soia-client 1.0.14__py3-none-any.whl → 1.0.16__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.

Potentially problematic release.


This version of soia-client might be problematic. Click here for more details.

soia/__init__.py ADDED
@@ -0,0 +1,30 @@
1
+ import typing as _typing
2
+
3
+ from soia._impl.keyed_items import KeyedItems
4
+ from soia._impl.method import Method
5
+ from soia._impl.serializer import Serializer
6
+ from soia._impl.serializers import (
7
+ array_serializer,
8
+ optional_serializer,
9
+ primitive_serializer,
10
+ )
11
+ from soia._impl.service import RequestHeaders, ResponseHeaders, Service
12
+ from soia._impl.service_client import ServiceClient
13
+ from soia._impl.timestamp import Timestamp
14
+
15
+ _: _typing.Final[_typing.Any] = None
16
+
17
+ __all__ = [
18
+ "_",
19
+ "KeyedItems",
20
+ "Method",
21
+ "RequestHeaders",
22
+ "ResponseHeaders",
23
+ "Serializer",
24
+ "Service",
25
+ "ServiceClient",
26
+ "Timestamp",
27
+ "array_serializer",
28
+ "optional_serializer",
29
+ "primitive_serializer",
30
+ ]
@@ -3,11 +3,11 @@ from dataclasses import FrozenInstanceError
3
3
  from typing import Generic, Optional
4
4
  from weakref import WeakValueDictionary
5
5
 
6
- import soialib.reflection
7
- from soialib import spec
8
- from soialib.impl.function_maker import Any, Expr, ExprLike, Line, make_function
9
- from soialib.impl.type_adapter import TypeAdapter
10
- from soialib.keyed_items import Item, Key, KeyedItems
6
+ from soia._impl.function_maker import Any, Expr, ExprLike, Line, make_function
7
+ from soia._impl.keyed_items import Item, Key, KeyedItems
8
+ from soia._impl.type_adapter import TypeAdapter
9
+
10
+ from soia import _spec, reflection
11
11
 
12
12
 
