Best Python code snippet using hypothesis
models.py
Source:models.py  
1import datetime2from django.conf import settings3import requests4from django.db import models5from django.urls import reverse6from database.model.tool_model.accessibility import *7from database.model.tool_model.collection import *8from database.model.tool_model.language import *9from database.model.tool_model.link import *10from database.model.tool_model.function import *11from database.model.tool_model.operatingSystem import *12from database.model.tool_model.publication import *13from database.model.tool_model.tool import *14from database.model.tool_model.topic import *15from database.model.tool_model.download import *16from database.model.tool_model.documentation import *17from database.model.resource import *18from database.model.keyword import *19from database.model.service_model.service import *20# from database.model.service_model.credit import *21# from database.model.service_model.elixirCommunities import *22# from database.model.operatingSystem import OperatingSystem23import json24"""25class Dataset(models.Model):26    identifier = models.CharField(max_length=100)27    name = models.CharField(max_length=100)28    alternateName = models.CharField(max_length=100)29    datePublished = models.DateTimeField(default=datetime.now, blank=True)30    description = models.CharField(max_length=100)31    keywords = models.CharField(max_length=100)32    url = models.URLField(max_length=200)33    licence = models.CharField(max_length=100)34    citation = models.CharField(max_length=100)35    creator = models.CharField(max_length=100)36    distribution = models.CharField(max_length=100)37    includeInDataCatalogue = models.CharField(max_length=100)38    measurementTechnique = models.CharField(max_length=100)39    variableMeasured = models.CharField(max_length=100)40    version = models.CharField(max_length=100)41    def __str__(self):42        return self.name43class Function(models.Model):44    operation = models.CharField(max_length=100)45    input = models.CharField(max_length=100)46    output = models.CharField(max_length=100)47    comment = models.CharField(max_length=100)48    cmd = models.CharField(max_length=100)49    term = models.CharField(max_length=100)50class Labels(models.Model):51    toolType = models.CharField(max_length=100)52    topic = models.CharField(max_length=100)53    operatingSystem = models.CharField(max_length=100)54    language = models.CharField(max_length=100)55    license = models.CharField(max_length=100)56    collectionID = models.CharField(max_length=100)57    maturity = models.CharField(max_length=100)58    cost = models.IntegerField()59    accessibility = models.CharField(max_length=100)60class Link(models.Model):61    url = models.URLField(max_length=200)62    type = models.CharField(max_length=100)63    comment = models.CharField(max_length=100)64class Download(models.Model):65    link = models.CharField(max_length=100)66    url = models.URLField(max_length=200)67    type = models.CharField(max_length=100)68    comment = models.CharField(max_length=1000)69class Documentation(models.Model):70    url = models.CharField(max_length=100)71    type = models.CharField(max_length=100)72    comment = models.CharField(max_length=100)73    cmd = models.CharField(max_length=100)74    version = models.CharField(max_length=100)75class Publication(models.Model):76    doi = models.CharField(max_length=100)77    pmid = models.CharField(max_length=100)78    pmcid = models.CharField(max_length=100)79    type = models.CharField(max_length=100)80    version = models.CharField(max_length=100)81class Credit(models.Model):82    name = models.CharField(max_length=100)83    orcidid = models.CharField(max_length=100)84    gridid = models.CharField(max_length=100)85    email = models.CharField(max_length=100)86    url = models.URLField(max_length=200)87    tel = models.CharField(max_length=100)88    typeEntity = models.CharField(max_length=100)89    typeRole = models.CharField(max_length=100)90    comment = models.CharField(max_length=100)91class Tool(models.Model):92    name = models.CharField(max_length=100)93    description = models.TextField()94    homepage = models.URLField()95    biotoolsID = models.CharField(max_length=100)96    biotoolsCURIE = models.CharField(max_length=100)97    version = models.CharField(max_length=100)98    otherID = models.CharField(max_length=100)99    featureList = models.CharField(max_length=100)100    rdf:type= models.CharField(max_length=100)101    softwareVersion = models.CharField(max_length=100)102    url = models.URLField()103    citation = models.CharField(max_length=100)104    license = models.CharField(max_length=100)105    publisher = models.CharField(max_length=100)106    applicationCategory = models.CharField(max_length=100)107    date_created = models.DateTimeField(blank=True)108    date_modified = models.DateTimeField(blank=True)109    has_part = models.CharField(max_length=100)110    keywords = models.CharField(max_length=100)111    offers = models.CharField(max_length=100)112    operating_system = models.CharField(max_length=100)113    potentialAction = models.CharField(max_length=100)114    softwareHelp = models.CharField(max_length=100)115    software_requirements = models.CharField(max_length=100)116    function = models.ForeignKey(Function, on_delete=models.CASCADE)117    labels = models.ForeignKey(Labels, on_delete=models.CASCADE)118    link = models.ForeignKey(Link, on_delete=models.CASCADE)119    download = models.ForeignKey(Download, on_delete=models.CASCADE)120    documentation = models.ForeignKey(Documentation, on_delete=models.CASCADE)121    publication = models.ForeignKey(Publication, on_delete=models.CASCADE)122    credit = models.ForeignKey(Credit, on_delete=models.CASCADE)123    def __str__(self):124        return self.name125"""126TITLE_MATURITY = (127    ('EMERGING', 'Emerging'),128    ('MATURE', 'Mature'),129    ('LEGACY', 'Legacy'),130)131class Database(Resource):132    logo = models.URLField(max_length=200, blank=True, null=True)133    access_conditions = models.TextField()134    citations = models.CharField(max_length=1000, blank=True, null=True)135    link_data = models.CharField(max_length=1000, blank=True, null=True)136    keywords = models.ManyToManyField(Keyword, blank=True)137    annual_visits = models.IntegerField( blank=True, null=True)138    unique_visits = models.IntegerField( blank=True, null=True)139    last_update = models.DateTimeField( blank=True, null=True)140    increase_last_update = models.CharField(max_length=1000, blank=True, null=True)141    platform = models.ManyToManyField(Platform)142    def sd(self):143        return {144            "@context":145                {146                "edam": "http://edamontology.org/",147                "schema": "http://schema.org/",148                "dc": "http://purl.org/dc/terms/",149                },150            "@id": settings.VAR_URL+"api/?name="+self.name,151            "@language": "fr",152            "@type": "schema:WebAPI",153            "name": "CatalogRestToolAPI",154            "@graph":155                [{156                "@id": "https://www.france-bioinformatique.fr/en/services/outils/"+self.name,157                "@type": "schema:SoftwareApplication",158                "schema:name": self.name,159                "schema:description": self.description,160                "schema:laboratoryScience":161                    {162                        "@type": "schema:LaboratoryScience",163                        "schema:name": self.platform.name,164                    }165                }]166                }167class Event(Resource):168    logo = models.URLField(max_length=200, blank=True, null=True)169    event_type = models.CharField(max_length=1000, blank=True, null=True)170    start_date = models.DateTimeField( blank=True, null=True)171    end_date = models.DateTimeField(blank=True, null=True)172    location = models.CharField(max_length=1000, blank=True, null=True)173    link = models.CharField(max_length=1000, blank=True, null=True)174    organizer = models.CharField(max_length=1000, blank=True, null=True)175    sponsors = models.CharField(max_length=1000, blank=True, null=True)176    def __str__(self):177        return self.name178class Formation(Resource):179    logo = models.URLField(max_length=200, blank=True, null=True)180    formation_type = models.CharField(max_length=1000, blank=True, null=True)181    keywords = models.ManyToManyField(Keyword, blank=True)182    start_date = models.DateTimeField( blank=True, null=True)183    end_date = models.DateTimeField(blank=True, null=True)184    location = models.CharField(max_length=1000, blank=True, null=True)185    access_conditions = models.TextField()186    link = models.CharField(max_length=1000, blank=True, null=True)187    organizer = models.CharField(max_length=1000, blank=True, null=True)188    sponsors = models.CharField(max_length=1000, blank=True, null=True)189    number_people_trained = models.IntegerField( blank=True, null=True)190    number_of_academic_participants = models.IntegerField( blank=True, null=True)191    number_of_non_academic_participants = models.IntegerField( blank=True, null=True)192    training_time = models.DecimalField(decimal_places=2, max_digits=4, blank=True, null=True)193    participation = models.CharField(max_length=1000, blank=True, null=True)194    training_level = models.CharField(max_length=1000, blank=True, null=True)195    training_operator = models.CharField(max_length=1000, blank=True, null=True)196    number_of_sessions = models.IntegerField( blank=True, null=True)197    recurrence = models.CharField(max_length=1000, blank=True, null=True)198    satisfaction_rate = models.CharField(max_length=1000, blank=True, null=True)199    platform = models.ManyToManyField(Platform)200    def __str__(self):201        return self.name202class Training_material(Resource):203    file_name = models.CharField(max_length=1000, blank=True, null=True)204    keywords = models.ManyToManyField(Keyword, blank=True)205    licence = models.CharField(max_length=1000, blank=True, null=True)206    event_link = models.CharField(max_length=1000, blank=True, null=True)207    publication_date = models.DateTimeField(blank=True)208    target_audience = models.CharField(max_length=1000, blank=True, null=True)209    url_file = models.URLField(max_length=200, blank=True, null=True)210    def __str__(self):211        return self.name212# class Link(models.Model):213# 	# name = models.CharField(max_length=100, blank=True, null=True)214#     url = models.CharField(max_length=200, blank=True, null=True)215#     type = models.CharField(max_length=100, blank=True, null=True)216#     note = models.CharField(max_length=1000, blank=True, null=True)217#     tool = models.ForeignKey(Tool, null=True, blank=True, related_name='link', on_delete=models.CASCADE)218#219#     # metadata220#     additionDate = models.DateTimeField(auto_now_add=True)221#222#     def __unicode__(self):223#         return unicode(self.name) or u''224class Relation(models.Model):225    biotoolsID = models.CharField(max_length=100, blank=False, null=False)226    type = models.CharField(max_length=100, blank=False, null=False)227    tool = models.ForeignKey(Tool, null=True, blank=True, related_name='relation', on_delete=models.CASCADE)228     # metadata229    additionDate = models.DateTimeField(auto_now_add=True)230    def __unicode__(self):231        return unicode(self.name) or u''232class OtherID(models.Model):233    value = models.CharField(blank=False, null=False, max_length=1000, unique=False)234    type = models.TextField(blank=True, null=True)235    version = models.TextField(blank=True, null=True)236    tool = models.ForeignKey(Tool, null=True, blank=True, related_name='otherID', on_delete=models.CASCADE)237    # metadata238    additionDate = models.DateTimeField(auto_now_add=True, null=True)239    def __unicode__(self):240        return unicode(self.value) or u''241class Version(models.Model):242    version = models.CharField(max_length=100, blank=True, null=True)243    tool = models.ForeignKey(Tool, null=True, blank=True, related_name='version', on_delete=models.CASCADE)244     # metadata245    additionDate = models.DateTimeField(auto_now_add=True)246    def __unicode__(self):...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!!
