コード例 #1
0
class BarcodePrintJobMember(Member):
    relation = "%s/barcode" % RELATION_BASE_URL
    title = attribute_alias('labels')
    barcodes = terminal_attribute(str, 'barcodes')
    labels = terminal_attribute(str, 'labels')
    printer = terminal_attribute(str, 'printer')
    type = terminal_attribute(str, 'type')
コード例 #2
0
ファイル: moleculetype.py プロジェクト: papagr/TheLMA
class MoleculeTypeMember(Member):
    relation = "%s/molecule-type" % RELATION_BASE_URL
    title = attribute_alias('name')
    name = terminal_attribute(str, 'name')
    description = terminal_attribute(str, 'description')
    thaw_time = terminal_attribute(float, 'thaw_time')
    modifications = collection_attribute(IChemicalStructure, 'modifications')
コード例 #3
0
class RackSpecsMember(Member):
    relation = "%s/rack-specs" % RELATION_BASE_URL
    title = attribute_alias('label')
    label = terminal_attribute(str, 'label')
    shape = member_attribute(IRackShape, 'shape')
    manufacturer = member_attribute(IOrganization, 'manufacturer')
    has_tubes = terminal_attribute(bool, 'has_tubes')
コード例 #4
0
ファイル: species.py プロジェクト: scraping-xx/everest-demo
class SpeciesMember(Member):
    relation = 'http://plantscribe.org/relations/species'
    title = attribute_alias('species_name')
    species_name = terminal_attribute(str, 'species_name')
    genus_name = terminal_attribute(str, 'genus_name')
    cultivar = terminal_attribute(str, 'cultivar')
    author = terminal_attribute(str, 'author')
コード例 #5
0
class SpeciesMember(Member):
    relation = "%s/species" % RELATION_BASE_URL
    title = attribute_alias('common_name')
    genus_name = terminal_attribute(str, 'genus_name')
    species_name = terminal_attribute(str, 'species_name')
    common_name = terminal_attribute(str, 'common_name')
    acronym = terminal_attribute(str, 'acronym')
    ncbi_tax_id = terminal_attribute(int, 'ncbi_tax_id')
コード例 #6
0
ファイル: rack.py プロジェクト: papagr/TheLMA
class RackShapeMember(Member):
    relation = "%s/rack-shape" % RELATION_BASE_URL
    id = terminal_attribute(str, 'id')  # rack shape IDs are *strings*.
    name = terminal_attribute(str, 'name')
    label = terminal_attribute(str, 'label')
    number_rows = terminal_attribute(int, 'number_rows')
    number_columns = terminal_attribute(int, 'number_columns')
    title = attribute_alias('label')
コード例 #7
0
ファイル: chemicalstructure.py プロジェクト: papagr/TheLMA
class ChemicalStructureMember(Member):
    relation = "%s/chemical-structure" % RELATION_BASE_URL
    molecule_designs = collection_attribute(IMoleculeDesign,
                                            'molecule_designs')
    structure_type = member_attribute(IChemicalStructureType, 'structure_type')
    representation = terminal_attribute(str, 'representation')
    structure_type_id = terminal_attribute(str, 'structure_type_id')
    title = attribute_alias('representation')
コード例 #8
0
ファイル: user.py プロジェクト: papagr/TheLMA
class UserMember(Member):
    relation = "%s/user" % RELATION_BASE_URL
    title = attribute_alias('username')
    label = attribute_alias('username')
    username = terminal_attribute(str, 'username')
    user_preferenceses = collection_attribute(IUserPreferences,
                                              'user_preferenceses')
    directory_user_id = terminal_attribute(str, 'directory_user_id')
コード例 #9
0
class ProjectMember(Member):
    relation = "%s/project" % RELATION_BASE_URL
    title = attribute_alias('label')
    label = terminal_attribute(str, 'label')
    creation_date = terminal_attribute(datetime, 'creation_date')
    leader = member_attribute(IUser, 'leader')
    customer = member_attribute(IOrganization, 'customer')
    subprojects = collection_attribute(ISubproject, 'subprojects')
