Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
organisation_id = IntType(required=True)
organisation = StringType(required=True)
name = StringType(required=True)
logo = StringType()
description = StringType()
invite_only = BooleanType(
default=False, serialized_name="inviteOnly", required=True
)
visibility = StringType(
required=True, validators=[validate_team_visibility], serialize_when_none=False
)
is_org_admin = BooleanType(default=False)
is_general_admin = BooleanType(default=False)
members = ListType(ModelType(TeamMembersDTO))
team_projects = ListType(ModelType(ProjectTeamDTO))
organisation_projects = ListType(ModelType(OrganisationProjectsDTO))
class TeamDTO(Model):
""" Describes JSON model for a team """
team_id = IntType(serialized_name="teamId")
organisation_id = IntType(required=True)
organisation = StringType(required=True)
name = StringType(required=True)
logo = StringType()
description = StringType()
invite_only = BooleanType(
default=False, serialized_name="inviteOnly", required=True
)
visibility = StringType(
required=True, validators=[validate_team_visibility], serialize_when_none=False
""" Describes JSON model for a team """
team_id = IntType(serialized_name="teamId")
organisation_id = IntType(required=True)
organisation = StringType(required=True)
name = StringType(required=True)
logo = StringType()
description = StringType()
invite_only = BooleanType(
default=False, serialized_name="inviteOnly", required=True
)
visibility = StringType(
required=True, validators=[validate_team_visibility], serialize_when_none=False
)
is_org_admin = BooleanType(default=False)
is_general_admin = BooleanType(default=False)
members = ListType(ModelType(TeamMembersDTO))
team_projects = ListType(ModelType(ProjectTeamDTO))
organisation_projects = ListType(ModelType(OrganisationProjectsDTO))
class TeamDTO(Model):
""" Describes JSON model for a team """
team_id = IntType(serialized_name="teamId")
organisation_id = IntType(required=True)
organisation = StringType(required=True)
name = StringType(required=True)
logo = StringType()
description = StringType()
invite_only = BooleanType(
default=False, serialized_name="inviteOnly", required=True
)
"""
cfngin_bucket = StringType(serialize_when_none=False)
cfngin_bucket_region = StringType(serialize_when_none=False)
cfngin_cache_dir = StringType(serialize_when_none=False)
log_formats = DictType(StringType, serialize_when_none=False)
lookups = DictType(StringType, serialize_when_none=False)
mappings = DictType(
DictType(DictType(StringType)), serialize_when_none=False)
namespace = StringType(required=True)
namespace_delimiter = StringType(serialize_when_none=False)
package_sources = ModelType(PackageSources, serialize_when_none=False)
persistent_graph_key = StringType(serialize_when_none=False)
post_build = ListType(ModelType(Hook), serialize_when_none=False)
post_destroy = ListType(ModelType(Hook), serialize_when_none=False)
pre_build = ListType(ModelType(Hook), serialize_when_none=False)
pre_destroy = ListType(ModelType(Hook), serialize_when_none=False)
service_role = StringType(serialize_when_none=False)
stacker_bucket = StringType(serialize_when_none=False)
stacker_bucket_region = StringType(serialize_when_none=False)
stacker_cache_dir = StringType(serialize_when_none=False)
stacks = ListType(
ModelType(Stack), default=[])
sys_path = StringType(serialize_when_none=False)
tags = DictType(StringType, serialize_when_none=False)
targets = ListType(
ModelType(Target), serialize_when_none=False)
template_indent = StringType(serialize_when_none=False)
def __init__(self, raw_data=None, trusted_data=None,
deserialize_mapping=None, init=True, partial=True,
strict=True, validate=False, app_data=None, lazy=False,
url = StringType(serialize_when_none=False)
description = StringType(serialize_when_none=False)
class CampaignProjectDTO(Model):
""" DTO used to define avaliable campaign connnected projects"""
project_id = IntType()
campaign_id = IntType()
class CampaignListDTO(Model):
""" DTO used to define available campaigns """
def __init__(self):
""" DTO constructor initialise all arrays to empty"""
super().__init__()
self.campaigns = []
campaigns = ListType(ModelType(CampaignDTO))
class ModelModel(Model):
"""
Information about the model used for a job.
"""
name: Optional[str] = StringType(serialize_when_none=True)
version: Optional[str] = StringType(serialize_when_none=True)
class SheepModel(Model):
"""
Information about a sheep.
"""
running: bool = BooleanType(required=True)
model: ModelModel = ModelType(ModelModel, required=True)
request: Optional[str] = UUIDType(serialize_when_none=True)
class ErrorModel(Model):
"""
Information about an error that occurred when processing a job.
"""
message: str = StringType(required=True)
exception_type: str = StringType(required=False)
exception_traceback: str = StringType(required=False)
class JobStatus:
"""
Used as an enum class that represents all possible states of a job.
"""
ACCEPTED = "accepted"
QUEUED = "queued"
PROCESSING = "processing"
FAILED = "failed"
DONE = "done"
class JobStatusModel(Model, ExamplesMixin):
"""
Status information for a job.
"""
status: JobStatus = StringType(required=True, choices=[*map(
lambda m: getattr(JobStatus, m),
filter(str.isupper, dir(JobStatus)))
])
error_details: ErrorModel = ModelType(ErrorModel, required=False, default=None)
model: ModelModel = ModelType(ModelModel, required=True)
enqueued_at: datetime = DateTimeType(required=False)
processing_started_at: datetime = DateTimeType(required=False)
finished_at: datetime = DateTimeType(required=False)
def copy(self) -> 'JobStatusModel':
"""
Make a deep copy of this object.
:return: a deep copy of this object
"""
return JobStatusModel(deepcopy(self.to_primitive()))
@classmethod
def get_examples(cls):
return [
version = schematics.types.StringType(required=True)
is_direct = schematics.types.BooleanType(required=True)
source = schematics.types.StringType(required=True)
dependencies = _SortedListType(
schematics.types.StringType,
default=[],
)
class Environment(schematics.models.Model):
sys_platform = schematics.types.StringType()
python_version = schematics.types.IntType(choices=[2, 3])
requirements = schematics.types.DictType(
schematics.types.ModelType(Requirement),
default={},
)
@classmethod
def from_current(cls):
environment = cls()
environment.set_to_current()
return environment
@property
def name(self):
return "{sys_platform}_py{python_version}".format(**self.to_primitive())
def set_to_current(self):
self.sys_platform = sys.platform
self.python_version = sys.version_info.major
use_latest = BooleanType(serialize_when_none=False)
requester_pays = BooleanType(serialize_when_none=False)
paths = ListType(StringType, serialize_when_none=False)
configs = ListType(StringType, serialize_when_none=False)
class PackageSources(Model):
local = ListType(ModelType(LocalPackageSource))
git = ListType(ModelType(GitPackageSource))
s3 = ListType(ModelType(S3PackageSource))
class Hook(Model):
path = StringType(required=True)
required = BooleanType(default=True)
enabled = BooleanType(default=True)
data_key = StringType(serialize_when_none=False)
args = DictType(AnyType)
class Target(Model):
name = StringType(required=True)
class GdsEps(EpsilonSpec):
"""Defines a permittivity distribution using a GDS file.
The GDS file will be flattened so that each layer only contains polygons.
TODO(logansu): Expand description.
Attributes:
type: Must be "gds_epsilon".
gds: URI of GDS file.
mat_stack: Description of each GDS layer permittivity values and
thicknesses.
stack_normal: Direction considered the normal to the stack.
"""
type = schema_utils.polymorphic_model_type("gds")
gds = types.StringType()
mat_stack = types.ModelType(GdsMaterialStack)
stack_normal = optplan.vec3d()
class Mesh(schema_utils.Model):
"""Defines a mesh to draw.
Meshes are used to define permittivities through `GdsMeshEps`.
"""
@schema_utils.polymorphic_model()
class GdsMesh(Mesh):
"""Defines a mesh by using polygons from a GDS file.
The mesh is defined by extruding the polygon along the stack normal with
coordinates given by `extents`.
requester_pays = BooleanType(serialize_when_none=False)
use_latest = BooleanType(serialize_when_none=False)
class PackageSources(Model):
"""Package sources model.
Attributes:
git (GitPackageSource): Package source located in a git repo.
local (LocalPackageSource): Package source located on a local disk.
s3 (S3PackageSource): Package source located in AWS S3.
"""
git = ListType(ModelType(GitPackageSource))
local = ListType(ModelType(LocalPackageSource))
s3 = ListType(ModelType(S3PackageSource))
class Hook(Model):
"""Hook module.
Attributes:
args (DictType)
data_key (StringType)
enabled (BooleanType)
path (StringType)
required (BooleanType)
"""
args = DictType(AnyType)