hexsha stringlengths 40 40 | size int64 10 1.01M | ext stringclasses 8 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 237 | max_stars_repo_name stringlengths 5 113 | max_stars_repo_head_hexsha stringlengths 40 41 | max_stars_repo_licenses list | max_stars_count int64 1 95.2k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 237 | max_issues_repo_name stringlengths 5 113 | max_issues_repo_head_hexsha stringlengths 40 41 | max_issues_repo_licenses list | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 237 | max_forks_repo_name stringlengths 5 113 | max_forks_repo_head_hexsha stringlengths 40 41 | max_forks_repo_licenses list | max_forks_count int64 1 33.1k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 10 1.01M | avg_line_length float64 2.26 46k | max_line_length int64 3 990k | alphanum_fraction float64 0.1 1 | label int64 0 2 | cost float64 0 5.77 | embedding list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8a5657a9ba609c4b80f71648ff43f36e553c66c2 | 26,287 | py | Python | azure-devops/azext_devops/vstsCompressed/work_item_tracking_process/v4_0/models/models.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | null | null | null | azure-devops/azext_devops/vstsCompressed/work_item_tracking_process/v4_0/models/models.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | 37 | 2020-04-27T07:45:19.000Z | 2021-04-05T07:27:15.000Z | azure-devops/azext_devops/vstsCompressed/work_item_tracking_process/v4_0/models/models.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------
from msrest.serialization import Model
class Control(Model):
"""Control.
:param contribution: Contribution for the control.
:type contribution: :class:`WitContribution <work-item-tracking.v4_0.models.WitContribution>`
:param control_type: Type of the control.
:type control_type: str
:param height: Height of the control, for html controls.
:type height: int
:param id: The id for the layout node.
:type id: str
:param inherited: A value indicating whether this layout node has been inherited from a parent layout. This is expected to only be only set by the combiner.
:type inherited: bool
:param is_contribution: A value indicating if the layout node is contribution or not.
:type is_contribution: bool
:param label: Label for the field
:type label: str
:param metadata: Inner text of the control.
:type metadata: str
:param order:
:type order: int
:param overridden: A value indicating whether this layout node has been overridden by a child layout.
:type overridden: bool
:param read_only: A value indicating if the control is readonly.
:type read_only: bool
:param visible: A value indicating if the control should be hidden or not.
:type visible: bool
:param watermark: Watermark text for the textbox.
:type watermark: str
"""
_attribute_map = {
'contribution': {'key': 'contribution', 'type': 'WitContribution'},
'control_type': {'key': 'controlType', 'type': 'str'},
'height': {'key': 'height', 'type': 'int'},
'id': {'key': 'id', 'type': 'str'},
'inherited': {'key': 'inherited', 'type': 'bool'},
'is_contribution': {'key': 'isContribution', 'type': 'bool'},
'label': {'key': 'label', 'type': 'str'},
'metadata': {'key': 'metadata', 'type': 'str'},
'order': {'key': 'order', 'type': 'int'},
'overridden': {'key': 'overridden', 'type': 'bool'},
'read_only': {'key': 'readOnly', 'type': 'bool'},
'visible': {'key': 'visible', 'type': 'bool'},
'watermark': {'key': 'watermark', 'type': 'str'}
}
def __init__(self, contribution=None, control_type=None, height=None, id=None, inherited=None, is_contribution=None, label=None, metadata=None, order=None, overridden=None, read_only=None, visible=None, watermark=None):
super(Control, self).__init__()
self.contribution = contribution
self.control_type = control_type
self.height = height
self.id = id
self.inherited = inherited
self.is_contribution = is_contribution
self.label = label
self.metadata = metadata
self.order = order
self.overridden = overridden
self.read_only = read_only
self.visible = visible
self.watermark = watermark
class CreateProcessModel(Model):
"""CreateProcessModel.
:param description:
:type description: str
:param name:
:type name: str
:param parent_process_type_id:
:type parent_process_type_id: str
:param reference_name:
:type reference_name: str
"""
_attribute_map = {
'description': {'key': 'description', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'parent_process_type_id': {'key': 'parentProcessTypeId', 'type': 'str'},
'reference_name': {'key': 'referenceName', 'type': 'str'}
}
def __init__(self, description=None, name=None, parent_process_type_id=None, reference_name=None):
super(CreateProcessModel, self).__init__()
self.description = description
self.name = name
self.parent_process_type_id = parent_process_type_id
self.reference_name = reference_name
class Extension(Model):
"""Extension.
:param id:
:type id: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'}
}
def __init__(self, id=None):
super(Extension, self).__init__()
self.id = id
class FieldModel(Model):
"""FieldModel.
:param description:
:type description: str
:param id:
:type id: str
:param is_identity:
:type is_identity: bool
:param name:
:type name: str
:param type:
:type type: object
:param url:
:type url: str
"""
_attribute_map = {
'description': {'key': 'description', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'is_identity': {'key': 'isIdentity', 'type': 'bool'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'object'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, description=None, id=None, is_identity=None, name=None, type=None, url=None):
super(FieldModel, self).__init__()
self.description = description
self.id = id
self.is_identity = is_identity
self.name = name
self.type = type
self.url = url
class FieldRuleModel(Model):
"""FieldRuleModel.
:param actions:
:type actions: list of :class:`RuleActionModel <work-item-tracking.v4_0.models.RuleActionModel>`
:param conditions:
:type conditions: list of :class:`RuleConditionModel <work-item-tracking.v4_0.models.RuleConditionModel>`
:param friendly_name:
:type friendly_name: str
:param id:
:type id: str
:param is_disabled:
:type is_disabled: bool
:param is_system:
:type is_system: bool
"""
_attribute_map = {
'actions': {'key': 'actions', 'type': '[RuleActionModel]'},
'conditions': {'key': 'conditions', 'type': '[RuleConditionModel]'},
'friendly_name': {'key': 'friendlyName', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'is_disabled': {'key': 'isDisabled', 'type': 'bool'},
'is_system': {'key': 'isSystem', 'type': 'bool'}
}
def __init__(self, actions=None, conditions=None, friendly_name=None, id=None, is_disabled=None, is_system=None):
super(FieldRuleModel, self).__init__()
self.actions = actions
self.conditions = conditions
self.friendly_name = friendly_name
self.id = id
self.is_disabled = is_disabled
self.is_system = is_system
class FormLayout(Model):
"""FormLayout.
:param extensions: Gets and sets extensions list
:type extensions: list of :class:`Extension <work-item-tracking.v4_0.models.Extension>`
:param pages: Top level tabs of the layout.
:type pages: list of :class:`Page <work-item-tracking.v4_0.models.Page>`
:param system_controls: Headers controls of the layout.
:type system_controls: list of :class:`Control <work-item-tracking.v4_0.models.Control>`
"""
_attribute_map = {
'extensions': {'key': 'extensions', 'type': '[Extension]'},
'pages': {'key': 'pages', 'type': '[Page]'},
'system_controls': {'key': 'systemControls', 'type': '[Control]'}
}
def __init__(self, extensions=None, pages=None, system_controls=None):
super(FormLayout, self).__init__()
self.extensions = extensions
self.pages = pages
self.system_controls = system_controls
class Group(Model):
"""Group.
:param contribution: Contribution for the group.
:type contribution: :class:`WitContribution <work-item-tracking.v4_0.models.WitContribution>`
:param controls: Controls to be put in the group.
:type controls: list of :class:`Control <work-item-tracking.v4_0.models.Control>`
:param height: The height for the contribution.
:type height: int
:param id: The id for the layout node.
:type id: str
:param inherited: A value indicating whether this layout node has been inherited from a parent layout. This is expected to only be only set by the combiner.
:type inherited: bool
:param is_contribution: A value indicating if the layout node is contribution are not.
:type is_contribution: bool
:param label: Label for the group.
:type label: str
:param order: Order in which the group should appear in the section.
:type order: int
:param overridden: A value indicating whether this layout node has been overridden by a child layout.
:type overridden: bool
:param visible: A value indicating if the group should be hidden or not.
:type visible: bool
"""
_attribute_map = {
'contribution': {'key': 'contribution', 'type': 'WitContribution'},
'controls': {'key': 'controls', 'type': '[Control]'},
'height': {'key': 'height', 'type': 'int'},
'id': {'key': 'id', 'type': 'str'},
'inherited': {'key': 'inherited', 'type': 'bool'},
'is_contribution': {'key': 'isContribution', 'type': 'bool'},
'label': {'key': 'label', 'type': 'str'},
'order': {'key': 'order', 'type': 'int'},
'overridden': {'key': 'overridden', 'type': 'bool'},
'visible': {'key': 'visible', 'type': 'bool'}
}
def __init__(self, contribution=None, controls=None, height=None, id=None, inherited=None, is_contribution=None, label=None, order=None, overridden=None, visible=None):
super(Group, self).__init__()
self.contribution = contribution
self.controls = controls
self.height = height
self.id = id
self.inherited = inherited
self.is_contribution = is_contribution
self.label = label
self.order = order
self.overridden = overridden
self.visible = visible
class Page(Model):
"""Page.
:param contribution: Contribution for the page.
:type contribution: :class:`WitContribution <work-item-tracking.v4_0.models.WitContribution>`
:param id: The id for the layout node.
:type id: str
:param inherited: A value indicating whether this layout node has been inherited from a parent layout. This is expected to only be only set by the combiner.
:type inherited: bool
:param is_contribution: A value indicating if the layout node is contribution are not.
:type is_contribution: bool
:param label: The label for the page.
:type label: str
:param locked: A value indicating whether any user operations are permitted on this page and the contents of this page
:type locked: bool
:param order: Order in which the page should appear in the layout.
:type order: int
:param overridden: A value indicating whether this layout node has been overridden by a child layout.
:type overridden: bool
:param page_type: The icon for the page.
:type page_type: object
:param sections: The sections of the page.
:type sections: list of :class:`Section <work-item-tracking.v4_0.models.Section>`
:param visible: A value indicating if the page should be hidden or not.
:type visible: bool
"""
_attribute_map = {
'contribution': {'key': 'contribution', 'type': 'WitContribution'},
'id': {'key': 'id', 'type': 'str'},
'inherited': {'key': 'inherited', 'type': 'bool'},
'is_contribution': {'key': 'isContribution', 'type': 'bool'},
'label': {'key': 'label', 'type': 'str'},
'locked': {'key': 'locked', 'type': 'bool'},
'order': {'key': 'order', 'type': 'int'},
'overridden': {'key': 'overridden', 'type': 'bool'},
'page_type': {'key': 'pageType', 'type': 'object'},
'sections': {'key': 'sections', 'type': '[Section]'},
'visible': {'key': 'visible', 'type': 'bool'}
}
def __init__(self, contribution=None, id=None, inherited=None, is_contribution=None, label=None, locked=None, order=None, overridden=None, page_type=None, sections=None, visible=None):
super(Page, self).__init__()
self.contribution = contribution
self.id = id
self.inherited = inherited
self.is_contribution = is_contribution
self.label = label
self.locked = locked
self.order = order
self.overridden = overridden
self.page_type = page_type
self.sections = sections
self.visible = visible
class ProcessModel(Model):
"""ProcessModel.
:param description:
:type description: str
:param name:
:type name: str
:param projects:
:type projects: list of :class:`ProjectReference <work-item-tracking.v4_0.models.ProjectReference>`
:param properties:
:type properties: :class:`ProcessProperties <work-item-tracking.v4_0.models.ProcessProperties>`
:param reference_name:
:type reference_name: str
:param type_id:
:type type_id: str
"""
_attribute_map = {
'description': {'key': 'description', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'projects': {'key': 'projects', 'type': '[ProjectReference]'},
'properties': {'key': 'properties', 'type': 'ProcessProperties'},
'reference_name': {'key': 'referenceName', 'type': 'str'},
'type_id': {'key': 'typeId', 'type': 'str'}
}
def __init__(self, description=None, name=None, projects=None, properties=None, reference_name=None, type_id=None):
super(ProcessModel, self).__init__()
self.description = description
self.name = name
self.projects = projects
self.properties = properties
self.reference_name = reference_name
self.type_id = type_id
class ProcessProperties(Model):
"""ProcessProperties.
:param class_:
:type class_: object
:param is_default:
:type is_default: bool
:param is_enabled:
:type is_enabled: bool
:param parent_process_type_id:
:type parent_process_type_id: str
:param version:
:type version: str
"""
_attribute_map = {
'class_': {'key': 'class', 'type': 'object'},
'is_default': {'key': 'isDefault', 'type': 'bool'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'parent_process_type_id': {'key': 'parentProcessTypeId', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'}
}
def __init__(self, class_=None, is_default=None, is_enabled=None, parent_process_type_id=None, version=None):
super(ProcessProperties, self).__init__()
self.class_ = class_
self.is_default = is_default
self.is_enabled = is_enabled
self.parent_process_type_id = parent_process_type_id
self.version = version
class ProjectReference(Model):
"""ProjectReference.
:param description:
:type description: str
:param id:
:type id: str
:param name:
:type name: str
:param url:
:type url: str
"""
_attribute_map = {
'description': {'key': 'description', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, description=None, id=None, name=None, url=None):
super(ProjectReference, self).__init__()
self.description = description
self.id = id
self.name = name
self.url = url
class RuleActionModel(Model):
"""RuleActionModel.
:param action_type:
:type action_type: str
:param target_field:
:type target_field: str
:param value:
:type value: str
"""
_attribute_map = {
'action_type': {'key': 'actionType', 'type': 'str'},
'target_field': {'key': 'targetField', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'}
}
def __init__(self, action_type=None, target_field=None, value=None):
super(RuleActionModel, self).__init__()
self.action_type = action_type
self.target_field = target_field
self.value = value
class RuleConditionModel(Model):
"""RuleConditionModel.
:param condition_type:
:type condition_type: str
:param field:
:type field: str
:param value:
:type value: str
"""
_attribute_map = {
'condition_type': {'key': 'conditionType', 'type': 'str'},
'field': {'key': 'field', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'}
}
def __init__(self, condition_type=None, field=None, value=None):
super(RuleConditionModel, self).__init__()
self.condition_type = condition_type
self.field = field
self.value = value
class Section(Model):
"""Section.
:param groups:
:type groups: list of :class:`Group <work-item-tracking.v4_0.models.Group>`
:param id: The id for the layout node.
:type id: str
:param overridden: A value indicating whether this layout node has been overridden by a child layout.
:type overridden: bool
"""
_attribute_map = {
'groups': {'key': 'groups', 'type': '[Group]'},
'id': {'key': 'id', 'type': 'str'},
'overridden': {'key': 'overridden', 'type': 'bool'}
}
def __init__(self, groups=None, id=None, overridden=None):
super(Section, self).__init__()
self.groups = groups
self.id = id
self.overridden = overridden
class UpdateProcessModel(Model):
"""UpdateProcessModel.
:param description:
:type description: str
:param is_default:
:type is_default: bool
:param is_enabled:
:type is_enabled: bool
:param name:
:type name: str
"""
_attribute_map = {
'description': {'key': 'description', 'type': 'str'},
'is_default': {'key': 'isDefault', 'type': 'bool'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'name': {'key': 'name', 'type': 'str'}
}
def __init__(self, description=None, is_default=None, is_enabled=None, name=None):
super(UpdateProcessModel, self).__init__()
self.description = description
self.is_default = is_default
self.is_enabled = is_enabled
self.name = name
class WitContribution(Model):
"""WitContribution.
:param contribution_id: The id for the contribution.
:type contribution_id: str
:param height: The height for the contribution.
:type height: int
:param inputs: A dictionary holding key value pairs for contribution inputs.
:type inputs: dict
:param show_on_deleted_work_item: A value indicating if the contribution should be show on deleted workItem.
:type show_on_deleted_work_item: bool
"""
_attribute_map = {
'contribution_id': {'key': 'contributionId', 'type': 'str'},
'height': {'key': 'height', 'type': 'int'},
'inputs': {'key': 'inputs', 'type': '{object}'},
'show_on_deleted_work_item': {'key': 'showOnDeletedWorkItem', 'type': 'bool'}
}
def __init__(self, contribution_id=None, height=None, inputs=None, show_on_deleted_work_item=None):
super(WitContribution, self).__init__()
self.contribution_id = contribution_id
self.height = height
self.inputs = inputs
self.show_on_deleted_work_item = show_on_deleted_work_item
class WorkItemBehavior(Model):
"""WorkItemBehavior.
:param abstract:
:type abstract: bool
:param color:
:type color: str
:param description:
:type description: str
:param fields:
:type fields: list of :class:`WorkItemBehaviorField <work-item-tracking.v4_0.models.WorkItemBehaviorField>`
:param id:
:type id: str
:param inherits:
:type inherits: :class:`WorkItemBehaviorReference <work-item-tracking.v4_0.models.WorkItemBehaviorReference>`
:param name:
:type name: str
:param overriden:
:type overriden: bool
:param rank:
:type rank: int
:param url:
:type url: str
"""
_attribute_map = {
'abstract': {'key': 'abstract', 'type': 'bool'},
'color': {'key': 'color', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'fields': {'key': 'fields', 'type': '[WorkItemBehaviorField]'},
'id': {'key': 'id', 'type': 'str'},
'inherits': {'key': 'inherits', 'type': 'WorkItemBehaviorReference'},
'name': {'key': 'name', 'type': 'str'},
'overriden': {'key': 'overriden', 'type': 'bool'},
'rank': {'key': 'rank', 'type': 'int'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, abstract=None, color=None, description=None, fields=None, id=None, inherits=None, name=None, overriden=None, rank=None, url=None):
super(WorkItemBehavior, self).__init__()
self.abstract = abstract
self.color = color
self.description = description
self.fields = fields
self.id = id
self.inherits = inherits
self.name = name
self.overriden = overriden
self.rank = rank
self.url = url
class WorkItemBehaviorField(Model):
"""WorkItemBehaviorField.
:param behavior_field_id:
:type behavior_field_id: str
:param id:
:type id: str
:param url:
:type url: str
"""
_attribute_map = {
'behavior_field_id': {'key': 'behaviorFieldId', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, behavior_field_id=None, id=None, url=None):
super(WorkItemBehaviorField, self).__init__()
self.behavior_field_id = behavior_field_id
self.id = id
self.url = url
class WorkItemBehaviorReference(Model):
"""WorkItemBehaviorReference.
:param id:
:type id: str
:param url:
:type url: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, id=None, url=None):
super(WorkItemBehaviorReference, self).__init__()
self.id = id
self.url = url
class WorkItemStateResultModel(Model):
"""WorkItemStateResultModel.
:param color:
:type color: str
:param hidden:
:type hidden: bool
:param id:
:type id: str
:param name:
:type name: str
:param order:
:type order: int
:param state_category:
:type state_category: str
:param url:
:type url: str
"""
_attribute_map = {
'color': {'key': 'color', 'type': 'str'},
'hidden': {'key': 'hidden', 'type': 'bool'},
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'order': {'key': 'order', 'type': 'int'},
'state_category': {'key': 'stateCategory', 'type': 'str'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, color=None, hidden=None, id=None, name=None, order=None, state_category=None, url=None):
super(WorkItemStateResultModel, self).__init__()
self.color = color
self.hidden = hidden
self.id = id
self.name = name
self.order = order
self.state_category = state_category
self.url = url
class WorkItemTypeBehavior(Model):
"""WorkItemTypeBehavior.
:param behavior:
:type behavior: :class:`WorkItemBehaviorReference <work-item-tracking.v4_0.models.WorkItemBehaviorReference>`
:param is_default:
:type is_default: bool
:param url:
:type url: str
"""
_attribute_map = {
'behavior': {'key': 'behavior', 'type': 'WorkItemBehaviorReference'},
'is_default': {'key': 'isDefault', 'type': 'bool'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, behavior=None, is_default=None, url=None):
super(WorkItemTypeBehavior, self).__init__()
self.behavior = behavior
self.is_default = is_default
self.url = url
class WorkItemTypeModel(Model):
"""WorkItemTypeModel.
:param behaviors:
:type behaviors: list of :class:`WorkItemTypeBehavior <work-item-tracking.v4_0.models.WorkItemTypeBehavior>`
:param class_:
:type class_: object
:param color:
:type color: str
:param description:
:type description: str
:param icon:
:type icon: str
:param id:
:type id: str
:param inherits: Parent WIT Id/Internal ReferenceName that it inherits from
:type inherits: str
:param is_disabled:
:type is_disabled: bool
:param layout:
:type layout: :class:`FormLayout <work-item-tracking.v4_0.models.FormLayout>`
:param name:
:type name: str
:param states:
:type states: list of :class:`WorkItemStateResultModel <work-item-tracking.v4_0.models.WorkItemStateResultModel>`
:param url:
:type url: str
"""
_attribute_map = {
'behaviors': {'key': 'behaviors', 'type': '[WorkItemTypeBehavior]'},
'class_': {'key': 'class', 'type': 'object'},
'color': {'key': 'color', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'icon': {'key': 'icon', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'inherits': {'key': 'inherits', 'type': 'str'},
'is_disabled': {'key': 'isDisabled', 'type': 'bool'},
'layout': {'key': 'layout', 'type': 'FormLayout'},
'name': {'key': 'name', 'type': 'str'},
'states': {'key': 'states', 'type': '[WorkItemStateResultModel]'},
'url': {'key': 'url', 'type': 'str'}
}
def __init__(self, behaviors=None, class_=None, color=None, description=None, icon=None, id=None, inherits=None, is_disabled=None, layout=None, name=None, states=None, url=None):
super(WorkItemTypeModel, self).__init__()
self.behaviors = behaviors
self.class_ = class_
self.color = color
self.description = description
self.icon = icon
self.id = id
self.inherits = inherits
self.is_disabled = is_disabled
self.layout = layout
self.name = name
self.states = states
self.url = url
| 33.316857 | 223 | 0.608666 | 1 | 2.0376 | [
-0.050720151513814926,
0.0073995040729641914,
0.030626961961388588,
-0.007172785233706236,
-0.018947619944810867,
-0.006224599201232195,
-0.0065190778113901615,
-0.0031651584431529045,
-0.03317194804549217,
0.03556590899825096,
0.026344047859311104,
0.003872893052175641,
0.05626080557703972,
0.000050435330194886774,
-0.02156594768166542,
0.011045506224036217,
0.10013876110315323,
0.0010881139896810055,
-0.02536650374531746,
-0.022507015615701675,
-0.014945940114557743,
-0.03069649450480938,
0.021451396867632866,
0.01478077657520771,
-0.005174749530851841,
-0.01224883459508419,
0.026853566989302635,
-0.013491821475327015,
-0.006009863689541817,
-0.019891412928700447,
-0.03338516876101494,
-0.0423380471765995,
0.04219551011919975,
-0.0015439430717378855,
-0.015289747156202793,
0.010760124772787094,
0.0243942029774189,
-0.048982519656419754,
0.007015111856162548,
0.03671068325638771,
-0.00994677934795618,
-0.015761123970150948,
-0.007770313881337643,
-0.01873254030942917,
0.047102246433496475,
-0.015500468201935291,
-0.013552401214838028,
0.008495562709867954,
-0.016775650903582573,
0.009044842794537544,
-0.036823857575654984,
0.052219219505786896,
0.0004571085446514189,
-0.026051552966237068,
0.0010852564591914415,
-0.060094039887189865,
0.014921748079359531,
0.018492896109819412,
-0.03498167172074318,
0.017355727031826973,
-0.01368704717606306,
0.0013986434787511826,
0.03953832760453224,
0.0021762519609183073,
0.021985789760947227,
-0.018567746505141258,
0.013993597589433193,
0.004294177517294884,
-0.022511286661028862,
-0.03003622405230999,
-0.00031743597355671227,
-0.011588966473937035,
0.0014818941708654165,
0.05798548087477684,
0.004080919083207846,
0.00907581765204668,
-0.04671303927898407,
-0.011096609756350517,
0.008241974748671055,
0.004163348115980625,
-0.015359747223556042,
0.08423491567373276,
0.02187942899763584,
-0.0015743995318189263,
0.003468940267339349,
0.02473411150276661,
0.05137789994478226,
-0.061480507254600525,
0.04721476510167122,
0.020655764266848564,
-0.04821842908859253,
0.04082456976175308,
-0.055569786578416824,
0.012203033082187176,
-0.05859037861227989,
-0.055404722690582275,
0.01731429435312748,
0.015510511584579945,
-0.000910577189642936,
-0.007168111857026815,
0.006733298301696777,
0.013362969271838665,
0.03293704614043236,
0.008715218864381313,
-0.023684632033109665,
-0.015287118963897228,
-0.040014687925577164,
0.010773946531116962,
-0.004527105949819088,
-0.03416326269507408,
-0.038962554186582565,
-0.019315605983138084,
0.030059559270739555,
-0.06567364931106567,
-0.06205599755048752,
-0.04405895248055458,
-0.0017556438688188791,
0.009023665450513363,
-0.037771426141262054,
0.05170455202460289,
-0.01946099102497101,
0.009902816265821457,
-0.008034054189920425,
0.014277108944952488,
-0.01033773459494114,
0.09109222143888474,
-0.0034204779658466578,
-0.014844592660665512,
0.02761010453104973,
-0.00016065302770584822,
-0.002518379595130682,
0.000025290453777415678,
0.036953140050172806,
-0.022036569193005562,
-0.014217556454241276,
0.022409403696656227,
0.028497034683823586,
0.0015922074671834707,
-0.046770334243774414,
0.0037617539055645466,
0.003624572418630123,
-0.05394412949681282,
0.010188913904130459,
-0.010502483695745468,
-0.030412141233682632,
-0.06014173477888107,
-0.011879666708409786,
0.01721545122563839,
-0.025727376341819763,
-0.010614916682243347,
-0.009131941013038158,
0.0366402231156826,
-0.01610848493874073,
-0.013913325034081936,
-0.005653719883412123,
-0.013644751161336899,
-0.030706282705068588,
-0.038394033908843994,
0.0033023611176759005,
0.011976411566138268,
-0.009498410858213902,
0.007281189318746328,
0.0011566204484552145,
0.02513715997338295,
-0.020975172519683838,
0.0874725952744484,
-0.06162086874246597,
0.020922234281897545,
-0.02333657629787922,
0.005586562212556601,
0.019078228622674942,
0.003935312852263451,
-0.013482828624546528,
-0.011108368635177612,
-0.043917931616306305,
0.014820819720625877,
0.03834511712193489,
0.01774103380739689,
0.019105400890111923,
-0.016824370250105858,
0.018159398809075356,
-0.011372633278369904,
0.008892437443137169,
0.024021239951252937,
0.014592241495847702,
-0.008779434487223625,
-0.053194113075733185,
-0.006260347552597523,
-0.020247677341103554,
-0.011399329639971256,
-0.0202572550624609,
0.04039285331964493,
-0.018935922533273697,
-0.029156791046261787,
0.02617061138153076,
-0.020251093432307243,
-0.016252046450972557,
0.07076151669025421,
0.0024664795491844416,
0.04686155915260315,
0.013182922266423702,
-0.014599195681512356,
0.021976521238684654,
0.0006668330170214176,
-0.008220485411584377,
-0.009038042277097702,
-0.6794735789299011,
0.007895860821008682,
0.04541780799627304,
0.004470194224268198,
-0.002659692196175456,
0.024623097851872444,
-0.025718634948134422,
0.02123863808810711,
-0.01973213069140911,
0.001046591904014349,
0.0033166473731398582,
-0.03184456005692482,
-0.033980660140514374,
0.017202869057655334,
-0.0272819921374321,
-0.006336506921797991,
-0.010731194168329239,
-0.025473417714238167,
0.03672250360250473,
0.037302397191524506,
-0.0005723596550524235,
0.0027015800587832928,
-0.022533481940627098,
0.023978743702173233,
-0.02309853583574295,
-0.012917455285787582,
0.034931786358356476,
0.01696588844060898,
0.018770070746541023,
0.005215752404183149,
-0.01858731172978878,
-0.053113099187612534,
0.02647784724831581,
0.00325770303606987,
-0.027494439855217934,
0.0034119768533855677,
-0.02250421606004238,
-0.01803475059568882,
0.07182344049215317,
0.012385323643684387,
-0.01721152476966381,
-0.004450018517673016,
-0.011886144056916237,
-0.054600849747657776,
0.0018747290596365929,
-0.02885577827692032,
-0.04609664902091026,
-0.009691538289189339,
0.024654099717736244,
-0.009927276521921158,
-0.0257171168923378,
0.0642407238483429,
0.03492038697004318,
-0.013675661757588387,
0.020427998155355453,
0.01352870836853981,
-0.010912668891251087,
-0.012545835226774216,
0.012909823097288609,
-0.02095908671617508,
0.04161761328577995,
0.03743169084191322,
-0.018261246383190155,
0.018416494131088257,
0.023146359249949455,
0.01901291124522686,
0.01955648511648178,
-0.04998909682035446,
-0.04133955389261246,
0.04151253029704094,
-0.07302271574735641,
0.011739971116185188,
-0.03687407076358795,
0.08870113641023636,
-0.0051636770367622375,
0.013963134959340096,
0.012235693633556366,
-0.007880127057433128,
-0.031812507659196854,
-0.01489091757684946,
0.02095056138932705,
-0.015378878451883793,
-0.036814939230680466,
0.00029112823540344834,
-0.026672497391700745,
-0.01689865253865719,
0.021632220596075058,
-0.007332467474043369,
0.01827114447951317,
0.026304665952920914,
0.04146945849061012,
0.06963448226451874,
0.014917251653969288,
0.034325286746025085,
0.00004422615165822208,
-0.0020172307267785072,
-0.016788499429821968,
0.0540727935731411,
0.027886971831321716,
0.02478177472949028,
-0.023570075631141663,
0.02879669889807701,
0.009389112703502178,
0.018164850771427155,
-0.01417634543031454,
-0.001577569404616952,
-0.05232356861233711,
-0.007344819605350494,
0.019237762317061424,
0.007379850838333368,
-0.031428076326847076,
-0.010829010047018528,
-0.011750759556889534,
-0.010890434496104717,
-0.03356616199016571,
-0.020407773554325104,
0.01077241450548172,
-0.03585360571742058,
0.027454247698187828,
-0.02106105536222458,
-0.02539321593940258,
-0.011456788517534733,
-0.0019317675614729524,
0.034251127392053604,
0.0008154731476679444,
0.01049026194959879,
-0.0433424636721611,
-0.0002334004529984668,
0.022489644587039948,
0.027673548087477684,
-0.06114668399095535,
-0.0003818247059825808,
-0.03201674669981003,
0.02038615569472313,
0.018377328291535378,
-0.017662860453128815,
-0.034973375499248505,
-0.04583929106593132,
0.026143785566091537,
0.030091406777501106,
-0.012275278568267822,
-0.03060644306242466,
0.020449023693799973,
-0.028130793944001198,
0.018052997067570686,
0.0472416877746582,
-0.011155331507325172,
-0.003902990836650133,
0.016295146197080612,
0.010283823125064373,
0.019122252240777016,
-0.003083960385993123,
0.013389565981924534,
-0.0009210393764078617,
-0.016968049108982086,
-0.001727001741528511,
-0.034669890999794006,
-0.019908057525753975,
0.03808552026748657,
0.02210363745689392,
0.012803925201296806,
-0.0019987875130027533,
0.0016663672868162394,
0.04695797339081764,
0.005233961623162031,
0.015971018001437187,
0.009484216570854187,
0.04655506834387779,
0.04642002657055855,
0.021183596923947334,
0.03769452124834061,
-0.00452592084184289,
0.016777964308857918,
-0.0286604892462492,
-0.029547208920121193,
0.004425335675477982,
-0.018439050763845444,
-0.026972969993948936,
0.024405602365732193,
-0.0037091723643243313,
-0.028914330527186394,
-0.0030340126249939203,
-0.009469046257436275,
0.010218686424195766,
0.01904469169676304,
0.010793422348797321,
0.02226736582815647,
-0.013653839007019997,
0.004878311883658171,
-0.028571851551532745,
0.009624574333429337,
-0.00929089356213808,
-0.00812516175210476,
0.01531784888356924,
-0.05322394520044327,
-0.028075188398361206,
-0.02370833232998848,
0.019474780187010765,
-0.0031880533788353205,
-0.031623952090740204,
0.025064758956432343,
0.01603544130921364,
0.033253900706768036,
-0.0015533160185441375,
0.03778984770178795,
0.08250458538532257,
-0.02477286197245121,
-0.004155686590820551,
0.039708539843559265,
-0.022438691928982735,
0.013305320404469967,
-0.01147873792797327,
0.0017112531932070851,
-0.0032103518024086952,
-0.0257834754884243,
-0.007751201279461384,
-0.033454958349466324,
-0.0326593853533268,
0.0132453553378582,
-0.05774702876806259,
-0.01815597526729107,
-0.014895869418978691,
0.05655234307050705,
0.007792328950017691,
0.008586995303630829,
-0.012827785685658455,
-0.03662976995110512,
0.025945108383893967,
0.015245141461491585,
0.000797154672909528,
0.03323785215616226,
0.018053371459245682,
-0.007257101591676474,
-0.02741759642958641,
-0.012452498078346252,
0.002225167816504836,
-0.015348485670983791,
-0.05008317157626152,
-0.029556674882769585,
-0.043161146342754364,
-0.0057543604634702206,
-0.029455110430717468,
0.006407099775969982,
0.05621485039591789,
0.007600846700370312,
0.00867658481001854,
-0.014053795486688614,
-0.002000486245378852,
-0.02317047491669655,
-0.023326341062784195,
-0.028346873819828033,
0.02711719274520874,
-0.01936054416000843,
0.010490912944078445,
-0.0019077525939792395,
-0.0033951036166399717,
-0.024765226989984512,
0.0038055418990552425,
0.017224857583642006,
0.010816044174134731,
-0.006141945719718933,
-0.004627760965377092,
-0.014499830082058907,
0.035151783376932144,
-0.024033498018980026,
0.027620645239949226,
0.010091278702020645,
0.006193517241626978,
0.015345022082328796,
0.05418232083320618,
0.010319375433027744,
-0.011428327299654484,
-0.021304162219166756,
0.0028123247902840376,
-0.022927723824977875,
-0.029009368270635605,
-0.00692340824753046,
-0.036458976566791534,
0.018099067732691765,
0.019516481086611748,
0.004579707980155945,
-0.01345654483884573,
0.015324673615396023,
0.023330556228756905,
-0.018097680062055588,
0.0088124368339777,
-0.02431226521730423,
-0.00812146533280611,
-0.04332708567380905,
0.005685352720320225,
-0.008096971549093723,
-0.026693854480981827,
0.03331352025270462,
-0.011523698456585407,
-0.04583939537405968,
0.007608470506966114,
-0.03618437796831131,
0.011817234568297863,
0.03380448743700981,
0.01213952898979187,
0.029542364180088043,
0.0054049803875386715,
-0.006313866004347801,
-0.026644522324204445,
0.01715877093374729,
-0.02570488303899765,
0.023466546088457108,
-0.022761208936572075,
0.03622948378324509,
-0.00035496102645993233,
0.0009131403057835996,
0.020071621984243393,
0.02390110306441784,
0.0009360049152746797,
0.024149090051651,
-0.0015578159363940358,
0.007996653206646442,
0.0271522868424654,
0.009221527725458145,
-0.015164388343691826,
-0.014980828389525414,
0.04394989088177681,
-0.01847047545015812,
-0.01283017173409462,
0.004413898102939129,
-0.03224048763513565,
-0.03194474056363106,
-0.010347000323235989,
-0.01427539624273777,
-0.004046277143061161,
0.005637054797261953,
0.002757833106443286,
-0.018820835277438164,
0.024893339723348618,
0.005681364331394434,
-0.009433681145310402,
0.02067115344107151,
0.03451388329267502,
0.031123697757720947,
-0.0103547228500247,
-0.02592935971915722,
-0.012785625644028187,
-0.033171188086271286,
-0.0024804186541587114,
0.021610263735055923,
0.011121132411062717,
0.000482666480820626,
0.02817399986088276,
0.034598760306835175,
0.0028497138991951942,
0.014765270054340363,
-0.013461723923683167,
0.003285139799118042,
-0.003991610370576382,
-0.012997685931622982,
-0.006003310903906822,
-0.013947801664471626,
-0.012690065428614616,
0.00018387471209280193,
0.024584699422121048,
-0.0037337904796004295,
0.020319513976573944,
0.013836686499416828,
-0.0017691486282274127,
0.009982854127883911,
-0.030823370441794395,
0.05984923616051674,
0.024210652336478233,
-0.00276702712289989,
0.03420385345816612,
0.002529340796172619,
-0.022475987672805786,
-0.009016710333526134,
0.0012771494220942259,
-0.002995446091517806,
0.007922617718577385,
0.053164348006248474,
-0.008608400821685791,
-0.0146100465208292,
-0.02412385866045952,
0.009579973295331001,
-0.019328681752085686,
0.0026715691201388836,
-0.007009900640696287,
0.015125599689781666,
-0.014887780882418156,
-0.013837127946317196,
0.012446604669094086,
-0.005264393053948879,
-0.05078606307506561,
0.0026162290014326572,
0.0015534983249381185,
0.039294831454753876,
0.03356153517961502,
0.019008798524737358,
-0.017233403399586678,
-0.0031887569930404425,
0.01271443534642458,
-0.00014723429922014475,
-0.0159006267786026,
0.012449726462364197,
0.02189500443637371,
-0.0006480027223005891,
0.008308086544275284,
0.02956504002213478,
0.013960693962872028,
0.005734608508646488,
-0.025717876851558685,
-0.0021584767382591963,
0.0056378524750471115,
0.01660083793103695,
0.021183470264077187,
-0.00005619111470878124,
-0.00235129171051085,
-0.026727434247732162,
-0.0016161869280040264,
-0.011113572865724564,
-0.019861288368701935,
-0.01852482557296753,
0.012427641078829765,
-0.023467127233743668,
-0.013914135284721851,
-0.003902147291228175,
0.0038653737865388393,
-0.018112655729055405,
0.0009162830538116395,
0.01702096499502659,
0.029228568077087402,
-0.010550460778176785,
0.029555700719356537,
0.007779943291097879,
0.03409756347537041,
-0.03819289803504944,
-0.021388323977589607,
0.00976785272359848,
-0.0205672737210989,
-0.009100672788918018,
-0.015127497725188732,
-0.03217712417244911,
0.004564211238175631,
-0.028120610862970352,
-0.012858479283750057,
0.029563048854470253,
0.009789071045815945,
-0.01412602886557579,
0.015916505828499794,
0.014794536866247654,
0.010896081104874611,
0.01579451933503151,
-0.007670669350773096,
-0.001418013242073357,
-0.0017427160637453198,
0.03190363571047783,
0.015974286943674088,
0.02097196690738201,
-0.02433168701827526,
0.021298013627529144,
0.016077617183327675,
0.00020283550838939846,
0.03490065410733223,
-0.011471635662019253,
0.005177768412977457,
-0.05396091192960739,
0.046044185757637024,
0.06039801612496376,
0.008017556741833687,
0.03648956120014191,
-0.021467309445142746,
-0.007708249147981405,
-0.006830256432294846,
-0.05110970884561539,
-0.007547736167907715,
-0.0053834072314202785,
0.008843629620969296,
-0.043142735958099365,
-0.01720750890672207,
-0.0152169493958354,
-0.0001459935592720285,
0.002694154856726527,
0.008666184730827808,
-0.01622895710170269,
0.0184532068669796,
0.0041968985460698605,
0.006661994848400354,
-0.014447309076786041,
-0.0004832226550206542,
-0.027662277221679688,
0.0812436193227768,
-0.010817290283739567,
0.028662407770752907,
-0.019625281915068626,
-0.01752150058746338,
0.003586978418752551,
0.06600698828697205,
0.02009090594947338,
-0.012971398420631886,
0.025039728730916977,
-0.006967081222683191,
0.04270580783486366,
0.004606356378644705,
-0.038650523871183395,
-0.020305098965764046,
0.005154920741915703,
-0.006437128409743309,
-0.005332852713763714,
0.019370315596461296,
0.11128309369087219,
0.04986124485731125,
-0.02132180519402027,
-0.03169325739145279,
-0.023876583203673363,
-0.03289853036403656,
-0.02284293994307518,
0.0142285181209445,
0.03079207055270672,
-0.011707676574587822,
0.0180557481944561,
-0.050989240407943726,
-0.011416645720601082,
-0.00022306572645902634,
-0.014438353478908539,
0.021510427817702293,
0.007994679734110832,
-0.002130916342139244,
-0.04156061261892319,
0.012871690094470978,
-0.03514541685581207,
-0.03824827820062637,
-0.004346315748989582,
0.0036977403797209263,
-0.016092399135231972,
-0.006990766618400812,
-0.003561084857210517,
-0.001694007427431643,
0.012580039910972118,
-0.03323223441839218,
0.03277783468365669,
0.052581291645765305,
-0.014695903286337852,
-0.011575102806091309,
0.06643106043338776,
-0.006102946121245623,
0.006294229067862034,
-0.025714779272675514,
-0.015758279711008072,
-0.025898737832903862,
-0.0029301471076905727,
0.0008815170149318874,
0.00510806031525135,
0.04356468468904495,
-0.010971901938319206,
-0.007087512873113155,
-0.0034340552520006895,
0.018794642761349678,
-0.047261156141757965,
0.04091968387365341,
-0.011975876986980438,
-0.008347517810761929,
-0.03786317631602287,
-0.07836398482322693,
0.0017837894847616553,
-0.012594697996973991
] |
8a56af27e9c2f89056b41302d904e7b48a70d0c4 | 1,379 | py | Python | responder.py | ziggyzacks/pyrecs | 06e760aad4b49a62322f1d46660c52c81eeb1b11 | [
"MIT"
] | 2 | 2018-03-21T17:55:57.000Z | 2018-03-21T17:56:00.000Z | responder.py | ziggyzacks/pyrecs | 06e760aad4b49a62322f1d46660c52c81eeb1b11 | [
"MIT"
] | null | null | null | responder.py | ziggyzacks/pyrecs | 06e760aad4b49a62322f1d46660c52c81eeb1b11 | [
"MIT"
] | null | null | null | import abc
from utils import LogMixin
class Reponse(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def redis(self):
""" redis connection """
return
@abc.abstractmethod
def fetch(self, ids):
""" hydrate relevant ids with data """
return
class Movies(Reponse, LogMixin):
DEFAULT_FIELDS = ['title', 'year', 'genres']
def __init__(self, **kwargs):
super().__init__()
for key, value in kwargs.items():
setattr(self, key, value)
def fetch(self, movies, fields=None, from_index=False):
""" hydrates class ids with metadata, return redis pipeline that must be executed """
if fields is None:
fields = Movies.DEFAULT_FIELDS
if from_index:
movies = self.redis.mget(('inverse:index:movie:{}'.format(idx) for idx in movies))
response = []
for movie in movies:
values = self.redis.hmget('movie:{}'.format(movie), fields)
obj = dict(zip(fields, values))
if 'genres' in obj:
obj['genres'] = obj['genres'].split(',')
if 'year' in obj:
obj['year'] = int(obj['year'])
response.append(obj)
return response
def movie_to_index(self, movies):
return self.redis.mget(('index:movie:{}'.format(m) for m in movies))
| 28.729167 | 94 | 0.57723 | 1 | 1.0791 | [
-0.00020957225933670998,
0.02402142994105816,
0.007499913219362497,
0.00042276011663489044,
0.004187678452581167,
-0.003327657002955675,
-0.01168137602508068,
0.004207245074212551,
-0.005588854663074017,
0.005128424149006605,
0.0022009212989360094,
0.005586457438766956,
0.007563505321741104,
-0.014947217889130116,
0.0011689594248309731,
0.016468867659568787,
-0.05273031070828438,
0.005278993397951126,
-0.005391379352658987,
0.0008511641062796116,
-0.009032181464135647,
0.010116302408277988,
0.009891711175441742,
0.008314552716910839,
0.005403244402259588,
0.0018544167978689075,
0.010050099343061447,
0.004914227873086929,
-0.007861905731260777,
-0.005061229690909386,
-0.000021190920961089432,
-0.0011361025972291827,
-0.0021383848506957293,
-0.007557831238955259,
0.007114315405488014,
-0.004130419809371233,
-0.0015460547292605042,
-0.021705539897084236,
0.00853718165308237,
-0.005979421082884073,
-0.007589790970087051,
-0.015631601214408875,
-0.004619283601641655,
0.0040167104452848434,
-0.01172562688589096,
0.0021464021410793066,
-0.005255921743810177,
0.004997297655791044,
-0.009380949661135674,
0.006164730526506901,
-0.008639995940029621,
0.006126150954514742,
0.01300141867250204,
0.0007148453732952476,
-0.005282634403556585,
-0.007766235154122114,
0.013917943462729454,
0.0018413299694657326,
-0.010592455044388771,
-0.0009152675047516823,
-0.0038334359414875507,
-0.0034793356899172068,
0.006574086379259825,
0.003516283817589283,
-0.01787206158041954,
-0.00792049802839756,
-0.00403609499335289,
0.0020835697650909424,
-0.0021585319191217422,
0.0059519303031265736,
0.0004518851055763662,
-0.0021831647027283907,
0.006990517023950815,
0.0065288362093269825,
0.004336065147072077,
-0.0045111654326319695,
-0.00031727258465252817,
0.001634168904274702,
0.010003776289522648,
0.005962308030575514,
0.003307539504021406,
-0.008259424939751625,
0.0067472392693161964,
0.01138666644692421,
0.016357289627194405,
0.009471530094742775,
0.020199671387672424,
-0.013167795725166798,
0.04616096615791321,
0.005683849100023508,
-0.011198887601494789,
0.0005313451983965933,
-0.009964760392904282,
-0.0020035093184560537,
-0.0034231403842568398,
-0.029690958559513092,
-0.0003097893495578319,
-0.006405985448509455,
0.0003607155231293291,
0.004795541055500507,
-0.0010070252465084195,
0.005185307469218969,
-0.0013423938071355224,
-0.0014693746343255043,
-0.009788761846721172,
0.014630002900958061,
-0.01058500912040472,
-0.0027118471916764975,
0.006980516482144594,
0.0017214678227901459,
-0.011003007180988789,
-0.0024200992193073034,
0.0008616833365522325,
-0.010541011579334736,
0.004794570151716471,
0.0025142375379800797,
-0.0065880510956048965,
0.05549883842468262,
-0.001301789889112115,
0.00525495084002614,
-0.0058176517486572266,
-0.0010889422846958041,
0.0004236311942804605,
0.005860183387994766,
0.008662442676723003,
-0.0038522426038980484,
0.011871114373207092,
0.007644315250217915,
0.002228021854534745,
0.007972653023898602,
0.0002587858180049807,
0.010615590028464794,
-0.006013327743858099,
-0.002238454297184944,
-0.0016122811939567327,
-0.009366292506456375,
0.005302878562361002,
-0.0009202715591527522,
-0.005703480914235115,
0.0025495574809610844,
-0.00017194580868817866,
-0.012600898742675781,
0.0014099044492468238,
-0.00455920584499836,
0.0012039134744554758,
-0.013361332006752491,
-0.0032756063155829906,
-0.0031543804798275232,
-0.006110376212745905,
0.0018454876262694597,
0.006293133832514286,
0.003968164324760437,
0.0008459378150291741,
-0.004135326016694307,
-0.007192044518887997,
-0.0001226203894475475,
-0.005707923788577318,
0.0009517577709630132,
0.007536302320659161,
0.0030432522762566805,
-0.009803496301174164,
-0.00042982405284419656,
0.00408573541790247,
0.004860731307417154,
-0.0007640965050086379,
0.004699640441685915,
-0.007047703023999929,
0.008916598744690418,
0.0017561368877068162,
0.0038428870029747486,
0.00999603420495987,
-0.004625741858035326,
-0.0013022132916375995,
-0.00023966720618773252,
0.003332951106131077,
-0.0003314011846669018,
0.004643348976969719,
0.010963333770632744,
-0.006477272137999535,
-0.006246465258300304,
0.004293686244636774,
0.002643283922225237,
0.009606977924704552,
0.008372957818210125,
-0.0024749943986535072,
0.004330837167799473,
-0.0064656734466552734,
-0.0022965832613408566,
0.004036625847220421,
-0.007080696057528257,
0.0048881652764976025,
0.007458298932760954,
-0.01407560147345066,
-0.006812611129134893,
0.0006964355707168579,
-0.011805783957242966,
0.0019578782375901937,
0.01663948781788349,
0.009855314157903194,
-0.00278286961838603,
0.0035004103556275368,
-0.009107950143516064,
-0.000342653103871271,
0.007354764733463526,
0.0010767416097223759,
-0.012603766284883022,
-0.9565160870552063,
0.005295595154166222,
0.003270243527367711,
-0.0006567727541550994,
0.004861239343881607,
0.0017825012328103185,
0.002921375911682844,
0.003524248953908682,
0.013874996453523636,
-0.01145622693002224,
-0.007444418966770172,
-0.010854799300432205,
-0.010491235181689262,
-0.000035216882679378614,
-0.008096478879451752,
-0.0018368784803897142,
-0.005943293683230877,
-0.008552971296012402,
-0.0015478743007406592,
-0.0033093320671468973,
0.0007894684094935656,
0.006640573963522911,
0.0017503640847280622,
0.00426517566666007,
0.004023128654807806,
0.00511816143989563,
-0.0033462494611740112,
-0.002162473974749446,
0.00012823136057704687,
-0.002397616859525442,
-0.009869232773780823,
-0.014339527115225792,
-0.004981926176697016,
-0.0025039513129740953,
0.011782325804233551,
-0.0002887034206651151,
0.007945440709590912,
-0.002394023584201932,
0.0029781144112348557,
-0.008855980820953846,
0.0056154727935791016,
-0.0012583862990140915,
0.005536629818379879,
-0.02904195338487625,
0.0007950943545438349,
-0.002972677815705538,
-0.009859391488134861,
0.010521531105041504,
0.002630047732964158,
0.0010091487783938646,
-0.004432175774127245,
-0.004293250385671854,
0.00852462649345398,
-0.005293228663504124,
0.004011186771094799,
-0.007149396929889917,
-0.005357949063181877,
-0.003018683521077037,
-0.009743353351950645,
0.0014165679458528757,
0.005867811385542154,
-0.002832091646268964,
-0.005775576923042536,
-0.003602118231356144,
0.001811204943805933,
0.00388304959051311,
0.004563491325825453,
-0.019412392750382423,
-0.006076690275222063,
-0.0004023585934191942,
0.005549252964556217,
-0.001606693142093718,
-0.0038894936442375183,
0.006073924247175455,
-0.010433124378323555,
0.006876430474221706,
0.004041146952658892,
0.003982009831815958,
-0.0101445522159338,
0.0019702245481312275,
-0.008995008654892445,
-0.009813901036977768,
0.0024996837601065636,
-0.006162426900118589,
-0.0037387872580438852,
-0.0012062359601259232,
0.003548606764525175,
0.008542233146727085,
-0.0038239676505327225,
0.004206276033073664,
0.01059636753052473,
-0.004481341224163771,
-0.011411143466830254,
0.007832190953195095,
0.008335213176906109,
0.0017693063709884882,
-0.002684810431674123,
0.0031115850433707237,
0.008313574828207493,
0.005978723987936974,
0.0025636274367570877,
0.006308250594884157,
0.000948338012676686,
0.011728626675903797,
0.0016164203407242894,
0.0052597313188016415,
-0.005259807221591473,
0.000014602681403630413,
-0.005056433379650116,
-0.002389020286500454,
-0.005000761244446039,
-0.0013508663978427649,
-0.014260168187320232,
-0.009557235054671764,
-0.003629057900980115,
0.0013318568235263228,
0.0007257102988660336,
-0.004428107291460037,
-0.0022481961641460657,
0.0026871110312640667,
0.009612551890313625,
-0.0018787920707836747,
-0.0040816799737513065,
0.0012058637803420424,
0.0038931078743189573,
-0.008915957063436508,
0.013590831309556961,
-0.01306063961237669,
0.008467249572277069,
-0.0011174617102369666,
-0.015438717789947987,
0.0073903282172977924,
0.010174817405641079,
-0.007514534052461386,
0.003992762416601181,
0.00015341238758992404,
0.0035187152680009604,
-0.0005138997221365571,
-0.004604433663189411,
-0.0042037200182676315,
-0.017077088356018066,
-0.0024167040828615427,
0.02098962664604187,
0.0034744420554488897,
0.012529577128589153,
0.01136727910488844,
-0.0033017287496477365,
0.00414530374109745,
0.005724946968257427,
0.0018440993735566735,
0.012257762253284454,
-0.009533191099762917,
-0.0005092576611787081,
0.0011368573177605867,
-0.005494249518960714,
0.0021718847565352917,
0.004856040235608816,
0.00426412234082818,
-0.002703950274735689,
0.0012158268364146352,
-0.006907326634973288,
-0.004249220713973045,
-0.017160406336188316,
0.0012711015297099948,
0.009881249628961086,
-0.004252698738127947,
0.0069921910762786865,
-0.010482077486813068,
0.0054815043695271015,
0.006938253995031118,
0.0032402395736426115,
0.0006906776688992977,
-0.0009374386863783002,
0.005142064765095711,
0.010904052294790745,
-0.006721336394548416,
0.005167985800653696,
0.0036748715210705996,
0.0008191438391804695,
0.003503246698528528,
0.008824837394058704,
-0.00914087239652872,
-0.005449165124446154,
0.002579137682914734,
0.002026585629209876,
-0.0013107974082231522,
-0.004199214745312929,
-0.008916749618947506,
-0.002746113110333681,
0.003443672088906169,
-0.0061658532358706,
0.005462256260216236,
0.0020812239963561296,
0.004343562293797731,
-0.008737638592720032,
-0.000870813149958849,
-0.004467636346817017,
-0.01035714615136385,
0.00918505061417818,
-0.0035727331414818764,
0.004637810401618481,
0.01233229786157608,
0.003430817974731326,
-0.014430654235184193,
0.007018521893769503,
0.006789013277739286,
-0.002823823131620884,
0.0033083257731050253,
0.0071127633564174175,
-0.006052620708942413,
-0.021829545497894287,
-0.0015003257431089878,
-0.014926102012395859,
0.007855876348912716,
-0.003302384167909622,
0.003685359377413988,
-0.00690010329708457,
0.006781585048884153,
0.00600231671705842,
-0.01480734720826149,
-0.0033279869239777327,
-0.007604330778121948,
0.009534114971756935,
0.0011187534546479583,
-0.0016387643991038203,
-0.003149252850562334,
-0.0032750163227319717,
-0.0032907272689044476,
-0.002162846038118005,
-0.0010588099248707294,
0.006174953654408455,
0.0015572457341477275,
-0.0038074119947850704,
0.0023831194266676903,
-0.004960717633366585,
0.00028616207418963313,
-0.00009205067181028426,
-0.010969020426273346,
0.0014250996755436063,
0.004410354420542717,
-0.002245493931695819,
-0.001454627956263721,
-0.0011392920278012753,
-0.0027890175115317106,
-0.006329631432890892,
-0.012316628359258175,
-0.004816787783056498,
-0.005049796774983406,
-0.003730348777025938,
-0.009338976815342903,
-0.003132805461063981,
-0.009783711284399033,
0.005584311671555042,
-0.0073796045035123825,
0.005111708305776119,
0.006456669885665178,
-0.0047248899936676025,
0.0063089411705732346,
-0.000907442532479763,
0.0041842288337647915,
0.003924245480448008,
0.006485374644398689,
-0.002455458976328373,
-0.007522848434746265,
-0.008522357791662216,
0.010492337867617607,
-0.007621922995895147,
-0.00016314181266352534,
0.014902684837579727,
0.002689383691176772,
0.007774827070534229,
0.0006742493133060634,
-0.0019017838640138507,
0.001366802491247654,
0.007790527306497097,
-0.0136477155610919,
0.005037303548306227,
-0.002664582571014762,
-0.001085471361875534,
0.005507329478859901,
-0.004876714199781418,
0.001650544349104166,
0.007266261149197817,
0.0029410654678940773,
-0.00778342317789793,
-0.0013869913527742028,
0.0022770497016608715,
0.004897961392998695,
-0.011143376119434834,
-0.0006876006373204291,
-0.004486296325922012,
-0.005694663617759943,
-0.003494840580970049,
-0.0031697426456958055,
-0.0008902027038857341,
0.004347970709204674,
-0.002476604888215661,
0.006734075956046581,
0.0020355130545794964,
-0.005354538559913635,
0.014651344157755375,
-0.00534994387999177,
-0.0043035042472183704,
0.003490298753604293,
0.0017214155523106456,
-0.004790518432855606,
-0.008208736777305603,
-0.0012357059167698026,
0.0019958687480539083,
0.004091092851012945,
-0.0014369775308296084,
-0.006738977041095495,
-0.002895553130656481,
0.0019049305701628327,
-0.008677595295011997,
0.001931725419126451,
0.010828978382050991,
-0.0009514258126728237,
0.004462274257093668,
-0.00035538460360839963,
-0.00938619114458561,
-0.01528851967304945,
0.05607898160815239,
-0.0036709678824990988,
0.0042085484601557255,
0.0055931066162884235,
-0.008405639789998531,
0.000021911366275162436,
-0.00323090679012239,
0.008327470161020756,
-0.007758138235658407,
-0.0073961555026471615,
0.007189922966063023,
-0.002846586052328348,
0.004117809236049652,
0.0030098669230937958,
-0.0031914033461362123,
0.01530257798731327,
-0.008573494851589203,
-0.015623221173882484,
-0.01658651977777481,
0.009274820797145367,
-0.00256749358959496,
-0.006576834712177515,
0.008584078401327133,
0.000475172302685678,
-0.005863219033926725,
0.0005702755297534168,
0.006337351631373167,
0.0007896689930930734,
-0.00015823384455870837,
-0.0045541031286120415,
-0.0033452387433499098,
-0.0008097029640339315,
0.0037834022659808397,
0.005595022346824408,
0.00790515448898077,
-0.002637697383761406,
0.0032473851460963488,
-0.002898785751312971,
-0.0012775189243257046,
0.0013191926991567016,
0.004224967211484909,
0.007722865324467421,
0.001398084918037057,
-0.0007397173321805894,
0.0046977391466498375,
0.004388791974633932,
0.0006275271298363805,
0.01324029266834259,
0.0005826799897477031,
-0.0059539698995649815,
0.009296143427491188,
0.009138003922998905,
-0.0009033599053509533,
0.007442777045071125,
-0.0007939391653053463,
0.006057098973542452,
0.0013423413038253784,
-0.00777494627982378,
-0.01630483940243721,
0.00041842664359137416,
0.005935330875217915,
0.007431446108967066,
-0.0036734328605234623,
0.0018432654906064272,
-0.0031880182214081287,
-0.0027055293321609497,
-0.007326350547373295,
-0.006912858225405216,
-0.0047038858756423,
0.0016985393594950438,
0.0029757837764918804,
0.07251863926649094,
-0.007681691087782383,
-0.003988028038293123,
-0.0111703397706151,
-0.0003790405753534287,
-0.002642981940880418,
-0.0014365296810865402,
0.0008359495550394058,
0.0017193128587678075,
0.0020579935517162085,
0.000007546476354036713,
-0.009376121684908867,
-0.011049140244722366,
0.0036539360880851746,
0.0028671545442193747,
-0.003943928051739931,
0.0056172143667936325,
0.0038917677011340857,
-0.007190741132944822,
0.0030504504684358835,
-0.010313848964869976,
-0.0022921611089259386,
-0.004497069865465164,
-0.007392198778688908,
-0.0031895635183900595,
-0.003951372113078833,
0.003098386339843273,
0.0041297185234725475,
0.006611539050936699,
-0.003799092024564743,
0.007241401821374893,
-0.0015081840101629496,
-0.00022582490055356175,
-0.0030697479378432035,
-0.0005140993744134903,
-0.007287982851266861,
0.008045986294746399,
0.001713294885121286,
-0.009422282688319683,
-0.004260174930095673,
-0.0019822195172309875,
-0.0005703839706256986,
-0.005375882610678673,
0.003394361585378647,
0.002328387927263975,
0.0074712433852255344,
-0.0040908083319664,
0.0011679911985993385,
-0.005264129489660263,
0.001930634374730289,
-0.012255202047526836,
0.0020041479729115963,
-0.17758721113204956,
0.007927559316158295,
0.002817542990669608,
-0.005489918868988752,
-0.0028134507592767477,
-0.014700383879244328,
-0.008294504135847092,
0.0032073219772428274,
0.00885690376162529,
0.0003544503706507385,
-0.0016943779774010181,
-0.003140775253996253,
0.00558182317763567,
0.003939306363463402,
-0.0002225101343356073,
-0.005123580805957317,
0.004652123432606459,
-0.006437006872147322,
-0.00021539998124353588,
0.00394391780719161,
0.005666528362780809,
0.009447920136153698,
0.00043277133954688907,
0.002085427287966013,
-0.0008572741062380373,
-0.0018060547299683094,
0.0068434071727097034,
-0.003807295113801956,
0.004767121747136116,
-0.011967094615101814,
-0.003849486820399761,
-0.00526207871735096,
-0.003483052831143141,
0.005460438784211874,
0.002615501871332526,
-0.00032038113567978144,
0.009102534502744675,
0.004142299294471741,
-0.008227506652474403,
0.007512541953474283,
-0.007945287972688675,
0.028463328257203102,
0.006586922332644463,
0.008794435299932957,
0.0015316865174099803,
-0.00554942712187767,
-0.003072305815294385,
0.005885483231395483,
0.0019349951762706041,
0.011118710041046143,
-0.014326507225632668,
-0.002751740161329508,
0.000675463117659092,
0.01906866393983364,
-0.005899978801608086,
-0.009191027842462063,
-0.007003549952059984,
-0.00273114163428545,
0.005667674355208874,
0.007275963202118874,
0.010200399905443192,
-0.00321177882142365,
0.004684138111770153,
-0.003670731093734503,
-0.023073695600032806,
0.0031490165274590254,
-0.00046135534648783505,
-0.00698896823450923,
0.000039649417885812,
0.007729276083409786,
0.008126754313707352,
-0.00026863181847147644,
0.003781931707635522,
0.0008524483419023454,
0.0043464102782309055,
-0.001405468792654574,
0.006869675125926733,
-0.0036984668113291264,
0.0053735049441456795,
-0.008100925013422966,
0.011022089049220085,
-0.01052658911794424,
-0.0025883980561047792,
0.0024708514101803303,
-0.0039131599478423595,
0.013386478647589684,
0.00428610946983099,
-0.0024024429731070995,
0.0014032386243343353,
-0.010274622589349747,
-0.00007714890671195462,
0.003346038516610861,
0.003595384769141674,
-0.00706275412812829,
0.0004475396708585322,
-0.00009938960283761844,
0.003355116816237569,
0.007363726384937763,
-0.00725540891289711,
0.005785755813121796,
0.004665753338485956,
-0.0051056742668151855,
-0.000617971527390182,
-0.004604250658303499,
0.0014256163267418742,
0.005586925894021988,
-0.007242599967867136,
-0.0077400002628564835,
0.004156604874879122,
-0.00399002805352211,
-0.007403547875583172,
0.006066090427339077,
-0.009987560100853443,
-0.009073885157704353,
-0.002308059949427843,
-0.012263908050954342,
0.001972170313820243
] |
8a56cef3b3f2ca89cec426bc77ad6809415c305d | 1,327 | bzl | Python | python/library.bzl | robfig/rules_proto | 6a85b0e4c3eeddf8863890ef48f2daab7a524ab7 | [
"Apache-2.0"
] | null | null | null | python/library.bzl | robfig/rules_proto | 6a85b0e4c3eeddf8863890ef48f2daab7a524ab7 | [
"Apache-2.0"
] | null | null | null | python/library.bzl | robfig/rules_proto | 6a85b0e4c3eeddf8863890ef48f2daab7a524ab7 | [
"Apache-2.0"
] | null | null | null | load("//python:compile.bzl", "py_proto_compile", "py_grpc_compile")
load("@grpc_py_deps//:requirements.bzl", "all_requirements")
def py_proto_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
verbose = kwargs.get("verbose")
visibility = kwargs.get("visibility")
name_pb = name + "_pb"
py_proto_compile(
name = name_pb,
deps = deps,
visibility = visibility,
verbose = verbose,
)
native.py_library(
name = name,
srcs = [name_pb],
deps = all_requirements, # fixme don't need grpc here
# This magically adds REPOSITORY_NAME/PACKAGE_NAME/{name_pb} to PYTHONPATH
imports = [name_pb],
visibility = visibility,
)
def py_grpc_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
verbose = kwargs.get("verbose")
visibility = kwargs.get("visibility")
name_pb = name + "_pb"
py_grpc_compile(
name = name_pb,
deps = deps,
visibility = visibility,
verbose = verbose,
)
native.py_library(
name = name,
srcs = [name_pb],
deps = all_requirements,
# This magically adds REPOSITORY_NAME/PACKAGE_NAME/{name_pb} to PYTHONPATH
imports = [name_pb],
visibility = visibility,
) | 28.847826 | 82 | 0.609646 | 1 | 1.0881 | [
0.00011482246918603778,
0.025293266400694847,
0.008568056859076023,
0.0024172367993742228,
0.0035771247930824757,
-0.0017923197010532022,
-0.00983947142958641,
0.0013178017688915133,
-0.005835187621414661,
0.0029230895452201366,
0.0020982956048101187,
0.005240630358457565,
0.008125077933073044,
-0.01621388830244541,
0.0003521805920172483,
0.01764282025396824,
-0.050279345363378525,
0.0014589959755539894,
-0.002053258242085576,
0.0015655140159651637,
-0.006982147227972746,
0.009507625363767147,
0.007613764610141516,
0.008123140782117844,
0.009335201233625412,
-0.0023317851591855288,
0.01167283859103918,
0.0046313973143696785,
-0.009350040927529335,
-0.008051629178225994,
-0.002704380312934518,
-0.0002765977696981281,
-0.004988068714737892,
-0.009082678705453873,
0.004499243106693029,
-0.0058260648511350155,
-0.0005704953800886869,
-0.0181479062885046,
0.010290410369634628,
-0.0073381285183131695,
-0.007362182717770338,
-0.012405375018715858,
-0.0006603999645449221,
0.00652887299656868,
-0.008849662728607655,
0.0005014131893403828,
-0.004540863446891308,
0.0040558273904025555,
-0.01125358510762453,
0.007572320755571127,
-0.0090008694678545,
0.009640474803745747,
0.0146378418430686,
-0.00013050345296505839,
-0.007305566221475601,
-0.004406264051795006,
0.01343045849353075,
0.0021702731028199196,
-0.013295217417180538,
-0.00010777832358144224,
-0.003493993077427149,
-0.0012087173527106643,
0.006448596715927124,
0.004582773428410292,
-0.01955534517765045,
-0.007414250168949366,
-0.002229056553915143,
0.005399823654443026,
-0.002266725292429328,
0.004418267402797937,
-0.0020065526477992535,
-0.00267858081497252,
0.008799271658062935,
0.007409302052110434,
0.007803845219314098,
-0.0020127492025494576,
-0.0005276889423839748,
-0.0009184280061163008,
0.007353808730840683,
0.0013985451078042388,
0.004652267787605524,
-0.007295243442058563,
0.0049430932849645615,
0.011993992142379284,
0.01545544434338808,
0.01173686608672142,
0.016516439616680145,
-0.014896863140165806,
0.044816628098487854,
0.007037371397018433,
-0.01261819712817669,
0.002379627199843526,
-0.00956672616302967,
-0.00733494246378541,
-0.007284210994839668,
-0.027084678411483765,
0.0015700021758675575,
-0.004825562704354525,
0.000529093318618834,
0.0014853833708912134,
0.0007725809118710458,
0.009086770005524158,
-0.0015974397538229823,
-0.0041167777962982655,
-0.011929246596992016,
0.014906518161296844,
-0.008755550719797611,
-0.0021245914977043867,
0.01000881940126419,
0.0030422210693359375,
-0.012041324749588966,
-0.0041364263743162155,
0.00022421302855946124,
-0.01275929156690836,
0.0010648947209119797,
0.004181709606200457,
-0.009651508182287216,
0.05249727889895439,
0.0018065869808197021,
0.00678282929584384,
-0.003929708618670702,
0.002484273398295045,
0.0013532360317185521,
0.007260528393089771,
0.008855555206537247,
-0.00151174352504313,
0.012518861331045628,
0.0047559114173054695,
-0.0005806363187730312,
0.006891388446092606,
-0.00032085212296806276,
0.00452242698520422,
-0.003100954694673419,
-0.0005860739038325846,
0.0020564752630889416,
-0.004356918856501579,
0.009588878601789474,
-0.001366402953863144,
-0.010299739427864552,
0.0007985258125700057,
-0.004147273954004049,
-0.011122602969408035,
0.0008553826482966542,
-0.004550951533019543,
0.0033214427530765533,
-0.012370482087135315,
-0.002171384636312723,
-0.003952067345380783,
-0.005268789362162352,
0.0015062113525345922,
0.008526142686605453,
0.007478581741452217,
0.00471731461584568,
-0.007848959416151047,
-0.006974997464567423,
0.0015146419173106551,
-0.007920785807073116,
0.0007355073466897011,
0.0059935771860182285,
0.00572302145883441,
-0.006404283922165632,
-0.0023074783384799957,
0.005640560295432806,
0.005485503934323788,
0.0029355476144701242,
0.0059254285879433155,
-0.006543769035488367,
0.010048921220004559,
0.002553180791437626,
0.006841142196208239,
0.009570504538714886,
-0.004687546286731958,
-0.002683590166270733,
-0.0011576502583920956,
0.005215284414589405,
0.0020623726304620504,
0.007300850935280323,
0.010206871666014194,
-0.002244947711005807,
-0.002676699310541153,
0.008496439084410667,
0.0031682017724961042,
0.009625504724681377,
0.003569740802049637,
-0.0033177046570926905,
0.0014610188081860542,
-0.00393172912299633,
-0.0028756754472851753,
0.008348993957042694,
-0.008991973474621773,
0.009173699654638767,
0.005723472684621811,
-0.020300336182117462,
-0.007713307160884142,
0.00225556967779994,
-0.008410890586674213,
0.0041053746826946735,
0.01697392389178276,
0.012179418466985226,
-0.001949896803125739,
0.004087225534021854,
-0.006848180200904608,
0.003838079050183296,
0.009197797626256943,
-0.0025529288686811924,
-0.010406352579593658,
-0.9552815556526184,
0.005052076652646065,
0.006092539988458157,
-0.0022423798218369484,
0.003848572261631489,
-0.0010118490317836404,
0.0023237187415361404,
0.003119104541838169,
0.01208130270242691,
-0.004847704898566008,
-0.0034447000361979008,
-0.010328630916774273,
-0.01321426872164011,
-0.00042626383947208524,
-0.007851005531847477,
-0.003440095577389002,
-0.007556829135864973,
-0.007128044962882996,
-0.0006357503589242697,
-0.0015359141398221254,
-0.003378721419721842,
0.009021937847137451,
0.0015429334016516805,
0.00397734297439456,
0.0026376652531325817,
0.00193698366638273,
-0.0030299099162220955,
0.0056329043582081795,
-0.000060481586842797697,
-0.0029222930315881968,
-0.008019540458917618,
-0.014569283463060856,
-0.004253982100635767,
-0.004135608207434416,
0.01129429042339325,
0.00022983546659816056,
0.01061464287340641,
-0.0020509588066488504,
0.0033206988591700792,
-0.009134248830378056,
0.006684219930320978,
0.0006620636559091508,
0.0034351360518485308,
-0.03183987736701965,
0.0003510802343953401,
-0.001107953954488039,
-0.00993753969669342,
0.010875926353037357,
0.0036125481128692627,
-0.0028796959668397903,
-0.00191002176143229,
-0.00666785379871726,
0.010292742401361465,
-0.007273475173860788,
0.004593305289745331,
-0.0027285099495202303,
-0.004289974458515644,
-0.0045565152540802956,
-0.01174921914935112,
0.0026564295403659344,
0.0042639528401196,
-0.003021144075319171,
-0.002444465644657612,
-0.004946943372488022,
0.0007219482213258743,
-0.00012490613153204322,
0.003059210255742073,
-0.020078551024198532,
-0.008167613297700882,
0.0002557140833232552,
0.00457351841032505,
-0.0019504391821101308,
-0.005189760588109493,
0.006183433346450329,
-0.008707535453140736,
0.007163637783378363,
0.0022251165937632322,
-0.00028370178188197315,
-0.010662215761840343,
-0.0003140053595416248,
-0.012006353586912155,
-0.00584071222692728,
-0.0004486208490561694,
-0.005452780984342098,
-0.007612090092152357,
0.00038309075171127915,
0.0029784436337649822,
0.007369262631982565,
-0.005784883629530668,
0.0030304561369121075,
0.010233105160295963,
-0.0038934822659939528,
-0.006111240014433861,
0.007383247371762991,
0.009280861355364323,
0.0017046862049028277,
0.004722976591438055,
-0.0014661989407613873,
0.008896664716303349,
0.009622332639992237,
0.004577466286718845,
0.00987226516008377,
0.0020720455795526505,
0.016555514186620712,
0.0019396611023694277,
0.0013171691680327058,
-0.005936665926128626,
-0.00108899746555835,
-0.0042984383180737495,
0.0038174306973814964,
-0.0033584965858608484,
-0.0032575689256191254,
-0.012068026699125767,
-0.01006869226694107,
-0.004754441790282726,
-0.0011213861871510744,
0.0007372028776444495,
-0.007162891328334808,
-0.0003852912923321128,
0.0020009649451822042,
0.004310938995331526,
-0.0009007150656543672,
-0.0027709912974387407,
0.003317141206935048,
0.00538969412446022,
-0.0048079234547913074,
0.013444453477859497,
-0.01258768793195486,
0.005861165467649698,
0.0008540389826521277,
-0.016575269401073456,
0.0076502286829054356,
0.007249804213643074,
-0.0059217289090156555,
0.0017368432600051165,
0.003695579245686531,
0.0017884079134091735,
-0.0018847720930352807,
-0.005735217127948999,
-0.003330967156216502,
-0.01744707301259041,
0.0008345789392478764,
0.02404898777604103,
0.004831826779991388,
0.012461449019610882,
0.01329344604164362,
-0.0018711043521761894,
-0.0017666590865701437,
0.005218840204179287,
0.00005168671123101376,
0.014659924432635307,
-0.006186377722769976,
-0.00045965026947669685,
0.0014563895529136062,
-0.007916881702840328,
0.0009929054649546742,
0.006112715229392052,
0.003443343797698617,
-0.0004450793203432113,
0.0039213295094668865,
-0.009273100644350052,
-0.010392256081104279,
-0.015852520242333412,
-0.003134897444397211,
0.009051263332366943,
-0.004008013289421797,
0.0060284556820988655,
-0.012692964635789394,
0.0055009061470627785,
0.004287241492420435,
0.00854533538222313,
-0.0028958965558558702,
0.0011031535686925054,
0.006496304180473089,
0.011335503309965134,
-0.007506150286644697,
0.002509328769519925,
0.00014309189282357693,
0.0019961451180279255,
-0.0013254397781565785,
0.007678436581045389,
-0.00717967189848423,
-0.003094305517151952,
0.004188449587672949,
0.004752858076244593,
-0.00010112638119608164,
-0.004145079292356968,
-0.01021533738821745,
-0.006229911930859089,
0.007989378646016121,
-0.00585091020911932,
0.004071149509400129,
-0.0007962011150084436,
0.0017815956380218267,
-0.011244405061006546,
-0.0002277394087286666,
-0.008465197868645191,
-0.011408633552491665,
0.01518330443650484,
-0.0015577326994389296,
0.005045216530561447,
0.01412869244813919,
0.005678312852978706,
-0.01609075628221035,
0.006417509634047747,
0.003879299620166421,
-0.0004311986267566681,
0.0027673807926476,
0.005259936675429344,
-0.0036302567459642887,
-0.026056187227368355,
-0.002943504136055708,
-0.014419377781450748,
0.006345374044030905,
-0.001912783132866025,
0.003767798189073801,
-0.005945082288235426,
0.0035464572720229626,
0.005520383827388287,
-0.012787403538823128,
-0.004057024139910936,
-0.010518616996705532,
0.01035582460463047,
-0.000553961202967912,
0.0031165038235485554,
-0.00677147600799799,
-0.0044453199952840805,
-0.004194354638457298,
-0.002256451640278101,
-0.002790005411952734,
0.00816587544977665,
0.004678563680499792,
-0.002358031226322055,
0.0015363373095169663,
-0.004107839893549681,
-0.0018721502274274826,
-0.0009697330533526838,
-0.011953545734286308,
-0.000343823223374784,
0.004423703532665968,
-0.0032145839650183916,
-0.0067817470990121365,
-0.0003914013796020299,
-0.0011992420768365264,
-0.003877724288031459,
-0.010300979018211365,
-0.003899551462382078,
-0.005424097646027803,
-0.004421772435307503,
-0.011472543701529503,
-0.004709286615252495,
-0.01057837437838316,
0.011850902810692787,
-0.0062281545251607895,
0.010187297128140926,
0.003228408982977271,
-0.0077486420050263405,
0.00713596073910594,
-0.004162624012678862,
0.0034176281187683344,
-0.00019997675553895533,
0.00681131798774004,
0.002619208302348852,
-0.008603096939623356,
-0.00820227712392807,
0.012383089400827885,
-0.009555011987686157,
0.0020923607517033815,
0.013129467144608498,
0.0054328953847289085,
0.0077419583685696125,
-0.000263245718088001,
-0.00014168070629239082,
0.003326471894979477,
0.005711978301405907,
-0.011463669128715992,
0.0014774368610233068,
-0.0015024907188490033,
0.000891513773240149,
0.004873358178883791,
-0.00648768013343215,
0.0030953644309192896,
0.009545170702040195,
-0.002097564982250333,
-0.0064187245443463326,
-0.003065225901082158,
-0.0005402867682278156,
0.0030974503606557846,
-0.00994179118424654,
-0.0003947173245251179,
-0.0033146576024591923,
-0.006588233634829521,
-0.0038431903813034296,
-0.0032978011295199394,
0.0005122962757013738,
0.005034367088228464,
-0.006777035538107157,
0.0071302736178040504,
-0.0025979983620345592,
-0.007151623256504536,
0.014054476283490658,
-0.008808388374745846,
-0.006535568740218878,
0.00648955162614584,
0.0009032158413901925,
0.0012152005219832063,
-0.0035684469621628523,
-0.0013873922871425748,
0.004581013694405556,
0.005461207590997219,
-0.004823112394660711,
-0.003557927906513214,
0.002854615217074752,
-0.002433738438412547,
-0.007097047753632069,
0.0007611224427819252,
0.010478980839252472,
-0.003888195613399148,
0.0052122087217867374,
-0.0021264965180307627,
-0.006581626832485199,
-0.021353306248784065,
0.05298217386007309,
-0.0021851223427802324,
0.0023032831959426403,
0.003541401354596019,
-0.01104273647069931,
-0.0032410258427262306,
-0.0032631410285830498,
0.007140737026929855,
-0.006369549315422773,
-0.007318395189940929,
0.007044099271297455,
-0.0013378432486206293,
0.0022134988103061914,
-0.0005933287320658565,
0.00012669889838434756,
0.013846760615706444,
-0.002608443144708872,
-0.017073845490813255,
-0.017070969566702843,
0.006233798339962959,
-0.004811879713088274,
-0.011233747936785221,
0.013009891845285892,
-0.006238954141736031,
-0.003762314096093178,
0.00385811529122293,
0.008509090170264244,
0.0012175623560324311,
0.0022239554673433304,
-0.00408804789185524,
-0.004309244453907013,
-0.0011688469676300883,
0.0014598126290366054,
0.007400397211313248,
0.007744393311440945,
-0.002455387730151415,
0.007135795895010233,
-0.0004092817544005811,
-0.000751438841689378,
-0.003532400354743004,
0.00451271329075098,
0.008562085218727589,
-0.0011160762514919043,
-0.003407552605494857,
0.003431165125221014,
0.0030199959874153137,
0.0002638793084770441,
0.012635148130357265,
-0.001157152932137251,
-0.004907582886517048,
0.007074187975376844,
0.004287971183657646,
0.0004942022496834397,
0.00839031022042036,
-0.00039538147393614054,
0.0035853078588843346,
0.0030333283357322216,
-0.005692395847290754,
-0.01863008178770542,
-0.00244298973120749,
0.005012528505176306,
0.006741266697645187,
-0.000577457423787564,
-0.0017678971635177732,
-0.003780693979933858,
-0.0033097064588218927,
-0.0038384965155273676,
-0.009386260062456131,
0.0017544919392094016,
0.00019165115372743458,
0.0017113593639805913,
0.07260648161172867,
-0.006227173842489719,
0.000055565873481100425,
-0.007164651062339544,
-0.0010156285716220737,
-0.0018779612146317959,
-0.0011419972870498896,
0.00007696591637795791,
-0.003623340278863907,
0.0012628205586224794,
0.0014843742828816175,
-0.00831770058721304,
-0.011828401125967503,
0.00029469490982592106,
-0.00015296928177122027,
-0.002432591747492552,
0.0032629896886646748,
0.008335820399224758,
-0.009874669834971428,
0.0023874479811638594,
-0.015012887306511402,
0.0006733828340657055,
-0.001806954387575388,
-0.009792166762053967,
-0.0034271185286343098,
-0.002905064495280385,
0.008700422011315823,
0.00497649610042572,
0.004892842844128609,
-0.005753139033913612,
0.002334451535716653,
-0.000855497841257602,
0.0011125084711238742,
-0.003946337848901749,
-0.004123779479414225,
-0.008978697471320629,
0.0052283750846982,
0.0018863125005736947,
-0.012786991894245148,
-0.0060793678276240826,
-0.0030981311574578285,
-0.0014923028647899628,
-0.007597494870424271,
0.0037210192531347275,
0.0007146322168409824,
0.008782483637332916,
-0.002081688027828932,
0.001577251241542399,
-0.005261278711259365,
0.00549776665866375,
-0.007939323782920837,
0.0044728233478963375,
-0.17835082113742828,
0.010645631700754166,
0.0032552042976021767,
-0.006032763514667749,
-0.005388054996728897,
-0.016959011554718018,
-0.0055659860372543335,
0.004739047959446907,
0.009600781835615635,
0.0038923376705497503,
-0.004194506444036961,
-0.006240846589207649,
0.008190413936972618,
-0.0018673212034627795,
0.0009625139064155519,
-0.007977440021932125,
0.0024334704503417015,
-0.0017336133169010282,
0.0009459852590225637,
0.004541470669209957,
0.006409189663827419,
0.009235929697751999,
-0.00048123119631782174,
0.0017406110418960452,
0.0011917229276150465,
-0.0050600990653038025,
0.006490022875368595,
-0.004697528202086687,
0.006687570363283157,
-0.012594547122716904,
-0.003192876698449254,
-0.0012736138887703419,
-0.007320720702409744,
-0.0019020737381651998,
0.005276765674352646,
-0.002440504729747772,
0.008570929057896137,
0.0025009328965097666,
-0.00574500160291791,
0.007389845326542854,
-0.005405886564403772,
0.027886435389518738,
0.007782105356454849,
0.006794774439185858,
0.0010874137515202165,
-0.004921459127217531,
-0.007163273170590401,
0.007966487668454647,
0.0032200163695961237,
0.01244894415140152,
-0.013999626971781254,
-0.0009334860369563103,
0.0035351275000721216,
0.01763242855668068,
-0.004104385618120432,
-0.010913361795246601,
-0.006106770131736994,
-0.007193289697170258,
0.003683285554870963,
0.010743251070380211,
0.012524100951850414,
-0.003655862994492054,
0.01440378837287426,
-0.003414050443097949,
-0.024194609373807907,
0.0003681212547235191,
-0.00229061022400856,
-0.00852426327764988,
0.0033622910268604755,
0.008871771395206451,
0.01015174575150013,
0.0015142402844503522,
0.0054894695058465,
-0.0019702771678566933,
0.0036269023548811674,
-0.001483424217440188,
0.0035827101673930883,
-0.0026224076282233,
0.007044746074825525,
-0.008809235878288746,
0.01090855523943901,
-0.0117501774802804,
-0.0055981469340622425,
0.0023367665708065033,
-0.006867941003292799,
0.008700961247086525,
0.0024964893236756325,
0.0006658309139311314,
0.00042123167077079415,
-0.01143981609493494,
-0.004944687709212303,
0.004122642334550619,
0.004196302965283394,
-0.010134664364159107,
0.0010689353803172708,
0.0007923832745291293,
0.005155665334314108,
0.007729717064648867,
-0.007799385581165552,
0.00901000201702118,
0.007005676161497831,
-0.0023908219300210476,
-0.000443647732026875,
-0.002207639394327998,
0.003850997192785144,
0.0031165098771452904,
-0.006140637677162886,
-0.006590674165636301,
0.0032786093652248383,
-0.005724706687033176,
-0.008294659666717052,
0.004342192318290472,
-0.010827016085386276,
-0.008435195311903954,
-0.0005948049365542829,
-0.009839090518653393,
0.001290916814468801
] |
8a58853ac66bc8f5b8cfad78774a49e43b593fba | 2,786 | py | Python | src/mem/slicc/ast/TypeDeclAST.py | qianlong4526888/haha | 01baf923693873c11ae072ce4dde3d8f1d7b6239 | [
"BSD-3-Clause"
] | 135 | 2016-10-21T03:31:49.000Z | 2022-03-25T01:22:20.000Z | src/mem/slicc/ast/TypeDeclAST.py | qianlong4526888/haha | 01baf923693873c11ae072ce4dde3d8f1d7b6239 | [
"BSD-3-Clause"
] | 148 | 2018-07-20T00:58:36.000Z | 2021-11-16T01:52:33.000Z | src/mem/slicc/ast/TypeDeclAST.py | qianlong4526888/haha | 01baf923693873c11ae072ce4dde3d8f1d7b6239 | [
"BSD-3-Clause"
] | 48 | 2016-12-08T12:03:13.000Z | 2022-02-16T09:16:13.000Z | # Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from slicc.ast.DeclAST import DeclAST
from slicc.symbols.Type import Type
class TypeDeclAST(DeclAST):
def __init__(self, slicc, type_ast, pairs, field_asts):
super(TypeDeclAST, self).__init__(slicc, pairs)
self.type_ast = type_ast
self.field_asts = field_asts
def __repr__(self):
return "[TypeDecl: %r]" % (self.type_ast)
def files(self, parent=None):
if "external" in self:
return set()
if parent:
ident = "%s_%s" % (parent, self.type_ast.ident)
else:
ident = self.type_ast.ident
return set(("%s.hh" % ident, "%s.cc" % ident))
def generate(self):
ident = str(self.type_ast)
machine = self.symtab.state_machine
# Make the new type
new_type = Type(self.symtab, ident, self.location, self.pairs,
self.state_machine)
if machine:
machine.addType(new_type)
self.symtab.newSymbol(new_type)
self.symtab.pushFrame()
# Add all of the fields of the type to it
for field in self.field_asts:
field.generate(new_type)
self.symtab.popFrame()
| 39.8 | 72 | 0.709261 | 1 | 1.5456 | [
0.0013637746451422572,
0.02446434646844864,
0.007960605435073376,
0.0015582413179799914,
0.004435105714946985,
-0.002910666400566697,
-0.009090744890272617,
0.002157418755814433,
-0.006967632099986076,
0.0029777728486806154,
0.0020603712182492018,
0.005403593648225069,
0.006698190700262785,
-0.015671107918024063,
0.0010047947289422154,
0.016269361600279808,
-0.05103910341858864,
0.003036655718460679,
-0.0032005347311496735,
0.002754922490566969,
-0.0075537655502557755,
0.009553994983434677,
0.009904314763844013,
0.005630845203995705,
0.006876644212752581,
-0.0005918426322750747,
0.007533540949225426,
0.001745769171975553,
-0.0061503807082772255,
-0.007314549293369055,
-0.000340307509759441,
-0.0014312436105683446,
-0.0059332638047635555,
-0.008364265784621239,
0.006248232908546925,
-0.00245468458160758,
-0.0007849935791455209,
-0.018564485013484955,
0.012704734690487385,
-0.003543236991390586,
-0.005580358672887087,
-0.014027855359017849,
0.00023523949494119734,
0.0025429429952055216,
-0.00980240385979414,
-0.00036796790664084256,
-0.004585314076393843,
0.0038809829857200384,
-0.01195561233907938,
0.00593846570700407,
-0.007677641697227955,
0.006734171882271767,
0.014008120633661747,
0.003422569017857313,
-0.0057435426861047745,
-0.005433955695480108,
0.012344221584498882,
-0.00018571107648313046,
-0.010494296438992023,
-0.001490035210736096,
-0.0037465239875018597,
-0.002171512460336089,
0.0039947256445884705,
0.0014454679330810905,
-0.014907018281519413,
-0.007713806815445423,
-0.004598646424710751,
0.0026986871380358934,
-0.0013057796750217676,
0.005356871988624334,
0.0010171657195314765,
0.001140411477535963,
0.006688560359179974,
0.00440780958160758,
0.0030631667468696833,
-0.0037448692601174116,
-0.00244864821434021,
-0.0010832586558535695,
0.007243990432471037,
0.0027542931493371725,
0.004517367575317621,
-0.005312267690896988,
0.004183315206319094,
0.0075627039186656475,
0.013638309203088284,
0.006754112429916859,
0.019331403076648712,
-0.011196480132639408,
0.04631549492478371,
0.008935031481087208,
-0.007195299956947565,
0.003350716782733798,
-0.00802101381123066,
-0.002257063752040267,
-0.004060819745063782,
-0.027195749804377556,
-0.000496631080750376,
-0.00319442106410861,
0.0005562463775277138,
0.002931906608864665,
0.00042101385770365596,
0.007748792879283428,
0.0005335137830115855,
-0.0011661482276394963,
-0.008739553391933441,
0.008791420608758926,
-0.009011498652398586,
-0.0024582776241004467,
0.006055894773453474,
0.0027062452863901854,
-0.012381922453641891,
-0.003129475051537156,
0.001342261559329927,
-0.011744081042706966,
0.0035274489782750607,
0.0017670614179223776,
-0.005622100085020065,
0.05275806412100792,
-0.002547072246670723,
0.004521516151726246,
-0.0042377351783216,
0.0036560487933456898,
0.0023155072703957558,
0.006093458738178015,
0.008998414501547813,
-0.003337465925142169,
0.01259432453662157,
0.008213752880692482,
0.0032312737312167883,
0.00892612710595131,
-0.0024634760338813066,
0.006401437800377607,
-0.00394938699901104,
-0.0013973230961710215,
0.0011804447276517749,
-0.007599080912768841,
0.00889531522989273,
-0.0019054741133004427,
-0.008443971164524555,
0.002041311003267765,
-0.0002417482464807108,
-0.008944454602897167,
0.0014489942695945501,
-0.005514311604201794,
0.005564760882407427,
-0.008937609381973743,
-0.0017008358845487237,
-0.004439396783709526,
-0.0030983653850853443,
0.0012402681168168783,
0.010055352002382278,
0.0042706741951406,
0.0034892938565462828,
-0.006203892175108194,
-0.009467484429478645,
0.0003952119732275605,
-0.003051190171390772,
0.00015348517626989633,
0.007403389550745487,
0.004258148837834597,
-0.009179708547890186,
-0.0018862395081669092,
0.0014262422919273376,
0.003270620247349143,
-0.0017713617999106646,
0.004440855234861374,
-0.008847884833812714,
0.005407438147813082,
0.00008320898632518947,
0.0047958712093532085,
0.011101813055574894,
-0.003755982266739011,
0.0004181845870334655,
-0.0006712320609949529,
0.0017193780513480306,
-0.002461656928062439,
0.004898689221590757,
0.008486321195960045,
-0.0014226115308701992,
-0.0024162945337593555,
0.004021944012492895,
0.006202960852533579,
0.009211900644004345,
0.00347178359515965,
-0.0034934855066239834,
0.0031352334190160036,
-0.0029276921413838863,
-0.0020326750818639994,
0.006944896187633276,
-0.004288155119866133,
0.005864689126610756,
0.005433380138128996,
-0.01245131529867649,
-0.007423965726047754,
0.00067900336580351,
-0.008387026377022266,
0.0009532597032375634,
0.013931074179708958,
0.010652517899870872,
-0.0033661930356174707,
0.004316371399909258,
-0.008838474750518799,
0.0004123374237678945,
0.007119003217667341,
0.0020728465169668198,
-0.012059946544468403,
-0.9605048298835754,
0.005838260054588318,
0.0048073879443109035,
-0.002440570155158639,
0.006349269766360521,
0.0038216288667172194,
0.003145618597045541,
0.004946946166455746,
0.01309270691126585,
-0.007375914603471756,
-0.007820640690624714,
-0.009196936152875423,
-0.010561768896877766,
-0.00344708189368248,
-0.007405255455523729,
-0.003661239752545953,
-0.006219249218702316,
-0.006788135506212711,
-0.0007700474234297872,
-0.0023801762145012617,
-0.0011757855536416173,
0.008841983042657375,
-0.0022104796953499317,
0.0055959043093025684,
0.0031583828385919333,
0.002617184305563569,
-0.00503186509013176,
0.0003555048315320164,
-0.0023315404541790485,
-0.0035599516704678535,
-0.00785487238317728,
-0.013170545920729637,
-0.003913054708391428,
-0.0008428379078395665,
0.009916671551764011,
-0.00023188652994576842,
0.007858801633119583,
-0.002705004997551441,
0.0011880124220624566,
-0.007974885404109955,
0.005505944136530161,
-0.0010912887519225478,
0.0017359261400997639,
-0.02895260788500309,
-0.0015984773635864258,
0.0003679166838992387,
-0.009712952189147472,
0.008210578002035618,
-0.0011849785223603249,
0.00011698932939907536,
-0.0019297931576147676,
-0.006388457026332617,
0.009261629544198513,
-0.007527184206992388,
0.003767629386857152,
-0.004057007841765881,
-0.008823617361485958,
-0.0025942933280020952,
-0.0075706494972109795,
0.0008772080182097852,
0.004398909397423267,
-0.0029667362105101347,
-0.004903069697320461,
-0.0029632775112986565,
0.004624951630830765,
0.00247955066151917,
0.002321255160495639,
-0.01760222390294075,
-0.0063835373148322105,
0.0004896843456663191,
0.0030118790455162525,
-0.002117263386026025,
-0.0034421049058437347,
0.004761352203786373,
-0.009512604214251041,
0.006658174563199282,
0.0009183795773424208,
-0.002201378345489502,
-0.012831549160182476,
0.00004294422615203075,
-0.009769494645297527,
-0.0074710906483232975,
0.00034500425681471825,
-0.005338441114872694,
-0.005455514416098595,
-0.0003423095913603902,
-0.0001620765106054023,
0.00634458614513278,
-0.00395870441570878,
0.0035231197252869606,
0.011942675337195396,
-0.003374141873791814,
-0.008254329673945904,
0.006380749866366386,
0.007579276338219643,
-0.00003433193705859594,
-0.0014530080370604992,
0.0014596256660297513,
0.008582741022109985,
0.008106344379484653,
0.002702446887269616,
0.006281827110797167,
-0.00025879379245452583,
0.009571966715157032,
0.00028458694578148425,
0.0006131280097179115,
-0.003856009803712368,
0.00014328380348160863,
-0.005377282854169607,
-0.0003469112853053957,
-0.0042747328989207745,
-0.002679236000403762,
-0.012885726056993008,
-0.009263758547604084,
-0.0028648991137742996,
0.00041619883268140256,
0.004069067537784576,
-0.004291634075343609,
-0.0011855431366711855,
0.0020828265696763992,
0.006643765605986118,
0.0006933801341801882,
-0.002501953160390258,
-0.00010057196050183848,
0.002312765456736088,
-0.005145929753780365,
0.013549994677305222,
-0.011773308739066124,
0.0069371419958770275,
0.000051228886150056496,
-0.014368373900651932,
0.006388656795024872,
0.010781672783195972,
-0.00911661796271801,
0.0025093250442296267,
0.0023656380362808704,
0.0020989750046283007,
0.00003429341086302884,
-0.005297836847603321,
-0.0025026220828294754,
-0.01747213304042816,
0.00012414880620781332,
0.019168565049767494,
0.0006028332863934338,
0.009437254630029202,
0.012330245226621628,
-0.004012841731309891,
0.0019939530175179243,
0.004610954783856869,
0.0023814307060092688,
0.011537985876202583,
-0.009772627614438534,
0.0002440950775053352,
0.0019337860867381096,
-0.006304428447037935,
-0.00012505466293077916,
0.005570816807448864,
0.00718257762491703,
-0.002927016466856003,
0.0030375916976481676,
-0.008194898255169392,
-0.006622138898819685,
-0.017760436981916428,
-0.005256743635982275,
0.006989639718085527,
-0.005112889222800732,
0.006012766156345606,
-0.011808987706899643,
0.006377093493938446,
0.005711337085813284,
0.003270913613960147,
-0.0014816968468949199,
0.00038349456735886633,
0.00388951669447124,
0.012389185838401318,
-0.005312252789735794,
0.001968878321349621,
0.0030974536202847958,
-0.000832516816444695,
0.0007844123756513,
0.008213662542402744,
-0.005033204331994057,
-0.0043381741270422935,
0.0018271708395332098,
0.0057485830038785934,
-0.00038248125929385424,
-0.0021540881134569645,
-0.008745618164539337,
-0.0034921884071081877,
0.002897478174418211,
-0.00682301027700305,
0.004526197444647551,
0.000635714503005147,
0.0050269318744540215,
-0.007337234448641539,
-0.0025532981380820274,
-0.005002175457775593,
-0.013279316015541553,
0.010796860791742802,
-0.002308669500052929,
0.0044529130682349205,
0.013411342166364193,
0.005467111244797707,
-0.012427627108991146,
0.005755176767706871,
0.00934678316116333,
-0.0031217734795063734,
0.0026247852947562933,
0.004779320675879717,
-0.004059179220348597,
-0.022041743621230125,
-0.00298322387970984,
-0.012802844867110252,
0.006573331542313099,
-0.0017588690388947725,
0.0027305062394589186,
-0.008780275471508503,
0.007744121365249157,
0.006055666133761406,
-0.013342799618840218,
-0.006219961680471897,
-0.008168855682015419,
0.008384077809751034,
0.0017945504514500499,
-0.0011355889728292823,
-0.0023670147638767958,
0.00027571964892558753,
-0.0006953327683731914,
-0.004756399895995855,
-0.0036820918321609497,
0.0050422740168869495,
0.0019890638068318367,
-0.0029059818480163813,
0.001777196885086596,
-0.004883970599621534,
0.0007550101145170629,
0.0011457406217232347,
-0.010995150543749332,
0.0017540472326800227,
0.004689461551606655,
-0.0008838661015033722,
-0.0033120487350970507,
0.0008640181622467935,
-0.004058607388287783,
-0.007860038429498672,
-0.010721618309617043,
-0.0053062643855810165,
-0.004046204499900341,
-0.003973572980612516,
-0.013778774067759514,
-0.0020869742147624493,
-0.009096921421587467,
0.0051011694595217705,
-0.007468364667147398,
0.0061561185866594315,
0.005261944141238928,
-0.003411697456613183,
0.0060984850861132145,
-0.0017402622615918517,
0.0049757887609303,
0.002818985842168331,
0.004389715380966663,
0.0009058724972419441,
-0.005152787547558546,
-0.010684321634471416,
0.011649996973574162,
-0.008050707168877125,
0.001295277732424438,
0.012791846878826618,
0.005608610808849335,
0.009697665460407734,
-0.0009764977148734033,
0.000691872148308903,
0.0021533584222197533,
0.006614352110773325,
-0.013073460198938847,
0.0032193746883422136,
-0.003766412613913417,
-0.0005638597649522126,
0.0039039007388055325,
-0.002462332136929035,
0.0015822290442883968,
0.009009446948766708,
-0.0002369159337831661,
-0.006997767370194197,
-0.0035189734771847725,
0.0020882447715848684,
0.002529098652303219,
-0.0122632822021842,
-0.000752679246943444,
-0.0025166599079966545,
-0.004527867306023836,
-0.00228933896869421,
-0.0019540113862603903,
-0.000927833782043308,
0.0032705587800592184,
-0.0021390181500464678,
0.004493853077292442,
0.003838237840682268,
-0.004850947298109531,
0.01420487929135561,
-0.004404148552566767,
-0.00661766342818737,
0.0033236308954656124,
0.0021549491211771965,
-0.0013798826839774847,
-0.00680621899664402,
-0.0036302469670772552,
0.0031511676497757435,
0.00698642386123538,
-0.004433898255228996,
-0.001164782210253179,
-0.001309904269874096,
0.0013357243733480573,
-0.009049776010215282,
0.001923882751725614,
0.011878255754709244,
-0.004475777503103018,
0.00485971849411726,
-0.002843855181708932,
-0.006522385869175196,
-0.013698074966669083,
0.053318146616220474,
-0.0006954839918762445,
0.0031508097890764475,
0.0028856657445430756,
-0.008650489151477814,
-0.0002692168636713177,
-0.0028182698879390955,
0.007596366107463837,
-0.005988195538520813,
-0.006147964391857386,
0.008697913028299809,
-0.0028777816332876682,
0.003559484612196684,
0.0037529568653553724,
-0.00008959027763921767,
0.01445876993238926,
-0.0028397971764206886,
-0.016536246985197067,
-0.01679457537829876,
0.008022988215088844,
-0.003905386198312044,
-0.008262638933956623,
0.010729946196079254,
-0.003292002948001027,
-0.005605625919997692,
0.0010264288866892457,
0.006892532575875521,
0.0013116005575284362,
0.000624326930847019,
-0.002053764183074236,
-0.004409517161548138,
-0.0018417496467009187,
0.0029034006875008345,
0.00462226290255785,
0.004956476390361786,
-0.0029104268178343773,
0.004305794835090637,
-0.00191850820556283,
-0.003351799910888076,
-0.001349418773315847,
0.003930992446839809,
0.0070762247778475285,
-0.0004226638993714005,
-0.00020013262110296637,
0.006896686274558306,
0.005746857728809118,
0.004074417054653168,
0.01081247441470623,
-0.0003577448078431189,
-0.005787893198430538,
0.006783385761082172,
0.007774548605084419,
0.0009134887368418276,
0.009583977982401848,
-0.0011276556178927422,
0.006669703405350447,
0.0021810634061694145,
-0.006477947346866131,
-0.01544105727225542,
-0.0014548954786732793,
0.007702693343162537,
0.007502769585698843,
-0.0026861177757382393,
-0.001578369876369834,
-0.0032879302743822336,
-0.002979504643008113,
-0.005616991780698299,
-0.00839553214609623,
-0.0014327180106192827,
0.0009584467043168843,
0.0029738156590610743,
0.06843165308237076,
-0.007142513990402222,
-0.0014927989104762673,
-0.008431611582636833,
-0.0013302360894158483,
-0.0031334718223661184,
-0.001515114912763238,
0.0007110118167474866,
0.00001399423763359664,
0.001457398058846593,
-0.00043441186426207423,
-0.008930950425565243,
-0.011599789373576641,
-0.0010507666738703847,
0.002284454647451639,
-0.002089920686557889,
0.0037521293852478266,
0.006092966068536043,
-0.009297509677708149,
0.0013291751965880394,
-0.010617288760840893,
0.0006070552044548094,
-0.0011746807722374797,
-0.009278837591409683,
-0.003566362429410219,
-0.0022453018464148045,
0.006810896098613739,
0.002877103164792061,
0.0072761159390211105,
-0.004992049653083086,
0.00631726672872901,
-0.0025350977666676044,
-0.0004527508281171322,
-0.00551710557192564,
0.0005719518521800637,
-0.006863087881356478,
0.008258451707661152,
0.0009995397413149476,
-0.010533701628446579,
-0.00531022110953927,
-0.0003403620794415474,
0.0013015768490731716,
-0.0040589687414467335,
0.0030381998512893915,
0.00022056310262996703,
0.005552911665290594,
-0.003558618016541004,
-0.000748607621062547,
-0.006549931596964598,
0.0030593196861445904,
-0.0130385123193264,
0.007213700097054243,
-0.16864867508411407,
0.011769887059926987,
0.004295212682336569,
-0.006510755978524685,
-0.0028669536113739014,
-0.015034636482596397,
-0.0038512186147272587,
0.0033131190575659275,
0.009207441471517086,
0.0017405999824404716,
-0.0015440942952409387,
-0.003062240080907941,
0.0030256840400397778,
0.004012088291347027,
-0.0020117952954024076,
-0.00506105599924922,
0.005738462787121534,
-0.0036666712258011103,
0.0012389644980430603,
0.0031112362630665302,
0.004456548951566219,
0.0070380899123847485,
0.0015358744421973825,
0.002227098448202014,
-0.001304785953834653,
-0.0059325313195586205,
0.005689948331564665,
-0.0014908219454810023,
0.0048730154521763325,
-0.011962118558585644,
-0.001274268259294331,
-0.004464743193238974,
-0.005310805514454842,
-0.00012236401380505413,
0.003748286049813032,
0.00027172957197763026,
0.009224225766956806,
0.0038105230778455734,
-0.009399447590112686,
0.007398235145956278,
-0.007322777062654495,
0.028565432876348495,
0.005139478482306004,
0.005737971048802137,
-0.0001865731319412589,
-0.00572590297088027,
-0.004950136411935091,
0.009704499505460262,
0.002047955757007003,
0.010752847418189049,
-0.013985267840325832,
-0.001383015071041882,
0.004433640278875828,
0.018395325168967247,
-0.005969054065644741,
-0.009264874272048473,
-0.005592703819274902,
-0.0037585487589240074,
0.0011634745169430971,
0.007682690396904945,
0.010378922335803509,
-0.005447482690215111,
0.008183513768017292,
-0.0007647696183994412,
-0.020498715341091156,
0.0032658367417752743,
-0.005455822218209505,
-0.006809623911976814,
0.0024776384234428406,
0.007498051971197128,
0.009966909885406494,
0.00032557945814915,
0.003179348073899746,
-0.0012212215224280953,
0.007055778056383133,
0.0002483962452970445,
0.005221174564212561,
-0.00006373733776854351,
0.005130978301167488,
-0.009843806736171246,
0.006312983576208353,
-0.01035927515476942,
-0.0033609431702643633,
0.0032852930016815662,
-0.003438215935602784,
0.010823550634086132,
0.0036753166932612658,
-0.001962409820407629,
-0.0013747101183980703,
-0.01022843923419714,
-0.0030648489482700825,
0.0018348897574469447,
0.00116954545956105,
-0.008405540138483047,
0.003754781559109688,
0.0006603029905818403,
0.004370571114122868,
0.0056328922510147095,
-0.01042093150317669,
0.006569941993802786,
0.0061887758783996105,
-0.004792434629052877,
0.0016109797870740294,
-0.005089444573968649,
0.0005369771970435977,
0.004738309420645237,
-0.005460210144519806,
-0.0055360738188028336,
0.004183229990303516,
-0.006947302725166082,
-0.005732610821723938,
0.006067598704248667,
-0.009291271679103374,
-0.009044291451573372,
-0.001423165202140808,
-0.01106895413249731,
0.0008118549594655633
] |
8a59e89d09e32fec1b404a96ad1edf1ccd223adb | 8,871 | py | Python | tests/test_preempt_return.py | vpv11110000/pyss | bc2226e2e66e0b551a09ae6ab6835b0bb6c7f32b | [
"MIT"
] | null | null | null | tests/test_preempt_return.py | vpv11110000/pyss | bc2226e2e66e0b551a09ae6ab6835b0bb6c7f32b | [
"MIT"
] | 2 | 2017-09-05T11:12:05.000Z | 2017-09-07T19:23:15.000Z | tests/test_preempt_return.py | vpv11110000/pyss | bc2226e2e66e0b551a09ae6ab6835b0bb6c7f32b | [
"MIT"
] | null | null | null | # #!/usr/bin/python
# -*- coding: utf-8 -*-
# test_preempt_return.py
# pylint: disable=line-too-long,missing-docstring,bad-whitespace, unused-argument, too-many-locals
import sys
import os
import random
import unittest
DIRNAME_MODULE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))) + os.sep
sys.path.append(DIRNAME_MODULE)
sys.path.append(DIRNAME_MODULE + "pyss" + os.sep)
from pyss import pyssobject
from pyss.pyss_model import PyssModel
from pyss.segment import Segment
from pyss.generate import Generate
from pyss.terminate import Terminate
from pyss import logger
from pyss.table import Table
from pyss.handle import Handle
from pyss.enter import Enter
from pyss.leave import Leave
from pyss.storage import Storage
from pyss.advance import Advance
from pyss.preempt import Preempt
from pyss.g_return import GReturn
from pyss.facility import Facility
from pyss.seize import Seize
from pyss.release import Release
from pyss.transfer import Transfer
from pyss.test import Test
from pyss.pyss_const import *
class TestPreemptReturn(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
# @unittest.skip("testing skipping test_preempt_return_001")
def test_preempt_return_001(self):
"""Тест Preempt - Return
Формируется один транзакт в момент времени 1.
Прерывает работу устройства F_1 на 5 единиц времени.
Выходит из модели в момент времени 6.
"""
logger.info("--- test_preempt_return_001 ----------------------------------")
### MODEL ----------------------------------
m = PyssModel()
sgm = Segment(m)
#
m[OPTIONS].setAllFalse()
MAX_TIME = 20
#
list_all_transact = []
#
MAX_TIME = 20
#
F_1 = "F_1"
# ОКУ
Facility(m, facilityName=F_1)
#
def funcTransactTo_list_all_transact(owner, transact):
# складируем транзакты в список
list_all_transact.append(transact)
### SEGMENT ----------------------------
# формируется одна заявка в момент времени 1
Generate(sgm, med_value=None,
modificatorFunc=None,
first_tx=1,
max_amount=1)
Handle(sgm, handlerFunc=funcTransactTo_list_all_transact)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertNotIn(F_1, t[FACILITY]))
#
Preempt(sgm, facilityName=F_1)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertIn(F_1, t[FACILITY]))
#
Advance(sgm, meanTime=5, modificatorFunc=None)
GReturn(sgm, facilityName=F_1)
# test
Handle(sgm, handlerFunc=lambda o, t:not self.assertNotIn(F_1, t[FACILITY]))
#
Terminate(sgm, deltaTerminate=0)
# ЗАПУСК ----------------------
m.start(terminationCount=MAX_TIME, maxTime=MAX_TIME)
# ТЕСТЫ ----------------------
for t in list_all_transact:
self.assertEqual(t[TIME_CREATED], 1)
self.assertEqual(t[TERMINATED_TIME], 6)
print str(["%s:%s" % (k, t[k])
for k in t.keys() if k
in [TIME_CREATED, TERMINATED_TIME]])
# @unittest.skip("testing skipping test_preempt_return_002")
def test_preempt_return_002(self):
"""Тест Preempt - Return
Формируется транзакт A в момент времени 1.
Идёт на обработку устройством F_1 в течение 3 единиц времени.
Формируется транзакт B в момент времени 2.
Прерывает работу устройства на 5 единиц времени.
Транзакт B выходит из модели в момент времени 7.
Транзакт А выходит из модели в момент времени 9.
Обработка транзакта А была прервана с 2 по 7.
"""
logger.info("--- test_preempt_return_002 ----------------------------------")
### MODEL ----------------------------------
m = PyssModel()
sgm = Segment(m)
#
m[OPTIONS].setAllFalse()
MAX_TIME = 20
# CONSTS
TRANSACT_A = "A"
TRANSACT_B = "B"
#
list_all_transact = []
tA = []
tB = []
#
F_1 = "F_1"
# ОКУ
facility_1 = Facility(m, facilityName=F_1)
#
def funcTransactTo_list_all_transact(owner, transact):
# складируем транзакты в список
list_all_transact.append(transact)
def setTransactLabel(owner, transact):
if transact[NUM] == 1:
transact[LABEL] = TRANSACT_A
tA.append(transact)
elif transact[NUM] == 2:
transact[LABEL] = TRANSACT_B
tB.append(transact)
# функция проверки условия
def checkTest(o):
t=m.getCurrentTransact()
if t[LABEL] == TRANSACT_B:
return False
return True
def printAllTransact(owner, transact):
print "Time=%s" % str(m.getCurTime())
print "\n".join([str(t) for t in list_all_transact])
print "tA=%s" % str(tA[0])
print "tB=%s" % str(tB[0])
### SEGMENT ----------------------------
# формируется одна заявка в момент времени 1
Generate(sgm,
med_value=1,
modificatorFunc=None,
first_tx=1,
max_amount=2)
# вспомогательные операции
Handle(sgm, handlerFunc=funcTransactTo_list_all_transact)
Handle(sgm, handlerFunc=setTransactLabel)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertNotIn(F_1, t[FACILITY]))
#
# первый транзакт проходит, второй направляется к метке "to_preempt"
Test(sgm, funcCondition=checkTest, move2block="to_preempt")
# только первый транзакт
Seize(sgm, facilityName=F_1)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertIn(F_1, t[FACILITY]))
#
Advance(sgm, meanTime=3, modificatorFunc=None)
Release(sgm, facilityName=F_1)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertNotIn(F_1, t[FACILITY]))
#
Transfer(sgm, funcTransfer=lambda o, t: o.findBlockByLabel("to_term"))
#---
# только второй транзакт
Preempt(sgm, facilityName=F_1, label="to_preempt")
# test
# .addBlock(handle.Handle(handlerFunc=lambda o,t:self.assertEqual(tA[0][REMAIND_TIME], None)))
Handle(sgm, handlerFunc=printAllTransact)
Handle(sgm, handlerFunc=lambda o, t:self.assertIn(F_1, t[FACILITY]))
#
Handle(sgm, handlerFunc=printAllTransact)
Advance(sgm, meanTime=5, modificatorFunc=None)
GReturn(sgm, facilityName=F_1)
# test
Handle(sgm, handlerFunc=lambda o, t:self.assertEqual(tA[0][REMAIND_TIME], 2))
Handle(sgm, handlerFunc=lambda o, t:self.assertEqual(tA[0][SCHEDULED_TIME], 9))
Handle(sgm, handlerFunc=lambda o, t:self.assertNotIn(F_1, t[FACILITY]))
#
Handle(sgm, handlerFunc=printAllTransact)
# все транзакты
Terminate(sgm, label="to_term", deltaTerminate=0)
# ЗАПУСК ----------------------
m.start(terminationCount=MAX_TIME, maxTime=MAX_TIME)
# ТЕСТЫ ----------------------
for t in list_all_transact:
# Формируется транзакт A в момент времени 1.
# Идёт на обработку устройством F_1 в течение 3 единиц времени.
# Формируется транзакт B в момент времени 2.
# Прерывает работу устройства на 5 единиц времени.
# Транзакт B выходит из модели в момент времени 7.
# Транзакт А выходит из модели в момент времени 9.
# Обработка транзакта А была прервана с 2 по 7.
print str(["%s:%s" % (k, t[k])
for k in t.keys() if k
in [TIME_CREATED, TERMINATED_TIME, LIFE_TIME_LIST]])
if t[LABEL] == TRANSACT_A:
self.assertEqual(t[TIME_CREATED], 1)
self.assertEqual(t[REMAIND_TIME], 2)
self.assertEqual(t[TERMINATED_TIME], 9)
self.assertListEqual(t[LIFE_TIME_LIST], [
{'start': 1, 'state': 'actived'},
{'start': 2, 'state': 'preempted'},
{'start': 7, 'state': 'actived'},
{'start': 9, 'state': 'deleted'}])
elif t[LABEL] == TRANSACT_B:
self.assertEqual(t[TIME_CREATED], 2)
self.assertEqual(t[TERMINATED_TIME], 7)
self.assertListEqual(t[LIFE_TIME_LIST], [
{'start': 2, 'state': 'actived'},
{'start': 7, 'state': 'deleted'}])
if __name__ == '__main__':
unittest.main(module="test_preempt_return")
| 35.342629 | 106 | 0.578289 | 0 | 0 | [
0.01669102907180786,
-0.023207612335681915,
0.03775154426693916,
0.04427945241332054,
-0.005154071841388941,
0.02331950142979622,
-0.052624210715293884,
0.02084834687411785,
0.04664983972907066,
-0.0019605723209679127,
-0.02347933128476143,
0.003226432017982006,
0.003740806831046939,
0.05645226314663887,
-0.014724280685186386,
0.0033595035783946514,
0.21842384338378906,
0.021293366327881813,
0.017554953694343567,
-0.007999449968338013,
0.018346309661865234,
0.0027925993781536818,
0.013216238468885422,
0.017903300002217293,
0.022797605022788048,
-0.0074018435552716255,
-0.009906992316246033,
-0.021927684545516968,
-0.006375269964337349,
-0.033645909279584885,
-0.00728266267105937,
-0.04824689030647278,
-0.07722609490156174,
-0.010916346684098244,
-0.027469605207443237,
0.013224261812865734,
-0.013573888689279556,
-0.010355094447731972,
0.014114506542682648,
0.009556926786899567,
0.03731187805533409,
0.04817046597599983,
0.0018992765108123422,
0.02399648167192936,
0.03183935210108757,
0.008818832226097584,
-0.02824142947793007,
0.0426042303442955,
-0.005952790845185518,
-0.0006949288072064519,
0.06557094305753708,
0.018363114446401596,
0.004886574111878872,
0.0083777429535985,
-0.00108980608638376,
0.011056408286094666,
-0.012450354173779488,
0.05575362965464592,
-0.023204375058412552,
0.018509598448872566,
-0.03134722262620926,
0.04173598811030388,
-0.03155114874243736,
0.032371729612350464,
0.009971319697797298,
0.0057449801824986935,
-0.0009212659788317978,
0.020426888018846512,
-0.028904085978865623,
0.04606228321790695,
0.030413517728447914,
0.06388311833143234,
-0.004547501914203167,
0.05598147213459015,
-0.021273499354720116,
-0.008590882644057274,
0.009005296975374222,
-0.016235804185271263,
-0.016475187614560127,
-0.00017492852930445224,
-0.029079368337988853,
0.039924927055835724,
-0.012029275298118591,
-0.027421388775110245,
0.004242255352437496,
0.05167471617460251,
0.002016110811382532,
-0.01960296370089054,
0.045151691883802414,
-0.023730574175715446,
-0.02280649170279503,
0.022352242842316628,
-0.01659642718732357,
0.005264314357191324,
-0.02158118598163128,
-0.005775417201220989,
0.024050701409578323,
-0.00781991332769394,
0.02567007765173912,
0.039821598678827286,
0.035954464226961136,
-0.026775669306516647,
0.0033033161889761686,
-0.007742488291114569,
0.0038065642584115267,
-0.04905654862523079,
-0.045425962656736374,
-0.03453495725989342,
-0.042654849588871,
-0.022436397150158882,
-0.06552432477474213,
0.01363003347069025,
-0.04605916142463684,
0.010135971009731293,
-0.022168995812535286,
0.02951444499194622,
-0.00737411854788661,
0.023575088009238243,
-0.005074327811598778,
0.03527216613292694,
0.010070244781672955,
-0.015377974137663841,
0.006759284529834986,
-0.026704180985689163,
0.021228473633527756,
0.037154119461774826,
-0.003562644822522998,
0.004010937176644802,
-0.007256951183080673,
0.004925870802253485,
0.015811389312148094,
0.031440407037734985,
-0.010858996771275997,
-0.010588754899799824,
-0.0122451176866889,
-0.00893347803503275,
0.006447175517678261,
-0.023980433121323586,
-0.011392406187951565,
-0.01435500755906105,
-0.0070545789785683155,
0.02242903597652912,
-0.016096482053399086,
0.006355697754770517,
-0.005706717725843191,
-0.034691452980041504,
0.002312983153387904,
0.013473443686962128,
-0.023359863087534904,
-0.023733558133244514,
0.0013172877952456474,
0.029208561405539513,
0.0040266127325594425,
-0.015943467617034912,
0.026414820924401283,
0.001291414606384933,
-0.010928026400506496,
0.004048849456012249,
-0.00927235372364521,
-0.02135002240538597,
-0.007780766114592552,
0.012106130830943584,
0.032792575657367706,
-0.024536820128560066,
0.03981074318289757,
-0.011060325428843498,
0.015407435595989227,
0.01775251515209675,
0.005767493974417448,
-0.02977375127375126,
-0.011783158406615257,
0.007205570582300425,
0.011415231041610241,
-0.0011615491239354014,
-0.06756413727998734,
-0.03161013871431351,
0.011686829850077629,
-0.004723802674561739,
0.0025478594470769167,
-0.03258726745843887,
-0.011608891189098358,
-0.03403517231345177,
0.016009507700800896,
0.028092563152313232,
-0.01273112278431654,
-0.05424575135111809,
-0.005078734364360571,
-0.08275742083787918,
0.041159067302942276,
-0.009770047850906849,
-0.01576206646859646,
-0.024595070630311966,
0.05677424371242523,
-0.011516896076500416,
-0.02129373699426651,
-0.04380105063319206,
0.06896314024925232,
-0.019554048776626587,
0.010826978832483292,
-0.028251396492123604,
-0.02515427954494953,
0.007771085947751999,
0.01866394467651844,
-0.01735590770840645,
0.001133945188485086,
-0.004819624125957489,
-0.6493695378303528,
0.015020914375782013,
-0.01722337119281292,
-0.024275554344058037,
0.007509519346058369,
-0.009620307944715023,
-0.04309269040822983,
-0.01609351858496666,
0.04670491814613342,
-0.004618150647729635,
-0.025429582223296165,
0.024070654064416885,
0.03817490488290787,
-0.022339778020977974,
-0.01574191451072693,
-0.04149019718170166,
-0.021320661529898643,
-0.029141077771782875,
0.03008868731558323,
0.0033057737164199352,
0.018357399851083755,
0.0032500086817890406,
0.010401895269751549,
0.0010991734452545643,
-0.038092076778411865,
-0.014772919937968254,
-0.041827503591775894,
0.010547496378421783,
-0.035630062222480774,
-0.024872900918126106,
-0.003023832105100155,
0.011522590182721615,
-0.0011890209279954433,
-0.02742670848965645,
-0.001119690714403987,
-0.00024601680343039334,
0.008495478890836239,
0.018507691100239754,
0.04000018909573555,
-0.004639295395463705,
-0.013085771352052689,
-0.05742892622947693,
-0.009429351426661015,
-0.04563158005475998,
-0.012413494288921356,
-0.024522198364138603,
0.04396713897585869,
-0.018736224621534348,
0.027383984997868538,
-0.0020164360757917166,
0.016383161768317223,
0.04450727254152298,
-0.00035201082937419415,
0.04209150746464729,
-0.0019761750008910894,
0.024424463510513306,
-0.0003461885207798332,
-0.01492367684841156,
0.009412589482963085,
0.017751364037394524,
0.02067210152745247,
-0.04471840336918831,
0.0004827004740945995,
0.009212641045451164,
-0.039974331855773926,
-0.008036196231842041,
0.03744211047887802,
0.015044876374304295,
-0.009023749269545078,
-0.02187347039580345,
-0.023059532046318054,
0.004756510723382235,
-0.013480507768690586,
0.018952934071421623,
-0.01010154653340578,
-0.008956280536949635,
0.01723942533135414,
-0.03028370998799801,
-0.021692834794521332,
0.011291864328086376,
0.010334158316254616,
-0.016935182735323906,
0.016406113281846046,
-0.025993678718805313,
0.026387130841612816,
-0.006107402499765158,
-0.020027032122015953,
-0.022182844579219818,
-0.005032679066061974,
0.01876857317984104,
-0.009508117102086544,
-0.021886980161070824,
-0.0090996865183115,
-0.00812225230038166,
0.004157580900937319,
0.03295357525348663,
0.03717399016022682,
-0.011301913298666477,
0.02826586365699768,
-0.017176229506731033,
0.03922879695892334,
-0.020130017772316933,
-0.01954440400004387,
-0.0026254544500261545,
-0.04063034430146217,
-0.023029623553156853,
-0.0005378985079005361,
-0.004430816043168306,
-0.0030214085709303617,
0.012146452441811562,
0.013199037872254848,
-0.013334878720343113,
-0.04457394406199455,
0.005870266817510128,
-0.016824087128043175,
-0.03595072776079178,
0.011876892298460007,
-0.016115454956889153,
-0.007850105874240398,
0.02251245267689228,
0.035096120089292526,
0.0002540754503570497,
0.0021832608617842197,
0.05698585510253906,
-0.056560833007097244,
-0.013781560584902763,
-0.04447949305176735,
-0.01777774840593338,
-0.010461795143783092,
0.04361597076058388,
-0.001247880863957107,
0.0672932043671608,
0.0037512050475925207,
0.032705411314964294,
0.006613865029066801,
-0.028688577935099602,
-0.02206571400165558,
0.005996124353259802,
0.051329322159290314,
-0.03986353054642677,
0.0027921495493501425,
0.008713488467037678,
-0.008891037665307522,
-0.02610170841217041,
0.029439499601721764,
-0.009791207499802113,
0.011974012479186058,
-0.011441140435636044,
-0.047484371811151505,
-0.030133681371808052,
-0.0037898935843259096,
0.056149981915950775,
0.0298911202698946,
0.023363566026091576,
-0.00837594736367464,
0.010912254452705383,
0.018352311104536057,
0.020506806671619415,
0.015959076583385468,
-0.009698227047920227,
0.022415703162550926,
-0.07859164476394653,
-0.050755660980939865,
0.0035700874868780375,
-0.013036772608757019,
0.0020305842626839876,
-0.003354005515575409,
0.051664553582668304,
0.02910649962723255,
0.007285224739462137,
0.012791674584150314,
-0.0613720566034317,
-0.029705680906772614,
0.006941878702491522,
0.032412994652986526,
-0.036183252930641174,
-0.009653402492403984,
-0.03176547586917877,
-0.014880596660077572,
0.015817321836948395,
0.042442746460437775,
0.016364576295018196,
-0.01818196289241314,
0.00797718483954668,
-0.0032719564624130726,
0.05215873196721077,
0.0076368036679923534,
-0.048981256783008575,
-0.02790108695626259,
-0.019523348659276962,
0.002211648738011718,
0.02301144041121006,
-0.016340063884854317,
0.02453427016735077,
-0.004032652825117111,
0.0077401334419846535,
-0.018620939925312996,
0.04686009883880615,
-0.001938464236445725,
-0.003367796540260315,
0.012138021178543568,
0.002374006435275078,
0.007903640158474445,
0.013500764966011047,
-0.020077364519238472,
-0.017124706879258156,
-0.02066061459481716,
0.05445608124136925,
-0.04898664727807045,
-0.039896074682474136,
-0.007685206364840269,
0.028723182156682014,
-0.011884044855833054,
0.016325708478689194,
0.04775209352374077,
0.006318316329270601,
0.0070601883344352245,
0.007840902544558048,
0.004079326055943966,
0.035239286720752716,
-0.054600778967142105,
0.0015099829761311412,
0.020280910655856133,
-0.010105702094733715,
-0.024420790374279022,
-0.0005894038476981223,
-0.028464235365390778,
0.03278248757123947,
-0.03416548669338226,
0.010865354910492897,
-0.008183925412595272,
-0.048835184425115585,
-0.0014817201299592853,
-0.02829909697175026,
0.05002078786492348,
0.01568264327943325,
-0.01523388922214508,
0.002322436310350895,
-0.03377237170934677,
0.017783863469958305,
0.00628782669082284,
-0.008049121126532555,
-0.022425763309001923,
0.043201591819524765,
0.0055868844501674175,
-0.0003969476674683392,
0.010599869303405285,
-0.0059995632618665695,
0.016719667240977287,
0.011059681884944439,
-0.02848738618195057,
-0.003986567258834839,
0.003904630895704031,
0.0158440712839365,
-0.024156805127859116,
0.06247260421514511,
0.010529070161283016,
0.028578605502843857,
0.02014329470694065,
0.01133041363209486,
-0.0016225691651925445,
-0.015549881383776665,
0.005627600941807032,
0.04462588205933571,
0.01420742180198431,
-0.004682960454374552,
0.014217559248209,
0.014966372400522232,
-0.03254975378513336,
0.007309073116630316,
0.006207700818777084,
-0.04698944091796875,
-0.019262412562966347,
0.008694954216480255,
0.010205824859440327,
-0.014336778782308102,
0.034701764583587646,
0.0037283345591276884,
0.001820627716369927,
-0.014307412318885326,
-0.010727787390351295,
0.0058306301943957806,
-0.0300808884203434,
0.023637915030121803,
-0.003116993699222803,
0.0048614987172186375,
0.07938980311155319,
0.0030387493316084146,
-0.04696885496377945,
0.012578461319208145,
-0.000047774250560905784,
-0.0008012638427317142,
0.016658591106534004,
0.005956094712018967,
-0.002727688290178776,
0.02252209186553955,
-0.0048764836974442005,
-0.03856883570551872,
0.016679178923368454,
0.008989580906927586,
0.012532845139503479,
-0.0044451504945755005,
0.02144799381494522,
0.009409472346305847,
-0.012903101742267609,
-0.005815038923174143,
-0.01224952656775713,
-0.02255154214799404,
0.016627004370093346,
-0.03777693957090378,
0.014218561351299286,
0.03189698979258537,
0.023115776479244232,
0.030906766653060913,
0.0014411471784114838,
0.05011092126369476,
0.013927173800766468,
0.04975518956780434,
0.001639180933125317,
0.016078326851129532,
-0.01923307403922081,
-0.026205478236079216,
0.0026391353458166122,
-0.04809323698282242,
0.013992151245474815,
-0.009737755171954632,
-0.0022304558660835028,
-0.04969797655940056,
0.00015389863983727992,
0.0875641405582428,
0.015572350472211838,
-0.03207321837544441,
0.0226310882717371,
0.0006203498924151063,
0.053230226039886475,
0.004474482964724302,
-0.02057010866701603,
-0.01468704268336296,
0.041946135461330414,
0.02073303982615471,
-0.02596660703420639,
-0.03636420890688896,
0.052720677107572556,
-0.02301628142595291,
0.021899322047829628,
0.007097720634192228,
0.032822806388139725,
-0.004021660890430212,
0.018179653212428093,
-0.018483612686395645,
-0.016668643802404404,
-0.009308543056249619,
-0.009039605967700481,
-0.004142222460359335,
0.010549359954893589,
0.005693336017429829,
-0.04882994294166565,
0.0017336771124973893,
-0.005851306952536106,
-0.0027859380934387445,
0.006190688349306583,
-0.02968171425163746,
-0.02791699767112732,
0.0018530827946960926,
-0.0567510686814785,
-0.014006408862769604,
0.014129707589745522,
-0.00506216287612915,
-0.005643621552735567,
-0.01179120410233736,
-0.011708265170454979,
-0.04311332479119301,
0.008905099704861641,
0.03833196684718132,
0.0035771713592112064,
0.008588085882365704,
-0.03100740723311901,
-0.013819877058267593,
0.051911093294620514,
0.009019454941153526,
-0.06735492497682571,
-0.030397841706871986,
-0.03175671771168709,
-0.04674312472343445,
0.017343932762742043,
-0.014112142845988274,
0.02682563103735447,
0.013877231627702713,
-0.02114740014076233,
-0.011655590496957302,
0.017598764970898628,
-0.03475716710090637,
0.04125586524605751,
0.02619180642068386,
-0.019460512325167656,
-0.0006875905091874301,
-0.027003943920135498,
-0.006401718128472567,
-0.03926881030201912,
-0.03340274840593338,
-0.0324409082531929,
0.011480619199573994,
0.0021387299057096243,
0.02236047200858593,
0.03578735515475273,
-0.00905439630150795,
-0.00492500327527523,
0.023356320336461067,
0.019866393879055977,
-0.007058457005769014,
-0.03481101989746094,
-0.03142257034778595,
-0.015834880992770195,
-0.017350636422634125,
0.03157645836472511,
0.007555353920906782,
0.03457421064376831,
-0.012925144284963608,
-0.020602891221642494,
-0.008818927221000195,
-0.0025823921896517277,
0.03513165935873985,
0.011019619181752205,
-0.0399811826646328,
-0.012631896883249283,
-0.004945339635014534,
0.0031108499970287085,
0.002417161362245679,
0.009947200305759907,
0.003791400697082281,
-0.029286880046129227,
0.017466334626078606,
0.005248167086392641,
-0.017065124586224556,
0.02045096829533577,
0.02638181485235691,
-0.02429538406431675,
-0.021025553345680237,
-0.04864375293254852,
0.014993160963058472,
-0.017395492643117905,
-0.028953664004802704,
-0.04107506945729256,
0.02615584060549736,
-0.01286061480641365,
-0.12648944556713104,
-0.008211582899093628,
-0.005388004705309868,
0.017729349434375763,
0.03231845796108246,
-0.005044256336987019,
0.001954952022060752,
0.051107365638017654,
-0.00709399301558733,
-0.004521274473518133,
0.040679071098566055,
0.01099630817770958,
-0.012100380845367908,
-0.012204496189951897,
-0.025676896795630455,
0.03937464579939842,
0.011991748586297035,
-0.0049257525242865086,
0.031115110963582993,
-0.0689365565776825,
-0.005007536616176367,
0.0541238859295845,
-0.0013254026416689157,
0.016970254480838776,
-0.012096595019102097,
0.03586631268262863,
0.03034846857190132,
0.0064175548031926155,
-0.02479744330048561,
0.017479702830314636,
0.014641610905528069,
0.012516067363321781,
0.045215919613838196,
0.006976685021072626,
0.02413204498589039,
-0.028113191947340965,
0.0012575499713420868,
0.03656356781721115,
0.0289753545075655,
-0.014936900697648525,
-0.01973351277410984,
-0.05705699324607849,
0.002090230118483305,
0.0170365609228611,
-0.006688041612505913,
0.003913900814950466,
0.009560838341712952,
-0.004294986836612225,
-0.011089145205914974,
0.03429938107728958,
-0.013237797655165195,
-0.004846886731684208,
-0.06092916429042816,
0.003672997932881117,
-0.02255643531680107,
0.004536049906164408,
0.04888391122221947,
0.016493234783411026,
-0.0001744470646372065,
0.004190471954643726,
0.014522016048431396,
-0.0050638336688280106,
0.011907997541129589,
-0.0007411151891574264,
-0.026768123731017113,
-0.00888759084045887,
-0.026058213785290718,
-0.0008381977677345276,
0.025851648300886154,
0.0021157185547053814,
-0.006719954777508974,
0.012460452504456043,
-0.07621321827173233,
0.019850753247737885,
0.004761132411658764,
0.0030953348614275455,
-0.04772082343697548,
-0.02045382745563984,
0.01657246984541416,
-0.03072129562497139,
-0.03379074111580849,
-0.0112313162535429,
-0.0350528247654438,
-0.0038380902260541916,
-0.0063368184491992,
0.0040574041195213795,
0.005781220737844706,
-0.026779018342494965,
-0.006710636895149946,
0.05415378138422966,
-0.0011326594976708293,
0.03187219426035881,
-0.017113791778683662,
-0.02457265928387642,
-0.0047445148229599,
0.007031590677797794,
-0.03509877994656563,
0.016154183074831963,
-0.016027309000492096,
-0.009573669172823429,
0.016341056674718857,
-0.010720114223659039,
-0.03334040194749832,
0.004606123548001051,
-0.0007680105627514422,
0.025954347103834152,
0.07113625854253769,
-0.004284084774553776,
0.032562896609306335,
0.029325146228075027,
-0.05122705549001694,
-0.019976863637566566,
0.0007763013709336519,
-0.024605896323919296,
0.0097748301923275,
0.021496286615729332,
0.0067697507329285145
] |
8a5ab5ed3f3ad80694d11c3e4b2aca3d095ca892 | 2,400 | py | Python | python/ray/rllib/ddpg2/ddpg_evaluator.py | songqing/ray | 166000b089ee15d44635ebca00f12320f51ce587 | [
"Apache-2.0"
] | 1 | 2018-06-25T08:00:51.000Z | 2018-06-25T08:00:51.000Z | python/ray/rllib/ddpg2/ddpg_evaluator.py | songqing/ray | 166000b089ee15d44635ebca00f12320f51ce587 | [
"Apache-2.0"
] | 1 | 2018-01-26T05:11:04.000Z | 2018-01-26T05:11:04.000Z | python/ray/rllib/ddpg2/ddpg_evaluator.py | songqing/ray | 166000b089ee15d44635ebca00f12320f51ce587 | [
"Apache-2.0"
] | 1 | 2020-10-16T08:42:32.000Z | 2020-10-16T08:42:32.000Z | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import ray
from ray.rllib.ddpg2.models import DDPGModel
from ray.rllib.models.catalog import ModelCatalog
from ray.rllib.optimizers import PolicyEvaluator
from ray.rllib.utils.filter import NoFilter
from ray.rllib.utils.process_rollout import process_rollout
from ray.rllib.utils.sampler import SyncSampler
class DDPGEvaluator(PolicyEvaluator):
def __init__(self, registry, env_creator, config):
self.env = ModelCatalog.get_preprocessor_as_wrapper(
registry, env_creator(config["env_config"]))
# contains model, target_model
self.model = DDPGModel(registry, self.env, config)
self.sampler = SyncSampler(
self.env, self.model.model, NoFilter(),
config["num_local_steps"], horizon=config["horizon"])
def sample(self):
"""Returns a batch of samples."""
rollout = self.sampler.get_data()
rollout.data["weights"] = np.ones_like(rollout.data["rewards"])
# since each sample is one step, no discounting needs to be applied;
# this does not involve config["gamma"]
samples = process_rollout(
rollout, NoFilter(),
gamma=1.0, use_gae=False)
return samples
def update_target(self):
"""Updates target critic and target actor."""
self.model.update_target()
def compute_gradients(self, samples):
"""Returns critic, actor gradients."""
return self.model.compute_gradients(samples)
def apply_gradients(self, grads):
"""Applies gradients to evaluator weights."""
self.model.apply_gradients(grads)
def compute_apply(self, samples):
grads, _ = self.compute_gradients(samples)
self.apply_gradients(grads)
def get_weights(self):
"""Returns model weights."""
return self.model.get_weights()
def set_weights(self, weights):
"""Sets model weights."""
self.model.set_weights(weights)
def get_completed_rollout_metrics(self):
"""Returns metrics on previously completed rollouts.
Calling this clears the queue of completed rollout metrics.
"""
return self.sampler.get_metrics()
RemoteDDPGEvaluator = ray.remote(DDPGEvaluator)
| 31.578947 | 77 | 0.675417 | 1 | 1.3491 | [
0.00011158996494486928,
0.022775156423449516,
0.007901155389845371,
-0.0003546552325133234,
0.0046990420669317245,
-0.0020395980682224035,
-0.008191598579287529,
0.0022198669612407684,
-0.007625873200595379,
0.002506945049390197,
0.00008591121877543628,
0.005455400794744492,
0.006937806960195303,
-0.015550881624221802,
-0.00020293396664783359,
0.014930931851267815,
-0.05206279456615448,
0.0009229010320268571,
-0.0050655691884458065,
0.002327547874301672,
-0.008455432020127773,
0.009653721936047077,
0.01028869766741991,
0.00872726272791624,
0.005297601688653231,
-0.0004401274782139808,
0.009406660683453083,
0.0037849810905754566,
-0.008719587698578835,
-0.006584834307432175,
-0.002621655585244298,
-0.001041506533510983,
-0.007145989686250687,
-0.006816442124545574,
0.0054932646453380585,
-0.004167552571743727,
-0.0008935975492931902,
-0.020239198580384254,
0.012544860132038593,
-0.006356077268719673,
-0.004276649560779333,
-0.013190126046538353,
-0.001305553363636136,
0.004824276082217693,
-0.007336312904953957,
0.00170980638358742,
-0.0027167911175638437,
0.0037221300881356,
-0.008966220542788506,
0.006883459631353617,
-0.010081986896693707,
0.0074913944117724895,
0.011728087440133095,
0.0033723546657711267,
-0.006169527303427458,
-0.006016656756401062,
0.013620877638459206,
0.0016378459986299276,
-0.009536058641970158,
-0.00041962627437897027,
-0.004643636755645275,
-0.0025889347307384014,
0.004144922364503145,
0.0024325153790414333,
-0.014695988036692142,
-0.007355852052569389,
-0.004727309104055166,
0.0028423897456377745,
-0.0005441620014607906,
0.005407312884926796,
0.001681976835243404,
-0.0016912211431190372,
0.0056110830046236515,
0.0039933230727910995,
0.004570213612169027,
-0.005231199320405722,
-0.0015213449951261282,
-0.00043272486072964966,
0.011672761291265488,
0.002399289049208164,
0.0028178344946354628,
-0.006271203514188528,
0.003713753307238221,
0.009475357830524445,
0.01468890905380249,
0.011078836396336555,
0.017076320946216583,
-0.011134970001876354,
0.04614804685115814,
0.007214969489723444,
-0.009649616666138172,
0.0022518523037433624,
-0.010968363843858242,
-0.0005152240628376603,
-0.00473037688061595,
-0.02515505626797676,
0.000464527343865484,
-0.004062267951667309,
-0.0018612616695463657,
0.0036805151030421257,
-0.000389832683140412,
0.006344967987388372,
-0.0006122369668446481,
-0.004164273384958506,
-0.008715622127056122,
0.0076982565224170685,
-0.008144674822688103,
-0.0026774313300848007,
0.005151489749550819,
0.0026224900502711535,
-0.01000125426799059,
-0.001938378787599504,
0.001200085855089128,
-0.011602360755205154,
0.002972713904455304,
0.002328096888959408,
-0.007768250070512295,
0.05189445614814758,
-0.0004244535812176764,
0.002655526390299201,
-0.005432362202554941,
0.001353097497485578,
0.0007222016574814916,
0.006614722777158022,
0.010287372395396233,
-0.0034058683086186647,
0.010616536252200603,
0.008623630739748478,
0.0032926846761256456,
0.008347570896148682,
-0.003485930385068059,
0.007561185862869024,
-0.0031085286755114794,
-0.0018803193233907223,
-0.001697803265415132,
-0.007260542828589678,
0.008699599653482437,
-0.0007285751635208726,
-0.008483079262077808,
0.001661266083829105,
-0.0005615413538180292,
-0.009116111323237419,
0.0015721370000392199,
-0.005136914551258087,
0.0054664211347699165,
-0.010947443544864655,
-0.0033397062215954065,
-0.0039857616648077965,
-0.0036843556445091963,
0.003952940460294485,
0.007860113866627216,
0.005574628245085478,
0.0025609969161450863,
-0.0067615145817399025,
-0.009895040653645992,
0.0006346512818709016,
-0.004618973936885595,
0.0023249650839716196,
0.009940655902028084,
0.0038811408448964357,
-0.010396886616945267,
-0.0024278205819427967,
0.001064200303517282,
0.0028235220815986395,
-0.0012988150119781494,
0.0023257790599018335,
-0.008211732842028141,
0.005852953530848026,
0.0014924537390470505,
0.0033425698056817055,
0.011840245686471462,
-0.004310439806431532,
0.0005775144090875983,
-0.0016508885892108083,
0.00041459311614744365,
-0.0014442882966250181,
0.0057139587588608265,
0.009717508219182491,
-0.0019383066100999713,
-0.005059018265455961,
0.002184205921366811,
0.005107139702886343,
0.0116182342171669,
0.005747638177126646,
-0.005296424031257629,
0.0029446203261613846,
-0.00482225650921464,
0.000026834095478989184,
0.006339681334793568,
-0.0055647483095526695,
0.004465585108846426,
0.0033656968735158443,
-0.012945706956088543,
-0.008925153873860836,
-0.0010394877754151821,
-0.008003736846148968,
0.0012586248340085149,
0.012660251930356026,
0.00982174277305603,
-0.0011827292619273067,
0.0037364456802606583,
-0.008062554523348808,
0.000793608371168375,
0.007909595966339111,
0.0029708249494433403,
-0.012789865955710411,
-0.9603425860404968,
0.0062455423176288605,
0.003030693158507347,
-0.002878188621252775,
0.005337006412446499,
0.003763325046747923,
0.004919102415442467,
0.0021694698370993137,
0.013026266358792782,
-0.010874568484723568,
-0.0063486057333648205,
-0.008392861112952232,
-0.01054889615625143,
-0.0021459506824612617,
-0.007507898844778538,
-0.0032666486222296953,
-0.005674125626683235,
-0.006856563035398722,
-0.0035793965216726065,
-0.0035365454386919737,
-0.002653920790180564,
0.007255575153976679,
-0.002817535074427724,
0.0064766667783260345,
0.00247132102958858,
0.001661124057136476,
-0.0031627672724425793,
-0.0031499979086220264,
-0.0031368534546345472,
-0.0037929515819996595,
-0.005535655654966831,
-0.015691537410020828,
-0.0023159468546509743,
-0.0021693662274628878,
0.00959896668791771,
-0.0017110452754423022,
0.009216771461069584,
-0.0017138500697910786,
0.004546998534351587,
-0.008561876602470875,
0.005034781526774168,
-0.00097380526131019,
0.003942869603633881,
-0.02906056120991707,
-0.0019305519526824355,
-0.0013287293259054422,
-0.008317512460052967,
0.006733819842338562,
-0.001691574463620782,
-0.0010783503530547023,
-0.002176538808271289,
-0.006712308619171381,
0.01011078990995884,
-0.006254745181649923,
0.004299737047404051,
-0.005193959455937147,
-0.008107244968414307,
-0.0021748256403952837,
-0.006268290337175131,
0.0013480059569701552,
0.0031526454258710146,
-0.005527510307729244,
-0.0040678163059055805,
-0.0029398109763860703,
0.0018405616283416748,
0.0029450315050780773,
0.0025350479409098625,
-0.0176291111856699,
-0.007205350790172815,
-0.0005773454904556274,
0.0028319063130766153,
-0.003317630849778652,
-0.003862574463710189,
0.006750022992491722,
-0.0081279082223773,
0.004623433109372854,
0.0018956790445372462,
0.0009614733280614018,
-0.011563255451619625,
0.0008462221012450755,
-0.010695557110011578,
-0.007689785212278366,
0.001997654791921377,
-0.004859945271164179,
-0.004349889233708382,
-0.00004158915544394404,
0.0017073573544621468,
0.0068459464237093925,
-0.005312563385814428,
0.002591079566627741,
0.011065629310905933,
-0.003914843779057264,
-0.008297592401504517,
0.005048196297138929,
0.008174670860171318,
0.001307161757722497,
-0.0029133071657270193,
0.002809191355481744,
0.008283822797238827,
0.006797958631068468,
0.0023280158638954163,
0.006409242749214172,
0.0005290125263854861,
0.008770685642957687,
-0.00012421283463481814,
0.0019678729586303234,
-0.0008429819718003273,
0.0003031357773579657,
-0.00448963837698102,
-0.002211798680946231,
-0.004570061806589365,
-0.004706197418272495,
-0.012972041964530945,
-0.008033784106373787,
-0.006633202079683542,
0.00012862207950092852,
0.0014988218899816275,
-0.003068977501243353,
-0.0011772119905799627,
0.0017275112913921475,
0.008277383632957935,
-0.0003125922230537981,
-0.0029472855385392904,
-0.00010375058627687395,
0.003250974928960204,
-0.006204870995134115,
0.012931338511407375,
-0.011635515838861465,
0.00827733427286148,
-0.0008387595880776644,
-0.014623729512095451,
0.004593670833855867,
0.007283455692231655,
-0.009477595798671246,
0.0025222771801054478,
0.0008847893332131207,
0.0021601964253932238,
0.000058289711887482554,
-0.002726559294387698,
-0.0017782826907932758,
-0.01655641198158264,
-0.0015074975090101361,
0.018107986077666283,
0.0006733066984452307,
0.0099880276247859,
0.012041900306940079,
-0.0027389288879930973,
0.0033801537938416004,
0.0024880245327949524,
0.000928499037399888,
0.013264589011669159,
-0.009517542086541653,
0.001218305085785687,
0.001153507735580206,
-0.0043125818483531475,
0.002841564128175378,
0.00712361466139555,
0.004325730260461569,
-0.003909922670572996,
0.0027708117850124836,
-0.005630101077258587,
-0.003914110362529755,
-0.019452890381217003,
-0.0022109851706773043,
0.00844140537083149,
-0.004963240120559931,
0.006646147929131985,
-0.00951167568564415,
0.0041345697827637196,
0.0061266180127859116,
0.002334192395210266,
0.0004532230959739536,
-0.0003786815796047449,
0.005837153643369675,
0.011712577193975449,
-0.006898512598127127,
0.0008641293388791382,
0.003916413523256779,
-0.001252701273187995,
-0.00039736955659464,
0.007526228670030832,
-0.005091613158583641,
-0.005838169250637293,
0.0032130891922861338,
0.004287384450435638,
0.0007165371207520366,
-0.0039223358035087585,
-0.00819868128746748,
-0.0036351527087390423,
0.00323720695450902,
-0.004510834347456694,
0.004457850009202957,
0.0013864856446161866,
0.002860626205801964,
-0.0069550564512610435,
-0.0009515229612588882,
-0.0034110897686332464,
-0.012677482329308987,
0.011032911017537117,
-0.005186022724956274,
0.004129677079617977,
0.014207825995981693,
0.0031745180021971464,
-0.012864959426224232,
0.00833929143846035,
0.009873563423752785,
-0.004049910698086023,
0.0037764913868159056,
0.005405274219810963,
-0.0041229501366615295,
-0.020770834758877754,
-0.002901629777625203,
-0.012125931680202484,
0.006361644249409437,
-0.0010252436622977257,
0.0021979056764394045,
-0.00620636623352766,
0.00897614099085331,
0.0055792913772165775,
-0.01510106772184372,
-0.003354122629389167,
-0.00852555688470602,
0.006149379536509514,
0.00017715779540594667,
-0.000010401554391137324,
-0.002554492326453328,
-0.0035963887348771095,
-0.001428326591849327,
-0.0030835496727377176,
-0.0019805331248790026,
0.004617320839315653,
0.0008846436976455152,
-0.0034944326616823673,
0.002452070591971278,
-0.005298906937241554,
0.0014817871851846576,
-0.0009541839826852083,
-0.009877817705273628,
0.002396290423348546,
0.003699434921145439,
-0.0013720657443627715,
-0.001728156115859747,
0.0018928907811641693,
-0.0024377277586609125,
-0.005706710275262594,
-0.011807014234364033,
-0.0074256486259400845,
-0.003950733691453934,
-0.004099682904779911,
-0.01064188964664936,
-0.0033132240641862154,
-0.009241314604878426,
0.007213562726974487,
-0.005964718293398619,
0.008817818015813828,
0.00478771235793829,
-0.006443927530199289,
0.005114443600177765,
-0.0003691361052915454,
0.003438257845118642,
0.003162670647725463,
0.004597852006554604,
-0.000057334258599439636,
-0.007170204073190689,
-0.007749789860099554,
0.010595791973173618,
-0.009952103719115257,
0.0021711201407015324,
0.014307674951851368,
0.003334022592753172,
0.009708709083497524,
0.00009814864461077377,
-0.0008213936816900969,
0.004021024331450462,
0.006570692174136639,
-0.014461268670856953,
0.0031690874602645636,
-0.0033304262906312943,
0.00043219205690547824,
0.004815563093870878,
-0.003076510038226843,
0.0027696886099874973,
0.007825818844139576,
0.00434676930308342,
-0.005144128575921059,
-0.00003224388638045639,
0.0015506428899243474,
0.0031682841945439577,
-0.011003068648278713,
0.0015493608079850674,
-0.0017706564394757152,
-0.0018978870939463377,
-0.002338637597858906,
-0.0021137853618711233,
-0.000052018120186403394,
0.004546990152448416,
-0.0012791280169039965,
0.004961004946380854,
0.003975010942667723,
-0.005579032935202122,
0.015027467161417007,
-0.00571822514757514,
-0.004670392256230116,
0.0019625620916485786,
0.002470357110723853,
-0.004178859293460846,
-0.0071113221347332,
-0.0008753367583267391,
0.0019613811746239662,
0.0064397165551781654,
-0.0026295240968465805,
-0.0026800488121807575,
-0.0029948533046990633,
0.0011598283890634775,
-0.01112948264926672,
0.0006471901433542371,
0.012264863587915897,
-0.0049289227463305,
0.004900477360934019,
-0.0024216938763856888,
-0.005551227368414402,
-0.010998675599694252,
0.05406559258699417,
-0.00037797936238348484,
0.00337066687643528,
0.004222937859594822,
-0.009152108803391457,
-0.0003885602636728436,
-0.0023177326656877995,
0.007524420041590929,
-0.005198260303586721,
-0.008196081966161728,
0.007915234193205833,
-0.004013548605144024,
0.0033386945724487305,
0.0041920701041817665,
-0.0012818191898986697,
0.015574461780488491,
-0.0014613047242164612,
-0.016965225338935852,
-0.01619141735136509,
0.0096475500613451,
-0.003647875040769577,
-0.006688023451715708,
0.011222016997635365,
-0.0010952095035463572,
-0.004451758228242397,
0.00044886881369166076,
0.006969593930989504,
0.00013477324682753533,
-0.0008227657526731491,
-0.0027654992882162333,
-0.0019918931648135185,
-0.0022014824207872152,
0.003216362791135907,
0.006092209834605455,
0.006493271794170141,
-0.0033731816802173853,
0.0045647467486560345,
-0.0001902158692246303,
-0.0003071110404562205,
-0.0019098729826509953,
0.005537199787795544,
0.004552277270704508,
0.00004916079342365265,
-0.0008300620247609913,
0.006796211935579777,
0.004718497861176729,
0.002718494273722172,
0.01078831683844328,
0.0007672123028896749,
-0.006143750157207251,
0.009168625809252262,
0.00775947654619813,
0.0005283908103592694,
0.0079903369769454,
0.0010396370198577642,
0.0068331570364534855,
0.0005503062275238335,
-0.006929329130798578,
-0.013598808087408543,
0.000543752103112638,
0.009268857538700104,
0.006516023073345423,
-0.0011747151147574186,
0.0011778842890635133,
-0.0012077671708539128,
-0.0017204235773533583,
-0.0066645885817706585,
-0.00807820726186037,
-0.004910578019917011,
0.001226210268214345,
0.0031142085790634155,
0.06982795149087906,
-0.006602597888559103,
-0.0017392449080944061,
-0.009458659216761589,
0.0009055181872099638,
-0.003440527245402336,
-0.0015669233398512006,
-0.0014238727744668722,
-0.0011102702701464295,
0.0018439413979649544,
0.0016964890528470278,
-0.009259884245693684,
-0.011460205540060997,
0.0009508506045676768,
0.000038664587918901816,
-0.001615217188373208,
0.003195694414898753,
0.005749798379838467,
-0.006403487175703049,
0.0014019428053870797,
-0.010600445792078972,
-0.003189068753272295,
-0.0032175066880881786,
-0.009639725089073181,
-0.004946966655552387,
-0.0027996411081403494,
0.0049836598336696625,
0.001145675778388977,
0.006836616899818182,
-0.002634909935295582,
0.008099674247205257,
-0.0020267425570636988,
-0.0007103793323040009,
-0.0030582097824662924,
0.00029395634192042053,
-0.007226396817713976,
0.008973183110356331,
0.002420109463855624,
-0.01178037840873003,
-0.004333470482379198,
0.0011930932523682714,
-0.0005519763799384236,
-0.0050447252579033375,
0.0044729807414114475,
0.002205329481512308,
0.00675953971222043,
-0.004632897675037384,
0.0012999315513297915,
-0.006634858902543783,
0.0034574682358652353,
-0.012491499073803425,
0.005461851134896278,
-0.16938717663288116,
0.010709206573665142,
0.003473378252238035,
-0.00460371607914567,
-0.0037440715823322535,
-0.014195689931511879,
-0.006131165660917759,
0.004968313965946436,
0.009387616999447346,
0.0023267960641533136,
-0.0008060015388764441,
-0.0013575379271060228,
0.004614586476236582,
0.005090679042041302,
-0.00037838879507035017,
-0.006043890956789255,
0.004465106874704361,
-0.005487585905939341,
0.00019892826094292104,
0.004069776274263859,
0.003556591458618641,
0.009187459014356136,
0.00020401754591148347,
0.0023392329458147287,
-0.002739792224019766,
-0.0035367023665457964,
0.004866246599704027,
-0.001678945729508996,
0.0062864706851542,
-0.010789407417178154,
-0.0026781964115798473,
-0.0037988482508808374,
-0.0032123762648552656,
0.002270679920911789,
0.003434996120631695,
0.000847549585159868,
0.009552441537380219,
0.0025482128839939833,
-0.006854238919913769,
0.005158217623829842,
-0.007417689543217421,
0.029228394851088524,
0.0057957954704761505,
0.00802761409431696,
0.0011412589810788631,
-0.005601605866104364,
-0.0038108762819319963,
0.008920209482312202,
0.002743504475802183,
0.009996929205954075,
-0.014937689527869225,
-0.0009088536025956273,
0.0025242220144718885,
0.01751093566417694,
-0.0053748395293951035,
-0.008939518593251705,
-0.00623380858451128,
-0.002015643287450075,
0.0022153123281896114,
0.007965248078107834,
0.009783906862139702,
-0.0032882376108318567,
0.008101262152194977,
-0.0025233665946871042,
-0.021403826773166656,
0.0020947607699781656,
-0.004365116357803345,
-0.007650895044207573,
0.0024129452649503946,
0.007731670048087835,
0.009180637076497078,
0.00015436926332768053,
-0.0013988025020807981,
-0.00006844176823506132,
0.006544358562678099,
0.000650067871902138,
0.006059760227799416,
-0.000264907896053046,
0.002144097350537777,
-0.009048023261129856,
0.007681125774979591,
-0.009611954912543297,
-0.0035053021274507046,
0.0015753790503367782,
-0.004743204452097416,
0.012068614363670349,
0.004423389211297035,
-0.0024595463182777166,
-0.0011292906710878015,
-0.0077462587505578995,
-0.003615038236603141,
0.002012044657021761,
0.00040901999454945326,
-0.010952096432447433,
0.0018234449671581388,
0.001574650639668107,
0.004974434617906809,
0.007366576697677374,
-0.009726577438414097,
0.007892162539064884,
0.004613649100065231,
-0.006799749564379454,
0.00017809784912969917,
-0.0026068424340337515,
-0.00017380795907229185,
0.003908757586032152,
-0.005157007835805416,
-0.005459475796669722,
0.0033909280318766832,
-0.00689761433750391,
-0.007609045132994652,
0.004816695582121611,
-0.009994061663746834,
-0.00969422422349453,
-0.0011261400068178773,
-0.011066649109125137,
-0.0004942166851833463
] |
8a5d2dc08b304db2757537f331d99b9fccf16fe7 | 3,064 | py | Python | python/sysmap/graph.py | harryherold/sysmap | 293e5f0dc22ed709c8fd5c170662e433c039eeab | [
"BSD-3-Clause"
] | 1 | 2020-05-08T13:55:31.000Z | 2020-05-08T13:55:31.000Z | python/sysmap/graph.py | harryherold/sysmap | 293e5f0dc22ed709c8fd5c170662e433c039eeab | [
"BSD-3-Clause"
] | 3 | 2020-01-16T10:30:28.000Z | 2020-01-27T11:23:49.000Z | python/sysmap/graph.py | harryherold/sysmap | 293e5f0dc22ed709c8fd5c170662e433c039eeab | [
"BSD-3-Clause"
] | 1 | 2020-01-16T09:08:14.000Z | 2020-01-16T09:08:14.000Z | from graphviz import Digraph
from collections import namedtuple
class NetworkGraph:
''' Representation of the network connections.
This class contains the entities in the network e.g. hosts or switches.
And the connections between them.
'''
Vertex = namedtuple('Vertexes', ['hosts', 'switches'])
_edges = []
def _sanitize_edge_connection(self, edge):
''' Update '_to' and '_form' field of a edge.
:param edge: One edge connection.
:type edge: dict
:returns: Updated edge with _to and _from key.
:rtype: dict
'''
if edge['to_guid'].startswith('S'):
to_collection = 'switches/'
elif edge['to_guid'].startswith('H'):
to_collection = 'hosts/'
if edge['from_guid'].startswith('S'):
from_collection = 'switches/'
elif edge['from_guid'].startswith('H'):
from_collection = 'hosts/'
edge.update({
'_to': to_collection + edge['to_guid'],
'_from': from_collection + edge['from_guid']
})
return edge
def _sanitize_vertexes(self, vertex):
''' Update '_key' field of vertex to appropriate guid.
:param vertex: Vertex
:type vertex: dict
:returns: An updated dict, '_key' field with 'guid' value.
:rtype: dict
'''
vertex.update({'_key': vertex['guid']})
return vertex
def __init__(self, hsts=None, switches=None, connections=None):
self._vertexes = self.Vertex(hosts=[self._sanitize_vertexes(h) for h in hsts],
switches=[self._sanitize_vertexes(s) for s in switches])
self._edges = [self._sanitize_edge_connection(c) for c in connections]
@property
def vertexes(self):
''' Returns a concatenated list of all vertexes.
:returns: List of vertexes, contains of hosts and switches.
:rtype: List[dict]
'''
return self._vertexes.hosts + self._vertexes.switches
@property
def switches(self):
''' Returns a list of all 'switch' vertexes.
:returns: List of all switches.
:rtype: List[dict]
'''
return self._vertexes.switches
@property
def hosts(self):
''' Returns a list of all 'host' vertexes.
:returns: List of all hosts.
:rtype: List[dict]
'''
return self._vertexes.hosts
@property
def edges(self):
''' Return a list of all 'connection' edges.
:returns: List of all connections.
:rtype: List[dict]
'''
return self._edges
def to_graph(self, graphargs):
''' Draw a dot graph of the network graph.
:params graphargs: Arguments to graphviz.Digraph.
:type graphargs: dict
'''
graph = Digraph(**graphargs)
for v in self._vertexes:
graph.node(v['guid'], v['description'])
for c in self._edges:
graph.edge(c['from_guid'], c['to_guid'])
graph.render()
| 29.461538 | 92 | 0.582572 | 1 | 1.6686 | [
0.0025143639650195837,
0.026378480717539787,
0.007420687470585108,
-0.001372820814140141,
0.005233238451182842,
-0.002542268019169569,
-0.010644554160535336,
0.0023177978582680225,
-0.004964552354067564,
0.004374227952212095,
0.00393650820478797,
0.003970499616116285,
0.008514639921486378,
-0.01638636738061905,
0.0012708675349131227,
0.016944335773587227,
-0.050606194883584976,
0.0022029373794794083,
-0.0034865555353462696,
0.0006327212322503328,
-0.008283567614853382,
0.008488744497299194,
0.010122759267687798,
0.008880619890987873,
0.008022181689739227,
0.002103096805512905,
0.007978725247085094,
0.0029974409844726324,
-0.007776475511491299,
-0.005402124021202326,
-0.0011200129520148039,
-0.0023115312214940786,
-0.003898972412571311,
-0.006722168065607548,
0.007114836480468512,
-0.003551672911271453,
-0.0008988436893559992,
-0.019855163991451263,
0.013153379783034325,
-0.005098769906908274,
-0.0067966775968670845,
-0.018032463267445564,
-0.0028620788361877203,
0.003239047946408391,
-0.008902447298169136,
0.0012625805102288723,
-0.004366643726825714,
0.002684888197109103,
-0.011188586242496967,
0.006418012082576752,
-0.01050251442939043,
0.005949878133833408,
0.013893859460949898,
0.001515790936537087,
-0.006983155384659767,
-0.008246690966188908,
0.01225257758051157,
0.0016108646523207426,
-0.011257579550147057,
-0.00015690313011873513,
-0.0006054361001588404,
-0.003208661451935768,
0.006662864703685045,
0.0037409665528684855,
-0.016692642122507095,
-0.007379457820206881,
-0.0049957893788814545,
0.0031959146726876497,
0.00011777803592849523,
0.004908375442028046,
0.0011777214240282774,
-0.0005419882945716381,
0.007773965131491423,
0.004655723925679922,
0.005140672903507948,
-0.0029848418198525906,
-0.001103722956031561,
0.001452410127967596,
0.007473204750567675,
0.0044471039436757565,
0.0025161555968225002,
-0.005902784410864115,
0.006414793431758881,
0.00954466313123703,
0.014228114858269691,
0.009335986338555813,
0.01974707655608654,
-0.012822630815207958,
0.046957388520240784,
0.007213205099105835,
-0.009808870032429695,
0.0032443231903016567,
-0.009564303793013096,
-0.0017729977844282985,
-0.00022315679234452546,
-0.027174705639481544,
0.0010832303669303656,
-0.004926153924316168,
0.00047115673078224063,
0.002486464800313115,
-0.0007180929533205926,
0.005661475006490946,
-0.0012069866061210632,
-0.0002763981174211949,
-0.010150930844247341,
0.011962505988776684,
-0.010651319287717342,
-0.003632286097854376,
0.0070498003624379635,
-0.0002617143327370286,
-0.009297781623899937,
-0.002742981305345893,
0.0016236052615568042,
-0.012345262803137302,
0.0013607641449198127,
0.0015633286675438285,
-0.00554405665025115,
0.055997468531131744,
-0.000802213849965483,
0.005886677652597427,
-0.004982984624803066,
-0.00003161978384014219,
-0.0007588399457745254,
0.005644535180181265,
0.008599499240517616,
-0.0034645022824406624,
0.010842671617865562,
0.00691771786659956,
0.003003817517310381,
0.008910968899726868,
-0.0035862126387655735,
0.007833505980670452,
-0.006485738791525364,
-0.002091530244797468,
0.00013065939128864557,
-0.008122044615447521,
0.005662354175001383,
-0.0018965015187859535,
-0.0068603805266320705,
0.0008945980225689709,
-0.0009118475136347115,
-0.01197664625942707,
0.0019962370861321688,
-0.004160552751272917,
0.0016990109579637647,
-0.01339400839060545,
-0.0032454924657940865,
-0.0029463437385857105,
-0.003942316398024559,
0.002707532374188304,
0.010184621438384056,
0.0039077396504580975,
0.001175945857539773,
-0.0025701511185616255,
-0.009350272826850414,
-0.0005971419159322977,
-0.006455420050770044,
0.0028813076205551624,
0.008439259603619576,
0.003181037027388811,
-0.01104115042835474,
-0.0005229715607129037,
0.002328060334548354,
0.0025284832809120417,
-0.0011668901424854994,
0.0054081156849861145,
-0.007245675195008516,
0.008679015561938286,
0.00023706196225248277,
0.00408994872123003,
0.012147389352321625,
-0.007632628083229065,
0.00014313793508335948,
0.00021761369134765118,
0.002338903024792671,
0.0010191182373091578,
0.0032187083270400763,
0.008650471456348896,
-0.0021689243149012327,
-0.005096212960779667,
0.005888973828405142,
0.005247245542705059,
0.009068064391613007,
0.004396641626954079,
-0.0030885532032698393,
0.0007037685718387365,
-0.005170757882297039,
-0.0026270938105881214,
0.00736995879560709,
-0.0044997334480285645,
0.005033092573285103,
0.005750342272222042,
-0.01653182879090309,
-0.008612100966274738,
0.00017576631216797978,
-0.009642030112445354,
0.00017126306192949414,
0.015883494168519974,
0.01146848127245903,
-0.004458967130631208,
0.004132198169827461,
-0.00906860176473856,
0.0017982209101319313,
0.006658326368778944,
0.001726652611978352,
-0.013427545316517353,
-0.955892026424408,
0.004911957308650017,
0.004339356906712055,
-0.0016080066561698914,
0.005339248571544886,
0.0019823447801172733,
0.003449092386290431,
0.005430117249488831,
0.013980780728161335,
-0.011297502554953098,
-0.007357903756201267,
-0.011683439835906029,
-0.012282058596611023,
-0.0007576366770081222,
-0.006989133544266224,
-0.00452458206564188,
-0.005276835057884455,
-0.007154523395001888,
-0.004692602436989546,
-0.005471188109368086,
-0.0010575513588264585,
0.008432979695498943,
0.0010433244751766324,
0.0034075703006237745,
0.00415112916380167,
0.0053688050247728825,
-0.004221857525408268,
-0.0029453346505761147,
-0.0017115658847615123,
-0.0020602582953870296,
-0.0077515291050076485,
-0.01462777704000473,
-0.0034017448779195547,
-0.000615636061411351,
0.010505584999918938,
0.0005375249311327934,
0.008364672772586346,
-0.003528027329593897,
0.0017622176092118025,
-0.008347061462700367,
0.004219521302729845,
-0.00032671663211658597,
0.002688931068405509,
-0.02825285866856575,
0.0004761859599966556,
-0.0013581376988440752,
-0.009770906530320644,
0.008602271787822247,
0.0019882547203451395,
-0.0009435738902539015,
-0.0024129124358296394,
-0.006428382825106382,
0.008984947577118874,
-0.0047016567550599575,
0.0045747593976557255,
-0.0033075246028602123,
-0.006680488120764494,
-0.002742866752669215,
-0.008298421278595924,
0.0019715086091309786,
0.005663753487169743,
-0.0037051578983664513,
-0.004963946528732777,
-0.0020547739695757627,
0.003425877308472991,
0.0021116426214575768,
0.004886663518846035,
-0.02026740089058876,
-0.009071080014109612,
0.0012035411782562733,
0.003752213902771473,
-0.0021941321901977062,
-0.005092198960483074,
0.005618820432573557,
-0.0094450693577528,
0.005813033320009708,
0.00160948873963207,
0.0016069200355559587,
-0.013139203190803528,
0.0022322412114590406,
-0.010991347022354603,
-0.0067588272504508495,
0.0029518944211304188,
-0.004423203412443399,
-0.004628479015082121,
0.0006144865765236318,
0.0029502594843506813,
0.007589991670101881,
-0.004447537008672953,
0.004756464622914791,
0.009898913092911243,
-0.002917972858995199,
-0.009340970776975155,
0.007573685608804226,
0.00691523402929306,
0.0005954993539489806,
-0.0026953488122671843,
0.0024391005281358957,
0.008586186915636063,
0.006277651991695166,
0.0027105759363621473,
0.006419429089874029,
0.00016148861323017627,
0.009597128257155418,
-0.0016523748636245728,
0.0013665022561326623,
-0.0030411924235522747,
0.0002712437999434769,
-0.005269139539450407,
-0.0016527229454368353,
-0.00316699524410069,
-0.0026749293319880962,
-0.011878031305968761,
-0.009110326878726482,
-0.003709738375619054,
0.0007468567346222699,
0.0011184863978996873,
-0.005450987257063389,
-0.0014226597268134356,
0.0010345189366489649,
0.009634280577301979,
-0.001766819623298943,
-0.005572376307100058,
0.0005310407723300159,
0.0036813586484640837,
-0.00924109760671854,
0.015490055084228516,
-0.012642478570342064,
0.008688069880008698,
0.00014414731413125992,
-0.018905770033597946,
0.0070013850927352905,
0.008481929078698158,
-0.010017143562436104,
0.0026727374643087387,
0.0006048084469512105,
0.003820961806923151,
0.00010904097143793479,
-0.004442933946847916,
-0.0049288952723145485,
-0.015685101971030235,
-0.0005198846338316798,
0.022810185328125954,
0.001185113564133644,
0.011604970321059227,
0.012341851368546486,
-0.005427346099168062,
0.0035216386895626783,
0.004154230933636427,
-0.00045602701720781624,
0.013406828977167606,
-0.007860377430915833,
-0.00003486721107037738,
0.001895971829071641,
-0.0063557811081409454,
0.0010355934500694275,
0.004601575899869204,
0.005699623376131058,
-0.0024982497561722994,
0.0023489822633564472,
-0.006238289177417755,
-0.005535137839615345,
-0.016390250995755196,
-0.0014083018759265542,
0.008721631020307541,
-0.005127728916704655,
0.004690077621489763,
-0.010638237930834293,
0.007504907436668873,
0.007794697303324938,
0.003536609234288335,
-0.00008526705641997978,
-0.0007783703622408211,
0.006569377146661282,
0.011251257732510567,
-0.005110892467200756,
0.00032919933437369764,
0.004249869845807552,
-0.0004838662571273744,
0.0006345544243231416,
0.007106313016265631,
-0.008433167822659016,
-0.0037335508968681097,
0.001287305960431695,
0.003566881874576211,
0.00035915567423217,
-0.006057481747120619,
-0.007960761897265911,
-0.003910669591277838,
0.004202658776193857,
-0.006550859194248915,
0.003536353586241603,
0.002947030821815133,
0.0038447100669145584,
-0.007596373558044434,
-0.0005851786700077355,
-0.003981363493949175,
-0.011611982248723507,
0.011753762140870094,
-0.0019744187593460083,
0.0031558694317936897,
0.0124374870210886,
0.0046911416575312614,
-0.014708341099321842,
0.00542345829308033,
0.008382134139537811,
-0.003395077772438526,
0.005360770504921675,
0.0045611378736793995,
-0.005027181468904018,
-0.0226760096848011,
-0.001850356813520193,
-0.012977996841073036,
0.00747116282582283,
-0.003850654000416398,
0.006731020286679268,
-0.008942194283008575,
0.004952377639710903,
0.007441754452884197,
-0.013949090614914894,
-0.00633482588455081,
-0.007707618176937103,
0.009013469330966473,
-0.0007745918119326234,
-0.0014333082363009453,
-0.004646727815270424,
-0.004145550541579723,
-0.0019545985851436853,
-0.0034383651800453663,
-0.0023008030839264393,
0.006086933892220259,
0.003580378834158182,
-0.0040890066884458065,
0.002127713058143854,
-0.003465624526143074,
0.0008161253063008189,
-0.00004718282798421569,
-0.009267866611480713,
0.0031478838063776493,
0.00422899704426527,
-0.004346971865743399,
-0.0030425626318901777,
0.000885383109562099,
-0.0032767991069704294,
-0.007544470950961113,
-0.010127325542271137,
-0.003717257874086499,
-0.0055832210928201675,
-0.003761161817237735,
-0.010745825245976448,
-0.0020970511250197887,
-0.008876597508788109,
0.007214101031422615,
-0.009247046895325184,
0.008214026689529419,
0.0076463655568659306,
-0.0041980622336268425,
0.008065221831202507,
-0.002340380335226655,
0.004411340691149235,
0.0032822429202497005,
0.0062781451269984245,
0.00029682493186555803,
-0.00529633229598403,
-0.010685192421078682,
0.012027518823742867,
-0.008311701007187366,
-0.00019637650984805077,
0.013598380610346794,
0.0040814573876559734,
0.009567048400640488,
0.0023438185453414917,
-0.0012120646424591541,
0.003523412859067321,
0.008987987414002419,
-0.013484162278473377,
0.004976428579539061,
-0.0022448794916272163,
-0.0015770215541124344,
0.006110397167503834,
-0.0057283430360257626,
0.0008368803537450731,
0.009787903167307377,
0.00003953670238843188,
-0.008407393470406532,
-0.0009651689906604588,
0.004288902506232262,
0.005699667613953352,
-0.01223767176270485,
-0.00017764794756658375,
-0.006375515833497047,
-0.005048102233558893,
-0.0010608742013573647,
-0.0016635997453704476,
-0.00019337181583978236,
0.0041302526369690895,
-0.003056702669709921,
0.005406868178397417,
0.0017623852472752333,
-0.0033550316002219915,
0.013894790783524513,
-0.004025050438940525,
-0.006908193696290255,
0.0033056363463401794,
0.0023913495242595673,
-0.002999053103849292,
-0.007173760328441858,
-0.001950503559783101,
0.001304122619330883,
0.005424998234957457,
-0.004699327517300844,
-0.0036463458091020584,
-0.002601425163447857,
0.00040258053923025727,
-0.009004424326121807,
0.000024100285372696817,
0.012600449845194817,
-0.004297771956771612,
0.005674939136952162,
-0.0007002537604421377,
-0.007391805294901133,
-0.017044201493263245,
0.053549401462078094,
-0.0009332973859272897,
0.003968485631048679,
0.0031472642440348864,
-0.007462749723345041,
0.0004883055808022618,
0.0003678535867948085,
0.009554763324558735,
-0.005991756916046143,
-0.01006278209388256,
0.00911206565797329,
-0.0033921769354492426,
0.0018657671753317118,
0.004874314647167921,
0.000129760752315633,
0.01551961712539196,
-0.005560240708291531,
-0.01818854920566082,
-0.017017092555761337,
0.008227755315601826,
-0.001236391719430685,
-0.007512753829360008,
0.00935664027929306,
-0.0014246836071833968,
-0.0015113685512915254,
0.0017324452055618167,
0.006398040801286697,
0.00036038149846717715,
0.001621345290914178,
-0.004403530620038509,
-0.0029462368693202734,
0.00004242893191985786,
0.0029053285252302885,
0.0063415709882974625,
0.006132238544523716,
-0.002677247626706958,
0.005164192058146,
-0.0030966235790401697,
-0.00011440387606853619,
-0.0020855364855378866,
0.00446070171892643,
0.008557423949241638,
-0.0007678293623030186,
-0.0003156130842398852,
0.003276499453932047,
0.003994667902588844,
0.00314763723872602,
0.011092268861830235,
0.0006522370968014002,
-0.00794676411896944,
0.009582859463989735,
0.0063893417827785015,
0.00048310947022400796,
0.010405264794826508,
-0.0011718737659975886,
0.006958139128983021,
0.002254569437354803,
-0.008322205394506454,
-0.016062013804912567,
-0.002345516113564372,
0.0077031380496919155,
0.007744077127426863,
-0.00200443877838552,
0.003526017302647233,
-0.003021355951204896,
-0.0016998088685795665,
-0.006320496089756489,
-0.008067745715379715,
-0.003013933775946498,
0.0010924860835075378,
0.004444939084351063,
0.07065089792013168,
-0.00625084713101387,
-0.004224920179694891,
-0.008950335904955864,
-0.000023494416382163763,
-0.004062785767018795,
-0.0007884641527198255,
-0.0014664902118965983,
0.0004861948546022177,
0.0031880345195531845,
0.002627075184136629,
-0.009379848837852478,
-0.010454426519572735,
0.004154372029006481,
0.0003484543995000422,
-0.002193134743720293,
0.0061643184162676334,
0.00559955183416605,
-0.0077206166461110115,
0.002975729526951909,
-0.011998462490737438,
-0.0003949092351831496,
-0.0040537286549806595,
-0.01193901989609003,
-0.0028813958633691072,
-0.0031143564265221357,
0.0031168898567557335,
0.0009368360042572021,
0.0059878709726035595,
-0.004555906634777784,
0.006029401905834675,
-0.002895415760576725,
0.0021278380881994963,
-0.002336896490305662,
0.0021154889836907387,
-0.008655296638607979,
0.008512133732438087,
0.001628137775696814,
-0.010851765982806683,
-0.004795640707015991,
-0.0013938527554273605,
-0.00005881291508558206,
-0.005476576741784811,
0.005354829132556915,
-0.0017746685771271586,
0.006913610268384218,
-0.002116996329277754,
0.0010056174360215664,
-0.007131928578019142,
0.0028919531032443047,
-0.013575971126556396,
0.004379209131002426,
-0.1817377805709839,
0.009268091060221195,
0.0029081818647682667,
-0.005844326689839363,
-0.0041496711783111095,
-0.013726206496357918,
-0.004966616630554199,
0.004602615721523762,
0.009467353112995625,
0.001912608160637319,
-0.00047467206604778767,
-0.005476151593029499,
0.004086772445589304,
0.004885364789515734,
-0.00014648112119175494,
-0.006417474243789911,
0.00442925188690424,
-0.004934340249747038,
0.0018555258866399527,
0.00496389577165246,
0.006117194890975952,
0.010670687071979046,
0.0021005889866501093,
0.001731656608171761,
-0.0015857378020882607,
-0.004409913904964924,
0.006565237417817116,
-0.0024286883417516947,
0.004859181120991707,
-0.013971829786896706,
-0.0027907737530767918,
-0.006165360566228628,
-0.003482086816802621,
0.0031875474378466606,
0.005236180033534765,
-0.000598470913246274,
0.00882180966436863,
0.0030522083397954702,
-0.00881912000477314,
0.007462030276656151,
-0.006654983852058649,
0.028714068233966827,
0.005886835046112537,
0.006153163034468889,
0.0027802276890724897,
-0.005784183274954557,
-0.003970474470406771,
0.009019138291478157,
0.0013642493868246675,
0.01231785211712122,
-0.01681356318295002,
-0.004244914278388023,
0.0017503030830994248,
0.01913229376077652,
-0.0031154861208051443,
-0.009504813700914383,
-0.005231386516243219,
-0.0045696767047047615,
0.0012582405470311642,
0.011406226083636284,
0.011655949987471104,
-0.0038805596996098757,
0.006213000509887934,
-0.001732098637148738,
-0.02413528971374035,
0.000630160968285054,
-0.0038940832018852234,
-0.007186398841440678,
0.0006584505899809301,
0.006252599880099297,
0.009472131729125977,
0.00004691051071858965,
0.0024413811042904854,
0.00015180182526819408,
0.004260297864675522,
-0.0006532025872729719,
0.005602342542260885,
-0.0003838737611658871,
0.004377749748528004,
-0.01120089739561081,
0.009213058277964592,
-0.009895283728837967,
-0.0022433255799114704,
0.0022979159839451313,
-0.005307229235768318,
0.012483477592468262,
0.0052110482938587666,
-0.0016989430878311396,
-0.000541101093403995,
-0.008584331721067429,
-0.0028853893745690584,
0.0028890324756503105,
0.001541776000522077,
-0.009054964408278465,
0.0012998429592698812,
0.0005437869112938643,
0.004189416766166687,
0.005312901921570301,
-0.008241883479058743,
0.0066106379963457584,
0.005775141064077616,
-0.007379056885838509,
0.0012385902227833867,
-0.003381464397534728,
0.003907181788235903,
0.0051589286886155605,
-0.006812344305217266,
-0.006534839514642954,
0.0007029102998785675,
-0.005735128652304411,
-0.0049709659069776535,
0.005845006089657545,
-0.00806189700961113,
-0.010234621353447437,
-0.002166069345548749,
-0.01237177848815918,
0.0031793462112545967
] |
8a5d63158988a4154bd4df2b897b694d5cad31f9 | 46,478 | py | Python | alembic/versions/1d092815507a_add_huawei_2g_managedobjects.py | bodastage/bts-database | 96df7915621dd46daf55016eedf5cfc84dd0e3a2 | [
"Apache-2.0"
] | 1 | 2019-08-30T01:20:14.000Z | 2019-08-30T01:20:14.000Z | alembic/versions/1d092815507a_add_huawei_2g_managedobjects.py | bodastage/bts-database | 96df7915621dd46daf55016eedf5cfc84dd0e3a2 | [
"Apache-2.0"
] | 1 | 2018-05-30T09:29:24.000Z | 2018-05-30T10:04:37.000Z | alembic/versions/1d092815507a_add_huawei_2g_managedobjects.py | bodastage/bts-database | 96df7915621dd46daf55016eedf5cfc84dd0e3a2 | [
"Apache-2.0"
] | 3 | 2018-03-10T23:29:30.000Z | 2019-02-19T22:11:09.000Z | """Add Huawei 2G managedobjects
Revision ID: 1d092815507a
Revises: 3fa514f1b7a9
Create Date: 2018-02-13 01:38:59.965000
"""
from alembic import op
import sqlalchemy as sa
import datetime
# revision identifiers, used by Alembic.
revision = '1d092815507a'
down_revision = '3fa514f1b7a9'
branch_labels = None
depends_on = None
def upgrade():
managedobjects = sa.sql.table(
'managedobjects',
sa.Column('pk', sa.Integer, sa.Sequence('seq_managedobjects_pk', ), primary_key=True, nullable=False),
sa.Column('name', sa.String(50), nullable=False),
sa.Column('notes', sa.Text),
sa.Column('label', sa.String(200)),
sa.Column('parent_pk', sa.Integer),
sa.Column('affect_level', sa.Integer),
sa.Column('tech_pk', sa.Integer),
sa.Column('vendor_pk', sa.Integer),
sa.Column('modified_by', sa.Integer),
sa.Column('added_by', sa.Integer),
sa.Column('date_added', sa.TIMESTAMP, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow),
sa.Column('date_modified', sa.TIMESTAMP, default=datetime.datetime.utcnow)
)
op.bulk_insert(managedobjects, [
{'name': 'BTSCABINET', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'AITFOTHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'AITFREV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALGCTRLPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMBLKPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMBLKSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMCAPACITY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMLVL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMML', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMOSCISW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMOSCITHRD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMSCRN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ALMSHLD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'APPCERT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ATESTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BFDPROTOSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BOXRPT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BRD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCAISS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCAITFTMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCDSTPA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCEXSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCFCPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCJBF', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCNSPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPCUTYPE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPSGBPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPSSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPSSTAT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPSTCDSCPMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCPSUMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCSIGTRC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCTESTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSCTMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSSGPPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BSSLS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSABISMUXFLOW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSABISPRIMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSABISTROP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSAISS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSALM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSALMFLASHTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSALMFLASHTW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSALMPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSAPMUBP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSAPPCERT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSAUTODLDACTINFO', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBAKPWR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBBMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBINDLOCGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBRD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBREAKPOINT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSBWPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCELLPATCHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCERTCHKTSK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCERTDEPLOY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCERTMK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCERTREQ', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCHNFALLBACK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCLK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCONNECT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCPRIPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCRC4', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCRLPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCTRLEX', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSCTRLLNK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSDEVIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSDHCPSVRIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSDHEUBP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSDSCPMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSE1T1BER', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSEAMRC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSENVALMPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSEQUIPMENT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSESN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSETHOAM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSETHOAMAH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSETHPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSFALLBACK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSFLEXABISPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSFMUABP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSGTRANSPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSGUPWRSHRFP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSIDLETS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSIKECFG', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSINTRXUSPEC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSIPGUARD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSIPRT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSJBF', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLAPDWS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLLDPGLOBAL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLNKBKATTR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLOCGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLOCKBCCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSLSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSMNTMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSMPGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSMPLNK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSOMLBACKUP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSOMLDETECT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSOMLTS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSOTHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSPATCHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSPINGSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSPLRALM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSPSUFP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRELIALOGSWITCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRET', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRETDEVICEDATA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRETSUBUNIT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRINGATTR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRSV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRXU2LOCGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRXUBP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRXUBRD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSRXUCHAIN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSSHARING', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTEMPLATERSC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTHEFTALM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTMA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTMADEVICEDATA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTMASUBUNIT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTRANS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTRCMPR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTRUSTCERT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSTRXBACKUP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSVLAN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSXFC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'BTSXMUFP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CAB', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CCGN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CELLBIND2BTS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CELLGLDSS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CERTCHKTSK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CERTMK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CERTREQ', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CLK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CLKMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CLKSRC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CONNTYPE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'COPTLNK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CPUTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CRLPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'CSPRECTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DEVIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DEVRSVDPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DSCPMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DSP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DSPLVDSMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DXX', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DXXCONNECT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'DXXTSEXGRELATION', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'E1T1', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'EMSIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ENVALMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ETHIP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ETHPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ETHREDPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ETHSWITCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FACFG', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FANSPEED', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FCCOMMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'filefooter', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FTPCLTPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FTPSCLT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FTPSCLTDPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FTPSRVSPD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'FTPSSRV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G2GNCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G3GARFCN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G3GNCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GAFCALMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GALLCELLBLKSTAT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GBSCREDGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELL2GBA1', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELL3GARFCN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLAMRQUL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLBASICPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0, 'affect_level': 1},
{'name': 'GCELLBTSSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCACCESS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCAD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCAMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCTMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCCUTRANSYS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCHMGAD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCHMGBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCONGACALGO', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLCSFBPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLDYNTURNOFF', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLEGPRSPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLEXTMSRPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLFREQ', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLFREQSCAN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLGPRS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLGSMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHO2GBA2', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOAD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOEDBPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOEMG', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOFAST', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOFDDBA2', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOFITPEN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOINTERRATLDB', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOIUO', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOPANT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOPTP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOTDDBA2', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOUTRANFDD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHOUTRANTDD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLHSRPLCUSRIDFMG', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLIBCAII', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLIDLEAD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLIDLEBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLIDLEFDDBA1', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLIDLETDDBA1', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLLCS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLMAGRP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLMAIOPLAN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLMOCN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLNC2PARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLNCRESELECTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLNONSTANDARDBW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLNWCTRLMSRPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLOPTREV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLOSPMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLOTHBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLOTHEXT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLOTHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPRACH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPRIEUTRANSYS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPRIVATEOPTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSABISPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSBASE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSCHM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSCS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSDIFFSERVICE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSI1', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSOTHERPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSPWPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPSSMALLPKTRESBAL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0,
'added_by': 0},
{'name': 'GCELLPWR2', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPWR3', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLPWRBASIC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLRESELECTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLRESELECTUTRANTDD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0,
'added_by': 0},
{'name': 'GCELLRESELUTRANFDD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLRSVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSBC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSERVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSOFT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSON', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSRVCC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLSTANDARDOPTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLTA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLTEMPLATERSC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLTMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLTRANPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLUNDPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLVAMOS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLVAMOSPWR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCELLWLAN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCNCFGALMTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCNNODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCNOPERATOR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCNOPERATORREV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCSCHRCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCSCHRSCOPE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GCSFILE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GDSSPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GEXT2GCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GEXT3GCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GEXTLTECELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GFORCESWITCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GHOSTSTATUS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GKPIALMTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GLOBALROUTESW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GLTENCELL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GMRCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GMRSCOPE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GNODEREDCFGCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GNODEREDUNDANCY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GPSCHRCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GPSCHRSCOPE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GPSKPIALMTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GREDGRPHOSTPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GRSVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRX', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXBASE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXCHAN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXCHANHOP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXDEV', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXFC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXHOP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXIUO', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXRLALM', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'GTRXRSVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G_ADJMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G_ADJNODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'G_IPPATH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'HOSTLOGSPD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IDRQTEST', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'INFBRDRESCFG', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'INTBRDPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IPCHK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IPGUARD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IPLOGICPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IPMUX', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'IPRT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'ITWKPIALMTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'L2L3ROUTEPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'LDR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'LICALMTHD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'LICPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'LODCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'LOGLIMIT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'M3DE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'M3LE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'M3LKS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'M3LNK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'M3RT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MDTLCS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MNTMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MOCNPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MSGSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MSP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'MTP3TMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'N7DPC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'NRIMSCMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'NRISGSNMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'NSE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'NSVLLOCAL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OBJALMSHLD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OBJAUTHSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OMUCOMMSVCSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OMUETH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OMUPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OMUPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OPC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OPLOCK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OPSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OPT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OSPWDPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'OTHSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PACKETFILTERALMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PHBMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PORTFLOWCTRLPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PORTOSCCTRLPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PSPREFABISCONGCTRL', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PSUSRRESBIND', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PTPBVC', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PWDPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PWRALMSW', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'PWRPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'QUEUEMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'RSVRES', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'RULELIBVER', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SAUCENTER', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SCCPTMR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SCTPLNK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SCTPPROF', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SCTPSRVPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SCUPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SGSN', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SGSNNODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SNTPCLTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SNTPSRVINFO', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SRCONPATH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SS7PATCHSWITCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SSLAUTHMODE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SSLCONF', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SSLCS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SUBNET', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SUBRACK', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SUBSESSION_NE', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SYNSWITCH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'SYS', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TCPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TCRSVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TNALMPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TNLOADBALANCEPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TNRSVDPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TNSOFTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRANSPATCHPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRANSPHYLNKPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRANSRSVPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRCLOGSPD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRMFACTOR', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRMLOADTH', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRMMAP', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRUSTCERT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TRXBIND2PHYBRD', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'TZ', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'UMTESTPARA', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'USEREVTRTNPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'USRRESBIND', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'VLANID', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'WEBLOGINPOLICY', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
{'name': 'XPUPORT', 'parent_pk': 0, 'vendor_pk': 2, 'tech_pk': 1, 'modified_by': 0, 'added_by': 0},
])
def downgrade():
op.execute("""DELETE FROM managedobjects WHERE vendor_pk = {0} AND tech_pk = {1}""".format(2, 1))
| 103.055432 | 133 | 0.570162 | 1 | 2.8851 | [
-0.030845731496810913,
0.02536042593419552,
-0.009304984472692013,
0.04665077477693558,
-0.03827813267707825,
-0.00021776049106847495,
0.024674447253346443,
-0.0034143594093620777,
0.025725839659571648,
0.019562123343348503,
0.021388884633779526,
0.009545037522912025,
0.03462028503417969,
0.02509976364672184,
0.022672949358820915,
-0.005369417369365692,
0.05043670907616615,
-0.042199164628982544,
-0.027269961312413216,
-0.00625479593873024,
-0.01817035861313343,
0.017219634726643562,
-0.00823420099914074,
0.03779972344636917,
0.04139140620827675,
0.024541381746530533,
0.04270370677113533,
0.03366473317146301,
-0.03928414732217789,
-0.047347091138362885,
0.0017481736140325665,
0.07866577059030533,
-0.008547209203243256,
-0.04857252165675163,
-0.02171194739639759,
-0.0033228194806724787,
-0.01061233039945364,
-0.0796755775809288,
0.0038689065258949995,
-0.020212780684232712,
-0.006940324790775776,
-0.050534799695014954,
-0.04837530851364136,
-0.016037750989198685,
0.01823274791240692,
0.0029088284354656935,
-0.019826743751764297,
-0.005383258685469627,
-0.0014696497237309813,
0.04849177598953247,
0.008858502842485905,
0.00012186449021100998,
0.00666987057775259,
-0.019242390990257263,
0.007287961896508932,
-0.0022170403972268105,
0.03224166855216026,
0.0414217971265316,
-0.03555408492684364,
-0.004675048403441906,
-0.020693421363830566,
0.015478123910725117,
-0.02479550801217556,
-0.00573749840259552,
0.015467577613890171,
0.0175522118806839,
0.029274310916662216,
-0.0018621156923472881,
-0.041115596890449524,
0.007865693420171738,
-0.01043642871081829,
-0.011079165153205395,
-0.01621449925005436,
0.0025826692581176758,
-0.0018119147280231118,
-0.017988165840506554,
-0.028043678030371666,
-0.0671328604221344,
0.006707798223942518,
-0.006154803093522787,
0.0058990600518882275,
0.071640744805336,
-0.027546577155590057,
-0.005606901366263628,
0.03686313331127167,
0.014558142051100731,
0.031308699399232864,
-0.0847124457359314,
0.024411791935563087,
0.022025005891919136,
-0.05579027533531189,
-0.031833335757255554,
-0.02920439839363098,
0.034669678658246994,
-0.03306170180439949,
-0.036124613136053085,
0.035506755113601685,
0.025026394054293633,
-0.006554572843015194,
0.018280357122421265,
0.03230355307459831,
0.0111136669293046,
0.02617841772735119,
0.014444871805608273,
0.0017692679539322853,
-0.02288491651415825,
-0.06601417809724808,
-0.025213045999407768,
-0.0049543543718755245,
-0.01979920268058777,
0.10558274388313293,
0.03702419623732567,
-0.02882949262857437,
-0.026458745822310448,
0.025519678369164467,
-0.053195521235466,
0.02518087811768055,
0.00822762306779623,
0.0419120267033577,
-0.0016807185020297766,
0.028864996507763863,
0.029409300535917282,
-0.012763302773237228,
-0.034221526235342026,
-0.05084391310811043,
0.06293541193008423,
-0.033979129046201706,
0.037393487989902496,
0.017734462395310402,
0.011599195189774036,
-0.03811284899711609,
0.04658827558159828,
-0.019453417509794235,
-0.0648212805390358,
0.04309791326522827,
0.02493355982005596,
-0.005756065249443054,
0.030737942084670067,
-0.038882095366716385,
0.03518505394458771,
-0.041206274181604385,
-0.02945750020444393,
0.008480190299451351,
-0.02051405794918537,
-0.01402934268116951,
-0.022871484979987144,
0.003827588399872184,
0.059528231620788574,
-0.05330180376768112,
-0.009556543081998825,
0.0036381823010742664,
0.009444686584174633,
-0.0010988437570631504,
-0.031207427382469177,
-0.04151848331093788,
0.006984360050410032,
0.003833440598100424,
-0.01128365658223629,
-0.026596399024128914,
-0.06515971571207047,
-0.027642197906970978,
0.022462833672761917,
0.0021605389192700386,
0.018531927838921547,
0.07288800925016403,
0.01877468451857567,
-0.0010267534526064992,
0.004775175359100103,
-0.005329763516783714,
0.04406185448169708,
-0.016461286693811417,
0.001667077885940671,
-0.05585971474647522,
-0.030820010229945183,
0.013841948471963406,
-0.007155947387218475,
0.07801825553178787,
0.011980894953012466,
0.038133177906274796,
-0.059861358255147934,
-0.009718975983560085,
-0.03720425069332123,
0.01983271725475788,
0.03164876997470856,
-0.019078003242611885,
0.033146537840366364,
-0.05100571736693382,
-0.020934488624334335,
-0.0169131550937891,
0.03531034663319588,
-0.026922862976789474,
0.08612088859081268,
-0.019715366885066032,
-0.0035036744084209204,
0.05654516816139221,
-0.034240394830703735,
0.041596706956624985,
0.015235187485814095,
0.01951281912624836,
-0.00035534065682440996,
0.019203800708055496,
0.014354776591062546,
0.01293469313532114,
0.031105859205126762,
-0.02372066117823124,
0.011775857768952847,
-0.5250234007835388,
0.05202123522758484,
0.010255574248731136,
0.033338647335767746,
0.026113590225577354,
0.04506160691380501,
0.005247226916253567,
0.04854404181241989,
-0.00558514753356576,
0.0004347324720583856,
-0.005195397883653641,
-0.02285735495388508,
-0.06569263339042664,
-0.012555760331451893,
-0.0273678470402956,
0.0007278849952854216,
0.04501961171627045,
-0.007386001758277416,
0.04182850569486618,
0.001728441216982901,
-0.005253588315099478,
-0.016909655183553696,
-0.03345758095383644,
0.019957875832915306,
-0.018817199394106865,
-0.02837931551039219,
0.07589541375637054,
0.011485548689961433,
-0.025345714762806892,
0.009004292078316212,
-0.07766400277614594,
-0.000455756759038195,
-0.008588769473135471,
-0.005156243685632944,
0.00022134470054879785,
0.04235047474503517,
0.05258599668741226,
-0.03872932121157646,
-0.03869634121656418,
-0.03826838731765747,
-0.01794704981148243,
-0.04280028119683266,
-0.0323224738240242,
-0.06390506029129028,
-0.02524608187377453,
-0.03516225144267082,
0.06886234134435654,
-0.007410391699522734,
0.00799731258302927,
0.024890132248401642,
-0.012023862451314926,
0.03159445524215698,
0.026687810197472572,
0.01323250774294138,
-0.04012712836265564,
-0.006585021037608385,
-0.00037986773531883955,
-0.013313760980963707,
-0.004817487671971321,
0.021539291366934776,
0.037873610854148865,
0.03829651698470116,
-0.036077216267585754,
0.0008428705623373389,
0.030848775058984756,
-0.02092268131673336,
0.04941948503255844,
0.005473649594932795,
-0.022239768877625465,
0.04649922251701355,
-0.04534893110394478,
0.005789496470242739,
-0.05276987701654434,
0.026793919503688812,
0.006753748282790184,
0.027942365035414696,
0.055271487683057785,
0.005164206027984619,
0.018298983573913574,
-0.0061690667644143105,
-0.03618703410029411,
0.022679496556520462,
-0.01290153805166483,
-0.02493627741932869,
-0.05240103602409363,
-0.01641077920794487,
0.009007297456264496,
-0.02939966507256031,
-0.007346633356064558,
0.0043761287815868855,
0.014210974797606468,
-0.004636493045836687,
0.0072495597414672375,
0.01371693704277277,
0.012963510118424892,
-0.009596857242286205,
-0.010257860645651817,
0.0675845667719841,
0.009429366327822208,
0.03667759895324707,
-0.015883905813097954,
-0.04225138947367668,
-0.030490225180983543,
-0.018807722255587578,
-0.032842088490724564,
-0.00390092795714736,
-0.10512014478445053,
-0.014950068667531013,
0.041402667760849,
-0.005166520364582539,
0.02558232843875885,
-0.0026079383678734303,
0.01037592999637127,
0.013124017044901848,
-0.04016245901584625,
-0.021723736077547073,
-0.014257299713790417,
-0.00274169840849936,
-0.0099024698138237,
0.03881962224841118,
0.00039787948480807245,
-0.016487739980220795,
0.0017370692221447825,
-0.015058675780892372,
-0.031384505331516266,
0.054513975977897644,
-0.0828818678855896,
-0.00781528651714325,
0.0014714522985741496,
0.02071431279182434,
-0.043899089097976685,
-0.02063438668847084,
0.007203988265246153,
-0.04925075173377991,
-0.008222830481827259,
0.031773410737514496,
-0.008617348037660122,
0.004016587510704994,
0.021770508959889412,
-0.002062083687633276,
-0.03638289496302605,
-0.014273916371166706,
0.017837313935160637,
0.012653235346078873,
0.015495928935706615,
0.05356317013502121,
0.02613002061843872,
0.01894313283264637,
0.01704101264476776,
-0.00944262184202671,
-0.006232729181647301,
0.026358993723988533,
-0.00490811001509428,
0.03385503590106964,
-0.017750872299075127,
0.004419785458594561,
-0.03496319800615311,
-0.048876065760850906,
-0.009272814728319645,
0.021353181451559067,
-0.026902256533503532,
-0.09090370684862137,
-0.010933647863566875,
0.011100864969193935,
-0.030166354030370712,
-0.01861070841550827,
0.0072395275346934795,
0.04341370239853859,
0.02348809689283371,
0.018162157386541367,
-0.020735010504722595,
-0.04209236055612564,
0.035427141934633255,
-0.0034173873718827963,
0.022048555314540863,
-0.005324312951415777,
-0.0022220094688236713,
-0.04287933558225632,
-0.021601920947432518,
0.018467549234628677,
0.016111545264720917,
-0.01747056469321251,
-0.004358834121376276,
0.023079965263605118,
0.01024524588137865,
0.02446165680885315,
0.014098815619945526,
-0.009527912363409996,
-0.00677342526614666,
-0.02378142811357975,
0.02132304757833481,
0.08466963469982147,
-0.020185522735118866,
-0.0036214394494891167,
-0.06659621745347977,
-0.04522351920604706,
-0.05248699709773064,
0.01637122966349125,
0.017207249999046326,
-0.01021753903478384,
0.033439673483371735,
-0.005778861232101917,
0.017296580597758293,
-0.01289072073996067,
-0.012197451665997505,
0.03420473262667656,
-0.0010853237472474575,
0.02034311182796955,
-0.01781284250319004,
-0.059778083115816116,
0.02312062308192253,
0.005944691598415375,
0.01730857603251934,
0.04439100623130798,
0.010455482639372349,
0.03045446053147316,
-0.05306844413280487,
0.002752854023128748,
0.06966282427310944,
-0.03253127634525299,
-0.07388361543416977,
-0.01855596899986267,
0.04337465390563011,
0.020067963749170303,
-0.02746310457587242,
-0.050385747104883194,
-0.024933286011219025,
0.019198061898350716,
-0.017546413466334343,
0.006374217104166746,
0.042109549045562744,
0.019333485513925552,
0.049800630658864975,
-0.0031530645210295916,
0.0254867784678936,
0.04012560844421387,
-0.003901582444086671,
-0.015260499902069569,
-0.017121843993663788,
0.009719587862491608,
-0.0017630333313718438,
0.005471447017043829,
-0.028931470587849617,
-0.01583520695567131,
-0.015079946257174015,
-0.0021096959244459867,
0.024355316534638405,
-0.07117979973554611,
-0.012429071590304375,
0.0022310344502329826,
0.03074772097170353,
0.001158570870757103,
0.04006505757570267,
-0.0037223096005618572,
0.021459095180034637,
0.05203830823302269,
-0.021161075681447983,
0.004451936576515436,
0.017181076109409332,
0.019783565774559975,
0.04059043899178505,
-0.06434014439582825,
0.0062658716924488544,
-0.002144948346540332,
0.0447470061480999,
0.012232223525643349,
-0.005236564204096794,
-0.018917476758360863,
-0.007348883897066116,
-0.0019392619142308831,
-0.015279269777238369,
0.03157290071249008,
-0.056885138154029846,
0.008060155436396599,
-0.0057234615087509155,
0.0308062881231308,
0.020738286897540092,
0.00249630119651556,
-0.04104597494006157,
0.05134056508541107,
-0.03982723876833916,
-0.01204847451299429,
-0.014719607308506966,
0.01515469141304493,
-0.024597419425845146,
-0.006348548457026482,
0.06696939468383789,
0.0092939343303442,
-0.08401082456111908,
0.003789718495681882,
-0.027483096346259117,
-0.04788510501384735,
0.029739417135715485,
0.020585736259818077,
0.006686912849545479,
-0.008652942255139351,
-0.031045712530612946,
-0.038264840841293335,
-0.01409938558936119,
-0.028952518478035927,
-0.037065014243125916,
-0.0587337389588356,
-0.02733560837805271,
-0.009025240316987038,
-0.03194644674658775,
-0.014858396723866463,
0.0026338736061006784,
0.009947794489562511,
0.03914083540439606,
0.02165835350751877,
0.049961235374212265,
-0.004769798833876848,
0.04233936965465546,
0.04360254481434822,
-0.017479924485087395,
0.009415806271135807,
-0.0006544289062730968,
0.034552525728940964,
0.07704312354326248,
0.0162836741656065,
-0.005135886836796999,
-0.019500093534588814,
0.016836924478411674,
-0.018082184717059135,
0.014241114258766174,
-0.033168524503707886,
0.006409546826034784,
-0.004335817415267229,
-0.02736697718501091,
-0.019903309643268585,
-0.0028922210913151503,
-0.0189833827316761,
-0.01900194212794304,
0.028553983196616173,
0.015542592853307724,
0.029764456674456596,
0.012090525589883327,
0.02431745082139969,
-0.008975011296570301,
-0.007461875677108765,
0.0009203003137372434,
0.04098953306674957,
-0.02285074070096016,
-0.02673119120299816,
0.03642295300960541,
0.03150302916765213,
0.0031755627132952213,
0.016856763511896133,
0.03048798441886902,
-0.0015456319088116288,
-0.02010488510131836,
-0.013205795548856258,
0.0041014631278812885,
-0.03506026789546013,
0.0034526316449046135,
-0.0011979438131675124,
-0.01725212298333645,
-0.02234642207622528,
0.0030106769409030676,
0.019521545618772507,
0.005397131200879812,
0.001548910397104919,
0.002630433766171336,
0.002176109701395035,
-0.013926082290709019,
0.029691727831959724,
0.046312037855386734,
-0.05494134500622749,
-0.0131505923345685,
-0.002516344655305147,
-0.04023456200957298,
-0.031513966619968414,
-0.014290439896285534,
0.004539931192994118,
0.01921319216489792,
0.05682085081934929,
0.027808181941509247,
0.018609214574098587,
0.004398639779537916,
-0.014760145917534828,
-0.02876211702823639,
-0.04577191174030304,
-0.0009385597077198327,
-0.02633519470691681,
0.009854158386588097,
0.024836299940943718,
-0.004175806418061256,
0.0011593799572438002,
0.0016119993524625897,
0.003078302601352334,
0.04626764357089996,
0.0302667785435915,
0.02613779716193676,
0.01084850076586008,
0.000032991727493936196,
-0.0072444407269358635,
-0.03183760493993759,
-0.029085073620080948,
-0.011903940699994564,
0.0018605071818456054,
0.03437475487589836,
-0.03161230310797691,
-0.021427644416689873,
0.0006317341467365623,
0.0034469026140868664,
-0.05033675208687782,
0.05516019091010094,
-0.00580208795145154,
-0.017551960423588753,
0.03362400084733963,
-0.0008450638852082193,
0.00034941956982947886,
-0.0060346792452037334,
-0.039419274777173996,
0.03641814365983009,
0.04186851903796196,
0.00982191227376461,
-0.027910642325878143,
-0.03472371771931648,
0.04182868078351021,
-0.020329348742961884,
-0.010459990240633488,
0.01080397330224514,
-0.013281555846333504,
0.002177995629608631,
0.016073282808065414,
0.006467925384640694,
0.012039459310472012,
-0.0024887227918952703,
-0.0014909442979842424,
-0.019387640058994293,
0.05170045047998428,
-0.045187681913375854,
0.005900273099541664,
0.027724482119083405,
-0.03142436221241951,
-0.0709545835852623,
-0.02482237108051777,
-0.00954283308237791,
0.00006805078737670556,
-0.015386698767542839,
0.004416126757860184,
-0.019754385575652122,
0.054742638021707535,
0.013400077819824219,
-0.12150422483682632,
0.004967938177287579,
-0.0038700432050973177,
-0.027218453586101532,
-0.07025792449712753,
-0.07369553297758102,
0.03720535337924957,
0.010512339882552624,
-0.004484114237129688,
0.007211517076939344,
-0.029426127672195435,
0.019392475485801697,
0.020955407992005348,
0.011273336596786976,
0.030862675979733467,
0.016824157908558846,
0.02195124514400959,
0.00771432276815176,
0.007736614905297756,
0.017166363075375557,
0.02999516762793064,
0.033958666026592255,
-0.02866343781352043,
-0.01828049123287201,
0.023181306198239326,
0.006042884197086096,
0.044869571924209595,
-0.01841491088271141,
0.009630144573748112,
0.011953409761190414,
-0.035976655781269073,
0.011181158944964409,
-0.01671675033867359,
0.010945446789264679,
0.009114716202020645,
-0.03884093463420868,
0.023118529468774796,
0.034733328968286514,
0.0217805877327919,
0.03622497245669365,
-0.05700637400150299,
-0.03360125795006752,
-0.02450588159263134,
-0.04584231227636337,
-0.005813139025121927,
-0.02717062644660473,
-0.04191560298204422,
-0.01037714071571827,
0.021386269479990005,
0.058258965611457825,
-0.028223372995853424,
0.06247332692146301,
-0.030209271237254143,
0.073702871799469,
-0.05124235153198242,
0.05089873820543289,
-0.011466782540082932,
0.00781939271837473,
-0.0023259269073605537,
0.003104969160631299,
-0.0007421025075018406,
0.023413607850670815,
0.017240002751350403,
0.02150707133114338,
0.012543284334242344,
-0.010103258304297924,
0.004470138344913721,
-0.04039293900132179,
0.008120739832520485,
0.030259879305958748,
0.024792252108454704,
0.05526480823755264,
-0.010622645728290081,
-0.014242950826883316,
-0.026632757857441902,
0.03221774473786354,
-0.021908564493060112,
0.0036107406485825777,
-0.03768400102853775,
0.021822119131684303,
-0.03223174437880516,
-0.004401868674904108,
0.019683463498950005,
0.07376410067081451,
-0.013467893935739994,
-0.0064597357995808125,
-0.012805802747607231,
-0.039174869656562805,
0.03425590693950653,
0.0014598999405279756,
-0.04590095207095146,
0.055387403815984726,
0.01904216781258583,
-0.017410296946763992,
-0.028701268136501312,
0.029284177348017693,
0.016902251169085503,
0.009616460651159286,
-0.019835425540804863,
-0.03189510107040405,
-0.02082245983183384,
0.007842829450964928,
-0.03911467269062996,
0.004754810128360987,
0.023336658254265785,
0.02773362398147583,
0.018885470926761627,
0.006577893625944853,
-0.002488973317667842,
-0.028725039213895798,
-0.04606754332780838,
-0.026724817231297493,
0.019557055085897446,
0.009853789582848549,
-0.058882132172584534,
-0.03359384462237358,
0.036365531384944916
] |
8a5d6681ce10a3af268cfdb475c6d9aff87499c6 | 1,211 | py | Python | png/imageRecognition_Simple.py | tanthanadon/senior | 89fc24889b34860982b551e5ea5e0d3550505f65 | [
"MIT"
] | null | null | null | png/imageRecognition_Simple.py | tanthanadon/senior | 89fc24889b34860982b551e5ea5e0d3550505f65 | [
"MIT"
] | 5 | 2020-03-04T13:49:10.000Z | 2020-03-20T04:06:23.000Z | png/imageRecognition_Simple.py | tanthanadon/senior | 89fc24889b34860982b551e5ea5e0d3550505f65 | [
"MIT"
] | null | null | null | from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from skimage import io
import matplotlib.pyplot as plt
image = io.imread("star.jpg")
image_gray = rgb2gray(image)
blobs_log = blob_log(image_gray, max_sigma=30, num_sigma=10, threshold=.1)
# Compute radii in the 3rd column.
blobs_log[:, 2] = blobs_log[:, 2] * sqrt(2)
blobs_dog = blob_dog(image_gray, max_sigma=30, threshold=.1)
blobs_dog[:, 2] = blobs_dog[:, 2] * sqrt(2)
blobs_doh = blob_doh(image_gray, max_sigma=30, threshold=.01)
blobs_list = [blobs_log, blobs_dog, blobs_doh]
colors = ['yellow', 'lime', 'red']
titles = ['Laplacian of Gaussian', 'Difference of Gaussian',
'Determinant of Hessian']
sequence = zip(blobs_list, colors, titles)
fig, axes = plt.subplots(1, 3, figsize=(9, 3), sharex=True, sharey=True)
ax = axes.ravel()
for idx, (blobs, color, title) in enumerate(sequence):
ax[idx].set_title(title)
ax[idx].imshow(image)
for blob in blobs:
y, x, r = blob
c = plt.Circle((x, y), r, color=color, linewidth=2, fill=False)
ax[idx].add_patch(c)
ax[idx].set_axis_off()
plt.tight_layout()
plt.show() | 28.833333 | 74 | 0.696945 | 1 | 1.1571 | [
0.0017242798348888755,
0.022631201893091202,
0.009373318403959274,
-0.00014820744399912655,
0.005173139274120331,
-0.003044930985197425,
-0.00718939071521163,
-0.0000954596689553,
-0.006486511789262295,
0.002767996396869421,
0.0034093866124749184,
0.0049693286418914795,
0.009208202362060547,
-0.016363950446248055,
0.000267070165136829,
0.015557561069726944,
-0.05058441311120987,
-0.0017570675117895007,
-0.0012146770022809505,
0.0031138372141867876,
-0.00916895642876625,
0.010084888897836208,
0.007207167334854603,
0.006450354587286711,
0.005706062540411949,
-0.003417040454223752,
0.009389312006533146,
0.0044547212310135365,
-0.010890807025134563,
-0.005538017954677343,
-0.0008354933233931661,
-0.0011070378823205829,
-0.004396858625113964,
-0.0076806815341115,
0.004306199494749308,
-0.004878878127783537,
7.868346756367828e-7,
-0.020893685519695282,
0.011708619073033333,
-0.007574231363832951,
-0.004997389856725931,
-0.013145200908184052,
-0.0004258007393218577,
0.002557571278885007,
-0.007658379152417183,
0.0037427309434860945,
-0.005157421343028545,
-0.000047683333832537755,
-0.010313714854419231,
0.006198529154062271,
-0.009878593496978283,
0.0025224867276847363,
0.014018644578754902,
-0.0013156522763893008,
-0.006013884674757719,
-0.004884941503405571,
0.012545877136290073,
0.00008367567352252081,
-0.012618623673915863,
-0.00045667437370866537,
-0.000545505085028708,
-0.0031934469006955624,
0.005169766955077648,
0.00220280047506094,
-0.012973631732165813,
-0.007534169591963291,
-0.004664160776883364,
0.003924572374671698,
-0.002188247162848711,
0.005430152174085379,
0.001430194592103362,
-0.0003988019598182291,
0.006734934169799089,
0.004714390262961388,
0.006036878097802401,
-0.0039959801360964775,
-0.0016905415104702115,
-0.00011121289571747184,
0.0088202441111207,
0.0038782793562859297,
0.003110431134700775,
-0.004561461973935366,
0.005002159159630537,
0.013129324652254581,
0.013934486545622349,
0.012807820923626423,
0.016980143263936043,
-0.012701453641057014,
0.047533463686704636,
0.00685452576726675,
-0.009821811690926552,
0.0029254260007292032,
-0.013437431305646896,
-0.0035916403867304325,
-0.007565027102828026,
-0.029643584042787552,
0.0022483565844595432,
-0.003982355818152428,
-0.00038825575029477477,
0.003939252346754074,
0.0017597629921510816,
0.00971253216266632,
-0.00003309614839963615,
-0.0021836808882653713,
-0.008583106100559235,
0.0075639295391738415,
-0.009890449233353138,
-0.0047868406400084496,
0.009255877695977688,
0.004035534802824259,
-0.012075425125658512,
-0.0020779648330062628,
-0.0010412518167868257,
-0.014614940620958805,
0.004287946969270706,
0.007136884611099958,
-0.005781933665275574,
0.05276380851864815,
-0.0011899126693606377,
0.005888603162020445,
-0.004946410655975342,
-0.001997594954445958,
0.002543212380260229,
0.006340282037854195,
0.010977652855217457,
-0.0014974597143009305,
0.011120791547000408,
0.004655259661376476,
0.003754609264433384,
0.007773945573717356,
-0.002492705825716257,
0.005623560398817062,
-0.0014722741907462478,
-0.001735370373353362,
-0.0005278282333165407,
-0.008429269306361675,
0.004839522298425436,
-0.002857046667486429,
-0.008238622918725014,
0.0030142657924443483,
-0.0007533748866990209,
-0.01137279998511076,
0.0006295028724707663,
-0.00484190508723259,
0.005201276857405901,
-0.013929340057075024,
-0.002795544685795903,
-0.004173534456640482,
-0.005319849122315645,
0.001454302342608571,
0.010473644360899925,
0.004881386179476976,
0.0039582219906151295,
-0.004621398635208607,
-0.010394446551799774,
0.002012496115639806,
-0.00470663420855999,
0.0015665546525269747,
0.00886195432394743,
0.0033409763127565384,
-0.010100185871124268,
0.00001442478514945833,
0.0019196273060515523,
0.004231949336826801,
-0.00008169160719262436,
0.003315684851258993,
-0.004315589554607868,
0.008247829973697662,
-0.0005050260806456208,
0.005788112059235573,
0.014372996985912323,
-0.0046869306825101376,
0.0008540739072486758,
-0.0005661772447638214,
0.0046240417286753654,
0.001490733353421092,
0.005335845053195953,
0.011851173825562,
-0.005038885865360498,
-0.005997900385409594,
0.005614596419036388,
0.003530824789777398,
0.00900606345385313,
0.007133475970476866,
-0.002220556605607271,
-0.0012786336010321975,
-0.004425798077136278,
-0.001424870453774929,
0.008628192357718945,
-0.007102987263351679,
0.007189163472503424,
0.004390389192849398,
-0.014320042915642262,
-0.010011543519794941,
-0.003111053491011262,
-0.006946740671992302,
0.0030577871948480606,
0.015036066062748432,
0.011823143810033798,
-0.004715620540082455,
0.00044972379691898823,
-0.011323400773108006,
0.001265460392460227,
0.010320833884179592,
0.0005367077537812293,
-0.012019198387861252,
-0.9574987292289734,
0.007958563044667244,
0.0037258591037243605,
-0.0030574293341487646,
0.007039398420602083,
0.001989085925742984,
0.0027840235270559788,
0.002809034427627921,
0.012512067332863808,
-0.0039038825780153275,
-0.004644468426704407,
-0.011449599638581276,
-0.012330768629908562,
-0.0019700108096003532,
-0.008061674423515797,
-0.005035159643739462,
-0.004506177734583616,
-0.007043079007416964,
-0.005710072815418243,
-0.0025515283923596144,
-0.003315519541501999,
0.007389106787741184,
-0.0003297761140856892,
0.0035092313773930073,
0.0039056004025042057,
0.004481141455471516,
-0.002348045352846384,
-0.0009157548192888498,
-0.0019193716580048203,
-0.0048230793327093124,
-0.009407845325767994,
-0.0136621855199337,
-0.0012760553508996964,
-0.0036226341035217047,
0.012092255987226963,
0.004400734789669514,
0.00890763197094202,
-0.002322229789569974,
0.0032859169878065586,
-0.007870659232139587,
0.004882874898612499,
0.0021581132896244526,
0.002857058309018612,
-0.03024594858288765,
-0.00006151771231088787,
-0.0005506707238964736,
-0.008084834553301334,
0.005656428635120392,
0.001913087791763246,
-0.0016920092748478055,
-0.0040981038473546505,
-0.00550458999350667,
0.010734385810792446,
-0.005328909493982792,
0.004121601115912199,
-0.0029370649717748165,
-0.009435405023396015,
-0.004521012771874666,
-0.006802753545343876,
0.0023138858377933502,
0.006209307815879583,
-0.0034721314441412687,
-0.004115906078368425,
-0.005093313753604889,
0.002119518117979169,
0.0005235166172496974,
0.0003878155548591167,
-0.021763358265161514,
-0.006884750444442034,
0.0003000219294335693,
0.0008035443024709821,
0.0008629470830783248,
-0.0054290699772536755,
0.0025798301212489605,
-0.00837747659534216,
0.0036799488589167595,
0.00402451679110527,
0.0033356701023876667,
-0.011292117647826672,
-0.0008244598284363747,
-0.009030683897435665,
-0.007634252775460482,
0.0021862308494746685,
-0.004227814264595509,
-0.0040135919116437435,
0.000573190744034946,
0.0027306638658046722,
0.009347968734800816,
-0.0073102740570902824,
0.0011087849270552397,
0.011374173685908318,
-0.00263294018805027,
-0.006272998638451099,
0.005038556642830372,
0.006719586439430714,
0.0009710449376143515,
-0.0010464295046404004,
0.0055031306110322475,
0.007930462248623371,
0.010955017060041428,
0.003906273283064365,
0.008556068874895573,
0.0004966954584233463,
0.014483663253486156,
0.0009325635619461536,
0.00035229307832196355,
-0.00597213814035058,
-0.0003750161558855325,
-0.0026696159038692713,
0.0007393663981929421,
-0.0063739679753780365,
-0.0013363547623157501,
-0.011038451455533504,
-0.007850602269172668,
-0.006181142292916775,
-0.0009659996721893549,
0.0018354550702497363,
-0.006074420642107725,
-0.003504212014377117,
0.0007531786104664207,
0.008078905753791332,
0.000003939794623875059,
-0.0036160668823868036,
0.0005846016574651003,
0.001340298680588603,
-0.005957386922091246,
0.015202272683382034,
-0.011548545211553574,
0.007917549461126328,
0.0012485433835536242,
-0.01635921746492386,
0.004378030076622963,
0.00748408492654562,
-0.007434221915900707,
-0.00011708260717568919,
0.0037488159723579884,
0.0019036708399653435,
-0.0015968834049999714,
-0.0071913148276507854,
-0.0036028872709721327,
-0.014312788844108582,
0.0012329875025898218,
0.018144097179174423,
0.003040492068976164,
0.010225055739283562,
0.010515592060983181,
-0.0039321910589933395,
0.0024662031792104244,
0.003990726545453072,
-0.0007023395737633109,
0.015890559181571007,
-0.009828911162912846,
0.0006795586668886244,
0.0020942939445376396,
-0.009352940134704113,
0.0014209902146831155,
0.0056230840273201466,
0.005108685698360205,
-0.0017050097230821848,
0.00541054317727685,
-0.005553003866225481,
-0.005711786448955536,
-0.01683754101395607,
-0.003719319822266698,
0.00922098383307457,
-0.0048659797757864,
0.004946868866682053,
-0.011461625806987286,
0.003214336931705475,
0.0035946464631706476,
0.010011219419538975,
0.00042891959310509264,
0.0026122750714421272,
0.007054570596665144,
0.011971663683652878,
-0.007555472664535046,
-0.0006451290682889521,
0.005057061556726694,
-0.0006803614087402821,
0.0008518426911905408,
0.00771912420168519,
-0.007685505785048008,
-0.00459565594792366,
-0.00016985235561151057,
0.005087942350655794,
0.0013764591421931982,
-0.0032095659989863634,
-0.009565313346683979,
-0.004516313783824444,
0.005570027511566877,
-0.00722562987357378,
0.003126294119283557,
0.0018007672624662519,
0.0009647315600886941,
-0.0066348048858344555,
0.0006689558504149318,
-0.003273520851507783,
-0.009930621832609177,
0.011149096302688122,
-0.0036561565939337015,
0.003389101242646575,
0.015950985252857208,
0.007496565114706755,
-0.013699563220143318,
0.005617100279778242,
0.0076994686387479305,
-0.0028507893439382315,
0.0030199517495930195,
0.007833501324057579,
-0.005241356324404478,
-0.025053000077605247,
-0.003671696176752448,
-0.009365350008010864,
0.005102708004415035,
-0.004942604340612888,
0.006246363744139671,
-0.0076615591533482075,
0.005477730184793472,
0.007756029721349478,
-0.016085434705018997,
-0.006361422594636679,
-0.009451175108551979,
0.006477668881416321,
-0.000520031142514199,
0.0011053544003516436,
-0.005500382278114557,
-0.003358980640769005,
-0.0013438158202916384,
-0.0033330621663480997,
-0.004439250100404024,
0.0052881995216012,
-0.00013927709369454533,
-0.0017917719669640064,
0.001121334033086896,
0.00014012627070769668,
0.0012308559380471706,
0.0003795280063059181,
-0.008399792946875095,
0.004644091706722975,
0.0026407078839838505,
-0.0017392474692314863,
-0.0016817479627206922,
0.0008303996874019504,
-0.004325625486671925,
-0.008239664137363434,
-0.009299026802182198,
-0.0034394843969494104,
-0.001091150683350861,
-0.003829674096778035,
-0.00972461886703968,
-0.00507385516539216,
-0.005705901421606541,
0.008497162722051144,
-0.008882395923137665,
0.008432438597083092,
0.005183999892324209,
-0.004099613055586815,
0.003777953563258052,
-0.002969315042719245,
0.0030033569782972336,
0.002017479157075286,
0.005476619582623243,
0.0030151254031807184,
-0.008249802514910698,
-0.008756648749113083,
0.011245235800743103,
-0.006218722555786371,
0.00008192697714548558,
0.014544012024998665,
0.0025218951050192118,
0.007923951372504234,
-0.0013251177733764052,
0.0005120133864693344,
0.000976666109636426,
0.008071549236774445,
-0.013522783294320107,
0.004701904021203518,
-0.0058511774986982346,
0.0007787374197505414,
0.00493535166606307,
-0.004493714310228825,
0.004351121373474598,
0.011864346452057362,
0.0025900613982230425,
-0.007998451590538025,
-0.0004172600747551769,
0.0030755994375795126,
0.004752903711050749,
-0.012532628141343594,
-0.0008542263531126082,
-0.0025872415862977505,
-0.0049701291136443615,
-0.0012106643989682198,
-0.0021026532631367445,
0.00041794381104409695,
0.004479604307562113,
-0.003371013095602393,
0.0073972647078335285,
0.0002694136928766966,
-0.0035451652947813272,
0.013282956555485725,
-0.005090811289846897,
-0.003649985883384943,
0.002347704954445362,
0.0019978531636297703,
-0.0033689241390675306,
-0.004208368249237537,
-0.004165139514952898,
0.0027418802492320538,
0.00635955948382616,
-0.004472190048545599,
-0.003050281433388591,
-0.001997770508751273,
0.0006962901679798961,
-0.009427436627447605,
-0.00013174953346606344,
0.01525269914418459,
-0.005500993691384792,
0.00664975680410862,
-0.00019797471759375185,
-0.006880066357553005,
-0.014236539602279663,
0.04935361072421074,
-0.0013353946851566434,
0.0029057662468403578,
0.0036047836765646935,
-0.0064139459282159805,
0.00160510977730155,
-0.0008699437021277845,
0.008696955628693104,
-0.008485555648803711,
-0.007894974201917648,
0.011380939744412899,
-0.005046704318374395,
0.0051177795976400375,
0.0008493518689647317,
0.001064541982486844,
0.016778068616986275,
-0.0014719677856191993,
-0.016407707706093788,
-0.018960844725370407,
0.00496757123619318,
-0.0046723587438464165,
-0.006432653870433569,
0.007481530774384737,
-0.003913047257810831,
-0.0028500414919108152,
0.003063291311264038,
0.008595806546509266,
0.0015232922742143273,
0.0015114328125491738,
-0.00381214777007699,
-0.002758646849542856,
0.0027536158449947834,
0.0026598614640533924,
0.006540642119944096,
0.00854337029159069,
-0.002102612517774105,
0.005494266282767057,
-0.0029771034605801105,
-0.0004945427062921226,
-0.004009762778878212,
0.004157365765422583,
0.008565484546124935,
-0.0027358534280210733,
-0.0037247163709253073,
0.003141836728900671,
0.0046591078862547874,
-0.0003840969002339989,
0.01182854175567627,
0.00007928535342216492,
-0.006596482824534178,
0.009547729976475239,
0.003914659842848778,
-0.002431522822007537,
0.008969029411673546,
-0.0007227491587400436,
0.0059636738151311874,
0.001168000977486372,
-0.008500066585838795,
-0.012935878708958626,
-0.0017533872742205858,
0.01051734946668148,
0.008170252665877342,
0.0019103728700429201,
-0.00023790776322130114,
0.0025942905340343714,
-0.004053215496242046,
-0.008879195898771286,
-0.010840542614459991,
-0.002774928230792284,
0.002290228148922324,
0.000972853391431272,
0.07107251137495041,
-0.007056877017021179,
-0.0002392699825577438,
-0.00910660345107317,
0.00011376539623597637,
-0.000945878739003092,
-0.002040701452642679,
0.0020188819617033005,
-0.0025774436071515083,
0.0029354183934628963,
0.0015757870860397816,
-0.009690571576356888,
-0.01147694792598486,
0.0037569310516119003,
0.001202684361487627,
-0.0020292161498218775,
0.003669795347377658,
0.006950147915631533,
-0.006910989060997963,
0.0013820308959111571,
-0.012806817889213562,
-0.0024144903291016817,
0.001321622054092586,
-0.010872780345380306,
-0.00499655120074749,
-0.0038498227950185537,
0.006703379563987255,
0.002272607060149312,
0.002629018621519208,
-0.0028079489711672068,
0.005007595755159855,
-0.0024881453718990088,
0.001821874175220728,
-0.0014456926146522164,
-0.0005305337253957987,
-0.007028139196336269,
0.00915675051510334,
0.00047546185669489205,
-0.015976594761013985,
-0.004557945765554905,
-0.00041400399641133845,
0.0015763972187414765,
-0.0066762357018888,
0.006914707366377115,
-0.004797139670699835,
0.0041723232716321945,
-0.003559606848284602,
0.0016917192842811346,
-0.004810312297195196,
0.003603886580094695,
-0.01162305474281311,
0.0033440387342125177,
-0.17380717396736145,
0.011184833943843842,
0.0021636169403791428,
-0.006105833221226931,
-0.0037461973261088133,
-0.015919676050543785,
-0.00980249885469675,
0.0024745482951402664,
0.011889725923538208,
0.004226911347359419,
0.0004992031608708203,
-0.0029699925798922777,
0.005655904300510883,
0.0035599779803305864,
-0.0015103460755199194,
-0.007659923750907183,
0.006008777767419815,
-0.006244610529392958,
0.0001257716940017417,
0.0032418856862932444,
0.0036295312456786633,
0.013367705047130585,
0.001040964969433844,
0.002095545642077923,
-0.00034542710636742413,
-0.005018402356654406,
0.007933237589895725,
-0.002473886590451002,
0.005322831217199564,
-0.01375105232000351,
-0.006423597224056721,
-0.005246412009000778,
-0.005815428216010332,
0.001574206631630659,
0.005046735983341932,
-0.0028953813016414642,
0.008341732434928417,
0.0027890841010957956,
-0.008594347164034843,
0.0052658445201814175,
-0.006015283986926079,
0.03160037100315094,
0.001243391539901495,
0.005648007150739431,
0.0006605810485780239,
-0.006746868137270212,
-0.0064015742391347885,
0.008207402192056179,
0.003192771226167679,
0.014078086242079735,
-0.01780567318201065,
-0.0013947749976068735,
0.0032923193648457527,
0.02239539660513401,
-0.0036530173383653164,
-0.008296781219542027,
-0.007600452285259962,
-0.005193288438022137,
0.00027500162832438946,
0.009684850461781025,
0.013040164485573769,
-0.0037553010042756796,
0.006233442109078169,
-0.00277621834538877,
-0.022561583667993546,
0.0027092231903225183,
-0.0023159037809818983,
-0.006213515531271696,
-0.0016742716543376446,
0.00608418881893158,
0.007516684476286173,
0.0011341526405885816,
0.004417186137288809,
0.0008994721574708819,
0.0028598872013390064,
-0.00155923911370337,
0.003174461890012026,
-0.0018764134729281068,
0.00576519500464201,
-0.008308172225952148,
0.009100288152694702,
-0.0095490338280797,
-0.001975530991330743,
0.0010881988564506173,
-0.005326271988451481,
0.011221615597605705,
0.007583502680063248,
-0.004943953827023506,
-0.0025114051532000303,
-0.009703429415822029,
-0.0016797808930277824,
0.003365485230460763,
0.0005448163137771189,
-0.009995033964514732,
0.00361818284727633,
0.0016448197420686483,
0.004928616341203451,
0.0051070936024188995,
-0.008726281113922596,
0.0059075611643493176,
0.0063263732008636,
-0.00808071531355381,
-0.0005290593253448606,
-0.004740833770483732,
0.0039366004057228565,
0.0026153523940593004,
-0.0062152426689863205,
-0.008475433103740215,
0.003659764537587762,
-0.008326459676027298,
-0.005411010701209307,
0.005150058772414923,
-0.007084048353135586,
-0.009155946783721447,
-0.0013319278368726373,
-0.010077185928821564,
0.00042937861871905625
] |
8a5de963629a6bc23b3e927dcbf31f83ecc1590d | 171 | py | Python | indexof.py | gnuchev/homework | 4083d44561cc9738d3cd8da99f8ef91b69961b6c | [
"MIT"
] | null | null | null | indexof.py | gnuchev/homework | 4083d44561cc9738d3cd8da99f8ef91b69961b6c | [
"MIT"
] | null | null | null | indexof.py | gnuchev/homework | 4083d44561cc9738d3cd8da99f8ef91b69961b6c | [
"MIT"
] | null | null | null | def indexof(listofnames, value):
if value in listofnames:
value_index = listofnames.index(value)
return(listofnames, value_index)
else: return(-1)
| 28.5 | 46 | 0.684211 | 1 | 0.6846 | [
0.003585164900869131,
0.029917774721980095,
0.006486115977168083,
-0.0004787189536727965,
0.006520730443298817,
-0.00554882176220417,
-0.015766939148306847,
0.00834347028285265,
-0.0065364474430680275,
0.003819035831838846,
0.001191343879327178,
0.0017678081057965755,
0.009810930117964745,
-0.016208887100219727,
-0.000014087024283071514,
0.02518117055296898,
-0.05867382884025574,
0.0036365638952702284,
-0.0053682830184698105,
0.0019398403819650412,
-0.00985608622431755,
0.012153828516602516,
0.00681066932156682,
0.010582533665001392,
0.010159439407289028,
0.0056226965971291065,
0.009302441962063313,
0.005770387127995491,
-0.010658654384315014,
-0.0002524266892578453,
0.003994329832494259,
-0.0004434778238646686,
-0.003513401374220848,
-0.009369087405502796,
0.006490990519523621,
-0.0033583128824830055,
0.0013095502508804202,
-0.01698150485754013,
0.008774440735578537,
-0.006587437819689512,
-0.011684144847095013,
-0.019302908331155777,
-0.00029254250694066286,
0.007154121063649654,
-0.013279099948704243,
0.0065216002985835075,
-0.005251778289675713,
0.0037563221994787455,
-0.012399610131978989,
0.002950295340269804,
-0.011386867612600327,
0.004300376400351524,
0.012546833604574203,
0.0015764079289510846,
-0.006726699415594339,
-0.008601042442023754,
0.010065366514027119,
0.0015560491010546684,
-0.012618538923561573,
-0.0033493093214929104,
-0.002270762575790286,
-0.004037921782582998,
0.0025488685350865126,
0.0028732374776154757,
-0.020184630528092384,
-0.006013084203004837,
-0.0036488312762230635,
-0.00008870827150531113,
-0.0035378618631511927,
0.003381820395588875,
0.004562755580991507,
-0.0012623347574844956,
0.009612325578927994,
0.0039051948115229607,
0.00278077507391572,
0.0016350874211639166,
-0.0013713192893192172,
0.004380812868475914,
0.007426868658512831,
0.002498747780919075,
0.0036940588615834713,
-0.012022796086966991,
0.006416644435375929,
0.010209382511675358,
0.011872303672134876,
0.005646881181746721,
0.018871620297431946,
-0.014167502522468567,
0.039105795323848724,
0.005768980830907822,
-0.010537690483033657,
0.0007985563715919852,
-0.0060730078257620335,
-0.0041387202218174934,
-0.002640425693243742,
-0.031330008059740067,
0.0017501781694591045,
-0.008657181635499,
-0.0007771775126457214,
0.006299673113971949,
-0.0019397869473323226,
0.003518825862556696,
-0.008808341808617115,
-0.0007039068732410669,
-0.0124657042324543,
0.02000906877219677,
-0.01238988246768713,
-0.0021867817267775536,
0.004618455655872822,
0.0032101960387080908,
-0.013250399380922318,
-0.0006306893774308264,
0.0023167605977505445,
-0.010061273351311684,
0.0029972612392157316,
-0.00034098990727216005,
-0.003961279522627592,
0.06045679375529289,
0.0009565301588736475,
0.0005197299760766327,
-0.00419784476980567,
-0.005942031741142273,
0.003466938389465213,
0.007013743277639151,
0.010122543200850487,
-0.008499890565872192,
0.011132210493087769,
0.004808702506124973,
0.002155538182705641,
0.0061650630086660385,
0.0013549481518566608,
0.009634057059884071,
-0.007356016431003809,
0.0007942679803818464,
-0.0036221127957105637,
-0.00760225672274828,
0.008299077861011028,
-0.0004916350590065122,
-0.000704716076143086,
0.001866313861683011,
-0.007118180859833956,
-0.016503453254699707,
0.002040171530097723,
0.002427639439702034,
-0.0014462900580838323,
-0.015199432149529457,
-0.004093836061656475,
-0.00442200992256403,
-0.005485399626195431,
0.0030407484155148268,
0.00984649546444416,
0.0049496544525027275,
0.003151712706312537,
-0.004334775730967522,
-0.007187538780272007,
-0.0025710114277899265,
-0.006168092601001263,
0.004868046380579472,
0.00677355146035552,
0.003708235453814268,
-0.008613837882876396,
-0.00552158709615469,
0.004799797665327787,
0.006681515369564295,
-0.002680801320821047,
0.0017609444912523031,
-0.009471208788454533,
0.010738286189734936,
0.0034369996283203363,
0.0014186827465891838,
0.012171977199614048,
-0.004408144857734442,
0.0008120209095068276,
0.0010929633863270283,
0.003736077342182398,
0.0026114722713828087,
0.005429000593721867,
0.008465520106256008,
-0.0076148295775055885,
-0.005311875604093075,
0.008461990393698215,
0.00012831746425945312,
0.012403073720633984,
0.007645076140761375,
-0.0004732453671749681,
0.002133495407178998,
-0.0025111516006290913,
0.0008208167855627835,
0.003140168497338891,
-0.005674455780535936,
0.011376853100955486,
0.006429307162761688,
-0.01805836707353592,
-0.0056966328993439674,
-0.00329778715968132,
-0.01047307625412941,
0.0004278428968973458,
0.016971254721283913,
0.009004924446344376,
0.00536021264269948,
0.004553406499326229,
-0.014075706712901592,
-0.00006341364496620372,
0.008853765204548836,
-0.0012448019115254283,
-0.010601385496556759,
-0.9493030309677124,
0.0007371380343101919,
0.006378417834639549,
0.0010971332667395473,
0.007252436131238937,
0.0024497625418007374,
0.004198486916720867,
0.0018963925540447235,
0.014213371090590954,
-0.011172793805599213,
-0.00712938467040658,
-0.008815770037472248,
-0.01647103577852249,
0.0013151437742635608,
-0.0051417299546301365,
-0.0016489865956827998,
-0.004089027643203735,
-0.014030134305357933,
-0.003491667564958334,
-0.006496809888631105,
0.00014768587425351143,
0.00858180969953537,
-0.002075400436297059,
0.003920759540051222,
0.006374348420649767,
0.006831199396401644,
-0.0071154385805130005,
-0.0006976808072067797,
0.003601423231884837,
-0.0007598786614835262,
-0.0031836717389523983,
-0.016078228130936623,
-0.009275989606976509,
-0.0006724789855070412,
0.011975551024079323,
0.0013139090733602643,
0.0060428958386182785,
-0.002367474837228656,
-0.0008896102081052959,
-0.01262497529387474,
0.004783292300999165,
0.004444058518856764,
0.0030532239470630884,
-0.029186448082327843,
0.0023077765945345163,
-0.006532427854835987,
-0.011029793880879879,
0.011632652021944523,
0.009072015061974525,
-0.0025976875331252813,
-0.0026440522633492947,
-0.0008170324144884944,
0.008378115482628345,
-0.008076058700680733,
0.005638353060930967,
-0.006465081125497818,
-0.004945835098624229,
0.0006506411009468138,
-0.013463357463479042,
0.001666454249061644,
0.0032434160821139812,
-0.002290977630764246,
-0.005034773610532284,
-0.004393951967358589,
-0.00040693857590667903,
0.0018565780483186245,
0.002920579630881548,
-0.01916717179119587,
-0.0058464230969548225,
-0.0031628257129341364,
0.00638832151889801,
0.0016375184059143066,
-0.0018551495159044862,
0.0013331263326108456,
-0.011166533455252647,
0.006556194741278887,
-0.0002441659162286669,
0.0030224097426980734,
-0.007702556438744068,
0.002905554138123989,
-0.00917837768793106,
-0.010816475376486778,
0.0032390945125371218,
-0.005787459202110767,
-0.003064671065658331,
0.0023414266761392355,
0.0064960685558617115,
0.007322941906750202,
-0.007212101016193628,
-0.0010411336552351713,
0.008576312102377415,
-0.0031013209372758865,
-0.012224285863339901,
0.010051545687019825,
0.005898706614971161,
0.0015929024666547775,
0.00015839636034797877,
0.001676621031947434,
0.008273418061435223,
0.008094274438917637,
-0.0006968379020690918,
0.005224653519690037,
0.0006842009606771171,
0.011713758111000061,
0.0010939135681837797,
0.002948654582723975,
0.0020946550648659468,
-0.0018873255467042327,
-0.004151832778006792,
-0.004977519623935223,
-0.004675448872148991,
-0.001713012927211821,
-0.01056678406894207,
-0.01194735523313284,
-0.006227976176887751,
0.003608377417549491,
-0.0009978307643905282,
-0.005440861452370882,
-0.00037121615605428815,
0.0038899288047105074,
0.010630893521010876,
0.0007649617036804557,
-0.007983745075762272,
0.003526942105963826,
0.0038473340682685375,
-0.005844114348292351,
0.01439847331494093,
-0.012098656967282295,
0.007424280978739262,
-0.001416041748598218,
-0.016032982617616653,
0.008465726859867573,
0.0102152768522501,
-0.00779430428519845,
0.005118321627378464,
-0.0026155891828238964,
0.00017011504678521305,
0.0004536557535175234,
-0.006944478955119848,
-0.00525515154004097,
-0.019076822325587273,
0.0009072721004486084,
0.02624695375561714,
0.004113232251256704,
0.010610079392790794,
0.016899093985557556,
-0.007304126396775246,
0.0012509155785664916,
0.010757631622254848,
-0.001294644782319665,
0.01827448420226574,
-0.008509961888194084,
-0.003064459888264537,
0.0008550546481274068,
-0.004978069104254246,
0.0034708138555288315,
0.0024795362260192633,
0.0032262627501040697,
-0.0018665893003344536,
0.0010917922481894493,
-0.009273393079638481,
-0.0035662599839270115,
-0.016849815845489502,
-0.0003567142703104764,
0.008238096721470356,
-0.003287029918283224,
0.0027029630728065968,
-0.011586718261241913,
0.0034233485348522663,
0.006131468340754509,
0.0023421405348926783,
0.0029995418153703213,
-0.0013077728217467666,
0.006160160060971975,
0.009712337516248226,
-0.005060612224042416,
0.006354120559990406,
0.005102643743157387,
0.000286953232716769,
0.0030660696793347597,
0.011050728149712086,
-0.009091258980333805,
-0.005041136872023344,
0.003071651328355074,
0.000014811686014581937,
0.00010475600720383227,
-0.007290724664926529,
-0.011227733455598354,
-0.0059297094121575356,
0.0057107205502688885,
-0.008551622740924358,
0.004111316986382008,
0.0016851505497470498,
0.0040064710192382336,
-0.01265982910990715,
-0.002367059700191021,
-0.0047883628867566586,
-0.008687501773238182,
0.010126490145921707,
-0.003605961799621582,
0.006629730574786663,
0.013608967885375023,
0.002207612618803978,
-0.014263331890106201,
0.011142401024699211,
0.006776777561753988,
-0.009996803477406502,
0.004071641713380814,
0.007677972316741943,
-0.004588835872709751,
-0.024122659116983414,
0.0031425380147993565,
-0.01682431809604168,
0.007164411246776581,
-0.0010313773527741432,
0.005266358610242605,
-0.009732110425829887,
0.009787770919501781,
0.00606572488322854,
-0.012429265305399895,
-0.004289808217436075,
-0.010812003165483475,
0.008007662370800972,
-0.0026683739852160215,
-0.0058570546098053455,
-0.005479278974235058,
-0.003457089187577367,
-0.0019090226851403713,
0.0010745944455265999,
-0.0012681431835517287,
0.0031956681050360203,
0.0038475729525089264,
-0.002307361224666238,
0.0057823266834020615,
-0.002496841363608837,
0.001039884053170681,
0.003570452332496643,
-0.009003335610032082,
0.002640873659402132,
0.010878325439989567,
-0.001776966848410666,
-0.002504571108147502,
-0.0017087520100176334,
-0.004647992551326752,
-0.009186767041683197,
-0.008550806902348995,
-0.0038986082654446363,
-0.0040804496966302395,
-0.005637131631374359,
-0.011154784820973873,
-0.004232403822243214,
-0.012446777895092964,
0.008914345875382423,
-0.009745430201292038,
0.008784351870417595,
0.0051041836850345135,
-0.008299154229462147,
0.006209563929587603,
-0.001731175696477294,
0.006274071987718344,
0.0020286741200834513,
0.008507353253662586,
-0.004152598325163126,
-0.004127952735871077,
-0.007154642138630152,
0.016339024528861046,
-0.014049706980586052,
-0.004307459574192762,
0.017167996615171432,
0.005715375766158104,
0.012209341861307621,
0.00225377781316638,
-0.00042379662045277655,
0.005534588824957609,
0.008682278916239738,
-0.013040687888860703,
0.005084352567791939,
-0.001828238251619041,
-0.0012562707997858524,
0.008480580523610115,
-0.004266352858394384,
0.002221567090600729,
0.0046165683306753635,
0.0028117650654166937,
-0.007917914539575577,
-0.0034690035972744226,
-0.0009495366830378771,
0.0011306906817480922,
-0.01355473231524229,
-0.0009809527546167374,
-0.004958041477948427,
-0.006103434134274721,
-0.007232369389384985,
-0.0017065956490114331,
0.0001330282975686714,
0.003920484334230423,
-0.0036693995352834463,
0.005495268851518631,
0.005694851744920015,
-0.005899674259126186,
0.0201372429728508,
-0.0013780072331428528,
-0.00789879821240902,
0.007846701890230179,
0.0025265382137149572,
0.001421264256350696,
-0.008429169654846191,
-0.003245558124035597,
0.0011850225273519754,
0.0028714274521917105,
-0.0003766246372833848,
-0.008802070282399654,
-0.005608130246400833,
-0.0034721381962299347,
-0.006641292478889227,
0.0005237108562141657,
0.008834129199385643,
-0.0009935038397088647,
0.0012059086002409458,
0.0008119153208099306,
-0.006584430579096079,
-0.022336522117257118,
0.06354773789644241,
-0.0002220585010945797,
0.002910204231739044,
0.009082237258553505,
-0.004909673240035772,
-0.0012496778508648276,
-0.002746598096564412,
0.006383356638252735,
-0.008032247424125671,
-0.008524876087903976,
0.010750295594334602,
-0.0009633725858293474,
0.0005248680245131254,
-0.0007350041996687651,
-0.0027120839804410934,
0.013966328464448452,
-0.0057861050590872765,
-0.021036183461546898,
-0.010547453537583351,
0.010853840038180351,
-0.005524447187781334,
-0.004741441458463669,
0.005286922678351402,
-0.006648934446275234,
0.0030016733799129725,
0.0006623461376875639,
0.005029626656323671,
-0.002193703316152096,
0.002940030535683036,
-0.0005794414319097996,
-0.0022170429583638906,
0.004064080771058798,
0.0045896111987531185,
0.005342120770365,
0.010187845677137375,
0.00010989452857756987,
0.006808626931160688,
-0.0016152776079252362,
0.0025299766566604376,
-0.00003398674016352743,
0.00816661212593317,
0.007334881462156773,
-0.0010068932315334678,
-0.00391934672370553,
0.0033756669145077467,
0.005510678980499506,
0.000768515223171562,
0.014146390371024609,
0.0026186564937233925,
-0.004143540281802416,
0.006503402255475521,
0.006116392090916634,
-0.0035241839941591024,
0.009517824277281761,
-0.0021596101578325033,
0.004842759575694799,
0.0013016877928748727,
-0.007584663107991219,
-0.008292772807180882,
0.001842405879870057,
0.0032016451004892588,
0.010260038077831268,
-0.0028249176684767008,
-0.00236403732560575,
-0.0007315132534131408,
-0.0009584333165548742,
-0.006800164468586445,
-0.005093367304652929,
-0.007033489644527435,
-0.0006556098815053701,
0.002291958313435316,
0.07484756410121918,
-0.007452124729752541,
-0.004441418685019016,
-0.011579487472772598,
0.002777048386633396,
-0.0002700282202567905,
-0.0030089470092207193,
-0.004564293660223484,
0.0015766742872074246,
0.002756596077233553,
0.004056832753121853,
-0.009703550487756729,
-0.011725104413926601,
0.002558979205787182,
0.001969910692423582,
0.00014999773702584207,
0.005029522813856602,
0.009036225266754627,
-0.0035637416876852512,
0.004177682101726532,
-0.015180298127233982,
-0.0033562968019396067,
-0.004108168184757233,
-0.008418906480073929,
-0.0034481303300708532,
-0.006006728392094374,
0.00021460770221892744,
0.006645490415394306,
0.004827416967600584,
-0.00707657914608717,
0.0054144663736224174,
-0.0028445045463740826,
0.0016556625487282872,
-0.0004462617798708379,
-0.0033168864902108908,
-0.0065432204864919186,
0.005108962766826153,
-0.000903427368029952,
-0.01305375900119543,
-0.00362391141243279,
-0.0033721844665706158,
-0.0002401503879809752,
-0.007945619523525238,
0.007525082211941481,
-0.0006434269598685205,
0.014306762255728245,
-0.00022176832135301083,
0.002702883444726467,
-0.003358570858836174,
0.0007307041669264436,
-0.013335973024368286,
0.00420218612998724,
-0.19164948165416718,
0.008420647121965885,
0.001226596301421523,
-0.005158919375389814,
-0.006783672608435154,
-0.013385222293436527,
-0.011425668373703957,
0.0026828674599528313,
0.009005146101117134,
0.000557876075617969,
0.002953520743176341,
-0.005221473053097725,
0.0021873493678867817,
0.002457532798871398,
-0.001536316005513072,
-0.004762463271617889,
0.0049041337333619595,
-0.0016014630673453212,
-0.004632484167814255,
0.005968684796243906,
0.006500089541077614,
0.008091297931969166,
0.0054030572064220905,
0.00019077146134804934,
0.001583037432283163,
-0.0035112439654767513,
0.006033244077116251,
-0.0037521137855947018,
0.00787651352584362,
-0.006466935854405165,
-0.006440065335482359,
-0.007224400062114,
-0.006828725803643465,
0.003498959122225642,
0.003880165982991457,
-0.0030333269387483597,
0.003506771521642804,
0.0008973774965852499,
-0.009869552217423916,
0.00746230548247695,
-0.003825646825134754,
0.033615149557590485,
0.0026575177907943726,
0.01012427732348442,
0.000984087586402893,
0.0018356959335505962,
-0.0034386140760034323,
0.008406088687479496,
0.0028282145503908396,
0.010696080513298512,
-0.01177073922008276,
-0.007112348917871714,
0.00102786545176059,
0.017467396333813667,
-0.005919044837355614,
-0.009285422042012215,
-0.008123870939016342,
-0.009712940081954002,
0.005232554394751787,
0.01538246963173151,
0.010695005767047405,
-0.004118768963962793,
0.009240156970918179,
-0.002042175503447652,
-0.02155677042901516,
0.000019792594684986398,
-0.0018981510074809194,
-0.0070618982426822186,
-0.002420001896098256,
0.0071546281687915325,
0.01089960802346468,
-0.006482566706836224,
0.00971543975174427,
0.0007437755702994764,
0.0005842825048603117,
-0.0013051093555986881,
0.0058111525140702724,
-0.005721673835068941,
0.0058092293329536915,
-0.0074221910908818245,
0.01122762355953455,
-0.005934969987720251,
-0.0024999442975968122,
0.00020036016940139234,
-0.0017432768363505602,
0.013896115124225616,
0.006557243876159191,
0.0007543435203842819,
-0.001956961350515485,
-0.011297978460788727,
-0.002196521032601595,
0.0020186069887131453,
0.004135102033615112,
-0.005033328663557768,
0.0034497100859880447,
-0.00407934607937932,
0.0020487885922193527,
0.008424926549196243,
-0.004078282508999109,
0.004977155942469835,
0.006150324363261461,
-0.0058002592995762825,
0.001991123892366886,
-0.0031325549352914095,
-0.0031166698317974806,
0.003443003399297595,
-0.006422903388738632,
-0.010294316336512566,
0.004796995315700769,
-0.004293376579880714,
-0.0053918613120913506,
0.0031274380162358284,
-0.01131761446595192,
-0.008425095118582249,
0.0021580681204795837,
-0.013567985035479069,
0.0002631728712003678
] |
8a5e3b1295194140be07e7851df9a2e6e39cc960 | 529 | py | Python | Day22_Pong/ball.py | syt1209/PythonProjects | 0409dbd3c0b0ddf00debc38875059c828eb31dec | [
"MIT"
] | 1 | 2021-02-16T00:59:29.000Z | 2021-02-16T00:59:29.000Z | Day22_Pong/ball.py | syt1209/PythonProjects | 0409dbd3c0b0ddf00debc38875059c828eb31dec | [
"MIT"
] | null | null | null | Day22_Pong/ball.py | syt1209/PythonProjects | 0409dbd3c0b0ddf00debc38875059c828eb31dec | [
"MIT"
] | null | null | null | from turtle import Turtle
SPEED = 10
class Ball(Turtle):
def __init__(self):
super().__init__()
self.penup()
self.color("white")
self.shape("circle")
self.move_speed = 0.1
self.y_bounce = 1
self.x_bounce = 1
def move(self):
new_x = self.xcor() + SPEED*self.x_bounce
new_y = self.ycor() + SPEED*self.y_bounce
self.goto(new_x, new_y)
def reset(self):
self.goto(0, 0)
self.move_speed = 0.1
self.x_bounce *= -1
| 20.346154 | 49 | 0.551985 | 1 | 0.8451 | [
0.0020777108147740364,
0.026260072365403175,
0.007425291463732719,
-0.0019852318800985813,
0.007890826091170311,
-0.0036895954981446266,
-0.010945877060294151,
0.0004162818950135261,
-0.008242430165410042,
0.0027351751923561096,
0.0022371767554432154,
0.006085236091166735,
0.007516476325690746,
-0.014330927282571793,
0.0017524652648717165,
0.01677061803638935,
-0.05240345373749733,
0.0007388284429907799,
-0.0005361517542041838,
0.003234335919842124,
-0.005644035525619984,
0.012713692151010036,
0.007406703196465969,
0.007783643435686827,
0.006512079853564501,
0.0013770204968750477,
0.010062722489237785,
0.005547820590436459,
-0.010601246729493141,
-0.009328003041446209,
-0.004840855021029711,
-0.002348271431401372,
-0.006519954651594162,
-0.009936004877090454,
0.008886509574949741,
-0.0027825741562992334,
0.0009265623521059752,
-0.02168646827340126,
0.010061366483569145,
-0.004241723567247391,
-0.0058333310298621655,
-0.016775038093328476,
-0.0008319461485370994,
0.005068322643637657,
-0.01062686461955309,
0.0009837173856794834,
-0.004202709533274174,
0.004245279356837273,
-0.00903337448835373,
0.0063214353285729885,
-0.01413696352392435,
0.006899525877088308,
0.0153046865016222,
0.005538681522011757,
-0.0061610061675310135,
-0.0071055712178349495,
0.012698662467300892,
0.001021454343572259,
-0.01095527969300747,
-0.0033896763343364,
-0.0027699728962033987,
-0.001087392563931644,
0.00415015360340476,
0.0007292137015610933,
-0.018520493060350418,
-0.008227067068219185,
-0.00732256518676877,
0.006086623761802912,
-0.004974587820470333,
0.003967778757214546,
0.0016741026192903519,
-0.000413982110330835,
0.008048010058701038,
0.001298478338867426,
0.004138175863772631,
-0.007057319860905409,
-0.0033431064803153276,
0.0005275404546409845,
0.007094807457178831,
0.0014286346267908812,
0.007636824157088995,
-0.009359670802950859,
0.0039831059984862804,
0.009045963175594807,
0.01110069826245308,
0.0069208694621920586,
0.017178332433104515,
-0.009085875004529953,
0.0453852154314518,
0.011529866605997086,
-0.012021193280816078,
-0.00024282452068291605,
-0.007568201050162315,
-0.004599674604833126,
-0.004547073971480131,
-0.030146358534693718,
-0.004084987100213766,
-0.0029647471383213997,
-0.0004710086213890463,
0.0027282771188765764,
0.0008318058680742979,
0.009648225270211697,
-0.0004398793971631676,
-0.0064846607856452465,
-0.011582820676267147,
0.013606743887066841,
-0.009366460144519806,
-0.005788441281765699,
0.010290038771927357,
0.0007634135545231402,
-0.011970262043178082,
0.0005256259464658797,
0.0019995232578366995,
-0.013267602771520615,
0.005937645211815834,
-0.0009162133210338652,
-0.009187696501612663,
0.055235736072063446,
-0.002238921821117401,
-0.002481799805536866,
-0.006498825736343861,
0.0009055675473064184,
0.003832210786640644,
0.00793981272727251,
0.009895316325128078,
-0.0023533303756266832,
0.012057485058903694,
0.011881356127560139,
0.007632006891071796,
0.008894053287804127,
-0.0020978013053536415,
0.012459732592105865,
-0.0010768331121653318,
-0.00036855743383057415,
0.005150142591446638,
-0.006962902378290892,
0.009356942027807236,
-0.0008970849448814988,
-0.0090019004419446,
0.006857297383248806,
-0.0005232905386947095,
-0.013195396400988102,
0.0028075187001377344,
-0.000973951886408031,
0.0014778687618672848,
-0.008878989145159721,
-0.004624247085303068,
-0.005339028779417276,
-0.0046461038291454315,
0.004333111923187971,
0.010694882832467556,
0.004985285922884941,
0.004561037290841341,
-0.0075089773163199425,
-0.010744908824563026,
-0.0024508952628821135,
-0.0026386012323200703,
-0.0009155950392596424,
0.012431293725967407,
0.006879673805087805,
-0.01011656504124403,
-0.0029777016025036573,
0.003495302051305771,
0.006211065221577883,
-0.002890557050704956,
0.0018469044007360935,
-0.007512606680393219,
0.008397245779633522,
0.0003415588289499283,
0.0013704517623409629,
0.014009586535394192,
-0.002599839586764574,
-0.0001971223537111655,
-0.0006636276957578957,
0.0014880918897688389,
-0.0006548913079313934,
0.004841155372560024,
0.013271459378302097,
-0.004850910976529121,
-0.003988676238805056,
0.00826188363134861,
0.0014979487750679255,
0.0064202263019979,
0.006015011575073004,
-0.0018908737692981958,
0.00322741805575788,
-0.0024340974632650614,
-0.0024443359579890966,
0.00518275611102581,
-0.002018110593780875,
0.006802944000810385,
0.006929329596459866,
-0.011804576963186264,
-0.011361146345734596,
-0.0007541622035205364,
-0.011884799227118492,
0.0010107278358191252,
0.015309465117752552,
0.011053892783820629,
-0.002928219735622406,
0.002623705891892314,
-0.011975922621786594,
-0.0012980756582692266,
0.006352289114147425,
0.0018165642395615578,
-0.011509048752486706,
-0.9546335339546204,
0.007246316876262426,
0.00025570261641405523,
0.0006024576141498983,
0.005991838872432709,
0.003392007201910019,
0.0031530659180134535,
0.0025556643959134817,
0.016086025163531303,
-0.008047398179769516,
-0.007377970032393932,
-0.012714451178908348,
-0.011256689205765724,
0.0006948431255295873,
-0.00863819383084774,
-0.004541680682450533,
-0.007768901996314526,
-0.008442939259111881,
-0.006902399472892284,
-0.003108114004135132,
-0.0020146274473518133,
0.011651690118014812,
-0.00044210298801772296,
0.006225932855159044,
0.005453316029161215,
0.0047117359936237335,
-0.008815578185021877,
-0.0003343409625813365,
0.0002077859826385975,
-0.0019943220540881157,
-0.0044016181491315365,
-0.011449459008872509,
-0.00795277301222086,
-0.0011658647563308477,
0.012269213795661926,
-0.003173291450366378,
0.009928234852850437,
0.000014589023521693889,
0.0018878316041082144,
-0.007156095467507839,
0.007404489908367395,
0.0022613219916820526,
0.0029499055817723274,
-0.030643688514828682,
-0.0013389124069362879,
-0.0021677399054169655,
-0.010760816745460033,
0.008176563307642937,
0.00238496670499444,
-0.0013516946928575635,
-0.004000862594693899,
-0.002531343838199973,
0.010141695849597454,
-0.008822799660265446,
0.003757594618946314,
-0.005666378885507584,
-0.00569276325404644,
-0.0038694723043590784,
-0.01051217969506979,
-0.0006426587351597846,
0.0020181310828775167,
-0.0057522207498550415,
-0.0037995725870132446,
-0.0012817280367016792,
0.004894420504570007,
0.004423700273036957,
0.0026602160651236773,
-0.01762164942920208,
-0.004345668945461512,
0.0028570028953254223,
0.00088509387569502,
-0.0023400590289384127,
-0.004784991033375263,
-0.00016969756688922644,
-0.01091364212334156,
0.0032296127174049616,
0.0012186799431219697,
0.000646326458081603,
-0.014088708907365799,
-0.0032826224341988564,
-0.010031506419181824,
-0.007274209521710873,
0.003946693614125252,
-0.0046893334947526455,
-0.0041881040669977665,
-0.0006127831875346601,
0.001298048417083919,
0.007328555919229984,
-0.007048908621072769,
0.005524179432541132,
0.010423981584608555,
0.001914749387651682,
-0.008155382238328457,
0.007952759973704815,
0.00832721684128046,
0.0031433189287781715,
-0.004892928060144186,
0.005471640266478062,
0.008676065132021904,
0.010358190163969994,
0.0025070279370993376,
0.004186904523521662,
0.0016087230760604143,
0.008836724795401096,
-0.0016871299594640732,
0.0014015864580869675,
-0.00412013940513134,
0.0007748876814730465,
-0.0036792377941310406,
-0.002529236488044262,
-0.0027397223748266697,
-0.0014144516317173839,
-0.01253284141421318,
-0.00919952243566513,
-0.00401409761980176,
0.0012712737079709768,
0.0010696841636672616,
-0.0028979070484638214,
0.003165704198181629,
-0.0008937768288888037,
0.006750174798071384,
0.0031742353457957506,
-0.0042853462509810925,
0.00012148452515248209,
0.0026069292798638344,
-0.005240059457719326,
0.014669383876025677,
-0.012906360439956188,
0.0074388859793543816,
0.0001105733826989308,
-0.016039159148931503,
0.004751673433929682,
0.011125319637358189,
-0.00448529701679945,
-0.00009948375372914597,
0.002527534030377865,
0.004344963002949953,
-0.002888888120651245,
-0.004691658541560173,
-0.002567082177847624,
-0.017506759613752365,
0.0009365769219584763,
0.021227026358246803,
0.003426546696573496,
0.008320724591612816,
0.010365036316215992,
-0.00506181363016367,
0.00580546585842967,
0.008423586376011372,
0.004142699297517538,
0.015189332887530327,
-0.006750442553311586,
0.0013837780570611358,
-0.0009438740089535713,
-0.0038265862967818975,
0.0027983433101326227,
0.002895880490541458,
0.002405524952337146,
-0.005223957356065512,
-0.0006304677808657289,
-0.0047417497262358665,
-0.006482210010290146,
-0.018162162974476814,
-0.0022048121318221092,
0.008888059295713902,
-0.006062614731490612,
0.007557000499218702,
-0.01379403006285429,
0.0035268524661660194,
0.006018118001520634,
0.002423994243144989,
-0.0013573565520346165,
0.0001572693872731179,
0.007329750806093216,
0.011848420836031437,
-0.006038739811629057,
0.003644051030278206,
0.0025022244080901146,
-0.005918804090470076,
0.0012988769449293613,
0.011163722723722458,
-0.0064845881424844265,
-0.006698697805404663,
0.0015228403499349952,
0.0019404112827032804,
0.0014159680576995015,
-0.003975679632276297,
-0.009503324516117573,
-0.004826693795621395,
0.0025583996903151274,
-0.008891376666724682,
0.0037393884267657995,
0.002676920499652624,
0.0005848546861670911,
-0.009639598429203033,
0.0012100819731131196,
-0.0019272988429293036,
-0.010111999697983265,
0.009872280061244965,
-0.0012303282273933291,
0.002619778737425804,
0.011618511751294136,
0.0005401966045610607,
-0.015271570533514023,
0.006240645423531532,
0.007248777896165848,
-0.00803525373339653,
0.006224686745554209,
0.009112505242228508,
-0.007802220527082682,
-0.020598560571670532,
-0.0035153436474502087,
-0.01748550869524479,
0.004139205440878868,
-0.0030034894589334726,
-0.0002262655907543376,
-0.008600383996963501,
0.014445610344409943,
0.005362870171666145,
-0.010700790211558342,
-0.0010916581377387047,
-0.010359037667512894,
0.005214049480855465,
-0.0015099503798410296,
0.00023017011699266732,
-0.003036763519048691,
-0.00209803506731987,
-0.0023776174057275057,
-0.004046675283461809,
-0.004187924321740866,
0.0019531273283064365,
0.003030000254511833,
-0.0006675294134765863,
0.000617283396422863,
-0.004390048794448376,
-0.0008868105942383409,
0.0026972321793437004,
-0.014516924507915974,
-0.0005093597574159503,
0.007186295930296183,
-0.0014056613435968757,
-0.006895413622260094,
-0.0007398662273772061,
-0.0034587793052196503,
-0.00449151499196887,
-0.00891854614019394,
-0.0038157515227794647,
-0.0015043857274577022,
-0.0013951357686892152,
-0.011693795211613178,
-0.0013094366295263171,
-0.012603520415723324,
0.010255428031086922,
-0.006626789458096027,
0.006652175914496183,
0.005261230748146772,
-0.003997704945504665,
0.010027664713561535,
-0.0008726652595214546,
0.0020904780831187963,
0.001228708541020751,
0.0047855074517428875,
0.0018319102237001061,
-0.008630163967609406,
-0.014255668967962265,
0.01231371983885765,
-0.00873982161283493,
0.001818141550756991,
0.014828273095190525,
0.003675363026559353,
0.008887744508683681,
-0.0010083876550197601,
0.0013913186267018318,
0.004332382697612047,
0.00630942452698946,
-0.018244262784719467,
0.004257147666066885,
-0.0059929220005869865,
-0.0016926978714764118,
0.004407054744660854,
-0.00547144515439868,
0.0015162404160946608,
0.010325036942958832,
0.0038925425615161657,
-0.005641816649585962,
-0.004370835609734058,
-0.0019342453451827168,
0.003113676095381379,
-0.011073296889662743,
-0.0028427622746676207,
-0.0031774553935974836,
-0.004672101233154535,
-0.004332689568400383,
-0.001998369814828038,
-0.0009544597123749554,
0.005401598289608955,
-0.00365269067697227,
0.004244066774845123,
0.004508012905716896,
-0.004251865204423666,
0.013889782130718231,
-0.004966593347489834,
-0.007026422303169966,
0.0019191554747521877,
0.000052402621804503724,
-0.0033863638527691364,
-0.007478383369743824,
-0.002670145593583584,
0.0013280247803777456,
0.006902335211634636,
0.0002685108338482678,
-0.006615895312279463,
-0.004488636739552021,
0.0017098539974540472,
-0.00982267688959837,
0.0041778553277254105,
0.014267448335886002,
-0.0014577998081222177,
0.003441007575020194,
-0.0013861157931387424,
-0.009349778294563293,
-0.013795962557196617,
0.05594524368643761,
-0.001199259888380766,
0.005424730014055967,
0.009298133663833141,
-0.005997022148221731,
0.0011137851979583502,
-0.0006091238465160131,
0.006768652703613043,
-0.005649626720696688,
-0.007323101162910461,
0.00919339619576931,
0.0001495512406108901,
0.00462862616404891,
0.002895115641877055,
-0.003427234711125493,
0.0161376241594553,
-0.0061195008456707,
-0.01415353175252676,
-0.015255254693329334,
0.0019587567076087,
-0.005863995756953955,
-0.008747673593461514,
0.008262176997959614,
-0.0014566776808351278,
-0.0030740159563720226,
0.001047313679009676,
0.009015059098601341,
0.0021751413587480783,
-0.0007330017979256809,
-0.0036388898734003305,
-0.002093486487865448,
-0.00019481999333947897,
0.004863282665610313,
0.0035633514635264874,
0.007599034812301397,
-0.005085363052785397,
0.001550719840452075,
-0.0005232359399087727,
-0.0016612333711236715,
-0.00012369744945317507,
0.004470037762075663,
0.00690704770386219,
0.0007315799593925476,
-0.0005521547864191234,
0.007072194013744593,
0.005169473588466644,
0.0010250937193632126,
0.012352966703474522,
-0.0015612150309607387,
-0.005231190472841263,
0.006985197775065899,
0.010461464524269104,
-0.002771620638668537,
0.007324812933802605,
0.0004849892284255475,
0.007510804571211338,
0.0037258644588291645,
-0.0084878820925951,
-0.01171973068267107,
0.0006815475062467158,
0.007559605408459902,
0.009602546691894531,
-0.0002819504588842392,
0.002248801989480853,
-0.0012665924150496721,
-0.004131535533815622,
-0.010994755662977695,
-0.0094927828758955,
-0.0012580854818224907,
0.0026234330143779516,
0.004490421153604984,
0.07158416509628296,
-0.005919184070080519,
-0.0013455844018608332,
-0.01107263844460249,
0.002578784478828311,
-0.001021276111714542,
-0.0008775119786150753,
-0.0015835351077839732,
-0.0005933082429692149,
0.004641347099095583,
-0.00043751747580245137,
-0.009228958748281002,
-0.008935143239796162,
0.000656955293379724,
0.005222112871706486,
-0.0013248174218460917,
0.0025609079748392105,
0.0046129245311021805,
-0.007087831851094961,
0.003433073405176401,
-0.014691879972815514,
-0.0006312273908406496,
0.0007714882376603782,
-0.008482859469950199,
-0.004319334868341684,
-0.00158972991630435,
0.005033199209719896,
0.0013510441640391946,
0.006388736888766289,
-0.0055014826357364655,
0.007471844088286161,
-0.006594973616302013,
-0.0012165771331638098,
-0.00586536293849349,
0.001828715088777244,
-0.005210148636251688,
0.0076094758696854115,
0.001608528196811676,
-0.01050497405230999,
-0.008203055709600449,
-0.0011325558880344033,
0.0006996029987931252,
-0.007380306255072355,
0.006452878471463919,
-0.0016851070104166865,
0.006331531796604395,
-0.005820943042635918,
0.004807591903954744,
-0.005354763939976692,
0.0006198529154062271,
-0.014672691933810711,
0.00490575423464179,
-0.17912371456623077,
0.009815969504415989,
0.003145831637084484,
-0.003379820380359888,
-0.0029874693136662245,
-0.015605543740093708,
-0.007859119214117527,
0.0034298673272132874,
0.009779022075235844,
0.005546562373638153,
0.0009276657365262508,
-0.0005172233795747161,
0.005280454643070698,
0.006732012610882521,
-0.002718012547120452,
-0.004674309864640236,
0.004279383923858404,
-0.00590971764177084,
0.000686393934302032,
0.006287265103310347,
0.005576733965426683,
0.006813713815063238,
0.0011988740880042315,
0.0042856186628341675,
0.00002208705154771451,
-0.005614774767309427,
0.006011128891259432,
-0.0018029523780569434,
0.0064107635989785194,
-0.012302694842219353,
-0.004690566100180149,
-0.0039026422891765833,
-0.0041303387843072414,
-0.003420354565605521,
0.002450662199407816,
0.00034212329774163663,
0.006634633522480726,
0.0012599971378222108,
-0.007829060778021812,
0.007006480824202299,
-0.007243024650961161,
0.031616050750017166,
0.005230288486927748,
0.010423880070447922,
0.0002442282566335052,
-0.004960498306900263,
-0.0061082998290658,
0.010233953595161438,
0.0026574491057544947,
0.01395249180495739,
-0.011811657808721066,
-0.0010732435621321201,
0.004497583489865065,
0.019832082092761993,
-0.005163596943020821,
-0.0076937004923820496,
-0.008206570520997047,
-0.004217417910695076,
0.0035026762634515762,
0.010613974183797836,
0.013110371306538582,
-0.005335008725523949,
0.007861138321459293,
-0.005762540269643068,
-0.021179422736167908,
0.007209649309515953,
-0.004011012148112059,
-0.008729101158678532,
0.003715779632329941,
0.007232259027659893,
0.010490911081433296,
-0.0017729437677189708,
0.007065244950354099,
0.00017115635273512453,
0.0050859712064266205,
-0.002695926697924733,
0.007394650485366583,
-0.002788159064948559,
0.0063965762965381145,
-0.008932964876294136,
0.010793969966471195,
-0.010579421184957027,
-0.002594540361315012,
0.0026963038835674524,
-0.004571060184389353,
0.011753649450838566,
0.00389009527862072,
-0.0050748493522405624,
-0.001396378269419074,
-0.011130697093904018,
-0.003358465153723955,
0.004502672702074051,
0.001031432650052011,
-0.008837251923978329,
0.004341403488069773,
-0.0018390578916296363,
0.00613205973058939,
0.009598758071660995,
-0.011595184914767742,
0.006729145534336567,
0.002315954538062215,
-0.008061065338551998,
0.0018448284827172756,
-0.004810026381164789,
0.002465074183419347,
0.006427807733416557,
-0.007949016988277435,
-0.0074494341388344765,
0.004218217451125383,
-0.007873683236539364,
-0.005849854089319706,
0.005901557393372059,
-0.010024546645581722,
-0.01061263494193554,
-0.000026751822588266805,
-0.014992909505963326,
0.0008418576326221228
] |
8a5eacf969c02364f5e4daefab7f03dd79ff6a0f | 447 | py | Python | programs/combine/jry2/treedef.py | lsrcz/SyGuS | 5aab1b2c324d8a3c20e51f8acb2866190a1431d3 | [
"MIT"
] | 1 | 2021-07-11T08:32:32.000Z | 2021-07-11T08:32:32.000Z | programs/combine/jry2/treedef.py | lsrcz/SyGuS | 5aab1b2c324d8a3c20e51f8acb2866190a1431d3 | [
"MIT"
] | null | null | null | programs/combine/jry2/treedef.py | lsrcz/SyGuS | 5aab1b2c324d8a3c20e51f8acb2866190a1431d3 | [
"MIT"
] | 1 | 2020-12-20T16:08:10.000Z | 2020-12-20T16:08:10.000Z | from jry2.semantics import Expr
class TreeNode:
pass
class TreeLeaf(TreeNode):
def __init__(self, term):
self.term = term
def getExpr(self):
return self.term
class TreeInnerNode(TreeNode):
def __init__(self, pred, left, right):
self.pred = pred
self.left = left
self.right = right
def getExpr(self):
return Expr('ite', self.pred, self.left.getExpr(), self.right.getExpr())
| 20.318182 | 80 | 0.630872 | 1 | 0.7821 | [
0.002274930477142334,
0.026301680132746696,
0.007464392110705376,
-0.0001321638555964455,
0.00675557553768158,
-0.007485437672585249,
-0.010913768783211708,
0.002966924337670207,
-0.005621160846203566,
0.0022033213172107935,
0.002407063962891698,
0.004062563180923462,
0.008450745604932308,
-0.014552738517522812,
0.002748801140114665,
0.019759178161621094,
-0.055621642619371414,
0.005178110208362341,
-0.0036755248438566923,
0.003059669863432646,
-0.005554138217121363,
0.00921601988375187,
0.00926454458385706,
0.007272754795849323,
0.005777832120656967,
0.0018828678876161575,
0.009149281308054924,
0.0032858902122825384,
-0.008461914025247097,
-0.006094148848205805,
-0.001402406021952629,
-0.0025007000658661127,
-0.0032012881711125374,
-0.010506883263587952,
0.008267541415989399,
-0.0037101851776242256,
0.001301519456319511,
-0.020439043641090393,
0.0117487832903862,
-0.005849603097885847,
-0.005981187801808119,
-0.017133992165327072,
0.00018122901383321732,
0.00431561004370451,
-0.009459472261369228,
0.0044672442600131035,
-0.004030214156955481,
0.00524681294336915,
-0.010475932620465755,
0.00601226557046175,
-0.011154877953231335,
0.007507064379751682,
0.013316025957465172,
0.001165609573945403,
-0.006699819583445787,
-0.007470936048775911,
0.010315142571926117,
0.0002785525575745851,
-0.010174368508160114,
-0.001389564131386578,
-0.003539137076586485,
-0.0015417097602039576,
0.003826261032372713,
0.00309156090952456,
-0.01940479315817356,
-0.00860754307359457,
-0.005000737961381674,
0.003910827450454235,
-0.0028320022393018007,
0.004734981805086136,
0.0014297226443886757,
-0.002113197697326541,
0.006454664748162031,
0.0019446280784904957,
0.004393925424665213,
-0.0030010626651346684,
-0.0022611310705542564,
-0.0010283634765073657,
0.00797844585031271,
0.0017405591206625104,
0.0039241802878677845,
-0.008508330211043358,
0.004843101836740971,
0.009612704627215862,
0.014470208436250687,
0.009444001130759716,
0.01973949372768402,
-0.011920008808374405,
0.046684376895427704,
0.010253326036036015,
-0.010787286795675755,
0.0024381536059081554,
-0.0070740715600550175,
-0.0033540846779942513,
-0.00143008294980973,
-0.02950168587267399,
0.0001669729535933584,
-0.005404608324170113,
0.0016913529252633452,
0.003495673183351755,
0.0026529249735176563,
0.008548161014914513,
0.001780994120053947,
-0.0036542240995913744,
-0.011135733686387539,
0.012048134580254555,
-0.01123475469648838,
-0.0033467733301222324,
0.008445062674582005,
0.003018382005393505,
-0.012262050062417984,
-0.0026220616418868303,
0.00301266903989017,
-0.011618210934102535,
0.006258353125303984,
0.002975632669404149,
-0.008175315335392952,
0.05667737498879433,
-0.00026691402308642864,
0.0034092434216290712,
-0.0070223319344222546,
-0.00009684103133622557,
0.0015104900812730193,
0.007844292558729649,
0.011170688085258007,
-0.0035618653055280447,
0.011448275297880173,
0.007975686341524124,
0.004746186546981335,
0.007252398878335953,
-0.0007457349565811455,
0.008588016033172607,
-0.0038425743114203215,
-0.0013518258929252625,
0.0019992936868220568,
-0.006172591354697943,
0.00925858411937952,
-0.0005641889292746782,
-0.008000404573976994,
0.0008988194749690592,
-0.0002584445755928755,
-0.011944038793444633,
0.0017629567300900817,
-0.004179001320153475,
0.0017390770372003317,
-0.009421509690582752,
-0.0028165814001113176,
-0.004425964783877134,
-0.0057176025584340096,
0.002558695152401924,
0.007943253964185715,
0.006774659268558025,
0.003306702012196183,
-0.006437769625335932,
-0.010411931201815605,
-0.0020709687378257513,
-0.004957045894116163,
0.0016577154165133834,
0.010580739006400108,
0.004542596638202667,
-0.008432939648628235,
-0.003069428727030754,
0.001663658651523292,
0.0027963921893388033,
-0.0014145741006359458,
0.0033443428110331297,
-0.009006175212562084,
0.007867277599871159,
0.0009822248248383403,
0.003928452730178833,
0.010693877004086971,
-0.004433907102793455,
-0.0010552621679380536,
0.0002240744070149958,
0.0007896126480773091,
0.001095255371183157,
0.002461689291521907,
0.008269312791526318,
-0.0025079662445932627,
-0.0034145410172641277,
0.005996102467179298,
0.005821361672133207,
0.010189231485128403,
0.006075120996683836,
-0.0024845523294061422,
0.0018530377419665456,
-0.0033390067983418703,
-0.0016911401180550456,
0.008195352740585804,
-0.004175608046352863,
0.005873079411685467,
0.006550758611410856,
-0.014256631024181843,
-0.008120396174490452,
0.00039472218486480415,
-0.010032379068434238,
0.0013509842101484537,
0.016843141987919807,
0.010511664673686028,
0.000009477835192228667,
0.0036181153263896704,
-0.01129909511655569,
-0.0004932526499032974,
0.007162186317145824,
0.00227303896099329,
-0.012582032009959221,
-0.9555304646492004,
0.0037960263434797525,
0.0023652107920497656,
-0.000820696703158319,
0.006746738683432341,
0.002336034318432212,
0.003722915193066001,
0.0018989865202456713,
0.00991638284176588,
-0.011142706498503685,
-0.01020639855414629,
-0.01012533437460661,
-0.0124736363068223,
0.00099069660063833,
-0.006482450757175684,
-0.004038436338305473,
-0.00589503301307559,
-0.008376427926123142,
-0.0017051261384040117,
-0.002889750525355339,
-0.0013230490731075406,
0.008933554403483868,
-0.00163275096565485,
0.002756701549515128,
0.002410256303846836,
0.004035324323922396,
-0.0059834374114871025,
-0.0008016684441827238,
-0.00007478475890820846,
-0.0019229431636631489,
-0.007852161303162575,
-0.015533754602074623,
-0.006669408176094294,
0.0003194838354829699,
0.012360106222331524,
-0.002150470856577158,
0.008744821883738041,
-0.0026673409156501293,
0.001075391541235149,
-0.008919119834899902,
0.00566138094291091,
-0.0011192262172698975,
0.005657832603901625,
-0.02943464182317257,
-0.0005604841280728579,
-0.0015546833164989948,
-0.005461324471980333,
0.008132151328027248,
0.0021761630196124315,
-0.002150042913854122,
-0.0018018505070358515,
-0.005772525444626808,
0.009615682996809483,
-0.007964146323502064,
0.004606383386999369,
-0.0032272334210574627,
-0.007519210688769817,
-0.004678626079112291,
-0.008537080138921738,
0.0015170149272307754,
0.00536308391019702,
-0.0037983269430696964,
-0.0052549755200743675,
-0.004293747711926699,
0.0017778220353648067,
0.0028104009106755257,
0.0005478524253703654,
-0.01788579300045967,
-0.0055254120379686356,
-0.0034391223452985287,
0.003521538572385907,
-0.0009915271075442433,
-0.002788187237456441,
0.002469822997227311,
-0.009440723806619644,
0.006926930043846369,
0.0013441650662571192,
0.00027833139756694436,
-0.010605012997984886,
0.0013044776860624552,
-0.009423382580280304,
-0.007665316574275494,
0.002377083757892251,
-0.005406373646110296,
-0.004133629612624645,
-0.0009533936972729862,
0.004254989326000214,
0.007287258747965097,
-0.006316628307104111,
0.002799313748255372,
0.010997702367603779,
-0.0031011763494461775,
-0.010450052097439766,
0.006743942387402058,
0.007117563858628273,
-0.0010311054065823555,
-0.002212200779467821,
0.001615875051356852,
0.010708814486861229,
0.009528214111924171,
0.0026886987034231424,
0.0066728368401527405,
0.0009509079973213375,
0.010603963397443295,
0.00035288496292196214,
0.001987073104828596,
-0.0020823932718485594,
0.00039217047742567956,
-0.0036164820194244385,
-0.0010390320094302297,
-0.0019421555334702134,
-0.0005428294534794986,
-0.011595136485993862,
-0.011334926821291447,
-0.006519028451293707,
0.0020714455749839544,
0.0023471543099731207,
-0.0031964757945388556,
0.0019157553324475884,
0.0012925361515954137,
0.00922885537147522,
0.002127255778759718,
-0.005352625623345375,
0.0009455020190216601,
0.002763535128906369,
-0.008332492783665657,
0.01472841389477253,
-0.013557096011936665,
0.008023601025342941,
-0.0007655713125132024,
-0.016505243256688118,
0.007244753651320934,
0.00893158745020628,
-0.008256714791059494,
-0.0009558082092553377,
0.0009049852378666401,
0.003316226415336132,
0.0017146780155599117,
-0.0062821959145367146,
-0.0028722784481942654,
-0.019352706149220467,
-0.00006690621376037598,
0.02077247016131878,
0.00010063884838018566,
0.012351006269454956,
0.012191696092486382,
-0.0055022286251187325,
0.0026234795805066824,
0.006702778860926628,
0.0016838809242472053,
0.013348788022994995,
-0.008928797207772732,
0.0011914994101971388,
0.0013381417375057936,
-0.004424990154802799,
0.00047617798554711044,
0.005113414954394102,
0.0032116903457790613,
-0.0019323674496263266,
0.0034225224517285824,
-0.007120268419384956,
-0.004392735660076141,
-0.01940225064754486,
-0.002442766446620226,
0.008322332054376602,
-0.004298522602766752,
0.00546087883412838,
-0.010808797553181648,
0.002147303894162178,
0.007550202310085297,
0.002297855680808425,
-0.0008558205445297062,
-0.0005771268042735755,
0.002766961697489023,
0.011278996244072914,
-0.006059362553060055,
0.003956635948270559,
0.004102662205696106,
0.00034264835994690657,
0.001763610984198749,
0.009075773879885674,
-0.007383311633020639,
-0.006078936159610748,
0.002049674978479743,
0.003790919901803136,
0.0012450559297576547,
-0.0035818663891404867,
-0.008651917800307274,
-0.003794910619035363,
0.0043205153197050095,
-0.008142683655023575,
0.003508156631141901,
0.003458470804616809,
0.003922271076589823,
-0.009221714921295643,
0.000600904633756727,
-0.0019347236957401037,
-0.009905034676194191,
0.010284651070833206,
-0.0036322097294032574,
0.0034544416703283787,
0.013060730881989002,
0.003746702801436186,
-0.013536307029426098,
0.005635430570691824,
0.01017012819647789,
-0.0051908912137150764,
0.0034437570720911026,
0.007799538318067789,
-0.005910158157348633,
-0.02463119849562645,
-0.000033658547181403264,
-0.0147837083786726,
0.008124500513076782,
-0.004390015732496977,
0.0018829823238775134,
-0.009591929614543915,
0.009198169223964214,
0.00469631515443325,
-0.013182280585169792,
-0.004265490919351578,
-0.010584002360701561,
0.0085488585755229,
-0.0016291175270453095,
-0.0004444363876245916,
-0.0032040118239820004,
-0.003446173621341586,
-0.00029050474404357374,
-0.002915774704888463,
-0.002275512320920825,
0.0054587977938354015,
0.00244763377122581,
-0.0036842639092355967,
0.002728346735239029,
-0.00287829153239727,
0.0008573448867537081,
0.001652497099712491,
-0.011184319853782654,
0.0022123181261122227,
0.006180521100759506,
-0.0015484588220715523,
-0.003655270906165242,
0.0008981939754448831,
-0.0036984800826758146,
-0.006445708218961954,
-0.011596789583563805,
-0.004296618513762951,
-0.0029938984662294388,
-0.004485235083848238,
-0.012055628001689911,
-0.001034436165355146,
-0.009656318463385105,
0.006634542252868414,
-0.007015542592853308,
0.009301047772169113,
0.0037757286336272955,
-0.004812473431229591,
0.007411826867610216,
-0.0026454899925738573,
0.004849012941122055,
0.004266039002686739,
0.00607889611274004,
0.0003044490877073258,
-0.007092329207807779,
-0.010080540552735329,
0.011979658156633377,
-0.010101289488375187,
0.00015310033631976694,
0.013319729827344418,
0.004083175677806139,
0.009909110143780708,
0.0019257976673543453,
-0.000328356574755162,
0.0031127880793064833,
0.00606944365426898,
-0.015373564325273037,
0.003932383377104998,
-0.0002060543338302523,
-0.0027228761464357376,
0.004182121716439724,
-0.003089373465627432,
0.0017250048695132136,
0.007116508670151234,
0.002381616272032261,
-0.009584951214492321,
-0.004692359361797571,
0.00135239667724818,
0.002135745482519269,
-0.011943426914513111,
-0.00261168135330081,
-0.0034676254726946354,
-0.004723785910755396,
-0.002675910945981741,
-0.0017024262342602015,
-0.002270517870783806,
0.0037491151597350836,
-0.0015902903396636248,
0.006528818979859352,
0.004133798182010651,
-0.0043033710680902,
0.013114362955093384,
-0.006330594886094332,
-0.007125338073819876,
0.00389104220084846,
0.002069101668894291,
-0.0014093482168391347,
-0.006555269006639719,
-0.002848703181371093,
0.001567732309922576,
0.0062017738819122314,
-0.0021236722823232412,
-0.005411611404269934,
-0.004721521399915218,
0.0017385166138410568,
-0.010612133890390396,
0.0023503450211137533,
0.011057895608246326,
-0.003022393910214305,
0.0032280469313263893,
-0.0021388798486441374,
-0.007919312454760075,
-0.014023319818079472,
0.05375675484538078,
-0.00006834888336015865,
0.0024870960041880608,
0.004287604242563248,
-0.007027186919003725,
-0.0008648355142213404,
-0.0030731919687241316,
0.007568467874079943,
-0.006395486183464527,
-0.006998105905950069,
0.008887306787073612,
-0.002374831819906831,
0.003782220184803009,
0.004586588125675917,
-0.001842656871303916,
0.016397686675190926,
-0.005636805668473244,
-0.01845039613544941,
-0.01534948218613863,
0.006585699040442705,
-0.0023377100005745888,
-0.008036901243031025,
0.008776731789112091,
-0.0019416954601183534,
-0.004265621304512024,
0.0011176497209817171,
0.0069046104326844215,
0.00015145012002903968,
0.0024952644016593695,
-0.0020910543389618397,
-0.0036513302475214005,
0.00047766350326128304,
0.0023174392990767956,
0.006453235633671284,
0.004823782481253147,
-0.0031307144090533257,
0.0037991078570485115,
-0.0014729113318026066,
-0.0014421852538362145,
0.0016763474559411407,
0.0036795204505324364,
0.006333452649414539,
0.000036647474189521745,
-0.0031510069966316223,
0.0043772379867732525,
0.0064691840671002865,
0.002385814441367984,
0.011299913749098778,
0.0012348367599770427,
-0.0055979047901928425,
0.009547652676701546,
0.008608352392911911,
-0.000483755546156317,
0.007944345474243164,
0.0019786946941167116,
0.005280987359583378,
0.0019956170581281185,
-0.008125495165586472,
-0.013102696277201176,
-0.00162833696231246,
0.004821597598493099,
0.009129045531153679,
-0.00033783624530769885,
0.0006798874819651246,
0.0006328183226287365,
-0.0013301529688760638,
-0.008959607221186161,
-0.006914800964295864,
-0.001389520475640893,
0.0014272418338805437,
0.003212867770344019,
0.06976109743118286,
-0.006959525402635336,
-0.0018554904963821173,
-0.007497617043554783,
-0.0005301267956383526,
-0.0017021060921251774,
-0.00213914318010211,
-0.0019185194978490472,
-0.0007626384031027555,
0.002314789919182658,
0.00038888270501047373,
-0.006856423337012529,
-0.0105490293353796,
-0.0002738325565587729,
0.0025930041447281837,
-0.0028908555395901203,
0.0036926944740116596,
0.00526277394965291,
-0.007656887173652649,
0.0021486750338226557,
-0.013319391757249832,
-0.002755584195256233,
-0.0013231511693447828,
-0.010787159204483032,
-0.002324224915355444,
-0.0032814578153192997,
0.0036009347531944513,
0.004267103038728237,
0.007727965712547302,
-0.004655872471630573,
0.005364646203815937,
-0.0017699397867545485,
-0.00003255774936405942,
-0.0018495044205337763,
-0.0012790539767593145,
-0.008093852549791336,
0.007911063730716705,
0.001074262079782784,
-0.011200928129255772,
-0.007064295932650566,
-0.003997483290731907,
0.0015282650711014867,
-0.006146468222141266,
0.006091080140322447,
0.0007925187237560749,
0.010019626468420029,
-0.002703747246414423,
0.0004297089180909097,
-0.0039924317970871925,
0.0012923730537295341,
-0.013169459067285061,
0.004567381925880909,
-0.1808568835258484,
0.010416826233267784,
0.0026522253174334764,
-0.0031361777801066637,
-0.003323968034237623,
-0.01643763855099678,
-0.007025777827948332,
0.0029407867696136236,
0.008306872099637985,
0.0011300771730020642,
-0.00017528671014588326,
-0.004211663734167814,
0.006072305142879486,
0.0024831301998347044,
-0.0035687778145074844,
-0.006449512671679258,
0.00466772448271513,
-0.004890723153948784,
0.00041846444946713746,
0.006482307333499193,
0.008560744114220142,
0.007777753286063671,
0.005395351909101009,
0.0028821458108723164,
0.000010467411811987404,
-0.006370964925736189,
0.006200444418936968,
-0.003303620032966137,
0.00758720189332962,
-0.011786037124693394,
-0.003266759915277362,
-0.006296189967542887,
-0.004928596783429384,
0.002224197145551443,
0.001856501097790897,
-0.0017280667088925838,
0.008299547247588634,
0.0029271377716213465,
-0.009013615548610687,
0.008370224386453629,
-0.00595103157684207,
0.03253459557890892,
0.004083635285496712,
0.007333326619118452,
-0.000715782807674259,
-0.00337791396304965,
-0.0035637477412819862,
0.009605257771909237,
0.0030619720928370953,
0.010001386515796185,
-0.013613104820251465,
-0.003000289900228381,
0.00483868969604373,
0.019095836207270622,
-0.004951186943799257,
-0.009786908514797688,
-0.006095163524150848,
-0.005611273925751448,
0.002545891562476754,
0.01135786809027195,
0.013360929675400257,
-0.0043325829319655895,
0.00951086264103651,
-0.0026055886410176754,
-0.021315798163414,
0.0024694474413990974,
-0.003071747487410903,
-0.009560917504131794,
0.0013159409863874316,
0.0050254394300282,
0.010665331035852432,
-0.0031244903802871704,
0.006373811513185501,
-0.0006788410828448832,
0.00454683369025588,
-0.0016384022310376167,
0.0044523910619318485,
-0.0029441635124385357,
0.0038761175237596035,
-0.00989073608070612,
0.007451291661709547,
-0.008922367356717587,
-0.001990272430703044,
0.004970865324139595,
-0.003910308238118887,
0.010118810459971428,
0.004484319593757391,
-0.0010103037348017097,
0.00011551767966011539,
-0.012561330571770668,
-0.005789752118289471,
0.0025063662324100733,
0.0014669107040390372,
-0.008101437240839005,
0.003786644898355007,
-0.0022486569359898567,
0.00497629027813673,
0.006784387398511171,
-0.008870517835021019,
0.005516366101801395,
0.004565292503684759,
-0.008368498645722866,
0.0018956511048600078,
-0.002704454818740487,
0.0009272022289223969,
0.004497780930250883,
-0.0069410540163517,
-0.006046601105481386,
0.005510551854968071,
-0.007270989939570427,
-0.006426599808037281,
0.004502378404140472,
-0.009082340635359287,
-0.009308945387601852,
-0.0009779059328138828,
-0.012178082950413227,
0.002988597610965371
] |
8a5ec6dd61aef0b828a5fdf8e68715be0262b256 | 103,584 | py | Python | src/sage/modular/dirichlet.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | 1 | 2021-10-18T01:24:04.000Z | 2021-10-18T01:24:04.000Z | src/sage/modular/dirichlet.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | null | null | null | src/sage/modular/dirichlet.py | hsm207/sage | 020bd59ec28717bfab9af44d2231c53da1ff99f1 | [
"BSL-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
r"""
Dirichlet characters
A :class:`DirichletCharacter` is the extension of a homomorphism
.. MATH::
(\ZZ/N\ZZ)^* \to R^*,
for some ring `R`, to the map `\ZZ/N\ZZ \to R` obtained by sending
those `x\in\ZZ/N\ZZ` with `\gcd(N,x)>1` to `0`.
EXAMPLES::
sage: G = DirichletGroup(35)
sage: x = G.gens()
sage: e = x[0]*x[1]^2; e
Dirichlet character modulo 35 of conductor 35 mapping 22 |--> zeta12^3, 31 |--> zeta12^2 - 1
sage: e.order()
12
This illustrates a canonical coercion::
sage: e = DirichletGroup(5, QQ).0
sage: f = DirichletGroup(5,CyclotomicField(4)).0
sage: e*f
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -zeta4
AUTHORS:
- William Stein (2005-09-02): Fixed bug in comparison of Dirichlet
characters. It was checking that their values were the same, but
not checking that they had the same level!
- William Stein (2006-01-07): added more examples
- William Stein (2006-05-21): added examples of everything; fix a
*lot* of tiny bugs and design problem that became clear when
creating examples.
- Craig Citro (2008-02-16): speed up __call__ method for
Dirichlet characters, miscellaneous fixes
- Julian Rueth (2014-03-06): use UniqueFactory to cache DirichletGroups
"""
# ****************************************************************************
# Copyright (C) 2004-2006 William Stein <wstein@gmail.com>
# Copyright (C) 2014 Julian Rueth <julian.rueth@fsfe.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from __future__ import print_function
import sage.categories.all as cat
from sage.misc.all import prod
import sage.misc.prandom as random
import sage.modules.free_module as free_module
import sage.modules.free_module_element as free_module_element
import sage.rings.all as rings
import sage.rings.number_field.number_field as number_field
from sage.libs.pari import pari
from sage.categories.map import Map
from sage.rings.rational_field import is_RationalField
from sage.rings.complex_mpfr import is_ComplexField
from sage.rings.qqbar import is_AlgebraicField
from sage.rings.ring import is_Ring
from sage.misc.functional import round
from sage.misc.cachefunc import cached_method
from sage.misc.fast_methods import WithEqualityById
from sage.structure.element import MultiplicativeGroupElement
from sage.structure.gens_py import multiplicative_iterator
from sage.structure.parent import Parent
from sage.structure.sequence import Sequence
from sage.structure.factory import UniqueFactory
from sage.structure.richcmp import richcmp
from sage.arith.all import (binomial, bernoulli, kronecker, factor, gcd,
lcm, fundamental_discriminant, euler_phi, factorial, valuation)
def trivial_character(N, base_ring=rings.RationalField()):
r"""
Return the trivial character of the given modulus, with values in the given
base ring.
EXAMPLES::
sage: t = trivial_character(7)
sage: [t(x) for x in [0..20]]
[0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1]
sage: t(1).parent()
Rational Field
sage: trivial_character(7, Integers(3))(1).parent()
Ring of integers modulo 3
"""
return DirichletGroup(N, base_ring)(1)
TrivialCharacter = trivial_character
def kronecker_character(d):
"""
Return the quadratic Dirichlet character (d/.) of minimal
conductor.
EXAMPLES::
sage: kronecker_character(97*389*997^2)
Dirichlet character modulo 37733 of conductor 37733 mapping 1557 |--> -1, 37346 |--> -1
::
sage: a = kronecker_character(1)
sage: b = DirichletGroup(2401,QQ)(a) # NOTE -- over QQ!
sage: b.modulus()
2401
AUTHORS:
- Jon Hanke (2006-08-06)
"""
d = rings.Integer(d)
if d == 0:
raise ValueError("d must be nonzero")
D = fundamental_discriminant(d)
G = DirichletGroup(abs(D), rings.RationalField())
return G([kronecker(D,u) for u in G.unit_gens()])
def kronecker_character_upside_down(d):
"""
Return the quadratic Dirichlet character (./d) of conductor d, for
d0.
EXAMPLES::
sage: kronecker_character_upside_down(97*389*997^2)
Dirichlet character modulo 37506941597 of conductor 37733 mapping 13533432536 |--> -1, 22369178537 |--> -1, 14266017175 |--> 1
AUTHORS:
- Jon Hanke (2006-08-06)
"""
d = rings.Integer(d)
if d <= 0:
raise ValueError("d must be positive")
G = DirichletGroup(d, rings.RationalField())
return G([kronecker(u.lift(),d) for u in G.unit_gens()])
def is_DirichletCharacter(x):
r"""
Return True if x is of type DirichletCharacter.
EXAMPLES::
sage: from sage.modular.dirichlet import is_DirichletCharacter
sage: is_DirichletCharacter(trivial_character(3))
True
sage: is_DirichletCharacter([1])
False
"""
return isinstance(x, DirichletCharacter)
class DirichletCharacter(MultiplicativeGroupElement):
"""
A Dirichlet character.
"""
def __init__(self, parent, x, check=True):
r"""
Create a Dirichlet character with specified values on
generators of `(\ZZ/n\ZZ)^*`.
INPUT:
- ``parent`` -- :class:`DirichletGroup`, a group of Dirichlet
characters
- ``x`` -- one of the following:
- tuple or list of ring elements: the values of the
Dirichlet character on the standard generators of
`(\ZZ/N\ZZ)^*` as returned by
:meth:`sage.rings.finite_rings.integer_mod_ring.IntegerModRing_generic.unit_gens`.
- vector over `\ZZ/e\ZZ`, where `e` is the order of the
standard root of unity for ``parent``.
In both cases, the orders of the elements must divide the
orders of the respective generators of `(\ZZ/N\ZZ)^*`.
OUTPUT:
The Dirichlet character defined by `x` (type
:class:`DirichletCharacter`).
EXAMPLES::
sage: G.<e> = DirichletGroup(13)
sage: G
Group of Dirichlet characters modulo 13 with values in Cyclotomic Field of order 12 and degree 4
sage: e
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12
sage: loads(e.dumps()) == e
True
::
sage: G, x = DirichletGroup(35).objgens()
sage: e = x[0]*x[1]; e
Dirichlet character modulo 35 of conductor 35 mapping 22 |--> zeta12^3, 31 |--> zeta12^2
sage: e.order()
12
sage: loads(e.dumps()) == e
True
TESTS::
sage: G = DirichletGroup(10)
sage: TestSuite(G[1]).run()
It is checked that the orders of the elements in `x` are
admissible (see :trac:`17283`)::
sage: k.<i> = CyclotomicField(4)
sage: G = DirichletGroup(192)
sage: G([i, -1, -1])
Traceback (most recent call last):
...
ValueError: values (= (zeta16^4, -1, -1)) must have multiplicative orders dividing (2, 16, 2), respectively
sage: from sage.modular.dirichlet import DirichletCharacter
sage: M = FreeModule(Zmod(16), 3)
sage: DirichletCharacter(G, M([4, 8, 8]))
Traceback (most recent call last):
...
ValueError: values (= (4, 8, 8) modulo 16) must have additive orders dividing (2, 16, 2), respectively
"""
MultiplicativeGroupElement.__init__(self, parent)
if check:
orders = parent.integers_mod().unit_group().gens_orders()
if len(x) != len(orders):
raise ValueError("wrong number of values (= {}) on generators (want {})".format(x, len(orders)))
if free_module_element.is_FreeModuleElement(x):
x = parent._module(x)
if any(u * v for u, v in zip(x, orders)):
raise ValueError("values (= {} modulo {}) must have additive orders dividing {}, respectively"
.format(x, parent.zeta_order(), orders))
self.element.set_cache(x)
else:
R = parent.base_ring()
x = tuple(map(R, x))
if R.is_exact() and any(u**v != 1 for u, v in zip(x, orders)):
raise ValueError("values (= {}) must have multiplicative orders dividing {}, respectively"
.format(x, orders))
self.values_on_gens.set_cache(x)
else:
if free_module_element.is_FreeModuleElement(x):
self.element.set_cache(x)
else:
self.values_on_gens.set_cache(x)
@cached_method
def __eval_at_minus_one(self):
r"""
Efficiently evaluate the character at -1 using knowledge of its
order. This is potentially much more efficient than computing the
value of -1 directly using dlog and a large power of the image root
of unity.
We use the following. Proposition: Suppose eps is a character mod
`p^n`, where `p` is a prime. Then
`\varepsilon(-1) = -1` if and only if `p = 2` and
the factor of eps at 4 is nontrivial or `p > 2` and 2 does
not divide `\phi(p^n)/\mbox{\rm ord}(\varepsilon)`.
EXAMPLES::
sage: chi = DirichletGroup(20).0; chi._DirichletCharacter__eval_at_minus_one()
-1
"""
D = self.decomposition()
val = self.base_ring()(1)
for e in D:
if e.modulus() % 2 == 0:
if e.modulus() % 4 == 0:
val *= e.values_on_gens()[0] # first gen is -1 for 2-power modulus
elif (euler_phi(e.parent().modulus()) / e.order()) % 2:
val *= -1
return val
def __call__(self, m):
"""
Return the value of this character at the integer `m`.
.. warning::
A table of values of the character is made the first time
you call this (unless `m` equals -1)
EXAMPLES::
sage: G = DirichletGroup(60)
sage: e = prod(G.gens(), G(1))
sage: e
Dirichlet character modulo 60 of conductor 60 mapping 31 |--> -1, 41 |--> -1, 37 |--> zeta4
sage: e(-1)
-1
sage: e(2)
0
sage: e(7)
-zeta4
sage: Integers(60).unit_gens()
(31, 41, 37)
sage: e(31)
-1
sage: e(41)
-1
sage: e(37)
zeta4
sage: e(31*37)
-zeta4
sage: parent(e(31*37))
Cyclotomic Field of order 4 and degree 2
"""
N = self.modulus()
m = m % N
if self.values.is_in_cache() or m != N - 1:
return self.values()[m]
else:
return self.__eval_at_minus_one()
def change_ring(self, R):
"""
Return the base extension of ``self`` to ``R``.
INPUT:
- ``R`` -- either a ring admitting a conversion map from the
base ring of ``self``, or a ring homomorphism with the base
ring of ``self`` as its domain
EXAMPLES::
sage: e = DirichletGroup(7, QQ).0
sage: f = e.change_ring(QuadraticField(3, 'a'))
sage: f.parent()
Group of Dirichlet characters modulo 7 with values in Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878?
::
sage: e = DirichletGroup(13).0
sage: e.change_ring(QQ)
Traceback (most recent call last):
...
TypeError: Unable to coerce zeta12 to a rational
We test the case where `R` is a map (:trac:`18072`)::
sage: K.<i> = QuadraticField(-1)
sage: chi = DirichletGroup(5, K)[1]
sage: chi(2)
i
sage: f = K.complex_embeddings()[0]
sage: psi = chi.change_ring(f)
sage: psi(2)
-1.83697019872103e-16 - 1.00000000000000*I
"""
if self.base_ring() is R:
return self
G = self.parent().change_ring(R)
return G.element_class(G, [R(x) for x in self.values_on_gens()])
def _richcmp_(self, other, op):
"""
Compare ``self`` to ``other``.
.. NOTE::
Since there is no coercion between Dirichlet groups
of different moduli, characters of different moduli
compare as unequal, even if they define identical
functions on ``ZZ``.
EXAMPLES::
sage: e = DirichletGroup(16)([-1, 1])
sage: f = e.restrict(8)
sage: e == e
True
sage: f == f
True
sage: e == f
False
sage: k = DirichletGroup(7)([-1])
sage: k == e
False
"""
return richcmp(self.values_on_gens(), other.values_on_gens(), op)
def __hash__(self):
"""
Return the hash of ``self``.
EXAMPLES::
sage: e = DirichletGroup(16)([-1, 1])
sage: hash(e) == hash((-1,1))
True
"""
return hash(self.values_on_gens())
def __invert__(self):
"""
Return the multiplicative inverse of self.
EXAMPLES::
sage: e = DirichletGroup(13).0
sage: f = ~e
sage: f*e
Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1
"""
G = self.parent()
if G.zeta.is_in_cache():
x = -self.element()
else:
x = tuple(~z for z in self.values_on_gens())
return G.element_class(G, x, check=False)
def _mul_(self, other):
"""
Return the product of self and other.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: b
Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4
sage: a*b # indirect doctest
Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> zeta4
Multiplying elements whose parents have different zeta orders works::
sage: a = DirichletGroup(3, QQ, zeta=1, zeta_order=1)(1)
sage: b = DirichletGroup(3, QQ, zeta=-1, zeta_order=2)([-1])
sage: a * b # indirect doctest
Dirichlet character modulo 3 of conductor 3 mapping 2 |--> -1
"""
G = self.parent()
if G.zeta.is_in_cache():
x = self.element() + other.element()
else:
x = tuple(y * z for y, z in zip(self.values_on_gens(), other.values_on_gens()))
return G.element_class(G, x, check=False)
def __copy__(self):
"""
Return a (shallow) copy of this Dirichlet character.
EXAMPLES::
sage: G.<a> = DirichletGroup(11)
sage: b = copy(a)
sage: a is b
False
sage: a.element() is b.element()
False
sage: a.values_on_gens() is b.values_on_gens()
True
"""
# This method exists solely because of a bug in the cPickle module --
# see modsym/manin_symbols.py.
G = self.parent()
return G.element_class(G, self.values_on_gens(), check=False)
def __pow__(self, n):
"""
Return self raised to the power of n
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a^2
Dirichlet character modulo 20 of conductor 1 mapping 11 |--> 1, 17 |--> 1
sage: b^2
Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -1
"""
G = self.parent()
if G.zeta.is_in_cache():
x = n * self.element()
else:
x = tuple(z**n for z in self.values_on_gens())
return G.element_class(G, x, check=False)
def _repr_short_(self):
r"""
A short string representation of self, often used in string representations of modular forms
EXAMPLES::
sage: chi = DirichletGroup(24).0
sage: chi._repr_short_()
'[-1, 1, 1]'
"""
return str(list(self.values_on_gens()))
def _repr_(self):
"""
String representation of self.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: repr(a) # indirect doctest
'Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1'
TESTS:
Dirichlet characters modulo 1 and 2 are printed correctly (see
:trac:`17338`)::
sage: DirichletGroup(1)[0]
Dirichlet character modulo 1 of conductor 1
sage: DirichletGroup(2)[0]
Dirichlet character modulo 2 of conductor 1
"""
s = 'Dirichlet character modulo %s of conductor %s' % (self.modulus(), self.conductor())
r = len(self.values_on_gens())
if r != 0:
s += ' mapping '
for i in range(r):
if i != 0:
s += ', '
s += str(self.parent().unit_gens()[i]) + ' |--> ' + str(self.values_on_gens()[i])
return s
def _latex_(self):
r"""
LaTeX representation of self.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(16)
sage: latex(b) # indirect doctest
\hbox{Dirichlet character modulo } 16 \hbox{ of conductor } 16 \hbox{ mapping } 15 \mapsto 1,\ 5 \mapsto \zeta_{4}
TESTS:
Dirichlet characters modulo 1 and 2 are printed correctly (see
:trac:`17338`)::
sage: latex(DirichletGroup(1)[0])
\hbox{Dirichlet character modulo } 1 \hbox{ of conductor } 1
sage: latex(DirichletGroup(2)[0])
\hbox{Dirichlet character modulo } 2 \hbox{ of conductor } 1
"""
s = r'\hbox{Dirichlet character modulo } %s \hbox{ of conductor } %s' % (self.modulus(), self.conductor())
r = len(self.values_on_gens())
if r != 0:
s += r' \hbox{ mapping } '
for i in range(r):
if i != 0:
s += r',\ '
s += self.parent().unit_gens()[i]._latex_() + r' \mapsto ' + self.values_on_gens()[i]._latex_()
return s
def base_ring(self):
"""
Returns the base ring of this Dirichlet character.
EXAMPLES::
sage: G = DirichletGroup(11)
sage: G.gen(0).base_ring()
Cyclotomic Field of order 10 and degree 4
sage: G = DirichletGroup(11, RationalField())
sage: G.gen(0).base_ring()
Rational Field
"""
return self.parent().base_ring()
def bar(self):
"""
Return the complex conjugate of this Dirichlet character.
EXAMPLES::
sage: e = DirichletGroup(5).0
sage: e
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> zeta4
sage: e.bar()
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -zeta4
"""
return ~self
def bernoulli(self, k, algorithm='recurrence', cache=True, **opts):
r"""
Returns the generalized Bernoulli number `B_{k,eps}`.
INPUT:
- ``k`` -- a non-negative integer
- ``algorithm`` -- either ``'recurrence'`` (default) or
``'definition'``
- ``cache`` -- if True, cache answers
- ``**opts`` -- optional arguments; not used directly, but
passed to the :func:`bernoulli` function if this is called
OUTPUT:
Let `\varepsilon` be a (not necessarily primitive) character
of modulus `N`. This function returns the generalized
Bernoulli number `B_{k,\varepsilon}`, as defined by the
following identity of power series (see for example
[DI1995]_, Section 2.2):
.. MATH::
\sum_{a=1}^N \frac{\varepsilon(a) t e^{at}}{e^{Nt}-1}
= sum_{k=0}^{\infty} \frac{B_{k,\varepsilon}}{k!} t^k.
ALGORITHM:
The ``'recurrence'`` algorithm computes generalized Bernoulli
numbers via classical Bernoulli numbers using the formula in
[Coh2007]_, Proposition 9.4.5; this is usually optimal. The
``definition`` algorithm uses the definition directly.
.. WARNING::
In the case of the trivial Dirichlet character modulo 1,
this function returns `B_{1,\varepsilon} = 1/2`, in
accordance with the above definition, but in contrast to
the value `B_1 = -1/2` for the classical Bernoulli number.
Some authors use an alternative definition giving
`B_{1,\varepsilon} = -1/2`; see the discussion in
[Coh2007]_, Section 9.4.1.
EXAMPLES::
sage: G = DirichletGroup(13)
sage: e = G.0
sage: e.bernoulli(5)
7430/13*zeta12^3 - 34750/13*zeta12^2 - 11380/13*zeta12 + 9110/13
sage: eps = DirichletGroup(9).0
sage: eps.bernoulli(3)
10*zeta6 + 4
sage: eps.bernoulli(3, algorithm="definition")
10*zeta6 + 4
TESTS:
Check that :trac:`17586` is fixed::
sage: DirichletGroup(1)[0].bernoulli(1)
1/2
"""
if cache:
try:
self.__bernoulli
except AttributeError:
self.__bernoulli = {}
if k in self.__bernoulli:
return self.__bernoulli[k]
N = self.modulus()
K = self.base_ring()
if N == 1:
# By definition, the first Bernoulli number of the trivial
# character is 1/2, in contrast to the value B_1 = -1/2.
ber = K.one()/2 if k == 1 else K(bernoulli(k))
elif self(-1) != K((-1)**k):
ber = K.zero()
elif algorithm == "recurrence":
# The following code is pretty fast, at least compared to
# the other algorithm below. That said, I'm sure it could
# be sped up by a factor of 10 or more in many cases,
# especially since we end up computing all the Bernoulli
# numbers up to k, which should be done with power series
# instead of calls to the Bernoulli function. Likewise
# computing all binomial coefficients can be done much
# more efficiently.
v = self.values()
S = lambda n: sum(v[r] * r**n for r in range(1, N))
ber = K(sum(binomial(k,j) * bernoulli(j, **opts) *
N**(j-1) * S(k-j) for j in range(k+1)))
elif algorithm == "definition":
# This is better since it computes the same thing, but requires
# no arith in a poly ring over a number field.
prec = k+2
R = rings.PowerSeriesRing(rings.QQ, 't')
t = R.gen()
# g(t) = t/(e^{Nt}-1)
g = t/((N*t).exp(prec) - 1)
# h(n) = g(t)*e^{nt}
h = [0] + [g * ((n*t).exp(prec)) for n in range(1,N+1)]
ber = sum([self(a)*h[a][k] for a in range(1,N+1)]) * factorial(k)
else:
raise ValueError("algorithm = '%s' unknown"%algorithm)
if cache:
self.__bernoulli[k] = ber
return ber
def lfunction(self, prec=53, algorithm='pari'):
"""
Return the L-function of ``self``.
The result is a wrapper around a PARI L-function or around
the ``lcalc`` program.
INPUT:
- ``prec`` -- precision (default 53)
- ``algorithm`` -- 'pari' (default) or 'lcalc'
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: L = a.lfunction(); L
PARI L-function associated to Dirichlet character modulo 20
of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: L(4)
0.988944551741105
With the algorithm "lcalc"::
sage: a = a.primitive_character()
sage: L = a.lfunction(algorithm='lcalc'); L
L-function with complex Dirichlet coefficients
sage: L.value(4) # abs tol 1e-14
0.988944551741105 - 5.16608739123418e-18*I
"""
if algorithm is None:
algorithm = 'pari'
if algorithm == 'pari':
from sage.lfunctions.pari import lfun_character, LFunction
Z = LFunction(lfun_character(self), prec=prec)
Z.rename('PARI L-function associated to %s' % self)
return Z
elif algorithm == 'lcalc':
from sage.libs.lcalc.lcalc_Lfunction import Lfunction_from_character
return Lfunction_from_character(self)
raise ValueError('algorithm must be "pari" or "lcalc"')
@cached_method
def conductor(self):
"""
Computes and returns the conductor of this character.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a.conductor()
4
sage: b.conductor()
5
sage: (a*b).conductor()
20
TESTS::
sage: G.<a, b> = DirichletGroup(20)
sage: type(G(1).conductor())
<type 'sage.rings.integer.Integer'>
"""
if self.modulus() == 1 or self.is_trivial():
return rings.Integer(1)
F = factor(self.modulus())
if len(F) > 1:
return prod([d.conductor() for d in self.decomposition()])
p = F[0][0]
# When p is odd, and x =/= 1, the conductor is the smallest p**r such that
# Order(x) divides EulerPhi(p**r) = p**(r-1)*(p-1).
# For a given r, whether or not the above divisibility holds
# depends only on the factor of p**(r-1) on the right hand side.
# Since p-1 is coprime to p, this smallest r such that the
# divisibility holds equals Valuation(Order(x),p)+1.
cond = p**(valuation(self.order(),p) + 1)
if p == 2 and F[0][1] > 2 and self.values_on_gens()[1].multiplicative_order() != 1:
cond *= 2
return rings.Integer(cond)
@cached_method
def decomposition(self):
r"""
Return the decomposition of self as a product of Dirichlet
characters of prime power modulus, where the prime powers exactly
divide the modulus of this character.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: c = a*b
sage: d = c.decomposition(); d
[Dirichlet character modulo 4 of conductor 4 mapping 3 |--> -1, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> zeta4]
sage: d[0].parent()
Group of Dirichlet characters modulo 4 with values in Cyclotomic Field of order 4 and degree 2
sage: d[1].parent()
Group of Dirichlet characters modulo 5 with values in Cyclotomic Field of order 4 and degree 2
We can't multiply directly, since coercion of one element into the
other parent fails in both cases::
sage: d[0]*d[1] == c
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for *: 'Group of Dirichlet characters modulo 4 with values in Cyclotomic Field of order 4 and degree 2' and 'Group of Dirichlet characters modulo 5 with values in Cyclotomic Field of order 4 and degree 2'
We can multiply if we're explicit about where we want the
multiplication to take place.
::
sage: G(d[0])*G(d[1]) == c
True
Conductors that are divisible by various powers of 2 present
some problems as the multiplicative group modulo `2^k` is
trivial for `k = 1` and non-cyclic for `k \ge 3`::
sage: (DirichletGroup(18).0).decomposition()
[Dirichlet character modulo 2 of conductor 1, Dirichlet character modulo 9 of conductor 9 mapping 2 |--> zeta6]
sage: (DirichletGroup(36).0).decomposition()
[Dirichlet character modulo 4 of conductor 4 mapping 3 |--> -1, Dirichlet character modulo 9 of conductor 1 mapping 2 |--> 1]
sage: (DirichletGroup(72).0).decomposition()
[Dirichlet character modulo 8 of conductor 4 mapping 7 |--> -1, 5 |--> 1, Dirichlet character modulo 9 of conductor 1 mapping 2 |--> 1]
"""
D = self.parent().decomposition()
vals = [[z] for z in self.values_on_gens()]
if self.modulus() % 8 == 0: # 2 factors at 2.
vals[0].append(vals[1][0])
del vals[1]
elif self.modulus() % 4 == 2: # 0 factors at 2.
vals = [1] + vals
return [D[i](vals[i]) for i in range(len(D))]
def extend(self, M):
"""
Returns the extension of this character to a Dirichlet character
modulo the multiple M of the modulus.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: H.<c> = DirichletGroup(4)
sage: c.extend(20)
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: a
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: c.extend(20) == a
True
"""
if M % self.modulus() != 0:
raise ArithmeticError("M(=%s) must be a multiple of the modulus(=%s)"%(M,self.modulus()))
H = DirichletGroup(M, self.base_ring())
return H(self)
def _pari_conversion(self):
r"""
Prepare data for the conversion of the character to Pari.
OUTPUT:
pair (G, v) where G is `(\ZZ / N \ZZ)^*` where `N` is the modulus
EXAMPLES::
sage: chi4 = DirichletGroup(4).gen()
sage: chi4._pari_conversion()
([[4, [0]], [2, [2], [3]], [[2]~, Vecsmall([2])],
[[4], [[1, matrix(0,2)]], Mat(1), [3], [2], [0]], Mat(1)], [1])
sage: chi = DirichletGroup(24)([1,-1,-1]); chi
Dirichlet character modulo 24 of conductor 24
mapping 7 |--> 1, 13 |--> -1, 17 |--> -1
sage: chi._pari_conversion()
([[24, [0]], [8, [2, 2, 2], [7, 13, 17]],
[[2, 2, 3]~, Vecsmall([3, 3, 1])],
[[8, 8, 3], [[1, matrix(0,2)], [1, matrix(0,2)], [2, Mat([2, 1])]],
[1, 0, 0; 0, 1, 0; 0, 0, 1], [7, 13, 17], [2, 2, 2], [0, 0, 0]],
[1, 0, 0; 0, 1, 0; 0, 0, 1]], [0, 1, 1])
"""
G = pari.znstar(self.modulus(), 1)
pari_orders = G[1][1]
pari_gens = G[1][2]
# one should use the following, but this does not work
# pari_orders = G.cyc()
# pari_gens = G.gen()
values_on_gens = (self(x) for x in pari_gens)
# now compute the input for pari (list of exponents)
P = self.parent()
if is_ComplexField(P.base_ring()):
zeta = P.zeta()
zeta_argument = zeta.argument()
v = [int(x.argument() / zeta_argument) for x in values_on_gens]
else:
dlog = P._zeta_dlog
v = [dlog[x] for x in values_on_gens]
m = P.zeta_order()
v = [(vi * oi) // m for vi, oi in zip(v, pari_orders)]
return (G, v)
def conrey_number(self):
r"""
Return the Conrey number for this character.
This is a positive integer coprime to q that identifies a
Dirichlet character of modulus q.
See https://www.lmfdb.org/knowledge/show/character.dirichlet.conrey
EXAMPLES::
sage: chi4 = DirichletGroup(4).gen()
sage: chi4.conrey_number()
3
sage: chi = DirichletGroup(24)([1,-1,-1]); chi
Dirichlet character modulo 24 of conductor 24
mapping 7 |--> 1, 13 |--> -1, 17 |--> -1
sage: chi.conrey_number()
5
sage: chi = DirichletGroup(60)([1,-1,I])
sage: chi.conrey_number()
17
sage: chi = DirichletGroup(420)([1,-1,-I,1])
sage: chi.conrey_number()
113
TESTS::
sage: eps1 = DirichletGroup(5)([-1])
sage: eps2 = DirichletGroup(5,QQ)([-1])
sage: eps1.conrey_number() == eps2.conrey_number()
True
"""
G, v = self._pari_conversion()
return pari.znconreyexp(G, v).sage()
def lmfdb_page(self):
r"""
Open the LMFDB web page of the character in a browser.
See https://www.lmfdb.org
EXAMPLES::
sage: E = DirichletGroup(4).gen()
sage: E.lmfdb_page() # optional -- webbrowser
"""
import webbrowser
lmfdb_url = 'https://www.lmfdb.org/Character/Dirichlet/{}/{}'
url = lmfdb_url.format(self.modulus(), self.conrey_number())
webbrowser.open(url)
def galois_orbit(self, sort=True):
r"""
Return the orbit of this character under the action of the absolute
Galois group of the prime subfield of the base ring.
EXAMPLES::
sage: G = DirichletGroup(30); e = G.1
sage: e.galois_orbit()
[Dirichlet character modulo 30 of conductor 5 mapping 11 |--> 1, 7 |--> -zeta4,
Dirichlet character modulo 30 of conductor 5 mapping 11 |--> 1, 7 |--> zeta4]
Another example::
sage: G = DirichletGroup(13)
sage: G.galois_orbits()
[
[Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1],
...,
[Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1]
]
sage: e = G.0
sage: e
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12
sage: e.galois_orbit()
[Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12,
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta12^3 + zeta12,
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12^3 - zeta12,
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta12]
sage: e = G.0^2; e
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12^2
sage: e.galois_orbit()
[Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12^2, Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -zeta12^2 + 1]
A non-example::
sage: chi = DirichletGroup(7, Integers(9), zeta = Integers(9)(2)).0
sage: chi.galois_orbit()
Traceback (most recent call last):
...
TypeError: Galois orbits only defined if base ring is an integral domain
"""
if not self.base_ring().is_integral_domain():
raise TypeError("Galois orbits only defined if base ring is an integral domain")
k = self.order()
if k <= 2:
return [self]
P = self.parent()
z = self.element()
o = int(z.additive_order())
Auts = set([m % o for m in P._automorphisms()])
v = [P.element_class(P, m * z, check=False) for m in Auts]
if sort:
v.sort()
return v
def gauss_sum(self, a=1):
r"""
Return a Gauss sum associated to this Dirichlet character.
The Gauss sum associated to `\chi` is
.. MATH::
g_a(\chi) = \sum_{r \in \ZZ/m\ZZ} \chi(r)\,\zeta^{ar},
where `m` is the modulus of `\chi` and `\zeta` is a primitive
`m^{th}` root of unity.
FACTS: If the modulus is a prime `p` and the character is
nontrivial, then the Gauss sum has absolute value `\sqrt{p}`.
CACHING: Computed Gauss sums are *not* cached with this character.
EXAMPLES::
sage: G = DirichletGroup(3)
sage: e = G([-1])
sage: e.gauss_sum(1)
2*zeta6 - 1
sage: e.gauss_sum(2)
-2*zeta6 + 1
sage: norm(e.gauss_sum())
3
::
sage: G = DirichletGroup(13)
sage: e = G.0
sage: e.gauss_sum()
-zeta156^46 + zeta156^45 + zeta156^42 + zeta156^41 + 2*zeta156^40 + zeta156^37 - zeta156^36 - zeta156^34 - zeta156^33 - zeta156^31 + 2*zeta156^30 + zeta156^28 - zeta156^24 - zeta156^22 + zeta156^21 + zeta156^20 - zeta156^19 + zeta156^18 - zeta156^16 - zeta156^15 - 2*zeta156^14 - zeta156^10 + zeta156^8 + zeta156^7 + zeta156^6 + zeta156^5 - zeta156^4 - zeta156^2 - 1
sage: factor(norm(e.gauss_sum()))
13^24
TESTS:
The field of algebraic numbers is supported (:trac:`19056`)::
sage: G = DirichletGroup(7, QQbar)
sage: G[1].gauss_sum()
-2.440133358345538? + 1.022618791871794?*I
Check that :trac:`19060` is fixed::
sage: K.<z> = CyclotomicField(8)
sage: G = DirichletGroup(13, K)
sage: chi = G([z^2])
sage: chi.gauss_sum()
zeta52^22 + zeta52^21 + zeta52^19 - zeta52^16 + zeta52^15 + zeta52^14 + zeta52^12 - zeta52^11 - zeta52^10 - zeta52^7 - zeta52^5 + zeta52^4
Check that :trac:`25127` is fixed::
sage: G = DirichletGroup(1)
sage: chi = G.one()
sage: chi.gauss_sum()
1
.. SEEALSO::
- :func:`sage.arith.misc.gauss_sum` for general finite fields
- :func:`sage.rings.padics.misc.gauss_sum` for a `p`-adic version
"""
G = self.parent()
K = G.base_ring()
chi = self
m = G.modulus()
if is_ComplexField(K):
return self.gauss_sum_numerical(a=a)
elif is_AlgebraicField(K):
L = K
zeta = L.zeta(m)
elif number_field.is_CyclotomicField(K) or is_RationalField(K):
chi = chi.minimize_base_ring()
n = lcm(m, G.zeta_order())
L = rings.CyclotomicField(n)
zeta = L.gen(0) ** (n // m)
else:
raise NotImplementedError("Gauss sums only currently implemented when the base ring is a cyclotomic field, QQ, QQbar, or a complex field")
zeta = zeta ** a
g = L(chi(0))
z = L.one()
for c in chi.values()[1:]:
z *= zeta
g += L(c)*z
return g
def gauss_sum_numerical(self, prec=53, a=1):
r"""
Return a Gauss sum associated to this Dirichlet character as an
approximate complex number with prec bits of precision.
INPUT:
- ``prec`` -- integer (default: 53), *bits* of precision
- ``a`` -- integer, as for :meth:`gauss_sum`.
The Gauss sum associated to `\chi` is
.. MATH::
g_a(\chi) = \sum_{r \in \ZZ/m\ZZ} \chi(r)\,\zeta^{ar},
where `m` is the modulus of `\chi` and `\zeta` is a primitive
`m^{th}` root of unity.
EXAMPLES::
sage: G = DirichletGroup(3)
sage: e = G.0
sage: abs(e.gauss_sum_numerical())
1.7320508075...
sage: sqrt(3.0)
1.73205080756888
sage: e.gauss_sum_numerical(a=2)
-...e-15 - 1.7320508075...*I
sage: e.gauss_sum_numerical(a=2, prec=100)
4.7331654313260708324703713917e-30 - 1.7320508075688772935274463415*I
sage: G = DirichletGroup(13)
sage: H = DirichletGroup(13, CC)
sage: e = G.0
sage: f = H.0
sage: e.gauss_sum_numerical()
-3.07497205... + 1.8826966926...*I
sage: f.gauss_sum_numerical()
-3.07497205... + 1.8826966926...*I
sage: abs(e.gauss_sum_numerical())
3.60555127546...
sage: abs(f.gauss_sum_numerical())
3.60555127546...
sage: sqrt(13.0)
3.60555127546399
TESTS:
The field of algebraic numbers is supported (:trac:`19056`)::
sage: G = DirichletGroup(7, QQbar)
sage: G[1].gauss_sum_numerical()
-2.44013335834554 + 1.02261879187179*I
"""
G = self.parent()
K = G.base_ring()
if is_ComplexField(K):
phi = lambda t : t
CC = K
elif is_AlgebraicField(K):
from sage.rings.complex_mpfr import ComplexField
CC = ComplexField(prec)
phi = CC.coerce_map_from(K)
elif number_field.is_CyclotomicField(K) or is_RationalField(K):
phi = K.complex_embedding(prec)
CC = phi.codomain()
else:
raise NotImplementedError("Gauss sums only currently implemented when the base ring is a cyclotomic field, QQ, QQbar, or a complex field")
zeta = CC.zeta(G.modulus()) ** a
g = phi(self(0))
z = CC.one()
for c in self.values()[1:]:
z *= zeta
g += phi(c)*z
return g
def jacobi_sum(self, char, check=True):
r"""
Return the Jacobi sum associated to these Dirichlet characters
(i.e., J(self,char)).
This is defined as
.. MATH::
J(\chi, \psi) = \sum_{a \in \ZZ / N\ZZ} \chi(a) \psi(1-a)
where `\chi` and `\psi` are both characters modulo `N`.
EXAMPLES::
sage: D = DirichletGroup(13)
sage: e = D.0
sage: f = D[-2]
sage: e.jacobi_sum(f)
3*zeta12^2 + 2*zeta12 - 3
sage: f.jacobi_sum(e)
3*zeta12^2 + 2*zeta12 - 3
sage: p = 7
sage: DP = DirichletGroup(p)
sage: f = DP.0
sage: e.jacobi_sum(f)
Traceback (most recent call last):
...
NotImplementedError: Characters must be from the same Dirichlet Group.
sage: all_jacobi_sums = [(DP[i].values_on_gens(),DP[j].values_on_gens(),DP[i].jacobi_sum(DP[j]))
....: for i in range(p-1) for j in range(i, p-1)]
sage: for s in all_jacobi_sums:
....: print(s)
((1,), (1,), 5)
((1,), (zeta6,), -1)
((1,), (zeta6 - 1,), -1)
((1,), (-1,), -1)
((1,), (-zeta6,), -1)
((1,), (-zeta6 + 1,), -1)
((zeta6,), (zeta6,), -zeta6 + 3)
((zeta6,), (zeta6 - 1,), 2*zeta6 + 1)
((zeta6,), (-1,), -2*zeta6 - 1)
((zeta6,), (-zeta6,), zeta6 - 3)
((zeta6,), (-zeta6 + 1,), 1)
((zeta6 - 1,), (zeta6 - 1,), -3*zeta6 + 2)
((zeta6 - 1,), (-1,), 2*zeta6 + 1)
((zeta6 - 1,), (-zeta6,), -1)
((zeta6 - 1,), (-zeta6 + 1,), -zeta6 - 2)
((-1,), (-1,), 1)
((-1,), (-zeta6,), -2*zeta6 + 3)
((-1,), (-zeta6 + 1,), 2*zeta6 - 3)
((-zeta6,), (-zeta6,), 3*zeta6 - 1)
((-zeta6,), (-zeta6 + 1,), -2*zeta6 + 3)
((-zeta6 + 1,), (-zeta6 + 1,), zeta6 + 2)
Let's check that trivial sums are being calculated correctly::
sage: N = 13
sage: D = DirichletGroup(N)
sage: g = D(1)
sage: g.jacobi_sum(g)
11
sage: sum([g(x)*g(1-x) for x in IntegerModRing(N)])
11
And sums where exactly one character is nontrivial (see :trac:`6393`)::
sage: G = DirichletGroup(5); X=G.list(); Y=X[0]; Z=X[1]
sage: Y.jacobi_sum(Z)
-1
sage: Z.jacobi_sum(Y)
-1
Now let's take a look at a non-prime modulus::
sage: N = 9
sage: D = DirichletGroup(N)
sage: g = D(1)
sage: g.jacobi_sum(g)
3
We consider a sum with values in a finite field::
sage: g = DirichletGroup(17, GF(9,'a')).0
sage: g.jacobi_sum(g**2)
2*a
TESTS:
This shows that :trac:`6393` has been fixed::
sage: G = DirichletGroup(5); X = G.list(); Y = X[0]; Z = X[1]
sage: # Y is trivial and Z is quartic
sage: sum([Y(x)*Z(1-x) for x in IntegerModRing(5)])
-1
sage: # The value -1 above is the correct value of the Jacobi sum J(Y, Z).
sage: Y.jacobi_sum(Z); Z.jacobi_sum(Y)
-1
-1
"""
if check:
if self.parent() != char.parent():
raise NotImplementedError("Characters must be from the same Dirichlet Group.")
return sum([self(x) * char(1-x) for x in rings.IntegerModRing(self.modulus())])
def kloosterman_sum(self, a=1, b=0):
r"""
Return the "twisted" Kloosterman sum associated to this Dirichlet character.
This includes Gauss sums, classical Kloosterman sums, Salié sums, etc.
The Kloosterman sum associated to `\chi` and the integers a,b is
.. MATH::
K(a,b,\chi) = \sum_{r \in (\ZZ/m\ZZ)^\times} \chi(r)\,\zeta^{ar+br^{-1}},
where `m` is the modulus of `\chi` and `\zeta` is a primitive
`m` th root of unity. This reduces to the Gauss sum if `b=0`.
This method performs an exact calculation and returns an element of a
suitable cyclotomic field; see also :meth:`.kloosterman_sum_numerical`,
which gives an inexact answer (but is generally much quicker).
CACHING: Computed Kloosterman sums are *not* cached with this
character.
EXAMPLES::
sage: G = DirichletGroup(3)
sage: e = G([-1])
sage: e.kloosterman_sum(3,5)
-2*zeta6 + 1
sage: G = DirichletGroup(20)
sage: e = G([1 for u in G.unit_gens()])
sage: e.kloosterman_sum(7,17)
-2*zeta20^6 + 2*zeta20^4 + 4
TESTS::
sage: G = DirichletGroup(20, UniversalCyclotomicField())
sage: e = G([1 for u in G.unit_gens()])
sage: e.kloosterman_sum(7,17)
-2*E(5) - 4*E(5)^2 - 4*E(5)^3 - 2*E(5)^4
sage: G = DirichletGroup(12, QQbar)
sage: e = G.gens()[0]
sage: e.kloosterman_sum(5,11)
Traceback (most recent call last):
...
NotImplementedError: Kloosterman sums not implemented over this ring
"""
G = self.parent()
zo = G.zeta_order()
m = G.modulus()
g = 0
L = rings.CyclotomicField(m.lcm(zo))
zeta = L.gen(0)
try:
self(1) * zeta**(a+b)
except TypeError:
raise NotImplementedError('Kloosterman sums not implemented '
'over this ring')
n = zeta.multiplicative_order()
zeta = zeta**(n // m)
for c in m.coprime_integers(m):
e = rings.Mod(c, m)
g += self(c) * zeta**int(a*e + b*e**(-1))
return g
def kloosterman_sum_numerical(self, prec=53, a=1, b=0):
r"""
Return the Kloosterman sum associated to this Dirichlet character as
an approximate complex number with prec bits of precision.
See also :meth:`.kloosterman_sum`, which calculates the sum
exactly (which is generally slower).
INPUT:
- ``prec`` -- integer (default: 53), *bits* of precision
- ``a`` -- integer, as for :meth:`.kloosterman_sum`
- ``b`` -- integer, as for :meth:`.kloosterman_sum`.
EXAMPLES::
sage: G = DirichletGroup(3)
sage: e = G.0
The real component of the numerical value of e is near zero::
sage: v=e.kloosterman_sum_numerical()
sage: v.real() < 1.0e15
True
sage: v.imag()
1.73205080756888
sage: G = DirichletGroup(20)
sage: e = G.1
sage: e.kloosterman_sum_numerical(53,3,11)
3.80422606518061 - 3.80422606518061*I
"""
G = self.parent()
K = G.base_ring()
if not (number_field.is_CyclotomicField(K) or is_RationalField(K)):
raise NotImplementedError("Kloosterman sums only currently implemented when the base ring is a cyclotomic field or QQ.")
phi = K.complex_embedding(prec)
CC = phi.codomain()
g = 0
m = G.modulus()
zeta = CC.zeta(m)
for c in m.coprime_integers(m):
e = rings.Mod(c, m)
z = zeta ** int(a*e + b*(e**(-1)))
g += phi(self(c))*z
return g
@cached_method
def is_even(self):
r"""
Return ``True`` if and only if `\varepsilon(-1) = 1`.
EXAMPLES::
sage: G = DirichletGroup(13)
sage: e = G.0
sage: e.is_even()
False
sage: e(-1)
-1
sage: [e.is_even() for e in G]
[True, False, True, False, True, False, True, False, True, False, True, False]
sage: G = DirichletGroup(13, CC)
sage: e = G.0
sage: e.is_even()
False
sage: e(-1)
-1.000000...
sage: [e.is_even() for e in G]
[True, False, True, False, True, False, True, False, True, False, True, False]
sage: G = DirichletGroup(100000, CC)
sage: G.1.is_even()
True
Note that ``is_even`` need not be the negation of
is_odd, e.g., in characteristic 2::
sage: G.<e> = DirichletGroup(13, GF(4,'a'))
sage: e.is_even()
True
sage: e.is_odd()
True
"""
R = self.base_ring()
# self(-1) is either +1 or -1
if not R.is_exact():
return abs(self(-1) - R(1)) < 0.5
return self(-1) == R(1)
@cached_method
def is_odd(self):
r"""
Return ``True`` if and only if
`\varepsilon(-1) = -1`.
EXAMPLES::
sage: G = DirichletGroup(13)
sage: e = G.0
sage: e.is_odd()
True
sage: [e.is_odd() for e in G]
[False, True, False, True, False, True, False, True, False, True, False, True]
sage: G = DirichletGroup(13)
sage: e = G.0
sage: e.is_odd()
True
sage: [e.is_odd() for e in G]
[False, True, False, True, False, True, False, True, False, True, False, True]
sage: G = DirichletGroup(100000, CC)
sage: G.0.is_odd()
True
Note that ``is_even`` need not be the negation of
is_odd, e.g., in characteristic 2::
sage: G.<e> = DirichletGroup(13, GF(4,'a'))
sage: e.is_even()
True
sage: e.is_odd()
True
"""
R = self.base_ring()
# self(-1) is either +1 or -1
if not R.is_exact():
return abs(self(-1) - R(-1)) < 0.5
return self(-1) == R(-1)
@cached_method
def is_primitive(self):
"""
Return ``True`` if and only if this character is
primitive, i.e., its conductor equals its modulus.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a.is_primitive()
False
sage: b.is_primitive()
False
sage: (a*b).is_primitive()
True
sage: G.<a,b> = DirichletGroup(20, CC)
sage: a.is_primitive()
False
sage: b.is_primitive()
False
sage: (a*b).is_primitive()
True
"""
return (self.conductor() == self.modulus())
@cached_method
def is_trivial(self):
r"""
Returns ``True`` if this is the trivial character,
i.e., has order 1.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a.is_trivial()
False
sage: (a^2).is_trivial()
True
"""
if self.element.is_in_cache():
return not self.element()
one = self.base_ring().one()
return all(x == one for x in self.values_on_gens())
def kernel(self):
r"""
Return the kernel of this character.
OUTPUT: Currently the kernel is returned as a list. This may
change.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a.kernel()
[1, 9, 13, 17]
sage: b.kernel()
[1, 11]
"""
one = self.base_ring().one()
return [x for x in range(self.modulus()) if self(x) == one]
def maximize_base_ring(self):
r"""
Let
.. MATH::
\varepsilon : (\ZZ/N\ZZ)^* \to \QQ(\zeta_n)
be a Dirichlet character. This function returns an equal Dirichlet
character
.. MATH::
\chi : (\ZZ/N\ZZ)^* \to \QQ(\zeta_m)
where `m` is the least common multiple of `n` and
the exponent of `(\ZZ/N\ZZ)^*`.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20,QQ)
sage: b.maximize_base_ring()
Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -1
sage: b.maximize_base_ring().base_ring()
Cyclotomic Field of order 4 and degree 2
sage: DirichletGroup(20).base_ring()
Cyclotomic Field of order 4 and degree 2
"""
g = rings.IntegerModRing(self.modulus()).unit_group_exponent()
if g == 1:
g = 2
z = self.base_ring().zeta()
n = z.multiplicative_order()
m = lcm(g,n)
if n == m:
return self
K = rings.CyclotomicField(m)
return self.change_ring(K)
def minimize_base_ring(self):
r"""
Return a Dirichlet character that equals this one, but over as
small a subfield (or subring) of the base ring as possible.
.. note::
This function is currently only implemented when the base
ring is a number field. It's the identity function in
characteristic p.
EXAMPLES::
sage: G = DirichletGroup(13)
sage: e = DirichletGroup(13).0
sage: e.base_ring()
Cyclotomic Field of order 12 and degree 4
sage: e.minimize_base_ring().base_ring()
Cyclotomic Field of order 12 and degree 4
sage: (e^2).minimize_base_ring().base_ring()
Cyclotomic Field of order 6 and degree 2
sage: (e^3).minimize_base_ring().base_ring()
Cyclotomic Field of order 4 and degree 2
sage: (e^12).minimize_base_ring().base_ring()
Rational Field
TESTS:
Check that :trac:`18479` is fixed::
sage: f = Newforms(Gamma1(25), names='a')[1]
sage: eps = f.character()
sage: eps.minimize_base_ring() == eps
True
A related bug (see :trac:`18086`)::
sage: K.<a,b>=NumberField([x^2 + 1, x^2 - 3])
sage: chi = DirichletGroup(7, K).0
sage: chi.minimize_base_ring()
Dirichlet character modulo 7 of conductor 7 mapping 3 |--> -1/2*b*a + 1/2
"""
R = self.base_ring()
if R.is_prime_field():
return self
p = R.characteristic()
if p:
K = rings.IntegerModRing(p)
elif self.order() <= 2:
K = rings.QQ
elif (isinstance(R, number_field.NumberField_generic)
and euler_phi(self.order()) < R.absolute_degree()):
K = rings.CyclotomicField(self.order())
else:
return self
try:
return self.change_ring(K)
except (TypeError, ValueError, ArithmeticError):
return self
def modulus(self):
"""
The modulus of this character.
EXAMPLES::
sage: e = DirichletGroup(100, QQ).0
sage: e.modulus()
100
sage: e.conductor()
4
"""
return self.parent().modulus()
def level(self):
"""
Synonym for modulus.
EXAMPLES::
sage: e = DirichletGroup(100, QQ).0
sage: e.level()
100
"""
return self.modulus()
@cached_method
def multiplicative_order(self):
"""
The order of this character.
EXAMPLES::
sage: e = DirichletGroup(100).1
sage: e.order() # same as multiplicative_order, since group is multiplicative
20
sage: e.multiplicative_order()
20
sage: e = DirichletGroup(100).0
sage: e.multiplicative_order()
2
"""
if self.parent().zeta.is_in_cache():
return self.element().additive_order()
return lcm([z.multiplicative_order() for z in self.values_on_gens()])
def primitive_character(self):
"""
Returns the primitive character associated to self.
EXAMPLES::
sage: e = DirichletGroup(100).0; e
Dirichlet character modulo 100 of conductor 4 mapping 51 |--> -1, 77 |--> 1
sage: e.conductor()
4
sage: f = e.primitive_character(); f
Dirichlet character modulo 4 of conductor 4 mapping 3 |--> -1
sage: f.modulus()
4
"""
return self.restrict(self.conductor())
def restrict(self, M):
"""
Returns the restriction of this character to a Dirichlet character
modulo the divisor M of the modulus, which must also be a multiple
of the conductor of this character.
EXAMPLES::
sage: e = DirichletGroup(100).0
sage: e.modulus()
100
sage: e.conductor()
4
sage: e.restrict(20)
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: e.restrict(4)
Dirichlet character modulo 4 of conductor 4 mapping 3 |--> -1
sage: e.restrict(50)
Traceback (most recent call last):
...
ValueError: conductor(=4) must divide M(=50)
"""
M = int(M)
if self.modulus()%M != 0:
raise ValueError("M(=%s) must divide the modulus(=%s)"%(M,self.modulus()))
if M%self.conductor() != 0:
raise ValueError("conductor(=%s) must divide M(=%s)"%(self.conductor(),M))
H = DirichletGroup(M, self.base_ring())
return H(self)
@cached_method
def values(self):
"""
Return a list of the values of this character on each integer
between 0 and the modulus.
EXAMPLES::
sage: e = DirichletGroup(20)(1)
sage: e.values()
[0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1]
sage: e = DirichletGroup(20).gen(0)
sage: e.values()
[0, 1, 0, -1, 0, 0, 0, -1, 0, 1, 0, -1, 0, 1, 0, 0, 0, 1, 0, -1]
sage: e = DirichletGroup(20).gen(1)
sage: e.values()
[0, 1, 0, -zeta4, 0, 0, 0, zeta4, 0, -1, 0, 1, 0, -zeta4, 0, 0, 0, zeta4, 0, -1]
sage: e = DirichletGroup(21).gen(0) ; e.values()
[0, 1, -1, 0, 1, -1, 0, 0, -1, 0, 1, -1, 0, 1, 0, 0, 1, -1, 0, 1, -1]
sage: e = DirichletGroup(21, base_ring=GF(37)).gen(0) ; e.values()
[0, 1, 36, 0, 1, 36, 0, 0, 36, 0, 1, 36, 0, 1, 0, 0, 1, 36, 0, 1, 36]
sage: e = DirichletGroup(21, base_ring=GF(3)).gen(0) ; e.values()
[0, 1, 2, 0, 1, 2, 0, 0, 2, 0, 1, 2, 0, 1, 0, 0, 1, 2, 0, 1, 2]
::
sage: chi = DirichletGroup(100151, CyclotomicField(10)).0
sage: ls = chi.values() ; ls[0:10]
[0,
1,
-zeta10^3,
-zeta10,
-zeta10,
1,
zeta10^3 - zeta10^2 + zeta10 - 1,
zeta10,
zeta10^3 - zeta10^2 + zeta10 - 1,
zeta10^2]
TESTS:
Test that :trac:`11783` and :trac:`14368` are fixed::
sage: chi = DirichletGroup(1).list()[0]
sage: chi.values()
[1]
sage: chi(1)
1
"""
G = self.parent()
R = G.base_ring()
mod = self.parent().modulus()
if mod == 1:
return [R.one()]
elif mod == 2:
return [R.zero(), R.one()]
result_list = [R.zero()] * mod
gens = G.unit_gens()
orders = G.integers_mod().unit_group().gens_orders()
R_values = G._zeta_powers
val_on_gen = self.element()
exponents = [0] * len(orders)
n = G.integers_mod().one()
value = val_on_gen.base_ring().zero()
while True:
# record character value on n
result_list[n] = R_values[value]
# iterate:
# increase the exponent vector by 1,
# increase n accordingly, and increase value
i = 0
while True:
try:
exponents[i] += 1
except IndexError: # Done!
return result_list
value += val_on_gen[i]
n *= gens[i]
if exponents[i] < orders[i]:
break
exponents[i] = 0
i += 1
@cached_method(do_pickle=True)
def values_on_gens(self):
r"""
Return a tuple of the values of ``self`` on the standard
generators of `(\ZZ/N\ZZ)^*`, where `N` is the modulus.
EXAMPLES::
sage: e = DirichletGroup(16)([-1, 1])
sage: e.values_on_gens ()
(-1, 1)
.. NOTE::
The constructor of :class:`DirichletCharacter` sets the
cache of :meth:`element` or of :meth:`values_on_gens`. The cache of
one of these methods needs to be set for the other method to work properly,
these caches have to be stored when pickling an instance of
:class:`DirichletCharacter`.
"""
pows = self.parent()._zeta_powers
return tuple([pows[i] for i in self.element()])
@cached_method(do_pickle=True)
def element(self):
r"""
Return the underlying `\ZZ/n\ZZ`-module
vector of exponents.
.. warning::
Please do not change the entries of the returned vector;
this vector is mutable *only* because immutable vectors are
not implemented yet.
EXAMPLES::
sage: G.<a,b> = DirichletGroup(20)
sage: a.element()
(2, 0)
sage: b.element()
(0, 1)
.. NOTE::
The constructor of :class:`DirichletCharacter` sets the
cache of :meth:`element` or of :meth:`values_on_gens`. The cache of
one of these methods needs to be set for the other method to work properly,
these caches have to be stored when pickling an instance of
:class:`DirichletCharacter`.
"""
P = self.parent()
M = P._module
if is_ComplexField(P.base_ring()):
zeta = P.zeta()
zeta_argument = zeta.argument()
v = M([int(round(x.argument() / zeta_argument))
for x in self.values_on_gens()])
else:
dlog = P._zeta_dlog
v = M([dlog[x] for x in self.values_on_gens()])
v.set_immutable()
return v
def __setstate__(self, state):
r"""
Restore a pickled element from ``state``.
TESTS::
sage: e = DirichletGroup(16)([-1, 1])
sage: loads(dumps(e)) == e
True
"""
# values_on_gens() used an explicit cache __values_on_gens in the past
# we need to set the cache of values_on_gens() from that if we encounter it in a pickle
values_on_gens_key = '_DirichletCharacter__values_on_gens'
values_on_gens = None
state_dict = state[1]
if values_on_gens_key in state_dict:
values_on_gens = state_dict[values_on_gens_key]
del state_dict[values_on_gens_key]
# element() used an explicit cache __element in the past
# we need to set the cache of element() from that if we encounter it in a pickle
element_key = '_DirichletCharacter__element'
element = None
if element_key in state_dict:
element = state_dict[element_key]
del state_dict[element_key]
super(DirichletCharacter, self).__setstate__(state)
if values_on_gens is not None:
self.values_on_gens.set_cache(values_on_gens)
if element is not None:
self.element.set_cache(element)
class DirichletGroupFactory(UniqueFactory):
r"""
Construct a group of Dirichlet characters modulo `N`.
INPUT:
- ``N`` -- positive integer
- ``base_ring`` -- commutative ring; the value ring for the
characters in this group (default: the cyclotomic field
`\QQ(\zeta_n)`, where `n` is the exponent of `(\ZZ/N\ZZ)^*`)
- ``zeta`` -- (optional) root of unity in ``base_ring``
- ``zeta_order`` -- (optional) positive integer; this must be the
order of ``zeta`` if both are specified
- ``names`` -- ignored (needed so ``G.<...> = DirichletGroup(...)``
notation works)
- ``integral`` -- boolean (default: ``False``); whether to replace
the default cyclotomic field by its rings of integers as the
base ring. This is ignored if ``base_ring`` is not ``None``.
OUTPUT:
The group of Dirichlet characters modulo `N` with values in a
subgroup `V` of the multiplicative group `R^*` of ``base_ring``.
This is the group of homomorphisms `(\ZZ/N\ZZ)^* \to V` with
pointwise multiplication. The group `V` is determined as follows:
- If both ``zeta`` and ``zeta_order`` are omitted, then `V` is
taken to be `R^*`, or equivalently its `n`-torsion subgroup,
where `n` is the exponent of `(\ZZ/N\ZZ)^*`. Many operations,
such as finding a set of generators for the group, are only
implemented if `V` is cyclic and a generator for `V` can be
found.
- If ``zeta`` is specified, then `V` is taken to be the cyclic
subgroup of `R^*` generated by ``zeta``. If ``zeta_order`` is
also given, it must be the multiplicative order of ``zeta``;
this is useful if the base ring is not exact or if the order of
``zeta`` is very large.
- If ``zeta`` is not specified but ``zeta_order`` is, then `V` is
taken to be the group of roots of unity of order dividing
``zeta_order`` in `R`. In this case, `R` must be a domain (so
`V` is cyclic), and `V` must have order ``zeta_order``.
Furthermore, a generator ``zeta`` of `V` is computed, and an
error is raised if such ``zeta`` cannot be found.
EXAMPLES:
The default base ring is a cyclotomic field of order the exponent
of `(\ZZ/N\ZZ)^*`::
sage: DirichletGroup(20)
Group of Dirichlet characters modulo 20 with values in Cyclotomic Field of order 4 and degree 2
We create the group of Dirichlet character mod 20 with values in
the rational numbers::
sage: G = DirichletGroup(20, QQ); G
Group of Dirichlet characters modulo 20 with values in Rational Field
sage: G.order()
4
sage: G.base_ring()
Rational Field
The elements of G print as lists giving the values of the character
on the generators of `(Z/NZ)^*`::
sage: list(G)
[Dirichlet character modulo 20 of conductor 1 mapping 11 |--> 1, 17 |--> 1, Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1, Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> -1, Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -1]
Next we construct the group of Dirichlet character mod 20, but with
values in `\QQ(\zeta_n)`::
sage: G = DirichletGroup(20)
sage: G.1
Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4
We next compute several invariants of ``G``::
sage: G.gens()
(Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1, Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4)
sage: G.unit_gens()
(11, 17)
sage: G.zeta()
zeta4
sage: G.zeta_order()
4
In this example we create a Dirichlet group with values in a
number field::
sage: R.<x> = PolynomialRing(QQ)
sage: K.<a> = NumberField(x^4 + 1)
sage: DirichletGroup(5, K)
Group of Dirichlet characters modulo 5 with values in Number Field in a with defining polynomial x^4 + 1
An example where we give ``zeta``, but not its order::
sage: G = DirichletGroup(5, K, a); G
Group of Dirichlet characters modulo 5 with values in the group of order 8 generated by a in Number Field in a with defining polynomial x^4 + 1
sage: G.list()
[Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> a^2, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1, Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -a^2]
We can also restrict the order of the characters, either with or
without specifying a root of unity::
sage: DirichletGroup(5, K, zeta=-1, zeta_order=2)
Group of Dirichlet characters modulo 5 with values in the group of order 2 generated by -1 in Number Field in a with defining polynomial x^4 + 1
sage: DirichletGroup(5, K, zeta_order=2)
Group of Dirichlet characters modulo 5 with values in the group of order 2 generated by -1 in Number Field in a with defining polynomial x^4 + 1
::
sage: G.<e> = DirichletGroup(13)
sage: loads(G.dumps()) == G
True
::
sage: G = DirichletGroup(19, GF(5))
sage: loads(G.dumps()) == G
True
We compute a Dirichlet group over a large prime field::
sage: p = next_prime(10^40)
sage: g = DirichletGroup(19, GF(p)); g
Group of Dirichlet characters modulo 19 with values in Finite Field of size 10000000000000000000000000000000000000121
Note that the root of unity has small order, i.e., it is not the
largest order root of unity in the field::
sage: g.zeta_order()
2
::
sage: r4 = CyclotomicField(4).ring_of_integers()
sage: G = DirichletGroup(60, r4)
sage: G.gens()
(Dirichlet character modulo 60 of conductor 4 mapping 31 |--> -1, 41 |--> 1, 37 |--> 1, Dirichlet character modulo 60 of conductor 3 mapping 31 |--> 1, 41 |--> -1, 37 |--> 1, Dirichlet character modulo 60 of conductor 5 mapping 31 |--> 1, 41 |--> 1, 37 |--> zeta4)
sage: val = G.gens()[2].values_on_gens()[2] ; val
zeta4
sage: parent(val)
Gaussian Integers in Cyclotomic Field of order 4 and degree 2
sage: r4.residue_field(r4.ideal(29).factor()[0][0])(val)
17
sage: r4.residue_field(r4.ideal(29).factor()[0][0])(val) * GF(29)(3)
22
sage: r4.residue_field(r4.ideal(29).factor()[0][0])(G.gens()[2].values_on_gens()[2]) * 3
22
sage: parent(r4.residue_field(r4.ideal(29).factor()[0][0])(G.gens()[2].values_on_gens()[2]) * 3)
Residue field of Fractional ideal (-2*zeta4 + 5)
::
sage: DirichletGroup(60, integral=True)
Group of Dirichlet characters modulo 60 with values in Gaussian Integers in Cyclotomic Field of order 4 and degree 2
sage: parent(DirichletGroup(60, integral=True).gens()[2].values_on_gens()[2])
Gaussian Integers in Cyclotomic Field of order 4 and degree 2
If the order of ``zeta`` cannot be determined automatically, we
can specify it using ``zeta_order``::
sage: DirichletGroup(7, CC, zeta=exp(2*pi*I/6))
Traceback (most recent call last):
...
NotImplementedError: order of element not known
sage: DirichletGroup(7, CC, zeta=exp(2*pi*I/6), zeta_order=6)
Group of Dirichlet characters modulo 7 with values in the group of order 6 generated by 0.500000000000000 + 0.866025403784439*I in Complex Field with 53 bits of precision
If the base ring is not a domain (in which case the group of roots
of unity is not necessarily cyclic), some operations still work,
such as creation of elements::
sage: G = DirichletGroup(5, Zmod(15)); G
Group of Dirichlet characters modulo 5 with values in Ring of integers modulo 15
sage: chi = G([13]); chi
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 13
sage: chi^2
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 4
sage: chi.multiplicative_order()
4
Other operations only work if ``zeta`` is specified::
sage: G.gens()
Traceback (most recent call last):
...
NotImplementedError: factorization of polynomials over rings with composite characteristic is not implemented
sage: G = DirichletGroup(5, Zmod(15), zeta=2); G
Group of Dirichlet characters modulo 5 with values in the group of order 4 generated by 2 in Ring of integers modulo 15
sage: G.gens()
(Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 2,)
TESTS:
Dirichlet groups are cached, creating two groups with the same parameters
yields the same object::
sage: DirichletGroup(60) is DirichletGroup(60)
True
"""
def create_key(self, N, base_ring=None, zeta=None, zeta_order=None,
names=None, integral=False):
"""
Create a key that uniquely determines a Dirichlet group.
TESTS::
sage: DirichletGroup.create_key(60)
(Cyclotomic Field of order 4 and degree 2, 60, None, None)
An example to illustrate that ``base_ring`` is a part of the key::
sage: k = DirichletGroup.create_key(2, base_ring=QQ); k
(Rational Field, 2, None, None)
sage: l = DirichletGroup.create_key(2, base_ring=CC); l
(Complex Field with 53 bits of precision, 2, None, None)
sage: k == l
False
sage: G = DirichletGroup.create_object(None, k); G
Group of Dirichlet characters modulo 2 with values in Rational Field
sage: H = DirichletGroup.create_object(None, l); H
Group of Dirichlet characters modulo 2 with values in Complex Field with 53 bits of precision
sage: G == H
False
If ``base_ring`` was not be a part of the key, the keys would compare
equal and the caching would be broken::
sage: k = k[1:]; k
(2, None, None)
sage: l = l[1:]; l
(2, None, None)
sage: k == l
True
sage: DirichletGroup(2, base_ring=QQ) is DirichletGroup(2, base_ring=CC)
False
If the base ring is not an integral domain, an error will be
raised if only ``zeta_order`` is specified::
sage: DirichletGroup(17, Integers(15))
Group of Dirichlet characters modulo 17 with values in Ring of integers modulo 15
sage: DirichletGroup(17, Integers(15), zeta_order=4)
Traceback (most recent call last):
...
ValueError: base ring (= Ring of integers modulo 15) must be an integral domain if only zeta_order is specified
sage: G = DirichletGroup(17, Integers(15), zeta=7); G
Group of Dirichlet characters modulo 17 with values in the group of order 4 generated by 7 in Ring of integers modulo 15
sage: G.order()
4
sage: DirichletGroup(-33)
Traceback (most recent call last):
...
ValueError: modulus should be positive
"""
modulus = rings.Integer(N)
if modulus <= 0:
raise ValueError('modulus should be positive')
if base_ring is None:
if not (zeta is None and zeta_order is None):
raise ValueError("zeta and zeta_order must be None if base_ring not specified")
e = rings.IntegerModRing(modulus).unit_group_exponent()
base_ring = rings.CyclotomicField(e)
if integral:
base_ring = base_ring.ring_of_integers()
if not is_Ring(base_ring):
raise TypeError("base_ring (= %s) must be a ring" % base_ring)
# If either zeta or zeta_order is given, compute the other.
if zeta is not None:
zeta = base_ring(zeta)
if zeta_order is None:
zeta_order = zeta.multiplicative_order()
elif zeta_order is not None:
if not base_ring.is_integral_domain():
raise ValueError("base ring (= %s) must be an integral domain if only zeta_order is specified"
% base_ring)
zeta_order = rings.Integer(zeta_order)
zeta = base_ring.zeta(zeta_order)
return (base_ring, modulus, zeta, zeta_order)
def create_object(self, version, key, **extra_args):
"""
Create the object from the key (extra arguments are ignored). This is
only called if the object was not found in the cache.
TESTS::
sage: K = CyclotomicField(4)
sage: DirichletGroup.create_object(None, (K, 60, K.gen(), 4))
Group of Dirichlet characters modulo 60 with values in the group of order 4 generated by zeta4 in Cyclotomic Field of order 4 and degree 2
"""
base_ring, modulus, zeta, zeta_order = key
return DirichletGroup_class(base_ring, modulus, zeta, zeta_order)
DirichletGroup = DirichletGroupFactory("DirichletGroup")
def is_DirichletGroup(x):
"""
Returns True if x is a Dirichlet group.
EXAMPLES::
sage: from sage.modular.dirichlet import is_DirichletGroup
sage: is_DirichletGroup(DirichletGroup(11))
True
sage: is_DirichletGroup(11)
False
sage: is_DirichletGroup(DirichletGroup(11).0)
False
"""
return isinstance(x, DirichletGroup_class)
class DirichletGroup_class(WithEqualityById, Parent):
"""
Group of Dirichlet characters modulo `N` with values in a ring `R`.
"""
Element = DirichletCharacter
def __init__(self, base_ring, modulus, zeta, zeta_order):
"""
Create a Dirichlet group.
Not to be called directly (use the factory function ``DirichletGroup``).
The ``DirichletGroup`` factory ensures that either both
``zeta`` and ``zeta_order`` are specified, or that both are
``None``. In the former case, it also ensures that ``zeta``
is an element of ``base_ring`` and that ``zeta_order`` is an
element of ``ZZ``.
TESTS::
sage: G = DirichletGroup(7, base_ring=Integers(9), zeta=2) # indirect doctest
sage: TestSuite(G).run()
sage: G.base() # check that Parent.__init__ has been called
Ring of integers modulo 9
sage: DirichletGroup(13) == DirichletGroup(13)
True
sage: DirichletGroup(13) == DirichletGroup(13, QQ)
False
"""
from sage.categories.groups import Groups
category = Groups().Commutative()
if base_ring.is_integral_domain() or base_ring.is_finite():
# The group of n-th roots of unity in the base ring is
# finite, and hence this Dirichlet group is finite too.
# In particular, it is finitely generated; the added
# FinitelyGenerated() here means that the group has a
# distinguished set of generators.
category = category.Finite().FinitelyGenerated()
Parent.__init__(self, base_ring, category=category)
self._zeta = zeta
self._zeta_order = zeta_order
self._modulus = modulus
self._integers = rings.IntegerModRing(modulus)
def __setstate__(self, state):
"""
Used for unpickling old instances.
TESTS::
sage: G = DirichletGroup(9)
sage: loads(dumps(G)) is G
True
"""
self._set_element_constructor()
if '_zeta_order' in state:
state['_zeta_order'] = rings.Integer(state['_zeta_order'])
super(DirichletGroup_class, self).__setstate__(state)
@property
def _module(self):
"""
Return the free module used to represent Dirichlet characters.
TESTS::
sage: DirichletGroup(12)._module
Vector space of dimension 2 over Ring of integers modulo 2
"""
return free_module.FreeModule(rings.IntegerModRing(self.zeta_order()),
len(self.unit_gens()))
@property
def _zeta_powers(self):
"""
Return a list of powers of the distinguished root of unity.
TESTS::
sage: DirichletGroup(5)._zeta_powers
[1, zeta4, -1, -zeta4]
"""
R = self.base_ring()
a = R.one()
w = [a]
zeta = self.zeta()
zeta_order = self.zeta_order()
if is_ComplexField(R):
for i in range(1, zeta_order):
a = a * zeta
a._set_multiplicative_order(zeta_order/gcd(zeta_order, i))
w.append(a)
else:
for i in range(1, zeta_order):
a = a * zeta
w.append(a)
return w
@property
def _zeta_dlog(self):
"""
Return a dictionary that can be used to compute discrete
logarithms in the value group of this Dirichlet group.
TESTS::
sage: DirichletGroup(5)._zeta_dlog
{-1: 2, -zeta4: 3, zeta4: 1, 1: 0}
"""
return {z: i for i, z in enumerate(self._zeta_powers)}
def change_ring(self, R, zeta=None, zeta_order=None):
"""
Return the base extension of ``self`` to ``R``.
INPUT:
- ``R`` -- either a ring admitting a conversion map from the
base ring of ``self``, or a ring homomorphism with the base
ring of ``self`` as its domain
- ``zeta`` -- (optional) root of unity in ``R``
- ``zeta_order`` -- (optional) order of ``zeta``
EXAMPLES::
sage: G = DirichletGroup(7,QQ); G
Group of Dirichlet characters modulo 7 with values in Rational Field
sage: G.change_ring(CyclotomicField(6))
Group of Dirichlet characters modulo 7 with values in Cyclotomic Field of order 6 and degree 2
TESTS:
We test the case where `R` is a map (:trac:`18072`)::
sage: K.<i> = QuadraticField(-1)
sage: f = K.complex_embeddings()[0]
sage: D = DirichletGroup(5, K)
sage: D.change_ring(f)
Group of Dirichlet characters modulo 5 with values in Complex Field with 53 bits of precision
"""
if zeta is None and self._zeta is not None:
# A root of unity was explicitly given; we use it over the
# new base ring as well.
zeta = self._zeta
if zeta_order is None:
# We reuse _zeta_order if we know that it stays the
# same; otherwise it will be recomputed as the order
# of R(zeta) by the DirichletGroup factory.
p = R.characteristic()
if p == 0 or p.gcd(self._zeta_order) == 1:
zeta_order = self._zeta_order
else:
# No root of unity specified; use the same zeta_order
# (which may still be None).
zeta_order = self._zeta_order
# Map zeta to the new parent
if zeta is not None:
zeta = R(zeta)
if isinstance(R, Map):
R = R.codomain()
return DirichletGroup(self.modulus(), R,
zeta=zeta,
zeta_order=zeta_order)
def base_extend(self, R):
"""
Return the base extension of ``self`` to ``R``.
INPUT:
- ``R`` -- either a ring admitting a *coercion* map from the
base ring of ``self``, or a ring homomorphism with the base
ring of ``self`` as its domain
EXAMPLES::
sage: G = DirichletGroup(7,QQ); G
Group of Dirichlet characters modulo 7 with values in Rational Field
sage: H = G.base_extend(CyclotomicField(6)); H
Group of Dirichlet characters modulo 7 with values in Cyclotomic Field of order 6 and degree 2
Note that the root of unity can change::
sage: H.zeta()
zeta6
This method (in contrast to :meth:`change_ring`) requires a
coercion map to exist::
sage: G.base_extend(ZZ)
Traceback (most recent call last):
...
TypeError: no coercion map from Rational Field to Integer Ring is defined
Base-extended Dirichlet groups do not silently get roots of
unity with smaller order than expected (:trac:`6018`)::
sage: G = DirichletGroup(10, QQ).base_extend(CyclotomicField(4))
sage: H = DirichletGroup(10, CyclotomicField(4))
sage: G is H
True
sage: G3 = DirichletGroup(31, CyclotomicField(3))
sage: G5 = DirichletGroup(31, CyclotomicField(5))
sage: K30 = CyclotomicField(30)
sage: G3.gen(0).base_extend(K30) * G5.gen(0).base_extend(K30)
Dirichlet character modulo 31 of conductor 31 mapping 3 |--> -zeta30^7 + zeta30^5 + zeta30^4 + zeta30^3 - zeta30 - 1
When a root of unity is specified, base extension still works
if the new base ring is not an integral domain::
sage: f = DirichletGroup(17, ZZ, zeta=-1).0
sage: g = f.base_extend(Integers(15))
sage: g(3)
14
sage: g.parent().zeta()
14
"""
if not (isinstance(R, Map)
or R.has_coerce_map_from(self.base_ring())):
raise TypeError("no coercion map from %s to %s is defined"
% (self.base_ring(), R))
return self.change_ring(R)
def _element_constructor_(self, x):
"""
Construct a Dirichlet character from `x`.
EXAMPLES::
sage: G = DirichletGroup(13)
sage: K = G.base_ring()
sage: G(1)
Dirichlet character modulo 13 of conductor 1 mapping 2 |--> 1
sage: G([-1])
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> -1
sage: G([K.0])
Dirichlet character modulo 13 of conductor 13 mapping 2 |--> zeta12
sage: G(0)
Traceback (most recent call last):
...
TypeError: cannot convert 0 to an element of Group of Dirichlet characters modulo 13 with values in Cyclotomic Field of order 12 and degree 4
sage: G = DirichletGroup(6)
sage: G(DirichletGroup(3).0)
Dirichlet character modulo 6 of conductor 3 mapping 5 |--> -1
sage: G(DirichletGroup(15).0)
Dirichlet character modulo 6 of conductor 3 mapping 5 |--> -1
sage: G(DirichletGroup(15).1)
Traceback (most recent call last):
...
TypeError: conductor must divide modulus
sage: H = DirichletGroup(16, QQ); H(DirichletGroup(16).1)
Traceback (most recent call last):
...
TypeError: Unable to coerce zeta4 to a rational
"""
R = self.base_ring()
try:
if x == R.one():
x = [R.one()] * len(self.unit_gens())
except (TypeError, ValueError, ArithmeticError):
pass
if isinstance(x, list): # list of values on each unit generator
return self.element_class(self, x)
elif not isinstance(x, DirichletCharacter):
raise TypeError("cannot convert %s to an element of %s" % (x, self))
elif not x.conductor().divides(self.modulus()):
raise TypeError("conductor must divide modulus")
a = []
for u in self.unit_gens():
v = u.lift()
# have to do this, since e.g., unit gens mod 11 are not units mod 22.
while x.modulus().gcd(v) != 1:
v += self.modulus()
a.append(R(x(v)))
return self.element_class(self, a)
def _coerce_map_from_(self, X):
"""
Decide whether there is a coercion map from `X`.
There is conversion between Dirichlet groups of different
moduli, but no coercion. This implies that Dirichlet
characters of different moduli do not compare as equal.
TESTS::
sage: trivial_character(6) == trivial_character(3) # indirect doctest
False
sage: trivial_character(3) == trivial_character(9)
False
sage: trivial_character(3) == DirichletGroup(3, QQ).0^2
True
"""
return (isinstance(X, DirichletGroup_class) and
self.modulus() == X.modulus() and
self.base_ring().has_coerce_map_from(X.base_ring()) and
(self._zeta is None or
(X._zeta is not None and
self.base_ring()(X._zeta) in self._zeta_powers)))
def __len__(self):
"""
Return the number of elements of this Dirichlet group. This is the
same as self.order().
EXAMPLES::
sage: len(DirichletGroup(20))
8
sage: len(DirichletGroup(20, QQ))
4
sage: len(DirichletGroup(20, GF(5)))
8
sage: len(DirichletGroup(20, GF(2)))
1
sage: len(DirichletGroup(20, GF(3)))
4
"""
return self.order()
def _repr_(self):
"""
Return a print representation of this group, which can be renamed.
EXAMPLES::
sage: G = DirichletGroup(11)
sage: repr(G) # indirect doctest
'Group of Dirichlet characters modulo 11 with values in Cyclotomic Field of order 10 and degree 4'
sage: G.rename('Dir(11)')
sage: G
Dir(11)
"""
s = "Group of Dirichlet characters modulo %s with values in " % self.modulus()
if self._zeta is not None:
s += "the group of order %s generated by %s in " % (self._zeta_order, self._zeta)
s += str(self.base_ring())
return s
@cached_method
def decomposition(self):
r"""
Returns the Dirichlet groups of prime power modulus corresponding
to primes dividing modulus.
(Note that if the modulus is 2 mod 4, there will be a "factor" of
`(\ZZ/2\ZZ)^*`, which is the trivial group.)
EXAMPLES::
sage: DirichletGroup(20).decomposition()
[
Group of Dirichlet characters modulo 4 with values in Cyclotomic Field of order 4 and degree 2,
Group of Dirichlet characters modulo 5 with values in Cyclotomic Field of order 4 and degree 2
]
sage: DirichletGroup(20,GF(5)).decomposition()
[
Group of Dirichlet characters modulo 4 with values in Finite Field of size 5,
Group of Dirichlet characters modulo 5 with values in Finite Field of size 5
]
"""
R = self.base_ring()
return Sequence([DirichletGroup(p**r,R) for p, r \
in factor(self.modulus())],
cr=True,
universe = cat.Objects())
def exponent(self):
"""
Return the exponent of this group.
EXAMPLES::
sage: DirichletGroup(20).exponent()
4
sage: DirichletGroup(20,GF(3)).exponent()
2
sage: DirichletGroup(20,GF(2)).exponent()
1
sage: DirichletGroup(37).exponent()
36
"""
return self.zeta_order()
@cached_method
def _automorphisms(self):
"""
Compute the automorphisms of self. These are always given by raising to
a power, so the return value is a list of integers.
At present this is only implemented if the base ring has characteristic 0 or a prime.
EXAMPLES::
sage: DirichletGroup(17)._automorphisms()
[1, 3, 5, 7, 9, 11, 13, 15]
sage: DirichletGroup(17, GF(11^4, 'a'))._automorphisms()
[1, 11, 121, 1331]
sage: DirichletGroup(17, Integers(6), zeta=Integers(6)(5))._automorphisms()
Traceback (most recent call last):
...
NotImplementedError: Automorphisms for finite non-field base rings not implemented
sage: DirichletGroup(17, Integers(9), zeta=Integers(9)(2))._automorphisms()
Traceback (most recent call last):
...
NotImplementedError: Automorphisms for finite non-field base rings not implemented
"""
n = self.zeta_order()
R = self.base_ring()
p = R.characteristic()
if p == 0:
Auts = [e for e in range(1,n) if gcd(e,n) == 1]
else:
if not rings.ZZ(p).is_prime():
raise NotImplementedError("Automorphisms for finite non-field base rings not implemented")
# The automorphisms in characteristic p are
# k-th powering for
# k = 1, p, p^2, ..., p^(r-1),
# where p^r = 1 (mod n), so r is the mult order of p modulo n.
r = rings.IntegerModRing(n)(p).multiplicative_order()
Auts = [p**m for m in range(0,r)]
return Auts
def galois_orbits(self, v=None, reps_only=False, sort=True, check=True):
"""
Return a list of the Galois orbits of Dirichlet characters in self,
or in v if v is not None.
INPUT:
- ``v`` - (optional) list of elements of self
- ``reps_only`` - (optional: default False) if True
only returns representatives for the orbits.
- ``sort`` - (optional: default True) whether to sort
the list of orbits and the orbits themselves (slightly faster if
False).
- ``check`` - (optional, default: True) whether or not
to explicitly coerce each element of v into self.
The Galois group is the absolute Galois group of the prime subfield
of Frac(R). If R is not a domain, an error will be raised.
EXAMPLES::
sage: DirichletGroup(20).galois_orbits()
[
[Dirichlet character modulo 20 of conductor 20 mapping 11 |--> -1, 17 |--> -1],
...,
[Dirichlet character modulo 20 of conductor 1 mapping 11 |--> 1, 17 |--> 1]
]
sage: DirichletGroup(17, Integers(6), zeta=Integers(6)(5)).galois_orbits()
Traceback (most recent call last):
...
TypeError: Galois orbits only defined if base ring is an integral domain
sage: DirichletGroup(17, Integers(9), zeta=Integers(9)(2)).galois_orbits()
Traceback (most recent call last):
...
TypeError: Galois orbits only defined if base ring is an integral domain
"""
if v is None:
v = self.list()
else:
if check:
v = [self(x) for x in v]
G = []
seen_so_far = set([])
for x in v:
z = x.element()
e = tuple(z) # change when there are immutable vectors (and below)
if e in seen_so_far:
continue
orbit = x.galois_orbit(sort=sort)
if reps_only:
G.append(x)
else:
G.append(orbit)
for z in orbit:
seen_so_far.add(tuple(z.element()))
G = Sequence(G, cr=True)
if sort:
G.sort()
return G
def gen(self, n=0):
"""
Return the n-th generator of self.
EXAMPLES::
sage: G = DirichletGroup(20)
sage: G.gen(0)
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: G.gen(1)
Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4
sage: G.gen(2)
Traceback (most recent call last):
...
IndexError: n(=2) must be between 0 and 1
::
sage: G.gen(-1)
Traceback (most recent call last):
...
IndexError: n(=-1) must be between 0 and 1
"""
n = int(n)
g = self.gens()
if n<0 or n>=len(g):
raise IndexError("n(=%s) must be between 0 and %s"%(n,len(g)-1))
return g[n]
@cached_method
def gens(self):
"""
Returns generators of self.
EXAMPLES::
sage: G = DirichletGroup(20)
sage: G.gens()
(Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1, Dirichlet character modulo 20 of conductor 5 mapping 11 |--> 1, 17 |--> zeta4)
"""
g = []
ord = self.zeta_order()
M = self._module
zero = M(0)
orders = self.integers_mod().unit_group().gens_orders()
for i in range(len(self.unit_gens())):
z = zero.__copy__()
z[i] = ord//gcd(ord, orders[i])
g.append(self.element_class(self, z, check=False))
return tuple(g)
def integers_mod(self):
r"""
Returns the group of integers `\ZZ/N\ZZ`
where `N` is the modulus of self.
EXAMPLES::
sage: G = DirichletGroup(20)
sage: G.integers_mod()
Ring of integers modulo 20
"""
return self._integers
__iter__ = multiplicative_iterator
def list(self):
"""
Return a list of the Dirichlet characters in this group.
EXAMPLES::
sage: DirichletGroup(5).list()
[Dirichlet character modulo 5 of conductor 1 mapping 2 |--> 1,
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> zeta4,
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1,
Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -zeta4]
"""
return self._list_from_iterator()
def modulus(self):
"""
Returns the modulus of self.
EXAMPLES::
sage: G = DirichletGroup(20)
sage: G.modulus()
20
"""
return self._modulus
def ngens(self):
"""
Returns the number of generators of self.
EXAMPLES::
sage: G = DirichletGroup(20)
sage: G.ngens()
2
"""
return len(self.gens())
@cached_method
def order(self):
"""
Return the number of elements of self. This is the same as
len(self).
EXAMPLES::
sage: DirichletGroup(20).order()
8
sage: DirichletGroup(37).order()
36
"""
ord = rings.Integer(1)
for g in self.gens():
ord *= int(g.order())
return ord
def random_element(self):
"""
Return a random element of self.
The element is computed by multiplying a random power of each
generator together, where the power is between 0 and the order of
the generator minus 1, inclusive.
EXAMPLES::
sage: DirichletGroup(37).random_element()
Dirichlet character modulo 37 of conductor 37 mapping 2 |--> zeta36^4
sage: DirichletGroup(20).random_element()
Dirichlet character modulo 20 of conductor 4 mapping 11 |--> -1, 17 |--> 1
sage: DirichletGroup(60).random_element()
Dirichlet character modulo 60 of conductor 3 mapping 31 |--> 1, 41 |--> -1, 37 |--> 1
"""
e = self(1)
for i in range(self.ngens()):
g = self.gen(i)
n = random.randrange(g.order())
e *= g**n
return e
def unit_gens(self):
r"""
Returns the minimal generators for the units of
`(\ZZ/N\ZZ)^*`, where `N` is the
modulus of self.
EXAMPLES::
sage: DirichletGroup(37).unit_gens()
(2,)
sage: DirichletGroup(20).unit_gens()
(11, 17)
sage: DirichletGroup(60).unit_gens()
(31, 41, 37)
sage: DirichletGroup(20,QQ).unit_gens()
(11, 17)
"""
return self._integers.unit_gens()
@cached_method
def zeta(self):
"""
Return the chosen root of unity in the base ring.
EXAMPLES::
sage: DirichletGroup(37).zeta()
zeta36
sage: DirichletGroup(20).zeta()
zeta4
sage: DirichletGroup(60).zeta()
zeta4
sage: DirichletGroup(60,QQ).zeta()
-1
sage: DirichletGroup(60, GF(25,'a')).zeta()
2
"""
zeta = self._zeta
if zeta is None:
R = self.base_ring()
e = self._integers.unit_group_exponent()
for d in reversed(e.divisors()):
try:
zeta = R.zeta(d)
break
except ValueError:
pass
self.zeta_order.set_cache(d)
return zeta
@cached_method
def zeta_order(self):
"""
Return the order of the chosen root of unity in the base ring.
EXAMPLES::
sage: DirichletGroup(20).zeta_order()
4
sage: DirichletGroup(60).zeta_order()
4
sage: DirichletGroup(60, GF(25,'a')).zeta_order()
4
sage: DirichletGroup(19).zeta_order()
18
"""
order = self._zeta_order
if order is None:
order = self.zeta().multiplicative_order()
return order
| 34.562563 | 378 | 0.545557 | 1 | 2.2103 | [
-0.02168879099190235,
0.012985847890377045,
0.007168292533606291,
0.0010617710649967194,
-0.002769609447568655,
0.0012646338436752558,
-0.0034371253568679094,
0.00038043083623051643,
-0.011883364990353584,
0.020691070705652237,
-0.0014395187608897686,
-0.00550254387781024,
0.0065105329267680645,
-0.02443026937544346,
-0.011869722045958042,
-0.019296085461974144,
0.07646479457616806,
0.015762537717819214,
0.031749967485666275,
0.016660485416650772,
0.0033941976726055145,
-0.018461473286151886,
-0.014943592250347137,
0.023924734443426132,
-0.010055813938379288,
0.034890271723270416,
0.0257573202252388,
0.0006796364905312657,
0.004635295365005732,
-0.015618623234331608,
-0.022693010047078133,
0.003274124814197421,
-0.0448455773293972,
0.03803186118602753,
-0.02531047724187374,
0.0013254153309389949,
-0.0038550852332264185,
-0.025242473930120468,
-0.010948038659989834,
0.015477227047085762,
0.0012879453133791685,
-0.004911003168672323,
-0.0029432987794280052,
-0.029057586565613747,
0.01965397410094738,
0.03256908431649208,
0.024534201249480247,
-0.006208375096321106,
-0.02943139523267746,
-0.0003067627258133143,
0.04779881238937378,
0.02029627189040184,
0.030527902767062187,
-0.03125284984707832,
-0.014634479768574238,
-0.05710352584719658,
0.004433175548911095,
-0.06309747695922852,
-0.041799239814281464,
0.032663747668266296,
-0.046366624534130096,
-0.009232566691935062,
-0.00236020446754992,
-0.002310526790097356,
0.034833282232284546,
-0.005522978492081165,
-0.05377736687660217,
-0.026800286024808884,
0.003811589675024152,
-0.01650354452431202,
-0.02801891416311264,
-0.009129988960921764,
0.04080764576792717,
0.03334570676088333,
-0.003683951683342457,
0.01815103180706501,
-0.03366050869226456,
-0.0056431107223033905,
-0.005680663976818323,
0.020328463986516,
-0.00931491144001484,
-0.003805843647569418,
0.025149425491690636,
-0.0010230314219370484,
-0.029852747917175293,
0.05339086800813675,
0.06719855219125748,
-0.0020591882057487965,
0.027071548625826836,
0.0061052097007632256,
-0.020372875034809113,
0.04361705482006073,
-0.009852535091340542,
-0.02132001332938671,
-0.04455743357539177,
-0.05552557110786438,
0.0305730402469635,
0.02922200597822666,
-0.011321493424475193,
0.07025052607059479,
0.03225019574165344,
-0.03436977043747902,
0.00992100965231657,
-0.0027712758164852858,
-0.0158438291400671,
0.03170321136713028,
-0.04751148819923401,
0.0350523516535759,
-0.03314387425780296,
-0.013148381374776363,
-0.025435009971261024,
-0.02904689684510231,
0.0015495765255764127,
0.004197099711745977,
0.00443944800645113,
-0.018025534227490425,
-0.01577143371105194,
-0.009164429269731045,
-0.016496293246746063,
0.02214079350233078,
0.020787393674254417,
0.010070997290313244,
0.015338361263275146,
-0.0011843815445899963,
0.0011383446399122477,
0.032283224165439606,
0.03734910115599632,
-0.03089269995689392,
0.04623357951641083,
-0.002536527579650283,
0.01997082307934761,
0.010268110781908035,
-0.016677189618349075,
-0.03180362656712532,
0.02956192009150982,
-0.006225407123565674,
0.007496446371078491,
-0.027842458337545395,
-0.03366689383983612,
-0.025238482281565666,
-0.04921599105000496,
-0.020429687574505806,
-0.017817990854382515,
-0.0105790626257658,
0.05074496194720268,
-0.02296213060617447,
0.0015290812589228153,
-0.0018850930500775576,
-0.001086193835362792,
-0.011652941815555096,
0.03904149308800697,
0.013320702128112316,
-0.038148339837789536,
0.02847309038043022,
0.018225667998194695,
-0.0019865771755576134,
0.04896502196788788,
-0.012963921763002872,
0.0009685024269856513,
0.02477218769490719,
-0.03628656268119812,
-0.010928011499345303,
0.017298582941293716,
0.009324791841208935,
0.013758369721472263,
-0.016154402866959572,
-0.00277971220202744,
-0.0017437770729884505,
0.0006254047621041536,
-0.01840129867196083,
-0.002074911491945386,
0.019129427149891853,
0.019364751875400543,
0.00011005709529854357,
-0.0617978610098362,
0.016046933829784393,
0.02148524299263954,
-0.02374994195997715,
-0.016373220831155777,
-0.018353139981627464,
-0.013782151974737644,
-0.005609426647424698,
0.03499717265367508,
0.014297166839241982,
0.000908243062440306,
-0.0276939794421196,
-0.017943093553185463,
-0.023866716772317886,
-0.022381339222192764,
0.004810960963368416,
0.015049971640110016,
0.01592961885035038,
0.04815908893942833,
-0.017263203859329224,
-0.029130540788173676,
0.004275009501725435,
0.026927301660180092,
0.007654723711311817,
-0.0413992665708065,
0.030784260481595993,
-0.023875944316387177,
-0.021147187799215317,
-0.009360910393297672,
0.011940891854465008,
-0.006452950648963451,
-0.0008449871093034744,
-0.7647336721420288,
0.0067816367372870445,
0.007525491528213024,
-0.013447562232613564,
-0.016389476135373116,
0.013183500617742538,
0.004416299052536488,
0.03833018243312836,
-0.03979931399226189,
-0.025584444403648376,
0.01164943352341652,
-0.02006796933710575,
-0.023181289434432983,
-0.008842114359140396,
0.056771084666252136,
-0.01612379029393196,
-0.004814797081053257,
0.01593291014432907,
-0.03110215626657009,
0.027024654671549797,
0.007195235695689917,
0.009615866467356682,
0.009832371957600117,
0.010761269368231297,
-0.02977137640118599,
0.035055968910455704,
0.021053198724985123,
-0.015209725126624107,
0.014820925891399384,
-0.020246705040335655,
-0.020294398069381714,
0.006522387731820345,
-0.007131943479180336,
0.010696358978748322,
0.011500569060444832,
-0.012505263090133667,
-0.02204727567732334,
-0.02375118061900139,
-0.011195176281034946,
-0.013409732840955257,
-0.005325233563780785,
-0.010354913771152496,
0.005715492181479931,
-0.02935759909451008,
-0.01951291598379612,
0.0047704316675662994,
-0.013119949027895927,
-0.047400325536727905,
0.037420425564050674,
0.02082056552171707,
-0.02670476585626602,
-0.00714479386806488,
0.005837780423462391,
-0.013807005248963833,
-0.014056817628443241,
0.016590731218457222,
-0.028058286756277084,
-0.007623476441949606,
-0.006075223442167044,
0.02266616001725197,
0.04623265564441681,
0.00806196965277195,
-0.022606294602155685,
-0.0001461914216633886,
-0.034661199897527695,
0.024296006187796593,
0.03770335763692856,
0.007088019512593746,
0.020352190360426903,
0.033787354826927185,
0.04140092805027962,
-0.023975467309355736,
-0.020322192460298538,
0.05477789416909218,
-0.021133946254849434,
0.0002416607312625274,
-0.026340235024690628,
0.007089446298778057,
-0.007807920221239328,
-0.023211341351270676,
0.009579378180205822,
0.005714834202080965,
-0.007782618515193462,
0.010194866918027401,
-0.03357986360788345,
0.030277317389845848,
-0.016157027333974838,
-0.003259040415287018,
0.01272235345095396,
0.024065986275672913,
0.007379837334156036,
0.049741230905056,
0.013017327524721622,
0.01638736203312874,
0.007652509957551956,
0.010496552102267742,
0.024632003158330917,
0.03321610391139984,
0.011428281664848328,
0.003044153330847621,
-0.019716791808605194,
0.0050778500735759735,
-0.007999848574399948,
-0.015742827206850052,
-0.025094138458371162,
-0.02112407237291336,
-0.012777628377079964,
-0.03044828586280346,
0.023187220096588135,
-0.03207788243889809,
0.01025976799428463,
0.01134609617292881,
-0.010066363029181957,
0.030471526086330414,
0.029283814132213593,
-0.025359036400914192,
0.00403825007379055,
-0.0332954041659832,
-0.005515493918210268,
-0.016893725842237473,
-0.016151225194334984,
-0.02429824136197567,
-0.011638826690614223,
0.008240622468292713,
-0.04172702506184578,
-0.009961307980120182,
-0.056146252900362015,
0.009065184742212296,
0.009689566679298878,
0.01731945015490055,
-0.02397746406495571,
-0.022199518978595734,
0.0020984234288334846,
0.02608289197087288,
0.02663269080221653,
-0.029015058651566505,
-0.02372605912387371,
0.019209105521440506,
0.0015373054193332791,
-0.02585907280445099,
0.000762414070777595,
-0.00655375374481082,
-0.012974340468645096,
0.00005940444680163637,
0.02149730734527111,
-0.019703606143593788,
-0.010134401731193066,
0.005171057302504778,
0.014683479443192482,
0.03357350453734398,
-0.014273904263973236,
0.018801001831889153,
0.007563138380646706,
-0.0033186168875545263,
0.016089480370283127,
0.036790478974580765,
-0.008299008011817932,
0.002491153310984373,
-0.01462641917169094,
-0.007355801295489073,
-0.02942400984466076,
0.007477611303329468,
-0.0024073810782283545,
0.00775601901113987,
-0.006861592642962933,
0.02276017516851425,
-0.002419745083898306,
0.008564536459743977,
0.003966613207012415,
0.015418763272464275,
0.03246917575597763,
-0.05263534188270569,
-0.006110701244324446,
0.028601115569472313,
-0.018063077703118324,
-0.004735438618808985,
0.004627123940736055,
0.002791230333968997,
-0.02526230178773403,
0.002182913012802601,
0.011742291040718555,
0.005424764472991228,
-0.02373666502535343,
-0.0006653800373896956,
-0.028941651806235313,
0.015633035451173782,
-0.010485343635082245,
0.012946389615535736,
0.01433263998478651,
-0.024642905220389366,
0.01014686282724142,
0.0282660573720932,
-0.014110160991549492,
-0.0051974826492369175,
0.02576257288455963,
0.0032874809112399817,
-0.007620788179337978,
0.010010365396738052,
0.003128320910036564,
-0.004505549091845751,
0.03692436218261719,
0.017390429973602295,
-0.013782414607703686,
-0.030498702079057693,
-0.023487428203225136,
0.02070542797446251,
0.02861953340470791,
-0.014477904886007309,
-0.014716925099492073,
0.007196943741291761,
0.029269879683852196,
0.017795292660593987,
0.03553490713238716,
0.01951686106622219,
-0.03757528215646744,
-0.006676983553916216,
-0.019593369215726852,
0.023711062967777252,
-0.009798049926757812,
-0.050764989107847214,
-0.0010038509499281645,
-0.020409423857927322,
-0.021443521603941917,
0.004229598678648472,
-0.021075323224067688,
-0.014537685550749302,
-0.01238662376999855,
0.044746674597263336,
-0.017491400241851807,
-0.03365558385848999,
0.0028538305778056383,
0.0020761643536388874,
-0.006545488256961107,
0.015830539166927338,
-0.010836618021130562,
0.031343623995780945,
-0.009914770722389221,
-0.042532164603471756,
-0.03225480765104294,
-0.021634060889482498,
0.039555154740810394,
-0.0007979465299285948,
0.016309263184666634,
-0.012968112714588642,
-0.0041335346177220345,
-0.015179873444139957,
0.012168805114924908,
-0.00969642773270607,
-0.017891572788357735,
-0.013797695748507977,
0.0008309049881063402,
0.04458296671509743,
-0.00937574077397585,
-0.02254636585712433,
0.0007037654868327081,
0.017576511949300766,
-0.013096116483211517,
0.01268676482141018,
0.04569992795586586,
0.006795449182391167,
-0.037988219410181046,
-0.0178504791110754,
-0.008394594304263592,
0.014985667541623116,
0.0025623547844588757,
-0.025979381054639816,
0.006746460683643818,
0.023554347455501556,
0.026116114109754562,
0.001996537670493126,
0.004220214672386646,
-0.01687837578356266,
-0.01928527280688286,
-0.038202058523893356,
0.013791336677968502,
-0.013299031183123589,
0.007295270916074514,
-0.019296715036034584,
-0.028674393892288208,
0.009550947695970535,
-0.03666325658559799,
-0.015527324751019478,
0.04468361288309097,
0.04108083248138428,
-0.010711533948779106,
0.028971239924430847,
-0.042711954563856125,
-0.005765217822045088,
-0.0072255306877195835,
0.02824047952890396,
0.009532872587442398,
0.01055531483143568,
0.021376149728894234,
0.050273504108190536,
0.018489180132746696,
-0.030510898679494858,
-0.011765658855438232,
0.002768686506897211,
0.005153011530637741,
0.0068191890604794025,
0.0439629964530468,
0.005549674388021231,
-0.030578995123505592,
0.01566845364868641,
-0.018529012799263,
0.011159845627844334,
-0.004447652958333492,
-0.03393176943063736,
0.0017192029627040029,
0.03471080958843231,
0.0263625867664814,
0.03329287841916084,
-0.00995211023837328,
0.010280195623636246,
-0.022068150341510773,
0.009579459205269814,
0.012086610309779644,
0.028023231774568558,
-0.012830615974962711,
0.009403705596923828,
-0.019802184775471687,
0.026514120399951935,
-0.018784791231155396,
0.0717327818274498,
-0.003236127784475684,
-0.012315579690039158,
0.0023488032165914774,
0.030372999608516693,
0.0005696938023902476,
0.0011851722374558449,
-0.02538803033530712,
-0.0070396121591329575,
-0.0011979874689131975,
-0.0061429948545992374,
0.007963491603732109,
-0.020817775279283524,
0.0341220498085022,
0.003660350339487195,
0.04950260370969772,
0.011608368717133999,
0.039725590497255325,
0.017970198765397072,
-0.03921942040324211,
0.00528813898563385,
-0.017461106181144714,
-0.0015694181201979518,
-0.0013773131649941206,
0.07026401907205582,
0.026333343237638474,
0.03352401405572891,
-0.005246382672339678,
-0.006188943516463041,
-0.016347046941518784,
0.012511824257671833,
-0.013505793176591396,
-0.040334686636924744,
0.01612323336303234,
0.005203239154070616,
0.053105082362890244,
-0.031331516802310944,
0.019683634862303734,
0.005864335224032402,
-0.0013890084810554981,
-0.04038342460989952,
0.041040148586034775,
-0.04063788056373596,
-0.021741729229688644,
-0.013654800131917,
-0.0004912593285553157,
0.008400236256420612,
-0.002538932953029871,
-0.007603325881063938,
-0.007410437799990177,
0.002266030292958021,
-0.016303125768899918,
-0.009922998026013374,
0.006367275025695562,
0.036230653524398804,
-0.019214898347854614,
-0.0379493311047554,
-0.031098779290914536,
-0.03479747846722603,
0.017230726778507233,
-0.00549990264698863,
0.021261371672153473,
-0.03130669891834259,
-0.011737534776329994,
-0.02134322002530098,
0.006452968344092369,
0.0014586063334718347,
-0.03297128528356552,
-0.0035015929024666548,
-0.018266694620251656,
0.021713752299547195,
-0.018501494079828262,
-0.01660207472741604,
-0.012848484329879284,
-0.0038049104623496532,
0.013072327710688114,
-0.02180016040802002,
0.008224801160395145,
0.006942634005099535,
-0.008850137703120708,
-0.04065033420920372,
0.02939792163670063,
-0.038009122014045715,
0.04503671079874039,
0.013545774854719639,
0.023671772330999374,
0.00884175207465887,
-0.009935254231095314,
0.030418643727898598,
-0.009726257063448429,
-0.04352597892284393,
0.0639171153306961,
0.0057090772315859795,
-0.05449074134230614,
-0.00036240750341676176,
0.030291032046079636,
-0.010435675270855427,
-0.02926420420408249,
0.030834315344691277,
-0.005489364266395569,
-0.003924971912056208,
-0.00992816872894764,
0.026671167463064194,
0.012139366939663887,
-0.0021748037543147802,
-0.014029637910425663,
0.03366078436374664,
-0.0266032163053751,
-0.026528406888246536,
-0.016885358840227127,
0.025538913905620575,
0.029671359807252884,
-0.006301401183009148,
0.04204428941011429,
0.006978692952543497,
0.0013578599318861961,
0.007268136367201805,
-0.0028801404405385256,
-0.01706288382411003,
-0.0062025487422943115,
0.02110903151333332,
0.034620340913534164,
-0.05129498615860939,
0.005109468474984169,
0.020547812804579735,
0.03313656896352768,
0.022003138437867165,
0.023112228140234947,
-0.0052526346407830715,
0.008930335752665997,
-0.02204165607690811,
0.02328348159790039,
0.020813170820474625,
-0.037970513105392456,
-0.023242058232426643,
-0.010807100683450699,
0.007429123390465975,
0.0052629695273935795,
0.03995534032583237,
-0.0006028058123774827,
-0.003977897111326456,
0.011826010420918465,
-0.008136655203998089,
0.019946936517953873,
-0.020635034888982773,
-0.025865716859698296,
-0.013397913426160812,
0.011879910714924335,
-0.008814077824354172,
0.016206394881010056,
0.008809469640254974,
0.008914853446185589,
0.018796950578689575,
-0.019114675000309944,
-0.00768003985285759,
0.003427858930081129,
0.026468854397535324,
-0.003678314620628953,
0.01073803286999464,
0.024594470858573914,
-0.010054344311356544,
0.027436813339591026,
0.009814390912652016,
-0.010990084148943424,
-0.01255609281361103,
0.01393834874033928,
0.01868961751461029,
0.00400098180398345,
-0.027941590175032616,
0.00962649006396532,
0.02452108822762966,
0.017596736550331116,
-0.02887246571481228,
0.010803180746734142,
0.007582667283713818,
0.045854564756155014,
-0.012651580385863781,
-0.02867797389626503,
-0.017010219395160675,
0.030966347083449364,
-0.0251445434987545,
0.01692950911819935,
0.00646644551306963,
0.03381086140871048,
-0.0075768292881548405,
-0.016618622466921806,
-0.012410249561071396,
-0.027902847155928612,
-0.00007018719770712778,
-0.020700568333268166,
-0.005597796756774187,
0.02661896124482155,
0.00483593437820673,
0.007046992890536785,
0.04647304490208626,
0.007054135203361511,
-0.01661285199224949,
-0.0024438821710646152,
0.0214507095515728,
-0.019422713667154312,
-0.024180592969059944,
-0.02806740626692772,
-0.015989098697900772,
-0.002030590083450079,
0.01046690158545971,
0.0050180573016405106,
-0.016113759949803352,
-0.022252587601542473,
-0.0009952301625162363,
-0.03450625389814377,
0.0015276704216375947,
0.031251467764377594,
-0.03057258576154709,
0.03008083812892437,
0.03376632183790207,
-0.036515042185783386,
-0.0024613633286207914,
0.03303477540612221,
-0.00037124339723959565,
-0.02809903211891651,
0.0014740829356014729,
-0.018101802095770836,
0.0005254148272797465,
0.007318123709410429,
0.030018838122487068,
0.022428909316658974,
0.04696476459503174,
-0.010035074315965176,
0.003376677865162492,
-0.05909528210759163,
-0.00534037034958601,
0.0268167145550251,
-0.04579710587859154,
-0.03339575231075287,
0.013641645200550556,
0.00597160030156374,
-0.021352581679821014,
-0.017710698768496513,
0.004000974353402853
] |
8a5f3213a4f40ad41fa4289061fc1bfb9a560419 | 6,445 | py | Python | src/biotite/file.py | danijoo/biotite | 22072e64676e4e917236eac8493eed4c6a22cc33 | [
"BSD-3-Clause"
] | 208 | 2018-04-20T15:59:42.000Z | 2022-03-22T07:47:12.000Z | src/biotite/file.py | danielmuthama/biotite | cb238a8d8d7dc82b3bcea274d7d91d5c876badcd | [
"BSD-3-Clause"
] | 121 | 2017-11-15T14:52:07.000Z | 2022-03-30T16:31:41.000Z | src/biotite/file.py | danielmuthama/biotite | cb238a8d8d7dc82b3bcea274d7d91d5c876badcd | [
"BSD-3-Clause"
] | 49 | 2018-07-19T09:06:24.000Z | 2022-03-23T17:21:34.000Z | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite"
__author__ = "Patrick Kunzmann"
__all__ = ["File", "TextFile", "InvalidFileError"]
import abc
import io
import warnings
from .copyable import Copyable
import copy
class File(Copyable, metaclass=abc.ABCMeta):
"""
Base class for all file classes.
The constructor creates an empty file, that can be filled with data
using the class specific setter methods.
Conversely, the class method :func:`read()` reads a file from disk
(or a file-like object from other sources).
In order to write the instance content into a file the
:func:`write()` method is used.
"""
def __init__(self):
# Support for deprecated instance method 'read()':
# When creating an instance, the 'read()' class method is
# replaced by the instance method, so that subsequent
# 'read()' calls are delegated to the instance method
self.read = self._deprecated_read
@classmethod
@abc.abstractmethod
def read(cls, file):
"""
Parse a file (or file-like object).
Parameters
----------
file : file-like object or str
The file to be read.
Alternatively a file path can be supplied.
Returns
-------
file_object : File
An instance from the respective :class:`File` subclass
representing the parsed file.
"""
pass
def _deprecated_read(self, file, *args, **kwargs):
"""
Support for deprecated instance method :func:`read()`.
Internally this calls the :func:`read()` class method and
replaces the data in `self` with the data from the newly created
:class:`File` object
"""
warnings.warn(
"Instance method 'read()' is deprecated, "
"use class method instead",
DeprecationWarning
)
cls = type(self)
new_file = cls.read(file, *args, **kwargs)
self.__dict__.update(new_file.__dict__)
@abc.abstractmethod
def write(self, file):
"""
Write the contents of this :class:`File` object into a file.
Parameters
----------
file_name : file-like object or str
The file to be written to.
Alternatively a file path can be supplied.
"""
pass
class TextFile(File, metaclass=abc.ABCMeta):
"""
Base class for all line based text files.
When reading a file, the text content is saved as list of strings,
one for each line.
When writing a file, this list is written into the file.
Attributes
----------
lines : list
List of string representing the lines in the text file.
PROTECTED: Do not modify from outside.
"""
def __init__(self):
super().__init__()
self.lines = []
@classmethod
def read(cls, file, *args, **kwargs):
# File name
if isinstance(file, str):
with open(file, "r") as f:
lines = f.read().splitlines()
# File object
else:
if not is_text(file):
raise TypeError("A file opened in 'text' mode is required")
lines = file.read().splitlines()
file_object = cls(*args, **kwargs)
file_object.lines = lines
return file_object
@staticmethod
def read_iter(file):
"""
Create an iterator over each line of the given text file.
Parameters
----------
file : file-like object or str
The file to be read.
Alternatively a file path can be supplied.
Yields
------
line : str
The current line in the file.
"""
# File name
if isinstance(file, str):
with open(file, "r") as f:
while True:
line = f.readline()
if not line:
break
yield line
# File object
else:
if not is_text(file):
raise TypeError("A file opened in 'text' mode is required")
while True:
line = file.readline()
if not line:
break
yield line
def write(self, file):
"""
Write the contents of this object into a file
(or file-like object).
Parameters
----------
file_name : file-like object or str
The file to be written to.
Alternatively a file path can be supplied.
"""
if isinstance(file, str):
with open(file, "w") as f:
f.write("\n".join(self.lines) + "\n")
else:
if not is_text(file):
raise TypeError("A file opened in 'text' mode is required")
file.write("\n".join(self.lines) + "\n")
def __copy_fill__(self, clone):
super().__copy_fill__(clone)
clone.lines = copy.copy(self.lines)
def __str__(self):
return("\n".join(self.lines))
class InvalidFileError(Exception):
"""
Indicates that the file is not suitable for the requested action,
either because the file does not contain the required data or
because the file is malformed.
"""
pass
def wrap_string(text, width):
"""
A much simpler and hence much more efficient version of
`textwrap.wrap()`.
This function simply wraps the given `text` after `width`
characters, ignoring sentences, whitespaces, etc.
"""
lines = []
for i in range(0, len(text), width):
lines.append(text[i : i+width])
return lines
def is_binary(file):
if isinstance(file, io.BufferedIOBase):
return True
# for file wrappers, e.g. 'TemporaryFile'
elif hasattr(file, "file") and isinstance(file.file, io.BufferedIOBase):
return True
else:
return False
def is_text(file):
if isinstance(file, io.TextIOBase):
return True
# for file wrappers, e.g. 'TemporaryFile'
elif hasattr(file, "file") and isinstance(file.file, io.TextIOBase):
return True
else:
return False
| 29.162896 | 76 | 0.565244 | 1 | 1.9551 | [
-0.06683257967233658,
0.0551532544195652,
0.006532780360430479,
-0.03051973134279251,
-0.006995111238211393,
0.036521945148706436,
-0.032730281352996826,
-0.026898860931396484,
-0.03343041241168976,
0.02675206959247589,
0.030724072828888893,
0.024576568976044655,
0.014621937647461891,
0.011168789118528366,
0.009523970074951649,
-0.027809318155050278,
0.22741083800792694,
0.027539022266864777,
-0.027371684089303017,
0.0007568897563032806,
0.018694603815674782,
0.0066900067031383514,
0.003524462226778269,
0.04377111792564392,
0.055960673838853836,
-0.003269872162491083,
0.04852965101599693,
0.007624117191880941,
-0.01354557927697897,
-0.03611414134502411,
0.01586255058646202,
0.0205132644623518,
-0.03315582871437073,
-0.007737289182841778,
-0.04250284284353256,
0.053262192755937576,
0.021255632862448692,
-0.07997705787420273,
0.02674873359501362,
0.021090365946292877,
-0.009488726034760475,
0.024565070867538452,
-0.0277174711227417,
-0.026789667084813118,
0.01698802225291729,
-0.04215748980641365,
0.013371221721172333,
0.0014914751518517733,
-0.009696489199995995,
-0.005804008804261684,
0.0024675466120243073,
0.04313361272215843,
-0.01473712082952261,
-0.04555332288146019,
0.03779430687427521,
-0.04071183502674103,
0.04089349880814552,
-0.0393659882247448,
-0.03407314419746399,
-0.0007154684863053262,
-0.029589856043457985,
0.002934530144557357,
0.027135834097862244,
0.004520463291555643,
0.0020067617297172546,
0.0019834989216178656,
-0.00010080919309984893,
-0.00025942176580429077,
0.04605599865317345,
0.0038522030226886272,
-0.02652830258011818,
-0.01210485864430666,
0.0005354456952773035,
0.02428893931210041,
-0.003552693407982588,
-0.004884009715169668,
-0.02052684873342514,
-0.004700567107647657,
-0.02762157842516899,
-0.00652922922745347,
-0.041888073086738586,
0.064975306391716,
0.005735632963478565,
-0.006461517419666052,
0.025645839050412178,
0.04865097999572754,
0.06374852359294891,
-0.05414444953203201,
0.048867519944906235,
-0.005790420807898045,
-0.0364045612514019,
0.04911942034959793,
-0.04162682220339775,
-0.012527892366051674,
-0.037425532937049866,
-0.08474148064851761,
0.02097449079155922,
0.008819825015962124,
0.038359154015779495,
0.001387939089909196,
0.03470838814973831,
-0.05545419827103615,
0.0202226210385561,
0.049503009766340256,
-0.01326689776033163,
0.0015581856714561582,
-0.03976863995194435,
-0.010990496724843979,
0.007498563267290592,
-0.023641150444746017,
-0.038875069469213486,
0.012280653230845928,
0.03494459390640259,
-0.037801530212163925,
-0.02255859039723873,
-0.0076295966282486916,
0.06612587720155716,
0.030769426375627518,
0.02709684893488884,
-0.017489319667220116,
-0.0138313639909029,
-0.0005950143095105886,
0.006297439336776733,
-0.033786311745643616,
-0.03520256653428078,
0.09077472984790802,
-0.00912424735724926,
0.008612372912466526,
0.06396166980266571,
0.029285188764333725,
0.01800660602748394,
-0.020446009933948517,
-0.009150260128080845,
-0.028288451954722404,
0.03538757190108299,
0.002559852320700884,
0.013031789101660252,
0.004927248228341341,
-0.06705368310213089,
-0.028783779591321945,
0.001084012445062399,
0.006685673259198666,
0.011233209632337093,
-0.025308694690465927,
-0.0031179222278296947,
-0.07434399425983429,
0.017947664484381676,
-0.014660513959825039,
-0.024082468822598457,
-0.026767754927277565,
0.05158471316099167,
0.04062031954526901,
-0.00034716163645498455,
-0.0010272623039782047,
-0.02221626043319702,
-0.014917809516191483,
0.014712449163198471,
-0.048866406083106995,
0.014335177838802338,
0.0460125207901001,
-0.042163021862506866,
0.00999817531555891,
0.03445115312933922,
0.007310307119041681,
0.035081394016742706,
0.02035168930888176,
-0.03325547277927399,
0.01097461674362421,
-0.01719270646572113,
0.026569435372948647,
-0.00499664805829525,
0.006115003488957882,
-0.029051413759589195,
0.021912163123488426,
-0.02688460238277912,
0.003002628916874528,
0.03287049010396004,
0.04479312524199486,
-0.0174950510263443,
-0.0031463224440813065,
0.014961485750973225,
-0.013941459357738495,
-0.014363999478518963,
0.017498895525932312,
0.001783681334927678,
0.005386284552514553,
-0.06777235120534897,
-0.015680311247706413,
-0.03369230777025223,
0.0077331881038844585,
0.014600294642150402,
0.05112101137638092,
-0.03417399898171425,
-0.02124703861773014,
-0.004127863794565201,
-0.010586360469460487,
0.012537620030343533,
-0.009792556054890156,
-0.005808935966342688,
-0.032121241092681885,
-0.0038177352398633957,
-0.023866727948188782,
-0.004103018436580896,
0.029829703271389008,
-0.0283069871366024,
-0.0022456252481788397,
-0.5779677629470825,
0.041116900742053986,
-0.02958856150507927,
-0.03886907920241356,
0.024428796023130417,
-0.00019291849457658827,
-0.08980471640825272,
0.011562326923012733,
-0.03253084421157837,
0.006132686045020819,
-0.015589076094329357,
-0.016231095418334007,
-0.06725098937749863,
0.004327930044382811,
0.012031902559101582,
-0.004715424031019211,
-0.020779702812433243,
0.007429615128785372,
0.005066093523055315,
0.021673670038580894,
0.015482029877603054,
0.007433730643242598,
0.0029953569173812866,
0.013177945278584957,
0.0197567380964756,
-0.00020488802692852914,
0.00943582784384489,
-0.02460850030183792,
-0.020494675263762474,
0.02951185405254364,
-0.0668046772480011,
-0.010363202542066574,
0.03336682543158531,
0.022914161905646324,
0.0004913806333206594,
0.007705020718276501,
0.03638685122132301,
-0.024991638958454132,
0.0005286579253152013,
-0.027579572051763535,
-0.0437796488404274,
-0.026053693145513535,
-0.041705988347530365,
-0.05286179110407829,
-0.06978844851255417,
-0.04068303108215332,
-0.028805598616600037,
0.008469332940876484,
0.02142542414367199,
0.05860457196831703,
-0.013661863282322884,
0.02211606875061989,
0.0371745340526104,
-0.025271372869610786,
0.021319033578038216,
0.02261578105390072,
-0.04464499652385712,
0.011854559183120728,
0.00535898981615901,
0.002821182832121849,
-0.0020883753895759583,
0.0006852563819848001,
-0.038408175110816956,
0.027526121586561203,
0.03173118084669113,
-0.003742699744179845,
0.025942524895071983,
-0.041862327605485916,
0.008658078499138355,
0.04867862910032272,
-0.06554298102855682,
0.044001586735248566,
-0.034279726445674896,
0.06424152851104736,
-0.003201564773917198,
0.015875937417149544,
-0.004763082601130009,
-0.015216135419905186,
-0.04603256657719612,
-0.02099538967013359,
0.008529121056199074,
-0.012923127971589565,
-0.02719023823738098,
0.00290770479477942,
-0.014144282788038254,
-0.013688581995666027,
-0.013406500220298767,
-0.022015195339918137,
-0.0013052322901785374,
-0.013689336366951466,
0.007527981884777546,
0.03043363057076931,
-0.030529700219631195,
-0.014321641996502876,
-0.0010603906121104956,
0.05052032321691513,
0.005582248326390982,
0.028007855638861656,
0.01871854066848755,
0.0042180088348686695,
-0.04293555021286011,
0.0049890480004251,
-0.028453504666686058,
0.011670979671180248,
-0.033253781497478485,
-0.010058005340397358,
-0.050891730934381485,
0.006095279473811388,
0.10462881624698639,
-0.04511177912354469,
0.031172780320048332,
-0.03210770711302757,
-0.009577983058989048,
-0.010286952368915081,
0.04464976489543915,
0.028268948197364807,
0.004492433276027441,
-0.03406807780265808,
-0.003998506348580122,
0.028076207265257835,
-0.000048299440095433965,
-0.031725700944662094,
0.0021777211222797632,
-0.008659153245389462,
-0.011132403276860714,
0.021687127649784088,
-0.02369396947324276,
0.02954397164285183,
0.014400715939700603,
0.04841424897313118,
-0.07157739251852036,
-0.019053151831030846,
-0.0024672644212841988,
0.001354794017970562,
-0.0015749515732750297,
0.01729210838675499,
-0.022228393703699112,
-0.020298494026064873,
0.012929791584610939,
-0.012136053293943405,
-0.004955734126269817,
-0.013172087259590626,
0.051714081317186356,
-0.06017213314771652,
-0.027601992711424828,
0.04323142021894455,
-0.005361167713999748,
-0.0021502866875380278,
-0.02558387815952301,
-0.03559904173016548,
0.0062293801456689835,
0.06999785453081131,
-0.004937529563903809,
-0.01268591359257698,
-0.010348498821258545,
-0.02479809708893299,
-0.03194722160696983,
0.0009434499661438167,
0.0002302137581864372,
-0.0030158618465065956,
-0.000211951628443785,
-0.050149429589509964,
0.019012445583939552,
-0.007259344682097435,
0.002334472956135869,
-0.016518453136086464,
-0.020954612642526627,
0.010624547488987446,
-0.005395035725086927,
0.03523624315857887,
0.03575444221496582,
-0.012444150634109974,
0.013256908394396305,
0.04253702610731125,
0.0021990814711898565,
0.036065030843019485,
-0.00552051467821002,
-0.029464108869433403,
0.02187139168381691,
0.021679574623703957,
-0.004509142134338617,
0.010872535407543182,
-0.012163738720119,
0.0038044594693928957,
-0.006511634215712547,
-0.021677350625395775,
-0.02651749551296234,
-0.019581329077482224,
0.009694050066173077,
0.0022612246684730053,
0.05183839425444603,
0.03383149951696396,
-0.007543023210018873,
-0.026005353778600693,
-0.0319625586271286,
-0.012140955775976181,
-0.036056820303201675,
-0.02683960273861885,
-0.052810147404670715,
-0.004392263945192099,
0.013016967102885246,
0.03057616390287876,
-0.006827023345977068,
0.0041741239838302135,
0.02557026408612728,
0.043321412056684494,
0.00907209888100624,
-0.0046296329237520695,
-0.018294870853424072,
-0.05442015081644058,
0.04156436398625374,
-0.025071565061807632,
0.032786812633275986,
0.004261894151568413,
-0.006267061922699213,
0.002332908334210515,
-0.07369551807641983,
-0.015419172123074532,
-0.001391395227983594,
-0.012010456994175911,
-0.022251181304454803,
-0.04864147678017616,
0.023635970428586006,
0.014566239900887012,
-0.012347177602350712,
-0.006009700242429972,
-0.01140522863715887,
-0.013523083180189133,
0.000058048801292898133,
-0.014967972412705421,
0.005428530275821686,
0.0057250685058534145,
0.0036300027277320623,
-0.02580353431403637,
-0.0019884721841663122,
-0.030234066769480705,
-0.01716678962111473,
-0.02443142607808113,
0.006666926667094231,
-0.02638128772377968,
0.037396080791950226,
-0.02707582525908947,
-0.007947389967739582,
0.0011245663044974208,
0.03238477557897568,
-0.023844733834266663,
0.021162889897823334,
-0.03491523489356041,
-0.004463627003133297,
0.006730339024215937,
-0.040723033249378204,
0.03846479579806328,
0.00942309945821762,
0.00846452359110117,
0.02213321067392826,
-0.013494377955794334,
-0.007638843264430761,
0.016535134986042976,
-0.004813033621758223,
0.01243109256029129,
0.011583534069359303,
-0.029586363583803177,
-0.007226064335554838,
0.04598519206047058,
-0.025915704667568207,
0.03609102964401245,
0.011052065528929234,
-0.0030619974713772535,
-0.01860014535486698,
-0.0020202076993882656,
0.003859135555103421,
-0.002305984264239669,
-0.027668574824929237,
-0.0020095405634492636,
0.010577431879937649,
0.014904310926795006,
0.006678690202534199,
-0.0073295896872878075,
-0.01428043469786644,
0.06835636496543884,
0.02360457368195057,
0.0052729821763932705,
-0.0010504547972232103,
0.00461558997631073,
0.015704790130257607,
0.016940727829933167,
-0.027167191728949547,
-0.008692001923918724,
-0.05293012037873268,
-0.0067199827171862125,
-0.009153125807642937,
-0.03762771561741829,
0.024774516001343727,
-0.017950812354683876,
0.0020262685138732195,
-0.019633136689662933,
0.0016132802702486515,
0.0017843155656009912,
0.02833450771868229,
0.014294173568487167,
0.04690466448664665,
-0.011684007942676544,
-0.03728394955396652,
0.004115638788789511,
0.0561642199754715,
-0.0057245539501309395,
-0.004342750180512667,
-0.011190980672836304,
0.011909978464245796,
0.030900539830327034,
0.014738383702933788,
0.01678675226867199,
0.007868832908570766,
-0.017109187319874763,
0.03980554640293121,
-0.018331926316022873,
0.0700467899441719,
0.004194999113678932,
0.03350260853767395,
0.0423496775329113,
-0.008887176401913166,
-0.0075370874255895615,
-0.004055249039083719,
-0.04316136613488197,
0.015554457902908325,
-0.020258521661162376,
0.010340310633182526,
-0.010425911284983158,
-0.006522933021187782,
0.029993265867233276,
-0.03451165184378624,
-0.018214600160717964,
0.022946173325181007,
0.009293746203184128,
0.030908923596143723,
0.025512782856822014,
0.0034917863085865974,
0.043815672397613525,
-0.009026377461850643,
0.003218274097889662,
-0.01832960918545723,
-0.010479492135345936,
-0.04746397212147713,
-0.009628966450691223,
-0.020294584333896637,
-0.05254274979233742,
-0.0021846326999366283,
0.034269753843545914,
0.019967347383499146,
0.06668873131275177,
-0.011470643803477287,
-0.007869101129472256,
0.009849862195551395,
0.039422355592250824,
0.0029925706330686808,
-0.019489213824272156,
0.01984066143631935,
-0.034636467695236206,
0.04088957980275154,
0.03498286381363869,
-0.007179935462772846,
-0.013198163360357285,
-0.006316912826150656,
0.018498558551073074,
-0.034613385796546936,
-0.04650982841849327,
0.052510619163513184,
-0.0012056682026013732,
-0.010634658858180046,
0.06423772126436234,
0.0014132183277979493,
-0.02386084385216236,
0.033289529383182526,
-0.008862223476171494,
-0.009480644948780537,
0.05582265928387642,
0.021187661215662956,
0.014255886897444725,
-0.019722415134310722,
-0.033972010016441345,
-0.01772480085492134,
-0.02688016928732395,
-0.01718376949429512,
-0.025783352553844452,
0.005141958594322205,
-0.020372025668621063,
-0.006273558828979731,
0.04934091866016388,
-0.05561475828289986,
-0.04684019833803177,
-0.008423074148595333,
0.00926133617758751,
0.0047889831475913525,
0.03833730146288872,
-0.01592349447309971,
-0.02068183943629265,
-0.023946326225996017,
-0.03054279088973999,
-0.0011637270217761397,
-0.02012043260037899,
-0.0207164715975523,
-0.03861697390675545,
-0.01415762398391962,
-0.0007433256832882762,
0.011708609759807587,
0.006883894558995962,
0.03331928327679634,
0.006169975269585848,
-0.021392084658145905,
0.019979575648903847,
-0.010472538881003857,
0.013973867520689964,
0.0032573745120316744,
-0.03638816624879837,
0.014152302406728268,
0.053211577236652374,
-0.017879119142889977,
-0.008366161957383156,
-0.0038781955372542143,
0.015276562422513962,
-0.024334130808711052,
-0.005139925051480532,
0.018778551369905472,
-0.002135758986696601,
0.00311836414039135,
-0.02226509153842926,
-0.0366252101957798,
0.04317716136574745,
0.012185820378363132,
0.02044869214296341,
-0.044199056923389435,
-0.026781601831316948,
0.0038526852149516344,
0.03404915705323219,
0.023846127092838287,
-0.015042675659060478,
-0.014825962483882904,
0.0149057162925601,
-0.01900613307952881,
0.011714034713804722,
-0.003871144261211157,
-0.0049186279065907,
-0.030051810666918755,
0.013192199170589447,
0.024698607623577118,
-0.008649345487356186,
0.03954235464334488,
-0.000834314152598381,
-0.002902440959587693,
-0.008262195624411106,
-0.016786251217126846,
-0.01182332169264555,
0.015237320214509964,
0.035733651369810104,
0.04602771997451782,
0.04158380255103111,
-0.0037424275651574135,
-0.020299941301345825,
0.09248971194028854,
0.006694708485156298,
0.0036984120961278677,
0.02668813429772854,
0.05486380308866501,
0.020838627591729164,
0.00034426181809976697,
-0.01765517145395279,
-0.0057100336998701096,
-0.04154935106635094,
-0.019570497795939445,
0.010476604104042053,
-0.02501722238957882,
-0.0031365840695798397,
0.007517490070313215,
0.015403327532112598,
0.005262625403702259,
0.018137725070118904,
-0.01780570298433304,
-0.012068449519574642,
0.05491989478468895,
-0.011887109838426113,
-0.04598107188940048,
0.003656952641904354,
0.00978483073413372,
-0.007248530164361,
0.008250835351645947,
0.03499585762619972,
-0.015540634281933308,
-0.0535130612552166,
-0.0020404618699103594,
0.032182492315769196,
-0.059738386422395706,
-0.036787234246730804,
-0.004433106165379286,
0.03527950122952461,
0.03245856985449791,
-0.034022487699985504,
0.020895183086395264,
-0.003931974060833454,
0.053048279136419296,
-0.010240594856441021,
0.016170188784599304,
-0.0004234972584526986,
-0.049679022282361984,
-0.01142625417560339,
0.00587032176554203,
0.029833652079105377,
0.0802915170788765,
0.04658118262887001,
0.002129054395481944,
-0.05169162154197693,
-0.03523676469922066,
-0.009874694980680943,
-0.005438022315502167,
-0.05440836399793625,
0.010447077453136444,
0.002518867142498493,
0.04233762249350548,
0.0021610260009765625,
-0.0016583839897066355,
-0.014240599237382412,
0.002418369520455599,
0.017641855403780937,
0.024315159767866135,
0.029231617227196693,
-0.020906243473291397,
0.0033469751942902803,
-0.06691647320985794,
0.03311076760292053,
-0.014870435930788517,
0.025075001642107964,
0.00968044064939022,
0.003832964226603508,
-0.015175361186265945,
0.01603482849895954,
-0.011562027037143707,
-0.031242579221725464,
-0.011207261122763157,
0.016539061442017555,
-0.03295475244522095,
-0.027071738615632057,
0.06848185509443283,
0.006294445600360632,
0.0001615625951671973,
-0.01167578436434269,
-0.03206967934966087,
-0.0298247542232275,
0.02043667435646057,
0.01062588207423687,
0.00767647847533226,
0.014588779769837856,
0.00421481765806675,
-0.03504238277673721,
-0.026235297322273254,
0.005627388134598732,
0.00029239707509987056,
0.0328340046107769,
0.010606296360492706,
0.06183398514986038,
-0.020077789202332497,
-0.02356713078916073,
-0.027230482548475266,
0.03715144842863083
] |
8a5fa0d5b2ac5b94aac410a26a9a516f09e6dcbd | 4,918 | py | Python | src/cms/views/push_notifications/push_notification_sender.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | null | null | null | src/cms/views/push_notifications/push_notification_sender.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | 5 | 2021-02-10T02:41:20.000Z | 2022-03-12T00:56:56.000Z | src/cms/views/push_notifications/push_notification_sender.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | null | null | null | """
Module for sending Push Notifications
"""
import logging
import requests
from django.conf import settings
from ...models import PushNotificationTranslation
from ...models import Region
from ...constants import push_notifications as pnt_const
logger = logging.getLogger(__name__)
# pylint: disable=too-few-public-methods
class PushNotificationSender:
"""
Sends push notifications via FCM HTTP API.
Definition: https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream-http-messages-json
"""
fcm_url = "https://fcm.googleapis.com/fcm/send"
def __init__(self, push_notification):
"""
Load relevant push notification translations and prepare content for sending
:param push_notification: the push notification that should be sent
:type push_notification: ~cms.models.push_notifications.push_notification.PushNotification
"""
self.push_notification = push_notification
self.prepared_pnts = []
self.primary_pnt = PushNotificationTranslation.objects.get(
push_notification=push_notification,
language=push_notification.region.default_language,
)
if len(self.primary_pnt.title) > 0:
self.prepared_pnts.append(self.primary_pnt)
self.load_secondary_pnts()
self.auth_key = self.get_auth_key()
def load_secondary_pnts(self):
"""
Load push notification translations in other languages
"""
secondary_pnts = PushNotificationTranslation.objects.filter(
push_notification=self.push_notification
).exclude(id=self.primary_pnt.id)
for secondary_pnt in secondary_pnts:
if (
secondary_pnt.title == ""
and pnt_const.USE_MAIN_LANGUAGE == self.push_notification.mode
):
secondary_pnt.title = self.primary_pnt.title
secondary_pnt.text = self.primary_pnt.text
self.prepared_pnts.append(secondary_pnt)
if len(secondary_pnt.title) > 0:
self.prepared_pnts.append(secondary_pnt)
def is_valid(self):
"""
Check if all data for sending push notifications is available
:return: all prepared push notification translations are valid
:rtype: bool
"""
if self.auth_key is None:
return False
for pnt in self.prepared_pnts:
if not pnt.title:
logger.debug("%r has no title", pnt)
return False
return True
@staticmethod
def get_auth_key():
"""
Get FCM API auth key
:return: FCM API auth key
:rtype: str
"""
fcm_auth_config_key = "fcm_auth_key"
auth_key = settings.FCM_KEY
if auth_key.exists():
logger.debug("Got fcm_auth_key from database")
return auth_key.first().value
logger.warning(
"Could not get %r from configuration database", fcm_auth_config_key
)
return None
def send_pn(self, pnt):
"""
Send single push notification translation
:param pnt: the prepared push notification translation to be sent
:type pnt: ~cms.models.push_notifications.push_notification_translation.PushNotificationTranslation
:return: Response of the :mod:`requests` library
:rtype: ~requests.Response
"""
if settings.DEBUG:
region_slug = Region.objects.get(
id=settings.TEST_BLOG_ID
).slug # Testumgebung - prevent sending PNs to actual users in development
else:
region_slug = self.push_notification.region.slug
payload = {
"to": f"/topics/{region_slug}-{pnt.language.slug}-{self.push_notification.channel}",
"notification": {"title": pnt.title, "body": pnt.text},
"data": {
"lanCode": pnt.language.slug,
"city": self.push_notification.region.slug,
},
}
headers = {"Authorization": f"key={self.auth_key}"}
return requests.post(self.fcm_url, json=payload, headers=headers)
# pylint: disable=too-many-arguments
def send_all(self):
"""
Send all prepared push notification translations
:return: Success status
:rtype: bool
"""
status = True
for pnt in self.prepared_pnts:
res = self.send_pn(pnt)
if res.status_code == 200:
logger.info("%r sent, FCM id: %r", pnt, res.json()["message_id"])
else:
status = False
logger.warning(
"Received invalid response from FCM for %r, status: %r, body: %r",
pnt,
res.status_code,
res.text,
)
return status
| 34.391608 | 110 | 0.610207 | 1 | 1.8546 | [
-0.01612139865756035,
0.04372803494334221,
0.0028891251422464848,
-0.022744186222553253,
0.01913858763873577,
-0.007644950412213802,
-0.021491732448339462,
-0.009564852342009544,
-0.034655287861824036,
0.004875585902482271,
0.009251715615391731,
0.020544307306408882,
0.004425778053700924,
-0.012750639580190182,
-0.0025674153584986925,
0.004764621611684561,
0.1239386796951294,
-0.03250967338681221,
0.0372789204120636,
0.00580839766189456,
0.0186216589063406,
0.016520053148269653,
-0.01737099513411522,
0.030166486278176308,
-0.003584223799407482,
0.007062686141580343,
0.02885754220187664,
0.02532772347331047,
-0.03905745595693588,
-0.03759691119194031,
-0.010088472627103329,
0.011165059171617031,
-0.004364457447081804,
0.02075854316353798,
-0.011313424445688725,
0.007088224403560162,
-0.02046511322259903,
-0.031086303293704987,
0.07542932033538818,
0.01881641335785389,
0.002454497618600726,
-0.006058176513761282,
0.02190597541630268,
-0.06425148248672485,
0.010368374176323414,
0.015021809376776218,
0.009761815890669823,
0.004179037641733885,
-0.008315075188875198,
0.006308059673756361,
0.048541586846113205,
0.06646792590618134,
0.006744059268385172,
-0.002577349776402116,
0.030471617355942726,
-0.012458356097340584,
-0.010356040671467781,
0.005704042501747608,
-0.06365277618169785,
-0.004390988033264875,
-0.009972548112273216,
-0.003942209295928478,
0.05459100753068924,
-0.0014854827895760536,
-0.018910134211182594,
0.03156781569123268,
-0.039795003831386566,
-0.002541166730225086,
0.008856739848852158,
0.0013097176561132073,
-0.03970365598797798,
-0.008627756498754025,
-0.000013727647456107661,
0.09429723024368286,
0.040846239775419235,
0.01327276136726141,
-0.005740600172430277,
-0.07228674739599228,
-0.04054907709360123,
0.06302125006914139,
-0.02713535539805889,
0.032965946942567825,
0.021882280707359314,
-0.025671791285276413,
0.022073570638895035,
0.01102641224861145,
0.02100769244134426,
-0.04114273935556412,
0.06796913594007492,
0.00969813670963049,
-0.039889778941869736,
-0.02500915713608265,
0.0031008506193757057,
-0.0012869288912042975,
-0.030233224853873253,
-0.012910536490380764,
0.03614708036184311,
-0.025224246084690094,
0.01393482182174921,
0.05204072967171669,
0.02947661280632019,
-0.04007066413760185,
0.025106273591518402,
0.008229200728237629,
-0.00015841942513361573,
0.011984066106379032,
-0.05052778124809265,
-0.03955806419253349,
-0.03075801394879818,
-0.008584877476096153,
-0.07800530642271042,
-0.013212243095040321,
-0.006317716557532549,
-0.04357406497001648,
0.00836278684437275,
-0.017092177644371986,
0.01655597612261772,
-0.007914457470178604,
0.03987276554107666,
0.12803761661052704,
0.005193896126002073,
-0.013950400054454803,
-0.030804386362433434,
-0.028667449951171875,
0.0014794939197599888,
0.05286629870533943,
-0.019352983683347702,
0.015233487822115421,
0.0451982207596302,
-0.020149128511548042,
-0.037288911640644073,
0.02085733413696289,
0.015333724208176136,
-0.013866261579096317,
-0.012911167927086353,
0.08085432648658752,
-0.015328115783631802,
-0.010394586250185966,
-0.04974077641963959,
-0.018827417865395546,
-0.027964143082499504,
-0.029853327199816704,
-0.027625672519207,
-0.010391282849013805,
0.01451477687805891,
-0.03353887423872948,
-0.02726960927248001,
0.03717387467622757,
-0.007138040382415056,
0.006078965496271849,
0.0160038061439991,
0.03765246644616127,
-0.0024708108976483345,
0.03391144424676895,
0.000981076154857874,
-0.0033811377361416817,
0.0022836001589894295,
-0.03664156794548035,
0.0020664697512984276,
0.007586452644318342,
-0.03797803074121475,
0.014030033722519875,
0.012522137723863125,
-0.01574687287211418,
0.05086302384734154,
0.030887072905898094,
-0.026092473417520523,
-0.027889160439372063,
-0.023044968023896217,
-0.024040307849645615,
0.018750129267573357,
-0.0225375983864069,
-0.03286841884255409,
-0.0013355049304664135,
-0.038872476667165756,
0.022321652621030807,
0.07913985848426819,
-0.048097722232341766,
-0.020485933870077133,
-0.0190874170511961,
0.015680238604545593,
-0.047626011073589325,
0.01697048917412758,
0.00705925514921546,
0.006395249627530575,
0.014410048723220825,
-0.04087410122156143,
0.00974966213107109,
0.004441552795469761,
-0.040965959429740906,
0.0019457980524748564,
0.02688923478126526,
-0.03370658680796623,
-0.005791860166937113,
0.01791193149983883,
-0.028273295611143112,
0.02252352423965931,
0.039223361760377884,
-0.01910342089831829,
-0.001452137134037912,
0.020288771018385887,
0.014303842559456825,
0.0005760654457844794,
0.03918042033910751,
-0.0024030779022723436,
-0.01858527399599552,
-0.6421979665756226,
0.04027193412184715,
-0.023261263966560364,
-0.01418556272983551,
0.0034607297275215387,
0.003574944334104657,
-0.05987697094678879,
0.00846091192215681,
0.04056096822023392,
-0.020837368443608284,
-0.01010679081082344,
0.009018171578645706,
-0.03003656677901745,
-0.021885361522436142,
-0.000059090238210046664,
-0.03498976305127144,
-0.004970581270754337,
-0.015206189826130867,
-0.03197747468948364,
0.011789430864155293,
-0.03945515304803848,
0.0017448377329856157,
0.0405815951526165,
0.01817460171878338,
-0.010993597097694874,
-0.033854223787784576,
-0.03195684030652046,
-0.006722121965140104,
-0.0009361489792354405,
0.018094459548592567,
-0.005096893757581711,
-0.0403495654463768,
0.02594509720802307,
0.04743378236889839,
0.024134617298841476,
-0.057343848049640656,
0.02505585551261902,
0.00715197529643774,
-0.027054954320192337,
-0.00855015218257904,
0.003241780214011669,
-0.03148844838142395,
0.010086583904922009,
-0.014486181549727917,
-0.04550420120358467,
-0.019752908498048782,
-0.007567571476101875,
0.020869269967079163,
-0.01657295413315296,
0.016081741079688072,
0.02081093192100525,
0.004800168797373772,
-0.010268033482134342,
0.03127607703208923,
-0.02555007115006447,
0.040830641984939575,
-0.005934695713222027,
-0.018928339704871178,
-0.03513232246041298,
-0.0011511514894664288,
-0.007165657356381416,
-0.011642624624073505,
-0.00574858533218503,
0.007065705023705959,
-0.059173088520765305,
0.019561726599931717,
0.02059173211455345,
-0.043811798095703125,
0.021872099488973618,
0.032672666013240814,
-0.011592699214816093,
0.0004954853793606162,
-0.01667456328868866,
0.018256552517414093,
0.025528086349368095,
0.006343573797494173,
0.018234431743621826,
0.03404976800084114,
0.022862423211336136,
0.01026514545083046,
-0.00190762581769377,
-0.013140074908733368,
0.035019051283597946,
-0.02761465311050415,
-0.03615731745958328,
0.006322283297777176,
-0.036867402493953705,
0.017287371680140495,
-0.0017292608972638845,
0.022538239136338234,
0.017037898302078247,
0.02492610551416874,
-0.014131328091025352,
0.012765944935381413,
0.04597427323460579,
0.04505665600299835,
-0.012939976528286934,
0.047906294465065,
0.010770064778625965,
0.0073018381372094154,
-0.011200418695807457,
0.013416261412203312,
0.017947375774383545,
0.004120269324630499,
-0.017448095604777336,
0.04496995732188225,
-0.0409402996301651,
-0.0005735030863434076,
0.036943987011909485,
-0.03280705213546753,
-0.01615397073328495,
-0.03365734592080116,
-0.03789995610713959,
0.009011849761009216,
0.04696182534098625,
0.0024811599869281054,
0.024884335696697235,
-0.053020842373371124,
-0.04194045439362526,
-0.007960864342749119,
0.009173894301056862,
0.013186837546527386,
0.05228368937969208,
-0.027150025591254234,
-0.022844437509775162,
-0.01445278711616993,
-0.05497549846768379,
0.03665347769856453,
-0.019857505336403847,
0.05110662803053856,
-0.013216412626206875,
0.019173817709088326,
-0.01217595487833023,
0.008359367959201336,
-0.009979699738323689,
-0.01841091737151146,
-0.0013775263214483857,
-0.03802613914012909,
-0.03128339722752571,
0.012207530438899994,
-0.015821753069758415,
-0.019631169736385345,
0.008732439950108528,
-0.017757117748260498,
0.011189386248588562,
-0.042566824704408646,
-0.014170381240546703,
-0.002368653891608119,
0.056909263134002686,
-0.03143757954239845,
-0.016779692843556404,
0.03335852548480034,
0.012027457356452942,
0.057286232709884644,
-0.009654546156525612,
-0.026530299335718155,
-0.005072144791483879,
0.062316134572029114,
0.05667003616690636,
0.007162424735724926,
-0.038062483072280884,
-0.032949041575193405,
-0.019201919436454773,
-0.015106010250747204,
-0.0161281768232584,
-0.017779365181922913,
0.02059515006840229,
0.0029846802353858948,
-0.02949451096355915,
0.02566383220255375,
-0.033020131289958954,
-0.03482980653643608,
0.004374902229756117,
0.050027698278427124,
-0.0033311601728200912,
-0.009627347812056541,
0.029009250923991203,
-0.010962855070829391,
-0.012621576897799969,
0.0004335832200013101,
-0.026740215718746185,
0.0019127491395920515,
-0.005607861094176769,
0.0013199803652241826,
0.01718788966536522,
0.012776751071214676,
-0.017762742936611176,
-0.03433370217680931,
-0.03284527361392975,
-0.02341606840491295,
0.03413638845086098,
0.010623259469866753,
-0.029740894213318825,
0.012159965932369232,
-0.0018829575274139643,
-0.006808130070567131,
0.007417840883135796,
0.007531036157160997,
0.037727970629930496,
-0.037234827876091,
-0.0064006769098341465,
-0.009584848769009113,
-0.009215058758854866,
0.000591884832829237,
-0.0027163277845829725,
0.02602553367614746,
-0.009707329794764519,
0.008494512178003788,
-0.02080722339451313,
0.03484106808900833,
0.012200812809169292,
0.006268563214689493,
0.04094747081398964,
-0.013329108245670795,
-0.008724328130483627,
-0.010081369429826736,
0.022426042705774307,
0.0007022642530500889,
-0.005496774334460497,
-0.022463571280241013,
-0.040151163935661316,
-0.0011939654359593987,
0.006895735394209623,
-0.010599463246762753,
-0.015743408352136612,
-0.006918123923242092,
-0.04683301970362663,
-0.003006839659065008,
0.010214542038738728,
0.004395221825689077,
-0.01813030056655407,
0.011827731505036354,
-0.00699804350733757,
-0.03384510800242424,
0.018557032570242882,
0.003897783812135458,
-0.0038076876662671566,
-0.005772145930677652,
0.014751742593944073,
0.016196126118302345,
0.03229774907231331,
-0.045060016214847565,
-0.021357329562306404,
0.02788766659796238,
-0.004075051285326481,
-0.014119206927716732,
-0.013484244234859943,
-0.0410129651427269,
-0.029352674260735512,
-0.017562197521328926,
0.01723664440214634,
0.002116343704983592,
-0.011484364978969097,
0.00343841640278697,
0.00932974461466074,
0.02544051967561245,
-0.015719790011644363,
0.018862443044781685,
0.03128074109554291,
0.0009598283795639873,
0.020687587559223175,
-0.004154453054070473,
0.012101389467716217,
0.0024235115852206945,
0.048721812665462494,
-0.007780838757753372,
0.03871618211269379,
-0.003490579081699252,
0.014380287379026413,
-0.022473569959402084,
0.015034488402307034,
-0.030000364407896996,
-0.004200792871415615,
0.010213179513812065,
-0.020970525220036507,
-0.015499942936003208,
0.05525260418653488,
-0.007299923337996006,
-0.01941605843603611,
-0.010984654538333416,
-0.0133637310937047,
-0.01686733216047287,
0.02871367335319519,
0.0101284459233284,
-0.034467291086912155,
0.028518887236714363,
0.02193227969110012,
0.011295195668935776,
-0.04217017814517021,
0.009965525940060616,
0.003994436003267765,
-0.023288367316126823,
0.019154366105794907,
0.028405465185642242,
0.01172707136720419,
-0.025209318846464157,
-0.04394423961639404,
-0.005390002857893705,
-0.050302159041166306,
-0.031239090487360954,
0.026278667151927948,
-0.01374738197773695,
0.00225958158262074,
0.003224816871806979,
-0.01269998773932457,
0.021476080641150475,
0.04010666534304619,
0.006559427361935377,
0.02573232166469097,
0.01918243058025837,
0.049827538430690765,
-0.0004719704738818109,
-0.013868674635887146,
-0.007252775598317385,
-0.014754713512957096,
0.017008375376462936,
0.047097302973270416,
0.00025520502822473645,
0.007929202169179916,
-0.018057910725474358,
-0.002811021637171507,
0.012391005642712116,
0.001778642414137721,
0.026104789227247238,
-0.020842162892222404,
-0.05632494390010834,
-0.040228214114904404,
-0.029659807682037354,
0.002327163005247712,
0.015066558495163918,
-0.0267034862190485,
-0.028493067249655724,
0.003135005244985223,
-0.0056317392736673355,
0.00458859745413065,
-0.0015682390658184886,
-0.02558840438723564,
0.03945966809988022,
-0.0010351344244554639,
0.034531369805336,
-0.01869920827448368,
0.02602206915616989,
0.017567824572324753,
-0.03802625089883804,
0.03177835792303085,
0.023447321727871895,
0.03264840319752693,
0.0021343862172216177,
0.013146758079528809,
0.04431575536727905,
0.019663793966174126,
-0.013796093873679638,
-0.023202745243906975,
0.017275255173444748,
-0.0057318126782774925,
-0.002294866368174553,
-0.003461049171164632,
0.018399644643068314,
0.025271520018577576,
0.0101515743881464,
0.06153387576341629,
-0.009403525851666927,
-0.06255275011062622,
0.003687345189973712,
-0.03990369662642479,
-0.037017013877630234,
0.024721520021557808,
-0.021026799455285072,
-0.0396665520966053,
0.02505655586719513,
-0.009958420880138874,
-0.0027638659812510014,
0.019584598019719124,
-0.019298028200864792,
-0.023546257987618446,
0.011662738397717476,
-0.007010773289948702,
0.035790760070085526,
-0.00983265321701765,
-0.03385553136467934,
-0.025387605652213097,
-0.022346606478095055,
0.012500783428549767,
0.013780828565359116,
0.0011333884904161096,
-0.04784054681658745,
0.016037771478295326,
0.011329006403684616,
-0.0180475115776062,
0.0066431425511837006,
0.035276297479867935,
0.02143285982310772,
0.026548022404313087,
0.03282729908823967,
0.005115462001413107,
-0.03707531839609146,
-0.007576723583042622,
0.011007924564182758,
-0.018122464418411255,
0.010093683376908302,
0.03889267146587372,
0.002814771607518196,
-0.0046353465877473354,
-0.01956254243850708,
0.030609233304858208,
-0.0010702371364459395,
0.04435896873474121,
0.014684425666928291,
-0.009599357843399048,
0.02434219792485237,
-0.036977432668209076,
0.019161859527230263,
-0.028884252533316612,
-0.021231915801763535,
0.0084846755489707,
-0.017962941899895668,
-0.0357062853872776,
0.016092490404844284,
-0.006437336560338736,
0.016886316239833832,
-0.04772617667913437,
0.012792162597179413,
0.006932880263775587,
-0.05190498009324074,
0.004342901986092329,
0.048807527869939804,
-0.021651770919561386,
0.008508601225912571,
-0.015580846928060055,
0.039439525455236435,
-0.042731840163469315,
-0.021091189235448837,
-0.041229646652936935,
0.027287298813462257,
-0.007114002481102943,
-0.04030149430036545,
-0.012125995010137558,
0.04638427868485451,
-0.02212359942495823,
0.022659096866846085,
-0.022307410836219788,
0.005492024123668671,
-0.03434070944786072,
0.037089623510837555,
0.008041154593229294,
-0.14161065220832825,
-0.0197492316365242,
0.031117094680666924,
0.026505986228585243,
-0.0066045429557561874,
-0.02608000487089157,
-0.01072228979319334,
-0.001589432475157082,
-0.031050696969032288,
-0.006728542502969503,
-0.0004809861711692065,
0.02016012743115425,
-0.0009516002028249204,
0.019369211047887802,
0.04681567847728729,
-0.0064072757959365845,
0.05367421358823776,
-0.011193593963980675,
0.005635817535221577,
-0.010944009758532047,
0.007506269495934248,
0.03359626233577728,
-0.007839922793209553,
-0.01536537054926157,
-0.021681565791368484,
0.022353490814566612,
-0.009660771116614342,
-0.005591645836830139,
0.04603487253189087,
-0.01891637034714222,
0.004948974121361971,
0.014218488708138466,
0.00010510942956898361,
0.004866213537752628,
0.02621859684586525,
-0.025835605338215828,
0.021721458062529564,
0.010112874209880829,
0.04008116200566292,
0.025481868535280228,
-0.02865617536008358,
-0.04091576859354973,
0.03103037364780903,
0.002964547835290432,
0.05349130183458328,
-0.0216152872890234,
-0.025778600946068764,
0.03333716094493866,
-0.02085406333208084,
0.050362493842840195,
0.011641142889857292,
-0.008020227774977684,
-0.02093932218849659,
0.03360672667622566,
-0.05291197821497917,
0.06862519681453705,
0.0018236073665320873,
0.024656962603330612,
-0.02765090949833393,
-0.006516464985907078,
0.009186932817101479,
0.03349129483103752,
-0.018120933324098587,
-0.04209422692656517,
-0.017004339024424553,
-0.0273751113563776,
0.02920551225543022,
-0.037028901278972626,
-0.0031041211914271116,
-0.01279495283961296,
0.034508779644966125,
0.03746488690376282,
-0.01333976536989212,
0.04788485914468765,
0.0068559651263058186,
0.03424200788140297,
0.017089171335101128,
0.0005270579713396728,
-0.01934223808348179,
-0.03003476932644844,
0.01872393488883972,
-0.007444056682288647,
0.018836937844753265,
0.021886346861720085,
-0.03035430610179901,
0.004407223779708147,
0.02542547509074211,
-0.04129930958151817,
-0.024002892896533012,
-0.0005750628770329058,
-0.04052112624049187,
-0.009083259850740433,
0.04549659788608551,
-0.024821337312459946,
-0.012925712391734123,
0.0005221626488491893,
0.0033310106955468655,
-0.016927869990468025,
-0.0033026838209480047,
-0.0348326675593853,
-0.025225555524230003,
-0.024347271770238876,
-0.0021013759542256594,
0.04251474142074585,
-0.0004182255652267486,
-0.017200812697410583,
0.02742735855281353,
-0.03687044233083725,
0.03976374864578247,
0.011840644292533398,
-0.05544603615999222,
0.03309808671474457,
-0.005870909430086613,
-0.03019501082599163,
-0.03453543037176132,
-0.01801634579896927,
0.018806660547852516
] |
8a5fbb70b61ec5fc6c7b862f0da3b78b40dc8aa0 | 984 | py | Python | tests/functional/index/create/test_03.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | tests/functional/index/create/test_03.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | tests/functional/index/create/test_03.py | reevespaul/firebird-qa | 98f16f425aa9ab8ee63b86172f959d63a2d76f21 | [
"MIT"
] | null | null | null | #coding:utf-8
#
# id: functional.index.create.03
# title: CREATE ASC INDEX
# decription: CREATE ASC INDEX
#
# Dependencies:
# CREATE DATABASE
# CREATE TABLE
# SHOW INDEX
# tracker_id:
# min_versions: []
# versions: 1.0
# qmid: functional.index.create.create_index_03
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 1.0
# resources: None
substitutions_1 = []
init_script_1 = """CREATE TABLE t( a INTEGER);
commit;"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """CREATE ASC INDEX test ON t(a);
SHOW INDEX test;"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """TEST INDEX ON T(A)"""
@pytest.mark.version('>=1.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_expected_stdout == act_1.clean_stdout
| 23.428571 | 70 | 0.654472 | 1 | 1.0191 | [
0.0005771865835413337,
0.022997474297881126,
0.009241653606295586,
0.0015522426692768931,
0.005175280384719372,
-0.003604710102081299,
-0.010356183163821697,
0.0037858125288039446,
-0.005652878899127245,
0.001992747886106372,
0.0039417133666574955,
0.005185557063668966,
0.005128216929733753,
-0.014794665388762951,
0.0008307922398671508,
0.016491055488586426,
-0.05367264524102211,
0.004824711941182613,
-0.0047393073327839375,
0.0026071718893945217,
-0.010606735944747925,
0.007966571487486362,
0.009953382425010204,
0.0048207868821918964,
0.004709452390670776,
-0.0013204364804551005,
0.008965975604951382,
0.004255842883139849,
-0.00868478324264288,
-0.007377732079476118,
-0.0005325140664353967,
-0.002652269322425127,
-0.009016278199851513,
-0.007700715679675341,
0.007172780577093363,
-0.0030766569543629885,
-0.000926180393435061,
-0.018078135326504707,
0.012562471441924572,
-0.001827648258768022,
-0.004304077476263046,
-0.013988022692501545,
0.00018892665684688836,
0.006258042994886637,
-0.010329888202250004,
0.0004444177611730993,
-0.003674539038911462,
0.0051580448634922504,
-0.010723297484219074,
0.004762414377182722,
-0.008366787806153297,
0.005704592447727919,
0.016576766967773438,
0.0030547124333679676,
-0.0031232803594321012,
-0.00706108333542943,
0.010095275938510895,
0.0012383265420794487,
-0.009387589991092682,
-0.0010937749175354838,
-0.0055607822723686695,
-0.004127657040953636,
0.0042343526147305965,
0.0009068863000720739,
-0.014450358226895332,
-0.008156872354447842,
-0.005385587923228741,
0.002766963327303529,
-0.0013906056992709637,
0.006257284432649612,
0.0018528576474636793,
0.0010129759320989251,
0.006306575145572424,
0.0028396351262927055,
0.0020477839279919863,
-0.004853939171880484,
-0.0016641898546367884,
0.0015960446326062083,
0.006017918232828379,
0.005394562613219023,
0.0058236620388925076,
-0.006156092509627342,
0.004892390687018633,
0.007744136732071638,
0.013066454790532589,
0.006331653334200382,
0.019331373274326324,
-0.012111435644328594,
0.046328745782375336,
0.006408104673027992,
-0.00985079724341631,
0.0021626725792884827,
-0.007417481392621994,
-0.0014073689235374331,
-0.0034381868317723274,
-0.027148880064487457,
-0.0017551399068906903,
-0.0032383790239691734,
-0.00043544956133700907,
0.0026642626617103815,
0.00021006070892326534,
0.008456096984446049,
0.0008280823240056634,
-0.0013234236976131797,
-0.007008494343608618,
0.00858840998262167,
-0.008388831280171871,
-0.002911643125116825,
0.008286431431770325,
0.0028360558208078146,
-0.013780632056295872,
-0.0023879867512732744,
0.002058574929833412,
-0.010708368383347988,
0.005651503335684538,
-0.001875848276540637,
-0.007254254072904587,
0.0519697330892086,
-0.001639784313738346,
0.00026969515602104366,
-0.003931509330868721,
0.001017236732877791,
0.0032557586673647165,
0.007851050235331059,
0.008790332823991776,
-0.0036788410507142544,
0.011785156093537807,
0.009509732015430927,
0.007509488612413406,
0.010912748984992504,
-0.0018057923298329115,
0.009849172085523605,
-0.002877341117709875,
-0.004805088974535465,
0.00151887908577919,
-0.009222786873579025,
0.009201507084071636,
-0.0016136578051373363,
-0.009468380361795425,
0.0000012160477353972965,
-0.00022317536058835685,
-0.008791150525212288,
0.002313893288373947,
-0.004777833819389343,
0.0054784975945949554,
-0.008526574820280075,
-0.003517844947054982,
-0.004668363835662603,
-0.0030012293718755245,
0.0029756142757833004,
0.009784949943423271,
0.004460645839571953,
0.003931601531803608,
-0.005155568942427635,
-0.007531293667852879,
0.00018151162657886744,
-0.004658394493162632,
0.0009903993923217058,
0.007744028698652983,
0.0033396112266927958,
-0.009600884281098843,
-0.0015454021049663424,
0.0024469462223351,
0.0021014513913542032,
-0.0017608830239623785,
0.0019989830907434225,
-0.009656998328864574,
0.005250927060842514,
-0.0024794775526970625,
0.005469697527587414,
0.010671725496649742,
-0.0030593005940318108,
-0.0008897900697775185,
-0.0019272647332400084,
0.0037286316510289907,
-0.0015083679463714361,
0.006691754795610905,
0.00967539194971323,
-0.002784298500046134,
-0.0038897425401955843,
0.0038563094567507505,
0.004710081033408642,
0.009212733246386051,
0.00790818314999342,
-0.0021292874589562416,
0.002415681956335902,
-0.004399789497256279,
-0.0013604951091110706,
0.00547501165419817,
-0.0023087162990123034,
0.006687142886221409,
0.004562905058264732,
-0.01166716031730175,
-0.008410124108195305,
-0.0009841523133218288,
-0.011347118765115738,
0.0015693958848714828,
0.014332731254398823,
0.012007854878902435,
-0.0028326986357569695,
0.004887748975306749,
-0.00777210108935833,
-0.000768942350987345,
0.006832526996731758,
0.00482955202460289,
-0.011521544307470322,
-0.958844006061554,
0.004834560677409172,
0.002613811520859599,
-0.0032799525652080774,
0.003925670869648457,
0.003399261273443699,
0.0014383504167199135,
0.004538255278021097,
0.015199106186628342,
-0.00759750185534358,
-0.006664737593382597,
-0.008283717557787895,
-0.011012410745024681,
-0.0017764238873496652,
-0.006160925608128309,
-0.0026984564028680325,
-0.009113575331866741,
-0.00781225273385644,
-0.00344519829377532,
-0.003489046124741435,
-0.001929549383930862,
0.008833615109324455,
-0.002369699999690056,
0.0030809114687144756,
0.001188373425975442,
0.0034057782031595707,
-0.007867228239774704,
-0.002681662095710635,
-0.004106647800654173,
-0.002829516539350152,
-0.00657462514936924,
-0.01358927320688963,
-0.005825907923281193,
-0.00010069517156807706,
0.0097960839048028,
-0.000335084943799302,
0.009056143462657928,
-0.00461307168006897,
0.0016910990234464407,
-0.007423122879117727,
0.006586886942386627,
-0.001642354647628963,
0.0039037587121129036,
-0.03014768660068512,
-0.0034942335914820433,
-0.0032313810661435127,
-0.0066768331453204155,
0.008483091369271278,
-0.001020569703541696,
-0.0007436952437274158,
-0.004364206921309233,
-0.00540311262011528,
0.007979270070791245,
-0.01028734352439642,
0.001195129007101059,
-0.004117622505873442,
-0.0073171681724488735,
-0.0023847471456974745,
-0.01100385095924139,
0.0025827083736658096,
0.002804717281833291,
-0.002492859261110425,
-0.0038842561189085245,
-0.0024322737008333206,
0.003883563680574298,
0.0030052494257688522,
0.00211735931225121,
-0.015714330598711967,
-0.005292159505188465,
0.0007174017373472452,
0.0010587493889033794,
-0.003698938060551882,
-0.004443498328328133,
0.0018314272165298462,
-0.009152280166745186,
0.005449507851153612,
0.0035130588803440332,
0.0016068759141489863,
-0.008549719117581844,
-0.0001771023089531809,
-0.00999784842133522,
-0.010083886794745922,
0.002446067286655307,
-0.004276823252439499,
-0.0035154521465301514,
-0.0015296651981770992,
-0.0007151046302169561,
0.0062166908755898476,
-0.0045510632917284966,
0.004235269967466593,
0.012250936590135098,
-0.0033540120348334312,
-0.008967344649136066,
0.007027473300695419,
0.007504105102270842,
0.0009619630873203278,
-0.003022161778062582,
0.0016627608565613627,
0.009417624212801456,
0.007077556569129229,
0.003037641290575266,
0.005180320702493191,
-0.001590966945514083,
0.0076984381303191185,
-0.0005659406306222081,
-0.0008779897470958531,
-0.003035909030586481,
-0.0006259792717173696,
-0.0028183897957205772,
-0.00148947408888489,
-0.004559807945042849,
-0.0012151928385719657,
-0.011142066679894924,
-0.007873862981796265,
-0.0005972445942461491,
-0.0014006748097017407,
0.004112564027309418,
-0.0028767294716089964,
0.0015472848899662495,
0.0010626902803778648,
0.008313334546983242,
0.00064333580667153,
-0.001088508521206677,
-0.0003602854267228395,
0.0011671335669234395,
-0.004578875843435526,
0.013291355222463608,
-0.010769476182758808,
0.0068253143690526485,
-0.0017753251595422626,
-0.013143136166036129,
0.010580841451883316,
0.011899982579052448,
-0.008475428447127342,
0.00040815601823851466,
0.002949405461549759,
0.0040627229027450085,
0.0022024766076356173,
-0.005347555037587881,
-0.002851968863978982,
-0.018123436719179153,
0.00010341854795115069,
0.019149964675307274,
-0.000021545942217926495,
0.010562004521489143,
0.012254912406206131,
-0.0029381595086306334,
0.0011808160925284028,
0.008015942759811878,
0.003089589299634099,
0.011861579492688179,
-0.010279909707605839,
-0.0003896390844602138,
0.0030632431153208017,
-0.008363884873688221,
0.0028049685060977936,
0.004866063594818115,
0.005204437766224146,
-0.004468504339456558,
0.002855314640328288,
-0.010886773467063904,
-0.004957996308803558,
-0.020040318369865417,
-0.0024136279243975878,
0.003162272507324815,
-0.005706815514713526,
0.007988513447344303,
-0.014576276764273643,
0.0009579734760336578,
0.005604136269539595,
0.0036158282309770584,
-0.0007855748990550637,
0.00023441911616828293,
0.0024233818985521793,
0.013317503966391087,
-0.00508836330845952,
0.004340621177107096,
0.001971587771549821,
-0.00310774939134717,
0.001532677561044693,
0.010725780390202999,
-0.006504556629806757,
-0.0050118654035031796,
0.003360852599143982,
0.0055688172578811646,
-0.00026482122484594584,
-0.0009318806696683168,
-0.007499635219573975,
-0.003814985044300556,
0.0018323302501812577,
-0.005341086070984602,
0.004067957866936922,
-0.0020339328330010176,
0.005277286283671856,
-0.005311600398272276,
-0.0024002944119274616,
-0.0034874905832111835,
-0.012830596417188644,
0.008511143736541271,
-0.003707455238327384,
0.0008754184818826616,
0.013701760210096836,
0.0034794716630131006,
-0.014067023992538452,
0.004677850753068924,
0.011767956428229809,
-0.003099753288552165,
0.0032986123114824295,
0.006805651355534792,
-0.0059895929880440235,
-0.0213219802826643,
-0.0006031320663169026,
-0.014835814945399761,
0.006436839234083891,
-0.0003611123829614371,
-0.000006606269380426966,
-0.007249055430293083,
0.007539425045251846,
0.005468289367854595,
-0.012127747759222984,
-0.005050409119576216,
-0.008366885595023632,
0.010690901428461075,
-0.00012991677795071155,
-0.001777090597897768,
-0.00633040489628911,
-0.0009862532606348395,
-0.0027376855723559856,
-0.003499669721350074,
-0.0007011370616964996,
0.004387962631881237,
0.0019350238144397736,
-0.00025494361761957407,
0.0002320682688150555,
-0.006138161290436983,
0.002459116280078888,
0.0021638672333210707,
-0.01239329669624567,
0.0008642367320135236,
0.004573868587613106,
0.0008055156795307994,
-0.002859357977285981,
0.0008505800506100059,
-0.0029554201755672693,
-0.007175265811383724,
-0.012947292998433113,
-0.0032347592059522867,
-0.006102131213992834,
-0.0019012471893802285,
-0.011175721883773804,
-0.001454175217077136,
-0.005548588000237942,
0.005138897802680731,
-0.00806331168860197,
0.00540552893653512,
0.004101903643459082,
-0.006387121044099331,
0.005779188591986895,
-0.0025592241436243057,
0.003950285725295544,
0.0041365837678313255,
0.0035500614903867245,
0.0009345354046672583,
-0.005815600976347923,
-0.01115304697304964,
0.011297679506242275,
-0.010813604108989239,
0.0002282206987729296,
0.014186820015311241,
0.0037198064383119345,
0.008359245024621487,
-0.00047583976993337274,
-0.0016657828819006681,
0.0018389312317594886,
0.010508925653994083,
-0.013285829685628414,
0.003292870009317994,
-0.0027816458605229855,
-0.00201101484708488,
0.004596712067723274,
-0.0030869292095303535,
0.0012425881577655673,
0.007265821099281311,
0.0018497179262340069,
-0.007079320028424263,
-0.0057133277878165245,
0.0026613157242536545,
0.0027132888790220022,
-0.01276390440762043,
0.0003456829581409693,
-0.0026722170878201723,
-0.0034515936858952045,
-0.0019824118353426456,
0.0029347497038543224,
-0.001659038825891912,
0.0030918088741600513,
0.000033040763810276985,
0.0045530726201832294,
0.004153462126851082,
-0.004770589526742697,
0.015217628329992294,
-0.007630207575857639,
-0.005930494517087936,
0.0038250498473644257,
-0.0004034621233586222,
-0.0020429331343621016,
-0.007125282660126686,
-0.0022414710838347673,
0.0027951104566454887,
0.006538957357406616,
-0.0015238836640492082,
-0.0066428156569600105,
-0.0012767564039677382,
0.0024556294083595276,
-0.007133261766284704,
0.0034004542976617813,
0.01009846106171608,
-0.004827361553907394,
0.006085059605538845,
-0.0026600139681249857,
-0.005973587743937969,
-0.01075307559221983,
0.05488012731075287,
-0.0012400912819430232,
0.004288299474865198,
0.0038386033847928047,
-0.007718932814896107,
0.0010389542439952493,
-0.0036432486958801746,
0.007796107791364193,
-0.007597649469971657,
-0.004930434282869101,
0.008362678810954094,
-0.004246745258569717,
0.0037883745972067118,
0.0033951487857848406,
-0.0006135945441201329,
0.015534451231360435,
-0.0024333216715604067,
-0.01673448458313942,
-0.016290796920657158,
0.005157316569238901,
-0.004548432305455208,
-0.005652562249451876,
0.007182607892900705,
-0.003731832839548588,
-0.004623633809387684,
0.0008343166555278003,
0.0048098149709403515,
0.000588607566896826,
-0.0007283859304152429,
-0.001814655726775527,
-0.0032744561322033405,
-0.00019920425256714225,
0.0022147337440401316,
0.006760300137102604,
0.0061670211143791676,
-0.003236715216189623,
0.0036658556200563908,
-0.001052860519848764,
-0.0010071898577734828,
0.0007828736561350524,
0.005872678477317095,
0.005081223789602518,
-0.0008230166858993471,
-0.0004765127378050238,
0.007816427387297153,
0.005207565613090992,
-0.00015340927348006517,
0.013290618546307087,
0.000732815358787775,
-0.005586775951087475,
0.007486324291676283,
0.011505451053380966,
0.0003499190788716078,
0.0056672911159694195,
-0.00014129152987152338,
0.006648558657616377,
0.0028899761382490396,
-0.00816164817661047,
-0.01441726740449667,
-0.00026710587553679943,
0.005884918384253979,
0.01017073169350624,
-0.0010455475421622396,
0.0021212848369032145,
-0.0014370674034580588,
-0.004155195318162441,
-0.008953415788710117,
-0.005214297212660313,
-0.00047611925401724875,
0.0005570639623329043,
0.0030158567242324352,
0.06729600578546524,
-0.007541712839156389,
0.0009349362226203084,
-0.00922366976737976,
-0.0032970006577670574,
-0.001644634990952909,
-0.001071955543011427,
0.00042129153735004365,
0.0011352917645126581,
0.0018704216927289963,
0.001641717622987926,
-0.00578548526391387,
-0.010898265056312084,
0.0009348917519673705,
0.00558182317763567,
-0.002934626769274473,
0.005184222478419542,
0.0049332487396895885,
-0.008330227807164192,
0.0010772234527394176,
-0.012123593129217625,
-0.0023993777576833963,
-0.000007857984201109502,
-0.008870820514857769,
-0.0047455597668886185,
-0.00010601225221762434,
0.005048442166298628,
0.0031024187337607145,
0.006529682315886021,
-0.001678604632616043,
0.007581316400319338,
-0.0028514282312244177,
-0.0017363125225529075,
-0.006574581377208233,
-0.0011547593167051673,
-0.0023613302037119865,
0.006602820474654436,
0.0009020576835609972,
-0.010387914255261421,
-0.006879002321511507,
-0.002032160758972168,
-0.0007219997351057827,
-0.006122273858636618,
0.0027875807136297226,
0.0038316601421684027,
0.003738721366971731,
-0.0025097657926380634,
0.0017024989938363433,
-0.004723382648080587,
0.002002946799620986,
-0.010992980562150478,
0.005475647281855345,
-0.1751558482646942,
0.009889688342809677,
0.00505710719153285,
-0.004708262626081705,
-0.004696819465607405,
-0.015249659307301044,
-0.002367256674915552,
0.0034218153450638056,
0.010732574388384819,
0.0023996192030608654,
-0.0014406724367290735,
-0.0004575389320962131,
0.005063585937023163,
0.0027559902518987656,
-0.0030257601756602526,
-0.0016418626764789224,
0.0031240941025316715,
-0.003948539029806852,
0.0006837343098595738,
0.004003658425062895,
0.0038576480001211166,
0.009463317692279816,
0.0014793871669098735,
0.0010916006285697222,
-0.002963766222819686,
-0.008078842423856258,
0.0060726613737642765,
0.0003134737489745021,
0.005295241251587868,
-0.01505044661462307,
-0.0035508093424141407,
-0.0018117973813787103,
-0.0035184763837605715,
-0.0006324221612885594,
0.003330656560137868,
-0.0012143341591581702,
0.007725960109382868,
0.002077343175187707,
-0.006253257393836975,
0.006480187177658081,
-0.006236578803509474,
0.028544647619128227,
0.006080622784793377,
0.005725961644202471,
-0.0024872764479368925,
-0.005871383938938379,
-0.004613736178725958,
0.008200429379940033,
0.0024127517826855183,
0.012173013761639595,
-0.010171876288950443,
0.000854968442581594,
0.005235821008682251,
0.016856031492352486,
-0.005916214548051357,
-0.009855184704065323,
-0.007315790746361017,
-0.0030074557289481163,
0.0028071545530110598,
0.0067504835315048695,
0.011144357733428478,
-0.006785429082810879,
0.008209986612200737,
-0.0020632087253034115,
-0.01901664026081562,
0.0040736207738518715,
-0.004542562644928694,
-0.006944631226360798,
0.003436855273321271,
0.007164396345615387,
0.010990295559167862,
-0.002197735011577606,
0.005068379454314709,
-0.002066242741420865,
0.005475954618304968,
0.0005986095638945699,
0.006768037565052509,
-0.003637864487245679,
0.005792646668851376,
-0.008395305834710598,
0.0075269583612680435,
-0.008548801764845848,
-0.003193892305716872,
0.002187940990552306,
-0.005015387199819088,
0.012413743883371353,
0.005637092515826225,
-0.003867320017889142,
-0.0018330010352656245,
-0.011948729865252972,
-0.004370712209492922,
0.00459848390892148,
0.0029805691447108984,
-0.009983140975236893,
0.00438597472384572,
-0.0027554058469831944,
0.006947314366698265,
0.0072714644484221935,
-0.009668690152466297,
0.005632592365145683,
0.00552136218175292,
-0.002587387105450034,
0.0006626314716413617,
-0.0032620737329125404,
0.002317987848073244,
0.002542668953537941,
-0.0058816345408558846,
-0.006756849121302366,
0.004436671268194914,
-0.008078076876699924,
-0.0021412584464997053,
0.007270790170878172,
-0.011337123811244965,
-0.007387122604995966,
-0.002954533090814948,
-0.011155441403388977,
-0.0005031548207625747
] |
8a6044d55abd530531d11b4f87fb12061cb65199 | 370 | py | Python | app/logic/httpcommon/Page.py | imvu/bluesteel | ab52133249a693b3cd2d8593c5d47408a3b0fce6 | [
"MIT"
] | 10 | 2017-01-13T06:28:04.000Z | 2020-11-18T13:00:26.000Z | app/logic/httpcommon/Page.py | imvu/bluesteel | ab52133249a693b3cd2d8593c5d47408a3b0fce6 | [
"MIT"
] | null | null | null | app/logic/httpcommon/Page.py | imvu/bluesteel | ab52133249a693b3cd2d8593c5d47408a3b0fce6 | [
"MIT"
] | 2 | 2018-03-29T14:10:53.000Z | 2019-11-20T08:21:57.000Z | """ Page object file """
class Page():
""" Page object, it contains information about the pare we are refering, index, items per page, etc. """
page_index = 0
items_per_page = 0
def __init__(self, items_per_page, page_index):
""" Creates the page """
self.page_index = int(page_index)
self.items_per_page = int(items_per_page)
| 28.461538 | 108 | 0.648649 | 1 | 0.7521 | [
0.0008768747793510556,
0.027462393045425415,
0.007665799930691719,
0.0011902755359187722,
0.005833093076944351,
-0.004548182245343924,
-0.012526582926511765,
0.0055318293161690235,
-0.008127184584736824,
0.0018536841962486506,
0.0029362877830863,
0.004100861493498087,
0.00830637477338314,
-0.018729232251644135,
0.0016961286310106516,
0.01562994159758091,
-0.05396423116326332,
0.002451501786708832,
-0.005713331513106823,
0.0006461185985244811,
-0.009179608896374702,
0.012483376078307629,
0.008734160102903843,
0.007940907962620258,
0.006360686384141445,
0.0010347856441512704,
0.008087670430541039,
0.00484934588894248,
-0.007109406869858503,
-0.0029810990672558546,
-0.001329955062828958,
-0.001115249702706933,
-0.0026167677715420723,
-0.008618153631687164,
0.00690168933942914,
-0.003618770744651556,
-0.00020250293891876936,
-0.022827323526144028,
0.01068789605051279,
-0.004136116709560156,
-0.00846716295927763,
-0.01871662028133869,
-0.002956107258796692,
0.00291874585673213,
-0.012330672703683376,
0.0022342402953654528,
-0.004628472961485386,
0.006518742069602013,
-0.010514729656279087,
0.004440546967089176,
-0.008280186913907528,
0.0053535280749201775,
0.012761842459440231,
0.0008463782141916454,
-0.0077333105728030205,
-0.008690973743796349,
0.013075176626443863,
0.0014847938437014818,
-0.01338411308825016,
0.0020853939931839705,
-0.005736697465181351,
-0.005987337790429592,
0.003233938245102763,
0.0017389693530276418,
-0.021738359704613686,
-0.005491290241479874,
-0.005593089386820793,
0.0010767497587949038,
0.0009158082539215684,
0.003986785188317299,
0.0025768002960830927,
-0.0013518473133444786,
0.008951104246079922,
0.003695559687912464,
0.0016485498053953052,
-0.0026166439056396484,
-0.001111984602175653,
0.003721284680068493,
0.007752588950097561,
0.003479108912870288,
0.0049399519339203835,
-0.007846934720873833,
0.0064174216240644455,
0.011946375481784344,
0.008622942492365837,
0.008667672984302044,
0.01685865968465805,
-0.012623244896531105,
0.04314335063099861,
0.00678962143138051,
-0.010944608598947525,
0.0013722326839342713,
-0.006960713304579258,
-0.002955018077045679,
-0.00224242708645761,
-0.032027848064899445,
-0.0011580842547118664,
-0.004762748721987009,
0.0002888350572902709,
0.005571827758103609,
0.00003175446545355953,
0.007874230854213238,
-0.0025706617161631584,
-0.002372539835050702,
-0.013526331633329391,
0.016471784561872482,
-0.008919265121221542,
-0.002164470264688134,
0.007886266335844994,
-0.00015302401152439415,
-0.013242555782198906,
-0.0011723542120307684,
0.0004984132247045636,
-0.011160455644130707,
0.003840156365185976,
-0.002173281041905284,
-0.006538815796375275,
0.05746307596564293,
-0.0021966113708913326,
0.0005300556658767164,
-0.004251968581229448,
0.00010439297329867259,
-0.0008523220312781632,
0.006653614807873964,
0.009443987160921097,
-0.005529358517378569,
0.011974815279245377,
0.005093148443847895,
0.004830246325582266,
0.007705113384872675,
-0.001963504822924733,
0.008172026835381985,
-0.0018419150728732347,
-0.000774199899751693,
0.0011553330114111304,
-0.008195120841264725,
0.007454852107912302,
-0.00203491048887372,
-0.0035652786027640104,
0.0027209841646254063,
-0.0036713313311338425,
-0.013989275321364403,
0.0006842519505880773,
-0.0009881985606625676,
0.00016999465879052877,
-0.012076940387487411,
-0.0036247950047254562,
-0.0029926516581326723,
-0.004905424080789089,
0.0037568332627415657,
0.010758447460830212,
0.005687744822353125,
0.003533909795805812,
-0.007471431512385607,
-0.006613980513066053,
-0.0002735596790444106,
-0.005546769592911005,
0.0011774471495300531,
0.010557197965681553,
0.004399983678013086,
-0.009770936332643032,
-0.004525777883827686,
0.004934745375066996,
0.0033396489452570677,
-0.0019523443188518286,
0.003550240071490407,
-0.006550594232976437,
0.009091570973396301,
-0.00018914148677140474,
0.0057395040057599545,
0.011201195418834686,
-0.004910690244287252,
0.00017462566029280424,
-0.0017406968399882317,
0.005200460087507963,
-0.000028892542104586028,
0.004493796266615391,
0.007291078567504883,
-0.005012235138565302,
-0.00627105450257659,
0.005698571912944317,
0.0021799211390316486,
0.009660654701292515,
0.007176102139055729,
-0.002260341076180339,
0.00451056519523263,
-0.003522708546370268,
-0.00018687811098061502,
0.005388306453824043,
-0.0044928910210728645,
0.007187202572822571,
0.006033896468579769,
-0.015719423070549965,
-0.007279547862708569,
-0.0009345716098323464,
-0.010699509643018246,
0.0004441607161425054,
0.019436191767454147,
0.010485626757144928,
-0.0026699290610849857,
0.003988699987530708,
-0.011467781849205494,
0.0012600269401445985,
0.008012508973479271,
0.001112323603592813,
-0.010399547405540943,
-0.9527982473373413,
0.0037990494165569544,
0.003379435045644641,
0.0012303697876632214,
0.00503773707896471,
0.0026952403131872416,
0.0019250428304076195,
0.00622603390365839,
0.016067754477262497,
-0.008565676398575306,
-0.0074766287580132484,
-0.0117155397310853,
-0.014066843315958977,
-0.00017760740593075752,
-0.007427623961120844,
-0.003177595790475607,
-0.006728057283908129,
-0.00863636378198862,
-0.0022483067587018013,
-0.005448620766401291,
-0.001296142814680934,
0.010141897015273571,
-0.000034494900319259614,
0.004897300153970718,
0.0034162960946559906,
0.005513131618499756,
-0.005594221875071526,
-0.0011436741333454847,
0.0017040802631527185,
-0.0003477982245385647,
-0.006584996357560158,
-0.012565557844936848,
-0.0062992023304104805,
0.0010853847488760948,
0.01178005151450634,
0.0009370232000946999,
0.008992602117359638,
-0.0011731201084330678,
0.0026417868211865425,
-0.011478235013782978,
0.0037662156391888857,
0.0026387807447463274,
0.0020182104781270027,
-0.029198380187153816,
0.0023115312214940786,
-0.0002232403348898515,
-0.009203608147799969,
0.011198286898434162,
0.0018985033966600895,
0.0005147438496351242,
-0.004041661508381367,
-0.004073651507496834,
0.01036127470433712,
-0.008449198678135872,
0.004633843433111906,
-0.006422807928174734,
-0.00659110676497221,
-0.002737704198807478,
-0.011508473195135593,
0.0003076702996622771,
0.00318570202216506,
-0.0013121821684762836,
-0.0019282220164313912,
-0.004271967336535454,
0.004222599323838949,
0.0028341151773929596,
0.002534812316298485,
-0.02080920711159706,
-0.007629415486007929,
0.003730613039806485,
0.0014946700539439917,
0.000670929963234812,
-0.005179987754672766,
0.0033941874280571938,
-0.012292030267417431,
0.006919766776263714,
0.0024260012432932854,
0.003312027081847191,
-0.011258939281105995,
0.002653895877301693,
-0.006985520478338003,
-0.010821545496582985,
0.0021645885426551104,
-0.006619755644351244,
-0.004460066091269255,
0.0032564839348196983,
0.004204274620860815,
0.007197132334113121,
-0.007338986732065678,
0.004321985878050327,
0.010895025916397572,
-0.0023278146982192993,
-0.01059709582477808,
0.01019571628421545,
0.009147508069872856,
0.003266170620918274,
-0.0002976744726765901,
0.0032547193113714457,
0.011679679155349731,
0.007886598818004131,
-0.00017321566701866686,
0.0029351108241826296,
0.00031551613938063383,
0.008903743699193,
0.00010179646778851748,
0.0041193305514752865,
-0.00453557213768363,
0.00017891138850245625,
-0.003776440629735589,
-0.003138914704322815,
-0.00469916732981801,
-0.001530387788079679,
-0.011651529930531979,
-0.00884375348687172,
-0.006254884880036116,
0.003647984005510807,
0.0017965319566428661,
-0.00557686248794198,
0.00008083433931460604,
0.0021767523139715195,
0.00797372218221426,
-0.0010006107622757554,
-0.005898820236325264,
0.00005949658952886239,
0.0031971547286957502,
-0.01030461024492979,
0.016472849994897842,
-0.011564618907868862,
0.00846718717366457,
-0.00017197540728375316,
-0.01847064681351185,
0.007860928773880005,
0.01173008605837822,
-0.0065068649128079414,
0.002515357220545411,
-0.0013075704919174314,
0.002536352025344968,
-0.0007906201644800603,
-0.0052571543492376804,
-0.0049821664579212666,
-0.017423491925001144,
0.0002566858602222055,
0.02208499237895012,
0.002379779936745763,
0.009402158670127392,
0.011847738176584244,
-0.004965873435139656,
0.0029328488744795322,
0.007780018728226423,
0.0039231968112289906,
0.015072045847773552,
-0.007387478835880756,
0.0005416732747107744,
0.001196939148940146,
-0.005626878701150417,
0.002194168046116829,
0.003145413938909769,
0.0029484208207577467,
-0.0029026775155216455,
0.0017726286314427853,
-0.007564773317426443,
-0.00911706406623125,
-0.018504315987229347,
-0.0028599249199032784,
0.012214245274662971,
-0.004436091985553503,
0.0038267164491117,
-0.009326638653874397,
0.0068847788497805595,
0.006534942891448736,
0.004057415761053562,
0.0007221348350867629,
0.0016395259881392121,
0.00777442054823041,
0.01172526367008686,
-0.0049612196162343025,
0.0031111068092286587,
0.001627899706363678,
-0.0005938922404311597,
0.0032503842376172543,
0.008041239343583584,
-0.008479753509163857,
-0.004195131361484528,
0.004090306349098682,
0.002881487598642707,
-1.9649952776035207e-7,
-0.004219887312501669,
-0.010276317596435547,
-0.005470058880746365,
0.004324152134358883,
-0.008106186985969543,
0.004022635985165834,
0.002617874415591359,
0.0032164244912564754,
-0.010341806337237358,
-0.0011632482055574656,
-0.005008423700928688,
-0.01023782230913639,
0.010849928483366966,
-0.0009578508324921131,
0.0029273824766278267,
0.01230520848184824,
0.004664468113332987,
-0.013417375274002552,
0.007823435589671135,
0.007380027323961258,
-0.006959951017051935,
0.005427341442555189,
0.004234951920807362,
-0.0063434685580432415,
-0.022495238110423088,
-0.0002922529529314488,
-0.014234037138521671,
0.006142048630863428,
-0.0016743048327043653,
0.0045472304336726665,
-0.009067561477422714,
0.00609439006075263,
0.005238063167780638,
-0.01345216017216444,
-0.00393437035381794,
-0.008410497568547726,
0.010111678391695023,
-0.0020107761956751347,
-0.004642603453248739,
-0.006801452487707138,
-0.0004414392460603267,
-0.002655428135767579,
-0.0023418618366122246,
-0.0011478363303467631,
0.003994085360318422,
0.00318289827555418,
-0.00485910614952445,
0.001107127289287746,
-0.0018955075647681952,
-0.001415787497535348,
0.005423771683126688,
-0.010443734005093575,
-0.0018846256425604224,
0.005328433122485876,
-0.0011933932546526194,
-0.0033145209308713675,
-0.001651893719099462,
-0.00001310507650487125,
-0.007899900898337364,
-0.011181452311575413,
-0.004237844608724117,
-0.005361375864595175,
-0.0061174421571195126,
-0.010323562659323215,
-0.0028901470359414816,
-0.010140751488506794,
0.006765996105968952,
-0.006933598313480616,
0.007496269885450602,
0.0074549284763634205,
-0.004955388605594635,
0.010209075175225735,
-0.00015066236665006727,
0.003331410000100732,
0.0052900672890245914,
0.006003510672599077,
-0.00009313837654190138,
-0.004854321945458651,
-0.00843750685453415,
0.01537481788545847,
-0.009582353755831718,
-0.0006728066364303231,
0.015789968892931938,
0.004825119860470295,
0.010879898443818092,
0.0018188535468652844,
-0.0023396785836666822,
0.0018723555840551853,
0.008236819878220558,
-0.014895741827785969,
0.002745521953329444,
-0.0034639432560652494,
-0.00296774017624557,
0.00892352033406496,
-0.006049884483218193,
0.0008570983773097396,
0.007863225415349007,
0.0010505218524485826,
-0.00786292739212513,
-0.0030291930306702852,
-0.001940065179951489,
0.004072720650583506,
-0.012483486905694008,
-0.002555647399276495,
-0.005355727858841419,
-0.004941919352859259,
-0.003039124421775341,
-0.0011145821772515774,
0.0005275643197819591,
0.004635498858988285,
-0.003295582253485918,
0.007378010544925928,
0.001396662904880941,
-0.0031051170080900192,
0.016141841188073158,
-0.005340746138244867,
-0.006756954826414585,
0.005702040158212185,
0.00029946741415187716,
-0.000486414588522166,
-0.00737556628882885,
-0.0021689890418201685,
0.0017173558007925749,
0.0041941143572330475,
-0.0023442290257662535,
-0.008987381123006344,
-0.00260272528976202,
-0.0014982232823967934,
-0.00771986274048686,
0.0007531167939305305,
0.010785232298076153,
-0.0004570640157908201,
0.0033495784737169743,
-0.0012788795866072178,
-0.006075876299291849,
-0.019006799906492233,
0.05698760971426964,
-0.0021632793359458447,
0.004758868832141161,
0.006353992037475109,
-0.008122716099023819,
-0.0022822245955467224,
-0.0033229829277843237,
0.006952399387955666,
-0.0063860476948320866,
-0.008311732672154903,
0.009987636469304562,
-0.00302524515427649,
0.0015718875220045447,
0.0026311699766665697,
-0.0010438193567097187,
0.01708170957863331,
-0.005781269166618586,
-0.017131272703409195,
-0.014998228289186954,
0.007617427036166191,
-0.003191617550328374,
-0.009257065132260323,
0.006118877325206995,
-0.00397209357470274,
-0.00311464536935091,
0.0029660293366760015,
0.007502422202378511,
-0.002436561044305563,
-0.0002663186169229448,
-0.0016729027265682817,
-0.0017239953158423305,
0.0005429566954262555,
0.0036481295246630907,
0.0049959588795900345,
0.008260516449809074,
-0.0019532269798219204,
0.0067604645155370235,
-0.0009156165760941803,
-0.002691441448405385,
0.00045952535583637655,
0.007720728404819965,
0.0068004499189555645,
-0.0017813784070312977,
-0.0021520412992686033,
0.002931988798081875,
0.006347874645143747,
0.0016148650320246816,
0.015131855383515358,
-0.0007168111042119563,
-0.004098136443644762,
0.00870636198669672,
0.010404440574347973,
-0.0014036757638677955,
0.00895184651017189,
-0.001686996198259294,
0.004652330651879311,
0.003101376350969076,
-0.008229581639170647,
-0.012091370299458504,
0.0027870626654475927,
0.0065047526732087135,
0.008920152671635151,
-0.0029770720284432173,
0.003645313670858741,
-0.003951944410800934,
-0.0028257155790925026,
-0.008850835263729095,
-0.009004947729408741,
-0.005061169620603323,
0.0004660242120735347,
0.004758879542350769,
0.07193326950073242,
-0.00721895694732666,
-0.003926812671124935,
-0.011993694119155407,
-0.0006476740236394107,
0.000028242036933079362,
-0.00012564240023493767,
-0.00016685340960975736,
-0.0018146157963201404,
0.005908990278840065,
0.003281872719526291,
-0.008164712227880955,
-0.011413762345910072,
-0.00008894543861970305,
0.002356705954298377,
-0.00032161956187337637,
0.004980449564754963,
0.004165919031947851,
-0.009471317753195763,
0.0028526820242404938,
-0.012926945462822914,
-0.001676060725003481,
-0.003229048103094101,
-0.007901960983872414,
-0.0019239867106080055,
-0.004209947306662798,
0.0023161075077950954,
0.005893119145184755,
0.007644145283848047,
-0.005624156445264816,
0.006137089338153601,
-0.0017580128042027354,
0.0014429984148591757,
-0.00274614873342216,
0.00153293926268816,
-0.004378299694508314,
0.0071181245148181915,
0.0005386626580730081,
-0.012949645519256592,
-0.005171517841517925,
-0.0034952149726450443,
-0.0014220238663256168,
-0.006621936801820993,
0.006904278881847858,
0.0007642153650522232,
0.010130414739251137,
-0.0054418244399130344,
0.0028018723241984844,
-0.006959090009331703,
0.0036902157589793205,
-0.012546127662062645,
0.0014874672051519156,
-0.1870645135641098,
0.008367846719920635,
0.0028762167785316706,
-0.006936077959835529,
-0.0037322225980460644,
-0.015569964423775673,
-0.009317433461546898,
0.003368077101185918,
0.009143740870058537,
0.0015434307279065251,
0.00288457702845335,
-0.0012523948680609465,
0.0022004565689712763,
0.006053546443581581,
-0.001444104709662497,
-0.006689137313514948,
0.004641405306756496,
-0.007218065205961466,
-0.0002769077545963228,
0.006546861492097378,
0.00734483590349555,
0.010782481171190739,
0.002295344602316618,
0.0014271280961111188,
0.0016392768593505025,
-0.002044758992269635,
0.0045518637634813786,
-0.0036978484131395817,
0.006684330757707357,
-0.011169050820171833,
-0.005228166002780199,
-0.0026389043778181076,
-0.005095907486975193,
0.00384720740839839,
0.0040791393257677555,
-0.0005845259292982519,
0.0059648798778653145,
0.00014146669127512723,
-0.007396482862532139,
0.009150869213044643,
-0.007798926439136267,
0.028974471613764763,
0.005352606065571308,
0.007870722562074661,
0.0008550622733309865,
-0.0031769077759236097,
-0.0033822115510702133,
0.008486075326800346,
0.0029474564362317324,
0.014910977333784103,
-0.013492446392774582,
-0.005069976206868887,
0.0007196703809313476,
0.018189791589975357,
-0.00614292873069644,
-0.008548768237233162,
-0.006318547297269106,
-0.006757043302059174,
0.005377695895731449,
0.010420054197311401,
0.01051901001483202,
-0.006200520787388086,
0.008382955566048622,
-0.00268294895067811,
-0.022538304328918457,
0.001849780441261828,
-0.0023565609008073807,
-0.00727661419659853,
-0.00009939997107721865,
0.003854556242004037,
0.010523060336709023,
-0.00379925942979753,
0.00483642378821969,
-0.0007690823986195028,
0.00442290585488081,
-0.0018736993661150336,
0.00820296909660101,
-0.003617594251409173,
0.007060868199914694,
-0.009962539188563824,
0.012592614628374577,
-0.009516914375126362,
-0.0013621305115520954,
0.003689400851726532,
-0.005442972294986248,
0.012024038471281528,
0.005808596033602953,
-0.002828188007697463,
0.0002512785722501576,
-0.01480715349316597,
0.0008772147120907903,
0.0018401892157271504,
0.003932410851120949,
-0.004652007017284632,
0.0036831567995250225,
-0.004410090856254101,
0.00579552398994565,
0.008853782899677753,
-0.008017112500965595,
0.007039157208055258,
0.0023976380471140146,
-0.007128335069864988,
0.0009229418355971575,
-0.007422406226396561,
0.002851642668247223,
0.007747366558760405,
-0.011706467717885971,
-0.009858009405434132,
0.004268016666173935,
-0.004979533143341541,
-0.005693249870091677,
0.00609979871660471,
-0.010360176675021648,
-0.0076286871917545795,
0.00016672983474563807,
-0.011975043453276157,
0.0024811134207993746
] |
8a60852354e6415290eaf2e5371028a21ee46376 | 1,004 | py | Python | models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/PyTorch/pt_personreid-res18_market1501_176_80_1.1G_1.3/code/core/data_manager.py | guochunhe/Vitis-AI | e86b6efae11f8703ee647e4a99004dc980b84989 | [
"Apache-2.0"
] | 1 | 2020-12-18T14:49:19.000Z | 2020-12-18T14:49:19.000Z | models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/PyTorch/pt_personreid-res50_market1501_256_128_5.4G_1.3/code/core/data_manager.py | guochunhe/Vitis-AI | e86b6efae11f8703ee647e4a99004dc980b84989 | [
"Apache-2.0"
] | null | null | null | models/AI-Model-Zoo/VAI-1.3-Model-Zoo-Code/PyTorch/pt_personreid-res50_market1501_256_128_5.4G_1.3/code/core/data_manager.py | guochunhe/Vitis-AI | e86b6efae11f8703ee647e4a99004dc980b84989 | [
"Apache-2.0"
] | null | null | null | # Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function, absolute_import
import glob
import re
from os import path as osp
from .market1501 import Market1501
__factory = {
'market1501': Market1501
}
def get_names():
return list(__factory.keys())
def init_dataset(name, *args, **kwargs):
if name not in __factory.keys():
raise KeyError("Unknown datasets: {}".format(name))
return __factory[name](*args, **kwargs)
| 27.888889 | 74 | 0.737052 | 1 | 0.9681 | [
0.003494561417028308,
0.02092462033033371,
0.007695142645388842,
0.004017665982246399,
0.005425558891147375,
-0.0029698163270950317,
-0.006015535909682512,
0.0024533243849873543,
-0.006269024685025215,
0.003394167637452483,
0.003159276442602277,
0.004838635213673115,
0.008367648348212242,
-0.015574234537780285,
-0.000600108178332448,
0.017634885385632515,
-0.0524323470890522,
0.0007444797665812075,
-0.0029242828022688627,
0.001231538481079042,
-0.009862937033176422,
0.009000040590763092,
0.007852214388549328,
0.006100983824580908,
0.004270658362656832,
-0.000240376204601489,
0.00884108804166317,
0.0003287139697931707,
-0.005571906920522451,
-0.007237461395561695,
-0.0013526971451938152,
-0.001871699234470725,
-0.007290971931070089,
-0.0062379431910812855,
0.0077914525754749775,
-0.004511756356805563,
-0.0008003940456546843,
-0.01830301433801651,
0.010362662374973297,
-0.00420852517709136,
-0.004696690011769533,
-0.013971314765512943,
0.0012725249398499727,
0.0044049764983356,
-0.009431472979485989,
0.003316333284601569,
-0.003833957016468048,
0.003147428622469306,
-0.01232600212097168,
0.005491043906658888,
-0.009357264265418053,
0.005101821385324001,
0.013741561211645603,
0.0030872835777699947,
-0.006234869826585054,
-0.007953973487019539,
0.011860172264277935,
0.0011480036191642284,
-0.010669775307178497,
-0.00013293081428855658,
-0.004832587670534849,
-0.0009513352997601032,
0.003042808501049876,
0.004905851557850838,
-0.016356725245714188,
-0.005441573448479176,
-0.004126142244786024,
0.001120804576203227,
-0.00124395452439785,
0.007963122799992561,
0.002438198309391737,
-0.0011423587566241622,
0.007238760590553284,
0.003988608717918396,
0.0031514952424913645,
-0.005748857744038105,
-0.0017916315700858831,
-0.0007665167795494199,
0.008673865348100662,
0.004479605238884687,
0.00395111134275794,
-0.007925286889076233,
0.0038932792376726866,
0.008596071042120457,
0.01512011606246233,
0.0104390112683177,
0.01785513572394848,
-0.00829340424388647,
0.044095490127801895,
0.005584859289228916,
-0.008079815655946732,
0.00023328028328251094,
-0.010184104554355145,
-0.002876714803278446,
-0.006351896561682224,
-0.026679329574108124,
-0.000680505414493382,
-0.003226625034585595,
0.0016855736030265689,
0.005322586745023727,
-0.0005224880296736956,
0.006436435505747795,
-0.001038390793837607,
-0.002919459482654929,
-0.008650635369122028,
0.011111566796898842,
-0.008113604970276356,
-0.004264168441295624,
0.006425962317734957,
0.002159441588446498,
-0.012401985935866833,
-0.002848228206858039,
0.001153013319708407,
-0.012156607583165169,
0.0034479936584830284,
0.003465593559667468,
-0.005834560375660658,
0.05028600990772247,
-0.0017548311734572053,
0.002585840178653598,
-0.0030633669812232256,
0.00013078641495667398,
0.000752137100789696,
0.006369329057633877,
0.009337836876511574,
-0.0030059616547077894,
0.011469976045191288,
0.0077222613617777824,
0.004167779814451933,
0.008617669343948364,
-0.00018235904281027615,
0.009150746278464794,
-0.004783750046044588,
-0.002219120040535927,
-0.00021503034804482013,
-0.006413423456251621,
0.006518087815493345,
-0.0008619013824500144,
-0.006723116151988506,
0.0021803718991577625,
0.0012543507618829608,
-0.009605524130165577,
0.001311211148276925,
-0.0018867908511310816,
0.0054136053659021854,
-0.009630360640585423,
-0.004177807830274105,
-0.002894776174798608,
-0.0054826741106808186,
0.0028060837648808956,
0.007656725589185953,
0.0031541287899017334,
0.004516312852501869,
-0.006923134438693523,
-0.008851527236402035,
-0.00021064651082269847,
-0.0027886345051229,
0.0005954639636911452,
0.0073362854309380054,
0.0033012477215379477,
-0.00968384463340044,
0.0006984779611229897,
0.0030313213355839252,
0.0067862337455153465,
-0.0028348001651465893,
0.0019281435525044799,
-0.009803155437111855,
0.00836900807917118,
0.0008363381493836641,
0.004282479174435139,
0.010202164761722088,
-0.003644841257482767,
0.0022088622208684683,
0.00031085737282410264,
0.0033388903830200434,
-0.0007074283203110099,
0.0064209322445094585,
0.009511053562164307,
-0.003540939884260297,
-0.005919796414673328,
0.002612805226817727,
0.005558224860578775,
0.00873534008860588,
0.0079927584156394,
-0.0030164376366883516,
0.0023201131261885166,
-0.005194711498916149,
-0.0009665363468229771,
0.005566384643316269,
-0.0031529306434094906,
0.004496368579566479,
0.0028013710398226976,
-0.011472750455141068,
-0.00659532193094492,
-0.0004740528529509902,
-0.009018711745738983,
0.0012464412720873952,
0.011289303191006184,
0.012688207440078259,
-0.001149962074123323,
0.0055086007341742516,
-0.011031551286578178,
-0.0018473985837772489,
0.005722882226109505,
0.0017724421340972185,
-0.01176413707435131,
-0.9608067870140076,
0.0058207702822983265,
0.0047014132142066956,
-0.0000998301911749877,
0.004883672576397657,
0.003696655621752143,
0.0025579198263585567,
0.0033166296780109406,
0.014089350588619709,
-0.005084403790533543,
-0.005842368118464947,
-0.007735068444162607,
-0.009455272927880287,
-0.0007575424970127642,
-0.005140255205333233,
-0.001499382546171546,
-0.005482811015099287,
-0.006557222921401262,
-0.001619923859834671,
-0.003825636114925146,
-0.0033284733071923256,
0.009070483036339283,
-0.0032333217095583677,
0.006256928667426109,
0.0028330038767307997,
0.004180962219834328,
-0.0036818175576627254,
0.0002545165771152824,
-0.0023693519178777933,
-0.0014380067586898804,
-0.005457455292344093,
-0.012872196733951569,
-0.0035895851906389,
-0.003908884711563587,
0.00907064601778984,
0.0003888893115799874,
0.007506209425628185,
-0.0012131535913795233,
0.001063913805410266,
-0.008103466592729092,
0.005959575064480305,
-0.0008096948149614036,
0.0037627071142196655,
-0.0300628412514925,
-0.0022125313989818096,
-0.0004241980495862663,
-0.0074440776370465755,
0.007544435560703278,
0.0009919489966705441,
0.00016723311273381114,
-0.004321994259953499,
-0.006159493699669838,
0.01147092692553997,
-0.008378678001463413,
0.003792261704802513,
-0.004723516758531332,
-0.008519132621586323,
-0.001551532419398427,
-0.00866332184523344,
0.0011915973154827952,
0.0031820586882531643,
-0.0033985620830208063,
-0.004225567448884249,
-0.004099751356989145,
0.0020795243326574564,
0.003023227909579873,
-0.0009567432571202517,
-0.017653102055191994,
-0.007355961948633194,
-0.001998225459828973,
-0.0005318750627338886,
-0.003005584003403783,
-0.00040173312299884856,
0.003006892278790474,
-0.007777890656143427,
0.0055720931850373745,
0.0026768387760967016,
0.0004321496235206723,
-0.012286601588129997,
-0.002279670676216483,
-0.009880493395030499,
-0.008528707548975945,
0.0012836226960644126,
-0.005717562977224588,
-0.003872915403917432,
-0.0008439915836788714,
0.001684465678408742,
0.007063708733767271,
-0.003262058598920703,
0.0036743474192917347,
0.011334427632391453,
-0.0017982731806114316,
-0.009476502425968647,
0.006995149422436953,
0.006095775403082371,
0.00012461173173505813,
-0.0033183537889271975,
-0.00019305077148601413,
0.006549473851919174,
0.008020457811653614,
0.0030101125594228506,
0.006321694236248732,
-0.00015517801512032747,
0.013728203251957893,
-0.0007308709900826216,
-0.0004152752517256886,
-0.005004913080483675,
-0.001417732797563076,
-0.005343759898096323,
-0.004647258669137955,
-0.004070696420967579,
-0.002135918941348791,
-0.012611999176442623,
-0.008913879282772541,
-0.0027049416676163673,
-0.0018662320217117667,
0.0019812248647212982,
-0.0040740384720265865,
0.0005593278328888118,
0.0019977143965661526,
0.00796767883002758,
0.0005757859908044338,
-0.002055990742519498,
0.0009909681975841522,
0.0023652329109609127,
-0.003159684594720602,
0.014099342748522758,
-0.013330449350178242,
0.005689063109457493,
-0.0017832349985837936,
-0.012872076593339443,
0.008067234419286251,
0.010492573492228985,
-0.006456816103309393,
0.0023072874173521996,
0.0023146434687078,
0.0021406691521406174,
-0.0017751619452610612,
-0.0040122754871845245,
-0.0023630710784345865,
-0.017384817823767662,
0.00015947999781928957,
0.016875408589839935,
0.00003744697096408345,
0.010659437626600266,
0.011588980443775654,
-0.0027079235296696424,
-0.00041159975808113813,
0.008304128423333168,
0.0010246668243780732,
0.012580162845551968,
-0.00811246782541275,
-0.00042171558015979826,
0.0018839351832866669,
-0.007270915433764458,
0.0011894176714122295,
0.006520276889204979,
0.004900097846984863,
-0.0026169561315327883,
0.003042486496269703,
-0.008258705027401447,
-0.004498720169067383,
-0.01841086894273758,
-0.004250007681548595,
0.008280300535261631,
-0.006142463069409132,
0.005709567107260227,
-0.011857135221362114,
0.0034031167160719633,
0.004506198223680258,
0.004731453955173492,
0.0007106081466190517,
-0.0009335592039860785,
0.005882402416318655,
0.01024784054607153,
-0.007544216699898243,
0.0030158963054418564,
0.0034422792959958315,
-0.00047560903476551175,
0.00030136111308820546,
0.010139760561287403,
-0.006471181754022837,
-0.005289170425385237,
0.003343554912135005,
0.003217858960852027,
0.0005210898234508932,
-0.0034521245397627354,
-0.007352480664849281,
-0.003896358422935009,
0.0018829761538654566,
-0.004103552550077438,
0.00524886092171073,
0.002341337502002716,
0.003255260642617941,
-0.00816827267408371,
-0.0007404650095850229,
-0.00412916811183095,
-0.009594828821718693,
0.010114218108355999,
-0.0012607260141521692,
0.0022530928254127502,
0.014551076106727123,
0.0021065822802484035,
-0.012690046802163124,
0.006130967754870653,
0.0092400424182415,
-0.002534382278099656,
0.003999956417828798,
0.007952900603413582,
-0.004683108534663916,
-0.021820873022079468,
-0.005339926108717918,
-0.014676312915980816,
0.004807484336197376,
-0.0013524374226108193,
0.0037045793142169714,
-0.006209046114236116,
0.009080462157726288,
0.004592828918248415,
-0.013798524625599384,
-0.005320380441844463,
-0.0091133126989007,
0.009165999479591846,
0.000020158478946541436,
0.0003125798248220235,
-0.002415433991700411,
-0.002606508554890752,
-0.0028706826269626617,
-0.0036239272449165583,
-0.002125304890796542,
0.003541666315868497,
0.00224397168494761,
-0.0013895235024392605,
0.003594379173591733,
-0.0039998204447329044,
0.002076657023280859,
0.00008486327715218067,
-0.01091369241476059,
0.0017296491423621774,
0.005797958467155695,
-0.0005069993785582483,
-0.0049428194761276245,
-0.0015509763034060597,
-0.00020579838019330055,
-0.007635867223143578,
-0.01096365600824356,
-0.004640667233616114,
-0.003605462145060301,
-0.002583280438557267,
-0.011791936121881008,
-0.004109534900635481,
-0.008235693909227848,
0.008527886122465134,
-0.00639078114181757,
0.0057260505855083466,
0.0038935465272516012,
-0.005538810044527054,
0.00757523812353611,
0.00019314490782562643,
0.004436016548424959,
0.0029942351393401623,
0.003044749377295375,
-0.0010425645159557462,
-0.005183986853808165,
-0.010572969913482666,
0.01116135437041521,
-0.007196955382823944,
0.00295976921916008,
0.012615648098289967,
0.0053818440064787865,
0.0099016223102808,
-0.0024317060597240925,
-0.0013277700636535883,
0.001729066134430468,
0.008434468880295753,
-0.014298751018941402,
0.004990022163838148,
-0.0039789434522390366,
-0.0008606502669863403,
0.003252077614888549,
-0.0027278370689600706,
0.002426792634651065,
0.009570492431521416,
0.0031180819496512413,
-0.007006901316344738,
-0.0020969021134078503,
0.00040745644946582615,
0.0014339616755023599,
-0.012632215395569801,
0.0011205013142898679,
-0.0024484628811478615,
-0.0033934758976101875,
-0.003260800614953041,
-0.002829171484336257,
0.000021782740077469498,
0.006283511873334646,
-0.000363729806849733,
0.007085938937962055,
0.002249515149742365,
-0.005466652102768421,
0.015075786970555782,
-0.003737342543900013,
-0.00406468054279685,
0.0028408679645508528,
0.0025987857952713966,
-0.001240481506101787,
-0.007996460422873497,
-0.0026835580356419086,
0.0030198886524885893,
0.004738904535770416,
-0.0040504466742277145,
-0.005959649104624987,
-0.004014711827039719,
-0.0002444595447741449,
-0.010462116450071335,
-0.00014291178376879543,
0.010084882378578186,
-0.004167414270341396,
0.0043114866130054,
-0.0011406743433326483,
-0.009718464687466621,
-0.012817105278372765,
0.05354471504688263,
-0.001197555335238576,
0.0032116256188601255,
0.006656259763985872,
-0.007126121316105127,
-0.0017141969874501228,
-0.0014089348260313272,
0.007364817429333925,
-0.006412980146706104,
-0.006461461540311575,
0.008216995745897293,
-0.0047348858788609505,
0.00430251844227314,
0.002260755281895399,
-0.003740363521501422,
0.014110424555838108,
-0.0046021300368011,
-0.017130129039287567,
-0.017571156844496727,
0.005317955277860165,
-0.003650525351986289,
-0.00734569551423192,
0.008370880968868732,
-0.0050995913334190845,
-0.005198477767407894,
0.0004494368040468544,
0.004548350349068642,
0.001958905952051282,
-0.00276001263409853,
-0.0022206332068890333,
-0.001451781834475696,
-0.000046523535274900496,
0.0013409140519797802,
0.006981117185205221,
0.00833076611161232,
-0.002815081737935543,
0.004464883357286453,
-0.0006224683602340519,
-0.00144803780131042,
-0.0018685230752453208,
0.00456754956394434,
0.00581999309360981,
-0.0012401670683175325,
-0.003535259747877717,
0.004996337927877903,
0.0028862718027085066,
0.0010532159358263016,
0.008913918398320675,
0.0002873271587304771,
-0.0032449427526444197,
0.007562227547168732,
0.008779747411608696,
0.0012020051945000887,
0.008120301179587841,
-0.003906533122062683,
0.005600801669061184,
0.0023137019015848637,
-0.009249159134924412,
-0.01596197858452797,
-0.0018462288426235318,
0.00694081699475646,
0.008339342661201954,
-0.0007037611212581396,
0.0018320693634450436,
-0.002052362309768796,
-0.003821561112999916,
-0.008155454881489277,
-0.007651403546333313,
-0.0031632734462618828,
0.0008154914830811322,
0.004268202930688858,
0.07108604162931442,
-0.007938669063150883,
-0.0012084865011274815,
-0.0080998120829463,
-0.0005059785326011479,
-0.0018145836656913161,
-0.0017779985209926963,
-0.00034770803176797926,
-0.002792197046801448,
0.002203964628279209,
0.0002869322197511792,
-0.01118344534188509,
-0.011615142226219177,
-0.0005762791261076927,
0.003681287169456482,
-0.0025748347397893667,
0.00198541977442801,
0.007502264343202114,
-0.009638234041631222,
0.0025889375247061253,
-0.012342172674834728,
-0.0008991047507151961,
-0.0017847841372713447,
-0.009061763063073158,
-0.005733413156121969,
-0.0018205245723947883,
0.004656689707189798,
0.006425289902836084,
0.0026504378765821457,
-0.0027234419248998165,
0.007082405965775251,
-0.001825054525397718,
-0.0010133306495845318,
-0.0043946122750639915,
-0.0016750888898968697,
-0.004814625717699528,
0.007277144119143486,
-0.0001024981975206174,
-0.011213968507945538,
-0.006340036168694496,
-0.002537819556891918,
0.0014866896672174335,
-0.004787079058587551,
0.005134677980095148,
0.0011854346375912428,
0.004528613295406103,
-0.002833224833011627,
-0.0007270615897141397,
-0.004901860374957323,
0.002940854988992214,
-0.011255934834480286,
0.009048172272741795,
-0.1673366129398346,
0.010311637073755264,
0.003344145370647311,
-0.005275672301650047,
-0.004084132611751556,
-0.015730783343315125,
-0.005763056688010693,
0.004120407626032829,
0.0088569987565279,
0.0008003809489309788,
-0.002532467944547534,
0.00005580877768807113,
0.004310886841267347,
0.0036630015820264816,
-0.0045641646720469,
-0.0033902141731232405,
0.003300614422187209,
-0.004487574100494385,
0.0002884609857574105,
0.005618472583591938,
0.0055383858270943165,
0.007061163429170847,
0.0027153235860168934,
0.0010149001609534025,
-0.001743112807162106,
-0.004455962218344212,
0.005262638442218304,
-0.0013523886445909739,
0.005196118261665106,
-0.009001778438687325,
-0.004567460156977177,
-0.002836485393345356,
-0.004033117089420557,
0.0014585795579478145,
0.005867830011993647,
-0.00010324473259970546,
0.008914255537092686,
0.0033427474554628134,
-0.006714832503348589,
0.006806214805692434,
-0.006227541249245405,
0.028126543387770653,
0.004827261436730623,
0.0034800004214048386,
-0.002079283120110631,
-0.0044172112829983234,
-0.004294542595744133,
0.010125787928700447,
0.0015288504073396325,
0.011898514814674854,
-0.01097280066460371,
-0.00152492243796587,
0.005325776524841785,
0.01819894276559353,
-0.006447373889386654,
-0.009030281566083431,
-0.005531365051865578,
-0.0010702533181756735,
0.003054848639294505,
0.006415047682821751,
0.010972774587571621,
-0.003701416775584221,
0.011177861131727695,
-0.004771969746798277,
-0.019136615097522736,
0.004092163871973753,
-0.001940351678058505,
-0.00836195982992649,
0.0028208994772285223,
0.007140607573091984,
0.009227159433066845,
0.0001446601963834837,
0.004342623054981232,
-0.002045169472694397,
0.007510756608098745,
-0.0005389776779338717,
0.005624542012810707,
-0.00038430263521149755,
0.00567058427259326,
-0.008788716048002243,
0.007674587424844503,
-0.00874882098287344,
-0.00359938177280128,
0.0033813691698014736,
-0.004411220084875822,
0.010494835674762726,
0.0038115624338388443,
-0.0017287193331867456,
-0.0003102615592069924,
-0.009733433835208416,
-0.0029585720039904118,
0.002841018373146653,
0.001175692887045443,
-0.009728480130434036,
0.00395389785990119,
0.0015840721316635609,
0.0058381506241858006,
0.008732768706977367,
-0.009815769270062447,
0.00786817166954279,
0.0055693406611680984,
-0.006222974509000778,
-0.0012909414945170283,
-0.0043659452348947525,
0.0016087337862700224,
0.004007292445749044,
-0.0025680479593575,
-0.004334673751145601,
0.0036918804980814457,
-0.0047182561829686165,
-0.0046764868311584,
0.003063924377784133,
-0.01134344283491373,
-0.009868969209492207,
-0.0008598731947131455,
-0.01003288198262453,
-0.00003298288720543496
] |
8a61523d34a63b6c1b5541a6127f60a7a5d5ec7e | 4,684 | py | Python | PyBank/.ipynb_checkpoints/Pymain-checkpoint.py | yash5OG/PythonChallengeW3-Y5 | 4a20ea5bae2d88af5a7d56f43ddc63ac64eaee67 | [
"MIT"
] | null | null | null | PyBank/.ipynb_checkpoints/Pymain-checkpoint.py | yash5OG/PythonChallengeW3-Y5 | 4a20ea5bae2d88af5a7d56f43ddc63ac64eaee67 | [
"MIT"
] | null | null | null | PyBank/.ipynb_checkpoints/Pymain-checkpoint.py | yash5OG/PythonChallengeW3-Y5 | 4a20ea5bae2d88af5a7d56f43ddc63ac64eaee67 | [
"MIT"
] | null | null | null | {
"cells": [
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [],
"source": [
"# Import libraries\n",
"import os, csv"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"#variables for the script\n",
"months = [] #list of months\n",
"pl =[] #list of monthly PL\n",
"pl_changes = [] #list of P&L Changes\n",
"n_months = 0 #count of months\n",
"pl_total = 0 #total of P&L\n",
"plc = 0 #variable to track PL changes\n",
"avg_pl_change = 0 #average of changes in PL\n",
"maxpl = 0 #maximum increase in profits\n",
"minpl = 0 #maximum decrease in losses\n",
"max_i = 0 #index for max pl\n",
"min_i = 0 #index for min pl\n",
"\n",
"#read the resource file\n",
"bankcsv = os.path.join(\".\", \"Resources\", \"budget_data.csv\") #set path\n",
"\n",
"\n",
"#read file\n",
"with open(bankcsv, 'r') as csv_file:\n",
" csv_reader = csv.reader(csv_file,delimiter=\",\")\n",
" header = next(csv_reader)\n",
" \n",
" #for loop to update the counters and lists\n",
" for row in csv_reader:\n",
" n_months += 1\n",
" pl_total += int(row[1])\n",
" pl.append(row[1])\n",
" months.append(row[0])"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [],
"source": [
"# loop to track the PL change values\n",
"pl_changes = [] \n",
"plc = int(pl[0])\n",
"for i in range(1, len(pl)):\n",
" pl_changes.append(int(pl[i]) - plc)\n",
" plc = int(pl[i])\n",
" i += 1\n",
"#print(pl_changes)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
"#calculate the average PL Changes, max and min\n",
"avg_pl_change = sum(pl_changes) / len(pl_changes)\n",
"maxpl = max(pl_changes)\n",
"minpl = min(pl_changes)\n",
"#print(avg_pl_change, maxpl, minpl)\n",
"#print(pl_changes.index(maxpl))\n",
"#print(len(pl_changes))"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Financial Analysis\n",
"---------------------------------------------------------------------\n",
"Total Months: 86\n",
"Total: $38382578\n",
"Average Change: $-2315.12\n",
"Greatest Increase in Profits: Feb-2012 ($1926159)\n",
"Greatest Decrease in Profits: Sep-2013 ($-2196167)\n"
]
}
],
"source": [
"#find dates for max and min PL changes\n",
"max_i = pl_changes.index(maxpl) +1 #adding +1 since the changes are calculated one row above\n",
"min_i = pl_changes.index(minpl) +1\n",
"\n",
"maxmonth = months[max_i]\n",
"minmonth = months[min_i]\n",
"\n",
"#print output to the terminal\n",
"\n",
"print(\"Financial Analysis\")\n",
"print(\"-\"*69)\n",
"print(f\"Total Months: {n_months}\")\n",
"print(f\"Total: ${round(pl_total,2)}\")\n",
"print(f\"Average Change: ${round(avg_pl_change,2)}\")\n",
"print(f\"Greatest Increase in Profits: {maxmonth} (${maxpl})\")\n",
"print(f\"Greatest Decrease in Profits: {minmonth} (${minpl})\")\n"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [],
"source": [
"# write summary to txt file\n",
"output = os.path.join(\".\",\"Analysis\", \"summary.txt\")\n",
"\n",
"# use \"\\n\" to create a new line\n",
"with open(output, 'w') as output:\n",
" output.write(\"Financial Analysis\\n\")\n",
" output.write(\"-\"*69 + \"\\n\")\n",
" output.write(f\"Total Months: {n_months}\\n\")\n",
" output.write(f\"Total: ${round(pl_total,2)}\\n\")\n",
" output.write(f\"Average Change: ${round(avg_pl_change,2)}\\n\")\n",
" output.write(f\"Greatest Increase in Profits: {maxmonth} (${maxpl})\\n\")\n",
" output.write(f\"Greatest Decrease in Profits: {minmonth} (${minpl})\\n\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
| 29.093168 | 104 | 0.51281 | 0 | 0 | [
0.00897485576570034,
0.027492282912135124,
0.005483877379447222,
0.01171445194631815,
0.039009712636470795,
0.046790506690740585,
-0.04260697588324547,
-0.038562577217817307,
-0.025455180555582047,
0.012419443577528,
0.014495208859443665,
-0.013118164613842964,
0.03072044625878334,
-0.04446021839976311,
0.022274788469076157,
0.007472513243556023,
-0.018133321776986122,
-0.03414319083094597,
-0.03459852933883667,
0.0004867668612860143,
-0.02731281891465187,
0.01798609457910061,
-0.04168107360601425,
0.011779983527958393,
-0.005256486590951681,
-0.030766166746616364,
0.03771572932600975,
0.008466027677059174,
0.013073648326098919,
-0.016226375475525856,
-0.01419359166175127,
-0.0004954935284331441,
0.031489789485931396,
-0.04350936785340309,
-0.08288246393203735,
0.02268640697002411,
-0.01437261700630188,
-0.015756485983729362,
0.021522581577301025,
0.020452015101909637,
-0.029207896441221237,
-0.012369191274046898,
0.0008592765661887825,
-0.04986758157610893,
0.08068816363811493,
-0.02280455455183983,
-0.02100083790719509,
-0.0002621742314659059,
-0.02430020086467266,
-0.01146945171058178,
-0.04536856338381767,
0.04847603663802147,
0.011666729114949703,
0.01633051037788391,
-0.025516491383314133,
0.003299454692751169,
0.05547431483864784,
0.03380768373608589,
-0.009733842685818672,
-0.014267909340560436,
0.05814450979232788,
-0.011608783155679703,
0.0002663049672264606,
0.0047855679877102375,
0.011902553960680962,
0.027136515825986862,
0.053992897272109985,
0.00750652514398098,
-0.0326584093272686,
0.062256865203380585,
-0.009367220103740692,
0.02419809252023697,
0.016678281128406525,
0.05865161493420601,
-0.012937511317431927,
0.009753573685884476,
-0.04507569223642349,
-0.05371661111712456,
0.004888903349637985,
0.019416647031903267,
-0.06026926264166832,
0.034229081124067307,
0.0045585595071315765,
-0.03169843554496765,
0.029729651287198067,
-0.04078419879078865,
0.01952287368476391,
-0.07889703661203384,
0.029973318800330162,
0.0035309200175106525,
-0.04379132762551308,
-0.008874664083123207,
-0.11476859450340271,
0.04389308765530586,
-0.03140852227807045,
-0.049090780317783356,
0.03510802984237671,
0.009762832894921303,
0.029288187623023987,
-0.012302698567509651,
0.011799875646829605,
-0.04314678907394409,
0.032531965523958206,
0.0046339319087564945,
0.03934600576758385,
-0.040292687714099884,
-0.0097585404291749,
-0.048220016062259674,
0.029624823480844498,
-0.027782758697867393,
-0.0556686632335186,
0.02954721823334694,
0.060813162475824356,
0.0024413298815488815,
0.03840632736682892,
-0.04882417619228363,
0.0004847824457101524,
0.032520800828933716,
0.005466255825012922,
-0.0053671253845095634,
0.04459290951490402,
0.020906247198581696,
0.012499052099883556,
-0.01709960401058197,
-0.013649722561240196,
0.08462096005678177,
0.02881329134106636,
0.024564774706959724,
-0.007883459329605103,
-0.009601341560482979,
0.0184441227465868,
-0.035121701657772064,
-0.008050589822232723,
-0.02499266527593136,
0.03927423059940338,
0.011081415228545666,
-0.009283507242798805,
0.007688769605010748,
-0.037177231162786484,
0.05158175528049469,
-0.04249859228730202,
0.02480200305581093,
0.004688002169132233,
0.0008699543541297317,
0.05268489941954613,
-0.04973507300019264,
0.023233333602547646,
-0.015917588025331497,
-0.046803079545497894,
-0.013953021727502346,
0.05315764248371124,
0.003408520482480526,
-0.00013501271314453334,
-0.006885975133627653,
-0.03819236159324646,
0.0008301967172883451,
0.02417798340320587,
0.001048056990839541,
-0.018787002190947533,
0.022321444004774094,
0.01949186623096466,
0.07291635870933533,
-0.018456172198057175,
0.009931963868439198,
0.011920711025595665,
0.07248112559318542,
0.008382237516343594,
0.03246735781431198,
-0.002798844827339053,
-0.0013103828532621264,
-0.0030966990161687136,
0.023361776024103165,
-0.015124170109629631,
-0.009056394919753075,
0.061884500086307526,
-0.016360662877559662,
0.015136276371777058,
0.037328291684389114,
-0.0039366986602544785,
-0.05088852718472481,
0.01322285458445549,
0.013378671370446682,
0.006930426228791475,
0.029063265770673752,
0.013133051805198193,
0.015131022781133652,
-0.01638483628630638,
-0.012391996569931507,
0.011744477786123753,
-0.020116286352276802,
-0.0630139410495758,
0.03533435985445976,
0.020621787756681442,
-0.03992876410484314,
-0.03255830332636833,
-0.005939053371548653,
-0.030564263463020325,
-0.0030077097471803427,
0.01974419504404068,
-0.036232270300388336,
-0.034430038183927536,
0.004828447010368109,
0.03412122279405594,
0.006140736397355795,
-0.038038767874240875,
0.004952724557369947,
-0.4684399366378784,
-0.020221076905727386,
0.0006842958391644061,
-0.02885124459862709,
0.0401727631688118,
0.01980922371149063,
0.020525628700852394,
0.04807066172361374,
-0.00642691133543849,
0.042137861251831055,
-0.03098968043923378,
-0.029404856264591217,
-0.03272216022014618,
-0.04970856010913849,
-0.032697007060050964,
-0.020256878808140755,
0.012826344929635525,
-0.0001693537487881258,
-0.0012948724906891584,
0.027312496677041054,
0.0472433976829052,
-0.08904148638248444,
0.00178496353328228,
0.05166717618703842,
-0.007989374920725822,
-0.03177966922521591,
0.021526727825403214,
0.014592467807233334,
-0.02402217499911785,
-0.0455266498029232,
-0.003841767320409417,
0.0011692475527524948,
-0.007200026884675026,
-0.01064181700348854,
0.055173035711050034,
0.05964316800236702,
0.029553748667240143,
-0.04015875980257988,
-0.0594840869307518,
0.009094594046473503,
0.010551340878009796,
-0.010293613187968731,
-0.019523270428180695,
-0.048875562846660614,
-0.03937510773539543,
0.06480453163385391,
0.023344868794083595,
-0.01284604612737894,
0.05361481010913849,
0.028829695656895638,
-0.03492950275540352,
0.013207422569394112,
0.011811424046754837,
-0.014384999871253967,
-0.03345378115773201,
-0.054239559918642044,
-0.015747353434562683,
-0.005537227727472782,
0.007520244922488928,
0.016167372465133667,
-0.010825961828231812,
-0.028850896283984184,
-0.04103684425354004,
0.004470724146813154,
-0.006081543397158384,
0.04079428315162659,
0.08931147307157516,
-0.020844675600528717,
-0.0066694519482553005,
-0.010104281827807426,
-0.09958329051733017,
-0.0030373982153832912,
-0.060385145246982574,
0.06307979673147202,
0.069187231361866,
-0.022088631987571716,
-0.028501439839601517,
0.03524184972047806,
-0.053078580647706985,
-0.02746148221194744,
0.039788488298654556,
0.018444549292325974,
-0.01486349105834961,
0.0017501151887699962,
-0.049614351242780685,
-0.024182818830013275,
0.015069402754306793,
0.012190391309559345,
-0.007729350123554468,
-0.010166820138692856,
-0.017736542969942093,
0.03817194327712059,
-0.04041001945734024,
-0.005629357881844044,
-0.024749986827373505,
0.03171143680810928,
0.0042725661769509315,
0.05433400347828865,
-0.009526677429676056,
0.036791570484638214,
-0.030789215117692947,
-0.013752729631960392,
0.013569610193371773,
0.0033809987362474203,
-0.05486894026398659,
0.004965329542756081,
-0.07541681081056595,
-0.011146072298288345,
-0.002655903110280633,
-0.0025544771924614906,
0.03058677725493908,
0.025967147201299667,
-0.012568662874400616,
0.02842147834599018,
0.04126891493797302,
-0.06025296077132225,
0.0051646605134010315,
-0.056765586137771606,
0.035935141146183014,
0.009373041801154613,
-0.014784358441829681,
0.023496948182582855,
-0.008213463239371777,
-0.04492780938744545,
-0.011755876243114471,
0.007928859442472458,
-0.06882055103778839,
-0.059341199696063995,
0.030521247535943985,
-0.00929945893585682,
0.02973753772675991,
-0.002301069675013423,
0.02588466741144657,
0.027914253994822502,
0.0030003872234374285,
-0.048985619097948074,
0.015104691497981548,
-0.013503121212124825,
-0.007089121267199516,
-0.015629755333065987,
-0.0311330184340477,
-0.04265812039375305,
-0.004291874822229147,
-0.039097487926483154,
0.026060035452246666,
-0.004994537681341171,
0.009542555548250675,
0.018662309274077415,
-0.07818882167339325,
-0.035940803587436676,
0.024510998278856277,
0.015490496531128883,
0.0012379148975014687,
0.007722006645053625,
-0.025373397395014763,
-0.01137105654925108,
-0.03935826197266579,
-0.00858449749648571,
0.04227971285581589,
-0.00289686257019639,
0.007261454593390226,
0.007552667520940304,
-0.002813056344166398,
0.01918860711157322,
-0.023021047934889793,
0.0008451682515442371,
0.016862744465470314,
0.026023071259260178,
-0.04848532751202583,
-0.005424260161817074,
-0.026185035705566406,
0.02538171596825123,
0.010442987084388733,
0.024171043187379837,
0.021087927743792534,
-0.03011823259294033,
-0.013987625949084759,
0.01369156688451767,
-0.07467421144247055,
0.05608075484633446,
0.04005269333720207,
-0.012732558883726597,
-0.01185065507888794,
0.017331019043922424,
0.013684701174497604,
0.02324635349214077,
-0.014437227509915829,
-0.0069832513108849525,
-0.018498042598366737,
-0.0480663999915123,
0.006384525913745165,
0.007628057152032852,
-0.003939511254429817,
-0.0275385994464159,
-0.05819620192050934,
-0.03801059350371361,
0.05966811999678612,
0.011465644463896751,
0.03181731328368187,
0.009629463776946068,
-0.008322755806148052,
0.004904351197183132,
0.013535328209400177,
-0.0044481209479272366,
0.002424336038529873,
0.07392957806587219,
0.050405826419591904,
0.017210911959409714,
0.01696205884218216,
-0.009515553712844849,
0.010109351016581059,
-0.06063292920589447,
-0.025820909067988396,
-0.049937669187784195,
-0.005403920542448759,
0.0570937879383564,
-0.05619194731116295,
0.04996240884065628,
0.036280494183301926,
-0.006592356134206057,
0.02038451097905636,
0.008935471065342426,
0.03143248334527016,
-0.0014200977748259902,
-0.022193564102053642,
0.01858416572213173,
0.0002987035841215402,
-0.02520434744656086,
-0.06716129183769226,
0.006183582358062267,
-0.014512147754430771,
-0.006456885952502489,
0.03691113367676735,
-0.008440930396318436,
0.003671762067824602,
0.03103243187069893,
-0.006999536417424679,
-0.014508353546261787,
0.005832088645547628,
-0.01990022137761116,
0.010959752835333347,
-0.011207696050405502,
-0.04503617808222771,
0.01825137250125408,
-0.012044870294630527,
-0.003110007382929325,
-0.004768607206642628,
-0.019834885373711586,
-0.0034135570749640465,
-0.015184776857495308,
0.004774533677846193,
0.06855743378400803,
0.020431993529200554,
-0.0030654058791697025,
0.003522499930113554,
-0.03590967133641243,
-0.002828926080837846,
0.038567814975976944,
0.017785867676138878,
-0.005185991059988737,
-0.022239677608013153,
-0.052547432482242584,
0.011138015426695347,
0.05779309198260307,
0.025779971852898598,
0.007744194008409977,
0.007919740863144398,
-0.005581618752330542,
0.015702392905950546,
0.00385005259886384,
0.06359446048736572,
-0.04158695787191391,
-0.07369023561477661,
-0.009170125238597393,
0.05527900531888008,
-0.027355290949344635,
-0.0356036052107811,
-0.04481404274702072,
0.02323952503502369,
-0.024443812668323517,
-0.02260025218129158,
-0.007090499624609947,
0.01644543744623661,
-0.0014006891287863255,
-0.015968266874551773,
-0.00634452560916543,
-0.0016294711967930198,
0.014238743111491203,
-0.06705598533153534,
-0.0142258545383811,
0.019989658147096634,
-0.011218298226594925,
0.04821305349469185,
0.014935813844203949,
-0.016187967732548714,
0.04011177271604538,
0.0021219004411250353,
-0.038813117891550064,
0.01375602651387453,
0.002000331413000822,
-0.011784344911575317,
-0.014975159429013729,
-0.004129767883569002,
-0.011769530363380909,
-0.013385615311563015,
-0.03136962279677391,
0.007369212340563536,
-0.05400554835796356,
0.044406451284885406,
0.02802243083715439,
0.056863389909267426,
-0.004013670142740011,
-0.009424302726984024,
0.027750443667173386,
0.023606054484844208,
-0.04827884957194328,
0.015599188394844532,
-0.02546316757798195,
0.03803762048482895,
0.014570683240890503,
-0.03447174280881882,
0.02985084056854248,
0.041323378682136536,
-0.018002696335315704,
-0.010117449797689915,
-0.018389247357845306,
-0.04604169353842735,
0.022113440558314323,
-0.00044942283420823514,
0.0536126047372818,
-0.001969065750017762,
0.002069974085316062,
0.02173570916056633,
-0.019556989893317223,
0.031795963644981384,
-0.0013044321676716208,
0.04013694077730179,
0.02351435087621212,
0.0368732288479805,
0.008794565685093403,
-0.044668637216091156,
-0.00990541186183691,
0.006780646741390228,
-0.06782285869121552,
0.031442757695913315,
-0.0004329683433752507,
0.015296366065740585,
-0.02291056141257286,
0.056794438511133194,
0.016907762736082077,
-0.08929017186164856,
0.02746816910803318,
-0.026949280872941017,
0.019971687346696854,
-0.019689103588461876,
0.003636701265349984,
0.012577286921441555,
0.034626323729753494,
-0.013891533017158508,
0.021349089220166206,
-0.004380450118333101,
0.003390491008758545,
-0.0013152715982869267,
-0.011928423307836056,
0.006372890900820494,
-0.018981004133820534,
-0.01830006204545498,
-0.01048830896615982,
-0.032386958599090576,
-0.017288126051425934,
0.006758620962500572,
-0.04391539841890335,
0.0038991470355540514,
0.0270443893969059,
0.005411576945334673,
0.02085535228252411,
0.007374732289463282,
0.024783719331026077,
-0.007923562079668045,
0.03081534244120121,
-0.006330392323434353,
-0.08189373463392258,
0.043982259929180145,
0.016725443303585052,
-0.011993391439318657,
0.0020020902156829834,
-0.0045008412562310696,
0.016538266092538834,
-0.022612527012825012,
-0.05293948948383331,
0.03519067540764809,
-0.024767378345131874,
0.0018167640082538128,
0.04368535056710243,
-0.014751315116882324,
0.0007522071828134358,
-0.01838434673845768,
-0.025134244933724403,
0.00014117290265858173,
-0.04639490693807602,
0.02671222947537899,
0.019524576142430305,
-0.019620053470134735,
-0.05078253522515297,
0.020253006368875504,
-0.06073964387178421,
0.04469815269112587,
0.002583069959655404,
0.004022783599793911,
0.08921993523836136,
0.010306362994015217,
0.03248242288827896,
0.020416758954524994,
-0.027640433982014656,
0.018338238820433617,
0.0503106564283371,
0.010852253995835781,
-0.012575769796967506,
-0.015842968598008156,
0.013870973140001297,
-0.047753047198057175,
-0.028685353696346283,
-0.007713358383625746,
0.005915394984185696,
-0.016822000965476036,
-0.03857460618019104,
-0.053143925964832306,
-0.012675163336098194,
-0.011585182510316372,
0.028584090992808342,
0.005304118152707815,
0.039858341217041016,
-0.029275663197040558,
0.04468521475791931,
0.04963996261358261,
0.019640618935227394,
-0.01336222980171442,
0.006117494311183691,
-0.034768782556056976,
-0.0035096544306725264,
-0.03028338961303234,
0.009485994465649128,
-0.016733208671212196,
0.06525136530399323,
-0.017295658588409424,
-0.08708963543176651,
0.006202669348567724,
-0.033635929226875305,
-0.049344707280397415,
-0.06304474174976349,
-0.014159361831843853,
0.020571177825331688,
-0.00896555744111538,
0.006329316180199385,
-0.02748948708176613,
0.007709552068263292,
0.0434548519551754,
0.06365171074867249,
0.0005634702974930406,
0.028607534244656563,
0.06414581835269928,
-0.0112981041893363,
-0.01773359440267086,
0.03117724508047104,
0.006708978675305843,
0.0694487914443016,
-0.007669021375477314,
0.021380526944994926,
-0.006723516620695591,
0.01691335253417492,
0.032091476023197174,
-0.0019789771176874638,
0.009306177496910095,
-0.004251904785633087,
0.013125380501151085,
-0.019746948033571243,
-0.05456160753965378,
0.0482473149895668,
0.05018457770347595,
-0.0032807104289531708,
-0.10578907281160355,
0.01641881838440895,
-0.017757775261998177,
0.0067558325827121735,
0.041138578206300735,
0.0035930455196648836,
0.03923302888870239,
0.0061868042685091496,
-0.02764633484184742,
0.010504016652703285,
-0.0304648969322443,
-0.047107044607400894,
-0.03921935707330704,
0.023798339068889618,
0.03606026992201805,
-0.049713924527168274,
-0.015596465207636356,
0.010875328443944454,
0.03063594363629818,
0.00034939777106046677,
-0.050824932754039764,
-0.012664590030908585,
0.023019157350063324,
-0.014853091910481453,
-0.011881127022206783,
0.029511047527194023,
0.058469533920288086,
0.03374301642179489,
-0.021710846573114395,
0.013689535669982433,
-0.015999451279640198,
-0.034468088299036026,
0.014239485375583172,
-0.05346096679568291,
0.0107989851385355,
0.005803483072668314,
0.02390436828136444,
-0.0037082291673868895,
-0.035944029688835144,
-0.04445866122841835,
0.019452158361673355,
-0.001287640887312591,
-0.020065149292349815,
0.008327477611601353,
0.00458551524206996,
-0.06354085355997086,
-0.005708869080990553,
0.040299270302057266,
0.0046318890526890755,
-0.009349155239760876,
0.01902812346816063,
-0.03589991480112076,
-0.006082457024604082,
0.05784853920340538,
0.008766845799982548,
-0.047436341643333435,
-0.005145528353750706,
0.05374731495976448,
-0.03842868655920029,
-0.044785093516111374,
-0.0024313717149198055,
0.03232880309224129,
0.06599564105272293,
-0.027775710448622704,
-0.04352844879031181,
-0.020949291065335274,
0.014742393046617508,
0.024378634989261627,
0.018194328993558884,
0.004968638066202402,
0.022463923320174217,
0.08600888401269913,
0.007700053043663502,
0.014817554503679276,
0.030418379232287407,
-0.027376970276236534,
0.02266688272356987,
0.028722623363137245,
0.03517266735434532,
-0.018216915428638458,
-0.02530927211046219,
-0.005597879644483328
] |
8a6266df7a1375925ee79de0d3567238f763ecfa | 165 | py | Python | xlib/api/win32/oleaut32/oleaut32.py | jkennedyvz/DeepFaceLive | 274c20808da089eb7fc0fc0e8abe649379a29ffe | [
"MIT"
] | null | null | null | xlib/api/win32/oleaut32/oleaut32.py | jkennedyvz/DeepFaceLive | 274c20808da089eb7fc0fc0e8abe649379a29ffe | [
"MIT"
] | null | null | null | xlib/api/win32/oleaut32/oleaut32.py | jkennedyvz/DeepFaceLive | 274c20808da089eb7fc0fc0e8abe649379a29ffe | [
"MIT"
] | null | null | null | from ctypes import POINTER, Structure
from ..wintypes import VARIANT, dll_import
@dll_import('OleAut32')
def VariantInit( pvarg : POINTER(VARIANT) ) -> None: ...
| 20.625 | 56 | 0.739394 | 1 | 0.6846 | [
0.0035514673218131065,
0.0230873953551054,
0.005592886358499527,
-0.0008637579157948494,
0.0067037176340818405,
-0.003240078454837203,
-0.010642207227647305,
0.004546388052403927,
-0.004236259497702122,
-0.0004992206231690943,
0.0013922161888331175,
0.003166473936289549,
0.007964489050209522,
-0.01997692696750164,
-0.00447731651365757,
0.018256062641739845,
-0.06030726805329323,
0.004714359529316425,
-0.002340037375688553,
0.005281789228320122,
-0.006987316533923149,
0.011927972547709942,
0.009408042766153812,
0.012358597479760647,
0.0057982876896858215,
0.00004004157744930126,
0.00865594856441021,
0.00709561025723815,
-0.0036614129785448313,
-0.005620712414383888,
0.0020814056042581797,
-0.0006194410379976034,
-0.004186961334198713,
-0.01075326930731535,
0.011714830994606018,
-0.005786541849374771,
0.0022444245405495167,
-0.01651228778064251,
0.008581278845667839,
-0.003253885079175234,
-0.007207575254142284,
-0.01578165404498577,
-0.0020345253869891167,
0.010392781347036362,
-0.011493713594973087,
0.00001303281715081539,
-0.007844453677535057,
0.002521456917747855,
-0.011438519693911076,
0.007763679139316082,
-0.011476477608084679,
0.003537859069183469,
0.012529268860816956,
0.0019246487645432353,
-0.009045188315212727,
-0.0061948057264089584,
0.009524260647594929,
-0.00047665942111052573,
-0.01395589392632246,
-0.004606230184435844,
0.0000689707521814853,
-0.005927704274654388,
0.004071712959557772,
0.001967755611985922,
-0.014326833188533783,
-0.00699765607714653,
-0.004467273596674204,
0.0018165440997108817,
-0.003881958546116948,
0.0030449701007455587,
-0.00032824327354319394,
-0.004454650916159153,
0.009366927668452263,
0.002397164236754179,
0.001839664182625711,
0.0008892976329661906,
-0.0016790308291092515,
0.0007617592345923185,
0.005168692674487829,
0.0006469592335633934,
0.009901260025799274,
-0.009579364210367203,
0.006268926430493593,
0.009411395527422428,
0.014313317835330963,
0.010153420269489288,
0.015027937479317188,
-0.009448197670280933,
0.04233390465378761,
0.0068840994499623775,
-0.007845240645110607,
-0.004034389276057482,
-0.006894999649375677,
-0.003945627715438604,
-0.0026205801405012608,
-0.026898005977272987,
-0.00037401399458758533,
-0.005152326542884111,
-0.00026911310851573944,
0.007411341182887554,
0.004647149704396725,
0.010764626786112785,
-0.005740185733884573,
-0.0032408114057034254,
-0.0075918217189610004,
0.011927511543035507,
-0.009576472453773022,
-0.005380549002438784,
0.007949094288051128,
0.0012777738738805056,
-0.007360635790973902,
-0.004718101117759943,
0.00177692377474159,
-0.01298503763973713,
0.0033488820772618055,
0.0012009006459265947,
-0.008947721682488918,
0.05846845358610153,
0.0011310717090964317,
0.0030832241754978895,
-0.002018693368881941,
-0.0025881926994770765,
0.0011579067213460803,
0.009160002693533897,
0.008751645684242249,
-0.0069396342150866985,
0.011309368535876274,
0.003506341716274619,
-0.000681403442285955,
0.0065931458957493305,
-0.0027535518165677786,
0.012430483475327492,
-0.0015550119569525123,
-0.0003468767972663045,
-0.003468097420409322,
-0.007363056298345327,
0.006101285107433796,
-0.0024402050767093897,
-0.0052856863476336,
0.002620697719976306,
0.0003368410107214004,
-0.011706552468240261,
6.236974741113954e-7,
-0.0005229220842011273,
0.00026607673498801887,
-0.007881752215325832,
-0.0027988965157419443,
-0.0035950588062405586,
-0.0032815521117299795,
0.0024807839654386044,
0.009879217483103275,
0.005778881721198559,
0.005669135134667158,
-0.007203519344329834,
-0.008238996379077435,
-0.001646823831833899,
-0.004007455427199602,
0.0015723566757515073,
0.008481320925056934,
0.004548150114715099,
-0.010974057018756866,
-0.005755503661930561,
0.0039688097313046455,
0.007791845593601465,
-0.0006129431421868503,
-0.0036599072627723217,
-0.012378400191664696,
0.0077385022304952145,
0.0028016206342726946,
0.003424041671678424,
0.015706000849604607,
-0.0068572526797652245,
0.0034792653750628233,
0.0003117137821391225,
0.006615211255848408,
-0.0035318564623594284,
0.0032397264149039984,
0.005162291694432497,
-0.0012800947297364473,
-0.005607611034065485,
0.006485986057668924,
0.004348778165876865,
0.009698149748146534,
0.00980591494590044,
-0.0023596074897795916,
0.006540225353091955,
-0.003892408451065421,
-0.001352634048089385,
0.0066320449113845825,
0.0003739044477697462,
0.011563815176486969,
0.0030869932379573584,
-0.014354546554386616,
-0.0037311760243028402,
-0.0028282504063099623,
-0.011816773563623428,
-0.000893911812454462,
0.017464542761445045,
0.013247188180685043,
0.00023820709611754864,
0.009240565821528435,
-0.009506541304290295,
0.000951929425355047,
0.0009724906994961202,
-0.00038270591176114976,
-0.011900810524821281,
-0.9551106691360474,
0.003507282817736268,
0.004600549582391977,
-0.001311848172917962,
0.005089534446597099,
-0.0019516297616064548,
0.004248554352670908,
0.00013504800153896213,
0.012641404755413532,
-0.006129959598183632,
-0.009920332580804825,
-0.0057082106359303,
-0.016190245747566223,
-0.0007813723059371114,
-0.0027517820708453655,
-0.0002608747745398432,
-0.00783624965697527,
-0.009923185221850872,
-0.001434001955203712,
-0.0036653990391641855,
0.0012215691385790706,
0.012231914326548576,
-0.0024670036509633064,
0.004466886632144451,
0.002531955484300852,
0.003635867265984416,
-0.004259767942130566,
-0.003217904129996896,
-0.0003155386948492378,
0.0007689353660680354,
-0.003430569777265191,
-0.014697429724037647,
-0.007799737621098757,
-0.0004049987765029073,
0.009988521225750446,
0.0013872974086552858,
0.009151539765298367,
-0.002353854477405548,
0.0002378541394136846,
-0.011562126688659191,
0.006681486964225769,
0.0033365420531481504,
0.0013395556015893817,
-0.0302170068025589,
-0.0018015813548117876,
0.002573794685304165,
-0.004771839827299118,
0.0033765181433409452,
0.00016809201042633504,
-0.004543695133179426,
0.0008021991234272718,
-0.0013347092317417264,
0.005507735535502434,
-0.007870860397815704,
0.001468999544158578,
-0.007586262654513121,
-0.0029158436227589846,
-0.0025359983555972576,
-0.010544088669121265,
0.003161199390888214,
0.002466792007908225,
-0.004878206178545952,
-0.004666974768042564,
-0.000736795540433377,
0.001191282062791288,
0.0014593686209991574,
-0.006765103433281183,
-0.013780692592263222,
-0.004352597985416651,
-0.0032843961380422115,
0.007984448224306107,
0.000022302327124634758,
-0.005329987965524197,
0.0029700451996177435,
-0.009921306744217873,
0.0073232403956353664,
0.003949829842895269,
0.0009242512751370668,
-0.010933948680758476,
-0.0005374025204218924,
-0.00697106821462512,
-0.00653942720964551,
0.001167735899798572,
-0.0033126450143754482,
-0.007722316775470972,
0.0026992149651050568,
0.0015753679908812046,
0.012244472280144691,
-0.0051731569692492485,
0.004097834695130587,
0.017383208498358727,
-0.0016477723838761449,
-0.008953839540481567,
0.009019835852086544,
0.007255434524267912,
0.0010434294817969203,
-0.00417244341224432,
0.004500121809542179,
0.004956219810992479,
0.009951361455023289,
0.0035332064144313335,
0.0077314735390245914,
-0.0003005563630722463,
0.015085038729012012,
0.0017863204702734947,
-0.0026603650767356157,
0.002421791199594736,
-0.0027536049019545317,
-0.0035909488797187805,
-0.007470445241779089,
-0.005131496116518974,
-0.0013490879209712148,
-0.01316771935671568,
-0.013768138363957405,
-0.007075571455061436,
0.0005006050923839211,
-0.0008706251392140985,
-0.004904603119939566,
0.000580310239456594,
0.0009351088665425777,
0.013182626105844975,
0.00043053904664702713,
-0.006611320190131664,
0.0036137844435870647,
0.005305097438395023,
-0.0038448828272521496,
0.015586325898766518,
-0.014424415305256844,
0.006282813381403685,
-0.00047523423563688993,
-0.016787394881248474,
0.006154540926218033,
0.00521936547011137,
-0.008871500380337238,
0.005972713232040405,
0.004059895407408476,
0.002350372029468417,
0.0023314596619457006,
-0.008863058872520924,
-0.0063954731449484825,
-0.016598835587501526,
-0.0011896041687577963,
0.021981971338391304,
0.004443792160600424,
0.009655441157519817,
0.010963342152535915,
-0.005494874902069569,
-0.002772057894617319,
0.008521257899701595,
0.008031568489968777,
0.01570391096174717,
-0.00917916838079691,
-0.0015792390331625938,
-0.0015803975984454155,
-0.009272034280002117,
0.0028728023171424866,
0.0041661993600428104,
0.01049814559519291,
-0.0031900196336209774,
0.002426800550892949,
-0.007374309469014406,
-0.007805490400642157,
-0.01819034293293953,
-0.0028999499045312405,
0.008768015541136265,
-0.005522640887647867,
0.007081551011651754,
-0.008532991632819176,
0.0035038136411458254,
0.0012832008069381118,
-0.0006884728791192174,
0.0004432163550518453,
0.0015595059376209974,
0.004550629295408726,
0.011842157691717148,
-0.008812098763883114,
0.00438275933265686,
0.0030447733588516712,
-0.004099791869521141,
0.004598671570420265,
0.010195554234087467,
-0.006962832063436508,
-0.003504626452922821,
-0.000136628354084678,
0.0027555583510547876,
0.0006297012441791594,
-0.004388347268104553,
-0.01120307669043541,
-0.005563047714531422,
0.006948980037122965,
-0.004967657849192619,
0.003228200366720557,
0.0005861810641363263,
0.002557360799983144,
-0.013550586998462677,
-0.0021630043629556894,
-0.007922056131064892,
-0.00900297611951828,
0.011386189609766006,
-0.0010471442947164178,
0.007330256048589945,
0.010311068035662174,
-0.00028322875732555985,
-0.014272889122366905,
0.006051200907677412,
0.007538939360529184,
-0.004595579579472542,
0.0061277966015040874,
0.0051171788945794106,
-0.0007037998293526471,
-0.02073170803487301,
0.000022833390175946988,
-0.015746423974633217,
0.00506357429549098,
-0.0019060460617765784,
0.003087790682911873,
-0.006720332894474268,
0.010363238863646984,
0.004396900534629822,
-0.010022629983723164,
-0.0031198288779705763,
-0.00785976555198431,
0.00797610729932785,
-0.0016604721313342452,
-0.0014607410412281752,
-0.0037535675801336765,
0.0019539725035429,
-0.00539720244705677,
-0.003981585614383221,
0.0013986272970214486,
0.006268290337175131,
0.003796538570895791,
-0.007806953974068165,
-0.0008318671025335789,
-0.00480372179299593,
0.0004670912167057395,
0.005015656352043152,
-0.0140849519520998,
-0.0013852511765435338,
0.013252713717520237,
-0.0019087637774646282,
-0.0036933128722012043,
-0.005023703444749117,
-0.0018218401819467545,
-0.004874295089393854,
-0.00926639698445797,
-0.00327950157225132,
-0.00525618577376008,
-0.004768248647451401,
-0.010338475927710533,
-0.00017979354015551507,
-0.005184456240385771,
0.0069455960765480995,
-0.006792792584747076,
0.009501822292804718,
0.007373051717877388,
-0.005373677238821983,
0.008567861281335354,
-0.004103720188140869,
0.004574350547045469,
0.004900505766272545,
0.0024073792155832052,
0.000795984931755811,
-0.011547490954399109,
-0.012074789963662624,
0.017475562170147896,
-0.00905556883662939,
-0.002040092833340168,
0.013386433944106102,
0.0041403258219361305,
0.011850617825984955,
0.0008876210195012391,
0.00004368689042166807,
0.004690251778811216,
0.008669517934322357,
-0.011652280576527119,
0.0025312798097729683,
0.0013210201868787408,
-0.0017078163800761104,
0.00863635540008545,
-0.003251168178394437,
0.004673807416111231,
0.007158290129154921,
-0.0010539982467889786,
-0.009730678983032703,
-0.0019511128775775433,
-0.001662716967985034,
0.002469193423166871,
-0.010843031108379364,
0.0001782361650839448,
-0.005243418272584677,
-0.0023314261343330145,
-0.005317948292940855,
-0.001211034134030342,
-0.0016586126293987036,
0.0015803648857399821,
-0.0038267828058451414,
0.00315790344029665,
0.0030987176578491926,
-0.004856848157942295,
0.015180721879005432,
-0.008263984695076942,
-0.0057352446019649506,
-0.0004506221448536962,
0.0019230337347835302,
0.004081635270267725,
-0.007662017364054918,
-0.0000412509725720156,
0.0031553825829178095,
0.004107907880097628,
-0.0021413478534668684,
-0.004993113223463297,
-0.003125191666185856,
0.002105710096657276,
-0.007394707296043634,
0.004253467079252005,
0.01311187632381916,
-0.0019574600737541914,
0.003059416776522994,
-0.0037188720889389515,
-0.008462997153401375,
-0.011617119424045086,
0.05776963010430336,
-0.0034619695506989956,
0.0006927141221240163,
0.004679138772189617,
-0.007292359601706266,
-0.003234553150832653,
-0.001853233901783824,
0.004233758430927992,
-0.00750602874904871,
-0.007461630739271641,
0.009382304735481739,
-0.004139121621847153,
-0.0017432767199352384,
-0.001711377059109509,
-0.006183294579386711,
0.00909693818539381,
-0.0033780483063310385,
-0.013372430577874184,
-0.01660712994635105,
0.004100065678358078,
-0.007009913679212332,
-0.009747538715600967,
0.008684996515512466,
-0.001987515250220895,
-0.003757659811526537,
0.00186367507558316,
0.0020354262087494135,
0.0036281454376876354,
0.0019318367121741176,
-0.0011860586237162352,
0.000008822331437841058,
-0.0039923712611198425,
0.002539881970733404,
0.0071149845607578754,
0.008714444935321808,
-0.005812484305351973,
0.00743430620059371,
-0.001698197447694838,
-0.0017072443151846528,
0.001966006588190794,
0.004372197203338146,
0.00846056267619133,
-0.0008193663670681417,
-0.001913292333483696,
0.004843497183173895,
0.007409294601529837,
0.003068619640544057,
0.013670387677848339,
0.0011782464571297169,
-0.002366862492635846,
0.006513967178761959,
0.008531796745955944,
0.0011572481598705053,
0.008556302636861801,
-0.0041711898520588875,
0.0038304112385958433,
0.0019861452747136354,
-0.004449678119271994,
-0.016236629337072372,
0.0008339924388565123,
0.0035705219488590956,
0.005511871073395014,
-0.00005264049832476303,
0.005613757763057947,
-0.0005033871857449412,
-0.0010028895922005177,
-0.006785763893276453,
-0.00337740546092391,
-0.0023998648393899202,
0.0013718940317630768,
-0.001512676477432251,
0.07102299481630325,
-0.006705159787088633,
-0.0009098712471313775,
-0.009556040167808533,
-0.00018788318266160786,
-0.0035415315069258213,
-0.003962228540331125,
-0.0024337118957191706,
-0.0006915244739502668,
-0.002054088981822133,
0.008083142340183258,
-0.008302879519760609,
-0.0073194741271436214,
0.0021281223744153976,
0.0026299934834241867,
-0.0008655014098621905,
0.006757911294698715,
0.007672606501728296,
-0.005074006505310535,
0.004935070872306824,
-0.01192203164100647,
-0.003030369058251381,
-0.0038452239241451025,
-0.004913126118481159,
-0.005310314707458019,
-0.0022648656740784645,
0.0027937074191868305,
0.0029522289987653494,
0.007076074369251728,
-0.005169214680790901,
0.009065881371498108,
-0.006967875640839338,
0.0008717255550436676,
-0.0011341780191287398,
-0.004092849791049957,
-0.010278145782649517,
0.00257585640065372,
0.0019035502336919308,
-0.009964394383132458,
-0.002256151055917144,
-0.0034029721282422543,
-0.004955310374498367,
-0.0019372331444174051,
0.007899375632405281,
0.0009433598024770617,
0.009702736511826515,
-0.0014329416444525123,
0.0012665216345340014,
-0.006570377387106419,
0.0024991349782794714,
-0.015609228052198887,
0.0008583901799283922,
-0.1784636527299881,
0.013537510298192501,
0.005073736887425184,
-0.006037070881575346,
-0.004991512279957533,
-0.015014652162790298,
-0.007635010406374931,
0.0010120962979272008,
0.011156342923641205,
-0.00011099474068032578,
-0.0004231770581100136,
-0.002038876758888364,
0.0001418363390257582,
0.002432317705824971,
-0.004909040872007608,
-0.0063766674138605595,
0.004183005541563034,
-0.006291689816862345,
0.000987623236142099,
0.008279363624751568,
0.005771888419985771,
0.005865170154720545,
0.004201987292617559,
-0.002941085724160075,
-0.0000792064456618391,
-0.0038419044576585293,
0.0021548864897340536,
-0.0006926975911483169,
0.006361860316246748,
-0.008337440900504589,
-0.004955519922077656,
-0.0013944045640528202,
-0.006421580910682678,
-0.0002379035868216306,
0.0037978754844516516,
-0.002207009354606271,
0.0069826445542275906,
0.0004533829924184829,
-0.006380391772836447,
0.0043246205896139145,
-0.006458583753556013,
0.028923798352479935,
0.005493688862770796,
0.006979287136346102,
-0.0017250583041459322,
-0.00020080535614397377,
-0.005812444724142551,
0.013522598892450333,
0.0021628185641020536,
0.010847153142094612,
-0.010059848427772522,
-0.006628026720136404,
0.002340385690331459,
0.017573295161128044,
-0.0046508279629051685,
-0.008859260007739067,
-0.007916354574263096,
-0.007334561087191105,
0.003158105304464698,
0.01211567036807537,
0.011133632622659206,
-0.00533386180177331,
0.013481749221682549,
-0.0005410949815995991,
-0.019536981359124184,
0.0010649310424923897,
-0.001716594211757183,
-0.010198745876550674,
0.000857918756082654,
0.006217544432729483,
0.00838162936270237,
-0.00106000283267349,
0.005253253970295191,
-0.0021145299542695284,
0.006274224724620581,
0.001721293549053371,
0.0030679155606776476,
-0.0031972117722034454,
0.0026957616209983826,
-0.00921374000608921,
0.011721538379788399,
-0.01038062758743763,
-0.0038980389945209026,
0.003819260513409972,
-0.005418956279754639,
0.011434730142354965,
0.0066993157379329205,
0.0005454396014101803,
0.0044464305974543095,
-0.011296241544187069,
0.000019088529370492324,
-0.004817772191017866,
0.0006621539941988885,
-0.009320982731878757,
0.005295029375702143,
0.00019865036301780492,
0.00586680369451642,
0.006273792590945959,
-0.005958792753517628,
0.009058342315256596,
0.007223750930279493,
-0.0046495189890265465,
0.0016097542829811573,
-0.007939377799630165,
0.003302068682387471,
0.004759965464472771,
-0.004680701997131109,
-0.008007933385670185,
0.004671244416385889,
-0.005819423124194145,
-0.0027360094245523214,
0.005720778834074736,
-0.012435325421392918,
-0.010027803480625153,
-0.00347688514739275,
-0.011021439917385578,
0.001809792360290885
] |
8a62e622419e3b5175ed6a324e076188b956be4c | 2,313 | py | Python | azure-devops/azext_devops/vstsCompressed/service_hooks/v4_0/models/__init__.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | null | null | null | azure-devops/azext_devops/vstsCompressed/service_hooks/v4_0/models/__init__.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | 37 | 2020-04-27T07:45:19.000Z | 2021-04-05T07:27:15.000Z | azure-devops/azext_devops/vstsCompressed/service_hooks/v4_0/models/__init__.py | vijayraavi/azure-devops-cli-extension | 88f1420c5815cb09bea15b050f4c553e0f326dad | [
"MIT"
] | null | null | null | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------
from .models import Consumer
from .models import ConsumerAction
from .models import Event
from .models import EventTypeDescriptor
from .models import ExternalConfigurationDescriptor
from .models import FormattedEventMessage
from .models import IdentityRef
from .models import InputDescriptor
from .models import InputFilter
from .models import InputFilterCondition
from .models import InputValidation
from .models import InputValue
from .models import InputValues
from .models import InputValuesError
from .models import InputValuesQuery
from .models import Notification
from .models import NotificationDetails
from .models import NotificationResultsSummaryDetail
from .models import NotificationsQuery
from .models import NotificationSummary
from .models import Publisher
from .models import PublisherEvent
from .models import PublishersQuery
from .models import ReferenceLinks
from .models import ResourceContainer
from .models import SessionToken
from .models import Subscription
from .models import SubscriptionsQuery
from .models import VersionedResource
__all__ = [
'Consumer',
'ConsumerAction',
'Event',
'EventTypeDescriptor',
'ExternalConfigurationDescriptor',
'FormattedEventMessage',
'IdentityRef',
'InputDescriptor',
'InputFilter',
'InputFilterCondition',
'InputValidation',
'InputValue',
'InputValues',
'InputValuesError',
'InputValuesQuery',
'Notification',
'NotificationDetails',
'NotificationResultsSummaryDetail',
'NotificationsQuery',
'NotificationSummary',
'Publisher',
'PublisherEvent',
'PublishersQuery',
'ReferenceLinks',
'ResourceContainer',
'SessionToken',
'Subscription',
'SubscriptionsQuery',
'VersionedResource',
]
| 33.042857 | 94 | 0.685257 | 1 | 1.2651 | [
0.0031411047093570232,
0.025212189182639122,
0.00913479458540678,
0.0013107277918606997,
0.0031217944342643023,
-0.0038195352535694838,
-0.011721604503691196,
0.004061865620315075,
-0.007018604315817356,
0.0027162875048816204,
0.005089180544018745,
0.00344935548491776,
0.008862242102622986,
-0.017363114282488823,
0.0021229549311101437,
0.019267339259386063,
-0.05627917870879173,
0.0027447582688182592,
-0.004592485260218382,
0.001557083218358457,
-0.007117955479770899,
0.00889368262141943,
0.01154040265828371,
0.007265329360961914,
0.007092862389981747,
-0.0006600671913474798,
0.009602785110473633,
0.0033197214361280203,
-0.00884330552071333,
-0.006191630382090807,
-0.00042268511606380343,
-0.0039216033183038235,
-0.005959798581898212,
-0.009510879404842854,
0.006582819391041994,
-0.004791857674717903,
0.00027620341279543936,
-0.01926029846072197,
0.012445222586393356,
-0.00484373327344656,
-0.00882558524608612,
-0.017335237935185432,
-0.0011472858022898436,
0.006023240741342306,
-0.00993516854941845,
0.0005672001861967146,
-0.003043348668143153,
0.003307390259578824,
-0.010330281220376492,
0.004323404747992754,
-0.00958861131221056,
0.0047562699764966965,
0.01447498518973589,
0.0025976377073675394,
-0.006247485522180796,
-0.0055800736881792545,
0.012563099153339863,
0.0008436758653260767,
-0.011647224426269531,
-0.000008276230801129714,
-0.002007286064326763,
-0.002336591947823763,
0.005921961273998022,
0.003297664225101471,
-0.018987946212291718,
-0.005584818311035633,
-0.0042851772159338,
0.0016734787495806813,
-0.0016675717197358608,
0.004314478952437639,
0.0013380494201555848,
-0.0016455440782010555,
0.0045980773866176605,
0.004665173124521971,
0.003988492768257856,
-0.0024988502264022827,
-0.0020944392308592796,
0.003185626119375229,
0.006957794073969126,
0.0019090295536443591,
0.0036493910010904074,
-0.007575421594083309,
0.004701059311628342,
0.011832255870103836,
0.01385481283068657,
0.009136020205914974,
0.018849587067961693,
-0.01194914523512125,
0.04460469260811806,
0.004254152067005634,
-0.009873655624687672,
0.0020674988627433777,
-0.008484343066811562,
-0.0012266606790944934,
-0.0035553639754652977,
-0.026697758585214615,
-0.0011281851911917329,
-0.004947023466229439,
0.00006097297591622919,
0.0042436919175088406,
-0.0007400913746096194,
0.006275959312915802,
0.00038485138793475926,
-0.0012430472997948527,
-0.008496605791151524,
0.012538701295852661,
-0.00881437212228775,
-0.003991524688899517,
0.006053432356566191,
0.002631610492244363,
-0.012825079262256622,
-0.0013546267291530967,
0.0027397971134632826,
-0.012923603877425194,
0.003155479207634926,
0.003058849833905697,
-0.006502722389996052,
0.056973010301589966,
-0.0009286120184697211,
0.004299851134419441,
-0.0046998923644423485,
-0.0004546003183349967,
-0.00008083525608526543,
0.008527270518243313,
0.009434342384338379,
-0.004728450905531645,
0.008982419036328793,
0.0065545011311769485,
0.004465608391910791,
0.006351096089929342,
-0.0025619026273489,
0.007683186326175928,
-0.004668873269110918,
-0.0024982504546642303,
-0.00022394119878299534,
-0.007344322744756937,
0.0077500916086137295,
-0.0027377265505492687,
-0.005156731698662043,
-0.0019078479381278157,
-0.0013845806242898107,
-0.009854502975940704,
0.0010859115282073617,
-0.005467433016747236,
0.0025675809010863304,
-0.01317170076072216,
-0.0017407845007255673,
-0.001782663050107658,
-0.004791530780494213,
0.003373919054865837,
0.008536214008927345,
0.005629606544971466,
0.0033712482545524836,
-0.0060703749768435955,
-0.00687746237963438,
0.0014912078622728586,
-0.0037077574525028467,
0.003672646591439843,
0.00947697926312685,
0.0037213682662695646,
-0.007975045591592789,
-0.0018483194289729,
0.003017537295818329,
0.002997140632942319,
-0.0025323473382741213,
0.001505945692770183,
-0.009050623513758183,
0.00789914932101965,
0.0000011695318562487955,
0.006111056078225374,
0.011051799170672894,
-0.006170825567096472,
-0.0004931697039864957,
0.00018904905300587416,
0.004432768560945988,
-0.00006809445039834827,
0.004054584074765444,
0.007320039439946413,
-0.005025908350944519,
-0.0028158528730273247,
0.00259436946362257,
0.0067278556525707245,
0.009260930120944977,
0.007189078722149134,
-0.002337397076189518,
0.0009161752532236278,
-0.006156655494123697,
-0.0000536817497049924,
0.005756714381277561,
-0.005208694376051426,
0.006939953193068504,
0.0021803195122629404,
-0.01575777679681778,
-0.00668749213218689,
0.000979238422587514,
-0.00920483935624361,
0.0001312523236265406,
0.016456138342618942,
0.011865368112921715,
-0.0032807704992592335,
0.00495150126516819,
-0.007249889429658651,
0.0022304230369627476,
0.004064834676682949,
0.0012474947143346071,
-0.012171855196356773,
-0.9564765095710754,
0.004660582169890404,
0.0024898741394281387,
-0.0011569372145459056,
0.004358033183962107,
0.0006992313428781927,
0.004571493715047836,
0.0025833123363554478,
0.014385025016963482,
-0.008370389230549335,
-0.0059962281957268715,
-0.009068959392607212,
-0.011335578747093678,
0.0003027265483979136,
-0.006429822649806738,
-0.0018930814694613218,
-0.006054611876606941,
-0.007890071719884872,
0.00040442319004796445,
-0.005493619944900274,
-0.0028235807549208403,
0.009281131438910961,
-0.002319179940968752,
0.006127726286649704,
0.004686643835157156,
0.002761630807071924,
-0.00395245524123311,
-0.002486584475263953,
-0.0022458944004029036,
-0.001906093442812562,
-0.005883962847292423,
-0.01612524874508381,
-0.0069456566125154495,
-0.0005374886677600443,
0.011160875670611858,
0.0003953423001803458,
0.010159922763705254,
-0.0030394387431442738,
0.004944076295942068,
-0.008094346150755882,
0.005043593235313892,
0.0007177336956374347,
0.002560239750891924,
-0.02948346734046936,
0.0019623420666903257,
-0.000421679113060236,
-0.005148501135408878,
0.009716799482703209,
0.000447814934886992,
-0.00161489169113338,
-0.0027815091889351606,
-0.004461891483515501,
0.008565999567508698,
-0.007158024702221155,
0.005020963028073311,
-0.00531915295869112,
-0.005940361879765987,
-0.0016203791601583362,
-0.009267196990549564,
0.0010559090878814459,
0.0025916178710758686,
-0.0035678052809089422,
-0.004812394734472036,
-0.004994017072021961,
0.00460263155400753,
0.002352180890738964,
-0.00006279260560404509,
-0.0181408878415823,
-0.006043551489710808,
-0.002682649064809084,
0.003131086938083172,
-0.0030585606582462788,
-0.0036952898371964693,
0.0043770014308393,
-0.009828433394432068,
0.00741024361923337,
0.0016405063215643167,
0.0018743212567642331,
-0.01134466752409935,
0.0012838918482884765,
-0.008454342372715473,
-0.0077933999709784985,
0.0016702988650649786,
-0.003038631286472082,
-0.004028694238513708,
-0.0008419774239882827,
0.002862001536414027,
0.008183639496564865,
-0.004028829280287027,
0.0036658793687820435,
0.011230318807065487,
-0.004408580716699362,
-0.008061771281063557,
0.006747081410139799,
0.007875845767557621,
0.0007650802144780755,
-0.002527864882722497,
0.0003971604455728084,
0.009711772203445435,
0.007650318555533886,
0.005083142314106226,
0.006564068142324686,
0.00028697337256744504,
0.012220277450978756,
0.00008817809430183843,
0.0023114110808819532,
-0.0026216504629701376,
-0.0018593408167362213,
-0.004488654434680939,
-0.003335974644869566,
-0.004489796701818705,
-0.003146270988509059,
-0.01132713072001934,
-0.010213441215455532,
-0.0009270618902519345,
-0.000462197232991457,
0.0009217812330462039,
-0.0031267402227967978,
-0.0004465239471755922,
0.0027182523626834154,
0.010711449198424816,
0.0022457162849605083,
-0.004460523370653391,
0.0016683227149769664,
0.0024757850915193558,
-0.008743254467844963,
0.0160947535187006,
-0.013821720145642757,
0.00819911528378725,
-0.0008908472955226898,
-0.015216139145195484,
0.0089502464979887,
0.008871507830917835,
-0.009287997148931026,
0.0013161293463781476,
0.003641990479081869,
0.006417825352400541,
0.0026512013282626867,
-0.0034967598039656878,
-0.004345450550317764,
-0.01718730479478836,
-0.00026119634276255965,
0.020157411694526672,
0.0011621015146374702,
0.010144111700356007,
0.012312782928347588,
-0.004221283830702305,
0.0016169437440112233,
0.00437620934098959,
0.002678536344319582,
0.012861747294664383,
-0.009411458857357502,
0.00011427015124354511,
0.0037072545383125544,
-0.006091377232223749,
0.0004976380150765181,
0.004934634547680616,
0.007407722529023886,
-0.004124114289879799,
0.0021608383394777775,
-0.004577168729156256,
-0.003215450095012784,
-0.018528731539845467,
-0.0006306110299192369,
0.007032631430774927,
-0.005661293398588896,
0.004612349439412355,
-0.011552613228559494,
0.005811414681375027,
0.003700405824929476,
0.0010460242629051208,
-0.0012457112316042185,
-0.00013612279144581407,
0.0063455188646912575,
0.012801546603441238,
-0.006736391689628363,
0.002166507299989462,
0.002582162618637085,
-0.00023452704772353172,
0.0016134356847032905,
0.00995086319744587,
-0.00779643515124917,
-0.003658466273918748,
0.0029695602133870125,
0.004131589084863663,
-0.00032332251430489123,
-0.005190332420170307,
-0.009775061160326004,
-0.0024771098978817463,
0.002105887746438384,
-0.004502105060964823,
0.003665151773020625,
0.0013468628749251366,
0.004470219835639,
-0.005717503372579813,
0.001208062400110066,
-0.0016899240436032414,
-0.012297727167606354,
0.010531769134104252,
-0.0021910960786044598,
0.002946307882666588,
0.014293189160525799,
0.0026600321289151907,
-0.014239072799682617,
0.004327684640884399,
0.009673885069787502,
-0.003877531737089157,
0.0052779847756028175,
0.005189195740967989,
-0.004857162479311228,
-0.02415916696190834,
0.0014459665399044752,
-0.01366101112216711,
0.007705289870500565,
-0.0016332266386598349,
0.003840833203867078,
-0.007437152788043022,
0.008356154896318913,
0.0068574333563447,
-0.013120412826538086,
-0.005380996968597174,
-0.010171648114919662,
0.010349391028285027,
-0.0021141746547073126,
-0.002434305613860488,
-0.003383425297215581,
-0.0022105497773736715,
-0.003949275240302086,
-0.002853129291906953,
-0.0009408908663317561,
0.00762230483815074,
0.0014172712108120322,
-0.005587812978774309,
0.0017229971708729863,
-0.00408254424110055,
0.0016517278272658587,
0.0019390906672924757,
-0.010593686252832413,
0.0009541961480863392,
0.0040703727863729,
0.00007492429722333327,
-0.003110332414507866,
0.0010837302543222904,
-0.00003741566251846962,
-0.007556450087577105,
-0.012086651287972927,
-0.0021579281892627478,
-0.005544113460928202,
-0.0041607581079006195,
-0.012602006085216999,
-0.0014400685904547572,
-0.00814122799783945,
0.0033793023321777582,
-0.006456617731601,
0.009443914517760277,
0.004522028844803572,
-0.003812805050984025,
0.006113545969128609,
-0.0016555811744183302,
0.0032571551855653524,
0.004570117220282555,
0.007602018304169178,
-0.0015077530406415462,
-0.006176402792334557,
-0.009445982053875923,
0.009785161353647709,
-0.009117682464420795,
-0.0005684782518073916,
0.011637948453426361,
0.00480242446064949,
0.009019111283123493,
0.0016802354948595166,
0.000013797647625324316,
0.004874432925134897,
0.007989552803337574,
-0.013249056413769722,
0.002393060363829136,
-0.0012296909699216485,
-0.0025921359192579985,
0.007230711169540882,
-0.004780696239322424,
0.005736491177231073,
0.007315264083445072,
0.00048136175610125065,
-0.00905592180788517,
-0.0010328369680792093,
0.0006023684400133789,
0.003355053486302495,
-0.012060031294822693,
0.002050823764875531,
-0.003558029653504491,
-0.00409544026479125,
-0.0027895085513591766,
-0.0018834565998986363,
-0.000795951928012073,
0.0055081481114029884,
-0.0025705555453896523,
0.006350395269691944,
0.0007700847345404327,
-0.0038294135592877865,
0.013525573536753654,
-0.006935937330126762,
-0.006490402389317751,
0.0011461037211120129,
0.001529843546450138,
-0.00003640361683210358,
-0.006962548475712538,
-0.0011651844251900911,
0.0012283000396564603,
0.004819327965378761,
-0.005887101870030165,
-0.004749782849103212,
-0.0015405045123770833,
0.003083385294303298,
-0.006942278239876032,
0.002586720511317253,
0.009050355292856693,
-0.0022819049190729856,
0.0037114950828254223,
-0.0016175867058336735,
-0.006594761740416288,
-0.013595116324722767,
0.05527262017130852,
-0.003289122600108385,
0.0043614148162305355,
0.003939648158848286,
-0.006673756521195173,
-0.002135594841092825,
-0.002583080669865012,
0.006609463132917881,
-0.005348156671971083,
-0.006045108661055565,
0.007373047526925802,
-0.006988584529608488,
0.0033966132905334234,
-0.001960315741598606,
-0.0023418942000716925,
0.012785729952156544,
-0.006303644739091396,
-0.018746932968497276,
-0.014291537925601006,
0.006864901166409254,
-0.0021410209592431784,
-0.00720684789121151,
0.009001302532851696,
-0.0017889156006276608,
-0.005297380965203047,
0.0005369019927456975,
0.006206835620105267,
-0.00007399629976134747,
-0.0019040914485231042,
-0.0022524292580783367,
-0.0020415904000401497,
-0.0031755934469401836,
0.0031883236952126026,
0.007721516769379377,
0.007735753897577524,
-0.0031998162157833576,
0.005532787647098303,
-0.0030075740069150925,
0.0005961627466604114,
-0.0013980289222672582,
0.006135647650808096,
0.005366604309529066,
-0.0019843096379190683,
0.00023080762184690684,
0.005061919800937176,
0.00619669770821929,
0.0014491963665932417,
0.012781728990375996,
0.001224592444486916,
-0.005179605446755886,
0.009406160563230515,
0.008952146396040916,
0.0009189640986733139,
0.007195953279733658,
-0.003891898784786463,
0.006632785778492689,
0.0006409785128198564,
-0.007457531988620758,
-0.016244562342762947,
-0.00012812482600566,
0.008090713061392307,
0.006248315330594778,
-0.003232631366699934,
0.0012830843916162848,
-0.0014438405632972717,
-0.0026881457306444645,
-0.006403142120689154,
-0.004807220306247473,
-0.0023997840471565723,
-0.0005738596082665026,
0.0060465894639492035,
0.06800553947687149,
-0.006796423811465502,
-0.00218809861689806,
-0.008044584654271603,
-0.0014698769664391875,
-0.004485624376684427,
-0.002792455954477191,
-0.0012569816317409277,
-0.0019990645814687014,
-0.0009063022444024682,
0.003402772592380643,
-0.008563407696783543,
-0.01018291711807251,
0.0010634454665705562,
0.0017488420708104968,
-0.0029703560285270214,
0.005761702079325914,
0.007927539758384228,
-0.00956236943602562,
0.0043570431880652905,
-0.010780347511172295,
-0.0031720944680273533,
-0.005412620957940817,
-0.010658171027898788,
-0.0035302124451845884,
-0.0034194947220385075,
0.00446435296908021,
0.0036964283790439367,
0.007984447292983532,
-0.003896852256730199,
0.008134107105433941,
-0.0012607334647327662,
0.0016248843166977167,
-0.004027277231216431,
0.000037613044696627185,
-0.006540610920637846,
0.0052417004480957985,
0.0023524619173258543,
-0.011377527378499508,
-0.0035005563404411077,
-0.00467862281948328,
-0.0022788553033024073,
-0.003958955407142639,
0.004215620923787355,
0.0011343564838171005,
0.005535209085792303,
-0.001755493343807757,
0.0013219887623563409,
-0.004769096150994301,
0.0025852611288428307,
-0.013084002770483494,
0.004680647049099207,
-0.1814505159854889,
0.008436894044280052,
0.003630228340625763,
-0.004769592545926571,
-0.0036985541228204966,
-0.015222487971186638,
-0.005800559185445309,
0.0032540892716497183,
0.009554320015013218,
0.00047590635949745774,
-0.00209073000587523,
-0.003303778124973178,
0.00332330702804029,
0.0031803110614418983,
-0.0019327980699017644,
-0.003794237971305847,
0.0038802444469183683,
-0.005759057588875294,
0.0015132660046219826,
0.005066024139523506,
0.005374070256948471,
0.00663365563377738,
0.00333368219435215,
0.0006516974535770714,
-0.0007979210931807756,
-0.0022454175632447004,
0.004447196610271931,
-0.00278392992913723,
0.005823731888085604,
-0.014069302007555962,
-0.002998888259753585,
-0.006091316230595112,
-0.003880213014781475,
0.0035573579370975494,
0.0032091038301587105,
0.001049394952133298,
0.010811824351549149,
0.0005707573145627975,
-0.0059668030589818954,
0.006794898770749569,
-0.007380321621894836,
0.027807626873254776,
0.006968436297029257,
0.006124987732619047,
-0.001376333530060947,
-0.004276745021343231,
-0.003903387114405632,
0.008567998185753822,
0.0035742521286010742,
0.011570580303668976,
-0.012284515425562859,
-0.0027903232257813215,
0.004434006754308939,
0.01789306290447712,
-0.0058271498419344425,
-0.010799715295433998,
-0.007185458205640316,
-0.006201483309268951,
0.0013028027024120092,
0.008798531256616116,
0.009441863745450974,
-0.004631516989320517,
0.009398107416927814,
-0.0023277548607438803,
-0.024522675201296806,
0.0034991707652807236,
-0.0027259960770606995,
-0.007133086211979389,
0.003988716285675764,
0.0058671957813203335,
0.009417571127414703,
-0.0013009713729843497,
0.001422021770849824,
-0.0009658696362748742,
0.0033721679355949163,
-0.000012382162822177634,
0.006062482949346304,
-0.0002817779022734612,
0.004606258124113083,
-0.009855099022388458,
0.007500841282308102,
-0.007831008173525333,
-0.002980118617415428,
0.004605791997164488,
-0.0040413811802864075,
0.012503862380981445,
0.004154796712100506,
-0.0019884766079485416,
0.0006437393603846431,
-0.01093253679573536,
-0.0008467533043585718,
0.0034920568577945232,
0.002808985998854041,
-0.008210250176489353,
0.002431181725114584,
0.0008813939639367163,
0.003345541190356016,
0.0062657613307237625,
-0.01032374519854784,
0.006862820126116276,
0.007925303652882576,
-0.0051281750202178955,
-0.0008162689628079534,
-0.006967507302761078,
0.0020635509863495827,
0.0017478460213169456,
-0.007486742455512285,
-0.007546602748334408,
0.0013389119412750006,
-0.006270999554544687,
-0.0063361721113324165,
0.005819840356707573,
-0.012443575076758862,
-0.0074178362265229225,
-0.0017408615676686168,
-0.009795320220291615,
0.0022644426207989454
] |
8a643abfeb244244f7979e846782a5b379e9f35e | 935 | py | Python | pizdyuk/pzd_logging.py | DeathAdder1999/Pizdyuk | 3fd7c71508c79b36e3cc801d78cd1a87eee5aa0b | [
"Apache-2.0"
] | 1 | 2021-05-06T20:23:08.000Z | 2021-05-06T20:23:08.000Z | pizdyuk/pzd_logging.py | aufdnb/Pizdyuk | 75096ffa54df831eb05360d7b39f49000d466f80 | [
"Apache-2.0"
] | null | null | null | pizdyuk/pzd_logging.py | aufdnb/Pizdyuk | 75096ffa54df831eb05360d7b39f49000d466f80 | [
"Apache-2.0"
] | null | null | null | import datetime as date
from pzd_utils import datetime_to_str
class PizdyukLogger:
__logger = None
def __init__(self):
global __logger
if self.__logger:
raise RuntimeError("Logger instance already exists")
@staticmethod
def get_logger():
global __logger
if not PizdyukLogger._PizdyukLogger__logger:
PizdyukLogger._PizdyukLogger__logger = PizdyukLogger()
return PizdyukLogger._PizdyukLogger__logger
def log_info(self, msg):
self.__log(msg, "INFO")
def log_warning(self, warning):
self.__log(warning, "WARNING")
def log_error(self, error):
self.__log(error, "ERROR")
def log_fatal(self, fatal):
self.__log(fatal, "FATAL")
def __log(self, msg, lvl):
date_str = datetime_to_str(date.datetime.now())
log = "[{0}] [{1}] {2}".format(lvl, date_str, msg)
print(log)
| 25.27027 | 66 | 0.632086 | 1 | 0.9816 | [
0.0008815481560304761,
0.025451159104704857,
0.007515189703553915,
-0.0020466968417167664,
0.007164730224758387,
-0.0019936105236411095,
-0.015083291567862034,
0.003650485072284937,
-0.008928493596613407,
0.0017506462754681706,
0.0007874132716096938,
0.0040781437419354916,
0.009110629558563232,
-0.01841362565755844,
-0.0017805966781452298,
0.01455316599458456,
-0.058686744421720505,
0.004080392420291901,
-0.005417403299361467,
0.004772459156811237,
-0.008066440001130104,
0.013492627069354057,
0.008318564854562283,
0.010716188699007034,
0.010676855221390724,
0.000650673930067569,
0.007404355797916651,
0.000569699564948678,
-0.010348346084356308,
-0.0060264794155955315,
0.002666724845767021,
-0.0006560665788128972,
-0.007228390779346228,
-0.006882108747959137,
0.008401535451412201,
-0.001624958822503686,
-0.0014578338013961911,
-0.018544526770710945,
0.010702692903578281,
-0.006486453115940094,
-0.008691547438502312,
-0.015490596182644367,
-0.003457864513620734,
0.00623343326151371,
-0.01036807894706726,
-0.000641070946585387,
-0.007745668292045593,
0.006256695371121168,
-0.009574814699590206,
0.004951603710651398,
-0.009813216514885426,
0.0030213496647775173,
0.012650148943066597,
0.000029607388569274917,
-0.007898771204054356,
-0.0074588279239833355,
0.014392118901014328,
0.0016284278826788068,
-0.01258144062012434,
-0.001145299058407545,
-0.00458698021247983,
-0.0031257292721420527,
0.006493605673313141,
0.004252152051776648,
-0.016326099634170532,
-0.006396154407411814,
-0.008710511960089207,
-0.0002920387196354568,
-0.002374630654230714,
0.007864451967179775,
0.0013318534474819899,
-0.0032772573176771402,
0.009692558087408543,
0.003939440008252859,
0.002728668972849846,
-0.00859877746552229,
-0.001131113851442933,
0.00040118381730280817,
0.00753782270476222,
0.0016451634000986814,
0.00665223179385066,
-0.00988735631108284,
0.008821272291243076,
0.011524422094225883,
0.0134325185790658,
0.01000900473445654,
0.020218782126903534,
-0.01227570790797472,
0.043139275163412094,
0.004616490099579096,
-0.01101427897810936,
0.00002307038266735617,
-0.009863325394690037,
-0.004991875030100346,
-0.00030319191864691675,
-0.03148157149553299,
0.0007474295562133193,
-0.002431320957839489,
0.00043038453441113234,
0.0057813688181340694,
0.003303661709651351,
0.003664381569251418,
-0.0015354874776676297,
-0.0007888910477049649,
-0.008254011161625385,
0.013663098216056824,
-0.01136336661875248,
-0.0021611489355564117,
0.00807931274175644,
-0.002293238416314125,
-0.010126409120857716,
-0.00027551528182812035,
0.0017698095180094242,
-0.014504127204418182,
0.0021617638412863016,
0.0011968107428401709,
-0.0040122140198946,
0.05650583282113075,
0.0009300290257669985,
0.0032500845845788717,
-0.004464576952159405,
0.002153848297894001,
0.0003595316084101796,
0.005718040745705366,
0.0077563743107020855,
-0.003747935639694333,
0.014120327308773994,
0.005375835578888655,
0.0021637799218297005,
0.006090897601097822,
0.0010971807641908526,
0.005892718676477671,
-0.006104323547333479,
-0.0003083198971580714,
0.0003951115068048239,
-0.006274479907006025,
0.007101517170667648,
-0.0013500311179086566,
-0.007940026000142097,
-0.0000644160172669217,
-0.0020739473402500153,
-0.015429845079779625,
0.0011657600989565253,
-0.001444239285774529,
-0.00045002673869021237,
-0.009926512837409973,
-0.004353058058768511,
-0.0024461213033646345,
-0.002208527410402894,
0.0014204761246219277,
0.009628744795918465,
0.005915571935474873,
0.0018492091912776232,
-0.004703117068856955,
-0.008628635667264462,
-0.0006813528016209602,
-0.005709875840693712,
0.0025437104050070047,
0.008494085632264614,
0.004963849205523729,
-0.010810045525431633,
-0.0023266065400093794,
0.0028677405789494514,
0.00877495389431715,
0.0036674514412879944,
-0.00003864908285322599,
-0.007924839854240417,
0.010157318785786629,
0.0038718017749488354,
0.0026717265136539936,
0.015016917139291763,
-0.0055572292767465115,
-0.001300051691941917,
0.0026211366057395935,
0.0035681878216564655,
-0.0009073063847608864,
0.006147016305476427,
0.01075721625238657,
-0.004943144507706165,
-0.008394178934395313,
0.007449911441653967,
0.0023684294428676367,
0.005788959097117186,
0.0061018201522529125,
-0.0026247436180710793,
0.0020259430166333914,
-0.003269452601671219,
0.002140477765351534,
0.003734851721674204,
-0.006534371059387922,
0.008034816011786461,
0.004529507365077734,
-0.01787525974214077,
-0.008932373486459255,
-0.00023151325876824558,
-0.010017788968980312,
0.0031144849490374327,
0.020146261900663376,
0.00811413861811161,
0.0007840843172743917,
0.0041204700246453285,
-0.011874222196638584,
-0.00039581905002705753,
0.009816675446927547,
-0.0020998187828809023,
-0.01303935144096613,
-0.9541032910346985,
0.005731010343879461,
0.003966364078223705,
-0.002331613330170512,
0.005690868012607098,
0.001306982827372849,
0.0025654647033661604,
0.0030865720473229885,
0.011669890023767948,
-0.010337961837649345,
-0.010349396616220474,
-0.010677644982933998,
-0.010539041832089424,
-0.0011826688423752785,
-0.0037057294975966215,
-0.0012269106227904558,
-0.006720023695379496,
-0.005628588143736124,
-0.00161925854627043,
-0.005236141383647919,
0.0002261598565382883,
0.006652112118899822,
0.005165592301636934,
0.00282403826713562,
0.0032598357647657394,
0.006045931484550238,
-0.006612253841012716,
-0.0009748442098498344,
0.00020200927974656224,
0.0012530646054074168,
-0.007476880680769682,
-0.014966077171266079,
-0.004780617542564869,
-0.00346651510335505,
0.012296449393033981,
-0.002810845850035548,
0.008021363988518715,
0.0015792159829288721,
-0.0006880604778416455,
-0.008522112853825092,
0.005980229936540127,
0.004155047237873077,
0.0018817824311554432,
-0.03110651485621929,
0.00028374907560646534,
-0.003035477828234434,
-0.010059281252324581,
0.012462576851248741,
0.000893365649972111,
0.0007992180180735886,
-0.0035024459939450026,
-0.003020784119144082,
0.010778422467410564,
-0.007848256267607212,
0.0035039628855884075,
-0.0070406598970294,
-0.005182579625397921,
-0.0016033514402806759,
-0.010459603741765022,
-0.0010348174255341291,
0.004629761446267366,
-0.0020775781013071537,
-0.005335424095392227,
-0.0024845039006322622,
-0.000040659677324583754,
0.0005995992687530816,
-0.0021309738513082266,
-0.01746661588549614,
-0.0064617907628417015,
-0.002796033164486289,
0.005078297574073076,
0.0019999025389552116,
-0.0034269385505467653,
0.003841758007183671,
-0.011169484816491604,
0.007438614033162594,
-0.0008474225178360939,
0.0018931216327473521,
-0.01030806452035904,
0.0003561171470209956,
-0.007914329878985882,
-0.01053643599152565,
0.004197702277451754,
-0.007972930558025837,
-0.003869503503665328,
0.00010831606050487608,
0.0019503384828567505,
0.007730395067483187,
-0.005261325743049383,
0.0010260115377604961,
0.012766977772116661,
-0.003267343621701002,
-0.011006420478224754,
0.007095355074852705,
0.005596977658569813,
0.0034244738053530455,
-0.0008396704215556383,
0.0064667584374547005,
0.009307866916060448,
0.006252049934118986,
-0.0005294173024594784,
0.00337962806224823,
0.004882718436419964,
0.009124360978603363,
0.0011718757450580597,
0.00289047509431839,
0.0013988857390359044,
-0.0012646093964576721,
-0.00697213364765048,
-0.004979133605957031,
-0.005116881337016821,
0.00021019409177824855,
-0.012087005190551281,
-0.008123216219246387,
-0.00529705872759223,
0.001447932911105454,
0.00042515440145507455,
-0.00298224575817585,
0.0009835946839302778,
-0.0001634312211535871,
0.010642336681485176,
0.0014322701608762145,
-0.0038524470292031765,
0.0026636626571416855,
0.00523150572553277,
-0.01019356306642294,
0.014324747025966644,
-0.01379703450948,
0.004534455481916666,
-0.0033560728188604116,
-0.017201269045472145,
0.0067231981083750725,
0.0065745157189667225,
-0.007815203629434109,
0.0009906381601467729,
0.0031806398183107376,
0.002358068712055683,
-0.004978036507964134,
-0.006848330143839121,
-0.007086384575814009,
-0.012830594554543495,
-0.0009117346489802003,
0.024422964081168175,
-0.000747852202039212,
0.011969427578151226,
0.012146547436714172,
-0.003599634161219001,
0.005884661339223385,
0.00826341100037098,
0.0013814280973747373,
0.014318816363811493,
-0.010057571344077587,
0.00035384605871513486,
0.002059941878542304,
-0.004669904243201017,
0.0022298120893538,
0.0018038124544546008,
0.004045426845550537,
-0.005888291168957949,
-0.0014067618176341057,
-0.007122681941837072,
-0.007803488057106733,
-0.017329026013612747,
-0.000003337017233207007,
0.010196170769631863,
-0.006207390688359737,
0.0026960500981658697,
-0.008904335089027882,
0.005148697644472122,
0.005217172671109438,
0.0003825421736110002,
0.0010200077667832375,
0.0028986872639507055,
0.006347840651869774,
0.013443650677800179,
-0.010051186196506023,
0.009086103178560734,
0.002373605500906706,
-0.0001603679556865245,
0.005180412903428078,
0.006579786539077759,
-0.009537998586893082,
-0.005451650358736515,
0.00286307861097157,
0.002360353711992502,
0.0019394122064113617,
-0.0038170982152223587,
-0.007924969308078289,
-0.0011618738062679768,
0.0033625748474150896,
-0.007617418188601732,
0.007455781567841768,
0.003090051468461752,
0.0014189978828653693,
-0.011716154403984547,
-0.002207603072747588,
0.0008455560891889036,
-0.009968222118914127,
0.00929300393909216,
-0.005289778113365173,
0.005030591040849686,
0.010865818709135056,
0.008077222853899002,
-0.014063513837754726,
0.010054927319288254,
0.00864416640251875,
-0.004088006913661957,
0.0043952870182693005,
0.00636719074100256,
-0.004033650737255812,
-0.02060936950147152,
0.0004709599306806922,
-0.013024130836129189,
0.00634126178920269,
-0.005044323857873678,
0.0038534426130354404,
-0.00689488323405385,
0.00926264002919197,
0.0019449982792139053,
-0.012722102925181389,
-0.004436023533344269,
-0.008430982939898968,
0.008973854593932629,
-0.0025420926976948977,
-0.0010966259287670255,
-0.0063805487006902695,
-0.0024574778508394957,
-0.0016959236236289144,
-0.002559552900493145,
-0.00067495321854949,
0.005071274470537901,
0.0025290364865213633,
-0.006771510001271963,
0.00413699122145772,
-0.002894995966926217,
-0.0008823711541481316,
-0.00017470523016527295,
-0.012253539636731148,
0.002334386808797717,
0.009775874204933643,
-0.004552691709250212,
-0.007147706113755703,
0.0027243955992162228,
-0.007542030420154333,
-0.004139558412134647,
-0.01309808436781168,
-0.0042123510502278805,
-0.003579969285055995,
-0.005483346525579691,
-0.007471518125385046,
-0.003680122783407569,
-0.007296109106391668,
0.008012100122869015,
-0.006417891010642052,
0.0035868962295353413,
0.006808249745517969,
-0.0035436770413070917,
0.01070000883191824,
-0.005872671026736498,
0.004249542020261288,
0.0018548843218013644,
0.0074068717658519745,
0.0009981592884287238,
-0.006399074569344521,
-0.010006168857216835,
0.011697906069457531,
-0.009696530178189278,
-0.0015570044051855803,
0.01465784665197134,
0.0042760055512189865,
0.008880582638084888,
0.002818444976583123,
-0.0026729400269687176,
0.0022720685228705406,
0.01003817468881607,
-0.014731655828654766,
0.0023212211672216654,
-0.000348520785337314,
0.0012819203548133373,
0.004299005027860403,
-0.004719576332718134,
0.0018631572602316737,
0.00772401038557291,
0.003278611460700631,
-0.009090639650821686,
-0.0014987470349296927,
-0.004217063542455435,
0.004650866612792015,
-0.011257768608629704,
-0.003405783325433731,
-0.007616426795721054,
-0.005968946032226086,
-0.00571956904605031,
-0.0015534721314907074,
-0.0010038616601377726,
0.008170953951776028,
-0.0024969871155917645,
0.004509918857365847,
0.0020540880504995584,
-0.007123648189008236,
0.01661851815879345,
-0.004937456455081701,
-0.0074974712915718555,
0.0033645776566118,
0.003104831324890256,
-0.0012074095429852605,
-0.008119235746562481,
-0.00008884708222467452,
0.004531409591436386,
0.002902492182329297,
-0.002811844227835536,
-0.006994596682488918,
-0.001347507699392736,
0.0011929566971957684,
-0.0071789976209402084,
0.00047221872955560684,
0.010909711010754108,
0.0012308598961681128,
0.004829227924346924,
0.0000034742081425065408,
-0.004003831185400486,
-0.013968569226562977,
0.05417631193995476,
-0.00006182146171340719,
0.0015098497970029712,
0.00698667299002409,
-0.0064905546605587006,
0.0007547624409198761,
-0.005044495686888695,
0.006602441892027855,
-0.008244182914495468,
-0.006786186248064041,
0.008185303770005703,
-0.004537507425993681,
-0.0022909475956112146,
0.0024029912892729044,
-0.004972775001078844,
0.017095252871513367,
-0.0022567533887922764,
-0.012481744401156902,
-0.015043945051729679,
0.005568584427237511,
-0.004532448016107082,
-0.009100320748984814,
0.0068271043710410595,
-0.0006775379297323525,
-0.0008523574215359986,
0.005202474072575569,
0.004324851091951132,
0.0020453850738704205,
0.00008923252607928589,
-0.0037473211996257305,
-0.0016496240859851241,
-0.0011538934195414186,
0.006418020464479923,
0.0054421559907495975,
0.010782189667224884,
-0.0015158747555688024,
0.005214054603129625,
0.00008389824506593868,
-0.00025989499408751726,
-0.001765068736858666,
0.005436828825622797,
0.009206374175846577,
-0.0003862090816255659,
-0.0001433846482541412,
0.005468312650918961,
0.0064951884560287,
-0.001997736282646656,
0.012966029345989227,
-0.000025256729713873938,
-0.004467532970011234,
0.006038108374923468,
0.011010724119842052,
-0.004344500135630369,
0.009273720905184746,
-0.003430788405239582,
0.0038315518759191036,
0.001677950844168663,
-0.007355133071541786,
-0.011397006921470165,
-0.0045303343795239925,
0.006028455216437578,
0.00744120916351676,
-0.0035116097424179316,
0.0005646569770760834,
-0.00042042077984660864,
-0.0026570307090878487,
-0.009424029849469662,
-0.008594309911131859,
-0.004070184659212828,
-0.0008994898525997996,
0.0019807317294180393,
0.07639069110155106,
-0.00853509921580553,
-0.002508201403543353,
-0.011698316782712936,
0.0002013120974879712,
-0.0029177165124565363,
0.0035635302774608135,
0.003087464952841401,
-0.0024791155010461807,
0.003427269170060754,
0.004404264036566019,
-0.00881258212029934,
-0.011926556006073952,
0.004168067593127489,
0.0031644566915929317,
-0.0007098836358636618,
0.005239363294094801,
0.007537496276199818,
-0.004420577548444271,
0.0015127115184441209,
-0.011900724843144417,
-0.002122916979715228,
-0.00367624219506979,
-0.006203972268849611,
0.00010362393368268386,
-0.0022811207454651594,
-0.0004631684278137982,
0.002664771396666765,
0.002628826070576906,
-0.004110753070563078,
0.005836525931954384,
-0.0007875063456594944,
0.00042020753608085215,
-0.0026170152705162764,
-0.0004628497699741274,
-0.007681105751544237,
0.005612037610262632,
0.001486831926740706,
-0.011511598713696003,
-0.005655971355736256,
-0.0015725636621937156,
-0.0005716303130611777,
-0.007583253551274538,
0.00797687191516161,
0.0024756225757300854,
0.006786564365029335,
-0.003135969862341881,
0.0034337444230914116,
-0.008708540350198746,
0.0002817051426973194,
-0.012058266438543797,
0.007103621959686279,
-0.18071211874485016,
0.010677635669708252,
0.0023009972646832466,
-0.007111300714313984,
-0.0059013222344219685,
-0.013918683864176273,
-0.011350293643772602,
0.004236235748976469,
0.010681956075131893,
-0.0016637369990348816,
-0.0005088222678750753,
-0.0034630396403372288,
0.007779846899211407,
0.003405062248930335,
-0.0010888244723901153,
-0.0067458380945026875,
0.0003848594496957958,
-0.0028520869091153145,
-0.002153180306777358,
0.004858379252254963,
0.00493556447327137,
0.006574372295290232,
0.004783853888511658,
-0.0005089697078801692,
0.0005895504727959633,
-0.0035057272762060165,
0.004200799390673637,
-0.003944389056414366,
0.0065266466699540615,
-0.012799004092812538,
-0.0038892943412065506,
-0.00011778812040574849,
-0.0020684634801000357,
0.0025496443267911673,
0.003224239218980074,
-0.0031346725299954414,
0.009083397686481476,
0.0029218134004622698,
-0.008101951330900192,
0.007334914989769459,
-0.007988089695572853,
0.03314582258462906,
0.001843731733970344,
0.008264799602329731,
0.0010244661243632436,
-0.005195985082536936,
-0.0018651883583515882,
0.006565521005541086,
0.0025630039162933826,
0.01235276646912098,
-0.009882232174277306,
-0.003687505377456546,
0.0022129632998257875,
0.019204027950763702,
-0.005311936140060425,
-0.009401760995388031,
-0.006699272897094488,
-0.0017014783807098866,
0.006849604193121195,
0.01176643930375576,
0.011299672536551952,
-0.004244549665600061,
0.007496105507016182,
-0.0030728329438716173,
-0.01928243786096573,
0.0023459168151021004,
-0.0031294699292629957,
-0.009104270488023758,
-0.0004148248117417097,
0.007072086445987225,
0.009575002826750278,
0.00005172255259822123,
0.008474612608551979,
0.00317563209682703,
0.003823283826932311,
-0.0022055504377931356,
0.005721856374293566,
-0.004444954451173544,
0.004594892729073763,
-0.009143113158643246,
0.013218218460679054,
-0.012390202842652798,
0.0008691398543305695,
0.0036803355906158686,
-0.0056314533576369286,
0.014202981255948544,
0.004294161684811115,
-0.0005823603132739663,
-0.0003127181262243539,
-0.010558824986219406,
-0.0009560374892316759,
0.004086825530976057,
0.002006363123655319,
-0.006335644517093897,
0.002731687854975462,
-0.00018375093350186944,
0.005325400270521641,
0.008192730136215687,
-0.009570403955876827,
0.0069847446866333485,
0.00527561828494072,
-0.008983557112514973,
-0.00041092908941209316,
-0.006032530218362808,
0.0019286384340375662,
0.007836339995265007,
-0.010209416970610619,
-0.009096597321331501,
0.006111780647188425,
-0.0059229289181530476,
-0.004102995153516531,
0.001851256238296628,
-0.009935080073773861,
-0.0056162127293646336,
-0.001542542828246951,
-0.012386110611259937,
0.0004890516865998507
] |
8a64487109643353c0e84bbee6dfb1cf09044927 | 834 | py | Python | beta_reconstruction/crystal_relations.py | LightForm-group/beta-reconstruction | 67584f75ee08690226595c5f9dc75dfd164a11a0 | [
"MIT"
] | null | null | null | beta_reconstruction/crystal_relations.py | LightForm-group/beta-reconstruction | 67584f75ee08690226595c5f9dc75dfd164a11a0 | [
"MIT"
] | 1 | 2020-01-07T12:41:26.000Z | 2020-01-07T12:50:40.000Z | beta_reconstruction/crystal_relations.py | LightForm-group/beta-reconstruction | 67584f75ee08690226595c5f9dc75dfd164a11a0 | [
"MIT"
] | null | null | null | import numpy as np
from defdap.quat import Quat
hex_syms = Quat.symEqv("hexagonal")
# subset of hexagonal symmetries that give unique orientations when the
# Burgers transformation is applied
unq_hex_syms = [
hex_syms[0],
hex_syms[5],
hex_syms[4],
hex_syms[2],
hex_syms[10],
hex_syms[11]
]
cubic_syms = Quat.symEqv("cubic")
# subset of cubic symmetries that give unique orientations when the
# Burgers transformation is applied
unq_cub_syms = [
cubic_syms[0],
cubic_syms[7],
cubic_syms[9],
cubic_syms[1],
cubic_syms[22],
cubic_syms[16],
cubic_syms[12],
cubic_syms[15],
cubic_syms[4],
cubic_syms[8],
cubic_syms[21],
cubic_syms[20]
]
# HCP -> BCC
burg_eulers = np.array([135, 90, 354.74]) * np.pi / 180
burg_trans = Quat.fromEulerAngles(*burg_eulers).conjugate
| 22.540541 | 71 | 0.689448 | 1 | 1.0326 | [
0.0024481690488755703,
0.023598311468958855,
0.0072203208692371845,
0.0034266698639839888,
0.006418807897716761,
-0.0028053238056600094,
-0.0079568512737751,
0.0034996788017451763,
-0.004414168652147055,
0.001199259771965444,
0.0025688831228762865,
0.0037698685191571712,
0.007824084721505642,
-0.016569936648011208,
0.00011644418555079028,
0.017551260069012642,
-0.05400590971112251,
0.0028392199892550707,
-0.0019036885350942612,
0.002869939897209406,
-0.008816651999950409,
0.010093634948134422,
0.008157288655638695,
0.005911621730774641,
0.004575238563120365,
0.0011703260242938995,
0.008451138623058796,
0.00438842223957181,
-0.008816860616207123,
-0.005151432938873768,
0.0005219896556809545,
-0.001770698931068182,
-0.005890627391636372,
-0.008313787169754505,
0.004990591201931238,
-0.003477218560874462,
0.0010727945482358336,
-0.02062533050775528,
0.012024411000311375,
-0.005943657364696264,
-0.00718294084072113,
-0.01621255651116371,
0.0022550923749804497,
0.006534019485116005,
-0.014923551119863987,
0.001676758285611868,
-0.0027901881840080023,
0.00046449078945443034,
-0.0092798862606287,
0.006741618271917105,
-0.009733187966048717,
0.0021150647662580013,
0.014617780223488808,
0.004499995149672031,
-0.005994775332510471,
-0.006619615945965052,
0.012556935660541058,
0.0005298124742694199,
-0.013055299408733845,
0.0013940258650109172,
-0.0005937120877206326,
-0.002238847780972719,
0.0038036052137613297,
0.0018428039038553834,
-0.01772226206958294,
-0.007624513003975153,
-0.007285586092621088,
0.002783576026558876,
-0.004444272723048925,
0.006430558394640684,
0.002344143111258745,
0.0010906016686931252,
0.006732074543833733,
0.003503276966512203,
0.0035540342796593904,
-0.0034823170863091946,
-0.0018517121206969023,
0.00015694473404437304,
0.008283291943371296,
0.004400766454637051,
0.0060312096029520035,
-0.007908009923994541,
0.004809168633073568,
0.010461357422173023,
0.012054618448019028,
0.006129158660769463,
0.017152370885014534,
-0.009776173159480095,
0.04414444416761398,
0.009281173348426819,
-0.008022776804864407,
0.00010925968672381714,
-0.008709391579031944,
-0.004506840370595455,
-0.0011429090518504381,
-0.030324317514896393,
0.0017767400713637471,
-0.0037325569428503513,
0.0010779995936900377,
0.0018593869172036648,
-0.0006979997851885855,
0.007092772051692009,
0.0008830448496155441,
-0.002514167921617627,
-0.011235094629228115,
0.008416573517024517,
-0.0061635589227080345,
-0.002216296037659049,
0.009342283941805363,
0.0027706846594810486,
-0.014746797271072865,
-0.0017098593525588512,
0.0017171755898743868,
-0.013217607513070107,
0.004661975894123316,
0.0025621403474360704,
-0.008301319554448128,
0.055579978972673416,
-0.003848534543067217,
0.0019096385221928358,
-0.0050867097452282906,
-0.0034108201507478952,
0.0026012693997472525,
0.00954933650791645,
0.008846215903759003,
-0.005209401249885559,
0.012394338846206665,
0.009440112859010696,
0.007315234746783972,
0.008669917471706867,
-0.0027912980876863003,
0.00922447256743908,
-0.004033942706882954,
-0.0016486502718180418,
0.001317106536589563,
-0.007648115511983633,
0.010254928842186928,
0.00009076412243302912,
-0.007694401778280735,
0.0023630368523299694,
-0.0013405849458649755,
-0.01329694502055645,
0.0013953038724139333,
-0.00268219574354589,
0.0017702033510431647,
-0.010776989161968231,
-0.005587432533502579,
-0.003129121381789446,
-0.004775141831487417,
0.00399682717397809,
0.007788500748574734,
0.003816556418314576,
0.0027362185064703226,
-0.003501866478472948,
-0.008349972777068615,
-0.00015251744480337948,
-0.004681212827563286,
0.003861907636746764,
0.008600627072155476,
0.0029564565047621727,
-0.00911872461438179,
-0.0016162256943061948,
0.0047454326413571835,
0.004289384000003338,
-0.005056081339716911,
0.0029998805839568377,
-0.005730706267058849,
0.00989655964076519,
0.0024991617538034916,
0.0030384594574570656,
0.012803778052330017,
-0.005020994693040848,
0.0013810780365020037,
-0.002270383993163705,
0.001323997974395752,
0.00010953112359857187,
0.0030655907467007637,
0.011102166026830673,
-0.0026943671982735395,
-0.006190665066242218,
0.005474509205669165,
0.0042791832238435745,
0.007743088062852621,
0.007779577746987343,
-0.0024280098732560873,
0.0018224521772935987,
-0.006791459862142801,
0.0015020235441625118,
0.00798419676721096,
-0.0045678019523620605,
0.007816595956683159,
0.0047354972921311855,
-0.012104727327823639,
-0.00675967987626791,
-0.003588901599869132,
-0.008926625363528728,
0.002176738576963544,
0.014393709599971771,
0.011079399846494198,
-0.0017704771598801017,
0.0012893549865111709,
-0.009694179520010948,
-0.0018356159562245011,
0.008562471717596054,
0.0014902345137670636,
-0.012620040215551853,
-0.9566588401794434,
0.003028435865417123,
0.0023591078352183104,
-0.0017280891770496964,
0.004915716592222452,
0.0035640865098685026,
0.003484750632196665,
0.005093866493552923,
0.011250914074480534,
-0.005463169422000647,
-0.0051806350238621235,
-0.007848645560443401,
-0.011496733874082565,
-0.0007805392378941178,
-0.008142930455505848,
-0.0037524274084717035,
-0.008025235496461391,
-0.008947915397584438,
-0.0004268373304512352,
-0.004204952158033848,
-0.0021872634533792734,
0.008206446655094624,
0.0004359375452622771,
0.00546003645285964,
0.002436399692669511,
0.003725132206454873,
-0.006178626324981451,
0.0013897351454943419,
-0.001368261524476111,
-0.0033920020796358585,
-0.004847038071602583,
-0.013905772008001804,
-0.004408308304846287,
-0.002114927163347602,
0.011062522418797016,
-0.0026703181210905313,
0.009163469076156616,
-0.0015604689251631498,
0.0003432072699069977,
-0.010417998768389225,
0.005033864174038172,
0.00013338474673219025,
0.001980290748178959,
-0.030305223539471626,
-0.0008726499509066343,
-0.0009247756679542363,
-0.006566160824149847,
0.00489062862470746,
0.001862686942331493,
0.0008584317401982844,
-0.004750091582536697,
-0.006993855349719524,
0.008923233486711979,
-0.009763194248080254,
0.004972131922841072,
-0.006640040315687656,
-0.007634119596332312,
-0.0006027022609487176,
-0.007529504597187042,
0.00028995313914492726,
0.00492193503305316,
-0.005279936827719212,
-0.0024404495488852262,
-0.005200931802392006,
0.0010784269543364644,
0.0005002663237974048,
0.0013715249951928854,
-0.019832508638501167,
-0.006905031856149435,
-0.00021032264339737594,
0.0032081808894872665,
-0.0025425152853131294,
-0.0027218260802328587,
0.00046723184641450644,
-0.009135935455560684,
0.006350246258080006,
-0.001066111377440393,
0.0035961654502898455,
-0.009299665689468384,
-0.0007162127294577658,
-0.008894665166735649,
-0.007579595781862736,
0.0032409965060651302,
-0.006513034924864769,
-0.004900583066046238,
-0.001966350944712758,
0.0009077658760361373,
0.008463005535304546,
-0.0031698241364210844,
0.0030740355141460896,
0.010027238167822361,
-0.0012412749929353595,
-0.008850736543536186,
0.006903502158820629,
0.00526528712362051,
-0.0010348256910219789,
-0.0041486956179142,
0.00347106228582561,
0.008585185743868351,
0.007458719424903393,
0.002707498846575618,
0.0056595513597130775,
-0.0017882761312648654,
0.010631253011524677,
-0.0023305686190724373,
0.0012841393472626805,
-0.0012259292416274548,
-0.0033411066979169846,
-0.005910204723477364,
-0.0010588096920400858,
-0.007656239904463291,
-0.0017625996842980385,
-0.012430332601070404,
-0.010253318585455418,
-0.004138631280511618,
-0.00019586217240430415,
0.003682828275486827,
-0.00428050896152854,
0.0016218232922255993,
-0.0002690086839720607,
0.008441600948572159,
-0.003955227322876453,
-0.002096479292958975,
0.0025750910863280296,
-0.00023280591994989663,
-0.006141435820609331,
0.014921523630619049,
-0.009780903346836567,
0.006266400683671236,
-0.0012350413016974926,
-0.015801377594470978,
0.009810034185647964,
0.007582897320389748,
-0.0051766084507107735,
-0.00034593837335705757,
0.0015681423246860504,
0.00390861788764596,
-0.00061177829047665,
-0.00597064383327961,
-0.003845848375931382,
-0.01817927323281765,
0.0014049768215045333,
0.021106235682964325,
0.004716875962913036,
0.010622420348227024,
0.012086547911167145,
-0.00300014391541481,
0.0005745578673668206,
0.005818010773509741,
0.001582745579071343,
0.014318029396235943,
-0.007271348498761654,
0.00017209509678650647,
0.00023135531228035688,
-0.006676522083580494,
0.0027567255310714245,
0.0028272715862840414,
0.004446404054760933,
-0.002915977733209729,
0.0028097883332520723,
-0.006984821055084467,
-0.00508818868547678,
-0.01872873865067959,
-0.0039049037732183933,
0.0068011474795639515,
-0.003486665664240718,
0.006758704315871,
-0.012310278601944447,
0.005253562703728676,
0.004440802149474621,
0.0019180959789082408,
-0.00018083170289173722,
0.00027465797029435635,
0.005729839205741882,
0.008874905295670033,
-0.006572755519300699,
0.001909982063807547,
0.003569524735212326,
-0.0022525954991579056,
0.002105258870869875,
0.00886108260601759,
-0.0081518879160285,
-0.0035657414700835943,
0.0016610060120001435,
0.0056229266338050365,
0.0011937832459807396,
-0.0033124820329248905,
-0.011906296014785767,
-0.005216279998421669,
0.00222055078484118,
-0.004443030338734388,
0.004314836114645004,
0.0008113194489851594,
0.004782143980264664,
-0.006733948830515146,
-0.0011823622044175863,
-0.006797815207391977,
-0.010417829267680645,
0.011952062137424946,
-0.003103185910731554,
0.004689177498221397,
0.012876455672085285,
0.003467754926532507,
-0.012399552389979362,
0.005640535149723291,
0.009624035097658634,
-0.0034663386177271605,
0.0026996030937880278,
0.007616035174578428,
-0.005104853305965662,
-0.020628860220313072,
-0.0009680403163656592,
-0.014381328597664833,
0.0056604924611747265,
-0.0011557344114407897,
0.002388034714385867,
-0.00809412356466055,
0.009731324389576912,
0.005073342006653547,
-0.013621299527585506,
-0.005459832958877087,
-0.008277468383312225,
0.005021689459681511,
-0.0020070055034011602,
-0.002376430667936802,
-0.002851224271580577,
-0.002307421062141657,
-0.0021139471791684628,
-0.004480625037103891,
-0.001966804265975952,
0.003516910597681999,
0.0006011879886500537,
-0.001992626581341028,
0.002863968489691615,
-0.0015382610727101564,
0.001783099607564509,
-0.0007212502532638609,
-0.011714862659573555,
0.0017718111630529165,
0.0048227133229374886,
-0.0026530171744525433,
-0.00020057137589901686,
-0.0011938796378672123,
-0.00438558729365468,
-0.005650828592479229,
-0.00948290340602398,
-0.004925278015434742,
-0.004292990546673536,
-0.004423543345183134,
-0.010163540951907635,
-0.0035653668455779552,
-0.009160843677818775,
0.00964602455496788,
-0.004814961925148964,
0.008393287658691406,
0.005901958327740431,
-0.007442397531121969,
0.00670636584982276,
-0.0013194504426792264,
0.005883085075765848,
0.002580713015049696,
0.00659021083265543,
0.0015192414866760373,
-0.008286136202514172,
-0.011535569094121456,
0.011902954429388046,
-0.008580177091062069,
0.0012803651625290513,
0.014930314384400845,
0.003035470610484481,
0.008514590561389923,
-0.00003880289659718983,
-0.00022428065130952746,
0.004418341442942619,
0.008853521198034286,
-0.015909092500805855,
0.0018188023241236806,
-0.0030162378679960966,
-0.002955702366307378,
0.004928848706185818,
-0.003946395590901375,
0.001513211289420724,
0.009984519332647324,
0.0032726263161748648,
-0.00811692513525486,
-0.0003032880777027458,
0.0030405058059841394,
0.005581392906606197,
-0.012011758983135223,
-0.0020538123790174723,
-0.003352855332195759,
-0.003406912786886096,
-0.004599320702254772,
-0.0031912897247821093,
0.0008168992353603244,
0.005911845713853836,
-0.002584582194685936,
0.004578306805342436,
0.0034707486629486084,
-0.003575716633349657,
0.01572742871940136,
-0.006636316888034344,
-0.003902432741597295,
0.005712491925805807,
0.001960230991244316,
-0.002664144616574049,
-0.00974213145673275,
-0.0015567176742479205,
0.0023350997362285852,
0.0069611105136573315,
-0.00015617566532455385,
-0.006364596076309681,
-0.005171378143131733,
0.000619611470028758,
-0.00952839758247137,
0.0036268900148570538,
0.010785636492073536,
-0.002479121321812272,
0.004529755562543869,
-0.0002943984873127192,
-0.008422797545790672,
-0.014745025895535946,
0.05640837922692299,
-0.0011219086591154337,
0.005379865877330303,
0.003720740554854274,
-0.009453708305954933,
0.0006402838625945151,
-0.003497426863759756,
0.00803322996944189,
-0.007716250140219927,
-0.006608597468584776,
0.00893984455615282,
-0.003304204670712352,
0.003507311223074794,
0.0035597351379692554,
-0.0009531957912258804,
0.013689890503883362,
-0.005395590327680111,
-0.01601773500442505,
-0.013923042453825474,
0.006491686217486858,
-0.005179840140044689,
-0.0073203882202506065,
0.006372933275997639,
-0.006136715412139893,
-0.0010677995160222054,
0.0021803940180689096,
0.007547253742814064,
-0.00024033441150095314,
0.0023742192424833775,
-0.002495921915397048,
-0.002709813881665468,
0.0010516132460907102,
0.004240364767611027,
0.006397371646016836,
0.00538243493065238,
-0.0019969081040471792,
0.00738726370036602,
-0.003296741284430027,
0.001015758141875267,
-0.0027248174883425236,
0.005678409710526466,
0.005177890881896019,
-0.0028116453904658556,
-0.003577176481485367,
0.003950789570808411,
0.0032177746761590242,
0.0016645366558805108,
0.011103448458015919,
0.0015967312501743436,
-0.006580394692718983,
0.009858318604528904,
0.0070120166055858135,
-0.002487616380676627,
0.009671736508607864,
-0.000026544195861788467,
0.003432454075664282,
0.0014325663214549422,
-0.008733853697776794,
-0.013167105615139008,
0.00034106505336239934,
0.007142993155866861,
0.008098173886537552,
-0.0012006808537989855,
-0.0004020287888124585,
-0.0013092251028865576,
-0.003754153847694397,
-0.006621247157454491,
-0.009680568240582943,
-0.0004681565333157778,
0.0007773293764330447,
0.002445991849526763,
0.07128658890724182,
-0.006604838650673628,
-0.0029231738299131393,
-0.008486230857670307,
0.0031486295629292727,
-0.001928297569975257,
0.0007128874422051013,
-0.0016188862500712276,
-0.001211568247526884,
0.0028909051325172186,
0.004087373614311218,
-0.010638558305799961,
-0.012586240656673908,
0.0020305290818214417,
0.004638180136680603,
-0.0010277959518134594,
0.0037892358377575874,
0.007918672636151314,
-0.00882289931178093,
0.002328209113329649,
-0.012780399061739445,
-0.0012890114448964596,
0.0011404177639633417,
-0.007520322687923908,
-0.004842097405344248,
-0.0037016242276877165,
0.0033792760223150253,
0.0018441930878907442,
0.006917563732713461,
-0.003858910407871008,
0.00722165871411562,
-0.001168241840787232,
0.0012022816808894277,
-0.004456082824617624,
-0.0007702567963860929,
-0.005021342076361179,
0.009077154099941254,
-0.000013079188647679985,
-0.011289374902844429,
-0.005325214006006718,
-0.00004060376886627637,
0.000654180534183979,
-0.005363480653613806,
0.006452339701354504,
-0.0013027555542066693,
0.007163747679442167,
-0.0029961203690618277,
0.0015952849062159657,
-0.005338201764971018,
0.001985131064429879,
-0.01512814685702324,
0.006621915847063065,
-0.17844194173812866,
0.015074068680405617,
0.004429698921740055,
-0.0040974789299070835,
-0.0041422657668590546,
-0.018662290647625923,
-0.005584452301263809,
0.0010290113277733326,
0.013135923072695732,
0.0022054093424230814,
-0.0014177457196637988,
-0.004297382198274136,
0.0034030317328870296,
0.004754343070089817,
-0.0010880718473345041,
-0.00528139341622591,
0.0060007693246006966,
-0.004546606447547674,
0.000022925825760466978,
0.002611734438687563,
0.005582408048212528,
0.006700814235955477,
0.0028598408680409193,
0.00008532959327567369,
-0.0031178223434835672,
-0.002844621427357197,
0.0057014767080545425,
-0.0011906190775334835,
0.0027457543183118105,
-0.012774446979165077,
-0.0038730697706341743,
-0.005468771327286959,
-0.002808460732921958,
0.0015158074675127864,
0.004717477597296238,
-0.0017850262811407447,
0.008015665225684643,
0.0019714143127202988,
-0.009482153691351414,
0.008140966296195984,
-0.006023137364536524,
0.030212627723813057,
0.0033057820983231068,
0.006468747276812792,
-0.0004654534859582782,
-0.0013568898430094123,
-0.003722136840224266,
0.009035737253725529,
0.004117622040212154,
0.01369520090520382,
-0.011647836305201054,
-0.0020496342331171036,
0.00502468878403306,
0.01810949295759201,
-0.004656587261706591,
-0.006519018206745386,
-0.007276821881532669,
-0.006303032394498587,
0.0035690320655703545,
0.010786626487970352,
0.00984359160065651,
-0.005806582514196634,
0.008843529969453812,
-0.0014127148315310478,
-0.018001390621066093,
0.004769494291394949,
-0.004221469629555941,
-0.010311800986528397,
0.00013292876246850938,
0.006946206092834473,
0.01003365870565176,
-0.0025137653574347496,
0.006076917052268982,
-0.0003421168657951057,
0.005137546453624964,
0.00004223283031024039,
0.007800711318850517,
-0.002549676923081279,
0.007716522552073002,
-0.007990043610334396,
0.01202118955552578,
-0.009620459750294685,
-0.0030329993460327387,
0.0004462081997189671,
-0.004728171043097973,
0.0118079399690032,
0.0049285790883004665,
-0.0030044231098145247,
-0.0014458522200584412,
-0.010191715322434902,
-0.004307568073272705,
0.0032095799688249826,
0.0015903800958767533,
-0.009238101541996002,
0.0027090341318398714,
-0.00013540411600843072,
0.004728877451270819,
0.005771659780293703,
-0.008535741828382015,
0.002022956497967243,
0.00481049157679081,
-0.007142797578126192,
0.0022605466656386852,
-0.0022058235481381416,
0.00020197646517772228,
0.0033948938362300396,
-0.00334630673751235,
-0.008012699894607067,
0.004775121808052063,
-0.008301799185574055,
-0.0056800455786287785,
0.003669370897114277,
-0.010120933875441551,
-0.007034486625343561,
-0.00023461095406673849,
-0.013469856232404709,
0.0008851605234667659
] |
8a64819227bba93979e4413095e01b50e7c00dec | 13 | py | Python | a2.py | Changhong-Jiang/test | b907b984cbd9703711f52c9f497cf36b5b4e8752 | [
"MIT"
] | null | null | null | a2.py | Changhong-Jiang/test | b907b984cbd9703711f52c9f497cf36b5b4e8752 | [
"MIT"
] | 1 | 2020-02-28T08:15:58.000Z | 2020-02-28T08:16:41.000Z | a2.py | Changhong-Jiang/test | b907b984cbd9703711f52c9f497cf36b5b4e8752 | [
"MIT"
] | null | null | null | print('222')
| 6.5 | 12 | 0.615385 | 2 | 0.6261 | [
0.00102235225494951,
0.027808694168925285,
0.006121334154158831,
0.0001431522105121985,
0.004437880124896765,
-0.007868231274187565,
-0.013487890362739563,
0.00707175163552165,
-0.005707540083676577,
0.0005740848137065768,
0.0013734897365793586,
0.0024088327772915363,
0.0079003581777215,
-0.014315137639641762,
0.00379064935259521,
0.02158902771770954,
-0.06452787667512894,
0.004488256759941578,
-0.0038160148542374372,
0.0029878870118409395,
-0.00840610358864069,
0.011401010677218437,
0.009189127944409847,
0.008984840475022793,
0.00393585255369544,
0.006108992267400026,
0.011199754662811756,
0.004517747554928064,
-0.007824898697435856,
-0.0028989440761506557,
0.002536518732085824,
-0.0009807192254811525,
-0.005973906256258488,
-0.008357390761375427,
0.006094442680478096,
-0.004108772613108158,
0.002685326850041747,
-0.018262742087244987,
0.011949179694056511,
-0.0073486813344061375,
-0.009069814346730709,
-0.02061520516872406,
-0.00026917882496491075,
0.007322437595576048,
-0.013634901493787766,
0.0036625924985855818,
-0.004538043402135372,
0.004208845552057028,
-0.01037934422492981,
0.0055807954631745815,
-0.012479054741561413,
0.0024904448073357344,
0.011133604682981968,
0.005598993971943855,
-0.004721484612673521,
-0.007676613517105579,
0.009563124738633633,
-0.0006454583490267396,
-0.015552596189081669,
-0.0028310578782111406,
-0.0029207917395979166,
-0.005568963475525379,
0.002929131966084242,
0.0044401101768016815,
-0.021933361887931824,
-0.005903785582631826,
-0.0062552099116146564,
0.0026777712628245354,
-0.004907253663986921,
0.003830320667475462,
0.0011253698030486703,
-0.0025129353161901236,
0.005802784115076065,
-0.0017971813213080168,
0.0019143117824569345,
-0.0024793597403913736,
-0.002554704202339053,
0.006261403206735849,
0.005838893819600344,
0.0006493351538665593,
0.009752084501087666,
-0.0124431811273098,
0.00935619231313467,
0.01425982266664505,
0.013278848491609097,
0.008479501120746136,
0.0165039524435997,
-0.010363597422838211,
0.036145251244306564,
0.005210202652961016,
-0.009037468582391739,
0.0019281156128272414,
-0.004739825613796711,
-0.003444208763539791,
0.0006432164227589965,
-0.035000234842300415,
0.0006604685913771391,
-0.007184794172644615,
0.0005996781983412802,
0.0049976808950304985,
0.0012114128330722451,
0.005161812528967857,
-0.003709977027028799,
-0.0022366477642208338,
-0.011302575469017029,
0.01888417638838291,
-0.010889084078371525,
-0.0017712091794237494,
0.0080232759937644,
0.004854980856180191,
-0.01429030578583479,
-0.00018404165166430175,
0.003284954000264406,
-0.012098584324121475,
0.006129271816462278,
0.0012172880815342069,
-0.004244679119437933,
0.06116969510912895,
0.0014454895863309503,
0.0017387914704158902,
-0.006508816499263048,
-0.005464611575007439,
0.000976832234300673,
0.009513954631984234,
0.012910732999444008,
-0.010200916789472103,
0.010750077664852142,
0.0067935511469841,
0.001368502271361649,
0.005924359429627657,
0.0015153208514675498,
0.009446518495678902,
-0.004663356114178896,
0.0017313645221292973,
0.0001011429339996539,
-0.00904422253370285,
0.00845083687454462,
-0.0037769058253616095,
0.0013262409484013915,
-0.00011287972301943228,
-0.0025512895081192255,
-0.01624911278486252,
0.000646616390440613,
0.000311405019601807,
0.0006713088951073587,
-0.010225791484117508,
-0.006768141873180866,
-0.0022848709486424923,
-0.004739231429994106,
-0.0001417839084751904,
0.008788243867456913,
0.004894280340522528,
0.002334264339879155,
-0.00737519608810544,
-0.004869033582508564,
-0.004410476423799992,
-0.0053906613029539585,
0.0041729360818862915,
0.011413317173719406,
0.0030047649051994085,
-0.005843473132699728,
-0.007348099257797003,
0.003889463609084487,
0.006366103421896696,
0.0006792588392272592,
0.0006398350815288723,
-0.009809141978621483,
0.009252329356968403,
0.0021866641473025084,
0.0027905264869332314,
0.01179692056030035,
-0.0026447135023772717,
-0.002366932574659586,
0.00386153906583786,
0.0014582560397684574,
0.0016676784725859761,
0.0016005595680326223,
0.009045206941664219,
-0.0037952959537506104,
-0.004280644003301859,
0.005327750463038683,
0.0008966019377112389,
0.007810859940946102,
0.013003332540392876,
-0.00305092497728765,
0.0023691742680966854,
-0.00008277972665382549,
0.00029901452944613993,
0.006825270596891642,
-0.0024795150384306908,
0.013260303065180779,
0.004381674807518721,
-0.016953913494944572,
-0.006743472535163164,
-0.0012189482804387808,
-0.013527928851544857,
-0.0003794577205553651,
0.01674199290573597,
0.010014383122324944,
0.001898244139738381,
0.0018623026553541422,
-0.012556365691125393,
0.0005933208158239722,
0.009469497948884964,
-0.00020868933643214405,
-0.011707578785717487,
-0.9501084089279175,
-0.000036078788980375975,
0.004079410340636969,
0.0024807301815599203,
0.004007241688668728,
0.0007108712452463806,
0.004332748241722584,
0.0013859261525794864,
0.014251050539314747,
-0.012286528944969177,
-0.007324027828872204,
-0.00970190018415451,
-0.010526100173592567,
0.002207269659265876,
-0.0073142219334840775,
-0.006323623936623335,
-0.005983683746308088,
-0.008116504177451134,
0.0011626018676906824,
-0.0048499698750674725,
-0.002042625565081835,
0.010149146430194378,
-0.0006496987771242857,
0.0030567420180886984,
0.005553791765123606,
0.003076938446611166,
-0.005497225560247898,
-0.0013175834901630878,
0.00463707884773612,
0.0004578040970955044,
-0.003660042304545641,
-0.0157376267015934,
-0.008203156292438507,
0.0012214194284752011,
0.014816883951425552,
-0.000027001880880561657,
0.004705467727035284,
-0.00031315875821746886,
0.0013483252841979265,
-0.013604864478111267,
0.005370920058339834,
0.004067861940711737,
0.0028324085287749767,
-0.029144765809178352,
0.006759651470929384,
-0.0022612654138356447,
-0.00731970090419054,
0.008598310872912407,
0.00545742129907012,
-0.0027676315512508154,
-0.0010183567646890879,
-0.001273901667445898,
0.005189987830817699,
-0.008577427826821804,
0.0053376127034425735,
-0.006481773220002651,
-0.004675301257520914,
-0.0007067809347063303,
-0.010903620161116123,
0.001844374812208116,
0.0028358956333249807,
-0.005494746845215559,
-0.0006322122062556446,
-0.0023811273276805878,
0.00041762771434150636,
-0.00007551259477622807,
0.0004863361536990851,
-0.01634112372994423,
-0.002704957965761423,
-0.004841862712055445,
0.007561744190752506,
-0.00015674448513891548,
-0.003492973279207945,
0.00042783477692864835,
-0.009065101854503155,
0.006617613602429628,
0.0015629426343366504,
0.0018002820434048772,
-0.008934298530220985,
0.002345484681427479,
-0.008031165227293968,
-0.012002182193100452,
0.004707771819084883,
-0.00520792743191123,
-0.0025100561324507,
0.002476355992257595,
0.006911595351994038,
0.007347736973315477,
-0.006754204630851746,
-0.0028612236492335796,
0.011320680379867554,
-0.004665740299969912,
-0.01231818925589323,
0.00745608052238822,
0.007366443518549204,
-0.002464293036609888,
-0.0015792633639648557,
0.004818422254174948,
0.008435816504061222,
0.011643124744296074,
0.0012216957984492183,
0.0024532857351005077,
0.000840559892822057,
0.013283531181514263,
0.001114406855776906,
0.003946784418076277,
0.001187691232189536,
-0.002460027579218149,
-0.002400866011157632,
-0.002542827744036913,
-0.005841029807925224,
0.002367321401834488,
-0.011334850452840328,
-0.013190185651183128,
-0.0061943307518959045,
0.005126008298248053,
-0.0019322530133649707,
-0.002505981596186757,
0.001106109470129013,
0.0021292264573276043,
0.014456898905336857,
0.002748842816799879,
-0.007999787107110023,
0.0007327553466893733,
0.002934052376076579,
-0.008006005547940731,
0.019259167835116386,
-0.011675909161567688,
0.006089289207011461,
-0.0014409905998036265,
-0.012876161374151707,
0.007063727825880051,
0.008864087983965874,
-0.007642519194632769,
0.004362428095191717,
0.00008647286449559033,
0.003522904822602868,
0.0012372430646792054,
-0.005891100503504276,
-0.0043196966871619225,
-0.019170138984918594,
0.000853938574437052,
0.022823678329586983,
0.0068633053451776505,
0.00850037019699812,
0.011898482218384743,
-0.004609729629009962,
0.003750828094780445,
0.010085415095090866,
0.0013404714409261942,
0.016303079202771187,
-0.007490534335374832,
-0.0015215405728667974,
0.0019375812262296677,
-0.005213822703808546,
0.003380347276106477,
0.0006758946110494435,
0.003975030034780502,
-0.002748398343101144,
-0.0014322811039164662,
-0.005949865095317364,
-0.004014892503619194,
-0.017236363142728806,
0.00033124108449555933,
0.007366224657744169,
-0.004561536014080048,
0.0004631417104974389,
-0.016570359468460083,
0.003142651403322816,
0.004931771662086248,
0.00048577471170574427,
-0.0011833934113383293,
0.0014710890827700496,
0.008860142901539803,
0.010955669917166233,
-0.006028375122696161,
0.004700324963778257,
0.0036717026960104704,
0.000009503703040536493,
0.004823524970561266,
0.009464326314628124,
-0.010809835977852345,
-0.0046853600069880486,
0.0031041267793625593,
0.0019624391570687294,
0.0006364531582221389,
-0.004178147297352552,
-0.00987931340932846,
-0.0039423489943146706,
0.004086359404027462,
-0.010015781037509441,
0.005084550473839045,
0.00032945905695669353,
0.0025319033302366734,
-0.011223983019590378,
0.0006098374142311513,
-0.00662520295009017,
-0.009115014225244522,
0.006725949235260487,
-0.0033985150512307882,
0.004205400589853525,
0.009538157843053341,
0.0011466291034594178,
-0.013865601271390915,
0.007513909600675106,
0.005983275827020407,
-0.0066987150348722935,
0.00031121991924010217,
0.00912619661539793,
-0.003802639665082097,
-0.022929849103093147,
0.0016121678054332733,
-0.017317747697234154,
0.008588089607656002,
-0.004442260134965181,
-0.0002839836524799466,
-0.009505909867584705,
0.011897769756615162,
0.004418655764311552,
-0.011043740436434746,
-0.0027018985711038113,
-0.0083963293582201,
0.00570951122790575,
-0.003717734245583415,
-0.006030089221894741,
-0.001847852603532374,
-0.0003769962931983173,
-0.004893213044852018,
0.0018165672663599253,
0.001649250858463347,
0.0011207550996914506,
0.004187637474387884,
-0.00639417115598917,
0.002903923625126481,
-0.0009647459373809397,
-0.00020215619588270783,
0.008008514530956745,
-0.010663961060345173,
0.003379977773874998,
0.009817361831665039,
-0.0033096892293542624,
-0.004472535569220781,
-0.0021522047463804483,
-0.003343212651088834,
-0.005980863701552153,
-0.012062168680131435,
-0.00085664470680058,
-0.002585908630862832,
-0.0054912203922867775,
-0.008765148930251598,
0.0003909935476258397,
-0.006160228047519922,
0.008016928099095821,
-0.007445190567523241,
0.007258719298988581,
0.007556242868304253,
-0.004439190495759249,
0.006097536534070969,
-0.005931524094194174,
0.004560338333249092,
0.001963444985449314,
0.007573556620627642,
-0.0002754113811533898,
-0.006279320456087589,
-0.008244842290878296,
0.012690313160419464,
-0.01304253563284874,
-0.0005048855091445148,
0.014427647925913334,
0.006581124849617481,
0.008668304421007633,
0.0056586251594126225,
0.00011206539056729525,
0.00522529985755682,
0.009008996188640594,
-0.015021627768874168,
0.0042495764791965485,
-0.0003441829758230597,
-0.0022518280893564224,
0.00633522542193532,
-0.0070252553559839725,
0.005095170810818672,
0.005205797962844372,
0.0007078296621330082,
-0.007548327092081308,
-0.0039163753390312195,
-0.003566392930224538,
0.002445439575240016,
-0.011123226955533028,
-0.0008835048065520823,
-0.005755218677222729,
-0.006324805319309235,
-0.006625876761972904,
-0.0005946480087004602,
-0.003457786049693823,
0.003454305464401841,
-0.0030628370586782694,
0.009108093567192554,
0.0026274407282471657,
-0.005320798605680466,
0.015029443427920341,
-0.004964745137840509,
-0.004593666177242994,
0.002528978744521737,
-0.001449809642508626,
0.0009858781704679132,
-0.008644533343613148,
-0.0021714172326028347,
-0.0009386182064190507,
0.003747551003471017,
-0.003938268404453993,
-0.011180060915648937,
-0.002172617707401514,
0.0019194182241335511,
-0.006849602796137333,
0.0009966582292690873,
0.009074636735022068,
0.001549527165479958,
0.0010025595547631383,
0.0005925064906477928,
-0.006640459410846233,
-0.01725822314620018,
0.058768078684806824,
0.0012599834008142352,
0.0007558577926829457,
0.009724616073071957,
-0.005443636793643236,
-0.0005716164014302194,
-0.003318917704746127,
0.004447268787771463,
-0.008837342262268066,
-0.006531525403261185,
0.012622258625924587,
-0.0016339862486347556,
0.0013758469140157104,
-0.0039833770133554935,
-0.003931623883545399,
0.0134067228063941,
-0.008488467894494534,
-0.019264498725533485,
-0.012880802154541016,
0.006850202567875385,
-0.0038578235544264317,
-0.004697166848927736,
0.005097256973385811,
-0.0059926449321210384,
-0.0010609135497361422,
-0.00007735181134194136,
0.0032443117816001177,
-0.003692268393933773,
0.0005630053346976638,
-0.0013891701819375157,
-0.0010363963665440679,
0.0006512700929306448,
0.0036780720110982656,
0.006852827034890652,
0.011980530805885792,
-0.002375298645347357,
0.0052416687831282616,
-0.001590190688148141,
-0.00029520216048695147,
0.0010872650891542435,
0.00718160392716527,
0.008372125215828419,
-0.0021354288328438997,
-0.002282884670421481,
0.0025031385011970997,
0.00468845758587122,
0.0022343802265822887,
0.01413755863904953,
0.001287150545977056,
-0.004797608125954866,
0.007333594374358654,
0.009538223966956139,
-0.00555279990658164,
0.00661437027156353,
-0.0017181884031742811,
0.0032100894022732973,
0.0013142898678779602,
-0.011185172013938427,
-0.009167044423520565,
0.0011039815144613385,
0.004183242563158274,
0.006078504025936127,
-0.0036910397466272116,
0.0011456683278083801,
0.0000033667140542092966,
-0.004858030471950769,
-0.013234233483672142,
-0.0031148619018495083,
-0.005041507072746754,
-0.0002140791912097484,
0.0039479392580688,
0.07448854297399521,
-0.006870405748486519,
-0.0028691254556179047,
-0.006614602170884609,
0.004984390921890736,
0.0007247297908179462,
-0.002041963394731283,
-0.0033287557307630777,
0.0013730573700740933,
0.003951055463403463,
0.004154309630393982,
-0.00870828703045845,
-0.009578116238117218,
0.0020993216894567013,
0.0033389409072697163,
-0.0019320194842293859,
0.0004632797499652952,
0.0098331393674016,
-0.006491891108453274,
0.004528484772890806,
-0.01240260899066925,
-0.001838572439737618,
-0.005370594561100006,
-0.0038888962008059025,
-0.00233315653167665,
-0.006033606361597776,
-0.003165879985317588,
0.004830615594983101,
0.0058455574326217175,
-0.007225965615361929,
0.006552655715495348,
-0.00037068326491862535,
0.0023129016626626253,
-0.0021973110269755125,
-0.0012939127627760172,
-0.007619136478751898,
0.0052963136695325375,
0.0019966824911534786,
-0.011841295287013054,
-0.004013742320239544,
-0.004318499471992254,
-0.000051594262913567945,
-0.008249310776591301,
0.007457959931343794,
-0.004077251069247723,
0.01272315252572298,
0.00008007830911083147,
0.002451176755130291,
-0.0024665736127644777,
-0.0005823998362757266,
-0.013399734161794186,
0.004242123570293188,
-0.19300761818885803,
0.007777235470712185,
0.00048526463797315955,
-0.0065824175253510475,
-0.003184339962899685,
-0.01787743903696537,
-0.011264831759035587,
0.0011885438580065966,
0.008810607716441154,
-0.0014222764875739813,
0.00040564476512372494,
-0.005573587026447058,
0.007598476484417915,
0.0037721372209489346,
-0.0022388407960534096,
-0.006013406440615654,
0.004573232494294643,
-0.0026138683315366507,
-0.004549825564026833,
0.002844745060428977,
0.009990041144192219,
0.008546460419893265,
0.003042495809495449,
0.0024315151385962963,
-0.0006179919582791626,
-0.005652350373566151,
0.00362482201308012,
-0.0022344430908560753,
0.00693475129082799,
-0.007577625103294849,
-0.0049587758257985115,
-0.0064789652824401855,
-0.0015689668944105506,
0.000496813328936696,
0.0032556061632931232,
-0.001562788849696517,
0.006235681474208832,
0.0022552763111889362,
-0.008650067262351513,
0.007355212699621916,
-0.0071377940475940704,
0.03503895550966263,
0.0012948699295520782,
0.012206249870359898,
0.0018849774496629834,
0.0026585001032799482,
-0.0035760668106377125,
0.010464408434927464,
0.0020171853248029947,
0.013049728237092495,
-0.010544628836214542,
-0.00974320713430643,
0.00003209556234651245,
0.017500150948762894,
-0.0030887885950505733,
-0.009119369089603424,
-0.009778193198144436,
-0.00822211429476738,
0.0062819235026836395,
0.015833331272006035,
0.009114585816860199,
-0.0056524560786783695,
0.008108333684504032,
-0.0036244462244212627,
-0.018711326643824577,
0.0034094781149178743,
0.0010097111808136106,
-0.009021143428981304,
-0.0007474497542716563,
0.005959177389740944,
0.010838408954441547,
-0.005794684402644634,
0.010726256296038628,
-0.001300921430811286,
-0.00040433485992252827,
-0.0037706687580794096,
0.007312425412237644,
-0.00313237844966352,
0.00746735418215394,
-0.006899760104715824,
0.013273031450808048,
-0.009748267009854317,
-0.0022535393945872784,
0.0022323881275951862,
-0.0028964777011424303,
0.009807560592889786,
0.006875559221953154,
0.00033811063622124493,
0.000858439365401864,
-0.012978368438780308,
-0.0017767696408554912,
0.0020622173324227333,
0.004009320866316557,
-0.006757892668247223,
0.0025163008831441402,
-0.002397078787907958,
0.004002884961664677,
0.009298078715801239,
-0.006539769470691681,
0.004420874174684286,
0.007076570764183998,
-0.008355905301868916,
0.002116006100550294,
-0.006787172053009272,
0.0009771808981895447,
0.005654290318489075,
-0.006170701235532761,
-0.012159512378275394,
0.005521364044398069,
-0.0047260127030313015,
-0.005792220588773489,
0.0050142607651650906,
-0.012893805280327797,
-0.005281426943838596,
0.0016782019520178437,
-0.011508824303746223,
0.000432296801591292
] |
8a65b0ad04c9a2a75abc3c11ac9fc679788fe298 | 4,318 | py | Python | app/api/v1/views/auth_views.py | emdeechege/Questionaire-API | 1dd05dc25f96ea8ecdce82fe28449ea684991251 | [
"MIT"
] | null | null | null | app/api/v1/views/auth_views.py | emdeechege/Questionaire-API | 1dd05dc25f96ea8ecdce82fe28449ea684991251 | [
"MIT"
] | 20 | 2019-01-08T19:16:45.000Z | 2019-08-22T10:21:43.000Z | app/api/v1/views/auth_views.py | emdeechege/Questioner-API | 1dd05dc25f96ea8ecdce82fe28449ea684991251 | [
"MIT"
] | 1 | 2019-01-11T10:13:42.000Z | 2019-01-11T10:13:42.000Z | from flask import jsonify, Blueprint, request, json, make_response
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime
from ..utils.validators import Validation
from ..models.auth_models import Users
v1_auth_blueprint = Blueprint('auth', __name__, url_prefix='/api/v1')
USER = Users()
VALIDATOR = Validation()
@v1_auth_blueprint.route('/signup', methods=['POST'])
def signup():
"""View that controls creation of new users"""
try:
data = request.get_json()
except:
return jsonify({
"status": 400,
"message": "Invalid input"
}), 400
firstname = data.get('firstname')
lastname = data.get('lastname')
othername = data.get('othername')
email = data.get('email')
phone_number = data.get('phone_number')
username = data.get('username')
is_admin = data.get('is_admin')
password = data.get('password')
if not firstname or not firstname.split():
return make_response(jsonify({
"status": 400,
"message": "Firstname is required"
})), 400
if not lastname or not lastname.split():
return make_response(jsonify({
"status": 400,
"message": "Lastname is required"
})), 400
if not email or not email.split():
return make_response(jsonify({
"status": 400,
"message": "Email is required"
})), 400
if not phone_number:
return make_response(jsonify({
"status": 400,
"message": "Phone number is required"
})), 400
if not username or not username.split():
return make_response(jsonify({
"status": 400,
"message": "Username is required"
})), 400
if not password or not password.split():
return make_response(jsonify({
"status": 400,
"message": "Password is required"
})), 400
if not VALIDATOR.validate_phone_number(phone_number):
return jsonify({
"status": 400,
"message": "Please input valid phone number"
}), 400
if VALIDATOR.validate_password(password):
return jsonify({
"status": 400,
"message": "Password not valid"
}), 400
if not VALIDATOR.validate_email(email):
return jsonify({
"status": 400,
"message": "Invalid email"
}), 400
if VALIDATOR.username_exists(username):
return jsonify({
"status": 400,
"message": "Username exists"
}), 400
if VALIDATOR.email_exists(email):
return jsonify({
"status": 400,
"message": "Email exists"
}), 400
password = generate_password_hash(
password, method='pbkdf2:sha256', salt_length=8)
res = USER.signup(
firstname, lastname, othername, email, phone_number, username, is_admin, password)
return jsonify({
"status": 201,
"data": [{
"firstname": firstname,
"lastname": lastname,
"othername": othername,
"email": email,
"phone_number": phone_number,
"username": username,
"is_admin": is_admin
}]
}), 201
@v1_auth_blueprint.route('/login', methods=['POST'])
def login():
""" A view to control users login """
try:
data = request.get_json()
except:
return make_response(jsonify({
"status": 400,
"message": "Wrong input"
})), 400
username = data.get('username')
password = data.get('password')
if not username:
return make_response(jsonify({
"status": 400,
"message": "Username is required"
})), 400
if not password:
return make_response(jsonify({
"status": 400,
"message": "Password is required"
})), 400
if not VALIDATOR.username_exists(username):
return jsonify({
"status": 404,
"message": "User does not exist"
}), 404
auth_token = user.generate_auth_token(username)
return make_response(jsonify({
"status": 200,
"message": 'Logged in successfuly',
"token": auth_token
})), 200
| 28.596026 | 90 | 0.568782 | 1 | 1.9746 | [
0.011921909637749195,
0.022099165245890617,
0.031237542629241943,
0.009060708805918694,
-0.003670146455988288,
0.022917738184332848,
-0.05700280889868736,
-0.031564146280288696,
0.03105023503303528,
0.02298586443066597,
0.0347268208861351,
0.014751912094652653,
0.04669174179434776,
-0.008230253122746944,
-0.007153593935072422,
-0.0008384745451621711,
0.11202379316091537,
0.00030099990544840693,
-0.01623178832232952,
0.008551167324185371,
-0.027098817750811577,
0.027288686484098434,
-0.02316392958164215,
-0.0022342356387525797,
0.004383265506476164,
0.016898375004529953,
0.04528792202472687,
-0.017913401126861572,
0.014270167797803879,
-0.021669600158929825,
-0.004350739996880293,
0.005128856282681227,
-0.01049456000328064,
0.06672817468643188,
-0.023542901501059532,
0.035684648901224136,
-0.015540624968707561,
0.021375348791480064,
0.026268228888511658,
-0.0020314911380410194,
-0.03425673395395279,
-0.057045649737119675,
0.013615974225103855,
-0.019730696454644203,
-0.006056290119886398,
0.047557052224874496,
-0.024913040921092033,
0.015019110403954983,
-0.026352807879447937,
-0.0016107952687889338,
0.020644426345825195,
0.05769719183444977,
0.006090877112001181,
-0.0358889140188694,
0.03408372029662132,
-0.05213369056582451,
0.014095612801611423,
-0.005820137448608875,
-0.03465244174003601,
0.01751832291483879,
0.003169788047671318,
0.008465416729450226,
0.02435336261987686,
-0.03343553468585014,
0.0018919772701337934,
0.0105883264914155,
-0.02233527973294258,
-0.015674177557229996,
-0.044866207987070084,
0.022891422733664513,
-0.04923297092318535,
-0.014255596324801445,
0.038384463638067245,
0.04703059792518616,
0.03183003142476082,
0.021692199632525444,
-0.029167449101805687,
-0.011345019564032555,
-0.01732131466269493,
0.016376996412873268,
-0.05629655346274376,
0.023185672238469124,
0.020679419860243797,
0.0345238596200943,
0.0008465400896966457,
0.0494937039911747,
0.10550788044929504,
-0.0405130460858345,
0.030793312937021255,
0.028749331831932068,
-0.03701694309711456,
0.03741998225450516,
-0.058618441224098206,
0.010118355043232441,
0.027699196711182594,
-0.06212294101715088,
0.012222672812640667,
-0.01681741327047348,
0.03420518338680267,
-0.008804691955447197,
0.009700478054583073,
-0.021596089005470276,
0.018673570826649666,
0.010635917074978352,
0.006441357545554638,
-0.003591986373066902,
-0.06504116952419281,
0.01613704301416874,
0.008249862119555473,
0.007243524305522442,
-0.0038313944824039936,
-0.00020447553833946586,
0.015155707485973835,
-0.04403575509786606,
-0.017116457223892212,
-0.04536968469619751,
0.053337763994932175,
0.03820075839757919,
0.012743339873850346,
0.03247860074043274,
0.00729276891797781,
-0.0005022407276555896,
-0.0016380372690036893,
0.008084658533334732,
-0.02715512178838253,
0.05707435682415962,
0.04624437913298607,
-0.0009732266771607101,
0.030380088835954666,
-0.006868460681289434,
0.0032143150456249714,
0.010108591057360172,
-0.019852545112371445,
-0.02360401302576065,
0.0018237041076645255,
-0.01601027138531208,
-0.012470110319554806,
-0.012944979593157768,
-0.036870043724775314,
0.003956879489123821,
-0.013251861557364464,
-0.023044157773256302,
0.017514066770672798,
0.05691263824701309,
0.008354649879038334,
-0.041550543159246445,
-0.02141946367919445,
0.017708515748381615,
-0.02696445770561695,
-0.03289405256509781,
0.0015744139673188329,
0.02255917526781559,
-0.03032980114221573,
0.024186385795474052,
-0.008635767735540867,
-0.014868758618831635,
0.011021843180060387,
-0.06526997685432434,
-0.024870937690138817,
0.02365998551249504,
-0.03425123170018196,
0.004328009206801653,
-0.007667393423616886,
0.004557342734187841,
0.004461826290935278,
0.042701639235019684,
0.020713327452540398,
-0.008558790199458599,
-0.03566211834549904,
-0.01690002530813217,
0.02554444409906864,
-0.04278538376092911,
-0.04431919381022453,
-0.0045194379054009914,
-0.003584435675293207,
0.005728685297071934,
0.030115894973278046,
-0.01383280660957098,
-0.003401397727429867,
-0.04927031695842743,
0.01413782685995102,
-0.002549367258325219,
0.033801645040512085,
0.050639014691114426,
0.0038374303840100765,
-0.04466422647237778,
-0.05619514733552933,
-0.0023306021466851234,
0.004659020807594061,
-0.02061169594526291,
0.010242750868201256,
0.041801080107688904,
-0.019758902490139008,
-0.040289878845214844,
0.017237013205885887,
-0.013746843673288822,
-0.0014476373326033354,
-0.023340702056884766,
-0.003781338455155492,
-0.013052232563495636,
-0.02922823280096054,
-0.0044834488071501255,
-0.04033154621720314,
0.02269686944782734,
0.03505050763487816,
-0.0026258251164108515,
-0.6677854657173157,
-0.01906878873705864,
-0.0032224259339272976,
0.002094767987728119,
0.05815526098012924,
0.0124549875035882,
-0.021205473691225052,
0.019186992198228836,
0.004315479658544064,
0.007288292516022921,
-0.02406349778175354,
-0.02705942653119564,
-0.046393975615501404,
-0.005193109158426523,
0.020969172939658165,
-0.0071833631955087185,
0.015319091267883778,
0.03529901057481766,
-0.02700165845453739,
0.014843301847577095,
0.02240220457315445,
0.043021999299526215,
-0.007207214832305908,
0.012942994944751263,
0.026132818311452866,
-0.03336916118860245,
-0.0004907688708044589,
-0.05114852264523506,
-0.0064214118756353855,
0.006096354685723782,
-0.017363455146551132,
-0.022449452430009842,
0.02133549563586712,
-0.024849891662597656,
0.009363395161926746,
-0.028421765193343163,
0.010453498922288418,
-0.017688313499093056,
0.006658959202468395,
-0.04185106232762337,
-0.007905129343271255,
-0.012218043208122253,
-0.020316997542977333,
-0.03927852585911751,
-0.012641859240829945,
-0.009166763164103031,
-0.01715598814189434,
-0.026041993871331215,
-0.007259953301399946,
0.048793893307447433,
-0.0023018112406134605,
0.041546259075403214,
0.044960882514715195,
-0.0356811061501503,
0.0006135446601547301,
-0.02115742489695549,
0.0019955523312091827,
-0.0028553230222314596,
-0.03655529394745827,
0.0294302050024271,
0.025181272998452187,
0.03323688730597496,
-0.014288718812167645,
0.0052042012102901936,
-0.0024915519170463085,
0.008180897682905197,
-0.007932151667773724,
-0.042940404266119,
-0.03543952852487564,
-0.004766837693750858,
-0.023888560011982918,
-0.03390323743224144,
-0.06358211487531662,
0.0695992261171341,
0.005433925427496433,
-0.02090020664036274,
-0.0005672117695212364,
0.008368460461497307,
-0.0036461337003856897,
0.0024414598010480404,
0.008902794681489468,
-0.021382885053753853,
0.031863994896411896,
-0.026650965213775635,
-0.022856369614601135,
0.02720392681658268,
0.007708437740802765,
-0.005948202684521675,
-0.012530275620520115,
0.03355460986495018,
0.017744919285178185,
0.05457403138279915,
0.006185737904161215,
-0.007193938363343477,
0.049601588398218155,
-0.0038093996699899435,
-0.01388881541788578,
0.021319881081581116,
0.047234926372766495,
0.03433184698224068,
-0.04308313876390457,
0.00910147838294506,
-0.001502690021879971,
0.034856926649808884,
-0.04739174246788025,
0.0007220679544843733,
-0.029700152575969696,
-0.0124846575781703,
0.02440890111029148,
-0.0967104583978653,
-0.021238189190626144,
-0.005071565508842468,
-0.03669985011219978,
0.00019650638569146395,
-0.006734826136380434,
-0.03487545996904373,
-0.006548931356519461,
-0.026740511879324913,
0.027140868827700615,
-0.013384548015892506,
-0.0021713189780712128,
0.015762876719236374,
-0.007321368902921677,
0.06922492384910583,
-0.01818377524614334,
-0.00951217021793127,
-0.01057551708072424,
0.007208835333585739,
0.025212988257408142,
-0.011522992514073849,
0.008828539401292801,
-0.01491369865834713,
-0.03110802359879017,
0.01124925073236227,
-0.03665915131568909,
-0.015994902700185776,
-0.019907809793949127,
-0.03940499573945999,
-0.010981953702867031,
-0.015304328873753548,
0.012424417771399021,
0.006495567504316568,
0.025593968108296394,
-0.043278343975543976,
0.017692111432552338,
0.027979392558336258,
-0.006836745887994766,
-0.012378173880279064,
0.032232724130153656,
-0.032975733280181885,
-0.022722935304045677,
0.05254945904016495,
-0.002082097576931119,
0.030810466036200523,
0.01203024573624134,
0.009195661172270775,
-0.023139668628573418,
-0.006149800959974527,
0.022304607555270195,
0.021450063213706017,
0.006791102234274149,
-0.03281497210264206,
0.002017634455114603,
0.03371872380375862,
0.040864910930395126,
-0.02317766845226288,
0.005937297362834215,
0.030108923092484474,
0.007006907369941473,
0.0748492032289505,
0.012661974877119064,
-0.0008524685981683433,
0.006865627132356167,
-0.015389927662909031,
-0.05581922084093094,
0.00946333073079586,
0.021271994337439537,
-0.02749479189515114,
0.013586773537099361,
0.005593573674559593,
-0.04524216428399086,
-0.014117112383246422,
0.004732712171971798,
-0.01096341572701931,
0.03239942342042923,
0.04217110574245453,
0.004882648587226868,
0.02133556641638279,
-0.007388528902083635,
0.010900023393332958,
0.05670662969350815,
0.023073332384228706,
0.0016422674525529146,
0.007360628806054592,
-0.0032207907643169165,
-0.0027524211909621954,
0.026066871359944344,
-0.0138331213966012,
0.0071820965968072414,
0.005135359708219767,
0.008943694643676281,
0.014728939160704613,
-0.04257728531956673,
0.0049269977025687695,
0.009371737018227577,
0.07547355443239212,
-0.031089602038264275,
0.004838150460273027,
0.022611573338508606,
-0.038094379007816315,
0.01723800227046013,
0.0028547728434205055,
0.030983740463852882,
0.011694048531353474,
-0.04834408685564995,
0.0363297313451767,
-0.0417482890188694,
-0.035624947398900986,
-0.004006658680737019,
-0.05524171143770218,
-0.03742152079939842,
-0.04143565893173218,
0.04390614107251167,
-0.00047708896454423666,
-0.039385754615068436,
-0.015262647531926632,
-0.04507606104016304,
0.00045038541429676116,
-0.02768506482243538,
-0.020212050527334213,
0.0108637111261487,
0.003623686730861664,
0.031219888478517532,
-0.008649452589452267,
0.002206256613135338,
0.03323448821902275,
-0.04418588802218437,
-0.024975191801786423,
0.029269695281982422,
-0.005514985416084528,
-0.008318683132529259,
-0.036209773272275925,
-0.03323030099272728,
-0.011645885184407234,
-0.0004955557524226606,
0.014552558772265911,
0.036574557423591614,
-0.030637120828032494,
-0.016980666667222977,
0.007476964965462685,
-0.005103642120957375,
0.021899178624153137,
-0.0003177621401846409,
-0.010157210752367973,
-0.020996225997805595,
0.024672186002135277,
-0.013239078223705292,
0.018947632983326912,
0.014688931405544281,
-0.023850927129387856,
-0.00919199176132679,
-0.016156760975718498,
-0.024415379390120506,
0.007873231545090675,
-0.02990107424557209,
0.005430485121905804,
0.0515688955783844,
-0.04830097407102585,
0.00910989660769701,
-0.010109624825417995,
0.027251718565821648,
0.02038000337779522,
-0.023889241740107536,
-0.019648881629109383,
0.0033869068138301373,
-0.019783789291977882,
0.012411539442837238,
-0.009161827154457569,
-0.007566805463284254,
0.0238227229565382,
-0.023775266483426094,
-0.011428754776716232,
0.05267159268260002,
0.028426526114344597,
0.01712164282798767,
-0.01608220487833023,
-0.05681867152452469,
0.00029963950510136783,
-0.008337791077792645,
0.02279077284038067,
-0.01067411620169878,
-0.020910780876874924,
-0.009764883667230606,
0.026421722024679184,
-0.004267011769115925,
-0.014041398651897907,
-0.000058363275456940755,
-0.0034208842553198338,
0.029631728306412697,
0.013317110016942024,
0.032641880214214325,
0.005713168531656265,
-0.0025946006644517183,
0.016185196116566658,
0.02537829428911209,
-0.004972122143954039,
-0.013331723399460316,
0.005189673509448767,
0.02588406391441822,
0.002593392040580511,
0.04310049116611481,
0.0020547539461404085,
0.0007159436936490238,
-0.028640255331993103,
-0.008309805765748024,
-0.005153302103281021,
0.023791635408997536,
-0.013318505138158798,
0.029698844999074936,
0.020489605143666267,
0.011643854901194572,
0.00916137546300888,
-0.019178153946995735,
-0.004759717267006636,
-0.0045295353047549725,
-0.011885036714375019,
-0.015288597904145718,
-0.012709679082036018,
-0.0007138248183764517,
0.027107534930109978,
0.005403383169323206,
-0.03350187465548515,
-0.017970414832234383,
0.03477456793189049,
0.005318262614309788,
0.0010838954476639628,
0.021986600011587143,
0.04561843350529671,
0.02119661495089531,
0.015900300815701485,
0.03979891911149025,
0.01659776084125042,
-0.05258011445403099,
-0.013795087113976479,
0.022122716531157494,
0.03722573071718216,
-0.03604530915617943,
0.04723228141665459,
0.007770713418722153,
0.062167953699827194,
0.008457092568278313,
-0.021938905119895935,
0.010647510178387165,
0.013605213724076748,
0.015537876635789871,
-0.024292301386594772,
-0.00027745479019358754,
0.0022819512523710728,
0.002866423223167658,
-0.013163112103939056,
-0.018773185089230537,
0.004918923135846853,
-0.019968170672655106,
-0.017544135451316833,
0.03023097850382328,
-0.07737629860639572,
0.029383046552538872,
-0.033885836601257324,
-0.010858910158276558,
-0.003037639195099473,
-0.019943660125136375,
-0.010426431894302368,
-0.013833911158144474,
0.021091416478157043,
0.02761748805642128,
0.05210816487669945,
0.01219068095088005,
0.012091020122170448,
-0.012573962099850178,
0.01953953132033348,
-0.024004194885492325,
-0.06616398692131042,
-0.005160721018910408,
-0.024204332381486893,
0.027899594977498055,
-0.05466879531741142,
0.010610460303723812,
-0.006864593829959631,
-0.00490557262673974,
-0.0024943274911493063,
0.012474440969526768,
-0.028718171641230583,
-0.009420858696103096,
0.030390730127692223,
-0.03355403244495392,
0.011434514075517654,
-0.03398776799440384,
-0.013741424307227135,
-0.007104572374373674,
0.023563137277960777,
-0.0028668558225035667,
0.00721405865624547,
-0.013609153218567371,
-0.030302444472908974,
-0.011665526777505875,
-0.004747322760522366,
0.013853061012923717,
-0.04257746785879135,
0.014172964729368687,
-0.0007073229062370956,
0.03157979995012283,
0.021665843203663826,
0.008885434828698635,
-0.02104107476770878,
0.0099955964833498,
-0.021985584869980812,
-0.030602281913161278,
0.016162971034646034,
0.027730882167816162,
0.026468168944120407,
0.004753464367240667,
-0.040545158088207245,
-0.04157638922333717,
-0.048556603491306305,
0.01764499954879284,
0.008140071295201778,
-0.008010624907910824,
-0.006787554360926151,
-0.02116977609694004,
0.00756735960021615,
-0.03311803936958313,
-0.0027355605270713568,
0.016523199155926704,
0.023589622229337692,
-0.003250857349485159,
-0.01855471357703209,
0.009155168198049068,
0.00036435789661481977,
-0.016651149839162827,
0.03210270777344704,
0.03151971474289894,
0.029492394998669624,
-0.03603610768914223,
0.03316936269402504,
0.02581414207816124,
-0.018516527488827705,
0.010224658064544201,
-0.024272747337818146,
-0.001565471407957375,
-0.022477611899375916,
-0.06455755233764648,
-0.006554941646754742,
0.011332027614116669,
0.016773544251918793,
0.006405582185834646,
-0.0043108705431222916,
0.04731778800487518,
0.005811507813632488,
0.0432593934237957,
0.033016085624694824,
-0.019214604049921036,
0.019750306382775307,
0.021830769255757332,
0.004729671403765678,
0.020336993038654327,
0.016904465854167938,
0.0193850789219141,
-0.0012263302924111485,
0.0034632044844329357,
-0.05695387348532677,
0.01863880269229412,
-0.0030726382974535227,
-0.004843668546527624,
0.01884782873094082,
-0.014459737576544285,
0.00314978021197021,
-0.027506863698363304,
0.007190524134784937,
0.044943761080503464,
0.011960480362176895,
-0.008733476512134075,
0.04451704025268555,
0.025944765657186508,
0.005195495206862688,
0.013134355656802654,
-0.003040335141122341,
-0.006433174945414066,
-0.015736615285277367,
-0.03217080608010292,
0.011583737097680569,
-0.025300322100520134,
-0.039681557565927505,
-0.042941849678754807,
0.008181853219866753,
0.0024672604631632566,
0.009661450050771236,
0.03050493262708187,
0.009242414496839046,
0.01716218888759613,
-0.017335152253508568,
-0.03187934309244156,
-0.015906156972050667,
0.028126103803515434,
-0.04557111859321594,
0.011856252327561378,
0.026362620294094086,
0.0654091164469719,
0.020903460681438446,
-0.015251945704221725,
-0.053005654364824295,
-0.0007737160194665194,
0.009371490217745304,
-0.04736184701323509,
-0.021647319197654724,
-0.005850200075656176,
0.03422275185585022,
0.024701710790395737,
0.005742999725043774,
0.03668378293514252,
-0.019794682040810585,
0.02170032449066639,
0.03962060809135437,
-0.05346290394663811,
-0.015020542778074741,
-0.004763198085129261,
-0.011000565253198147,
-0.051488250494003296,
0.005454751662909985,
-0.027845799922943115,
0.01864728331565857,
-0.02576017566025257,
-0.00041971111204475164,
-0.021853255107998848,
0.007816641591489315,
0.016764838248491287,
-0.022348817437887192,
0.02555011585354805,
0.026083897799253464,
-0.0031655088532716036,
-0.023590629920363426,
0.04319797456264496,
0.03845558315515518,
0.01448033843189478,
-0.04945990815758705,
-0.03359648585319519,
-0.009765981696546078,
-0.02018098160624504,
0.03122892789542675,
0.025110263377428055,
0.008084995672106743,
-0.0351593978703022,
0.02470681071281433,
-0.005259559955447912,
0.008720035664737225,
-0.040555763989686966,
-0.006530390121042728,
0.03251959756016731,
0.007504131179302931,
0.010507231578230858,
-0.02633015066385269,
-0.02177289128303528,
-0.014732975512742996
] |
8a66a4e65b6c15a92cb15d2436631fabac501551 | 4,314 | py | Python | pint/testsuite/test_definitions.py | s-avni/pint | 4e33d44437991bf7c5e30977643f42ebd6ed40da | [
"BSD-3-Clause"
] | null | null | null | pint/testsuite/test_definitions.py | s-avni/pint | 4e33d44437991bf7c5e30977643f42ebd6ed40da | [
"BSD-3-Clause"
] | null | null | null | pint/testsuite/test_definitions.py | s-avni/pint | 4e33d44437991bf7c5e30977643f42ebd6ed40da | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import division, unicode_literals, print_function, absolute_import
from pint.util import (UnitsContainer)
from pint.converters import (ScaleConverter, OffsetConverter)
from pint.definitions import (Definition, PrefixDefinition, UnitDefinition,
DimensionDefinition, AliasDefinition)
from pint.testsuite import BaseTestCase
class TestDefinition(BaseTestCase):
def test_invalid(self):
self.assertRaises(ValueError, Definition.from_string, 'x = [time] * meter')
self.assertRaises(ValueError, Definition.from_string, '[x] = [time] * meter')
def test_prefix_definition(self):
for definition in ('m- = 1e-3', 'm- = 10**-3', 'm- = 0.001'):
x = Definition.from_string(definition)
self.assertIsInstance(x, PrefixDefinition)
self.assertEqual(x.name, 'm')
self.assertEqual(x.aliases, ())
self.assertEqual(x.converter.to_reference(1000), 1)
self.assertEqual(x.converter.from_reference(0.001), 1)
self.assertEqual(str(x), 'm')
x = Definition.from_string('kilo- = 1e-3 = k-')
self.assertIsInstance(x, PrefixDefinition)
self.assertEqual(x.name, 'kilo')
self.assertEqual(x.aliases, ())
self.assertEqual(x.symbol, 'k')
self.assertEqual(x.converter.to_reference(1000), 1)
self.assertEqual(x.converter.from_reference(.001), 1)
x = Definition.from_string('kilo- = 1e-3 = k- = anotherk-')
self.assertIsInstance(x, PrefixDefinition)
self.assertEqual(x.name, 'kilo')
self.assertEqual(x.aliases, ('anotherk', ))
self.assertEqual(x.symbol, 'k')
self.assertEqual(x.converter.to_reference(1000), 1)
self.assertEqual(x.converter.from_reference(.001), 1)
def test_baseunit_definition(self):
x = Definition.from_string('meter = [length]')
self.assertIsInstance(x, UnitDefinition)
self.assertTrue(x.is_base)
self.assertEqual(x.reference, UnitsContainer({'[length]': 1}))
def test_unit_definition(self):
x = Definition.from_string('coulomb = ampere * second')
self.assertIsInstance(x, UnitDefinition)
self.assertFalse(x.is_base)
self.assertIsInstance(x.converter, ScaleConverter)
self.assertEqual(x.converter.scale, 1)
self.assertEqual(x.reference, UnitsContainer(ampere=1, second=1))
x = Definition.from_string('faraday = 96485.3399 * coulomb')
self.assertIsInstance(x, UnitDefinition)
self.assertFalse(x.is_base)
self.assertIsInstance(x.converter, ScaleConverter)
self.assertEqual(x.converter.scale, 96485.3399)
self.assertEqual(x.reference, UnitsContainer(coulomb=1))
x = Definition.from_string('degF = 9 / 5 * kelvin; offset: 255.372222')
self.assertIsInstance(x, UnitDefinition)
self.assertFalse(x.is_base)
self.assertIsInstance(x.converter, OffsetConverter)
self.assertEqual(x.converter.scale, 9/5)
self.assertEqual(x.converter.offset, 255.372222)
self.assertEqual(x.reference, UnitsContainer(kelvin=1))
x = Definition.from_string('turn = 6.28 * radian = _ = revolution = = cycle = _')
self.assertIsInstance(x, UnitDefinition)
self.assertEqual(x.name, 'turn')
self.assertEqual(x.aliases, ('revolution', 'cycle'))
self.assertEqual(x.symbol, 'turn')
self.assertFalse(x.is_base)
self.assertIsInstance(x.converter, ScaleConverter)
self.assertEqual(x.converter.scale, 6.28)
self.assertEqual(x.reference, UnitsContainer(radian=1))
def test_dimension_definition(self):
x = DimensionDefinition('[time]', '', (), converter='')
self.assertTrue(x.is_base)
self.assertEqual(x.name, '[time]')
x = Definition.from_string('[speed] = [length]/[time]')
self.assertIsInstance(x, DimensionDefinition)
self.assertEqual(x.reference, UnitsContainer({'[length]': 1, '[time]': -1}))
def test_alias_definition(self):
x = Definition.from_string("@alias meter = metro = metr")
self.assertIsInstance(x, AliasDefinition)
self.assertEqual(x.name, "meter")
self.assertEqual(x.aliases, ("metro", "metr"))
| 44.474227 | 89 | 0.660176 | 1 | 1.9581 | [
-0.051638681441545486,
0.04553887993097305,
0.05025768280029297,
0.001616738853044808,
-0.02043922431766987,
-0.019516853615641594,
-0.0205268245190382,
-0.009608087129890919,
-0.021656017750501633,
0.029814235866069794,
0.019419023767113686,
-0.014722868800163269,
0.022807378321886063,
-0.005037072580307722,
0.01015591248869896,
-0.010572637431323528,
0.11275137960910797,
-0.011298852041363716,
-0.01317436434328556,
-0.028018340468406677,
0.004294760059565306,
0.0019496101886034012,
-0.006067325361073017,
0.012747182510793209,
-0.01116908062249422,
0.009280582889914513,
0.027921529486775398,
-0.03359496593475342,
-0.010169614106416702,
-0.018146701157093048,
-0.015950940549373627,
0.00408313749358058,
0.023448940366506577,
0.0038243273738771677,
-0.004142900463193655,
0.015112555585801601,
0.016235537827014923,
-0.06131349503993988,
-0.015503807924687862,
0.02508498728275299,
-0.00798332691192627,
0.015612008050084114,
0.012953538447618484,
-0.046518199145793915,
0.06308865547180176,
-0.016527220606803894,
0.001983551075682044,
0.004396280739456415,
-0.029623225331306458,
0.01884729042649269,
-0.03053419664502144,
0.02853867970407009,
-0.020703481510281563,
-0.02885747142136097,
0.024872517213225365,
-0.06582573801279068,
0.010460549965500832,
0.023144574835896492,
-0.023095201700925827,
-0.013412929140031338,
0.013426212593913078,
0.011651149019598961,
0.04336485266685486,
0.0020024587865918875,
0.008705909363925457,
-0.021828409284353256,
0.02130955643951893,
0.0025660700630396605,
-0.02237442135810852,
-0.008336520753800869,
-0.005506259389221668,
-0.026650438085198402,
0.02242053858935833,
0.06498923152685165,
-0.010061749257147312,
-0.01191684976220131,
-0.03862694650888443,
-0.022728579118847847,
0.0065101622603833675,
0.012735821306705475,
-0.0059739514254033566,
0.08169975131750107,
0.0027042245492339134,
-0.03389805182814598,
0.0026365353260189295,
0.037510696798563004,
0.03256244584918022,
-0.05452737584710121,
0.05663178116083145,
0.004434674978256226,
-0.03543505817651749,
0.015266235917806625,
-0.035672567784786224,
-0.0008244425407610834,
-0.03719479218125343,
-0.058150485157966614,
0.03378772735595703,
0.03346778079867363,
-0.00427057733759284,
-0.009424963034689426,
0.020724203437566757,
0.006123207043856382,
0.031426310539245605,
-0.018472734838724136,
-0.01543605700135231,
0.003167328890413046,
-0.027093563228845596,
0.0011807758128270507,
0.006610269658267498,
-0.03354674205183983,
-0.04889265075325966,
-0.0183697659522295,
0.013878189958631992,
-0.06935148686170578,
-0.067610003054142,
-0.014977465383708477,
0.007861759513616562,
0.0012192607391625643,
-0.027431700378656387,
-0.014699471183121204,
-0.010474669747054577,
0.01951957307755947,
0.00806965958327055,
-0.007420903071761131,
-0.04909663647413254,
0.07532949000597,
-0.010551085695624352,
0.013973213732242584,
0.013968851417303085,
-0.000035312637919560075,
-0.012529207393527031,
-0.002179693663492799,
-0.006993947084993124,
-0.01500271912664175,
0.02621602639555931,
0.015154414810240269,
0.018845897167921066,
-0.008428340777754784,
-0.05290387198328972,
0.018054554238915443,
0.005905468016862869,
-0.04177303612232208,
0.04079325124621391,
-0.025547495111823082,
-0.006847937125712633,
-0.039527539163827896,
0.022227315232157707,
0.006522876210510731,
-0.02931007742881775,
-0.026187321171164513,
0.016427814960479736,
0.020060958340764046,
-0.02509414777159691,
0.044446952641010284,
0.00473328772932291,
-0.015496226958930492,
-0.0339181087911129,
-0.06402198225259781,
-0.0052480329759418964,
0.004635255318135023,
0.00943046249449253,
0.0357259102165699,
0.0009782937122508883,
0.002451915992423892,
0.003136217826977372,
0.03923466056585312,
-0.06333793699741364,
-0.003947224467992783,
-0.004995882045477629,
-0.0006182697834447026,
0.0004005084338132292,
0.013390137813985348,
-0.02048731967806816,
0.017267679795622826,
-0.053890932351350784,
0.0023354296572506428,
0.0017831821460276842,
0.05562448129057884,
0.03229600936174393,
-0.0026152681093662977,
0.020241890102624893,
0.004922379273921251,
0.006940250750631094,
0.02106332965195179,
0.027501968666911125,
-0.004410316701978445,
-0.05146517604589462,
-0.017862964421510696,
-0.026203805580735207,
0.00556784775108099,
0.0023048159200698137,
0.04753684997558594,
0.005246305372565985,
-0.021790117025375366,
0.016977868974208832,
-0.020597675815224648,
0.006297767627984285,
0.021988535299897194,
0.002948472509160638,
0.00753253186121583,
0.03540237620472908,
-0.0384630411863327,
0.014559965580701828,
-0.002984820632264018,
0.01270697545260191,
-0.018674595281481743,
-0.6429111957550049,
-0.004688971675932407,
0.040123969316482544,
0.02179543487727642,
0.003815888427197933,
0.032322272658348083,
-0.03896195441484451,
0.027513982728123665,
-0.05697200447320938,
-0.008433062583208084,
-0.008152463473379612,
-0.02890719845890999,
-0.03954998403787613,
0.017040658742189407,
-0.0030538372229784727,
-0.006875329650938511,
0.015840448439121246,
-0.013149730861186981,
0.028765296563506126,
0.020371580496430397,
-0.00792806874960661,
-0.012398318387567997,
-0.007760805077850819,
0.0029568136669695377,
-0.014052674174308777,
-0.034154411405324936,
0.04457380622625351,
0.012650016695261002,
0.0233920831233263,
-0.022678401321172714,
-0.014959330670535564,
-0.027328643947839737,
0.007914409041404724,
0.012892681173980236,
-0.027579665184020996,
0.03381999954581261,
-0.019698234274983406,
-0.02473478764295578,
0.02686954475939274,
-0.0034528940450400114,
-0.004511626437306404,
-0.005217115394771099,
-0.0016858810558915138,
-0.05055201053619385,
-0.013092225417494774,
-0.025646021589636803,
-0.008153151720762253,
-0.025705581530928612,
0.011353762820363045,
0.024259081110358238,
-0.034600187093019485,
0.0433843657374382,
0.02322266437113285,
-0.03396095335483551,
0.02062794379889965,
-0.03703443706035614,
-0.014395233243703842,
-0.03952140361070633,
0.00344923697412014,
-0.018956316635012627,
0.0608045719563961,
0.0030946822371333838,
-0.019700637087225914,
0.014887102879583836,
0.021075842902064323,
0.01810750737786293,
0.0014281009789556265,
-0.03899180516600609,
-0.04056340828537941,
0.038809310644865036,
-0.075059674680233,
0.0061348178423941135,
-0.04099804908037186,
0.05630752071738243,
-0.02541915699839592,
0.027314556762576103,
0.0016251810593530536,
-0.019778788089752197,
-0.05443417653441429,
-0.00018863457080442458,
0.01221107505261898,
-0.03390161320567131,
-0.01895742304623127,
-0.018161064013838768,
-0.0033008945174515247,
-0.013074343092739582,
-0.01617775484919548,
-0.004316347651183605,
0.018634803593158722,
0.006677475292235613,
0.05876961722970009,
0.03134218230843544,
0.007437232881784439,
0.027066444978117943,
0.009237761609256268,
-0.027970077469944954,
-0.0022487740498036146,
0.09810665994882584,
0.030102398246526718,
0.016286244615912437,
-0.009527686983346939,
0.02124650590121746,
-0.004395235329866409,
0.0146954245865345,
-0.007363100070506334,
0.008449231274425983,
-0.02762683853507042,
-0.00031607519485987723,
0.036979760974645615,
0.009094051085412502,
-0.003778453217819333,
-0.011413509026169777,
-0.010132689960300922,
0.005370962433516979,
-0.03055821917951107,
-0.01616193912923336,
-0.003458314808085561,
-0.03369768708944321,
0.018663689494132996,
-0.011393190361559391,
-0.01678534224629402,
-0.014230065047740936,
0.01118280179798603,
0.030178654938936234,
-0.013581257313489914,
-0.0201784148812294,
-0.05482373386621475,
-0.01330368872731924,
-0.007153010461479425,
0.003035023109987378,
-0.05199240893125534,
0.018902888521552086,
-0.0505371019244194,
0.012439047917723656,
0.032183997333049774,
0.015485911630094051,
-0.06643339991569519,
-0.05867496132850647,
0.013229947537183762,
0.022211579605937004,
-0.0024616727605462074,
-0.023243244737386703,
0.004362278152257204,
-0.029136670753359795,
0.015191178768873215,
0.029504284262657166,
0.03806781768798828,
-0.004496167413890362,
0.0065729510970413685,
-0.009463352151215076,
-0.010626993142068386,
0.02653966285288334,
0.011672272346913815,
-0.004477370530366898,
-0.011110447347164154,
0.005962809082120657,
-0.03807410970330238,
-0.010697668418288231,
0.04345488175749779,
0.014705714769661427,
-0.018902044743299484,
0.011119069531559944,
-0.0049043032340705395,
0.047899145632982254,
-0.012321286834776402,
0.005368055310100317,
-0.020111747086048126,
0.016038959845900536,
0.043084852397441864,
0.012887906283140182,
0.018873287364840508,
0.010945982299745083,
0.03603668138384819,
-0.006226130295544863,
-0.028947049751877785,
0.02841728739440441,
-0.031134139746427536,
-0.05247730389237404,
0.0030683253426104784,
-0.02424730360507965,
-0.016941234469413757,
0.006052931305021048,
0.0035777774173766375,
-0.006089481990784407,
0.005611455999314785,
-0.007728109136223793,
-0.018919244408607483,
-0.006524666212499142,
0.01462499424815178,
-0.016099389642477036,
0.030277876183390617,
0.0010262030409649014,
-0.019440438598394394,
-0.009521855041384697,
-0.051225367933511734,
-0.014487956650555134,
-0.05557774007320404,
0.007779629435390234,
-0.007149348966777325,
-0.04114936664700508,
0.018426520749926567,
0.006341760512441397,
0.03235805407166481,
-0.0017822745721787214,
0.025249691680073738,
0.05425751209259033,
-0.013650027103722095,
0.004437512252479792,
0.029432570561766624,
-0.033171214163303375,
0.007645420730113983,
-0.0037287722807377577,
0.035522617399692535,
0.007319052703678608,
-0.01864911988377571,
0.02462700940668583,
-0.05854400619864464,
-0.03604712709784508,
0.023558054119348526,
-0.06267927587032318,
0.008064191788434982,
-0.04045289009809494,
0.038339339196681976,
-0.005021966993808746,
0.02458810806274414,
0.008726868778467178,
-0.02669604867696762,
0.025288540869951248,
0.0008132749935612082,
-0.03458590433001518,
0.035785965621471405,
-0.009747720323503017,
0.01684700883924961,
-0.030751222744584084,
-0.015480614267289639,
-0.008680424652993679,
-0.008609631098806858,
-0.06058923155069351,
0.010621112771332264,
-0.013269114308059216,
-0.002932271920144558,
-0.03723787143826485,
-0.005786579102277756,
0.045470111072063446,
-0.012194129638373852,
-0.025657935068011284,
0.003086862387135625,
-0.014337935484945774,
0.010554357431828976,
-0.006410717498511076,
-0.02475542388856411,
0.043193452060222626,
-0.0020067505538463593,
-0.026211094111204147,
0.038391415029764175,
-0.004462426993995905,
-0.028230959549546242,
-0.009341463446617126,
0.008885137736797333,
0.02950296923518181,
-0.016860857605934143,
0.0017801919020712376,
-0.008865236304700375,
0.04722566157579422,
-0.0011625179322436452,
0.005684764124453068,
0.011017357930541039,
-0.00876507069915533,
0.005695120431482792,
0.055328208953142166,
0.011422243900597095,
-0.0034018149599432945,
-0.012338812462985516,
-0.010375714860856533,
-0.0010384655324742198,
-0.030378222465515137,
-0.0014851910527795553,
-0.04882590472698212,
0.005017524119466543,
0.006413365714251995,
0.0035875672474503517,
-0.026048699393868446,
-0.0061103361658751965,
0.024611324071884155,
-0.0042123133316636086,
-0.003317908849567175,
-0.005212253425270319,
0.011000665836036205,
-0.06737824529409409,
0.0018993354169651866,
0.0161988977342844,
-0.03613010421395302,
0.0528913252055645,
0.01603410206735134,
-0.022969890385866165,
0.001260317862033844,
-0.023400576785206795,
0.016577836126089096,
0.0530611127614975,
0.01937895081937313,
0.04756075516343117,
-0.006679283455014229,
0.0010090360883623362,
-0.019668692722916603,
-0.021708516404032707,
-0.04743136093020439,
0.03161323070526123,
-0.007236488163471222,
0.037007156759500504,
0.00972312968224287,
-0.009986094199120998,
0.04293772205710411,
0.017380235716700554,
0.008346600458025932,
0.05201598256826401,
0.03395271673798561,
0.027909770607948303,
0.014296526089310646,
0.020254530012607574,
-0.02309211529791355,
-0.016009414568543434,
0.025030868127942085,
-0.005803406238555908,
-0.019663849845528603,
-0.01766175590455532,
-0.011149337515234947,
-0.01360347867012024,
0.014148220419883728,
-0.0075879180803895,
0.014945611357688904,
-0.01724841631948948,
-0.005847746040672064,
-0.004735149443149567,
0.0004303519963286817,
0.02708815038204193,
-0.028584597632288933,
0.027978960424661636,
0.042944926768541336,
0.04263128712773323,
0.0019129790598526597,
-0.04146553948521614,
0.026755349710583687,
-0.025535358116030693,
-0.00493977777659893,
0.027082527056336403,
-0.004748186096549034,
0.005497095640748739,
0.054540857672691345,
0.033932484686374664,
0.01608332060277462,
0.020930327475070953,
-0.0012833854416385293,
-0.005993283353745937,
-0.031845614314079285,
-0.003627878613770008,
-0.01409113872796297,
-0.020660407841205597,
0.021425003185868263,
-0.0008528458420187235,
0.05612368509173393,
-0.014299946837127209,
0.028885148465633392,
-0.015735426917672157,
-0.018309317529201508,
0.012938061729073524,
-0.03322781249880791,
0.04050375521183014,
0.0323496088385582,
-0.008608783595263958,
0.005054993089288473,
0.02178451046347618,
-0.016409948468208313,
0.023154785856604576,
0.0029773907735943794,
-0.0017912834882736206,
0.016581015661358833,
0.05850847065448761,
-0.017826737836003304,
0.011045729741454124,
-0.03173540532588959,
0.02136714942753315,
-0.007661692798137665,
0.007858595810830593,
-0.013851855881512165,
0.034927450120449066,
-0.021748604252934456,
0.007202078588306904,
0.006931792013347149,
-0.01538223959505558,
-0.055802807211875916,
-0.006183056626468897,
-0.00802464410662651,
0.015276201069355011,
0.06556865572929382,
-0.009231275878846645,
-0.004507557488977909,
0.009825175628066063,
0.016568675637245178,
0.005400293041020632,
-0.021960100159049034,
0.0022039846517145634,
-0.008065881207585335,
0.018373487517237663,
-0.017768321558833122,
0.0497477650642395,
-0.00601960439234972,
-0.019166111946105957,
-0.006073075346648693,
0.010882039554417133,
-0.02161162532866001,
0.02054663747549057,
0.02502295933663845,
-0.020344145596027374,
0.0006166151724755764,
-0.02787747234106064,
0.012738348916172981,
-0.0171226654201746,
-0.005678934045135975,
-0.0005328232073225081,
0.006477448157966137,
-0.039081498980522156,
-0.008268223144114017,
0.012720034457743168,
0.034792106598615646,
-0.03861667588353157,
-0.007438818458467722,
0.005791406612843275,
0.03969117999076843,
-0.009734224528074265,
0.024699607864022255,
0.014464076608419418,
0.01731679029762745,
-0.03148505091667175,
-0.014074403792619705,
0.021732548251748085,
-0.03441137447953224,
-0.033375103026628494,
-0.016492251306772232,
-0.037801261991262436,
-0.0016784974141046405,
-0.030808452516794205,
-0.027014635503292084,
0.021214677020907402,
-0.009648342616856098,
-0.005827741697430611,
0.10295466333627701,
0.01726609095931053,
0.026333320885896683,
0.017525818198919296,
0.007807367015630007,
0.024149062111973763,
-0.005007936153560877,
0.0158725306391716,
0.015021623112261295,
0.023578111082315445,
-0.011053147725760937,
0.021997975185513496,
0.04978049173951149,
0.02433125115931034,
0.03114348091185093,
-0.004859560169279575,
0.03203152120113373,
-0.028685513883829117,
0.05596260726451874,
0.06604699790477753,
0.035838790237903595,
0.029386315494775772,
-0.006353241391479969,
-0.016178738325834274,
0.005490441806614399,
-0.0674305334687233,
0.00008217187860282138,
-0.03559506684541702,
0.030095674097537994,
-0.03591727465391159,
-0.012635823339223862,
-0.039080534130334854,
0.0032438470516353846,
0.02737623266875744,
-0.016661668196320534,
-0.04750678688287735,
0.016148854047060013,
0.008821859955787659,
-0.019211241975426674,
0.0008691815310157835,
0.007187415845692158,
-0.03087853267788887,
0.05914810299873352,
-0.01299990713596344,
0.04107469692826271,
-0.01828642375767231,
0.006176938768476248,
0.018733607605099678,
0.033969152718782425,
0.0019379963632673025,
-0.04436609521508217,
0.02995128743350506,
0.04101266711950302,
0.041405852884054184,
-0.015064077451825142,
-0.006238565314561129,
-0.021588822826743126,
0.005859720055013895,
-0.021059811115264893,
0.021603906527161598,
0.0262005478143692,
0.09469747543334961,
0.077832892537117,
0.0007247842731885612,
-0.02696806751191616,
-0.036081865429878235,
-0.012413154356181622,
-0.014789756387472153,
0.005397074390202761,
0.053655292838811874,
-0.028075221925973892,
0.039917029440402985,
-0.04895974323153496,
-0.013067992404103279,
0.008204711601138115,
-0.01979023963212967,
0.03808824345469475,
0.030167095363140106,
0.00027476242394186556,
-0.03837369382381439,
0.020433682948350906,
-0.06104857474565506,
-0.020313957706093788,
0.004177795257419348,
0.029902631416916847,
-0.041473388671875,
-0.021997665986418724,
-0.004383342806249857,
-0.0182136632502079,
0.011197279207408428,
-0.0537143275141716,
0.023372355848550797,
0.029782839119434357,
-0.04455333203077316,
-0.008179676719009876,
0.06594964116811752,
0.005936897359788418,
0.0060458737425506115,
-0.047022800892591476,
-0.018781956285238266,
-0.029535967856645584,
-0.0063841515220701694,
0.01912912167608738,
0.012742619030177593,
-0.00841909646987915,
0.005629817023873329,
-0.011934098787605762,
0.0022732431534677744,
0.025105508044362068,
-0.06404056400060654,
0.04034086689352989,
-0.021442648023366928,
0.009046751074492931,
-0.0008505842997692525,
-0.07585590332746506,
-0.022896913811564445,
-0.018903115764260292
] |
8a678b6dfe1f80688ee851169cd059181b03b309 | 5,922 | py | Python | electrum/dnssec.py | Jesusown/electrum | 0df05dd914c823acae1828cad3b20bdeb13150e9 | [
"MIT"
] | 5,905 | 2015-01-02T17:05:36.000Z | 2022-03-29T07:28:29.000Z | electrum/dnssec.py | Jesusown/electrum | 0df05dd914c823acae1828cad3b20bdeb13150e9 | [
"MIT"
] | 6,097 | 2015-01-01T21:20:25.000Z | 2022-03-31T23:55:01.000Z | electrum/dnssec.py | Jesusown/electrum | 0df05dd914c823acae1828cad3b20bdeb13150e9 | [
"MIT"
] | 2,202 | 2015-01-02T18:31:25.000Z | 2022-03-28T15:35:03.000Z | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software,
# and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# Check DNSSEC trust chain.
# Todo: verify expiration dates
#
# Based on
# http://backreference.org/2010/11/17/dnssec-verification-with-dig/
# https://github.com/rthalley/dnspython/blob/master/tests/test_dnssec.py
import dns
import dns.name
import dns.query
import dns.dnssec
import dns.message
import dns.resolver
import dns.rdatatype
import dns.rdtypes.ANY.NS
import dns.rdtypes.ANY.CNAME
import dns.rdtypes.ANY.DLV
import dns.rdtypes.ANY.DNSKEY
import dns.rdtypes.ANY.DS
import dns.rdtypes.ANY.NSEC
import dns.rdtypes.ANY.NSEC3
import dns.rdtypes.ANY.NSEC3PARAM
import dns.rdtypes.ANY.RRSIG
import dns.rdtypes.ANY.SOA
import dns.rdtypes.ANY.TXT
import dns.rdtypes.IN.A
import dns.rdtypes.IN.AAAA
from .logging import get_logger
_logger = get_logger(__name__)
# hard-coded trust anchors (root KSKs)
trust_anchors = [
# KSK-2017:
dns.rrset.from_text('.', 1 , 'IN', 'DNSKEY', '257 3 8 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU='),
# KSK-2010:
dns.rrset.from_text('.', 15202, 'IN', 'DNSKEY', '257 3 8 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq QxA+Uk1ihz0='),
]
def _check_query(ns, sub, _type, keys):
q = dns.message.make_query(sub, _type, want_dnssec=True)
response = dns.query.tcp(q, ns, timeout=5)
assert response.rcode() == 0, 'No answer'
answer = response.answer
assert len(answer) != 0, ('No DNS record found', sub, _type)
assert len(answer) != 1, ('No DNSSEC record found', sub, _type)
if answer[0].rdtype == dns.rdatatype.RRSIG:
rrsig, rrset = answer
elif answer[1].rdtype == dns.rdatatype.RRSIG:
rrset, rrsig = answer
else:
raise Exception('No signature set in record')
if keys is None:
keys = {dns.name.from_text(sub):rrset}
dns.dnssec.validate(rrset, rrsig, keys)
return rrset
def _get_and_validate(ns, url, _type):
# get trusted root key
root_rrset = None
for dnskey_rr in trust_anchors:
try:
# Check if there is a valid signature for the root dnskey
root_rrset = _check_query(ns, '', dns.rdatatype.DNSKEY, {dns.name.root: dnskey_rr})
break
except dns.dnssec.ValidationFailure:
# It's OK as long as one key validates
continue
if not root_rrset:
raise dns.dnssec.ValidationFailure('None of the trust anchors found in DNS')
keys = {dns.name.root: root_rrset}
# top-down verification
parts = url.split('.')
for i in range(len(parts), 0, -1):
sub = '.'.join(parts[i-1:])
name = dns.name.from_text(sub)
# If server is authoritative, don't fetch DNSKEY
query = dns.message.make_query(sub, dns.rdatatype.NS)
response = dns.query.udp(query, ns, 3)
assert response.rcode() == dns.rcode.NOERROR, "query error"
rrset = response.authority[0] if len(response.authority) > 0 else response.answer[0]
rr = rrset[0]
if rr.rdtype == dns.rdatatype.SOA:
continue
# get DNSKEY (self-signed)
rrset = _check_query(ns, sub, dns.rdatatype.DNSKEY, None)
# get DS (signed by parent)
ds_rrset = _check_query(ns, sub, dns.rdatatype.DS, keys)
# verify that a signed DS validates DNSKEY
for ds in ds_rrset:
for dnskey in rrset:
htype = 'SHA256' if ds.digest_type == 2 else 'SHA1'
good_ds = dns.dnssec.make_ds(name, dnskey, htype)
if ds == good_ds:
break
else:
continue
break
else:
raise Exception("DS does not match DNSKEY")
# set key for next iteration
keys = {name: rrset}
# get TXT record (signed by zone)
rrset = _check_query(ns, url, _type, keys)
return rrset
def query(url, rtype):
# 8.8.8.8 is Google's public DNS server
nameservers = ['8.8.8.8']
ns = nameservers[0]
try:
out = _get_and_validate(ns, url, rtype)
validated = True
except Exception as e:
_logger.info(f"DNSSEC error: {repr(e)}")
out = dns.resolver.resolve(url, rtype)
validated = False
return out, validated
| 39.218543 | 418 | 0.700777 | 0 | 0 | [
-0.023296700790524483,
0.03495846316218376,
-0.0015191854909062386,
0.040491826832294464,
0.0360298827290535,
0.03488931804895401,
0.00706052640452981,
-0.008636373095214367,
0.016755711287260056,
0.004832853563129902,
0.007463095244020224,
-0.003574898699298501,
-0.016387009993195534,
0.005024714395403862,
-0.028200805187225342,
-0.012940013781189919,
0.1200176253914833,
0.04496295750141144,
-0.008948844857513905,
-0.0031292964704334736,
-0.00842986535280943,
-0.058227572590112686,
-0.03223033249378204,
-0.022589795291423798,
0.0014505699509754777,
-0.0862828865647316,
0.02723156474530697,
-0.016461199149489403,
-0.002664354396983981,
0.000588216760661453,
-0.02580595761537552,
0.024965381249785423,
-0.042366188019514084,
0.028500400483608246,
-0.027630295604467392,
0.02534325234591961,
-0.01754213683307171,
-0.05589260160923004,
-0.00028306152671575546,
-0.008689826354384422,
-0.061202943325042725,
-0.03975027799606323,
0.005934095475822687,
-0.022386593744158745,
0.017803944647312164,
0.027422815561294556,
-0.03331678733229637,
-0.0034785731695592403,
-0.057812102138996124,
0.011401073075830936,
0.022617587819695473,
-0.0026053390465676785,
0.02741825021803379,
0.0329873189330101,
0.010170417837798595,
-0.03956066817045212,
0.019551405683159828,
-0.06125771999359131,
0.008602508343756199,
-0.01016773097217083,
-0.024538058787584305,
-0.04706346243619919,
0.021002445369958878,
-0.006103466730564833,
-0.0029057925567030907,
0.016945065930485725,
0.010287204757332802,
0.01643892377614975,
-0.0631139948964119,
-0.023266250267624855,
0.017594831064343452,
0.0002349513815715909,
0.06329671293497086,
0.05515148490667343,
0.0037930626422166824,
-0.030696816742420197,
-0.001378590241074562,
-0.020573284476995468,
0.014328444376587868,
0.02172033116221428,
-0.007538687437772751,
0.07746701687574387,
0.018979985266923904,
0.022137349471449852,
-0.039062563329935074,
-0.014618041925132275,
-0.04136340692639351,
-0.03599616885185242,
0.010279004462063313,
0.016316456720232964,
0.013211274519562721,
-0.007957142777740955,
-0.02884964644908905,
-0.0450480654835701,
0.005482708569616079,
-0.05770512670278549,
0.017093025147914886,
-0.023778386414051056,
0.07553015649318695,
0.03064878284931183,
0.02385791763663292,
-0.0030094406101852655,
0.057421859353780746,
-0.03810245543718338,
0.03885887190699577,
-0.057280536741018295,
-0.0014213896356523037,
-0.0024174973368644714,
0.010451238602399826,
-0.022660942748188972,
0.04565449804067612,
-0.022307703271508217,
-0.002063095336779952,
-0.0007572888862341642,
-0.01937054470181465,
0.017430542036890984,
0.02693995088338852,
-0.012583116069436073,
-0.01915004290640354,
-0.02015865594148636,
-0.02442256361246109,
-0.008735987357795238,
-0.002822147449478507,
0.001289697946049273,
-0.05524282157421112,
0.018116317689418793,
-0.01308939978480339,
0.016348207369446754,
0.017198747023940086,
0.0020086015574634075,
0.012262098491191864,
0.01458489429205656,
0.027156544849276543,
0.0033715819008648396,
0.020902207121253014,
0.0373200997710228,
-0.001739750150591135,
0.05064663290977478,
-0.008908737450838089,
0.03730442374944687,
-0.033963922411203384,
0.018079185858368874,
-0.024879787117242813,
0.05854638293385506,
-0.029127629473805428,
-0.0340699665248394,
-0.06830018013715744,
-0.008704562671482563,
-0.002611579140648246,
-0.00549568934366107,
-0.00799516774713993,
0.014911223202943802,
-0.010863643139600754,
-0.03430497646331787,
-0.0072080884128808975,
0.006281320936977863,
-0.00873626209795475,
0.06201683357357979,
-0.05145652964711189,
-0.020195897668600082,
0.008698269724845886,
0.028144221752882004,
0.006994226947426796,
-0.012043822556734085,
0.001231442904099822,
-0.018880685791373253,
-0.008649216964840889,
0.0015890027862042189,
0.018880166113376617,
0.021294839680194855,
-0.0396086610853672,
0.015978975221514702,
0.0024259279016405344,
-0.010803443379700184,
-0.02234708145260811,
0.006896038539707661,
0.010711079463362694,
-0.024805724620819092,
-0.021458882838487625,
-0.0489480160176754,
-0.011714409105479717,
0.029817555099725723,
0.019353779032826424,
-0.011249378323554993,
-0.013973376713693142,
-0.08445461094379425,
-0.014298414811491966,
-0.08290232717990875,
-0.010657231323421001,
0.0003521225298754871,
0.03173063322901726,
0.00907741766422987,
-0.028385551646351814,
0.004083125852048397,
0.02133150026202202,
0.04667315259575844,
0.007492466364055872,
0.010698886588215828,
0.02430657483637333,
0.02234840579330921,
-0.015806378796696663,
-0.011169672943651676,
-0.030479002743959427,
0.021942179650068283,
0.013347767293453217,
0.01969240792095661,
-0.6572815775871277,
-0.006554018706083298,
0.022062672302126884,
-0.04858347773551941,
-0.0074004679918289185,
0.003064274089410901,
-0.05380544066429138,
0.0034917062148451805,
-0.03750257566571236,
-0.016127338632941246,
0.0030316764023154974,
0.022906506434082985,
-0.016021905466914177,
0.013936094008386135,
-0.035517796874046326,
-0.01795964129269123,
-0.011618604883551598,
-0.011844967491924763,
0.03703124821186066,
0.031416986137628555,
-0.0024209399707615376,
-0.032951824367046356,
0.047573626041412354,
0.017925655469298363,
0.012426034547388554,
-0.028166690841317177,
0.008939836174249649,
-0.02357843518257141,
0.016484839841723442,
0.031572867184877396,
0.016028454527258873,
-0.002471684478223324,
0.011890887282788754,
0.02507280372083187,
0.04099306836724281,
-0.020833659917116165,
0.046154461801052094,
0.0005537838442251086,
-0.01894979551434517,
0.028775691986083984,
0.002580838045105338,
0.004357343539595604,
-0.01994430087506771,
-0.05232697352766991,
-0.01354492548853159,
0.008549398742616177,
-0.03309457004070282,
0.017772525548934937,
-0.0073149423114955425,
0.0044389707036316395,
0.003807616885751486,
-0.020243987441062927,
-0.005722030531615019,
-0.019732339307665825,
-0.027249960228800774,
-0.0050703855231404305,
-0.00833137333393097,
0.0005483774584718049,
-0.008873208425939083,
0.0051558855921030045,
-0.025286350399255753,
0.0067425258457660675,
-0.020816318690776825,
0.01336668897420168,
0.008707589469850063,
0.01779722236096859,
0.003081787843257189,
-0.016507655382156372,
0.030610237270593643,
-0.011328932829201221,
-0.027740860357880592,
-0.00963481143116951,
-0.00436663581058383,
-0.030392440035939217,
0.06047319620847702,
0.030359312891960144,
-0.03159838914871216,
-0.022176217287778854,
-0.042435791343450546,
-0.008556614629924297,
0.010400443337857723,
-0.022933637723326683,
-0.01245061680674553,
-0.04780374839901924,
0.0006419513374567032,
0.030553258955478668,
-0.025647496804594994,
0.0014281969051808119,
-0.010050829499959946,
-0.027123577892780304,
0.04684838280081749,
0.016994629055261612,
-0.00041388304089196026,
0.00023993171635083854,
-0.009623176418244839,
0.011422579176723957,
0.01841197907924652,
0.04849326238036156,
-0.0245259627699852,
0.04468719661235809,
0.009131119586527348,
0.04342745244503021,
-0.009221385233104229,
0.05384998396039009,
0.005464712157845497,
-0.015692496672272682,
-0.005160165950655937,
-0.024963369593024254,
0.019718913361430168,
0.040662799030542374,
0.029039723798632622,
-0.01060524582862854,
-0.016309335827827454,
-0.02827238291501999,
-0.06431784480810165,
0.00125234411098063,
-0.000058601661294233054,
0.0008963524596765637,
0.01210288517177105,
-0.014101066626608372,
-0.029925337061285973,
-0.015138034708797932,
-0.026911737397313118,
-0.036230362951755524,
-0.0736287459731102,
-0.00784024503082037,
-0.010130046866834164,
0.011335363611578941,
-0.02470042183995247,
0.020028404891490936,
0.00043549935799092054,
-0.0022702659480273724,
-0.055422861129045486,
0.012932373210787773,
0.03152455762028694,
0.022464226931333542,
0.00300893047824502,
-0.010510803200304508,
0.0007068940903991461,
-0.023113468661904335,
-0.04566676914691925,
0.005074620712548494,
-0.018006732687354088,
0.024831365793943405,
-0.00625520758330822,
0.02336232364177704,
-0.014819778501987457,
-0.014724686741828918,
-0.027882106602191925,
0.0014898922527208924,
-0.007707290817052126,
0.0106697091832757,
0.0011325911618769169,
0.009856768883764744,
-0.07167109847068787,
0.009910543449223042,
-0.012946653179824352,
0.00005473418423207477,
0.0058098589070141315,
0.007388273719698191,
-0.015464667230844498,
-0.02018279954791069,
-0.014936448074877262,
0.04356351122260094,
-0.01793540082871914,
0.03245757147669792,
0.0023207159247249365,
-0.029816240072250366,
-0.0169297456741333,
0.043671101331710815,
0.07153290510177612,
-0.004069294314831495,
-0.013485697098076344,
0.04569769278168678,
0.050541847944259644,
0.0454716682434082,
-0.017391670495271683,
0.009354573674499989,
-0.07327532768249512,
0.04467574506998062,
-0.010879048146307468,
0.007749964948743582,
0.015096710063517094,
0.007451754063367844,
-0.0003655069158412516,
0.006763511803001165,
0.03471250832080841,
-0.00906437449157238,
0.00872355792671442,
0.011211665347218513,
0.022089000791311264,
-0.026965191587805748,
-0.03561849892139435,
0.023512335494160652,
-0.004185424651950598,
-0.010446270927786827,
-0.013229184783995152,
-0.01315427664667368,
0.027373285964131355,
-0.023306474089622498,
-0.021849824115633965,
-0.001884929253719747,
-0.008442118763923645,
-0.014354361221194267,
0.03341827169060707,
0.04522959887981415,
-0.027562590315937996,
-0.020797887817025185,
0.025307536125183105,
-0.01528703048825264,
0.02985655888915062,
0.018183870241045952,
-0.024671312421560287,
-0.011267679743468761,
-0.018196184188127518,
0.06615329533815384,
0.0031096211168915033,
-0.017243260517716408,
-0.04006306454539299,
0.011983873322606087,
-0.017926281318068504,
0.006041721906512976,
-0.017288176342844963,
-0.012916640378534794,
0.02711997926235199,
-0.016913237050175667,
-0.026180366054177284,
-0.011796875856816769,
0.00006475496775237843,
-0.033678121864795685,
0.0006883327732793987,
-0.0076598417945206165,
-0.0009399997652508318,
-0.019321918487548828,
0.045783333480358124,
0.045641299337148666,
-0.014151081442832947,
0.01908176578581333,
0.004460717085748911,
0.020398098975419998,
-0.01794022135436535,
-0.023241186514496803,
-0.08786880224943161,
0.006075650919228792,
-0.04114198312163353,
0.013132860884070396,
0.024285178631544113,
-0.0060522351413965225,
0.0030713339801877737,
0.018845556303858757,
0.022799532860517502,
-0.003932924475520849,
0.047306545078754425,
0.00377991097047925,
-0.00862802192568779,
0.04189886897802353,
-0.026642311364412308,
0.02235056646168232,
0.006979705765843391,
0.00010594474588287994,
-0.008992942050099373,
0.0030823734123259783,
-0.042782388627529144,
-0.009976067580282688,
0.008357120677828789,
-0.011542043648660183,
0.04428723454475403,
0.03019709698855877,
-0.032266587018966675,
0.022048981860280037,
0.023231547325849533,
0.03780317306518555,
-0.035600192844867706,
-0.01525989081710577,
0.00942805502563715,
0.0698976144194603,
-0.006960950791835785,
-0.0008597999112680554,
-0.016348181292414665,
-0.015084054321050644,
0.04595456272363663,
-0.02486489526927471,
-0.00038022969965822995,
0.01827963814139366,
-0.032970625907182693,
0.015518112108111382,
0.004048227798193693,
-0.0024743489921092987,
0.006746103521436453,
0.01536719873547554,
0.010689164511859417,
-0.02861628867685795,
0.058097921311855316,
-0.024277186021208763,
0.012228196486830711,
-0.005730525590479374,
-0.027194790542125702,
0.02159370854496956,
0.013923765160143375,
0.0013783478643745184,
-0.03245436027646065,
0.009247208945453167,
0.011107033118605614,
0.011351121589541435,
-0.06014203280210495,
0.00900933425873518,
0.03200160712003708,
0.007132848259061575,
0.02038753777742386,
0.01134400349110365,
-0.01401445735245943,
0.029876166954636574,
-0.015853026881814003,
0.0399579256772995,
0.03243638947606087,
0.004770488012582064,
0.03322744742035866,
-0.006319848354905844,
0.025231774896383286,
0.016413435339927673,
-0.006672456860542297,
0.005629357881844044,
-0.01828891411423683,
-0.012140849605202675,
0.0008608418283984065,
-0.03733310475945473,
-0.0169270858168602,
-0.021639898419380188,
-0.02031399868428707,
0.023768750950694084,
-0.04216922074556351,
0.05065128579735756,
-0.02536347508430481,
0.01772904209792614,
0.010021924041211605,
-0.0016431385884061456,
0.007656874600797892,
-0.013631073758006096,
0.03187667578458786,
0.027968404814600945,
-0.05720985680818558,
0.06283137947320938,
0.007689375430345535,
-0.015575679950416088,
0.01151206623762846,
-0.0010297177359461784,
0.03143823891878128,
0.0008417919161729515,
-0.029681170359253883,
-0.0036168410442769527,
0.01107861939817667,
0.005192888900637627,
0.054286204278469086,
-0.02349832095205784,
0.011191748082637787,
0.024527184665203094,
0.008987044915556908,
-0.00284893368370831,
0.02730998583137989,
-0.048714060336351395,
0.007582738064229488,
0.018707329407334328,
0.07597967982292175,
0.002615319797769189,
0.025261685252189636,
-0.034198641777038574,
-0.01299266703426838,
0.008283345960080624,
-0.05493587255477905,
0.023623568937182426,
0.00852107722312212,
-0.04906684160232544,
0.008289077319204807,
0.00006535811553476378,
0.008978798054158688,
-0.004823343362659216,
0.05437112972140312,
-0.03406882286071777,
0.03814305365085602,
0.0002018847590079531,
-0.0440666489303112,
-0.033520713448524475,
-0.04295256361365318,
0.01313996221870184,
-0.011650924570858479,
-0.0067765782587230206,
0.0052177757024765015,
-0.02786426991224289,
0.01010450255125761,
0.0280055720359087,
-0.0006794552900828421,
-0.021612219512462616,
0.00039846726576797664,
0.037661876529455185,
-0.017587782815098763,
0.0074927471578121185,
-0.004316740669310093,
-0.003433812875300646,
-0.01957695186138153,
0.06682127714157104,
0.018974682316184044,
0.026913104578852654,
-0.01754537783563137,
0.04510513320565224,
-0.0015219113556668162,
-0.037305399775505066,
-0.020528756082057953,
0.009017780423164368,
0.030339982360601425,
0.012505154125392437,
-0.008664481341838837,
0.07001034915447235,
-0.037058450281620026,
-0.018373778089880943,
-0.004914482589811087,
0.03626854717731476,
0.0009530449751764536,
-0.009249075315892696,
-0.03198042884469032,
-0.008383172564208508,
-0.013080749660730362,
-0.005764263216406107,
-0.012073817662894726,
0.01553551945835352,
0.004145293962210417,
0.008184564299881458,
-0.02173159457743168,
0.0013875768054276705,
-0.013164075091481209,
0.014917080290615559,
0.029006972908973694,
-0.03505918011069298,
0.025402504950761795,
0.009491696022450924,
0.024369873106479645,
-0.0263163261115551,
-0.02333618514239788,
-0.008398719131946564,
-0.06487856060266495,
0.003622561227530241,
-0.006217222660779953,
-0.004967628978192806,
-0.004449575208127499,
0.031465012580156326,
0.018913069739937782,
-0.03361421823501587,
0.016401562839746475,
0.0265946127474308,
-0.004256741609424353,
-0.005413493607193232,
-0.0037675141356885433,
0.008102125488221645,
0.03303001821041107,
-0.06166039779782295,
0.022003469988703728,
-0.01644054800271988,
0.019290128722786903,
0.010937237180769444,
-0.019444279372692108,
0.03339371457695961,
0.012851220555603504,
0.005893777124583721,
-0.023221369832754135,
-0.033078987151384354,
-0.03499380126595497,
0.005265821702778339,
-0.029958324506878853,
-0.0050587160512804985,
-0.008840594440698624,
0.008806862868368626,
-0.04339558258652687,
0.023286152631044388,
0.03861051797866821,
-0.002947343047708273,
-0.006896865554153919,
-0.024931682273745537,
0.00613694591447711,
-0.01607442833483219,
-0.002174840308725834,
-0.011370858177542686,
-0.08048155158758163,
-0.012820359319448471,
0.0024106623604893684,
0.015802577137947083,
-0.00742785818874836,
-0.0010466229869052768,
0.016275210306048393,
-0.016305819153785706,
-0.012630176730453968,
-0.023263515904545784,
-0.007035743445158005,
0.015554736368358135,
0.015277358703315258,
0.04541122540831566,
0.005550337955355644,
-0.008453093469142914,
0.005247336346656084,
-0.06897810846567154,
0.009221122600138187,
0.017590675503015518,
0.013633985072374344,
0.03056911565363407,
0.021471871063113213,
0.011768598109483719,
-0.015775684267282486,
0.03617095947265625,
-0.0018757152138277888,
0.04924503341317177,
-0.012170957401394844,
-0.009748618118464947,
-0.013149797916412354,
0.014283076860010624,
-0.025390226393938065,
-0.02867838554084301,
0.014678812585771084,
-0.023245738819241524,
0.022979862987995148,
-0.018860531970858574,
-0.011775454506278038,
0.03643269091844559,
0.012111258693039417,
-0.06054535135626793,
0.051895249634981155,
-0.004087354987859726,
0.0057143233716487885,
0.00033479303237982094,
-0.0013309948844835162,
-0.05190625041723251,
0.007877438329160213,
-0.0076220897026360035,
0.027749307453632355,
-0.0027328990399837494,
0.02600959874689579,
0.020588357001543045,
0.01107922475785017,
-0.004245531279593706,
0.03171902894973755,
-0.011074580252170563,
0.02481972426176071,
-0.028041284531354904,
0.0482964813709259,
-0.00822819396853447,
0.006038979161530733,
-0.021282942965626717,
-0.02590765431523323,
0.007284319028258324,
0.00550538906827569,
-0.008391432464122772,
0.008519681170582771,
-0.029787832871079445,
-0.01595526747405529,
0.03492802381515503,
0.042413219809532166,
-0.009556669741868973,
-0.005662956275045872,
0.0027814614586532116,
0.04390055686235428,
-0.004044939763844013,
-0.029948268085718155,
-0.017802461981773376,
-0.029947344213724136,
0.030139142647385597
] |
8a681bd50a01e317584f76158f59adbe05396fb6 | 61,870 | py | Python | specs/d3d11.py | ds-hwang/apitrace | b74347ebae0d033a013c4de3efb0e9165e9cea8f | [
"MIT"
] | 1 | 2017-06-07T15:28:36.000Z | 2017-06-07T15:28:36.000Z | specs/d3d11.py | jciehl/apitrace | 0e01acc36de14e9ca7c0ced258767ffb99ac96ea | [
"MIT"
] | null | null | null | specs/d3d11.py | jciehl/apitrace | 0e01acc36de14e9ca7c0ced258767ffb99ac96ea | [
"MIT"
] | 1 | 2021-05-21T18:27:29.000Z | 2021-05-21T18:27:29.000Z | ##########################################################################
#
# Copyright 2012 Jose Fonseca
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
##########################################################################/
from dxgi import *
from d3dcommon import *
from d3d11sdklayers import *
HRESULT = MAKE_HRESULT([
"D3D11_ERROR_FILE_NOT_FOUND",
"D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS",
"D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS",
"D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD",
"D3DERR_INVALIDCALL",
"D3DERR_WASSTILLDRAWING",
])
ID3D11DepthStencilState = Interface("ID3D11DepthStencilState", ID3D11DeviceChild)
ID3D11BlendState = Interface("ID3D11BlendState", ID3D11DeviceChild)
ID3D11RasterizerState = Interface("ID3D11RasterizerState", ID3D11DeviceChild)
ID3D11Resource = Interface("ID3D11Resource", ID3D11DeviceChild)
ID3D11Buffer = Interface("ID3D11Buffer", ID3D11Resource)
ID3D11Texture1D = Interface("ID3D11Texture1D", ID3D11Resource)
ID3D11Texture2D = Interface("ID3D11Texture2D", ID3D11Resource)
ID3D11Texture3D = Interface("ID3D11Texture3D", ID3D11Resource)
ID3D11View = Interface("ID3D11View", ID3D11DeviceChild)
ID3D11ShaderResourceView = Interface("ID3D11ShaderResourceView", ID3D11View)
ID3D11RenderTargetView = Interface("ID3D11RenderTargetView", ID3D11View)
ID3D11DepthStencilView = Interface("ID3D11DepthStencilView", ID3D11View)
ID3D11UnorderedAccessView = Interface("ID3D11UnorderedAccessView", ID3D11View)
ID3D11VertexShader = Interface("ID3D11VertexShader", ID3D11DeviceChild)
ID3D11HullShader = Interface("ID3D11HullShader", ID3D11DeviceChild)
ID3D11DomainShader = Interface("ID3D11DomainShader", ID3D11DeviceChild)
ID3D11GeometryShader = Interface("ID3D11GeometryShader", ID3D11DeviceChild)
ID3D11PixelShader = Interface("ID3D11PixelShader", ID3D11DeviceChild)
ID3D11ComputeShader = Interface("ID3D11ComputeShader", ID3D11DeviceChild)
ID3D11InputLayout = Interface("ID3D11InputLayout", ID3D11DeviceChild)
ID3D11SamplerState = Interface("ID3D11SamplerState", ID3D11DeviceChild)
ID3D11Asynchronous = Interface("ID3D11Asynchronous", ID3D11DeviceChild)
ID3D11Query = Interface("ID3D11Query", ID3D11Asynchronous)
ID3D11Predicate = Interface("ID3D11Predicate", ID3D11Query)
ID3D11Counter = Interface("ID3D11Counter", ID3D11Asynchronous)
ID3D11ClassInstance = Interface("ID3D11ClassInstance", ID3D11DeviceChild)
ID3D11ClassLinkage = Interface("ID3D11ClassLinkage", ID3D11DeviceChild)
ID3D11CommandList = Interface("ID3D11CommandList", ID3D11DeviceChild)
ID3D11Device = Interface("ID3D11Device", IUnknown)
D3D11_INPUT_CLASSIFICATION = Enum("D3D11_INPUT_CLASSIFICATION", [
"D3D11_INPUT_PER_VERTEX_DATA",
"D3D11_INPUT_PER_INSTANCE_DATA",
])
D3D11_INPUT_ELEMENT_ALIGNED_BYTE_OFFSET = FakeEnum(UINT, [
"D3D11_APPEND_ALIGNED_ELEMENT",
])
D3D11_INPUT_ELEMENT_DESC = Struct("D3D11_INPUT_ELEMENT_DESC", [
(LPCSTR, "SemanticName"),
(UINT, "SemanticIndex"),
(DXGI_FORMAT, "Format"),
(UINT, "InputSlot"),
(D3D11_INPUT_ELEMENT_ALIGNED_BYTE_OFFSET, "AlignedByteOffset"),
(D3D11_INPUT_CLASSIFICATION, "InputSlotClass"),
(UINT, "InstanceDataStepRate"),
])
D3D11_FILL_MODE = Enum("D3D11_FILL_MODE", [
"D3D11_FILL_WIREFRAME",
"D3D11_FILL_SOLID",
])
D3D11_PRIMITIVE_TOPOLOGY = Enum("D3D11_PRIMITIVE_TOPOLOGY", [
"D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED",
"D3D11_PRIMITIVE_TOPOLOGY_POINTLIST",
"D3D11_PRIMITIVE_TOPOLOGY_LINELIST",
"D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP",
"D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST",
"D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP",
"D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ",
"D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ",
"D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ",
"D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ",
"D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST",
"D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST",
])
D3D11_PRIMITIVE = Enum("D3D11_PRIMITIVE", [
"D3D11_PRIMITIVE_UNDEFINED",
"D3D11_PRIMITIVE_POINT",
"D3D11_PRIMITIVE_LINE",
"D3D11_PRIMITIVE_TRIANGLE",
"D3D11_PRIMITIVE_LINE_ADJ",
"D3D11_PRIMITIVE_TRIANGLE_ADJ",
"D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH",
"D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH",
])
D3D11_CULL_MODE = Enum("D3D11_CULL_MODE", [
"D3D11_CULL_NONE",
"D3D11_CULL_FRONT",
"D3D11_CULL_BACK",
])
D3D11_SO_DECLARATION_ENTRY = Struct("D3D11_SO_DECLARATION_ENTRY", [
(UINT, "Stream"),
(LPCSTR, "SemanticName"),
(UINT, "SemanticIndex"),
(BYTE, "StartComponent"),
(BYTE, "ComponentCount"),
(BYTE, "OutputSlot"),
])
D3D11_VIEWPORT = Struct("D3D11_VIEWPORT", [
(FLOAT, "TopLeftX"),
(FLOAT, "TopLeftY"),
(FLOAT, "Width"),
(FLOAT, "Height"),
(FLOAT, "MinDepth"),
(FLOAT, "MaxDepth"),
])
D3D11_RESOURCE_DIMENSION = Enum("D3D11_RESOURCE_DIMENSION", [
"D3D11_RESOURCE_DIMENSION_UNKNOWN",
"D3D11_RESOURCE_DIMENSION_BUFFER",
"D3D11_RESOURCE_DIMENSION_TEXTURE1D",
"D3D11_RESOURCE_DIMENSION_TEXTURE2D",
"D3D11_RESOURCE_DIMENSION_TEXTURE3D",
])
D3D11_SRV_DIMENSION = Enum("D3D11_SRV_DIMENSION", [
"D3D11_SRV_DIMENSION_UNKNOWN",
"D3D11_SRV_DIMENSION_BUFFER",
"D3D11_SRV_DIMENSION_TEXTURE1D",
"D3D11_SRV_DIMENSION_TEXTURE1DARRAY",
"D3D11_SRV_DIMENSION_TEXTURE2D",
"D3D11_SRV_DIMENSION_TEXTURE2DARRAY",
"D3D11_SRV_DIMENSION_TEXTURE2DMS",
"D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY",
"D3D11_SRV_DIMENSION_TEXTURE3D",
"D3D11_SRV_DIMENSION_TEXTURECUBE",
"D3D11_SRV_DIMENSION_TEXTURECUBEARRAY",
"D3D11_SRV_DIMENSION_BUFFEREX",
])
D3D11_DSV_DIMENSION = Enum("D3D11_DSV_DIMENSION", [
"D3D11_DSV_DIMENSION_UNKNOWN",
"D3D11_DSV_DIMENSION_TEXTURE1D",
"D3D11_DSV_DIMENSION_TEXTURE1DARRAY",
"D3D11_DSV_DIMENSION_TEXTURE2D",
"D3D11_DSV_DIMENSION_TEXTURE2DARRAY",
"D3D11_DSV_DIMENSION_TEXTURE2DMS",
"D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY",
])
D3D11_RTV_DIMENSION = Enum("D3D11_RTV_DIMENSION", [
"D3D11_RTV_DIMENSION_UNKNOWN",
"D3D11_RTV_DIMENSION_BUFFER",
"D3D11_RTV_DIMENSION_TEXTURE1D",
"D3D11_RTV_DIMENSION_TEXTURE1DARRAY",
"D3D11_RTV_DIMENSION_TEXTURE2D",
"D3D11_RTV_DIMENSION_TEXTURE2DARRAY",
"D3D11_RTV_DIMENSION_TEXTURE2DMS",
"D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY",
"D3D11_RTV_DIMENSION_TEXTURE3D",
])
D3D11_UAV_DIMENSION = Enum("D3D11_UAV_DIMENSION", [
"D3D11_UAV_DIMENSION_UNKNOWN",
"D3D11_UAV_DIMENSION_BUFFER",
"D3D11_UAV_DIMENSION_TEXTURE1D",
"D3D11_UAV_DIMENSION_TEXTURE1DARRAY",
"D3D11_UAV_DIMENSION_TEXTURE2D",
"D3D11_UAV_DIMENSION_TEXTURE2DARRAY",
"D3D11_UAV_DIMENSION_TEXTURE3D",
])
D3D11_USAGE = Enum("D3D11_USAGE", [
"D3D11_USAGE_DEFAULT",
"D3D11_USAGE_IMMUTABLE",
"D3D11_USAGE_DYNAMIC",
"D3D11_USAGE_STAGING",
])
D3D11_BIND_FLAG = Flags(UINT, [
"D3D11_BIND_VERTEX_BUFFER",
"D3D11_BIND_INDEX_BUFFER",
"D3D11_BIND_CONSTANT_BUFFER",
"D3D11_BIND_SHADER_RESOURCE",
"D3D11_BIND_STREAM_OUTPUT",
"D3D11_BIND_RENDER_TARGET",
"D3D11_BIND_DEPTH_STENCIL",
"D3D11_BIND_UNORDERED_ACCESS",
])
D3D11_CPU_ACCESS_FLAG = Flags(UINT, [
"D3D11_CPU_ACCESS_WRITE",
"D3D11_CPU_ACCESS_READ",
])
D3D11_RESOURCE_MISC_FLAG = Flags(UINT, [
"D3D11_RESOURCE_MISC_GENERATE_MIPS",
"D3D11_RESOURCE_MISC_SHARED",
"D3D11_RESOURCE_MISC_TEXTURECUBE",
"D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS",
"D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS",
"D3D11_RESOURCE_MISC_BUFFER_STRUCTURED",
"D3D11_RESOURCE_MISC_RESOURCE_CLAMP",
"D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX",
"D3D11_RESOURCE_MISC_GDI_COMPATIBLE",
])
D3D11_MAP = Enum("D3D11_MAP", [
"D3D11_MAP_READ",
"D3D11_MAP_WRITE",
"D3D11_MAP_READ_WRITE",
"D3D11_MAP_WRITE_DISCARD",
"D3D11_MAP_WRITE_NO_OVERWRITE",
])
D3D11_MAP_FLAG = Flags(UINT, [
"D3D11_MAP_FLAG_DO_NOT_WAIT",
])
D3D11_RAISE_FLAG = Flags(UINT, [
"D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR",
])
D3D11_CLEAR_FLAG = Flags(UINT, [
"D3D11_CLEAR_DEPTH",
"D3D11_CLEAR_STENCIL",
])
D3D11_RECT = Alias("D3D11_RECT", RECT)
D3D11_BOX = Struct("D3D11_BOX", [
(UINT, "left"),
(UINT, "top"),
(UINT, "front"),
(UINT, "right"),
(UINT, "bottom"),
(UINT, "back"),
])
ID3D11DeviceChild.methods += [
StdMethod(Void, "GetDevice", [Out(Pointer(ObjPointer(ID3D11Device)), "ppDevice")]),
StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")]),
StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]),
StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")]),
]
D3D11_COMPARISON_FUNC = Enum("D3D11_COMPARISON_FUNC", [
"D3D11_COMPARISON_NEVER",
"D3D11_COMPARISON_LESS",
"D3D11_COMPARISON_EQUAL",
"D3D11_COMPARISON_LESS_EQUAL",
"D3D11_COMPARISON_GREATER",
"D3D11_COMPARISON_NOT_EQUAL",
"D3D11_COMPARISON_GREATER_EQUAL",
"D3D11_COMPARISON_ALWAYS",
])
D3D11_DEPTH_WRITE_MASK = Enum("D3D11_DEPTH_WRITE_MASK", [
"D3D11_DEPTH_WRITE_MASK_ZERO",
"D3D11_DEPTH_WRITE_MASK_ALL",
])
D3D11_STENCIL_OP = Enum("D3D11_STENCIL_OP", [
"D3D11_STENCIL_OP_KEEP",
"D3D11_STENCIL_OP_ZERO",
"D3D11_STENCIL_OP_REPLACE",
"D3D11_STENCIL_OP_INCR_SAT",
"D3D11_STENCIL_OP_DECR_SAT",
"D3D11_STENCIL_OP_INVERT",
"D3D11_STENCIL_OP_INCR",
"D3D11_STENCIL_OP_DECR",
])
D3D11_DEPTH_STENCILOP_DESC = Struct("D3D11_DEPTH_STENCILOP_DESC", [
(D3D11_STENCIL_OP, "StencilFailOp"),
(D3D11_STENCIL_OP, "StencilDepthFailOp"),
(D3D11_STENCIL_OP, "StencilPassOp"),
(D3D11_COMPARISON_FUNC, "StencilFunc"),
])
D3D11_DEPTH_STENCIL_DESC = Struct("D3D11_DEPTH_STENCIL_DESC", [
(BOOL, "DepthEnable"),
(D3D11_DEPTH_WRITE_MASK, "DepthWriteMask"),
(D3D11_COMPARISON_FUNC, "DepthFunc"),
(BOOL, "StencilEnable"),
(UINT8, "StencilReadMask"),
(UINT8, "StencilWriteMask"),
(D3D11_DEPTH_STENCILOP_DESC, "FrontFace"),
(D3D11_DEPTH_STENCILOP_DESC, "BackFace"),
])
ID3D11DepthStencilState.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_DEPTH_STENCIL_DESC), "pDesc")]),
]
D3D11_BLEND = Enum("D3D11_BLEND", [
"D3D11_BLEND_ZERO",
"D3D11_BLEND_ONE",
"D3D11_BLEND_SRC_COLOR",
"D3D11_BLEND_INV_SRC_COLOR",
"D3D11_BLEND_SRC_ALPHA",
"D3D11_BLEND_INV_SRC_ALPHA",
"D3D11_BLEND_DEST_ALPHA",
"D3D11_BLEND_INV_DEST_ALPHA",
"D3D11_BLEND_DEST_COLOR",
"D3D11_BLEND_INV_DEST_COLOR",
"D3D11_BLEND_SRC_ALPHA_SAT",
"D3D11_BLEND_BLEND_FACTOR",
"D3D11_BLEND_INV_BLEND_FACTOR",
"D3D11_BLEND_SRC1_COLOR",
"D3D11_BLEND_INV_SRC1_COLOR",
"D3D11_BLEND_SRC1_ALPHA",
"D3D11_BLEND_INV_SRC1_ALPHA",
])
D3D11_BLEND_OP = Enum("D3D11_BLEND_OP", [
"D3D11_BLEND_OP_ADD",
"D3D11_BLEND_OP_SUBTRACT",
"D3D11_BLEND_OP_REV_SUBTRACT",
"D3D11_BLEND_OP_MIN",
"D3D11_BLEND_OP_MAX",
])
D3D11_COLOR_WRITE_ENABLE = Enum("D3D11_COLOR_WRITE_ENABLE", [
"D3D11_COLOR_WRITE_ENABLE_ALL",
"D3D11_COLOR_WRITE_ENABLE_RED",
"D3D11_COLOR_WRITE_ENABLE_GREEN",
"D3D11_COLOR_WRITE_ENABLE_BLUE",
"D3D11_COLOR_WRITE_ENABLE_ALPHA",
])
D3D11_RENDER_TARGET_BLEND_DESC = Struct("D3D11_RENDER_TARGET_BLEND_DESC", [
(BOOL, "BlendEnable"),
(D3D11_BLEND, "SrcBlend"),
(D3D11_BLEND, "DestBlend"),
(D3D11_BLEND_OP, "BlendOp"),
(D3D11_BLEND, "SrcBlendAlpha"),
(D3D11_BLEND, "DestBlendAlpha"),
(D3D11_BLEND_OP, "BlendOpAlpha"),
(UINT8, "RenderTargetWriteMask"),
])
D3D11_BLEND_DESC = Struct("D3D11_BLEND_DESC", [
(BOOL, "AlphaToCoverageEnable"),
(BOOL, "IndependentBlendEnable"),
(Array(D3D11_RENDER_TARGET_BLEND_DESC, 8), "RenderTarget"),
])
ID3D11BlendState.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_BLEND_DESC), "pDesc")]),
]
D3D11_RASTERIZER_DESC = Struct("D3D11_RASTERIZER_DESC", [
(D3D11_FILL_MODE, "FillMode"),
(D3D11_CULL_MODE, "CullMode"),
(BOOL, "FrontCounterClockwise"),
(INT, "DepthBias"),
(FLOAT, "DepthBiasClamp"),
(FLOAT, "SlopeScaledDepthBias"),
(BOOL, "DepthClipEnable"),
(BOOL, "ScissorEnable"),
(BOOL, "MultisampleEnable"),
(BOOL, "AntialiasedLineEnable"),
])
ID3D11RasterizerState.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_RASTERIZER_DESC), "pDesc")]),
]
D3D11_SUBRESOURCE_DATA = Struct("D3D11_SUBRESOURCE_DATA", [
(OpaquePointer(Const(Void)), "pSysMem"),
(UINT, "SysMemPitch"),
(UINT, "SysMemSlicePitch"),
])
D3D11_MAPPED_SUBRESOURCE = Struct("D3D11_MAPPED_SUBRESOURCE", [
(OpaquePointer(Void), "pData"),
(UINT, "RowPitch"),
(UINT, "DepthPitch"),
])
ID3D11Resource.methods += [
StdMethod(Void, "GetType", [Out(Pointer(D3D11_RESOURCE_DIMENSION), "pResourceDimension")]),
StdMethod(Void, "SetEvictionPriority", [(UINT, "EvictionPriority")]),
StdMethod(UINT, "GetEvictionPriority", []),
]
D3D11_BUFFER_DESC = Struct("D3D11_BUFFER_DESC", [
(UINT, "ByteWidth"),
(D3D11_USAGE, "Usage"),
(D3D11_BIND_FLAG, "BindFlags"),
(D3D11_CPU_ACCESS_FLAG, "CPUAccessFlags"),
(D3D11_RESOURCE_MISC_FLAG, "MiscFlags"),
(UINT, "StructureByteStride"),
])
ID3D11Buffer.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_BUFFER_DESC), "pDesc")]),
]
D3D11_TEXTURE1D_DESC = Struct("D3D11_TEXTURE1D_DESC", [
(UINT, "Width"),
(UINT, "MipLevels"),
(UINT, "ArraySize"),
(DXGI_FORMAT, "Format"),
(D3D11_USAGE, "Usage"),
(D3D11_BIND_FLAG, "BindFlags"),
(D3D11_CPU_ACCESS_FLAG, "CPUAccessFlags"),
(D3D11_RESOURCE_MISC_FLAG, "MiscFlags"),
])
ID3D11Texture1D.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_TEXTURE1D_DESC), "pDesc")]),
]
D3D11_TEXTURE2D_DESC = Struct("D3D11_TEXTURE2D_DESC", [
(UINT, "Width"),
(UINT, "Height"),
(UINT, "MipLevels"),
(UINT, "ArraySize"),
(DXGI_FORMAT, "Format"),
(DXGI_SAMPLE_DESC, "SampleDesc"),
(D3D11_USAGE, "Usage"),
(D3D11_BIND_FLAG, "BindFlags"),
(D3D11_CPU_ACCESS_FLAG, "CPUAccessFlags"),
(D3D11_RESOURCE_MISC_FLAG, "MiscFlags"),
])
ID3D11Texture2D.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_TEXTURE2D_DESC), "pDesc")]),
]
D3D11_TEXTURE3D_DESC = Struct("D3D11_TEXTURE3D_DESC", [
(UINT, "Width"),
(UINT, "Height"),
(UINT, "Depth"),
(UINT, "MipLevels"),
(DXGI_FORMAT, "Format"),
(D3D11_USAGE, "Usage"),
(D3D11_BIND_FLAG, "BindFlags"),
(D3D11_CPU_ACCESS_FLAG, "CPUAccessFlags"),
(D3D11_RESOURCE_MISC_FLAG, "MiscFlags"),
])
ID3D11Texture3D.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_TEXTURE3D_DESC), "pDesc")]),
]
D3D11_TEXTURECUBE_FACE = Enum("D3D11_TEXTURECUBE_FACE", [
"D3D11_TEXTURECUBE_FACE_POSITIVE_X",
"D3D11_TEXTURECUBE_FACE_NEGATIVE_X",
"D3D11_TEXTURECUBE_FACE_POSITIVE_Y",
"D3D11_TEXTURECUBE_FACE_NEGATIVE_Y",
"D3D11_TEXTURECUBE_FACE_POSITIVE_Z",
"D3D11_TEXTURECUBE_FACE_NEGATIVE_Z",
])
ID3D11View.methods += [
StdMethod(Void, "GetResource", [Out(Pointer(ObjPointer(ID3D11Resource)), "ppResource")]),
]
D3D11_BUFFER_SRV = Struct("D3D11_BUFFER_SRV", [
(Union(None, [(UINT, "FirstElement"), (UINT, "ElementOffset")]), None),
(Union(None, [(UINT, "NumElements"), (UINT, "ElementWidth")]), None),
])
D3D11_BUFFEREX_SRV_FLAG = Flags(UINT, [
"D3D11_BUFFEREX_SRV_FLAG_RAW",
])
D3D11_BUFFEREX_SRV = Struct("D3D11_BUFFEREX_SRV", [
(UINT, "FirstElement"),
(UINT, "NumElements"),
(D3D11_BUFFEREX_SRV_FLAG, "Flags"),
])
D3D11_TEX1D_SRV = Struct("D3D11_TEX1D_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
])
D3D11_TEX1D_ARRAY_SRV = Struct("D3D11_TEX1D_ARRAY_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2D_SRV = Struct("D3D11_TEX2D_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
])
D3D11_TEX2D_ARRAY_SRV = Struct("D3D11_TEX2D_ARRAY_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX3D_SRV = Struct("D3D11_TEX3D_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
])
D3D11_TEXCUBE_SRV = Struct("D3D11_TEXCUBE_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
])
D3D11_TEXCUBE_ARRAY_SRV = Struct("D3D11_TEXCUBE_ARRAY_SRV", [
(UINT, "MostDetailedMip"),
(UINT, "MipLevels"),
(UINT, "First2DArrayFace"),
(UINT, "NumCubes"),
])
D3D11_TEX2DMS_SRV = Struct("D3D11_TEX2DMS_SRV", [
(UINT, "UnusedField_NothingToDefine"),
])
D3D11_TEX2DMS_ARRAY_SRV = Struct("D3D11_TEX2DMS_ARRAY_SRV", [
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_SHADER_RESOURCE_VIEW_DESC = Struct("D3D11_SHADER_RESOURCE_VIEW_DESC", [
(DXGI_FORMAT, "Format"),
(D3D11_SRV_DIMENSION, "ViewDimension"),
(Union(None, [
(D3D11_BUFFER_SRV, "Buffer"),
(D3D11_TEX1D_SRV, "Texture1D"),
(D3D11_TEX1D_ARRAY_SRV, "Texture1DArray"),
(D3D11_TEX2D_SRV, "Texture2D"),
(D3D11_TEX2D_ARRAY_SRV, "Texture2DArray"),
(D3D11_TEX2DMS_SRV, "Texture2DMS"),
(D3D11_TEX2DMS_ARRAY_SRV, "Texture2DMSArray"),
(D3D11_TEX3D_SRV, "Texture3D"),
(D3D11_TEXCUBE_SRV, "TextureCube"),
(D3D11_TEXCUBE_ARRAY_SRV, "TextureCubeArray"),
(D3D11_BUFFEREX_SRV, "BufferEx"),
]), None),
])
ID3D11ShaderResourceView.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_SHADER_RESOURCE_VIEW_DESC), "pDesc")]),
]
D3D11_BUFFER_RTV = Struct("D3D11_BUFFER_RTV", [
(Union(None, [(UINT, "FirstElement"), (UINT, "ElementOffset")]), None),
(Union(None, [(UINT, "NumElements"), (UINT, "ElementWidth")]), None),
])
D3D11_TEX1D_RTV = Struct("D3D11_TEX1D_RTV", [
(UINT, "MipSlice"),
])
D3D11_TEX1D_ARRAY_RTV = Struct("D3D11_TEX1D_ARRAY_RTV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2D_RTV = Struct("D3D11_TEX2D_RTV", [
(UINT, "MipSlice"),
])
D3D11_TEX2DMS_RTV = Struct("D3D11_TEX2DMS_RTV", [
(UINT, "UnusedField_NothingToDefine"),
])
D3D11_TEX2D_ARRAY_RTV = Struct("D3D11_TEX2D_ARRAY_RTV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2DMS_ARRAY_RTV = Struct("D3D11_TEX2DMS_ARRAY_RTV", [
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX3D_RTV = Struct("D3D11_TEX3D_RTV", [
(UINT, "MipSlice"),
(UINT, "FirstWSlice"),
(UINT, "WSize"),
])
D3D11_RENDER_TARGET_VIEW_DESC = Struct("D3D11_RENDER_TARGET_VIEW_DESC", [
(DXGI_FORMAT, "Format"),
(D3D11_RTV_DIMENSION, "ViewDimension"),
(Union(None, [
(D3D11_BUFFER_RTV, "Buffer"),
(D3D11_TEX1D_RTV, "Texture1D"),
(D3D11_TEX1D_ARRAY_RTV, "Texture1DArray"),
(D3D11_TEX2D_RTV, "Texture2D"),
(D3D11_TEX2D_ARRAY_RTV, "Texture2DArray"),
(D3D11_TEX2DMS_RTV, "Texture2DMS"),
(D3D11_TEX2DMS_ARRAY_RTV, "Texture2DMSArray"),
(D3D11_TEX3D_RTV, "Texture3D"),
]), None),
])
ID3D11RenderTargetView.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_RENDER_TARGET_VIEW_DESC), "pDesc")]),
]
D3D11_TEX1D_DSV = Struct("D3D11_TEX1D_DSV", [
(UINT, "MipSlice"),
])
D3D11_TEX1D_ARRAY_DSV = Struct("D3D11_TEX1D_ARRAY_DSV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2D_DSV = Struct("D3D11_TEX2D_DSV", [
(UINT, "MipSlice"),
])
D3D11_TEX2D_ARRAY_DSV = Struct("D3D11_TEX2D_ARRAY_DSV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2DMS_DSV = Struct("D3D11_TEX2DMS_DSV", [
(UINT, "UnusedField_NothingToDefine"),
])
D3D11_TEX2DMS_ARRAY_DSV = Struct("D3D11_TEX2DMS_ARRAY_DSV", [
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_DSV_FLAG = Flags(UINT, [
"D3D11_DSV_READ_ONLY_DEPTH",
"D3D11_DSV_READ_ONLY_STENCIL",
])
D3D11_DEPTH_STENCIL_VIEW_DESC = Struct("D3D11_DEPTH_STENCIL_VIEW_DESC", [
(DXGI_FORMAT, "Format"),
(D3D11_DSV_DIMENSION, "ViewDimension"),
(D3D11_DSV_FLAG, "Flags"),
(Union(None, [
(D3D11_TEX1D_DSV, "Texture1D"),
(D3D11_TEX1D_ARRAY_DSV, "Texture1DArray"),
(D3D11_TEX2D_DSV, "Texture2D"),
(D3D11_TEX2D_ARRAY_DSV, "Texture2DArray"),
(D3D11_TEX2DMS_DSV, "Texture2DMS"),
(D3D11_TEX2DMS_ARRAY_DSV, "Texture2DMSArray"),
]), None),
])
ID3D11DepthStencilView.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_DEPTH_STENCIL_VIEW_DESC), "pDesc")]),
]
D3D11_BUFFER_UAV_FLAG = Flags(UINT, [
"D3D11_BUFFER_UAV_FLAG_RAW",
"D3D11_BUFFER_UAV_FLAG_APPEND",
"D3D11_BUFFER_UAV_FLAG_COUNTER",
])
D3D11_BUFFER_UAV = Struct("D3D11_BUFFER_UAV", [
(UINT, "FirstElement"),
(UINT, "NumElements"),
(D3D11_BUFFER_UAV_FLAG, "Flags"),
])
D3D11_TEX1D_UAV = Struct("D3D11_TEX1D_UAV", [
(UINT, "MipSlice"),
])
D3D11_TEX1D_ARRAY_UAV = Struct("D3D11_TEX1D_ARRAY_UAV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX2D_UAV = Struct("D3D11_TEX2D_UAV", [
(UINT, "MipSlice"),
])
D3D11_TEX2D_ARRAY_UAV = Struct("D3D11_TEX2D_ARRAY_UAV", [
(UINT, "MipSlice"),
(UINT, "FirstArraySlice"),
(UINT, "ArraySize"),
])
D3D11_TEX3D_UAV = Struct("D3D11_TEX3D_UAV", [
(UINT, "MipSlice"),
(UINT, "FirstWSlice"),
(UINT, "WSize"),
])
D3D11_UNORDERED_ACCESS_VIEW_DESC = Struct("D3D11_UNORDERED_ACCESS_VIEW_DESC", [
(DXGI_FORMAT, "Format"),
(D3D11_UAV_DIMENSION, "ViewDimension"),
(Union(None, [
(D3D11_BUFFER_UAV, "Buffer"),
(D3D11_TEX1D_UAV, "Texture1D"),
(D3D11_TEX1D_ARRAY_UAV, "Texture1DArray"),
(D3D11_TEX2D_UAV, "Texture2D"),
(D3D11_TEX2D_ARRAY_UAV, "Texture2DArray"),
(D3D11_TEX3D_UAV, "Texture3D"),
]), None),
])
ID3D11UnorderedAccessView.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_UNORDERED_ACCESS_VIEW_DESC), "pDesc")]),
]
D3D11_FILTER = Enum("D3D11_FILTER", [
"D3D11_FILTER_MIN_MAG_MIP_POINT",
"D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR",
"D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT",
"D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR",
"D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT",
"D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR",
"D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT",
"D3D11_FILTER_MIN_MAG_MIP_LINEAR",
"D3D11_FILTER_ANISOTROPIC",
"D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT",
"D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR",
"D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT",
"D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR",
"D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT",
"D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR",
"D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT",
"D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR",
"D3D11_FILTER_COMPARISON_ANISOTROPIC",
])
D3D11_FILTER_TYPE = Enum("D3D11_FILTER_TYPE", [
"D3D11_FILTER_TYPE_POINT",
"D3D11_FILTER_TYPE_LINEAR",
])
D3D11_TEXTURE_ADDRESS_MODE = Enum("D3D11_TEXTURE_ADDRESS_MODE", [
"D3D11_TEXTURE_ADDRESS_WRAP",
"D3D11_TEXTURE_ADDRESS_MIRROR",
"D3D11_TEXTURE_ADDRESS_CLAMP",
"D3D11_TEXTURE_ADDRESS_BORDER",
"D3D11_TEXTURE_ADDRESS_MIRROR_ONCE",
])
D3D11_SAMPLER_DESC = Struct("D3D11_SAMPLER_DESC", [
(D3D11_FILTER, "Filter"),
(D3D11_TEXTURE_ADDRESS_MODE, "AddressU"),
(D3D11_TEXTURE_ADDRESS_MODE, "AddressV"),
(D3D11_TEXTURE_ADDRESS_MODE, "AddressW"),
(FLOAT, "MipLODBias"),
(UINT, "MaxAnisotropy"),
(D3D11_COMPARISON_FUNC, "ComparisonFunc"),
(Array(FLOAT, 4), "BorderColor"),
(FLOAT, "MinLOD"),
(FLOAT, "MaxLOD"),
])
ID3D11SamplerState.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_SAMPLER_DESC), "pDesc")]),
]
D3D11_FORMAT_SUPPORT = Flags(UINT, [
"D3D11_FORMAT_SUPPORT_BUFFER",
"D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER",
"D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER",
"D3D11_FORMAT_SUPPORT_SO_BUFFER",
"D3D11_FORMAT_SUPPORT_TEXTURE1D",
"D3D11_FORMAT_SUPPORT_TEXTURE2D",
"D3D11_FORMAT_SUPPORT_TEXTURE3D",
"D3D11_FORMAT_SUPPORT_TEXTURECUBE",
"D3D11_FORMAT_SUPPORT_SHADER_LOAD",
"D3D11_FORMAT_SUPPORT_SHADER_SAMPLE",
"D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON",
"D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT",
"D3D11_FORMAT_SUPPORT_MIP",
"D3D11_FORMAT_SUPPORT_MIP_AUTOGEN",
"D3D11_FORMAT_SUPPORT_RENDER_TARGET",
"D3D11_FORMAT_SUPPORT_BLENDABLE",
"D3D11_FORMAT_SUPPORT_DEPTH_STENCIL",
"D3D11_FORMAT_SUPPORT_CPU_LOCKABLE",
"D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE",
"D3D11_FORMAT_SUPPORT_DISPLAY",
"D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT",
"D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET",
"D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD",
"D3D11_FORMAT_SUPPORT_SHADER_GATHER",
"D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST",
"D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW",
"D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON",
])
D3D11_FORMAT_SUPPORT2 = Enum("D3D11_FORMAT_SUPPORT2", [
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD",
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS",
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE",
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE",
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX",
"D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX",
"D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD",
"D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE",
])
ID3D11Asynchronous.methods += [
StdMethod(UINT, "GetDataSize", []),
]
D3D11_ASYNC_GETDATA_FLAG = Flags(UINT, [
"D3D11_ASYNC_GETDATA_DONOTFLUSH",
])
D3D11_QUERY = Enum("D3D11_QUERY", [
"D3D11_QUERY_EVENT",
"D3D11_QUERY_OCCLUSION",
"D3D11_QUERY_TIMESTAMP",
"D3D11_QUERY_TIMESTAMP_DISJOINT",
"D3D11_QUERY_PIPELINE_STATISTICS",
"D3D11_QUERY_OCCLUSION_PREDICATE",
"D3D11_QUERY_SO_STATISTICS",
"D3D11_QUERY_SO_OVERFLOW_PREDICATE",
"D3D11_QUERY_SO_STATISTICS_STREAM0",
"D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0",
"D3D11_QUERY_SO_STATISTICS_STREAM1",
"D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1",
"D3D11_QUERY_SO_STATISTICS_STREAM2",
"D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2",
"D3D11_QUERY_SO_STATISTICS_STREAM3",
"D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3",
])
D3D11_QUERY_MISC_FLAG = Flags(UINT, [
"D3D11_QUERY_MISC_PREDICATEHINT",
])
D3D11_QUERY_DESC = Struct("D3D11_QUERY_DESC", [
(D3D11_QUERY, "Query"),
(D3D11_QUERY_MISC_FLAG, "MiscFlags"),
])
ID3D11Query.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_QUERY_DESC), "pDesc")]),
]
D3D11_QUERY_DATA_TIMESTAMP_DISJOINT = Struct("D3D11_QUERY_DATA_TIMESTAMP_DISJOINT", [
(UINT64, "Frequency"),
(BOOL, "Disjoint"),
])
D3D11_QUERY_DATA_PIPELINE_STATISTICS = Struct("D3D11_QUERY_DATA_PIPELINE_STATISTICS", [
(UINT64, "IAVertices"),
(UINT64, "IAPrimitives"),
(UINT64, "VSInvocations"),
(UINT64, "GSInvocations"),
(UINT64, "GSPrimitives"),
(UINT64, "CInvocations"),
(UINT64, "CPrimitives"),
(UINT64, "PSInvocations"),
(UINT64, "HSInvocations"),
(UINT64, "DSInvocations"),
(UINT64, "CSInvocations"),
])
D3D11_QUERY_DATA_SO_STATISTICS = Struct("D3D11_QUERY_DATA_SO_STATISTICS", [
(UINT64, "NumPrimitivesWritten"),
(UINT64, "PrimitivesStorageNeeded"),
])
D3D11_COUNTER = Enum("D3D11_COUNTER", [
"D3D11_COUNTER_DEVICE_DEPENDENT_0",
])
D3D11_COUNTER_TYPE = Enum("D3D11_COUNTER_TYPE", [
"D3D11_COUNTER_TYPE_FLOAT32",
"D3D11_COUNTER_TYPE_UINT16",
"D3D11_COUNTER_TYPE_UINT32",
"D3D11_COUNTER_TYPE_UINT64",
])
D3D11_COUNTER_DESC = Struct("D3D11_COUNTER_DESC", [
(D3D11_COUNTER, "Counter"),
(UINT, "MiscFlags"),
])
D3D11_COUNTER_INFO = Struct("D3D11_COUNTER_INFO", [
(D3D11_COUNTER, "LastDeviceDependentCounter"),
(UINT, "NumSimultaneousCounters"),
(UINT8, "NumDetectableParallelUnits"),
])
ID3D11Counter.methods += [
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_COUNTER_DESC), "pDesc")]),
]
D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS = Enum("D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS", [
"D3D11_STANDARD_MULTISAMPLE_PATTERN",
"D3D11_CENTER_MULTISAMPLE_PATTERN",
])
D3D11_DEVICE_CONTEXT_TYPE = Enum("D3D11_DEVICE_CONTEXT_TYPE", [
"D3D11_DEVICE_CONTEXT_IMMEDIATE",
"D3D11_DEVICE_CONTEXT_DEFERRED",
])
D3D11_CLASS_INSTANCE_DESC = Struct("D3D11_CLASS_INSTANCE_DESC", [
(UINT, "InstanceId"),
(UINT, "InstanceIndex"),
(UINT, "TypeId"),
(UINT, "ConstantBuffer"),
(UINT, "BaseConstantBufferOffset"),
(UINT, "BaseTexture"),
(UINT, "BaseSampler"),
(BOOL, "Created"),
])
ID3D11ClassInstance.methods += [
StdMethod(Void, "GetClassLinkage", [Out(Pointer(ObjPointer(ID3D11ClassLinkage)), "ppLinkage")]),
StdMethod(Void, "GetDesc", [Out(Pointer(D3D11_CLASS_INSTANCE_DESC), "pDesc")]),
StdMethod(Void, "GetInstanceName", [Out(LPSTR, "pInstanceName"), Out(Pointer(SIZE_T), "pBufferLength")]),
StdMethod(Void, "GetTypeName", [Out(LPSTR, "pTypeName"), Out(Pointer(SIZE_T), "pBufferLength")]),
]
ID3D11ClassLinkage.methods += [
StdMethod(HRESULT, "GetClassInstance", [(LPCSTR, "pClassInstanceName"), (UINT, "InstanceIndex"), Out(Pointer(ObjPointer(ID3D11ClassInstance)), "ppInstance")]),
StdMethod(HRESULT, "CreateClassInstance", [(LPCSTR, "pClassTypeName"), (UINT, "ConstantBufferOffset"), (UINT, "ConstantVectorOffset"), (UINT, "TextureOffset"), (UINT, "SamplerOffset"), Out(Pointer(ObjPointer(ID3D11ClassInstance)), "ppInstance")]),
]
ID3D11CommandList.methods += [
StdMethod(UINT, "GetContextFlags", []),
]
D3D11_FEATURE_DATA_THREADING = Struct("D3D11_FEATURE_DATA_THREADING", [
(BOOL, "DriverConcurrentCreates"),
(BOOL, "DriverCommandLists"),
])
D3D11_FEATURE_DATA_DOUBLES = Struct("D3D11_FEATURE_DATA_DOUBLES", [
(BOOL, "DoublePrecisionFloatShaderOps"),
])
D3D11_FEATURE_DATA_FORMAT_SUPPORT = Struct("D3D11_FEATURE_DATA_FORMAT_SUPPORT", [
(DXGI_FORMAT, "InFormat"),
(D3D11_FORMAT_SUPPORT, "OutFormatSupport"),
])
D3D11_FEATURE_DATA_FORMAT_SUPPORT2 = Struct("D3D11_FEATURE_DATA_FORMAT_SUPPORT2", [
(DXGI_FORMAT, "InFormat"),
(D3D11_FORMAT_SUPPORT2, "OutFormatSupport2"),
])
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS = Struct("D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS", [
(BOOL, "ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x"),
])
D3D11_FEATURE, D3D11_FEATURE_DATA = EnumPolymorphic("D3D11_FEATURE", "Feature", [
("D3D11_FEATURE_THREADING", Pointer(D3D11_FEATURE_DATA_THREADING)),
("D3D11_FEATURE_DOUBLES", Pointer(D3D11_FEATURE_DATA_DOUBLES)),
("D3D11_FEATURE_FORMAT_SUPPORT", Pointer(D3D11_FEATURE_DATA_FORMAT_SUPPORT)),
("D3D11_FEATURE_FORMAT_SUPPORT2", Pointer(D3D11_FEATURE_DATA_FORMAT_SUPPORT2)),
("D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS", Pointer(D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS)),
], Blob(Void, "FeatureSupportDataSize"), False)
ID3D11DeviceContext.methods += [
StdMethod(Void, "VSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "PSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "PSSetShader", [(ObjPointer(ID3D11PixelShader), "pPixelShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "PSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "VSSetShader", [(ObjPointer(ID3D11VertexShader), "pVertexShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "DrawIndexed", [(UINT, "IndexCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation")]),
StdMethod(Void, "Draw", [(UINT, "VertexCount"), (UINT, "StartVertexLocation")]),
StdMethod(HRESULT, "Map", [(ObjPointer(ID3D11Resource), "pResource"), (UINT, "Subresource"), (D3D11_MAP, "MapType"), (D3D11_MAP_FLAG, "MapFlags"), Out(Pointer(D3D11_MAPPED_SUBRESOURCE), "pMappedResource")]),
StdMethod(Void, "Unmap", [(ObjPointer(ID3D11Resource), "pResource"), (UINT, "Subresource")]),
StdMethod(Void, "PSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "IASetInputLayout", [(ObjPointer(ID3D11InputLayout), "pInputLayout")]),
StdMethod(Void, "IASetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppVertexBuffers"), (Pointer(Const(UINT)), "pStrides"), (Pointer(Const(UINT)), "pOffsets")]),
StdMethod(Void, "IASetIndexBuffer", [(ObjPointer(ID3D11Buffer), "pIndexBuffer"), (DXGI_FORMAT, "Format"), (UINT, "Offset")]),
StdMethod(Void, "DrawIndexedInstanced", [(UINT, "IndexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartIndexLocation"), (INT, "BaseVertexLocation"), (UINT, "StartInstanceLocation")]),
StdMethod(Void, "DrawInstanced", [(UINT, "VertexCountPerInstance"), (UINT, "InstanceCount"), (UINT, "StartVertexLocation"), (UINT, "StartInstanceLocation")]),
StdMethod(Void, "GSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "GSSetShader", [(ObjPointer(ID3D11GeometryShader), "pShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "IASetPrimitiveTopology", [(D3D11_PRIMITIVE_TOPOLOGY, "Topology")]),
StdMethod(Void, "VSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "VSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "Begin", [(ObjPointer(ID3D11Asynchronous), "pAsync")]),
StdMethod(Void, "End", [(ObjPointer(ID3D11Asynchronous), "pAsync")]),
StdMethod(HRESULT, "GetData", [(ObjPointer(ID3D11Asynchronous), "pAsync"), Out(OpaqueBlob(Void, "DataSize"), "pData"), (UINT, "DataSize"), (D3D11_ASYNC_GETDATA_FLAG, "GetDataFlags")]),
StdMethod(Void, "SetPredication", [(ObjPointer(ID3D11Predicate), "pPredicate"), (BOOL, "PredicateValue")]),
StdMethod(Void, "GSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "GSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "OMSetRenderTargets", [(UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11RenderTargetView)), "NumViews"), "ppRenderTargetViews"), (ObjPointer(ID3D11DepthStencilView), "pDepthStencilView")]),
StdMethod(Void, "OMSetRenderTargetsAndUnorderedAccessViews", [(UINT, "NumRTVs"), (Array(Const(ObjPointer(ID3D11RenderTargetView)), "NumRTVs"), "ppRenderTargetViews"), (ObjPointer(ID3D11DepthStencilView), "pDepthStencilView"), (UINT, "UAVStartSlot"), (UINT, "NumUAVs"), (Array(Const(ObjPointer(ID3D11UnorderedAccessView)), "NumUAVs"), "ppUnorderedAccessViews"), (Pointer(Const(UINT)), "pUAVInitialCounts")]),
StdMethod(Void, "OMSetBlendState", [(ObjPointer(ID3D11BlendState), "pBlendState"), (Array(Const(FLOAT), 4), "BlendFactor"), (UINT, "SampleMask")]),
StdMethod(Void, "OMSetDepthStencilState", [(ObjPointer(ID3D11DepthStencilState), "pDepthStencilState"), (UINT, "StencilRef")]),
StdMethod(Void, "SOSetTargets", [(UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppSOTargets"), (Pointer(Const(UINT)), "pOffsets")]),
StdMethod(Void, "DrawAuto", []),
StdMethod(Void, "DrawIndexedInstancedIndirect", [(ObjPointer(ID3D11Buffer), "pBufferForArgs"), (UINT, "AlignedByteOffsetForArgs")]),
StdMethod(Void, "DrawInstancedIndirect", [(ObjPointer(ID3D11Buffer), "pBufferForArgs"), (UINT, "AlignedByteOffsetForArgs")]),
StdMethod(Void, "Dispatch", [(UINT, "ThreadGroupCountX"), (UINT, "ThreadGroupCountY"), (UINT, "ThreadGroupCountZ")]),
StdMethod(Void, "DispatchIndirect", [(ObjPointer(ID3D11Buffer), "pBufferForArgs"), (UINT, "AlignedByteOffsetForArgs")]),
StdMethod(Void, "RSSetState", [(ObjPointer(ID3D11RasterizerState), "pRasterizerState")]),
StdMethod(Void, "RSSetViewports", [(UINT, "NumViewports"), (Array(Const(D3D11_VIEWPORT), "NumViewports"), "pViewports")]),
StdMethod(Void, "RSSetScissorRects", [(UINT, "NumRects"), (Array(Const(D3D11_RECT), "NumRects"), "pRects")]),
StdMethod(Void, "CopySubresourceRegion", [(ObjPointer(ID3D11Resource), "pDstResource"), (UINT, "DstSubresource"), (UINT, "DstX"), (UINT, "DstY"), (UINT, "DstZ"), (ObjPointer(ID3D11Resource), "pSrcResource"), (UINT, "SrcSubresource"), (Pointer(Const(D3D11_BOX)), "pSrcBox")]),
StdMethod(Void, "CopyResource", [(ObjPointer(ID3D11Resource), "pDstResource"), (ObjPointer(ID3D11Resource), "pSrcResource")]),
StdMethod(Void, "UpdateSubresource", [(ObjPointer(ID3D11Resource), "pDstResource"), (UINT, "DstSubresource"), (Pointer(Const(D3D11_BOX)), "pDstBox"), (OpaquePointer(Const(Void)), "pSrcData"), (UINT, "SrcRowPitch"), (UINT, "SrcDepthPitch")]),
StdMethod(Void, "CopyStructureCount", [(ObjPointer(ID3D11Buffer), "pDstBuffer"), (UINT, "DstAlignedByteOffset"), (ObjPointer(ID3D11UnorderedAccessView), "pSrcView")]),
StdMethod(Void, "ClearRenderTargetView", [(ObjPointer(ID3D11RenderTargetView), "pRenderTargetView"), (Array(Const(FLOAT), 4), "ColorRGBA")]),
StdMethod(Void, "ClearUnorderedAccessViewUint", [(ObjPointer(ID3D11UnorderedAccessView), "pUnorderedAccessView"), (Array(Const(UINT), 4), "Values")]),
StdMethod(Void, "ClearUnorderedAccessViewFloat", [(ObjPointer(ID3D11UnorderedAccessView), "pUnorderedAccessView"), (Array(Const(FLOAT), 4), "Values")]),
StdMethod(Void, "ClearDepthStencilView", [(ObjPointer(ID3D11DepthStencilView), "pDepthStencilView"), (D3D11_CLEAR_FLAG, "ClearFlags"), (FLOAT, "Depth"), (UINT8, "Stencil")]),
StdMethod(Void, "GenerateMips", [(ObjPointer(ID3D11ShaderResourceView), "pShaderResourceView")]),
StdMethod(Void, "SetResourceMinLOD", [(ObjPointer(ID3D11Resource), "pResource"), (FLOAT, "MinLOD")]),
StdMethod(FLOAT, "GetResourceMinLOD", [(ObjPointer(ID3D11Resource), "pResource")]),
StdMethod(Void, "ResolveSubresource", [(ObjPointer(ID3D11Resource), "pDstResource"), (UINT, "DstSubresource"), (ObjPointer(ID3D11Resource), "pSrcResource"), (UINT, "SrcSubresource"), (DXGI_FORMAT, "Format")]),
StdMethod(Void, "ExecuteCommandList", [(ObjPointer(ID3D11CommandList), "pCommandList"), (BOOL, "RestoreContextState")]),
StdMethod(Void, "HSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "HSSetShader", [(ObjPointer(ID3D11HullShader), "pHullShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "HSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "HSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "DSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "DSSetShader", [(ObjPointer(ID3D11DomainShader), "pDomainShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "DSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "DSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "CSSetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(Const(ObjPointer(ID3D11ShaderResourceView)), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "CSSetUnorderedAccessViews", [(UINT, "StartSlot"), (UINT, "NumUAVs"), (Array(Const(ObjPointer(ID3D11UnorderedAccessView)), "NumUAVs"), "ppUnorderedAccessViews"), (Pointer(Const(UINT)), "pUAVInitialCounts")]),
StdMethod(Void, "CSSetShader", [(ObjPointer(ID3D11ComputeShader), "pComputeShader"), (Array(Const(ObjPointer(ID3D11ClassInstance)), "NumClassInstances"), "ppClassInstances"), (UINT, "NumClassInstances")]),
StdMethod(Void, "CSSetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(Const(ObjPointer(ID3D11SamplerState)), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "CSSetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(Const(ObjPointer(ID3D11Buffer)), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "VSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "PSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "PSGetShader", [Out(Pointer(ObjPointer(ID3D11PixelShader)), "ppPixelShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "PSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "VSGetShader", [Out(Pointer(ObjPointer(ID3D11VertexShader)), "ppVertexShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "PSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "IAGetInputLayout", [Out(Pointer(ObjPointer(ID3D11InputLayout)), "ppInputLayout")]),
StdMethod(Void, "IAGetVertexBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppVertexBuffers"), Out(Pointer(UINT), "pStrides"), Out(Pointer(UINT), "pOffsets")]),
StdMethod(Void, "IAGetIndexBuffer", [Out(Pointer(ObjPointer(ID3D11Buffer)), "pIndexBuffer"), Out(Pointer(DXGI_FORMAT), "Format"), Out(Pointer(UINT), "Offset")]),
StdMethod(Void, "GSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "GSGetShader", [Out(Pointer(ObjPointer(ID3D11GeometryShader)), "ppGeometryShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "IAGetPrimitiveTopology", [Out(Pointer(D3D11_PRIMITIVE_TOPOLOGY), "pTopology")]),
StdMethod(Void, "VSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "VSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "GetPredication", [Out(Pointer(ObjPointer(ID3D11Predicate)), "ppPredicate"), Out(Pointer(BOOL), "pPredicateValue")]),
StdMethod(Void, "GSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "GSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "OMGetRenderTargets", [(UINT, "NumViews"), (Array(ObjPointer(ID3D11RenderTargetView), "NumViews"), "ppRenderTargetViews"), Out(Pointer(ObjPointer(ID3D11DepthStencilView)), "ppDepthStencilView")]),
StdMethod(Void, "OMGetRenderTargetsAndUnorderedAccessViews", [(UINT, "NumRTVs"), (Array(ObjPointer(ID3D11RenderTargetView), "NumRTVs"), "ppRenderTargetViews"), Out(Pointer(ObjPointer(ID3D11DepthStencilView)), "ppDepthStencilView"), (UINT, "UAVStartSlot"), (UINT, "NumUAVs"), (Array(ObjPointer(ID3D11UnorderedAccessView), "NumUAVs"), "ppUnorderedAccessViews")]),
StdMethod(Void, "OMGetBlendState", [Out(Pointer(ObjPointer(ID3D11BlendState)), "ppBlendState"), Out(Array(FLOAT, 4), "BlendFactor"), Out(Pointer(UINT), "pSampleMask")]),
StdMethod(Void, "OMGetDepthStencilState", [Out(Pointer(ObjPointer(ID3D11DepthStencilState)), "ppDepthStencilState"), Out(Pointer(UINT), "pStencilRef")]),
StdMethod(Void, "SOGetTargets", [(UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppSOTargets")]),
StdMethod(Void, "RSGetState", [Out(Pointer(ObjPointer(ID3D11RasterizerState)), "ppRasterizerState")]),
StdMethod(Void, "RSGetViewports", [Out(Pointer(UINT), "pNumViewports"), Out(Array(D3D11_VIEWPORT, "*pNumViewports"), "pViewports")]),
StdMethod(Void, "RSGetScissorRects", [Out(Pointer(UINT), "pNumRects"), Out(Array(D3D11_RECT, "*pNumRects"), "pRects")]),
StdMethod(Void, "HSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "HSGetShader", [Out(Pointer(ObjPointer(ID3D11HullShader)), "ppHullShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "HSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "HSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "DSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "DSGetShader", [Out(Pointer(ObjPointer(ID3D11DomainShader)), "ppDomainShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "DSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "DSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "CSGetShaderResources", [(UINT, "StartSlot"), (UINT, "NumViews"), (Array(ObjPointer(ID3D11ShaderResourceView), "NumViews"), "ppShaderResourceViews")]),
StdMethod(Void, "CSGetUnorderedAccessViews", [(UINT, "StartSlot"), (UINT, "NumUAVs"), (Array(ObjPointer(ID3D11UnorderedAccessView), "NumUAVs"), "ppUnorderedAccessViews")]),
StdMethod(Void, "CSGetShader", [Out(Pointer(ObjPointer(ID3D11ComputeShader)), "ppComputeShader"), Out(Array(ObjPointer(ID3D11ClassInstance), "*pNumClassInstances"), "ppClassInstances"), Out(Pointer(UINT), "pNumClassInstances")]),
StdMethod(Void, "CSGetSamplers", [(UINT, "StartSlot"), (UINT, "NumSamplers"), (Array(ObjPointer(ID3D11SamplerState), "NumSamplers"), "ppSamplers")]),
StdMethod(Void, "CSGetConstantBuffers", [(UINT, "StartSlot"), (UINT, "NumBuffers"), (Array(ObjPointer(ID3D11Buffer), "NumBuffers"), "ppConstantBuffers")]),
StdMethod(Void, "ClearState", []),
StdMethod(Void, "Flush", []),
StdMethod(D3D11_DEVICE_CONTEXT_TYPE, "GetType", []),
StdMethod(UINT, "GetContextFlags", []),
StdMethod(HRESULT, "FinishCommandList", [(BOOL, "RestoreDeferredContextState"), Out(Pointer(ObjPointer(ID3D11CommandList)), "ppCommandList")]),
]
D3D11_CREATE_DEVICE_FLAG = Flags(UINT, [
"D3D11_CREATE_DEVICE_SINGLETHREADED",
"D3D11_CREATE_DEVICE_DEBUG",
"D3D11_CREATE_DEVICE_SWITCH_TO_REF",
"D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS",
"D3D11_CREATE_DEVICE_BGRA_SUPPORT",
])
ID3D11Device.methods += [
StdMethod(HRESULT, "CreateBuffer", [(Pointer(Const(D3D11_BUFFER_DESC)), "pDesc"), (Pointer(Const(D3D11_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(ObjPointer(ID3D11Buffer)), "ppBuffer")]),
StdMethod(HRESULT, "CreateTexture1D", [(Pointer(Const(D3D11_TEXTURE1D_DESC)), "pDesc"), (Pointer(Const(D3D11_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(ObjPointer(ID3D11Texture1D)), "ppTexture1D")]),
StdMethod(HRESULT, "CreateTexture2D", [(Pointer(Const(D3D11_TEXTURE2D_DESC)), "pDesc"), (Pointer(Const(D3D11_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(ObjPointer(ID3D11Texture2D)), "ppTexture2D")]),
StdMethod(HRESULT, "CreateTexture3D", [(Pointer(Const(D3D11_TEXTURE3D_DESC)), "pDesc"), (Pointer(Const(D3D11_SUBRESOURCE_DATA)), "pInitialData"), Out(Pointer(ObjPointer(ID3D11Texture3D)), "ppTexture3D")]),
StdMethod(HRESULT, "CreateShaderResourceView", [(ObjPointer(ID3D11Resource), "pResource"), (Pointer(Const(D3D11_SHADER_RESOURCE_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D11ShaderResourceView)), "ppSRView")]),
StdMethod(HRESULT, "CreateUnorderedAccessView", [(ObjPointer(ID3D11Resource), "pResource"), (Pointer(Const(D3D11_UNORDERED_ACCESS_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D11UnorderedAccessView)), "ppUAView")]),
StdMethod(HRESULT, "CreateRenderTargetView", [(ObjPointer(ID3D11Resource), "pResource"), (Pointer(Const(D3D11_RENDER_TARGET_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D11RenderTargetView)), "ppRTView")]),
StdMethod(HRESULT, "CreateDepthStencilView", [(ObjPointer(ID3D11Resource), "pResource"), (Pointer(Const(D3D11_DEPTH_STENCIL_VIEW_DESC)), "pDesc"), Out(Pointer(ObjPointer(ID3D11DepthStencilView)), "ppDepthStencilView")]),
StdMethod(HRESULT, "CreateInputLayout", [(Array(Const(D3D11_INPUT_ELEMENT_DESC), "NumElements"), "pInputElementDescs"), (UINT, "NumElements"), (Blob(Const(Void), "BytecodeLength"), "pShaderBytecodeWithInputSignature"), (SIZE_T, "BytecodeLength"), Out(Pointer(ObjPointer(ID3D11InputLayout)), "ppInputLayout")]),
StdMethod(HRESULT, "CreateVertexShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11VertexShader)), "ppVertexShader")]),
StdMethod(HRESULT, "CreateGeometryShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11GeometryShader)), "ppGeometryShader")]),
StdMethod(HRESULT, "CreateGeometryShaderWithStreamOutput", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (Array(Const(D3D11_SO_DECLARATION_ENTRY), "NumEntries"), "pSODeclaration"), (UINT, "NumEntries"), (Array(Const(UINT), "NumStrides"), "pBufferStrides"), (UINT, "NumStrides"), (UINT, "RasterizedStream"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11GeometryShader)), "ppGeometryShader")]),
StdMethod(HRESULT, "CreatePixelShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11PixelShader)), "ppPixelShader")]),
StdMethod(HRESULT, "CreateHullShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11HullShader)), "ppHullShader")]),
StdMethod(HRESULT, "CreateDomainShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11DomainShader)), "ppDomainShader")]),
StdMethod(HRESULT, "CreateComputeShader", [(Blob(Const(Void), "BytecodeLength"), "pShaderBytecode"), (SIZE_T, "BytecodeLength"), (ObjPointer(ID3D11ClassLinkage), "pClassLinkage"), Out(Pointer(ObjPointer(ID3D11ComputeShader)), "ppComputeShader")]),
StdMethod(HRESULT, "CreateClassLinkage", [Out(Pointer(ObjPointer(ID3D11ClassLinkage)), "ppLinkage")]),
StdMethod(HRESULT, "CreateBlendState", [(Pointer(Const(D3D11_BLEND_DESC)), "pBlendStateDesc"), Out(Pointer(ObjPointer(ID3D11BlendState)), "ppBlendState")]),
StdMethod(HRESULT, "CreateDepthStencilState", [(Pointer(Const(D3D11_DEPTH_STENCIL_DESC)), "pDepthStencilDesc"), Out(Pointer(ObjPointer(ID3D11DepthStencilState)), "ppDepthStencilState")]),
StdMethod(HRESULT, "CreateRasterizerState", [(Pointer(Const(D3D11_RASTERIZER_DESC)), "pRasterizerDesc"), Out(Pointer(ObjPointer(ID3D11RasterizerState)), "ppRasterizerState")]),
StdMethod(HRESULT, "CreateSamplerState", [(Pointer(Const(D3D11_SAMPLER_DESC)), "pSamplerDesc"), Out(Pointer(ObjPointer(ID3D11SamplerState)), "ppSamplerState")]),
StdMethod(HRESULT, "CreateQuery", [(Pointer(Const(D3D11_QUERY_DESC)), "pQueryDesc"), Out(Pointer(ObjPointer(ID3D11Query)), "ppQuery")]),
StdMethod(HRESULT, "CreatePredicate", [(Pointer(Const(D3D11_QUERY_DESC)), "pPredicateDesc"), Out(Pointer(ObjPointer(ID3D11Predicate)), "ppPredicate")]),
StdMethod(HRESULT, "CreateCounter", [(Pointer(Const(D3D11_COUNTER_DESC)), "pCounterDesc"), Out(Pointer(ObjPointer(ID3D11Counter)), "ppCounter")]),
StdMethod(HRESULT, "CreateDeferredContext", [(UINT, "ContextFlags"), Out(Pointer(ObjPointer(ID3D11DeviceContext)), "ppDeferredContext")]),
StdMethod(HRESULT, "OpenSharedResource", [(HANDLE, "hResource"), (REFIID, "ReturnedInterface"), Out(Pointer(ObjPointer(Void)), "ppResource")]),
StdMethod(HRESULT, "CheckFormatSupport", [(DXGI_FORMAT, "Format"), Out(Pointer(D3D11_FORMAT_SUPPORT), "pFormatSupport")]),
StdMethod(HRESULT, "CheckMultisampleQualityLevels", [(DXGI_FORMAT, "Format"), (UINT, "SampleCount"), Out(Pointer(UINT), "pNumQualityLevels")]),
StdMethod(Void, "CheckCounterInfo", [Out(Pointer(D3D11_COUNTER_INFO), "pCounterInfo")]),
StdMethod(HRESULT, "CheckCounter", [(Pointer(Const(D3D11_COUNTER_DESC)), "pDesc"), Out(Pointer(D3D11_COUNTER_TYPE), "pType"), Out(Pointer(UINT), "pActiveCounters"), Out(LPSTR, "szName"), Out(Pointer(UINT), "pNameLength"), Out(LPSTR, "szUnits"), Out(Pointer(UINT), "pUnitsLength"), Out(LPSTR, "szDescription"), Out(Pointer(UINT), "pDescriptionLength")]),
StdMethod(HRESULT, "CheckFeatureSupport", [(D3D11_FEATURE, "Feature"), Out(D3D11_FEATURE_DATA, "pFeatureSupportData"), (UINT, "FeatureSupportDataSize")]),
StdMethod(HRESULT, "GetPrivateData", [(REFGUID, "guid"), Out(Pointer(UINT), "pDataSize"), Out(OpaquePointer(Void), "pData")]),
StdMethod(HRESULT, "SetPrivateData", [(REFGUID, "guid"), (UINT, "DataSize"), (OpaqueBlob(Const(Void), "DataSize"), "pData")]),
StdMethod(HRESULT, "SetPrivateDataInterface", [(REFGUID, "guid"), (OpaquePointer(Const(IUnknown)), "pData")]),
StdMethod(D3D_FEATURE_LEVEL, "GetFeatureLevel", []),
StdMethod(D3D11_CREATE_DEVICE_FLAG, "GetCreationFlags", []),
StdMethod(HRESULT, "GetDeviceRemovedReason", []),
StdMethod(Void, "GetImmediateContext", [Out(Pointer(ObjPointer(ID3D11DeviceContext)), "ppImmediateContext")]),
StdMethod(HRESULT, "SetExceptionMode", [(D3D11_RAISE_FLAG, "RaiseFlags")]),
StdMethod(UINT, "GetExceptionMode", []),
]
d3d11 = API("d3d11")
d3d11.addFunctions([
StdFunction(HRESULT, "D3D11CreateDevice", [(ObjPointer(IDXGIAdapter), "pAdapter"), (D3D_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (D3D11_CREATE_DEVICE_FLAG, "Flags"), (Array(Const(D3D_FEATURE_LEVEL), "FeatureLevels"), "pFeatureLevels"), (UINT, "FeatureLevels"), (UINT, "SDKVersion"), Out(Pointer(ObjPointer(ID3D11Device)), "ppDevice"), Out(Pointer(D3D_FEATURE_LEVEL), "pFeatureLevel"), Out(Pointer(ObjPointer(ID3D11DeviceContext)), "ppImmediateContext")]),
StdFunction(HRESULT, "D3D11CreateDeviceAndSwapChain", [(ObjPointer(IDXGIAdapter), "pAdapter"), (D3D_DRIVER_TYPE, "DriverType"), (HMODULE, "Software"), (D3D11_CREATE_DEVICE_FLAG, "Flags"), (Array(Const(D3D_FEATURE_LEVEL), "FeatureLevels"), "pFeatureLevels"), (UINT, "FeatureLevels"), (UINT, "SDKVersion"), (Pointer(Const(DXGI_SWAP_CHAIN_DESC)), "pSwapChainDesc"), Out(Pointer(ObjPointer(IDXGISwapChain)), "ppSwapChain"), Out(Pointer(ObjPointer(ID3D11Device)), "ppDevice"), Out(Pointer(D3D_FEATURE_LEVEL), "pFeatureLevel"), Out(Pointer(ObjPointer(ID3D11DeviceContext)), "ppImmediateContext")]),
# XXX: Undocumented functions, called by d3d11sdklayers.dll when D3D11_CREATE_DEVICE_DEBUG is set
StdFunction(HRESULT, "D3D11CoreRegisterLayers", [LPCVOID, DWORD], internal=True),
StdFunction(SIZE_T, "D3D11CoreGetLayeredDeviceSize", [LPCVOID, DWORD], internal=True),
StdFunction(HRESULT, "D3D11CoreCreateLayeredDevice", [LPCVOID, DWORD, LPCVOID, (REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj")], internal=True),
StdFunction(HRESULT, "D3D11CoreCreateDevice", [DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD], internal=True),
])
d3d11.addInterfaces([
IDXGIAdapter1,
IDXGIDevice1,
IDXGIResource,
ID3D11Debug,
ID3D11InfoQueue,
ID3D11SwitchToRef,
])
| 50.016168 | 596 | 0.739227 | 1 | 2.3496 | [
-0.018584242090582848,
0.014388678595423698,
-0.012761586345732212,
0.03012857586145401,
-0.0221999678760767,
0.0023122024722397327,
-0.010137524455785751,
-0.029890313744544983,
-0.04974013566970825,
0.019389968365430832,
0.02789430506527424,
-0.010738864541053772,
-0.01252348069101572,
-0.004793806932866573,
-0.0042915502563118935,
0.005138551816344261,
0.03184603899717331,
-0.05437486991286278,
-0.04144545644521713,
-0.010377848520874977,
0.04548288881778717,
-0.006861839443445206,
0.004846435971558094,
-0.0018439028644934297,
-0.0430985651910305,
0.007233166601508856,
0.00576561875641346,
0.019120927900075912,
0.025262732058763504,
0.025772493332624435,
0.04393526911735535,
0.026550540700554848,
-0.045115284621715546,
-0.021535735577344894,
-0.00968924444168806,
0.010929686948657036,
0.021846652030944824,
0.032563433051109314,
-0.0002895481593441218,
0.0038252011872828007,
0.01224369928240776,
0.029673654586076736,
-0.02687925659120083,
-0.004063424654304981,
0.013282760977745056,
-0.02098955772817135,
0.016994353383779526,
-0.010684199631214142,
-0.01872703991830349,
-0.014464504085481167,
0.04051976278424263,
0.013887236826121807,
-0.0353410542011261,
-0.03904584050178528,
0.0015442490112036467,
0.0031944725196808577,
-0.009489597752690315,
0.02358078770339489,
0.012944061309099197,
0.010877644643187523,
0.02890521101653576,
-0.014430426992475986,
-0.0020081098191440105,
-0.0022587452549487352,
0.01835951954126358,
0.0023228770587593317,
-0.04268588870763779,
-0.0010632699122652411,
-0.015391262248158455,
-0.028019649907946587,
0.009215244092047215,
0.038154277950525284,
0.04291662946343422,
0.0076702916994690895,
-0.013953168876469135,
0.03203526884317398,
0.006964385509490967,
-0.005803576670587063,
-0.02726169303059578,
0.027163300663232803,
0.03333386033773422,
0.042554017156362534,
-0.06431951373815536,
-0.016599681228399277,
0.025930780917406082,
0.00677955849096179,
0.02490135282278061,
-0.02365131489932537,
0.030179478228092194,
0.032197389751672745,
-0.035107094794511795,
-0.006274093873798847,
0.04963265731930733,
-0.020030798390507698,
-0.047560714185237885,
-0.04244980961084366,
0.009057177230715752,
0.026226937770843506,
-0.03455503657460213,
0.0010525669204071164,
0.02009749598801136,
0.051381513476371765,
-0.020520595833659172,
-0.004462675657123327,
-0.02696770243346691,
0.0003210904833395034,
-0.0009336238726973534,
0.0020625335164368153,
0.024334155023097992,
-0.029756518080830574,
0.01057800929993391,
-0.004739276133477688,
0.005993334110826254,
0.004254412837326527,
-0.042978961020708084,
0.000391719164326787,
0.0334307886660099,
-0.022642051801085472,
0.047157421708106995,
0.02945226989686489,
0.006254993379116058,
-0.046612147241830826,
0.010265087708830833,
-0.006352284457534552,
-0.009317741729319096,
0.04506528005003929,
-0.016998430714011192,
0.01258393656462431,
0.025481808930635452,
-0.0026933669578284025,
0.011583192273974419,
-0.009269766509532928,
0.028363315388560295,
0.021882053464651108,
-0.002852726262062788,
0.027288241311907768,
-0.00466561084613204,
-0.015421942807734013,
-0.01807168684899807,
0.006335667800158262,
0.005675449036061764,
-0.01998382993042469,
-0.011129430495202541,
-0.03344716504216194,
-0.014089926145970821,
-0.00815562717616558,
-0.010921718552708626,
0.0023514521308243275,
0.004229917656630278,
0.007139431778341532,
0.016079017892479897,
-0.025850513949990273,
-0.019870812073349953,
0.01753043942153454,
0.021646277979016304,
-0.028334688395261765,
0.01203441247344017,
0.003221390536054969,
-0.052263278514146805,
-0.03372737765312195,
-0.008028049021959305,
-0.004248621873557568,
0.014639039523899555,
-0.02384333871304989,
0.0533427968621254,
-0.004477291833609343,
0.010624255985021591,
0.004752907436341047,
-0.01010387483984232,
-0.00044130071182735264,
0.005266965366899967,
0.021837526932358742,
-0.032384105026721954,
0.012678890489041805,
-0.013218948617577553,
-0.060251716524362564,
-0.02939041331410408,
0.0038878091145306826,
0.01386068295687437,
0.019704414531588554,
0.027988309040665627,
0.00987934973090887,
-0.007316288538277149,
-0.019042279571294785,
-0.004742082208395004,
-0.013486063107848167,
-0.003012001048773527,
-0.04436039924621582,
0.007930207997560501,
-0.01080390252172947,
0.009984702803194523,
0.03562627732753754,
0.030238192528486252,
-0.05562843009829521,
-0.02606145292520523,
0.017358463257551193,
-0.011244752444326878,
0.01636599190533161,
0.011116895824670792,
-0.020071137696504593,
0.03357965499162674,
0.03223135694861412,
0.003159252693876624,
0.012098176404833794,
0.005961450282484293,
0.0133846215903759,
-0.7025134563446045,
0.0017470334423705935,
0.0260374266654253,
0.02220369502902031,
-0.027235107496380806,
-0.021781014278531075,
-0.045100271701812744,
0.028833262622356415,
-0.082513228058815,
-0.027344243600964546,
0.001630903105251491,
0.01743016578257084,
-0.038605108857154846,
0.014962824061512947,
0.02120363712310791,
0.007841440849006176,
-0.013628319837152958,
-0.028804443776607513,
0.008672265335917473,
0.018686149269342422,
-0.0002932432107627392,
-0.01515965722501278,
-0.01253780908882618,
-0.020597506314516068,
-0.03017771616578102,
0.025477100163698196,
0.05375148728489876,
-0.015027732588350773,
-0.014665537513792515,
0.030036786571145058,
0.0010903479997068644,
0.043900325894355774,
-0.014775157906115055,
-0.015116210095584393,
-0.005026460625231266,
0.012764258310198784,
-0.015279016457498074,
-0.014637346379458904,
0.027232486754655838,
0.007880463264882565,
0.013207663781940937,
-0.013960134238004684,
-0.007002019789069891,
-0.016084475442767143,
-0.024818047881126404,
-0.008707965724170208,
-0.015298517420887947,
0.03925701603293419,
-0.03711231052875519,
-0.00001537327807454858,
-0.030390886589884758,
0.00688917376101017,
-0.005718381609767675,
-0.03704111650586128,
0.009030703455209732,
0.04541422426700592,
-0.02806941419839859,
-0.03188120946288109,
0.009278864599764347,
0.0027238077018409967,
-0.04677864909172058,
-0.051119882613420486,
-0.016687380149960518,
0.013880877755582333,
-0.03473803400993347,
-0.02107364870607853,
0.050003357231616974,
-0.011152852326631546,
0.025756575167179108,
0.044540561735630035,
-0.029179180040955544,
-0.0182151198387146,
-0.0016476589953526855,
0.04293523356318474,
0.01457726489752531,
0.008935578167438507,
0.03007175400853157,
0.002922206185758114,
-0.0000759158720029518,
-0.0018495761323720217,
-0.025395922362804413,
-0.01692000962793827,
-0.0002321990323252976,
-0.018851911649107933,
0.008273899555206299,
0.0026657539419829845,
-0.004889550618827343,
0.0022944253869354725,
0.008415940217673779,
-0.006774126552045345,
0.024044735357165337,
-0.01613721065223217,
0.04929571971297264,
0.0365397185087204,
0.03771979361772537,
0.0715956836938858,
-0.008622324094176292,
0.03754124790430069,
-0.020394887775182724,
0.005842043086886406,
0.0012281241361051798,
-0.01553791668266058,
0.009742950089275837,
0.002355834934860468,
-0.03586595505475998,
-0.04954427108168602,
-0.0066248513758182526,
-0.02707541733980179,
0.03021908551454544,
0.009324091486632824,
0.0031302333809435368,
0.018110500648617744,
0.021686431020498276,
-0.0074253506027162075,
0.031360626220703125,
-0.010526937432587147,
-0.02729201316833496,
-0.05136631429195404,
0.007638375740498304,
0.015903040766716003,
-0.0028971871361136436,
-0.03651687130331993,
0.009254815988242626,
0.004838467109948397,
-0.010196045972406864,
0.008958329446613789,
-0.023142708465456963,
0.02527153305709362,
-0.015690427273511887,
0.04339827969670296,
-0.003946057986468077,
0.002153681358322501,
-0.03472668305039406,
-0.015523451380431652,
-0.004956253804266453,
-0.002737875562161207,
0.003456785110756755,
-0.00038607718306593597,
-0.022684985771775246,
-0.016076311469078064,
-0.029206212610006332,
-0.024545952677726746,
0.010167835280299187,
-0.027762843295931816,
0.004438074771314859,
-0.017875168472528458,
-0.027404075488448143,
-0.022252637892961502,
-0.006522509269416332,
0.05145198851823807,
-0.011157645843923092,
0.054442111402750015,
0.011585548520088196,
-0.024072490632534027,
-0.026011882349848747,
0.021024037152528763,
-0.07176356762647629,
0.00905114971101284,
0.014181781560182571,
-0.009170654229819775,
-0.008930429816246033,
-0.013788403943181038,
0.022337203845381737,
-0.017498217523097992,
0.004042663611471653,
-0.00000564747233511298,
-0.00691242516040802,
-0.00378807564266026,
0.013197082094848156,
-0.042393699288368225,
-0.024958046153187752,
0.03026397153735161,
-0.012907813303172588,
0.03163681924343109,
0.005888358224183321,
0.03366917371749878,
-0.05402584746479988,
-0.0355919785797596,
-0.038081880658864975,
0.009452384896576405,
0.0132322758436203,
0.0009494012338109314,
-0.01672101765871048,
-0.0011323068756610155,
0.046699635684490204,
0.033200956881046295,
-0.061326514929533005,
-0.016300156712532043,
-0.012995189055800438,
-0.01155487447977066,
0.014117231592535973,
0.01588454097509384,
-0.006202526390552521,
0.03302289918065071,
-0.0034231161698698997,
0.0016010310500860214,
-0.03435063734650612,
0.024849960580468178,
0.002495251363143325,
0.004819731693714857,
-0.018331382423639297,
0.022543197497725487,
0.01575486548244953,
0.026759590953588486,
-0.0061973812989890575,
0.0020713028497993946,
0.025857603177428246,
0.016992969438433647,
-0.0378512404859066,
-0.01076149195432663,
0.034464433789253235,
-0.012609957717359066,
-0.024152837693691254,
0.02656666748225689,
-0.016421416774392128,
0.01293349638581276,
-0.022267773747444153,
0.0011940073454752564,
0.020185889676213264,
-0.07008738070726395,
-0.050887998193502426,
-0.019272122532129288,
-0.013363850302994251,
-0.0016590921441093087,
0.02252659946680069,
-0.0030361120589077473,
-0.0197775736451149,
-0.0281209796667099,
-0.011243486776947975,
-0.019028209149837494,
0.033459391444921494,
-0.06964261084794998,
-0.004780130460858345,
-0.013936707749962807,
0.008130687288939953,
0.0062914215959608555,
-0.029322993010282516,
-0.017216481268405914,
0.006297642830759287,
-0.0060274009592831135,
-0.018932204693555832,
-0.003099065739661455,
-0.014043774455785751,
0.0430830754339695,
-0.006439254153519869,
-0.015179918147623539,
0.023320283740758896,
-0.019140781834721565,
-0.008162304759025574,
0.022174879908561707,
0.007286430336534977,
-0.01252849493175745,
0.0323977917432785,
-0.009859188459813595,
0.018255658447742462,
-0.030003907158970833,
-0.021295083686709404,
0.03004010021686554,
0.002489013597369194,
0.023601073771715164,
0.019961858168244362,
-0.04051591455936432,
0.016116878017783165,
-0.012627500109374523,
0.051440197974443436,
-0.015169470570981503,
-0.011176323518157005,
-0.008540970273315907,
-0.012784818187355995,
-0.01471550203859806,
0.04449276998639107,
0.011899917386472225,
-0.018908340483903885,
-0.016764815896749496,
0.0202789306640625,
0.03144575655460358,
0.022352688014507294,
-0.01891588233411312,
0.007516221608966589,
-0.008369333110749722,
0.00343392719514668,
0.028959661722183228,
-0.026885801926255226,
-0.005050311330705881,
-0.01606529951095581,
0.01995355449616909,
-0.015646692365407944,
0.019623836502432823,
-0.007807712536305189,
-0.009166659787297249,
0.009035908617079258,
-0.05847504734992981,
0.028480373322963715,
0.042876072227954865,
-0.022401457652449608,
0.027114199474453926,
-0.0027013320941478014,
0.005853161681443453,
-0.005873111076653004,
-0.0056884256191551685,
0.021090716123580933,
-0.036570895463228226,
-0.014454767107963562,
0.01977561227977276,
0.005652846768498421,
0.0523519366979599,
0.022272402420639992,
-0.006696400232613087,
-0.0024454770609736443,
-0.007307713385671377,
-0.02344983071088791,
0.010387443006038666,
0.015066906809806824,
-0.0058311838656663895,
0.020753910765051842,
-0.004192824941128492,
-0.01647222973406315,
0.04047248885035515,
0.01617179811000824,
-0.03753439709544182,
-0.0218240674585104,
-0.0024003649596124887,
0.002725529484450817,
-0.045227181166410446,
0.002764967503026128,
-0.008845203556120396,
-0.011084135621786118,
0.00854398962110281,
-0.02372177504003048,
0.004417727701365948,
-0.009881929494440556,
0.026299886405467987,
0.007752304431051016,
-0.014070400968194008,
0.02544655092060566,
0.0029450843576341867,
-0.015179624781012535,
-0.0050714751705527306,
-0.022035760805010796,
0.05160096660256386,
0.03325981646776199,
-0.012374937534332275,
-0.048787690699100494,
0.03469908609986305,
-0.020674195140600204,
0.005545977968722582,
0.005313865840435028,
0.02789752371609211,
-0.015881003811955452,
0.006070886272937059,
0.0595879890024662,
-0.021411115303635597,
-0.0063297501765191555,
-0.009144628420472145,
-0.024856790900230408,
-0.04657779633998871,
0.018694492056965828,
-0.006996829994022846,
0.03335556015372276,
-0.01721853017807007,
0.012267797254025936,
0.010523395612835884,
-0.03732096403837204,
-0.01289762370288372,
-0.011292317882180214,
-0.012478705495595932,
-0.025241436436772346,
0.010370981879532337,
0.019428003579378128,
0.004765303339809179,
0.05369390547275543,
-0.022876465693116188,
0.005492363125085831,
-0.0028996893670409918,
-0.00597722502425313,
0.06132589653134346,
0.03528881072998047,
0.030007142573595047,
-0.0009162419009953737,
-0.030681272968649864,
-0.01081074494868517,
0.0008722637430764735,
-0.017889339476823807,
0.00624785665422678,
-0.032586339861154556,
-0.012580174021422863,
0.00392614072188735,
-0.01606021821498871,
-0.02401011623442173,
-0.014493146911263466,
-0.025000514462590218,
-0.01819189265370369,
0.04170001298189163,
0.007479908410459757,
0.02387220598757267,
-0.018050942569971085,
-0.007900690659880638,
-0.015595189295709133,
0.0032105257268995047,
-0.007002547848969698,
0.0019084298983216286,
-0.026317866519093513,
-0.008837193250656128,
-0.033415064215660095,
0.04563171789050102,
-0.012827446684241295,
0.007303333841264248,
-0.022479267790913582,
0.01796574704349041,
0.014508083462715149,
-0.009886948391795158,
-0.00116901402361691,
0.011359835974872112,
-0.01896195486187935,
0.026605363935232162,
0.03375519439578056,
-0.05690537393093109,
-0.06280713528394699,
0.0162762813270092,
-0.01933029666543007,
0.026227794587612152,
0.03144588693976402,
-0.02680182084441185,
-0.015002182684838772,
-0.058647334575653076,
-0.028183871880173683,
0.02585439570248127,
-0.018265480175614357,
0.010402306914329529,
0.04271740838885307,
0.06490220874547958,
-0.052249543368816376,
0.012941506691277027,
-0.014669930562376976,
-0.004435210954397917,
0.022142594680190086,
-0.009134202264249325,
0.003315209411084652,
-0.04272592440247536,
0.01007018145173788,
0.03270546346902847,
-0.022537918761372566,
0.03421218320727348,
0.022227896377444267,
0.03103691339492798,
-0.0020638834685087204,
-0.05588102340698242,
0.019401447847485542,
0.013684704899787903,
-0.005995333194732666,
-0.013060028664767742,
0.030477680265903473,
-0.010649881325662136,
-0.006409026216715574,
0.0074808052740991116,
-0.009293118491768837,
0.10600049048662186,
-0.024922333657741547,
0.05432600900530815,
0.01949281617999077,
-0.020481234416365623,
-0.005432478617876768,
-0.01830577291548252,
0.04925091192126274,
-0.017671240493655205,
0.0004491196305025369,
-0.0036034355871379375,
-0.023334495723247528,
-0.019796336069703102,
-0.0028248599264770746,
0.0048817540518939495,
-0.011032172478735447,
-0.012368161231279373,
0.05118099972605705,
-0.012704413384199142,
0.02018049918115139,
0.015168064273893833,
0.05661263316869736,
0.05908151715993881,
0.008864933624863625,
-0.031098622828722,
-0.037595365196466446,
0.0053170048631727695,
0.00044453414739109576,
0.015285142697393894,
0.02584504708647728,
0.019667986780405045,
-0.016584934666752815,
-0.03488527983427048,
-0.022635936737060547,
-0.019750945270061493,
0.018148979172110558,
0.02484663762152195,
0.03404461592435837,
0.00460928725078702,
-0.05103183165192604,
0.00439505185931921,
0.026534652337431908,
-0.05339207127690315,
-0.0012403656728565693,
0.06384918093681335,
0.005832058377563953,
-0.0008888219599612057,
0.0009191817953251302,
0.029630571603775024,
0.04325136914849281,
0.02369447611272335,
0.029086260125041008,
0.02335432916879654,
0.003823261009529233,
0.008335946127772331,
0.014725706540048122,
0.04401366785168648,
0.03074544481933117,
0.007817952893674374,
-0.056002046912908554,
0.05021997168660164,
0.011830488219857216,
0.03406694531440735,
-0.049441274255514145,
0.0074807521887123585,
-0.00024779976229183376,
-0.004242172464728355,
0.0074680563993752,
-0.00006775231304345652,
0.0025116014294326305,
-0.047212421894073486,
-0.022493794560432434,
0.023016776889562607,
0.0002180679584853351,
0.021749647334218025,
-0.02335618995130062,
0.0063223340548574924,
-0.005650644190609455,
0.03661578521132469,
-0.04969242960214615,
0.0468079149723053,
-0.013211223296821117,
-0.05318138375878334,
0.027227647602558136,
0.00994494091719389,
0.028546659275889397,
-0.03277827799320221,
0.004101392813026905,
0.006315534468740225,
-0.01991523616015911,
-0.04452063888311386,
0.07162012904882431,
-0.01214177068322897,
0.031491685658693314,
-0.010743673890829086,
-0.020734351128339767,
-0.00989503227174282,
-0.01275081466883421,
-0.012045050039887428,
-0.004770515952259302,
0.015222707763314247,
0.030123399570584297,
0.06682909280061722,
-0.04022417590022087,
-0.02472718618810177,
0.037641216069459915
] |
8a682a5b6be55bf5cb429b4f53cde390f56c0458 | 1,244 | py | Python | day08.py | Pil0u/adventofcode2020 | 97a6c291fc1653bcb1ea7abd7f38e71e2c0458f8 | [
"MIT"
] | null | null | null | day08.py | Pil0u/adventofcode2020 | 97a6c291fc1653bcb1ea7abd7f38e71e2c0458f8 | [
"MIT"
] | null | null | null | day08.py | Pil0u/adventofcode2020 | 97a6c291fc1653bcb1ea7abd7f38e71e2c0458f8 | [
"MIT"
] | null | null | null | from copy import deepcopy
def boot(seq):
index = 0
played_indices = set()
acc = 0
while True:
if index == len(seq):
return True, acc
if index in played_indices:
return False, acc
played_indices.add(index)
line = seq[index].split()
op = line[0]
value = int(line[1])
if op == 'nop':
index += 1
if op == 'acc':
acc += value
index += 1
if op == 'jmp':
index += value
def generate_sequences(list_):
all_seqs = []
for idx, value in enumerate(list_):
if value[:3] == 'nop':
seq = deepcopy(list_)
seq[idx] = 'jmp' + value[3:]
all_seqs.append(seq)
if value[:3] == 'jmp':
seq = deepcopy(list_)
seq[idx] = 'nop' + value[3:]
all_seqs.append(seq)
return all_seqs
def result(input_):
# Part 1
part_one = boot(input_)[1]
# Part 2
all_sequences = generate_sequences(input_)
for sequence in all_sequences:
result = boot(sequence)
if result[0] is not False:
part_two = result[1]
break
return part_one, part_two
| 19.4375 | 46 | 0.498392 | 1 | 1.0746 | [
0.0014103521825745702,
0.027977941557765007,
0.0062085711397230625,
-0.0026698207948356867,
0.004234593361616135,
-0.005780084058642387,
-0.011353647336363792,
0.00758247310295701,
-0.005318290088325739,
0.00011045034625567496,
0.0014825169928371906,
0.0033931497018784285,
0.008812560699880123,
-0.018255705013871193,
0.0007859701290726662,
0.01961161382496357,
-0.0545671321451664,
0.005142830777913332,
-0.00346406945027411,
0.0022659983951598406,
-0.008780961856245995,
0.010133259929716587,
0.007239172235131264,
0.007035612594336271,
0.008415461517870426,
0.0021131818648427725,
0.012346422299742699,
0.004071390721946955,
-0.006246885284781456,
-0.006975867785513401,
-0.001374894636683166,
-0.0008288836688734591,
-0.006266181357204914,
-0.010231667198240757,
0.0070562115870416164,
-0.0038215951062738895,
0.001754989381879568,
-0.01891200803220272,
0.010731921531260014,
-0.006307903211563826,
-0.006092981435358524,
-0.018803054466843605,
-0.0022874497808516026,
0.005083055235445499,
-0.012393346056342125,
0.003155859187245369,
-0.003718166146427393,
0.003148983931168914,
-0.012424567714333534,
0.002649580826982856,
-0.009635435417294502,
0.005259292665868998,
0.014021553099155426,
0.004003182053565979,
-0.004436025395989418,
-0.007781157735735178,
0.010785347782075405,
-0.0016286104219034314,
-0.012186400592327118,
-0.0008590832585468888,
-0.001328960875980556,
-0.003630235558375716,
0.00580256711691618,
0.0018504898762330413,
-0.014956768602132797,
-0.00836244598031044,
-0.0062261600978672504,
0.003154520643875003,
-0.005496790166944265,
0.00343175302259624,
0.0015288206050172448,
-0.00227408017963171,
0.009478398598730564,
0.004651825875043869,
0.0027765168342739344,
-0.003239238169044256,
-0.0050933463498950005,
0.0018167863599956036,
0.008398661389946938,
0.002196720102801919,
0.004215856082737446,
-0.006639552768319845,
0.0073363278061151505,
0.012790328823029995,
0.016957813873887062,
0.004911171272397041,
0.01744292862713337,
-0.012323010712862015,
0.04497189074754715,
0.009862489067018032,
-0.01143649686127901,
0.001992211677134037,
-0.009860367514193058,
-0.0012006924953311682,
-0.0011612743837758899,
-0.03051004558801651,
0.002272070851176977,
-0.005455820821225643,
-0.0010755060939118266,
0.004289103206247091,
0.0026145142037421465,
0.0063765691593289375,
0.002567145973443985,
-0.0033908637706190348,
-0.010263673961162567,
0.013988573104143143,
-0.01298584695905447,
-0.002894436940550804,
0.008096166886389256,
0.001521809957921505,
-0.013033084571361542,
0.0011422414099797606,
0.004288190044462681,
-0.010806276462972164,
0.004582028370350599,
0.002414003247395158,
-0.00744140287861228,
0.0578022226691246,
-0.001330699073150754,
0.0037857983261346817,
-0.005935424938797951,
-0.0015276642516255379,
0.0016389575321227312,
0.005150297656655312,
0.010495206341147423,
-0.0050530326552689075,
0.0110466368496418,
0.004002715460956097,
0.003201876301318407,
0.009948036633431911,
-0.00029816519236192107,
0.007682732306420803,
-0.005497399717569351,
-0.00108916440512985,
0.00009102901094593108,
-0.00971162412315607,
0.006611588876694441,
-0.0007993277395144105,
-0.00485194381326437,
0.002855055034160614,
0.0004517132183536887,
-0.012865262106060982,
0.002484641270712018,
-0.003582585835829377,
0.001043126918375492,
-0.012520487420260906,
-0.006573241204023361,
-0.003170110285282135,
-0.00537788076326251,
0.0010386252542957664,
0.01063812430948019,
0.006136957556009293,
0.001065719174221158,
-0.003929994534701109,
-0.008024885319173336,
-0.003983161877840757,
-0.007172072771936655,
0.001861221739090979,
0.006827096920460463,
0.0041744280606508255,
-0.011969476006925106,
-0.0030605264473706484,
0.0009677550988271832,
0.0008624245529063046,
0.00006525331264128909,
0.003432115074247122,
-0.010010591708123684,
0.009460548870265484,
0.0006685892585664988,
0.001000621123239398,
0.012318341992795467,
-0.006873015780001879,
-0.002263452857732773,
0.0007411257829517126,
0.0028638234362006187,
0.00097108562476933,
0.004513060674071312,
0.01031144242733717,
-0.0029137912206351757,
-0.005605653859674931,
0.00810527615249157,
0.006143707316368818,
0.010100054554641247,
0.0056523727253079414,
-0.0021531262900680304,
0.005184881389141083,
-0.005320660304278135,
0.0006138543831184506,
0.006528926081955433,
-0.007743032183498144,
0.0072849649004638195,
0.005076858215034008,
-0.016207106411457062,
-0.008122440427541733,
0.00031567097175866365,
-0.008297261781990528,
-0.0006914942059665918,
0.016037773340940475,
0.009740782901644707,
-0.001729002920910716,
0.0010883839568123221,
-0.012335533276200294,
-0.001794651965610683,
0.009712010622024536,
0.0016822873149067163,
-0.011818098835647106,
-0.9532309770584106,
0.006059274543076754,
0.003984975628554821,
-0.0013425318757072091,
0.005070040002465248,
-0.0005756202735938132,
0.001929973834194243,
0.0046100495383143425,
0.016260497272014618,
-0.008682369254529476,
-0.007185196503996849,
-0.010990220122039318,
-0.010309705510735512,
-0.0016718708211556077,
-0.00641619460657239,
-0.0018087406642735004,
-0.006170403677970171,
-0.008785185404121876,
-0.003985682036727667,
-0.0017798962071537971,
-0.003038500202819705,
0.011985576711595058,
-0.0013459452893584967,
0.0025406379718333483,
0.004266382660716772,
0.002989598549902439,
-0.007792159914970398,
-0.004015185870230198,
0.001995795639231801,
-0.0016228222521021962,
-0.00673938263207674,
-0.013975578360259533,
-0.004630481358617544,
0.0007473979494534433,
0.01259848102927208,
0.0008350281859748065,
0.007116266991943121,
-0.0002994774258695543,
0.0007741848821751773,
-0.00971169862896204,
0.004012614022940397,
0.0011301229242235422,
0.0011820017825812101,
-0.029769646003842354,
0.0003509682137519121,
-0.0031193960458040237,
-0.010315687395632267,
0.007460284978151321,
0.0025437793228775263,
-0.0005062678246758878,
-0.004199134651571512,
-0.005060007330030203,
0.010051553137600422,
-0.009543076157569885,
0.004673454444855452,
-0.005168096628040075,
-0.005886009428650141,
-0.002396278316155076,
-0.011815808713436127,
0.0008684697677381337,
0.002023623324930668,
-0.005173868034034967,
-0.005395328160375357,
-0.0040977406315505505,
0.0036528233904391527,
0.0013233477948233485,
0.008170041255652905,
-0.020751744508743286,
-0.00671013630926609,
0.0014339582994580269,
0.0062207430601119995,
0.0016241783741861582,
-0.005862550809979439,
0.003504757070913911,
-0.009871956892311573,
0.007443215232342482,
0.0007111038430593908,
0.001445428584702313,
-0.012187513522803783,
0.0003385232121217996,
-0.008607689291238785,
-0.008832365274429321,
0.00637433584779501,
-0.005457080900669098,
-0.005652815569192171,
-0.00007201942935353145,
0.003905774559825659,
0.00783525686711073,
-0.0038795501459389925,
0.002373797120526433,
0.010475607588887215,
-0.0017475448548793793,
-0.013926828280091286,
0.00845263060182333,
0.008185083977878094,
0.0012272290186956525,
-0.002761862240731716,
0.002021166728809476,
0.006796484347432852,
0.004807514604181051,
0.000953860639128834,
0.0035225495230406523,
0.0008024784037843347,
0.00883435644209385,
-0.0022888609673827887,
0.0030012524221092463,
-0.0021541318856179714,
-0.0008496110676787794,
-0.004863597918301821,
0.001461885287426412,
-0.006292174570262432,
-0.0002831205492839217,
-0.012774343602359295,
-0.008717137388885021,
-0.004977836273610592,
0.0029610733035951853,
0.00011023893603123724,
-0.005204793997108936,
-0.0012306076241657138,
0.00007299696881091222,
0.0069007957354187965,
-0.0030372519977390766,
-0.006171642802655697,
0.0012847825419157743,
0.005150730721652508,
-0.007777947001159191,
0.014398785308003426,
-0.012306401506066322,
0.006937164813280106,
0.0011929853353649378,
-0.017517834901809692,
0.00800106767565012,
0.011264546774327755,
-0.006964374799281359,
0.003872093977406621,
0.0011528006289154291,
0.0024324357509613037,
0.0010080791544169188,
-0.007911602966487408,
-0.0014824019744992256,
-0.019180629402399063,
0.0006689277361147106,
0.02356976643204689,
0.002300001448020339,
0.009903176687657833,
0.013005035929381847,
-0.005471411626785994,
0.004273584578186274,
0.003742941888049245,
0.001182719599455595,
0.015207674354314804,
-0.007817374542355537,
-0.00017447177378926426,
0.002561855362728238,
-0.00454504881054163,
0.0021605193614959717,
0.004260065965354443,
0.005255334544926882,
-0.003031149972230196,
0.0051598153077065945,
-0.005510610528290272,
-0.004842489957809448,
-0.017207350581884384,
-0.003170216688886285,
0.008862734772264957,
-0.006739254109561443,
0.0044164834544062614,
-0.013270392082631588,
0.006509857252240181,
0.005690435878932476,
0.0020218919962644577,
0.0017627314664423466,
0.0013724052114412189,
0.003590833628550172,
0.013221454806625843,
-0.008033232763409615,
0.0027683281805366278,
0.005647910758852959,
-0.0025921587366610765,
-0.0007305607432499528,
0.005869766231626272,
-0.009525829926133156,
-0.004873200785368681,
0.0019501311471685767,
0.002149707404896617,
0.0005355814355425537,
-0.002894575707614422,
-0.007984636351466179,
-0.0040475414134562016,
0.002892248099669814,
-0.010523312725126743,
0.003948803059756756,
-0.0007782593602314591,
0.0045980531722307205,
-0.009569816291332245,
-0.0014952642377465963,
-0.0033381059765815735,
-0.011828909628093243,
0.011821893975138664,
-0.0018636324675753713,
0.003444396425038576,
0.012523763813078403,
0.004774652887135744,
-0.011066592298448086,
0.00560415955260396,
0.008851433172821999,
-0.004507402423769236,
0.001946949865669012,
0.007219009567052126,
-0.005232876166701317,
-0.025119598954916,
0.001175002777017653,
-0.014987076632678509,
0.007535075303167105,
-0.0025510224513709545,
0.003009718842804432,
-0.009799327701330185,
0.005742429289966822,
0.004827793221920729,
-0.01243703905493021,
-0.0075335195288062096,
-0.006754958536475897,
0.009760523214936256,
-0.0003810780472122133,
-0.002270466648042202,
-0.0031682837288826704,
-0.0018469960195943713,
-0.0020557509269565344,
-0.0035698022693395615,
-0.0015501199522987008,
0.0050192163325846195,
0.0035024818498641253,
-0.0037033138796687126,
0.002047078451141715,
-0.004691726062446833,
0.0024131592363119125,
0.0014704945497214794,
-0.011138889007270336,
0.004151934292167425,
0.007262647617608309,
-0.0007451968267560005,
-0.0027684627566486597,
-0.0006218098569661379,
-0.0022687523160129786,
-0.007300607860088348,
-0.013925350271165371,
-0.004120907746255398,
-0.0068132602609694,
-0.004265325143933296,
-0.010591410100460052,
-0.004819205030798912,
-0.009427724406123161,
0.008275145664811134,
-0.008199471980333328,
0.008992815390229225,
0.009633107110857964,
-0.0059304325841367245,
0.006624079309403896,
-0.0015969009837135673,
0.0048890975303947926,
-0.0007772492244839668,
0.005958994850516319,
0.0008999870042316616,
-0.007249145302921534,
-0.009144986979663372,
0.01271892711520195,
-0.010783114470541477,
-0.0006192600703798234,
0.01500882487744093,
0.005822243168950081,
0.008747093379497528,
-0.0018381790723651648,
0.00018286978593096137,
0.0027791124302893877,
0.010680935345590115,
-0.01370493695139885,
0.0029260846786201,
-0.002887186361476779,
-0.0025988027919083834,
0.005735243204981089,
-0.0030334366019815207,
0.001567151746712625,
0.006595163140445948,
0.002766681369394064,
-0.005960601381957531,
-0.0017965291626751423,
0.000850409793201834,
0.004882277455180883,
-0.012934035621583462,
-0.001778574544005096,
-0.0041502597741782665,
-0.009219993837177753,
-0.0022026794031262398,
0.0011611429508775473,
-0.0004815900756511837,
0.002915796125307679,
-0.002174936467781663,
0.007633261848241091,
0.0034039493184536695,
-0.004052340053021908,
0.015333996154367924,
-0.002509162062779069,
-0.004958100616931915,
0.004993893206119537,
0.0034270405303686857,
-0.0015080232406035066,
-0.003807805012911558,
0.0005078446120023727,
0.0028090348932892084,
0.0057973372749984264,
-0.0013159732334315777,
-0.007154454477131367,
-0.0035827127285301685,
-0.0006227931007742882,
-0.012342369183897972,
0.0020063624251633883,
0.014248802326619625,
-0.005201730877161026,
0.005112357437610626,
-0.0001493898016633466,
-0.008031834848225117,
-0.015033827163279057,
0.059339672327041626,
-0.00038340347236953676,
0.0049980110488832,
0.005130894482135773,
-0.00800548680126667,
0.000681708159390837,
-0.0029155404772609472,
0.007303606253117323,
-0.007430792320519686,
-0.005536980461329222,
0.009044812992215157,
-0.006416792050004005,
-0.0005921560805290937,
0.005214007571339607,
-0.0002637786092236638,
0.01761002466082573,
-0.005447186063975096,
-0.01834942027926445,
-0.015969740226864815,
0.006632332690060139,
-0.0048493435606360435,
-0.005615118891000748,
0.0077139874920248985,
-0.003758801845833659,
0.00047181890113279223,
0.002625599503517151,
0.00822093989700079,
-0.002094124210998416,
0.0004317871935199946,
-0.004375954158604145,
-0.004667906556278467,
0.0028207642026245594,
0.003013287205249071,
0.004260036163032055,
0.008740776218473911,
-0.0013354677939787507,
0.006604342255741358,
0.0017891055904328823,
-0.0017629367066547275,
-0.0016281182179227471,
0.005481090396642685,
0.006715507712215185,
-0.0007798633887432516,
-0.003875988768413663,
0.006890638265758753,
0.004570170305669308,
0.003686868352815509,
0.01311639416962862,
-0.0008717426098883152,
-0.008563457988202572,
0.008083219639956951,
0.006798759568482637,
-0.0018444862216711044,
0.010114049538969994,
-0.0010172998299822211,
0.004813263192772865,
0.0008227869984693825,
-0.008887712843716145,
-0.0124283442273736,
-0.0009706984856165946,
0.007148016709834337,
0.013644702732563019,
-0.0021132060792297125,
0.0001481990038882941,
0.0009673909517005086,
-0.0020003749523311853,
-0.011812809854745865,
-0.0064048320055007935,
-0.0018793351482599974,
0.002356776501983404,
0.004718894604593515,
0.07305926084518433,
-0.007522445172071457,
-0.002436138689517975,
-0.012485194019973278,
-0.00012872711522504687,
-0.0010244190925732255,
0.0009625465027056634,
0.0014483517734333873,
0.000824403134174645,
0.0023612347431480885,
0.0022802494931966066,
-0.008656276389956474,
-0.010911557823419571,
0.0035304168704897165,
0.002940876642242074,
-0.0027605989016592503,
0.005108547396957874,
0.005209361668676138,
-0.004415708594024181,
0.0013793162070214748,
-0.012915464118123055,
-0.0017958470853045583,
-0.003843408776447177,
-0.010090258903801441,
-0.0017546426970511675,
-0.00571260554715991,
0.001345892553217709,
0.00252442411147058,
0.007119546644389629,
-0.003910745028406382,
0.005066594574600458,
-0.0025693329516798258,
0.002238818211480975,
-0.004151333123445511,
0.00015599159814883024,
-0.0068492591381073,
0.008150496520102024,
-0.0001995167403947562,
-0.012268152087926865,
-0.006149859167635441,
-0.000024439328626613133,
-0.0008480573887936771,
-0.004212797619402409,
0.005102528724819422,
-0.0008135604439303279,
0.007246858906000853,
-0.0017193738603964448,
0.0030062906444072723,
-0.007002119440585375,
0.004150972235947847,
-0.011952434666454792,
0.0013272881042212248,
-0.18432334065437317,
0.011426297016441822,
0.004413128364831209,
-0.0071184695698320866,
-0.0027463489677757025,
-0.014923418872058392,
-0.0073523554019629955,
0.0035914615727961063,
0.00873966421931982,
0.001401532324962318,
0.0002406810235697776,
-0.0004965253174304962,
0.008183884434401989,
0.007440338376909494,
-0.0007849808316677809,
-0.0066542052663862705,
0.009767122566699982,
-0.004426872823387384,
0.00038478474016301334,
0.005256681703031063,
0.0072709061205387115,
0.007621703669428825,
0.002470014849677682,
0.0037974014412611723,
-0.0017693298868834972,
-0.004221342969685793,
0.004722996149212122,
-0.00011823880049632862,
0.005321008153259754,
-0.00806534942239523,
-0.003190475981682539,
-0.005570549052208662,
-0.00394231453537941,
0.00365487695671618,
0.0076631177216768265,
-0.001201028237119317,
0.005793948192149401,
0.0031492423731833696,
-0.008206458762288094,
0.007155295927077532,
-0.009919359348714352,
0.02877708151936531,
0.0039800615049898624,
0.009178103879094124,
0.0019114235183224082,
-0.004494029562920332,
-0.004068994894623756,
0.009076336398720741,
0.0025007419753819704,
0.013006244786083698,
-0.011309855617582798,
-0.0025470696855336428,
0.0017538202228024602,
0.020836396142840385,
-0.006557809188961983,
-0.010688168928027153,
-0.007828515022993088,
-0.005241421516984701,
0.002933495445176959,
0.01000378467142582,
0.00873294472694397,
-0.006568398792296648,
0.006405784748494625,
-0.003636013250797987,
-0.023108091205358505,
0.0036048265174031258,
-0.004172361455857754,
-0.006829049438238144,
0.0014744267100468278,
0.005103270057588816,
0.013694246299564838,
-0.0014200560981407762,
0.004362235777080059,
0.00009191042772727087,
0.0009662996744737029,
-0.002099948236718774,
0.007179656066000462,
-0.00381624442525208,
0.006659491453319788,
-0.007835750468075275,
0.00884989369660616,
-0.007885240018367767,
-0.003140298882499337,
0.001963764661923051,
-0.004065362270921469,
0.011168760247528553,
0.007432681042701006,
-0.002126141684129834,
-0.001956690801307559,
-0.01169036515057087,
-0.0035504524130374193,
0.0007616428192704916,
0.002719505690038204,
-0.005818504840135574,
-0.0003388347977306694,
-0.003348415018990636,
0.005457978695631027,
0.005852396599948406,
-0.0071103498339653015,
0.004670590627938509,
0.004492681939154863,
-0.008225401863455772,
0.0023298142477869987,
-0.001705655362457037,
0.0016823920886963606,
0.005397259723395109,
-0.006956988945603371,
-0.007821474224328995,
0.005017469637095928,
-0.008281728252768517,
-0.0015621965285390615,
0.006343873217701912,
-0.009346865117549896,
-0.00869785901159048,
0.00045516836689785123,
-0.011600294150412083,
0.0009052175446413457
] |
8a685db25a2acacd77798f8f41ad85739a6b001d | 3,825 | py | Python | train_fcn.py | onlyNata/segModel | 7a823e096b3ed7f554a331c5fba39e24c9e0d8bf | [
"MIT"
] | 3 | 2018-07-02T06:15:36.000Z | 2019-06-10T06:26:18.000Z | train_fcn.py | onlyNata/segModel | 7a823e096b3ed7f554a331c5fba39e24c9e0d8bf | [
"MIT"
] | null | null | null | train_fcn.py | onlyNata/segModel | 7a823e096b3ed7f554a331c5fba39e24c9e0d8bf | [
"MIT"
] | 1 | 2018-10-19T08:07:59.000Z | 2018-10-19T08:07:59.000Z | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 16:34:21 2018
@author: LiHongWang
"""
import os
import tensorflow as tf
from model import fcn_vgg
from model import fcn_mobile
from model import fcn_resnet_v2
from data import input_data
slim = tf.contrib.slim
def main():
num_classes=2
tfRecorf_dir= 'D:/dataSet/kitti/road/sub_um_lane_tra66.tfrecord'
train_dir = './fm2/'
if not os.path.exists(train_dir):
os.makedirs(train_dir)
with tf.Graph().as_default():
global_step = tf.contrib.framework.get_or_create_global_step()
tf.logging.set_verbosity(tf.logging.INFO)
with tf.device("/cpu:0"):
samples=input_data.get_images_labels(tfRecorf_dir,num_classes,66,
crop_size=[224,224],
batch_size=4)
batch_queue = slim.prefetch_queue.prefetch_queue(samples,
capacity=128 )
tra_batch = batch_queue.dequeue()
logit,prediction=fcn_mobile.fcn_mobv1(tra_batch['image'],num_classes)
# logit,prediction=fcn_vgg.fcn_vgg16(tra_batch['image'],num_classes)
# logit,prediction=fcn_resnet_v2.fcn_res101(tra_batch['image'],num_classes)
cross_entropy=tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logit,
labels=tf.squeeze(tra_batch['label'], squeeze_dims=[3]),name="entropy")
loss = tf.reduce_mean(cross_entropy,name='loss')
slim.losses.add_loss(loss)
total_loss = slim.losses.get_total_loss()
# print("image", tra_batch['image'])
# print("label", tf.cast(tra_batch['label']*255, tf.uint8))
# print("prediction", tf.cast(prediction*255, tf.uint8))
# Create some summaries to visualize the training process:
tf.summary.scalar('losses/Total_Loss', total_loss)
tf.summary.image("image", tra_batch['image'], max_outputs=4)
tf.summary.image("label", tf.cast(tra_batch['label']*255, tf.uint8), max_outputs=4)
tf.summary.image("prediction", tf.cast(prediction*255, tf.uint8), max_outputs=4)
lr = tf.train.exponential_decay(0.001,
global_step,
10000,
0.8,
staircase=True)
#lr = tf.constant(0.001, tf.float32)
tf.summary.scalar('learning_rate', lr)
for variable in slim.get_model_variables():
tf.summary.histogram(variable.op.name, variable)
# Specify the optimizer and create the train op:
optimizer = tf.train.RMSPropOptimizer(lr,0.9)
train_op = slim.learning.create_train_op(total_loss, optimizer)
# Run the training:
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.7)
config=tf.ConfigProto(gpu_options=gpu_options)
final_loss = slim.learning.train(train_op,
logdir=train_dir,
log_every_n_steps=100,
save_summaries_secs=20,
save_interval_secs=1800,
init_fn=None,#fcn_mobile.get_init_fn(),
session_config=config,
number_of_steps=65000)
print('Finished training. Last batch loss %f' % final_loss)
if __name__=='__main__':
main() | 34.151786 | 99 | 0.539608 | 1 | 1.7856 | [
-0.02824903093278408,
0.02649534121155739,
-0.009389234706759453,
-0.026106301695108414,
0.01991305872797966,
0.005641608498990536,
-0.011839174665510654,
-0.0025397627614438534,
-0.056347016245126724,
0.010364248417317867,
0.030449625104665756,
0.012216350995004177,
0.02169726975262165,
0.004640703555196524,
-0.0007164727430790663,
-0.0235553290694952,
0.19054901599884033,
-0.01056479662656784,
-0.03050093725323677,
-0.0023785538505762815,
0.023584973067045212,
0.005152807105332613,
-0.0012692082673311234,
0.02689809538424015,
0.012020852416753769,
0.029143042862415314,
0.056820448487997055,
0.01001632958650589,
0.01948941871523857,
-0.0035541264805942774,
-0.00043630669824779034,
0.01741982437670231,
0.001588893122971058,
0.0027793494518846273,
-0.006624019704759121,
-0.0066256592981517315,
-0.016340026631951332,
-0.028802404180169106,
0.01545317005366087,
-0.03167164325714111,
0.02683880180120468,
-0.02147355116903782,
0.022104959934949875,
-0.018185295164585114,
-0.00399518758058548,
-0.015480684116482735,
-0.018752118572592735,
-0.007033909671008587,
0.011862748302519321,
-0.013583964668214321,
-0.009336908347904682,
0.013606497086584568,
0.03736932575702667,
-0.016568878665566444,
0.013463573530316353,
-0.015148335136473179,
0.01990531198680401,
0.017912108451128006,
-0.034857578575611115,
-0.023280242457985878,
-0.014721699990332127,
0.012132870964705944,
0.013127514161169529,
0.034525882452726364,
-0.033628541976213455,
-0.001234759925864637,
-0.001446582842618227,
0.022214064374566078,
0.05659407004714012,
-0.021021101623773575,
0.014552760869264603,
0.02053876221179962,
-0.029569732025265694,
0.011580842547118664,
0.028008339926600456,
-0.00846437644213438,
-0.05278649926185608,
-0.0026794173754751682,
0.021091146394610405,
-0.012986796908080578,
-0.013012406416237354,
0.05070492997765541,
-0.00039568671490997076,
0.03683431074023247,
0.005031202454119921,
-0.004558879416435957,
0.02365485392510891,
-0.03911225125193596,
0.04899737238883972,
0.01598425954580307,
-0.006479434669017792,
-0.001187434303574264,
-0.06670408695936203,
0.013162512332201004,
0.02003319188952446,
-0.025473572313785553,
0.005120065063238144,
-0.005363751668483019,
-0.0021952784154564142,
-0.0005139066488482058,
-0.00544658163562417,
-0.03871598839759827,
0.029443342238664627,
-0.006889069452881813,
-0.014992906711995602,
-0.009055268950760365,
-0.004561163950711489,
-0.00725463917478919,
0.01835860125720501,
-0.003435725113376975,
-0.06539475172758102,
0.032923128455877304,
0.012743723578751087,
-0.05483962595462799,
-0.003488563932478428,
0.010560495778918266,
0.01186320185661316,
-0.022476771846413612,
0.02592507191002369,
0.07262676954269409,
-0.010323572903871536,
-0.003253560047596693,
-0.026900548487901688,
-0.01692061871290207,
0.007108846213668585,
0.03717964515089989,
0.0046111540868878365,
0.03457975015044212,
0.027707738801836967,
0.008016962558031082,
-0.010131369344890118,
0.008041919209063053,
-0.010961895808577538,
-0.025664398446679115,
0.021417776122689247,
0.01942097209393978,
-0.028664881363511086,
0.025178760290145874,
-0.041628140956163406,
-0.01039402186870575,
-0.003327104961499572,
-0.029689054936170578,
-0.001669708639383316,
-0.013077294453978539,
0.003570333356037736,
-0.04344405606389046,
-0.021401507779955864,
0.02230069972574711,
-0.014212100766599178,
0.011635364033281803,
-0.00964526366442442,
0.016349773854017258,
0.013569049537181854,
-0.010941711254417896,
-0.012430385686457157,
0.02588355354964733,
-0.02039262466132641,
-0.0277717262506485,
0.01340645644813776,
-0.008438646793365479,
-0.007940983399748802,
0.0009981525363400578,
-0.017567235976457596,
-0.010104754008352757,
0.03766542300581932,
-0.005539553705602884,
0.02599228359758854,
0.021188747137784958,
-0.004104756284505129,
-0.036606885492801666,
-0.007898224517703056,
-0.011644953861832619,
-0.009347698651254177,
0.0019568358547985554,
-0.018653973937034607,
-0.031315356492996216,
0.017239607870578766,
0.004332051612436771,
0.0329754613339901,
-0.01750263385474682,
0.0038882975932210684,
-0.03968193754553795,
0.009937349706888199,
0.02564375288784504,
-0.02121192403137684,
0.041825879365205765,
-0.09009335190057755,
-0.008317898958921432,
0.009731653146445751,
-0.015944816172122955,
-0.014094853773713112,
0.034643180668354034,
-0.0067230695858597755,
-0.01290430873632431,
-0.012251096777617931,
-0.043560098856687546,
-0.0008787773549556732,
0.00725002633407712,
0.003402315080165863,
0.03258810564875603,
0.01199242752045393,
-0.009049681015312672,
-0.0207973662763834,
-0.012632259167730808,
-0.003342424752190709,
0.002202601172029972,
-0.7854762673377991,
0.023111648857593536,
-0.003218166995793581,
-0.005631322041153908,
-0.023316387087106705,
0.008830809034407139,
-0.029598340392112732,
0.005180699285119772,
-0.002990191103890538,
-0.00463870307430625,
0.005214419215917587,
-0.0026827252004295588,
-0.0007044372032396495,
-0.004650313872843981,
0.008722824044525623,
-0.009560021571815014,
-0.01370538305491209,
0.023820441216230392,
0.03527093678712845,
-0.00010903953807428479,
-0.028636455535888672,
-0.012668322771787643,
0.008304322138428688,
0.020655691623687744,
0.003950697369873524,
-0.04114553704857826,
-0.0338343046605587,
0.011229611933231354,
-0.01063304953277111,
0.0024076534900814295,
-0.001538467826321721,
-0.007108910474926233,
0.02345789410173893,
-0.011207054369151592,
0.01936037465929985,
-0.036164138466119766,
0.058291155844926834,
0.009312721900641918,
0.03161413595080376,
-0.0041299001313745975,
-0.025361383333802223,
-0.023830752819776535,
-0.0041085160337388515,
-0.05761423707008362,
-0.002271662000566721,
0.03742365911602974,
0.028469108045101166,
0.025895986706018448,
0.013564578257501125,
-0.011906513944268227,
-0.016084542497992516,
0.019338740035891533,
0.027708442881703377,
0.009856373071670532,
0.010884452611207962,
-0.012054027058184147,
-0.01695610024034977,
0.0063974857330322266,
0.012195417657494545,
-0.0157186146825552,
0.0004118777869734913,
-0.006496339105069637,
-0.0098887849599123,
0.0005314233712852001,
0.009066819213330746,
-0.006813659332692623,
0.04752678424119949,
-0.012957327999174595,
0.014967272989451885,
-0.001192294992506504,
-0.020878484472632408,
-0.008480929769575596,
-0.03260454908013344,
-0.020100055262446404,
0.008946917951107025,
-0.022037263959646225,
0.00471699982881546,
0.015016923658549786,
-0.04753570258617401,
-0.017774445936083794,
-0.008151832967996597,
-0.013220477849245071,
0.02914038859307766,
-0.009754360653460026,
-0.013548697344958782,
-0.002286049537360668,
0.0056393882259726524,
-0.01696280762553215,
0.0002837232023011893,
0.01845391094684601,
-0.02331814542412758,
0.02561088092625141,
-0.02770495042204857,
0.01606564223766327,
0.030283404514193535,
0.019168034195899963,
0.008601543493568897,
-0.002182713709771633,
-0.0011444183764979243,
0.0025725835002958775,
-0.011803417466580868,
0.02320231683552265,
0.015812210738658905,
-0.0031725952867418528,
-0.026632159948349,
-0.0032929982990026474,
-0.012890754267573357,
-0.017665814608335495,
0.025117408484220505,
0.00417362479493022,
-0.010069021955132484,
-0.023438485339283943,
-0.02198341302573681,
0.02789883315563202,
0.004068491980433464,
0.0017244508489966393,
-0.02438199520111084,
-0.013009743764996529,
-0.016543304547667503,
0.01702352613210678,
0.0033482350409030914,
-0.013161453418433666,
0.0009084576740860939,
0.034610096365213394,
0.024426482617855072,
0.011900220066308975,
-0.019779620692133904,
0.010868482291698456,
0.010432369075715542,
0.009225503541529179,
-0.04348320513963699,
0.0025123741943389177,
-0.01948472298681736,
-0.012214820832014084,
-0.0017064959974959493,
0.020389823243021965,
-0.015392551198601723,
-0.03305394574999809,
-0.005074632354080677,
0.011092358268797398,
-0.043141528964042664,
-0.01951839029788971,
0.005594187881797552,
-0.015952711924910545,
0.0006447444902732968,
0.024333544075489044,
0.000990257947705686,
0.03143490105867386,
0.009651302359998226,
-0.012283070012927055,
0.006410503294318914,
0.0029904753901064396,
0.0033811561297625303,
0.01850837469100952,
-0.04557414725422859,
-0.019157269969582558,
0.011421164497733116,
0.02142135426402092,
0.008231952786445618,
-0.008641126565635204,
0.013204015791416168,
0.0024394220672547817,
-0.04638401046395302,
0.009335977956652641,
0.0315057598054409,
-0.014180440455675125,
-0.014589006081223488,
-0.011665443889796734,
-0.008571755141019821,
0.024280279874801636,
-0.014350525103509426,
-0.006860374938696623,
0.010139216668903828,
0.019347095862030983,
-0.012203525751829147,
0.01584644801914692,
0.00157074851449579,
-0.003671466838568449,
0.04149991273880005,
-0.01216280646622181,
0.0032727874349802732,
-0.008621000684797764,
-0.021865375339984894,
-0.0044883545488119125,
0.011677485890686512,
0.009949581697583199,
0.007728601340204477,
-0.010197576135396957,
-0.012215930037200451,
-0.011138232424855232,
0.032717444002628326,
0.014602984301745892,
-0.021032165735960007,
-0.01701693795621395,
-0.02543901465833187,
0.017522301524877548,
-0.018882283940911293,
-0.05861469730734825,
0.007260406389832497,
-0.012259879149496555,
0.007089969702064991,
0.04943280667066574,
-0.005553942173719406,
-0.012652403675019741,
0.004266831558197737,
0.019513143226504326,
-0.007206530310213566,
-0.0030399796087294817,
0.0064385379664599895,
-0.0031373808160424232,
-0.029624272137880325,
-0.00515856733545661,
0.024937033653259277,
-0.017030909657478333,
0.006102880463004112,
0.026366323232650757,
-0.03476644679903984,
0.00460844486951828,
0.0002818572393152863,
-0.027494478970766068,
-0.04109031334519386,
-0.01637733355164528,
0.024564377963542938,
-0.004614593926817179,
0.006078202277421951,
-0.011939022690057755,
-0.0280540082603693,
-0.00271530169993639,
0.01395545993000269,
-0.03508959710597992,
-0.0007521791267208755,
0.023541942238807678,
0.007143321912735701,
-0.008211785927414894,
-0.006121566519141197,
-0.009240767918527126,
-0.02529444731771946,
-0.0007330354419536889,
-0.008913055062294006,
-0.03397565335035324,
0.019153151661157608,
-0.010815281420946121,
0.013751673512160778,
-0.004077821504324675,
0.0036360963713377714,
-0.0120003130286932,
-0.00837529357522726,
0.000420321652200073,
0.002621977124363184,
-0.0027775352355092764,
-0.002708646934479475,
0.051839862018823624,
0.03159235417842865,
-0.0035808244720101357,
0.010657403618097305,
0.020719509571790695,
0.001991096418350935,
0.004902038257569075,
0.008529194630682468,
0.010280785150825977,
-0.006606752052903175,
-0.004156860522925854,
0.006141707766801119,
-0.0012206619139760733,
0.0033430017065256834,
0.003935007378458977,
-0.03110419772565365,
-0.009957960806787014,
0.01706143096089363,
-0.004820438101887703,
0.006229721009731293,
-0.004302894696593285,
0.011994441971182823,
0.002119562355801463,
0.0012163849314674735,
0.01994800753891468,
-0.007648445200175047,
-0.023400140926241875,
0.005963536445051432,
0.03323924168944359,
0.029457533732056618,
-0.0013601116370409727,
0.023423677310347557,
0.006789016537368298,
0.016589581966400146,
0.018513714894652367,
0.013443747535347939,
-0.004228881094604731,
-0.039556555449962616,
-0.013477209955453873,
-0.012532846070826054,
-0.01976667158305645,
0.03769521042704582,
-0.01245945319533348,
-0.007283441722393036,
-0.00941257644444704,
-0.006864855065941811,
-0.026486819609999657,
-0.023723416030406952,
-0.0274022426456213,
0.012720889411866665,
-0.005894203204661608,
-0.026450103148818016,
-0.0026546993758529425,
0.004535969812422991,
-0.005391207989305258,
0.011906384490430355,
0.020964927971363068,
0.01524499710649252,
0.024884654209017754,
-0.011344126425683498,
-0.010700120590627193,
0.03340093418955803,
0.048879366368055344,
0.011199476197361946,
-0.011445103213191032,
0.031306564807891846,
-0.04575195908546448,
0.016544515267014503,
0.009277448989450932,
-0.025715837255120277,
0.01040046475827694,
-0.013589252717792988,
0.005036484450101852,
-0.008915499784052372,
-0.026533588767051697,
-0.026520637795329094,
0.004827238153666258,
0.02219097502529621,
0.06289826333522797,
0.0010470252018421888,
-0.017990631982684135,
0.05596998333930969,
-0.018459364771842957,
-0.02053644135594368,
0.00734188174828887,
0.011031152680516243,
0.02120775356888771,
0.016665173694491386,
-0.020778372883796692,
-0.03327419236302376,
-0.00940092746168375,
-0.019326413050293922,
-0.015012918040156364,
0.0020617879927158356,
0.0028007396031171083,
0.0080224284902215,
0.006344357505440712,
-0.0018691082950681448,
0.00715958047658205,
-0.030537128448486328,
-0.015118292532861233,
-0.0006674997857771814,
-0.0019730946514755487,
-0.005134793929755688,
0.017389796674251556,
0.012666599825024605,
0.0007369198137894273,
0.029890183359384537,
0.03098789043724537,
-0.014795745722949505,
0.0010215746005997062,
-0.0009741683606989682,
-0.006292893551290035,
-0.020930897444486618,
-0.009234689176082611,
0.03131694346666336,
-0.008080474101006985,
0.013175149448215961,
0.044449035078287125,
-0.047178059816360474,
-0.00037513705319724977,
0.03196797892451286,
0.025145918130874634,
0.0030344873666763306,
0.044030848890542984,
0.01284850388765335,
0.01141322124749422,
-0.022207777947187424,
-0.020200705155730247,
-0.000862909946590662,
-0.011420698836445808,
-0.002006207127124071,
0.004033853765577078,
0.014937162399291992,
-0.021142717450857162,
-0.010960036888718605,
0.02794298343360424,
-0.05102449283003807,
-0.0292984526604414,
0.0033065401948988438,
-0.00023360230261459947,
-0.006146427243947983,
0.0047781504690647125,
-0.022870628163218498,
0.001812607515603304,
-0.020160771906375885,
-0.00511952256783843,
-0.01153999101370573,
-0.010748081840574741,
-0.01215796172618866,
0.007844794541597366,
0.011212944984436035,
-0.004351739771664143,
-0.037898264825344086,
-0.026125015690922737,
0.015525824390351772,
-0.010162204504013062,
-0.011576872318983078,
0.025694921612739563,
-0.012556271627545357,
0.03617500513792038,
-0.028507668524980545,
-0.004034306854009628,
0.005813306197524071,
0.018723584711551666,
-0.0068570272997021675,
-0.009460062719881535,
-0.0058257486671209335,
0.058060530573129654,
-0.011511814780533314,
0.009412458166480064,
-0.017978720366954803,
-0.01660880446434021,
-0.04405522719025612,
-0.015825241804122925,
-0.00417591305449605,
0.008367201313376427,
-0.007547715678811073,
0.029252758249640465,
0.028266560286283493,
-0.021271338686347008,
-0.012417842634022236,
-0.003355334745720029,
-0.016428986564278603,
-0.011534974910318851,
-0.023106740787625313,
0.01917213201522827,
0.03435654193162918,
0.010959593579173088,
-0.004867528565227985,
0.0015787954907864332,
-0.00416370527818799,
-0.01536717638373375,
-0.007104700431227684,
-0.10947311669588089,
0.03018481843173504,
-0.025411684066057205,
0.021479301154613495,
-0.004238887690007687,
-0.021476970985531807,
-0.014320713467895985,
-0.006885353941470385,
0.03794848546385765,
0.05045955255627632,
0.02359888143837452,
0.0007156357751227915,
0.013598400168120861,
0.008752000518143177,
-0.01959887333214283,
0.0026797589380294085,
0.012983663938939571,
0.010430567897856236,
-0.018391644582152367,
0.029590114951133728,
-0.0021911878138780594,
0.004299802705645561,
-0.014457520097494125,
0.008425051346421242,
-0.007453839760273695,
0.0209116879850626,
0.019444290548563004,
0.0031876033172011375,
0.003776043886318803,
0.011153984814882278,
-0.028049759566783905,
-0.010427098721265793,
-0.007815671153366566,
0.004588106647133827,
0.004082828294485807,
0.009201347827911377,
0.009224660694599152,
0.007504354231059551,
-0.008263248018920422,
0.02347378619015217,
-0.004283052869141102,
-0.001411883975379169,
-0.004642211366444826,
0.012849168851971626,
0.030018791556358337,
-0.02159922569990158,
-0.023139601573348045,
0.003994126804172993,
0.003076330991461873,
0.007826481014490128,
-0.04414280503988266,
0.01985117793083191,
-0.004295934457331896,
0.0313275083899498,
-0.0015919763827696443,
0.03604688495397568,
-0.03659239038825035,
-0.012766731902956963,
-0.018815582618117332,
0.0032533372286707163,
0.014497493393719196,
0.02492664009332657,
0.015724390745162964,
-0.0010223874123767018,
-0.04834635183215141,
-0.004986234474927187,
-0.004839602392166853,
0.010982082225382328,
-0.034527845680713654,
0.008368341252207756,
0.003352761035785079,
0.026104742661118507,
0.0002966417232528329,
-0.01514170877635479,
0.005674426909536123,
-0.004409514833241701,
-0.009675762616097927,
-0.009239462204277515,
-0.01240579504519701,
-0.006579742766916752,
0.019592542201280594,
-0.012505512684583664,
0.0399957001209259,
0.031696867197752,
-0.007348131854087114,
0.0061305854469537735,
0.007227668538689613,
-0.030118148773908615,
-0.009041596204042435,
-0.0037670850288122892,
0.0011553361546248198,
-0.0003587222599890083,
0.029191255569458008,
-0.03753601759672165,
-0.01720387116074562,
0.05012314394116402,
0.007567605935037136,
0.023174278438091278,
-0.01575959287583828,
-0.00959043949842453,
-0.013452342711389065,
0.0013089262647554278,
-0.004149160347878933,
0.03181825205683708,
0.01151038147509098,
-0.008080994710326195,
0.028697330504655838,
-0.01371048018336296,
0.021428868174552917,
0.0026235897094011307,
0.053404390811920166,
-0.010836564935743809,
-0.023061072453856468,
-0.010235171765089035,
-0.03498156741261482,
0.024439923465251923,
-0.0043615601025521755
] |
8a69c6a560d7f1d6a12a9bb69281971b56733693 | 1,637 | py | Python | setup.py | xbabka01/filetype.py | faba42b86988bd21a50d5b20919ecff0c6a84957 | [
"MIT"
] | null | null | null | setup.py | xbabka01/filetype.py | faba42b86988bd21a50d5b20919ecff0c6a84957 | [
"MIT"
] | null | null | null | setup.py | xbabka01/filetype.py | faba42b86988bd21a50d5b20919ecff0c6a84957 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
from setuptools import find_packages, setup
setup(
name='filetype',
version='1.0.7',
description='Infer file type and MIME type of any file/buffer. '
'No external dependencies.',
long_description=codecs.open('README.rst', 'r',
encoding='utf-8', errors='ignore').read(),
keywords='file libmagic magic infer numbers magicnumbers discovery mime '
'type kind',
url='https://github.com/h2non/filetype.py',
download_url='https://github.com/h2non/filetype.py/tarball/master',
author='Tomas Aparicio',
author_email='tomas@aparicio.me',
license='MIT',
license_files=['LICENSE'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: System',
'Topic :: System :: Filesystems',
'Topic :: Utilities'],
platforms=['any'],
packages=find_packages(exclude=['dist', 'build', 'docs', 'tests',
'examples']),
package_data={'filetype': ['LICENSE', '*.md']},
zip_safe=True)
| 38.069767 | 77 | 0.588882 | 1 | 1.1676 | [
0.00048289907863363624,
0.024055808782577515,
0.006832497660070658,
0.0006559640169143677,
0.0036774673499166965,
-0.0015016120159998536,
-0.010795029811561108,
0.0028087329119443893,
-0.010005490854382515,
0.0023108709137886763,
0.003187644062563777,
0.006014799699187279,
0.0064286827109754086,
-0.016583697870373726,
0.0027238759212195873,
0.016681108623743057,
-0.05441047623753548,
0.0014847738202661276,
-0.0039086854085326195,
0.0015474100364372134,
-0.00715256854891777,
0.010396823287010193,
0.007415593136101961,
0.00905008427798748,
0.007561671081930399,
-0.0007850319962017238,
0.008107881061732769,
0.002221027621999383,
-0.008345872163772583,
-0.004763707984238863,
-0.0011760257184505463,
-0.0026340121403336525,
-0.0054949549958109856,
-0.008663160726428032,
0.006877117790281773,
-0.0009780804393813014,
0.0010034845909103751,
-0.01942606084048748,
0.011821351014077663,
-0.0038673924282193184,
-0.007639585994184017,
-0.01677580550312996,
0.0002549941127654165,
0.0012257015332579613,
-0.009906650520861149,
0.002192788990214467,
-0.004554016049951315,
0.0029750466346740723,
-0.010753779672086239,
0.006037887651473284,
-0.009435664862394333,
0.005963121075183153,
0.013225111179053783,
0.0044479332864284515,
-0.008001967333257198,
-0.006450384855270386,
0.011824255809187889,
0.001497657154686749,
-0.011531486175954342,
-0.00011860764061566442,
-0.0016495466697961092,
-0.0027982830069959164,
0.005452190991491079,
0.004646376706659794,
-0.017814654856920242,
-0.008909114636480808,
-0.0035258911084383726,
0.0017636255361139774,
-0.0014878690708428621,
0.0040786112658679485,
-0.00004579068991006352,
-0.0015556069556623697,
0.006902214139699936,
0.003760821186006069,
0.0068642315454781055,
-0.0010224867146462202,
-0.0019309225026518106,
-0.00006596460298169404,
0.010505646467208862,
0.0042218975722789764,
0.004210866522043943,
-0.00575268967077136,
0.006573621183633804,
0.009982873685657978,
0.015428103506565094,
0.007496640086174011,
0.01843164674937725,
-0.010752229019999504,
0.045682039111852646,
0.006381011568009853,
-0.010482466779649258,
0.0011412836611270905,
-0.00827091559767723,
-0.0015988072846084833,
-0.0032303729094564915,
-0.028738467022776604,
0.0026275948621332645,
-0.003959819208830595,
-0.00002669281093403697,
0.003892699023708701,
-0.000509940495248884,
0.005800000857561827,
-0.001603251206688583,
-0.0016628885641694069,
-0.012097006663680077,
0.012392019852995872,
-0.00910941045731306,
-0.003000672673806548,
0.005562069360166788,
0.0019048199756070971,
-0.008014783263206482,
-0.0009930063970386982,
0.0010941331274807453,
-0.012726256623864174,
0.002691296162083745,
0.0038746721111238003,
-0.005000479519367218,
0.053918760269880295,
-0.0008000263478606939,
0.005016007460653782,
-0.0046366495080292225,
0.00038445612881332636,
-0.0011189811630174518,
0.004673186223953962,
0.008499421179294586,
-0.003947583492845297,
0.011127205565571785,
0.006151573732495308,
0.004083878360688686,
0.009082410484552383,
-0.0011480237590149045,
0.004614502657204866,
-0.004913888871669769,
-0.0027786593418568373,
-0.000904603861272335,
-0.009001437574625015,
0.008869570679962635,
-0.002110853558406234,
-0.0067853741347789764,
0.0009036553674377501,
-0.0011283562052994967,
-0.009479939937591553,
0.002770437393337488,
-0.0032334337010979652,
0.0022292286157608032,
-0.012467509135603905,
-0.0050264326855540276,
-0.0017901150276884437,
-0.004165406804531813,
0.0021472633816301823,
0.008880101144313812,
0.005087008699774742,
0.0034427796490490437,
-0.005484472960233688,
-0.008912644349038601,
-0.0015129679813981056,
-0.0024450612254440784,
0.002150188200175762,
0.0071692755445837975,
0.003629905404523015,
-0.010666772723197937,
-0.0019005656940862536,
0.003987218253314495,
0.004885070491582155,
-0.002011361299082637,
0.003762998152524233,
-0.0077576180920004845,
0.007992193102836609,
0.0007660260889679193,
0.004750493448227644,
0.011422539129853249,
-0.004002787172794342,
-0.0015932248206809163,
0.0023072906769812107,
0.005452426616102457,
-0.0006265649572014809,
0.006003981456160545,
0.010579262860119343,
-0.0033931033685803413,
-0.002707738196477294,
0.0033840653486549854,
0.006170765962451696,
0.008194402791559696,
0.00929054245352745,
-0.0033179931342601776,
0.002107784152030945,
-0.004169636871665716,
-0.002031416865065694,
0.005791794508695602,
-0.0033317848574370146,
0.007350750733166933,
0.004283331800252199,
-0.01376315951347351,
-0.007135514635592699,
-0.0004436192393768579,
-0.008970490656793118,
0.0010463431244716048,
0.012392777018249035,
0.012382308952510357,
-0.00424331147223711,
0.00348474970087409,
-0.009914269670844078,
0.002373990137130022,
0.007750480901449919,
-0.000044960022933082655,
-0.01388065330684185,
-0.9575793147087097,
0.005086555145680904,
0.0013548167189583182,
-0.0007765574846416712,
0.006168185733258724,
0.0003364056465215981,
0.0015121744945645332,
0.004756522364914417,
0.01238181721419096,
-0.006712424568831921,
-0.0064179846085608006,
-0.00888399500399828,
-0.013332166709005833,
-0.0016686331946402788,
-0.008193458430469036,
-0.0024795811623334885,
-0.005915157031267881,
-0.006809293292462826,
-0.0009866748005151749,
-0.004631968680769205,
-0.0029134375508874655,
0.009567704051733017,
-0.0033045087475329638,
0.004894992336630821,
0.003427593968808651,
0.004209437873214483,
-0.0032415357418358326,
0.0002941985731013119,
0.0006750914035364985,
-0.004458567127585411,
-0.006663786247372627,
-0.01620003767311573,
-0.003780276980251074,
0.0002845020208042115,
0.009205589070916176,
0.002787694800645113,
0.008376263082027435,
-0.0007579858065582812,
0.0015979036688804626,
-0.00567682646214962,
0.00410108407959342,
0.0017934556817635894,
0.0026143223512917757,
-0.029458606615662575,
0.0008909592288546264,
-0.0010369353694841266,
-0.01161047350615263,
0.005690582096576691,
0.0017128330655395985,
-0.0015047709457576275,
-0.0023063907865434885,
-0.007567663677036762,
0.010137482546269894,
-0.007638789713382721,
0.005976721178740263,
-0.003876426722854376,
-0.008928656578063965,
-0.003734421916306019,
-0.008592004887759686,
0.0009755670907907188,
0.0053000254556536674,
-0.00503412215039134,
-0.005648788530379534,
-0.003210464958101511,
0.001435062033124268,
0.00501020485535264,
0.0015293994219973683,
-0.02018721029162407,
-0.005778950173407793,
-0.0019380288431420922,
0.0055233207531273365,
-0.004478082992136478,
-0.004009863827377558,
0.00719404686242342,
-0.009064536541700363,
0.00762369018048048,
0.002918813843280077,
0.0002097499673254788,
-0.010494069196283817,
0.0016430245013907552,
-0.00812262762337923,
-0.007565183099359274,
0.0013381099561229348,
-0.005392611026763916,
-0.005254570860415697,
-0.0009816231904551387,
0.0005838236538693309,
0.0065064202062785625,
-0.0038447785191237926,
0.0040892381221055984,
0.010965204797685146,
-0.0058937701396644115,
-0.007932497188448906,
0.00526821194216609,
0.006686129607260227,
0.001582922413945198,
-0.0017003519460558891,
0.0009997505694627762,
0.010044910944998264,
0.007531147450208664,
0.003772599156945944,
0.0058866096660494804,
0.00022079846530687064,
0.007787153124809265,
0.0003986393567174673,
0.002604277804493904,
-0.003482437925413251,
-0.0018576241564005613,
-0.004155064467340708,
0.0005223582265898585,
-0.0027873823419213295,
-0.004111504647880793,
-0.011947590857744217,
-0.008656277321279049,
-0.0009778012754395604,
0.000736463931389153,
0.0013184529962018132,
-0.0022435029968619347,
-0.0010758695425465703,
0.003569358494132757,
0.009424833580851555,
-0.0019693844951689243,
-0.003008988918736577,
0.000005932228759775171,
0.0035349635872989893,
-0.006739887408912182,
0.014458926394581795,
-0.009752136655151844,
0.005258850287646055,
-0.0009028806234709918,
-0.017527926713228226,
0.006543193012475967,
0.009178638458251953,
-0.007926663383841515,
0.0036250734701752663,
0.0026300859171897173,
0.0008064777357503772,
-0.00002390182635281235,
-0.004551362246274948,
-0.002798155415803194,
-0.01761460117995739,
0.00022248466848395765,
0.01868288405239582,
0.0017223900649696589,
0.010025612078607082,
0.011729380115866661,
-0.004183941055089235,
0.00042065695743076503,
0.00467985775321722,
-0.00002664820567588322,
0.011930606327950954,
-0.00935770757496357,
-0.0008511653868481517,
-0.0002755934838205576,
-0.004695008974522352,
0.0008643634500913322,
0.007132256869226694,
0.005635878536850214,
-0.002446142490953207,
0.0017221244052052498,
-0.00615529902279377,
-0.004671956412494183,
-0.017588665708899498,
-0.00223217043094337,
0.008759969845414162,
-0.005943868774920702,
0.0056810537353158,
-0.009988990612328053,
0.005291062407195568,
0.006713884882628918,
0.0038903080858290195,
0.0009749298333190382,
-0.000696091796271503,
0.007622890640050173,
0.010496503673493862,
-0.006273864768445492,
-0.000495791609864682,
0.003514581359922886,
-0.0011226398637518287,
-0.0011236490681767464,
0.008315816521644592,
-0.007078426890075207,
-0.004833928309381008,
0.0022342579904943705,
0.0029865805990993977,
0.0013116203481331468,
-0.003764483844861388,
-0.0077093904837965965,
-0.0028551535215228796,
0.0048463293351233006,
-0.005913786590099335,
0.004677863791584969,
0.0006138966418802738,
0.0037193051539361477,
-0.008219047449529171,
0.0011216200655326247,
-0.006218005903065205,
-0.011598014272749424,
0.011923057958483696,
-0.0018459638813510537,
0.002185201272368431,
0.010768958367407322,
0.00494262995198369,
-0.014760670252144337,
0.004411305300891399,
0.0075391498394310474,
-0.0029098736122250557,
0.0032319724559783936,
0.007101838942617178,
-0.0045561897568404675,
-0.02230384200811386,
-0.0013557177735492587,
-0.012465571984648705,
0.006765291094779968,
-0.0020110944751650095,
0.004701923578977585,
-0.007195600774139166,
0.0053204926662147045,
0.008221926167607307,
-0.013455252163112164,
-0.003845513565465808,
-0.010126267559826374,
0.007027319632470608,
-0.0010766932973638177,
-0.0014053601771593094,
-0.003191837575286627,
-0.0010945538524538279,
-0.0036995206028223038,
-0.002403231570497155,
-0.0037870658561587334,
0.005679884925484657,
0.0020474051125347614,
-0.004137348383665085,
0.0016403612680733204,
-0.0028321039862930775,
-0.0007734770188108087,
0.0033035622909665108,
-0.009413414634764194,
0.0042411829344928265,
0.00599772110581398,
-0.00101435964461416,
-0.0031756816897541285,
-0.000018065056792693213,
-0.003090260084718466,
-0.005189306102693081,
-0.009086867794394493,
-0.0029934775084257126,
-0.002885764930397272,
-0.0021283836103975773,
-0.011444732546806335,
-0.0012526841601356864,
-0.011313454248011112,
0.006139905657619238,
-0.006820560898631811,
0.008804978802800179,
0.003853162284940481,
-0.0056461188942193985,
0.004419246222823858,
-0.00288693537004292,
0.004806447774171829,
0.004705829080194235,
0.0071509042754769325,
0.0006970001850277185,
-0.004427151754498482,
-0.010530492290854454,
0.013302072882652283,
-0.007447835523635149,
0.001815782394260168,
0.012325803749263287,
0.0044351257383823395,
0.010457003489136696,
0.00006128967652330175,
0.00022438899031840265,
0.004892251454293728,
0.008351284079253674,
-0.012511137872934341,
0.0029107157606631517,
-0.0025393078103661537,
-0.00022471668489743024,
0.005950449500232935,
-0.0038665100000798702,
0.004023279994726181,
0.009409782476723194,
0.00127270573284477,
-0.008561994880437851,
-0.0006036365521140397,
0.00015171489212661982,
0.004809977486729622,
-0.012055739760398865,
0.0006533238920383155,
-0.0024224792141467333,
-0.0056673879735171795,
-0.003113471670076251,
-0.003716694889590144,
0.00018733306205831468,
0.003418418113142252,
-0.002830600133165717,
0.00628445902839303,
0.0011149331694468856,
-0.0047172182239592075,
0.014195166528224945,
-0.007413794752210379,
-0.006259049754589796,
0.00329338270239532,
0.0020629994105547667,
-0.0045372792519629,
-0.005293354857712984,
-0.004825379233807325,
0.0018452458316460252,
0.005586299113929272,
-0.0019470017869025469,
-0.005212015006691217,
-0.00019197544315829873,
0.00042909453622996807,
-0.008001723326742649,
-0.000711955945007503,
0.013838641345500946,
-0.002409278880804777,
0.005556180141866207,
-0.0008929573814384639,
-0.006815430708229542,
-0.013400271534919739,
0.054456036537885666,
-0.00029347825329750776,
0.005215128418058157,
0.005302175413817167,
-0.007217332720756531,
-0.0004245875752530992,
-0.0018163135973736644,
0.0059412806294858456,
-0.009401996619999409,
-0.009257663041353226,
0.011517017148435116,
-0.0025776862166821957,
0.004793303553014994,
-0.00027674552984535694,
0.00029384714434854686,
0.0150750195607543,
-0.0027831995394080877,
-0.016064433380961418,
-0.016775602474808693,
0.007282047998160124,
-0.003932728432118893,
-0.008949542418122292,
0.008231223560869694,
-0.0028236773796379566,
-0.003641013288870454,
0.00046435793046839535,
0.004338954109698534,
0.0002579395077191293,
-0.00014326040400192142,
-0.003685549832880497,
-0.0018383520655333996,
-0.0005153361707925797,
0.0021325317211449146,
0.007466444745659828,
0.008849152363836765,
-0.003935768269002438,
0.0056642512790858746,
-0.003349094418808818,
-0.001671500620432198,
-0.0016769061330705881,
0.00543985003605485,
0.0064475941471755505,
-0.0019503626972436905,
-0.0023928401060402393,
0.0048623112961649895,
0.004482331220060587,
0.001176265417598188,
0.00999277364462614,
-0.00012440812133718282,
-0.004284340888261795,
0.009635338559746742,
0.006864100228995085,
-0.0023716790601611137,
0.0073947906494140625,
-0.0024684742093086243,
0.005228593945503235,
0.003130646888166666,
-0.0068435524590313435,
-0.01678738370537758,
-0.004396331962198019,
0.004671435337513685,
0.007677068468183279,
-0.0006490436499007046,
0.0007911536376923323,
-0.0023698839358985424,
-0.002304859459400177,
-0.007870038971304893,
-0.007217665668576956,
-0.004353339783847332,
0.0008948280592449009,
0.002971378155052662,
0.07285960018634796,
-0.004480583593249321,
-0.0008698704768903553,
-0.006648722104728222,
-0.0012349352473393083,
-0.0029105220455676317,
-0.003598112380132079,
-0.0008493108907714486,
-0.002431114437058568,
0.0017628391506150365,
0.0010066471295431256,
-0.005790427792817354,
-0.010707331821322441,
0.0013780536828562617,
0.0003900523006450385,
-0.002786270808428526,
0.003826647065579891,
0.007161129266023636,
-0.010260649025440216,
0.002491301391273737,
-0.01074805948883295,
-0.0034052671398967505,
-0.002621866762638092,
-0.009670908562839031,
-0.00259800860658288,
-0.002680224599316716,
0.005373311694711447,
0.0044868746772408485,
0.0058773537166416645,
-0.0018639292102307081,
0.007323016878217459,
-0.0021488983184099197,
0.0017900363309308887,
-0.005585136357694864,
-0.0007675321539863944,
-0.006754865869879723,
0.006482256110757589,
-0.0006296923384070396,
-0.009900446981191635,
-0.005008676555007696,
-0.004691204521805048,
0.0004323597240727395,
-0.004805394914001226,
0.005498823709785938,
-0.002349909394979477,
0.0045185149647295475,
-0.0022355830296874046,
0.0013749562203884125,
-0.007179532665759325,
0.0020377724431455135,
-0.013455450534820557,
0.005518110003322363,
-0.17733706533908844,
0.010207868181169033,
0.0037223570980131626,
-0.0056079416535794735,
-0.003733087098225951,
-0.013616213575005531,
-0.008972744457423687,
0.0030747170094400644,
0.010175847448408604,
-0.0003953040868509561,
-0.00019533923477865756,
-0.00048017583321779966,
0.004771217238157988,
0.0048315213061869144,
0.0003263613034505397,
-0.006470199208706617,
0.003696853294968605,
-0.004266773816198111,
0.0016447256784886122,
0.0034876575227826834,
0.003653576597571373,
0.010040439665317535,
0.003425704315304756,
0.001251498586498201,
-0.0008540009730495512,
-0.003994906786829233,
0.006666019093245268,
-0.001238907454535365,
0.004891230259090662,
-0.013310885988175869,
-0.0026771726552397013,
-0.006151619832962751,
-0.005108057055622339,
0.00030790327582508326,
0.005308008752763271,
-0.0031396213453263044,
0.007056307513266802,
0.001117587205953896,
-0.008012554608285427,
0.0077789099887013435,
-0.008766310289502144,
0.028242215514183044,
0.0006095824064686894,
0.00693844398483634,
0.0023472777102142572,
-0.004053703509271145,
-0.0045968396589159966,
0.008769561536610126,
0.002369722817093134,
0.012706112116575241,
-0.014630737714469433,
-0.004178802948445082,
0.004079398233443499,
0.020212622359395027,
-0.005279270000755787,
-0.009814797900617123,
-0.007733672857284546,
-0.004609120078384876,
0.0010610665194690228,
0.009326614439487457,
0.009482845664024353,
-0.0018658788176253438,
0.010314191691577435,
-0.0030250742565840483,
-0.02044951729476452,
0.0018551438115537167,
-0.00237794267013669,
-0.007937053218483925,
0.002707719337195158,
0.007833396084606647,
0.011596943251788616,
-0.0005737802130170166,
0.005824633873999119,
-0.0016297847032546997,
0.004630394745618105,
-0.0006245808908715844,
0.007272195536643267,
-0.0020985628943890333,
0.003845924511551857,
-0.009881870821118355,
0.010042574256658554,
-0.011679098941385746,
-0.0034078641328960657,
0.0019197199726477265,
-0.004735184367746115,
0.010634577833116055,
0.0038844377268105745,
-0.00276766624301672,
-0.0002912378404289484,
-0.010351384989917278,
-0.0023331635165959597,
0.001230399589985609,
0.0034307530149817467,
-0.007829159498214722,
0.004304046276956797,
0.0001675818202784285,
0.004609379451721907,
0.00594640988856554,
-0.006893998943269253,
0.004848024807870388,
0.001795444404706359,
-0.004440898075699806,
0.00025272497441619635,
-0.006202406249940395,
0.003336239606142044,
0.0030039718840271235,
-0.004998341668397188,
-0.005884256213903427,
0.003404148854315281,
-0.0059242551214993,
-0.005958490539342165,
0.006993742194026709,
-0.008545772172510624,
-0.007737420499324799,
-0.002651406452059746,
-0.011401859112083912,
0.0003505125059746206
] |
8a69d4b012c5607f3bca22996d7b21d1f2aed261 | 2,049 | py | Python | demos/netmiko_textfsm.py | ryanaa08/NPA | 45173efa60713858bb8b1d884fe12c50fe69920c | [
"BSD-Source-Code"
] | 4 | 2019-01-15T16:15:26.000Z | 2021-12-05T16:03:15.000Z | demos/netmiko_textfsm.py | krishnakadiyala/NPAcourse | 74f097107839d990b44adcee69d4f949696a332c | [
"BSD-Source-Code"
] | null | null | null | demos/netmiko_textfsm.py | krishnakadiyala/NPAcourse | 74f097107839d990b44adcee69d4f949696a332c | [
"BSD-Source-Code"
] | 2 | 2019-07-04T16:38:19.000Z | 2020-01-31T15:38:27.000Z | # make sure templates are present and netmiko knows about them
# git clone https://github.com/networktocode/ntc-templates
# export NET_TEXTFSM=/home/ntc/ntc-templates/templates/
# see https://github.com/networktocode/ntc-templates/tree/master/templates
# for list of templates
from netmiko import ConnectHandler
import json
user = 'ntc'
pwd = 'ntc123'
d_type = 'cisco_ios'
csr1 = ConnectHandler(ip='csr1', username=user, password=pwd, device_type=d_type)
sh_ip_int_br = csr1.send_command("show ip int brief", use_textfsm=True)
# [{'status': 'up', 'intf': 'GigabitEthernet1', 'ipaddr': '10.0.0.51', 'proto': 'up'}, {'status': 'up', 'intf': 'GigabitEthernet2', 'ipaddr': 'unassigned', 'proto': 'up'}, {'status': 'up', 'intf': 'GigabitEthernet3', 'ipaddr': 'unassigned', 'proto': 'up'}, {'status': 'up', 'intf': 'GigabitEthernet4', 'ipaddr': '5.12.1.1', 'proto': 'up'}, {'status': 'up', 'intf': 'Loopback100', 'ipaddr': '10.200.1.20', 'proto': 'up'}]
# is type list
print (type(sh_ip_int_br))
# list of dicts
print (type(sh_ip_int_br[0]))
for each_dict in sh_ip_int_br:
print "\n"
for key in each_dict.keys():
print key
for each_dict in sh_ip_int_br:
print "\n"
for key, value in each_dict.items():
print key + " is " + value
sh_ver_ios = csr1.send_command("show version", use_textfsm=True)
# [{'running_image': 'packages.conf', 'hostname': 'csr1', 'uptime': '6 hours, 59 minutes', 'config_register': '0x2102', 'hardware': ['CSR1000V'], 'version': '16.6.2', 'serial': ['9KIBQAQ3OPE'], 'rommon': 'IOS-XE'}]
# print the json nicely
print (json.dumps(sh_ver_ios, indent=4))
print sh_ver_ios
# list
print type(sh_ver_ios)
# each item is a dict
print type(sh_ver_ios[0])
# list of dicts with some nested lists with the dicts
for each_dict in sh_ver_ios:
print "\n"
for key, value in each_dict.items():
if type(value) is list:
print key + " is "
for list_entry in value:
print list_entry
if type(value) is str:
print key + " is " + value
| 35.947368 | 420 | 0.660322 | 1 | 1.5636 | [
0.0011152278166264296,
0.024450363591313362,
0.009512598626315594,
0.002515628468245268,
0.004802829120308161,
-0.0015471745282411575,
-0.0080505246296525,
0.00042379580554552376,
-0.006508419290184975,
0.0011433456093072891,
0.002274344675242901,
0.005364706739783287,
0.006138625554740429,
-0.015990525484085083,
-0.001023693010210991,
0.0148084107786417,
-0.050972338765859604,
0.0010076588951051235,
-0.0026278658770024776,
0.0012803621357306838,
-0.008105973713099957,
0.0089950542896986,
0.007948760874569416,
0.0035889851860702038,
0.004711392801254988,
-0.0011692657135426998,
0.007853695191442966,
0.00041056866757571697,
-0.007372310385107994,
-0.006960781756788492,
0.0008484967984259129,
-0.002989391330629587,
-0.006177994422614574,
-0.005553297232836485,
0.00413160165771842,
-0.005638892762362957,
0.0001098423745133914,
-0.018213173374533653,
0.013914454728364944,
-0.004128299653530121,
-0.00644964724779129,
-0.01428937166929245,
-0.0007824891363270581,
0.0026371735148131847,
-0.00860126968473196,
0.000887810718268156,
-0.004212420899420977,
0.0032696668058633804,
-0.014085225760936737,
0.004966565407812595,
-0.006572364829480648,
0.006527387537062168,
0.015923891216516495,
0.003782612970098853,
-0.0066375732421875,
-0.0064359488897025585,
0.012437754310667515,
0.00017738011956680566,
-0.010137764737010002,
-0.00023225434415508062,
-0.003816494718194008,
-0.002422238467261195,
0.004378380719572306,
0.0035068627912551165,
-0.016124848276376724,
-0.005774579476565123,
-0.0015848616603761911,
0.0007457208703272045,
-0.0029727607034146786,
0.00757246371358633,
-0.0002992656663991511,
0.000756573339458555,
0.007752168457955122,
0.003285508370026946,
0.004266480915248394,
-0.004111011046916246,
-0.0011131186038255692,
-0.002282606204971671,
0.008114592172205448,
0.0033203798811882734,
0.0045564803294837475,
-0.006488306913524866,
0.006412073969841003,
0.007450433913618326,
0.014743948355317116,
0.008761659264564514,
0.018889103084802628,
-0.011058866046369076,
0.04692847654223442,
0.007717402186244726,
-0.00627337209880352,
0.002825056901201606,
-0.009094282053411007,
-0.002605261979624629,
-0.005632131360471249,
-0.026976602151989937,
-0.00033332090242765844,
-0.0035506144631654024,
0.0019210346508771181,
0.003457228187471628,
-0.0009412486688233912,
0.007915729656815529,
-0.0015210151905193925,
-0.0024454903323203325,
-0.007758936379104853,
0.008687089197337627,
-0.009425397031009197,
-0.003964243456721306,
0.0050809853710234165,
0.0010544030228629708,
-0.010916266590356827,
-0.0035528785083442926,
0.003063984913751483,
-0.011889737099409103,
0.0024035689420998096,
0.0033718692138791084,
-0.003476854879409075,
0.05357525125145912,
-0.0009402279974892735,
0.0012751786271110177,
-0.0029928921721875668,
0.002267394680529833,
0.0015294515760615468,
0.005271236412227154,
0.01078361552208662,
-0.0023655840195715427,
0.013243217021226883,
0.007183907087892294,
0.002878208877518773,
0.008340228348970413,
-0.0038164372090250254,
0.004767611622810364,
-0.002530862810090184,
-0.0014433854958042502,
0.0015498948050662875,
-0.007258519995957613,
0.005067436955869198,
-0.003640979528427124,
-0.009063485078513622,
0.0029837237671017647,
0.000602960994001478,
-0.00995431188493967,
0.002127646002918482,
-0.0018966824281960726,
0.008491484448313713,
-0.009652343578636646,
-0.004611498676240444,
-0.0031669759191572666,
-0.00461820513010025,
0.0024860322009772062,
0.00917612574994564,
0.0030631425324827433,
0.004249451216310263,
-0.0036634900607168674,
-0.007406912744045258,
0.00039045748417265713,
-0.002204420045018196,
0.002069082111120224,
0.006852687802165747,
0.005614006891846657,
-0.011096306145191193,
0.00010644349094945937,
0.0027465373277664185,
0.0028450959362089634,
-0.0008097254321910441,
0.004447618033736944,
-0.00922080036252737,
0.005321137141436338,
-0.0007992222090251744,
0.0062562935054302216,
0.011604221537709236,
-0.0023384112864732742,
0.0005965330055914819,
0.000562077562790364,
0.0019072308205068111,
-0.00140537996776402,
0.007933910004794598,
0.008645368739962578,
-0.002930416725575924,
-0.004788150545209646,
0.0046552144922316074,
0.006257353816181421,
0.007953112944960594,
0.003952066879719496,
-0.0027298738714307547,
0.00044288134085945785,
-0.003997363615781069,
-0.005048161838203669,
0.00761217437684536,
-0.0022769153583794832,
0.0063278344459831715,
0.004021309316158295,
-0.010591654106974602,
-0.009883875958621502,
0.002390434965491295,
-0.006694307550787926,
0.00018703231762629002,
0.011716154403984547,
0.012687411159276962,
-0.00533500500023365,
0.0033544234465807676,
-0.010559219866991043,
0.0004905276000499725,
0.009011827409267426,
0.002323259599506855,
-0.012120437808334827,
-0.9620188474655151,
0.00830227043479681,
0.0030031930655241013,
-0.0011537340469658375,
0.005832069553434849,
0.0016251555643975735,
0.004224093165248632,
0.00601407652720809,
0.016006305813789368,
-0.0069684856571257114,
-0.006289594806730747,
-0.00967301707714796,
-0.009797106496989727,
-0.0020979177206754684,
-0.006092153489589691,
-0.00308460951782763,
-0.005572244059294462,
-0.004452961962670088,
-0.0037155093159526587,
-0.0018128941301256418,
-0.003378757741302252,
0.007452084217220545,
0.0007435244624502957,
0.00437708105891943,
0.0010391053510829806,
0.002735426649451256,
-0.005550635978579521,
-0.0025162198580801487,
-0.0031728199683129787,
-0.003169165225699544,
-0.0031881893519312143,
-0.014325476251542568,
-0.0027986762579530478,
-0.001698687905445695,
0.00825200043618679,
0.002706935629248619,
0.007383350282907486,
-0.0023783864453434944,
0.0017902441322803497,
-0.008904836140573025,
0.0056411270052194595,
-0.0010542060481384397,
0.0024650602135807276,
-0.03114921972155571,
-0.0011555011151358485,
0.0007990548037923872,
-0.006729454267770052,
0.0061263772659003735,
-0.00009616018360247836,
-0.0003533232375048101,
-0.0024712146259844303,
-0.005269563291221857,
0.007829710841178894,
-0.007078621536493301,
0.004545875824987888,
-0.003813376883044839,
-0.00827797967940569,
-0.0019156653434038162,
-0.007640460506081581,
0.0005927159218117595,
0.005226754583418369,
-0.0038131456822156906,
-0.0032037983182817698,
-0.004128170665353537,
0.0024041524156928062,
0.004130960907787085,
0.001847987761721015,
-0.01851765438914299,
-0.007093220017850399,
0.0013921530917286873,
-0.0006265548872761428,
-0.004304289352148771,
-0.0034020442981272936,
0.004324361216276884,
-0.008485063910484314,
0.006625464651733637,
0.0023911588359624147,
-0.0019060892518609762,
-0.011877737008035183,
-0.000861702545080334,
-0.007766277529299259,
-0.0074782418087124825,
0.0013740911381319165,
-0.004176640417426825,
-0.005870525259524584,
-0.00045824304106645286,
-0.0005948835168965161,
0.007276325020939112,
-0.0021212794817984104,
0.004208386410027742,
0.011769079603254795,
-0.0014060981338843703,
-0.007072427775710821,
0.0045662447810173035,
0.006958510261029005,
0.0015339250676333904,
-0.002005587564781308,
0.0037511775735765696,
0.007316885516047478,
0.0080675994977355,
0.0025137776974588633,
0.004778746515512466,
0.00007038416515570134,
0.01101183332502842,
-0.002187668113037944,
0.00016882832278497517,
-0.004682355094701052,
-0.0010797472205013037,
-0.0038612319622188807,
-0.00021125984494574368,
-0.005428318865597248,
-0.001685868133790791,
-0.014634639024734497,
-0.007946710102260113,
0.000013023257452005055,
-0.0014972648350521922,
0.003441688371822238,
-0.004290246404707432,
-0.0018410610500723124,
0.003141307272017002,
0.006850218400359154,
0.002119639655575156,
-0.0009223928791470826,
-0.0017657226417213678,
0.0005275765433907509,
-0.002656335011124611,
0.013243020512163639,
-0.012173904106020927,
0.0075112865306437016,
-0.000687495106831193,
-0.014247425831854343,
0.007906495593488216,
0.01096514705568552,
-0.007786523550748825,
0.002180602867156267,
0.00382588105276227,
0.0027165026403963566,
-0.0011541990097612143,
-0.004469382110983133,
-0.004189868923276663,
-0.015690410509705544,
0.0014241058379411697,
0.019039010629057884,
0.0003603555087465793,
0.009159351699054241,
0.009744768030941486,
-0.0024081189185380936,
0.0005740615306422114,
0.007013912778347731,
0.001747253118082881,
0.011615293100476265,
-0.006332583259791136,
-0.0022287622559815645,
0.0029382752254605293,
-0.008851093240082264,
0.0010022087953984737,
0.005787307396531105,
0.005122997332364321,
-0.0021683562081307173,
0.0008945048321038485,
-0.007498706225305796,
-0.005718196276575327,
-0.016241462901234627,
-0.006033412646502256,
0.004274067934602499,
-0.0051369620487093925,
0.005701906979084015,
-0.013486925512552261,
0.004917520564049482,
0.005330704618245363,
0.0056275418028235435,
-0.0008820598595775664,
0.0016698772087693214,
0.004782426171004772,
0.011607740074396133,
-0.0038759498856961727,
0.0003103336493950337,
0.0009228041162714362,
-0.0015034107491374016,
0.0005972878425382078,
0.008941642940044403,
-0.006704447790980339,
-0.005447832401841879,
0.003247652668505907,
0.003889600047841668,
0.0006801333511248231,
-0.0023704697377979755,
-0.00840112753212452,
-0.0030591024551540613,
0.0024267444387078285,
-0.006244734860956669,
0.0033631545957177877,
0.0005952288629487157,
0.002914522774517536,
-0.008322023786604404,
-0.0023695703130215406,
-0.003823251696303487,
-0.012582225725054741,
0.009614192880690098,
-0.001592561835423112,
0.0015822580317035317,
0.012463525868952274,
0.00515467906370759,
-0.01178091112524271,
0.004203651566058397,
0.009829132817685604,
-0.0022749516647309065,
0.005198535975068808,
0.005845393519848585,
-0.005316709168255329,
-0.020291008055210114,
-0.005696726031601429,
-0.01501520723104477,
0.003579659853130579,
-0.002016801154240966,
0.006308259908109903,
-0.008810952305793762,
0.005665800534188747,
0.006783283781260252,
-0.011702945455908775,
-0.006680321414023638,
-0.007375337183475494,
0.008772204630076885,
-0.0009664095123298466,
-0.0006111080292612314,
-0.002763523254543543,
0.0005899722455069423,
-0.0020482386462390423,
-0.005875429138541222,
-0.0020637814886868,
0.004915329162031412,
0.0030176667496562004,
-0.0014156914548948407,
0.002848799806088209,
-0.004868136718869209,
0.0021755164489150047,
0.0019958734046667814,
-0.010333449579775333,
0.0016133669996634126,
0.002928460482507944,
-0.002748611383140087,
-0.0019315351964905858,
0.000507963530253619,
-0.0015744530828669667,
-0.0075685507617890835,
-0.011233250610530376,
-0.0026597254909574986,
-0.003596485825255513,
-0.001999768428504467,
-0.010979965329170227,
-0.0025285487063229084,
-0.006815947126597166,
0.007527509238570929,
-0.006817347835749388,
0.008841942064464092,
0.004846278578042984,
-0.0035860224161297083,
0.007800594437867403,
-0.0017321263439953327,
0.0042585087940096855,
0.0024499320425093174,
0.002235154854133725,
0.0020555031951516867,
-0.0032342071644961834,
-0.012383409775793552,
0.012637373991310596,
-0.0065411594696342945,
0.0021134698763489723,
0.012445696629583836,
0.005134429316967726,
0.007189000956714153,
-0.004166848491877317,
-0.0007931140135042369,
0.0018566068029031157,
0.006794534623622894,
-0.013155506923794746,
0.0037516902666538954,
-0.005541870836168528,
-0.0005422570975497365,
0.003222714178264141,
-0.0032664493191987276,
0.0015352371847257018,
0.011086137033998966,
0.001571530825458467,
-0.007690500468015671,
-0.0022803659085184336,
0.0019968014676123857,
0.001320134848356247,
-0.012427762150764465,
0.0005532905925065279,
-0.0040169283747673035,
-0.003566731931641698,
-0.0011717489687725902,
-0.0007970287115313113,
0.0008187197963707149,
0.004490795079618692,
-0.000347628490999341,
0.005204027518630028,
0.003311916720122099,
-0.005934413522481918,
0.015580919571220875,
-0.0034073565620929003,
-0.002219283254817128,
0.0036068339832127094,
0.002519316505640745,
-0.0022870313841849566,
-0.005716813262552023,
-0.002101563848555088,
0.004026998300105333,
0.006985880900174379,
-0.0037262309342622757,
-0.002103676786646247,
-0.0010897102765738964,
0.0008165872422978282,
-0.012533757835626602,
0.0009581163176335394,
0.010039709508419037,
-0.004056320525705814,
0.005680555012077093,
-0.0023081544786691666,
-0.008976025506854057,
-0.012199409306049347,
0.05019422620534897,
0.0005853245966136456,
0.0023014117032289505,
0.001992012606933713,
-0.0067501612938940525,
-0.0016038870671764016,
-0.0011850895825773478,
0.008387521840631962,
-0.006858255248516798,
-0.008080399595201015,
0.007143427152186632,
-0.004155747592449188,
0.003731442615389824,
0.002288310555741191,
-0.0016624864656478167,
0.0123441806063056,
-0.0006282393587753177,
-0.014612967148423195,
-0.018707381561398506,
0.006766918580979109,
-0.005415871273726225,
-0.008155256509780884,
0.008372299373149872,
-0.0037566134706139565,
-0.004310427233576775,
0.0024219972547143698,
0.005558506585657597,
0.0014980984851717949,
-0.0010038507170975208,
-0.0013097123010084033,
-0.0027406644076108932,
-0.00024670138373039663,
0.001107104355469346,
0.005331439431756735,
0.007273710332810879,
-0.002240356057882309,
0.002765034092590213,
-0.0018709053983911872,
-0.0006548159290105104,
-0.0028054818976670504,
0.004854373633861542,
0.0067265694960951805,
-0.0025200715754181147,
-0.004433248657733202,
0.0036022744607180357,
0.00403145095333457,
0.0017987354658544064,
0.01142121385782957,
-0.0010397008154541254,
-0.00664928974583745,
0.006262348499149084,
0.008035900071263313,
0.0029702051542699337,
0.008121744729578495,
-0.0014808718115091324,
0.004727634135633707,
0.002423396334052086,
-0.010250313207507133,
-0.01727675087749958,
-0.0034367365296930075,
0.007117771077901125,
0.007512501906603575,
-0.0022434464190155268,
0.0016877606976777315,
-0.0042824349366128445,
-0.001771432813256979,
-0.008020374923944473,
-0.00687130494043231,
-0.004085539374500513,
0.0035071191377937794,
0.005238953046500683,
0.06717628240585327,
-0.0064700813964009285,
-0.0017836985643953085,
-0.008639436215162277,
-0.0014485577121376991,
-0.002565620932728052,
0.0005479151150211692,
0.002261077519506216,
0.0007410862017422915,
0.0014636191772297025,
-0.0005912631750106812,
-0.010496211238205433,
-0.011478656902909279,
-0.0007512043230235577,
0.003022158984094858,
-0.0030113982502371073,
0.0018003078876063228,
0.005845288746058941,
-0.010200068354606628,
0.0023543809074908495,
-0.01178327202796936,
-0.0010964741231873631,
-0.002924809232354164,
-0.011756723746657372,
-0.0036625349894165993,
-0.002855329541489482,
0.0059595596976578236,
0.005185351707041264,
0.005751722026616335,
-0.003489566035568714,
0.006039472762495279,
-0.0010435436852276325,
-0.0007071922882460058,
-0.006719420664012432,
-0.0008002277463674545,
-0.005086865741759539,
0.008224199526011944,
0.004130949731916189,
-0.010846053250133991,
-0.00536350067704916,
0.0005172538221813738,
0.001095555373467505,
-0.004521740134805441,
0.0027076529804617167,
-0.00029039543005637825,
0.0003856603871099651,
-0.002167831175029278,
-0.00036498025292530656,
-0.0074940575286746025,
0.0017364537343382835,
-0.01178575586527586,
0.008982800878584385,
-0.16252200305461884,
0.011341880075633526,
0.004015540238469839,
-0.005845286883413792,
-0.0034451407846063375,
-0.015191330574452877,
-0.0028171648737043142,
0.004511442966759205,
0.009598419070243835,
0.001572132809087634,
-0.0016603418625891209,
-0.000703233468811959,
0.005622263066470623,
0.002183447126299143,
-0.0021436610259115696,
-0.004589579533785582,
0.002148138592019677,
-0.0048036579973995686,
-0.0004932711599394679,
0.0030529082287102938,
0.0031640001107007265,
0.008537841960787773,
0.00033709409763105214,
0.0019027042435482144,
-0.0021955135744065046,
-0.002899979008361697,
0.004566289484500885,
-0.0013236254453659058,
0.003830943489447236,
-0.01188044622540474,
-0.002108061220496893,
-0.0049961223267018795,
-0.004809881094843149,
0.0002484632714185864,
0.007005530409514904,
0.0009714254993014038,
0.010075070895254612,
0.0021850825287401676,
-0.0054077585227787495,
0.009000245481729507,
-0.007002333644777536,
0.025325030088424683,
0.004255721811205149,
0.005874686874449253,
0.00040720863034948707,
-0.008561259135603905,
-0.005825836211442947,
0.009802883490920067,
0.0005012803594581783,
0.009459633380174637,
-0.01375424861907959,
0.0002695455332286656,
0.004328558687120676,
0.019421853125095367,
-0.007144308649003506,
-0.010405122302472591,
-0.0063297441229224205,
-0.002127293264493346,
-0.0013954442692920566,
0.009741357527673244,
0.012301734648644924,
-0.0031238957308232784,
0.009449298493564129,
-0.0036956004332751036,
-0.01841730996966362,
0.003114508232101798,
-0.003887877333909273,
-0.005963417701423168,
0.0020403119269758463,
0.006890690419822931,
0.007456767372786999,
0.0007177821244113147,
0.0015979417366907,
-0.00011939333489863202,
0.00519979652017355,
0.001398645807057619,
0.006711906753480434,
-0.0005872133770026267,
0.006709227804094553,
-0.008716639131307602,
0.006368722766637802,
-0.010588590055704117,
-0.0024632250424474478,
0.004807497374713421,
-0.004610132426023483,
0.010816428810358047,
0.003771738847717643,
-0.0014041583053767681,
-0.0018613316351547837,
-0.008745765313506126,
-0.0028681238181889057,
0.0020030210725963116,
0.002486846409738064,
-0.008457298390567303,
0.002884284593164921,
0.001799257006496191,
0.005786662455648184,
0.006161993835121393,
-0.011363127268850803,
0.006144274026155472,
0.00596627127379179,
-0.005039173178374767,
0.0014980024425312877,
-0.004459454212337732,
0.0025453518610447645,
0.004764148965477943,
-0.005228795576840639,
-0.0043994830921292305,
0.0025778878480196,
-0.005793629679828882,
-0.006773173809051514,
0.006374078337103128,
-0.008278955705463886,
-0.009315906092524529,
-0.003245083848014474,
-0.009852688759565353,
0.00014911562902852893
] |
8a69e368874ca389ea7a44e379f62b44b8a60c98 | 4,411 | py | Python | iap/validate_jwt.py | spitfire55/python-docs-samples | b8fe0d1c5c9f7f5d27965fa3367117af7b1f0aed | [
"Apache-2.0"
] | 4 | 2018-12-23T18:17:14.000Z | 2020-01-05T19:13:58.000Z | iap/validate_jwt.py | spitfire55/python-docs-samples | b8fe0d1c5c9f7f5d27965fa3367117af7b1f0aed | [
"Apache-2.0"
] | 16 | 2019-06-15T00:02:56.000Z | 2021-03-25T23:22:38.000Z | iap/validate_jwt.py | spitfire55/python-docs-samples | b8fe0d1c5c9f7f5d27965fa3367117af7b1f0aed | [
"Apache-2.0"
] | 4 | 2018-06-03T14:43:25.000Z | 2019-11-24T04:05:18.000Z | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Sample showing how to validate the Identity-Aware Proxy (IAP) JWT.
This code should be used by applications in Google Compute Engine-based
environments (such as Google App Engine flexible environment, Google
Compute Engine, or Google Container Engine) to provide an extra layer
of assurance that a request was authorized by IAP.
For applications running in the App Engine standard environment, use
App Engine's Users API instead.
"""
# [START iap_validate_jwt]
import jwt
import requests
def validate_iap_jwt_from_app_engine(iap_jwt, cloud_project_number,
cloud_project_id):
"""Validate a JWT passed to your App Engine app by Identity-Aware Proxy.
Args:
iap_jwt: The contents of the X-Goog-IAP-JWT-Assertion header.
cloud_project_number: The project *number* for your Google Cloud project.
This is returned by 'gcloud projects describe $PROJECT_ID', or
in the Project Info card in Cloud Console.
cloud_project_id: The project *ID* for your Google Cloud project.
Returns:
(user_id, user_email, error_str).
"""
expected_audience = '/projects/{}/apps/{}'.format(
cloud_project_number, cloud_project_id)
return _validate_iap_jwt(iap_jwt, expected_audience)
def validate_iap_jwt_from_compute_engine(iap_jwt, cloud_project_number,
backend_service_id):
"""Validate an IAP JWT for your (Compute|Container) Engine service.
Args:
iap_jwt: The contents of the X-Goog-IAP-JWT-Assertion header.
cloud_project_number: The project *number* for your Google Cloud project.
This is returned by 'gcloud projects describe $PROJECT_ID', or
in the Project Info card in Cloud Console.
backend_service_id: The ID of the backend service used to access the
application. See
https://cloud.google.com/iap/docs/signed-headers-howto
for details on how to get this value.
Returns:
(user_id, user_email, error_str).
"""
expected_audience = '/projects/{}/global/backendServices/{}'.format(
cloud_project_number, backend_service_id)
return _validate_iap_jwt(iap_jwt, expected_audience)
def _validate_iap_jwt(iap_jwt, expected_audience):
try:
key_id = jwt.get_unverified_header(iap_jwt).get('kid')
if not key_id:
return (None, None, '**ERROR: no key ID**')
key = get_iap_key(key_id)
decoded_jwt = jwt.decode(
iap_jwt, key,
algorithms=['ES256'],
audience=expected_audience)
return (decoded_jwt['sub'], decoded_jwt['email'], '')
except (jwt.exceptions.InvalidTokenError,
requests.exceptions.RequestException) as e:
return (None, None, '**ERROR: JWT validation error {}**'.format(e))
def get_iap_key(key_id):
"""Retrieves a public key from the list published by Identity-Aware Proxy,
re-fetching the key file if necessary.
"""
key_cache = get_iap_key.key_cache
key = key_cache.get(key_id)
if not key:
# Re-fetch the key file.
resp = requests.get(
'https://www.gstatic.com/iap/verify/public_key')
if resp.status_code != 200:
raise Exception(
'Unable to fetch IAP keys: {} / {} / {}'.format(
resp.status_code, resp.headers, resp.text))
key_cache = resp.json()
get_iap_key.key_cache = key_cache
key = key_cache.get(key_id)
if not key:
raise Exception('Key {!r} not found'.format(key_id))
return key
# Used to cache the Identity-Aware Proxy public keys. This code only
# refetches the file when a JWT is signed with a key not present in
# this cache.
get_iap_key.key_cache = {}
# [END iap_validate_jwt]
| 38.692982 | 79 | 0.682838 | 0 | 0 | [
-0.02149192988872528,
0.027861451730132103,
-0.020577652379870415,
-0.007743396796286106,
-0.012776858173310757,
0.034168828278779984,
-0.0363372303545475,
0.011778412386775017,
-0.03455903008580208,
0.009068428538739681,
-0.011540855281054974,
0.047870930284261703,
-0.009841540828347206,
0.02806672267615795,
-0.001993313431739807,
-0.01830260269343853,
-0.02087138406932354,
0.02898341789841652,
0.0127320671454072,
-0.035834599286317825,
-0.007952449843287468,
0.01000311877578497,
-0.010729664005339146,
-0.015335209667682648,
0.049377281218767166,
0.0739964097738266,
0.013339536264538765,
0.02020575851202011,
-0.031690698117017746,
-0.008292274549603462,
-0.024516653269529343,
-0.027079854160547256,
0.0073668500408530235,
-0.05191662535071373,
-0.020112743601202965,
0.024107368662953377,
-0.01320721860975027,
-0.059171922504901886,
0.03894919157028198,
0.011166111566126347,
-0.04481220617890358,
-0.024181338027119637,
0.030770689249038696,
-0.010652274824678898,
0.038870736956596375,
0.021776629611849785,
0.01430710218846798,
0.0318080298602581,
-0.028875092044472694,
-0.01561212819069624,
-0.028442347422242165,
0.02758176065981388,
-0.011812768876552582,
-0.05326157435774803,
-0.03498189151287079,
-0.0350349135696888,
0.021492037922143936,
0.024663623422384262,
0.010421749204397202,
0.014336367137730122,
-0.037903111428022385,
0.023488355800509453,
0.036099471151828766,
-0.011084793135523796,
0.05149742588400841,
0.01664697751402855,
-0.013031148351728916,
0.0041153570637106895,
-0.08849736303091049,
0.000600675935856998,
0.0069478475488722324,
0.03402719274163246,
-0.014875906519591808,
0.055508166551589966,
0.05236516147851944,
0.0004963126848451793,
0.010141599923372269,
-0.020826470106840134,
-0.01844596117734909,
0.03242136165499687,
-0.016261771321296692,
0.06778639554977417,
0.016720805317163467,
0.02645169384777546,
-0.02813633345067501,
-0.000452708249213174,
-0.00681632524356246,
-0.03305773809552193,
0.028382550925016403,
0.012515455484390259,
0.008929872885346413,
0.026474157348275185,
-0.012023755349218845,
0.00872800312936306,
-0.033728279173374176,
-0.03008485957980156,
0.0007880553021095693,
0.0021287817507982254,
-0.010314649902284145,
0.00834228191524744,
-0.013355512171983719,
-0.02913028374314308,
0.014196104370057583,
0.013987354002892971,
-0.042229730635881424,
-0.005883789621293545,
-0.06296663731336594,
-0.0047993832267820835,
0.003635117318481207,
-0.018899988383054733,
-0.02630622126162052,
0.014445430599153042,
0.010943926870822906,
-0.004337669815868139,
0.0017730683321133256,
-0.017351986840367317,
0.009662558324635029,
0.029924608767032623,
0.006646671332418919,
0.045901037752628326,
-0.01244188379496336,
-0.03710198402404785,
0.04606335610151291,
-0.03612975776195526,
-0.014384380541741848,
0.07334998995065689,
-0.014537910930812359,
-0.02805374376475811,
-0.03618808090686798,
0.03479640930891037,
-0.013712874613702297,
0.0049665989354252815,
0.03125689551234245,
0.02698863483965397,
0.05610097572207451,
-0.03182760998606682,
0.009959367103874683,
0.05741552263498306,
-0.05123183876276016,
0.05786849558353424,
0.04734756425023079,
-0.04656270146369934,
-0.00933975912630558,
-0.028772780671715736,
0.021246837452054024,
0.0026808527763932943,
-0.007047347724437714,
-0.012926111929118633,
-0.0011103330180048943,
-0.005223393905907869,
-0.0013496889732778072,
-0.014991075731813908,
-0.017100412398576736,
0.019645260646939278,
-0.008406846784055233,
0.05185149237513542,
-0.035004764795303345,
-0.04642469063401222,
-0.03516942262649536,
0.042277391999959946,
-0.026298360899090767,
-0.0007666292367503047,
-0.0011254092678427696,
0.02904665283858776,
0.017870763316750526,
-0.002064259722828865,
-0.012010452337563038,
-0.009587998501956463,
-0.002580090658739209,
0.06430015712976456,
0.03932606801390648,
-0.008841661736369133,
0.0016009063692763448,
-0.020458627492189407,
-0.03309692442417145,
0.004870979581028223,
0.03768966719508171,
-0.02935618907213211,
-0.01355340238660574,
-0.04953649640083313,
0.010119794867932796,
-0.048355355858802795,
0.002656286582350731,
0.03804599866271019,
0.0030158450827002525,
-0.049376096576452255,
-0.06050116568803787,
-0.047864802181720734,
0.010311726480722427,
-0.020518844947218895,
-0.014092172496020794,
-0.019574524834752083,
-0.01959674060344696,
-0.0016885659424588084,
0.050588659942150116,
0.011233450844883919,
0.034335847944021225,
-0.04316306486725807,
-0.011198942549526691,
0.005774793680757284,
0.0010264060692861676,
-0.00124062760733068,
0.0023639912251383066,
0.018407978117465973,
-0.01977403834462166,
0.006178985815495253,
-0.6383781433105469,
0.01605948619544506,
-0.0546257346868515,
-0.011502781882882118,
0.02794254943728447,
0.004790537524968386,
-0.041892990469932556,
-0.007033625617623329,
-0.022541383281350136,
0.03343149274587631,
0.010545059107244015,
0.0002543882583267987,
-0.03583846986293793,
0.007837535813450813,
0.030105745419859886,
-0.029659273102879524,
0.04048394039273262,
-0.014273008331656456,
-0.01132962480187416,
0.006523012183606625,
0.005507809109985828,
-0.04481778293848038,
0.0008300633053295314,
0.026458382606506348,
0.0331769697368145,
-0.002520614070817828,
0.009347342886030674,
-0.031377676874399185,
0.0009857722325250506,
0.00826509203761816,
0.048309311270713806,
0.006262872368097305,
-0.009131628088653088,
0.000009141876034846064,
0.03952115774154663,
0.008955186232924461,
0.060147181153297424,
-0.021090025082230568,
-0.038947202265262604,
-0.025378981605172157,
0.03670739755034447,
-0.016895638778805733,
0.022437946870923042,
-0.04518803581595421,
-0.06297499686479568,
0.007585970219224691,
-0.059688031673431396,
-0.01711711846292019,
-0.023990968242287636,
0.014164673164486885,
-0.00895354337990284,
0.013965270482003689,
0.013052783906459808,
-0.013353897258639336,
-0.06241568922996521,
0.05546478554606438,
-0.029890062287449837,
-0.06704588979482651,
0.009131471626460552,
-0.020531712099909782,
0.019561180844902992,
0.022718263790011406,
-0.022807415574789047,
0.017091838642954826,
-0.007555673830211163,
-0.01046802382916212,
0.020913520827889442,
-0.022179877385497093,
-0.010137843899428844,
0.046233076602220535,
-0.03532302752137184,
0.04457453638315201,
-0.039678335189819336,
0.07578568160533905,
0.00802988838404417,
-0.03403012081980705,
-0.03636947646737099,
0.009861706756055355,
-0.037781160324811935,
0.03033193200826645,
0.0018286958802491426,
0.006328894756734371,
-0.01030748337507248,
0.029597140848636627,
0.019541742280125618,
-0.0054891533218324184,
0.002158741932362318,
-0.027246281504631042,
-0.00495590316131711,
0.006926138885319233,
0.01911879889667034,
0.01730830781161785,
0.019966628402471542,
0.035097818821668625,
-0.0015966062201187015,
0.04104755073785782,
0.030206792056560516,
0.0873517170548439,
0.005052689462900162,
-0.013462899252772331,
-0.023684203624725342,
0.0021835470106452703,
0.006709876470267773,
0.047714293003082275,
-0.012006492353975773,
0.01729975827038288,
-0.01954025961458683,
-0.025989973917603493,
0.03750475496053696,
-0.03973568603396416,
0.008494972251355648,
-0.01604410633444786,
-0.02629239112138748,
0.01230865903198719,
-0.0321037657558918,
0.004171350505203009,
-0.006637305021286011,
-0.03316882252693176,
0.013161559589207172,
-0.020656147971749306,
-0.031279467046260834,
0.016444483771920204,
0.0030218265019357204,
0.00567765673622489,
-0.004831914324313402,
-0.010543687269091606,
-0.03695802390575409,
0.05214696004986763,
-0.023117752745747566,
-0.016521725803613663,
-0.006321266759186983,
-0.0022442094050347805,
0.029755573719739914,
-0.023423632606863976,
-0.0186743326485157,
0.004257203079760075,
-0.023227939382195473,
-0.040478579699993134,
0.02022412233054638,
-0.0062224227003753185,
0.028365591540932655,
-0.01882130652666092,
-0.05479060485959053,
-0.04522452503442764,
0.02078399620950222,
-0.019105784595012665,
0.03992491587996483,
0.009432799182832241,
-0.004198011476546526,
0.028463294729590416,
-0.014035931788384914,
-0.008552460931241512,
0.022260218858718872,
0.009923912584781647,
0.005508887581527233,
-0.004090131726115942,
0.03276970237493515,
0.03174809738993645,
0.04845791682600975,
-0.01978776417672634,
0.00315912626683712,
-0.022541673853993416,
-0.0034934920258820057,
-0.011144064366817474,
0.012995678000152111,
-0.015431751497089863,
0.01567860133945942,
0.020198287442326546,
0.01522260345518589,
0.030507348477840424,
0.0404166541993618,
-0.02283904142677784,
0.01882048323750496,
-0.005661511793732643,
-0.030518485233187675,
-0.01729172095656395,
0.00927226897329092,
-0.060372550040483475,
0.07197948545217514,
0.02546117641031742,
-0.005215617828071117,
0.003155703889206052,
-0.009988024830818176,
0.014644342474639416,
-0.017753703519701958,
-0.004165776539593935,
-0.003961918875575066,
0.060055553913116455,
0.04516831785440445,
-0.006370564457029104,
-0.027306577190756798,
0.031606726348400116,
0.014144958928227425,
0.019996270537376404,
-0.020239097997546196,
-0.017173513770103455,
0.061035994440317154,
0.002067863242700696,
-0.029812078922986984,
-0.002757139503955841,
-0.005146860610693693,
0.02629072777926922,
0.033221788704395294,
0.0027805666904896498,
0.0005861549871042371,
0.022046338766813278,
0.019932735711336136,
-0.02669380232691765,
0.022950954735279083,
-0.0340493768453598,
0.06238511577248573,
-0.04445173218846321,
0.019436808302998543,
0.0019781640730798244,
-0.007732619531452656,
0.02073698863387108,
-0.022013414651155472,
0.0056684562005102634,
0.008297672495245934,
0.0013564146356657147,
-0.02912597730755806,
-0.02915952168405056,
0.016361771151423454,
0.0002735579037107527,
0.010505438782274723,
-0.02907348982989788,
-0.03477964922785759,
-0.006814942229539156,
-0.014260138384997845,
0.017140118405222893,
-0.013742604292929173,
0.04321666061878204,
-0.0035302795004099607,
-0.006067805457860231,
-0.00006356988160405308,
0.01611064374446869,
-0.043098703026771545,
-0.007324050646275282,
-0.042801424860954285,
0.01368819922208786,
-0.03961942717432976,
-0.02572285756468773,
-0.014836789108812809,
0.010580112226307392,
0.027341943234205246,
-0.009760726243257523,
0.01100152451545,
-0.016700221225619316,
-0.07002943754196167,
-0.01654903031885624,
-0.04460426792502403,
0.015749221667647362,
0.04264455288648605,
0.018952835351228714,
-0.019011329859495163,
0.03890075907111168,
0.001212993753142655,
0.009277991950511932,
0.015269205905497074,
-0.005274931434541941,
0.04266997426748276,
-0.002597041428089142,
0.029663540422916412,
0.027521615847945213,
-0.03614550456404686,
-0.01535425242036581,
-0.0005086452001705766,
-0.025209305807948112,
-0.0280273649841547,
0.014602242968976498,
-0.014916273765265942,
-0.060017991811037064,
0.021989619359374046,
0.018997536972165108,
-0.016846921294927597,
-0.009185276925563812,
-0.021719839423894882,
-0.00603015162050724,
0.02491290308535099,
0.01869998127222061,
-0.010688632726669312,
-0.005149371922016144,
0.03508784621953964,
0.016155926510691643,
0.0131640350446105,
0.02337273582816124,
0.010463954880833626,
0.024614566937088966,
-0.019238900393247604,
-0.03156144171953201,
-0.015336485579609871,
-0.011155539192259312,
-0.022483479231595993,
0.011069401167333126,
0.0010642653796821833,
0.011143075302243233,
-0.004284747410565615,
-0.037799254059791565,
0.053426384925842285,
-0.005281862802803516,
0.036014799028635025,
-0.015563461929559708,
-0.012168588116765022,
0.009582797065377235,
0.06398475915193558,
-0.008551780134439468,
0.03860543295741081,
-0.011227441020309925,
0.018727676942944527,
0.013280116021633148,
0.011055609211325645,
-0.018854394555091858,
0.003064636839553714,
-0.010545063763856888,
0.02977759577333927,
-0.019219644367694855,
0.061936598271131516,
0.027627263218164444,
0.012758616358041763,
0.017530616372823715,
-0.0468844473361969,
0.02643253281712532,
-0.051714103668928146,
-0.018820784986019135,
-0.016698088496923447,
-0.021600615233182907,
-0.07089120894670486,
-0.04515255615115166,
-0.03714672476053238,
0.012001239694654942,
-0.022433556616306305,
-0.04749761521816254,
-0.00513881491497159,
0.010832569561898708,
-0.013620000332593918,
-0.013674985617399216,
0.0159173421561718,
0.01672315038740635,
0.024292536079883575,
-0.031358037143945694,
0.03772043436765671,
-0.01659778691828251,
0.020694401115179062,
-0.04206187278032303,
0.029483461752533913,
0.003205567132681608,
0.03884097561240196,
0.00537193613126874,
0.006246710661798716,
0.05976768583059311,
-0.01060181763023138,
-0.011867760680615902,
0.008067715913057327,
0.014375057071447372,
0.0038719731383025646,
-0.0035245572216808796,
0.01656874641776085,
0.01191769540309906,
-0.007272692862898111,
-0.05004250258207321,
0.002851702505722642,
-0.002882130676880479,
-0.02627599984407425,
-0.007636026479303837,
0.021847844123840332,
0.017427507787942886,
0.03198057785630226,
0.0019097381737083197,
-0.007043787278234959,
0.04698922857642174,
-0.0041054324246943,
-0.004862240049988031,
0.02646738663315773,
-0.02413591556251049,
0.01764352060854435,
-0.013763906434178352,
0.013303330168128014,
-0.002626166446134448,
0.0062292758375406265,
0.005455839913338423,
-0.015367227606475353,
-0.019552340731024742,
0.032479047775268555,
0.028910858556628227,
0.054139766842126846,
-0.06796836107969284,
0.004529350437223911,
0.019341859966516495,
-0.010535608045756817,
-0.02057618834078312,
0.0055136955343186855,
0.0022918255999684334,
0.042086075991392136,
-0.03266102820634842,
-0.024075577035546303,
-0.019189877435564995,
0.003233253490179777,
-0.01663949526846409,
0.036593202501535416,
0.013312379829585552,
-0.013780388049781322,
0.013711168430745602,
-0.012428193353116512,
-0.04957751929759979,
0.0343705378472805,
0.007738975342363119,
0.05292957276105881,
-0.026855524629354477,
0.023367315530776978,
-0.024422980844974518,
-0.034633830189704895,
-0.0016298163682222366,
0.003404404269531369,
0.01656736433506012,
0.00353027181699872,
-0.008579988032579422,
-0.02491251565515995,
-0.003779966849833727,
0.003863183781504631,
0.04157111421227455,
-0.0022366843186318874,
0.03294540196657181,
0.04478829354047775,
0.013537471182644367,
-0.02025500498712063,
-0.03157658129930496,
-0.0052839913405478,
0.0023879348300397396,
0.04519558325409889,
-0.010765203274786472,
-0.011193600483238697,
0.027989860624074936,
-0.0023342377971857786,
0.016583187505602837,
0.028674233704805374,
-0.01324730459600687,
-0.024146733805537224,
0.005804500542581081,
-0.013715838082134724,
-0.006742219440639019,
0.008430576883256435,
0.01820613257586956,
-0.0037570118438452482,
0.01568743586540222,
-0.0030155996792018414,
0.012229585088789463,
0.009405363351106644,
0.01119890809059143,
-0.01947670616209507,
0.029723117128014565,
-0.04200223460793495,
-0.01571490988135338,
0.010987957008183002,
-0.020779456943273544,
0.003065223339945078,
-0.009852874092757702,
0.02160247415304184,
0.03595082089304924,
0.05852086469531059,
0.02308129146695137,
0.01944967545568943,
-0.03434323891997337,
-0.0473373606801033,
-0.026654748246073723,
0.009672533720731735,
-0.015765035524964333,
-0.0070786927826702595,
-0.0011721678311005235,
0.005897707771509886,
-0.00757998414337635,
0.04163698852062225,
-0.041040509939193726,
0.00920394342392683,
0.0046730791218578815,
-0.022595485672354698,
0.030786508694291115,
0.026445962488651276,
-0.008965660817921162,
0.029544152319431305,
0.043335262686014175,
0.007501338608562946,
0.027484320104122162,
0.009994360618293285,
0.04886265844106674,
-0.034652650356292725,
0.010478281415998936,
-0.008401083759963512,
0.05730598419904709,
-0.05809301137924194,
-0.021417222917079926,
-0.073354572057724,
-0.05511259660124779,
-0.03601214289665222,
-0.007846236228942871,
0.004114937502890825,
0.015831852331757545,
0.05048270523548126,
-0.042129844427108765,
-0.005779604893177748,
-0.029647808521986008,
0.02905496582388878,
-0.038708530366420746,
-0.04660642892122269,
-0.01752628944814205,
0.04538818821310997,
0.004609616473317146,
0.036113906651735306,
-0.02991456352174282,
-0.029654543846845627,
0.02869509346783161,
-0.027150150388479233,
0.03786876052618027,
-0.0005003844271413982,
-0.000573936034925282,
0.009668070822954178,
-0.009967289865016937,
-0.0021064477041363716,
-0.07999079674482346,
0.032630857080221176,
0.0036993024405092,
0.014082551933825016,
0.02352391555905342,
-0.009503448382019997,
-0.019379187375307083,
-0.009599646553397179,
0.011553787626326084,
0.014342005364596844,
-0.029745135456323624,
0.029130252078175545,
0.009083778597414494,
-0.016894519329071045,
0.03932248428463936,
-0.023820314556360245,
-0.008316314779222012,
-0.0021115655545145273,
-0.05520373955368996,
-0.022801468148827553,
0.06322108954191208,
-0.016014087945222855,
-0.007416881620883942,
-0.004319728352129459,
0.0043082525953650475,
0.0011432943865656853,
0.005872888490557671,
-0.029890168458223343,
0.011761391535401344,
0.003933312837034464,
-0.05418818071484566,
-0.002889150520786643,
-0.004199865274131298,
0.014936637133359909,
-0.05628955736756325,
-0.00898728147149086,
-0.0017985340673476458,
-0.02701723389327526,
-0.03298650309443474,
-0.0033073509112000465,
0.026003435254096985,
0.02248634211719036,
-0.0633305087685585,
-0.00017400828073732555,
0.008028305135667324
] |
8a6b4f25018fb455967003872eafa0810ca93675 | 1,995 | py | Python | examples/calc.py | manatlan/htag | cf085077adf04bec8a2b059497efedb210c59936 | [
"MIT"
] | 1 | 2022-03-12T09:42:13.000Z | 2022-03-12T09:42:13.000Z | examples/calc.py | manatlan/thag | 0c57a103a8dbdbf9e1f09c759f1c35c1c3eff359 | [
"MIT"
] | null | null | null | examples/calc.py | manatlan/thag | 0c57a103a8dbdbf9e1f09c759f1c35c1c3eff359 | [
"MIT"
] | null | null | null | import os,sys; sys.path.insert(0,os.path.dirname(os.path.dirname(__file__)))
from htag import Tag
"""
This example show you how to make a "Calc App"
(with physical buttons + keyboard events)
There is no work for rendering the layout ;-)
Can't be simpler !
"""
class Calc(Tag.div):
statics=[Tag.H.style("""
.mycalc *,button {font-size:2em;font-family: monospace}
""")]
def init(self):
self.txt=""
self.aff = Tag.Div(" ",_style="border:1px solid black")
self["class"]="mycalc"
self <= self.aff
self <= Tag.button("C", _onclick=self.bind( self.clean) )
self <= [Tag.button(i, _onclick=self.bind( self.press, i) ) for i in "0123456789+-x/."]
self <= Tag.button("=", _onclick=self.bind( self.compute ) )
#-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ with real keyboard
self["onkeyup"] = self.bind( self.presskey, b"event.key" )
def presskey(self,key):
if key in "0123456789+-*/.":
self.press(key)
elif key=="Enter":
self.compute()
elif key in ["Delete","Backspace"]:
self.clean()
#-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
def press(self,val):
self.txt += val
self.aff.set( self.txt )
def compute(self):
try:
self.txt = str(eval(self.txt.replace("x","*")))
self.aff.set( self.txt )
except:
self.txt = ""
self.aff.set( "Error" )
def clean(self):
self.txt=""
self.aff.set(" ")
if __name__=="__main__":
# import logging
# logging.basicConfig(format='[%(levelname)-5s] %(name)s: %(message)s',level=logging.DEBUG)
# logging.getLogger("htag.tag").setLevel( logging.INFO )
# and execute it in a pywebview instance
from htag.runners import *
# here is another runner, in a simple browser (thru ajax calls)
BrowserHTTP( Calc ).run()
# PyWebWiew( Calc ).run()
| 28.913043 | 96 | 0.543358 | 1 | 1.4271 | [
0.0021132775582373142,
0.02619367279112339,
0.007580379024147987,
0.0008446340216323733,
0.005111808888614178,
-0.001976636704057455,
-0.010026879608631134,
0.002495763823390007,
-0.007099346723407507,
0.0035271134693175554,
0.0032086821738630533,
0.005610160529613495,
0.00870801042765379,
-0.016909128054976463,
0.0006034423713572323,
0.015354462899267673,
-0.05096045508980751,
0.0030113467946648598,
-0.002853271085768938,
0.0017332978313788772,
-0.008385702036321163,
0.010945246554911137,
0.008676683530211449,
0.005110310390591621,
0.007210142444819212,
0.000148412145790644,
0.008599083870649338,
0.0030239992775022984,
-0.010316782630980015,
-0.008047239854931831,
-0.0021203351207077503,
-0.0008132243528962135,
-0.004374815616756678,
-0.00888217706233263,
0.005169663578271866,
-0.004504712764173746,
-0.0026466120034456253,
-0.021012749522924423,
0.012586642056703568,
-0.002787238685414195,
-0.006097047124058008,
-0.014390800148248672,
0.000988832674920559,
0.003560725599527359,
-0.009562826715409756,
0.00021935274708084762,
-0.004487745463848114,
0.003514706389978528,
-0.010961214080452919,
0.004028833005577326,
-0.009344080463051796,
0.004739734809845686,
0.013506321236491203,
0.0036408700980246067,
-0.0054924082942306995,
-0.007768314331769943,
0.012455441057682037,
-0.0005652523832395673,
-0.009491805918514729,
-0.001085049589164555,
-0.0029468159191310406,
-0.004015034064650536,
0.0037926046643406153,
0.0020748311653733253,
-0.01657266356050968,
-0.008214877918362617,
-0.005383335053920746,
0.004560742061585188,
-0.0008840346708893776,
0.004362704232335091,
0.001204183790832758,
-0.00040579421329312027,
0.007872924208641052,
0.003898169845342636,
0.004752083215862513,
-0.004240920301526785,
-0.001605816069059074,
0.0011068552266806364,
0.006481407675892115,
0.003542001126334071,
0.0050038862973451614,
-0.006119388155639172,
0.00650403555482626,
0.008660459890961647,
0.012724030762910843,
0.005571798887103796,
0.017827950417995453,
-0.01204600464552641,
0.04701537638902664,
0.006900464650243521,
-0.008413433097302914,
0.0020728253293782473,
-0.009122521616518497,
-0.0010836325818672776,
-0.004157579969614744,
-0.028579704463481903,
-0.000385678926249966,
-0.0048324656672775745,
0.0008457399089820683,
0.0019191907485947013,
0.0006505697383545339,
0.006411133799701929,
-0.0009014379465952516,
-0.002771778032183647,
-0.007932216860353947,
0.011827941983938217,
-0.008503437973558903,
-0.0031183846294879913,
0.006649324670433998,
0.00273535237647593,
-0.010321117006242275,
-0.0022526991087943316,
-0.00042847689474001527,
-0.013354294002056122,
0.0034511957783252,
0.0017316259909421206,
-0.005458695814013481,
0.05508562922477722,
-0.0009667915292084217,
0.0029979513492435217,
-0.0053076897747814655,
0.001719099935144186,
0.0006046570488251746,
0.006518313195556402,
0.009694979526102543,
-0.003101886482909322,
0.00908655021339655,
0.007731584366410971,
0.004100391641259193,
0.00941019132733345,
-0.0011576666729524732,
0.006303542759269476,
-0.003628665115684271,
-0.0010385733330622315,
0.0010332065867260098,
-0.007363711949437857,
0.006824324373155832,
-0.003259534714743495,
-0.0068713403306901455,
0.003950343932956457,
-0.002377991797402501,
-0.009067369624972343,
0.0015605140943080187,
-0.0035630990751087666,
0.002845398848876357,
-0.009264834225177765,
-0.002250415040180087,
-0.004523138515651226,
-0.0042303758673369884,
0.0015229862183332443,
0.009082208387553692,
0.0040866355411708355,
0.0032420940697193146,
-0.004584460519254208,
-0.009455005638301373,
-0.002490842714905739,
-0.004704405087977648,
0.0012719869846478105,
0.00836158636957407,
0.004598207771778107,
-0.010008158162236214,
-0.0011599123245105147,
0.0012548157246783376,
0.001568607403896749,
-0.0011720937909558415,
0.0038548018783330917,
-0.007916972041130066,
0.007174169644713402,
-0.0009470907971262932,
0.004986349493265152,
0.0111995292827487,
-0.0032527174334973097,
-0.0006174173904582858,
0.00037676014471799135,
0.002377582248300314,
-0.000638786586932838,
0.005471071694046259,
0.010361156426370144,
-0.0037282530684024096,
-0.003326714038848877,
0.006008671596646309,
0.005852143745869398,
0.007574864663183689,
0.0033463090658187866,
-0.0026978766545653343,
0.0023189468774944544,
-0.0048901294358074665,
-0.0027812218759208918,
0.007129188627004623,
-0.004834251012653112,
0.0066091022454202175,
0.005208808928728104,
-0.01308656670153141,
-0.007267118897289038,
-0.0011170429643243551,
-0.007852294482290745,
0.00016452641284558922,
0.014696567319333553,
0.013007291592657566,
-0.00438861595466733,
0.0030911737121641636,
-0.01072875875979662,
-0.0003320633841212839,
0.007364633493125439,
0.002730452222749591,
-0.01168875489383936,
-0.9582647085189819,
0.005070582032203674,
0.0035109047312289476,
-0.002060650149360299,
0.006807103753089905,
0.0032753306441009045,
0.002884293207898736,
0.003911297302693129,
0.014496106654405594,
-0.009463207796216011,
-0.006959437392652035,
-0.011119789443910122,
-0.011339988559484482,
-0.002664047759026289,
-0.006674428936094046,
-0.0035438660997897387,
-0.006808019708842039,
-0.006745000369846821,
-0.002900226740166545,
-0.0019214210333302617,
-0.0035197557881474495,
0.009326389990746975,
-0.0010999231599271297,
0.0043181865476071835,
0.0025081755593419075,
0.003059508977457881,
-0.006679170299321413,
-0.0018539190059527755,
-0.0002701248158700764,
-0.0024349663872271776,
-0.006092809606343508,
-0.012646818533539772,
-0.0061038765124976635,
0.0010365520138293505,
0.009234505705535412,
0.0028852487448602915,
0.008828255347907543,
-0.0008990673813968897,
0.0024863991420716047,
-0.009180308319628239,
0.003929431084543467,
0.0018865505699068308,
0.0016436101868748665,
-0.030787087976932526,
-0.00007197659579105675,
0.0013047842076048255,
-0.007822884246706963,
0.009495744481682777,
0.0003489888913463801,
-0.000806035881396383,
-0.002681141020730138,
-0.006117562297731638,
0.008544850163161755,
-0.0061652581207454205,
0.005221043713390827,
-0.0039891875348985195,
-0.007242671679705381,
-0.0015248116105794907,
-0.00896928459405899,
0.0009475135011598468,
0.0035626234021037817,
-0.003946784418076277,
-0.005038827657699585,
-0.0032733501866459846,
0.002806010190397501,
0.0022158317733556032,
0.0022445437498390675,
-0.018360847607254982,
-0.006193674169480801,
0.0015506345080211759,
0.00013912649592384696,
-0.0023976534139364958,
-0.005939861293882132,
0.003939671907573938,
-0.010044951923191547,
0.007121531292796135,
0.0013348623178899288,
0.0012214969610795379,
-0.012716403231024742,
-0.0009563473868183792,
-0.009273047558963299,
-0.00875855889171362,
0.002316712634637952,
-0.005120152607560158,
-0.004173314664512873,
0.001148234587162733,
0.0008260825998149812,
0.00713877659291029,
-0.0046281637623906136,
0.0020845490507781506,
0.012111806310713291,
-0.0017835894832387567,
-0.008224711753427982,
0.007118754088878632,
0.006560299079865217,
0.0007294461247511208,
-0.003614053362980485,
0.0043440815061330795,
0.007195934187620878,
0.008985241875052452,
0.0022895007859915495,
0.005224050488322973,
0.0007032066932879388,
0.010319518856704235,
-0.0010997395729646087,
0.001040819101035595,
-0.004125127103179693,
0.0002607186615932733,
-0.003120079170912504,
-0.0014247189974412322,
-0.002726631471887231,
-0.0016011950792744756,
-0.012206782586872578,
-0.010751593858003616,
-0.003381369635462761,
0.0011194262187927961,
0.0020380241330713034,
-0.004462019074708223,
-0.0005105814780108631,
0.0009387711761519313,
0.008521050214767456,
0.0027053444646298885,
-0.0036722717341035604,
-0.0006339540123008192,
0.003193404758349061,
-0.007903439924120903,
0.015093914233148098,
-0.012245383113622665,
0.007742086425423622,
-0.0004766813653986901,
-0.01589510217308998,
0.006838335655629635,
0.009636933915317059,
-0.008773737587034702,
0.0029728803783655167,
0.002821824047714472,
0.0029933613259345293,
-0.0003982611233368516,
-0.004522912669926882,
-0.0045039234682917595,
-0.017062244936823845,
0.00005433847036329098,
0.020499475300312042,
0.0012108947848901153,
0.008010877296328545,
0.01132834143936634,
-0.003809858812019229,
0.00191755429841578,
0.005038613453507423,
0.0009431458893232048,
0.01256449893116951,
-0.007262834347784519,
0.0009450321085751057,
0.0033266032114624977,
-0.004526166711002588,
0.0009094095439650118,
0.005618652328848839,
0.00724431499838829,
-0.0021235968451946974,
0.0019950252026319504,
-0.006518680136650801,
-0.005197103135287762,
-0.01716792955994606,
-0.003494641510769725,
0.006639203988015652,
-0.004573441110551357,
0.004580956418067217,
-0.013568304479122162,
0.004555426072329283,
0.007187040522694588,
0.0042832535691559315,
0.00011350053682690486,
0.0015246928669512272,
0.004602756816893816,
0.011807151138782501,
-0.005253499839454889,
-0.000044244734453968704,
0.0031481205951422453,
-0.0010072761215269566,
-0.0003556028241291642,
0.008758808486163616,
-0.006549635902047157,
-0.006878018844872713,
0.001456849160604179,
0.0053276922553777695,
-0.001415126956999302,
-0.004565984942018986,
-0.007099787704646587,
-0.00527598662301898,
0.003242149483412504,
-0.008648603223264217,
0.003260294208303094,
-0.0005318993935361505,
0.00373951462097466,
-0.00773830758407712,
-0.0012735138880088925,
-0.002155496971681714,
-0.013921760953962803,
0.010015302337706089,
-0.0014277189038693905,
0.0001203358915518038,
0.01143950130790472,
0.003935237880796194,
-0.012974079698324203,
0.005529128946363926,
0.00881967693567276,
-0.0047845374792814255,
0.005082278046756983,
0.005482540000230074,
-0.005635117646306753,
-0.021131621673703194,
-0.0024467662442475557,
-0.012559973634779453,
0.005251722410321236,
-0.0005204698536545038,
0.0047760275192558765,
-0.007940796203911304,
0.007590914145112038,
0.008736323565244675,
-0.01376213040202856,
-0.0049949027597904205,
-0.009713239967823029,
0.009168618358671665,
-0.00036007564631290734,
-0.00041091928142122924,
-0.0035148891620337963,
-0.00009691618470242247,
-0.000977254705503583,
-0.0039548068307340145,
-0.0012632430298253894,
0.005339873023331165,
0.0019550893921405077,
-0.00190867786295712,
0.00221584876999259,
-0.003492087824270129,
0.0006952030817046762,
0.0024324015248566866,
-0.009388898499310017,
0.0009084651246666908,
0.004922675900161266,
-0.0023273921106010675,
-0.0005682394257746637,
0.0022569464053958654,
-0.00008825596887618303,
-0.0070245591923594475,
-0.009620005264878273,
-0.002327257301658392,
-0.0048677437007427216,
-0.0023026990238577127,
-0.01248717401176691,
-0.0024323556572198868,
-0.010415863245725632,
0.006693103816360235,
-0.007016277406364679,
0.008284226059913635,
0.006518791429698467,
-0.005383786279708147,
0.005476815160363913,
-0.0034565713722258806,
0.0032776223961263895,
0.0034840810112655163,
0.005349403712898493,
0.00030524865724146366,
-0.006181619130074978,
-0.011136487126350403,
0.012556232511997223,
-0.008455412462353706,
0.0021240341011434793,
0.01425084751099348,
0.006975412834435701,
0.010518954135477543,
0.00048038826207630336,
-0.00003690970697789453,
0.0015904864994809031,
0.0071744960732758045,
-0.012095951475203037,
0.003424157155677676,
-0.004721019417047501,
-0.0016336709959432483,
0.004095467738807201,
-0.004740651696920395,
0.0015410683117806911,
0.009071900509297848,
0.0009303395636379719,
-0.006958865560591221,
-0.0014436005149036646,
0.00017472406034357846,
0.003590397536754608,
-0.013143332675099373,
0.0012937834253534675,
-0.0034154532477259636,
-0.005617106799036264,
-0.0023442183155566454,
-0.0031783096492290497,
-0.00034954037982970476,
0.004382968880236149,
-0.0024470302741974592,
0.006281524896621704,
0.0015414683148264885,
-0.0042938487604260445,
0.014827209524810314,
-0.004670004826039076,
-0.005697205197066069,
0.002323548309504986,
0.001946777105331421,
-0.002424469916149974,
-0.006879332475364208,
-0.0025793155655264854,
0.0033910961356014013,
0.006925962865352631,
-0.0024574026465415955,
-0.004775831010192633,
-0.0006382715073414147,
0.0012258175993338227,
-0.009417114779353142,
0.0024893388617783785,
0.01279019471257925,
-0.0061178309842944145,
0.005492427386343479,
-0.0013614330673590302,
-0.007325594313442707,
-0.014238573610782623,
0.054133087396621704,
-0.0008899367530830204,
0.003907846286892891,
0.004646810702979565,
-0.006151100620627403,
0.0007093239109963179,
-0.0017020463710650802,
0.007422915659844875,
-0.0068208263255655766,
-0.008431173861026764,
0.007440655026584864,
-0.0030090019572526217,
0.002901627216488123,
0.0027168989181518555,
-0.0005617309943772852,
0.017588218674063683,
-0.004275285638868809,
-0.016152461990714073,
-0.016436567530035973,
0.008321459405124187,
-0.003558805678039789,
-0.007389796897768974,
0.008977186866104603,
-0.0034358566626906395,
-0.004405553452670574,
0.002362394705414772,
0.007003509905189276,
-0.00037754533695988357,
0.0017610250506550074,
-0.002335116034373641,
-0.002202030271291733,
-0.0015630933921784163,
0.0016127198468893766,
0.004494387656450272,
0.008509681560099125,
-0.002808031626045704,
0.0027854754589498043,
-0.002200421877205372,
-0.0018125317292287946,
-0.001135325524955988,
0.004184895660728216,
0.008162171579897404,
-0.0013591378228738904,
-0.0032235789112746716,
0.004294798243790865,
0.004881585016846657,
0.0037148375995457172,
0.010492839850485325,
-0.00017881402163766325,
-0.005966552998870611,
0.008890554308891296,
0.008109408430755138,
-0.0012086214264854789,
0.010537409223616123,
-0.0015064716571941972,
0.007501282729208469,
0.0028028804808855057,
-0.007497294805943966,
-0.015135317109525204,
-0.0031281777191907167,
0.007339484058320522,
0.01023926679044962,
-0.0014558607945218682,
0.0022429998498409986,
-0.0024510647635906935,
-0.0021709264256060123,
-0.006046012509614229,
-0.008978075347840786,
-0.002794516272842884,
0.000775023247115314,
0.0038410676643252373,
0.07103163748979568,
-0.006293919403105974,
-0.0011283998610451818,
-0.009614960290491581,
-0.001138600637204945,
-0.0010397640289738774,
0.0004935054457746446,
0.0013469454133883119,
-0.0011121047427877784,
0.002107574138790369,
0.0012906723422929645,
-0.008619551546871662,
-0.012400737963616848,
0.00047421507770195603,
0.0029236809350550175,
-0.0010618814267218113,
0.0025023098569363356,
0.006969492416828871,
-0.009203673340380192,
0.00239507295191288,
-0.010501379147171974,
-0.00006207773549249396,
-0.0021926576737314463,
-0.010756157338619232,
-0.00423350790515542,
-0.003952589351683855,
0.004137211013585329,
0.004807467572391033,
0.005972344893962145,
-0.0032317296136170626,
0.005505846347659826,
-0.002289003226906061,
0.0007028679247014225,
-0.006312892772257328,
0.000522166839800775,
-0.006574275903403759,
0.006485230755060911,
0.003053872147575021,
-0.011240865103900433,
-0.00470574339851737,
-0.0007888476829975843,
-0.0007743486785329878,
-0.0062894378788769245,
0.0055839139968156815,
-0.0011174993123859167,
0.006162422709167004,
-0.003438628977164626,
0.002469101455062628,
-0.0072575584053993225,
0.00312515115365386,
-0.014110053889453411,
0.0033406740985810757,
-0.17380115389823914,
0.011031581088900566,
0.002955276984721422,
-0.007160753011703491,
-0.0025694393552839756,
-0.014357290230691433,
-0.006129894405603409,
0.0031720197293907404,
0.010858802124857903,
0.002916287863627076,
-0.0010332298697903752,
-0.00010547321289777756,
0.003358446527272463,
0.0047941990196704865,
-0.001599801704287529,
-0.00564557546749711,
0.0035561779513955116,
-0.005370365921407938,
0.0007735894760116935,
0.003782812273129821,
0.004626153502613306,
0.010094517841935158,
0.0003090719983447343,
0.0013819386949762702,
-0.00007556313357781619,
-0.005468156188726425,
0.006622736342251301,
-0.0016307781916111708,
0.004964746069163084,
-0.012161302380263805,
-0.0034991654101759195,
-0.004785290453583002,
-0.003848577383905649,
0.0012683679815381765,
0.0038078422658145428,
-0.0005637163994833827,
0.007736196741461754,
0.002705690683797002,
-0.007830538786947727,
0.008297130465507507,
-0.006912137381732464,
0.030897248536348343,
0.004705287516117096,
0.00835090409964323,
-0.00013605471758637577,
-0.004489542450755835,
-0.004783125128597021,
0.010889193043112755,
0.0011584425810724497,
0.013119020499289036,
-0.013719425536692142,
-0.0004301294102333486,
0.002264436101540923,
0.017576387152075768,
-0.0037523957435041666,
-0.010672989301383495,
-0.008077518083155155,
-0.003512215567752719,
0.002308779628947377,
0.009287339635193348,
0.011520525440573692,
-0.005279821343719959,
0.008288498967885971,
-0.0030775379855185747,
-0.021652303636074066,
0.002224813913926482,
-0.004906139802187681,
-0.004830438643693924,
0.0011839732760563493,
0.005894976202398539,
0.01068845298141241,
-0.00130201515275985,
0.001695886137895286,
-0.0005921197007410228,
0.004700142424553633,
-0.001292480737902224,
0.005869030486792326,
-0.003307587932795286,
0.005440337583422661,
-0.009312892332673073,
0.007989007979631424,
-0.009331551380455494,
-0.0011409320868551731,
0.003008997067809105,
-0.005365684162825346,
0.010651802644133568,
0.004309034440666437,
-0.0028622497338801622,
-0.0012404544977471232,
-0.011310278438031673,
-0.0021149595268070698,
0.0012724968837574124,
0.0019861706532537937,
-0.009678912349045277,
0.004517302382737398,
0.0004496946930885315,
0.005024458281695843,
0.005231564864516258,
-0.00923861376941204,
0.007251571398228407,
0.006287123542279005,
-0.00610803859308362,
0.0028552263975143433,
-0.00648269010707736,
0.0019022029591724277,
0.004666857421398163,
-0.007224946282804012,
-0.00685929786413908,
0.002591400872915983,
-0.0073569826781749725,
-0.006513375323265791,
0.006292713340371847,
-0.00901543814688921,
-0.00897276308387518,
-0.001885348348878324,
-0.011935378424823284,
0.0004471095453482121
] |
8a6c2e5a6d6baef647e0e3b1e7b605691b398cfe | 188 | py | Python | res/example1.py | tghira16/Giraphics | 74265c4c0220c677e0fa3e5e65fd0b7087401106 | [
"MIT"
] | 1 | 2021-03-24T10:09:57.000Z | 2021-03-24T10:09:57.000Z | res/example1.py | tghira16/Giraphics | 74265c4c0220c677e0fa3e5e65fd0b7087401106 | [
"MIT"
] | null | null | null | res/example1.py | tghira16/Giraphics | 74265c4c0220c677e0fa3e5e65fd0b7087401106 | [
"MIT"
] | null | null | null | from giraphics.graphing.graph import Graph
def func(x):
return (x-3)*(x+2)*x*0.2
g = Graph(800,600,8,6, 'example1.svg')
g.bg()
g.grid()
g.axes()
g.graph(func)
g.save()
g.display() | 12.533333 | 42 | 0.632979 | 1 | 0.7206 | [
0.0030099800787866116,
0.025678198784589767,
0.008320659399032593,
-0.0017033024923875928,
0.0061118402518332005,
-0.004210557788610458,
-0.009352329187095165,
0.000394880014937371,
-0.006012522149831057,
0.001452868222258985,
0.001279014046303928,
0.003738511586561799,
0.011919382028281689,
-0.016388991847634315,
0.0024767660070210695,
0.017662137746810913,
-0.055339567363262177,
0.0023825587704777718,
-0.0032144722063094378,
0.004064935725182295,
-0.010678202845156193,
0.010972564108669758,
0.006734550464898348,
0.008570481091737747,
0.005853717215359211,
0.001814778195694089,
0.007674431893974543,
0.005347121506929398,
-0.010343925096094608,
-0.006716462783515453,
-0.0022395921405404806,
-0.002613339340314269,
-0.0029198990669101477,
-0.009853502735495567,
0.007250734604895115,
-0.004402026068419218,
0.0011685916688293219,
-0.020543953403830528,
0.012756390497088432,
-0.006315058097243309,
-0.003488741349428892,
-0.015769440680742264,
0.00035537764779292047,
0.006503579672425985,
-0.011433538980782032,
0.0019089143024757504,
-0.004555569030344486,
0.0019425550708547235,
-0.010129778645932674,
0.003346933051943779,
-0.01344661507755518,
0.00043126108357682824,
0.013955692760646343,
-0.0007769166841171682,
-0.004320018924772739,
-0.008237877860665321,
0.011058129370212555,
-0.0003384217561688274,
-0.012656862847507,
-0.0009904531762003899,
-0.0023093437775969505,
-0.0020287621300667524,
0.0016057260800153017,
0.002804886782541871,
-0.016536643728613853,
-0.008463256992399693,
-0.005956999957561493,
0.003315497888252139,
-0.002718108706176281,
0.0055540213361382484,
0.002081639366224408,
0.0014061725232750177,
0.0070952861569821835,
0.00047840585466474295,
0.003777039237320423,
-0.0058055962435901165,
-0.0013341392623260617,
0.0028098425827920437,
0.004981283564120531,
0.0038076003547757864,
0.00472790515050292,
-0.008111008442938328,
0.004008473362773657,
0.0145945455878973,
0.011127752251923084,
0.009682542644441128,
0.015382819809019566,
-0.012325537391006947,
0.041953399777412415,
0.008873609825968742,
-0.010366956703364849,
0.0018129487289115787,
-0.009314555674791336,
-0.00519607262685895,
-0.0019453107379376888,
-0.03167920559644699,
-0.0006125633371993899,
-0.0031512081623077393,
0.001067566336132586,
0.0019402250181883574,
0.00290109496563673,
0.0075391423888504505,
-0.0009846014436334372,
-0.003927389159798622,
-0.00977387186139822,
0.011397191323339939,
-0.010432475246489048,
-0.0032918378710746765,
0.013203326612710953,
0.0032348453532904387,
-0.010898620821535587,
-0.003218259196728468,
0.0026418392080813646,
-0.01324137207120657,
0.004938722122460604,
0.002611540723592043,
-0.007601361256092787,
0.05864567682147026,
0.00006723192927893251,
-0.0004094603646080941,
-0.0050410679541528225,
-0.005190670490264893,
0.003294228343293071,
0.01052777748554945,
0.01082234364002943,
-0.004158906638622284,
0.013409554958343506,
0.00915283989161253,
0.00480104424059391,
0.007416873704642057,
0.001600464340299368,
0.006633011158555746,
-0.003117657033726573,
-0.00141775025986135,
0.0009504570625722408,
-0.008622892200946808,
0.009011615067720413,
-0.002082517370581627,
-0.007212859578430653,
0.0034168229904025793,
-0.001462783431634307,
-0.015414485707879066,
0.002081570215523243,
-0.003803070867434144,
0.003091283841058612,
-0.009673572145402431,
-0.002330418908968568,
-0.004685097839683294,
-0.002146142767742276,
0.0015722032403573394,
0.008281080052256584,
0.00410839356482029,
0.002642995212227106,
-0.005370061378926039,
-0.009584146551787853,
-0.0022804588079452515,
-0.007995321415364742,
0.0031111023854464293,
0.010143532417714596,
0.00377124035730958,
-0.007940422743558884,
-0.0009511817479506135,
0.0030794721096754074,
0.004651515278965235,
-0.0009466352639719844,
0.0011131484061479568,
-0.007343219593167305,
0.011985233053565025,
-0.00045802860404364765,
0.0033901301212608814,
0.015201360918581486,
-0.006082072854042053,
0.0014269453240558505,
-0.0011725847143679857,
0.0036024812143296003,
0.0010414380813017488,
0.003913693595677614,
0.010463280603289604,
-0.002778278663754463,
-0.00355217675678432,
0.009523484855890274,
0.0032763476483523846,
0.009462520480155945,
0.004615137353539467,
-0.0016076283063739538,
0.0013212136691436172,
-0.0029513780027627945,
-0.0005694129504263401,
0.007133769802749157,
-0.0037166124675422907,
0.00859361793845892,
0.006306827533990145,
-0.016481563448905945,
-0.007754098623991013,
-0.001783245475962758,
-0.00996280089020729,
0.0009450839133933187,
0.01748528704047203,
0.010962123982608318,
-0.002673060167580843,
0.003440138651058078,
-0.014567193575203419,
-0.0023959865793585777,
0.006435299292206764,
-0.00004901397551293485,
-0.012945102527737617,
-0.9539511203765869,
0.0028858862351626158,
0.005131272133439779,
-0.0004080178332515061,
0.005279397591948509,
0.0037870113737881184,
0.0008984011365100741,
0.004444777965545654,
0.012482201680541039,
-0.01055883802473545,
-0.0071782697923481464,
-0.012235273607075214,
-0.01076123770326376,
-0.0010521564399823546,
-0.005983376409858465,
-0.006416110787540674,
-0.005249497480690479,
-0.00790775753557682,
-0.0016797535354271531,
-0.0038092948962002993,
-0.0025450452230870724,
0.011694357730448246,
0.0005898387171328068,
0.0020577514078468084,
0.004336030688136816,
0.0053277467377483845,
-0.003804640844464302,
-0.0014629795914515853,
-0.00017115760419983417,
-0.0038641043938696384,
-0.005929020699113607,
-0.014208562672138214,
-0.005761578679084778,
-0.0016740348655730486,
0.012768623419106007,
-0.00046207921695895493,
0.008600161410868168,
-0.002740969182923436,
0.002907214919105172,
-0.006986041087657213,
0.00560365803539753,
0.003606343176215887,
0.0012685017427429557,
-0.03162040561437607,
-0.0021802070550620556,
-0.0005678967572748661,
-0.006749780382961035,
0.01115476619452238,
0.002186923287808895,
-0.0010675480589270592,
-0.004396701231598854,
-0.0039786905981600285,
0.009741594083607197,
-0.007267777808010578,
0.0038096916396170855,
-0.003890238469466567,
-0.005013721063733101,
-0.0030046470928937197,
-0.009426317177712917,
0.000753314234316349,
0.0024925600737333298,
-0.0035536028444767,
-0.00304389582015574,
-0.002435453236103058,
0.00362765952013433,
0.0003192407020833343,
-0.00038340274477377534,
-0.018398625776171684,
-0.006953306961804628,
0.0009490509983152151,
0.002178056165575981,
0.0030397383961826563,
-0.005057118367403746,
0.000009850455171545036,
-0.01239389181137085,
0.0041203573346138,
-0.0005849439185112715,
0.002938398625701666,
-0.01248819287866354,
-0.0025828841608017683,
-0.009210135787725449,
-0.010367515496909618,
0.004304016474634409,
-0.003837144933640957,
-0.002050775336101651,
0.0016044658841565251,
0.002044428838416934,
0.007311578840017319,
-0.007925705052912235,
0.0012917486019432545,
0.013811974786221981,
-0.0017147113103419542,
-0.010219451040029526,
0.007693275809288025,
0.006268524099141359,
0.0031603898387402296,
-0.004079334903508425,
0.003996285144239664,
0.007874968461692333,
0.01005223672837019,
0.0002946520398836583,
0.0066502210684120655,
0.0003084341005887836,
0.014744785614311695,
0.0008361535728909075,
-0.0011377115733921528,
-0.005152872297912836,
-0.0014960227999836206,
-0.0027545499615371227,
-0.0026115160435438156,
-0.0026843082159757614,
0.0018352753249928355,
-0.010193051770329475,
-0.010112482123076916,
-0.0035057440400123596,
0.0028955568559467793,
-0.0015389460604637861,
-0.0038293523248285055,
-0.00006672486779280007,
-0.0007449646363966167,
0.009572007693350315,
-0.00030089146457612514,
-0.007788278162479401,
0.0013552799355238676,
-0.0013992212479934096,
-0.00757640739902854,
0.016825426369905472,
-0.011744998395442963,
0.007494618650525808,
-0.000673314556479454,
-0.0170002318918705,
0.007344103883951902,
0.00765571091324091,
-0.005375114269554615,
-0.0008233841508626938,
0.0011370748979970813,
0.0028518596664071083,
0.0003696615749504417,
-0.010408129543066025,
-0.0030957369599491358,
-0.01605607196688652,
0.000026715015337686054,
0.01958482526242733,
0.005473989527672529,
0.010518066585063934,
0.009350433014333248,
-0.006502494215965271,
0.0035146973095834255,
0.006829449906945229,
0.0007090475410223007,
0.01693401113152504,
-0.008966081775724888,
0.0021979527082294226,
0.0017071665497496724,
-0.008295414038002491,
0.0019270684570074081,
0.004609798546880484,
0.002497499343007803,
-0.00326865934766829,
0.002858721883967519,
-0.006175704766064882,
-0.006936282385140657,
-0.019217345863580704,
-0.0022259934339672327,
0.006491994485259056,
-0.005022898316383362,
0.0028265947476029396,
-0.013717131689190865,
0.0018195047741755843,
0.00393263204023242,
0.0056403037160634995,
-0.0005253693670965731,
0.0007031062268652022,
0.007808614056557417,
0.012554125860333443,
-0.0053038871847093105,
0.0009538667509332299,
0.003714637365192175,
-0.002475461922585964,
0.003867858089506626,
0.011530070565640926,
-0.009343708865344524,
-0.003636973211541772,
0.00023381983919534832,
0.005310490727424622,
0.0026200348511338234,
-0.005249259062111378,
-0.007977037690579891,
-0.004834268242120743,
0.0019440405303612351,
-0.007701901253312826,
0.0013896507443860173,
0.0015047889901325107,
0.0036528208293020725,
-0.007915716618299484,
-0.0015401875134557486,
-0.002500795992091298,
-0.009072544053196907,
0.008771071210503578,
-0.0016209931345656514,
0.0018511881353333592,
0.01376824639737606,
0.0028098206967115402,
-0.016474295407533646,
0.005792513955384493,
0.010320017114281654,
-0.00397554412484169,
0.0031231387984007597,
0.008725276216864586,
-0.005888409912586212,
-0.02388790249824524,
-0.0007638118113391101,
-0.014133096672594547,
0.006475906819105148,
-0.004479869268834591,
0.003635651431977749,
-0.009713364765048027,
0.008757746778428555,
0.005123881623148918,
-0.011359323747456074,
-0.0034263895358890295,
-0.009367930702865124,
0.00759971234947443,
-0.002214632695540786,
0.00006111502443673089,
-0.005731523968279362,
-0.0042762961238622665,
-0.0015893334057182074,
-0.0032012483570724726,
-0.0009773299098014832,
0.0028808163478970528,
0.0021660379134118557,
-0.0011140044080093503,
0.0018215146847069263,
-0.001410095952451229,
0.0026859811041504145,
0.0005950158229097724,
-0.009687568992376328,
-0.0024129764642566442,
0.0074297585524618626,
-0.0017517319647595286,
-0.0025874930433928967,
0.002014017663896084,
-0.004641400650143623,
-0.00832412764430046,
-0.009624826721847057,
-0.0032294790726155043,
-0.003928334452211857,
-0.003383919131010771,
-0.013093600049614906,
-0.002381655154749751,
-0.00663007190451026,
0.00913784746080637,
-0.008588827215135098,
0.010408756323158741,
0.005515178665518761,
-0.006903872359544039,
0.004272660240530968,
-0.006265091709792614,
0.005771894473582506,
0.0023323101922869682,
0.006494500674307346,
0.0013048999244347215,
-0.007662609219551086,
-0.011989925988018513,
0.010158369317650795,
-0.009067455306649208,
0.0004856383893638849,
0.01512598805129528,
0.004609804134815931,
0.009679628536105156,
0.0017640830483287573,
-0.0011442569084465504,
0.003231421345844865,
0.00896436907351017,
-0.013275708071887493,
0.003490494331344962,
-0.004582345951348543,
-0.0010065048700198531,
0.003883749945089221,
-0.006675568409264088,
0.005804909393191338,
0.009812233038246632,
0.001694803242571652,
-0.008448062464594841,
-0.002241716021671891,
0.0013359204167500138,
0.004049570765346289,
-0.011996728368103504,
-0.002455563982948661,
-0.004601932130753994,
-0.0035344185307621956,
-0.00047904340317472816,
0.0005527610774151981,
-0.0027449156623333693,
0.003407062729820609,
-0.004018863663077354,
0.005842642858624458,
0.0011353889713063836,
-0.0011640307493507862,
0.012719225138425827,
-0.005703173577785492,
-0.005236518103629351,
0.0037719986867159605,
0.0023628813214600086,
-0.0010136173805221915,
-0.007639257237315178,
-0.004766375292092562,
0.0012124157510697842,
0.0048215691931545734,
-0.004601193591952324,
-0.007406318560242653,
-0.004329186864197254,
0.0010874103754758835,
-0.0074233789928257465,
0.002227150835096836,
0.012080186977982521,
-0.0040145451202988625,
0.004988162312656641,
0.0011299551697447896,
-0.007063309196382761,
-0.015470698475837708,
0.053894687443971634,
-0.0010098045459017158,
0.0020214177202433348,
0.0069772326387465,
-0.007095918525010347,
0.002538180211558938,
-0.0017742494819685817,
0.008535587228834629,
-0.008047412149608135,
-0.008507439866662025,
0.011818645521998405,
-0.003153914352878928,
0.0009512716205790639,
0.0021659235935658216,
-0.000617956044152379,
0.018429027870297432,
-0.003864842467010021,
-0.017294473946094513,
-0.018650179728865623,
0.0023067134898155928,
-0.005120079033076763,
-0.006641107611358166,
0.00684716273099184,
-0.0035179646220058203,
-0.0017190581420436502,
0.002002323279157281,
0.009207742288708687,
0.0026689262595027685,
0.00215110182762146,
-0.0019696562085300684,
-0.0012276176130399108,
0.0007794448174536228,
0.003742706961929798,
0.004028732888400555,
0.00871179811656475,
-0.0012047451455146074,
0.004958039615303278,
-0.0015414664521813393,
-0.0005001398967579007,
-0.0028155192267149687,
0.004489501006901264,
0.00756707601249218,
-0.0016489798435941339,
-0.0021571428515017033,
0.00362414657138288,
0.003748082322999835,
0.0012795004295185208,
0.013338618911802769,
0.0010849867248907685,
-0.00600947393104434,
0.009792661294341087,
0.006371334660798311,
-0.00011699394235620275,
0.011644620448350906,
0.00030292931478470564,
0.007626782171428204,
0.0013592970790341496,
-0.008791735395789146,
-0.010007013566792011,
-0.0006796502857469022,
0.010881848633289337,
0.008008772507309914,
-0.0007166165160015225,
0.0031336627434939146,
0.0034981027711182833,
-0.006672041956335306,
-0.009176759049296379,
-0.006291117984801531,
0.00038268635398708284,
0.0016616152133792639,
0.002318084239959717,
0.073683962225914,
-0.00779811991378665,
0.00009571974078426138,
-0.009640351869165897,
0.0008606340852566063,
-0.0005453118938021362,
-0.0017999728443101048,
-0.0007906377431936562,
-0.0020385137759149075,
0.0037194066680967808,
0.003446361981332302,
-0.010267660953104496,
-0.010335355997085571,
0.0012776352232322097,
0.0026544719003140926,
-0.0014000486116856337,
0.003544863313436508,
0.007396060973405838,
-0.00610791239887476,
0.0050800517201423645,
-0.014066820032894611,
0.00026021021767519414,
0.000313691416522488,
-0.007994325831532478,
-0.0029522539116442204,
-0.001149277202785015,
0.002616219688206911,
0.0033330766018480062,
0.0022187698632478714,
-0.0048311008140444756,
0.0041250805370509624,
-0.0031279653776437044,
0.003927378915250301,
-0.0004612666671164334,
-0.0009685562690719962,
-0.006292354315519333,
0.009618114680051804,
0.001996120670810342,
-0.015062674880027771,
-0.008024114184081554,
-0.003020936157554388,
0.0008700272883288562,
-0.008555669337511063,
0.008796937763690948,
-0.005835645366460085,
0.008455481380224228,
-0.0038851802237331867,
0.002827422460541129,
-0.004951191134750843,
0.0018344665877521038,
-0.011529343202710152,
0.002842260291799903,
-0.18136198818683624,
0.010459991171956062,
0.0016022897325456142,
-0.0051699611358344555,
-0.001472659409046173,
-0.013864204287528992,
-0.009241209365427494,
0.001348374062217772,
0.009768519550561905,
0.005304065998643637,
0.0013993745669722557,
-0.002411747584119439,
0.007036175578832626,
0.004240379668772221,
-0.003776420373469591,
-0.005560632795095444,
0.004853348713368177,
-0.005091952160000801,
0.0011882060207426548,
0.005311749409884214,
0.007676309440284967,
0.009010189212858677,
0.0029186345636844635,
0.0025103732477873564,
-0.00017110125918406993,
-0.006033990066498518,
0.004969758912920952,
-0.0019524802919477224,
0.004274449311196804,
-0.011873781681060791,
-0.005071219988167286,
-0.005246405489742756,
-0.00011109989281976596,
0.00046473523252643645,
0.003616078058257699,
-0.0032830520067363977,
0.008479722775518894,
0.0023278386797755957,
-0.00821626652032137,
0.00769795011729002,
-0.0032820834312587976,
0.03686782717704773,
0.002679995493963361,
0.007291366811841726,
0.00019074697047472,
-0.00320246210321784,
-0.006832176353782415,
0.01133942510932684,
0.0031079822219908237,
0.014166638255119324,
-0.012897400185465813,
-0.002132440684363246,
0.004286869429051876,
0.01878451742231846,
-0.002629905240610242,
-0.006701692007482052,
-0.008907084353268147,
-0.00834829080849886,
0.00509423715993762,
0.011616173200309277,
0.013118590228259563,
-0.007213289849460125,
0.009647482074797153,
-0.002748051891103387,
-0.02283766306936741,
0.003478421363979578,
-0.00021879741689190269,
-0.00803639180958271,
-0.0002268405514769256,
0.0039582704193890095,
0.00921748485416174,
-0.0017004096880555153,
0.00826230552047491,
-0.0005868947482667863,
0.0031304259318858385,
-0.003041478805243969,
0.003112644888460636,
-0.0033345373813062906,
0.008762394078075886,
-0.010051547549664974,
0.01123442780226469,
-0.00831697415560484,
-0.002476651920005679,
0.0010304191382601857,
-0.00629906402900815,
0.008624788373708725,
0.0073709930293262005,
-0.006419147830456495,
-0.0008369786664843559,
-0.012472175061702728,
-0.0037213594187051058,
0.00609772140160203,
0.0011189423967152834,
-0.009778095409274101,
0.0020603365264832973,
-0.0007180477259680629,
0.007075265981256962,
0.008069507777690887,
-0.008881223388016224,
0.007055292371660471,
0.006206665188074112,
-0.00812743604183197,
0.000445137033239007,
-0.005456418264657259,
0.003523588413372636,
0.005341292358934879,
-0.009541396982967854,
-0.011017384938895702,
0.005476899910718203,
-0.005582091864198446,
-0.004819071386009455,
0.001206503715366125,
-0.009558659046888351,
-0.007549508474767208,
0.00341261038556695,
-0.013264281675219536,
0.0017227649223059416
] |
8a6c4e202130d51c730ab01bd3f2f21e5ec32862 | 758 | py | Python | tools/data.py | seanys/2D-Irregular-Packing-Algorithm | cc10edff2bc2631fcbcb47acf7bb3215e5c5023c | [
"MIT"
] | 29 | 2020-02-07T06:41:25.000Z | 2022-03-16T18:04:07.000Z | tools/data.py | seanys/2D-Irregular-Packing-Algorithm | cc10edff2bc2631fcbcb47acf7bb3215e5c5023c | [
"MIT"
] | 6 | 2020-04-27T01:36:27.000Z | 2022-01-31T11:59:05.000Z | tools/data.py | seanys/2D-Irregular-Packing-Algorithm | cc10edff2bc2631fcbcb47acf7bb3215e5c5023c | [
"MIT"
] | 12 | 2020-05-05T05:34:06.000Z | 2022-03-26T07:32:46.000Z | from tools.geofunc import GeoFunc
import pandas as pd
import json
def getData(index):
'''报错数据集有(空心):han,jakobs1,jakobs2 '''
'''形状过多暂时未处理:shapes、shirt、swim、trousers'''
name=["ga","albano","blaz1","blaz2","dighe1","dighe2","fu","han","jakobs1","jakobs2","mao","marques","shapes","shirts","swim","trousers"]
print("开始处理",name[index],"数据集")
'''暂时没有考虑宽度,全部缩放来表示'''
scale=[100,0.5,100,100,20,20,20,10,20,20,0.5,20,50]
print("缩放",scale[index],"倍")
df = pd.read_csv("data/"+name[index]+".csv")
polygons=[]
for i in range(0,df.shape[0]):
for j in range(0,df['num'][i]):
poly=json.loads(df['polygon'][i])
GeoFunc.normData(poly,scale[index])
polygons.append(poly)
return polygons
| 36.095238 | 141 | 0.60686 | 1 | 1.0296 | [
0.0017992216162383556,
0.02725674770772457,
0.0047823041677474976,
-0.0007103311945684254,
0.005448625888675451,
-0.006460694596171379,
-0.00841814186424017,
0.005130108445882797,
-0.008868707343935966,
-0.0005263334605842829,
0.004165478982031345,
0.002734327921643853,
0.010850570164620876,
-0.01698780432343483,
0.0026908833533525467,
0.01997305639088154,
-0.054194577038288116,
-0.0008236774592660367,
-0.003685782663524151,
0.0015496447449550033,
-0.011436963453888893,
0.010464228689670563,
0.008932724595069885,
0.008786083199083805,
0.0038584116846323013,
-0.002691234927624464,
0.010700559243559837,
0.003966385964304209,
-0.01112387515604496,
-0.008087249472737312,
-0.00006645242683589458,
-0.0020008827559649944,
-0.006139959208667278,
-0.006418340373784304,
0.004913883749395609,
-0.0036716831382364035,
-0.0007864120998419821,
-0.021598253399133682,
0.011069368571043015,
-0.006889371667057276,
-0.007249548099935055,
-0.016181226819753647,
0.0017672081012278795,
0.008840110152959824,
-0.01050660852342844,
0.0008007000433281064,
-0.005342818330973387,
-0.0030782625544816256,
-0.004721660166978836,
0.005589024163782597,
-0.012045673094689846,
0.002813356462866068,
0.014835666865110397,
0.005054638721048832,
-0.004698032047599554,
-0.006062937434762716,
0.011228623799979687,
0.00012598102330230176,
-0.013384697027504444,
-0.0026962817646563053,
-0.001810495276004076,
-0.0023362841457128525,
0.005209974478930235,
0.0019982634112238884,
-0.020078422501683235,
-0.007750195451080799,
-0.004839933477342129,
0.0016198731027543545,
0.0003942769253626466,
0.004555975086987019,
0.0026809670962393284,
0.001029422739520669,
0.007863686420023441,
0.0034359837882220745,
0.003431340679526329,
-0.003204409033060074,
-0.00011321539932396263,
0.002233491512015462,
0.008250768296420574,
0.004932553507387638,
0.004696904681622982,
-0.007640605792403221,
0.00390721345320344,
0.01127222552895546,
0.011832060292363167,
0.006153829395771027,
0.019848128780722618,
-0.011379444040358067,
0.04446132481098175,
0.007115649525076151,
-0.010734145529568195,
0.003591590328142047,
-0.012270454317331314,
-0.0016509316628798842,
-0.0024647910613566637,
-0.03440897539258003,
-0.00010844411008292809,
-0.0030114438850432634,
0.0008928208262659609,
0.002674357034265995,
0.00018081556481774896,
0.009499088861048222,
-0.002402747282758355,
-0.0052095637656748295,
-0.009779948741197586,
0.013645456172525883,
-0.009091271087527275,
-0.0015593623975291848,
0.010036640800535679,
0.0013760746223852038,
-0.01268177479505539,
-0.0004190234758425504,
0.0016239882679656148,
-0.013382399454712868,
0.004838327877223492,
0.00246550259180367,
-0.007215558085590601,
0.05802876129746437,
-0.004521391354501247,
0.002764941891655326,
-0.006283269729465246,
-0.0025423308834433556,
0.0058685350231826305,
0.01025183591991663,
0.010660868138074875,
-0.003962191753089428,
0.011570688337087631,
0.009329341351985931,
0.005910757463425398,
0.0061014252714812756,
-0.0012681991793215275,
0.009509503841400146,
-0.0053816307336091995,
-0.0014137845719233155,
0.00245134555734694,
-0.008319693617522717,
0.009734701365232468,
-0.0008616630802862346,
-0.004291982389986515,
0.0027159000746905804,
-0.002003042958676815,
-0.011413726955652237,
0.0007457711617462337,
-0.0025818434078246355,
-0.00006814582593506202,
-0.011724099516868591,
-0.0025078868493437767,
-0.002248582663014531,
-0.006408145651221275,
0.0013405533973127604,
0.01199796050786972,
0.0016317572444677353,
0.0023073721677064896,
-0.004184052813798189,
-0.009138215333223343,
-0.002583579160273075,
-0.0035042495001107454,
0.005324157886207104,
0.007072843611240387,
0.0016910543199628592,
-0.010416312143206596,
0.0004306721384637058,
0.005845034494996071,
0.0049166204407811165,
-0.0014098508981987834,
0.0010276437969878316,
-0.005702195223420858,
0.01131519302725792,
0.0015551774995401502,
0.005580308381468058,
0.014255428686738014,
-0.0047448305413126945,
-0.0019979835487902164,
-0.0007468866533599794,
0.0033251645509153605,
0.0005012346664443612,
0.005931212101131678,
0.008307849988341331,
-0.00423002801835537,
-0.005555386189371347,
0.008118377067148685,
0.002775703789666295,
0.007999795489013195,
0.004516132175922394,
-0.0003467998467385769,
0.0010605095885694027,
-0.006241040304303169,
0.00009402162686455995,
0.005166945513337851,
-0.006507610436528921,
0.004498705267906189,
0.006598384585231543,
-0.015108161605894566,
-0.007093316409736872,
0.00015851786884013563,
-0.01045334991067648,
0.003538514021784067,
0.016149548813700676,
0.009629283100366592,
0.0026583571452647448,
0.0037821317091584206,
-0.013398978859186172,
-0.0007845423533581197,
0.004808094818145037,
0.002767079509794712,
-0.012340082786977291,
-0.954914927482605,
0.006188391707837582,
0.005792588461190462,
-0.0027974811382591724,
0.005269831512123346,
0.0016740564024075866,
0.0028189681470394135,
0.004527767654508352,
0.012842988595366478,
-0.00981434527784586,
-0.006017362233251333,
-0.01114457007497549,
-0.013928034342825413,
-0.00019815171253867447,
-0.006920586805790663,
-0.0034656033385545015,
-0.004715286195278168,
-0.0075057391077280045,
0.00023715755378361791,
-0.003629715647548437,
-0.002419640077278018,
0.011969567276537418,
-0.0003192246367689222,
0.00556993018835783,
0.006775078363716602,
0.0035345915239304304,
-0.00819586031138897,
-0.004437155090272427,
-0.001531929592601955,
-0.003331526415422559,
-0.00672207772731781,
-0.015310076996684074,
-0.00603261636570096,
0.0021640814375132322,
0.011816775426268578,
-0.0013606102438643575,
0.010343063622713089,
-0.0013463841751217842,
0.0022095057647675276,
-0.009593463502824306,
0.005564401857554913,
0.0020075435750186443,
0.006095364224165678,
-0.030613550916314125,
-0.00027418314130045474,
-0.0025508336257189512,
-0.009781522676348686,
0.008767982944846153,
0.004691604524850845,
-0.0007540139486081898,
-0.004232651088386774,
-0.006223301403224468,
0.010783156380057335,
-0.007830900140106678,
0.0012805854203179479,
-0.005752252880483866,
-0.008007897064089775,
-0.0024096271954476833,
-0.007155365776270628,
0.0017838304629549384,
0.004274714272469282,
-0.004907017108052969,
-0.004835954401642084,
-0.00599226588383317,
0.006026112008839846,
0.002225354081019759,
0.0015795425279065967,
-0.02014513686299324,
-0.004891892895102501,
-0.002341671846807003,
0.0030860232654958963,
-0.0004213284992147237,
-0.0030739966314285994,
0.0014011977473273873,
-0.010723362676799297,
0.006118963472545147,
-0.000060102178395027295,
0.0027017572429031134,
-0.01326136477291584,
-0.002240143483504653,
-0.010934803634881973,
-0.010471018962562084,
0.0032771185506135225,
-0.0029445986729115248,
-0.00415990874171257,
0.0006417448166757822,
0.0013225625734776258,
0.00717686815187335,
-0.0067849550396203995,
0.0035590294282883406,
0.011287827976047993,
-0.001453822129406035,
-0.007980823516845703,
0.006932457908987999,
0.006558804307132959,
0.005462157540023327,
-0.002734634093940258,
0.0046701557002961636,
0.007407523225992918,
0.0095054404810071,
-0.0017565955640748143,
0.004716775845736265,
-0.00212852843105793,
0.014795014634728432,
-0.0013725749449804425,
0.0016811726382002234,
-0.0022893990390002728,
-0.0007378593436442316,
-0.002581885550171137,
-0.002100176177918911,
-0.0031636774074286222,
-0.002099714707583189,
-0.010669587180018425,
-0.010777482762932777,
-0.006218339316546917,
0.0002981071884278208,
0.0011233483674004674,
-0.007465224713087082,
0.0016069000121206045,
0.00017935255891643465,
0.010139440186321735,
-0.00004449061816558242,
-0.006896786857396364,
-0.0013431855477392673,
-0.002639498794451356,
-0.0075108823366463184,
0.016007237136363983,
-0.011317558586597443,
0.006396965589374304,
-0.0015936350682750344,
-0.014868129044771194,
0.007595774717628956,
0.008637359365820885,
-0.00805214885622263,
0.0004971864982508123,
0.0018705641850829124,
0.00294483988545835,
-0.0019440868636593223,
-0.006930017378181219,
-0.002511114114895463,
-0.017903292551636696,
-0.0017180738504976034,
0.02152417041361332,
0.0014048473676666617,
0.014128608629107475,
0.012722772546112537,
-0.0026395791210234165,
0.0027623181231319904,
0.007998374290764332,
0.0011622975580394268,
0.013496353290975094,
-0.009034435264766216,
0.00243506976403296,
0.0003451343218330294,
-0.006105151958763599,
0.0009084462653845549,
0.0037875135894864798,
0.0032478529028594494,
-0.0018507309723645449,
0.0012474505929276347,
-0.0078025697730481625,
-0.008135964162647724,
-0.017533432692289352,
-0.00261008576489985,
0.004359082318842411,
-0.0057934001088142395,
0.005863713566213846,
-0.011273243464529514,
0.005529479589313269,
0.0032430447172373533,
0.005110962316393852,
0.0002501129638403654,
0.0038339875172823668,
0.00630980683490634,
0.011083277873694897,
-0.005573591683059931,
0.0035218042321503162,
0.003860904835164547,
-0.003609211416915059,
0.003136435290798545,
0.010509047657251358,
-0.010164810344576836,
-0.004833298735320568,
0.0020998306572437286,
0.002689626533538103,
0.0007964515825733542,
-0.005570727866142988,
-0.009204217232763767,
-0.002752286149188876,
0.0021674949675798416,
-0.004918700084090233,
0.0039902725256979465,
0.000015466428521904163,
0.00020270049571990967,
-0.010602385737001896,
0.0012532114051282406,
-0.0026195307727903128,
-0.009633073583245277,
0.008471250534057617,
-0.002558318432420492,
-0.00031123406370170414,
0.014178324490785599,
0.002936829114332795,
-0.01379322912544012,
0.006542169954627752,
0.00813480094075203,
-0.005697560030966997,
0.0048136101104319096,
0.009093819186091423,
-0.007104144431650639,
-0.018966585397720337,
-0.0028040583711117506,
-0.01474709715694189,
0.00531106349080801,
-0.0036582157481461763,
0.003418550593778491,
-0.006648777984082699,
0.008597983978688717,
0.010827245190739632,
-0.014497213065624237,
-0.002453084569424391,
-0.008471926674246788,
0.009277316741645336,
-0.0017301961779594421,
-0.0014878826914355159,
-0.0035714602563530207,
-0.0031393771059811115,
-0.003429398639127612,
-0.0034989246632903814,
-0.001889867358841002,
0.0027129047084599733,
0.001107836258597672,
-0.0004778335860464722,
0.0029519551899284124,
0.002516378415748477,
0.0020069412421435118,
-0.001105910399928689,
-0.010980352759361267,
0.0010620891116559505,
0.0055864304304122925,
-0.004393449518829584,
-0.001505416352301836,
0.0021920513827353716,
-0.001615990069694817,
-0.00803526770323515,
-0.010905495844781399,
-0.0035412206780165434,
-0.006925598718225956,
-0.0035380744375288486,
-0.011780227534472942,
-0.003293740563094616,
-0.009909123182296753,
0.01079428568482399,
-0.006397850811481476,
0.010394513607025146,
0.004221641458570957,
-0.007206173613667488,
0.006861384492367506,
-0.0029956605285406113,
0.006974303629249334,
0.002733791247010231,
0.007165473885834217,
0.0019090079003944993,
-0.007841750048100948,
-0.010781179182231426,
0.011286820285022259,
-0.007934422232210636,
0.0028393876273185015,
0.014103922061622143,
0.005233920179307461,
0.008612172678112984,
-0.00006981183105381206,
0.0017706427024677396,
0.0033107411582022905,
0.006931757554411888,
-0.011458659544587135,
0.0021961377933621407,
-0.006166717037558556,
-0.001382043701596558,
0.0044351620599627495,
-0.005157011561095715,
0.000958672899287194,
0.009657193906605244,
0.0006849173805676401,
-0.00715396786108613,
-0.00021478885901160538,
-0.0019163908436894417,
0.0027515385299921036,
-0.012775593437254429,
-0.0010245030280202627,
-0.00411631353199482,
-0.002972731366753578,
-0.00003950747850467451,
-0.001474865130148828,
-0.0012964284978806973,
0.0036330625880509615,
-0.003314313245937228,
0.007776402402669191,
-0.00009464469621889293,
-0.00010332675446989015,
0.01609339937567711,
-0.004352804739028215,
-0.004483756609261036,
0.002789337420836091,
0.0026448897551745176,
-0.0004697261319961399,
-0.009530037641525269,
-0.002378737321123481,
-0.0011053462512791157,
0.00741092162206769,
-0.0018949437653645873,
-0.004461931996047497,
-0.004864158574491739,
0.0015416167443618178,
-0.005866573192179203,
0.002826015232130885,
0.015067742206156254,
-0.006210400257259607,
0.005591983906924725,
0.00013523019151762128,
-0.00863912794739008,
-0.012726846151053905,
0.05610736086964607,
-0.000990856671705842,
0.0038616182282567024,
0.0069541591219604015,
-0.006021479144692421,
0.0029560658149421215,
-0.002020580694079399,
0.007645186502486467,
-0.00792803056538105,
-0.009354318492114544,
0.007904764264822006,
-0.002845299430191517,
0.0018460823921486735,
0.0026514234486967325,
-0.000549224263522774,
0.016387486830353737,
-0.005333589389920235,
-0.017946353182196617,
-0.014546423219144344,
0.0037135265301913023,
-0.004083460196852684,
-0.005305122118443251,
0.006815245840698481,
-0.00634371442720294,
-0.0004975451738573611,
0.0033693464938551188,
0.0057472665794193745,
0.000002464830458848155,
0.0006642659427598119,
-0.0017461322713643312,
0.00003802799983532168,
-0.0015685464022681117,
0.0015378760872408748,
0.0034693346824496984,
0.008696818724274635,
-0.0014264046913012862,
0.0027460434939712286,
-0.001280688215047121,
0.001910267979837954,
-0.003201183397322893,
0.0078064994886517525,
0.007619302719831467,
-0.0027296356856822968,
-0.0032591416966170073,
0.0034127580001950264,
0.0022037329617887735,
-0.0010891249403357506,
0.013749513775110245,
0.0005009252927266061,
-0.006887262221425772,
0.00569726899266243,
0.005555277690291405,
-0.0019501447677612305,
0.007267514243721962,
-0.0003916136338375509,
0.00943149346858263,
0.0023764572106301785,
-0.00931667722761631,
-0.011439470574259758,
0.00014499448298010975,
0.007933124899864197,
0.008095735684037209,
-0.0021020714193582535,
0.002719938987866044,
0.0007674744701944292,
-0.003509480506181717,
-0.008729759603738785,
-0.008134352043271065,
0.0014224851038306952,
0.00001784019696060568,
0.0032338376622647047,
0.07237928360700607,
-0.007373551372438669,
-0.000020768084141309373,
-0.008578842505812645,
-0.00020864818361587822,
-0.0006016338593326509,
-0.0011936281807720661,
-0.0012349174357950687,
-0.0005051226471550763,
0.0029118014499545097,
0.005484755616635084,
-0.009059443138539791,
-0.010986045002937317,
0.002260724315419793,
0.0036077790427953005,
-0.0026632288936525583,
0.006004533730447292,
0.0076091173104941845,
-0.006608991418033838,
0.0037999909836798906,
-0.013488132506608963,
0.0001364301861030981,
-0.0011393283493816853,
-0.008708149194717407,
-0.002877029124647379,
-0.004648363217711449,
0.0053849793039262295,
0.0034253050107508898,
0.004721397999674082,
-0.003726249560713768,
0.0031288706231862307,
-0.0028385368641465902,
0.0012082100147381425,
-0.002856556558981538,
-0.0014094093348830938,
-0.004790926817804575,
0.009068010374903679,
-0.0003724902053363621,
-0.010126098059117794,
-0.00863657146692276,
-0.0008747359388507903,
0.002190789207816124,
-0.008520792238414288,
0.0056409467943012714,
-0.0030729188583791256,
0.00777510367333889,
-0.0026859729550778866,
0.0021059231366962194,
-0.006565961055457592,
0.003276896197348833,
-0.012101659551262856,
0.007983285002410412,
-0.1777477115392685,
0.011672113090753555,
0.0023987183813005686,
-0.005845704115927219,
-0.003035406582057476,
-0.014728842303156853,
-0.009134856052696705,
-0.0002130267967004329,
0.009972675703465939,
0.0037266924045979977,
0.0013471307465806603,
-0.0013594154734164476,
0.0015930937370285392,
0.004978360142558813,
-0.0013027695240452886,
-0.0009938932489603758,
0.0013920494820922613,
-0.002363421954214573,
0.0007322909077629447,
0.006430097855627537,
0.005816692486405373,
0.007243105676025152,
0.0026645285543054342,
0.00364517979323864,
0.0008094539516605437,
-0.007226178422570229,
0.0038594352081418037,
-0.0030387002043426037,
0.006056089419871569,
-0.011919757351279259,
-0.005730222910642624,
-0.007430022582411766,
-0.002894236007705331,
-0.0006871219375170767,
0.004327756818383932,
-0.0031775112729519606,
0.00640551932156086,
-0.00018255642498843372,
-0.0073238215409219265,
0.005582557991147041,
-0.006227029021829367,
0.031347449868917465,
0.002507600700482726,
0.006545846350491047,
-0.002765570068731904,
-0.002825117902830243,
-0.005706640426069498,
0.009125804528594017,
0.004298111889511347,
0.016229018568992615,
-0.01167394407093525,
-0.0016406020149588585,
0.0021521758753806353,
0.021499263122677803,
-0.003184838453307748,
-0.009772767312824726,
-0.008524465374648571,
-0.00427684560418129,
0.004546216689050198,
0.008030131459236145,
0.011754275299608707,
-0.003777948208153248,
0.00881754606962204,
-0.0036036670207977295,
-0.024661308154463768,
0.005688285920768976,
-0.0033936197869479656,
-0.009582151658833027,
-0.00004888850526185706,
0.008450194261968136,
0.009739547036588192,
-0.0045353081077337265,
0.010708521120250225,
-0.0022606151178479195,
0.0054174005053937435,
0.000012175148185633589,
0.007128724362701178,
-0.0065881251357495785,
0.006106868386268616,
-0.007528913673013449,
0.009926841594278812,
-0.010577247478067875,
-0.001050759805366397,
0.00443138787522912,
-0.006487881299108267,
0.009581455960869789,
0.0051676067523658276,
-0.003473008517175913,
0.0012245154939591885,
-0.010783721692860126,
-0.00294675980694592,
0.0022509817499667406,
0.005003313533961773,
-0.0076446011662483215,
0.0026322330813854933,
0.000338934623869136,
0.004844925832003355,
0.00777307478711009,
-0.008020084351301193,
0.005783519707620144,
0.004354086238890886,
-0.006545540876686573,
-0.00201983074657619,
-0.002894451143220067,
0.0002887846785597503,
0.00486824382096529,
-0.007261665537953377,
-0.007986917160451412,
0.004256600514054298,
-0.005926493555307388,
-0.004209020175039768,
0.0024683387018740177,
-0.0097147012129426,
-0.010503550991415977,
-0.0011932519264519215,
-0.01248660497367382,
0.0001242177386302501
] |
8a6c803544f7e0d285bc37ff4aefd197349a5940 | 456 | py | Python | src/trw/reporting/__init__.py | civodlu/trw | b9a1cf045f61d6df9c65c014ef63b4048972dcdc | [
"MIT"
] | 3 | 2019-07-04T01:20:41.000Z | 2020-01-27T02:36:12.000Z | src/trw/reporting/__init__.py | civodlu/trw | b9a1cf045f61d6df9c65c014ef63b4048972dcdc | [
"MIT"
] | null | null | null | src/trw/reporting/__init__.py | civodlu/trw | b9a1cf045f61d6df9c65c014ef63b4048972dcdc | [
"MIT"
] | 2 | 2020-10-19T13:46:06.000Z | 2021-12-27T02:18:10.000Z | #from trw.utils import collect_hierarchical_module_name, collect_hierarchical_parameter_name, get_batch_n, to_value, \
# safe_lookup, len_batch
from .export import as_image_ui8, as_rgb_image, export_image, export_sample, export_as_image
from .table_sqlite import TableStream, SQLITE_TYPE_PATTERN, get_table_number_of_rows
from .reporting_bokeh import report, create_default_reporting_options
from .reporting_bokeh_samples import PanelDataSamplesTabular
| 65.142857 | 118 | 0.875 | 1 | 0.7746 | [
0.0018076939741149545,
0.02609097771346569,
0.007902461104094982,
0.0019769512582570314,
0.0034534933511167765,
-0.0034754176158457994,
-0.008768090978264809,
0.006889508105814457,
-0.0101172411814332,
0.0015573394484817982,
0.006022230722010136,
0.002980895573273301,
0.012139609083533287,
-0.017311612144112587,
0.0009354213252663612,
0.01754535175859928,
-0.05966920405626297,
0.004612312652170658,
-0.004555477295070887,
0.003261174075305462,
-0.008677619509398937,
0.009680886752903461,
0.00903515424579382,
0.013106411322951317,
0.003648282028734684,
-0.0009237537160515785,
0.010486030019819736,
0.0026966440491378307,
-0.005147641059011221,
-0.006915778387337923,
0.00047207146417349577,
0.00041084663826040924,
-0.009394324384629726,
-0.012429545633494854,
0.009568281471729279,
-0.0041037872433662415,
0.0002675876021385193,
-0.02089092880487442,
0.009911959990859032,
-0.005289559718221426,
-0.005802526604384184,
-0.016977502033114433,
0.0033934353850781918,
0.00737471180036664,
-0.015522893518209457,
0.00569091597571969,
-0.0013747336342930794,
0.004875644110143185,
-0.01070406474173069,
0.003013679990544915,
-0.008954577147960663,
0.0009821882704272866,
0.01248786598443985,
-0.00022512349823955446,
-0.005860874895006418,
-0.008038735017180443,
0.008437259122729301,
0.0013775749830529094,
-0.014128712937235832,
-0.0001135648853960447,
-0.003568632062524557,
-0.0017966643208637834,
0.005904755555093288,
0.005288762040436268,
-0.016681265085935593,
-0.00846912432461977,
-0.005853340029716492,
0.0027472025249153376,
-0.0010418979218229651,
0.005795120261609554,
0.002442234428599477,
-0.002906045876443386,
0.0071087428368628025,
0.0013671121560037136,
0.004444780759513378,
-0.007234441116452217,
0.0013610688038170338,
0.0032341289333999157,
0.008632875978946686,
0.001997130224481225,
0.004147939849644899,
-0.007813834585249424,
0.0038885874673724174,
0.010615223087370396,
0.013508886098861694,
0.013017416931688786,
0.017946334555745125,
-0.009613637812435627,
0.03822196274995804,
0.0032303326297551394,
-0.012779824435710907,
0.0016924765659496188,
-0.008729983121156693,
-0.0020292005501687527,
-0.0016211330657824874,
-0.032367199659347534,
0.0011467298027127981,
-0.0037041909527033567,
0.00022550129506271333,
0.004363783169537783,
-0.001399171887896955,
0.006945465691387653,
-0.000873166078235954,
-0.003060095477849245,
-0.008732205256819725,
0.011965767480432987,
-0.009212883189320564,
-0.0020121147390455008,
0.006292310077697039,
0.005282774101942778,
-0.013866735622286797,
-0.0010926744434982538,
-0.0011443328112363815,
-0.014695556834340096,
0.004903228487819433,
0.003394179046154022,
-0.004626407288014889,
0.060410209000110626,
-0.002633169526234269,
0.001993797719478607,
-0.004915046505630016,
-0.004582890309393406,
-0.00013577750360127538,
0.007946892641484737,
0.009429221972823143,
-0.008376354351639748,
0.012278650887310505,
0.0027885769959539175,
0.004717767704278231,
0.00585803622379899,
-0.0003966510121244937,
0.008848931640386581,
-0.00447831628844142,
-0.0003978577733505517,
0.000034979559131897986,
-0.009908655658364296,
0.007481379434466362,
-0.0048289974220097065,
-0.004518024157732725,
-0.0029016737826168537,
-0.00010727727203629911,
-0.014115020632743835,
-0.0004845955700147897,
-0.005282559897750616,
0.0031111605931073427,
-0.013931935653090477,
-0.003791386028751731,
-0.0010695437667891383,
-0.0032251309603452682,
0.0015313609037548304,
0.008999446406960487,
-0.0004836279549635947,
0.00436868192628026,
-0.005028935149312019,
-0.0075223990716040134,
-0.004649839363992214,
-0.005561705678701401,
0.003100706497207284,
0.006982037797570229,
0.004406643565744162,
-0.005724853835999966,
-0.002549579367041588,
0.006323934067040682,
0.004706777632236481,
0.0012140851467847824,
-0.0037923131603747606,
-0.008958750404417515,
0.008615551516413689,
0.0011655091075226665,
0.0032064823899418116,
0.012442002072930336,
-0.004516908433288336,
-0.002980640856549144,
0.001980056054890156,
0.0040207128040492535,
0.0015000581042841077,
0.005925922654569149,
0.007642614655196667,
-0.005987446289509535,
-0.005953297950327396,
0.005302034318447113,
0.0020247066859155893,
0.011841943487524986,
0.011225581169128418,
-0.0028940453194081783,
0.006527366582304239,
-0.004308769945055246,
0.0015401119599118829,
0.005807032343000174,
-0.0038086995482444763,
0.010338983498513699,
0.0018551427638158202,
-0.01206536591053009,
-0.0049053458496928215,
-0.001819584984332323,
-0.010316018015146255,
0.0007462412468157709,
0.016134504228830338,
0.009595249779522419,
0.004626472480595112,
0.005999716464430094,
-0.013322871178388596,
-0.0040251570753753185,
0.006190048530697823,
0.001449716161005199,
-0.014194649644196033,
-0.9539720416069031,
0.0024545162450522184,
0.0034526861272752285,
0.00048405828420072794,
0.0038094287738204002,
0.0043084402568638325,
0.0018060384318232536,
0.003864747006446123,
0.01485946774482727,
-0.00630820682272315,
-0.005178270861506462,
-0.009247313253581524,
-0.009533215314149857,
0.0017277945298701525,
-0.005667468998581171,
-0.002052465220913291,
-0.004566682502627373,
-0.005325091537088156,
-0.0014438685029745102,
-0.007097430527210236,
-0.004892956465482712,
0.010703147388994694,
-0.0031494242139160633,
0.003551419824361801,
0.0046109710820019245,
0.00439009815454483,
-0.004736175294965506,
-0.0023429039865732193,
-0.0017014243640005589,
-0.0005354984314180911,
-0.006512275896966457,
-0.0157190952450037,
-0.0032360602635890245,
-0.0006182059296406806,
0.011399630457162857,
0.0008131468784995377,
0.010993272997438908,
0.0026167728938162327,
0.004300558473914862,
-0.011376605369150639,
0.004558340646326542,
0.0036814312916249037,
0.004658835474401712,
-0.02999795600771904,
0.00042761521763168275,
-0.0002804512914735824,
-0.0054220897145569324,
0.009429888799786568,
0.006031935103237629,
-0.00018035950779449195,
-0.0037594467867165804,
-0.002876071957871318,
0.009048511274158955,
-0.009705286473035812,
0.004804168362170458,
-0.009618260897696018,
-0.003713548183441162,
-0.000800000096205622,
-0.006097284145653248,
0.002004368230700493,
0.005791118368506432,
-0.005740688182413578,
-0.0032748898956924677,
-0.003194798482581973,
0.0007783466135151684,
-0.001271857414394617,
-0.004573846235871315,
-0.019369253888726234,
-0.005477584898471832,
-0.005618030671030283,
0.009271626360714436,
-0.0007264682208187878,
-0.0035813164431601763,
0.0016255582449957728,
-0.009791907854378223,
0.005261458456516266,
0.0006552755949087441,
0.002395434770733118,
-0.0063554672524333,
-0.00020522643171716481,
-0.007374737411737442,
-0.009001369588077068,
0.004761616233736277,
-0.004686320200562477,
-0.0017407119739800692,
0.0004059461352881044,
0.0032647119369357824,
0.010478089563548565,
-0.004260088782757521,
-0.0020854701288044453,
0.013775267638266087,
-0.0025555547326803207,
-0.007498165126889944,
0.007908419705927372,
0.005985141731798649,
0.002108745975419879,
-0.001538825803436339,
-0.0008038444211706519,
0.008589047007262707,
0.008965802378952503,
0.004147876054048538,
0.00398383429273963,
-0.0025247957091778517,
0.019852157682180405,
0.0008228877559304237,
0.0017673773691058159,
0.001606831676326692,
-0.002697442891076207,
-0.0031623048707842827,
-0.004738658666610718,
-0.00893073808401823,
-0.002885764930397272,
-0.011346795596182346,
-0.009005904197692871,
-0.005046479403972626,
0.00011750704288715497,
-0.003738285740837455,
-0.0020082108676433563,
-0.0002587976341601461,
0.0002590405638329685,
0.013114802539348602,
0.0009689974831417203,
-0.001962871989235282,
0.0007584933773614466,
0.00026216451078653336,
-0.008218200877308846,
0.01751518063247204,
-0.01077957171946764,
0.005122273229062557,
-0.0006328698946163058,
-0.0174915362149477,
0.009464285336434841,
0.008967755362391472,
-0.010457691736519337,
0.0032025431282818317,
0.0011930092005059123,
0.004101736471056938,
0.000047913599701132625,
-0.005963057279586792,
-0.003922358620911837,
-0.014646376483142376,
-0.0025480350013822317,
0.0206574909389019,
0.0029697197023779154,
0.010715418495237827,
0.011996904388070107,
-0.003744465997442603,
0.0032124309800565243,
0.008102823048830032,
0.0035940208472311497,
0.011633550748229027,
-0.01195696834474802,
-0.0022312637884169817,
0.0011465189745649695,
-0.006935407407581806,
0.001132370438426733,
0.0030071535147726536,
0.0017886294517666101,
-0.0036070235073566437,
0.0012810109183192253,
-0.005171473138034344,
-0.00895780511200428,
-0.01795380190014839,
-0.0021634234581142664,
0.007240308914333582,
-0.0051412433385849,
0.0034785177558660507,
-0.012816290371119976,
0.00418013846501708,
0.003341927193105221,
0.002179047791287303,
0.0020917332731187344,
0.000230940873734653,
0.006816067732870579,
0.011738227680325508,
-0.004714625421911478,
0.002169967396184802,
0.0027571821119636297,
-0.0008149597560986876,
0.004177750088274479,
0.008143178187310696,
-0.011844719760119915,
-0.0062745786271989346,
0.0005127208423800766,
0.002060697181150317,
0.0023410471621900797,
-0.003478187369182706,
-0.008679539896547794,
-0.005302872508764267,
0.001835071248933673,
-0.006015313323587179,
0.002082203747704625,
0.0030821713153272867,
0.0012701910454779863,
-0.008839249610900879,
-0.0031133980955928564,
-0.0029305536299943924,
-0.0103776128962636,
0.007238779682666063,
-0.002121113706380129,
0.0012984122149646282,
0.013975546695291996,
0.004038264509290457,
-0.012351793237030506,
0.008332619443535805,
0.010295483283698559,
-0.0013206867733970284,
0.0030117114074528217,
0.011434451676905155,
-0.006206001620739698,
-0.021922273561358452,
0.0016018931055441499,
-0.013810000382363796,
0.005985659081488848,
-0.004931942094117403,
0.002914239652454853,
-0.006408954504877329,
0.006969334091991186,
0.004849154502153397,
-0.010157630778849125,
-0.003148623974993825,
-0.009007680229842663,
0.00855747889727354,
-0.004595072474330664,
-0.0023633181117475033,
-0.0027613509446382523,
-0.0027282889932394028,
-0.00004524604446487501,
0.0008356827893294394,
-0.0025365673936903477,
0.003231270471587777,
0.0012857791734859347,
-0.006790044717490673,
0.000131636654259637,
-0.0017804998205974698,
0.0009095454588532448,
0.0031205317936837673,
-0.011632307432591915,
0.0014915165957063437,
0.007257412187755108,
-0.003476737765595317,
-0.006455894559621811,
0.00004373380579636432,
-0.0003553123970050365,
-0.006613227538764477,
-0.011207319796085358,
-0.002537746448069811,
-0.00716818543151021,
-0.0035198740661144257,
-0.010260826908051968,
-0.005551826674491167,
-0.00815485417842865,
0.00900967326015234,
-0.007610132917761803,
0.007961452938616276,
0.006222212221473455,
-0.005775897763669491,
0.005373306106775999,
-0.00333217135630548,
0.004436294548213482,
0.004939563572406769,
0.007682607974857092,
-0.001557440496981144,
-0.006076624616980553,
-0.010946442373096943,
0.008752047084271908,
-0.010004074312746525,
0.000383030652301386,
0.013958183117210865,
0.0041167582385241985,
0.008724784478545189,
0.0015690625878050923,
0.0019717752002179623,
0.006953469477593899,
0.01210683025419712,
-0.012257596477866173,
0.0025133457966148853,
-0.003478618571534753,
-0.004128490574657917,
0.0035622550640255213,
-0.0041399793699383736,
0.005454621743410826,
0.0064018904231488705,
0.0048948596231639385,
-0.009445044212043285,
0.0006414454546757042,
-0.001049149315804243,
0.002756324131041765,
-0.013177290558815002,
-0.0023050098679959774,
-0.004051829222589731,
-0.002501892624422908,
0.0008146448526531458,
-0.00015838841500226408,
0.000007383474894595565,
0.0033061248250305653,
-0.0023141992278397083,
0.008376442827284336,
0.0029965583235025406,
-0.003679942572489381,
0.014671615324914455,
-0.0065760244615375996,
-0.008351405151188374,
0.004270531702786684,
0.001058217603713274,
-0.002773852553218603,
-0.009760474786162376,
-0.0018153066048398614,
-0.0013794477563351393,
0.0049578468315303326,
-0.006905379705131054,
-0.0066755046136677265,
-0.003077043453231454,
0.0020011437591165304,
-0.007865489460527897,
0.0010073201265186071,
0.010130909271538258,
-0.00002785780088743195,
0.001529722474515438,
0.0031452227849513292,
-0.007730451878160238,
-0.014316670596599579,
0.05580217018723488,
-0.001856162678450346,
0.00045603723265230656,
0.007504915352910757,
-0.006887209601700306,
0.000358071323717013,
-0.002867043251171708,
0.008083455264568329,
-0.010539241135120392,
-0.003915478941053152,
0.010579219087958336,
-0.0072462051175534725,
0.0018290362786501646,
-0.004188547842204571,
-0.004173486493527889,
0.01439946610480547,
-0.0038663530722260475,
-0.017125781625509262,
-0.014577635563910007,
0.0023602494038641453,
-0.004346746020019054,
-0.004242963157594204,
0.008452024310827255,
-0.0016720857238397002,
-0.0020610715728253126,
0.003490797709673643,
0.006334088277071714,
-0.0004912702715955675,
-0.0024968874640762806,
-0.0018351362086832523,
-0.0023082334082573652,
-0.0008482721168547869,
0.005503916647285223,
0.00953745562583208,
0.011508490890264511,
-0.002093945862725377,
0.006903339643031359,
-0.0008854196639731526,
-0.00005691997648682445,
-0.0018872207729145885,
0.00680888257920742,
0.0038026724942028522,
-0.003841322846710682,
-0.006600980646908283,
0.007106001488864422,
0.004576512146741152,
-0.0021903144661337137,
0.010913209989666939,
0.0024959042202681303,
-0.0017932160990312696,
0.007808986585587263,
0.005350877996534109,
-0.0025982772931456566,
0.0096353180706501,
-0.004174998961389065,
0.006230551283806562,
-0.0005409633158706129,
-0.008307208307087421,
-0.012661459855735302,
0.0015425295569002628,
0.009614143520593643,
0.005747506394982338,
-0.004121093079447746,
0.005030587315559387,
0.002681808779016137,
-0.00784249696880579,
-0.009684761054813862,
-0.005443318281322718,
-0.00592749984934926,
-0.002337923739105463,
0.004205743316560984,
0.07224392890930176,
-0.00636029988527298,
0.0004244258161634207,
-0.01022595539689064,
0.0007855409639887512,
-0.0006218157941475511,
-0.001117195701226592,
-0.0006569862016476691,
-0.0015055231051519513,
0.0018576179863885045,
0.006213749758899212,
-0.011580088175833225,
-0.010866955853998661,
0.0019418322481215,
0.0035382204223424196,
0.00023795441666152328,
-0.0004306071496102959,
0.009334518574178219,
-0.0055858539417386055,
0.002067894209176302,
-0.01038429606705904,
-0.0009021265432238579,
-0.0009676370536908507,
-0.007102866657078266,
-0.0038774877320975065,
-0.004784913267940283,
-0.0005927545134909451,
0.0038945439737290144,
0.0049040112644433975,
-0.005405600182712078,
0.009033537469804287,
0.00040635064942762256,
0.0012123428750783205,
-0.0013833821285516024,
-0.0031817122362554073,
-0.006717388983815908,
0.010050787590444088,
-0.0020759592298418283,
-0.011554094031453133,
-0.006495824083685875,
-0.003662060247734189,
-0.00027142115868628025,
-0.006885111797600985,
0.005875980947166681,
0.002043389715254307,
0.005653238855302334,
-0.0014670257223770022,
0.004280746448785067,
-0.004534292500466108,
0.002739535877481103,
-0.011109479703009129,
0.0056929937563836575,
-0.18300507962703705,
0.009253816679120064,
0.004963052924722433,
-0.007817654870450497,
-0.004053219687193632,
-0.014591899700462818,
-0.01033770851790905,
0.0023421754594892263,
0.010049684904515743,
-0.0015693326713517308,
-0.0011889089364558458,
0.0002565734612289816,
0.0040166350081563,
0.004972842521965504,
0.0003571387496776879,
-0.005479464307427406,
0.0022558460477739573,
-0.0033823088742792606,
-0.0011421778472140431,
0.004596781451255083,
0.00430314801633358,
0.006633277051150799,
0.0036945114843547344,
0.0007492810836993158,
0.0006558785680681467,
-0.00546281598508358,
0.004839175846427679,
-0.0012456305557861924,
0.0060319844633340836,
-0.011013626120984554,
-0.0012284561526030302,
-0.007693551015108824,
-0.0036478147376328707,
0.002475566463544965,
0.0029876611661165953,
-0.0000787856915849261,
0.0057007428258657455,
-0.0002775217581074685,
-0.006178427487611771,
0.007376704830676317,
-0.003836795687675476,
0.031437285244464874,
0.0038356860168278217,
0.009364171884953976,
-0.0024855046067386866,
-0.003404998453333974,
-0.002478084759786725,
0.007985752075910568,
0.004864209331572056,
0.01403469406068325,
-0.014587593264877796,
-0.003191180294379592,
-0.00022226794681046158,
0.018222564831376076,
-0.007521913852542639,
-0.007296176161617041,
-0.008319892920553684,
-0.007409293204545975,
0.004167069680988789,
0.01178614143282175,
0.010371831245720387,
-0.009203930385410786,
0.012677496299147606,
0.00003966069198213518,
-0.023981178179383278,
0.005920728202909231,
-0.0004891410353593528,
-0.006960222963243723,
0.0008911297773011029,
0.008308731950819492,
0.009171928279101849,
-0.0033841372933238745,
0.0073076700791716576,
-0.00067752820905298,
0.0033177954610437155,
-0.0010103973327204585,
0.010433659888803959,
-0.0031526018865406513,
0.007075123023241758,
-0.006775396876037121,
0.011461962945759296,
-0.008390299044549465,
-0.0029585142619907856,
0.002753659151494503,
-0.002890122588723898,
0.0058157299645245075,
0.0078376904129982,
-0.00745000084862113,
0.00026422381051816046,
-0.013619235716760159,
-0.0004908624687232077,
0.0032384104561060667,
0.005417984910309315,
-0.008420906960964203,
0.003925444092601538,
-0.0024457592517137527,
0.008499066345393658,
0.00804064143449068,
-0.005288988351821899,
0.004696464631706476,
0.007433182094246149,
-0.008027912117540836,
0.00002569355274317786,
-0.0042835441417992115,
0.00019926796085201204,
0.004697720520198345,
-0.007006138563156128,
-0.008244353346526623,
0.006103897467255592,
-0.006102660205215216,
-0.005161832552403212,
0.0051981136202812195,
-0.011988833546638489,
-0.0063397688791155815,
-0.0013679306721314788,
-0.009814304299652576,
0.0015567389782518148
] |
8a6d51f8a422fff8bc79749ffb6d71189dc006bc | 2,509 | py | Python | vframe_cli/commands/templates/image-mp.py | julescarbon/vframe | 0798841fa9eb7e1252e4cdf71d68d991c26acab8 | [
"MIT"
] | 1 | 2021-05-15T11:06:39.000Z | 2021-05-15T11:06:39.000Z | vframe_cli/commands/templates/image-mp.py | julescarbon/vframe | 0798841fa9eb7e1252e4cdf71d68d991c26acab8 | [
"MIT"
] | null | null | null | vframe_cli/commands/templates/image-mp.py | julescarbon/vframe | 0798841fa9eb7e1252e4cdf71d68d991c26acab8 | [
"MIT"
] | null | null | null | #############################################################################
#
# VFRAME
# MIT License
# Copyright (c) 2020 Adam Harvey and VFRAME
# https://vframe.io
#
#############################################################################
import click
@click.command('')
@click.option('-i', '--input', 'opt_dir_in', required=True)
@click.option('-r', '--recursive', 'opt_recursive', is_flag=True)
@click.option('-e', '--ext', 'opt_exts', default=['jpg', 'png'], multiple=True,
help='Glob extension')
@click.option('--slice', 'opt_slice', type=(int, int), default=(None, None),
help='Slice list of files')
@click.option('-t', '--threads', 'opt_threads', default=None)
@click.pass_context
def cli(ctx, opt_dir_in, opt_recursive, opt_exts, opt_slice, opt_threads):
"""Multiprocessor image template"""
# ------------------------------------------------
# imports
from os.path import join
from pathlib import Path
from dataclasses import asdict
import numpy as np
import cv2 as cv
from tqdm import tqdm
from pathos.multiprocessing import ProcessingPool as Pool
from pathos.multiprocessing import cpu_count
from vframe.settings import app_cfg
from vframe.settings.modelzoo_cfg import modelzoo
from vframe.models.dnn import DNN
from vframe.image.dnn_factory import DNNFactory
from vframe.utils import file_utils
from vframe.utils.video_utils import FileVideoStream, mediainfo
log = app_cfg.LOG
# set N threads
if not opt_threads:
opt_threads = cpu_count() # maximum
# glob items
fp_items = file_utils.glob_multi(opt_dir_in, opt_exts, recursive=opt_recursive)
if any(opt_slice):
fp_items = fp_items[opt_slice[0]:opt_slice[1]]
log.info(f'Processing: {len(fp_items):,} files')
# -----------------------------------------------------------
# start pool worker
def pool_worker(pool_item):
# init threaded video reader
fp = pool_item['fp']
result = {'fp': fp}
# add media metadata
im = cv.imread(fp)
for i in range(20):
im = cv.blur(im, (35,35))
return result
# end pool worker
# -----------------------------------------------------------
# convert file list into object with
pool_items = [{'fp': fp} for fp in fp_items]
# init processing pool iterator
# use imap instead of map via @hkyi Stack Overflow 41920124
desc = f'image-mp x{opt_threads}'
with Pool(opt_threads) as p:
pool_results = list(tqdm(p.imap(pool_worker, pool_items), total=len(fp_items), desc=desc)) | 28.83908 | 94 | 0.610602 | 1 | 1.5291 | [
0.0012739697704091668,
0.023662852123379707,
0.009543128311634064,
0.001852978253737092,
0.0037895082496106625,
-0.0040572043508291245,
-0.006985588930547237,
-0.0002369782014284283,
-0.005622395314276218,
0.003781706327572465,
-0.00011260739847784862,
0.005865490064024925,
0.00934567116200924,
-0.013927189633250237,
-0.00017564590962138027,
0.016501914709806442,
-0.05343664065003395,
0.0023411798756569624,
-0.006148923188447952,
0.0009048146894201636,
-0.009637873619794846,
0.009870264679193497,
0.00703670596703887,
0.007644490338861942,
0.003777152393013239,
-0.0013700866838917136,
0.008177359588444233,
0.0029391441494226456,
-0.006268630735576153,
-0.005857676267623901,
-0.0012400229461491108,
-0.0015352759510278702,
-0.005898354575037956,
-0.007306902203708887,
0.007144845090806484,
-0.005985615309327841,
0.00045843131374567747,
-0.01909925974905491,
0.010713769122958183,
-0.0027114597614854574,
-0.005576233379542828,
-0.010374820791184902,
-0.0020949007011950016,
0.0043611773289740086,
-0.0077199265360832214,
0.003695653984323144,
-0.005735288839787245,
-0.0019970720168203115,
-0.01117622759193182,
0.006410655099898577,
-0.007951868698000908,
0.006233692169189453,
0.015035043470561504,
0.0008914053323678672,
-0.006626027636229992,
-0.007897520437836647,
0.015626022592186928,
0.0008397373021580279,
-0.009993997402489185,
-0.0007576248608529568,
-0.002193667460232973,
-0.002183049451559782,
0.00644567608833313,
0.0017817236948758364,
-0.016102151945233345,
-0.007009668741375208,
-0.0057406555861234665,
0.0031065556686371565,
-0.000929874018765986,
0.007094193249940872,
0.0026907434221357107,
-0.0027695419266819954,
0.006234942469745874,
0.00464617507532239,
0.0027112991083413363,
-0.004259591456502676,
-0.0006328918389044702,
0.00047605959116481245,
0.008576048538088799,
0.00294192461296916,
0.003941969946026802,
-0.005877129267901182,
0.0026245403569191694,
0.010798441246151924,
0.014953773468732834,
0.009728995151817799,
0.01791439577937126,
-0.012290737591683865,
0.04486728459596634,
0.005335024558007717,
-0.008037845604121685,
0.0034625402186065912,
-0.00825278926640749,
-0.003602389944717288,
-0.007961312308907509,
-0.02827404998242855,
-0.0011095240479335189,
-0.0026255189441144466,
0.0008128127665258944,
0.006611773278564215,
0.0002753378066699952,
0.007272670976817608,
-0.002268659183755517,
-0.003733517834916711,
-0.008339806459844112,
0.009878491051495075,
-0.008540642447769642,
-0.004724828992038965,
0.00748847471550107,
0.002003636211156845,
-0.013021181337535381,
-0.0022866171784698963,
0.0002535994572099298,
-0.011543146334588528,
0.002170549239963293,
0.0056615425273776054,
-0.004100429825484753,
0.051432572305202484,
-0.0006133978604339063,
0.005599736236035824,
-0.004331341944634914,
0.00044531156891025603,
0.004629778675734997,
0.005732329562306404,
0.008520511910319328,
-0.0030125186312943697,
0.011786752380430698,
0.006186701823025942,
0.0008404194959439337,
0.006801198236644268,
-0.00029150117188692093,
0.007595158647745848,
-0.0044440957717597485,
-0.0009360387921333313,
-0.0010256561217829585,
-0.007924234494566917,
0.006948263384401798,
-0.0030970473308116198,
-0.007363426964730024,
0.004212288651615381,
-0.0011564581654965878,
-0.011785008013248444,
-0.00013380500604398549,
-0.0052742925472557545,
0.0043364656157791615,
-0.009854946285486221,
-0.004967379849404097,
-0.00388519698753953,
-0.004724676255136728,
0.001865970203652978,
0.0086020827293396,
0.0056245517916977406,
0.0019300158601254225,
-0.006731757428497076,
-0.007420829962939024,
-0.000010722746992541943,
-0.00455045560374856,
0.0005231795948930085,
0.006603517569601536,
0.0035030851140618324,
-0.010092460550367832,
-0.00024072163796517998,
0.003395150415599346,
0.005425652023404837,
0.0008712291019037366,
0.0014306099619716406,
-0.008298004977405071,
0.009137826971709728,
-0.0012668559793382883,
0.0064947959035634995,
0.008897246792912483,
-0.0056423586793243885,
0.0015246475813910365,
-0.0037486215587705374,
0.0053129796870052814,
-0.0017312996787950397,
0.00496780127286911,
0.011396454647183418,
-0.0054153697565197945,
-0.0059532769955694675,
0.00593836884945631,
0.003572017652913928,
0.00859819259494543,
0.00630725035443902,
-0.0020852794405072927,
0.0018545924685895443,
-0.004168693907558918,
-0.000897711724974215,
0.005464253015816212,
-0.004910020157694817,
0.007728971540927887,
0.004069598391652107,
-0.014772521331906319,
-0.005827923305332661,
0.00014656332496087998,
-0.008661752566695213,
0.001182839972898364,
0.014835230074822903,
0.01171975675970316,
-0.0026297946460545063,
0.002786736935377121,
-0.009988014586269855,
0.001127145136706531,
0.009622515179216862,
-0.000170703322510235,
-0.014075935818254948,
-0.9603297114372253,
0.007646466139703989,
0.004472378175705671,
-0.001961175352334976,
0.006644132547080517,
0.0031353833619505167,
0.0017946704756468534,
0.005082123912870884,
0.013470614328980446,
-0.005817750934511423,
-0.005971066188067198,
-0.008991757407784462,
-0.010251050814986229,
-0.002748958533629775,
-0.008308804593980312,
-0.0010953131131827831,
-0.006450706161558628,
-0.00562153197824955,
-0.003468229901045561,
-0.004622626584023237,
-0.0012090307427570224,
0.01027488149702549,
-0.003441845066845417,
0.006341703701764345,
0.004333570599555969,
0.002289943164214492,
-0.0007064869278110564,
-0.0037783614825457335,
-0.0007272050133906305,
-0.0025673112832009792,
-0.008326448500156403,
-0.014620169065892696,
-0.0013579108053818345,
-0.005631256382912397,
0.009015422314405441,
0.001423462643288076,
0.009171692654490471,
-0.003459496423602104,
0.002170388586819172,
-0.009058583527803421,
0.005281960126012564,
0.0004958807257935405,
0.0034776590764522552,
-0.027017883956432343,
-0.0028714828658849,
0.0007772262906655669,
-0.008289356715977192,
0.008478332310914993,
0.00216238247230649,
0.0007019351469352841,
-0.004679571837186813,
-0.00544353574514389,
0.007877727039158344,
-0.007056255359202623,
0.00576036935672164,
-0.004817016422748566,
-0.006498189643025398,
-0.002085108309984207,
-0.00909473467618227,
0.0025806725025177,
0.004628120455890894,
-0.001709650387056172,
-0.002829139120876789,
-0.004898050334304571,
0.00487904017791152,
0.0024037554394453764,
0.0014281970215961337,
-0.01999848335981369,
-0.006214700639247894,
0.0008818153874017298,
0.0035770174581557512,
-0.00012827888713218272,
-0.0045890710316598415,
0.005422663874924183,
-0.007961870171129704,
0.005119488574564457,
0.002962748985737562,
-0.0012319659581407905,
-0.009877357631921768,
-0.0027192949783056974,
-0.010061578825116158,
-0.008060798980295658,
0.00006179911724757403,
-0.004930537194013596,
-0.0052748387679457664,
0.0009801718406379223,
0.0026844001840800047,
0.008145089261233807,
-0.00634014792740345,
0.003928678575903177,
0.011774420738220215,
-0.0012364520225673914,
-0.009482037276029587,
0.005375386215746403,
0.006768683437258005,
0.002668374218046665,
-0.0012633191654458642,
0.002642075065523386,
0.0074060834012925625,
0.006167198996990919,
0.003428720636293292,
0.005895690992474556,
0.0018551192479208112,
0.011446433141827583,
-0.00039322429802268744,
-0.0005528449546545744,
-0.005139481276273727,
0.00011883609113283455,
-0.0036507032345980406,
-0.0007397151202894747,
-0.0034367155749350786,
-0.0028200442902743816,
-0.011832394637167454,
-0.010103356093168259,
-0.0030511533841490746,
-0.0008115505333989859,
0.0017090786714106798,
-0.004889100324362516,
-0.0030166413635015488,
0.0006726252613589168,
0.005639506503939629,
-0.001644971314817667,
-0.005641402676701546,
0.00045066437451168895,
0.0011760846246033907,
-0.0030468078330159187,
0.016450848430395126,
-0.010527017526328564,
0.00783368106931448,
0.0003635208122432232,
-0.01535182073712349,
0.005292857531458139,
0.010120105929672718,
-0.006227890960872173,
0.00006989884423092008,
0.0010864421492442489,
0.002563202055171132,
-0.0012698133941739798,
-0.0037625120021402836,
-0.0038369218818843365,
-0.018227219581604004,
0.0021130896639078856,
0.01739838905632496,
0.005400093737989664,
0.010077028535306454,
0.011430694721639156,
-0.0048242066986858845,
0.0021269561257213354,
0.007413879036903381,
0.00018269561405759305,
0.013861204497516155,
-0.00784547720104456,
0.0013380604796111584,
0.0005635656998492777,
-0.006808531936258078,
0.0021612364798784256,
0.005711844190955162,
0.0021708535496145487,
-0.0031375044491142035,
0.0020381174981594086,
-0.005961761809885502,
-0.005137675441801548,
-0.016360918059945107,
-0.003340494818985462,
0.00978806335479021,
-0.007573366165161133,
0.004337530117481947,
-0.008355406112968922,
0.005254327319562435,
0.004921734798699617,
0.007079004775732756,
0.002443663775920868,
-0.0003661334339994937,
0.007699808571487665,
0.011014169082045555,
-0.005412851460278034,
0.0025552199222147465,
0.0032882969826459885,
0.00016423503984697163,
0.0018795039504766464,
0.009231191128492355,
-0.006265455391258001,
-0.005604051519185305,
0.0014994635712355375,
0.0027865367010235786,
-0.0017527902964502573,
-0.0033932996448129416,
-0.008829256519675255,
-0.001682416768744588,
0.0028339482378214598,
-0.003740613115951419,
0.0018921445589512587,
0.0022136513143777847,
0.0031253916677087545,
-0.008851876482367516,
0.0007183688576333225,
-0.006512374617159367,
-0.011097375303506851,
0.010404565371572971,
0.00045997477718628943,
0.0026452308520674706,
0.014883534982800484,
0.002302480861544609,
-0.014090296812355518,
0.007905933074653149,
0.009645838290452957,
-0.0014553433284163475,
0.004858638625591993,
0.008243518881499767,
-0.005648304708302021,
-0.02305954322218895,
-0.00411974685266614,
-0.013454240746796131,
0.002416059374809265,
-0.0015912854578346014,
0.00453814584761858,
-0.008348658680915833,
0.005071314517408609,
0.006928030867129564,
-0.013622630387544632,
-0.00532569969072938,
-0.008028083480894566,
0.008605260401964188,
0.0007049486739560962,
0.0009627460385672748,
-0.004092423710972071,
-0.0009073718101717532,
-0.0018483609892427921,
-0.005888570100069046,
-0.0023040452506393194,
0.004746238235384226,
0.0006508732330985367,
-0.0027018135879188776,
0.003187039401382208,
-0.004977757576853037,
0.0008419405203312635,
-0.0005421180394478142,
-0.009238393045961857,
0.0021298194769769907,
0.004227008670568466,
-0.001677239779382944,
-0.0007792728720232844,
-0.0004515796899795532,
-0.0034106054808944464,
-0.006959700956940651,
-0.009826037101447582,
-0.006597546860575676,
-0.0038072799798101187,
-0.0033865191508084536,
-0.010764055885374546,
-0.003460920648649335,
-0.010354842059314251,
0.008532571606338024,
-0.005707535892724991,
0.00837611686438322,
0.00553438626229763,
-0.005104880314320326,
0.006644139531999826,
-0.001439061714336276,
0.0035057158675044775,
0.0031330741476267576,
0.005790557246655226,
-0.00009646213584346697,
-0.005609544459730387,
-0.011565529741346836,
0.012967875227332115,
-0.0073748743161559105,
0.0016386084025725722,
0.014419114217162132,
0.004170158877968788,
0.010843668133020401,
0.0012782069388777018,
-0.0018520498415455222,
0.000026623707526596263,
0.00790706928819418,
-0.011496794410049915,
0.005734642036259174,
-0.0047263107262551785,
0.00030649040127173066,
0.004122068639844656,
-0.002597036538645625,
0.0033090924844145775,
0.009903300553560257,
0.001690435572527349,
-0.006338747683912516,
-0.00064240483334288,
-0.00002384200161031913,
0.002522447146475315,
-0.010977143421769142,
0.00026193683152087033,
-0.0036666716914623976,
-0.004399362485855818,
-0.004587761592119932,
-0.0005929293110966682,
0.0003741672553587705,
0.0038450937718153,
-0.004653246141970158,
0.006347909104079008,
0.002577202394604683,
-0.005288210231810808,
0.013109371066093445,
-0.004896024242043495,
-0.0031650576274842024,
0.003214679891243577,
0.0037368687335401773,
-0.002913425909355283,
-0.00688637001439929,
-0.00273441756144166,
0.0028461518231779337,
0.005348818842321634,
-0.0050361561588943005,
-0.004664506763219833,
-0.0001859180920291692,
-0.0018927206983789802,
-0.010393938980996609,
-0.0008208629442378879,
0.013106578961014748,
-0.004947020206600428,
0.003979870118200779,
-0.002605882938951254,
-0.008605443872511387,
-0.013204650953412056,
0.05383913591504097,
-0.0014889296144247055,
0.004360490012913942,
0.005550482776015997,
-0.0060681854374706745,
-0.0016627236036583781,
-0.001539558987133205,
0.006759768817573786,
-0.004968596622347832,
-0.007493262644857168,
0.007531953975558281,
-0.0056317830458283424,
0.0033000207040458918,
0.0027743817772716284,
-0.0013298045378178358,
0.0170250553637743,
-0.0032765136566013098,
-0.015892336145043373,
-0.01727408543229103,
0.0045663174241781235,
-0.0032491202000528574,
-0.007310462649911642,
0.008535285480320454,
-0.005674673244357109,
-0.004838382825255394,
0.001865545753389597,
0.004687467589974403,
0.0016032519051805139,
0.0007979891379363835,
-0.003633140819147229,
-0.001963477348908782,
-0.0021806741133332253,
0.0006784299039281905,
0.005278990603983402,
0.008764063008129597,
-0.0022744997404515743,
0.008037853986024857,
-0.0008525024750269949,
-0.0030822698026895523,
-0.004048261325806379,
0.004349167924374342,
0.010077189654111862,
-0.0012960475869476795,
-0.002600599778816104,
0.004271458834409714,
0.004786319099366665,
0.0012531345710158348,
0.011564076878130436,
-0.0003216704062651843,
-0.003896194975823164,
0.007672111503779888,
0.005996108986437321,
0.000052402352594072,
0.011323356069624424,
-0.0015710724983364344,
0.005144542548805475,
0.0016218108357861638,
-0.006633746903389692,
-0.015596617013216019,
0.00006151705019874498,
0.008151497691869736,
0.007926707156002522,
-0.003114575520157814,
0.0017440273659303784,
-0.0023690282832831144,
-0.0021861926652491093,
-0.008745365776121616,
-0.009374924935400486,
0.00046020906302146614,
0.0033549938816577196,
0.0044397939927875996,
0.07216241955757141,
-0.005535185802727938,
0.0005340483621694148,
-0.00935142021626234,
0.0009043113677762449,
0.0005083864089101553,
-0.00266288872808218,
0.002195175504311919,
-0.0017613574163988233,
0.0008656925638206303,
0.0022096524480730295,
-0.010298195295035839,
-0.011376881040632725,
-0.0009241412626579404,
0.0016647286247462034,
-0.0024540682788938284,
0.0019043444190174341,
0.005927722901105881,
-0.008317412808537483,
0.0033150152303278446,
-0.01110067032277584,
-0.0013898771721869707,
-0.0008165944600477815,
-0.009571222588419914,
-0.0024587579537183046,
-0.0029455069452524185,
0.004681597463786602,
0.004231182858347893,
0.0029486040584743023,
-0.0029996756929904222,
0.00725089805200696,
-0.00351069332100451,
0.0005264724604785442,
-0.0024858044926077127,
-0.0002851947501767427,
-0.006687989458441734,
0.006809716112911701,
0.00240413099527359,
-0.010668138973414898,
-0.004310795105993748,
-0.0017969859763979912,
0.0010247138561680913,
-0.004060649313032627,
0.0037557948380708694,
-0.0009081850294023752,
0.004281972534954548,
-0.004966144450008869,
0.0007509214919991791,
-0.006950111594051123,
0.004000007174909115,
-0.009121292270720005,
0.004583377856761217,
-0.16474223136901855,
0.011262254789471626,
0.003667444922029972,
-0.006190508138388395,
-0.002995970193296671,
-0.015482592396438122,
-0.008494855836033821,
0.0004437193274497986,
0.008554816246032715,
0.0022886707447469234,
-0.0015775876818224788,
-0.0026810213457792997,
0.0019152533495798707,
0.004781091120094061,
-0.003511225339025259,
-0.004874059464782476,
0.002435115398839116,
-0.004959948360919952,
-0.0002556096587795764,
0.004655640572309494,
0.0037418047431856394,
0.010208452120423317,
0.0008205240592360497,
0.002272368175908923,
-0.00037340738344937563,
-0.004710122477263212,
0.0037015278358012438,
-0.004301267210394144,
0.002393496921285987,
-0.011162328533828259,
-0.005171569995582104,
-0.0031918389722704887,
-0.0035667228512465954,
0.00298945140093565,
0.004989094100892544,
-0.0007029012776911259,
0.008980345912277699,
0.0009499727166257799,
-0.007971260696649551,
0.004732637666165829,
-0.007753495592623949,
0.029455602169036865,
0.004543978720903397,
0.005562761332839727,
-0.0011288323439657688,
-0.006624131463468075,
-0.005013049114495516,
0.008531779982149601,
0.0032991243060678244,
0.012280525639653206,
-0.014184379018843174,
-0.0020120926201343536,
0.0015956505667418242,
0.018113914877176285,
-0.005623453296720982,
-0.010842123068869114,
-0.005187618546187878,
-0.006106181535869837,
0.0029807190876454115,
0.006671700160950422,
0.009823130443692207,
-0.002606526017189026,
0.007810581475496292,
-0.001145281596109271,
-0.024257734417915344,
0.0028557274490594864,
-0.001296425238251686,
-0.008644544519484043,
-0.0024466475006192923,
0.008664918132126331,
0.009859997779130936,
0.0011248750379309058,
0.003440770786255598,
0.00140715716406703,
0.006484130397439003,
-0.0004707973275799304,
0.0055090016685426235,
-0.0010138720972463489,
0.006780059076845646,
-0.009097563102841377,
0.007464354857802391,
-0.009845806285738945,
-0.002231764607131481,
0.0022939674090594053,
-0.00474972277879715,
0.00852592196315527,
0.005804781336337328,
-0.003393851686269045,
-0.0012405815068632364,
-0.010320676490664482,
-0.000045210930693428963,
0.0026179065462201834,
0.0028858163859695196,
-0.008179498836398125,
0.003010688116773963,
0.001340158167295158,
0.0033234411384910345,
0.008600440807640553,
-0.009551073424518108,
0.007137213833630085,
0.0028127701953053474,
-0.005489164963364601,
-0.004053681623190641,
-0.007370311301201582,
0.004437368828803301,
0.005908697843551636,
-0.0056470781564712524,
-0.006075149867683649,
0.002109213499352336,
-0.00381062226369977,
-0.00447452999651432,
0.007851803675293922,
-0.009165625087916851,
-0.008969094604253769,
-0.0013163703260943294,
-0.008917290717363358,
0.00009306181163992733
] |
8a6d637336ee5d703603ebc196b3672612c215ab | 1,976 | py | Python | src/learndash/api_resources/user.py | MarkMacDon/learndash-python | a3fbfc45567a524b80c732d735f2ae101119f2e4 | [
"MIT"
] | null | null | null | src/learndash/api_resources/user.py | MarkMacDon/learndash-python | a3fbfc45567a524b80c732d735f2ae101119f2e4 | [
"MIT"
] | 1 | 2021-05-06T19:01:24.000Z | 2021-05-06T19:01:24.000Z | src/learndash/api_resources/user.py | MarkMacDon/learndash-python | a3fbfc45567a524b80c732d735f2ae101119f2e4 | [
"MIT"
] | 2 | 2021-05-05T22:45:04.000Z | 2021-07-24T08:47:02.000Z | import learndash
from learndash.api_resources.abstract import ListableAPIResource
from learndash.api_resources.abstract import RetrievableAPIResource
from learndash.api_resources.abstract import UpdateableAPIResource
from learndash.api_resources.abstract import NestedAPIResource
from learndash.api_resources.typing import UserDict
from learndash.api_resources.typing import UserCourseProgressDict
from learndash.api_resources.typing import UserCourseDict
from learndash.api_resources.typing import UserGroupDict
from learndash.api_resources.typing import UserQuizProgressDict
class User(RetrievableAPIResource[UserDict], ListableAPIResource[UserDict]):
api_path = learndash.path_users
def course_progress(self, id=None):
return UserCourseProgress(id, parent=self)
def courses(self, id=None):
return UserCourse(id, parent=self)
def groups(self, id=None):
return UserGroup(id, parent=self)
def quiz_progress(self, id=None):
return UserQuizProgress(id, parent=self)
class UserCourseProgress(ListableAPIResource[UserCourseProgressDict], NestedAPIResource):
api_path = learndash.path_user_course_progress
# class UserCourseProgressSteps(ListableAPIResource, NestedAPIResource):
class UserCourse(ListableAPIResource[UserCourseDict], UpdateableAPIResource, NestedAPIResource): # also deletable
api_path = learndash.path_user_courses
def instance_url(self):
# This endpoint accepts updates and deletions at it's base endpoint
return self.class_url()
class UserGroup(ListableAPIResource[UserGroupDict], UpdateableAPIResource, NestedAPIResource): # also deleteable
api_path = learndash.path_user_groups
def instance_url(self):
# This endpoint accepts updates and deletions at it's base endpoint
return self.class_url()
class UserQuizProgress(ListableAPIResource[UserQuizProgressDict], NestedAPIResource):
api_path = learndash.path_user_quiz_progress
| 35.927273 | 113 | 0.802632 | 1 | 1.2681 | [
0.0021207761019468307,
0.02379699796438217,
0.008058222942054272,
0.002439912175759673,
0.0037559138145297766,
-0.0026851303409785032,
-0.008039550855755806,
0.0007274793460965157,
-0.005675694905221462,
0.0026001324877142906,
0.0033593846019357443,
0.005373843479901552,
0.0048210411332547665,
-0.015382061712443829,
-0.0007774326950311661,
0.015604686923325062,
-0.05064050853252411,
0.002491891849786043,
-0.003922828007489443,
0.0024520677980035543,
-0.006959967780858278,
0.009945479221642017,
0.010464181192219257,
0.005196307320147753,
0.0058016530238091946,
-0.00043532857671380043,
0.008262652903795242,
0.0023436162155121565,
-0.007328095845878124,
-0.007598015945404768,
-0.0022560034412890673,
-0.0030915983952581882,
-0.004932647105306387,
-0.0071950918063521385,
0.00710963923484087,
-0.003652497660368681,
-0.000166046796948649,
-0.019393758848309517,
0.011905244551599026,
-0.0049903010949492455,
-0.006761699914932251,
-0.014929765835404396,
-0.001112480415031314,
0.004595092032104731,
-0.011186997406184673,
0.0017405420076102018,
-0.0028887344524264336,
0.00398185383528471,
-0.011287217028439045,
0.006381864193826914,
-0.007874203845858574,
0.0066496762447059155,
0.013079117052257061,
0.0035025039687752724,
-0.006037394981831312,
-0.006691909395158291,
0.01333536859601736,
-0.0007902767974883318,
-0.010175102390348911,
-0.0018950487719848752,
-0.0049494546838104725,
-0.0023922144901007414,
0.003943971823900938,
0.0009406365570612252,
-0.016497435048222542,
-0.005709383636713028,
-0.0034499061293900013,
0.001698120147921145,
-0.0013459533220157027,
0.007374080363661051,
0.0012645624810829759,
0.00013337489508558065,
0.00699709914624691,
0.003636675886809826,
0.0038073346950113773,
-0.004306374583393335,
0.00040646109846420586,
0.0005843337276019156,
0.008546680212020874,
0.0044203647412359715,
0.005393907427787781,
-0.008120807819068432,
0.0029782787896692753,
0.008757656440138817,
0.01127542182803154,
0.009072884917259216,
0.022110342979431152,
-0.01123642548918724,
0.04740165174007416,
0.008900819346308708,
-0.008555883541703224,
0.003125341609120369,
-0.006642458960413933,
-0.0033054123632609844,
-0.006250051315873861,
-0.026901094242930412,
-0.0025837933644652367,
-0.006062481552362442,
-0.0021066905464977026,
0.004071127623319626,
-0.0009161339839920402,
0.0080732936039567,
-0.0023848330602049828,
-0.004999222699552774,
-0.007597567513585091,
0.011183029040694237,
-0.00713153462857008,
-0.0030745838303118944,
0.005330822430551052,
0.002621924737468362,
-0.012356352061033249,
-0.001246917643584311,
0.0030093935783952475,
-0.010392219759523869,
0.003809770103543997,
0.00011807534610852599,
-0.006680313032120466,
0.05403983220458031,
-0.0008816426852717996,
0.0023072361946105957,
-0.004925346001982689,
0.0015273065073415637,
0.0018964684568345547,
0.0037298963870853186,
0.009326426312327385,
-0.0019618053920567036,
0.01371979620307684,
0.009154225699603558,
0.0042957947589457035,
0.008344688452780247,
-0.001991678960621357,
0.010718978941440582,
-0.0026106773875653744,
-0.002042504260316491,
0.001005428610369563,
-0.006614301819354296,
0.006167454645037651,
-0.0028596813790500164,
-0.009913080371916294,
0.0023413714952766895,
0.0010766490595415235,
-0.008776159957051277,
-0.00003379704867256805,
-0.001468966482207179,
0.0031572775915265083,
-0.010797646827995777,
-0.002890466945245862,
-0.004783990327268839,
-0.004314531106501818,
0.004571862518787384,
0.00987167190760374,
0.0032029019203037024,
0.002970859408378601,
-0.0051736123859882355,
-0.008999190293252468,
0.001698200241662562,
-0.00398789020255208,
0.0006035653059370816,
0.007102521602064371,
0.002343659056350589,
-0.010103263892233372,
-0.0013688444159924984,
0.0031425138004124165,
0.002898731967434287,
-0.0025039713364094496,
0.00036490082857199013,
-0.008316189050674438,
0.007297063246369362,
-0.00024030667555052787,
0.003254164708778262,
0.011160281486809254,
-0.0056845746003091335,
-0.0007263378938660026,
-0.0022965483367443085,
0.0013151828898116946,
-0.001931415288709104,
0.006430035922676325,
0.009498953819274902,
-0.004507947713136673,
-0.005069991108030081,
0.003815390868112445,
0.005836163181811571,
0.010192126035690308,
0.005118959583342075,
-0.0017216303385794163,
0.0034742322750389576,
-0.005742114037275314,
-0.0031592363957315683,
0.006173927336931229,
-0.004059545695781708,
0.004506700672209263,
0.004385035019367933,
-0.012846129015088081,
-0.006280922330915928,
0.001625258824788034,
-0.006642413791269064,
0.001446002977900207,
0.012525868602097034,
0.010282379575073719,
-0.004611475858837366,
0.005113157443702221,
-0.008329933509230614,
0.0016082612564787269,
0.005358813796192408,
0.0035387149546295404,
-0.011340990662574768,
-0.9601146578788757,
0.00672512874007225,
0.004072093870490789,
-0.000330673239659518,
0.006503631826490164,
0.0023378783371299505,
0.00351291848346591,
0.003950614016503096,
0.012802861630916595,
-0.010061481967568398,
-0.006705624982714653,
-0.011864063329994678,
-0.010965476743876934,
-0.0031529541593044996,
-0.007746939081698656,
-0.0022217892110347748,
-0.006579519249498844,
-0.006940918974578381,
-0.0031516412273049355,
-0.001915376866236329,
-0.003010242013260722,
0.010441976599395275,
-0.0013424629578366876,
0.004897532053291798,
0.0020770581904798746,
0.00378694967366755,
-0.004901253152638674,
-0.0018308459548279643,
-0.003454760182648897,
-0.0030243454966694117,
-0.005757168401032686,
-0.011456185951828957,
-0.004242821130901575,
-0.0017794988816604018,
0.009995690546929836,
-0.0005884274723939598,
0.00944813247770071,
-0.0022468725219368935,
0.0024488763883709908,
-0.007013263646513224,
0.004668681416660547,
-0.001541484147310257,
0.0019599853549152613,
-0.029689153656363487,
-0.0009008942288346589,
-0.0017882415559142828,
-0.008686996065080166,
0.010385256260633469,
-0.0012864418094977736,
-0.001234337454661727,
-0.003934814594686031,
-0.0038544691633433104,
0.010027924552559853,
-0.006809066981077194,
0.0019048195099458098,
-0.006134469993412495,
-0.007646935526281595,
-0.0003448796342127025,
-0.008999243378639221,
0.000845142814796418,
0.003175250953063369,
-0.0017387584084644914,
-0.0042962743900716305,
-0.0037279173266142607,
0.0035842014476656914,
0.003996970597654581,
0.0015515148406848311,
-0.019053980708122253,
-0.008002140559256077,
0.0021398277021944523,
-0.002266774419695139,
-0.004759537056088448,
-0.0017858752980828285,
0.0020792188588529825,
-0.00931044202297926,
0.006062558386474848,
0.0037392466329038143,
0.0004498362250160426,
-0.012996578589081764,
-0.0016066377284005284,
-0.006946368142962456,
-0.008354110643267632,
0.0021904143504798412,
-0.006783713586628437,
-0.0037113837897777557,
-0.0011579152196645737,
0.00007587743311887607,
0.006361010484397411,
-0.0038669398054480553,
0.0057170698419213295,
0.013127749785780907,
0.00014443743566516787,
-0.005402366630733013,
0.007056816481053829,
0.006679852493107319,
0.002181187504902482,
-0.0030386443249881268,
0.002511095954105258,
0.007389373145997524,
0.0075382632203400135,
0.002142295939847827,
0.004347025882452726,
-0.000014282351003203075,
0.0115699153393507,
-0.0018862318247556686,
-0.0005891035543754697,
-0.004032200668007135,
0.001657373970374465,
-0.0043685222044587135,
-0.0010482084471732378,
-0.003974204882979393,
-0.00412713410332799,
-0.011790363118052483,
-0.0099656842648983,
-0.0009792057098820806,
-0.0020783026702702045,
0.002824778202921152,
-0.0027095393743366003,
0.0005687947268597782,
0.002067247638478875,
0.005942690651863813,
-0.00010224137076875195,
-0.0016921713249757886,
0.0006481728632934391,
0.0004155582864768803,
-0.004777426365762949,
0.013596777804195881,
-0.013125295750796795,
0.006457549519836903,
0.00007999002264114097,
-0.01440810039639473,
0.006251663900911808,
0.009688681922852993,
-0.008163525722920895,
-0.0010392697295174003,
0.003745325841009617,
0.003543054684996605,
0.000760069175157696,
-0.004733634646981955,
-0.002882600063458085,
-0.015223108232021332,
0.00029162998544052243,
0.01967042312026024,
0.0016241271514445543,
0.009573393501341343,
0.012037827633321285,
-0.002803680021315813,
0.00010138197103515267,
0.007359728682786226,
0.003025847254320979,
0.01318124309182167,
-0.007051965221762657,
0.00029093839111737907,
0.0002538140397518873,
-0.006433151196688414,
-0.0015688530402258039,
0.005889463238418102,
0.005992795806378126,
-0.004808370023965836,
0.002746261889114976,
-0.0072375996969640255,
-0.005659107118844986,
-0.01695360615849495,
-0.003413817146793008,
0.007522710599005222,
-0.005553881637752056,
0.004551574122160673,
-0.010121231898665428,
0.0051812706515192986,
0.005594531539827585,
0.005682061426341534,
0.0006554705905728042,
-0.0012299210065975785,
0.0071372161619365215,
0.013883158564567566,
-0.0037118541076779366,
0.0030170902609825134,
0.00304065877571702,
-0.0005972688086330891,
0.0025741986464709044,
0.010378154926002026,
-0.006762093864381313,
-0.0047018625773489475,
0.0037988261319696903,
0.003123844275251031,
-0.00012160120968474075,
-0.003939735237509012,
-0.010568099096417427,
-0.00341175589710474,
0.002674630843102932,
-0.005997161380946636,
0.005387771874666214,
0.0015494029503315687,
0.0036860606633126736,
-0.006752855610102415,
-0.0034203873947262764,
-0.0007943299715407193,
-0.012769627384841442,
0.010606748051941395,
-0.002403784077614546,
0.003112638834863901,
0.014448603615164757,
0.0020248016808182,
-0.014012056402862072,
0.004690316040068865,
0.011073913425207138,
-0.0035141052212566137,
0.005023973528295755,
0.005959771107882261,
-0.005701964721083641,
-0.0205807127058506,
-0.0021103823091834784,
-0.01450970210134983,
0.003889805171638727,
-0.003368091769516468,
0.005865117069333792,
-0.007983427494764328,
0.00866018421947956,
0.004237421788275242,
-0.013053537346422672,
-0.004437072668224573,
-0.006597502157092094,
0.010015047155320644,
0.0009381062700413167,
0.0001956858322955668,
-0.004562139045447111,
-0.00040896746213547885,
-0.002465745434165001,
-0.004324173089116812,
-0.0012205998646095395,
0.005211654584854841,
0.0016705311136320233,
-0.0017033678013831377,
0.00144102587364614,
-0.004601051099598408,
-0.0002700527256820351,
0.0015849448973312974,
-0.010940462350845337,
0.0020174093078821898,
0.0037653271574527025,
-0.0015325861750170588,
-0.005116406362503767,
0.0010373659897595644,
-0.0014798472402617335,
-0.007515342440456152,
-0.01123636495321989,
-0.004347995389252901,
-0.0038064001128077507,
-0.0041462271474301815,
-0.01213365513831377,
-0.0009017664706334472,
-0.007961155846714973,
0.004793389234691858,
-0.00600396329537034,
0.00875021144747734,
0.005122604314237833,
-0.006099700462073088,
0.006770012900233269,
0.00023375441378448159,
0.002610434778034687,
0.004422105383127928,
0.004813953302800655,
-0.0006675415788777173,
-0.005614150781184435,
-0.012121133506298065,
0.009956789202988148,
-0.007226584944874048,
0.00107786082662642,
0.012714951299130917,
0.0043563214130699635,
0.00822892040014267,
-0.0019035888835787773,
0.0005142426816746593,
0.00013282800500746816,
0.0043283486738801,
-0.01627737283706665,
0.0040495567955076694,
-0.003708673408254981,
-0.00019222906848881394,
0.004950697999447584,
-0.005303292069584131,
0.0028179604560136795,
0.010444947518408298,
0.0027296808548271656,
-0.008080109022557735,
-0.0023670911323279142,
0.0013839773600921035,
0.0029126321896910667,
-0.011527705937623978,
0.0001478786434745416,
-0.003855304326862097,
-0.003228719113394618,
-0.0021740009542554617,
-0.0023844102397561073,
0.0003063813492190093,
0.0058390358462929726,
-0.0014185113832354546,
0.005530712194740772,
0.0018513472750782967,
-0.005583763588219881,
0.014093455858528614,
-0.004517735447734594,
-0.005623628851026297,
0.0024916476104408503,
0.0020669191144406796,
-0.003132404061034322,
-0.0069933561608195305,
-0.0018901036819443107,
0.001975937746465206,
0.007324529346078634,
-0.0031453967094421387,
-0.005758099723607302,
-0.0031487492378801107,
0.0004181582771707326,
-0.008947912603616714,
0.0018450659699738026,
0.01159803569316864,
-0.0031628955621272326,
0.005311537068337202,
-0.0030251829884946346,
-0.007842413149774075,
-0.013571102172136307,
0.0537349097430706,
-0.0009145640069618821,
0.004206154961138964,
0.0054608979262411594,
-0.007453517988324165,
-0.0020621016155928373,
-0.003737048013135791,
0.006466725841164589,
-0.005152627360075712,
-0.006166995968669653,
0.006687495857477188,
-0.0013711986830458045,
0.004743632394820452,
0.00399921415373683,
-0.0034295187797397375,
0.017633669078350067,
-0.005023262929171324,
-0.014640450477600098,
-0.01784123294055462,
0.0063804504461586475,
-0.003754968987777829,
-0.00940808467566967,
0.010751890949904919,
-0.0024534016847610474,
-0.005177379120141268,
0.0010868734680116177,
0.006235605105757713,
0.0016994625329971313,
-0.0014352662255987525,
-0.003271958790719509,
-0.00256534107029438,
-0.0035168903414160013,
0.002649888163432479,
0.0028317042160779238,
0.007252105046063662,
-0.004508741199970245,
0.0035239197313785553,
-0.0029705320484936237,
-0.0025832962710410357,
-0.0010800397722050548,
0.0055089304223656654,
0.007626622915267944,
-0.00046870854566805065,
-0.00020459070219658315,
0.006272696424275637,
0.0034645809791982174,
0.001549164648167789,
0.013669882901012897,
0.0004466366663109511,
-0.004588068928569555,
0.00907075684517622,
0.008142060600221157,
0.0011843646643683314,
0.00991870742291212,
0.0004791266983374953,
0.0057835509069263935,
0.0011838849168270826,
-0.006808053702116013,
-0.01304030604660511,
-0.0033664617221802473,
0.005348854698240757,
0.009734496474266052,
-0.002369870897382498,
0.0019434276036918163,
-0.0027182353660464287,
-0.003362025134265423,
-0.005793881602585316,
-0.007452845573425293,
-0.001209022244438529,
0.0019395878771319985,
0.004171612206846476,
0.06894850730895996,
-0.007513401098549366,
-0.0019274590304121375,
-0.009129841811954975,
-0.0013327270280569792,
-0.0009986505610868335,
-0.001078893430531025,
0.0007337761926464736,
-0.0027508181519806385,
0.0005134805105626583,
0.0010545363184064627,
-0.0061676595360040665,
-0.010954107157886028,
-0.002575066639110446,
0.0028552429284900427,
-0.004133961629122496,
0.005185810849070549,
0.004159584175795317,
-0.008834924548864365,
0.0018921481678262353,
-0.013094836845993996,
-0.002201132010668516,
-0.0015136150177568197,
-0.009045574814081192,
-0.003524561645463109,
-0.0018179164035245776,
0.007161919958889484,
0.004302644170820713,
0.0051943957805633545,
-0.003455677069723606,
0.006022236775606871,
-0.003923897631466389,
-0.0012568876845762134,
-0.005334389861673117,
-0.0019408466760069132,
-0.004935493692755699,
0.007332200184464455,
0.0017332442803308368,
-0.010412966832518578,
-0.003947143442928791,
-0.00036254350561648607,
-0.0005000858218409121,
-0.005152520257979631,
0.002554267644882202,
0.0011916891671717167,
0.005138608627021313,
-0.004863625857979059,
-0.00040999663178808987,
-0.005585103295743465,
0.0013490625424310565,
-0.013576136901974678,
0.006484105717390776,
-0.16830910742282867,
0.010985278524458408,
0.004433612804859877,
-0.0031572766602039337,
-0.0029990614857524633,
-0.015322871506214142,
-0.004466857295483351,
0.004144035279750824,
0.009029431268572807,
0.0029914153274148703,
-0.0017727852100506425,
-0.0002048483001999557,
0.0026652447413653135,
0.0031027246732264757,
-0.00261180242523551,
-0.003026074729859829,
0.00367295416072011,
-0.004729940555989742,
0.0009235009783878922,
0.0058823986910283566,
0.005499951541423798,
0.00876192469149828,
0.0008702583727426827,
0.0013712900690734386,
-0.0009142522467300296,
-0.00427625747397542,
0.006577556487172842,
-0.0009197438484989107,
0.003959696739912033,
-0.01207544095814228,
-0.0028868899680674076,
-0.00396529259160161,
-0.005224342457950115,
0.002031125593930483,
0.003977990709245205,
-0.00018374313367530704,
0.010061677545309067,
0.0031199618242681026,
-0.006696560885757208,
0.007017772179096937,
-0.007958543486893177,
0.026551974937319756,
0.005343806929886341,
0.006016667932271957,
-0.001144430716522038,
-0.0077484105713665485,
-0.005116887390613556,
0.00808481965214014,
0.0013641620753332973,
0.011184499599039555,
-0.013694637455046177,
-0.0002588366041891277,
0.003170219250023365,
0.01770462468266487,
-0.005406061187386513,
-0.009354032576084137,
-0.005603686906397343,
-0.002225492149591446,
0.003711150726303458,
0.006508311722427607,
0.010184194892644882,
-0.0029261247254908085,
0.009623781777918339,
-0.0016815263079479337,
-0.02283080667257309,
0.005615363363176584,
-0.0025528669357299805,
-0.006890671327710152,
0.0040560150519013405,
0.0052636913023889065,
0.00795918982475996,
-0.001495472271926701,
0.0005855165072716773,
0.001130340388044715,
0.006060637068003416,
0.0008048894233070314,
0.00703547103330493,
-0.001158323371782899,
0.006010103039443493,
-0.010416223667562008,
0.007037576287984848,
-0.00960166659206152,
-0.002867681672796607,
0.0035809252876788378,
-0.003904318204149604,
0.012286534532904625,
0.005591383669525385,
-0.0005049814353697002,
0.00006298124935710803,
-0.01067773625254631,
-0.0029238697607070208,
0.001908180071040988,
0.0015803665155544877,
-0.008519724942743778,
0.0030673977453261614,
0.000014970269148761872,
0.005917554721236229,
0.008524050004780293,
-0.010646956972777843,
0.0072038182988762856,
0.002971077337861061,
-0.0035874596796929836,
0.0010447748936712742,
-0.005802192725241184,
0.0008398833451792598,
0.005335357040166855,
-0.006445184350013733,
-0.006361095234751701,
0.003099268302321434,
-0.005671417340636253,
-0.006776541005820036,
0.005338295828551054,
-0.00864529237151146,
-0.009044112637639046,
-0.0023780185729265213,
-0.009583566337823868,
0.00040261264075525105
] |
8a6dd286ad198b0a16465871a4cd84854d419ad0 | 1,824 | py | Python | lib/galaxy/tool_util/deps/container_resolvers/__init__.py | sneumann/galaxy | f6011bab5b8adbabae4986a45849bb9158ffc8bb | [
"CC-BY-3.0"
] | 1 | 2019-07-27T19:30:55.000Z | 2019-07-27T19:30:55.000Z | lib/galaxy/tool_util/deps/container_resolvers/__init__.py | userssss/galaxy | 9662164ad68b39adf5a5606a7aa8e388f6a79f1e | [
"CC-BY-3.0"
] | 4 | 2021-02-08T20:28:34.000Z | 2022-03-02T02:52:55.000Z | lib/galaxy/tool_util/deps/container_resolvers/__init__.py | userssss/galaxy | 9662164ad68b39adf5a5606a7aa8e388f6a79f1e | [
"CC-BY-3.0"
] | 1 | 2018-05-30T07:38:54.000Z | 2018-05-30T07:38:54.000Z | """The module defines the abstract interface for resolving container images for tool execution."""
from abc import (
ABCMeta,
abstractmethod,
abstractproperty,
)
import six
from galaxy.util.dictifiable import Dictifiable
@six.python_2_unicode_compatible
@six.add_metaclass(ABCMeta)
class ContainerResolver(Dictifiable):
"""Description of a technique for resolving container images for tool execution."""
# Keys for dictification.
dict_collection_visible_keys = ['resolver_type', 'can_uninstall_dependencies']
can_uninstall_dependencies = False
def __init__(self, app_info=None, **kwds):
"""Default initializer for ``ContainerResolver`` subclasses."""
self.app_info = app_info
self.resolver_kwds = kwds
def _get_config_option(self, key, default=None):
"""Look in resolver-specific settings for option and then fallback to
global settings.
"""
if self.app_info and hasattr(self.app_info, key):
return getattr(self.app_info, key)
else:
return default
@abstractmethod
def resolve(self, enabled_container_types, tool_info, **kwds):
"""Find a container matching all supplied requirements for tool.
The supplied argument is a :class:`galaxy.tool_util.deps.containers.ToolInfo` description
of the tool and its requirements.
"""
@abstractproperty
def resolver_type(self):
"""Short label for the type of container resolution."""
def _container_type_enabled(self, container_description, enabled_container_types):
"""Return a boolean indicating if the specified container type is enabled."""
return container_description.type in enabled_container_types
def __str__(self):
return "%s[]" % self.__class__.__name__
| 33.777778 | 98 | 0.707237 | 1 | 1.1676 | [
0.00171016831882298,
0.022080009803175926,
0.00784127414226532,
-0.0014464579289779067,
0.005409510340541601,
-0.004310826770961285,
-0.00843300111591816,
0.0037863089237362146,
-0.006400000303983688,
0.002866534749045968,
0.0014613440725952387,
0.005679688882082701,
0.0066442848183214664,
-0.01910950057208538,
0.0014522506389766932,
0.01712382771074772,
-0.05138672515749931,
0.0037304239813238382,
-0.00586755620315671,
0.0037786317989230156,
-0.008426211774349213,
0.009412307292222977,
0.009581731632351875,
0.008491617627441883,
0.0068342494778335094,
0.0007117146160453558,
0.008228925988078117,
0.002989207161590457,
-0.005943352822214365,
-0.0074370927177369595,
-0.0010273548541590571,
-0.0038632997311651707,
-0.006590989418327808,
-0.008035955019295216,
0.006432750727981329,
-0.0027806030120700598,
-0.001184480031952262,
-0.019569745287299156,
0.009458542801439762,
-0.0047655655071139336,
-0.0080705052241683,
-0.016581794247031212,
-0.002549920929595828,
0.0043930732645094395,
-0.008288852870464325,
0.002938673598691821,
-0.0026328912936151028,
0.003390662372112274,
-0.010197944939136505,
0.008607370778918266,
-0.009647411294281483,
0.006487673614174128,
0.01395002193748951,
0.0027439123950898647,
-0.006004498340189457,
-0.0077797905541956425,
0.011900915764272213,
0.0005126283504068851,
-0.00972183607518673,
0.0008007211145013571,
-0.00316786696203053,
-0.002097176620736718,
0.005729151889681816,
0.0034532700665295124,
-0.014780938625335693,
-0.007584935519844294,
-0.00290149194188416,
0.001807962078601122,
0.0012389970943331718,
0.006060548592358828,
0.0009407487232238054,
-0.00344483507797122,
0.008980977348983288,
0.0056943828240036964,
0.005410448648035526,
-0.0035928150173276663,
-0.0007036690949462354,
-0.000986934406682849,
0.009356082417070866,
0.006523216608911753,
0.003992303274571896,
-0.007371990941464901,
0.006541692651808262,
0.008820765651762486,
0.015321440994739532,
0.007886877283453941,
0.023152682930231094,
-0.009323807433247566,
0.04683340713381767,
0.007610007654875517,
-0.01089070551097393,
-0.000255758612183854,
-0.007535560987889767,
-0.0004243107105139643,
-0.001595345907844603,
-0.027746867388486862,
0.0013232885394245386,
-0.002672698348760605,
-0.0010452420683577657,
0.0037889108061790466,
-0.0020203758031129837,
0.0050085438415408134,
-0.005232149735093117,
-0.0008319501648657024,
-0.01032692939043045,
0.009048736654222012,
-0.010277294553816319,
-0.0012869659112766385,
0.008126870729029179,
0.002644933760166168,
-0.012153646908700466,
-0.0018674334278330207,
0.0028633438050746918,
-0.0140909468755126,
0.0031303628347814083,
0.0005903624114580452,
-0.005648271646350622,
0.055650290101766586,
-0.004462352953851223,
0.0047292038798332214,
-0.005286029540002346,
0.0028831481467932463,
0.0002140048163710162,
0.006585280876606703,
0.00747280428186059,
-0.0023425298277288675,
0.014080449938774109,
0.005363105796277523,
0.0027320703957229853,
0.00827744323760271,
-0.0006493804394267499,
0.010125956498086452,
-0.007289254572242498,
-0.004300604574382305,
-0.0033607850782573223,
-0.009075513109564781,
0.005402644630521536,
0.00028119966736994684,
-0.007970483042299747,
0.0009833353105932474,
0.001505126478150487,
-0.01078302226960659,
0.000835529004689306,
-0.0034476404543966055,
0.0045332214795053005,
-0.010590808466076851,
-0.0023753661662340164,
-0.0028107597026973963,
-0.004301360808312893,
0.002651115646585822,
0.009761164896190166,
0.0038833662401884794,
0.00376217276789248,
-0.005663020070642233,
-0.010109116323292255,
8.888573006515799e-7,
-0.003332969034090638,
0.0010961826192215085,
0.007141966838389635,
0.00770154781639576,
-0.009868418797850609,
-0.0005895770736970007,
0.0033646211959421635,
0.0038500139489769936,
-0.0007619312964379787,
0.004600788000971079,
-0.009498627856373787,
0.00807011779397726,
0.0019732469227164984,
0.004259664565324783,
0.011607908643782139,
-0.006640077568590641,
-0.00005313722795108333,
-0.002107433043420315,
0.005327058956027031,
0.00026124855503439903,
0.006201053969562054,
0.007730185519903898,
-0.003697007428854704,
-0.0037571669090539217,
0.003352793864905834,
0.003355017863214016,
0.010653214529156685,
0.006666269153356552,
-0.004741782322525978,
0.0026240074075758457,
-0.0030327020213007927,
-0.0016405797796323895,
0.005293093156069517,
-0.006192257162183523,
0.0034242579713463783,
0.005947458557784557,
-0.014072569087147713,
-0.007824588567018509,
0.0006203721859492362,
-0.010239982977509499,
0.0006509731756523252,
0.014885048381984234,
0.011889181099832058,
-0.0032127436716109514,
0.004036919213831425,
-0.009137659333646297,
0.0025238250382244587,
0.006436130031943321,
0.0014426459092646837,
-0.01221774984151125,
-0.9576499462127686,
0.005108853802084923,
0.0034694571513682604,
-0.0012892965460196137,
0.004306980408728123,
0.0046544671058654785,
0.0040590581484138966,
0.005333709064871073,
0.01664767414331436,
-0.007957390509545803,
-0.008243749849498272,
-0.010132061317563057,
-0.011346734128892422,
0.00026001984952017665,
-0.00830270629376173,
-0.002346718916669488,
-0.006835522595793009,
-0.006831056904047728,
-0.00099616264924407,
-0.0035528128501027822,
-0.00012936560960952193,
0.005710928235203028,
0.0003761214029509574,
0.0034078543540090322,
0.001991091063246131,
0.0016855503199622035,
-0.003887288738042116,
-0.0025454373098909855,
-0.004335522186011076,
-0.0026915152557194233,
-0.007589195854961872,
-0.015535316430032253,
-0.0021672325674444437,
-0.001127244788222015,
0.011691114865243435,
-0.00016866142686922103,
0.007402861025184393,
-0.0022084570955485106,
0.00275554321706295,
-0.006817616056650877,
0.005092209670692682,
-0.0005967071047052741,
0.004836329258978367,
-0.030391670763492584,
-0.00021497275156434625,
-0.0025493029970675707,
-0.008620239794254303,
0.009308304637670517,
0.0019001425243914127,
-0.0008187700877897441,
-0.002543696900829673,
-0.007891322486102581,
0.010158971883356571,
-0.00664388295263052,
0.0023078175727277994,
-0.005044633522629738,
-0.007497264537960291,
-0.0024152547121047974,
-0.008770558051764965,
0.0024202882777899504,
0.005232465453445911,
-0.003520594211295247,
-0.004319959320127964,
-0.0020186156034469604,
0.0007151711615733802,
0.004075343254953623,
0.0015614388976246119,
-0.018763313069939613,
-0.008418132551014423,
-0.0004844896320719272,
0.006005147472023964,
-0.003374274354428053,
-0.0021115480922162533,
0.006700593512505293,
-0.00953652337193489,
0.0056792087852954865,
0.003050085622817278,
-0.0007096397457644343,
-0.011819811537861824,
0.0029414326418191195,
-0.009422057308256626,
-0.007670138962566853,
0.0003877656999975443,
-0.005824493709951639,
-0.005068077705800533,
-0.0016603339463472366,
-0.0010633534984663129,
0.008208272978663445,
-0.0033007715828716755,
0.007038552779704332,
0.011386160738766193,
-0.003903265343979001,
-0.0070611354894936085,
0.0062093292362987995,
0.00721484050154686,
-0.00027122566825710237,
-0.00037216563941910863,
-0.0007921080105006695,
0.009236888028681278,
0.005074610002338886,
0.0005343849770724773,
0.0065849898383021355,
-0.0001094675317290239,
0.007937519811093807,
-0.00014392552839126438,
0.003147524781525135,
-0.004294965416193008,
-0.0024895111564546824,
-0.006309337913990021,
-0.0016621779650449753,
-0.003374845953658223,
-0.0032261854503303766,
-0.013989601284265518,
-0.009075731039047241,
-0.0037047804798930883,
-0.00031748495530337095,
0.0017080364050343633,
-0.006169292610138655,
-0.0009694265900179744,
0.003820793703198433,
0.007961929775774479,
-0.0022252537310123444,
-0.0024144595954567194,
0.001607693382538855,
0.004463680554181337,
-0.00758893508464098,
0.014013489708304405,
-0.012219135649502277,
0.005879739299416542,
-0.002729566767811775,
-0.01542616542428732,
0.008366508409380913,
0.009388980455696583,
-0.009315392933785915,
0.0012078947620466352,
0.0029140927363187075,
0.0009976812871173024,
-0.0001452822471037507,
-0.0042618075385689735,
-0.0059759896248579025,
-0.015882570296525955,
-0.0018124714260920882,
0.019526779651641846,
0.00017965830920729786,
0.011873234994709492,
0.010720728896558285,
-0.005351451691240072,
0.001371250837109983,
0.0025876336731016636,
-0.0005439238739199936,
0.01246436033397913,
-0.009042372927069664,
-0.0006812590872868896,
0.0006849553901702166,
-0.006835721433162689,
0.0007173369522206485,
0.006990320049226284,
0.0053623695857822895,
-0.003032818203791976,
0.0025001601316034794,
-0.00781488697975874,
-0.005652605090290308,
-0.01779606007039547,
-0.0025618334766477346,
0.00858834944665432,
-0.005323545541614294,
0.007030957844108343,
-0.00881894025951624,
0.005910847336053848,
0.007435939274728298,
0.001764739747159183,
-0.0001383674389217049,
-0.0017007922288030386,
0.0062942844815552235,
0.010514460504055023,
-0.0056234304793179035,
0.004482967779040337,
0.003063781885430217,
-0.000257323234109208,
0.001350081991404295,
0.007551732938736677,
-0.007839572615921497,
-0.005548176355659962,
0.003405890194699168,
0.003074423409998417,
0.0018251455621793866,
-0.0026501368265599012,
-0.009435641579329967,
-0.004237936809659004,
0.003979403525590897,
-0.00460611330345273,
0.0025653077755123377,
0.0019789657089859247,
0.004930656403303146,
-0.00618204940110445,
0.0014561581192538142,
-0.006036246195435524,
-0.011395887471735477,
0.012582272291183472,
-0.0026778087485581636,
0.0014384544920176268,
0.012394960969686508,
0.0054791574366390705,
-0.014634648337960243,
0.007948067039251328,
0.008724721148610115,
-0.004907991737127304,
0.004789341706782579,
0.004863608628511429,
-0.005088286008685827,
-0.02332734689116478,
-0.00205549830570817,
-0.015086744911968708,
0.00652715191245079,
-0.0043821134604513645,
0.0025532536674290895,
-0.006637374870479107,
0.004117579665035009,
0.004921393468976021,
-0.013512584380805492,
-0.004704383667558432,
-0.009146190248429775,
0.009014231152832508,
-0.0011383398668840528,
0.0008253490086644888,
-0.0029346237424761057,
-0.0017946246080100536,
-0.0028076244052499533,
-0.001978290034458041,
-0.0014583509182557464,
0.004375367891043425,
0.001361488364636898,
-0.003025089856237173,
0.0030390829779207706,
-0.006605062633752823,
-0.00021554996783379465,
0.0005670685204677284,
-0.010731044225394726,
0.003310943953692913,
0.004828149452805519,
-0.002321426523849368,
-0.0024510836228728294,
-0.00026718623121269047,
-0.0024795602075755596,
-0.004243569914251566,
-0.010429401881992817,
-0.005310565233230591,
-0.002128694439306855,
-0.002510356716811657,
-0.011041661724448204,
-0.002685862360522151,
-0.009348107501864433,
0.005610696971416473,
-0.008639245294034481,
0.006725773680955172,
0.006031964439898729,
-0.004607185255736113,
0.007822616025805473,
-0.001911439816467464,
0.003971598111093044,
0.003243309212848544,
0.007098078727722168,
-0.00041857105679810047,
-0.008352933451533318,
-0.011460799723863602,
0.01333373598754406,
-0.0074710301123559475,
0.0009148729732260108,
0.014057236723601818,
0.0031921654008328915,
0.01193016953766346,
-0.0008667687070555985,
0.0004266410833224654,
0.0035421857610344887,
0.007011322770267725,
-0.013613041490316391,
0.00542176840826869,
-0.003717774758115411,
-0.000027385422072256915,
0.006569801364094019,
-0.0019490137929096818,
-0.00031740625854581594,
0.01020239107310772,
0.0013877562014386058,
-0.007275053765624762,
-0.0042076632380485535,
0.0017559099942445755,
0.006215760484337807,
-0.01290925033390522,
-0.001114956452511251,
-0.004575888626277447,
-0.0028476177249103785,
-0.002511837752535939,
-0.002030700910836458,
-0.00012597224849741906,
0.003947987221181393,
-0.003895617090165615,
0.005937131587415934,
0.0027297786436975002,
-0.0038533343467861414,
0.016415638849139214,
-0.005672660656273365,
-0.006317418534308672,
0.004365934059023857,
0.003727762261405587,
-0.002407751977443695,
-0.006679834797978401,
-0.003292960813269019,
0.002534265862777829,
0.0049255951307713985,
-0.0008743318030610681,
-0.004220621194690466,
-0.0027043893933296204,
-0.0009743108530528843,
-0.007558023557066917,
0.0017352085560560226,
0.011190241202712059,
-0.003468620590865612,
0.005330964922904968,
-0.0008371142903342843,
-0.00773512152954936,
-0.014358907006680965,
0.05353091284632683,
-0.0006847605691291392,
0.003556325798854232,
0.0035960220266133547,
-0.007821864448487759,
0.0004327314381953329,
-0.0034173994790762663,
0.0076912702061235905,
-0.00666038179770112,
-0.010187405161559582,
0.00749835092574358,
-0.0038583374116569757,
0.0035735531710088253,
0.004543955437839031,
-0.001955469371750951,
0.014996632933616638,
-0.0015879232669249177,
-0.017208542674779892,
-0.014912587590515614,
0.00932042021304369,
-0.003937529865652323,
-0.007448473013937473,
0.010108357295393944,
-0.002308710478246212,
-0.006694435607641935,
0.0022127078846096992,
0.005138650070875883,
0.0032062947284430265,
0.002280388493090868,
-0.004513189662247896,
-0.001995884580537677,
-0.00161564105655998,
0.0036601892206817865,
0.004812354687601328,
0.005350162740796804,
-0.0029433430172502995,
0.0038267546333372593,
-0.002613971708342433,
-0.0006725761340931058,
-0.00003339882459840737,
0.0037678349763154984,
0.006804918870329857,
-0.0018289447762072086,
-0.0017614936223253608,
0.004871081095188856,
0.004735204391181469,
0.0025600327644497156,
0.01050568651407957,
0.0001282889279536903,
-0.006922115106135607,
0.008855070918798447,
0.005325965583324432,
0.0010910661658272147,
0.007219860330224037,
-0.001557820593006909,
0.005073468200862408,
0.002161787822842598,
-0.005184257868677378,
-0.01596379652619362,
-0.0010676198871806264,
0.004838250577449799,
0.008578216657042503,
-0.00006244912219699472,
0.0013349535875022411,
-0.0018574774730950594,
-0.0007629477186128497,
-0.007419737521559,
-0.007509072311222553,
-0.004321740474551916,
0.00032852214644663036,
0.0010413210839033127,
0.07184629142284393,
-0.005549598950892687,
-0.0025493961293250322,
-0.009119890630245209,
-0.001356178312562406,
-0.0036584336776286364,
-0.0015246919356286526,
-0.0008020645473152399,
-0.0013554608449339867,
0.0048220898024737835,
0.0023543224669992924,
-0.0070725432597100735,
-0.01167407725006342,
0.00229657138697803,
0.0015498728025704622,
-0.003365115262567997,
0.008044734597206116,
0.006291424389928579,
-0.007987670600414276,
0.0006571922567673028,
-0.01169061940163374,
-0.0031130239367485046,
-0.0032853574957698584,
-0.008357900194823742,
-0.002302193781360984,
-0.0018266728147864342,
0.0040059504099190235,
0.002552173798903823,
0.008622214198112488,
-0.0037294388748705387,
0.005017878022044897,
-0.0016501114005222917,
-0.0001704301539575681,
-0.0022456625010818243,
-0.0005245528882369399,
-0.008403421379625797,
0.0065148212015628815,
0.0008158946875482798,
-0.008958033286035061,
-0.005250359419733286,
-0.0020813981536775827,
0.0024390616454184055,
-0.0032717345748096704,
0.0058663045056164265,
0.0022958347108215094,
0.007309147156774998,
-0.003734620288014412,
-0.0011431275634095073,
-0.007467212155461311,
0.0004029196861665696,
-0.011620310135185719,
0.0053377519361674786,
-0.17609630525112152,
0.009385590441524982,
0.0036455632653087378,
-0.00516037130728364,
-0.0018087017815560102,
-0.015687735751271248,
-0.006444213446229696,
0.0030173170380294323,
0.010282604955136776,
0.0003056642017327249,
0.00036163063487038016,
-0.004149915650486946,
0.0009551916155032814,
0.0035809981636703014,
-0.0006632977165281773,
-0.0052919331938028336,
0.004134830553084612,
-0.005994701292365789,
0.0025233591441065073,
0.005311242304742336,
0.004872994031757116,
0.010646122507750988,
0.0034118439070880413,
-0.0005013120826333761,
-0.0014228952350094914,
-0.0046085938811302185,
0.00712271174415946,
-0.0012194339651614428,
0.005210432689636946,
-0.010100528597831726,
-0.0017352255526930094,
-0.004108057357370853,
-0.00448828749358654,
0.000672179798129946,
0.005333512555807829,
-0.00040304014692083,
0.0076868911273777485,
0.005203025881201029,
-0.009846380911767483,
0.007338158320635557,
-0.005392810795456171,
0.02627178095281124,
0.005515876226127148,
0.0056857396848499775,
0.00013821055472362787,
-0.0067490204237401485,
-0.004542024806141853,
0.00702354870736599,
0.0019064490916207433,
0.011005118489265442,
-0.011932081542909145,
-0.003202886087819934,
0.00210039340890944,
0.016775500029325485,
-0.005181815009564161,
-0.007213367149233818,
-0.0061266361735761166,
-0.0026166976895183325,
0.003390609985217452,
0.009000638499855995,
0.00994368176907301,
-0.003748777322471142,
0.006846799980849028,
-0.004029727540910244,
-0.021950749680399895,
0.0024285647086799145,
-0.003375646425411105,
-0.008691330440342426,
0.002808318007737398,
0.009622465819120407,
0.00794974248856306,
0.0007496030302718282,
0.0025415897835046053,
-0.001266832579858601,
0.005743162706494331,
0.00116774532943964,
0.007244154345244169,
-0.0021560124587267637,
0.004928546957671642,
-0.011895675212144852,
0.0069040339440107346,
-0.010705173946917057,
-0.002724793739616871,
0.0009994694264605641,
-0.004083347041159868,
0.013041608966886997,
0.0038767107762396336,
-0.0020981538109481335,
-0.001134931342676282,
-0.00925231073051691,
-0.0025200166273862123,
0.0028687454760074615,
0.0009819071274250746,
-0.008552433922886848,
0.000737992231734097,
-0.0027184002101421356,
0.006490997038781643,
0.008276039734482765,
-0.006667927373200655,
0.007718175183981657,
0.004834386520087719,
-0.004664398264139891,
0.0004951371811330318,
-0.0029768068343400955,
0.0021186969242990017,
0.005381470546126366,
-0.00634338241070509,
-0.004293794743716717,
0.003776960540562868,
-0.0060605015605688095,
-0.00724771386012435,
0.007011844776570797,
-0.009082114323973656,
-0.009199906140565872,
-0.002674794290214777,
-0.011452022939920425,
-0.00004448720210348256
] |
8a6e9d6c995b4c34ef5a6722c4973c2c7fb333f1 | 1,065 | py | Python | projects/eyetracking/gen_adhd_sin.py | nirdslab/streaminghub | a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf | [
"MIT"
] | null | null | null | projects/eyetracking/gen_adhd_sin.py | nirdslab/streaminghub | a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf | [
"MIT"
] | null | null | null | projects/eyetracking/gen_adhd_sin.py | nirdslab/streaminghub | a0d9f5f8be0ee6f090bd2b48b9f596695497c2bf | [
"MIT"
] | 1 | 2020-01-22T15:35:29.000Z | 2020-01-22T15:35:29.000Z | #!/usr/bin/env python3
import glob
import os
import pandas as pd
import dfs
SRC_DIR = f"{dfs.get_data_dir()}/adhd_sin_orig"
OUT_DIR = f"{dfs.get_data_dir()}/adhd_sin"
if __name__ == '__main__':
files = glob.glob(f"{SRC_DIR}/*.csv")
file_names = list(map(os.path.basename, files))
for file_name in file_names:
df: pd.DataFrame = pd.read_csv(f'{SRC_DIR}/{file_name}').set_index('EyeTrackerTimestamp').sort_index()[
['GazePointX (ADCSpx)', 'GazePointY (ADCSpx)', 'PupilLeft', 'PupilRight']].reset_index()
df.columns = ['t', 'x', 'y', 'dl', 'dr']
# fill blanks (order=interpolate(inter)->bfill+ffill(edges))->zerofill
df = df.apply(lambda x: x.interpolate().fillna(method="bfill").fillna(method="ffill")).fillna(0)
df['x'] = df['x'] / 1920
df['y'] = df['y'] / 1080
df['d'] = (df['dl'] + df['dr']) / 2
# start with t=0, and set unit to ms
df['t'] = (df['t'] - df['t'].min()) / 1000
df = df[['t', 'x', 'y', 'd']].round(6).set_index('t')
df.to_csv(f'{OUT_DIR}/{file_name}')
print(f'Processed: {file_name}')
| 35.5 | 107 | 0.613146 | 1 | 1.1571 | [
0.0009929775260388851,
0.02600046433508396,
0.0088846106082201,
0.0008044703863561153,
0.004367690533399582,
-0.004342986736446619,
-0.007914166897535324,
0.0021937366109341383,
-0.00972522608935833,
0.0019061225466430187,
0.0027674485463649035,
0.004383384250104427,
0.008873267099261284,
-0.019070925191044807,
0.00023463006073143333,
0.01706070452928543,
-0.05370154604315758,
0.0028436770662665367,
-0.004327676258981228,
0.0018984845373779535,
-0.011285104788839817,
0.009367589838802814,
0.008512750267982483,
0.006649084389209747,
0.004257232882082462,
-0.0013852666597813368,
0.011222397908568382,
0.0018987657967954874,
-0.007959346286952496,
-0.006343162152916193,
-0.0003260473895352334,
-0.0010462097125127912,
-0.0077173421159386635,
-0.00748838484287262,
0.005551216658204794,
-0.0030793240293860435,
0.0012580470647662878,
-0.01921485736966133,
0.011934544891119003,
-0.005782338324934244,
-0.006653904914855957,
-0.01547587476670742,
0.0013279924169182777,
0.004830870311707258,
-0.009772130288183689,
0.00010853421554202214,
-0.005030796397477388,
-0.00011833476310130209,
-0.009498370811343193,
0.005818057339638472,
-0.008300911635160446,
0.004461031872779131,
0.013799868524074554,
0.003401639871299267,
-0.004346643108874559,
-0.007546187378466129,
0.01376308687031269,
0.0018546449718996882,
-0.011630433611571789,
-0.00264145340770483,
-0.003509086323902011,
-0.0025732796639204025,
0.006853211671113968,
0.0027852612547576427,
-0.016601435840129852,
-0.007659864146262407,
-0.007456178776919842,
0.002307628048583865,
-0.001202447572723031,
0.006194290705025196,
0.0024328758008778095,
0.0005204047192819417,
0.005173879209905863,
0.003754237899556756,
0.0031195757910609245,
-0.004177701193839312,
-0.0011457364307716489,
0.0020916806533932686,
0.009737682528793812,
0.004077042452991009,
0.004601757507771254,
-0.007064121309667826,
0.005132291931658983,
0.01150644849985838,
0.014492826536297798,
0.00821941439062357,
0.02063179574906826,
-0.011215678416192532,
0.044114645570516586,
0.006127441301941872,
-0.010714652016758919,
0.0017221852904185653,
-0.011111986823379993,
-0.0040298025123775005,
-0.0032950600143522024,
-0.031416699290275574,
-0.0002660572645254433,
-0.0029272641986608505,
-0.00004997291762265377,
0.004232568200677633,
0.0005179608124308288,
0.00841555092483759,
0.0009363792487420142,
-0.0030350591987371445,
-0.009870563633739948,
0.01210029423236847,
-0.008312568068504333,
-0.0012433369411155581,
0.007969191297888756,
0.0013399743475019932,
-0.014437654986977577,
-0.00078645593021065,
0.000785635900683701,
-0.013193527236580849,
0.0045959861017763615,
0.00342763215303421,
-0.0060335565358400345,
0.0545521005988121,
-0.001674665603786707,
0.003612457774579525,
-0.0033764084801077843,
-0.0006520777242258191,
0.002608342096209526,
0.008188879117369652,
0.007875722832977772,
-0.0038128835149109364,
0.012673500925302505,
0.008369137533009052,
0.0055198040790855885,
0.005792473442852497,
-0.0016567398561164737,
0.0070914640091359615,
-0.0038036962505429983,
-0.0016799141885712743,
0.002035787794739008,
-0.007499870844185352,
0.007714116480201483,
-0.001256661838851869,
-0.006298691965639591,
0.0025695767253637314,
-0.00017589551862329245,
-0.010290388017892838,
0.0022447556257247925,
-0.005055234767496586,
0.003082631854340434,
-0.011519815772771835,
-0.003940042573958635,
-0.003689056495204568,
-0.005810437258332968,
0.0028612359892576933,
0.008755364455282688,
0.0035829301923513412,
0.0032626455649733543,
-0.005453780293464661,
-0.007347156293690205,
-0.0007897870964370668,
-0.004511445760726929,
0.0036475767847150564,
0.0067777992226183414,
0.003405933966860175,
-0.009409609250724316,
0.0004830424441024661,
0.005086787045001984,
0.006567530333995819,
-0.00005006344508728944,
0.004687321372330189,
-0.009084352292120457,
0.009211834520101547,
-0.0000892680327524431,
0.0043961056508123875,
0.01265569869428873,
-0.005044001620262861,
0.000037048852391308174,
-0.0006407155888155103,
0.004555555060505867,
-0.00007291706424439326,
0.005725746508687735,
0.012373123317956924,
-0.003867369145154953,
-0.005364586133509874,
0.005173467565327883,
0.0034992278087884188,
0.006750794593244791,
0.009340159595012665,
-0.0017846651608124375,
0.0016905588563531637,
-0.005188825540244579,
-0.0007157378131523728,
0.006671059411019087,
-0.00555248511955142,
0.005532152950763702,
0.005613171961158514,
-0.014947581104934216,
-0.007322668097913265,
0.00020990148186683655,
-0.010741791687905788,
0.0019802225288003683,
0.015929581597447395,
0.010817145928740501,
0.00005360047362046316,
0.0037049080710858107,
-0.011053451336920261,
0.0009324582060799003,
0.00905578676611185,
0.0014673685654997826,
-0.01188700832426548,
-0.9569040536880493,
0.005708830896764994,
0.004328332841396332,
-0.0024754172191023827,
0.0054407124407589436,
0.004058490972965956,
0.0018325664568692446,
0.004385560750961304,
0.015354705043137074,
-0.007384615018963814,
-0.005788022186607122,
-0.009132270701229572,
-0.010926377959549427,
-0.0005931835621595383,
-0.00875953957438469,
-0.002972885500639677,
-0.006855524145066738,
-0.007882848381996155,
-0.001996331848204136,
-0.0043014902621507645,
-0.0019378437427803874,
0.007541973143815994,
-0.0022321967408061028,
0.0044367494992911816,
0.0045533510856330395,
0.0018906318582594395,
-0.004177679307758808,
-0.0035583474673330784,
-0.0009973268024623394,
-0.0036121506709605455,
-0.007597404532134533,
-0.01290225237607956,
-0.003896682523190975,
-0.0022097351029515266,
0.012946350499987602,
0.0010183971608057618,
0.009784398600459099,
-0.0031341935973614454,
0.0004966449341736734,
-0.00934242270886898,
0.0071992166340351105,
0.0001519657816970721,
0.0019651351030915976,
-0.02850167080760002,
-0.0014190992806106806,
-0.0007387068471871316,
-0.009090145118534565,
0.00582176074385643,
0.001332159386947751,
0.000381533958716318,
-0.005061091855168343,
-0.006336021702736616,
0.008687183260917664,
-0.008616456761956215,
0.0037164990790188313,
-0.0053558084182441235,
-0.008668482303619385,
-0.0013862875057384372,
-0.007511192932724953,
0.0004544914118014276,
0.004645707551389933,
-0.0030281448271125555,
-0.004175409208983183,
-0.00405476801097393,
0.0037079344037920237,
0.002134628826752305,
0.0048302034847438335,
-0.018788158893585205,
-0.0062487474642694,
-0.0016953666927292943,
0.0036009480245411396,
-0.0015242422232404351,
-0.002213601488620043,
0.004293845500797033,
-0.008874024264514446,
0.0050203134305775166,
0.0011262843618169427,
0.0009684652904979885,
-0.009583537466824055,
-0.000616281118709594,
-0.010548898950219154,
-0.008757345378398895,
0.0035553877241909504,
-0.004639154765754938,
-0.0047800675965845585,
-0.0011903780978173018,
0.0013702817959710956,
0.00972294807434082,
-0.005166078917682171,
0.002735731890425086,
0.011110763065516949,
-0.0037997467443346977,
-0.011739732697606087,
0.005894147325307131,
0.006354406010359526,
0.0010425798827782273,
-0.002076664473861456,
0.0025954253505915403,
0.007504289038479328,
0.007925836369395256,
0.001432271907106042,
0.0061822193674743176,
-0.0007272823713719845,
0.011685112491250038,
-0.0005133686936460435,
0.0032252450473606586,
-0.004235693719238043,
-0.001002107048407197,
-0.005255991127341986,
0.00006650085560977459,
-0.005445912480354309,
-0.0015758330700919032,
-0.011156528256833553,
-0.008731217123568058,
-0.004467661492526531,
0.0006506107747554779,
0.002769800601527095,
-0.005973937921226025,
-0.0010111386654898524,
0.000859495485201478,
0.009932161308825016,
-0.0006867439369671047,
-0.0049951947294175625,
-0.0016841809265315533,
-0.0015473231906071305,
-0.0054188137874007225,
0.015094977803528309,
-0.008955406956374645,
0.006356882397085428,
-0.0020192184019833803,
-0.014763975515961647,
0.00867847166955471,
0.010710629634559155,
-0.008873716928064823,
0.0022426843643188477,
-0.0005072714993730187,
0.004084156360477209,
-0.0016056938329711556,
-0.005704403389245272,
-0.003298394149169326,
-0.017919426783919334,
0.0002739136398304254,
0.01970781572163105,
0.001968476688489318,
0.011320332996547222,
0.012481773272156715,
-0.0033472548238933086,
0.0023096585646271706,
0.007632951717823744,
0.0018715189071372151,
0.013453151099383831,
-0.009475912898778915,
-0.00021584267960861325,
0.0023171287029981613,
-0.006351785734295845,
0.0029555070213973522,
0.004741436801850796,
0.003162733744829893,
-0.0036767420824617147,
0.002732223365455866,
-0.005964368581771851,
-0.005797584541141987,
-0.01726285181939602,
-0.00166881934273988,
0.007254588417708874,
-0.005942422430962324,
0.006659431383013725,
-0.012714371085166931,
0.0028677501250058413,
0.0033566132187843323,
0.0054235863499343395,
-0.00002612140087876469,
0.0013163656694814563,
0.007668537087738514,
0.012972281314432621,
-0.006911227945238352,
0.002319769002497196,
0.0032255721744149923,
-0.0027965665794909,
0.002052599098533392,
0.0071197994984686375,
-0.007710759993642569,
-0.004628382623195648,
0.003052574349567294,
0.004503484349697828,
-0.0008966851746663451,
-0.0031214554328471422,
-0.009332284331321716,
-0.0030743167735636234,
0.0013935560127720237,
-0.003573681926354766,
0.002984717022627592,
0.0011579071870073676,
0.0021113480906933546,
-0.007102549076080322,
0.0010738647542893887,
-0.004253768362104893,
-0.010704124346375465,
0.009621157310903072,
-0.0015133883571252227,
0.00215405342169106,
0.012725027278065681,
0.0036156245041638613,
-0.01400710828602314,
0.007033594883978367,
0.008556105196475983,
-0.0032185378950089216,
0.0032201323192566633,
0.007839643396437168,
-0.003534234594553709,
-0.02205568552017212,
-0.0026565617881715298,
-0.013217896223068237,
0.006874365266412497,
-0.0026613108348101377,
0.00009120766480918974,
-0.008877355605363846,
0.007758704945445061,
0.004175054375082254,
-0.01577100344002247,
-0.005699298810213804,
-0.009631415829062462,
0.010254253633320332,
0.001444679801352322,
-0.002533153397962451,
-0.0036750163417309523,
-0.0021474063396453857,
-0.0021113373804837465,
-0.003686056239530444,
-0.0016749616479501128,
0.0037121574860066175,
0.0008443954866379499,
-0.002035106299445033,
0.002704567275941372,
-0.0027414823416620493,
0.0014704143395647407,
-0.00010369760275352746,
-0.01075034961104393,
-0.00014446277054958045,
0.004624857101589441,
-0.0020294066052883863,
-0.0031347940675914288,
0.0007632711785845459,
-0.0022363103926181793,
-0.007883516140282154,
-0.012046316638588905,
-0.006047562696039677,
-0.00579068623483181,
-0.004067599307745695,
-0.010578383691608906,
-0.004237812478095293,
-0.008712965995073318,
0.007289547007530928,
-0.005910838022828102,
0.007358067203313112,
0.005666592624038458,
-0.0038016594480723143,
0.00656674662604928,
-0.0009945012861862779,
0.005813467316329479,
0.001251143286935985,
0.005214293487370014,
0.0025082984939217567,
-0.006205608602613211,
-0.01081917155534029,
0.010472956113517284,
-0.009570382535457611,
0.002277570078149438,
0.01191724743694067,
0.0032570597250014544,
0.010140066966414452,
-0.001087674987502396,
-0.00027664980734698474,
0.0033939580898731947,
0.009118550457060337,
-0.014208903536200523,
0.00452439347282052,
-0.0038559697568416595,
-0.0015470414655283093,
0.003746611997485161,
-0.003978785593062639,
0.004286816343665123,
0.009158185683190823,
0.0018019727431237698,
-0.007082921452820301,
-0.0020439752843230963,
0.0031415445264428854,
0.0043950011022388935,
-0.012355544604361057,
-0.0015547132352367043,
-0.0023562752176076174,
-0.005559572484344244,
-0.002665929729118943,
-0.0006884876056574285,
-0.0009111353429034352,
0.004051090218126774,
-0.0026964338030666113,
0.00716385617852211,
0.004260016139596701,
-0.004404681734740734,
0.01496032439172268,
-0.005033022724092007,
-0.005257350392639637,
0.0055718496441841125,
0.001727792900055647,
-0.004340031649917364,
-0.007630797103047371,
-0.002583559136837721,
0.0004360403399914503,
0.005361655261367559,
-0.0036756715271621943,
-0.005776225123554468,
-0.0005286959349177778,
0.0019217670196667314,
-0.00798790156841278,
-0.00018409197218716145,
0.011682356707751751,
-0.003844721708446741,
0.006260639987885952,
0.00029419586644507945,
-0.0064490120857954025,
-0.014733589254319668,
0.05348624289035797,
-0.001130150631070137,
0.0044565824791789055,
0.005128437653183937,
-0.006922855507582426,
0.000594260694924742,
-0.0010205496801063418,
0.008238022215664387,
-0.00803129281848669,
-0.004794161766767502,
0.008586145006120205,
-0.004718944430351257,
0.0024821069091558456,
0.0012805075384676456,
-0.0008607070776633918,
0.015435909852385521,
-0.0031779941637068987,
-0.01714630238711834,
-0.017230840399861336,
0.006542248651385307,
-0.003906312398612499,
-0.005723695736378431,
0.008183935657143593,
-0.005295140668749809,
-0.0009364071884192526,
0.0011805129470303655,
0.0052041420713067055,
0.00041137723019346595,
-0.0007083062082529068,
-0.001396339270286262,
-0.002684877021238208,
-0.0014976410893723369,
0.004151844419538975,
0.00677314680069685,
0.008712477050721645,
-0.0014055334031581879,
0.005982952658087015,
0.00010267506149830297,
-0.0005164690664969385,
-0.002445243066176772,
0.0065736323595047,
0.006002378650009632,
-0.0010890684789046645,
-0.0013242578133940697,
0.006678638979792595,
0.006308895070105791,
0.000011261248801019974,
0.012339945882558823,
0.0005498831160366535,
-0.005073650274425745,
0.008381708525121212,
0.006390641909092665,
-0.002562740119174123,
0.007919378578662872,
-0.0009397192043252289,
0.00594279495999217,
0.002606781665235758,
-0.00891246646642685,
-0.013522433117032051,
0.00008263390191132203,
0.00901039969176054,
0.007231433410197496,
-0.003162732347846031,
0.0030128739308565855,
-0.0015038831625133753,
-0.005502320360392332,
-0.009566321037709713,
-0.00702084181830287,
-0.0018532763933762908,
0.0018379848916083574,
0.004150004126131535,
0.07299632579088211,
-0.007554544601589441,
-0.0011224825866520405,
-0.0072427731938660145,
-0.0017036738572642207,
-0.0003875338879879564,
-0.0007081275689415634,
0.0008400873630307615,
-0.002242505317553878,
0.001730576972477138,
0.0024077678099274635,
-0.009891333989799023,
-0.011100287549197674,
0.0010739790741354227,
0.003641759045422077,
-0.0021090921945869923,
0.003987903706729412,
0.006104632280766964,
-0.011027926579117775,
0.0024415731895715,
-0.01184789091348648,
-0.0018737867940217257,
-0.0018766495632007718,
-0.008995884098112583,
-0.003698932472616434,
-0.0033882849384099245,
0.004085229244083166,
0.002955593401566148,
0.0029993990901857615,
-0.00273716589435935,
0.0062182992696762085,
-0.002481098985299468,
0.0007201968692243099,
-0.003896730486303568,
-0.00020999762637075037,
-0.004993051756173372,
0.008721175603568554,
0.001181510160677135,
-0.011918987147510052,
-0.008102111518383026,
-0.0019227673765271902,
0.00044814846478402615,
-0.006885402835905552,
0.004557609558105469,
-0.0015555534046143293,
0.0034212584141641855,
-0.0028732591308653355,
0.0016610256861895323,
-0.006183421239256859,
0.0021193199791014194,
-0.011257810518145561,
0.006824341136962175,
-0.17735834419727325,
0.010853039100766182,
0.0023702981416136026,
-0.005604134406894445,
-0.002451441017910838,
-0.013843592256307602,
-0.006464769598096609,
0.0019123348174616694,
0.01035007182508707,
0.0009537114528939128,
-0.0033469507470726967,
-0.0012692484306171536,
0.005031443201005459,
0.002540446585044265,
-0.0026834725867956877,
-0.003969436511397362,
0.004499192349612713,
-0.0015353383496403694,
0.00011811697913799435,
0.003164560068398714,
0.004713752306997776,
0.0076430924236774445,
0.001824726932682097,
0.0018877676920965314,
-0.0008474145433865488,
-0.004608112387359142,
0.003955106716603041,
-0.001855132170021534,
0.0035806812811642885,
-0.013894233852624893,
-0.003770474810153246,
-0.003462556516751647,
-0.003451745258644223,
-0.00045543565647676587,
0.003684127703309059,
-0.0019994396716356277,
0.007435792591422796,
0.0006709519075229764,
-0.008641541004180908,
0.007364275865256786,
-0.006519829388707876,
0.03151066601276398,
0.002760876202955842,
0.00610820297151804,
-0.0004956762422807515,
-0.005745068192481995,
-0.0045883432030677795,
0.009360764175653458,
0.0027553983964025974,
0.013324497267603874,
-0.012488563545048237,
-0.0037360379938036203,
0.004126603249460459,
0.01925593428313732,
-0.004677759483456612,
-0.01016386691480875,
-0.0070662363432347775,
-0.0038977796211838722,
0.0032388032414019108,
0.008000821806490421,
0.010389569215476513,
-0.005326524842530489,
0.008981169201433659,
-0.0024767688009887934,
-0.020483622327446938,
0.003922710195183754,
-0.005174440797418356,
-0.006043528206646442,
-0.0007574951159767807,
0.009609919041395187,
0.010152792558073997,
0.0003499974263831973,
0.005730332341045141,
-0.002118981210514903,
0.00589981721714139,
-0.00124746176879853,
0.007188690826296806,
-0.001299839117564261,
0.007802923675626516,
-0.009446432814002037,
0.011178786866366863,
-0.010798653587698936,
-0.0014444709522649646,
0.0029712875839322805,
-0.004029272124171257,
0.007788396440446377,
0.005151072051376104,
-0.0038899153005331755,
-0.0006459926953539252,
-0.010091019794344902,
-0.0019412909168750048,
0.0025625182315707207,
0.0033813861664384604,
-0.00859050452709198,
0.0027707673143595457,
-0.0006856630789116025,
0.003809421556070447,
0.007453151512891054,
-0.00936726201325655,
0.005518188700079918,
0.006074263248592615,
-0.005947727244347334,
-0.0016931876307353377,
-0.00545775331556797,
0.002778588095679879,
0.0037394727114588022,
-0.003341946518048644,
-0.007563119288533926,
0.004792585503309965,
-0.007757734041661024,
-0.003883965080603957,
0.006271555088460445,
-0.010491692461073399,
-0.006864073220640421,
-0.0007129735313355923,
-0.009312822483479977,
-0.0011021711397916079
] |
8a6f626dba5ce35c66724326d654b9ba19117497 | 4,322 | py | Python | dataProcessing.py | TauferLab/PENGUIN | af789163078310f2504b8a0163df4395ccf119f1 | [
"Apache-2.0"
] | null | null | null | dataProcessing.py | TauferLab/PENGUIN | af789163078310f2504b8a0163df4395ccf119f1 | [
"Apache-2.0"
] | null | null | null | dataProcessing.py | TauferLab/PENGUIN | af789163078310f2504b8a0163df4395ccf119f1 | [
"Apache-2.0"
] | null | null | null | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import matplotlib.pyplot as plt
import CurveFit
import shutil
#find all DIRECTORIES containing non-hidden files ending in FILENAME
def getDataDirectories(DIRECTORY, FILENAME="valLoss.txt"):
directories=[]
for directory in os.scandir(DIRECTORY):
for item in os.scandir(directory):
if item.name.endswith(FILENAME) and not item.name.startswith("."):
directories.append(directory.path)
return directories
#get all non-hidden data files in DIRECTORY with extension EXT
def getDataFiles(DIRECTORY, EXT='txt'):
datafiles=[]
for item in os.scandir(DIRECTORY):
if item.name.endswith("."+EXT) and not item.name.startswith("."):
datafiles.append(item.path)
return datafiles
#checking if loss ever doesn't decrease for numEpochs epochs in a row.
def stopsDecreasing(loss, epoch, numEpochs):
minLoss=np.inf
epochMin=0
for i in range(0,loss.size):
if loss[i] < minLoss:
minLoss=loss[i]
epochMin=epoch[i]
elif (epoch[i]-epochMin) >= numEpochs:
return i, minLoss
return i, minLoss
#dirpath is where the accuracy and loss files are stored. want to move the files into the same format expected by grabNNData.
def createFolders(SEARCHDIR, SAVEDIR):
for item in os.scandir(SEARCHDIR):
name=str(item.name)
files=name.split('-')
SAVEFULLDIR=SAVEDIR+str(files[0])
if not os.path.exists(SAVEFULLDIR):
try:
os.makedirs(SAVEFULLDIR)
except FileExistsError:
#directory already exists--must have been created between the if statement & our attempt at making directory
pass
shutil.move(item.path, SAVEFULLDIR+"/"+str(files[1]))
#a function to read in information (e.g. accuracy, loss) stored at FILENAME
def grabNNData(FILENAME, header='infer', sep=' '):
data = pd.read_csv(FILENAME, sep, header=header)
if ('epochs' in data.columns) and ('trainLoss' in data.columns) and ('valLoss' in data.columns) and ('valAcc' in data.columns) and ('batch_size' in data.columns) and ('learning_rate' in data.columns):
sortedData=data.sort_values(by="epochs", axis=0, ascending=True)
epoch=np.array(sortedData['epochs'])
trainLoss=np.array(sortedData['trainLoss'])
valLoss=np.array(sortedData['valLoss'])
valAcc=np.array(sortedData['valAcc'])
batch_size=np.array(sortedData['batch_size'])
learning_rate=np.array(sortedData['learning_rate'])
convKers=np.array(sortedData['convKernels'])
return(epoch, trainLoss, valLoss, valAcc, batch_size, learning_rate, convKers)
elif ('epochs' in data.columns) and ('trainLoss' in data.columns) and ('valLoss' in data.columns) and ('valAcc' in data.columns):
sortedData=data.sort_values(by="epochs", axis=0, ascending=True)
epoch=np.array(sortedData['epochs'])
trainLoss=np.array(sortedData['trainLoss'])
valLoss=np.array(sortedData['valLoss'])
valAcc=np.array(sortedData['valAcc'])
else:
print("Missing a column in NN datafile")
raise Exception('NN datafile is missing one of the expected columns: epochs trainLoss valLoss valAcc [optional extra columns: batch_size, learning_rate]')
#slice data could be used to test values of E other than E=0.5, which we use by default
def sliceData(xsize, x, y, z=None, w=None):
#we can slice the data to sample less often, but not more often. We verify that we're not being asked for a granularity that is smaller than the frequency of datapoints in the vectors.
if x[0] > xsize:
return x,y,z,w
else:
result=(1.0/x[0])*xsize
#result is how often we should take datapoints if we wish to consider values every xsize
x=x[int(result-1)::int(result)]
y=y[int(result-1)::int(result)]
if z is not None:
z=z[int(result-1)::int(result)]
if w is None:
return x,y,z
else:
return x,y
#if we get to this point in function, it means z and w are both not None.
w=w[int(result-1)::int(result)]
return x,y,z,w
| 38.936937 | 204 | 0.657103 | 1 | 2.0736 | [
-0.01976056396961212,
0.012673063203692436,
0.014695616438984871,
0.0010373700642958283,
0.008364156819880009,
-0.03762582316994667,
0.023110046982765198,
-0.008157819509506226,
-0.004005684517323971,
-0.0012254666071385145,
-0.012259893119335175,
0.00784369558095932,
0.027731671929359436,
0.02735058404505253,
-0.024300601333379745,
-0.021755371242761612,
0.0005178852588869631,
0.0216189194470644,
0.03213413432240486,
0.011574266478419304,
-0.0005708650569431484,
-0.01796964928507805,
-0.00853105541318655,
0.02245285175740719,
-0.026426460593938828,
0.026666056364774704,
0.02837369590997696,
0.02202565409243107,
0.006411557085812092,
0.02068750001490116,
-0.006788038648664951,
-0.04056229069828987,
0.041232381016016006,
-0.03808673471212387,
-0.04844598099589348,
-0.005363095551729202,
0.007273103576153517,
-0.04990672692656517,
0.018043560907244682,
0.00021078420104458928,
-0.00622783787548542,
0.03207894787192345,
-0.018069079145789146,
0.025783218443393707,
-0.003000920871272683,
-0.022943906486034393,
0.018689332529902458,
-0.08647654950618744,
0.044384248554706573,
-0.023070406168699265,
0.047378528863191605,
-0.009872051887214184,
-0.0034659483935683966,
0.006510290317237377,
-0.015029181726276875,
-0.029574114829301834,
-0.006346403155475855,
0.055079225450754166,
0.006828077603131533,
-0.00900854729115963,
-0.008516006171703339,
-0.03133702278137207,
0.010620390996336937,
0.010906978510320187,
0.02634025365114212,
0.0028229623567312956,
-0.012748152948915958,
-0.004156743176281452,
-0.052316632121801376,
-0.05607999116182327,
0.024336358532309532,
0.01030102837830782,
0.04337768256664276,
0.02598629891872406,
-0.03681478649377823,
-0.016041748225688934,
-0.006406843662261963,
-0.019763953983783722,
-0.0040283710695803165,
-0.0054962350986897945,
-0.018049459904432297,
0.07404407113790512,
0.0028757418040186167,
-0.0232304185628891,
0.005467449314892292,
0.028673240914940834,
0.04396842420101166,
-0.02129659615457058,
0.024536123499274254,
-0.02567434124648571,
-0.0010017837630584836,
0.03205975517630577,
-0.05975394695997238,
0.027927987277507782,
-0.021617911756038666,
-0.026702309027314186,
0.014842207543551922,
-0.009728088043630123,
0.03889428451657295,
0.01712271198630333,
0.03448932617902756,
0.022072073072195053,
0.02875271998345852,
-0.02714306116104126,
0.010037046857178211,
0.0010624706046655774,
0.013374212197959423,
0.007209047209471464,
0.022680340334773064,
-0.003718039719387889,
-0.019319109618663788,
-0.03209974616765976,
-0.0303964763879776,
0.0016373377293348312,
-0.04804173856973648,
-0.007906594313681126,
0.045811351388692856,
-0.00709729827940464,
-0.01593830995261669,
0.03491140902042389,
0.008840604685246944,
-0.01880648173391819,
-0.027638601139187813,
0.02492554299533367,
-0.003941196948289871,
0.028123436495661736,
-0.048352353274822235,
0.004103866405785084,
-0.030737634748220444,
-0.014816293492913246,
-0.04187748208642006,
0.045180223882198334,
-0.0032743618357926607,
0.006664519663900137,
-0.03641049191355705,
0.027697652578353882,
0.004435521550476551,
0.0035275432746857405,
-0.014887926168739796,
0.01402898970991373,
0.016077350825071335,
0.03636620193719864,
-0.01566486619412899,
0.001185702858492732,
0.0005523242871277034,
-0.018102051690220833,
-0.06231382116675377,
0.0054570590145885944,
-0.016515837982296944,
-0.004038386978209019,
0.023318814113736153,
0.0029770659748464823,
-0.025127774104475975,
-0.004312571603804827,
-0.017600970342755318,
0.05202798917889595,
0.00064454524544999,
0.003427137155085802,
-0.017049498856067657,
0.03797363489866257,
-0.02874448336660862,
-0.022414350882172585,
0.006794229615479708,
-0.04730956256389618,
0.020811637863516808,
-0.05182519182562828,
0.02990242838859558,
0.017671553418040276,
-0.0203977320343256,
-0.030938180163502693,
0.013855352066457272,
0.001104238792322576,
0.005703250877559185,
-0.02983335591852665,
-0.060920652002096176,
-0.003662107978016138,
-0.012984136119484901,
-0.005042923614382744,
0.0331147238612175,
0.0009394435910508037,
0.00993699673563242,
0.007371547166258097,
0.03626592829823494,
-0.002553050871938467,
-0.009399382397532463,
-0.00976699497550726,
0.0100070396438241,
-0.0018590566469356418,
-0.010278169997036457,
0.006278184708207846,
0.03668471425771713,
-0.038517121225595474,
0.05168983340263367,
0.009021745063364506,
-0.02547149360179901,
0.009136578999459743,
-0.048041146248579025,
-0.028609395027160645,
-0.024466391652822495,
0.028599662706255913,
0.027447359636425972,
0.0016997274942696095,
-0.0015044950414448977,
0.008919058367609978,
0.011139987967908382,
0.04155730828642845,
-0.6624109745025635,
0.015059594996273518,
0.01454798225313425,
-0.017222939059138298,
0.01762021891772747,
0.030867774039506912,
-0.03656371682882309,
-0.01022312417626381,
-0.008008318953216076,
-0.008514059707522392,
0.020441703498363495,
0.020887430757284164,
-0.05425490811467171,
-0.03266091272234917,
-0.014700218103826046,
0.03411854803562164,
-0.0033528408966958523,
0.015986016020178795,
0.00309670134447515,
0.013087579049170017,
-0.013090677559375763,
-0.02019500359892845,
0.015051115304231644,
-0.010204016231000423,
-0.025821590796113014,
-0.06261537224054337,
0.022990640252828598,
0.03077930025756359,
0.019408147782087326,
-0.011229405179619789,
0.03743288666009903,
-0.013482637703418732,
0.030162258073687553,
-0.0020742323249578476,
-0.008727029897272587,
-0.02043073996901512,
0.005657892674207687,
0.03914136439561844,
0.014167395420372486,
-0.015137413516640663,
0.005393656902015209,
-0.015527614392340183,
-0.02246861159801483,
-0.031089331954717636,
-0.038001712411642075,
0.03213149681687355,
0.010951156727969646,
-0.01276752632111311,
0.04275659844279289,
0.00007244315202115104,
-0.03881719708442688,
0.002539657987654209,
0.03145783022046089,
-0.0058567114174366,
-0.009838531725108624,
-0.03153686597943306,
-0.03379981592297554,
-0.025184616446495056,
0.03194475919008255,
-0.031673233956098557,
0.020290030166506767,
-0.020464204251766205,
0.02509479783475399,
0.02553963102400303,
-0.06714221090078354,
-0.0077950600534677505,
0.017380326986312866,
-0.013947293162345886,
-0.018688328564167023,
0.017395736649632454,
-0.030317775905132294,
-0.003006674349308014,
-0.04724270477890968,
-0.004430501721799374,
0.01813504286110401,
-0.04751043766736984,
-0.010794173926115036,
0.01687641814351082,
0.029439041391015053,
0.038148440420627594,
0.006957529112696648,
-0.022426065057516098,
0.0013441353803500533,
-0.011182041838765144,
-0.002402938436716795,
-0.0023959088139235973,
-0.025643397122621536,
-0.02371683530509472,
-0.01553175039589405,
-0.018478596583008766,
0.06794502586126328,
0.034510161727666855,
0.059682462364435196,
0.026913493871688843,
0.008094019256532192,
-0.0013815071433782578,
0.01066823210567236,
0.10795624554157257,
0.002426386345177889,
0.028117289766669273,
0.01205404568463564,
0.0578412190079689,
-0.011505507864058018,
-0.03811653330922127,
0.01776919886469841,
-0.036308422684669495,
0.017819909378886223,
-0.004948602523654699,
0.014112853445112705,
0.004859482869505882,
-0.04043989256024361,
-0.015529963187873363,
0.00803421065211296,
-0.022583087906241417,
-0.040008340030908585,
-0.05022504925727844,
0.006722771096974611,
-0.0057477764785289764,
0.013024386018514633,
-0.026121968403458595,
-0.021892700344324112,
-0.015276400372385979,
0.044218629598617554,
-0.011290539987385273,
-0.01700429804623127,
-0.0011460842797532678,
-0.0025062954518944025,
-0.03464755788445473,
-0.012090074829757214,
0.03444903716444969,
0.056449420750141144,
-0.01947936974465847,
-0.04475812986493111,
0.007118951063603163,
-0.020080765709280968,
0.004775242879986763,
-0.015155162662267685,
-0.02849009446799755,
-0.027361271902918816,
-0.011228056624531746,
0.003998192492872477,
-0.006615147460252047,
0.03132391348481178,
-0.026301207020878792,
0.020425336435437202,
0.03031114488840103,
0.00031610886799171567,
-0.014887101948261261,
-0.005318659357726574,
-0.04362975433468819,
0.011003863997757435,
-0.023348184302449226,
0.000054754687880631536,
-0.04073888808488846,
-0.02209332212805748,
0.0236954428255558,
-0.049707457423210144,
-0.023346222937107086,
-0.002240800065919757,
0.03464791178703308,
0.024441268295049667,
0.027171552181243896,
-0.032614316791296005,
-0.005598136689513922,
0.037668269127607346,
-0.006507103331387043,
0.020772144198417664,
0.0016016579465940595,
-0.03913704678416252,
0.011760012246668339,
0.05767827481031418,
0.03952934592962265,
-0.011713908985257149,
0.04053724929690361,
-0.07897158712148666,
-0.03697666525840759,
-0.03977007046341896,
0.01677546463906765,
-0.016199344769120216,
-0.001082150381989777,
0.022726304829120636,
0.005627739708870649,
-0.006629479583352804,
-0.02882726676762104,
-0.02108614146709442,
0.0602053739130497,
0.006127373781055212,
-0.011092295870184898,
-0.018811514601111412,
0.03236749768257141,
0.010648210532963276,
0.01606994867324829,
-0.007581002078950405,
-0.012349511496722698,
-0.006621472537517548,
-0.03409530594944954,
0.00012867602345068008,
0.00435383478179574,
-0.007439384702593088,
-0.019314566627144814,
0.02099793590605259,
0.038928959518671036,
0.03237545117735863,
0.01163127925246954,
-0.010512157343327999,
0.045031845569610596,
0.0005721551715396345,
-0.021087946370244026,
0.025729378685355186,
-0.021304290741682053,
0.00553495017811656,
-0.009268175810575485,
0.010739311575889587,
-0.017535485327243805,
-0.0016016243025660515,
-0.007566283456981182,
-0.008273711428046227,
0.00586279109120369,
0.034177348017692566,
-0.018573757261037827,
-0.00485858041793108,
-0.006229182705283165,
-0.0011582104489207268,
-0.02472163923084736,
0.005407921504229307,
-0.01776125095784664,
-0.010031519457697868,
-0.006341932807117701,
0.022121118381619453,
-0.0122746042907238,
-0.004523812793195248,
0.02899215556681156,
-0.005833421368151903,
-0.005218597128987312,
-0.03440588712692261,
0.014503134414553642,
-0.023548679426312447,
0.02524174377322197,
0.014805407263338566,
0.009242987260222435,
0.020652737468481064,
-0.023778803646564484,
-0.008479657582938671,
0.009116323664784431,
-0.04533896595239639,
0.05851583555340767,
0.009849759750068188,
-0.010815514251589775,
0.008748497813940048,
0.018215956166386604,
0.011675141751766205,
0.019512489438056946,
0.05402244254946709,
0.010055196471512318,
0.02463037334382534,
0.04114169254899025,
-0.021123047918081284,
-0.008102912455797195,
-0.0034785582683980465,
0.03315507248044014,
0.03148948773741722,
-0.02172916755080223,
-0.032769959419965744,
0.010399897582828999,
0.01188779715448618,
0.04670967906713486,
0.04419269412755966,
-0.001438609790056944,
-0.011097962968051434,
0.00976672861725092,
-0.02000090666115284,
-0.022809600457549095,
0.0028090013656765223,
-0.04468529298901558,
-0.013719170354306698,
-0.002839179476723075,
-0.001962927170097828,
-0.042971108108758926,
0.050629183650016785,
-0.06904442608356476,
-0.028249382972717285,
0.01480676420032978,
0.0030326014384627342,
0.022167490795254707,
-0.004842953756451607,
-0.00348702073097229,
-0.03889055922627449,
0.021358933299779892,
-0.026174558326601982,
-0.0007047833641991019,
0.00024042295990511775,
0.006452939938753843,
0.0041127558797597885,
0.043541062623262405,
-0.0015898431884124875,
0.0044669946655631065,
-0.020791253075003624,
-0.008201705291867256,
0.003161722095683217,
0.015503061935305595,
-0.008254016749560833,
-0.031966280192136765,
-0.00767435971647501,
-0.01810557395219803,
-0.031699344515800476,
-0.007280590012669563,
0.01988324709236622,
-0.04104144871234894,
0.007720096968114376,
0.05753389745950699,
-0.01241993997246027,
-0.011331615038216114,
-0.06364412605762482,
0.010814998298883438,
-0.03898103907704353,
0.03238910436630249,
0.02438610978424549,
-0.01986459270119667,
-0.011795382015407085,
0.0023280198220163584,
-0.036621011793613434,
0.012103789485991001,
0.017741898074746132,
0.019978715106844902,
0.0008930381154641509,
-0.02218608371913433,
-0.024997778236865997,
0.057737208902835846,
0.027279270812869072,
-0.05033832788467407,
-0.012652668170630932,
0.0030653541907668114,
0.006985936313867569,
-0.021342195570468903,
0.03324192017316818,
0.005392793100327253,
0.013966825790703297,
0.0056264568120241165,
0.04410820081830025,
-0.01760699972510338,
-0.019629986956715584,
0.025034397840499878,
-0.08022279292345047,
0.033616580069065094,
-0.0025487218517810106,
-0.004753335379064083,
-0.07298648357391357,
0.02319677174091339,
0.00548852002248168,
-0.046610575169324875,
0.0193015243858099,
0.015328086912631989,
0.03326878324151039,
0.048362892121076584,
-0.020125268027186394,
-0.04142037034034729,
0.015119533985853195,
0.008641081862151623,
0.013208302669227123,
0.039497260004282,
0.0021736493799835443,
0.006956729106605053,
0.01177637092769146,
-0.015702398493885994,
-0.02055397629737854,
-0.017912283539772034,
0.015411946922540665,
-0.005529819987714291,
-0.009331895969808102,
0.044107336550951004,
-0.04686274752020836,
-0.032293274998664856,
0.03162481263279915,
-0.0034897406585514545,
-0.029212186112999916,
0.0039260732010006905,
0.06795252114534378,
0.029676802456378937,
-0.024909282103180885,
-0.009531171061098576,
-0.010502034798264503,
0.034666191786527634,
0.02144443802535534,
0.002456523012369871,
-0.011418301612138748,
-0.02489573508501053,
-0.0030854123178869486,
-0.015535487793385983,
0.010527138598263264,
0.0063385129906237125,
-0.01723533682525158,
-0.016910195350646973,
0.008949482813477516,
0.031615182757377625,
-0.041396450251340866,
-0.014361810870468616,
-0.011026047170162201,
-0.009177988395094872,
0.05842984467744827,
-0.0003792532079387456,
-0.00033107114722952247,
0.02786676213145256,
-0.009764216840267181,
-0.036251820623874664,
-0.009574451483786106,
-0.05979042500257492,
0.007080710027366877,
0.046435609459877014,
0.022277317941188812,
0.0313008613884449,
0.03972964361310005,
0.06780629605054855,
-0.06684152781963348,
0.011805432848632336,
0.010795798152685165,
0.02905539609491825,
0.013877327553927898,
0.026238467544317245,
-0.06504615396261215,
-0.0014441544190049171,
0.05261916294693947,
0.05211169272661209,
0.0026491163298487663,
0.023803383111953735,
-0.018950344994664192,
-0.021306758746504784,
-0.00014716011355631053,
-0.0067090196534991264,
0.02410191111266613,
0.0005525188171304762,
-0.005862151272594929,
-0.013827299699187279,
-0.04780749976634979,
0.003868497908115387,
0.0377659872174263,
-0.04901745915412903,
0.023907680064439774,
-0.0012406600872054696,
-0.013593403622508049,
0.027600502595305443,
-0.014703544788062572,
-0.014630094170570374,
0.0002618219587020576,
0.014569850638508797,
0.0205392949283123,
-0.09991925209760666,
0.0031101314816623926,
-0.000470916333142668,
-0.011229886673390865,
0.011088993400335312,
-0.016273334622383118,
0.029925763607025146,
-0.043815117329359055,
-0.020694058388471603,
0.002143117366358638,
-0.009765132330358028,
0.05275445431470871,
0.03882593661546707,
-0.03839004784822464,
0.033829547464847565,
0.019986173138022423,
0.010715383104979992,
-0.018559735268354416,
-0.02038365975022316,
-0.013551908545196056,
0.049347031861543655,
0.019795678555965424,
-0.016871239989995956,
-0.053631965070962906,
0.015918472781777382,
-0.004995113238692284,
0.03706677630543709,
-0.0004926741239614785,
-0.0038679626304656267,
-0.0002441938850097358,
0.02359115332365036,
-0.01911536417901516,
0.035706326365470886,
-0.0278666689991951,
0.023076333105564117,
-0.013377304188907146,
0.03141075000166893,
0.019426923245191574,
-0.02083338424563408,
-0.01496864389628172,
0.025258183479309082,
-0.032327376306056976,
-0.03445495665073395,
-0.007801917381584644,
-0.0020253006368875504,
-0.007903343997895718,
-0.0020180654246360064,
0.002328423783183098,
0.010272323153913021,
0.012934090569615364,
0.007566303946077824,
0.009061644785106182,
-0.001164760673418641,
0.06291075795888901,
0.011096097528934479,
-0.03106548823416233,
-0.06019625812768936,
-0.006957855075597763,
-0.00788920558989048,
-0.0023132532369345427,
0.006369426380842924,
0.06383229047060013,
0.03348715975880623,
-0.015164767391979694,
0.007234923075884581,
0.01391101349145174,
0.01647803746163845,
-0.010563617572188377,
-0.009286660701036453,
0.027605736628174782,
0.017657402902841568,
0.006712594535201788,
-0.07970681041479111,
0.03346763923764229,
-0.028234271332621574,
0.03106136992573738,
-0.004764097277075052,
-0.040381673723459244,
0.016411013901233673,
0.0005344130913726985,
-0.0009157578460872173,
-0.04758670553565025,
-0.021189022809267044,
0.00041961768874898553,
-0.014002222567796707,
0.00723523972555995,
0.006523284129798412,
0.009937344118952751,
-0.010560179129242897,
0.020066197961568832,
-0.028881778940558434,
-0.007671487517654896,
0.008112740702927113,
-0.04125051945447922,
-0.00882746558636427,
0.02827048860490322,
-0.0071901786141097546,
-0.03617008775472641,
-0.00610309187322855,
0.00821618176996708,
-0.0024140411987900734,
-0.02504909597337246,
-0.03556578978896141,
0.057603903114795685,
-0.03747470676898956,
-0.02005247212946415,
0.04156852886080742,
0.011938784271478653,
-0.011973128654062748,
0.025813445448875427,
-0.021573953330516815,
0.002720216289162636,
0.05013629049062729,
0.011732039973139763,
-0.03028855472803116,
0.014226902276277542,
0.023189257830381393
] |
8a6fea40902a5d1ec59a6cdd9117e96fcdef70a1 | 572 | py | Python | algo_probs/newcoder/classic/nc52.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | algo_probs/newcoder/classic/nc52.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | algo_probs/newcoder/classic/nc52.py | Jackthebighead/recruiment-2022 | a81007908e3c2f65a6be3ff2d62dfb92d0753b0d | [
"MIT"
] | null | null | null | # 题意:给出一个仅包含字符'(',')','{','}','['和']',的字符串,判断给出的字符串是否是合法的括号序列。括号必须以正确的顺序关闭,"()"和"()[]{}"都是合法的括号序列,但"(]"和"([)]"不合法。
# @param s string字符串
# @return bool布尔型
#
class Solution:
def isValid(self , s ):
# write code here
if not s: return True
stack = []
dic = {'{':'}','[':']','(':')'}
for char in s:
if not stack or char in dic: stack.append(char)
elif stack and dic.get(stack[-1])!=char: return False
else:
stack.pop()
continue
return True
| 30.105263 | 114 | 0.47028 | 1 | 0.9173 | [
0.0002453256747685373,
0.025912482291460037,
0.004152300767600536,
0.0005886898725293577,
0.007131254766136408,
-0.0052583771757781506,
-0.014248146675527096,
0.005846246145665646,
-0.003550507826730609,
0.0009233453893102705,
-0.0014842175878584385,
0.0040786247700452805,
0.007851795293390751,
-0.014145802706480026,
0.004000791814178228,
0.024335943162441254,
-0.05018537864089012,
0.00001887341568362899,
-0.001011281507089734,
0.003514267737045884,
-0.009434345178306103,
0.0068078492768108845,
0.009559336118400097,
0.0046611507423222065,
0.007455373648554087,
0.00003215561810065992,
0.008811913430690765,
-0.0012785920407623053,
-0.005980950780212879,
-0.008485744707286358,
0.0008883012342266738,
-0.0008333061705343425,
-0.0049215215258300304,
-0.010274309664964676,
0.009371627122163773,
-0.005455005448311567,
-0.0004601895925588906,
-0.017317041754722595,
0.01132197305560112,
-0.0026300998870283365,
-0.004036531317979097,
-0.016885440796613693,
-0.004244697280228138,
0.005445295944809914,
-0.009789331816136837,
0.004087113309651613,
-0.004938937723636627,
-0.00227615749463439,
-0.010074421763420105,
0.0010541921947151423,
-0.011661206372082233,
0.004756070673465729,
0.014872622676193714,
0.004816921893507242,
-0.004214559216052294,
-0.007250024471431971,
0.010820247232913971,
-0.002594263292849064,
-0.010698238387703896,
-0.004262771923094988,
-0.004806267563253641,
-0.000296656449791044,
0.005851505324244499,
-0.0011282541090622544,
-0.01934310793876648,
-0.008112607523798943,
-0.006324311252683401,
0.0015380019322037697,
0.00007787110371282324,
0.002796930493786931,
0.0011800694046542048,
0.0031207879073917866,
0.01006995141506195,
0.004624405410140753,
0.0022662703413516283,
-0.0032375233713537455,
-0.0004129488952457905,
0.0002877432852983475,
0.007580815814435482,
0.0019495008746162057,
0.004151785746216774,
-0.008906443603336811,
0.007847419939935207,
0.011039585806429386,
0.01385379210114479,
0.0024177522864192724,
0.018193501979112625,
-0.01077249925583601,
0.04603167995810509,
0.010180246084928513,
-0.009644560515880585,
0.0015048268251121044,
-0.009307365864515305,
-0.0022912234999239445,
-0.0026610444765537977,
-0.03267195075750351,
0.002519749104976654,
-0.00469548674300313,
0.0011590359499678016,
0.005440854001790285,
-0.0011947350576519966,
0.007329570595175028,
-0.00047337080468423665,
-0.0022910633124411106,
-0.011389147490262985,
0.015573552809655666,
-0.010636922903358936,
-0.003984828479588032,
0.012154809199273586,
0.0002630307280924171,
-0.012743244878947735,
-0.0006253623287193477,
0.00485606724396348,
-0.01418025977909565,
0.0077179851941764355,
-0.00023556392989121377,
-0.0053163678385317326,
0.05689385533332825,
-0.002592188073322177,
0.004765373654663563,
-0.004308758769184351,
-0.00012325827265158296,
0.0033291976433247328,
0.005547102075070143,
0.011774132959544659,
-0.00266429060138762,
0.01136984582990408,
0.006113232113420963,
0.0045987945050001144,
0.007429884281009436,
0.001555161434225738,
0.008724534884095192,
-0.006559921894222498,
-0.0049699149094522,
0.0006961235776543617,
-0.010295940563082695,
0.006368288770318031,
-0.0022833498660475016,
-0.00509417150169611,
0.005977223161607981,
0.00034008591319434345,
-0.012627111747860909,
-0.0007530427537858486,
-0.001776774413883686,
0.004239338915795088,
-0.0117789963260293,
-0.0035030250437557697,
-0.0029834979213774204,
-0.006741017568856478,
0.0032961396500468254,
0.011879777535796165,
0.0050603849813342094,
0.003928152844309807,
-0.00585484504699707,
-0.00872525479644537,
0.004574972670525312,
-0.004644062835723162,
0.0013827697839587927,
0.005511661060154438,
0.004323136061429977,
-0.007554533891379833,
-0.004077404271811247,
0.002588110277429223,
0.0029126047156751156,
0.00016238298849202693,
0.0031810037326067686,
-0.007592859212309122,
0.010595262981951237,
-0.0012901144800707698,
0.005092496983706951,
0.012793595902621746,
-0.006175042130053043,
-0.0007149344310164452,
0.0031593258026987314,
0.005889041814953089,
0.0009164721705019474,
0.011121895164251328,
0.010217748582363129,
-0.006379010155797005,
-0.00041106357821263373,
0.011395810171961784,
0.00297628459520638,
0.007077482528984547,
0.006149111781269312,
0.00036143543547950685,
-0.0008129163179546595,
-0.006203496363013983,
-0.002475763438269496,
0.009488058276474476,
-0.002201053546741605,
0.004948001820594072,
0.006805714685469866,
-0.01456026267260313,
-0.006218148861080408,
0.00030979429720900953,
-0.009253652766346931,
0.0005637223366647959,
0.016794554889202118,
0.01240508072078228,
0.0007770913653075695,
0.0037420412991195917,
-0.014403062872588634,
-0.0028063906356692314,
0.003827902488410473,
-0.0004920898354612291,
-0.012133863754570484,
-0.9544723629951477,
0.0063398745842278,
0.005462788511067629,
-0.0018049046630039811,
0.0034429198130965233,
-0.0012249768478795886,
0.0030289883725345135,
0.0038772174157202244,
0.015185913071036339,
-0.005845562554895878,
-0.006603739690035582,
-0.01085688266903162,
-0.013367148116230965,
0.0018421284621581435,
-0.006667954381555319,
-0.004446446895599365,
-0.00684051588177681,
-0.010444963350892067,
-0.00166699371766299,
-0.0014183985767886043,
-0.004144812468439341,
0.0112905940040946,
-0.0010654497891664505,
0.001982163405045867,
0.0035005074460059404,
0.0066617801785469055,
-0.006583031266927719,
-0.0023634200915694237,
-0.0006626084796153009,
0.0007719873683527112,
-0.005921788979321718,
-0.012616893276572227,
-0.008488720282912254,
0.005229496397078037,
0.013606245629489422,
0.00021901181025896221,
0.006197214592248201,
-0.0014670545933768153,
-0.001808220287784934,
-0.008986962959170341,
0.00635865330696106,
0.00034259053063578904,
0.006510190200060606,
-0.0291732270270586,
-0.0001427920942660421,
-0.0007749838405288756,
-0.007433843333274126,
0.010088592767715454,
0.003352355444803834,
-0.0022233722265809774,
-0.0034810793586075306,
-0.006275114603340626,
0.009429900906980038,
-0.0075489794835448265,
0.0019562465604394674,
-0.006915749050676823,
-0.008768316358327866,
-0.003912482876330614,
-0.010811560787260532,
-0.0021641296334564686,
0.005041379947215319,
-0.003294511465355754,
-0.005074633751064539,
-0.007683694828301668,
0.0072946404106915,
-0.0013580475933849812,
0.0016453539719805121,
-0.019865727052092552,
-0.009542998857796192,
0.0011821092339232564,
0.007353863213211298,
-0.00012526236241683364,
-0.004451259039342403,
0.001955432118847966,
-0.010098999366164207,
0.006572311744093895,
0.00508089130744338,
0.0020852063316851854,
-0.015712371096014977,
-0.0018232633592560887,
-0.014345518313348293,
-0.007868733257055283,
0.001695535727776587,
-0.0054531884379684925,
-0.006523540709167719,
0.00027056835824623704,
0.003610205603763461,
0.007079733535647392,
-0.0019578631035983562,
0.003547913860529661,
0.012272781692445278,
0.00017944342107512057,
-0.008409048430621624,
0.007840516977012157,
0.008493575267493725,
0.005582169163972139,
-0.0014201805461198092,
0.005074166692793369,
0.008328969590365887,
0.007425087969750166,
0.0008622094173915684,
0.006441517733037472,
0.003213228192180395,
0.007700575049966574,
0.0008831328013911843,
-0.0019256571540609002,
-0.004417245276272297,
-0.0015949197113513947,
-0.004545628093183041,
-0.0021162345074117184,
-0.0036817234940826893,
-0.0011910267639905214,
-0.017060432583093643,
-0.00834409799426794,
0.0003244935651309788,
0.0014033704064786434,
0.003728775540366769,
-0.005167956929653883,
0.0009323536069132388,
0.000015035491742310114,
0.0045077563263475895,
-0.005809203255921602,
-0.003481097286567092,
0.0013615261996164918,
0.0019213296473026276,
-0.004479758441448212,
0.013044864870607853,
-0.011726663447916508,
0.005905258934944868,
-0.0004517422348726541,
-0.014272676780819893,
0.008954629302024841,
0.010170895606279373,
-0.00673470925539732,
0.001682274742051959,
0.002941771410405636,
0.004112490452826023,
-0.0014493459602817893,
-0.003512950614094734,
-0.004152771085500717,
-0.019270451739430428,
0.0014091158518567681,
0.022144339978694916,
0.0037848171778023243,
0.010386413894593716,
0.010851243510842323,
-0.007812529802322388,
0.001009731087833643,
0.008768218569457531,
0.004295558203011751,
0.015297861769795418,
-0.011198057793080807,
0.0001381659967591986,
0.00663356389850378,
-0.0075200404971838,
-0.001902137417346239,
0.005028537008911371,
0.0019374475814402103,
-0.0020476700738072395,
0.00214024749584496,
-0.009161924012005329,
-0.003802021499723196,
-0.014101317152380943,
-0.004497602116316557,
0.004715791903436184,
-0.001187357003800571,
0.004439650569111109,
-0.013014434836804867,
0.0026664813049137592,
0.0025391282979398966,
0.0029200876597315073,
-0.00117531418800354,
0.004011040087789297,
0.0023882887326180935,
0.012599538080394268,
-0.007510066963732243,
0.005108959972858429,
0.003638718044385314,
0.000210677259019576,
0.0026583673898130655,
0.006890252698212862,
-0.010115292854607105,
-0.004267376381903887,
0.0043360828422009945,
0.00441734166815877,
-0.0022721898276358843,
-0.0022797666024416685,
-0.008029094897210598,
-0.004847146105021238,
0.003733276855200529,
-0.009473033249378204,
0.001824753126129508,
-0.00616996455937624,
0.0028412395622581244,
-0.008953818120062351,
-0.000918094941880554,
-0.002638318808749318,
-0.012100618332624435,
0.01030631922185421,
-0.0006469337386079133,
0.004049088340252638,
0.015294002369046211,
0.004801668226718903,
-0.0108016487210989,
-0.00014366689720191061,
0.008842111565172672,
-0.007010564208030701,
0.0026414745952934027,
0.01369231753051281,
-0.003987205680459738,
-0.022985585033893585,
-0.0005412041209638119,
-0.014154485426843166,
0.004644930828362703,
-0.0029867689590901136,
0.005657495465129614,
-0.007029198110103607,
0.005327633582055569,
0.0037084927316755056,
-0.010506204329431057,
-0.006629408802837133,
-0.006768114399164915,
0.00957577582448721,
-0.000598666665609926,
0.001631859689950943,
-0.002703120233491063,
0.0015576862497255206,
-0.0038930922746658325,
-0.0017372728325426579,
-0.0033268185798078775,
0.003160045715048909,
0.00450443709269166,
-0.00546250818297267,
0.002640270860865712,
-0.0019598756916821003,
0.0004773316322825849,
0.0024198114406317472,
-0.013242549262940884,
0.005139368586242199,
0.008383288979530334,
-0.004452262073755264,
-0.0015984908677637577,
0.0028099315240979195,
-0.0028545260429382324,
-0.00771008525043726,
-0.012470131739974022,
-0.0035692222882062197,
-0.0022432387340813875,
-0.004389353096485138,
-0.011438079178333282,
-0.0039004224818199873,
-0.010629720985889435,
0.007425976917147636,
-0.008472808636724949,
0.01142608467489481,
0.008415999822318554,
-0.005168723873794079,
0.005962996277958155,
-0.001971789402887225,
0.006000608671456575,
0.00041849041008390486,
0.007184707093983889,
-0.0011621033772826195,
-0.009774674661457539,
-0.01110163051635027,
0.01648186706006527,
-0.012890567071735859,
0.00024142804613802582,
0.015994159504771233,
0.007452724501490593,
0.00747885974124074,
-0.0035889511927962303,
-0.001065858406946063,
-0.0011813297169283032,
0.007504244800657034,
-0.013148023746907711,
0.00046353720244951546,
-0.0054829842410981655,
-0.0005418258369900286,
0.005760314408689737,
-0.0020278228912502527,
0.001759599894285202,
0.008050303906202316,
-0.0019435499561950564,
-0.006670964881777763,
-0.006379077211022377,
-0.001539509161375463,
0.0014834533212706447,
-0.016270102933049202,
-0.00038799765752628446,
-0.004987161606550217,
-0.005853099282830954,
-0.005131369456648827,
-0.00012814522779081017,
0.0010237018577754498,
0.003551694331690669,
-0.0011749248951673508,
0.006775990594178438,
0.0023068212904036045,
-0.007232241332530975,
0.0167397428303957,
-0.00274177105166018,
-0.0022713830694556236,
0.0026286914944648743,
0.0021488447673618793,
-0.000172370026120916,
-0.003729858435690403,
-0.0035941896494477987,
0.0033102696761488914,
0.0055551412515342236,
-0.0015319755766540766,
-0.002771373139694333,
-0.00433483486995101,
-0.0006260804366320372,
-0.00995461642742157,
0.0023586794268339872,
0.012310144491493702,
-0.004806747194379568,
0.004536911379545927,
-0.0005875251954421401,
-0.009709158912301064,
-0.013778138905763626,
0.060895536094903946,
0.0006930969539098442,
-0.00030538413557223976,
0.005812380462884903,
-0.006822309456765652,
0.0005612000823020935,
-0.001114833285100758,
0.009935990907251835,
-0.007362770847976208,
-0.001953035593032837,
0.009488830342888832,
-0.0019256036030128598,
0.0022808134090155363,
-0.00021448095503728837,
-0.0003066062927246094,
0.016039162874221802,
-0.007939472794532776,
-0.01752900891005993,
-0.01861543580889702,
0.003753420663997531,
-0.0038473252207040787,
-0.00931594055145979,
0.008514669723808765,
-0.007902615703642368,
-0.0005045424913987517,
0.006404646206647158,
0.0053038159385323524,
0.0007716804975643754,
-0.0010420888429507613,
-0.0014891946921125054,
-0.004405834246426821,
0.00008489478204865009,
0.001777653698809445,
-0.0006721264217048883,
0.0072111766785383224,
-0.004046981688588858,
0.005534488242119551,
0.0015132696134969592,
0.00031975089223124087,
0.000559832900762558,
0.005395456682890654,
0.006337843835353851,
-0.0010646755108609796,
-0.0025882080662995577,
0.0027505196630954742,
0.005689592566341162,
0.0026175358798354864,
0.014940782450139523,
-0.0018414173973724246,
-0.008302569389343262,
0.0020267891231924295,
0.008088442496955395,
-0.0025463781785219908,
0.008542506024241447,
0.000873367942404002,
0.0070741246454417706,
0.004146363586187363,
-0.01233323197811842,
-0.013788771815598011,
-0.000982231111265719,
0.008666994981467724,
0.010881725698709488,
-0.0002935186494141817,
-0.0013572300085797906,
0.00018105190247297287,
-0.0034926203079521656,
-0.011490240693092346,
-0.006950831040740013,
-0.0011563177686184645,
0.0023516237270087004,
0.00564252445474267,
0.07030367851257324,
-0.009216584265232086,
-0.00273661850951612,
-0.006734355352818966,
-0.00006294161721598357,
-0.0023448539432138205,
-0.001559791504405439,
0.00016558586503379047,
0.0018140283646062016,
0.0013262438587844372,
0.0020589055493474007,
-0.009872003458440304,
-0.009890902787446976,
0.0016736609395593405,
0.004054277203977108,
-0.004589597694575787,
0.004547081887722015,
0.006889547221362591,
-0.009760914370417595,
0.003024117322638631,
-0.015209071338176727,
-0.0035006594844162464,
-0.0019982249941676855,
-0.011862151324748993,
-0.0029424852691590786,
-0.0024619896430522203,
0.0019729493651539087,
0.005958014167845249,
0.007720774970948696,
-0.004841580521315336,
0.004789527505636215,
-0.003751534502953291,
0.00258451490662992,
-0.005242589395493269,
0.0012703886022791266,
-0.0075171650387346745,
0.012337562628090382,
0.0018149218522012234,
-0.017368044704198837,
-0.006692368537187576,
-0.0018800010439008474,
-0.0004750626103486866,
-0.003757346887141466,
0.005531133618205786,
-0.0007401736220344901,
0.0058922297321259975,
-0.004540255293250084,
0.002585632260888815,
-0.004837600514292717,
0.006666401866823435,
-0.013962370343506336,
0.007920018397271633,
-0.1760825365781784,
0.010019022971391678,
0.004591379780322313,
-0.006544501055032015,
-0.004631439223885536,
-0.016070857644081116,
-0.006951956078410149,
0.004335563629865646,
0.011664950288832188,
0.003747505135834217,
0.0010474537266418338,
-0.005936598405241966,
0.005244571249932051,
0.00006837263936176896,
-0.003236522199586034,
-0.0031477133743464947,
0.004905337002128363,
-0.003336948109790683,
0.001669440884143114,
0.008156727068126202,
0.009571850299835205,
0.010783886536955833,
0.005875901784747839,
0.0015233648009598255,
-0.0003083253977820277,
-0.008239950984716415,
0.003815588541328907,
-0.0015668655978515744,
0.005894339177757502,
-0.007536594290286303,
-0.005193243734538555,
-0.0071424683555960655,
-0.005212570074945688,
-0.00216976972296834,
0.005290617235004902,
-0.00238165445625782,
0.0091701103374362,
0.0022549722343683243,
-0.009614111855626106,
0.00632821349427104,
-0.010913673788309097,
0.028931500390172005,
0.006764163728803396,
0.00753430649638176,
0.002387245884165168,
-0.005495014600455761,
-0.004082628060132265,
0.009441999718546867,
0.0044670444913208485,
0.010544374585151672,
-0.012370877899229527,
-0.004341751802712679,
0.0012249092105776072,
0.020274534821510315,
-0.004295288119465113,
-0.011541597545146942,
-0.0022770646028220654,
-0.0058226860128343105,
0.00265267095528543,
0.009558669291436672,
0.011530827730894089,
-0.007430287543684244,
0.006985763553529978,
-0.005919723305851221,
-0.022697653621435165,
0.0032009202986955643,
-0.006393907591700554,
-0.006320244167000055,
-0.0019442933844402432,
0.007172359619289637,
0.010677783749997616,
-0.002097404794767499,
0.008094269782304764,
0.000012912532838527113,
-0.0016877840971574187,
-0.001179064391180873,
0.005118673201650381,
-0.0037066859658807516,
0.007225994952023029,
-0.01098738145083189,
0.010370784439146519,
-0.011034372262656689,
-0.0023704138584434986,
0.005269814282655716,
-0.005090834107249975,
0.01004958339035511,
0.004977489821612835,
-0.0016019765753298998,
-0.00010743220627773553,
-0.01112450659275055,
-0.003625038079917431,
0.0007402787450700998,
0.009236169047653675,
-0.0037920651957392693,
0.00457427091896534,
-0.0013559813378378749,
0.003460255218669772,
0.008618809282779694,
-0.006473326589912176,
0.006804284639656544,
0.0049477932043373585,
-0.005560908000916243,
0.004033035598695278,
-0.007351846434175968,
0.0012998164165765047,
0.004068195819854736,
-0.007642348762601614,
-0.007738696876913309,
0.00538525590673089,
-0.007931954227387905,
-0.00424494594335556,
0.0021485413890331984,
-0.0090172179043293,
-0.008996001444756985,
-0.0029668204952031374,
-0.01028821524232626,
-0.001470169983804226
] |
8a73038a9d54b6fdd609f321f9fbc694a2017b7b | 2,385 | py | Python | piecrust/processing/util.py | airbornemint/PieCrust2 | bd8e44a1a3ba646a9ebfbb4d4f1fa01a1daa3beb | [
"Apache-2.0"
] | null | null | null | piecrust/processing/util.py | airbornemint/PieCrust2 | bd8e44a1a3ba646a9ebfbb4d4f1fa01a1daa3beb | [
"Apache-2.0"
] | null | null | null | piecrust/processing/util.py | airbornemint/PieCrust2 | bd8e44a1a3ba646a9ebfbb4d4f1fa01a1daa3beb | [
"Apache-2.0"
] | null | null | null | import os.path
import time
import logging
import yaml
from piecrust.processing.base import Processor
logger = logging.getLogger(__name__)
class _ConcatInfo(object):
timestamp = 0
files = None
delim = "\n"
class ConcatProcessor(Processor):
PROCESSOR_NAME = 'concat'
def __init__(self):
super(ConcatProcessor, self).__init__()
self._cache = {}
def matches(self, path):
return path.endswith('.concat')
def getDependencies(self, path):
info = self._load(path)
return info.files
def getOutputFilenames(self, filename):
return [filename[:-7]]
def process(self, path, out_dir):
dirname, filename = os.path.split(path)
out_path = os.path.join(out_dir, filename[:-7])
info = self._load(path)
if not info.files:
raise Exception("No files specified in: %s" %
os.path.relpath(path, self.app.root_dir))
logger.debug("Concatenating %d files to: %s" %
(len(info.files), out_path))
encoded_delim = info.delim.encode('utf8')
with open(out_path, 'wb') as ofp:
for p in info.files:
with open(p, 'rb') as ifp:
ofp.write(ifp.read())
if info.delim:
ofp.write(encoded_delim)
return True
def _load(self, path):
cur_time = time.time()
info = self._cache.get(path)
if (info is not None and
(cur_time - info.timestamp <= 1 or
os.path.getmtime(path) < info.timestamp)):
return info
if info is None:
info = _ConcatInfo()
self._cache[path] = info
with open(path, 'r') as fp:
config = yaml.load(fp)
info.files = config.get('files', [])
info.delim = config.get('delim', "\n")
info.timestamp = cur_time
path_mode = config.get('path_mode', 'relative')
if path_mode == 'relative':
dirname, _ = os.path.split(path)
info.files = [os.path.join(dirname, f) for f in info.files]
elif path_mode == 'absolute':
info.files = [os.path.join(self.app.root_dir, f)
for f in info.files]
else:
raise Exception("Unknown path mode: %s" % path_mode)
return info
| 28.392857 | 71 | 0.554717 | 1 | 1.4346 | [
0.002958899363875389,
0.023903517052531242,
0.008124111220240593,
0.0018873175140470266,
0.004700017161667347,
-0.0037588090635836124,
-0.009383419528603554,
0.0012658926425501704,
-0.007848663255572319,
0.0028495851438492537,
0.001511187176220119,
0.004698570817708969,
0.00685168756172061,
-0.017460213974118233,
0.001782550709322095,
0.015154126100242138,
-0.050980325788259506,
0.001580205513164401,
-0.004965126980096102,
0.00234229420311749,
-0.0075213974341750145,
0.008921753615140915,
0.010447020642459393,
0.006048253737390041,
0.006731431931257248,
-0.0019595290068536997,
0.008164145983755589,
0.0010740704601630569,
-0.007007970008999109,
-0.008402923122048378,
-0.002373430412262678,
-0.001953206956386566,
-0.006878668908029795,
-0.006963605061173439,
0.006845627445727587,
-0.0020502726547420025,
0.0005289465771056712,
-0.01918579265475273,
0.0120221683755517,
-0.0020883390679955482,
-0.006451301276683807,
-0.012877724133431911,
-0.0005309422267600894,
0.0029069501906633377,
-0.008615083992481232,
-0.001253092079423368,
-0.0033909303601831198,
0.0035150451585650444,
-0.010617232881486416,
0.0068375105038285255,
-0.009733523242175579,
0.007405089680105448,
0.014622359536588192,
0.004003514070063829,
-0.005515645258128643,
-0.004825729411095381,
0.012204289436340332,
-0.0002556809049565345,
-0.009715563617646694,
-0.0026049029547721148,
-0.004894847050309181,
-0.002472743857651949,
0.004971615970134735,
0.0020238312426954508,
-0.016124049201607704,
-0.006679406389594078,
-0.006922457832843065,
0.0036999208386987448,
0.00027552261599339545,
0.005348490085452795,
0.0012571304105222225,
-0.0008579993736930192,
0.007707139011472464,
0.00323588983155787,
0.004390981514006853,
-0.005955888424068689,
-0.0017957099480554461,
-0.0015347432345151901,
0.00813429243862629,
0.0025246518198400736,
0.005599627271294594,
-0.00685480423271656,
0.004356394521892071,
0.007516954559832811,
0.015225030481815338,
0.007782162167131901,
0.020880764350295067,
-0.008931456133723259,
0.04901725426316261,
0.009183134883642197,
-0.009554312564432621,
0.00270004291087389,
-0.006993981543928385,
-0.0016010955441743135,
-0.003897916292771697,
-0.027648938819766045,
-0.001405970542691648,
-0.0024196337908506393,
0.0004381926264613867,
0.004574020393192768,
0.0014269074890762568,
0.0066914670169353485,
-0.0013616818469017744,
-0.002980298362672329,
-0.007391059771180153,
0.010288707911968231,
-0.009046775288879871,
-0.004565602168440819,
0.006540973205119371,
0.0024843518622219563,
-0.010141750797629356,
-0.0009840866550803185,
0.0007055189344100654,
-0.012017615139484406,
0.004049219191074371,
0.0021514170803129673,
-0.005698734428733587,
0.05143791437149048,
-0.001596287707798183,
0.004272542428225279,
-0.005178165156394243,
0.003974756225943565,
0.002500907052308321,
0.006323321722447872,
0.008847133256494999,
-0.0017392695881426334,
0.01211306732147932,
0.009706187061965466,
0.004251713398844004,
0.009104679338634014,
-0.0016442254418507218,
0.008069626055657864,
-0.004203261341899633,
-0.0021488741040229797,
0.001437956583686173,
-0.007931379601359367,
0.009117226116359234,
-0.0013706027530133724,
-0.010683173313736916,
0.0014287220546975732,
0.0007902570650912821,
-0.007350594270974398,
0.0004515279724728316,
-0.004383418243378401,
0.003497044090181589,
-0.010019279085099697,
-0.0028269353788346052,
-0.0037872465327382088,
-0.004097179975360632,
0.0035004131495952606,
0.011419695802032948,
0.004918190184980631,
0.003537643002346158,
-0.006073053926229477,
-0.011103722266852856,
-0.0007459767512045801,
-0.004579149652272463,
0.0015555154532194138,
0.006816480308771133,
0.003983110189437866,
-0.009448060765862465,
-0.001527360174804926,
0.0013561799423769116,
0.006370970048010349,
-0.0003861725563183427,
0.002692627487704158,
-0.00900742132216692,
0.007525130175054073,
0.0001109953154809773,
0.004747857805341482,
0.00996764563024044,
-0.003958434797823429,
-0.0015909785870462656,
-0.0002066733140964061,
0.0034248691517859697,
-0.0034938000608235598,
0.005445763934403658,
0.010112243704497814,
-0.0030423139687627554,
-0.0037515771109610796,
0.004773280583322048,
0.005943655967712402,
0.0090675950050354,
0.005866760853677988,
-0.003938631154596806,
0.003064054762944579,
-0.004932147450745106,
-0.0026561205741018057,
0.006458225194364786,
-0.00470223743468523,
0.00418166583403945,
0.00381284998729825,
-0.013689100742340088,
-0.00982754398137331,
0.0015892824158072472,
-0.0068452185951173306,
0.00204021530225873,
0.013515730388462543,
0.010558362118899822,
-0.002557622268795967,
0.0029470790177583694,
-0.008619013242423534,
-0.00020160667190793902,
0.00699931476265192,
0.0029080063104629517,
-0.013895445503294468,
-0.9597648978233337,
0.0069785816594958305,
0.004853055812418461,
-0.0014940568944439292,
0.006208796985447407,
0.004183576442301273,
0.003986393101513386,
0.004654439631849527,
0.013670817948877811,
-0.008607584983110428,
-0.006697655655443668,
-0.009343419224023819,
-0.009300217032432556,
-0.0011430061422288418,
-0.00811310950666666,
-0.003584811231121421,
-0.007887689396739006,
-0.005968598648905754,
-0.0016454646829515696,
-0.0033158992882817984,
-0.0035833518486469984,
0.00824087206274271,
-0.0021279321517795324,
0.004407019354403019,
0.0031769764609634876,
0.0034737230744212866,
-0.00494467793032527,
-0.0024838438257575035,
-0.003768047085031867,
-0.0018616578308865428,
-0.00734550878405571,
-0.014841370284557343,
-0.003059757873415947,
-0.002070835093036294,
0.010430591180920601,
-0.000005142337613506243,
0.00896496046334505,
-0.002068085828796029,
0.0020040380768477917,
-0.006368696223944426,
0.006125262472778559,
-0.00015564888599328697,
0.004190940409898758,
-0.030011596158146858,
-0.002785450778901577,
-0.002047942951321602,
-0.008911210112273693,
0.008877580985426903,
-0.0006085732602514327,
-0.0009709497098810971,
-0.003769038477912545,
-0.005167547147721052,
0.009333200752735138,
-0.00999895017594099,
0.0020662026945501566,
-0.005788586568087339,
-0.008557979017496109,
-0.00349686318077147,
-0.009576006792485714,
-0.0007857413147576153,
0.0027826649602502584,
-0.0028564895037561655,
-0.00630704453215003,
-0.002659418387338519,
0.003363556694239378,
0.0036239998880773783,
0.00026591375353746116,
-0.017762096598744392,
-0.00547757325693965,
0.0006140281329862773,
-0.00036484558950178325,
-0.004878807347267866,
-0.0024822927080094814,
0.005200785119086504,
-0.009046492166817188,
0.005703878588974476,
0.0024273786693811417,
-0.0026741467881947756,
-0.012761316262185574,
-0.0010172883048653603,
-0.009690603241324425,
-0.009035550057888031,
0.0006083474727347493,
-0.003925195895135403,
-0.004572777543216944,
-0.0021570397075265646,
-0.0013125217519700527,
0.007817329838871956,
-0.005132553167641163,
0.005166724324226379,
0.013076956383883953,
-0.0021616672165691853,
-0.007752194069325924,
0.006439060438424349,
0.007784455083310604,
0.0009176905732601881,
-0.0038918068166822195,
0.0010788068175315857,
0.009681298397481441,
0.007016614079475403,
0.0030737118795514107,
0.004241479095071554,
-0.00009905073966365308,
0.005403404124081135,
-0.00012339279055595398,
0.0005067447782494128,
-0.0031552952714264393,
-0.00012798218813259155,
-0.0030847787857055664,
-0.0011050585890188813,
-0.0036130743101239204,
-0.002250808058306575,
-0.012911180034279823,
-0.008937821723520756,
-0.003113384358584881,
-0.0010787975043058395,
0.0024016760289669037,
-0.004133820068091154,
0.0011638853466138244,
0.0023864784743636847,
0.006652100943028927,
-0.0002721075143199414,
-0.002521924674510956,
0.0004219947732053697,
0.0023191487416625023,
-0.006069723051041365,
0.01512913964688778,
-0.011374007910490036,
0.004928101319819689,
-0.0006125402869656682,
-0.015607668086886406,
0.007628202438354492,
0.009650606662034988,
-0.00866320263594389,
0.0009553713607601821,
0.003841239959001541,
0.002752553438767791,
-0.00005553826849791221,
-0.004282985348254442,
-0.0026281834580004215,
-0.015231644734740257,
0.00007789388473611325,
0.01933118887245655,
0.0013099010102450848,
0.010224025696516037,
0.0113998306915164,
-0.005110002588480711,
0.0023494164925068617,
0.006571840960532427,
0.0017679062439128757,
0.011326344683766365,
-0.01017458550632,
0.001220570644363761,
0.00026362488279119134,
-0.005718196742236614,
-0.00022244684805627912,
0.005443104542791843,
0.005567471496760845,
-0.003715198254212737,
0.002360073383897543,
-0.009263753890991211,
-0.005913781467825174,
-0.018987124785780907,
-0.004013973753899336,
0.00604204460978508,
-0.006635144352912903,
0.0073925466276705265,
-0.010614697821438313,
0.004840103909373283,
0.006397244520485401,
0.003348367055878043,
-0.0005612386157736182,
0.0002784824464470148,
0.005340180359780788,
0.013816183432936668,
-0.006332798395305872,
0.003898805705830455,
0.0014214939437806606,
-0.0015171999111771584,
-0.000034610213333508,
0.009136635810136795,
-0.006472717504948378,
-0.005871186964213848,
0.004086005967110395,
0.005198899656534195,
0.0007265820750035346,
-0.0036117739509791136,
-0.008114366792142391,
-0.003189549082890153,
0.00125462980940938,
-0.006759319454431534,
0.00391940725967288,
0.001937125576660037,
0.003858676878735423,
-0.0069074807688593864,
-0.001321539282798767,
-0.0026239114813506603,
-0.012141838669776917,
0.010000648908317089,
-0.003167796181514859,
0.002578746061772108,
0.01391798909753561,
0.0030437998939305544,
-0.013445434160530567,
0.005938773509114981,
0.010672159492969513,
-0.0026390086859464645,
0.003994697704911232,
0.007692599669098854,
-0.00481664203107357,
-0.022558309137821198,
-0.0026545149739831686,
-0.015639830380678177,
0.0056808399967849255,
-0.0031692725606262684,
0.002123181475326419,
-0.009729023091495037,
0.008166958577930927,
0.007753671612590551,
-0.012057898566126823,
-0.003567627863958478,
-0.007540530990809202,
0.009803862310945988,
0.001921808230690658,
0.0002770475693978369,
-0.0029509724117815495,
-0.001364188501611352,
0.0008523592259734869,
-0.003851889166980982,
-0.0031315803062170744,
0.004208064172416925,
0.0016393909463658929,
-0.0015062361489981413,
0.0024955275002866983,
-0.00556700536981225,
-0.00000448201535618864,
0.000005519034857570659,
-0.009970289655029774,
0.0023428243584930897,
0.0038423247169703245,
-0.0010388968512415886,
-0.004168165847659111,
0.00204834365285933,
-0.0035591567866504192,
-0.005023489240556955,
-0.01211992185562849,
-0.0046528917737305164,
-0.004770493134856224,
-0.0013633265625685453,
-0.012388880364596844,
-0.001438746228814125,
-0.01074294000864029,
0.007939520291984081,
-0.005444262642413378,
0.004422466270625591,
0.00520193949341774,
-0.0064091007225215435,
0.00640881760045886,
-0.0014575746608898044,
0.005862878169864416,
0.0029224755708128214,
0.0046862163580954075,
0.002371197799220681,
-0.0050205341540277,
-0.013194956816732883,
0.01209605298936367,
-0.00838277768343687,
0.003674711100757122,
0.012409262359142303,
0.0048445239663124084,
0.01044497825205326,
-0.00004136210918659344,
0.0010426659137010574,
0.0010118263307958841,
0.0075110760517418385,
-0.013617219403386116,
0.003796393284574151,
-0.003282075049355626,
-0.0007891481509432197,
0.002889852272346616,
-0.001920870621688664,
0.002177199348807335,
0.010206972248852253,
0.0010153873590752482,
-0.006288319360464811,
-0.003501929808408022,
0.00008599674765719101,
0.003932001534849405,
-0.013831060379743576,
-0.0016509725246578455,
-0.002294776728376746,
-0.005079083144664764,
-0.0031048462260514498,
-0.0015018467092886567,
-0.0010973321041092277,
0.004933275748044252,
-0.0017555021913722157,
0.006167102139443159,
0.004780363291501999,
-0.00619092769920826,
0.01461096666753292,
-0.004816118627786636,
-0.004855357110500336,
0.00249470048584044,
0.0038417389150708914,
-0.0019303750013932586,
-0.006159074138849974,
-0.002282776404172182,
0.002442956203594804,
0.006169742438942194,
-0.0028348646592348814,
-0.002986322157084942,
-0.0016070372657850385,
0.0018839266849681735,
-0.01009229477494955,
0.0007894884911365807,
0.01375147420912981,
-0.00511293625459075,
0.004276798106729984,
-0.0037452697288244963,
-0.009386586025357246,
-0.01243942603468895,
0.05224773287773132,
-0.0006817787070758641,
0.004737438168376684,
0.005526531953364611,
-0.005824400577694178,
0.0006251595914363861,
-0.004011554643511772,
0.007754605729132891,
-0.006313081830739975,
-0.008490282110869884,
0.006578250788152218,
-0.0043071964755654335,
0.004295331425964832,
0.0053676120005548,
-0.002418927848339081,
0.01610064134001732,
-0.004063591361045837,
-0.01639927178621292,
-0.01729622110724449,
0.0048931366764009,
-0.00420801667496562,
-0.007532667834311724,
0.009696879424154758,
-0.005007176194339991,
-0.0060773929581046104,
0.0018627758836373687,
0.004495618864893913,
0.002076856093481183,
-0.00037261020042933524,
-0.003546407213434577,
-0.0019052078714594245,
-0.0027437747921794653,
0.0029820208437740803,
0.006050888914614916,
0.006370226386934519,
-0.002839744323864579,
0.0023848179262131453,
-0.0013205517316237092,
-0.0027142586186528206,
-0.0003908991056960076,
0.004763034638017416,
0.006916107144206762,
0.0005280915065668523,
-0.00023514582426287234,
0.006727400701493025,
0.0052285450510680676,
0.0030027288012206554,
0.009038427844643593,
-0.00023730596876703203,
-0.006086803041398525,
0.008787183091044426,
0.006547519471496344,
-0.00012098973820684478,
0.008053050376474857,
-0.0008601377485319972,
0.007255676202476025,
0.0022122287191450596,
-0.0068559804931283,
-0.0158937256783247,
-0.0024880722630769014,
0.007544488180428743,
0.011201668530702591,
0.0002660606987774372,
0.0010473799193277955,
-0.0023158674594014883,
-0.002093086251989007,
-0.007995307445526123,
-0.008470955304801464,
-0.0015191661659628153,
0.002806766191497445,
0.002503730822354555,
0.06997191905975342,
-0.006269516423344612,
-0.0015349388122558594,
-0.009321085177361965,
-0.0032093427143990993,
-0.0023348755203187466,
-0.0019924480002373457,
0.0017985764425247908,
-0.0028107708785682917,
0.0029326363001018763,
0.0011338451877236366,
-0.006496799178421497,
-0.011426148004829884,
0.0004821823094971478,
0.0031619800720363855,
-0.003288897918537259,
0.004430673085153103,
0.005147751420736313,
-0.010363374836742878,
0.00204027583822608,
-0.012666068971157074,
-0.0008261733455583453,
-0.001942174043506384,
-0.009328629821538925,
-0.0036576492711901665,
-0.002858987543731928,
0.0051296004094183445,
0.002363697625696659,
0.0052938638255000114,
-0.0006919130682945251,
0.005576884839683771,
-0.004144072066992521,
-0.002451649634167552,
-0.006254932377487421,
-0.0008625281043350697,
-0.006846297066658735,
0.008403695188462734,
0.0007490205462090671,
-0.009057795628905296,
-0.0056001353077590466,
0.0005660393508151174,
0.0004800906463060528,
-0.0029973438940942287,
0.003866130020469427,
0.0014191202353686094,
0.004079924896359444,
-0.002246465301141143,
0.00009852454968495294,
-0.007289574947208166,
0.0010377693688496947,
-0.013716420158743858,
0.007005604449659586,
-0.16825224459171295,
0.009834416210651398,
0.00536721246317029,
-0.0064729428850114346,
-0.004061994608491659,
-0.014028840698301792,
-0.004040844738483429,
0.003458675229921937,
0.009295639581978321,
0.0013552545569837093,
-0.002011040225625038,
-0.0006849521887488663,
0.0045149740763008595,
0.004151517059653997,
-0.0018998706946149468,
-0.002591177588328719,
0.0044153304770588875,
-0.003337521106004715,
0.0015764812706038356,
0.004509280901402235,
0.003324220422655344,
0.008264711126685143,
0.0009302283870056272,
0.0033064496237784624,
-0.0019087642431259155,
-0.006860411260277033,
0.006232560612261295,
-0.001355152577161789,
0.005513079930096865,
-0.011756358668208122,
-0.0021447124890983105,
-0.0020525881554931402,
-0.005084171425551176,
-0.00029886115225963295,
0.003170045092701912,
-0.0013823304325342178,
0.00867971871048212,
0.001925264485180378,
-0.009048772044479847,
0.007599964737892151,
-0.007492643315345049,
0.029313964769244194,
0.003906784113496542,
0.006022950634360313,
-0.0017273047706112266,
-0.006915447302162647,
-0.004148939624428749,
0.00903535820543766,
0.001999931875616312,
0.011423124000430107,
-0.011013437062501907,
0.0007134629995562136,
0.006058808881789446,
0.018086295574903488,
-0.0035378835164010525,
-0.01011925470083952,
-0.004272368736565113,
-0.0013805507915094495,
0.00295643275603652,
0.006997994612902403,
0.010370288975536823,
-0.0020464984700083733,
0.007988164201378822,
-0.002206266624853015,
-0.02170003578066826,
0.005133381579071283,
-0.005130356177687645,
-0.007446248084306717,
0.003615587716922164,
0.007070921827107668,
0.009771522134542465,
0.00016729194612707943,
0.0014773088041692972,
-0.0011220108717679977,
0.007137357722967863,
0.0004628022143151611,
0.006040558218955994,
-0.00306128803640604,
0.004731045104563236,
-0.009236146695911884,
0.00733419694006443,
-0.010238535702228546,
-0.0035124646965414286,
0.002507817931473255,
-0.005127387121319771,
0.010366836562752724,
0.003089032368734479,
-0.0022932919673621655,
-0.001673394814133644,
-0.010463015176355839,
-0.0025867156218737364,
0.001708763069473207,
0.0008787825936451554,
-0.008428605273365974,
0.0036370325833559036,
0.00010352234676247463,
0.00494317477568984,
0.007163220085203648,
-0.009572728537023067,
0.007851449772715569,
0.0036991366650909185,
-0.004524591378867626,
0.00041640159906819463,
-0.0022786608897149563,
0.001145532471127808,
0.0054890476167202,
-0.0041758352890610695,
-0.004826837219297886,
0.0035560335963964462,
-0.00687216455116868,
-0.004570893011987209,
0.008998023346066475,
-0.009648068808019161,
-0.00894652958959341,
-0.0038117694202810526,
-0.01079290546476841,
0.0010956829646602273
] |
8a7310d8abb463c70846c800ef296e8c1423ac2b | 186 | py | Python | src/events/cell_pressed.py | ArcosJuan/Get-out-of-my-fucking-maze | ca2cfeaaeecb6c6f583ad647d020f25176170805 | [
"MIT"
] | 2 | 2021-09-09T14:03:40.000Z | 2021-11-03T03:35:55.000Z | src/events/cell_pressed.py | ArcosJuan/Get-out-of-my-fucking-maze | ca2cfeaaeecb6c6f583ad647d020f25176170805 | [
"MIT"
] | null | null | null | src/events/cell_pressed.py | ArcosJuan/Get-out-of-my-fucking-maze | ca2cfeaaeecb6c6f583ad647d020f25176170805 | [
"MIT"
] | null | null | null | from src.events import Event
class CellPressed(Event):
def __init__(self, position):
self.position = position
def get_position(self):
return self.position | 18.6 | 33 | 0.672043 | 1 | 0.6741 | [
-0.0004747596103698015,
0.027213746681809425,
0.0055214762687683105,
-0.0009083346812985837,
0.005664294119924307,
-0.008483458310365677,
-0.010073722340166569,
0.0034049213863909245,
-0.008563495241105556,
0.001088266377337277,
0.003379551460966468,
0.008897567167878151,
0.010577930137515068,
-0.013684649951756,
0.0005290449480526149,
0.018681691959500313,
-0.05676973983645439,
0.005437562242150307,
-0.00459690298885107,
0.0024760535452514887,
-0.008613299578428268,
0.012783451937139034,
0.008193855173885822,
0.0067534311674535275,
0.008657105267047882,
0.001361743314191699,
0.011539173312485218,
0.004757894203066826,
-0.010693956166505814,
-0.004203081596642733,
-0.0012323867995291948,
0.0002574760001152754,
-0.004838016349822283,
-0.012096697464585304,
0.008007240481674671,
-0.006816171109676361,
0.0007070654537528753,
-0.02035088837146759,
0.008889596909284592,
-0.0037724936846643686,
-0.005490384995937347,
-0.017981411889195442,
-0.002624085871502757,
0.005539418663829565,
-0.012635861523449421,
0.008098437450826168,
-0.005052787717431784,
0.004712489899247885,
-0.012506251223385334,
0.0015099713345989585,
-0.010084511712193489,
0.005101731047034264,
0.011410406790673733,
0.0038247511256486177,
-0.005390467122197151,
-0.0076815583743155,
0.014310785569250584,
0.0011092581553384662,
-0.011259024031460285,
0.0004652384377550334,
-0.0010438392637297511,
-0.0027243588119745255,
0.003991951700299978,
-0.0005518170073628426,
-0.024390796199440956,
-0.00551309809088707,
-0.006728760432451963,
0.003001327393576503,
-0.0048533049412071705,
0.0047830804251134396,
0.0017069535097107291,
-0.0013406925136223435,
0.011068971827626228,
0.0035664502065628767,
0.00425746152177453,
-0.005641269963234663,
-0.0028554301243275404,
0.002396487398073077,
0.009343705140054226,
0.001071334001608193,
0.006447704043239355,
-0.00982401892542839,
0.004786905366927385,
0.012318674474954605,
0.013373742811381817,
0.009467464871704578,
0.01577910967171192,
-0.01209940668195486,
0.043581489473581314,
0.01078195869922638,
-0.012993223965168,
0.001676815445534885,
-0.00827462412416935,
-0.0029761549085378647,
-0.004767781589180231,
-0.03216376155614853,
0.000982550554908812,
-0.005452894605696201,
0.0003136090817861259,
0.005005395505577326,
0.002230229787528515,
0.009243153966963291,
-0.00123125989921391,
-0.002427954226732254,
-0.014437330886721611,
0.015137247741222382,
-0.013458695262670517,
-0.0029924544505774975,
0.008644049987196922,
-0.0006074435077607632,
-0.011396328918635845,
0.0005884918500669301,
-0.0015550990356132388,
-0.012113378383219242,
0.002927935216575861,
0.0005848105647601187,
-0.006984933745115995,
0.05888074263930321,
-0.0022520904894918203,
0.006760532036423683,
-0.006460290402173996,
-0.0025455078575760126,
0.0019708932377398014,
0.008422638289630413,
0.009461190551519394,
-0.004815822932869196,
0.010887451469898224,
0.005594233982264996,
0.00436488538980484,
0.0073051173239946365,
0.0018736328929662704,
0.009138689376413822,
-0.003691144986078143,
0.00007694291707593948,
-0.00015109515516087413,
-0.009726470336318016,
0.003307589329779148,
-0.0003094380081165582,
-0.006701137404888868,
0.006302929483354092,
-0.0020813478622585535,
-0.011622261255979538,
0.0013082247460260987,
0.0006362734129652381,
0.0007331468514166772,
-0.013416861183941364,
-0.0059874351136386395,
-0.0029136573430150747,
-0.005751202814280987,
0.003730783239006996,
0.0069153085350990295,
0.006694115698337555,
0.002216592663899064,
-0.0043024164624512196,
-0.006687540095299482,
-0.0036116279661655426,
-0.00607976783066988,
-0.00013567179848905653,
0.0104548130184412,
0.005989328492432833,
-0.009766870178282261,
-0.004019653890281916,
0.004139640834182501,
0.005405357573181391,
-0.0029975292272865772,
0.006843640469014645,
-0.006977628916501999,
0.010420383885502815,
0.0010722278384491801,
0.0018303489778190851,
0.013660197146236897,
-0.006255239248275757,
0.0006793810753151774,
-0.0001247288892045617,
0.006027851719409227,
0.0009219102212227881,
0.0032931885216385126,
0.010476465336978436,
-0.004954728297889233,
-0.0057795122265815735,
0.009081540629267693,
0.0003931796527467668,
0.008873964659869671,
0.007689486723393202,
0.0008146237814798951,
0.003873977577313781,
-0.004864543676376343,
0.00025957945035770535,
0.005534420255571604,
-0.0051615238189697266,
0.00963504146784544,
0.004562503192573786,
-0.015040787868201733,
-0.005853090900927782,
-0.0004495738830883056,
-0.010573524981737137,
0.001170656643807888,
0.015880824998021126,
0.012364903464913368,
-0.002490363083779812,
0.0008593847160227597,
-0.012784484773874283,
0.0015846694586798549,
0.009523986838757992,
-0.0001970338198589161,
-0.010613626800477505,
-0.9524847269058228,
0.00409180112183094,
0.0010468685068190098,
0.0006384372827596962,
0.0052312747575342655,
-0.0005059214890934527,
0.0020084362477064133,
0.0006988260429352522,
0.013812120072543621,
-0.00916830450296402,
-0.005197737365961075,
-0.008839387446641922,
-0.014968635514378548,
0.0006737647927366197,
-0.009006543084979057,
-0.00611658813431859,
-0.005146331619471312,
-0.007806301116943359,
-0.003008637111634016,
-0.0035046834964305162,
-0.0027286221738904715,
0.010830648243427277,
0.0011618451680988073,
0.004974763840436935,
0.005582348443567753,
0.007830544374883175,
-0.0034313052892684937,
-0.0014346969546750188,
0.005159601103514433,
0.001692968769930303,
-0.006889756303280592,
-0.011429120786488056,
-0.008046078495681286,
-0.0007175552891567349,
0.01481151208281517,
0.0008749236003495753,
0.006874609272927046,
0.001283943885937333,
0.001375832362100482,
-0.011884397827088833,
0.006816053297370672,
0.005327266175299883,
0.004724851809442043,
-0.029380252584815025,
0.0022875953000038862,
-0.005009121727198362,
-0.008017431013286114,
0.01260305754840374,
0.0029983087442815304,
-0.002660345286130905,
-0.004812906496226788,
-0.0049465554766356945,
0.008208182640373707,
-0.008709562011063099,
0.005032167304307222,
-0.006268984638154507,
-0.0056094517931342125,
-0.0025483027566224337,
-0.008519088849425316,
0.0024822044651955366,
0.0047375294379889965,
-0.0018165137153118849,
-0.0025966090615838766,
-0.0051077925600111485,
0.0023643935564905405,
-0.0001811482070479542,
0.0006641127984039485,
-0.02359785884618759,
-0.010738464072346687,
-0.0007130547892302275,
0.0034696476068347692,
0.0017109995242208242,
-0.003194203367456794,
0.0016580233350396156,
-0.011226577684283257,
0.005983519367873669,
0.001610184321179986,
0.0034142066724598408,
-0.008923104964196682,
0.003938573412597179,
-0.008674449287354946,
-0.010363169945776463,
0.006983918137848377,
-0.005654033739119768,
-0.0036069503985345364,
0.004725238773971796,
0.007810058072209358,
0.007564221974462271,
-0.003911723382771015,
0.0026033450849354267,
0.009877786040306091,
-0.0015818700194358826,
-0.011674967594444752,
0.009063437581062317,
0.008851060643792152,
0.004174486268311739,
-0.0032585663720965385,
0.005501593463122845,
0.00976201705634594,
0.009300989098846912,
0.0035403708461672068,
0.006412684451788664,
0.002075058175250888,
0.013257150538265705,
0.0008438224904239178,
0.004160755313932896,
-0.004783218260854483,
-0.0012131674448028207,
-0.0058073485270142555,
-0.0016527932602912188,
-0.0037294155918061733,
0.0008924016146920621,
-0.009053029119968414,
-0.013762746937572956,
-0.00615590950474143,
0.00041246190085075796,
-0.0008143387385644019,
-0.007087091449648142,
0.00037737865932285786,
0.00019691933994181454,
0.009363377466797829,
0.0019114766037091613,
-0.005361286457628012,
0.003896628739312291,
0.0008389786817133427,
-0.009000933729112148,
0.013873263262212276,
-0.015398668125271797,
0.006831327453255653,
-0.0006085498025640845,
-0.015925096347928047,
0.0072934008203446865,
0.009969724342226982,
-0.008215381763875484,
0.0017292433185502887,
-0.0007727719494141638,
0.0007911694119684398,
-0.0011590670328587294,
-0.005237526725977659,
-0.0021646544337272644,
-0.018128473311662674,
0.0002837220672518015,
0.021211829036474228,
0.004051541443914175,
0.009460638277232647,
0.009402969852089882,
-0.0048161162994802,
0.0030914153903722763,
0.00745952595025301,
0.0028049456886947155,
0.016226546838879585,
-0.010797711089253426,
0.0007260527927428484,
0.002038428094238043,
-0.004873916041105986,
0.0032707692589610815,
0.00360575458034873,
0.0025946549139916897,
-0.003943274728953838,
-0.00016960020002443343,
-0.0034559464547783136,
-0.005004038568586111,
-0.013718901202082634,
-0.0035178926773369312,
0.014065153896808624,
-0.003493555821478367,
0.006760686635971069,
-0.010363028384745121,
0.0024213099386543036,
0.00254999753087759,
0.005176769569516182,
0.00237271492369473,
0.001224928768351674,
0.008168134838342667,
0.012999325059354305,
-0.00589762581512332,
0.0042617302387952805,
0.0002824841358233243,
-0.0019980152137577534,
0.0053853243589401245,
0.008216774091124535,
-0.01095220260322094,
-0.004639882594347,
0.0037145994137972593,
0.0016048727557063103,
0.0022487109526991844,
-0.004215259570628405,
-0.008835457265377045,
-0.004036987666040659,
0.0039035985246300697,
-0.0058772750198841095,
0.0027585101779550314,
0.00275526219047606,
0.003574052359908819,
-0.011677720583975315,
-4.7183229412439687e-7,
-0.0016236002556979656,
-0.007140208501368761,
0.011141307651996613,
-0.0018607742385938764,
0.003686064388602972,
0.012948316521942616,
0.005313342437148094,
-0.015152002684772015,
0.010167781263589859,
0.007353509776294231,
-0.0068585192784667015,
0.007794288452714682,
0.006641085725277662,
-0.00391020905226469,
-0.023189453408122063,
-0.00039571209345012903,
-0.015622527338564396,
0.005442430730909109,
-0.0012309360317885876,
0.003283016150817275,
-0.008648838847875595,
0.010100237093865871,
0.005684275180101395,
-0.011978236958384514,
-0.002362851519137621,
-0.009774195030331612,
0.01045595295727253,
-0.001689221360720694,
-0.0005935371736995876,
-0.0028903705533593893,
-0.0019270590273663402,
-0.005365747958421707,
-0.0016113125020638108,
-0.0013693076325580478,
0.006541302427649498,
0.0015525324270129204,
-0.004022999666631222,
-0.0011219606967642903,
-0.00291138025932014,
0.0013339371653273702,
0.0037307559978216887,
-0.011829688213765621,
-0.0016649457393214107,
0.01017651055008173,
-0.0026723083574324846,
-0.004400394391268492,
-0.000707934086676687,
-0.004746279679238796,
-0.008100341074168682,
-0.010213126428425312,
-0.002140812808647752,
-0.005578376352787018,
-0.005814230069518089,
-0.009974048472940922,
-0.0038499063812196255,
-0.011304506100714207,
0.004644038155674934,
-0.00792128685861826,
0.0068513317964971066,
0.005876955576241016,
-0.004472948145121336,
0.008415722288191319,
-0.0006028330535627902,
0.007670050952583551,
0.0037939902395009995,
0.0057771094143390656,
0.0021016360260546207,
-0.010910047218203545,
-0.009344848804175854,
0.013633725233376026,
-0.01225605420768261,
-0.0004696965334005654,
0.015509516932070255,
0.006084846332669258,
0.009199255146086216,
-0.003973718732595444,
-0.0010384520282968879,
0.0019574614707380533,
0.007155525032430887,
-0.016240691766142845,
0.00396852707490325,
-0.0021830180194228888,
0.0005596571718342602,
0.004471661988645792,
-0.005911628715693951,
0.003942756447941065,
0.006657578982412815,
0.00145254610106349,
-0.007473674137145281,
-0.0032886432018131018,
-0.0040193358436226845,
0.006287351716309786,
-0.012856848537921906,
-0.0006883437745273113,
-0.004662021994590759,
-0.006738197989761829,
-0.005976456683129072,
-0.003089728532359004,
0.0007483567460440099,
0.0067442613653838634,
-0.005675546359270811,
0.0039534070529043674,
-0.0011653394903987646,
-0.003524729050695896,
0.014614004641771317,
-0.0014437518548220396,
-0.005861459765583277,
0.0028833721298724413,
0.0012387116439640522,
-0.0008167355554178357,
-0.008335207588970661,
-0.004844365641474724,
0.004055980127304792,
0.0031865115743130445,
-0.0015968671068549156,
-0.007503137923777103,
-0.0038210118655115366,
0.0007564139668829739,
-0.009083578363060951,
0.004703009966760874,
0.010596076026558876,
0.0022003694903105497,
0.005042639095336199,
-0.0011660801246762276,
-0.007848509587347507,
-0.014918312430381775,
0.05546842887997627,
-0.00173275510314852,
0.0039868662133812904,
0.00646447017788887,
-0.006872451398521662,
-0.001748821116052568,
0.0014808509731665254,
0.007555118761956692,
-0.004752033855766058,
-0.0075338720344007015,
0.010099565610289574,
-0.00302143138833344,
0.0009416313259862363,
0.001199562568217516,
-0.000844022142700851,
0.015807166695594788,
-0.006063169799745083,
-0.017660556361079216,
-0.0133338812738657,
0.0038147077430039644,
-0.007874738425016403,
-0.006765968631953001,
0.006150518078356981,
-0.0020581402350217104,
-0.0026649555657058954,
0.0011875935597345233,
0.008238637819886208,
-0.0003481467720121145,
-0.0014654435217380524,
-0.0006150050321593881,
-0.0019967362750321627,
0.00039395809289999306,
0.004944634158164263,
0.0034861534368246794,
0.011381136253476143,
-0.0015745391137897968,
0.007059815805405378,
-0.0035726085770875216,
-0.002161195268854499,
-0.0023778018075972795,
0.005599744617938995,
0.007872773334383965,
-0.002057660836726427,
-0.003753089811652899,
0.0007356324349530041,
0.0030170821119099855,
0.0005466870497912169,
0.014550942927598953,
0.0015761239919811487,
-0.0045179459266364574,
0.003904724959284067,
0.0069403634406626225,
-0.0023947935551404953,
0.010033716447651386,
-0.0006717918440699577,
0.004167952109128237,
0.004370108246803284,
-0.008906526491045952,
-0.015191062353551388,
0.0037669071462005377,
0.009021579287946224,
0.006948370952159166,
-0.004308188799768686,
0.0014206027844920754,
-0.0010784209007397294,
-0.0037973043508827686,
-0.012787279672920704,
-0.008179140277206898,
-0.004819042980670929,
-0.0002200830786023289,
0.002569108037278056,
0.06954430043697357,
-0.007891918532550335,
-0.004095352254807949,
-0.011891723610460758,
0.0033610810060054064,
-0.00034278142265975475,
-0.0033359271474182606,
-0.0010212253546342254,
-0.0017570514464750886,
0.004899050109088421,
0.0026829035487025976,
-0.012004834599792957,
-0.011945771984755993,
0.0002149740612367168,
0.0026203894522041082,
-0.0028867751825600863,
0.0019385885680094361,
0.007119905669242144,
-0.006081132683902979,
0.00593180488795042,
-0.015659959986805916,
-0.006603974848985672,
-0.0024899530690163374,
-0.007632947992533445,
-0.005325034260749817,
-0.0043563758954405785,
0.001600227551534772,
0.0036456233356148005,
0.008577552624046803,
-0.006666636560112238,
0.006264575757086277,
-0.0033679665066301823,
0.003342850599437952,
-0.003043179865926504,
-0.002322855871170759,
-0.008209023624658585,
0.007907848805189133,
0.0011569928610697389,
-0.01645614579319954,
-0.005859230645000935,
-0.0022980044595897198,
-0.0003470717347227037,
-0.0052573541179299355,
0.008817343972623348,
-0.0011496971128508449,
0.009379555471241474,
-0.005400445312261581,
0.0039102425798773766,
-0.004122063517570496,
0.004697469994425774,
-0.014969677664339542,
0.0011670547537505627,
-0.18281635642051697,
0.008672844618558884,
0.003235776908695698,
-0.007335050031542778,
-0.003405860159546137,
-0.016324864700436592,
-0.012768685817718506,
0.005851334892213345,
0.010714535601437092,
0.001510864240117371,
0.0025071371346712112,
-0.008493800647556782,
0.006611921358853579,
0.004637008998543024,
-0.0013992800377309322,
-0.008221996948122978,
0.005814013537019491,
-0.006240928545594215,
-0.0036423085257411003,
0.00552600109949708,
0.008024504408240318,
0.009817195124924183,
0.0013693058863282204,
0.0018277071649208665,
0.0006131610716693103,
-0.00032970443135127425,
0.0042982203885912895,
-0.003453086828812957,
0.004631933756172657,
-0.009344222024083138,
-0.0034362252335995436,
-0.005032399669289589,
-0.004778991919010878,
0.0029389457777142525,
0.0020275101996958256,
0.0022679567337036133,
0.007245556451380253,
0.0007893607835285366,
-0.010966830886900425,
0.007695859298110008,
-0.007079077418893576,
0.030439460650086403,
0.00490903202444315,
0.009697732515633106,
0.00033444585278630257,
-0.002801098395138979,
-0.006028919946402311,
0.010201863944530487,
0.002360729966312647,
0.014246545732021332,
-0.012162168510258198,
-0.006596548482775688,
0.002218457404524088,
0.017588511109352112,
-0.004848700016736984,
-0.008940806612372398,
-0.009105279110372066,
-0.004929771181195974,
0.0037231792230159044,
0.009432385675609112,
0.01410200446844101,
-0.006906403228640556,
0.007215414196252823,
-0.006249946542084217,
-0.022502509877085686,
0.0021104849874973297,
0.001704904017969966,
-0.007582336198538542,
0.0016550697619095445,
0.00606912188231945,
0.009782307781279087,
-0.00032893146271817386,
0.006181708537042141,
0.0018773062620311975,
0.0020302420016378164,
-0.007174615748226643,
0.007931601256132126,
-0.0003820931015070528,
0.007388481870293617,
-0.010325508192181587,
0.012957652099430561,
-0.008659102953970432,
-0.001702668028883636,
0.001788505120202899,
-0.002860983368009329,
0.011655106209218502,
0.007090938277542591,
-0.005558772012591362,
-0.00015039312711451203,
-0.015340260230004787,
-0.0007098246715031564,
0.002404439263045788,
0.002351920586079359,
-0.007603786885738373,
0.0014761348720639944,
-0.0030884677544236183,
0.004811808466911316,
0.008972764015197754,
-0.00624968484044075,
0.006790430750697851,
0.003092967439442873,
-0.006428068038076162,
0.0019115959294140339,
-0.01020409818738699,
0.0071798511780798435,
0.007576830685138702,
-0.00866030715405941,
-0.008903576992452145,
0.006081514060497284,
-0.0057234978303313255,
-0.0026818388141691685,
0.005148552358150482,
-0.011506833136081696,
-0.010680967941880226,
0.0009740389650687575,
-0.010881539434194565,
-0.0014350167475640774
] |
8a73f2115b3d49a7048eebbbf6a7d009bf2bcb02 | 864 | py | Python | TopQuarkAnalysis/TopJetCombination/python/TtSemiLepJetCombMaxSumPtWMass_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | TopQuarkAnalysis/TopJetCombination/python/TtSemiLepJetCombMaxSumPtWMass_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | TopQuarkAnalysis/TopJetCombination/python/TtSemiLepJetCombMaxSumPtWMass_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | import FWCore.ParameterSet.Config as cms
#
# module to make the MaxSumPtWMass jet combination
#
findTtSemiLepJetCombMaxSumPtWMass = cms.EDProducer("TtSemiLepJetCombMaxSumPtWMass",
## jet input
jets = cms.InputTag("selectedPatJets"),
## lepton input
leps = cms.InputTag("selectedPatMuons"),
## maximum number of jets to be considered
maxNJets = cms.int32(4),
## nominal WMass parameter (in GeV)
wMass = cms.double(80.4),
## use b-tagging two distinguish between light and b jets
useBTagging = cms.bool(False),
## choose algorithm for b-tagging
bTagAlgorithm = cms.string("trackCountingHighEffBJetTags"),
## minimum b discriminator value required for b jets and
## maximum b discriminator value allowed for non-b jets
minBDiscBJets = cms.double(1.0),
maxBDiscLightJets = cms.double(3.0)
)
| 36 | 83 | 0.706019 | 1 | 0.9861 | [
-0.003045583376660943,
0.023234806954860687,
0.005887039937078953,
-0.0021130272652953863,
0.005016990005970001,
-0.0025182331446558237,
-0.007923886179924011,
0.0033701485954225063,
-0.004678789526224136,
0.0036415972281247377,
0.0031297258101403713,
0.00512638920918107,
0.010260026901960373,
-0.014711538329720497,
-0.0034563534427434206,
0.015664538368582726,
-0.053130313754081726,
-0.0022942498326301575,
-0.005531533155590296,
0.002154833870008588,
-0.0061866301111876965,
0.010064095258712769,
0.011387460865080357,
0.010768533684313297,
0.006967312190681696,
0.0000826241957838647,
0.01037245336920023,
0.0038759768940508366,
-0.006281515583395958,
-0.005711184348911047,
0.0003914495464414358,
-0.004017730243504047,
-0.005243391264230013,
-0.011720804497599602,
0.004706786014139652,
-0.003918503876775503,
-0.0017640232108533382,
-0.01399026159197092,
0.007960119284689426,
-0.0038356813602149487,
-0.011346247047185898,
-0.015281036496162415,
0.0007983721443451941,
0.005940018687397242,
-0.011961521580815315,
-0.0031691049225628376,
-0.0032299021258950233,
0.0026720226742327213,
-0.0062528750859200954,
0.009599789045751095,
-0.009953560307621956,
-0.0014439028454944491,
0.01917335018515587,
0.006921777036041021,
-0.006272104103118181,
-0.008226841688156128,
0.013043703511357307,
-0.0019133462337777019,
-0.013759954832494259,
-0.003922060132026672,
0.00025626967544667423,
-0.0049481382593512535,
0.006091699935495853,
0.0029419793281704187,
-0.014671220444142818,
-0.006517904344946146,
-0.003501689760014415,
-0.0005382790695875883,
-0.007604455575346947,
-0.00046601297799497843,
0.0036842909175902605,
-0.002919020364060998,
0.007862293161451817,
0.0054501816630363464,
0.0001303378667216748,
-0.005881881341338158,
-0.004074981436133385,
0.005199786275625229,
0.0073021273128688335,
0.0008692947449162602,
0.00542235653847456,
-0.00446326332166791,
0.009264868684113026,
0.0139008779078722,
0.017656518146395683,
0.0004280588764231652,
0.015371158719062805,
-0.01238104049116373,
0.04257580637931824,
0.0021059478167444468,
-0.01130760833621025,
-0.0028139352798461914,
-0.009005667641758919,
-0.0025623913388699293,
-0.0007692487561143935,
-0.0320514515042305,
0.002955497708171606,
-0.0019721491262316704,
-0.001333869993686676,
0.005634138360619545,
0.0014905034331604838,
0.005341143812984228,
0.0006769640021957457,
-0.0012104419292882085,
-0.009967727586627007,
0.013293788768351078,
-0.00819037202745676,
-0.0028846149798482656,
0.007577160373330116,
0.0027226251550018787,
-0.009960691444575787,
-0.0018838781397789717,
-0.001057342509739101,
-0.015551515854895115,
0.0011249510571360588,
0.007113221101462841,
-0.004629907663911581,
0.0542687363922596,
-0.007258705794811249,
0.0037313345819711685,
-0.0026266081258654594,
0.004179628100246191,
0.0035162814892828465,
0.008595354855060577,
0.006575049366801977,
-0.001069420832209289,
0.007401243317872286,
0.008987120352685452,
0.004739359021186829,
0.00845319963991642,
-0.00035543576814234257,
0.010058754123747349,
-0.004788554739207029,
-0.004177534021437168,
-0.0029174291994422674,
-0.004611625801771879,
0.00788493175059557,
-0.001355342217721045,
-0.01026913896203041,
0.0014050480676814914,
-0.0012078401632606983,
-0.010640119202435017,
-0.000666422420181334,
-0.0012374107027426362,
0.0013100544456392527,
-0.009801474399864674,
-0.002082021674141288,
-0.00453249691054225,
-0.005841948091983795,
0.005888216197490692,
0.006743886508047581,
0.005035906098783016,
0.0026178990956395864,
-0.0046152048744261265,
-0.010248348116874695,
0.002847087336704135,
-0.0038769119419157505,
0.00009386737656313926,
0.009777930565178394,
0.002167105907574296,
-0.013681529089808464,
0.0016076323809102178,
-0.0035181960556656122,
0.0014418652281165123,
0.0024797385558485985,
0.0052457936108112335,
-0.007453407160937786,
0.013710003346204758,
-0.00098380574490875,
0.0034386811312288046,
0.011551198549568653,
-0.008260687813162804,
0.0013657684903591871,
-0.0014702780172228813,
0.006450798362493515,
-0.00604274682700634,
0.004758066032081842,
0.009759060107171535,
0.0009283465915359557,
-0.00497458828613162,
0.005363821517676115,
0.00578347546979785,
0.005685705691576004,
0.010846728459000587,
-0.004081956576555967,
0.0021019105333834887,
-0.009967576712369919,
0.001923939911648631,
0.00449634063988924,
-0.006527231074869633,
0.009491190314292908,
0.0002891881740652025,
-0.018224317580461502,
-0.00893852673470974,
-0.0062064179219305515,
-0.008838976733386517,
0.0007464811205863953,
0.020796313881874084,
0.014393136836588383,
-0.004347244743257761,
0.00002764568489510566,
-0.008947878144681454,
0.0011383057571947575,
0.008367564529180527,
0.004148508887737989,
-0.013483518734574318,
-0.9548889398574829,
0.004244410432875156,
0.005682247690856457,
-0.00524443294852972,
0.007589701563119888,
0.002455262467265129,
0.004515014588832855,
0.0035848442930728197,
0.014431731775403023,
-0.006789280101656914,
-0.010452335700392723,
-0.008329319767653942,
-0.011294049210846424,
-0.00016035455337259918,
-0.008240130729973316,
0.000701037875842303,
-0.002067982219159603,
-0.005867963191121817,
-0.002068778732791543,
-0.005132779013365507,
0.0005637362482957542,
0.011415887624025345,
-0.002405562438070774,
0.005325368605554104,
0.0015675262548029423,
0.0035366564989089966,
-0.0011749672703444958,
-0.00122440280392766,
-0.005625253077596426,
-0.0029729651287198067,
-0.006228586193174124,
-0.01644154079258442,
-0.008677404373884201,
-0.0008164893952198327,
0.008115471340715885,
0.001986683811992407,
0.013121826574206352,
-0.000018351496692048386,
0.006388003472238779,
-0.012138611637055874,
0.006050091702491045,
0.000906331290025264,
-0.002022064756602049,
-0.02625994198024273,
-0.0010012974962592125,
-0.0023854519240558147,
-0.005260319449007511,
0.0068976678885519505,
0.00044431074638850987,
-0.0021648004185408354,
-0.005630271043628454,
-0.009625455364584923,
0.008913129568099976,
-0.00547165609896183,
0.008098344318568707,
-0.0076091294176876545,
-0.007912691682577133,
-0.004154780879616737,
-0.007519049569964409,
0.001131365541368723,
-0.0025351145304739475,
-0.004591654986143112,
-0.006202641408890486,
-0.0027985384222120047,
0.0007209539762698114,
0.00018943836039397866,
-0.0028347966726869345,
-0.01891721785068512,
-0.0021003454457968473,
-0.0010845366632565856,
0.006937950383871794,
0.0014670419041067362,
-0.006196167320013046,
0.006278101354837418,
-0.009093422442674637,
0.010377993807196617,
0.0026318721938878298,
0.0013106709811836481,
-0.011279702186584473,
-0.0009721138630993664,
-0.011987517587840557,
-0.007647556718438864,
0.0017187697812914848,
-0.002819986781105399,
-0.004333607852458954,
-0.00021180440671741962,
0.00046503296471200883,
0.01398587878793478,
-0.0034838749561458826,
0.0056188711896538734,
0.014117647893726826,
-0.0035284708719700575,
-0.01014371681958437,
0.007621606346219778,
0.004836706910282373,
0.0026385027449578047,
-0.003298357594758272,
-0.0012328210286796093,
0.002304947003722191,
0.0058883740566670895,
0.0022863969206809998,
0.009716578759253025,
0.001884438213892281,
0.011519228108227253,
-0.004135852679610252,
-0.0007627795566804707,
-0.008197751827538013,
-0.0034718425013124943,
-0.00010349920921726152,
-0.0014471779577434063,
0.00022321716824080795,
0.0005591646768152714,
-0.009023771621286869,
-0.0153780123218894,
-0.006048248149454594,
-0.0031047614756971598,
-0.0018013451481238008,
-0.005451179575175047,
0.0007467391551472247,
-0.00046390265924856067,
0.010477638803422451,
0.000681399367749691,
-0.007123064715415239,
0.00031776129617355764,
0.00757954828441143,
-0.009500286541879177,
0.018160296604037285,
-0.013869404792785645,
0.005501314532011747,
-0.0006562807247973979,
-0.016651462763547897,
0.011173048056662083,
0.003846468636766076,
-0.005584831815212965,
0.005967502947896719,
0.001966687384992838,
0.001801730482839048,
0.002154923276975751,
-0.001980926375836134,
-0.0050698076374828815,
-0.01569169946014881,
0.0004136219504289329,
0.019558928906917572,
0.002977200085297227,
0.007986851967871189,
0.014378387480974197,
-0.0013799878070130944,
-0.0019409232772886753,
0.011368597857654095,
-0.00263696676120162,
0.014502035453915596,
-0.008311779238283634,
0.0015430625062435865,
0.0009706489508971572,
-0.005056506488472223,
0.0007972706225700676,
0.0053446367383003235,
0.009904631413519382,
-0.0031807427294552326,
0.0029678186401724815,
-0.005219550803303719,
-0.0053797620348632336,
-0.016133613884449005,
0.0017242777394130826,
0.010207743383944035,
-0.005549875553697348,
0.0018371365731582046,
-0.015691032633185387,
0.0005955854430794716,
0.0025889358948916197,
0.0012515010312199593,
0.0013213437050580978,
0.004213904961943626,
0.0063008395954966545,
0.010848534293472767,
-0.008972754701972008,
-0.0009100540773943067,
0.004597363527864218,
-0.003962110728025436,
0.002534931991249323,
0.0053223129361867905,
-0.011380513198673725,
-0.005282464902848005,
0.003686330048367381,
0.004156786948442459,
0.000127411971334368,
-0.0038020412903279066,
-0.005508441012352705,
-0.00407835841178894,
0.004134323913604021,
-0.010106037370860577,
0.0029334037099033594,
0.004811661783605814,
0.0027036641258746386,
-0.006819893140345812,
0.00047562833060510457,
-0.0122829033061862,
-0.009652342647314072,
0.013235781341791153,
-0.0028835185803472996,
0.0020367635879665613,
0.012682735919952393,
0.0004245783493388444,
-0.013254739344120026,
0.005386001896113157,
0.006947364658117294,
-0.005337362643331289,
0.0002639468584675342,
0.0032440738286823034,
-0.002907751826569438,
-0.025516070425510406,
-0.0011639335425570607,
-0.010803940705955029,
0.002735249465331435,
-0.0024970730300992727,
0.0044050379656255245,
-0.008113708347082138,
0.013120980001986027,
0.004039562772959471,
-0.017186781391501427,
-0.003546783234924078,
-0.007953796535730362,
0.009334830567240715,
-0.000034870856325142086,
-0.0005236240685917437,
-0.0005967590841464698,
-0.0022606700658798218,
-0.0050064194947481155,
-0.007697833701968193,
-0.0011178713757544756,
0.0038488060235977173,
-0.00007021788042038679,
-0.005470724776387215,
0.003040806157514453,
-0.005493862554430962,
-0.0005545643507502973,
0.002675327705219388,
-0.011633777059614658,
0.005608890205621719,
0.0069523765705525875,
-0.002510775811970234,
0.0013919336488470435,
0.0036893298383802176,
-0.009123706258833408,
-0.004906505346298218,
-0.013204892165958881,
-0.009974143467843533,
-0.006429236847907305,
-0.0029760475736111403,
-0.011047057807445526,
-0.003498397534713149,
-0.005957047455012798,
0.010417520999908447,
-0.0007159441011026502,
0.006157224532216787,
0.0043165371753275394,
-0.007461587432771921,
0.0049415272660553455,
0.00022697931854054332,
0.0037102140486240387,
0.004293413832783699,
0.008243276737630367,
-0.007728288881480694,
-0.011804775334894657,
-0.008617077022790909,
0.017577730119228363,
-0.011906992644071579,
0.0035337689332664013,
0.015499376691877842,
0.007944700308144093,
0.01139523833990097,
0.0038452756125479937,
-0.0006865952163934708,
-0.0004520658403635025,
0.008938178420066833,
-0.014839518815279007,
0.004773044027388096,
0.0002649931702762842,
-0.0020803213119506836,
0.006398190278559923,
-0.0015550794778391719,
0.0028274627402424812,
0.012014157138764858,
-0.0010407725349068642,
-0.00562665332108736,
0.0009554740972816944,
-0.00027785435668192804,
0.005375901702791452,
-0.012486018240451813,
-0.001839549746364355,
-0.0015905277105048299,
-0.005500337574630976,
0.0001351639803033322,
-0.0026812751311808825,
-0.0008034099591895938,
0.005427584983408451,
-0.001030651619657874,
0.006070255767554045,
0.0024196295998990536,
-0.006892323959618807,
0.012117717415094376,
-0.00818221177905798,
-0.007034883834421635,
0.003025163896381855,
-0.0031665260903537273,
-0.0023962578270584345,
-0.004191284533590078,
0.002705313265323639,
0.004128577653318644,
0.004607939627021551,
-0.0026078682858496904,
-0.0062850224785506725,
-0.0036908374167978764,
0.003937883768230677,
-0.012548776343464851,
0.0004518227942753583,
0.011201511137187481,
-0.0026368761900812387,
0.0027798525989055634,
-0.0015052531380206347,
-0.006698909215629101,
-0.01873479038476944,
0.05694212391972542,
0.0011911860201507807,
0.0017948673339560628,
0.0035946255084127188,
-0.00797751359641552,
-0.002190160797908902,
0.0010719388956204057,
0.0005744806840084493,
-0.005490346811711788,
-0.002999486168846488,
0.006536704953759909,
-0.00303258141502738,
0.005575855262577534,
-0.0009348539751954377,
-0.00622634356841445,
0.014547238126397133,
-0.006944742053747177,
-0.014437141828238964,
-0.012283435091376305,
0.008333290927112103,
-0.0032407145481556654,
-0.003933591302484274,
0.004414449445903301,
-0.004586690571159124,
-0.00326544395647943,
-0.0014140027342364192,
0.0023535853251814842,
-0.0030159023590385914,
-0.0018867439357563853,
-0.0003811916976701468,
0.00008892400364857167,
-0.005044846795499325,
0.0018901006551459432,
0.004556145053356886,
0.009001804515719414,
-0.003392049577087164,
0.005614381283521652,
0.0016751117072999477,
-0.003715434344485402,
-0.0006989011890254915,
0.006359899416565895,
0.006894230842590332,
-0.00034160047653131187,
-0.0033228485845029354,
0.004939468577504158,
0.007157555781304836,
0.0012298007495701313,
0.01138924341648817,
-0.0031832396052777767,
-0.008209923282265663,
0.00724890548735857,
0.009698308072984219,
-0.002289252821356058,
0.009110731072723866,
-0.0006729215383529663,
0.005116368643939495,
0.006187370978295803,
-0.00952089298516512,
-0.014492477290332317,
-0.0021987271029502153,
0.0034586500842124224,
0.006315609440207481,
-0.0017421339871361852,
0.006438486743718386,
-0.004139433614909649,
-0.0006549528334289789,
-0.008830518461763859,
-0.006583485286682844,
0.0012205211678519845,
0.0015519754961133003,
0.005968509241938591,
0.07125396281480789,
-0.0032486016862094402,
-0.007299941964447498,
-0.00978597067296505,
-0.0028563910163939,
-0.0029013599269092083,
0.0015750444727018476,
0.002184502547606826,
-0.0009097600122913718,
0.005334110930562019,
0.0026101525872945786,
-0.008245282806456089,
-0.011042078956961632,
0.002308166353031993,
0.007237462792545557,
-0.0042546698823571205,
0.001283898949623108,
0.005714991595596075,
-0.005997787695378065,
0.0048005664721131325,
-0.0135227395221591,
-0.00003103534982074052,
0.000246523559326306,
-0.008187376894056797,
0.0017468624282628298,
-0.003377272980287671,
0.0033675392623990774,
0.003335973247885704,
0.009075544774532318,
-0.0021612055134028196,
0.0100245987996459,
-0.004744385369122028,
0.00200912868604064,
-0.004225148819386959,
0.005300094373524189,
-0.007895905524492264,
0.004320851061493158,
-0.002790838945657015,
-0.012149478308856487,
-0.003909666556864977,
0.001154612866230309,
0.004631426185369492,
-0.004863815847784281,
0.006586690898984671,
0.0007670235936529934,
0.011837237514555454,
-0.0017972298664972186,
0.006209586281329393,
-0.005727923475205898,
0.000317468453431502,
-0.011702713556587696,
0.006668173708021641,
-0.17708782851696014,
0.010607266798615456,
0.002692267531529069,
-0.009606150910258293,
-0.003411736572161317,
-0.01411406695842743,
-0.008462212048470974,
0.0010382633190602064,
0.009528479538857937,
0.002347726607695222,
0.0011969864135608077,
-0.0006196897011250257,
0.0015521999448537827,
0.0056407819502055645,
-0.005842064972966909,
0.0010262499563395977,
0.005396184045821428,
-0.010342097841203213,
0.0009234719327650964,
0.0035999733954668045,
0.0008982906001619995,
0.010768542066216469,
0.008097919635474682,
0.005262113641947508,
-0.0016311471117660403,
-0.003102450165897608,
0.008031105622649193,
-0.0038450206629931927,
0.006068989634513855,
-0.016842488199472427,
-0.006456844974309206,
-0.0013407337246462703,
-0.002442500554025173,
0.001565846847370267,
0.004161984194070101,
0.0006679199286736548,
0.007856147363781929,
-0.0007010209956206381,
-0.008017752319574356,
0.011016318574547768,
-0.0066823228262364864,
0.032859429717063904,
0.004362835083156824,
-0.001906618126668036,
0.00022012923727743328,
0.0007806850480847061,
-0.00035964950802735984,
0.011930661275982857,
0.004218371119350195,
0.012264078482985497,
-0.017370516434311867,
-0.0021926555782556534,
0.0035219613928347826,
0.023287734016776085,
-0.004521178547292948,
-0.0063393437303602695,
-0.007397588808089495,
-0.004226958844810724,
-0.0018299318617209792,
0.01281184982508421,
0.0052347443997859955,
-0.008199057541787624,
0.007393236272037029,
-0.004754994064569473,
-0.019131790846586227,
0.0007967305718921125,
-0.003261175472289324,
-0.002281838096678257,
0.0035466933622956276,
0.006060110870748758,
0.010378767736256123,
0.0034176213666796684,
0.0035071750171482563,
-0.003883075201883912,
-0.003110039746388793,
-0.0008941721171140671,
0.007148280739784241,
-0.0036011789925396442,
0.005443599075078964,
-0.00881410576403141,
0.009291872382164001,
-0.009004794992506504,
-0.004787821788340807,
0.006192970089614391,
-0.010179350152611732,
0.014088855125010014,
0.003402561880648136,
-0.00032016547629609704,
-0.0018962356261909008,
-0.010937390848994255,
0.0037826504558324814,
0.0018419873667880893,
0.0028160682413727045,
-0.0036364486441016197,
0.002762249205261469,
0.0021906690672039986,
0.007262053433805704,
0.008278372697532177,
-0.00972871296107769,
0.010240856558084488,
0.004550780635327101,
-0.006637207698076963,
-0.00043821343570016325,
-0.005189123097807169,
-0.0003723505651578307,
0.002580492990091443,
-0.0026458818465471268,
-0.007546973880380392,
0.004447454120963812,
-0.007932085543870926,
-0.004871103912591934,
0.008111509494483471,
-0.010565981268882751,
-0.009989233687520027,
-0.003485976718366146,
-0.007555714342743158,
0.00410828273743391
] |
8a746baf4af656a91220d07018cb78e6eb2e1b1f | 119 | py | Python | xortool/__init__.py | runapp/xortool | 9dac27387e7883775936a31e67598eaba182e053 | [
"MIT"
] | 14 | 2017-06-14T06:10:07.000Z | 2019-02-22T03:21:15.000Z | Cryptography/tools/xortool-master/xortool/__init__.py | rookie-12/My-Gray-Hacker-Resources | e9b10ac7b0e557a9e624a5a6e761f9af4488d777 | [
"MIT"
] | 1 | 2021-04-30T21:19:32.000Z | 2021-04-30T21:19:32.000Z | Cryptography/tools/xortool-master/xortool/__init__.py | rookie-12/My-Gray-Hacker-Resources | e9b10ac7b0e557a9e624a5a6e761f9af4488d777 | [
"MIT"
] | 7 | 2015-10-01T09:47:05.000Z | 2022-01-21T14:25:37.000Z | #!/usr/bin/env python
#-*- coding:utf-8 -*-
__all__ = ["args", "colors", "libcolors", "routine"]
__version__ = "0.96"
| 19.833333 | 52 | 0.605042 | 1 | 0.6786 | [
0.0027135531418025494,
0.022607749328017235,
0.00964909978210926,
-0.0003602835349738598,
0.004017453175038099,
-0.00408434821292758,
-0.01129577960819006,
0.006213442422449589,
-0.006349824834614992,
-0.0015022768639028072,
0.000715274247340858,
0.007145796436816454,
0.006105243694037199,
-0.01607479713857174,
0.004156918730586767,
0.018934881314635277,
-0.05957051366567612,
0.002154878806322813,
-0.004637845791876316,
0.004093162715435028,
-0.008875636383891106,
0.013890608213841915,
0.007053160574287176,
0.010309205390512943,
0.006008583586663008,
0.0016517620533704758,
0.011985061690211296,
0.004681525286287069,
-0.007592255249619484,
-0.006898743100464344,
0.001070366706699133,
-0.002950061112642288,
-0.0068652452901005745,
-0.00946179311722517,
0.0072347670793533325,
-0.004987162537872791,
0.0006533612031489611,
-0.018490098416805267,
0.00930798053741455,
-0.006216940935701132,
-0.007879734970629215,
-0.016142118722200394,
-0.0010376013815402985,
0.0079324496909976,
-0.010179935023188591,
0.003260127268731594,
-0.0035084430128335953,
0.0048686605878174305,
-0.005971041973680258,
0.007095659151673317,
-0.010875211097300053,
0.0029279994778335094,
0.012025241740047932,
0.004573279991745949,
-0.006978586781769991,
-0.006542860064655542,
0.010161442682147026,
-0.0000063540592236677185,
-0.01398689579218626,
-0.002075605560094118,
-0.0050679538398981094,
-0.00430127652361989,
0.002424047328531742,
0.0037400892470031977,
-0.017971836030483246,
-0.007924840785562992,
-0.004983671475201845,
0.0017362004145979881,
-0.0006041083252057433,
0.007526840083301067,
0.0023220779839903116,
-0.002435477217659354,
0.009185452945530415,
0.0015507112257182598,
0.0024662103969603777,
-0.001247203559614718,
-0.0017120273550972342,
0.005605111829936504,
0.006813229061663151,
0.003146406030282378,
0.007515243254601955,
-0.010656927712261677,
0.008051090873777866,
0.013689606450498104,
0.010346331633627415,
0.007528352551162243,
0.015009673312306404,
-0.009628955274820328,
0.0411500446498394,
0.002639087615534663,
-0.009549977257847786,
0.0004586698778439313,
-0.0076094395481050014,
-0.0018708256538957357,
-0.004470955580472946,
-0.03105033189058304,
-0.0010687651811167598,
-0.0033290167339146137,
0.000009303405931859743,
0.004952466115355492,
-0.001320147537626326,
0.004858790431171656,
-0.00635387422516942,
-0.004972503520548344,
-0.011079401709139347,
0.014664757996797562,
-0.008232295513153076,
-0.0011352429864928126,
0.010772387497127056,
0.0038540444802492857,
-0.010784916579723358,
-0.0025941389612853527,
0.0015019754646345973,
-0.010598467662930489,
0.007652911823242903,
0.0024422770366072655,
-0.004334512632340193,
0.05638837441802025,
-0.0016440530307590961,
0.0011276075383648276,
-0.004968954715877771,
-0.000513311882968992,
0.0006989952526055276,
0.008871134370565414,
0.010800899937748909,
-0.0070847999304533005,
0.013175313360989094,
0.00606020400300622,
0.001519502024166286,
0.006948549300432205,
0.0007172908517532051,
0.008167555555701256,
-0.00395549088716507,
-0.000740814779419452,
-0.0009506858186796308,
-0.0065271309576928616,
0.008333366364240646,
-0.0012180720223113894,
-0.0027313807513564825,
0.003341078758239746,
-0.0010515464236959815,
-0.01478932611644268,
-0.00041410181438550353,
0.0007693814695812762,
0.00271238898858428,
-0.009721162728965282,
-0.005052537657320499,
-0.001979381777346134,
-0.003071750747039914,
0.0013554681790992618,
0.007831734605133533,
0.002305072732269764,
0.004643799737095833,
-0.008214193396270275,
-0.005935148801654577,
-0.0031012145336717367,
-0.003456961363554001,
0.003475593402981758,
0.007533039432018995,
0.00534126115962863,
-0.0069602783769369125,
-0.0035297514405101538,
0.003983018454164267,
0.006628594361245632,
-0.0012729165609925985,
-0.0016920370981097221,
-0.007671995088458061,
0.007751792203634977,
0.0024413291830569506,
0.004382940474897623,
0.01176456082612276,
-0.0040139262564480305,
-0.0002399525692453608,
0.0008485120488330722,
0.005192093551158905,
-0.0005431345198303461,
0.005461220163851976,
0.008247158490121365,
-0.006215689238160849,
-0.004183674231171608,
0.003985321614891291,
0.0018674487946555018,
0.007300143595784903,
0.008453359827399254,
-0.0038248994387686253,
0.001761427498422563,
-0.000618797610513866,
0.0007452411227859557,
0.0056725675240159035,
-0.005813999101519585,
0.007763460744172335,
0.004377951379865408,
-0.01646558567881584,
-0.007728300057351589,
-0.0024888855405151844,
-0.011330557987093925,
-0.0003287149884272367,
0.015617982484400272,
0.010111133567988873,
-0.000023461467208107933,
0.004143755417317152,
-0.011813133023679256,
-0.0016547141131013632,
0.005085085518658161,
-0.0005233431584201753,
-0.011260975152254105,
-0.9558058977127075,
0.00035210823989473283,
0.0032287901267409325,
-0.0011907058069482446,
0.003691474674269557,
0.0006059601437300444,
0.0019317344995215535,
0.0012677889317274094,
0.01527316216379404,
-0.009827257134020329,
-0.008208395913243294,
-0.009379065595567226,
-0.011748983524739742,
-0.00002974443486891687,
-0.006120959762483835,
-0.003278161631897092,
-0.006830744910985231,
-0.008313500322401524,
0.0001544811384519562,
-0.004676476586610079,
-0.0014990558847784996,
0.011142884381115437,
-0.0007818278972990811,
0.0023250479716807604,
0.0030365074053406715,
0.003494377015158534,
-0.004092239774763584,
-0.00047205068403854966,
-0.0006165893282741308,
-0.0037779060658067465,
-0.003718507941812277,
-0.018568409606814384,
-0.0068457587622106075,
-0.0014900172827765346,
0.013099455274641514,
0.002213586587458849,
0.008501386269927025,
0.0005938905524089932,
-0.00014045427087694407,
-0.009592586196959019,
0.004714362323284149,
0.00392660778015852,
0.0019721451681107283,
-0.03087690845131874,
0.002421214012429118,
-0.0006437667179852724,
-0.007465127389878035,
0.006828205659985542,
0.0028652872424572706,
-0.0021745224948972464,
-0.002332592848688364,
-0.0033885776065289974,
0.008546644821763039,
-0.008947988040745258,
0.00333958538249135,
-0.006714922375977039,
-0.005322022829204798,
-0.003482104977592826,
-0.010328361764550209,
0.0018461230210959911,
0.0014776301104575396,
-0.006611946504563093,
-0.004945690743625164,
-0.00375836412422359,
0.0011843245010823011,
0.0015724743716418743,
-0.0011801186483353376,
-0.015851475298404694,
-0.003387684468179941,
-0.003376239910721779,
0.0043999142944812775,
-0.0009402127470821142,
-0.002457914175465703,
0.0028704393189400434,
-0.009291415102779865,
0.004681339021772146,
0.0022747532930225134,
0.0017773547442629933,
-0.00814325176179409,
0.0013893237337470055,
-0.006252551916986704,
-0.008116256445646286,
0.0029414291493594646,
-0.005176316015422344,
-0.0027891790959984064,
0.0011275717988610268,
0.0037329040933400393,
0.009046322666108608,
-0.0035643468145281076,
0.0018216073513031006,
0.01358882151544094,
-0.004764310084283352,
-0.01136792916804552,
0.006283679977059364,
0.006677847821265459,
0.0005143192247487605,
-0.002645505126565695,
0.002612121170386672,
0.008617935702204704,
0.007848609238862991,
0.00011247783550061285,
0.004007406998425722,
-0.00006478847353719175,
0.01297521498054266,
0.00047000666381791234,
0.002300421241670847,
-0.0022033725399523973,
-0.002612509299069643,
-0.0036678004544228315,
-0.0009940131567418575,
-0.007018233183771372,
-0.000153886474436149,
-0.012707802467048168,
-0.010749531909823418,
-0.0012886791955679655,
0.001886943937279284,
0.0005096820532344282,
-0.0022324093151837587,
0.0019138019997626543,
0.0032714575063437223,
0.010897671803832054,
0.0007594816852360964,
-0.006411658599972725,
0.0010169035522267222,
0.001517663593403995,
-0.008316691033542156,
0.01589544489979744,
-0.012416821904480457,
0.005756406579166651,
-0.003601235803216696,
-0.013656217604875565,
0.0062263295985758305,
0.005546541418880224,
-0.0070684500969946384,
0.0021097774151712656,
0.0010225726291537285,
0.0031662469264119864,
0.0005550719215534627,
-0.004604279529303312,
-0.008789194747805595,
-0.014497866854071617,
0.0020210265647619963,
0.020945634692907333,
0.005328596103936434,
0.009651255793869495,
0.012153693474829197,
-0.004143483936786652,
0.0028827504720538855,
0.009853545576334,
0.0014854173641651869,
0.01549894455820322,
-0.009212708100676537,
-0.0009031552472151816,
0.0013943607918918133,
-0.00827127043157816,
0.0020162116270512342,
0.005755099002271891,
0.005291270557790995,
-0.005572989117354155,
0.0008678602171130478,
-0.007256091106683016,
-0.006095587275922298,
-0.017972446978092194,
-0.004165764432400465,
0.0068261767737567425,
-0.005825574975460768,
0.00401304941624403,
-0.01274403091520071,
0.004465149715542793,
0.0050775776617228985,
0.0018102098256349564,
-0.0010310630314052105,
-0.00005360627255868167,
0.006963924504816532,
0.01042430754750967,
-0.004614211153239012,
0.0024376290384680033,
0.002932661911472678,
-0.0007671069470234215,
0.0038789326790720224,
0.005318374838680029,
-0.008862112648785114,
-0.004003525245934725,
0.0024994434788823128,
0.00459041865542531,
0.00022467564849648625,
-0.004967349581420422,
-0.008577283471822739,
-0.003635465633124113,
0.0033318481873720884,
-0.009187748655676842,
0.003960470203310251,
0.0010560681112110615,
0.0028146877884864807,
-0.008711745962500572,
0.0004140665696468204,
-0.005281384568661451,
-0.008923104964196682,
0.007622484117746353,
-0.0020177990663796663,
0.0026143474970012903,
0.012857459485530853,
0.0008004908449947834,
-0.01370289083570242,
0.005413703620433807,
0.00895856972783804,
-0.004762677010148764,
0.001110053970478475,
0.004640565719455481,
-0.003504528198391199,
-0.019013186916708946,
0.001961721573024988,
-0.015084721148014069,
0.008134741336107254,
-0.0030092597007751465,
0.0017454121261835098,
-0.006065585650503635,
0.010281448252499104,
0.002316964790225029,
-0.010934500023722649,
-0.0037543342914432287,
-0.00836118683218956,
0.007309116888791323,
-0.0017391913570463657,
-0.0022078638430684805,
-0.0030857620295137167,
0.000014086111150390934,
-0.0036725325044244528,
-0.0007041543140076101,
-0.0010422882623970509,
0.0037461770698428154,
0.0009244618704542518,
-0.004233791027218103,
0.0018078198190778494,
-0.0014348926488310099,
0.0006998918252065778,
0.003486747620627284,
-0.010356012731790543,
0.00013082932855468243,
0.010351521894335747,
-0.0019687912426888943,
-0.00041354153654538095,
0.0006537256413139403,
-0.0017269083764404058,
-0.003134754253551364,
-0.010290835052728653,
-0.005005642306059599,
-0.0027235355228185654,
-0.0035392334684729576,
-0.011530880816280842,
-0.0008512207423336804,
-0.008079287596046925,
0.0073112561367452145,
-0.008425923995673656,
0.009670139290392399,
0.003968121018260717,
-0.005324041936546564,
0.0055596474558115005,
-0.005407057702541351,
0.005381667520850897,
0.0031210959423333406,
0.008535065688192844,
0.002312334254384041,
-0.007855894975364208,
-0.012434191070497036,
0.011115293949842453,
-0.009214666672050953,
0.0002661845355760306,
0.015288291499018669,
0.004334295634180307,
0.011215546168386936,
0.0020818421617150307,
0.00007599100354127586,
0.005854071117937565,
0.00818606186658144,
-0.013999753631651402,
0.004376241005957127,
-0.0026144213043153286,
-0.0012690323637798429,
0.006690335460007191,
-0.004480540286749601,
0.003877655602991581,
0.007858251221477985,
0.0006134336581453681,
-0.008720439858734608,
-0.003489500842988491,
-0.0030883057042956352,
0.0003856903640553355,
-0.009879598394036293,
0.00022908115352038294,
-0.0030363553669303656,
-0.003652780782431364,
-0.005666655953973532,
-0.002148863859474659,
-0.0017093393253162503,
0.005853904876857996,
-0.0031605446711182594,
0.007889436557888985,
0.0011902919504791498,
-0.005304780788719654,
0.013874884694814682,
-0.006947953253984451,
-0.007268749643117189,
0.0034851296804845333,
0.0015234247548505664,
0.00020773167489096522,
-0.007638602051883936,
-0.0006609273259527981,
0.000726914731785655,
0.0025436736177653074,
-0.0020619649440050125,
-0.007979623973369598,
-0.0023083528503775597,
0.002485924633219838,
-0.008354890160262585,
0.0002914937795139849,
0.009828678332269192,
-0.00033371394965797663,
0.0020216747652739286,
0.0006015848484821618,
-0.004209261853247881,
-0.0127182025462389,
0.055588994175195694,
0.0011234455741941929,
-0.00016992980090435594,
0.007815646938979626,
-0.007499165832996368,
0.0015671954024583101,
-0.0002886857255361974,
0.0038732716348022223,
-0.00930557306855917,
-0.008133871480822563,
0.011018296703696251,
-0.002441499615088105,
0.002454163506627083,
-0.004989811219274998,
-0.004352480173110962,
0.011802456341683865,
-0.00626512011513114,
-0.016916418448090553,
-0.013579231686890125,
0.0066083515994250774,
-0.002193902852013707,
-0.007053246721625328,
0.006303888279944658,
-0.0040266201831400394,
-0.0046662939712405205,
-0.0009351035114377737,
0.004982384853065014,
-0.00015896034892648458,
0.00016244214202743024,
-0.004325213376432657,
-0.0028686816804111004,
0.00003213121453882195,
0.00391340022906661,
0.0074953846633434296,
0.00905922707170248,
-0.0017885001143440604,
0.004950841888785362,
-0.002595956437289715,
0.00037501633050851524,
0.0011760401539504528,
0.00662568025290966,
0.007381819188594818,
-0.0024594999849796295,
0.000024317796487594023,
0.0047016688622534275,
0.003538107965141535,
0.0033071250654757023,
0.011740931309759617,
-0.0012323849368840456,
-0.003698139451444149,
0.007249330636113882,
0.009486422874033451,
-0.003912510350346565,
0.0047996798530220985,
-0.0008820478687994182,
0.0076679266057908535,
0.0008545169257558882,
-0.009552683681249619,
-0.010430647991597652,
-0.001666538999415934,
0.004492407664656639,
0.007739092689007521,
-0.0010125020053237677,
0.000495383981615305,
-0.0002050788316410035,
-0.0045695193111896515,
-0.010645098984241486,
-0.005837143398821354,
-0.00286496477201581,
-0.0014228138606995344,
0.00007352309330599383,
0.07416177541017532,
-0.004242577590048313,
-0.0012377306120470166,
-0.008483998477458954,
0.0013505322858691216,
0.0014517690287902951,
-0.0011312438873574138,
-0.001744974753819406,
0.0006871241494081914,
0.0012530558742582798,
0.003927440382540226,
-0.006562823895365,
-0.007988694123923779,
0.001571754226461053,
0.0023558540269732475,
-0.0013253369834274054,
0.0031093123834580183,
0.009093286469578743,
-0.008652339689433575,
0.0037461507599800825,
-0.012446342967450619,
-0.0007239214610308409,
-0.0035496780183166265,
-0.005246129352599382,
-0.0027462367434054613,
-0.0027015425730496645,
0.0008850079611875117,
0.0044747344218194485,
0.0045129768550395966,
-0.004248384386301041,
0.0065665338188409805,
0.00021056178957223892,
0.001903239986859262,
-0.00395130505785346,
0.000029284905394888483,
-0.0077724033035337925,
0.004802694544196129,
0.0013867501402273774,
-0.011175239458680153,
-0.005067752208560705,
-0.0036678845062851906,
-0.000015210286619549152,
-0.007642562501132488,
0.007638090290129185,
-0.001419516047462821,
0.006353895179927349,
-0.0033401937689632177,
0.001327532110735774,
-0.005472057498991489,
0.0019538055639714003,
-0.014489871449768543,
0.0057245343923568726,
-0.18118609488010406,
0.011529502458870411,
0.0018171380506828427,
-0.005058900453150272,
-0.0012019219575449824,
-0.016675762832164764,
-0.008955869823694229,
0.0009723827824927866,
0.010657386854290962,
-0.002964752959087491,
0.0007479271152988076,
-0.00021070661023259163,
0.0021987881045788527,
0.003800153499469161,
-0.002443948294967413,
-0.005688817705959082,
0.0025568129494786263,
-0.006495149806141853,
0.0000123201762107783,
0.004921443294733763,
0.007612049113959074,
0.007506876718252897,
0.004364170599728823,
0.0021843663416802883,
-0.0005212900578044355,
-0.00445226626470685,
0.004192128777503967,
-0.0009081420721486211,
0.007231767289340496,
-0.011103745549917221,
-0.005515732802450657,
-0.0035868175327777863,
-0.0025320351123809814,
-0.0013331789523363113,
0.00437377393245697,
-0.004171925596892834,
0.008691404014825821,
0.0034770548809319735,
-0.007935852743685246,
0.006990324705839157,
-0.003794629592448473,
0.03218196704983711,
0.0024705613031983376,
0.00953017920255661,
0.00046557385940104723,
-0.001500248326919973,
-0.002829704899340868,
0.010829509235918522,
0.00040474426350556314,
0.012798752635717392,
-0.00896011758595705,
-0.007444119546562433,
0.0014564043376594782,
0.017409764230251312,
-0.0031664585694670677,
-0.008121763356029987,
-0.0079177375882864,
-0.008271870203316212,
0.005400663707405329,
0.011870699934661388,
0.009790139272809029,
-0.008151805028319359,
0.010013897903263569,
-0.004133451264351606,
-0.01920332759618759,
0.004285432398319244,
-0.0002517080574762076,
-0.008123831823468208,
0.00024728747666813433,
0.007526208180934191,
0.011935783550143242,
-0.001021023141220212,
0.009706144221127033,
-0.0030473051592707634,
0.003246844979003072,
-0.0007794162374921143,
0.0074897692538797855,
-0.0033537112176418304,
0.004784715827554464,
-0.0069049266166985035,
0.009014573879539967,
-0.007986507378518581,
-0.004325775429606438,
0.003027105238288641,
-0.005166846327483654,
0.00972473993897438,
0.006522827316075563,
-0.0017811779398471117,
-0.00041861238423734903,
-0.013131055049598217,
0.0004624731664080173,
0.00221483432687819,
0.0039145308546721935,
-0.006147272419184446,
0.00362890656106174,
-0.0031930021941661835,
0.005225467029958963,
0.009192454628646374,
-0.006378227844834328,
0.006252532824873924,
0.0049480414018034935,
-0.006613433826714754,
-0.00035775452852249146,
-0.005568512715399265,
0.00036809913581237197,
0.00534383300691843,
-0.008313235826790333,
-0.009964726865291595,
0.005308801308274269,
-0.005309414584189653,
-0.005698539782315493,
0.005828080233186483,
-0.010236644186079502,
-0.0037409630604088306,
0.0041805775836110115,
-0.013080847449600697,
0.0003120192850474268
] |
8a748a255fe78209cc5338aaab9ff134d24befab | 1,134 | py | Python | baopig/ressources/ressources.py | ChreSyr/baopig | 6264ab9a851b1ed0a031292abe7f159a53b3fc5e | [
"MIT"
] | null | null | null | baopig/ressources/ressources.py | ChreSyr/baopig | 6264ab9a851b1ed0a031292abe7f159a53b3fc5e | [
"MIT"
] | null | null | null | baopig/ressources/ressources.py | ChreSyr/baopig | 6264ab9a851b1ed0a031292abe7f159a53b3fc5e | [
"MIT"
] | null | null | null |
from baopig.pybao.objectutilities import Object
from baopig.pybao.issomething import *
class RessourcePack:
def config(self, **kwargs):
for name, value in kwargs.items():
self.__setattr__('_'+name, value)
class FontsRessourcePack(RessourcePack):
def __init__(self,
file=None,
height=15,
color=(0, 0, 0),
):
assert is_color(color)
self._file = file
self._height = height
self._color = color
file = property(lambda self: self._file)
color = property(lambda self: self._color)
height = property(lambda self: self._height)
class ScenesRessourcePack(RessourcePack):
def __init__(self,
background_color=(170, 170, 170),
):
assert is_color(background_color)
self._background_color = background_color
background_color = property(lambda self: self._background_color)
# TODO : ButtonRessourcePack.style.create_surface(size)
class _RessourcePack:
def __init__(self):
self.font = FontsRessourcePack()
self.scene = ScenesRessourcePack()
ressources = _RessourcePack()
| 19.894737 | 68 | 0.666667 | 1 | 1.0311 | [
0.0009627516265027225,
0.02373197115957737,
0.009244738146662712,
-0.0008924828725866973,
0.004751634784042835,
-0.003306478261947632,
-0.009645760990679264,
0.0031123857479542494,
-0.005463826935738325,
0.0016165591077879071,
0.0030391572508960962,
0.005389499012380838,
0.00763066066429019,
-0.016003424301743507,
0.0013644503196701407,
0.017515961080789566,
-0.05573591589927673,
0.003437497653067112,
-0.004856784828007221,
0.0033728706184774637,
-0.006841578520834446,
0.01009114645421505,
0.007981497794389725,
0.007527248002588749,
0.00592078547924757,
0.0006030049407854676,
0.006740333046764135,
0.005110594909638166,
-0.008978810161352158,
-0.007098150439560413,
-0.0017753130523487926,
-0.00319064874202013,
-0.003960760775953531,
-0.009633391164243221,
0.00675539206713438,
-0.004580541513860226,
-0.0008489122265018523,
-0.02004348114132881,
0.010305398143827915,
-0.0017754504224285483,
-0.005125958472490311,
-0.015139820985496044,
-0.0013527810806408525,
0.004147699568420649,
-0.011255336925387383,
0.0019118129275739193,
-0.0045764269307255745,
0.004291918594390154,
-0.011218919418752193,
0.005726049188524485,
-0.00971448328346014,
0.00469678919762373,
0.01669318787753582,
0.0032635533716529608,
-0.0068863327614963055,
-0.00586324417963624,
0.011482280679047108,
-0.0022223498672246933,
-0.009793050587177277,
-0.00015207153046503663,
-0.0028137569315731525,
-0.003746267408132553,
0.002150566317141056,
0.002562564332038164,
-0.01773548126220703,
-0.0053163738921284676,
-0.005681016482412815,
0.004657164681702852,
-0.0010872335406020284,
0.006586064584553242,
0.002156887436285615,
-0.0009448244236409664,
0.008746976032853127,
0.0005974067025817931,
0.0034169808495789766,
-0.003197158221155405,
-0.00008693834388395771,
0.0012474952964112163,
0.005914569832384586,
0.00436750752851367,
0.006249123718589544,
-0.005798968952149153,
0.0057776630856096745,
0.010611514560878277,
0.011056074872612953,
0.010728908702731133,
0.016544047743082047,
-0.00986006110906601,
0.04397017881274223,
0.007581769023090601,
-0.009646735154092312,
0.0022880532778799534,
-0.006562977563589811,
-0.0029985615983605385,
-0.0018930290825664997,
-0.028241446241736412,
-0.0017211660742759705,
-0.003369012149050832,
0.0020413235761225224,
0.004254541359841824,
-0.00019031435658689588,
0.006488161627203226,
-0.004292648751288652,
-0.0025679562240839005,
-0.008532975800335407,
0.008133882656693459,
-0.00797454733401537,
-0.003258773358538747,
0.011243363842368126,
0.0005651137907989323,
-0.011812741868197918,
-0.0033617480657994747,
0.0015836252132430673,
-0.012506963685154915,
0.005468641873449087,
0.0006277862703427672,
-0.008221134543418884,
0.0562136210501194,
0.0003516351571306586,
0.0012971768155694008,
-0.004003087058663368,
-0.00043614357127808034,
0.0007690786151215434,
0.0049031637609004974,
0.008755818009376526,
-0.005281145218759775,
0.011833949945867062,
0.008996495977044106,
0.0035929842852056026,
0.007486260496079922,
-0.000466152501758188,
0.008525002747774124,
-0.002849277574568987,
-0.0023385887034237385,
0.0005354779423214495,
-0.00825763214379549,
0.005717920139431953,
-0.0025989951100200415,
-0.007638631854206324,
0.005479021929204464,
-0.0002694821741897613,
-0.012501892633736134,
0.0006834875093773007,
-0.0021281992085278034,
0.0032302290201187134,
-0.009693325497210026,
-0.0039517697878181934,
-0.004577092360705137,
-0.002994815818965435,
0.002585780108347535,
0.009217756800353527,
0.002385150408372283,
0.004757800605148077,
-0.005826112348586321,
-0.006853195372968912,
-0.0018780691316351295,
-0.004275389481335878,
0.0012033296516165137,
0.010037411004304886,
0.004591727629303932,
-0.009010354988276958,
-0.004179832525551319,
0.003154132515192032,
0.004748325329273939,
-0.003721910994499922,
-0.00000578302524445462,
-0.007166796829551458,
0.007023162674158812,
0.0014478852972388268,
0.004710099659860134,
0.01261462364345789,
-0.005628584884107113,
0.0017352139111608267,
-0.0002530005876906216,
0.003451735246926546,
-0.002431440632790327,
0.0051363008096814156,
0.010044358670711517,
-0.004017777740955353,
-0.0033844346180558205,
0.005265960935503244,
0.0029741767793893814,
0.006786544341593981,
0.007030967157334089,
-0.0020957388915121555,
0.0015021564904600382,
-0.0015811061020940542,
-0.0012961147585883737,
0.0054258559830486774,
-0.001620967872440815,
0.006431602872908115,
0.003936768509447575,
-0.012741651386022568,
-0.008955494500696659,
0.00046075688442215323,
-0.010255910456180573,
0.0013757179258391261,
0.014137974008917809,
0.012815034948289394,
-0.0028280585538595915,
0.005489261820912361,
-0.009951988235116005,
-0.0011341259814798832,
0.006027087103575468,
0.0014082689303904772,
-0.012415815144777298,
-0.9580867886543274,
0.004599541425704956,
0.002796075539663434,
-0.0014091618359088898,
0.005451895296573639,
0.005020963493734598,
0.004721196833997965,
0.00317525677382946,
0.015770375728607178,
-0.00819188542664051,
-0.006862980779260397,
-0.009530655108392239,
-0.013130107894539833,
-0.0003782555286306888,
-0.005738766398280859,
-0.003167348448187113,
-0.007773721590638161,
-0.00825691968202591,
-0.0030350959859788418,
-0.003947220742702484,
-0.00364021142013371,
0.011291112750768661,
-0.00012016852997476235,
0.0026546150911599398,
0.0027298072818666697,
0.00382022000849247,
-0.004457070492208004,
0.0005677029839716852,
-0.002969135297462344,
-0.002762947464361787,
-0.0049001662991940975,
-0.014297879301011562,
-0.0069140116684138775,
-0.00013642979320138693,
0.010244925506412983,
0.0011523099383339286,
0.008077717386186123,
-0.001448549097403884,
0.0015698956558480859,
-0.007920946925878525,
0.0049480171874165535,
0.0027883839793503284,
0.0021783076226711273,
-0.02920200489461422,
-0.0003771695483010262,
-0.0007478295592591166,
-0.007339240051805973,
0.009709022007882595,
-0.0004088296846020967,
-0.0008675438584759831,
-0.0019328354392200708,
-0.004712776746600866,
0.007518311962485313,
-0.006874580401927233,
0.0035398288164287806,
-0.006067619659006596,
-0.006284637842327356,
-0.00303262029774487,
-0.011491207405924797,
0.0007480130880139768,
0.001449276925995946,
-0.0045974780805408955,
-0.0020963598508387804,
-0.0012444054009392858,
0.003414860926568508,
0.001813019858673215,
-0.0010247534373775125,
-0.018147576600313187,
-0.007598910480737686,
0.002595025347545743,
0.003162534674629569,
-0.0009033111273311079,
-0.005628521088510752,
0.0030684350058436394,
-0.011180145666003227,
0.006870996672660112,
0.0022786767221987247,
0.0012901413720101118,
-0.011772982776165009,
-0.0013538433704525232,
-0.008846178650856018,
-0.0073494031094014645,
0.0020568054169416428,
-0.005810958798974752,
-0.003620914649218321,
0.0022485877852886915,
0.00006695684714941308,
0.007439726963639259,
-0.0032071727328002453,
0.005537525750696659,
0.013962257653474808,
-0.001875659334473312,
-0.009134705178439617,
0.007052356842905283,
0.008486165665090084,
0.0014218790456652641,
-0.0026642167940735817,
0.003836064599454403,
0.008516527712345123,
0.00812398549169302,
0.0030313453171402216,
0.0034761668648570776,
0.0001256723189726472,
0.013341613113880157,
0.0013205037685111165,
0.0002442929253447801,
-0.004129177425056696,
-0.0011211894452571869,
-0.004314583260565996,
-0.004871256649494171,
-0.004374368581920862,
-0.0021598762832581997,
-0.011143472045660019,
-0.01056078914552927,
-0.003474579891189933,
0.0009914227994158864,
0.0006862308946438134,
-0.0032814766746014357,
0.000480768911074847,
0.0021089317742735147,
0.009021892212331295,
0.0020714853890240192,
-0.003326971782371402,
0.0017562357243150473,
0.002027407055720687,
-0.006771010812371969,
0.013299824669957161,
-0.01425112970173359,
0.006806978955864906,
-0.0003844782477244735,
-0.015722796320915222,
0.007962333969771862,
0.01006471086293459,
-0.007894103415310383,
0.0005718357861042023,
0.0023651630617678165,
0.0017224560724571347,
0.00215590326115489,
-0.0059910062700510025,
-0.004334290977567434,
-0.014514307491481304,
-0.0009061645832844079,
0.017854271456599236,
0.0031734565272927284,
0.00888652540743351,
0.010298791341483593,
-0.005817430093884468,
0.0023111761547625065,
0.00617604935541749,
0.0026748301461338997,
0.014252888038754463,
-0.006881196051836014,
0.0007301383884623647,
-0.0012268915306776762,
-0.007119264453649521,
-0.00014920115063432604,
0.004867060575634241,
0.005814601667225361,
-0.0032639510463923216,
0.0020436181221157312,
-0.007264984305948019,
-0.006072015501558781,
-0.019556555896997452,
-0.002985502127557993,
0.006777334492653608,
-0.004545908421278,
0.007238366641104221,
-0.011501283384859562,
0.004301067907363176,
0.005451028700917959,
0.003978862427175045,
0.0011057188967242837,
0.000020352968931547366,
0.007705578580498695,
0.012241396121680737,
-0.005465781781822443,
0.002977280179038644,
0.002095364034175873,
-0.0023243739269673824,
0.002046906854957342,
0.010832319036126137,
-0.008547891862690449,
-0.005617310758680105,
0.0012510366505011916,
0.004211515188217163,
0.0024777930229902267,
-0.002497145440429449,
-0.010134993121027946,
-0.005021015647798777,
0.003386505413800478,
-0.006041098386049271,
0.0027223248034715652,
0.00014947431918699294,
0.003688635304570198,
-0.006322045344859362,
-0.00013639037206303328,
-0.004857389722019434,
-0.011456373147666454,
0.01033512782305479,
-0.0017660544253885746,
0.0018858740804716945,
0.013473549857735634,
0.0030172853730618954,
-0.013540506362915039,
0.006060043815523386,
0.010365154594182968,
-0.004723228979855776,
0.004868385847657919,
0.006429760251194239,
-0.008038878440856934,
-0.02142796292901039,
-0.0017761646304279566,
-0.01680801436305046,
0.006156730931252241,
-0.0010918260086327791,
0.00443163700401783,
-0.007276930380612612,
0.008506341837346554,
0.005400895141065121,
-0.01229871716350317,
-0.005349780432879925,
-0.008169181644916534,
0.006943827029317617,
-0.0009662361699156463,
-0.0014279283350333571,
-0.003765588393434882,
-0.0006717061041854322,
-0.003180661704391241,
-0.0034687009174376726,
-0.002088750246912241,
0.002709332387894392,
0.0009470174554735422,
-0.0026344244834035635,
0.0007535948534496129,
-0.0019365623593330383,
0.0018049164209514856,
0.0022723488509655,
-0.011662062257528305,
-0.00041925592813640833,
0.007510386873036623,
-0.0005763599765487015,
-0.002113563474267721,
0.00038369710091501474,
-0.002346160588786006,
-0.005478609818965197,
-0.0100855166092515,
-0.003898845985531807,
-0.0035386146046221256,
-0.0025460757315158844,
-0.012256192974746227,
0.00013754954852629453,
-0.00918650347739458,
0.008169456385076046,
-0.007676814682781696,
0.006804102100431919,
0.006144339684396982,
-0.006018303334712982,
0.006090871058404446,
-0.002959941513836384,
0.0022461009211838245,
0.0034709619358181953,
0.004761423449963331,
0.0008725578081794083,
-0.006093816366046667,
-0.013867199420928955,
0.013611102476716042,
-0.007332810200750828,
0.00044645974412560463,
0.014035052619874477,
0.004230392165482044,
0.007913351058959961,
0.0008870572200976312,
0.0005820072838105261,
0.003978064749389887,
0.008790343068540096,
-0.014616014435887337,
0.004588810261338949,
-0.003063337644562125,
-0.0025929820258170366,
0.00579057727009058,
-0.003022865392267704,
0.004189817234873772,
0.0106985904276371,
0.0013069132110103965,
-0.005867051891982555,
-0.0030018198303878307,
-0.000173158070538193,
0.0019256576197221875,
-0.011537822894752026,
-0.0006154084112495184,
-0.0027981302700936794,
-0.0030822111293673515,
-0.0019826479256153107,
-0.0031355207320302725,
0.0003105321084149182,
0.00508895656093955,
-0.0024498021230101585,
0.005270746536552906,
0.000898137572221458,
-0.003935656975954771,
0.014603613875806332,
-0.007223119959235191,
-0.004649115260690451,
0.0033970437943935394,
0.0003972940321546048,
-0.000438762828707695,
-0.006065359339118004,
-0.0015814992366358638,
0.0013796493876725435,
0.004784007556736469,
-0.002491850173100829,
-0.006097936537116766,
-0.005768267437815666,
0.0010117471683770418,
-0.00818970799446106,
0.004626008216291666,
0.012122536078095436,
-0.003106535878032446,
0.0027380192186683416,
-0.0013240983244031668,
-0.0069324248470366,
-0.014396418817341328,
0.055270105600357056,
-0.0023374673910439014,
0.004521033260971308,
0.004382812883704901,
-0.007222382351756096,
0.0009534547571092844,
-0.002640597987920046,
0.006396586541086435,
-0.007620695047080517,
-0.010485576465725899,
0.009132865816354752,
-0.002940201200544834,
0.00487623130902648,
0.002533751307055354,
-0.0027360175736248493,
0.013859708793461323,
-0.004564514849334955,
-0.014700067229568958,
-0.015592534095048904,
0.005440239794552326,
-0.005594110116362572,
-0.00923080462962389,
0.008027367293834686,
-0.003642973955720663,
-0.004603166598826647,
0.0024122886825352907,
0.006282005459070206,
0.001512871589511633,
-0.0006989856483414769,
-0.0036191975232213736,
-0.00030068529304116964,
0.000494237698148936,
0.004506468307226896,
0.005836873315274715,
0.006686731241643429,
-0.00492892088368535,
0.0048102568835020065,
-0.0015735216438770294,
-0.0009808536851778626,
0.0008314043516293168,
0.0039126090705394745,
0.006268501281738281,
-0.002581515582278371,
-0.0028500454500317574,
0.003973020706325769,
0.0029673748649656773,
0.0031195248011499643,
0.01232647243887186,
-0.00067363609559834,
-0.0048917680978775024,
0.006716863252222538,
0.008060390129685402,
-0.0014559599803760648,
0.00893364567309618,
-0.002645965199917555,
0.0054296995513141155,
0.002013936173170805,
-0.008510292507708073,
-0.013031816110014915,
-0.00012507550127338618,
0.007193637080490589,
0.006955379154533148,
-0.0018108139047399163,
0.0018320006784051657,
0.000908900226932019,
-0.003844120539724827,
-0.007283641956746578,
-0.007356175221502781,
-0.0026413528248667717,
-0.0006629191339015961,
0.00429854029789567,
0.07192122936248779,
-0.007834259420633316,
-0.0012123218039050698,
-0.010258475318551064,
-0.00033126695780083537,
-0.0008644929621368647,
-0.0009788029128685594,
-0.0005288570537231863,
-0.0006104148924350739,
0.0026007930282503366,
0.0023695682175457478,
-0.008224627934396267,
-0.010217634029686451,
-0.0016735041281208396,
0.0035011994186788797,
-0.002941250102594495,
0.002612924436107278,
0.007497664541006088,
-0.008604032918810844,
0.0038371176924556494,
-0.01220113504678011,
-0.002658436307683587,
-0.0009254614124074578,
-0.008188639767467976,
-0.0032047596760094166,
-0.0019278007093816996,
0.004404337145388126,
0.0015231141587719321,
0.006764378864318132,
-0.005528734065592289,
0.008504950441420078,
-0.002179966773837805,
0.0013531164731830359,
-0.0033929883502423763,
0.000773420266341418,
-0.004993773531168699,
0.006527491845190525,
0.0013846250949427485,
-0.010913632810115814,
-0.003430803306400776,
-0.0011079099494963884,
-0.0005173980607651174,
-0.0043008034117519855,
0.006460157223045826,
0.0009807127062231302,
0.00596364913508296,
-0.004797341302037239,
0.0007673565414734185,
-0.00691856537014246,
0.0013804002664983273,
-0.011475668288767338,
0.004232000093907118,
-0.1735680103302002,
0.011123551055788994,
0.003777128178626299,
-0.006350554525852203,
-0.003791860770434141,
-0.0162225179374218,
-0.006876812316477299,
0.0017252144170925021,
0.009311346337199211,
0.002439569216221571,
0.0015216177562251687,
-0.0018227434484288096,
0.0023157380055636168,
0.004661668557673693,
-0.0009174740989692509,
-0.0043548764660954475,
0.003967443946748972,
-0.007801729720085859,
0.0015636780299246311,
0.005719869863241911,
0.006745175924152136,
0.008336985483765602,
0.00023957158555276692,
0.002953830873593688,
-0.0006032902747392654,
-0.005388318095356226,
0.005172669887542725,
-0.0015718321083113551,
0.004706462845206261,
-0.010603580623865128,
-0.003909648861736059,
-0.002298640552908182,
-0.002657524775713682,
0.0006504969205707312,
0.004761689342558384,
-0.0009347276063635945,
0.009032397530972958,
0.0031204617116600275,
-0.0064357854425907135,
0.004730350337922573,
-0.006091477815061808,
0.029038269072771072,
0.0060081942938268185,
0.007306172978132963,
-0.0016285047167912126,
-0.004162810742855072,
-0.004662063904106617,
0.010468448512256145,
0.001513572409749031,
0.01228906586766243,
-0.008882250636816025,
-0.00169156224001199,
0.002206895500421524,
0.015941625460982323,
-0.005469236057251692,
-0.008856244385242462,
-0.006986184045672417,
-0.0064423782750964165,
0.0030822334811091423,
0.010329396463930607,
0.011927731335163116,
-0.0061819651164114475,
0.010403508320450783,
-0.004444821737706661,
-0.02009817212820053,
0.00348032102920115,
-0.0022959751076996326,
-0.009473196230828762,
0.0009046685299836099,
0.006228018086403608,
0.008344912901520729,
-0.002488726284354925,
0.003459885949268937,
-0.00019143936515320092,
0.004953496623784304,
-0.0004468194383662194,
0.007104542572051287,
-0.0032595691736787558,
0.0062124342657625675,
-0.008255920372903347,
0.008729798719286919,
-0.009784204885363579,
-0.004201120231300592,
0.0028306946624070406,
-0.0054496233351528645,
0.01057630218565464,
0.006968282163143158,
-0.004284927621483803,
0.00012518874427769333,
-0.012139194644987583,
-0.0009771294426172972,
0.0026007434353232384,
0.0029287920333445072,
-0.009019927121698856,
0.003994378261268139,
-0.0018034778768196702,
0.00624489039182663,
0.008181094191968441,
-0.008876125328242779,
0.006137799937278032,
0.005223424639552832,
-0.005464612506330013,
0.0002546923060435802,
-0.00619124248623848,
0.0020772875286638737,
0.005094004329293966,
-0.00936811976134777,
-0.008189892396330833,
0.0034533259458839893,
-0.006611617747694254,
-0.006769826635718346,
0.005151189863681793,
-0.010115928016602993,
-0.00793612003326416,
-0.0006493392866104841,
-0.011299681849777699,
0.0005619017756544054
] |
8a75b4a74e6ecd635d9404db9ea5df06d5114069 | 10,282 | py | Python | bufr_extract_unique_stations.py | glamod/glamod-misc | 4c8743dd3aa436377017c49bec990b11fe1c6f7d | [
"BSD-3-Clause"
] | null | null | null | bufr_extract_unique_stations.py | glamod/glamod-misc | 4c8743dd3aa436377017c49bec990b11fe1c6f7d | [
"BSD-3-Clause"
] | 16 | 2018-10-23T08:06:18.000Z | 2018-10-30T10:20:01.000Z | bufr_extract_unique_stations.py | glamod/glamod-misc | 4c8743dd3aa436377017c49bec990b11fe1c6f7d | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/python2.7
"""
Extract unique set of station locations (and names) along with number of obs
RJHD - Exeter - October 2017
"""
# ECMWF import defaults
import traceback
import sys
from eccodes import *
# RJHD imports
import cartopy
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import gc
VERBOSE = 1 # verbose error reporting.
ATTRS = [
'code',
'units',
'scale',
'reference',
'width'
]
INTMDI = 2147483647
#***************************************************
def process_file(infilename, station_names, fixed_station, latitudes, longitudes, observations, start_year, end_year):
infile = open(infilename)
year = int(infilename.split(".")[0].split("_")[-1])
cmatch = 0
counter = 0
# loop all messages (with stop statement)
while 1:
"""OPEN MESSAGE"""
# get handle for message
bufr = codes_bufr_new_from_file(infile)
if bufr is None:
break
if counter%100000 == 0:
print "message: {:d}".format(counter)
# we need to instruct ecCodes to expand all the descriptors
# i.e. unpack the data values
codes_set(bufr, 'unpack', 1)
"""ITERATOR TO EXTRACT KEYS"""
these_keys = []
# get BUFR key iterator
iterid = codes_bufr_keys_iterator_new(bufr)
# loop over the keys
while codes_bufr_keys_iterator_next(iterid):
# print key name
keyname = codes_bufr_keys_iterator_get_name(iterid)
# print(" %s" % keyname)
these_keys += [keyname]
# delete the key iterator
codes_bufr_keys_iterator_delete(iterid)
# Use these to select obs from land/marine surface
name_keys = ["#1#shipOrMobileLandStationIdentifier", "#1#stationNumber"]
processed = False
for nk in name_keys:
if nk in these_keys:
try:
name = codes_get(bufr, nk)
lat = codes_get(bufr, "#1#latitude")
lon = codes_get(bufr, "#1#longitude")
sloc = tloc = nloc = [-1]
if name in station_names:
sloc, = np.where(station_names == name)
if lat in latitudes:
tloc, = np.where(latitudes == lat)
if lon in longitudes:
nloc, = np.where(longitudes == lon)
if tloc[0] == -1 and nloc[0] == -1:
# if not in list, then add
station_names = np.append(station_names, name)
latitudes = np.append(latitudes, lat)
longitudes = np.append(longitudes, lon)
observations = np.append(observations, 1)
start_year = np.append(start_year, year)
end_year = np.append(end_year, year)
# allow splitting of land and marine/mobile
if nk == "#1#stationNumber":
fixed_station = np.append(fixed_station, True)
else:
fixed_station = np.append(fixed_station, False)
elif (tloc[0] != -1 or nloc[0] != -1) and tloc[0] != nloc[0]:
# add if one element of position is unique
station_names = np.append(station_names, name)
latitudes = np.append(latitudes, lat)
longitudes = np.append(longitudes, lon)
observations = np.append(observations, 1)
start_year = np.append(start_year, year)
end_year = np.append(end_year, year)
# allow splitting of land and marine/mobile
if nk == "#1#stationNumber":
fixed_station = np.append(fixed_station, True)
else:
fixed_station = np.append(fixed_station, False)
elif tloc[0] != -1 and tloc[0] == nloc[0]:
# if position matches exactly, up observation counter
observations[tloc[0]] += 1
end_year[tloc[0]] = year
# allow splitting of land and marine/mobile
if nk == "#1#stationNumber":
if fixed_station[tloc[0]] != True:
# if listed as land and now marine, take marine
fixed_station[tloc[0]] = False
else:
if fixed_station[tloc[0]] != False:
# easier to leave as mobile/marine than to move
# hopefully will stand out later
pass
else:
cmatch += 1
processed = True
except CodesInternalError:
raw_input("key error?")
# check for new keys which give station ID information
if not processed:
other_keys = ["#1#carrierBalloonOrAircraftIdentifier", "#1#aircraftFlightNumber"]
new_key = True
for ok in other_keys:
if ok in these_keys: new_key = False
if new_key:
raw_input(these_keys)
# if counter > 10000: break
counter += 1
codes_release(bufr)
# print "Number of unique locations in this year: {}".format(len(latitudes))
return station_names, fixed_station, latitudes, longitudes, observations, start_year, end_year # process_file
#***************************************************
def scatter_map(outname, data, lons, lats, cmap, bounds, cb_label, title = "", figtext = "", doText = False):
'''
Standard scatter map
:param str outname: output filename root
:param array data: data to plot
:param array lons: longitudes
:param array lats: latitudes
:param obj cmap: colourmap to use
:param array bounds: bounds for discrete colormap
:param str cb_label: colorbar label
'''
norm=mpl.cm.colors.BoundaryNorm(bounds,cmap.N)
fig = plt.figure(figsize =(10,6.5))
plt.clf()
ax = plt.axes([0.05, 0.10, 0.90, 0.90], projection=cartopy.crs.Robinson())
ax.gridlines() #draw_labels=True)
ax.add_feature(cartopy.feature.LAND, zorder = 0, facecolor = "0.9", edgecolor = "k")
ax.coastlines()
ext = ax.get_extent() # save the original extent
scatter = plt.scatter(lons, lats, c = data, cmap = cmap, norm = norm, s=10, \
transform = cartopy.crs.Geodetic(), edgecolor = "r", linewidth = 0.1)
cb=plt.colorbar(scatter, orientation = 'horizontal', pad = 0.05, fraction = 0.05, \
aspect = 30, ticks = bounds[1:-1], label = cb_label, drawedges=True)
# thicken border of colorbar and the dividers
# http://stackoverflow.com/questions/14477696/customizing-colorbar-border-color-on-matplotlib
# cb.set_ticklabels(["{:g}".format(b) for b in bounds[1:-1]])
# cb.outline.set_color('k')
# cb.outline.set_linewidth(2)
cb.dividers.set_color('k')
cb.dividers.set_linewidth(2)
ax.set_extent(ext, ax.projection) # fix the extent change from colormesh
plt.title(title)
if doText: plt.text(0.01, 0.98, "#stations: {}".format(data.shape[0]), transform = ax.transAxes, fontsize = 10)
plt.savefig(outname)
plt.close()
return # scatter_map
#***************************************************
def main(ms = "era40_", year = 1980):
LOCS = "/group_workspaces/jasmin2/c3s311a_lot2/data/incoming/mars/v20170628/data/"
print year
station_names = np.array([])
fixed_station = np.array([])
latitudes = np.array([])
longitudes = np.array([])
observations = np.array([])
start_year = np.array([])
end_year = np.array([])
if ms == "erai_" and year < 1979:
return
else:
INFILE = "{}mars_{}{}.bufr".format(LOCS, ms, year)
try:
station_names, fixed_station, latitudes, longitudes, observations, start_year, end_year = \
process_file(INFILE, station_names, fixed_station, latitudes, longitudes, observations, start_year, end_year)
except CodesInternalError as err:
if VERBOSE:
traceback.print_exc(file=sys.stderr)
else:
sys.stderr.write(err.msg + '\n')
land = np.where(np.array(fixed_station) == True)
marine = np.where(np.array(fixed_station) == False)
bounds = np.linspace(0,max(observations),10).astype(int)
cmap = plt.cm.YlOrRd_r
if ms == "erai_":
title = "MARS - SYNOP - {}".format(year)
else:
title = "MARS - ERA40 - {}".format(year)
scatter_map("mars_{}{}_land_observations.png".format(ms, year), observations[land], longitudes[land], latitudes[land], cmap, bounds, "Number of Observations", title, doText = True)
scatter_map("mars_{}{}_marine_observations.png".format(ms, year), observations[marine], longitudes[marine], latitudes[marine], cmap, bounds, "Number of Observations", title)
station_names = 0
fixed_station = 0
latitudes = 0
longitudes = 0
observations = 0
start_year = 0
end_year = 0
land = 0
marine = 0
gc.collect()
return # main
#***************************************************
if __name__ == "__main__":
import argparse
# set up keyword arguments
parser = argparse.ArgumentParser()
parser.add_argument('--ms', dest='ms', action='store', default = "era40_",
help='Run on ERA40 ["era40_"] (default) or ERA-I ["erai_"] data')
parser.add_argument('--year', dest='year', action='store', default = 1980,
help='Which year to process - default 1980')
args = parser.parse_args()
main(ms = args.ms, year = args.year)
sys.exit()
#***************************************************
# END
#***************************************************
| 33.167742 | 184 | 0.540751 | 1 | 1.9446 | [
0.0005356253823265433,
0.048801589757204056,
0.024172158911824226,
-0.006055676378309727,
0.009119291789829731,
-0.034275393933057785,
0.03226752579212189,
-0.007589867804199457,
0.007350081577897072,
0.01759500242769718,
0.020412437617778778,
0.010614222846925259,
0.016977213323116302,
0.00839646253734827,
0.0004020822234451771,
-0.02868296578526497,
0.11700894683599472,
-0.014239530079066753,
0.032528214156627655,
0.04621070623397827,
0.0027154991403222084,
0.01999019831418991,
-0.02764067053794861,
0.036047112196683884,
0.004909547045826912,
0.03184394910931587,
-0.01726284809410572,
0.013374445028603077,
-0.0461178719997406,
0.0006341395201161504,
0.007770300377160311,
-0.006746524013578892,
-0.06854992359876633,
0.050372414290905,
-0.019780827686190605,
0.03786299750208855,
-0.02339690551161766,
-0.002718681236729026,
-0.006787967402487993,
0.04542923346161842,
-0.005626813508570194,
0.0013062163488939404,
-0.0034906601067632437,
-0.11575932800769806,
0.019513893872499466,
0.012120637111365795,
0.024394862353801727,
-0.006566143129020929,
-0.022275375202298164,
0.0016117505729198456,
-0.026118239387869835,
0.07632507383823395,
0.016464179381728172,
-0.029882311820983887,
0.03455911949276924,
-0.03933694213628769,
-0.014546992257237434,
-0.03658013418316841,
-0.03132212907075882,
-0.02857361175119877,
-0.018113069236278534,
0.008882742375135422,
0.03145938366651535,
-0.05013146251440048,
0.0068187592551112175,
0.022497836500406265,
-0.004883119836449623,
0.021254179999232292,
-0.01362695638090372,
-0.014507834799587727,
-0.019789045676589012,
-0.004635380115360022,
-0.014005490578711033,
0.06877605617046356,
-0.016536841168999672,
0.020605113357305527,
0.005065504927188158,
-0.036294445395469666,
-0.019715141505002975,
-0.02097753994166851,
-0.009247695095837116,
0.07063260674476624,
-0.03619960695505142,
-0.002209567464888096,
0.028195364400744438,
0.005183784756809473,
0.05446033924818039,
-0.018742572516202927,
-0.0033716773614287376,
0.009818023070693016,
-0.004154594149440527,
-0.0014081221306696534,
-0.012215062975883484,
-0.011860167607665062,
0.0029596989043056965,
-0.07128024101257324,
0.026842979714274406,
0.05021997541189194,
-0.011479593813419342,
0.009895849041640759,
0.01586092822253704,
-0.021083394065499306,
0.04416116699576378,
-0.00023576458625029773,
0.004626920446753502,
-0.05429388955235481,
-0.02082948200404644,
0.0004452933499123901,
0.03066491335630417,
0.0006882261950522661,
-0.096978098154068,
-0.002300760243088007,
0.05954975634813309,
-0.026435421779751778,
0.0038397496100515127,
-0.02494458295404911,
0.003205931978300214,
0.04384993016719818,
-0.031047742813825607,
0.06391369551420212,
0.01972511038184166,
-0.02873908169567585,
-0.00028490403201431036,
-0.01874588057398796,
-0.02000477910041809,
0.05759061127901077,
0.031019963324069977,
-0.015703776851296425,
-0.0024805900175124407,
-0.050454337149858475,
-0.011588199064135551,
-0.01815820299088955,
-0.0006893383106216788,
-0.02497762069106102,
0.030481107532978058,
-0.009896272793412209,
0.015771357342600822,
-0.025631729513406754,
-0.043624550104141235,
0.00738067552447319,
-0.0023445608094334602,
0.004081925377249718,
-0.0027871853671967983,
-0.03995031118392944,
0.013999435119330883,
-0.0006127560627646744,
0.0003103282942902297,
-0.033696249127388,
-0.03333090618252754,
-0.01387343741953373,
0.03917934373021126,
0.04828474670648575,
0.029144905507564545,
-0.004478604067116976,
0.0007066348334774375,
-0.06708212196826935,
0.016076160594820976,
-0.10234658420085907,
0.01248868741095066,
0.011688696220517159,
-0.034538835287094116,
0.0034900547470897436,
0.028738871216773987,
-0.024399355053901672,
-0.0002696012379601598,
0.009917833842337132,
-0.06784531474113464,
-0.010858292691409588,
0.004373979289084673,
0.012994018383324146,
0.006647416856139898,
0.03204486146569252,
-0.015482880175113678,
-0.03409222885966301,
-0.0021923899184912443,
-0.004564194008708,
0.03759339451789856,
-0.017004089429974556,
0.011665493249893188,
-0.054684117436409,
0.012587431818246841,
0.05916031450033188,
0.015649186447262764,
0.012383612804114819,
0.01481628231704235,
-0.045679837465286255,
-0.03142431005835533,
-0.03941068798303604,
0.04491237550973892,
-0.0050901370123028755,
-0.01833314076066017,
0.04276012256741524,
-0.007709627039730549,
0.03825828433036804,
-0.006890422198921442,
0.012619721703231335,
0.00012821267591789365,
-0.006345154717564583,
-0.006125605199486017,
-0.029960982501506805,
-0.007035919465124607,
-0.00733078783378005,
0.05973580479621887,
0.05632156506180763,
-0.02483425848186016,
0.010356861166656017,
-0.6118525266647339,
0.026495356112718582,
-0.003376747714355588,
-0.02543211542069912,
-0.007890088483691216,
0.007432462181895971,
-0.023333275690674782,
0.009644011035561562,
-0.03396587818861008,
0.054222483187913895,
-0.02040504664182663,
0.02716587670147419,
-0.0573468878865242,
0.01881047897040844,
0.02233877405524254,
0.012807071208953857,
-0.024534044787287712,
0.038432519882917404,
-0.010754762217402458,
-0.021837718784809113,
0.05080181732773781,
-0.010501149110496044,
0.006521632894873619,
-0.0007895121816545725,
-0.0037851941306144,
-0.06602723151445389,
0.00633030803874135,
-0.008643165230751038,
-0.002741633215919137,
-0.018973324447870255,
-0.02810877561569214,
0.005786131601780653,
-0.002771726343780756,
-0.0008873994229361415,
0.049323756247758865,
0.016382357105612755,
0.02447395585477352,
-0.015516499057412148,
0.0410715788602829,
-0.02937375195324421,
-0.026804978027939796,
-0.038274023681879044,
-0.03812601789832115,
-0.03395557031035423,
-0.0585307739675045,
-0.021202409639954567,
0.024275872856378555,
-0.05215251445770264,
-0.021111231297254562,
-0.028725847601890564,
0.00634217681363225,
0.027615807950496674,
0.01665007881820202,
-0.01803853176534176,
-0.005070701241493225,
-0.0044721998274326324,
-0.02801329456269741,
-0.02398698963224888,
-0.025485055521130562,
0.021152352914214134,
0.02368284948170185,
-0.040052346885204315,
0.0035405901726335287,
-0.001997204264625907,
0.012849847786128521,
0.009611055254936218,
-0.026461828500032425,
-0.042804647237062454,
-0.01757468283176422,
0.027263887226581573,
0.008283744566142559,
0.0010337521089240909,
-0.04673571139574051,
-0.010610383003950119,
0.04059861600399017,
-0.011717396788299084,
-0.016786957159638405,
-0.002169649116694927,
-0.03452228009700775,
-0.026472991332411766,
0.0020914890337735415,
0.03570203483104706,
-0.015688635408878326,
-0.018609333783388138,
0.0012744353152811527,
0.01310237031430006,
-0.001275527523830533,
0.00848748441785574,
0.019414013251662254,
-0.02634154073894024,
-0.002427381230518222,
0.08314654976129532,
0.03524818643927574,
0.00872997660189867,
-0.007946259342133999,
-0.011333274655044079,
0.020497804507613182,
0.016912562772631645,
0.022768905386328697,
0.03521734103560448,
-0.026374999433755875,
0.005967673845589161,
-0.0012094521662220359,
0.05134584382176399,
-0.05231466144323349,
0.03433861583471298,
-0.04904325306415558,
-0.03562653809785843,
0.02712797187268734,
-0.04900410771369934,
0.0123780257999897,
0.013509456999599934,
-0.03234631568193436,
-0.05504078045487404,
-0.009092302061617374,
-0.04590903967618942,
-0.011794446036219597,
-0.05046642944216728,
-0.006097876001149416,
0.03974645212292671,
-0.003832852467894554,
0.011668289080262184,
-0.014143622480332851,
0.04745392128825188,
0.0010470151901245117,
-0.0147695979103446,
-0.014956480823457241,
0.01845625229179859,
0.04213200882077217,
0.02163468673825264,
-0.02466006763279438,
-0.03075803443789482,
0.028390072286128998,
0.011069875210523605,
-0.022485941648483276,
-0.00012580885959323496,
-0.03469599410891533,
-0.004475499503314495,
0.023525219410657883,
-0.012643532827496529,
-0.04215021803975105,
0.02443990297615528,
-0.006708648055791855,
-0.018395492807030678,
0.001953275641426444,
0.028527289628982544,
0.028981689363718033,
-0.00017403834499418736,
-0.010989980772137642,
-0.022422268986701965,
0.020220812410116196,
0.020052645355463028,
0.0028865786734968424,
0.04797551780939102,
-0.0155055345967412,
0.022664302960038185,
-0.05958716943860054,
0.009582914412021637,
0.036499980837106705,
0.006087153218686581,
-0.013141054660081863,
0.011504791676998138,
-0.021365156397223473,
-0.017584357410669327,
0.03402378037571907,
0.013975568115711212,
-0.023608339950442314,
0.05638788267970085,
0.03007553331553936,
-0.0010384690249338746,
0.0040494841523468494,
0.009832468815147877,
0.034894414246082306,
0.03195822611451149,
-0.01464015617966652,
0.0228388924151659,
-0.013726119883358479,
-0.039543431252241135,
-0.015305170789361,
0.011233272962272167,
0.027212118729948997,
-0.02907547540962696,
-0.002758115530014038,
-0.013791101984679699,
0.04602446034550667,
0.04470442980527878,
-0.006805598270148039,
-0.007641015574336052,
-0.003532533999532461,
-0.005303484853357077,
0.03750183433294296,
0.004404955543577671,
0.0006881086737848818,
-0.034784696996212006,
-0.013427216559648514,
0.02262895740568638,
-0.028562190011143684,
-0.02233991026878357,
0.008338894695043564,
0.00454747537150979,
-0.005644879769533873,
0.03564147278666496,
-0.017580967396497726,
0.02239186316728592,
0.0026282130274921656,
0.06672241538763046,
-0.03290373086929321,
0.018674157559871674,
-0.00664531160145998,
-0.007092091254889965,
-0.00047401641495525837,
-0.016417192295193672,
0.014011181890964508,
0.04302942007780075,
-0.016238175332546234,
0.018516289070248604,
-0.045474499464035034,
0.031111814081668854,
-0.012840752489864826,
-0.04936297610402107,
-0.004977564327418804,
-0.05598345026373863,
0.037428177893161774,
-0.015456573106348515,
-0.0031471075490117073,
-0.0040961625054478645,
0.013754946179687977,
-0.008065294474363327,
-0.009145567193627357,
-0.017838625237345695,
0.015955781564116478,
-0.00918705016374588,
-0.005547226872295141,
-0.027635842561721802,
0.02236619032919407,
0.02236049808561802,
0.020417269319295883,
-0.03927924484014511,
-0.00040224328404292464,
-0.0158351119607687,
0.05278017744421959,
-0.03532669320702553,
0.013670661486685276,
-0.008831744082272053,
-0.021591654047369957,
0.00515764020383358,
0.01521421317011118,
-0.03220682963728905,
0.014838320203125477,
-0.0323612317442894,
-0.0177860539406538,
0.017721666023135185,
0.029782643541693687,
-0.0005418737418949604,
0.01965976692736149,
0.009020179510116577,
0.000686981191392988,
-0.0012610242702066898,
0.011345545761287212,
-0.006551201920956373,
-0.04024903103709221,
-0.03044869191944599,
-0.049083810299634933,
-0.009660392999649048,
-0.02016426809132099,
-0.011417900212109089,
0.030927957966923714,
-0.018416501581668854,
0.000022985093892202713,
-0.03266622871160507,
-0.03127790242433548,
-0.006920589134097099,
-0.031043939292430878,
-0.03080565668642521,
0.01023663580417633,
-0.026142209768295288,
-0.03130596876144409,
-0.04199910908937454,
-0.01274922676384449,
0.04329848662018776,
-0.03546961396932602,
-0.033059149980545044,
0.013377317227423191,
-0.006830580998212099,
0.019826224073767662,
0.004704785533249378,
-0.014502499252557755,
-0.003552354173734784,
-0.0326913557946682,
-0.014601992443203926,
0.016932204365730286,
-0.04341724514961243,
0.05513012781739235,
0.005958386696875095,
0.013747595250606537,
0.007789436262100935,
-0.011191487312316895,
-0.01315691415220499,
0.02868317812681198,
-0.02444527857005596,
0.03468083217740059,
-0.02226630039513111,
-0.013378439471125603,
0.010005629621446133,
-0.021646900102496147,
-0.013266641646623611,
-0.008568232879042625,
-0.009678716771304607,
0.022897453978657722,
-0.02419503964483738,
0.049306608736515045,
0.049160122871398926,
-0.03284091129899025,
-0.003427423071116209,
0.01035816129297018,
0.03821533918380737,
0.009409017860889435,
0.007170804776251316,
0.000017116199160227552,
-0.008454319089651108,
-0.01774279586970806,
0.014612386003136635,
0.008121180348098278,
-0.016776053234934807,
-0.004365440458059311,
-0.015202917158603668,
-0.02803472802042961,
-0.03942869231104851,
0.04023859277367592,
-0.03098425455391407,
-0.02297268435359001,
0.04386116936802864,
-0.0170703437179327,
0.02202485129237175,
0.0026141470298171043,
0.0576293058693409,
0.05504820868372917,
0.037635818123817444,
0.012800113297998905,
0.03839285299181938,
-0.0003664384421426803,
0.008153374306857586,
-0.01835872046649456,
0.00730830617249012,
-0.035665497183799744,
-0.049333732575178146,
-0.02689225785434246,
0.06493974477052689,
0.041681017726659775,
0.03135436028242111,
0.006821692921221256,
-0.030007164925336838,
-0.000863948545884341,
-0.03311359882354736,
0.00044471045839600265,
-0.022867606952786446,
-0.024646515026688576,
0.006049058865755796,
0.0011034312192350626,
-0.03339492157101631,
0.05682595074176788,
0.007765594404190779,
-0.009154933504760265,
-0.008313637226819992,
-0.0035847018007189035,
-0.009335696697235107,
0.011133733205497265,
-0.008554965257644653,
0.0020790148992091417,
0.008195001631975174,
0.03263454511761665,
-0.00541381910443306,
0.0018056350527331233,
0.015095057897269726,
-0.02241632528603077,
0.01313707698136568,
-0.0006885881302878261,
-0.0002039697574218735,
-0.018813777714967728,
0.005343830678611994,
0.01088669802993536,
0.020049002021551132,
0.05291879177093506,
-0.023035170510411263,
0.058039430528879166,
-0.023179180920124054,
-0.009484151378273964,
0.007125054020434618,
-0.005294684320688248,
-0.04774119332432747,
0.025653380900621414,
-0.005291292909532785,
-0.018258271738886833,
0.02710365690290928,
-0.01497867051512003,
0.01609700359404087,
-0.00036525423638522625,
-0.009559005498886108,
-0.0047619035467505455,
-0.008759180083870888,
0.010110393166542053,
0.007847317494452,
-0.00205336045473814,
0.029416289180517197,
-0.00034389307256788015,
-0.04522915929555893,
0.013013973832130432,
-0.004583232570439577,
0.025774959474802017,
0.049794651567935944,
0.029686082154512405,
0.0732751414179802,
-0.01515620481222868,
-0.04853903129696846,
0.08551949262619019,
0.031989555805921555,
-0.007958070375025272,
-0.03808196261525154,
0.04194549471139908,
0.017889726907014847,
-0.0617186613380909,
0.017018236219882965,
-0.01104288175702095,
-0.05817026644945145,
0.007909066043794155,
-0.03717559203505516,
0.02576642483472824,
-0.006161551456898451,
-0.017341982573270798,
-0.00826669204980135,
0.006227128207683563,
-0.07091666758060455,
-0.015069530345499516,
0.003340874332934618,
0.04015294462442398,
-0.003435809863731265,
0.013733080588281155,
0.007520463317632675,
-0.022270163521170616,
-0.02793300524353981,
0.003970425575971603,
0.011122421361505985,
0.012242991477251053,
0.03861883655190468,
0.021123984828591347,
-0.04806318134069443,
0.020636722445487976,
0.05079874023795128,
0.04075305536389351,
-0.031354937702417374,
-0.012387959286570549,
-0.01882103644311428,
0.013894619420170784,
0.023875264450907707,
0.006371625699102879,
0.022395888343453407,
0.018080808222293854,
-0.007712358143180609,
0.028520114719867706,
0.042863015085458755,
-0.02660663053393364,
0.010363743640482426,
-0.0010681061539798975,
0.00745727401226759,
0.004048679489642382,
0.026234092190861702,
0.03330357372760773,
0.03128701448440552,
-0.003637628396973014,
-0.0023010154254734516,
-0.03183424845337868,
0.013653349131345749,
-0.01527246180921793,
0.04252687841653824,
-0.034020792692899704,
-0.014475316740572453,
-0.04655329883098602,
0.028977008536458015,
-0.0066596209071576595,
-0.003485172986984253,
-0.04536174237728119,
0.005277634598314762,
0.03622456267476082,
0.027547942474484444,
0.038849856704473495,
0.020094232633709908,
-0.02318880520761013,
-0.003318974981084466,
-0.04314155504107475,
0.011486556380987167,
-0.037646468728780746,
-0.027939438819885254,
-0.02040543220937252,
0.03453047573566437,
0.01894298382103443,
-0.054584648460149765,
0.004487574566155672,
0.014172994531691074,
0.04038023576140404,
-0.010279005393385887,
-0.023318737745285034,
-0.004180373158305883,
0.05594472959637642,
-0.059882987290620804,
0.02367807738482952,
0.024498971179127693,
0.05728641897439957,
0.0222538560628891,
0.018765347078442574,
0.004066464025527239,
-0.007420870941132307,
-0.024710219353437424,
-0.005150550976395607,
-0.0652405396103859,
-0.018341612070798874,
0.014456002041697502,
0.04507344216108322,
-0.0008850716985762119,
0.007314957212656736,
-0.024743491783738136,
0.013029307126998901,
0.004346274770796299,
-0.01347423531115055,
-0.013043968938291073,
0.037743356078863144,
-0.05753156915307045,
-0.012252118438482285,
0.044865962117910385,
-0.0027469643391668797,
0.0303778238594532,
-0.0023426595143973827,
-0.027062509208917618,
-0.0031092537101358175,
0.002593615557998419,
0.043553534895181656,
-0.0495188869535923,
0.03236909583210945,
0.009433295577764511,
0.00867483951151371,
-0.05336317792534828,
0.030977856367826462,
0.01975739374756813,
0.0007544936379417777,
-0.036501187831163406,
-0.03949877992272377,
-0.027986014261841774,
-0.016973184421658516,
-0.014016415923833847,
0.03163466602563858,
-0.03075302578508854,
0.02811620570719242,
0.010507890954613686,
-0.03847156837582588,
-0.011677831411361694,
0.005978374741971493,
-0.019248340278863907,
0.0025656179059296846,
-0.0018925049807876348,
0.038715653121471405,
-0.021233415231108665,
0.03381301462650299,
0.006822782102972269
] |
8a7777964dadf66bcb5c8207f5f26c1301e49cee | 3,977 | py | Python | libsaas/services/twilio/applications.py | MidtownFellowship/libsaas | 541bb731b996b08ede1d91a235cb82895765c38a | [
"MIT"
] | 155 | 2015-01-27T15:17:59.000Z | 2022-02-20T00:14:08.000Z | libsaas/services/twilio/applications.py | MidtownFellowship/libsaas | 541bb731b996b08ede1d91a235cb82895765c38a | [
"MIT"
] | 14 | 2015-01-12T08:22:37.000Z | 2021-06-16T19:49:31.000Z | libsaas/services/twilio/applications.py | MidtownFellowship/libsaas | 541bb731b996b08ede1d91a235cb82895765c38a | [
"MIT"
] | 43 | 2015-01-28T22:41:45.000Z | 2021-09-21T04:44:26.000Z | from libsaas import http, parsers
from libsaas.services import base
from libsaas.services.twilio import resource
class ApplicationsBase(resource.TwilioResource):
path = 'Applications'
class Application(ApplicationsBase):
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
class Applications(ApplicationsBase):
@base.apimethod
def get(self, FriendlyName=None, Page=None, PageSize=None, AfterSid=None):
"""
Fetch the Applications belonging to an account.
:var FriendlyName: Only return the Account resources with friendly
names that exactly match this name.
:vartype FriendlyName: str
:var Page: The current page number. Zero-indexed, so the first page
is 0.
:vartype Page: int
:var PageSize: How many resources to return in each list page.
The default is 50, and the maximum is 1000.
:vartype PageSize: int
:var AfterSid: The last Sid returned in the previous page, used to
avoid listing duplicated resources if new ones are created while
paging.
:vartype AfterSid: str
"""
params = resource.get_params(None, locals())
request = http.Request('GET', self.get_url(), params)
return request, parsers.parse_json
def update(self, *args, **kwargs):
raise base.MethodNotSupported()
def delete(self, *args, **kwargs):
raise base.MethodNotSupported()
class ConnectAppsBase(resource.TwilioResource):
path = 'ConnectApps'
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
def delete(self, *args, **kwargs):
raise base.MethodNotSupported()
class ConnectApp(ConnectAppsBase):
pass
class ConnectApps(ConnectAppsBase):
@base.apimethod
def get(self, Page=None, PageSize=None, AfterSid=None):
"""
Fetch the Connect Apps belonging to an account.
:var Page: The current page number. Zero-indexed, so the first page
is 0.
:vartype Page: int
:var PageSize: How many resources to return in each list page.
The default is 50, and the maximum is 1000.
:vartype PageSize: int
:var AfterSid: The last Sid returned in the previous page, used to
avoid listing duplicated resources if new ones are created while
paging.
:vartype AfterSid: str
"""
params = resource.get_params(None, locals())
request = http.Request('GET', self.get_url(), params)
return request, parsers.parse_json
def update(self, *args, **kwargs):
raise base.MethodNotSupported()
class AuthorizedConnectAppsBase(resource.TwilioResource):
path = 'AuthorizedConnectApps'
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
def update(self, *args, **kwargs):
raise base.MethodNotSupported()
def delete(self, *args, **kwargs):
raise base.MethodNotSupported()
class AuthorizedConnectApp(AuthorizedConnectAppsBase):
pass
class AuthorizedConnectApps(AuthorizedConnectAppsBase):
@base.apimethod
def get(self, Page=None, PageSize=None, AfterSid=None):
"""
Fetch the Authorized Connect Apps belonging to an account.
:var Page: The current page number. Zero-indexed, so the first page
is 0.
:vartype Page: int
:var PageSize: How many resources to return in each list page.
The default is 50, and the maximum is 1000.
:vartype PageSize: int
:var AfterSid: The last Sid returned in the previous page, used to
avoid listing duplicated resources if new ones are created while
paging.
:vartype AfterSid: str
"""
params = resource.get_params(None, locals())
request = http.Request('GET', self.get_url(), params)
return request, parsers.parse_json
| 28.007042 | 78 | 0.652753 | 1 | 1.9416 | [
0.002084298525005579,
0.02254163660109043,
0.008165908977389336,
0.0035119326785206795,
0.002940325764939189,
-0.0003507201327010989,
-0.007944531738758087,
0.000454032706329599,
-0.0065461271442472935,
0.004272302147001028,
0.001377907465212047,
0.005053560249507427,
0.00651090033352375,
-0.01624176651239395,
-0.0018845422891899943,
0.016952672973275185,
-0.04579950124025345,
-0.0016511334106326103,
-0.0030621658079326153,
0.001007450744509697,
-0.007224645931273699,
0.007687834091484547,
0.00893788505345583,
0.004417895805090666,
0.006966807413846254,
-0.001926083816215396,
0.010502983815968037,
0.0019870037212967873,
-0.006599674466997385,
-0.007277919910848141,
-0.0038355800788849592,
-0.002302663866430521,
-0.004785027354955673,
-0.0035948632284998894,
0.005221538245677948,
-0.004629839211702347,
-0.0013678475515916944,
-0.021594690158963203,
0.012550760991871357,
-0.0029298937879502773,
-0.004637619014829397,
-0.015710696578025818,
-0.0012470557121559978,
0.0026476348284631968,
-0.0059271217323839664,
0.0013397950679063797,
-0.004034687764942646,
0.003955771215260029,
-0.014185109175741673,
0.006429294589906931,
-0.008420468308031559,
0.009608838707208633,
0.014556658454239368,
0.0026154639199376106,
-0.006583400070667267,
-0.006916486658155918,
0.013772262260317802,
-0.0006882040179334581,
-0.009386849589645863,
-0.0012339785462245345,
-0.003961155191063881,
-0.004693964030593634,
0.006595307495445013,
0.002192396903410554,
-0.014028745703399181,
-0.008337549865245819,
-0.003908456303179264,
0.0021465045865625143,
0.0002767742844298482,
0.006932099349796772,
-0.001891382155008614,
0.0004166003200225532,
0.007925852201879025,
0.007131029386073351,
0.007812067400664091,
-0.0036165646743029356,
-0.00022586794511880726,
-0.002673547714948654,
0.009481620043516159,
0.003350946819409728,
0.0035179711412638426,
-0.007132978644222021,
0.005035387352108955,
0.005684222560375929,
0.013658386655151844,
0.01137521956115961,
0.022363416850566864,
-0.010937019251286983,
0.05101985111832619,
0.01078339759260416,
-0.0059686931781470776,
0.0031926860101521015,
-0.011023099534213543,
-0.0013666612794622779,
-0.009733947925269604,
-0.02566993050277233,
0.0009690079023130238,
-0.004654273856431246,
-0.0009764065034687519,
0.0034442483447492123,
-0.0008575994288548827,
0.00868050567805767,
-0.0028364690952003,
-0.0016193812480196357,
-0.006185438949614763,
0.009028259664773941,
-0.009578915312886238,
-0.004174621310085058,
0.0027490241918712854,
0.00152192625682801,
-0.010669812560081482,
-0.0026649965438991785,
0.0028881975449621677,
-0.011884918436408043,
0.002719131065532565,
0.0015255413018167019,
-0.005170788615942001,
0.05230307579040527,
0.0007534371106885374,
0.006013389676809311,
-0.004484499339014292,
0.0037107709795236588,
0.001689540920779109,
0.0027333982288837433,
0.01091410219669342,
0.0006670365110039711,
0.010955404490232468,
0.007035115268081427,
0.0020972995553165674,
0.009824555367231369,
-0.004028110299259424,
0.006595865357667208,
-0.0038249038625508547,
-0.0035942373797297478,
0.000857654376886785,
-0.007388200610876083,
0.005441170185804367,
-0.0018534584669396281,
-0.010310294106602669,
0.0016843769699335098,
0.0012408056063577533,
-0.007500321604311466,
-0.0008442533435299993,
-0.0009032170637510717,
0.00455284770578146,
-0.01097318809479475,
-0.0029884199611842632,
-0.004959174897521734,
-0.004914586897939444,
0.0032673049718141556,
0.01215591374784708,
0.003285749116912484,
0.0023545613512396812,
-0.003854882437735796,
-0.009684224613010883,
0.002827285323292017,
-0.004362578969448805,
0.00009727175347507,
0.006819257978349924,
0.0020099743269383907,
-0.011310216970741749,
-0.0006720993551425636,
0.0018402454443275928,
0.0007042493089102209,
-0.000030105227779131383,
0.004464867990463972,
-0.0069980560801923275,
0.004063803236931562,
0.00029841982177458704,
0.005230661015957594,
0.010299966670572758,
-0.0037664480041712523,
-0.0006612086435779929,
-0.0011890341993421316,
0.0010291400831192732,
-0.0015696623595431447,
0.006241228897124529,
0.00974420178681612,
-0.00227244826965034,
-0.003568310523405671,
0.0051860930398106575,
0.006609436124563217,
0.00983241107314825,
0.004400879144668579,
-0.004381079226732254,
0.00043212034506723285,
-0.007897263392806053,
-0.00539787532761693,
0.006050415337085724,
-0.004886094015091658,
0.004380284808576107,
0.0052578323520720005,
-0.011806258000433445,
-0.00902223028242588,
0.0021827206946909428,
-0.003473282791674137,
0.0007408160017803311,
0.012823224999010563,
0.012374751269817352,
-0.006630858406424522,
0.005528616718947887,
-0.006758356466889381,
0.0028005605563521385,
0.007673938293009996,
0.002216177526861429,
-0.011951704509556293,
-0.9603537321090698,
0.011016692034900188,
0.0038976131472736597,
-0.002244410337880254,
0.006683626677840948,
0.0033021769486367702,
0.0055008335039019585,
0.005038910079747438,
0.01699826866388321,
-0.008993979543447495,
-0.004079561214894056,
-0.013145208358764648,
-0.011586523614823818,
-0.0015554140554741025,
-0.008858022280037403,
-0.0049848491325974464,
-0.0050460719503462315,
-0.006247206125408411,
-0.002106032334268093,
-0.0024807488080114126,
-0.0019919374026358128,
0.008266485296189785,
-0.002182961907237768,
0.004754641558974981,
0.0021079168654978275,
0.005705957766622305,
-0.003675533691421151,
-0.0009763766429387033,
-0.002298472449183464,
-0.002081932732835412,
-0.008067380636930466,
-0.011141166090965271,
-0.0027397554367780685,
-0.0016358359716832638,
0.010974181815981865,
0.0019666424486786127,
0.009481334127485752,
-0.002890573348850012,
0.004178945906460285,
-0.006042762193828821,
0.004251358564943075,
-0.0008654062985442579,
0.003140705870464444,
-0.030195141211152077,
0.0010864868527278304,
-0.00013212952762842178,
-0.012461238540709019,
0.008951118215918541,
0.0002434418274788186,
-0.0010368330404162407,
-0.0029816848691552877,
-0.0059507121331989765,
0.009589633904397488,
-0.00487099215388298,
0.001372709171846509,
-0.0030525769107043743,
-0.009749654680490494,
-0.003397321794182062,
-0.008354427292943,
0.0006138357566669583,
0.0042074015364050865,
-0.001842360943555832,
-0.005226301960647106,
-0.003009774489328265,
0.0037874283734709024,
0.004052386153489351,
0.002540789544582367,
-0.018816446885466576,
-0.009543747641146183,
0.0022874290589243174,
-0.0032432028092443943,
-0.007783149369060993,
-0.003330075182020664,
0.004172540735453367,
-0.009401936084032059,
0.0074137551710009575,
0.0031288480386137962,
0.0001675574603723362,
-0.01407486479729414,
-0.0005753064178861678,
-0.008706638589501381,
-0.0044539798982441425,
-0.00040639983490109444,
-0.005766489077359438,
-0.008496807888150215,
-0.0024533201940357685,
-0.0017935200594365597,
0.007532651070505381,
-0.003592829219996929,
0.005037304013967514,
0.009612246416509151,
-0.0027981572784483433,
-0.005350241903215647,
0.005481380503624678,
0.006287021096795797,
-0.0001419481704942882,
-0.0015837952960282564,
0.003439556574448943,
0.005974114406853914,
0.0076578957960009575,
0.004405539017170668,
0.006390441674739122,
-0.0007758012507110834,
0.007104218937456608,
-0.002790563041344285,
0.00016956194303929806,
-0.005677489098161459,
0.0017582755535840988,
-0.002853386802598834,
-0.0009693739702925086,
-0.0022070324048399925,
-0.00424320250749588,
-0.014478979632258415,
-0.005255641415715218,
-0.0013694769004359841,
-0.0031410795636475086,
0.0038997961673885584,
-0.004640430212020874,
-0.0008104325970634818,
0.003062823321670294,
0.006109209265559912,
-0.0002382761740591377,
-0.0003446711925789714,
0.0010819635353982449,
0.0034562803339213133,
-0.005824912805110216,
0.014294550754129887,
-0.012724636122584343,
0.008189156651496887,
0.0015716168563812971,
-0.01756349205970764,
0.0056129079312086105,
0.008771098218858242,
-0.009825150482356548,
0.001906782272271812,
0.007257276214659214,
0.0016329905483871698,
-0.0019048305694013834,
-0.004824224393814802,
-0.002562756882980466,
-0.015278685837984085,
-0.0011713779531419277,
0.01804313249886036,
-0.0009928160579875112,
0.009368049912154675,
0.008770029060542583,
-0.002473817439749837,
0.0019986105617135763,
0.005124922376126051,
-0.0007423279457725585,
0.011366077698767185,
-0.006499037612229586,
-0.0022016759030520916,
0.003907250706106424,
-0.008030351251363754,
-0.0009619970223866403,
0.006817176006734371,
0.00700283283367753,
-0.0013933992013335228,
0.003621387295424938,
-0.008538098074495792,
-0.006342294160276651,
-0.0173236895352602,
-0.004875827580690384,
0.007797311060130596,
-0.003629711689427495,
0.006646934896707535,
-0.010710847564041615,
0.006198749877512455,
0.0064186230301856995,
0.0062838648445904255,
-0.0035387075040489435,
-0.00007901885692263022,
0.006500772666186094,
0.01351869385689497,
-0.00357424165122211,
-0.00021733803441748023,
0.0035412528086453676,
-0.0014265220379456878,
-0.00267976731993258,
0.012310681864619255,
-0.006199059076607227,
-0.006523397285491228,
0.004114527255296707,
0.005339001305401325,
-0.0005114773521199822,
-0.0035536352079361677,
-0.008858340792357922,
-0.0030806842260062695,
0.004201869014650583,
-0.006078983657062054,
0.003953088074922562,
-0.0009429433266632259,
0.00430327607318759,
-0.00486115925014019,
-0.0015643206425011158,
-0.0010691441129893064,
-0.01421499066054821,
0.010894976556301117,
-0.0024367847945541143,
0.002375364536419511,
0.013898809440433979,
0.006735263392329216,
-0.010754729621112347,
0.004212872125208378,
0.009921766817569733,
-0.002718091942369938,
0.00601049093529582,
0.005266253370791674,
-0.007092868443578482,
-0.020224345847964287,
-0.006057641934603453,
-0.014551817439496517,
0.005041621159762144,
-0.004665928892791271,
0.007418360095471144,
-0.005610582418739796,
0.007496003061532974,
0.009362130425870419,
-0.013294735923409462,
-0.006480262149125338,
-0.006843018811196089,
0.010558262467384338,
0.001434623496606946,
0.0008508319733664393,
-0.004680521786212921,
-0.00016938685439527035,
-0.0026148061733692884,
-0.006571254692971706,
-0.004324120003730059,
0.005846838466823101,
0.001843784935772419,
-0.0005189744406379759,
0.001371206482872367,
-0.006092740222811699,
0.00009552518167765811,
0.0012513628462329507,
-0.009217659942805767,
0.0025897782761603594,
0.0010232087224721909,
-0.002225446980446577,
-0.0036375585477799177,
0.0019074541050940752,
-0.0003501282481011003,
-0.008474035188555717,
-0.01104023028165102,
-0.004227215889841318,
-0.003132648766040802,
-0.003216397948563099,
-0.012375797145068645,
-0.0023354319855570793,
-0.006672247312963009,
0.003466881113126874,
-0.00840791780501604,
0.008572068065404892,
0.006925030145794153,
-0.0030343346297740936,
0.007535258773714304,
-0.0008123177103698254,
0.004109832923859358,
0.004201407078653574,
0.004154256545007229,
0.00300413160584867,
-0.003439617110416293,
-0.010057752951979637,
0.012413984164595604,
-0.005991070065647364,
0.00028718626708723605,
0.012338445521891117,
0.004786855075508356,
0.00829241145402193,
-0.0019087221007794142,
-0.0006586412782780826,
0.00004640390397980809,
0.004889546427875757,
-0.013163832016289234,
0.0032411632128059864,
-0.003575518960133195,
0.0008603772730566561,
0.005177106708288193,
-0.004641879815608263,
-0.0008876441279426217,
0.011398401111364365,
0.0001136264982051216,
-0.00910855457186699,
-0.001283239689655602,
0.0034817582927644253,
0.0032462100498378277,
-0.013481250032782555,
0.000497897679451853,
-0.0027842822019010782,
-0.0043703122064471245,
-0.002468399703502655,
-0.0037765323650091887,
0.001256044371984899,
0.004430465400218964,
-0.00045974942622706294,
0.0073289270512759686,
0.002361186081543565,
-0.004819321911782026,
0.013373048044741154,
-0.0038584440480917692,
-0.005064577795565128,
0.003441066946834326,
0.0044958945363759995,
-0.0038725724443793297,
-0.004697470925748348,
-0.0014228399377316236,
0.0037533221766352654,
0.008427890948951244,
-0.0017990831984207034,
-0.005966133903712034,
0.0011084179859608412,
0.0002153491077478975,
-0.01235123910009861,
0.002807525685057044,
0.014192713424563408,
-0.0045502749271690845,
0.00753549300134182,
-0.004229275975376368,
-0.008813747204840183,
-0.01395923551172018,
0.050694070756435394,
-0.0017345084343105555,
0.0024214291479438543,
0.0018478671554476023,
-0.008206506259739399,
-0.0020903402473777533,
-0.0037133798468858004,
0.01017698273062706,
-0.005652118474245071,
-0.006204687058925629,
0.006922072730958462,
-0.0029790804255753756,
0.005944008938968182,
0.003737897612154484,
-0.0002637506404425949,
0.01581457443535328,
-0.0042875646613538265,
-0.013191376812756062,
-0.021636320278048515,
0.00890308991074562,
-0.003785425331443548,
-0.009135900996625423,
0.011381405405700207,
-0.002829877659678459,
-0.007831769064068794,
0.0035553802736103535,
0.006893731653690338,
0.0024116148706525564,
-0.0015903449384495616,
-0.002487007761374116,
-0.0031962941866368055,
-0.0033584260381758213,
0.002127715153619647,
0.0028159371577203274,
0.005741606000810862,
-0.0023264531046152115,
0.003044671379029751,
-0.0014203524915501475,
-0.0024978667497634888,
-0.0015922090969979763,
0.0042560468427836895,
0.006044087000191212,
-0.0010769290383905172,
-0.001787065644748509,
0.005083140917122364,
0.0042073093354702,
0.0030635534785687923,
0.010912972502410412,
0.000008283993338409346,
-0.010198728181421757,
0.00831938348710537,
0.005808497779071331,
0.001991179073229432,
0.010405885986983776,
-0.0009999277535825968,
0.006564900744706392,
0.002037231344729662,
-0.007081765681505203,
-0.01555580273270607,
-0.004115629475563765,
0.0056199426762759686,
0.007684048730880022,
0.0000782933275331743,
-0.000979787320829928,
-0.0020223192404955626,
-0.0010937787592411041,
-0.00552098173648119,
-0.006970349699258804,
-0.003929183818399906,
0.001699879881925881,
0.002849196083843708,
0.0659007728099823,
-0.007703403010964394,
-0.0020035638008266687,
-0.007161465007811785,
-0.0016810193192213774,
-0.0033280416391789913,
-0.0021016178652644157,
0.0013487855903804302,
-0.0056592561304569244,
0.0009174171718768775,
-0.002374767092987895,
-0.004266715608537197,
-0.013209925964474678,
0.00002836824205587618,
0.00015859000268392265,
-0.003859860822558403,
0.005421527661383152,
0.006034719757735729,
-0.012885946780443192,
0.001037591602653265,
-0.012544013559818268,
-0.001934465253725648,
-0.0024366648867726326,
-0.01060369424521923,
-0.005138277541846037,
-0.0007960197399370372,
0.008158201351761818,
0.0031705095898360014,
0.005144230555742979,
-0.0017776071326807141,
0.00395422987639904,
-0.003148967633023858,
-0.0016387924551963806,
-0.007101831026375294,
-0.0007624126737937331,
-0.007275964133441448,
0.007859357632696629,
0.003198734950274229,
-0.009119246155023575,
-0.002460027812048793,
0.0009135476429946721,
-0.0004866661038249731,
-0.005085505545139313,
0.000802905997261405,
-0.00148923194501549,
0.0022727337200194597,
-0.0038458448834717274,
0.00031160007347352803,
-0.005122296046465635,
0.004147511441260576,
-0.013207528740167618,
0.005924237426370382,
-0.16523297131061554,
0.009714856743812561,
0.004222196526825428,
-0.006466697435826063,
-0.005404836032539606,
-0.014082021079957485,
-0.0015893855597823858,
0.005460052751004696,
0.00836971215903759,
0.0035708891227841377,
-0.0025633471086621284,
0.0014574156375601888,
0.0036086956970393658,
0.004367596935480833,
0.00012956080900039524,
-0.005891895387321711,
0.0038738278672099113,
-0.0044057839550077915,
0.003435757476836443,
0.004331525880843401,
0.0037295822985470295,
0.012265226803719997,
-0.0018306556157767773,
0.00020538859826046973,
-0.0023733298294246197,
-0.004021326545625925,
0.00877291802316904,
-0.0023641400039196014,
0.005147411487996578,
-0.011295484378933907,
-0.002271357225254178,
-0.004945813678205013,
-0.006007173098623753,
-0.0007666160236112773,
0.004195570480078459,
-0.0007788584916852415,
0.011028553359210491,
0.0035770961549133062,
-0.008101086132228374,
0.00998845137655735,
-0.0105811832472682,
0.024906979873776436,
0.005791997537016869,
0.005834174808114767,
0.001053361571393907,
-0.00983927957713604,
-0.007332879584282637,
0.006656265817582607,
0.0003450130461715162,
0.013062973506748676,
-0.014721836894750595,
-0.00004924854511045851,
0.003601808100938797,
0.01843070797622204,
-0.006106499116867781,
-0.010802211239933968,
-0.005386893171817064,
0.0005598171264864504,
0.00022511181305162609,
0.006379498168826103,
0.012041373178362846,
-0.00014996060053817928,
0.007896930910646915,
-0.0026580875273793936,
-0.022585365921258926,
0.005008697509765625,
-0.0035466179251670837,
-0.006031137425452471,
0.0042816768400371075,
0.005305025260895491,
0.0069965156726539135,
-0.001398809952661395,
-0.0002569934295024723,
-0.0015051990048959851,
0.006835925858467817,
0.002879972569644451,
0.007500584702938795,
-0.0010312972590327263,
0.004495189059525728,
-0.011031506583094597,
0.004862909205257893,
-0.010940812528133392,
-0.00035226752515882254,
0.002996881725266576,
-0.003721106331795454,
0.013143714517354965,
0.0017050893511623144,
-0.0005513799842447042,
-0.0001722433080431074,
-0.008500313386321068,
-0.002747969003394246,
0.002687891246750951,
0.0015827850438654423,
-0.008862410672008991,
0.0035749657545238733,
0.0029084801208227873,
0.0065537202171981335,
0.0037559582851827145,
-0.009209830313920975,
0.0068980189971625805,
0.004742575343698263,
-0.0020774940494447947,
0.0018531202804297209,
-0.00636719074100256,
0.0050776987336575985,
0.002539613051339984,
-0.004677425604313612,
-0.004567490890622139,
0.0004222677671350539,
-0.005116051062941551,
-0.005944508593529463,
0.007423582021147013,
-0.007378373295068741,
-0.011012990027666092,
-0.004655755590647459,
-0.012228789739310741,
0.0006404716987162828
] |
8a78745915eb3a4aaf90865a024b4d8bafd46ca7 | 5,151 | py | Python | research/gnn/sgcn/postprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 1 | 2021-11-18T08:17:44.000Z | 2021-11-18T08:17:44.000Z | research/gnn/sgcn/postprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | null | null | null | research/gnn/sgcn/postprocess.py | leelige/mindspore | 5199e05ba3888963473f2b07da3f7bca5b9ef6dc | [
"Apache-2.0"
] | 2 | 2019-09-01T06:17:04.000Z | 2019-10-04T08:39:45.000Z | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""
postprocess.
"""
import os
import argparse
import numpy as np
from src.ms_utils import calculate_auc
from mindspore import context, load_checkpoint
def softmax(x):
t_max = np.max(x, axis=1, keepdims=True) # returns max of each row and keeps same dims
e_x = np.exp(x - t_max) # subtracts each row with its max value
t_sum = np.sum(e_x, axis=1, keepdims=True) # returns sum of each row and keeps same dims
f_x = e_x / t_sum
return f_x
def score_model(preds, test_pos, test_neg, weight, bias):
"""
Score the model on the test set edges in each epoch.
Args:
epoch (LongTensor): Training epochs.
Returns:
auc(Float32): AUC result.
f1(Float32): F1-Score result.
"""
score_positive_edges = np.array(test_pos, dtype=np.int32).T
score_negative_edges = np.array(test_neg, dtype=np.int32).T
test_positive_z = np.concatenate((preds[score_positive_edges[0, :], :],
preds[score_positive_edges[1, :], :]), axis=1)
test_negative_z = np.concatenate((preds[score_negative_edges[0, :], :],
preds[score_negative_edges[1, :], :]), axis=1)
# operands could not be broadcast together with shapes (4288,128) (128,3)
scores = np.dot(np.concatenate((test_positive_z, test_negative_z), axis=0), weight) + bias
probability_scores = np.exp(softmax(scores))
predictions = probability_scores[:, 0]/probability_scores[:, 0:2].sum(1)
# predictions = predictions.asnumpy()
targets = [0]*len(test_pos) + [1]*len(test_neg)
auc, f1 = calculate_auc(targets, predictions)
return auc, f1
def get_acc():
"""get infer Accuracy."""
parser = argparse.ArgumentParser(description='postprocess')
parser.add_argument('--dataset_name', type=str, default='bitcoin-otc', choices=['bitcoin-otc', 'bitcoin-alpha'],
help='dataset name')
parser.add_argument('--result_path', type=str, default='./ascend310_infer/input/', help='result Files')
parser.add_argument('--label_path', type=str, default='', help='y_test npy Files')
parser.add_argument('--mask_path', type=str, default='', help='test_mask npy Files')
parser.add_argument("--checkpoint_file", type=str, default='sgcn_alpha_f1.ckpt', help="Checkpoint file path.")
parser.add_argument("--edge_path", nargs="?",
default="./input/bitcoin_alpha.csv", help="Edge list csv.")
parser.add_argument("--features-path", nargs="?",
default="./input/bitcoin_alpha.csv", help="Edge list csv.")
parser.add_argument("--test-size", type=float,
default=0.2, help="Test dataset size. Default is 0.2.")
parser.add_argument("--seed", type=int, default=42,
help="Random seed for sklearn pre-training. Default is 42.")
parser.add_argument("--spectral-features", default=True, dest="spectral_features", action="store_true")
parser.add_argument("--reduction-iterations", type=int,
default=30, help="Number of SVD iterations. Default is 30.")
parser.add_argument("--reduction-dimensions", type=int,
default=64, help="Number of SVD feature extraction dimensions. Default is 64.")
args_opt = parser.parse_args()
# Runtime
context.set_context(mode=context.GRAPH_MODE, device_target='Ascend', device_id=0)
# Create network
test_pos = np.load(os.path.join(args_opt.result_path, 'pos_test.npy'))
test_neg = np.load(os.path.join(args_opt.result_path, 'neg_test.npy'))
# Load parameters from checkpoint into network
param_dict = load_checkpoint(args_opt.checkpoint_file)
print(type(param_dict))
print(param_dict)
print(type(param_dict['regression_weights']))
print(param_dict['regression_weights'])
# load_param_into_net(net, param_dict)
pred = np.fromfile('./result_Files/repos_0.bin', np.float32)
if args_opt.dataset_name == 'bitcoin-otc':
pred = pred.reshape(5881, 64)
else:
pred = pred.reshape(3783, 64)
auc, f1 = score_model(pred, test_pos, test_neg, param_dict['regression_weights'].asnumpy(),
param_dict['regression_bias'].asnumpy())
print("Test set results:", "auc=", "{:.5f}".format(auc), "f1=", "{:.5f}".format(f1))
if __name__ == '__main__':
get_acc()
| 48.140187 | 117 | 0.644729 | 1 | 2.0151 | [
-0.033519744873046875,
0.00010371868120273575,
0.028857968747615814,
-0.036108218133449554,
-0.016317501664161682,
0.028160221874713898,
0.03192444145679474,
-0.00823644082993269,
0.016261164098978043,
0.024505944922566414,
0.002808625577017665,
0.009122607298195362,
0.05361486226320267,
0.013846080750226974,
-0.010148963890969753,
-0.011618691496551037,
0.0853792354464531,
-0.07069194316864014,
0.004377963952720165,
0.007552645169198513,
0.028137844055891037,
0.016297059133648872,
0.004057863727211952,
0.02219606749713421,
0.012989326380193233,
-0.000668926804792136,
0.06265024095773697,
0.031073547899723053,
-0.002892975462600589,
-0.0248655304312706,
-0.012054305523633957,
-0.035905566066503525,
-0.009840947575867176,
0.011460261419415474,
0.0012951212702319026,
0.01130607444792986,
-0.004013181198388338,
-0.056699205189943314,
0.034163493663072586,
-0.03416772931814194,
-0.02071331813931465,
0.006671799812465906,
-0.045306600630283356,
0.04068668931722641,
0.04933309182524681,
0.007315072696655989,
-0.01945161260664463,
-0.006878734100610018,
0.002168532693758607,
0.009614205919206142,
0.038879234343767166,
0.023970169946551323,
-0.013302898034453392,
-0.02861691825091839,
0.01451742835342884,
-0.01771073043346405,
0.017809754237532616,
0.01187766995280981,
-0.010922687128186226,
-0.006246133707463741,
0.006630280055105686,
0.03127915784716606,
-0.00836795475333929,
-0.013898981735110283,
0.03669112175703049,
0.0003889810177497566,
-0.0019287505419924855,
0.022326067090034485,
-0.031853631138801575,
-0.024048974737524986,
-0.031923603266477585,
0.0046288976445794106,
-0.009815012104809284,
0.019306153059005737,
0.006676725577563047,
-0.014826007187366486,
-0.028612732887268066,
-0.020040074363350868,
-0.013545728288590908,
0.004423144273459911,
0.007375452201813459,
0.05172009393572807,
0.04185279458761215,
-0.008890978060662746,
-0.005016532260924578,
0.019128471612930298,
0.05949659273028374,
-0.06830122321844101,
0.049731116741895676,
0.011467896401882172,
0.0022864278871566057,
0.034451473504304886,
-0.030552079901099205,
-0.008863779716193676,
-0.020769890397787094,
-0.022809110581874847,
0.03824952244758606,
0.039061374962329865,
-0.04791918024420738,
0.0320669524371624,
0.026866184547543526,
-0.004009601194411516,
0.022620974108576775,
-0.0006540476460941136,
-0.0067868707701563835,
0.03680380433797836,
-0.030121462419629097,
0.012726637534797192,
0.02648467943072319,
0.006566517520695925,
-0.017974738031625748,
0.006803550291806459,
0.0028529581613838673,
0.015848418697714806,
-0.003654740285128355,
0.005816510878503323,
-0.0010560430819168687,
-0.029014723375439644,
0.03585316240787506,
-0.0488121435046196,
-0.02790876291692257,
0.008715612813830376,
0.023282421752810478,
-0.02633601613342762,
-0.03504539653658867,
0.05649039149284363,
-0.008370312862098217,
0.03590748831629753,
0.037445489317178726,
0.0041274018585681915,
-0.024512415751814842,
0.006854974664747715,
-0.009338201023638248,
-0.024047721177339554,
-0.007822686806321144,
-0.0020304603967815638,
0.012697703205049038,
0.04509030655026436,
-0.010390502400696278,
0.00034093382419086993,
-0.01858511008322239,
-0.011061331257224083,
0.0099641727283597,
0.013674301095306873,
-0.009933771565556526,
0.011781873181462288,
0.0003509607049636543,
-0.01944275200366974,
-0.022674432024359703,
0.005868894979357719,
0.007887221872806549,
0.0023333870340138674,
0.012560565955936909,
0.03276348486542702,
-0.022748487070202827,
-0.036758918315172195,
0.0004758330178447068,
-0.027042681351304054,
-0.025421809405088425,
-0.03365430235862732,
-0.037293288856744766,
0.006658283993601799,
-0.00264655239880085,
0.017332255840301514,
0.016819115728139877,
0.05443652719259262,
-0.0037734827492386103,
0.013166463002562523,
-0.04051387682557106,
-0.04624876752495766,
-0.014503982849419117,
0.011945897713303566,
-0.024703441187739372,
0.001376767293550074,
-0.023568620905280113,
-0.03024146892130375,
-0.003859488293528557,
0.01753988116979599,
-0.022848956286907196,
-0.04258779063820839,
-0.014378353022038937,
-0.03152753412723541,
0.026764215901494026,
-0.0003101991314906627,
-0.024106528609991074,
-0.0034020505845546722,
-0.027052825316786766,
-0.024764051660895348,
0.022900816053152084,
-0.0334928035736084,
-0.006636481732130051,
0.029517395421862602,
-0.01219321507960558,
-0.02270481362938881,
0.01540703047066927,
-0.00578651949763298,
0.008325634524226189,
-0.008594663813710213,
0.006199204362928867,
-0.008040349930524826,
0.0018846401944756508,
-0.03145687282085419,
0.03611178323626518,
0.060542963445186615,
-0.02002144791185856,
0.029404670000076294,
-0.7383045554161072,
-0.0029131765477359295,
0.07529503107070923,
-0.015443648211658001,
-0.003651744220405817,
0.0038388269022107124,
0.02010095864534378,
0.013711731880903244,
-0.023339325562119484,
0.021309860050678253,
-0.0194550808519125,
0.009766465984284878,
-0.016037967056035995,
0.02039485052227974,
-0.02900284342467785,
-0.021240081638097763,
-0.026799654588103294,
-0.013856512494385242,
0.008397146128118038,
0.0034698175732046366,
-0.00560377212241292,
0.0035376709420233965,
-0.027275700122117996,
-0.0005980193382129073,
0.007691932842135429,
-0.010516301728785038,
0.003901219693943858,
0.009106718003749847,
0.005776006728410721,
0.003508456749841571,
0.012469657696783543,
0.013841846026480198,
0.021786697208881378,
-0.019594956189393997,
0.002380902646109462,
0.01887216977775097,
0.01849052496254444,
0.006947956047952175,
-0.029922842979431152,
0.01658882573246956,
0.015346222557127476,
0.01377323642373085,
-0.02682352438569069,
-0.04340409114956856,
-0.0020887635182589293,
-0.022125298157334328,
-0.05226108431816101,
-0.006563876755535603,
-0.008884341455996037,
0.007487170863896608,
0.008397615514695644,
0.008087200112640858,
0.012858517467975616,
-0.004690127447247505,
0.0032670022919774055,
0.008299448527395725,
-0.024968981742858887,
0.000213554099900648,
0.0297179464250803,
-0.004487421829253435,
0.013314281590282917,
0.01616833172738552,
-0.007370334584265947,
0.0248153917491436,
-0.012709079310297966,
-0.0036608665250241756,
0.04720413312315941,
-0.004858025349676609,
-0.020052453503012657,
0.013105685822665691,
-0.01726609654724598,
0.010516952723264694,
0.012631998397409916,
0.06608761101961136,
0.0005466235452331603,
0.01760895736515522,
0.0005087907775305212,
0.01309039443731308,
-0.038978900760412216,
-0.04908614978194237,
-0.04911606013774872,
-0.0318143293261528,
-0.004700670950114727,
-0.0038405905943363905,
0.010801495052874088,
0.023598408326506615,
-0.008309907279908657,
0.024250784888863564,
-0.004626956768333912,
-0.003667108016088605,
0.03381023928523064,
-0.04018215835094452,
0.005835389718413353,
-0.005681832320988178,
-0.02319592423737049,
0.018762053921818733,
-0.01738090068101883,
0.02829543687403202,
0.002162298886105418,
0.07127495110034943,
-0.03138995170593262,
0.026638396084308624,
0.016762329265475273,
0.02651732787489891,
-0.030751097947359085,
-0.040922295302152634,
-0.010376484133303165,
-0.03667323291301727,
0.01487073116004467,
-0.04105546697974205,
0.02300271764397621,
-0.021813690662384033,
-0.006174770649522543,
0.018109429627656937,
0.01474935282021761,
0.0009355177171528339,
-0.010972253046929836,
-0.031069885939359665,
0.009963267482817173,
-0.0055600679479539394,
0.01978948339819908,
0.018742673099040985,
0.06312111020088196,
0.008890212513506413,
-0.012308388017117977,
0.02603675052523613,
0.010178739205002785,
0.011006537824869156,
0.014977086335420609,
0.008490156382322311,
-0.03417947515845299,
-0.013641036115586758,
0.030088460072875023,
0.01825643517076969,
-0.0427045039832592,
0.03357888385653496,
-0.0360872782766819,
-0.037371180951595306,
-0.009015667252242565,
-0.019651802256703377,
-0.010101024992763996,
0.0068980189971625805,
-0.001109275035560131,
-0.03737003728747368,
0.021082021296024323,
-0.007874700240790844,
-0.00004905307287117466,
0.00006880874570924789,
0.06275230646133423,
-0.016394732519984245,
-0.008100613951683044,
0.011433313600718975,
0.027105843648314476,
-0.007765444926917553,
-0.052899159491062164,
0.029562463983893394,
0.016549982130527496,
-0.010644093155860901,
0.020076293498277664,
-0.014343582093715668,
-0.02610141970217228,
-0.02031930536031723,
0.026399321854114532,
0.021344704553484917,
-0.03737739846110344,
0.0015414654044434428,
-0.012187458574771881,
-0.01863369531929493,
-0.01880352571606636,
0.019231392070651054,
0.040220774710178375,
-0.037138666957616806,
0.027077585458755493,
0.003070719540119171,
0.03961563482880592,
-0.013581085950136185,
-0.015426166355609894,
-0.04758143052458763,
0.009636247530579567,
-0.008602328598499298,
-0.009216714650392532,
-0.007683384697884321,
-0.03926658257842064,
-0.002217593602836132,
0.02050652913749218,
0.019672473892569542,
-0.0018199719488620758,
-0.001855481998063624,
-0.0077921124175190926,
0.008482047356665134,
0.01943054609000683,
0.03056630864739418,
-0.010532828979194164,
0.019803378731012344,
0.010900846682488918,
-0.010686966590583324,
-0.00917884148657322,
-0.025892870500683784,
0.033908661454916,
-0.039797887206077576,
0.007017532829195261,
0.008763941936194897,
-0.020108936354517937,
-0.013676265254616737,
-0.006207379046827555,
-0.0356605090200901,
-0.0018428729381412268,
-0.013055814430117607,
-0.03135114163160324,
-0.02927086316049099,
-0.016959823668003082,
0.01303135883063078,
-0.0069539351388812065,
0.03452988341450691,
-0.03280087560415268,
-0.014507182873785496,
0.003580020507797599,
0.010356415063142776,
-0.0006291194586083293,
-0.029623528942465782,
-0.051417019218206406,
-0.045768510550260544,
-0.014479698613286018,
0.003615941619500518,
-0.010621028020977974,
-0.03298696503043175,
0.028064588084816933,
0.006679782643914223,
-0.024637706577777863,
-0.04199545085430145,
0.024426551535725594,
-0.0050492677837610245,
-0.016566138714551926,
0.006976487580686808,
0.00768996262922883,
0.019021954387426376,
-0.02351176179945469,
-0.031388215720653534,
-0.010904685594141483,
-0.024638962000608444,
0.010958502069115639,
-0.016879364848136902,
0.035478100180625916,
0.01312529668211937,
-0.003371270839124918,
0.006364093162119389,
0.013864596374332905,
-0.010998746380209923,
-0.03703554719686508,
-0.003987331874668598,
-0.021379239857196808,
0.020935487002134323,
0.013118519447743893,
-0.038458243012428284,
0.022581636905670166,
0.04485853388905525,
-0.02223859168589115,
0.01516226027160883,
0.024210024625062943,
0.007161241956055164,
-0.009298271499574184,
-0.014465617015957832,
-0.022788062691688538,
-0.013840261846780777,
-0.021287700161337852,
-0.006469860672950745,
-0.0027849082835018635,
0.011579343117773533,
-0.03426753357052803,
0.03235246241092682,
-0.014838744886219501,
0.012169180437922478,
-0.029322221875190735,
0.0008987096953205764,
0.0021174438297748566,
0.004212060943245888,
-0.001563354511745274,
-0.025399042293429375,
0.02416081167757511,
-0.01717241480946541,
-0.02862640470266342,
-0.035095009952783585,
-0.04648361727595329,
0.022836964577436447,
0.0038895076140761375,
0.013452489860355854,
0.010446351021528244,
0.005878893192857504,
-0.021368613466620445,
-0.01074674166738987,
0.0025987608823925257,
-0.041081156581640244,
0.0050734467804431915,
0.01830151490867138,
-0.021976346150040627,
0.035861946642398834,
0.0011786561226472259,
-0.01824326440691948,
0.010927950963377953,
0.002861861139535904,
0.019985411316156387,
-0.02406924031674862,
-0.02785722352564335,
0.015923626720905304,
0.024448148906230927,
0.022069739177823067,
0.01226129848510027,
-0.0041096690110862255,
0.01955561339855194,
-0.022375043481588364,
0.006494617089629173,
0.040162406861782074,
0.020625896751880646,
0.0022591331508010626,
-0.0008331892313435674,
-0.00211908551864326,
0.03909134492278099,
0.0067930337972939014,
0.0019978859927505255,
-0.013515887781977654,
0.034555938094854355,
0.045333415269851685,
-0.04280206933617592,
0.0035494884941726923,
-0.003973688930273056,
0.021785002201795578,
-0.002355232136324048,
0.022588659077882767,
-0.058974385261535645,
-0.053558871150016785,
-0.008159710094332695,
0.015873005613684654,
0.013491112738847733,
0.022943340241909027,
0.007135963998734951,
0.015632163733243942,
-0.004220460541546345,
0.017122795805335045,
0.013690323568880558,
0.006424443796277046,
-0.03187034651637077,
0.044013939797878265,
-0.045372720807790756,
0.0029886348638683558,
0.025373797863721848,
-0.02090812288224697,
0.02896389178931713,
0.056631702929735184,
-0.026547033339738846,
0.004757254384458065,
0.02783232368528843,
-0.026496522128582,
0.01944100111722946,
-0.020301954820752144,
0.0010926340473815799,
-0.027444858103990555,
0.005503217224031687,
-0.006524496246129274,
0.0019904423970729113,
0.007772478740662336,
0.011465509422123432,
-0.024313289672136307,
-0.0023048596922308207,
-0.011313197202980518,
0.009410375729203224,
-0.018071373924613,
0.04408060759305954,
0.0031851434614509344,
0.010367258451879025,
0.04218398779630661,
-0.017197605222463608,
0.000200239650439471,
-0.03246547281742096,
-0.023678483441472054,
0.0019998878706246614,
0.0020037381909787655,
0.0535416342318058,
0.04234183952212334,
-0.0003979732282459736,
-0.02718690037727356,
-0.030186772346496582,
-0.012619396671652794,
0.020919350907206535,
-0.04184373468160629,
0.0075349328108131886,
-0.04115666449069977,
-0.006000424735248089,
-0.011102969758212566,
-0.0018850717460736632,
-0.019556572660803795,
0.000017140027921414003,
-0.01186198741197586,
0.020628763362765312,
0.017754139378666878,
0.02648775279521942,
-0.011339385062456131,
-0.006506071891635656,
0.023173324763774872,
-0.014766383916139603,
0.021052328869700432,
0.02202909253537655,
-0.07492514699697495,
-0.009049353189766407,
-0.027343902736902237,
0.011204651556909084,
0.014914030209183693,
0.009370885789394379,
0.005046091973781586,
0.004838172812014818,
0.003406291827559471,
0.05296071618795395,
-0.010817191563546658,
0.027442490682005882,
-0.009095854125916958,
-0.008532057516276836,
0.016888119280338287,
-0.038482990115880966,
-0.047773245722055435,
0.01031645480543375,
0.05313418433070183,
-0.022888775914907455,
-0.028891578316688538,
-0.05198625847697258,
0.009050233289599419,
-0.03399943932890892,
-0.004270817153155804,
0.0426916778087616,
-0.015268117189407349,
-0.03471701964735985,
0.004879262298345566,
0.005039469804614782,
-0.01682775653898716,
0.000276643258985132,
0.038709525018930435,
-0.005272708833217621,
0.002257569460198283,
-0.010768730193376541,
0.006685495376586914,
-0.0030716070905327797,
0.01623234525322914,
-0.0030080904252827168,
0.015072925947606564,
0.006193074863404036,
0.016514752060174942,
-0.002397525357082486,
-0.021508624777197838,
0.019687624648213387,
0.03556423261761665,
0.0006179132033139467,
-0.023985859006643295,
-0.04126143455505371,
0.010492323897778988,
0.010431645438075066,
0.023337457329034805,
0.0025321037974208593,
-0.03092576004564762,
-0.003640376031398773,
0.014084581285715103,
0.01541141513735056,
-0.009215840138494968,
-0.02664722315967083,
-0.0051017459481954575,
0.003261711448431015,
0.016154475510120392,
-0.00836891494691372,
-0.014394729398190975,
0.00883040763437748,
-0.0007778730359859765,
-0.046532053500413895,
-0.002259474014863372,
0.05636022984981537,
0.01136457547545433,
-0.023390451446175575,
0.03268333524465561,
0.0017179712885990739,
0.0010465842206031084,
0.004675281699746847,
0.0011813899036496878,
0.0033062752336263657,
0.030790407210588455,
-0.0236992035061121,
-0.021638289093971252,
-0.00490456260740757,
0.009053363464772701,
0.034275978803634644,
0.04444819316267967,
0.0029611678328365088,
0.021204140037298203,
-0.016003834083676338,
-0.005888062529265881,
0.03500279784202576,
0.018274053931236267,
-0.01813257299363613,
0.014455815777182579,
0.043100543320178986,
-0.017341721802949905,
0.011590839363634586,
-0.001359997782856226,
0.03465939685702324,
-0.026121053844690323,
0.043845534324645996,
-0.006187485530972481,
0.04262043908238411,
0.01830313540995121,
0.0400715135037899,
0.017873186618089676,
0.06952549517154694,
0.03811256214976311,
-0.047386303544044495,
0.007731728721410036,
-0.020419418811798096,
-0.006502814125269651,
-0.016638299450278282,
-0.023014595732092857,
0.018180346116423607,
-0.0014043573755770922,
0.026279017329216003,
-0.05612753704190254,
0.00988091342151165,
-0.012451797723770142,
0.009497124701738358,
0.030585646629333496,
0.01145758293569088,
-0.047937944531440735,
-0.030229561030864716,
-0.043232664465904236,
-0.026140768080949783,
-0.03566933795809746,
-0.00803633313626051,
0.01103164628148079,
-0.005757358390837908,
0.006194017361849546,
-0.008215038105845451,
-0.005791062023490667,
0.010344913229346275,
-0.016428764909505844,
0.0563812218606472,
0.016115238890051842,
-0.018499968573451042,
0.0075112609192729,
0.011586743406951427,
0.007966245524585247,
0.017997248098254204,
0.011628380045294762,
-0.002752801636233926,
-0.0033044826705008745,
0.009435213170945644,
-0.05655848979949951,
0.0003672346065286547,
0.0009100730530917645,
-0.005523629952222109,
-0.006763861980289221,
0.0035889327991753817,
-0.0185992494225502,
-0.039304669946432114,
-0.02925940416753292,
-0.0013686452293768525,
0.0042043207213282585,
0.021326009184122086,
0.0019609357696026564,
-0.022142769768834114,
-0.024481309577822685
] |
8a78d7cdf72b62f6c5c9341d633e72ed6d4ea01c | 4,001 | py | Python | pykeops/common/get_options.py | dvolgyes/keops | 58b2c5f7822a7468a6da2ce439939e7dad04d7f3 | [
"MIT"
] | 1 | 2020-09-29T13:21:30.000Z | 2020-09-29T13:21:30.000Z | pykeops/common/get_options.py | dvolgyes/keops | 58b2c5f7822a7468a6da2ce439939e7dad04d7f3 | [
"MIT"
] | null | null | null | pykeops/common/get_options.py | dvolgyes/keops | 58b2c5f7822a7468a6da2ce439939e7dad04d7f3 | [
"MIT"
] | null | null | null | import re
import numpy as np
from collections import OrderedDict
import pykeops
import pykeops.config
############################################################
# define backend
############################################################
class SetBackend():
"""
This class is used to centralized the options used in PyKeops.
"""
dev = OrderedDict([('CPU',0),('GPU',1)])
grid = OrderedDict([('1D',0),('2D',1)])
memtype = OrderedDict([('host',0), ('device',1)])
possible_options_list = ['auto',
'CPU',
'GPU',
'GPU_1D', 'GPU_1D_device', 'GPU_1D_host',
'GPU_2D', 'GPU_2D_device', 'GPU_2D_host'
]
def define_tag_backend(self, backend, variables):
"""
Try to make a good guess for the backend... available methods are: (host means Cpu, device means Gpu)
CPU : computations performed with the host from host arrays
GPU_1D_device : computations performed on the device from device arrays, using the 1D scheme
GPU_2D_device : computations performed on the device from device arrays, using the 2D scheme
GPU_1D_host : computations performed on the device from host arrays, using the 1D scheme
GPU_2D_host : computations performed on the device from host data, using the 2D scheme
:param backend (str), variables (tuple)
:return (tagCPUGPU, tag1D2D, tagHostDevice)
"""
# check that the option is valid
if (backend not in self.possible_options_list):
raise ValueError('Invalid backend. Should be one of ', self.possible_options_list)
# auto : infer everything
if backend == 'auto':
return int(pykeops.config.gpu_available), self._find_grid(), self._find_mem(variables)
split_backend = re.split('_',backend)
if len(split_backend) == 1: # CPU or GPU
return self.dev[split_backend[0]], self._find_grid(), self._find_mem(variables)
elif len(split_backend) == 2: # GPU_1D or GPU_2D
return self.dev[split_backend[0]], self.grid[split_backend[1]], self._find_mem(variables)
elif len(split_backend) == 3: # the option is known
return self.dev[split_backend[0]], self.grid[split_backend[1]], self.memtype[split_backend[2]]
def define_backend(self, backend, variables):
tagCPUGPU, tag1D2D, tagHostDevice = self.define_tag_backend(backend, variables)
return self.dev[tagCPUGPU], self.grid[tag1D2D], self.memtype[tagHostDevice]
@staticmethod
def _find_dev():
return int(pykeops.config.gpu_available)
@staticmethod
def _find_mem(variables):
if all([type(var) is np.ndarray for var in variables ]): # Infer if we're working with numpy arrays or torch tensors:
MemType = 0
elif pykeops.config.torch_found:
import torch
if all([type(var) in [torch.Tensor, torch.nn.parameter.Parameter] for var in variables]):
from pykeops.torch.utils import is_on_device
VarsAreOnGpu = tuple(map(is_on_device, tuple(variables)))
if all(VarsAreOnGpu):
MemType = 1
elif not any(VarsAreOnGpu):
MemType = 0
else:
raise ValueError('At least two input variables have different memory locations (Cpu/Gpu).')
else:
raise TypeError('All variables should either be numpy arrays or torch tensors.')
return MemType
@staticmethod
def _find_grid():
return 0
def get_tag_backend(backend, variables, str = False):
"""
entry point to get the correct backend
"""
res = SetBackend()
if not str:
return res.define_tag_backend(backend, variables)
else:
return res.define_backend(backend, variables)
| 38.84466 | 125 | 0.59935 | 1 | 1.9776 | [
0.0015684517566114664,
0.02499283105134964,
0.007230645976960659,
-0.00039929462946020067,
0.005049240309745073,
-0.0030902980361133814,
-0.010238025337457657,
0.004450823646038771,
-0.0072305332869291306,
0.002915412187576294,
0.003011060180142522,
0.004406583495438099,
0.008609234355390072,
-0.01678639091551304,
-0.00031449130619876087,
0.01908724196255207,
-0.052440304309129715,
0.0037213617470115423,
-0.004040509928017855,
0.002044669119641185,
-0.008323435671627522,
0.009132180362939835,
0.009128979407250881,
0.009826055727899075,
0.00561912264674902,
-0.001111303805373609,
0.009631866589188576,
0.002054079668596387,
-0.0076597766019403934,
-0.005581417120993137,
-0.0003608909610193223,
-0.0018553542904555798,
-0.006322737317532301,
-0.008030807599425316,
0.007442621514201164,
-0.003428383730351925,
0.000011017255019396544,
-0.01801660843193531,
0.011512245051562786,
-0.0050163730047643185,
-0.007067966274917126,
-0.0160105898976326,
-0.002452199812978506,
0.0044695427641272545,
-0.010449456050992012,
0.002174853114411235,
-0.0032694817055016756,
0.00175198120996356,
-0.01018853485584259,
0.005944564938545227,
-0.007958751171827316,
0.006444165017455816,
0.012670258060097694,
0.0037015455309301615,
-0.006792934611439705,
-0.007948585785925388,
0.01235763356089592,
0.0006330496980808675,
-0.011409970000386238,
0.0001725501788314432,
-0.0018064971081912518,
-0.0028382446616888046,
0.004823509603738785,
0.0025898325257003307,
-0.016625255346298218,
-0.007372479885816574,
-0.005079823546111584,
0.002476284746080637,
-0.00022365018958225846,
0.005975958425551653,
0.0006721040117554367,
-0.0016672597266733646,
0.009019981138408184,
0.004502998664975166,
0.0048774369060993195,
-0.0042838542722165585,
-0.0014924469869583845,
0.002058908808976412,
0.008369791321456432,
0.003965387120842934,
0.002598424442112446,
-0.00698815006762743,
0.005732424091547728,
0.011377367191016674,
0.01594441942870617,
0.0066254339180886745,
0.019666532054543495,
-0.011868980713188648,
0.04531216248869896,
0.006734087131917477,
-0.00931247416883707,
0.0013546169502660632,
-0.009144389070570469,
-0.0018848672043532133,
-0.0018805491272360086,
-0.02762744389474392,
0.0017110584303736687,
-0.004595640581101179,
-0.000702978519257158,
0.0034482604824006557,
-0.00031869683880358934,
0.006424400024116039,
-0.0012264230754226446,
-0.0015947794308885932,
-0.009313457645475864,
0.011059349402785301,
-0.010435241274535656,
-0.0029589480254799128,
0.007018712814897299,
0.0032410554122179747,
-0.01020789984613657,
-0.0015110740205273032,
0.0019159337971359491,
-0.014020347967743874,
0.0014379506465047598,
0.002154287416487932,
-0.005035806447267532,
0.055701229721307755,
-0.0025575077161192894,
0.0038258687127381563,
-0.005703303497284651,
0.0005634880508296192,
0.0009742855909280479,
0.00550606194883585,
0.01021252479404211,
-0.004395603202283382,
0.010581804439425468,
0.006139017175883055,
0.003858885494992137,
0.007939275354146957,
-0.0029780270997434855,
0.007167251780629158,
-0.005190056748688221,
-0.0018917340785264969,
-0.00021404422295745462,
-0.007302833721041679,
0.006021665409207344,
-0.003038040129467845,
-0.0063773212023079395,
0.002662032376974821,
0.0003302880213595927,
-0.01180415228009224,
0.0017945155268535018,
-0.00425800820812583,
0.003604376455768943,
-0.01161983609199524,
-0.0040895952843129635,
-0.0011504525318741798,
-0.004450817126780748,
0.0026772303972393274,
0.009932998567819595,
0.0039459276013076305,
0.0027046138420701027,
-0.003978160209953785,
-0.01001009065657854,
-0.0004013055586256087,
-0.0057978504337370396,
0.001652160077355802,
0.006559018045663834,
0.0032690437510609627,
-0.010358672589063644,
-0.0012760777026414871,
0.003187173279002309,
0.004014598671346903,
-0.0014591816579923034,
0.0019599348306655884,
-0.008779997937381268,
0.007720197085291147,
-0.000258788641076535,
0.0032492284663021564,
0.01148858480155468,
-0.005768716800957918,
-0.001071918522939086,
0.0012050671502947807,
0.002591157564893365,
-0.0002936823293566704,
0.005425687413662672,
0.009435289539396763,
-0.0028642022516578436,
-0.004160675220191479,
0.005864367820322514,
0.004267062526196241,
0.007953480817377567,
0.00537103833630681,
-0.0024573085829615593,
0.0030758182983845472,
-0.0064767878502607346,
-0.0005379125359468162,
0.006141273770481348,
-0.005054572131484747,
0.006989191751927137,
0.0037057159934192896,
-0.01405330654233694,
-0.007255151402205229,
-0.0010160674573853612,
-0.007374793756753206,
0.000549006974324584,
0.014639117754995823,
0.010697302408516407,
-0.002292912220582366,
0.0038055679760873318,
-0.010688412934541702,
0.0008137932163663208,
0.005998318083584309,
0.0012260820949450135,
-0.012516409158706665,
-0.9570227265357971,
0.006189248058944941,
0.004030554089695215,
-0.0017347640823572874,
0.0059100305661559105,
0.0020473867189139128,
0.0038215185049921274,
0.004297490231692791,
0.01357613317668438,
-0.008623594418168068,
-0.006349814124405384,
-0.010288828052580357,
-0.012553839012980461,
-0.0025840522721409798,
-0.0063541424460709095,
-0.0024694327730685472,
-0.004899793304502964,
-0.006504364311695099,
-0.0025005480274558067,
-0.0034020044840872288,
-0.001464471803046763,
0.011238275095820427,
-0.0008587901829741895,
0.004927759524434805,
0.0029520911630243063,
0.004307412076741457,
-0.00518299313262105,
-0.001424518064595759,
-0.0009104566997848451,
-0.002596051199361682,
-0.006044902838766575,
-0.015617593191564083,
-0.00318247452378273,
-0.0003700718516483903,
0.008905632421374321,
0.0009984448552131653,
0.007614701520651579,
-0.0023389533162117004,
0.00045451876940205693,
-0.009816661477088928,
0.0034406292252242565,
0.0011867040302604437,
0.002209306927397847,
-0.02999814786016941,
0.0008123535662889481,
0.0007597308722324669,
-0.008202482014894485,
0.007740416564047337,
0.0025880280882120132,
-0.0015801084227859974,
-0.002797568216919899,
-0.006969321519136429,
0.009853163734078407,
-0.007230720017105341,
0.005568687804043293,
-0.003878888674080372,
-0.007109765894711018,
-0.0010684027802199125,
-0.007641474716365337,
0.0018306514248251915,
0.00477520702406764,
-0.0035895544569939375,
-0.0037406468763947487,
-0.006074762437492609,
0.002832296071574092,
0.0015571992844343185,
0.0025035685393959284,
-0.019916780292987823,
-0.008603650145232677,
-0.0009257771307602525,
0.003999850247055292,
-0.002627188339829445,
-0.005824842490255833,
0.005368981976062059,
-0.00861082598567009,
0.007965167053043842,
0.002215383108705282,
0.0004209336475469172,
-0.012315256521105766,
0.0011123658623546362,
-0.010281641967594624,
-0.006620439700782299,
0.0022849496454000473,
-0.0046701994724571705,
-0.006415056064724922,
0.0009901091689243913,
0.0014260229654610157,
0.007758252322673798,
-0.0029366635717451572,
0.0031733885407447815,
0.009790495969355106,
-0.002731672255322337,
-0.008841571398079395,
0.005570314824581146,
0.006371825933456421,
0.0030122653115540743,
-0.0024540736339986324,
0.000661729252897203,
0.006982979364693165,
0.00741070369258523,
0.0027139107696712017,
0.004986599087715149,
0.0015810182085260749,
0.009396914392709732,
-0.0017335773445665836,
0.0013005119981244206,
-0.002416134811937809,
-0.002614061813801527,
-0.004336521960794926,
-0.0020585129968822002,
-0.003996438346803188,
-0.002666713437065482,
-0.012023084796965122,
-0.009814570657908916,
-0.005094839259982109,
0.000039435421058442444,
0.001234545256011188,
-0.005716752260923386,
-0.0016080443747341633,
0.0019911136478185654,
0.008324160240590572,
-0.0017200615257024765,
-0.00435028038918972,
0.0003859934804495424,
0.003498423146083951,
-0.007012262940406799,
0.013668074272572994,
-0.013316085562109947,
0.007035722490400076,
-0.0002596312260720879,
-0.016943996772170067,
0.007317895535379648,
0.007562136743217707,
-0.009901948273181915,
0.003151541342958808,
0.0008450972381979227,
0.0014206365449354053,
-0.0014061982510611415,
-0.005759124178439379,
-0.0038655740208923817,
-0.016433661803603172,
-0.0005855035269632936,
0.022355999797582626,
0.002488647820428014,
0.01014177780598402,
0.012040392495691776,
-0.004092356655746698,
0.002352118492126465,
0.00453041959553957,
0.001759613398462534,
0.01475647371262312,
-0.008499407209455967,
-0.001165226916782558,
0.0006498732254840434,
-0.0040036276914179325,
0.0006212739972397685,
0.0066436296328902245,
0.0049906158819794655,
-0.0024313952308148146,
0.002637542551383376,
-0.006652715150266886,
-0.00698763458058238,
-0.015602058731019497,
-0.002291681943461299,
0.009231675416231155,
-0.006527331192046404,
0.004056923557072878,
-0.010938934981822968,
0.005803501233458519,
0.007691333536058664,
0.0033948607742786407,
0.0015092011308297515,
-0.00009933560795616359,
0.005848183762282133,
0.01169412862509489,
-0.00501141045242548,
0.0022106063552200794,
0.0051734065636992455,
-0.0004497258341871202,
0.0014440225204452872,
0.009393671527504921,
-0.008414565585553646,
-0.00544578954577446,
0.0013796337880194187,
0.002872166456654668,
0.0028588471468538046,
-0.0039415317587554455,
-0.00826191809028387,
-0.005334162153303623,
0.004370552953332663,
-0.005213029682636261,
0.002616099314764142,
0.0020625581964850426,
0.001755381585098803,
-0.008348939940333366,
-0.0028603258542716503,
-0.005345519166439772,
-0.012046542949974537,
0.010635913349688053,
-0.0017856466583907604,
0.0030290866270661354,
0.01457134634256363,
0.00688970135524869,
-0.014018620364367962,
0.006782664451748133,
0.009605227038264275,
-0.003340390743687749,
0.005733179859817028,
0.0058324639685451984,
-0.005455326288938522,
-0.021981528028845787,
-0.0027584400959312916,
-0.014270040206611156,
0.005039157811552286,
-0.0004368523368611932,
0.005530888680368662,
-0.008300683461129665,
0.005578533746302128,
0.007717113010585308,
-0.013736216351389885,
-0.006942286621779203,
-0.008680857717990875,
0.009724335744976997,
-0.0006133457063697278,
0.0000584655390412081,
-0.00363347795791924,
-0.0025500694755464792,
-0.0018803260754793882,
-0.002547117881476879,
-0.0023743489291518927,
0.004102169536054134,
0.0014641182497143745,
-0.0037939194589853287,
0.0019547652918845415,
-0.003065241500735283,
-0.00005607658385997638,
0.0020070835016667843,
-0.01096421293914318,
0.002355873351916671,
0.0062004197388887405,
-0.0035038581117987633,
-0.0016067364485934377,
0.000051460665417835116,
-0.0019579902291297913,
-0.006731827277690172,
-0.011854436248540878,
-0.004564523231238127,
-0.0064864251762628555,
-0.00355247943662107,
-0.010712722316384315,
-0.004026299808174372,
-0.010364186018705368,
0.008135869167745113,
-0.006595800165086985,
0.007838369347155094,
0.007389949634671211,
-0.004889593925327063,
0.005321159027516842,
-0.0024503099266439676,
0.003942461218684912,
0.0018295588670298457,
0.00482532475143671,
-0.0004036971658933908,
-0.00789665523916483,
-0.0087821576744318,
0.012979992665350437,
-0.010095278732478619,
0.0021371834445744753,
0.013910680077970028,
0.005899891722947359,
0.009322604164481163,
-0.0008385006804019213,
0.00016025220975279808,
0.0026518767699599266,
0.008117484860122204,
-0.013001353479921818,
0.0035636427346616983,
-0.003719225525856018,
-0.0013458237517625093,
0.0054704658687114716,
-0.003800277365371585,
0.0014082108391448855,
0.007714744657278061,
0.0023638829588890076,
-0.006190289743244648,
-0.001280275289900601,
0.001509358873590827,
0.004554550163447857,
-0.012162530794739723,
0.0006464791367761791,
-0.0025059636682271957,
-0.005183163098990917,
-0.002425829879939556,
-0.0018774797208607197,
0.0015115782152861357,
0.0042700693011283875,
-0.002298998646438122,
0.004632684402167797,
0.0019046791130676866,
-0.005647079553455114,
0.017103228718042374,
-0.0035017093177884817,
-0.006417245138436556,
0.002970194211229682,
0.0030491158831864595,
-0.003094532759860158,
-0.005893110763281584,
-0.0016581214731559157,
0.002315693534910679,
0.00622696615755558,
-0.0021811737678945065,
-0.004277065861970186,
-0.0017007641727104783,
0.0007861609919928014,
-0.011004767380654812,
0.0010631406912580132,
0.012224063277244568,
-0.0033124249894171953,
0.004576778970658779,
-0.0014326927484944463,
-0.007869744673371315,
-0.015146980062127113,
0.05639443174004555,
-0.0012628353433683515,
0.002520826179534197,
0.0043919021263718605,
-0.008476919494569302,
0.0006395653472281992,
-0.0005310035776346922,
0.007827365770936012,
-0.00590495252981782,
-0.007639408577233553,
0.010739783756434917,
-0.004398182034492493,
0.001816160511225462,
0.0042951954528689384,
-0.0006046775379218161,
0.015239420346915722,
-0.004212942440062761,
-0.01852324791252613,
-0.015866927802562714,
0.00828005000948906,
-0.0049148499965667725,
-0.006695028860121965,
0.009820730425417423,
-0.0027643621433526278,
-0.0027421351987868547,
0.0012325610732659698,
0.005867446307092905,
0.000058042969612870365,
0.0012423604493960738,
-0.003484544809907675,
-0.0012470517540350556,
0.0003807090688496828,
0.0022880451288074255,
0.005237970035523176,
0.008935009129345417,
-0.002472387393936515,
0.006322954315692186,
-0.0009538003359921277,
-0.002357203746214509,
-0.001512137008830905,
0.0044790394604206085,
0.007123637944459915,
-0.0011767528485506773,
-0.0027935276739299297,
0.0042762355878949165,
0.004353627096861601,
0.002918645739555359,
0.012130461633205414,
-0.00027155273710377514,
-0.005444674286991358,
0.008377783000469208,
0.006131050642579794,
-0.0010846193181350827,
0.011103407479822636,
-0.0023568524047732353,
0.0065898834727704525,
0.0018107651267200708,
-0.007428579032421112,
-0.01505062822252512,
-0.0011741520138457417,
0.00667964993044734,
0.007849919609725475,
-0.0021772580221295357,
0.0023109535686671734,
-0.002020697807893157,
-0.0029202892910689116,
-0.005574398674070835,
-0.010549825616180897,
-0.004113090690225363,
0.001816491479985416,
0.004017618019133806,
0.07125648856163025,
-0.0059809135273098946,
-0.002187492325901985,
-0.009490151889622211,
0.0003331087646074593,
-0.001081821508705616,
0.000726628175470978,
-0.0011251919204369187,
-0.0014963772846385837,
0.003051975043490529,
0.003196385456249118,
-0.00993254967033863,
-0.011872690171003342,
0.0011674539418891072,
0.000801556627266109,
-0.002028388436883688,
0.00390953803434968,
0.005582404788583517,
-0.008147763088345528,
0.002570411656051874,
-0.012195122428238392,
-0.0008853243198245764,
-0.0029601219575852156,
-0.010873803868889809,
-0.004810892511159182,
-0.004723494406789541,
0.0042060501873493195,
0.0024271083530038595,
0.005862590856850147,
-0.004462902899831533,
0.00556676322594285,
-0.002566993236541748,
0.0014917755033820868,
-0.0022835887502878904,
-0.0003033591201528907,
-0.0079837366938591,
0.007803563494235277,
0.001952245132997632,
-0.011804490350186825,
-0.005668120924383402,
-0.0012408926850184798,
0.0010034997249022126,
-0.00623914273455739,
0.005073606967926025,
-0.000733379099983722,
0.007943757809698582,
-0.0030876873061060905,
0.0007383955526165664,
-0.007251595612615347,
0.00466568861156702,
-0.011961014941334724,
0.007197631988674402,
-0.17699797451496124,
0.009769328869879246,
0.002660936675965786,
-0.00750144524499774,
-0.004686405882239342,
-0.014401503838598728,
-0.006728568580001593,
0.0031297041568905115,
0.009996247477829456,
0.0011759082553908229,
-0.00031993267475627363,
-0.0023454930633306503,
0.0056592258624732494,
0.0042769284918904305,
-0.0007159235537983477,
-0.0053609823808074,
0.004310572519898415,
-0.006681041792035103,
0.00027371535543352365,
0.00470357108861208,
0.003894725115969777,
0.009514854289591312,
0.002525066025555134,
-0.00011453360639279708,
-0.0010466714156791568,
-0.003562639467418194,
0.005399963818490505,
-0.0019495824817568064,
0.0065011377446353436,
-0.012116161175072193,
-0.004358282778412104,
-0.005663606803864241,
-0.004480171483010054,
0.004648278933018446,
0.005342833697795868,
0.0006695959018543363,
0.008402915671467781,
0.0027809315361082554,
-0.008346688002347946,
0.008042666129767895,
-0.006966345943510532,
0.02816156856715679,
0.005325838923454285,
0.005567512009292841,
0.0017222928581759334,
-0.004910567309707403,
-0.003785942681133747,
0.00961569044739008,
0.0033322179224342108,
0.012144830077886581,
-0.016132902354002,
-0.0025982146617025137,
0.0015737286303192377,
0.018740244209766388,
-0.0062322155572474,
-0.009657791815698147,
-0.005650314502418041,
-0.004884790629148483,
0.0023633067030459642,
0.010846893303096294,
0.010991470888257027,
-0.0029706961940973997,
0.006720896810293198,
-0.0012558773159980774,
-0.02345406264066696,
0.0014208696084097028,
-0.0042686364613473415,
-0.006310430355370045,
0.00018629191617947072,
0.0074004302732646465,
0.010663529857993126,
-0.0011426217388361692,
0.0025257524102926254,
0.0010177238145843148,
0.005389810539782047,
-0.0003673516330309212,
0.0056908312253654,
-0.0019131156150251627,
0.005527150817215443,
-0.008514237590134144,
0.009692259132862091,
-0.008878769353032112,
-0.0023769112303853035,
0.002300156746059656,
-0.0050968206487596035,
0.012897660955786705,
0.00439999857917428,
-0.0024601935874670744,
-0.001485760323703289,
-0.008822258561849594,
-0.0015031748916953802,
0.001223294180817902,
0.0017530065961182117,
-0.00854746624827385,
0.0014702886110171676,
0.0002398883952992037,
0.00522112101316452,
0.006692350376397371,
-0.008716324344277382,
0.006377349607646465,
0.006367882713675499,
-0.007695816457271576,
0.0018644568044692278,
-0.0034937297459691763,
0.003840911202132702,
0.005115776788443327,
-0.005599446129053831,
-0.005709298420697451,
0.0023732136469334364,
-0.0067921350710093975,
-0.006058875005692244,
0.005785391200333834,
-0.00957485381513834,
-0.009001650847494602,
-0.0015768856974318624,
-0.011410342529416084,
0.0006575962179340422
] |
8a78e9f69beda0a9b40161770e8196cc19774191 | 4,306 | py | Python | prepare_features_vc.py | tkm2261/dnn-voice-changer | 63a4ca0b2d8a33a26fc5aaec168180152df1b429 | [
"MIT"
] | 13 | 2018-03-09T07:56:50.000Z | 2022-03-26T12:23:22.000Z | prepare_features_vc.py | tkm2261/dnn-voice-changer | 63a4ca0b2d8a33a26fc5aaec168180152df1b429 | [
"MIT"
] | null | null | null | prepare_features_vc.py | tkm2261/dnn-voice-changer | 63a4ca0b2d8a33a26fc5aaec168180152df1b429 | [
"MIT"
] | 2 | 2018-06-16T03:44:56.000Z | 2021-04-06T17:32:38.000Z | """Prepare acoustic features for one-to-one voice conversion.
usage:
prepare_features_vc.py [options] <DATA_ROOT> <source_speaker> <target_speaker>
options:
--max_files=<N> Max num files to be collected. [default: 100]
--dst_dir=<d> Destination directory [default: data/cmu_arctic_vc].
--overwrite Overwrite files.
-h, --help show this help message and exit
"""
from __future__ import division, print_function, absolute_import
from docopt import docopt
import numpy as np
from nnmnkwii.datasets import FileSourceDataset
from nnmnkwii import preprocessing as P
from nnmnkwii.preprocessing.alignment import DTWAligner
from nnmnkwii.datasets import cmu_arctic, voice_statistics, vcc2016
import pysptk
import pyworld
from scipy.io import wavfile
from tqdm import tqdm
from os.path import basename, splitext, exists, expanduser, join, dirname
import os
import sys
from hparams import vc as hp
from hparams import hparams_debug_string
# vcc2016.WavFileDataSource and voice_statistics.WavFileDataSource can be
# drop-in replacement. See below for details:
# https://r9y9.github.io/nnmnkwii/latest/references/datasets.html#builtin-data-sources
class MGCSource(cmu_arctic.WavFileDataSource):
def __init__(self, data_root, speakers, max_files=None):
super(MGCSource, self).__init__(data_root, speakers,
max_files=max_files)
self.alpha = None
def collect_features(self, wav_path):
fs, x = wavfile.read(wav_path)
x = x.astype(np.float64)
f0, timeaxis = pyworld.dio(x, fs, frame_period=hp.frame_period)
f0 = pyworld.stonemask(x, f0, timeaxis, fs)
spectrogram = pyworld.cheaptrick(x, f0, timeaxis, fs)
spectrogram = P.trim_zeros_frames(spectrogram)
if self.alpha is None:
self.alpha = pysptk.util.mcepalpha(fs)
mgc = pysptk.sp2mc(spectrogram, order=hp.order, alpha=self.alpha)
# Drop 0-th coefficient
mgc = mgc[:, 1:]
# 50Hz cut-off MS smoothing
hop_length = int(fs * (hp.frame_period * 0.001))
modfs = fs / hop_length
mgc = P.modspec_smoothing(mgc, modfs, cutoff=50)
# Add delta
mgc = P.delta_features(mgc, hp.windows)
return mgc.astype(np.float32)
if __name__ == "__main__":
args = docopt(__doc__)
print("Command line args:\n", args)
DATA_ROOT = args["<DATA_ROOT>"]
source_speaker = args["<source_speaker>"]
target_speaker = args["<target_speaker>"]
max_files = int(args["--max_files"])
dst_dir = args["--dst_dir"]
overwrite = args["--overwrite"]
print(hparams_debug_string(hp))
X_dataset = FileSourceDataset(MGCSource(DATA_ROOT, [source_speaker],
max_files=max_files))
Y_dataset = FileSourceDataset(MGCSource(DATA_ROOT, [target_speaker],
max_files=max_files))
skip_feature_extraction = exists(join(dst_dir, "X")) \
and exists(join(dst_dir, "Y"))
if overwrite:
skip_feature_extraction = False
if skip_feature_extraction:
print("Features seems to be prepared, skipping feature extraction.")
sys.exit(0)
# Create dirs
for speaker, name in [(source_speaker, "X"), (target_speaker, "Y")]:
d = join(dst_dir, name)
print("Destination dir for {}: {}".format(speaker, d))
if not exists(d):
os.makedirs(d)
# Convert to arrays
print("Convert datasets to arrays")
X, Y = X_dataset.asarray(verbose=1), Y_dataset.asarray(verbose=1)
# Alignment
print("Perform alignment")
X, Y = DTWAligner().transform((X, Y))
print("Save features to disk")
for idx, (x, y) in tqdm(enumerate(zip(X, Y))):
# paths
src_name = splitext(basename(X_dataset.collected_files[idx][0]))[0]
tgt_name = splitext(basename(Y_dataset.collected_files[idx][0]))[0]
src_path = join(dst_dir, "X", src_name)
tgt_path = join(dst_dir, "Y", tgt_name)
# Trim and ajast frames
x = P.trim_zeros_frames(x)
y = P.trim_zeros_frames(y)
x, y = P.adjust_frame_lengths(x, y, pad=True, divisible_by=2)
# Save
np.save(src_path, x)
np.save(tgt_path, y)
| 35.883333 | 86 | 0.656061 | 1 | 2.1771 | [
-0.020911239087581635,
0.030512893572449684,
0.029157431796193123,
-0.00496179424226284,
0.01628909632563591,
-0.01187258679419756,
-0.02688940241932869,
-0.03407663851976395,
0.04754497855901718,
0.02107299491763115,
0.023916972801089287,
0.0268842875957489,
0.0287440437823534,
0.00008091850759228691,
-0.014562799595296383,
-0.002962957601994276,
0.07923200726509094,
-0.03297639638185501,
-0.015992993488907814,
0.003917255904525518,
-0.003888663835823536,
0.01527448557317257,
-0.0089095588773489,
0.003474489552900195,
0.018364794552326202,
0.01507609337568283,
0.018215319141745567,
-0.01652810350060463,
0.022971060127019882,
-0.015246386639773846,
0.00816428754478693,
0.028162939473986626,
-0.012211639434099197,
0.07790447026491165,
-0.022009586915373802,
0.024721696972846985,
-0.019322223961353302,
0.0421941876411438,
0.0157100148499012,
0.009621929377317429,
-0.02594037540256977,
-0.03305267170071602,
0.001977398991584778,
0.0014496794901788235,
-0.004597780294716358,
0.03403783217072487,
-0.015587188303470612,
0.011789297685027122,
-0.04089461639523506,
0.011970472522079945,
0.026745455339550972,
0.05446458235383034,
0.004344319924712181,
-0.017071392387151718,
0.037353694438934326,
-0.05830971524119377,
0.0034548030234873295,
-0.014667456969618797,
-0.01916995272040367,
0.005434385500848293,
-0.027202805504202843,
0.003926736302673817,
0.026708994060754776,
-0.022547395899891853,
0.0007599960081279278,
0.011825917288661003,
-0.03157908096909523,
-0.039469558745622635,
-0.032203689217567444,
0.00017209487850777805,
-0.03479359298944473,
-0.0014219052391126752,
0.04245113581418991,
0.026688212528824806,
0.03641851991415024,
-0.010698080994188786,
-0.028297312557697296,
-0.028834646567702293,
-0.007253757677972317,
0.0055367350578308105,
-0.04802093282341957,
0.021447740495204926,
0.013863511383533478,
0.03471924737095833,
0.0006950521492399275,
0.019061092287302017,
0.07451549172401428,
-0.034689705818891525,
0.03229402005672455,
0.017158005386590958,
-0.03551393374800682,
0.01674777641892433,
-0.055250611156225204,
-0.01721237227320671,
0.021424157544970512,
-0.05006203427910805,
0.01583157666027546,
0.017345422878861427,
0.028355596587061882,
0.008171332068741322,
-0.0023395998869091272,
-0.014104901812970638,
-0.010042627342045307,
-0.001432896126061678,
0.002813204424455762,
0.00006501131429104134,
-0.036410797387361526,
0.007233476731926203,
0.02070607617497444,
-0.008409122005105019,
-0.02882789820432663,
-0.016914334148168564,
-0.0009093857370316982,
-0.02894326113164425,
-0.024218780919909477,
-0.03861931338906288,
0.0617215633392334,
0.025499962270259857,
0.0012723224936053157,
0.016289353370666504,
0.009085889905691147,
0.01344146579504013,
0.008358892984688282,
0.0036755697801709175,
-0.020048698410391808,
0.036949243396520615,
0.03441249579191208,
-0.02013270929455757,
0.013690615072846413,
-0.0056000081822276115,
0.0218210369348526,
0.001973783364519477,
0.0002776063047349453,
-0.03542890399694443,
0.015793362632393837,
-0.03278982639312744,
0.01282194908708334,
-0.016443539410829544,
-0.028212377801537514,
-0.00549246184527874,
0.001980053260922432,
-0.009267270565032959,
0.007678543217480183,
0.0588274709880352,
0.03768843039870262,
-0.03086072765290737,
-0.01302883867174387,
0.011152036488056183,
-0.020663373172283173,
-0.028043223544955254,
0.013562345877289772,
0.015775131061673164,
-0.015365969389677048,
0.02077578380703926,
0.008996093645691872,
-0.006227750796824694,
0.01817505620419979,
-0.055937573313713074,
-0.024624725803732872,
0.017989346757531166,
-0.033065471798181534,
0.008918754756450653,
-0.002119417767971754,
0.015142770484089851,
0.013079495169222355,
0.04378542676568031,
-0.010135666467249393,
-0.006804794538766146,
-0.03497764468193054,
-0.008717731572687626,
0.022597787901759148,
-0.013894821517169476,
-0.026972413063049316,
-0.005609143525362015,
-0.03074599802494049,
0.01660021021962166,
0.03743596747517586,
-0.012958863750100136,
-0.04054752364754677,
-0.058159638196229935,
0.004074500873684883,
-0.02116277813911438,
0.032325904816389084,
0.04234153404831886,
0.004739466588944197,
-0.037260930985212326,
-0.031628210097551346,
0.004501153714954853,
0.009970029816031456,
-0.016406938433647156,
0.02328972890973091,
0.056653909385204315,
-0.04865194112062454,
-0.03561624139547348,
0.021276015788316727,
-0.008836684748530388,
0.03426547721028328,
-0.015154960565268993,
-0.0005865852581337094,
0.0021886974573135376,
-0.03219091519713402,
-0.01033840887248516,
-0.021967215463519096,
0.025310687720775604,
0.016207726672291756,
-0.007697329856455326,
-0.7264732718467712,
-0.010187968611717224,
0.01031044963747263,
-0.017433755099773407,
0.04262597858905792,
0.022762302309274673,
-0.015811972320079803,
0.027653569355607033,
-0.01075247023254633,
0.03407623618841171,
-0.03802649676799774,
0.0010170161258429289,
-0.029518261551856995,
0.013612404465675354,
0.008627048693597317,
-0.024327479302883148,
-0.0022751321084797382,
0.026782020926475525,
-0.02498384565114975,
0.0022658798843622208,
0.02130991779267788,
0.0561654306948185,
-0.01591487228870392,
0.008427074179053307,
0.0031297511886805296,
-0.03845081478357315,
0.028626665472984314,
-0.04367940127849579,
-0.009592905640602112,
0.021830540150403976,
-0.02161056362092495,
-0.03090990148484707,
0.030569519847631454,
-0.017812080681324005,
-0.026566404849290848,
-0.03665870428085327,
0.0007131145684979856,
-0.010124316439032555,
-0.004603722132742405,
-0.022821752354502678,
-0.016226785257458687,
-0.013026130385696888,
-0.021141264587640762,
-0.033986762166023254,
-0.03553164377808571,
-0.0098355608060956,
-0.031022891402244568,
-0.034596774727106094,
0.026177329942584038,
0.039640072733163834,
-0.006583871319890022,
0.035092540085315704,
0.031919170171022415,
-0.0067158895544707775,
0.004162812139838934,
-0.002378202276304364,
0.015361609868705273,
0.004087804351001978,
-0.014280036091804504,
0.034969035536050797,
0.02172592654824257,
0.045627109706401825,
0.0033767041750252247,
0.005562940612435341,
-0.0241951085627079,
-0.00033631332917138934,
-0.04137580096721649,
-0.018048563972115517,
-0.041304152458906174,
-0.019945884123444557,
-0.04519803449511528,
-0.0057371328584849834,
-0.02594495564699173,
0.059145230799913406,
-0.010043108835816383,
-0.024057451635599136,
-0.007979371584951878,
-0.0026056994684040546,
0.016919493675231934,
0.004651302937418222,
-0.01807861030101776,
-0.02077062800526619,
0.010484177619218826,
0.002616534009575844,
-0.024167951196432114,
0.03503973409533501,
0.003457062877714634,
-0.0010325140319764614,
0.003430281300097704,
0.03042040951550007,
0.034792833030223846,
0.049459028989076614,
-0.005513625219464302,
-0.034705061465501785,
0.029309993609786034,
-0.004146241582930088,
-0.0017049926100298762,
0.01837916113436222,
0.019630957394838333,
0.03382216766476631,
-0.01764286495745182,
0.02794697694480419,
-0.00496520334854722,
0.05518447607755661,
-0.036759283393621445,
-0.0015066468622535467,
-0.03598811477422714,
-0.022882655262947083,
0.03567567840218544,
-0.09967013448476791,
-0.01818895898759365,
-0.02509348653256893,
-0.03176671266555786,
-0.03087535686790943,
0.0013932648580521345,
-0.03539840877056122,
-0.0001500713115092367,
-0.0294960904866457,
0.03221672400832176,
-0.0168304443359375,
-0.004160033073276281,
-0.008710529655218124,
-0.004680383484810591,
0.05399388447403908,
-0.014393105171620846,
-0.01216971781104803,
-0.01939891278743744,
0.01250458974391222,
0.030987314879894257,
-0.0015318574151024222,
0.014969311654567719,
-0.007393477018922567,
-0.022348061203956604,
-0.007790394127368927,
-0.0325024276971817,
-0.026497624814510345,
-0.02610190212726593,
-0.03557600453495979,
0.016324488446116447,
-0.016164246946573257,
0.012122880667448044,
-0.000832779798656702,
0.01690068654716015,
-0.04249417409300804,
0.009077698923647404,
0.0241785179823637,
0.012872918508946896,
-0.0052742138504981995,
0.048966776579618454,
-0.01165125984698534,
-0.037524763494729996,
0.05168323963880539,
0.014532416127622128,
0.012978903017938137,
0.0006560442852787673,
-0.003984861541539431,
-0.017939692363142967,
-0.018791841343045235,
0.017984574660658836,
0.00858973991125822,
-0.01113576628267765,
-0.022681929171085358,
-0.009938760660588741,
0.032332900911569595,
0.047647036612033844,
0.007676294073462486,
0.007960439659655094,
0.02630610391497612,
0.006599643267691135,
0.04384975880384445,
0.020270749926567078,
-0.002959462348371744,
0.018658269196748734,
-0.009151206351816654,
-0.05691175535321236,
0.0014379791682586074,
0.013337893411517143,
-0.04970692843198776,
-0.009861878119409084,
0.01433268841356039,
-0.04334570840001106,
-0.015501587651669979,
0.005467662122100592,
-0.008671373128890991,
0.030012698844075203,
0.031062837690114975,
-0.005867337808012962,
0.029998019337654114,
0.005345218349248171,
-0.007592942100018263,
0.04294661432504654,
0.038686927407979965,
-0.02768786996603012,
-0.002457636408507824,
-0.010011685080826283,
-0.02979305200278759,
0.00013843677879776806,
-0.009367614984512329,
0.020741045475006104,
0.017001787200570107,
0.013520021922886372,
0.00742250494658947,
0.0015357558149844408,
0.008584504947066307,
0.026050787419080734,
0.07889264822006226,
-0.005850955843925476,
-0.002346690045669675,
0.03295064717531204,
-0.017065007239580154,
0.008681043982505798,
0.007003070320934057,
0.030898284167051315,
0.0051284609362483025,
-0.03880105912685394,
0.017470940947532654,
-0.05679457634687424,
-0.03899158537387848,
-0.022151444107294083,
-0.043295152485370636,
-0.01996764913201332,
-0.027534905821084976,
0.06787251681089401,
0.018022429198026657,
-0.01973765157163143,
0.0156871248036623,
-0.06974473595619202,
0.012445805594325066,
-0.033001650124788284,
-0.013818072155117989,
0.008713447488844395,
-0.006337575148791075,
0.036555755883455276,
-0.006024163216352463,
0.009366704151034355,
0.02936500683426857,
-0.03030376508831978,
0.002797134453430772,
0.017294934019446373,
-0.008439243771135807,
0.0037978498730808496,
-0.03333863243460655,
-0.023204822093248367,
-0.007935557514429092,
0.01869884878396988,
0.01754562370479107,
0.03509184718132019,
-0.0270354226231575,
-0.008937752805650234,
0.003595071379095316,
0.012211921624839306,
0.028480814769864082,
-0.014328171499073505,
-0.007161565124988556,
-0.007190648000687361,
0.018971774727106094,
-0.015283315442502499,
0.026090625673532486,
0.018585044890642166,
-0.008339032530784607,
-0.0025020332541316748,
-0.014784770086407661,
-0.009164019487798214,
0.017622321844100952,
-0.008605162613093853,
0.0012357396772131324,
0.038408469408750534,
-0.027736349031329155,
-0.011656688526272774,
-0.0013526665279641747,
0.030444733798503876,
0.02713789977133274,
-0.007640636060386896,
-0.01915157586336136,
0.013096700422465801,
-0.012865589000284672,
-0.012765894643962383,
-0.020306983962655067,
-0.008201761171221733,
0.02905580960214138,
-0.017417561262845993,
-0.015193571336567402,
0.030188824981451035,
0.03131289780139923,
0.014165458269417286,
-0.0331292524933815,
-0.040450237691402435,
-0.0017082486301660538,
-0.0153574887663126,
0.013697986491024494,
-0.007885854691267014,
-0.025662483647465706,
0.001243726583197713,
0.03136540576815605,
0.0048481617122888565,
-0.005911113694310188,
0.008541563525795937,
-0.0034003891050815582,
0.043530333787202835,
0.014024014584720135,
0.022724799811840057,
-0.006527941673994064,
-0.00467795180156827,
0.014509784989058971,
0.0055144233629107475,
-0.015155536122620106,
0.017693351954221725,
-0.02133806049823761,
0.025982990860939026,
0.0071008349768817425,
0.03677394986152649,
0.014787130989134312,
0.003844628343358636,
-0.023419689387083054,
-0.010579348541796207,
0.008288894779980183,
0.021495191380381584,
0.0010637067025527358,
-0.003688159165903926,
-0.009259656071662903,
0.025275060907006264,
0.03058309480547905,
-0.036492303013801575,
0.008159798569977283,
-0.021377600729465485,
-0.0023443831596523523,
-0.0024645288940519094,
-0.022603562101721764,
0.018601544201374054,
0.0263420008122921,
-0.024218378588557243,
-0.018506910651922226,
-0.031270600855350494,
0.027902381494641304,
0.02159878984093666,
0.0020873979665338993,
0.005831418093293905,
0.02794467657804489,
0.03047092817723751,
0.008717650547623634,
0.03925122320652008,
0.024084124714136124,
-0.0245759729295969,
0.007124889642000198,
0.01924794912338257,
0.025395574048161507,
-0.006462243385612965,
0.045580457895994186,
-0.005095081403851509,
0.0568569116294384,
0.02538502961397171,
-0.02257945016026497,
0.001121313194744289,
0.0007256147218868136,
0.027006445452570915,
-0.020921729505062103,
-0.024058986455202103,
0.0006585452356375754,
0.03026852197945118,
0.0010338022839277983,
-0.009150787256658077,
-0.02208736166357994,
-0.00866681057959795,
0.0018195443553850055,
0.016927944496273994,
-0.05921017378568649,
0.02753838151693344,
-0.02278888411819935,
0.0033354125916957855,
-0.005425961688160896,
-0.028904346749186516,
0.006793666630983353,
-0.016623681411147118,
0.0009161896887235343,
0.026331229135394096,
0.0492866076529026,
0.00204546214081347,
-0.003547671716660261,
-0.01605009101331234,
0.015132125467061996,
-0.023884035646915436,
-0.04836544021964073,
-0.0035682714078575373,
-0.03558025881648064,
0.03800544887781143,
-0.052067581564188004,
0.0018231041030958295,
-0.011873923242092133,
-0.02949582040309906,
-0.018503451719880104,
-0.016523053869605064,
-0.006525043863803148,
-0.03371212258934975,
0.03717707470059395,
-0.004183182958513498,
0.008027328178286552,
-0.03122323751449585,
-0.016755472868680954,
0.00025016392464749515,
0.03477166220545769,
-0.00842865277081728,
0.002153610112145543,
0.026707058772444725,
-0.029939405620098114,
-0.023612873628735542,
0.00041044954559765756,
-0.0031534647569060326,
-0.057379622012376785,
0.007592192385345697,
-0.01350504532456398,
0.024946922436356544,
0.009654436260461807,
-0.008016782812774181,
-0.014260981231927872,
0.0037081281188875437,
-0.023311523720622063,
-0.0138437794521451,
0.016798414289951324,
0.041130390018224716,
0.018101483583450317,
-0.009070614352822304,
-0.0150828305631876,
-0.021956510841846466,
-0.030388670042157173,
0.012880166992545128,
-0.0009987293742597103,
-0.017611604183912277,
0.00023946525470819324,
-0.019290421158075333,
0.006703573279082775,
-0.03924794867634773,
-0.017597978934645653,
-0.0053852275013923645,
0.0304220300167799,
0.03321307152509689,
-0.0416741818189621,
0.01942981220781803,
0.003700114320963621,
-0.017802180722355843,
0.02040608413517475,
0.0007347568753175437,
0.019739655777812004,
-0.03288000449538231,
0.030609052628278732,
0.02558555081486702,
-0.016671916469931602,
0.014195901341736317,
-0.02880922518670559,
-0.005288491491228342,
-0.03186267986893654,
-0.05090215802192688,
-0.000409429834689945,
0.02600523643195629,
0.020530762150883675,
0.014976788312196732,
0.00038670923095196486,
0.06392194330692291,
0.006857354659587145,
0.026634883135557175,
0.03377516195178032,
-0.011138594709336758,
-0.002940076868981123,
0.016712579876184464,
0.003386714728549123,
0.009483135305345058,
0.03270336240530014,
0.016597118228673935,
-0.014649727381765842,
0.005206133704632521,
-0.030638055875897408,
0.011805887334048748,
-0.020211996510624886,
0.0005373017047531903,
0.01792285218834877,
-0.028782807290554047,
0.003807715605944395,
-0.019610604271292686,
0.017751099541783333,
0.02264012023806572,
0.0013644839636981487,
-0.01498719397932291,
0.030135108157992363,
0.002403583377599716,
-0.0006368829635903239,
-0.0002290007978444919,
-0.010577603243291378,
-0.00694267638027668,
-0.041779156774282455,
-0.04514653980731964,
0.0035899339709430933,
-0.010282937437295914,
-0.018655596300959587,
-0.03254163637757301,
0.007828193716704845,
-0.007516413927078247,
-0.003336945315822959,
0.01919662579894066,
0.02273734286427498,
0.011221379972994328,
-0.01880386658012867,
-0.015668725594878197,
0.014350629411637783,
0.00829172134399414,
-0.032219719141721725,
0.022679056972265244,
0.024229777976870537,
0.05351840332150459,
0.0011955633526667953,
0.0033967792987823486,
-0.009561771526932716,
0.007859722711145878,
0.00440147053450346,
-0.049538057297468185,
-0.02738242968916893,
0.011486547999083996,
0.03648841008543968,
0.03465734049677849,
0.0021334830671548843,
0.023138338699936867,
-0.015116622671484947,
0.017629966139793396,
0.005938458256423473,
-0.03637908399105072,
-0.026973407715559006,
0.0015053794486448169,
-0.0365966334939003,
-0.036035459488630295,
0.004744262900203466,
-0.013265312649309635,
0.029019832611083984,
-0.0231196116656065,
0.006892057601362467,
-0.02755986526608467,
-0.005213301628828049,
0.01664200983941555,
-0.007122744340449572,
0.009704859927296638,
0.02836117334663868,
-0.0020440896041691303,
0.0009807654423639178,
0.04614340886473656,
0.012049790471792221,
0.002499280497431755,
-0.048323195427656174,
-0.02404514141380787,
-0.015536339953541756,
-0.0023243443574756384,
0.024332579225301743,
0.015622102655470371,
0.03357924520969391,
-0.018910175189375877,
0.01948477514088154,
-0.01319124922156334,
-0.010419248603284359,
-0.041900958865880966,
-0.003212207229807973,
0.006219903472810984,
-0.0022046687081456184,
0.009526756592094898,
-0.04682796075940132,
-0.019719023257493973,
-0.002151043154299259
] |
8a7905cf7b3fc947d0fefe5c680371a050d82807 | 1,855 | py | Python | lib/tests/streamlit/pydeck_test.py | zgtz/streamlit | be797682394955ef2b94a5f7641b6f9d8fd1dbfc | [
"Apache-2.0"
] | 1 | 2022-01-19T10:48:49.000Z | 2022-01-19T10:48:49.000Z | lib/tests/streamlit/pydeck_test.py | zgtz/streamlit | be797682394955ef2b94a5f7641b6f9d8fd1dbfc | [
"Apache-2.0"
] | 52 | 2021-10-04T21:52:48.000Z | 2021-12-29T02:18:44.000Z | lib/tests/streamlit/pydeck_test.py | zgtz/streamlit | be797682394955ef2b94a5f7641b6f9d8fd1dbfc | [
"Apache-2.0"
] | null | null | null | # Copyright 2018-2021 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import pandas as pd
import pydeck as pdk
from tests import testutil
import streamlit as st
import streamlit.elements.deck_gl_json_chart as deck_gl_json_chart
df1 = pd.DataFrame({"lat": [1, 2, 3, 4], "lon": [10, 20, 30, 40]})
class PyDeckTest(testutil.DeltaGeneratorTestCase):
def test_basic(self):
"""Test that pydeck object orks."""
st.pydeck_chart(
pdk.Deck(
layers=[
pdk.Layer("ScatterplotLayer", data=df1),
]
)
)
el = self.get_delta_from_queue().new_element
actual = json.loads(el.deck_gl_json_chart.json)
self.assertEqual(actual["layers"][0]["@@type"], "ScatterplotLayer")
self.assertEqual(
actual["layers"][0]["data"],
[
{"lat": 1, "lon": 10},
{"lat": 2, "lon": 20},
{"lat": 3, "lon": 30},
{"lat": 4, "lon": 40},
],
)
def test_no_args(self):
"""Test that it can be called with no args."""
st.pydeck_chart()
el = self.get_delta_from_queue().new_element
actual = json.loads(el.deck_gl_json_chart.json)
self.assertEqual(actual, deck_gl_json_chart.EMPTY_MAP)
| 30.409836 | 75 | 0.618329 | 1 | 1.2876 | [
0.0003537001903168857,
0.02272425778210163,
0.008263703435659409,
0.0013359165750443935,
0.004185463301837444,
-0.0024254366289824247,
-0.006563468836247921,
0.0027565399650484324,
-0.005141511093825102,
0.0023543015122413635,
0.0047514187172055244,
0.005618918687105179,
0.00879330188035965,
-0.015874434262514114,
-0.0006645998801104724,
0.015368340536952019,
-0.0497640036046505,
0.00008993256778921932,
-0.0032662521116435528,
0.002215196145698428,
-0.00916246511042118,
0.00887259654700756,
0.009933439083397388,
0.005452789831906557,
0.005818081088364124,
-0.0012751648901030421,
0.009102905169129372,
-0.000530739373061806,
-0.006549375131726265,
-0.009535553865134716,
-0.001595736714079976,
-0.0029074344784021378,
-0.006577794905751944,
-0.005938507150858641,
0.0060872603207826614,
-0.003938294015824795,
-0.0019065610831603408,
-0.020876238122582436,
0.011612889356911182,
-0.005799519829452038,
-0.005182959605008364,
-0.015617980621755123,
0.0015160291222855449,
0.0037985914386808872,
-0.00973049271851778,
0.001144877984188497,
-0.0036064470186829567,
0.0008502882556058466,
-0.012360203079879284,
0.006919253151863813,
-0.009837840683758259,
0.005047421902418137,
0.012818765826523304,
0.0019456917652860284,
-0.00517753092572093,
-0.006136351730674505,
0.01362334843724966,
-0.0014919342938810587,
-0.010262996889650822,
-0.00015817028179299086,
-0.004893973935395479,
-0.0038871183060109615,
0.004492349922657013,
0.0021190957631915808,
-0.015249508433043957,
-0.007391509134322405,
-0.005250377580523491,
0.00425195274874568,
-0.00036613884731195867,
0.007019152864813805,
0.001460320665501058,
-0.0013062028447166085,
0.00538307148963213,
0.006207559257745743,
0.004413755610585213,
-0.005363318603485823,
-0.0005167752387933433,
-0.0006474058609455824,
0.008996167220175266,
0.005134495906531811,
0.004316443577408791,
-0.007017930503934622,
0.004269526340067387,
0.010406413115561008,
0.012631778605282307,
0.006697827018797398,
0.021332059055566788,
-0.011192833073437214,
0.04723837599158287,
0.009200281463563442,
-0.008040998131036758,
0.0010427265660837293,
-0.009552708826959133,
-0.000826643779873848,
-0.005035881418734789,
-0.0270446315407753,
0.00020449959265533835,
-0.003062981180846691,
-0.0005218225414864719,
0.002293484518304467,
-0.002257582964375615,
0.006933469325304031,
-0.0007920170901343226,
-0.0004412100533954799,
-0.008123804815113544,
0.009098414331674576,
-0.007650870364159346,
-0.0013775081606581807,
0.008650125935673714,
0.002862578257918358,
-0.011797831393778324,
-0.0026882891543209553,
0.0009324515704065561,
-0.013620935380458832,
0.003717720042914152,
0.0012536986032500863,
-0.007575442083179951,
0.054367247968912125,
-0.0019267699681222439,
0.004160153213888407,
-0.00450949277728796,
0.0015409705229103565,
0.002913642907515168,
0.005282268859446049,
0.008497139438986778,
-0.002897584578022361,
0.013423738069832325,
0.009344438090920448,
0.005444400943815708,
0.009012111462652683,
-0.0008659075247123837,
0.007350332569330931,
-0.006389733403921127,
-0.0021095569245517254,
0.0010341943707317114,
-0.007284136954694986,
0.006958552170544863,
-0.0005752671859227121,
-0.008970833383500576,
0.0010039275512099266,
-0.000441159209003672,
-0.009997132234275341,
0.0026048007421195507,
-0.0051225037313997746,
0.004506546538323164,
-0.008905953727662563,
-0.002460378222167492,
-0.004407718311995268,
-0.004428235348314047,
0.0017565713496878743,
0.008737480267882347,
0.003038964234292507,
0.00247948314063251,
-0.006068491842597723,
-0.009392247535288334,
-0.0005485301371663809,
-0.005133750848472118,
0.001057534129358828,
0.007456652820110321,
0.003105275798588991,
-0.010188695974647999,
0.0002383536921115592,
0.0010910440469160676,
0.002430156571790576,
-0.002058113692328334,
0.0037707111332565546,
-0.008823137730360031,
0.007731853984296322,
0.000807940203230828,
0.0037888067308813334,
0.01202752348035574,
-0.004920714534819126,
-0.0009420664282515645,
-0.0004676522803492844,
0.0033339455258101225,
-0.0007990662124939263,
0.005208150949329138,
0.010244814679026604,
-0.0016392188845202327,
-0.005102424882352352,
0.0025548837147653103,
0.003961706999689341,
0.011394529603421688,
0.005689934361726046,
-0.004131321329623461,
0.0008264902280643582,
-0.004652474075555801,
-0.0011369510320946574,
0.007813104428350925,
-0.003933655098080635,
0.005026229191571474,
0.0048017059452831745,
-0.013027784414589405,
-0.007624487858265638,
0.0009440140565857291,
-0.008661596104502678,
0.001814459334127605,
0.014986453577876091,
0.010998154059052467,
-0.0036095967516303062,
0.0017862775130197406,
-0.0089743472635746,
0.00011122989235445857,
0.008066578768193722,
0.0036601873580366373,
-0.013446606695652008,
-0.958891749382019,
0.006524163763970137,
0.005386549048125744,
-0.0019354555988684297,
0.005403017625212669,
0.0035040134098380804,
0.00460989773273468,
0.0044119516387581825,
0.016002243384718895,
-0.008499909192323685,
-0.00441789673641324,
-0.0090912114828825,
-0.009271630086004734,
0.00008052982593653724,
-0.005683558527380228,
-0.004355030134320259,
-0.00653313472867012,
-0.005977754946798086,
-0.001568092149682343,
-0.0038716639392077923,
-0.0030121137388050556,
0.007396362721920013,
-0.0012488355860114098,
0.005585651379078627,
0.0027374073397368193,
0.002710147527977824,
-0.005293531809002161,
-0.0016655769431963563,
-0.0029656800907105207,
-0.0019401817116886377,
-0.0068734800443053246,
-0.01351930946111679,
-0.0028352010995149612,
-0.002013269579038024,
0.01013921108096838,
0.0008067593444138765,
0.00829190481454134,
-0.0030398541130125523,
0.002745105652138591,
-0.006063356995582581,
0.0041122958064079285,
-0.0006637917249463499,
0.0030369721353054047,
-0.031166009604930878,
-0.0006064111948944628,
-0.0007530595757998526,
-0.010847692377865314,
0.008465014398097992,
-0.002502808813005686,
0.002362535335123539,
-0.0038955644704401493,
-0.006363110616803169,
0.00846022367477417,
-0.006979518570005894,
0.0023470998276025057,
-0.00461677648127079,
-0.008718057535588741,
-0.0020176677498966455,
-0.008471651002764702,
0.0010166154243052006,
0.003763666143640876,
-0.0036369035951793194,
-0.004424863029271364,
-0.0018919687718153,
0.004539398476481438,
0.002158192452043295,
0.0032634572125971317,
-0.017804177477955818,
-0.00965676736086607,
-0.000989145366474986,
-0.00013649419997818768,
-0.00420792680233717,
-0.002736649475991726,
0.005041680298745632,
-0.009961566887795925,
0.005716936197131872,
0.001011103275232017,
0.00002224989111709874,
-0.011174443177878857,
-0.0007145716808736324,
-0.007851784117519855,
-0.009759733453392982,
0.0019212482729926705,
-0.004916818346828222,
-0.004472420550882816,
0.0006211053114384413,
0.0002811296144500375,
0.007636992260813713,
-0.00328928348608315,
0.0042638517916202545,
0.01052242424339056,
-0.002962931990623474,
-0.007682381197810173,
0.008463123813271523,
0.006211011670529842,
-0.0005944361328147352,
-0.0029856672044843435,
0.002175072208046913,
0.008152988739311695,
0.008996554650366306,
0.001973936799913645,
0.004823338706046343,
-0.0004886562237516046,
0.008846841752529144,
0.00043685795390047133,
0.0005245328648015857,
-0.0034950736444443464,
-0.0008888048469088972,
-0.0033842537086457014,
-0.0031111876014620066,
-0.004393732640892267,
-0.0034741582348942757,
-0.011905034072697163,
-0.010143188759684563,
-0.004128667060285807,
-0.0008739096228964627,
0.0038968154694885015,
-0.005066414829343557,
0.0022855442948639393,
0.00024454150116071105,
0.008771843276917934,
0.00034294367651455104,
-0.0023170881904661655,
0.0011758855544030666,
0.002029015915468335,
-0.006256210617721081,
0.014272183179855347,
-0.011253640986979008,
0.007322146091610193,
-0.00025551390717737377,
-0.015973789617419243,
0.007778332568705082,
0.011086045764386654,
-0.009369169361889362,
0.0005908639868721366,
0.004043979104608297,
0.0020607071928679943,
0.00017259606102015823,
-0.005684791132807732,
-0.0036723241209983826,
-0.018850764259696007,
-0.0016433467390015721,
0.018512975424528122,
0.001671715872362256,
0.009969057515263557,
0.012242930941283703,
-0.0009694501059129834,
0.0011239796876907349,
0.005538574885576963,
0.002517343033105135,
0.014638968743383884,
-0.009084295481443405,
-0.00017825198301579803,
0.002600607927888632,
-0.008013843558728695,
0.0023175873793661594,
0.005837042350322008,
0.004528807010501623,
-0.003069194033741951,
0.0051493956707417965,
-0.007132561411708593,
-0.005190852098166943,
-0.018086310476064682,
-0.0026739523746073246,
0.005266138818114996,
-0.002895419718697667,
0.006476599257439375,
-0.012823776341974735,
0.002907888498157263,
0.006047759670764208,
0.003774070180952549,
-0.0003489189548417926,
0.0016515938332304358,
0.005684796255081892,
0.011647429317235947,
-0.00501368148252368,
0.003566117025911808,
0.003532061818987131,
-0.0016979662468656898,
0.00018407694005873054,
0.007659262977540493,
-0.006209382321685553,
-0.007289452478289604,
0.0032992144115269184,
0.003028415609151125,
-0.00004273858212400228,
-0.003531272290274501,
-0.007744608446955681,
-0.0023336331360042095,
0.002206309698522091,
-0.004703552462160587,
0.0038732970133423805,
0.0013559365179389715,
0.00390365207567811,
-0.004833912011235952,
-0.0004888421390205622,
-0.0021632532589137554,
-0.01103190891444683,
0.011526517570018768,
-0.0021186303347349167,
0.0016271971398964524,
0.011761919595301151,
0.0022332947701215744,
-0.01238354854285717,
0.0044486019760370255,
0.008667176589369774,
-0.0036176887806504965,
0.006327449344098568,
0.006444569677114487,
-0.004628573078662157,
-0.021796274930238724,
-0.004260552581399679,
-0.013223393820226192,
0.007735920138657093,
-0.0021056639961898327,
0.004495562054216862,
-0.007787315174937248,
0.00765082286670804,
0.007531525567173958,
-0.014844111166894436,
-0.004497701767832041,
-0.008819399401545525,
0.008846154436469078,
-0.0007734308601357043,
-0.001005838974379003,
-0.0037562057841569185,
-0.0018988392548635602,
-0.0043846480548381805,
-0.0034479275345802307,
-0.0026114170905202627,
0.0058701494708657265,
0.0023401135113090277,
-0.0007393771666102111,
0.0024635728914290667,
-0.0033734426833689213,
0.0012671201257035136,
-0.0003897028509527445,
-0.010252747684717178,
-0.000016857104128575884,
0.0032053072936832905,
-0.0025908416137099266,
-0.0035615370143204927,
0.0003677920321933925,
-0.0010978587670251727,
-0.008593046106398106,
-0.01169626321643591,
-0.0024482153821736574,
-0.00561785651370883,
-0.001964942552149296,
-0.01239475142210722,
-0.0027170460671186447,
-0.005920865572988987,
0.005467635579407215,
-0.007711106911301613,
0.009122669696807861,
0.006289701443165541,
-0.004629296716302633,
0.006034410558640957,
-0.0007935852627269924,
0.004653196781873703,
0.004628587514162064,
0.0056805722415447235,
0.0038384238723665476,
-0.006016477942466736,
-0.010919811204075813,
0.01297019049525261,
-0.008398830890655518,
0.0011163706658408046,
0.013492370955646038,
0.006286161486059427,
0.009190489538013935,
-0.0009974497370421886,
-0.0009605591185390949,
0.001948221237398684,
0.007767816074192524,
-0.014964915812015533,
0.004164682235568762,
-0.0017869393341243267,
-0.00008281671034637839,
0.004580849315971136,
-0.005090756341814995,
0.001973566832020879,
0.009529942646622658,
0.0009988570818677545,
-0.006736908107995987,
-0.004529730416834354,
0.004157653544098139,
0.003209256799891591,
-0.01358575839549303,
0.0002687814412638545,
-0.004339888691902161,
-0.005418869201093912,
-0.00249421875923872,
-0.004689878784120083,
-0.0008832983439788222,
0.0029169339686632156,
-0.00283263111487031,
0.005699248518794775,
0.003275541588664055,
-0.004042713902890682,
0.013666036538779736,
-0.003496232209727168,
-0.00549507699906826,
0.0033380480017513037,
0.00244386144913733,
-0.0031600838992744684,
-0.007828673347830772,
-0.0035648795310407877,
0.0020771375857293606,
0.006934058852493763,
-0.002768081845715642,
-0.003538941964507103,
-0.0023315572179853916,
0.001244613085873425,
-0.007187021430581808,
0.002421086886897683,
0.011457288637757301,
-0.003254912793636322,
0.007838389836251736,
-0.0015839723637327552,
-0.007198507431894541,
-0.013626870699226856,
0.05186296999454498,
-0.0019136121263727546,
0.003949228208512068,
0.00390829099342227,
-0.007657815236598253,
0.002790041035041213,
-0.001875702291727066,
0.00749690318480134,
-0.0064529781229794025,
-0.006758346688002348,
0.009670069441199303,
-0.002611365169286728,
0.00426155049353838,
0.004635380581021309,
-0.0007590610184706748,
0.016703393310308456,
-0.0031520791817456484,
-0.01756124570965767,
-0.018339814618229866,
0.007315679453313351,
-0.003867814317345619,
-0.007480358239263296,
0.010784259997308254,
-0.0028308539185673,
-0.005032305605709553,
0.0008038481464609504,
0.007900734432041645,
0.0021791313774883747,
-0.0005246567307040095,
-0.0017672551330178976,
-0.0017429293366149068,
0.0009571212576702237,
0.003437251318246126,
0.007476453203707933,
0.005965291056782007,
-0.0033266686368733644,
0.002421906916424632,
-0.0021111888345330954,
-0.0013690214836969972,
-0.001338635222055018,
0.00384119083173573,
0.00723669258877635,
-0.0012667793780565262,
-0.0016157865757122636,
0.0055647948756814,
0.004733876790851355,
0.0015659723430871964,
0.011931235902011395,
-0.0010968550341203809,
-0.006395157426595688,
0.00815716665238142,
0.007369085215032101,
0.001025776262395084,
0.006906928960233927,
0.0007845589425414801,
0.005500924773514271,
0.002011955948546529,
-0.007063816301524639,
-0.016906816512346268,
-0.0037407276686280966,
0.008736032992601395,
0.0077977851033210754,
-0.0009357256349176168,
0.002204654738306999,
-0.002658613957464695,
-0.0032065168488770723,
-0.006648669950664043,
-0.006575286388397217,
-0.003370191901922226,
0.0015192081918939948,
0.0034155419562011957,
0.06955480575561523,
-0.008899584412574768,
-0.0028584280516952276,
-0.00739895598962903,
-0.0014396634651347995,
-0.0022332973312586546,
-0.0007199969841167331,
0.0014268216909840703,
-0.002785353222861886,
0.0028068425599485636,
-0.00012613525905180722,
-0.010042846202850342,
-0.012092343531548977,
0.0002233788836747408,
0.003167591290548444,
-0.0025931610725820065,
0.0034545704256743193,
0.007261907681822777,
-0.01001658197492361,
0.0009144210489466786,
-0.012439241632819176,
-0.003876883303746581,
-0.0020160204730927944,
-0.009277436882257462,
-0.005258545745164156,
-0.00344085949473083,
0.005081465467810631,
0.0021830378100275993,
0.006052421871572733,
-0.0037907434161752462,
0.007136182393878698,
-0.002596621634438634,
-0.0012629905249923468,
-0.006099873222410679,
-0.000915729848202318,
-0.00660133920609951,
0.008920027874410152,
0.0005490154726430774,
-0.009727626107633114,
-0.004727483261376619,
-0.0017997287213802338,
-0.00009683252574177459,
-0.006677411030977964,
0.0044976831413805485,
0.0003361229319125414,
0.004801656119525433,
-0.0036755159962922335,
-0.00013474971638061106,
-0.007314436137676239,
0.0035508829168975353,
-0.011668149381875992,
0.004971106071025133,
-0.1723080724477768,
0.009977443143725395,
0.003630508203059435,
-0.0061578815802931786,
-0.0043278527446091175,
-0.016008269041776657,
-0.0038641514256596565,
0.0038510430604219437,
0.010916597209870815,
0.0023693216498941183,
-0.002600806299597025,
-0.0027157762087881565,
0.0041553252376616,
0.002257420914247632,
-0.0010352187091484666,
-0.005373032763600349,
0.004133234731853008,
-0.003204526612535119,
0.0016956322360783815,
0.0037108799442648888,
0.004818318411707878,
0.00976119376718998,
0.000012330056051723659,
0.0025173486210405827,
-0.0024530701339244843,
-0.005770268850028515,
0.0068833851255476475,
-0.0025665403809398413,
0.004307835828512907,
-0.011553285643458366,
-0.003141615306958556,
-0.004868672229349613,
-0.0038799671456217766,
-0.000462877273093909,
0.005265373270958662,
-0.00011071364133385941,
0.00970489252358675,
0.0034748101606965065,
-0.007184883113950491,
0.00769713195040822,
-0.007341003976762295,
0.029558470472693443,
0.006219408940523863,
0.006037650629878044,
-0.0018086772179231048,
-0.005919203627854586,
-0.005919449497014284,
0.009544205851852894,
0.001312247128225863,
0.01187634002417326,
-0.011413490399718285,
0.00008572467777412385,
0.004214064683765173,
0.017739519476890564,
-0.005683084949851036,
-0.00962161086499691,
-0.006104673258960247,
-0.0008686213404871523,
0.0028942194767296314,
0.008104139938950539,
0.011889543384313583,
-0.004600103013217449,
0.007831070572137833,
-0.003071447368711233,
-0.021415065973997116,
0.004609778523445129,
-0.005929991137236357,
-0.006533104460686445,
0.0006836677785031497,
0.005188231822103262,
0.00834681186825037,
0.00022249709581956267,
0.0012583467178046703,
-0.0013588226865977049,
0.005951468832790852,
-0.0005130060017108917,
0.006253631319850683,
-0.0013797200517728925,
0.004764846991747618,
-0.010067081078886986,
0.00911500584334135,
-0.009502987377345562,
-0.001871320535428822,
0.002572951139882207,
-0.0034899096935987473,
0.011721329763531685,
0.0030000265687704086,
-0.0023116187658160925,
-0.0008074299548752606,
-0.01008028443902731,
-0.0023044063709676266,
0.0020801741629838943,
0.0030125114135444164,
-0.0099183963611722,
0.003541691927239299,
0.001537942560389638,
0.00820812489837408,
0.006534484215080738,
-0.008774027228355408,
0.006713527254760265,
0.005701575893908739,
-0.004887664224952459,
0.0012769688619300723,
-0.003736205631867051,
0.0014562926953658462,
0.002815097104758024,
-0.006929792929440737,
-0.005077771842479706,
0.003980937413871288,
-0.008457356132566929,
-0.004083396401256323,
0.0059892828576266766,
-0.009623619727790356,
-0.008886086754500866,
-0.0020229844376444817,
-0.010847623459994793,
0.0003422792942728847
] |
8a790773c525636d7fecb88a7d84df906ba09ba6 | 40,698 | py | Python | sdks/python/apache_beam/io/gcp/bigquery_tools.py | Doctusoft/beam | 91d59e78ffec3771a1d646c4e320fff571393829 | [
"Apache-2.0"
] | null | null | null | sdks/python/apache_beam/io/gcp/bigquery_tools.py | Doctusoft/beam | 91d59e78ffec3771a1d646c4e320fff571393829 | [
"Apache-2.0"
] | 1 | 2022-02-10T06:56:11.000Z | 2022-02-10T06:56:11.000Z | sdks/python/apache_beam/io/gcp/bigquery_tools.py | Doctusoft/beam | 91d59e78ffec3771a1d646c4e320fff571393829 | [
"Apache-2.0"
] | null | null | null | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Tools used by BigQuery sources and sinks.
Classes, constants and functions in this file are experimental and have no
backwards compatibility guarantees.
These tools include wrappers and clients to interact with BigQuery APIs.
NOTHING IN THIS FILE HAS BACKWARDS COMPATIBILITY GUARANTEES.
"""
from __future__ import absolute_import
import datetime
import decimal
import json
import logging
import re
import sys
import time
import uuid
from builtins import object
from future.utils import iteritems
from apache_beam import coders
from apache_beam.internal.gcp import auth
from apache_beam.internal.gcp.json_value import from_json_value
from apache_beam.internal.gcp.json_value import to_json_value
from apache_beam.internal.http_client import get_new_http
from apache_beam.io.gcp.internal.clients import bigquery
from apache_beam.options import value_provider
from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.runners.dataflow.native_io import iobase as dataflow_io
from apache_beam.transforms import DoFn
from apache_beam.utils import retry
# Protect against environments where bigquery library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
try:
from apitools.base.py.exceptions import HttpError
except ImportError:
pass
# pylint: enable=wrong-import-order, wrong-import-position
MAX_RETRIES = 3
JSON_COMPLIANCE_ERROR = 'NAN, INF and -INF values are not JSON compliant.'
def default_encoder(obj):
if isinstance(obj, decimal.Decimal):
return str(obj)
raise TypeError(
"Object of type '%s' is not JSON serializable" % type(obj).__name__)
def get_hashable_destination(destination):
"""Parses a table reference into a (project, dataset, table) tuple.
Args:
destination: Either a TableReference object from the bigquery API.
The object has the following attributes: projectId, datasetId, and
tableId. Or a string representing the destination containing
'PROJECT:DATASET.TABLE'.
Returns:
A string representing the destination containing
'PROJECT:DATASET.TABLE'.
"""
if isinstance(destination, bigquery.TableReference):
return '%s:%s.%s' % (
destination.projectId, destination.datasetId, destination.tableId)
else:
return destination
def parse_table_schema_from_json(schema_string):
"""Parse the Table Schema provided as string.
Args:
schema_string: String serialized table schema, should be a valid JSON.
Returns:
A TableSchema of the BigQuery export from either the Query or the Table.
"""
json_schema = json.loads(schema_string)
def _parse_schema_field(field):
"""Parse a single schema field from dictionary.
Args:
field: Dictionary object containing serialized schema.
Returns:
A TableFieldSchema for a single column in BigQuery.
"""
schema = bigquery.TableFieldSchema()
schema.name = field['name']
schema.type = field['type']
if 'mode' in field:
schema.mode = field['mode']
else:
schema.mode = 'NULLABLE'
if 'description' in field:
schema.description = field['description']
if 'fields' in field:
schema.fields = [_parse_schema_field(x) for x in field['fields']]
return schema
fields = [_parse_schema_field(f) for f in json_schema['fields']]
return bigquery.TableSchema(fields=fields)
def parse_table_reference(table, dataset=None, project=None):
"""Parses a table reference into a (project, dataset, table) tuple.
Args:
table: The ID of the table. The ID must contain only letters
(a-z, A-Z), numbers (0-9), or underscores (_). If dataset argument is None
then the table argument must contain the entire table reference:
'DATASET.TABLE' or 'PROJECT:DATASET.TABLE'. This argument can be a
bigquery.TableReference instance in which case dataset and project are
ignored and the reference is returned as a result. Additionally, for date
partitioned tables, appending '$YYYYmmdd' to the table name is supported,
e.g. 'DATASET.TABLE$YYYYmmdd'.
dataset: The ID of the dataset containing this table or null if the table
reference is specified entirely by the table argument.
project: The ID of the project containing this table or null if the table
reference is specified entirely by the table (and possibly dataset)
argument.
Returns:
A TableReference object from the bigquery API. The object has the following
attributes: projectId, datasetId, and tableId.
Raises:
ValueError: if the table reference as a string does not match the expected
format.
"""
if isinstance(table, bigquery.TableReference):
return table
elif callable(table):
return table
elif isinstance(table, value_provider.ValueProvider):
return table
table_reference = bigquery.TableReference()
# If dataset argument is not specified, the expectation is that the
# table argument will contain a full table reference instead of just a
# table name.
if dataset is None:
match = re.match(
r'^((?P<project>.+):)?(?P<dataset>\w+)\.(?P<table>[\w\$]+)$', table)
if not match:
raise ValueError(
'Expected a table reference (PROJECT:DATASET.TABLE or '
'DATASET.TABLE) instead of %s.' % table)
table_reference.projectId = match.group('project')
table_reference.datasetId = match.group('dataset')
table_reference.tableId = match.group('table')
else:
table_reference.projectId = project
table_reference.datasetId = dataset
table_reference.tableId = table
return table_reference
# -----------------------------------------------------------------------------
# BigQueryWrapper.
class BigQueryWrapper(object):
"""BigQuery client wrapper with utilities for querying.
The wrapper is used to organize all the BigQuery integration points and
offer a common place where retry logic for failures can be controlled.
In addition it offers various functions used both in sources and sinks
(e.g., find and create tables, query a table, etc.).
"""
TEMP_TABLE = 'temp_table_'
TEMP_DATASET = 'temp_dataset_'
def __init__(self, client=None):
self.client = client or bigquery.BigqueryV2(
http=get_new_http(),
credentials=auth.get_service_credentials(),
response_encoding=None if sys.version_info[0] < 3 else 'utf8')
self._unique_row_id = 0
# For testing scenarios where we pass in a client we do not want a
# randomized prefix for row IDs.
self._row_id_prefix = '' if client else uuid.uuid4()
self._temporary_table_suffix = uuid.uuid4().hex
@property
def unique_row_id(self):
"""Returns a unique row ID (str) used to avoid multiple insertions.
If the row ID is provided, BigQuery will make a best effort to not insert
the same row multiple times for fail and retry scenarios in which the insert
request may be issued several times. This comes into play for sinks executed
in a local runner.
Returns:
a unique row ID string
"""
self._unique_row_id += 1
return '%s_%d' % (self._row_id_prefix, self._unique_row_id)
def _get_temp_table(self, project_id):
return parse_table_reference(
table=BigQueryWrapper.TEMP_TABLE + self._temporary_table_suffix,
dataset=BigQueryWrapper.TEMP_DATASET + self._temporary_table_suffix,
project=project_id)
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_query_location(self, project_id, query, use_legacy_sql):
"""
Get the location of tables referenced in a query.
This method returns the location of the first referenced table in the query
and depends on the BigQuery service to provide error handling for
queries that reference tables in multiple locations.
"""
reference = bigquery.JobReference(jobId=uuid.uuid4().hex,
projectId=project_id)
request = bigquery.BigqueryJobsInsertRequest(
projectId=project_id,
job=bigquery.Job(
configuration=bigquery.JobConfiguration(
dryRun=True,
query=bigquery.JobConfigurationQuery(
query=query,
useLegacySql=use_legacy_sql,
)),
jobReference=reference))
response = self.client.jobs.Insert(request)
if response.statistics is None:
# This behavior is only expected in tests
logging.warning(
"Unable to get location, missing response.statistics. Query: %s",
query)
return None
referenced_tables = response.statistics.query.referencedTables
if referenced_tables: # Guards against both non-empty and non-None
table = referenced_tables[0]
location = self.get_table_location(
table.projectId,
table.datasetId,
table.tableId)
logging.info("Using location %r from table %r referenced by query %s",
location, table, query)
return location
logging.debug("Query %s does not reference any tables.", query)
return None
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _insert_copy_job(self,
project_id,
job_id,
from_table_reference,
to_table_reference,
create_disposition=None,
write_disposition=None):
reference = bigquery.JobReference()
reference.jobId = job_id
reference.projectId = project_id
request = bigquery.BigqueryJobsInsertRequest(
projectId=project_id,
job=bigquery.Job(
configuration=bigquery.JobConfiguration(
copy=bigquery.JobConfigurationTableCopy(
destinationTable=to_table_reference,
sourceTable=from_table_reference,
createDisposition=create_disposition,
writeDisposition=write_disposition,
)
),
jobReference=reference,
)
)
logging.info("Inserting job request: %s", request)
response = self.client.jobs.Insert(request)
logging.info("Response was %s", response)
return response.jobReference
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _insert_load_job(self,
project_id,
job_id,
table_reference,
source_uris,
schema=None,
write_disposition=None,
create_disposition=None):
reference = bigquery.JobReference(jobId=job_id, projectId=project_id)
request = bigquery.BigqueryJobsInsertRequest(
projectId=project_id,
job=bigquery.Job(
configuration=bigquery.JobConfiguration(
load=bigquery.JobConfigurationLoad(
sourceUris=source_uris,
destinationTable=table_reference,
schema=schema,
writeDisposition=write_disposition,
createDisposition=create_disposition,
sourceFormat='NEWLINE_DELIMITED_JSON',
autodetect=schema is None,
)
),
jobReference=reference,
)
)
response = self.client.jobs.Insert(request)
return response.jobReference
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _start_query_job(self, project_id, query, use_legacy_sql, flatten_results,
job_id, dry_run=False):
reference = bigquery.JobReference(jobId=job_id, projectId=project_id)
request = bigquery.BigqueryJobsInsertRequest(
projectId=project_id,
job=bigquery.Job(
configuration=bigquery.JobConfiguration(
dryRun=dry_run,
query=bigquery.JobConfigurationQuery(
query=query,
useLegacySql=use_legacy_sql,
allowLargeResults=True,
destinationTable=self._get_temp_table(project_id),
flattenResults=flatten_results)),
jobReference=reference))
response = self.client.jobs.Insert(request)
return response.jobReference.jobId
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _get_query_results(self, project_id, job_id,
page_token=None, max_results=10000):
request = bigquery.BigqueryJobsGetQueryResultsRequest(
jobId=job_id, pageToken=page_token, projectId=project_id,
maxResults=max_results)
response = self.client.jobs.GetQueryResults(request)
return response
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_timeout_or_quota_issues_filter)
def _insert_all_rows(self, project_id, dataset_id, table_id, rows,
skip_invalid_rows=False):
"""Calls the insertAll BigQuery API endpoint.
Docs for this BQ call: https://cloud.google.com/bigquery/docs/reference\
/rest/v2/tabledata/insertAll."""
# The rows argument is a list of
# bigquery.TableDataInsertAllRequest.RowsValueListEntry instances as
# required by the InsertAll() method.
request = bigquery.BigqueryTabledataInsertAllRequest(
projectId=project_id, datasetId=dataset_id, tableId=table_id,
tableDataInsertAllRequest=bigquery.TableDataInsertAllRequest(
skipInvalidRows=skip_invalid_rows,
# TODO(silviuc): Should have an option for ignoreUnknownValues?
rows=rows))
response = self.client.tabledata.InsertAll(request)
# response.insertErrors is not [] if errors encountered.
return not response.insertErrors, response.insertErrors
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_table(self, project_id, dataset_id, table_id):
"""Lookup a table's metadata object.
Args:
client: bigquery.BigqueryV2 instance
project_id, dataset_id, table_id: table lookup parameters
Returns:
bigquery.Table instance
Raises:
HttpError if lookup failed.
"""
request = bigquery.BigqueryTablesGetRequest(
projectId=project_id, datasetId=dataset_id, tableId=table_id)
response = self.client.tables.Get(request)
return response
def _create_table(self, project_id, dataset_id, table_id, schema):
table = bigquery.Table(
tableReference=bigquery.TableReference(
projectId=project_id, datasetId=dataset_id, tableId=table_id),
schema=schema)
request = bigquery.BigqueryTablesInsertRequest(
projectId=project_id, datasetId=dataset_id, table=table)
response = self.client.tables.Insert(request)
logging.debug("Created the table with id %s", table_id)
# The response is a bigquery.Table instance.
return response
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_or_create_dataset(self, project_id, dataset_id, location=None):
# Check if dataset already exists otherwise create it
try:
dataset = self.client.datasets.Get(bigquery.BigqueryDatasetsGetRequest(
projectId=project_id, datasetId=dataset_id))
return dataset
except HttpError as exn:
if exn.status_code == 404:
dataset_reference = bigquery.DatasetReference(
projectId=project_id, datasetId=dataset_id)
dataset = bigquery.Dataset(datasetReference=dataset_reference)
if location is not None:
dataset.location = location
request = bigquery.BigqueryDatasetsInsertRequest(
projectId=project_id, dataset=dataset)
response = self.client.datasets.Insert(request)
# The response is a bigquery.Dataset instance.
return response
else:
raise
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _is_table_empty(self, project_id, dataset_id, table_id):
request = bigquery.BigqueryTabledataListRequest(
projectId=project_id, datasetId=dataset_id, tableId=table_id,
maxResults=1)
response = self.client.tabledata.List(request)
# The response is a bigquery.TableDataList instance.
return response.totalRows == 0
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _delete_table(self, project_id, dataset_id, table_id):
request = bigquery.BigqueryTablesDeleteRequest(
projectId=project_id, datasetId=dataset_id, tableId=table_id)
try:
self.client.tables.Delete(request)
except HttpError as exn:
if exn.status_code == 404:
logging.warning('Table %s:%s.%s does not exist', project_id,
dataset_id, table_id)
return
else:
raise
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def _delete_dataset(self, project_id, dataset_id, delete_contents=True):
request = bigquery.BigqueryDatasetsDeleteRequest(
projectId=project_id, datasetId=dataset_id,
deleteContents=delete_contents)
try:
self.client.datasets.Delete(request)
except HttpError as exn:
if exn.status_code == 404:
logging.warning('Dataset %s:%s does not exist', project_id,
dataset_id)
return
else:
raise
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_table_location(self, project_id, dataset_id, table_id):
table = self.get_table(project_id, dataset_id, table_id)
return table.location
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def create_temporary_dataset(self, project_id, location):
dataset_id = BigQueryWrapper.TEMP_DATASET + self._temporary_table_suffix
# Check if dataset exists to make sure that the temporary id is unique
try:
self.client.datasets.Get(bigquery.BigqueryDatasetsGetRequest(
projectId=project_id, datasetId=dataset_id))
if project_id is not None:
# Unittests don't pass projectIds so they can be run without error
raise RuntimeError(
'Dataset %s:%s already exists so cannot be used as temporary.'
% (project_id, dataset_id))
except HttpError as exn:
if exn.status_code == 404:
logging.warning(
'Dataset %s:%s does not exist so we will create it as temporary '
'with location=%s',
project_id, dataset_id, location)
self.get_or_create_dataset(project_id, dataset_id, location=location)
else:
raise
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def clean_up_temporary_dataset(self, project_id):
temp_table = self._get_temp_table(project_id)
try:
self.client.datasets.Get(bigquery.BigqueryDatasetsGetRequest(
projectId=project_id, datasetId=temp_table.datasetId))
except HttpError as exn:
if exn.status_code == 404:
logging.warning('Dataset %s:%s does not exist', project_id,
temp_table.datasetId)
return
else:
raise
self._delete_dataset(temp_table.projectId, temp_table.datasetId, True)
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_job(self, project, job_id, location=None):
request = bigquery.BigqueryJobsGetRequest()
request.jobId = job_id
request.projectId = project
request.location = location
return self.client.jobs.Get(request)
def perform_load_job(self,
destination,
files,
job_id,
schema=None,
write_disposition=None,
create_disposition=None):
"""Starts a job to load data into BigQuery.
Returns:
bigquery.JobReference with the information about the job that was started.
"""
return self._insert_load_job(
destination.projectId, job_id, destination, files,
schema=schema,
create_disposition=create_disposition,
write_disposition=write_disposition)
@retry.with_exponential_backoff(
num_retries=MAX_RETRIES,
retry_filter=retry.retry_on_server_errors_and_timeout_filter)
def get_or_create_table(
self, project_id, dataset_id, table_id, schema,
create_disposition, write_disposition):
"""Gets or creates a table based on create and write dispositions.
The function mimics the behavior of BigQuery import jobs when using the
same create and write dispositions.
Args:
project_id: The project id owning the table.
dataset_id: The dataset id owning the table.
table_id: The table id.
schema: A bigquery.TableSchema instance or None.
create_disposition: CREATE_NEVER or CREATE_IF_NEEDED.
write_disposition: WRITE_APPEND, WRITE_EMPTY or WRITE_TRUNCATE.
Returns:
A bigquery.Table instance if table was found or created.
Raises:
RuntimeError: For various mismatches between the state of the table and
the create/write dispositions passed in. For example if the table is not
empty and WRITE_EMPTY was specified then an error will be raised since
the table was expected to be empty.
"""
from apache_beam.io.gcp.bigquery import BigQueryDisposition
found_table = None
try:
found_table = self.get_table(project_id, dataset_id, table_id)
except HttpError as exn:
if exn.status_code == 404:
if create_disposition == BigQueryDisposition.CREATE_NEVER:
raise RuntimeError(
'Table %s:%s.%s not found but create disposition is CREATE_NEVER.'
% (project_id, dataset_id, table_id))
else:
raise
# If table exists already then handle the semantics for WRITE_EMPTY and
# WRITE_TRUNCATE write dispositions.
if found_table:
table_empty = self._is_table_empty(project_id, dataset_id, table_id)
if (not table_empty and
write_disposition == BigQueryDisposition.WRITE_EMPTY):
raise RuntimeError(
'Table %s:%s.%s is not empty but write disposition is WRITE_EMPTY.'
% (project_id, dataset_id, table_id))
# Delete the table and recreate it (later) if WRITE_TRUNCATE was
# specified.
if write_disposition == BigQueryDisposition.WRITE_TRUNCATE:
self._delete_table(project_id, dataset_id, table_id)
# Create a new table potentially reusing the schema from a previously
# found table in case the schema was not specified.
if schema is None and found_table is None:
raise RuntimeError(
'Table %s:%s.%s requires a schema. None can be inferred because the '
'table does not exist.'
% (project_id, dataset_id, table_id))
if found_table and write_disposition != BigQueryDisposition.WRITE_TRUNCATE:
return found_table
else:
created_table = self._create_table(project_id=project_id,
dataset_id=dataset_id,
table_id=table_id,
schema=schema or found_table.schema)
logging.info('Created table %s.%s.%s with schema %s. Result: %s.',
project_id, dataset_id, table_id,
schema or found_table.schema,
created_table)
# if write_disposition == BigQueryDisposition.WRITE_TRUNCATE we delete
# the table before this point.
if write_disposition == BigQueryDisposition.WRITE_TRUNCATE:
# BigQuery can route data to the old table for 2 mins max so wait
# that much time before creating the table and writing it
logging.warning('Sleeping for 150 seconds before the write as ' +
'BigQuery inserts can be routed to deleted table ' +
'for 2 mins after the delete and create.')
# TODO(BEAM-2673): Remove this sleep by migrating to load api
time.sleep(150)
return created_table
else:
return created_table
def run_query(self, project_id, query, use_legacy_sql, flatten_results,
dry_run=False):
job_id = self._start_query_job(project_id, query, use_legacy_sql,
flatten_results, job_id=uuid.uuid4().hex,
dry_run=dry_run)
if dry_run:
# If this was a dry run then the fact that we get here means the
# query has no errors. The start_query_job would raise an error otherwise.
return
page_token = None
while True:
response = self._get_query_results(project_id, job_id, page_token)
if not response.jobComplete:
# The jobComplete field can be False if the query request times out
# (default is 10 seconds). Note that this is a timeout for the query
# request not for the actual execution of the query in the service. If
# the request times out we keep trying. This situation is quite possible
# if the query will return a large number of rows.
logging.info('Waiting on response from query: %s ...', query)
time.sleep(1.0)
continue
# We got some results. The last page is signalled by a missing pageToken.
yield response.rows, response.schema
if not response.pageToken:
break
page_token = response.pageToken
def insert_rows(self, project_id, dataset_id, table_id, rows,
skip_invalid_rows=False):
"""Inserts rows into the specified table.
Args:
project_id: The project id owning the table.
dataset_id: The dataset id owning the table.
table_id: The table id.
rows: A list of plain Python dictionaries. Each dictionary is a row and
each key in it is the name of a field.
skip_invalid_rows: If there are rows with insertion errors, whether they
should be skipped, and all others should be inserted successfully.
Returns:
A tuple (bool, errors). If first element is False then the second element
will be a bigquery.InserttErrorsValueListEntry instance containing
specific errors.
"""
# Prepare rows for insertion. Of special note is the row ID that we add to
# each row in order to help BigQuery avoid inserting a row multiple times.
# BigQuery will do a best-effort if unique IDs are provided. This situation
# can happen during retries on failures.
# TODO(silviuc): Must add support to writing TableRow's instead of dicts.
final_rows = []
for row in rows:
json_object = bigquery.JsonObject()
for k, v in iteritems(row):
if isinstance(v, decimal.Decimal):
# decimal values are converted into string because JSON does not
# support the precision that decimal supports. BQ is able to handle
# inserts into NUMERIC columns by receiving JSON with string attrs.
v = str(v)
json_object.additionalProperties.append(
bigquery.JsonObject.AdditionalProperty(
key=k, value=to_json_value(v)))
final_rows.append(
bigquery.TableDataInsertAllRequest.RowsValueListEntry(
insertId=str(self.unique_row_id),
json=json_object))
result, errors = self._insert_all_rows(
project_id, dataset_id, table_id, final_rows, skip_invalid_rows)
return result, errors
def _convert_cell_value_to_dict(self, value, field):
if field.type == 'STRING':
# Input: "XYZ" --> Output: "XYZ"
return value
elif field.type == 'BOOLEAN':
# Input: "true" --> Output: True
return value == 'true'
elif field.type == 'INTEGER':
# Input: "123" --> Output: 123
return int(value)
elif field.type == 'FLOAT':
# Input: "1.23" --> Output: 1.23
return float(value)
elif field.type == 'TIMESTAMP':
# The UTC should come from the timezone library but this is a known
# issue in python 2.7 so we'll just hardcode it as we're reading using
# utcfromtimestamp.
# Input: 1478134176.985864 --> Output: "2016-11-03 00:49:36.985864 UTC"
dt = datetime.datetime.utcfromtimestamp(float(value))
return dt.strftime('%Y-%m-%d %H:%M:%S.%f UTC')
elif field.type == 'BYTES':
# Input: "YmJi" --> Output: "YmJi"
return value
elif field.type == 'DATE':
# Input: "2016-11-03" --> Output: "2016-11-03"
return value
elif field.type == 'DATETIME':
# Input: "2016-11-03T00:49:36" --> Output: "2016-11-03T00:49:36"
return value
elif field.type == 'TIME':
# Input: "00:49:36" --> Output: "00:49:36"
return value
elif field.type == 'RECORD':
# Note that a schema field object supports also a RECORD type. However
# when querying, the repeated and/or record fields are flattened
# unless we pass the flatten_results flag as False to the source
return self.convert_row_to_dict(value, field)
elif field.type == 'NUMERIC':
return decimal.Decimal(value)
elif field.type == 'GEOGRAPHY':
return value
else:
raise RuntimeError('Unexpected field type: %s' % field.type)
def convert_row_to_dict(self, row, schema):
"""Converts a TableRow instance using the schema to a Python dict."""
result = {}
for index, field in enumerate(schema.fields):
value = None
if isinstance(schema, bigquery.TableSchema):
cell = row.f[index]
value = from_json_value(cell.v) if cell.v is not None else None
elif isinstance(schema, bigquery.TableFieldSchema):
cell = row['f'][index]
value = cell['v'] if 'v' in cell else None
if field.mode == 'REPEATED':
if value is None:
# Ideally this should never happen as repeated fields default to
# returning an empty list
result[field.name] = []
else:
result[field.name] = [self._convert_cell_value_to_dict(x['v'], field)
for x in value]
elif value is None:
if not field.mode == 'NULLABLE':
raise ValueError('Received \'None\' as the value for the field %s '
'but the field is not NULLABLE.' % field.name)
result[field.name] = None
else:
result[field.name] = self._convert_cell_value_to_dict(value, field)
return result
# -----------------------------------------------------------------------------
# BigQueryReader, BigQueryWriter.
class BigQueryReader(dataflow_io.NativeSourceReader):
"""A reader for a BigQuery source."""
def __init__(self, source, test_bigquery_client=None, use_legacy_sql=True,
flatten_results=True, kms_key=None):
self.source = source
self.test_bigquery_client = test_bigquery_client
if auth.is_running_in_gce:
self.executing_project = auth.executing_project
elif hasattr(source, 'pipeline_options'):
self.executing_project = (
source.pipeline_options.view_as(GoogleCloudOptions).project)
else:
self.executing_project = None
# TODO(silviuc): Try to automatically get it from gcloud config info.
if not self.executing_project and test_bigquery_client is None:
raise RuntimeError(
'Missing executing project information. Please use the --project '
'command line option to specify it.')
self.row_as_dict = isinstance(self.source.coder, RowAsDictJsonCoder)
# Schema for the rows being read by the reader. It is initialized the
# first time something gets read from the table. It is not required
# for reading the field values in each row but could be useful for
# getting additional details.
self.schema = None
self.use_legacy_sql = use_legacy_sql
self.flatten_results = flatten_results
self.kms_key = kms_key
if self.source.table_reference is not None:
# If table schema did not define a project we default to executing
# project.
project_id = self.source.table_reference.projectId
if not project_id:
project_id = self.executing_project
self.query = 'SELECT * FROM [%s:%s.%s];' % (
project_id,
self.source.table_reference.datasetId,
self.source.table_reference.tableId)
elif self.source.query is not None:
self.query = self.source.query
else:
# Enforce the "modes" enforced by BigQuerySource.__init__.
# If this exception has been raised, the BigQuerySource "modes" have
# changed and this method will need to be updated as well.
raise ValueError("BigQuerySource must have either a table or query")
def _get_source_location(self):
"""
Get the source location (e.g. ``"EU"`` or ``"US"``) from either
- :data:`source.table_reference`
or
- The first referenced table in :data:`source.query`
See Also:
- :meth:`BigQueryWrapper.get_query_location`
- :meth:`BigQueryWrapper.get_table_location`
Returns:
Optional[str]: The source location, if any.
"""
if self.source.table_reference is not None:
tr = self.source.table_reference
return self.client.get_table_location(
tr.projectId if tr.projectId is not None else self.executing_project,
tr.datasetId, tr.tableId)
else: # It's a query source
return self.client.get_query_location(
self.executing_project,
self.source.query,
self.source.use_legacy_sql)
def __enter__(self):
self.client = BigQueryWrapper(client=self.test_bigquery_client)
self.client.create_temporary_dataset(
self.executing_project, location=self._get_source_location())
return self
def __exit__(self, exception_type, exception_value, traceback):
self.client.clean_up_temporary_dataset(self.executing_project)
def __iter__(self):
for rows, schema in self.client.run_query(
project_id=self.executing_project, query=self.query,
use_legacy_sql=self.use_legacy_sql,
flatten_results=self.flatten_results):
if self.schema is None:
self.schema = schema
for row in rows:
if self.row_as_dict:
yield self.client.convert_row_to_dict(row, schema)
else:
yield row
class BigQueryWriter(dataflow_io.NativeSinkWriter):
"""The sink writer for a BigQuerySink."""
def __init__(self, sink, test_bigquery_client=None, buffer_size=None):
self.sink = sink
self.test_bigquery_client = test_bigquery_client
self.row_as_dict = isinstance(self.sink.coder, RowAsDictJsonCoder)
# Buffer used to batch written rows so we reduce communication with the
# BigQuery service.
self.rows_buffer = []
self.rows_buffer_flush_threshold = buffer_size or 1000
# Figure out the project, dataset, and table used for the sink.
self.project_id = self.sink.table_reference.projectId
# If table schema did not define a project we default to executing project.
if self.project_id is None and hasattr(sink, 'pipeline_options'):
self.project_id = (
sink.pipeline_options.view_as(GoogleCloudOptions).project)
assert self.project_id is not None
self.dataset_id = self.sink.table_reference.datasetId
self.table_id = self.sink.table_reference.tableId
def _flush_rows_buffer(self):
if self.rows_buffer:
logging.info('Writing %d rows to %s:%s.%s table.', len(self.rows_buffer),
self.project_id, self.dataset_id, self.table_id)
passed, errors = self.client.insert_rows(
project_id=self.project_id, dataset_id=self.dataset_id,
table_id=self.table_id, rows=self.rows_buffer)
self.rows_buffer = []
if not passed:
raise RuntimeError('Could not successfully insert rows to BigQuery'
' table [%s:%s.%s]. Errors: %s' %
(self.project_id, self.dataset_id,
self.table_id, errors))
def __enter__(self):
self.client = BigQueryWrapper(client=self.test_bigquery_client)
self.client.get_or_create_table(
self.project_id, self.dataset_id, self.table_id, self.sink.table_schema,
self.sink.create_disposition, self.sink.write_disposition)
return self
def __exit__(self, exception_type, exception_value, traceback):
self._flush_rows_buffer()
def Write(self, row):
self.rows_buffer.append(row)
if len(self.rows_buffer) > self.rows_buffer_flush_threshold:
self._flush_rows_buffer()
class RowAsDictJsonCoder(coders.Coder):
"""A coder for a table row (represented as a dict) to/from a JSON string.
This is the default coder for sources and sinks if the coder argument is not
specified.
"""
def encode(self, table_row):
# The normal error when dumping NAN/INF values is:
# ValueError: Out of range float values are not JSON compliant
# This code will catch this error to emit an error that explains
# to the programmer that they have used NAN/INF values.
try:
return json.dumps(
table_row, allow_nan=False, default=default_encoder).encode('utf-8')
except ValueError as e:
raise ValueError('%s. %s' % (e, JSON_COMPLIANCE_ERROR))
def decode(self, encoded_table_row):
return json.loads(encoded_table_row.decode('utf-8'))
class RetryStrategy(object):
RETRY_ALWAYS = 'RETRY_ALWAYS'
RETRY_NEVER = 'RETRY_NEVER'
RETRY_ON_TRANSIENT_ERROR = 'RETRY_ON_TRANSIENT_ERROR'
_NON_TRANSIENT_ERRORS = {'invalid', 'invalidQuery', 'notImplemented'}
@staticmethod
def should_retry(strategy, error_message):
if strategy == RetryStrategy.RETRY_ALWAYS:
return True
elif strategy == RetryStrategy.RETRY_NEVER:
return False
elif (strategy == RetryStrategy.RETRY_ON_TRANSIENT_ERROR and
error_message not in RetryStrategy._NON_TRANSIENT_ERRORS):
return True
else:
return False
class AppendDestinationsFn(DoFn):
"""Adds the destination to an element, making it a KV pair.
Outputs a PCollection of KV-pairs where the key is a TableReference for the
destination, and the value is the record itself.
Experimental; no backwards compatibility guarantees.
"""
def __init__(self, destination):
self.destination = AppendDestinationsFn._get_table_fn(destination)
@staticmethod
def _value_provider_or_static_val(elm):
if isinstance(elm, value_provider.ValueProvider):
return elm
else:
# The type argument is a NoOp, because we assume the argument already has
# the proper formatting.
return value_provider.StaticValueProvider(lambda x: x, value=elm)
@staticmethod
def _get_table_fn(destination):
if callable(destination):
return destination
else:
return lambda x: AppendDestinationsFn._value_provider_or_static_val(
destination).get()
def process(self, element):
yield (self.destination(element), element)
| 39.095101 | 80 | 0.685832 | 1 | 1.9491 | [
-0.04140648990869522,
0.07823502272367477,
0.013361720368266106,
0.03490786254405975,
0.0011002051178365946,
-0.014349092729389668,
0.003045068122446537,
0.0064514572732150555,
-0.03929084166884422,
0.01982955075800419,
0.04401068761944771,
0.006779321935027838,
-0.0056323218159377575,
-0.02076171338558197,
0.028787899762392044,
0.005807955749332905,
0.008584131486713886,
0.014694755896925926,
-0.006261694245040417,
0.02088221162557602,
0.01973886787891388,
-0.004013853147625923,
0.020730920135974884,
0.025412073358893394,
-0.021273786202073097,
0.018399495631456375,
0.007286321371793747,
0.031692586839199066,
0.00679380539804697,
-0.03995271027088165,
0.009849250316619873,
-0.035440415143966675,
-0.054943110793828964,
-0.021316012367606163,
0.016908111050724983,
0.007144168484956026,
-0.01321071945130825,
-0.04355182871222496,
0.0068669128231704235,
-0.017398562282323837,
-0.006206819321960211,
0.0006759212701581419,
-0.017601758241653442,
0.011062338948249817,
0.00869771745055914,
-0.020435860380530357,
0.02442563883960247,
-0.014003729447722435,
0.006776541471481323,
-0.01937081478536129,
-0.030649591237306595,
-0.013722418807446957,
0.006274152547121048,
-0.032635223120450974,
0.04156480357050896,
0.004156266339123249,
-0.0007185271242633462,
-0.0238729789853096,
-0.011648587882518768,
0.013599135912954807,
-0.017879966646432877,
0.012244722805917263,
0.019979773089289665,
-0.024352939799427986,
-0.02776309661567211,
-0.02644304931163788,
-0.01617318019270897,
0.030555326491594315,
-0.01085975393652916,
0.00997911673039198,
-0.020316146314144135,
0.006251197773963213,
-0.04634023457765579,
0.018027886748313904,
-0.0307463351637125,
-0.004994432907551527,
-0.006868442520499229,
-0.018569890409708023,
0.003518188139423728,
0.017856769263744354,
-0.000022205276763997972,
0.054952315986156464,
-0.0040001231245696545,
0.006030728574842215,
0.008234133012592793,
0.0211752038449049,
0.05822663754224777,
-0.042819708585739136,
0.04257502034306526,
-0.009647629223763943,
-0.02070735953748226,
0.0008558205445297062,
-0.038780637085437775,
-0.023794839158654213,
0.0006774323410354555,
-0.032136470079422,
0.009901883080601692,
0.0013705040328204632,
0.005548966582864523,
-0.01475408673286438,
0.030954664573073387,
0.017324939370155334,
0.04005832225084305,
-0.00152575911488384,
-0.012796944938600063,
-0.02341056428849697,
-0.02378186397254467,
-0.0047019170597195625,
0.01696334034204483,
-0.004387461580336094,
-0.06560163199901581,
0.009360593743622303,
0.004842168651521206,
-0.010655749589204788,
0.014584475196897984,
-0.010426660068333149,
0.017141198739409447,
0.00035687771742232144,
0.008075734600424767,
0.05023963376879692,
0.026465479284524918,
0.0020380772184580564,
0.02181123197078705,
0.005642575677484274,
-0.0018861230928450823,
0.08202604949474335,
-0.015358495526015759,
0.01580086350440979,
0.0047168368473649025,
-0.0005928738974034786,
0.002011319622397423,
0.009862962178885937,
-0.015820728614926338,
-0.014546355232596397,
0.023081084713339806,
-0.017299547791481018,
-0.00032030747388489544,
0.017717914655804634,
-0.03904670849442482,
0.007960915565490723,
0.025611013174057007,
-0.014069169759750366,
-0.012961783446371555,
-0.0343773178756237,
0.015541397966444492,
-0.012755202129483223,
-0.027459967881441116,
0.017980996519327164,
-0.021989883854985237,
-0.003573223715648055,
0.02929687686264515,
0.0057784090749919415,
0.010087615810334682,
-0.003818928962573409,
-0.006939950864762068,
-0.010968082584440708,
0.003824732732027769,
-0.07637248933315277,
0.01422880869358778,
0.023179393261671066,
0.0033612577244639397,
-0.014837805181741714,
0.024503877386450768,
-0.006819620728492737,
0.04131634533405304,
0.016713012009859085,
0.0166398286819458,
0.019624877721071243,
-0.0023804628290235996,
0.0025211062747985125,
-0.01615360751748085,
-0.024706708267331123,
-0.044038236141204834,
0.005513257812708616,
-0.015193506143987179,
-0.013332531787455082,
0.019173795357346535,
0.0009944842895492911,
0.025284476578235626,
0.006449008826166391,
0.015200648456811905,
-0.033765874803066254,
0.03219427540898323,
-0.005630854982882738,
0.00556831294670701,
-0.013482736423611641,
-0.0571369044482708,
-0.048217061907052994,
0.014291636645793915,
0.020667437463998795,
-0.012159604579210281,
0.03440796583890915,
-0.0327579528093338,
-0.00027706442051567137,
0.030391011387109756,
-0.018448416143655777,
-0.007487921044230461,
0.015131769701838493,
-0.02317308448255062,
0.04217718169093132,
-0.012213452719151974,
0.009433901868760586,
-0.040047820657491684,
-0.00834477599710226,
0.01209175679832697,
0.013082338497042656,
-0.7273194789886475,
0.03067491576075554,
-0.011871292255818844,
0.006046667229384184,
-0.028239546343684196,
0.013336289674043655,
0.004368682857602835,
0.034371234476566315,
-0.013462893664836884,
0.011737859807908535,
0.011238654144108295,
-0.02238317020237446,
-0.02622297964990139,
0.0048834178596735,
0.02129693701863289,
0.048315878957509995,
-0.01114863995462656,
-0.026398710906505585,
-0.01128087006509304,
-0.011232888326048851,
0.02357850968837738,
-0.03105391375720501,
-0.016187261790037155,
-0.014636710286140442,
-0.0031052627600729465,
-0.003043033881112933,
0.01690877228975296,
-0.04097265377640724,
-0.019787248224020004,
0.03829610347747803,
-0.010237455368041992,
0.004210381768643856,
-0.006060347426682711,
0.010953093878924847,
0.004086173139512539,
0.006316615734249353,
0.02499983087182045,
-0.029323680326342583,
0.0858316645026207,
-0.006484609097242355,
-0.03777482360601425,
-0.005391562823206186,
-0.02855725958943367,
-0.07215986400842667,
-0.0068308040499687195,
0.011149796657264233,
0.055355254560709,
0.017622115090489388,
-0.002464341465383768,
0.004765783436596394,
-0.046347640454769135,
-0.047297243028879166,
0.02006526105105877,
-0.02232293412089348,
0.0278424434363842,
0.00954595860093832,
0.01409145724028349,
-0.002607519505545497,
-0.023751918226480484,
-0.006155107170343399,
0.015069019980728626,
-0.00819503702223301,
-0.01338957343250513,
0.013735812157392502,
-0.007645659614354372,
-0.0006145116640254855,
0.03533586114645004,
-0.029186254367232323,
-0.011202096939086914,
0.023089777678251266,
-0.05279045179486275,
-0.013068373315036297,
-0.0263248048722744,
-0.0007374183624051511,
-0.013359427452087402,
0.018513929098844528,
0.030667204409837723,
-0.0204888004809618,
-0.04688289761543274,
-0.0014201243175193667,
0.03124922141432762,
-0.005358043592423201,
0.008051261305809021,
-0.031078308820724487,
-0.028137395158410072,
-0.008585641160607338,
0.003952383063733578,
-0.003978048451244831,
0.020917760208249092,
-0.026986978948116302,
0.002915270859375596,
-0.003815415082499385,
0.022490695118904114,
0.02223471738398075,
0.0022343064192682505,
0.014201466925442219,
0.05285479128360748,
0.02081136591732502,
-0.000906173256225884,
0.05503975600004196,
0.01516111008822918,
-0.022634290158748627,
-0.018599020317196846,
0.02859937585890293,
-0.038770515471696854,
0.006036091595888138,
-0.02983168512582779,
0.0003314104105811566,
0.046986520290374756,
-0.02147606387734413,
-0.008150160312652588,
-0.016475094482302666,
-0.04292086884379387,
-0.033908091485500336,
-0.014787732623517513,
-0.010532363317906857,
-0.03168652206659317,
-0.023542406037449837,
-0.009428178891539574,
0.008931517601013184,
-0.01176972221583128,
-0.013104978017508984,
0.055824004113674164,
0.004814539570361376,
-0.015409255400300026,
0.02821609191596508,
0.012393496930599213,
0.006693234201520681,
0.024615563452243805,
0.02116737700998783,
-0.06342416256666183,
-0.02918366529047489,
0.0015872303629294038,
-0.05889737233519554,
-0.0031711659394204617,
0.04390960931777954,
-0.01690325140953064,
-0.03838164359331131,
0.003920766059309244,
-0.012688150629401207,
-0.041131798177957535,
0.018329482525587082,
0.03295917809009552,
-0.020840970799326897,
0.01860649697482586,
0.009743339382112026,
0.03694024309515953,
-0.0065837581641972065,
-0.03610415756702423,
-0.009060859680175781,
0.010324520990252495,
0.031168190762400627,
0.027061544358730316,
0.010771767236292362,
-0.018811196088790894,
0.007956894114613533,
-0.04520420730113983,
-0.012063364498317242,
0.007063806522637606,
-0.01255475077778101,
-0.01545172743499279,
-0.040096867829561234,
0.01123835425823927,
0.015512056648731232,
0.00336250988766551,
0.007570125162601471,
-0.028167447075247765,
-0.025282179936766624,
0.007317923009395599,
0.05476906895637512,
0.015418557450175285,
0.01898249238729477,
0.004106838721781969,
0.029792850837111473,
-0.0005982823204249144,
0.01106458529829979,
-0.0005080513656139374,
0.008852620609104633,
-0.005166234448552132,
-0.0008429097360931337,
-0.021465154364705086,
0.02127814292907715,
-0.009750384837388992,
-0.050023142248392105,
-0.01396283507347107,
-0.04172470420598984,
-0.0058891745284199715,
-0.004777902737259865,
0.011681834235787392,
-0.04466303065419197,
0.007735845632851124,
0.030408084392547607,
-0.03949431702494621,
-0.016187576577067375,
0.020006053149700165,
0.0006922527099959552,
-0.0006351240444928408,
-0.02429986745119095,
-0.04794476553797722,
0.0016052044229581952,
0.0023626855108886957,
-0.005933438893407583,
0.031440310180187225,
-0.002395683666691184,
0.008267583325505257,
0.029019879177212715,
0.0018794923089444637,
-0.003751317271962762,
-0.033183760941028595,
0.003340361174196005,
-0.015481473878026009,
0.020783456042408943,
0.02223239094018936,
0.023035019636154175,
0.011420592665672302,
-0.029247045516967773,
-0.041306257247924805,
-0.0057243462651968,
0.011844984255731106,
0.008636916987597942,
0.0014731099363416433,
-0.022056590765714645,
0.02243231050670147,
0.005124224349856377,
-0.0017802894581109285,
-0.04529336467385292,
-0.016391703858971596,
0.018388476222753525,
-0.018542395904660225,
-0.061934731900691986,
0.02108890190720558,
-0.021559519693255424,
0.010668154805898666,
-0.02289723791182041,
0.021994508802890778,
0.021488742902874947,
0.018209077417850494,
-0.01670709252357483,
0.0069810207933187485,
-0.011095764115452766,
-0.014917923137545586,
-0.03020378202199936,
-0.0035564422141760588,
0.015524577349424362,
-0.02035580947995186,
-0.00873387698084116,
-0.025276506319642067,
-0.037630606442689896,
0.004699294921010733,
0.006854015868157148,
-0.05553743243217468,
0.03642640635371208,
-0.012030696496367455,
-0.0032434873282909393,
0.016178233548998833,
-0.012982495129108429,
-0.014161169528961182,
0.019486309960484505,
0.025012841448187828,
0.0004493953019846231,
0.037701331079006195,
-0.0308968685567379,
0.04294505715370178,
0.00708617502823472,
0.03411586210131645,
0.019290022552013397,
0.006207277532666922,
-0.008721631020307541,
-0.03071540594100952,
-0.002665976295247674,
-0.03697415813803673,
-0.004319797735661268,
-0.022123971953988075,
-0.012998566962778568,
0.006438331678509712,
0.016340486705303192,
0.0062204403802752495,
0.0039738877676427364,
0.019303498789668083,
0.06681377440690994,
0.0018697355408221483,
-0.014751583337783813,
-0.03779706731438637,
-0.004741141106933355,
-0.016472328454256058,
0.00785114150494337,
-0.021812137216329575,
-0.013445346616208553,
-0.027802124619483948,
-0.020106852054595947,
-0.007565842941403389,
0.04362507909536362,
0.031421490013599396,
0.006120765116065741,
0.0022236278746277094,
-0.016007816419005394,
0.01514383777976036,
0.012960911728441715,
-0.007970592938363552,
-0.019155019894242287,
0.022262858226895332,
-0.004996527452021837,
-0.06514793634414673,
-0.027044087648391724,
0.019122889265418053,
0.0017288492526859045,
-0.006832411978393793,
-0.033536698669195175,
0.03336130082607269,
-0.009424548596143723,
-0.005461337510496378,
0.04188954085111618,
0.0007422928465530276,
0.020028168335556984,
0.013478013686835766,
-0.025175288319587708,
0.022330965846776962,
0.0026954486966133118,
-0.018639590591192245,
-0.010613230057060719,
-0.02839161828160286,
0.019057244062423706,
-0.03232293576002121,
0.004620769061148167,
-0.007993653416633606,
0.026068609207868576,
-0.04203879088163376,
0.032323919236660004,
0.02911299653351307,
-0.027674807235598564,
-0.05051572620868683,
-0.005808580666780472,
0.03014928102493286,
0.0040228841826319695,
0.045587312430143356,
-0.014165101572871208,
0.015782948583364487,
0.04134711995720863,
0.018303290009498596,
0.015583486296236515,
0.015600607730448246,
0.04604140669107437,
-0.023139609023928642,
0.007891937159001827,
0.007612341083586216,
-0.004471592139452696,
-0.008976513519883156,
0.05708048865199089,
0.0018891319632530212,
0.0031857250723987818,
-0.002533343154937029,
-0.016232024878263474,
-0.0018374924547970295,
-0.014022455550730228,
-0.0022750385105609894,
-0.012350351549685001,
-0.019939487800002098,
-0.02088681235909462,
0.0021915810648351908,
0.011293836869299412,
0.03025035746395588,
0.013050328940153122,
-0.004429110325872898,
0.016996096819639206,
-0.03175733983516693,
0.00116219581104815,
0.03032761439681053,
-0.035530805587768555,
-0.01971900276839733,
0.03683183714747429,
-0.0072157601825892925,
-0.02852487936615944,
0.01298903115093708,
0.018315410241484642,
-0.004555184859782457,
0.0511833131313324,
-0.010569576174020767,
0.031670667231082916,
-0.012321715243160725,
-0.004426672589033842,
0.014039849862456322,
0.012570364400744438,
0.015019673854112625,
-0.0205566193908453,
-0.031545717269182205,
0.021054832264780998,
0.01067288313060999,
0.03261908143758774,
-0.03557678312063217,
-0.039425428956747055,
-0.022277789190411568,
-0.014554024673998356,
0.012015968561172485,
-0.015215889550745487,
-0.014697232283651829,
0.02153102308511734,
-0.03146190568804741,
0.001699183601886034,
0.023013897240161896,
0.01188819669187069,
0.021505208685994148,
0.02518041618168354,
-0.0028895330615341663,
-0.00047730570076964796,
0.045891355723142624,
-0.05459626019001007,
-0.0007306031766347587,
-0.010526972822844982,
0.0012208400294184685,
0.017846912145614624,
0.019885994493961334,
-0.01611567847430706,
-0.02432878687977791,
-0.030398370698094368,
0.010245024226605892,
0.029571333900094032,
-0.03492870181798935,
-0.026853153482079506,
-0.026246532797813416,
0.03455466032028198,
-0.014432359486818314,
0.00378600531257689,
-0.005375727545469999,
-0.005163892637938261,
-0.0022247699089348316,
-0.05901622027158737,
0.008419455960392952,
-0.009529280476272106,
-0.00465222354978323,
0.030409548431634903,
0.03327934071421623,
0.01092594489455223,
-0.015933526679873466,
-0.03579898178577423,
0.03372391313314438,
-0.026931781321763992,
-0.04202434793114662,
0.03153657913208008,
-0.034663669764995575,
0.01906667836010456,
0.005376913119107485,
0.0037995437160134315,
0.0009482614696025848,
0.039460211992263794,
0.027989182621240616,
-0.11196544766426086,
0.00304076517932117,
0.029777459800243378,
0.009317087940871716,
-0.014347868971526623,
0.03036840260028839,
0.02571024000644684,
0.0018161421176046133,
0.035219863057136536,
0.044214747846126556,
0.03241401165723801,
-0.02495165728032589,
0.008658514358103275,
0.036109808832407,
0.00459431204944849,
-0.038281332701444626,
0.016574116423726082,
-0.032178282737731934,
0.019321713596582413,
-0.009789528325200081,
0.040895089507102966,
0.0064215525053441525,
0.0014862576499581337,
-0.003740801475942135,
0.027141766622662544,
-0.04047699645161629,
0.02600296400487423,
-0.0027667777612805367,
0.02001899480819702,
-0.023403823375701904,
0.004028011579066515,
-0.015626145526766777,
0.028430581092834473,
0.0195858646184206,
0.0033298530615866184,
0.010503307916224003,
-0.005060908850282431,
0.03167744725942612,
-0.021869398653507233,
0.030094735324382782,
0.005994279403239489,
-0.011404648423194885,
-0.003722122870385647,
0.009400327689945698,
0.004236578941345215,
-0.005274904891848564,
-0.00836434680968523,
0.007633468601852655,
0.051012370735406876,
0.013060328550636768,
0.006642124615609646,
0.02657000720500946,
-0.021380523219704628,
0.030148634687066078,
-0.024855775758624077,
0.06888783723115921,
-0.024472331628203392,
-0.007225243840366602,
-0.036253370344638824,
0.016015488654375076,
0.04845493659377098,
0.02457169070839882,
0.07513241469860077,
0.03456312417984009,
0.00039733145968057215,
-0.024390490725636482,
-0.015556094236671925,
0.011490656062960625,
-0.0036883989814668894,
-0.020807012915611267,
0.015736740082502365,
0.0270408745855093,
-0.012997716665267944,
-0.004120266065001488,
-0.019473034888505936,
-0.0022093201987445354,
0.013118727132678032,
-0.04244030639529228,
-0.006891872268170118,
-0.03392142429947853,
-0.022060150280594826,
-0.05047257989645004,
-0.012600877322256565,
0.02526695840060711,
-0.005022008903324604,
-0.014645014889538288,
-0.010037229396402836,
-0.016627700999379158,
0.01811053790152073,
0.011982067488133907,
-0.01833493448793888,
0.01227833703160286,
0.0397442951798439,
-0.0005794726312160492,
-0.007165480870753527,
0.03618202358484268,
0.04500523954629898,
-0.017354009672999382,
-0.04890400916337967,
-0.023214587941765785,
-0.0012496724957600236,
-0.016582772135734558,
0.01294445339590311,
0.03338552266359329,
-0.009732536971569061,
-0.013353954069316387,
0.006510804407298565,
0.03736073896288872,
0.010971102863550186,
-0.03836013376712799,
-0.01780245639383793,
0.006013453938066959,
0.0012917808489874005,
0.025634199380874634,
-0.022263282909989357,
0.012807260267436504,
0.024501612409949303
] |
8a790aaa3beecccbae1e5fe2d0bb1478dbadd597 | 1,841 | py | Python | VENV/lib/python3.6/site-packages/PyInstaller/hooks/hook-PyQt5.py | workingyifei/display-pattern-generator | b27be84c6221fa93833f283109870737b05bfbf6 | [
"MIT"
] | 3 | 2018-11-27T06:30:23.000Z | 2021-05-30T15:56:32.000Z | VENV/lib/python3.6/site-packages/PyInstaller/hooks/hook-PyQt5.py | workingyifei/display-pattern-generator | b27be84c6221fa93833f283109870737b05bfbf6 | [
"MIT"
] | 1 | 2018-11-15T02:00:31.000Z | 2021-12-06T02:20:32.000Z | VENV/lib/python3.6/site-packages/PyInstaller/hooks/hook-PyQt5.py | workingyifei/display-pattern-generator | b27be84c6221fa93833f283109870737b05bfbf6 | [
"MIT"
] | 1 | 2020-11-06T18:46:35.000Z | 2020-11-06T18:46:35.000Z | #-----------------------------------------------------------------------------
# Copyright (c) 2005-2017, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
import os
from PyInstaller.utils.hooks import (
get_module_attribute, is_module_satisfies, qt_menu_nib_dir, get_module_file_attribute,
collect_data_files)
from PyInstaller.compat import getsitepackages, is_darwin, is_win
# On Windows system PATH has to be extended to point to the PyQt5 directory.
# The PySide directory contains Qt dlls. We need to avoid including different
# version of Qt libraries when there is installed another application (e.g. QtCreator)
if is_win:
from PyInstaller.utils.win32.winutils import extend_system_path
extend_system_path([os.path.join(x, 'PyQt5') for x in getsitepackages()])
extend_system_path([os.path.join(os.path.dirname(get_module_file_attribute('PyQt5')),
'Qt', 'bin')])
# In the new consolidated mode any PyQt depends on _qt
hiddenimports = ['sip', 'PyQt5.Qt']
# Collect just the qt.conf file.
datas = [x for x in collect_data_files('PyQt5', False, os.path.join('Qt', 'bin')) if
x[0].endswith('qt.conf')]
# For Qt<5.4 to work on Mac OS X it is necessary to include `qt_menu.nib`.
# This directory contains some resource files necessary to run PyQt or PySide
# app.
if is_darwin:
# Version of the currently installed Qt 5.x shared library.
qt_version = get_module_attribute('PyQt5.QtCore', 'QT_VERSION_STR')
if is_module_satisfies('Qt < 5.4', qt_version):
datas = [(qt_menu_nib_dir('PyQt5'), '')]
| 42.813953 | 90 | 0.669745 | 1 | 1.2516 | [
0.002199794165790081,
0.019838739186525345,
0.008054935373365879,
0.002948580775409937,
0.005390102043747902,
-0.0026961900293827057,
-0.00738950539380312,
0.0013757327105849981,
-0.007702285423874855,
0.001958798384293914,
0.0019509972771629691,
0.004001774825155735,
0.004982042592018843,
-0.016192369163036346,
0.0023147317115217447,
0.01569553278386593,
-0.050894808024168015,
0.0011741308262571692,
-0.0045174905098974705,
0.002910848706960678,
-0.007006220519542694,
0.00865193922072649,
0.008306858129799366,
0.004264034330844879,
0.005942074116319418,
-0.002020861255005002,
0.007886281237006187,
0.0014654402621090412,
-0.007420423906296492,
-0.008507314138114452,
-0.001670735189691186,
-0.0029994389042258263,
-0.003998058382421732,
-0.009118624031543732,
0.007293631788343191,
-0.0024497394915670156,
-0.0006799002876505256,
-0.018344834446907043,
0.010869508609175682,
-0.0018046045443043113,
-0.006020865403115749,
-0.015467985533177853,
0.001469184411689639,
0.0030898149125277996,
-0.009669860824942589,
0.0007494693272747099,
-0.0033031643833965063,
0.0034118674229830503,
-0.011731896549463272,
0.006603606510907412,
-0.0074988906271755695,
0.006827204022556543,
0.013729600235819817,
0.004281871020793915,
-0.005505004432052374,
-0.006455441936850548,
0.013526804745197296,
0.0010146471904590726,
-0.009070402942597866,
0.0024402723647654057,
-0.004843739327043295,
-0.0013831694377586246,
0.002175097120925784,
0.0025429674424231052,
-0.013974899426102638,
-0.007613210007548332,
-0.003546166466549039,
0.002343206200748682,
-0.0019224007846787572,
0.007316055241972208,
0.0012028961209580302,
-0.0020009996369481087,
0.008218792267143726,
0.0035535027272999287,
0.005460808519273996,
-0.004278756678104401,
-0.0019406573846936226,
-0.0025432142429053783,
0.010264738462865353,
0.0037859920412302017,
0.004333831835538149,
-0.006466649007052183,
0.005815721116960049,
0.009175329469144344,
0.015098360367119312,
0.010291879996657372,
0.01836784929037094,
-0.010234777815639973,
0.04613272100687027,
0.007624969817698002,
-0.007993021979928017,
0.0005110423662699759,
-0.007348774466663599,
-0.0034822977613657713,
-0.004991918336600065,
-0.028364509344100952,
0.0007350241648964584,
-0.0029892046004533768,
0.0020009863656014204,
0.005046745762228966,
0.0006805488956160843,
0.00773932971060276,
0.000060620801377808675,
-0.002465675352141261,
-0.010179111734032631,
0.010593854822218418,
-0.007063569501042366,
-0.003465151647105813,
0.006418910343199968,
0.0004086984263267368,
-0.008802630007266998,
-0.003849685424938798,
0.0027368192095309496,
-0.012223080731928349,
0.0024432993959635496,
0.002921846229583025,
-0.006204289849847555,
0.052341338247060776,
-0.002417693380266428,
0.00023120063997339457,
-0.0030861515551805496,
0.0025531621649861336,
0.002476013731211424,
0.0071842242032289505,
0.009158614091575146,
-0.00234956294298172,
0.013343852944672108,
0.007162248250097036,
0.0020049356389790773,
0.010256721638143063,
-0.002456274814903736,
0.0054275598376989365,
-0.003745965426787734,
-0.004461090546101332,
0.0011950305197387934,
-0.006652187090367079,
0.00928852241486311,
-0.0015800029505044222,
-0.01038148533552885,
-0.0005339445197023451,
0.0015461917500942945,
-0.008670014329254627,
0.0018026954494416714,
-0.004756478127092123,
0.00615124125033617,
-0.008110920898616314,
-0.0029227600898593664,
-0.004656147677451372,
-0.0030794553458690643,
0.0013781626475974917,
0.00846744142472744,
0.0031013083644211292,
0.004738411866128445,
-0.006082148291170597,
-0.009355844929814339,
-0.0016173332696780562,
-0.002068981993943453,
0.0006418821285478771,
0.006544129457324743,
0.005636214278638363,
-0.009857069700956345,
-0.00028582598315551877,
0.0038985658902674913,
0.003908151760697365,
-0.0013500209897756577,
0.002514762571081519,
-0.008727572858333588,
0.005581636913120747,
0.0012173008872196078,
0.0035272857639938593,
0.012408791109919548,
-0.0027529762592166662,
0.0007284537423402071,
0.0008691149414516985,
0.004894664976745844,
-0.001329233986325562,
0.00618051178753376,
0.0097386185079813,
-0.003715676721185446,
-0.004357784986495972,
0.003663078648969531,
0.00601632846519351,
0.009945912286639214,
0.007991323247551918,
-0.0031082259956747293,
0.0033572111278772354,
-0.0045143128372728825,
-0.003170214593410492,
0.006673853844404221,
-0.002619217149913311,
0.006059349048882723,
0.0025596057530492544,
-0.011258954182267189,
-0.008627351373434067,
-0.0003805402957368642,
-0.008410152979195118,
0.0012295098276808858,
0.013441566377878189,
0.013519737869501114,
-0.0043785059824585915,
0.005690461955964565,
-0.00995115377008915,
0.00008086503657978028,
0.00682002492249012,
0.002154276706278324,
-0.013650475069880486,
-0.9607778191566467,
0.005847687367349863,
0.002316439291462302,
-0.0010078002233058214,
0.0053106630221009254,
0.002549612196162343,
0.002778882859274745,
0.005899839568883181,
0.01316469069570303,
-0.006967850960791111,
-0.006866928189992905,
-0.008876063860952854,
-0.00906547624617815,
-0.0018718962091952562,
-0.00508080143481493,
-0.0028880916070193052,
-0.007229936309158802,
-0.0046651652082800865,
-0.001760985003784299,
-0.0033474324736744165,
-0.0016322756418958306,
0.010529251769185066,
-0.0002650221867952496,
0.004993890877813101,
-0.0007673174259252846,
0.003059262875467539,
-0.0034201480448246002,
-0.0005388727295212448,
-0.003257458796724677,
-0.0031108511611819267,
-0.00572729529812932,
-0.015901969745755196,
-0.00337887741625309,
0.0003982546040788293,
0.007446824572980404,
0.0018495675176382065,
0.009417075663805008,
-0.0013924117665737867,
0.0012321271933615208,
-0.00818151980638504,
0.004756870213896036,
0.00025583006208762527,
0.002861031098291278,
-0.02959960326552391,
-0.002445175312459469,
-0.0005492042982950807,
-0.00572430994361639,
0.0074610658921301365,
-0.00045779210631735623,
0.0016254320507869124,
-0.0028113846201449633,
-0.005835722666233778,
0.007915263995528221,
-0.0094786137342453,
0.004212946631014347,
-0.004095648415386677,
-0.00918604340404272,
-0.0011418793583288789,
-0.007847997359931469,
0.002326577203348279,
0.005065552890300751,
-0.0020169862546026707,
-0.0033150692470371723,
-0.0041640992276370525,
0.0009773921919986606,
0.0030085977632552385,
-0.00047740840818732977,
-0.01793566904962063,
-0.0069644153118133545,
0.0012173540890216827,
0.0006047859787940979,
-0.005462211091071367,
-0.0028807390481233597,
0.004316987004131079,
-0.009794040583074093,
0.005671379156410694,
0.004421107470989227,
0.000007848247150832321,
-0.010102170519530773,
-0.0009101218893192708,
-0.006847350392490625,
-0.0057621486485004425,
-0.0007738227141089737,
-0.005679070018231869,
-0.0053286077454686165,
0.00041893517482094467,
-0.0014964641304686666,
0.006679983343929052,
-0.004452644847333431,
0.004948561545461416,
0.01355020236223936,
-0.0039841532707214355,
-0.00832402240484953,
0.004239125642925501,
0.005467813927680254,
-0.0003469139919616282,
-0.0035663810558617115,
0.0028801376465708017,
0.008853670209646225,
0.006842388771474361,
0.0028482924681156874,
0.00619486253708601,
-0.00129506248049438,
0.008294492959976196,
-0.0016857588198035955,
-0.001419951906427741,
-0.005341343116015196,
-0.0018566931830719113,
-0.005341766402125359,
-0.0012567491503432393,
-0.004177271854132414,
-0.0024991079699248075,
-0.011475988663733006,
-0.010056507773697376,
-0.002294109435752034,
-0.002884732326492667,
0.003687588730826974,
-0.004408636130392551,
0.0006530518876388669,
0.003502326551824808,
0.008337692357599735,
0.00004213780630379915,
-0.0013825728092342615,
0.0012941672466695309,
0.0038355879951268435,
-0.005740853026509285,
0.012201346457004547,
-0.010060885921120644,
0.005067083053290844,
-0.0016480846097692847,
-0.015044095925986767,
0.007919857278466225,
0.008390897884964943,
-0.006997519172728062,
0.0012220527278259397,
0.003712399397045374,
0.0030562991742044687,
-0.003324860706925392,
-0.005978437606245279,
-0.0002203432668466121,
-0.014964189380407333,
0.0013940267963334918,
0.01749013178050518,
-0.0001303793105762452,
0.010975947603583336,
0.009601956233382225,
-0.001022722339257598,
-0.002501932205632329,
0.006872816942632198,
0.0015368522144854069,
0.011176805943250656,
-0.008233996108174324,
-0.001998230116441846,
-0.0010250365594401956,
-0.008272305130958557,
-0.0005750159034505486,
0.006714813876897097,
0.005335224326699972,
-0.0025509486440569162,
0.0014423138927668333,
-0.008141822181642056,
-0.007194035686552525,
-0.01817435584962368,
-0.004695802461355925,
0.010427439585328102,
-0.0057358937337994576,
0.006887341849505901,
-0.013739144429564476,
0.004410490859299898,
0.0053746262565255165,
0.00508439214900136,
-0.0001995853817788884,
0.0017135015223175287,
0.007148399017751217,
0.008370933122932911,
-0.006557212211191654,
0.0025175688788294792,
-0.00003471851232461631,
-0.0005595423863269389,
-0.00032729070517234504,
0.008856374770402908,
-0.005886955186724663,
-0.004365209024399519,
0.002904078457504511,
0.003592225955799222,
0.0006195137393660843,
-0.004316854290664196,
-0.007019302807748318,
-0.004260815680027008,
0.0025966004468500614,
-0.0043418132700026035,
0.004649362992495298,
0.0028799891006201506,
0.005364167038351297,
-0.006517267320305109,
-0.0027075116522610188,
-0.002153431996703148,
-0.010646048001945019,
0.011541054584085941,
-0.0024410320911556482,
0.003211595816537738,
0.012110774405300617,
0.004626583773642778,
-0.012912076897919178,
0.005676525644958019,
0.011721963994204998,
-0.002787967910990119,
0.004009435418993235,
0.008937280625104904,
-0.004320596344769001,
-0.019968967884778976,
-0.002997132483869791,
-0.015367964282631874,
0.005207090638577938,
-0.003399333218112588,
0.003780948929488659,
-0.006070575676858425,
0.004001512657850981,
0.007548206485807896,
-0.013542652130126953,
-0.0045467945747077465,
-0.008444039151072502,
0.008774037472903728,
-0.0004334428231231868,
-0.0004714450624305755,
-0.002212495543062687,
-0.001313133747316897,
-0.0029132808558642864,
-0.005085529759526253,
-0.0022389860823750496,
0.004365059547126293,
0.0012164546642452478,
-0.002682954538613558,
0.0017185276374220848,
-0.006088492460548878,
0.003021612763404846,
0.0005317642353475094,
-0.011016433127224445,
0.002879930194467306,
0.004369632340967655,
-0.0019115160685032606,
-0.001259885379113257,
-0.00040139691554941237,
-0.0026680852752178907,
-0.005273886490613222,
-0.011765656061470509,
-0.004931534640491009,
-0.0022262712009251118,
-0.0027702751103788614,
-0.013980920426547527,
-0.00018885907775256783,
-0.008685304783284664,
0.007085781544446945,
-0.007206167094409466,
0.0073790899477899075,
0.004275929648429155,
-0.004943354986608028,
0.009213147684931755,
-0.001070187776349485,
0.0051192338578403,
0.004087043460458517,
0.0035156873054802418,
0.0020445697009563446,
-0.0030371437314897776,
-0.015009923838078976,
0.013626767322421074,
-0.006545407697558403,
0.0005729215918108821,
0.014068806543946266,
0.007126675918698311,
0.010844958946108818,
-0.0018141809850931168,
-0.001207158900797367,
0.0038483503740280867,
0.007685557473450899,
-0.015337149612605572,
0.0028349412605166435,
-0.003463034052401781,
0.0007256748504005373,
0.003220754209905863,
-0.0013885439839214087,
0.0011107533937320113,
0.011800030246376991,
0.003211316652595997,
-0.007259410340338945,
-0.002429779851809144,
0.002651611343026161,
0.0028997918125241995,
-0.01283666118979454,
0.00016198040975723416,
-0.00397307425737381,
-0.0027316489722579718,
-0.003260648110881448,
-0.003378645284101367,
0.00014395850303117186,
0.005397793836891651,
-0.0023482777178287506,
0.004776883404701948,
0.005337916314601898,
-0.005302386824041605,
0.01462520007044077,
-0.009289397858083248,
-0.0056918621994555,
0.003460902953520417,
0.0021679685451090336,
-0.0012099100276827812,
-0.005258139222860336,
-0.0034968769177794456,
0.004126671701669693,
0.007859928533434868,
-0.001020040363073349,
-0.004140642937272787,
0.0005443473928608,
0.0006241794908419251,
-0.011030725203454494,
-0.0005257615121081471,
0.010602879337966442,
-0.001468878355808556,
0.005728492978960276,
-0.002384430728852749,
-0.007734114769846201,
-0.012444503605365753,
0.052860941737890244,
-0.0010869861580431461,
0.002899743150919676,
0.0028474903665483,
-0.00818287767469883,
-0.00170476536732167,
-0.003283812664449215,
0.006009597331285477,
-0.007465347647666931,
-0.006762254051864147,
0.008327499032020569,
-0.0028505062218755484,
0.0036850925534963608,
0.0027636978775262833,
-0.0026817338075488806,
0.013790780678391457,
-0.002374633215367794,
-0.013928298838436604,
-0.017460590228438377,
0.00460774265229702,
-0.003538605058565736,
-0.00966217927634716,
0.009339746087789536,
-0.003592077875509858,
-0.007100602611899376,
0.0006942077889107168,
0.004168280400335789,
-0.00003819480843958445,
-0.0014946687733754516,
-0.0033116391859948635,
-0.0016442328924313188,
0.00028549801209010184,
0.0007164329290390015,
0.004691639915108681,
0.006771172862499952,
-0.0028918806929141283,
0.005242623388767242,
-0.0006618362385779619,
-0.002373265102505684,
-0.0019203928532078862,
0.0033492394722998142,
0.007597238756716251,
-0.0030007667373865843,
-0.005421470385044813,
0.004509652964770794,
0.0028804121538996696,
0.003305025864392519,
0.009583051316440105,
-0.0008828890277072787,
-0.004180260468274355,
0.0064184279181063175,
0.008214344270527363,
0.00014984577137511224,
0.006086164619773626,
-0.002668054774403572,
0.0043406132608652115,
0.0007501512300223112,
-0.009430723264813423,
-0.01851773075759411,
-0.00582136819139123,
0.004979012534022331,
0.009035210125148296,
-0.0009794295765459538,
-0.0003107339143753052,
-0.002764884615316987,
-0.0035300450399518013,
-0.0072631631046533585,
-0.008349702693521976,
0.0005797011544927955,
0.0007017762400209904,
0.0016282566357403994,
0.07201018929481506,
-0.004252483136951923,
-0.0011285757645964622,
-0.0060525028966367245,
-0.000800018198788166,
-0.002734559355303645,
-0.0012030270881950855,
0.001294556655921042,
-0.002326593268662691,
0.00201571942307055,
0.0018918249988928437,
-0.009267925284802914,
-0.010401492938399315,
-0.00031653910991735756,
0.001664017210714519,
-0.00397518090903759,
0.003210660768672824,
0.0062496596947312355,
-0.010448714718222618,
-0.00026908080326393247,
-0.010966955684125423,
-0.0020503466948866844,
-0.002092811744660139,
-0.009566405788064003,
-0.0035928671713918447,
-0.0032377922907471657,
0.004669382702559233,
0.003922942094504833,
0.006626821123063564,
-0.0012047543423250318,
0.006560467183589935,
-0.004135043825954199,
0.00045345237595029175,
-0.006082399282604456,
-0.0006750142201781273,
-0.006837694440037012,
0.007521023973822594,
-0.00005324919038685039,
-0.00901892688125372,
-0.0031208342406898737,
-0.0010473099537193775,
0.0031005654018372297,
-0.004280920140445232,
0.005450446158647537,
0.0012044404866173863,
0.003960689529776573,
-0.0030409505125135183,
0.0006177991162985563,
-0.007507022935897112,
0.001705434639006853,
-0.012460345402359962,
0.006747059524059296,
-0.16598211228847504,
0.011872895061969757,
0.0061149317771196365,
-0.004468519706279039,
-0.005187239497900009,
-0.014149729162454605,
-0.006318643689155579,
0.005173530429601669,
0.010841084644198418,
0.000774360029026866,
-0.002707087667658925,
-0.0005860899691469967,
0.0051942626014351845,
0.005484030116349459,
-0.001059722388163209,
-0.006010496523231268,
0.001740042120218277,
-0.004541072528809309,
-0.00032684547477401793,
0.0024039745330810547,
0.004971539601683617,
0.010246033780276775,
0.0027508263010531664,
0.0004910895950160921,
-0.002352768089622259,
-0.0052542430348694324,
0.006367403082549572,
-0.0020746360532939434,
0.0045342715457081795,
-0.012088039889931679,
-0.001999831525608897,
-0.003665636060759425,
-0.004874004982411861,
0.0003823067236226052,
0.005406622309237719,
-0.0002208574878750369,
0.00952303409576416,
0.0016832734690979123,
-0.007344793528318405,
0.008898845873773098,
-0.007510446943342686,
0.02413436584174633,
0.004098416771739721,
0.004930319730192423,
-0.0001250175992026925,
-0.006715817376971245,
-0.0038917523343116045,
0.010309502482414246,
0.0006220876821316779,
0.012296946719288826,
-0.012567448429763317,
-0.0011613806709647179,
0.008127372711896896,
0.018193842843174934,
-0.006302253808826208,
-0.010056785307824612,
-0.005498431157320738,
-0.003985295072197914,
0.0022761626169085503,
0.007977515459060669,
0.009126297198235989,
-0.0009100304450839758,
0.013200301676988602,
-0.004458515904843807,
-0.0191959235817194,
0.0031923078931868076,
-0.002412007423117757,
-0.008633885532617569,
0.0022864937782287598,
0.009530754759907722,
0.008222868666052818,
0.0016617225483059883,
0.001263003796339035,
-0.002297421684488654,
0.006844951771199703,
0.0013431377010419965,
0.007822849787771702,
-0.0029671615920960903,
0.0059685781598091125,
-0.010039074346423149,
0.005321328062564135,
-0.008534117601811886,
-0.003252120688557625,
0.001421217224560678,
-0.004850141238421202,
0.009731448255479336,
0.0030061339493840933,
-0.0020140998531132936,
-0.0007248053443618119,
-0.008424625732004642,
-0.0022960593923926353,
0.0020156484097242355,
0.0019360054284334183,
-0.008600069209933281,
0.002656124532222748,
-0.001830313471145928,
0.006298826076090336,
0.005367278587073088,
-0.010567125864326954,
0.004009645897895098,
0.004728045780211687,
-0.005213570781052113,
0.0026233645621687174,
-0.005225246772170067,
0.004095195326954126,
0.0061453781090676785,
-0.005083147436380386,
-0.004892966244369745,
0.0035206673201173544,
-0.004558706656098366,
-0.006673259194940329,
0.004513092339038849,
-0.008158346638083458,
-0.010517911985516548,
-0.0031059272587299347,
-0.011136429384350777,
0.0005886496510356665
] |
8a7922d582e70ee076c3374be8cdb74d33423c9b | 1,038 | py | Python | tests/ast/nodes/test_from_node.py | upgradvisor/vyper | 642884ea938a25793c1b2fac866e8458e63a7b49 | [
"Apache-2.0"
] | 1,471 | 2017-12-25T05:47:57.000Z | 2019-11-19T07:47:53.000Z | tests/ast/nodes/test_from_node.py | upgradvisor/vyper | 642884ea938a25793c1b2fac866e8458e63a7b49 | [
"Apache-2.0"
] | 915 | 2019-11-21T05:48:16.000Z | 2022-03-31T23:51:03.000Z | tests/ast/nodes/test_from_node.py | upgradvisor/vyper | 642884ea938a25793c1b2fac866e8458e63a7b49 | [
"Apache-2.0"
] | 321 | 2017-12-25T16:37:21.000Z | 2019-11-15T17:44:06.000Z | from vyper import ast as vy_ast
def test_output_class():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert isinstance(new_node, vy_ast.Int)
def test_source():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert old_node.src == new_node.src
assert old_node.node_source_code == new_node.node_source_code
def test_kwargs():
old_node = vy_ast.parse_to_ast("42").body[0].value
new_node = vy_ast.Int.from_node(old_node, value=666)
assert old_node.value == 42
assert new_node.value == 666
def test_compare_nodes():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert not vy_ast.compare_nodes(old_node, new_node)
def test_new_node_has_no_parent():
old_node = vy_ast.parse_to_ast("foo = 42")
new_node = vy_ast.Int.from_node(old_node, value=666)
assert new_node._parent is None
assert new_node._depth == 0
| 25.95 | 65 | 0.719653 | 1 | 1.0356 | [
0.002685259561985731,
0.0260943453758955,
0.010067912749946117,
-0.00044255965622141957,
0.005100943613797426,
-0.003671948565170169,
-0.010543792508542538,
0.0022769125644117594,
-0.005904604680836201,
0.0016495749587193131,
0.0030046943575143814,
0.0037234844639897346,
0.008286609314382076,
-0.014848356135189533,
0.0012545199133455753,
0.018490754067897797,
-0.055089373141527176,
0.007131912279874086,
-0.004036684054881334,
0.0047269403003156185,
-0.007187230978161097,
0.009255263023078442,
0.009383844211697578,
0.004759094677865505,
0.0065604886040091515,
0.0003318099770694971,
0.009107446298003197,
0.0014199496945366263,
-0.008363105356693268,
-0.007926908321678638,
-0.00012784689897671342,
-0.0026198599953204393,
-0.007104688789695501,
-0.008745808154344559,
0.006277161184698343,
-0.003326175967231393,
-0.000057933702919399366,
-0.018612487241625786,
0.01191441435366869,
-0.004920989740639925,
-0.005447858944535255,
-0.018136976286768913,
0.00005574310853262432,
0.0033737136982381344,
-0.012642513029277325,
0.0027935407124459743,
-0.0037614901084452868,
0.004679362289607525,
-0.011978965252637863,
0.006226628553122282,
-0.010632925666868687,
0.0050081610679626465,
0.014988753944635391,
0.0032818885520100594,
-0.005885290913283825,
-0.007155258674174547,
0.013278651982545853,
-0.0009619708871468902,
-0.00984176155179739,
0.0005941415438428521,
-0.004577198997139931,
-0.002110963687300682,
0.00444635609164834,
0.0023636806290596724,
-0.017792725935578346,
-0.007903567515313625,
-0.004225437063723803,
0.0032731909304857254,
-0.0034842269960790873,
0.006327150855213404,
-0.0008931378833949566,
-0.0011369739659130573,
0.008358997292816639,
0.0012026893673464656,
0.004542985465377569,
-0.002128144958987832,
-0.000898397876881063,
-0.0011866599088534713,
0.006933341734111309,
0.0024012885987758636,
0.005438874009996653,
-0.007336924783885479,
0.0052084238268435,
0.007547121495008469,
0.013726321049034595,
0.008782489225268364,
0.020220814272761345,
-0.011411718092858791,
0.04494984447956085,
0.009672234766185284,
-0.00946942437440157,
0.0023576903622597456,
-0.00608247984200716,
-0.002996225841343403,
-0.002221509115770459,
-0.030021047219634056,
0.0008356986800208688,
-0.005276574287563562,
0.000921105791348964,
0.0032116887159645557,
-0.0006940069142729044,
0.006197295151650906,
-0.0007204436114989221,
-0.0005143771413713694,
-0.00874591339379549,
0.010965061374008656,
-0.009164122864603996,
-0.001819193596020341,
0.009257284924387932,
0.0020456884521991014,
-0.012264074757695198,
-0.0038422371726483107,
0.0018813017522916198,
-0.012460124678909779,
0.005158956628292799,
-0.0004071694565936923,
-0.007528571877628565,
0.05448545888066292,
-0.00015299882215913385,
0.0018867369508370757,
-0.005403021816164255,
0.0013731024228036404,
0.0019870921969413757,
0.004905027337372303,
0.011306663043797016,
-0.004526981618255377,
0.010969125665724277,
0.007661660201847553,
0.0031596149783581495,
0.007005208637565374,
-0.0036877666134387255,
0.007375024259090424,
-0.004463876597583294,
-0.004249995574355125,
0.0024214719887822866,
-0.006189238280057907,
0.007274257950484753,
-0.0017259628511965275,
-0.008146443404257298,
0.0012375593651086092,
-0.0020876142662018538,
-0.009537366218864918,
0.0015138244489207864,
-0.0042051696218550205,
0.005074567161500454,
-0.007836200296878815,
-0.003517166478559375,
-0.005468958523124456,
-0.003029582090675831,
0.002182823373004794,
0.007823572494089603,
0.0048380945809185505,
0.00466934172436595,
-0.0046195597387850285,
-0.007359509821981192,
-0.0023129985202103853,
-0.004422172904014587,
0.001368170604109764,
0.006722291931509972,
0.004300607834011316,
-0.009767324663698673,
-0.0018795756623148918,
0.0014472479233518243,
0.0053421915508806705,
0.00024378531088586897,
0.004193529486656189,
-0.010581538081169128,
0.007910291664302349,
0.0011626543710008264,
0.0033405465073883533,
0.011656437069177628,
-0.0047663128934800625,
-0.00120625423733145,
-0.0003977314627263695,
0.0024307933636009693,
-0.00019751564832404256,
0.005813621450215578,
0.009599931538105011,
-0.003667573444545269,
-0.003873692825436592,
0.00470571918413043,
0.005268259905278683,
0.011377152055501938,
0.004861818160861731,
-0.0017228987999260426,
-0.00008969056216301396,
-0.002223759423941374,
-0.0026543159037828445,
0.006231730338186026,
-0.0047449273988604546,
0.007368937600404024,
0.004766385070979595,
-0.011713671498000622,
-0.008258700370788574,
0.0022281487472355366,
-0.008202116005122662,
0.0023451063316315413,
0.01622217521071434,
0.013564907014369965,
-0.0007122506503947079,
0.0034117340110242367,
-0.011282961815595627,
0.0007253417861647904,
0.007796039804816246,
0.0029285696800798178,
-0.010919321328401566,
-0.9572616219520569,
0.0038709663785994053,
0.003913682885468006,
-0.002909586299210787,
0.004544494207948446,
0.00393157871440053,
0.003479127073660493,
0.0036515218671411276,
0.01594902016222477,
-0.00867657270282507,
-0.008957295678555965,
-0.009871515445411205,
-0.01142203714698553,
0.0009599632467143238,
-0.005268177017569542,
-0.004756249021738768,
-0.006325779017060995,
-0.006601843982934952,
-0.0019276186358183622,
-0.003673683386296034,
-0.002442906843498349,
0.00796373002231121,
0.00006342571577988565,
0.004025333095341921,
0.0020057023502886295,
0.004608588293194771,
-0.006827868055552244,
-0.0015759316738694906,
-0.0013467295793816447,
-0.002365358639508486,
-0.006497500464320183,
-0.013950015418231487,
-0.0070402007550001144,
-0.0007200988475233316,
0.010941389948129654,
-0.000988442450761795,
0.008735636249184608,
-0.0040789018385112286,
-0.0011114795925095677,
-0.007905020378530025,
0.0064661758951842785,
0.00018686469411477447,
0.004899636842310429,
-0.029450854286551476,
-0.002121508354321122,
0.0006843151059001684,
-0.008453330025076866,
0.008464344777166843,
-0.0013733895029872656,
-0.0006364975124597549,
-0.0027161359321326017,
-0.0037296651862561703,
0.006825366988778114,
-0.008943392895162106,
0.003919317852705717,
-0.0027070085052400827,
-0.008024148643016815,
-0.0021572744008153677,
-0.009264527820050716,
0.0008463738486170769,
0.0042043630965054035,
-0.002767366822808981,
-0.00461337435990572,
-0.0018022452713921666,
0.003345709526911378,
0.0018256301991641521,
0.003509007627144456,
-0.018177414312958717,
-0.0072736674919724464,
-0.0016052152495831251,
0.0030250626150518656,
-0.0013616608921438456,
-0.003243456594645977,
0.003983351867645979,
-0.01016905065625906,
0.0074986680410802364,
0.0015411828644573689,
-0.002200307557359338,
-0.007208106108009815,
0.0005111713544465601,
-0.008856617845594883,
-0.008010603487491608,
0.0035390628036111593,
-0.006284989416599274,
-0.00585515983402729,
-0.00016778986901044846,
0.0007978518260642886,
0.005266300402581692,
-0.0045501962304115295,
0.004243936389684677,
0.01011180691421032,
-0.0031061756890267134,
-0.010301648639142513,
0.007532303687185049,
0.0046804663725197315,
0.00043650466250255704,
-0.0015415597008541226,
0.002387144137173891,
0.008586871437728405,
0.008600907400250435,
0.0017008353024721146,
0.005315386690199375,
0.0006098879966884851,
0.008885071612894535,
0.0006203746306709945,
-0.00012357166269794106,
-0.003996067680418491,
-0.00001563058322062716,
-0.0054972427897155285,
-0.0010329870274290442,
-0.003997541964054108,
-0.003004205645993352,
-0.010702962055802345,
-0.008282839320600033,
-0.004071458242833614,
0.001449073082767427,
0.00506892055273056,
-0.004481941927224398,
0.0015367637388408184,
0.0006188518018461764,
0.008523307740688324,
0.0012692235177382827,
-0.0026716694701462984,
0.0011744709918275476,
0.0009027012274600565,
-0.00516048027202487,
0.012763217091560364,
-0.011355376802384853,
0.006316374056041241,
0.000066772845457308,
-0.015020838938653469,
0.00902222003787756,
0.011093965731561184,
-0.008079838939011097,
0.0006386307650245726,
0.002869605552405119,
0.0033503270242363214,
0.0010006361408159137,
-0.007768935989588499,
-0.003729874501004815,
-0.01688862219452858,
0.0009569390094839036,
0.02091289311647415,
0.0010822333861142397,
0.011146665550768375,
0.011525810696184635,
-0.0042643300257623196,
0.001996132778003812,
0.006512381136417389,
0.0024156703148037195,
0.014139518141746521,
-0.006098055746406317,
-0.000716983457095921,
0.002237790497019887,
-0.007488632574677467,
0.0019236205844208598,
0.0051957229152321815,
0.0038015679456293583,
-0.0021656739991158247,
0.005194379016757011,
-0.008510500192642212,
-0.006888510659337044,
-0.017620284110307693,
-0.0025580606888979673,
0.005396501626819372,
-0.003876413917168975,
0.006456044502556324,
-0.012426263652741909,
0.0010905020171776414,
0.006960827857255936,
0.004924480337649584,
0.0003012905362993479,
0.00023823720403015614,
0.004160535521805286,
0.012455093674361706,
-0.005617988295853138,
0.005204938817769289,
0.001910109305754304,
-0.0023147952742874622,
0.0032962081022560596,
0.007160016801208258,
-0.007080841343849897,
-0.0033976593986153603,
0.0022758115082979202,
0.003856427501887083,
0.0008141574217006564,
-0.002050654962658882,
-0.007919235154986382,
-0.002439524047076702,
0.0038279842119663954,
-0.0068357596173882484,
0.003420861903578043,
0.0028089419938623905,
0.0031588803976774216,
-0.006781434174627066,
-0.0020102399867028,
-0.003838261589407921,
-0.011188295669853687,
0.011375910602509975,
-0.0024378630332648754,
0.002639365615323186,
0.014256570488214493,
0.00402856757864356,
-0.01210092194378376,
0.005332065746188164,
0.010615009814500809,
-0.002221163362264633,
0.004434891510754824,
0.00690182950347662,
-0.004357095807790756,
-0.022889655083417892,
-0.002150928135961294,
-0.014379039406776428,
0.005927958060055971,
-0.0019239910179749131,
0.0024035018868744373,
-0.008880154229700565,
0.008867486380040646,
0.004552563652396202,
-0.012376145459711552,
-0.007444698829203844,
-0.011105788871645927,
0.010987200774252415,
-0.001456530997529626,
-0.0007015358423814178,
-0.004296020604670048,
-0.0021368013694882393,
-0.0013948938576504588,
-0.0032047368586063385,
-0.001043235301040113,
0.00520496629178524,
0.00299265468493104,
-0.001190451206639409,
0.0024676783941686153,
-0.0048188320361077785,
0.001213490846566856,
0.0012925614137202501,
-0.011643447913229465,
-0.00032534130150452256,
0.005066765937954187,
-0.003003515535965562,
-0.0019499744521453977,
-0.00008474313654005527,
-0.0025540872011333704,
-0.008213646709918976,
-0.012697504833340645,
-0.005744460970163345,
-0.004149630665779114,
-0.005039524752646685,
-0.012093491852283478,
-0.0026889301370829344,
-0.007037266623228788,
0.006649580784142017,
-0.00672893738374114,
0.008413928560912609,
0.005292191170156002,
-0.0033337436616420746,
0.007616563234478235,
-0.002028518356382847,
0.004563177470117807,
0.0034691295586526394,
0.005641676019877195,
0.0021369964815676212,
-0.005577459000051022,
-0.011628889478743076,
0.011767220683395863,
-0.009408140555024147,
-0.00033689115662127733,
0.014097824692726135,
0.004426887724548578,
0.008717882446944714,
0.00013828344526700675,
0.00015446596080437303,
0.003883418859913945,
0.0074426294304430485,
-0.015646226704120636,
0.004625295288860798,
-0.00041452673031017184,
-0.0016733036609366536,
0.0030802476685494184,
-0.004249928053468466,
-0.0008231804240494967,
0.008026733994483948,
0.0012662276858463883,
-0.009796857833862305,
-0.0048033990897238255,
0.0036098898854106665,
0.003553791670128703,
-0.013650026172399521,
-0.0008035746868699789,
-0.003018881194293499,
-0.004816449247300625,
-0.0032227258197963238,
-0.001209824695251882,
-0.00046573756844736636,
0.003383483039215207,
-0.002571780700236559,
0.007150090299546719,
0.004965038038790226,
-0.005743157118558884,
0.015318429097533226,
-0.006945496425032616,
-0.00783203449100256,
0.0047661676071584225,
0.001442527398467064,
-0.0009140468901023269,
-0.0070480406284332275,
-0.004416194744408131,
0.0019562039524316788,
0.006482145749032497,
-0.0034178842324763536,
-0.004666681867092848,
-0.002895490964874625,
0.0002563406596891582,
-0.01042549591511488,
0.002599631203338504,
0.00908549316227436,
-0.0030030992347747087,
0.006237130146473646,
-0.00038711653905920684,
-0.007592366077005863,
-0.013457154855132103,
0.05288271605968475,
0.0003913393593393266,
0.0019263637950643897,
0.004460811149328947,
-0.008548307232558727,
-0.000633934629149735,
-0.004101090598851442,
0.006606792565435171,
-0.006686455570161343,
-0.006177881732583046,
0.009291329421103,
-0.0020739673636853695,
0.002848378149792552,
0.005632525309920311,
-0.0016692819772288203,
0.01505995076149702,
-0.0017190119251608849,
-0.017680590972304344,
-0.017002562060952187,
0.008626453578472137,
-0.004095571581274271,
-0.007466417737305164,
0.009591568261384964,
-0.00177488022018224,
-0.003858980257064104,
0.0017946782754734159,
0.006252980791032314,
0.0012954777339473367,
0.00251368572935462,
-0.0007311948575079441,
-0.004555524792522192,
0.0003879689029417932,
0.003652227111160755,
0.0073827761225402355,
0.00641558226197958,
-0.0033787244465202093,
0.004035796504467726,
0.0000822497095214203,
-0.0014006963465362787,
-0.0007021965575404465,
0.0033381113316863775,
0.007582124322652817,
-0.002955357078462839,
-0.0031358550768345594,
0.004828950390219688,
0.0061500780284404755,
0.002758253598585725,
0.012957664206624031,
-0.0000037926949971733848,
-0.006212661508470774,
0.010704237036406994,
0.006908157374709845,
0.0016599851660430431,
0.008551308885216713,
-0.0003010276413988322,
0.003627851139754057,
0.0012368462048470974,
-0.008998865261673927,
-0.015538006089627743,
-0.001389465294778347,
0.005394681356847286,
0.01068464107811451,
-0.0020665188785642385,
0.000913467607460916,
-0.0013069009874016047,
-0.00238258414901793,
-0.006579203065484762,
-0.005772249307483435,
-0.002138805342838168,
-0.00028423662297427654,
0.004282352980226278,
0.06863848119974136,
-0.00868236180394888,
-0.0015177713939920068,
-0.008052431046962738,
-0.0011546079767867923,
-0.0019968501292169094,
-0.0006191357388161123,
0.00041763955960050225,
-0.0009281039237976074,
0.0021875635720789433,
-0.0006251907907426357,
-0.007700678892433643,
-0.010713244788348675,
-0.00002952064278360922,
0.003661662805825472,
-0.003827954875305295,
0.004073832184076309,
0.006577249616384506,
-0.009319398552179337,
0.0015824716538190842,
-0.014675520360469818,
-0.002137145958840847,
-0.00115912314504385,
-0.010238544084131718,
-0.003841869533061981,
-0.002411788096651435,
0.004020049702376127,
0.0020134239457547665,
0.006302573252469301,
-0.005415886640548706,
0.007573405746370554,
-0.0022088338155299425,
0.0006858987035229802,
-0.004110434092581272,
-0.0013029687106609344,
-0.006544612348079681,
0.008015238679945469,
0.001687454292550683,
-0.011277582496404648,
-0.005995037499815226,
-0.003333531552925706,
0.0008949139155447483,
-0.005229069851338863,
0.004035750404000282,
0.00030473078368231654,
0.007381895557045937,
-0.0025632947217673063,
0.0006015745457261801,
-0.006121491082012653,
-0.0010476402239874005,
-0.009747117757797241,
0.00593962986022234,
-0.17758896946907043,
0.01014129351824522,
0.001921172020956874,
-0.00339007587172091,
-0.0041890754364430904,
-0.015550950542092323,
-0.005893960129469633,
0.0048888432793319225,
0.010039894841611385,
0.0007238280959427357,
-0.0022519349586218596,
-0.003946071490645409,
0.004982259124517441,
0.0019201391842216253,
-0.0031272261403501034,
-0.006852744147181511,
0.0032135071232914925,
-0.001995030092075467,
0.00165819120593369,
0.0035416134633123875,
0.0061811357736587524,
0.006975524127483368,
0.0021755641791969538,
0.0031419750303030014,
-0.0015439611161127687,
-0.00646827882155776,
0.00616929167881608,
-0.0015817302046343684,
0.005635570734739304,
-0.012998468242585659,
-0.0017826521070674062,
-0.0051421415992081165,
-0.00391078507527709,
-0.00036451092455536127,
0.00517279002815485,
-0.0012877885019406676,
0.009236115962266922,
0.0019940424244850874,
-0.007470327895134687,
0.008581480011343956,
-0.008968346752226353,
0.029178274795413017,
0.005977589637041092,
0.006312072277069092,
-0.003358811140060425,
-0.005259308032691479,
-0.00577767938375473,
0.009140410460531712,
0.002429831074550748,
0.008930116891860962,
-0.013212545774877071,
-0.0002032458723988384,
0.0045667728409171104,
0.015653083100914955,
-0.006782752461731434,
-0.010665800422430038,
-0.006042751483619213,
-0.0033389090094715357,
0.002837893320247531,
0.009185515344142914,
0.012541678734123707,
-0.003943057265132666,
0.0100838178768754,
-0.0027689372655004263,
-0.021220985800027847,
0.000399174343328923,
-0.004890314768999815,
-0.00951525941491127,
0.001179484068416059,
0.005190791562199593,
0.009236015379428864,
-0.0010786304483190179,
0.005187497474253178,
-0.00009094343113247305,
0.0057507045567035675,
-0.0016855361172929406,
0.00505592068657279,
-0.002625315450131893,
0.007078505586832762,
-0.009651288390159607,
0.007445275317877531,
-0.009994660504162312,
-0.004228690173476934,
0.0033307650592178106,
-0.0034953055437654257,
0.011590332724153996,
0.0063973646610975266,
-0.0003309638414066285,
-0.00012956270074937493,
-0.01032845675945282,
-0.00526784174144268,
0.0030656764283776283,
0.002659173682332039,
-0.00823836401104927,
0.0016184748383238912,
0.00035975914215669036,
0.00659331725910306,
0.007059159222990274,
-0.0077340141870081425,
0.005545418243855238,
0.006275223568081856,
-0.005991074256598949,
0.0040373108349740505,
-0.005018478259444237,
0.0018707202980294824,
0.004079718142747879,
-0.005374892149120569,
-0.004813855048269033,
0.005226476117968559,
-0.006322741042822599,
-0.005555237177759409,
0.006474378518760204,
-0.009058021008968353,
-0.0077230664901435375,
-0.0021811590995639563,
-0.012268382124602795,
0.0006251533632166684
] |
8a79bd5eb2532e1ffdd3b87d6be696b8303afc7f | 2,624 | py | Python | generator/modules/opencv.py | dayta-ai/deepo | fa720e39052e63adfe0f2b9dbd8444a0d69c2540 | [
"MIT"
] | 1 | 2021-11-18T18:34:29.000Z | 2021-11-18T18:34:29.000Z | generator/modules/opencv.py | dayta-ai/deepo | fa720e39052e63adfe0f2b9dbd8444a0d69c2540 | [
"MIT"
] | null | null | null | generator/modules/opencv.py | dayta-ai/deepo | fa720e39052e63adfe0f2b9dbd8444a0d69c2540 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .__module__ import Module, dependency, source, version
from .tools import Tools
from .boost import Boost
from .python import Python
@dependency(Tools, Python, Boost)
@source('git')
@version('4.0.1')
class Opencv(Module):
def build(self):
return r'''
RUN ln -fs /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime && \
DEBIAN_FRONTEND=noninteractive \
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && \
apt update && \
$APT_INSTALL \
libatlas-base-dev \
libgflags-dev \
libgoogle-glog-dev \
libhdf5-serial-dev \
libleveldb-dev \
liblmdb-dev \
libprotobuf-dev \
libsnappy-dev \
protobuf-compiler \
libopencv-dev \
yasm \
libjpeg-dev \
libjasper-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libdc1394-22-dev \
libv4l-dev \
libtbb-dev \
libqt4-dev \
libgtk2.0-dev \
libfaac-dev \
libmp3lame-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libtheora-dev \
libvorbis-dev \
libxvidcore-dev \
x264 \
v4l-utils \
ffmpeg \
&& \
$GIT_CLONE --branch {0} https://github.com/opencv/opencv opencv && \
$GIT_CLONE --branch {0} https://github.com/opencv/opencv_contrib.git opencv_contrib && \
mkdir -p opencv/build && cd opencv/build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_IPP=OFF \
-D WITH_CUDA=OFF \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENCL=ON \
-D WITH_GTK=ON \
-D WITH_LIBV4L=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D WITH_FFMPEG=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
.. && \
make -j"$(nproc)" install && \
ln -s /usr/local/include/opencv4/opencv2 /usr/local/include/opencv2
'''.format(self.version)
| 35.945205 | 100 | 0.463796 | 1 | 1.5066 | [
-0.0004135656636208296,
0.02190197817981243,
0.011372075416147709,
-0.0013569520087912679,
0.0022773093078285456,
-0.004256412386894226,
-0.005335907451808453,
0.003864872734993696,
-0.007164421491324902,
0.00027650673291645944,
0.0011105528101325035,
0.006849127821624279,
0.009618022479116917,
-0.017702754586935043,
0.001979714957997203,
0.01846221461892128,
-0.05597839504480362,
0.002882086206227541,
-0.0032399361953139305,
0.003779713297262788,
-0.008111885748803616,
0.008044233545660973,
0.007823486812412739,
0.008261331357061863,
0.0053312331438064575,
-0.0009288000292144716,
0.008170540444552898,
0.0014563450822606683,
-0.010002818889915943,
-0.007506800815463066,
0.001705372123979032,
-0.001513156108558178,
-0.004788467660546303,
-0.007939781062304974,
0.007957392372190952,
-0.004281418398022652,
-0.002189137041568756,
-0.016348378732800484,
0.011424259282648563,
-0.003158847102895379,
-0.008498674258589745,
-0.01370379701256752,
0.00016684408183209598,
0.004837444983422756,
-0.010865345597267151,
0.0006585911614820361,
-0.0039270916022360325,
0.0026488376315683126,
-0.008786680176854134,
0.007372361142188311,
-0.008294780738651752,
0.008167832158505917,
0.01176812220364809,
0.004465852864086628,
-0.005669241771101952,
-0.004037363454699516,
0.011584930121898651,
0.00001953689570655115,
-0.010418608784675598,
0.001492790994234383,
-0.0007122139795683324,
-0.003137734951451421,
0.005072345491498709,
0.005594246089458466,
-0.01636720634996891,
-0.0086290892213583,
-0.0036737145856022835,
0.005226627923548222,
-0.0024717359337955713,
0.005113835912197828,
-0.0008570169447921216,
-0.0004278972337488085,
0.007684560492634773,
0.0013358209980651736,
0.0056310249492526054,
-0.003906051628291607,
-0.003682075534015894,
0.002919815480709076,
0.008321455679833889,
0.002866925671696663,
0.0032753050327301025,
-0.00799793004989624,
0.00416708504781127,
0.012196696363389492,
0.017008859664201736,
0.007662716321647167,
0.015400294214487076,
-0.011011134833097458,
0.046960312873125076,
0.0020137266255915165,
-0.00929213035851717,
-0.00026419988716952503,
-0.007497680373489857,
-0.0017630023648962379,
0.0001561133103678003,
-0.028791209682822227,
0.001019941526465118,
-0.003057401394471526,
0.0009521719184704125,
0.003448452800512314,
-0.0013467086246237159,
0.0038369162939488888,
-0.004120401106774807,
-0.0011829836294054985,
-0.010138380341231823,
0.011922536417841911,
-0.00555818947032094,
-0.0006301910034380853,
0.00709910225123167,
0.004464620258659124,
-0.01000471692532301,
-0.0027534945402294397,
0.0016455922741442919,
-0.012146915309131145,
0.005565342027693987,
0.0033787116408348083,
-0.00570899760350585,
0.053867876529693604,
-0.0018910161452367902,
0.0031625584233552217,
-0.006169353146106005,
0.002294831210747361,
-0.00018739532970357686,
0.008381479419767857,
0.011032011359930038,
-0.006278461776673794,
0.009526788257062435,
0.0051839170046150684,
0.0008836234919726849,
0.0066299475729465485,
-0.0009507846552878618,
0.005983240436762571,
-0.005374306347221136,
-0.0008265344658866525,
0.0005021676770411432,
-0.006232221610844135,
0.006824302952736616,
-0.0034999940544366837,
-0.0049107070080935955,
0.003103199414908886,
-0.00113899155985564,
-0.010287677869200706,
0.00014602414739783853,
-0.0037701774854213,
0.000005427995347417891,
-0.010890595614910126,
-0.005695017985999584,
-0.00004412621638039127,
-0.002554403617978096,
0.0010243342258036137,
0.009286914020776749,
0.004316060338169336,
0.004665005952119827,
-0.007502550259232521,
-0.006947937421500683,
-0.0023025020491331816,
-0.005601555574685335,
0.0015287657734006643,
0.005940537434071302,
0.002828996628522873,
-0.006939449813216925,
-0.0035517660435289145,
0.002857278101146221,
0.0042073591612279415,
0.0006031643133610487,
0.001381176058202982,
-0.009259525686502457,
0.007260176818817854,
0.0018458730774000287,
0.003377346321940422,
0.009441124275326729,
-0.0030319958459585905,
0.0005887590232305229,
0.0002631080278661102,
0.004480699542909861,
-0.002471896354109049,
0.005341380834579468,
0.009693028405308723,
-0.0015217855107039213,
-0.004225770477205515,
0.004014296922832727,
0.0041944729164242744,
0.006843894720077515,
0.008970392867922783,
-0.0057372646406292915,
0.0025957338511943817,
-0.006018335931003094,
0.000018186492525273934,
0.008405815809965134,
-0.005130971781909466,
0.006277597974985838,
0.0039014595095068216,
-0.012791301123797894,
-0.004869050346314907,
-0.0007496168254874647,
-0.008682328276336193,
0.0012499046279117465,
0.011652326211333275,
0.013024931773543358,
-0.003085144329816103,
0.004183681216090918,
-0.008193270303308964,
0.000656685559079051,
0.004691681358963251,
-0.0009834005031734705,
-0.014470783993601799,
-0.959184467792511,
0.004933627787977457,
0.0045711263082921505,
-0.0034793508239090443,
0.0073810783214867115,
0.001746046356856823,
0.0031745496671646833,
0.003288367297500372,
0.014560716226696968,
-0.00894966907799244,
-0.011081913486123085,
-0.0053835222497582436,
-0.008542320691049099,
-0.002091196831315756,
-0.005238036159425974,
-0.0039108917117118835,
-0.007637052331119776,
-0.006331453565508127,
0.0004484552191570401,
-0.004915567114949226,
-0.001914009335450828,
0.009661003015935421,
-0.00028767972253262997,
0.0037471309769898653,
0.005214632488787174,
0.0021219784393906593,
-0.0058717913925647736,
-0.0019309846684336662,
0.00024085916811600327,
-0.003723396919667721,
-0.004095987416803837,
-0.016302786767482758,
-0.0024010499473661184,
-0.0012837686808779836,
0.010104566812515259,
0.0023505466524511576,
0.005564495921134949,
-0.0004108451830688864,
0.001988759497180581,
-0.007975909858942032,
0.0029485411942005157,
0.004308965988457203,
0.00361810764297843,
-0.028048323467373848,
-0.0001813541166484356,
0.0024061326403170824,
-0.005576085764914751,
0.003991544712334871,
-0.00006940097227925435,
-0.002925251377746463,
0.0012888215715065598,
-0.005222249776124954,
0.007424251176416874,
-0.0066657657735049725,
0.007646750193089247,
-0.004430282395333052,
-0.003293525194749236,
-0.00250651640817523,
-0.00788951013237238,
0.003397002350538969,
0.003358825109899044,
-0.002649368718266487,
-0.002740077208727598,
-0.0027670119889080524,
0.003398176049813628,
0.0002930131449829787,
0.001981798792257905,
-0.02054365538060665,
-0.002956365467980504,
-0.0024578613229095936,
0.00993513036519289,
-0.0021362323313951492,
-0.00564221665263176,
0.005799310281872749,
-0.00587152224034071,
0.008819673210382462,
0.003057411639019847,
-0.0016500103520229459,
-0.011234767735004425,
0.0021712034940719604,
-0.008883013390004635,
-0.006735806353390217,
0.004276666324585676,
-0.002714017638936639,
-0.004502105992287397,
0.0007774176192469895,
0.0035078467335551977,
0.011030741035938263,
-0.003951020538806915,
0.003601941978558898,
0.010125118307769299,
-0.004218003246933222,
-0.011126126162707806,
0.005792361684143543,
0.0046063573099672794,
0.0002391394809819758,
-0.004213565494865179,
0.0016078782500699162,
0.0071962811052799225,
0.005333856213837862,
0.0035924238618463278,
0.005504244938492775,
0.0018912558443844318,
0.01005583256483078,
-0.00034902861807495356,
0.0033477393444627523,
-0.0017654531402513385,
-0.00221807393245399,
-0.00530394958332181,
0.000396654533687979,
-0.005965469405055046,
-0.00008320955384988338,
-0.01267105434089899,
-0.013721087016165257,
-0.006686999928206205,
0.0011097886599600315,
0.0008314211736433208,
-0.005890346597880125,
-0.0027469692286103964,
0.003546567168086767,
0.009908041916787624,
-0.0019077108008787036,
-0.0036730566062033176,
0.0012756498763337731,
0.0011413856409490108,
-0.007168671581894159,
0.013107743114233017,
-0.013848061673343182,
0.007323686499148607,
-0.0011884423438459635,
-0.013567882589995861,
0.006159281358122826,
0.006513128522783518,
-0.007585122715681791,
0.0027323211543262005,
0.002810458419844508,
0.0005910711479373276,
0.0008801760268397629,
-0.0066679539158940315,
-0.0042649670504033566,
-0.014723988249897957,
0.0018797462107613683,
0.02181185968220234,
0.005921286530792713,
0.00728535046800971,
0.011980649083852768,
-0.003906789235770702,
0.0035368436947464943,
0.004650690592825413,
0.0018869297346100211,
0.013570128008723259,
-0.008127326145768166,
-0.0013044287916272879,
0.0007048571133054793,
-0.005713074933737516,
0.00041799122118391097,
0.005648438818752766,
0.004912355449050665,
-0.0014030811144039035,
0.00122685800306499,
-0.0071658845990896225,
-0.00699966074898839,
-0.016429368406534195,
-0.0011737109161913395,
0.006650077644735575,
-0.0061770291067659855,
0.003991742618381977,
-0.009098530746996403,
0.004816500935703516,
0.007622991222888231,
0.0027698208577930927,
-0.0005285714287310839,
0.00036851069307886064,
0.007011379115283489,
0.012183924205601215,
-0.005360681097954512,
0.002715934533625841,
0.0030292393639683723,
-0.0009756465442478657,
0.0025145518593490124,
0.006397395394742489,
-0.006787293590605259,
-0.003881844924762845,
0.002886116039007902,
0.005079246126115322,
-0.0021407813765108585,
-0.0017234667902812362,
-0.0091996556147933,
-0.004672805778682232,
0.0007193669443950057,
-0.0032579475082457066,
0.006070987321436405,
0.0018137997249141335,
0.004810373764485121,
-0.007268205285072327,
-0.000037392361264210194,
-0.008035820908844471,
-0.012127727270126343,
0.010271839797496796,
-0.0019611832685768604,
0.001323933363892138,
0.01199024636298418,
0.0029342155903577805,
-0.012527519837021828,
0.007341319695115089,
0.009931046515703201,
-0.00371479126624763,
0.005598097108304501,
0.004907991737127304,
-0.002477100584656,
-0.022251084446907043,
-0.0027149503584951162,
-0.014096460305154324,
0.003971862141042948,
-0.0003354818909429014,
0.0037807654589414597,
-0.010819378308951855,
0.005683537572622299,
0.008351408876478672,
-0.010935329832136631,
-0.0033711676951497793,
-0.005992873106151819,
0.005299646407365799,
-0.0009605998639017344,
-0.00009700662485556677,
-0.001015092246234417,
-0.0005641690222546458,
-0.00329525675624609,
-0.00019979197531938553,
-0.0003407564654480666,
0.005412593949586153,
0.002067209454253316,
-0.00549475708976388,
0.0020001456141471863,
-0.003200340550392866,
-0.0021033454686403275,
0.0005356184556148946,
-0.00954203587025404,
0.0005715091829188168,
0.007451615761965513,
-0.0014902210095897317,
-0.00045984721509739757,
-0.0009105093195103109,
-0.0017094672657549381,
-0.00348706915974617,
-0.01064316276460886,
-0.002659710356965661,
-0.0036442356649786234,
-0.0019021689658984542,
-0.010219307616353035,
-0.0027006373275071383,
-0.007144107483327389,
0.006954526994377375,
-0.00802204292267561,
0.007657566573470831,
0.006257957778871059,
-0.0031614629551768303,
0.005654107313603163,
-0.0034288004972040653,
0.002677740529179573,
0.0006694995681755245,
0.0035154037177562714,
-0.00018045023898594081,
-0.007819786667823792,
-0.013142679817974567,
0.01035076193511486,
-0.009302683174610138,
0.0031383514869958162,
0.016415102407336235,
0.0064856670796871185,
0.01123395562171936,
0.001613633707165718,
-0.0003051802923437208,
0.00609811395406723,
0.006368198432028294,
-0.01298437174409628,
0.003949702717363834,
-0.005256186239421368,
0.00045866152504459023,
0.003277823096141219,
-0.0024326303973793983,
0.0028607267886400223,
0.008137516677379608,
0.0005694994470104575,
-0.0033829431049525738,
-0.0035632033832371235,
0.0033581543248146772,
0.0021890350617468357,
-0.010724712163209915,
-0.0004847928648814559,
-0.002737288363277912,
-0.005622587166726589,
-0.005002117250114679,
-0.0028509243857115507,
0.00010040421329904348,
0.0035942201502621174,
-0.004058987367898226,
0.006857309956103563,
0.0019300583517178893,
-0.007392908912152052,
0.013299674727022648,
-0.00564053189009428,
-0.004936051554977894,
0.001783497747965157,
-0.0012687568087130785,
-0.0007503136876039207,
-0.004727623425424099,
0.00015435962995979935,
0.004125931300222874,
0.004347081296145916,
-0.0045744129456579685,
-0.0016222142148762941,
0.0008491795160807669,
0.0014537341194227338,
-0.011602753773331642,
-0.00048278787289746106,
0.012840871699154377,
-0.00234922650270164,
0.0029350481927394867,
-0.0031304953154176474,
-0.00936561357229948,
-0.01466447301208973,
0.053376130759716034,
0.00005177420098334551,
0.0005245772772468626,
0.0028443611226975918,
-0.006616794969886541,
-0.0020094721112400293,
0.0003169907722622156,
0.006378318648785353,
-0.004618966020643711,
-0.007500810548663139,
0.011750122532248497,
-0.0053626419976353645,
0.002683674916625023,
0.002013110090047121,
-0.0009429425117559731,
0.010438602417707443,
-0.0039036867674440145,
-0.01612614467740059,
-0.017309485003352165,
0.008628682233393192,
-0.00377501267939806,
-0.003757363185286522,
0.006483047269284725,
-0.0027870384510606527,
-0.006185639183968306,
0.001294451649300754,
0.008144332095980644,
-0.0010070889256894588,
0.0014401249354705215,
-0.006107271648943424,
0.0012250026920810342,
0.00006443919846788049,
0.0007620896794833243,
0.006246487610042095,
0.010001106187701225,
-0.0039049836341291666,
0.007144620642066002,
-0.0013319671852514148,
-0.0031546822283416986,
-0.0012090669479221106,
0.0024978367146104574,
0.00660275761038065,
-0.0021882099099457264,
-0.003953955136239529,
0.0035696804989129305,
0.003984759096056223,
0.0036207151133567095,
0.010261508636176586,
-0.0016303308075293899,
-0.004490410443395376,
0.010492075234651566,
0.004916171543300152,
-0.0019465205259621143,
0.005776735953986645,
-0.003329936880618334,
0.0021975189447402954,
0.001003696583211422,
-0.009516531601548195,
-0.017094073817133904,
-0.002892091404646635,
0.006347183603793383,
0.00771211925894022,
-0.0026533668860793114,
0.00037352993967942894,
-0.0005524148582480848,
-0.0037591669242829084,
-0.006779389921575785,
-0.008265888318419456,
-0.004297866020351648,
0.00167868344578892,
0.0030320968944579363,
0.07179515063762665,
-0.0036587186623364687,
-0.0006235557375475764,
-0.008748173713684082,
-0.0008798324270173907,
-0.0028000676538795233,
-0.0010605291463434696,
-0.0020371500868350267,
-0.0015210665296763182,
0.0027167261578142643,
0.0010283368173986673,
-0.010532448999583721,
-0.0093366215005517,
0.002036407357081771,
0.0017150366911664605,
-0.002691602800041437,
0.003333735978230834,
0.007103360258042812,
-0.009512769058346748,
0.004063703585416079,
-0.008787156082689762,
0.00037829525535926223,
-0.0024292925372719765,
-0.009672415442764759,
-0.0033112976234406233,
-0.002295949961990118,
0.0030103030148893595,
0.0016336183762177825,
0.004324282519519329,
-0.0028612364549189806,
0.006136290263384581,
-0.00024909694911912084,
0.0015751607716083527,
-0.0016421227483078837,
-0.002622464206069708,
-0.00931944977492094,
0.006487970240414143,
0.003452444216236472,
-0.008429736830294132,
-0.004227389581501484,
-0.003624936332926154,
-0.0013249634066596627,
-0.00469908956438303,
0.004053580574691296,
-0.0024362734984606504,
0.006413294468075037,
-0.0030707092955708504,
0.0016341360751539469,
-0.0041348435916006565,
0.0013989765429869294,
-0.011232554912567139,
0.0039191166870296,
-0.17244181036949158,
0.011347220279276371,
0.0028788712806999683,
-0.007037219125777483,
-0.0026975679211318493,
-0.013572897762060165,
-0.007086490280926228,
0.0034656538628041744,
0.009663927368819714,
-0.0008158946293406188,
-0.0005504414439201355,
-0.002121726283803582,
0.005176621489226818,
0.0023733554407954216,
0.00018377648666501045,
-0.006468707695603371,
0.006679994519799948,
-0.005959388334304094,
0.002737024798989296,
0.0022803577594459057,
0.0043697236105799675,
0.009083984419703484,
0.002644018968567252,
0.0040887934155762196,
-0.0010547516867518425,
-0.00188513717148453,
0.003624619683250785,
-0.002050933428108692,
0.007388679776340723,
-0.014126023277640343,
-0.0029244893230497837,
-0.003749018767848611,
-0.002116139978170395,
0.0015905590262264013,
0.0016691114287823439,
-0.0007219290710054338,
0.008762640878558159,
0.003023233963176608,
-0.008359822444617748,
0.007949022576212883,
-0.010786742903292179,
0.026722712442278862,
0.0055144233629107475,
0.008557290770113468,
-0.00016744424647185951,
-0.002069710986688733,
-0.0015708818100392818,
0.010922905057668686,
0.002678673481568694,
0.010999824851751328,
-0.015711577609181404,
-0.005526152905076742,
0.0030324156396090984,
0.01594879850745201,
-0.0033358035143464804,
-0.010960794053971767,
-0.005558851640671492,
-0.005571425426751375,
0.0035902264062315226,
0.00924665853381157,
0.009750153869390488,
-0.005544866435229778,
0.0052548544481396675,
-0.0011373329907655716,
-0.023163802921772003,
0.000189028141903691,
-0.0033211277332156897,
-0.00809649657458067,
0.0014620586298406124,
0.009410216473042965,
0.008811299689114094,
0.0017435932531952858,
0.0001516369666205719,
-0.00023523392155766487,
0.0031375109683722258,
-0.001139201456680894,
0.006787980906665325,
-0.0021949110087007284,
0.004436102695763111,
-0.006613221950829029,
0.008113586343824863,
-0.011695808731019497,
-0.006073161493986845,
0.002538284519687295,
-0.004125457257032394,
0.009113622829318047,
0.003836693475022912,
-0.0021422968711704016,
-0.002808904042467475,
-0.008877715095877647,
-0.0004008199321106076,
0.0011449517915025353,
0.0008112686336971819,
-0.006857425905764103,
0.002566262846812606,
-0.00025708507746458054,
0.005241310223937035,
0.006868972908705473,
-0.011377289891242981,
0.00324632809497416,
0.0063425046391785145,
-0.003183844266459346,
-0.00042600801680237055,
-0.006538838148117065,
0.0046209353022277355,
0.0037437849678099155,
-0.0035338127054274082,
-0.006563159637153149,
0.0008650990203022957,
-0.006730747874826193,
-0.006668181158602238,
0.006952305324375629,
-0.009387451224029064,
-0.01020211074501276,
-0.0017071138136088848,
-0.012165231630206108,
-0.0006067273789085448
] |
8a7a7334b3428135d28ee8a3da56e39eed250254 | 1,564 | py | Python | day16/solve16.py | jmacarthur/aoc2017 | 2a3096aabf464ef52c05f9437498035cfb5ca1a6 | [
"MIT"
] | null | null | null | day16/solve16.py | jmacarthur/aoc2017 | 2a3096aabf464ef52c05f9437498035cfb5ca1a6 | [
"MIT"
] | null | null | null | day16/solve16.py | jmacarthur/aoc2017 | 2a3096aabf464ef52c05f9437498035cfb5ca1a6 | [
"MIT"
] | null | null | null | #!/usr/bin/python
import sys
import copy
stage_length = 16
stage = map(chr, range(ord('a'),ord('a')+stage_length))
def spin(amount):
"""To save time, this function isn't used except at the end.
Normally, a counter marks the start of the stage and this changes
instead. """
global stage
stage = stage[amount:] + stage[:amount]
def swap(pos1, pos2):
global stage
(stage[pos1], stage[pos2]) = (stage[pos2], stage[pos1])
with open(sys.argv[1], 'rt') as f:
program = ",".join(f.readlines()).split(",")
n = 0
pos = 0
arguments_list = [x[1:].strip().split("/") for x in program]
action_list = [x[0] for x in program]
history = []
# Change this to 1 for the solution to part 1.
iterations = 1000000000
while n<iterations:
for s in range(0,len(program)):
arguments = arguments_list[s]
if action_list[s] == 's':
pos += stage_length-int(arguments[0])
elif action_list[s] == 'x':
swap((int(arguments[0])+pos)%stage_length, (int(arguments[1])+pos)%stage_length)
elif action_list[s] == 'p':
pos1 = stage.index(arguments[0])
pos2 = stage.index(arguments[1])
swap(pos1, pos2)
if stage in history:
print("Duplicate found: %r at index %d matches at stage %d"%(stage, history.index(stage), n))
loop_length = n - history.index(stage)
complete_cycles = (iterations - n) / loop_length
n += complete_cycles * loop_length
history.append(copy.copy(stage))
n += 1
spin(pos % stage_length)
print "".join(stage)
| 30.076923 | 101 | 0.621483 | 1 | 1.2396 | [
0.0015030562644824386,
0.025743400678038597,
0.007122031878679991,
0.00007127476419555023,
0.00537875946611166,
-0.002295310143381357,
-0.012315722182393074,
0.002013782039284706,
-0.004585090093314648,
0.0013527014525607228,
0.0017350283451378345,
0.005227136891335249,
0.007492966018617153,
-0.017403870820999146,
0.0014621105510741472,
0.017142457887530327,
-0.05158965289592743,
0.0024391040205955505,
-0.0031766120810061693,
0.001607011305168271,
-0.009069228544831276,
0.010444403626024723,
0.010172956623136997,
0.006190263666212559,
0.006099743768572807,
-0.0004224295262247324,
0.008756585419178009,
0.0039500026032328606,
-0.008041724562644958,
-0.006147828884422779,
-0.0009545214707031846,
-0.0015726827550679445,
-0.0060554249212145805,
-0.01003392692655325,
0.005563877522945404,
-0.0022727360483258963,
-0.000398279691580683,
-0.019656213000416756,
0.01271654013544321,
-0.004442418459802866,
-0.0061920336447656155,
-0.01392417773604393,
0.0005833047325722873,
0.005803760606795549,
-0.009610875509679317,
0.0011492323828861117,
-0.005619717296212912,
0.00263061560690403,
-0.010171907022595406,
0.004449205938726664,
-0.009270892478525639,
0.0047961329109966755,
0.014591492712497711,
0.003951708320528269,
-0.004810071084648371,
-0.007186065893620253,
0.012432594783604145,
-0.0002763877564575523,
-0.009667102247476578,
-0.0011237524449825287,
-0.0030258847400546074,
-0.003807950299233198,
0.004997486714273691,
0.0014089196920394897,
-0.014845059253275394,
-0.0076621840707957745,
-0.00479394244030118,
0.002491859020665288,
-0.0012916442938148975,
0.00503696221858263,
0.00095417007105425,
0.0008500416879542172,
0.007022182922810316,
0.004938020370900631,
0.0019322242587804794,
-0.0026911760214716196,
-0.003611527616158128,
0.002167751546949148,
0.007778204511851072,
0.0027046650648117065,
0.0036957988049834967,
-0.00662989029660821,
0.006839906796813011,
0.009425561875104904,
0.01375141553580761,
0.005168938543647528,
0.018505603075027466,
-0.01190143171697855,
0.04625874385237694,
0.006992504931986332,
-0.007653480861335993,
0.002240430098026991,
-0.010511362925171852,
-0.002510643331333995,
-0.005150323733687401,
-0.029371613636612892,
-0.0007153308251872659,
-0.0039051861967891455,
-0.00022076272580306977,
0.003214950207620859,
-0.00012261653319001198,
0.006183288991451263,
-0.000529447803273797,
-0.003449300304055214,
-0.009784440509974957,
0.01269708201289177,
-0.00863249134272337,
-0.003649096703156829,
0.008183347061276436,
0.0024399508256465197,
-0.010826842859387398,
-0.0013873664429411292,
0.0016699983971193433,
-0.012643569149076939,
0.0031589269638061523,
0.0017799825873225927,
-0.005903636105358601,
0.05435786023736,
-0.0019216183573007584,
0.001548883505165577,
-0.0034836928825825453,
0.0009443725575692952,
0.0021731441374868155,
0.005396668333560228,
0.00993048120290041,
-0.004939422942698002,
0.011402200907468796,
0.008439616300165653,
0.0027995218988507986,
0.009381626732647419,
-0.00165317312348634,
0.006324002984911203,
-0.005027495324611664,
-0.0006455393740907311,
0.00027469746419228613,
-0.007536223158240318,
0.00923279020935297,
-0.0017703576013445854,
-0.005539650563150644,
0.0011597457341849804,
-0.0024237020406872034,
-0.010848489589989185,
0.00250254780985415,
-0.0035366499796509743,
0.0037760369013994932,
-0.010800381191074848,
-0.003830408677458763,
-0.0027342650573700666,
-0.005247585941106081,
0.001872748602181673,
0.009784436784684658,
0.0034181857481598854,
0.0012751533649861813,
-0.0030988811049610376,
-0.010143490508198738,
-0.0010034785373136401,
-0.005727451294660568,
0.002859968226402998,
0.0067672464065253735,
0.003924613352864981,
-0.010236845351755619,
-0.0010091406293213367,
0.0021664504893124104,
0.001247020554728806,
-0.0002497798122931272,
0.00273062102496624,
-0.008639924228191376,
0.006647179368883371,
-0.0016058400506153703,
0.002811020938679576,
0.012625361792743206,
-0.004079259466379881,
-0.0005780582432635128,
0.0015562191838398576,
0.0018899766728281975,
0.0009199835476465523,
0.005020733457058668,
0.009875061921775341,
-0.0032587689347565174,
-0.004617604892700911,
0.005224761553108692,
0.004760276526212692,
0.0076911561191082,
0.0032604981679469347,
-0.0018976102583110332,
0.001953970640897751,
-0.0049714501947164536,
-0.0004600108659360558,
0.0070325033739209175,
-0.0054864417761564255,
0.008002794347703457,
0.006050658877938986,
-0.014604958705604076,
-0.008097967132925987,
-0.0014058806700631976,
-0.009004442021250725,
0.0013729245401918888,
0.014431481249630451,
0.009703733958303928,
-0.002236713422462344,
0.0020274908747524023,
-0.012528683990240097,
0.0002303596556885168,
0.008435484021902084,
0.0012264898978173733,
-0.01141157653182745,
-0.9579981565475464,
0.005065706092864275,
0.0031179352663457394,
-0.0024965284392237663,
0.005067791789770126,
0.0014938911190256476,
0.0017553517827764153,
0.005605489015579224,
0.013198471628129482,
-0.010243616066873074,
-0.0055799889378249645,
-0.01157284714281559,
-0.010466949082911015,
-0.0009128979290835559,
-0.007845302112400532,
-0.0038556032814085484,
-0.006718948949128389,
-0.008427252992987633,
-0.0022848777007311583,
-0.001695273444056511,
-0.0020431780721992254,
0.009501371532678604,
-0.001040937379002571,
0.00512653635814786,
0.003120490349829197,
0.0032963489647954702,
-0.005524003878235817,
-0.0022372284438461065,
-0.00018150494724977762,
-0.0031789771746844053,
-0.005687285214662552,
-0.01547001488506794,
-0.002666393294930458,
-0.0007856344454921782,
0.01022298913449049,
0.0015939082950353622,
0.008663328364491463,
-0.0017993098590523005,
-0.00040073893615044653,
-0.008403628133237362,
0.004871835932135582,
0.0015058835269883275,
0.0015833203215152025,
-0.029298344627022743,
-0.00006020665023243055,
0.00023328863608185202,
-0.00921635702252388,
0.0072522577829658985,
0.0017211090307682753,
0.0006349955801852047,
-0.003912127576768398,
-0.0061850594356656075,
0.0088773462921381,
-0.008496006950736046,
0.004531430546194315,
-0.0033493696246296167,
-0.008189600892364979,
-0.0021130067761987448,
-0.00875033438205719,
0.0017781248316168785,
0.002923691412433982,
-0.003265797160565853,
-0.005069410894066095,
-0.004377823788672686,
0.004986807703971863,
0.0005778555641882122,
0.004338584840297699,
-0.01781611703336239,
-0.004811693914234638,
-0.00035099644446745515,
0.0018562874756753445,
-0.00015096810238901526,
-0.0042219506576657295,
0.004158103838562965,
-0.009413572028279305,
0.005335967522114515,
0.0009562218911014497,
0.00025011037359945476,
-0.01168399304151535,
0.0001274025853490457,
-0.008454726077616215,
-0.008433534763753414,
0.0034721025731414557,
-0.003830580972135067,
-0.0035495508927851915,
0.00041383670759387314,
0.003136970568448305,
0.006083551794290543,
-0.003998070489615202,
0.0026211619842797518,
0.010152512229979038,
-0.002641322324052453,
-0.011995437555015087,
0.006010891404002905,
0.007484048139303923,
0.0004287396150175482,
-0.0036765970289707184,
0.0041764164343476295,
0.007989681325852871,
0.007441133260726929,
0.0014624401228502393,
0.004560024477541447,
0.0012096903519704938,
0.010144411586225033,
0.0004137178766541183,
0.0007739868597127497,
-0.00333868945017457,
-0.001794115174561739,
-0.0034481000620871782,
-0.00011148549674544483,
-0.005105371121317148,
-0.0020336040761321783,
-0.012505012564361095,
-0.00972126703709364,
-0.0018786491127684712,
0.002426594030112028,
0.0023016431368887424,
-0.003392857266589999,
-0.0008014088962227106,
0.0003971366095356643,
0.008343607187271118,
-0.001563089550472796,
-0.005404417868703604,
-0.0006243066163733602,
0.0030626889783889055,
-0.007054911460727453,
0.015038236044347286,
-0.010003254748880863,
0.008479575626552105,
-0.0002964323794003576,
-0.0157932136207819,
0.007032974157482386,
0.011046352796256542,
-0.009121909737586975,
0.0034642156679183245,
0.000981074059382081,
0.004475537221878767,
0.0003971655969507992,
-0.003953900653868914,
-0.0037075013387948275,
-0.01788969710469246,
0.00025393901159986854,
0.0202991534024477,
0.0008855883497744799,
0.010395491495728493,
0.011709042824804783,
-0.00233323872089386,
0.002485640812665224,
0.006046058610081673,
0.0011130667990073562,
0.013581941835582256,
-0.007345479913055897,
-0.0008573124068789184,
0.002203781623393297,
-0.006237385794520378,
0.0015991105465218425,
0.005102998111397028,
0.005203486420214176,
-0.005222828593105078,
0.003244359977543354,
-0.006587795447558165,
-0.004380539059638977,
-0.016062777489423752,
-0.00334896775893867,
0.0051897927187383175,
-0.005058401729911566,
0.003933011554181576,
-0.01403957698494196,
0.005809654947370291,
0.006633272394537926,
0.004656224511563778,
-0.0000470247796329204,
0.0021341589745134115,
0.005395900923758745,
0.013359245844185352,
-0.006659077014774084,
0.001558996271342039,
0.004032667260617018,
-0.0007349056540988386,
0.0006188083789311349,
0.004530278500169516,
-0.008189703337848186,
-0.005461486056447029,
0.0019392224494367838,
0.005833786446601152,
-0.0019475900335237384,
-0.004148667212575674,
-0.008810819126665592,
-0.004536733962595463,
0.00379039254039526,
-0.009111153893172741,
0.003898173337802291,
0.00010660228872438893,
0.00430265860632062,
-0.006890358403325081,
-0.0021002867724746466,
-0.0033739088103175163,
-0.012790442444384098,
0.00996622908860445,
-0.003031013999134302,
0.003244816092774272,
0.01277246419340372,
0.0051692696288228035,
-0.012368161231279373,
0.004095062147825956,
0.009052235633134842,
-0.005690947640687227,
0.00203813542611897,
0.005585333798080683,
-0.005773948971182108,
-0.022606629878282547,
-0.0015970402164384723,
-0.01431204192340374,
0.006080429069697857,
-0.0011799357598647475,
0.0012498153373599052,
-0.008566837757825851,
0.006339783314615488,
0.0069012767635285854,
-0.012946497648954391,
-0.006834489293396473,
-0.007594018708914518,
0.009076545014977455,
0.0005777605692856014,
-0.00214195204898715,
-0.0032586229499429464,
-0.001358847483061254,
-0.0016965944087132812,
-0.003152037737891078,
-0.001325856545008719,
0.004399374593049288,
0.0024405058939009905,
-0.0037506113294512033,
0.0018859484698623419,
-0.002691032597795129,
0.0010952578159049153,
0.0011324887163937092,
-0.00995525624603033,
0.002823996590450406,
0.004280379507690668,
-0.001722527202218771,
-0.0013152954634279013,
0.0021937363781034946,
-0.0018462076550349593,
-0.007201621308922768,
-0.010922450572252274,
-0.004862917121499777,
-0.0051996223628520966,
-0.0040027243085205555,
-0.011926227249205112,
-0.0013521683868020773,
-0.00926305167376995,
0.00862071942538023,
-0.007773151621222496,
0.007979809306561947,
0.006283971946686506,
-0.006419810466468334,
0.007432924117892981,
-0.0030820223037153482,
0.004859020467847586,
0.0007434397703036666,
0.004818985238671303,
0.00030062932637520134,
-0.006644451525062323,
-0.011780492030084133,
0.011726322583854198,
-0.009639743715524673,
0.0006523671327158809,
0.01328497938811779,
0.006307743024080992,
0.008785360492765903,
0.0017488871235400438,
-0.00040771631756797433,
0.001957583473995328,
0.007638866081833839,
-0.012891505844891071,
0.002530122874304652,
-0.0035858277697116137,
-0.0006583190406672657,
0.004204587545245886,
-0.0041863271035254,
0.0004943764652125537,
0.007357384078204632,
0.000652033428195864,
-0.0060257879085838795,
-0.0025766994804143906,
0.001875855028629303,
0.0029330626130104065,
-0.011939694173634052,
-0.00015364518912974745,
-0.0036396817304193974,
-0.006092150695621967,
-0.003370848949998617,
0.0006260171066969633,
-0.0004321273881942034,
0.0037228830624371767,
-0.001967853866517544,
0.005309422500431538,
0.0032635461539030075,
-0.004780128598213196,
0.015583797357976437,
-0.004993961192667484,
-0.0033670144621282816,
0.00500365998595953,
0.0033633301500231028,
-0.0018117474392056465,
-0.004967709071934223,
-0.0016863521886989474,
0.002150429878383875,
0.006998156197369099,
-0.002205949043855071,
-0.004913693759590387,
-0.0020055612549185753,
0.0003026458725798875,
-0.008723161183297634,
0.000017346328604617156,
0.013118776492774487,
-0.006251503247767687,
0.005260860547423363,
-0.0019921050406992435,
-0.007144090719521046,
-0.014719066210091114,
0.0557192787528038,
-0.00045691669220104814,
0.004698208067566156,
0.0057449303567409515,
-0.006920319516211748,
0.00008399174112128094,
-0.0010230648331344128,
0.006743728183209896,
-0.007169615011662245,
-0.006247994489967823,
0.009889180772006512,
-0.004707687068730593,
0.002702874131500721,
0.0030854663345962763,
-0.0011836086632683873,
0.01658889278769493,
-0.004932567477226257,
-0.017991146072745323,
-0.016115399077534676,
0.008424276486039162,
-0.0032110370229929686,
-0.005839034449309111,
0.008508794941008091,
-0.003385483752936125,
-0.0014945334987714887,
0.0013026760425418615,
0.005299631506204605,
-0.00090960314264521,
0.0018186423694714904,
-0.0035341503098607063,
-0.004095614422112703,
-0.0005255526048131287,
0.003169010626152158,
0.004144399426877499,
0.008867906406521797,
-0.0028023652266710997,
0.0036510173231363297,
-0.0012379252584651113,
-0.001038947026245296,
-0.0024886291939765215,
0.005264220759272575,
0.0077940840274095535,
-0.0022127963602542877,
-0.0022294525988399982,
0.006082859355956316,
0.005381336901336908,
0.0030487601179629564,
0.012066710740327835,
0.00043625247781164944,
-0.0055231936275959015,
0.008833813481032848,
0.008276605978608131,
-0.0002544327871873975,
0.009576094336807728,
-0.0001868407562142238,
0.006201782263815403,
0.0015733630862087011,
-0.007658648770302534,
-0.014509358443319798,
-0.0026870504952967167,
0.008009885437786579,
0.009951433166861534,
-0.002647878834977746,
0.00034836711711250246,
-0.0005989129422232509,
-0.002915211720392108,
-0.007490108720958233,
-0.008783666417002678,
-0.0025865337811410427,
0.0017278131563216448,
0.004469604697078466,
0.07135175913572311,
-0.005165653768926859,
-0.001046708901412785,
-0.009029749780893326,
-0.0008456618525087833,
-0.0020783378276973963,
-0.00006496789865195751,
0.0005068566533736885,
0.00024225981906056404,
0.0030548162758350372,
0.0012305101845413446,
-0.00778920017182827,
-0.009819290600717068,
0.0003574186412151903,
0.002000601962208748,
-0.0022698258981108665,
0.0038760046008974314,
0.006741744466125965,
-0.007478171959519386,
0.0009356173104606569,
-0.010821741074323654,
-0.0016476241871714592,
-0.002383837476372719,
-0.010277037508785725,
-0.004161783494055271,
-0.0051454766653478146,
0.0039790961891412735,
0.0038623185828328133,
0.006246180273592472,
-0.004489996004849672,
0.006594604346901178,
-0.0021717639174312353,
0.0008523184224031866,
-0.005098894238471985,
0.00016092180158011615,
-0.005184924229979515,
0.008145587518811226,
0.0021818422246724367,
-0.010926607996225357,
-0.0067646699026227,
0.0016630702884867787,
0.0006668386631645262,
-0.005690021440386772,
0.004193849861621857,
-0.0007608429295942187,
0.006050140131264925,
-0.0029917277861386538,
0.0022695751395076513,
-0.008237095549702644,
0.0032649929635226727,
-0.01216869242489338,
0.004302913788706064,
-0.17467553913593292,
0.011090296320617199,
0.002611366333439946,
-0.005002026911824942,
-0.0026286880020052195,
-0.01703081652522087,
-0.006717433221638203,
0.003143847920000553,
0.009422616101801395,
0.0016369583318009973,
-0.001147652161307633,
-0.00048419670201838017,
0.005096611566841602,
0.0056834956631064415,
-0.0018287630518898368,
-0.0040115974843502045,
0.0054297782480716705,
-0.0027060529682785273,
-0.00006654658500337973,
0.0015158001333475113,
0.004306610208004713,
0.009702608920633793,
0.0017977551324293017,
0.0027154141571372747,
-0.0011688455706462264,
-0.004890552721917629,
0.004713546019047499,
-0.0008031409815885127,
0.0054619512520730495,
-0.01182822696864605,
-0.0025144193787127733,
-0.006492619402706623,
-0.003592269727960229,
0.0017294641584157944,
0.006546420510858297,
0.00002842893445631489,
0.007624949794262648,
0.002438827883452177,
-0.008474690839648247,
0.007283448241651058,
-0.007758404593914747,
0.029255133122205734,
0.0035229253116995096,
0.008639993146061897,
0.0009991826955229044,
-0.004625268280506134,
-0.004424118436872959,
0.01057401206344366,
0.0010175625793635845,
0.012601625174283981,
-0.013935912400484085,
-0.0007273504161275923,
0.002553675090894103,
0.019930655136704445,
-0.004536094143986702,
-0.010539240203797817,
-0.0068541960790753365,
-0.0061774724163115025,
0.0025467490777373314,
0.010005440562963486,
0.010144610889256,
-0.00630936911329627,
0.0060073924250900745,
-0.001980363391339779,
-0.020366065204143524,
0.004255622625350952,
-0.0061294944025576115,
-0.005019438918679953,
-0.0005173242534510791,
0.007150367368012667,
0.012688432820141315,
-0.00030988414073362947,
0.004631137941032648,
-0.0011721433838829398,
0.00533185712993145,
-0.0012555615976452827,
0.0051236082799732685,
-0.0025446065701544285,
0.007590767461806536,
-0.007721595000475645,
0.00890189316123724,
-0.008514655753970146,
-0.0028701189439743757,
0.0014557073591277003,
-0.0059911590069532394,
0.011305519379675388,
0.004412022419273853,
-0.0028268969617784023,
-0.0024882738944143057,
-0.010019388049840927,
-0.0022146899718791246,
0.0013441810151562095,
0.0028720167465507984,
-0.007996187545359135,
0.0026050785090774298,
-0.0012705441331490874,
0.004439041018486023,
0.005066717509180307,
-0.010574903339147568,
0.007221926003694534,
0.006012425292283297,
-0.007014217786490917,
0.0027380543760955334,
-0.004094793926924467,
0.0013413334963843226,
0.003645992837846279,
-0.00723302410915494,
-0.007468776777386665,
0.004213050939142704,
-0.008381137624382973,
-0.003933636471629143,
0.00519606051966548,
-0.008566983975470066,
-0.006656432058662176,
0.0005636492278426886,
-0.011187602765858173,
0.0011826978297904134
] |
8a7abfc40ef422e33ab3c8284edc61617b59e3dc | 1,165 | py | Python | skimage/segmentation/tests/test_felzenszwalb.py | jaberg/scikits-image | 2ab3e2dfb341189ef2ff9370c6cf3d33ef6ec88d | [
"BSD-3-Clause"
] | 2 | 2020-02-17T18:54:33.000Z | 2021-09-28T15:18:23.000Z | skimage/segmentation/tests/test_felzenszwalb.py | jaberg/scikits-image | 2ab3e2dfb341189ef2ff9370c6cf3d33ef6ec88d | [
"BSD-3-Clause"
] | 1 | 2020-03-30T12:31:55.000Z | 2020-03-30T12:31:55.000Z | skimage/segmentation/tests/test_felzenszwalb.py | emmanuelle/scikit-image | eccc41907135cf81b99c4be18a480a9bc705485d | [
"BSD-3-Clause"
] | 1 | 2019-12-20T19:19:59.000Z | 2019-12-20T19:19:59.000Z | import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from nose.tools import assert_greater
from skimage.segmentation import felzenszwalb
def test_grey():
# very weak tests. This algorithm is pretty unstable.
img = np.zeros((20, 21))
img[:10, 10:] = 0.2
img[10:, :10] = 0.4
img[10:, 10:] = 0.6
seg = felzenszwalb(img, sigma=0)
# we expect 4 segments:
assert_equal(len(np.unique(seg)), 4)
# that mostly respect the 4 regions:
for i in range(4):
hist = np.histogram(img[seg == i], bins=[0, 0.1, 0.3, 0.5, 1])[0]
assert_greater(hist[i], 40)
def test_color():
# very weak tests. This algorithm is pretty unstable.
img = np.zeros((20, 21, 3))
img[:10, :10, 0] = 1
img[10:, :10, 1] = 1
img[10:, 10:, 2] = 1
seg = felzenszwalb(img, sigma=0)
# we expect 4 segments:
assert_equal(len(np.unique(seg)), 4)
assert_array_equal(seg[:10, :10], 0)
assert_array_equal(seg[10:, :10], 2)
assert_array_equal(seg[:10, 10:], 1)
assert_array_equal(seg[10:, 10:], 3)
if __name__ == '__main__':
from numpy import testing
testing.run_module_suite()
| 29.125 | 73 | 0.628326 | 1 | 1.1946 | [
0.003771356074139476,
0.024544112384319305,
0.007437261287122965,
-0.0009227300761267543,
0.005940088536590338,
-0.0033053294755518436,
-0.007555654272437096,
0.0040388950146734715,
-0.005673842970281839,
-0.0009853695519268513,
0.004980565048754215,
0.003646450350061059,
0.007776285521686077,
-0.016421524807810783,
0.0019412223482504487,
0.018568862229585648,
-0.05386237055063248,
-0.00004856536543229595,
-0.00224973913282156,
0.005161692854017019,
-0.008392909541726112,
0.009934395551681519,
0.00854314025491476,
0.009050840511918068,
0.003999562002718449,
-0.0032964609563350677,
0.010183673352003098,
0.003503404324874282,
-0.00982181541621685,
-0.006832051556557417,
0.0014024281408637762,
-0.0012789033353328705,
-0.007300264667719603,
-0.0056047323159873486,
0.00461756344884634,
-0.003075622720643878,
0.0003650926228147,
-0.018670761957764626,
0.010597990825772285,
-0.006756115239113569,
-0.00667943712323904,
-0.018061773851513863,
0.0006698340876027942,
0.0038549804594367743,
-0.012726821936666965,
0.0022803808096796274,
-0.0027885730378329754,
0.00048407469876110554,
-0.009341738186776638,
0.0072162034921348095,
-0.011954128742218018,
0.0031355733517557383,
0.014534889720380306,
0.003768749302253127,
-0.0063487510196864605,
-0.006925781257450581,
0.010743438266217709,
0.00003415199898881838,
-0.012066255323588848,
0.0008652108372189105,
-0.0007020957418717444,
-0.002307708142325282,
0.003495896467939019,
0.0021160035394132137,
-0.013466584496200085,
-0.006756565533578396,
-0.006103185471147299,
0.0023269816301763058,
-0.00041978186345659196,
0.007147320546209812,
0.0012265529949218035,
-0.0012706875568255782,
0.0075350296683609486,
0.0030387621372938156,
0.004338268656283617,
-0.003575878217816353,
-0.001934607164002955,
0.002721025375649333,
0.0073484634049236774,
0.0034750208724290133,
0.003173158038407564,
-0.004893044475466013,
0.0042622885666787624,
0.011041471734642982,
0.013451263308525085,
0.010193239897489548,
0.01860312558710575,
-0.008684021420776844,
0.043347351253032684,
0.008575307205319405,
-0.007426638621836901,
0.0010736780241131783,
-0.010750841349363327,
-0.0014391648583114147,
-0.0014299496542662382,
-0.030316729098558426,
0.001655219472013414,
-0.004485650919377804,
-0.001401222893036902,
0.0045397598296403885,
-0.0024237532634288073,
0.006802184507250786,
-0.0012896280968561769,
-0.0017861005617305636,
-0.009440778754651546,
0.008948208764195442,
-0.008514244109392166,
-0.0007932538283057511,
0.007688640616834164,
0.004161574877798557,
-0.01249950286000967,
-0.0018488644855096936,
-0.00015268256538547575,
-0.01347094401717186,
0.0038344943895936012,
0.002757595619186759,
-0.00718687055632472,
0.055259305983781815,
-0.0025512282736599445,
0.0016701975837349892,
-0.005893281660974026,
-0.0022812860552221537,
0.0024357337970286608,
0.005413554608821869,
0.009934225119650364,
-0.005172662436962128,
0.011319599114358425,
0.0052182977087795734,
0.004994990304112434,
0.009678127244114876,
-0.0032279142178595066,
0.008850932121276855,
-0.00536632165312767,
-0.0014912346377968788,
0.0003078781592193991,
-0.007314649876207113,
0.004736858885735273,
-0.0010442585917189717,
-0.004710423294454813,
0.0028512361459434032,
-0.0014869184233248234,
-0.00991033110767603,
0.00023949430033098906,
-0.0069524808786809444,
0.006281496025621891,
-0.012733555398881435,
-0.0058616227470338345,
-0.0029277612920850515,
-0.0024940939620137215,
0.0013887843815609813,
0.009599209763109684,
0.003973755985498428,
0.004010568372905254,
-0.003774072742089629,
-0.008614721707999706,
-0.0014996532117947936,
-0.0032936669886112213,
0.0017597300466150045,
0.0050440942868590355,
0.003571223234757781,
-0.009728017263114452,
-0.0003933634434361011,
0.0027407247107475996,
0.0028051515109837055,
-0.0013776632258668542,
-0.0017304742941632867,
-0.006662892643362284,
0.008481381461024284,
-0.0000638760466245003,
0.00278470478951931,
0.011758211068809032,
-0.007440668530762196,
-0.0008550398051738739,
-0.00026111205806955695,
0.0027453892398625612,
0.0003624777018558234,
0.005548832006752491,
0.009028267115354538,
-0.002976285293698311,
-0.004342894535511732,
0.0038312766700983047,
0.003652454586699605,
0.009356479160487652,
0.008956719189882278,
-0.001953979255631566,
0.0011654292466118932,
-0.0052339606918394566,
0.000247437710640952,
0.007583552971482277,
-0.0056343358010053635,
0.006295483093708754,
0.0027347486466169357,
-0.014499935321509838,
-0.009635583497583866,
-0.004437093157321215,
-0.0084226094186306,
0.0019356408156454563,
0.015570827759802341,
0.011071099899709225,
-0.002139999531209469,
0.0016017347807064652,
-0.012331006117165089,
0.000672688358463347,
0.00805868860334158,
0.0017670225352048874,
-0.013401048257946968,
-0.9570395946502686,
0.005693288054317236,
0.003873680252581835,
-0.00284818047657609,
0.0057857464998960495,
0.005094987340271473,
0.0023423528764396906,
0.0038380566984415054,
0.015923038125038147,
-0.004690547473728657,
-0.008343272842466831,
-0.009794327430427074,
-0.011527398601174355,
0.0004896184545941651,
-0.00720535684376955,
-0.004262334201484919,
-0.00458780350163579,
-0.005700594745576382,
-0.00445178896188736,
-0.004511172883212566,
-0.003074812702834606,
0.00937851145863533,
-0.0015639436896890402,
0.005718291737139225,
0.004304052330553532,
0.002815475920215249,
-0.004539977293461561,
-0.0031205678824335337,
-0.002172591630369425,
-0.003903206204995513,
-0.007438351400196552,
-0.016056761145591736,
-0.0034030659589916468,
-0.0010787912178784609,
0.010980652645230293,
0.00011654914123937488,
0.009157504886388779,
-0.0007110292208380997,
0.0009558710735291243,
-0.008612428791821003,
0.004881819244474173,
0.001138363848440349,
0.005037959665060043,
-0.029577789828181267,
-0.0010892045684158802,
-0.0007742451271042228,
-0.009414097294211388,
0.0035351936239749193,
0.00213964213617146,
-0.0009615843882784247,
-0.003242975566536188,
-0.00686437264084816,
0.010926713235676289,
-0.0046389661729335785,
0.0026421165093779564,
-0.0012391500640660524,
-0.007063162978738546,
-0.002037977334111929,
-0.006052369251847267,
0.003618900664150715,
0.005618092603981495,
-0.006105862092226744,
-0.0034924461506307125,
-0.0040032388642430305,
0.0035482007078826427,
0.00128877570386976,
0.0027923882007598877,
-0.017545226961374283,
-0.005638951901346445,
-0.0020649803336709738,
0.004908987786620855,
-0.000673214381095022,
-0.005367422942072153,
0.0054522245191037655,
-0.00970372837036848,
0.004340872634202242,
0.0037751104682683945,
0.0009340139222331345,
-0.00917093362659216,
0.00018237467156723142,
-0.009931348264217377,
-0.006969058886170387,
0.003499565413221717,
-0.004152598325163126,
-0.003939623944461346,
-0.0003461574960965663,
0.003155659418553114,
0.008645029738545418,
-0.0068108863197267056,
0.002517308574169874,
0.010487345047295094,
-0.0024928071070462465,
-0.007640422787517309,
0.006228654645383358,
0.005655798129737377,
0.00020517072698567063,
-0.002446424216032028,
0.0021581596229225397,
0.006592365447431803,
0.006909199990332127,
0.0011506350710988045,
0.003982003312557936,
-0.000516447820700705,
0.0074960836209356785,
-0.001100791385397315,
0.0020277758594602346,
-0.0016893232241272926,
-0.0006823570001870394,
-0.004456872120499611,
-0.0012855426175519824,
-0.006058710161596537,
-0.002666780259460211,
-0.01177157461643219,
-0.007730249781161547,
-0.0066010840237140656,
0.0007863781065680087,
0.002963700331747532,
-0.0033131048548966646,
-0.0018786409636959434,
0.00015917091513983905,
0.010822432115674019,
-0.00110045843757689,
-0.004447844810783863,
0.000482327799545601,
0.0026652058586478233,
-0.006982572842389345,
0.014208049513399601,
-0.010513748042285442,
0.007162448950111866,
-0.0021925049368292093,
-0.017017191275954247,
0.006260700989514589,
0.007339341565966606,
-0.009323914535343647,
0.0017819346394389868,
0.003185856156051159,
0.0014989518094807863,
0.0006200532079674304,
-0.006916671991348267,
-0.0042105927132070065,
-0.016191650182008743,
0.00043702832772396505,
0.020442180335521698,
0.0019109997665509582,
0.011226269416511059,
0.013689250685274601,
-0.005269831977784634,
0.0023451524320989847,
0.0032431650906801224,
-0.0009717228240333498,
0.01501893438398838,
-0.007690554019063711,
0.00008842284296406433,
-0.0003139558248221874,
-0.006173726636916399,
0.0015762263210490346,
0.006244162563234568,
0.0058343554846942425,
-0.001868166378699243,
0.0047189416363835335,
-0.004884989000856876,
-0.004856184124946594,
-0.018316170200705528,
-0.0012084071058779955,
0.006819325033575296,
-0.004869294352829456,
0.005617076065391302,
-0.010876801796257496,
0.004339650273323059,
0.0068894922733306885,
0.004246497061103582,
0.0007603130652569234,
0.0016416670987382531,
0.0068873455747962,
0.009277086704969406,
-0.00540055800229311,
-0.0003629953716881573,
0.0065439133904874325,
-0.0021383333951234818,
-0.00022696639643982053,
0.0069096991792321205,
-0.00816272385418415,
-0.004468674771487713,
-0.001046697492711246,
0.0014670840464532375,
0.00237147300504148,
-0.003316337475553155,
-0.010396122001111507,
-0.004111382178962231,
0.004815354943275452,
-0.007139619905501604,
0.002616862766444683,
0.0022229210007935762,
0.0029858388006687164,
-0.005924350582063198,
0.0018722451059147716,
-0.0036595759447664022,
-0.010660246014595032,
0.011458611115813255,
-0.0034007043577730656,
0.0014666576171293855,
0.012886052019894123,
0.0055289557203650475,
-0.012797009199857712,
0.0070489742793142796,
0.01043660007417202,
-0.0029614618979394436,
0.003792891977354884,
0.006605328992009163,
-0.00455068564042449,
-0.022957948967814445,
-0.0007368198130279779,
-0.011035682633519173,
0.005661694332957268,
-0.0011233724653720856,
0.005990823730826378,
-0.006574042607098818,
0.006946123205125332,
0.0065772351808846,
-0.014809297397732735,
-0.004884027410298586,
-0.009523469023406506,
0.006959051825106144,
-0.00032083140104077756,
0.00002669663263077382,
-0.004075996577739716,
-0.00408289534971118,
-0.0026820101775228977,
-0.0024970429949462414,
-0.001539507880806923,
0.003225407563149929,
0.00010565702541498467,
-0.003099035006016493,
0.0033790357410907745,
-0.0018569703679531813,
0.0031816682312637568,
-0.0005645420169457793,
-0.009130117483437061,
0.004469253588467836,
0.004353913012892008,
-0.0036268685944378376,
0.00047693634405732155,
-0.000496908847708255,
-0.0015954280970618129,
-0.0062121679075062275,
-0.010167866945266724,
-0.005162831861525774,
-0.004703618586063385,
-0.0027656112797558308,
-0.011086549609899521,
-0.0037972142454236746,
-0.008220830000936985,
0.007805587258189917,
-0.008527791127562523,
0.008373886346817017,
0.0057667214423418045,
-0.0046871500089764595,
0.0062586404383182526,
-0.003010957967489958,
0.0017101949779316783,
0.00029056656057946384,
0.006328314542770386,
0.0012488497886806726,
-0.0075945365242660046,
-0.011242141015827656,
0.01381039060652256,
-0.008359493687748909,
0.001001140451990068,
0.01291089877486229,
0.005585480481386185,
0.010293860919773579,
0.00046495601418428123,
0.0007957122288644314,
0.003139201318845153,
0.008773749694228172,
-0.01469357218593359,
0.0012869728961959481,
-0.002763456664979458,
-0.0006529759848490357,
0.006461928132921457,
-0.0033676770981401205,
0.0013048588298261166,
0.012049954384565353,
0.0023032177705317736,
-0.007781195919960737,
0.00009491636592429131,
0.00401523569598794,
0.004242194350808859,
-0.011353407986462116,
0.0016358345746994019,
-0.0025903237983584404,
-0.0029067944269627333,
0.000017689570086076856,
-0.0027328592259436846,
0.001414722646586597,
0.0026780273765325546,
-0.00243888096883893,
0.0052672200836241245,
0.0018959161825478077,
-0.004206839017570019,
0.01583433523774147,
-0.00568404421210289,
-0.005797467194497585,
0.0047689154744148254,
0.001147625152952969,
-0.0030111439991742373,
-0.006674930453300476,
-0.005048790015280247,
0.0015267453854903579,
0.00617621885612607,
-0.0022867685183882713,
-0.004490622319281101,
-0.0032531735487282276,
0.0009274408221244812,
-0.010736680589616299,
-0.0009894598042592406,
0.014331988990306854,
-0.004317067097872496,
0.0049308654852211475,
0.0010730755748227239,
-0.0064454753883183,
-0.013515304774045944,
0.05363190546631813,
-0.0011359808268025517,
0.002863750560209155,
0.005531732924282551,
-0.006180246360599995,
0.0012016671244055033,
-0.0013501327484846115,
0.009065158665180206,
-0.009147833101451397,
-0.009893188253045082,
0.011498905718326569,
-0.004100483376532793,
0.003232489572837949,
0.0011292163981124759,
-0.00027935992693528533,
0.015223517082631588,
-0.004899617750197649,
-0.017056534066796303,
-0.014163253828883171,
0.007678693160414696,
-0.004349443130195141,
-0.0060766092501580715,
0.006811546627432108,
-0.0017992834327742457,
-0.001077493536286056,
0.002095339586958289,
0.007648287806659937,
-0.0009398896363563836,
0.0024847588501870632,
-0.0023966969456523657,
-0.003404701128602028,
0.0010438598692417145,
0.002139362273737788,
0.008014681749045849,
0.008923306129872799,
-0.0021395098883658648,
0.005881787743419409,
-0.0002677937736734748,
0.0005768162664026022,
-0.0032208054326474667,
0.0057602329179644585,
0.006843419745564461,
-0.0048319073393940926,
-0.004878799431025982,
0.0032757895532995462,
0.002832590602338314,
0.0019680687692016363,
0.00985493790358305,
0.00031255779322236776,
-0.006437649950385094,
0.009637842886149883,
0.00541285565122962,
-0.0023504223208874464,
0.008954988792538643,
-0.001575367758050561,
0.005180921405553818,
0.0010697615798562765,
-0.009637747891247272,
-0.013757508248090744,
-0.0016767128836363554,
0.0070384955033659935,
0.007575178053230047,
-0.00047777415602467954,
0.004202991724014282,
0.0027649004478007555,
-0.003266845364123583,
-0.00816415436565876,
-0.007010460831224918,
-0.0048071518540382385,
-0.0002990378416143358,
0.002026294358074665,
0.07219021767377853,
-0.007793954107910395,
-0.0012843419099226594,
-0.008758459240198135,
-0.00003489654773147777,
-0.0002840437809936702,
0.0007209961186163127,
-0.00139296380802989,
-0.001042014337144792,
0.003992605488747358,
0.002403564751148224,
-0.007584902923554182,
-0.010762046091258526,
0.0026744031347334385,
0.0005768655682913959,
-0.0017931610345840454,
0.0038420329801738262,
0.007046753540635109,
-0.006791813764721155,
0.0010128775611519814,
-0.013187914155423641,
-0.0005082218558527529,
-0.0016425050562247634,
-0.01096243504434824,
-0.005390674341470003,
-0.00443425215780735,
0.003929425030946732,
0.0013441038317978382,
0.005439796019345522,
-0.003273383481428027,
0.005885958671569824,
-0.004222055431455374,
0.0016481479397043586,
-0.0030046100728213787,
0.0004753815592266619,
-0.0065467567183077335,
0.007915045134723186,
0.001636513858102262,
-0.012321176938712597,
-0.003909893799573183,
-0.0017953284550458193,
0.004142004530876875,
-0.005093658342957497,
0.00590992346405983,
-0.005358619149774313,
0.007764812093228102,
-0.0028842389583587646,
0.0014579014386981726,
-0.005195131059736013,
0.0013688718900084496,
-0.012806263752281666,
0.005860352888703346,
-0.17828130722045898,
0.009945116937160492,
0.0031457541044801474,
-0.004665432497859001,
-0.003930652979761362,
-0.013937746174633503,
-0.009663701988756657,
0.004197979345917702,
0.011838671751320362,
0.0010934771271422505,
0.0005225245258770883,
-0.0027355714701116085,
0.004911111202090979,
0.004309921059757471,
-0.001104529481381178,
-0.006626189686357975,
0.004784596152603626,
-0.0038453955203294754,
0.0007458170293830335,
0.0023109877947717905,
0.0017880161758512259,
0.010130365379154682,
0.0035186512395739555,
0.001557427691295743,
-0.0009662536322139204,
-0.004269934259355068,
0.00694897398352623,
-0.0022898553870618343,
0.006511087529361248,
-0.012085813097655773,
-0.003455500118434429,
-0.005705683957785368,
-0.005796458572149277,
-0.00011072854249505326,
0.006030627992004156,
-0.0015324861742556095,
0.006913996767252684,
0.0027751754969358444,
-0.007367953658103943,
0.005873706191778183,
-0.00889304094016552,
0.030514154583215714,
0.0014100315747782588,
0.005798309575766325,
0.0005564190214499831,
-0.003906830679625273,
-0.00373034062795341,
0.010975987650454044,
0.001611062209121883,
0.013568474911153316,
-0.015374896116554737,
-0.0020394346211105585,
0.002175134140998125,
0.0201119314879179,
-0.0045115286484360695,
-0.009596970863640308,
-0.008502435870468616,
-0.005284056067466736,
0.0024007062893360853,
0.01178849209100008,
0.00931366253644228,
-0.004835303872823715,
0.006683573592454195,
-0.0011512533528730273,
-0.022899216040968895,
0.002841792767867446,
-0.005164552479982376,
-0.00881146639585495,
-0.0018295461777597666,
0.0070282998494803905,
0.009932897984981537,
-0.0011762615758925676,
0.0042193434201180935,
-0.0005519318510778248,
0.004529932048171759,
0.0010957312770187855,
0.005899444222450256,
-0.0035073538310825825,
0.006187890190631151,
-0.008834528736770153,
0.008019689470529556,
-0.009071248583495617,
-0.004098547622561455,
0.0009886061307042837,
-0.004893462639302015,
0.010297398082911968,
0.007489421404898167,
-0.004516278393566608,
-0.002232916187494993,
-0.006019520573318005,
-0.00036896762321703136,
0.00410617608577013,
0.0005104804295115173,
-0.008703920990228653,
0.00116975128185004,
-0.0011224313639104366,
0.006592640187591314,
0.007121758069843054,
-0.007476875092834234,
0.003927251789718866,
0.008754750713706017,
-0.00959116593003273,
0.0032522943802177906,
-0.002168375998735428,
0.0017871357267722487,
0.0030459966510534286,
-0.005297296680510044,
-0.005936574190855026,
0.0027643779758363962,
-0.008797986432909966,
-0.005248500499874353,
0.003098380984738469,
-0.007916562259197235,
-0.009079420939087868,
-0.0023582088761031628,
-0.012123670428991318,
0.00018533150432631373
] |
8a7ac7f87e160e8f864dafce2acd68a6454b8a68 | 1,419 | py | Python | tests/middleware/test_csrf_middleware.py | w3x10e8/core | d8f0ca29c2bd5e86d199391fa916ce2f5c9b0f49 | [
"MIT"
] | null | null | null | tests/middleware/test_csrf_middleware.py | w3x10e8/core | d8f0ca29c2bd5e86d199391fa916ce2f5c9b0f49 | [
"MIT"
] | null | null | null | tests/middleware/test_csrf_middleware.py | w3x10e8/core | d8f0ca29c2bd5e86d199391fa916ce2f5c9b0f49 | [
"MIT"
] | null | null | null | from masonite.request import Request
from masonite.view import View
from masonite.auth.Csrf import Csrf
from masonite.app import App
from masonite.middleware import CsrfMiddleware
from masonite.testsuite.TestSuite import generate_wsgi
import pytest
from masonite.exceptions import InvalidCSRFToken
class TestCSRFMiddleware:
def setup_method(self):
self.app = App()
self.request = Request(generate_wsgi())
self.view = View(self.app)
self.app.bind('Request', self.request)
self.request = self.app.make('Request')
self.middleware = CsrfMiddleware(self.request, Csrf(self.request), self.view)
def test_middleware_shares_correct_input(self):
self.middleware.before()
assert 'csrf_field' in self.view.dictionary
assert self.view.dictionary['csrf_field'].startswith("<input type='hidden' name='__token' value='")
def test_middleware_throws_exception_on_post(self):
self.request.environ['REQUEST_METHOD'] = 'POST'
self.middleware.exempt = []
with pytest.raises(InvalidCSRFToken):
self.middleware.before()
def test_incoming_token_does_not_throw_exception_with_token(self):
self.request.environ['REQUEST_METHOD'] = 'POST'
self.request.request_variables.update({'__token': self.request.get_cookie('csrf_token')})
self.middleware.exempt = []
self.middleware.before()
| 36.384615 | 107 | 0.718816 | 1 | 1.0716 | [
0.001958496868610382,
0.02214953489601612,
0.009147305972874165,
0.0014765451196581125,
0.005876997951418161,
-0.002173846587538719,
-0.008415449410676956,
0.0006242128438316286,
-0.006682863458991051,
0.002833258593454957,
0.0024365712888538837,
0.004763634409755468,
0.004491010680794716,
-0.014927804470062256,
-0.0009352047927677631,
0.015413427725434303,
-0.05046926066279411,
0.0023154481314122677,
-0.004011035431176424,
0.004764486104249954,
-0.0077010709792375565,
0.008459275588393211,
0.007815605029463768,
0.004091283772140741,
0.003998250234872103,
-0.0018193979049101472,
0.008438528515398502,
0.00324644916690886,
-0.006252104416489601,
-0.006237356923520565,
-0.0011243864428251982,
-0.00219605746679008,
-0.004223117139190435,
-0.008201124146580696,
0.005569510627537966,
-0.0024416381493210793,
0.000765513046644628,
-0.017646484076976776,
0.012191412039101124,
-0.004916124511510134,
-0.007775718811899424,
-0.01517184916883707,
-0.0017267201328650117,
0.00012513704132288694,
-0.009028693661093712,
0.002457271795719862,
-0.0032698141876608133,
0.00413117790594697,
-0.01584496907889843,
0.0057831620797514915,
-0.0076011172495782375,
0.006583007518202066,
0.01437800470739603,
0.0037294409703463316,
-0.0055518071167171,
-0.007772638462483883,
0.012839442119002342,
0.0006034882972016931,
-0.00944218598306179,
0.001284502330236137,
-0.006297302898019552,
-0.00486221257597208,
0.004351240117102861,
0.0012383004650473595,
-0.013733798637986183,
-0.005403146147727966,
-0.004164684563875198,
0.0027879755944013596,
-0.0010956794722005725,
0.007202137261629105,
0.001634004758670926,
-0.001293115084990859,
0.00610029511153698,
0.003826257074251771,
0.004594080615788698,
-0.004347969777882099,
-0.0008355166646651924,
-0.00004325023473938927,
0.007477836217731237,
0.0028456910513341427,
0.005905050318688154,
-0.0068914564326405525,
0.006378794554620981,
0.009009044617414474,
0.013538102619349957,
0.008337153121829033,
0.019114453345537186,
-0.011518683284521103,
0.04783209040760994,
0.00790958758443594,
-0.007535669486969709,
0.003537509124726057,
-0.008036660961806774,
-0.001225898740813136,
-0.00619250163435936,
-0.028268544003367424,
-0.0002104447194142267,
-0.004778534639626741,
0.0010493503650650382,
0.004302434157580137,
-0.00026547894231043756,
0.004169616382569075,
-0.002870944794267416,
-0.0006757141090929508,
-0.00926962774246931,
0.011645747348666191,
-0.009637774899601936,
-0.001504661631770432,
0.004880333784967661,
0.0003269880835432559,
-0.012152903713285923,
-0.0010238919639959931,
0.0031643903348594904,
-0.012568792328238487,
0.005105721764266491,
0.002199521055445075,
-0.004057719372212887,
0.050212107598781586,
0.0007964428514242172,
0.0010564819676801562,
-0.0055475193075835705,
0.0009725792915560305,
-0.000012539665476651862,
0.002183596370741725,
0.008597398176789284,
-0.0033107006456702948,
0.012721576727926731,
0.007405747193843126,
0.005024982150644064,
0.010015740990638733,
-0.0015472745290026069,
0.008334310725331306,
-0.0029631287325173616,
-0.0023567958269268274,
0.0007402132032439113,
-0.0054208203218877316,
0.004268398974090815,
-0.002761441981419921,
-0.008740561082959175,
0.004115072079002857,
-0.0007030388806015253,
-0.009940839372575283,
0.00006311483593890443,
-0.0036218268796801567,
0.006176596507430077,
-0.009362107142806053,
-0.0055627599358558655,
-0.007873267866671085,
-0.0050011295825243,
0.004233206156641245,
0.007496891543269157,
0.0051039750687778,
0.003014062764123082,
-0.00508455652743578,
-0.007004679646342993,
-0.0014708704547956586,
-0.004106960259377956,
-0.000032471678423462436,
0.005676617380231619,
0.0016818849835544825,
-0.010404149070382118,
-0.0005073168431408703,
0.0017509316094219685,
0.0036517614498734474,
-0.0017555691301822662,
0.0015367399901151657,
-0.007310743909329176,
0.005310476291924715,
-0.0004649924812838435,
0.003814246039837599,
0.008398068137466908,
-0.006097521632909775,
-0.0006262026727199554,
-0.0018612986896187067,
0.004166737664490938,
-0.0033293988090008497,
0.0059079257771372795,
0.011039490811526775,
-0.003921599593013525,
-0.0052639576606452465,
0.005338315386325121,
0.008391388691961765,
0.012208471074700356,
0.007696204818785191,
-0.003217838006094098,
0.0003869755601044744,
-0.002061571693047881,
-0.0018277677008882165,
0.005649115424603224,
-0.005093877203762531,
0.004462527111172676,
0.0035664790775626898,
-0.012384086847305298,
-0.010217960923910141,
0.0013577805366367102,
-0.008476225659251213,
0.0013563089305534959,
0.015036498196423054,
0.010389578528702259,
-0.003949746023863554,
0.005174777936190367,
-0.009329750202596188,
-0.00010326623305445537,
0.005541104357689619,
0.004409193992614746,
-0.013879884034395218,
-0.9601755142211914,
0.005866582505404949,
0.002092329552397132,
-0.000659148907288909,
0.005076238885521889,
0.001647808006964624,
0.0025296881794929504,
0.004744933918118477,
0.01491400133818388,
-0.008408675901591778,
-0.00633424986153841,
-0.012441600672900677,
-0.009722258895635605,
-0.0013156915083527565,
-0.007530819624662399,
-0.0037129241973161697,
-0.006284896284341812,
-0.005358003079891205,
-0.00677596777677536,
-0.002610784489661455,
-0.0028339126147329807,
0.0060471538454294205,
-0.0015390566550195217,
0.0046106851659715176,
0.002171106170862913,
0.006569273304194212,
-0.004469914361834526,
-0.00178235222119838,
-0.0017483739648014307,
-0.0020053412299603224,
-0.008550537750124931,
-0.012615613639354706,
-0.004947624169290066,
-0.00017337595636490732,
0.011171892285346985,
0.0011886405991390347,
0.0060909707099199295,
-0.0033128694631159306,
0.000415441463701427,
-0.00802099984139204,
0.006535508204251528,
-0.0019191522151231766,
0.0026574518997222185,
-0.02828015759587288,
0.0006156340823508799,
-0.0021722442470490932,
-0.008053346537053585,
0.009488408453762531,
-0.0015106014907360077,
0.0007542026578448713,
-0.001124101341702044,
-0.00501114409416914,
0.01047228742390871,
-0.006405992433428764,
0.0050592017360031605,
-0.0028763473965227604,
-0.006221266463398933,
-0.0037444615736603737,
-0.0072389463894069195,
0.0009268770809285343,
0.004719389136880636,
-0.005891137756407261,
-0.0042072804644703865,
-0.0019262634450569749,
0.002994115464389324,
0.002039825776591897,
0.0038725014310330153,
-0.01672418601810932,
-0.00676295580342412,
0.0012870634673163295,
-0.001807359978556633,
-0.004241808317601681,
-0.003878287272527814,
0.00519816717132926,
-0.008361339569091797,
0.008216537535190582,
0.004095958545804024,
-0.0011574088130146265,
-0.011053692549467087,
0.0009590284898877144,
-0.008811207488179207,
-0.009143851697444916,
0.0040313610807061195,
-0.006896080449223518,
-0.005945108365267515,
-0.00040242468821816146,
0.0035826361272484064,
0.008882212452590466,
-0.0035671587102115154,
0.003817509161308408,
0.013707970269024372,
-0.0034228391014039516,
-0.0069686416536569595,
0.006765611935406923,
0.0058427853509783745,
-0.00010315842519048601,
-0.0014052428305149078,
0.0035877791233360767,
0.005994703155010939,
0.0055060298182070255,
0.0020157203543931246,
0.005642957054078579,
0.0007122599636204541,
0.007266949396580458,
-0.0011076267110183835,
-0.001053127460181713,
-0.0029480441007763147,
-0.00020855365437455475,
-0.004441116936504841,
-0.0012821913696825504,
-0.004786652512848377,
-0.001909641781821847,
-0.015138892456889153,
-0.0063989791087806225,
-0.0001866604870883748,
-0.0018590985564514995,
0.00460438197478652,
-0.001825470244511962,
-0.00026083149714395404,
0.0019793331157416105,
0.007712582591921091,
0.0008233267581090331,
-0.0019692264031618834,
-0.0003411149955354631,
0.0030266207177191973,
-0.0062825679779052734,
0.012116437777876854,
-0.01191739086061716,
0.0069264015182852745,
-0.0007673734799027443,
-0.012961058877408504,
0.007276975549757481,
0.012487892061471939,
-0.008705873973667622,
0.00445040687918663,
0.004286701325327158,
0.0025799605064094067,
-0.0033575445413589478,
-0.007940350100398064,
-0.0013724808814004064,
-0.014852904714643955,
0.00039585225749760866,
0.018585823476314545,
0.00039781403029337525,
0.010589616373181343,
0.012220978736877441,
-0.00232950528152287,
0.001007482293061912,
0.0043116966262459755,
0.0015901037259027362,
0.012413929216563702,
-0.008579632267355919,
-0.0010780327720567584,
0.0003682503884192556,
-0.005414139945060015,
0.0010926710674539208,
0.0048675029538571835,
0.0061975386925041676,
-0.00009540643077343702,
0.004828596953302622,
-0.005375437438488007,
-0.005797712132334709,
-0.017365245148539543,
-0.002515163505449891,
0.009360725060105324,
-0.0035946585703641176,
0.0069923363626003265,
-0.009137177839875221,
0.005741639528423548,
0.005243574269115925,
0.005384871270507574,
0.0004635173245333135,
0.0011138065019622445,
0.007329015526920557,
0.012295863591134548,
-0.006738173309713602,
0.00448941346257925,
0.0024449338670819998,
-0.002520178444683552,
0.00017653490067459643,
0.00965796411037445,
-0.007858277298510075,
-0.006271240301430225,
0.0023776700254529715,
0.00340093276463449,
0.0012195450253784657,
-0.0018446006579324603,
-0.007023720070719719,
-0.0026240835431963205,
0.004461957141757011,
-0.005737331695854664,
0.0025752531364560127,
0.00526136951521039,
0.004412197507917881,
-0.004238068126142025,
0.0005150224315002561,
-0.004859692882746458,
-0.012596669606864452,
0.010757679119706154,
-0.0027530041988939047,
0.002061117673292756,
0.012828514911234379,
0.004510991275310516,
-0.008769849315285683,
0.005774722434580326,
0.008394792675971985,
-0.003485956462100148,
0.005927442107349634,
0.007028580643236637,
-0.005012377630919218,
-0.02201787941157818,
-0.004954999312758446,
-0.014907293021678925,
0.006332243327051401,
-0.002685196464881301,
0.007484616246074438,
-0.006297883577644825,
0.008175703696906567,
0.005729238037019968,
-0.015390971675515175,
-0.006202367600053549,
-0.00748660322278738,
0.011361370794475079,
0.0014228541404008865,
0.0018053892999887466,
-0.002774292603135109,
0.0013671836350113153,
-0.003309760009869933,
-0.0024385727010667324,
-0.002989088883623481,
0.004737135488539934,
0.0027768113650381565,
-0.0037299077957868576,
0.0023927653674036264,
-0.0064265853725373745,
-0.0002815519110299647,
0.00339007331058383,
-0.011915085837244987,
0.0028287721797823906,
0.004800512921065092,
-0.0025592695455998182,
-0.003938884939998388,
-0.00002027982372965198,
-0.002148054540157318,
-0.009755359962582588,
-0.010803308337926865,
-0.0041175480000674725,
-0.003777356818318367,
-0.0032200117129832506,
-0.010816236957907677,
-0.0018580569885671139,
-0.007264061365276575,
0.00442382600158453,
-0.008649887517094612,
0.003963508177548647,
0.006668217945843935,
-0.005283969454467297,
0.007443721406161785,
0.00010713745723478496,
0.001294418703764677,
0.002912660362198949,
0.004036944825202227,
0.0008610397926531732,
-0.003363886848092079,
-0.014655165374279022,
0.012877363711595535,
-0.007898151874542236,
-0.000301174761261791,
0.013892865739762783,
0.006287704221904278,
0.010905373841524124,
-0.0010091293370351195,
-0.0013985874829813838,
0.0015982454642653465,
0.008181961253285408,
-0.013887688517570496,
0.00025520226336084306,
-0.0029165935702621937,
0.0008157815900631249,
0.00244353455491364,
-0.0037398282438516617,
0.0018847965402528644,
0.009189309552311897,
0.0037609071005135775,
-0.0061869192868471146,
-0.00565258739516139,
0.0008986449684016407,
0.0052293394692242146,
-0.012512009590864182,
0.000742608739528805,
-0.004121319390833378,
-0.005897832103073597,
-0.002260562963783741,
-0.0042740702629089355,
-0.000896463287062943,
0.005618976894766092,
-0.0028132975567132235,
0.003489287104457617,
0.004401802085340023,
-0.006332181394100189,
0.01558315847069025,
-0.004758121445775032,
-0.005041875410825014,
0.001822016085498035,
0.0016633099876344204,
-0.0021283894311636686,
-0.006576717831194401,
-0.00719531811773777,
0.003963375464081764,
0.0065235719084739685,
-0.0004627951420843601,
-0.007320220582187176,
0.0006481813616119325,
0.0007114528561942279,
-0.011103206314146519,
-0.00078943109838292,
0.00778568210080266,
-0.0028345908503979445,
0.004845170769840479,
-0.0019871906843036413,
-0.006756408140063286,
-0.01351688802242279,
0.05290086194872856,
-0.0007560945814475417,
0.005187784321606159,
0.003910130355507135,
-0.007828263565897942,
-0.003296193201094866,
-0.00171463203150779,
0.00839878898113966,
-0.0057149906642735004,
-0.007325435522943735,
0.006669138092547655,
-0.001655188505537808,
0.003865946549922228,
0.002029735827818513,
-0.0011535377707332373,
0.014149777591228485,
-0.004462565295398235,
-0.01121350284665823,
-0.01778467930853367,
0.007416356820613146,
-0.006626972928643227,
-0.008854513987898827,
0.01102761086076498,
-0.0023403267841786146,
-0.008083763532340527,
0.0025326849427074194,
0.00690347608178854,
0.0011518087703734636,
-0.0012947790091857314,
-0.0027426097076386213,
-0.0017955334624275565,
-0.00037095308653078973,
0.0025188468862324953,
0.0034222013782709837,
0.005502402316778898,
-0.006226908415555954,
0.004053925629705191,
-0.0014755823649466038,
-0.004352721385657787,
0.0013526231050491333,
0.00275682145729661,
0.008118736557662487,
-0.00010375708370702341,
-0.0015779294772073627,
0.006445492617785931,
0.006088873837143183,
0.0017772011924535036,
0.010296940803527832,
0.000759650079999119,
-0.008200505748391151,
0.010332228615880013,
0.009874103590846062,
-0.00030137435533106327,
0.009151642210781574,
-0.0021149914246052504,
0.006003648974001408,
0.003260652767494321,
-0.006030690390616655,
-0.0197478998452425,
-0.00445539178326726,
0.005703371949493885,
0.010796393267810345,
-0.0021204384975135326,
0.0015837113605812192,
-0.0021201581694185734,
-0.001123939175158739,
-0.006804287433624268,
-0.0058736903592944145,
-0.00299143698066473,
-0.00013509237032849342,
0.006477781571447849,
0.06857642531394958,
-0.009337899275124073,
-0.0012101046741008759,
-0.009943888522684574,
-0.0011879383819177747,
-0.001285960664972663,
-0.00014576448302250355,
0.004363367334008217,
-0.0015233817975968122,
0.0023403349332511425,
-0.002216121181845665,
-0.006482040975242853,
-0.011124667711555958,
-0.00029372028075158596,
0.003208613023161888,
-0.003221228951588273,
0.00036126773920841515,
0.006205576937645674,
-0.011130093596875668,
0.0023163463920354843,
-0.010362137109041214,
-0.004489060956984758,
-0.0032970248721539974,
-0.009042187593877316,
-0.004905496258288622,
-0.0025593601167201996,
0.005878914147615433,
0.004226835910230875,
0.00537850009277463,
-0.0033968507777899504,
0.007790812291204929,
-0.0026724671479314566,
0.0009089440573006868,
-0.005415318068116903,
-0.0005425012786872685,
-0.002233940875157714,
0.006400614511221647,
0.0019073521252721548,
-0.010877801105380058,
-0.0025509875267744064,
-0.003413589671254158,
0.0009492809185758233,
-0.005901576951146126,
0.002560533583164215,
-0.0007803005864843726,
0.004727160558104515,
-0.004068978130817413,
0.00008358943887287751,
-0.00469543831422925,
0.0017465928103774786,
-0.012231648899614811,
0.005589485168457031,
-0.1686374694108963,
0.009051697328686714,
0.0030058345291763544,
-0.005040558520704508,
-0.004565350711345673,
-0.016018569469451904,
-0.006528889294713736,
0.00664568692445755,
0.008823527954518795,
0.0010378683218732476,
-0.002436139155179262,
0.0012944333720952272,
0.00493353046476841,
0.004864642862230539,
-0.0032607915345579386,
-0.006401340011507273,
0.0009589093970134854,
-0.0029392922297120094,
0.001826076884754002,
0.0054466612637043,
0.002247534692287445,
0.01037610787898302,
0.0008226089412346482,
0.00042845553252846,
-0.0016523407539352775,
-0.004392577800899744,
0.006969178095459938,
-0.004172614309936762,
0.0034181110095232725,
-0.009442402981221676,
-0.0027470500208437443,
-0.004253378603607416,
-0.005386726465076208,
0.0003981452318839729,
0.004783489741384983,
-0.0003222907835152,
0.008995294570922852,
0.004830961115658283,
-0.007718784734606743,
0.007350301835685968,
-0.010483689606189728,
0.027367595583200455,
0.008181218057870865,
0.006117676384747028,
0.0025719546247273684,
-0.007487280759960413,
-0.004647138528525829,
0.008247282356023788,
0.001026616431772709,
0.011803187429904938,
-0.014110758900642395,
-0.0021803677082061768,
0.0025685452856123447,
0.01794259250164032,
-0.005963942967355251,
-0.00836031325161457,
-0.008265161886811256,
-0.0022764464374631643,
0.0026704263873398304,
0.00859729666262865,
0.011511777527630329,
-0.0036037282552570105,
0.0068215178325772285,
-0.00388065492734313,
-0.019509773701429367,
0.0031490656547248363,
-0.005202986299991608,
-0.008126203902065754,
0.0015313188778236508,
0.004888845141977072,
0.009846944361925125,
-0.0013100827345624566,
-0.0002930239134002477,
0.0008413748582825065,
0.005793799180537462,
-0.000548589217942208,
0.008658153004944324,
-0.0005819662474095821,
0.0063240849412977695,
-0.009061571210622787,
0.009056050330400467,
-0.011584877967834473,
-0.0009505084017291665,
0.002345006912946701,
-0.002885222900658846,
0.011698986403644085,
0.0034038734156638384,
-0.0008083762950263917,
-0.000030934010283090174,
-0.0083496468141675,
-0.001884416793473065,
0.000527306692674756,
0.000512921717017889,
-0.008900233544409275,
0.003240470541641116,
0.0002339993807254359,
0.00616579269990325,
0.007973325438797474,
-0.01025464478880167,
0.006910907104611397,
0.003779682097956538,
-0.005386405158787966,
0.002559392247349024,
-0.007371493149548769,
0.0010673434007912874,
0.002935017691925168,
-0.005311054643243551,
-0.004983939696103334,
0.003421432338654995,
-0.005228167399764061,
-0.004545949399471283,
0.004833999555557966,
-0.007968983612954617,
-0.010069025680422783,
-0.0018300368683412671,
-0.007859330624341965,
0.00032666706829331815
] |
8a7bd23662f4d2b0b0c83db0df08df0f16f7923c | 690 | py | Python | phoible/views.py | ltxom/phoible | 7ce6f5e62d885f142dba61937d920e68fa7f9fca | [
"Apache-2.0"
] | 31 | 2015-01-20T01:36:22.000Z | 2022-03-11T16:47:30.000Z | phoible/views.py | ltxom/phoible | 7ce6f5e62d885f142dba61937d920e68fa7f9fca | [
"Apache-2.0"
] | 22 | 2015-03-09T11:11:31.000Z | 2022-03-07T14:08:29.000Z | phoible/views.py | ltxom/phoible | 7ce6f5e62d885f142dba61937d920e68fa7f9fca | [
"Apache-2.0"
] | 12 | 2015-11-16T18:28:43.000Z | 2021-05-20T21:55:49.000Z | from pyramid.view import view_config
import os
@view_config(route_name='faq', renderer='faq.mako')
def faq_view(request):
dir_path = os.path.dirname(__file__)
faq_file = os.path.join(dir_path, 'static/faq_with_indexes.html')
with open(faq_file, 'r') as f:
faq_page = f.read()
return {'content': faq_page}
@view_config(route_name='conventions', renderer='conventions.mako')
def conventions_view(request):
dir_path = os.path.dirname(__file__)
conventions_file = os.path.join(dir_path, 'static/conventions.html')
with open(conventions_file, 'r') as file:
conventions_page = file.read().replace('\n', '')
return {'content': conventions_page}
| 32.857143 | 72 | 0.708696 | 1 | 0.8736 | [
0.002839874243363738,
0.02436172589659691,
0.008931046351790428,
0.002024557674303651,
0.004326375667005777,
-0.0023288100492209196,
-0.01294653583317995,
0.003100469708442688,
-0.008271203376352787,
0.003190244548022747,
0.003425762988626957,
0.001953603234142065,
0.006231609266251326,
-0.017910202965140343,
0.0005672082188539207,
0.01651999168097973,
-0.05172157660126686,
0.004755339119583368,
-0.0042313928715884686,
0.0017565444577485323,
-0.008560076355934143,
0.008638912811875343,
0.007105412892997265,
0.006012824829667807,
0.006523011717945337,
-0.00006313183985184878,
0.011013705283403397,
0.0011308499379083514,
-0.008058118633925915,
-0.006494577974081039,
-0.001927486271597445,
-0.0020641274750232697,
-0.0024512838572263718,
-0.007015131879597902,
0.005810445640236139,
-0.002945988904684782,
0.0006245127297006547,
-0.021415503695607185,
0.011655639857053757,
-0.0036223195493221283,
-0.008081676438450813,
-0.017207801342010498,
-0.001452658325433731,
0.0008191668894141912,
-0.013740192167460918,
0.0023939493112266064,
-0.005119931418448687,
0.00620915275067091,
-0.013763085938990116,
0.007135381922125816,
-0.008617301471531391,
0.007254195865243673,
0.015056935139000416,
0.0023428238928318024,
-0.004671684466302395,
-0.006637765560299158,
0.013518515042960644,
0.0019219234818592668,
-0.011842050589621067,
0.0028653754852712154,
-0.003926537465304136,
-0.0037439404986798763,
0.004647451918572187,
0.0035069147124886513,
-0.01926814578473568,
-0.0060971518978476524,
-0.003974940627813339,
0.001291091670282185,
-0.0009694657637737691,
0.006203691475093365,
0.002364597748965025,
-0.0011611237423494458,
0.008297177031636238,
0.0036680197808891535,
0.006983897183090448,
-0.00345676951110363,
-0.0010842349147424102,
0.0011084001744166017,
0.009159172885119915,
0.0032439150381833315,
0.004700880963355303,
-0.008776005357503891,
0.0064460583962500095,
0.010788902640342712,
0.013844696804881096,
0.007690412923693657,
0.02144135721027851,
-0.010786745697259903,
0.04797147586941719,
0.007740309461951256,
-0.00864253006875515,
0.0016125928377732635,
-0.009859112091362476,
-0.0023854130413383245,
-0.005550399422645569,
-0.03359164297580719,
0.0010918239131569862,
-0.005328907165676355,
-0.0006491573294624686,
0.003730475902557373,
0.00016561051597818732,
0.006202239543199539,
-0.0018165234941989183,
-0.00045615393901243806,
-0.010762861929833889,
0.01593397557735443,
-0.011792993173003197,
-0.0017853676108643413,
0.007732924539595842,
0.0017355072777718306,
-0.01162765547633171,
-0.000808568496722728,
0.0019474326400086284,
-0.011901306919753551,
0.004910580348223448,
0.002743880031630397,
-0.002496179426088929,
0.05861898511648178,
0.0010687093017622828,
0.003159869695082307,
-0.00564251933246851,
-0.0013399786548689008,
-0.00019709421030711383,
0.007395960856229067,
0.009399539791047573,
-0.0011173086240887642,
0.012072702869772911,
0.0033733004238456488,
0.004944321233779192,
0.009357819333672523,
-0.00009043083264259622,
0.0067673334851861,
-0.005351721774786711,
-0.0037314333021640778,
0.001814196351915598,
-0.007106533274054527,
0.008449230343103409,
-0.0022093604784458876,
-0.009027654305100441,
-0.00016131813754327595,
0.0007382746553048491,
-0.009808223694562912,
0.0004770918167196214,
-0.0020929102320224047,
0.0012468990171328187,
-0.01395377330482006,
-0.003949083387851715,
-0.003911725711077452,
-0.006052103359252214,
0.004719849210232496,
0.00812747236341238,
0.004609249997884035,
0.0038334771525114775,
-0.004049737937748432,
-0.008221220225095749,
-0.0007300938596017659,
-0.005444528069347143,
0.0019259798573330045,
0.006263789255172014,
0.0021109499502927065,
-0.009677332825958729,
0.00006476106500485912,
0.004059699829667807,
0.004477857146412134,
-0.0019475044682621956,
0.003946992103010416,
-0.0063180094584822655,
0.009132579900324345,
-0.00011412112507969141,
0.005181923974305391,
0.011018716730177402,
-0.006393641233444214,
-0.0008351764408871531,
-0.0005596671253442764,
0.002840758301317692,
0.00006401274731615558,
0.004829576704651117,
0.01129919197410345,
-0.005614170804619789,
-0.0065618776716291904,
0.005663835909217596,
0.0076219928450882435,
0.009371423162519932,
0.006588674150407314,
-0.0012788292951881886,
0.0007348979124799371,
-0.005823046434670687,
-0.00126285245642066,
0.006197904236614704,
-0.004543899092823267,
0.005294566974043846,
0.004592130426317453,
-0.015363193117082119,
-0.005645629484206438,
0.0019138819770887494,
-0.006543201394379139,
0.0013014234136790037,
0.015972543507814407,
0.011116302572190762,
-0.003082899609580636,
0.0023569990880787373,
-0.011690039187669754,
0.0008358015911653638,
0.007145448587834835,
0.00354625447653234,
-0.012372984550893307,
-0.9552368521690369,
0.006194130517542362,
0.0038968173321336508,
-0.0017896357458084822,
0.0062458631582558155,
0.003440368687734008,
0.0030970508232712746,
0.00545948650687933,
0.012596611864864826,
-0.008575087413191795,
-0.005613228771835566,
-0.011806624941527843,
-0.011016929522156715,
-0.0016089064301922917,
-0.0072759962640702724,
-0.00546982791274786,
-0.007186447735875845,
-0.006690062116831541,
-0.0039025666192173958,
-0.003783896565437317,
-0.0031790852081030607,
0.009373791515827179,
-0.0005541252321563661,
0.004689526278525591,
0.0025132365990430117,
0.006992348004132509,
-0.004738921765238047,
0.0008817454800009727,
0.0001549741718918085,
-0.0021361703984439373,
-0.006082179490476847,
-0.01524556614458561,
-0.004550712648779154,
-0.0009824318112805486,
0.009645260870456696,
0.00041711251833476126,
0.009339198470115662,
-0.0026713458355516195,
0.0010285681346431375,
-0.00871072057634592,
0.006167635787278414,
0.0023548700846731663,
0.002137573668733239,
-0.031418319791555405,
-0.0003613711742218584,
-0.002185316290706396,
-0.008305612951517105,
0.010228359140455723,
0.00029232719680294394,
-0.00002217607652710285,
-0.0026287368964403868,
-0.003996196668595076,
0.009848758578300476,
-0.00913473591208458,
0.004707091487944126,
-0.004322042688727379,
-0.007288945373147726,
-0.004211800172924995,
-0.009585980325937271,
0.0014977958053350449,
0.005601572338491678,
-0.003724160371348262,
-0.004835160449147224,
-0.00589150283485651,
0.0012471637455746531,
0.0011684935307130218,
0.003112973878160119,
-0.021730555221438408,
-0.006758735049515963,
-0.000003498220394249074,
0.000268003495875746,
-0.00518881855532527,
-0.003704684553667903,
0.001790118170902133,
-0.010626671835780144,
0.008822256699204445,
0.0026892602909356356,
-0.0008446447900496423,
-0.011574694886803627,
0.0027870468329638243,
-0.006662231869995594,
-0.009968498721718788,
0.00208470830693841,
-0.005486794747412205,
-0.005089504178613424,
-0.0011952241184189916,
0.0014183904277160764,
0.009747583419084549,
-0.004658125806599855,
0.0006377121899276972,
0.011589854024350643,
-0.004167960491031408,
-0.008056334219872952,
0.008784902282059193,
0.007693955674767494,
0.0006487014470621943,
-0.002385513624176383,
0.002872284734621644,
0.009175694547593594,
0.007105185650289059,
0.0007665472803637385,
0.004874426871538162,
-0.0005093355430290103,
0.010867764241993427,
-0.0005219676531851292,
0.0008476146613247693,
-0.003788124769926071,
-0.0013132196618244052,
-0.003592114197090268,
-0.0004703018057625741,
-0.0036151474341750145,
-0.0018924284959211946,
-0.012369144707918167,
-0.009517612867057323,
-0.0035475888289511204,
-0.0005488081369549036,
0.001841518678702414,
-0.005266247317194939,
-0.0012311824830248952,
0.0026944237761199474,
0.007721416652202606,
-0.000990772619843483,
-0.0031272517517209053,
0.000990000437013805,
0.0024982281029224396,
-0.010821879841387272,
0.01500962395220995,
-0.01346567366272211,
0.005832210183143616,
0.00019823155889753252,
-0.01739593781530857,
0.006573289632797241,
0.01020557526499033,
-0.006921460386365652,
0.0026054095942527056,
0.004919111263006926,
0.004430536646395922,
-0.0005582625744864345,
-0.0066602798178792,
-0.0030691255815327168,
-0.01487797312438488,
0.0014387954724952579,
0.021120961755514145,
0.0010809149825945497,
0.01070778165012598,
0.012203365564346313,
-0.0032922590617090464,
0.0026666976045817137,
0.006970058660954237,
0.0018468358321115375,
0.013953955844044685,
-0.008251657709479332,
-0.0013865696964785457,
0.0014581308932974935,
-0.008326314389705658,
-0.00017853260214906186,
0.004385025706142187,
0.004218508023768663,
-0.001396310399286449,
0.004051788244396448,
-0.009097741916775703,
-0.00550114456564188,
-0.01867540553212166,
-0.004171192180365324,
0.00814178679138422,
-0.0046516768634319305,
0.003761953441426158,
-0.011181776411831379,
0.007662234827876091,
0.005135676357895136,
0.0066296411678195,
-0.0010587457800284028,
0.0021946984343230724,
0.00726499455049634,
0.01191660389304161,
-0.007195909507572651,
0.00368596357293427,
0.00031125752138905227,
-0.0010822750627994537,
0.0010360251180827618,
0.007966027595102787,
-0.009449049830436707,
-0.005137204192578793,
0.003758818143978715,
0.005325385369360447,
-0.0002814152103383094,
-0.0034930214751511812,
-0.007686811499297619,
-0.0058255321346223354,
0.004362075589597225,
-0.007399436552077532,
0.003950845450162888,
0.00448888773098588,
0.0036781555972993374,
-0.006620533298701048,
-0.0004442953213583678,
-0.004328257404267788,
-0.012630603276193142,
0.010561143048107624,
-0.0032966553699225187,
0.0019020852632820606,
0.01361896377056837,
0.004744740203022957,
-0.011211451143026352,
0.0056692794896662235,
0.006465844344347715,
-0.003985858056694269,
0.004134898539632559,
0.009298627264797688,
-0.005757336970418692,
-0.022615404799580574,
-0.0006008793134242296,
-0.014559830538928509,
0.00802141334861517,
-0.003433849895372987,
0.005612160544842482,
-0.0066371639259159565,
0.0037993097212165594,
0.006580868735909462,
-0.014818207360804081,
-0.0049494728446006775,
-0.010443875566124916,
0.011127040721476078,
0.000038673457311233506,
0.00026643837918527424,
-0.00418560765683651,
-0.0008627657080069184,
-0.002272104611620307,
-0.003654573578387499,
-0.0022596733178943396,
0.005832746624946594,
0.0023781289346516132,
-0.0028813802637159824,
0.0036048362962901592,
-0.00340434187091887,
0.0015533223049715161,
0.0034459137823432684,
-0.010384002700448036,
0.0022919161710888147,
0.004579981788992882,
-0.0025773108936846256,
-0.0019212232436984777,
0.0002999766147695482,
0.0005701934569515288,
-0.007952072657644749,
-0.009986339136958122,
-0.0018115452257916331,
-0.004890133161097765,
-0.0021472095977514982,
-0.010838101617991924,
-0.0014225010527297854,
-0.008512558415532112,
0.006899144966155291,
-0.007604950573295355,
0.007624208927154541,
0.006148090586066246,
-0.00554276118054986,
0.00692044198513031,
-0.0006392444483935833,
0.004761968273669481,
0.005164558067917824,
0.005409367848187685,
0.0016767854103818536,
-0.003505842760205269,
-0.011842885985970497,
0.012197031639516354,
-0.007483660709112883,
-0.001086236909031868,
0.01314058993011713,
0.005378959234803915,
0.009087763726711273,
0.00041544283158145845,
-0.0007017365423962474,
0.0028080386109650135,
0.00825486145913601,
-0.014600839465856552,
0.000038202957512112334,
-0.0011296144220978022,
-0.00007299705612240359,
0.003639157395809889,
-0.005186309572309256,
0.0019452085252851248,
0.008519529365003109,
0.002701724413782358,
-0.007712789811193943,
-0.0014121258864179254,
0.0001679714914644137,
0.005524269305169582,
-0.016577931120991707,
-0.0020650881342589855,
-0.004142605699598789,
-0.004877360071986914,
-0.0035699759609997272,
-0.004844832234084606,
0.001370197394862771,
0.007863870821893215,
0.00015543695189990103,
0.005662818904966116,
0.0011768534313887358,
-0.0044290442019701,
0.01541453693062067,
-0.0051916493102908134,
-0.005310949869453907,
0.004084614105522633,
0.0038911341689527035,
-0.0009764162241481245,
-0.007692888844758272,
-0.0036849575117230415,
0.0032756212167441845,
0.003683955641463399,
-0.001201694249175489,
-0.008134441450238228,
-0.0010937664192169905,
0.0009694459149613976,
-0.010337338782846928,
0.0013811495155096054,
0.010558855719864368,
-0.0024194754660129547,
0.00431328359991312,
-0.00042210027459077537,
-0.010092675685882568,
-0.016560958698391914,
0.05309790000319481,
-0.0032089902088046074,
0.005864374339580536,
0.0048947399482131,
-0.008263668976724148,
-0.002900295192375779,
-0.0032101513352245092,
0.007359493989497423,
-0.005898569710552692,
-0.007200304884463549,
0.007961842231452465,
-0.001567237894050777,
0.002776575507596135,
0.002526057418435812,
-0.001472540432587266,
0.01607595756649971,
-0.007951950654387474,
-0.01348366029560566,
-0.0198493804782629,
0.007254383526742458,
-0.004148585721850395,
-0.009549207985401154,
0.007573951035737991,
-0.004290946293622255,
-0.004105644766241312,
0.002778281457722187,
0.0059682452119886875,
0.0008062291890382767,
-0.0002621239109430462,
-0.00007364770135609433,
-0.0027280242647975683,
0.0005829360452480614,
0.003615110879763961,
0.005872854497283697,
0.00741524389013648,
-0.0009185223607346416,
0.003974150866270065,
-0.001749083399772644,
-0.0007101155933924019,
-0.0013262316351756454,
0.004205822944641113,
0.006493093445897102,
-0.001710127922706306,
-0.0025892669800668955,
0.003469976596534252,
0.0044639017432928085,
0.0008259318419732153,
0.010852423496544361,
0.0010340285953134298,
-0.007554815150797367,
0.01005871593952179,
0.007271208800375462,
-0.00026516817160882056,
0.007827001623809338,
-0.0028769071213901043,
0.005613838322460651,
0.0018397424137219787,
-0.008275088854134083,
-0.017101066187024117,
-0.0028376122936606407,
0.006052657496184111,
0.009408308193087578,
0.00018786799046210945,
0.001727194874547422,
-0.0017463447293266654,
-0.0033643050119280815,
-0.00959472544491291,
-0.0063808374106884,
-0.0023770062252879143,
-0.000923390791285783,
0.0008359234780073166,
0.0708860456943512,
-0.00929465051740408,
-0.002862881636247039,
-0.010207734070718288,
-0.001108216354623437,
0.0005827309214510024,
-0.0019018632592633367,
0.003675073618069291,
-0.0019488958641886711,
0.0020366546232253313,
0.0028393834363669157,
-0.00744268111884594,
-0.011789007112383842,
-0.00006182867218740284,
0.0034896479919552803,
-0.0024273833259940147,
0.002232152968645096,
0.006646263878792524,
-0.01250188983976841,
0.0028312490321695805,
-0.010655787773430347,
-0.0038044133689254522,
-0.0016272244974970818,
-0.009020745754241943,
-0.003162740496918559,
-0.002226618118584156,
0.0029368922114372253,
0.004110763315111399,
0.004296049941331148,
-0.0032699431758373976,
0.005029889289289713,
-0.0031951572746038437,
0.0019714878872036934,
-0.0042500123381614685,
-0.003491242416203022,
-0.004515658598393202,
0.007412135601043701,
0.0007490277639590204,
-0.01005666796118021,
-0.005609888583421707,
-0.0021148566156625748,
0.00007047513645375147,
-0.005854664370417595,
0.003664580173790455,
-0.0018813530914485455,
0.005262327380478382,
-0.0031447734218090773,
0.0009367632446810603,
-0.004548078402876854,
0.0023117433302104473,
-0.015354175120592117,
0.005228819325566292,
-0.1803315132856369,
0.01050490327179432,
0.004170158877968788,
-0.005079387221485376,
-0.005420045927166939,
-0.014350134879350662,
-0.006842931266874075,
0.0050982022657990456,
0.010100685060024261,
0.0006313039339147508,
-0.0014233372639864683,
-0.0008579168352298439,
0.003878479590639472,
0.003871132154017687,
-0.0025276881642639637,
-0.005228692665696144,
0.004704722668975592,
-0.005119906272739172,
-0.0002613781252875924,
0.003912365064024925,
0.005441747605800629,
0.012293048202991486,
0.0019680988043546677,
0.002709681401029229,
-0.0019458872266113758,
-0.005246803630143404,
0.007567144930362701,
-0.0037062906194478273,
0.004430420696735382,
-0.01096250768750906,
-0.004311580676585436,
-0.005861759185791016,
-0.005592986475676298,
0.003016088157892227,
0.0063548763282597065,
-0.002872318960726261,
0.007821072824299335,
0.003935636952519417,
-0.00732419965788722,
0.011127142235636711,
-0.008799736388027668,
0.0287752915173769,
0.004077957011759281,
0.005770835559815168,
0.00006775800284231082,
-0.00782817229628563,
-0.003306400729343295,
0.008410581387579441,
0.001521404949016869,
0.013699973002076149,
-0.013297976925969124,
-0.003820326179265976,
0.002484077587723732,
0.020548222586512566,
-0.004100310616195202,
-0.010011361911892891,
-0.006175026763230562,
-0.00516209052875638,
0.003802589839324355,
0.009598007425665855,
0.010042439214885235,
-0.0020784621592611074,
0.008201864548027515,
-0.003942718729376793,
-0.023127323016524315,
0.004456464201211929,
-0.002857301151379943,
-0.006268966011703014,
0.0006940466701053083,
0.002579545369371772,
0.008217744529247284,
-0.0012947198702022433,
0.004630364011973143,
0.001100752386264503,
0.0038600547704845667,
-0.000489126774482429,
0.006999405566602945,
-0.0035818421747535467,
0.0077485074289143085,
-0.008659112267196178,
0.009772861376404762,
-0.009932099841535091,
-0.001356918946839869,
0.0023998322430998087,
-0.002810644917190075,
0.010186104103922844,
0.005224773660302162,
-0.002576127415522933,
0.0013525777030736208,
-0.01150937657803297,
-0.002827256917953491,
0.002193835796788335,
0.0029536050278693438,
-0.0068390038795769215,
0.003109656972810626,
-0.0001572366018081084,
0.005270090885460377,
0.006794940680265427,
-0.008091578260064125,
0.0057296352460980415,
0.004220052622258663,
-0.00542276119813323,
0.0026734150014817715,
-0.005161133594810963,
0.0029088747687637806,
0.0044265869073569775,
-0.005896355025470257,
-0.007455169688910246,
0.0038680355064570904,
-0.0066552055068314075,
-0.004528735764324665,
0.004694647621363401,
-0.008510395884513855,
-0.00879590306431055,
0.00012101653555873781,
-0.010018549859523773,
0.002631379757076502
] |
8a7c5a43d05f7336921551d124cf954c34bc06e5 | 46,013 | py | Python | tests/restapi/test_routes.py | aiace9/aiida-core | 09ac91654648adb684a58d5d2d7b1c11a503dae8 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | tests/restapi/test_routes.py | aiace9/aiida-core | 09ac91654648adb684a58d5d2d7b1c11a503dae8 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | tests/restapi/test_routes.py | aiace9/aiida-core | 09ac91654648adb684a58d5d2d7b1c11a503dae8 | [
"MIT",
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
# pylint: disable=too-many-lines
"""Unittests for REST API."""
import tempfile
from flask_cors.core import ACL_ORIGIN
from aiida import orm
from aiida.backends.testbase import AiidaTestCase
from aiida.common import json
from aiida.common.links import LinkType
from aiida.restapi.run_api import configure_api
class RESTApiTestCase(AiidaTestCase):
"""
Setup of the tests for the AiiDA RESTful-api
"""
_url_prefix = '/api/v4'
_dummy_data = {}
_PERPAGE_DEFAULT = 20
_LIMIT_DEFAULT = 400
@classmethod
def setUpClass(cls, *args, **kwargs): # pylint: disable=too-many-locals, too-many-statements
"""
Add objects to the database for different requests/filters/orderings etc.
"""
super().setUpClass()
api = configure_api(catch_internal_server=True)
cls.app = api.app
cls.app.config['TESTING'] = True
# create test inputs
cell = ((2., 0., 0.), (0., 2., 0.), (0., 0., 2.))
structure = orm.StructureData(cell=cell)
structure.append_atom(position=(0., 0., 0.), symbols=['Ba'])
structure.store()
structure.add_comment('This is test comment.')
structure.add_comment('Add another comment.')
cif = orm.CifData(ase=structure.get_ase())
cif.store()
parameter1 = orm.Dict(dict={'a': 1, 'b': 2})
parameter1.store()
parameter2 = orm.Dict(dict={'c': 3, 'd': 4})
parameter2.store()
kpoint = orm.KpointsData()
kpoint.set_kpoints_mesh([4, 4, 4])
kpoint.store()
resources = {'num_machines': 1, 'num_mpiprocs_per_machine': 1}
calcfunc = orm.CalcFunctionNode(computer=cls.computer)
calcfunc.store()
calc = orm.CalcJobNode(computer=cls.computer)
calc.set_option('resources', resources)
calc.set_attribute('attr1', 'OK')
calc.set_attribute('attr2', 'OK')
calc.set_extra('extra1', False)
calc.set_extra('extra2', 'extra_info')
calc.add_incoming(structure, link_type=LinkType.INPUT_CALC, link_label='link_structure')
calc.add_incoming(parameter1, link_type=LinkType.INPUT_CALC, link_label='link_parameter')
aiida_in = 'The input file\nof the CalcJob node'
# Add the calcjob_inputs folder with the aiida.in file to the CalcJobNode repository
with tempfile.NamedTemporaryFile(mode='w+') as handle:
handle.write(aiida_in)
handle.flush()
handle.seek(0)
calc.put_object_from_filelike(handle, 'calcjob_inputs/aiida.in', force=True)
calc.store()
# create log message for calcjob
import logging
from aiida.common.log import LOG_LEVEL_REPORT
from aiida.common.timezone import now
from aiida.orm import Log
log_record = {
'time': now(),
'loggername': 'loggername',
'levelname': logging.getLevelName(LOG_LEVEL_REPORT),
'dbnode_id': calc.id,
'message': 'This is a template record message',
'metadata': {
'content': 'test'
},
}
Log(**log_record)
aiida_out = 'The output file\nof the CalcJob node'
retrieved_outputs = orm.FolderData()
# Add the calcjob_outputs folder with the aiida.out file to the FolderData node
with tempfile.NamedTemporaryFile(mode='w+') as handle:
handle.write(aiida_out)
handle.flush()
handle.seek(0)
retrieved_outputs.put_object_from_filelike(handle, 'calcjob_outputs/aiida.out', force=True)
retrieved_outputs.store()
retrieved_outputs.add_incoming(calc, link_type=LinkType.CREATE, link_label='retrieved')
kpoint.add_incoming(calc, link_type=LinkType.CREATE, link_label='create')
calc1 = orm.CalcJobNode(computer=cls.computer)
calc1.set_option('resources', resources)
calc1.store()
dummy_computers = [{
'label': 'test1',
'hostname': 'test1.epfl.ch',
'transport_type': 'ssh',
'scheduler_type': 'pbspro',
}, {
'label': 'test2',
'hostname': 'test2.epfl.ch',
'transport_type': 'ssh',
'scheduler_type': 'torque',
}, {
'label': 'test3',
'hostname': 'test3.epfl.ch',
'transport_type': 'local',
'scheduler_type': 'slurm',
}, {
'label': 'test4',
'hostname': 'test4.epfl.ch',
'transport_type': 'ssh',
'scheduler_type': 'slurm',
}]
for dummy_computer in dummy_computers:
computer = orm.Computer(**dummy_computer)
computer.store()
# Prepare typical REST responses
cls.process_dummy_data()
def get_dummy_data(self):
return self._dummy_data
def get_url_prefix(self):
return self._url_prefix
@classmethod
def process_dummy_data(cls):
# pylint: disable=fixme
"""
This functions prepare atomic chunks of typical responses from the
RESTapi and puts them into class attributes
"""
# TODO: Storing the different nodes as lists and accessing them
# by their list index is very fragile and a pain to debug.
# Please change this!
computer_projections = ['id', 'uuid', 'name', 'hostname', 'transport_type', 'scheduler_type']
computers = orm.QueryBuilder().append(orm.Computer, tag='comp', project=computer_projections).order_by({
'comp': [{
'id': {
'order': 'asc'
}
}]
}).dict()
# Cast UUID into a string (e.g. in sqlalchemy it comes as a UUID object)
computers = [_['comp'] for _ in computers]
for comp in computers:
if comp['uuid'] is not None:
comp['uuid'] = str(comp['uuid'])
cls._dummy_data['computers'] = computers
calculation_projections = ['id', 'uuid', 'user_id', 'node_type']
calculations = orm.QueryBuilder().append(orm.CalculationNode, tag='calc',
project=calculation_projections).order_by({
'calc': [{
'id': {
'order': 'desc'
}
}]
}).dict()
calculations = [_['calc'] for _ in calculations]
for calc in calculations:
if calc['uuid'] is not None:
calc['uuid'] = str(calc['uuid'])
cls._dummy_data['calculations'] = calculations
data_projections = ['id', 'uuid', 'user_id', 'node_type']
data_types = {
'cifdata': orm.CifData,
'parameterdata': orm.Dict,
'structuredata': orm.StructureData,
'data': orm.Data,
}
for label, dataclass in data_types.items():
data = orm.QueryBuilder().append(dataclass, tag='data', project=data_projections).order_by({
'data': [{
'id': {
'order': 'desc'
}
}]
}).dict()
data = [_['data'] for _ in data]
for datum in data:
if datum['uuid'] is not None:
datum['uuid'] = str(datum['uuid'])
cls._dummy_data[label] = data
def split_path(self, url):
# pylint: disable=no-self-use
"""
Split the url with "?" to get url path and it's parameters
:param url: Web url
:return: url path and url parameters
"""
parts = url.split('?')
path = ''
query_string = ''
if parts:
path = parts[0]
if len(parts) > 1:
query_string = parts[1]
return path, query_string
def compare_extra_response_data(self, node_type, url, response, uuid=None):
"""
In url response, we pass some extra information/data along with the node
results. e.g. url method, node_type, path, pk, query_string, url,
url_root,
etc.
:param node_type: url requested fot the type of the node
:param url: web url
:param response: url response
:param uuid: url requested for the node pk
"""
path, query_string = self.split_path(url)
self.assertEqual(response['method'], 'GET')
self.assertEqual(response['resource_type'], node_type)
self.assertEqual(response['path'], path)
self.assertEqual(response['id'], uuid)
self.assertEqual(response['query_string'], query_string)
self.assertEqual(response['url'], f'http://localhost{url}')
self.assertEqual(response['url_root'], 'http://localhost/')
# node details and list with limit, offset, page, perpage
def process_test(
self,
entity_type,
url,
full_list=False,
empty_list=False,
expected_list_ids=None,
expected_range=None,
expected_errormsg=None,
uuid=None,
result_node_type=None,
result_name=None
):
# pylint: disable=too-many-arguments
"""
Check whether response matches expected values.
:param entity_type: url requested for the type of the node
:param url: web url
:param full_list: if url is requested to get full list
:param empty_list: if the response list is empty
:param expected_list_ids: list of expected ids from data
:param expected_range: [start, stop] range of expected ids from data
:param expected_errormsg: expected error message in response
:param uuid: url requested for the node pk
:param result_node_type: node type in response data
:param result_name: result name in response e.g. incoming, outgoing
"""
if expected_list_ids is None:
expected_list_ids = []
if expected_range is None:
expected_range = []
if result_node_type is None and result_name is None:
result_node_type = entity_type
result_name = entity_type
url = self._url_prefix + url
with self.app.test_client() as client:
rv_response = client.get(url)
response = json.loads(rv_response.data)
if expected_errormsg:
self.assertEqual(response['message'], expected_errormsg)
else:
if full_list:
expected_data = self._dummy_data[result_node_type]
elif empty_list:
expected_data = []
elif expected_list_ids:
expected_data = [self._dummy_data[result_node_type][i] for i in expected_list_ids]
elif expected_range != []:
expected_data = self._dummy_data[result_node_type][expected_range[0]:expected_range[1]]
else:
from aiida.common.exceptions import InputValidationError
raise InputValidationError('Pass the expected range of the dummydata')
expected_node_uuids = [node['uuid'] for node in expected_data]
result_node_uuids = [node['uuid'] for node in response['data'][result_name]]
self.assertEqual(expected_node_uuids, result_node_uuids)
self.compare_extra_response_data(entity_type, url, response, uuid)
class RESTApiTestSuite(RESTApiTestCase):
# pylint: disable=too-many-public-methods
"""
Define unittests for rest api
"""
############### generic endpoints ########################
def test_server(self):
"""
Test that /server endpoint returns AiiDA version
"""
url = f'{self.get_url_prefix()}/server'
from aiida import __version__
with self.app.test_client() as client:
response = client.get(url)
data = json.loads(response.data)['data']
self.assertEqual(__version__, data['AiiDA_version'])
self.assertEqual(self.get_url_prefix(), data['API_prefix'])
def test_base_url(self):
"""
Test that / returns list of endpoints
"""
with self.app.test_client() as client:
data_base = json.loads(client.get(self.get_url_prefix() + '/').data)['data']
data_server = json.loads(client.get(self.get_url_prefix() + '/server/endpoints').data)['data']
self.assertTrue(len(data_base['available_endpoints']) > 0)
self.assertDictEqual(data_base, data_server)
def test_cors_headers(self):
"""
Test that REST API sets cross-origin resource sharing headers
"""
url = f'{self.get_url_prefix()}/server'
with self.app.test_client() as client:
response = client.get(url)
headers = response.headers
self.assertEqual(headers.get(ACL_ORIGIN), '*')
############### computers endpoint ########################
def test_computers_details(self):
"""
Requests the details of single computer
"""
node_uuid = self.get_dummy_data()['computers'][1]['uuid']
RESTApiTestCase.process_test(
self, 'computers', f'/computers/{str(node_uuid)}', expected_list_ids=[1], uuid=node_uuid
)
def test_computers_list(self):
"""
Get the full list of computers from database
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?orderby=+id', full_list=True)
def test_computers_list_limit_offset(self):
"""
Get the list of computers from database using limit
and offset parameter.
It should return the no of rows specified in limit from
database starting from the no. specified in offset
"""
RESTApiTestCase.process_test(
self, 'computers', '/computers?limit=2&offset=2&orderby=+id', expected_range=[2, 4]
)
def test_computers_list_limit_only(self):
"""
Get the list of computers from database using limit
parameter.
It should return the no of rows specified in limit from
database.
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?limit=2&orderby=+id', expected_range=[None, 2])
def test_computers_list_offset_only(self):
"""
Get the list of computers from database using offset
parameter
It should return all the rows from database starting from
the no. specified in offset
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?offset=2&orderby=+id', expected_range=[2, None])
def test_computers_list_limit_offset_perpage(self):
"""
If we pass the limit, offset and perpage at same time, it
would return the error message.
"""
expected_error = 'perpage key is incompatible with limit and offset'
RESTApiTestCase.process_test(
self, 'computers', '/computers?offset=2&limit=1&perpage=2&orderby=+id', expected_errormsg=expected_error
)
def test_computers_list_page_limit_offset(self):
"""
If we use the page, limit and offset at same time, it
would return the error message.
"""
expected_error = 'requesting a specific page is incompatible with ' \
'limit and offset'
RESTApiTestCase.process_test(
self, 'computers', '/computers/page/2?offset=2&limit=1&orderby=+id', expected_errormsg=expected_error
)
def test_complist_pagelimitoffset_perpage(self):
"""
If we use the page, limit, offset and perpage at same time, it
would return the error message.
"""
expected_error = 'perpage key is incompatible with limit and offset'
RESTApiTestCase.process_test(
self,
'computers',
'/computers/page/2?offset=2&limit=1&perpage=2&orderby=+id',
expected_errormsg=expected_error
)
def test_computers_list_page_default(self):
"""
it returns the no. of rows defined as default perpage option
from database.
no.of pages = total no. of computers in database / perpage
"/page" acts as "/page/1?perpage=default_value"
"""
RESTApiTestCase.process_test(self, 'computers', '/computers/page?orderby=+id', full_list=True)
def test_computers_list_page_perpage(self):
"""
no.of pages = total no. of computers in database / perpage
Using this formula it returns the no. of rows for requested page
"""
RESTApiTestCase.process_test(
self, 'computers', '/computers/page/1?perpage=2&orderby=+id', expected_range=[None, 2]
)
def test_computers_list_page_perpage_exceed(self):
"""
no.of pages = total no. of computers in database / perpage
If we request the page which exceeds the total no. of pages then
it would return the error message.
"""
expected_error = 'Non existent page requested. The page range is [1 : ' \
'3]'
RESTApiTestCase.process_test(
self, 'computers', '/computers/page/4?perpage=2&orderby=+id', expected_errormsg=expected_error
)
############### list filters ########################
def test_computers_filter_id1(self):
"""
Add filter on the id of computer and get the filtered computer
list (e.g. id=1)
"""
node_pk = self.get_dummy_data()['computers'][1]['id']
RESTApiTestCase.process_test(self, 'computers', f'/computers?id={str(node_pk)}', expected_list_ids=[1])
def test_computers_filter_id2(self):
"""
Add filter on the id of computer and get the filtered computer
list (e.g. id > 2)
"""
node_pk = self.get_dummy_data()['computers'][1]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers?id>{str(node_pk)}&orderby=+id', expected_range=[2, None]
)
def test_computers_filter_pk(self):
"""
Add filter on the id of computer and get the filtered computer
list (e.g. id=1)
"""
node_pk = self.get_dummy_data()['computers'][1]['id']
RESTApiTestCase.process_test(self, 'computers', f'/computers?pk={str(node_pk)}', expected_list_ids=[1])
def test_computers_filter_name(self):
"""
Add filter for the name of computer and get the filtered computer
list
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?name="test1"', expected_list_ids=[1])
def test_computers_filter_hostname(self):
"""
Add filter for the hostname of computer and get the filtered computer
list
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?hostname="test1.epfl.ch"', expected_list_ids=[1])
def test_computers_filter_transport_type(self):
"""
Add filter for the transport_type of computer and get the filtered
computer
list
"""
RESTApiTestCase.process_test(
self, 'computers', '/computers?transport_type="local"&name="test3"&orderby=+id', expected_list_ids=[3]
)
############### list orderby ########################
def test_computers_orderby_id_asc(self):
"""
Returns the computers list ordered by "id" in ascending
order
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?orderby=id', full_list=True)
def test_computers_orderby_id_asc_sign(self):
"""
Returns the computers list ordered by "+id" in ascending
order
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?orderby=+id', full_list=True)
def test_computers_orderby_id_desc(self):
"""
Returns the computers list ordered by "id" in descending
order
"""
RESTApiTestCase.process_test(self, 'computers', '/computers?orderby=-id', expected_list_ids=[4, 3, 2, 1, 0])
def test_computers_orderby_name_asc(self):
"""
Returns the computers list ordered by "name" in ascending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers?pk>{str(node_pk)}&orderby=name', expected_list_ids=[1, 2, 3, 4]
)
def test_computers_orderby_name_asc_sign(self):
"""
Returns the computers list ordered by "+name" in ascending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers?pk>{str(node_pk)}&orderby=+name', expected_list_ids=[1, 2, 3, 4]
)
def test_computers_orderby_name_desc(self):
"""
Returns the computers list ordered by "name" in descending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers?pk>{str(node_pk)}&orderby=-name', expected_list_ids=[4, 3, 2, 1]
)
def test_computers_orderby_scheduler_type_asc(self):
"""
Returns the computers list ordered by "scheduler_type" in ascending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f"/computers?transport_type=\"ssh\"&pk>{str(node_pk)}&orderby=scheduler_type",
expected_list_ids=[1, 4, 2]
)
def test_comp_orderby_scheduler_ascsign(self):
"""
Returns the computers list ordered by "+scheduler_type" in ascending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f"/computers?transport_type=\"ssh\"&pk>{str(node_pk)}&orderby=+scheduler_type",
expected_list_ids=[1, 4, 2]
)
def test_computers_orderby_schedulertype_desc(self):
"""
Returns the computers list ordered by "scheduler_type" in descending
order
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f"/computers?pk>{str(node_pk)}&transport_type=\"ssh\"&orderby=-scheduler_type",
expected_list_ids=[2, 4, 1]
)
############### list orderby combinations #######################
def test_computers_orderby_mixed1(self):
"""
Returns the computers list first order by "transport_type" in
ascending order and if it is having same transport_type, order it
by "id"
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f'/computers?pk>{str(node_pk)}&orderby=transport_type,id',
expected_list_ids=[3, 1, 2, 4]
)
def test_computers_orderby_mixed2(self):
"""
Returns the computers list first order by "scheduler_type" in
descending order and if it is having same scheduler_type, order it
by "name"
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f'/computers?pk>{str(node_pk)}&orderby=-scheduler_type,name',
expected_list_ids=[2, 3, 4, 1]
)
def test_computers_orderby_mixed3(self):
"""
Returns the computers list first order by "scheduler_type" in
ascending order and if it is having same scheduler_type, order it
by "hostname" descending order
Response::
test4 slurm
test3 slurm
test2 torque
test1 pbspro
localhost pbspro
==========
Expected::
test1 pbspro
localhost pbspro
test4 slurm
test3 slurm
test2 torque
test1 test4
RESTApiTestCase.process_test(self, "computers",
"/computers?orderby=+scheduler_type,
-hostname",
expected_list_ids=[1,0,4,3,2])
"""
############### list filter combinations #######################
def test_computers_filter_mixed1(self):
"""
Add filter for the hostname and id of computer and get the
filtered computer list
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f"/computers?id>{str(node_pk)}&hostname=\"test1.epfl.ch\"", expected_list_ids=[1]
)
def test_computers_filter_mixed2(self):
"""
Add filter for the id, hostname and transport_type of the computer
and get the filtered computer list
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f"/computers?id>{str(node_pk)}&hostname=\"test3.epfl.ch\"&transport_type=\"ssh\"",
empty_list=True
)
############### list all parameter combinations #######################
def test_computers_mixed1(self):
"""
url parameters: id, limit and offset
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers?id>{str(node_pk)}&limit=2&offset=3&orderby=+id', expected_list_ids=[4]
)
def test_computers_mixed2(self):
"""
url parameters: id, page, perpage
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self, 'computers', f'/computers/page/2?id>{str(node_pk)}&perpage=2&orderby=+id', expected_list_ids=[3, 4]
)
def test_computers_mixed3(self):
"""
url parameters: id, transport_type, orderby
"""
node_pk = self.get_dummy_data()['computers'][0]['id']
RESTApiTestCase.process_test(
self,
'computers',
f"/computers?id>={str(node_pk)}&transport_type=\"ssh\"&orderby=-id&limit=2",
expected_list_ids=[4, 2]
)
########## pass unknown url parameter ###########
def test_computers_unknown_param(self):
"""
url parameters: id, limit and offset
from aiida.common.exceptions import InputValidationError
RESTApiTestCase.node_exception(self, "/computers?aa=bb&id=2", InputValidationError)
"""
############### calculation retrieved_inputs and retrieved_outputs #############
def test_calculation_retrieved_inputs(self):
"""
Get the list of given calculation retrieved_inputs
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/calcjobs/{str(node_uuid)}/input_files'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(response['data'], [{'name': 'calcjob_inputs', 'type': 'DIRECTORY'}])
def test_calculation_retrieved_outputs(self):
"""
Get the list of given calculation retrieved_outputs
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/calcjobs/{str(node_uuid)}/output_files'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(response['data'], [{'name': 'calcjob_outputs', 'type': 'DIRECTORY'}])
############### calculation incoming #############
def test_calculation_inputs(self):
"""
Get the list of give calculation incoming
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
self.process_test(
'nodes',
f'/nodes/{str(node_uuid)}/links/incoming?orderby=id',
expected_list_ids=[5, 3],
uuid=node_uuid,
result_node_type='data',
result_name='incoming'
)
def test_calculation_input_filters(self):
"""
Get filtered incoming list for given calculations
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
self.process_test(
'nodes',
f"/nodes/{str(node_uuid)}/links/incoming?node_type=\"data.dict.Dict.\"",
expected_list_ids=[3],
uuid=node_uuid,
result_node_type='data',
result_name='incoming'
)
def test_calculation_iotree(self):
"""
Get filtered incoming list for given calculations
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}/links/tree?in_limit=1&out_limit=1'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(len(response['data']['nodes']), 1)
self.assertEqual(len(response['data']['nodes'][0]['incoming']), 1)
self.assertEqual(len(response['data']['nodes'][0]['outgoing']), 1)
self.assertEqual(len(response['data']['metadata']), 1)
expected_attr = [
'ctime', 'mtime', 'id', 'node_label', 'node_type', 'uuid', 'description', 'incoming', 'outgoing'
]
received_attr = response['data']['nodes'][0].keys()
for attr in expected_attr:
self.assertIn(attr, received_attr)
RESTApiTestCase.compare_extra_response_data(self, 'nodes', url, response, uuid=node_uuid)
############### calculation attributes #############
def test_calculation_attributes(self):
"""
Get list of calculation attributes
"""
attributes = {
'attr1': 'OK',
'attr2': 'OK',
'resources': {
'num_machines': 1,
'num_mpiprocs_per_machine': 1
},
}
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}/contents/attributes'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
self.assertNotIn('message', response)
self.assertEqual(response['data']['attributes'], attributes)
RESTApiTestCase.compare_extra_response_data(self, 'nodes', url, response, uuid=node_uuid)
def test_contents_attributes_filter(self):
"""
Get list of calculation attributes with filter attributes_filter
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f"{self.get_url_prefix()}/nodes/{str(node_uuid)}/contents/attributes?attributes_filter=\"attr1\""
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
self.assertNotIn('message', response)
self.assertEqual(response['data']['attributes'], {'attr1': 'OK'})
RESTApiTestCase.compare_extra_response_data(self, 'nodes', url, response, uuid=node_uuid)
############### calculation node attributes filter #############
def test_calculation_attributes_filter(self):
"""
Get the list of given calculation attributes filtered
"""
attributes = {
'attr1': 'OK',
'attr2': 'OK',
'resources': {
'num_machines': 1,
'num_mpiprocs_per_machine': 1
},
}
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}?attributes=true'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(response['data']['nodes'][0]['attributes'], attributes)
############### calculation node extras_filter #############
def test_calculation_extras_filter(self):
"""
Get the list of given calculation extras filtered
"""
extras = {'extra1': False, 'extra2': 'extra_info'}
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}?extras=true&extras_filter=extra1,extra2'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(response['data']['nodes'][0]['extras']['extra1'], extras['extra1'])
self.assertEqual(response['data']['nodes'][0]['extras']['extra2'], extras['extra2'])
############### structure node attributes filter #############
def test_structure_attributes_filter(self):
"""
Get the list of given calculation attributes filtered
"""
cell = [[2., 0., 0.], [0., 2., 0.], [0., 0., 2.]]
node_uuid = self.get_dummy_data()['structuredata'][0]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}?attributes=true&attributes_filter=cell'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
self.assertEqual(response['data']['nodes'][0]['attributes']['cell'], cell)
############### node attributes_filter with pagination #############
def test_node_attributes_filter_pagination(self):
"""
Check that node attributes specified in attributes_filter are
returned as a dictionary when pagination is set
"""
expected_attributes = ['resources', 'cell']
url = f'{self.get_url_prefix()}/nodes/page/1?perpage=10&attributes=true&attributes_filter=resources,cell'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertNotEqual(len(response['data']['nodes']), 0)
for node in response['data']['nodes']:
self.assertIn('attributes', node)
self.assertNotIn('attributes.resources', node)
self.assertNotIn('attributes.cell', node)
self.assertEqual(len(node['attributes']), len(expected_attributes))
for attr in expected_attributes:
self.assertIn(attr, node['attributes'])
############### node get one attributes_filter with pagination #############
def test_node_single_attributes_filter(self):
"""
Check that when only one node attribute is specified in attributes_filter
only this attribute is returned as a dictionary when pagination is set
"""
expected_attribute = ['resources']
url = f'{self.get_url_prefix()}/nodes/page/1?perpage=10&attributes=true&attributes_filter=resources'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertNotEqual(len(response['data']['nodes']), 0)
for node in response['data']['nodes']:
self.assertEqual(list(node['attributes'].keys()), expected_attribute)
############### node extras_filter with pagination #############
def test_node_extras_filter_pagination(self):
"""
Check that node extras specified in extras_filter are
returned as a dictionary when pagination is set
"""
expected_extras = ['extra1', 'extra2']
url = f'{self.get_url_prefix()}/nodes/page/1?perpage=10&extras=true&extras_filter=extra1,extra2'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertNotEqual(len(response['data']['nodes']), 0)
for node in response['data']['nodes']:
self.assertIn('extras', node)
self.assertNotIn('extras.extra1', node)
self.assertNotIn('extras.extra2', node)
self.assertEqual(len(node['extras']), len(expected_extras))
for extra in expected_extras:
self.assertIn(extra, node['extras'])
############### node get one extras_filter with pagination #############
def test_node_single_extras_filter(self):
"""
Check that when only one node extra is specified in extras_filter
only this extra is returned as a dictionary when pagination is set
"""
expected_extra = ['extra2']
url = f'{self.get_url_prefix()}/nodes/page/1?perpage=10&extras=true&extras_filter=extra2'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertNotEqual(len(response['data']['nodes']), 0)
for node in response['data']['nodes']:
self.assertEqual(list(node['extras'].keys()), expected_extra)
############### node full_type filter #############
def test_nodes_full_type_filter(self):
"""
Get the list of nodes filtered by full_type
"""
expected_node_uuids = []
for calc in self.get_dummy_data()['calculations']:
if calc['node_type'] == 'process.calculation.calcjob.CalcJobNode.':
expected_node_uuids.append(calc['uuid'])
url = f"{self.get_url_prefix()}/nodes/?full_type=\"process.calculation.calcjob.CalcJobNode.|\""
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
for node in response['data']['nodes']:
self.assertIn(node['uuid'], expected_node_uuids)
############### Structure visualization and download #############
def test_structure_derived_properties(self):
"""
Get the list of give calculation incoming
"""
node_uuid = self.get_dummy_data()['structuredata'][0]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}/contents/derived_properties'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
self.assertNotIn('message', response)
self.assertEqual(
response['data']['derived_properties']['dimensionality'], {
'dim': 3,
'value': 8.0,
'label': 'volume'
}
)
self.assertEqual(response['data']['derived_properties']['formula'], 'Ba')
RESTApiTestCase.compare_extra_response_data(self, 'nodes', url, response, uuid=node_uuid)
def test_structure_download(self):
"""
Test download of structure file
"""
from aiida.orm import load_node
node_uuid = self.get_dummy_data()['structuredata'][0]['uuid']
url = f'{self.get_url_prefix()}/nodes/{node_uuid}/download?download_format=xsf'
with self.app.test_client() as client:
rv_obj = client.get(url)
structure_data = load_node(node_uuid)._exportcontent('xsf')[0] # pylint: disable=protected-access
self.assertEqual(rv_obj.data, structure_data)
def test_cif(self):
"""
Test download of cif file
"""
from aiida.orm import load_node
node_uuid = self.get_dummy_data()['cifdata'][0]['uuid']
url = f'{self.get_url_prefix()}/nodes/{node_uuid}/download?download_format=cif'
with self.app.test_client() as client:
rv_obj = client.get(url)
cif = load_node(node_uuid)._prepare_cif()[0] # pylint: disable=protected-access
self.assertEqual(rv_obj.data, cif)
############### projectable_properties #############
def test_projectable_properties(self):
"""
test projectable_properties endpoint
"""
for nodetype in ['nodes', 'processes', 'computers', 'users', 'groups']:
url = f'{self.get_url_prefix()}/{nodetype}/projectable_properties'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
self.assertNotIn('message', response)
expected_keys = ['display_name', 'help_text', 'is_display', 'is_foreign_key', 'type']
# check fields
for _, pinfo in response['data']['fields'].items():
available_keys = pinfo.keys()
for prop in expected_keys:
self.assertIn(prop, available_keys)
# check order
available_properties = response['data']['fields'].keys()
for prop in response['data']['ordering']:
self.assertIn(prop, available_properties)
def test_node_namespace(self):
"""
Test the rest api call to get list of available node namespace
"""
url = f'{self.get_url_prefix()}/nodes/full_types'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)
expected_data_keys = ['path', 'namespace', 'subspaces', 'label', 'full_type']
response_keys = response['data'].keys()
for dkay in expected_data_keys:
self.assertIn(dkay, response_keys)
RESTApiTestCase.compare_extra_response_data(self, 'nodes', url, response)
def test_comments(self):
"""
Get the node comments
"""
node_uuid = self.get_dummy_data()['structuredata'][0]['uuid']
url = f'{self.get_url_prefix()}/nodes/{str(node_uuid)}/contents/comments'
with self.app.test_client() as client:
rv_obj = client.get(url)
response = json.loads(rv_obj.data)['data']['comments']
all_comments = []
for comment in response:
all_comments.append(comment['message'])
self.assertEqual(sorted(all_comments), sorted(['This is test comment.', 'Add another comment.']))
def test_repo(self):
"""
Test to get repo list or repo file contents for given node
"""
from aiida.orm import load_node
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f"{self.get_url_prefix()}/nodes/{str(node_uuid)}/repo/list?filename=\"calcjob_inputs\""
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(response['data']['repo_list'], [{'type': 'FILE', 'name': 'aiida.in'}])
url = f"{self.get_url_prefix()}/nodes/{str(node_uuid)}/repo/contents?filename=\"calcjob_inputs/aiida.in\""
with self.app.test_client() as client:
response_obj = client.get(url)
input_file = load_node(node_uuid).get_object_content('calcjob_inputs/aiida.in', mode='rb')
self.assertEqual(response_obj.data, input_file)
def test_process_report(self):
"""
Test process report
"""
node_uuid = self.get_dummy_data()['calculations'][1]['uuid']
url = f'{self.get_url_prefix()}/processes/{str(node_uuid)}/report'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
expected_keys = response['data'].keys()
for key in ['logs']:
self.assertIn(key, expected_keys)
expected_log_keys = response['data']['logs'][0].keys()
for key in ['time', 'loggername', 'levelname', 'dbnode_id', 'message']:
self.assertIn(key, expected_log_keys)
def test_download_formats(self):
"""
test for download format endpoint
"""
url = f'{self.get_url_prefix()}/nodes/download_formats'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
for key in ['data.structure.StructureData.|', 'data.cif.CifData.|']:
self.assertIn(key, response['data'].keys())
for key in ['cif', 'xsf', 'xyz']:
self.assertIn(key, response['data']['data.structure.StructureData.|'])
self.assertIn('cif', response['data']['data.cif.CifData.|'])
| 40.186026 | 117 | 0.583878 | 1 | 2.0166 | [
-0.04958285391330719,
0.05955066531896591,
0.0037870740052312613,
-0.019339000806212425,
-0.0049216230399906635,
0.013626234605908394,
-0.057953547686338425,
-0.021045250818133354,
-0.016595780849456787,
0.04729730635881424,
0.01910817064344883,
0.0021831674966961145,
0.033088818192481995,
-0.047448355704545975,
-0.015715869143605232,
-0.013379831798374653,
0.2766386866569519,
0.009821245446801186,
-0.01004798524081707,
0.003909753635525703,
-0.006141165737062693,
0.0020837318152189255,
-0.016620278358459473,
0.03752957656979561,
0.0034475529100745916,
-0.02909613959491253,
0.03628752380609512,
-0.0008901068940758705,
-0.009682846255600452,
-0.013276361860334873,
0.016739632934331894,
0.007649704348295927,
-0.0217814389616251,
0.005710850935429335,
-0.03254036232829094,
0.009557461366057396,
0.0045330519787967205,
-0.046762533485889435,
-0.00649423198774457,
0.026285020634531975,
0.018950330093503,
-0.01466418243944645,
-0.023339489474892616,
-0.025659171864390373,
0.02648637630045414,
-0.033820487558841705,
-0.03018772229552269,
0.0341741181910038,
-0.0754709541797638,
-0.009041260927915573,
-0.02089923992753029,
0.02666805498301983,
0.016117846593260765,
-0.012721428647637367,
0.008416235446929932,
-0.027850860729813576,
0.007211943157017231,
-0.0106672253459692,
-0.005151517689228058,
-0.020186327397823334,
-0.059693556278944016,
-0.008706998080015182,
0.004893217235803604,
-0.004937299992889166,
-0.052487075328826904,
-0.0222305990755558,
-0.02918234094977379,
-0.03205733373761177,
-0.005348485428839922,
-0.023148387670516968,
-0.030409371480345726,
0.006871341727674007,
0.013230286538600922,
0.032275084406137466,
0.0018458378035575151,
-0.003457693150267005,
-0.03023482859134674,
-0.008953485637903214,
-0.01392810046672821,
0.005147414281964302,
-0.008127540349960327,
0.030972877517342567,
0.0011659293668344617,
0.006192576140165329,
-0.011303015984594822,
0.01697547547519207,
0.06256578117609024,
-0.040614694356918335,
0.055101461708545685,
0.04115256294608116,
-0.019540948793292046,
0.010855106636881828,
-0.0429997593164444,
-0.0024003738071769476,
-0.013068177737295628,
-0.025131134316325188,
-0.0016166884452104568,
-0.012617088854312897,
-0.005837475415319204,
-0.02568242885172367,
-0.008148974739015102,
-0.035364434123039246,
-0.00013942150690127164,
-0.015154081396758556,
-0.008251650258898735,
0.05726083740592003,
-0.03407810255885124,
-0.0019314272794872522,
0.018080780282616615,
0.012814664281904697,
-0.03878941386938095,
-0.024384507909417152,
0.01862322725355625,
-0.049632906913757324,
-0.011507517658174038,
-0.03613246977329254,
0.014569912105798721,
0.032298605889081955,
-0.012033145874738693,
0.048851437866687775,
0.026052376255393028,
0.00033811290632002056,
0.007506475783884525,
0.02325846441090107,
-0.015631284564733505,
0.0427059605717659,
0.029202338308095932,
-0.014585991390049458,
0.016077158972620964,
-0.005165128502994776,
0.0030222893692553043,
0.00802959967404604,
-0.018015451729297638,
0.003086609300225973,
0.02285601757466793,
0.00901375524699688,
-0.008428161963820457,
-0.006051601842045784,
-0.04714174568653107,
-0.005900871474295855,
-0.0018681286601349711,
-0.02290503866970539,
0.005127161741256714,
-0.026996558532118797,
0.006183987949043512,
-0.040380604565143585,
0.0016688037430867553,
-0.002693362534046173,
-0.011875562369823456,
-0.015713315457105637,
0.009594005532562733,
0.027802934870123863,
0.03303186967968941,
-0.004493813496083021,
-0.006979178171604872,
0.013096475042402744,
-0.004252409562468529,
-0.050183895975351334,
0.0466451421380043,
-0.004000106360763311,
-0.02926798351109028,
0.014155028387904167,
0.0062622614204883575,
-0.018565403297543526,
0.038027074187994,
0.017823476344347,
-0.014656810089945793,
-0.018735485151410103,
-0.006021704990416765,
0.02723999321460724,
0.014283736236393452,
-0.007375338580459356,
-0.04088655486702919,
-0.009131280705332756,
-0.025180548429489136,
0.002995733404532075,
0.018585091456770897,
0.010867057368159294,
-0.011710351333022118,
0.007916168309748173,
0.020020276308059692,
0.021780509501695633,
0.016279110684990883,
0.013771731406450272,
-0.013462815433740616,
0.03857247903943062,
-0.08233416825532913,
-0.017319099977612495,
0.015033645555377007,
0.001914994791150093,
0.004690622910857201,
0.032219063490629196,
-0.017493316903710365,
-0.017489533871412277,
0.016270721331238747,
-0.031523898243904114,
0.0037737544625997543,
0.009130677208304405,
0.019455937668681145,
-0.0016759166028350592,
-0.012844745069742203,
0.005279798060655594,
-0.0030166967771947384,
-0.007391325663775206,
-0.002983818529173732,
-0.02717539854347706,
-0.6923968195915222,
0.03221198543906212,
0.004868780262768269,
-0.004501296207308769,
0.03331565856933594,
0.012165023013949394,
-0.006102333310991526,
-0.01906832493841648,
-0.01442998182028532,
-0.0231703519821167,
0.022720888257026672,
-0.018896644935011864,
-0.008948836475610733,
0.020881105214357376,
0.02815655805170536,
-0.015085307881236076,
-0.001991166500374675,
-0.022828305140137672,
-0.05909653380513191,
0.021921584382653236,
-0.01922798715531826,
-0.02001873217523098,
-0.016063498333096504,
0.0066387285478413105,
-0.0013915400486439466,
-0.01620243489742279,
0.004159791860729456,
-0.023730779066681862,
-0.0026983849238604307,
0.02088741771876812,
-0.016558384522795677,
-0.0002665086358319968,
0.008309888653457165,
-0.0009345573489554226,
-0.006742712575942278,
0.027839578688144684,
0.03302067145705223,
-0.02367432974278927,
0.00832223892211914,
-0.023708883672952652,
-0.032389454543590546,
-0.022461729124188423,
-0.009356875903904438,
-0.04229823499917984,
-0.03063519299030304,
0.0027742087841033936,
-0.013784351758658886,
-0.018981631845235825,
0.016114287078380585,
0.015446517616510391,
-0.028077367693185806,
0.033917929977178574,
0.01753125712275505,
-0.008820084854960442,
0.02080303058028221,
0.02370990812778473,
-0.0002845785638783127,
-0.009103909134864807,
-0.001810415182262659,
-0.0028902010526508093,
0.010868712328374386,
0.0005639605224132538,
-0.023514248430728912,
-0.00006964787462493405,
0.04249513894319534,
0.004322182387113571,
0.03882395476102829,
-0.022397926077246666,
-0.022225575521588326,
0.048469748347997665,
-0.06936749070882797,
-0.01775207370519638,
-0.04750183969736099,
0.11630907654762268,
-0.02511470951139927,
0.001823135302402079,
-0.005308692809194326,
0.013072975911200047,
-0.015091435983777046,
-0.0008344913367182016,
0.02743852138519287,
-0.01293113548308611,
0.00193558051250875,
-0.007890605367720127,
-0.03933483362197876,
0.008550036698579788,
-0.013718655332922935,
-0.0037719751708209515,
-0.0046441820450127125,
-0.005589720327407122,
0.034451697021722794,
0.03552147001028061,
0.049560967832803726,
0.009271034970879555,
0.01250255573540926,
0.031163491308689117,
0.035702966153621674,
0.017503084614872932,
0.032367803156375885,
0.0031754479277879,
-0.03961244225502014,
-0.0018942414317280054,
-0.008597930893301964,
0.01339183934032917,
-0.0005980599671602249,
0.02347441017627716,
-0.033941615372896194,
0.016217462718486786,
0.04080614075064659,
-0.020589634776115417,
-0.0054227448999881744,
-0.027052931487560272,
-0.024385176599025726,
-0.013846677727997303,
-0.02219972014427185,
-0.020805437117815018,
0.005112467333674431,
-0.06776753067970276,
0.03305680677294731,
-0.021103935316205025,
0.014624734409153461,
-0.0441012941300869,
-0.00623586680740118,
0.03085222654044628,
0.013511570170521736,
-0.0022125281393527985,
-0.01670037768781185,
0.009112423285841942,
0.019549904391169548,
-0.007347669918090105,
-0.004540435038506985,
0.03252792730927467,
-0.0012990882387384772,
0.010142830200493336,
0.005653912201523781,
0.004181808792054653,
-0.02218644879758358,
-0.008800042793154716,
0.013007556088268757,
0.005497790407389402,
-0.013793417252600193,
0.008545543067157269,
0.043861277401447296,
-0.04655987769365311,
0.0019870023243129253,
0.03007321059703827,
0.06142706423997879,
0.016208363696932793,
0.030062654986977577,
0.01082562655210495,
-0.010792974382638931,
0.015194610692560673,
0.002029047580435872,
0.005684074945747852,
-0.015110532753169537,
-0.011043917387723923,
-0.008842474780976772,
0.010111590847373009,
0.03103957511484623,
0.0062841493636369705,
0.006503620184957981,
-0.007371441926807165,
-0.047657787799835205,
0.03392889350652695,
-0.004630540497601032,
-0.001519516808912158,
-0.01160626020282507,
0.067433200776577,
0.00618445361033082,
0.008766829036176205,
0.03353205323219299,
-0.004461607895791531,
0.026791995391249657,
0.0013610029127448797,
-0.012836755253374577,
0.040690820664167404,
-0.019841816276311874,
-0.02757863514125347,
0.015988174825906754,
-0.021672464907169342,
-0.025273514911532402,
0.014871075749397278,
0.018523985520005226,
-0.019978325814008713,
0.005012384615838528,
0.012235620990395546,
-0.010585587471723557,
-0.0067823659628629684,
-0.001600906951352954,
-0.032832738012075424,
-0.006995555479079485,
-0.016348110511898994,
-0.03323955088853836,
0.006696466822177172,
-0.004551783669739962,
-0.014987941831350327,
-0.013158795423805714,
-0.0077847670763731,
0.027617240324616432,
0.008880989626049995,
0.0006080676103010774,
0.029390310868620872,
0.0005912789492867887,
-0.017043443396687508,
0.0019268569303676486,
0.01684843935072422,
-0.00807613879442215,
-0.007497421931475401,
0.013097248040139675,
-0.007264106068760157,
0.008177508600056171,
-0.0263752993196249,
0.0144425630569458,
-0.034234222024679184,
-0.013289274647831917,
0.0035631530918180943,
-0.030077360570430756,
-0.019806796684861183,
-0.000588637194596231,
0.0018488257192075253,
-0.02012700028717518,
-0.027191605418920517,
0.017123406752943993,
0.011249901726841927,
-0.0177268385887146,
-0.012239276431500912,
-0.028862062841653824,
0.01470488216727972,
-0.007589526940137148,
-0.02054627053439617,
0.04071689769625664,
-0.012124533765017986,
-0.002216612920165062,
-0.00794928427785635,
0.020061494782567024,
0.007272596471011639,
-0.008710588328540325,
-0.02205912210047245,
0.02192380651831627,
-0.02643299102783203,
0.01574382372200489,
-0.003531802212819457,
0.0231598112732172,
0.04534003138542175,
0.014851512387394905,
0.0017810269491747022,
0.003772411961108446,
-0.02348318323493004,
-0.013225255534052849,
-0.01251092180609703,
-0.026823880150914192,
0.046556033194065094,
0.009283795021474361,
0.009750726632773876,
0.007478676736354828,
-0.008386286906898022,
-0.019521156325936317,
-0.021396927535533905,
0.029355138540267944,
0.05007099360227585,
-0.016170399263501167,
-0.01774783991277218,
0.03199315816164017,
0.015055266208946705,
-0.035427458584308624,
0.01118189375847578,
-0.013338269665837288,
-0.00119048822671175,
0.009541405364871025,
0.015842251479625702,
0.021759355440735817,
-0.027911173179745674,
0.0021986565552651882,
-0.001669807592406869,
-0.016172584146261215,
0.023004265502095222,
-0.018833760172128677,
-0.0013827270595356822,
-0.012262753210961819,
0.05205675959587097,
-0.016412071883678436,
-0.009650887921452522,
0.03543008863925934,
0.014813818037509918,
-0.012413915246725082,
0.02147074230015278,
0.009708045050501823,
-0.0028846673667430878,
-0.072644904255867,
0.014795147813856602,
-0.0023550880141556263,
-0.005914400331676006,
0.02308773249387741,
0.0031831921078264713,
0.017711510881781578,
-0.003957889508455992,
-0.0072971549816429615,
0.030699875205755234,
0.016069626435637474,
0.008769377134740353,
0.04124954715371132,
-0.03978951275348663,
-0.026536742225289345,
-0.0067574745044112206,
0.02323579229414463,
0.0015263492241501808,
0.04604526236653328,
0.010593065991997719,
0.03152802214026451,
0.001625926815904677,
0.0019352581584826112,
0.010008353739976883,
0.0032712197862565517,
0.020196927711367607,
0.02157714031636715,
0.000946171407122165,
0.0436948724091053,
0.023567739874124527,
0.011097087524831295,
0.004676534328609705,
-0.01650458388030529,
-0.011454031802713871,
-0.01276127714663744,
-0.023388143628835678,
-0.013558137230575085,
-0.041837435215711594,
-0.02514341101050377,
-0.04367196187376976,
-0.013616042211651802,
0.04869342967867851,
-0.015809226781129837,
-0.03477659448981285,
-0.0006397979450412095,
0.01199735514819622,
0.0065035130828619,
0.0044383821077644825,
0.021127697080373764,
0.001421215245500207,
-0.006279632914811373,
0.011778422631323338,
-0.0069093783386051655,
0.004619949031621218,
-0.007130494806915522,
-0.01568005606532097,
-0.001487381407059729,
-0.035698793828487396,
-0.03551635891199112,
0.013467144221067429,
0.03600164130330086,
0.03584805876016617,
0.0063809058628976345,
-0.029516149312257767,
-0.02120373584330082,
-0.029600877314805984,
0.009557061828672886,
0.010566312819719315,
0.0034329425543546677,
0.0212289746850729,
0.01632741652429104,
0.03208160027861595,
-0.010092557407915592,
-0.011938922107219696,
-0.034890566021203995,
0.021269867196679115,
0.007661511655896902,
-0.03144129365682602,
0.0347258560359478,
-0.00788003858178854,
-0.024432513862848282,
0.01030155923217535,
0.0164609644562006,
-0.010311814025044441,
-0.008148913271725178,
0.027436723932623863,
0.015553721226751804,
0.03920429199934006,
-0.0016665528528392315,
-0.0020928392186760902,
-0.007439687382429838,
0.01811116188764572,
-0.0049726152792572975,
-0.01895156502723694,
-0.007275732699781656,
-0.029397299513220787,
0.013311479240655899,
-0.014418104663491249,
0.000011112780157418456,
0.015751900151371956,
-0.001898171380162239,
-0.024207066744565964,
0.015268932096660137,
0.01837395504117012,
0.030643858015537262,
0.02598452940583229,
-0.008106204681098461,
-0.013970891945064068,
-0.04135463386774063,
-0.03356730192899704,
-0.023486914113163948,
-0.009367264807224274,
0.007915783673524857,
-0.007058975752443075,
-0.0033077956177294254,
0.0033906602766364813,
0.015881018713116646,
-0.012597141787409782,
0.020284319296479225,
0.011886052787303925,
-0.005554192699491978,
0.014694027602672577,
0.025176040828227997,
0.0206052977591753,
0.009798796847462654,
-0.06063530221581459,
-0.0025129630230367184,
0.010036461986601353,
-0.02652217075228691,
0.004438936244696379,
0.01832963526248932,
0.020978987216949463,
-0.053648918867111206,
0.023839766159653664,
0.003376538632437587,
0.003338385606184602,
-0.03390255942940712,
-0.04444360360503197,
0.005175972357392311,
-0.012246821075677872,
0.00014307246601674706,
0.02641577273607254,
-0.0046875993721187115,
0.002106373431161046,
0.004193659871816635,
0.011900545097887516,
-0.008491466753184795,
0.003918913658708334,
-0.015310877002775669,
-0.00938351172953844,
-0.017793672159314156,
0.015854017809033394,
-0.0023005118127912283,
0.012078175321221352,
0.01499123964458704,
-0.013403472490608692,
0.005839020479470491,
-0.05886073037981987,
0.0032429432030767202,
-0.005389787722378969,
-0.006430346053093672,
0.02460302598774433,
-0.0008087244932539761,
0.03188834339380264,
0.032896511256694794,
0.02905390039086342,
0.00837700255215168,
0.022431302815675735,
-0.019525300711393356,
0.0030621213372796774,
0.04509378597140312,
-0.020443180575966835,
0.013511275872588158,
0.01674976758658886,
-0.0008423895924352109,
0.02451535128057003,
0.007485022768378258,
0.03688117489218712,
0.01903882995247841,
-0.03545214235782623,
-0.005189614836126566,
-0.015134605579078197,
0.004311528522521257,
0.008754617534577847,
-0.03426431491971016,
0.006134456023573875,
-0.009200151078402996,
-0.003338454756885767,
-0.04088510200381279,
-0.01304672472178936,
0.03333023935556412,
0.061095695942640305,
-0.060013554990291595,
0.01810915581882,
0.010479485616087914,
0.03515741229057312,
0.012996120378375053,
-0.00902735348790884,
0.0068986001424491405,
-0.03792935237288475,
0.011561819352209568,
0.0167943574488163,
-0.019625205546617508,
-0.013277043588459492,
-0.006031425669789314,
0.03415044769644737,
-0.015420878306031227,
-0.060720279812812805,
0.013066548854112625,
0.06115295737981796,
0.05490214005112648,
-0.017029568552970886,
-0.017924068495631218,
-0.022254865616559982,
0.027498967945575714,
-0.04584279656410217,
0.039906397461891174,
0.0175704974681139,
0.07035039365291595,
0.04703408479690552,
-0.016664285212755203,
0.0013340587029233575,
-0.0044776322320103645,
-0.03431935980916023,
0.0008967116009443998,
0.013611764647066593,
-0.0063230497762560844,
0.0026499927043914795,
0.0364818349480629,
-0.0704570785164833,
-0.012533476576209068,
-0.020857522264122963,
0.027801286429166794,
0.03568734601140022,
0.023069119080901146,
-0.02180895023047924,
-0.02148127742111683,
-0.028026120737195015,
-0.019199777394533157,
0.018200019374489784,
0.016768096014857292,
-0.022396184504032135,
-0.00913541205227375,
-0.004804444499313831,
-0.005883245728909969,
0.0010138287907466292,
-0.03723663464188576,
0.005814176984131336,
0.004060592968016863,
0.05628064647316933,
-0.01490877941250801,
-0.0197431780397892,
0.03371579945087433,
0.020041566342115402,
-0.035467371344566345,
-0.024091733619570732,
-0.0229602362960577,
-0.021517867222428322,
0.023425471037626266,
0.012916365638375282,
0.017056003212928772,
-0.026495562866330147,
-0.00420962693169713,
-0.012534618377685547,
0.0034004165790975094,
0.020251568406820297,
-0.033934060484170914,
-0.02802933007478714,
-0.02640221267938614,
-0.0060919239185750484,
-0.028696805238723755,
-0.04619497060775757,
-0.00009167432290269062,
0.03421824425458908
] |
8a7d500dd98fa04ac32ae6b712ad22a261bd4d52 | 3,644 | py | Python | processmonitor.py | yletallec/processmonitor | 95db3416ec35fcb1325a1ac6c5a26807e4c3a474 | [
"MIT"
] | null | null | null | processmonitor.py | yletallec/processmonitor | 95db3416ec35fcb1325a1ac6c5a26807e4c3a474 | [
"MIT"
] | null | null | null | processmonitor.py | yletallec/processmonitor | 95db3416ec35fcb1325a1ac6c5a26807e4c3a474 | [
"MIT"
] | null | null | null | """Process Monitor
Usage:
processmonitor.py <process_name> <overall_duration> [<sampling_interval>]
processmonitor.py -h|--help
processmonitor.py -v|--version
Options:
<process_name> Process name argument.
<overall_duration> Overall duration of the monitoring in seconds.
<sampling_interval> Sampling interval in seconds (optional, default 5).
-h --help Show this screen.
-v --version Show version.
"""
from docopt import docopt
from utils import string_to_integer
from process import Process
from threading import Event, Thread
from datetime import datetime
import os
import sys
import csv
import time
from enum import IntEnum
class ExitStatus(IntEnum):
OK = 0
BAD_DURATION = 1
BAD_INTERVAL = 2
INTERVAL_GT_DURATION = 3
def call_repeatedly(interval, func, *args):
stopped = Event()
def loop():
iteration = 1
while not stopped.wait(interval - time.time() % interval):
func(*args, iteration)
iteration = iteration + 1
Thread(target=loop).start()
return stopped.set
def print_average():
cpu_avg, mem_avg, files_avg = Process.metrics_average()
if cpu_avg != None and mem_avg != None and files_avg != None:
print(f"Metrics Avg.: %CPU: {cpu_avg}, MEMORY(B): {mem_avg}, OPEN FILES: {files_avg}")
return True
return False
def generate_report(name, duration, interval):
if len(Process.metrics) == 0:
return False
ts = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
filename = f"{ts}_process-metrics-report_{name}_{duration}_{interval}.csv"
with open(f"{filename}", mode='w') as report:
writer = csv.writer(report, delimiter=',')
writer.writerow(['ITERATION', '%CPU', 'MEMORY(B)', 'OPEN FILES'])
iteration = 1
for metric in Process.metrics:
writer.writerow([
iteration,
metric.cpu,
metric.mem,
metric.files])
iteration = iteration + 1
reportpath = f"./{filename}"
print(f"Metrics report: {reportpath}")
return True
def raise_memory_leak_warning(name):
if (Process.has_memory_leaks(name)):
print(f"WARNING: possible memory leaks detected for process \'{name}\'")
return True
return False
def main():
args = docopt(__doc__, version='Process Monitor 1.0')
if not args['<sampling_interval>']:
args['<sampling_interval>'] = 5
name = args['<process_name>']
try:
duration = string_to_integer(args['<overall_duration>'])
except:
print("duration parameter is not an integer")
return ExitStatus.BAD_DURATION
try:
interval = string_to_integer(args['<sampling_interval>'])
except:
print("interval parameter is not an integer")
return ExitStatus.BAD_INTERVAL
if interval > duration:
print("interval parameter is greater than duration parameter")
return ExitStatus.INTERVAL_GT_DURATION
print("---------------------------------------------")
print(" Process Monitor")
print("---------------------------------------------")
print(f"Monitoring process \'{name}\' every {interval} sec for {duration} sec")
cancel_future_calls = call_repeatedly(interval, Process.monitor, name)
time.sleep(duration)
cancel_future_calls()
print_average()
generate_report(name, duration, interval)
raise_memory_leak_warning(name)
return ExitStatus.OK
def init():
if __name__ == '__main__':
if len(sys.argv) == 1:
sys.argv.append('-h')
sys.exit(main())
init()
| 31.145299 | 94 | 0.630626 | 1 | 1.8426 | [
0.0014739170437678695,
0.02586575224995613,
0.006785990670323372,
-0.00019295784295536578,
0.003914534114301205,
-0.0016402227338403463,
-0.010637215338647366,
0.002433542860671878,
-0.007604151498526335,
0.0025098025798797607,
0.0010667128954082727,
0.005792244337499142,
0.007463224697858095,
-0.01696855202317238,
0.0006820320850238204,
0.014929155819118023,
-0.05042276531457901,
-0.00006757071969332173,
-0.004613336641341448,
0.0010999793885275722,
-0.006919781677424908,
0.011003664694726467,
0.01013021357357502,
0.006194771733134985,
0.008418439887464046,
-0.00031947274692356586,
0.01048626471310854,
0.0022671238984912634,
-0.00814951304346323,
-0.007241095881909132,
-0.0007736546103842556,
-0.0012143711792305112,
-0.006078702863305807,
-0.008714644238352776,
0.004913233686238527,
-0.003284263424575329,
-0.0014513586647808552,
-0.01848454587161541,
0.01349798496812582,
-0.004555691033601761,
-0.0073136524297297,
-0.013317522592842579,
0.000367284519597888,
0.004660811275243759,
-0.006856888998299837,
0.0009016048279590905,
-0.005087664350867271,
0.0031510470435023308,
-0.011213414371013641,
0.006114860996603966,
-0.009841098450124264,
0.0042927986942231655,
0.012823651544749737,
0.003922994248569012,
-0.0055266693234443665,
-0.006880609318614006,
0.012357675470411777,
-0.00011207737406948581,
-0.010626915842294693,
-0.0008509877952747047,
-0.0038533308543264866,
-0.0030034801457077265,
0.005162245128303766,
0.0025656763464212418,
-0.014842410571873188,
-0.007536341901868582,
-0.004732401575893164,
0.0035212107468396425,
0.0008104219450615346,
0.005080843809992075,
0.0012550769606605172,
0.00032619546982459724,
0.007763464469462633,
0.005203977692872286,
0.003505269531160593,
-0.0033226285595446825,
-0.0019733854569494724,
0.0017038568621501327,
0.00907730869948864,
0.0031402851454913616,
0.004133443348109722,
-0.006110686343163252,
0.0063058459199965,
0.010361365973949432,
0.013613100163638592,
0.006613981444388628,
0.019326619803905487,
-0.01159911509603262,
0.04785613343119621,
0.007777096703648567,
-0.008897082880139351,
0.0023425635881721973,
-0.010721590369939804,
-0.0015274446923285723,
-0.006625820882618427,
-0.025905493646860123,
0.00026983118732459843,
-0.004024278372526169,
-0.0014051354955881834,
0.0035868617706000805,
0.0006750446045771241,
0.006530257407575846,
0.0001304245088249445,
-0.003216029377654195,
-0.00838005356490612,
0.010782006196677685,
-0.00944371335208416,
-0.0036989564541727304,
0.005634628236293793,
0.002204007003456354,
-0.011140412651002407,
-0.0013757580891251564,
0.0013952124863862991,
-0.011552766896784306,
0.0027984066400676966,
0.0020893551409244537,
-0.005695856176316738,
0.05444373935461044,
-0.0010929846903309226,
0.0038179028779268265,
-0.003532750764861703,
0.0027041658759117126,
0.001652493141591549,
0.005902999080717564,
0.009160454384982586,
-0.0023151542991399765,
0.009856993332505226,
0.009182807058095932,
0.0023008903954178095,
0.009662955068051815,
-0.0027141370810568333,
0.006679949816316366,
-0.0037269643507897854,
-0.0006846984615549445,
0.0015745590208098292,
-0.007491155061870813,
0.008188275620341301,
-0.0024965074844658375,
-0.007536569144576788,
-0.00006800625124014914,
-0.001369209960103035,
-0.00983631145209074,
0.00213383580558002,
-0.004944500979036093,
0.0027530572842806578,
-0.010712387040257454,
-0.0022880258038640022,
-0.0020153592340648174,
-0.0036153981927782297,
0.0023996736854314804,
0.010654320940375328,
0.004654870368540287,
0.002274425234645605,
-0.005669164005666971,
-0.010103777050971985,
-0.0007897375035099685,
-0.0045772735029459,
0.0018946202471852303,
0.007131481543183327,
0.0036145972553640604,
-0.01122944988310337,
-0.0013064704835414886,
0.0015878451522439718,
0.0026130634360015392,
-0.0002463458222337067,
0.003241433994844556,
-0.008497725240886211,
0.006831405218690634,
-0.0005405670963227749,
0.00467679463326931,
0.00975866336375475,
-0.003902541473507881,
-0.001050674938596785,
0.0003521932230796665,
0.0010610101744532585,
-0.0009319335804320872,
0.004786957520991564,
0.010349099524319172,
-0.001868794672191143,
-0.0038316426798701286,
0.00423236470669508,
0.00514695281162858,
0.007897400297224522,
0.004554748069494963,
-0.002855064580217004,
0.0018468282651156187,
-0.005637971684336662,
-0.0002797680499497801,
0.0057982937432825565,
-0.0058465017937123775,
0.006544804200530052,
0.003877801587805152,
-0.01395012903958559,
-0.00867577362805605,
-0.001088783610612154,
-0.008344673551619053,
0.001596749876625836,
0.013765258714556694,
0.009874429553747177,
-0.002859455067664385,
0.0010604079579934478,
-0.009903835132718086,
0.000655734445899725,
0.007932024076581001,
0.002603903179988265,
-0.011483374051749706,
-0.9591820240020752,
0.006617684382945299,
0.003488276619464159,
-0.0007922800723463297,
0.006673319730907679,
0.0011252580443397164,
0.0030026680324226618,
0.003681137692183256,
0.013957220129668713,
-0.010624514892697334,
-0.007306984160095453,
-0.009625885635614395,
-0.010140327736735344,
-0.004048297181725502,
-0.008902670815587044,
-0.0021765963174402714,
-0.005978805478662252,
-0.006575244013220072,
-0.0016509165288880467,
-0.0030836681835353374,
-0.0017103261779993773,
0.009409235790371895,
0.0000066081643126381095,
0.005902647040784359,
0.0041833664290606976,
0.002435368485748768,
-0.004998797085136175,
-0.003167692804709077,
-0.0023448418360203505,
-0.0030459461268037558,
-0.0070353117771446705,
-0.0149195222184062,
-0.00285540078766644,
-0.0020815767347812653,
0.01104670949280262,
0.0017940422985702753,
0.010256929323077202,
-0.0018996745347976685,
0.001914882566779852,
-0.008201428689062595,
0.004440695978701115,
0.0015685277758166194,
0.0028052153065800667,
-0.03023822419345379,
-0.00006354302604449913,
-0.0017905391287058592,
-0.008994989097118378,
0.007468287367373705,
0.0009173952857963741,
-0.001367150223813951,
-0.003991834353655577,
-0.006002676207572222,
0.008773217909038067,
-0.008596456609666348,
0.004524714779108763,
-0.004378228913992643,
-0.00800751056522131,
-0.0021765420679003,
-0.008140222169458866,
0.00252852076664567,
0.0036959717981517315,
-0.002458698581904173,
-0.006284439004957676,
-0.004619324579834938,
0.004637192003428936,
0.0025532764848321676,
0.0024330196902155876,
-0.016974439844489098,
-0.0046696737408638,
-0.0003882755117956549,
0.0004594607453327626,
-0.0018205749802291393,
-0.004499236587435007,
0.006815060041844845,
-0.008386830799281597,
0.006547579076141119,
0.0011518577812239528,
-0.000005365190645534312,
-0.013356581330299377,
0.0003814488009084016,
-0.009138367138803005,
-0.008196174167096615,
0.001392451347783208,
-0.00391772948205471,
-0.003910079598426819,
0.0007111647282727063,
0.0020203115418553352,
0.006215654779225588,
-0.005162499379366636,
0.0026983467396348715,
0.013554160483181477,
-0.004179485607892275,
-0.009527711197733879,
0.005571887828409672,
0.006474345922470093,
0.0019583371467888355,
-0.002391418907791376,
0.0030500481370836496,
0.00883509311825037,
0.008792825974524021,
0.001806464046239853,
0.004662105347961187,
0.000518804183229804,
0.008764858357608318,
-0.0005774435703642666,
0.0027369840536266565,
-0.0024728269781917334,
-0.0011998630361631513,
-0.0020092460326850414,
-0.0014594246167689562,
-0.0035691119264811277,
-0.0021193320862948895,
-0.012318706139922142,
-0.00942587573081255,
-0.004626035690307617,
0.00035920998197980225,
0.001916393986903131,
-0.004617099184542894,
-0.0009397368994541466,
0.0020782556384801865,
0.008939569815993309,
0.00048661796608939767,
-0.00259285606443882,
-0.0002149790379917249,
0.002491773571819067,
-0.007035160902887583,
0.015090811997652054,
-0.011384567245841026,
0.006291492376476526,
-0.0002330203860765323,
-0.01638958975672722,
0.0062206704169511795,
0.007449403405189514,
-0.01022928487509489,
0.0018589101964607835,
0.002957044867798686,
0.002732649212703109,
-0.000382707774406299,
-0.0037209494039416313,
-0.004003838170319796,
-0.01508809719234705,
0.00036014101351611316,
0.019929993897676468,
0.0005549457273446023,
0.009845384396612644,
0.012334257364273071,
-0.002816183492541313,
0.0029474052134901285,
0.005731078330427408,
0.00045163012691773474,
0.011709881946444511,
-0.00928183551877737,
0.00057259137975052,
0.001994206802919507,
-0.005151323974132538,
0.0013050711713731289,
0.006027070339769125,
0.007447335869073868,
-0.005626655649393797,
0.002942947670817375,
-0.007021182682365179,
-0.004692883230745792,
-0.017660144716501236,
-0.0028689918108284473,
0.00658703176304698,
-0.006968246307224035,
0.005838877055794001,
-0.012218552641570568,
0.0062402402982115746,
0.007016859482973814,
0.002778298920020461,
0.0006514975102618337,
0.0022248169407248497,
0.0056515708565711975,
0.01412524189800024,
-0.006816901732236147,
0.0014081171248108149,
0.0026207107584923506,
-0.0006233128951862454,
-0.0002999673306476325,
0.007260933518409729,
-0.007817596197128296,
-0.005809105467051268,
0.0019103586673736572,
0.004425120074301958,
-0.00015595855074934661,
-0.004805049393326044,
-0.008821780793368816,
-0.004357760772109032,
0.001972638303413987,
-0.00772791588678956,
0.004936129320412874,
-0.00015174834697972983,
0.0036992738023400307,
-0.006844102405011654,
-0.0007325626793317497,
-0.0016240837285295129,
-0.012795778922736645,
0.010524654760956764,
-0.0041035497561097145,
0.003497371217235923,
0.013676549308001995,
0.005698458291590214,
-0.012427243404090405,
0.005678836721926928,
0.008987220004200935,
-0.0030189857352524996,
0.003919375594705343,
0.00451090931892395,
-0.0054474459029734135,
-0.020828839391469955,
-0.002145994221791625,
-0.012639116495847702,
0.005914205219596624,
-0.002559203887358308,
0.004259525332599878,
-0.007518550846725702,
0.006919420324265957,
0.00810339767485857,
-0.013794885016977787,
-0.005755502264946699,
-0.00839957408607006,
0.009805665351450443,
0.00021973294497001916,
-0.0008197894785553217,
-0.003827368840575218,
-0.0018645036034286022,
-0.001556304981932044,
-0.003301038406789303,
-0.0019547799602150917,
0.005769495852291584,
0.000589163915719837,
-0.002503685187548399,
0.0020135617814958096,
-0.004352079704403877,
0.000903827662114054,
0.00009970377141144127,
-0.009931012988090515,
0.003928585909307003,
0.004379175137728453,
-0.0014257756993174553,
-0.0027979565784335136,
0.0034831638913601637,
-0.0031184370163828135,
-0.005774219520390034,
-0.01187963504344225,
-0.003618469927459955,
-0.004890636540949345,
-0.0019801806192845106,
-0.01254715770483017,
-0.0025638563092797995,
-0.009281065315008163,
0.007859227247536182,
-0.006919218692928553,
0.008164195343852043,
0.004075363744050264,
-0.005926972720772028,
0.004656246397644281,
-0.003227472538128495,
0.003958127927035093,
0.0023413265589624643,
0.005747525487095118,
0.00029026195988990366,
-0.006450096610933542,
-0.009813046082854271,
0.01128139067441225,
-0.008689355105161667,
0.0011678853770717978,
0.01285889558494091,
0.006710293237119913,
0.00984190870076418,
0.0006972995470277965,
-0.0004387855005916208,
0.002050126204267144,
0.007354274857789278,
-0.010321356356143951,
0.003150819567963481,
-0.0030038326513022184,
-0.0009085005731321871,
0.004750431515276432,
-0.0033660405315458775,
0.001541102072224021,
0.008322988636791706,
-0.00012323989358264953,
-0.0071359178982675076,
-0.0009116571163758636,
0.001521111000329256,
0.0043264650739729404,
-0.012662733905017376,
0.0010909754782915115,
-0.0023700834717601538,
-0.004195356275886297,
-0.001791408285498619,
-0.0005499700782820582,
-0.00006349318573484197,
0.004375398624688387,
-0.0020375526510179043,
0.00574493408203125,
0.0014504039427265525,
-0.005581467878073454,
0.014274513348937035,
-0.005001379642635584,
-0.005205628927797079,
0.002145475475117564,
0.0033134387340396643,
-0.002675873227417469,
-0.0055155144073069096,
-0.00214288174174726,
0.002816678723320365,
0.00710162241011858,
-0.0042055887170135975,
-0.0035664322786033154,
-0.0003512786061037332,
0.0034091791603714228,
-0.008899476379156113,
-0.0001947914861375466,
0.013611608184874058,
-0.0060603078454732895,
0.0062915668822824955,
-0.0018429687479510903,
-0.007408458273857832,
-0.012797601521015167,
0.05300545319914818,
-0.000854073150549084,
0.002997715724632144,
0.005311117973178625,
-0.006516929250210524,
-0.00029142823768779635,
-0.0021943189203739166,
0.007473672274500132,
-0.006647060159593821,
-0.0072212074883282185,
0.008039356209337711,
-0.004409388173371553,
0.0036798259243369102,
0.0015062377788126469,
-0.0016813540132716298,
0.016598979011178017,
-0.004869412165135145,
-0.017249664291739464,
-0.01611500233411789,
0.008982815779745579,
-0.0041307853534817696,
-0.006799801252782345,
0.008971518836915493,
-0.00256286165677011,
-0.002417544601485133,
0.00019686980522237718,
0.004749592859297991,
0.0005445933202281594,
0.00029133318457752466,
-0.003469419665634632,
-0.001622783369384706,
-0.0025854690466076136,
0.0016410837415605783,
0.005707926116883755,
0.007981781847774982,
-0.0023064909037202597,
0.004252688027918339,
-0.0016520704375579953,
-0.002158593386411667,
-0.003567212028428912,
0.004325639922171831,
0.008279416710138321,
-0.002832440659403801,
-0.0018147426890209317,
0.0062056598253548145,
0.0045210313983261585,
0.0024727333802729845,
0.01093315053731203,
-0.0009809498442336917,
-0.0051666609942913055,
0.0078709302470088,
0.0069455960765480995,
-0.0013333711540326476,
0.009256992489099503,
-0.0011191102676093578,
0.007221452426165342,
0.0011668640654534101,
-0.006687091663479805,
-0.014080426655709743,
-0.0030201314948499203,
0.00682143634185195,
0.008403090760111809,
-0.001247744308784604,
0.0007220057887025177,
-0.0009665174875408411,
-0.001116134342737496,
-0.006850088480859995,
-0.008367501199245453,
-0.0014043416595086455,
0.0013137063942849636,
0.004651167895644903,
0.07080463320016861,
-0.004736481234431267,
-0.000408953579608351,
-0.009837818332016468,
-0.0018185523804277182,
-0.00263593764975667,
-0.0015982763143256307,
0.0001982131361728534,
-0.0025401609018445015,
0.0011209690710529685,
0.0026885378174483776,
-0.007362072356045246,
-0.01130529586225748,
0.0008028652518987656,
0.00011792681470979005,
-0.0022788066416978836,
0.004785836674273014,
0.006048229523003101,
-0.007416602689772844,
0.0007414001738652587,
-0.011746671050786972,
-0.000909733003936708,
-0.0026032065507024527,
-0.010410455986857414,
-0.0041531906463205814,
-0.0056876312009990215,
0.005696851294487715,
0.003201790852472186,
0.00537444232031703,
-0.0016224829014390707,
0.004784603603184223,
-0.003392517566680908,
-0.0012736418284475803,
-0.0064252098090946674,
-0.000756851106416434,
-0.006259409245103598,
0.007005809340626001,
0.0010995307238772511,
-0.00985526479780674,
-0.0068352255038917065,
0.0009283444378525019,
-0.001167307491414249,
-0.004927711561322212,
0.0030086683109402657,
0.0004107776621822268,
0.00582139240577817,
-0.0024700036738067865,
0.0016067088581621647,
-0.0077149453572928905,
0.0016061672940850258,
-0.01181052252650261,
0.0055140904150903225,
-0.17238304018974304,
0.010395168326795101,
0.0022720179986208677,
-0.005828506778925657,
-0.0034494835417717695,
-0.014661421999335289,
-0.0064802272245287895,
0.0021417848765850067,
0.009423513896763325,
0.00017375948664266616,
-0.0003875780093949288,
0.0003543267957866192,
0.0047212825156748295,
0.005400697235018015,
-0.001956629566848278,
-0.003467284608632326,
0.00519085768610239,
-0.0046828496269881725,
0.0007317719282582402,
0.0035240352153778076,
0.002815115498378873,
0.0078700240701437,
0.0013449714751914144,
0.0021331338211894035,
-0.000529352342709899,
-0.004792484920471907,
0.006438558921217918,
-0.0024820519611239433,
0.006189015228301287,
-0.013644354417920113,
-0.003569574560970068,
-0.004326824564486742,
-0.004739921074360609,
0.0020025959238409996,
0.006456001196056604,
-0.0006467631901614368,
0.009093398228287697,
0.0025566124822944403,
-0.008205543272197247,
0.006734900642186403,
-0.007328438106924295,
0.029057269915938377,
0.0034694846253842115,
0.00648835301399231,
-0.000005841529855388217,
-0.005098927766084671,
-0.0046425494365394115,
0.008715013042092323,
0.0024505306500941515,
0.012698585167527199,
-0.012238497845828533,
-0.001104912837035954,
0.0030925977043807507,
0.01924930140376091,
-0.004078717436641455,
-0.009751399978995323,
-0.006019710097461939,
-0.0022500602062791586,
0.002494960557669401,
0.007179736625403166,
0.009530420415103436,
-0.0038033018354326487,
0.006711824797093868,
-0.002578489016741514,
-0.021968891844153404,
0.002666269661858678,
-0.00439877063035965,
-0.00579203711822629,
0.0009820290142670274,
0.00743110803887248,
0.010465879924595356,
0.00027974238037131727,
0.0018394512590020895,
-0.0012587913079187274,
0.005211485084146261,
0.0007744953036308289,
0.005972269456833601,
-0.0022000097669661045,
0.0037825540639460087,
-0.009912766516208649,
0.006520852912217379,
-0.009960087016224861,
-0.0026771416887640953,
0.002305078087374568,
-0.005654718726873398,
0.012299821712076664,
0.004246325697749853,
-0.0018245679093524814,
-0.0022686782758682966,
-0.010504515841603279,
-0.0010184209095314145,
0.002257846063002944,
0.001743752509355545,
-0.008660497143864632,
0.0026894714683294296,
0.0017986815655604005,
0.004361974075436592,
0.005576663184911013,
-0.009593901224434376,
0.006663006730377674,
0.005139776039868593,
-0.0055692740716040134,
0.001325510093010962,
-0.004476791713386774,
0.0019233257044106722,
0.004706094972789288,
-0.005941377952694893,
-0.006421743426471949,
0.002515064785256982,
-0.006468161009252071,
-0.004976341966539621,
0.008694034069776535,
-0.009531891904771328,
-0.006600221153348684,
-0.003039895324036479,
-0.011524282395839691,
0.0006410146015696228
] |
8a7d668b99ceea74e75c844a87347ac04ef02b71 | 6,740 | py | Python | Projects/DeepLearningTechniques/MobileNet_v2/tiny_imagenet/data_loader.py | Tim232/Python-Things | 05f0f373a4cf298e70d9668c88a6e3a9d1cd8146 | [
"MIT"
] | 2 | 2020-12-05T07:42:55.000Z | 2021-01-06T23:23:18.000Z | Projects/DeepLearningTechniques/MobileNet_v2/tiny_imagenet/data_loader.py | Tim232/Python-Things | 05f0f373a4cf298e70d9668c88a6e3a9d1cd8146 | [
"MIT"
] | null | null | null | Projects/DeepLearningTechniques/MobileNet_v2/tiny_imagenet/data_loader.py | Tim232/Python-Things | 05f0f373a4cf298e70d9668c88a6e3a9d1cd8146 | [
"MIT"
] | null | null | null | import os
import re
import numpy as np
from Projects.DeepLearningTechniques.MobileNet_v2.tiny_imagenet.constants import *
class DataLoader:
# todo train/test/validation => (클래스 당 500/50/50)
def __init__(self):
self.image_width = flags.FLAGS.image_width
self.image_height = flags.FLAGS.image_height
self.batch_size = flags.FLAGS.batch_size
self.data_path = flags.FLAGS.data_path
self.img_reg = re.compile('.*\\.jpeg', re.IGNORECASE)
self.init_class()
self.init_annotation()
def init_class(self):
self.cls = {}
for idx, dir in enumerate(os.listdir(os.path.join(self.data_path, 'train'))):
self.cls[dir] = idx
def init_annotation(self):
self.anno = {}
for line in open(os.path.join(self.data_path, 'val', 'val_annotations.txt')):
filename, label, *_ = line.split('\t')
self.anno[filename] = label
def init_train(self):
train_x, train_y = [], []
for (path, dirs, files) in os.walk(os.path.join(self.data_path, 'train')):
for file in files:
if self.img_reg.match(file):
train_x.append(os.path.join(path, file))
train_y.append(self.cls[re.match('(.+)\\_\d+\\.jpeg', file, re.IGNORECASE).group(1)])
self.train_len = len(train_y)
#todo train data random sort
random_sort = np.random.permutation(self.train_len)
train_x, train_y = np.asarray(train_x, dtype=np.string_)[random_sort], np.asarray(train_y, dtype=np.int64)[random_sort]
#todo (Numpy / List) => Tensor 로 변환
with tf.variable_scope(name_or_scope='data_tensor'):
self.train_x = tf.convert_to_tensor(value=train_x, dtype=tf.string, name='train_x')
self.train_y = tf.convert_to_tensor(value=train_y, dtype=tf.int64, name='train_y')
def init_validation(self):
valid_x, valid_y = [], []
for (path, dirs, files) in os.walk(os.path.join(self.data_path, 'val')):
for file in files:
if self.img_reg.match(file):
valid_x.append(os.path.join(path, file))
valid_y.append(self.cls[self.anno[file]])
self.valid_len = len(valid_y)
#todo validataion data random sort
random_sort = np.random.permutation(self.valid_len)
valid_x, valid_y = np.asarray(valid_x, dtype=np.string_)[random_sort], np.asarray(valid_y, dtype=np.int64)[random_sort]
#todo (Numpy / List) -> Tensor 로 변환
with tf.variable_scope(name_or_scope='data_tensor'):
self.valid_x = tf.convert_to_tensor(value=valid_x, dtype=tf.string, name='valid_x')
self.valid_y = tf.convert_to_tensor(value=valid_y, dtype=tf.int64, name='valid_y')
def init_test(self):
test_x = []
for (path, dirs, files) in os.walk(os.path.join(self.data_path, 'test')):
for file in files:
test_x.append(os.path.join(path, file))
self.test_len = len(test_x)
#todo (Numpy / List) -> Tensor 로 변환
with tf.variable_scope(name_or_scope='data_tensor'):
self.test_x = tf.convert_to_tensor(value=test_x, dtype=tf.string, name='test_x')
def train_normal(self, x, y):
with tf.variable_scope(name_or_scope='train_normal'):
x = tf.read_file(filename=x)
x = tf.image.decode_png(contents=x, channels=3, name='decode_png')
x = tf.divide(tf.cast(x, tf.float32), 255.)
x = tf.subtract(x, [0.4921, 0.4833, 0.4484])
x = tf.divide(x, [0.2465, 0.2431, 0.2610])
return x, y
def train_random_crop(self, x, y):
with tf.variable_scope(name_or_scope='train_random_crop'):
x = tf.read_file(filename=x)
x = tf.image.decode_png(contents=x, channels=3, name='decode_png')
x = tf.pad(x, [[0, 0], [4, 4], [4, 4], [0, 0]], name='padding')
# x = tf.image.resize_images(images=x, size=(self.image_height+8, self.image_width+8), method=tf.image.ResizeMethod.NEAREST_NEIGHBOR)
x = tf.random_crop(value=x, size=(self.image_height, self.image_width, 3))
x = tf.divide(tf.cast(x, tf.float32), 255.)
x = tf.subtract(x, [0.4921, 0.4833, 0.4484])
x = tf.divide(x, [0.2465, 0.2431, 0.2610])
return x, y
def valid_normal(self, x, y):
with tf.variable_scope(name_or_scope='valid_normal'):
x = tf.read_file(filename=x)
x = tf.image.decode_png(contents=x, channels=3, name='decode_png')
x = tf.divide(tf.cast(x, tf.float32), 255.)
x = tf.subtract(x, [0.4921, 0.4833, 0.4484])
x = tf.divide(x, [0.2465, 0.2431, 0.2610])
return x, y
def test_normal(self, x):
with tf.variable_scope(name_or_scope='test_normal'):
x = tf.read_file(filename=x)
x = tf.image.decode_png(contents=x, channels=3, name='decode_png')
x = tf.divide(tf.cast(x, tf.float32), 255.)
x = tf.subtract(x, [0.4921, 0.4833, 0.4484])
x = tf.divide(x, [0.2465, 0.2431, 0.2610])
return x
def dataset_batch_loader(self, dataset, ref_func, name):
with tf.variable_scope(name_or_scope=name):
dataset_map = dataset.map(ref_func).batch(self.batch_size)
iterator = dataset_map.make_one_shot_iterator()
batch_input = iterator.get_next()
return batch_input
def train_loader(self):
with tf.variable_scope('train_loader'):
'''
repeat(): 데이터셋이 끝에 도달했을 때 다시 처음부터 수행하게 하는 함수
shuffle(): 데이터셋에 대해 random sort 기능을 수행하는 함수 (괄호안에 값이 전체 데이터 수보다 크면 전체 데이터에 대한 random sort)
'''
dataset = tf.data.Dataset.from_tensor_slices((self.train_x, self.train_y)).repeat()
normal_batch = self.dataset_batch_loader(dataset, self.train_normal, name='normal_batch')
random_crop_batch = self.dataset_batch_loader(dataset, self.train_random_crop, name='random_crop_batch')
return normal_batch, random_crop_batch
def valid_loader(self):
with tf.variable_scope('valid_loader'):
dataset = tf.data.Dataset.from_tensor_slices((self.valid_x, self.valid_y)).repeat()
normal_batch = self.dataset_batch_loader(dataset, self.valid_normal, name='normal_batch')
return normal_batch
def test_loader(self):
with tf.variable_scope('test_loader'):
dataset = tf.data.Dataset.from_tensor_slices(self.test_x).repeat()
normal_batch = self.dataset_batch_loader(dataset, self.test_normal, name='normal_batch')
return normal_batch | 41.863354 | 145 | 0.616914 | 1 | 2.1276 | [
-0.01164095476269722,
0.006911668460816145,
-0.01119815930724144,
-0.004093501716852188,
-0.01719394139945507,
0.03344998136162758,
-0.004354863427579403,
-0.02839593216776848,
-0.03450072184205055,
0.009504611603915691,
-0.013965659774839878,
-0.008998419158160686,
0.019208090379834175,
-0.0017830563010647893,
-0.03785732761025429,
-0.01774960570037365,
0.06625372171401978,
-0.01706453040242195,
-0.02632669173181057,
-0.0002418540680082515,
-0.0036874152719974518,
0.018550895154476166,
-0.004516013897955418,
0.023631811141967773,
0.012515577487647533,
-0.01724383421242237,
0.029001910239458084,
0.011871780268847942,
0.02779514528810978,
0.0024495022371411324,
0.0049276091158390045,
-0.009998436085879803,
-0.007172677665948868,
0.0004515782347880304,
0.006014874670654535,
-0.009350903332233429,
0.017863988876342773,
0.009575830772519112,
-0.005104638170450926,
-0.021408915519714355,
0.052293699234724045,
-0.045915938913822174,
-0.00899942871183157,
-0.004915314260870218,
0.017846744507551193,
0.0008344990783371031,
-0.004785759374499321,
0.023041347041726112,
-0.04151075705885887,
-0.009950495325028896,
-0.018651852384209633,
0.006062744185328484,
0.020907195284962654,
-0.036130741238594055,
0.02280368283390999,
-0.05840824916958809,
-0.00544348731637001,
0.05574212968349457,
-0.034487318247556686,
-0.008998825214803219,
0.014369676820933819,
-0.002772761508822441,
0.009615889750421047,
0.006380877923220396,
0.013001048937439919,
0.0012091555399820209,
-0.00023287888325285167,
0.026180652901530266,
-0.023812102153897285,
-0.025342613458633423,
0.013362903147935867,
-0.009424958378076553,
-0.00011177962005604059,
0.01151419896632433,
0.014027945697307587,
0.020432908087968826,
-0.0376272089779377,
-0.034744035452604294,
-0.0131405433639884,
0.0026452888268977404,
0.0006173762958496809,
0.02172262594103813,
0.022162018343806267,
-0.008014298975467682,
0.0177159421145916,
0.07274612784385681,
0.03722856938838959,
-0.008988347835838795,
0.02625337429344654,
0.007247902452945709,
-0.031779415905475616,
0.04000280052423477,
-0.02817121148109436,
0.0110862972214818,
-0.02265922911465168,
-0.049179017543792725,
0.002595319878309965,
0.0053026434034109116,
-0.004103784915059805,
0.03907018527388573,
0.012001206167042255,
-0.024144476279616356,
0.020955661311745644,
0.00601088535040617,
-0.009712028317153454,
-0.028495794162154198,
-0.07352148741483688,
-0.00010451632988406345,
0.007411673199385405,
-0.005835676100105047,
-0.01694425381720066,
-0.007054292596876621,
0.00550027284771204,
-0.026765262708067894,
0.01386876031756401,
0.0003492617979645729,
-0.0025532294530421495,
-0.011302960105240345,
0.0037480040919035673,
0.03412589430809021,
0.001338673522695899,
-0.019442040473222733,
0.014498064294457436,
-0.020198054611682892,
-0.02017090655863285,
0.050175756216049194,
0.025917155668139458,
0.025606388226151466,
0.0455416738986969,
-0.02777828276157379,
-0.008032482117414474,
0.03314291685819626,
0.005326931830495596,
-0.005962761119008064,
-0.026370331645011902,
-0.015118326060473919,
0.0008726546657271683,
0.0259210467338562,
-0.01365178544074297,
0.004369961563497782,
0.042367417365312576,
-0.026813389733433723,
0.01096669677644968,
-0.020524509251117706,
-0.03127066418528557,
-0.02466990239918232,
-0.04239555075764656,
-0.011922882869839668,
-0.025818776339292526,
-0.008415655232965946,
-0.01793474517762661,
-0.010227492079138756,
-0.017177144065499306,
0.031359944492578506,
-0.01224472001194954,
-0.02682015672326088,
-0.006616310682147741,
-0.04651803895831108,
-0.002616235287860036,
-0.021243955940008163,
-0.010551683604717255,
0.0038264943286776543,
-0.014180544763803482,
-0.00343578914180398,
-0.018164463341236115,
0.02876053936779499,
0.0064699784852564335,
0.012570521794259548,
-0.018790176138281822,
-0.0035939463414251804,
0.0006280611851252615,
-0.025068463757634163,
0.0005265300278551877,
-0.022245820611715317,
-0.015788907185196877,
0.007036848459392786,
0.011592728085815907,
0.00913180224597454,
0.012364087626338005,
-0.0003174276789650321,
0.025439463555812836,
-0.0024853195063769817,
0.018024560064077377,
0.026340574026107788,
0.012223104014992714,
0.0014307245146483183,
-0.00781316589564085,
0.007835152558982372,
0.0011596865952014923,
-0.030220922082662582,
-0.034394294023513794,
0.003399652661755681,
-0.011025970801711082,
-0.02837594971060753,
0.014375116676092148,
-0.0030560637824237347,
0.012320523150265217,
0.002916839672252536,
-0.009575173258781433,
-0.011149736121296883,
0.023864205926656723,
0.012015284039080143,
-0.01102240290492773,
0.010477650910615921,
-0.02474319189786911,
-0.02129947580397129,
-0.7803437113761902,
0.014756845310330391,
0.008652153424918652,
-0.007500869687646627,
-0.01080856192857027,
0.037292513996362686,
-0.05634485185146332,
0.02155969850718975,
-0.03573653846979141,
-0.015204638242721558,
-0.007830609567463398,
0.017481662333011627,
-0.0257421862334013,
0.00022778201673645526,
0.03862175717949867,
0.0008702880004420877,
0.00584837282076478,
0.022334711626172066,
0.01061591599136591,
-0.0021961014717817307,
-0.0014703490305691957,
0.028008805587887764,
0.02020832896232605,
-0.01593489572405815,
0.0036127837374806404,
0.00785010028630495,
0.015285315923392773,
-0.033043671399354935,
0.007033393252640963,
0.007656743749976158,
-0.009949917905032635,
-0.011023905128240585,
0.00632570032030344,
-0.005393342114984989,
0.020692594349384308,
0.005050555802881718,
0.0018849404295906425,
-0.013516504317522049,
-0.01221353467553854,
-0.016653018072247505,
0.002751353196799755,
-0.04344968870282173,
-0.005106301512569189,
-0.03656227886676788,
-0.042223550379276276,
0.013123869895935059,
-0.02998458594083786,
-0.025814199820160866,
0.029775798320770264,
-0.005482432898133993,
-0.05793827399611473,
0.028123917058110237,
0.038256771862506866,
-0.006197166629135609,
-0.013273295015096664,
-0.007061309646815062,
-0.003370583290234208,
-0.010960986837744713,
-0.026933005079627037,
-0.004236465785652399,
0.03449143469333649,
-0.003836011281237006,
-0.04383019357919693,
0.012872562743723392,
0.002403422025963664,
0.026862461119890213,
0.0613737516105175,
-0.017684251070022583,
-0.016327721998095512,
-0.007812074385583401,
-0.052980680018663406,
0.004343750420957804,
0.0003520516329444945,
0.09988294541835785,
-0.013548227027058601,
-0.007506740279495716,
0.023020990192890167,
0.01177356019616127,
-0.0496193990111351,
-0.012337672524154186,
-0.008226591162383556,
-0.015059800818562508,
0.012872557155787945,
-0.01762676239013672,
-0.028825493529438972,
0.02937440387904644,
-0.0004391780530568212,
-0.013492066413164139,
-0.02239767648279667,
-0.011936016380786896,
-0.008965983986854553,
0.05839204788208008,
-0.015197102911770344,
-0.01683485321700573,
-0.0017636578995734453,
0.013781673274934292,
0.010842995718121529,
0.006609421223402023,
0.002771168714389205,
-0.0006104286294430494,
-0.06702721863985062,
0.0069354623556137085,
0.016533227637410164,
0.03429071977734566,
0.016608932986855507,
0.0328502394258976,
-0.008150031790137291,
0.008115586824715137,
0.04550623521208763,
-0.021008018404245377,
-0.00606964435428381,
-0.04040709510445595,
-0.012242146767675877,
0.03472454845905304,
-0.02624027244746685,
-0.011568017303943634,
-0.001650691032409668,
-0.011207668110728264,
0.009017719887197018,
0.007109705358743668,
-0.040123164653778076,
-0.009594731032848358,
0.04401136562228203,
-0.000576950900722295,
-0.013085850514471531,
0.01516533549875021,
-0.018567854538559914,
-0.007066492922604084,
0.005992661230266094,
0.021573957055807114,
-0.014816717244684696,
-0.041901230812072754,
0.0031645570416003466,
0.010893994942307472,
0.006572964135557413,
0.014160819351673126,
-0.025213954970240593,
-0.042101357132196426,
-0.008733833208680153,
0.0029717320576310158,
-0.002022329717874527,
-0.004990256857126951,
0.010383039712905884,
-0.019119244068861008,
0.024324102327227592,
0.0037873676046729088,
0.016272032633423805,
0.01821991428732872,
0.002210332080721855,
0.011915483511984348,
0.006545743439346552,
0.02894611842930317,
0.01664690487086773,
-0.01703324355185032,
-0.0017627142369747162,
0.029462462291121483,
-0.019947296008467674,
-0.007013404276221991,
0.008855855092406273,
-0.009044955484569073,
-0.003463605884462595,
-0.012940993532538414,
-0.05064668133854866,
0.011412723921239376,
0.03374573960900307,
0.005561071448028088,
-0.0035451343283057213,
0.022585229948163033,
-0.010477731004357338,
0.00030234764562919736,
0.00845442246645689,
-0.016742156818509102,
0.02302596904337406,
0.011228079907596111,
0.01290670596063137,
0.014799329452216625,
-0.007470297627151012,
-0.0344194732606411,
-0.018232792615890503,
0.0022336796391755342,
0.013050706125795841,
0.004253328312188387,
-0.009982067160308361,
0.02348414435982704,
-0.002990485867485404,
0.04015638306736946,
0.02384188398718834,
0.018762975931167603,
0.0010680974228307605,
0.013497469946742058,
0.013800080865621567,
0.008801061660051346,
-0.021806038916110992,
0.0014673150144517422,
-0.04405313357710838,
0.007897567935287952,
-0.01733289659023285,
-0.0014399333158507943,
0.00496230274438858,
-0.007514448836445808,
0.00860768835991621,
0.03730842098593712,
0.008391598239541054,
-0.01328926533460617,
0.006723961792886257,
0.039566945284605026,
0.009856385178864002,
-0.00977919902652502,
-0.01886683888733387,
-0.01643434353172779,
0.001200946280732751,
-0.031363122165203094,
0.028646672144532204,
-0.022388746961951256,
0.0022627448197454214,
0.027420267462730408,
-0.014232702553272247,
0.005567201878875494,
-0.0069923680275678635,
-0.04717031866312027,
0.0114773353561759,
-0.01328885555267334,
0.011238442733883858,
0.0005125653697177768,
-0.006187682971358299,
-0.0039057775866240263,
-0.017556216567754745,
0.01147875003516674,
0.0008509760373272002,
0.008169695734977722,
0.0018769258167594671,
0.001251356559805572,
-0.00447198236361146,
-0.020130863413214684,
0.00044037384213879704,
-0.020662356168031693,
-0.023245226591825485,
-0.007590584456920624,
-0.05893731117248535,
0.0049697537906467915,
-0.0014607056509703398,
-0.0003397832624614239,
-0.042699262499809265,
0.013327001594007015,
0.0029716170392930508,
-0.010721529833972454,
0.007066782098263502,
-0.004415595438331366,
-0.04709620773792267,
-0.005554623901844025,
-0.010503416880965233,
0.009592980146408081,
0.012423940002918243,
-0.004655326716601849,
0.05027708038687706,
-0.00722650857642293,
-0.0029073588084429502,
0.034939929842948914,
0.006857954431325197,
0.012616865336894989,
0.004110689274966717,
-0.025633664801716805,
0.002998977666720748,
0.010714306496083736,
0.014530668035149574,
0.0038738215807825327,
-0.004264014773070812,
0.003005135804414749,
-0.000163617281941697,
0.003832589602097869,
0.014822420664131641,
-0.016052482649683952,
-0.013729248195886612,
-0.01417327206581831,
-0.013979625888168812,
-0.013651248998939991,
0.013998775742948055,
-0.04818936437368393,
0.010761437006294727,
0.027717282995581627,
-0.05228567123413086,
-0.019902193918824196,
0.011456519365310669,
0.0365443229675293,
0.02700338326394558,
0.012242167256772518,
0.01804216578602791,
-0.03849627077579498,
-0.01132122054696083,
0.011412481777369976,
0.001685164519585669,
-0.03378622233867645,
-0.03059551864862442,
-0.03243887796998024,
-0.010808011516928673,
0.03743607550859451,
0.010108979418873787,
-0.013603460974991322,
0.02045048028230667,
0.045886486768722534,
0.03561469167470932,
0.0002980025310534984,
0.000666865729726851,
-0.006325673311948776,
-0.005998004227876663,
-0.0220082625746727,
0.005420764442533255,
-0.004883456043899059,
0.03440205752849579,
-0.012919642962515354,
0.005031374748796225,
0.024732138961553574,
0.029877783730626106,
0.007366616278886795,
-0.02174801379442215,
-0.0043600741773843765,
0.027821838855743408,
0.02938014641404152,
0.013842310756444931,
-0.004994044080376625,
0.0024497010745108128,
-0.010025231167674065,
-0.010146185755729675,
-0.03897235915064812,
0.006076935213059187,
-0.017104361206293106,
0.0016683543799445033,
0.01691984012722969,
0.023919418454170227,
0.031964901834726334,
-0.019022278487682343,
0.014543689787387848,
-0.0005929406033828855,
0.004710510838776827,
-0.0005574725801125169,
-0.019101597368717194,
0.011162479408085346,
0.036611463874578476,
0.05452680587768555,
-0.018208205699920654,
-0.023347871378064156,
-0.0039026662707328796,
0.031523920595645905,
-0.003462528809905052,
0.0007131234742701054,
0.02434621751308441,
0.05104349926114082,
0.07547371834516525,
0.03282962366938591,
0.020466985180974007,
0.021139170974493027,
-0.028334738686680794,
-0.003425625851377845,
-0.005347229540348053,
0.022911518812179565,
-0.008940741419792175,
-0.002140546916052699,
0.02253304421901703,
0.0020183080341666937,
-0.013872593641281128,
0.019591106101870537,
0.006361084058880806,
-0.0009917485294863582,
-0.007519213482737541,
0.0031033537816256285,
-0.028658602386713028,
0.0261257104575634,
-0.047798093408346176,
-0.008380986750125885,
0.045206259936094284,
-0.02322794869542122,
-0.03786377236247063,
0.012400691397488117,
0.015814293175935745,
0.0275445394217968,
0.03281458467245102,
0.07853689044713974,
0.03032633848488331,
-0.002234065905213356,
0.0046056173741817474,
-0.018665576353669167,
-0.023910606279969215,
0.007823226042091846,
-0.005102153867483139,
0.029090100899338722,
-0.027027467265725136,
0.007756724022328854,
0.007841279730200768,
-0.01894785836338997,
0.027891730889678,
0.009214678779244423,
-0.01351698487997055,
0.013498221524059772,
-0.005233406089246273,
-0.03896360099315643,
-0.011952138505876064,
-0.041935812681913376,
-0.015706298872828484,
-0.007193166762590408,
-0.006242052186280489,
0.0014298040186986327,
0.013089966028928757,
0.015529340133070946,
-0.00775139220058918,
-0.0020157762337476015,
-0.007373399566859007,
0.036170005798339844,
-0.002479631919413805,
-0.008798128925263882,
0.008285347372293472,
-0.005275039933621883,
0.0148476492613554,
-0.01062825694680214,
-0.01667594350874424,
-0.006046489346772432,
-0.01321951299905777,
-0.01555075217038393,
-0.0001192730778711848,
-0.0013052573194727302,
0.01273381058126688,
0.017112573608756065,
-0.03371833264827728,
-0.020623158663511276,
-0.015906045213341713,
-0.011371592991054058,
-0.015299653634428978,
0.03298994526267052,
-0.01794164441525936,
-0.003934452310204506,
0.025481102988123894,
0.008313225582242012,
-0.013441918417811394,
-0.01004206296056509,
0.03572144731879234,
0.006449006963521242,
-0.014538893476128578,
0.042181700468063354,
-0.016670512035489082,
-0.007201302330940962,
0.03145121783018112,
0.003115763422101736,
0.016853181645274162,
-0.013696066103875637,
0.004600853659212589,
-0.00040730697219260037,
-0.015720635652542114,
0.016252372413873672,
0.011048391461372375,
0.01244243886321783,
-0.013681524433195591,
0.005033171735703945,
-0.00744979502633214,
0.02991321124136448,
0.0245028268545866,
0.006735645234584808,
0.02818669006228447,
0.05070358142256737,
0.0038123985286802053,
0.0014026591088622808,
0.024065833538770676,
-0.011850534938275814,
0.021593274548649788,
-0.021831348538398743,
0.03759350627660751,
0.04297793656587601,
0.018511304631829262,
-0.004428282845765352,
-0.040175143629312515,
-0.0014169730711728334,
-0.03483323007822037,
0.019330084323883057,
-0.0046079414896667,
-0.03299814835190773,
0.013670612126588821,
-0.01743372716009617,
-0.03377952426671982,
0.0003280023520346731,
0.026268763467669487,
0.018934551626443863,
-0.008779898285865784,
-0.02165503241121769,
0.01858796551823616,
0.02119172178208828,
-0.001288459636271,
0.019717374816536903,
-0.028713714331388474,
-0.019379600882530212,
0.07170840352773666,
-0.027483738958835602,
0.00533306272700429,
-0.008156640455126762,
0.005345063749700785,
-0.03261719271540642,
0.011887352913618088,
-0.0015934628900140524,
-0.01806425116956234,
0.029183626174926758,
-0.043212201446294785,
0.031083550304174423,
0.010441008023917675,
-0.027937332168221474,
-0.04338356852531433,
-0.031539492309093475,
-0.035509221255779266,
0.03687005862593651,
0.01342284120619297,
0.07454574108123779,
0.023938722908496857,
-0.014817055314779282,
-0.018997488543391228,
-0.0032703543547540903,
0.004582698456943035,
-0.05586602911353111,
0.00020711180695798248,
-0.002851697150617838,
0.022606441751122475,
0.026920774951577187,
-0.02194170095026493,
0.0013484923401847482,
0.04770006239414215,
-0.0026485687121748924,
0.02253972552716732,
0.007740537635982037,
0.0023287811782211065,
-0.003045195946469903,
0.00236583617515862,
-0.021570123732089996,
0.00020619979477487504,
0.006669032387435436,
0.010786929167807102,
-0.018597107380628586,
-0.00810330081731081,
-0.02937537431716919,
-0.004437399562448263,
0.007986780256032944,
-0.019099902361631393,
0.0335124135017395,
0.0031711419578641653,
-0.01633034087717533,
0.0059301056899130344,
0.035782765597105026,
0.022847125306725502,
0.02424849011003971,
-0.008844787254929543,
-0.014558671042323112,
-0.02152116410434246,
-0.01351155061274767,
0.01204084511846304,
0.02425500378012657,
-0.006125611253082752,
-0.0035835420712828636,
-0.04676206037402153,
0.004891629796475172,
-0.0027550910599529743,
-0.05135220289230347,
0.02087095007300377,
0.001642117160372436,
-0.01482620369642973,
-0.038765303790569305,
-0.003655720502138138,
0.008580947294831276,
-0.008845927193760872
] |
8a7d81f9fd3f30534398ff05abd7412a6f78b709 | 4,035 | py | Python | MarkReport/MarkReport.py | dedukun/MarkReport | 2d92c87a69db5868d14b7a59e815b9ee72d439f9 | [
"MIT"
] | null | null | null | MarkReport/MarkReport.py | dedukun/MarkReport | 2d92c87a69db5868d14b7a59e815b9ee72d439f9 | [
"MIT"
] | null | null | null | MarkReport/MarkReport.py | dedukun/MarkReport | 2d92c87a69db5868d14b7a59e815b9ee72d439f9 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Command line flags
import os
import glob
import re
import pyinotify
import subprocess
from sys import stdout, stderr
from time import time, sleep
from tempfile import gettempdir
from distutils.dir_util import copy_tree
from shutil import copyfile
from weasyprint import HTML
import argparse
parser = argparse.ArgumentParser(
description='Converts Markdown to elegant PDF reports')
parser.add_argument('--basic', dest='basic', action='store_true',
help='Do not enrich HTML with LaTeX and syntax highlighting (faster builds)')
parser.add_argument('--watch', dest='watch', action='store_true',
help='Watch the current folder for changes and rebuild automatically')
parser.add_argument('--quiet', dest='quiet', action='store_true',
help='Do not output any information')
parser.add_argument("--timeout", type=int, default=2,
help='Page generation timeout')
parser.add_argument("--base-html", type=str, default="",
help='The path to the base HTML file')
parser.set_defaults(watch=False)
args = parser.parse_args()
# Check directory
ok = False
for file in os.listdir("."):
if file.endswith(".md"):
ok = True
break
if not ok:
stderr.write("No markdown file found in the current folder")
exit(1)
if args.base_html != "":
if not os.path.isfile(args.base_html):
stderr.write("The given base HTML file doesn't exist")
exit(1)
script_path = os.path.dirname(os.path.realpath(__file__))
# Temp dir
timestamp = str(int(time()))
tmp_dir = gettempdir() + "/" + timestamp + "_md-report/"
os.makedirs(tmp_dir, exist_ok=True)
# Headless browser
if not args.basic:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
options = Options()
options.headless = True
options.log.level = "trace"
d = DesiredCapabilities.FIREFOX
d['loggingPrefs'] = {'browser': 'ALL'}
driver = webdriver.Firefox(options=options, capabilities=d)
driver.set_page_load_timeout(args.timeout)
prev_compile_time = 0
def recompile(notifier):
if notifier is not None and (notifier.maskname != "IN_MODIFY" or notifier.pathname.endswith(".pdf")):
return
global prev_compile_time
if time() - prev_compile_time < 1:
return
prev_compile_time = time()
if not args.quiet:
stdout.write("\rBuilding the PDF file...")
stdout.flush()
files = glob.glob(tmp_dir + '/*.md')
for f in files:
os.remove(f)
if args.base_html == "":
copyfile(script_path + "/base.html", tmp_dir + "/base.html")
else:
copyfile(args.base_html, tmp_dir + "/base.html")
if not os.path.islink(tmp_dir + "/src"):
os.symlink(script_path + "/src", tmp_dir + "/src")
copy_tree(".", tmp_dir)
# Markdown parsing
subprocess.check_output(script_path + "/md-parsing " +
tmp_dir, shell=True).decode('utf-8')
html_file_name = tmp_dir + "output.html"
# Interpret JS code
if not args.basic:
driver.get("file:///" + html_file_name)
sleep(2)
elem = driver.find_element_by_xpath("//*")
interpreted_html = elem.get_attribute("outerHTML")
with open(html_file_name, "w") as html_out_file:
html_out_file.write(interpreted_html)
# Create final PDF file
pdf = HTML(html_file_name).write_pdf()
f = open("output.pdf", 'wb')
f.write(pdf)
if not args.quiet:
stdout.write("\rDone. ")
stdout.flush()
recompile(None)
if not args.watch:
if not args.basic:
driver.quit()
exit(0)
watch_manager = pyinotify.WatchManager()
event_notifier = pyinotify.Notifier(watch_manager, recompile)
watch_manager.add_watch(os.path.abspath("."), pyinotify.ALL_EVENTS, rec=True)
event_notifier.loop()
if not args.basic:
driver.quit()
| 27.827586 | 105 | 0.662949 | 1 | 1.9866 | [
-0.07091567665338516,
0.038079168647527695,
-0.020336829125881195,
-0.02733110636472702,
0.014973246492445469,
0.01680406555533409,
0.018993427976965904,
-0.016618601977825165,
0.00618122611194849,
0.028528884053230286,
0.02640491910278797,
0.015385085716843605,
0.041817788034677505,
-0.02006537839770317,
-0.027962226420640945,
-0.024541063234210014,
0.07356571406126022,
-0.03524148836731911,
-0.010049444623291492,
-0.0002546274336054921,
0.012378036975860596,
0.014364897273480892,
-0.01612333580851555,
0.02335713431239128,
0.05371277034282684,
-0.0013961895601823926,
0.03497827425599098,
-0.003533558454364538,
-0.008072780445218086,
0.014126081950962543,
0.013309834524989128,
0.011252873577177525,
-0.0046315863728523254,
-0.003480872604995966,
0.012641127221286297,
0.030143871903419495,
0.02139379270374775,
-0.05084175243973732,
0.040556650608778,
0.030601654201745987,
-0.022237667813897133,
-0.01807275228202343,
-0.018107153475284576,
-0.0647401511669159,
0.022488625720143318,
0.026965826749801636,
-0.015857895836234093,
-0.009931853972375393,
-0.05183098092675209,
0.018793033435940742,
-0.006594865582883358,
0.0033220667392015457,
0.03542695567011833,
-0.058793485164642334,
0.023229755461215973,
-0.038369420915842056,
-0.01994323544204235,
0.022206412628293037,
-0.021895701065659523,
-0.025514982640743256,
-0.03912055864930153,
0.025757933035492897,
0.01108521968126297,
0.04738621413707733,
0.017290983349084854,
0.012792391702532768,
-0.020377550274133682,
-0.01543350424617529,
-0.02392517775297165,
-0.015941260382533073,
-0.0010467368410900235,
-0.021589370444417,
0.00032684655161574483,
0.03060089983046055,
0.030746400356292725,
0.0027615507133305073,
-0.03867004066705704,
-0.004887408576905727,
-0.005864674225449562,
0.03966866806149483,
-0.012991979718208313,
0.051304519176483154,
0.014809670858085155,
0.03634485602378845,
0.004133583512157202,
0.05281475931406021,
0.038396600633859634,
-0.06741991639137268,
0.05578317865729332,
0.012162909843027592,
-0.014309556223452091,
0.03631057217717171,
-0.033113088458776474,
-0.024521369487047195,
-0.035873573273420334,
-0.05999277904629707,
0.0021291759330779314,
0.009119309484958649,
0.0016360911540687084,
-0.007740275468677282,
0.023431973531842232,
-0.0343775600194931,
0.05498089641332626,
-0.0384027399122715,
-0.0068183294497430325,
0.0009256674675270915,
-0.04656461253762245,
-0.003979500383138657,
0.002782415598630905,
-0.00008295646694023162,
-0.04685868322849274,
-0.021849675104022026,
0.022035306319594383,
-0.03540839999914169,
0.014771654270589352,
-0.03036893531680107,
0.03580257296562195,
-0.002308042487129569,
-0.003619313472881913,
0.020754996687173843,
0.009634989313781261,
0.009321359917521477,
0.00024118772125802934,
-0.00012318961671553552,
-0.03810681775212288,
0.07211384177207947,
0.04287591949105263,
0.018194615840911865,
0.0387384258210659,
-0.040613409131765366,
0.011234523728489876,
0.030788615345954895,
-0.006066472735255957,
-0.0007214508950710297,
-0.00039755256148055196,
-0.006838369183242321,
0.00028986731194891036,
0.008866209536790848,
-0.04957149550318718,
-0.0024567069485783577,
-0.04083181172609329,
-0.029581310227513313,
-0.006540907081216574,
0.012872530147433281,
-0.02162647806107998,
-0.0498458631336689,
-0.022252509370446205,
-0.005043983459472656,
-0.02364896610379219,
-0.008363669738173485,
0.024898076429963112,
0.00577350240200758,
0.017389541491866112,
-0.00313653820194304,
-0.035666316747665405,
-0.03621663525700569,
0.009126011282205582,
-0.06461770087480545,
-0.043685246258974075,
-0.018476584926247597,
-0.08535865694284439,
0.008120851591229439,
0.0027820293325930834,
0.02705255150794983,
0.03992115333676338,
0.03927720710635185,
-0.03814444690942764,
-0.012308253906667233,
-0.022749561816453934,
0.014513382688164711,
0.03606821596622467,
-0.007266703527420759,
-0.01958530582487583,
-0.018174827098846436,
-0.023568175733089447,
-0.03128792345523834,
0.0710059329867363,
0.004366660490632057,
-0.028071966022253036,
0.006314437370747328,
0.004027566406875849,
0.0019719386473298073,
0.012736947275698185,
0.021205704659223557,
0.009834302589297295,
0.011910506524145603,
-0.06320425122976303,
-0.030607104301452637,
-0.0059509058482944965,
0.019158368930220604,
-0.005613219458609819,
0.0054132514633238316,
-0.022449400275945663,
-0.06762122362852097,
0.036121219396591187,
-0.018537109717726707,
0.010870798490941525,
0.0061980658210814,
-0.006118460092693567,
0.002413374837487936,
0.004513216204941273,
-0.005700850859284401,
0.004411142785102129,
0.036942631006240845,
-0.025506218895316124,
0.004639712627977133,
-0.6637997627258301,
0.04246439412236214,
-0.008196273818612099,
0.010851390659809113,
0.01295051071792841,
0.039776191115379333,
-0.0562002919614315,
0.01969202607870102,
-0.011182487942278385,
0.018675625324249268,
-0.0009654314490035176,
-0.008974246680736542,
-0.004232555162161589,
-0.0248582661151886,
-0.0066780573688447475,
-0.046538081020116806,
0.015766842290759087,
0.004306056071072817,
-0.02119559794664383,
0.01616457849740982,
-0.00012372885248623788,
-0.013016097247600555,
0.018305469304323196,
0.01292900275439024,
-0.022183885797858238,
0.03229615092277527,
-0.0009231779258698225,
0.0034329562913626432,
0.0054880366660654545,
0.0056876977905631065,
0.0011578681878745556,
-0.019397689029574394,
0.022506481036543846,
-0.025844233110547066,
0.024833831936120987,
0.010191010311245918,
0.0059147910214960575,
-0.010141733102500439,
-0.00010541761002968997,
-0.020284123718738556,
-0.03170805796980858,
-0.01789768785238266,
-0.00807718001306057,
-0.04479387402534485,
-0.01625615544617176,
-0.026079433038830757,
-0.04426811262965202,
0.0009772081393748522,
0.004917950369417667,
0.009416504763066769,
-0.04462301358580589,
0.08783089369535446,
0.0192413292825222,
-0.017246611416339874,
0.016722287982702255,
0.02954750508069992,
-0.05145496129989624,
-0.003338715760037303,
-0.007886546663939953,
0.008415509946644306,
0.02534535340964794,
0.030718330293893814,
-0.022283345460891724,
0.009389272890985012,
-0.024915236979722977,
0.01916193775832653,
0.06731725484132767,
-0.007158905733376741,
-0.01265071239322424,
0.020299987867474556,
-0.0757579430937767,
-0.0007545104017481208,
-0.002913587260991335,
0.12070458382368088,
-0.0014904424315318465,
0.024466542527079582,
-0.016672251746058464,
0.0006205295794643462,
-0.030498825013637543,
-0.00022749164781998843,
0.0023284379858523607,
-0.028763383626937866,
-0.003981748130172491,
0.022860072553157806,
-0.037315238267183304,
-0.026492398232221603,
0.004716424271464348,
-0.008277139626443386,
-0.018515611067414284,
0.028933528810739517,
0.01899617537856102,
0.06382829695940018,
0.018809666857123375,
-0.023174550384283066,
0.036783963441848755,
0.00041204888839274645,
0.03916318342089653,
0.04022716358304024,
0.025234173983335495,
0.03400934115052223,
-0.0032860836945474148,
0.035142481327056885,
0.010370238684117794,
0.01755993813276291,
0.028240475803613663,
0.044197339564561844,
-0.07734885066747665,
0.0034359428100287914,
0.05424261838197708,
-0.008030504919588566,
-0.013608871959149837,
-0.0181872621178627,
-0.03141912817955017,
0.02357771061360836,
-0.029197387397289276,
-0.006138104945421219,
-0.01276389230042696,
-0.040851887315511703,
-0.013623959384858608,
-0.012336809188127518,
-0.0004700934514403343,
0.014568086713552475,
0.016285713762044907,
0.01696549914777279,
0.028471672907471657,
0.01507226750254631,
-0.016490787267684937,
0.03469042479991913,
0.036370035260915756,
-0.027170637622475624,
0.007178927306085825,
-0.06002739444375038,
-0.02218523621559143,
-0.015276484191417694,
0.003520858706906438,
-0.031037066131830215,
-0.03921452537178993,
-0.0234590582549572,
0.006732180714607239,
0.002627038396894932,
-0.03393879532814026,
-0.01978175900876522,
-0.008214500732719898,
-0.0682363510131836,
-0.005298293195664883,
0.023071687668561935,
0.013857368379831314,
0.019859516993165016,
0.025101233273744583,
0.0013076025061309338,
-0.026030799373984337,
0.022706927731633186,
-0.017953408882021904,
0.007246916648000479,
-0.001634557032957673,
-0.024156009778380394,
-0.011526109650731087,
-0.008683770895004272,
0.007787796203047037,
0.005005084443837404,
-0.02130609191954136,
0.03249816969037056,
-0.012600569054484367,
-0.001348640420474112,
0.026122473180294037,
0.005999519024044275,
-0.034647781401872635,
-0.0030109393410384655,
0.03238067403435707,
0.03216775134205818,
0.018012912943959236,
-0.02217661775648594,
0.02933061495423317,
-0.013620889745652676,
-0.011549769900739193,
-0.030359698459506035,
-0.024976644665002823,
-0.07946227490901947,
0.030809415504336357,
-0.011490272358059883,
-0.013485325500369072,
-0.00738445995375514,
-0.002637159777805209,
0.013041569851338863,
0.02779306285083294,
0.0045540956780314445,
-0.015133131295442581,
-0.007024192251265049,
0.0036736007314175367,
-0.0036700114142149687,
0.016562776640057564,
-0.0018239981727674603,
-0.007175324019044638,
0.020634207874536514,
-0.014825879596173763,
-0.051913220435380936,
-0.0040718973614275455,
-0.03343887999653816,
-0.006742800585925579,
-0.01365688256919384,
0.011275257915258408,
-0.017967162653803825,
0.007682727184146643,
0.0159738902002573,
0.00524320499971509,
0.0314776636660099,
-0.009736987762153149,
0.0033914768137037754,
0.008617314510047436,
-0.03890638425946236,
0.05550108104944229,
0.014230129308998585,
0.017712661996483803,
-0.01919838972389698,
-0.017818065360188484,
0.009480331093072891,
-0.03183458000421524,
-0.006933440919965506,
-0.020927516743540764,
-0.03286666423082352,
-0.0330449678003788,
-0.035482026636600494,
0.035558320581912994,
-0.003213200718164444,
-0.006526450160890818,
-0.033370714634656906,
-0.020882340148091316,
0.03701205924153328,
0.016614267602562904,
-0.021120142191648483,
0.021183328703045845,
-0.006296175066381693,
0.044139422476291656,
-0.05287940427660942,
-0.006641368847340345,
-0.019210385158658028,
-0.012064401991665363,
-0.008096621371805668,
-0.008941330015659332,
-0.008577669970691204,
-0.019321493804454803,
-0.03053589165210724,
-0.024440085515379906,
0.018014898523688316,
-0.04452746734023094,
-0.020665939897298813,
0.009578436613082886,
-0.019473513588309288,
-0.004940025042742491,
0.00680172722786665,
-0.022363821044564247,
0.044962190091609955,
0.001152190612629056,
-0.022029345855116844,
-0.027853718027472496,
0.047825224697589874,
-0.05785917863249779,
0.007127498276531696,
0.04751311242580414,
0.007695205509662628,
-0.011437742039561272,
-0.016489241272211075,
-0.0203605554997921,
0.021968897432088852,
-0.08389583230018616,
0.016488919034600258,
0.005082996562123299,
-0.015717720612883568,
0.007123189512640238,
0.013625120744109154,
0.012915747240185738,
-0.010324167087674141,
-0.005370344500988722,
-0.004616559483110905,
0.024977734312415123,
-0.022287476807832718,
0.016630874946713448,
0.006239898968487978,
0.020097855478525162,
0.025981485843658447,
0.022740257903933525,
-0.016298742964863777,
0.024919303134083748,
0.024916822090744972,
0.022369669750332832,
-0.0071941870264709,
0.049081139266490936,
0.03364415466785431,
-0.05952965468168259,
-0.006070270203053951,
-0.010365371592342854,
-0.016577640548348427,
0.026006022468209267,
0.012826524674892426,
-0.014297977089881897,
0.006459865253418684,
-0.0018412304343655705,
-0.008611265569925308,
0.029150785878300667,
0.025396831333637238,
0.010242361575365067,
0.016703737899661064,
0.0052405549213290215,
0.00908647570759058,
-0.0019274570513516665,
-0.003045028541237116,
0.002349043032154441,
-0.03752439096570015,
0.04065720736980438,
-0.013067963533103466,
0.011603851802647114,
0.0067383600398898125,
0.031695347279310226,
0.012498430907726288,
0.0016079350607469678,
-0.017772166058421135,
0.015350790694355965,
0.05506930500268936,
0.003697324311360717,
0.017261536791920662,
-0.015082760713994503,
0.0019062000792473555,
0.02193409390747547,
0.014360662549734116,
-0.0004724602331407368,
-0.024971967563033104,
-0.025241071358323097,
-0.021645722910761833,
-0.02502967230975628,
-0.029571935534477234,
0.010202707722783089,
-0.01904643140733242,
0.008459821343421936,
0.024838658049702644,
0.02128894440829754,
-0.026299577206373215,
0.021130375564098358,
0.011807544156908989,
0.04696959629654884,
-0.009467276744544506,
0.03183116763830185,
-0.01445772498846054,
-0.009590007364749908,
0.019733760505914688,
-0.009112405590713024,
-0.006479502189904451,
0.02625429816544056,
0.07050348818302155,
0.028503481298685074,
0.06207231059670448,
0.0036065864842385054,
-0.00176993478089571,
-0.025273427367210388,
-0.007979619316756725,
0.010253820568323135,
-0.03421461209654808,
-0.02597695030272007,
-0.002496251603588462,
0.035400912165641785,
-0.0021609680261462927,
-0.012377804145216942,
-0.029033737257122993,
-0.001077533233910799,
0.011676554568111897,
0.03364679217338562,
-0.027230842038989067,
0.039093464612960815,
-0.020615888759493828,
-0.010999170131981373,
0.0045739635825157166,
-0.045464564114809036,
0.00249609281308949,
-0.03138667345046997,
0.030541403219103813,
0.0007054691668599844,
0.046029232442379,
0.02625526301562786,
-0.03197743371129036,
-0.03489351272583008,
0.010917002335190773,
0.029204851016402245,
-0.042365364730358124,
0.04697693511843681,
-0.05470707640051842,
0.06771112978458405,
-0.017573971301317215,
0.025635868310928345,
-0.008175675757229328,
0.009480789303779602,
-0.03882473334670067,
-0.02672724798321724,
0.003430456155911088,
0.034073930233716965,
0.02790318988263607,
0.00030271237483248115,
-0.012084468267858028,
-0.04309229925274849,
-0.01269461214542389,
0.008775659836828709,
-0.006733614951372147,
-0.01096429768949747,
0.027140872552990913,
0.014580764807760715,
-0.0343109667301178,
-0.012475568801164627,
-0.01720651425421238,
0.030920930206775665,
-0.028887441381812096,
0.015243083238601685,
-0.017518455162644386,
0.007954355329275131,
-0.018581783398985863,
-0.005400416906923056,
-0.004889653529971838,
0.041425324976444244,
-0.006149456836283207,
-0.045291222631931305,
0.016438940539956093,
-0.004838176537305117,
0.013153980486094952,
-0.016043197363615036,
-0.05831495672464371,
-0.010733007453382015,
0.02376197651028633,
0.026488948613405228,
0.006307364907115698,
0.043284982442855835,
0.012786787934601307,
-0.004020134452730417,
-0.004637319594621658,
0.009448204189538956,
0.021847674623131752,
-0.04193183407187462,
-0.012847746722400188,
0.04254461079835892,
-0.028465744107961655,
-0.015562955290079117,
-0.016718067228794098,
-0.008825605735182762,
0.010933300480246544,
-0.026110146194696426,
0.008502960205078125,
0.0038262102752923965,
0.05742328613996506,
0.0008197383722290397,
0.020578371360898018,
0.03544854745268822,
0.00790329184383154,
0.03782128915190697,
-0.029222318902611732,
-0.02323092333972454,
-0.015649693086743355,
0.01598295196890831,
0.007299279328435659,
-0.025454081594944,
-0.001330968108959496,
0.05443330481648445,
0.02483866922557354,
0.013501633889973164,
-0.0022709686309099197,
0.030009306967258453,
-0.002686190651729703,
0.009230677969753742,
0.013547689653933048,
0.03130944073200226,
0.03375264257192612,
0.02026808261871338,
-0.015098937787115574,
-0.00015183378127403557,
-0.03141457960009575,
-0.002759357215836644,
0.03204679861664772,
0.0052993339486420155,
-0.006139778532087803,
-0.0020886778365820646,
-0.0009671280859038234,
0.019096428528428078,
0.021455831825733185,
0.026713116094470024,
-0.0016720880521461368,
-0.045886460691690445,
0.009925901889801025,
0.03877941146492958,
0.039784375578165054,
-0.006212256383150816,
0.005913156550377607,
-0.02550097368657589,
-0.015441825613379478,
0.010119658894836903,
-0.009586685337126255,
-0.025367939844727516,
-0.014998489059507847,
-0.04550382122397423,
0.017735494300723076,
-0.011447297409176826,
-0.015551364049315453,
0.016233814880251884,
-0.00044493767200037837,
0.022146234288811684,
0.02566111646592617,
-0.018326666206121445,
-0.024645710363984108,
-0.007313940208405256,
-0.01280886773020029,
0.04637574031949043,
0.03580152988433838,
0.029842380434274673,
-0.0033703860826790333,
-0.030661538243293762,
-0.032854609191417694,
0.007805936504155397,
-0.0005796753102913499,
-0.044498834758996964,
0.010111435316503048,
0.03220410272479057,
0.008141400292515755,
0.07232072949409485,
0.006700018420815468,
-0.004058151505887508,
0.005861175712198019,
0.03975255414843559,
0.02343355119228363,
0.01726911962032318,
0.02104867249727249,
-0.023901477456092834,
-0.04560506343841553,
-0.051621872931718826,
0.005774285644292831,
-0.001115578692406416,
-0.0012084180489182472,
-0.02138409949839115,
-0.010493723675608635,
-0.04585040733218193,
-0.003816510085016489,
0.0258647408336401,
-0.03329097852110863,
0.0047494336031377316,
0.013222543522715569,
0.00033821113174781203,
-0.002268831478431821,
0.07251739501953125,
0.02918260358273983,
-0.03045949898660183,
-0.023525914177298546,
-0.0025246392469853163,
0.006984819658100605,
0.012709463015198708,
-0.001481893239542842,
0.037855882197618484,
0.007362748496234417,
0.0001400504115736112,
-0.007451746147125959,
-0.04484293982386589,
0.023205215111374855,
-0.018108859658241272,
-0.013269943185150623,
-0.020418880507349968,
-0.04569019004702568,
-0.015795741230249405,
-0.02444491907954216,
-0.007781781256198883,
-0.001996580744162202
] |
8a7e18d0d0b30bb03c5125997bb7d29ab2737184 | 902 | py | Python | DFS/13023.py | kjh9267/BOJ_Python | b4d2ae09c252cc9280df93ccecbd07880947827e | [
"Apache-2.0"
] | null | null | null | DFS/13023.py | kjh9267/BOJ_Python | b4d2ae09c252cc9280df93ccecbd07880947827e | [
"Apache-2.0"
] | null | null | null | DFS/13023.py | kjh9267/BOJ_Python | b4d2ae09c252cc9280df93ccecbd07880947827e | [
"Apache-2.0"
] | null | null | null | # https://www.acmicpc.net/problem/13023
import sys
sys.setrecursionlimit(999999999)
def dfs_all():
is_possible = [False]
for node in range(N):
visited = [False for _ in range(N)]
dfs(node, 0, visited, is_possible)
if is_possible[0]:
return 1
return 0
def dfs(cur, depth, visited, is_possible):
if visited[cur]:
return
if depth == target_depth:
is_possible[0] = True
return
visited[cur] = True
for nxt in graph[cur]:
dfs(nxt, depth + 1, visited, is_possible)
visited[cur] = False
if __name__ == '__main__':
input = __import__('sys').stdin.readline
target_depth = 4
N, M = map(int, input().split())
graph = [list() for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
print(dfs_all())
| 19.191489 | 49 | 0.578714 | 1 | 0.9906 | [
0.004485873505473137,
0.026926659047603607,
0.00818035751581192,
-0.002043025102466345,
0.006338775157928467,
-0.0036601279862225056,
-0.01428926270455122,
0.002640488790348172,
-0.004389267414808273,
0.0004859210748691112,
-0.0008875220082700253,
0.0032738586887717247,
0.006594251375645399,
-0.017085662111639977,
0.0006594674196094275,
0.01771830953657627,
-0.054391372948884964,
0.007332243956625462,
-0.001623838092200458,
0.004682166036218405,
-0.008379774168133736,
0.007411764934659004,
0.010053948499262333,
0.0063568600453436375,
0.005635121837258339,
0.0018486565677449107,
0.009472228586673737,
0.002599993022158742,
-0.007197320461273193,
-0.006492342334240675,
-0.0034964866936206818,
-0.0027381419204175472,
-0.0044777547009289265,
-0.010025212541222572,
0.005119779612869024,
-0.004116246942430735,
0.0008974368101917207,
-0.0190656166523695,
0.01279459148645401,
-0.0058035291731357574,
-0.006163278594613075,
-0.019519278779625893,
-0.002841831650584936,
0.006061536259949207,
-0.010745173320174217,
0.0005694442661479115,
-0.004591068718582392,
0.0016942680813372135,
-0.011163533665239811,
0.005412924103438854,
-0.011037862859666348,
0.005512462463229895,
0.0133279487490654,
0.0022054200526326895,
-0.0048590488731861115,
-0.009121929295361042,
0.011733793653547764,
-0.0022282195277512074,
-0.009544423781335354,
0.0008554244413971901,
-0.0019299340201541781,
-0.0011608096538111567,
0.004644682165235281,
0.0034366485197097063,
-0.015864994376897812,
-0.00833536684513092,
-0.0035615540109574795,
0.001981245120987296,
-0.003259645076468587,
0.00380904134362936,
0.0010069652926176786,
-0.0019025454530492425,
0.007006858009845018,
0.0025969701819121838,
0.005279717035591602,
-0.004472628701478243,
-0.0033264949452131987,
-0.00013069459237158298,
0.00810475368052721,
0.0035376555752009153,
0.0022250423207879066,
-0.007807865273207426,
0.006745368707925081,
0.008731390349566936,
0.014022164978086948,
0.007151643745601177,
0.017918171361088753,
-0.010736274532973766,
0.04413217306137085,
0.008508559316396713,
-0.00792147871106863,
0.0029137616511434317,
-0.008939062245190144,
-0.004077600315213203,
-0.00021456698596011847,
-0.030661728233098984,
-0.00040200617513619363,
-0.005269057583063841,
-0.00025529443519189954,
0.003332471940666437,
0.0009129062527790666,
0.007187547627836466,
0.0018310630694031715,
-0.004710954148322344,
-0.011531302705407143,
0.012309391051530838,
-0.010029169730842113,
-0.0019610144663602114,
0.008377526886761189,
0.0016655826475471258,
-0.013553732074797153,
-0.0008834625477902591,
0.0064584338106215,
-0.01263859961181879,
0.006494517438113689,
0.0004934905446134508,
-0.008038611151278019,
0.05560896918177605,
0.00042219425085932016,
0.0014235886046662927,
-0.0045609865337610245,
-0.00029452802846208215,
0.0007164811249822378,
0.008122093044221401,
0.011335055343806744,
-0.004216762259602547,
0.010530389845371246,
0.0066656190901994705,
0.0018867215840145946,
0.0077836960554122925,
-0.0019933530129492283,
0.0094124935567379,
-0.005170390009880066,
-0.002969438908621669,
0.0027418204117566347,
-0.005858197342604399,
0.007201675325632095,
-0.0014884414849802852,
-0.005518928170204163,
0.00043765283771790564,
0.0007357128779403865,
-0.01164113637059927,
0.0031375361140817404,
-0.0031037626322358847,
0.002437448129057884,
-0.009250406175851822,
-0.003828402841463685,
-0.004389397334307432,
-0.00490224827080965,
0.0008486578008159995,
0.008383157663047314,
0.004053767770528793,
0.0026646151673048735,
-0.0039212764240801334,
-0.008619634434580803,
-0.0006031126831658185,
-0.004832521080970764,
0.0019107795087620616,
0.008355964906513691,
0.005241767968982458,
-0.01035073772072792,
-0.0025936567690223455,
0.0021271761506795883,
0.002814694307744503,
0.00168971240054816,
0.006286575924605131,
-0.009023798629641533,
0.009969833306968212,
0.00027027263422496617,
0.0030775878112763166,
0.011890844441950321,
-0.006198937073349953,
-0.0019989539869129658,
-0.0015340809477493167,
0.0021388749592006207,
-0.0002477239177096635,
0.002987185027450323,
0.012153787538409233,
-0.0039508529007434845,
-0.005786985158920288,
0.006630098447203636,
0.005567581858485937,
0.008953015320003033,
0.003224929329007864,
-0.0012652933364734054,
-0.0007143691182136536,
-0.0024488961789757013,
-0.0019356512930244207,
0.0073086475022137165,
-0.00570422550663352,
0.00513255363330245,
0.008181444369256496,
-0.015712831169366837,
-0.009382876567542553,
0.0012549608945846558,
-0.009206054732203484,
0.0008199962903745472,
0.014267543330788612,
0.011696242727339268,
-0.00008122388680931181,
0.0009291645837947726,
-0.010964760556817055,
-0.0005740919150412083,
0.009438569657504559,
0.003111214842647314,
-0.011540339328348637,
-0.9554122090339661,
0.004180050455033779,
0.004383443854749203,
-0.00021630209812428802,
0.004781135357916355,
0.0013051950372755527,
0.003276301547884941,
0.004924430977553129,
0.012640915811061859,
-0.011140252463519573,
-0.007990133948624134,
-0.011799318715929985,
-0.011629125103354454,
0.00022957019973546267,
-0.0034395018592476845,
-0.00479175103828311,
-0.00638616131618619,
-0.008146928623318672,
-0.004817353095859289,
-0.002941778628155589,
-0.0009191688150167465,
0.01039042416960001,
0.0010935374302789569,
0.002983152400702238,
0.004273881204426289,
0.004122663289308548,
-0.005471068434417248,
-0.00389818730764091,
-0.0016886444063857198,
-0.0024667109828442335,
-0.006999936420470476,
-0.014858230948448181,
-0.006089863367378712,
0.001353655126877129,
0.010950875468552113,
-0.001177252852357924,
0.009782887063920498,
-0.0018116221763193607,
-0.0021396002266556025,
-0.009080984629690647,
0.006484144367277622,
-0.00039259163895621896,
0.004288701806217432,
-0.02880583144724369,
-0.002019053790718317,
-0.0012653667945414782,
-0.008702723309397697,
0.0074942088685929775,
0.0008277990273199975,
-0.001164955203421414,
-0.0038767484948039055,
-0.004828821402043104,
0.009367188438773155,
-0.00819533783942461,
0.004864112474024296,
-0.00165106903295964,
-0.0063012707978487015,
-0.0023042000830173492,
-0.00781492330133915,
0.0025361008010804653,
0.003025851910933852,
-0.003563416190445423,
-0.004749485291540623,
-0.004390344023704529,
0.003295412054285407,
0.0007881000638008118,
0.005151018500328064,
-0.01996154896914959,
-0.005397382192313671,
0.0006777310045436025,
0.00191869109403342,
0.0003181385400239378,
-0.005473719909787178,
0.002588182222098112,
-0.008897501043975353,
0.006824436131864786,
0.00251219654455781,
-0.001604250050149858,
-0.014361079782247543,
-0.0003125691437162459,
-0.010306029580533504,
-0.009535041637718678,
0.004285885486751795,
-0.005539665464311838,
-0.003987081814557314,
-0.00043356677633710206,
0.003715397324413061,
0.007694466970860958,
-0.0053983526304364204,
0.004002381581813097,
0.013272684067487717,
-0.0016619969392195344,
-0.010533548891544342,
0.006347074639052153,
0.006846711505204439,
0.002233925275504589,
-0.0027821853291243315,
0.002808509860187769,
0.008928388357162476,
0.00685731228441,
-0.0020350771956145763,
0.005278241820633411,
0.0028913673013448715,
0.010237351059913635,
0.0006442802841775119,
0.0010744971223175526,
-0.0035207592882215977,
0.001338025787845254,
-0.005526088643819094,
0.0019877455197274685,
-0.004385128151625395,
-0.003617946757003665,
-0.01133081503212452,
-0.009764480404555798,
-0.0028644141275435686,
0.002938218181952834,
0.0014420861843973398,
-0.003953395411372185,
0.0006534173153340816,
0.0005839768564328551,
0.007780096493661404,
-0.0027958645951002836,
-0.007572428323328495,
0.0016428438248112798,
0.0046829055063426495,
-0.006617936305701733,
0.013585452921688557,
-0.012427865527570248,
0.007505904883146286,
-0.00018827572057489306,
-0.01342212688177824,
0.00672318646684289,
0.011657154187560081,
-0.008099311031401157,
0.0027366173453629017,
0.0005003116093575954,
0.006276183295994997,
-0.0016007520025596023,
-0.006861113477498293,
-0.0032815025188028812,
-0.01867521181702614,
0.0019625495187938213,
0.020837249234318733,
0.001831530244089663,
0.012309860438108444,
0.012785517610609531,
-0.006265067961066961,
0.004105125553905964,
0.006010531913489103,
0.00020087302254978567,
0.014300350099802017,
-0.007088088896125555,
-0.0006405355525203049,
0.0024968311190605164,
-0.008721256628632545,
0.0015776115469634533,
0.004178693052381277,
0.00177319988142699,
-0.004763728007674217,
0.004320670384913683,
-0.0062792119570076466,
-0.0036187833175063133,
-0.017134113237261772,
-0.0001447677204851061,
0.009603554382920265,
-0.003477801801636815,
0.005160225089639425,
-0.013440102338790894,
0.007581384386867285,
0.006763951852917671,
0.005850881338119507,
-0.0007122015813365579,
0.0016657697269693017,
0.004250641912221909,
0.011037362739443779,
-0.009542628191411495,
0.0034003404434770346,
0.004626598674803972,
-0.0031711291521787643,
0.0018458698177710176,
0.00537272822111845,
-0.008031148463487625,
-0.004114698152989149,
0.0026331250555813313,
0.0046337563544511795,
-0.0007686536991968751,
-0.0024778663646429777,
-0.006749918684363365,
-0.004207908175885677,
0.0018685981631278992,
-0.007729214616119862,
0.00384614453651011,
0.001868892926722765,
0.004009325988590717,
-0.0068487427197396755,
-0.00041274691466242075,
-0.0030106729827821255,
-0.012462718412280083,
0.012616795487701893,
-0.0034895085263997316,
0.002800402697175741,
0.012392529286444187,
0.004131566267460585,
-0.012851472944021225,
0.005377731751650572,
0.012365075759589672,
-0.0034091470297425985,
0.002948538865894079,
0.009129298850893974,
-0.006165478844195604,
-0.024613644927740097,
-0.00021456819376908243,
-0.013962394557893276,
0.006683029234409332,
-0.004067320842295885,
0.0009149773977696896,
-0.009341847151517868,
0.006639265455305576,
0.0019149899017065763,
-0.011405977420508862,
-0.007416258566081524,
-0.007551535032689571,
0.008697772398591042,
0.0006277522770687938,
-0.0024212978314608335,
-0.0025401529856026173,
-0.0026054957415908575,
-0.001382349757477641,
-0.001998571213334799,
-0.001660945825278759,
0.004823120776563883,
0.005532515700906515,
-0.0019976242911070585,
0.0037354070227593184,
-0.004077988211065531,
0.0009547385270707309,
0.0005177224520593882,
-0.012082882225513458,
0.0022432859987020493,
0.005419677123427391,
-0.002225220436230302,
-0.0024366318248212337,
-0.0007844379870221019,
-0.0024248668923974037,
-0.005699553061276674,
-0.011780052445828915,
-0.007065677549690008,
-0.0028824168257415295,
-0.005490915849804878,
-0.01213150192052126,
-0.0016525447135791183,
-0.005727585405111313,
0.008670922368764877,
-0.007635394111275673,
0.008184402249753475,
0.00603483384475112,
-0.00435811560600996,
0.00855481531471014,
-0.0019658352248370647,
0.005402207374572754,
-0.001189776579849422,
0.006337129510939121,
0.0017928455490618944,
-0.006012319587171078,
-0.011547703295946121,
0.009957804344594479,
-0.010049675591289997,
0.00006689198926324025,
0.014954065904021263,
0.006666993722319603,
0.011230644769966602,
0.001962995855137706,
0.0007591245230287313,
0.005595577880740166,
0.008826131001114845,
-0.014035144820809364,
0.003292675828561187,
-0.002129238098859787,
-0.0018818468088284135,
0.002869170159101486,
-0.004752755630761385,
-0.00034221206442452967,
0.00870970543473959,
0.0031506819650530815,
-0.005984425079077482,
-0.0033803328406065702,
0.0020568626932799816,
0.0023087048903107643,
-0.011984188109636307,
-0.002404823200777173,
-0.004972483497112989,
-0.004593292251229286,
-0.002996311755850911,
0.0005834430339746177,
-0.0003273041802458465,
0.0022353942040354013,
-0.0010351344244554639,
0.0061911968514323235,
0.005254443734884262,
-0.004499615170061588,
0.0140764769166708,
-0.0038916843477636576,
-0.0015531659591943026,
0.0036442962009459734,
0.002042194828391075,
-0.0007910504937171936,
-0.0026646743062883615,
-0.0014447037829086185,
0.0022932589054107666,
0.004264052025973797,
-0.0029286332428455353,
-0.004097507335245609,
-0.003808683482930064,
-0.00022122380323708057,
-0.013001528568565845,
0.0013448274694383144,
0.01174247171729803,
-0.005283065140247345,
0.004406774416565895,
0.00003119596658507362,
-0.007631087675690651,
-0.01563733071088791,
0.055465370416641235,
-0.0005073334323242307,
0.004459587391465902,
0.005302013363689184,
-0.009066314436495304,
0.0003070717793889344,
-0.0034616754855960608,
0.0068626562133431435,
-0.0054068355821073055,
-0.006694907322525978,
0.008711039088666439,
-0.005496245343238115,
0.0025864040944725275,
0.0043940371833741665,
-0.0003246731066610664,
0.017825718969106674,
-0.004751311149448156,
-0.017705077305436134,
-0.01487935520708561,
0.007416251581162214,
-0.0021396672818809748,
-0.005737293977290392,
0.008658228442072868,
-0.002185934456065297,
-0.0009484468610025942,
0.0018094269325956702,
0.006080991122871637,
0.0015781993279233575,
0.0015906060580164194,
-0.0017359447665512562,
-0.0025242615956813097,
-0.00023303435591515154,
0.0035659512504935265,
0.004917940124869347,
0.007169477175921202,
-0.002545818919315934,
0.005223548971116543,
-0.00003869968350045383,
-0.002089274348691106,
0.0007295108516700566,
0.004710459616035223,
0.008772329427301884,
-0.0015870133647695184,
-0.0025416298303753138,
0.004726634826511145,
0.00611738720908761,
0.0019591974560171366,
0.012124703265726566,
-0.0010920979548245668,
-0.007254843600094318,
0.011096369475126266,
0.005949337501078844,
-0.0007966140401549637,
0.0101864542812109,
-0.0009807540336623788,
0.0051498557440936565,
0.0016268253093585372,
-0.010045819915831089,
-0.013854242861270905,
-0.0018885034369304776,
0.00775386905297637,
0.011846188455820084,
-0.0018436210229992867,
0.0008129544439725578,
-0.0011050768662244081,
-0.003070987295359373,
-0.0088869109749794,
-0.005311520304530859,
-0.0031794928945600986,
0.001959375338628888,
0.0040201181545853615,
0.07300107926130295,
-0.006441119126975536,
-0.0019842081237584352,
-0.009164602495729923,
-0.0014073222409933805,
-0.002495325868949294,
0.00037275056820362806,
-0.0013979596551507711,
0.0013981880620121956,
0.004213462583720684,
0.0007259651902131736,
-0.009237600490450859,
-0.008121337741613388,
0.0024880196433514357,
0.002299949759617448,
-0.0034198183566331863,
0.006916661746799946,
0.005342838354408741,
-0.004628248047083616,
0.0015123073244467378,
-0.01436274591833353,
-0.0026065425481647253,
-0.0028504696674644947,
-0.009347404353320599,
-0.0018745389534160495,
-0.0012636544415727258,
0.0011753382859751582,
0.0017103237332776189,
0.003008838277310133,
-0.006171640940010548,
0.005226633977144957,
-0.002854076214134693,
0.0008271593833342195,
-0.0034748613834381104,
-0.0008268998935818672,
-0.005738705396652222,
0.008739427663385868,
0.0004254160448908806,
-0.013271608389914036,
-0.007550712674856186,
-0.001662709633819759,
-0.001280673430301249,
-0.005323744844645262,
0.00480297114700079,
-0.001719429506920278,
0.006795041728764772,
-0.003288041101768613,
0.002521434100344777,
-0.0061734686605632305,
-0.0005261281039565802,
-0.012554123066365719,
0.005501213017851114,
-0.18099232017993927,
0.010422132909297943,
0.002194252097979188,
-0.00327862286940217,
-0.00235697440803051,
-0.015730153769254684,
-0.006683969404548407,
0.00299716810695827,
0.00925124529749155,
0.00015854671073611826,
-0.000339119607815519,
-0.0036829952150583267,
0.007552080322057009,
0.0027165370993316174,
-0.0018222788348793983,
-0.00544432969763875,
0.006409991066902876,
-0.004062190651893616,
0.002228079130873084,
0.004542939364910126,
0.007291683927178383,
0.007745308335870504,
0.0028139562346041203,
0.005148611962795258,
-0.0034941022749990225,
-0.005460945423692465,
0.003776813391596079,
-0.001468000584281981,
0.006236406043171883,
-0.011458846740424633,
-0.003387226490303874,
-0.004727853927761316,
-0.003755067242309451,
0.002316164318472147,
0.006705365609377623,
-0.002594896825030446,
0.008410867303609848,
0.0007092741434462368,
-0.006673380732536316,
0.007796583231538534,
-0.010023504495620728,
0.03150353953242302,
0.0026158594992011786,
0.00892650242894888,
0.0009360144031234086,
-0.004640216939151287,
-0.004098746459931135,
0.008085772395133972,
-0.0004091821319889277,
0.008303981274366379,
-0.014151831157505512,
-0.002213212428614497,
0.0025719651021063328,
0.017694268375635147,
-0.00330646731890738,
-0.008792496286332607,
-0.006625442299991846,
-0.004955126903951168,
0.0021450351923704147,
0.010074594058096409,
0.010732445865869522,
-0.00562177924439311,
0.006894937250763178,
-0.003508621593937278,
-0.02344084158539772,
0.0022631322499364614,
-0.005514880176633596,
-0.010518662631511688,
0.0019915387965738773,
0.00787944532930851,
0.011494186706840992,
-0.0016198873054236174,
0.005831489805132151,
0.0004504936223383993,
0.00422475254163146,
-0.001413665828295052,
0.004466361831873655,
-0.0022017930168658495,
0.006442647892981768,
-0.009513309225440025,
0.005810319911688566,
-0.010429915972054005,
-0.003222964471206069,
0.0013945666141808033,
-0.005146812181919813,
0.01012779027223587,
0.004406358581036329,
-0.0007365014171227813,
-0.0004089565481990576,
-0.008713297545909882,
-0.0060500046238303185,
0.0008506900048814714,
0.0029333464335650206,
-0.008529696613550186,
0.0009794142097234726,
-0.002934170886874199,
0.005509877577424049,
0.009685221128165722,
-0.010614949278533459,
0.005984858609735966,
0.006702773738652468,
-0.007047878112643957,
0.001074016559869051,
-0.0011591319926083088,
0.00004384212297736667,
0.0043710689060389996,
-0.004149469546973705,
-0.007064135745167732,
0.005038700997829437,
-0.007114913780242205,
-0.004215384367853403,
0.006637989543378353,
-0.008863122202455997,
-0.008169334381818771,
-0.00036989367799833417,
-0.011807422153651714,
0.0016985958209261298
] |
8a7ecd71a92cf19cd5b6422ac30a671d4195653c | 1,358 | py | Python | experiments/bst/setup.py | bigchaindb/privacy-protocols | d220f642c7c056e5ec179b47a8d0863dbc373d9d | [
"CC-BY-4.0"
] | 68 | 2017-08-02T14:22:59.000Z | 2022-02-19T05:27:42.000Z | experiments/bst/setup.py | bigchaindb/privacy-protocols | d220f642c7c056e5ec179b47a8d0863dbc373d9d | [
"CC-BY-4.0"
] | 6 | 2017-08-05T18:30:14.000Z | 2017-08-22T19:54:53.000Z | experiments/bst/setup.py | bigchaindb/privacy-protocols | d220f642c7c056e5ec179b47a8d0863dbc373d9d | [
"CC-BY-4.0"
] | 15 | 2017-08-22T16:04:26.000Z | 2022-03-13T10:36:02.000Z | """bst: BigchainDB Sharing Tools"""
from setuptools import setup, find_packages
install_requires = [
'base58~=0.2.2',
'PyNaCl~=1.1.0',
'bigchaindb-driver',
'click==6.7',
'colorama',
]
setup(
name='bst',
version='0.1.0',
description='bst: BigchainDB Sharing Tools',
long_description=(
'A collection of scripts with different patterns to share'
'private data on BigchainDB.'),
url='https://github.com/vrde/bst/',
author='Alberto Granzotto',
author_email='alberto@bigchaindb.com',
license='AGPLv3',
zip_safe=False,
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Database',
'Topic :: Database :: Database Engines/Servers',
'Topic :: Software Development',
'Natural Language :: English',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
],
packages=find_packages(),
entry_points={
'console_scripts': [
'bst=bst.cli:main'
],
},
install_requires=install_requires
)
| 26.115385 | 74 | 0.594993 | 1 | 1.1076 | [
-0.00062571931630373,
0.02300972491502762,
0.007715301122516394,
-0.0011919065145775676,
0.0039945500902831554,
-0.0031184121035039425,
-0.010138425976037979,
0.004259468521922827,
-0.008105979301035404,
0.00329055218026042,
0.003257532138377428,
0.0064908103086054325,
0.006818095687776804,
-0.018520938232541084,
0.002102533122524619,
0.016735399141907692,
-0.05383295938372612,
0.001276936149224639,
-0.003431381192058325,
0.002247861586511135,
-0.008742486126720905,
0.010455039329826832,
0.008325695991516113,
0.008784525096416473,
0.0075864046812057495,
-0.0014851344749331474,
0.009842164814472198,
0.002422966528683901,
-0.009123247116804123,
-0.0065419538877904415,
-0.0007028465042822063,
-0.00341544346883893,
-0.007803964428603649,
-0.009081127122044563,
0.00952844973653555,
-0.002268529264256358,
-0.0009128961246460676,
-0.019572950899600983,
0.011983727104961872,
-0.0030931925866752863,
-0.007099358830600977,
-0.017459247261285782,
0.0011547170579433441,
0.0036683697253465652,
-0.008364871144294739,
0.0026240325532853603,
-0.004678583703935146,
0.0037795996759086847,
-0.008636696264147758,
0.005372554529458284,
-0.010635461658239365,
0.006948361173272133,
0.013446525670588017,
0.003455299884080887,
-0.004802571143954992,
-0.006605172995477915,
0.011771031655371189,
0.0010025915689766407,
-0.010913746431469917,
0.0005729505210183561,
-0.0017179754795506597,
-0.0027463326696306467,
0.006272454280406237,
0.0040372260846197605,
-0.017239222303032875,
-0.007957525551319122,
-0.004302810411900282,
0.0028607386630028486,
-0.0011872377945110202,
0.003587869694456458,
0.00012378671090118587,
-0.0007826377404853702,
0.007694684434682131,
0.0029343010392040014,
0.005210039671510458,
-0.0035663312301039696,
-0.00022340456780511886,
0.0014029530575498939,
0.010213416069746017,
0.005076185334473848,
0.00576767697930336,
-0.006665070075541735,
0.007055072113871574,
0.010574939660727978,
0.014668164774775505,
0.006879325024783611,
0.018967382609844208,
-0.011725586839020252,
0.0470573827624321,
0.0049929008819162846,
-0.011765963397920132,
0.0008763986988924444,
-0.008497078903019428,
-0.0012850837083533406,
-0.0011152103543281555,
-0.028631968423724174,
0.001741988118737936,
-0.0037637236528098583,
0.0005436855717562139,
0.0020415245089679956,
-0.0005627220380119979,
0.005936569534242153,
-0.0012956910068169236,
-0.0025058272294700146,
-0.010065842419862747,
0.012199717573821545,
-0.009185993112623692,
-0.002518384950235486,
0.0071030305698513985,
0.0017859423533082008,
-0.008739897049963474,
-0.0014670006930828094,
0.001898512477055192,
-0.013821312226355076,
0.0043631731532514095,
0.0032557223457843065,
-0.006221138872206211,
0.05564595386385918,
-0.0020023146644234657,
0.0032308916561305523,
-0.0057281507179141045,
0.0015174676664173603,
-0.0006185048841871321,
0.008127621375024319,
0.006377986632287502,
-0.004007712472230196,
0.012228253297507763,
0.007989805191755295,
0.002055669669061899,
0.009706764481961727,
-0.00036688600084744394,
0.0070610661059618,
-0.005510192830115557,
-0.0023343495558947325,
0.00041739316657185555,
-0.00794206839054823,
0.007717821281403303,
-0.001527057378552854,
-0.00785793736577034,
0.001556175877340138,
0.00022950225684326142,
-0.011025020852684975,
0.002620765706524253,
-0.002066384768113494,
0.0008404183899983764,
-0.011401909403502941,
-0.005114145111292601,
-0.0022225400898605585,
-0.003547374624758959,
0.0030272393487393856,
0.009666419588029385,
0.004837644286453724,
0.0028269365429878235,
-0.004377252422273159,
-0.00868086889386177,
-0.0007080162176862359,
-0.0024445021990686655,
0.0029718547593802214,
0.006320601794868708,
0.003546365536749363,
-0.009573155082762241,
-0.001240692101418972,
0.004079706035554409,
0.004550902638584375,
-0.0014460103120654821,
0.002274770988151431,
-0.008148745633661747,
0.008661670610308647,
0.0006767876911908388,
0.004652117379009724,
0.011218475177884102,
-0.004580860026180744,
-0.0010225707665085793,
0.0015446223551407456,
0.0033257384784519672,
0.0010070150019600987,
0.006463751196861267,
0.010431102477014065,
-0.0023393449373543262,
-0.0037697318475693464,
0.003314088098704815,
0.005512996576726437,
0.007121060974895954,
0.007763287518173456,
-0.0022625161800533533,
0.0033435693476349115,
-0.004972975701093674,
-0.0007296418189071119,
0.004534151870757341,
-0.005474431905895472,
0.005965014919638634,
0.003526245942339301,
-0.014535305090248585,
-0.007484618108719587,
0.0004180799296591431,
-0.010220370255410671,
0.0010976034682244062,
0.015120318159461021,
0.01158688124269247,
-0.0036856059450656176,
0.005142041947692633,
-0.00926712155342102,
0.0005781578947789967,
0.006907061208039522,
0.001235844800248742,
-0.014698632061481476,
-0.9570441842079163,
0.006525577045977116,
0.0014028261648491025,
-0.0005998607375659049,
0.004734675865620375,
0.0014145747991278768,
0.0015398218529298902,
0.004065730143338442,
0.011667618528008461,
-0.008540765382349491,
-0.006666053086519241,
-0.009211870841681957,
-0.010124423541128635,
-0.0014450965682044625,
-0.008587905205786228,
-0.0026895722839981318,
-0.005976155400276184,
-0.006547621916979551,
-0.0019348557107150555,
-0.0057383147068321705,
-0.0026630789507180452,
0.009637531824409962,
-0.000492626684717834,
0.004859367851167917,
0.004949474241584539,
0.0035285954363644123,
-0.005352654028683901,
-0.0009904063772410154,
-0.0011131021892651916,
-0.0031329612247645855,
-0.007202042266726494,
-0.01570209115743637,
-0.006024566013365984,
-0.00046413595555350184,
0.011339795775711536,
0.0013840623432770371,
0.0089832479134202,
-0.00045510902418754995,
0.0019075415330007672,
-0.00636002654209733,
0.005462299566715956,
0.0008004754781723022,
0.0037006521597504616,
-0.029920531436800957,
0.0009581733611412346,
-0.0024722705129534006,
-0.010180294513702393,
0.008780095726251602,
0.0014608161291107535,
-0.004069234244525433,
-0.004076672252267599,
-0.006027188617736101,
0.008876174688339233,
-0.008044494315981865,
0.00522758299484849,
-0.003974063787609339,
-0.0066834683530032635,
-0.0021358763333410025,
-0.008858338929712772,
0.0012666905531659722,
0.005441160406917334,
-0.0023794935550540686,
-0.004996804986149073,
-0.001833327696658671,
0.001216379227116704,
0.0032257218845188618,
0.0021020558197051287,
-0.019109422340989113,
-0.0064944857731461525,
-0.0016143468674272299,
0.005916663911193609,
-0.0050010159611701965,
-0.004006553441286087,
0.0060366238467395306,
-0.009138938039541245,
0.006425965111702681,
0.003164632711559534,
0.0009705477277748287,
-0.010784907266497612,
0.002613503485918045,
-0.009059823118150234,
-0.008800823241472244,
0.0016324061434715986,
-0.006205517798662186,
-0.0049043502658605576,
-0.0010676882229745388,
-0.0004062312364112586,
0.006645501591265202,
-0.0049841925501823425,
0.0034699784591794014,
0.011453518643975258,
-0.005953915882855654,
-0.008393634110689163,
0.007639539428055286,
0.006879972293972969,
0.0006881627487018704,
-0.0024222058709710836,
0.0033281370997428894,
0.010028093121945858,
0.006870117969810963,
0.004328100010752678,
0.004804128780961037,
-0.0009038974530994892,
0.00881409551948309,
-0.00017263818881474435,
0.0030301131773740053,
-0.004256473854184151,
-0.002017322462052107,
-0.004337795078754425,
-0.00005131789657752961,
-0.0008399919606745243,
-0.0019638454541563988,
-0.011647063307464123,
-0.010013360530138016,
-0.001891433377750218,
-0.00021637350437231362,
0.0003615268797148019,
-0.0039270487613976,
0.00019732477085199207,
0.003034170949831605,
0.009355347603559494,
-0.0020675319246947765,
-0.0035307949874550104,
-0.0003734916972462088,
0.0018592827254906297,
-0.0069479807280004025,
0.014093576930463314,
-0.011624190956354141,
0.006379337981343269,
0.0002313993900315836,
-0.016791416332125664,
0.006889720447361469,
0.008393676951527596,
-0.00879779551178217,
0.001013473724015057,
0.003569579217582941,
0.0035591700579971075,
-0.00023870824952609837,
-0.004341568797826767,
-0.0032446098048239946,
-0.015738941729068756,
-2.6262009100719297e-7,
0.020671257749199867,
0.001522603677585721,
0.009415321983397007,
0.012382905930280685,
-0.0041079833172261715,
0.00169957778416574,
0.0066999830305576324,
0.0002547758922446519,
0.011984762735664845,
-0.010400250554084778,
-0.0005215759738348424,
0.002284810645505786,
-0.00512052234262228,
0.001071776496246457,
0.0058459085412323475,
0.00470561720430851,
-0.0031900827307254076,
0.00013148566358722746,
-0.008101103827357292,
-0.005618749652057886,
-0.017150836065411568,
-0.0021248627454042435,
0.008326742798089981,
-0.005636544898152351,
0.005793520249426365,
-0.010643398389220238,
0.006086110137403011,
0.006225330755114555,
0.0025651135947555304,
-0.00010363076580688357,
0.00011807838745880872,
0.007061113137751818,
0.011318130418658257,
-0.006393586751073599,
0.0020081077236682177,
0.002120289485901594,
-0.002672204514965415,
0.0021978644654154778,
0.006838703993707895,
-0.009403017349541187,
-0.005161242093890905,
0.0024737482890486717,
0.004730221815407276,
-0.00030534443794749677,
-0.0046727294102311134,
-0.007369379512965679,
-0.0037839142605662346,
0.002914668992161751,
-0.007237392943352461,
0.005402177572250366,
0.001780173508450389,
0.004780742339789867,
-0.008292763493955135,
0.001143845496699214,
-0.003960979636758566,
-0.011335795745253563,
0.011021405458450317,
-0.00270913727581501,
0.0010890974663197994,
0.010916344821453094,
0.00434908689931035,
-0.01536281406879425,
0.006251920014619827,
0.008557607419788837,
-0.0051635694690048695,
0.003132724901661277,
0.007018042728304863,
-0.005436250474303961,
-0.021458392962813377,
-0.00005444273483590223,
-0.012990121729671955,
0.005921120755374432,
-0.0038715898990631104,
0.0026270647067576647,
-0.007530565839260817,
0.0059341308660805225,
0.006752551067620516,
-0.01293657161295414,
-0.00452666450291872,
-0.008735746145248413,
0.008677458390593529,
-0.0009515011333860457,
-0.0012950680684298277,
-0.003817212302237749,
-0.0021569402888417244,
-0.0037586528342217207,
-0.0018589288229122758,
-0.002185937948524952,
0.005178419407457113,
0.0022858346346765757,
-0.0040213568136096,
0.0005773761076852679,
-0.003001987934112549,
-0.0013073669979348779,
0.00036930557689629495,
-0.010998853482306004,
0.003420206718146801,
0.005378774832934141,
-0.003200081642717123,
-0.004704013001173735,
0.0008615183760412037,
-0.0022683413699269295,
-0.004943740088492632,
-0.00927751325070858,
-0.002260258188471198,
-0.003550358349457383,
-0.0018697723280638456,
-0.011142997071146965,
-0.0014111179625615478,
-0.011080551892518997,
0.005076428409665823,
-0.006609789561480284,
0.007922692224383354,
0.0036979778669774532,
-0.006175088230520487,
0.00594796659424901,
-0.002980731660500169,
0.0037203140091151,
0.005159210413694382,
0.008437896147370338,
-0.0008218610309995711,
-0.007939712144434452,
-0.010633724741637707,
0.012222738936543465,
-0.008878881111741066,
0.0026592824142426252,
0.014325357042253017,
0.0037499843165278435,
0.009913063608109951,
0.001154436613433063,
0.0002684368519112468,
0.004832967184484005,
0.009023997001349926,
-0.009659973904490471,
0.0030348733998835087,
-0.0033230117987841368,
-0.0004364752967376262,
0.006451976485550404,
-0.004518400877714157,
0.004125846084207296,
0.00984594039618969,
0.0008240313618443906,
-0.008403648622334003,
-0.002683765720576048,
0.0005295898881740868,
0.0043289680033922195,
-0.011301928199827671,
0.0028704009018838406,
-0.004727142862975597,
-0.006358242128044367,
-0.0030903893057256937,
-0.00201970711350441,
-0.0012680813670158386,
0.004696901887655258,
-0.0021587787196040154,
0.007533826399594545,
0.0010774601250886917,
-0.0033269452396780252,
0.013864223845303059,
-0.009387324564158916,
-0.006956550758332014,
0.0032845623791217804,
0.0001767282810760662,
-0.0024336844217032194,
-0.006732923910021782,
-0.0033922644797712564,
0.0017501205438748002,
0.0054730637930333614,
-0.0021545076742768288,
-0.005150312557816505,
-0.0011303011560812593,
0.0018206870881840587,
-0.007422512397170067,
0.000632146024145186,
0.012023926712572575,
-0.00214958842843771,
0.00518867326900363,
-0.00037979678018018603,
-0.005931575782597065,
-0.013079140335321426,
0.054709743708372116,
-0.0002475524670444429,
0.005122815258800983,
0.005122415721416473,
-0.006629212759435177,
0.00023701069585513324,
-0.0030946501065045595,
0.006272904574871063,
-0.008922955952584743,
-0.008212851360440254,
0.009923117235302925,
-0.0028094276785850525,
0.00331934099085629,
0.0004890718264505267,
-0.0013783458853140473,
0.014936049468815327,
-0.004317096434533596,
-0.015884660184383392,
-0.01526733860373497,
0.006129822693765163,
-0.00403881398960948,
-0.007938256487250328,
0.008030153810977936,
-0.002879357198253274,
-0.002093505347147584,
0.0008763039368204772,
0.004024354740977287,
0.00020940594549756497,
-0.0007552860770374537,
-0.005376202519983053,
-0.0012152377748861909,
0.00006253668834688142,
0.003184493165463209,
0.008296625688672066,
0.007962265983223915,
-0.0037533817812800407,
0.004040197469294071,
-0.0024853500071913004,
-0.0005765489768236876,
-0.0017411933513358235,
0.00600541802123189,
0.007033209782093763,
-0.0012853719526901841,
0.0002765242534223944,
0.005603432655334473,
0.0020890156738460064,
0.0006042774184606969,
0.010583792813122272,
-0.0007100495276972651,
-0.0047871144488453865,
0.007655986584722996,
0.005303346551954746,
-0.0016290171770378947,
0.005669566802680492,
-0.0014923966955393553,
0.0066395229659974575,
0.003223828971385956,
-0.006793145090341568,
-0.01639341004192829,
-0.0033683893270790577,
0.005967161618173122,
0.007485978305339813,
-0.0007736809202469885,
0.0029362477362155914,
-0.0020797683391720057,
-0.00230539683252573,
-0.007517004385590553,
-0.00685115298256278,
-0.002733951434493065,
-0.00017106515588238835,
0.0015134538989514112,
0.07073695957660675,
-0.005551846232265234,
-0.0017228000797331333,
-0.007881738245487213,
-0.0012741581303998828,
-0.0029027345590293407,
-0.0017309122486039996,
-0.0003486363566480577,
-0.0014073040802031755,
0.001204854343086481,
0.0029187574982643127,
-0.005544415675103664,
-0.009094752371311188,
0.0028034020215272903,
0.0018515144474804401,
-0.0017530381446704268,
0.0060757542960345745,
0.006294835824519396,
-0.009299591183662415,
0.0023030873853713274,
-0.011051850393414497,
-0.0030837415251880884,
-0.002987626474350691,
-0.008729764260351658,
-0.002053084783256054,
-0.002595659578219056,
0.003499506274238229,
0.002969857072457671,
0.007767064962536097,
-0.0014783760998398066,
0.004689070396125317,
-0.0017065299907699227,
0.00009520920866634697,
-0.0036249374970793724,
0.00007046791142784059,
-0.005766494199633598,
0.0082582738250494,
0.00031837992719374597,
-0.009276960976421833,
-0.005227953661233187,
-0.0029155616648495197,
-0.0008705337531864643,
-0.005920149385929108,
0.004682765807956457,
0.00023833138402551413,
0.0057727438397705555,
-0.0018805989529937506,
0.0012886901386082172,
-0.006871707737445831,
0.002410949906334281,
-0.012163142673671246,
0.004376590251922607,
-0.18030405044555664,
0.010367196053266525,
0.004592541605234146,
-0.005420090164989233,
-0.0053178309462964535,
-0.01431186031550169,
-0.008829369209706783,
0.0033528420608490705,
0.011007771827280521,
0.002368250163272023,
0.00026983022689819336,
-0.0010098214261233807,
0.0041933003813028336,
0.004833584185689688,
0.0007157478830777109,
-0.005228154361248016,
0.003539613215252757,
-0.006017670035362244,
0.0013547828420996666,
0.002798905596137047,
0.005376544781029224,
0.009251046925783157,
0.003541208803653717,
0.0026100524701178074,
-0.0011977074900642037,
-0.005255942232906818,
0.005640984047204256,
-0.0018282673554494977,
0.006360174622386694,
-0.011685065925121307,
-0.004133722744882107,
-0.003383068600669503,
-0.00464773690328002,
-0.00010983968968503177,
0.003463460598140955,
-0.0019360724836587906,
0.007380776572972536,
0.0020217993296682835,
-0.008787441067397594,
0.007759082596749067,
-0.006960920989513397,
0.026845384389162064,
0.002637015888467431,
0.007887124083936214,
0.0008739799377508461,
-0.0038674217648804188,
-0.004193087108433247,
0.009369374252855778,
0.0032884690444916487,
0.013870391994714737,
-0.013380064629018307,
-0.004281580913811922,
0.002202653558924794,
0.018379367887973785,
-0.0038116697687655687,
-0.008685248903930187,
-0.0067075700499117374,
-0.003325502621009946,
0.003455388592556119,
0.009231398813426495,
0.009036727249622345,
-0.0042560407891869545,
0.008060348220169544,
-0.0039032672066241503,
-0.021450186148285866,
0.003866175888106227,
-0.0032838687766343355,
-0.006438172422349453,
0.002291780663654208,
0.00837671384215355,
0.011048007756471634,
-0.00032064071274362504,
0.002877370920032263,
-0.0023488043807446957,
0.0037918975576758385,
-0.0009373450302518904,
0.007263020146638155,
-0.003923103678971529,
0.0047164009883999825,
-0.00988722313195467,
0.009350395761430264,
-0.010234636254608631,
-0.003675010520964861,
0.001984173199161887,
-0.005475889425724745,
0.010514382272958755,
0.0025668630842119455,
-0.0027167133521288633,
-0.0010813111439347267,
-0.011727186851203442,
-0.002019620966166258,
0.003933772444725037,
0.002204486634582281,
-0.00871619675308466,
0.0025750650092959404,
-0.001717673148959875,
0.004196803085505962,
0.0065437620505690575,
-0.007747472729533911,
0.005700073204934597,
0.002216469729319215,
-0.0039787283167243,
-0.0002204727497883141,
-0.004326028283685446,
0.002725463593378663,
0.003881994867697358,
-0.007106145843863487,
-0.006041472312062979,
0.004072192125022411,
-0.007566072978079319,
-0.005068793427199125,
0.006291307508945465,
-0.008853856474161148,
-0.00884897168725729,
-0.002574834506958723,
-0.011417119763791561,
0.0010446722153574228
] |
8a7f754432204bffd274f53972f0d99bc17086e5 | 118 | py | Python | polyaxon/db/admin/job_resources.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | polyaxon/db/admin/job_resources.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | polyaxon/db/admin/job_resources.py | elyase/polyaxon | 1c19f059a010a6889e2b7ea340715b2bcfa382a0 | [
"MIT"
] | null | null | null | from django.contrib import admin
from db.models.job_resources import JobResources
admin.site.register(JobResources)
| 19.666667 | 48 | 0.847458 | 1 | 0.6516 | [
0.0021062574815005064,
0.022418661043047905,
0.009896619245409966,
0.004206318408250809,
0.004964789841324091,
-0.004326935857534409,
-0.011078867129981518,
0.0030761458911001682,
-0.006964393425732851,
0.0003262455575168133,
0.004482556134462357,
0.004687081091105938,
0.00886787660419941,
-0.01763349585235119,
0.0027592722326517105,
0.01820746622979641,
-0.05503556877374649,
0.005481983534991741,
-0.005818518809974194,
0.0012126785004511476,
-0.007184214424341917,
0.011079000309109688,
0.010913499630987644,
0.007254054304212332,
0.004378714133054018,
-0.0004957159981131554,
0.009816554374992847,
0.004060948733240366,
-0.00888049229979515,
-0.006610292475670576,
-0.002634810982272029,
-0.0014071731129661202,
-0.004990112502127886,
-0.007363888900727034,
0.007641828153282404,
-0.002200998831540346,
0.0016720045823603868,
-0.021275149658322334,
0.011031786911189556,
-0.005764966364949942,
-0.00638098968192935,
-0.019143858924508095,
-0.00014078452659305185,
0.004311800003051758,
-0.01297655887901783,
0.004287777002900839,
-0.004590686876326799,
0.004686740227043629,
-0.008099177852272987,
0.006260694470256567,
-0.011098505929112434,
0.002245767042040825,
0.013613369315862656,
0.002775674220174551,
-0.0053031290881335735,
-0.007487345486879349,
0.010028901509940624,
-0.00007273988740053028,
-0.012026543729007244,
-0.0007819169550202787,
-0.004174124449491501,
-0.001867201761342585,
0.005741915199905634,
0.002135073533281684,
-0.020153354853391647,
-0.005991097539663315,
-0.002904705237597227,
0.0032314376439899206,
0.00035100121749565005,
0.00714049581438303,
0.001841654535382986,
-0.0024030760396271944,
0.007422253023833036,
0.003324936144053936,
0.0066915773786604404,
-0.004194005858153105,
0.00024145151837728918,
0.0041305809281766415,
0.007660194765776396,
0.0036339182406663895,
0.005505803972482681,
-0.00850649829953909,
0.005822127219289541,
0.01319681666791439,
0.013948372565209866,
0.009048782289028168,
0.023770835250616074,
-0.010595857165753841,
0.04463830217719078,
0.005481438711285591,
-0.009661508724093437,
0.0029555426444858313,
-0.007700127549469471,
-0.0018822067650035024,
-0.003572933143004775,
-0.03418192267417908,
-0.0017306541558355093,
-0.004941969644278288,
-0.0016635317588225007,
0.002427406143397093,
0.0007881440105848014,
0.004114791285246611,
-0.0007826017681509256,
-0.0019575825426727533,
-0.010583698749542236,
0.01400075014680624,
-0.010199040174484253,
-0.0023927742149680853,
0.008141422644257545,
0.003376612439751625,
-0.011027049273252487,
0.00014513364294543862,
0.002676707925274968,
-0.013720830902457237,
0.006260951515287161,
0.002735293470323086,
-0.00790022499859333,
0.056898653507232666,
-0.00026002907543443143,
0.0022681066766381264,
-0.005354099906980991,
-0.0030327686108648777,
0.0020921113900840282,
0.009242014028131962,
0.008792977780103683,
-0.004534923005849123,
0.009866317734122276,
0.00678314920514822,
0.004089952912181616,
0.00575594138354063,
-0.001736568519845605,
0.007348412647843361,
-0.004397155251353979,
-0.003120327601209283,
0.0007407711818814278,
-0.008905459195375443,
0.009703694842755795,
-0.0018534277332946658,
-0.008775562047958374,
0.0007840709877200425,
0.000027431769922259264,
-0.011048105545341969,
0.0011403197422623634,
-0.0006009761127643287,
-0.0012385444715619087,
-0.013564513996243477,
-0.0032546024303883314,
-0.0005624763434752822,
-0.005695837549865246,
0.005616052076220512,
0.006448936183005571,
0.0031563974916934967,
0.0016125678084790707,
-0.005591857712715864,
-0.009264006279408932,
0.0008561931317672133,
-0.00574153009802103,
0.0046722968108952045,
0.008929966948926449,
0.0033878646790981293,
-0.008042240515351295,
-0.0004793958505615592,
0.004582657944411039,
0.006068680435419083,
-0.002348619978874922,
0.0005168771604076028,
-0.007270334754139185,
0.009351624175906181,
-0.0005400770460255444,
0.0013876400189474225,
0.012102373875677586,
-0.006260214373469353,
-0.0005213810363784432,
0.0014329261612147093,
0.0050932010635733604,
-0.0006712430622428656,
0.004562188405543566,
0.012288716621696949,
-0.003613393986597657,
-0.005721509922295809,
0.0034845578484237194,
0.005222679115831852,
0.009098870679736137,
0.009742998518049717,
-0.0016727014444768429,
0.0032200973946601152,
-0.003144453279674053,
0.0005141891306266189,
0.0040120515041053295,
-0.006780679803341627,
0.0061138165183365345,
0.005957484245300293,
-0.01461069192737341,
-0.003481350839138031,
0.0015027030603960156,
-0.010225106962025166,
0.0010982219828292727,
0.016101788729429245,
0.010208019986748695,
-9.083426562028762e-7,
0.002841233043000102,
-0.010029553435742855,
0.0018051430815830827,
0.005259769503027201,
0.0049293250776827335,
-0.011665435507893562,
-0.9539998769760132,
0.003193177282810211,
0.0013525764225050807,
0.0006517406436614692,
0.004688939545303583,
0.004615548066794872,
0.002324056113138795,
0.0029820329509675503,
0.014121833257377148,
-0.010836881585419178,
-0.007132227066904306,
-0.00970454327762127,
-0.010519337840378284,
-0.0007840241305530071,
-0.009072264656424522,
-0.0009596062009222806,
-0.0027305008843541145,
-0.00633658142760396,
-0.0011339207412675023,
-0.005786463618278503,
-0.003018673975020647,
0.011420613154768944,
-0.0007035505259409547,
0.006017640233039856,
0.002460850402712822,
0.0037837193813174963,
-0.005098576657474041,
0.00003159985499223694,
-0.00208887062035501,
-0.0041693891398608685,
-0.006116822827607393,
-0.01601388305425644,
-0.006094241514801979,
-0.00219004787504673,
0.009698444046080112,
-0.0010039473418146372,
0.01076478324830532,
0.0005205653724260628,
0.0029844962991774082,
-0.00977927166968584,
0.004926158580929041,
0.0022743502631783485,
0.0018953471444547176,
-0.028188517317175865,
0.0018103336915373802,
-0.002896873513236642,
-0.005922126583755016,
0.008641586638987064,
0.000464663899037987,
-0.00004490450373850763,
-0.00534052075818181,
-0.0034731144551187754,
0.00914819072932005,
-0.008911066688597202,
0.004558446351438761,
-0.007780095562338829,
-0.007202178239822388,
-0.0009297481155954301,
-0.008520708419382572,
0.0026853946037590504,
0.004598292522132397,
-0.002381499856710434,
-0.00410298490896821,
-0.002912286203354597,
0.001728715724311769,
0.0031062844209372997,
-0.0009695807239040732,
-0.017802398651838303,
-0.008438278920948505,
-0.004466523416340351,
-0.0008012637845240533,
-0.0034749023616313934,
-0.0036680151242762804,
0.001916568842716515,
-0.010592572391033173,
0.006992741022258997,
0.004147970583289862,
-0.00001912992593133822,
-0.011096106842160225,
0.003965161275118589,
-0.0088499141857028,
-0.010509511455893517,
0.004054953344166279,
-0.008319024927914143,
-0.0013887429377064109,
-0.0008174094255082309,
0.0027658625040203333,
0.009002329781651497,
-0.004706955049186945,
0.0032610378693789244,
0.010894570499658585,
-0.002042408799752593,
-0.008713915944099426,
0.00799419917166233,
0.0079170698300004,
0.002768866950646043,
-0.00451726745814085,
-0.00046018505236133933,
0.009426398202776909,
0.0070951515808701515,
0.0015258676139637828,
0.004924320615828037,
-0.0011789770796895027,
0.012843932956457138,
-0.0014689249219372869,
0.003697772277519107,
-0.002973902737721801,
-0.0018314033513888717,
-0.002099106553941965,
-0.0004478390037547797,
-0.004505181219428778,
-0.002170474734157324,
-0.010765363462269306,
-0.012888952158391476,
-0.0032467180863022804,
0.00004359483500593342,
0.00035695324186235666,
-0.003123729256913066,
0.0014443221734836698,
0.0027870596386492252,
0.011980948969721794,
0.004276361782103777,
-0.003052359214052558,
0.0013085860991850495,
0.0009584861691109836,
-0.01083019282668829,
0.015858160331845284,
-0.016026100143790245,
0.00468412134796381,
-0.001070630270987749,
-0.017610834911465645,
0.007858901284635067,
0.007318228483200073,
-0.008774909190833569,
-0.0010058593470603228,
0.004500386770814657,
0.003551113186404109,
0.000020058436348335817,
-0.004831718746572733,
-0.00217391992919147,
-0.017597177997231483,
-0.0020799452904611826,
0.019034426659345627,
0.003044730983674526,
0.009467103518545628,
0.0113358860835433,
-0.0058755832724273205,
0.0016360542504116893,
0.009267331101000309,
0.0005392251769080758,
0.015972597524523735,
-0.010309051722288132,
-0.0000658752687741071,
0.0015302225947380066,
-0.0058358944952487946,
0.0002689253306016326,
0.005125230643898249,
0.00665412237867713,
-0.0007128651486709714,
0.00032380910124629736,
-0.00839163362979889,
-0.005156155675649643,
-0.018478943035006523,
-0.0014256448484957218,
0.006509620230644941,
-0.0054136645048856735,
0.004304489120841026,
-0.010687802918255329,
0.0058137341402471066,
0.0064919134601950645,
0.0028200512751936913,
0.002018846571445465,
-0.0014797002077102661,
0.007451614830642939,
0.014133176766335964,
-0.007350583095103502,
0.002334604039788246,
-0.000093155111244414,
-0.00019259740656707436,
0.003394476603716612,
0.009156779386103153,
-0.010106509551405907,
-0.003571931039914489,
0.002140534808859229,
0.0024826473090797663,
0.0010541772935539484,
-0.005136466585099697,
-0.008603999391198158,
-0.004237605258822441,
0.0015005921013653278,
-0.004907993599772453,
0.005901233293116093,
0.003293056273832917,
0.003763865679502487,
-0.0046785371378064156,
-0.00062609335873276,
-0.000685313600115478,
-0.008968009613454342,
0.011370240710675716,
-0.0032017866615206003,
0.0007903212099336088,
0.014182417653501034,
0.0033120610751211643,
-0.01456471811980009,
0.006912986282259226,
0.011219491250813007,
-0.006181315053254366,
0.0030448026955127716,
0.008962222374975681,
-0.00601862883195281,
-0.02282089926302433,
0.0007795606506988406,
-0.014871526509523392,
0.0047689625062048435,
-0.004389515612274408,
0.0030185768846422434,
-0.005988472141325474,
0.0114079425111413,
0.003206508234143257,
-0.014273497276008129,
-0.0033546730410307646,
-0.010114902630448341,
0.009348035790026188,
-0.002292312914505601,
-0.0027168833184987307,
-0.0022512036375701427,
-0.0035449943970888853,
-0.00442317221313715,
-0.0015359522076323628,
0.000980813056230545,
0.004203508608043194,
0.000019691346096806228,
-0.006113833282142878,
0.0003481309104245156,
-0.002678283490240574,
-0.0003702023532241583,
0.002765171229839325,
-0.011310015805065632,
0.00175519660115242,
0.00649465573951602,
-0.0028018758166581392,
-0.002909935312345624,
0.00028647208819165826,
-0.002117432886734605,
-0.007192199118435383,
-0.012306267395615578,
-0.002746999729424715,
-0.004186877980828285,
-0.0010166643187403679,
-0.009359530173242092,
-0.0019201711984351277,
-0.006776818074285984,
0.0031898338347673416,
-0.006351033691316843,
0.006684756837785244,
0.002228224417194724,
-0.007973761297762394,
0.0036061268765479326,
-0.0022504020016640425,
0.005883107427507639,
0.007703424897044897,
0.00959259644150734,
-0.0031182984821498394,
-0.007564587984234095,
-0.00957727711647749,
0.009526152163743973,
-0.008829180151224136,
0.000051829982112394646,
0.013950902968645096,
0.002343001775443554,
0.007181061431765556,
0.002832600846886635,
0.0028582410886883736,
0.0034033097326755524,
0.006188820581883192,
-0.0173130352050066,
0.003677493194118142,
-0.005089606624096632,
-0.0007570094894617796,
0.005185574758797884,
-0.0048376573249697685,
0.006138939876109362,
0.008628501556813717,
0.004090546630322933,
-0.007553174160420895,
-0.0014054039493203163,
-0.0011062889825552702,
0.004290989600121975,
-0.013399244286119938,
-0.0008440701640211046,
-0.0010581450769677758,
-0.0018946003401651978,
-0.00292084994725883,
-0.005427051335573196,
-0.003011484630405903,
0.007126984652131796,
-0.0028438095469027758,
0.005720897577702999,
0.0013095263857394457,
-0.0007292308146134019,
0.014077848754823208,
-0.0066852024756371975,
-0.007533264346420765,
0.0017380565404891968,
0.0015957943396642804,
-0.0037052887491881847,
-0.00858687050640583,
-0.0010828208178281784,
0.0013390391832217574,
0.0032106181606650352,
-0.002426175167784095,
-0.009620494209229946,
0.00020629269420169294,
0.0023409740533679724,
-0.00643180450424552,
0.0037291322369128466,
0.01129501685500145,
0.0008842155802994967,
0.004129553213715553,
-0.0022021280601620674,
-0.007277532014995813,
-0.016263384371995926,
0.057007551193237305,
-0.0017370320856571198,
0.002793087624013424,
0.006886051967740059,
-0.00599553482607007,
-0.0007142446120269597,
-0.0029472748283296824,
0.00670783082023263,
-0.005617499351501465,
-0.005537351127713919,
0.008246736600995064,
-0.002951451577246189,
0.003265464212745428,
0.0000677778443787247,
-0.004973848350346088,
0.0185519028455019,
-0.005505293607711792,
-0.018681779503822327,
-0.016644952818751335,
0.007005663122981787,
-0.0038784630596637726,
-0.0063277678564190865,
0.009137816727161407,
-0.0014586624456569552,
-0.003089134581387043,
0.0019455015426501632,
0.005165452137589455,
0.0005964016309008002,
-0.0009024498285725713,
-0.002073317766189575,
-0.0006745160790160298,
-0.0024148274678736925,
0.0042211031541228294,
0.004652569070458412,
0.010116084478795528,
-0.0016429119277745485,
0.004759541247040033,
-0.005591855384409428,
-0.0008034681668505073,
0.00211924291215837,
0.00657033221796155,
0.004649461712688208,
0.0007122002425603569,
-0.002550251316279173,
0.00354556692764163,
0.004678106401115656,
-0.002392180496826768,
0.013314317911863327,
0.001041187671944499,
-0.004060271196067333,
0.00790228322148323,
0.009705117903649807,
-0.0029460752848535776,
0.00681576132774353,
-0.0005229663802310824,
0.006796362344175577,
0.002706004772335291,
-0.007210100535303354,
-0.01220221258699894,
-0.002027372596785426,
0.005353597458451986,
0.0067236777395009995,
-0.0018844439182430506,
0.0030816991347819567,
0.0010900581255555153,
-0.003632650710642338,
-0.009427374228835106,
-0.0074081989005208015,
-0.0038160718977451324,
-0.0012797359377145767,
0.0038360836915671825,
0.07136186212301254,
-0.006501703057438135,
-0.0017831058939918876,
-0.008190876804292202,
0.0006732125184498727,
0.0012599327601492405,
-0.0003447713970672339,
0.0007952743326313794,
-0.0020802943035960197,
0.0014741643099114299,
0.0054013426415622234,
-0.006911232136189938,
-0.010962577536702156,
-0.00002431330540275667,
0.0017794942250475287,
-0.002803848823532462,
0.0035222875885665417,
0.006199296563863754,
-0.005511538591235876,
-0.00008564167364966124,
-0.012885510921478271,
-0.006251045502722263,
-0.0037509105168282986,
-0.005181456916034222,
-0.0035882466472685337,
-0.0026176401879638433,
0.0007707770564593375,
0.004623987711966038,
0.007413886487483978,
-0.004413284361362457,
0.007475975900888443,
-0.0018938130233436823,
0.000970899302046746,
-0.0028632290195673704,
-0.0014763146173208952,
-0.006099552381783724,
0.010379093699157238,
0.0006916124257259071,
-0.012298792600631714,
-0.004863530397415161,
-0.00146769848652184,
0.00011566893954295665,
-0.008825935423374176,
0.003430543001741171,
0.0006590930861420929,
0.008569742552936077,
-0.0025970281567424536,
0.0022553750313818455,
-0.004902917891740799,
-0.0009348152671009302,
-0.015155449509620667,
0.006093812640756369,
-0.18553070724010468,
0.01035400666296482,
0.003679603338241577,
-0.004245046526193619,
-0.002907820511609316,
-0.015831250697374344,
-0.009295984171330929,
0.004698160570114851,
0.009391381405293941,
0.0012279129587113857,
-0.00028527138056233525,
-0.001013745553791523,
0.002323767403140664,
0.00343537051230669,
-0.004350388888269663,
-0.004475194960832596,
0.00484827533364296,
-0.008172930218279362,
-0.0021915037650614977,
0.004383113235235214,
0.0039624618366360664,
0.008400755003094673,
0.0035343363415449858,
0.0016719314735382795,
-0.0004381590988487005,
-0.0035383780486881733,
0.004717614501714706,
-0.002833130769431591,
0.005434454884380102,
-0.011200758628547192,
-0.005492781288921833,
-0.005647003185003996,
-0.0019497012253850698,
0.003130568191409111,
0.002089728834107518,
0.0008779508643783629,
0.006849281955510378,
0.0023438059724867344,
-0.008890886791050434,
0.009766525588929653,
-0.008220483548939228,
0.029959965497255325,
0.0069831907749176025,
0.0071692559868097305,
0.0013584200059995055,
-0.00479719415307045,
-0.00314635899849236,
0.00795702263712883,
0.0027673153672367334,
0.013277167454361916,
-0.010690541006624699,
-0.004150689579546452,
0.003125529969111085,
0.018414314836263657,
-0.0032007587142288685,
-0.008168964646756649,
-0.008272373117506504,
-0.004780177492648363,
0.004550872836261988,
0.00810815580189228,
0.008446779102087021,
-0.004011787939816713,
0.00801895558834076,
-0.004539658781141043,
-0.025083303451538086,
0.006640051491558552,
0.00001818782402551733,
-0.007298434618860483,
0.0036057084798812866,
0.005143342074006796,
0.009108694270253181,
-0.0031369789503514767,
0.005422553047537804,
-0.00037121103378012776,
0.0026759980246424675,
-0.0015859666746109724,
0.008205418474972248,
-0.0031298240646719933,
0.006692345254123211,
-0.00885904859751463,
0.008715989999473095,
-0.00904260203242302,
-0.0030335974879562855,
0.0005778513150289655,
-0.005801660008728504,
0.009674854576587677,
0.003974512685090303,
-0.0048588174395263195,
0.0020093529019504786,
-0.013339177705347538,
-0.0004846810770686716,
0.002793329069390893,
0.0015762755647301674,
-0.00968221016228199,
0.0005127794574946165,
-0.002131738932803273,
0.006319927517324686,
0.00915900431573391,
-0.008202547207474709,
0.0073300632648169994,
0.005580649711191654,
-0.007105703465640545,
-0.00023761336342431605,
-0.005274864844977856,
-0.00042472820496186614,
0.0039635831490159035,
-0.0059018065221607685,
-0.007877285592257977,
0.0037656163331121206,
-0.006720126606523991,
-0.005097915418446064,
0.006061821710318327,
-0.010047064162790775,
-0.007663219701498747,
-0.0006109541864134371,
-0.012122243642807007,
0.00007308573549380526
] |
8a7f7c81cefa2649d2218e763e7fb484932406a9 | 8,498 | py | Python | voting_ml/main.py | tommy-waltmann/voting-ml | 327de4515d8f2f7b8e072833df20eca651621ea6 | [
"BSD-3-Clause"
] | null | null | null | voting_ml/main.py | tommy-waltmann/voting-ml | 327de4515d8f2f7b8e072833df20eca651621ea6 | [
"BSD-3-Clause"
] | 2 | 2021-04-20T19:04:36.000Z | 2021-04-24T22:33:47.000Z | voting_ml/main.py | tommy-waltmann/voting-ml | 327de4515d8f2f7b8e072833df20eca651621ea6 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
import sklearn
import subprocess
from sklearn import model_selection, tree
import data
import feature_selection
import model_sel
import os
import matplotlib.pyplot as plt
import seaborn as sns
def main():
#parameter space
list_test_size = [0.1,0.15,0.2] # decide this
list_ftsel_method = ['chi2','mutlinfo','pca','dt']
list_num_features = [10,15,20] # decide this
list_Kfold = [3,5]
list_corr_threshold = [1,0.5,0.6,0.7] # decide this
param_space = {
'criterion': ['gini', 'entropy'],
'max_depth': [2, 3, 4, 5, 7],
'min_samples_split': [2, 5, 10],
'min_samples_leaf': [2, 5, 10],
'max_leaf_nodes': [2, 4, 6, 8, 10, 12, 15],
}
repeat = 1
#output dictrionary list
list_output_dict = []
# output directory path
outdir = "../results/run1/"
if(not os.path.isdir(outdir)):
os.mkdir(outdir)
o_models_file = open(outdir+"models.csv","w")
o_models_file.write("test size,run num,ftsel method,Kfold,number of features,correlation threshold,best features,criterion,max_depth,max_leaf_nodes,min_samples_leaf,min_samples_split,training accuracy,test accuracy\n")
#splitting data and weights into train, test (refer to optimal_params.py)
poll_data = data.PollDataProxy(remove_nan=False, convert_to_float=False)
acc = []
'''refer to optimal_params.py. Functions from this python scripts are transferred here. (get_bad_questions() and separate_weights().)'''
for ts in list_test_size:
for run_num in range(repeat):
all_data, all_data_questions = poll_data.all_data_except(get_bad_questions())
X = all_data[:, :-1]
y = all_data[:, -1]
X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y,
test_size=ts,
shuffle=True)
X_train, weights_train, questions = separate_weights(X_train, all_data_questions[:-1])
X_test, weights_test, _ = separate_weights(X_test, all_data_questions[:-1])
print("Number of Training Samples:", len(X_train))
print("Number of Testing Samples:", len(X_test))
data_dict = {
'X_train': X_train,
'X_test': X_test,
'y_train': y_train,
'y_test': y_test
}
weights_dict = {
'weights_train': weights_train,
'weights_test': weights_test}
for meth in list_ftsel_method:
'''Create class objects of the current selection method'''
for thres in list_corr_threshold:
data_ranked_dict, ranked_questions = {}, []
ftsel_obj =None
if(meth=='chi2'):
ftsel_obj = feature_selection.FeatureSelection(
necess_que_file="../extern/manage_data/list_all_questions.txt",
unnecess_que_file="../extern/manage_data/list_unnecessary_columns.txt",
bool_necess_que=False,
run_name="test_chi2"
)
data_ranked_dict, ranked_questions = ftsel_obj.ftsel_chi2(data_dict, thres)
elif(meth=='mutlinfo'):
ftsel_obj = feature_selection.FeatureSelection(
necess_que_file="../extern/manage_data/list_all_questions.txt",
unnecess_que_file="../extern/manage_data/list_unnecessary_columns.txt",
bool_necess_que=False,
run_name="test_mutlinfo"
)
data_ranked_dict, ranked_questions = ftsel_obj.ftsel_mutlinfo(data_dict, thres)
elif(meth=='pca'):
ftsel_obj = feature_selection.FeatureSelection(
necess_que_file="../extern/manage_data/list_all_questions.txt",
unnecess_que_file="../extern/manage_data/list_unnecessary_columns.txt",
bool_necess_que=False,
run_name="test_pca"
)
data_ranked_dict,_ = ftsel_obj.ftsel_pca(data_dict)
fts = data_sel_dict['X_train'].shape[1]
questions_int = list(map(str, list(range(1,fts+1,1))))
ranked_questions = ["ft_"+x for x in questions_int]
elif(meth=='dt'):
ftsel_obj = feature_selection.FeatureSelection(
necess_que_file="../extern/manage_data/list_all_questions.txt",
unnecess_que_file="../extern/manage_data/list_unnecessary_columns.txt",
bool_necess_que=False,
run_name="test_dt"
)
data_ranked_dict, ranked_questions = ftsel_obj.ftsel_decision_tree_method(data_dict, thres)
for num in list_num_features:
data_sel_dict, sel_questions = ftsel_obj.select_num_features(data_ranked_dict, num, ranked_questions)
ftsel_obj.plot_heatmap(data_sel_dict['X_train'], sel_questions)
for K in list_Kfold:
'''Here create a class onject of "model_sel" and output all the best parameters and values into "list_output_dict". Then, can create a .csv file to list all the models and accuracies.'''
model_obj = model_sel.model_sel(ts, run_num, meth, param_space, K, num, thres, data_sel_dict ,weights_dict, sel_questions, outdir).select_model()
# intermediate = model_obj.select_model()
acc.append(model_obj['test_acc'])
o_models_file.write(str(ts)+",")
o_models_file.write(str(run_num)+",")
o_models_file.write(meth+",")
o_models_file.write(str(K)+",")
o_models_file.write(str(num)+",")
o_models_file.write(str(thres)+",")
for ii in range(len(model_obj['best_features'])):
o_models_file.write(model_obj['best_features'][ii]+" ")
o_models_file.write(",")
o_models_file.write(model_obj['best_params']['criterion']+",")
o_models_file.write(str(model_obj['best_params']['max_depth'])+",")
o_models_file.write(str(model_obj['best_params']['max_leaf_nodes'])+",")
o_models_file.write(str(model_obj['best_params']['min_samples_leaf'])+",")
o_models_file.write(str(model_obj['best_params']['min_samples_split'])+",")
o_models_file.write(str(model_obj['train_acc'])+",")
o_models_file.write(str(model_obj['test_acc'])+",")
o_models_file.write("\n")
list_output_dict.append(model_obj)
'''Once all the models are run, select the model with best test accuracy and return the output dict for that model.'''
o_models_file.close()
best_index = np.argmax(acc)
best_model_dict = list_output_dict[best_index]
print("The best model parameters:")
print(best_model_dict)
def get_bad_questions():
f = open("../extern/manage_data/list_unnecessary_columns.txt", 'r')
bad_questions = f.readline().split(',')
bad_questions[-1] = bad_questions[-1][:-1] # chop the \n off the end
bad_questions.remove('weight') # need weight for training
return bad_questions
def separate_weights(X_train, column_names):
"""
Removes the column containing weights from X_train, and returns it as
a separate array.
"""
weight_column_idx = column_names.index('weight')
weights = X_train[:, weight_column_idx]
new_X_train = np.delete(X_train, weight_column_idx, axis=1)
new_questions = column_names
new_questions.remove('weight')
return new_X_train, weights, new_questions
if __name__ == "__main__":
main()
| 47.741573 | 222 | 0.564603 | 1 | 1.9296 | [
-0.015145212411880493,
0.04667704924941063,
-0.00841581542044878,
0.022361738607287407,
-0.009319726377725601,
-0.006255351006984711,
-0.045733798295259476,
0.022567447274923325,
-0.013559391722083092,
-0.01953166350722313,
0.015999462455511093,
0.030637631192803383,
0.005990682169795036,
0.05517648532986641,
0.0014332806458696723,
-0.005615743808448315,
0.2035474330186844,
-0.03962092474102974,
0.030459823086857796,
-0.011203428730368614,
-0.012087658047676086,
0.011909901164472103,
-0.017616352066397667,
0.015510010533034801,
-0.030938491225242615,
0.0044316379353404045,
0.05862260237336159,
0.01848738268017769,
0.0021564788185060024,
-0.04010384529829025,
0.004546856041997671,
0.03241023048758507,
-0.008411864750087261,
0.006222331430763006,
-0.003353520529344678,
-0.023472042754292488,
-0.010635127313435078,
-0.09389180690050125,
0.03248541057109833,
-0.018383141607046127,
-0.01195766031742096,
-0.05413161590695381,
0.0006248828140087426,
-0.003432094119489193,
0.010556177236139774,
0.042437583208084106,
-0.005206404719501734,
0.0689368024468422,
-0.014857525937259197,
-0.01943613775074482,
-0.03995070606470108,
0.01998615637421608,
-0.029684768989682198,
-0.05257410556077957,
-0.00461892643943429,
-0.036532241851091385,
0.01385637279599905,
0.024587543681263924,
-0.029354432597756386,
0.025179622694849968,
-0.08840388059616089,
0.030993206426501274,
-0.03509954735636711,
0.01881631277501583,
-0.04117843881249428,
0.021470149978995323,
0.011054111644625664,
0.002769963815808296,
-0.04474673792719841,
0.03919845446944237,
0.02634960040450096,
0.036152031272649765,
0.039871182292699814,
0.021332496777176857,
0.026750076562166214,
0.016411136835813522,
0.0019308564951643348,
-0.0333237498998642,
-0.02052363008260727,
-0.016053032130002975,
-0.032364021986722946,
0.13318932056427002,
0.01600745879113674,
-0.04942464828491211,
0.017752839252352715,
-0.003192611038684845,
0.04532169923186302,
-0.031973157078027725,
-0.009891307912766933,
0.02246098779141903,
-0.02819035016000271,
0.025161759927868843,
0.0038868477568030357,
-0.028279561549425125,
-0.02547323890030384,
-0.054362453520298004,
0.0013755369000136852,
-0.017703941091895103,
0.0023825925309211016,
-0.004229935817420483,
0.030264854431152344,
0.042818959802389145,
0.02815842628479004,
-0.000003955473403038923,
0.011973453685641289,
-0.018061000853776932,
0.022452207282185555,
0.017883609980344772,
0.006158290430903435,
0.026781534776091576,
-0.007173686753958464,
-0.005010899156332016,
0.0560029111802578,
0.002582962391898036,
-0.012709250673651695,
-0.031787723302841187,
-0.03420676290988922,
0.051379602402448654,
0.04613043740391731,
0.02288234420120716,
-0.041932981461286545,
-0.007680994458496571,
0.037921030074357986,
0.006802387069910765,
0.023472124710679054,
0.056891877204179764,
-0.04248320311307907,
-0.0163616631180048,
0.026993226259946823,
-0.01865966245532036,
-0.012765579856932163,
0.024273322895169258,
-0.025301704183220863,
0.05241043120622635,
-0.005676438566297293,
-0.00044623840949498117,
-0.009979832917451859,
0.023786570876836777,
-0.06320574879646301,
0.029458334669470787,
-0.017204975709319115,
-0.030148707330226898,
0.025958113372325897,
0.006382388528436422,
0.04491882771253586,
-0.043559733778238297,
0.03945242986083031,
-0.008583899587392807,
-0.014108271338045597,
0.03643900156021118,
0.006110359448939562,
0.04556311294436455,
-0.011152779683470726,
0.009023392572999,
-0.019203174859285355,
-0.014210048131644726,
0.010610549710690975,
-0.021797338500618935,
-0.04386472329497337,
0.007468460593372583,
0.015273545868694782,
0.07902173697948456,
0.0014978431863710284,
-0.03449203819036484,
0.054396387189626694,
0.010160294361412525,
0.017167411744594574,
0.029203146696090698,
-0.02069198153913021,
0.005245014559477568,
-0.00877742376178503,
-0.017636971548199654,
-0.02157745137810707,
-0.018381619825959206,
0.010221450589597225,
0.016828469932079315,
-0.007370454724878073,
-0.0010793072870001197,
0.009597345255315304,
-0.013831184245646,
-0.01186030451208353,
-0.016029154881834984,
0.060451481491327286,
-0.014377840794622898,
0.004078907426446676,
-0.04996251314878464,
-0.06043890118598938,
-0.020490232855081558,
0.024176131933927536,
-0.006725192070007324,
-0.005849751178175211,
-0.02012171410024166,
0.022244498133659363,
-0.028320014476776123,
0.045309584587812424,
0.012595605105161667,
-0.03317951038479805,
0.013466138392686844,
-0.0015556333819404244,
-0.015147868543863297,
0.00014682220353279263,
0.006719043478369713,
0.015660680830478668,
0.022635919973254204,
-0.021194886416196823,
-0.011009412817656994,
-0.5125313401222229,
-0.000027840058464789763,
0.021163111552596092,
-0.029864296317100525,
0.010258355177938938,
0.04871150106191635,
-0.02144933119416237,
0.0037212318275123835,
-0.04878680035471916,
-0.048993732780218124,
0.01968432031571865,
0.02863377332687378,
-0.03542247787117958,
-0.013895886950194836,
-0.024364318698644638,
-0.06195961683988571,
-0.015621532686054707,
-0.056796833872795105,
-0.026665594428777695,
-0.00263793277554214,
0.009385869838297367,
-0.03045530617237091,
-0.021869108080863953,
0.0051955231465399265,
-0.008221311494708061,
-0.07910982519388199,
0.030986890196800232,
0.03094647079706192,
-0.023806730285286903,
0.046301815658807755,
-0.006158307660371065,
0.050900962203741074,
0.017442692071199417,
-0.0440356619656086,
0.021725865080952644,
-0.016955886036157608,
0.04795239493250847,
-0.03533712774515152,
0.03017481230199337,
-0.019314007833600044,
0.016227712854743004,
-0.0069554210640490055,
0.015262829139828682,
-0.04831609129905701,
-0.08924266695976257,
-0.009219607338309288,
-0.010035684332251549,
-0.01281967293471098,
0.023143742233514786,
0.04569108039140701,
-0.033108972012996674,
0.019202305004000664,
0.030170802026987076,
-0.029681527987122536,
-0.018912434577941895,
-0.0077233463525772095,
-0.0257260724902153,
-0.04324270412325859,
-0.052409686148166656,
0.003962312359362841,
-0.020110290497541428,
-0.03768153116106987,
-0.014012900181114674,
0.018786801025271416,
-0.042210567742586136,
-0.0041756462305784225,
0.05571800842881203,
-0.0014850773150101304,
-0.015230508521199226,
0.04014011472463608,
-0.016161488369107246,
0.020986082032322884,
-0.04389435797929764,
0.0634499117732048,
-0.03741937503218651,
0.016454609110951424,
-0.045974887907505035,
0.01978353224694729,
-0.04162907972931862,
-0.012552831321954727,
0.01937139593064785,
-0.01778615452349186,
-0.023675017058849335,
0.013757878914475441,
-0.016768839210271835,
0.021227898076176643,
-0.0012170261470600963,
-0.02968740463256836,
-0.004855792969465256,
0.015165585093200207,
0.03412149101495743,
0.001210671616718173,
0.005471904296427965,
-0.02863580547273159,
0.011258913204073906,
0.010236133821308613,
0.056461527943611145,
-0.003965187817811966,
0.007719742599874735,
0.012133007869124413,
-0.0685833990573883,
0.04097824543714523,
0.027601540088653564,
0.05691857263445854,
-0.037904929369688034,
-0.022383393719792366,
-0.007699934300035238,
0.02444201335310936,
0.018105262890458107,
-0.005635397508740425,
0.012046544812619686,
-0.0036037913523614407,
-0.025071032345294952,
0.008296019397675991,
-0.05045512691140175,
0.011428240686655045,
-0.030410856008529663,
-0.07305537909269333,
0.02029784396290779,
-0.015433525666594505,
-0.009381535463035107,
0.029632873833179474,
0.0411238931119442,
0.012488138861954212,
0.019902106374502182,
-0.020063305273652077,
0.0026651599910110235,
-0.02486882172524929,
-0.007565573323518038,
-0.013819045387208462,
0.001371793681755662,
0.006980759557336569,
0.002130844397470355,
-0.0008685904322192073,
-0.04043729603290558,
-0.020467888563871384,
0.015310891903936863,
-0.017713453620672226,
0.021892761811614037,
0.025152865797281265,
-0.03795289620757103,
-0.04284955561161041,
0.03461039811372757,
-0.015343005768954754,
0.024114243686199188,
0.04547327384352684,
0.02107280120253563,
-0.010715779848396778,
-0.041691623628139496,
-0.041173018515110016,
0.009657219983637333,
-0.004703030455857515,
0.05695834383368492,
-0.0155296316370368,
-0.004007983952760696,
-0.020204773172736168,
-0.005411611404269934,
0.01072959415614605,
0.03637297451496124,
0.024441925808787346,
0.02539781481027603,
-0.05175380781292915,
-0.005928937345743179,
0.026582112535834312,
-0.015864599496126175,
-0.006651017814874649,
0.036375172436237335,
0.024507535621523857,
0.011533507145941257,
0.04229893162846565,
0.010283928364515305,
0.052885040640830994,
-0.005830586887896061,
0.04410424456000328,
0.011873547919094563,
0.037993963807821274,
-0.04053886979818344,
-0.053674813359975815,
0.0030452588107436895,
-0.003184301545843482,
-0.0017459271475672722,
0.02068888023495674,
0.014232470653951168,
0.05590742081403732,
-0.04519527032971382,
-0.003556535579264164,
-0.02137533389031887,
-0.022013040259480476,
0.00703811552375555,
-0.08727745711803436,
0.023928873240947723,
-0.015774695202708244,
-0.00849170796573162,
0.04528722167015076,
-0.028025418519973755,
-0.02329753153026104,
0.01710774190723896,
-0.010500517673790455,
0.0012527276994660497,
-0.07041115313768387,
-0.02058415301144123,
0.010856962762773037,
-0.01539301685988903,
-0.007350207306444645,
0.027379920706152916,
0.0653260350227356,
0.014654912054538727,
-0.02683296799659729,
0.01127877738326788,
-0.03258667513728142,
-0.006090695504099131,
0.002342002931982279,
0.01588940992951393,
-0.03295695409178734,
-0.006102210376411676,
0.04100123420357704,
-0.07162754982709885,
-0.08724329620599747,
-0.016382470726966858,
-0.0018862568540498614,
0.01805778220295906,
-0.03877212479710579,
-0.007443010341376066,
0.046789348125457764,
-0.0176528487354517,
-0.026823673397302628,
-0.023391425609588623,
0.004653392359614372,
-0.03565360978245735,
0.024561772122979164,
0.005700418725609779,
-0.0439075268805027,
0.005167735740542412,
0.014056578278541565,
0.0002607917704153806,
0.04587889462709427,
-0.04435745254158974,
-0.00013089219282846898,
0.034411389380693436,
0.0057041640393435955,
0.0389215424656868,
-0.011776519939303398,
0.002358879428356886,
0.01613948866724968,
-0.02952081710100174,
-0.005770455114543438,
0.009130957536399364,
-0.036363713443279266,
-0.056169282644987106,
0.012606511823832989,
-0.01713322289288044,
0.05549975857138634,
0.02928287722170353,
-0.008465412072837353,
0.00013746415788773447,
-0.03617841377854347,
-0.01648874022066593,
0.026468876749277115,
0.02046225778758526,
0.04261244833469391,
-0.0189488735049963,
0.00112387933768332,
0.031191132962703705,
0.00890152994543314,
-0.011688163504004478,
-0.008616195060312748,
-0.031060054898262024,
-0.021389560773968697,
0.010084278881549835,
0.05422604829072952,
0.015990735962986946,
-0.0053435927256941795,
0.004254462663084269,
0.03335193544626236,
0.07871337234973907,
-0.019081952050328255,
-0.014770147390663624,
-0.002736393827944994,
-0.06381378322839737,
0.005456843413412571,
-0.004597693681716919,
-0.012183384969830513,
0.054588522762060165,
-0.005618232302367687,
-0.005065430887043476,
0.00660287868231535,
-0.0729079321026802,
0.011637386865913868,
-0.0433594211935997,
-0.030913757160305977,
0.011902349069714546,
-0.002294259611517191,
0.0550326369702816,
-0.01917479932308197,
0.05184189975261688,
-0.03215264156460762,
-0.03414665535092354,
-0.028298543766140938,
0.010293390601873398,
-0.05058331415057182,
-0.03249780833721161,
0.023476388305425644,
0.007845651358366013,
0.006130062974989414,
0.027683617547154427,
-0.006726412568241358,
0.0068372939713299274,
-0.026277659460902214,
0.012120204977691174,
0.012103050015866756,
0.023261211812496185,
-0.006405990570783615,
-0.019950466230511665,
0.018679248169064522,
-0.003219140227884054,
-0.01788066141307354,
0.053403403609991074,
-0.0025996938347816467,
0.015833670273423195,
0.00015471606457140297,
-0.031163891777396202,
0.011672032065689564,
0.0026874893810600042,
-0.0071813445538282394,
0.03113909810781479,
-0.05561394616961479,
-0.03222942724823952,
-0.002381144557148218,
-0.030050616711378098,
0.011456006206572056,
0.030006570741534233,
-0.004522279836237431,
0.021243922412395477,
-0.002356000943109393,
0.007690721657127142,
0.10283060371875763,
0.03167782351374626,
0.054890669882297516,
0.03683563694357872,
0.020942270755767822,
0.03990965336561203,
-0.01038484275341034,
0.00890206079930067,
0.010447779670357704,
-0.010482586920261383,
-0.026635510846972466,
0.03918801248073578,
0.051735471934080124,
0.01867065392434597,
0.01784350536763668,
0.013622979633510113,
0.0015358146047219634,
0.009665606543421745,
0.05862802267074585,
0.030158590525388718,
-0.013005292974412441,
0.0169011689722538,
0.0303743127733469,
0.030228041112422943,
0.019313842058181763,
-0.029746493324637413,
0.0347406379878521,
-0.003580137388780713,
-0.043905045837163925,
0.003058927832171321,
-0.02785814367234707,
-0.01339026354253292,
-0.04628603905439377,
-0.022025473415851593,
0.04016319662332535,
-0.00032612954964861274,
-0.062302373349666595,
0.044367335736751556,
0.036453165113925934,
0.022702716290950775,
-0.014493746683001518,
0.038847070187330246,
-0.044800467789173126,
0.004993986804038286,
-0.002243731403723359,
-0.022389866411685944,
-0.06938833743333817,
-0.02239719219505787,
-0.003720290958881378,
0.04133279249072075,
-0.07351267337799072,
0.0012755241477862,
0.04435642063617706,
-0.08178973197937012,
0.0038080259691923857,
0.025581229478120804,
0.0004504914686549455,
-0.005606378894299269,
0.01347528025507927,
0.0007338178693316877,
-0.0096131581813097,
-0.017620813101530075,
-0.06036807969212532,
-0.01669241115450859,
-0.004344628658145666,
-0.0035211320500820875,
-0.006765661295503378,
0.01919574663043022,
0.0065444475039839745,
0.010588553734123707,
-0.05377984046936035,
0.027477765455842018,
-0.032602787017822266,
0.012179246172308922,
-0.008075710386037827,
0.04214482009410858,
0.06283304840326309,
-0.02114948257803917,
-0.040598709136247635,
0.023608965799212456,
-0.015597949735820293,
-0.022370968014001846,
0.015128794126212597,
0.0017369926208630204,
0.04199744388461113,
-0.03751587122678757,
-0.008199185132980347,
0.00018442247528582811,
-0.016641853377223015,
-0.02045990526676178,
-0.0322844497859478,
-0.007508020382374525,
-0.0048513556830585,
0.012259895913302898,
0.02503165416419506,
0.01945497654378414,
0.03031391091644764,
-0.04783206805586815,
-0.008921260014176369,
0.023498468101024628,
-0.025075318291783333,
0.007816081866621971,
-0.0060980478301644325,
0.025114137679338455,
-0.007969220168888569,
-0.0009475754923187196,
0.004143994767218828,
-0.04406781867146492,
0.03120279125869274,
0.0035718532744795084,
-0.04483489319682121,
-0.02098742686212063,
0.0029818841721862555,
-0.030580030754208565,
-0.015483361668884754,
-0.015414551831781864,
-0.007640263997018337,
0.03539784252643585,
0.017564255744218826,
0.02390565164387226,
-0.009134260006248951,
0.024364681914448738,
-0.011875240132212639,
0.04738769680261612,
0.011898435652256012,
0.024920552968978882,
0.05955573916435242,
0.03325139358639717,
-0.00178734480869025,
-0.013114869594573975,
0.026462649926543236,
0.019037757068872452,
-0.022218437865376472,
0.013279740698635578,
0.0031631996389478445,
-0.004620996303856373,
0.00018158290185965598,
-0.04129722714424133,
0.04015091806650162,
0.004380001686513424,
0.04013652727007866,
-0.008155698888003826,
-0.008247834630310535,
0.00665900856256485,
0.05466334521770477,
-0.013147793710231781,
-0.01165764033794403,
0.023153385147452354,
-0.002527993405237794,
-0.02936389297246933,
0.021548468619585037,
0.01833357661962509,
0.014175232499837875,
-0.004144344013184309,
-0.017881155014038086,
-0.04622190073132515,
-0.028313003480434418,
0.0066720531322062016,
0.008781105279922485,
0.018765313550829887,
-0.016916275024414062,
-0.003334077075123787,
-0.030920252203941345,
-0.005648460704833269,
-0.026386359706521034,
-0.021148119121789932,
0.022246235981583595,
0.013361603021621704,
-0.00829105731099844,
0.016005929559469223,
0.03815054893493652,
0.014100415632128716,
0.056668657809495926,
-0.008422937244176865,
-0.06749105453491211,
-0.034714240580797195,
-0.00683577312156558,
-0.014606203883886337,
-0.001959898741915822,
0.03772985190153122,
-0.03612575680017471,
-0.010385454632341862,
-0.016864793375134468,
0.03339735418558121,
-0.052987370640039444,
0.02222231961786747,
-0.01570943184196949,
-0.04014492779970169,
-0.005974386353045702,
0.018809471279382706,
-0.030203746631741524,
-0.016611680388450623,
-0.015813296660780907,
0.012318864464759827,
0.013363242149353027,
0.04309753701090813,
-0.016405776143074036,
0.0024715287145227194,
-0.0005835837800987065,
-0.019097182899713516,
-0.026209918782114983,
0.053903646767139435,
0.057914819568395615,
-0.07025348395109177,
-0.04269540682435036,
0.03026319295167923,
-0.005245066713541746,
0.005842165555804968,
-0.02116495929658413,
-0.036074113100767136,
-0.004782811272889376,
-0.0015530241653323174,
-0.008476215414702892,
0.031790729612112045,
-0.05173054337501526,
-0.00780134554952383,
-0.010790955275297165,
0.01798063889145851,
-0.016912497580051422,
-0.03322981297969818,
-0.04568492993712425,
0.0008439231314696372,
0.0635894238948822,
-0.04179994389414787,
0.01692475564777851,
-0.03607798367738724,
0.0503375343978405
] |
8a7f9273d28271b0f56005e762e91504d2293322 | 12,334 | py | Python | src/the_tale/the_tale/game/heroes/tests/test_logic.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/game/heroes/tests/test_logic.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | null | null | null | src/the_tale/the_tale/game/heroes/tests/test_logic.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | null | null | null |
import smart_imports
smart_imports.all()
class HeroDescriptionTests(utils_testcase.TestCase):
def setUp(self):
super().setUp()
game_logic.create_test_map()
account = self.accounts_factory.create_account(is_fast=True)
self.storage = game_logic_storage.LogicStorage()
self.storage.load_account_data(account)
self.hero = self.storage.accounts_to_heroes[account.id]
def test_no_description(self):
self.assertEqual(logic.get_hero_description(self.hero.id), '')
def test_has_description(self):
logic.set_hero_description(self.hero.id, 'bla-bla')
self.assertEqual(logic.get_hero_description(self.hero.id), 'bla-bla')
def test_update_description(self):
logic.set_hero_description(self.hero.id, 'bla-bla')
logic.set_hero_description(self.hero.id, 'new description')
self.assertEqual(logic.get_hero_description(self.hero.id), 'new description')
class CreateHero(utils_testcase.TestCase):
def setUp(self):
super().setUp()
game_logic.create_test_map()
self.account = accounts_prototypes.AccountPrototype.create(nick='nick-xxx',
email='test@test.test',
is_fast=False)
self.attributes = {'is_fast': False,
'is_bot': False,
'might': 0,
'active_state_end_at': datetime.datetime.now() + datetime.timedelta(days=3),
'premium_state_end_at': datetime.datetime.fromtimestamp(0),
'ban_state_end_at': datetime.datetime.fromtimestamp(0)}
def test_default(self):
logic.create_hero(account_id=self.account.id, attributes=self.attributes)
hero = logic.load_hero(self.account.id)
self.assertEqual(hero.id, self.account.id)
self.assertEqual(hero.account_id, self.account.id)
self.assertIn(hero.gender, (game_relations.GENDER.MALE,
game_relations.GENDER.FEMALE))
self.assertEqual(hero.preferences.energy_regeneration_type, hero.race.energy_regeneration)
self.assertEqual(hero.habit_honor.raw_value, 0)
self.assertEqual(hero.habit_peacefulness.raw_value, 0)
self.assertTrue(hero.preferences.archetype.is_NEUTRAL)
self.assertTrue(hero.upbringing.is_PHILISTINE)
self.assertTrue(hero.first_death.is_FROM_THE_MONSTER_FANGS)
self.assertTrue(hero.death_age.is_MATURE)
def test_account_attributes_required(self):
for attribute in self.attributes.keys():
with self.assertRaises(exceptions.HeroAttributeRequiredError):
logic.create_hero(account_id=self.account.id,
attributes={key: value for key, value in self.attributes.items() if key != attribute })
def test_account_attributes(self):
attributes = {'is_fast': random.choice((True, False)),
'is_bot': random.choice((True, False)),
'might': random.randint(1, 1000),
'active_state_end_at': datetime.datetime.fromtimestamp(1),
'premium_state_end_at': datetime.datetime.fromtimestamp(2),
'ban_state_end_at': datetime.datetime.fromtimestamp(3)}
logic.create_hero(account_id=self.account.id, attributes=attributes)
hero = logic.load_hero(self.account.id)
self.assertEqual(hero.is_fast, attributes['is_fast'])
self.assertEqual(hero.is_bot, attributes['is_bot'])
self.assertEqual(hero.might, attributes['might'])
self.assertEqual(hero.active_state_end_at, attributes['active_state_end_at'])
self.assertEqual(hero.premium_state_end_at, attributes['premium_state_end_at'])
self.assertEqual(hero.ban_state_end_at, attributes['ban_state_end_at'])
def test_attributes(self):
self.attributes.update({'race': game_relations.RACE.random(),
'gender': game_relations.GENDER.random(),
'name': game_names.generator().get_name(game_relations.RACE.random(),
game_relations.GENDER.random()),
'peacefulness': random.randint(-c.HABITS_BORDER, c.HABITS_BORDER),
'honor': random.randint(-c.HABITS_BORDER, c.HABITS_BORDER),
'archetype': game_relations.ARCHETYPE.random(),
'upbringing': tt_beings_relations.UPBRINGING.random(),
'first_death': tt_beings_relations.FIRST_DEATH.random(),
'death_age': tt_beings_relations.AGE.random()})
logic.create_hero(account_id=self.account.id, attributes=self.attributes)
hero = logic.load_hero(self.account.id)
self.assertEqual(hero.race, self.attributes['race'])
self.assertEqual(hero.gender, self.attributes['gender'])
self.assertEqual(hero.utg_name, self.attributes['name'])
self.assertEqual(hero.habit_peacefulness.raw_value, self.attributes['peacefulness'])
self.assertEqual(hero.habit_honor.raw_value, self.attributes['honor'])
self.assertEqual(hero.preferences.archetype, self.attributes['archetype'])
self.assertEqual(hero.upbringing, self.attributes['upbringing'])
self.assertEqual(hero.first_death, self.attributes['first_death'])
self.assertEqual(hero.death_age, self.attributes['death_age'])
class RegisterSpendingTests(utils_testcase.TestCase):
def setUp(self):
super().setUp()
self.places = game_logic.create_test_map()
account = self.accounts_factory.create_account()
self.storage = game_logic_storage.LogicStorage()
self.storage.load_account_data(account)
self.hero = self.storage.accounts_to_heroes[account.id]
self.hero.premium_state_end_at
game_tt_services.debug_clear_service()
@mock.patch('the_tale.game.heroes.objects.Hero.can_change_place_power', lambda hero, place: True)
def test_not_in_place(self):
self.hero.position.set_position(0, 0)
self.assertEqual(self.hero.position.place_id, None)
logic.register_spending(self.hero, 100)
impacts = game_tt_services.money_impacts.cmd_get_targets_impacts(targets=[(tt_api_impacts.OBJECT_TYPE.PLACE, self.places[0].id)])
self.assertEqual(impacts, [])
@mock.patch('the_tale.game.heroes.objects.Hero.can_change_place_power', lambda hero, place: False)
def test_can_not_change_place_power(self):
self.hero.position.set_place(self.places[0])
logic.register_spending(self.hero, 100)
impacts = game_tt_services.money_impacts.cmd_get_targets_impacts(targets=[(tt_api_impacts.OBJECT_TYPE.PLACE, self.places[0].id)])
self.assertEqual(impacts, [])
@mock.patch('the_tale.game.heroes.objects.Hero.can_change_place_power', lambda hero, place: True)
def test_can_change_place_power(self):
self.hero.position.set_place(self.places[0])
logic.register_spending(self.hero, 100)
impacts = game_tt_services.money_impacts.cmd_get_targets_impacts(targets=[(tt_api_impacts.OBJECT_TYPE.PLACE, self.places[0].id)])
self.assertEqual(len(impacts), 1)
self.assertEqual(impacts[0].amount, 100)
self.assertTrue(impacts[0].target_type.is_PLACE)
self.assertEqual(impacts[0].target_id, self.places[0].id)
@mock.patch('the_tale.game.heroes.objects.Hero.can_change_place_power', lambda hero, place: True)
def test_can_change_place_power__below_zero(self):
self.hero.position.set_place(self.places[0])
logic.register_spending(self.hero, 100)
logic.register_spending(self.hero, -50)
impacts = game_tt_services.money_impacts.cmd_get_targets_impacts(targets=[(tt_api_impacts.OBJECT_TYPE.PLACE, self.places[0].id)])
self.assertEqual(len(impacts), 1)
self.assertEqual(impacts[0].amount, 150)
class GetPlacesPathModifiersTests(places_helpers.PlacesTestsMixin,
utils_testcase.TestCase):
def setUp(self):
super().setUp()
self.places = game_logic.create_test_map()
account = self.accounts_factory.create_account(is_fast=True)
self.storage = game_logic_storage.LogicStorage()
self.storage.load_account_data(account)
self.hero = self.storage.accounts_to_heroes[account.id]
def place_0_cost(self):
return logic.get_places_path_modifiers(self.hero)[self.places[0].id]
def test_every_place_has_modifier(self):
modifiers = logic.get_places_path_modifiers(self.hero)
self.assertEqual(set(modifiers.keys()), {place.id for place in self.places})
def test_race_bonus(self):
self.places[0].race = game_relations.RACE.random(exclude=(self.hero.race,))
with self.check_almost_delta(self.place_0_cost, -c.PATH_MODIFIER_MINOR_DELTA):
self.places[0].race = self.hero.race
def test_modifier_bonus(self):
self.assertFalse(self.places[0].is_modifier_active())
with self.check_almost_delta(self.place_0_cost, -c.PATH_MODIFIER_MINOR_DELTA):
self.places[0].set_modifier(places_modifiers.CITY_MODIFIERS.FORT)
self.create_effect(self.places[0].id,
value=100500,
attribute=places_relations.ATTRIBUTE.MODIFIER_FORT,
delta=0)
self.places[0].refresh_attributes()
self.assertTrue(self.places[0].is_modifier_active())
def test_home_place(self):
with self.check_almost_delta(self.place_0_cost, -c.PATH_MODIFIER_NORMAL_DELTA):
self.hero.preferences.set(relations.PREFERENCE_TYPE.PLACE, self.places[0])
def test_friend(self):
with self.check_almost_delta(self.place_0_cost, -c.PATH_MODIFIER_NORMAL_DELTA):
self.hero.preferences.set(relations.PREFERENCE_TYPE.FRIEND, self.places[0].persons[0])
def test_enemy(self):
with self.check_almost_delta(self.place_0_cost, c.PATH_MODIFIER_NORMAL_DELTA):
self.hero.preferences.set(relations.PREFERENCE_TYPE.ENEMY, self.places[0].persons[0])
def test_tax(self):
self.places[0].attrs.size = 10
self.places[0].refresh_attributes()
self.assertEqual(self.places[0].attrs.tax, 0)
with self.check_almost_delta(self.place_0_cost, c.PATH_MODIFIER_NORMAL_DELTA):
self.create_effect(self.places[0].id,
value=100,
attribute=places_relations.ATTRIBUTE.TAX,
delta=0)
self.places[0].refresh_attributes()
HABITS_DELTAS = [(-1, -1, -c.PATH_MODIFIER_MINOR_DELTA),
(-1, 0, 0),
(-1, +1, +c.PATH_MODIFIER_MINOR_DELTA),
( 0, -1, 0),
( 0, 0, 0),
( 0, +1, 0),
(+1, -1, +c.PATH_MODIFIER_MINOR_DELTA),
(+1, 0, 0),
(+1, +1, -c.PATH_MODIFIER_MINOR_DELTA)]
def test_habits__honor(self):
for place_direction, hero_direction, expected_delta in self.HABITS_DELTAS:
self.places[0].habit_honor.set_habit(0)
self.hero.habit_honor.set_habit(0)
with self.check_almost_delta(self.place_0_cost, expected_delta):
self.places[0].habit_honor.set_habit(place_direction * c.HABITS_BORDER)
self.hero.habit_honor.set_habit(hero_direction * c.HABITS_BORDER)
def test_habits__peacefulness(self):
for place_direction, hero_direction, expected_delta in self.HABITS_DELTAS:
self.places[0].habit_peacefulness.set_habit(0)
self.hero.habit_peacefulness.set_habit(0)
with self.check_almost_delta(self.place_0_cost, expected_delta):
self.places[0].habit_peacefulness.set_habit(place_direction * c.HABITS_BORDER)
self.hero.habit_peacefulness.set_habit(hero_direction * c.HABITS_BORDER)
| 44.688406 | 137 | 0.652749 | 1 | 1.7526 | [
-0.02659147046506405,
0.038417574018239975,
0.02172376587986946,
0.02528240531682968,
0.010905924253165722,
0.0024420435074716806,
0.02360437624156475,
0.006718222983181477,
-0.02009127289056778,
0.01304675918072462,
-0.014087431132793427,
-0.004456786904484034,
0.025671260431408882,
-0.015553838573396206,
-0.021361373364925385,
-0.023166751489043236,
0.08969783782958984,
0.004793851636350155,
-0.022150026634335518,
0.019722063094377518,
0.027523217722773552,
0.020877650007605553,
-0.031795527786016464,
0.02166777476668358,
0.015228377655148506,
0.03801693767309189,
0.0566670186817646,
0.005386877339333296,
0.01413856353610754,
-0.04211058467626572,
0.02288784459233284,
0.019538583233952522,
-0.0029416107572615147,
0.02181675098836422,
-0.014486292377114296,
-0.007180954795330763,
-0.023611940443515778,
-0.08076582103967667,
0.04786663129925728,
-0.010184570215642452,
-0.0238397978246212,
-0.028961775824427605,
-0.02849455736577511,
-0.05243704095482826,
0.011798419989645481,
-0.028467359021306038,
-0.03977089375257492,
0.026926958933472633,
-0.018700305372476578,
0.0231940858066082,
-0.02806672267615795,
-0.03384629264473915,
-0.027266643941402435,
0.01174202375113964,
0.020647410303354263,
-0.04672122374176979,
0.014281786978244781,
0.05172120779752731,
-0.038013309240341187,
-0.02559962309896946,
-0.014856687746942043,
-0.005597097799181938,
0.01316605694591999,
0.013083640486001968,
-0.021017499268054962,
0.0014634478138759732,
0.006184795405715704,
0.008470745757222176,
-0.01024620421230793,
0.026304014027118683,
-0.008851214312016964,
0.0103926295414567,
0.05356145650148392,
0.013978088274598122,
-0.02191099524497986,
0.002319896128028631,
-0.009199793450534344,
-0.03934828191995621,
-0.06223348528146744,
-0.014190368354320526,
-0.026363197714090347,
0.07881087809801102,
0.011959433555603027,
-0.069330595433712,
0.02703186497092247,
0.003866766346618533,
0.034317679703235626,
-0.053269367665052414,
0.042744092643260956,
0.01828448660671711,
-0.024541638791561127,
-0.028369732201099396,
0.005783022381365299,
-0.0015708255814388394,
-0.04555971547961235,
-0.061221010982990265,
0.027096843346953392,
-0.011343460530042648,
0.028461340814828873,
-0.016019726172089577,
0.016806352883577347,
-0.05613275617361069,
0.02571052312850952,
-0.002745856996625662,
-0.004940047860145569,
0.01208532229065895,
-0.039594002068042755,
-0.011752046644687653,
-0.0010803061304613948,
-0.01862889714539051,
-0.03919699043035507,
0.01653556525707245,
-0.03650994971394539,
-0.0215066596865654,
-0.04158259928226471,
-0.02297205477952957,
0.015516849234700203,
0.013573918491601944,
0.009221451357007027,
0.00012270474690012634,
-0.003987661097198725,
-0.009172508493065834,
0.008731145411729813,
-0.0014752811985090375,
0.01360021997243166,
0.10533834993839264,
-0.04695679247379303,
0.035775937139987946,
0.004438417963683605,
-0.025710077956318855,
0.0016109987627714872,
0.014083335176110268,
-0.04975238814949989,
-0.005378029774874449,
0.02238457277417183,
0.026744022965431213,
0.0008973113144747913,
0.004214925225824118,
-0.056895166635513306,
-0.0066174669191241264,
-0.005526755005121231,
0.038253139704465866,
-0.018129786476492882,
0.009591794572770596,
0.03622895106673241,
-0.06854312121868134,
-0.007898812182247639,
-0.01225688960403204,
-0.007032674737274647,
-0.01807590201497078,
0.001307907048612833,
0.027065439149737358,
0.003602644195780158,
0.012021663598716259,
0.020577307790517807,
0.016323622316122055,
0.036415230482816696,
-0.02044646441936493,
0.020515508949756622,
-0.014936274848878384,
-0.017493998631834984,
0.02798093855381012,
0.013504165224730968,
0.005450535099953413,
0.039663590490818024,
0.010184117592871189,
-0.014584309421479702,
0.02744055539369583,
-0.000962614081799984,
0.01942693069577217,
-0.0037299073301255703,
-0.028560714796185493,
-0.020905066281557083,
-0.04610496759414673,
0.012534444220364094,
-0.02063988521695137,
0.03218395262956619,
0.0014143744483590126,
0.0194619819521904,
-0.009925811551511288,
-0.006380302831530571,
-0.0436968095600605,
0.02417345903813839,
-0.005483333487063646,
-0.029000848531723022,
0.019760306924581528,
-0.014690574258565903,
-0.023026565089821815,
0.0131031209602952,
-0.0068573905155062675,
0.012998552061617374,
0.06109578162431717,
0.0336848683655262,
-0.0043290103785693645,
-0.004186357371509075,
-0.028015628457069397,
0.011682027019560337,
-0.01190272904932499,
0.032719653099775314,
-0.029594169929623604,
-0.021317608654499054,
0.010450214147567749,
-0.007116560824215412,
-0.0009696931228972971,
-0.011523319408297539,
0.020261645317077637,
-0.6468873620033264,
0.027648596093058586,
-0.013033391907811165,
-0.011648103594779968,
0.02283322438597679,
0.00027988062356598675,
-0.03305099904537201,
0.010016286745667458,
0.06241545453667641,
0.022855380550026894,
-0.024912415072321892,
-0.0007154178456403315,
-0.031875625252723694,
0.016540488228201866,
-0.04263840615749359,
0.006443324964493513,
-0.049135658890008926,
-0.015497288666665554,
-0.010845424607396126,
0.002351866802200675,
0.02163456752896309,
-0.07856379449367523,
0.02852197363972664,
0.010378667153418064,
0.03812304884195328,
-0.05894509702920914,
-0.019048279151320457,
-0.024545354768633842,
-0.013043134473264217,
0.006490147672593594,
0.010043536312878132,
0.00814757775515318,
0.0053415847942233086,
-0.012397736310958862,
-0.0018914102111011744,
-0.0003549334069248289,
0.005877391900867224,
-0.01822461374104023,
-0.010660217143595219,
0.004221643786877394,
-0.00601896783336997,
-0.024870073422789574,
-0.00800724420696497,
-0.07488542050123215,
-0.03993287682533264,
-0.014074381440877914,
0.031222043558955193,
-0.012741395272314548,
0.0014183450257405639,
-0.0189550518989563,
-0.039430633187294006,
0.016238482668995857,
0.022406818345189095,
0.02429124526679516,
-0.010246027261018753,
0.004635343793779612,
0.02921217493712902,
-0.005884419661015272,
-0.011031145229935646,
-0.01926974579691887,
-0.00502863060683012,
-0.03145412728190422,
-0.011614842340350151,
0.019097547978162766,
-0.047942690551280975,
0.012196101248264313,
0.02065698616206646,
-0.03141552954912186,
-0.035639382898807526,
0.0272962786257267,
-0.03545121103525162,
0.039733197540044785,
-0.023860208690166473,
0.011698374524712563,
-0.014776417054235935,
0.025552699342370033,
-0.012604259885847569,
-0.007456422783434391,
-0.061410821974277496,
-0.009705225937068462,
0.007388503290712833,
-0.01251845434308052,
0.022893082350492477,
-0.02097317762672901,
0.010159558616578579,
-0.014333394356071949,
-0.00707064475864172,
-0.05214768275618553,
-0.016915464773774147,
0.010153435170650482,
-0.02625923417508602,
-0.0022152874153107405,
-0.0006876055267639458,
0.006814427673816681,
0.019656101241707802,
-0.005430108401924372,
0.02758435159921646,
-0.03528071567416191,
-0.013260144740343094,
0.002310126554220915,
-0.06951824575662613,
-0.0007295763352885842,
-0.010524705052375793,
0.012611505575478077,
-0.047232333570718765,
0.032903559505939484,
-0.048841457813978195,
-0.030808258801698685,
0.014342138543725014,
0.033999767154455185,
-0.022916048765182495,
-0.03376815840601921,
-0.0390487015247345,
0.03209725394845009,
-0.026862161234021187,
-0.014228318817913532,
-0.009601450525224209,
-0.05629030242562294,
0.013510522432625294,
-0.0017230990342795849,
-0.0021026504691690207,
0.03745030611753464,
0.023987116292119026,
0.010516619309782982,
0.011460122652351856,
0.020950602367520332,
0.0019801082089543343,
0.031063392758369446,
0.0016704783774912357,
0.01506740041077137,
-0.02206711657345295,
-0.025504199787974358,
0.033925700932741165,
-0.007448950316756964,
0.009779756888747215,
0.0016099560307338834,
-0.005533555988222361,
-0.04581979662179947,
0.01782575435936451,
-0.015482407994568348,
-0.08705449104309082,
-0.004439007490873337,
0.020046310499310493,
-0.0029545440338552,
0.04198327660560608,
0.03816169872879982,
-0.023068081587553024,
0.006737783085554838,
-0.04434121027588844,
0.0021077399142086506,
0.020291537046432495,
0.0179761853069067,
0.016679449006915092,
-0.0030789778102189302,
-0.044053997844457626,
0.001669140881858766,
0.015527555719017982,
0.01709577813744545,
0.0058678616769611835,
0.007910680957138538,
-0.009160216897726059,
0.023362236097455025,
-0.04587382450699806,
0.015130525454878807,
-0.01943942718207836,
0.007914054207503796,
0.005364019423723221,
-0.01666632667183876,
-0.0025910306721925735,
0.03225541487336159,
0.002864199923351407,
0.005872787442058325,
-0.018209513276815414,
0.07890520989894867,
0.023868035525083542,
0.008890950120985508,
-0.03206649422645569,
-0.02625950798392296,
-0.039696838706731796,
0.018599187955260277,
0.07257620245218277,
0.012542934156954288,
0.009946306236088276,
0.015028300695121288,
-0.026151681318879128,
0.01906900480389595,
0.006415094714611769,
-0.012367116287350655,
-0.004217973910272121,
-0.006626920308917761,
0.018424464389681816,
0.0014750491827726364,
-0.03049425594508648,
-0.004128097090870142,
0.029320256784558296,
-0.006162034347653389,
-0.017345258966088295,
0.009856152348220348,
0.04554470628499985,
-0.012386258691549301,
-0.03593948483467102,
0.031234920024871826,
-0.01913977600634098,
-0.018697038292884827,
0.017940280959010124,
0.04243297129869461,
-0.012162342667579651,
0.02962302416563034,
0.043540336191654205,
0.02155693620443344,
0.0194514449685812,
0.006376844365149736,
0.026137221604585648,
0.034878022968769073,
0.022480810061097145,
0.06397788226604462,
-0.02560894377529621,
-0.048298757523298264,
0.03677896410226822,
-0.02136910893023014,
-0.032424598932266235,
-0.05599932000041008,
-0.00024667216348461807,
0.009256881661713123,
-0.017668284475803375,
0.0206765066832304,
-0.02447648160159588,
-0.024086710065603256,
-0.002034008502960205,
-0.014378625899553299,
-0.02270582690834999,
-0.06661371141672134,
-0.004296209197491407,
-0.03753301873803139,
-0.012951180338859558,
0.02719135396182537,
0.004895170219242573,
-0.022547172382473946,
0.02957107499241829,
0.011762545444071293,
0.018901143223047256,
0.021823227405548096,
-0.001990941818803549,
0.013641046360135078,
-0.02044251188635826,
-0.01781015656888485,
-0.013393794186413288,
-0.03317451849579811,
-0.007011178880929947,
-0.0307406447827816,
0.008433599025011063,
0.07363913208246231,
0.02885199710726738,
-0.024821028113365173,
-0.004264285322278738,
-0.006706989370286465,
0.005899098236113787,
0.01228230819106102,
0.04516948387026787,
-0.004775706212967634,
-0.020547516644001007,
0.01615532860159874,
0.007939768955111504,
0.04775407165288925,
-0.03691086918115616,
0.04111814871430397,
0.01451647188514471,
0.004751494619995356,
0.03008851408958435,
-0.0005121906287968159,
0.004192890599370003,
0.002036713296547532,
-0.002652520779520273,
-0.016763407737016678,
0.0617779940366745,
-0.04389086365699768,
-0.0007788778166286647,
-0.01669265516102314,
-0.01647588238120079,
0.025574350729584694,
-0.0029397003818303347,
0.00571393920108676,
0.003349733306095004,
0.02935834974050522,
-0.006489204242825508,
0.008805771358311176,
0.054520171135663986,
0.015529469586908817,
-0.04658065363764763,
-0.00952246692031622,
-0.020220965147018433,
-0.002682490274310112,
0.08470341563224792,
-0.029690856114029884,
0.047797687351703644,
-0.002947916043922305,
0.014941001310944557,
-0.006963981781154871,
-0.015035265125334263,
-0.00733863515779376,
0.03953117877244949,
-0.03154189884662628,
-0.007080800831317902,
-0.0006274746265262365,
0.03735631704330444,
-0.02452547661960125,
0.017794422805309296,
-0.016640620306134224,
0.0428391769528389,
-0.00730157969519496,
0.0448136143386364,
-0.017437152564525604,
0.0034339060075581074,
0.04240557178854942,
0.014824324287474155,
-0.008603031747043133,
0.04820847883820534,
-0.035925015807151794,
0.02994377352297306,
0.006613987497985363,
-0.037729959934949875,
0.02076135389506817,
-0.021124333143234253,
0.014283372089266777,
0.011668487451970577,
-0.013201183639466763,
-0.05375758558511734,
-0.024358535185456276,
0.032330479472875595,
0.01926433853805065,
0.03283609077334404,
-0.057728689163923264,
0.013268527574837208,
0.002799232490360737,
0.03785444051027298,
0.036278702318668365,
0.0014563949080184102,
0.017588596791028976,
0.0064451429061591625,
0.023402461782097816,
-0.01491748820990324,
0.03195052593946457,
-0.012335270643234253,
-0.021760111674666405,
0.03658326715230942,
-0.028897887095808983,
0.03865022212266922,
0.016453208401799202,
0.02023976854979992,
0.013166112825274467,
-0.0009346063598059118,
0.004474778193980455,
0.01077252347022295,
-0.005534955766052008,
-0.004219371359795332,
0.046296488493680954,
-0.002029081340879202,
0.005738535895943642,
0.04680437594652176,
0.02617291361093521,
-0.014149014838039875,
0.016756657510995865,
0.00029289867961779237,
-0.0033005743753165007,
-0.04602651670575142,
0.002707413397729397,
0.06265032291412354,
-0.03218313679099083,
-0.010381879284977913,
0.0015968529041856527,
-0.04824820160865784,
-0.018920503556728363,
0.05069464072585106,
0.023457156494259834,
0.046484578400850296,
0.00020078738452866673,
0.03478022664785385,
-0.0018691385630518198,
-0.0178696196526289,
-0.010211543180048466,
-0.026823796331882477,
-0.008437315002083778,
-0.013594400137662888,
-0.02000887505710125,
-0.02542940154671669,
-0.02966136485338211,
0.009422028437256813,
0.03967626020312309,
-0.06632346659898758,
-0.00002582164597697556,
0.03814190626144409,
0.014177203178405762,
0.033862996846437454,
0.029976876452565193,
-0.025588398799300194,
-0.011305490508675575,
-0.029117561876773834,
-0.016735799610614777,
-0.019905105233192444,
0.018938571214675903,
0.008170457556843758,
0.008964486420154572,
0.03136561065912247,
-0.004716494120657444,
-0.010701178573071957,
-0.04042087122797966,
0.029662111774086952,
0.0194125697016716,
-0.02082841284573078,
-0.026014262810349464,
0.011925323866307735,
0.03303546458482742,
-0.02276800386607647,
-0.03703536465764046,
0.0320589542388916,
0.012905492447316647,
0.01188391912728548,
0.02332327514886856,
0.0010891457786783576,
0.03382973372936249,
-0.045725349336862564,
0.04450583830475807,
0.004378119949251413,
0.01615554839372635,
0.008215372450649738,
0.00890161283314228,
-0.008376258425414562,
0.0192736629396677,
0.039508718997240067,
0.03058081492781639,
0.02659008838236332,
-0.009565688669681549,
-0.025647737085819244,
-0.03654585778713226,
0.006397165358066559,
-0.03311024233698845,
-0.005546239670366049,
-0.006886555813252926,
0.034907665103673935,
0.0033126568887382746,
-0.04273277893662453,
-0.058820441365242004,
-0.04303745552897453,
0.03970964625477791,
-0.07355470210313797,
-0.054448068141937256,
-0.016696183010935783,
-0.0028990476857870817,
0.007150324992835522,
0.005874663591384888,
-0.038886163383722305,
0.027060044929385185,
-0.01801558956503868,
-0.03520147502422333,
0.0035566396545618773,
0.015103314071893692,
-0.003968503326177597,
0.013978232629597187,
-0.019535431638360023,
-0.012386994436383247,
0.008042493835091591,
0.011564123444259167,
0.022552544251084328,
0.031102163717150688,
0.005788637325167656,
0.03746563196182251,
0.011649567633867264,
0.0018236327450722456,
0.023682711645960808,
-0.014686633832752705,
-0.003430295968428254,
0.007536767516285181,
0.014704220928251743,
0.012941558845341206,
0.005514502990990877,
-0.01710471697151661,
-0.025828102603554726,
0.014305355958640575,
0.03718602657318115,
0.020484138280153275,
0.020027562975883484,
-0.002074438612908125,
0.007383438758552074,
0.019355405122041702,
0.008259973488748074,
-0.019404182210564613,
-0.011902986094355583,
0.06398061662912369,
0.002887106267735362,
0.006260387599468231,
-0.019696751609444618,
-0.037215907126665115,
-0.004533857107162476,
-0.011139700189232826,
0.01135853212326765,
-0.002775410423055291,
0.00062366429483518,
0.0007693709922023118,
0.03193249925971031,
-0.05393784120678902,
0.03469039127230644,
0.013722250238060951,
0.04367828741669655,
-0.002780822804197669,
0.009519027546048164,
0.011318691074848175,
0.002384996274486184,
0.025930307805538177,
-0.039005495607852936,
-0.017186926677823067,
-0.005666793789714575,
-0.0010547259589657187,
0.00802233349531889,
0.0018636666936799884,
-0.001098630833439529,
0.010284650139510632,
0.031057603657245636,
-0.012063669040799141,
0.018177764490246773,
-0.004273590631783009,
0.004822608083486557,
-0.03318090736865997,
-0.023273270577192307,
0.0028937687166035175,
-0.014461089856922626,
-0.023809393867850304,
-0.06012551486492157,
-0.021169181913137436,
-0.005005925428122282,
-0.012258580885827541,
0.029090313240885735,
0.015383461490273476,
-0.01923488825559616,
-0.02421349100768566,
-0.003355890978127718,
0.0025009531527757645,
-0.010034813545644283,
0.029875466600060463,
-0.018913904204964638,
-0.06815901398658752,
0.03147663548588753,
0.023918094113469124,
0.005112872924655676,
-0.01899610459804535,
-0.002502723829820752,
0.025328882038593292,
0.028128916397690773,
-0.008089235052466393,
0.01780145987868309,
-0.03607792407274246,
-0.0028006192296743393,
0.009349009953439236,
0.035705361515283585,
-0.007383119780570269,
-0.020308425650000572,
-0.024454714730381966,
0.00920272059738636,
0.126973956823349,
-0.02631719596683979,
-0.03021610528230667,
-0.04777044802904129,
0.0026280884630978107
] |
8a7fb03f3abaa9ff95210abc3bc840c8008d9076 | 41 | py | Python | tinylinks/tests/test_app/models.py | brad/django-tinylinks | b3ae58ebe0d0292b7f618e9b0f1a08d2fb61b173 | [
"MIT"
] | 11 | 2016-11-27T15:46:42.000Z | 2021-07-31T14:03:54.000Z | tinylinks/tests/test_app/models.py | brad/django-tinylinks | b3ae58ebe0d0292b7f618e9b0f1a08d2fb61b173 | [
"MIT"
] | 2 | 2016-12-27T19:53:59.000Z | 2017-05-26T07:12:02.000Z | tinylinks/tests/test_app/models.py | brad/django-tinylinks | b3ae58ebe0d0292b7f618e9b0f1a08d2fb61b173 | [
"MIT"
] | 5 | 2015-02-01T01:10:31.000Z | 2015-10-29T18:48:59.000Z | """Dummy model needed for tests."""
pass
| 13.666667 | 35 | 0.682927 | 2 | 0.6336 | [
-0.0009328441228717566,
0.02192559652030468,
0.009442870505154133,
-0.00040873343823477626,
0.0063268751837313175,
-0.006712011527270079,
-0.011994640342891216,
0.004915621597319841,
-0.005907569080591202,
-0.0012241373769938946,
0.002605827059596777,
0.0029067841824144125,
0.008484164252877235,
-0.013028882443904877,
0.004723281599581242,
0.02038750983774662,
-0.06277354806661606,
0.004201098345220089,
-0.006988330278545618,
0.0016031588893383741,
-0.005298983305692673,
0.011291299015283585,
0.007673187181353569,
0.006305371411144733,
0.005250302609056234,
0.002851874101907015,
0.011482426896691322,
0.0069994842633605,
-0.007882993668317795,
-0.0048710354603827,
0.002185679506510496,
-0.0006635297904722393,
-0.008602779358625412,
-0.008721883408725262,
0.007688514422625303,
-0.001939413952641189,
0.00025048284442164004,
-0.020554613322019577,
0.011151731014251709,
-0.00676994863897562,
-0.006050795316696167,
-0.02240813337266445,
-0.0004429324471857399,
0.00587268453091383,
-0.013841076754033566,
0.004963268991559744,
-0.0003201247891411185,
0.006099851801991463,
-0.011707262136042118,
0.005899324081838131,
-0.01166503131389618,
0.004104922991245985,
0.016394147649407387,
0.004380546975880861,
-0.007534747943282127,
-0.007982182316482067,
0.009293412789702415,
-0.000206431228434667,
-0.011951234191656113,
0.00270168692804873,
-0.004695483483374119,
-0.007163838017731905,
0.0026720641180872917,
0.001803603838197887,
-0.02018532156944275,
-0.0021121434401720762,
-0.004463403485715389,
0.0036947501357644796,
-0.0024640040937811136,
0.007150591351091862,
0.0007745865150354803,
-0.0026009217835962772,
0.0067886002361774445,
0.0008759402553550899,
0.003201595041900873,
0.0006614348385483027,
-0.0012788842432200909,
0.008193334564566612,
0.00876845046877861,
0.0027800092939287424,
0.0037808269262313843,
-0.01020108349621296,
0.007384434808045626,
0.013990890234708786,
0.01370471715927124,
0.010764590464532375,
0.01685129664838314,
-0.01240807306021452,
0.03983603045344353,
0.004151563625782728,
-0.011249043047428131,
0.002972338115796447,
-0.004932264797389507,
-0.0008725239895284176,
0.0003780825063586235,
-0.03186318278312683,
-0.0009443230810575187,
-0.005511571187525988,
-0.0007779491133987904,
0.004468847066164017,
-0.0026776345912367105,
0.0035319889429956675,
-0.004717194940894842,
-0.0006021299050189555,
-0.011684145778417587,
0.013501223176717758,
-0.00876419898122549,
-0.0021983778569847345,
0.008872058242559433,
0.004490470513701439,
-0.015240001492202282,
0.001503790495917201,
0.0011688773520290852,
-0.012817930430173874,
0.005422730930149555,
0.0031447208020836115,
-0.005980898626148701,
0.05918731540441513,
-0.0022743954323232174,
0.001166839268989861,
-0.004635571967810392,
-0.004528670571744442,
0.0031295022927224636,
0.006012719124555588,
0.010235295630991459,
-0.00855221413075924,
0.01020398922264576,
0.004106390755623579,
0.002297062426805496,
0.005317242816090584,
0.0014030722668394446,
0.010031227953732014,
-0.0027858386747539043,
-0.0025752498768270016,
-0.0011906627332791686,
-0.008256609551608562,
0.007576687261462212,
-0.0006970103713683784,
-0.0032020295038819313,
-0.0006854755338281393,
-0.004035893827676773,
-0.013012549839913845,
-0.0009136985172517598,
-0.003843056969344616,
0.0014330948470160365,
-0.012484598904848099,
-0.007306721061468124,
-0.0005725583760067821,
-0.003856789320707321,
0.003589640837162733,
0.006604162976145744,
0.004528574179857969,
0.001172708347439766,
-0.0053863562643527985,
-0.007776736281812191,
-0.0022926167584955692,
-0.00668811472132802,
0.003758861683309078,
0.011328393593430519,
0.0037946978118270636,
-0.006796716712415218,
-0.005708211101591587,
0.0048790257424116135,
0.0022584195248782635,
-0.0016962775262072682,
0.00030613120179623365,
-0.006850037258118391,
0.009077543392777443,
0.0017323982901871204,
0.0019152306485921144,
0.008683829568326473,
-0.004435678478330374,
-0.0007013626163825393,
0.0009294045157730579,
0.0003952761762775481,
0.0005902298144064844,
0.002904005814343691,
0.010094604454934597,
-0.007333945482969284,
-0.006314517930150032,
0.0059883068315684795,
0.0020811627618968487,
0.009358465671539307,
0.011506067588925362,
-0.004325038753449917,
0.003014602465555072,
0.00027789996238425374,
0.0024314154870808125,
0.004911827854812145,
-0.004090475849807262,
0.011476578190922737,
0.001544126425869763,
-0.012139644473791122,
-0.007159346714615822,
-0.0017747948877513409,
-0.013293835334479809,
-0.0012104494962841272,
0.01742500439286232,
0.010974837467074394,
-0.00018686246767174453,
0.001430013682693243,
-0.011446980759501457,
0.001629869919270277,
0.00547003885731101,
0.00270088785327971,
-0.01260264590382576,
-0.9504789113998413,
0.0014128221664577723,
0.0007684716838411987,
0.001095177256502211,
0.0015051531372591853,
0.002659449353814125,
0.0055395131930708885,
0.0023184337187558413,
0.016047600656747818,
-0.010587135329842567,
-0.005936052184551954,
-0.00895692128688097,
-0.011744416318833828,
0.0037884360644966364,
-0.00854458101093769,
-0.004843713715672493,
-0.003916259855031967,
-0.006268433760851622,
-0.0010877352906391025,
-0.006537755019962788,
-0.0020822593942284584,
0.012702282518148422,
-0.00024102377938106656,
0.004299928899854422,
0.004481549374759197,
0.005464437883347273,
-0.0037866707425564528,
0.0005257540615275502,
-0.0017110788030549884,
0.0006280456436797976,
-0.007110288832336664,
-0.017202774062752724,
-0.006916482467204332,
-0.001143094152212143,
0.013971298933029175,
-0.0019192106556147337,
0.005668122787028551,
-0.0010799869196489453,
0.0016514005837962031,
-0.011367784813046455,
0.00401061587035656,
0.004357962403446436,
0.006144744344055653,
-0.02844681404531002,
0.0034376548137515783,
0.0010551192099228501,
-0.005908816121518612,
0.009536528959870338,
0.0037507961969822645,
-0.001106727053411305,
-0.0003213570162188262,
-0.004430608358234167,
0.009893816895782948,
-0.009326895698904991,
0.006894652731716633,
-0.007112995255738497,
-0.0036720833741128445,
-0.0006380768027156591,
-0.011869288049638271,
0.0022308523766696453,
0.00647258386015892,
-0.0036103161983191967,
-0.00008849044388625771,
-0.004767699167132378,
0.0035146891605108976,
-0.0009684024844318628,
-0.00045799085637554526,
-0.015027409419417381,
-0.003464458743110299,
-0.0036382738035172224,
0.006484426558017731,
-0.001481499639339745,
-0.0042656464502215385,
0.0034870151430368423,
-0.010953078046441078,
0.005267659667879343,
0.00268375501036644,
0.00041275116382166743,
-0.005827097687870264,
0.0051878709346055984,
-0.008577493950724602,
-0.008830207400023937,
0.005139589309692383,
-0.007293009199202061,
-0.005334209650754929,
0.003660681424662471,
0.007294557057321072,
0.007108006626367569,
-0.0037076319567859173,
0.003680236404761672,
0.010573827661573887,
-0.007814018987119198,
-0.010049032047390938,
0.007500108331441879,
0.0054978071711957455,
0.0016104977112263441,
-0.002395380288362503,
-0.0016190593596547842,
0.009205187670886517,
0.007304156199097633,
0.0018499556463211775,
0.005222715903073549,
-0.0007280216668732464,
0.008782116696238518,
0.004065636545419693,
0.004377108067274094,
-0.00019161557429470122,
-0.0024880447890609503,
-0.0036663261707872152,
0.0009276990895159543,
-0.005656542722135782,
-0.001265052822418511,
-0.009928446263074875,
-0.011646735481917858,
-0.003315430134534836,
0.002623100997880101,
-0.0013926764950156212,
-0.0029126431327313185,
0.0016406882787123322,
0.0004817844310309738,
0.014542433433234692,
0.0019883536733686924,
-0.002392543014138937,
0.003108600853011012,
0.004179648123681545,
-0.007313040550798178,
0.017007768154144287,
-0.011215800419449806,
0.0076871900819242,
-0.002257308457046747,
-0.014147627167403698,
0.011673029512166977,
0.009453422389924526,
-0.006201633717864752,
0.001828153501264751,
-0.0005238297744654119,
0.0019495993619784713,
0.0024320038501173258,
-0.0076822079718112946,
-0.0030557075515389442,
-0.02155233360826969,
-0.00045095226960256696,
0.020816506817936897,
0.007377543020993471,
0.010117916390299797,
0.011505707167088985,
-0.00262841721996665,
0.0022140585351735353,
0.007277362979948521,
0.001566465711221099,
0.016127265989780426,
-0.00904095359146595,
-0.0013928599655628204,
0.00007682693831156939,
-0.0038992599584162235,
0.0034569285344332457,
0.0026302761398255825,
0.0028765792958438396,
-0.001415494130924344,
-0.000737030350137502,
-0.0023430343717336655,
-0.004463571589440107,
-0.017231931909918785,
-0.0019425186328589916,
0.010198098607361317,
-0.0035649326164275408,
0.004416295327246189,
-0.012146727181971073,
0.0022026309743523598,
0.003877676324918866,
-0.0001297435665037483,
0.000223356721107848,
-0.0008207318605855107,
0.007274430710822344,
0.011496416293084621,
-0.006852924358099699,
0.003279211698099971,
0.0013325016479939222,
-0.001455265679396689,
0.00464525306597352,
0.008542686700820923,
-0.008418308570981026,
-0.00288118957541883,
0.003251877147704363,
0.0007044168887659907,
0.001118714571930468,
-0.003116114065051079,
-0.011162832379341125,
-0.0018545151688158512,
0.005246375221759081,
-0.0029719374142587185,
0.004302428103983402,
0.004548697266727686,
0.0057258279994130135,
-0.010335972532629967,
0.0005678020534105599,
-0.006708867847919464,
-0.00783863291144371,
0.008755614049732685,
-0.0019494955195114017,
0.002095655770972371,
0.011752382852137089,
0.003336312249302864,
-0.011696540750563145,
0.006784356664866209,
0.00601806677877903,
-0.004639417864382267,
0.005198371130973101,
0.0050365799106657505,
-0.006450680550187826,
-0.02550620026886463,
0.0011302211787551641,
-0.01777954027056694,
0.008325815200805664,
-0.0028298753313720226,
0.0011769164120778441,
-0.007596820127218962,
0.008849654346704483,
0.006141943391412497,
-0.011715557426214218,
-0.0035923048853874207,
-0.0115023422986269,
0.007289000786840916,
-0.0024886392056941986,
-0.004199030343443155,
-0.003455163910984993,
-0.0019582544919103384,
-0.006106254179030657,
-0.0014277223963290453,
0.0023437398485839367,
0.004526255186647177,
0.002815615851432085,
-0.009028098545968533,
0.0013896701857447624,
-0.0028508147224783897,
-0.0017976510571315885,
0.005517533048987389,
-0.011466797441244125,
-0.00048535087262280285,
0.00944430474191904,
-0.004411492496728897,
-0.003002680605277419,
0.00008895707287592813,
-0.0012863356387242675,
-0.0030327588319778442,
-0.011963332071900368,
-0.003871886059641838,
-0.006344432011246681,
-0.004318376071751118,
-0.008544137701392174,
-0.0005763562512584031,
-0.006367367226630449,
0.006064982153475285,
-0.008528155274689198,
0.007696391083300114,
0.005308585707098246,
-0.005145117174834013,
0.0065943594090640545,
-0.004253281746059656,
0.003819998586550355,
0.0045182774774730206,
0.0064849876798689365,
0.0005205320194363594,
-0.007376078050583601,
-0.009624924510717392,
0.011389107443392277,
-0.009793664328753948,
-0.0012589344987645745,
0.015563542023301125,
0.005016971845179796,
0.00985761173069477,
0.004066751338541508,
-0.0018725269474089146,
0.008123654872179031,
0.007822050713002682,
-0.01798028126358986,
0.0005499168182723224,
-0.0006800819537602365,
-0.0025491544511169195,
0.0075207422487437725,
-0.005582546815276146,
0.003157651284709573,
0.005771479569375515,
0.0034509976394474506,
-0.006593690253794193,
-0.002800782211124897,
-0.0004050645511597395,
0.004186078440397978,
-0.008498677052557468,
0.0007955627515912056,
-0.003176027676090598,
-0.0063916645012795925,
-0.006500420160591602,
-0.0045820847153663635,
-0.0022262593265622854,
0.007392453029751778,
-0.0012942202156409621,
0.005973495543003082,
0.002170628635212779,
-0.004105646163225174,
0.014256062917411327,
-0.006611825432628393,
-0.004562688060104847,
0.0013965385733172297,
-0.00015117527800612152,
-0.0002520501147955656,
-0.009961996227502823,
-0.004078569356352091,
0.0002021620312007144,
0.003961064387112856,
-0.0024243933148682117,
-0.011379001662135124,
-0.0031334368977695704,
-0.00029292627004906535,
-0.007068860810250044,
0.0016518672928214073,
0.006609264761209488,
0.0030185480136424303,
0.002309692557901144,
0.00048035895451903343,
-0.0067007471807301044,
-0.016585370525717735,
0.057560671120882034,
-0.0008131895447149873,
0.0019275961676612496,
0.0066247065551579,
-0.008624388836324215,
-0.005691878497600555,
-0.0011933862697333097,
0.005602564197033644,
-0.0064493403770029545,
-0.00690339645370841,
0.010026832111179829,
-0.002843643771484494,
0.0005307118990458548,
-0.0011311843991279602,
-0.003003789810463786,
0.014353683218359947,
-0.006351199932396412,
-0.023030655458569527,
-0.013642188161611557,
0.010160133242607117,
-0.0018866123864427209,
-0.007036836817860603,
0.005239236168563366,
-0.0025848825462162495,
0.0003510633250698447,
-0.000953424780163914,
0.007899106480181217,
-0.0031320550478994846,
0.0010344948386773467,
-0.0029172254726290703,
-0.0017564777517691255,
0.003669129218906164,
0.003757850034162402,
0.008872734382748604,
0.009306960739195347,
-0.0025483309291303158,
0.006426486186683178,
-0.004899204708635807,
-0.0005939838592894375,
0.0008746981038711965,
0.004468846134841442,
0.006519102491438389,
-0.004038924351334572,
-0.0028061510529369116,
0.0026602272409945726,
0.0031647547148168087,
0.0008205248159356415,
0.01240414660423994,
0.002890883246436715,
-0.0019519253401085734,
0.00900494959205389,
0.009429873898625374,
-0.0033292067237198353,
0.006790284998714924,
-0.005491886753588915,
0.004345881287008524,
-0.0006330407341010869,
-0.009331117384135723,
-0.014321396127343178,
-0.0014048732118681073,
0.004376786295324564,
0.006672874093055725,
-0.0036153520923107862,
0.002371422713622451,
0.0023401090875267982,
-0.004380112048238516,
-0.010918499901890755,
-0.005470425356179476,
-0.0028227621223777533,
0.0004065070825163275,
0.002141938777640462,
0.07263718545436859,
-0.004192202817648649,
-0.005089086480438709,
-0.00932885892689228,
0.003936725668609142,
0.0018490286311134696,
-0.000339190213708207,
-0.0023309874814003706,
-0.0029508552979677916,
0.0036070107016712427,
0.003024157602339983,
-0.01130257360637188,
-0.010548452846705914,
0.0024521476589143276,
0.0010202834382653236,
-0.001472783857025206,
0.0020630767103284597,
0.006406292784959078,
-0.007102899253368378,
0.004147945437580347,
-0.010453653521835804,
-0.0012573556741699576,
-0.005056010093539953,
-0.005870763212442398,
-0.004097304306924343,
-0.004213506821542978,
-0.001696377177722752,
0.0010367765789851546,
0.00781261920928955,
-0.003958315122872591,
0.006650738418102264,
0.0030688736587762833,
0.004199623130261898,
-0.0011627855710685253,
-0.0019859944004565477,
-0.007701164111495018,
0.006006249226629734,
0.00018743964028544724,
-0.013330873101949692,
-0.004085000604391098,
-0.006813099607825279,
-0.0007448861724697053,
-0.005675098393112421,
0.008565936237573624,
-0.00004418149546836503,
0.011949339881539345,
-0.0015266815898939967,
0.0038486476987600327,
-0.003282408230006695,
-0.001581168151460588,
-0.013551456853747368,
0.0009262445382773876,
-0.19652603566646576,
0.009917771443724632,
-0.00001218557281390531,
-0.0017435646150261164,
-0.0037938908208161592,
-0.01660054549574852,
-0.012507825158536434,
0.005907931365072727,
0.011560744605958462,
0.0005235010175965726,
0.001256065210327506,
-0.004144416656345129,
0.0053130146116018295,
0.005523900967091322,
-0.001569510204717517,
-0.006293146405369043,
0.0005905632860958576,
-0.005118082277476788,
-0.0020983191207051277,
0.006431916728615761,
0.006143894046545029,
0.010958366096019745,
0.002142920158803463,
0.0024061633739620447,
-0.0005460557877086103,
-0.004467400722205639,
0.004322318825870752,
-0.0017695784335955977,
0.005456725135445595,
-0.010797655209898949,
-0.0059030065312981606,
-0.005770512856543064,
-0.0031430877279490232,
0.004117392934858799,
0.0015181712806224823,
0.001700913649983704,
0.006431869231164455,
-0.00139778817538172,
-0.010235142894089222,
0.007626836653798819,
-0.006466343998908997,
0.03209809958934784,
0.005978072062134743,
0.008912824094295502,
-0.001021031872369349,
0.0007190443575382233,
-0.0035085424315184355,
0.010009923949837685,
0.0037689979653805494,
0.014322440139949322,
-0.009406913071870804,
-0.009630788117647171,
0.001626036362722516,
0.015733743086457253,
-0.00571875786408782,
-0.010324198752641678,
-0.00877348892390728,
-0.007822468876838684,
0.008634575642645359,
0.012186463922262192,
0.009618647396564484,
-0.0052767968736588955,
0.00840920303016901,
-0.002976188436150551,
-0.023381872102618217,
0.003404908115044236,
-0.0010023306822404265,
-0.01102426927536726,
0.0014269521925598383,
0.0052024731412529945,
0.012237238697707653,
-0.0059104920364916325,
0.007709601894021034,
-0.0016957538900896907,
0.003045427380129695,
-0.003730385797098279,
0.009331262670457363,
-0.0034785359166562557,
0.004746343940496445,
-0.006891411729156971,
0.012065568938851357,
-0.007731722202152014,
-0.001117509906180203,
0.0003206566907465458,
-0.0030442269053310156,
0.011942300014197826,
0.0075905052945017815,
-0.002256529638543725,
-0.001380801317282021,
-0.011361988261342049,
-0.00045540439896285534,
0.0037379099521785975,
0.0014574670931324363,
-0.006548471748828888,
0.00041514565236866474,
-0.0025637480430305004,
0.007647426798939705,
0.009585329331457615,
-0.005900498945266008,
0.003152094315737486,
0.0066575962118804455,
-0.009667606092989445,
0.001968016382306814,
-0.00803501158952713,
0.004768606275320053,
0.004396999720484018,
-0.0077089243568480015,
-0.011117171496152878,
0.0033958491403609514,
-0.005597996991127729,
-0.006858167704194784,
0.005758760962635279,
-0.01275967713445425,
-0.0068120271898806095,
0.00039909753832034767,
-0.012128761038184166,
0.0017439784714952111
] |
8a7fb88f2b8f8ab7d00332f23a58d29ccc1392ee | 1,346 | py | Python | postcipes/hydraulic_jump.py | timofeymukha/postcipes | f37b349038e26bb0295a2511295a46ef63fcd851 | [
"MIT"
] | null | null | null | postcipes/hydraulic_jump.py | timofeymukha/postcipes | f37b349038e26bb0295a2511295a46ef63fcd851 | [
"MIT"
] | null | null | null | postcipes/hydraulic_jump.py | timofeymukha/postcipes | f37b349038e26bb0295a2511295a46ef63fcd851 | [
"MIT"
] | 1 | 2019-03-20T22:39:55.000Z | 2019-03-20T22:39:55.000Z | # This file is part of postcipes
# (c) Timofey Mukha
# The code is released under the MIT Licence.
# See LICENCE.txt and the Legal section in the README for more information
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .postcipe import Postcipe
import turbulucid as tbl
from scipy.interpolate import interp1d
import numpy as np
import h5py
__all__ = ["HydraulicJump"]
class HydraulicJump(Postcipe):
def __init__(self, path):
Postcipe.__init__(self)
self.case = tbl.Case(path)
self.case['alphag'] = 1 - self.case['alpha.waterMean']
self.U = self.case.boundary_data("inlet", sort="y")[1]['UMean'][0, 0]
y_inlet = self.case.boundary_data("inlet", sort="y")[0][:, 1]
inlet_edge_length = tbl.edge_lengths(self.case, "inlet")
self.d = y_inlet[-1] + 0.5*inlet_edge_length[-1]
self.Fr1 = self.U/np.sqrt(9.81*self.d)
self.d2 = self.d*(np.sqrt(1 + 8*self.Fr1**2) - 1)/2
self.Fr2 = self.U/np.sqrt(9.81*self.d2)
iso05 = tbl.isoline(self.case, "alpha.waterMean", 0.5)
idx = iso05[:, 0].argsort()
self.xfs = iso05[idx, 0]
self.yfs = iso05[idx, 1]
idx_toe = np.argmin(np.abs(self.d*1.1 - self.yfs[:int(self.yfs.size/2)]))
self.xtoe = self.xfs[idx_toe]
| 33.65 | 81 | 0.653046 | 1 | 1.2486 | [
0.0018546541687101126,
0.022214310243725777,
0.00629404466599226,
0.0033312570303678513,
0.006123693194240332,
-0.0035021642688661814,
-0.0053225308656692505,
0.0016248230822384357,
-0.005883667152374983,
0.0035594673827290535,
0.003027408616617322,
0.0031794935930520296,
0.005745885893702507,
-0.015999810770154,
-0.00221288506872952,
0.016855565831065178,
-0.05162683501839638,
0.0038797359447926283,
-0.0030946105252951384,
0.0024049889761954546,
-0.007921379059553146,
0.00974216591566801,
0.007740438915789127,
0.006404568441212177,
0.005025200080126524,
-0.000547613191884011,
0.0069416239857673645,
0.0009820228442549706,
-0.006829474586993456,
-0.004822415765374899,
0.0002180864248657599,
-0.0020892603788524866,
-0.006802443880587816,
-0.00560391042381525,
0.005192008335143328,
-0.005547127686440945,
-0.00023613328812643886,
-0.021277237683534622,
0.011083242483437061,
-0.0035358346067368984,
-0.00675609614700079,
-0.013533880934119225,
0.0009326582076027989,
0.0027894629165530205,
-0.010458392091095448,
0.0015771110774949193,
-0.004399958066642284,
0.0022894730791449547,
-0.010042784735560417,
0.008520101197063923,
-0.006649032235145569,
0.004860889166593552,
0.013044333085417747,
0.0028789369389414787,
-0.007126998621970415,
-0.008029614575207233,
0.014097293838858604,
0.0005712794372811913,
-0.009231035597622395,
-0.00010520684736547992,
-0.0021347871515899897,
-0.004004329908639193,
0.002346935449168086,
0.0009258744539692998,
-0.015452958643436432,
-0.0070195808075368404,
-0.0058569819666445255,
0.0010362378088757396,
-0.002850719029083848,
0.006772089283913374,
0.0024167895317077637,
-0.0027375700883567333,
0.007553556933999062,
0.004848712123930454,
-0.00005553018854698166,
-0.006260959897190332,
-0.0021259798668324947,
-0.00011409600119804963,
0.008794562891125679,
0.004724584054201841,
0.005324431695044041,
-0.0070852539502084255,
0.00530259357765317,
0.007828284054994583,
0.011834471486508846,
0.009274923242628574,
0.01843794248998165,
-0.009277991019189358,
0.0421135276556015,
0.0055568343959748745,
-0.007962719537317753,
0.0023667579516768456,
-0.007855776697397232,
-0.002539889421314001,
-0.004176435526460409,
-0.028473414480686188,
-0.00016258907271549106,
-0.0022012272384017706,
-0.0015044210013002157,
0.004171576350927353,
-0.000523796072229743,
0.006735677365213633,
-0.000599406601395458,
-0.002752816304564476,
-0.010751997120678425,
0.010172412730753422,
-0.007505616173148155,
-0.002864319831132889,
0.006280754692852497,
0.0013462293427437544,
-0.01278784777969122,
-0.0016899702604860067,
0.0011326553067192435,
-0.012744884006679058,
0.002980836434289813,
0.0019965858664363623,
-0.005118813831359148,
0.048792921006679535,
-0.002418271731585264,
0.0030203545466065407,
-0.005404926370829344,
0.001803883700631559,
0.0025840899907052517,
0.0051852017641067505,
0.008423336781561375,
-0.0047342730686068535,
0.01278926432132721,
0.008263787254691124,
0.0037311248015612364,
0.008608699776232243,
-0.0015443701995536685,
0.007824343629181385,
-0.0053904191590845585,
-0.00262927426956594,
-0.00013430898252408952,
-0.004322453401982784,
0.0072884513065218925,
-0.0017697500297799706,
-0.006096835248172283,
0.003953883424401283,
-0.0009945835918188095,
-0.009516827762126923,
0.0006751013570465147,
-0.0024495164398103952,
0.006212841719388962,
-0.00825794693082571,
-0.0048888931050896645,
-0.003865820588544011,
-0.003742366563528776,
0.0037155896425247192,
0.00900093000382185,
0.0029182895086705685,
0.0033560236915946007,
-0.006279731169342995,
-0.008019166067242622,
-0.0002724359801504761,
-0.002154387068003416,
0.0007849152316339314,
0.007202818989753723,
0.0031682231929153204,
-0.01059924066066742,
0.0002819233341142535,
0.004560564644634724,
0.0048886751756072044,
-0.0029587296303361654,
0.003963949624449015,
-0.007612940389662981,
0.007358219940215349,
0.0012719305232167244,
0.0019267480820417404,
0.011993302963674068,
-0.004742199555039406,
0.0012929763179272413,
-0.0018941703019663692,
0.002681969664990902,
-0.0009004945168271661,
0.0048484657891094685,
0.009916739538311958,
-0.004870933014899492,
-0.0059004295617341995,
0.005760403349995613,
0.006040727254003286,
0.00967397540807724,
0.004197739064693451,
-0.003794799093157053,
0.0022581317462027073,
-0.004025388043373823,
-0.0010800552554428577,
0.007157133426517248,
-0.0022528015542775393,
0.005907035432755947,
0.00322124850936234,
-0.009824991226196289,
-0.008515041321516037,
0.000003992518031736836,
-0.008180742152035236,
0.0004625018045771867,
0.013946534134447575,
0.00995047576725483,
-0.0024154570419341326,
0.0054525770246982574,
-0.01097064558416605,
-0.0005970399943180382,
0.007577565498650074,
0.0029854909516870975,
-0.011828095652163029,
-0.961746096611023,
0.006103672087192535,
0.002399990102276206,
-0.0018093724502250552,
0.004635381046682596,
0.00463745417073369,
0.00382363167591393,
0.0055871158838272095,
0.012426665984094143,
-0.006821990013122559,
-0.006007075775414705,
-0.010075331665575504,
-0.012267530895769596,
-0.0006897441344335675,
-0.005375513806939125,
-0.0018782044062390924,
-0.0071707372553646564,
-0.006041272077709436,
-0.0022779114078730345,
-0.0042866249568760395,
-0.0024119203444570303,
0.007002008147537708,
-0.001231212867423892,
0.005026219878345728,
0.001982572488486767,
0.004223178140819073,
-0.0033769586589187384,
-0.0013015767326578498,
-0.0029613818041980267,
-0.0016577322967350483,
-0.005732363555580378,
-0.012305814772844315,
-0.0033516944386065006,
-0.0010870920959860086,
0.008098974823951721,
-0.000912986695766449,
0.006347745656967163,
-0.0020942226983606815,
0.0005364358657971025,
-0.008917206898331642,
0.006746712606400251,
-0.0014162425650283694,
0.0026852202136069536,
-0.02914745919406414,
-0.002037081867456436,
0.00006863776798127219,
-0.008274152874946594,
0.005990366917103529,
0.0009130847756750882,
0.001359259127639234,
-0.004875307437032461,
-0.007282259874045849,
0.010532578453421593,
-0.006817570421844721,
0.003933251835405827,
-0.004508886486291885,
-0.007230605464428663,
-0.0006895471015013754,
-0.00727887824177742,
-0.0009615466697141528,
0.004368853289633989,
-0.004511695355176926,
-0.002009895397350192,
-0.004600075073540211,
0.002253460232168436,
0.0017821973888203502,
0.004626104608178139,
-0.018121948465704918,
-0.0064662788063287735,
0.0023571993224322796,
0.002283357549458742,
-0.0022239158861339092,
-0.0025573393795639277,
0.0031441240571439266,
-0.008569865487515926,
0.0055239335633814335,
0.001330983592197299,
0.0003377120883669704,
-0.009392572566866875,
-0.0016515174647793174,
-0.009702609851956367,
-0.0073148878291249275,
0.0036754764150828123,
-0.005116358399391174,
-0.007104754913598299,
-0.0004991397727280855,
0.0008989998605102301,
0.007880016230046749,
-0.0022568644490092993,
0.0038564512506127357,
0.010197006165981293,
-0.0014396806946024299,
-0.007361376192420721,
0.005333034321665764,
0.006059010047465563,
-0.000452626496553421,
-0.0027133221738040447,
0.000980534590780735,
0.007819795049726963,
0.006060413084924221,
0.001981198787689209,
0.005218692123889923,
0.0004282711888663471,
0.010663851164281368,
0.0007707593031227589,
-0.0012381732231006026,
-0.0035554049536585808,
-0.0002448875457048416,
-0.006083978805691004,
-0.000035687480703927577,
-0.006631895899772644,
-0.0020000862423330545,
-0.01348582748323679,
-0.008066529408097267,
-0.0036753627937287092,
-0.0008159361896105111,
0.0017193336971104145,
-0.004964703693985939,
-0.000032127241865964606,
0.0006156470626592636,
0.0057051521725952625,
-0.0013589636655524373,
-0.002558454405516386,
-0.0023835664615035057,
0.0016106907278299332,
-0.0024509457871317863,
0.013625108636915684,
-0.009759156033396721,
0.005806987639516592,
-0.0007551602320745587,
-0.012547705322504044,
0.006129690911620855,
0.009595179930329323,
-0.006180220749229193,
0.003174333833158016,
0.000712551933247596,
0.002274265279993415,
-0.002483326243236661,
-0.006871657446026802,
-0.002527836011722684,
-0.017784930765628815,
0.0004303464957047254,
0.01814175210893154,
0.0010688933543860912,
0.011198336258530617,
0.011081432923674583,
-0.002520567737519741,
0.001224992796778679,
0.00616632541641593,
0.001828353269957006,
0.01376134343445301,
-0.008535568602383137,
0.00042744577513076365,
-0.0002456845249980688,
-0.0054345750249922276,
0.0004481597279664129,
0.005376481916755438,
0.0032719122245907784,
-0.002840714529156685,
0.003304064506664872,
-0.0055964235216379166,
-0.004940867889672518,
-0.017232267186045647,
-0.002638542326167226,
0.009501355700194836,
-0.005322028882801533,
0.0066130030900239944,
-0.011132479645311832,
0.00502257514744997,
0.0034379411954432726,
0.004004132468253374,
0.0016823051264509559,
-0.0005508916219696403,
0.0065122926607728004,
0.007877299562096596,
-0.005453347694128752,
0.0002766808611340821,
0.004876954481005669,
-0.0031186016276478767,
0.0009109515231102705,
0.007727242074906826,
-0.005351529456675053,
-0.004078191239386797,
0.0020959926769137383,
0.003081744071096182,
0.0015092800604179502,
-0.0027404725551605225,
-0.008658604696393013,
-0.0022161207161843777,
0.0013125801924616098,
-0.003480953862890601,
0.00434816163033247,
0.002753863111138344,
0.0030926747713238,
-0.006675515789538622,
-0.0021692300215363503,
-0.005216269753873348,
-0.011899628676474094,
0.01016920618712902,
-0.0011782370274886489,
0.0029192871879786253,
0.01134779304265976,
0.003397535067051649,
-0.011666028760373592,
0.00709924940019846,
0.007466768845915794,
-0.0022331022191792727,
0.004506287630647421,
0.00642402283847332,
-0.004427180625498295,
-0.020908424630761147,
-0.004270617384463549,
-0.014610977843403816,
0.005351198371499777,
0.0007477980107069016,
0.004169686231762171,
-0.00774946017190814,
0.008355760015547276,
0.007862027734518051,
-0.013373807072639465,
-0.005316491238772869,
-0.007763124071061611,
0.008486864157021046,
-0.0013057237956672907,
0.0008940239786170423,
-0.003066073404625058,
-0.0016093866433948278,
-0.002126473467797041,
-0.0043674493208527565,
-0.0037344975862652063,
0.004488639533519745,
0.0029396533500403166,
-0.003064296441152692,
0.003621224546805024,
-0.0036008150782436132,
0.00007765997725073248,
0.0008257115841843188,
-0.010497922077775002,
0.0023168728221207857,
0.0041299620643258095,
-0.0024373664055019617,
-0.0007642245618626475,
-0.0009475124534219503,
-0.002061102306470275,
-0.00802669394761324,
-0.010185226798057556,
-0.005010218359529972,
-0.0053981696255505085,
-0.0047838203608989716,
-0.011937896721065044,
-0.0011983310105279088,
-0.007317541632801294,
0.00794069655239582,
-0.006875611841678619,
0.006233897991478443,
0.005407192278653383,
-0.004153330810368061,
0.009467163123190403,
0.0004066950350534171,
0.004201146308332682,
0.0026125162839889526,
0.003886539489030838,
0.002031201496720314,
-0.003996408078819513,
-0.013058530166745186,
0.011617355048656464,
-0.0079196747392416,
0.0010984030086547136,
0.012976482510566711,
0.004940001759678125,
0.0101107656955719,
-0.0028733464423567057,
-0.00047423734213225543,
0.0005331778666004539,
0.00644200574606657,
-0.014739127829670906,
0.005118470173329115,
-0.004052663687616587,
-0.0009799593826755881,
0.004267689306288958,
-0.0032609482295811176,
-0.0002863140543922782,
0.009547914378345013,
0.003808848327025771,
-0.006258379202336073,
-0.002462049014866352,
0.0022779684513807297,
0.00340523524209857,
-0.01019013486802578,
-0.000192399209481664,
-0.0033404070418328047,
-0.0041058119386434555,
-0.0025158084463328123,
-0.0024834726937115192,
0.0014396469341591,
0.004097358323633671,
-0.002203455427661538,
0.004667619243264198,
0.002962560160085559,
-0.0055977883748710155,
0.015904324129223824,
-0.004895716905593872,
-0.004735235124826431,
0.00274596456438303,
0.0027990154922008514,
-0.00328744831494987,
-0.007123056799173355,
-0.0035088942386209965,
0.0020361016504466534,
0.007376793306320906,
-0.002159942639991641,
-0.004449246916919947,
-0.004077959805727005,
-0.0013667148305103183,
-0.010781888850033283,
0.00026185272145085037,
0.011536138132214546,
-0.002932588802650571,
0.004410196095705032,
-0.0010322980815544724,
-0.007616927847266197,
-0.01350062433630228,
0.05364156886935234,
-0.000812685932032764,
0.004254682920873165,
0.0028958101756870747,
-0.008027409203350544,
-0.0019623746629804373,
-0.0008195386035367846,
0.006663283333182335,
-0.00718593318015337,
-0.0061679622158408165,
0.00887058861553669,
-0.004244885873049498,
0.0035758675076067448,
0.003489286173135042,
-0.0003619903582148254,
0.013144896365702152,
-0.0030692412983626127,
-0.014546963386237621,
-0.014698076993227005,
0.007453893311321735,
-0.0033912116196006536,
-0.0071786087937653065,
0.009717532433569431,
-0.003992665093392134,
-0.0031070271506905556,
0.0024218789767473936,
0.006562769878655672,
-0.00019953143782913685,
0.00016606877034064382,
-0.0031121629290282726,
-0.0024043386802077293,
-0.00022302372963167727,
0.002631740877404809,
0.0046621584333479404,
0.007029874715954065,
-0.0021490277722477913,
0.005053337197750807,
-0.0006812103092670441,
-0.001941788592375815,
-0.00193594372831285,
0.004658135585486889,
0.006881396286189556,
-0.001338933827355504,
-0.0030194642022252083,
0.005777452606707811,
0.005727733951061964,
0.0018668322591111064,
0.00948190689086914,
-0.00023876836348790675,
-0.006284845992922783,
0.00773204118013382,
0.007877756841480732,
-0.0008675088174641132,
0.010652104392647743,
0.001209392212331295,
0.00489395298063755,
0.002736913040280342,
-0.008767103776335716,
-0.014915027655661106,
-0.0027001637499779463,
0.008626638911664486,
0.00704994797706604,
-0.002736498136073351,
0.0007160743698477745,
-0.0023030710872262716,
-0.004061772022396326,
-0.007151078898459673,
-0.009212030097842216,
-0.003634965978562832,
0.0029595382511615753,
0.003411499783396721,
0.0717494785785675,
-0.008267533965408802,
-0.002818304579705,
-0.009634146466851234,
0.0007558735669590533,
-0.0006797121022827923,
0.0021745222620666027,
0.0012348300078883767,
-0.00015315641940105706,
0.004177120514214039,
-0.0012643287191167474,
-0.008752444759011269,
-0.010160100646317005,
-0.0009940435411408544,
0.003154660342261195,
-0.0015609505353495479,
0.0018743685213848948,
0.006173944566398859,
-0.009136203676462173,
0.00008535182860214263,
-0.00920175202190876,
-0.0013105061370879412,
-0.0005416410276666284,
-0.009515834040939808,
-0.0036017815582454205,
-0.004017981700599194,
0.00507115526124835,
0.003983017988502979,
0.00557008758187294,
-0.003355965716764331,
0.006920458748936653,
-0.00290769524872303,
0.00016809637600090355,
-0.004758602008223534,
0.00026221227017231286,
-0.004880660679191351,
0.008401350118219852,
0.0006870030192658305,
-0.012307236902415752,
-0.005953651387244463,
-0.0017951023764908314,
0.0036088242195546627,
-0.006775594316422939,
0.006032769102603197,
-0.0016229749890044332,
0.006158033385872841,
-0.003971431404352188,
-0.00031908138771541417,
-0.007254251278936863,
0.0033541976008564234,
-0.011027279309928417,
0.008131925947964191,
-0.16569790244102478,
0.010355159640312195,
0.0035698977299034595,
-0.005815547425299883,
-0.002549739321693778,
-0.015578482300043106,
-0.004361769650131464,
0.002088002162054181,
0.008670364506542683,
0.0003176798636559397,
-0.002673761686310172,
-0.0016129504656419158,
0.004285682458430529,
0.004035832826048136,
-0.0020690925884991884,
-0.0047056348994374275,
0.0036267382092773914,
-0.004692364484071732,
-0.00009906190825859085,
0.0034333073999732733,
0.003644916694611311,
0.009403843432664871,
0.001790311187505722,
0.0006985991494730115,
-0.002520218724384904,
-0.004081423394382,
0.004616452381014824,
-0.0018874589586630464,
0.0037821675650775433,
-0.011725366115570068,
-0.003986662719398737,
-0.0043603284284472466,
-0.004333477467298508,
0.0017140917479991913,
0.00400515366345644,
0.0005734607111662626,
0.009127175435423851,
0.0020961386617273092,
-0.007727405987679958,
0.007231546565890312,
-0.007440629880875349,
0.028397494927048683,
0.0027950964868068695,
0.005897433031350374,
0.0007977096829563379,
-0.005717212334275246,
-0.0035565486177802086,
0.00935655739158392,
0.0013989255530759692,
0.011789469048380852,
-0.01330537162721157,
-0.0008234705310314894,
0.00527468416839838,
0.019093932583928108,
-0.006400708109140396,
-0.00918651558458805,
-0.0062197186052799225,
-0.0033699735067784786,
0.0021352756302803755,
0.007562272250652313,
0.010149456560611725,
-0.004057008307427168,
0.00810893252491951,
-0.0025180780794471502,
-0.018005670979619026,
0.002555915853008628,
-0.003441448323428631,
-0.008523222990334034,
0.0015108841471374035,
0.006515368819236755,
0.010293735191226006,
-0.0004473527951631695,
0.0039740498177707195,
0.0003653335152193904,
0.00871429406106472,
0.00008557801629649475,
0.007305560167878866,
-0.0015162250492721796,
0.006287440191954374,
-0.007483556866645813,
0.008051051758229733,
-0.009766926988959312,
-0.001805314444936812,
0.004942030180245638,
-0.002447983017191291,
0.010304883122444153,
0.0048523107543587685,
-0.0025847426149994135,
-0.0013310725335031748,
-0.007705821190029383,
-0.0007660482660867274,
0.0018869343912228942,
0.0012510294327512383,
-0.007456534076482058,
0.002188062062487006,
-0.0017535688821226358,
0.004306953866034746,
0.007243387401103973,
-0.0094997463747859,
0.006084981374442577,
0.004390691872686148,
-0.006489046849310398,
-0.000012657355910050683,
-0.005738959647715092,
0.002878635423257947,
0.0048912689089775085,
-0.0031282431446015835,
-0.0034627853892743587,
0.0038910333532840014,
-0.005109862890094519,
-0.006235610228031874,
0.004060645587742329,
-0.00956867728382349,
-0.00944035779684782,
-0.0012807755265384912,
-0.009498100727796555,
-0.0004162020923104137
] |
8a80483513e593a3c49ee46795ac3b8d601f6b9a | 416 | py | Python | main/SimulationSettings/ScreenshotsSteppable/Simulation/screenshots_steppables.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | null | null | null | main/SimulationSettings/ScreenshotsSteppable/Simulation/screenshots_steppables.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | null | null | null | main/SimulationSettings/ScreenshotsSteppable/Simulation/screenshots_steppables.py | JulianoGianlupi/nh-cc3d-4x-base-tool | c0f4aceebd4c5bf3ec39e831ef851e419b161259 | [
"CC0-1.0"
] | 1 | 2021-02-26T21:50:29.000Z | 2021-02-26T21:50:29.000Z | from cc3d.core.PySteppables import *
from cc3d import CompuCellSetup
from random import random
class ScreenshotSteppable(SteppableBasePy):
def __init__(self, frequency=10):
SteppableBasePy.__init__(self, frequency)
def step(self, mcs):
if mcs in [3, 5, 19,20, 23, 29, 31]:
self.request_screenshot(mcs=mcs, screenshot_label='Cell_Field_CellField_2D_XY_0')
| 27.733333 | 93 | 0.6875 | 1 | 0.8061 | [
0.0031730476766824722,
0.025671614333987236,
0.005547788459807634,
-0.004155423957854509,
0.007286901585757732,
-0.005929781589657068,
-0.007474985439330339,
-0.0002880710526369512,
-0.007695757318288088,
-0.0004903677036054432,
0.0034053672570735216,
0.004572488833218813,
0.011132348328828812,
-0.013254579156637192,
-0.0020553357899188995,
0.0184254739433527,
-0.057649921625852585,
0.001372764934785664,
-0.003684730501845479,
0.003458621446043253,
-0.011696381494402885,
0.01443028636276722,
0.007132530678063631,
0.013028275221586227,
0.007222927175462246,
0.001972783822566271,
0.00804704986512661,
0.003966787364333868,
-0.007647343445569277,
-0.008540064096450806,
0.0001688931224634871,
0.00022944723605178297,
-0.009858264587819576,
-0.012596504762768745,
0.008324842900037766,
-0.0042175971902906895,
0.00234150979667902,
-0.01608077995479107,
0.011216391809284687,
-0.005753470119088888,
-0.005902325734496117,
-0.016210809350013733,
-0.0010779430158436298,
0.004861228168010712,
-0.014426590874791145,
0.0014558371622115374,
-0.002240127185359597,
0.0027906892355531454,
-0.013282155618071556,
0.0027788763400167227,
-0.007817717269062996,
0.002530136378481984,
0.013049689121544361,
0.0021799406968057156,
-0.0054929377511143684,
-0.0102670444175601,
0.01139342412352562,
-0.0023298696614801884,
-0.013577152043581009,
0.0032352705020457506,
-0.0003237971686758101,
-0.004605086520314217,
0.003949542064219713,
0.002121696248650551,
-0.017910877242684364,
-0.003290036926046014,
-0.007973459549248219,
0.0015831398777663708,
-0.0036725166719406843,
0.006405642721801996,
0.0036323508247733116,
-0.0023217452690005302,
0.0075014084577560425,
0.000990448985248804,
0.0003223090316168964,
-0.009391811676323414,
-0.000008822687959764153,
0.005947202909737825,
0.009354125708341599,
0.00357065605930984,
0.007455042563378811,
-0.008141674101352692,
0.007488476112484932,
0.01625404693186283,
0.011325699277222157,
0.009334913454949856,
0.017821716144680977,
-0.011999383568763733,
0.04106038063764572,
0.00752289080992341,
-0.011109301820397377,
0.00027896539540961385,
-0.00627761660143733,
-0.004271477926522493,
-0.004056247882544994,
-0.03371864929795265,
-0.0005781236686743796,
-0.004840024281293154,
-0.002030098345130682,
0.008175290189683437,
0.0006129365065135062,
0.00590041046962142,
0.0015875635435804725,
-0.0015903058229014277,
-0.011677549220621586,
0.014509960077702999,
-0.010567176155745983,
-0.0023908917792141438,
0.0082017220556736,
-0.0003236832853872329,
-0.016353167593479156,
0.0009851143695414066,
-0.0013437016168609262,
-0.012463876977562904,
0.0005460688844323158,
-0.00011792686564149335,
-0.010749108158051968,
0.056955598294734955,
-0.0028828918002545834,
0.0029044768307358027,
-0.00316454260610044,
-0.0059564923867583275,
0.0016872261185199022,
0.005067541729658842,
0.00866877194494009,
-0.005910953041166067,
0.014501415193080902,
0.009858895093202591,
0.009175031445920467,
0.007352079730480909,
-0.0025049210526049137,
0.010291926562786102,
-0.0036852103658020496,
-0.0017198162386193871,
0.000688741565681994,
-0.00980607233941555,
0.002323392080143094,
-0.0025046453811228275,
-0.005800879094749689,
0.003675069659948349,
-0.0004065400280524045,
-0.01469163317233324,
0.001542795798741281,
-0.003428800730034709,
0.0014316665474325418,
-0.009885046631097794,
-0.008247067220509052,
-0.004764278419315815,
-0.00151430768892169,
0.006964664440602064,
0.011159935966134071,
0.005105395335704088,
0.0026322673074901104,
-0.0038462369702756405,
-0.007765920367091894,
-0.004712683614343405,
-0.0065040322951972485,
0.0014868873404338956,
0.008809134364128113,
0.004635152406990528,
-0.00902580562978983,
-0.0022082901559770107,
0.005736429709941149,
0.004948472138494253,
0.00010601564281387255,
-0.00007854939758544788,
-0.007652186322957277,
0.010880625806748867,
0.0008065749425441027,
0.0020587709732353687,
0.013153592124581337,
-0.007665766403079033,
0.0009786959271878004,
0.0013226022711023688,
0.010728554800152779,
-0.001205305103212595,
0.004836203996092081,
0.011431926861405373,
0.00020428879361134022,
-0.007363675162196159,
0.011231248266994953,
-0.0007076949696056545,
0.007784128654748201,
0.010544873774051666,
-0.0001323407341260463,
0.005102050956338644,
-0.0058166999369859695,
0.0016675380757078528,
0.006068331655114889,
-0.006402915343642235,
0.00964925903826952,
0.0025361543521285057,
-0.013866245746612549,
-0.008366119116544724,
-0.004890829790383577,
-0.01418180949985981,
0.002565248403698206,
0.014507435262203217,
0.011264358647167683,
0.00027158777811564505,
0.0026797817554324865,
-0.013495274819433689,
-0.0018074199324473739,
0.008854524232447147,
0.000802782888058573,
-0.012847262434661388,
-0.9536949396133423,
0.006123815663158894,
0.003729695687070489,
0.003796499455347657,
0.009371533989906311,
0.00011342614016029984,
-0.0022602968383580446,
0.0034945670049637556,
0.014650518074631691,
-0.006183703429996967,
-0.007420083973556757,
-0.009737998247146606,
-0.009600731544196606,
0.00015743845142424107,
-0.005624789744615555,
-0.005576171446591616,
-0.006614538375288248,
-0.005614814348518848,
-0.005200506653636694,
-0.005448022857308388,
-0.003934537060558796,
0.009891449473798275,
-0.0009734948398545384,
0.003172004595398903,
0.0027297036722302437,
0.0062491106800735,
-0.006078008562326431,
-0.005958068650215864,
-0.0011608533095568419,
0.00076385895954445,
-0.0053049251437187195,
-0.014724752865731716,
-0.006822082679718733,
-0.0035271865781396627,
0.01222237478941679,
0.0006283583352342248,
0.00833903905004263,
0.001724768546409905,
0.0004117945209145546,
-0.013687397353351116,
0.005851764231920242,
0.006182442884892225,
0.0018626856617629528,
-0.026259005069732666,
-0.0022121542133390903,
-0.004849908873438835,
-0.009122014045715332,
0.007437234744429588,
0.003022590884938836,
0.002131558721885085,
-0.003963844384998083,
-0.004945842083543539,
0.009933607652783394,
-0.008657227270305157,
0.0024760086089372635,
-0.004169612191617489,
-0.002202923409640789,
-0.0005962682189419866,
-0.007544987369328737,
0.003269285662099719,
0.003961669281125069,
-0.006625784561038017,
0.0020772614516317844,
-0.0024053186643868685,
0.0024474349338561296,
-0.0015817886451259255,
0.0005126531468704343,
-0.018020905554294586,
-0.00923639815300703,
0.0020249804947525263,
0.005330058746039867,
0.0028558694757521152,
-0.0051622213795781136,
0.0006493699620477855,
-0.011085386388003826,
0.004948659334331751,
-0.0011994743254035711,
0.005324574187397957,
-0.007700471207499504,
0.00021113066759426147,
-0.010969805531203747,
-0.0077554876916110516,
0.007605905178934336,
-0.006823171861469746,
-0.006241430528461933,
0.0030433281790465117,
0.0011359265772625804,
0.011374717578291893,
-0.005006030201911926,
0.003307180479168892,
0.01596836932003498,
-0.003224714891985059,
-0.010884525254368782,
0.006627867463976145,
0.005911740940064192,
0.002522924216464162,
-0.008497483097016811,
0.002666645450517535,
0.00904680322855711,
0.008170835673809052,
0.0004009910626336932,
0.004883172921836376,
-0.0011420681839808822,
0.009669207967817783,
0.002641060156747699,
0.0003678321954794228,
-0.003824358806014061,
-0.0029224485624581575,
-0.0047583915293216705,
-0.004659069702029228,
-0.005277079995721579,
-0.00036238523898646235,
-0.009074980393052101,
-0.008458237163722515,
-0.005330878775566816,
0.000298707076581195,
-0.001062012161128223,
-0.0020107466261833906,
-0.0018467905465513468,
-0.001137636019848287,
0.010777894407510757,
-0.0031371833756566048,
-0.0033829682506620884,
-0.0008506336016580462,
0.005087646655738354,
-0.0070706564001739025,
0.013468828983604908,
-0.009168840944766998,
0.008521908894181252,
0.0004031666030641645,
-0.014721413142979145,
0.009699254296720028,
0.009481648914515972,
-0.009154864586889744,
0.0026263908948749304,
-0.0013623242266476154,
-0.00022798222198616713,
-0.0040975152514874935,
-0.008183634839951992,
-0.002498583635315299,
-0.013597121462225914,
-0.0017245984636247158,
0.02013961784541607,
-0.00012959635932929814,
0.008884484879672527,
0.007367406971752644,
-0.0023700313176959753,
0.0029165789019316435,
0.011379375122487545,
0.0013114383909851313,
0.015986600890755653,
-0.00906603317707777,
0.0010049304692074656,
-0.001445555011741817,
-0.004939767066389322,
0.003252385649830103,
0.0009639321360737085,
0.0025856848806142807,
-0.0017373586306348443,
0.001014826470054686,
-0.004668764304369688,
-0.010378274135291576,
-0.014952745288610458,
-0.0026312065310776234,
0.009464957751333714,
-0.0056228553876280785,
0.006437923293560743,
-0.009906472638249397,
0.0014451040187850595,
0.0019272621721029282,
0.007279501296579838,
0.005214413162320852,
0.00011456436186563224,
0.013852336443960667,
0.01014654990285635,
-0.008631715551018715,
0.0038290407974272966,
0.003681483445689082,
-0.004314683843404055,
0.002734394744038582,
0.008990940637886524,
-0.00800451822578907,
-0.004037072416394949,
0.0017711491091176867,
0.0009280931553803384,
0.005276287440210581,
-0.004329657647758722,
-0.009392956271767616,
-0.004318193066865206,
-0.0005403917166404426,
-0.006946789100766182,
0.003989174962043762,
0.000645410327706486,
0.003745382186025381,
-0.007631664164364338,
0.0021902318112552166,
-0.0023995107039809227,
-0.005179882515221834,
0.009797608479857445,
-0.00038407277315855026,
0.0010243016295135021,
0.011018992401659489,
0.0041495212353765965,
-0.014533048495650291,
0.00979600939899683,
0.006090764421969652,
-0.0023251581005752087,
0.002783340634778142,
0.010832838714122772,
-0.0025848073419183493,
-0.0205606110394001,
-0.0028787690680474043,
-0.018772432580590248,
0.0031486586667597294,
-0.00302750407718122,
0.008456723764538765,
-0.006846706382930279,
0.007945805788040161,
0.004426360130310059,
-0.010106172412633896,
-0.0026491729076951742,
-0.009133831597864628,
0.0075074853375554085,
-0.001823881408199668,
-0.0016746571054682136,
-0.0025072875432670116,
-0.001105638686567545,
-0.005341512616723776,
-0.0008149162749759853,
-0.00020244004554115236,
0.002421095035970211,
0.0042440942488610744,
-0.0046636806800961494,
0.003089114325121045,
-0.0031399899162352085,
0.002125506056472659,
-0.00013748108176514506,
-0.009825199842453003,
-0.0014482078840956092,
0.010793319903314114,
-0.0014618831919506192,
-0.0019177136709913611,
-0.0012912505771964788,
-0.005664570722728968,
-0.008768693543970585,
-0.01210071612149477,
-0.004881184082478285,
-0.006480283569544554,
-0.0037140927743166685,
-0.007124197669327259,
-0.0029309424571692944,
-0.005730459466576576,
0.010846007615327835,
-0.009139236062765121,
0.005370035767555237,
0.007400973234325647,
-0.00461717089638114,
0.005895490758121014,
-0.0028258648235350847,
0.0022756780963391066,
0.0007595620700158179,
0.006299931090325117,
0.001673197839409113,
-0.00894573051482439,
-0.015089131891727448,
0.0160248763859272,
-0.010399315506219864,
-0.00008621441520517692,
0.016197901219129562,
0.00578974187374115,
0.014367938041687012,
-0.005146680399775505,
-0.0020857269410043955,
0.004921063780784607,
0.010275128297507763,
-0.011491123586893082,
0.005065130069851875,
-0.002581812208518386,
-0.0021329165901988745,
0.005429701879620552,
-0.008001431822776794,
0.003907535225152969,
0.008710585534572601,
0.0037045814096927643,
-0.0037135593593120575,
-0.0014430308947339654,
-0.001828197157010436,
0.002725425409153104,
-0.01058984361588955,
-0.0010156339267268777,
-0.005093823187053204,
-0.00498055899515748,
-0.0024371196050196886,
0.002335071098059416,
0.0027245525270700455,
0.007035982329398394,
-0.004508043639361858,
0.0032472857274115086,
0.0003168382390867919,
-0.005458840634673834,
0.015215490013360977,
-0.005711027421057224,
-0.0063576288521289825,
0.003265484469011426,
0.00007003315113252029,
-0.001151884556747973,
-0.005260582081973553,
-0.006407821085304022,
0.0013678664108738303,
0.004279246553778648,
-0.003557768650352955,
-0.008458391763269901,
-0.0013662310084328055,
-0.0012807935709133744,
-0.009607694111764431,
0.002050685463473201,
0.010915803723037243,
0.0011442292015999556,
0.004871471785008907,
0.0009430664358660579,
-0.007479875348508358,
-0.015038985759019852,
0.05734557658433914,
-0.002264927141368389,
0.0027893490623682737,
0.00805023591965437,
-0.006583415903151035,
-0.002018048195168376,
-0.0016467539826408029,
0.007157294545322657,
-0.007813377305865288,
-0.007182690314948559,
0.00926341861486435,
-0.0030243569053709507,
0.00043925989302806556,
-0.0022397879511117935,
-0.0007081000367179513,
0.015592475421726704,
-0.004973470699042082,
-0.014586936682462692,
-0.012176722288131714,
0.005316098686307669,
-0.0056607951410114765,
-0.006388300098478794,
0.005951870698481798,
-0.0017252397956326604,
0.0015715672634541988,
0.001600016257725656,
0.00498849106952548,
-0.0004130472952965647,
-0.003735671751201153,
-0.004246198572218418,
-0.0037151663564145565,
0.003542097518220544,
0.00600945670157671,
0.002879795851185918,
0.012712604366242886,
-0.004946527536958456,
0.0068645174615085125,
-0.0014392414595931768,
-0.0032721697352826595,
-0.002351615112274885,
0.01002877950668335,
0.007654269691556692,
-0.0035636809188872576,
-0.007817150093615055,
0.0039590103551745415,
0.0019516374450176954,
0.0007290453067980707,
0.01375147420912981,
0.0008641519234515727,
-0.003046630183234811,
0.004657111130654812,
0.009060406126081944,
-0.007063321769237518,
0.010398870334029198,
-0.002816314809024334,
0.0024166377261281013,
0.004004168324172497,
-0.00653441809117794,
-0.017077038064599037,
-0.0007944807875901461,
0.009686661884188652,
0.008378550410270691,
-0.004732117522507906,
0.0021751795429736376,
0.004263243637979031,
-0.00696889404207468,
-0.013478762470185757,
-0.008972969837486744,
-0.0054030390456318855,
-0.0001669165794737637,
0.006857209373265505,
0.07597668468952179,
-0.006585751194506884,
-0.0035910627339035273,
-0.012451373040676117,
0.003980257548391819,
0.0002385332336416468,
0.001617180067114532,
0.0006936133722774684,
0.0015459749847650528,
0.00738673098385334,
0.004797281231731176,
-0.012662091292440891,
-0.010477438569068909,
-0.000271190598141402,
0.003289080923423171,
-0.0009252605377696455,
-0.0014038175577297807,
0.007515237666666508,
-0.0047136340290308,
0.003958459477871656,
-0.014834137633442879,
-0.0050947112031280994,
-0.0018375585786998272,
-0.008141270838677883,
-0.0023074739146977663,
-0.0039533828385174274,
0.0016214920906350017,
0.003286421764642,
0.0032151101622730494,
-0.005413081496953964,
0.006338614504784346,
-0.003001941367983818,
0.004428005311638117,
-0.004264418501406908,
-0.0005288182874210179,
-0.005710409488528967,
0.006397187244147062,
-0.0005504220025613904,
-0.01359360571950674,
-0.005130942445248365,
-0.0026744031347334385,
-0.0009843051666393876,
-0.0044850693084299564,
0.008429189212620258,
0.0002662187034729868,
0.006056054495275021,
-0.005203998647630215,
0.0066691511310637,
-0.009610258042812347,
0.0006810167105868459,
-0.013277075253427029,
0.006406220141798258,
-0.17930011451244354,
0.006288731936365366,
0.0022017164155840874,
-0.004842481110244989,
-0.0027869660407304764,
-0.013556834310293198,
-0.014370960183441639,
0.003939586691558361,
0.011273333802819252,
0.0008550124475732446,
0.0030434962827712297,
-0.002133099129423499,
0.00356168276630342,
0.004457251168787479,
-0.0015815728111192584,
-0.005045657977461815,
0.003888282924890518,
-0.005567389074712992,
-0.00451581459492445,
0.004197382368147373,
0.005005079787224531,
0.007727596443146467,
0.002321206033229828,
0.0022513940930366516,
0.001329628168605268,
-0.0010919988853856921,
0.0026521775871515274,
-0.002125621074810624,
0.003236402990296483,
-0.010054510086774826,
-0.004321536049246788,
-0.0038332021795213223,
-0.0004481298674363643,
0.0009751094621606171,
0.001955958316102624,
0.0012845257297158241,
0.007007678505033255,
0.0029897193890064955,
-0.008250497281551361,
0.00787641666829586,
-0.005889199674129486,
0.03163423389196396,
0.00573797756806016,
0.008536377921700478,
0.0005934681394137442,
-0.001976203639060259,
-0.0038314475677907467,
0.010279534384608269,
0.004349039867520332,
0.014048852026462555,
-0.01181831769645214,
-0.0047135972417891026,
0.00013611948816105723,
0.015713568776845932,
-0.005455701146274805,
-0.006008120719343424,
-0.010066146962344646,
-0.004943836480379105,
0.005934195592999458,
0.01392667181789875,
0.012146948836743832,
-0.008624930866062641,
0.006263484247028828,
-0.0045852502807974815,
-0.019734174013137817,
0.002918788930401206,
-0.0018820686964318156,
-0.006935372017323971,
-0.0008889431483112276,
0.004554069135338068,
0.009779533371329308,
-0.00036207662196829915,
0.0062781949527561665,
0.00268959766253829,
0.002096907002851367,
-0.00209653633646667,
0.0065442337654531,
-0.002291906625032425,
0.010355471633374691,
-0.008246585726737976,
0.012384322471916676,
-0.01018013246357441,
-0.002743820194154978,
0.0019541503861546516,
-0.004108686465770006,
0.011889954097568989,
0.0063912877812981606,
-0.007372900377959013,
-0.0010184000711888075,
-0.012637745589017868,
0.0017288007074967027,
0.0019369821529835463,
0.0017983856378123164,
-0.00636683963239193,
0.003391600912436843,
-0.0022210285533219576,
0.009946372359991074,
0.01117146760225296,
-0.007272468414157629,
0.008193091489374638,
0.005658949725329876,
-0.005625749472528696,
0.0015897136181592941,
-0.009192616678774357,
0.0040285298600792885,
0.0064390795305371284,
-0.008538011461496353,
-0.008109585382044315,
0.005746354814618826,
-0.0042393989861011505,
-0.006139134522527456,
0.003585910890251398,
-0.010695327073335648,
-0.007253943011164665,
-0.0004136451461818069,
-0.010143066756427288,
-0.003793054958805442
] |
8a80b1c774bd44450fbb371648857468404e7e42 | 3,350 | py | Python | aesara/gpuarray/optdb.py | anirudhacharya/aesara | cbf91122296b68ee2ad592b2312d56f6ff65ba53 | [
"BSD-3-Clause"
] | 1 | 2021-11-09T10:19:46.000Z | 2021-11-09T10:19:46.000Z | aesara/gpuarray/optdb.py | anirudhacharya/aesara | cbf91122296b68ee2ad592b2312d56f6ff65ba53 | [
"BSD-3-Clause"
] | null | null | null | aesara/gpuarray/optdb.py | anirudhacharya/aesara | cbf91122296b68ee2ad592b2312d56f6ff65ba53 | [
"BSD-3-Clause"
] | null | null | null | from aesara.compile import optdb
from aesara.graph.opt import GraphToGPULocalOptGroup, TopoOptimizer, local_optimizer
from aesara.graph.optdb import (
EquilibriumDB,
LocalGroupDB,
OptimizationDatabase,
SequenceDB,
)
gpu_optimizer = EquilibriumDB()
gpu_cut_copies = EquilibriumDB()
# Not used for an EquilibriumOptimizer. It has the "tracks" that we need for GraphToGPUDB.
gpu_optimizer2 = EquilibriumDB()
gpu_seqopt = SequenceDB()
# do not add 'fast_run' to these two as this would always enable gpuarray mode
optdb.register(
"gpuarray_opt",
gpu_seqopt,
optdb.__position__.get("add_destroy_handler", 49.5) - 1,
"gpuarray",
)
pool_db = LocalGroupDB()
pool_db2 = LocalGroupDB(local_opt=GraphToGPULocalOptGroup)
pool_db2.__name__ = "pool_db2"
matrix_ops_db = LocalGroupDB()
matrix_ops_db2 = LocalGroupDB(local_opt=GraphToGPULocalOptGroup)
matrix_ops_db2.__name__ = "matrix_ops_db2"
abstract_batch_norm_db = LocalGroupDB()
abstract_batch_norm_db2 = LocalGroupDB(local_opt=GraphToGPULocalOptGroup)
abstract_batch_norm_db2.__name__ = "abstract_batch_norm_db2"
abstract_batch_norm_groupopt = LocalGroupDB()
abstract_batch_norm_groupopt.__name__ = "gpuarray_batchnorm_opts"
def register_opt(*tags, **kwargs):
def f(local_opt):
name = (kwargs and kwargs.pop("name")) or local_opt.__name__
gpu_optimizer.register(name, local_opt, "fast_run", "gpuarray", *tags)
return local_opt
return f
def register_opt2(tracks, *tags, **kwargs):
"""
Decorator for the new GraphToGPU optimizer.
Takes an extra parameter(Op) compared to register_opt decorator.
Parameters
----------
tracks : List of Op class Or Op instance or None
The Node's Op to which optimization is being applied.
tags : String
The optimization tag to which the optimizer will be registered.
"""
def f(local_opt):
name = (kwargs and kwargs.pop("name")) or local_opt.__name__
if isinstance(local_opt, OptimizationDatabase):
opt = local_opt
else:
opt = local_optimizer(tracks)(local_opt)
gpu_optimizer2.register(name, opt, "fast_run", "gpuarray", *tags)
return local_opt
return f
def register_inplace(*tags, **kwargs):
def f(local_opt):
name = (kwargs and kwargs.pop("name")) or local_opt.__name__
optdb.register(
name,
TopoOptimizer(local_opt, failure_callback=TopoOptimizer.warn_inplace),
60,
"fast_run",
"inplace",
"gpuarray",
*tags,
)
return local_opt
return f
# Register GPU convolution implementation
# They are tried in a specific order so we can control
# which ones take precedence over others.
abstractconv_groupopt = LocalGroupDB()
abstractconv_groupopt.__name__ = "gpuarray_abstractconv_opts"
register_opt("fast_compile")(abstractconv_groupopt)
class GraphToGPUDB(OptimizationDatabase):
"""
Retrieves the list local optimizers based on the optimizer flag's value
from EquilibriumOptimizer by calling the method query.
"""
def query(self, *tags, **kwtags):
from aesara.gpuarray.opt import GraphToGPU
opt = gpu_optimizer2.query(*tags, **kwtags)
return GraphToGPU(opt.local_optimizers_all, opt.local_optimizers_map)
| 28.632479 | 90 | 0.711343 | 1 | 1.8276 | [
0.0011970603372901678,
0.02324022725224495,
0.008310585282742977,
0.0015284566907212138,
0.004885424394160509,
-0.003581291763111949,
-0.007447507232427597,
0.003591045504435897,
-0.005544896237552166,
0.0027171680703759193,
0.0023487270809710026,
0.0040482813492417336,
0.007880546152591705,
-0.016991809010505676,
0.0005234006675891578,
0.016255054622888565,
-0.05218794196844101,
0.004304811358451843,
-0.005604550242424011,
0.003144098911434412,
-0.00783528108149767,
0.0080241234973073,
0.009558634832501411,
0.0062678661197423935,
0.00534637039527297,
-0.0018559825839474797,
0.00968298688530922,
0.0002301507192896679,
-0.005469002295285463,
-0.00764511339366436,
-0.0015322951367124915,
-0.0018984994385391474,
-0.006597552448511124,
-0.008102997206151485,
0.007148443721234798,
-0.0038705836050212383,
-0.0011263461783528328,
-0.019747406244277954,
0.011682010255753994,
-0.004410137888044119,
-0.004957345314323902,
-0.01468183845281601,
0.0009838230907917023,
0.005215146113187075,
-0.009954526089131832,
0.0017609550850465894,
-0.003766804002225399,
0.00314947753213346,
-0.010055351071059704,
0.00732765905559063,
-0.008014651946723461,
0.005929055158048868,
0.014653493650257587,
0.0031741345301270485,
-0.0053906007669866085,
-0.00611802376806736,
0.012974639423191547,
-0.00019035118748433888,
-0.010393709875643253,
-0.0011823646491393447,
-0.004793075378984213,
-0.0021689848508685827,
0.004508404992520809,
0.0018776076612994075,
-0.014327770099043846,
-0.008035640232264996,
-0.0029523461125791073,
0.0032530578318983316,
-0.001241575344465673,
0.006643955130130053,
0.0003941990144085139,
-0.0005626593483611941,
0.008973352611064911,
0.004121513571590185,
0.003305783262476325,
-0.004693783354014158,
-0.000006907864189997781,
0.0002883833076339215,
0.007413915824145079,
0.004136649426072836,
0.0036558399442583323,
-0.0061197951436042786,
0.00390913849696517,
0.009764098562300205,
0.014529675245285034,
0.008064236491918564,
0.020514369010925293,
-0.011833208613097668,
0.04655489698052406,
0.00796029344201088,
-0.009011846967041492,
0.0017655178671702743,
-0.006782562471926212,
-0.002987593412399292,
-0.0023519762326031923,
-0.027188537642359734,
0.0004849466204177588,
-0.0033941511064767838,
0.00013290156493894756,
0.0034900344908237457,
-0.0011978944530710578,
0.0060954648070037365,
-0.0007295099785551429,
-0.002015090547502041,
-0.007607803680002689,
0.010829564183950424,
-0.008167954161763191,
-0.0013461883645504713,
0.008380616083741188,
0.00238280207850039,
-0.012104433961212635,
-0.002358425175771117,
0.0035027493722736835,
-0.01204453781247139,
0.003760682651773095,
0.002064256463199854,
-0.006553128361701965,
0.05394626408815384,
-0.001675087260082364,
0.001242046826519072,
-0.004383480176329613,
0.002733301604166627,
0.0038390906993299723,
0.00641974713653326,
0.009511305950582027,
-0.0029504052363336086,
0.01298680528998375,
0.009121633134782314,
0.003739228006452322,
0.00764522235840559,
-0.0014129738556221128,
0.006558569148182869,
-0.0038186078891158104,
-0.004197912290692329,
0.001983783906325698,
-0.006388300564140081,
0.009126274846494198,
-0.0016279760748147964,
-0.009792781434953213,
0.0019392900867387652,
-0.0007316686096601188,
-0.01119135320186615,
0.00015105062630027533,
-0.0052737588994205,
0.003731771372258663,
-0.00866642501205206,
-0.0024314827751368284,
-0.0045209843665361404,
-0.004642019979655743,
0.0027248449623584747,
0.010066674090921879,
0.002731483895331621,
0.003119439585134387,
-0.005616545211523771,
-0.009353836067020893,
0.000057716923038242385,
-0.004515516106039286,
0.0014540536794811487,
0.007004520855844021,
0.003131208475679159,
-0.009349683299660683,
-0.0012363794958218932,
0.002933400683104992,
0.003068098798394203,
-0.00039575507980771363,
0.002851503435522318,
-0.008675919845700264,
0.006267823278903961,
0.00004668714609579183,
0.0025480398908257484,
0.010788151063024998,
-0.003998137544840574,
-0.0010167515138164163,
0.000085907377069816,
0.0010159756056964397,
-0.0010616439394652843,
0.005104852840304375,
0.010411801747977734,
-0.0005175479454919696,
-0.004380161873996258,
0.004953948315232992,
0.0051976642571389675,
0.009449606761336327,
0.003862501820549369,
-0.002940279431641102,
0.003532129805535078,
-0.004438923671841621,
-0.0015131954569369555,
0.00654373737052083,
-0.00431751599535346,
0.004540746565908194,
0.0044012819416821,
-0.013578667305409908,
-0.008123802952468395,
0.001432550954632461,
-0.007243768777698278,
0.0017976141534745693,
0.01616295427083969,
0.01001804880797863,
-0.0019134311005473137,
0.004442125558853149,
-0.009180239401757717,
0.0012403489090502262,
0.00676606222987175,
0.002643994987010956,
-0.012173320166766644,
-0.9591338634490967,
0.005707661155611277,
0.004443420097231865,
-0.0022697411477565765,
0.0037156844045966864,
0.003632364794611931,
0.0038926114793866873,
0.005143607500940561,
0.01552700623869896,
-0.008964980021119118,
-0.005973018705844879,
-0.010328774340450764,
-0.01081762183457613,
-0.0011237440630793571,
-0.007485333364456892,
-0.0021374619100242853,
-0.005525295622646809,
-0.0060375104658305645,
0.0003459587460383773,
-0.002898885402828455,
-0.00212141708470881,
0.010290873236954212,
0.0007944090757519007,
0.005185482557862997,
0.0029514331836253405,
0.00406276760622859,
-0.005385305732488632,
-0.00019968634296674281,
-0.0031936313025653362,
-0.0029532499611377716,
-0.006164629478007555,
-0.01553813274949789,
-0.004615597426891327,
-0.0013813786208629608,
0.010296689346432686,
-0.0009198377374559641,
0.00948156788945198,
-0.00359587324783206,
0.001505295978859067,
-0.007954785600304604,
0.0054810238070786,
-0.0005191337550058961,
0.0031362641602754593,
-0.030053913593292236,
-0.002070296322926879,
-0.0009787589078769088,
-0.008866229094564915,
0.008924366906285286,
0.000200760638108477,
0.0001265100436285138,
-0.003649198915809393,
-0.0060356054455041885,
0.0075603690929710865,
-0.008044564165174961,
0.003408401506021619,
-0.005465928930789232,
-0.008214224129915237,
-0.0013490387937054038,
-0.009370815940201283,
0.0013316088588908315,
0.004033506382256746,
-0.0019585827831178904,
-0.003562784055247903,
-0.003124742303043604,
0.004091538954526186,
0.0025477870367467403,
0.001958429114893079,
-0.01783175766468048,
-0.007093378808349371,
0.0016020606271922588,
0.0019832546822726727,
-0.0029029548168182373,
-0.002495404565706849,
0.004329107701778412,
-0.009712469764053822,
0.006266506388783455,
0.0007084157550707459,
-0.000796270091086626,
-0.01229755487293005,
-0.00042203953489661217,
-0.008998779579997063,
-0.007603477220982313,
0.0004133960173930973,
-0.005474115256220102,
-0.005197970662266016,
-0.00036218276363797486,
-0.0006207186379469931,
0.006881697569042444,
-0.004460764117538929,
0.005058226175606251,
0.01052143331617117,
-0.004033676348626614,
-0.009211037307977676,
0.006368374451994896,
0.007067997474223375,
0.0018857332179322839,
-0.0019356393022462726,
0.001152134034782648,
0.007765704300254583,
0.006990051828324795,
0.0020015339832752943,
0.004607603419572115,
-0.00043041649041697383,
0.010362927801907063,
-0.0015952582471072674,
-0.0005702603957615793,
-0.004414482973515987,
-0.0017552004428580403,
-0.004133645910769701,
-0.0018804676365107298,
-0.003202071413397789,
-0.0025415788404643536,
-0.01214628852903843,
-0.008644786663353443,
-0.003013457404449582,
-0.0010449070250615478,
0.003583459882065654,
-0.005511006806045771,
0.00038007358671166003,
0.0032213947270065546,
0.00746565917506814,
-0.001372454222291708,
-0.003216228913515806,
-0.0006871874211356044,
0.0022992168087512255,
-0.00562704773619771,
0.01380397379398346,
-0.01218865904957056,
0.006329463794827461,
-0.0008379602804780006,
-0.015150469727814198,
0.006871556397527456,
0.007920610718429089,
-0.0077257463708519936,
0.0018136596772819757,
0.0017012514872476459,
0.0026620086282491684,
-0.0009606598760001361,
-0.005995824933052063,
-0.0030819554813206196,
-0.016256989911198616,
-0.00027895907987840474,
0.020359037443995476,
0.0026182623114436865,
0.010602952912449837,
0.011331633664667606,
-0.002842921996489167,
0.0009372271597385406,
0.004367453511804342,
0.002340681618079543,
0.01298691239207983,
-0.008849363774061203,
0.0005559067358262837,
0.0006113899871706963,
-0.006706668063998222,
0.00010401192412246019,
0.006950494833290577,
0.004600032232701778,
-0.0031654969789087772,
0.00321235042065382,
-0.009621899574995041,
-0.007252814248204231,
-0.018954362720251083,
-0.003586596343666315,
0.007577120326459408,
-0.00511156814172864,
0.005795679055154324,
-0.0140585508197546,
0.0042426688596606255,
0.006161423400044441,
0.003418508218601346,
-0.0001189094691653736,
0.00009439247514819726,
0.005657541565597057,
0.013257725164294243,
-0.00538214948028326,
0.0037644612602889538,
0.002807551994919777,
-0.0009699329966679215,
0.0030423207208514214,
0.010228127241134644,
-0.007240253500640392,
-0.004819538909941912,
0.0028815760742872953,
0.004793895874172449,
0.0006133895367383957,
-0.003462471766397357,
-0.008501371368765831,
-0.004936717916280031,
0.0031816193368285894,
-0.005857375916093588,
0.004092279355973005,
0.0009886195184662938,
0.0029942572582513094,
-0.006045426242053509,
-0.003337226342409849,
-0.004076145589351654,
-0.012564181350171566,
0.009740124456584454,
-0.003383277915418148,
0.003305416088551283,
0.014068560674786568,
0.004057643469423056,
-0.012961259111762047,
0.005378769710659981,
0.010350771248340607,
-0.0035701547749340534,
0.003924939781427383,
0.004780920688062906,
-0.006459712516516447,
-0.02231740765273571,
-0.0025190061423927546,
-0.015641095116734505,
0.005707587115466595,
-0.0011035408824682236,
0.0019479537149891257,
-0.008050908334553242,
0.007300101220607758,
0.007075765170156956,
-0.014056313782930374,
-0.007025944534689188,
-0.007514962460845709,
0.010472927242517471,
0.00023011775920167565,
-0.000042048490286106244,
-0.004484242759644985,
-0.002008771523833275,
-0.0017535549122840166,
-0.00442968774586916,
-0.0029394463635981083,
0.004912057425826788,
0.001961328089237213,
-0.0009301634272560477,
0.0026049581356346607,
-0.005044084507972002,
0.0012295701308175921,
-0.0008552895742468536,
-0.011844752356410027,
0.0006241166847757995,
0.0048894803039729595,
-0.0021995902061462402,
-0.002323772059753537,
-0.00007081734656821936,
-0.0028760815039277077,
-0.007135022897273302,
-0.013514915481209755,
-0.005940331611782312,
-0.004462989047169685,
-0.0032426209654659033,
-0.012868347577750683,
-0.0021851370111107826,
-0.00839294958859682,
0.0071932473219931126,
-0.005546195898205042,
0.007544721011072397,
0.004446020815521479,
-0.004654741380363703,
0.005533975083380938,
-0.0017316717421635985,
0.004740724805742502,
0.0026303224731236696,
0.0062499502673745155,
0.0004858077154494822,
-0.007195250131189823,
-0.011581312865018845,
0.012313143350183964,
-0.009695464745163918,
0.0025448861997574568,
0.012302347458899021,
0.00656201783567667,
0.008409541100263596,
0.00005890370812267065,
0.0011854940094053745,
0.0020933488849550486,
0.0065026371739804745,
-0.014250640757381916,
0.003546806750819087,
-0.002374594798311591,
-0.0003847519401460886,
0.0037919972091913223,
-0.002123963786289096,
0.0006842504371888936,
0.008116370067000389,
0.0013785366900265217,
-0.006954117212444544,
-0.003880996024236083,
0.002306895097717643,
0.0038964559789747,
-0.012757694348692894,
-0.0005489420727826655,
-0.0030743253882974386,
-0.004508421290665865,
-0.0026185549795627594,
-0.0010735028190538287,
-0.0001667536562308669,
0.0028077256865799427,
-0.0021944351028651,
0.006250434555113316,
0.003746591741219163,
-0.005010717548429966,
0.015779374167323112,
-0.0053308927454054356,
-0.005826644133776426,
0.0025587882846593857,
0.0026400049682706594,
-0.0007380966562777758,
-0.0066229901276528835,
-0.0021629170514643192,
0.0021638397593051195,
0.006757558789104223,
-0.003316454356536269,
-0.0033610272221267223,
-0.0019219720270484686,
0.000656912277918309,
-0.01023001316934824,
0.0013568677240982652,
0.011766950599849224,
-0.003444133559241891,
0.005078636109828949,
-0.0020612585358321667,
-0.0069579510018229485,
-0.01573851704597473,
0.05469340458512306,
-0.001535284100100398,
0.002803180366754532,
0.004283524584025145,
-0.008792884647846222,
0.001136074191890657,
-0.003813563846051693,
0.00665421225130558,
-0.007039534859359264,
-0.00611270684748888,
0.009096192196011543,
-0.003718024818226695,
0.002839217195287347,
0.006239401176571846,
-0.0015796155203133821,
0.015444647520780563,
-0.0035603425931185484,
-0.018459834158420563,
-0.01775536686182022,
0.008145231753587723,
-0.004474874120205641,
-0.006727016530930996,
0.01038577500730753,
-0.0036161330062896013,
-0.0035321444738656282,
0.0005760536296293139,
0.005494353827089071,
0.0023598193656653166,
0.0009910990484058857,
-0.0017984526930376887,
-0.002069565700367093,
-0.0018248005071654916,
0.0021475232206285,
0.004915590398013592,
0.0063597881235182285,
-0.0023063388653099537,
0.0042525408789515495,
0.000587829330470413,
-0.002686363412067294,
-0.0009264621767215431,
0.003754004603251815,
0.007293845992535353,
-0.0007108238060027361,
0.000026820531275006942,
0.005470257718116045,
0.005423474591225386,
0.0035575944930315018,
0.011416257359087467,
-0.0008684521308168769,
-0.006071900483220816,
0.008807042613625526,
0.0055383252911269665,
0.0014770792331546545,
0.009016415104269981,
0.0003361573617439717,
0.006932935211807489,
0.0011407716665416956,
-0.008988874033093452,
-0.015459070913493633,
-0.0015791647601872683,
0.006576115731149912,
0.009077313356101513,
-0.0009072593529708683,
0.00038534740451723337,
-0.003535622963681817,
-0.002465521451085806,
-0.005934043321758509,
-0.0073568690568208694,
-0.0014032685430720448,
0.002028668997809291,
0.0023592605721205473,
0.06989544630050659,
-0.0062819477170705795,
-0.0010190147440880537,
-0.008364969864487648,
-0.0018293276662006974,
-0.0018802173435688019,
-0.0010254610097035766,
-0.0007733762031421065,
-0.0029360316693782806,
0.003450821153819561,
0.0020206752233207226,
-0.007609073538333178,
-0.012248139828443527,
-0.0008986612083390355,
0.0018457977566868067,
-0.0033780469093471766,
0.0044662486761808395,
0.00633581355214119,
-0.009363126941025257,
0.0014679686864838004,
-0.01283537968993187,
-0.0011374405585229397,
-0.0017727400409057736,
-0.008799426257610321,
-0.0032945014536380768,
-0.0026268463116139174,
0.004721477162092924,
0.0014729229733347893,
0.00579771026968956,
-0.0038577092345803976,
0.0061526172794401646,
-0.003119837725535035,
-0.0010087370174005628,
-0.0032021196093410254,
-0.0016992739401757717,
-0.006429741624742746,
0.007256528362631798,
0.0006410277565009892,
-0.009064772166311741,
-0.004734405316412449,
0.000053360348829301074,
0.00194353680126369,
-0.005528781563043594,
0.0031181941740214825,
0.0014877457870170474,
0.007110035978257656,
-0.0033879473339766264,
0.0008379430510103703,
-0.006747882347553968,
0.00131233932916075,
-0.009837641380727291,
0.005896633956581354,
-0.17043732106685638,
0.009887098334729671,
0.00411575473845005,
-0.007283944636583328,
-0.003018181072548032,
-0.015244957990944386,
-0.0044656735844910145,
0.0034588919952511787,
0.010429193265736103,
0.0016031580744311213,
-0.0006449550273828208,
-0.0024951710365712643,
0.0053034815937280655,
0.0029410100542008877,
-0.0028770698700100183,
-0.004935627803206444,
0.0036475493106991053,
-0.003843456506729126,
0.001684076152741909,
0.005019790958613157,
0.005432002246379852,
0.008051467128098011,
0.0025107646360993385,
0.001737851882353425,
-0.0029630076605826616,
-0.005198734812438488,
0.00720856012776494,
-0.001756825135089457,
0.0060460795648396015,
-0.013074790127575397,
-0.0029281482566148043,
-0.0044026682153344154,
-0.004443977028131485,
0.0008384330430999398,
0.006135663017630577,
-0.000009697256245999597,
0.009107522666454315,
0.0022445067297667265,
-0.00867331214249134,
0.008310439996421337,
-0.007042197976261377,
0.028594139963388443,
0.005123009439557791,
0.005967693403363228,
-0.0022104743402451277,
-0.0056274449452757835,
-0.005035705864429474,
0.008602294139564037,
0.0036178322043269873,
0.011798547580838203,
-0.014263623394072056,
0.0007768182549625635,
0.004284626804292202,
0.01588372327387333,
-0.00507625425234437,
-0.009570795111358166,
-0.004167815204709768,
-0.003883614204823971,
0.0023083328269422054,
0.008483638986945152,
0.010315872728824615,
-0.003707998665049672,
0.008807084523141384,
-0.0009148907265625894,
-0.023204989731311798,
0.0032931393943727016,
-0.004111436195671558,
-0.00671793520450592,
0.002446396742016077,
0.007637131959199905,
0.008905524387955666,
-0.0011655298294499516,
0.0028734044171869755,
-0.0017107053427025676,
0.005916670896112919,
-0.0001242588768946007,
0.004858161322772503,
-0.0010980735532939434,
0.007558446377515793,
-0.008414826355874538,
0.006896300707012415,
-0.00838832464069128,
-0.004384578671306372,
0.0031861746683716774,
-0.0062535787001252174,
0.01151210442185402,
0.0040383306331932545,
-0.002193212043493986,
0.00042007307638414204,
-0.010081594809889793,
-0.0026013499591499567,
0.002219234127551317,
0.000638608995359391,
-0.008545021526515484,
0.0016181288519874215,
-0.0006164831575006247,
0.006217988673597574,
0.007781061343848705,
-0.009712769649922848,
0.0067636785097420216,
0.004404911305755377,
-0.004671920090913773,
0.0011254651471972466,
-0.002713631372898817,
0.0008491305634379387,
0.0045507438480854034,
-0.00629693828523159,
-0.005682534538209438,
0.0037968510296195745,
-0.008171129040420055,
-0.0047400156036019325,
0.0076213800348341465,
-0.010168395936489105,
-0.009147954173386097,
-0.0024130851961672306,
-0.01088032964617014,
0.0006662758532911539
] |
8a810acd6b334888a1432a3e590727946894d380 | 4,579 | py | Python | jenkinsapi/node.py | imsardine/jenkinsapi | d4bfac62a4d01394ff41540c4d8d897ab566f4eb | [
"MIT"
] | null | null | null | jenkinsapi/node.py | imsardine/jenkinsapi | d4bfac62a4d01394ff41540c4d8d897ab566f4eb | [
"MIT"
] | null | null | null | jenkinsapi/node.py | imsardine/jenkinsapi | d4bfac62a4d01394ff41540c4d8d897ab566f4eb | [
"MIT"
] | null | null | null | """
Module for jenkinsapi Node class
"""
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.custom_exceptions import PostRequired
import logging
try:
from urllib import quote as urlquote
except ImportError:
# Python3
from urllib.parse import quote as urlquote
log = logging.getLogger(__name__)
class Node(JenkinsBase):
"""
Class to hold information on nodes that are attached as slaves
to the master jenkins instance
"""
def __init__(self, baseurl, nodename, jenkins_obj):
"""
Init a node object by providing all relevant pointers to it
:param baseurl: basic url for querying information on a node
:param nodename: hostname of the node
:param jenkins_obj: ref to the jenkins obj
:return: Node obj
"""
self.name = nodename
self.jenkins = jenkins_obj
JenkinsBase.__init__(self, baseurl)
def get_jenkins_obj(self):
return self.jenkins
def __str__(self):
return self.name
def is_online(self):
return not self.poll(tree='offline')['offline']
def is_temporarily_offline(self):
return self.poll(tree='temporarilyOffline')['temporarilyOffline']
def is_jnlpagent(self):
return self._data['jnlpAgent']
def is_idle(self):
return self._data['idle']
def set_online(self):
"""
Set node online.
Before change state verify client state: if node set 'offline'
but 'temporarilyOffline' is not set - client has connection problems
and AssertionError raised.
If after run node state has not been changed raise AssertionError.
"""
self.poll()
# Before change state check if client is connected
if self._data['offline'] and not self._data['temporarilyOffline']:
raise AssertionError("Node is offline and not marked as "
"temporarilyOffline, check client "
"connection: offline = %s, "
"temporarilyOffline = %s" %
(self._data['offline'],
self._data['temporarilyOffline']))
elif self._data['offline'] and self._data['temporarilyOffline']:
self.toggle_temporarily_offline()
if self._data['offline']:
raise AssertionError("The node state is still offline, "
"check client connection:"
" offline = %s, "
"temporarilyOffline = %s" %
(self._data['offline'],
self._data['temporarilyOffline']))
def set_offline(self, message="requested from jenkinsapi"):
"""
Set node offline.
If after run node state has not been changed raise AssertionError.
: param message: optional string explain why you are taking this
node offline
"""
if not self._data['offline']:
self.toggle_temporarily_offline(message)
data = self.poll(tree='offline,temporarilyOffline')
if not data['offline']:
raise AssertionError("The node state is still online:" +
"offline = %s , temporarilyOffline = %s" %
(data['offline'],
data['temporarilyOffline']))
def toggle_temporarily_offline(self, message="requested from jenkinsapi"):
"""
Switches state of connected node (online/offline) and
set 'temporarilyOffline' property (True/False)
Calling the same method again will bring node status back.
:param message: optional string can be used to explain why you
are taking this node offline
"""
initial_state = self.is_temporarily_offline()
url = self.baseurl + \
"/toggleOffline?offlineMessage=" + urlquote(message)
try:
html_result = self.jenkins.requester.get_and_confirm_status(url)
except PostRequired:
html_result = self.jenkins.requester.post_and_confirm_status(
url,
data={})
self.poll()
log.debug(html_result)
state = self.is_temporarily_offline()
if initial_state == state:
raise AssertionError(
"The node state has not changed: temporarilyOffline = %s" %
state)
| 37.227642 | 79 | 0.580913 | 1 | 1.8156 | [
0.0001911717263283208,
0.024993428960442543,
0.00672324700281024,
0.0006246462580747902,
0.006731107365339994,
-0.004895357880741358,
-0.009117190726101398,
0.002235152991488576,
-0.007117263972759247,
0.0033133039250969887,
0.0031127657275646925,
0.005340322386473417,
0.007882160134613514,
-0.01371685229241848,
-0.0005917847738601267,
0.015336815267801285,
-0.05146817862987518,
0.0018426587339490652,
-0.004419203847646713,
0.0001887168182292953,
-0.0066484385170042515,
0.009603363461792469,
0.009639361873269081,
0.005145630333572626,
0.008224972523748875,
-0.00014629024371970445,
0.007707945536822081,
0.0020421103108674288,
-0.009491208009421825,
-0.007811249233782291,
-0.00019017890735995024,
-0.0034070538822561502,
-0.0037888705264776945,
-0.007267924025654793,
0.00659917201846838,
-0.004410278983414173,
-0.002036439720541239,
-0.021549900993704796,
0.012247629463672638,
-0.005700842943042517,
-0.006189506035298109,
-0.014576192945241928,
-0.0020244966726750135,
0.0031815418042242527,
-0.007822379469871521,
0.0001389370154356584,
-0.004471383057534695,
0.00234073749743402,
-0.01087938528507948,
0.007091607432812452,
-0.009140498004853725,
0.005801355000585318,
0.013924635015428066,
0.001836910960264504,
-0.006991180591285229,
-0.007101998198777437,
0.013746100477874279,
-0.0012082421453669667,
-0.008954617194831371,
-0.0020426271948963404,
-0.00477234972640872,
-0.0025142368394881487,
0.005757134407758713,
0.0020182132720947266,
-0.018663885071873665,
-0.007188698742538691,
-0.0045077018439769745,
0.0025895738508552313,
-0.0008124664891511202,
0.006974502932280302,
-0.0005866573192179203,
0.00004533982428256422,
0.008680774830281734,
0.005792492069303989,
0.004886632319539785,
-0.005012098234146833,
-0.0018754705088213086,
-0.0008502319105900824,
0.00959357712417841,
0.0025625410489737988,
0.003503254381939769,
-0.008471952751278877,
0.006790322717279196,
0.00976606085896492,
0.013755928725004196,
0.009429915808141232,
0.022914016619324684,
-0.013523045927286148,
0.048279061913490295,
0.008888010866940022,
-0.010217228904366493,
0.0018502838211134076,
-0.0068860952742397785,
-0.001641429029405117,
-0.006123669911175966,
-0.027346724644303322,
0.0003313866909593344,
-0.004204551689326763,
-0.0014338212786242366,
0.003151634009554982,
-0.000049728820158634335,
0.00522348890081048,
-0.0009294742485508323,
-0.0008429836598224938,
-0.008624084293842316,
0.012307907454669476,
-0.010330081917345524,
-0.003950129263103008,
0.006851459853351116,
-0.00021948966605123132,
-0.010615574195981026,
-0.0033257503528147936,
0.0025686733424663544,
-0.013222161680459976,
0.0024490938521921635,
0.0018821178236976266,
-0.006257340312004089,
0.05321436747908592,
-0.0013225789880380034,
0.006454979535192251,
-0.004712803289294243,
0.00402468116953969,
0.0005839161458425224,
0.00472903111949563,
0.00947305653244257,
-0.0016337028937414289,
0.011379232630133629,
0.009832206182181835,
0.002451109467074275,
0.008932306431233883,
-0.0037575773894786835,
0.008349481970071793,
-0.005824053660035133,
-0.003964429255574942,
0.0019875841680914164,
-0.004905962385237217,
0.006614936515688896,
-0.002910775598138571,
-0.010068491101264954,
0.0026827258989214897,
-0.00011485582945169881,
-0.009212318807840347,
0.0014480866957455873,
-0.00369621766731143,
0.0038945337291806936,
-0.010156741365790367,
-0.0009177649626508355,
-0.0039569903165102005,
-0.005165646784007549,
0.0038158155512064695,
0.010628360323607922,
0.00416597118601203,
0.0034871241077780724,
-0.004942457191646099,
-0.009840084239840508,
0.0005087187746539712,
-0.005297680385410786,
0.0009262209059670568,
0.008252270519733429,
0.004235193133354187,
-0.010481603443622589,
0.0007085239049047232,
0.0016237973468378186,
0.002772559644654393,
-0.0008697410230524838,
0.004272902384400368,
-0.008643368259072304,
0.007726595737040043,
-0.0008121274295262992,
0.004524313844740391,
0.012333338148891926,
-0.003726514521986246,
-0.0017498275265097618,
0.000992507440969348,
0.001854663249105215,
-0.0030674387235194445,
0.00656085042282939,
0.010233829729259014,
-0.004368108231574297,
-0.004067377652972937,
0.005587879102677107,
0.0046844142489135265,
0.00913966540247202,
0.0028292753268033266,
-0.002322300337255001,
0.0013136352645233274,
-0.004808088298887014,
-0.00264300056733191,
0.005452245008200407,
-0.005107864737510681,
0.005128410644829273,
0.00538023142144084,
-0.013367675244808197,
-0.010749340988695621,
0.0011650313390418887,
-0.009668190032243729,
0.0016330473590642214,
0.016539672389626503,
0.01159219816327095,
-0.0029813970904797316,
0.00360400159843266,
-0.010230440646409988,
0.0020090017933398485,
0.007588305976241827,
0.0027126658242195845,
-0.013176926411688328,
-0.9586275815963745,
0.007209887728095055,
0.001760666724294424,
-0.0018208939582109451,
0.006489391438663006,
0.0012722730170935392,
0.004899904131889343,
0.004100378602743149,
0.01454782485961914,
-0.010251245461404324,
-0.007301530800759792,
-0.01168234646320343,
-0.012999426573514938,
0.00048556356341578066,
-0.007533658295869827,
-0.0038094662595540285,
-0.005812797229737043,
-0.005880181211978197,
-0.003218604950234294,
-0.002442882861942053,
-0.0008055167272686958,
0.008413717150688171,
-0.00023250028607435524,
0.004853267688304186,
0.00121237151324749,
0.004865334369242191,
-0.006219528149813414,
-0.0019600004889070988,
-0.00315601727925241,
-0.001856809831224382,
-0.006864534690976143,
-0.014564351178705692,
-0.0048316423781216145,
-0.002422695979475975,
0.011171482503414154,
-0.000025574136088835075,
0.008952121250331402,
-0.0042672595009207726,
0.0025111089926213026,
-0.007920063100755215,
0.00512745650485158,
0.00043719325913116336,
0.0036250536795705557,
-0.029215538874268532,
-0.0013590389862656593,
0.0016882491763681173,
-0.008062746375799179,
0.00857546366751194,
-0.00034464203054085374,
-0.00152336445171386,
-0.0028894003480672836,
-0.004083092324435711,
0.010118995793163776,
-0.006675295066088438,
0.001962544396519661,
-0.004618317354470491,
-0.008362720720469952,
-0.002845628419891,
-0.007044078782200813,
0.0009462286834605038,
0.004109540954232216,
-0.002197723602876067,
-0.005699575878679752,
-0.0019937336910516024,
0.0032061119563877583,
0.003336076159030199,
0.0022568125277757645,
-0.017956633120775223,
-0.0065862322226166725,
0.00027972442330792546,
0.001578881754539907,
-0.0034710478503257036,
-0.0032685836777091026,
0.005721673835068941,
-0.009301858954131603,
0.005246477201581001,
0.0041980985552072525,
0.001987170660868287,
-0.013119316659867764,
-0.000730230298358947,
-0.008950239047408104,
-0.006138094700872898,
0.0019529263954609632,
-0.0034434350673109293,
-0.006640875246375799,
0.001788509194739163,
0.0006967612425796688,
0.005902304779738188,
-0.00416541425511241,
0.005158994812518358,
0.01152875181287527,
-0.003742919070646167,
-0.00836519617587328,
0.004805615171790123,
0.006400375626981258,
0.0014412408927455544,
-0.001359543763101101,
0.003538122633472085,
0.008344137109816074,
0.007156012114137411,
0.0023573115468025208,
0.005706545431166887,
0.0010023467475548387,
0.008455266244709492,
0.00007973137689987198,
-0.00009432587103219703,
-0.00502365455031395,
0.0003438209241721779,
-0.004396914504468441,
0.00026514503406360745,
-0.002743892604485154,
-0.0025714521761983633,
-0.010814071632921696,
-0.00943500641733408,
-0.004963869694620371,
-0.00038698394200764596,
0.004489427898079157,
-0.005357390269637108,
-0.0012989829992875457,
0.0013545494293794036,
0.007450674660503864,
0.0019937935285270214,
-0.0026312770787626505,
-0.0007940335781313479,
0.003633121494203806,
-0.0070321811363101006,
0.01258892472833395,
-0.012411996722221375,
0.005944729782640934,
-0.0009143230272457004,
-0.017771875485777855,
0.008646746166050434,
0.006912650540471077,
-0.009236897341907024,
0.0015917285345494747,
0.002961577847599983,
0.0034291523043066263,
0.0009012733935378492,
-0.0034651828464120626,
-0.00352794979698956,
-0.015920575708150864,
-0.0005659991293214262,
0.02050609327852726,
0.00017771709826774895,
0.011558000929653645,
0.009756181389093399,
-0.0036053587682545185,
0.001627969671972096,
0.006413629278540611,
0.003355041379109025,
0.012743922881782055,
-0.009838287718594074,
0.0003684513212647289,
0.0010223917197436094,
-0.005170940887182951,
-0.00011063823330914602,
0.00516094733029604,
0.005794167518615723,
-0.003022607648745179,
0.002882177010178566,
-0.007891274057328701,
-0.00523484917357564,
-0.014930439181625843,
-0.0017181254224851727,
0.0068063135258853436,
-0.0042543839663267136,
0.006058011669665575,
-0.010945150628685951,
0.0026202506851404905,
0.007002335973083973,
0.003595170797780156,
0.001885642996057868,
0.00028419127920642495,
0.005074393004179001,
0.011118195950984955,
-0.005773087963461876,
0.0024004941806197166,
0.002547871321439743,
-0.00019352987874299288,
0.0024281779769808054,
0.007061060052365065,
-0.007859442383050919,
-0.0046708169393241405,
0.0033942703157663345,
0.0025283601135015488,
0.0005426642601378262,
-0.004507861565798521,
-0.008223036304116249,
-0.004080478101968765,
0.0043508270755410194,
-0.004697875585407019,
0.004000385291874409,
0.0014698924496769905,
0.0028334211092442274,
-0.008263183757662773,
-0.0019023027271032333,
-0.0013391554821282625,
-0.011833583004772663,
0.011022632010281086,
-0.0027479969430714846,
0.002371438778936863,
0.014092285186052322,
0.004318965133279562,
-0.013241163454949856,
0.0048271906562149525,
0.008431032299995422,
-0.002829206408932805,
0.005357763264328241,
0.004464711062610149,
-0.005689631216228008,
-0.021822717040777206,
-0.003820578334853053,
-0.01395193487405777,
0.004836238920688629,
-0.002908989554271102,
0.00589959928765893,
-0.008680891245603561,
0.006553085055202246,
0.008652910590171814,
-0.01424469519406557,
-0.004286693409085274,
-0.00872568879276514,
0.010747180320322514,
-0.00008309678378282115,
0.001183616346679628,
-0.0032425301615148783,
-0.0024555239360779524,
-0.0006088232039473951,
-0.00445453030988574,
-0.0013716684188693762,
0.005683539435267448,
0.00216791988350451,
-0.0022567096166312695,
0.0011936393566429615,
-0.005770524498075247,
-0.0003457346756476909,
0.0003941032337024808,
-0.01064992044121027,
0.0026900246739387512,
0.005256163887679577,
-0.0037872744724154472,
-0.002019347157329321,
0.0023863075766712427,
-0.0046560331247746944,
-0.008147652260959148,
-0.01265698205679655,
-0.002839685184881091,
-0.004995491821318865,
-0.00402797432616353,
-0.011216480284929276,
-0.001430281437933445,
-0.007579398807138205,
0.006783791817724705,
-0.007207428105175495,
0.00791773572564125,
0.006028695497661829,
-0.004711540415883064,
0.005626932717859745,
-0.0011434269836172462,
0.0040451460517942905,
0.003848208812996745,
0.006241705734282732,
0.0022498180624097586,
-0.005632062442600727,
-0.013566369190812111,
0.01213877834379673,
-0.008349193260073662,
0.0009277496137656271,
0.01525233406573534,
0.005623175296932459,
0.00917586125433445,
0.00019961748330388218,
-0.0005831347079947591,
0.0007361924508586526,
0.00522610591724515,
-0.015402100048959255,
0.004857427906244993,
-0.004192638676613569,
0.00032417691545560956,
0.004074047319591045,
-0.00226150406524539,
0.0034617639612406492,
0.008996495045721531,
0.002864374313503504,
-0.008130397647619247,
-0.002336360514163971,
0.0020728823728859425,
0.005174178630113602,
-0.0130344582721591,
0.0004201673436909914,
-0.0038871492724865675,
-0.0032970954198390245,
-0.002850782126188278,
-0.002738476265221834,
0.0004324550391174853,
0.0041493806056678295,
-0.0030056852847337723,
0.0052346521988511086,
0.0008793187444098294,
-0.004161335527896881,
0.015181866474449635,
-0.0057766069658100605,
-0.006432231515645981,
0.0022973797749727964,
0.0027238463517278433,
-0.003703540423884988,
-0.003848507534712553,
-0.0020238773431628942,
0.0023444844409823418,
0.009349152445793152,
-0.002685947809368372,
-0.003889379557222128,
-0.0003312196349725127,
0.0003694012120831758,
-0.00925508514046669,
0.00014226327766664326,
0.012799791060388088,
-0.0038048129063099623,
0.006508109159767628,
-0.004206179175525904,
-0.005817190743982792,
-0.015046518296003342,
0.05268900468945503,
-0.00021594318968709558,
0.003888568375259638,
0.002811746671795845,
-0.0071794516406953335,
0.0002343897067476064,
-0.0006587206153199077,
0.006778998300433159,
-0.00596414040774107,
-0.007129891775548458,
0.008348491974174976,
-0.0021261374931782484,
0.004631845746189356,
0.004522699862718582,
-0.0006427007610909641,
0.015713177621364594,
-0.0025262022390961647,
-0.015564369037747383,
-0.018102578818798065,
0.007777098100632429,
-0.006497001275420189,
-0.007666440214961767,
0.010652738623321056,
-0.0024194030556827784,
-0.003919054754078388,
0.0001536895870231092,
0.004972666036337614,
-0.00023698537552263588,
0.0013315571704879403,
-0.003064114833250642,
-0.00228870683349669,
-0.0006585787050426006,
0.0014764193911105394,
0.0038242714945226908,
0.0075591919012367725,
-0.0029491595923900604,
0.0024223257787525654,
-0.001843186211772263,
-0.0018036025576293468,
-0.0006699603400193155,
0.0045859552919864655,
0.009530655108392239,
0.0004390960675664246,
-0.0019249668112024665,
0.004745081532746553,
0.0062241810373961926,
0.0007884211954660714,
0.011357933282852173,
-0.0006287961732596159,
-0.006014753133058548,
0.007826047949492931,
0.00812097080051899,
-0.001050442224368453,
0.008967376314103603,
0.0015207066899165511,
0.005684626288712025,
0.0030154611449688673,
-0.00731551693752408,
-0.015575477853417397,
-0.003937324043363333,
0.007023032754659653,
0.008637837134301662,
-0.001604262157343328,
0.0004224854346830398,
-0.0035204675514250994,
-0.0017630788497626781,
-0.0045392075553536415,
-0.010297603905200958,
-0.0012110660318285227,
0.0015199179761111736,
0.006957917474210262,
0.0700375884771347,
-0.00674743065610528,
-0.0019430093234404922,
-0.007984652183949947,
-0.0012217283947393298,
-0.0022226457949727774,
0.00026125393924303353,
0.0014666235074400902,
-0.0024738945066928864,
0.0022625154815614223,
0.0022624998819082975,
-0.0067692892625927925,
-0.009709233418107033,
0.0009097986039705575,
0.0010451492853462696,
-0.003965246956795454,
0.004756358917802572,
0.005004289094358683,
-0.007731935475021601,
0.0008988312329165637,
-0.012551788240671158,
-0.0031172307208180428,
-0.0012991612311452627,
-0.011930488049983978,
-0.0031713279895484447,
-0.0053582764230668545,
0.005262377671897411,
0.0027698026970028877,
0.007050907704979181,
-0.0035355924628674984,
0.006685109343379736,
-0.003452324541285634,
0.0003007980121765286,
-0.005636761896312237,
0.001867759390734136,
-0.0075295306742191315,
0.007847032509744167,
0.0046150158159434795,
-0.012177912518382072,
-0.005921658128499985,
-0.0011487012961879373,
0.0022405190393328667,
-0.006218996364623308,
0.005988245829939842,
0.0004332710523158312,
0.007164974231272936,
-0.004301111213862896,
-0.0014010440791025758,
-0.008059666492044926,
0.0028554811142385006,
-0.012629949487745762,
0.00650807423517108,
-0.1706448197364807,
0.009323298931121826,
0.0032969454769045115,
-0.0047799390740692616,
-0.004289734177291393,
-0.014255543239414692,
-0.004538868088275194,
0.0044444166123867035,
0.00946477334946394,
0.0018189528491348028,
-0.001279467367567122,
-0.005135569255799055,
0.005207384005188942,
0.0027495152316987514,
-0.0013965209946036339,
-0.004137570504099131,
0.0016679370310157537,
-0.0045523070730268955,
-0.000027964973924099468,
0.005678771063685417,
0.005170552060008049,
0.01040763221681118,
0.0013093529269099236,
0.0026101800613105297,
0.0003041682066395879,
-0.0060305409133434296,
0.005879173055291176,
-0.001860621850937605,
0.00358747155405581,
-0.014349043369293213,
-0.0037105984520167112,
-0.0033861291594803333,
-0.00517624756321311,
0.0012578447349369526,
0.005370723083615303,
-0.0010241582058370113,
0.010682578198611736,
0.0023003339301794767,
-0.007550919894129038,
0.008402807638049126,
-0.007958147674798965,
0.027639636769890785,
0.004818068351596594,
0.006784308701753616,
-0.0008356714388355613,
-0.007474282290786505,
-0.0047164903953671455,
0.008101169019937515,
0.0012071977835148573,
0.010794336907565594,
-0.014163120649755001,
-0.0018082259921357036,
0.0037518921308219433,
0.018482742831110954,
-0.004156468436121941,
-0.00853241328150034,
-0.0047743842005729675,
-0.0019576800987124443,
0.0013370929518714547,
0.00769827701151371,
0.012238800525665283,
-0.0019807429052889347,
0.006995055824518204,
-0.003824065439403057,
-0.02438890002667904,
0.0015858847182244062,
-0.004626488778740168,
-0.006011992692947388,
0.0012831288622692227,
0.006965434644371271,
0.008288640528917313,
-0.0005556723335757852,
0.0007440507761202753,
0.0007671164930798113,
0.004111524671316147,
0.000239682529354468,
0.004588929936289787,
-0.002968659857288003,
0.0038442809600383043,
-0.009878778830170631,
0.007881096564233303,
-0.008932838216423988,
0.00031738480902276933,
0.00487828254699707,
-0.005276892799884081,
0.013086078688502312,
0.004060526378452778,
-0.0026173964142799377,
0.00039289670530706644,
-0.009732240810990334,
-0.001969745848327875,
0.0025018276646733284,
0.002640653634443879,
-0.00927712395787239,
0.0020874948240816593,
0.00006431240763049573,
0.004268473945558071,
0.0061172544956207275,
-0.010319598019123077,
0.007100199349224567,
0.004988944157958031,
-0.00651742797344923,
0.0025824361946433783,
-0.006369686219841242,
0.004133216105401516,
0.005215720273554325,
-0.00677071325480938,
-0.006458090618252754,
0.004263347014784813,
-0.004640606231987476,
-0.006699214689433575,
0.005833551287651062,
-0.008862872608006,
-0.008559354580938816,
-0.004115295130759478,
-0.011230777017772198,
0.0003794302756432444
] |
8a82d93e4ba8abbe55f44853090dbccbc8c6e819 | 48,277 | py | Python | edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/gfe/textproducts/templates/product/GenericHazards.py | srcarter3/awips2 | 37f31f5e88516b9fd576eaa49d43bfb762e1d174 | [
"Apache-2.0"
] | null | null | null | edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/gfe/textproducts/templates/product/GenericHazards.py | srcarter3/awips2 | 37f31f5e88516b9fd576eaa49d43bfb762e1d174 | [
"Apache-2.0"
] | null | null | null | edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/gfe/textproducts/templates/product/GenericHazards.py | srcarter3/awips2 | 37f31f5e88516b9fd576eaa49d43bfb762e1d174 | [
"Apache-2.0"
] | 1 | 2021-10-30T00:03:05.000Z | 2021-10-30T00:03:05.000Z | ##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 05/07/2015 4027 randerso Migrated A1 OB9.16 code to A2
# 06/17/2015 4027 dgilling Perform case-insensitive
# comparisons in foundCTAs.
# 07/13/2015 4648 randerso Fix bullets in follow up products
# 02/24/2016 5411 randerso Make bullet headers upper case
# 07/15/2016 5749 randerso Replaced ellipses with commas in hazardBodyText
#
##
# This is a base file that is not intended to be overridden.
##
#-------------------------------------------------------------------------
# Description: This product is a template for creating Hazard Products.
#-------------------------------------------------------------------------
# Copying:
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#-------------------------------------------------------------------------
# Standard and Local file names and Locations:
# GenericHazards
#-------------------------------------------------------------------------
# Customization Points:
#
# DEFINITION SECTION
#
# Required Configuration Items:
#
# displayName If not None, defines how product appears in GFE GUI
#
# You must set the following:
#
# productName defines name of product e.g. "Zone Forecast Product"
# fullStationID Full station identifier, 4 letter, such as "KSLC".
# wmoID WMO ID code for product header, such as "FOUS45"
# pil Product pil, such as "SFTBOS"
# areaName (opt.) Area name for product header, such as "Western New York"
# wfoCityState City,state that the WFO is located in, such as "Buffalo NY"
#
# Optional Configuration Items
#
# mapNameForCombinations Name of the map background that is used for
# creating/editing the combinations file. This must
# be defined or the GFE zone combiner
# database Source database for product. Can be "Official",
# "Fcst" or "ISC"
# outputFile Defines the output location of the finished product.
# Product is saved if autoWrite is 1.
# debug If on, debug_print statements will appear.
# textdbPil Defines the awips product identifier
# (e.g., DENCCFDEN) that is used to store the product
# in the AWIPS text database. The product is not
# automatically stored unless autoStore is 1. This
# value is also used for the default GUI entry for
# storage.
# awipsWANPil Defines the awips product identifier
# (e.g., KBOUCCFDEN) that is used to transmit the
# product to the AWIPS WAN. The product is not
# automatically transmitted unless autoSend is 1.
# This value is also used for the default GUI
# entry for storage.
# autoSend If set to 1, then the product will be automatically
# sent on the AWIPS WAN to the "autoSendAddress" with
# the "awipsWANPil after product creation.
# autoStore If set to 1, then the product will be automatically
# stored into the text database using the "textdbPil"
# after product creation.
# autoWrite If set to 1, then the product will be automatically
# written to the "output" named disk file after
# product creation.
#
# lineLength max length of each line
#
# defaultEditAreas defines edit areas, default is Combinations
#
# purgeTime Maximum number of hours past issuance time for the
# expire time.
# includeCities If 1, cities will be included in the area header
# accurateCities If 1, cities are determined from grids
# citiesPhrase "Including the cities of" phrase used when including
# cities
# includeZoneNames If 1, zone names will be included in the area header
# easPhrase Optional EAS phrase to be include in product header
#
# hazardSamplingThreshold Defines the percentage coverage or number of
# grid points in a zone that must contain the hazard
# in order for it to be considered. Tuple (percent, points)
# includeOverviewHeadline If 1, the overview header is templated
# includeOverview If 1, the overview section is templated
# bulletProd If 1, the product will use a bullet format
#-------------------------------------------------------------------------
# Weather Elements Needed:
# Hazards
#-------------------------------------------------------------------------
# Edit Areas Needed: None
#-------------------------------------------------------------------------
# Associated Utilities Files e.g. Combinations file:
# Combinations file
#-------------------------------------------------------------------------
# Component Products:
# Hazards
#-------------------------------------------------------------------------
# Development tasks that are identified and in progress:
#
# To look up tasks and their status, see the Text Product User Guide
# Section on "Tkgnats: Task Reporting System".
#-------------------------------------------------------------------------
# Additional Information:
#-------------------------------------------------------------------------
# Example Output:
#-------------------------------------------------------------------------
import LogStream
import TextRules
import SampleAnalysis
import time, string, types, copy, re
import CallToActions
import AbsTime
class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
CallToActions.CallToActions):
Definition = {
"type": "smart",
"displayName": None,
# Source database for product. Can be "Official", "Fcst" or "ISC"
"database": "Official",
# Defines output location of finished product.
"outputFile": "{prddir}/TEXT/genHaz.txt",
"debug": 0,
# Name of map background for creating Combinations
# Can be:
# Zones_BOU
# FireWxZones_BOU
# Counties
# Marine_Zones_BOU
"mapNameForCombinations": "Zones_<site>",
## Edit Areas: Create Combinations file with edit area combinations.
## Can be:
## EditAreas_PublicZones_BOU
## EditAreas_FireWx_BOU
## EditAreas_FIPS_BOU
## EditAreas_MarineZones_BOU
"defaultEditAreas" : "EditAreas_PublicZones_<site>_<MultiPil>",
# product identifiers
"productName": "Generic Hazard Product", # product name
"fullStationID": "<fullStationID>", # full station identifier (4letter)
"wmoID": "<wmoID>", # WMO ID
"pil": "<pil>", # Product pil
"areaName": "", # Name of state, such as "Georgia" -- optional
"wfoCityState": "<wfoCityState>", # Location of WFO - city,state
"textdbPil": "<textdbPil>", # Product ID for storing to AWIPS text database.
"awipsWANPil": "<awipsWANPil>", # Product ID for transmitting to AWIPS WAN.
"periodCombining" : 0, # If 1, combine periods, if possible
# automatic functions
"autoSend": 0, #set to 1 to automatically transmit product
"autoSendAddress": "000", #transmission address
"autoStore": 0, #set to 1 to automatically store product in textDB
"autoWrite": 0, #set to 1 to automatically write product to file
# Area Dictionary -- Descriptive information about zones
"areaDictionary": "AreaDictionary",
# Language
"language": "english",
"lineLength": 66, #Maximum line length
"purgeTime": 8, # Maximum hours for expireTime
"includeCities": 1 , # Cities included in area header
"accurateCities": 0, # Include all cities in area header
"cityLocation": "CityLocation", # City lat/lon dictionary to use
"cityDescriptor":"Including the cities of",
"includeZoneNames":1, # Zone names will be included in the area header
"easPhrase" :"", # Optional EAS phrase to be include in product header
"includeOverviewHeadline": 1, #include overview header
"includeOverview": 1, #include overview section
"bulletProd": 0, # do not default to bullets
"hazardSamplingThreshold": (10, None), #(%cov, #points)
"callToAction": 1,
}
def __init__(self):
TextRules.TextRules.__init__(self)
SampleAnalysis.SampleAnalysis.__init__(self)
self.__overviewText = ""
self.__procCTA = None
def generateForecast(self, argDict):
# Generate Text Phrases for a list of edit areas
# Get variables
error = self._getVariables(argDict)
if error is not None:
return error
# Get the segments
hazardsC = argDict['hazards']
segmentList = self.organizeHazards(hazardsC.rawAnalyzedTable())
if len(segmentList) == 0:
return "No hazards to report"
# Determine time ranges
error = self._determineTimeRanges(argDict)
if error is not None:
return error
# Initialize the output string
fcst = ""
fcst = self._preProcessProduct(fcst, argDict)
# Generate the product for each segment in the segmentList
fraction = 0
fractionOne = 1.0/float(len(segmentList))
percent = 50.0
self.setProgressPercentage(50)
for segmentAreas in segmentList:
self.progressMessage(fraction, percent, "Making Product for Segment")
fcst = self._preProcessArea(fcst, segmentAreas, self._expireTime, argDict)
fcst = self._makeProduct(fcst, segmentAreas, argDict)
fcst = self._postProcessArea(fcst, segmentAreas, argDict)
fraction = fractionOne
fcst = self._postProcessProduct(fcst, argDict)
return fcst
def _getVariables(self, argDict):
# Make argDict accessible
self.__argDict = argDict
# Get Definition variables
self._definition = argDict["forecastDef"]
for key in self._definition.keys():
exec "self._" + key + "= self._definition[key]"
# Get VariableList
varDict = argDict["varDict"]
for key in varDict.keys():
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
self._language = argDict["language"]
# Set up information for Hazards product
self._hazards = argDict['hazards']
self._combinations = argDict["combinations"]
return None
def _determineTimeRanges(self, argDict):
# Set up the time range for 0-240 hours
self._timeRange = self.createTimeRange(0, 240)
self._ddhhmmTime = self.getCurrentTime(
argDict, "%d%H%M", shiftToLocal=0, stripLeading=0)
self._issueTime = AbsTime.AbsTime(argDict['creationTime'])
self._currentTime = argDict['creationTime']
self._expireTime = self._issueTime + self._purgeTime*3600
self._timeLabel = self.getCurrentTime(
argDict, "%l%M %p %Z %a %b %e %Y", stripLeading=1)
return None
def _preProcessProduct(self, fcst, argDict):
# Product header
if self._areaName != "":
self._areaName = " for " + self._areaName
issuedByString = self.getIssuedByString()
productName = self.checkTestMode(argDict,
self._productName + self._areaName)
if len(self._easPhrase) != 0:
eas = self._easPhrase + '\n'
else:
eas = ''
s = self._wmoID + " " + self._fullStationID + " " + \
self._ddhhmmTime + "\n" + self._pil + "\n\n"
fcst = fcst + s.upper()
s = eas + productName + "\n" +\
"National Weather Service " + self._wfoCityState + \
"\n" + issuedByString + self._timeLabel + "\n\n"
fcst = fcst + s
fcst = fcst + "Default overview section\n"
return fcst
def _preProcessArea(self, fcst, segmentAreas, expireTime, argDict):
# This is the header for an edit area combination
areaHeader = self.makeAreaHeader(
argDict, "", self._issueTime, expireTime,
self._areaDictionary, None, cityDescriptor=self._cityDescriptor,
areaList=segmentAreas, includeCities=self._includeCities,
includeZoneNames = self._includeZoneNames,
accurateCities = self._accurateCities)
fcst = fcst + areaHeader
return fcst
def _makeProduct(self, fcst, segmentAreas, argDict):
argDict["language"] = self._language
# Generate Narrative Forecast for Edit Area
# get the hazards text
# We only need to get headlines for the first edit area
# in the segment since all areas in the segment have
# the same headlines
editArea = segmentAreas[0]
areaLabel = editArea
headlines = self.generateProduct("Hazards", argDict, area = editArea,
areaLabel=areaLabel,
timeRange = self._timeRange)
fcst = fcst + headlines
return fcst
def _postProcessArea(self, fcst, segmentAreas, argDict):
return fcst + "\n\n$$\n\n"
def _postProcessProduct(self, fcst, argDict):
#
# If an overview exists for this product, insert it
#
overview = self.finalOverviewText()
overviewSearch = re.compile(r'Default overview section', re.DOTALL)
fcst = overviewSearch.sub(overview, fcst)
#
# Added to place line feeds in the CAP tags to keep separate from CTAs
fcst = string.replace(fcst, \
r"PRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.", \
r"\nPRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.\n")
fcst = string.replace(fcst, "\n ","\n")
fcst = string.replace(fcst, "&&", "\n&&\n")
# Prevent empty Call to Action Tags
fcst = re.sub(r'\nPRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.\s*&&\n', \
"", fcst)
fcst = self._indentBulletText(fcst)
#
# Clean up multiple line feeds
#
fixMultiLF = re.compile(r'(\n\n)\n*', re.DOTALL)
fcst = fixMultiLF.sub(r'\1', fcst)
# finish progress meter
self.setProgressPercentage(100)
self.progressMessage(0, 100, self._displayName + " Complete")
return fcst
def allowedHazards(self):
return []
# Added for DR 21194
def _bulletDict(self):
return []
# Added for DR 21309
def _bulletOrder(self):
return []
## Replaced by 21309 code
## def _getBullets(self, newBulletList, argDict):
##
## ### get the bullet dictionary and split the bullets
## bDict = self._bulletDict()
## bLine = bDict.get(eachHazard['phen'])
## print 20* "*" + (eachHazard['phen'])
## bList = newBulletList.split(",")
##
## ### initialize the bullet output
## bullets = ""
##
## ### loop through the bullets and format the output
## for b in bList:
## bullets = bullets + "* " + b + "...|* Enter bullet text *|\n\n"
## # bullets = bullets + "\n"
## return bullets
def _indentBulletText(self, prevText):
print prevText
### if previous text is empty, return nothing
if prevText is None:
return prevText
###
### split the text
###
bullets = []
bullets = string.split(prevText, '\n\n')
if len(bullets) <= 1:
return prevText
###
### process the text
###
outText = ""
for b in bullets:
### if first character is a * we found a bullet
if re.match("\*", b):
### remove line feeds
removeLF = re.compile(r'(s*[^\n])\n([^\n])', re.DOTALL)
bullet = removeLF.sub(r'\1 \2',b)
### indent code
bullet = self.indentText(bullet, indentFirstString = '',
indentNextString = ' ', maxWidth=self._lineLength,
breakStrings=[" ", "..."])
###
### the "-" in the breakStrings line above is causing issues with
### offices that use "-20 degrees" in the text.
###
outText = outText + bullet + "\n\n"
else: ### not a bullet, CTA text
outText = outText + b + "\n\n"
### that's it
print outText
return outText
# The _hazardTimePhrases method is passed a hazard key, and returns
# time phrase wording consistent with that generated by the headline
# algorithms in DiscretePhrases.
#
def hazardTimePhrases(self, hazard, argDict, prefixSpace=True):
timeWords = self.getTimingPhrase(hazard, argDict['creationTime'])
if prefixSpace and len(timeWords):
timeWords = " " + timeWords #add a leading space
return timeWords
#
# The method hazardBodyText creates an attribution phrase
#
def hazardBodyText(self, hazardList, argDict):
bulletProd = self._bulletProd
hazardBodyPhrase = ''
#
# First, sort the hazards for this segment by importance
#
sortedHazardList = []
for each in ['W', 'Y', 'A', 'O', 'S']:
for eachHazard in hazardList:
if eachHazard['sig'] == each:
if eachHazard not in sortedHazardList:
sortedHazardList.append(eachHazard)
#
# Next, break them into individual lists based on action
#
newList = []
canList = []
expList = []
extList = []
conList = []
upgList = []
statementList = []
for eachHazard in sortedHazardList:
if eachHazard['sig'] in ['S']and eachHazard['phen'] in ['CF', 'LS']:
statementList.append(eachHazard)
elif eachHazard['act'] in ['NEW', 'EXA', 'EXB']:
newList.append(eachHazard)
elif eachHazard['act'] in ['CAN']:
canList.append(eachHazard)
elif eachHazard['act'] in ['EXP']:
expList.append(eachHazard)
elif eachHazard['act'] in ['EXT']:
extList.append(eachHazard)
elif eachHazard['act'] in ['UPG']:
upgList.append(eachHazard)
else:
conList.append(eachHazard)
#
# Now, go through each list and build the phrases
#
nwsIntroUsed = 0
#
# This is for the new hazards
#
phraseCount = 0
lastHdln = None
for eachHazard in newList:
hdln = eachHazard['hdln']
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
hazNameA = self.hazardName(eachHazard['hdln'], argDict, True)
hazNameACap = self.sentence(hazNameA, addPeriod=False)
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
if hazName in ["Winter Weather Advisory", "Winter Storm Warning", "Beach Hazards Statement"]:
forPhrase = " for |* Enter hazard type *|"
else:
forPhrase =""
if nwsIntroUsed == 0:
hazardBodyPhrase = "The National Weather Service in " + self._wfoCity
nwsIntroUsed = 1
if phraseCount == 0:
phraseCount = 1
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase = hazardBodyPhrase + " has issued " + \
hazNameA + ". "
else:
hazardBodyPhrase += " has issued " + hazNameA + forPhrase + \
", which is in effect" + endTimePhrase + ". "
elif phraseCount == 1:
phraseCount = 2
if hdln != lastHdln:
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued."
else:
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued. This " + hazName + forPhrase + \
" is in effect" + endTimePhrase + ". "
else:
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + \
" has also been issued."
else:
hazardBodyPhrase = hazardBodyPhrase + hazNameACap + forPhrase + \
" has also been issued" + endTimePhrase + ". "
else:
if eachHazard['phen'] in ['HU', 'TR', 'TY']:
hazardBodyPhrase += "In addition, " + \
hazNameA + " has been issued."
else:
hazardBodyPhrase += "In addition, " + \
hazNameA + forPhrase + " has been issued. This " + hazName + \
" is in effect" + endTimePhrase + ". "
lastHdln = hdln
#
# This is for the can hazards
#
for eachHazard in canList:
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
if nwsIntroUsed == 0:
hazardBodyPhrase = "The National Weather Service in " +\
self._wfoCity
nwsIntroUsed = 1
hazardBodyPhrase = hazardBodyPhrase + \
" has cancelled the " + hazName + ". "
else:
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" has been cancelled. "
#
# This is for the exp hazards
#
phraseCount = 0
for eachHazard in expList:
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
if self._bulletProd:
continue # No attribution for this case if it is a bullet product
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
if eachHazard['endTime'] <= argDict['creationTime']:
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is no longer in effect. "
else:
expTimeCurrent = argDict['creationTime']
timeWords = self.getTimingPhrase(eachHazard, expTimeCurrent)
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" will expire " + timeWords + ". "
#
# This is for ext hazards
#
for eachHazard in extList:
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
if self._bulletProd:
continue # No attribution for this case if it is a bullet product
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is now in effect" + endTimePhrase + ". "
#
# This is for upgrade hazards
#
for eachHazard in upgList:
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
hazName = self.hazardName(eachHazard['hdln'], argDict, False)
hazardBodyPhrase = hazardBodyPhrase + "The " + hazName + \
" is no longer in effect. "
#
# This is for con hazards
#
for eachHazard in conList:
if len(eachHazard['hdln']) == 0:
continue #no defined headline, skip phrase
if self._bulletProd:
continue # No attribution for this case if it is a bullet product
endTimePhrase = self.hazardTimePhrases(eachHazard, argDict)
hazNameA = self.hazardName(eachHazard['hdln'], argDict, True)
hazardBodyPhrase = hazardBodyPhrase + hazNameA + \
" remains in effect" + endTimePhrase + ". "
#
# This is for statement hazards
#
for eachHazard in statementList:
hazardBodyPhrase = "...|* Add statement headline *|...\n\n"
#
# This adds segment text
#
segmentText = ''
#
# Check that this segment codes to determine capture or not,
# and frame captured text or not
#
incTextFlag, incFramingCodes, skipCTAs, forceCTAList = \
self.useCaptureText(sortedHazardList)
#
#
# Check that the previous text exists
#
foundCTAs = []
for eachHazard in sortedHazardList:
if eachHazard.has_key('prevText'):
prevText = eachHazard['prevText']
if eachHazard['pil'] == 'MWS':
startPara = 0
else:
startPara = 1
segmentText, foundCTAs = self.cleanCapturedText(prevText,
startPara, addFramingCodes = False,
skipCTAs = skipCTAs)
tester = segmentText[0]
if tester == '*':
startPara = 1
else:
startPara = 2
segmentText, foundCTAs = self.cleanCapturedText(prevText,
startPara, addFramingCodes = False,
skipCTAs = skipCTAs)
#
# Check that the segment text isn't very short or blank
#
if len(segmentText) < 6:
incTextFlag = 0
# DR 21309 code addition from Middendorf (BYZ)
#
# Now if there is a new hazard and previous segment Text, then
# we may have to add bullets.
#
if incTextFlag and bulletProd:
for eachHazard in sortedHazardList:
if not eachHazard.has_key('prevText'):
newBullets = string.split(self._bulletDict().get(eachHazard['phen']),",")
print "newBullets = ", newBullets
print "segment text is: ", segmentText
for bullet in newBullets:
if re.search("\* " + bullet + "\.\.\.", segmentText, flags=re.IGNORECASE) is None:
print bullet + " not in segmentText"
start = self._bulletOrder().index(bullet) + 1
end = len(self._bulletOrder())
bulletFlag = 1
for i in range(start,end):
if (re.search("\* " + self._bulletOrder()[i] + "\.\.\.", segmentText, flags=re.IGNORECASE) is not None) and bulletFlag:
print "* " + self._bulletOrder()[i] + "... found!"
segmentTextSplit = re.split("\* " + self._bulletOrder()[i] + "\.\.\.", segmentText, flags=re.IGNORECASE)
segmentText = string.join(segmentTextSplit,"* " + bullet.upper() + \
"...|* Enter bullet text *|\n\n* " + self._bulletOrder()[i] + "...")
bulletFlag = 0
if bulletFlag:
print "appending to bottom list of bullets!"
segmentTextSplit = re.split("PRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.", segmentText, flags=re.IGNORECASE)
segmentText = "\n" + string.join(segmentTextSplit,"* " + bullet.upper() + \
"...|* Enter bullet text *|\n\nPRECAUTIONARY/PREPAREDNESS ACTIONS...")
bulletFlag = 0
#
# Now if there is a can/exp hazard and previous segment Text, then
# we may have to remove bullets.
#
if incTextFlag and bulletProd:
# First make list of bullets that we need to keep.
keepBulletList = []
for eachHazard in sortedHazardList:
if eachHazard['act'] not in ["CAN","EXP"]:
saveBullets = string.split(self._bulletDict().get(eachHazard['phen']),",")
for saveBullet in saveBullets:
if saveBullet not in keepBulletList:
keepBulletList.append(saveBullet)
# Now determine which bullets we have to remove.
removeBulletList = []
for eachHazard in sortedHazardList:
if eachHazard['act'] in ["CAN","EXP"]:
canBullets = string.split(self._bulletDict().get(eachHazard['phen']),",")
for canBullet in canBullets:
if canBullet not in keepBulletList and canBullet not in removeBulletList:
removeBulletList.append(canBullet)
print "hazardBodyText info: keepBulletList: ",keepBulletList
print "hazardBodyText info: removeBulletList: ",removeBulletList
# Finally remove the bullets no longer needed.
for bullet in removeBulletList:
if re.search("\* "+ bullet + "\.\.\.", segmentText, flags=re.IGNORECASE) is not None:
segmentTextSplit = re.split("\* " + bullet + "\.\.\.", segmentText, flags=re.IGNORECASE)
print "segmentTextSplit is ", segmentTextSplit
segmentTextSplit2 = string.split(segmentTextSplit[1],"*",1)
if len(segmentTextSplit2) == 2:
segmentTextSplit[1] = "*" + segmentTextSplit2[1]
else:
segmentTextSplit2 = re.split("PRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.", segmentTextSplit[1], 1, flags=re.IGNORECASE)
if len(segmentTextSplit2) == 2:
segmentTextSplit[1] = "PRECAUTIONARY/PREPAREDNESS ACTIONS..." + segmentTextSplit2[1]
segmentText = string.join(segmentTextSplit,"")
if removeBulletList != []:
segmentText = "|*\n" + segmentText + "*|"
else:
segmentText = segmentText
#
# If segment passes the above checks, add the text
#
print "hazardBodyText info: incTextFlag: ",incTextFlag
if incTextFlag:
print "hazardBodyText info: segmentText: ",segmentText
hazardBodyPhrase = hazardBodyPhrase + "\n\n" + \
segmentText + '\n\n'
elif bulletProd:
bulletFlag = 0
if eachHazard['act'] == 'CAN':
hazardBodyPhrase = hazardBodyPhrase + \
"\n\n|* Wrap-up text goes here *|.\n"
elif eachHazard['act'] == 'EXP':
hazardBodyPhrase = hazardBodyPhrase + \
"\n\n|* Wrap-up text goes here *|.\n"
else:
bulletFlag = 1
## print "bulletFlag is: ",bulletFlag
if bulletFlag:
newBulletList = []
bullets = ""
for eachHazard in sortedHazardList:
### get the default bullets for all hazards from the bullet diction
newBullets = string.split(self._bulletDict().get(eachHazard['phen']),",")
for newBullet in newBullets:
if newBullet not in newBulletList:
newBulletList.append(newBullet)
print "my bullets are: ", newBulletList
### Determine the correct order for all bullets
bulletOrder = self._bulletOrder()
staticBulletOrder = self._bulletOrder()
for bullet in staticBulletOrder:
print "correct bullet order should be: ", bulletOrder
if bullet not in newBulletList:
bulletOrder.remove(bullet)
print "reordered bullets are: ", bulletOrder
for b in bulletOrder:
bullets = bullets + "* " + b.upper() + "...|* Enter bullet text *|\n\n"
hazardBodyPhrase = hazardBodyPhrase + "\n\n" + bullets
# If segment doesn't pass the checks, put in framing codes
else:
hazardBodyPhrase = hazardBodyPhrase + \
"\n\n|* Statement text goes here *|.\n\n"
# End code for DR 21310
#
# This adds the call to action statements. This is only performed
# if the segment is 'NEW' or if the previous text has been discarded
# due to a CAN/EXP/UPG segment
#
# remove items from forceCTAList if they exist in foundCTAs. Note
# that the formats of these lists are different, thus this code
# is more complicated
for ent in foundCTAs:
#only process CTAs that are vtec phen/sig based
if ent.find('.') == 2:
phensig = (ent[0:2], ent[3]) #phen.sig
if phensig in forceCTAList:
del forceCTAList[forceCTAList.index(phensig)]
hazardBodyPhrase = hazardBodyPhrase + '\n\n'
ctas = []
for (phen,sig) in forceCTAList:
hazardPhenSig = phen + "." + sig
cta = self.defaultCTA(hazardPhenSig)
if cta not in ctas:
ctas.append(cta)
if len(ctas) > 0:
hazardBodyPhrase = hazardBodyPhrase + \
'PRECAUTIONARY/PREPAREDNESS ACTIONS...\n\n'
for c in ctas:
hazardBodyPhrase = hazardBodyPhrase + c + '\n\n'
hazardBodyPhrase = hazardBodyPhrase + '&&\n\n'
# Make sure there is only one CAP tag pairs
hazardBodyPhrase = re.sub(r'&&\s*PRECAUTIONARY/PREPAREDNESS ACTIONS\.\.\.\n', \
"", hazardBodyPhrase)
return hazardBodyPhrase
def finalOverviewText(self):
#if didn't calculate any, use the default
if len(self.__overviewText) == 0:
if self._includeOverviewHeadline:
overviewHeadline = "...|*Overview headline (must edit)*|...\n\n"
else:
overviewHeadline = ""
if self._includeOverview:
overviewBody = ".|*Overview (must edit)*|.\n\n"
else:
overviewBody = ""
#assemble the lines
overview = overviewHeadline + overviewBody
return overview
else:
return self.__overviewText
def overviewText(self, hazardList, pil):
#
# This method finds an overview in the previous product
#
overview = ""
for each in hazardList:
if (each.has_key('prevOverviewText') and
each.has_key('pil') and
each.has_key('endTime') and
each.has_key('act')):
if (each['pil'] == pil and
each['endTime'] > self._currentTime and
each['act'] not in ['CAN', 'EXP']):
overview = each['prevOverviewText']
self.__overviewText, dummy = self.cleanCapturedText(
overview, 0)
break
def useCaptureText(self, hazardList):
#Based on the hazardlist, returns a tuple indicating:
# (inc capture text, inc framing codes, skip CTAs, forceCTAList)
#
# For the values to be considered, the 'hdln' value must be
# present in the list, or it needs to be a Statement (sig="S")
cans = ['CAN','UPG','EXP']
acts = ['NEW','EXT','EXA','EXB','CON']
foundACTS = 0
foundCANS = 0
foundSig = []
for eh in hazardList:
if eh['act'] in acts and (len(eh['hdln']) or eh['sig'] == 'S'):
foundACTS = 1
if eh['act'] in cans and (len(eh['hdln']) or eh['sig'] == 'S'):
foundCANS = 1
if eh['sig'] not in foundSig:
foundSig.append(eh['sig'])
includeFrameCodes = 0
includeText = 1
skipCTAs = 0
forceCTAList = []
# all actions are in CAN, UPG, EXP only (don't include text)
if foundCANS and not foundACTS:
if 'S' in foundSig and len(foundSig) == 1: #only S
includeFrameCodes = 1 #capture text, but frame it
else:
includeText = 0 #end of non statement
# something in CANS and something in acts (frame it, include text)
elif foundCANS and foundACTS:
includeFrameCodes = 1
skipCTAs = 1
for eh in hazardList:
if eh['act'] in acts and \
(eh['phen'], eh['sig']) not in forceCTAList and \
len(eh['hdln']):
forceCTAList.append((eh['phen'], eh['sig']))
#everything in active entries, captured text is used, but still
# need to handle the "NEW" entries.
else:
for eh in hazardList:
if eh['act'] in ['NEW'] and len(eh['hdln']):
forceCTAList.append((eh['phen'], eh['sig']))
return (includeText, includeFrameCodes, skipCTAs, forceCTAList)
def cleanCapturedText(self, text, paragraphs, addFramingCodes = False,
skipCTAs = False):
#
# This method takes a block of text, wraps it preserving blank lines,
# then returns the part after 'paragraphs'. So, if paragraphs is 0, it
# returns the whole thing, if it's 2, it returns paragraphs 2 -> end, etc.
# Headlines are always removed.
# Framing codes are added if specified.
#
paras = self.convertSingleParas(text) #single paragraphs
# keep track of any call to actions found
foundCTAs = []
# Process the paragraphs, keep only the interested ones
paraCount = 0
processedText = ''
for eachPara in paras:
if paraCount >= paragraphs:
found = self.ctasFound(eachPara) #get list of ctas found
if skipCTAs and len(found):
pass
else:
processedText = processedText + eachPara + '\n\n'
#keep track of remaining CTAs in processed text
for f in found:
if f not in foundCTAs:
foundCTAs.append(f)
if eachPara.find('...') == 0:
pass #ignore headlines
paraCount = paraCount + 1
# Add framing codes
if addFramingCodes:
processedText = processedText.rstrip()
processedText = "|*\n" + processedText + "*|\n"
# Wrap
processedText = self.endline(processedText,
linelength=self._lineLength, breakStr=[" ", "-", "..."])
return processedText, foundCTAs
def decodeBulletedText(self, prevText):
# returns the bullet paragraph text or None, returns the
# regular text after the bullets. The afterText is text up to
# the next bullet or up to "The National Weather Service". Note
# that this only correctly handles the 1st set of entries in
# a segment, thus double events will only decode the first set
# of bullets and text. The multipleRecords is set to 1 in the
# event that there are multiple sets of bullets. In this case
# only the 1st set was captured/decoded.
# (hazard, time, basis, impact, afterText, multipleRecords)
if prevText is None:
return (None, None, None, None, None, None)
# find the bullets
bullets = []
buf = prevText.split('\n\n* ')
if len(buf) <= 1:
return (None, None, None, None, None, None)
multRecords = 0 #indicator of multiple sets of bullets
for x in xrange(len(buf)):
if x == 0:
continue #headlines and text before the bullets
bullets.append(buf[x])
# find only the bulleted text, defined by the double line feed term.
# of the text
regText = "" #regular text after bullets
for x in xrange(1, len(bullets)):
index = bullets[x].find('\n\n')
if index != -1:
regText = bullets[x][index+2:]
bullets[x] = bullets[x][0:index] #eliminate after bullet text
if len(bullets) > x+2: #more bullets are present
multRecords = 1
bullets = bullets[0:x+1] #only interested in these bullets
break
# regular text is the remainder of the text. However we only
# want text from the last in the series of bullets to the
# beginning of any next NWS phrase.
lines = regText.split('\n')
for x in xrange(len(lines)):
if lines[x].find('The National Weather Service') == 0:
lines = lines[0:x] #eliminate following lines
break
regText = ("\n").join(lines)
# now clean up the text
for x in xrange(len(bullets)):
bullets[x] = string.replace(bullets[x],'\n',' ')
removeLF = re.compile(r'(s*[^\n])\n([^\n])', re.DOTALL)
regText = removeLF.sub(r'\1 \2',regText)
# extract out each section for returning the values
if len(bullets) >= 1:
hazard = bullets[0]
else:
hazard = None
if len(bullets) >= 2:
time = bullets[1]
else:
time = None
if len(bullets) >= 3:
basis = bullets[2]
else:
basis = None
if len(bullets) >= 4:
impact = bullets[3]
else:
impact = None
if len(regText) == 0:
regText = None #no regular text after bullets
return (hazard, time, basis, impact, regText, multRecords)
def substituteBulletedText(self, capText, defaultText, frameit="Never"):
#returns a properly formatted bulleted text based on
#the capText variable. If capText is None or 0 length, then
#the default text is used. frameit can be "Never", in which
#nothing is wrapped in framing codes, "Always" in which the
#text (default or cap) is wrapped in framing codes, or
#DefaultOnly" in which just the default text is wrapped.
if capText is not None and len(capText):
textToUse = capText[0].upper()+capText[1:]
if frameit == "Always":
textToUse = "|* " + textToUse + " *|"
else:
textToUse = defaultText
if frameit == "Always" or frameit == "DefaultOnly":
textToUse = "|* " + textToUse + " *|"
# add bullet codes
textToUse = "* " + textToUse
# format it
return self.indentText(textToUse, indentFirstString = '',
indentNextString = ' ', maxWidth=self._lineLength,
breakStrings=[" ", "-", "..."])
def convertSingleParas(self, text):
#returns a list of paragraphs based on the input text.
lf = re.compile(r'(s*[^\n])\n([^\n])', re.DOTALL)
ptext = lf.sub(r'\1 \2', text)
ptext = ptext.replace('\n\n', '\n')
paragraphs = ptext.split('\n')
return paragraphs
def ctasFound(self, text):
#returns types of ctas found. The identifier is the pil (e.g., ZFP),
#phen/sig (e.g., DU.Y), or GENERIC. Uses the CallToAction definitions.
#convert text to single paragraphs
paragraphs = self.convertSingleParas(text)
for x in xrange(len(paragraphs)):
paragraphs[x] = string.replace(paragraphs[x],' ','')
#make list of call to actions (type, cta text)
if self.__procCTA is None:
self.__procCTA = []
ctao = CallToActions.CallToActions()
d = ctao.ctaDict()
for k in d.keys():
func = d[k]
items = func()
for it in items:
if type(it) == types.TupleType:
it = it[1] #get second string which is the CTA
ctaParas = self.convertSingleParas(it)
for cta in ctaParas:
self.__procCTA.append((k,string.replace(cta,' ','')))
d = ctao.ctaPilDict()
for k in d.keys():
func = d[k]
items = func()
for it in items:
if type(it) == types.TupleType:
it = it[1] #get second string which is the CTA
ctaParas = self.convertSingleParas(it)
for cta in ctaParas:
self.__procCTA.append((k,string.replace(cta,' ','')))
ctas = ctao.genericCTAs()
for it in ctas:
if type(it) == types.TupleType:
it = it[1] #get second string which is the CTA
ctaParas = self.convertSingleParas(it)
for cta in ctaParas:
self.__procCTA.append(("GENERIC",
string.replace(cta,' ','')))
#compare
found = []
for para in paragraphs:
for (ctaType, cta) in self.__procCTA:
## Added following line to account for framing code issues in CTA
cta = re.sub("\|\*.*\*\|","",cta)
# We want this comparison to be case-insensitive just in case
# the site is not transmitting in mixed case yet.
if para.upper() == cta.upper() and ctaType not in found:
found.append(ctaType)
return found
| 41.29769 | 151 | 0.53106 | 2 | 1.9146 | [
-0.04581914469599724,
0.018587805330753326,
0.00448860228061676,
-0.02359127439558506,
-0.004670436959713697,
0.007483324967324734,
-0.025257105007767677,
0.03357730433344841,
0.005362645257264376,
0.056354086846113205,
-0.01379616279155016,
0.005030646454542875,
-0.03261975571513176,
-0.014919235371053219,
0.009632591158151627,
-0.03959061950445175,
0.22931833565235138,
-0.03885045647621155,
0.0024335295893251896,
-0.031008053570985794,
-0.004337459336966276,
-0.008214492350816727,
-0.03909984976053238,
-0.0022267645690590143,
-0.0009489658987149596,
-0.00011739331966964528,
0.019417885690927505,
0.011624906212091446,
-0.006789734587073326,
-0.00018992841069120914,
-0.0449979193508625,
0.03337652608752251,
-0.03210509940981865,
0.04408219829201698,
-0.0020176703110337257,
0.01856672205030918,
-0.018532192334532738,
0.020358150824904442,
-0.009167375974357128,
0.004200061317533255,
0.004288282711058855,
0.01944546215236187,
-0.014469715766608715,
-0.018291551619768143,
0.022270971909165382,
0.040554631501436234,
0.0009579492034390569,
0.03087736666202545,
-0.031084127724170685,
0.035421404987573624,
-0.016350949183106422,
0.018941324204206467,
-0.043548617511987686,
-0.012659059837460518,
-0.010358435101807117,
-0.03189963102340698,
0.004273506347090006,
-0.010898604057729244,
-0.009555453434586525,
-0.03711070120334625,
-0.0189826563000679,
0.006873647216707468,
0.0015296692727133632,
-0.010496183298528194,
-0.005908994469791651,
0.039962124079465866,
-0.0012474601389840245,
0.009345635771751404,
0.024427084252238274,
0.006016426719725132,
-0.0016923095099627972,
-0.021470168605446815,
-0.007643235847353935,
0.041681718081235886,
0.020529890432953835,
0.011129423044621944,
-0.015728875994682312,
-0.03310249745845795,
-0.004619183484464884,
0.02549733966588974,
-0.0529390312731266,
0.009032094851136208,
0.014682473614811897,
-0.001551740220747888,
0.022214433178305626,
-0.002254878170788288,
0.03691118210554123,
-0.06101009622216225,
0.03294837102293968,
0.03023654967546463,
-0.0014742010971531272,
0.01595143787562847,
-0.007059202529489994,
-0.013540126383304596,
-0.01836826652288437,
-0.021554838865995407,
0.010452820919454098,
0.025428498163819313,
0.011696064844727516,
0.008182499557733536,
0.0015201930655166507,
-0.0037058864254504442,
0.01906672865152359,
0.03976328298449516,
0.022013677284121513,
-0.04277806356549263,
-0.016206977888941765,
0.014065691269934177,
0.034949712455272675,
-0.008979381993412971,
-0.04596860706806183,
0.005257769953459501,
-0.005634256638586521,
-0.027062200009822845,
-0.012377284467220306,
-0.029129931703209877,
0.010603771544992924,
0.004206529818475246,
0.02491992898285389,
0.054384343326091766,
-0.015864374116063118,
-0.0428081750869751,
0.03302627429366112,
0.012474944815039635,
-0.03044130653142929,
0.02047240547835827,
-0.03314637020230293,
-0.010533477179706097,
0.028134949505329132,
-0.0000815365492599085,
0.03536218777298927,
-0.014378871768712997,
-0.005801944062113762,
-0.02678830735385418,
0.01042268704622984,
0.009597137570381165,
0.006303353700786829,
-0.003726987401023507,
-0.051749106496572495,
0.040454745292663574,
-0.008591840043663979,
0.010364591144025326,
-0.020352309569716454,
0.041574470698833466,
0.039024896919727325,
-0.013231516815721989,
0.02157459780573845,
0.013293185271322727,
-0.037673890590667725,
-0.010361218824982643,
0.014867027290165424,
0.027651065960526466,
-0.02811819314956665,
0.009290510788559914,
0.004664605017751455,
-0.016908690333366394,
-0.0035562124103307724,
-0.015080153942108154,
0.015381031669676304,
-0.009670366533100605,
-0.0423644557595253,
0.03419842943549156,
-0.0006906163762323558,
0.004932129289954901,
0.012631182558834553,
0.00537891173735261,
-0.007043411955237389,
-0.003873290726915002,
-0.004455680027604103,
-0.02859976328909397,
-0.011848283931612968,
0.015309853479266167,
-0.0057921502739191055,
-0.004025312606245279,
-0.017540525645017624,
0.003326037432998419,
0.03538324311375618,
0.009309768676757812,
-0.006310084834694862,
-0.029782544821500778,
0.024700338020920753,
0.02797074057161808,
-0.009499241597950459,
0.01064253505319357,
0.00334904994815588,
0.032010436058044434,
-0.019782552495598793,
-0.024530285969376564,
0.030643895268440247,
0.004971013404428959,
0.003756763646379113,
0.001971851335838437,
0.02889380231499672,
-0.0334046445786953,
-0.0021925836335867643,
-0.028164461255073547,
0.027524201199412346,
0.0019207055447623134,
0.0038834186270833015,
0.01474942360073328,
-0.028048481792211533,
-0.017859432846307755,
-0.004280649591237307,
0.07679431140422821,
-0.006106005981564522,
-0.0380510576069355,
-0.6794057488441467,
-0.012121595442295074,
-0.004986100364476442,
-0.00831032358109951,
-0.03936018794775009,
0.005638804752379656,
-0.025875989347696304,
0.015234286896884441,
-0.014515835791826248,
0.014210124500095844,
-0.019339408725500107,
0.0018832107307389379,
0.018456371501088142,
0.007628847844898701,
0.004523996729403734,
-0.014808958396315575,
-0.002910596551373601,
0.010896027088165283,
-0.037522364407777786,
-0.026595544070005417,
-0.015261022374033928,
-0.017212722450494766,
0.0027669889386743307,
0.02551008015871048,
0.008744501508772373,
0.0003390215861145407,
0.041198935359716415,
0.03883912041783333,
-0.0018108143704012036,
0.03606744483113289,
-0.03378945589065552,
0.0010085394605994225,
-0.022457968443632126,
-0.022718900814652443,
-0.0028261602856218815,
-0.0043241227976977825,
0.037097472697496414,
-0.01350292656570673,
-0.031024668365716934,
-0.0024737752974033356,
-0.0017980476841330528,
-0.03019922412931919,
-0.015574910677969456,
-0.032578244805336,
-0.027966249734163284,
-0.02325497753918171,
-0.01402376126497984,
-0.08096015453338623,
0.01305967103689909,
0.019455455243587494,
-0.022302404046058655,
0.007365403696894646,
0.002584882779046893,
-0.012887869961559772,
0.030232485383749008,
0.017914965748786926,
0.007887407205998898,
-0.0014893333427608013,
0.008119689300656319,
0.013918626122176647,
-0.04717420041561127,
0.011715633794665337,
-0.028454504907131195,
0.01747780106961727,
-0.01148778386414051,
0.00534965330734849,
-0.03526321053504944,
0.01031504850834608,
0.0337100550532341,
-0.006810066290199757,
-0.030248768627643585,
-0.026725810021162033,
-0.043259091675281525,
0.07823777198791504,
0.033400002866983414,
0.056350160390138626,
-0.0241356510668993,
0.0016612042672932148,
-0.006247976794838905,
-0.06064502149820328,
0.006261556874960661,
0.06620454043149948,
-0.004816885571926832,
0.022825337946414948,
-0.012116837315261364,
0.01969909481704235,
0.001626541605219245,
-0.023366637527942657,
-0.013273991644382477,
0.019865991547703743,
0.0006183673394843936,
0.05263222008943558,
-0.017086679115891457,
-0.026489440351724625,
-0.009666458703577518,
0.034777574241161346,
-0.02618606574833393,
-0.0332605317234993,
0.0031196398194879293,
0.02767777256667614,
-0.04584646224975586,
0.004105836618691683,
0.011542710475623608,
0.07291924208402634,
-0.014600655995309353,
0.023953039199113846,
-0.04646418243646622,
-0.006181090604513884,
-0.00030260757193900645,
0.011875038035213947,
0.04274795949459076,
0.03872555121779442,
-0.005833691917359829,
0.03298958018422127,
-0.021921662613749504,
0.008026689291000366,
-0.01566290110349655,
-0.052996888756752014,
0.054764363914728165,
0.007356348447501659,
-0.028589481487870216,
0.010697470977902412,
-0.0024538312572985888,
-0.000633968214970082,
0.02886810339987278,
-0.011318305507302284,
-0.009700655937194824,
0.01787552982568741,
-0.01697009988129139,
-0.0029571091290563345,
0.03242505341768265,
0.0054440670646727085,
-0.02859451435506344,
0.008064200170338154,
0.013921039178967476,
0.006369634531438351,
-0.014186474494636059,
0.010519192554056644,
0.03991810977458954,
-0.02974042482674122,
-0.019889824092388153,
-0.03767486289143562,
0.004412143491208553,
-0.05155326798558235,
-0.03932444751262665,
-0.023293308913707733,
0.07900015264749527,
-0.0018582068150863051,
-0.012520691379904747,
0.0202364269644022,
0.012210783548653126,
0.06891348212957382,
0.007193350698798895,
-0.015383375808596611,
-0.006944272201508284,
0.02855605073273182,
-0.029172388836741447,
0.06370405107736588,
0.008775237947702408,
-0.015991074964404106,
-0.01033600140362978,
-0.04289618879556656,
-0.047632429748773575,
0.006946922279894352,
-0.020659686997532845,
-0.04121964052319527,
-0.04089704155921936,
-0.012356087565422058,
0.01686066947877407,
-0.00941646657884121,
0.01846960373222828,
-0.005469647701829672,
0.003888743696734309,
0.0011776190949603915,
0.03287219628691673,
0.05149494484066963,
-0.016997190192341805,
-0.0545414537191391,
-0.009160215966403484,
0.01918068714439869,
0.004570567514747381,
0.007935075089335442,
-0.009086810052394867,
0.005358957685530186,
0.015152892097830772,
0.028276808559894562,
-0.03760199993848801,
0.020800450816750526,
-0.01862276904284954,
-0.041444938629865646,
0.0028144260868430138,
0.016035541892051697,
-0.027823204174637794,
-0.045124784111976624,
-0.0369449220597744,
0.017806444317102432,
-0.03660484775900841,
0.004440542310476303,
0.022993678227066994,
-0.010739440098404884,
-0.011913195252418518,
-0.0005195444682613015,
0.022285927087068558,
-0.022335771471261978,
0.019853834062814713,
0.015797937288880348,
-0.004899713210761547,
0.004163785371929407,
-0.003693230450153351,
0.01625436171889305,
0.027528846636414528,
0.0004133912443649024,
-0.01063848752528429,
-0.031783219426870346,
0.022554805502295494,
0.04336335510015488,
-0.016349947080016136,
0.03984617441892624,
0.0006117232260294259,
0.0016164344269782305,
-0.000766945187933743,
-0.025939112529158592,
0.02979995496571064,
0.013890854083001614,
0.01712651737034321,
0.016718685626983643,
-0.008027113042771816,
-0.028499417006969452,
-0.028959006071090698,
0.011472593061625957,
0.022196035832166672,
-0.007599738892167807,
0.005305283237248659,
-0.007832888513803482,
0.0128199877217412,
-0.0021078744903206825,
0.013067888095974922,
-0.03773832321166992,
0.012957899831235409,
-0.020472049713134766,
0.03768334910273552,
-0.016755368560552597,
-0.01763675920665264,
0.02002107724547386,
0.011335472576320171,
-0.018667932599782944,
0.006101903505623341,
-0.020420528948307037,
-0.019381828606128693,
0.007947295904159546,
-0.011281413026154041,
-0.02326616458594799,
-0.0022352165542542934,
-0.015645472332835197,
-0.011806484311819077,
0.013322466053068638,
-0.03915528208017349,
-0.01056879386305809,
0.03777443245053291,
-0.04572982341051102,
-0.029856381937861443,
-0.02467416413128376,
-0.006902126129716635,
-0.011525354348123074,
0.0379764586687088,
-0.012113984674215317,
-0.05899827182292938,
0.04011179506778717,
0.009603781625628471,
0.010619508102536201,
0.02435236983001232,
0.011553017422556877,
0.003035160945728421,
-0.013375263661146164,
0.012244435027241707,
-0.004582408349961042,
0.009849765338003635,
-0.027983644977211952,
0.007048735860735178,
0.05171709507703781,
-0.018496941775083542,
-0.004675133619457483,
-0.01481938548386097,
0.02396543323993683,
0.004607805982232094,
-0.006224776618182659,
0.02544041909277439,
0.0048209368251264095,
-0.029330329969525337,
0.008400124497711658,
0.04614005237817764,
-0.02714408002793789,
0.007661779876798391,
-0.018780436366796494,
0.014057465828955173,
0.012931019999086857,
-0.022615207359194756,
-0.0013960694195702672,
0.027310408651828766,
-0.036905936896800995,
0.029797594994306564,
-0.017534516751766205,
-0.019231928512454033,
0.060487013310194016,
-0.01861155591905117,
0.0038129743188619614,
0.026704762130975723,
0.006413009017705917,
0.02887791208922863,
-0.013365458697080612,
0.04290875792503357,
0.01341000385582447,
-0.033641040325164795,
-0.011930297128856182,
0.014612982049584389,
-0.0033954966347664595,
0.020059719681739807,
0.05646159499883652,
-0.0009937926661223173,
-0.03323392570018768,
-0.013202584348618984,
0.0036375175695866346,
-0.0031558836344629526,
0.010031047277152538,
0.007975969463586807,
-0.0046782949939370155,
-0.05197300761938095,
-0.0021758878137916327,
-0.0016867842059582472,
-0.0069158682599663734,
0.01776372827589512,
-0.036209285259246826,
-0.05692094936966896,
0.02225116640329361,
0.010922562330961227,
0.014037351123988628,
0.028471026569604874,
-0.026277169585227966,
-0.012971415184438229,
0.0022810129448771477,
0.009153653867542744,
0.020209522917866707,
0.024085141718387604,
0.026167066767811775,
-0.02013610303401947,
-0.02401956543326378,
0.0048200576566159725,
0.05279591307044029,
0.005393914878368378,
0.02060750499367714,
0.013618984259665012,
0.02048814296722412,
-0.02835250087082386,
0.029492409899830818,
0.010317886248230934,
-0.0020353884901851416,
0.001410137745551765,
0.008048648945987225,
-0.03139090538024902,
0.008684641681611538,
-0.028229938820004463,
0.0134236766025424,
-0.0258950162678957,
-0.014809833839535713,
-0.018985511735081673,
-0.043865106999874115,
-0.012406495399773121,
-0.041619256138801575,
-0.027345510199666023,
0.01394588127732277,
0.0019936703611165285,
0.009221801534295082,
-0.0057841273956000805,
0.025778917595744133,
0.029309673234820366,
0.007505576126277447,
0.0038996776565909386,
0.02195480279624462,
0.019969966262578964,
-0.04576706886291504,
-0.02291649580001831,
0.0017509108874946833,
0.006129622459411621,
0.0035989300813525915,
0.049532510340213776,
-0.04517276957631111,
-0.02391946315765381,
0.005022095981985331,
-0.040652643889188766,
-0.025274571031332016,
0.007567157968878746,
0.010069191455841064,
0.022390441969037056,
0.012744106352329254,
-0.013104524463415146,
0.03222852945327759,
-0.0196996983140707,
-0.04013112559914589,
-0.016253476962447166,
-0.006536242086440325,
-0.0012747130822390318,
0.01636381819844246,
0.0056596738286316395,
-0.05357017740607262,
-0.010114651173353195,
0.015459936112165451,
0.029231393709778786,
-0.019257888197898865,
0.032589707523584366,
-0.0007257488905452192,
0.039219167083501816,
0.035469621419906616,
0.009591971524059772,
-0.0497078038752079,
0.01258105132728815,
0.008578486740589142,
-0.02464207261800766,
-0.006030275486409664,
0.012788703665137291,
-0.001441115397028625,
-0.035659030079841614,
-0.013034561648964882,
-0.008124463260173798,
0.001609263475984335,
-0.020379725843667984,
-0.017048636451363564,
-0.017257273197174072,
0.029896685853600502,
-0.008058588951826096,
0.05114921182394028,
0.029985474422574043,
-0.040206678211688995,
0.009293816052377224,
0.011866079643368721,
-0.0015641546342521906,
-0.02327960729598999,
0.010080323554575443,
-0.007728606462478638,
-0.008086725138127804,
-0.01763494499027729,
-0.023245804011821747,
-0.0034487484954297543,
-0.009409327059984207,
-0.01393807865679264,
0.03934963047504425,
-0.08754551410675049,
-0.017132239416241646,
0.03163768723607063,
0.014087443239986897,
-0.014396389946341515,
-0.01893693208694458,
-0.014648392796516418,
0.05708324536681175,
0.03656042367219925,
0.004559807479381561,
-0.0195170808583498,
0.04096340760588646,
0.0012273620814085007,
0.025099098682403564,
-0.005922268610447645,
0.0012564928038045764,
-0.06378384679555893,
-0.0011549820192158222,
-0.020747734233736992,
0.005928754340857267,
0.01506059616804123,
0.010706269182264805,
-0.002517109038308263,
0.011166448704898357,
0.0006140688201412559,
-0.02206175960600376,
-0.006335986312478781,
-0.010891953483223915,
0.04761841893196106,
0.022073060274124146,
0.004651761148124933,
0.009231792762875557,
0.041075024753808975,
0.03890982270240784,
-0.009322586469352245,
-0.06661783158779144,
0.003986288793385029,
0.004869768861681223,
0.020019888877868652,
0.04391904175281525,
0.009705111384391785,
0.020110152661800385,
0.020120155066251755,
-0.022636806592345238,
-0.003130037570372224,
-0.026684723794460297,
-0.023830555379390717,
-0.04256020858883858,
0.04749102517962456,
0.008794181980192661,
0.02940714918076992,
0.009917779825627804,
-0.006961769890040159,
0.004987197462469339,
-0.005378819070756435,
0.0011099876137450337,
-0.01684325374662876,
0.034164875745773315,
0.003384661627933383,
0.030605165287852287,
0.036821089684963226,
0.04167206212878227,
0.04537065327167511,
-0.007729923818260431,
-0.043168798089027405,
-0.02587587758898735,
0.020556384697556496,
0.011620143428444862,
-0.01407028827816248,
-0.015514451079070568,
0.026083942502737045,
0.027173615992069244,
0.00630384823307395,
-0.022317171096801758,
-0.021549168974161148,
0.01625782996416092,
0.022166239097714424,
0.005579584743827581,
-0.01505511999130249,
-0.011372034437954426,
-0.028234029188752174,
0.025393744930624962,
-0.009293605573475361,
0.0005377421621233225,
0.015241160988807678,
-0.0027205897495150566,
-0.003015595255419612,
-0.01807241700589657,
-0.022337742149829865,
-0.007341937627643347,
-0.049705397337675095,
0.01868307776749134,
0.03408415988087654,
-0.0131657300516963,
0.006039370317012072,
0.062318865209817886,
0.009826603345572948,
-0.010857123881578445,
-0.009295658208429813,
-0.04937024414539337,
-0.021177150309085846,
-0.012202516198158264,
0.01797502674162388,
-0.017187289893627167,
0.07039052993059158,
-0.029021533206105232,
0.012058359570801258,
-0.00766128022223711,
-0.005588318221271038,
-0.007304647006094456,
-0.03430064022541046,
-0.033469270914793015,
-0.0510031133890152,
0.034856945276260376,
-0.013589373789727688,
-0.036366093903779984,
0.020265471190214157
] |
8a8396f2f3ab51a489f606b57146366f183507ea | 14,346 | py | Python | virtualscreening/vina/spark/buried_areas.py | rodrigofaccioli/drugdesign | de15880af361a010729b1f4fbc8a75a2b36688a6 | [
"Apache-2.0"
] | 3 | 2015-01-19T20:12:59.000Z | 2019-02-21T18:43:04.000Z | virtualscreening/vina/spark/buried_areas.py | rodrigofaccioli/drugdesign | de15880af361a010729b1f4fbc8a75a2b36688a6 | [
"Apache-2.0"
] | 22 | 2015-01-05T16:48:54.000Z | 2017-01-21T16:36:10.000Z | virtualscreening/vina/spark/buried_areas.py | rodrigofaccioli/drugdesign | de15880af361a010729b1f4fbc8a75a2b36688a6 | [
"Apache-2.0"
] | 11 | 2015-03-03T13:32:24.000Z | 2020-04-03T11:22:24.000Z | from pyspark import SparkContext, SparkConf, SparkFiles
from pyspark.sql import SQLContext, Row
import ConfigParser as configparser
from subprocess import Popen, PIPE
from datetime import datetime
from vina_utils import get_directory_complex_pdb_analysis, get_files_pdb, get_name_model_pdb, get_ligand_from_receptor_ligand_model, get_separator_filename_mode, get_directory_pdb_analysis, loading_pdb_2_list, get_name_receptor_pdb, get_files_pdb_filter
import os, sys
from os_utils import preparing_path
from gromacs_utils import get_value_from_xvg_sasa
from pdb_io import replace_chain_atom_line
from database_io import load_database
def sorting_buried_area(sc, buried_areaRDD):
sqlCtx = SQLContext(sc)
buried_areaRDD = sc.parallelize(buried_areaRDD)
#buried_areaRDD = buried_areaRDD.map(lambda p: Row(receptor=str(p[0]), ligand=str(p[1]), model=int(p[2]), buried_lig_rec=float(p[3]), buried_lig_rec_perc=float(p[4]), buried_lig_lig_perc=float(p[5]) ) )
buried_areaRDD = buried_areaRDD.map(lambda p: Row(pose=str(p[0]), buried_total=float(p[1]) ) )
buried_area_table = sqlCtx.createDataFrame(buried_areaRDD)
buried_area_table.registerTempTable("buried_area")
buried_area_sorted_by_buried_total = sqlCtx.sql("SELECT * FROM buried_area ORDER BY buried_total DESC") #buried_lig_lig_perc
return buried_area_sorted_by_buried_total
def save_receptor_buried_area(path_file_buried_area, buried_area_sorted_by_lig_rec_perc):
f_buried_area = open(path_file_buried_area,"w")
for area in buried_area_sorted_by_lig_rec_perc:
#splited_line = area[0].split("_-_")
#aux_recep = splited_line[0]
#aux_lig = str(splited_line[1])
#preparing receptor
#receptor = str(str(aux_recep).replace("compl_", " ")).strip()
#preparing ligand
#splited_aux_lig = str(aux_lig).split(get_separator_filename_mode())
#ligand = splited_aux_lig[0]
#model = splited_aux_lig[1]
pose = area[0]
buried_total = "{:.4f}".format(area[1])
#line = receptor+"\t"+ligand+"\t"+model+"\t"+str(buried_lig_rec)+"\t"+str(buried_lig_rec_perc)+"\t"+str(buried_lig_lig_perc)+"\n"
line = pose+"\t"+str(buried_total)+"\n"
f_buried_area.write(line)
f_buried_area.close()
def save_buried_area(path_file_buried_area, buried_area_sorted_by_lig_rec_perc):
f_buried_area = open(path_file_buried_area,"w")
line = "# buried_area_total[nm2]\tpose"+"\n"
f_buried_area.write(line)
for area in buried_area_sorted_by_lig_rec_perc:
#receptor = area[0]
#ligand = area[1]
#model = area[2]
pose = str(str(area[0]).replace("compl_", " ")).strip()
buried_total = "{:.4f}".format(area[1])
#buried_lig_rec_perc = "{:.4f}".format(area[4])
#buried_lig_lig_perc = "{:.4f}".format(area[5])
#line = receptor+"\t"+ligand+"\t"+str(model)+"\t"+str(buried_lig_rec)+"\t"+str(buried_lig_rec_perc)+"\t"+str(buried_lig_lig_perc)+"\n"
line = str(buried_total)+"\t"+str(pose)+"\n"
f_buried_area.write(line)
f_buried_area.close()
def save_normalized_buried_area(path_file_buried_area, full_dataRDD):
f_buried_area = open(path_file_buried_area,"w")
line = "# normalized_buried_area_total[nm2]\tpose"+"\n"
f_buried_area.write(line)
for area in full_dataRDD.collect():
pose = str(str(area[0]).replace("compl_", " ")).strip()
normalized_buried_total = "{:.4f}".format(area[1])
line = str(normalized_buried_total)+"\t"+str(pose)+"\n"
f_buried_area.write(line)
f_buried_area.close()
def loading_lines_from_area_files(line):
line_splited = str(line).split()
#line_ret = ( str(line_splited[0]), str(line_splited[1]), int(line_splited[2]), float(line_splited[3]), float(line_splited[4]), float(line_splited[5]) )
line_ret = ( str(line_splited[0]), float(line_splited[1]) )
return line_ret
def get_files_area(mypath):
only_mol2_file = []
for root, dirs, files in os.walk(mypath):
for file in files:
if file.endswith(".area"):
f_path = os.path.join(root,file)
only_mol2_file.append(f_path)
return only_mol2_file
def save_log(finish_time, start_time):
log_file_name = 'vs_buried_areas.log'
current_path = os.getcwd()
path_file = os.path.join(current_path, log_file_name)
log_file = open(path_file, 'w')
diff_time = finish_time - start_time
msg = 'Starting ' + str(start_time) +'\n'
log_file.write(msg)
msg = 'Finishing ' + str(finish_time) +'\n'
log_file.write(msg)
msg = 'Time Execution (seconds): ' + str(diff_time.total_seconds()) +'\n'
log_file.write(msg)
def main():
config = configparser.ConfigParser()
config.read('config.ini')
#Path for Gromacs project
gromacs_path = preparing_path(config.get('DRUGDESIGN', 'gromacs_path'))
#Path where PDB ligand are - They are NOT participated in docking
pdb_ligand_path = config.get('DEFAULT', 'pdb_ligand_path')
#Path that contains all files for analysis
path_analysis = config.get('DEFAULT', 'path_analysis')
#Ligand Database file
ligand_database = config.get('DEFAULT', 'ligand_database_path_file')
#Path where all pdb receptor are
path_receptor_pdb = config.get('DEFAULT', 'pdb_path')
#Path for saving pdb files of models generated by VS
path_analysis_pdb = get_directory_pdb_analysis(path_analysis)
# Create SPARK config
maxResultSize = str(config.get('SPARK', 'maxResultSize'))
conf = (SparkConf().set("spark.driver.maxResultSize", maxResultSize))
# Create context
sc = SparkContext(conf=conf)
sqlCtx = SQLContext(sc)
#Adding Python Source file
#Path for drugdesign project
path_spark_drugdesign = config.get('DRUGDESIGN', 'path_spark_drugdesign')
sc.addPyFile(os.path.join(path_spark_drugdesign,"vina_utils.py"))
sc.addPyFile(os.path.join(path_spark_drugdesign,"os_utils.py"))
sc.addPyFile(os.path.join(path_spark_drugdesign,"gromacs_utils.py"))
sc.addPyFile(os.path.join(path_spark_drugdesign,"pdb_io.py"))
sc.addPyFile(os.path.join(path_spark_drugdesign,"database_io.py"))
sc.addPyFile(os.path.join(path_spark_drugdesign,"json_utils.py"))
#Adding bash scripts
sc.addFile(os.path.join(path_spark_drugdesign,"make_ndx_buried_area_total.sh"))
sc.addFile(os.path.join(path_spark_drugdesign,"make_sasa_rec_buried_area_total.sh"))
#Parameters form command line
#Indicates probe. Example: 0.14
probe = float(sys.argv[1])
#Indicates ndots. Example: 24
ndots = int(sys.argv[2])
#Broadcast
path_analysis_pdb_complex_b = sc.broadcast(path_analysis_pdb)
gromacs_path = sc.broadcast(gromacs_path)
pdb_ligand_path = sc.broadcast(pdb_ligand_path)
probe = sc.broadcast(probe)
ndots = sc.broadcast(ndots)
start_time = datetime.now()
os.environ["GMX_MAXBACKUP"]="-1"
#Loading all PDB receptor files into memory
list_all_pdb_receptor_files_path = []
all_receptor_for_complex = get_files_pdb(path_receptor_pdb)
for receptor in all_receptor_for_complex:
list_all_pdb_receptor_files_path.append(loading_pdb_2_list(receptor))
#Computing Buried areas
for pdb_receptor_files in list_all_pdb_receptor_files_path:
#Getting receptor name by fully path
base_file_name_receptor = get_name_receptor_pdb(str(pdb_receptor_files[0]))
#PDB file loaded into memory is sent by broadcast
pdb_file_receptor = pdb_receptor_files[1]
pdb_file_receptor = sc.broadcast(pdb_file_receptor)
#Loading PDB model files based on receptor into memory
base_file_name_receptor_for_filter = base_file_name_receptor+"_-_"
all_model_for_complex = get_files_pdb_filter(path_analysis_pdb,base_file_name_receptor_for_filter)
all_model_for_complexRDD = sc.parallelize(all_model_for_complex)
all_model_filesRDD = all_model_for_complexRDD.map(loading_pdb_2_list).collect()
# ********** Starting function **********************************************************
def compute_buried_area(pdb_complex):
chZ = "chZ"
sasa_complex = -1.0
sasa_rec = -1.0
sasa_lig = -1.0
buried_total = -1.0
returned_list = []
try:
base_name = get_name_model_pdb(pdb_complex)
ligand_name = get_ligand_from_receptor_ligand_model(base_name)
f_pdb_ligand_no_docking = os.path.join(pdb_ligand_path.value,ligand_name+".pdb")
f_ndx = os.path.join(path_analysis_pdb_complex_b.value,base_name+".ndx")
f_temp_sasa_complex = os.path.join(path_analysis_pdb_complex_b.value,base_name+"_sasa_complex.xvg")
f_temp_sasa_rec = os.path.join(path_analysis_pdb_complex_b.value,base_name+"_sasa_rec.xvg")
f_temp_sasa_lig = os.path.join(path_analysis_pdb_complex_b.value,base_name+"_sasa_lig.xvg")
# Makes the index file with the ligand (chain z) and the rest (non chain z)
script_make_ndx = SparkFiles.get("make_ndx_buried_area_total.sh") #Getting bash script that was copied by addFile command
command = script_make_ndx + " " + gromacs_path.value + " "+ pdb_complex + " "+ f_ndx
process = Popen(command,shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
command = gromacs_path.value +"gmx sasa -f " + pdb_complex + " -s " + pdb_complex + " -nopbc " + " -n " + f_ndx + " -surface System " + " -output System "+ " -xvg none " + " -o " + f_temp_sasa_complex
process = Popen(command,shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
# Makes f_temp_sasa_rec file
script_make_sasa_rec = SparkFiles.get("make_sasa_rec_buried_area_total.sh") #Getting bash script that was copied by addFile command
command = script_make_sasa_rec + " " + gromacs_path.value + " "+ pdb_complex + " "+ f_ndx + " " + f_temp_sasa_rec
process = Popen(command,shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
command = gromacs_path.value +"gmx sasa -f " + pdb_complex + " -s " + pdb_complex + " -nopbc " + " -n " + f_ndx + " -surface chZ " + " -output chZ "+ " -xvg none " + " -o " + f_temp_sasa_lig
process = Popen(command,shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
sasa_complex = get_value_from_xvg_sasa(f_temp_sasa_complex)
sasa_rec = get_value_from_xvg_sasa(f_temp_sasa_rec)
sasa_lig = get_value_from_xvg_sasa(f_temp_sasa_lig)
buried_total = sasa_rec + sasa_lig - sasa_complex
#Generating result - See column sorting because resultaed file will be created based on this sorting
returned_list = (base_name, buried_total)
except:
returned_list = (base_name, float(0))
#Deleting files
if os.path.exists(f_ndx):
os.remove(f_ndx)
if os.path.exists(f_temp_sasa_complex):
os.remove(f_temp_sasa_complex)
if os.path.exists(f_temp_sasa_rec):
os.remove(f_temp_sasa_rec)
if os.path.exists(f_temp_sasa_lig):
os.remove(f_temp_sasa_lig)
return returned_list
# ********** Finish function **********************************************************
# ********** Starting function **********************************************************
def save_model_receptor(list_receptor_model_file):
receptor_file = pdb_file_receptor.value #Obtained from broadcast
model_file = list_receptor_model_file[0]
full_path_for_save_complex = list_receptor_model_file[1]
#Open file for writting the complex
f_compl = open(full_path_for_save_complex, "w")
#Insert lines of receptor
for item in receptor_file:
f_compl.write(item)
#Insert lines of model and insert Z chain
for item in model_file:
item = replace_chain_atom_line(item,"d","z")
f_compl.write(item)
f_compl.close()
# ********** Finish function **********************************************************
# ********** Starting function **********************************************************
def build_list_model_for_complex(model):
full_path_model = model[0]
model_file = model[1]
path_pdb_complex = path_analysis_pdb_complex_b.value #Obtained from broadcast
#Building complex file based on model file name
base_name_model = get_name_model_pdb(full_path_model)
complex_name = "compl_"+base_name_model+".pdb"
full_path_for_save_complex = os.path.join(path_pdb_complex,complex_name)
list_receptor_model_file = (model_file, full_path_for_save_complex)
save_model_receptor(list_receptor_model_file)
list_ret = compute_buried_area(full_path_for_save_complex)
os.remove(full_path_for_save_complex)
return list_ret
# ********** Finish function **********************************************************
all_model_filesRDD = sc.parallelize(all_model_filesRDD)
all_model_filesRDD = all_model_filesRDD.map(build_list_model_for_complex).collect()
#Saving buried area of receptor
full_area_file = os.path.join(path_analysis,base_file_name_receptor+".area")
save_receptor_buried_area(full_area_file, all_model_filesRDD)
#Loading all area file
all_area_file = os.path.join(path_analysis,"*.area")
buried_areaRDD = sc.textFile(all_area_file).map(loading_lines_from_area_files).collect()
#Sorting by buried_total column
buried_area_sorted_by_buried_total = sorting_buried_area(sc, buried_areaRDD)
buried_area_sorted_by_buried_total.cache()
buried_area_sorted_by_buried_total_LIST = buried_area_sorted_by_buried_total.map(lambda p: (p.pose, p.buried_total) ).collect()
#Saving buried area file
path_file_buried_area = os.path.join(path_analysis, "summary_buried_areas_total.dat")
save_buried_area(path_file_buried_area, buried_area_sorted_by_buried_total_LIST)
#Calculating normalized buried area
#Loading database
rdd_database = load_database(sc, ligand_database)
#Creating Dataframe
database_table = sqlCtx.createDataFrame(rdd_database)
database_table.registerTempTable("database")
number_pose_ligandRDD = buried_area_sorted_by_buried_total.map(lambda p: Row(buried_total=int(p.buried_total), ligand=get_ligand_from_receptor_ligand_model(p.pose), pose=str(p.pose) ) ).collect()
number_pose_ligand_table = sqlCtx.createDataFrame(number_pose_ligandRDD)
number_pose_ligand_table.registerTempTable("buried_area_total_sort")
sql = """
SELECT pose, (b.buried_total / a.heavyAtom) as normalized_buried_area
FROM database a
JOIN buried_area_total_sort b ON b.ligand = a.ligand
ORDER BY normalized_buried_area DESC
"""
#Getting all data
full_dataRDD = sqlCtx.sql(sql)
#Saving normalized buried area file
path_file_buried_area = os.path.join(path_analysis, "summary_normalized_buried_areas.dat")
save_normalized_buried_area(path_file_buried_area, full_dataRDD)
#Removing all area files
all_area_files = get_files_area(path_analysis)
for area_file in all_area_files:
os.remove(area_file)
finish_time = datetime.now()
save_log(finish_time, start_time)
main()
| 43.87156 | 253 | 0.748292 | 0 | 0 | [
-0.01972166635096073,
0.03362142667174339,
0.027165092527866364,
0.000861985667143017,
-0.04196753352880478,
0.010265962220728397,
-0.02157977968454361,
0.031170058995485306,
-0.07147518545389175,
-0.023370584473013878,
-0.0006131682894192636,
-0.005267435219138861,
0.036423709243535995,
-0.02488143928349018,
-0.028308652341365814,
0.011158518493175507,
0.06959469616413116,
0.02289731241762638,
-0.017916427925229073,
0.03828142583370209,
-0.047333672642707825,
-0.028056923300027847,
-0.01885015331208706,
0.014395521022379398,
-0.03740447014570236,
-0.013295460492372513,
0.08733325451612473,
0.007632173132151365,
-0.007145443465560675,
-0.009011105634272099,
-0.0282371137291193,
-0.006173670757561922,
-0.00649816682562232,
0.038936957716941833,
-0.040627412497997284,
0.013968337327241898,
0.006685817148536444,
-0.04332626238465309,
-0.017971904948353767,
-0.0024313756730407476,
-0.057246360927820206,
0.03673848137259483,
-0.03787126764655113,
-0.012331828474998474,
0.008150771260261536,
0.0020246258936822414,
0.002859920496121049,
-0.0039604781195521355,
0.015869271010160446,
0.009873547591269016,
0.01757248304784298,
0.031619053333997726,
0.027044538408517838,
0.0069817593321204185,
-0.016101576387882233,
-0.03913385048508644,
0.0014592678053304553,
-0.025462765246629715,
-0.031158389523625374,
0.020471181720495224,
-0.03322566673159599,
0.008913530968129635,
0.030638722702860832,
0.012815205380320549,
-0.018507007509469986,
-0.004038319457322359,
0.014299877919256687,
-0.048858024179935455,
-0.04954233020544052,
-0.003800951410084963,
-0.025259658694267273,
-0.012923731468617916,
0.0455961637198925,
0.09380264580249786,
0.0016490536509081721,
-0.026817109435796738,
-0.04606796056032181,
-0.013719758950173855,
0.012618497014045715,
0.022516118362545967,
-0.025830287486314774,
0.06920868158340454,
-0.018756156787276268,
-0.02585219033062458,
-0.04302002117037773,
0.04351251199841499,
0.04788553714752197,
-0.006027004215866327,
0.01985815353691578,
0.03603410720825195,
-0.013774486258625984,
0.029348284006118774,
-0.04250939562916756,
0.02178690768778324,
-0.04845050349831581,
-0.06085404381155968,
-0.014960053376853466,
0.028994662687182426,
0.02645144797861576,
0.031509801745414734,
0.03017335943877697,
0.011841975152492523,
0.07202956825494766,
0.003431143704801798,
-0.01673033833503723,
-0.00782136619091034,
-0.03713471069931984,
0.0030282565858215094,
0.00011495080980239436,
0.01933540217578411,
-0.020568648353219032,
-0.016150662675499916,
0.010144177824258804,
-0.018611038103699684,
-0.01915525645017624,
-0.03420181944966316,
-0.018184078857302666,
0.05890241265296936,
-0.04590978845953941,
0.053554967045784,
0.0007156491628848016,
0.01445719413459301,
0.016122538596391678,
0.0333322249352932,
-0.0036558269057422876,
0.0814502090215683,
-0.0074103944934904575,
0.00477611692622304,
0.058876942843198776,
-0.04292329028248787,
0.004508310928940773,
-0.05970313027501106,
0.006724813021719456,
-0.02194965071976185,
0.06337187439203262,
-0.04622373729944229,
-0.014608851633965969,
0.010215017013251781,
-0.04010933265089989,
0.02546628937125206,
0.0054174684919416904,
0.0061222282238304615,
0.002497041830793023,
-0.011967036873102188,
-0.002550886245444417,
-0.03261372074484825,
-0.0004629377508535981,
-0.02057364210486412,
-0.010750477202236652,
-0.0180502962321043,
0.035851068794727325,
0.015305866487324238,
-0.02233862318098545,
-0.016245141625404358,
-0.011641493067145348,
-0.009757902473211288,
0.0012846158351749182,
-0.04778941348195076,
-0.015097531490027905,
0.02551221288740635,
-0.04122108966112137,
0.00757046602666378,
0.013627455569803715,
0.03995854780077934,
-0.016440007835626602,
0.0462045855820179,
-0.02064843848347664,
0.010997194796800613,
-0.00821060873568058,
0.0030802753753960133,
0.01959512010216713,
-0.022089356556534767,
0.008466621860861778,
-0.022204305976629257,
-0.03685079887509346,
0.0037397542037069798,
-0.008092372678220272,
0.019425779581069946,
0.012023924849927425,
-0.054506465792655945,
-0.010047740302979946,
0.0019786080811172724,
0.02268773317337036,
0.045096464455127716,
0.006198989227414131,
-0.03641677275300026,
-0.03466159477829933,
-0.046870552003383636,
-0.009059484116733074,
-0.021631577983498573,
-0.03229386731982231,
0.057786401361227036,
0.049294326454401016,
-0.005200439132750034,
0.04042842611670494,
0.020214645192027092,
-0.016908349469304085,
-0.016729749739170074,
-0.013207691721618176,
-0.014971324242651463,
-0.0020055389031767845,
-0.04699067398905754,
0.012117486447095871,
-0.014591549523174763,
-0.03254498541355133,
0.012090750969946384,
-0.6469299793243408,
0.03398910164833069,
0.04317654296755791,
0.013819823041558266,
0.021711930632591248,
0.03654441982507706,
-0.016641004011034966,
0.036025043576955795,
-0.005892192013561726,
-0.023748401552438736,
-0.02798323519527912,
-0.031155487522482872,
-0.013986530713737011,
-0.020352818071842194,
0.015826255083084106,
0.00016114696336444467,
0.052484143525362015,
0.049052219837903976,
0.0069252667017281055,
0.061080798506736755,
0.015102246776223183,
-0.04280058294534683,
-0.01880384050309658,
0.002687216969206929,
0.019980957731604576,
0.0013323505409061909,
-0.00881017092615366,
0.019719991832971573,
0.029827913269400597,
-0.0005175194819457829,
-0.0021364784333854914,
-0.032018695026636124,
0.0031150951981544495,
0.013969199731945992,
0.008255991153419018,
0.020023714751005173,
0.015387061983346939,
-0.01272803358733654,
0.020111754536628723,
0.0010252349311485887,
0.0060561904683709145,
-0.0016106945695355535,
-0.01115884818136692,
-0.03548348695039749,
-0.004508406389504671,
-0.0349101647734642,
0.005287469830363989,
-0.023411624133586884,
0.03057895414531231,
0.04946836084127426,
-0.02637266367673874,
0.0403582863509655,
0.0349498949944973,
-0.01009649783372879,
-0.00886727124452591,
-0.013042670674622059,
-0.04203607514500618,
-0.009032018482685089,
0.01405291073024273,
-0.024892866611480713,
0.02651686780154705,
-0.004652146715670824,
-0.03935835137963295,
0.015649346634745598,
0.013639324344694614,
0.015482686460018158,
0.011775298975408077,
-0.06080589070916176,
-0.011028320528566837,
0.01793183945119381,
0.0011714609572663903,
0.01609634980559349,
-0.04126879945397377,
0.08214976638555527,
0.006233789026737213,
-0.005311964545398951,
-0.03184019774198532,
-0.04562411084771156,
-0.024478211998939514,
-0.05154921114444733,
-0.0016966976691037416,
0.020100820809602737,
-0.004875116515904665,
0.026293378323316574,
-0.007191110868006945,
-0.03857135400176048,
0.029417699202895164,
0.02655615098774433,
0.012644175440073013,
0.03064838796854019,
0.03552412986755371,
0.05051014572381973,
0.005603779572993517,
0.001709625357761979,
0.02616805210709572,
0.007834510877728462,
-0.04036499932408333,
0.06159869208931923,
0.018358750268816948,
0.038430262356996536,
0.005351563915610313,
0.03701118007302284,
-0.029686318710446358,
0.020680388435721397,
-0.03259335458278656,
-0.00013344116450753063,
-0.06602979451417923,
-0.023462481796741486,
-0.006229701917618513,
-0.01573876291513443,
0.005789068527519703,
-0.01727600395679474,
-0.05026717856526375,
-0.004787554033100605,
-0.014207599684596062,
-0.00798149686306715,
-0.02168254368007183,
-0.026958070695400238,
0.0077877892181277275,
0.003573169931769371,
-0.03668353706598282,
0.00994675513356924,
-0.038036201149225235,
-0.0023488469887524843,
0.003346841549500823,
0.0006738707888871431,
-0.06031086668372154,
-0.006329029332846403,
-0.013191095553338528,
0.047740958631038666,
-0.003554006339982152,
0.011717870831489563,
-0.005539783276617527,
0.00423093605786562,
-0.0006606950191780925,
-0.030291477218270302,
-0.04788324981927872,
-0.027088597416877747,
-0.01452413946390152,
-0.02198219858109951,
0.0058959294110536575,
0.04593929648399353,
0.01616567000746727,
-0.0029260136652737856,
-0.007516630459576845,
0.017414521425962448,
0.017794782295823097,
0.019640127196907997,
0.04292432963848114,
0.037340909242630005,
0.0065000648610293865,
0.017406616359949112,
0.00939998496323824,
-0.014606713317334652,
0.003788412781432271,
0.01902906969189644,
-0.009757655672729015,
-0.013708701357245445,
0.011747634038329124,
0.05286415293812752,
0.03423444181680679,
0.0009992497507482767,
-0.0536409392952919,
0.011132122948765755,
-0.02614910714328289,
-0.003283968660980463,
0.019589565694332123,
0.06132112443447113,
-0.0014494623756036162,
-0.011471173726022243,
0.0926612913608551,
-0.03154594078660011,
0.010805412195622921,
0.01635691151022911,
-0.010565543547272682,
0.028047379106283188,
-0.008390484377741814,
0.011187399737536907,
-0.0013702195137739182,
-0.009176312945783138,
0.007226515561342239,
-0.01598322205245495,
-0.02942901849746704,
-0.013250742107629776,
0.0027483853045850992,
0.004744395613670349,
-0.004394741263240576,
0.00035888951970264316,
0.03539283946156502,
-0.007102323230355978,
-0.028717434033751488,
0.020792439579963684,
-0.01236754935234785,
0.016536494717001915,
-0.0488884337246418,
0.024597346782684326,
-0.008410921320319176,
-0.018323402851819992,
0.001927895937114954,
-0.03907986730337143,
-0.014819118194282055,
0.023064348846673965,
0.012247839942574501,
-0.04035903513431549,
-0.007555840536952019,
0.04016035422682762,
-0.01986277662217617,
-0.0018995482241734862,
-0.03844430297613144,
-0.01961079053580761,
0.04907551035284996,
-0.003707726951688528,
-0.054754529148340225,
0.006021109409630299,
-0.05910320207476616,
0.008864779956638813,
-0.0360373854637146,
0.04061926528811455,
-0.01753845252096653,
0.002466294914484024,
-0.0033961585722863674,
-0.019365772604942322,
0.02390107698738575,
0.019562356173992157,
-0.021806644275784492,
-0.00015990609244909137,
0.021296268329024315,
0.024058789014816284,
0.0016467213863506913,
-0.014138412661850452,
0.001283709891140461,
-0.01264746394008398,
-0.0000032493551316292724,
-0.02937578782439232,
-0.027195975184440613,
0.011874661780893803,
-0.0449611134827137,
-0.020179927349090576,
-0.026599477976560593,
-0.018788816407322884,
0.05771470069885254,
0.02440626174211502,
0.006720663048326969,
0.053876470774412155,
-0.003256355645135045,
0.010766986757516861,
0.032865606248378754,
-0.01815398409962654,
-0.0022033441346138716,
-0.011162939481437206,
-0.017879873514175415,
-0.026479575783014297,
0.018939727917313576,
-0.03183828294277191,
-0.01152136828750372,
-0.012117265723645687,
-0.02224528044462204,
-0.003491438226774335,
-0.0063208588398993015,
-0.002629552036523819,
-0.02233426831662655,
-0.0001294112007599324,
-0.04478643834590912,
0.029874205589294434,
-0.013073396869003773,
-0.003996079787611961,
0.03999185189604759,
-0.002171766245737672,
-0.014096463099122047,
0.011588862165808678,
0.03279505670070648,
-0.0180220827460289,
-0.03756704181432724,
-0.010873142629861832,
-0.012071140110492706,
-0.04752939194440842,
0.008501393720507622,
-0.02676049992442131,
0.030723877251148224,
0.03843211010098457,
-0.04190148040652275,
-0.025762392207980156,
0.04705089330673218,
0.01472964696586132,
-0.044873517006635666,
-0.004567973781377077,
-0.07584092020988464,
-0.00734594976529479,
-0.02923578768968582,
-0.008676299825310707,
0.027720460668206215,
-0.007912369444966316,
0.06162099912762642,
0.020080456510186195,
-0.03557700663805008,
0.033819254487752914,
-0.01142890378832817,
-0.005122316535562277,
0.07290671020746231,
0.03076440468430519,
0.050797902047634125,
0.010110028088092804,
0.030078576877713203,
0.00007581696263514459,
-0.003416770603507757,
-0.004412611480802298,
0.030430711805820465,
-0.012272878549993038,
0.030407218262553215,
0.05045504868030548,
0.015036861412227154,
0.02824387699365616,
0.014448758214712143,
0.0031656466890126467,
0.009451789781451225,
-0.005637201480567455,
0.04449063539505005,
0.009142101742327213,
0.014416828751564026,
0.0028104293160140514,
-0.031291037797927856,
0.05180230736732483,
-0.012913251295685768,
-0.014932667836546898,
-0.012645062059164047,
-0.03084944747388363,
-0.05932673439383507,
0.015903353691101074,
-0.016301298514008522,
0.027613893151283264,
0.027203518897294998,
-0.027382543310523033,
0.007109528873115778,
-0.012715967372059822,
0.040218256413936615,
0.02290111593902111,
0.0423150397837162,
0.04463960975408554,
0.023570029065012932,
0.06948032230138779,
-0.026903769001364708,
0.006002985406666994,
0.021279387176036835,
0.010043689049780369,
0.009372994303703308,
0.01661182940006256,
-0.06714801490306854,
0.04429284855723381,
0.021801983937621117,
0.0030709770508110523,
-0.02170567587018013,
0.005964282434433699,
-0.02031586319208145,
0.002757592359557748,
0.016967888921499252,
-0.028988193720579147,
-0.007870814763009548,
0.026917381212115288,
-0.0052441745065152645,
0.007879287004470825,
0.007748199161142111,
0.030624790117144585,
0.006860219873487949,
-0.07240108400583267,
0.015671521425247192,
-0.04542020708322525,
0.017173176631331444,
-0.03377344086766243,
-0.041468147188425064,
0.00505899079144001,
-0.03897073492407799,
-0.024112388491630554,
-0.000892949930857867,
0.028796762228012085,
-0.02717684581875801,
-0.018486134707927704,
-0.00933077558875084,
0.031002458184957504,
-0.03712721914052963,
-0.02793039381504059,
-0.03017006628215313,
-0.041098494082689285,
0.029155965894460678,
-0.0055819107219576836,
0.026791425421833992,
-0.01838715933263302,
0.01128234900534153,
-0.016754934564232826,
0.010077781043946743,
-0.017439140006899834,
0.0031535993330180645,
0.014425395987927914,
0.049088768661022186,
0.03007923811674118,
-0.01976011134684086,
-0.019492294639348984,
-0.03812471777200699,
-0.03649597242474556,
0.020573468878865242,
-0.007141264155507088,
-0.011699015274643898,
-0.006547185126692057,
0.0001912139996420592,
-0.026694368571043015,
0.009928619489073753,
0.023793017491698265,
-0.002715485170483589,
0.02327742427587509,
0.0038898077327758074,
-0.02075134962797165,
0.006016360130161047,
0.016773654147982597,
-0.00693408353254199,
-0.0460163839161396,
0.04204291105270386,
0.01428244449198246,
-0.060629379004240036,
-0.004408358596265316,
0.0034731945488601923,
0.01075699646025896,
-0.013720751740038395,
-0.020336898043751717,
-0.01472244318574667,
0.0014230463420972228,
-0.012646534480154514,
0.037672869861125946,
-0.0085517643019557,
0.029230009764432907,
0.0030787158757448196,
0.018031440675258636,
-0.018806764855980873,
-0.015722811222076416,
-0.014622808434069157,
0.02144656702876091,
0.011327849701046944,
0.0035536554642021656,
-0.006139765493571758,
-0.03236744552850723,
-0.051043588668107986,
0.02187611535191536,
-0.031259454786777496,
0.007297724485397339,
0.02766765095293522,
0.0039017328526824713,
0.013953842222690582,
-0.014963841065764427,
0.000016359135770471767,
-0.010172855108976364,
0.01685478538274765,
0.040222302079200745,
-0.00255050347186625,
0.029244644567370415,
0.008320055902004242,
0.012465057894587517,
0.029241012409329414,
-0.022506386041641235,
-0.03904338926076889,
0.05836564674973488,
0.012953223660588264,
0.011943877674639225,
0.06051413714885712,
0.00005607154525932856,
0.003218304365873337,
0.02847873978316784,
0.01060246117413044,
0.0019560731016099453,
0.0012658871710300446,
0.014928511343896389,
-0.03979582339525223,
0.010221567936241627,
-0.0020856675691902637,
0.009334759786725044,
-0.010997631587088108,
0.038472309708595276,
-0.011535455472767353,
0.029180163517594337,
-0.02837851643562317,
0.01209885161370039,
0.009836765937507153,
0.011670456267893314,
-0.03540719673037529,
0.019871901720762253,
0.022062508389353752,
-0.025015586987137794,
0.02187570184469223,
-0.012003586627542973,
-0.02100028470158577,
0.0014144692104309797,
-0.030283233150839806,
0.021322794258594513,
-0.027840930968523026,
-0.03167116641998291,
-0.0049203247763216496,
0.014153552241623402,
0.009893487207591534,
0.024075161665678024,
-0.004773175809532404,
-0.007544577121734619,
0.044194936752319336,
-0.015694094821810722,
-0.005860789213329554,
-0.06649433821439743,
0.016488999128341675,
-0.022429613396525383,
0.039798032492399216,
0.015201384201645851,
0.057350434362888336,
-0.009724545292556286,
-0.0024373165797442198,
-0.00001176292516902322,
-0.00958022940903902,
0.00217810389585793,
-0.02311355248093605,
-0.012630774639546871,
0.0015960250748321414,
0.022542022168636322,
0.023848753422498703,
0.02188202738761902,
0.010196161456406116,
-0.008648033253848553,
0.010934827849268913,
0.013156541623175144,
0.03741089254617691,
0.02296748198568821,
-0.019890381023287773,
0.0007260467391461134,
0.0003030695079360157,
-0.0018080213339999318,
0.025264939293265343,
0.008092248812317848,
0.0068710194900631905,
-0.036596477031707764,
0.01046542078256607,
-0.034993089735507965,
0.015288730151951313,
-0.009830490685999393,
-0.008085589855909348,
0.0080396868288517,
-0.03407178446650505,
-0.017672890797257423,
0.0068019418977200985,
0.005056486465036869,
-0.03396349027752876,
-0.03944586217403412,
-0.029543904587626457,
-0.0610160157084465,
0.0016034500440582633,
0.03634455054998398,
-0.0070504010654985905,
0.009937840513885021,
-0.008572458289563656,
0.007024259772151709,
0.009826650843024254,
-0.009175767190754414,
0.009414386935532093,
-0.012913405895233154,
-0.029787490144371986,
-0.0017513773636892438,
-0.037973418831825256,
-0.006610346958041191,
0.010014701634645462,
-0.002562441863119602
] |
8a84ca10fd051b6b0bb8be0088246cc71958f9d5 | 12,062 | py | Python | oase-root/web_app/views/system/mail/action_mail.py | Masa-Yasuno/oase | 90f3cee73c0d9b3153808a4a72bd19984a4873f9 | [
"Apache-2.0"
] | 9 | 2020-03-25T07:51:47.000Z | 2022-02-07T00:07:28.000Z | oase-root/web_app/views/system/mail/action_mail.py | Masa-Yasuno/oase | 90f3cee73c0d9b3153808a4a72bd19984a4873f9 | [
"Apache-2.0"
] | 1,164 | 2021-01-28T23:16:11.000Z | 2022-03-28T07:23:10.000Z | oase-root/web_app/views/system/mail/action_mail.py | Masa-Yasuno/oase | 90f3cee73c0d9b3153808a4a72bd19984a4873f9 | [
"Apache-2.0"
] | 25 | 2020-03-17T06:48:30.000Z | 2022-02-15T15:13:44.000Z | # Copyright 2019 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""
[概要]
MAILアクション用画面表示補助クラス
"""
import pytz
import datetime
import json
import socket
import traceback
from django.http import HttpResponse
from django.http import HttpResponseServerError
from django.db import transaction
from django.conf import settings
from libs.commonlibs import define as defs
from libs.commonlibs.oase_logger import OaseLogger
from libs.commonlibs.aes_cipher import AESCipher
from web_app.models.models import ActionType
from web_app.models.mail_models import MailDriver
from web_app.templatetags.common import get_message
from web_app.serializers.unicode_check import UnicodeCheck
logger = OaseLogger.get_instance() # ロガー初期化
class mailDriverInfo():
def __init__(self, drv_id, act_id, name, ver, icon_name):
self.drv_id = drv_id
self.act_id = act_id
self.name = name
self.ver = ver
self.icon_name = icon_name
def __str__(self):
return '%s(ver%s)' % (self.name, self.ver)
def get_driver_name(self):
return '%s Driver ver%s' % (self.name, self.ver)
def get_driver_id(self):
return self.drv_id
def get_icon_name(self):
return self.icon_name
@classmethod
def get_template_file(cls):
return 'system/mail/action_mail.html'
@classmethod
def get_info_list(cls, user_groups):
try:
mail_driver_obj_list = MailDriver.objects.all()
except Exception as e:
# ここでの例外は大外で拾う
raise
protocol_dict = cls.get_define()['dict']
mail_driver_dto_list = []
cipher = AESCipher(settings.AES_KEY)
for mail_obj in mail_driver_obj_list:
mail_info = mail_obj.__dict__
if mail_obj.password:
mail_info['password'] = cipher.decrypt(mail_obj.password)
mail_info['protocol_str'] = protocol_dict[mail_obj.protocol]
mail_driver_dto_list.append(mail_info)
return mail_driver_dto_list
@classmethod
def get_group_list(cls, user_groups):
"""
[概要]
グループ一覧を取得する(システム管理グループを除く)
"""
return []
@classmethod
def get_define(cls):
protocol_dict = {key_value['v']: key_value['k'] for key_value in defs.SMTP_PROTOCOL.LIST_ALL}
defines = {
'list_all': defs.SMTP_PROTOCOL.LIST_ALL,
'dict': protocol_dict,
}
return defines
def record_lock(self, json_str, request):
logger.logic_log('LOSI00001', 'None', request=request)
driver_id = self.get_driver_id()
# 更新前にレコードロック
if json_str['json_str']['ope'] in (defs.DABASE_OPECODE.OPE_UPDATE, defs.DABASE_OPECODE.OPE_DELETE):
drvinfo_modify = int(json_str['json_str']['mail_driver_id'])
MailDriver.objects.select_for_update().filter(pk=drvinfo_modify)
logger.logic_log('LOSI00002', 'Record locked.(driver_id=%s)' % driver_id, request=request)
def modify(self, json_str, request):
"""
[メソッド概要]
グループのDB更新処理
"""
logger.logic_log('LOSI00001', 'None', request=request)
error_flag = False
error_msg = {
'mail_disp_name' : '',
'protocol' : '',
'smtp_server' : '',
'port' : '',
'user' : '',
'password' : '',
}
now = datetime.datetime.now(pytz.timezone('UTC'))
emo_chk = UnicodeCheck()
# 成功時データ
response = {"status": "success",}
try:
rq = json_str['json_str']
ope = int(rq['ope'])
#削除以外の場合の入力チェック
if ope != defs.DABASE_OPECODE.OPE_DELETE:
error_flag = self._validate(rq, error_msg, request)
if error_flag:
raise UserWarning('validation error.')
# パスワードを暗号化 空なら空文字
cipher = AESCipher(settings.AES_KEY)
if ope == defs.DABASE_OPECODE.OPE_UPDATE:
encrypted_password = cipher.encrypt(rq['password']) if rq['password'] else ''
driver_info_mod = MailDriver.objects.get(mail_driver_id=rq['mail_driver_id'])
driver_info_mod.mail_disp_name = rq['mail_disp_name']
driver_info_mod.protocol = rq['protocol']
driver_info_mod.smtp_server = rq['smtp_server']
driver_info_mod.port = rq['port']
driver_info_mod.user = rq['user']
driver_info_mod.password = encrypted_password
driver_info_mod.last_update_user = request.user.user_name
driver_info_mod.last_update_timestamp = now
driver_info_mod.save(force_update=True)
elif ope == defs.DABASE_OPECODE.OPE_DELETE:
MailDriver.objects.filter(pk=rq['mail_driver_id']).delete()
elif ope == defs.DABASE_OPECODE.OPE_INSERT:
encrypted_password = cipher.encrypt(rq['password']) if rq['password'] else ''
driver_info_reg = MailDriver(
mail_disp_name = rq['mail_disp_name'],
protocol = rq['protocol'],
smtp_server = rq['smtp_server'],
port = rq['port'],
user = rq['user'],
password = encrypted_password,
last_update_user = request.user.user_name,
last_update_timestamp = now
).save(force_insert=True)
except MailDriver.DoesNotExist:
logger.logic_log('LOSM07006', "mail_driver_id", mail_driver_id, request=request)
except Exception as e:
logger.logic_log('LOSI00005', traceback.format_exc(), request=request)
response = {
'status': 'failure',
'error_msg': error_msg, # エラー詳細(エラーアイコンで出す)
}
logger.logic_log('LOSI00002', 'response=%s' % response, request=request)
return response
def _validate(self, rq, error_msg, request):
"""
[概要]
入力チェック
[引数]
rq: dict リクエストされた入力データ
error_msg: dict
[戻り値]
"""
logger.logic_log('LOSI00001', 'data: %s, error_msg:%s'%(rq, error_msg))
error_flag = False
emo_chk = UnicodeCheck()
emo_flag = False
emo_flag_ita_disp_name = False
emo_flag_hostname = False
if len(rq['mail_disp_name']) == 0:
error_flag = True
error_msg['mail_disp_name'] += get_message('MOSJA27201', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07001', 'mail_disp_name', request=request)
if len(rq['mail_disp_name']) > 64:
error_flag = True
error_msg['mail_disp_name'] += get_message('MOSJA27202', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07002', 'mail_disp_name', 64, rq['mail_disp_name'], request=request)
# 絵文字チェック
value_list = emo_chk.is_emotion(rq['mail_disp_name'])
if len(value_list) > 0:
error_flag = True
emo_flag = True
error_msg['mail_disp_name'] += get_message('MOSJA27216', request.user.get_lang_mode(), showMsgId=False) + '\n'
if len(rq['protocol']) == 0:
error_flag = True
error_msg['protocol'] += get_message('MOSJA27212', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07001', 'protocol', request=request)
if len(rq['protocol']) > 64:
error_flag = True
error_msg['protocol'] += get_message('MOSJA27213', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07002', 'protocol', 64, rq['protocol'], request=request)
if len(rq['smtp_server']) == 0:
error_flag = True
error_msg['smtp_server'] += get_message('MOSJA27203', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07001', 'smtp_server', request=request)
if len(rq['smtp_server']) > 128:
error_flag = True
error_msg['smtp_server'] += get_message('MOSJA27204', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07002', 'smtp_server', 64, rq['smtp_server'], request=request)
# 絵文字チェック
value_list = emo_chk.is_emotion(rq['smtp_server'])
if len(value_list) > 0:
error_flag = True
error_msg['smtp_server'] += get_message('MOSJA27217', request.user.get_lang_mode(), showMsgId=False) + '\n'
if len(rq['port']) == 0:
error_flag = True
error_msg['port'] += get_message('MOSJA27205', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07001', 'port', request=request)
try:
tmp_port = int(rq['port'])
if 0 > tmp_port or tmp_port > 65535:
error_flag = True
error_msg['port'] += get_message('MOSJA27206', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07003', 'port', rq['port'], request=request)
except ValueError:
error_flag = True
error_msg['port'] += get_message('MOSJA27206', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07003', 'port', rq['port'], request=request)
if len(rq['user']) > 64:
error_flag = True
error_msg['user'] += get_message('MOSJA27207', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07002', 'user', 64, rq['user'], request=request)
# 絵文字チェック
value_list = emo_chk.is_emotion(rq['user'])
if len(value_list) > 0:
error_flag = True
error_msg['user'] += get_message('MOSJA27218', request.user.get_lang_mode(), showMsgId=False) + '\n'
if len(rq['password']) > 64:
error_flag = True
error_msg['password'] += get_message('MOSJA27208', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07002', 'password', 64, rq['password'], request=request)
# 絵文字チェック
value_list = emo_chk.is_emotion(rq['password'])
if len(value_list) > 0:
error_flag = True
error_msg['password'] += get_message('MOSJA27219', request.user.get_lang_mode(), showMsgId=False) + '\n'
if not emo_flag:
duplication = MailDriver.objects.filter(mail_disp_name=rq['mail_disp_name'])
if len(duplication) == 1 and int(rq['mail_driver_id']) != duplication[0].mail_driver_id:
error_flag = True
error_msg['mail_disp_name'] += get_message('MOSJA27209', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07004', 'mail_disp_name', rq['mail_disp_name'], request=request)
if error_flag == False:
# 疎通確認
resp_code = -1
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
resp_code = sock.connect_ex((rq['smtp_server'], int(rq['port']))) # host名名前解決が必要/etc/hostsとか
sock.close()
except Exception as e:
pass
if resp_code != 0:
error_flag = True
#todo 仮でこのエラーは名前に入れている
error_msg['mail_disp_name'] += get_message('MOSJA27215', request.user.get_lang_mode()) + '\n'
logger.user_log('LOSM07005', rq['smtp_server'], rq['port'], request=request)
return error_flag
| 35.372434 | 122 | 0.596419 | 1 | 2.1321 | [
-0.018654726445674896,
0.02855737693607807,
0.00003777815800276585,
0.010960636660456657,
-0.012814244255423546,
0.020775331184267998,
-0.0323602631688118,
-0.011981597170233727,
-0.007122362963855267,
0.03502587229013443,
-0.00961088202893734,
0.036926690489053726,
0.04589445888996124,
-0.020094987004995346,
0.011176953092217445,
-0.0147805605083704,
0.13815557956695557,
0.03119789995253086,
0.030174173414707184,
0.02075796201825142,
-0.005205043125897646,
0.036628369241952896,
-0.020565448328852654,
-0.0035687494091689587,
0.02343331277370453,
-0.003091009333729744,
0.01408250443637371,
-0.005903911776840687,
-0.0016584123950451612,
-0.018280943855643272,
0.018493639305233955,
-0.01767387054860592,
0.03553815931081772,
0.04196883738040924,
-0.03475616127252579,
0.006713383831083775,
-0.0010694378288462758,
-0.04713336005806923,
0.027632951736450195,
0.01696416176855564,
0.003959013149142265,
0.00018323585391044617,
-0.004389587324112654,
-0.011040308512747288,
-0.005356920417398214,
-0.0026490306481719017,
-0.024808762595057487,
-0.006848511751741171,
-0.020327091217041016,
0.024224696680903435,
0.004777579102665186,
0.03045077808201313,
-0.018627656623721123,
-0.043757062405347824,
-0.003138789674267173,
-0.03173954412341118,
0.0034171943552792072,
-0.010774747468531132,
-0.022187450900673866,
-0.022057397291064262,
0.005712050013244152,
-0.0022878905292600393,
0.021804435178637505,
-0.024334115907549858,
-0.037015270441770554,
-0.006825073156505823,
0.029123952612280846,
0.026771578937768936,
0.029616031795740128,
-0.017785951495170593,
-0.013868924230337143,
-0.018591612577438354,
0.019655829295516014,
0.0751749724149704,
0.021019084379076958,
0.02697829157114029,
-0.027119258418679237,
0.013857601210474968,
0.010263029485940933,
0.008740216493606567,
0.00019691821944434196,
0.019130321219563484,
-0.006095584481954575,
0.008664575405418873,
0.0026932270266115665,
0.004269115626811981,
0.06252720952033997,
-0.027947962284088135,
0.05010833218693733,
-0.004718920681625605,
-0.019203923642635345,
0.06278473138809204,
-0.04918261989951134,
0.020302770659327507,
-0.0757647231221199,
-0.0570143386721611,
0.034512344747781754,
0.012027665041387081,
0.01760280504822731,
0.025714896619319916,
0.04172433912754059,
-0.014825834892690182,
0.011645302176475525,
0.007680263835936785,
0.021334974095225334,
-0.00979573279619217,
-0.05309443920850754,
-0.010219846852123737,
0.025964640080928802,
-0.0012939557200297713,
0.00811978243291378,
0.0017325151711702347,
0.0650731772184372,
-0.04041295871138573,
-0.004916127771139145,
-0.01215268112719059,
0.018045993521809578,
0.0074950046837329865,
-0.019424520432949066,
0.07095165550708771,
-0.004514905158430338,
-0.017219074070453644,
-0.004437829367816448,
-0.01347460225224495,
0.009413070976734161,
0.0957341194152832,
0.010947063565254211,
0.00016483201761730015,
0.01662767492234707,
-0.010596731677651405,
-0.02418319694697857,
-0.02130722813308239,
-0.004575483035296202,
0.01591205969452858,
0.016450483351945877,
0.012771697714924812,
0.005130206700414419,
0.016534944996237755,
-0.07942894101142883,
0.02402450516819954,
0.024798128753900528,
-0.037890367209911346,
0.009155966341495514,
-0.021008649840950966,
-0.03262972831726074,
-0.01450774073600769,
0.01198604702949524,
0.02287834882736206,
-0.040113065391778946,
-0.036953140050172806,
0.008677609264850616,
0.006099724676460028,
-0.04418179765343666,
-0.004898371174931526,
-0.005432584788650274,
0.01027634833008051,
-0.017167577520012856,
-0.019305948168039322,
-0.00912392232567072,
-0.016268938779830933,
-0.0154516426846385,
0.02862897701561451,
0.03475033491849899,
-0.015241592191159725,
0.014854518696665764,
0.0044641075655817986,
-0.018572064116597176,
0.019339602440595627,
0.010957068763673306,
0.05274152010679245,
-0.01703634299337864,
-0.0157384742051363,
-0.04398919641971588,
0.009036454372107983,
-0.04428146779537201,
0.01358214020729065,
0.03176453709602356,
0.045228779315948486,
0.024488437920808792,
0.0059313103556632996,
0.010973304510116577,
-0.023777367547154427,
0.017184816300868988,
0.04098037630319595,
-0.02101428061723709,
-0.025724610313773155,
-0.02714337222278118,
0.010855240747332573,
0.0012270937440916896,
-0.02261349931359291,
0.004045493435114622,
0.04684789851307869,
-0.07022765278816223,
-0.026003707200288773,
0.0442851297557354,
-0.019875654950737953,
-0.0031813085079193115,
0.010292500257492065,
0.0007369306986220181,
-0.05096092075109482,
0.004077994730323553,
-0.002223776187747717,
-0.012326939031481743,
-0.0003979218890890479,
0.00887797586619854,
0.010597704909741879,
-0.6671532988548279,
0.018081698566675186,
-0.00882380735129118,
-0.007576077710837126,
0.02298339270055294,
0.03618042916059494,
0.012265916913747787,
-0.018188325688242912,
-0.04712275415658951,
-0.04300754517316818,
-0.0036402626428753138,
0.019146909937262535,
-0.032718755304813385,
0.006576986983418465,
0.03662997484207153,
0.004157122690230608,
-0.009051205590367317,
-0.0348234623670578,
0.004695636220276356,
0.011669359169900417,
0.024938056245446205,
0.03389032185077667,
0.03744051977992058,
0.009282450191676617,
-0.043304480612277985,
-0.03165442496538162,
-0.005370311439037323,
-0.0020286061335355043,
-0.02198934182524681,
-0.016141794621944427,
-0.05295722931623459,
-0.026618462055921555,
-0.01153607852756977,
0.01541359443217516,
0.0024732635356485844,
-0.00946455355733633,
0.03747580200433731,
-0.016066774725914,
-0.024787796661257744,
-0.029399722814559937,
-0.026616675779223442,
-0.0024515222758054733,
-0.00844230130314827,
-0.0309487022459507,
-0.061448369175195694,
-0.05296901613473892,
0.00047957192873582244,
-0.04666832461953163,
-0.00614824378862977,
0.04158402606844902,
-0.02262558974325657,
0.0500405952334404,
0.0500158928334713,
-0.017580313608050346,
-0.019583309069275856,
0.0005031756008975208,
-0.04278486594557762,
-0.025323335081338882,
-0.03614367917180061,
-0.014972275123000145,
0.013232581317424774,
0.01015895139425993,
-0.0073952628299593925,
0.00047015235759317875,
0.03091101534664631,
-0.008276338689029217,
-0.0012858904665336013,
-0.019976353272795677,
0.025755681097507477,
0.006904629059135914,
-0.04897206276655197,
0.03949549421668053,
-0.04288410767912865,
0.009879873134195805,
-0.01584169641137123,
0.023852912709116936,
-0.018108757212758064,
0.009682738222181797,
-0.02743716910481453,
-0.0016359601868316531,
0.010102779604494572,
-0.011702466756105423,
-0.02672147937119007,
-0.01599624752998352,
-0.03794730082154274,
0.018496617674827576,
-0.0030821149703115225,
-0.029692314565181732,
0.02882869727909565,
0.0044063422828912735,
0.05729135870933533,
0.049912504851818085,
0.04816576465964317,
-0.0014136278769001365,
0.021108977496623993,
0.013436336070299149,
0.019379908218979836,
0.023806555196642876,
-0.00030971370870247483,
0.0032533674966543913,
-0.05524100363254547,
0.00779224606230855,
0.010243309661746025,
0.006701755337417126,
-0.008808182552456856,
0.001107457559555769,
-0.014122458174824715,
-0.0005137654952704906,
0.07832329720258713,
-0.02697533182799816,
-0.007712186314165592,
0.011591315269470215,
0.0019177041249349713,
-0.0022920197807252407,
0.024053890258073807,
0.00903487578034401,
0.006799117662012577,
-0.021271217614412308,
0.0007457463652826846,
-0.006203083321452141,
0.006169544532895088,
0.0009600695921108127,
0.00036185653880238533,
0.02226727455854416,
-0.02323116920888424,
0.013540699146687984,
-0.017665745690464973,
0.0026989313773810863,
-0.011395236477255821,
0.02563648298382759,
-0.00477823568508029,
0.004144995007663965,
-0.02162705734372139,
0.039849404245615005,
-0.01872105710208416,
-0.014129533432424068,
-0.012131137773394585,
-0.01801062375307083,
0.030113570392131805,
-0.02034190483391285,
-0.03794173523783684,
-0.020751776173710823,
0.030450303107500076,
-0.014289178885519505,
0.0052420832216739655,
0.02599347196519375,
0.014306687749922276,
-0.034624356776475906,
-0.007820526137948036,
-0.0073458184488117695,
-0.02947997860610485,
0.0447683222591877,
0.041545502841472626,
0.018482204526662827,
-0.009482675231993198,
0.03255641460418701,
-0.03240111842751503,
0.0107496976852417,
0.041861288249492645,
0.02088385447859764,
-0.03612545132637024,
-0.038140084594488144,
0.008849282748997211,
0.0028208212461322546,
-0.01239500381052494,
-0.016241075471043587,
0.005859179422259331,
0.03522246703505516,
0.020113443955779076,
0.03682299703359604,
-0.029497338458895683,
0.012657259590923786,
0.02021813578903675,
-0.02850736305117607,
0.01755099929869175,
0.000027574611522140913,
0.022990737110376358,
-0.04732053726911545,
0.00903404876589775,
0.016279319301247597,
-0.049708422273397446,
0.005159401800483465,
-0.008528091944754124,
0.012034877203404903,
0.011944440193474293,
0.008128853514790535,
-0.012714236043393612,
-0.011174396611750126,
0.023207683116197586,
-0.013242431916296482,
0.08193348348140717,
0.00022154697217047215,
-0.016536341980099678,
0.009087533690035343,
-0.013401984237134457,
0.003127699252218008,
-0.0038694809190928936,
-0.024913504719734192,
0.0070345476269721985,
-0.010902335867285728,
-0.03093608096241951,
0.008342261426150799,
-0.00918593443930149,
-0.03014339879155159,
0.0026803635992109776,
0.03247860446572304,
-0.016977472230792046,
-0.007511682342737913,
0.020632483065128326,
-0.02750825136899948,
0.03091306798160076,
-0.007976804859936237,
0.029599148780107498,
-0.022862572222948074,
-0.0155221838504076,
0.02333732880651951,
-0.03174047917127609,
-0.025994908064603806,
0.019405152648687363,
-0.026145881041884422,
-0.02018716372549534,
0.005864471197128296,
0.03631274402141571,
-0.008700430393218994,
-0.012451203539967537,
-0.015035782940685749,
-0.007209728006273508,
-0.012384248897433281,
0.01883300393819809,
0.03637559711933136,
0.05780931934714317,
0.018102215602993965,
-0.01701253466308117,
-0.004825862590223551,
-0.011622422374784946,
0.009979329071938992,
-0.01525529008358717,
-0.036914367228746414,
-0.009428291581571102,
0.0165635384619236,
0.01203770563006401,
0.0019637146033346653,
-0.028091344982385635,
0.0002071672206511721,
0.012126527726650238,
-0.03957298770546913,
0.026111263781785965,
-0.03811057284474373,
-0.04439251497387886,
-0.0024072008673101664,
-0.04486728832125664,
0.0733998566865921,
0.010034944862127304,
-0.015541295520961285,
0.0008353906450793147,
-0.04614054039120674,
0.00226830062456429,
0.03695501387119293,
-0.006060354877263308,
-0.00499696983024478,
0.0006089709349907935,
-0.04975057393312454,
0.017046507447957993,
-0.035742565989494324,
0.006693040486425161,
0.008498983457684517,
0.021437499672174454,
-0.023447364568710327,
0.04421411082148552,
0.036544736474752426,
0.01722748577594757,
-0.033851079642772675,
-0.008084893226623535,
0.002589094452559948,
-0.007765431422740221,
-0.011915446259081364,
0.015792634338140488,
-0.029254013672471046,
-0.03605261817574501,
0.03725919499993324,
-0.017069324851036072,
0.006622985005378723,
0.03613176941871643,
0.01732000894844532,
0.01733790524303913,
0.02441597916185856,
-0.014326473698019981,
-0.012055701576173306,
-0.026079652830958366,
0.033395517617464066,
0.0031068529933691025,
-0.04426312819123268,
-0.007602486293762922,
-0.016597090288996696,
-0.0038706669583916664,
-0.04115404933691025,
-0.013980226591229439,
-0.00019947068358305842,
-0.025387560948729515,
0.025688380002975464,
0.01196790300309658,
-0.02005716599524021,
0.0028448321390897036,
-0.02142191119492054,
0.013670635409653187,
0.002853234065696597,
-0.000776259636040777,
-0.022076182067394257,
0.040771663188934326,
0.03504043072462082,
0.024407735094428062,
0.04618258774280548,
0.01007151510566473,
-0.0017760019982233644,
0.012144170701503754,
0.029409337788820267,
0.023894958198070526,
0.05459211766719818,
0.032041996717453,
-0.001351793296635151,
-0.028923237696290016,
0.030358655378222466,
-0.008260829374194145,
-0.03667771443724632,
-0.031110543757677078,
-0.04708462208509445,
-0.015291968360543251,
0.01877753809094429,
0.015494809485971928,
0.002712295390665531,
-0.006179497577250004,
0.009709140285849571,
-0.015777787193655968,
0.007074126973748207,
-0.03269262611865997,
0.025972027331590652,
0.043683722615242004,
0.02469559572637081,
0.02231425978243351,
0.003606339916586876,
-0.022365037351846695,
-0.02333204820752144,
-0.017035992816090584,
-0.009417560882866383,
0.011091910302639008,
-0.0014027641154825687,
-0.055137258023023605,
0.03664639964699745,
0.01507036853581667,
0.020801803097128868,
0.024876773357391357,
-0.006560089066624641,
0.007620042655616999,
-0.03393701836466789,
0.00322704017162323,
-0.05441597104072571,
0.007483710069209337,
-0.030770523473620415,
-0.021054593846201897,
-0.007671091705560684,
-0.002308334456756711,
0.014357366599142551,
-0.024271652102470398,
0.013778632506728172,
-0.0071195210330188274,
-0.025947613641619682,
-0.015611867420375347,
-0.0021996181458234787,
-0.00422043539583683,
0.026589693501591682,
-0.011404475197196007,
-0.03316028043627739,
-0.01428870391100645,
0.012144854292273521,
0.0017585753230378032,
0.009620294906198978,
0.025672024115920067,
-0.0017848550342023373,
0.01030869223177433,
-0.01987917721271515,
-0.02104152739048004,
-0.055970240384340286,
0.035477183759212494,
0.0037954002618789673,
-0.009307033382356167,
-0.05186983942985535,
-0.00670750392600894,
0.03836061805486679,
-0.03330579772591591,
-0.02533552423119545,
0.03461604192852974,
0.03655616566538811,
0.016388125717639923,
0.01633676514029503,
-0.03836197406053543,
0.014761393889784813,
-0.031469155102968216,
0.021227054297924042,
0.0240730419754982,
-0.01745050959289074,
0.03461482748389244,
-0.0017552421195432544,
-0.016787206754088402,
0.006643964909017086,
0.011319510638713837,
-0.03074268251657486,
0.03661177307367325,
-0.025860723108053207,
0.004621535073965788,
0.028177261352539062,
-0.0024860098492354155,
0.07779709994792938,
-0.04960199072957039,
-0.03891202434897423,
-0.0140845263376832,
0.008023527450859547,
-0.006996212061494589,
-0.028562119230628014,
-0.007086311932653189,
0.05872751399874687,
-0.028413599357008934,
0.022849133238196373,
0.009616387076675892,
-0.02956491708755493,
0.014111910946667194,
-0.019008241593837738,
0.006258274428546429,
-0.02847863920032978,
-0.014690794982016087,
0.017083093523979187,
-0.0015295199118554592,
-0.029998205602169037,
-0.005571614019572735,
0.05549493804574013,
-0.009843077510595322,
-0.01714671403169632,
-0.015193487517535686,
-0.03472151234745979,
-0.028440110385417938,
0.01963353157043457,
0.010906769894063473,
-0.016268620267510414,
-0.023514585569500923,
-0.00798521563410759,
0.015199403278529644,
-0.1383531391620636,
0.05373101681470871,
-0.016332779079675674,
0.03008907474577427,
0.003789398819208145,
-0.05907277390360832,
-0.005297442432492971,
0.016335824504494667,
0.007999781519174576,
0.03078557550907135,
-0.00028046692023053765,
0.06940396875143051,
0.014758062548935413,
0.020319705829024315,
0.0353676937520504,
-0.005558024626225233,
0.015121150761842728,
-0.005904165096580982,
0.04006083682179451,
0.007781890220940113,
0.02226056158542633,
0.003450504271313548,
-0.043071165680885315,
0.013026905246078968,
0.001679042587056756,
-0.011003779247403145,
-0.004315030761063099,
-0.0029736857395619154,
0.012484273873269558,
-0.016461389139294624,
-0.018334923312067986,
-0.015782363712787628,
-0.011478625237941742,
-0.002815073588863015,
0.00793289951980114,
-0.0028021102771162987,
0.025455458089709282,
0.05713917687535286,
0.05509278550744057,
-0.002892478834837675,
0.009010648354887962,
-0.023324783891439438,
0.0015186808304861188,
-0.013552773743867874,
0.051362328231334686,
-0.013665781356394291,
-0.020161492750048637,
-0.01880745217204094,
0.03187616541981697,
0.023172203451395035,
-0.007384388241916895,
0.031146766617894173,
-0.016732607036828995,
0.048853304237127304,
0.013418059796094894,
-0.02685619704425335,
-0.05442258343100548,
0.006569201126694679,
-0.029333705082535744,
0.001026465673930943,
0.02795175276696682,
0.06396274268627167,
0.026657527312636375,
-0.04493222385644913,
-0.037835121154785156,
-0.036806974560022354,
0.002534188563004136,
-0.027897607535123825,
-0.02382907085120678,
0.004885692149400711,
0.006706532556563616,
-0.005227194167673588,
-0.025848165154457092,
0.013035565614700317,
-0.03130226582288742,
0.024951009079813957,
0.004295738413929939,
-0.029602782800793648,
-0.0009595358278602362,
0.006822614930570126,
-0.01964755356311798,
-0.049812622368335724,
0.05869225785136223,
-0.01237128023058176,
-0.00939853023737669,
-0.019769178703427315,
0.00498183025047183,
-0.03461047634482384,
-0.0015588774112984538,
-0.024188295006752014,
-0.007077432703226805,
0.0025055205915123224,
0.027036290615797043,
-0.022288333624601364,
-0.031017793342471123,
0.020068850368261337,
0.020314857363700867,
-0.011028592474758625,
-0.023368215188384056,
-0.00502753583714366,
-0.02414226159453392,
-0.004467733670026064,
-0.0006980460602790117,
0.022643225267529488,
-0.040758874267339706,
-0.030262954533100128,
-0.023874228820204735,
-0.01850748620927334,
-0.011015466414391994,
-0.0009920367738232017,
-0.02375633828341961,
0.021638454869389534,
0.0025200145319104195,
0.013268418610095978,
-0.037095632404088974,
0.005719735287129879,
0.021294910460710526
] |
8a85a524c6381c0f4e277dd284d072a8b41daaac | 3,427 | py | Python | queue/animal_queue.py | cozek/code-practice | bf3098dbeb502cab2e22ce7ea73c2aa05a3caf80 | [
"MIT"
] | null | null | null | queue/animal_queue.py | cozek/code-practice | bf3098dbeb502cab2e22ce7ea73c2aa05a3caf80 | [
"MIT"
] | null | null | null | queue/animal_queue.py | cozek/code-practice | bf3098dbeb502cab2e22ce7ea73c2aa05a3caf80 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from typing import Any, Union
class Animal:
def __init__(self, name: str) -> None:
self.name = name
def set_order(self, order: int) -> None:
self.order = order
def peek_order(self) -> int:
return self.order
def __str__(self) -> str:
return f"{self.name}"
class Node:
def __init__(self, data: Any):
self.data = data
self.next_node = None
class LinkedList:
def __init__(self) -> None:
self.head = None
self.tail = None
def __str__(self) -> str:
current = self.head
string = f""
while current.next_node is not None:
string += f"{current.data} -> "
current = current.next_node
return string + "END"
def is_empty(self) -> bool:
if self.head is None:
return True
else:
return False
def insert(self, item: Any) -> None:
if self.is_empty():
self.head = Node(item)
self.tail = self.head
else:
new_node = Node(item)
self.tail.next_node = new_node
self.tail = self.tail.next_node
def remove(self) -> Any:
if self.head is None:
raise ("Empty LinkedList!")
else:
data = self.head.data
self.head = self.head.next_node
return data
def peak(self):
return self.head.data
class Dog(Animal):
def __init__(self, name: str):
super().__init__(name)
class Cat(Animal):
def __init__(self, name: str):
super().__init__(name)
class AnimalQueue:
def __init__(self) -> None:
self.dogs = LinkedList()
self.cats = LinkedList()
self.order = 0
def enqueue(self, animal: Union[Dog, Cat]) -> None:
if not isinstance(animal, (Dog, Cat)):
raise Exception("Expected Dog or Cat!")
else:
animal.set_order(self.order)
self.order += 1
if isinstance(animal, Dog):
self.dogs.insert(animal)
elif isinstance(animal, Cat):
self.cats.insert(animal)
def dequeAny(self) -> Union[Dog, Cat]:
if self.dogs.is_empty():
return self.dequeCat()
elif self.cats.is_empty():
return self.dequeDog()
if self.dogs.head.data.peek_order() > self.cats.head.data.peek_order():
return self.dequeCat()
else:
return self.dequeDog()
def print_cats(self) -> str:
string = ""
cat = self.cats.head
while cat is not None:
string += f"{cat.data.name} {cat.data.peek_order()} | "
cat = cat.next_node
return string
def dequeDog(self) -> Dog:
return self.dogs.remove()
def dequeCat(self) -> Cat:
return self.cats.remove()
def main():
q = AnimalQueue()
dogs = [Dog("d1"), Dog("d2"), Dog("d3")]
cats = [Cat("c1"), Cat("c2"), Cat("c3")]
both = []
while cats != []:
both.append(cats.pop())
both.append(dogs.pop())
[q.enqueue(animal) for animal in both]
string = ""
for anim in both:
string += f"{anim.name} {anim.order} | "
print(string)
# print(q.print_cats())
get = q.dequeDog()
print(get.order,get.name)
get = q.dequeAny()
print(get.order,get.name)
if __name__ == "__main__":
main()
| 24.133803 | 79 | 0.541873 | 1 | 1.8621 | [
0.0015542084584012628,
0.02566409669816494,
0.006914663128554821,
-0.0005213943659327924,
0.005112112034112215,
-0.0023743053898215294,
-0.010320915840566158,
0.003351768711581826,
-0.006602325942367315,
0.0017937177326530218,
0.00146506039891392,
0.0055906325578689575,
0.007258761674165726,
-0.016290348023176193,
0.0005155121325515211,
0.016741951927542686,
-0.052939899265766144,
0.0010403500637039542,
-0.002936074510216713,
0.0015793389175087214,
-0.007493703160434961,
0.009741325862705708,
0.008802956901490688,
0.0069284867495298386,
0.007892359979450703,
0.0012927585048601031,
0.008306477218866348,
0.003382761962711811,
-0.008253897540271282,
-0.005102963652461767,
-0.0006322774570435286,
-0.0008256513974629343,
-0.005171985365450382,
-0.009635809808969498,
0.006117839366197586,
-0.0029982426203787327,
-0.0007922538206912577,
-0.01909988559782505,
0.012578429654240608,
-0.004144936800003052,
-0.005727672018110752,
-0.015667878091335297,
-0.00008750030974624678,
0.004932986572384834,
-0.008657935075461864,
0.001922168885357678,
-0.004801854956895113,
0.0003905321646016091,
-0.010639735497534275,
0.005889945197850466,
-0.009655154310166836,
0.006696625612676144,
0.012398735620081425,
0.003630052786320448,
-0.006185202393680811,
-0.0070110345259308815,
0.012603453360497952,
-0.0004947014385834336,
-0.010350408032536507,
-0.0004601921536959708,
-0.0018296429188922048,
-0.0024731182493269444,
0.005213048774749041,
0.0028412495739758015,
-0.016970248892903328,
-0.007311496417969465,
-0.004498504102230072,
0.0032645673491060734,
-0.0018108702497556806,
0.005307813175022602,
-0.000074141236837022,
-0.0017295859288424253,
0.0058815195225179195,
0.005194521974772215,
0.0032377245370298624,
-0.002066226676106453,
-0.001995899947360158,
0.0008446543361060321,
0.007966263219714165,
0.003905130783095956,
0.0025625796988606453,
-0.007561010774224997,
0.0072823879308998585,
0.01015300489962101,
0.014042090624570847,
0.006712356116622686,
0.018481355160474777,
-0.010991264134645462,
0.045315731316804886,
0.007533614989370108,
-0.008104194886982441,
0.002527851378545165,
-0.00869016069918871,
-0.001900009112432599,
-0.0035307661164551973,
-0.026358671486377716,
0.0017159326234832406,
-0.004020346328616142,
-0.002457892755046487,
0.0036376062780618668,
-0.000021504583855858073,
0.007455192971974611,
-0.001115605584345758,
-0.0021756968926638365,
-0.009003841318190098,
0.011213305406272411,
-0.008610228076577187,
-0.0033468627370893955,
0.006403426174074411,
0.002713090507313609,
-0.010655593127012253,
-0.0008397067431360483,
0.0017396826297044754,
-0.012149027548730373,
0.0015113720437511802,
0.0013095540925860405,
-0.004510065540671349,
0.054218292236328125,
0.0007325535407289863,
0.004639675375074148,
-0.0046187699772417545,
0.00031233744812197983,
0.0006596227176487446,
0.004404646344482899,
0.010392001830041409,
-0.0041099474765360355,
0.009913887828588486,
0.00577993830665946,
0.0017698677256703377,
0.00834424514323473,
-0.0018846455495804548,
0.006942104548215866,
-0.005809409078210592,
-0.0003448881034273654,
-0.00012490028166212142,
-0.008260143920779228,
0.006519463378936052,
-0.0016003274358808994,
-0.004804189316928387,
-0.00008654874545754865,
-0.0018045762553811073,
-0.01067103911191225,
0.002438180847093463,
-0.00492457440122962,
0.0036606115754693747,
-0.010683598928153515,
-0.0027247038669884205,
-0.001602385425940156,
-0.004164392594248056,
0.001257272087968886,
0.010222385637462139,
0.0037650500889867544,
0.0023095582146197557,
-0.005127377808094025,
-0.008491241373121738,
0.0003570086264517158,
-0.0039839232340455055,
0.0019904710352420807,
0.007480091881006956,
0.004578868392854929,
-0.010191348381340504,
-0.002305496484041214,
0.0007218155078589916,
0.0016764284810051322,
-0.0005927883903495967,
0.005030045751482248,
-0.008713971823453903,
0.007032525260001421,
-0.00019530100689735264,
0.0029745008796453476,
0.012620770372450352,
-0.004440667107701302,
-0.0005362465162761509,
0.0007907046820037067,
0.001001822529360652,
0.0007873448194004595,
0.003505907254293561,
0.009302742779254913,
-0.004690058529376984,
-0.0040360321290791035,
0.003411370562389493,
0.004042269196361303,
0.008981717750430107,
0.00521309208124876,
-0.003929088823497295,
0.0022384191397577524,
-0.005406802985817194,
-0.0016455136938020587,
0.00720693776383996,
-0.004659051075577736,
0.006115783471614122,
0.004857754800468683,
-0.013487971387803555,
-0.00919343065470457,
-0.0006860771682113409,
-0.00891024712473154,
0.0003849714412353933,
0.014181246049702168,
0.010811409913003445,
-0.0037137793842703104,
0.0011910866014659405,
-0.010676240548491478,
0.0017910553142428398,
0.00839292537420988,
0.0006824291194789112,
-0.011597840115427971,
-0.957817792892456,
0.006028235424309969,
0.0035565325524657965,
-0.001252211513929069,
0.005784804467111826,
0.002847611904144287,
0.0036566623020917177,
0.00358907924965024,
0.014530587941408157,
-0.010209573432803154,
-0.006394353229552507,
-0.010675066150724888,
-0.01141326129436493,
-0.0009351695189252496,
-0.0072832489386200905,
-0.0034136122558265924,
-0.006626636255532503,
-0.00699859531596303,
-0.00297303544357419,
-0.0019533862359821796,
-0.0013107432750985026,
0.007222942542284727,
-0.0010221874108538032,
0.005750896409153938,
0.003248925320804119,
0.002576452447101474,
-0.004283256363123655,
-0.0014389387797564268,
-0.0016711250646039844,
-0.0015231120632961392,
-0.007012718357145786,
-0.014499694108963013,
-0.003975267987698317,
-0.0009924304904416203,
0.010791652835905552,
0.002272415906190872,
0.0074885147623717785,
-0.0028044364880770445,
0.0009272408788092434,
-0.00839891005307436,
0.00396865326911211,
0.0006595209706574678,
0.0035502174869179726,
-0.029626626521348953,
0.001672633457928896,
0.00045570757356472313,
-0.010779797099530697,
0.00785271730273962,
0.0022345869801938534,
-0.0005891263717785478,
-0.0028997098561376333,
-0.00610296381637454,
0.009327581152319908,
-0.006754700560122728,
0.0049241697415709496,
-0.003453595098108053,
-0.007752268109470606,
-0.0022130224388092756,
-0.007572618313133717,
0.0013997936621308327,
0.004467571619898081,
-0.0037081120535731316,
-0.004350841976702213,
-0.004562846850603819,
0.0028672083280980587,
0.0016819299198687077,
0.002949960995465517,
-0.019033830612897873,
-0.006899538449943066,
-0.0010634098434820771,
0.0037880397867411375,
-0.001774578238837421,
-0.005015527363866568,
0.004872590769082308,
-0.007616828195750713,
0.005806288681924343,
0.002541904803365469,
0.001073650666512549,
-0.011807889677584171,
-0.00014870175800751895,
-0.009377006441354752,
-0.006633772514760494,
0.0019112336449325085,
-0.005329436622560024,
-0.004107488784939051,
0.0007784171612001956,
0.0033682354260236025,
0.006711497902870178,
-0.0038862000219523907,
0.0031222302932292223,
0.009986394084990025,
-0.0041820514015853405,
-0.010609397664666176,
0.006104827392846346,
0.006417895667254925,
0.00010928398842224851,
-0.0018697220366448164,
0.0057935817167162895,
0.008748741820454597,
0.008262190967798233,
0.0027996539138257504,
0.0047707632184028625,
0.001913478714413941,
0.00911736860871315,
0.000003253486511312076,
0.0025465404614806175,
-0.001968014519661665,
-0.00011562753206817433,
-0.0042033009231090546,
0.0009726794669404626,
-0.005376191809773445,
-0.002303946763277054,
-0.012515416368842125,
-0.010393111035227776,
-0.004702282603830099,
0.001975845778360963,
0.0016246674349531531,
-0.00420454703271389,
-0.0013802382163703442,
0.0011161868460476398,
0.009286118671298027,
0.0006493912660516798,
-0.005511795170605183,
-0.00001920156501000747,
0.003166574751958251,
-0.0060715279541909695,
0.015143652446568012,
-0.011106092482805252,
0.0071668727323412895,
0.000580074090976268,
-0.016088733449578285,
0.0060814679600298405,
0.010540461167693138,
-0.010964550077915192,
0.0028740514535456896,
0.0014403495006263256,
0.0028952830471098423,
0.00022714711667504162,
-0.0029782347846776247,
-0.0047953748144209385,
-0.017466118559241295,
0.0003364712465554476,
0.01982876844704151,
0.0012690831208601594,
0.010159837082028389,
0.012228126637637615,
-0.004021377302706242,
0.0029004369862377644,
0.004217053763568401,
0.0013905733358114958,
0.013801179826259613,
-0.008596278727054596,
-0.00035744631895795465,
0.0024848314933478832,
-0.0050985487177968025,
0.0015510338125750422,
0.005516252480447292,
0.00540701812133193,
-0.003703834256157279,
0.00318373111076653,
-0.00544118182733655,
-0.0037468960508704185,
-0.016138456761837006,
-0.0026828551199287176,
0.00803624838590622,
-0.004133168142288923,
0.003852738765999675,
-0.011368031613528728,
0.005903081968426704,
0.006630527321249247,
0.0036794671323150396,
-0.001490963390097022,
0.0008619831060059369,
0.005953378975391388,
0.011585024185478687,
-0.005964344367384911,
0.0019079982303082943,
0.003970142919570208,
-0.00047250374336726964,
0.0007566474378108978,
0.00621635839343071,
-0.00769347557798028,
-0.005534980911761522,
0.002085585379973054,
0.0046188621781766415,
0.00008318395703099668,
-0.0031481727492064238,
-0.009407991543412209,
-0.004170007538050413,
0.003602229757234454,
-0.0060708774253726006,
0.004838640335947275,
-0.0002737640170380473,
0.004051486495882273,
-0.006339783314615488,
-0.0002736411988735199,
-0.00233265059068799,
-0.011225294321775436,
0.011213233694434166,
-0.0034892070107162,
0.0029747923836112022,
0.013138379901647568,
0.005628242623060942,
-0.01328621618449688,
0.005877475254237652,
0.008492404595017433,
-0.005290934816002846,
0.004704111721366644,
0.00471130758523941,
-0.006757359951734543,
-0.022803185507655144,
-0.0020483452826738358,
-0.012790527194738388,
0.006664489395916462,
-0.003553497837856412,
0.004311124794185162,
-0.008882299065589905,
0.006919939070940018,
0.006341114640235901,
-0.012971773743629456,
-0.006333524826914072,
-0.00843359250575304,
0.0073321121744811535,
-0.0005573841626755893,
-0.002787090139463544,
-0.0033842974808067083,
-0.0016304177697747946,
-0.0008236695430241525,
-0.0025667964946478605,
-0.0026342440396547318,
0.0059444536454975605,
0.002529018558561802,
-0.0039934199303388596,
0.0026188422925770283,
-0.0032779257744550705,
0.0011800439096987247,
0.0019490743288770318,
-0.009048955515027046,
0.0036615217104554176,
0.0038727568462491035,
-0.003183567663654685,
-0.002451231237500906,
0.0016610648017376661,
-0.003359478199854493,
-0.006581016816198826,
-0.012209205888211727,
-0.0028548187110573053,
-0.00410741800442338,
-0.0040018451400101185,
-0.011727641336619854,
-0.002902688691392541,
-0.008878011256456375,
0.006294168531894684,
-0.007928697392344475,
0.008697225712239742,
0.006852620281279087,
-0.004468689206987619,
0.007132300641387701,
-0.000438377057434991,
0.0037872774992138147,
0.001493183895945549,
0.005984130315482616,
-0.00011825538967968896,
-0.005560725927352905,
-0.007900568656623363,
0.012486351653933525,
-0.009241974912583828,
-0.00048484065337106586,
0.014146738685667515,
0.00541329151019454,
0.009561254642903805,
0.0017988939071074128,
-0.00045437109656631947,
0.0028184172697365284,
0.007325352635234594,
-0.013249892741441727,
0.004614362958818674,
-0.003866614541038871,
0.0003982375783380121,
0.005179021041840315,
-0.003848783439025283,
0.0009743025875650346,
0.007964431308209896,
-0.00031209050212055445,
-0.006309775169938803,
-0.0015373858623206615,
0.0029484748374670744,
0.0036128563806414604,
-0.011793567799031734,
-0.001310284249484539,
-0.005405086558312178,
-0.005645356606692076,
-0.002893782453611493,
-0.0034254142083227634,
0.00022218606318347156,
0.004394478630274534,
-0.0037305327132344246,
0.005659147631376982,
0.0030812330078333616,
-0.004180363845080137,
0.013139196671545506,
-0.0042283120565116405,
-0.003984131850302219,
0.004526335746049881,
0.003282784018665552,
-0.0028736682143062353,
-0.00606552604585886,
-0.0024076520930975676,
0.0017356041353195906,
0.006337434984743595,
-0.0026312798727303743,
-0.005014798138290644,
-0.002090706955641508,
0.0004930708673782647,
-0.00865725614130497,
0.0007298938580788672,
0.011991412378847599,
-0.004802338313311338,
0.006950849201530218,
-0.0015262466622516513,
-0.006711332593113184,
-0.015895336866378784,
0.05389368161559105,
0.00023157910618465394,
0.004091657232493162,
0.004319716244935989,
-0.007448986172676086,
-0.00045969843631610274,
-0.0003864961618091911,
0.008226036094129086,
-0.006193218287080526,
-0.008530070073902607,
0.008965541608631611,
-0.0035652650985866785,
0.004461968317627907,
0.0029260008595883846,
-0.000941146572586149,
0.015389589592814445,
-0.0032647564075887203,
-0.018415207043290138,
-0.014577310532331467,
0.007784615270793438,
-0.0024264040403068066,
-0.008099627681076527,
0.009326530620455742,
-0.0029374738223850727,
-0.003670693840831518,
0.001247923937626183,
0.006879378110170364,
-0.0010613161139190197,
0.0015475836116820574,
-0.0037105560768395662,
-0.0016423664055764675,
-0.0002457658411003649,
0.004040699452161789,
0.005813293624669313,
0.007014766801148653,
-0.0021095331758260727,
0.005145341623574495,
-0.0028541842475533485,
-0.0012680450454354286,
-0.0033919517882168293,
0.0043576559983193874,
0.008847824297845364,
-0.001094375504180789,
-0.0029659054707735777,
0.003592850174754858,
0.005365183111280203,
0.003964809235185385,
0.0118316151201725,
0.0004552507889457047,
-0.0050893803127110004,
0.009225860238075256,
0.007167683448642492,
-0.0010192852932959795,
0.008362488821148872,
-0.002515068044885993,
0.005740405526012182,
0.0006760393735021353,
-0.006972144357860088,
-0.014097930863499641,
-0.002329780487343669,
0.007610684260725975,
0.007223698776215315,
-0.002523481845855713,
0.00033205290674231946,
-0.0024875830858945847,
-0.0009308066801168025,
-0.005466524511575699,
-0.008503426797688007,
-0.003644730895757675,
0.0010255106026306748,
0.00546647422015667,
0.07084012031555176,
-0.005459144711494446,
-0.0030132581014186144,
-0.008960635401308537,
-0.0010442837374284863,
-0.002890641102567315,
-0.001347118872217834,
-0.0008082016720436513,
-0.0005783213418908417,
0.0021242755465209484,
0.0010434779105708003,
-0.00841687060892582,
-0.010404877364635468,
0.0020427904091775417,
0.00044351149699650705,
-0.0029816783498972654,
0.005709378980100155,
0.006899480242282152,
-0.009389047510921955,
0.0021886108443140984,
-0.010771245695650578,
-0.0018015858950093389,
-0.003136327490210533,
-0.010481663048267365,
-0.0037313837092369795,
-0.005309314467012882,
0.0035922047682106495,
0.003495435928925872,
0.005043098237365484,
-0.00632941909134388,
0.005915905348956585,
-0.00139411143027246,
0.001066332682967186,
-0.0036392041947692633,
0.0014521045377478004,
-0.007504771929234266,
0.007531843613833189,
0.0017647916683927178,
-0.012054730206727982,
-0.0038550125900655985,
-0.0019322825828567147,
0.0002158670249627903,
-0.004933342337608337,
0.0048792799934744835,
-0.0022679942194372416,
0.005995605606585741,
-0.00264189881272614,
0.00012294886982999742,
-0.006277482025325298,
0.003635217435657978,
-0.013153805397450924,
0.00379200023598969,
-0.17858542501926422,
0.009703886695206165,
0.0025242005940526724,
-0.006247144658118486,
-0.0029879885260015726,
-0.015505634248256683,
-0.007134960498660803,
0.003788038855418563,
0.009799939580261707,
0.0011730818077921867,
-0.0016434219432994723,
-0.0024712122976779938,
0.006406760308891535,
0.0045202565379440784,
-0.0014338274486362934,
-0.005977019667625427,
0.004055038094520569,
-0.004327948670834303,
-0.0002251693222206086,
0.0035393473226577044,
0.005212896969169378,
0.010637586005032063,
0.001388599630445242,
0.0016702142311260104,
-0.001445077476091683,
-0.004596928134560585,
0.006903504952788353,
-0.002900260966271162,
0.005791040603071451,
-0.011703518219292164,
-0.0029504592530429363,
-0.005725359544157982,
-0.004306774586439133,
0.002668759087100625,
0.005716359242796898,
-0.0012133768759667873,
0.007598998490720987,
0.001677831867709756,
-0.00820166990160942,
0.007649936713278294,
-0.007751571014523506,
0.028604675084352493,
0.004266916774213314,
0.008289668709039688,
0.0021363873966038227,
-0.004609080031514168,
-0.0036795656196773052,
0.008791196160018444,
0.0019095480674877763,
0.011768304742872715,
-0.014129066839814186,
-0.0038357225712388754,
0.0023066147696226835,
0.01883797161281109,
-0.005341670010238886,
-0.010544519871473312,
-0.006734584458172321,
-0.00399026507511735,
0.0021322767715901136,
0.009087597951292992,
0.010930069722235203,
-0.0033402841072529554,
0.00750324223190546,
-0.0012488954234868288,
-0.022275986149907112,
0.0024434581864625216,
-0.0047905538231134415,
-0.007521850056946278,
-0.0001537099597044289,
0.006695902440696955,
0.01002981886267662,
-0.0015730434097349644,
0.00286486791446805,
0.0007739077555015683,
0.005826068110764027,
-0.0012723995605483651,
0.006075412966310978,
-0.000646592176053673,
0.004496730398386717,
-0.010355840437114239,
0.007755761034786701,
-0.008440817706286907,
-0.0023204905446618795,
0.0005952268256805837,
-0.003917995374649763,
0.011781224980950356,
0.004967883694916964,
-0.0018452475778758526,
-0.0024070213548839092,
-0.008767629973590374,
-0.003017508191987872,
0.0027734260074794292,
0.0020005013793706894,
-0.009326240047812462,
0.0024461301509290934,
-0.0010767991188913584,
0.0036615044809877872,
0.006335356272757053,
-0.008741296827793121,
0.005427599418908358,
0.006699411664158106,
-0.005940964911133051,
0.0026731048710644245,
-0.005414387211203575,
0.0028208165895193815,
0.005423892289400101,
-0.007343636825680733,
-0.006073071621358395,
0.0027759301010519266,
-0.00653883209452033,
-0.006547980941832066,
0.006394245196133852,
-0.008537017740309238,
-0.00786712858825922,
-0.001804644358344376,
-0.012039023451507092,
0.0012640878558158875
] |
8a85f7a1837485544e723eea52a8cc5f16480c6c | 6,816 | py | Python | ophyd/areadetector/detectors.py | NSLS-II/ophyd | d5fc722eef4d3d83845b1d523004302ec3aadb78 | [
"BSD-3-Clause"
] | 16 | 2015-05-20T20:48:25.000Z | 2019-04-24T21:12:59.000Z | ophyd/areadetector/detectors.py | NSLS-II/ophyd | d5fc722eef4d3d83845b1d523004302ec3aadb78 | [
"BSD-3-Clause"
] | 594 | 2015-01-05T21:55:21.000Z | 2019-05-10T02:05:24.000Z | ophyd/areadetector/detectors.py | NSLS-II/ophyd | d5fc722eef4d3d83845b1d523004302ec3aadb78 | [
"BSD-3-Clause"
] | 34 | 2015-01-23T19:50:58.000Z | 2019-05-07T05:38:57.000Z | # vi: ts=4 sw=4
'''AreaDetector Devices
`areaDetector`_ detector abstractions
.. _areaDetector: https://areadetector.github.io/master/index.html
'''
import warnings
from .base import (ADBase, ADComponent as C)
from . import cam
__all__ = ['DetectorBase',
'AreaDetector',
'AdscDetector',
'Andor3Detector',
'AndorDetector',
'BrukerDetector',
'DexelaDetector',
'EmergentVisionDetector',
'EigerDetector',
'FirewireLinDetector',
'FirewireWinDetector',
'GreatEyesDetector',
'LightFieldDetector',
'Mar345Detector',
'MarCCDDetector',
'PSLDetector',
'PerkinElmerDetector',
'PICamDetector',
'PilatusDetector',
'PixiradDetector',
'PointGreyDetector',
'ProsilicaDetector',
'PvcamDetector',
'RoperDetector',
'SimDetector',
'URLDetector',
'UVCDetector',
'Xspress3Detector'
]
class DetectorBase(ADBase):
"""
The base class for the hardware-specific classes that follow.
Note that Plugin also inherits from ADBase.
This adds some AD-specific methods that are not shared by the plugins.
"""
_default_configuration_attrs = (ADBase._default_configuration_attrs +
('cam', ))
def generate_datum(self, key, timestamp, datum_kwargs=None):
"""
Notify plugins of acquisition being complete.
When a new acquisition is started, this method is called with a
key which is a label like 'light', 'dark', or 'gain8'.
It in turn calls ``generate_datum`` on all of the plugins that have
that method.
File plugins are identified by searching for a
:meth:`~ophyd.areadetector.filestore_mixins.FileStoreBase.generate_datum`
method that must have the signature ::
def generate_datum(key: str, timestamp: float, datum_kwargs: dict):
...
Parameters
----------
key : str
The label for the datum that should be generated
timestamp : float
The time of the trigger
datum_kwargs : Dict[str, Any], optional
Any datum kwargs that should go to all children.
"""
if datum_kwargs is None:
datum_kwargs = {}
file_plugins = [s for s in self._signals.values() if
hasattr(s, 'generate_datum')]
for p in file_plugins:
if p.enable.get():
p.generate_datum(key, timestamp, datum_kwargs)
def dispatch(self, key, timestamp):
warnings.warn(
".dispatch is deprecated, use .generate_datum instead",
stacklevel=2
)
return self.generate_datum(key, timestamp, {})
dispatch.__doc__ = generate_datum.__doc__
def make_data_key(self):
source = 'PV:{}'.format(self.prefix)
# This shape is expected to match arr.shape for the array.
shape = (self.cam.num_images.get(),
self.cam.array_size.array_size_y.get(),
self.cam.array_size.array_size_x.get())
return dict(shape=shape, source=source, dtype='array',
external='FILESTORE:')
def collect_asset_docs(self):
file_plugins = [s for s in self._signals.values() if
hasattr(s, 'collect_asset_docs')]
for p in file_plugins:
yield from p.collect_asset_docs()
class AreaDetector(DetectorBase):
cam = C(cam.AreaDetectorCam, 'cam1:')
class SimDetector(DetectorBase):
_html_docs = ['simDetectorDoc.html']
cam = C(cam.SimDetectorCam, 'cam1:')
class AdscDetector(DetectorBase):
_html_docs = ['adscDoc.html']
cam = C(cam.AdscDetectorCam, 'cam1:')
class AndorDetector(DetectorBase):
_html_docs = ['andorDoc.html']
cam = C(cam.AndorDetectorCam, 'cam1:')
class Andor3Detector(DetectorBase):
_html_docs = ['andor3Doc.html']
cam = C(cam.Andor3DetectorCam, 'cam1:')
class BrukerDetector(DetectorBase):
_html_docs = ['BrukerDoc.html']
cam = C(cam.BrukerDetectorCam, 'cam1:')
class DexelaDetector(DetectorBase):
_html_docs = ['DexelaDoc.html']
cam = C(cam.DexelaDetectorCam, 'cam1:')
class EmergentVisionDetector(DetectorBase):
_html_docs = ['EVTDoc.html']
cam = C(cam.EmergentVisionDetectorCam, 'cam1:')
class EigerDetector(DetectorBase):
_html_docs = ['EigerDoc.html']
cam = C(cam.EigerDetectorCam, 'cam1:')
class FirewireLinDetector(DetectorBase):
_html_docs = ['FirewireWinDoc.html']
cam = C(cam.FirewireLinDetectorCam, 'cam1:')
class FirewireWinDetector(DetectorBase):
_html_docs = ['FirewireWinDoc.html']
cam = C(cam.FirewireWinDetectorCam, 'cam1:')
class GreatEyesDetector(DetectorBase):
_html_docs = [] # the documentation is not public
cam = C(cam.GreatEyesDetectorCam, 'cam1:')
class LightFieldDetector(DetectorBase):
_html_docs = ['LightFieldDoc.html']
cam = C(cam.LightFieldDetectorCam, 'cam1:')
class Mar345Detector(DetectorBase):
_html_docs = ['Mar345Doc.html']
cam = C(cam.Mar345DetectorCam, 'cam1:')
class MarCCDDetector(DetectorBase):
_html_docs = ['MarCCDDoc.html']
cam = C(cam.MarCCDDetectorCam, 'cam1:')
class PerkinElmerDetector(DetectorBase):
_html_docs = ['PerkinElmerDoc.html']
cam = C(cam.PerkinElmerDetectorCam, 'cam1:')
class PSLDetector(DetectorBase):
_html_docs = ['PSLDoc.html']
cam = C(cam.PSLDetectorCam, 'cam1:')
class PICamDetector(DetectorBase):
_html_docs = ['PICamDoc.html']
cam = C(cam.PICamDetectorCam, 'cam1:')
class PilatusDetector(DetectorBase):
_html_docs = ['pilatusDoc.html']
cam = C(cam.PilatusDetectorCam, 'cam1:')
class PixiradDetector(DetectorBase):
_html_docs = ['PixiradDoc.html']
cam = C(cam.PixiradDetectorCam, 'cam1:')
class PointGreyDetector(DetectorBase):
_html_docs = ['PointGreyDoc.html']
cam = C(cam.PointGreyDetectorCam, 'cam1:')
class ProsilicaDetector(DetectorBase):
_html_docs = ['prosilicaDoc.html']
cam = C(cam.ProsilicaDetectorCam, 'cam1:')
class PvcamDetector(DetectorBase):
_html_docs = ['pvcamDoc.html']
cam = C(cam.PvcamDetectorCam, 'cam1:')
class RoperDetector(DetectorBase):
_html_docs = ['RoperDoc.html']
cam = C(cam.RoperDetectorCam, 'cam1:')
class URLDetector(DetectorBase):
_html_docs = ['URLDoc.html']
cam = C(cam.URLDetectorCam, 'cam1:')
class UVCDetector(DetectorBase):
_html_docs = ['UVCDoc.html']
cam = C(cam.UVCDetectorCam, 'cam1:')
class Xspress3Detector(DetectorBase):
_html_docs = ['Xspress3Doc.html']
cam = C(cam.Xspress3DetectorCam, 'det1:')
| 27.264 | 81 | 0.639965 | 1 | 1.9941 | [
0.0016349453944712877,
0.07964114099740982,
-0.021721666678786278,
-0.010939628817141056,
-0.00188722915481776,
-0.029907716438174248,
0.024465249851346016,
-0.0032779709435999393,
-0.06660642474889755,
0.009138231165707111,
0.04144763946533203,
0.048414718359708786,
0.02436741441488266,
0.0034077363088726997,
-0.025629740208387375,
-0.022483736276626587,
0.05788639560341835,
-0.0071001313626766205,
-0.03597063198685646,
-0.01789751835167408,
-0.0143774738535285,
-0.005850651767104864,
-0.021710406988859177,
-0.010110783390700817,
0.007573095615953207,
0.054916560649871826,
0.020319361239671707,
-0.016126738861203194,
-0.005738281179219484,
-0.013832923956215382,
-0.014112879522144794,
-0.05982184782624245,
-0.06215529516339302,
0.001083114417269826,
-0.028522005304694176,
0.017275338992476463,
0.022530848160386086,
-0.05463056266307831,
0.00778771610930562,
-0.0010381395695731044,
-0.028892390429973602,
0.011692535132169724,
0.017144300043582916,
-0.09136466681957245,
0.054092466831207275,
0.006347517482936382,
0.0009204179514199495,
-0.043834295123815536,
0.004510726314038038,
-0.018254218623042107,
-0.013346933759748936,
0.022824816405773163,
-0.005631726700812578,
0.0025902229826897383,
0.025651762261986732,
-0.0011611017398536205,
0.043598294258117676,
0.006180322263389826,
-0.014071259647607803,
0.046018533408641815,
-0.0060820747166872025,
0.029544658958911896,
0.0004485076351556927,
0.034134916961193085,
-0.030975256115198135,
-0.007559636142104864,
-0.0010086407419294119,
-0.003706404473632574,
-0.048448994755744934,
0.006821536924690008,
0.03428182005882263,
0.0183174517005682,
0.009717469103634357,
0.04503680020570755,
-0.006432448048144579,
0.026184068992733955,
-0.02684677764773369,
-0.042000770568847656,
-0.03173185512423515,
-0.0164044126868248,
0.0004123387043364346,
0.04740625247359276,
-0.003679786343127489,
-0.05542526766657829,
0.03149782866239548,
-0.05809779465198517,
0.06455867737531662,
0.001517054857686162,
0.05554015189409256,
0.004558656830340624,
-0.03262419253587723,
0.02265428937971592,
-0.04789070785045624,
-0.017738498747348785,
-0.005649146623909473,
-0.023721862584352493,
0.007349718827754259,
-0.00072768289828673,
-0.062175992876291275,
-0.008274104446172714,
0.03899051249027252,
-0.0021738873329013586,
0.06507675349712372,
-0.023382186889648438,
-0.01879524067044258,
-0.013355603441596031,
-0.034318771213293076,
-0.0034485384821891785,
0.005781068932265043,
0.018332229927182198,
0.04966345429420471,
0.023098234087228775,
0.04465584084391594,
-0.026143459603190422,
-0.053101733326911926,
0.018712162971496582,
-0.011585862375795841,
0.03492215648293495,
-0.006678965408354998,
0.047539908438920975,
0.028084205463528633,
0.013262717053294182,
0.011141604743897915,
0.024742182344198227,
0.03245262801647186,
0.09201150387525558,
-0.016165588051080704,
-0.001863884273916483,
-0.0016203738050535321,
0.011346726678311825,
0.02154547907412052,
0.027327176183462143,
0.009612428024411201,
-0.05501337721943855,
-0.011338543146848679,
0.03125239908695221,
-0.017145929858088493,
0.010902255773544312,
-0.06309099495410919,
0.026501962915062904,
-0.014353563077747822,
0.0019678042735904455,
0.006756830494850874,
0.009037039242684841,
0.005367235746234655,
-0.0565715916454792,
-0.046970829367637634,
0.05311298742890358,
-0.00359296053647995,
-0.03795187920331955,
-0.0412304662168026,
0.06545525044202805,
0.04720154404640198,
0.015677040442824364,
-0.03165014088153839,
0.012368875555694103,
0.025170456618070602,
-0.013298479840159416,
0.0009713436593301594,
-0.021533142775297165,
-0.04994712769985199,
0.025949157774448395,
0.030673876404762268,
-0.00038116308860480785,
0.07200555503368378,
0.021036315709352493,
0.029674172401428223,
0.08853555470705032,
-0.01823880709707737,
-0.013014281168580055,
0.008819891139864922,
-0.03511742874979973,
0.022411325946450233,
-0.04922696575522423,
0.028578516095876694,
-0.037309303879737854,
0.062086332589387894,
-0.013561716303229332,
0.04196406155824661,
0.0035091093741357327,
0.01135831605643034,
-0.027811892330646515,
0.011742638424038887,
0.03440943360328674,
0.0086979353800416,
0.008809746243059635,
-0.025824060663580894,
-0.036724772304296494,
0.04430334270000458,
0.009280054830014706,
-0.03345845267176628,
0.002291914774104953,
0.018774330615997314,
-0.021108753979206085,
0.025999199599027634,
-0.07521436363458633,
0.013231957331299782,
0.009749909862875938,
-0.015836527571082115,
-0.04353352636098862,
-0.009904053062200546,
0.017228135839104652,
0.00441365921869874,
0.002379946643486619,
-0.0038781841285526752,
0.01915605552494526,
-0.5147368311882019,
0.02500207908451557,
0.007813330739736557,
-0.034799639135599136,
0.029263798147439957,
0.013939685188233852,
-0.013909691013395786,
0.030814578756690025,
0.03271609917283058,
-0.00823434628546238,
-0.037897445261478424,
0.02014593593776226,
-0.02416824735701084,
-0.015194399282336235,
-0.011625004932284355,
-0.015098238363862038,
0.015996767207980156,
0.000031538893381366506,
-0.0047817653976380825,
0.01831674389541149,
-0.0003936885332223028,
-0.0609041266143322,
0.008997960947453976,
0.007866844534873962,
0.049343328922986984,
0.011454964987933636,
0.0004113194008823484,
0.03222973644733429,
-0.05482407659292221,
0.002915085991844535,
0.04125290736556053,
0.019927725195884705,
0.021935386583209038,
-0.010273542255163193,
0.032370008528232574,
-0.00018558451847638935,
0.014543619006872177,
0.00927908718585968,
0.0365028977394104,
-0.01579037867486477,
-0.004221021663397551,
0.015522733330726624,
0.031708694994449615,
-0.05728505179286003,
-0.0195506252348423,
-0.01755766198039055,
-0.04441072419285774,
-0.015640422701835632,
0.0009707286371849477,
-0.019351225346326828,
-0.042645830661058426,
-0.040220435708761215,
0.06321355700492859,
-0.009509854950010777,
0.00934718269854784,
0.04669886827468872,
0.05312398821115494,
-0.020902059972286224,
-0.03230194374918938,
-0.024472957476973534,
-0.014811074361205101,
-0.04776915907859802,
-0.003142338013276458,
0.01267333049327135,
-0.0072031388990581036,
-0.002741058124229312,
-0.010716603137552738,
-0.040321074426174164,
0.008438598364591599,
0.012496262788772583,
-0.010952920652925968,
-0.014309341087937355,
-0.05905042588710785,
-0.0027415836229920387,
0.03736739978194237,
0.006292748264968395,
0.013293125666677952,
-0.006180531810969114,
-0.046559616923332214,
0.0075634135864675045,
0.02680290676653385,
-0.03968017175793648,
0.032345958054065704,
-0.022950919345021248,
-0.0019722022116184235,
0.0030579175800085068,
-0.002302654320374131,
0.020376285538077354,
-0.0171308983117342,
-0.005686975084245205,
-0.004262479953467846,
-0.032192204147577286,
-0.02382628247141838,
0.05860810726881027,
0.011672786436975002,
0.04810722544789314,
0.047596435993909836,
-0.00048165806219913065,
-0.0007597199291922152,
-0.022002294659614563,
0.026175744831562042,
0.00014610427024308592,
0.000575839658267796,
0.00751531682908535,
-0.03503812849521637,
0.028622128069400787,
0.010632097721099854,
0.0046036806888878345,
-0.009305715560913086,
-0.023432781919836998,
0.04151134192943573,
0.0019635893404483795,
-0.035770926624536514,
0.002480766735970974,
-0.08662522584199905,
-0.046036187559366226,
-0.019457796588540077,
-0.047203559428453445,
0.035212401300668716,
-0.013692324049770832,
-0.029067765921354294,
0.04934672266244888,
0.044269975274801254,
-0.03193172067403793,
-0.019153689965605736,
0.008105294778943062,
0.004629048053175211,
0.0034775580279529095,
0.002938292222097516,
-0.023949816823005676,
0.0025006202049553394,
-0.027169615030288696,
-0.016818705946207047,
0.006267838180065155,
-0.028526782989501953,
0.0032811309210956097,
-0.009046686813235283,
-0.007607071660459042,
-0.03249146044254303,
-0.011262951418757439,
-0.04235988110303879,
0.06470602005720139,
0.05077933520078659,
-0.07100836932659149,
-0.004448935389518738,
0.024297330528497696,
-0.009187453426420689,
0.019780650734901428,
-0.09051492065191269,
0.03444402664899826,
0.02461359277367592,
-0.022585341706871986,
0.029947029426693916,
0.002526891650632024,
0.007926682941615582,
-0.005786241497844458,
-0.03899471089243889,
0.031353533267974854,
0.002385425614193082,
0.026240626350045204,
0.007623049430549145,
-0.04617892578244209,
-0.001038569025695324,
0.03050907514989376,
0.03409624844789505,
0.013799440115690231,
0.006553879007697105,
0.025517264381051064,
0.0014663073234260082,
0.006534258369356394,
0.041356127709150314,
0.00008937509846873581,
0.0049053882248699665,
0.08458659052848816,
0.0013340564910322428,
-0.04699678346514702,
0.04536478593945503,
-0.011989664286375046,
-0.02541598305106163,
-0.0390157587826252,
0.05190617963671684,
0.022213274613022804,
-0.0352628193795681,
0.0057032182812690735,
-0.010613247752189636,
-0.002618921920657158,
-0.019624067470431328,
-0.05412822216749191,
-0.02726493403315544,
-0.03167000412940979,
0.007317920681089163,
0.02865573763847351,
-0.033213019371032715,
-0.010480907745659351,
-0.032281313091516495,
0.02615147829055786,
0.0006720656529068947,
-0.02229512482881546,
0.05235560983419418,
0.019729789346456528,
-0.033142752945423126,
0.01580558530986309,
0.00706309312954545,
-0.007710732985287905,
-0.004823026712983847,
0.03716551139950752,
-0.000978180905804038,
0.012916035950183868,
0.02068088948726654,
0.02330150082707405,
-0.013030820526182652,
0.015500534325838089,
0.04070761054754257,
-0.04794389754533768,
0.0020015095360577106,
0.01728244498372078,
-0.00833901297301054,
-0.0004098423814866692,
0.02238299697637558,
-0.005367743782699108,
-0.029118919745087624,
-0.05151590332388878,
0.021046817302703857,
-0.000005475711986946408,
0.04139961302280426,
0.02231650985777378,
-0.012213414534926414,
0.0045131538063287735,
-0.028646234422922134,
-0.0815771222114563,
0.021296020597219467,
-0.013470127247273922,
0.03778686001896858,
0.009013938717544079,
0.0298962090164423,
0.03526683151721954,
-0.017679808661341667,
-0.01783663220703602,
0.020321477204561234,
0.04803655669093132,
0.0031948157120496035,
-0.0024914604146033525,
-0.025659238919615746,
-0.01621025800704956,
-0.0008740024059079587,
-0.0076666781678795815,
-0.036173656582832336,
0.016610663384199142,
-0.03784123808145523,
0.00041444855742156506,
-0.0038869043346494436,
-0.026341654360294342,
0.005003686994314194,
-0.014867141842842102,
-0.03259211406111717,
-0.06514013558626175,
0.0028615384362637997,
-0.0012935524573549628,
0.0007825460052117705,
0.006297819782048464,
0.015054403804242611,
-0.0811091810464859,
0.005556898191571236,
-0.01006398443132639,
0.049956344068050385,
0.014571824111044407,
0.00454671960324049,
0.02071980945765972,
0.01066984236240387,
0.010333891026675701,
0.018837543204426765,
-0.027745187282562256,
0.03541817516088486,
0.005660166032612324,
0.001842860714532435,
-0.022314274683594704,
0.00127288734074682,
-0.012484428472816944,
0.057410940527915955,
0.00798418652266264,
0.0027793031185865402,
0.016410090029239655,
-0.027389636263251305,
0.003929472528398037,
-0.04383036121726036,
-0.01328124850988388,
0.004793438129127026,
-0.03898084908723831,
-0.06991609930992126,
0.017812758684158325,
-0.033557869493961334,
-0.028773155063390732,
0.04006046801805496,
-0.052189018577337265,
0.0039042728021740913,
-0.018640927970409393,
-0.005830179899930954,
-0.027222713455557823,
-0.014931506477296352,
-0.018070723861455917,
0.04180428758263588,
-0.02219902165234089,
-0.06478416174650192,
-0.03109482116997242,
-0.019154544919729233,
0.021405017003417015,
-0.025385480374097824,
0.014688758179545403,
0.040304187685251236,
-0.049739956855773926,
0.002873143181204796,
0.061295393854379654,
-0.013638393953442574,
0.053086910396814346,
0.011655028909444809,
0.03214575722813606,
0.026128368452191353,
0.03019871562719345,
0.02527562715113163,
-0.03873792290687561,
-0.01849164068698883,
0.021778864786028862,
-0.053087081760168076,
0.04636071249842644,
0.01752740517258644,
-0.0007581259706057608,
0.0073486207984387875,
-0.004761934280395508,
0.011385910212993622,
-0.0322582870721817,
0.03753884136676788,
-0.0302337147295475,
0.05581941083073616,
0.014969565905630589,
0.018636265769600868,
0.008054251782596111,
0.03729993477463722,
0.03154749050736427,
0.01244333479553461,
0.004735758528113365,
0.035289980471134186,
0.006771582644432783,
-0.000547114759683609,
-0.03321278840303421,
0.03499613702297211,
-0.01326967217028141,
-0.03771943598985672,
0.02281378023326397,
-0.044442590326070786,
-0.020640356466174126,
0.056711964309215546,
-0.03643084317445755,
0.05105077475309372,
0.035762690007686615,
-0.004827858414500952,
-0.022572921589016914,
-0.019390961155295372,
-0.0018668678821995854,
0.036193713545799255,
-0.008347079157829285,
-0.004775268025696278,
-0.00013497458712663502,
0.01626751385629177,
-0.014391601085662842,
-0.0765501856803894,
-0.0657397210597992,
-0.015236211009323597,
-0.0047925496473908424,
0.026454728096723557,
0.013088627718389034,
-0.0016443900531157851,
-0.059653300791978836,
-0.024650560691952705,
0.01727798953652382,
-0.025762883946299553,
0.05562065169215202,
0.03599200397729874,
-0.057008855044841766,
0.01766512170433998,
0.0042823790572583675,
-0.01114710234105587,
0.003210986265912652,
-0.012012039311230183,
-0.02821747586131096,
0.02059251070022583,
-0.006976310629397631,
-0.005020352080464363,
0.04563218355178833,
-0.025984536856412888,
-0.010355868376791477,
0.014397528022527695,
-0.017450157552957535,
0.02831985428929329,
-0.020140010863542557,
0.0162226352840662,
0.011091363616287708,
0.00603129155933857,
-0.005833808798342943,
-0.007580672390758991,
0.0060522668063640594,
-0.0018229895504191518,
0.00855479296296835,
0.004989963490515947,
0.005724790506064892,
-0.0285202544182539,
-0.05817043408751488,
-0.04051367938518524,
-0.007963084615767002,
0.014687861315906048,
0.013237470760941505,
0.025563349947333336,
-0.002476379508152604,
-0.08188113570213318,
-0.03470301628112793,
0.0010281582362949848,
0.05124359205365181,
-0.04895628243684769,
0.002576359547674656,
-0.06065189093351364,
0.02086653746664524,
-0.029144568368792534,
-0.030723029747605324,
0.02896363101899624,
-0.01186111755669117,
-0.09871713072061539,
0.008113918825984001,
-0.007092833053320646,
0.005047242157161236,
0.010959271341562271,
-0.009222648106515408,
0.03202485293149948,
-0.013088900595903397,
-0.044135600328445435,
-0.0399770624935627,
0.005546723958104849,
-0.02653561905026436,
-0.021238287910819054,
-0.007370530627667904,
-0.009976396337151527,
-0.01452143955975771,
0.017884843051433563,
-0.03305935859680176,
-0.04796209558844566,
0.018078450113534927,
0.04175935313105583,
-0.16463948786258698,
0.006851257290691137,
0.027417659759521484,
-0.02791067399084568,
-0.058407098054885864,
0.017314888536930084,
-0.010499134659767151,
0.008687217719852924,
0.04453731328248978,
0.05359484627842903,
-0.01898195408284664,
0.05362069979310036,
-0.02047102339565754,
-0.04742114618420601,
0.00557262497022748,
0.02200196497142315,
0.04790231212973595,
-0.008535546250641346,
0.01299765333533287,
-0.005173402838408947,
0.03875665366649628,
0.034665096551179886,
-0.007684621028602123,
0.0303219985216856,
0.01315936166793108,
-0.02376774325966835,
0.036859143525362015,
-0.013537012040615082,
0.01701393723487854,
-0.010385196655988693,
0.005505726207047701,
0.017948990687727928,
0.02766747958958149,
0.003625915152952075,
-0.013454523868858814,
-0.02750038541853428,
-0.013505356386303902,
0.051351845264434814,
0.016046449542045593,
0.03268948569893837,
0.006967312656342983,
-0.007907780818641186,
0.07269860059022903,
-0.03460920602083206,
0.012325849384069443,
0.01166765857487917,
-0.0054572164081037045,
0.04769780859351158,
0.04143456742167473,
0.02842308022081852,
-0.012498256750404835,
0.005451621953397989,
-0.045646026730537415,
-0.03291802853345871,
-0.029274171218276024,
0.015629209578037262,
-0.01681406982243061,
0.0011731712147593498,
-0.00702635245397687,
0.011641178280115128,
0.028855666518211365,
-0.04822410270571709,
0.040940266102552414,
0.012620198540389538,
-0.012192929163575172,
-0.015274124220013618,
-0.030485160648822784,
0.007983259856700897,
0.011701622977852821,
0.0035503655672073364,
0.02985430881381035,
0.012234252877533436,
0.015321055427193642,
0.01317466702312231,
-0.048172224313020706,
0.018389038741588593,
-0.00017102312995120883,
-0.004334629513323307,
0.02985277585685253,
-0.024776002392172813,
0.014105713926255703,
-0.09432370960712433,
-0.029874539002776146,
0.04249855875968933,
0.010852240957319736,
0.02516201138496399,
-0.011645619757473469,
0.043475229293107986,
-0.061799608170986176,
0.0266592875123024,
-0.04080353304743767,
0.02436586283147335,
0.0008214610861614347,
-0.037551842629909515,
-0.0065329410135746,
0.03816346079111099,
0.032625168561935425,
0.002138423267751932,
-0.0330393947660923,
0.0022874814458191395,
-0.011252152733504772,
-0.009906036779284477,
0.022928284481167793,
0.032684892416000366,
0.008841048926115036,
-0.01951907016336918,
-0.032347891479730606,
0.046255577355623245,
0.00421116454526782,
-0.04065422713756561,
0.009561733342707157,
0.014393490739166737,
0.05058159679174423,
-0.015122040174901485,
-0.06560863554477692,
-0.05877283215522766,
0.0170875396579504
] |
8a86ee599744eb8c45294e523b8309fa29706768 | 261 | py | Python | python/EXERCICIO 96 - FUNCAO QUE CALCULA A AREA.py | debor4h/exerciciosPython | a18d88c6e98bc49005bfcb8badeb712007c16d69 | [
"MIT"
] | 1 | 2022-03-15T02:25:17.000Z | 2022-03-15T02:25:17.000Z | python/EXERCICIO 96 - FUNCAO QUE CALCULA A AREA.py | debor4h/exerciciosPython | a18d88c6e98bc49005bfcb8badeb712007c16d69 | [
"MIT"
] | null | null | null | python/EXERCICIO 96 - FUNCAO QUE CALCULA A AREA.py | debor4h/exerciciosPython | a18d88c6e98bc49005bfcb8badeb712007c16d69 | [
"MIT"
] | null | null | null | def area(msg):#declaracao da funcao com o parametro msg
print(msg)#aqui msg e a area
print('Controle de Terrenos')
print('-' * 20)
l = float(input('Largura (m): '))
c = float(input('Comprimento (m): '))
area(f'A área do seu terreno {l}X{c} é de {l*c}m².')
| 26.1 | 55 | 0.64751 | 1 | 0.7551 | [
0.0026669753715395927,
0.02712996117770672,
0.00640491209924221,
-0.0015193043509498239,
0.004142770543694496,
-0.00421943049877882,
-0.012433587573468685,
0.005113915540277958,
-0.007472144905477762,
0.002162712160497904,
-0.0002123192825820297,
0.006531532388180494,
0.006757576949894428,
-0.018212195485830307,
-0.0009577785385772586,
0.01753171533346176,
-0.05789932236075401,
0.002834557555615902,
-0.0024581521283835173,
0.005134176928550005,
-0.00904774572700262,
0.011380468495190144,
0.007788226939737797,
0.007369778584688902,
0.0053201536647975445,
0.002249656245112419,
0.010789627209305763,
0.003368513658642769,
-0.007485347334295511,
-0.0024179420433938503,
0.0008878485532477498,
-0.0023223606403917074,
-0.0028043189086019993,
-0.010117119178175926,
0.007240228820592165,
-0.002489265985786915,
0.00025984065723605454,
-0.01964154653251171,
0.013126339763402939,
-0.0031469149980694056,
-0.004687012638896704,
-0.01773880608379841,
0.00007697459659539163,
0.0077563184313476086,
-0.012482748366892338,
0.002597844460979104,
-0.005108329001814127,
0.0010230457410216331,
-0.008101224899291992,
0.004542262759059668,
-0.012006394565105438,
0.0047638085670769215,
0.014101910404860973,
0.0052457028068602085,
-0.005227336194366217,
-0.007274226751178503,
0.012185388244688511,
-0.0012825088342651725,
-0.013212228193879128,
-0.0030627651140093803,
-0.0017827106639742851,
-0.00183968897908926,
0.0031273888889700174,
0.0020183795131742954,
-0.02072443626821041,
-0.006372553762048483,
-0.006134320981800556,
0.0025101290084421635,
-0.00013519561616703868,
0.0043664793483912945,
0.0037716173101216555,
0.0020370983984321356,
0.006470013875514269,
-0.0014890821184962988,
-0.00028137332992628217,
-0.00394904799759388,
-0.0031898971647024155,
0.0043250382877886295,
0.006660740822553635,
0.0038042841479182243,
0.005305026192218065,
-0.009512776508927345,
0.0035724136978387833,
0.011927894316613674,
0.00885320920497179,
0.008057245053350925,
0.015145599842071533,
-0.010218190960586071,
0.04201562702655792,
0.0072718956507742405,
-0.006451592780649662,
0.0025322758592665195,
-0.006718476302921772,
-0.004500637296587229,
-0.0013400828465819359,
-0.031556252390146255,
-0.0005854948540218174,
-0.005745529197156429,
-0.0018525534542277455,
0.0021175078582018614,
0.0007874695584177971,
0.008418514393270016,
-0.0006217557238414884,
-0.0019680981058627367,
-0.010044943541288376,
0.015156473033130169,
-0.008806295692920685,
-0.0028840992599725723,
0.01005459949374199,
0.0034509056713432074,
-0.012312322854995728,
-0.0005513656069524586,
0.0015058652497828007,
-0.011691187508404255,
0.00665045902132988,
0.0016305994940921664,
-0.0046547953970730305,
0.059366192668676376,
-0.001764311222359538,
0.003025642829015851,
-0.006336912512779236,
-0.0009570304537191987,
0.002353279385715723,
0.00689192209392786,
0.009876376017928123,
-0.004999268800020218,
0.011824967339634895,
0.010929998010396957,
0.0033335131593048573,
0.008076119236648083,
-0.00008869480370776728,
0.0087098628282547,
-0.002308417810127139,
0.0025277375243604183,
0.0034252130426466465,
-0.007644699886441231,
0.011451451107859612,
-0.0035672879312187433,
-0.00470467284321785,
0.0018804662395268679,
-0.003292020643129945,
-0.011902694590389729,
0.0015754541382193565,
0.0004268645716365427,
-0.00036102713784202933,
-0.008908003568649292,
-0.003009521635249257,
-0.004159056581556797,
-0.0036582020111382008,
0.0025758319534361362,
0.011147615499794483,
0.007415056228637695,
0.0013338698772713542,
-0.005986446514725685,
-0.007818495854735374,
-0.0019945171661674976,
-0.0022037802264094353,
0.0036954961251467466,
0.01041851844638586,
0.002870011841878295,
-0.009030518122017384,
-0.006561119109392166,
0.00328602222725749,
0.008019371889531612,
-0.002522088587284088,
0.0005363664822652936,
-0.006881670095026493,
0.010161408223211765,
0.001100290915928781,
0.005529880989342928,
0.01091067772358656,
-0.00523107685148716,
-0.000330172450048849,
-0.0005286954692564905,
0.0033754282630980015,
0.0005445698625408113,
0.00407017394900322,
0.008876326493918896,
-0.00462611997500062,
-0.003231554990634322,
0.006122751627117395,
0.005261577665805817,
0.004685305990278721,
0.005719558335840702,
-0.0006332898628897965,
-0.00019362235616426915,
-0.0033594027627259493,
-0.0013385391794145107,
0.007189959287643433,
-0.005066890735179186,
0.010667980648577213,
0.006445026025176048,
-0.015174977481365204,
-0.009065850637853146,
-0.003340746508911252,
-0.010076195001602173,
-0.00009162809874396771,
0.013109850697219372,
0.012258359231054783,
-0.0007055153837427497,
0.0019554211758077145,
-0.012035743333399296,
0.0030626929365098476,
0.008444148115813732,
0.0011862367391586304,
-0.015090410597622395,
-0.9558621644973755,
0.00740704545751214,
0.0018630909034982324,
0.0003962281043641269,
0.004621885716915131,
0.0008649898809380829,
0.004199387039989233,
0.0012878900161013007,
0.011860436759889126,
-0.011235620826482773,
-0.006667573004961014,
-0.009788168594241142,
-0.012860625050961971,
-0.00010344722250010818,
-0.006518065929412842,
-0.005314626265317202,
-0.007614465430378914,
-0.00833799783140421,
-0.0011092296335846186,
-0.0037948698736727238,
-0.002321731299161911,
0.011198592372238636,
-0.0012069536605849862,
0.003909232094883919,
0.008261985145509243,
0.0035218840930610895,
-0.0070265112444758415,
-0.0016218855744227767,
0.0001648261386435479,
-0.0004565228009596467,
-0.005613614805042744,
-0.013281481340527534,
-0.0059196678921580315,
0.0014755901647731662,
0.012463175691664219,
0.0009023334132507443,
0.008641572669148445,
-0.0023146725725382566,
0.00041477972990833223,
-0.009808279573917389,
0.008234631270170212,
0.0033525254111737013,
0.00542706623673439,
-0.02749745547771454,
0.002051708521321416,
-0.0016223068814724684,
-0.005092657171189785,
0.007585776504129171,
0.00219136499799788,
-0.003969431389123201,
-0.001519960816949606,
-0.005551127716898918,
0.0065316129475831985,
-0.007911857217550278,
0.004327977541834116,
-0.0041801282204687595,
-0.0071964203380048275,
-0.002773023210465908,
-0.010313840582966805,
0.002989979926496744,
0.004051928874105215,
-0.0020606662146747112,
-0.0007568755536340177,
-0.004661420360207558,
0.002546316012740135,
0.0023079209495335817,
0.0027017449028789997,
-0.018129397183656693,
-0.0039960225112736225,
-0.004274215083569288,
0.0019114456372335553,
-0.0026962615083903074,
-0.0048128534108400345,
0.002610826166346669,
-0.00992103572934866,
0.005084773991256952,
0.0004850202240049839,
0.0009605505620129406,
-0.011682599782943726,
0.0001300879375776276,
-0.0090864272788167,
-0.007826744578778744,
0.003537735901772976,
-0.00439908541738987,
-0.002576802857220173,
0.0005087172612547874,
0.004439870361238718,
0.007375436834990978,
-0.006590704899281263,
0.00012953326222486794,
0.01070049125701189,
-0.0041352189145982265,
-0.01005637552589178,
0.007331932429224253,
0.00641912454739213,
0.0022686838638037443,
-0.0021000117994844913,
0.00600016675889492,
0.008975913748145103,
0.00978284515440464,
-0.0008125554886646569,
0.0013846182264387608,
0.0008348111878149211,
0.010327178984880447,
0.00041502510430291295,
0.001977612031623721,
-0.0014564984012395144,
-0.0012101683532819152,
-0.0045248460955917835,
-0.0038443373050540686,
-0.0015563234919682145,
-0.00022761564468964934,
-0.009123295545578003,
-0.012622395530343056,
-0.007161285262554884,
0.003839324926957488,
-0.0011231633834540844,
-0.00414518965408206,
0.0006764890858903527,
0.0016757858684286475,
0.00925049651414156,
-0.0026212057564407587,
-0.006148646119982004,
0.0007612193003296852,
0.0008607796626165509,
-0.007129475008696318,
0.017017468810081482,
-0.01344978716224432,
0.006332725752145052,
-0.0009717540233395994,
-0.01506068091839552,
0.005104540381580591,
0.009808122180402279,
-0.0061393920332193375,
0.000055055119446478784,
0.0006481552263721824,
0.0022946789395064116,
-0.0008509084000252187,
-0.0031483550556004047,
-0.004532707389444113,
-0.01587405800819397,
0.0017439555376768112,
0.0199421476572752,
0.003922688774764538,
0.008050563745200634,
0.01047210767865181,
-0.005632458254694939,
0.0028171713929623365,
0.009119297377765179,
-0.000022868733140057884,
0.012457519769668579,
-0.00909366924315691,
0.0014091364573687315,
0.0009894313989207149,
-0.0071891071274876595,
0.0017530776094645262,
0.004313034471124411,
0.006443175021559,
-0.0048451353795826435,
-0.001548274653032422,
-0.0065040308982133865,
-0.0035908569116145372,
-0.018889110535383224,
-0.0006031494121998549,
0.006474051158875227,
-0.0037342715077102184,
0.0034227008000016212,
-0.011707684956490993,
0.004336138255894184,
0.004218773450702429,
0.0029984996654093266,
-0.0019021291518583894,
0.0013910707784816623,
0.006342986132949591,
0.01421019621193409,
-0.005286881234496832,
0.0030524677131325006,
0.0036086631007492542,
-0.002315002027899027,
0.005141108762472868,
0.009546533226966858,
-0.0096231484785676,
-0.006006084848195314,
0.00403109984472394,
0.002666155109182,
0.0025285030715167522,
-0.0025637373328208923,
-0.009725160896778107,
-0.005873434245586395,
0.004090253729373217,
-0.010252050124108791,
0.005320245400071144,
-0.0010984477121382952,
0.0024947887286543846,
-0.010193740017712116,
0.00007017829193500802,
-0.004818357061594725,
-0.010463139973580837,
0.00814443826675415,
-0.002194776199758053,
0.003954614978283644,
0.011856303550302982,
0.0024076958652585745,
-0.014793941751122475,
0.004708012565970421,
0.007148281205445528,
-0.004152368754148483,
-0.00009114950080402195,
0.006420958321541548,
-0.005757470149546862,
-0.02073277160525322,
0.00010444856889080256,
-0.014036481268703938,
0.005182304885238409,
-0.003759735031053424,
0.002584675792604685,
-0.008958229795098305,
0.005657583009451628,
0.005856857635080814,
-0.012160094454884529,
-0.006293663289397955,
-0.007399169262498617,
0.006197631824761629,
-0.0017561176791787148,
-0.005007664207369089,
-0.003008553758263588,
-0.0012061515590175986,
-0.003722346620634198,
-0.002887745387852192,
-0.0006129451212473214,
0.0033307757694274187,
0.00132740696426481,
-0.0023046769201755524,
0.005292737390846014,
-0.0005406838026829064,
0.00029115649522282183,
0.0018854810623452067,
-0.01079172920435667,
0.0005236979341134429,
0.005593326408416033,
-0.0009315169299952686,
-0.003070182865485549,
0.0028969726990908384,
-0.004931483883410692,
-0.004727466031908989,
-0.010142951272428036,
-0.004158957861363888,
0.0002367752167629078,
-0.004152361769229174,
-0.011197076179087162,
-0.0010352686513215303,
-0.009336166083812714,
0.007670329883694649,
-0.006065674126148224,
0.010498680174350739,
0.004206454381346703,
-0.0047060465440154076,
0.006779276765882969,
-0.005276383366435766,
0.0038192940410226583,
-0.000205073956749402,
0.005811893381178379,
0.00020873233734164387,
-0.006854066159576178,
-0.011746344156563282,
0.011063944548368454,
-0.011189429089426994,
0.0030276915058493614,
0.013294409029185772,
0.005317638162523508,
0.008883914910256863,
0.0039707510732114315,
0.00007122031092876568,
0.003649765392765403,
0.006068161688745022,
-0.01090966071933508,
0.0021931950468569994,
-0.0022238350939005613,
-0.0016160944942384958,
0.0072547635063529015,
-0.0023800660856068134,
0.0014014090411365032,
0.00917634554207325,
-0.00023712488473393023,
-0.005915224086493254,
-0.003769909730181098,
0.00015331857139244676,
0.0036005822475999594,
-0.011625337414443493,
-0.002581492532044649,
-0.004564717411994934,
-0.004636282101273537,
-0.005169042386114597,
-0.0029328179080039263,
0.00009298660006606951,
0.0032682428136467934,
-0.00206230441108346,
0.007540978491306305,
0.0007080155774019659,
-0.00220444961450994,
0.014204000122845173,
-0.003198025980964303,
-0.0005546978791244328,
0.004813031759113073,
0.0011784101370722055,
0.0006920216255821288,
-0.007361819501966238,
-0.002288792748004198,
-0.00048597625573165715,
0.006665260996669531,
-0.006025920622050762,
-0.010673398151993752,
-0.0029832099098712206,
-0.001054612803272903,
-0.00912538543343544,
0.0002896826481446624,
0.011992738582193851,
-0.00503583624958992,
0.0034647700376808643,
0.00044737564167007804,
-0.006354500539600849,
-0.01356201246380806,
0.05711295083165169,
0.000942976213991642,
0.0034816693514585495,
0.005451268516480923,
-0.00667544174939394,
0.00017646723426878452,
-0.00430250121280551,
0.006101209670305252,
-0.005541604477912188,
-0.0076639992184937,
0.009377622976899147,
-0.00239872420206666,
0.004491240251809359,
-0.0019320840947329998,
-0.002607857109978795,
0.01531128492206335,
-0.007787678856402636,
-0.01402963325381279,
-0.01442425511777401,
0.005372469779103994,
-0.003783418331295252,
-0.0059971618466079235,
0.0032796200830489397,
-0.005471489392220974,
-0.003107170108705759,
0.0009271699818782508,
0.004769093357026577,
-0.0005972395301796496,
0.0013343764003366232,
-0.0010270323837175965,
-0.00043596475734375417,
-0.0013826590729877353,
0.0023882747627794743,
0.005641174502670765,
0.00971458200365305,
-0.002237375359982252,
0.005450252443552017,
-0.003495299257338047,
-0.0015075670089572668,
-0.002665530424565077,
0.005738190840929747,
0.008445830084383488,
-0.0002960636338684708,
-0.0008015007479116321,
0.00376189686357975,
0.002664019586518407,
0.00271334289573133,
0.011028367094695568,
0.002064187079668045,
-0.0060913884080946445,
0.009067390114068985,
0.00883585773408413,
-0.004101297352463007,
0.0062223984859883785,
-0.0017529281321913004,
0.006823171861469746,
0.0023958911187946796,
-0.010296666994690895,
-0.0070602670311927795,
0.003022700548171997,
0.006088535767048597,
0.006653617136180401,
-0.0031476225703954697,
-0.0016391773242503405,
0.0018918896093964577,
-0.001079812180250883,
-0.0098807942122221,
-0.007586409337818623,
-0.0013642682461068034,
0.00008133034862112254,
0.004409410525113344,
0.07265881448984146,
-0.007423349190503359,
-0.0006578512256965041,
-0.007863689213991165,
0.002252542646601796,
-0.0010675708763301373,
-0.0012795523507520556,
-0.0033595554996281862,
0.001221733051352203,
0.002881665714085102,
0.0036637759767472744,
-0.007773827761411667,
-0.00852942280471325,
0.00014463916886597872,
0.0038780251052230597,
-0.002133527770638466,
0.005211546551436186,
0.009399807080626488,
-0.01010394562035799,
0.002628086833283305,
-0.010435229167342186,
-0.0026536518707871437,
-0.000816646555904299,
-0.00732098612934351,
-0.0016005351208150387,
-0.002563095185905695,
0.0020811466965824366,
0.00447171600535512,
0.008976418524980545,
-0.004936201963573694,
0.003726649098098278,
-0.0032102055847644806,
0.0012602359056472778,
-0.0038370154798030853,
-0.0002114806411555037,
-0.0053572687320411205,
0.005935979075729847,
0.0006376624223776162,
-0.012141128070652485,
-0.003980728331953287,
-0.0006968795787543058,
0.0011572744697332382,
-0.005616461858153343,
0.003616937668994069,
-0.0022590686567127705,
0.010839642956852913,
-0.0035535290371626616,
0.0023069619201123714,
-0.0046372669748961926,
-0.00013004790525883436,
-0.012418397702276707,
0.004468232858926058,
-0.179536372423172,
0.010539126582443714,
0.0011434219777584076,
-0.00440517021343112,
-0.002775307046249509,
-0.01629425585269928,
-0.009172631427645683,
0.002039458369836211,
0.008814072236418724,
0.00016143500397447497,
0.0022125255782157183,
-0.0022371660452336073,
0.004727800376713276,
0.002066511893644929,
-0.003003268036991358,
-0.0022867547813802958,
0.004098774865269661,
-0.005597072187811136,
-0.003030478721484542,
0.0023592193610966206,
0.00655002286657691,
0.006831352133303881,
0.003529909998178482,
0.0005072306958027184,
0.0008661753963679075,
-0.004007404204457998,
0.0029679604340344667,
-0.0023710874374955893,
0.00525203812867403,
-0.010772601701319218,
-0.005290328525006771,
-0.008351773954927921,
-0.0017103181453421712,
0.0001975696359295398,
0.0021143914200365543,
-0.002603809116408229,
0.007519976235926151,
0.0012489783111959696,
-0.007819926366209984,
0.007842052727937698,
-0.004956039134413004,
0.033150602132081985,
0.001968895085155964,
0.008377238176763058,
0.000530586636159569,
-0.0016514883609488606,
-0.0024850156623870134,
0.010337757878005505,
0.0022002055775374174,
0.01285498309880495,
-0.012413411401212215,
-0.005959257483482361,
0.0015555424615740776,
0.017717167735099792,
-0.003999507520347834,
-0.01076965220272541,
-0.00611214991658926,
-0.006313598249107599,
0.004181530326604843,
0.013765023089945316,
0.009227987378835678,
-0.0042965468019247055,
0.007594970054924488,
-0.0029035245534032583,
-0.01842464879155159,
0.003166546579450369,
-0.002593443263322115,
-0.008045380003750324,
-0.0017529097385704517,
0.00636547664180398,
0.009556042961776257,
-0.004552388098090887,
0.01003230083733797,
-0.0012682897504419088,
0.0004350775561761111,
-0.0013424777425825596,
0.004540988244116306,
-0.004746537655591965,
0.004491730127483606,
-0.009658794850111008,
0.01012667641043663,
-0.010069592855870724,
-0.0032793853897601366,
0.003823966719210148,
-0.0034200921654701233,
0.012462330982089043,
0.006669450551271439,
-0.002562666079029441,
-0.0017079381505027413,
-0.013749148696660995,
-0.0014291960978880525,
0.005111212842166424,
0.004493123851716518,
-0.009055660106241703,
0.0016614467604085803,
-0.0010919150663539767,
0.0035057212226092815,
0.009863344952464104,
-0.00944188516587019,
0.006001721136271954,
0.006584157235920429,
-0.0073294504545629025,
0.0005677100270986557,
-0.005094280932098627,
0.003008446888998151,
0.003925747238099575,
-0.008411414921283722,
-0.010167722590267658,
0.0018639819463714957,
-0.006038792431354523,
-0.004916293080896139,
0.006215774454176426,
-0.009653852321207523,
-0.005567724816501141,
-0.0020833956077694893,
-0.011898362077772617,
0.0017318602185696363
] |
8a8756b0429224a6d5fdf07d18eb3a9eed2f7a05 | 2,373 | py | Python | auth_iam/dashboard/auth/routes.py | santiher/dash-auth-example | 9854bfe953f86a0c7ed97660da30b7b7d1d3069f | [
"MIT"
] | 11 | 2020-03-05T18:50:07.000Z | 2022-02-16T19:45:35.000Z | auth_iam/dashboard/auth/routes.py | santiher/dash-auth-example | 9854bfe953f86a0c7ed97660da30b7b7d1d3069f | [
"MIT"
] | null | null | null | auth_iam/dashboard/auth/routes.py | santiher/dash-auth-example | 9854bfe953f86a0c7ed97660da30b7b7d1d3069f | [
"MIT"
] | null | null | null | import os
from functools import wraps
from os.path import join as join_path
from dash import Dash
from flask import make_response, render_template_string, redirect
excluded_resources_endpoints = (
'static', '_dash_assets.static', '/_favicon.ico', '/login', '/logout',
'/_user', '/auth')
def add_routes(app, authorizer):
"""Adds authentication endpoints to a flask app.
Decorates other endpoints to grant access.
The endpoints are:
* /login
* Method: GET
* /logout
* Method: GET
* Erases cookies
* /auth
* Method: GET
* Validates cookies if present or header authentication
* Header:
'Authorization: DASHBOARD-AUTH username=([^/]*)/password=([^/]*)'
* Sets cookies on login
* Rejects unauthorized users
Parameters
----------
app: flask.Flask or dash.Dash
The flask or dash application
excluded_resources_endpoints: tuple(str)
Tuple with endpoints where access must not be checked.
"""
def login():
ok, _ = authorizer.validate()
if ok:
return make_response(redirect('/'), 307)
return render_template_string(login_template)
def logout():
_, response = authorizer.clean_cookie()
return response
def auth():
_, response = authorizer.validate()
return response
def authorize_endpoint(function):
@wraps(function)
def authorized_function(*args, **kwargs):
ok, response = authorizer.validate()
if ok:
return function(*args, **kwargs)
return response
return authorized_function
if isinstance(app, Dash):
app = app.server
login_template = load_template('login.html')
app.add_url_rule('/auth', '/auth', auth)
app.add_url_rule('/login', '/login', login)
app.add_url_rule('/logout', '/logout', logout)
for endpoint, function in app.view_functions.items():
if endpoint not in excluded_resources_endpoints:
app.view_functions[endpoint] = authorize_endpoint(function)
def load_template(filename):
"""Loads the login html template."""
pyfile_path = os.path.dirname(os.path.abspath(__file__))
path = join_path(pyfile_path, 'templates', filename)
with open(path, 'r') as f:
return f.read().strip()
| 29.296296 | 77 | 0.634218 | 1 | 1.3836 | [
0.002088403096422553,
0.022114712744951248,
0.007752321194857359,
0.0007918914780020714,
0.004490561317652464,
-0.0026965804863721132,
-0.010478419251739979,
0.0018740557134151459,
-0.007213192526251078,
0.0029312153346836567,
0.002022321568801999,
0.001853862893767655,
0.006104808300733566,
-0.019276384264230728,
-0.0006948694935999811,
0.015085817314684391,
-0.05032651498913765,
0.0003507007204461843,
-0.003644919954240322,
0.0014193803071975708,
-0.007613853085786104,
0.008749403990805149,
0.006434289272874594,
0.0051831454038619995,
0.0063346754759550095,
0.0004172288754489273,
0.00865039974451065,
-0.0006004105671308935,
-0.00696619413793087,
-0.005982863716781139,
-0.0014306894736364484,
-0.0035099077504128218,
-0.004691570997238159,
-0.005696913693100214,
0.007446541450917721,
-0.001620240742340684,
0.0006750252796337008,
-0.019292082637548447,
0.012313557788729668,
-0.004493525251746178,
-0.006900781765580177,
-0.017904847860336304,
-0.0004036114551126957,
0.0020015090703964233,
-0.010343370027840137,
0.002389160916209221,
-0.004207790829241276,
0.004291200544685125,
-0.013965974561870098,
0.008122111670672894,
-0.007859104312956333,
0.007759910076856613,
0.012632857076823711,
0.0017194735119119287,
-0.0058889323845505714,
-0.007849064655601978,
0.013760440982878208,
0.00019719857664313167,
-0.011129333637654781,
0.0009418069967068732,
-0.001865315600298345,
-0.0024894915986806154,
0.0043741874396800995,
0.0030648240353912115,
-0.014366276562213898,
-0.0043129161931574345,
-0.0034980156924575567,
0.001954147592186928,
0.0005425749695859849,
0.005835339892655611,
0.00021692959126085043,
-0.0023042045067995787,
0.008008960634469986,
0.004879868123680353,
0.005371382459998131,
-0.0029896171763539314,
-0.0006677538622170687,
0.0009711768361739814,
0.008180218748748302,
0.005483142100274563,
0.005127372220158577,
-0.005953076295554638,
0.007016882766038179,
0.010921956971287727,
0.014185617677867413,
0.005182426888495684,
0.01969734951853752,
-0.01246294192969799,
0.04841415956616402,
0.0073543512262403965,
-0.008509491570293903,
0.0012183092767372727,
-0.009336407296359539,
-0.0015024942113086581,
-0.004063291475176811,
-0.027579965069890022,
0.0004384420462884009,
-0.00662187347188592,
0.0014815087197348475,
0.003040462266653776,
-0.0002005737042054534,
0.006955574732273817,
-0.004322031978517771,
-0.001654006540775299,
-0.008685708977282047,
0.014535782858729362,
-0.009351749904453754,
-0.001956528052687645,
0.006360867526382208,
0.0019056213786825538,
-0.009858598001301289,
-0.00009041652083396912,
0.002794260159134865,
-0.012040972709655762,
0.0033226478844881058,
0.0010624026181176305,
-0.0027296256739646196,
0.05529944226145744,
0.001188419759273529,
0.004909232724457979,
-0.0053436788730323315,
0.0007604123093187809,
-0.00007424086652463302,
0.006304319482296705,
0.006990115623921156,
-0.002539707813411951,
0.011238982900977135,
0.005975198000669479,
0.0038989691529423,
0.011047487147152424,
-0.0006343403947539628,
0.008941593579947948,
-0.0059304977767169476,
-0.002621844643726945,
0.0013977279886603355,
-0.005241842474788427,
0.005854841787368059,
-0.001903401454910636,
-0.0064452411606907845,
0.000962634920142591,
-0.000968649226706475,
-0.010611803270876408,
0.0025722195859998465,
-0.002691999077796936,
0.0030794988851994276,
-0.014142769388854504,
-0.00516911968588829,
-0.0037598840426653624,
-0.005232555326074362,
0.0037096994929015636,
0.008485970087349415,
0.0033827777951955795,
0.002171811880543828,
-0.006354932207614183,
-0.00859891902655363,
-0.001100142952054739,
-0.00350091140717268,
0.0016800774028524756,
0.005628675688058138,
0.001470481394790113,
-0.010203758254647255,
0.00032545666908845305,
0.0038523441180586815,
0.003392502898350358,
-0.00042966820183210075,
0.0010005520889535546,
-0.006811991333961487,
0.007261345628648996,
0.000321597617585212,
0.006136482581496239,
0.012185582891106606,
-0.005406593903899193,
-0.001593119464814663,
-0.0015804177382960916,
0.0010426908265799284,
-0.0012177834287285805,
0.0043837227858603,
0.010954130440950394,
-0.005617083515971899,
-0.00651778606697917,
0.004181570373475552,
0.005153577774763107,
0.009654735215008259,
0.0058369142934679985,
-0.00220935745164752,
0.0009735105559229851,
-0.004873927682638168,
-0.0018324380507692695,
0.006398995406925678,
-0.005508903414011002,
0.0026890782173722982,
0.00473337946459651,
-0.014750970527529716,
-0.007529192138463259,
0.0014628547942265868,
-0.006638973485678434,
0.000497556640766561,
0.013753697276115417,
0.011024885810911655,
-0.0049598035402596,
0.004014178644865751,
-0.009075326845049858,
0.0009401094866916537,
0.006361924111843109,
0.003070942824706435,
-0.013386710546910763,
-0.9588072299957275,
0.005712964106351137,
0.004599025007337332,
-0.0009853061055764556,
0.005110437516123056,
0.0049659148789942265,
0.0009004072053357959,
0.005580476019531488,
0.013268616050481796,
-0.011696089059114456,
-0.005030521657317877,
-0.012142105028033257,
-0.00906908605247736,
-0.0019137343624606729,
-0.007036362309008837,
-0.0047308034263551235,
-0.006428720895200968,
-0.007543492596596479,
-0.005965102463960648,
-0.0035190510097891092,
-0.0025283810682594776,
0.01130279153585434,
-0.0005301483324728906,
0.005067403893917799,
0.0032587344758212566,
0.002554886508733034,
-0.0020818794146180153,
-0.00024228196707554162,
-0.001307794009335339,
-0.001798529177904129,
-0.007026675622910261,
-0.014787363819777966,
-0.005176851991564035,
-0.0018304146360605955,
0.011097803711891174,
-0.0005861230310983956,
0.007590437773615122,
-0.0030899355188012123,
-0.00004141783938393928,
-0.008531391620635986,
0.005177362821996212,
-0.000488850346300751,
0.0019454017747193575,
-0.029152939096093178,
0.0008957465179264545,
-0.00075327861122787,
-0.01080893725156784,
0.0098048634827137,
-0.0010558805661275983,
0.00016822539328131825,
-0.0031835269182920456,
-0.00505440216511488,
0.010839036665856838,
-0.007139728870242834,
0.0034801396541297436,
-0.00271298224106431,
-0.008548276498913765,
-0.001803414081223309,
-0.008552526123821735,
0.0005555100506171584,
0.004503102973103523,
-0.0029896865598857403,
-0.004789265803992748,
-0.003939093556255102,
0.0021524836774915457,
0.0008934888173826039,
0.0028601037338376045,
-0.018350617960095406,
-0.008217169903218746,
0.001615431159734726,
-0.0017737846355885267,
-0.00524602085351944,
-0.0027300608344376087,
0.004650567192584276,
-0.00958484597504139,
0.0064372718334198,
0.0015481937443837523,
0.0024201273918151855,
-0.012133401818573475,
0.0012675136094912887,
-0.007722800597548485,
-0.008690280839800835,
0.001208348898217082,
-0.006333847530186176,
-0.0053639961406588554,
0.0006264201365411282,
0.0003412214573472738,
0.008700907230377197,
-0.0032534743659198284,
0.0035520149394869804,
0.01298407930880785,
-0.004276582971215248,
-0.006485287100076675,
0.007287708576768637,
0.006488082930445671,
-0.0013474153820425272,
-0.0016582943499088287,
0.0033775032497942448,
0.008392822928726673,
0.006651834584772587,
0.0029634498059749603,
0.005673030391335487,
0.00034231727477163076,
0.009310041554272175,
0.0002809440193232149,
0.0002953868533950299,
-0.002171139232814312,
-0.0017404652899131179,
-0.0043285079300403595,
-0.0007774733821861446,
-0.0031687619630247355,
-0.0022924018558114767,
-0.013190343044698238,
-0.009175825864076614,
-0.002060290426015854,
-0.00046499125892296433,
0.0009682453237473965,
-0.0032174980733543634,
-0.0008981326245702803,
0.002985504223033786,
0.007560682948678732,
0.0019207998411729932,
-0.0015896697295829654,
0.00013075798051431775,
0.0020143899600952864,
-0.006911778822541237,
0.013630631379783154,
-0.010830377228558064,
0.004906849469989538,
-0.00046741048572584987,
-0.015568358823657036,
0.006921613588929176,
0.009501425549387932,
-0.008345413953065872,
0.002155155874788761,
0.003987360745668411,
0.004965818952769041,
-0.0014263044577091932,
-0.006358921527862549,
-0.0036237246822565794,
-0.0138135040178895,
0.0008539320551790297,
0.019065452739596367,
-0.00016225497529376298,
0.010963324457406998,
0.013025045394897461,
-0.002512927632778883,
0.0018686688272282481,
0.006812411360442638,
0.000014986348105594516,
0.012057041749358177,
-0.009479599073529243,
-0.001054913504049182,
0.001026985584758222,
-0.004555029328912497,
0.0010388344526290894,
0.005094355903565884,
0.005781079642474651,
-0.001758320489898324,
0.004530184902250767,
-0.006513566244393587,
-0.003769118804484606,
-0.016364626586437225,
-0.0038095058407634497,
0.008137601427733898,
-0.0060137491673231125,
0.004114614333957434,
-0.010459943674504757,
0.007425033953040838,
0.007476924452930689,
0.002834676532074809,
0.000841439061332494,
0.0006236116169020534,
0.006396537646651268,
0.011035997420549393,
-0.007574308663606644,
0.0026656307745724916,
0.002516265492886305,
-0.0009562461636960506,
0.0011116822715848684,
0.006191162392497063,
-0.007499058730900288,
-0.006682612933218479,
0.0027221443597227335,
0.004445123020559549,
-0.000651326437946409,
-0.004686144646257162,
-0.0084831602871418,
-0.004034877754747868,
0.003738061524927616,
-0.005476595833897591,
0.005470024887472391,
0.005268532317131758,
0.005010516382753849,
-0.006706786807626486,
-0.0007240456179715693,
-0.003433198668062687,
-0.011649205349385738,
0.010654063895344734,
-0.002541232854127884,
0.0032323780469596386,
0.011900869198143482,
0.003428379073739052,
-0.011728893965482712,
0.007130870129913092,
0.008052827790379524,
-0.004848318640142679,
0.0046283043920993805,
0.006136195734143257,
-0.005229772999882698,
-0.022133158519864082,
-0.0025179751683026552,
-0.013578573241829872,
0.007348650600761175,
-0.002977027092128992,
0.006187022663652897,
-0.007675445172935724,
0.004300158936530352,
0.00607702974230051,
-0.015442760661244392,
-0.0065816533751785755,
-0.007785007357597351,
0.0093910600990057,
0.0008653002441860735,
-0.0013247043825685978,
-0.003681477392092347,
-0.00029795250156894326,
-0.0023865236435085535,
-0.005066664423793554,
-0.0018010743660852313,
0.005258501507341862,
0.002770485356450081,
-0.0016405899077653885,
0.003652357729151845,
-0.0036594427656382322,
-0.0004530246660578996,
-0.0005299955373629928,
-0.01026105135679245,
0.005427584983408451,
0.0032909149304032326,
-0.004136373288929462,
-0.003915304318070412,
0.0005015091155655682,
0.0013400756288319826,
-0.008349747397005558,
-0.010000953450798988,
-0.0024212156422436237,
-0.004407786298543215,
-0.0022182976827025414,
-0.011758948676288128,
-0.0006708292057737708,
-0.005963216535747051,
0.005490799900144339,
-0.008038641884922981,
0.00879764836281538,
0.00694727897644043,
-0.006257928907871246,
0.00775344530120492,
-0.0011319526238366961,
0.005550122819840908,
0.0027274624444544315,
0.005618374794721603,
0.00030254447483457625,
-0.003813189221546054,
-0.012113037519156933,
0.010726447217166424,
-0.008842606097459793,
0.00007110935257514939,
0.014019407331943512,
0.0059417011216282845,
0.010392974130809307,
0.0004935008473694324,
-0.0008922246051952243,
0.0028633461333811283,
0.007815307006239891,
-0.01298894826322794,
0.0027149550151079893,
-0.0028393894899636507,
-0.000125622667837888,
0.004725850187242031,
-0.003730157157406211,
0.004496161825954914,
0.009265406988561153,
0.0034524763468652964,
-0.007837445475161076,
-0.0026390012353658676,
0.0031706136651337147,
0.005152628291398287,
-0.012537035159766674,
0.0007604121346957982,
-0.0071890936233103275,
-0.004855820909142494,
-0.0024720190558582544,
-0.005036802496761084,
0.00046036485582590103,
0.006865883246064186,
-0.002656468190252781,
0.005552932620048523,
0.0024725771509110928,
-0.004337421618402004,
0.015273363329470158,
-0.004020020365715027,
-0.004943198058754206,
0.002432894427329302,
0.0034989111591130495,
-0.0023010605946183205,
-0.0063348072580993176,
-0.003593387780711055,
0.002938663586974144,
0.00663831876590848,
-0.00029945955611765385,
-0.00674051558598876,
-0.00132125080563128,
0.00040690420428290963,
-0.007402253802865744,
0.001020694267936051,
0.01243376825004816,
-0.0032675471156835556,
0.004902570508420467,
-0.0008700091857463121,
-0.007558337412774563,
-0.012653637677431107,
0.05392734706401825,
-0.001414817525073886,
0.005587845109403133,
0.00528678996488452,
-0.006899201776832342,
-0.0000935221032705158,
-0.002763501601293683,
0.005577713716775179,
-0.005531694274395704,
-0.006829656194895506,
0.00793033093214035,
-0.0016194164054468274,
0.004099773708730936,
0.002581823617219925,
-0.0006681622471660376,
0.014077609404921532,
-0.007086380384862423,
-0.01461214479058981,
-0.016311056911945343,
0.00867446418851614,
-0.003148708026856184,
-0.009355498477816582,
0.010120040737092495,
-0.0037692440673708916,
-0.0048901718109846115,
0.0007105920230969787,
0.006211508996784687,
0.0016548715066164732,
-0.0009268923313356936,
-0.004984250757843256,
-0.0019403945188969374,
-0.0009276850614696741,
0.0021976421121507883,
0.006978633347898722,
0.004655761178582907,
-0.0027483163867145777,
0.0043944623321294785,
-0.004488716367632151,
-0.002500708680599928,
-0.0014421832747757435,
0.004286107141524553,
0.008584858849644661,
-0.0008326274692080915,
-0.002323659835383296,
0.0059742857702076435,
0.003995226230472326,
0.001394020626321435,
0.010052080266177654,
0.0022646489087492228,
-0.005862200167030096,
0.010574938729405403,
0.005465862341225147,
-0.002277252497151494,
0.007077306043356657,
-0.004408934153616428,
0.00643123546615243,
0.0012900270521640778,
-0.006933759897947311,
-0.017162026837468147,
-0.004795139655470848,
0.005437969695776701,
0.008707896806299686,
-0.0021353617776185274,
0.0012546684592962265,
-0.0011708023957908154,
-0.0030281278304755688,
-0.007152287755161524,
-0.006925276014953852,
-0.0007759368745610118,
0.0003619392809923738,
0.003497618017718196,
0.07003414630889893,
-0.007038287818431854,
-0.0018955714767798781,
-0.009267260320484638,
-0.0009049386135302484,
-0.0016318073030561209,
0.0009659279021434486,
0.0021436300594359636,
-0.0014331196434795856,
0.0011710418621078134,
0.0009327872539870441,
-0.009487478993833065,
-0.011631601490080357,
0.0012117307633161545,
0.001722516375593841,
-0.0007397906738333404,
0.002880042651668191,
0.006895286962389946,
-0.01041076797991991,
0.0014568195911124349,
-0.009394347667694092,
-0.003369677346199751,
-0.003168286755681038,
-0.008874931372702122,
-0.003960949834436178,
-0.0021536715794354677,
0.004344869405031204,
0.0032111937180161476,
0.003948235884308815,
-0.002264246577396989,
0.004453861154615879,
-0.004145321901887655,
-0.0002693694841582328,
-0.004668790381401777,
-0.00201470241881907,
-0.005381570663303137,
0.006975430063903332,
0.0019066529348492622,
-0.008240587078034878,
-0.005083115305751562,
-0.0013085334794595838,
-0.0011575128883123398,
-0.006073337513953447,
0.004973323550075293,
-0.0002682714257389307,
0.004933793563395739,
-0.0019497823668643832,
-0.0000047778621592442505,
-0.006770871113985777,
0.0020856382325291634,
-0.015333841554820538,
0.0037785647436976433,
-0.17312675714492798,
0.010358404368162155,
0.0024684101808816195,
-0.004670652095228434,
-0.006456526927649975,
-0.013841284438967705,
-0.003817787626758218,
0.00377619918435812,
0.010020938701927662,
0.001272017601877451,
-0.0028628497384488583,
-0.0015801545232534409,
0.0027206644881516695,
0.0037063821218907833,
0.00018392689526081085,
-0.00536690978333354,
0.0026730443350970745,
-0.0043478538282215595,
0.00020036875503137708,
0.004591114353388548,
0.004640877712517977,
0.010681834071874619,
-0.0000082308242781437,
0.0015092565445229411,
-0.003244201187044382,
-0.004892699420452118,
0.0081305131316185,
-0.0038314724806696177,
0.0031370697543025017,
-0.009122690185904503,
-0.0027890203054994345,
-0.004790801554918289,
-0.004560303874313831,
0.0032648860942572355,
0.006971791386604309,
-0.000935274816583842,
0.007962757721543312,
0.00409000413492322,
-0.008307736366987228,
0.008222891017794609,
-0.007503712549805641,
0.029352840036153793,
0.00689523434266448,
0.007565285544842482,
0.0014222480822354555,
-0.007215968798846006,
-0.003481178777292371,
0.009451459161937237,
0.001003666897304356,
0.012678156606853008,
-0.01113446056842804,
-0.004702358040958643,
0.002264003036543727,
0.018456395715475082,
-0.004564765375107527,
-0.009038018062710762,
-0.0073804548010230064,
-0.002538621425628662,
0.004313505720347166,
0.008735651150345802,
0.009859628975391388,
-0.0023714418057352304,
0.007402431685477495,
-0.003918725065886974,
-0.021581698209047318,
0.0037408967036753893,
-0.004825189709663391,
-0.00788151379674673,
0.0015122281620278955,
0.005019020289182663,
0.010336687788367271,
-0.000006933295026101405,
0.001473519136197865,
0.0005413211183622479,
0.006257920991629362,
-0.00017798032786231488,
0.005950216669589281,
-0.002454509725794196,
0.0035014080349355936,
-0.009277084842324257,
0.008374429307878017,
-0.010813772678375244,
-0.0016470752889290452,
0.0006896319100633264,
-0.0035376062151044607,
0.011780595406889915,
0.004837043583393097,
-0.001909900805912912,
0.0006787110469304025,
-0.008261281996965408,
-0.0019733738154172897,
0.0031643304973840714,
0.0027430944610387087,
-0.009426703676581383,
0.003991845529526472,
-0.0007063141092658043,
0.004877797327935696,
0.005772698670625687,
-0.009218434803187847,
0.005115874111652374,
0.00475792121142149,
-0.007047472056001425,
0.002880214946344495,
-0.004708010237663984,
0.0003282214456703514,
0.0033808404114097357,
-0.004012972116470337,
-0.006106392480432987,
0.0013729793718084693,
-0.0057243285700678825,
-0.007869469001889229,
0.0039998325519263744,
-0.00762700941413641,
-0.009581158868968487,
0.00023156496172305197,
-0.010626625269651413,
0.0011702495394274592
] |
8a8789db154d951e04619fad043530fa0eb6fd39 | 935 | py | Python | amazon/model_api/migrations/0005_remove_order_datetimecreated_alter_order__id_and_more.py | gabrielkarras/SOEN341 | da7241abd894bda4d5f7465b3de70e51afacf3f5 | [
"MIT"
] | 3 | 2022-01-16T19:12:37.000Z | 2022-01-25T18:50:15.000Z | amazon/model_api/migrations/0005_remove_order_datetimecreated_alter_order__id_and_more.py | gabrielkarras/SOEN341 | da7241abd894bda4d5f7465b3de70e51afacf3f5 | [
"MIT"
] | 83 | 2022-01-16T18:57:50.000Z | 2022-03-30T00:44:35.000Z | amazon/model_api/migrations/0005_remove_order_datetimecreated_alter_order__id_and_more.py | gabrielkarras/SOEN341 | da7241abd894bda4d5f7465b3de70e51afacf3f5 | [
"MIT"
] | null | null | null | # Generated by Django 4.0.1 on 2022-04-07 01:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('model_api', '0004_remove_order_created_remove_order_id_and_more'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='dateTimeCreated',
),
migrations.AlterField(
model_name='order',
name='_id',
field=models.AutoField(editable=False, primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='orderedproduct',
name='_id',
field=models.AutoField(editable=False, primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='orderedproduct',
name='price',
field=models.CharField(blank=True, max_length=20, null=True),
),
]
| 28.333333 | 86 | 0.594652 | 1 | 0.9006 | [
0.0013865629443898797,
0.02226179465651512,
0.007037196308374405,
0.003886170918121934,
0.0026999942492693663,
-0.0028669878374785185,
-0.008891556411981583,
0.004240222275257111,
-0.008010274730622768,
0.005737286061048508,
0.0038052171003073454,
0.007425119634717703,
0.006223833188414574,
-0.01848040148615837,
-0.00006064828630769625,
0.01975148357450962,
-0.053778309375047684,
0.002312568947672844,
-0.004109533037990332,
0.001057275920175016,
-0.006777172442525625,
0.007946965284645557,
0.009938627481460571,
0.005579082295298576,
0.006284195464104414,
-0.004601613152772188,
0.009169568307697773,
0.00021286598348524421,
-0.0028326960746198893,
-0.0017913293559104204,
-0.003268065396696329,
-0.0021364358253777027,
-0.004347046371549368,
-0.009044766426086426,
0.005043376702815294,
-0.0026884498074650764,
-0.00005581941513810307,
-0.020153101533651352,
0.01027695182710886,
-0.00463869608938694,
-0.00873532798141241,
-0.018654674291610718,
-0.0021027096081525087,
0.0016130346339195967,
-0.010234979912638664,
0.002528217388316989,
-0.004373343661427498,
0.007212760858237743,
-0.014405675232410431,
0.007541630417108536,
-0.009365116246044636,
0.00565962353721261,
0.01469601783901453,
0.006292845122516155,
-0.007413439452648163,
-0.00728332856670022,
0.01338949240744114,
0.004448781721293926,
-0.010584356263279915,
0.0007976522902026772,
-0.003834886709228158,
-0.002911169081926346,
0.006543262861669064,
0.0019302198197692633,
-0.018414456397294998,
-0.006882517598569393,
-0.0032541186083108187,
0.002054358832538128,
-0.0009812862845137715,
0.0059071858413517475,
-0.0006182907382026315,
-0.003110030200332403,
0.0063102031126618385,
0.005322389304637909,
0.006002753507345915,
-0.00022968417033553123,
-0.0012456338154152036,
0.0007253145449794829,
0.008800579234957695,
0.0028095804154872894,
0.001661940710619092,
-0.006669667549431324,
0.008000916801393032,
0.007813679985702038,
0.016935549676418304,
0.009301980026066303,
0.0196150541305542,
-0.013267160393297672,
0.044347986578941345,
0.00524181267246604,
-0.012464866042137146,
0.004103600978851318,
-0.008060985244810581,
-0.0017423374811187387,
-0.00425758445635438,
-0.028744632378220558,
0.0035594638902693987,
-0.003099336987361312,
-0.001103987917304039,
0.0028830019291490316,
-0.002065710723400116,
0.0053754812106490135,
-0.0031421626918017864,
-0.0008083002758212388,
-0.00909773912280798,
0.015379405580461025,
-0.010323397815227509,
-0.0034704513382166624,
0.00589592382311821,
0.001795377698726952,
-0.00871023815125227,
0.0014355176826938987,
-0.00018793057824950665,
-0.016418779268860817,
0.0021974630653858185,
0.0034442045725882053,
-0.00424456549808383,
0.05221517011523247,
0.0013173678889870644,
0.006017834879457951,
-0.004966019187122583,
0.0028176994528621435,
-0.000010076590115204453,
0.004031868651509285,
0.007368734572082758,
-0.00419722031801939,
0.008978686295449734,
0.005436486564576626,
0.002825773088261485,
0.006051103584468365,
-0.006380368024110794,
0.005887072999030352,
-0.0038800626061856747,
-0.005268930457532406,
-0.00009222738299285993,
-0.007895992137491703,
0.0061799329705536366,
-0.0008255983120761812,
-0.005885547026991844,
0.0018788750749081373,
-0.0030563489999622107,
-0.009987123310565948,
0.00008953675569500774,
-0.003588807536289096,
0.004447105340659618,
-0.01353259477764368,
-0.004470741841942072,
-0.0006145224906504154,
-0.007170799188315868,
0.004427656065672636,
0.008142402395606041,
0.003440306056290865,
0.004460199736058712,
-0.005966369062662125,
-0.007332964334636927,
0.002565784379839897,
-0.0043423534370958805,
0.000621459970716387,
0.003501753555610776,
0.003381061367690563,
-0.010681858286261559,
0.0006219437345862389,
0.0015531983226537704,
0.007547804620116949,
-0.002340405248105526,
0.003928633872419596,
-0.008335615508258343,
0.008117586374282837,
0.002493108855560422,
0.0005048728198744357,
0.0093739228323102,
-0.006976377684623003,
-0.0020499802194535732,
0.001896313508041203,
0.005351616069674492,
0.002446715719997883,
0.003577789757400751,
0.00941062904894352,
-0.002781708724796772,
-0.006705932319164276,
0.0037783982697874308,
0.00556195480749011,
0.008238918147981167,
0.008970597758889198,
-0.0035900825168937445,
0.0029173933435231447,
-0.007412277162075043,
-0.001737654092721641,
0.007771166041493416,
-0.0044517721980810165,
0.007423199713230133,
0.0003681657835841179,
-0.01500526163727045,
-0.006569945719093084,
0.002179273869842291,
-0.007814856246113777,
0.0011273104464635253,
0.016735417768359184,
0.013334715738892555,
-0.001963693182915449,
0.006248938851058483,
-0.00767222186550498,
0.004254132509231567,
0.006913546472787857,
0.001102926442399621,
-0.010924375616014004,
-0.9561415314674377,
0.006774820853024721,
0.0028922513592988253,
0.000327373796608299,
0.0023905232083052397,
0.006677897181361914,
0.0023909946903586388,
0.003388345707207918,
0.014585033059120178,
-0.007492715958505869,
-0.0017315190052613616,
-0.011317542754113674,
-0.011340707540512085,
0.0026755824219435453,
-0.008530854247510433,
-0.0028555472381412983,
-0.006644124630838633,
-0.005345804151147604,
-0.0003333581844344735,
-0.005058040842413902,
-0.003468036185950041,
0.006080832798033953,
-0.0013775757979601622,
0.007718018721789122,
0.0024355356581509113,
0.006973364390432835,
-0.0008679574821144342,
0.0022695381194353104,
-0.0009078487055376172,
0.0015893043018877506,
-0.009381940588355064,
-0.015605969354510307,
-0.005592229776084423,
-0.000626804307103157,
0.009065019898116589,
0.004888390656560659,
0.0068054492585361,
-0.0013475323794409633,
0.0025722088757902384,
-0.009401636198163033,
0.00462518772110343,
-0.0007432321435771883,
0.003196381963789463,
-0.028708774596452713,
0.004741757642477751,
-0.0011168018681928515,
-0.008368861861526966,
0.00635400228202343,
0.00006283562834141776,
0.0003285182756371796,
-0.0037032647524029016,
-0.003784837434068322,
0.008790346793830395,
-0.007849348708987236,
0.0058630662970244884,
-0.005265402607619762,
-0.010816623456776142,
-0.002828664379194379,
-0.010616905055940151,
0.00022780381550546736,
0.00601644441485405,
-0.005568430293351412,
-0.0029739972669631243,
-0.0026304814964532852,
0.0011605097679421306,
0.002616449259221554,
0.004493195563554764,
-0.01989622227847576,
-0.008664879016578197,
-0.000006446777206292609,
-0.0010191278997808695,
-0.007049974985420704,
-0.005886852741241455,
0.006349069066345692,
-0.009758025407791138,
0.008444396778941154,
0.003015016671270132,
0.001337063848040998,
-0.01199768390506506,
0.005118930712342262,
-0.007854631170630455,
-0.00737284729257226,
0.0011714088032022119,
-0.007446037605404854,
-0.006766779813915491,
-0.00062680704286322,
0.0026293147820979357,
0.009160222485661507,
-0.0030873361974954605,
0.006050658877938986,
0.009313865564763546,
-0.0016771683003753424,
-0.009150536730885506,
0.007951767183840275,
0.008522744290530682,
0.0027895860839635134,
-0.0023442304227501154,
0.00008051151962717995,
0.00859435461461544,
0.007252310868352652,
0.004104656632989645,
0.006394097115844488,
0.0019439916359260678,
0.01105688139796257,
-0.0024622175842523575,
0.00019395498384255916,
-0.006614873185753822,
-0.0033365569543093443,
-0.002348516834899783,
-0.00026262184837833047,
-0.00491617526859045,
-0.003597760107368231,
-0.013572168536484241,
-0.007628962397575378,
-0.0026022549718618393,
0.0006611262797378004,
-0.0011065180879086256,
-0.0011280383914709091,
0.0009079418377950788,
0.003450690768659115,
0.00927217397838831,
-0.001946964068338275,
-0.0014671864919364452,
0.00009015035902848467,
0.004011469427496195,
-0.0052911401726305485,
0.016967501491308212,
-0.013886695727705956,
0.004874217323958874,
0.0017290543764829636,
-0.016050219535827637,
0.006569834891706705,
0.010265940800309181,
-0.010275597684085369,
0.003330770181491971,
0.003634215798228979,
0.0014934553764760494,
-0.001413152553141117,
-0.006336878519505262,
-0.001991207944229245,
-0.014692033641040325,
-0.0003471492091193795,
0.021671244874596596,
0.001375868683680892,
0.009594252333045006,
0.011962315067648888,
-0.004711790010333061,
0.0002777239424176514,
0.0032653098460286856,
-0.00041823432547971606,
0.013624124228954315,
-0.00827083270996809,
-0.0031408073846250772,
0.003455633297562599,
-0.006834021769464016,
-0.00027663129731081426,
0.00829614233225584,
0.006046412978321314,
-0.0004268967604730278,
0.002617403632029891,
-0.006342927925288677,
-0.004560887813568115,
-0.019637903198599815,
0.000822799454908818,
0.011269562877714634,
-0.0037250714376568794,
0.0051084100268781185,
-0.015472331084311008,
0.007367498707026243,
0.002930982504040003,
0.0018482502782717347,
0.0008655271376483142,
-0.002991775516420603,
0.008155795745551586,
0.013452787883579731,
-0.005034684669226408,
0.001923982403241098,
0.001969788456335664,
0.00039439700776711106,
-0.0004851709818467498,
0.008524618111550808,
-0.00800443347543478,
-0.0018673070007935166,
0.0015706939157098532,
0.003611946478486061,
0.0014197147684171796,
-0.0022737591061741114,
-0.008582484908401966,
-0.000963958038482815,
0.005290016997605562,
-0.0055541363544762135,
0.005546990316361189,
0.002428267151117325,
0.0024163147900253534,
-0.0023842414375394583,
0.0012551904655992985,
-0.005272767972201109,
-0.010715720243752003,
0.011249333620071411,
-0.0025287449825555086,
0.004246211610734463,
0.011670288629829884,
0.004102443810552359,
-0.011486783623695374,
0.0060428837314248085,
0.007386207580566406,
-0.006324999500066042,
0.005004603415727615,
0.006894377991557121,
-0.006998793222010136,
-0.025949353352189064,
-0.0011415838962420821,
-0.01368175819516182,
0.004977189935743809,
-0.0016248378669843078,
0.006864589173346758,
-0.00565647566691041,
0.00730171101167798,
0.009195019491016865,
-0.01636446639895439,
-0.006487792357802391,
-0.009520457126200199,
0.010264560580253601,
-0.0003889215877279639,
-0.0036906804889440536,
-0.005192996934056282,
-0.0019814008846879005,
-0.00489788968116045,
-0.0014845116529613733,
-0.00291956914588809,
0.004801258910447359,
0.00021119001030456275,
-0.007487943861633539,
-0.0007169700693339109,
-0.004450120497494936,
-0.00009065471385838464,
0.005590094719082117,
-0.009262911975383759,
0.0026886749546974897,
0.00395303824916482,
-0.003041496267542243,
-0.002022684086114168,
-0.000461162329884246,
0.0016410620883107185,
-0.01054108515381813,
-0.013139602728188038,
-0.0012222796212881804,
-0.003728262148797512,
-0.004110356327146292,
-0.009490840137004852,
0.00030903509468771517,
-0.007766726426780224,
0.0017174568492919207,
-0.007840115576982498,
0.00425207894295454,
0.007157679181545973,
-0.0038990683387964964,
0.009103032760322094,
-0.001460477476939559,
0.0030822947155684233,
0.006226725410670042,
0.006418607197701931,
-0.0011777691543102264,
-0.004305369220674038,
-0.01008125301450491,
0.009508983232080936,
-0.009071476757526398,
-0.000566657807212323,
0.013499729335308075,
0.00457807956263423,
0.006152486428618431,
-0.00041353722917847335,
-0.0014591508079320192,
0.0029005121905356646,
0.006051694508641958,
-0.017633721232414246,
0.0018929096404463053,
-0.0011438276851549745,
-0.0007548030116595328,
0.005713202524930239,
-0.0052555943839251995,
-0.0012597638415172696,
0.009759875014424324,
0.002137808594852686,
-0.00842162873595953,
-0.0025005443021655083,
0.002558567561209202,
0.0052429805509746075,
-0.012052556499838829,
-0.00047648439067415893,
-0.004110163543373346,
-0.004349595867097378,
-0.003483806038275361,
-0.006040218751877546,
0.0009301718673668802,
0.0042175711132586,
-0.005637503229081631,
0.005961817689239979,
0.0007845794898457825,
-0.005210416857153177,
0.012215006165206432,
-0.008532905951142311,
-0.005791597533971071,
-0.00026599032571539283,
0.0012750804889947176,
-0.004036995582282543,
-0.008580557070672512,
-0.005909133702516556,
0.0027981181629002094,
0.002932470291852951,
-0.00042421993566676974,
-0.006855451036244631,
0.0013589102309197187,
0.0014737104065716267,
-0.01084959413856268,
0.004691597074270248,
0.011044458486139774,
0.0004153034242335707,
0.004949724301695824,
-0.0016537121264263988,
-0.009579531848430634,
-0.01864892803132534,
0.0543280653655529,
-0.002044284949079156,
0.00401859637349844,
0.0033340398222208023,
-0.005231225397437811,
-0.004803966730833054,
-0.0007617668015882373,
0.0069890194572508335,
-0.006742412224411964,
-0.005667316727340221,
0.010283224284648895,
-0.0024813800118863583,
0.0008948223548941314,
-0.0014375264290720224,
-0.0007976981578394771,
0.014637351036071777,
-0.004452743101865053,
-0.017549529671669006,
-0.016055192798376083,
0.0096050463616848,
-0.001025928882881999,
-0.0068415808491408825,
0.010487733408808708,
0.0003065331547986716,
-0.001515412819571793,
0.0038323039188981056,
0.009423399344086647,
0.0027747645508497953,
-0.00189835240598768,
-0.003528119530528784,
-0.0005060443072579801,
0.001532574649900198,
0.0038304580375552177,
0.006166989449411631,
0.008724672719836235,
-0.0016016034642234445,
0.007087243255227804,
-0.004175692796707153,
0.00024867241154424846,
-0.0020054036285728216,
0.00478140776976943,
0.005003705620765686,
-0.002856865990906954,
-0.00047047826228663325,
0.004821807146072388,
0.005480994936078787,
0.0026266458444297314,
0.011539838276803493,
0.001051556784659624,
-0.005346786696463823,
0.011732356622815132,
0.008556287735700607,
0.00015075315604917705,
0.007659191731363535,
-0.0033135823905467987,
0.005324327852576971,
0.0026452436577528715,
-0.010097608901560307,
-0.013857493177056313,
-0.005530407652258873,
0.007236775476485491,
0.005956118926405907,
-0.004198798444122076,
0.0018419214757159352,
-0.0030514581594616175,
-0.0017935746582224965,
-0.0057960920967161655,
-0.004988505505025387,
-0.006161967292428017,
0.002480635652318597,
0.007578123360872269,
0.06936897337436676,
-0.007488655392080545,
-0.004626262467354536,
-0.007907449267804623,
0.000023529504687758163,
-0.002376236952841282,
-0.0020025335252285004,
0.0020846042316406965,
-0.002462887903675437,
0.005304677411913872,
0.000005327133294485975,
-0.00661088339984417,
-0.010171649977564812,
0.00026536412769928575,
-0.0001472127332817763,
-0.0031987649854272604,
0.0033370554447174072,
0.005682643037289381,
-0.01129357423633337,
0.001502544735558331,
-0.01249526347965002,
-0.006481228396296501,
-0.004520736634731293,
-0.008990101516246796,
-0.0020447620190680027,
-0.0048598055727779865,
-0.00046761755947954953,
0.003273994429036975,
0.00812824908643961,
-0.004471470136195421,
0.008692183531820774,
-0.0019131634617224336,
0.0017223481554538012,
-0.004759477451443672,
0.00039592565735802054,
-0.00538557069376111,
0.008106262423098087,
0.0016028789104893804,
-0.008287070319056511,
-0.0025071704294532537,
-0.005517494399100542,
-0.0005428401636891067,
-0.005414236336946487,
0.0032569710165262222,
-0.0005223656189627945,
0.006629955023527145,
-0.0005249271634966135,
0.0024034150410443544,
-0.0026645984034985304,
0.0015253516612574458,
-0.012512889690697193,
0.006608704570680857,
-0.18077144026756287,
0.007652407046407461,
0.0011657510185614228,
-0.008044899441301823,
-0.003325185738503933,
-0.014314016327261925,
-0.007148897275328636,
0.006838710978627205,
0.009793060831725597,
0.003566861618310213,
-0.0034712557680904865,
-0.002207244047895074,
0.0038270517252385616,
0.0037000535521656275,
-0.0021320900414139032,
-0.007833254523575306,
0.0037416908890008926,
-0.00795893743634224,
-0.0003791635681409389,
0.00435074046254158,
0.004832547158002853,
0.01251189224421978,
-0.0006545842043124139,
-0.0006921876920387149,
0.0013740209396928549,
-0.0033428529277443886,
0.010057247243821621,
-0.005129558499902487,
0.0046432968229055405,
-0.00865858979523182,
-0.0033542311284691095,
-0.006000876426696777,
-0.004321454558521509,
0.002370718866586685,
0.004346493631601334,
0.002530119614675641,
0.008181119337677956,
-0.001049216603860259,
-0.008279775269329548,
0.00979785155504942,
-0.009812533855438232,
0.025744160637259483,
0.007433723658323288,
0.005219583865255117,
0.0027365009300410748,
-0.005700398702174425,
-0.0037454385310411453,
0.007547107990831137,
0.0015187272801995277,
0.011021400801837444,
-0.014413460157811642,
-0.003674777690321207,
0.003319814568385482,
0.018275577574968338,
-0.006254076026380062,
-0.012234286405146122,
-0.00602194108068943,
-0.0064096334390342236,
-0.000507504038978368,
0.007560933008790016,
0.009091254323720932,
-0.0014147378969937563,
0.010096046142280102,
-0.003688948694616556,
-0.02241332083940506,
0.0022949031554162502,
-0.0014298984315246344,
-0.008928569033741951,
0.005561736412346363,
0.00453412439674139,
0.008206305094063282,
-0.001121747074648738,
0.0025809311773627996,
0.0006242023082450032,
0.00443566869944334,
-0.001190010691061616,
0.010915594175457954,
0.0006360841216519475,
0.005990402773022652,
-0.007520586717873812,
0.005215248093008995,
-0.006542852148413658,
-0.0038932200986891985,
0.0037484874483197927,
-0.0006885654875077307,
0.01104852557182312,
0.003781438572332263,
-0.001937807654030621,
-0.0010980028891935945,
-0.006957560777664185,
-0.0016387387877330184,
0.0016860798932611942,
0.0002752759901341051,
-0.006057273596525192,
-0.0006456018309108913,
0.002535780891776085,
0.0037388226483017206,
0.008460753597319126,
-0.007220052182674408,
0.008029336109757423,
0.005276261828839779,
-0.004594049882143736,
-0.0001649579353397712,
-0.007017594296485186,
0.0050240978598594666,
0.0018235836178064346,
-0.0065832906402647495,
-0.005931731779128313,
-0.00110599584877491,
-0.005166905932128429,
-0.005975129548460245,
0.007412038277834654,
-0.007912824861705303,
-0.011009781621396542,
-0.0005427499418146908,
-0.007985690608620644,
0.0035304510965943336
] |
8a88b11de563042688caafdaffa71f1207edee67 | 8,082 | py | Python | items/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | 1 | 2020-05-06T16:59:47.000Z | 2020-05-06T16:59:47.000Z | items/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | null | null | null | items/migrations/0001_initial.py | tony-joseph/livre | 3a6a851ed58029d5d14edde647b15ed22d65f24b | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-21 12:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='BookCopy',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('book_status', models.IntegerField(choices=[(1, 'Available'), (2, 'In Circulation'), (3, 'Temporarily Unavailable'), (4, 'Unavailable'), (5, 'Protected'), (6, 'Damaged')])),
('remarks', models.TextField(blank=True, default='')),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='BookDetail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=1024)),
('author', models.CharField(default='Unknown', max_length=1024)),
('description', models.TextField(blank=True, default='')),
('publisher', models.CharField(blank=True, default='', max_length=512)),
('published_on', models.DateField(blank=True, null=True)),
('pages', models.PositiveIntegerField(blank=True, default=0, null=True)),
('ddc', models.CharField(blank=True, default='', max_length=1024)),
('llcc', models.CharField(blank=True, default='', max_length=1024)),
('isbn', models.CharField(blank=True, default='', max_length=1024)),
('tags', models.CharField(blank=True, max_length=1024, null=True)),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=512)),
('slug', models.SlugField(max_length=128, unique=True)),
('description', models.TextField(blank=True, default='')),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('updated_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='category_updated_by', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Language',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=512)),
('short_code', models.CharField(db_index=True, max_length=8, unique=True)),
('description', models.TextField(blank=True, default='')),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('updated_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='language_updated_by', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Periodical',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=1024)),
('description', models.TextField(blank=True, default='')),
('publisher', models.CharField(blank=True, default='', max_length=512)),
('tags', models.CharField(blank=True, max_length=1024, null=True)),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.Category')),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('language', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.Language')),
('updated_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='periodical_updated_by', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='PeriodicalIssue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('issue_status', models.IntegerField(choices=[(1, 'Available'), (2, 'In Circulation'), (3, 'Temporarily Unavailable'), (4, 'Unavailable'), (5, 'Protected'), (6, 'Damaged')])),
('published_on', models.DateField(blank=True, null=True)),
('volume', models.PositiveIntegerField(blank=True, null=True)),
('issue', models.PositiveIntegerField(blank=True, null=True)),
('remarks', models.TextField(blank=True, default='')),
('tags', models.CharField(blank=True, max_length=1024, null=True)),
('created_on', models.DateTimeField(auto_now_add=True)),
('updated_on', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('periodical', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.Periodical')),
('updated_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='periodical_issue_updated_by', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='bookdetail',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.Category'),
),
migrations.AddField(
model_name='bookdetail',
name='created_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='bookdetail',
name='language',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.Language'),
),
migrations.AddField(
model_name='bookdetail',
name='updated_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='book_detail_updated_by', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='bookcopy',
name='book_detail',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='items.BookDetail'),
),
migrations.AddField(
model_name='bookcopy',
name='created_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='bookcopy',
name='updated_by',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='book_copy_updated_by', to=settings.AUTH_USER_MODEL),
),
]
| 56.915493 | 191 | 0.614081 | 1 | 1.7826 | [
-0.01775747910141945,
0.021457860246300697,
-0.011418633162975311,
0.032887183129787445,
-0.025094682350754738,
-0.0027693856973201036,
-0.024829525500535965,
-0.020204177126288414,
-0.047900158911943436,
0.04691542685031891,
-0.006568843964487314,
-0.0022713360376656055,
0.025317683815956116,
0.023448245599865913,
-0.007188256364315748,
0.0063497391529381275,
0.06977138668298721,
-0.03366762027144432,
0.003962663933634758,
-0.012354644015431404,
-0.02280762419104576,
0.026878340169787407,
0.02735109254717827,
0.039536405354738235,
0.043758686631917953,
-0.02362934872508049,
0.02998163551092148,
0.01426622923463583,
-0.009483096189796925,
-0.022116709500551224,
-0.012796349823474884,
-0.008620440028607845,
-0.014046844094991684,
-0.02569226734340191,
0.005551949609071016,
0.022251777350902557,
0.011020663194358349,
-0.051424283534288406,
-0.011532856151461601,
0.006544333882629871,
0.007091895677149296,
-0.025779657065868378,
-0.01205829344689846,
-0.03071332722902298,
0.007658950053155422,
-0.033595167100429535,
-0.01901724375784397,
0.01469144131988287,
-0.042812783271074295,
0.00685527641326189,
0.010707633569836617,
-0.01780075766146183,
-0.021015582606196404,
-0.01625426858663559,
0.02829424850642681,
-0.07139941304922104,
-0.008319811895489693,
0.029595309868454933,
-0.04259224981069565,
0.023463815450668335,
0.002353428862988949,
-0.004945521708577871,
-0.009475870989263058,
0.004797346889972687,
0.008322957903146744,
0.017496777698397636,
0.03511136770248413,
-0.011038276366889477,
-0.025219598785042763,
-0.03821461275219917,
0.012115965597331524,
-0.0007690081838518381,
-0.016638202592730522,
0.05234239622950554,
-0.01423670444637537,
0.03762577474117279,
-0.027380267158150673,
-0.038538236171007156,
-0.01438067015260458,
0.04253816977143288,
-0.008695031516253948,
0.07923121005296707,
0.014520825818181038,
-0.01656293123960495,
0.027660299092531204,
0.03610959276556969,
0.05279816314578056,
-0.05357673391699791,
0.056983210146427155,
0.018436824902892113,
-0.031650103628635406,
0.0315287820994854,
0.005464811809360981,
0.005972500424832106,
-0.058878544718027115,
-0.02680126018822193,
0.019795624539256096,
0.03022506646811962,
-0.0035050015430897474,
0.0038730402011424303,
0.0013713173102587461,
-0.02957877703011036,
0.033154819160699844,
0.014277881011366844,
-0.01267944648861885,
-0.018835524097085,
-0.07140284031629562,
-0.004265318159013987,
-0.0006535634747706354,
0.00196376396343112,
0.0233473964035511,
0.0034416494891047478,
-0.0022248621098697186,
-0.04334208741784096,
-0.006037469487637281,
-0.022744126617908478,
0.021650755777955055,
0.010324930772185326,
-0.012150250375270844,
0.00026214797981083393,
-0.009455765597522259,
-0.004743045661598444,
-0.013686781749129295,
-0.0019853170961141586,
-0.019142398610711098,
0.05436772108078003,
-0.0059489719569683075,
0.01299254409968853,
0.039790622889995575,
0.008803777396678925,
-0.006878762040287256,
-0.007122885901480913,
0.01403870154172182,
-0.05234994739294052,
0.009980650618672371,
-0.006560675799846649,
-0.005963319446891546,
-0.002295469166710973,
-0.0401909314095974,
0.00503226974979043,
0.02476937137544155,
-0.03405272588133812,
0.01425196509808302,
-0.03857506811618805,
-0.033919766545295715,
-0.03339387848973274,
0.010183951817452908,
0.01511514000594616,
-0.020122507587075233,
-0.010468361899256706,
-0.013457412831485271,
0.005051972344517708,
-0.018732432276010513,
0.029862817376852036,
-0.015132663771510124,
-0.027611462399363518,
-0.011846127919852734,
-0.05867035686969757,
-0.024240488186478615,
-0.02445235289633274,
-0.032466866075992584,
-0.0006202324875630438,
-0.02125086821615696,
0.00741574726998806,
-0.0013006237568333745,
0.03245251253247261,
-0.023818667978048325,
0.0006320365355350077,
-0.010507638566195965,
0.005358328111469746,
-0.017178017646074295,
0.003339608898386359,
-0.015631072223186493,
-0.030394719913601875,
-0.018609128892421722,
0.030660303309559822,
0.02233615331351757,
-0.008415622636675835,
0.023530909791588783,
0.01025679986923933,
0.007096676621586084,
-0.0269668810069561,
-0.013577406294643879,
0.014606237411499023,
-0.001533622620627284,
0.011911457404494286,
-0.017409672960639,
0.011629505082964897,
-0.00984112173318863,
-0.036184266209602356,
-0.017264239490032196,
0.012066943570971489,
0.005964658688753843,
-0.016360651701688766,
0.02396896854043007,
0.005246343556791544,
0.011059143580496311,
0.03973761200904846,
0.0297075305134058,
-0.018657943233847618,
0.02446558326482773,
-0.014851132407784462,
0.019864019006490707,
0.014918141067028046,
-0.006978326477110386,
-0.012769395485520363,
-0.7349112033843994,
0.005721980705857277,
0.020124129951000214,
-0.02665894664824009,
0.00956790056079626,
0.04799551144242287,
-0.06354719400405884,
0.05132953077554703,
-0.040942154824733734,
0.03738686814904213,
0.0014032345497980714,
-0.015028762631118298,
-0.03133109584450722,
-0.03491189330816269,
0.013010048307478428,
-0.030732737854123116,
0.016236891970038414,
0.0024063207674771547,
0.043776486068964005,
0.011262155137956142,
-0.0020774570293724537,
0.019195912405848503,
-0.0059737092815339565,
0.008200489915907383,
0.01257002167403698,
0.012937337160110474,
0.05995141342282295,
-0.004121558275073767,
0.0034744818694889545,
-0.011767478659749031,
-0.015258300118148327,
-0.021687142550945282,
-0.0018012620275840163,
-0.021384667605161667,
-0.00457337498664856,
0.003979042638093233,
0.00017442376702092588,
-0.007971798069775105,
0.010834692046046257,
-0.02126479521393776,
-0.009292061440646648,
-0.040814630687236786,
-0.027121728286147118,
-0.058918509632349014,
-0.022550638765096664,
-0.019720587879419327,
-0.023444896563887596,
-0.0214543379843235,
0.012179023586213589,
-0.012261523865163326,
-0.021274523809552193,
0.06217052787542343,
0.007724612019956112,
-0.012280059047043324,
-0.014154624193906784,
0.008366105146706104,
-0.0006437852280214429,
-0.010445608757436275,
0.011247877962887287,
-0.02080860175192356,
0.033189721405506134,
-0.008326358161866665,
-0.03021250106394291,
0.006945168133825064,
-0.00427978252992034,
-0.004734272602945566,
0.05795403942465782,
-0.009790281765162945,
-0.03967177867889404,
0.024678803980350494,
-0.03206058219075203,
-0.006990383379161358,
-0.02514251321554184,
0.12573593854904175,
0.014869438484311104,
0.01349076721817255,
0.026684829965233803,
-0.008390608243644238,
-0.03528473153710365,
0.008543668314814568,
0.03868478164076805,
-0.022697698324918747,
-0.014264878816902637,
-0.009343128651380539,
-0.02219262346625328,
0.0016909640980884433,
-0.003707700176164508,
-0.010278548114001751,
-0.001300554140470922,
-0.0009598736651241779,
0.022312281653285027,
0.05035201087594032,
-0.019384361803531647,
-0.025101009756326675,
0.013472630642354488,
0.024919703602790833,
0.0023626850452274084,
0.018995679914951324,
0.004564042668789625,
0.029352951794862747,
-0.04250021278858185,
-0.007250234019011259,
-0.007719423156231642,
0.03394254669547081,
0.039799634367227554,
0.03231078013777733,
-0.04466063529253006,
-0.006758279167115688,
0.06913893669843674,
0.013780009001493454,
-0.02252831868827343,
-0.025800758972764015,
-0.02791157178580761,
-0.0019336177501827478,
0.012577389366924763,
-0.01972561702132225,
0.004200754687190056,
-0.045963093638420105,
0.030869826674461365,
-0.0028689035680145025,
-0.040223363786935806,
0.01679222472012043,
0.04250453785061836,
0.001996717182919383,
0.0008482186240144074,
0.015314522199332714,
-0.043532948940992355,
-0.006044509820640087,
-0.011668175458908081,
0.03696957603096962,
-0.002619456499814987,
-0.02478179521858692,
-0.0009465118055231869,
0.007826621644198895,
0.014513823203742504,
0.02116399072110653,
-0.018370434641838074,
-0.036509934812784195,
0.01047781016677618,
0.016047818586230278,
-0.012592090293765068,
-0.03156089037656784,
0.016866156831383705,
-0.03102041222155094,
0.012742687948048115,
0.000683601712808013,
0.001065351301804185,
0.020392781123518944,
-0.01131171453744173,
-0.020706411451101303,
0.017106354236602783,
0.005448892712593079,
-0.004668269772082567,
-0.023360030725598335,
0.0017424467951059341,
0.01922181248664856,
0.004619209561496973,
-0.020115850493311882,
0.016181275248527527,
0.0099721634760499,
0.00619907770305872,
-0.007103809621185064,
-0.015106172300875187,
0.00841494183987379,
0.01233607530593872,
-0.006873755715787411,
0.005065965931862593,
0.033456217497587204,
0.06839123368263245,
0.0028506177477538586,
-0.0025195807684212923,
0.006369504611939192,
0.02593853510916233,
0.0038246840704232454,
0.026059256866574287,
0.010328182950615883,
-0.005800248123705387,
-0.05416349321603775,
0.024937592446804047,
-0.02075435034930706,
0.008904200978577137,
0.01602010615170002,
-0.01198478601872921,
0.014634636230766773,
0.00253063952550292,
0.030835924670100212,
0.005203957669436932,
-0.003567861393094063,
-0.000724482408259064,
0.0057012964971363544,
0.016170913353562355,
0.013804021291434765,
-0.0010529592400416732,
0.02072986774146557,
-0.0377763994038105,
-0.005922370124608278,
-0.013853523880243301,
-0.006122960243374109,
-0.003767279675230384,
-0.023263076320290565,
0.0012408433249220252,
0.007006439380347729,
0.013500465080142021,
-0.01846279390156269,
0.013391315937042236,
0.03966556489467621,
-0.004521030932664871,
-0.004751378204673529,
0.022138789296150208,
-0.027101192623376846,
0.027873052284121513,
0.009928622283041477,
0.04340649023652077,
-0.0071579283103346825,
-0.007753489539027214,
0.004201051779091358,
-0.02276766486465931,
0.003399227513000369,
0.02834717370569706,
-0.042586687952280045,
-0.02652069926261902,
-0.03372557833790779,
0.01953100971877575,
0.02194623462855816,
-0.023400291800498962,
-0.013259109109640121,
-0.03571537137031555,
0.0026011450681835413,
-0.01655525155365467,
0.01332859043031931,
0.021150795742869377,
-0.017390653491020203,
-0.0006515479180961847,
-0.03240685164928436,
0.016214219853281975,
-0.004609046038240194,
-0.02219993993639946,
-0.002190818078815937,
-0.03297477588057518,
-0.05161037668585777,
-0.006248848978430033,
-0.0028420595917850733,
-0.0005363115342333913,
0.047139428555965424,
-0.02230602316558361,
0.018421979621052742,
0.013974594883620739,
-0.01048603467643261,
-0.027010370045900345,
-0.000853267963975668,
-0.012292598374187946,
0.034024495631456375,
-0.01495226938277483,
0.021990593522787094,
0.022266196087002754,
0.025884581729769707,
-0.002919328399002552,
0.00804729014635086,
0.00654571270570159,
0.01792602613568306,
0.020701324567198753,
-0.00908892136067152,
-0.006553076673299074,
0.00031979865161702037,
-0.016635136678814888,
0.0014063079142943025,
-0.01729397289454937,
-0.0008366536349058151,
0.009725695475935936,
0.025927480310201645,
0.0018027398036792874,
-0.006765172351151705,
-0.021135879680514336,
0.0173658337444067,
-0.02816201001405716,
0.015550888143479824,
-0.02295016497373581,
-0.02884720452129841,
0.020744508132338524,
0.02468232251703739,
-0.018230289220809937,
0.011285246349871159,
-0.02212413214147091,
0.028269052505493164,
-0.008424315601587296,
0.0038944499101489782,
0.031606946140527725,
-0.015625547617673874,
-0.02993650920689106,
-0.011674893088638783,
-0.007144372444599867,
-0.03241176903247833,
0.0116825420409441,
-0.028055012226104736,
-0.024353615939617157,
0.001875520683825016,
-0.0143051752820611,
-0.02917391061782837,
0.01866067387163639,
0.026212269440293312,
0.02613038569688797,
-0.0016807295614853501,
0.011945557780563831,
-0.004483046475797892,
0.016742339357733727,
-0.03748676925897598,
0.02928459271788597,
-0.03161729499697685,
0.03072156384587288,
0.00016758970741648227,
0.009588425047695637,
0.022346515208482742,
0.019335465505719185,
0.003116775769740343,
-0.008859321475028992,
0.0011043493868783116,
0.02150869183242321,
0.04245214909315109,
0.01330935675650835,
-0.0005748078692704439,
-0.0013106135884299874,
-0.028308896347880363,
-0.013826688751578331,
-0.023822668939828873,
0.011720099486410618,
-0.04733368754386902,
-0.008885442279279232,
-0.0027612182311713696,
0.010120944119989872,
0.03182543069124222,
-0.0030293383169919252,
0.0006246891571208835,
0.027971070259809494,
0.02566009946167469,
0.007085621356964111,
-0.02794763632118702,
0.00880491267889738,
0.03388618677854538,
0.03153529763221741,
0.00014042865950614214,
-0.03941943123936653,
-0.005455706734210253,
0.003858124604448676,
-0.008350053802132607,
0.016884388402104378,
0.032615382224321365,
0.019470110535621643,
0.044503070414066315,
0.057012446224689484,
0.022765053436160088,
0.018023837357759476,
-0.025907250121235847,
-0.021872377023100853,
-0.026505040004849434,
0.011684982106089592,
-0.013445323333144188,
-0.021331124007701874,
0.008474866859614849,
0.0004339445731602609,
-0.009293383918702602,
0.03387077897787094,
-0.0018654525047168136,
-0.017341913655400276,
0.0028001454193145037,
-0.009744557552039623,
-0.02192140743136406,
0.015922069549560547,
0.0034766243770718575,
0.007691376842558384,
0.060275547206401825,
0.025592880323529243,
-0.022307245060801506,
-0.0008269803365692496,
0.00037228537257760763,
0.01899343729019165,
0.01848011463880539,
0.07257548719644547,
0.002583262976258993,
-0.023262426257133484,
-0.020752662792801857,
-0.028632836416363716,
-0.03373073413968086,
0.014624676667153835,
-0.029103251174092293,
0.027574611827731133,
-0.017287669703364372,
-0.016914835199713707,
0.016996610909700394,
0.004486904479563236,
-0.024810058996081352,
0.019554849714040756,
-0.018824411556124687,
0.04256189242005348,
0.029636584222316742,
-0.0200470183044672,
0.005660349503159523,
-0.032767828553915024,
-0.014437923207879066,
0.012622973881661892,
-0.015144155360758305,
-0.01661692187190056,
-0.0123512614518404,
-0.0079308757558465,
-0.026476139202713966,
-0.009997379034757614,
0.00731491856276989,
0.03455929085612297,
0.0019387732027098536,
-0.015324641950428486,
0.04012833908200264,
-0.014221129938960075,
0.020906668156385422,
-0.009378896094858646,
-0.003355293534696102,
0.02887669764459133,
-0.02823469415307045,
-0.02181531861424446,
0.01951250061392784,
-0.033536870032548904,
-0.010984251275658607,
-0.001151114935055375,
-0.008732245303690434,
-0.004358241800218821,
0.003773240139707923,
-0.030478931963443756,
-0.011055788025259972,
0.023558970540761948,
0.03800768032670021,
0.009382846765220165,
0.007573348935693502,
0.009106073528528214,
0.021402085199952126,
0.007409765385091305,
0.005705731455236673,
0.000054854172049090266,
-0.03547278046607971,
-0.024264240637421608,
-0.043941620737314224,
0.011816197074949741,
0.008798904716968536,
-0.0017304390203207731,
0.0009720177622511983,
0.009908720850944519,
0.015578490681946278,
-0.019420655444264412,
0.04963746294379234,
0.026334838941693306,
0.018158569931983948,
-0.007020172197371721,
-0.011741395108401775,
-0.0004565096751321107,
0.0024924064055085182,
0.031997814774513245,
0.02159329131245613,
0.008348706178367138,
0.00005307265018927865,
0.03652016445994377,
0.0256069153547287,
0.0017080164980143309,
-0.005585016682744026,
-0.031608205288648605,
0.015601973049342632,
-0.0077925738878548145,
0.04490388557314873,
0.016329817473888397,
0.02089039422571659,
0.00899317767471075,
-0.032469477504491806,
0.010343827307224274,
-0.024191293865442276,
0.0071097551845014095,
0.02237522043287754,
-0.02435201220214367,
0.007772795855998993,
0.009409703314304352,
-0.022527141496539116,
-0.02081369422376156,
0.015597255900502205,
-0.009753244929015636,
-0.006706159561872482,
-0.02087508700788021,
0.010877763852477074,
0.02873995713889599,
0.044808074831962585,
0.0008088078466244042,
-0.03722531720995903,
-0.033232029527425766,
-0.003068756777793169,
-0.001958316657692194,
0.008557375520467758,
-0.01223174761980772,
-0.013378157280385494,
-0.011609269306063652,
0.040828634053468704,
0.0015296486672013998,
-0.003103364259004593,
0.04332241415977478,
-0.03799773380160332,
0.07655730098485947,
-0.010941841639578342,
-0.04754314944148064,
-0.0558069683611393,
-0.011548938229680061,
-0.022888807579874992,
0.021364878863096237,
0.007604676298797131,
0.0784459188580513,
0.03867952153086662,
-0.016632363200187683,
-0.028054721653461456,
-0.029692230746150017,
0.005412030965089798,
-0.020162170752882957,
0.01766098290681839,
-0.0009647891856729984,
0.008811560459434986,
0.06249329075217247,
-0.04078967496752739,
0.0002570370561443269,
0.038801077753305435,
-0.00312790391035378,
0.04137735068798065,
0.026269463822245598,
0.01924535445868969,
-0.026443196460604668,
-0.009415797889232635,
-0.01950833946466446,
-0.01421172171831131,
0.014226914383471012,
0.0007395370630547404,
-0.008294480852782726,
-0.008448616601526737,
-0.012815605849027634,
-0.01076301746070385,
-0.015451253391802311,
-0.052819687873125076,
0.021937713027000427,
0.027669453993439674,
-0.05962742120027542,
-0.0024633293505758047,
0.03542878478765488,
0.007430477067828178,
0.0028605114202946424,
-0.02627205103635788,
-0.010825891979038715,
-0.027599873021245003,
-0.003319119568914175,
-0.026344669982790947,
0.03128710016608238,
0.0014670876553282142,
-0.00006918067811056972,
-0.03810139372944832,
0.008418449200689793,
-0.015646234154701233,
-0.02957540564239025,
0.017232926562428474,
-0.007665529847145081,
0.006016144994646311,
-0.009770835749804974,
-0.04578256607055664,
0.00839956384152174,
0.035300031304359436
] |
8a894222f80aae1db1ccdaaadeb6288f55d6b62f | 267 | py | Python | compliance_suite/exceptions/user_config_exception.py | alextsaihi/rnaget-compliance-suite | a3accae431b9e4f7791dfa5ae867e70da2dd6278 | [
"Apache-2.0"
] | 1 | 2019-09-18T14:38:55.000Z | 2019-09-18T14:38:55.000Z | compliance_suite/exceptions/user_config_exception.py | alextsaihi/rnaget-compliance-suite | a3accae431b9e4f7791dfa5ae867e70da2dd6278 | [
"Apache-2.0"
] | 14 | 2019-05-24T18:55:23.000Z | 2022-02-25T16:56:28.000Z | compliance_suite/exceptions/user_config_exception.py | alextsaihi/rnaget-compliance-suite | a3accae431b9e4f7791dfa5ae867e70da2dd6278 | [
"Apache-2.0"
] | 8 | 2019-04-08T14:48:35.000Z | 2022-02-04T16:59:59.000Z | # -*- coding: utf-8 -*-
"""Module compliance_suite.exceptions.user_config_exception.py
This module contains class definition for user config file exceptions.
"""
class UserConfigException(Exception):
"""Exception for user config file-related errors"""
pass | 26.7 | 70 | 0.752809 | 0 | 0 | [
0.0017259720480069518,
0.021119529381394386,
0.006974466145038605,
0.0059317052364349365,
0.0055254860781133175,
-0.004335017409175634,
-0.010226165875792503,
0.002252955688163638,
-0.0068549057468771935,
0.0023774495348334312,
0.0006486648926511407,
0.005682362709194422,
0.008084463886916637,
-0.01708858087658882,
-0.001053746324032545,
0.018533123657107353,
-0.055962055921554565,
0.0024631046690046787,
-0.004945122171193361,
0.003916664980351925,
-0.005943284370005131,
0.00972004234790802,
0.004665186628699303,
0.004271881654858589,
0.005673229228705168,
0.0014481574762612581,
0.009933759458363056,
0.0010895617306232452,
-0.009524418972432613,
-0.004513875115662813,
-0.00017417193157598376,
-0.00028712250059470534,
-0.003176788566634059,
-0.008531819097697735,
0.006671943236142397,
-0.0021079101134091616,
-0.00029725852073170245,
-0.018545527011156082,
0.008832446299493313,
-0.0043898774310946465,
-0.007105571683496237,
-0.01882847025990486,
-0.00442566629499197,
0.003783941036090255,
-0.00959254801273346,
0.008481834083795547,
-0.003520427970215678,
0.0036345943808555603,
-0.013515111058950424,
0.006078124046325684,
-0.008456268347799778,
0.008638868108391762,
0.012575173750519753,
0.0008790214778855443,
-0.009668922983109951,
-0.003681905334815383,
0.01255266647785902,
0.004438390489667654,
-0.01077897660434246,
0.0037663166876882315,
-0.0023833243176341057,
-0.0032804827205836773,
0.006418267264962196,
0.002609782386571169,
-0.015791811048984528,
-0.0045574260875582695,
-0.0032338029704988003,
0.0001631953928153962,
-0.003688654862344265,
0.0055251093581318855,
0.001212230883538723,
-0.004555018153041601,
0.00865051057189703,
0.0063235582783818245,
0.0065825991332530975,
-0.0038489520084112883,
-0.0015375025104731321,
0.0008785767131485045,
0.00885697640478611,
0.002707462524995208,
0.00528849009424448,
-0.006605020258575678,
0.006193085573613644,
0.00579956965520978,
0.012339522130787373,
0.011690042912960052,
0.0197523832321167,
-0.011079897172749043,
0.04846808686852455,
0.006289815995842218,
-0.01248987391591072,
0.004988642409443855,
-0.010031405836343765,
-0.0022213663905858994,
-0.00959858950227499,
-0.032539866864681244,
0.002977462485432625,
-0.0032743753399699926,
0.0004657774115912616,
0.007580307777971029,
-0.0005095148226246238,
0.005744207184761763,
-0.0036136882845312357,
0.0006885745679028332,
-0.012242034077644348,
0.011466597206890583,
-0.013755022548139095,
-0.0011933641508221626,
0.004495211411267519,
0.0003235736221540719,
-0.011257510632276535,
-0.000011921869372599758,
0.000829127209726721,
-0.013453644700348377,
0.003244057297706604,
0.005005336366593838,
-0.0029258045833557844,
0.05291581153869629,
0.0019615511409938335,
0.008973091840744019,
-0.004413950722664595,
-0.0009285968262702227,
0.0014748175162822008,
0.0032533055637031794,
0.011500416323542595,
-0.0027038720436394215,
0.007089098449796438,
0.0013173917541280389,
-0.0008930090698413551,
0.0056261480785906315,
-0.0025609638541936874,
0.005952715873718262,
-0.003134725149720907,
-0.0016668449388816953,
0.0009758786181919277,
-0.007343788165599108,
0.005167154595255852,
-0.00018298147188033909,
-0.006960117258131504,
0.000024283148377435282,
-0.0015426307218149304,
-0.00941022764891386,
-0.0008667553775012493,
-0.0016145416302606463,
0.0022743321023881435,
-0.01304255984723568,
-0.008227980695664883,
-0.0031145038083195686,
-0.0028218282386660576,
0.002468833001330495,
0.007566864602267742,
0.007209602277725935,
0.003035956993699074,
-0.003459146013483405,
-0.006005912087857723,
0.00016609604062978178,
-0.007346745580434799,
-0.001765457564033568,
0.009509843774139881,
0.004909716546535492,
-0.011170176789164543,
-0.00031797547126188874,
0.0027776798233389854,
0.00679438654333353,
0.0003623610537033528,
0.001593237742781639,
-0.005931120831519365,
0.009092537686228752,
0.001931560691446066,
0.0065536280162632465,
0.01068029273301363,
-0.003694420214742422,
0.0005406268173828721,
-0.000651208742056042,
0.0014508682070299983,
0.0038615893572568893,
0.003960986156016588,
0.00816942099481821,
-0.0029521326068788767,
-0.006755271926522255,
0.004136892035603523,
0.00580309983342886,
0.008811886422336102,
0.008748676627874374,
-0.0006879976717755198,
0.000875688623636961,
-0.005059540271759033,
0.00041908089770004153,
0.007536596152931452,
-0.008055818267166615,
0.009942769072949886,
0.0014926842413842678,
-0.015814777463674545,
-0.0077676777727901936,
-0.0005514571093954146,
-0.006363618187606335,
0.0008822044474072754,
0.014936394058167934,
0.014024692587554455,
-0.002087715547531843,
0.002876926213502884,
-0.00938885286450386,
0.0034202695824205875,
0.006932620424777269,
0.0008917142986319959,
-0.011306952685117722,
-0.9550151228904724,
0.005037268623709679,
0.00046222712262533605,
-0.0029017915949225426,
0.003785372246056795,
-0.0006467406637966633,
0.0034883448388427496,
0.004201407544314861,
0.012179427780210972,
-0.007392767816781998,
-0.004771590232849121,
-0.010155434720218182,
-0.01477646455168724,
0.0006101658218540251,
-0.006733819842338562,
-0.002556584309786558,
-0.002344416454434395,
-0.007219882216304541,
-0.0038960096426308155,
-0.004533686209470034,
-0.0015527232317253947,
0.009381981566548347,
0.0005408214638009667,
0.0038781643379479647,
0.001809848239645362,
0.005822609644383192,
-0.0002167834318242967,
0.00016736135876271874,
0.0016253561479970813,
0.005380331538617611,
-0.008600501343607903,
-0.013152061961591244,
-0.004326019436120987,
-0.003341963514685631,
0.01602914184331894,
-0.0006471854285337031,
0.004330043215304613,
-0.0004162538389209658,
0.0038084005936980247,
-0.01041286252439022,
0.003634178312495351,
0.0022977644111961126,
0.008295025676488876,
-0.03061983920633793,
0.0026037967763841152,
-0.0005258854362182319,
-0.008539635688066483,
0.010896884836256504,
0.0020450905431061983,
-0.0033146769274026155,
-0.0007674124208278954,
-0.005396595224738121,
0.012106041423976421,
-0.007192336488515139,
0.005266907624900341,
-0.004100893158465624,
-0.004569218959659338,
-0.004943631589412689,
-0.009739333763718605,
0.002603227738291025,
0.008994578383862972,
0.0011452565668150783,
-0.0005803848034702241,
-0.004695638082921505,
0.0022636433131992817,
-0.0019355232361704111,
-0.0005778970662504435,
-0.01895783469080925,
-0.01100274920463562,
-0.0017693998524919152,
0.0020519110839813948,
-0.001593265449628234,
-0.0033425723668187857,
0.0067993225529789925,
-0.011200511828064919,
0.005815444979816675,
0.001566229504533112,
0.001537982141599059,
-0.009559846483170986,
0.006070861592888832,
-0.008912257850170135,
-0.00806762557476759,
0.002134207170456648,
-0.006358252838253975,
-0.006013898644596338,
0.0022598940413445234,
0.004487429745495319,
0.008426487445831299,
-0.0030982608441263437,
0.004931005649268627,
0.009782977402210236,
-0.0035681668668985367,
-0.007690735161304474,
0.006460237316787243,
0.007440810091793537,
0.004973255097866058,
0.0005357790505513549,
0.003693812992423773,
0.009617271833121777,
0.006417908705770969,
0.003078112145885825,
0.009495283477008343,
0.0030038931872695684,
0.011973113752901554,
0.00057405378902331,
0.001856994698755443,
-0.002753417706117034,
-0.00046296557411551476,
-0.005206650123000145,
0.0003428372729104012,
-0.0036241437774151564,
-0.000005270084784569917,
-0.010745621286332607,
-0.009275928139686584,
-0.006172422785311937,
-0.0009958269074559212,
0.0039771003648638725,
-0.006245599593967199,
-0.000710895808879286,
0.0026177780237048864,
0.008287964388728142,
0.005471228621900082,
0.0009606517269276083,
0.0061462996527552605,
0.002537076361477375,
-0.009657415561378002,
0.014565296471118927,
-0.015565787442028522,
0.004017939325422049,
0.0012927679345011711,
-0.016219215467572212,
0.00838254764676094,
0.009420748800039291,
-0.006391244940459728,
0.0022308689076453447,
0.004647886846214533,
0.001036072731949389,
-0.0020330650731921196,
-0.004744247533380985,
-0.0022117746993899345,
-0.015304971486330032,
0.0031221506651490927,
0.02120138704776764,
0.00009907539060804993,
0.00943369697779417,
0.010281232185661793,
-0.003958061803132296,
0.0012481090379878879,
0.007048371713608503,
0.000014040671885595657,
0.012927770614624023,
-0.009110825136303902,
-0.000992212095297873,
0.001375607680529356,
-0.0060352301225066185,
0.0005441840039566159,
0.004984411410987377,
0.0063970936462283134,
0.0013733399100601673,
0.0017423344543203712,
-0.0037268640007823706,
-0.005526592023670673,
-0.01635988987982273,
-0.005036280956119299,
0.013145454227924347,
-0.0012141996994614601,
0.003396478248760104,
-0.009711990132927895,
0.002836399246007204,
0.004381656646728516,
0.0039769564755260944,
-0.0021253235172480345,
0.0024931547231972218,
0.005730088800191879,
0.008447919972240925,
-0.006073208060115576,
0.004301177803426981,
0.0030381192918866873,
0.003942803479731083,
0.00043436189298518,
0.006714256480336189,
-0.008749539032578468,
-0.0015816173981875181,
0.0031892643310129642,
-0.002032548887655139,
0.001969533273950219,
-0.0023177452385425568,
-0.010102130472660065,
-0.003738809609785676,
0.007771671749651432,
-0.005033501889556646,
0.0009934401605278254,
0.00858366396278143,
0.0025597792118787766,
-0.010528357699513435,
-0.0003544061037246138,
-0.0046976590529084206,
-0.009243806824088097,
0.01128039974719286,
-0.005917328875511885,
0.002463345881551504,
0.01463409885764122,
0.010243910364806652,
-0.01266325730830431,
0.009137768298387527,
0.005921289324760437,
-0.0037595434114336967,
0.006230388768017292,
0.007458950392901897,
-0.004316537640988827,
-0.02428196556866169,
-0.004045240581035614,
-0.014245987869799137,
0.0055498057045042515,
-0.00453249691054225,
0.009406785480678082,
-0.008648140355944633,
0.005197316408157349,
0.005375836510211229,
-0.012997697107493877,
-0.004727981984615326,
-0.010036603547632694,
0.007558269891887903,
-0.0006259683286771178,
0.002220259280875325,
-0.005656109657138586,
-0.0017711387481540442,
-0.007870081812143326,
-0.0017074680654332042,
-0.0014789067208766937,
0.008120234124362469,
0.0027087549678981304,
-0.006938681472092867,
0.0009500555461272597,
-0.0031399382278323174,
-0.0003826765459962189,
0.002619080478325486,
-0.013172617182135582,
0.005232745315879583,
0.003638544585555792,
-0.005511834751814604,
-0.007960701361298561,
0.0006169009138830006,
-0.002827445277944207,
-0.006544150877743959,
-0.009723878465592861,
-0.0007621131371706724,
-0.0030442907009273767,
-0.005026265513151884,
-0.007784421090036631,
-0.0021755353081971407,
-0.010076806880533695,
0.0036182613112032413,
-0.008478078991174698,
0.006599149201065302,
0.008452018722891808,
-0.001546009094454348,
0.01369056198745966,
0.00017208298959303647,
0.005125158000737429,
0.0024953288957476616,
0.005523469764739275,
0.0041151936165988445,
-0.005609092768281698,
-0.009446186944842339,
0.013012914918363094,
-0.013032281771302223,
-0.001675887731835246,
0.015437203459441662,
0.002453035907819867,
0.009888892993330956,
-0.002237532055005431,
-0.000986895407550037,
0.0015655159950256348,
0.00850164145231247,
-0.018963662907481194,
0.0026058938819915056,
0.000006952071089472156,
0.0023977423552423716,
0.006713278125971556,
-0.003078413661569357,
0.004318654537200928,
0.007009447552263737,
0.0002118770353263244,
-0.009040899574756622,
-0.002792550716549158,
-0.0035666469484567642,
0.006929800845682621,
-0.014118416234850883,
0.0003031686064787209,
-0.007291214540600777,
-0.005002107936888933,
-0.0046996744349598885,
-0.004739740863442421,
0.0008360326755791903,
0.007983378134667873,
-0.002636463614180684,
0.0054578715935349464,
-0.0030384077690541744,
-0.002625255146995187,
0.012529128231108189,
-0.0018596055451780558,
-0.005237200763076544,
-0.0009539186139591038,
0.001885408302769065,
0.00020732535631395876,
-0.009257677011191845,
-0.0034916286822408438,
0.006175265181809664,
0.004888245835900307,
-0.002603129716590047,
-0.007799653802067041,
-0.0038757582660764456,
0.001105863368138671,
-0.009606379084289074,
0.0017000844236463308,
0.013385161757469177,
0.002489907667040825,
0.0027703766245394945,
-0.00040817714761942625,
-0.006012405268847942,
-0.01575227826833725,
0.04959917813539505,
-0.0003735066275112331,
0.0018770109163597226,
0.003870527958497405,
-0.005578795913606882,
-0.0043807742185890675,
0.000924661464523524,
0.007449628319591284,
-0.007106108125299215,
-0.005974350962787867,
0.00804660189896822,
-0.00519489636644721,
0.0030208579264581203,
0.00131868792232126,
0.002718384377658367,
0.01641841232776642,
-0.0028033326379954815,
-0.01694002002477646,
-0.015224657021462917,
0.006046222057193518,
-0.006274605635553598,
-0.009005471132695675,
0.006830966100096703,
-0.00281540397554636,
-0.0027828416787087917,
0.0014211932430043817,
0.006831940729171038,
0.0004198928363621235,
0.0006472121458500624,
-0.002167908940464258,
-0.004924273584038019,
0.004424498416483402,
0.0010159604717046022,
0.006231342907994986,
0.010480069555342197,
-0.0038835189770907164,
0.007041012402623892,
-0.0027804558631032705,
-0.002869607647880912,
-0.0010752319358289242,
0.002623910317197442,
0.00924684852361679,
-0.003340314142405987,
-0.003751154290512204,
-0.0004502162628341466,
0.0024495155084878206,
-0.0023670815862715244,
0.011569364927709103,
0.002803825307637453,
-0.007021850906312466,
0.0037991912104189396,
0.005571355111896992,
0.0005244756466709077,
0.010223224759101868,
-0.002009949879720807,
0.0036752820014953613,
0.0036022525746375322,
-0.008089255541563034,
-0.01745131053030491,
-0.001293214038014412,
0.0036525181494653225,
0.007487364113330841,
-0.0005510114133358002,
0.005443118046969175,
0.0005210900562815368,
-0.0017340626800432801,
-0.01063158642500639,
-0.009341300465166569,
-0.004138736519962549,
-0.004041442181915045,
0.0006020997534506023,
0.06763280928134918,
-0.006521026138216257,
-0.0033594570122659206,
-0.011691104620695114,
-0.0013042162172496319,
-0.0006364735891111195,
-0.0016993331955745816,
0.0023791776038706303,
-0.003397279651835561,
0.0029068696312606335,
0.0016256567323580384,
-0.011169657111167908,
-0.011861218139529228,
0.002046129899099469,
0.001319560338743031,
-0.0052151125855743885,
0.005919968709349632,
0.006840481422841549,
-0.012422443367540836,
0.0059491409920156,
-0.013217475265264511,
-0.003320680931210518,
-0.0047669862397015095,
-0.009585374966263771,
-0.004102481063455343,
-0.003969766199588776,
0.00380640453658998,
0.0030949816573411226,
0.005782523658126593,
-0.00170605699531734,
0.005956089124083519,
-0.0008684353670105338,
0.004717329982668161,
-0.0037180976942181587,
-0.0007492158329114318,
-0.008589912205934525,
0.0064343176782131195,
0.002168383914977312,
-0.014409502036869526,
-0.003151067066937685,
-0.008190755732357502,
0.003784667234867811,
-0.005893453489989042,
0.006397537887096405,
-0.001010881271213293,
0.006426709238439798,
-0.0003287345462013036,
0.0006612378056161106,
-0.005752313416451216,
0.0026581124402582645,
-0.010877885855734348,
0.003173488425090909,
-0.1819685399532318,
0.01067360956221819,
0.003260982222855091,
-0.005227206740528345,
-0.007948605343699455,
-0.013082249090075493,
-0.012294652871787548,
0.007111899554729462,
0.01390395313501358,
-0.0013378398725762963,
-0.00019376276759430766,
-0.0034988163970410824,
0.0048046475276350975,
0.004791186191141605,
-0.0014520299155265093,
-0.011038325726985931,
0.002994230482727289,
-0.007374736480414867,
-0.0007064775563776493,
0.006725025363266468,
0.008434395305812359,
0.011011244729161263,
0.004565303213894367,
-0.0012505082413554192,
-0.0014946263981983066,
-0.00411161407828331,
0.006625051610171795,
-0.002520531415939331,
0.0052941832691431046,
-0.009939524345099926,
-0.004130549728870392,
-0.006376080214977264,
-0.006535642314702272,
0.0029428477864712477,
0.0035376367159187794,
0.0033854024950414896,
0.006277293432503939,
0.001730154501274228,
-0.012498960830271244,
0.008436047472059727,
-0.007606798782944679,
0.027277428656816483,
0.0040269093587994576,
0.006630306597799063,
0.004333257209509611,
-0.005569975357502699,
-0.004157830961048603,
0.0058515737764537334,
0.0008489000028930604,
0.015192474238574505,
-0.013341078534722328,
-0.007826033979654312,
-0.0008675149292685091,
0.020397460088133812,
-0.005536725278943777,
-0.008207956328988075,
-0.011015325784683228,
-0.004751455504447222,
0.003216046839952469,
0.008466029539704323,
0.011700863018631935,
-0.0026861540973186493,
0.0068915537558496,
-0.008119518868625164,
-0.01844785548746586,
0.0005124318413436413,
0.0011043627746403217,
-0.008896994404494762,
0.0011210244847461581,
0.004268163815140724,
0.008523627184331417,
0.0003985209041275084,
0.006580745801329613,
0.0011033593909814954,
0.00010804966586874798,
-0.004068926442414522,
0.008192037232220173,
-0.0019523428054526448,
0.00562308868393302,
-0.010371701791882515,
0.008786597289144993,
-0.013362771831452847,
-0.0003130244731437415,
0.000910107686650008,
-0.0037304949946701527,
0.012173855677247047,
0.006605389527976513,
-0.003415044629946351,
-0.0015550085809081793,
-0.010532299987971783,
-0.005414544139057398,
0.0036593994591385126,
-0.0006233022431842983,
-0.007521926891058683,
0.0010127894347533584,
0.00047239934792742133,
0.006421126890927553,
0.007448711432516575,
-0.005650578998029232,
0.003883067052811384,
0.0032386339735239744,
-0.008166655898094177,
0.0007032276480458677,
-0.010422369465231895,
0.008516363799571991,
0.0035492561291903257,
-0.008255054242908955,
-0.006641964428126812,
0.004584436770528555,
-0.00437395554035902,
-0.004149313550442457,
0.005801617167890072,
-0.010830231942236423,
-0.012000711634755135,
-0.0011850004084408283,
-0.01131711807101965,
0.00007728332275291905
] |
8a8988f59a7e29aadd9cfcc08e9db137ae34f210 | 3,677 | py | Python | 2021/day15/aoc-2021-d15.py | bbornstein/aoc | 624dacfe591a46aa34e3071b894076cf60091e7d | [
"MIT"
] | null | null | null | 2021/day15/aoc-2021-d15.py | bbornstein/aoc | 624dacfe591a46aa34e3071b894076cf60091e7d | [
"MIT"
] | null | null | null | 2021/day15/aoc-2021-d15.py | bbornstein/aoc | 624dacfe591a46aa34e3071b894076cf60091e7d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Advent of Code 2021, Day 15 (https://adventofcode.com/2021/day/15)
# Author: Ben Bornstein
import collections
import heapq
Point = collections.namedtuple('Point', ['x', 'y'])
Point.__add__ = lambda self, q: Point(self[0] + q[0], self[1] + q[1])
class RiskMap:
def __init__ (self):
"""Creates a new (empty) risk-level map.
Individual risk-levels as specific positions are accessible via
`RiskMap[Point]`.
See also `RiskMap.load()`
"""
self._factor = 1
self._levels = [ ]
self._nrows = 0
self._ncols = 0
def __getitem__ (self, pos):
"""Returns the risk-level at position `pos`, i.e. `RiskMap[pos]`."""
if self._factor > 1:
risk = self._levels[pos.y % self._nrows][pos.x % self._ncols]
risk += pos.y // self._nrows
risk += pos.x // self._ncols
if risk > 9:
risk = risk % 9
else:
risk = self._levels[pos.y][pos.x]
return risk
@staticmethod
def load (filename):
"""Creates a new risk-level map from `filename`."""
rmap = RiskMap()
with open(filename) as stream:
for line in stream.readlines():
rmap.append([ int(c) for c in line.strip() ])
return rmap
@property
def ncols (self):
"""The number of columns in this `RiskMap`."""
return self._factor * self._ncols
@property
def nrows (self):
"""The number of rows in this `RiskMap`."""
return self._factor * self._nrows
def append (self, row):
"""Appends `row` to this `RiskMap`."""
if len(self._levels) == 0:
self._ncols = len(row)
self._levels.append(row)
self._nrows += 1
def neighbors (self, pos):
"""Iterable 4-neighbors (up, down, left, right) for `pos`ition."""
deltas = (0, -1), (0, 1), (-1, 0), (1, 0)
adjacent = ( pos + Point(*delta) for delta in deltas )
yield from ( p for p in adjacent if self.valid(p) )
def resize (self, factor):
"""Resizes this `RiskMap` by setting its expansion factor to `factor`
copies both horizontally and vertically.
"""
self._factor = factor
def valid (self, pos):
"""Indicates whether or not `pos` is valid (inside this `RiskMap`)."""
return pos.y in range(0, self.nrows) and pos.x in range(0, self.ncols)
def search (rmap, start, end):
"""Searches `RiskMap` `rmap` (breadth-first) to find the least risky
path from `start` to `end`. Returns the total risk of that path.
"""
risk = 0
queue = [ (rmap[p], p) for p in rmap.neighbors(start) ]
visited = { start }
heapq.heapify(queue)
while len(queue) > 0:
risk, current = heapq.heappop(queue)
if current == end:
break
for pos in rmap.neighbors(current):
if pos not in visited:
heapq.heappush( queue, ((rmap[pos] + risk), pos) )
visited.add(pos)
return risk
filename = 'aoc-2021-d15.txt'
rmap = RiskMap.load(filename)
start = Point(0, 0)
end = Point(rmap.ncols - 1, rmap.nrows - 1)
# Part 1
#
# Q: Lowest total risk of any path from the top left to the bottom right?
# A: Total Risk = 755
print(f'Part 1: Total Risk = {search(rmap, start, end):4}')
# Part 2
#
# Q: Lowest total risk of any path from the top left to the bottom right?
# A: Total Risk = 3016
rmap.resize(factor=5)
end = Point(rmap.ncols - 1, rmap.nrows - 1)
print(f'Part 2: Total Risk = {search(rmap, start, end)}')
| 25.184932 | 78 | 0.56731 | 1 | 2.1606 | [
-0.03723756968975067,
0.07922004908323288,
-0.021713122725486755,
-0.013409033417701721,
0.0071290102787315845,
0.038681499660015106,
-0.02113286778330803,
-0.01947171799838543,
-0.044046346098184586,
0.010094333440065384,
-0.015358720906078815,
0.014948575757443905,
0.05708414316177368,
0.010816088877618313,
-0.02863418683409691,
-0.007065522484481335,
0.06157490983605385,
-0.0334976390004158,
0.02448165975511074,
0.04454345256090164,
-0.01469923835247755,
0.031646549701690674,
-0.003430639160797,
0.03734894469380379,
0.039357591420412064,
-0.004205925855785608,
0.024542691186070442,
0.02237042225897312,
-0.0015241052024066448,
-0.030969122424721718,
-0.01012667827308178,
0.016630424186587334,
-0.0011288768146187067,
-0.014138921163976192,
-0.016778970137238503,
0.022468822076916695,
0.01692609302699566,
-0.05289877951145172,
-0.007059002295136452,
0.03929746896028519,
0.02166779711842537,
-0.05389046296477318,
0.015537906438112259,
-0.01088739838451147,
-0.027168817818164825,
-0.026613492518663406,
-0.03660009056329727,
-0.028799638152122498,
-0.07727912068367004,
-0.0027433941140770912,
0.02419043518602848,
-0.019839027896523476,
0.017245212569832802,
0.001346286735497415,
0.04620737209916115,
-0.05643441900610924,
0.0226170402020216,
0.007760702632367611,
-0.05366596207022667,
0.05281965062022209,
-0.006512174382805824,
0.01444462314248085,
-0.004005033057183027,
-0.02662976086139679,
0.037911221385002136,
-0.004816016182303429,
0.018945377320051193,
-0.019073976203799248,
-0.06201401352882385,
-0.03874285891652107,
0.005330462474375963,
0.00415770011022687,
0.0014518083771690726,
0.049490075558423996,
-0.007176362443715334,
0.019700614735484123,
-0.06445550918579102,
-0.03184935078024864,
-0.023268215358257294,
0.022156478837132454,
-0.03125440701842308,
0.06499474495649338,
-0.007413300219923258,
0.012374809011816978,
-0.0036422244738787413,
0.01468235906213522,
0.07771038264036179,
-0.05368417873978615,
0.03309565410017967,
0.02408004179596901,
-0.06344901025295258,
0.057123951613903046,
-0.0257157813757658,
-0.022240333259105682,
-0.049765925854444504,
-0.09297562390565872,
0.0075875213369727135,
0.02831166982650757,
-0.003430404467508197,
-0.018956489861011505,
0.044164080172777176,
-0.01918626017868519,
0.0017254609847441316,
0.004760806914418936,
0.0012629403499886394,
-0.013605406507849693,
-0.04032796621322632,
-0.016633927822113037,
-0.00929279439151287,
0.015087024308741093,
0.021669577807188034,
-0.007950644940137863,
0.017551790922880173,
-0.0071174995973706245,
-0.010050829499959946,
-0.03962165489792824,
0.0008354732999578118,
0.023028919473290443,
-0.01467484887689352,
0.00915468204766512,
-0.007057313807308674,
-0.008186019025743008,
-0.021963249891996384,
-0.026555795222520828,
-0.022796539589762688,
0.06765168160200119,
-0.039938993752002716,
-0.027487823739647865,
0.06023353338241577,
0.00035671822843141854,
-0.011456077918410301,
0.01878165267407894,
0.017103631049394608,
-0.04458339139819145,
-0.003556249663233757,
0.00710028363391757,
0.005701371934264898,
-0.014476499520242214,
-0.04044335335493088,
0.008841747418045998,
0.008093557320535183,
-0.01895807683467865,
0.021742189303040504,
-0.04515784978866577,
-0.0037747728638350964,
-0.0342288613319397,
0.0014502571430057287,
0.0032759408932179213,
-0.026602337136864662,
-0.004603688605129719,
0.01123232115060091,
0.017323795706033707,
-0.015011405572295189,
0.001631326973438263,
-0.031278934329748154,
-0.005891383159905672,
0.0211485605686903,
-0.05688782408833504,
0.00708908773958683,
-0.018885482102632523,
-0.04944819584488869,
-0.007403491996228695,
-0.014472253620624542,
-0.024462329223752022,
0.020763728767633438,
0.043155863881111145,
-0.04140313342213631,
0.019510552287101746,
-0.018363170325756073,
0.029778778553009033,
0.0024784021079540253,
-0.008572284132242203,
0.011516556143760681,
-0.03364366292953491,
-0.019626591354608536,
0.008553571067750454,
0.018948379904031754,
-0.005363541655242443,
0.030535435304045677,
0.004146122839301825,
0.027709627524018288,
0.0039621745236217976,
0.0025012369733303785,
0.026300305500626564,
0.019373098388314247,
0.0054388693533837795,
-0.02235763892531395,
-0.011125690303742886,
-0.023396244272589684,
-0.0270822886377573,
-0.03418772667646408,
0.02497292496263981,
0.0063764676451683044,
-0.010325483977794647,
0.040487729012966156,
-0.024279477074742317,
0.01067913044244051,
-0.025569047778844833,
0.006762996315956116,
-0.007917020469903946,
0.014442497864365578,
-0.015604404732584953,
-0.015803685411810875,
0.018491217866539955,
-0.03480454906821251,
-0.0053933896124362946,
-0.607440173625946,
0.024942759424448013,
0.005008738022297621,
-0.019856123253703117,
0.05759130418300629,
0.03632258251309395,
-0.07141217589378357,
0.02781599946320057,
-0.04989956319332123,
0.024489324539899826,
-0.01396348886191845,
-0.014201927930116653,
-0.008497919887304306,
-0.025954945012927055,
0.02982143871486187,
-0.046963587403297424,
0.0038127817679196596,
0.04528389126062393,
0.021464653313159943,
0.014522913843393326,
0.01480826921761036,
0.0012442460283637047,
-0.03175130859017372,
0.012352017685770988,
0.021688180044293404,
0.022387990728020668,
0.020957311615347862,
0.02614719420671463,
0.0171117652207613,
-0.051289670169353485,
0.005967370700091124,
-0.015294644050300121,
0.005263608880341053,
-0.018289439380168915,
0.0304256659001112,
0.025830626487731934,
0.025698846206068993,
-0.019406188279390335,
0.010701517574489117,
0.006657050456851721,
-0.026523496955633163,
-0.049710892140865326,
-0.044442787766456604,
-0.07335569709539413,
-0.03908402845263481,
-0.015550020150840282,
-0.03547242656350136,
-0.02604907564818859,
0.0054457527585327625,
0.012689377181231976,
-0.048212260007858276,
0.04316110908985138,
0.03517807647585869,
-0.02200404740869999,
-0.026502415537834167,
0.02015560120344162,
-0.03776443004608154,
-0.01327481772750616,
0.006547818426042795,
0.00827996525913477,
0.0219397135078907,
-0.012455334886908531,
-0.03697478398680687,
-0.013190098106861115,
0.0007681913557462394,
0.004029139410704374,
0.10031378269195557,
-0.018382932990789413,
-0.02255708910524845,
0.02953951433300972,
-0.02530761808156967,
0.01564844138920307,
-0.02032327465713024,
0.13152003288269043,
0.03419419378042221,
0.010501949116587639,
0.02488386072218418,
0.0013291174545884132,
-0.05340099707245827,
-0.011022506281733513,
0.05527925863862038,
0.006436859257519245,
-0.017725620418787003,
0.0028247565496712923,
-0.020278099924325943,
0.031556662172079086,
-0.0067160171456635,
-0.04388696327805519,
-0.026298683136701584,
-0.0015759430825710297,
0.005974805448204279,
0.05476590245962143,
-0.007359576411545277,
-0.004740654956549406,
-0.013890859670937061,
0.037976864725351334,
0.01302407868206501,
0.05264003947377205,
0.021754922345280647,
0.027711134403944016,
-0.04308396205306053,
0.005182105582207441,
-0.011267825961112976,
0.0184929221868515,
0.0060018873773515224,
0.027335526421666145,
-0.022636305540800095,
0.006384630687534809,
0.06477198749780655,
0.013704810291528702,
-0.011571981012821198,
-0.002252839272841811,
-0.016387570649385452,
0.019815683364868164,
-0.040420204401016235,
-0.021501557901501656,
0.010650333017110825,
-0.03111235797405243,
0.022044537588953972,
-0.003124274080619216,
-0.07446499913930893,
-0.002820090390741825,
0.020332181826233864,
0.011296342127025127,
-0.014045721851289272,
-0.016493503004312515,
-0.02538299933075905,
-0.01946495659649372,
-0.01394676323980093,
0.032114431262016296,
-0.014600913040339947,
-0.01995716243982315,
-0.010335689410567284,
-0.0035821578931063414,
-0.011656715534627438,
-0.01173761859536171,
-0.005523389205336571,
-0.002878315281122923,
0.014787818305194378,
0.01604229025542736,
-0.002488194964826107,
-0.01489182934165001,
0.032691992819309235,
0.005131327081471682,
-0.027100367471575737,
0.04077932983636856,
0.01814144477248192,
0.03806792199611664,
-0.04093533754348755,
-0.012246118858456612,
0.005582485347986221,
0.012636560015380383,
0.016285080462694168,
-0.047253336757421494,
-0.014710841700434685,
0.02793453074991703,
-0.01592901349067688,
-0.00785543117672205,
0.009370440617203712,
0.042518023401498795,
-0.027375895529985428,
0.00009259310172637925,
-0.019167032092809677,
0.02155226841568947,
0.013398640789091587,
-0.005600468721240759,
0.019854433834552765,
0.014512261375784874,
0.012670671567320824,
-0.00927390344440937,
0.005545946769416332,
-0.023950323462486267,
0.06113853678107262,
-0.005203690379858017,
-0.025369303300976753,
0.05273732170462608,
-0.00539806904271245,
-0.0651722103357315,
-0.02690902166068554,
-0.00007028521940810606,
-0.014195209369063377,
0.03329125791788101,
0.023889169096946716,
0.008559515699744225,
-0.02036857418715954,
0.023527778685092926,
0.004784231074154377,
-0.00672819884493947,
0.013556773774325848,
-0.001830924884416163,
-0.021057045087218285,
0.028818432241678238,
-0.027507586404681206,
-0.007599848788231611,
-0.03561755269765854,
-0.024441035464406013,
0.021170400083065033,
-0.03238368034362793,
-0.02533717453479767,
-0.013795728795230389,
0.022637803107500076,
0.03161122649908066,
0.0010309906210750341,
-0.028926562517881393,
-0.0006237825728021562,
0.033814191818237305,
0.02710486762225628,
-0.00637283967807889,
0.001922004041261971,
0.00003619474591687322,
0.03070126287639141,
-0.0000742725605960004,
0.02500980906188488,
0.005619892384856939,
-0.018654806539416313,
0.012985778041183949,
-0.06300739198923111,
0.02970101498067379,
0.036140311509370804,
-0.02656206674873829,
0.0009569140966050327,
0.01439734548330307,
0.03476674482226372,
-0.0031876240391284227,
-0.000039291204302571714,
-0.013243230991065502,
-0.02332253009080887,
0.007286116946488619,
-0.03546009212732315,
-0.027370065450668335,
0.0032266154885292053,
-0.010105928406119347,
0.007416800130158663,
-0.004254565574228764,
0.02533254213631153,
0.025030314922332764,
-0.03336925432085991,
-0.018810909241437912,
-0.0015903610037639737,
-0.04977243393659592,
0.013398745097219944,
-0.0006353429052978754,
-0.00043625084799714386,
-0.0008306706440635026,
-0.0049383267760276794,
0.018010277301073074,
0.007017011288553476,
-0.036322690546512604,
-0.05723322182893753,
-0.017197906970977783,
-0.06629166752099991,
0.0286136195063591,
-0.02248544618487358,
0.02327125146985054,
0.017327116802334785,
0.017485972493886948,
-0.030469609424471855,
0.019926918670535088,
0.018224263563752174,
0.025745663791894913,
-0.0015375951770693064,
-0.03563611954450607,
-0.02099243551492691,
-0.0007894904119893909,
-0.00208643707446754,
0.02557506412267685,
-0.0018360649701207876,
-0.034082915633916855,
0.02037874422967434,
-0.0011759866029024124,
-0.022210339084267616,
0.009870332665741444,
-0.0459674708545208,
0.023414727300405502,
-0.020288875326514244,
-0.016587479040026665,
-0.05013876035809517,
-0.05572379380464554,
0.018073594197630882,
0.03525553643703461,
-0.023975836113095284,
0.0198014285415411,
-0.01160380244255066,
0.008049976080656052,
-0.003083155257627368,
0.012835410423576832,
0.026922745630145073,
-0.037261731922626495,
-0.06971344351768494,
-0.0010552043095231056,
-0.01033428031951189,
-0.03467527776956558,
0.0016366851050406694,
-0.02397681586444378,
-0.023437559604644775,
-0.01624886319041252,
-0.01103602908551693,
0.008194168098270893,
0.002470065141096711,
0.01601019687950611,
0.01717325486242771,
-0.026295317336916924,
0.004622896201908588,
-0.039144858717918396,
0.02076074481010437,
-0.049911487847566605,
0.03082975000143051,
-0.041445281356573105,
0.030108589679002762,
0.0009478162974119186,
0.019803596660494804,
0.05805687606334686,
-0.0028776279650628567,
0.026466237381100655,
-0.020850639790296555,
0.015262175351381302,
0.04406889155507088,
0.04722190275788307,
0.017705298960208893,
0.01017169188708067,
-0.01652221754193306,
-0.0301271490752697,
-0.024808568879961967,
0.004195459187030792,
-0.0002177181449951604,
-0.047295037657022476,
-0.00954984501004219,
0.010160806588828564,
-0.004477950744330883,
0.05924510955810547,
-0.023026946932077408,
-0.009899611584842205,
0.034984663128852844,
0.022106856107711792,
0.008542506955564022,
0.001873088302090764,
0.03661860153079033,
0.04280390962958336,
0.03258426487445831,
0.005171096883714199,
-0.04533857852220535,
-0.01976427063345909,
-0.009557129815220833,
0.024363309144973755,
-0.026041336357593536,
0.018413398414850235,
0.024993259459733963,
0.08374727517366409,
0.049191754311323166,
0.019913138821721077,
0.05175861716270447,
-0.0019993679597973824,
0.0027750246226787567,
-0.026529356837272644,
0.0066833049058914185,
0.0006626390386372805,
-0.030057130381464958,
0.007088653743267059,
0.018922029063105583,
-0.02473403885960579,
0.019557522609829903,
0.0014986313180997968,
-0.0027327281422913074,
-0.01182518433779478,
0.003093612613156438,
-0.006273307837545872,
0.017499037086963654,
0.012417178601026535,
0.017193200066685677,
0.049038756638765335,
-0.016020478680729866,
-0.04587671905755997,
0.0038657377008348703,
0.0036895321682095528,
0.013327113352715969,
0.00910713616758585,
0.06113127991557121,
-0.0394255705177784,
-0.007262225728482008,
0.03758089989423752,
-0.025723058730363846,
-0.015623653307557106,
0.04791533201932907,
-0.03159065172076225,
0.00953768752515316,
0.015841040760278702,
-0.024037489667534828,
0.02664494886994362,
0.016360631212592125,
-0.052832622081041336,
-0.005413494538515806,
-0.011006246320903301,
-0.000750801176764071,
0.03506090119481087,
-0.034164249897003174,
0.00043224258115515113,
-0.034866053611040115,
-0.023958686739206314,
-0.024582592770457268,
0.02012743055820465,
-0.012389379553496838,
0.021119723096489906,
0.0057043288834393024,
-0.05100855231285095,
0.015535624697804451,
-0.02236999198794365,
0.03473624959588051,
0.017632750794291496,
-0.019351352006196976,
0.05099215731024742,
-0.021498294547200203,
0.03681957349181175,
-0.031636450439691544,
-0.05057912319898605,
0.018782567232847214,
-0.01556818000972271,
-0.016493743285536766,
0.0298355370759964,
-0.053061846643686295,
-0.005425999406725168,
-0.03591940179467201,
-0.01565670035779476,
0.0025693580973893404,
-0.0018514185212552547,
-0.0005707981763407588,
-0.012065461836755276,
0.01574084535241127,
0.029553277418017387,
0.009150485508143902,
0.0234866663813591,
0.01931336708366871,
-0.0053215655498206615,
-0.036945782601833344,
0.013792768120765686,
-0.009129123762249947,
-0.015246376395225525,
-0.006147344131022692,
-0.03572000563144684,
0.0034729894250631332,
0.02875109575688839,
0.006975678727030754,
0.0042678071185946465,
0.03046576678752899,
0.04098079726099968,
-0.01565306819975376,
-0.029929764568805695,
0.0347757562994957,
0.013912074267864227,
0.006181549746543169,
-0.02108672447502613,
0.03185451403260231,
0.01596170663833618,
0.022515593096613884,
0.05245030298829079,
0.024775031954050064,
0.02702600695192814,
0.05285358056426048,
-0.0040348670445382595,
0.009100666269659996,
-0.015698906034231186,
-0.0011296961456537247,
0.049757082015275955,
-0.0038351465482264757,
0.048402514308691025,
0.007776275742799044,
0.04432360455393791,
0.02354721911251545,
-0.061392202973365784,
0.025294136255979538,
-0.03540675342082977,
0.0010552344610914588,
0.04360862448811531,
-0.013069406151771545,
-0.0019300623098388314,
0.0037961089983582497,
-0.030036695301532745,
-0.020702803507447243,
0.020437147468328476,
0.025416474789381027,
0.009192000143229961,
0.010469202883541584,
0.02151261270046234,
0.009139918722212315,
0.022607814520597458,
-0.008289149031043053,
-0.04637264460325241,
-0.0076749930158257484,
0.018843788653612137,
0.025915225967764854,
0.001478303805924952,
-0.03404005244374275,
-0.033638980239629745,
-0.01718795672059059,
0.0487031526863575,
0.015240135602653027,
-0.0334702730178833,
0.019117014482617378,
-0.024243947118520737,
0.07423748821020126,
0.026323631405830383,
-0.0924835056066513,
-0.06850429624319077,
-0.028435025364160538,
-0.03569072484970093,
0.01891954429447651,
0.02015986293554306,
0.10088848322629929,
0.03752552345395088,
-0.01103183627128601,
0.008911269716918468,
-0.015579004772007465,
-0.030414029955863953,
-0.015786539763212204,
-0.014053920283913612,
-0.007617982570081949,
0.04084203764796257,
0.07485183328390121,
-0.018692070618271828,
0.010822745971381664,
0.04521007835865021,
0.01713572070002556,
0.013406497426331043,
0.012946528382599354,
0.03253975510597229,
0.005942872725427151,
-0.010862575843930244,
-0.04348015412688255,
-0.006630535237491131,
0.044555388391017914,
-0.0051933093927800655,
-0.002834521234035492,
-0.03486955538392067,
-0.03872373700141907,
-0.003551589325070381,
-0.014378031715750694,
-0.053863685578107834,
0.010732008144259453,
0.03148641064763069,
-0.028602927923202515,
-0.0034700175747275352,
0.05046090856194496,
0.009704279713332653,
-0.00419566361233592,
-0.03290308639407158,
0.0015201139030978084,
-0.020819904282689095,
-0.005242291837930679,
-0.011259708553552628,
0.03272633999586105,
-0.0018515364499762654,
-0.0015104322228580713,
-0.03414700925350189,
0.007430082652717829,
0.011853503994643688,
-0.029270753264427185,
-0.02576347254216671,
-0.007364373654127121,
0.03087659366428852,
-0.0048021539114415646,
-0.013362121768295765,
0.01812119036912918,
0.019571227952837944
] |
8a89fcb6aa9605bd61ebc69c816df71f6eb1ab81 | 673 | py | Python | indico/modules/events/abstracts/compat.py | aiforrural/Digital-Events-Example | 628aaa8727b259b9367ac0ae1c5ba8e9e95eca82 | [
"MIT"
] | 1 | 2021-02-08T09:34:27.000Z | 2021-02-08T09:34:27.000Z | indico/modules/events/abstracts/compat.py | pamirk/indico | c3b4e06b11cc21ad497f74d0b2ca901bc1b2a768 | [
"MIT"
] | null | null | null | indico/modules/events/abstracts/compat.py | pamirk/indico | c3b4e06b11cc21ad497f74d0b2ca901bc1b2a768 | [
"MIT"
] | null | null | null | # This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import redirect
from indico.modules.events.abstracts.models.abstracts import Abstract
from indico.web.flask.util import url_for
from indico.web.rh import RHSimple
@RHSimple.wrap_function
def compat_abstract(endpoint, confId, friendly_id, track_id=None, management=False):
abstract = Abstract.find(event_id=confId, friendly_id=friendly_id).first_or_404()
return redirect(url_for('abstracts.' + endpoint, abstract, management=management))
| 35.421053 | 86 | 0.786033 | 1 | 0.8661 | [
0.0026292705442756414,
0.02188734896481037,
0.007941135205328465,
0.002528277225792408,
0.007293083239346743,
-0.002388594439253211,
-0.011337797157466412,
0.0033455973025411367,
-0.0066436599008738995,
0.0023455615155398846,
0.0033024244476109743,
0.004923762287944555,
0.006081031169742346,
-0.01726556569337845,
0.0009517011349089444,
0.01667148806154728,
-0.054812245070934296,
0.0049972874112427235,
-0.005634861066937447,
0.002004389651119709,
-0.006713971961289644,
0.011198348365724087,
0.009741414338350296,
0.006853915750980377,
0.00561742065474391,
0.0013262355932965875,
0.009305708110332489,
0.0030383174307644367,
-0.008359123952686787,
-0.007503355387598276,
0.0015306294662877917,
-0.004658470395952463,
-0.00549274729564786,
-0.00811679195612669,
0.007562859449535608,
-0.004936965182423592,
0.0011840088991448283,
-0.020891200751066208,
0.009834077209234238,
-0.004012946039438248,
-0.007144358940422535,
-0.01716556027531624,
-0.001542328973300755,
0.0034064361825585365,
-0.013133416883647442,
0.0024552703835070133,
-0.0033355362247675657,
0.006176360882818699,
-0.010479521937668324,
0.0059282067231833935,
-0.009755371138453484,
0.005584727041423321,
0.01459499541670084,
-0.00007676565292058513,
-0.004748827312141657,
-0.007348943967372179,
0.011958293616771698,
0.0009474936523474753,
-0.0120009183883667,
0.000526371703017503,
-0.00396371865645051,
-0.0030645113438367844,
0.0034493464045226574,
0.00036130266380496323,
-0.016169974580407143,
-0.006211715284734964,
-0.00315708015114069,
0.0031273667700588703,
-0.00049643125385046,
0.005853585433214903,
0.0009542762418277562,
-0.0020648534409701824,
0.007402649614959955,
0.004415260162204504,
0.004214964807033539,
-0.005971877835690975,
0.002210634760558605,
0.00230706250295043,
0.009811273775994778,
0.0035022622905671597,
0.004859214648604393,
-0.009437679313123226,
0.005973972380161285,
0.012112514115869999,
0.01258073654025793,
0.007503228727728128,
0.021235650405287743,
-0.011436188593506813,
0.043516840785741806,
0.006765282712876797,
-0.008422712795436382,
0.0010895275045186281,
-0.008726132102310658,
-0.002401057630777359,
-0.003689780365675688,
-0.02872239053249359,
-0.001314632361754775,
-0.006260300520807505,
-0.00025017335428856313,
0.003430459648370743,
-0.0008592104422859848,
0.005679215770214796,
-0.0016122981905937195,
-0.0033426638692617416,
-0.011027204804122448,
0.013882444240152836,
-0.009593519382178783,
-0.003092327620834112,
0.00865011103451252,
0.0028526701498776674,
-0.012974437326192856,
-0.0018091874662786722,
0.0023572780191898346,
-0.010377021506428719,
0.004432727582752705,
0.0019049430266022682,
-0.005536808166652918,
0.056793488562107086,
-0.0013791690580546856,
0.0029852399602532387,
-0.004442885518074036,
-0.0017173716332763433,
0.0020440618973225355,
0.008849258534610271,
0.008058435283601284,
-0.004238490480929613,
0.01230074092745781,
0.006936545949429274,
0.004029853269457817,
0.008959729224443436,
0.0008012026082724333,
0.008797619491815567,
-0.0047453236766159534,
-0.00201870733872056,
-0.0008696970180608332,
-0.007743287365883589,
0.008978250436484814,
-0.0014344803057610989,
-0.007652473170310259,
0.0010719596175476909,
0.0005916326772421598,
-0.011465001851320267,
0.002321931766346097,
-0.002992301946505904,
-0.000010986374036292545,
-0.012906337156891823,
-0.0038051235023885965,
-0.003611203981563449,
-0.0038963695988059044,
0.004895814228802919,
0.006569135934114456,
0.0036856720689684153,
0.001271825865842402,
-0.005563479382544756,
-0.007957173511385918,
-0.0014680494787171483,
-0.0033116370905190706,
0.003462201450020075,
0.007975108921527863,
0.004069287329912186,
-0.009219217114150524,
0.0007123719551600516,
0.00436747819185257,
0.003486654721200466,
-0.0015983242774382234,
0.0012449908535927534,
-0.008351661264896393,
0.008083220571279526,
0.0013084461679682136,
0.0048890127800405025,
0.011985735967755318,
-0.004323231056332588,
-0.001597192487679422,
-0.0021734090987592936,
0.002205375349149108,
-0.0008701690821908414,
0.004203315824270248,
0.012614704668521881,
-0.0037227689754217863,
-0.005273567978292704,
0.004430971574038267,
0.004604907240718603,
0.011885072104632854,
0.007886633276939392,
-0.001750500756315887,
0.0020765431690961123,
-0.0037976037710905075,
0.000575528247281909,
0.004414271097630262,
-0.006262298673391342,
0.0062322611920535564,
0.005222095642238855,
-0.01453934796154499,
-0.0034615439362823963,
0.001296422677114606,
-0.009693419560790062,
0.0019125944236293435,
0.014299868606030941,
0.01094093732535839,
-0.002237737411633134,
0.002817722735926509,
-0.010021242313086987,
0.0006343596614897251,
0.0056480648927390575,
0.004345729947090149,
-0.013457010500133038,
-0.956723690032959,
0.0034229494631290436,
0.002067282097414136,
-0.0005241694743745029,
0.005097947549074888,
0.005088204517960548,
0.0018108936492353678,
0.004102478735148907,
0.012718386016786098,
-0.010342469438910484,
-0.007143736816942692,
-0.009902934543788433,
-0.010872425511479378,
-0.001472808187827468,
-0.008395141921937466,
-0.0031344059389084578,
-0.0052110617980360985,
-0.00761718675494194,
-0.0017047615256160498,
-0.004659746773540974,
-0.0011754281586036086,
0.009792906232178211,
0.00029884401010349393,
0.0030570721719413996,
0.00402563763782382,
0.0026082575786858797,
-0.0022942933719605207,
0.0009964107302948833,
-0.003925992641597986,
-0.001209562411531806,
-0.005503746680915356,
-0.017339199781417847,
-0.005046790465712547,
-0.0008646834176033735,
0.011845342814922333,
-0.0014253791887313128,
0.009285863488912582,
-0.0023997712414711714,
0.002122290898114443,
-0.008634145371615887,
0.006851699203252792,
0.0011726055527105927,
0.0012696943012997508,
-0.031170127913355827,
-0.0009161907946690917,
-0.0008186565828509629,
-0.006878118496388197,
0.009518512524664402,
0.0004295753315091133,
-0.000346130138495937,
-0.001856176182627678,
-0.0037087297532707453,
0.008895264938473701,
-0.007356957998126745,
0.004910166375339031,
-0.007592350244522095,
-0.005726497620344162,
-0.0026088401209563017,
-0.00946811679750681,
0.0025306979659944773,
0.004783045034855604,
-0.0008379900828003883,
-0.004364718217402697,
-0.004654956515878439,
0.002742121694609523,
0.0004999727825634181,
-0.001492218696512282,
-0.017365070059895515,
-0.004937920719385147,
-0.00015871296636760235,
0.0027371584437787533,
-0.002695712959393859,
-0.002563631860539317,
0.0035666534677147865,
-0.010866370983421803,
0.0076050530187785625,
0.0020044005941599607,
0.0018882144941017032,
-0.0103743402287364,
0.0009004934108816087,
-0.007381267845630646,
-0.010893403552472591,
0.0020417997147887945,
-0.005734394304454327,
-0.002941559534519911,
-0.00022162757522892207,
0.0019716829992830753,
0.00872236117720604,
-0.0042509580962359905,
0.0026195021346211433,
0.013676594942808151,
-0.0035273151006549597,
-0.007835649885237217,
0.007793590892106295,
0.008178599178791046,
0.0014641514280810952,
-0.0017873479519039392,
-0.00016709178453311324,
0.00905537512153387,
0.005734439007937908,
0.0019144406542181969,
0.006333172786980867,
-0.00010313683742424473,
0.013618098571896553,
-0.00005050604522693902,
0.0010583727853372693,
-0.002329729963093996,
-0.0018858944531530142,
-0.0029345413204282522,
-0.003372147213667631,
-0.004135145340114832,
-0.0013646201696246862,
-0.012722738087177277,
-0.010247856378555298,
-0.0013981227530166507,
-0.0004405863001011312,
0.0018109907396137714,
-0.002289403462782502,
-0.00021434664085973054,
0.0034274181816726923,
0.008464372716844082,
0.0026409816928207874,
-0.001107974792830646,
0.0031057903543114662,
0.0033655818551778793,
-0.007215658202767372,
0.013732966035604477,
-0.013147824443876743,
0.0065173618495464325,
-0.0028189595323055983,
-0.015910252928733826,
0.010318740271031857,
0.008699971251189709,
-0.007603224832564592,
0.0037048531230539083,
0.0026848686393350363,
0.006350429728627205,
-0.0004384803760331124,
-0.005270164459943771,
-0.003726579248905182,
-0.014793540351092815,
0.0009113998967222869,
0.01830502599477768,
0.002006582450121641,
0.010109868831932545,
0.012616866268217564,
-0.000228785807848908,
0.0012757956283167005,
0.006034073885530233,
0.00028964164084754884,
0.012408052571117878,
-0.012683962471783161,
-0.0000540192995686084,
0.001730067073367536,
-0.004803104791790247,
0.0012371514458209276,
0.004957806784659624,
0.003990165423601866,
-0.002834868151694536,
0.0029862753581255674,
-0.00662577198818326,
-0.005189761519432068,
-0.019504455849528313,
-0.0042541781440377235,
0.00824748445302248,
-0.004153378773480654,
0.00626714201644063,
-0.011644755490124226,
0.006901626009494066,
0.0059288907796144485,
-0.0002483476710040122,
0.0009825140004977584,
-0.0023651719093322754,
0.006178748328238726,
0.011241257190704346,
-0.008282755501568317,
0.00398595817387104,
0.0013312111841514707,
0.0005895564681850374,
0.0028112640138715506,
0.008090049959719181,
-0.007938424125313759,
-0.006355482153594494,
0.002391897840425372,
0.004455870017409325,
-0.001809088746085763,
-0.004839660134166479,
-0.00894214492291212,
-0.005028257146477699,
0.0027173487469553947,
-0.003443954512476921,
0.006078854203224182,
0.004770176485180855,
0.004317805171012878,
-0.008310065604746342,
0.00036571655073203146,
-0.0041023422963917255,
-0.010829152539372444,
0.008843528106808662,
-0.0028971144929528236,
0.00300953583791852,
0.012832469306886196,
0.002158556832000613,
-0.012692087329924107,
0.007352308835834265,
0.007667879574000835,
-0.004970089998096228,
0.002681930083781481,
0.005205780267715454,
-0.00627975445240736,
-0.02375617064535618,
-0.0004810631216969341,
-0.01572590321302414,
0.008974950760602951,
-0.0013314572861418128,
0.002573068020865321,
-0.004855894483625889,
0.00830066204071045,
0.003369786310940981,
-0.013031993061304092,
-0.0032458018977195024,
-0.008660273626446724,
0.010020491667091846,
-0.00034629355650395155,
-0.0015541043831035495,
-0.0037277149967849255,
0.0011694750282913446,
-0.002757171168923378,
-0.0033290465362370014,
-0.0017335067968815565,
0.005011624190956354,
0.002260818611830473,
-0.004172620829194784,
0.003066822187975049,
-0.005180057138204575,
-0.0013182349503040314,
0.0016186656430363655,
-0.012119943276047707,
0.0004774651606567204,
0.005469936411827803,
-0.002078372286632657,
-0.0045169382356107235,
0.0006258755456656218,
-0.001241642632521689,
-0.008339991793036461,
-0.009952266700565815,
-0.0037421807646751404,
-0.0059564001858234406,
-0.0027352962642908096,
-0.01174252200871706,
-0.0012844301527366042,
-0.006720336154103279,
0.004802107810974121,
-0.00741882249712944,
0.008076074533164501,
0.0028475713916122913,
-0.005562532227486372,
0.006243517156690359,
-0.0018474914832040668,
0.0036487325560301542,
0.006983272731304169,
0.006685404106974602,
-0.0017275322461500764,
-0.006153996102511883,
-0.010477149859070778,
0.008757563307881355,
-0.008922041393816471,
-0.0013589994050562382,
0.013385722413659096,
0.006287513766437769,
0.00928528606891632,
-0.0006266966229304671,
0.00014302076306194067,
0.0034326694440096617,
0.006848985329270363,
-0.014820592477917671,
0.0017221416346728802,
-0.0008480755495838821,
-0.0012831416679546237,
0.006760125979781151,
-0.004463014658540487,
0.00569332716986537,
0.007480453234165907,
0.005199336912482977,
-0.009723948314785957,
-0.0029908253345638514,
0.0004211307386867702,
0.00508404104039073,
-0.01177720446139574,
-0.000326956738717854,
-0.005102920345962048,
-0.0033881482668220997,
-0.0054588462226092815,
-0.0017530637560412288,
0.0006279947119764984,
0.006240156479179859,
-0.0014735570875927806,
0.0058209956623613834,
0.002597929909825325,
-0.0030439605470746756,
0.015272160992026329,
-0.005261162295937538,
-0.004564675968140364,
0.0012752923648804426,
0.0018801281694322824,
-0.00114104722160846,
-0.009017343632876873,
-0.0025261223781853914,
0.0022160953376442194,
0.004860640503466129,
-0.0010382512118667364,
-0.006984468083828688,
-0.0027884298469871283,
-0.0001330867817159742,
-0.0073328809812664986,
0.0027751021552830935,
0.010297668166458607,
0.0008078260580077767,
0.00292181596159935,
-0.002856633858755231,
-0.005744059570133686,
-0.014497964642941952,
0.05593085289001465,
-0.003199783619493246,
0.0046555656008422375,
0.007272927090525627,
-0.008450479246675968,
-0.0018127044895663857,
-0.0036073289811611176,
0.00518384063616395,
-0.007575728930532932,
-0.006427863612771034,
0.008497791364789009,
-0.0018286678241565824,
0.0038842882495373487,
0.0005509133916348219,
-0.003357682144269347,
0.015350415371358395,
-0.005341483745723963,
-0.018073806539177895,
-0.016651039943099022,
0.007774956524372101,
-0.00565033545717597,
-0.008868160657584667,
0.007801983971148729,
-0.003274589078500867,
-0.004579436033964157,
0.0011013112962245941,
0.006553149316459894,
0.0027385263238102198,
-0.0009029667126014829,
-0.0030441535636782646,
-0.002455850364640355,
-0.0007959039648994803,
0.0033745209220796824,
0.0062453472055494785,
0.008597859181463718,
-0.0030241436325013638,
0.004129685927182436,
-0.005710453726351261,
-0.0009221032378263772,
0.00004896280006505549,
0.00443843100219965,
0.008513085544109344,
-0.0002458065573591739,
0.0007353466935455799,
0.007851377129554749,
0.005130584351718426,
-0.0013722783187404275,
0.009472295641899109,
0.002615488599985838,
-0.0044312854297459126,
0.008256129920482635,
0.00713858800008893,
0.00016961462097242475,
0.005635840818285942,
-0.0007639867253601551,
0.00563417375087738,
-0.0008295758743770421,
-0.006374172866344452,
-0.014911812730133533,
-0.0006871151272207499,
0.006731230765581131,
0.0074981520883738995,
-0.0028024998027831316,
0.0025796887930482626,
-0.0015305588021874428,
-0.005555975716561079,
-0.008414528332650661,
-0.005458916071802378,
-0.003753338009119034,
0.00229700212366879,
0.0011021727696061134,
0.06938190758228302,
-0.008058197796344757,
-0.0032872974406927824,
-0.008807143196463585,
0.0000987419334705919,
-0.0008911405457183719,
-0.0015197658212855458,
0.0012217439943924546,
-0.0017761201597750187,
0.0009454127866774797,
0.0030722885858267546,
-0.008415080606937408,
-0.01031474769115448,
-0.00028853994444943964,
0.0022419688757508993,
-0.0033358049113303423,
0.003286849707365036,
0.005538664758205414,
-0.006737430579960346,
0.0018099381122738123,
-0.010857661254703999,
-0.003635177155956626,
-0.0017550052143633366,
-0.0070798578672111034,
-0.0035619738046079874,
-0.0017693848349153996,
0.0031166139524430037,
0.0021720437798649073,
0.006521319970488548,
-0.0021666777320206165,
0.00620498089119792,
-0.0008369016577489674,
0.00022121572692412883,
-0.005779233295470476,
-0.0020149475894868374,
-0.005026406608521938,
0.006361779756844044,
0.0012297871289774776,
-0.011036881245672703,
-0.007137602660804987,
-0.0034684317652136087,
-0.00018902710871770978,
-0.005411332938820124,
0.00484451511874795,
0.003585647791624069,
0.007195672485977411,
-0.0034051225520670414,
0.0018771551549434662,
-0.005262776743620634,
0.0018176061566919088,
-0.01468294020742178,
0.0022579298820346594,
-0.17850801348686218,
0.010082264430820942,
0.005969424266368151,
-0.005277229007333517,
-0.002321837469935417,
-0.014772201888263226,
-0.007210297975689173,
0.003985929302871227,
0.01048592384904623,
0.0000812521466286853,
0.00038995157228782773,
-0.0013702819123864174,
0.0031524028163403273,
0.004136829171329737,
-0.0004854781727772206,
-0.005671820603311062,
0.0015443015145137906,
-0.005358188413083553,
-0.0007795342244207859,
0.004978308454155922,
0.003305369522422552,
0.008975223638117313,
0.0029475821647793055,
0.0025021524634212255,
-0.0018104424234479666,
-0.003609890816733241,
0.00593942403793335,
-0.0034706091973930597,
0.0021520648151636124,
-0.013292727991938591,
-0.0033593366388231516,
-0.004143243655562401,
-0.005726127419620752,
0.0021457807160913944,
0.003970225807279348,
-0.0015398876275867224,
0.00996382161974907,
0.0038414262235164642,
-0.008722666651010513,
0.007923578843474388,
-0.0075461710803210735,
0.02947181463241577,
0.005060289520770311,
0.007670765742659569,
-0.00047293739044107497,
-0.004936172626912594,
-0.0034078829921782017,
0.008029372431337833,
0.003813667455688119,
0.01091676950454712,
-0.008558950386941433,
-0.004118857905268669,
0.0036915140226483345,
0.01990361697971821,
-0.004938711412250996,
-0.009176503866910934,
-0.007888897322118282,
-0.004726668819785118,
0.004587308969348669,
0.009488563984632492,
0.009240217506885529,
-0.005410715006291866,
0.006897557061165571,
-0.0018146870424970984,
-0.023030724376440048,
0.00600710092112422,
-0.0009264501859433949,
-0.007368820253759623,
0.004593261051923037,
0.0057797799818217754,
0.008793530985713005,
-0.0011109346523880959,
0.006161112803965807,
-0.00028140039648860693,
0.0033121018204838037,
-0.0010977076599374413,
0.0069521223194897175,
-0.003270852379500866,
0.006339590065181255,
-0.009790315292775631,
0.008835656568408012,
-0.009513447061181068,
-0.0021466391626745462,
0.0020762362983077765,
-0.002693888731300831,
0.011860664933919907,
0.0052875918336212635,
-0.0016916805179789662,
0.001038869027979672,
-0.012185041792690754,
-0.0009648859850130975,
0.001540681696496904,
0.003057027468457818,
-0.010473745875060558,
0.0034742914140224457,
-0.0037903725169599056,
0.006492071785032749,
0.007974797859787941,
-0.008145663887262344,
0.0055811139754951,
0.0021240191999822855,
-0.007557533215731382,
0.0002660547033883631,
-0.00579758919775486,
-0.0003835693933069706,
0.0029662810266017914,
-0.0071019637398421764,
-0.008751998655498028,
0.003461934393271804,
-0.006061597727239132,
-0.005331503693014383,
0.005951374303549528,
-0.011409142054617405,
-0.009285000152885914,
0.0005536587559618056,
-0.011894349940121174,
0.0014441037783399224
] |
8a8a2f0c0a2dfbb11e77c498d88fd4e6f73817b2 | 2,168 | py | Python | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/database_account_list_keys_result_py3.py | limingu/azure-cli-extensions | 1bc29f089f4da42ab8905e440f2f46d6b5b0aa97 | [
"MIT"
] | 2 | 2021-06-05T17:51:26.000Z | 2021-11-17T11:17:56.000Z | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/database_account_list_keys_result_py3.py | limingu/azure-cli-extensions | 1bc29f089f4da42ab8905e440f2f46d6b5b0aa97 | [
"MIT"
] | 1 | 2020-06-12T01:39:40.000Z | 2020-06-12T01:39:40.000Z | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/models/database_account_list_keys_result_py3.py | anpaz-msft/azure-cli-extensions | 847fd487fe61e83f2a4163a9393edc9555267bc2 | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .database_account_list_read_only_keys_result_py3 import DatabaseAccountListReadOnlyKeysResult
class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult):
"""The access keys for the given database account.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar primary_readonly_master_key: Base 64 encoded value of the primary
read-only key.
:vartype primary_readonly_master_key: str
:ivar secondary_readonly_master_key: Base 64 encoded value of the
secondary read-only key.
:vartype secondary_readonly_master_key: str
:ivar primary_master_key: Base 64 encoded value of the primary read-write
key.
:vartype primary_master_key: str
:ivar secondary_master_key: Base 64 encoded value of the secondary
read-write key.
:vartype secondary_master_key: str
"""
_validation = {
'primary_readonly_master_key': {'readonly': True},
'secondary_readonly_master_key': {'readonly': True},
'primary_master_key': {'readonly': True},
'secondary_master_key': {'readonly': True},
}
_attribute_map = {
'primary_readonly_master_key': {'key': 'primaryReadonlyMasterKey', 'type': 'str'},
'secondary_readonly_master_key': {'key': 'secondaryReadonlyMasterKey', 'type': 'str'},
'primary_master_key': {'key': 'primaryMasterKey', 'type': 'str'},
'secondary_master_key': {'key': 'secondaryMasterKey', 'type': 'str'},
}
def __init__(self, **kwargs) -> None:
super(DatabaseAccountListKeysResult, self).__init__(**kwargs)
self.primary_master_key = None
self.secondary_master_key = None
| 40.90566 | 98 | 0.66928 | 1 | 1.3266 | [
0.002165951067581773,
0.02414289116859436,
0.006920472718775272,
0.0034154164604842663,
0.0018671986181288958,
-0.0030062508303672075,
-0.007084961980581284,
0.001395512605085969,
-0.007581085432320833,
0.00618214625865221,
0.004622526466846466,
0.004155390430241823,
0.005697640124708414,
-0.01615903340280056,
-0.0010564308613538742,
0.018019726499915123,
-0.04953717812895775,
0.0010153778130188584,
-0.002111610723659396,
-0.00027554191183298826,
-0.007858173921704292,
0.007824514992535114,
0.010115493088960648,
0.007447161246091127,
0.0074812909588217735,
-0.002682920778170228,
0.010963266715407372,
0.002741047879680991,
-0.005741824861615896,
-0.004534158390015364,
-0.0019334189128130674,
-0.0038517951034009457,
-0.004823567811399698,
-0.007052727974951267,
0.006044337060302496,
-0.006764295976608992,
0.0002611071686260402,
-0.020789021626114845,
0.011569398455321789,
-0.003198223887011409,
-0.008395146578550339,
-0.015481074340641499,
-0.002924408996477723,
0.005960466805845499,
-0.008258366957306862,
0.002981289755553007,
-0.00279614538885653,
0.0028472812846302986,
-0.013354637660086155,
0.0079194949939847,
-0.010215477086603642,
0.008108709007501602,
0.013829976320266724,
0.0012685339897871017,
-0.005998393055051565,
-0.007528496906161308,
0.015041215345263481,
-0.0002572046360000968,
-0.010562531650066376,
-0.001158823841251433,
-0.003811750328168273,
-0.0035233336966484785,
0.0058736191131174564,
0.002462741918861866,
-0.015951504930853844,
-0.005462402943521738,
-0.004798609297722578,
-0.0000980466793407686,
-0.0017460334347561002,
0.004397128242999315,
-0.00032840241328813136,
-0.002669149311259389,
0.006448464468121529,
0.0068111238069832325,
0.0018843223806470633,
-0.0023416997864842415,
-0.00027137508732266724,
-0.0018646729877218604,
0.0066998181864619255,
0.002645172644406557,
0.003157986793667078,
-0.00483271898701787,
0.005497687961906195,
0.008079317398369312,
0.01063619926571846,
0.011894556693732738,
0.02049225941300392,
-0.01117230299860239,
0.044639915227890015,
0.004841728135943413,
-0.010258199647068977,
0.0035416814498603344,
-0.005935853812843561,
-0.001212729373946786,
-0.007274219300597906,
-0.023177195340394974,
-0.002344710286706686,
-0.004174933768808842,
-0.0021996672730892897,
0.005887669511139393,
-0.0017506669973954558,
0.007897945120930672,
-0.0024141783360391855,
-0.000694825139362365,
-0.007971110753715038,
0.013980300165712833,
-0.009850629605352879,
-0.003841799683868885,
0.0030290319118648767,
-0.00011566363536985591,
-0.012675991281867027,
-0.0008565896423533559,
0.0030059157870709896,
-0.012026665732264519,
0.0012887585908174515,
0.001959668705239892,
-0.006396526470780373,
0.04852069169282913,
0.00012415360833983868,
0.0026652233209460974,
-0.004679467063397169,
0.0007536692428402603,
0.002393104834482074,
0.0035281109157949686,
0.006993730086833239,
-0.0006203593220561743,
0.012468105182051659,
0.008069636300206184,
0.0027677002362906933,
0.008791837841272354,
-0.00405304366722703,
0.010827642865478992,
-0.003647423116490245,
-0.004046495538204908,
-0.0016633219784125686,
-0.006905536632984877,
0.0036962165031582117,
-0.002048081485554576,
-0.009529907256364822,
0.003032009582966566,
-0.004460841417312622,
-0.010112058371305466,
-0.0004906440153717995,
-0.0026561792474240065,
0.005269365385174751,
-0.010770807974040508,
-0.0018887404585257173,
-0.0036579743027687073,
-0.004042764659970999,
0.005365076474845409,
0.01054253801703453,
0.0032495292834937572,
0.0028019866440445185,
-0.0039197891019284725,
-0.006251639220863581,
0.0035742914769798517,
-0.002794844564050436,
0.00107326521538198,
0.009235934354364872,
0.0036331776063889265,
-0.009533274918794632,
-0.00046781214768998325,
0.0036487560719251633,
0.002785546239465475,
-0.004900083411484957,
0.0070312777534127235,
-0.00963449664413929,
0.009694078005850315,
0.001074501546099782,
0.003267651656642556,
0.007892678491771221,
-0.008012405596673489,
0.00020828613196499646,
-0.0010193350026383996,
0.003228427842259407,
0.0011438849614933133,
0.005267051048576832,
0.00824359804391861,
-0.004843945614993572,
-0.0064569809474051,
0.0021315449848771095,
0.006246168632060289,
0.008884348906576633,
0.005707056261599064,
-0.0017124663572758436,
0.0023693807888776064,
-0.006230384111404419,
-0.0014225644990801811,
0.00561280082911253,
-0.006001923233270645,
0.004833339247852564,
0.00269541097804904,
-0.01361565850675106,
-0.010119296610355377,
0.003263345919549465,
-0.00916153471916914,
0.0019386567873880267,
0.016917964443564415,
0.011924093589186668,
-0.003515018383041024,
0.005811698269098997,
-0.00666320975869894,
0.0030780755914747715,
0.006201678887009621,
-0.000357506942236796,
-0.013152072206139565,
-0.9602391123771667,
0.009528644382953644,
0.0021374491043388844,
-0.0009410303900949657,
0.0024208754766732454,
0.00004921659638057463,
0.00277765397913754,
0.0031374755781143904,
0.014664643444120884,
-0.007987194694578648,
-0.004584639333188534,
-0.010758206248283386,
-0.01147625781595707,
-0.0004863767244387418,
-0.006555016152560711,
-0.002699802862480283,
-0.0072145648300647736,
-0.007916226983070374,
-0.004039335064589977,
-0.006040673237293959,
-0.0024740167427808046,
0.008557897061109543,
-0.0030864346772432327,
0.005881214514374733,
0.005085020791739225,
0.0037378983106464148,
-0.002510269172489643,
-0.002176933689042926,
-0.0008901566616259515,
-0.00008494241046719253,
-0.007361177355051041,
-0.01280884724110365,
-0.004107738379389048,
-0.0033264048397541046,
0.009112323634326458,
0.0006680288352072239,
0.0061849807389080524,
-0.002015220234170556,
0.0023974657524377108,
-0.008174559101462364,
0.004693114664405584,
-0.0023737275041639805,
0.0038945949636399746,
-0.02854321524500847,
0.0034058389719575644,
-0.0005814790492877364,
-0.009548796340823174,
0.008282293565571308,
0.0017626644112169743,
0.0015239830827340484,
-0.002555681625381112,
-0.005172202363610268,
0.00938065629452467,
-0.005575160495936871,
0.0020059237722307444,
-0.005322318524122238,
-0.007254411466419697,
-0.0024623791687190533,
-0.009431197308003902,
0.00034897224395535886,
0.0049569085240364075,
-0.0005986002506688237,
-0.003930395003408194,
-0.005677996203303337,
0.0038607551250606775,
0.004667910281568766,
0.002716261427849531,
-0.017272237688302994,
-0.009305504150688648,
-0.0016637424705550075,
0.0001019761330098845,
-0.003939365968108177,
-0.0038380895275622606,
0.00560989324003458,
-0.010201728902757168,
0.006593962665647268,
0.0017616533441469073,
-0.0005803865497000515,
-0.009568656794726849,
0.00014286290388554335,
-0.008131650276482105,
-0.005416502244770527,
0.0003329947649035603,
-0.0072194840759038925,
-0.007948900572955608,
-0.0001497027842560783,
0.0017934709321707487,
0.008595993742346764,
-0.004021474625915289,
0.009065608493983746,
0.011196215637028217,
-0.00018477939011063427,
-0.007376272231340408,
0.006969038397073746,
0.007691645063459873,
0.0008127980399876833,
-0.0027258568443357944,
0.0022527212277054787,
0.008339530788362026,
0.004873950500041246,
0.004525880794972181,
0.0048205675557255745,
0.0007850564434193075,
0.010132331401109695,
-0.0021320469677448273,
0.002445091027766466,
-0.003407831070944667,
-0.0011935351649299264,
-0.005512420553714037,
-0.0030602985061705112,
-0.0032946530263870955,
-0.004884934052824974,
-0.014627382159233093,
-0.007490806747227907,
-0.0014330485137179494,
-0.0024600522592663765,
0.0028345256578177214,
-0.0030540768057107925,
0.0015920154983177781,
0.0013552962336689234,
0.007410036399960518,
-0.0018162502674385905,
-0.0016306176548823714,
0.0008560340502299368,
0.00233601126819849,
-0.0045234328135848045,
0.014208518899977207,
-0.012295419350266457,
0.009221775457262993,
0.0026490262243896723,
-0.014156966470181942,
0.0063912831246852875,
0.009325233288109303,
-0.010793446563184261,
0.0026715800631791353,
0.0036086966283619404,
0.004657287150621414,
-0.0009673828026279807,
-0.002620080951601267,
-0.00402868865057826,
-0.016440344974398613,
0.0006890405202284455,
0.020680256187915802,
-0.0032389808911830187,
0.012802651152014732,
0.01109271589666605,
-0.005233967211097479,
0.002286990638822317,
0.004140844102948904,
0.0055225384421646595,
0.010831940919160843,
-0.006013179663568735,
-0.0015512044774368405,
0.0034310687333345413,
-0.004204326309263706,
0.00038169746403582394,
0.005997864063829184,
0.006478823721408844,
-0.0018087780335918069,
0.001409773831255734,
-0.005672345403581858,
-0.003280208446085453,
-0.019090594723820686,
-0.0003390357887838036,
0.008587728254497051,
-0.00465876329690218,
0.006582619622349739,
-0.009794032201170921,
0.005118018947541714,
0.004086789209395647,
0.002750343643128872,
0.00007733935490250587,
-0.0011263962369412184,
0.007659148890525103,
0.011248167604207993,
-0.005948190577328205,
0.0018553497502580285,
0.003026809776201844,
-0.0016052075661718845,
0.0031295306980609894,
0.012090960517525673,
-0.0057390169240534306,
-0.00508610624819994,
0.005492762662470341,
0.0017049310263246298,
0.0018937482964247465,
-0.00665675476193428,
-0.011174616403877735,
-0.0022262230049818754,
0.002041050000116229,
-0.002461422001942992,
0.004072399344295263,
0.0025454864371567965,
0.0018337826477363706,
-0.0037307378370314837,
0.0016813193215057254,
-0.0019713020883500576,
-0.010573240928351879,
0.014336008578538895,
-0.0025171739980578423,
0.004430689383298159,
0.012637454085052013,
0.0020468994043767452,
-0.013034535571932793,
0.004102872684597969,
0.008558807894587517,
-0.0027162402402609587,
0.006673108320683241,
0.004628883674740791,
-0.007113736122846603,
-0.02353569120168686,
-0.004286932293325663,
-0.013550257310271263,
0.00501973507925868,
-0.00330712110735476,
0.006630337797105312,
-0.0053024617955088615,
0.007108595222234726,
0.00689809350296855,
-0.015805652365088463,
-0.006869325414299965,
-0.006698190234601498,
0.010154551826417446,
-0.000539285596460104,
-0.00012310846068430692,
-0.004402090795338154,
-0.001351919723674655,
-0.004545779433101416,
-0.00530888419598341,
-0.002903045155107975,
0.009929475374519825,
0.0038035991601645947,
-0.002824774943292141,
0.002686512190848589,
-0.008063366636633873,
0.0011329178232699633,
-0.0003952650586143136,
-0.011335453949868679,
0.0013164747506380081,
0.0020008902065455914,
-0.0007307322230190039,
-0.002803489100188017,
0.000432181463111192,
0.001841690973378718,
-0.005219812970608473,
-0.010999820195138454,
-0.0030209277756512165,
-0.0029607880860567093,
-0.005779349245131016,
-0.012749499641358852,
-0.0005215654382482171,
-0.010689949616789818,
0.0040995879098773,
-0.005416538566350937,
0.007456678431481123,
0.0047478084452450275,
-0.004048127681016922,
0.00891776941716671,
0.0018400107510387897,
0.00313337380066514,
0.004480098839849234,
0.0064828707836568356,
-0.003202202031388879,
-0.004131653346121311,
-0.011402134783565998,
0.010669627226889133,
-0.008429035544395447,
-0.0016303450101986527,
0.013967381790280342,
0.006176451221108437,
0.009336194954812527,
-0.0008926863083615899,
-0.002032686024904251,
0.002282465109601617,
0.0049720280803740025,
-0.012429766356945038,
0.0040356493555009365,
-0.0018825313309207559,
0.0005915134679526091,
0.007909739390015602,
-0.004721230827271938,
0.0022187179420143366,
0.009619608521461487,
0.0006747955339960754,
-0.009707560762763023,
-0.0035612317733466625,
-0.00020051957108080387,
0.003412980819121003,
-0.009651141241192818,
0.0015497008571401238,
-0.007150666322559118,
-0.003748031333088875,
-0.0023350846022367477,
-0.004211438819766045,
-0.0003539121535141021,
0.0042902398854494095,
-0.0063007608987390995,
0.003235982730984688,
0.00008109057671390474,
-0.00582277262583375,
0.014811075292527676,
-0.0053414758294820786,
-0.005178040359169245,
0.0003230961156077683,
0.0029608288314193487,
-0.003374178195372224,
-0.005725319031625986,
-0.00403547752648592,
0.002628214657306671,
0.004877262283116579,
-0.0035375934094190598,
-0.005674066953361034,
0.00036588136572390795,
-0.0011379248462617397,
-0.007225405890494585,
0.002886509755626321,
0.009438350796699524,
-0.002950389636680484,
0.006101398263126612,
-0.0025151788722723722,
-0.010223266668617725,
-0.012989849783480167,
0.05454513803124428,
-0.002318077487871051,
0.006968949921429157,
0.0017657683929428458,
-0.006964914035052061,
-0.004095399286597967,
-0.0010600067907944322,
0.009769869036972523,
-0.0027979675214737654,
-0.004999176133424044,
0.008734624832868576,
-0.0036681487690657377,
0.0058369082398712635,
0.0010432174894958735,
-0.0022290933411568403,
0.013667874038219452,
-0.0046454076655209064,
-0.015243344940245152,
-0.014603511430323124,
0.00758653599768877,
-0.002492674859240651,
-0.01156275998800993,
0.011707133613526821,
-0.0011680744355544448,
-0.007111441344022751,
0.0004188489983789623,
0.006227515172213316,
0.0015314779011532664,
-0.0015018710400909185,
-0.005113187246024609,
-0.0006742217228747904,
-0.002662686863914132,
0.0030942843295633793,
0.005341346841305494,
0.005739565007388592,
-0.004856074694544077,
0.0048965513706207275,
-0.00407838448882103,
-0.0010625366121530533,
-0.0009063114994205534,
0.003748111892491579,
0.006565917283296585,
-0.00003234199539292604,
-0.0014864387921988964,
0.0043320683762431145,
0.006698449142277241,
0.0010164802661165595,
0.012159779667854309,
0.0016385182971134782,
-0.0062621235847473145,
0.008053280413150787,
0.007677024696022272,
0.00023882130335550755,
0.008124133571982384,
-0.004025951959192753,
0.0031721950508654118,
0.002270120196044445,
-0.003930532839149237,
-0.017388194799423218,
0.00000939144865697017,
0.00854668952524662,
0.005558732431381941,
-0.001635692548006773,
0.002765090437605977,
-0.00037715272628702223,
-0.001116233877837658,
-0.003698413958773017,
-0.006165105849504471,
-0.004624542780220509,
-0.0007050639833323658,
0.009710238315165043,
0.06774868071079254,
-0.009154553525149822,
-0.0008763998630456626,
-0.007805970031768084,
0.0005476677906699479,
-0.0037988098338246346,
-0.0013321274891495705,
-0.000707366387359798,
-0.0022406994830816984,
-0.000809323275461793,
-0.0012314653722569346,
-0.009095022454857826,
-0.010208522900938988,
0.001049589249305427,
0.0005481182015500963,
-0.0029601275455206633,
0.005522726569324732,
0.0072894636541605,
-0.011312797665596008,
0.001285022939555347,
-0.012892261147499084,
-0.004201795440167189,
-0.006957423407584429,
-0.010805370286107063,
-0.003885323414579034,
-0.0025191386230289936,
0.006361654028296471,
0.004413600079715252,
0.007213495206087828,
-0.0029589475598186255,
0.007809625472873449,
-0.0033980049192905426,
0.0004433408612385392,
-0.005798766855150461,
-0.00010201067198067904,
-0.002917366800829768,
0.004050042945891619,
0.0016127104172483087,
-0.009069131687283516,
-0.0035985189024358988,
-0.005931858438998461,
-0.000905993627384305,
-0.004923552740365267,
0.004650828894227743,
-0.0013521284563466907,
0.004983383696526289,
-0.0025153018068522215,
-0.003616616828367114,
-0.0045758867636322975,
0.0016656428342685103,
-0.010120599530637264,
0.006130301859229803,
-0.16800503432750702,
0.005519302561879158,
0.0026318419259041548,
-0.0023239965084940195,
-0.0031456102151423693,
-0.01675611548125744,
-0.004087422974407673,
0.0053518046624958515,
0.007205952890217304,
0.0028592569287866354,
-0.0025904211215674877,
-0.001859635696746409,
0.0021463194862008095,
0.003590403823181987,
-0.002317295642569661,
-0.005912709981203079,
0.0020221341401338577,
-0.004625328816473484,
0.0002517758111935109,
0.0089843375608325,
0.004595591686666012,
0.007695348002016544,
-0.0002155904221581295,
0.00002127699372067582,
-0.0017042268300428987,
-0.0006213940214365721,
0.005717885680496693,
-0.002452496439218521,
0.004527707118541002,
-0.011111296713352203,
-0.003483513602986932,
-0.002579263411462307,
-0.007033341098576784,
0.0018826440209522843,
0.006982062477618456,
0.00030612616683356464,
0.011167673394083977,
0.0003187060938216746,
-0.0034701235126703978,
0.002810368314385414,
-0.005948162171989679,
0.023413268849253654,
0.008645440451800823,
0.0036223633214831352,
-0.00012010167120024562,
-0.006674282252788544,
-0.006180933676660061,
0.007346975151449442,
0.0026319720782339573,
0.010941588319838047,
-0.011043363250792027,
-0.001346662058494985,
0.00397737929597497,
0.016964808106422424,
-0.005925437901169062,
-0.01114827860146761,
-0.006781679578125477,
-0.004186464939266443,
0.0005233570700511336,
0.005316671449691057,
0.009379418566823006,
-0.0012037933338433504,
0.011037133634090424,
-0.002268858253955841,
-0.02345924824476242,
0.0013756481930613518,
-0.0030497442930936813,
-0.010342269204556942,
0.0028701999690383673,
0.0068887886591255665,
0.00975948479026556,
-0.0002667123917490244,
-0.001652320148423314,
-0.0013091539731249213,
0.011376826092600822,
0.0019960368517786264,
0.009376885369420052,
0.001872314023785293,
0.004760267212986946,
-0.008813152089715004,
0.007648482918739319,
-0.009718331508338451,
-0.002698813332244754,
0.00318941124714911,
-0.002588948467746377,
0.013831901364028454,
0.005825282074511051,
-0.0008249834063462913,
-0.00006457192648667842,
-0.007966051809489727,
-0.0014181281439960003,
0.00411367230117321,
0.0018401327542960644,
-0.005468121729791164,
0.0020539008546620607,
0.002732659224420786,
0.0036990002263337374,
0.008430142886936665,
-0.010989795438945293,
0.010206518694758415,
0.0053549520671367645,
-0.001158835948444903,
0.00011146891483804211,
-0.008645624853670597,
0.0032555037178099155,
0.0042396001517772675,
-0.006016785744577646,
-0.005230197217315435,
0.0015596190933138132,
-0.003596819471567869,
-0.0041607762686908245,
0.005087756551802158,
-0.01009979285299778,
-0.00987025536596775,
-0.0031703216955065727,
-0.007365752477198839,
0.00035893815220333636
] |
8a8aa73cf4c767bf7b906925d1382b404b94f301 | 1,834 | py | Python | Google/google_books/scrape_google_books.py | dimitryzub/blog-posts-archive | 0978aaa0c9f0142d6f996b81ce391930c5e3be35 | [
"CC0-1.0"
] | null | null | null | Google/google_books/scrape_google_books.py | dimitryzub/blog-posts-archive | 0978aaa0c9f0142d6f996b81ce391930c5e3be35 | [
"CC0-1.0"
] | null | null | null | Google/google_books/scrape_google_books.py | dimitryzub/blog-posts-archive | 0978aaa0c9f0142d6f996b81ce391930c5e3be35 | [
"CC0-1.0"
] | null | null | null | from parsel import Selector
import requests, json, re
params = {
"q": "richard branson",
"tbm": "bks",
"gl": "us",
"hl": "en"
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.87 Safari/537.36",
}
html = requests.get("https://www.google.com/search", params=params, headers=headers, timeout=30)
selector = Selector(text=html.text)
books_results = []
# https://regex101.com/r/mapBs4/1
book_thumbnails = re.findall(r"s=\\'data:image/jpg;base64,(.*?)\\'", str(selector.css("script").getall()), re.DOTALL)
for book_thumbnail, book_result in zip(book_thumbnails, selector.css(".Yr5TG")):
title = book_result.css(".DKV0Md::text").get()
link = book_result.css(".bHexk a::attr(href)").get()
displayed_link = book_result.css(".tjvcx::text").get()
snippet = book_result.css(".cmlJmd span::text").get()
author = book_result.css(".fl span::text").get()
author_link = f'https://www.google.com/search{book_result.css(".N96wpd .fl::attr(href)").get()}'
date_published = book_result.css(".fl+ span::text").get()
preview_link = book_result.css(".R1n8Q a.yKioRe:nth-child(1)::attr(href)").get()
more_editions_link = book_result.css(".R1n8Q a.yKioRe:nth-child(2)::attr(href)").get()
books_results.append({
"title": title,
"link": link,
"displayed_link": displayed_link,
"snippet": snippet,
"author": author,
"author_link": author_link,
"date_published": date_published,
"preview_link": preview_link,
"more_editions_link": f"https://www.google.com{more_editions_link}" if more_editions_link is not None else None,
"thumbnail": bytes(bytes(book_thumbnail, "ascii").decode("unicode-escape"), "ascii").decode("unicode-escape")
})
| 39.869565 | 135 | 0.657579 | 1 | 1.3911 | [
0.0013681850396096706,
0.024902591481804848,
0.010175392962992191,
0.002117002848535776,
0.004077522549778223,
-0.004491169936954975,
-0.009040194563567638,
0.0030116469133645296,
-0.00610787607729435,
0.0031546768732368946,
0.0029906616546213627,
0.0063133444637060165,
0.0073914434760808945,
-0.014813934452831745,
0.0026408685371279716,
0.014456572011113167,
-0.049884408712387085,
0.0012180035701021552,
-0.003770303213968873,
0.0018278900533914566,
-0.00807993020862341,
0.009692252613604069,
0.00920043047517538,
0.004773538559675217,
0.005547078792005777,
-0.00037092826096341014,
0.007624726742506027,
0.0026104217395186424,
-0.00846722349524498,
-0.00658002495765686,
-0.002410191111266613,
-0.0012993229320272803,
-0.005224482621997595,
-0.007082520984113216,
0.004090363625437021,
-0.004137804731726646,
-0.001563275116495788,
-0.02251025103032589,
0.011592806316912174,
-0.003729094285517931,
-0.006300090346485376,
-0.01415240578353405,
0.0010809144005179405,
0.0038437845651060343,
-0.009562395513057709,
-0.00024907849729061127,
-0.004409260116517544,
0.0032214014790952206,
-0.008696986362338066,
0.005529465619474649,
-0.008776559494435787,
0.005044241901487112,
0.012955536134541035,
0.003700170898810029,
-0.0041420855559408665,
-0.006651817820966244,
0.012018456123769283,
-0.0009859063429757953,
-0.00973496027290821,
-0.0005059535033069551,
-0.0027075635734945536,
-0.002700493671000004,
0.005152060650289059,
0.002847150433808565,
-0.017355605959892273,
-0.007461263332515955,
-0.0042110625654459,
0.0033805151470005512,
-0.0010732192313298583,
0.004944933578372002,
0.000415878021158278,
-0.0013310685753822327,
0.005874852649867535,
0.005304953083395958,
0.003223814070224762,
-0.0032009093556553125,
0.00022300489945337176,
0.00033580439048819244,
0.007954545319080353,
0.004841858986765146,
0.005525714717805386,
-0.005529874935746193,
0.006693973205983639,
0.009301651269197464,
0.014537704177200794,
0.007393333129584789,
0.019370680674910545,
-0.012772261165082455,
0.04691605269908905,
0.007295269053429365,
-0.007934514433145523,
0.001866077771410346,
-0.007721093483269215,
-0.003010157495737076,
-0.003660342423245311,
-0.028062136843800545,
-0.0010342828463762999,
-0.0033658002503216267,
0.0012007554760202765,
0.0018171038245782256,
-0.0007378304144367576,
0.006705533247441053,
-0.0002605926711112261,
-0.0030937599949538708,
-0.008656219579279423,
0.011674637906253338,
-0.008978275582194328,
-0.0033174892887473106,
0.006905232556164265,
0.002887915587052703,
-0.011939424090087414,
-0.0026186516042798758,
0.0011853794567286968,
-0.011516139842569828,
0.0022825184278190136,
0.003929622005671263,
-0.006499527487903833,
0.05199683457612991,
-0.001327723148278892,
0.002244026632979512,
-0.0054769753478467464,
0.0011486507719382644,
0.0020001442171633244,
0.006045076530426741,
0.008855091407895088,
-0.0027638364117592573,
0.010546166449785233,
0.009032499976456165,
0.0029956926591694355,
0.008190221153199673,
-0.001310980529524386,
0.005848252214491367,
-0.004003312438726425,
-0.0028058525640517473,
-0.0008104433072730899,
-0.00825911108404398,
0.008581315167248249,
-0.003154469421133399,
-0.006693647708743811,
0.00391897838562727,
-0.000614593387581408,
-0.009811698459088802,
0.002476796740666032,
-0.005161406472325325,
0.0044242218136787415,
-0.010679556988179684,
-0.0023329725954681635,
-0.004517200868576765,
-0.005027839448302984,
0.0026854616589844227,
0.009416946209967136,
0.003114900318905711,
0.002257531275972724,
-0.005084323696792126,
-0.00832482147961855,
0.0017034775810316205,
-0.0034547976683825254,
0.002463166369125247,
0.007823931984603405,
0.002779543399810791,
-0.009652393870055676,
0.0008559447014704347,
0.002527604578062892,
0.002330461051315069,
-0.0004064965178258717,
0.004643160849809647,
-0.008183026686310768,
0.007787699345499277,
-0.0017627025954425335,
0.004806618671864271,
0.010198342613875866,
-0.0034876593854278326,
-0.00023546162992715836,
0.00005248625893727876,
0.002566475188359618,
-0.00185700214933604,
0.004824881907552481,
0.012282319366931915,
-0.003830298315733671,
-0.0035221499856561422,
0.004353195428848267,
0.004784956108778715,
0.010581690818071365,
0.00439659645780921,
-0.0023131659254431725,
0.0003352754283696413,
-0.005564217455685139,
-0.0012586124939844012,
0.0048513817600905895,
-0.004686207044869661,
0.006470072083175182,
0.004907053895294666,
-0.012975986115634441,
-0.008146685548126698,
0.002233753679320216,
-0.01015661470592022,
0.0021599719766527414,
0.014616469852626324,
0.01101549994200468,
-0.0035276995040476322,
0.003497543977573514,
-0.010417412035167217,
0.001256785704754293,
0.008625099435448647,
0.0010971148731186986,
-0.012655242346227169,
-0.9595680236816406,
0.005777005571871996,
0.0035937782377004623,
-0.0015665398677811027,
0.00460575707256794,
0.0032089606393128633,
0.001558313611894846,
0.0046277944929897785,
0.014317370019853115,
-0.00866401381790638,
-0.006248728837817907,
-0.010416971519589424,
-0.010820245370268822,
-0.002203957177698612,
-0.007532231509685516,
-0.0034936643205583096,
-0.008137042634189129,
-0.007719623856246471,
-0.0021386377047747374,
-0.004364917520433664,
-0.0026786266826093197,
0.007372527848929167,
-0.0003292187466286123,
0.0060473112389445305,
0.0043979608453810215,
0.0026642302982509136,
-0.00520394928753376,
-0.0015954339178279042,
-0.002148166997358203,
-0.0038694574031978846,
-0.008168231695890427,
-0.012483812868595123,
-0.006863107439130545,
-0.00017485368880443275,
0.010313242673873901,
0.0002746495301835239,
0.009027695283293724,
-0.000305643625324592,
0.003961292095482349,
-0.006871839519590139,
0.005317078437656164,
-0.0014640208100900054,
0.0019224976422265172,
-0.029234865680336952,
-0.0013489802367985249,
-0.0010617634980008006,
-0.009882381185889244,
0.009630529209971428,
-0.00037622509989887476,
-0.0002564915339462459,
-0.003971809055656195,
-0.004735725466161966,
0.008294511586427689,
-0.006158572621643543,
0.00275043910369277,
-0.003577622352167964,
-0.007411590777337551,
-0.0026510024908930063,
-0.008154353126883507,
-3.081935417981185e-8,
0.003555045695975423,
-0.002361495513468981,
-0.0040071927942335606,
-0.0029500899836421013,
0.0027716197073459625,
0.0028290648479014635,
0.003720765234902501,
-0.01780754141509533,
-0.006171215791255236,
0.0014890902675688267,
0.0022502909414470196,
-0.0016026721568778157,
-0.0037294658832252026,
0.0035033258609473705,
-0.00958122219890356,
0.006307230796664953,
0.003904747311025858,
0.0005029896856285632,
-0.012704942375421524,
-0.0017217117128893733,
-0.00982495117932558,
-0.009335263632237911,
0.0014204608742147684,
-0.005748421885073185,
-0.0035050457809120417,
-0.0018049133941531181,
0.0013285920722410083,
0.0074081141501665115,
-0.00454120384529233,
0.0045956517569720745,
0.009644144214689732,
-0.0027622943744063377,
-0.009432008489966393,
0.007357179652899504,
0.006360858213156462,
-0.0005344374221749604,
-0.0032758605666458607,
0.0026046480052173138,
0.008097820915281773,
0.007931443862617016,
0.002269917633384466,
0.004672294482588768,
-0.0001809080713428557,
0.011175214312970638,
-0.0007689414778724313,
0.0007078507333062589,
-0.005227064248174429,
0.0007033689762465656,
-0.002178599825128913,
0.00035769189707934856,
-0.003948818892240524,
-0.00161647645290941,
-0.012371348217129707,
-0.009130937047302723,
-0.0017021879320964217,
0.0014003824908286333,
0.0035967661533504725,
-0.004806585144251585,
-0.00033961914596147835,
0.001744419801980257,
0.007071694824844599,
0.0002462055708747357,
-0.004925325978547335,
-0.0013813019031658769,
0.002600516891106963,
-0.006300768349319696,
0.015753690153360367,
-0.009407798759639263,
0.00700590992346406,
-0.0003683198301587254,
-0.01511598564684391,
0.007052354980260134,
0.009172818623483181,
-0.007102987729012966,
0.002354851458221674,
0.001681047142483294,
0.004473325330764055,
-0.0004982886603102088,
-0.004919787868857384,
-0.004646327346563339,
-0.01621422730386257,
0.0008238584850914776,
0.020364733412861824,
0.0030410345643758774,
0.00989194680005312,
0.010436736047267914,
-0.005334486719220877,
0.0017256649443879724,
0.006745372898876667,
0.0026517976075410843,
0.011780836619436741,
-0.0073190415278077126,
0.0005044213612563908,
0.003808228299021721,
-0.007305947132408619,
0.0007367234793491662,
0.005933262873440981,
0.005561913829296827,
-0.003346038283780217,
0.0032608164474368095,
-0.0072464714758098125,
-0.0052023036405444145,
-0.017842648550868034,
-0.003295875620096922,
0.006024136207997799,
-0.004240644630044699,
0.005974950734525919,
-0.013323781080543995,
0.004946592729538679,
0.006953684147447348,
0.003616144647821784,
0.000025110768547165208,
0.0002606086782179773,
0.006824382580816746,
0.01260445173829794,
-0.005853595677763224,
0.0017529421020299196,
0.003191405674442649,
-0.00035877383197657764,
0.0012568356469273567,
0.0073879556730389595,
-0.0076067280024290085,
-0.005394193809479475,
0.0026970813050866127,
0.006832071114331484,
-0.001777062425389886,
-0.0032940730452537537,
-0.009004957042634487,
-0.0035115128848701715,
0.002347955945879221,
-0.00625770166516304,
0.004887786693871021,
-0.0009406132739968598,
0.0034069085959345102,
-0.005941090639680624,
-0.0004941104562021792,
-0.003378198016434908,
-0.011958526447415352,
0.010762677527964115,
-0.001944788615219295,
0.0029023312963545322,
0.012134398333728313,
0.002084473380818963,
-0.012553805485367775,
0.004628490656614304,
0.008302071131765842,
-0.005426054820418358,
0.0035884263925254345,
0.0066094668582081795,
-0.004483136348426342,
-0.022928738966584206,
-0.0017864648252725601,
-0.013099930249154568,
0.0077565074898302555,
-0.0022576062474399805,
0.00513005256652832,
-0.007460271939635277,
0.007232937030494213,
0.007275300100445747,
-0.013654770329594612,
-0.004830119200050831,
-0.00870531890541315,
0.0097424341365695,
0.000457151560112834,
-0.0019870249088853598,
-0.004344181157648563,
-0.0004288663621991873,
-0.0015244079986587167,
-0.005043405573815107,
-0.0020920312963426113,
0.004711268004029989,
0.001302823075093329,
-0.003670989302918315,
0.0015061849262565374,
-0.0038371330592781305,
0.0004002605564892292,
0.0011880797101184726,
-0.009869488887488842,
0.0014883206458762288,
0.003210606751963496,
-0.0024181921035051346,
-0.0019222537521272898,
0.0017818764317780733,
-0.0013662256533280015,
-0.008022141642868519,
-0.010758614167571068,
-0.004409383982419968,
-0.003591714659705758,
-0.002731709275394678,
-0.012678667902946472,
-0.0035724022891372442,
-0.009571757167577744,
0.0062210289761424065,
-0.0067713093012571335,
0.008406093344092369,
0.006184608209878206,
-0.006244439631700516,
0.006113225594162941,
-0.0011402381351217628,
0.004003485199064016,
0.004111508373171091,
0.007357499096542597,
0.00042944171582348645,
-0.004037379287183285,
-0.010189990513026714,
0.009994539432227612,
-0.006190428510308266,
0.001080342917703092,
0.014681115746498108,
0.004710634704679251,
0.008170009590685368,
0.0011685987701639533,
-0.0007696828688494861,
0.001993880607187748,
0.005977824330329895,
-0.012301214039325714,
0.003029138082638383,
-0.004308983683586121,
-0.00036704482045024633,
0.0042566764168441296,
-0.004585389047861099,
0.003499530488625169,
0.009585369378328323,
0.0018278469797223806,
-0.006890831980854273,
-0.0011578594567254186,
0.0011441494571045041,
0.004187389742583036,
-0.012739754281938076,
-0.00023244133626576513,
-0.004579803440719843,
-0.006027356255799532,
-0.0019774790853261948,
-0.0024501862935721874,
-0.0012556362198665738,
0.00431218883022666,
-0.00415518693625927,
0.006962827872484922,
0.0029858534689992666,
-0.004910496529191732,
0.013889421708881855,
-0.0058872876688838005,
-0.004898393526673317,
0.004689821042120457,
0.0025984644889831543,
-0.0013377738650888205,
-0.006277571897953749,
-0.002292832126840949,
0.001340736635029316,
0.006096198223531246,
-0.0034992797300219536,
-0.004310931544750929,
-0.0009276648052036762,
0.00010655615187715739,
-0.008808186277747154,
0.0005553110386244953,
0.012697165831923485,
-0.0048311613500118256,
0.005248403176665306,
-0.003183952532708645,
-0.007788844406604767,
-0.01490821037441492,
0.05317481607198715,
-0.0007175999926403165,
0.004410614259541035,
0.004520852584391832,
-0.007615033071488142,
0.0005185918998904526,
-0.0014771701535210013,
0.0072622220031917095,
-0.006766522768884897,
-0.008097248151898384,
0.008708487264811993,
-0.0031865760684013367,
0.0037855375558137894,
0.004096982069313526,
-0.001748356968164444,
0.015390647575259209,
-0.003773871809244156,
-0.016346808522939682,
-0.016513541340827942,
0.007173432968556881,
-0.00453999312594533,
-0.008111175149679184,
0.010496237315237522,
-0.003565993392840028,
-0.00483624916523695,
0.0016087284311652184,
0.008117292076349258,
-0.0007571781752631068,
-0.00024268262495752424,
-0.002904074965044856,
-0.0019885869696736336,
-0.0006854822859168053,
0.002528078155592084,
0.005411314778029919,
0.006572321057319641,
-0.002934224670752883,
0.0038574431091547012,
-0.002127060666680336,
-0.0018316346686333418,
-0.0005154555547051132,
0.006014482583850622,
0.008140507154166698,
-0.0004145173297729343,
-0.0006022372399456799,
0.005427121184766293,
0.005070019979029894,
0.001324887853115797,
0.011562881991267204,
-0.00025220346287824214,
-0.005900956224650145,
0.009404872544109821,
0.007967326790094376,
-0.000523163063917309,
0.007863372564315796,
-0.00031795710674487054,
0.006599925458431244,
0.00367056205868721,
-0.008128012530505657,
-0.016759470105171204,
-0.001284885685890913,
0.008508025668561459,
0.007968764752149582,
-0.00122934952378273,
0.0005659530288539827,
-0.004854878876358271,
-0.0018849344924092293,
-0.0049817305989563465,
-0.006699444260448217,
-0.0012763583799824119,
0.0019024026114493608,
0.006174385081976652,
0.0703376904129982,
-0.006542193703353405,
-0.0020483024418354034,
-0.007267887704074383,
-0.0015125740319490433,
-0.0024857984390109777,
-0.00025866375654004514,
0.0005309935659170151,
-0.0014438761863857508,
0.0016734534874558449,
-0.000941549486014992,
-0.007273503113538027,
-0.011831052601337433,
-0.0006058180588297546,
0.0033657841850072145,
-0.0030793347395956516,
0.005639656912535429,
0.005190092604607344,
-0.008657986298203468,
0.0021257817279547453,
-0.010622330941259861,
-0.0009751952020451427,
-0.0024269598070532084,
-0.009410277009010315,
-0.002960997400805354,
-0.0044279019348323345,
0.005126632750034332,
0.004456576891243458,
0.006032397970557213,
-0.003363188821822405,
0.006129242014139891,
-0.002154301153495908,
-0.00039356088382191956,
-0.006156057585030794,
-0.0005779812345281243,
-0.006338872481137514,
0.007928472943603992,
0.0018002245342358947,
-0.010965115390717983,
-0.005088602192699909,
-0.0024291255977004766,
0.00026319772587157786,
-0.006619854364544153,
0.004050447605550289,
-0.0009574572904966772,
0.005066589452326298,
-0.00342390569858253,
0.00021963199833407998,
-0.005881382618099451,
0.003941797651350498,
-0.01189152430742979,
0.0036756317131221294,
-0.17175911366939545,
0.010825165547430515,
0.004191617015749216,
-0.005694074556231499,
-0.00218048132956028,
-0.0132046053186059,
-0.00643344409763813,
0.0011400141520425677,
0.008836883120238781,
0.002322998596355319,
-0.0020538524258881807,
-0.0014622609596699476,
0.004677208140492439,
0.0029353115241974592,
-0.0015776142245158553,
-0.0028484647627919912,
0.0035552228800952435,
-0.0038896240293979645,
-0.0001271658402401954,
0.002772985026240349,
0.004817709792405367,
0.009087682701647282,
0.001288104336708784,
0.00269699958153069,
-0.00009610322740627453,
-0.0035207958426326513,
0.005220308899879456,
-0.0023111605551093817,
0.005405851174145937,
-0.01226058043539524,
-0.003394524799659848,
-0.0035775043070316315,
-0.00425356812775135,
-0.0006442839512601495,
0.004651160445064306,
-0.0021670288406312466,
0.009772680699825287,
0.0025846040807664394,
-0.007532786577939987,
0.006829200778156519,
-0.00791333056986332,
0.027121245861053467,
0.005358890630304813,
0.006829523481428623,
-0.0005146963521838188,
-0.004559393972158432,
-0.00547200720757246,
0.010238468647003174,
0.0014943490969017148,
0.011799223721027374,
-0.012252368964254856,
-0.0009889075299724936,
0.002924291417002678,
0.019256185740232468,
-0.0036038807593286037,
-0.00822752807289362,
-0.006719483528286219,
-0.0040678903460502625,
0.0024795366916805506,
0.0077959513291716576,
0.010076319798827171,
-0.003673757193610072,
0.008624060079455376,
-0.002493589650839567,
-0.02234865166246891,
0.003990617580711842,
-0.0037905334029346704,
-0.005805096589028835,
0.0008326241513714194,
0.006635152269154787,
0.009613290429115295,
-0.0016276128590106964,
-0.0004903484950773418,
-0.002868631388992071,
0.005379820708185434,
-0.0010043213842436671,
0.004845519550144672,
-0.002369277412071824,
0.006947707384824753,
-0.0100080082193017,
0.007278094533830881,
-0.008433135226368904,
-0.0027976909186691046,
0.0022249857429414988,
-0.004454616457223892,
0.011051773093640804,
0.0039214687421917915,
-0.001963692484423518,
-0.0014667488867416978,
-0.011199155822396278,
-0.0022095930762588978,
0.0014564922312274575,
0.003654729574918747,
-0.007741624489426613,
0.0026130671612918377,
-0.00023005915863905102,
0.0030466581229120493,
0.005375012755393982,
-0.009282257407903671,
0.006562644615769386,
0.005356812383979559,
-0.0051010590977966785,
-0.00024204356304835528,
-0.005665711592882872,
-0.00016105691611301154,
0.0044797626323997974,
-0.005764089524745941,
-0.006757592316716909,
0.0036440701223909855,
-0.006545761600136757,
-0.006505440920591354,
0.006226611789315939,
-0.008820111863315105,
-0.00958798173815012,
-0.0018737433711066842,
-0.011451547034084797,
0.001460644300095737
] |
8a8bbdd35a1d135f6e6a32befca7b762678940d4 | 327 | py | Python | Python/Higher-Or-Lower/hol/__init__.py | AustinTSchaffer/DailyProgrammer | b16d9babb298ac5e879c514f9c4646b99c6860a8 | [
"MIT"
] | 1 | 2020-07-28T17:07:35.000Z | 2020-07-28T17:07:35.000Z | Python/Higher-Or-Lower/hol/__init__.py | AustinTSchaffer/DailyProgrammer | b16d9babb298ac5e879c514f9c4646b99c6860a8 | [
"MIT"
] | 5 | 2021-04-06T18:25:29.000Z | 2021-04-10T15:13:28.000Z | Python/Higher-Or-Lower/hol/__init__.py | AustinTSchaffer/DailyProgrammer | b16d9babb298ac5e879c514f9c4646b99c6860a8 | [
"MIT"
] | null | null | null | r"""
Contains classes and methods that can be used when simulating the game
Higher-or-Lower and performing statistical analysis on different games.
"""
from hol import (
cards,
constants,
)
from hol._hol import (
generate_all_games,
should_pick_higher,
is_a_winning_game,
generate_win_statistics,
)
| 17.210526 | 71 | 0.737003 | 0 | 0 | [
0.0005805441178381443,
0.023709947243332863,
0.007185367867350578,
0.0007714502862654626,
0.006677805446088314,
-0.005049603059887886,
-0.009264197200536728,
0.004623406566679478,
-0.006467671133577824,
0.0004612987977452576,
0.002850230550393462,
0.0011952740605920553,
0.007103343028575182,
-0.017108874395489693,
0.002488108817487955,
0.016376852989196777,
-0.05558561161160469,
0.003936490043997765,
-0.0020684655755758286,
0.0025957755278795958,
-0.007729412987828255,
0.010647425428032875,
0.006217888556420803,
0.007346553262323141,
0.005586239974945784,
-0.002168628852814436,
0.009656473994255066,
0.0012909317156299949,
-0.004969727247953415,
-0.006810131948441267,
-0.0015929072396829724,
-0.0029477369971573353,
-0.006265886593610048,
-0.010865847580134869,
0.006424867082387209,
-0.003969212062656879,
-0.0014174586394801736,
-0.020926564931869507,
0.012090971693396568,
-0.006306901108473539,
-0.004476075526326895,
-0.01664712093770504,
-0.0006149132968857884,
0.005003635305911303,
-0.012271188199520111,
0.005148111376911402,
-0.0032168584875762463,
0.001962200738489628,
-0.011189141310751438,
0.0051758247427642345,
-0.012350467033684254,
0.0031554438173770905,
0.013705355115234852,
0.003503486979752779,
-0.005198821425437927,
-0.00846796203404665,
0.010585553012788296,
-0.0000634866300970316,
-0.01141170971095562,
0.000555578910280019,
-0.0027201958000659943,
-0.003347797319293022,
0.002707223640754819,
0.003578237723559141,
-0.019049709662795067,
-0.005761428270488977,
-0.0023218083661049604,
0.0012373854406177998,
-0.0031210537999868393,
0.0052290307357907295,
0.002221060683950782,
-0.0015797720989212394,
0.0070548513904213905,
0.00256718834862113,
-0.00022086311946623027,
-0.0038129007443785667,
-0.0005597493727691472,
0.000593160220887512,
0.009549997746944427,
0.003348349826410413,
0.005854446906596422,
-0.008191273547708988,
0.005511366296559572,
0.011504569090902805,
0.013301960192620754,
0.009094418957829475,
0.017325399443507195,
-0.009680151008069515,
0.0400456041097641,
0.006999438162893057,
-0.009981345385313034,
0.001847212202847004,
-0.009602508507668972,
-0.0018522099126130342,
-0.00420138705521822,
-0.029034674167633057,
0.001151538803242147,
-0.006673075724393129,
0.001441126107238233,
0.0036692037247121334,
0.0010117620695382357,
0.0054755848832428455,
-0.002843289403244853,
-0.004439057782292366,
-0.010508347302675247,
0.013386589474976063,
-0.009141583926975727,
-0.003185379086062312,
0.009977709501981735,
0.0015303115360438824,
-0.013274150900542736,
-0.001127272262237966,
0.0007151833851821721,
-0.013365956954658031,
0.005922788754105568,
0.0038381691556423903,
-0.006744323298335075,
0.0555536225438118,
0.000014512309462588746,
0.0005914938519708812,
-0.003382433671504259,
-0.0022210869938135147,
0.0007408122764900327,
0.005783890839666128,
0.009295602329075336,
-0.007756329607218504,
0.011976602487266064,
0.006596110761165619,
0.0029436054173856974,
0.0066535272635519505,
0.0026500215753912926,
0.008709574118256569,
-0.0038320713210850954,
-0.002310117008164525,
-0.00031091857817955315,
-0.008683666586875916,
0.00754777854308486,
-0.0023065179120749235,
-0.0076712314039468765,
0.0013499163324013352,
-0.00141756737139076,
-0.013077235780656338,
0.0014085076982155442,
-0.0023998285178095102,
0.0033566534984856844,
-0.012259427458047867,
-0.0037426811177283525,
-0.003853960894048214,
-0.0028206491842865944,
0.00013301374565344304,
0.007346854079514742,
0.0030394543427973986,
0.0016525819664821029,
-0.006275182124227285,
-0.005578799173235893,
-0.0004009493859484792,
-0.003251942340284586,
0.002324415137991309,
0.00949158240109682,
0.004763978533446789,
-0.010211770422756672,
-0.004056829027831554,
0.0019432493718340993,
0.005552015267312527,
-0.0031191951129585505,
0.0017967475578188896,
-0.008255071938037872,
0.011203679256141186,
0.0018278678180649877,
0.005744472611695528,
0.013214312493801117,
-0.004259713925421238,
-0.002086606342345476,
0.0015064463950693607,
0.00015986985818017274,
-0.001597370021045208,
0.004221612587571144,
0.012034435756504536,
-0.00365989888086915,
-0.005675707943737507,
0.0057305810041725636,
0.0032559556420892477,
0.009334670379757881,
0.00809700507670641,
-0.0030112280510365963,
0.003388336393982172,
-0.004673798568546772,
0.0018915344262495637,
0.00476125068962574,
-0.0031290205661207438,
0.006281605456024408,
0.00547457579523325,
-0.013226375915110111,
-0.007562523707747459,
-0.0024033859372138977,
-0.011816943064332008,
0.0021099066361784935,
0.015088324435055256,
0.012034660205245018,
-0.0004902562941424549,
0.004410077352076769,
-0.010555856861174107,
0.0008671447285450995,
0.008886890485882759,
0.00035337862209416926,
-0.012730834074318409,
-0.9551737904548645,
0.0022325313184410334,
0.004697455558925867,
0.000987161765806377,
0.00104454904794693,
0.002809317549690604,
0.00236687483265996,
0.005122330505400896,
0.01620982028543949,
-0.009165075607597828,
-0.007841003127396107,
-0.007741840556263924,
-0.012271542102098465,
-0.0002293186989845708,
-0.005846461281180382,
-0.0034662331454455853,
-0.004532457794994116,
-0.008468188345432281,
0.0005221156170591712,
-0.0034829964861273766,
-0.0017021072562783957,
0.00965677760541439,
-0.0009393946384079754,
0.006073853466659784,
0.0030893629882484674,
0.00486628245562315,
-0.0024900822900235653,
-0.0020395759493112564,
0.0013936354080215096,
-0.0016498053446412086,
-0.004564498085528612,
-0.015088141895830631,
-0.006998270750045776,
-0.0013836717698723078,
0.01205738540738821,
0.001786271226592362,
0.006669325288385153,
-0.0021538613364100456,
0.0008543059811927378,
-0.009255089797079563,
0.005237228702753782,
0.002169402316212654,
0.0026745882350951433,
-0.03176002576947212,
0.00097964471206069,
-0.0004340574669186026,
-0.010985885746777058,
0.007889590226113796,
0.003259131219238043,
0.002118531381711364,
-0.0022333741653710604,
-0.0029601615387946367,
0.008880740962922573,
-0.009450745768845081,
0.004426249302923679,
-0.007205053232610226,
-0.00681561604142189,
-0.003167102811858058,
-0.010878157801926136,
0.0005355667090043426,
0.004503614269196987,
-0.0010215920628979802,
-0.003690350567921996,
-0.005143672693520784,
0.003395348321646452,
-0.0008890085737220943,
0.0015400208067148924,
-0.014592300169169903,
-0.007123053539544344,
-0.0002373160095885396,
0.005790377035737038,
0.00034835535916499794,
-0.002480235416442156,
0.00471720052883029,
-0.011838980950415134,
0.005929408594965935,
0.00044810911640524864,
0.002501772018149495,
-0.014069439843297005,
-0.002142663113772869,
-0.010486620478332043,
-0.00838780403137207,
0.004965334199368954,
-0.00537544209510088,
-0.0032530874013900757,
-0.00013760625733993948,
0.0017972184577956796,
0.007025205530226231,
-0.004623672924935818,
0.0019770730286836624,
0.011260743252933025,
-0.003898966358974576,
-0.009380999021232128,
0.009383137337863445,
0.008492140099406242,
0.0012945623602718115,
-0.00160120555665344,
0.0007908197585493326,
0.009082607924938202,
0.007228809874504805,
0.0031507827807217836,
0.004984621424227953,
-0.0012919192668050528,
0.012451574206352234,
0.0022100049536675215,
0.0024892627261579037,
-0.0014882257673889399,
-0.0020938036032021046,
-0.00528287049382925,
-0.0013018525205552578,
-0.005780565552413464,
-0.0026321110781282187,
-0.014466683380305767,
-0.009869474917650223,
-0.0011106638703495264,
0.0018432856304571033,
0.0007961622904986143,
-0.0014649812364950776,
0.0007509636343456805,
0.00251516024582088,
0.01145105343312025,
-0.0031569271814078093,
-0.00539868650957942,
0.00024544523330405354,
0.0019382896134629846,
-0.006349955685436726,
0.012864341028034687,
-0.01046761590987444,
0.004211329855024815,
0.0007342405733652413,
-0.015231356956064701,
0.008521350100636482,
0.009201844222843647,
-0.009383726865053177,
0.005256494041532278,
0.0014108484610915184,
0.004556075669825077,
-0.000248903437750414,
-0.006415357813239098,
0.000007695922249695286,
-0.018395600840449333,
-0.0008108053007163107,
0.022853828966617584,
0.008269721642136574,
0.012543202377855778,
0.011237869039177895,
-0.004089562222361565,
0.0024353116750717163,
0.008108263835310936,
0.005789345595985651,
0.015605531632900238,
-0.010967514477670193,
-0.0012497480493038893,
0.0020866470877081156,
-0.006078075617551804,
0.0029388531111180782,
0.004910922609269619,
0.0029812962748110294,
-0.003441491397097707,
0.003075426211580634,
-0.00499557564035058,
-0.0055613149888813496,
-0.018474917858839035,
-0.002571654040366411,
0.007853101007640362,
-0.005998554639518261,
0.007558254990726709,
-0.011556874960660934,
0.003950721584260464,
0.00287972972728312,
0.001989382551982999,
0.0006469362415373325,
-0.0002045770816039294,
0.008709941990673542,
0.011076493188738823,
-0.008425378240644932,
0.0024682593066245317,
0.0019067764515057206,
-0.002066259505227208,
0.0024421457201242447,
0.011368516832590103,
-0.011189074255526066,
-0.001944894203916192,
0.0015257543418556452,
0.0022012856788933277,
0.0014984789304435253,
-0.0032488731667399406,
-0.009547225199639797,
-0.005139915272593498,
0.003677292261272669,
-0.00530905881896615,
0.003485010704025626,
-0.0013895928859710693,
0.003294052090495825,
-0.010553023777902126,
-0.0009956295834854245,
-0.006456418894231319,
-0.009046630933880806,
0.010259934701025486,
-0.004080417566001415,
0.0056068142876029015,
0.012035313062369823,
0.002009697025641799,
-0.01352731417864561,
0.006701126229017973,
0.008366717025637627,
-0.004285699687898159,
0.0024668972473591566,
0.0048729050904512405,
-0.0037105476949363947,
-0.023729674518108368,
0.00029859066125936806,
-0.014572421088814735,
0.011287074536085129,
-0.0020025684498250484,
0.002861771732568741,
-0.006703139282763004,
0.009153665043413639,
0.0053414576686918736,
-0.01165336649864912,
-0.003740525571629405,
-0.007996045984327793,
0.007274609990417957,
-0.0013603812549263239,
-0.0034071991685777903,
-0.0025253891944885254,
-0.0014474656200036407,
-0.004737243056297302,
-0.00113148451782763,
-0.003122650785371661,
0.0035345142241567373,
0.003619846887886524,
-0.006099247839301825,
0.003331969026476145,
-0.0030306698754429817,
0.0015533557161688805,
0.0018996993312612176,
-0.01251427736133337,
0.0004837451269850135,
0.00825604796409607,
-0.0012655314058065414,
-0.00229405565187335,
-0.0010383081389591098,
-0.002799293026328087,
-0.006881460081785917,
-0.009416724555194378,
-0.003668596036732197,
-0.005828760098665953,
-0.003776259021833539,
-0.012026246637105942,
-0.0029318383894860744,
-0.008333618752658367,
0.00999644584953785,
-0.0075031365267932415,
0.006771661341190338,
0.004758113995194435,
-0.005664066411554813,
0.007114001549780369,
-0.0016169337322935462,
0.00347578851506114,
0.003327620681375265,
0.006361065432429314,
-0.0009758641244843602,
-0.0044555081985890865,
-0.008592319674789906,
0.01249811053276062,
-0.010632957331836224,
-0.0008511987398378551,
0.016824716702103615,
0.005107819568365812,
0.009692477993667126,
0.001432657241821289,
0.0010300376452505589,
0.006448001135140657,
0.01063416339457035,
-0.01630149967968464,
0.003529678098857403,
-0.001687442185357213,
-0.0007157844956964254,
0.004641237203031778,
-0.005359431728720665,
0.006529087200760841,
0.005344938952475786,
0.0045963614247739315,
-0.007216388825327158,
-0.003430390264838934,
-0.000007718073902651668,
0.004585098009556532,
-0.01273156888782978,
-0.003043039469048381,
-0.004623467568308115,
-0.007828287780284882,
-0.0011936330702155828,
-0.0022733265068382025,
0.00026951736072078347,
0.004462029319256544,
-0.003751788754016161,
0.006232042796909809,
0.0027587299700826406,
-0.005097819492220879,
0.014385215006768703,
-0.0022186944261193275,
-0.005085180047899485,
0.003656781977042556,
-0.0006925686029717326,
0.001282121636904776,
-0.004526268690824509,
-0.005434724036604166,
0.001234911847859621,
0.005933620501309633,
-0.0038252200465649366,
-0.00596644589677453,
-0.006738731171935797,
0.0014064832357689738,
-0.009884544648230076,
0.0010119733633473516,
0.011793447658419609,
-0.0013027001405134797,
0.003900568699464202,
0.0019680385012179613,
-0.006974018644541502,
-0.014030460268259048,
0.05567728728055954,
0.0006063656765036285,
0.0019698322284966707,
0.005790654569864273,
-0.009030322544276714,
-0.0010322780581191182,
-0.0005386675475165248,
0.007610080298036337,
-0.0068650031462311745,
-0.007434739265590906,
0.012407002970576286,
-0.0037202932871878147,
0.00396131444722414,
0.0003468923387117684,
-0.0016325131291523576,
0.0164738018065691,
-0.003785707289353013,
-0.016759920865297318,
-0.01533058937638998,
0.0074197230860590935,
-0.003667084500193596,
-0.008729563094675541,
0.008393311873078346,
-0.004108692519366741,
-0.002349050948396325,
-0.00018631943385116756,
0.0057340157218277454,
0.0011871946044266224,
-0.0022747195325791836,
-0.0016895767766982317,
-0.0004120217345189303,
0.0008577703847549856,
0.004433054476976395,
0.009145136922597885,
0.00941060297191143,
-0.0020800805650651455,
0.005120700690895319,
-0.0017781808273866773,
-0.00222703255712986,
-0.0004326215130276978,
0.008230432868003845,
0.007195836398750544,
-0.0014730808325111866,
-0.0020139224361628294,
0.0047464026138186455,
0.004595752339810133,
-0.0009302801918238401,
0.011321298778057098,
-0.002724059158936143,
-0.004632113501429558,
0.009630195796489716,
0.0071137892082333565,
-0.0001552362518850714,
0.008745832368731499,
-0.0035721526946872473,
0.005611793603748083,
0.0033691490534693003,
-0.0071201142854988575,
-0.01406140998005867,
0.00021910431678406894,
0.007904049940407276,
0.004976292606443167,
-0.0014034062623977661,
0.002799905138090253,
0.0021322837565094233,
-0.003948929253965616,
-0.009060053154826164,
-0.004845383111387491,
-0.0014619252178817987,
0.0004197605885565281,
0.006310459692031145,
0.07356809824705124,
-0.007861658930778503,
-0.0026552362833172083,
-0.008831924758851528,
-0.0005272203707136214,
-0.002782752038910985,
-0.0024906443431973457,
0.00026395171880722046,
0.00006908664363436401,
0.0024625093210488558,
0.0015456060646101832,
-0.009950819425284863,
-0.008248532190918922,
0.001610326231457293,
0.00282130460254848,
-0.002894326811656356,
0.0022711879573762417,
0.006856062449514866,
-0.007685862481594086,
0.0028602846432477236,
-0.012640433385968208,
-0.004229964688420296,
-0.0037039490416646004,
-0.0030491629149764776,
-0.006458572577685118,
-0.004618185106664896,
0.002207027515396476,
0.0032233435194939375,
0.0039156521670520306,
-0.0046259681694209576,
0.006595660001039505,
-0.0008899331442080438,
0.004159164149314165,
-0.003930983599275351,
-0.0028189769946038723,
-0.0038865215610712767,
0.009026017040014267,
-0.0006543750641867518,
-0.012874085456132889,
-0.007099801674485207,
-0.006287460681051016,
-0.002118223812431097,
-0.0048284088261425495,
0.005825560074299574,
-0.0005291885463520885,
0.006138977129012346,
-0.002618246478959918,
0.0003953448322135955,
-0.004451137967407703,
0.005345099605619907,
-0.013517690822482109,
0.0013042441569268703,
-0.18092362582683563,
0.008520401082932949,
0.00171145040076226,
-0.0053230151534080505,
-0.0020881262607872486,
-0.015626994892954826,
-0.01115902978926897,
0.0032298981677740812,
0.008290672674775124,
0.000017099986507673748,
0.002279865788295865,
-0.0018692039884626865,
0.0070068868808448315,
0.003695655846968293,
-0.0010044985683634877,
-0.00594533933326602,
0.003948581870645285,
-0.0038339593447744846,
0.0018916137050837278,
0.004253629129379988,
0.006070587784051895,
0.005854460410773754,
0.004549960605800152,
0.003233794355764985,
-0.0015426017343997955,
-0.0038050527218729258,
0.005096042063087225,
0.0006588997785001993,
0.004497567657381296,
-0.012107857502996922,
-0.006351045332849026,
-0.004711423069238663,
-0.0007898540934547782,
0.0029348530806601048,
0.0040630376897752285,
-0.0011974835069850087,
0.009128010831773281,
0.0019434327259659767,
-0.008175605908036232,
0.005720640532672405,
-0.008082079701125622,
0.028693627566099167,
0.007866651751101017,
0.009010582230985165,
0.002244000555947423,
-0.002540324814617634,
-0.005987360142171383,
0.012025763280689716,
0.002230370417237282,
0.01306450180709362,
-0.012216716073453426,
-0.004066471941769123,
0.004816828761249781,
0.019773822277784348,
-0.006298915483057499,
-0.006514872424304485,
-0.007676329929381609,
-0.0045822905376553535,
0.003956499043852091,
0.007811641786247492,
0.007668174337595701,
-0.008216098882257938,
0.010154064744710922,
-0.0036575861740857363,
-0.02527247741818428,
0.00490187294781208,
-0.0017115091904997826,
-0.009591394104063511,
-0.0023343940265476704,
0.006771752145141363,
0.011436873115599155,
-0.00265735131688416,
0.00942135602235794,
-0.0022519605699926615,
0.004201899748295546,
-0.004666427616029978,
0.006830273661762476,
-0.0007177347433753312,
0.006578821688890457,
-0.009412924759089947,
0.009588050656020641,
-0.007762345019727945,
-0.004090924747288227,
0.0010481748031452298,
-0.004687647335231304,
0.009944982826709747,
0.004048161208629608,
-0.004376361146569252,
0.0018419157713651657,
-0.010892859660089016,
-0.001540353405289352,
-0.00017100386321544647,
0.002696939976885915,
-0.007882589474320412,
0.001506373635493219,
-0.0006463626632466912,
0.005765301175415516,
0.010580537840723991,
-0.009599026292562485,
0.004226929508149624,
0.0058276760391891,
-0.00709228590130806,
0.00003971241676481441,
-0.004730106331408024,
0.0006656962214037776,
0.0036326227709650993,
-0.007564002647995949,
-0.009496664628386497,
0.008047511801123619,
-0.00420065363869071,
-0.004101913422346115,
0.002465643920004368,
-0.01168866641819477,
-0.007040271535515785,
0.00094842747785151,
-0.013242281042039394,
-0.00039311847649514675
] |
8a8bd51e1880ca1483e91fca0ab41237e4c4f869 | 4,896 | py | Python | Lib/hTools2/dialogs/glyphs/slide.py | gferreira/hTools2 | a75a671b81a0f4ce5c82b2ad3e2f971ca3e3d98c | [
"BSD-3-Clause"
] | 11 | 2015-01-06T15:43:56.000Z | 2019-07-27T00:35:20.000Z | Lib/hTools2/dialogs/glyphs/slide.py | gferreira/hTools2 | a75a671b81a0f4ce5c82b2ad3e2f971ca3e3d98c | [
"BSD-3-Clause"
] | 2 | 2017-05-17T10:11:46.000Z | 2018-11-21T21:43:43.000Z | Lib/hTools2/dialogs/glyphs/slide.py | gferreira/hTools2 | a75a671b81a0f4ce5c82b2ad3e2f971ca3e3d98c | [
"BSD-3-Clause"
] | 4 | 2015-01-10T13:58:50.000Z | 2019-12-18T15:40:14.000Z | # [h] slide selected glyphs
from mojo.roboFont import CurrentFont, CurrentGlyph, version
from vanilla import *
from hTools2 import hDialog
from hTools2.modules.fontutils import get_full_name, get_glyphs
from hTools2.modules.messages import no_font_open, no_glyph_selected
class slideGlyphsDialog(hDialog):
'''A dialog to slide the selected glyphs vertically and/or horizontally.
.. image:: imgs/glyphs/slide.png
'''
_moveX = 0
_moveY = 0
_xMax = 1000
_xMin = -1000
_yMax = 500
_yMin = -500
font = None
font_name = '(no font selected)'
def __init__(self):
# window
self.title = "slide"
self.button_width = 70
self.column_1 = 20
self.column_2 = 240
self.width = self.column_1 + self.column_2 + self.button_width + self.padding_x*3
self.height = self.text_height*3 + self.padding_y*4
self.w = HUDFloatingWindow((self.width, self.height), self.title)
x = self.padding_x
y = self.padding_y
# current font name
self.w.box = Box(
(x, y, self.column_1 + self.column_2, self.text_height))
self.w.box.text = TextBox(
(5, 0, self.column_1 + self.column_2, self.text_height),
self.font_name,
sizeStyle=self.size_style)
x += (self.column_2 + self.column_1 + self.padding_x)
self.w.button_update_font = SquareButton(
(x, y, self.button_width, self.text_height),
"update",
callback=self.update_font_callback,
sizeStyle=self.size_style)
# x slider
x = self.padding_x
y += self.text_height + self.padding_y
self.w.x_label = TextBox(
(x, y + 5, self.column_1, self.text_height),
"x",
sizeStyle=self.size_style)
x += self.column_1
self.w.x_slider = Slider(
(x, y, self.column_2, self.text_height),
value=0,
maxValue=self._xMax,
minValue=self._xMin,
callback=self.slide_callback,
sizeStyle=self.size_style)
x += (self.column_2 + self.padding_x)
self.w.button_restore_x = SquareButton(
(x, y, self.button_width, self.text_height),
"reset x",
callback=self.restore_x_callback,
sizeStyle=self.size_style)
# y slider
x = self.padding_x
y += (self.text_height + self.padding_y)
self.w.y_label = TextBox(
(x, y + 5, self.column_1, self.text_height),
"y",
sizeStyle=self.size_style)
x += self.column_1
self.w.y_slider = Slider(
(x, y, self.column_2, self.text_height),
value=0,
maxValue=self._yMax,
minValue=self._yMin,
callback=self.slide_callback,
sizeStyle=self.size_style)
x += (self.column_2 + self.padding_x)
self.w.button_restore_y = SquareButton(
(x, y, self.button_width, self.text_height),
"reset y",
callback=self.restore_y_callback,
sizeStyle=self.size_style)
# open
self.w.open()
self.update_font()
# callbacks
def restore_x(self):
self._moveX = 0
self.w.x_slider.set(self._moveX)
def restore_y(self):
self._moveY = 0
self.w.y_slider.set(self._moveY)
def restore_x_callback(self, sender):
self.restore_x()
def restore_y_callback(self, sender):
self.restore_y()
def update_font(self):
self.font = CurrentFont()
if self.font is not None:
self.w.box.text.set(get_full_name(self.font))
self.set_defaults()
self.restore_x()
self.restore_y()
else:
print no_font_open
def set_defaults(self):
self._xMax = self.font.info.unitsPerEm
self._yMax = self.font.info.unitsPerEm / 2
self._xMin = -self._xMax
self._yMin = -self._yMax
def update_font_callback(self, sender):
self.update_font()
def slide_callback(self, sender):
xValue = self.w.x_slider.get()
yValue = self.w.y_slider.get()
x = self._moveX - xValue
y = self._moveY - yValue
self._moveX = xValue
self._moveY = yValue
glyph_names = get_glyphs(self.font)
if len(glyph_names) > 0:
for glyph_name in glyph_names:
# RF 2.0
if version[0] == '2':
self.font[glyph_name].moveBy((-x, -y))
# RF 1.8.X
else:
self.font[glyph_name].move((-x, -y))
else:
print no_glyph_selected
| 31.184713 | 89 | 0.55576 | 1 | 2.0616 | [
-0.016185423359274864,
0.004600061569362879,
0.01589251682162285,
0.04797612130641937,
-0.016135936602950096,
0.006686284206807613,
-0.019901372492313385,
-0.006865757517516613,
-0.020121125504374504,
0.02932625636458397,
-0.005877118557691574,
-0.012585565447807312,
0.006696193479001522,
-0.03325362503528595,
-0.012337413616478443,
-0.07478581368923187,
0.031333841383457184,
-0.01791742630302906,
-0.00722179701551795,
0.014872358180582523,
0.0031383298337459564,
0.0020822519436478615,
-0.02350441738963127,
0.004966700915247202,
0.008765557780861855,
0.030730191618204117,
0.06859278678894043,
-0.013713150285184383,
0.006345949601382017,
0.012757595628499985,
0.005997922737151384,
-0.005052268970757723,
0.040525857359170914,
-0.028963632881641388,
-0.03537188097834587,
0.010565518401563168,
-0.0007937278132885695,
-0.055197276175022125,
0.05666424706578255,
0.030671166256070137,
0.01561532448977232,
-0.005701181944459677,
-0.011866830289363861,
-0.06338965147733688,
0.059034042060375214,
-0.02873663604259491,
0.0052170963026583195,
-0.018216177821159363,
-0.06005040183663368,
0.006443801801651716,
-0.053668539971113205,
-0.01639575883746147,
-0.008218108676373959,
-0.0007359217270277441,
-0.05151677876710892,
-0.04322269931435585,
0.00015407949103973806,
0.06010071188211441,
-0.05824769660830498,
-0.02769366279244423,
0.017788531258702278,
-0.01803869940340519,
0.012743034400045872,
0.023754896596074104,
-0.009507437236607075,
-0.01099887304008007,
0.03911542147397995,
0.028780601918697357,
0.03546179458498955,
0.02537628263235092,
-0.0013511989964172244,
0.08763909339904785,
0.01225612498819828,
0.052466318011283875,
0.01745237037539482,
-0.012602640315890312,
-0.018014924600720406,
-0.016338268294930458,
-0.018609188497066498,
0.0027250489220023155,
0.004752015694975853,
0.050434138625860214,
0.023825200274586678,
-0.02852645330131054,
0.032936591655015945,
0.002495213644579053,
0.010634067468345165,
-0.021016769111156464,
0.029080886393785477,
0.003412311663851142,
-0.04651695117354393,
-0.027415350079536438,
-0.03649946674704552,
0.0058715613558888435,
-0.01170264557003975,
-0.053773183375597,
0.025713643059134483,
0.023314589634537697,
0.035281162708997726,
0.0010433262214064598,
0.009448118507862091,
-0.02826617658138275,
-0.026088420301675797,
0.004436589311808348,
-0.06665098667144775,
0.01330945361405611,
-0.04062981903553009,
-0.007500174921005964,
0.00935292523354292,
-0.03583172708749771,
0.011191957630217075,
0.04359179735183716,
0.05004046484827995,
-0.015029272064566612,
-0.026449289172887802,
-0.01616799645125866,
-0.0005313103902153671,
0.019971393048763275,
0.024356158450245857,
-0.01089790090918541,
0.027695735916495323,
0.0009317777585238218,
-0.03196082264184952,
0.00021134242706466466,
-0.023770365864038467,
0.10125777870416641,
-0.0031125445384532213,
0.016669897362589836,
0.06320962309837341,
-0.03907342255115509,
0.016323480755090714,
0.0024917677510529757,
-0.022563442587852478,
-0.0013462111819535494,
-0.0003576707385946065,
-0.021321574226021767,
-0.03165711089968681,
0.014309139922261238,
-0.04628417268395424,
0.041929688304662704,
-0.0252347644418478,
-0.03729692101478577,
-0.009768610820174217,
0.03813500329852104,
-0.0034671148750931025,
-0.05387498065829277,
0.00745638832449913,
-0.0035544009879231453,
-0.020409494638442993,
0.003813930554315448,
-0.001085474155843258,
0.014713658019900322,
0.01582346111536026,
0.011919927783310413,
-0.02496621571481228,
0.030930066481232643,
-0.04776136949658394,
-0.006623526103794575,
-0.008880662731826305,
0.012853306718170643,
-0.019401762634515762,
0.045061543583869934,
-0.001010685577057302,
-0.01619802415370941,
-0.029917575418949127,
0.0681314542889595,
-0.01796959713101387,
0.033368244767189026,
-0.00520816957578063,
-0.0039053193759173155,
0.025426451116800308,
-0.00010767831554403529,
-0.02824043110013008,
-0.00840961653739214,
0.0070355553179979324,
-0.016106029972434044,
0.05620720237493515,
0.03159407898783684,
0.05973409488797188,
-0.04526764154434204,
0.04207465797662735,
-0.03495407849550247,
-0.05385228991508484,
0.01616079919040203,
-0.04528813809156418,
0.03715420514345169,
-0.05508805811405182,
0.005833436734974384,
0.005763175897300243,
0.0215554591268301,
-0.014217348769307137,
0.03902074322104454,
0.019833382219076157,
-0.0015838267281651497,
-0.012688025832176208,
0.007080420386046171,
-0.04998103901743889,
0.03254268690943718,
-0.01566634140908718,
-0.030338112264871597,
0.040947508066892624,
-0.019471174106001854,
0.04629823938012123,
-0.0038986492436379194,
-0.0018193800933659077,
0.0031135769095271826,
-0.6207165718078613,
-0.00173822115175426,
0.030076362192630768,
-0.027121398597955704,
-0.026872240006923676,
0.015659300610423088,
-0.010557178407907486,
0.00953234639018774,
-0.019907817244529724,
-0.028256408870220184,
-0.0049609229899942875,
0.02447046898305416,
-0.06109105795621872,
-0.036539021879434586,
-0.013394865207374096,
-0.008641619235277176,
-0.03560137748718262,
-0.010856427252292633,
0.020170316100120544,
-0.012138864025473595,
0.003525827545672655,
-0.0688793882727623,
0.00988199096173048,
0.02868233434855938,
0.008856922388076782,
-0.06185942143201828,
-0.03248481824994087,
-0.010098878294229507,
0.00142584927380085,
-0.02285240963101387,
0.016895897686481476,
0.02238442935049534,
0.02560177817940712,
-0.014031913131475449,
-0.002884706947952509,
0.04445570707321167,
0.013688787817955017,
-0.05536047741770744,
-0.025509387254714966,
0.010237683542072773,
0.038987547159194946,
0.003577189287170768,
-0.008609838783740997,
-0.06776220351457596,
-0.05586329847574234,
-0.0093043502420187,
0.0002427788422210142,
-0.04969419166445732,
-0.0001413783902535215,
0.014200860634446144,
0.02420153096318245,
0.021979860961437225,
0.0020891749300062656,
-0.04034174606204033,
0.01721508800983429,
-0.016974903643131256,
0.011190471239387989,
-0.020217306911945343,
-0.010867382399737835,
-0.018576253205537796,
0.006168981548398733,
-0.04208516702055931,
-0.023599646985530853,
-0.011990330182015896,
0.0014338957844302058,
-0.00809023529291153,
0.029194852337241173,
-0.005303768441081047,
-0.020923729985952377,
0.053477801382541656,
-0.030241655185818672,
-0.044454339891672134,
-0.03479444608092308,
0.023214735090732574,
0.014280934818089008,
0.01646934263408184,
-0.027660997584462166,
-0.004390685819089413,
-0.012792832218110561,
0.003729569958522916,
0.026804829016327858,
-0.030520522966980934,
0.018150748685002327,
-0.04073294997215271,
-0.00045429629972204566,
-0.0178499985486269,
0.019324613735079765,
-0.00890760961920023,
-0.007557918783277273,
-0.015559261664748192,
0.010458982549607754,
0.0086536118760705,
-0.0026567077729851007,
-0.004250710364431143,
0.03753908351063728,
-0.02949369326233864,
0.034354835748672485,
0.0746820718050003,
0.008271810598671436,
-0.01208174042403698,
0.022139668464660645,
-0.028225479647517204,
0.004493726883083582,
-0.021091774106025696,
-0.028631368651986122,
0.006940718274563551,
-0.06889379024505615,
-0.016535501927137375,
0.05963755026459694,
-0.025840390473604202,
0.031182536855340004,
-0.026470482349395752,
-0.030891191214323044,
0.01422548945993185,
-0.0107957748696208,
-0.04582482948899269,
0.012359833344817162,
-0.04803568869829178,
0.049620822072029114,
0.04141518846154213,
-0.00518906069919467,
0.03236427530646324,
0.028073618188500404,
0.008618548512458801,
-0.023492349311709404,
0.01935483328998089,
0.03026660345494747,
0.006436491850763559,
0.0063032545149326324,
-0.006346514448523521,
-0.005403581075370312,
0.0007331980159506202,
0.00009246758418157697,
0.07779986411333084,
0.02513001300394535,
-0.008509383536875248,
-0.0002811902668327093,
-0.02240961417555809,
0.05339343473315239,
-0.006071269046515226,
-0.04446366801857948,
-0.015720844268798828,
0.015721185132861137,
-0.03131534159183502,
0.00036723740049637854,
0.010973868891596794,
0.013835550285875797,
-0.0021629997063428164,
0.0068514421582221985,
0.046645957976579666,
0.0052232639864087105,
0.007076123729348183,
0.025170430541038513,
-0.0011691558174788952,
-0.022726761177182198,
0.010700924322009087,
-0.06376548111438751,
0.02571742795407772,
0.009582851082086563,
0.05385838449001312,
-0.011514585465192795,
0.056673116981983185,
0.01032215729355812,
0.017322512343525887,
-0.026549875736236572,
0.025488821789622307,
-0.03878284990787506,
0.012172002345323563,
0.0019460303010419011,
0.01360031682997942,
0.013610586524009705,
0.002904616529121995,
0.019099261611700058,
0.05234874039888382,
0.02178092673420906,
0.014406269416213036,
-0.029883624985814095,
-0.06061684712767601,
0.005144576542079449,
-0.00020131765631958842,
-0.0018690766301006079,
-0.005590456072241068,
-0.012161905877292156,
0.006596163380891085,
0.03905807062983513,
0.007575417868793011,
0.005689284298568964,
-0.0269326064735651,
-0.05304986238479614,
-0.021202990785241127,
0.03723980486392975,
-0.010332340374588966,
0.005695543251931667,
-0.0074688526801764965,
-0.039286304265260696,
-0.00271308864466846,
-0.023695653304457664,
-0.02115090936422348,
0.07761004567146301,
-0.030795328319072723,
-0.004475621040910482,
-0.03627808392047882,
0.003800177713856101,
-0.013270007446408272,
-0.014670802280306816,
0.018538158386945724,
-0.012428195215761662,
0.05986156314611435,
-0.015053224749863148,
0.009678930044174194,
-0.007107179146260023,
-0.04071414843201637,
-0.0019512304570525885,
0.014712400734424591,
-0.03382251039147377,
0.0010113308671861887,
0.030283601954579353,
-0.04275910556316376,
0.020702281966805458,
0.0035650532227009535,
-0.04027610272169113,
-0.03939242288470268,
0.000834049831610173,
0.04001084715127945,
0.002727717626839876,
0.01356158684939146,
-0.02578096278011799,
0.016726335510611534,
0.006257290486246347,
-0.007063800003379583,
0.0032368875108659267,
0.0073984344489872456,
0.017042774707078934,
0.01386862900108099,
-0.00637511070817709,
0.0028664609417319298,
-0.0012085485504940152,
-0.011301753111183643,
0.018968546763062477,
0.02401300147175789,
0.036774639040231705,
-0.07978604733943939,
0.002569484058767557,
0.009456734172999859,
-0.05692082643508911,
0.01958654448390007,
0.024952221661806107,
-0.006858423817902803,
0.01724865660071373,
-0.011482182890176773,
-0.010826810263097286,
0.09542585164308548,
0.027457771822810173,
-0.012579250149428844,
0.0033762960229068995,
0.048615679144859314,
-0.025021206587553024,
-0.010198287665843964,
0.04626644775271416,
-0.003911891952157021,
0.009438944980502129,
-0.06615350395441055,
-0.020126599818468094,
0.01546123344451189,
0.025969989597797394,
0.03935469686985016,
0.03345456346869469,
0.0017538969404995441,
0.0006940519670024514,
-0.004035822581499815,
0.009835325181484222,
-0.052939049899578094,
-0.025221526622772217,
-0.014418430626392365,
0.02813097834587097,
0.019974539056420326,
-0.022498706355690956,
-0.02592305652797222,
-0.005087052471935749,
-0.004209930542856455,
0.010679662227630615,
0.03100765496492386,
0.00034532492281869054,
-0.026278574019670486,
-0.011100252158939838,
0.037036340683698654,
-0.022343067452311516,
0.01960870623588562,
-0.046053968369960785,
-0.0216494370251894,
-0.02693544141948223,
-0.02352786995470524,
0.051888324320316315,
-0.039601605385541916,
-0.012165000662207603,
0.00902603194117546,
0.00047618112876079977,
0.007602579891681671,
0.004827236291021109,
0.015294150449335575,
0.03670625761151314,
0.01866721920669079,
-0.009756632149219513,
0.02058037556707859,
0.036008697003126144,
-0.025672951713204384,
-0.02064678445458412,
0.014695669524371624,
0.039787087589502335,
-0.008950406685471535,
0.011601174250245094,
0.027310598641633987,
0.05370191112160683,
0.008586176671087742,
0.026049595326185226,
-0.026820363476872444,
0.029825350269675255,
-0.006722215097397566,
0.01800408400595188,
-0.00699220784008503,
-0.03054816462099552,
-0.008462503552436829,
0.014406343922019005,
-0.03663010522723198,
0.013682067394256592,
-0.04178105667233467,
-0.012967315502464771,
-0.003520116675645113,
0.037492573261260986,
-0.02055465802550316,
0.03484382480382919,
-0.03276696801185608,
0.021035121753811836,
-0.010721593163907528,
-0.002946055494248867,
0.020231259986758232,
0.02054646797478199,
0.009692981839179993,
0.007630933541804552,
0.022513024508953094,
-0.03883666917681694,
-0.002022783737629652,
-0.07374347001314163,
-0.049719613045454025,
0.03193795680999756,
0.03501373901963234,
0.019929243251681328,
0.02791890874505043,
0.04764525964856148,
0.046910952776670456,
-0.0024806084111332893,
-0.007801768835633993,
0.008687426336109638,
-0.02321583963930607,
-0.005883159581571817,
-0.0618119016289711,
0.03403466194868088,
0.009284036234021187,
-0.012089119292795658,
-0.00035303665208630264,
-0.020976737141609192,
0.01396535150706768,
-0.07564283162355423,
-0.005126256495714188,
-0.022541606798768044,
0.004057913552969694,
0.01507988665252924,
0.014764402061700821,
0.005330953747034073,
-0.01494951918721199,
-0.009361627511680126,
-0.019899796694517136,
0.036760371178388596,
-0.0068077826872467995,
0.01335183996707201,
0.04071175307035446,
0.0611918605864048,
-0.009203155525028706,
0.029063362628221512,
-0.005144792143255472,
0.04011049494147301,
-0.021372321993112564,
0.0037602344527840614,
-0.016086401417851448,
0.008145017549395561,
-0.05332517623901367,
-0.005541839171200991,
0.025794334709644318,
-0.06962393969297409,
-0.030224613845348358,
0.0018749749287962914,
-0.010262059979140759,
0.05979618430137634,
0.01492585614323616,
-0.008405793458223343,
0.035811662673950195,
-0.021539203822612762,
-0.014883164316415787,
-0.0019257833482697606,
-0.03385031595826149,
0.02064528502523899,
0.026799404993653297,
0.010693995282053947,
0.012909241952002048,
-0.034082669764757156,
-0.04528854414820671,
0.016156742349267006,
0.003437898587435484,
0.0047080907970666885,
-0.004614895675331354,
0.01559003721922636,
0.027067165821790695,
-0.04481931030750275,
0.005459203850477934,
0.0700894370675087,
0.032431378960609436,
-0.013340085744857788,
-0.012690589763224125,
-0.02768043428659439,
-0.007113731000572443,
-0.043941251933574677,
-0.010487832129001617,
0.012254792265594006,
0.030458102002739906,
0.0017657052958384156,
-0.023879284039139748,
-0.008203982375562191,
-0.022961921989917755,
-0.026630043983459473,
0.034936510026454926,
0.03251032903790474,
0.013096814975142479,
-0.027517730370163918,
-0.014464565552771091,
-0.01076965220272541,
-0.004147786181420088,
-0.012121831066906452,
-0.016366001218557358,
-0.009059169329702854,
0.002956993877887726,
0.00639245193451643,
-0.04602308198809624,
0.016757860779762268,
-0.00585073372349143,
-0.037894539535045624,
-0.07082773745059967,
0.022766191512346268,
-0.0025511279236525297,
-0.008100087754428387,
-0.013772835955023766,
-0.014406880363821983,
-0.005345279350876808,
-0.005109123419970274,
0.04626470431685448,
0.031323183327913284,
-0.058053091168403625,
0.026730859652161598,
0.03850720450282097,
-0.016433682292699814,
-0.009776020422577858,
-0.01372616458684206,
0.02843465283513069,
0.0029695837292820215,
0.01429209765046835,
-0.0014298137975856662,
0.0442475825548172,
0.013193363323807716,
-0.00014452359755523503,
-0.014278610236942768,
0.013309433124959469,
0.007818087935447693,
0.016704268753528595,
-0.004036018159240484,
-0.028123997151851654,
0.017262162640690804,
0.02261175587773323,
0.026149937883019447,
0.01719137281179428,
0.01053360290825367,
0.010152901522815228,
-0.02299613319337368,
0.010669481009244919,
0.029206059873104095,
0.03368638828396797,
-0.015048682689666748,
0.007625749334692955,
0.00789450854063034,
0.0504741333425045,
0.008631736040115356,
0.018942369148135185,
-0.01948709599673748,
-0.011127355508506298,
0.012356668710708618,
-0.012919512577354908,
0.019008401781320572,
-0.018381161615252495,
0.008641672320663929,
0.0015180056216195226,
0.03808833286166191,
-0.02830887958407402,
0.018864722922444344,
0.020568236708641052,
0.015222917310893536,
-0.0037831731606274843,
0.0006422058795578778,
0.03999144956469536,
0.022275548428297043,
0.056780990213155746,
-0.018034188076853752,
-0.004534893203526735,
-0.023473942652344704,
-0.021550800651311874,
0.03302270174026489,
0.005062095355242491,
0.01606282964348793,
-0.015292534604668617,
0.01147150993347168,
0.010038073174655437,
-0.03465390205383301,
-0.05361662060022354,
0.003799949074164033,
-0.030393579974770546,
0.009670489467680454,
-0.0008289946708828211,
-0.036391161382198334,
0.002973266178742051,
-0.055328529328107834,
0.011175444349646568,
0.009974849410355091,
-0.0013907253742218018,
-0.02239147573709488,
-0.020904256030917168,
0.026245808228850365,
-0.005996204912662506,
-0.03730564936995506,
-0.0389198400080204,
0.0309655349701643,
0.02595280297100544,
-0.02153054066002369,
-0.02119608223438263,
0.004300904925912619,
0.02480943500995636,
0.033046822994947433,
-0.014591527171432972,
-0.03388528525829315,
-0.031723205000162125,
0.0023876053746789694,
-0.004445638041943312,
0.04948708042502403,
-0.009655924513936043,
-0.01912824995815754,
0.01730666682124138,
-0.0013928533298894763,
-0.0029007571283727884,
-0.0697886049747467,
0.03178015723824501,
0.023967472836375237,
0.00580247538164258,
-0.00018249610729981214,
-0.07551398873329163,
-0.0170795526355505,
-0.0018786531873047352
] |
8a8c544c5af946feba8528e8627d4c6fff3edf22 | 3,495 | py | Python | werobot/utils.py | lilac/WeRobot | 29fd70631b736a0c339f16f7729ea89f986c8bae | [
"MIT"
] | 2 | 2018-06-03T16:32:07.000Z | 2018-06-03T16:32:10.000Z | werobot/utils.py | Milleree/WeRoBot | f9777f792d55ae70e7262f13e6e3f3667a167036 | [
"MIT"
] | 9 | 2020-06-05T19:51:33.000Z | 2022-03-11T23:40:25.000Z | werobot/utils.py | Milleree/WeRoBot | f9777f792d55ae70e7262f13e6e3f3667a167036 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import io
import json
import os
import random
import re
import string
import time
from functools import wraps
from hashlib import sha1
import six
try:
from secrets import choice
except ImportError:
from random import choice
string_types = (six.string_types, six.text_type, six.binary_type)
re_type = type(re.compile("regex_test"))
def get_signature(token, timestamp, nonce, *args):
sign = [token, timestamp, nonce] + list(args)
sign.sort()
sign = to_binary(''.join(sign))
return sha1(sign).hexdigest()
def check_signature(token, timestamp, nonce, signature):
if not (token and timestamp and nonce and signature):
return False
sign = get_signature(token, timestamp, nonce)
return sign == signature
def check_token(token):
return re.match('^[A-Za-z0-9]{3,32}$', token)
def cached_property(method):
prop_name = '_{}'.format(method.__name__)
@wraps(method)
def wrapped_func(self, *args, **kwargs):
if not hasattr(self, prop_name):
setattr(self, prop_name, method(self, *args, **kwargs))
return getattr(self, prop_name)
return property(wrapped_func)
def to_text(value, encoding="utf-8"):
if isinstance(value, six.text_type):
return value
if isinstance(value, six.binary_type):
return value.decode(encoding)
return six.text_type(value)
def to_binary(value, encoding="utf-8"):
if isinstance(value, six.binary_type):
return value
if isinstance(value, six.text_type):
return value.encode(encoding)
return six.binary_type(value)
def is_string(value):
return isinstance(value, string_types)
def byte2int(s, index=0):
"""Get the ASCII int value of a character in a string.
:param s: a string
:param index: the position of desired character
:return: ASCII int value
"""
if six.PY2:
return ord(s[index])
return s[index]
def generate_token(length=''):
if not length:
length = random.randint(3, 32)
length = int(length)
assert 3 <= length <= 32
letters = string.ascii_letters + string.digits
return ''.join(choice(letters) for _ in range(length))
def json_loads(s):
s = to_text(s)
return json.loads(s)
def json_dumps(d):
return json.dumps(d)
def pay_sign_dict(
appid,
pay_sign_key,
add_noncestr=True,
add_timestamp=True,
add_appid=True,
**kwargs
):
"""
支付参数签名
"""
assert pay_sign_key, "PAY SIGN KEY IS EMPTY"
if add_appid:
kwargs.update({'appid': appid})
if add_noncestr:
kwargs.update({'noncestr': generate_token()})
if add_timestamp:
kwargs.update({'timestamp': int(time.time())})
params = kwargs.items()
_params = [
(k.lower(), v) for k, v in kwargs.items() if k.lower() != "appid"
]
_params += [('appid', appid), ('appkey', pay_sign_key)]
_params.sort()
sign = '&'.join(["%s=%s" % (str(p[0]), str(p[1]))
for p in _params]).encode("utf-8")
sign = sha1(sign).hexdigest()
sign_type = 'SHA1'
return dict(params), sign, sign_type
def make_error_page(url):
with io.open(
os.path.join(os.path.dirname(__file__), 'contrib/error.html'),
'r',
encoding='utf-8'
) as error_page:
return error_page.read().replace('{url}', url)
def is_regex(value):
return isinstance(value, re_type)
| 22.403846 | 73 | 0.645207 | 1 | 1.9071 | [
-0.037018146365880966,
0.05561263486742973,
0.015717439353466034,
0.00044844907824881375,
-0.007806688547134399,
0.007685351651161909,
-0.03365673869848251,
-0.00882362574338913,
0.0030032952781766653,
0.03332630544900894,
0.011665739119052887,
-0.027974313125014305,
0.03131360188126564,
-0.025165246799588203,
-0.011513414792716503,
-0.009097272530198097,
0.02786983549594879,
0.03431512415409088,
-0.014630846679210663,
-0.0069848825223743916,
0.008448123931884766,
0.023076409474015236,
-0.042276617139577866,
-0.003991612698882818,
0.04085446149110794,
0.003926411271095276,
0.05169960483908653,
0.025481857359409332,
0.013343107886612415,
0.007681104354560375,
-0.04153759405016899,
-0.004998945631086826,
0.01714412122964859,
0.007117043249309063,
-0.034177061170339584,
0.018603971228003502,
0.023584719747304916,
-0.09397151321172714,
-0.010329365730285645,
0.01595897600054741,
0.019514035433530807,
-0.03590400144457817,
-0.003503462066873908,
0.0016750912182033062,
0.02014724537730217,
0.0347520187497139,
-0.026280667632818222,
0.02953895926475525,
-0.0606248639523983,
0.005772533360868692,
-0.0318259596824646,
0.024505039677023888,
0.006540440022945404,
-0.029201095923781395,
0.02112373523414135,
-0.04217863827943802,
0.007811779621988535,
0.020941149443387985,
-0.03432827442884445,
-0.0031730979681015015,
-0.005384314805269241,
0.01606854610145092,
-0.010433211922645569,
0.02912517450749874,
0.03711295500397682,
-0.016482366248965263,
-0.006278472486883402,
-0.016674069687724113,
-0.03315917029976845,
-0.02842235378921032,
-0.021630652248859406,
-0.019974036142230034,
0.01458339300006628,
0.049238767474889755,
0.027607185766100883,
0.03004373610019684,
-0.018648622557520866,
-0.01305694691836834,
-0.005375185515731573,
0.014656901359558105,
-0.006348149385303259,
0.04710490629076958,
0.009526596404612064,
0.00018309045117348433,
-0.03492823615670204,
0.016534028574824333,
0.0825536772608757,
-0.06488056480884552,
0.055064857006073,
0.023638395592570305,
-0.022436004132032394,
-0.002767364727333188,
-0.048400767147541046,
0.014588523656129837,
-0.0025595142506062984,
-0.04141047224402428,
0.012555716559290886,
-0.0029095385689288378,
0.0029897415079176426,
0.00907412450760603,
0.011543210595846176,
-0.04635944962501526,
0.009509090334177017,
-0.030485844239592552,
-0.031143976375460625,
0.007370627019554377,
-0.03586630895733833,
0.010826200246810913,
-0.031162356957793236,
-0.016393305733799934,
0.0011772038415074348,
0.015549595467746258,
0.04482993483543396,
-0.027199987322092056,
0.013432933948934078,
-0.031042618677020073,
0.047668203711509705,
0.011657511815428734,
-0.0006835322710685432,
0.027178436517715454,
0.0006436076364479959,
-0.013590973801910877,
0.030685441568493843,
-0.03303828090429306,
-0.027973370626568794,
0.08262728154659271,
0.008587181568145752,
-0.003391130128875375,
0.02538200095295906,
0.00941278226673603,
0.0015805274015292525,
-0.022949421778321266,
-0.029971972107887268,
-0.008903983049094677,
0.015599959529936314,
-0.018549056723713875,
-0.023180294781923294,
-0.009441185742616653,
-0.05613939091563225,
0.015549571253359318,
0.0008140084100887179,
-0.03164777532219887,
-0.0009619359625503421,
-0.019501863047480583,
-0.008436083793640137,
-0.0239343773573637,
-0.0034339656122028828,
-0.02709992043673992,
-0.003437475999817252,
-0.012879571877419949,
0.01312223356217146,
0.026397477835416794,
0.005153638310730457,
0.012615659274160862,
-0.004264054354280233,
-0.0047105830162763596,
-0.01464026141911745,
-0.04794782027602196,
0.01658535748720169,
-0.012759832665324211,
-0.038024671375751495,
0.0214003324508667,
-0.02304687909781933,
0.022054539993405342,
0.02813095413148403,
0.054672710597515106,
-0.01450903806835413,
0.04042463377118111,
-0.018978523090481758,
0.025675103068351746,
-0.0006728687440045178,
0.005439015105366707,
-0.02662520855665207,
0.0006724435370415449,
-0.0076210773549973965,
-0.0064841872081160545,
0.030815092846751213,
0.016902148723602295,
0.022381367161870003,
0.015012558549642563,
0.009243164211511612,
0.01071535237133503,
0.03676889091730118,
0.038833145052194595,
0.0159902423620224,
0.006086503155529499,
-0.03488747775554657,
0.00002594656325527467,
0.018831783905625343,
-0.013990971259772778,
-0.021750397980213165,
0.03239241987466812,
0.011724194511771202,
-0.06814198195934296,
0.01895716041326523,
-0.0009365208679810166,
0.027302211150527,
-0.015664849430322647,
0.011260847561061382,
0.009906768798828125,
-0.0514606237411499,
0.012711500748991966,
0.0028766444884240627,
0.03237709403038025,
-0.01309336256235838,
-0.009376653470098972,
-0.7118238210678101,
-0.0034803643357008696,
0.004494018852710724,
-0.016803400591015816,
0.020728709176182747,
0.00929004792124033,
-0.03555182367563248,
0.01424415037035942,
-0.012916190549731255,
0.0073748365975916386,
-0.018573112785816193,
-0.009448635391891003,
-0.039273496717214584,
-0.017233382910490036,
0.018030881881713867,
-0.01015965361148119,
0.01703009568154812,
-0.05023377761244774,
0.012577343732118607,
-0.0011592366499826312,
0.04163803160190582,
-0.04110220447182655,
-0.002932646544650197,
0.01015335414558649,
0.034266985952854156,
0.013565508648753166,
0.04429100081324577,
0.012146015651524067,
-0.016198864206671715,
-0.024358920753002167,
0.00939396396279335,
-0.010940068401396275,
0.008174893446266651,
-0.004545315634459257,
0.006351218093186617,
0.03446505218744278,
0.0021981275640428066,
-0.006890138145536184,
-0.020071234554052353,
0.007012169808149338,
-0.030727768316864967,
0.0044377944432199,
-0.012821389362215996,
-0.048356033861637115,
-0.01412118598818779,
-0.011035338044166565,
-0.025182878598570824,
-0.029442500323057175,
0.026135260239243507,
0.011926735751330853,
-0.018433023244142532,
0.009453460574150085,
0.024267571046948433,
-0.01592152751982212,
-0.004360072780400515,
0.02104266919195652,
0.0039035333320498466,
-0.03342847526073456,
-0.017676303163170815,
-0.0038138816598802805,
0.06919805705547333,
0.02056131884455681,
-0.023677997291088104,
0.018105776980519295,
-0.016776928678154945,
0.020538274198770523,
0.048606522381305695,
0.0030856411904096603,
-0.046662915498018265,
0.013687841594219208,
-0.055711280554533005,
0.0029659646097570658,
-0.02561371400952339,
0.12418872117996216,
-0.02671731449663639,
-0.015600972808897495,
-0.03657028079032898,
0.003831631736829877,
-0.0518641360104084,
-0.0010862426133826375,
0.00350190163590014,
-0.00700182793661952,
0.0019586049020290375,
0.00007973524770932272,
-0.026967834681272507,
0.007611311040818691,
-0.004052901640534401,
-0.02869739569723606,
-0.016738219186663628,
0.019079135730862617,
-0.01617186702787876,
0.034379083663225174,
-0.00591403990983963,
-0.01749151013791561,
0.019247742369771004,
0.006153589114546776,
0.04105681553483009,
0.07636997103691101,
0.026534538716077805,
-0.004763132426887751,
-0.06928444653749466,
-0.01910415105521679,
-0.028773866593837738,
0.02403200976550579,
-0.007483330555260181,
0.015469545498490334,
-0.006698968820273876,
0.0038535797502845526,
0.042729247361421585,
-0.04971257224678993,
0.012104985304176807,
-0.0000043553091018111445,
-0.021144799888134003,
0.03393767774105072,
-0.0129682756960392,
-0.021553216502070427,
0.013902556151151657,
-0.04225749149918556,
0.007159976288676262,
-0.016736088320612907,
-0.014743819832801819,
0.00867973268032074,
-0.024339590221643448,
0.04258742555975914,
-0.003286084160208702,
0.010170171037316322,
-0.017553595826029778,
-0.0014386358670890331,
-0.014257360249757767,
0.016740331426262856,
0.001080391462892294,
0.0015203176299110055,
-0.01511464361101389,
0.022492168471217155,
-0.01938319206237793,
0.006215384695678949,
-0.02684224769473076,
-0.023740971460938454,
-0.01796892285346985,
-0.023022130131721497,
-0.017526160925626755,
-0.013975972309708595,
0.010564260184764862,
-0.05144305154681206,
0.03232079744338989,
-0.0037362496368587017,
0.033226195722818375,
0.006186244543641806,
-0.006386648863554001,
0.0009982776828110218,
-0.009484663605690002,
0.058571089059114456,
-0.022495577111840248,
0.008499695919454098,
-0.009164359420537949,
0.010105987079441547,
-0.00626324862241745,
0.028132624924182892,
0.03193264082074165,
0.001850991859100759,
0.02406982146203518,
0.02239665761590004,
-0.010821823962032795,
0.04242131859064102,
-0.00064107432262972,
-0.005006398074328899,
0.008275913074612617,
0.01796804368495941,
-0.00017638469580560923,
0.03815494477748871,
-0.02103930152952671,
-0.030024250969290733,
0.013252443633973598,
-0.03106418438255787,
-0.015044384635984898,
0.01205260306596756,
-0.007482876535505056,
-0.05158492922782898,
-0.02018757164478302,
-0.046025242656469345,
0.0024839681573212147,
-0.0213349387049675,
-0.0016386184142902493,
-0.012062685564160347,
0.009090866893529892,
0.012489457614719868,
-0.0026715868152678013,
0.012103847227990627,
0.021473057568073273,
-0.014309055171906948,
0.015372384339571,
-0.014121301472187042,
-0.03481706604361534,
0.012192299589514732,
-0.003944659139961004,
-0.020587585866451263,
-0.033206507563591,
0.016911694779992104,
0.009256435558199883,
0.00278895883820951,
0.028940409421920776,
0.00969601608812809,
0.03698583319783211,
-0.002907713409513235,
-0.004989104811102152,
-0.007713704835623503,
-0.017600638791918755,
-0.003233088180422783,
0.01942911371588707,
-0.0016605157870799303,
0.012493128888309002,
-0.007688506972044706,
-0.0011169739300385118,
-0.011744060553610325,
-0.027812186628580093,
0.042618561536073685,
-0.04908163473010063,
-0.040405675768852234,
-0.01924723945558071,
-0.012533857487142086,
-0.047354232519865036,
-0.030170144513249397,
0.022594891488552094,
-0.020847046747803688,
-0.011601665057241917,
-0.00568356504663825,
-0.019959159195423126,
0.03472014516592026,
-0.044912829995155334,
-0.02899888902902603,
0.025406470522284508,
-0.022393202409148216,
0.008104760199785233,
-0.019776759669184685,
-0.021496133878827095,
0.02489471435546875,
-0.0028230256866663694,
-0.028829192742705345,
-0.026391491293907166,
-0.020488042384386063,
0.0010289044585078955,
-0.012058628723025322,
-0.0038687121123075485,
0.014351064339280128,
-0.0014179721474647522,
0.025197822600603104,
0.0077025205828249454,
-0.043926551938056946,
0.004113758914172649,
-0.013852818869054317,
0.001779118087142706,
0.04433584585785866,
-0.006651710253208876,
0.00012600647460203618,
-0.003153532976284623,
-0.01741243153810501,
0.0061854771338403225,
0.03199394792318344,
0.033201318234205246,
0.023488197475671768,
-0.0032162214629352093,
-0.02880263142287731,
0.02725970558822155,
0.008298817090690136,
0.014018252491950989,
0.028472675010561943,
-0.0007059097988530993,
-0.020730478689074516,
-0.0169390756636858,
0.044539675116539,
0.004857521969825029,
-0.01409445982426405,
-0.024683905765414238,
-0.024231955409049988,
-0.008672547526657581,
-0.016576698049902916,
0.0109948068857193,
0.005806427914649248,
0.02228032425045967,
-0.00762628810480237,
-0.025568636134266853,
-0.014665798284113407,
0.03171739727258682,
0.008927185088396072,
-0.010053643956780434,
-0.01640472747385502,
-0.008655575104057789,
0.006667451001703739,
-0.04884708300232887,
0.005200027488172054,
0.012422407977283001,
-0.024591658264398575,
-0.014498596079647541,
0.010020616464316845,
-0.024974830448627472,
0.005542808212339878,
-0.015642639249563217,
-0.009950120002031326,
0.02320750057697296,
0.008033300749957561,
0.02342524193227291,
0.008285733871161938,
-0.0036919701378792524,
0.04631568491458893,
0.037290848791599274,
-0.026375891640782356,
0.016512179747223854,
-0.0038617043755948544,
0.03881240263581276,
-0.02058609388768673,
0.020191434770822525,
0.040769062936306,
0.009497198276221752,
-0.005203635431826115,
-0.017842784523963928,
-0.0013578812358900905,
0.04589351266622543,
0.019368167966604233,
0.010516797192394733,
-0.019425133243203163,
-0.011233433149755001,
0.03155902773141861,
-0.022733189165592194,
-0.02887415885925293,
-0.0252677034586668,
-0.030498161911964417,
-0.035294149070978165,
-0.014688982628285885,
0.005969471298158169,
0.03742222487926483,
-0.012586946599185467,
-0.017724189907312393,
0.027142196893692017,
0.022102048620581627,
0.042368579655885696,
-0.00991041585803032,
0.015502898022532463,
0.03138754516839981,
0.022788459435105324,
0.010715490207076073,
0.005472573451697826,
0.04162192344665527,
-0.006228663492947817,
-0.026501579210162163,
0.02938070520758629,
0.0024229586124420166,
0.01957577094435692,
0.03741615265607834,
0.048180051147937775,
0.051391635090112686,
0.022770950570702553,
-0.03730221465229988,
-0.0008778345654718578,
0.004059653729200363,
0.00555677292868495,
-0.022954726591706276,
-0.016806848347187042,
0.04558143764734268,
0.024644315242767334,
-0.008141630329191685,
-0.01783403940498829,
0.00033814250491559505,
0.012677333317697048,
-0.0013956218026578426,
0.010301892645657063,
-0.026425397023558617,
0.04262284189462662,
-0.010382740758359432,
0.0029732740949839354,
0.011462203226983547,
-0.015681803226470947,
-0.004849775694310665,
-0.03493809327483177,
0.03328436613082886,
-0.005077708046883345,
0.03416529297828674,
0.05383831635117531,
0.0007392814150080085,
-0.01418081670999527,
0.008478325791656971,
-0.00542889628559351,
-0.045400671660900116,
0.0017238541040569544,
-0.03850121051073074,
0.04849054664373398,
-0.04554077610373497,
0.011126543395221233,
0.012956407852470875,
-0.0086649926379323,
-0.027247605845332146,
0.004599602427333593,
0.022098969668149948,
0.042930968105793,
0.01603982411324978,
0.001260416000150144,
0.012301281094551086,
-0.0472172312438488,
-0.016489610075950623,
-0.00924519170075655,
-0.07285516709089279,
0.024920988827943802,
0.03622765094041824,
-0.0033138867001980543,
-0.027298036962747574,
0.011455578729510307,
0.013579003512859344,
0.0033037911634892225,
-0.017251232638955116,
-0.00492717744782567,
0.011578214354813099,
0.003972655162215233,
0.01707172580063343,
-0.005862404126673937,
-0.027490505948662758,
-0.013796777464449406,
0.00003802096034632996,
-0.03425613418221474,
-0.011254196055233479,
-0.00930456630885601,
0.02950008399784565,
-0.012054964900016785,
-0.023712199181318283,
-0.018283788114786148,
-0.0016852602129802108,
-0.03390446677803993,
0.005365526303648949,
0.017106590792536736,
-0.010580499656498432,
-0.006708445027470589,
0.009836590848863125,
-0.0294509194791317,
0.023415230214595795,
-0.01926313154399395,
0.010442288592457771,
0.02771669439971447,
0.006515778135508299,
-0.030260765925049782,
-0.002242159564048052,
0.012303391471505165,
0.00308001390658319,
-0.028547318652272224,
0.0007762383902445436,
0.013486542738974094,
0.011654178611934185,
-0.008439088240265846,
-0.013646876439452171,
0.02740170620381832,
0.00817630160599947,
0.0020863914396613836,
-0.028590701520442963,
0.007221069652587175,
0.014053435064852238,
0.02263268083333969,
0.018080394715070724,
-0.007819277234375477,
0.036691904067993164,
0.01300483476370573,
0.017491912469267845,
0.01973983459174633,
0.010945144109427929,
0.017752377316355705,
0.018931660801172256,
-0.01822941191494465,
0.029712608084082603,
0.07250739634037018,
0.07652197778224945,
-0.0160223338752985,
-0.008548031561076641,
-0.007482845801860094,
-0.019305823370814323,
0.007564733270555735,
0.04060719534754753,
-0.016344595700502396,
0.02092486433684826,
0.011952993459999561,
0.0035132018383592367,
-0.007828757166862488,
-0.02119891345500946,
0.0045486860908567905,
0.024112464860081673,
-0.049014922231435776,
0.03083384595811367,
0.03217126056551933,
0.02110913209617138,
0.034254040569067,
0.00350182200782001,
-0.0004885832313448191,
-0.0070814527571201324,
0.012927920557558537,
0.004543489310890436,
-0.03096630796790123,
-0.035602159798145294,
-0.03517727553844452,
0.03297021612524986,
0.0032354870345443487,
0.012233083136379719,
-0.002172401873394847,
-0.005946835968643427,
0.045462798327207565,
-0.012019398622214794,
-0.05935406684875488,
-0.03460032120347023,
0.03155164048075676,
-0.02288469672203064,
0.034926414489746094,
-0.0006532039842568338,
0.0639161542057991,
0.0324583575129509,
-0.022908663377165794,
0.01899077370762825,
-0.03133609518408775,
-0.0007095528999343514,
-0.034712616354227066,
-0.0030113852117210627,
0.01284031756222248,
0.005328684113919735,
0.02654927782714367,
-0.08507876098155975,
0.0010570577578619123,
-0.02260679006576538,
0.004717179108411074,
0.029459502547979355,
-0.021162616088986397,
-0.029343631118535995,
0.005836785305291414,
-0.010551859624683857,
-0.0389614962041378,
-0.017703529447317123,
-0.0008556533139199018,
0.018629495054483414,
-0.015346989966928959,
-0.0012946013594046235,
-0.017679590731859207,
-0.006092731840908527,
-0.014953169971704483,
-0.0400390587747097,
-0.0057451981119811535,
0.04553719237446785,
-0.012170645408332348,
0.017899300903081894,
0.016809672117233276,
0.019176747649908066,
-0.04209904372692108,
0.006184858735650778,
-0.03264941647648811,
-0.011414692737162113,
0.004721387289464474,
0.032262153923511505,
0.015378264710307121,
-0.00686135096475482,
-0.0006326601724140346,
0.004466412588953972,
0.014002437703311443,
0.0006174168665893376,
-0.028134986758232117,
-0.04669946804642677,
-0.013666809536516666,
-0.0020089871250092983,
-0.034849680960178375,
-0.03597954288125038,
-0.01786569133400917,
0.01954186148941517
] |
8a8c957af09c1662e1613d8819301ef9871bcd5c | 5,914 | py | Python | tensorflow/python/ops/standard_ops.py | ashutom/tensorflow-upstream | c16069c19de9e286dd664abb78d0ea421e9f32d4 | [
"Apache-2.0"
] | 8 | 2021-08-03T03:57:10.000Z | 2021-12-13T01:19:02.000Z | tensorflow/python/ops/standard_ops.py | CaptainGizzy21/tensorflow | 3457a2b122e50b4d44ceaaed5a663d635e5c22df | [
"Apache-2.0"
] | 17 | 2021-08-12T19:38:42.000Z | 2022-01-27T14:39:35.000Z | tensorflow/python/ops/standard_ops.py | CaptainGizzy21/tensorflow | 3457a2b122e50b4d44ceaaed5a663d635e5c22df | [
"Apache-2.0"
] | 4 | 2022-01-13T11:23:44.000Z | 2022-03-02T11:11:42.000Z | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# pylint: disable=unused-import
"""Import names of Tensor Flow standard Ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import platform as _platform
import sys as _sys
from tensorflow.python import autograph
from tensorflow.python.training.experimental import loss_scaling_gradient_tape
# pylint: disable=g-bad-import-order
# Imports the following modules so that @RegisterGradient get executed.
from tensorflow.python.ops import array_grad
from tensorflow.python.ops import cudnn_rnn_grad
from tensorflow.python.ops import data_flow_grad
from tensorflow.python.ops import manip_grad
from tensorflow.python.ops import math_grad
from tensorflow.python.ops import random_grad
from tensorflow.python.ops import rnn_grad
from tensorflow.python.ops import sparse_grad
from tensorflow.python.ops import state_grad
from tensorflow.python.ops import tensor_array_grad
# go/tf-wildcard-import
# pylint: disable=wildcard-import
from tensorflow.python.ops.array_ops import * # pylint: disable=redefined-builtin
from tensorflow.python.ops.check_ops import *
from tensorflow.python.ops.clip_ops import *
from tensorflow.python.ops.special_math_ops import *
# TODO(vrv): Switch to import * once we're okay with exposing the module.
from tensorflow.python.ops.confusion_matrix import confusion_matrix
from tensorflow.python.ops.control_flow_ops import Assert
from tensorflow.python.ops.control_flow_ops import case
from tensorflow.python.ops.control_flow_ops import cond
from tensorflow.python.ops.control_flow_ops import group
from tensorflow.python.ops.control_flow_ops import no_op
from tensorflow.python.ops.control_flow_ops import tuple # pylint: disable=redefined-builtin
# pylint: enable=redefined-builtin
from tensorflow.python.eager import wrap_function
from tensorflow.python.ops.control_flow_ops import while_loop
from tensorflow.python.ops.batch_ops import *
from tensorflow.python.ops.critical_section_ops import *
from tensorflow.python.ops.data_flow_ops import *
from tensorflow.python.ops.functional_ops import *
from tensorflow.python.ops.gradients import *
from tensorflow.python.ops.histogram_ops import *
from tensorflow.python.ops.init_ops import *
from tensorflow.python.ops.io_ops import *
from tensorflow.python.ops.linalg_ops import *
from tensorflow.python.ops.logging_ops import Print
from tensorflow.python.ops.logging_ops import get_summary_op
from tensorflow.python.ops.logging_ops import timestamp
from tensorflow.python.ops.lookup_ops import initialize_all_tables
from tensorflow.python.ops.lookup_ops import tables_initializer
from tensorflow.python.ops.manip_ops import *
from tensorflow.python.ops.math_ops import * # pylint: disable=redefined-builtin
from tensorflow.python.ops.numerics import *
from tensorflow.python.ops.parsing_ops import *
from tensorflow.python.ops.partitioned_variables import *
from tensorflow.python.ops.proto_ops import *
from tensorflow.python.ops.ragged import ragged_dispatch as _ragged_dispatch
from tensorflow.python.ops.ragged import ragged_operators as _ragged_operators
from tensorflow.python.ops.random_ops import *
from tensorflow.python.ops.script_ops import py_func
from tensorflow.python.ops.session_ops import *
from tensorflow.python.ops.sort_ops import *
from tensorflow.python.ops.sparse_ops import *
from tensorflow.python.ops.state_ops import assign
from tensorflow.python.ops.state_ops import assign_add
from tensorflow.python.ops.state_ops import assign_sub
from tensorflow.python.ops.state_ops import count_up_to
from tensorflow.python.ops.state_ops import scatter_add
from tensorflow.python.ops.state_ops import scatter_div
from tensorflow.python.ops.state_ops import scatter_mul
from tensorflow.python.ops.state_ops import scatter_sub
from tensorflow.python.ops.state_ops import scatter_min
from tensorflow.python.ops.state_ops import scatter_max
from tensorflow.python.ops.state_ops import scatter_update
from tensorflow.python.ops.state_ops import scatter_nd_add
from tensorflow.python.ops.state_ops import scatter_nd_sub
# TODO(simister): Re-enable once binary size increase due to scatter_nd
# ops is under control.
# from tensorflow.python.ops.state_ops import scatter_nd_mul
# from tensorflow.python.ops.state_ops import scatter_nd_div
from tensorflow.python.ops.state_ops import scatter_nd_update
from tensorflow.python.ops.stateless_random_ops import *
from tensorflow.python.ops.string_ops import *
from tensorflow.python.ops.template import *
from tensorflow.python.ops.tensor_array_ops import *
from tensorflow.python.ops.variable_scope import * # pylint: disable=redefined-builtin
from tensorflow.python.ops.variables import *
from tensorflow.python.ops.parallel_for.control_flow_ops import vectorized_map
# pylint: disable=g-import-not-at-top
if _platform.system() == "Windows":
from tensorflow.python.compiler.tensorrt import trt_convert_windows as trt
else:
from tensorflow.python.compiler.tensorrt import trt_convert as trt
# pylint: enable=g-import-not-at-top
# pylint: enable=wildcard-import
# pylint: enable=g-bad-import-order
# These modules were imported to set up RaggedTensor operators and dispatchers:
del _ragged_dispatch, _ragged_operators
| 46.936508 | 93 | 0.825668 | 0 | 0 | [
-0.048070356249809265,
0.03747375309467316,
0.002503069583326578,
0.030741682276129723,
-0.029695719480514526,
0.013221575878560543,
-0.017824731767177582,
-0.006246204487979412,
0.008616668172180653,
0.03060188703238964,
0.02359744906425476,
0.005687647964805365,
0.005634583067148924,
-0.004333702847361565,
-0.023249508813023567,
-0.021176734939217567,
0.07736518234014511,
-0.039443325251340866,
0.00565551221370697,
-0.014527958817780018,
0.01571689546108246,
-0.006198144052177668,
0.018322277814149857,
0.04001567140221596,
0.053494010120630264,
0.0526311956346035,
0.06469583511352539,
0.014819943346083164,
-0.00756327947601676,
-0.021189969033002853,
-0.0078892195597291,
0.015444094315171242,
-0.022290419787168503,
0.062366753816604614,
0.00902981124818325,
0.014445413835346699,
0.018397126346826553,
-0.09385045617818832,
0.02745538018643856,
-0.023231469094753265,
-0.017217766493558884,
-0.05440976098179817,
-0.01286671869456768,
-0.005438847932964563,
0.028714576736092567,
-0.0010999331716448069,
-0.017642555758357048,
-0.02209130860865116,
-0.04949810728430748,
-0.017874030396342278,
-0.059241894632577896,
-0.013408146798610687,
0.00856924057006836,
-0.009020185098052025,
-0.0005107881152071059,
-0.01880779303610325,
0.012760029174387455,
0.08532974123954773,
-0.021887417882680893,
-0.04458671063184738,
0.03543395921587944,
-0.00670194998383522,
0.013149390928447247,
0.054640740156173706,
0.0029856606852263212,
-0.022441092878580093,
-0.03320078179240227,
0.02846120111644268,
0.04000901058316231,
0.0023169321939349174,
-0.005277015268802643,
-0.006572638638317585,
0.015403982251882553,
0.003825702704489231,
0.0033636908046901226,
-0.005429799202829599,
-0.021818967536091805,
-0.02022244594991207,
-0.041064221411943436,
-0.002397275762632489,
-0.03419232368469238,
0.07642176747322083,
0.014873862266540527,
-0.007179119158536196,
0.04071822762489319,
0.00012628031254280359,
0.057350847870111465,
-0.04990433156490326,
0.05974980816245079,
-0.0033134380355477333,
-0.02708391286432743,
-0.04257149621844292,
-0.0074079628102481365,
-0.021339375525712967,
-0.050263915210962296,
-0.017138557508587837,
0.02906271629035473,
0.019078217446804047,
0.013092822395265102,
-0.05037730187177658,
-0.023092810064554214,
-0.022037280723452568,
0.021389272063970566,
0.0019863860215991735,
-0.006649278104305267,
0.03529375046491623,
-0.031720612198114395,
-0.016648519784212112,
0.025485888123512268,
-0.01242103986442089,
0.0019999269861727953,
0.026595255360007286,
-0.026768861338496208,
-0.044474128633737564,
-0.02742893248796463,
-0.01875636726617813,
0.004691815469413996,
0.008627794682979584,
0.018624041229486465,
-0.042647358030080795,
0.019887441769242287,
0.0037636489141732454,
0.01089511252939701,
0.007614364381879568,
-0.04762385040521622,
0.0700424462556839,
-0.010359927080571651,
0.07130526006221771,
0.001765559078194201,
-0.019055791199207306,
-0.0012317883083596826,
0.008863753639161587,
-0.04854331910610199,
0.008042318746447563,
0.009248663671314716,
0.029917296022176743,
0.014414738863706589,
0.02628191001713276,
-0.03958762437105179,
0.015621206723153591,
-0.017878439277410507,
-0.016087306663393974,
-0.011596625670790672,
-0.024467095732688904,
0.012193544767796993,
-0.05153859779238701,
0.006445977836847305,
-0.033587124198675156,
-0.009757167659699917,
0.013919226825237274,
0.014328229241073132,
0.001966439187526703,
0.004138032905757427,
0.016243096441030502,
-0.0005604638135991991,
0.008563557639718056,
-0.010087743401527405,
-0.025983132421970367,
-0.011260630562901497,
-0.024954652413725853,
-0.023963384330272675,
-0.029052475467324257,
0.014611496590077877,
-0.009723186492919922,
-0.0023962000850588083,
0.027401121333241463,
0.009193958714604378,
0.030925413593649864,
-0.0006923098699189723,
-0.033392567187547684,
-0.011011339724063873,
0.0031798509880900383,
-0.03969211131334305,
-0.0106780044734478,
0.03352589160203934,
0.012251094914972782,
0.02788718417286873,
0.02473711408674717,
0.027307145297527313,
0.024232445284724236,
0.004650871269404888,
-0.054087694734334946,
0.010413096286356449,
-0.008744477294385433,
-0.01742411218583584,
0.05387893691658974,
-0.04442005604505539,
-0.026416145265102386,
0.005903013050556183,
-0.022623281925916672,
0.01192229799926281,
0.04426288232207298,
0.013033307157456875,
-0.015897298231720924,
0.018969759345054626,
-0.011893874034285545,
0.006877552717924118,
0.012617835775017738,
-0.0028253677301108837,
0.013084141537547112,
-0.016866860911250114,
-0.017091166228055954,
0.03139406442642212,
-0.004407884553074837,
-0.009565516375005245,
0.0336601659655571,
-0.6075965762138367,
0.03222847357392311,
0.045058343559503555,
0.05623875930905342,
0.004008120857179165,
0.03130720928311348,
-0.043467339128255844,
-0.00536801852285862,
-0.04118170589208603,
-0.03769903630018234,
0.03466698154807091,
-0.017600592225790024,
0.0295144971460104,
0.02671186812222004,
-0.017092688009142876,
-0.0026846681721508503,
0.006915239151567221,
-0.017531393095850945,
0.0023057765793055296,
0.008188228122889996,
0.028190460056066513,
-0.012766649015247822,
-0.015126865357160568,
0.044178616255521774,
-0.04385736212134361,
-0.026342051103711128,
0.02426667883992195,
0.008099250495433807,
-0.011218163184821606,
-0.008703714236617088,
-0.009177830070257187,
0.013925598002970219,
0.00691723870113492,
-0.017330119386315346,
-0.026245074346661568,
0.00637831212952733,
0.053284745663404465,
-0.033342145383358,
-0.034204885363578796,
0.02239084057509899,
0.010839329101145267,
-0.015746012330055237,
0.007307537831366062,
-0.0842171236872673,
-0.018409643322229385,
0.020204734057188034,
0.06167003512382507,
0.022040294483304024,
0.0038573620840907097,
-0.03225356340408325,
-0.004099739715456963,
0.022010141983628273,
0.01848992519080639,
-0.010278496891260147,
0.018446020781993866,
0.016154002398252487,
-0.036628007888793945,
-0.013842674903571606,
-0.0016032711137086153,
-0.004317933227866888,
-0.0034383197780698538,
-0.033948492258787155,
-0.013603603467345238,
0.01563025265932083,
-0.005926421843469143,
0.0035598750691860914,
0.034070082008838654,
-0.02976847067475319,
0.005730954464524984,
0.006976955104619265,
-0.027075890451669693,
-0.00835263542830944,
-0.03128589317202568,
0.10911882668733597,
-0.009613314643502235,
0.026128718629479408,
-0.02463601343333721,
-0.00920258928090334,
-0.05804351717233658,
-0.03417225554585457,
0.028201675042510033,
-0.031376879662275314,
0.009747596457600594,
0.0023989537730813026,
-0.04722951725125313,
-0.0031070024706423283,
-0.007210979703813791,
-0.016335444524884224,
-0.03755224123597145,
-0.026076771318912506,
0.00872721802443266,
0.06336992233991623,
0.03673151880502701,
0.023703576996922493,
0.004484717268496752,
-0.015991492196917534,
-0.027088714763522148,
-0.04728606715798378,
0.01901370659470558,
0.02198883891105652,
-0.022076517343521118,
0.006006983108818531,
-0.01629369705915451,
-0.03067680075764656,
0.017864931374788284,
0.025460096076130867,
-0.047710902988910675,
-0.013089276850223541,
0.10451900213956833,
-0.030073175206780434,
-0.005536122713238001,
-0.025490958243608475,
-0.02836289256811142,
0.001920565264299512,
-0.014698758721351624,
-0.024004817008972168,
-0.03304658830165863,
-0.018185891211032867,
0.018423406407237053,
-0.021605920046567917,
0.012060316279530525,
-0.01235303096473217,
0.0013525300892069936,
0.06514506042003632,
0.016149817034602165,
0.03037618100643158,
-0.0018046438926830888,
0.03966851159930229,
0.048711273819208145,
0.020385008305311203,
-0.06257154047489166,
-0.016731442883610725,
0.022741753607988358,
-0.0254439078271389,
-0.01633872464299202,
0.0354665070772171,
-0.0013865771470591426,
-0.026743022724986076,
-0.0415932759642601,
-0.0006533715641126037,
-0.08315817266702652,
-0.021268296986818314,
0.030276069417595863,
0.008019589819014072,
-0.002801218768581748,
0.026195412501692772,
0.01984824426472187,
0.0032477222848683596,
-0.008772187866270542,
-0.0056528919376432896,
-0.0031900512985885143,
0.02433125674724579,
-0.02419787459075451,
-0.020286092534661293,
0.008674188517034054,
0.01245630718767643,
-0.029078738763928413,
-0.019557636231184006,
0.03246329724788666,
0.014148135669529438,
-0.023379379883408546,
-0.00472431443631649,
-0.013341990299522877,
0.015092408284544945,
-0.00007551260205218568,
-0.0030809363815933466,
-0.027786316350102425,
-0.002438238589093089,
0.02932075224816799,
0.038194846361875534,
0.029224295169115067,
0.01049671322107315,
-0.0056204176507890224,
0.014497212134301662,
0.006862429436296225,
0.003831236157566309,
-0.029567161574959755,
-0.03233040124177933,
0.0005923749995417893,
0.03126436844468117,
-0.009050318039953709,
-0.003948015160858631,
-0.004104602616280317,
-0.0030836276710033417,
0.007535605691373348,
0.045816488564014435,
-0.0005565743776969612,
-0.006465523038059473,
-0.00587446941062808,
0.007977749221026897,
0.002589732874184847,
0.006628900300711393,
-0.04021647945046425,
-0.02057306095957756,
-0.015522330068051815,
-0.008234955370426178,
0.01189288031309843,
0.007500920444726944,
0.024563446640968323,
-0.004847249947488308,
0.03389052301645279,
-0.041155606508255005,
0.002618510276079178,
-0.03844559192657471,
0.040018439292907715,
0.05480566993355751,
-0.017209410667419434,
0.016649456694722176,
-0.00005880928074475378,
-0.05908907577395439,
0.010035863146185875,
-0.012529578059911728,
-0.0059116799384355545,
-0.017427772283554077,
0.0033303159289062023,
0.04978340491652489,
0.005252381786704063,
-0.005839581601321697,
0.030897337943315506,
-0.0346619077026844,
-0.014889972284436226,
-0.021481193602085114,
-0.0010717138648033142,
0.006577289663255215,
-0.010521369986236095,
-0.028265541419386864,
-0.05084715038537979,
0.03402019292116165,
-0.004010449629276991,
-0.014160566963255405,
0.017086880281567574,
0.020338216796517372,
0.003926232922822237,
-0.02022000029683113,
0.03216790407896042,
0.009199955500662327,
-0.020381858572363853,
-0.024823198094964027,
-0.008708142675459385,
0.004165968857705593,
0.0024440784472972155,
-0.04310864582657814,
0.009779427200555801,
0.047817785292863846,
-0.013386930339038372,
0.00485257338732481,
-0.025095393881201744,
-0.04587511718273163,
-0.038958195596933365,
-0.001399743603542447,
0.01276683621108532,
0.017692632973194122,
0.03606175631284714,
-0.0068551963195204735,
-0.0009076317655853927,
-0.018975408747792244,
-0.006602502427995205,
-0.024328280240297318,
0.04546700417995453,
0.0063077728264033794,
-0.021667655557394028,
-0.01203876081854105,
-0.007715628948062658,
0.016365496441721916,
-0.035009484738111496,
0.023195985704660416,
-0.017422163859009743,
-0.000054493488278239965,
-0.00004407535379868932,
0.01609104871749878,
-0.038324229419231415,
-0.020711611956357956,
-0.038630492985248566,
0.020193085074424744,
0.05782556161284447,
0.022252341732382774,
0.017181240022182465,
-0.027532057836651802,
0.014681250788271427,
-0.008903785608708858,
-0.03111192211508751,
0.020261865109205246,
0.006266303360462189,
0.010880513116717339,
0.0038785520009696484,
0.0028767576441168785,
0.013427680358290672,
-0.013777580112218857,
-0.04183429852128029,
0.009234304539859295,
-0.012347285635769367,
-0.02564617060124874,
0.055945102125406265,
0.01723952777683735,
0.02063915506005287,
-0.003209273796528578,
-0.007400759030133486,
0.023983873426914215,
-0.03359941393136978,
0.019665954634547234,
0.01996769569814205,
-0.009906246326863766,
-0.04373888671398163,
0.04287102818489075,
0.0010623441776260734,
-0.03767240419983864,
0.010674159973859787,
-0.011010358110070229,
0.04746231809258461,
-0.0026953432243317366,
-0.006819205824285746,
0.002866148017346859,
0.0038377658929675817,
0.060041580349206924,
0.02855081483721733,
-0.0214503426104784,
0.07139192521572113,
-0.056023772805929184,
0.006969134788960218,
-0.015253415331244469,
-0.027080686762928963,
0.058578427881002426,
-0.01579217240214348,
-0.0004906909889541566,
0.015332577750086784,
-0.033267803490161896,
-0.06528724730014801,
-0.03319903090596199,
-0.01930738054215908,
-0.031903915107250214,
0.0185459665954113,
-0.0036936865653842688,
0.018402447924017906,
0.01278702449053526,
-0.008570007048547268,
-0.03475136309862137,
0.009027557447552681,
0.044744644314050674,
-0.00896148756146431,
-0.024018598720431328,
0.0006936905556358397,
-0.008054053410887718,
-0.03210042789578438,
-0.0662829577922821,
0.03083798848092556,
0.013062373735010624,
0.03556546941399574,
-0.013767481781542301,
0.022228490561246872,
0.06579189002513885,
0.02574186958372593,
-0.01716410182416439,
-0.038003984838724136,
0.03209032118320465,
-0.008874504826962948,
0.05330170691013336,
0.02503245882689953,
0.0013745835749432445,
0.010964259505271912,
-0.0135367875918746,
-0.04683062061667442,
-0.01058553159236908,
-0.022538242861628532,
0.0034958627074956894,
0.0011608304921537638,
-0.01860234886407852,
0.05811130255460739,
-0.011585352942347527,
0.006700711790472269,
0.023752382025122643,
-0.031303249299526215,
-0.00677572563290596,
0.014282574877142906,
0.017090119421482086,
0.025325501337647438,
0.08591271936893463,
0.020247571170330048,
-0.033749766647815704,
-0.04745343327522278,
-0.0068487972021102905,
-0.008566905744373798,
-0.029419036582112312,
-0.0007717694388702512,
-0.005591684952378273,
-0.016196049749851227,
-0.015404975041747093,
0.009164710529148579,
0.019503284245729446,
0.016003476455807686,
-0.05042075365781784,
0.004101334605365992,
-0.019513288512825966,
-0.005464667454361916,
-0.0029507270082831383,
-0.00006565587682416663,
0.003192498115822673,
-0.03342331200838089,
-0.0028571703005582094,
0.019198276102542877,
0.00372326304204762,
-0.014989737421274185,
0.004898755811154842,
0.023498013615608215,
0.004770668223500252,
0.022705717012286186,
-0.012278416194021702,
0.0026505745481699705,
-0.055025115609169006,
-0.01868538372218609,
-0.01649685576558113,
0.05195444077253342,
0.009016327559947968,
0.015246398746967316,
-0.042440854012966156,
0.06536678224802017,
0.02632122114300728,
-0.027950135990977287,
0.00516914390027523,
-0.01597295142710209,
0.03620167076587677,
0.001575505011714995,
0.001331991981714964,
-0.011991465464234352,
0.020175864920020103,
-0.015191157348453999,
-0.03714438155293465,
0.009814200922846794,
0.02366875857114792,
-0.01181409228593111,
0.03239816054701805,
0.024546047672629356,
-0.05513583868741989,
-0.05455506220459938,
0.011002176441252232,
0.002124122343957424,
-0.04978359490633011,
0.0030363183468580246,
-0.031415242701768875,
-0.035497430711984634,
0.01984274759888649,
-0.03658047690987587,
0.007717630825936794,
-0.027150964364409447,
0.02552894502878189,
-0.027280209586024284,
-0.02944863773882389,
0.016802221536636353,
0.027524296194314957,
0.007987625896930695,
0.025990083813667297,
0.016948848962783813,
0.03321164846420288,
-0.0087406812235713,
-0.04518686980009079,
-0.0004904925008304417,
-0.005776234902441502,
-0.003698262618854642,
0.013594307936728,
0.013903297483921051,
0.021497417241334915,
-0.013470091857016087,
0.022531263530254364,
0.032028548419475555,
0.026140859350562096,
-0.028351599350571632,
0.024471981450915337,
0.007503837812691927,
-0.028433585539460182,
0.013151890598237514,
0.030692944303154945,
0.0011089647887274623,
-0.0046216933988034725,
-0.03784584999084473,
0.008267214521765709,
-0.0148493442684412,
0.00629843957722187,
0.010169404558837414,
0.0021361883264034986,
0.010321268811821938,
0.011301913298666477,
-0.04513315111398697,
-0.008638137020170689,
-0.002293188590556383,
0.030496826395392418,
0.011955592781305313,
-0.01808536797761917,
-0.0034138953778892756,
0.05456269159913063,
0.013433443382382393,
0.012419041246175766,
-0.036564625799655914,
-0.05008586123585701,
-0.03469298407435417,
0.05678451433777809,
0.012145033106207848,
-0.07064696401357651,
0.041275445371866226,
0.044062066823244095,
0.05147144943475723,
-0.016651958227157593,
0.066260427236557,
-0.01228717714548111,
0.017384368926286697,
-0.028749285265803337,
0.03390521556138992,
0.03679288551211357,
0.024346906691789627,
0.04007074236869812,
-0.01210744772106409,
-0.04164186492562294,
-0.015431500971317291,
-0.030833112075924873,
-0.011676229536533356,
0.06969244033098221,
0.05589402839541435,
0.021691545844078064,
0.06837745755910873,
-0.06136765703558922,
-0.0165171530097723,
0.032222963869571686,
0.015546773560345173,
-0.0012799742398783565,
0.0025687371380627155,
-0.0020242510363459587,
0.014022407121956348,
0.024509727954864502,
-0.04978422448039055,
-0.020191654562950134,
0.016584234312176704,
0.013914890587329865,
0.03105567954480648,
-0.012087985873222351,
0.006744627840816975,
-0.030802790075540543,
0.002775896107777953,
-0.04120432212948799,
0.014558226801455021,
0.03981009125709534,
-0.013719321228563786,
-0.07078702002763748,
0.019580073654651642,
0.04908445104956627,
-0.05394401028752327,
-0.045646779239177704,
0.02037912979722023,
-0.02328784577548504,
-0.004459623713046312,
-0.028972895815968513,
0.03365083038806915,
-0.015749163925647736,
-0.033856917172670364,
-0.014093388803303242,
-0.019081974402070045,
0.010763026773929596,
-0.06564538925886154,
-0.021192368119955063,
0.031119724735617638,
0.08363565802574158,
-0.004250810015946627,
-0.054450493305921555,
-0.012194358743727207,
0.006367648020386696
] |
8a8ce25aff69e17f6f7281d206c301403a98d23f | 3,208 | py | Python | src/tango_scaling_test/TestDeviceServer/__main__.py | rtobar/sdp-prototype | 9f1527b884bf80daa509a7fe3722160c77260f4f | [
"BSD-3-Clause"
] | null | null | null | src/tango_scaling_test/TestDeviceServer/__main__.py | rtobar/sdp-prototype | 9f1527b884bf80daa509a7fe3722160c77260f4f | [
"BSD-3-Clause"
] | null | null | null | src/tango_scaling_test/TestDeviceServer/__main__.py | rtobar/sdp-prototype | 9f1527b884bf80daa509a7fe3722160c77260f4f | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test Tango device server for use with scaling tests."""
import sys
import time
import argparse
import tango
from tango.server import run
from TestDevice import TestDevice
def init_callback():
"""Report server start up times.
This callback is executed post server initialisation.
"""
# pylint: disable=global-statement
global START_TIME
db = tango.Database()
elapsed = time.time() - START_TIME
list_devices()
exported_devices = list(db.get_device_exported('test/*'))
num_devices = len(exported_devices)
file = open('results.txt', 'a')
file.write(',{},{}\n'.format(elapsed, elapsed / num_devices))
print('>> Time taken to start devices: {:.4f} s ({:.4f} s/dev)'
.format(elapsed, elapsed / num_devices))
def delete_server():
"""Delete the TestDeviceServer from the tango db."""
db = tango.Database()
db.set_timeout_millis(50000)
server = 'TestDeviceServer/1'
server_list = list(db.get_server_list(server))
if server in server_list:
start_time = time.time()
db.delete_server('TestDeviceServer/1')
print('- Delete server: {:.4f} s'.format(time.time() - start_time))
def register(num_devices):
"""Register devices in the tango db."""
db = tango.Database()
device_info = tango.DbDevInfo()
device_info.server = 'TestDeviceServer/1'
# pylint: disable=protected-access
device_info._class = 'TestDevice'
start_time = time.time()
for device_id in range(num_devices):
device_info.name = 'test/test_device/{:05d}'.format(device_id)
db.add_device(device_info)
elapsed = time.time() - start_time
file = open('results.txt', 'a')
file.write('{},{},{}'.format(num_devices, elapsed, elapsed/num_devices))
print('- Register devices: {:.4f} s ({:.4f} s/device)'
.format(elapsed, elapsed / num_devices))
def list_devices():
"""List tango devices associated with the TestDeviceServer."""
db = tango.Database()
server_instance = 'TestDeviceServer/1'
device_class = 'TestDevice'
devices = list(db.get_device_name(server_instance, device_class))
print('- No. registered devices: {}'.format(len(devices)))
exported_devices = list(db.get_device_exported('test/*'))
print('- No. running devices: {}'.format(len(exported_devices)))
def main(args=None, **kwargs):
"""Run (start) the device server."""
run([TestDevice], verbose=True, msg_stream=sys.stdout,
post_init_callback=init_callback, raises=False,
args=args, **kwargs)
if __name__ == '__main__':
PARSER = argparse.ArgumentParser(description='Device registration time.')
PARSER.add_argument('num_devices', metavar='N', type=int,
default=1, nargs='?',
help='Number of devices to start.')
ARGS = PARSER.parse_args()
delete_server()
time.sleep(0.5)
list_devices()
print('* Registering {} devices'.format(ARGS.num_devices))
register(ARGS.num_devices)
list_devices()
print('* Starting server ...')
sys.argv = ['TestDeviceServer', '1', '-v4']
START_TIME = time.time()
main()
| 29.981308 | 77 | 0.65586 | 1 | 1.7586 | [
0.001000388991087675,
0.0237891785800457,
0.008743640035390854,
0.001202080398797989,
0.002977058058604598,
-0.0011206314666196704,
-0.008347760885953903,
0.0024836512748152018,
-0.0070222122594714165,
0.00126712117344141,
0.0019411571556702256,
0.006331335287541151,
0.0066376663744449615,
-0.017784208059310913,
0.0006414879462681711,
0.014727442525327206,
-0.05111983045935631,
0.00031812337692826986,
-0.0026704079937189817,
0.0023523226846009493,
-0.006934085860848427,
0.009280960075557232,
0.009052908979356289,
0.006079773418605328,
0.006106636952608824,
-0.002248266479000449,
0.008766391314566135,
0.0003491744282655418,
-0.007418930064886808,
-0.007690886035561562,
-0.0014001098461449146,
-0.002393938833847642,
-0.007212279364466667,
-0.004920820239931345,
0.00536575959995389,
-0.003494584234431386,
-0.0020955256186425686,
-0.02013791911303997,
0.013758501037955284,
-0.0031923591159284115,
-0.00499206967651844,
-0.015729302540421486,
0.000014881846254866105,
0.0030338468495756388,
-0.007200717460364103,
-0.000028198075597174466,
-0.0030350182205438614,
0.0033281934447586536,
-0.012831846252083778,
0.00673489598557353,
-0.009138701483607292,
0.005855286493897438,
0.01360298227518797,
0.003213753690943122,
-0.006864407565444708,
-0.006834337022155523,
0.0113127576187253,
-0.000545595190487802,
-0.010271342471241951,
0.0000461446434201207,
-0.002503372961655259,
-0.0033583645708858967,
0.00625408673658967,
0.0030763940885663033,
-0.013031245209276676,
-0.00808711163699627,
-0.0033848057501018047,
0.0022090293932706118,
-0.0003536918666213751,
0.006140507757663727,
-0.0006739177624695003,
-0.0006334594218060374,
0.008324433118104935,
0.00473562628030777,
0.005009159445762634,
-0.0035419841296970844,
-0.0019377453718334436,
-0.00014671120152343065,
0.007685130462050438,
0.002689025364816189,
0.004142634570598602,
-0.0055160801857709885,
0.005448831710964441,
0.007289764005690813,
0.015215680934488773,
0.009720174595713615,
0.020332148298621178,
-0.01050032489001751,
0.048949532210826874,
0.009162013418972492,
-0.008206984028220177,
0.0031064143404364586,
-0.010649675503373146,
-0.0016471989220008254,
-0.0044010779820382595,
-0.026596296578645706,
0.0013252911157906055,
-0.002813626080751419,
-0.003084273776039481,
0.0031490419059991837,
0.0003382780705578625,
0.007551844697445631,
-0.0006953816628083587,
-0.000832382298540324,
-0.007079327013343573,
0.01101192831993103,
-0.008804162964224815,
-0.0030615946743637323,
0.005525071173906326,
0.0019640878308564425,
-0.009985018521547318,
-0.001585262594744563,
0.0030433584470301867,
-0.01277165301144123,
0.0011275176657363772,
0.002591487718746066,
-0.004542549140751362,
0.052545543760061264,
-0.0010635147336870432,
0.005110811907798052,
-0.004466299433261156,
0.0019509999547153711,
0.0012847097823396325,
0.004369716159999371,
0.010068997740745544,
-0.0018757078796625137,
0.0106465769931674,
0.007944069802761078,
0.0024253488518297672,
0.010638975538313389,
-0.003882485441863537,
0.005704973824322224,
-0.0033513158559799194,
-0.0018595437286421657,
0.0012161367340013385,
-0.007060169707983732,
0.00640511978417635,
-0.0027519608847796917,
-0.010272514075040817,
-0.00028426683275029063,
-0.0014371785800904036,
-0.008963292464613914,
0.0021422572899609804,
-0.0038138050585985184,
0.004426044411957264,
-0.011046933941543102,
-0.003608499187976122,
-0.003062627511098981,
-0.0025181984528899193,
0.0014627418713644147,
0.010825262404978275,
0.004784946329891682,
0.00222103763371706,
-0.0037505379877984524,
-0.009692317806184292,
-0.0015383731806650758,
-0.003940622787922621,
0.002466663485392928,
0.005918951705098152,
0.004050662275403738,
-0.00974129606038332,
-0.0010844884673133492,
0.0015658551128581166,
0.0017545960145071149,
0.00015131743566598743,
0.002715788083150983,
-0.007996642962098122,
0.006178460083901882,
-0.00029024621471762657,
0.0037471456453204155,
0.010284220799803734,
-0.0029069422744214535,
0.0003895575937349349,
0.0012187780812382698,
0.0013985189143568277,
-0.0005328828119672835,
0.004217197187244892,
0.010900430381298065,
-0.0016956728650256991,
-0.0036920327693223953,
0.004042649641633034,
0.005701011978089809,
0.009098107926547527,
0.005480588413774967,
-0.003008295316249132,
0.0012929131044074893,
-0.004706680774688721,
-0.0033778848592191935,
0.006730971392244101,
-0.004867864772677422,
0.005926606245338917,
0.003259866964071989,
-0.013695109635591507,
-0.00878563430160284,
0.00027073215460404754,
-0.007329548243433237,
0.0003022537275683135,
0.012477952986955643,
0.011756619438529015,
-0.005630455445498228,
0.002788808196783066,
-0.007768554612994194,
0.0028859402518719435,
0.008935060352087021,
0.004069052636623383,
-0.01280385535210371,
-0.9602821469306946,
0.008333242498338223,
0.002957678632810712,
-0.0021326940041035414,
0.005629109218716621,
0.0018220464698970318,
0.0061701564118266106,
0.004159901756793261,
0.014350874349474907,
-0.009626568295061588,
-0.004805580247193575,
-0.009758342057466507,
-0.009583049453794956,
-0.0024934939574450254,
-0.009277226403355598,
-0.002799359615892172,
-0.006262897048145533,
-0.005210413131862879,
-0.0033617503941059113,
-0.0029098570812493563,
-0.0008994704112410545,
0.008897243067622185,
-0.0005387985147535801,
0.004877212457358837,
0.003283807775005698,
0.003444020403549075,
-0.006226368248462677,
-0.0010931346332654357,
-0.0012829243205487728,
-0.002653460018336773,
-0.0069743562489748,
-0.013675655238330364,
-0.0025898870080709457,
-0.002538414439186454,
0.010572307743132114,
0.0011695899302139878,
0.008551598526537418,
-0.0029447737615555525,
0.00360115640796721,
-0.007352098356932402,
0.004232292529195547,
0.0019102354999631643,
0.00411668885499239,
-0.030834808945655823,
0.000060881000536028296,
-0.0011052859481424093,
-0.010047917254269123,
0.006431256886571646,
-0.0016516151372343302,
-0.002042357809841633,
-0.003346849698573351,
-0.006032524164766073,
0.007738862186670303,
-0.006694530136883259,
0.002328908769413829,
-0.002482349518686533,
-0.008377359248697758,
-0.002846358111128211,
-0.007852360606193542,
0.002615035977214575,
0.005693303886801004,
-0.0014059286331757903,
-0.003986571449786425,
-0.002893988974392414,
0.004201220814138651,
0.0030549585353583097,
0.0029464338440448046,
-0.019836023449897766,
-0.0068125114776194096,
-0.0004926135879941285,
-0.00015458191046491265,
-0.004931350704282522,
-0.004035589285194874,
0.006905409507453442,
-0.008727560751140118,
0.006369227543473244,
0.0010139303049072623,
-0.0025045520160347223,
-0.012374382466077805,
0.0003393692022655159,
-0.009924483485519886,
-0.006924337707459927,
0.0013865155633538961,
-0.004599995911121368,
-0.004873703699558973,
-0.001333107938989997,
-0.00030071978108026087,
0.006425762083381414,
-0.0031956741586327553,
0.0033196189906448126,
0.010233499109745026,
-0.0034940356854349375,
-0.007474116515368223,
0.005492199212312698,
0.005676987115293741,
0.000448376260465011,
-0.0018613343127071857,
0.003666657954454422,
0.00765795074403286,
0.008061530999839306,
0.002383219776675105,
0.00544476043432951,
0.0009681294905021787,
0.006131246220320463,
-0.0019224246498197317,
0.0013999294023960829,
-0.004421502351760864,
-0.0011388389393687248,
-0.002543017966672778,
-0.0007517990889027715,
-0.003208259819075465,
-0.0025004283525049686,
-0.012193805538117886,
-0.007194355595856905,
-0.003529887879267335,
-0.0009817348327487707,
0.0028231132309883833,
-0.004870515316724777,
-0.0015284826513379812,
0.0018649186240509152,
0.008894970640540123,
0.0006349356262944639,
-0.002914666198194027,
0.0010115059558302164,
0.004879047628492117,
-0.005212391261011362,
0.01489837933331728,
-0.011253401637077332,
0.006372362375259399,
0.0009278427460230887,
-0.01776009239256382,
0.0063299136236310005,
0.0083191879093647,
-0.01052878238260746,
0.002237434033304453,
0.004532078746706247,
0.001878006150946021,
-0.0017775302985683084,
-0.0033114193938672543,
-0.002729593776166439,
-0.01683364063501358,
0.00039922146243043244,
0.01991010084748268,
-0.001067614066414535,
0.007925222627818584,
0.009870722889900208,
-0.0011615259572863579,
0.003337353467941284,
0.005294584669172764,
0.0006012679077684879,
0.011626399122178555,
-0.008105958811938763,
-0.0003911500971298665,
0.0028092158026993275,
-0.005054445471614599,
0.0010969917057082057,
0.006929013878107071,
0.0070550586096942425,
-0.0024815264623612165,
0.0035744691267609596,
-0.007423286326229572,
-0.005901461001485586,
-0.016433842480182648,
-0.0025373888202011585,
0.006826561875641346,
-0.005488252732902765,
0.006154129281640053,
-0.012363743968307972,
0.004908631555736065,
0.008048173040151596,
0.0037780834827572107,
-0.0007820850005373359,
0.0011908719316124916,
0.0063437060452997684,
0.013233696110546589,
-0.005541506689041853,
0.0006767602753825486,
0.0034206558484584093,
-0.0011671424144878983,
-0.00029074770282022655,
0.008519799448549747,
-0.007037532981485128,
-0.007314920891076326,
0.001879880204796791,
0.0037978768814355135,
0.000009446254807699006,
-0.003158051986247301,
-0.008711733855307102,
-0.0037093113642185926,
0.0030085088219493628,
-0.006905002985149622,
0.0030796644277870655,
0.0012063938193023205,
0.004537881352007389,
-0.006133068818598986,
-0.001256953808479011,
-0.0035882173106074333,
-0.012800002470612526,
0.009952912107110023,
-0.003789361799135804,
0.0020201292354613543,
0.013609823770821095,
0.004904808476567268,
-0.01184860896319151,
0.004173733294010162,
0.011180752888321877,
-0.003096215659752488,
0.0057709235697984695,
0.004242976661771536,
-0.006033684127032757,
-0.020197425037622452,
-0.0033389900345355272,
-0.012560849077999592,
0.004569204058498144,
-0.002653236733749509,
0.00458080880343914,
-0.0075294580310583115,
0.0052472492679953575,
0.008281447924673557,
-0.013388081453740597,
-0.006829926744103432,
-0.00888905581086874,
0.009207730181515217,
0.0014031886821612716,
0.0008229974191635847,
-0.004217872396111488,
-0.002026643604040146,
-0.002640909282490611,
-0.004284392576664686,
-0.0014629411743953824,
0.00602323655039072,
0.0017905564745888114,
-0.0013429491082206368,
0.0025202645920217037,
-0.004491549916565418,
0.00018320654635317624,
-0.00005468489689519629,
-0.00985710322856903,
0.002100692130625248,
0.002586762188002467,
-0.0027425300795584917,
-0.001914931577630341,
0.0011445694835856557,
-0.0014166133478283882,
-0.006769611965864897,
-0.011651654727756977,
-0.0020081582479178905,
-0.0034382373560220003,
-0.0018005723832175136,
-0.01125517301261425,
-0.0013902512146160007,
-0.006146425846964121,
0.0069673992693424225,
-0.006996017415076494,
0.008180868811905384,
0.006136967334896326,
-0.005653448402881622,
0.006881504785269499,
-0.0017440670635551214,
0.004794843029230833,
0.002912311116233468,
0.003883533412590623,
0.0016052289865911007,
-0.006016424857079983,
-0.011348889209330082,
0.011981073766946793,
-0.008134784176945686,
0.0015321716200560331,
0.011920969933271408,
0.0072760870680212975,
0.008580991066992283,
-0.00039646640652790666,
0.0003647679404821247,
0.0013138937065377831,
0.0077506122179329395,
-0.012650575488805771,
0.0038072497118264437,
-0.0032334113493561745,
0.00035955000203102827,
0.0039795441552996635,
-0.003250619862228632,
0.0006929605733603239,
0.009588823653757572,
0.000017906040739035234,
-0.006729061249643564,
-0.0020364599768072367,
0.0027068040799349546,
0.004881319124251604,
-0.012707951478660107,
0.0020181217696517706,
-0.0037453605327755213,
-0.00520664919167757,
-0.001288791885599494,
-0.001658584806136787,
0.00022777370759285986,
0.002098463010042906,
-0.0014561759307980537,
0.00669288681820035,
0.0008538460824638605,
-0.0037155060563236475,
0.014280369505286217,
-0.0038309721276164055,
-0.005117826163768768,
0.001834565307945013,
0.002505852608010173,
-0.0032868050038814545,
-0.006582982838153839,
-0.002223542658612132,
0.0031071475241333246,
0.007325414102524519,
-0.002817784668877721,
-0.0040377117693424225,
0.0006543585914187133,
0.0019192477921023965,
-0.012347170151770115,
0.0032092861365526915,
0.014456690289080143,
-0.005383254494518042,
0.0075746625661849976,
-0.0007287146872840822,
-0.0071384790353477,
-0.011546730063855648,
0.05165215954184532,
-0.002545880153775215,
0.00326121156103909,
0.003699997905641794,
-0.005991007667034864,
-0.00024335415218956769,
-0.0023968624882400036,
0.008499030023813248,
-0.006459727417677641,
-0.007109548896551132,
0.009020605124533176,
-0.004857304506003857,
0.004202669952064753,
0.002302835462614894,
-0.00020304994541220367,
0.016726287081837654,
-0.0019257677486166358,
-0.016837868839502335,
-0.017221465706825256,
0.009114684537053108,
-0.003287283470854163,
-0.006024068221449852,
0.009022082202136517,
-0.0017945831641554832,
-0.004725909326225519,
0.0015883368905633688,
0.0054644993506371975,
0.000951705442275852,
0.0018154638819396496,
-0.0035970776807516813,
-0.002759585389867425,
-0.0006467339699156582,
0.0019676126539707184,
0.005045435391366482,
0.007707411888986826,
-0.0021971832029521465,
0.0038260603323578835,
-0.0014903729315847158,
-0.0017844944959506392,
-0.004622482694685459,
0.002380731049925089,
0.007605409249663353,
-0.002586503978818655,
-0.0023757305461913347,
0.004931771196424961,
0.0060942936688661575,
0.0027804868295788765,
0.01050911657512188,
0.0007272883667610586,
-0.007063459604978561,
0.00817226804792881,
0.006886983755975962,
0.0010788837680593133,
0.009367037564516068,
-0.001862470293417573,
0.0063560432754457,
0.002166558289900422,
-0.008099377155303955,
-0.0163316261023283,
-0.00387582927942276,
0.004920427221804857,
0.008192863315343857,
-0.0004178625240456313,
0.002076375298202038,
-0.002148817991837859,
-0.0014255743008106947,
-0.006808622274547815,
-0.009113679639995098,
-0.0034368964843451977,
0.0007142003159970045,
0.00452004186809063,
0.06801677495241165,
-0.005831822752952576,
-0.00009753504855325446,
-0.00792025402188301,
-0.0011557784164324403,
-0.0032733604311943054,
-0.0012159707257524133,
-0.000989214633591473,
-0.003908834885805845,
0.0032738433219492435,
0.0010870394762605429,
-0.008003813214600086,
-0.012988385744392872,
-0.0004562004760373384,
-0.0001248218322871253,
-0.0026719949673861265,
0.005211630370467901,
0.006460228469222784,
-0.010587393306195736,
0.00020635532564483583,
-0.012422382831573486,
0.0004445853119250387,
-0.0034924140200018883,
-0.010295388288795948,
-0.006496008951216936,
-0.0030273846350610256,
0.006615225691348314,
0.003025646088644862,
0.005448592361062765,
-0.0026590870693325996,
0.004164927639067173,
-0.0035241402219980955,
0.00025681211263872683,
-0.0053887199610471725,
0.00042776044574566185,
-0.006522889249026775,
0.008033896796405315,
0.0025343834422528744,
-0.009694572538137436,
-0.004300091415643692,
-0.0007721174042671919,
0.0003960236790589988,
-0.004895620979368687,
0.002891196170821786,
-0.0010377566795796156,
0.0044365739449858665,
-0.0033817733637988567,
0.00036474171793088317,
-0.006820444017648697,
0.0013670644257217646,
-0.013337998650968075,
0.006889975629746914,
-0.16829857230186462,
0.008473561145365238,
0.0028269526083022356,
-0.005424853879958391,
-0.005396467633545399,
-0.014666212722659111,
-0.004783087410032749,
0.004495162516832352,
0.011067318730056286,
0.0016486503882333636,
-0.0006238756468519568,
-0.001529409782961011,
0.00632596155628562,
0.004520321264863014,
-0.00031931771081872284,
-0.005948533304035664,
0.004054592456668615,
-0.004153387155383825,
0.0007929822313599288,
0.003119384404271841,
0.0030082182493060827,
0.011840605176985264,
-0.000012308421901252586,
0.002258900087326765,
-0.002837108913809061,
-0.004660194274038076,
0.006003139074891806,
-0.0021286222618073225,
0.007002339698374271,
-0.01318351924419403,
-0.002832819474861026,
-0.005488829221576452,
-0.004925319459289312,
0.001722821849398315,
0.006487284321337938,
-0.00047849654220044613,
0.009303953498601913,
0.003176921047270298,
-0.00842323713004589,
0.007537551689893007,
-0.007533458527177572,
0.02531551942229271,
0.004320718348026276,
0.005583649501204491,
0.0015724608674645424,
-0.006534047424793243,
-0.005795945879071951,
0.007547935005277395,
0.0018073217943310738,
0.011087790131568909,
-0.015489723533391953,
0.0003134376311209053,
0.003171960823237896,
0.018493056297302246,
-0.005040314048528671,
-0.011868143454194069,
-0.006168772932142019,
-0.002168735023587942,
-0.0004749337094835937,
0.007727719843387604,
0.010978220030665398,
-0.002011540113016963,
0.006295086350291967,
-0.002668531611561775,
-0.02188744954764843,
0.0037211214657872915,
-0.004974466282874346,
-0.005603312980383635,
0.0028079913463443518,
0.0066063846461474895,
0.008642638102173805,
-0.0010078769410029054,
0.0005328675615601242,
0.00016120665532071143,
0.005039468873292208,
0.000438253628090024,
0.006509259343147278,
-0.0017678019357845187,
0.003996211104094982,
-0.010108872316777706,
0.0051629492081701756,
-0.010372739285230637,
-0.0020754942670464516,
-0.00003746817310457118,
-0.004187468905001879,
0.0123588927090168,
0.004075946286320686,
-0.0028655522037297487,
-0.0026674445252865553,
-0.009076672606170177,
-0.002136325230821967,
0.0028387249913066626,
0.0003153322031721473,
-0.009506212547421455,
0.0013636135263368487,
0.002739489544183016,
0.006094726268202066,
0.0049490537494421005,
-0.009343378245830536,
0.0062117124907672405,
0.0050451625138521194,
-0.004916525445878506,
0.002346309134736657,
-0.005945080425590277,
0.0037208807189017534,
0.0047348421066999435,
-0.005773566663265228,
-0.0049111321568489075,
0.000752726336941123,
-0.0077413590624928474,
-0.004447102081030607,
0.008803175762295723,
-0.008535505272448063,
-0.008975622244179249,
-0.004042432643473148,
-0.012453301809728146,
0.0008046836592257023
] |
8a8d44634b296be16e3e3fe11b62e194bcce203d | 14,955 | py | Python | test/test_pipeline.py | ParikhKadam/haystack | 8a57f6b16af0bdd41dc02bf1200e0adbdf1da39b | [
"Apache-2.0"
] | 1 | 2021-08-04T09:06:43.000Z | 2021-08-04T09:06:43.000Z | test/test_pipeline.py | jacksbox/haystack | 65f1da00cc4b6757752dafb8bf756531fad46dd0 | [
"Apache-2.0"
] | null | null | null | test/test_pipeline.py | jacksbox/haystack | 65f1da00cc4b6757752dafb8bf756531fad46dd0 | [
"Apache-2.0"
] | null | null | null | from pathlib import Path
import pytest
from haystack.document_store.elasticsearch import ElasticsearchDocumentStore
from haystack.pipeline import TranslationWrapperPipeline, JoinDocuments, ExtractiveQAPipeline, Pipeline, FAQPipeline, \
DocumentSearchPipeline, RootNode
from haystack.retriever.dense import DensePassageRetriever
from haystack.retriever.sparse import ElasticsearchRetriever
@pytest.mark.parametrize("document_store_with_docs", ["elasticsearch"], indirect=True)
def test_load_yaml(document_store_with_docs):
# test correct load of indexing pipeline from yaml
pipeline = Pipeline.load_from_yaml(Path("samples/pipeline/test_pipeline.yaml"),
pipeline_name="indexing_pipeline")
pipeline.run(file_path=Path("samples/pdf/sample_pdf_1.pdf"), top_k_retriever=10, top_k_reader=3)
# test correct load of query pipeline from yaml
pipeline = Pipeline.load_from_yaml(Path("samples/pipeline/test_pipeline.yaml"), pipeline_name="query_pipeline")
prediction = pipeline.run(query="Who made the PDF specification?", top_k_retriever=10, top_k_reader=3)
assert prediction["query"] == "Who made the PDF specification?"
assert prediction["answers"][0]["answer"] == "Adobe Systems"
# test invalid pipeline name
with pytest.raises(Exception):
Pipeline.load_from_yaml(path=Path("samples/pipeline/test_pipeline.yaml"), pipeline_name="invalid")
@pytest.mark.slow
@pytest.mark.elasticsearch
@pytest.mark.parametrize(
"retriever_with_docs, document_store_with_docs", [("elasticsearch", "elasticsearch")], indirect=True
)
def test_graph_creation(reader, retriever_with_docs, document_store_with_docs):
pipeline = Pipeline()
pipeline.add_node(name="ES", component=retriever_with_docs, inputs=["Query"])
with pytest.raises(AssertionError):
pipeline.add_node(name="Reader", component=retriever_with_docs, inputs=["ES.output_2"])
with pytest.raises(AssertionError):
pipeline.add_node(name="Reader", component=retriever_with_docs, inputs=["ES.wrong_edge_label"])
with pytest.raises(Exception):
pipeline.add_node(name="Reader", component=retriever_with_docs, inputs=["InvalidNode"])
with pytest.raises(Exception):
pipeline = Pipeline()
pipeline.add_node(name="ES", component=retriever_with_docs, inputs=["InvalidNode"])
@pytest.mark.slow
@pytest.mark.elasticsearch
@pytest.mark.parametrize("retriever_with_docs", ["tfidf"], indirect=True)
def test_extractive_qa_answers(reader, retriever_with_docs):
pipeline = ExtractiveQAPipeline(reader=reader, retriever=retriever_with_docs)
prediction = pipeline.run(query="Who lives in Berlin?", top_k_retriever=10, top_k_reader=3)
assert prediction is not None
assert prediction["query"] == "Who lives in Berlin?"
assert prediction["answers"][0]["answer"] == "Carla"
assert prediction["answers"][0]["probability"] <= 1
assert prediction["answers"][0]["probability"] >= 0
assert prediction["answers"][0]["meta"]["meta_field"] == "test1"
assert prediction["answers"][0]["context"] == "My name is Carla and I live in Berlin"
assert len(prediction["answers"]) == 3
@pytest.mark.elasticsearch
@pytest.mark.parametrize("retriever_with_docs", ["tfidf"], indirect=True)
def test_extractive_qa_offsets(reader, retriever_with_docs):
pipeline = ExtractiveQAPipeline(reader=reader, retriever=retriever_with_docs)
prediction = pipeline.run(query="Who lives in Berlin?", top_k_retriever=10, top_k_reader=5)
assert prediction["answers"][0]["offset_start"] == 11
assert prediction["answers"][0]["offset_end"] == 16
start = prediction["answers"][0]["offset_start"]
end = prediction["answers"][0]["offset_end"]
assert prediction["answers"][0]["context"][start:end] == prediction["answers"][0]["answer"]
@pytest.mark.slow
@pytest.mark.elasticsearch
@pytest.mark.parametrize("retriever_with_docs", ["tfidf"], indirect=True)
def test_extractive_qa_answers_single_result(reader, retriever_with_docs):
pipeline = ExtractiveQAPipeline(reader=reader, retriever=retriever_with_docs)
query = "testing finder"
prediction = pipeline.run(query=query, top_k_retriever=1, top_k_reader=1)
assert prediction is not None
assert len(prediction["answers"]) == 1
@pytest.mark.elasticsearch
@pytest.mark.parametrize(
"retriever,document_store",
[("embedding", "memory"), ("embedding", "faiss"), ("embedding", "milvus"), ("embedding", "elasticsearch")],
indirect=True,
)
def test_faq_pipeline(retriever, document_store):
documents = [
{"text": "How to test module-1?", 'meta': {"source": "wiki1", "answer": "Using tests for module-1"}},
{"text": "How to test module-2?", 'meta': {"source": "wiki2", "answer": "Using tests for module-2"}},
{"text": "How to test module-3?", 'meta': {"source": "wiki3", "answer": "Using tests for module-3"}},
{"text": "How to test module-4?", 'meta': {"source": "wiki4", "answer": "Using tests for module-4"}},
{"text": "How to test module-5?", 'meta': {"source": "wiki5", "answer": "Using tests for module-5"}},
]
document_store.write_documents(documents)
document_store.update_embeddings(retriever)
pipeline = FAQPipeline(retriever=retriever)
output = pipeline.run(query="How to test this?", top_k_retriever=3)
assert len(output["answers"]) == 3
assert output["answers"][0]["query"].startswith("How to")
assert output["answers"][0]["answer"].startswith("Using tests")
if isinstance(document_store, ElasticsearchDocumentStore):
output = pipeline.run(query="How to test this?", filters={"source": ["wiki2"]}, top_k_retriever=5)
assert len(output["answers"]) == 1
@pytest.mark.elasticsearch
@pytest.mark.parametrize(
"retriever,document_store",
[("embedding", "memory"), ("embedding", "faiss"), ("embedding", "milvus"), ("embedding", "elasticsearch")],
indirect=True,
)
def test_document_search_pipeline(retriever, document_store):
documents = [
{"text": "Sample text for document-1", 'meta': {"source": "wiki1"}},
{"text": "Sample text for document-2", 'meta': {"source": "wiki2"}},
{"text": "Sample text for document-3", 'meta': {"source": "wiki3"}},
{"text": "Sample text for document-4", 'meta': {"source": "wiki4"}},
{"text": "Sample text for document-5", 'meta': {"source": "wiki5"}},
]
document_store.write_documents(documents)
document_store.update_embeddings(retriever)
pipeline = DocumentSearchPipeline(retriever=retriever)
output = pipeline.run(query="How to test this?", top_k_retriever=4)
assert len(output.get('documents', [])) == 4
if isinstance(document_store, ElasticsearchDocumentStore):
output = pipeline.run(query="How to test this?", filters={"source": ["wiki2"]}, top_k_retriever=5)
assert len(output["documents"]) == 1
@pytest.mark.slow
@pytest.mark.elasticsearch
@pytest.mark.parametrize("retriever_with_docs", ["tfidf"], indirect=True)
def test_extractive_qa_answers_with_translator(reader, retriever_with_docs, en_to_de_translator, de_to_en_translator):
base_pipeline = ExtractiveQAPipeline(reader=reader, retriever=retriever_with_docs)
pipeline = TranslationWrapperPipeline(
input_translator=de_to_en_translator,
output_translator=en_to_de_translator,
pipeline=base_pipeline
)
prediction = pipeline.run(query="Wer lebt in Berlin?", top_k_retriever=10, top_k_reader=3)
assert prediction is not None
assert prediction["query"] == "Wer lebt in Berlin?"
assert "Carla" in prediction["answers"][0]["answer"]
assert prediction["answers"][0]["probability"] <= 1
assert prediction["answers"][0]["probability"] >= 0
assert prediction["answers"][0]["meta"]["meta_field"] == "test1"
assert prediction["answers"][0]["context"] == "My name is Carla and I live in Berlin"
@pytest.mark.parametrize("document_store_with_docs", ["elasticsearch"], indirect=True)
@pytest.mark.parametrize("reader", ["farm"], indirect=True)
def test_join_document_pipeline(document_store_with_docs, reader):
es = ElasticsearchRetriever(document_store=document_store_with_docs)
dpr = DensePassageRetriever(
document_store=document_store_with_docs,
query_embedding_model="facebook/dpr-question_encoder-single-nq-base",
passage_embedding_model="facebook/dpr-ctx_encoder-single-nq-base",
use_gpu=False,
)
document_store_with_docs.update_embeddings(dpr)
query = "Where does Carla lives?"
# test merge without weights
join_node = JoinDocuments(join_mode="merge")
p = Pipeline()
p.add_node(component=es, name="R1", inputs=["Query"])
p.add_node(component=dpr, name="R2", inputs=["Query"])
p.add_node(component=join_node, name="Join", inputs=["R1", "R2"])
results = p.run(query=query)
assert len(results["documents"]) == 3
# test merge with weights
join_node = JoinDocuments(join_mode="merge", weights=[1000, 1], top_k_join=2)
p = Pipeline()
p.add_node(component=es, name="R1", inputs=["Query"])
p.add_node(component=dpr, name="R2", inputs=["Query"])
p.add_node(component=join_node, name="Join", inputs=["R1", "R2"])
results = p.run(query=query)
assert results["documents"][0].score > 1000
assert len(results["documents"]) == 2
# test concatenate
join_node = JoinDocuments(join_mode="concatenate")
p = Pipeline()
p.add_node(component=es, name="R1", inputs=["Query"])
p.add_node(component=dpr, name="R2", inputs=["Query"])
p.add_node(component=join_node, name="Join", inputs=["R1", "R2"])
results = p.run(query=query)
assert len(results["documents"]) == 3
# test join_node with reader
join_node = JoinDocuments()
p = Pipeline()
p.add_node(component=es, name="R1", inputs=["Query"])
p.add_node(component=dpr, name="R2", inputs=["Query"])
p.add_node(component=join_node, name="Join", inputs=["R1", "R2"])
p.add_node(component=reader, name="Reader", inputs=["Join"])
results = p.run(query=query)
assert results["answers"][0]["answer"] == "Berlin"
def test_parallel_paths_in_pipeline_graph():
class A(RootNode):
def run(self, **kwargs):
kwargs["output"] = "A"
return kwargs, "output_1"
class B(RootNode):
def run(self, **kwargs):
kwargs["output"] += "B"
return kwargs, "output_1"
class C(RootNode):
def run(self, **kwargs):
kwargs["output"] += "C"
return kwargs, "output_1"
class D(RootNode):
def run(self, **kwargs):
kwargs["output"] += "D"
return kwargs, "output_1"
class E(RootNode):
def run(self, **kwargs):
kwargs["output"] += "E"
return kwargs, "output_1"
class JoinNode(RootNode):
def run(self, **kwargs):
kwargs["output"] = kwargs["inputs"][0]["output"] + kwargs["inputs"][1]["output"]
return kwargs, "output_1"
pipeline = Pipeline()
pipeline.add_node(name="A", component=A(), inputs=["Query"])
pipeline.add_node(name="B", component=B(), inputs=["A"])
pipeline.add_node(name="C", component=C(), inputs=["B"])
pipeline.add_node(name="E", component=E(), inputs=["C"])
pipeline.add_node(name="D", component=D(), inputs=["B"])
pipeline.add_node(name="F", component=JoinNode(), inputs=["D", "E"])
output = pipeline.run(query="test")
assert output["output"] == "ABDABCE"
pipeline = Pipeline()
pipeline.add_node(name="A", component=A(), inputs=["Query"])
pipeline.add_node(name="B", component=B(), inputs=["A"])
pipeline.add_node(name="C", component=C(), inputs=["B"])
pipeline.add_node(name="D", component=D(), inputs=["B"])
pipeline.add_node(name="E", component=JoinNode(), inputs=["C", "D"])
output = pipeline.run(query="test")
assert output["output"] == "ABCABD"
def test_parallel_paths_in_pipeline_graph_with_branching():
class AWithOutput1(RootNode):
outgoing_edges = 2
def run(self, **kwargs):
kwargs["output"] = "A"
return kwargs, "output_1"
class AWithOutput2(RootNode):
outgoing_edges = 2
def run(self, **kwargs):
kwargs["output"] = "A"
return kwargs, "output_2"
class AWithOutputAll(RootNode):
outgoing_edges = 2
def run(self, **kwargs):
kwargs["output"] = "A"
return kwargs, "output_all"
class B(RootNode):
def run(self, **kwargs):
kwargs["output"] += "B"
return kwargs, "output_1"
class C(RootNode):
def run(self, **kwargs):
kwargs["output"] += "C"
return kwargs, "output_1"
class D(RootNode):
def run(self, **kwargs):
kwargs["output"] += "D"
return kwargs, "output_1"
class E(RootNode):
def run(self, **kwargs):
kwargs["output"] += "E"
return kwargs, "output_1"
class JoinNode(RootNode):
def run(self, **kwargs):
if kwargs.get("inputs"):
kwargs["output"] = ""
for input_dict in kwargs["inputs"]:
kwargs["output"] += (input_dict["output"])
return kwargs, "output_1"
pipeline = Pipeline()
pipeline.add_node(name="A", component=AWithOutput1(), inputs=["Query"])
pipeline.add_node(name="B", component=B(), inputs=["A.output_1"])
pipeline.add_node(name="C", component=C(), inputs=["A.output_2"])
pipeline.add_node(name="D", component=E(), inputs=["B"])
pipeline.add_node(name="E", component=D(), inputs=["B"])
pipeline.add_node(name="F", component=JoinNode(), inputs=["D", "E", "C"])
output = pipeline.run(query="test")
assert output["output"] == "ABEABD"
pipeline = Pipeline()
pipeline.add_node(name="A", component=AWithOutput2(), inputs=["Query"])
pipeline.add_node(name="B", component=B(), inputs=["A.output_1"])
pipeline.add_node(name="C", component=C(), inputs=["A.output_2"])
pipeline.add_node(name="D", component=E(), inputs=["B"])
pipeline.add_node(name="E", component=D(), inputs=["B"])
pipeline.add_node(name="F", component=JoinNode(), inputs=["D", "E", "C"])
output = pipeline.run(query="test")
assert output["output"] == "AC"
pipeline = Pipeline()
pipeline.add_node(name="A", component=AWithOutputAll(), inputs=["Query"])
pipeline.add_node(name="B", component=B(), inputs=["A.output_1"])
pipeline.add_node(name="C", component=C(), inputs=["A.output_2"])
pipeline.add_node(name="D", component=E(), inputs=["B"])
pipeline.add_node(name="E", component=D(), inputs=["B"])
pipeline.add_node(name="F", component=JoinNode(), inputs=["D", "E", "C"])
output = pipeline.run(query="test")
assert output["output"] == "ACABEABD"
| 42.126761 | 119 | 0.664527 | 1 | 1.9746 | [
0.0022696631494909525,
-0.0026186215691268444,
0.02414689026772976,
0.023046016693115234,
-0.024591317400336266,
0.012763562612235546,
-0.03105100616812706,
-0.0038907439447939396,
-0.039761245250701904,
-0.012019810266792774,
0.012521863915026188,
-0.028007926419377327,
0.05133158713579178,
-0.038431648164987564,
-0.016962049528956413,
-0.0061695692129433155,
0.042316630482673645,
0.04601138085126877,
-0.028872892260551453,
0.01257607527077198,
-0.025523453950881958,
-0.018321724608540535,
0.009968433529138565,
-0.01878526620566845,
-0.00756358215585351,
-0.03783343732357025,
0.01778005063533783,
-0.007851667702198029,
0.017203032970428467,
-0.034315191209316254,
0.010817664675414562,
-0.008962671272456646,
-0.013249695301055908,
0.013490967452526093,
-0.00681746331974864,
-0.009455873630940914,
0.005048006772994995,
-0.04353957623243332,
0.0038394706789404154,
-0.0033972470555454493,
-0.02667214535176754,
-0.01122890692204237,
0.022687312215566635,
0.022364407777786255,
0.005620299372822046,
-0.001846284605562687,
0.007099158130586147,
0.00696181133389473,
-0.008979559876024723,
0.006782132666558027,
-0.01270388439297676,
0.06031274050474167,
0.01873459853231907,
0.005688521079719067,
-0.015280252322554588,
-0.032227158546447754,
-0.011927234008908272,
0.0034669809974730015,
-0.01309162750840187,
-0.0020664669573307037,
-0.030483199283480644,
-0.00185226125176996,
0.005339779891073704,
0.04033311828970909,
0.025978934019804,
-0.007109545171260834,
-0.010180633515119553,
0.012064103968441486,
-0.019719719886779785,
0.02684350311756134,
-0.016438964754343033,
-0.0022326805628836155,
0.001531112939119339,
0.033403944224119186,
-0.015273806639015675,
-0.04224199429154396,
-0.047508589923381805,
0.004299817606806755,
-0.010757578536868095,
0.04145600274205208,
0.009534349665045738,
0.02428365685045719,
-0.012444778345525265,
0.03167944401502609,
-0.016456076875329018,
0.01338163111358881,
0.05406106635928154,
0.02214193530380726,
0.07080104947090149,
0.0433875173330307,
-0.00611594645306468,
0.005352263804525137,
-0.015136059373617172,
0.012729421257972717,
-0.03872549161314964,
-0.04897209629416466,
-0.038355451077222824,
-0.011434558779001236,
0.02971336618065834,
-0.0013695104280486703,
0.030796948820352554,
0.042484741657972336,
0.005828227382153273,
-0.041408948600292206,
0.004000072367489338,
0.04777685925364494,
-0.04240542650222778,
-0.013936017639935017,
0.035634156316518784,
0.01663857325911522,
-0.01145460456609726,
-0.009023780934512615,
0.030408669263124466,
-0.03490522503852844,
-0.0009048801730386913,
-0.04855989292263985,
-0.01920047588646412,
0.03171655535697937,
-0.013896115124225616,
-0.02460598200559616,
0.0005092336796224117,
0.02056453377008438,
0.04057999327778816,
0.044800881296396255,
-0.022639796137809753,
0.07613421976566315,
0.0364166684448719,
0.026865050196647644,
0.03008737973868847,
0.00038076480268500745,
0.002635854296386242,
0.014136523939669132,
0.026872767135500908,
-0.013368727639317513,
0.035426054149866104,
0.005715318024158478,
-0.004929619841277599,
0.027542121708393097,
-0.0631895586848259,
0.00041763423359952867,
0.009469638578593731,
-0.0033975804690271616,
-0.007479852065443993,
-0.021107705309987068,
-0.012611273676156998,
0.003988157492130995,
-0.0023526467848569155,
-0.033112917095422745,
0.009203477762639523,
-0.011302545666694641,
0.02838069573044777,
-0.008068704046308994,
0.014178036712110043,
0.011162311770021915,
-0.034959569573402405,
-0.005164734553545713,
-0.00726832402870059,
-0.01261735986918211,
-0.004121866542845964,
-0.009889245964586735,
-0.04361458495259285,
-0.012364189140498638,
-0.006836807820945978,
0.03942514955997467,
-0.0030684915836900473,
0.010196938179433346,
-0.011187415570020676,
0.011550297029316425,
-0.030856287106871605,
-0.00030617875745519996,
-0.005659680347889662,
-0.02452034503221512,
-0.000534495513420552,
-0.006197923328727484,
-0.02648540399968624,
-0.041089482605457306,
0.01609601080417633,
0.026735490188002586,
0.02277154102921486,
0.013417745009064674,
-0.022004300728440285,
-0.022880136966705322,
0.03131496161222458,
0.02930549532175064,
-0.018655695021152496,
-0.012466630898416042,
-0.009607327170670033,
-0.015473103150725365,
0.0003052848041988909,
-0.014318658038973808,
-0.0229258444160223,
0.0461246520280838,
-0.001499139005318284,
-0.02174115553498268,
0.062044598162174225,
-0.014914929866790771,
0.008791347034275532,
-0.007291038054972887,
-0.01345832273364067,
0.025188162922859192,
0.011451147496700287,
-0.001989123411476612,
-0.037939202040433884,
-0.003301468677818775,
0.024650955572724342,
-0.009315429255366325,
-0.7393463253974915,
-0.005841982550919056,
0.032906223088502884,
-0.01840358041226864,
-0.013110094703733921,
0.06257900595664978,
-0.01991622895002365,
0.00480738515034318,
-0.036665380001068115,
-0.028322873637080193,
-0.012160047888755798,
-0.02437085658311844,
-0.011318950913846493,
-0.0017490884056314826,
0.00886443816125393,
-0.017122341319918633,
0.002576346741989255,
0.02871658094227314,
0.016635730862617493,
0.013376460410654545,
0.022185662761330605,
0.014428023248910904,
-0.028849197551608086,
-0.00415429100394249,
0.009166174568235874,
0.018748372793197632,
-0.023808378726243973,
0.04416476562619209,
-0.004183794837445021,
0.006287999916821718,
0.04307098686695099,
-0.02725818380713463,
-0.0025270518381148577,
0.004361186176538467,
0.032523974776268005,
-0.03073669597506523,
0.0060554444789886475,
-0.0020741804037243128,
0.035458434373140335,
0.018937330693006516,
0.009012606926262379,
-0.0081603629514575,
0.0074074771255254745,
-0.038790084421634674,
-0.04527182877063751,
-0.041541166603565216,
-0.01030603889375925,
0.011432713828980923,
-0.009507393464446068,
0.02317131869494915,
-0.021529395133256912,
0.039218924939632416,
0.021086720749735832,
-0.04378161579370499,
-0.018415529280900955,
-0.010924638248980045,
-0.010460903868079185,
-0.005244155880063772,
-0.01082928292453289,
-0.024590030312538147,
0.01154793705791235,
-0.008597447536885738,
-0.004923186264932156,
0.005197703838348389,
0.02868235856294632,
0.04107028245925903,
-0.023884931579232216,
-0.040939558297395706,
-0.011519177816808224,
0.03553474321961403,
-0.03347663953900337,
-0.014257833361625671,
0.00562808383256197,
0.05741569399833679,
-0.002727746730670333,
-0.003987910225987434,
-0.0005361859803088009,
-0.050167642533779144,
-0.030523568391799927,
-0.04738210514187813,
-0.006899071857333183,
0.013591946102678776,
-0.012655368074774742,
-0.013442407362163067,
-0.016063956543803215,
-0.04043043404817581,
-0.014117339625954628,
0.012617124244570732,
-0.003906707279384136,
0.030380573123693466,
0.020439637824892998,
0.02351059392094612,
-0.03412345424294472,
0.000745725876186043,
0.0316757895052433,
-0.007657263427972794,
0.0004982785321772099,
0.02021137624979019,
0.02545129880309105,
0.02595168724656105,
-0.006703338120132685,
0.005488173104822636,
-0.03158947825431824,
0.014981932006776333,
-0.000671685382258147,
-0.0207681767642498,
-0.05316265672445297,
0.016466470435261726,
0.04551583528518677,
-0.041402705013751984,
-0.011929820291697979,
-0.010227744467556477,
-0.022697074338793755,
0.012389039620757103,
-0.010012531653046608,
-0.020818809047341347,
-0.01884732022881508,
-0.02125929854810238,
0.02080851048231125,
-0.005086487624794245,
-0.009214960969984531,
0.020050177350640297,
-0.009166163392364979,
0.01537195686250925,
-0.013829306699335575,
-0.005410040263086557,
-0.0018181026680395007,
-0.005720039829611778,
-0.014910146594047546,
-0.012297121807932854,
-0.004926658701151609,
0.014946705661714077,
-0.0004130036977585405,
0.007909865118563175,
0.023841720074415207,
-0.006628015544265509,
-0.025122888386249542,
-0.02942265383899212,
0.003296167589724064,
0.006843494717031717,
-0.00015696603804826736,
0.01145537942647934,
-0.006805762182921171,
-0.03564829379320145,
0.03521289303898811,
0.005156019236892462,
0.017581205815076828,
-0.003320442046970129,
0.05177368223667145,
0.023967675864696503,
-0.01794978231191635,
-0.030170971527695656,
-0.001732569420710206,
0.005294385366141796,
-0.036543309688568115,
0.012469845823943615,
-0.004778159316629171,
0.0004402886552270502,
-0.00017161492723971605,
0.04436742141842842,
-0.06767646968364716,
-0.02562280185520649,
-0.045597728341817856,
-0.0031187080312520266,
-0.014066457748413086,
-0.03521376848220825,
0.023017538711428642,
0.01614634320139885,
0.0003375616215635091,
0.00858120433986187,
0.045072466135025024,
-0.04647443816065788,
0.026156291365623474,
-0.01108559686690569,
0.01811692863702774,
0.018924394622445107,
0.0030848770402371883,
-0.011265354230999947,
-0.03537043184041977,
0.0021621044725179672,
0.023164011538028717,
-0.030926046893000603,
-0.034876301884651184,
0.027135087177157402,
0.002495346823707223,
0.019753403961658478,
-0.007843238301575184,
0.010044989176094532,
-0.01114507857710123,
-0.04140975698828697,
0.0037010866217315197,
-0.010814929381012917,
-0.023477181792259216,
0.023756131529808044,
-0.008084438741207123,
0.007133006118237972,
0.0259845107793808,
0.013177131302654743,
0.01859128288924694,
-0.03187912330031395,
-0.0009723903494887054,
-0.009762809611856937,
-0.0009135410655289888,
-0.02735377661883831,
-0.012099986895918846,
0.04669301211833954,
-0.033329419791698456,
-0.003299108939245343,
0.023860901594161987,
-0.0242497269064188,
0.0258977971971035,
0.003969976212829351,
-0.029126277193427086,
-0.00008539963891962543,
-0.03127312660217285,
-0.014061509631574154,
-0.034918393939733505,
0.011154655367136002,
-0.02981879748404026,
-0.01509950589388609,
-0.009228349663317204,
-0.03060056082904339,
0.017935503274202347,
0.027816100046038628,
0.016076907515525818,
-0.012538254261016846,
0.009894734248518944,
0.017182299867272377,
-0.009918819181621075,
-0.020019980147480965,
-0.01775939390063286,
0.006528716068714857,
0.03167280554771423,
-0.00009060006414074451,
-0.03238673880696297,
0.018742209300398827,
-0.010862302966415882,
-0.04264070838689804,
-0.024301864206790924,
-0.024799805134534836,
0.045191094279289246,
-0.0247742161154747,
-0.0072041344828903675,
0.04854945093393326,
0.0279533788561821,
-0.040031641721725464,
0.005371245555579662,
-0.010778674855828285,
0.021063830703496933,
-0.010553143918514252,
-0.014090209268033504,
0.027306528761982918,
-0.005299920216202736,
-0.01420788373798132,
0.016943618655204773,
-0.02072005905210972,
-0.014475290663540363,
-0.009218040853738785,
0.011125128716230392,
0.004795564338564873,
-0.0055741602554917336,
-0.01388892438262701,
-0.014089415781199932,
0.027224257588386536,
-0.040032051503658295,
-0.020445099100470543,
0.02301972545683384,
-0.01834157668054104,
-0.038276612758636475,
0.045041121542453766,
0.0024415652733296156,
-0.03571052476763725,
0.0034432425163686275,
-0.004099731333553791,
0.014871240593492985,
-0.030734730884432793,
-0.00045547232730314136,
-0.016483739018440247,
0.008260256610810757,
-0.015053244307637215,
-0.014981666579842567,
-0.015154914930462837,
0.04040885344147682,
0.021826665848493576,
-0.026423299685120583,
-0.02491678111255169,
-0.044623591005802155,
-0.016931382939219475,
-0.060146983712911606,
-0.015065561048686504,
0.01627952978014946,
-0.007242169231176376,
0.00594236608594656,
0.015635618939995766,
-0.034438930451869965,
0.018922341987490654,
-0.005089354235678911,
0.02030007354915142,
0.0564984455704689,
-0.026005787774920464,
0.04707896709442139,
0.017523271963000298,
-0.0010800609597936273,
0.0227560605853796,
0.033871982246637344,
-0.022630300372838974,
-0.009502542205154896,
-0.016826415434479713,
0.0331011526286602,
0.006095017306506634,
0.04713274538516998,
0.030311468988656998,
0.02462971955537796,
0.015870722010731697,
-0.043485160917043686,
0.029783878475427628,
0.04708733409643173,
-0.004944812506437302,
-0.0014767793472856283,
0.014554227702319622,
-0.04777563735842705,
0.012727930210530758,
-0.00544885965064168,
-0.03135678917169571,
0.0192245002835989,
0.0237314123660326,
-0.03437845781445503,
0.04192764312028885,
-0.017536113038659096,
0.023889750242233276,
0.014838901348412037,
-0.004774011205881834,
0.01803501322865486,
0.009881200268864632,
0.010317466221749783,
-0.008167159743607044,
0.005589167587459087,
0.032236248254776,
0.03044706955552101,
-0.008673432283103466,
-0.007092069834470749,
0.00629845866933465,
0.017110200598835945,
-0.00034147113910876215,
0.010850047692656517,
0.011525754816830158,
-0.05101446807384491,
0.032593049108982086,
-0.012170190922915936,
0.07478681206703186,
0.008914325386285782,
-0.0004427526146173477,
-0.025391604751348495,
-0.033095262944698334,
0.01307486742734909,
-0.022125888615846634,
0.007041093893349171,
0.03235340118408203,
-0.008894357830286026,
0.006023217923939228,
-0.03511941432952881,
0.03591729328036308,
0.0062718079425394535,
-0.027190325781702995,
0.052726227790117264,
-0.019345887005329132,
0.05385030061006546,
0.0037495335564017296,
-0.005940872710198164,
-0.00903413351625204,
-0.016003211960196495,
-0.04398213326931,
-0.013605319894850254,
0.035992592573165894,
0.030934853479266167,
-0.0024786004796624184,
0.03334999829530716,
0.012972976081073284,
-0.009189694188535213,
-0.015801655128598213,
-0.0029390582349151373,
-0.01199040561914444,
-0.02160600759088993,
0.033755235373973846,
0.05596834793686867,
-0.044926777482032776,
-0.013413716107606888,
-0.0039043619763106108,
-0.0021736237686127424,
0.009024744853377342,
-0.02467273734509945,
0.012737195007503033,
0.0013545326655730605,
0.014465833082795143,
-0.012607283890247345,
0.007663062773644924,
-0.018801899626851082,
-0.022747812792658806,
0.04214122146368027,
-0.012252969667315483,
-0.0032891761511564255,
-0.015613901428878307,
0.012980991043150425,
-0.011502576060593128,
0.02493344061076641,
-0.0080865528434515,
0.0094674127176404,
0.01571759209036827,
-0.0067890239879488945,
0.00858480203896761,
0.00213802931830287,
-0.0289265476167202,
0.006936969701200724,
-0.032736457884311676,
0.02298545278608799,
0.019426101818680763,
-0.01135225873440504,
-0.014019629918038845,
0.021672317758202553,
0.03684482350945473,
0.01326033379882574,
-0.003206477267667651,
-0.012779394164681435,
0.025345275178551674,
-0.0428810715675354,
-0.02791723422706127,
-0.018724508583545685,
-0.01724165305495262,
0.0004164108249824494,
0.024652935564517975,
-0.03210926800966263,
0.011508208699524403,
-0.041064754128456116,
0.00522370170801878,
0.02857915870845318,
0.019967395812273026,
-0.004525947850197554,
-0.0034744543954730034,
-0.03999323770403862,
0.012986796908080578,
-0.021017102524638176,
0.02172083407640457,
0.0014798189513385296,
-0.02061227150261402,
0.025101803243160248,
-0.0604691281914711,
-0.002676408039405942,
0.03250263258814812,
0.001858332077972591,
0.027900638058781624,
0.00448980089277029,
0.03372504562139511,
0.0105551453307271,
0.03325146064162254,
0.00040014705155044794,
0.012869559228420258,
0.007832369767129421,
0.001271509099751711,
-0.017688678577542305,
-0.01913147047162056,
0.02628888562321663,
-0.010769056156277657,
-0.011872106231749058,
0.03645150363445282,
0.03240036591887474,
0.010696274228394032,
-0.013084011152386665,
-0.014140862040221691,
0.0056213089264929295,
0.00960114412009716,
-0.020902816206216812,
0.00806051678955555,
0.011522171087563038,
0.03301340341567993,
-0.017359787598252296,
-0.0068647353909909725,
-0.0005449025193229318,
-0.014710123650729656,
-0.015939313918352127,
0.04069504886865616,
-0.03474913910031319,
0.04258017614483833,
-0.003300045384094119,
-0.01869264990091324,
0.057783614844083786,
0.03067692369222641,
0.004201489966362715,
0.037507303059101105,
-0.040231648832559586,
-0.029001465067267418,
-0.015919659286737442,
-0.006753119174391031,
-0.008726855739951134,
-0.0015117794973775744,
0.017841225489974022,
0.038168422877788544,
0.04533448442816734,
0.030809130519628525,
0.02785276249051094,
0.0001278092822758481,
0.013341479003429413,
-0.013364993967115879,
0.03300438076257706,
-0.013481777161359787,
0.007060376927256584,
0.016487330198287964,
0.0442630834877491,
0.02946079708635807,
-0.04313376918435097,
-0.020704101771116257,
0.014484801329672337,
-0.04169018939137459,
-0.012713438831269741,
0.030672751367092133,
0.014712744392454624,
0.018307434394955635,
0.02495533600449562,
-0.02606245130300522,
-0.009361089207231998,
0.028829123824834824,
0.00042586878407746553,
0.02712077647447586,
-0.021346209570765495,
0.04993433132767677,
-0.007617534603923559,
0.0004165666759945452,
-0.02569948136806488,
-0.018368534743785858,
-0.006500519346445799,
-0.002532611135393381,
0.013582561165094376,
-0.01903463900089264,
-0.022647516801953316,
0.010038456879556179,
-0.01672467775642872,
-0.03434523195028305,
-0.008050444535911083,
0.021652543917298317,
-0.04505610093474388,
-0.01928480714559555,
-0.007499095518141985,
0.030786091461777687,
0.009813726879656315,
0.0050651514902710915,
-0.008581011556088924,
-0.003608579281717539,
-0.008430588990449905,
-0.0035827967803925276,
0.0017864997498691082,
0.017339719459414482,
-0.03457663953304291,
0.0022889701649546623,
0.001683449256233871,
0.0011420900700613856,
-0.05181560665369034,
0.015612518414855003,
0.021329602226614952,
-0.057017095386981964,
0.02124427817761898,
-0.04013034328818321,
-0.004402104299515486,
-0.01568855158984661
] |
8a8db025d17d202dce4f03767b8394c4ff63db8d | 14,254 | py | Python | src/telr/TELR_assembly.py | dominik-handler/TELR | 3e34e54fc959c13fa45dc911facf0d5179fbb34b | [
"BSD-2-Clause"
] | 22 | 2020-09-22T21:21:17.000Z | 2022-01-21T17:52:12.000Z | src/telr/TELR_assembly.py | dominik-handler/TELR | 3e34e54fc959c13fa45dc911facf0d5179fbb34b | [
"BSD-2-Clause"
] | 6 | 2021-05-07T13:52:30.000Z | 2022-03-27T18:21:10.000Z | src/telr/TELR_assembly.py | dominik-handler/TELR | 3e34e54fc959c13fa45dc911facf0d5179fbb34b | [
"BSD-2-Clause"
] | 6 | 2020-10-01T12:47:19.000Z | 2021-08-13T14:38:11.000Z | import sys
import os
import subprocess
import shutil
import time
import logging
from Bio import SeqIO
from multiprocessing import Pool
import pysam
from telr.TELR_utility import mkdir, check_exist, format_time
def get_local_contigs(
assembler,
polisher,
contig_dir,
vcf_parsed,
out,
sample_name,
bam,
raw_reads,
thread,
presets,
polish_iterations,
):
"""Perform local assembly using reads from parsed VCF file in parallel"""
# Prepare reads used for local assembly and polishing
sv_reads_dir = os.path.join(out, "sv_reads")
try:
prep_assembly_inputs(
vcf_parsed, out, sample_name, bam, raw_reads, sv_reads_dir, read_type="sv"
)
except Exception as e:
print(e)
print("Prepare local assembly input data failed, exiting...")
sys.exit(1)
mkdir(contig_dir)
k = 0
asm_pa_list = []
with open(vcf_parsed, "r") as input:
for line in input:
entry = line.replace("\n", "").split("\t")
contig_name = "_".join([entry[0], entry[1], entry[2]])
# rename variant reads
sv_reads = sv_reads_dir + "/contig" + str(k)
sv_reads_rename = sv_reads_dir + "/" + contig_name + ".reads.fa"
os.rename(sv_reads, sv_reads_rename)
thread_asm = 1
asm_pa = [
sv_reads_rename,
contig_dir,
contig_name,
thread_asm,
presets,
assembler,
polisher,
polish_iterations,
]
asm_pa_list.append(asm_pa)
k = k + 1
# run assembly in parallel
logging.info("Perform local assembly of non-reference TE loci...")
start_time = time.time()
try:
pool = Pool(processes=thread)
contig_list = pool.map(run_assembly_polishing, asm_pa_list)
pool.close()
pool.join()
except Exception as e:
print(e)
print("Local assembly failed, exiting...")
sys.exit(1)
proc_time = time.time() - start_time
# merge all contigs
assembly_passed_loci = set()
merged_contigs = os.path.join(out, sample_name + ".contigs.fa")
with open(merged_contigs, "w") as merged_output_handle:
for contig in contig_list:
if check_exist(contig):
contig_name = os.path.basename(contig).replace(".cns.fa", "")
assembly_passed_loci.add(contig_name)
parsed_contig = os.path.join(contig_dir, contig_name + ".cns.ctg1.fa")
with open(contig, "r") as input:
records = SeqIO.parse(input, "fasta")
for record in records:
if record.id == "ctg1" or record.id == "contig_1":
record.id = contig_name
record.description = "len=" + str(len(record.seq))
SeqIO.write(record, merged_output_handle, "fasta")
with open(parsed_contig, "w") as parsed_output_handle:
SeqIO.write(record, parsed_output_handle, "fasta")
logging.info("Local assembly finished in " + format_time(proc_time))
return merged_contigs, assembly_passed_loci
def run_assembly_polishing(args):
reads = args[0]
asm_dir = args[1]
contig_name = args[2]
thread = args[3]
presets = args[4]
assembler = args[5]
polisher = args[6]
polish_iterations = args[7]
# run assembly
if assembler == "wtdbg2":
asm_cns = run_wtdbg2_assembly(reads, asm_dir, contig_name, thread, presets)
else:
asm_cns = run_flye_assembly(reads, asm_dir, contig_name, thread, presets)
if not check_exist(asm_cns):
print("assembly failed")
return None
# run polishing
if polish_iterations > 0:
if polisher == "wtdbg2":
asm_cns = run_wtdbg2_polishing(
asm_cns, reads, thread, polish_iterations, presets
)
else:
asm_cns = run_flye_polishing(
asm_cns, reads, asm_dir, contig_name, thread, polish_iterations, presets
)
if check_exist(asm_cns):
return asm_cns
else:
return None
def run_flye_polishing(
asm_cns, reads, asm_dir, contig_name, thread, polish_iterations, presets
):
"""Run Flye polishing"""
if presets == "pacbio":
presets_flye = "--pacbio-raw"
else:
presets_flye = "--nano-raw"
tmp_out_dir = os.path.join(asm_dir, contig_name)
mkdir(tmp_out_dir)
try:
subprocess.call(
[
"flye",
"--polish-target",
asm_cns,
presets_flye,
reads,
"--out-dir",
tmp_out_dir,
"--thread",
str(thread),
"--iterations",
str(polish_iterations),
]
)
except Exception as e:
print(e)
print("Polishing failed, exiting...")
return None
# rename contig file
polished_contig = os.path.join(
tmp_out_dir, "polished_" + str(polish_iterations) + ".fasta"
)
if check_exist(polished_contig):
os.rename(polished_contig, asm_cns)
shutil.rmtree(tmp_out_dir)
return asm_cns
else:
return None
def run_wtdbg2_polishing(asm_cns, reads, threads, polish_iterations, presets):
"""Run wtdbg2 polishing"""
if presets == "pacbio":
presets_minimap2 = "map-pb"
else:
presets_minimap2 = "map-ont"
# polish consensus
threads = str(min(threads, 4))
bam = asm_cns + ".bam"
k = 0
while True:
# align reads to contigs
command = (
"minimap2 -t "
+ threads
+ " -ax "
+ presets_minimap2
+ " -r2k "
+ asm_cns
+ " "
+ reads
+ " | samtools sort -@"
+ threads
+ " > "
+ bam
)
try:
subprocess.run(
command,
shell=True,
timeout=300,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
)
except subprocess.TimeoutExpired:
print("fail to map reads to contig: " + asm_cns)
return
# run wtpoa-cns to get polished contig
cns_tmp = asm_cns + ".tmp"
command = (
"samtools view -F0x900 "
+ bam
+ " | wtpoa-cns -t "
+ threads
+ " -d "
+ asm_cns
+ " -i - -fo "
+ cns_tmp
)
try:
subprocess.run(
command,
shell=True,
timeout=300,
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT,
)
except subprocess.TimeoutExpired:
print("fail to polish contig: " + asm_cns)
return
if check_exist(cns_tmp):
os.rename(cns_tmp, asm_cns)
os.remove(bam)
else:
break
k = k + 1
if k >= polish_iterations:
break
if check_exist(asm_cns):
return asm_cns
else:
print("polishing failed for " + asm_cns + "\n")
return None
def run_flye_assembly(sv_reads, asm_dir, contig_name, thread, presets):
"""Run Flye assembly"""
if presets == "pacbio":
presets_flye = "--pacbio-raw"
else:
presets_flye = "--nano-raw"
tmp_out_dir = os.path.join(asm_dir, contig_name)
mkdir(tmp_out_dir)
try:
subprocess.call(
[
"flye",
presets_flye,
sv_reads,
"--out-dir",
tmp_out_dir,
"--thread",
str(thread),
"--iterations",
"0",
]
)
except Exception as e:
print(e)
print("Assembly failed, exiting...")
return
# rename contigs
contig_path = os.path.join(tmp_out_dir, "assembly.fasta")
contig_path_new = os.path.join(asm_dir, contig_name + ".cns.fa")
if check_exist(contig_path):
os.rename(contig_path, contig_path_new)
# remove tmp files
shutil.rmtree(tmp_out_dir)
return contig_path_new
else:
print("assembly failed")
return None
def run_wtdbg2_assembly(sv_reads, asm_dir, contig_name, thread, presets):
"""Run wtdbg2 assembly"""
if presets == "pacbio":
presets_wtdbg2 = "rs"
else:
presets_wtdbg2 = "ont"
prefix = sv_reads.replace(".reads.fa", "")
try:
subprocess.run(
[
"wtdbg2",
"-x",
presets_wtdbg2,
"-q",
"-AS",
"1",
"-g",
"30k",
"-t",
str(thread),
"-i",
sv_reads,
"-fo",
prefix,
],
timeout=300,
)
except subprocess.TimeoutExpired:
print("fail to build contig layout for contig: " + contig_name)
return
except Exception as e:
print(e)
print("wtdbg2 failed, exiting...")
return None
# derive consensus
contig_layout = prefix + ".ctg.lay.gz"
if check_exist(contig_layout):
cns_thread = str(min(thread, 4))
consensus = prefix + ".cns.fa"
try:
subprocess.run(
[
"wtpoa-cns",
"-q",
"-t",
cns_thread,
"-i",
contig_layout,
"-fo",
consensus,
],
timeout=300,
)
except subprocess.TimeoutExpired:
print("fail to assemble contig: " + contig_name)
return None
if check_exist(consensus):
consensus_rename = os.path.join(asm_dir, contig_name + ".cns.fa")
os.rename(consensus, consensus_rename)
return consensus_rename
else:
return None
def prep_assembly_inputs(
vcf_parsed, out, sample_name, bam, raw_reads, reads_dir, read_type="sv"
):
"""Prepare reads for local assembly"""
# logging.info("Prepare reads for local assembly")
if read_type == "sv": # TODO: figure out what this does
# extract read IDs
read_ids = os.path.join(out, sample_name + ".id")
with open(vcf_parsed, "r") as input, open(read_ids, "w") as output:
for line in input:
entry = line.replace("\n", "").split("\t")
read_list = entry[8].split(",")
for read in read_list:
output.write(read + "\n")
else: # TODO: think about using this for assembly, filter for cigar reads
window = 1000
samfile = pysam.AlignmentFile(bam, "rb")
read_ids = os.path.join(out, sample_name + ".id")
vcf_parsed_new = vcf_parsed + ".new"
with open(vcf_parsed, "r") as input, open(read_ids, "w") as output, open(
vcf_parsed_new, "w"
) as VCF:
for line in input:
entry = line.replace("\n", "").split("\t")
# get sniffles read list
read_list = entry[8].split(",")
reads_sniffles = set(read_list)
ins_chr = entry[0]
ins_breakpoint = round((int(entry[1]) + int(entry[2])) / 2)
start = ins_breakpoint - window
end = ins_breakpoint + window
reads = set()
# coverage = 0
for read in samfile.fetch(ins_chr, start, end):
reads.add(read.query_name)
for read in reads:
output.write(read + "\n")
# write
out_line = line.replace("\n", "") + "\t" + str(len(reads))
VCF.write(out_line + "\n")
vcf_parsed = vcf_parsed_new
# generate unique ID list
read_ids_unique = read_ids + ".unique"
command = "cat " + read_ids + " | sort | uniq"
with open(read_ids_unique, "w") as output:
subprocess.call(command, stdout=output, shell=True)
# filter raw reads using read list
subset_fa = os.path.join(out, sample_name + ".subset.fa")
command = "seqtk subseq " + raw_reads + " " + read_ids_unique + " | seqtk seq -a"
with open(subset_fa, "w") as output:
subprocess.call(command, stdout=output, shell=True)
# reorder reads
subset_fa_reorder = out + "/" + sample_name + ".subset.reorder.fa"
extract_reads(subset_fa, read_ids, subset_fa_reorder)
# separate reads into multiple files, using csplit
mkdir(reads_dir)
csplit_prefix = reads_dir + "/contig"
m = []
k = 1
with open(vcf_parsed, "r") as input:
for line in input:
entry = line.replace("\n", "").split("\t")
if read_type == "sv":
k = k + 2 * (len(entry[8].split(",")))
else:
k = k + 2 * int(entry[14])
m.append(k)
if len(m) == 1:
subprocess.call(["cp", subset_fa_reorder, reads_dir + "/contig0"])
elif len(m) == 0:
print("No insertion detected, exiting...")
else:
m = m[:-1]
index = " ".join(str(i) for i in m)
command = (
"csplit -s -f " + csplit_prefix + " -n 1 " + subset_fa_reorder + " " + index
)
subprocess.call(command, shell=True)
# remove tmp files
os.remove(read_ids)
os.remove(read_ids_unique)
os.remove(subset_fa)
os.remove(subset_fa_reorder)
def extract_reads(reads, list, out):
"""Extract reads from fasta using read ID list"""
record_dict = SeqIO.index(reads, "fasta")
with open(out, "wb") as output_handle, open(list, "r") as ID:
for entry in ID:
entry = entry.replace("\n", "")
output_handle.write(record_dict.get_raw(entry))
| 30.32766 | 88 | 0.525116 | 1 | 2.0586 | [
-0.0137157728895545,
-0.009625986218452454,
0.019406067207455635,
0.016035959124565125,
-0.03625040128827095,
0.011359134688973427,
-0.013385678641498089,
-0.016718469560146332,
0.0058123879134655,
-0.004015050828456879,
-0.009166348725557327,
-0.00973384827375412,
0.03925546631217003,
-0.06804206967353821,
-0.03602354973554611,
0.01669061928987503,
0.11132364720106125,
0.02537333033978939,
-0.019717460498213768,
0.04037877544760704,
0.00910221878439188,
0.009589342400431633,
-0.022237183526158333,
0.022920280694961548,
0.0059068272821605206,
-0.025073423981666565,
0.04247438907623291,
-0.01998712308704853,
0.038755957037210464,
-0.01778346672654152,
0.00980853196233511,
-0.007464107125997543,
-0.018451886251568794,
0.05271754413843155,
-0.021435830742120743,
-0.04562484100461006,
-0.04139569029211998,
-0.0030806611757725477,
0.025893837213516235,
-0.014304421842098236,
-0.03704165294766426,
-0.027534736320376396,
-0.004217878449708223,
0.00944806169718504,
0.018141640350222588,
0.022889181971549988,
-0.032391294836997986,
0.034904856234788895,
-0.012088717892765999,
0.02073596976697445,
0.019096797332167625,
0.044907569885253906,
-0.02773258090019226,
-0.02973325364291668,
-0.0037626144476234913,
-0.02614155225455761,
0.037116359919309616,
0.025972897186875343,
-0.013007289730012417,
0.002163419732823968,
0.04090958088636398,
-0.013424962759017944,
0.008978278376162052,
-0.00471986411139369,
0.04958920180797577,
-0.002608070382848382,
0.007427223492413759,
-0.017486024647951126,
0.008341513574123383,
-0.0008003367693163455,
-0.03230481594800949,
-0.0277316402643919,
0.025352491065859795,
0.09147316217422485,
-0.0014256032882258296,
0.003582569072023034,
-0.03926781192421913,
-0.017550166696310043,
-0.020854437723755836,
0.009508171118795872,
-0.01726030930876732,
0.028302233666181564,
0.01961253397166729,
0.0009648908162489533,
0.013089608401060104,
0.025201426818966866,
0.02596733719110489,
-0.019682295620441437,
0.05897984281182289,
-0.0008676255820319057,
-0.003171444172039628,
-0.03630863502621651,
0.0019456708105280995,
-0.003849989967420697,
-0.029991576448082924,
-0.03090563789010048,
0.026680145412683487,
-0.021478112787008286,
0.00011811860167654231,
0.012155105359852314,
0.008833811618387699,
0.00864075031131506,
0.014940603636205196,
-0.004406255204230547,
-0.00833861343562603,
0.009294889867305756,
-0.060532648116350174,
-0.008940482512116432,
-0.001537481090053916,
-0.02028404362499714,
0.017398668453097343,
0.01461175736039877,
0.019124317914247513,
0.001234355615451932,
-0.03822196274995804,
-0.009180310182273388,
-0.005224302876740694,
-0.020840896293520927,
0.016686096787452698,
0.07453099638223648,
-0.004397197626531124,
0.02538311667740345,
-0.011334103532135487,
-0.03701711446046829,
-0.02334655448794365,
0.0756448432803154,
0.01479883398860693,
-0.0006599515909329057,
-0.012271243147552013,
-0.01136687584221363,
-0.010674945078790188,
-0.021873459219932556,
0.014848238788545132,
-0.011278044432401657,
0.009663722477853298,
-0.01648286171257496,
-0.01808127574622631,
0.008922548033297062,
-0.015670418739318848,
0.03612058609724045,
-0.00391712412238121,
-0.034440066665410995,
0.003296761540696025,
-0.00846775434911251,
0.032987017184495926,
-0.03578830510377884,
-0.03317622095346451,
-0.02403475157916546,
-0.024913381785154343,
0.002640077844262123,
-0.0067508649080991745,
0.011558124795556068,
0.00783810205757618,
0.01105478871613741,
-0.009238972328603268,
-0.00836033746600151,
-0.016593588516116142,
-0.035239435732364655,
-0.003202972235158086,
0.004528935067355633,
-0.03307880833745003,
0.03150510787963867,
0.03053201735019684,
0.02374298684298992,
-0.04667164385318756,
0.04853835701942444,
0.001406523515470326,
-0.003351846942678094,
0.005398573819547892,
0.028344223275780678,
-0.035484351217746735,
-0.027879424393177032,
-0.003419499145820737,
-0.0043547553941607475,
0.01778407022356987,
-0.002276603365316987,
0.021312275901436806,
-0.02389024756848812,
0.028130900114774704,
-0.053406111896038055,
0.00573940621688962,
-0.001551231136545539,
0.04248332232236862,
0.008437604643404484,
-0.02917453832924366,
-0.01804361119866371,
0.029196517542004585,
-0.019514622166752815,
0.029044313356280327,
-0.05074278265237808,
-0.029275981709361076,
0.03335811197757721,
-0.019787147641181946,
-0.005429059732705355,
-0.0004979109507985413,
-0.017239004373550415,
-0.037466101348400116,
0.016824569553136826,
0.0037967991083860397,
-0.01718994416296482,
-0.01810188591480255,
0.0180154200643301,
0.0258632842451334,
0.043140050023794174,
0.008032705634832382,
-0.0006116315489634871,
-0.7321493029594421,
-0.02235984615981579,
0.022615084424614906,
-0.0047726379707455635,
-0.010020469315350056,
0.007281286176294088,
0.005577616393566132,
0.026520678773522377,
0.011277489364147186,
-0.02356169931590557,
0.02056182362139225,
0.010544213466346264,
-0.012786338105797768,
-0.0038021027576178312,
0.03560248017311096,
-0.040433939546346664,
-0.01985924132168293,
0.0014095939695835114,
-0.05592096596956253,
0.011177650652825832,
-0.012592914514243603,
-0.02840280532836914,
-0.023579852655529976,
0.026614798232913017,
-0.010076377540826797,
-0.0067595066502690315,
-0.031949084252119064,
0.016490984708070755,
0.01772705465555191,
0.018416516482830048,
0.01844334788620472,
-0.013318868353962898,
0.020282236859202385,
0.0112153310328722,
-0.037069376558065414,
0.033076975494623184,
-0.006347286980599165,
-0.004692670423537493,
0.009123675525188446,
0.02640509605407715,
-0.018176615238189697,
0.012486846186220646,
-0.03603747859597206,
-0.04019332304596901,
-0.000040433638787362725,
0.00641321437433362,
-0.05504957213997841,
0.0012504586484283209,
0.019855834543704987,
-0.012738735415041447,
-0.02079639956355095,
0.022006766870617867,
0.005731946788728237,
-0.007814870215952396,
0.0160197950899601,
0.009472498670220375,
-0.007182412780821323,
-0.03712530434131622,
-0.017305521294474602,
0.023741401731967926,
0.0013546077534556389,
0.008179903030395508,
-0.02868712693452835,
-0.0058899750001728535,
-0.010733770206570625,
0.026598379015922546,
0.03877869248390198,
-0.04364291951060295,
-0.01792873814702034,
-0.01315191201865673,
-0.026889387518167496,
-0.021619856357574463,
-0.02556518092751503,
0.09417469054460526,
0.00509022269397974,
0.022964119911193848,
-0.049823932349681854,
-0.012261702679097652,
-0.003619532100856304,
-0.011918019503355026,
-0.01412468496710062,
-0.026065414771437645,
-0.008117463439702988,
-0.007075328379869461,
-0.023572832345962524,
-0.0023485608398914337,
-0.0021440081764012575,
0.0024980902671813965,
0.004503253381699324,
0.047892555594444275,
0.05332207307219505,
0.024507470428943634,
0.004636007361114025,
0.002882879227399826,
0.023820219561457634,
-0.019545072689652443,
0.021730676293373108,
-0.005274889059364796,
-0.0031245090067386627,
-0.0025118382181972265,
-0.021814100444316864,
-0.0057721976190805435,
0.01958722248673439,
0.04800545051693916,
-0.012129680253565311,
-0.03278852999210358,
-0.03356018662452698,
-0.01553106028586626,
0.003988637123256922,
0.013096598908305168,
-0.022427450865507126,
0.0024873053189367056,
0.00006502188625745475,
0.00997750461101532,
-0.009735293686389923,
-0.000028293197829043493,
-0.005574710667133331,
-0.047486983239650726,
0.002951455069705844,
-0.03345174342393875,
0.028322748839855194,
-0.019234774634242058,
0.03264543041586876,
0.00035807600943371654,
0.01474493183195591,
-0.014146207831799984,
-0.017854511737823486,
-0.024853860959410667,
-0.0017799224006012082,
-0.02252873219549656,
-0.037118520587682724,
-0.007018066942691803,
0.01198591012507677,
0.03245005011558533,
0.017922688275575638,
-0.00198667636141181,
-0.019036078825592995,
-0.05917289853096008,
-0.016777407377958298,
0.0012359409593045712,
-0.01746796816587448,
0.009029519744217396,
0.015694456174969673,
-0.0070199621841311455,
0.020152408629655838,
0.0012147531379014254,
0.014937357045710087,
0.004836284555494785,
0.09811483323574066,
0.0022021119948476553,
0.0027371735777705908,
0.001851798384450376,
-0.01173804048448801,
0.036533717066049576,
-0.03171822056174278,
0.012066616676747799,
-0.018525943160057068,
0.028791431337594986,
0.02491042949259281,
0.008893631398677826,
0.0016405791975557804,
0.0061513446271419525,
0.0023862519301474094,
0.04470420256257057,
0.01964690163731575,
0.0031002010218799114,
0.025080274790525436,
0.008718404918909073,
-0.005530529655516148,
0.0368991382420063,
0.02164004184305668,
-0.044617101550102234,
-0.0022771807853132486,
0.006325669586658478,
0.00744736148044467,
0.027487320825457573,
-0.002676657633855939,
0.020597200840711594,
-0.004575273022055626,
-0.0320277139544487,
-0.03890048712491989,
-0.004496337380260229,
0.00608040438964963,
-0.005177578888833523,
0.0011453715851530433,
0.0165538527071476,
0.010153790935873985,
-0.016716497018933296,
0.031803492456674576,
-0.03560333698987961,
0.009934784844517708,
0.02469515986740589,
-0.0016915110172703862,
0.03754938766360283,
-0.010182945989072323,
0.005448115523904562,
-0.019181109964847565,
-0.03819431737065315,
0.06880271434783936,
-0.011864894069731236,
-0.007122413720935583,
0.023069797083735466,
0.004486723802983761,
-0.016150841489434242,
0.030388135462999344,
0.051331158727407455,
-0.009608331136405468,
-0.002391890389844775,
-0.008073543198406696,
-0.033889494836330414,
-0.00045355476322583854,
-0.0057934001088142395,
0.0032820997294038534,
0.016557376831769943,
0.017761394381523132,
-0.0012193112634122372,
-0.05822756886482239,
-0.06612023711204529,
-0.03714120760560036,
-0.017678113654255867,
-0.04887227341532707,
-0.006924029905349016,
0.035182010382413864,
0.008362787775695324,
-0.03155408799648285,
-0.01930335909128189,
0.003953082021325827,
0.009258889593183994,
-0.0014123407891020179,
-0.04548000171780586,
0.03890379145741463,
0.04177888482809067,
0.009696926921606064,
-0.0006147904205136001,
-0.022539161145687103,
0.012743371538817883,
-0.014413920231163502,
-0.0371428057551384,
-0.02663479559123516,
-0.026853671297430992,
0.005054626148194075,
-0.049527235329151154,
-0.026333477348089218,
0.04166824743151665,
0.007849512621760368,
-0.0013082619989290833,
0.015510882250964642,
-0.028604788705706596,
-0.034513603895902634,
-0.009405862540006638,
0.009995299391448498,
-0.010448697954416275,
-0.01672697439789772,
-0.004236476495862007,
-0.020513631403446198,
-0.003413747064769268,
-0.003366603050380945,
0.02442406676709652,
0.00921123381704092,
-0.012903707101941109,
-0.03071201778948307,
0.022634437307715416,
0.008987776935100555,
0.009126723743975163,
-0.0017272172262892127,
-0.00013401643082033843,
0.0020912603940814734,
-0.0021041331347078085,
0.02257567085325718,
0.007225145120173693,
0.031271036714315414,
-0.036424849182367325,
-0.009265024214982986,
-0.023752115666866302,
0.011515814810991287,
-0.045025285333395004,
0.016849972307682037,
0.020369410514831543,
0.022297734394669533,
-0.009413541294634342,
-0.021915407851338387,
0.008621040731668472,
0.00626234570518136,
0.034239284694194794,
-0.022028326988220215,
0.009775541722774506,
-0.04482274129986763,
0.010352548211812973,
-0.04271947219967842,
0.009785382077097893,
-0.015907851979136467,
-0.03213236480951309,
0.019198089838027954,
0.02535707876086235,
-0.00537134101614356,
0.02163691073656082,
-0.01830274611711502,
-0.003165137954056263,
0.004649518523365259,
-0.027878301218152046,
0.014275926165282726,
0.013485291041433811,
0.003483504056930542,
0.017086271196603775,
-0.0023830768186599016,
-0.02108893357217312,
0.03279406204819679,
-0.0010122881503775716,
0.0417376309633255,
-0.02537471055984497,
0.0149662671610713,
0.03300119563937187,
0.0015166013035923243,
-0.013383010402321815,
-0.019126813858747482,
0.018109532073140144,
0.03519574925303459,
-0.010883963666856289,
0.005522102117538452,
-0.02628723345696926,
-0.028176840394735336,
0.015883740037679672,
-0.03252934291958809,
-0.0009729820303618908,
0.008340994827449322,
0.009234161116182804,
-0.03430543094873428,
-0.021986881271004677,
0.01603185385465622,
0.02385152131319046,
0.013439449481666088,
-0.03861837461590767,
-0.014061346650123596,
0.0023749566171318293,
-0.0025377224665135145,
-0.027798231691122055,
0.03740561008453369,
0.007415803149342537,
-0.021548965945839882,
0.029533954337239265,
0.010127581655979156,
0.030000144615769386,
-0.0292513407766819,
-0.018844962120056152,
0.01780521124601364,
0.025522934272885323,
-0.009147065691649914,
0.012155832722783089,
-0.004526955075562,
0.029483117163181305,
-0.02557179518043995,
-0.0007579865050502121,
-0.031020456925034523,
0.013293643482029438,
0.0019493307918310165,
0.02696862816810608,
0.022683866322040558,
0.02045569196343422,
0.00016179740487132221,
0.005241449922323227,
-0.01500007789582014,
-0.01607625186443329,
0.0204628836363554,
0.005999854765832424,
0.03238265588879585,
-0.05030383914709091,
0.020806342363357544,
-0.003951044753193855,
-0.02830975316464901,
-0.034006860107183456,
-0.025645708665251732,
-0.03072022832930088,
0.019207928329706192,
0.007983934134244919,
0.018042508512735367,
0.03287940472364426,
0.04023837298154831,
0.015742488205432892,
0.00959852896630764,
0.022139975801110268,
-0.07175862044095993,
0.008271178230643272,
0.012785538099706173,
0.02365599013864994,
-0.02203599363565445,
0.009039908647537231,
0.01978670060634613,
-0.001262374222278595,
-0.0076941680163145065,
-0.003736928105354309,
0.005046021193265915,
0.01549955178052187,
0.018663637340068817,
-0.0012749749002978206,
0.010110144503414631,
0.007000081706792116,
-0.004017973318696022,
-0.011593186296522617,
-0.015289364382624626,
0.013685880228877068,
0.01893853396177292,
0.024889154359698296,
0.01199626736342907,
-0.025179654359817505,
0.027671195566654205,
0.013055713847279549,
0.012733347713947296,
-0.006828107871115208,
0.03599362075328827,
-0.015039775520563126,
0.022542741149663925,
-0.004440723452717066,
-0.009503361769020557,
-0.030005471780896187,
0.04274386540055275,
-0.0034733309876173735,
-0.03846034035086632,
0.016825340688228607,
0.008548836223781109,
-0.00332152028568089,
-0.004705441650003195,
0.021309159696102142,
0.004980084951967001,
-0.04616863280534744,
-0.01214927714318037,
0.014322333969175816,
0.015785913914442062,
0.0027133768890053034,
0.0037533182185143232,
0.021511957049369812,
0.011631728149950504,
-0.018026690930128098,
-0.02953062765300274,
0.01525754202157259,
-0.015834927558898926,
0.023899037390947342,
0.01716902107000351,
0.0037000561133027077,
-0.0003082703915424645,
0.01724155806005001,
-0.008780727162957191,
0.02797435037791729,
0.0315481573343277,
0.04265106841921806,
-0.00030412068008445203,
-0.11458934843540192,
0.015188515186309814,
-0.0031574454624205828,
-0.006441317033022642,
-0.02160341665148735,
-0.02453221008181572,
0.03185299038887024,
0.03238026425242424,
-0.011056439951062202,
0.005421374924480915,
0.009368372149765491,
-0.028963830322027206,
0.007897695526480675,
-0.02475881390273571,
0.002618460450321436,
-0.004369523376226425,
0.01711629331111908,
-0.037780728191137314,
0.01233760267496109,
-0.0027890868950635195,
-0.010267793200910091,
0.05004256218671799,
0.0004759552830364555,
-0.0022994643077254295,
-0.017935259267687798,
0.045132506638765335,
-0.0037953918799757957,
-0.015070954337716103,
-0.017326224595308304,
-0.00041203846922144294,
0.01474297046661377,
-0.015923017635941505,
0.02418515272438526,
0.022395482286810875,
0.013716794550418854,
-0.0008556162938475609,
0.0018833200447261333,
0.023389818146824837,
-0.018705854192376137,
0.04401687905192375,
-0.004390543792396784,
0.011090878397226334,
0.044655535370111465,
-0.017463332042098045,
0.0005052451160736382,
-0.049252308905124664,
-0.0394735150039196,
-0.015650153160095215,
-0.01147245429456234,
0.026416057720780373,
-0.002317615319043398,
0.013005130924284458,
0.01172882504761219,
-0.0003566341183613986,
-0.019634544849395752,
-0.01828104257583618,
-0.023482348769903183,
0.035440728068351746,
-0.03750242665410042,
-0.0015842654975131154,
0.01761808805167675,
-0.0013537054182961583,
0.03527610003948212,
-0.021852081641554832,
-0.005491544958204031,
-0.02366720326244831,
0.0028219232335686684,
-0.027125507593154907,
0.002972312970086932,
-0.01212685089558363,
0.02860379032790661,
0.03358541801571846,
-0.03390888869762421,
0.01016636285930872,
-0.0005970106576569378,
-0.0004978190991096199,
0.027101758867502213,
0.011404456570744514,
-0.0056692068465054035,
-0.018816452473402023,
-0.025909360498189926,
-0.04771188274025917,
-0.028435584157705307,
-0.013826965354382992,
0.013335040770471096,
-0.01957651600241661,
0.005485215689986944,
0.0043612997978925705,
0.003318320494145155,
0.021071506664156914,
0.008289849385619164,
0.01731077954173088,
0.00884977076202631,
-0.024206334725022316,
-0.02645806036889553,
0.0004000206245109439,
0.03722168505191803,
-0.011091422289609909,
-0.017529234290122986,
0.024313081055879593,
0.02153652347624302,
0.023115813732147217,
-0.0031676061917096376,
0.02481851913034916,
0.05025070533156395,
-0.012300904840230942,
-0.01353672705590725,
0.045684609562158585,
0.04460478574037552,
-0.010556274093687534,
-0.012314590625464916,
0.014417016878724098,
-0.032194577157497406,
-0.03797405585646629,
-0.031238311901688576,
-0.011782108806073666,
-0.02918071672320366
] |
8a900957322aa8d59dab3c2935590611098dad34 | 28,015 | py | Python | pygmt/tests/test_clib.py | aliciaha1997/pygmt | a10af5d8deb3bf3090eab4b6492bcf8cf722cb71 | [
"BSD-3-Clause"
] | null | null | null | pygmt/tests/test_clib.py | aliciaha1997/pygmt | a10af5d8deb3bf3090eab4b6492bcf8cf722cb71 | [
"BSD-3-Clause"
] | null | null | null | pygmt/tests/test_clib.py | aliciaha1997/pygmt | a10af5d8deb3bf3090eab4b6492bcf8cf722cb71 | [
"BSD-3-Clause"
] | 1 | 2021-11-03T07:47:18.000Z | 2021-11-03T07:47:18.000Z | # pylint: disable=protected-access
"""
Test the wrappers for the C API.
"""
import os
from contextlib import contextmanager
import numpy as np
import numpy.testing as npt
import pandas as pd
import pytest
import xarray as xr
from packaging.version import Version
from pygmt import Figure, clib
from pygmt.clib.conversion import dataarray_to_matrix
from pygmt.clib.session import FAMILIES, VIAS
from pygmt.exceptions import (
GMTCLibError,
GMTCLibNoSessionError,
GMTInvalidInput,
GMTVersionError,
)
from pygmt.helpers import GMTTempFile
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
with clib.Session() as _lib:
gmt_version = Version(_lib.info["version"])
@contextmanager
def mock(session, func, returns=None, mock_func=None):
"""
Mock a GMT C API function to make it always return a given value.
Used to test that exceptions are raised when API functions fail by
producing a NULL pointer as output or non-zero status codes.
Needed because it's not easy to get some API functions to fail without
inducing a Segmentation Fault (which is a good thing because libgmt usually
only fails with errors).
"""
if mock_func is None:
def mock_api_function(*args): # pylint: disable=unused-argument
"""
A mock GMT API function that always returns a given value.
"""
return returns
mock_func = mock_api_function
get_libgmt_func = session.get_libgmt_func
def mock_get_libgmt_func(name, argtypes=None, restype=None):
"""
Return our mock function.
"""
if name == func:
return mock_func
return get_libgmt_func(name, argtypes, restype)
setattr(session, "get_libgmt_func", mock_get_libgmt_func)
yield
setattr(session, "get_libgmt_func", get_libgmt_func)
def test_getitem():
"""
Test that I can get correct constants from the C lib.
"""
ses = clib.Session()
assert ses["GMT_SESSION_EXTERNAL"] != -99999
assert ses["GMT_MODULE_CMD"] != -99999
assert ses["GMT_PAD_DEFAULT"] != -99999
assert ses["GMT_DOUBLE"] != -99999
with pytest.raises(GMTCLibError):
ses["A_WHOLE_LOT_OF_JUNK"] # pylint: disable=pointless-statement
def test_create_destroy_session():
"""
Test that create and destroy session are called without errors.
"""
# Create two session and make sure they are not pointing to the same memory
session1 = clib.Session()
session1.create(name="test_session1")
assert session1.session_pointer is not None
session2 = clib.Session()
session2.create(name="test_session2")
assert session2.session_pointer is not None
assert session2.session_pointer != session1.session_pointer
session1.destroy()
session2.destroy()
# Create and destroy a session twice
ses = clib.Session()
for __ in range(2):
with pytest.raises(GMTCLibNoSessionError):
ses.session_pointer # pylint: disable=pointless-statement
ses.create("session1")
assert ses.session_pointer is not None
ses.destroy()
with pytest.raises(GMTCLibNoSessionError):
ses.session_pointer # pylint: disable=pointless-statement
def test_create_session_fails():
"""
Check that an exception is raised when failing to create a session.
"""
ses = clib.Session()
with mock(ses, "GMT_Create_Session", returns=None):
with pytest.raises(GMTCLibError):
ses.create("test-session-name")
# Should fail if trying to create a session before destroying the old one.
ses.create("test1")
with pytest.raises(GMTCLibError):
ses.create("test2")
def test_destroy_session_fails():
"""
Fail to destroy session when given bad input.
"""
ses = clib.Session()
with pytest.raises(GMTCLibNoSessionError):
ses.destroy()
ses.create("test-session")
with mock(ses, "GMT_Destroy_Session", returns=1):
with pytest.raises(GMTCLibError):
ses.destroy()
ses.destroy()
def test_call_module():
"""
Run a command to see if call_module works.
"""
data_fname = os.path.join(TEST_DATA_DIR, "points.txt")
out_fname = "test_call_module.txt"
with clib.Session() as lib:
with GMTTempFile() as out_fname:
lib.call_module("info", "{} -C ->{}".format(data_fname, out_fname.name))
assert os.path.exists(out_fname.name)
output = out_fname.read().strip()
assert output == "11.5309 61.7074 -2.9289 7.8648 0.1412 0.9338"
def test_call_module_invalid_arguments():
"""
Fails for invalid module arguments.
"""
with clib.Session() as lib:
with pytest.raises(GMTCLibError):
lib.call_module("info", "bogus-data.bla")
def test_call_module_invalid_name():
"""
Fails when given bad input.
"""
with clib.Session() as lib:
with pytest.raises(GMTCLibError):
lib.call_module("meh", "")
def test_call_module_error_message():
"""
Check is the GMT error message was captured.
"""
with clib.Session() as lib:
try:
lib.call_module("info", "bogus-data.bla")
except GMTCLibError as error:
assert "Module 'info' failed with status code" in str(error)
assert "gmtinfo [ERROR]: Cannot find file bogus-data.bla" in str(error)
def test_method_no_session():
"""
Fails when not in a session.
"""
# Create an instance of Session without "with" so no session is created.
lib = clib.Session()
with pytest.raises(GMTCLibNoSessionError):
lib.call_module("gmtdefaults", "")
with pytest.raises(GMTCLibNoSessionError):
lib.session_pointer # pylint: disable=pointless-statement
def test_parse_constant_single():
"""
Parsing a single family argument correctly.
"""
lib = clib.Session()
for family in FAMILIES:
parsed = lib._parse_constant(family, valid=FAMILIES)
assert parsed == lib[family]
def test_parse_constant_composite():
"""
Parsing a composite constant argument (separated by |) correctly.
"""
lib = clib.Session()
test_cases = ((family, via) for family in FAMILIES for via in VIAS)
for family, via in test_cases:
composite = "|".join([family, via])
expected = lib[family] + lib[via]
parsed = lib._parse_constant(composite, valid=FAMILIES, valid_modifiers=VIAS)
assert parsed == expected
def test_parse_constant_fails():
"""
Check if the function fails when given bad input.
"""
lib = clib.Session()
test_cases = [
"SOME_random_STRING",
"GMT_IS_DATASET|GMT_VIA_MATRIX|GMT_VIA_VECTOR",
"GMT_IS_DATASET|NOT_A_PROPER_VIA",
"NOT_A_PROPER_FAMILY|GMT_VIA_MATRIX",
"NOT_A_PROPER_FAMILY|ALSO_INVALID",
]
for test_case in test_cases:
with pytest.raises(GMTInvalidInput):
lib._parse_constant(test_case, valid=FAMILIES, valid_modifiers=VIAS)
# Should also fail if not given valid modifiers but is using them anyway.
# This should work...
lib._parse_constant(
"GMT_IS_DATASET|GMT_VIA_MATRIX", valid=FAMILIES, valid_modifiers=VIAS
)
# But this shouldn't.
with pytest.raises(GMTInvalidInput):
lib._parse_constant(
"GMT_IS_DATASET|GMT_VIA_MATRIX", valid=FAMILIES, valid_modifiers=None
)
def test_create_data_dataset():
"""
Run the function to make sure it doesn't fail badly.
"""
with clib.Session() as lib:
# Dataset from vectors
data_vector = lib.create_data(
family="GMT_IS_DATASET|GMT_VIA_VECTOR",
geometry="GMT_IS_POINT",
mode="GMT_CONTAINER_ONLY",
dim=[10, 20, 1, 0], # columns, rows, layers, dtype
)
# Dataset from matrices
data_matrix = lib.create_data(
family="GMT_IS_DATASET|GMT_VIA_MATRIX",
geometry="GMT_IS_POINT",
mode="GMT_CONTAINER_ONLY",
dim=[10, 20, 1, 0],
)
assert data_vector != data_matrix
def test_create_data_grid_dim():
"""
Create a grid ignoring range and inc.
"""
with clib.Session() as lib:
# Grids from matrices using dim
lib.create_data(
family="GMT_IS_GRID|GMT_VIA_MATRIX",
geometry="GMT_IS_SURFACE",
mode="GMT_CONTAINER_ONLY",
dim=[10, 20, 1, 0],
)
def test_create_data_grid_range():
"""
Create a grid specifying range and inc instead of dim.
"""
with clib.Session() as lib:
# Grids from matrices using range and int
lib.create_data(
family="GMT_IS_GRID|GMT_VIA_MATRIX",
geometry="GMT_IS_SURFACE",
mode="GMT_CONTAINER_ONLY",
ranges=[150.0, 250.0, -20.0, 20.0],
inc=[0.1, 0.2],
)
def test_create_data_fails():
"""
Check that create_data raises exceptions for invalid input and output.
"""
# Passing in invalid mode
with pytest.raises(GMTInvalidInput):
with clib.Session() as lib:
lib.create_data(
family="GMT_IS_DATASET",
geometry="GMT_IS_SURFACE",
mode="Not_a_valid_mode",
dim=[0, 0, 1, 0],
ranges=[150.0, 250.0, -20.0, 20.0],
inc=[0.1, 0.2],
)
# Passing in invalid geometry
with pytest.raises(GMTInvalidInput):
with clib.Session() as lib:
lib.create_data(
family="GMT_IS_GRID",
geometry="Not_a_valid_geometry",
mode="GMT_CONTAINER_ONLY",
dim=[0, 0, 1, 0],
ranges=[150.0, 250.0, -20.0, 20.0],
inc=[0.1, 0.2],
)
# If the data pointer returned is None (NULL pointer)
with pytest.raises(GMTCLibError):
with clib.Session() as lib:
with mock(lib, "GMT_Create_Data", returns=None):
lib.create_data(
family="GMT_IS_DATASET",
geometry="GMT_IS_SURFACE",
mode="GMT_CONTAINER_ONLY",
dim=[11, 10, 2, 0],
)
def test_virtual_file():
"""
Test passing in data via a virtual file with a Dataset.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
shape = (5, 3)
for dtype in dtypes:
with clib.Session() as lib:
family = "GMT_IS_DATASET|GMT_VIA_MATRIX"
geometry = "GMT_IS_POINT"
dataset = lib.create_data(
family=family,
geometry=geometry,
mode="GMT_CONTAINER_ONLY",
dim=[shape[1], shape[0], 1, 0], # columns, rows, layers, dtype
)
data = np.arange(shape[0] * shape[1], dtype=dtype).reshape(shape)
lib.put_matrix(dataset, matrix=data)
# Add the dataset to a virtual file and pass it along to gmt info
vfargs = (family, geometry, "GMT_IN|GMT_IS_REFERENCE", dataset)
with lib.open_virtual_file(*vfargs) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["<{:.0f}/{:.0f}>".format(col.min(), col.max()) for col in data.T]
)
expected = "<matrix memory>: N = {}\t{}\n".format(shape[0], bounds)
assert output == expected
def test_virtual_file_fails():
"""
Check that opening and closing virtual files raises an exception for non-
zero return codes.
"""
vfargs = (
"GMT_IS_DATASET|GMT_VIA_MATRIX",
"GMT_IS_POINT",
"GMT_IN|GMT_IS_REFERENCE",
None,
)
# Mock Open_VirtualFile to test the status check when entering the context.
# If the exception is raised, the code won't get to the closing of the
# virtual file.
with clib.Session() as lib, mock(lib, "GMT_Open_VirtualFile", returns=1):
with pytest.raises(GMTCLibError):
with lib.open_virtual_file(*vfargs):
print("Should not get to this code")
# Test the status check when closing the virtual file
# Mock the opening to return 0 (success) so that we don't open a file that
# we won't close later.
with clib.Session() as lib, mock(lib, "GMT_Open_VirtualFile", returns=0), mock(
lib, "GMT_Close_VirtualFile", returns=1
):
with pytest.raises(GMTCLibError):
with lib.open_virtual_file(*vfargs):
pass
print("Shouldn't get to this code either")
def test_virtual_file_bad_direction():
"""
Test passing an invalid direction argument.
"""
with clib.Session() as lib:
vfargs = (
"GMT_IS_DATASET|GMT_VIA_MATRIX",
"GMT_IS_POINT",
"GMT_IS_GRID", # The invalid direction argument
0,
)
with pytest.raises(GMTInvalidInput):
with lib.open_virtual_file(*vfargs):
print("This should have failed")
def test_virtualfile_from_vectors():
"""
Test the automation for transforming vectors to virtual file dataset.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
size = 10
for dtype in dtypes:
x = np.arange(size, dtype=dtype)
y = np.arange(size, size * 2, 1, dtype=dtype)
z = np.arange(size * 2, size * 3, 1, dtype=dtype)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(x, y, z) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["<{:.0f}/{:.0f}>".format(i.min(), i.max()) for i in (x, y, z)]
)
expected = "<vector memory>: N = {}\t{}\n".format(size, bounds)
assert output == expected
@pytest.mark.parametrize("dtype", [str, object])
def test_virtualfile_from_vectors_one_string_or_object_column(dtype):
"""
Test passing in one column with string or object dtype into virtual file
dataset.
"""
size = 5
x = np.arange(size, dtype=np.int32)
y = np.arange(size, size * 2, 1, dtype=np.int32)
strings = np.array(["a", "bc", "defg", "hijklmn", "opqrst"], dtype=dtype)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(x, y, strings) as vfile:
with GMTTempFile() as outfile:
lib.call_module("convert", f"{vfile} ->{outfile.name}")
output = outfile.read(keep_tabs=True)
expected = "".join(f"{i}\t{j}\t{k}\n" for i, j, k in zip(x, y, strings))
assert output == expected
@pytest.mark.parametrize("dtype", [str, object])
def test_virtualfile_from_vectors_two_string_or_object_columns(dtype):
"""
Test passing in two columns of string or object dtype into virtual file
dataset.
"""
size = 5
x = np.arange(size, dtype=np.int32)
y = np.arange(size, size * 2, 1, dtype=np.int32)
strings1 = np.array(["a", "bc", "def", "ghij", "klmno"], dtype=dtype)
strings2 = np.array(["pqrst", "uvwx", "yz!", "@#", "$"], dtype=dtype)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(x, y, strings1, strings2) as vfile:
with GMTTempFile() as outfile:
lib.call_module("convert", f"{vfile} ->{outfile.name}")
output = outfile.read(keep_tabs=True)
expected = "".join(
f"{h}\t{i}\t{j} {k}\n" for h, i, j, k in zip(x, y, strings1, strings2)
)
assert output == expected
def test_virtualfile_from_vectors_transpose():
"""
Test transforming matrix columns to virtual file dataset.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
shape = (7, 5)
for dtype in dtypes:
data = np.arange(shape[0] * shape[1], dtype=dtype).reshape(shape)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(*data.T) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} -C ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["{:.0f}\t{:.0f}".format(col.min(), col.max()) for col in data.T]
)
expected = "{}\n".format(bounds)
assert output == expected
def test_virtualfile_from_vectors_diff_size():
"""
Test the function fails for arrays of different sizes.
"""
x = np.arange(5)
y = np.arange(6)
with clib.Session() as lib:
with pytest.raises(GMTInvalidInput):
with lib.virtualfile_from_vectors(x, y):
print("This should have failed")
def test_virtualfile_from_matrix():
"""
Test transforming a matrix to virtual file dataset.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
shape = (7, 5)
for dtype in dtypes:
data = np.arange(shape[0] * shape[1], dtype=dtype).reshape(shape)
with clib.Session() as lib:
with lib.virtualfile_from_matrix(data) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["<{:.0f}/{:.0f}>".format(col.min(), col.max()) for col in data.T]
)
expected = "<matrix memory>: N = {}\t{}\n".format(shape[0], bounds)
assert output == expected
def test_virtualfile_from_matrix_slice():
"""
Test transforming a slice of a larger array to virtual file dataset.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
shape = (10, 6)
for dtype in dtypes:
full_data = np.arange(shape[0] * shape[1], dtype=dtype).reshape(shape)
rows = 5
cols = 3
data = full_data[:rows, :cols]
with clib.Session() as lib:
with lib.virtualfile_from_matrix(data) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["<{:.0f}/{:.0f}>".format(col.min(), col.max()) for col in data.T]
)
expected = "<matrix memory>: N = {}\t{}\n".format(rows, bounds)
assert output == expected
def test_virtualfile_from_vectors_pandas():
"""
Pass vectors to a dataset using pandas Series.
"""
dtypes = "float32 float64 int32 int64 uint32 uint64".split()
size = 13
for dtype in dtypes:
data = pd.DataFrame(
data=dict(
x=np.arange(size, dtype=dtype),
y=np.arange(size, size * 2, 1, dtype=dtype),
z=np.arange(size * 2, size * 3, 1, dtype=dtype),
)
)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(data.x, data.y, data.z) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
[
"<{:.0f}/{:.0f}>".format(i.min(), i.max())
for i in (data.x, data.y, data.z)
]
)
expected = "<vector memory>: N = {}\t{}\n".format(size, bounds)
assert output == expected
def test_virtualfile_from_vectors_arraylike():
"""
Pass array-like vectors to a dataset.
"""
size = 13
x = list(range(0, size, 1))
y = tuple(range(size, size * 2, 1))
z = range(size * 2, size * 3, 1)
with clib.Session() as lib:
with lib.virtualfile_from_vectors(x, y, z) as vfile:
with GMTTempFile() as outfile:
lib.call_module("info", "{} ->{}".format(vfile, outfile.name))
output = outfile.read(keep_tabs=True)
bounds = "\t".join(
["<{:.0f}/{:.0f}>".format(min(i), max(i)) for i in (x, y, z)]
)
expected = "<vector memory>: N = {}\t{}\n".format(size, bounds)
assert output == expected
def test_extract_region_fails():
"""
Check that extract region fails if nothing has been plotted.
"""
Figure()
with pytest.raises(GMTCLibError):
with clib.Session() as lib:
lib.extract_region()
def test_extract_region_two_figures():
"""
Extract region should handle multiple figures existing at the same time.
"""
# Make two figures before calling extract_region to make sure that it's
# getting from the current figure, not the last figure.
fig1 = Figure()
region1 = np.array([0, 10, -20, -10])
fig1.coast(region=region1, projection="M6i", frame=True, land="black")
fig2 = Figure()
fig2.basemap(region="US.HI+r5", projection="M6i", frame=True)
# Activate the first figure and extract the region from it
# Use in a different session to avoid any memory problems.
with clib.Session() as lib:
lib.call_module("figure", "{} -".format(fig1._name))
with clib.Session() as lib:
wesn1 = lib.extract_region()
npt.assert_allclose(wesn1, region1)
# Now try it with the second one
with clib.Session() as lib:
lib.call_module("figure", "{} -".format(fig2._name))
with clib.Session() as lib:
wesn2 = lib.extract_region()
npt.assert_allclose(wesn2, np.array([-165.0, -150.0, 15.0, 25.0]))
def test_write_data_fails():
"""
Check that write data raises an exception for non-zero return codes.
"""
# It's hard to make the C API function fail without causing a Segmentation
# Fault. Can't test this if by giving a bad file name because if
# output=='', GMT will just write to stdout and spaces are valid file
# names. Use a mock instead just to exercise this part of the code.
with clib.Session() as lib:
with mock(lib, "GMT_Write_Data", returns=1):
with pytest.raises(GMTCLibError):
lib.write_data(
"GMT_IS_VECTOR",
"GMT_IS_POINT",
"GMT_WRITE_SET",
[1] * 6,
"some-file-name",
None,
)
def test_dataarray_to_matrix_works():
"""
Check that dataarray_to_matrix returns correct output.
"""
data = np.diag(v=np.arange(3))
x = np.linspace(start=0, stop=4, num=3)
y = np.linspace(start=5, stop=9, num=3)
grid = xr.DataArray(data, coords=[("y", y), ("x", x)])
matrix, region, inc = dataarray_to_matrix(grid)
npt.assert_allclose(actual=matrix, desired=np.flipud(data))
npt.assert_allclose(actual=region, desired=[x.min(), x.max(), y.min(), y.max()])
npt.assert_allclose(actual=inc, desired=[x[1] - x[0], y[1] - y[0]])
def test_dataarray_to_matrix_negative_x_increment():
"""
Check if dataarray_to_matrix returns correct output with flipped x.
"""
data = np.diag(v=np.arange(3))
x = np.linspace(start=4, stop=0, num=3)
y = np.linspace(start=5, stop=9, num=3)
grid = xr.DataArray(data, coords=[("y", y), ("x", x)])
matrix, region, inc = dataarray_to_matrix(grid)
npt.assert_allclose(actual=matrix, desired=np.flip(data, axis=(0, 1)))
npt.assert_allclose(actual=region, desired=[x.min(), x.max(), y.min(), y.max()])
npt.assert_allclose(actual=inc, desired=[abs(x[1] - x[0]), abs(y[1] - y[0])])
def test_dataarray_to_matrix_negative_y_increment():
"""
Check that dataarray_to_matrix returns correct output with flipped y.
"""
data = np.diag(v=np.arange(3))
x = np.linspace(start=0, stop=4, num=3)
y = np.linspace(start=9, stop=5, num=3)
grid = xr.DataArray(data, coords=[("y", y), ("x", x)])
matrix, region, inc = dataarray_to_matrix(grid)
npt.assert_allclose(actual=matrix, desired=data)
npt.assert_allclose(actual=region, desired=[x.min(), x.max(), y.min(), y.max()])
npt.assert_allclose(actual=inc, desired=[abs(x[1] - x[0]), abs(y[1] - y[0])])
def test_dataarray_to_matrix_negative_x_and_y_increment():
"""
Check that dataarray_to_matrix returns correct output with flipped x/y.
"""
data = np.diag(v=np.arange(3))
x = np.linspace(start=4, stop=0, num=3)
y = np.linspace(start=9, stop=5, num=3)
grid = xr.DataArray(data, coords=[("y", y), ("x", x)])
matrix, region, inc = dataarray_to_matrix(grid)
npt.assert_allclose(actual=matrix, desired=np.fliplr(data))
npt.assert_allclose(actual=region, desired=[x.min(), x.max(), y.min(), y.max()])
npt.assert_allclose(actual=inc, desired=[abs(x[1] - x[0]), abs(y[1] - y[0])])
def test_dataarray_to_matrix_dims_fails():
"""
Check that it fails for > 2 dims.
"""
# Make a 3D regular grid
data = np.ones((10, 12, 11), dtype="float32")
x = np.arange(11)
y = np.arange(12)
z = np.arange(10)
grid = xr.DataArray(data, coords=[("z", z), ("y", y), ("x", x)])
with pytest.raises(GMTInvalidInput):
dataarray_to_matrix(grid)
def test_dataarray_to_matrix_inc_fails():
"""
Check that it fails for variable increments.
"""
data = np.ones((4, 5), dtype="float64")
x = np.linspace(0, 1, 5)
y = np.logspace(2, 3, 4)
grid = xr.DataArray(data, coords=[("y", y), ("x", x)])
with pytest.raises(GMTInvalidInput):
dataarray_to_matrix(grid)
def test_get_default():
"""
Make sure get_default works without crashing and gives reasonable results.
"""
with clib.Session() as lib:
assert lib.get_default("API_GRID_LAYOUT") in ["rows", "columns"]
assert int(lib.get_default("API_CORES")) >= 1
assert Version(lib.get_default("API_VERSION")) >= Version("6.2.0")
def test_get_default_fails():
"""
Make sure get_default raises an exception for invalid names.
"""
with clib.Session() as lib:
with pytest.raises(GMTCLibError):
lib.get_default("NOT_A_VALID_NAME")
def test_info_dict():
"""
Make sure the clib.Session.info dict is working.
"""
# Check if there are no errors or segfaults from getting all of the
# properties.
with clib.Session() as lib:
assert lib.info
# Mock GMT_Get_Default to return always the same string
def mock_defaults(api, name, value): # pylint: disable=unused-argument
"""
Put 'bla' in the value buffer.
"""
value.value = b"bla"
return 0
ses = clib.Session()
ses.create("test-session")
with mock(ses, "GMT_Get_Default", mock_func=mock_defaults):
# Check for an empty dictionary
assert ses.info
for key in ses.info:
assert ses.info[key] == "bla"
ses.destroy()
def test_fails_for_wrong_version():
"""
Make sure the clib.Session raises an exception if GMT is too old.
"""
# Mock GMT_Get_Default to return an old version
def mock_defaults(api, name, value): # pylint: disable=unused-argument
"""
Return an old version.
"""
if name == b"API_VERSION":
value.value = b"5.4.3"
else:
value.value = b"bla"
return 0
lib = clib.Session()
with mock(lib, "GMT_Get_Default", mock_func=mock_defaults):
with pytest.raises(GMTVersionError):
with lib:
assert lib.info["version"] != "5.4.3"
# Make sure the session is closed when the exception is raised.
with pytest.raises(GMTCLibNoSessionError):
assert lib.session_pointer
| 34.332108 | 85 | 0.60464 | 0 | 0 | [
-0.03496360033750534,
0.005786248482763767,
-0.010827362537384033,
-0.01843094266951084,
0.027976401150226593,
0.022427141666412354,
0.0023312715347856283,
0.00971538107842207,
-0.02217051573097706,
0.05582018941640854,
0.008992362767457962,
0.055002693086862564,
-0.004624738357961178,
-0.04343067854642868,
-0.0061635845340788364,
0.0231730155646801,
0.15459752082824707,
0.013463877141475677,
-0.01843913085758686,
0.009397909045219421,
-0.003838110016658902,
0.005438593216240406,
-0.0065499600023031235,
0.02771521545946598,
0.01639467105269432,
-0.012119932100176811,
0.08095699548721313,
0.010120389983057976,
-0.022722402587532997,
-0.03471021726727486,
-0.0032669012434780598,
0.014119332656264305,
0.021820856258273125,
0.04151226207613945,
-0.02068040519952774,
0.0014947035815566778,
0.002292253077030182,
-0.01327783428132534,
-0.0013152759056538343,
-0.007781739812344313,
0.008091085590422153,
0.040500689297914505,
0.006933920085430145,
-0.028446339070796967,
-0.029355471953749657,
-0.02315877005457878,
0.02824021875858307,
-0.02000437304377556,
0.011867640540003777,
-0.006207555998116732,
-0.013187226839363575,
0.02032952755689621,
0.044886551797389984,
-0.026442501693964005,
0.05019121244549751,
-0.043043624609708786,
0.02989755943417549,
-0.004214197862893343,
-0.012837739661335945,
0.012030313722789288,
-0.009324204176664352,
-0.00600143289193511,
0.002981374505907297,
-0.017307598143815994,
0.034157078713178635,
0.000947910244576633,
-0.04789550229907036,
-0.018444254994392395,
0.09555257856845856,
0.0013908309629186988,
-0.03311144560575485,
-0.004051607102155685,
0.01635989174246788,
-0.022369759157299995,
-0.030103029683232307,
-0.0014905468560755253,
-0.03786333277821541,
0.00020983217109460384,
0.010046293027698994,
-0.0008729950641281903,
-0.012477375566959381,
0.004956475459039211,
-0.0006254040636122227,
0.009309410117566586,
0.014756814576685429,
0.023904956877231598,
0.0434831827878952,
-0.015288208611309528,
0.06129714474081993,
-0.011352895759046078,
-0.012778929434716702,
-0.055949874222278595,
-0.056685227900743484,
-0.02075413428246975,
-0.075759656727314,
0.016439029946923256,
0.011862803250551224,
0.034271080046892166,
0.004077199846506119,
0.05690640211105347,
0.01900744065642357,
-0.026351159438490868,
0.015975330024957657,
-0.009359573014080524,
-0.00865913089364767,
0.0012723273830488324,
-0.02086484059691429,
0.03032820299267769,
0.023499269038438797,
-0.0030150979291647673,
0.002525650430470705,
0.0004234772059135139,
-0.026114683598279953,
-0.016866503283381462,
0.018802989274263382,
-0.03560802713036537,
0.00304254493676126,
0.012959984131157398,
0.017138708382844925,
0.03452638164162636,
0.010961922816932201,
-0.014295607805252075,
-0.000819722656160593,
-0.006243750918656588,
-0.01577574573457241,
0.1146044209599495,
-0.04797231778502464,
0.007863778620958328,
0.018721815198659897,
0.023163065314292908,
-0.010099557228386402,
0.004724413622170687,
-0.030345957726240158,
-0.02587299235165119,
0.027376873418688774,
0.01748712919652462,
0.015416219830513,
-0.0028924387879669666,
-0.052802130579948425,
-0.025262242183089256,
-0.017300693318247795,
-0.025740955024957657,
-0.005066177807748318,
-0.037759698927402496,
-0.015119188465178013,
-0.03823385760188103,
0.02611485682427883,
0.0017822707304731011,
-0.03360283747315407,
-0.02441159076988697,
-0.002644546329975128,
0.029979033395648003,
-0.006568001117557287,
0.02277948334813118,
0.0047811041586101055,
-0.0025450249668210745,
0.006187077146023512,
-0.04072023928165436,
-0.025089725852012634,
-0.027867143973708153,
-0.03147523105144501,
0.005384540650993586,
-0.000748131365980953,
0.006640313193202019,
0.015370287001132965,
-0.0050964271649718285,
-0.030036473646759987,
0.010085919871926308,
-0.0011263568885624409,
0.014101407490670681,
-0.03806820884346962,
-0.06470036506652832,
-0.006187372840940952,
-0.018328825011849403,
-0.028528602793812752,
-0.007528985384851694,
0.028339294716715813,
0.01790635660290718,
0.02010178752243519,
-0.009056005626916885,
-0.049700237810611725,
0.014273442327976227,
0.028198735788464546,
0.03331919386982918,
0.012563084252178669,
-0.02321537770330906,
-0.060710202902555466,
-0.01818414404988289,
0.02447257749736309,
0.020640447735786438,
0.0024962511379271746,
-0.0002128184278262779,
-0.024511678144335747,
-0.02026212215423584,
0.02567978762090206,
-0.027581343427300453,
0.0026181775610893965,
0.03254387900233269,
-0.006701203994452953,
-0.019567428156733513,
-0.013045701198279858,
-0.024732111021876335,
-0.03006165102124214,
0.010005524381995201,
0.005092402454465628,
0.015941312536597252,
-0.6512427926063538,
0.0669652670621872,
-0.0439971461892128,
0.025351032614707947,
0.007039498537778854,
0.020476266741752625,
-0.03172467276453972,
-0.0038946964778006077,
-0.013487325981259346,
-0.03398139029741287,
-0.024633662775158882,
0.0035378732718527317,
-0.01280590146780014,
0.0379595123231411,
0.018699530512094498,
-0.04881518706679344,
-0.00540000619366765,
0.0005346665275283158,
-0.0532069057226181,
0.02873089723289013,
0.03391636908054352,
0.035048238933086395,
-0.014167255721986294,
-0.0042050848715007305,
-0.037250667810440063,
-0.012166205793619156,
0.016577601432800293,
-0.008972564712166786,
-0.08046942949295044,
0.005194604862481356,
-0.05592033639550209,
-0.021347103640437126,
-0.011595242656767368,
-0.021239008754491806,
0.02980097569525242,
0.007776081096380949,
0.037195175886154175,
-0.03309059515595436,
0.014783247373998165,
-0.014300987124443054,
0.0026107614394277334,
-0.016170283779501915,
0.018999652937054634,
-0.06437278538942337,
-0.016361303627490997,
0.0024171422701328993,
-0.009964183904230595,
-0.05033702030777931,
0.021411975845694542,
0.02347300387918949,
-0.007846563123166561,
0.03463931381702423,
0.041647884994745255,
0.02547750063240528,
0.04552927240729332,
0.027203377336263657,
0.009995208121836185,
0.02114727720618248,
-0.01014062762260437,
-0.010751917958259583,
0.030800536274909973,
0.00824227835983038,
-0.009887708351016045,
0.024534691125154495,
0.021920964121818542,
-0.006340013816952705,
0.011727354489266872,
-0.031348224729299545,
0.04059185832738876,
0.0011696110013872385,
-0.02205371856689453,
0.024953698739409447,
-0.05131300166249275,
0.0506834015250206,
-0.0005128144402988255,
-0.020363759249448776,
0.0062739853747189045,
0.014877666719257832,
0.03073841892182827,
0.017095185816287994,
-0.0032504722476005554,
-0.03446611762046814,
0.02824590355157852,
-0.002522828057408333,
-0.022409651428461075,
0.04040277749300003,
0.0073254709132015705,
-0.01239688228815794,
-0.021510783582925797,
0.001756527810357511,
0.04160768911242485,
0.03665585815906525,
0.015642104670405388,
0.02017231099307537,
-0.003857906674966216,
0.037349212914705276,
-0.037723857909440994,
0.02586028166115284,
0.019639374688267708,
0.0172398891299963,
-0.03980051726102829,
-0.009908244013786316,
-0.03927149996161461,
-0.05653293803334236,
0.0017913238843902946,
0.003286997089162469,
-0.01348054688423872,
-0.02132621593773365,
0.09583140164613724,
-0.0547395683825016,
-0.03044361062347889,
-0.00011936701775994152,
-0.01044680830091238,
0.0017553633078932762,
0.04457830265164375,
-0.03603119030594826,
0.03722315654158592,
-0.02765243873000145,
0.01418281625956297,
0.008986043743789196,
0.03166556730866432,
-0.049196626991033554,
-0.024748964235186577,
0.02562085911631584,
0.0055314661003649235,
-0.007510330528020859,
-0.06899721920490265,
0.004747383762151003,
0.0007902149227447808,
0.02476688101887703,
0.006282983347773552,
-0.01169608999043703,
0.010881887748837471,
-0.0038326506037265062,
-0.030081983655691147,
0.009436070919036865,
-0.0153995081782341,
0.0060677421279251575,
-0.012079299427568913,
-0.037332817912101746,
-0.012098240666091442,
0.012752620503306389,
0.016643963754177094,
-0.027952618896961212,
0.0019346673507243395,
0.02612946555018425,
0.021707847714424133,
0.006808097008615732,
0.021889308467507362,
-0.03029949776828289,
0.015709049999713898,
0.027058251202106476,
-0.031900838017463684,
0.028049340471625328,
0.024287672713398933,
0.004145496524870396,
-0.0062423888593912125,
0.00696510449051857,
0.009286699816584587,
0.025599811226129532,
-0.006012503989040852,
-0.04166281968355179,
-0.07186863571405411,
0.004063394386321306,
0.015703128650784492,
-0.01581917516887188,
-0.01602843590080738,
0.03002893179655075,
-0.019161248579621315,
0.024276532232761383,
-0.019735977053642273,
-0.05414552241563797,
-0.0015450696228072047,
0.04036736115813255,
-0.030779164284467697,
0.023516420274972916,
-0.013233224861323833,
-0.037441451102495193,
-0.01456284150481224,
-0.01963902823626995,
0.013777201995253563,
0.031238654628396034,
-0.028774786740541458,
-0.008441245183348656,
0.016371479257941246,
0.031768109649419785,
-0.01902628131210804,
-0.033261802047491074,
-0.0016371519304811954,
-0.0339154377579689,
0.0060028755106031895,
-0.01683613657951355,
-0.012291969731450081,
-0.0046732379123568535,
-0.03967629373073578,
-0.002979148179292679,
-0.0445791631937027,
0.0010474638547748327,
0.0130514707416296,
-0.009769493713974953,
0.006397909484803677,
0.006997357588261366,
0.029401391744613647,
-0.006132603622972965,
-0.021262340247631073,
0.04989583045244217,
-0.02733483351767063,
0.027430951595306396,
-0.03874236345291138,
-0.030277838930487633,
0.009144251234829426,
-0.02793615683913231,
0.040243279188871384,
-0.01162959448993206,
0.0010917765321210027,
0.02190556190907955,
0.0008347418042831123,
-0.01495442632585764,
0.013696258887648582,
-0.007617791183292866,
-0.022078288719058037,
-0.07033199071884155,
0.046507880091667175,
-0.0035264340694993734,
-0.016577139496803284,
-0.018161499872803688,
-0.03299516439437866,
-0.005650732200592756,
-0.00805535539984703,
0.009948797523975372,
0.0360012948513031,
-0.020277859643101692,
0.0006695559131912887,
-0.0025868932716548443,
-0.027401138097047806,
0.035069894045591354,
0.02309679053723812,
-0.04703361913561821,
-0.0266141165047884,
0.03547152131795883,
-0.010448048822581768,
-0.005105276126414537,
0.010613780468702316,
0.011733110062777996,
-0.023635944351553917,
-0.02062029018998146,
0.024792252108454704,
-0.09802990406751633,
-0.04395023360848427,
0.009923494420945644,
-0.03447939082980156,
0.06717157363891602,
0.035827890038490295,
-0.0016729315975680947,
0.017091307789087296,
0.001390378805808723,
0.02570514939725399,
0.01954377070069313,
-0.011620352044701576,
-0.013758335262537003,
-0.00849420391023159,
-0.04597251117229462,
-0.014346095733344555,
-0.029015960171818733,
0.0051437863148748875,
0.041504960507154465,
-0.010839803144335747,
-0.018595537170767784,
0.03316805511713028,
0.05734183266758919,
-0.028999201953411102,
-0.009246992878615856,
-0.03127003461122513,
-0.019026024267077446,
0.0016783947357907891,
-0.019525855779647827,
0.01529010757803917,
0.013397732749581337,
-0.008512074127793312,
0.00045508917537517846,
-0.018188437446951866,
-0.0018881451105698943,
0.0632869079709053,
0.01628565974533558,
-0.02364872582256794,
0.03141603618860245,
0.004875305108726025,
-0.017341194674372673,
-0.061671845614910126,
0.011156992055475712,
0.02664872445166111,
-0.003184715984389186,
0.010604366660118103,
0.012298546731472015,
0.00914761796593666,
-0.01034211739897728,
-0.01946328952908516,
-0.005199103616178036,
0.00016253111243713647,
0.02486349456012249,
0.035255663096904755,
-0.015211723744869232,
-0.017033733427524567,
0.00962806772440672,
-0.007576087024062872,
0.011676478199660778,
0.0253433920443058,
-0.04859648644924164,
0.022534610703587532,
0.018714837729930878,
0.018823876976966858,
0.021357666701078415,
-0.018479259684681892,
0.041168730705976486,
-0.019489089027047157,
0.01820412650704384,
0.002108998829498887,
0.025338299572467804,
0.042945701628923416,
-0.014416700229048729,
-0.0039261444471776485,
-0.0067223492078483105,
-0.009790467098355293,
-0.020874090492725372,
-0.012761730700731277,
-0.020600585266947746,
-0.0036860941909253597,
-0.06041194871068001,
0.04555682837963104,
0.017447926104068756,
-0.04196019470691681,
-0.0161338709294796,
-0.03360889479517937,
0.014889516867697239,
-0.001121504115872085,
-0.022449398413300514,
0.024874454364180565,
0.028092442080378532,
0.02706919051706791,
0.036526452749967575,
-0.01684529520571232,
-0.016420524567365646,
-0.013287495821714401,
0.018218684941530228,
0.015067094005644321,
0.000330804759869352,
-0.018016280606389046,
-0.007081130985170603,
0.04231928661465645,
0.050495631992816925,
-0.034396108239889145,
-0.01222875528037548,
-0.034565627574920654,
0.020173517987132072,
0.010383658111095428,
0.027215678244829178,
0.013501323759555817,
-0.020807646214962006,
0.015819689258933067,
0.0055793761275708675,
-0.03140087053179741,
0.008326079696416855,
-0.0399683453142643,
-0.00573392491787672,
-0.013752263970673084,
-0.03440067544579506,
0.02139103412628174,
-0.02449173852801323,
-0.017632147297263145,
0.017993126064538956,
-0.0020786214154213667,
0.0008204926853068173,
-0.011794596910476685,
0.03386539965867996,
-0.009061239659786224,
0.03988507762551308,
-0.0065290541388094425,
-0.037609875202178955,
-0.012509007006883621,
0.011281215585768223,
-0.024990497156977654,
-0.0006818469846621156,
-0.0040902867913246155,
0.005154090467840433,
0.043039917945861816,
0.04972565546631813,
-0.004911353345960379,
0.047816433012485504,
0.01417122595012188,
0.001776946592144668,
0.0394180566072464,
-0.021390791982412338,
0.020388904958963394,
0.012388771399855614,
-0.005240376107394695,
-0.01321073342114687,
0.0054844580590724945,
-0.032399412244558334,
0.02285527065396309,
-0.004047834314405918,
-0.00002383046012255363,
0.030913764610886574,
0.03104609251022339,
-0.007862838916480541,
0.03038286417722702,
-0.024320436641573906,
0.0415022112429142,
-0.004583623260259628,
-0.0011532810749486089,
0.05580640211701393,
-0.011560375802218914,
0.03553060442209244,
-0.017821749672293663,
-0.04289598762989044,
0.014246130362153053,
0.007462724577635527,
0.001030043000355363,
0.02490304969251156,
0.00009780352411326021,
0.057848818600177765,
0.0029432696755975485,
-0.025255288928747177,
0.015371808782219887,
-0.04223572835326195,
-0.0231618769466877,
0.01389880571514368,
0.00834013894200325,
0.025868218392133713,
0.014709400944411755,
-0.007735687308013439,
-0.003937786445021629,
-0.044068843126297,
0.011434503830969334,
-0.013574575074017048,
-0.004107204731553793,
-0.021488381549715996,
0.005910367704927921,
-0.034733470529317856,
0.005289063788950443,
-0.01474402192980051,
0.004187532234936953,
0.008378970436751842,
-0.014667983166873455,
0.017344841733574867,
-0.020767897367477417,
-0.12142554670572281,
0.010338288731873035,
-0.01613798551261425,
0.033091697841882706,
-0.02197255752980709,
0.004587954375892878,
0.039111021906137466,
0.02754111960530281,
0.019709864631295204,
0.014546439051628113,
0.027763521298766136,
0.003731305478140712,
0.017053240910172462,
0.02288394421339035,
0.001741490326821804,
0.01561962440609932,
-0.005321759730577469,
0.039265431463718414,
0.029758458957076073,
-0.0034102988429367542,
0.027080291882157326,
0.027115322649478912,
-0.05044635385274887,
-0.023290269076824188,
-0.0012141225161030889,
-0.01058154460042715,
0.008562092669308186,
-0.005664573982357979,
0.02372937649488449,
-0.00477640749886632,
-0.006251951213926077,
-0.015177365392446518,
0.011485659517347813,
-0.0032955592032521963,
0.0071748909540474415,
-0.03977656364440918,
0.013046130537986755,
0.03038793057203293,
-0.012030043639242649,
0.01367664709687233,
-0.00929594598710537,
-0.03130851686000824,
0.009254380129277706,
-0.03171486780047417,
-0.010161146521568298,
-0.012950906530022621,
-0.034753307700157166,
-0.017150206491351128,
-0.00022982880182098597,
0.032264988869428635,
-0.03792714327573776,
0.005549062509089708,
0.007004403509199619,
0.04489368200302124,
-0.0006034074467606843,
0.027376538142561913,
-0.05997275188565254,
0.014783424325287342,
-0.02413780242204666,
0.012875117361545563,
0.032677941024303436,
-0.0036137395072728395,
0.0029263778124004602,
-0.03458726778626442,
-0.011143490672111511,
-0.01747293397784233,
-0.022305957973003387,
-0.04208255186676979,
-0.021129218861460686,
0.009575437754392624,
0.022709764540195465,
0.053007613867521286,
-0.034077856689691544,
0.02618550881743431,
-0.004847180098295212,
-0.001981674460694194,
-0.028014615178108215,
0.0011781370267271996,
0.017172643914818764,
-0.014097590930759907,
0.03504520654678345,
-0.027606787160038948,
0.020042849704623222,
-0.01271407026797533,
-0.013506471179425716,
0.02207474783062935,
-0.0018190763657912612,
-0.02343880571424961,
-0.011464634910225868,
0.05130521208047867,
-0.02642822265625,
0.008635484613478184,
0.013378774747252464,
-0.014261886477470398,
-0.03352268040180206,
-0.017733238637447357,
0.07108450680971146,
-0.04144033417105675,
0.0014014544431120157,
-0.007447537966072559,
0.007943738251924515,
0.020749574527144432,
0.041923731565475464,
0.0009015649557113647,
0.018192743882536888,
-0.005945566575974226,
-0.024101700633764267,
-0.024925395846366882,
0.00914842914789915,
0.013028169050812721,
-0.020010141655802727,
-0.0009861578000709414,
0.05130599066615105,
0.010359400883316994,
0.0014405632391571999,
-0.011815217323601246,
0.0159393772482872
] |
8a9030707f61608d50658393cbb2098e6e4bfbb7 | 300 | py | Python | stubs/_pytest/_code.py | questioneer-ltd/scrut | 8cb914c9c35eee0d9e17a6051683c970db2649b5 | [
"MIT"
] | null | null | null | stubs/_pytest/_code.py | questioneer-ltd/scrut | 8cb914c9c35eee0d9e17a6051683c970db2649b5 | [
"MIT"
] | null | null | null | stubs/_pytest/_code.py | questioneer-ltd/scrut | 8cb914c9c35eee0d9e17a6051683c970db2649b5 | [
"MIT"
] | null | null | null | """Type stubs for _pytest._code."""
# This class actually has more functions than are specified here.
# We don't use these features, so I don't think its worth including
# them in our type stub. We can always change it later.
class ExceptionInfo:
@property
def value(self) -> Exception: ...
| 33.333333 | 67 | 0.72 | 1 | 0.7251 | [
0.002453458495438099,
0.02416103519499302,
0.007405530661344528,
0.0025657156948000193,
0.006597473286092281,
-0.006107100751250982,
-0.008758257143199444,
0.004009876400232315,
-0.004893239121884108,
0.00006365862645907328,
0.0012949196388944983,
0.003872303292155266,
0.005037880502641201,
-0.015131630003452301,
0.00100697111338377,
0.01889912597835064,
-0.05613454431295395,
0.004507170524448156,
-0.0074375588446855545,
0.004830694291740656,
-0.008051835931837559,
0.008955464698374271,
0.00818412285298109,
0.006913220509886742,
0.005641988944262266,
-0.00010439156903885305,
0.007534861098974943,
0.001014009234495461,
-0.006539666559547186,
-0.006668382789939642,
0.0026402652729302645,
-0.001483617932535708,
-0.00636181328445673,
-0.008121944032609463,
0.006036096252501011,
-0.0015552829718217254,
-0.0008376598125323653,
-0.017061978578567505,
0.009122558869421482,
-0.004472719505429268,
-0.00939762219786644,
-0.020031888037919998,
-0.0001247702311957255,
0.006169680971652269,
-0.010527669452130795,
0.004854374565184116,
-0.0010805678321048617,
0.0035858547780662775,
-0.00991587433964014,
0.005454718135297298,
-0.009517301805317402,
0.0061394586227834225,
0.01170238759368658,
0.003567612264305353,
-0.007058628834784031,
-0.006393208168447018,
0.011542187072336674,
-0.000026128233002964407,
-0.009769750759005547,
0.0008889259770512581,
-0.006113952957093716,
-0.0046690418384969234,
0.001785414176993072,
0.0025705413427203894,
-0.015082220546901226,
-0.005277345888316631,
-0.004242511931806803,
0.0033597045112401247,
-0.0014299678150564432,
0.0072416020557284355,
0.0008881199755705893,
-0.0031068010721355677,
0.008471962064504623,
0.0024954837281256914,
0.004309403244405985,
-0.0034379090648144484,
-0.00006909407238708809,
-0.0009331743931397796,
0.009020110592246056,
0.0010270262137055397,
0.005679253488779068,
-0.009644420817494392,
0.005850248970091343,
0.009423742070794106,
0.012264586053788662,
0.010329576209187508,
0.018573187291622162,
-0.007399011868983507,
0.04294075071811676,
0.008636439219117165,
-0.009091394022107124,
0.001070045051164925,
-0.00594513351097703,
-0.0024044278543442488,
-0.0021218310575932264,
-0.027802128344774246,
-0.00021223363000899553,
-0.004166116937994957,
-0.00046620427747257054,
0.004331956617534161,
-0.002884542802348733,
0.005188948009163141,
-0.0030255443416535854,
-0.00023367127869278193,
-0.00904947891831398,
0.012001654133200645,
-0.010555445216596127,
-0.00030770551529712975,
0.006447129882872105,
0.0017593571683391929,
-0.013047672808170319,
-0.001699355081655085,
0.002098629716783762,
-0.013049298897385597,
0.0031353242229670286,
0.0010285533498972654,
-0.007022383622825146,
0.05665023252367973,
-0.0005135215469636023,
0.0031870566308498383,
-0.004919474013149738,
0.001057020272128284,
0.0018898571142926812,
0.005175849888473749,
0.009382334537804127,
-0.005704983603209257,
0.011942058801651001,
0.006527270190417767,
0.003430659184232354,
0.007268050219863653,
-0.0005032934132032096,
0.00789500493556261,
-0.003549793269485235,
-0.003466572379693389,
-0.000030250856070779264,
-0.006712418980896473,
0.007763589266687632,
0.0009812571806833148,
-0.005569068714976311,
-0.0005048790480941534,
-0.002673537703230977,
-0.010589123703539371,
0.0012754396302625537,
-0.005182803608477116,
0.0035402250941842794,
-0.009640843607485294,
-0.001740121515467763,
-0.005680244881659746,
-0.0020592885557562113,
0.002434437396004796,
0.00915211159735918,
0.0028038285672664642,
0.00518768560141325,
-0.007000526413321495,
-0.0066273631528019905,
-0.003091125749051571,
-0.006120924372226,
-0.0009180671186186373,
0.006465604063123465,
0.004773816559463739,
-0.008012288250029087,
-0.0031998436897993088,
0.0038060881197452545,
0.004473650828003883,
-0.002125016413629055,
0.0003625298850238323,
-0.010145530104637146,
0.007018745876848698,
0.0022846306674182415,
0.0040749963372945786,
0.010187984444200993,
-0.004492425825446844,
-0.00021353874763008207,
-0.0005418366636149585,
0.00180054921656847,
-0.00017040064267348498,
0.004985373001545668,
0.005088499281555414,
-0.005748264957219362,
-0.0043554059229791164,
0.0033664570655673742,
0.003631575731560588,
0.012199087999761105,
0.008552242070436478,
-0.0009394896333105862,
0.0024438300170004368,
-0.0023193543311208487,
-0.00007692563667660579,
0.005195546429604292,
-0.00426257262006402,
0.010303264483809471,
0.0017856042832136154,
-0.013002773746848106,
-0.008927734568715096,
-0.0006531491526402533,
-0.010895569808781147,
0.0018629156984388828,
0.01746702566742897,
0.010664815083146095,
0.0005213164258748293,
0.0036501477006822824,
-0.011204352602362633,
0.003191406838595867,
0.006243239622563124,
0.0013968580169603229,
-0.013820985332131386,
-0.9561452865600586,
0.004940375220030546,
0.002316243015229702,
-0.0021755259949713945,
0.0023171305656433105,
0.0004292111552786082,
0.0026935937348753214,
0.0035507488064467907,
0.012876800261437893,
-0.008069324307143688,
-0.0073935785330832005,
-0.00895688310265541,
-0.012239782139658928,
0.0011751838028430939,
-0.005661203525960445,
-0.003943695221096277,
-0.005800524260848761,
-0.006098864134401083,
0.0003238741774111986,
-0.004874239210039377,
-0.0017366879619657993,
0.011795395985245705,
-0.0008220419986173511,
0.004661514889448881,
0.004427941981703043,
0.004104358609765768,
-0.004694630857557058,
0.0016383427428081632,
-0.0028803590685129166,
0.0010965988039970398,
-0.0074752322398126125,
-0.01482355035841465,
-0.0034092317800968885,
-0.004034859128296375,
0.015381967648863792,
-0.0015709337312728167,
0.006889559794217348,
0.0002512121864128858,
0.00011318361066514626,
-0.010984477587044239,
0.005997053347527981,
0.0010714262025430799,
0.0070778136141598225,
-0.03205655887722969,
-0.0005204169428907335,
-0.002333227777853608,
-0.007562046404927969,
0.008150952868163586,
0.0024815252982079983,
-0.0016308703925460577,
-0.00034470570972189307,
-0.005159785971045494,
0.01059282198548317,
-0.0072612580843269825,
0.002114803995937109,
-0.002717614406719804,
-0.005554815288633108,
-0.0029145055450499058,
-0.01064623799175024,
0.0015611397102475166,
0.006913837511092424,
-0.0034263390116393566,
-0.0020051859319210052,
-0.0038906403351575136,
0.0013254787772893906,
0.00021789268066640943,
-0.001809160690754652,
-0.014224749989807606,
-0.006034369580447674,
-0.0031327279284596443,
0.004199569579213858,
-0.0013244588626548648,
-0.002187089528888464,
0.003212530165910721,
-0.01188642904162407,
0.00697971461340785,
0.0013590864837169647,
0.0010398082667961717,
-0.006560697685927153,
0.0027482635341584682,
-0.006552711129188538,
-0.010233619250357151,
0.003807638306170702,
-0.0046724071726202965,
-0.005000893492251635,
0.002749283332377672,
0.004644297529011965,
0.006913924124091864,
-0.004022629931569099,
0.0045013087801635265,
0.010970218107104301,
-0.005914549808949232,
-0.006490546278655529,
0.006876858416944742,
0.004648639354854822,
0.0003771127085201442,
-0.0002881994587369263,
0.00037524968502111733,
0.007257688790559769,
0.008261341601610184,
0.0019438512390479445,
0.0045071798376739025,
0.0006539110909216106,
0.010922244749963284,
0.0018757317448034883,
0.0042819310910999775,
-0.00045520084677264094,
-0.0026926810387521982,
-0.004382211249321699,
-0.0023543036077171564,
-0.005833844654262066,
-0.0017448770813643932,
-0.0114865992218256,
-0.010572251863777637,
-0.00488258758559823,
0.0004743219760712236,
0.0016718575498089194,
-0.0055788797326385975,
0.0013627425068989396,
0.00278106820769608,
0.011888680048286915,
0.002877219347283244,
-0.001511402428150177,
0.0023474805057048798,
0.004197520203888416,
-0.011162498965859413,
0.01241716742515564,
-0.012101798318326473,
0.005989059805870056,
-0.0032135986257344484,
-0.012339639477431774,
0.010381381027400494,
0.010394075885415077,
-0.010069875977933407,
0.0027983812615275383,
0.0024407871533185244,
-0.0003814030496869236,
0.0008966955356299877,
-0.007778325118124485,
-0.003233213210478425,
-0.016992531716823578,
-0.0017776978202164173,
0.02063574269413948,
0.0008992850780487061,
0.012987305410206318,
0.012016459368169308,
-0.002666200278326869,
0.0009853949304670095,
0.006994320545345545,
0.0035865840036422014,
0.012794416397809982,
-0.012040067464113235,
-0.000933946343138814,
-0.0019931846763938665,
-0.004636027384549379,
0.0012474365066736937,
0.00471338490024209,
0.005403230898082256,
-0.002909156261011958,
0.0013806710485368967,
-0.007452037651091814,
-0.005887046921998262,
-0.017909463495016098,
-0.0010014408035203815,
0.012338591739535332,
-0.004653326701372862,
0.006277612876147032,
-0.01195499487221241,
0.002726228442043066,
0.004529915750026703,
0.0003614543820731342,
-0.00010151749302167445,
0.003289729356765747,
0.007133899722248316,
0.01115680206567049,
-0.006309169344604015,
0.006057255901396275,
-0.00029643491143360734,
-0.0025840739253908396,
0.003968891222029924,
0.010331155732274055,
-0.005406766198575497,
-0.004987600725144148,
0.0022002237383276224,
-0.0009709713631309569,
0.004312236327677965,
-0.002200729912146926,
-0.011134479194879532,
-0.0015509463846683502,
0.005694850347936153,
-0.005968477576971054,
0.0035469073336571455,
0.0044615501537919044,
0.0029352393466979265,
-0.009096857160329819,
0.00007333966641454026,
-0.003470210125669837,
-0.007993015460669994,
0.011358696967363358,
-0.003955083433538675,
0.00462562870234251,
0.012723635882139206,
0.00660206563770771,
-0.01344521064311266,
0.0075684646144509315,
0.006180321332067251,
-0.0037125968374311924,
0.005723918322473764,
0.007208728697150946,
-0.0043459380976855755,
-0.02228860929608345,
-0.002794132102280855,
-0.017842784523963928,
0.006213839165866375,
-0.0024366818834096193,
0.004039087798446417,
-0.006165576167404652,
0.008883718401193619,
0.004600656218826771,
-0.014194018207490444,
-0.0056587387807667255,
-0.010746931657195091,
0.010408258065581322,
-0.001089457655325532,
-0.00048161105951294303,
-0.005057839211076498,
-0.0029973099008202553,
-0.003687423886731267,
-0.0010358385043218732,
0.0014639162691310048,
0.006055024452507496,
0.003136366605758667,
-0.005901585333049297,
0.0006686151609756052,
-0.006544542498886585,
0.0027205755468457937,
0.005231346469372511,
-0.010936396196484566,
0.00027519805007614195,
0.008932993747293949,
-0.002741731470450759,
-0.006288337986916304,
-0.0002665452193468809,
-0.0023407996632158756,
-0.006970062851905823,
-0.012530485168099403,
-0.004972053226083517,
-0.0038538211956620216,
-0.0028962832875549793,
-0.008563249371945858,
-0.0005262753111310303,
-0.007953681983053684,
0.005342570133507252,
-0.008270313031971455,
0.00540099898353219,
0.006085765082389116,
-0.002250355202704668,
0.009398911148309708,
-0.002441180869936943,
0.002596881939098239,
0.002363669453188777,
0.0034831680823117495,
0.0009414101950824261,
-0.007095662411302328,
-0.012006150558590889,
0.0149242477491498,
-0.011957301758229733,
-0.0002783602976705879,
0.012365222908556461,
0.006193453446030617,
0.008982722647488117,
-0.0027300799265503883,
0.0001941435766639188,
0.00419849855825305,
0.009329439140856266,
-0.016053175553679466,
0.003037640592083335,
0.00010797682625707239,
-0.002864585956558585,
0.004731427878141403,
-0.002320806263014674,
0.0008251160033978522,
0.007829627953469753,
0.000005367960056901211,
-0.008661937899887562,
-0.004723685793578625,
-0.0006832998478785157,
0.004379705525934696,
-0.010273417457938194,
-0.0007774339755997062,
-0.006171749904751778,
-0.004962516948580742,
-0.003998307511210442,
-0.001572993234731257,
-0.0014872952597215772,
0.005875846371054649,
-0.0025630579330027103,
0.003432345576584339,
0.0015695132315158844,
-0.004364812280982733,
0.01573229767382145,
-0.004467408172786236,
-0.008247976191341877,
0.0016272712964564562,
0.0004885836387984455,
0.00021590100368484855,
-0.00741775706410408,
-0.0066720955073833466,
0.003536543808877468,
0.00481977965682745,
-0.0011780030326917768,
-0.006135527975857258,
-0.0033014463260769844,
0.0011758859036490321,
-0.0064658778719604015,
0.0027051318902522326,
0.009102835319936275,
0.0009007968474179506,
0.005011563189327717,
-0.002080231672152877,
-0.00613773288205266,
-0.012002724222838879,
0.054664354771375656,
-0.0033768564462661743,
0.0014785180101171136,
0.006061925552785397,
-0.007594184018671513,
-0.0020978334359824657,
-0.004035682883113623,
0.00719806831330061,
-0.008570201694965363,
-0.005343643482774496,
0.009878694079816341,
-0.0018445684108883142,
0.003381171030923724,
0.0004846293886657804,
-0.003224079729989171,
0.014747794717550278,
-0.004423364065587521,
-0.01599571295082569,
-0.013016953133046627,
0.00825166329741478,
-0.003326776437461376,
-0.009037173353135586,
0.009345761500298977,
-0.001316939597018063,
-0.003520317142829299,
0.0029613745864480734,
0.006773126311600208,
-0.00016944916569627821,
0.00027078186394646764,
-0.0010982451494783163,
-0.0016135507030412555,
0.0029992391355335712,
0.003140147775411606,
0.008858985267579556,
0.005865794140845537,
-0.005376058630645275,
0.006718839053064585,
-0.0009488830110058188,
-0.0010783405741676688,
0.0010185306891798973,
0.002991748508065939,
0.007813817821443081,
-0.004255802370607853,
-0.004744752775877714,
0.0041125076822936535,
0.006346655078232288,
-0.0010474685113877058,
0.01100065652281046,
0.002248981036245823,
-0.0034872563555836678,
0.007032233756035566,
0.00817580334842205,
-0.0017723446944728494,
0.006660348270088434,
-0.00332549586892128,
0.003515348071232438,
-0.00013655249495059252,
-0.006462289020419121,
-0.014112863689661026,
-0.0006830187630839646,
0.0031031747348606586,
0.006271401885896921,
-0.0011685339268296957,
0.003291337052360177,
0.001756093348376453,
-0.0030485126189887524,
-0.00783994235098362,
-0.004793184343725443,
-0.005330197513103485,
-0.001014792243950069,
0.001358168781735003,
0.07015559822320938,
-0.008009878918528557,
-0.0023995882365852594,
-0.009717559441924095,
0.0008996237302199006,
-0.0008957490208558738,
-0.0002495956141501665,
-0.0007878377218730748,
-0.0030130776576697826,
0.00534310145303607,
0.0019579443614929914,
-0.007185192778706551,
-0.010832281783223152,
0.0009102987824007869,
0.0033533992245793343,
-0.0024458542466163635,
0.003335034241899848,
0.006450775545090437,
-0.007063905242830515,
0.002781689865514636,
-0.0125622833147645,
-0.0019634210038930178,
-0.00414355518296361,
-0.007156247738748789,
-0.004455824848264456,
-0.003682156093418598,
0.006571554578840733,
0.0024451143108308315,
0.006791748106479645,
-0.003945221193134785,
0.008246108889579773,
-0.0029235039837658405,
0.0016145793488249183,
-0.003348061814904213,
-0.0026335318107157946,
-0.006894142832607031,
0.004548543598502874,
0.0008647201466374099,
-0.01175491139292717,
-0.003210775787010789,
-0.005763625260442495,
0.002770707942545414,
-0.006695235148072243,
0.0071469685062766075,
0.0009989095851778984,
0.010915415361523628,
-0.0010701552964746952,
-0.00015374891518149525,
-0.006337286438792944,
0.00036753673339262605,
-0.01231263019144535,
0.002254020655527711,
-0.18222059309482574,
0.008805300109088421,
0.00438198447227478,
-0.004019932355731726,
-0.002631035167723894,
-0.014350974932312965,
-0.008769211359322071,
0.0052934265695512295,
0.008493113331496716,
-0.0025166014675050974,
0.0005767786642536521,
-0.005264408886432648,
0.006491012405604124,
0.002234815387055278,
-0.0011582672595977783,
-0.004904304165393114,
0.0012849833583459258,
-0.002769382670521736,
0.0009603999787941575,
0.0057234796695411205,
0.005289488472044468,
0.008745213970541954,
0.0032997550442814827,
-0.002004760317504406,
-0.00023102898558136076,
-0.006287005729973316,
0.007338670082390308,
-0.0030364261474460363,
0.0065141660161316395,
-0.01202486827969551,
-0.0010043908841907978,
-0.00560255441814661,
-0.008073706179857254,
0.0003396168176550418,
0.003335219342261553,
-0.0014423606917262077,
0.00846246350556612,
0.003958879970014095,
-0.009590541012585163,
0.006696569267660379,
-0.007244935259222984,
0.028405798599123955,
0.0063856737688183784,
0.005973439663648605,
-0.0018072627717629075,
-0.00428438326343894,
-0.004237483721226454,
0.009291376918554306,
0.0016358871944248676,
0.012581019662320614,
-0.009317539632320404,
-0.006165946368128061,
0.003550064517185092,
0.018164994195103645,
-0.00727511290460825,
-0.008547783829271793,
-0.008874088525772095,
-0.005459402687847614,
0.005435203667730093,
0.009952627122402191,
0.011265735141932964,
-0.005697720684111118,
0.008940777741372585,
-0.005310841836035252,
-0.01841663010418415,
0.0027428199537098408,
-0.003454071469604969,
-0.010656807571649551,
0.0009554207208566368,
0.006266266107559204,
0.008830557577311993,
-0.0015286158304661512,
0.0045434217900037766,
-0.0005192994140088558,
0.004148057661950588,
-0.000054937085224082693,
0.006409946829080582,
-0.0036101811565458775,
0.005373431835323572,
-0.007184410467743874,
0.010688193142414093,
-0.010665101930499077,
-0.003675849875435233,
0.0032405753154307604,
-0.004674968309700489,
0.014234294183552265,
0.006506263744086027,
0.0006449901848100126,
-0.0007009419496171176,
-0.010216993279755116,
-0.0025342460721731186,
0.004061454441398382,
-0.0007990241283550858,
-0.008275771513581276,
0.003445535898208618,
-0.0021118693985044956,
0.008883964270353317,
0.008112645708024502,
-0.004599603824317455,
0.005119101144373417,
0.006977248936891556,
-0.00810788944363594,
0.003166104666888714,
-0.006505241151899099,
0.002245043171569705,
0.004553154110908508,
-0.0068102250806987286,
-0.006936522666364908,
0.0047379303723573685,
-0.005492111202329397,
-0.005705793388187885,
0.0021286627743393183,
-0.012148197740316391,
-0.007435178384184837,
-0.003185438923537731,
-0.010995805263519287,
0.0021610839758068323
] |
8a9169fbe2dd0a7e667174a77f2109a3f57e8580 | 1,808 | py | Python | Prime Factorization/prime_factorization_II.py | rayvantsahni/Let-us-Math | 571ee70452feae0b15f37d46de658b0c0251bd3d | [
"MIT"
] | 2 | 2020-08-06T07:09:38.000Z | 2020-09-12T02:32:23.000Z | Prime Factorization/prime_factorization_II.py | rayvantsahni/Math-is-Fun | 571ee70452feae0b15f37d46de658b0c0251bd3d | [
"MIT"
] | null | null | null | Prime Factorization/prime_factorization_II.py | rayvantsahni/Math-is-Fun | 571ee70452feae0b15f37d46de658b0c0251bd3d | [
"MIT"
] | 1 | 2021-08-30T14:17:28.000Z | 2021-08-30T14:17:28.000Z | def get_primes(n):
primes = [] # stores the prime numbers within the reange of the number
sieve = [False] * (n + 1) # stores boolean values indicating whether a number is prime or not
sieve[0] = sieve[1] = True # marking 0 and 1 as not prime
for i in range(2, n + 1): # loops over all the numbers to check for prime numbers
if sieve[i]: # checks whether a number is not prime
continue # skips the loop if the number is not a prime number
primes.append(i) # adds a number into list if it is a prime number
for j in range(i ** 2, n + 1, i): # loops over all multiples of the prime number starting from the sqaure of the prime number
sieve[j] = True # marks the multiple of the prime number as not prime
return primes # returns the list containing prime numbers
def get_factorization(n):
prime_factors = [] # stores the prime factorization of the number
for prime in get_primes(n): # looping over all the prime numbers
while n != 1: # keeps diving the number by a certain prime number until the number is 1
if n % prime == 0: # checks if the number is divisible by a particular prime number
prime_factors.append(prime) # add the prime factor in the list if it divides the number
n /= prime # reducing the number after dividing it by the prime number
else:
break # if the number is not divisible by the paricular prime number then the inner loop breaks and the number is further divided by the next prime number until the number becomes 1
return prime_factors # returns the list containing the prime factorization of the number
if __name__ == "__main__":
n = int(input("Enter a number: "))
print(get_factorization(n))
| 54.787879 | 198 | 0.672566 | 1 | 1.2696 | [
0.00007703366281930357,
0.02954641729593277,
0.006347754038870335,
-0.001967474352568388,
0.003443509340286255,
-0.004625705536454916,
-0.014616062864661217,
0.007126697339117527,
-0.001605057856068015,
0.0025947955437004566,
0.002491359133273363,
0.0032819719053804874,
0.006895239464938641,
-0.01770128682255745,
0.0013422761112451553,
0.019260115921497345,
-0.05526425689458847,
0.004555184859782457,
-0.0019081729697063565,
0.002754600951448083,
-0.008523211814463139,
0.009589813649654388,
0.008935194462537766,
0.00804481003433466,
0.007346176076680422,
0.0013547096168622375,
0.011947017163038254,
0.006227588746696711,
-0.007572520524263382,
-0.003993139136582613,
-0.000207913777558133,
-0.001539984019473195,
-0.0032912571914494038,
-0.011203787289559841,
0.005220131482928991,
-0.004699162673205137,
0.00265489611774683,
-0.0171004980802536,
0.009929114021360874,
-0.00796364713460207,
-0.008053400553762913,
-0.017280705273151398,
-0.005797140300273895,
0.006813295651227236,
-0.012096058577299118,
0.002488966565579176,
-0.006145427469164133,
-0.001276259426958859,
-0.013130025006830692,
0.0034740713890641928,
-0.012373060919344425,
0.004243839997798204,
0.013042374514043331,
0.005160852335393429,
-0.00691335229203105,
-0.009834875352680683,
0.011900397017598152,
-0.0007979996153153479,
-0.014276119880378246,
0.001005995087325573,
-0.0011565301101654768,
-0.004297847393900156,
0.006809823680669069,
0.003163162851706147,
-0.017375292256474495,
-0.008551192469894886,
-0.003998896107077599,
0.0024749524891376495,
-0.004324580077081919,
0.003127568867057562,
0.0016055881278589368,
-0.00010404572094557807,
0.0073582688346505165,
0.0037803740706294775,
0.0022966358810663223,
-0.004187093116343021,
-0.006164880003780127,
-0.00022840355813968927,
0.008322055451571941,
0.0017656079726293683,
0.004486273508518934,
-0.00929249357432127,
0.006650878582149744,
0.012517683207988739,
0.01221268530935049,
0.008060019463300705,
0.019065601751208305,
-0.010442660190165043,
0.04176222160458565,
0.008901944383978844,
-0.0068638501688838005,
0.0018913416424766183,
-0.009625338017940521,
-0.0024648283142596483,
-0.002670526970177889,
-0.031020278111100197,
0.002388301771134138,
-0.005476430058479309,
-0.0010538067435845733,
0.004828471690416336,
0.0011744153453037143,
0.008362310007214546,
-0.00010708250920288265,
-0.0023942566476762295,
-0.010653401724994183,
0.014791498892009258,
-0.011883190833032131,
-0.0021559959277510643,
0.007784836459904909,
0.0032289493829011917,
-0.014693843200802803,
-0.003304427955299616,
0.0019106640247628093,
-0.011803146451711655,
0.004032377619296312,
0.0014113321667537093,
-0.006028144620358944,
0.05914553254842758,
-0.001134812249802053,
0.003065343014895916,
-0.00393358338624239,
-0.0019701046403497458,
-0.0002452346670906991,
0.006039148196578026,
0.00902456697076559,
-0.00591817032545805,
0.01348326075822115,
0.005912307649850845,
0.0009272099123336375,
0.009891322813928127,
-0.0013651767512783408,
0.009378890506923199,
-0.005884095095098019,
-0.0003595793677959591,
0.0016778942663222551,
-0.007636291906237602,
0.00656213890761137,
-0.0025631801690906286,
-0.004812897183001041,
0.0006469342042692006,
-0.0030830048490315676,
-0.013715110719203949,
0.0033345704432576895,
-0.00240582088008523,
0.0001000060947262682,
-0.009807061403989792,
-0.005846966989338398,
-0.005411285441368818,
-0.0038839697372168303,
-0.001112845609895885,
0.010639007203280926,
0.007132016588002443,
0.0017741088522598147,
-0.0051778401248157024,
-0.008159012533724308,
-0.00272188032977283,
-0.0037858649156987667,
0.0008485736325383186,
0.007318839896470308,
0.005947785452008247,
-0.011175691150128841,
-0.006642855703830719,
0.0019196269568055868,
0.003561790334060788,
-0.00018123506742995232,
0.0032169558107852936,
-0.008209006860852242,
0.011564700864255428,
-0.000058113633713219315,
0.005383129697293043,
0.010056091472506523,
-0.007356468588113785,
-0.0027299015782773495,
0.0015049081994220614,
0.004910558462142944,
0.0017196222906932235,
0.0033274304587394,
0.010934536345303059,
-0.0058208308182656765,
-0.006433060392737389,
0.006624870467931032,
0.0043671769089996815,
0.006235152017325163,
0.006090295035392046,
-0.003494470613077283,
0.0009617424802854657,
-0.0037203244864940643,
-0.0009063339093700051,
0.008921483531594276,
-0.004110398702323437,
0.008835304528474808,
0.005305379629135132,
-0.017122823745012283,
-0.008547915145754814,
-0.0004990492598153651,
-0.012149717658758163,
0.002300301333889365,
0.016230935230851173,
0.011384888552129269,
0.00028846116038039327,
0.0009616280440241098,
-0.012299671769142151,
0.00004123668622924015,
0.01025508251041174,
0.0012497900752350688,
-0.010937046259641647,
-0.9528123140335083,
0.005037637427449226,
0.0054632131941616535,
-0.0007100493530742824,
0.006948783993721008,
0.000610200222581625,
0.002728200051933527,
0.0047125364653766155,
0.014989226125180721,
-0.00906585156917572,
-0.006645945832133293,
-0.011563131585717201,
-0.013743494637310505,
-0.0012183887884020805,
-0.005923782009631395,
-0.004733337555080652,
-0.007038735318928957,
-0.008111558854579926,
-0.0023148544132709503,
-0.006012781988829374,
-0.0014559292467311025,
0.00888525415211916,
-0.0007147315191105008,
0.003310209373012185,
0.0040277885273098946,
0.0035694842226803303,
-0.004269388038665056,
-0.0014320494374260306,
0.0016760345315560699,
-0.0014997744001448154,
-0.009388824924826622,
-0.01672040857374668,
-0.0036780626978725195,
0.0019433657871559262,
0.013303248211741447,
0.002257442334666848,
0.008205470629036427,
-0.0016395191196352243,
0.001243454753421247,
-0.010393032804131508,
0.002067251829430461,
0.0003486293717287481,
0.003554298309609294,
-0.028272263705730438,
0.002890327014029026,
-0.0004577507497742772,
-0.00918362382799387,
0.0074728489853441715,
0.004311711061745882,
0.00021280716464389116,
-0.0027417615056037903,
-0.004439179785549641,
0.00934601854532957,
-0.009652789682149887,
0.00661829998716712,
-0.0033404843416064978,
-0.009124459698796272,
-0.0010535874171182513,
-0.01030606497079134,
0.0015926226042211056,
0.0042957705445587635,
-0.004589112941175699,
-0.004766608588397503,
-0.003952900879085064,
0.0034602105151861906,
0.0011764091905206442,
0.004476133268326521,
-0.01845976710319519,
-0.006893669255077839,
0.0008317053434439003,
0.002324182540178299,
0.0000464866534457542,
-0.008930002339184284,
0.005907917860895395,
-0.01131255179643631,
0.007315452676266432,
0.001963965827599168,
0.0006384195876307786,
-0.014111843891441822,
-0.00047831956180743873,
-0.008814699947834015,
-0.008513943292200565,
0.006102805957198143,
-0.006218216847628355,
-0.0038735957350581884,
0.0022291410714387894,
0.005122858099639416,
0.005502123385667801,
-0.007685152348130941,
0.0032327172812074423,
0.0131794149056077,
-0.0013500995701178908,
-0.011617266573011875,
0.008747690357267857,
0.008075058460235596,
0.0008340051281265914,
-0.001486217719502747,
0.005786655005067587,
0.005701684858649969,
0.007779435254633427,
-0.000725701916962862,
0.005307827144861221,
0.002150746528059244,
0.01121751219034195,
0.0014603197341784835,
0.0036434726789593697,
-0.0019190848106518388,
-0.00046803898294456303,
-0.007261158432811499,
-0.0005602171295322478,
-0.005112092010676861,
-0.001193910138681531,
-0.012144780717790127,
-0.010990248061716557,
-0.006037923973053694,
0.0055285305716097355,
0.0028879044111818075,
-0.0037485340144485235,
-0.0014105914160609245,
-0.00030207776580937207,
0.0086906049400568,
-0.005030161235481501,
-0.007759022060781717,
0.0011329007102176547,
0.0038025567773729563,
-0.008996054530143738,
0.015310163609683514,
-0.010183537378907204,
0.00731616048142314,
0.0020917055662721395,
-0.016293350607156754,
0.008483640849590302,
0.011161432601511478,
-0.00702989986166358,
0.0015865628374740481,
-0.00001777014767867513,
0.0015664497623220086,
0.0006920783198438585,
-0.005972493905574083,
-0.005227664019912481,
-0.018126413226127625,
0.0028940055053681135,
0.0238458514213562,
0.004316613543778658,
0.010208765044808388,
0.013155764900147915,
-0.004559837747365236,
0.004460026975721121,
0.004617615602910519,
-0.00006292912439676002,
0.014519719406962395,
-0.006818446330726147,
-0.003166072303429246,
0.003754793666303158,
-0.006218121387064457,
0.0031673582270741463,
0.0046588946133852005,
0.004301285371184349,
-0.00438973493874073,
0.0027105987537652254,
-0.003697691485285759,
-0.004107295069843531,
-0.017671799287199974,
-0.0007359615992754698,
0.010913200676441193,
-0.005405716132372618,
0.0030165358912199736,
-0.012750154361128807,
0.007101357448846102,
0.0055341413244605064,
0.0028599982615560293,
0.001663650618866086,
0.0022616295609623194,
0.004033988807350397,
0.011128565296530724,
-0.007573861163109541,
0.00099836231674999,
0.0038280372973531485,
0.0005420575616881251,
-0.0014343567891046405,
0.006382510997354984,
-0.009373491629958153,
-0.004030467011034489,
0.0003611741412896663,
0.0023065381683409214,
0.0010461857309564948,
-0.005420298781245947,
-0.008911163546144962,
-0.0032365263905376196,
0.004503236152231693,
-0.009196066297590733,
0.005590563174337149,
0.00022412634280044585,
0.0034764690790325403,
-0.008632100187242031,
0.0012247484410181642,
-0.0037885447964072227,
-0.012387152761220932,
0.009421116672456264,
-0.0021116312127560377,
0.0047698416747152805,
0.011684739962220192,
0.005281677469611168,
-0.011728351004421711,
0.006461460143327713,
0.00913507491350174,
-0.005572463385760784,
0.0036624546628445387,
0.006810230202972889,
-0.006294111255556345,
-0.024184392765164375,
0.0009404514566995203,
-0.012082109227776527,
0.007538669742643833,
-0.002013398567214608,
0.00195653666742146,
-0.00874190405011177,
0.0038017774932086468,
0.006593015510588884,
-0.012206587940454483,
-0.0066030328162014484,
-0.008700278587639332,
0.008328433148562908,
-0.00021091398957651109,
-0.004172974731773138,
-0.0038868323899805546,
-0.0024341903626918793,
-0.0018007963662967086,
-0.0030524367466568947,
-0.0022822623141109943,
0.0051791006699204445,
0.0025265878066420555,
-0.0030665479134768248,
0.003723111003637314,
-0.0016508257249370217,
0.003583755809813738,
0.0031918270979076624,
-0.009307035245001316,
0.005584250669926405,
0.005026132334023714,
0.0005243484629318118,
-0.0016411575488746166,
0.0020529399625957012,
-0.003127678297460079,
-0.004547596909105778,
-0.010644999332726002,
-0.0030670606065541506,
-0.002951826201751828,
-0.005561999976634979,
-0.011323855258524418,
-0.003620193572714925,
-0.011032001115381718,
0.005827105138450861,
-0.008723346516489983,
0.0076088672503829,
0.007910155691206455,
-0.004412834998220205,
0.0075758988969028,
-0.0044416747987270355,
0.004654196090996265,
-0.0014240838354453444,
0.007016072515398264,
-0.0014350159326568246,
-0.0037869331426918507,
-0.007532428950071335,
0.013628809712827206,
-0.009971565566956997,
0.00002197350113419816,
0.014525880105793476,
0.005689246114343405,
0.00908629223704338,
0.0035688739735633135,
0.0023594882804900408,
0.0020656422711908817,
0.009739701636135578,
-0.010586104355752468,
0.002187259728088975,
-0.0021987224463373423,
-0.0003568952379282564,
0.007755012717097998,
-0.003467557718977332,
0.0012019843561574817,
0.008950796909630299,
0.00021449901396408677,
-0.008036338724195957,
-0.0030608540400862694,
0.001085222465917468,
0.002263628877699375,
-0.01296589057892561,
-0.0017913120100274682,
-0.0047532846219837666,
-0.00745987007394433,
-0.0025883319322019815,
-0.00111720513086766,
0.0006708715227432549,
0.0030171324033290148,
-0.0032687836792320013,
0.008629591204226017,
0.0012638512998819351,
-0.006056192796677351,
0.015700142830610275,
-0.006211359519511461,
-0.00504256458953023,
0.005629899445921183,
0.0015883897431194782,
-0.0010102948872372508,
-0.0038122881669551134,
-0.0034005041234195232,
0.0020590678323060274,
0.005339154973626137,
-0.003884740872308612,
-0.006662414874881506,
-0.0060949684120714664,
0.0007085449178703129,
-0.013253961689770222,
-0.0013007124653086066,
0.011708861216902733,
-0.004590432625263929,
0.002225246513262391,
0.0013572105672210455,
-0.005591722205281258,
-0.01444253046065569,
0.05829886347055435,
-0.0004536164633464068,
0.003927827812731266,
0.006363609805703163,
-0.007569949142634869,
-0.0026816551107913256,
-0.0036866054870188236,
0.007398427929729223,
-0.006421958561986685,
-0.010413042269647121,
0.009951002895832062,
-0.002166071441024542,
0.004203229211270809,
0.0006187587277963758,
0.001522047445178032,
0.018995756283402443,
-0.006687649991363287,
-0.01576637476682663,
-0.015061249025166035,
0.008750732988119125,
-0.003418329171836376,
-0.004648965783417225,
0.006284887436777353,
-0.004091947805136442,
0.0007186761358752847,
0.004264497198164463,
0.0048095425590872765,
-0.0021860019769519567,
0.0008980512502603233,
-0.0015049617504701018,
-0.00493990583345294,
0.0012110265670344234,
0.0022760285064578056,
0.005941173527389765,
0.009057935327291489,
-0.001869634143076837,
0.005058917682617903,
0.0030096392147243023,
-0.0008445772109553218,
0.0003639846108853817,
0.009062989614903927,
0.007885521277785301,
-0.0014201723970472813,
-0.006097473204135895,
0.0027320741210132837,
0.003777954960241914,
0.0022122026421129704,
0.014060135930776596,
-0.0020085202995687723,
-0.00859441515058279,
0.009713458828628063,
0.008501272648572922,
-0.0015731968451291323,
0.013267039321362972,
-0.0026430441066622734,
0.0031279060058295727,
0.001697432599030435,
-0.008361398242413998,
-0.01264241524040699,
0.0002724985242821276,
0.004705043509602547,
0.010198681615293026,
-0.0037122636567801237,
0.0034278049133718014,
0.0018190545961260796,
-0.0011237348662689328,
-0.008347462862730026,
-0.00562533363699913,
-0.004137124866247177,
0.0010202688863500953,
0.00799048226326704,
0.07471674680709839,
-0.007911406457424164,
-0.002550958190113306,
-0.008780132047832012,
-0.00008455784700345248,
-0.00300474907271564,
0.0003725654096342623,
-0.0012514765840023756,
0.0004674998635891825,
0.005039444658905268,
0.002259231638163328,
-0.007057726848870516,
-0.00932210311293602,
0.0017635549884289503,
0.0014872441533952951,
-0.0024590010289102793,
0.0062880790792405605,
0.007668988313525915,
-0.007153836544603109,
0.0010116857010871172,
-0.013805019669234753,
-0.002464684657752514,
-0.004605196416378021,
-0.008547337725758553,
-0.0013505532406270504,
-0.005629056133329868,
0.0000057744696277950425,
0.0063339523039758205,
0.006539864931255579,
-0.004134219605475664,
0.006502155214548111,
-0.003154841484501958,
0.003240072401240468,
-0.004556767642498016,
0.0007259882404468954,
-0.005539004225283861,
0.008066085167229176,
0.00018085705232806504,
-0.01333969458937645,
-0.002494205255061388,
-0.001531817950308323,
-0.000677873904351145,
-0.006177706643939018,
0.0038467328995466232,
-0.002147330902516842,
0.009209058247506618,
-0.0011619526194408536,
0.0007980084628798068,
-0.006466805003583431,
0.0013020845362916589,
-0.01410631649196148,
0.0039918143302202225,
-0.18485377728939056,
0.0096147945150733,
0.0010005627991631627,
-0.003589545376598835,
-0.003907619044184685,
-0.018583500757813454,
-0.00857904739677906,
0.0029319357126951218,
0.008525453507900238,
0.00017689328524284065,
0.0030749530997127295,
-0.00490824319422245,
0.005955300759524107,
0.0029518657829612494,
-0.0002968376502394676,
-0.007661661133170128,
0.007716889027506113,
-0.004343065898865461,
-0.0004500107897911221,
0.0010601688409224153,
0.007206899579614401,
0.008883374743163586,
0.0016980834770947695,
0.004350750707089901,
0.0013508645351976156,
-0.004308468196541071,
0.005245847161859274,
-0.001635980443097651,
0.005088952369987965,
-0.008373992517590523,
-0.007072467356920242,
-0.004618210718035698,
-0.001980810659006238,
0.006302839145064354,
0.00508536072447896,
-0.002717419760301709,
0.006477893330156803,
0.00022888196690473706,
-0.007534869480878115,
0.0071221753023564816,
-0.008420371450483799,
0.029611889272928238,
0.0008934670477174222,
0.007974986918270588,
0.0029665485490113497,
-0.0013849876122549176,
-0.004197846632450819,
0.007153449114412069,
0.0017298345919698477,
0.011119185015559196,
-0.015151860192418098,
-0.005123650189489126,
0.002809391589835286,
0.019575854763388634,
-0.007173305843025446,
-0.012527699582278728,
-0.009027336724102497,
-0.0073199220933020115,
0.0033230206463485956,
0.011266841553151608,
0.010368158109486103,
-0.007783995941281319,
0.007311586290597916,
-0.0045753177255392075,
-0.023072371259331703,
0.0012092855758965015,
-0.00472116656601429,
-0.00813619140535593,
-0.005068606231361628,
0.006690730340778828,
0.013023074716329575,
-0.0019892265554517508,
0.010168155655264854,
-0.00013463603681884706,
0.001969417557120323,
-0.001170846284367144,
0.007212478667497635,
-0.003546337364241481,
0.00759368110448122,
-0.009575906209647655,
0.00925931055098772,
-0.0102991359308362,
-0.0032342011108994484,
0.001113765756599605,
-0.0041168914176523685,
0.011277373880147934,
0.0071657570078969,
-0.0012143090134486556,
-0.002620051149278879,
-0.010967289097607136,
-0.0026784888468682766,
0.00039706911775283515,
0.0034697065129876137,
-0.005475815385580063,
0.0012011849321424961,
-0.0018232869915664196,
0.0039596110582351685,
0.008538245223462582,
-0.008593151345849037,
0.002801434602588415,
0.00799631979316473,
-0.006345874164253473,
0.00029210964567027986,
-0.0028447797521948814,
0.004026109352707863,
0.003977743908762932,
-0.007109262049198151,
-0.009265984408557415,
0.005384311079978943,
-0.006099418271332979,
-0.0023616794496774673,
0.005633601453155279,
-0.010359358042478561,
-0.0072502801194787025,
0.0009659933857619762,
-0.01359525416046381,
0.001800385070964694
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.