コード例 #10
0
class IsoJobMember(JobMember):
    relation = "%s/iso_job" % RELATION_BASE_URL

    isos = collection_attribute(IIso, 'isos')
    number_stock_racks = terminal_attribute(int, 'number_stock_racks')
    stock_racks = collection_attribute(IStockRack, 'iso_job_stock_racks')
    preparation_plates = collection_attribute(IPlate, 'preparation_plates')
    status = terminal_attribute(str, 'status')
コード例 #11
0
ファイル: sample.py プロジェクト: papagr/TheLMA
class SampleMember(Member):
    relation = "%s/sample" % RELATION_BASE_URL
    volume = terminal_attribute(float, 'volume')
    container = member_attribute(IContainer, 'container')
    sample_molecules = collection_attribute(ISampleMolecule,
                                            'sample_molecules')
    molecule_design_pool_id = terminal_attribute(int,
                                                 'molecule_design_pool_id')
コード例 #12
0
ファイル: sample.py プロジェクト: papagr/TheLMA
class MoleculeMember(Member):
    relation = "%s/molecule" % RELATION_BASE_URL
    molecule_design = member_attribute(IMoleculeDesign, 'molecule_design')
    molecule_design_id = terminal_attribute(int, 'molecule_design.id')
    supplier = member_attribute(IOrganization, 'supplier')
    product_id = terminal_attribute(str, 'supplier_molecule_design.product_id')
    insert_date = terminal_attribute(datetime, 'insert_date')
    samples = collection_attribute(ISample, 'samples')
コード例 #13
0
class MyEntityParentMember(Member):
    relation = 'http://test.org/myentity-parent'
    # String terminal.
    text = terminal_attribute(str, 'text')
    # String terminal with different name in entity.
    text_rc = terminal_attribute(str, 'text_ent')
    #
    text_alias = attribute_alias('text')
コード例 #14
0
ファイル: containerspecs.py プロジェクト: papagr/TheLMA
class ContainerSpecsMember(Member):
    relation = "%s/container-specs" % RELATION_BASE_URL
    title = attribute_alias('label')
    label = terminal_attribute(str, 'label')
    description = terminal_attribute(str, 'description')
    max_volume = terminal_attribute(float, 'max_volume')
    dead_volume = terminal_attribute(float, 'dead_volume')
    manufacturer = member_attribute(IOrganization, 'manufacturer')
コード例 #15
0
class MyEntityGrandchildMember(Member):
    relation = 'http://test.org/myentity-grandchild'
    # String terminal.
    text = terminal_attribute(str, 'text')
    # String terminal with different name in entity.
    text_rc = terminal_attribute(str, 'text_ent')
    # Member.
    parent = member_attribute(IMyEntityChild, 'parent', backref='children')
コード例 #16
0
ファイル: sampleregistration.py プロジェクト: papagr/TheLMA
class SampleRegistrationItemMember(Member):
    relation = "%s/sample-registration-item" % RELATION_BASE_URL
    supplier = member_attribute(IOrganization, 'supplier')
    concentration = terminal_attribute(float, 'concentration')
    volume = terminal_attribute(float, 'volume')
    tube_barcode = terminal_attribute(str, 'tube_barcode')
    rack_barcode = terminal_attribute(str, 'rack_barcode')
    rack_position = member_attribute(IRackPosition, 'rack_position')
    molecule_design_pool = member_attribute(IMoleculeDesignPool,
                                            'molecule_design_pool')
コード例 #17
0
class JobMember(Member):
    relation = '%s/job' % RELATION_BASE_URL
    job_type = terminal_attribute(str, 'job_type')
    label = terminal_attribute(str, 'label')
    user = member_attribute(IUser, 'user')
    creation_time = terminal_attribute(datetime, 'creation_time')

    @property
    def title(self):
        entity = self.get_entity()
        return '%s: %s' % (entity.job_type, entity.label)
