fal 1.16.1__py3-none-any.whl → 1.17.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.

Potentially problematic release.


This version of fal might be problematic. Click here for more details.

fal/_fal_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.16.1'
21
- __version_tuple__ = version_tuple = (1, 16, 1)
20
+ __version__ = version = '1.17.0'
21
+ __version_tuple__ = version_tuple = (1, 17, 0)
fal/files.py CHANGED
@@ -28,26 +28,39 @@ class FalFileSystem(AbstractFileSystem):
28
28
  },
29
29
  )
30
30
 
31
+ def _ls(self, path):
32
+ response = self._client.get(f"/files/list/{path}")
33
+ response.raise_for_status()
34
+ files = response.json()
35
+ return sorted(
36
+ (
37
+ {
38
+ "name": entry["path"],
39
+ "size": entry["size"],
40
+ "type": "file" if entry["is_file"] else "directory",
41
+ "mtime": entry["updated_time"],
42
+ }
43
+ for entry in files
44
+ ),
45
+ key=lambda x: x["name"],
46
+ )
47
+
31
48
  def ls(self, path, detail=True, **kwargs):
32
- if path in self.dircache:
33
- entries = self.dircache[path]
49
+ abs_path = "/" + path.lstrip("/")
50
+ if abs_path in self.dircache:
51
+ entries = self.dircache[abs_path]
52
+ elif abs_path in ["/", "", "."]:
53
+ entries = [
54
+ {
55
+ "name": "/data",
56
+ "size": 0,
57
+ "type": "directory",
58
+ "mtime": 0,
59
+ }
60
+ ]
34
61
  else:
35
- response = self._client.get(f"/files/list/{path.lstrip('/')}")
36
- response.raise_for_status()
37
- files = response.json()
38
- entries = sorted(
39
- (
40
- {
41
- "name": entry["path"].lstrip("/data/"),
42
- "size": entry["size"],
43
- "type": "file" if entry["is_file"] else "directory",
44
- "mtime": entry["updated_time"],
45
- }
46
- for entry in files
47
- ),
48
- key=lambda x: x["name"],
49
- )
50
- self.dircache[path] = entries
62
+ entries = self._ls(abs_path)
63
+ self.dircache[abs_path] = entries
51
64
 
52
65
  if detail:
53
66
  return entries
@@ -68,7 +81,7 @@ class FalFileSystem(AbstractFileSystem):
68
81
  return
69
82
 
70
83
  with open(lpath, "wb") as fobj:
71
- response = self._client.get(f"/files/file/{rpath.lstrip('/')}")
84
+ response = self._client.get(f"/files/file/{rpath}")
72
85
  response.raise_for_status()
73
86
  fobj.write(response.content)
74
87
 
@@ -78,13 +91,13 @@ class FalFileSystem(AbstractFileSystem):
78
91
 
79
92
  with open(lpath, "rb") as fobj:
80
93
  response = self._client.post(
81
- f"/files/file/local/{rpath.lstrip('/')}",
94
+ f"/files/file/local/{rpath}",
82
95
  files={"file_upload": (posixpath.basename(lpath), fobj, "text/plain")},
83
96
  )
84
97
  response.raise_for_status()
85
98
  self.dircache.clear()
86
99
 
87
100
  def rm(self, path, **kwargs):
88
- response = self._client.delete(f"/files/file/{path.lstrip('/')}")
101
+ response = self._client.delete(f"/files/file/{path}")
89
102
  response.raise_for_status()
90
103
  self.dircache.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fal
3
- Version: 1.16.1
3
+ Version: 1.17.0
4
4
  Summary: fal is an easy-to-use Serverless Python Framework
5
5
  Author: Features & Labels <support@fal.ai>
6
6
  Requires-Python: >=3.8
@@ -1,6 +1,6 @@
1
1
  fal/__init__.py,sha256=wXs1G0gSc7ZK60-bHe-B2m0l_sA6TrFk4BxY0tMoLe8,784
2
2
  fal/__main__.py,sha256=4JMK66Wj4uLZTKbF-sT3LAxOsr6buig77PmOkJCRRxw,83
3
- fal/_fal_version.py,sha256=fHsj4qb8quZFYixIg7OlfrAd4kLbNz0T5Cu5K-h6vsE,513
3
+ fal/_fal_version.py,sha256=L-yA9qIW9CPsU6jdmxu58Kyq_FoQoD9IW8plBJ9XLvQ,513
4
4
  fal/_serialization.py,sha256=npXNsFJ5G7jzBeBIyVMH01Ww34mGY4XWhHpRbSrTtnQ,7598
5
5
  fal/_version.py,sha256=1BbTFnucNC_6ldKJ_ZoC722_UkW4S9aDBSW9L0fkKAw,2315
6
6
  fal/api.py,sha256=moDNT8wt20uzsI-NTEsbVTpjFXFkSuuRXJx7Apux3SI,46329
@@ -8,7 +8,7 @@ fal/app.py,sha256=S5VHxDaj5J9YVC8ECenHCZJlTHalapHyOyHbCBNsDfs,24153
8
8
  fal/apps.py,sha256=pzCd2mrKl5J_4oVc40_pggvPtFahXBCdrZXWpnaEJVs,12130
9
9
  fal/config.py,sha256=BEMH10B2bfWJ9yNawnLG6v3kBLnLmkhMe201EAODzs4,3124
10
10
  fal/container.py,sha256=OvR-Zq-NPbYFHTnw0SBUUFxr890Fgbe68J2kSJEpLOk,1905
11
- fal/files.py,sha256=LHJxT4fs2jDs1hH26YoXdq77hUQp4IiaNJ0TE2-RFjo,2773
11
+ fal/files.py,sha256=gBQi1KJ91KURCFNMoGn8GfxCx0n5k0i-TXHWtOQp-ro,3022
12
12
  fal/flags.py,sha256=48pgtc9xb4LMpR9RE5KG2A2sH7zQRk_VjrgpND-H4Tc,942
13
13
  fal/project.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
14
14
  fal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -137,8 +137,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
137
137
  openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
138
138
  openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
139
139
  openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
140
- fal-1.16.1.dist-info/METADATA,sha256=KIyDdj36vshtcq463l_DSZU49gm6optvf9wvVqX8-BQ,4084
141
- fal-1.16.1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
142
- fal-1.16.1.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
143
- fal-1.16.1.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
144
- fal-1.16.1.dist-info/RECORD,,
140
+ fal-1.17.0.dist-info/METADATA,sha256=cxh2muMvhGGT7OCuoNXAw2Es7qlRdPkdrpAdX6TzYF8,4084
141
+ fal-1.17.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
142
+ fal-1.17.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
143
+ fal-1.17.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
144
+ fal-1.17.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5