13
13
  def get_array_adapter(
@@ -104,14 +104,14 @@ class _ArrayAdapter(TypeAdapter):
104
104
 
105
105
  def finalize(
106
106
  self,
107
- resolve_type_fn: Callable[[spec.Type], "TypeAdapter"],
107
+ resolve_type_fn: Callable[[_spec.Type], "TypeAdapter"],
108
108
  ) -> None:
109
109
  self.item_adapter.finalize(resolve_type_fn)
110
110
 
111
- def get_type(self) -> soialib.reflection.Type:
112
- return soialib.reflection.ArrayType(
111
+ def get_type(self) -> reflection.Type:
112
+ return reflection.ArrayType(
113
113
  kind="array",
114
- value=soialib.reflection.ArrayType.Array(
114
+ value=reflection.ArrayType.Array(
115
115
  item=self.item_adapter.get_type(),
116
116
  key_chain=self.key_attributes,
117
117
  ),
@@ -119,7 +119,7 @@ class _ArrayAdapter(TypeAdapter):
119
119
 
120
120
  def register_records(
121
121
  self,
122
- registry: dict[str, soialib.reflection.Record],
122
+ registry: dict[str, reflection.Record],
123
123
  ) -> None:
124
124
  self.item_adapter.register_records(registry)
125
125
 
@@ -3,11 +3,11 @@ from collections.abc import Callable, Sequence
3
3
  from dataclasses import FrozenInstanceError, dataclass
4
4
  from typing import Any, Final, Union
5
5
 
6
- import soialib.reflection
7
- from soialib import spec as _spec
8
- from soialib.impl.function_maker import BodyBuilder, Expr, ExprLike, Line, make_function
9
- from soialib.impl.repr import repr_impl
10
- from soialib.impl.type_adapter import TypeAdapter
6
+ from soia._impl.function_maker import BodyBuilder, Expr, ExprLike, Line, make_function
7
+ from soia._impl.repr import repr_impl
8
+ from soia._impl.type_adapter import TypeAdapter
9
+
10
+ from soia import _spec, reflection
11
11
 
12
12
 
13
13
  class EnumAdapter(TypeAdapter):
@@ -119,24 +119,24 @@ class EnumAdapter(TypeAdapter):
119
119
  Expr.local("_cls?", self.gen_class), f".{fn_name}(", json_expr, ")"
120
120
  )
121
121
 
122
- def get_type(self) -> soialib.reflection.Type:
123
- return soialib.reflection.RecordType(
122
+ def get_type(self) -> reflection.Type:
123
+ return reflection.RecordType(
124
124
  kind="record",
125
125
  value=self.spec.id,
126
126
  )
127
127
 
128
128
  def register_records(
129
129
  self,
130
- registry: dict[str, soialib.reflection.Record],
130
+ registry: dict[str, reflection.Record],
131
131
  ) -> None:
132
132
  record_id = self.spec.id
133
133
  if record_id in registry:
134
134
  return
135
- registry[record_id] = soialib.reflection.Record(
135
+ registry[record_id] = reflection.Record(
136
136
  kind="enum",
137
137
  id=record_id,
138
138
  fields=tuple(
139
- soialib.reflection.Field(
139
+ reflection.Field(
140
140
  name=field.spec.name,
141
141
  number=field.spec.number,
142
142
  type=field.field_type.get_type(),
@@ -1,7 +1,6 @@
1
1
  import abc
2
2
  from typing import Generic, Optional, TypeVar
3
3
 
4
-
5
4
  Item = TypeVar("Item")
6
5
  Key = TypeVar("Key")
7
6
 
@@ -1,7 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Generic, TypeVar
3
3
 
4
- from soialib.serializer import Serializer
4
+ from soia._impl.serializer import Serializer
5
5
 
6
6
  Request = TypeVar("Request")
7
7
  Response = TypeVar("Response")
@@ -1,4 +1,3 @@
1
1
  from typing import NoReturn
2
2
 
3
-
4
3
  Never = NoReturn
@@ -3,10 +3,10 @@ from dataclasses import dataclass
3
3
  from typing import TypeVar
4
4
  from weakref import WeakValueDictionary
5
5
 
6
- import soialib.reflection
7
- from soialib import spec
8
- from soialib.impl.function_maker import Expr, ExprLike
9
- from soialib.impl.type_adapter import TypeAdapter
6
+ from soia._impl.function_maker import Expr, ExprLike
7
+ from soia._impl.type_adapter import TypeAdapter
8
+
9
+ from soia import _spec, reflection
10
10
 
11
11
  Other = TypeVar("Other")
12
12
 
@@ -64,19 +64,19 @@ class _OptionalAdapter(TypeAdapter):
64
64
 
65
65
  def finalize(
66
66
  self,
67
- resolve_type_fn: Callable[[spec.Type], "TypeAdapter"],
67
+ resolve_type_fn: Callable[[_spec.Type], "TypeAdapter"],
68
68
  ) -> None:
69
69
  self.other_adapter.finalize(resolve_type_fn)
70
70
 
71
- def get_type(self) -> soialib.reflection.Type:
72
- return soialib.reflection.OptionalType(
71
+ def get_type(self) -> reflection.Type:
72
+ return reflection.OptionalType(
73
73
  kind="optional",
74
74
  value=self.other_adapter.get_type(),
75
75
  )
76
76
 
77
77
  def register_records(
78
78
  self,
79
- registry: dict[str, soialib.reflection.Record],
79
+ registry: dict[str, reflection.Record],
80
80
  ) -> None:
81
81
  self.other_adapter.register_records(registry)
82
82
 
@@ -2,25 +2,25 @@ from collections.abc import Callable
2
2
  from dataclasses import dataclass
3
3
  from typing import Any, Final, final
4
4
 
5
- import soialib.reflection
6
- from soialib import spec
7
- from soialib.impl.function_maker import Expr, ExprLike
8
- from soialib.impl.type_adapter import TypeAdapter
9
- from soialib.timestamp import Timestamp
5
+ from soia._impl.function_maker import Expr, ExprLike
6
+ from soia._impl.timestamp import Timestamp
7
+ from soia._impl.type_adapter import TypeAdapter
8
+
9
+ from soia import _spec, reflection
10
10
 
11
11
 
12
12
  class AbstractPrimitiveAdapter(TypeAdapter):
13
13
  @final
14
14
  def finalize(
15
15
  self,
16
- resolve_type_fn: Callable[[spec.Type], "TypeAdapter"],
16
+ resolve_type_fn: Callable[[_spec.Type], "TypeAdapter"],
17
17
  ) -> None:
18
18
  pass
19
19
 
20
20
  @final
21
21
  def register_records(
22
22
  self,
23
- records: dict[str, soialib.reflection.Record],
23
+ registry: dict[str, reflection.Record],
24
24
  ) -> None:
25
25
  pass
26
26
 
@@ -48,8 +48,8 @@ class _BoolAdapter(AbstractPrimitiveAdapter):
48
48
  def from_json_expr(self, json_expr: ExprLike) -> Expr:
49
49
  return Expr.join("(True if ", json_expr, " else False)")
50
50
 
51
- def get_type(self) -> soialib.reflection.Type:
52
- return soialib.reflection.PrimitiveType(
51
+ def get_type(self) -> reflection.Type:
52
+ return reflection.PrimitiveType(
53
53
  kind="primitive",
54
54
  value="bool",
55
55
  )
@@ -94,8 +94,8 @@ class _Int32Adapter(_AbstractIntAdapter):
94
94
  " < 2147483647 else 2147483647)",
95
95
  )
96
96
 
97
- def get_type(self) -> soialib.reflection.Type:
98
- return soialib.reflection.PrimitiveType(
97
+ def get_type(self) -> reflection.Type:
98
+ return reflection.PrimitiveType(
99
99
  kind="primitive",
100
100
  value="int32",
101
101
  )
@@ -120,8 +120,8 @@ class _Int64Adapter(_AbstractIntAdapter):
120
120
  def to_json_expr(self, in_expr: ExprLike, readable: bool) -> Expr:
121
121
  return Expr.join(Expr.local("int64_to_json", _int64_to_json), "(", in_expr, ")")
122
122
 
123
- def get_type(self) -> soialib.reflection.Type:
124
- return soialib.reflection.PrimitiveType(
123
+ def get_type(self) -> reflection.Type:
124
+ return reflection.PrimitiveType(
125
125
  kind="primitive",
126
126
  value="int64",
127
127
  )
@@ -145,8 +145,8 @@ class _Uint64Adapter(_AbstractIntAdapter):
145
145
  Expr.local("uint64_to_json", _uint64_to_json), "(", in_expr, ")"
146
146
  )
147
147
 
148
- def get_type(self) -> soialib.reflection.Type:
149
- return soialib.reflection.PrimitiveType(
148
+ def get_type(self) -> reflection.Type:
149
+ return reflection.PrimitiveType(
150
150
  kind="primitive",
151
151
  value="uint64",
152
152
  )
@@ -181,8 +181,8 @@ class _AbstractFloatAdapter(AbstractPrimitiveAdapter):
181
181
  class _Float32Adapter(_AbstractFloatAdapter):
182
182
  """Type adapter implementation for float32."""
183
183
 
184
- def get_type(self) -> soialib.reflection.Type:
185
- return soialib.reflection.PrimitiveType(
184
+ def get_type(self) -> reflection.Type:
185
+ return reflection.PrimitiveType(
186
186
  kind="primitive",
187
187
  value="float32",
188
188
  )
@@ -192,8 +192,8 @@ class _Float32Adapter(_AbstractFloatAdapter):
192
192
  class _Float64Adapter(_AbstractFloatAdapter):
193
193
  """Type adapter implementation for float32."""
194
194
 
195
- def get_type(self) -> soialib.reflection.Type:
196
- return soialib.reflection.PrimitiveType(
195
+ def get_type(self) -> reflection.Type:
196
+ return reflection.PrimitiveType(
197
197
  kind="primitive",
198
198
  value="float64",
199
199
  )
@@ -236,8 +236,8 @@ class _TimestampAdapter(AbstractPrimitiveAdapter):
236
236
  fn = Expr.local("_timestamp_from_json", _timestamp_from_json)
237
237
  return Expr.join(fn, "(", json_expr, ")")
238
238
 
239
- def get_type(self) -> soialib.reflection.Type:
240
- return soialib.reflection.PrimitiveType(
239
+ def get_type(self) -> reflection.Type:
240
+ return reflection.PrimitiveType(
241
241
  kind="primitive",
242
242
  value="timestamp",
243
243
  )
@@ -269,8 +269,8 @@ class _StringAdapter(AbstractPrimitiveAdapter):
269
269
  def from_json_expr(self, json_expr: ExprLike) -> Expr:
270
270
  return Expr.join("('' + (", json_expr, " or ''))")
271
271
 
272
- def get_type(self) -> soialib.reflection.Type:
273
- return soialib.reflection.PrimitiveType(
272
+ def get_type(self) -> reflection.Type:
273
+ return reflection.PrimitiveType(
274
274
  kind="primitive",
275
275
  value="string",
276
276
  )
@@ -303,8 +303,8 @@ class _BytesAdapter(AbstractPrimitiveAdapter):
303
303
  Expr.local("fromhex", _BytesAdapter._fromhex_fn), "(", json_expr, ' or "")'
304
304
  )
305
305
 
306
- def get_type(self) -> soialib.reflection.Type:
307
- return soialib.reflection.PrimitiveType(
306
+ def get_type(self) -> reflection.Type:
307
+ return reflection.PrimitiveType(
308
308
  kind="primitive",
309
309
  value="bytes",
310
310
  )
@@ -5,10 +5,11 @@ from functools import cached_property
5
5
  from typing import Any, Generic, TypeVar, cast, final
6
6
  from weakref import WeakValueDictionary
7
7
 
8
- import soialib.reflection
9
- from soialib.impl.function_maker import Expr, LineSpan, make_function
10
- from soialib.impl.type_adapter import TypeAdapter
11
- from soialib.never import Never
8
+ from soia._impl.function_maker import Expr, LineSpan, make_function
9
+ from soia._impl.never import Never
10
+ from soia._impl.type_adapter import TypeAdapter
11
+
12
+ from soia import reflection
12
13
 
13
14
  T = TypeVar("T")
14
15
 
@@ -61,10 +62,10 @@ class Serializer(Generic[T]):
61
62
  return self._from_json_fn(jsonlib.loads(json_code))
62
63
 
63
64
  @cached_property
64
- def type_descriptor(self) -> soialib.reflection.TypeDescriptor:
65
- records: dict[str, soialib.reflection.Record] = {}
65
+ def type_descriptor(self) -> reflection.TypeDescriptor:
66
+ records: dict[str, reflection.Record] = {}
66
67
  self._adapter.register_records(records)
67
- return soialib.reflection.TypeDescriptor(
68
+ return reflection.TypeDescriptor(
68
69
  type=self._adapter.get_type(),
69
70
  records=tuple(records.values()),
70
71
  )
@@ -1,10 +1,10 @@
1
1
  from typing import Final, Literal, TypeVar, overload
2
2
 
3
- from soialib.impl import primitives
4
- from soialib.impl.arrays import get_array_adapter
5
- from soialib.impl.optionals import get_optional_adapter
6
- from soialib.serializer import Serializer, make_serializer
7
- from soialib.timestamp import Timestamp
3
+ from soia._impl import primitives
4
+ from soia._impl.arrays import get_array_adapter
5
+ from soia._impl.optionals import get_optional_adapter
6
+ from soia._impl.serializer import Serializer, make_serializer
7
+ from soia._impl.timestamp import Timestamp
8
8
 
9
9
  Item = TypeVar("Item")
10
10
  Other = TypeVar("Other")
@@ -1,15 +1,19 @@
1
1
  import inspect
2
2
  import json
3
3
  from dataclasses import dataclass
4
- from typing import Any, Callable, Generic, Literal, Mapping, TypeAlias, Union, cast
4
+ from typing import Any, Callable, Generic, Literal, Protocol, TypeAlias, Union, cast
5
+
6
+ from soia._impl.method import Method, Request, Response
7
+
8
+
9
+ class RequestHeaders(Protocol):
10
+ def __getitem__(self, key: str, /) -> str | None: ...
5
11
 
6
- from soialib.method import Method, Request, Response
7
12
 
8
- RequestHeaders: TypeAlias = Mapping[str, str]
9
13
  ResponseHeaders: TypeAlias = dict[str, str]
10
14
 
11
15
 
12
- class ServiceImpl:
16
+ class Service:
13
17
  _number_to_method_impl: dict[int, "_MethodImpl"]
14
18
 
15
19
  def __init__(self):
@@ -23,7 +27,7 @@ class ServiceImpl:
23
27
  Callable[[Request, RequestHeaders], Response],
24
28
  Callable[[Request, RequestHeaders, ResponseHeaders], Response],
25
29
  ],
26
- ) -> "ServiceImpl":
30
+ ) -> "Service":
27
31
  signature = inspect.Signature.from_callable(impl)
28
32
  num_positional_params = 0
29
33
  for param in signature.parameters.values():
@@ -69,6 +73,26 @@ class ServiceImpl:
69
73
  data: str
70
74
  type: Literal["ok-json", "bad-request", "server-error"]
71
75
 
76
+ @property
77
+ def status_code(self):
78
+ if self.type == "ok-json":
79
+ return 200
80
+ elif self.type == "bad-request":
81
+ return 400
82
+ elif self.type == "server-error":
83
+ return 500
84
+ else:
85
+ raise TypeError(f"Unknown response type: {self.type}")
86
+
87
+ @property
88
+ def content_type(self):
89
+ if self.type == "ok-json":
90
+ return "application/json"
91
+ elif self.type == "bad-request" or self.type == "server-error":
92
+ return "text/plain; charset=utf-8"
93
+ else:
94
+ raise TypeError(f"Unknown response type: {self.type}")
95
+
72
96
  def handle_request(
73
97
  self,
74
98
  req_body: str,
@@ -2,8 +2,7 @@ import http.client
2
2
  from typing import Final, Mapping
3
3
  from urllib.parse import urlparse
4
4
 
5
- from soialib import Method
6
- from soialib.method import Request, Response
5
+ from soia._impl.method import Method, Request, Response
7
6
 
8
7
 
9
8
  class ServiceClient:
@@ -3,9 +3,7 @@ from collections.abc import Callable, Sequence
3
3
  from dataclasses import FrozenInstanceError, dataclass
4
4
  from typing import Any, Final, Union, cast
5
5
 
6
- import soialib.reflection
7
- from soialib import spec as _spec
8
- from soialib.impl.function_maker import (
6
+ from soia._impl.function_maker import (
9
7
  BodyBuilder,
10
8
  Expr,
11
9
  ExprLike,
@@ -16,8 +14,10 @@ from soialib.impl.function_maker import (
16
14
  Params,
17
15
  make_function,
18
16
  )
19
- from soialib.impl.repr import repr_impl
20
- from soialib.impl.type_adapter import TypeAdapter
17
+ from soia._impl.repr import repr_impl
18
+ from soia._impl.type_adapter import TypeAdapter
19
+
20
+ from soia import _spec, reflection
21
21
 
22
22
 
23
23
  class StructAdapter(TypeAdapter):
@@ -201,24 +201,24 @@ class StructAdapter(TypeAdapter):
201
201
  Expr.local("_cls?", self.gen_class), f".{fn_name}(", json_expr, ")"
202
202
  )
203
203
 
204
- def get_type(self) -> soialib.reflection.Type:
205
- return soialib.reflection.RecordType(
204
+ def get_type(self) -> reflection.Type:
205
+ return reflection.RecordType(
206
206
  kind="record",
207
207
  value=self.spec.id,
208
208
  )
209
209
 
210
210
  def register_records(
211
211
  self,
212
- registry: dict[str, soialib.reflection.Record],
212
+ registry: dict[str, reflection.Record],
213
213
  ) -> None:
214
214
  record_id = self.spec.id
215
215
  if record_id in registry:
216
216
  return
217
- registry[record_id] = soialib.reflection.Record(
217
+ registry[record_id] = reflection.Record(
218
218
  kind="struct",
219
219
  id=record_id,
220
220
  fields=tuple(
221
- soialib.reflection.Field(
221
+ reflection.Field(
222
222
  name=field.field.name,
223
223
  number=field.field.number,
224
224
  type=field.type.get_type(),
@@ -1,9 +1,9 @@
1
1
  from collections.abc import Callable
2
2
  from typing import Protocol
3
3
 
4
- import soialib.reflection
5
- from soialib import spec
6
- from soialib.impl.function_maker import ExprLike
4
+ from soia._impl.function_maker import ExprLike
5
+
6
+ from soia import _spec, reflection
7
7
 
8
8
 
9
9
  class TypeAdapter(Protocol):
@@ -52,12 +52,12 @@ class TypeAdapter(Protocol):
52
52
 
53
53
  def finalize(
54
54
  self,
55
- resolve_type_fn: Callable[[spec.Type], "TypeAdapter"],
55
+ resolve_type_fn: Callable[[_spec.Type], "TypeAdapter"],
56
56
  ) -> None: ...
57
57
 
58
- def get_type(self) -> soialib.reflection.Type: ...
58
+ def get_type(self) -> reflection.Type: ...
59
59
 
60
60
  def register_records(
61
61
  self,
62
- registry: dict[str, soialib.reflection.Record],
62
+ registry: dict[str, reflection.Record],
63
63
  ) -> None: ...
@@ -1,9 +1,10 @@
1
1
  from typing import Any, Union
2
2
 
3
- from soialib import method, spec
4
- from soialib.impl import arrays, enums, optionals, primitives, structs
5
- from soialib.impl.type_adapter import TypeAdapter
6
- from soialib.serializer import make_serializer
3
+ from soia._impl import arrays, enums, method, optionals, primitives, structs
4
+ from soia._impl.serializer import make_serializer
5
+ from soia._impl.type_adapter import TypeAdapter
6
+
7
+ from soia import _spec
7
8
 
8
9
  RecordAdapter = Union[structs.StructAdapter, enums.EnumAdapter]
9
10
 
@@ -12,39 +13,39 @@ _record_id_to_adapter: dict[str, RecordAdapter] = {}
12
13
 
13
14
 
14
15
  def init_module(
15
- records: tuple[spec.Record, ...],
16
- methods: tuple[spec.Method, ...],
17
- constants: tuple[spec.Constant, ...],
16
+ records: tuple[_spec.Record, ...],
17
+ methods: tuple[_spec.Method, ...],
18
+ constants: tuple[_spec.Constant, ...],
18
19
  globals: dict[str, Any],
19
20
  # For testing
20
21
  record_id_to_adapter: dict[str, RecordAdapter] = _record_id_to_adapter,
21
22
  ) -> None:
22
- def resolve_type(type: spec.Type) -> TypeAdapter:
23
- if isinstance(type, spec.PrimitiveType):
24
- if type == spec.PrimitiveType.BOOL:
23
+ def resolve_type(type: _spec.Type) -> TypeAdapter:
24
+ if isinstance(type, _spec.PrimitiveType):
25
+ if type == _spec.PrimitiveType.BOOL:
25
26
  return primitives.BOOL_ADAPTER
26
- elif type == spec.PrimitiveType.BYTES:
27
+ elif type == _spec.PrimitiveType.BYTES:
27
28
  return primitives.BYTES_ADAPTER
28
- elif type == spec.PrimitiveType.FLOAT32:
29
+ elif type == _spec.PrimitiveType.FLOAT32:
29
30
  return primitives.FLOAT32_ADAPTER
30
- elif type == spec.PrimitiveType.FLOAT64:
31
+ elif type == _spec.PrimitiveType.FLOAT64:
31
32
  return primitives.FLOAT64_ADAPTER
32
- elif type == spec.PrimitiveType.INT32:
33
+ elif type == _spec.PrimitiveType.INT32:
33
34
  return primitives.INT32_ADAPTER
34
- elif type == spec.PrimitiveType.INT64:
35
+ elif type == _spec.PrimitiveType.INT64:
35
36
  return primitives.INT64_ADAPTER
36
- elif type == spec.PrimitiveType.STRING:
37
+ elif type == _spec.PrimitiveType.STRING:
37
38
  return primitives.STRING_ADAPTER
38
- elif type == spec.PrimitiveType.TIMESTAMP:
39
+ elif type == _spec.PrimitiveType.TIMESTAMP:
39
40
  return primitives.TIMESTAMP_ADAPTER
40
- elif type == spec.PrimitiveType.UINT64:
41
+ elif type == _spec.PrimitiveType.UINT64:
41
42
  return primitives.UINT64_ADAPTER
42
- elif isinstance(type, spec.ArrayType):
43
+ elif isinstance(type, _spec.ArrayType):
43
44
  return arrays.get_array_adapter(
44
45
  resolve_type(type.item),
45
46
  type.key_attributes,
46
47
  )
47
- elif isinstance(type, spec.OptionalType):
48
+ elif isinstance(type, _spec.OptionalType):
48
49
  return optionals.get_optional_adapter(resolve_type(type.other))
49
50
  elif isinstance(type, str):
50
51
  # A record id.
@@ -55,7 +56,7 @@ def init_module(
55
56
  if record.id in record_id_to_adapter:
56
57
  raise AssertionError(record.id)
57
58
  adapter: RecordAdapter
58
- if isinstance(record, spec.Struct):
59
+ if isinstance(record, _spec.Struct):
59
60
  adapter = structs.StructAdapter(record)
60
61
  else:
61
62
  adapter = enums.EnumAdapter(record)
@@ -67,7 +68,7 @@ def init_module(
67
68
  gen_class = adapter.gen_class
68
69
  # Add the class name to either globals() if the record is defined at the top
69
70
  # level, or the parent class otherwise.
70
- record_id = spec.RecordId.parse(adapter.spec.id)
71
+ record_id = _spec.RecordId.parse(adapter.spec.id)
71
72
  parent_id = record_id.parent
72
73
  class_name = adapter.spec.class_name
73
74
  if parent_id:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soia-client
3
- Version: 1.0.14
3
+ Version: 1.0.16
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -0,0 +1,26 @@
1
+ soia/__init__.py,sha256=mI-PNb0RHa0mq4m0e6NKIcQsR8EFkTeKHzh6bVbnRYg,722
2
+ soia/_module_initializer.py,sha256=1TWnc0qUO7_iljQR2ywVERrrkY5jIkT3zucc-AYZyrQ,4221
3
+ soia/_spec.py,sha256=Y5EHHQa6qNeJc29aaqGrFPnPFXxlL7TED9_AXUGBjf0,3663
4
+ soia/reflection.py,sha256=U5knJGmawARCdcEhNxek4dvx48WLPETLqIqKBPWwT4Q,8771
5
+ soia/_impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ soia/_impl/arrays.py,sha256=VjvO3-OpBIk6JvGFdTgKhpano1AeHcMCvr0FjeN-GxA,5443
7
+ soia/_impl/enums.py,sha256=Pc9ngDPNfDtUKl0tXRTti6hfqMW1-6SA3SogkOa389A,16962
8
+ soia/_impl/function_maker.py,sha256=MvCDv1WwzKGJzZbNCnJ_8-MP3m1xTIabumXA-9Ydd9M,5639
9
+ soia/_impl/keyed_items.py,sha256=EoPrdeLJ8i7zCH-oW-7qOcyadyrzykB6lkrf3xRVmyk,337
10
+ soia/_impl/method.py,sha256=C6ygh-Li4zADxFR_gfeBTuPUzLjZ1XHCp0ZI4-uiRYs,455
11
+ soia/_impl/never.py,sha256=T7PHtIipuXlici4wa0yuJKrn9JgcT-ODC3QVCwsPprY,46
12
+ soia/_impl/optionals.py,sha256=KTgmbfYLJLrju5v10jgnnnW98QG6NYw2We3gdgi9i2E,2414
13
+ soia/_impl/primitives.py,sha256=Xk26Fv4oQG2oXd3tS_2sAnJYQdXYX9nva09713AcJvs,8940
14
+ soia/_impl/repr.py,sha256=7WX0bEAVENTjlyZIcbT8TcJylS7IRIyafGCmqaIMxFM,1413
15
+ soia/_impl/serializer.py,sha256=28IwkjtUnLpbnPQfVNfJXkApCK4JhXHwLkC5MVhF8xo,3529
16
+ soia/_impl/serializers.py,sha256=IL9jHHMo11pgrL1-crarOEElvTyV5YM6FTcgumjW6IU,2564
17
+ soia/_impl/service.py,sha256=Z0HZlitdEyosbrTXK8OQMnqvahywUJPi7GRTnyRE8B4,6004
18
+ soia/_impl/service_client.py,sha256=5gS7tUt0LJdKGxJsjNU6-aQaZk4dRg1alT83oJfqIZo,2218
19
+ soia/_impl/structs.py,sha256=YTc3Ykj2TxPquar2XsP2DhFfkfIoELXOveyd8yTqN90,26545
20
+ soia/_impl/timestamp.py,sha256=lXBNH8mPmzflkNjSKZSBl2XS-ot9N8N92B_zGO2SMtU,4078
21
+ soia/_impl/type_adapter.py,sha256=RyIyh4Fnt9rMy0HRzC-a2v2JAdZsV9FBzoGEUVygVRE,2101
22
+ soia_client-1.0.16.dist-info/licenses/LICENSE,sha256=SaAftKkX6hfSOiPdENQPS70tifH3PDHgazq8eK2Pwfw,1064
23
+ soia_client-1.0.16.dist-info/METADATA,sha256=mAhZErll3dmFwg-rMhQWEwd-EWFi9yf2rvCpBjS3a14,1667
24
+ soia_client-1.0.16.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
+ soia_client-1.0.16.dist-info/top_level.txt,sha256=lsYG9JrvauFe1oIV5zvnwsS9hsx3ztwfK_937op9mxc,5
26
+ soia_client-1.0.16.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ soia
@@ -1,27 +0,0 @@
1
- soia_client-1.0.14.dist-info/licenses/LICENSE,sha256=SaAftKkX6hfSOiPdENQPS70tifH3PDHgazq8eK2Pwfw,1064
2
- soialib/_.py,sha256=I4SxBM3brmE9D6hyrDrdkbfVnDLVRWaGwnj0C9Zxh54,52
3
- soialib/__init__.py,sha256=pUvVymO9x1rI68xZkbVvrhO1sHs4ECQ5pu2R2xHjoio,636
4
- soialib/keyed_items.py,sha256=q7MCn82obf-0jh7FcAhuw4eh9-wtuHIpkEFcSfc8EaY,338
5
- soialib/method.py,sha256=2qWG4jMqYhS3hA8y8YDu3iqzhXA_AKebpB38RWNmsYQ,452
6
- soialib/module_initializer.py,sha256=Riq6B6cS9HUG1W8tyaa0GkiG3F4fGX70bKU0UOCnrRw,4205
7
- soialib/never.py,sha256=bYU63XyNX4e2wOUXQHhHWGO-an4IFr9_ur1ut6GmGN0,47
8
- soialib/reflection.py,sha256=U5knJGmawARCdcEhNxek4dvx48WLPETLqIqKBPWwT4Q,8771
9
- soialib/serializer.py,sha256=Lprzy8RTWjwpQ5D4L0lj8NTpUAZxpzjfc-qUQs9egHs,3551
10
- soialib/serializers.py,sha256=vNLNsfuu6dF0ivJF6v7wQj5Yr6uo2kZHXG5tMrYiVTA,2564
11
- soialib/service.py,sha256=LWNlf2fH8ZgtssjXJnLiFQmtWTg4CrWo20y-Qlf2HXA,5263
12
- soialib/service_client.py,sha256=zJ7MhrTiF-T1yXJwCXcHyKbiD19QfUSAoxfj32B62a0,2234
13
- soialib/spec.py,sha256=Y5EHHQa6qNeJc29aaqGrFPnPFXxlL7TED9_AXUGBjf0,3663
14
- soialib/timestamp.py,sha256=lXBNH8mPmzflkNjSKZSBl2XS-ot9N8N92B_zGO2SMtU,4078
15
- soialib/impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- soialib/impl/arrays.py,sha256=jvyaCAralf-gmdbQxVd5-KobEs32LcMN6DUlBo3m9A8,5490
17
- soialib/impl/enums.py,sha256=xzBfpN5lQDzulPicZNRuqe4eAZ82DxCd_zWr8XxCUDw,17032
18
- soialib/impl/function_maker.py,sha256=MvCDv1WwzKGJzZbNCnJ_8-MP3m1xTIabumXA-9Ydd9M,5639
19
- soialib/impl/optionals.py,sha256=rAtylhc6LM4kNLYkbLF5kVLCxNa0A1tYglHvlQszLMQ,2456
20
- soialib/impl/primitives.py,sha256=E3rd6TZWDGqBzmrFwVGG2DZLMwDVoznLmilAgoCTT5Q,9106
21
- soialib/impl/repr.py,sha256=7WX0bEAVENTjlyZIcbT8TcJylS7IRIyafGCmqaIMxFM,1413
22
- soialib/impl/structs.py,sha256=3YW05rDRmp3G38FZ4CbIjudz6Txog3ymcD28NHf0uGA,26615
23
- soialib/impl/type_adapter.py,sha256=Q-PacpFKXfYBRF6dqHaf3VO7BcvqG7C6k5aXDFACMGY,2133
24
- soia_client-1.0.14.dist-info/METADATA,sha256=CeNC9i68qb1GPp5eH8FMDYDm4_lDmjDHjZ9CxsY_yQI,1667
25
- soia_client-1.0.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
26
- soia_client-1.0.14.dist-info/top_level.txt,sha256=2vPmAo5G0SrCxYrNdJKJJVdpalYppgjO2mmz2PtsFUI,8
27
- soia_client-1.0.14.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- soialib
soialib/_.py DELETED
@@ -1,3 +0,0 @@
1
- from typing import Any, Final
2
-
3
- _: Final[Any] = None
soialib/__init__.py DELETED
@@ -1,25 +0,0 @@
1
- from soialib.keyed_items import KeyedItems
2
- from soialib.method import Method
3
- from soialib.serializer import Serializer
4
- from soialib.serializers import (
5
- array_serializer,
6
- optional_serializer,
7
- primitive_serializer,
8
- )
9
- from soialib.service import RequestHeaders, ResponseHeaders, ServiceImpl
10
- from soialib.service_client import ServiceClient
11
- from soialib.timestamp import Timestamp
12
-
13
- __all__ = [
14
- "KeyedItems",
15
- "Method",
16
- "RequestHeaders",
17
- "ResponseHeaders",
18
- "Serializer",
19
- "ServiceImpl",
20
- "ServiceClient",
21
- "Timestamp",
22
- "array_serializer",
23
- "optional_serializer",
24
- "primitive_serializer",
25
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes