<s> import datetime <EOL> import hashlib <EOL> import factory <EOL> import factory . fuzzy <EOL> from pyblake2 import blake2b <EOL> from warehouse . packaging . models import ( <EOL> Project , Release , Role , File , JournalEntry , <EOL> ) <EOL> from . accounts import UserFactory <EOL> from . base import WarehouseFactory <EOL> class ProjectFactory ( WarehouseFactory ) : <EOL> class Meta : <EOL> model = Project <EOL> name = factory . fuzzy . FuzzyText ( length = <NUM_LIT:12> ) <EOL> class ReleaseFactory ( WarehouseFactory ) : <EOL> class Meta : <EOL> model = Release <EOL> name = factory . LazyAttribute ( lambda o : o . project . name ) <EOL> project = factory . SubFactory ( ProjectFactory ) <EOL> version = factory . Sequence ( lambda n : str ( n ) + "<STR_LIT>" ) <EOL> _pypi_ordering = factory . Sequence ( lambda n : n ) <EOL> uploader = factory . SubFactory ( UserFactory ) <EOL> class FileFactory ( WarehouseFactory ) : <EOL> class Meta : <EOL> model = File <EOL> name = factory . LazyAttribute ( lambda o : o . release . name ) <EOL> release = factory . SubFactory ( ReleaseFactory ) <EOL> python_version = "<STR_LIT:source>" <EOL> md5_digest = factory . LazyAttribute ( <EOL> lambda o : hashlib . md5 ( o . filename . encode ( "<STR_LIT:utf8>" ) ) . hexdigest ( ) <EOL> ) <EOL> sha256_digest = factory . LazyAttribute ( <EOL> lambda o : hashlib . sha256 ( o . filename . encode ( "<STR_LIT:utf8>" ) ) . hexdigest ( ) <EOL> ) <EOL> blake2_256_digest = factory . LazyAttribute ( <EOL> lambda o : ( <EOL> blake2b ( o . filename . encode ( "<STR_LIT:utf8>" ) , digest_size = <NUM_LIT:32> ) . hexdigest ( ) <EOL> ) <EOL> ) <EOL> upload_time = factory . fuzzy . FuzzyNaiveDateTime ( <EOL> datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> ) <EOL> path = factory . LazyAttribute ( <EOL> lambda o : "<STR_LIT:/>" . join ( [ <EOL> o . blake2_256_digest [ : <NUM_LIT:2> ] , <EOL> o . blake2_256_digest [ <NUM_LIT:2> : <NUM_LIT:4> ] , <EOL> o . blake2_256_digest [ <NUM_LIT:4> : ] , <EOL> o . filename , <EOL> ] ) <EOL> ) <EOL> class RoleFactory ( WarehouseFactory ) : <EOL> class Meta : <EOL> model = Role <EOL> role_name = "<STR_LIT>" <EOL> user = factory . SubFactory ( UserFactory ) <EOL> project = factory . SubFactory ( ProjectFactory ) <EOL> class JournalEntryFactory ( WarehouseFactory ) : <EOL> class Meta : <EOL> model = JournalEntry <EOL> id = factory . Sequence ( lambda n : n ) <EOL> name = factory . fuzzy . FuzzyText ( length = <NUM_LIT:12> ) <EOL> version = factory . Sequence ( lambda n : str ( n ) + "<STR_LIT>" ) <EOL> submitted_date = factory . fuzzy . FuzzyNaiveDateTime ( <EOL> datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> ) <EOL> submitted_by = factory . SubFactory ( UserFactory ) </s>
