Best Python code snippet using localstack_python
pathmgr.py
Source:pathmgr.py
...90 class_name = suite_class[suite_class.rfind('.') + 1:]91 target = "{}{}{}.class".format(suite_dir, os.sep, class_name)92 return Path(target).exists()93 @staticmethod94 def get_java_classpath():95 """Determines the Java classpath use use for compilation or execution. May return None if cannot96 be determined.97 :returns Java classpath to use for compilation or execution. May return None."""98 # First, attempt to read java_classpath from the configuration file. If it's99 # not found or is empty, attempt to read the environment CLASSPATH variable.100 java_classpath = ProctorConfig.get_config_value('Defaults', 'java_classpath')101 if java_classpath is None or len(java_classpath) == 0:102 try:103 java_classpath = os.environ['CLASSPATH']104 except:105 pass106 return java_classpath107 @staticmethod108 def get_junit_classpath():109 """Determines the Java classpath use use for JUnit.110 :returns Java classpath to use to run JUnit or None if it cannot be determined."""111 return ProctorConfig.get_config_value('Defaults', 'junit_path')112 @staticmethod113 def get_full_classpath(java_cp, junit_cp):114 """Builds a full classpath by combining the Java classpath and the JUnit classpath.115 :param java_cp: Java classpath116 :param junit_cp: JUnit classpath, including proper lib (.jar) files117 :returns Full classpath that includes access to the project's Java source, tests, and JUnit lib files."""118 if java_cp is None:119 java_cp = PathManager.get_java_classpath()120 if junit_cp is None:121 junit_cp = PathManager.get_junit_classpath()122 return os.pathsep.join([java_cp, junit_cp])123 @staticmethod124 def _get_project_config_value(project_name, cfg_key):125 """Returns the value of the given configuration key or None.126 :param project_name: Project being worked on, which represents a [section] name in the configuration file.127 :param cfg_key: Key for which the value is retrieved.128 :returns Value associated with the given configuration file key, or None if not found."""129 cfg_value = ProctorConfig.get_config_value(project_name, cfg_key)130 if cfg_value is None:131 new_key = f'default_{cfg_key}'132 cfg_value = ProctorConfig.get_config_value('Defaults', new_key)133 if not cfg_value is None:...
UpdateVectorizedMongoDBCollection.py
Source:UpdateVectorizedMongoDBCollection.py
...21 input_params = get_input_params()22 # Defines javac executable.23 java_exe = Path(os.environ['JAVA_HOME']) / 'bin' / 'java.exe'24 # Command.25 cmd = f"{java_exe} -cp {get_java_classpath()} {input_params['nlp_params'].java_class_name} " \26 f"-host {input_params['mongo_params'].host} " \27 f"-port {input_params['mongo_params'].port} " \28 f"-dbName {input_params['mongo_params'].db_name} " \29 f"-collName {input_params['mongo_params'].collection_name} " \30 f"-startYear {input_params['filter_params'].start_year} " \31 f"-endYear {input_params['filter_params'].end_year} " \32 f"-textColumnName {input_params['filter_params'].column_name} " \33 f"-maxNumTokens {input_params['nlp_params'].max_num_tokens} " \34 f"-parserModel {input_params['nlp_params'].parser_model} " \35 f"-createTrees {input_params['nlp_params'].get_trees} " \36 f"-calcEmbeddings {input_params['nlp_params'].get_embeddings} " \37 f"-calcCoherence {input_params['nlp_params'].get_coherence}"38 log.info(f"Running command: '{cmd}'")39 # Run command....
custom_configparser.py
Source:custom_configparser.py
...25 return self.config['SERVER']['upload_dir']26 def get_hyperparams(self):27 props = dict(self.config.items('HYPERPARAMS'))28 return self.parse_from_string(props)29 def get_java_classpath(self):30 return self.config['JAVA']['classpath']31 def get_java_jythonpath(self):32 return self.config['JAVA']['jython_path']33 def get_tokenization_params(self):34 props = dict(self.config.items('TOKENIZATION'))35 return self.parse_from_string(props)36 def parse_from_string(self, props):37 for key in props:38 if props[key] in ['true', 'false']:39 props[key] = props[key] == 'true'40 elif re.fullmatch(r'\d+', props[key]):41 props[key] = int(props[key])42 elif re.fullmatch(r'\d*\.\d+', props[key]):43 props[key] = float(props[key])...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!