1+ use core:: hydroflow_crate:: ports:: HydroflowSource ;
12use std:: collections:: HashMap ;
23use std:: ops:: DerefMut ;
34use std:: pin:: Pin ;
@@ -18,8 +19,6 @@ use pythonize::pythonize;
1819use tokio:: sync:: oneshot:: Sender ;
1920use tokio:: sync:: RwLock ;
2021
21- use crate :: core:: hydroflow_crate:: ports:: HydroflowSource ;
22-
2322mod cli;
2423use hydro_deploy as core;
2524use hydro_deploy:: ssh:: LaunchedSSHHost ;
@@ -142,20 +141,20 @@ impl AnyhowWrapper {
142141#[ pyclass( subclass) ]
143142#[ derive( Clone ) ]
144143struct HydroflowSink {
145- underlying : Arc < RwLock < dyn crate :: core:: hydroflow_crate:: ports:: HydroflowSink > > ,
144+ underlying : Arc < RwLock < dyn core:: hydroflow_crate:: ports:: HydroflowSink > > ,
146145}
147146
148147#[ pyclass( name = "Deployment" ) ]
149148pub struct Deployment {
150- underlying : Arc < RwLock < crate :: core:: Deployment > > ,
149+ underlying : Arc < RwLock < core:: Deployment > > ,
151150}
152151
153152#[ pymethods]
154153impl Deployment {
155154 #[ new]
156155 fn new ( ) -> Self {
157156 Deployment {
158- underlying : Arc :: new ( RwLock :: new ( crate :: core:: Deployment :: default ( ) ) ) ,
157+ underlying : Arc :: new ( RwLock :: new ( core:: Deployment :: default ( ) ) ) ,
159158 }
160159 }
161160
@@ -185,7 +184,7 @@ impl Deployment {
185184 user : Option < String > ,
186185 ) -> PyResult < Py < PyAny > > {
187186 let arc = self . underlying . blocking_write ( ) . add_host ( |id| {
188- crate :: core:: GCPComputeEngineHost :: new (
187+ core:: GCPComputeEngineHost :: new (
189188 id,
190189 project,
191190 machine_type,
@@ -218,7 +217,7 @@ impl Deployment {
218217 user : Option < String > ,
219218 ) -> PyResult < Py < PyAny > > {
220219 let arc = self . underlying . blocking_write ( ) . add_host ( |id| {
221- crate :: core:: AzureHost :: new ( id, project, os_type, machine_size, image, region, user)
220+ core:: AzureHost :: new ( id, project, os_type, machine_size, image, region, user)
222221 } ) ;
223222
224223 Ok ( Py :: new (
@@ -325,12 +324,12 @@ impl Deployment {
325324
326325#[ pyclass( subclass) ]
327326pub struct Host {
328- underlying : Arc < RwLock < dyn crate :: core:: Host > > ,
327+ underlying : Arc < RwLock < dyn core:: Host > > ,
329328}
330329
331330#[ pyclass( extends=Host , subclass) ]
332331struct LocalhostHost {
333- underlying : Arc < RwLock < crate :: core:: LocalhostHost > > ,
332+ underlying : Arc < RwLock < core:: LocalhostHost > > ,
334333}
335334
336335#[ pymethods]
@@ -354,24 +353,22 @@ impl LocalhostHost {
354353#[ pyclass]
355354#[ derive( Clone ) ]
356355struct GCPNetwork {
357- underlying : Arc < RwLock < crate :: core:: gcp:: GCPNetwork > > ,
356+ underlying : Arc < RwLock < core:: gcp:: GCPNetwork > > ,
358357}
359358
360359#[ pymethods]
361360impl GCPNetwork {
362361 #[ new]
363362 fn new ( project : String , existing : Option < String > ) -> Self {
364363 GCPNetwork {
365- underlying : Arc :: new ( RwLock :: new ( crate :: core:: gcp:: GCPNetwork :: new (
366- project, existing,
367- ) ) ) ,
364+ underlying : Arc :: new ( RwLock :: new ( core:: gcp:: GCPNetwork :: new ( project, existing) ) ) ,
368365 }
369366 }
370367}
371368
372369#[ pyclass( extends=Host , subclass) ]
373370struct GCPComputeEngineHost {
374- underlying : Arc < RwLock < crate :: core:: GCPComputeEngineHost > > ,
371+ underlying : Arc < RwLock < core:: GCPComputeEngineHost > > ,
375372}
376373
377374#[ pymethods]
@@ -414,7 +411,7 @@ impl GCPComputeEngineHost {
414411
415412#[ pyclass( extends=Host , subclass) ]
416413struct AzureHost {
417- underlying : Arc < RwLock < crate :: core:: AzureHost > > ,
414+ underlying : Arc < RwLock < core:: AzureHost > > ,
418415}
419416
420417#[ pymethods]
@@ -457,7 +454,7 @@ impl AzureHost {
457454
458455#[ pyclass( subclass) ]
459456pub struct Service {
460- underlying : Arc < RwLock < dyn crate :: core:: Service > > ,
457+ underlying : Arc < RwLock < dyn core:: Service > > ,
461458}
462459
463460#[ pymethods]
@@ -499,15 +496,15 @@ impl PyReceiver {
499496
500497#[ pyclass( extends=Service , subclass) ]
501498struct CustomService {
502- underlying : Arc < RwLock < crate :: core:: CustomService > > ,
499+ underlying : Arc < RwLock < core:: CustomService > > ,
503500}
504501
505502#[ pymethods]
506503impl CustomService {
507504 fn client_port ( & self , py : Python < ' _ > ) -> PyResult < Py < PyAny > > {
508- let arc = Arc :: new ( RwLock :: new (
509- crate :: core :: custom_service :: CustomClientPort :: new ( Arc :: downgrade ( & self . underlying ) ) ,
510- ) ) ;
505+ let arc = Arc :: new ( RwLock :: new ( core :: custom_service :: CustomClientPort :: new (
506+ Arc :: downgrade ( & self . underlying ) ,
507+ ) ) ) ;
511508
512509 Ok ( Py :: new (
513510 py,
@@ -523,7 +520,7 @@ impl CustomService {
523520#[ pyclass( extends=HydroflowSink , subclass) ]
524521#[ derive( Clone ) ]
525522struct CustomClientPort {
526- underlying : Arc < RwLock < crate :: core:: custom_service:: CustomClientPort > > ,
523+ underlying : Arc < RwLock < core:: custom_service:: CustomClientPort > > ,
527524}
528525
529526#[ pymethods]
@@ -537,12 +534,10 @@ impl CustomClientPort {
537534
538535 fn tagged ( & self , tag : u32 ) -> TaggedSource {
539536 TaggedSource {
540- underlying : Arc :: new ( RwLock :: new (
541- crate :: core:: hydroflow_crate:: ports:: TaggedSource {
542- source : self . underlying . clone ( ) ,
543- tag,
544- } ,
545- ) ) ,
537+ underlying : Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: TaggedSource {
538+ source : self . underlying . clone ( ) ,
539+ tag,
540+ } ) ) ,
546541 }
547542 }
548543
@@ -630,7 +625,7 @@ impl HydroflowCratePorts {
630625#[ pyclass( extends=HydroflowSink , subclass) ]
631626#[ derive( Clone ) ]
632627struct HydroflowCratePort {
633- underlying : Arc < RwLock < crate :: core:: hydroflow_crate:: ports:: HydroflowPortConfig > > ,
628+ underlying : Arc < RwLock < core:: hydroflow_crate:: ports:: HydroflowPortConfig > > ,
634629}
635630
636631#[ pymethods]
@@ -659,38 +654,34 @@ impl HydroflowCratePort {
659654
660655 fn tagged ( & self , tag : u32 ) -> TaggedSource {
661656 TaggedSource {
662- underlying : Arc :: new ( RwLock :: new (
663- crate :: core:: hydroflow_crate:: ports:: TaggedSource {
664- source : self . underlying . clone ( ) ,
665- tag,
666- } ,
667- ) ) ,
657+ underlying : Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: TaggedSource {
658+ source : self . underlying . clone ( ) ,
659+ tag,
660+ } ) ) ,
668661 }
669662 }
670663}
671664
672665#[ pyfunction]
673666fn demux ( mapping : & PyDict ) -> HydroflowSink {
674667 HydroflowSink {
675- underlying : Arc :: new ( RwLock :: new (
676- crate :: core:: hydroflow_crate:: ports:: DemuxSink {
677- demux : mapping
678- . into_iter ( )
679- . map ( |( k, v) | {
680- let k = k. extract :: < u32 > ( ) . unwrap ( ) ;
681- let v = v. extract :: < HydroflowSink > ( ) . unwrap ( ) ;
682- ( k, v. underlying )
683- } )
684- . collect ( ) ,
685- } ,
686- ) ) ,
668+ underlying : Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: DemuxSink {
669+ demux : mapping
670+ . into_iter ( )
671+ . map ( |( k, v) | {
672+ let k = k. extract :: < u32 > ( ) . unwrap ( ) ;
673+ let v = v. extract :: < HydroflowSink > ( ) . unwrap ( ) ;
674+ ( k, v. underlying )
675+ } )
676+ . collect ( ) ,
677+ } ) ) ,
687678 }
688679}
689680
690681#[ pyclass( subclass) ]
691682#[ derive( Clone ) ]
692683struct TaggedSource {
693- underlying : Arc < RwLock < crate :: core:: hydroflow_crate:: ports:: TaggedSource > > ,
684+ underlying : Arc < RwLock < core:: hydroflow_crate:: ports:: TaggedSource > > ,
694685}
695686
696687#[ pymethods]
@@ -704,20 +695,18 @@ impl TaggedSource {
704695
705696 fn tagged ( & self , tag : u32 ) -> TaggedSource {
706697 TaggedSource {
707- underlying : Arc :: new ( RwLock :: new (
708- crate :: core:: hydroflow_crate:: ports:: TaggedSource {
709- source : self . underlying . clone ( ) ,
710- tag,
711- } ,
712- ) ) ,
698+ underlying : Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: TaggedSource {
699+ source : self . underlying . clone ( ) ,
700+ tag,
701+ } ) ) ,
713702 }
714703 }
715704}
716705
717706#[ pyclass( extends=HydroflowSink , subclass) ]
718707#[ derive( Clone ) ]
719708struct HydroflowNull {
720- underlying : Arc < RwLock < crate :: core:: hydroflow_crate:: ports:: NullSourceSink > > ,
709+ underlying : Arc < RwLock < core:: hydroflow_crate:: ports:: NullSourceSink > > ,
721710}
722711
723712#[ pymethods]
@@ -731,21 +720,17 @@ impl HydroflowNull {
731720
732721 fn tagged ( & self , tag : u32 ) -> TaggedSource {
733722 TaggedSource {
734- underlying : Arc :: new ( RwLock :: new (
735- crate :: core:: hydroflow_crate:: ports:: TaggedSource {
736- source : self . underlying . clone ( ) ,
737- tag,
738- } ,
739- ) ) ,
723+ underlying : Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: TaggedSource {
724+ source : self . underlying . clone ( ) ,
725+ tag,
726+ } ) ) ,
740727 }
741728 }
742729}
743730
744731#[ pyfunction]
745732fn null ( py : Python < ' _ > ) -> PyResult < Py < PyAny > > {
746- let arc = Arc :: new ( RwLock :: new (
747- crate :: core:: hydroflow_crate:: ports:: NullSourceSink ,
748- ) ) ;
733+ let arc = Arc :: new ( RwLock :: new ( core:: hydroflow_crate:: ports:: NullSourceSink ) ) ;
749734
750735 Ok ( Py :: new (
751736 py,
0 commit comments