anson.py3 0.2.2__tar.gz → 0.2.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.
Files changed (57) hide show
  1. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/workspace.xml +1 -0
  2. {anson_py3-0.2.2 → anson_py3-0.2.4}/PKG-INFO +1 -1
  3. {anson_py3-0.2.2 → anson_py3-0.2.4}/pyproject.toml +1 -1
  4. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/anson/io/odysz/common.py +3 -1
  5. anson_py3-0.2.4/src/anson/io/odysz/utils.py +67 -0
  6. {anson_py3-0.2.2 → anson_py3-0.2.4}/.gitignore +0 -0
  7. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/.gitignore +0 -0
  8. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/inspectionProfiles/Project_Default.xml +0 -0
  9. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  10. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/misc.xml +0 -0
  11. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/modules.xml +0 -0
  12. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/py3.iml +0 -0
  13. {anson_py3-0.2.2 → anson_py3-0.2.4}/.idea/vcs.xml +0 -0
  14. {anson_py3-0.2.2 → anson_py3-0.2.4}/.project +0 -0
  15. {anson_py3-0.2.2 → anson_py3-0.2.4}/.pydevproject +0 -0
  16. {anson_py3-0.2.2 → anson_py3-0.2.4}/LICENSE +0 -0
  17. {anson_py3-0.2.2 → anson_py3-0.2.4}/README.md +0 -0
  18. {anson_py3-0.2.2 → anson_py3-0.2.4}/__init__.py +0 -0
  19. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/__init__.py +0 -0
  20. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/anson/__init__.py +0 -0
  21. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/anson/io/__init__.py +0 -0
  22. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/anson/io/odysz/__init__.py +0 -0
  23. {anson_py3-0.2.2 → anson_py3-0.2.4}/src/anson/io/odysz/anson.py +0 -0
  24. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/__init__.py +0 -0
  25. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/ansontypes.py +0 -0
  26. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/hello.py.del +0 -0
  27. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/__init__.py +0 -0
  28. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/__init__.py +0 -0
  29. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/jclient.py +0 -0
  30. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/semantic/__init__.py +0 -0
  31. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/semantic/jprotocol.py +0 -0
  32. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/semantic/jserv/__init__.py +0 -0
  33. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/semantic/jserv/echo.py +0 -0
  34. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/odysz/semantic/syn.py +0 -0
  35. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/__init__.py +0 -0
  36. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/jserv/__init__.py +0 -0
  37. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/jserv/docs/__init__.py +0 -0
  38. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/jserv/docs/syn/__init__.py +0 -0
  39. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/jserv/docs/syn/singleton.py +0 -0
  40. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/io/oz/syn.py +0 -0
  41. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/json/01.json +0 -0
  42. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/json/registry/dictionary.json +0 -0
  43. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/json/registry/settings.json +0 -0
  44. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/json/registry/syntity.json +0 -0
  45. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/node.py +0 -0
  46. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/res/__version__.bat +0 -0
  47. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test.py +0 -0
  48. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/testFrom.py.del +0 -0
  49. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/testTo.py.del +0 -0
  50. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_00_Anson.py +0 -0
  51. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_01_Instance4Name.py +0 -0
  52. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_02_Ping.py +0 -0
  53. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_03_LangExt.py +0 -0
  54. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_04_YellowPages.py +0 -0
  55. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/test_05_Utils.py +0 -0
  56. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/testier/__init__.py +0 -0
  57. {anson_py3-0.2.2 → anson_py3-0.2.4}/test/testier/extra.py +0 -0
@@ -7,6 +7,7 @@
7
7
  <list default="true" id="8abd2f88-f467-4ea4-848e-e32bbaf197e2" name="Changes" comment="">
8
8
  <change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
9
9
  <change beforePath="$PROJECT_DIR$/src/anson/io/odysz/anson.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/anson/io/odysz/anson.py" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/test/res/__version__.bat" beforeDir="false" afterPath="$PROJECT_DIR$/test/res/__version__.bat" afterDir="false" />
10
11
  </list>
11
12
  <option name="SHOW_DIALOG" value="false" />
12
13
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anson.py3
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Anson for Python3
5
5
  Project-URL: Homepage, https://github.com/odys-z/antson