コード例 #18
0
ファイル: devicetype.py プロジェクト: papagr/TheLMA
class DeviceTypeMember(Member):
    relation = "%s/device-type" % RELATION_BASE_URL
    title = attribute_alias('label')
    name = terminal_attribute(str, 'name')
    label = terminal_attribute(str, 'label')
    devices = collection_attribute(IDevice, 'devices', backref='type')

    def update(self, member):
        super(DeviceTypeMember, self).update(member)
        self.get_entity().name = member.get_entity().name
        self.label = member.label
コード例 #19
0
ファイル: iso.py プロジェクト: papagr/TheLMA
class StockSampleCreationIsoRequestMember(IsoRequestMember):
    relation = "%s/stock-sample-creation-iso-request" % RELATION_BASE_URL
    stock_volume = terminal_attribute(float, 'stock_volume')
    stock_concentration = terminal_attribute(float, 'stock_concentration')
    number_designs = terminal_attribute(int, 'number_designs')
    molecule_design_library = member_attribute(IMoleculeDesignLibrary,
                                               'molecule_design_library')

    @property
    def title(self):
        return 'Stock Sample Generation ISO Request'
コード例 #20
0
ファイル: iso.py プロジェクト: papagr/TheLMA
class IsoRequestMember(Member):
    relation = "%s/iso-request" % RELATION_BASE_URL
    iso_type = terminal_attribute(str, 'iso_type')
    label = terminal_attribute(str, 'label')
    owner = terminal_attribute(str, 'owner')
    expected_number_isos = terminal_attribute(int, 'expected_number_isos')
    number_aliquots = terminal_attribute(int, 'number_aliquots')
    iso_jobs = collection_attribute(IIsoJob, 'iso_jobs')

    @property
    def title(self):
        return 'Base ISO Request'
コード例 #21
0
ファイル: container.py プロジェクト: papagr/TheLMA
class ContainerMember(Member):
    relation = "%s/container" % RELATION_BASE_URL

    specs = member_attribute(IContainerSpecs, 'specs')
    sample_volume = terminal_attribute(float, 'sample.volume')
    sample_molecules = collection_attribute(ISampleMolecule,
                                            'sample.sample_molecules',
                                            backref='sample.container')
    status = member_attribute(IItemStatus, 'status')
    sample_molecule_design_pool_id = \
                        terminal_attribute(str,
                                           'sample.molecule_design_pool_id')
コード例 #22
0
class MyEntityChildMember(Member):
    relation = 'http://test.org/myentity-child'
    # Member.
    parent = member_attribute(IMyEntity, 'parent', backref='children')
    # Collection accessed as entity attribute and represented as
    # "parent equal to parent member" (backreferencing) specification.
    children = collection_attribute(IMyEntityGrandchild,
                                    entity_attr='children',
                                    backref='parent')
    # String terminal.
    text = terminal_attribute(str, 'text')
    # String terminal with different name in entity.
    text_rc = terminal_attribute(str, 'text_ent')
コード例 #23
0
ファイル: sampleregistration.py プロジェクト: papagr/TheLMA
class SupplierSampleRegistrationItemMember(SampleRegistrationItemMember):
    relation = "%s/supplier-sample-registration-item" % RELATION_BASE_URL
    supplier = member_attribute(IOrganization, 'supplier')
    product_id = terminal_attribute(str, 'product_id')
    concentration = terminal_attribute(float, 'concentration')
    volume = terminal_attribute(float, 'volume')
    tube_barcode = terminal_attribute(str, 'tube_barcode')
    rack_barcode = terminal_attribute(str, 'rack_barcode')
    rack_position = member_attribute(IRackPosition, 'rack_position')
    molecule_type = member_attribute(IMoleculeType, 'molecule_type')
    molecule_design_pool_registration_item = \
            member_attribute(IMoleculeDesignPoolRegistrationItem,
                             'molecule_design_pool_registration_item')
