8
8
9
9
from featurescript .base import ctxt , studio
10
10
from featurescript import conf
11
- from featurescript .feature_studio import FeatureStudio , get_feature_studios
11
+ from featurescript .feature_studio import LocalFeatureStudio , get_feature_studios
12
12
from onshape_api import api_base
13
13
from onshape_api .endpoints import feature_studios
14
14
from onshape_api .endpoints .feature_studios import create_feature_studio
15
15
from onshape_api .endpoints .std_versions import get_latest_std_version
16
16
from onshape_api .paths .paths import ElementPath
17
+ from robot_code .documents import BACKEND
17
18
18
19
OUTDATED_VERSION_MATCH : re .Pattern [str ] = re .compile (
19
20
r'version : "(\d{2,7})\.0"|FeatureScript (\d{2,7});'
@@ -43,15 +44,15 @@ def _finish(self) -> None:
43
44
if self .conflict :
44
45
print (CONFLICT_MESSAGE )
45
46
46
- def _report_conflict (self , studio : FeatureStudio ) -> None :
47
+ def _report_conflict (self , studio : LocalFeatureStudio ) -> None :
47
48
self .conflict = True
48
49
print (
49
50
"{} has been modified both locally and in Onshape. Skipping." .format (
50
51
studio .name
51
52
)
52
53
)
53
54
54
- def _get_studio_map (self ) -> dict [str , FeatureStudio ]:
55
+ def _get_studio_map (self ) -> dict [str , LocalFeatureStudio ]:
55
56
"""Returns a dict mapping Feature Studio names to FeatureStudios."""
56
57
with futures .ThreadPoolExecutor () as executor :
57
58
threads = [
@@ -97,8 +98,8 @@ def pull(self, force: bool = False) -> None:
97
98
self ._finish ()
98
99
99
100
def pull_studio (
100
- self , force : bool , studio_to_pull : FeatureStudio
101
- ) -> FeatureStudio | None :
101
+ self , force : bool , studio_to_pull : LocalFeatureStudio
102
+ ) -> LocalFeatureStudio | None :
102
103
curr_studio = self .curr_data .get (studio_to_pull .path .element_id , None )
103
104
if curr_studio is not None :
104
105
if (
@@ -163,10 +164,10 @@ def push(self, force: bool = False) -> None:
163
164
164
165
def push_studio (
165
166
self ,
166
- onshape_studio_map : dict [str , FeatureStudio ],
167
+ onshape_studio_map : dict [str , LocalFeatureStudio ],
167
168
force : bool ,
168
- studio_to_push : FeatureStudio ,
169
- ) -> FeatureStudio | None :
169
+ studio_to_push : LocalFeatureStudio ,
170
+ ) -> LocalFeatureStudio | None :
170
171
onshape_studio = onshape_studio_map .get (studio_to_push .path .element_id , None )
171
172
# next(
172
173
# filter(
@@ -264,7 +265,7 @@ def _send_code(self, studio: studio.Studio, std_version: str) -> bool:
264
265
return True
265
266
266
267
print ("{}: Successfully built." .format (studio .studio_name ))
267
- document = self . config . get_document ( "backend" )
268
+ document = BACKEND
268
269
if document is None :
269
270
print (
270
271
"{}: Failed to find document in config.json named {}. Valid names are: {}" .format (
@@ -278,10 +279,11 @@ def _send_code(self, studio: studio.Studio, std_version: str) -> bool:
278
279
279
280
if feature_studio is None :
280
281
result = create_feature_studio (self .api , document , studio .studio_name )
281
- feature_studio = FeatureStudio (
282
+ feature_studio = LocalFeatureStudio (
282
283
result ["name" ],
283
284
ElementPath .from_path (document , result ["id" ]),
284
285
result ["microversionId" ],
286
+ True ,
285
287
)
286
288
feature_studio .generated = True
287
289
feature_studio .modified = True
0 commit comments