Best Python code snippet using tox_python
pypi_client.py
Source:pypi_client.py
...349 new += 1350 self.last_list_update = datetime.now()351 return len(p_list), new, updated352 def get_package(self, package_name, nofetch=False):353 local_package = self.get_local_package(package_name)354 if local_package or nofetch:355 return local_package356 local_package357 # TODO: fetch358 return None359 def get_local_package(self, package_name, default=None):360 if not package_name:361 raise Exception("get_local_package(package_name, default=None): "362 "package_name not supplied")363 if package_name in self.package_list:364 logger.debug("get_local_package(): Package '%s' found in "365 "local list. Returning it" % package_name)366 return self.package_list[package_name]367 if default:368 self.package_list[package_name] = default369 logger.info("get_local_package(): package '%s' not in local "370 "list, but default package supplied so added and returned"371 % package_name)372 return self.package_list[package_name]373 # No package in local list nor default supplied374 logger.debug("get_local_package(): Package '%s' NOT found in "375 "local list. No default supplied, return False" % package_name)376 return False377 def get_package_releases(self, package_name, show_hidden=False):378 """379 Found releases for this package and update package information in local380 list.381 It uses the 'package_release(package_name, show_hidden)' method of382 XML-RPC interface383 ;return (#FOUND_RELEASES, #NEW_RELEASES)384 """385 package = self.get_local_package(package_name,386 PypiPackage(package_name))387 r_list = self.client.package_releases(package_name, show_hidden)388 if not r_list:389 logger.info("Any release found for package: %s"390 % package_name)391 return False392 new = 0393 for release_version in r_list:394 if package.add_release(release_version):395 new += 1396 return (len(r_list), new)397 def get_package_roles(self, package_name):398 package = self.get_local_package(package_name,399 PypiPackage(package_name))400 r_list = self.client.package_roles(package_name)401 if not r_list:402 logger.info("Any role found for package: %s" % package_name)403 return False404 new = 0405 for role, user in r_list:406 if package.add_role(role, user):407 new += 1408 return (len(r_list), new)409 def get_release_downloads(self, package_name, release_version):410 package = self.get_local_package(package_name,411 PypiPackage(package_name))412 release = package.get_local_release(release_version,413 PypiRelease(package_name, release_version))414 d_list = self.client.release_downloads(package_name, release_version)415 if not d_list:416 logger.info("Any download found for release '%s' of package "417 "'%s'" % (release_version, package_name))418 return False419 new = 0420 for filename, downloads in d_list:421 if release.add_download(filename, downloads):422 new += 1423 return (len(d_list), new)424 def get_release_urls(self, package_name, release_version):425 package = self.get_local_package(package_name,426 PypiPackage(package_name))427 release = package.get_local_release(release_version,428 PypiRelease(package_name, release_version))429 u_list = self.client.release_urls(package_name, release_version)430 if not u_list:431 logger.info("Any URL found for release '%s' of package "432 "'%s'" % (release_version, package_name))433 return False434 new = 0435 for url_vals in u_list:436 if release.add_url(url_vals['filename'], url_vals):437 new += 1438 return (len(u_list), new)439 def get_release_data(self, package_name, release_version):440 package = self.get_local_package(package_name,441 PypiPackage(package_name))442 release = package.get_local_release(release_version,443 PypiRelease(package_name, release_version))444 r_data = self.client.release_data(package_name, release_version)445 if not r_data:446 logger.info("No data found release '%s' of package "447 "'%s'" % (release_version, package_name))448 return False449 return release.update_data(r_data)450 # TODO: pending XML-RPC methods: search(spec[, operator]) and...
__init__.py
Source:__init__.py
...32 lock.release(force=True)33def acquire_package(config, report, session):34 """acquire a source distribution (either by loading a local file or triggering a build)"""35 if not config.option.sdistonly and (config.sdistsrc or config.option.installpkg):36 path = get_local_package(config, report, session)37 else:38 try:39 path = build_package(config, report, session)40 except tox.exception.InvocationError as exception:41 report.error("FAIL could not package project - v = {!r}".format(exception))42 return None43 sdist_file = config.distshare.join(path.basename)44 if sdist_file != path:45 report.info("copying new sdistfile to {!r}".format(str(sdist_file)))46 try:47 sdist_file.dirpath().ensure(dir=1)48 except py.error.Error:49 report.warning("could not copy distfile to {}".format(sdist_file.dirpath()))50 else:51 path.copy(sdist_file)52 return path53def get_local_package(config, report, session):54 path = config.option.installpkg55 if not path:56 path = config.sdistsrc57 py_path = py.path.local(session._resolve_package(path))58 report.info("using package {!r}, skipping 'sdist' activity ".format(str(py_path)))...
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!!