コード例 #24
0
class GeneMember(Member):
    relation = "%s/gene" % RELATION_BASE_URL
    title = attribute_alias('locus_name')

    accession = terminal_attribute(str, 'accession')
    locus_name = terminal_attribute(str, 'locus_name')
#    nice_name = terminal_attribute('nice_name')
    species = member_attribute(ISpecies, 'species')
    molecule_designs = \
        collection_attribute(IMoleculeDesign,
                             'molecule_designs',
                             cardinality=CARDINALITIES.MANYTOMANY)
    molecule_design_pools = \
        collection_attribute(IMoleculeDesignPool,
                             'molecule_design_pools',
                             cardinality=CARDINALITIES.MANYTOMANY)
コード例 #25
0
ファイル: container.py プロジェクト: papagr/TheLMA
class TubeMember(ContainerMember):
    relation = "%s/tube" % RELATION_BASE_URL

    position = member_attribute(IRackPosition, 'location.position')
    location = member_attribute(ILocation, 'location.rack.location')
    rack = member_attribute(IRack, 'location.rack')
    rack_specs = member_attribute(IRackSpecs, 'location.rack.specs')
    # None in containers that do not hold stock samples.
    sample_product_id = terminal_attribute(str, 'sample.product_id')
    sample_supplier = member_attribute(IOrganization, 'sample.supplier')
    barcode = terminal_attribute(str, 'barcode')

    @property
    def title(self):
        entity = self.get_entity()
        return '%s @ %s' % (entity.barcode or 'NO BARCODE', entity.location)
コード例 #26
0
class MoleculeDesignLibraryMember(Member):
    relation = "%s/molecule-design-library" % RELATION_BASE_URL
    molecule_design_pool_set = member_attribute(IMoleculeDesignPoolSet,
                                                'molecule_design_pool_set')
    label = terminal_attribute(str, 'label')
    final_volume = terminal_attribute(float, 'final_volume')
    final_concentration = terminal_attribute(float, 'final_concentration')
    number_layouts = terminal_attribute(int, 'number_layouts')
    rack_layout = member_attribute(IRackLayout, 'rack_layout')
    library_plates = collection_attribute(ILibraryPlate, 'library_plates')
    creation_iso_request = member_attribute(IIsoRequest,
                                            'creation_iso_request')

    @property
    def title(self):
        return self.label
コード例 #27
0
ファイル: experiment.py プロジェクト: papagr/TheLMA
class ExperimentDesignRackMember(Member):
    relation = "%s/experiment-design-rack" % RELATION_BASE_URL
    title = attribute_alias('label')
    label = terminal_attribute(str, 'label')
    rack_shape = member_attribute(IRackShape, 'rack_layout.shape')
    rack_layout = member_attribute(IRackLayout, 'rack_layout')
    tags = collection_attribute(ITag, 'tags')
コード例 #28
0
ファイル: site.py プロジェクト: scraping-xx/everest-demo
class SiteMember(Member):
    relation = 'http://plantscribe.org/relations/site'
    title = attribute_alias('name')
    name = terminal_attribute(str, 'name')
    incidences = collection_attribute(IIncidence,
                                      backref='site',
                                      is_nested=True)
    project = member_attribute(IProject, 'project')
コード例 #29
0
ファイル: subproject.py プロジェクト: papagr/TheLMA
class SubprojectMember(Member):
    relation = "%s/subproject" % RELATION_BASE_URL
    label = terminal_attribute(str, 'label')
    project = member_attribute(IProject, 'project')
    creation_date = terminal_attribute(datetime, 'creation_date')
    active = terminal_attribute(bool, 'active')

    @property
    def title(self):
        # The title is formed from the project's and the subproject's label
        # and does not need to be persisted or exposed.
        return self.get_entity().title

    def update(self, member):
        super(SubprojectMember, self).update(member)
        self.label = member.label
        self.active = member.active
