pathpilot 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pathpilot-0.4.0 → pathpilot-0.4.2}/PKG-INFO +1 -1
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/__init__.py +1 -1
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/base/df_dispatch_file.py +2 -2
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_excel.py +17 -15
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/_contents/base.py +3 -7
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pyproject.toml +1 -1
- {pathpilot-0.4.0 → pathpilot-0.4.2}/LICENSE +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/README.md +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/_utils.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/base/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/base/_decorators.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/base/core.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_csv.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_parquet.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_pickle.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_sqlite.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_text.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/kinds/_zip.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_file/utils.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/backup.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/_contents/__init__.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/_contents/files.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/_contents/subfolders.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/folder/core.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_folder/utils.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/_utils.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/config.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/core.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/decorators.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/exceptions.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/path.py +0 -0
- {pathpilot-0.4.0 → pathpilot-0.4.2}/pathpilot/utils.py +0 -0
|
@@ -31,7 +31,7 @@ class DfDispatchFile(File):
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
@inject_df_backend
|
|
34
|
-
def _save(self, obj, df_backend, **kwargs):
|
|
34
|
+
def _save(self, obj=None, df_backend=None, **kwargs):
|
|
35
35
|
|
|
36
36
|
if df_backend == 'pandas':
|
|
37
37
|
cast_func = odd.to_pandas_frame
|
|
@@ -40,7 +40,7 @@ class DfDispatchFile(File):
|
|
|
40
40
|
cast_func = odd.to_polars_frame
|
|
41
41
|
save_func = self._save_with_polars
|
|
42
42
|
|
|
43
|
-
if _is_frame(obj):
|
|
43
|
+
if obj is not None and _is_frame(obj):
|
|
44
44
|
obj = cast_func(obj)
|
|
45
45
|
|
|
46
46
|
save_func(obj, **kwargs)
|
|
@@ -160,6 +160,7 @@ class ExcelFile(DfDispatchFile):
|
|
|
160
160
|
def __init__(self, parent):
|
|
161
161
|
self._parent = parent
|
|
162
162
|
self._reset()
|
|
163
|
+
print(parent.name_ext + ':')
|
|
163
164
|
|
|
164
165
|
|
|
165
166
|
@property
|
|
@@ -325,9 +326,6 @@ class ExcelFile(DfDispatchFile):
|
|
|
325
326
|
|
|
326
327
|
@cached_property
|
|
327
328
|
def writer(self):
|
|
328
|
-
if self.verbose:
|
|
329
|
-
print(self.name_ext + ':')
|
|
330
|
-
|
|
331
329
|
return pd.ExcelWriter(self.path)
|
|
332
330
|
|
|
333
331
|
|
|
@@ -341,7 +339,7 @@ class ExcelFile(DfDispatchFile):
|
|
|
341
339
|
|
|
342
340
|
header_body_presets = {
|
|
343
341
|
'text_wrap': True,
|
|
344
|
-
'border':
|
|
342
|
+
'border': 1,
|
|
345
343
|
'align': 'left',
|
|
346
344
|
'valign': 'top'
|
|
347
345
|
}
|
|
@@ -374,14 +372,14 @@ class ExcelFile(DfDispatchFile):
|
|
|
374
372
|
# 'datetime': {'num_format': 'mm/dd/yyyy hh:mm:ss.000 AM/PM'},
|
|
375
373
|
|
|
376
374
|
# Border
|
|
377
|
-
'top': {'top':
|
|
378
|
-
'bottom': {'bottom':
|
|
379
|
-
'left': {'left':
|
|
380
|
-
'right': {'right':
|
|
375
|
+
'top': {'top': 1},
|
|
376
|
+
'bottom': {'bottom': 1},
|
|
377
|
+
'left': {'left': 1},
|
|
378
|
+
'right': {'right': 1},
|
|
381
379
|
|
|
382
380
|
# Headers
|
|
383
381
|
'pandas_header': {
|
|
384
|
-
'border':
|
|
382
|
+
'border': 1,
|
|
385
383
|
'align': 'center',
|
|
386
384
|
'valign': 'vcenter',
|
|
387
385
|
'bold': True
|
|
@@ -390,7 +388,7 @@ class ExcelFile(DfDispatchFile):
|
|
|
390
388
|
'black_header': {
|
|
391
389
|
'text_wrap': True,
|
|
392
390
|
'fg_color': 'black',
|
|
393
|
-
'border':
|
|
391
|
+
'border': 1,
|
|
394
392
|
'align': 'center',
|
|
395
393
|
'valign': 'vcenter',
|
|
396
394
|
'bold': True,
|
|
@@ -403,13 +401,13 @@ class ExcelFile(DfDispatchFile):
|
|
|
403
401
|
|
|
404
402
|
# Miscellaneous
|
|
405
403
|
'default_merge': {
|
|
406
|
-
'border':
|
|
404
|
+
'border': 1,
|
|
407
405
|
'align': 'top',
|
|
408
406
|
'text_wrap': True
|
|
409
407
|
},
|
|
410
408
|
|
|
411
409
|
'gold_wrap': {
|
|
412
|
-
'border':
|
|
410
|
+
'border': 1,
|
|
413
411
|
'align': 'top',
|
|
414
412
|
'text_wrap': True,
|
|
415
413
|
'fg_color': '#FFE265'
|
|
@@ -1177,7 +1175,7 @@ class ExcelFile(DfDispatchFile):
|
|
|
1177
1175
|
start_cell = start_cell.format(**header_to_column_map)
|
|
1178
1176
|
formula = formula.format(**header_to_column_map)
|
|
1179
1177
|
|
|
1180
|
-
components = list(set(re.findall('([a-zA-Z]+)(\d+)', formula)))
|
|
1178
|
+
components = list(set(re.findall(r'([a-zA-Z]+)(\d+)', formula)))
|
|
1181
1179
|
cols, rows = zip(*components)
|
|
1182
1180
|
cols = [self.get_column_index(x) + 1 for x in cols]
|
|
1183
1181
|
rows = [int(x) for x in rows]
|
|
@@ -1268,7 +1266,8 @@ class ExcelFile(DfDispatchFile):
|
|
|
1268
1266
|
)
|
|
1269
1267
|
|
|
1270
1268
|
fmt = dict()
|
|
1271
|
-
for k in name:
|
|
1269
|
+
for k in name:
|
|
1270
|
+
fmt.update(self.formats[k])
|
|
1272
1271
|
name = '_'.join(odd.natural_sort(name))
|
|
1273
1272
|
else:
|
|
1274
1273
|
if not isinstance(name, str):
|
|
@@ -1495,7 +1494,10 @@ class ExcelFile(DfDispatchFile):
|
|
|
1495
1494
|
# apply default parameters
|
|
1496
1495
|
defaults = {
|
|
1497
1496
|
'dtype_formats': {pl.Date: 'mm/dd/yyyy'},
|
|
1497
|
+
'header_format': self.formats['pandas_header'],
|
|
1498
1498
|
'float_precision': 2,
|
|
1499
|
+
'include_header': True,
|
|
1500
|
+
'autofilter': True,
|
|
1499
1501
|
'autofit': True,
|
|
1500
1502
|
}
|
|
1501
1503
|
|
|
@@ -1513,7 +1515,7 @@ class ExcelFile(DfDispatchFile):
|
|
|
1513
1515
|
df = normalize_if_lossless(
|
|
1514
1516
|
df=df,
|
|
1515
1517
|
selector=selector,
|
|
1516
|
-
expr=((selector
|
|
1518
|
+
expr=((selector % 1) == 0),
|
|
1517
1519
|
dtype=pl.Int64
|
|
1518
1520
|
)
|
|
1519
1521
|
|
|
@@ -135,8 +135,7 @@ class FolderContents(object):
|
|
|
135
135
|
------------
|
|
136
136
|
name_pattern : str
|
|
137
137
|
If not None, only object names meeting this pattern will be
|
|
138
|
-
considered candidates.
|
|
139
|
-
pd.Series.str.contains 'pat' argument.
|
|
138
|
+
considered candidates.
|
|
140
139
|
name_literal
|
|
141
140
|
Determines how 'name_pattern' is interpreted:
|
|
142
141
|
• True → literal string
|
|
@@ -157,17 +156,14 @@ class FolderContents(object):
|
|
|
157
156
|
There are a few scenarios to consider:
|
|
158
157
|
• 'date_pattern' is None → an attempt will be made to derive
|
|
159
158
|
the regex pattern using 'date_format' as the template.
|
|
160
|
-
• 'date_pattern' is not None → 'date_format' is optional
|
|
161
|
-
it can be included if you do not want to rely on
|
|
162
|
-
pd.to_datetime inferring the format.
|
|
159
|
+
• 'date_pattern' is not None → 'date_format' is optional.
|
|
163
160
|
|
|
164
161
|
Example:
|
|
165
162
|
------------
|
|
166
163
|
Dealing with the same example from above, all the following
|
|
167
164
|
combinations will achieve the same result since the None values
|
|
168
165
|
being inferred:
|
|
169
|
-
• date_pattern=r'\d{4}\-\d{2}\-\d{2}',
|
|
170
|
-
date_format='%Y-%m-%d'
|
|
166
|
+
• date_pattern=r'\d{4}\-\d{2}\-\d{2}', date_format='%Y-%m-%d'
|
|
171
167
|
• date_pattern=None, date_format='%Y-%m-%d'
|
|
172
168
|
• date_pattern=r'\d{4}\-\d{2}\-\d{2}', date_format=None
|
|
173
169
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|