How to use _rdv method in autotest

Best Python code snippet using autotest_python

svarea.py

Source:svarea.py Github

copy

Full Screen

1"""2Network Analyst tools converted to Python34Service Area Utilizations5"""67import arcpy8import os91011def get_sa(net, rdv, time_interval, loc, out,12 ONEWAY_RESTRICTION=True, OVERLAP=True):13 """14 Execute service area tool15 """16 17 from glass.mng.gen import copy_feat18 19 if arcpy.CheckExtension("Network") == "Available":20 arcpy.CheckOutExtension("Network")21 22 else:23 raise ValueError('Network analyst extension is not avaiable')24 25 network_name = str(os.path.basename(net))26 JUNCTIONS = network_name + '_Junctions'27 28 oneway = "" if not ONEWAY_RESTRICTION else "Oneway"29 30 INTERVALS = str(time_interval) if type(time_interval) == int or \31 type(time_interval) == float else time_interval if \32 type(time_interval) == str \33 else ' '.join([str(int(x)) for x in time_interval]) if \34 type(time_interval) == list else None35 36 if not INTERVALS: raise ValueError((37 'time_interval format is not valid'38 ))39 40 arcpy.MakeServiceAreaLayer_na(41 in_network_dataset=net, 42 out_network_analysis_layer="servArea", 43 impedance_attribute="Minutes", 44 travel_from_to="TRAVEL_FROM", 45 default_break_values=INTERVALS, 46 polygon_type="DETAILED_POLYS", 47 merge="NO_MERGE" if OVERLAP else "NO_OVERLAP", 48 nesting_type="RINGS", 49 line_type="NO_LINES", 50 overlap="OVERLAP" if OVERLAP else "NON_OVERLAP", 51 split="NO_SPLIT", 52 excluded_source_name="", 53 accumulate_attribute_name="", 54 UTurn_policy="NO_UTURNS", 55 restriction_attribute_name=oneway, 56 polygon_trim="NO_TRIM_POLYS", 57 poly_trim_value="100 Meters", 58 lines_source_fields="NO_LINES_SOURCE_FIELDS", 59 hierarchy="NO_HIERARCHY", 60 time_of_day=""61 )62 63 # Add locations to the service area layer64 arcpy.AddLocations_na(65 "servArea", "Facilities", loc, "", "5000 Meters", "",66 "{_rdv} SHAPE;{j} NONE".format(_rdv=str(rdv), j=str(JUNCTIONS)),67 "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "INCLUDE",68 "{_rdv} #;{j} #".format(_rdv=str(rdv), j=str(JUNCTIONS))69 )70 # Solve71 arcpy.Solve_na("servArea", "SKIP", "TERMINATE", "")72 # Export to a shapefile73 save_servArea = copy_feat("servArea\\Polygons", out, gisApi='arcpy')74 75 return save_servArea767778def service_area_use_meters(net, rdv, distance, loc, out,79 OVERLAP=True, ONEWAY=None):80 """81 Execute service area tool using metric distances82 """83 84 from glass.mng.gen import copy_feat85 86 if arcpy.CheckExtension("Network") == "Available":87 arcpy.CheckOutExtension("Network")88 89 else:90 raise ValueError('Network analyst extension is not avaiable')91 92 network_name = str(os.path.basename(net))93 JUNCTIONS = network_name + '_Junctions'94 95 oneway = "" if not ONEWAY else "Oneway"96 97 INTERVALS = str(distance) if type(distance) == int or \98 type(distance) == float else distance if \99 type(distance) == str or type(distance) == unicode \100 else ' '.join([str(int(x)) for x in distance]) if \101 type(distance) == list else None102 103 if not INTERVALS: raise ValueError((104 'distance format is not valid'105 ))106 107 arcpy.MakeServiceAreaLayer_na(108 in_network_dataset=net, 109 out_network_analysis_layer="servArea", 110 impedance_attribute="Length", 111 travel_from_to="TRAVEL_FROM", 112 default_break_values=INTERVALS, 113 polygon_type="DETAILED_POLYS", 114 merge="NO_MERGE" if OVERLAP else "NO_OVERLAP", 115 nesting_type="RINGS", 116 line_type="NO_LINES", 117 overlap="OVERLAP" if OVERLAP else "NON_OVERLAP", 118 split="NO_SPLIT", 119 excluded_source_name="", 120 accumulate_attribute_name="", 121 UTurn_policy="NO_UTURNS", 122 restriction_attribute_name=oneway, 123 polygon_trim="TRIM_POLYS", 124 poly_trim_value="250 Meters", 125 lines_source_fields="NO_LINES_SOURCE_FIELDS", 126 hierarchy="NO_HIERARCHY", 127 time_of_day=""128 )129 130 # Add locations to the service area layer131 arcpy.AddLocations_na(132 "servArea", "Facilities", loc, "", "5000 Meters", "",133 "{_rdv} SHAPE;{j} NONE".format(_rdv=str(rdv), j=str(JUNCTIONS)),134 "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "INCLUDE",135 "{_rdv} #;{j} #".format(_rdv=str(rdv), j=str(JUNCTIONS))136 )137 # Solve138 arcpy.Solve_na("servArea", "SKIP", "TERMINATE", "")139 # Export to a shapefile140 save_servArea = copy_feat("servArea\\Polygons", out, gisApi='arcpy')141 142 return save_servArea ...

Full Screen

Full Screen

barrier_unittest.py

Source:barrier_unittest.py Github

copy

Full Screen

...52 self.rendezvous_test, 0, port=63002,53 rendezvous_servers=True)54 # Internal utility function (not a unit test)55 def rendezvous_test(self, timeout, port=63000, rendezvous_servers=False):56 def _rdv(addr):57 b1 = barrier.barrier(addr, "test_meeting", timeout, port)58 if not rendezvous_servers:59 b1.rendezvous('127.0.0.1#0', '127.0.0.1#1')60 else:61 b1.rendezvous_servers('127.0.0.1#0', '127.0.0.1#1')62 def _thread_rdv(addr):63 # We need to ignore the exception on one side.64 try:65 _rdv(addr)66 except error.BarrierError:67 if timeout == 0:68 pass69 client = threading.Thread(target=_thread_rdv,70 args=('127.0.0.1#0',))71 client.start()72 _rdv('127.0.0.1#1')73 client.join()74if __name__ == "__main__":...

Full Screen

Full Screen

classes.py

Source:classes.py Github

copy

Full Screen

1class FileTransfer:2 _port = None3 @property4 def port(self):5 return self._port6 def initialization(self, *args, **kwargs):7 pass8 def serve_file(self, *args, **kwargs):9 pass10 def get_file(self, *args, **kwargs):11 pass12class RendezVous:13 def __init__(self, token):14 self._token = token15 def initialization(self, *args, **kwargs):16 pass17 def register(self, *args, **kwargs):18 pass19 def retreive(self, *args, **kwargs):20 pass21class Exchange:22 def __init__(self, rdv, transfer):23 self._rdv = rdv24 self._transfer = transfer25 def register(self, *args, **kwargs):26 return self._rdv.register(*args, **kwargs)27 def serve(self, *args, **kwargs):28 self._transfer.serve_file(*args, **kwargs)29 def retreive(self, *args, **kwargs):30 return self._rdv.retreive(*args, **kwargs)31 def get(self, *args, **kwargs):32 return self._transfer.get_file(*args, **kwargs)33 @property34 def port(self):35 return self._transfer.port...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful