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.
- async_casbin_adapter/__init__.py +0 -0
- async_casbin_adapter/adapter.py +100 -0
- async_casbin_adapter/apps.py +24 -0
- async_casbin_adapter/enforcer.py +81 -0
- async_casbin_adapter/migrations/0001_initial.py +37 -0
- async_casbin_adapter/migrations/__init__.py +0 -0
- async_casbin_adapter/models.py +48 -0
- async_casbin_adapter/utils.py +25 -0
- casbin_async_django_orm_adapter-1.0.0.dist-info/METADATA +116 -0
- casbin_async_django_orm_adapter-1.0.0.dist-info/RECORD +74 -0
- casbin_async_django_orm_adapter-1.0.0.dist-info/WHEEL +5 -0
- casbin_async_django_orm_adapter-1.0.0.dist-info/licenses/LICENSE +201 -0
- casbin_async_django_orm_adapter-1.0.0.dist-info/top_level.txt +3 -0
- node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py +45 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +365 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +206 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +1272 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +1547 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +59 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +152 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +270 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +574 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +704 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py +709 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +173 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +169 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +113 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +55 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +805 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +1172 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +1319 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +128 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +104 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +462 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +89 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +56 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +2745 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +3976 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +44 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2965 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +67 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +1391 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +26 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py +3112 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +99 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +767 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1260 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +174 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +61 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +373 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +1939 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +54 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +303 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +3196 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +65 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +15 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +108 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +252 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +83 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +359 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +61 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +192 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/markers.py +252 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +825 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +90 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +1030 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/tags.py +553 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/utils.py +172 -0
- node_modules/npm/node_modules/node-gyp/gyp/pylib/packaging/version.py +563 -0
- node_modules/npm/node_modules/node-gyp/gyp/test_gyp.py +261 -0
- node_modules/semantic-release-pypi/dist/py/set_version.py +32 -0
- node_modules/semantic-release-pypi/dist/py/verify_setup.py +24 -0
File without changes
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# This file is dual licensed under the terms of the Apache License, Version
|
2
|
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
3
|
+
# for complete details.
|
4
|
+
|
5
|
+
from typing import Any, Iterator, Optional, Set
|
6
|
+
|
7
|
+
from ._parser import parse_requirement as _parse_requirement
|
8
|
+
from ._tokenizer import ParserSyntaxError
|
9
|
+
from .markers import Marker, _normalize_extra_values
|
10
|
+
from .specifiers import SpecifierSet
|
11
|
+
from .utils import canonicalize_name
|
12
|
+
|
13
|
+
|
14
|
+
class InvalidRequirement(ValueError):
|
15
|
+
"""
|
16
|
+
An invalid requirement was found, users should refer to PEP 508.
|
17
|
+
"""
|
18
|
+
|
19
|
+
|
20
|
+
class Requirement:
|
21
|
+
"""Parse a requirement.
|
22
|
+
|
23
|
+
Parse a given requirement string into its parts, such as name, specifier,
|
24
|
+
URL, and extras. Raises InvalidRequirement on a badly-formed requirement
|
25
|
+
string.
|
26
|
+
"""
|
27
|
+
|
28
|
+
# TODO: Can we test whether something is contained within a requirement?
|
29
|
+
# If so how do we do that? Do we need to test against the _name_ of
|
30
|
+
# the thing as well as the version? What about the markers?
|
31
|
+
# TODO: Can we normalize the name and extra name?
|
32
|
+
|
33
|
+
def __init__(self, requirement_string: str) -> None:
|
34
|
+
try:
|
35
|
+
parsed = _parse_requirement(requirement_string)
|
36
|
+
except ParserSyntaxError as e:
|
37
|
+
raise InvalidRequirement(str(e)) from e
|
38
|
+
|
39
|
+
self.name: str = parsed.name
|
40
|
+
self.url: Optional[str] = parsed.url or None
|
41
|
+
self.extras: Set[str] = set(parsed.extras if parsed.extras else [])
|
42
|
+
self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
|
43
|
+
self.marker: Optional[Marker] = None
|
44
|
+
if parsed.marker is not None:
|
45
|
+
self.marker = Marker.__new__(Marker)
|
46
|
+
self.marker._markers = _normalize_extra_values(parsed.marker)
|
47
|
+
|
48
|
+
def _iter_parts(self, name: str) -> Iterator[str]:
|
49
|
+
yield name
|
50
|
+
|
51
|
+
if self.extras:
|
52
|
+
formatted_extras = ",".join(sorted(self.extras))
|
53
|
+
yield f"[{formatted_extras}]"
|
54
|
+
|
55
|
+
if self.specifier:
|
56
|
+
yield str(self.specifier)
|
57
|
+
|
58
|
+
if self.url:
|
59
|
+
yield f"@ {self.url}"
|
60
|
+
if self.marker:
|
61
|
+
yield " "
|
62
|
+
|
63
|
+
if self.marker:
|
64
|
+
yield f"; {self.marker}"
|
65
|
+
|
66
|
+
def __str__(self) -> str:
|
67
|
+
return "".join(self._iter_parts(self.name))
|
68
|
+
|
69
|
+
def __repr__(self) -> str:
|
70
|
+
return f"<Requirement('{self}')>"
|
71
|
+
|
72
|
+
def __hash__(self) -> int:
|
73
|
+
return hash(
|
74
|
+
(
|
75
|
+
self.__class__.__name__,
|
76
|
+
*self._iter_parts(canonicalize_name(self.name)),
|
77
|
+
)
|
78
|
+
)
|
79
|
+
|
80
|
+
def __eq__(self, other: Any) -> bool:
|
81
|
+
if not isinstance(other, Requirement):
|
82
|
+
return NotImplemented
|
83
|
+
|
84
|
+
return (
|
85
|
+
canonicalize_name(self.name) == canonicalize_name(other.name)
|
86
|
+
and self.extras == other.extras
|
87
|
+
and self.specifier == other.specifier
|
88
|
+
and self.url == other.url
|
89
|
+
and self.marker == other.marker
|
90
|
+
)
|