6
6
  Project-URL: Issues, https://github.com/odys-z/antson/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "anson.py3"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  authors = [
9
9
  { name="Ody Z", email="odys.zhou@gmail.com" },
10
10
  ]
@@ -126,6 +126,7 @@ class Utils:
126
126
  with open(file, 'r') as f:
127
127
  lines = f.readlines()
128
128
 
129
+ cnt = 0
129
130
  # updated_content = re.sub(pattern, repl, content)
130
131
  for i, line in enumerate(lines):
131
132
  updated = set()
@@ -134,6 +135,7 @@ class Utils:
134
135
  lines[i] = re.sub(k, v, line)
135
136
  updated.add(k)
136
137
  print('Updated line:', lines[i])
138
+ cnt += 1
137
139
 
138
140
  if len(updated) == len(patterns):
139
141
  break
@@ -141,7 +143,7 @@ class Utils:
141
143
  with open(file, 'w') as f:
142
144
  f.writelines(lines)
143
145
 
144
- print('JAR version updated successfully.', file)
146
+ print(f'[{cnt / len(patterns)}] lines updated. Patterns updating finsiedh.', file)
145
147
 
146
148
  return None
147
149
 
@@ -0,0 +1,67 @@
1
+ import fnmatch
2
+ import os
3
+ import re
4
+ import zipfile
5
+
6
+
7
+ def zip2(distzip, resources, exclude_patterns=[]):
8
+ """
9
+ example: zip2('registry-zsu.zip', {"zsu": "registry-deploy/*"}, ['*.zip'])
10
+ :param distzip:
11
+ :param resources:
12
+ :param exclude_patterns:
13
+ :return: None
14
+ """
15
+ def matches_patterns(filename, patterns):
16
+ """
17
+ Check if a filename matches any of the given patterns.
18
+
19
+ Args:
20
+ filename (str): The filename to check (e.g., "data.logs").
21
+ patterns (list): List of patterns (e.g., ["*.logs", "*.dat"]).
22
+
23
+ Returns:
24
+ bool: True if the filename matches any pattern, False otherwise.
25
+ """
26
+ return any(fnmatch.fnmatch(os.path.basename(filename), pattern) for pattern in patterns)
27
+
28
+ with zipfile.ZipFile(distzip, 'w', zipfile.ZIP_DEFLATED) as zipf:
29
+ err = False
30
+ # resources
31
+ for rk, rv in resources.items():
32
+ if "*" in rv:
33
+ count = 0
34
+ srcroot = re.sub('\\*$', '', rv.replace('\\', '/'))
35
+ for pth, _dir, fs in os.walk(srcroot):
36
+ for file in fs:
37
+ if not matches_patterns(file, exclude_patterns):
38
+ file_path = os.path.join(pth, file)
39
+ relative_path = os.path.relpath(file_path, srcroot)
40
+ # print(file, file_path, pth, srcroot, relative_path)
41
+
42
+ visited = set()
43
+ while os.path.islink(file_path):
44
+ if file_path in visited:
45
+ raise ValueError(f"Cycle detected in symbolic links at {relative_path}")
46
+ visited.add(file_path)
47
+ print(file_path, '->', os.path.realpath(file_path))
48
+ file_path = os.path.realpath(file_path)
49
+
50
+ relative_path = os.path.relpath(relative_path)
51
+ arcname = os.path.join(rk, relative_path)
52
+ zipf.write(file_path, arcname)
53
+ count += 1
54
+ print(f"Added to ZIP: {relative_path} as {arcname}")
55
+ if count == 0:
56
+ err = True
57
+ raise FileNotFoundError(f'[ERROR] No files found in {rv}.')
58
+ else: # Handle single files (jserv.jar and exiftool.exe)
59
+ file = rk if rv == '.' else rv
60
+ if os.path.exists(file):
61
+ zipf.write(file, rk)
62
+ print(f"Added to ZIP: {file} as {rk}")
63
+ else:
64
+ err = True
65
+ raise FileNotFoundError(f"[ERROR]: Resource '{rk}': '{file}' not found.")
66
+
67
+ print(f'Created ZIP file successfully: {distzip}' if not err else 'Errors while making target (creaded zip file)')
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