omlish 0.0.0.dev24__py3-none-any.whl → 0.0.0.dev26__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.
- omlish/__about__.py +20 -4
- omlish/_manifests.json +1 -0
- omlish/bootstrap/diag.py +25 -0
- omlish/bootstrap/harness.py +3 -2
- omlish/check.py +1 -1
- omlish/collections/__init__.py +1 -0
- omlish/collections/utils.py +7 -2
- omlish/dataclasses/__init__.py +4 -4
- omlish/dataclasses/impl/LICENSE +279 -0
- omlish/dataclasses/impl/api.py +5 -3
- omlish/dataclasses/impl/exceptions.py +2 -2
- omlish/dataclasses/impl/fields.py +7 -4
- omlish/dataclasses/impl/init.py +8 -8
- omlish/dataclasses/impl/metadata.py +3 -3
- omlish/dataclasses/impl/params.py +4 -3
- omlish/diag/replserver/server.py +17 -2
- omlish/docker.py +74 -6
- omlish/formats/yaml.py +10 -0
- omlish/graphs/dot/__init__.py +31 -19
- omlish/graphs/dot/make.py +16 -0
- omlish/graphs/dot/rendering.py +9 -8
- omlish/http/cookies.py +2 -1
- omlish/inject/impl/scopes.py +2 -0
- omlish/inject/keys.py +1 -1
- omlish/inject/multis.py +4 -4
- omlish/inject/providers.py +1 -1
- omlish/lang/__init__.py +9 -0
- omlish/lang/classes/__init__.py +3 -0
- omlish/lang/classes/restrict.py +25 -4
- omlish/lang/classes/simple.py +0 -4
- omlish/lang/classes/virtual.py +6 -4
- omlish/lang/datetimes.py +9 -0
- omlish/lang/typing.py +32 -0
- omlish/lite/logs.py +30 -25
- omlish/lite/secrets.py +3 -1
- omlish/logs/configs.py +2 -2
- omlish/marshal/dataclasses.py +1 -1
- omlish/secrets/secrets.py +1 -1
- omlish/specs/jsonschema/schemas/draft202012/metaschema.json +58 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/applicator.json +48 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/content.json +17 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/core.json +51 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/format-annotation.json +14 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/format-assertion.json +14 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/format.json +14 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/meta-data.json +37 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/unevaluated.json +15 -0
- omlish/specs/jsonschema/schemas/draft202012/vocabularies/validation.json +98 -0
- omlish/stats.py +1 -1
- {omlish-0.0.0.dev24.dist-info → omlish-0.0.0.dev26.dist-info}/METADATA +1 -1
- {omlish-0.0.0.dev24.dist-info → omlish-0.0.0.dev26.dist-info}/RECORD +54 -40
- {omlish-0.0.0.dev24.dist-info → omlish-0.0.0.dev26.dist-info}/WHEEL +1 -1
- {omlish-0.0.0.dev24.dist-info → omlish-0.0.0.dev26.dist-info}/LICENSE +0 -0
- {omlish-0.0.0.dev24.dist-info → omlish-0.0.0.dev26.dist-info}/top_level.txt +0 -0
omlish/__about__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
__version__ = '0.0.0.
|
2
|
-
__revision__ = '
|
1
|
+
__version__ = '0.0.0.dev26'
|
2
|
+
__revision__ = 'd3cb2e43eac2aa63dc4606aa371faa78ec0daf1a'
|
3
3
|
|
4
4
|
|
5
5
|
#
|
@@ -41,7 +41,9 @@ class Project(ProjectBase):
|
|
41
41
|
|
42
42
|
'compression': [
|
43
43
|
'lz4 ~= 4.0',
|
44
|
+
|
44
45
|
'python-snappy ~= 0.7; python_version < "3.13"',
|
46
|
+
|
45
47
|
'zstd ~= 1.5',
|
46
48
|
],
|
47
49
|
|
@@ -69,6 +71,7 @@ class Project(ProjectBase):
|
|
69
71
|
|
70
72
|
'misc': [
|
71
73
|
'jinja2 ~= 3.1',
|
74
|
+
|
72
75
|
'wrapt ~= 1.14',
|
73
76
|
],
|
74
77
|
|
@@ -81,6 +84,7 @@ class Project(ProjectBase):
|
|
81
84
|
|
82
85
|
'pg8000 ~= 1.31',
|
83
86
|
# 'psycopg2 ~= 2.9',
|
87
|
+
# 'psycopg ~= 3.2',
|
84
88
|
|
85
89
|
'pymysql ~= 1.1',
|
86
90
|
# 'mysql-connector-python ~= 9.0',
|
@@ -111,8 +115,6 @@ class SetuptoolsBase:
|
|
111
115
|
'global-exclude **/conftest.py',
|
112
116
|
]
|
113
117
|
|
114
|
-
include_package_data = False
|
115
|
-
|
116
118
|
find_packages = {
|
117
119
|
'exclude': [
|
118
120
|
'*.tests',
|
@@ -120,6 +122,20 @@ class SetuptoolsBase:
|
|
120
122
|
],
|
121
123
|
}
|
122
124
|
|
125
|
+
package_data = {
|
126
|
+
'*': [
|
127
|
+
'*.c',
|
128
|
+
'*.cc',
|
129
|
+
'*.h',
|
130
|
+
|
131
|
+
'*.json',
|
132
|
+
|
133
|
+
'*.sql',
|
134
|
+
|
135
|
+
'LICENSE',
|
136
|
+
],
|
137
|
+
}
|
138
|
+
|
123
139
|
|
124
140
|
class Setuptools(SetuptoolsBase):
|
125
141
|
find_packages = {
|
omlish/_manifests.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[]
|
omlish/bootstrap/diag.py
CHANGED
@@ -3,6 +3,7 @@ import contextlib
|
|
3
3
|
import dataclasses as dc
|
4
4
|
import signal
|
5
5
|
import sys
|
6
|
+
import threading
|
6
7
|
import typing as ta
|
7
8
|
|
8
9
|
from .. import check
|
@@ -17,6 +18,7 @@ if ta.TYPE_CHECKING:
|
|
17
18
|
import pstats
|
18
19
|
|
19
20
|
from ..diag import pycharm as diagpc
|
21
|
+
from ..diag import replserver as diagrs
|
20
22
|
from ..diag import threads as diagt
|
21
23
|
|
22
24
|
else:
|
@@ -24,6 +26,7 @@ else:
|
|
24
26
|
pstats = lang.proxy_import('pstats')
|
25
27
|
|
26
28
|
diagpc = lang.proxy_import('..diag.pycharm', __package__)
|
29
|
+
diagrs = lang.proxy_import('..diag.replserver', __package__)
|
27
30
|
diagt = lang.proxy_import('..diag.threads', __package__)
|
28
31
|
|
29
32
|
|
@@ -175,3 +178,25 @@ class PycharmBootstrap(SimpleBootstrap['PycharmBootstrap.Config']):
|
|
175
178
|
self._config.debug_port,
|
176
179
|
version=self._config.version,
|
177
180
|
)
|
181
|
+
|
182
|
+
|
183
|
+
##
|
184
|
+
|
185
|
+
|
186
|
+
class ReplServerBootstrap(ContextBootstrap['ReplServerBootstrap.Config']):
|
187
|
+
@dc.dataclass(frozen=True)
|
188
|
+
class Config(Bootstrap.Config):
|
189
|
+
path: str | None = None
|
190
|
+
|
191
|
+
@contextlib.contextmanager
|
192
|
+
def enter(self) -> ta.Iterator[None]:
|
193
|
+
if self._config.path is None:
|
194
|
+
return
|
195
|
+
|
196
|
+
with diagrs.ReplServer(diagrs.ReplServer.Config(
|
197
|
+
path=self._config.path,
|
198
|
+
)) as rs:
|
199
|
+
thread = threading.Thread(target=rs.run, name='replserver')
|
200
|
+
thread.start()
|
201
|
+
|
202
|
+
yield
|
omlish/bootstrap/harness.py
CHANGED
@@ -6,6 +6,7 @@ TODO:
|
|
6
6
|
- multiprocess profiling - afterfork, suffix with pid
|
7
7
|
|
8
8
|
TODO diag:
|
9
|
+
- tracemalloc
|
9
10
|
- yappi
|
10
11
|
- stackscope
|
11
12
|
- https://github.com/pythonspeed/filprofiler
|
@@ -13,10 +14,10 @@ TODO diag:
|
|
13
14
|
- https://pypi.org/project/memory-profiler/
|
14
15
|
- https://pypi.org/project/Pympler/
|
15
16
|
|
17
|
+
|
16
18
|
TODO new items:
|
17
|
-
- pydevd connect-back
|
18
19
|
- debugging / pdb
|
19
|
-
|
20
|
+
- https://github.com/inducer/pudb
|
20
21
|
- packaging fixups
|
21
22
|
- daemonize ( https://github.com/thesharp/daemonize/blob/master/daemonize.py )
|
22
23
|
"""
|
omlish/check.py
CHANGED
@@ -332,7 +332,7 @@ def single(obj: ta.Iterable[T], message: Message = None) -> T:
|
|
332
332
|
return value
|
333
333
|
|
334
334
|
|
335
|
-
def
|
335
|
+
def opt_single(obj: ta.Iterable[T], message: Message = None) -> T | None:
|
336
336
|
it = iter(obj)
|
337
337
|
try:
|
338
338
|
value = next(it)
|
omlish/collections/__init__.py
CHANGED
omlish/collections/utils.py
CHANGED
@@ -39,7 +39,12 @@ def toposort(data: ta.Mapping[T, ta.AbstractSet[T]]) -> ta.Iterator[set[T]]:
|
|
39
39
|
##
|
40
40
|
|
41
41
|
|
42
|
-
|
42
|
+
class PartitionResult(ta.NamedTuple, ta.Generic[T]):
|
43
|
+
t: list[T]
|
44
|
+
f: list[T]
|
45
|
+
|
46
|
+
|
47
|
+
def partition(items: ta.Iterable[T], pred: ta.Callable[[T], bool]) -> PartitionResult[T]:
|
43
48
|
t: list[T] = []
|
44
49
|
f: list[T] = []
|
45
50
|
for e in items:
|
@@ -47,7 +52,7 @@ def partition(items: ta.Iterable[T], pred: ta.Callable[[T], bool]) -> tuple[list
|
|
47
52
|
t.append(e)
|
48
53
|
else:
|
49
54
|
f.append(e)
|
50
|
-
return t, f
|
55
|
+
return PartitionResult(t, f)
|
51
56
|
|
52
57
|
|
53
58
|
def unique(
|
omlish/dataclasses/__init__.py
CHANGED
@@ -59,8 +59,8 @@ globals()['make_dataclass'] = xmake_dataclass
|
|
59
59
|
|
60
60
|
|
61
61
|
from .impl.exceptions import ( # noqa
|
62
|
-
|
63
|
-
|
62
|
+
FieldValidationError,
|
63
|
+
ValidationError,
|
64
64
|
)
|
65
65
|
|
66
66
|
from .impl.metaclass import ( # noqa
|
@@ -76,8 +76,8 @@ from .impl.metadata import ( # noqa
|
|
76
76
|
UserMetadata,
|
77
77
|
metadata,
|
78
78
|
|
79
|
-
|
80
|
-
|
79
|
+
Validate,
|
80
|
+
validate,
|
81
81
|
|
82
82
|
Init,
|
83
83
|
init,
|
@@ -0,0 +1,279 @@
|
|
1
|
+
A. HISTORY OF THE SOFTWARE
|
2
|
+
==========================
|
3
|
+
|
4
|
+
Python was created in the early 1990s by Guido van Rossum at Stichting
|
5
|
+
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
|
6
|
+
as a successor of a language called ABC. Guido remains Python's
|
7
|
+
principal author, although it includes many contributions from others.
|
8
|
+
|
9
|
+
In 1995, Guido continued his work on Python at the Corporation for
|
10
|
+
National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
|
11
|
+
in Reston, Virginia where he released several versions of the
|
12
|
+
software.
|
13
|
+
|
14
|
+
In May 2000, Guido and the Python core development team moved to
|
15
|
+
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
16
|
+
year, the PythonLabs team moved to Digital Creations, which became
|
17
|
+
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
18
|
+
https://www.python.org/psf/) was formed, a non-profit organization
|
19
|
+
created specifically to own Python-related Intellectual Property.
|
20
|
+
Zope Corporation was a sponsoring member of the PSF.
|
21
|
+
|
22
|
+
All Python releases are Open Source (see https://opensource.org for
|
23
|
+
the Open Source Definition). Historically, most, but not all, Python
|
24
|
+
releases have also been GPL-compatible; the table below summarizes
|
25
|
+
the various releases.
|
26
|
+
|
27
|
+
Release Derived Year Owner GPL-
|
28
|
+
from compatible? (1)
|
29
|
+
|
30
|
+
0.9.0 thru 1.2 1991-1995 CWI yes
|
31
|
+
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
32
|
+
1.6 1.5.2 2000 CNRI no
|
33
|
+
2.0 1.6 2000 BeOpen.com no
|
34
|
+
1.6.1 1.6 2001 CNRI yes (2)
|
35
|
+
2.1 2.0+1.6.1 2001 PSF no
|
36
|
+
2.0.1 2.0+1.6.1 2001 PSF yes
|
37
|
+
2.1.1 2.1+2.0.1 2001 PSF yes
|
38
|
+
2.1.2 2.1.1 2002 PSF yes
|
39
|
+
2.1.3 2.1.2 2002 PSF yes
|
40
|
+
2.2 and above 2.1.1 2001-now PSF yes
|
41
|
+
|
42
|
+
Footnotes:
|
43
|
+
|
44
|
+
(1) GPL-compatible doesn't mean that we're distributing Python under
|
45
|
+
the GPL. All Python licenses, unlike the GPL, let you distribute
|
46
|
+
a modified version without making your changes open source. The
|
47
|
+
GPL-compatible licenses make it possible to combine Python with
|
48
|
+
other software that is released under the GPL; the others don't.
|
49
|
+
|
50
|
+
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
51
|
+
because its license has a choice of law clause. According to
|
52
|
+
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
53
|
+
is "not incompatible" with the GPL.
|
54
|
+
|
55
|
+
Thanks to the many outside volunteers who have worked under Guido's
|
56
|
+
direction to make these releases possible.
|
57
|
+
|
58
|
+
|
59
|
+
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
60
|
+
===============================================================
|
61
|
+
|
62
|
+
Python software and documentation are licensed under the
|
63
|
+
Python Software Foundation License Version 2.
|
64
|
+
|
65
|
+
Starting with Python 3.8.6, examples, recipes, and other code in
|
66
|
+
the documentation are dual licensed under the PSF License Version 2
|
67
|
+
and the Zero-Clause BSD license.
|
68
|
+
|
69
|
+
Some software incorporated into Python is under different licenses.
|
70
|
+
The licenses are listed with code falling under that license.
|
71
|
+
|
72
|
+
|
73
|
+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
74
|
+
--------------------------------------------
|
75
|
+
|
76
|
+
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
77
|
+
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
78
|
+
otherwise using this software ("Python") in source or binary form and
|
79
|
+
its associated documentation.
|
80
|
+
|
81
|
+
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
82
|
+
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
83
|
+
analyze, test, perform and/or display publicly, prepare derivative works,
|
84
|
+
distribute, and otherwise use Python alone or in any derivative version,
|
85
|
+
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
86
|
+
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
87
|
+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
|
88
|
+
All Rights Reserved" are retained in Python alone or in any derivative version
|
89
|
+
prepared by Licensee.
|
90
|
+
|
91
|
+
3. In the event Licensee prepares a derivative work that is based on
|
92
|
+
or incorporates Python or any part thereof, and wants to make
|
93
|
+
the derivative work available to others as provided herein, then
|
94
|
+
Licensee hereby agrees to include in any such work a brief summary of
|
95
|
+
the changes made to Python.
|
96
|
+
|
97
|
+
4. PSF is making Python available to Licensee on an "AS IS"
|
98
|
+
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
99
|
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
100
|
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
101
|
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
102
|
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
103
|
+
|
104
|
+
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
105
|
+
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
106
|
+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
107
|
+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
108
|
+
|
109
|
+
6. This License Agreement will automatically terminate upon a material
|
110
|
+
breach of its terms and conditions.
|
111
|
+
|
112
|
+
7. Nothing in this License Agreement shall be deemed to create any
|
113
|
+
relationship of agency, partnership, or joint venture between PSF and
|
114
|
+
Licensee. This License Agreement does not grant permission to use PSF
|
115
|
+
trademarks or trade name in a trademark sense to endorse or promote
|
116
|
+
products or services of Licensee, or any third party.
|
117
|
+
|
118
|
+
8. By copying, installing or otherwise using Python, Licensee
|
119
|
+
agrees to be bound by the terms and conditions of this License
|
120
|
+
Agreement.
|
121
|
+
|
122
|
+
|
123
|
+
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
124
|
+
-------------------------------------------
|
125
|
+
|
126
|
+
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
127
|
+
|
128
|
+
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
129
|
+
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
130
|
+
Individual or Organization ("Licensee") accessing and otherwise using
|
131
|
+
this software in source or binary form and its associated
|
132
|
+
documentation ("the Software").
|
133
|
+
|
134
|
+
2. Subject to the terms and conditions of this BeOpen Python License
|
135
|
+
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
136
|
+
royalty-free, world-wide license to reproduce, analyze, test, perform
|
137
|
+
and/or display publicly, prepare derivative works, distribute, and
|
138
|
+
otherwise use the Software alone or in any derivative version,
|
139
|
+
provided, however, that the BeOpen Python License is retained in the
|
140
|
+
Software, alone or in any derivative version prepared by Licensee.
|
141
|
+
|
142
|
+
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
143
|
+
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
144
|
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
145
|
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
146
|
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
147
|
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
148
|
+
|
149
|
+
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
150
|
+
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
151
|
+
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
152
|
+
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
153
|
+
|
154
|
+
5. This License Agreement will automatically terminate upon a material
|
155
|
+
breach of its terms and conditions.
|
156
|
+
|
157
|
+
6. This License Agreement shall be governed by and interpreted in all
|
158
|
+
respects by the law of the State of California, excluding conflict of
|
159
|
+
law provisions. Nothing in this License Agreement shall be deemed to
|
160
|
+
create any relationship of agency, partnership, or joint venture
|
161
|
+
between BeOpen and Licensee. This License Agreement does not grant
|
162
|
+
permission to use BeOpen trademarks or trade names in a trademark
|
163
|
+
sense to endorse or promote products or services of Licensee, or any
|
164
|
+
third party. As an exception, the "BeOpen Python" logos available at
|
165
|
+
http://www.pythonlabs.com/logos.html may be used according to the
|
166
|
+
permissions granted on that web page.
|
167
|
+
|
168
|
+
7. By copying, installing or otherwise using the software, Licensee
|
169
|
+
agrees to be bound by the terms and conditions of this License
|
170
|
+
Agreement.
|
171
|
+
|
172
|
+
|
173
|
+
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
174
|
+
---------------------------------------
|
175
|
+
|
176
|
+
1. This LICENSE AGREEMENT is between the Corporation for National
|
177
|
+
Research Initiatives, having an office at 1895 Preston White Drive,
|
178
|
+
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
179
|
+
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
180
|
+
source or binary form and its associated documentation.
|
181
|
+
|
182
|
+
2. Subject to the terms and conditions of this License Agreement, CNRI
|
183
|
+
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
184
|
+
license to reproduce, analyze, test, perform and/or display publicly,
|
185
|
+
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
186
|
+
alone or in any derivative version, provided, however, that CNRI's
|
187
|
+
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
188
|
+
1995-2001 Corporation for National Research Initiatives; All Rights
|
189
|
+
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
190
|
+
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
191
|
+
Agreement, Licensee may substitute the following text (omitting the
|
192
|
+
quotes): "Python 1.6.1 is made available subject to the terms and
|
193
|
+
conditions in CNRI's License Agreement. This Agreement together with
|
194
|
+
Python 1.6.1 may be located on the internet using the following
|
195
|
+
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
196
|
+
Agreement may also be obtained from a proxy server on the internet
|
197
|
+
using the following URL: http://hdl.handle.net/1895.22/1013".
|
198
|
+
|
199
|
+
3. In the event Licensee prepares a derivative work that is based on
|
200
|
+
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
201
|
+
the derivative work available to others as provided herein, then
|
202
|
+
Licensee hereby agrees to include in any such work a brief summary of
|
203
|
+
the changes made to Python 1.6.1.
|
204
|
+
|
205
|
+
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
206
|
+
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
207
|
+
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
208
|
+
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
209
|
+
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
210
|
+
INFRINGE ANY THIRD PARTY RIGHTS.
|
211
|
+
|
212
|
+
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
213
|
+
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
214
|
+
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
215
|
+
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
216
|
+
|
217
|
+
6. This License Agreement will automatically terminate upon a material
|
218
|
+
breach of its terms and conditions.
|
219
|
+
|
220
|
+
7. This License Agreement shall be governed by the federal
|
221
|
+
intellectual property law of the United States, including without
|
222
|
+
limitation the federal copyright law, and, to the extent such
|
223
|
+
U.S. federal law does not apply, by the law of the Commonwealth of
|
224
|
+
Virginia, excluding Virginia's conflict of law provisions.
|
225
|
+
Notwithstanding the foregoing, with regard to derivative works based
|
226
|
+
on Python 1.6.1 that incorporate non-separable material that was
|
227
|
+
previously distributed under the GNU General Public License (GPL), the
|
228
|
+
law of the Commonwealth of Virginia shall govern this License
|
229
|
+
Agreement only as to issues arising under or with respect to
|
230
|
+
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
231
|
+
License Agreement shall be deemed to create any relationship of
|
232
|
+
agency, partnership, or joint venture between CNRI and Licensee. This
|
233
|
+
License Agreement does not grant permission to use CNRI trademarks or
|
234
|
+
trade name in a trademark sense to endorse or promote products or
|
235
|
+
services of Licensee, or any third party.
|
236
|
+
|
237
|
+
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
238
|
+
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
239
|
+
bound by the terms and conditions of this License Agreement.
|
240
|
+
|
241
|
+
ACCEPT
|
242
|
+
|
243
|
+
|
244
|
+
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
245
|
+
--------------------------------------------------
|
246
|
+
|
247
|
+
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
248
|
+
The Netherlands. All rights reserved.
|
249
|
+
|
250
|
+
Permission to use, copy, modify, and distribute this software and its
|
251
|
+
documentation for any purpose and without fee is hereby granted,
|
252
|
+
provided that the above copyright notice appear in all copies and that
|
253
|
+
both that copyright notice and this permission notice appear in
|
254
|
+
supporting documentation, and that the name of Stichting Mathematisch
|
255
|
+
Centrum or CWI not be used in advertising or publicity pertaining to
|
256
|
+
distribution of the software without specific, written prior
|
257
|
+
permission.
|
258
|
+
|
259
|
+
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
260
|
+
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
261
|
+
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
262
|
+
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
263
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
264
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
265
|
+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
266
|
+
|
267
|
+
ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
|
268
|
+
----------------------------------------------------------------------
|
269
|
+
|
270
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
271
|
+
purpose with or without fee is hereby granted.
|
272
|
+
|
273
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
274
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
275
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
276
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
277
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
278
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
279
|
+
PERFORMANCE OF THIS SOFTWARE.
|
omlish/dataclasses/impl/api.py
CHANGED
@@ -30,8 +30,9 @@ def field( # noqa
|
|
30
30
|
metadata=None,
|
31
31
|
kw_only=MISSING,
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
derive: ta.Callable[..., ta.Any] | None = None,
|
34
|
+
coerce: bool | ta.Callable[[ta.Any], ta.Any] | None = None,
|
35
|
+
validate: ta.Callable[[ta.Any], bool] | None = None,
|
35
36
|
check_type: bool | None = None,
|
36
37
|
override: bool = False,
|
37
38
|
repr_fn: ta.Callable[[ta.Any], str | None] | None = None,
|
@@ -40,8 +41,9 @@ def field( # noqa
|
|
40
41
|
raise ValueError('cannot specify both default and default_factory')
|
41
42
|
|
42
43
|
fx = FieldExtras(
|
44
|
+
derive=derive,
|
43
45
|
coerce=coerce,
|
44
|
-
|
46
|
+
validate=validate,
|
45
47
|
check_type=check_type,
|
46
48
|
override=override,
|
47
49
|
repr_fn=repr_fn,
|
@@ -175,15 +175,18 @@ def field_init(
|
|
175
175
|
else:
|
176
176
|
pass
|
177
177
|
|
178
|
+
if fx.derive is not None:
|
179
|
+
raise NotImplementedError
|
180
|
+
|
178
181
|
if fx.coerce is not None:
|
179
182
|
cn = f'__dataclass_coerce__{f.name}__'
|
180
183
|
locals[cn] = fx.coerce
|
181
184
|
lines.append(f'{value} = {cn}({value})')
|
182
185
|
|
183
|
-
if fx.
|
184
|
-
cn = f'
|
185
|
-
locals[cn] = fx.
|
186
|
-
lines.append(f'if not {cn}({value}): raise
|
186
|
+
if fx.validate is not None:
|
187
|
+
cn = f'__dataclass_validate__{f.name}__'
|
188
|
+
locals[cn] = fx.validate
|
189
|
+
lines.append(f'if not {cn}({value}): raise __dataclass_FieldValidationError__({f.name})')
|
187
190
|
|
188
191
|
if fx.check_type:
|
189
192
|
cn = f'__dataclass_check_type__{f.name}__'
|
omlish/dataclasses/impl/init.py
CHANGED
@@ -3,16 +3,16 @@ import inspect
|
|
3
3
|
import typing as ta
|
4
4
|
|
5
5
|
from ... import lang
|
6
|
-
from .exceptions import
|
7
|
-
from .exceptions import
|
6
|
+
from .exceptions import FieldValidationError
|
7
|
+
from .exceptions import ValidationError
|
8
8
|
from .fields import field_init
|
9
9
|
from .fields import field_type
|
10
10
|
from .fields import has_default
|
11
11
|
from .internals import HAS_DEFAULT_FACTORY
|
12
12
|
from .internals import POST_INIT_NAME
|
13
13
|
from .internals import FieldType
|
14
|
-
from .metadata import Check
|
15
14
|
from .metadata import Init
|
15
|
+
from .metadata import Validate
|
16
16
|
from .processing import Processor
|
17
17
|
from .reflect import ClassInfo
|
18
18
|
from .utils import Namespace
|
@@ -100,8 +100,8 @@ class InitBuilder:
|
|
100
100
|
'__dataclass_builtins_object__': object,
|
101
101
|
'__dataclass_builtins_isinstance__': isinstance,
|
102
102
|
'__dataclass_builtins_TypeError__': TypeError,
|
103
|
-
'
|
104
|
-
'
|
103
|
+
'__dataclass_ValidationError__': ValidationError,
|
104
|
+
'__dataclass_FieldValidationError__': FieldValidationError,
|
105
105
|
})
|
106
106
|
|
107
107
|
body_lines: list[str] = []
|
@@ -121,14 +121,14 @@ class InitBuilder:
|
|
121
121
|
params_str = ','.join(f.name for f in ifs.all if field_type(f) is FieldType.INIT)
|
122
122
|
body_lines.append(f'{self._self_name}.{POST_INIT_NAME}({params_str})')
|
123
123
|
|
124
|
-
for i, fn in enumerate(self._info.merged_metadata.get(
|
124
|
+
for i, fn in enumerate(self._info.merged_metadata.get(Validate, [])):
|
125
125
|
if isinstance(fn, staticmethod):
|
126
126
|
fn = fn.__func__
|
127
|
-
cn = f'
|
127
|
+
cn = f'__dataclass_validate_{i}__'
|
128
128
|
locals[cn] = fn
|
129
129
|
csig = inspect.signature(fn)
|
130
130
|
cas = ', '.join(p.name for p in csig.parameters.values())
|
131
|
-
body_lines.append(f'if not {cn}({cas}): raise
|
131
|
+
body_lines.append(f'if not {cn}({cas}): raise __dataclass_ValidationError__')
|
132
132
|
|
133
133
|
inits = self._info.merged_metadata.get(Init, [])
|
134
134
|
mro_dct = lang.build_mro_dict(self._info.cls)
|
@@ -54,12 +54,12 @@ def metadata(cls_dct, *args) -> None:
|
|
54
54
|
|
55
55
|
|
56
56
|
@_class_merged
|
57
|
-
class
|
57
|
+
class Validate(lang.Marker):
|
58
58
|
pass
|
59
59
|
|
60
60
|
|
61
|
-
def
|
62
|
-
_append_cls_md(
|
61
|
+
def validate(fn: ta.Callable[..., bool] | staticmethod) -> None:
|
62
|
+
_append_cls_md(Validate, fn)
|
63
63
|
|
64
64
|
|
65
65
|
##
|
@@ -40,10 +40,11 @@ from .metadata import METADATA_ATTR
|
|
40
40
|
##
|
41
41
|
|
42
42
|
|
43
|
-
@dc.dataclass(frozen=True)
|
43
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
44
44
|
class FieldExtras(lang.Final):
|
45
|
+
derive: ta.Callable[..., ta.Any] | None = None
|
45
46
|
coerce: bool | ta.Callable[[ta.Any], ta.Any] | None = None
|
46
|
-
|
47
|
+
validate: ta.Callable[[ta.Any], bool] | None = None
|
47
48
|
check_type: bool | None = None
|
48
49
|
override: bool = False
|
49
50
|
repr_fn: ta.Callable[[ta.Any], str | None] | None = None
|
@@ -79,7 +80,7 @@ def get_params(obj: ta.Any) -> Params:
|
|
79
80
|
##
|
80
81
|
|
81
82
|
|
82
|
-
@dc.dataclass(frozen=True)
|
83
|
+
@dc.dataclass(frozen=True, kw_only=True)
|
83
84
|
class ParamsExtras(lang.Final):
|
84
85
|
reorder: bool = False
|
85
86
|
cache_hash: bool = False
|
omlish/diag/replserver/server.py
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
"""
|
2
|
+
FIXME:
|
3
|
+
- lol shutdown deadlocks
|
4
|
+
- whole thing is just gross is this its own thread or what
|
5
|
+
|
2
6
|
TODO:
|
3
7
|
- !!! ANYIO !!!
|
4
8
|
- optional paramiko ssh-server
|
5
9
|
- optional ipython embed
|
10
|
+
- https://github.com/python/cpython/tree/56470004e58911b146c016fc9fec4461b8f69454/Lib/_pyrepl
|
6
11
|
|
7
12
|
lookit:
|
8
13
|
- https://github.com/vxgmichel/aioconsole/blob/e55f4b0601da3b3a40a88c965526d35ab38b5841/aioconsole/server.py
|
@@ -38,7 +43,7 @@ class ReplServer:
|
|
38
43
|
@dc.dataclass(frozen=True)
|
39
44
|
class Config:
|
40
45
|
path: str
|
41
|
-
file_mode: int | None =
|
46
|
+
file_mode: int | None = 0o660
|
42
47
|
poll_interval: float = 0.5
|
43
48
|
exit_timeout: float = 10.0
|
44
49
|
|
@@ -80,7 +85,17 @@ class ReplServer:
|
|
80
85
|
|
81
86
|
self._socket = sock.socket(sock.AF_UNIX, sock.SOCK_STREAM)
|
82
87
|
self._socket.settimeout(self._config.poll_interval)
|
83
|
-
|
88
|
+
|
89
|
+
if self._config.file_mode is not None:
|
90
|
+
prev_umask = os.umask(~self._config.file_mode)
|
91
|
+
else:
|
92
|
+
prev_umask = None
|
93
|
+
try:
|
94
|
+
self._socket.bind(self._config.path)
|
95
|
+
finally:
|
96
|
+
if prev_umask is not None:
|
97
|
+
os.umask(prev_umask)
|
98
|
+
|
84
99
|
with contextlib.closing(self._socket):
|
85
100
|
self._socket.listen(1)
|
86
101
|
|