コード例 #30
0
class MyEntityMember(Member):
    relation = 'http://test.org/myentity'
    # Member.
    parent = member_attribute(IMyEntityParent, 'parent')
    # Nested member (i.e., URL built relative to parent).
    nested_parent = member_attribute(IMyEntityParent, 'parent', is_nested=True)
    # Collection.
    children = collection_attribute(IMyEntityChild, 'children')
    # String terminal.
    text = terminal_attribute(str, 'text')
    # String terminal with different name in entity.
    text_rc = terminal_attribute(str, 'text_ent')
    # Number terminal.
    number = terminal_attribute(int, 'number')
    # Date time terminal.
    date_time = terminal_attribute(datetime.datetime, 'date_time')
    # Nested attribute.
    parent_text = terminal_attribute(str, 'parent.text_ent')
コード例 #31
0
ファイル: test_state.py プロジェクト: b8va/everest
 def test_state_data(self):
     data = dict(text='FOO',
                 number=-1,
                 parent=MyEntityParent(),
                 children=[MyEntityChild()])
     entity = MyEntity(**data)
     # We don't want to test the required unit of work here.
     uow = MagicMock()
     self.assert_raises(ValueError, EntityState.get_state, entity)
     entity.__everest__ = EntityState(entity, uow)
     state_data = EntityState.get_state(entity).data
     for attr, value in state_data.items():
         if attr.resource_attr == 'number':
             number_attr = attr
         elif attr.resource_attr == 'parent':
             parent_attr = attr
         elif attr.resource_attr == 'parent_text':
             parent_text_attr = attr
         if attr.resource_attr in data:
             self.assert_equal(value, data[attr.resource_attr])
     new_number = -2
     state_data[number_attr] = new_number
     EntityState.get_state(entity).data = state_data
     self.assert_equal(entity.number, new_number)
     new_entity = MyEntity()
     self.assert_not_equal(new_entity.number, new_number)
     new_entity.__everest__ = EntityState(new_entity, uow)
     EntityState.transfer_state_data(entity, new_entity)
     self.assert_equal(new_entity.number, new_number)
     # Make setting invalid attribute fail.
     invalid_number_attr = terminal_attribute(str, 'grmbl')
     del state_data[number_attr]
     state_data[invalid_number_attr] = -2
     with self.assert_raises(ValueError) as cm:
         EntityState.get_state(entity).data = state_data
     self.assert_true(cm.exception.args[0].startswith('Can not set'))
     # Make set nested attribute fail.
     entity.parent = None
     del state_data[invalid_number_attr]
     del state_data[parent_attr]
     state_data[parent_text_attr] = 'FOO PARENT'
     state = EntityState.get_state(entity)
     self.assert_raises(AttributeError, setattr, state, 'data', state_data)
コード例 #32
0
 def test_invalid_kind(self):
     attr = terminal_attribute(str, 'foo')
     attr.kind = 'INVALID'
     mp_attr = MappedAttribute(attr, options={IGNORE_OPTION:None})
     key = MappedAttributeKey(())
     self.assert_raises(ValueError, mp_attr.should_ignore, key)
コード例 #33
0
ファイル: test_attributes.py プロジェクト: helixyte/everest
 def test_is_terminal_attribute(self, attr_name):
     mb_attr = member_attribute(Member, attr_name)
     assert is_terminal_attribute(mb_attr) is False
     t_attr = terminal_attribute(int, attr_name)
     assert is_terminal_attribute(t_attr) is True
コード例 #34
0
ファイル: test_attributes.py プロジェクト: helixyte/everest
 def test_get_attribute_cardinality(self, attr_name):
     mb_attr = member_attribute(Member, attr_name)
     assert get_attribute_cardinality(mb_attr) == CARDINALITY_CONSTANTS.ONE
     t_attr = terminal_attribute(int, attr_name)
     with pytest.raises(ValueError):
         get_attribute_cardinality(t_attr)
コード例 #35
0
ファイル: test_attributes.py プロジェクト: b8va/everest
 def set_up(self):
     self.member_attr = member_attribute(Member, 'attr')
     self.terminal_attr = terminal_attribute(int, 'attr')