fxn 0.0.37__tar.gz → 0.0.39__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.
- {fxn-0.0.37 → fxn-0.0.39}/PKG-INFO +15 -9
- {fxn-0.0.37 → fxn-0.0.39}/README.md +14 -8
- {fxn-0.0.37 → fxn-0.0.39}/fxn/__init__.py +1 -1
- fxn-0.0.39/fxn/lib/linux/arm64/libFunction.so +0 -0
- fxn-0.0.39/fxn/lib/linux/x86_64/libFunction.so +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/lib/macos/arm64/Function.dylib +0 -0
- fxn-0.0.39/fxn/lib/macos/x86_64/Function.dylib +0 -0
- fxn-0.0.39/fxn/lib/windows/arm64/Function.dll +0 -0
- fxn-0.0.39/fxn/lib/windows/x86_64/Function.dll +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/services/prediction.py +32 -38
- {fxn-0.0.37 → fxn-0.0.39}/fxn/services/predictor.py +1 -1
- {fxn-0.0.37 → fxn-0.0.39}/fxn/types/__init__.py +1 -4
- {fxn-0.0.37 → fxn-0.0.39}/fxn/types/predictor.py +4 -4
- fxn-0.0.37/fxn/types/profile.py → fxn-0.0.39/fxn/types/user.py +6 -1
- {fxn-0.0.37 → fxn-0.0.39}/fxn/version.py +1 -1
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/PKG-INFO +15 -9
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/SOURCES.txt +2 -4
- fxn-0.0.37/fxn/lib/macos/x86_64/Function.dylib +0 -0
- fxn-0.0.37/fxn/lib/windows/arm64/Function.dll +0 -0
- fxn-0.0.37/fxn/lib/windows/x86_64/Function.dll +0 -0
- fxn-0.0.37/fxn/types/environment.py +0 -17
- fxn-0.0.37/fxn/types/storage.py +0 -14
- fxn-0.0.37/fxn/types/tag.py +0 -28
- fxn-0.0.37/fxn/types/user.py +0 -11
- {fxn-0.0.37 → fxn-0.0.39}/LICENSE +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/api/__init__.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/api/client.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/__init__.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/configuration.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/dtype.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/fxnc.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/map.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/prediction.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/predictor.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/status.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/stream.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/value.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/c/version.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/__init__.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/auth.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/env.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/misc.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/predict.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/cli/predictors.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/function.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/lib/__init__.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/services/__init__.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/services/user.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/types/dtype.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn/types/prediction.py +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/dependency_links.txt +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/entry_points.txt +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/requires.txt +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/fxn.egg-info/top_level.txt +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/pyproject.toml +0 -0
- {fxn-0.0.37 → fxn-0.0.39}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fxn
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.39
|
4
4
|
Summary: Run prediction functions locally in Python. Register at https://fxn.ai.
|
5
5
|
Author-email: "NatML Inc." <hi@fxn.ai>
|
6
6
|
License: Apache License
|
@@ -239,20 +239,24 @@ $ pip install --upgrade fxn
|
|
239
239
|
```
|
240
240
|
|
241
241
|
> [!NOTE]
|
242
|
-
> Function requires Python 3.
|
242
|
+
> Function requires Python 3.10+
|
243
243
|
|
244
244
|
## Retrieving your Access Key
|
245
|
-
Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
|
245
|
+
Head over to [fxn.ai](https://www.fxn.ai/account/developer) to create an account by logging in. Once you do, generate an access key:
|
246
246
|
|
247
247
|

|
248
248
|
|
249
249
|
## Making a Prediction
|
250
|
-
|
250
|
+
First, create a Function client, specifying your access key:
|
251
251
|
```py
|
252
252
|
from fxn import Function
|
253
253
|
|
254
254
|
# Create the Function client
|
255
255
|
fxn = Function(access_key="<Function access key>")
|
256
|
+
```
|
257
|
+
|
258
|
+
Then make a prediction:
|
259
|
+
```py
|
256
260
|
# Create a prediction
|
257
261
|
prediction = fxn.predictions.create(
|
258
262
|
tag="@fxn/greeting",
|
@@ -264,16 +268,18 @@ print(prediction.results[0])
|
|
264
268
|
|
265
269
|
> [!TIP]
|
266
270
|
> Explore public predictors [on Function](https://fxn.ai/explore) or [create your own](https://fxn.ai/waitlist).
|
267
|
-
r
|
268
|
-
## Using the Function CLI
|
269
|
-
Open up a terminal and run the following command:
|
270
271
|
|
272
|
+
## Using the Function CLI
|
273
|
+
Open up a terminal and login to the Function CLI:
|
271
274
|
```sh
|
272
275
|
# Login to Function
|
273
|
-
fxn auth login <ACCESS KEY>
|
276
|
+
$ fxn auth login <ACCESS KEY>
|
277
|
+
```
|
274
278
|
|
279
|
+
Then make a prediction:
|
280
|
+
```sh
|
275
281
|
# Make a prediction using the Function CLI
|
276
|
-
fxn predict @fxn/greeting --name Peter
|
282
|
+
$ fxn predict @fxn/greeting --name Peter
|
277
283
|
```
|
278
284
|
|
279
285
|
___
|
@@ -14,20 +14,24 @@ $ pip install --upgrade fxn
|
|
14
14
|
```
|
15
15
|
|
16
16
|
> [!NOTE]
|
17
|
-
> Function requires Python 3.
|
17
|
+
> Function requires Python 3.10+
|
18
18
|
|
19
19
|
## Retrieving your Access Key
|
20
|
-
Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
|
20
|
+
Head over to [fxn.ai](https://www.fxn.ai/account/developer) to create an account by logging in. Once you do, generate an access key:
|
21
21
|
|
22
22
|

|
23
23
|
|
24
24
|
## Making a Prediction
|
25
|
-
|
25
|
+
First, create a Function client, specifying your access key:
|
26
26
|
```py
|
27
27
|
from fxn import Function
|
28
28
|
|
29
29
|
# Create the Function client
|
30
30
|
fxn = Function(access_key="<Function access key>")
|
31
|
+
```
|
32
|
+
|
33
|
+
Then make a prediction:
|
34
|
+
```py
|
31
35
|
# Create a prediction
|
32
36
|
prediction = fxn.predictions.create(
|
33
37
|
tag="@fxn/greeting",
|
@@ -39,16 +43,18 @@ print(prediction.results[0])
|
|
39
43
|
|
40
44
|
> [!TIP]
|
41
45
|
> Explore public predictors [on Function](https://fxn.ai/explore) or [create your own](https://fxn.ai/waitlist).
|
42
|
-
r
|
43
|
-
## Using the Function CLI
|
44
|
-
Open up a terminal and run the following command:
|
45
46
|
|
47
|
+
## Using the Function CLI
|
48
|
+
Open up a terminal and login to the Function CLI:
|
46
49
|
```sh
|
47
50
|
# Login to Function
|
48
|
-
fxn auth login <ACCESS KEY>
|
51
|
+
$ fxn auth login <ACCESS KEY>
|
52
|
+
```
|
49
53
|
|
54
|
+
Then make a prediction:
|
55
|
+
```sh
|
50
56
|
# Make a prediction using the Function CLI
|
51
|
-
fxn predict @fxn/greeting --name Peter
|
57
|
+
$ fxn predict @fxn/greeting --name Peter
|
52
58
|
```
|
53
59
|
|
54
60
|
___
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -17,6 +17,7 @@ from PIL import Image
|
|
17
17
|
from platform import machine, system
|
18
18
|
from pydantic import BaseModel
|
19
19
|
from requests import get, post
|
20
|
+
from tempfile import gettempdir
|
20
21
|
from typing import Any, AsyncIterator, Dict, List, Optional, Union
|
21
22
|
from urllib.parse import urlparse
|
22
23
|
|
@@ -30,12 +31,14 @@ class PredictionService:
|
|
30
31
|
self.client = client
|
31
32
|
self.__fxnc = PredictionService.__load_fxnc()
|
32
33
|
self.__cache = { }
|
34
|
+
self.__cache_dir = self.__class__.__get_resource_dir() / ".fxn" / "cache"
|
35
|
+
self.__cache_dir.mkdir(exist_ok=True)
|
33
36
|
|
34
37
|
def create (
|
35
38
|
self,
|
36
39
|
tag: str,
|
37
40
|
*,
|
38
|
-
inputs: Optional[Dict[str,
|
41
|
+
inputs: Optional[Dict[str, ndarray | str | float | int | bool | List[Any] | Dict[str, Any] | Path | Image.Image]] = None,
|
39
42
|
acceleration: Acceleration=Acceleration.Default,
|
40
43
|
client_id: str=None,
|
41
44
|
configuration_id: str=None
|
@@ -58,7 +61,7 @@ class PredictionService:
|
|
58
61
|
return self.__predict(tag=tag, predictor=self.__cache[tag], inputs=inputs)
|
59
62
|
# Query
|
60
63
|
response = post(
|
61
|
-
f"{self.client.api_url}/predict/{tag}
|
64
|
+
f"{self.client.api_url}/predict/{tag}",
|
62
65
|
json={ },
|
63
66
|
headers={
|
64
67
|
"Authorization": f"Bearer {self.client.access_key}",
|
@@ -88,7 +91,7 @@ class PredictionService:
|
|
88
91
|
self,
|
89
92
|
tag: str,
|
90
93
|
*,
|
91
|
-
inputs: Dict[str,
|
94
|
+
inputs: Dict[str, float | int | str | bool | NDArray | List[Any] | Dict[str, Any] | Path | Image.Image] = {},
|
92
95
|
acceleration: Acceleration=Acceleration.Default,
|
93
96
|
client_id: str=None,
|
94
97
|
configuration_id: str=None
|
@@ -124,35 +127,22 @@ class PredictionService:
|
|
124
127
|
prediction = self.__predict(tag=tag, predictor=predictor, inputs=inputs)
|
125
128
|
# Yield
|
126
129
|
yield prediction
|
127
|
-
|
130
|
+
|
128
131
|
@classmethod
|
129
|
-
def __load_fxnc (
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
if
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
elif os == "Windows":
|
140
|
-
package = f"fxn.lib.windows.{machine()}"
|
141
|
-
resource = f"Function.dll"
|
142
|
-
else:
|
143
|
-
return None
|
144
|
-
# Load
|
132
|
+
def __load_fxnc (cls) -> Optional[CDLL]:
|
133
|
+
os = system().lower()
|
134
|
+
os = "macos" if os == "darwin" else os
|
135
|
+
arch = machine().lower()
|
136
|
+
arch = "arm64" if arch == "aarch64" else arch
|
137
|
+
arch = "x86_64" if arch in ["x64", "amd64"] else arch
|
138
|
+
package = f"fxn.lib.{os}.{arch}"
|
139
|
+
resource = "libFunction.so"
|
140
|
+
resource = "Function.dylib" if os == "macos" else resource
|
141
|
+
resource = "Function.dll" if os == "windows" else resource
|
145
142
|
with resources.path(package, resource) as fxnc_path:
|
146
143
|
return load_fxnc(fxnc_path)
|
147
144
|
|
148
145
|
def __get_client_id (self) -> str:
|
149
|
-
# Fallback if fxnc failed to load
|
150
|
-
if not self.__fxnc:
|
151
|
-
return {
|
152
|
-
"Darwin": f"macos-{machine()}",
|
153
|
-
"Linux": f"linux-{machine()}",
|
154
|
-
"Windows": f"windows-{machine()}"
|
155
|
-
}[system()]
|
156
146
|
# Get
|
157
147
|
buffer = create_string_buffer(64)
|
158
148
|
status = self.__fxnc.FXNConfigurationGetClientID(buffer, len(buffer))
|
@@ -285,7 +275,7 @@ class PredictionService:
|
|
285
275
|
|
286
276
|
def __to_value (
|
287
277
|
self,
|
288
|
-
value:
|
278
|
+
value: float | int | bool | str | NDArray | List[Any] | Dict[str, Any] | Image.Image | bytes | bytearray | memoryview | BytesIO | None
|
289
279
|
) -> type[FXNValueRef]:
|
290
280
|
value = PredictionService.__try_ensure_serializable(value)
|
291
281
|
fxnc = self.__fxnc
|
@@ -343,7 +333,7 @@ class PredictionService:
|
|
343
333
|
def __to_object (
|
344
334
|
self,
|
345
335
|
value: type[FXNValueRef]
|
346
|
-
) ->
|
336
|
+
) -> float | int | bool | str | NDArray | List[Any] | Dict[str, Any] | Image.Image | BytesIO | None:
|
347
337
|
# Type
|
348
338
|
fxnc = self.__fxnc
|
349
339
|
dtype = FXNDtype()
|
@@ -383,10 +373,8 @@ class PredictionService:
|
|
383
373
|
raise RuntimeError(f"Failed to convert Function value to Python value because Function value has unsupported type: {dtype}")
|
384
374
|
|
385
375
|
def __get_resource_path (self, resource: PredictionResource) -> Path:
|
386
|
-
cache_dir = Path.home() / ".fxn" / "cache"
|
387
|
-
cache_dir.mkdir(exist_ok=True)
|
388
376
|
res_name = Path(urlparse(resource.url).path).name
|
389
|
-
res_path =
|
377
|
+
res_path = self.__cache_dir / res_name
|
390
378
|
if res_path.exists():
|
391
379
|
return res_path
|
392
380
|
req = get(resource.url)
|
@@ -394,7 +382,18 @@ class PredictionService:
|
|
394
382
|
with open(res_path, "wb") as f:
|
395
383
|
f.write(req.content)
|
396
384
|
return res_path
|
397
|
-
|
385
|
+
|
386
|
+
@classmethod
|
387
|
+
def __get_resource_dir (cls) -> Path:
|
388
|
+
try:
|
389
|
+
check = Path.home() / ".fxntest"
|
390
|
+
with open(check, "w") as f:
|
391
|
+
f.write("fxn")
|
392
|
+
check.unlink()
|
393
|
+
return Path.home()
|
394
|
+
except:
|
395
|
+
return Path(gettempdir())
|
396
|
+
|
398
397
|
@classmethod
|
399
398
|
def __try_ensure_serializable (cls, object: Any) -> Any:
|
400
399
|
if object is None:
|
@@ -427,11 +426,6 @@ resources {{
|
|
427
426
|
url
|
428
427
|
name
|
429
428
|
}}
|
430
|
-
results {{
|
431
|
-
data
|
432
|
-
type
|
433
|
-
shape
|
434
|
-
}}
|
435
429
|
latency
|
436
430
|
error
|
437
431
|
logs
|
@@ -4,9 +4,6 @@
|
|
4
4
|
#
|
5
5
|
|
6
6
|
from .dtype import Dtype
|
7
|
-
from .environment import EnvironmentVariable
|
8
7
|
from .prediction import Prediction, PredictionResource
|
9
8
|
from .predictor import Acceleration, AccessMode, EnumerationMember, Parameter, Predictor, PredictorStatus, Signature
|
10
|
-
from .
|
11
|
-
from .storage import UploadType
|
12
|
-
from .user import User
|
9
|
+
from .user import Profile, User
|
@@ -11,16 +11,16 @@ from pydantic import AliasChoices, BaseModel, ConfigDict, Field
|
|
11
11
|
from typing import Any, Dict, List, Optional, Tuple
|
12
12
|
|
13
13
|
from .dtype import Dtype
|
14
|
-
from .
|
14
|
+
from .user import Profile
|
15
15
|
|
16
16
|
class Acceleration (IntFlag):
|
17
17
|
"""
|
18
18
|
Predictor acceleration.
|
19
19
|
"""
|
20
20
|
Default = 0,
|
21
|
-
CPU
|
22
|
-
GPU
|
23
|
-
NPU
|
21
|
+
CPU = 1 << 0,
|
22
|
+
GPU = 1 << 1,
|
23
|
+
NPU = 1 << 2
|
24
24
|
|
25
25
|
class AccessMode (str, Enum):
|
26
26
|
"""
|
@@ -27,4 +27,9 @@ class Profile (BaseModel):
|
|
27
27
|
avatar: Optional[str] = Field(default=None, description="User avatar URL.")
|
28
28
|
bio: Optional[str] = Field(default=None, description="User bio.")
|
29
29
|
website: Optional[str] = Field(default=None, description="User website.")
|
30
|
-
github: Optional[str] = Field(default=None, description="User GitHub handle.")
|
30
|
+
github: Optional[str] = Field(default=None, description="User GitHub handle.")
|
31
|
+
|
32
|
+
class User (Profile):
|
33
|
+
"""
|
34
|
+
User.
|
35
|
+
"""
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fxn
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.39
|
4
4
|
Summary: Run prediction functions locally in Python. Register at https://fxn.ai.
|
5
5
|
Author-email: "NatML Inc." <hi@fxn.ai>
|
6
6
|
License: Apache License
|
@@ -239,20 +239,24 @@ $ pip install --upgrade fxn
|
|
239
239
|
```
|
240
240
|
|
241
241
|
> [!NOTE]
|
242
|
-
> Function requires Python 3.
|
242
|
+
> Function requires Python 3.10+
|
243
243
|
|
244
244
|
## Retrieving your Access Key
|
245
|
-
Head over to [fxn.ai](https://fxn.ai) to create an account by logging in. Once you do, generate an access key:
|
245
|
+
Head over to [fxn.ai](https://www.fxn.ai/account/developer) to create an account by logging in. Once you do, generate an access key:
|
246
246
|
|
247
247
|

|
248
248
|
|
249
249
|
## Making a Prediction
|
250
|
-
|
250
|
+
First, create a Function client, specifying your access key:
|
251
251
|
```py
|
252
252
|
from fxn import Function
|
253
253
|
|
254
254
|
# Create the Function client
|
255
255
|
fxn = Function(access_key="<Function access key>")
|
256
|
+
```
|
257
|
+
|
258
|
+
Then make a prediction:
|
259
|
+
```py
|
256
260
|
# Create a prediction
|
257
261
|
prediction = fxn.predictions.create(
|
258
262
|
tag="@fxn/greeting",
|
@@ -264,16 +268,18 @@ print(prediction.results[0])
|
|
264
268
|
|
265
269
|
> [!TIP]
|
266
270
|
> Explore public predictors [on Function](https://fxn.ai/explore) or [create your own](https://fxn.ai/waitlist).
|
267
|
-
r
|
268
|
-
## Using the Function CLI
|
269
|
-
Open up a terminal and run the following command:
|
270
271
|
|
272
|
+
## Using the Function CLI
|
273
|
+
Open up a terminal and login to the Function CLI:
|
271
274
|
```sh
|
272
275
|
# Login to Function
|
273
|
-
fxn auth login <ACCESS KEY>
|
276
|
+
$ fxn auth login <ACCESS KEY>
|
277
|
+
```
|
274
278
|
|
279
|
+
Then make a prediction:
|
280
|
+
```sh
|
275
281
|
# Make a prediction using the Function CLI
|
276
|
-
fxn predict @fxn/greeting --name Peter
|
282
|
+
$ fxn predict @fxn/greeting --name Peter
|
277
283
|
```
|
278
284
|
|
279
285
|
___
|
@@ -30,6 +30,8 @@ fxn/cli/misc.py
|
|
30
30
|
fxn/cli/predict.py
|
31
31
|
fxn/cli/predictors.py
|
32
32
|
fxn/lib/__init__.py
|
33
|
+
fxn/lib/linux/arm64/libFunction.so
|
34
|
+
fxn/lib/linux/x86_64/libFunction.so
|
33
35
|
fxn/lib/macos/arm64/Function.dylib
|
34
36
|
fxn/lib/macos/x86_64/Function.dylib
|
35
37
|
fxn/lib/windows/arm64/Function.dll
|
@@ -40,10 +42,6 @@ fxn/services/predictor.py
|
|
40
42
|
fxn/services/user.py
|
41
43
|
fxn/types/__init__.py
|
42
44
|
fxn/types/dtype.py
|
43
|
-
fxn/types/environment.py
|
44
45
|
fxn/types/prediction.py
|
45
46
|
fxn/types/predictor.py
|
46
|
-
fxn/types/profile.py
|
47
|
-
fxn/types/storage.py
|
48
|
-
fxn/types/tag.py
|
49
47
|
fxn/types/user.py
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,17 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Function
|
3
|
-
# Copyright © 2024 NatML Inc. All Rights Reserved.
|
4
|
-
#
|
5
|
-
|
6
|
-
from pydantic import BaseModel, Field
|
7
|
-
|
8
|
-
class EnvironmentVariable (BaseModel):
|
9
|
-
"""
|
10
|
-
Predictor environment variable.
|
11
|
-
|
12
|
-
Members:
|
13
|
-
name (str): Variable name.
|
14
|
-
value (str): Variable value.
|
15
|
-
"""
|
16
|
-
name: str = Field(description="Variable name.")
|
17
|
-
value: str = Field(description="Variable value.")
|
fxn-0.0.37/fxn/types/storage.py
DELETED
fxn-0.0.37/fxn/types/tag.py
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Function
|
3
|
-
# Copyright © 2024 NatML Inc. All Rights Reserved.
|
4
|
-
#
|
5
|
-
|
6
|
-
from __future__ import annotations
|
7
|
-
from pydantic import BaseModel, Field
|
8
|
-
|
9
|
-
class Tag (BaseModel):
|
10
|
-
"""
|
11
|
-
Predictor tag.
|
12
|
-
|
13
|
-
Members:
|
14
|
-
username (str): Predictor owner username.
|
15
|
-
name (str): Predictor name.
|
16
|
-
"""
|
17
|
-
username: str = Field(description="Predictor owner username.")
|
18
|
-
name: str = Field(description="Predictor name.")
|
19
|
-
|
20
|
-
def from_str (cls, tag: str) -> Tag:
|
21
|
-
"""
|
22
|
-
Parse a predictor tag from a string.
|
23
|
-
"""
|
24
|
-
username, name = tag.lower()[1:].split("/")
|
25
|
-
return Tag(username=username, name=name)
|
26
|
-
|
27
|
-
def __str__ (self):
|
28
|
-
return f"@{self.username}/{self.name}"
|
fxn-0.0.37/fxn/types/user.py
DELETED
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
|
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
|