Best Python code snippet using lisa_python
bdss_application.py
Source: bdss_application.py
...105 except NoMatches:106 log.info("No extensions found")107 def _factory_registry_default(self):108 return self.get_service(IFactoryRegistry)109def _import_extensions(plugins, ext):110 """Service routine extracted for testing.111 Imports the extension in the plugins argument.112 """113 log.info("Found extension {}".format(ext.obj))114 plugins.append(ext.obj)115def _load_failure_callback(plugins, manager, entry_point, exception):116 """Service routine extracted for testing.117 Reports failure to load a module through stevedore, using the118 on_load_failure_callback option.119 """120 log.error(121 "Unable to load plugin {}. Exception: {}. Message: {}".format(122 entry_point, exception.__class__.__name__, exception),123 exc_info=True,...
content_types.py
Source: content_types.py
1import re2# RDF3TURTLE = "text/turtle"4RDF_XML = "application/rdf+xml"5NTRIPLES = "application/n-triples"6NQUADS = "application/n-quads"7TRIG = "application/trig"8N3 = "text/n3"9TRIX = "application/trix"10LD_JSON = "application/ld+json"11# Query Results12SPARQL_XML = "application/sparql-results+xml"13SPARQL_JSON = "application/sparql-results+json"14BINARY_RDF = "application/x-binary-rdf-results-table"15BOOLEAN = "text/boolean"16CSV = "text/csv"17TSV = "text/tab-separated-values"18# RDF filename extensions and their content types19_RDF_EXTENSIONS = {20 "ttl": TURTLE,21 "rdf": RDF_XML,22 "rdfs": RDF_XML,23 "owl": RDF_XML,24 "xml": RDF_XML,25 "nt": NTRIPLES,26 "n3": N3,27 "nq": NQUADS,28 "nquads": NQUADS,29 "trig": TRIG,30 "trix": TRIX,31 "json": LD_JSON,32 "jsonld": LD_JSON,33}34# Mapping filename extensions and their mapping syntax35_MAPPING_EXTENSIONS = {"rq": "SMS2", "sms": "SMS2", "sms2": "SMS2", "r2rml": "R2RML"}36# Import filename extension and their type, and seperator37_IMPORT_EXTENSIONS = {38 "csv": (CSV, "DELIMITED", ","),39 "tsv": (TSV, "DELIMITED", "\t"),40 "json": ("application/json", "JSON", None),41}42# Compression filename extensions and their content encodings43_COMPRESSION_EXTENSIONS = {"gz": "gzip", "zip": "zip", "bz2": "bzip2"}44def guess_rdf_format(fname):45 """46 Guess RDF content type and encoding from filename47 Parameters48 fname (str)49 Filename50 Returns51 (tuple)52 (content_encoding, content_type)53 """54 if fname is None:55 return None, None56 extension = _get_extension(fname)57 # if compressed, needs content encoding58 content_encoding = _COMPRESSION_EXTENSIONS.get(extension)59 if content_encoding:60 # remove encoding extension61 extension = _get_extension(fname[: -len(extension) - 1])62 # get content type63 content_type = _RDF_EXTENSIONS.get(extension)64 return content_encoding, content_type65def guess_mapping_format(fname):66 """67 Guess mapping syntax from filename68 Parameters69 fname (str)70 Filename71 Returns72 syntax73 """74 if fname is None:75 return None76 extension = _get_extension(fname)77 syntax = _MAPPING_EXTENSIONS.get(extension)78 return syntax79def guess_import_format(fname):80 """81 Guess import syntax from filename82 Parameters83 fname (str)84 Filename85 Returns86 (input_file_type,seperator)87 """88 if fname is None:89 return None, None, None, None90 extension = _get_extension(fname)91 content_encoding = _COMPRESSION_EXTENSIONS.get(extension)92 if content_encoding:93 # remove encoding extension94 extension = _get_extension(fname[: -len(extension) - 1])95 # get content type96 info = _IMPORT_EXTENSIONS.get(extension)97 content_type = info[0] if info else None98 input_type = info[1] if info else None99 separator = info[2] if info else None100 return content_encoding, content_type, input_type, separator101def guess_mapping_format_from_content(content):102 """103 Guess mapping syntax from content104 Parameters105 fname (str)106 Filename107 Returns108 syntax109 """110 regex = re.compile("MAPPING.*?FROM", re.DOTALL | re.IGNORECASE)111 syntax = "SMS2" if regex.search(content) else None112 return syntax113def _get_extension(fname):114 pos = fname.rfind(".")115 if pos >= 0:...
import_configure.py
Source: import_configure.py
...20 for field in ProjectContext.__fields__:21 if hasattr(config, field):22 setattr(project_context, field, getattr(config, field))23 if project_context.extensions:24 _import_extensions(project_context.extensions)25 if not project_context.deployments:26 project_context.deployments = find_deployments(27 path=project_context.project_root_dir28 )29 if not project_context.services:30 project_context.services = find_services(path=project_context.project_root_dir)31def _import_configure_py(file_name):32 if not os.path.isfile(file_name):33 raise FileNotFoundError(f"Could not find configure file '{file_name}'.")34 spec = importlib.util.spec_from_file_location(IMPORT_NAME_CONFIGURE_PY, file_name)35 config = importlib.util.module_from_spec(spec)36 sys.modules[IMPORT_NAME_CONFIGURE_PY] = config37 spec.loader.exec_module(config)38 return config39def _import_extensions(extensions):40 for extension in extensions:41 try:42 importlib.import_module(extension)43 except ImportError:...
Check out the latest blogs from LambdaTest on this topic:
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
It’s strange to hear someone declare, “This can’t be tested.” In reply, I contend that everything can be tested. However, one must be pleased with the outcome of testing, which might include failure, financial loss, or personal injury. Could anything be tested when a claim is made with this understanding?
When it comes to UI components, there are two versatile methods that we can use to build it for your website: either we can use prebuilt components from a well-known library or framework, or we can develop our UI components from scratch.
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!!