casbin-async-django-orm-adapter 1.0.0__py3-none-any.whl

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 (74) hide show
  1. async_casbin_adapter/__init__.py +0 -0
  2. async_casbin_adapter/adapter.py +100 -0
  3. async_casbin_adapter/apps.py +24 -0
  4. async_casbin_adapter/enforcer.py +81 -0
  5. async_casbin_adapter/migrations/0001_initial.py +37 -0
  6. async_casbin_adapter/migrations/__init__.py +0 -0
  7. async_casbin_adapter/models.py +48 -0
  8. async_casbin_adapter/utils.py +25 -0
  9. casbin_async_django_orm_adapter-1.0.0.dist-info/METADATA +116 -0
  10. casbin_async_django_orm_adapter-1.0.0.dist-info/RECORD +74 -0
  11. casbin_async_django_orm_adapter-1.0.0.dist-info/WHEEL +5 -0
  12. casbin_async_django_orm_adapter-1.0.0.dist-info/licenses/LICENSE +201 -0
  13. casbin_async_django_orm_adapter-1.0.0.dist-info/top_level.txt +3 -0
  14. node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py +45 -0
  15. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +365 -0
  16. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
  17. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1272 -0
  18. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
  19. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
  20. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +152 -0
  21. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +270 -0
  22. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
  23. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +704 -0
  24. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py +709 -0
  25. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +173 -0
  26. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +169 -0
  27. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +113 -0
  28. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
  29. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
  30. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +805 -0
  31. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1172 -0
  32. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1319 -0
  33. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +128 -0
  34. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +104 -0
  35. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +462 -0
  36. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
  37. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +56 -0
  38. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2745 -0
  39. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3976 -0
  40. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
  41. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2965 -0
  42. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +67 -0
  43. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1391 -0
  44. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +26 -0
  45. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +3112 -0
  46. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +99 -0
  47. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +767 -0
  48. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1260 -0
  49. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
  50. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
  51. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +373 -0
  52. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
  53. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +54 -0
  54. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +303 -0
  55. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3196 -0
  56. node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
  57. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +15 -0
  58. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +108 -0
  59. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +252 -0
  60. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +83 -0
  61. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +359 -0
  62. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +61 -0
  63. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +192 -0
  64. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py +252 -0
  65. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +825 -0
  66. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
  67. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +90 -0
  68. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +1030 -0
  69. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py +553 -0
  70. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py +172 -0
  71. node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py +563 -0
  72. node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py +261 -0
  73. node_modules/semantic-release-pypi/dist/py/set_version.py +32 -0
  74. node_modules/semantic-release-pypi/dist/py/verify_setup.py +24 -0
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Unit tests for the xcode_emulation.py file."""
4
+
5
+ import sys
6
+ import unittest
7
+
8
+ from gyp.xcode_emulation import XcodeSettings
9
+
10
+
11
+ class TestXcodeSettings(unittest.TestCase):
12
+ def setUp(self):
13
+ if sys.platform != "darwin":
14
+ self.skipTest("This test only runs on macOS")
15
+
16
+ def test_GetCflags(self):
17
+ target = {
18
+ "type": "static_library",
19
+ "configurations": {
20
+ "Release": {},
21
+ },
22
+ }
23
+ configuration_name = "Release"
24
+ xcode_settings = XcodeSettings(target)
25
+ cflags = xcode_settings.GetCflags(configuration_name, "arm64")
26
+
27
+ # Do not quote `-arch arm64` with spaces in one string.
28
+ self.assertEqual(
29
+ cflags,
30
+ ["-fasm-blocks", "-mpascal-strings", "-Os", "-gdwarf-2", "-arch", "arm64"],
31
+ )
32
+
33
+ def GypToBuildPath(self, path):
34
+ return path
35
+
36
+ def test_GetLdflags(self):
37
+ target = {
38
+ "type": "static_library",
39
+ "configurations": {
40
+ "Release": {},
41
+ },
42
+ }
43
+ configuration_name = "Release"
44
+ xcode_settings = XcodeSettings(target)
45
+ ldflags = xcode_settings.GetLdflags(
46
+ configuration_name, "PRODUCT_DIR", self.GypToBuildPath, "arm64"
47
+ )
48
+
49
+ # Do not quote `-arch arm64` with spaces in one string.
50
+ self.assertEqual(ldflags, ["-arch", "arm64", "-LPRODUCT_DIR"])
51
+
52
+
53
+ if __name__ == "__main__":
54
+ unittest.main()
@@ -0,0 +1,303 @@
1
+ # Copyright (c) 2014 Google Inc. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style license that can be
3
+ # found in the LICENSE file.
4
+
5
+ """Xcode-ninja wrapper project file generator.
6
+
7
+ This updates the data structures passed to the Xcode gyp generator to build
8
+ with ninja instead. The Xcode project itself is transformed into a list of
9
+ executable targets, each with a build step to build with ninja, and a target
10
+ with every source and resource file. This appears to sidestep some of the
11
+ major performance headaches experienced using complex projects and large number
12
+ of targets within Xcode.
13
+ """
14
+
15
+ import errno
16
+ import os
17
+ import re
18
+ import xml.sax.saxutils
19
+
20
+ import gyp.generator.ninja
21
+
22
+
23
+ def _WriteWorkspace(main_gyp, sources_gyp, params):
24
+ """ Create a workspace to wrap main and sources gyp paths. """
25
+ (build_file_root, build_file_ext) = os.path.splitext(main_gyp)
26
+ workspace_path = build_file_root + ".xcworkspace"
27
+ options = params["options"]
28
+ if options.generator_output:
29
+ workspace_path = os.path.join(options.generator_output, workspace_path)
30
+ try:
31
+ os.makedirs(workspace_path)
32
+ except OSError as e:
33
+ if e.errno != errno.EEXIST:
34
+ raise
35
+ output_string = (
36
+ '<?xml version="1.0" encoding="UTF-8"?>\n' + '<Workspace version = "1.0">\n'
37
+ )
38
+ for gyp_name in [main_gyp, sources_gyp]:
39
+ name = os.path.splitext(os.path.basename(gyp_name))[0] + ".xcodeproj"
40
+ name = xml.sax.saxutils.quoteattr("group:" + name)
41
+ output_string += " <FileRef location = %s></FileRef>\n" % name
42
+ output_string += "</Workspace>\n"
43
+
44
+ workspace_file = os.path.join(workspace_path, "contents.xcworkspacedata")
45
+
46
+ try:
47
+ with open(workspace_file) as input_file:
48
+ input_string = input_file.read()
49
+ if input_string == output_string:
50
+ return
51
+ except OSError:
52
+ # Ignore errors if the file doesn't exist.
53
+ pass
54
+
55
+ with open(workspace_file, "w") as output_file:
56
+ output_file.write(output_string)
57
+
58
+
59
+ def _TargetFromSpec(old_spec, params):
60
+ """ Create fake target for xcode-ninja wrapper. """
61
+ # Determine ninja top level build dir (e.g. /path/to/out).
62
+ ninja_toplevel = None
63
+ jobs = 0
64
+ if params:
65
+ options = params["options"]
66
+ ninja_toplevel = os.path.join(
67
+ options.toplevel_dir, gyp.generator.ninja.ComputeOutputDir(params)
68
+ )
69
+ jobs = params.get("generator_flags", {}).get("xcode_ninja_jobs", 0)
70
+
71
+ target_name = old_spec.get("target_name")
72
+ product_name = old_spec.get("product_name", target_name)
73
+ product_extension = old_spec.get("product_extension")
74
+
75
+ ninja_target = {}
76
+ ninja_target["target_name"] = target_name
77
+ ninja_target["product_name"] = product_name
78
+ if product_extension:
79
+ ninja_target["product_extension"] = product_extension
80
+ ninja_target["toolset"] = old_spec.get("toolset")
81
+ ninja_target["default_configuration"] = old_spec.get("default_configuration")
82
+ ninja_target["configurations"] = {}
83
+
84
+ # Tell Xcode to look in |ninja_toplevel| for build products.
85
+ new_xcode_settings = {}
86
+ if ninja_toplevel:
87
+ new_xcode_settings["CONFIGURATION_BUILD_DIR"] = (
88
+ "%s/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)" % ninja_toplevel
89
+ )
90
+
91
+ if "configurations" in old_spec:
92
+ for config in old_spec["configurations"]:
93
+ old_xcode_settings = old_spec["configurations"][config].get(
94
+ "xcode_settings", {}
95
+ )
96
+ if "IPHONEOS_DEPLOYMENT_TARGET" in old_xcode_settings:
97
+ new_xcode_settings["CODE_SIGNING_REQUIRED"] = "NO"
98
+ new_xcode_settings["IPHONEOS_DEPLOYMENT_TARGET"] = old_xcode_settings[
99
+ "IPHONEOS_DEPLOYMENT_TARGET"
100
+ ]
101
+ for key in ["BUNDLE_LOADER", "TEST_HOST"]:
102
+ if key in old_xcode_settings:
103
+ new_xcode_settings[key] = old_xcode_settings[key]
104
+
105
+ ninja_target["configurations"][config] = {}
106
+ ninja_target["configurations"][config][
107
+ "xcode_settings"
108
+ ] = new_xcode_settings
109
+
110
+ ninja_target["mac_bundle"] = old_spec.get("mac_bundle", 0)
111
+ ninja_target["mac_xctest_bundle"] = old_spec.get("mac_xctest_bundle", 0)
112
+ ninja_target["ios_app_extension"] = old_spec.get("ios_app_extension", 0)
113
+ ninja_target["ios_watchkit_extension"] = old_spec.get("ios_watchkit_extension", 0)
114
+ ninja_target["ios_watchkit_app"] = old_spec.get("ios_watchkit_app", 0)
115
+ ninja_target["type"] = old_spec["type"]
116
+ if ninja_toplevel:
117
+ ninja_target["actions"] = [
118
+ {
119
+ "action_name": "Compile and copy %s via ninja" % target_name,
120
+ "inputs": [],
121
+ "outputs": [],
122
+ "action": [
123
+ "env",
124
+ "PATH=%s" % os.environ["PATH"],
125
+ "ninja",
126
+ "-C",
127
+ new_xcode_settings["CONFIGURATION_BUILD_DIR"],
128
+ target_name,
129
+ ],
130
+ "message": "Compile and copy %s via ninja" % target_name,
131
+ },
132
+ ]
133
+ if jobs > 0:
134
+ ninja_target["actions"][0]["action"].extend(("-j", jobs))
135
+ return ninja_target
136
+
137
+
138
+ def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):
139
+ """Limit targets for Xcode wrapper.
140
+
141
+ Xcode sometimes performs poorly with too many targets, so only include
142
+ proper executable targets, with filters to customize.
143
+ Arguments:
144
+ target_extras: Regular expression to always add, matching any target.
145
+ executable_target_pattern: Regular expression limiting executable targets.
146
+ spec: Specifications for target.
147
+ """
148
+ target_name = spec.get("target_name")
149
+ # Always include targets matching target_extras.
150
+ if target_extras is not None and re.search(target_extras, target_name):
151
+ return True
152
+
153
+ # Otherwise just show executable targets and xc_tests.
154
+ if int(spec.get("mac_xctest_bundle", 0)) != 0 or (
155
+ spec.get("type", "") == "executable"
156
+ and spec.get("product_extension", "") != "bundle"
157
+ ):
158
+
159
+ # If there is a filter and the target does not match, exclude the target.
160
+ if executable_target_pattern is not None:
161
+ if not re.search(executable_target_pattern, target_name):
162
+ return False
163
+ return True
164
+ return False
165
+
166
+
167
+ def CreateWrapper(target_list, target_dicts, data, params):
168
+ """Initialize targets for the ninja wrapper.
169
+
170
+ This sets up the necessary variables in the targets to generate Xcode projects
171
+ that use ninja as an external builder.
172
+ Arguments:
173
+ target_list: List of target pairs: 'base/base.gyp:base'.
174
+ target_dicts: Dict of target properties keyed on target pair.
175
+ data: Dict of flattened build files keyed on gyp path.
176
+ params: Dict of global options for gyp.
177
+ """
178
+ orig_gyp = params["build_files"][0]
179
+ for gyp_name, gyp_dict in data.items():
180
+ if gyp_name == orig_gyp:
181
+ depth = gyp_dict["_DEPTH"]
182
+
183
+ # Check for custom main gyp name, otherwise use the default CHROMIUM_GYP_FILE
184
+ # and prepend .ninja before the .gyp extension.
185
+ generator_flags = params.get("generator_flags", {})
186
+ main_gyp = generator_flags.get("xcode_ninja_main_gyp", None)
187
+ if main_gyp is None:
188
+ (build_file_root, build_file_ext) = os.path.splitext(orig_gyp)
189
+ main_gyp = build_file_root + ".ninja" + build_file_ext
190
+
191
+ # Create new |target_list|, |target_dicts| and |data| data structures.
192
+ new_target_list = []
193
+ new_target_dicts = {}
194
+ new_data = {}
195
+
196
+ # Set base keys needed for |data|.
197
+ new_data[main_gyp] = {}
198
+ new_data[main_gyp]["included_files"] = []
199
+ new_data[main_gyp]["targets"] = []
200
+ new_data[main_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {})
201
+
202
+ # Normally the xcode-ninja generator includes only valid executable targets.
203
+ # If |xcode_ninja_executable_target_pattern| is set, that list is reduced to
204
+ # executable targets that match the pattern. (Default all)
205
+ executable_target_pattern = generator_flags.get(
206
+ "xcode_ninja_executable_target_pattern", None
207
+ )
208
+
209
+ # For including other non-executable targets, add the matching target name
210
+ # to the |xcode_ninja_target_pattern| regular expression. (Default none)
211
+ target_extras = generator_flags.get("xcode_ninja_target_pattern", None)
212
+
213
+ for old_qualified_target in target_list:
214
+ spec = target_dicts[old_qualified_target]
215
+ if IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):
216
+ # Add to new_target_list.
217
+ target_name = spec.get("target_name")
218
+ new_target_name = f"{main_gyp}:{target_name}#target"
219
+ new_target_list.append(new_target_name)
220
+
221
+ # Add to new_target_dicts.
222
+ new_target_dicts[new_target_name] = _TargetFromSpec(spec, params)
223
+
224
+ # Add to new_data.
225
+ for old_target in data[old_qualified_target.split(":")[0]]["targets"]:
226
+ if old_target["target_name"] == target_name:
227
+ new_data_target = {}
228
+ new_data_target["target_name"] = old_target["target_name"]
229
+ new_data_target["toolset"] = old_target["toolset"]
230
+ new_data[main_gyp]["targets"].append(new_data_target)
231
+
232
+ # Create sources target.
233
+ sources_target_name = "sources_for_indexing"
234
+ sources_target = _TargetFromSpec(
235
+ {
236
+ "target_name": sources_target_name,
237
+ "toolset": "target",
238
+ "default_configuration": "Default",
239
+ "mac_bundle": "0",
240
+ "type": "executable",
241
+ },
242
+ None,
243
+ )
244
+
245
+ # Tell Xcode to look everywhere for headers.
246
+ sources_target["configurations"] = {"Default": {"include_dirs": [depth]}}
247
+
248
+ # Put excluded files into the sources target so they can be opened in Xcode.
249
+ skip_excluded_files = not generator_flags.get(
250
+ "xcode_ninja_list_excluded_files", True
251
+ )
252
+
253
+ sources = []
254
+ for target, target_dict in target_dicts.items():
255
+ base = os.path.dirname(target)
256
+ files = target_dict.get("sources", []) + target_dict.get(
257
+ "mac_bundle_resources", []
258
+ )
259
+
260
+ if not skip_excluded_files:
261
+ files.extend(
262
+ target_dict.get("sources_excluded", [])
263
+ + target_dict.get("mac_bundle_resources_excluded", [])
264
+ )
265
+
266
+ for action in target_dict.get("actions", []):
267
+ files.extend(action.get("inputs", []))
268
+
269
+ if not skip_excluded_files:
270
+ files.extend(action.get("inputs_excluded", []))
271
+
272
+ # Remove files starting with $. These are mostly intermediate files for the
273
+ # build system.
274
+ files = [file for file in files if not file.startswith("$")]
275
+
276
+ # Make sources relative to root build file.
277
+ relative_path = os.path.dirname(main_gyp)
278
+ sources += [
279
+ os.path.relpath(os.path.join(base, file), relative_path) for file in files
280
+ ]
281
+
282
+ sources_target["sources"] = sorted(set(sources))
283
+
284
+ # Put sources_to_index in it's own gyp.
285
+ sources_gyp = os.path.join(os.path.dirname(main_gyp), sources_target_name + ".gyp")
286
+ fully_qualified_target_name = f"{sources_gyp}:{sources_target_name}#target"
287
+
288
+ # Add to new_target_list, new_target_dicts and new_data.
289
+ new_target_list.append(fully_qualified_target_name)
290
+ new_target_dicts[fully_qualified_target_name] = sources_target
291
+ new_data_target = {}
292
+ new_data_target["target_name"] = sources_target["target_name"]
293
+ new_data_target["_DEPTH"] = depth
294
+ new_data_target["toolset"] = "target"
295
+ new_data[sources_gyp] = {}
296
+ new_data[sources_gyp]["targets"] = []
297
+ new_data[sources_gyp]["included_files"] = []
298
+ new_data[sources_gyp]["xcode_settings"] = data[orig_gyp].get("xcode_settings", {})
299
+ new_data[sources_gyp]["targets"].append(new_data_target)
300
+
301
+ # Write workspace to file.
302
+ _WriteWorkspace(main_gyp, sources_gyp, params)
303
+ return (new_target_list, new_target_dicts, new_data)