rdxz2-utill 0.0.2__tar.gz → 0.0.4__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.

Potentially problematic release.


This version of rdxz2-utill might be problematic. Click here for more details.

Files changed (41) hide show
  1. {rdxz2_utill-0.0.2/src/rdxz2_utill.egg-info → rdxz2_utill-0.0.4}/PKG-INFO +1 -1
  2. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/pyproject.toml +1 -1
  3. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4/src/rdxz2_utill.egg-info}/PKG-INFO +1 -1
  4. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/rdxz2_utill.egg-info/SOURCES.txt +1 -0
  5. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_bq.py +1 -3
  6. rdxz2_utill-0.0.4/src/utill/my_compare.py +34 -0
  7. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_csv.py +1 -0
  8. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_gcs.py +2 -0
  9. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_pg.py +1 -1
  10. rdxz2_utill-0.0.4/src/utill/templates/mb.json +5 -0
  11. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/templates/pg.json +2 -1
  12. rdxz2_utill-0.0.2/src/utill/templates/mb.json +0 -4
  13. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/LICENSE +0 -0
  14. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/README.md +0 -0
  15. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/setup.cfg +0 -0
  16. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/rdxz2_utill.egg-info/dependency_links.txt +0 -0
  17. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/rdxz2_utill.egg-info/entry_points.txt +0 -0
  18. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/rdxz2_utill.egg-info/requires.txt +0 -0
  19. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/rdxz2_utill.egg-info/top_level.txt +0 -0
  20. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/__init__.py +0 -0
  21. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/__init__.py +0 -0
  22. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/_bq.py +0 -0
  23. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/_conf.py +0 -0
  24. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/_enc.py +0 -0
  25. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/_main.py +0 -0
  26. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/_pg.py +0 -0
  27. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/cmd/utill.py +0 -0
  28. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_const.py +0 -0
  29. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_datetime.py +0 -0
  30. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_dict.py +0 -0
  31. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_encryption.py +0 -0
  32. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_env.py +0 -0
  33. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_file.py +0 -0
  34. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_input.py +0 -0
  35. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_json.py +0 -0
  36. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_mb.py +0 -0
  37. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_queue.py +0 -0
  38. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_string.py +0 -0
  39. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_style.py +0 -0
  40. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_tunnel.py +0 -0
  41. {rdxz2_utill-0.0.2 → rdxz2_utill-0.0.4}/src/utill/my_xlsx.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdxz2-utill
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Your daily Python utility
5
5
  Author-email: Richard Dharmawan <richard.dharmawan@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rdxz2-utill"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  authors = [
9
9
  { name="Richard Dharmawan", email="richard.dharmawan@gmail.com" },
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdxz2-utill
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Your daily Python utility
5
5
  Author-email: Richard Dharmawan <richard.dharmawan@gmail.com>
6
6
  License: MIT License
@@ -9,6 +9,7 @@ src/rdxz2_utill.egg-info/requires.txt
9
9
  src/rdxz2_utill.egg-info/top_level.txt
10
10
  src/utill/__init__.py
11
11
  src/utill/my_bq.py
12
+ src/utill/my_compare.py
12
13
  src/utill/my_const.py
13
14
  src/utill/my_csv.py
14
15
  src/utill/my_datetime.py
@@ -12,7 +12,6 @@ from .my_const import ByteSize
12
12
  from .my_csv import read_header, combine as csv_combine, compress
13
13
  from .my_datetime import current_datetime_str
14
14
  from .my_env import envs
15
- from .my_file import make_sure_path_is_directory
16
15
  from .my_gcs import GCS
17
16
  from .my_queue import ThreadingQ
18
17
  from .my_string import replace_nonnumeric
@@ -249,8 +248,7 @@ class BQ():
249
248
  if not dst_filename.endswith('.csv'):
250
249
  raise ValueError('Destination filename must ends with .csv!')
251
250
 
252
- dirname = os.path.dirname(dst_filename)
253
- make_sure_path_is_directory(dirname)
251
+ dirname = dst_filename.removesuffix('.csv')
254
252
 
255
253
  # Remove & recreate existing folder
256
254
  if os.path.exists(dirname):
@@ -0,0 +1,34 @@
1
+ import math
2
+
3
+
4
+ def try_float(value) -> float:
5
+ try:
6
+ return float(value)
7
+ except:
8
+ return value
9
+
10
+
11
+ def same(a, b, float_precision=None) -> tuple[bool, float]:
12
+ if a is None and b is None:
13
+ return True, None
14
+
15
+ if a is None or b is None:
16
+ return False, None
17
+
18
+ # Compare float
19
+ a_float = try_float(a)
20
+ b_float = try_float(b)
21
+ if isinstance(a_float, float) or isinstance(b_float, float):
22
+ try:
23
+ if math.isnan(a_float) and math.isnan(b_float):
24
+ return True, None
25
+
26
+ if float_precision:
27
+ a_float_rounded = round(a_float, float_precision)
28
+ b_float_rounded = round(b_float, float_precision)
29
+
30
+ return a_float_rounded == b_float_rounded, abs(a_float - b_float)
31
+ except (ValueError, TypeError):
32
+ raise Exception(f'Can\'t compare {a} to {b}')
33
+
34
+ return str(a) == str(b), None
@@ -81,6 +81,7 @@ def combine(src_filenames: list[str], dst_filename: str) -> None:
81
81
  # Copy the header if this is the first file
82
82
  if first_file:
83
83
  csvwriter.writerow(next(csvreader))
84
+ first_file = False
84
85
  # Else, skip the header
85
86
  else:
86
87
  next(csvreader)
@@ -30,6 +30,8 @@ class GCS:
30
30
  return f'{self.base_path}/{path}' if self.base_path else path
31
31
 
32
32
  def change_bucket(self, bucket_name: str):
33
+ if not bucket_name:
34
+ raise ValueError('Bucket name needed')
33
35
  self.bucket = self.client.bucket(bucket_name)
34
36
  logger.debug(f'Change bucket to {self.bucket.name}')
35
37
 
@@ -24,7 +24,7 @@ class PG:
24
24
  ) -> None:
25
25
  # Evaluate config source
26
26
  if isinstance(config_source, str):
27
- if os.path.exists(config_source):
27
+ if not os.path.exists(config_source):
28
28
  raise ValueError(f'Config source file not found: {config_source}, create one with \'utill init\'')
29
29
  if connection is None:
30
30
  raise ValueError('Connection name must be provided when using file source!')
@@ -0,0 +1,5 @@
1
+ {
2
+ "base_url": "xxx",
3
+ "api_key": "xxx",
4
+ "end": true
5
+ }
@@ -9,5 +9,6 @@
9
9
  "db": "xxx",
10
10
  "username": "xxx",
11
11
  "password": "xxx"
12
- }
12
+ },
13
+ "end": true
13
14
  }
@@ -1,4 +0,0 @@
1
- {
2
- "base_url": "xxx",
3
- "api_key": "xxx"
4
- }
File without changes
File without changes
File without changes