Best Python code snippet using stestr_python
construct.py
Source: construct.py
...3from django.views.generic.create_update import create_object, update_object, delete_object4from django.contrib.auth.decorators import login_required, permission_required5from experimentdb.reagents.models import Construct6@login_required7def construct_list(*args, **kwargs):8 return object_list(*args, **kwargs)9@login_required10def construct_detail(*args, **kwargs):11 return object_detail(*args, **kwargs)12@permission_required('reagents.add_construct')13def create_construct(*args, **kwargs):14 return create_object(*args, **kwargs)15@permission_required('reagents.change_construct')16def change_construct(*args, **kwargs):17 return update_object(*args, **kwargs)18@permission_required('reagents.delete_construct')19def delete_construct(*args, **kwargs):20 return delete_object(*args, **kwargs)21urlpatterns = patterns('',...
ExtractFeaturesView.py
Source: ExtractFeaturesView.py
1"""Bla."""2from rest_framework import serializers3from easy_dna import extract_from_input4import flametree5from ..base import AsyncWorker, StartJobView6from ..tools import (7 records_from_data_files,8 data_to_html_data,9 matplotlib_figure_to_svg_base64_data,10 figures_to_pdf_report_data,11 write_record,12 autoname_genbank_file,13)14class FileSerializer(serializers.Serializer):15 """Serializer for files."""16 name = serializers.CharField()17 content = serializers.CharField()18class serializer_class(serializers.Serializer):19 """Serializer."""20 files = serializers.ListField(child=FileSerializer())21 min_sequence_length = serializers.IntegerField()22 direct_sense = serializers.BooleanField()23class worker_class(AsyncWorker):24 def work(self):25 data = self.data26 direct_sense = data.direct_sense27 min_sequence_length = data.min_sequence_length28 self.logger(message="Reading the files...")29 construct_list = records_from_data_files(data.files)30 self.logger(message="Generating the report")31 root = flametree.file_tree("@memory")32 extract_from_input(33 construct_list=construct_list,34 direct_sense=direct_sense,35 output_path=root,36 min_sequence_length=min_sequence_length,37 )38 zip_data = root._close()39 return {40 "zip_file": {41 "data": data_to_html_data(zip_data, "zip"),42 "name": "extracted_features.zip",43 "mimetype": "application/zip",44 }45 }46class ExtractFeaturesView(StartJobView):47 serializer_class = serializer_class...
sol_173_Binary_Search_Tree_Iterator.py
...3class BSTIterator:4 def __init__(self, root: Optional[TreeNode]):5 self.l = []6 self.index = 07 def construct_list(node):8 if node == None:9 return10 construct_list(node.left)11 self.l.append(node.val)12 construct_list(node.right)13 construct_list(root)14 def next(self) -> int:15 if self.hasNext():16 val = self.l[self.index]17 self.index += 118 return val19 def hasNext(self) -> bool:20 return self.index < len(self.l)21class BSTIterator2:22 def __init__(self, root: Optional[TreeNode]):23 self.stack = []24 while root:25 self.stack.append(root)26 root = root.left27 def next(self) -> int:...
Check out the latest blogs from LambdaTest on this topic:
In recent times, many web applications have been ported to mobile platforms, and mobile applications are also created to support businesses. However, Android and iOS are the major platforms because many people use smartphones compared to desktops for accessing web applications.
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.
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!!