How to use exists_package method in lisa

Best Python code snippet using lisa_python

SubmitPackageForm.py

Source:SubmitPackageForm.py Github

copy

Full Screen

...29 validators.Regexp(r"^.+\.keypirinha-package$",30 message='Path must end with ".keypirinha-package"')])3132 @staticmethod33 def exists_package(owner, repo, repo_type, path=None):34 qry = db_session.query(Package).filter(Package.owner == owner,35 Package.repo == repo,36 Package.ptype == repo_type,37 Package.path == path).exists()38 return db_session.query(qry).scalar()3940 def validate(self):41 if not super(SubmitPackageForm, self).validate():42 return False4344 if self.exists_package(self.owner.data,45 self.repo.data,46 self.type.data,47 self.path.data if self.path.data else None):48 self._errors = ["This package already exists in the repository"]49 return False5051 package = Package(self.owner.data, self.repo.data, self.type.data, self.path.data)52 source_type = next((package_source for package_source in app.config["package_sources"]53 if package_source.__name__ == package.ptype), None)54 source = source_type(package)5556 if not source.is_available():57 self._errors = ["The package source is not available."]58 return False ...

Full Screen

Full Screen

task.py

Source:task.py Github

copy

Full Screen

...19 :param task_name: The task name.20 """21 if task_name.lower() != task_name:22 raise ValueError("task name must be lowercase.")23 if not await exists_package(package_name):24 raise PackageNotFoundError(package_name)25 template_path = os.path.join(configs.project_root, "easy_api/template/task")26 package_path = os.path.join(configs.project_root, package_name)27 if not os.path.isdir(template_path):28 raise ValueError("package task_template not exist")29 if os.path.isfile(os.path.join(package_path, "handler", task_name + ".py")):30 raise TaskExistsError31 await copytree_and_render(32 template_path,33 package_path,34 {35 "package_name": package_name,36 "task_name": task_name,37 "legal_task_name": task_name.title().replace("_", ""),38 }39 )40async def delete_task(package_name: str, task_name: str):41 """42 Delete a task file.43 :param package_name: The package name.44 :param task_name: The task file name.45 """46 if task_name.lower() != task_name:47 raise ValueError("task name must be lowercase.")48 if not await exists_package(package_name):49 raise PackageNotFoundError50 package_path = os.path.join(configs.project_root, package_name)51 for file_name in (f"handler/{task_name}.py", f"handler/schema/{task_name}.py", f"service/{task_name}_task.py"):52 file_path = os.path.join(package_path, file_name)53 if os.path.isfile(file_path):54 os.remove(file_path)55def run_in_worker(package_name: str, task_name: str) -> Callable[[str, str], Callable[[callable], Awaitable[Result]]]:56 def _(func) -> Callable[[callable], Awaitable[Result]]:57 @functools.wraps(func)58 async def _fun_in_worker(*args, **kwargs):59 worker_task_id = uuid()60 future = Future()61 celery_waiter.wait_result(worker_task_id, future)62 invoke_task.apply_async(args=[package_name, task_name, args, kwargs], task_id=worker_task_id,...

Full Screen

Full Screen

test_package.py

Source:test_package.py Github

copy

Full Screen

...6 await assert_folders_same("easy_api/easy_api/template/package_template", tmp_dst,7 include_template=True, template_context={"package_name": tmp_dst})8async def test_create_package_exists(tmp_dst):9 os.makedirs(tmp_dst)...

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 lisa 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