genui.compounds.extensions.fileimports package

Submodules

genui.compounds.extensions.fileimports.initializer module

initializer

Created by: Martin Sicho On: 7/13/20, 1:59 PM

class genui.compounds.extensions.fileimports.initializer.FileInitializer(instance, progress_recorder=None, parser_class=None, instance_file_attr='file')[source]

Bases: MolSetInitializer

parseMols(callback)[source]
abstract populateInstance()[source]
updateInstance()[source]
exception genui.compounds.extensions.fileimports.initializer.InvalidParserException[source]

Bases: Exception

genui.compounds.extensions.fileimports.model module

models

Created by: Martin Sicho On: 7/16/20, 2:01 PM

class genui.compounds.extensions.fileimports.model.FileCompounds(*args, **kwargs)[source]

Bases: MolSet

class Meta[source]

Bases: object

abstract = False
property file
molset_ptr

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

molset_ptr_id
polymorphic_primary_key_name = 'id'
polymorphic_super_sub_accessors_replaced = False
tasks

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

genui.compounds.extensions.fileimports.parser module

parser

Created by: Martin Sicho On: 7/13/20, 4:37 PM

class genui.compounds.extensions.fileimports.parser.FileParser(file, molset)[source]

Bases: ABC

abstract parse() Iterable[tuple][source]

genui.compounds.extensions.fileimports.serializer module

serializer

Created by: Martin Sicho On: 7/16/20, 2:04 PM

class genui.compounds.extensions.fileimports.serializer.FileSetSerializer(*args, **kwargs)[source]

Bases: MolSetSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'activities', 'files', 'file')
file_extension = ''
read_only_fields = ('created', 'updated', 'activities', 'files')
create(validated_data)[source]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop(‘example_relationship’) instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you’ll need to write an explicit .create() method.

class genui.compounds.extensions.fileimports.serializer.FileSetUpdateSerializer(*args, **kwargs)[source]

Bases: MolSetUpdateSerializer

class Meta[source]

Bases: object

fields = ('id', 'name', 'description', 'created', 'updated', 'project', 'activities', 'files', 'updateData')
read_only_fields = ('created', 'updated', 'activities', 'files')

Module contents

__init__.py

Created by: Martin Sicho On: 7/13/20, 1:59 PM