max_stars_repo_path
stringlengths
4
237
max_stars_repo_name
stringlengths
6
117
max_stars_count
int64
0
95.2k
id
stringlengths
1
7
content
stringlengths
12
593k
input_ids
sequencelengths
7
549k
fhir/resources/specimendefinition.py
chgl/fhir.resources
0
32852
# -*- coding: utf-8 -*- """ Profile: http://hl7.org/fhir/StructureDefinition/SpecimenDefinition Release: R4 Version: 4.0.1 Build ID: 9346c8cc45 Last updated: 2019-11-01T09:29:23.356+11:00 """ import typing from pydantic import Field, root_validator from pydantic.error_wrappers import ErrorWrapper, ValidationError from pydantic.errors import MissingError, NoneIsNotAllowedError from . import backboneelement, domainresource, fhirtypes class SpecimenDefinition(domainresource.DomainResource): """Disclaimer: Any field name ends with ``__ext`` does't part of Resource StructureDefinition, instead used to enable Extensibility feature for FHIR Primitive Data Types. Kind of specimen. A kind of specimen with associated set of requirements. """ resource_type = Field("SpecimenDefinition", const=True) collection: typing.List[fhirtypes.CodeableConceptType] = Field( None, alias="collection", title="Specimen collection procedure", description="The action to be performed for collecting the specimen.", # if property is element of this resource. element_property=True, ) identifier: fhirtypes.IdentifierType = Field( None, alias="identifier", title="Business identifier of a kind of specimen", description="A business identifier associated with the kind of specimen.", # if property is element of this resource. element_property=True, ) patientPreparation: typing.List[fhirtypes.CodeableConceptType] = Field( None, alias="patientPreparation", title="Patient preparation for collection", description="Preparation of the patient for specimen collection.", # if property is element of this resource. element_property=True, ) timeAspect: fhirtypes.String = Field( None, alias="timeAspect", title="Time aspect for collection", description="Time aspect of specimen collection (duration or offset).", # if property is element of this resource. element_property=True, ) timeAspect__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_timeAspect", title="Extension field for ``timeAspect``." ) typeCollected: fhirtypes.CodeableConceptType = Field( None, alias="typeCollected", title="Kind of material to collect", description="The kind of material to be collected.", # if property is element of this resource. element_property=True, ) typeTested: typing.List[fhirtypes.SpecimenDefinitionTypeTestedType] = Field( None, alias="typeTested", title="Specimen in container intended for testing by lab", description=( "Specimen conditioned in a container as expected by the testing " "laboratory." ), # if property is element of this resource. element_property=True, ) class SpecimenDefinitionTypeTested(backboneelement.BackboneElement): """Disclaimer: Any field name ends with ``__ext`` does't part of Resource StructureDefinition, instead used to enable Extensibility feature for FHIR Primitive Data Types. Specimen in container intended for testing by lab. Specimen conditioned in a container as expected by the testing laboratory. """ resource_type = Field("SpecimenDefinitionTypeTested", const=True) container: fhirtypes.SpecimenDefinitionTypeTestedContainerType = Field( None, alias="container", title="The specimen's container", description=None, # if property is element of this resource. element_property=True, ) handling: typing.List[fhirtypes.SpecimenDefinitionTypeTestedHandlingType] = Field( None, alias="handling", title="Specimen handling before testing", description=( "Set of instructions for preservation/transport of the specimen at a " "defined temperature interval, prior the testing process." ), # if property is element of this resource. element_property=True, ) isDerived: bool = Field( None, alias="isDerived", title="Primary or secondary specimen", description="Primary of secondary specimen.", # if property is element of this resource. element_property=True, ) isDerived__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_isDerived", title="Extension field for ``isDerived``." ) preference: fhirtypes.Code = Field( None, alias="preference", title="preferred | alternate", description="The preference for this type of conditioned specimen.", # if property is element of this resource. element_property=True, element_required=True, # note: Enum values can be used in validation, # but use in your own responsibilities, read official FHIR documentation. enum_values=["preferred", "alternate"], ) preference__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_preference", title="Extension field for ``preference``." ) rejectionCriterion: typing.List[fhirtypes.CodeableConceptType] = Field( None, alias="rejectionCriterion", title="Rejection criterion", description=( "Criterion for rejection of the specimen in its container by the " "laboratory." ), # if property is element of this resource. element_property=True, ) requirement: fhirtypes.String = Field( None, alias="requirement", title="Specimen requirements", description=( "Requirements for delivery and special handling of this kind of " "conditioned specimen." ), # if property is element of this resource. element_property=True, ) requirement__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_requirement", title="Extension field for ``requirement``." ) retentionTime: fhirtypes.DurationType = Field( None, alias="retentionTime", title="Specimen retention time", description=( "The usual time that a specimen of this kind is retained after the " "ordered tests are completed, for the purpose of additional testing." ), # if property is element of this resource. element_property=True, ) type: fhirtypes.CodeableConceptType = Field( None, alias="type", title="Type of intended specimen", description="The kind of specimen conditioned for testing expected by lab.", # if property is element of this resource. element_property=True, ) @root_validator(pre=True, allow_reuse=True) def validate_required_primitive_elements_3071( cls, values: typing.Dict[str, typing.Any] ) -> typing.Dict[str, typing.Any]: """https://www.hl7.org/fhir/extensibility.html#Special-Case In some cases, implementers might find that they do not have appropriate data for an element with minimum cardinality = 1. In this case, the element must be present, but unless the resource or a profile on it has made the actual value of the primitive data type mandatory, it is possible to provide an extension that explains why the primitive value is not present. """ required_fields = [("preference", "preference__ext")] _missing = object() def _fallback(): return "" errors: typing.List["ErrorWrapper"] = [] for name, ext in required_fields: field = cls.__fields__[name] ext_field = cls.__fields__[ext] value = values.get(field.alias, _missing) if value not in (_missing, None): continue ext_value = values.get(ext_field.alias, _missing) missing_ext = True if ext_value not in (_missing, None): if isinstance(ext_value, dict): missing_ext = len(ext_value.get("extension", [])) == 0 elif ( getattr(ext_value.__class__, "get_resource_type", _fallback)() == "FHIRPrimitiveExtension" ): if ext_value.extension and len(ext_value.extension) > 0: missing_ext = False else: validate_pass = True for validator in ext_field.type_.__get_validators__(): try: ext_value = validator(v=ext_value) except ValidationError as exc: errors.append(ErrorWrapper(exc, loc=ext_field.alias)) validate_pass = False if not validate_pass: continue if ext_value.extension and len(ext_value.extension) > 0: missing_ext = False if missing_ext: if value is _missing: errors.append(ErrorWrapper(MissingError(), loc=field.alias)) else: errors.append( ErrorWrapper(NoneIsNotAllowedError(), loc=field.alias) ) if len(errors) > 0: raise ValidationError(errors, cls) # type: ignore return values class SpecimenDefinitionTypeTestedContainer(backboneelement.BackboneElement): """Disclaimer: Any field name ends with ``__ext`` does't part of Resource StructureDefinition, instead used to enable Extensibility feature for FHIR Primitive Data Types. The specimen's container. """ resource_type = Field("SpecimenDefinitionTypeTestedContainer", const=True) additive: typing.List[ fhirtypes.SpecimenDefinitionTypeTestedContainerAdditiveType ] = Field( None, alias="additive", title="Additive associated with container", description=( "Substance introduced in the kind of container to preserve, maintain or" " enhance the specimen. Examples: Formalin, Citrate, EDTA." ), # if property is element of this resource. element_property=True, ) cap: fhirtypes.CodeableConceptType = Field( None, alias="cap", title="Color of container cap", description=None, # if property is element of this resource. element_property=True, ) capacity: fhirtypes.QuantityType = Field( None, alias="capacity", title="Container capacity", description="The capacity (volume or other measure) of this kind of container.", # if property is element of this resource. element_property=True, ) description: fhirtypes.String = Field( None, alias="description", title="Container description", description="The textual description of the kind of container.", # if property is element of this resource. element_property=True, ) description__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_description", title="Extension field for ``description``." ) material: fhirtypes.CodeableConceptType = Field( None, alias="material", title="Container material", description="The type of material of the container.", # if property is element of this resource. element_property=True, ) minimumVolumeQuantity: fhirtypes.QuantityType = Field( None, alias="minimumVolumeQuantity", title="Minimum volume", description="The minimum volume to be conditioned in the container.", # if property is element of this resource. element_property=True, # Choice of Data Types. i.e minimumVolume[x] one_of_many="minimumVolume", one_of_many_required=False, ) minimumVolumeString: fhirtypes.String = Field( None, alias="minimumVolumeString", title="Minimum volume", description="The minimum volume to be conditioned in the container.", # if property is element of this resource. element_property=True, # Choice of Data Types. i.e minimumVolume[x] one_of_many="minimumVolume", one_of_many_required=False, ) minimumVolumeString__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_minimumVolumeString", title="Extension field for ``minimumVolumeString``.", ) preparation: fhirtypes.String = Field( None, alias="preparation", title="Specimen container preparation", description=( "Special processing that should be applied to the container for this " "kind of specimen." ), # if property is element of this resource. element_property=True, ) preparation__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_preparation", title="Extension field for ``preparation``." ) type: fhirtypes.CodeableConceptType = Field( None, alias="type", title="Kind of container associated with the kind of specimen", description="The type of container used to contain this kind of specimen.", # if property is element of this resource. element_property=True, ) @root_validator(pre=True, allow_reuse=True) def validate_one_of_many_4016( cls, values: typing.Dict[str, typing.Any] ) -> typing.Dict[str, typing.Any]: """https://www.hl7.org/fhir/formats.html#choice A few elements have a choice of more than one data type for their content. All such elements have a name that takes the form nnn[x]. The "nnn" part of the name is constant, and the "[x]" is replaced with the title-cased name of the type that is actually used. The table view shows each of these names explicitly. Elements that have a choice of data type cannot repeat - they must have a maximum cardinality of 1. When constructing an instance of an element with a choice of types, the authoring system must create a single element with a data type chosen from among the list of permitted data types. """ one_of_many_fields = { "minimumVolume": ["minimumVolumeQuantity", "minimumVolumeString"] } for prefix, fields in one_of_many_fields.items(): assert cls.__fields__[fields[0]].field_info.extra["one_of_many"] == prefix required = ( cls.__fields__[fields[0]].field_info.extra["one_of_many_required"] is True ) found = False for field in fields: if field in values and values[field] is not None: if found is True: raise ValueError( "Any of one field value is expected from " f"this list {fields}, but got multiple!" ) else: found = True if required is True and found is False: raise ValueError(f"Expect any of field value from this list {fields}.") return values class SpecimenDefinitionTypeTestedContainerAdditive(backboneelement.BackboneElement): """Disclaimer: Any field name ends with ``__ext`` does't part of Resource StructureDefinition, instead used to enable Extensibility feature for FHIR Primitive Data Types. Additive associated with container. Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA. """ resource_type = Field("SpecimenDefinitionTypeTestedContainerAdditive", const=True) additiveCodeableConcept: fhirtypes.CodeableConceptType = Field( None, alias="additiveCodeableConcept", title="Additive associated with container", description=( "Substance introduced in the kind of container to preserve, maintain or" " enhance the specimen. Examples: Formalin, Citrate, EDTA." ), # if property is element of this resource. element_property=True, # Choice of Data Types. i.e additive[x] one_of_many="additive", one_of_many_required=True, ) additiveReference: fhirtypes.ReferenceType = Field( None, alias="additiveReference", title="Additive associated with container", description=( "Substance introduced in the kind of container to preserve, maintain or" " enhance the specimen. Examples: Formalin, Citrate, EDTA." ), # if property is element of this resource. element_property=True, # Choice of Data Types. i.e additive[x] one_of_many="additive", one_of_many_required=True, # note: Listed Resource Type(s) should be allowed as Reference. enum_reference_types=["Substance"], ) @root_validator(pre=True, allow_reuse=True) def validate_one_of_many_4813( cls, values: typing.Dict[str, typing.Any] ) -> typing.Dict[str, typing.Any]: """https://www.hl7.org/fhir/formats.html#choice A few elements have a choice of more than one data type for their content. All such elements have a name that takes the form nnn[x]. The "nnn" part of the name is constant, and the "[x]" is replaced with the title-cased name of the type that is actually used. The table view shows each of these names explicitly. Elements that have a choice of data type cannot repeat - they must have a maximum cardinality of 1. When constructing an instance of an element with a choice of types, the authoring system must create a single element with a data type chosen from among the list of permitted data types. """ one_of_many_fields = { "additive": ["additiveCodeableConcept", "additiveReference"] } for prefix, fields in one_of_many_fields.items(): assert cls.__fields__[fields[0]].field_info.extra["one_of_many"] == prefix required = ( cls.__fields__[fields[0]].field_info.extra["one_of_many_required"] is True ) found = False for field in fields: if field in values and values[field] is not None: if found is True: raise ValueError( "Any of one field value is expected from " f"this list {fields}, but got multiple!" ) else: found = True if required is True and found is False: raise ValueError(f"Expect any of field value from this list {fields}.") return values class SpecimenDefinitionTypeTestedHandling(backboneelement.BackboneElement): """Disclaimer: Any field name ends with ``__ext`` does't part of Resource StructureDefinition, instead used to enable Extensibility feature for FHIR Primitive Data Types. Specimen handling before testing. Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process. """ resource_type = Field("SpecimenDefinitionTypeTestedHandling", const=True) instruction: fhirtypes.String = Field( None, alias="instruction", title="Preservation instruction", description=( "Additional textual instructions for the preservation or transport of " "the specimen. For instance, 'Protect from light exposure'." ), # if property is element of this resource. element_property=True, ) instruction__ext: fhirtypes.FHIRPrimitiveExtensionType = Field( None, alias="_instruction", title="Extension field for ``instruction``." ) maxDuration: fhirtypes.DurationType = Field( None, alias="maxDuration", title="Maximum preservation time", description=( "The maximum time interval of preservation of the specimen with these " "conditions." ), # if property is element of this resource. element_property=True, ) temperatureQualifier: fhirtypes.CodeableConceptType = Field( None, alias="temperatureQualifier", title="Temperature qualifier", description=( "It qualifies the interval of temperature, which characterizes an " "occurrence of handling. Conditions that are not related to temperature" " may be handled in the instruction element." ), # if property is element of this resource. element_property=True, ) temperatureRange: fhirtypes.RangeType = Field( None, alias="temperatureRange", title="Temperature range", description="The temperature interval for this set of handling instructions.", # if property is element of this resource. element_property=True, )
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 13909, 29901, 1732, 597, 4415, 29955, 29889, 990, 29914, 29888, 29882, 381, 29914, 5015, 12425, 14683, 29914, 10299, 19933, 14683, 13, 19729, 29901, 390, 29946, 13, 6594, 29901, 29871, 29946, 29889, 29900, 29889, 29896, 13, 8893, 3553, 29901, 29871, 29929, 29941, 29946, 29953, 29883, 29947, 617, 29946, 29945, 13, 8897, 4784, 29901, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29896, 29899, 29900, 29896, 29911, 29900, 29929, 29901, 29906, 29929, 29901, 29906, 29941, 29889, 29941, 29945, 29953, 29974, 29896, 29896, 29901, 29900, 29900, 13, 15945, 29908, 13, 5215, 19229, 13, 13, 3166, 282, 2941, 7716, 1053, 8989, 29892, 3876, 29918, 3084, 1061, 13, 3166, 282, 2941, 7716, 29889, 2704, 29918, 29893, 336, 22437, 1053, 4829, 15646, 29892, 15758, 362, 2392, 13, 3166, 282, 2941, 7716, 29889, 12523, 1053, 4750, 292, 2392, 29892, 6213, 3624, 3664, 15930, 287, 2392, 13, 13, 3166, 869, 1053, 1250, 15933, 5029, 29892, 5354, 10314, 29892, 285, 29882, 381, 8768, 13, 13, 13, 1990, 12048, 19933, 14683, 29898, 7247, 10314, 29889, 15951, 6848, 1125, 13, 1678, 9995, 4205, 16398, 4193, 29901, 3139, 1746, 1024, 10614, 411, 4954, 1649, 1062, 16159, 947, 29915, 29873, 760, 310, 13, 1678, 18981, 3767, 12425, 14683, 29892, 2012, 1304, 304, 9025, 7338, 575, 4127, 4682, 13, 1678, 363, 383, 29950, 8193, 9724, 3321, 3630, 28025, 29889, 13, 13, 1678, 13187, 310, 1580, 19933, 29889, 13, 1678, 319, 2924, 310, 1580, 19933, 411, 6942, 731, 310, 11780, 29889, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 8989, 703, 10299, 19933, 14683, 613, 1040, 29922, 5574, 29897, 13, 13, 1678, 4333, 29901, 19229, 29889, 1293, 29961, 29888, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 29962, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 10855, 613, 13, 4706, 3611, 543, 10299, 19933, 4333, 8792, 613, 13, 4706, 6139, 543, 1576, 3158, 304, 367, 8560, 363, 6314, 292, 278, 1580, 19933, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 15882, 29901, 285, 29882, 381, 8768, 29889, 12889, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 25378, 613, 13, 4706, 3611, 543, 16890, 3335, 15882, 310, 263, 2924, 310, 1580, 19933, 613, 13, 4706, 6139, 543, 29909, 5381, 15882, 6942, 411, 278, 2924, 310, 1580, 19933, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 16500, 6572, 862, 362, 29901, 19229, 29889, 1293, 29961, 29888, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 29962, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 5031, 993, 6572, 862, 362, 613, 13, 4706, 3611, 543, 11457, 993, 10223, 362, 363, 4333, 613, 13, 4706, 6139, 543, 6572, 862, 362, 310, 278, 16500, 363, 1580, 19933, 4333, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 931, 2887, 1103, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 2230, 2887, 1103, 613, 13, 4706, 3611, 543, 2481, 9565, 363, 4333, 613, 13, 4706, 6139, 543, 2481, 9565, 310, 1580, 19933, 4333, 313, 19708, 470, 9210, 467, 613, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 931, 2887, 1103, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 2230, 2887, 1103, 613, 3611, 543, 17657, 1746, 363, 4954, 2230, 2887, 1103, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 1134, 28916, 287, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1853, 28916, 287, 613, 13, 4706, 3611, 543, 11885, 310, 5518, 304, 6314, 613, 13, 4706, 6139, 543, 1576, 2924, 310, 5518, 304, 367, 16531, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 1134, 29911, 2868, 29901, 19229, 29889, 1293, 29961, 29888, 29882, 381, 8768, 29889, 10299, 19933, 14683, 1542, 29911, 2868, 1542, 29962, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1853, 29911, 2868, 613, 13, 4706, 3611, 543, 10299, 19933, 297, 5639, 9146, 363, 6724, 491, 9775, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 10299, 19933, 4195, 287, 297, 263, 5639, 408, 3806, 491, 278, 6724, 376, 13, 9651, 376, 29880, 3717, 7606, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 13, 1990, 12048, 19933, 14683, 1542, 29911, 2868, 29898, 1627, 15933, 5029, 29889, 5841, 15933, 2642, 1125, 13, 1678, 9995, 4205, 16398, 4193, 29901, 3139, 1746, 1024, 10614, 411, 4954, 1649, 1062, 16159, 947, 29915, 29873, 760, 310, 13, 1678, 18981, 3767, 12425, 14683, 29892, 2012, 1304, 304, 9025, 7338, 575, 4127, 4682, 13, 1678, 363, 383, 29950, 8193, 9724, 3321, 3630, 28025, 29889, 13, 13, 1678, 12048, 19933, 297, 5639, 9146, 363, 6724, 491, 9775, 29889, 13, 1678, 12048, 19933, 4195, 287, 297, 263, 5639, 408, 3806, 491, 278, 6724, 10212, 7606, 29889, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 8989, 703, 10299, 19933, 14683, 1542, 29911, 2868, 613, 1040, 29922, 5574, 29897, 13, 13, 1678, 5639, 29901, 285, 29882, 381, 8768, 29889, 10299, 19933, 14683, 1542, 29911, 2868, 7895, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 7611, 613, 13, 4706, 3611, 543, 1576, 1580, 19933, 29915, 29879, 5639, 613, 13, 4706, 6139, 29922, 8516, 29892, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 11415, 29901, 19229, 29889, 1293, 29961, 29888, 29882, 381, 8768, 29889, 10299, 19933, 14683, 1542, 29911, 2868, 3481, 1847, 1542, 29962, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 3179, 1847, 613, 13, 4706, 3611, 543, 10299, 19933, 11415, 1434, 6724, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 2697, 310, 11994, 363, 2225, 20525, 29914, 27882, 310, 278, 1580, 19933, 472, 263, 376, 13, 9651, 376, 12119, 10430, 7292, 29892, 7536, 278, 6724, 1889, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 338, 15383, 2347, 29901, 6120, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 275, 15383, 2347, 613, 13, 4706, 3611, 543, 26666, 470, 16723, 1580, 19933, 613, 13, 4706, 6139, 543, 26666, 310, 16723, 1580, 19933, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 338, 15383, 2347, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 275, 15383, 2347, 613, 3611, 543, 17657, 1746, 363, 4954, 275, 15383, 2347, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 24583, 29901, 285, 29882, 381, 8768, 29889, 3399, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1457, 1659, 613, 13, 4706, 3611, 543, 1457, 14373, 891, 25010, 613, 13, 4706, 6139, 543, 1576, 24583, 363, 445, 1134, 310, 4195, 287, 1580, 19933, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 4706, 1543, 29918, 12403, 29922, 5574, 29892, 13, 4706, 396, 4443, 29901, 1174, 398, 1819, 508, 367, 1304, 297, 8845, 29892, 13, 4706, 396, 541, 671, 297, 596, 1914, 5544, 747, 9770, 29892, 1303, 6221, 383, 29950, 8193, 5106, 29889, 13, 4706, 14115, 29918, 5975, 29922, 3366, 1457, 14373, 613, 376, 26123, 403, 12436, 13, 1678, 1723, 13, 1678, 24583, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 1457, 1659, 613, 3611, 543, 17657, 1746, 363, 4954, 1457, 1659, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 337, 6929, 29907, 5385, 291, 29901, 19229, 29889, 1293, 29961, 29888, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 29962, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 276, 6929, 29907, 5385, 291, 613, 13, 4706, 3611, 543, 1123, 6929, 28770, 291, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 29907, 5385, 291, 363, 337, 6929, 310, 278, 1580, 19933, 297, 967, 5639, 491, 278, 376, 13, 9651, 376, 29880, 3717, 7606, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 11809, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 12277, 358, 613, 13, 4706, 3611, 543, 10299, 19933, 11780, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 1123, 1548, 1860, 363, 28289, 322, 4266, 11415, 310, 445, 2924, 310, 376, 13, 9651, 376, 16122, 287, 1580, 19933, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 11809, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 12277, 358, 613, 3611, 543, 17657, 1746, 363, 4954, 12277, 358, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 3240, 2509, 2481, 29901, 285, 29882, 381, 8768, 29889, 18984, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 2267, 2509, 2481, 613, 13, 4706, 3611, 543, 10299, 19933, 3240, 2509, 931, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 1576, 9670, 931, 393, 263, 1580, 19933, 310, 445, 2924, 338, 26060, 1156, 278, 376, 13, 9651, 376, 21693, 6987, 526, 8676, 29892, 363, 278, 6437, 310, 5684, 6724, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 1134, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1853, 613, 13, 4706, 3611, 543, 1542, 310, 9146, 1580, 19933, 613, 13, 4706, 6139, 543, 1576, 2924, 310, 1580, 19933, 4195, 287, 363, 6724, 3806, 491, 9775, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 732, 4632, 29918, 3084, 1061, 29898, 1457, 29922, 5574, 29892, 2758, 29918, 276, 1509, 29922, 5574, 29897, 13, 1678, 822, 12725, 29918, 12403, 29918, 9469, 3321, 29918, 17664, 29918, 29941, 29900, 29955, 29896, 29898, 13, 4706, 1067, 29879, 29892, 1819, 29901, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 29962, 13, 1678, 1723, 1599, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 5387, 13, 4706, 9995, 991, 597, 1636, 29889, 4415, 29955, 29889, 990, 29914, 29888, 29882, 381, 29914, 1062, 575, 4127, 29889, 1420, 29937, 24780, 29899, 8259, 13, 4706, 512, 777, 4251, 29892, 2334, 414, 1795, 1284, 393, 896, 437, 451, 505, 8210, 848, 363, 13, 4706, 385, 1543, 411, 9212, 21008, 537, 353, 29871, 29896, 29889, 512, 445, 1206, 29892, 278, 1543, 1818, 367, 2198, 29892, 13, 4706, 541, 6521, 278, 6503, 470, 263, 8722, 373, 372, 756, 1754, 278, 3935, 995, 310, 278, 19269, 13, 4706, 848, 1134, 9619, 7606, 29892, 372, 338, 1950, 304, 3867, 385, 6081, 393, 18568, 2020, 13, 4706, 278, 19269, 995, 338, 451, 2198, 29889, 13, 4706, 9995, 13, 4706, 3734, 29918, 9621, 353, 518, 703, 1457, 1659, 613, 376, 1457, 1659, 1649, 1062, 13531, 13, 4706, 903, 27259, 353, 1203, 580, 13, 13, 4706, 822, 903, 11950, 1627, 7295, 13, 9651, 736, 5124, 13, 13, 4706, 4436, 29901, 19229, 29889, 1293, 3366, 2392, 15646, 3108, 353, 5159, 13, 4706, 363, 1024, 29892, 1294, 297, 3734, 29918, 9621, 29901, 13, 9651, 1746, 353, 1067, 29879, 17255, 9621, 1649, 29961, 978, 29962, 13, 9651, 1294, 29918, 2671, 353, 1067, 29879, 17255, 9621, 1649, 29961, 1062, 29962, 13, 9651, 995, 353, 1819, 29889, 657, 29898, 2671, 29889, 19973, 29892, 903, 27259, 29897, 13, 9651, 565, 995, 451, 297, 9423, 27259, 29892, 6213, 1125, 13, 18884, 6773, 13, 9651, 1294, 29918, 1767, 353, 1819, 29889, 657, 29898, 1062, 29918, 2671, 29889, 19973, 29892, 903, 27259, 29897, 13, 9651, 4567, 29918, 1062, 353, 5852, 13, 9651, 565, 1294, 29918, 1767, 451, 297, 9423, 27259, 29892, 6213, 1125, 13, 18884, 565, 338, 8758, 29898, 1062, 29918, 1767, 29892, 9657, 1125, 13, 462, 1678, 4567, 29918, 1062, 353, 7431, 29898, 1062, 29918, 1767, 29889, 657, 703, 17588, 613, 5159, 876, 1275, 29871, 29900, 13, 18884, 25342, 313, 13, 462, 1678, 679, 5552, 29898, 1062, 29918, 1767, 17255, 1990, 1649, 29892, 376, 657, 29918, 10314, 29918, 1853, 613, 903, 11950, 1627, 29897, 580, 13, 462, 1678, 1275, 376, 29943, 29950, 8193, 18213, 3321, 17657, 29908, 13, 462, 1125, 13, 462, 1678, 565, 1294, 29918, 1767, 29889, 17588, 322, 7431, 29898, 1062, 29918, 1767, 29889, 17588, 29897, 1405, 29871, 29900, 29901, 13, 462, 4706, 4567, 29918, 1062, 353, 7700, 13, 18884, 1683, 29901, 13, 462, 1678, 12725, 29918, 3364, 353, 5852, 13, 462, 1678, 363, 2854, 1061, 297, 1294, 29918, 2671, 29889, 1853, 5396, 1649, 657, 29918, 3084, 4097, 1649, 7295, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 1294, 29918, 1767, 353, 2854, 1061, 29898, 29894, 29922, 1062, 29918, 1767, 29897, 13, 462, 4706, 5174, 15758, 362, 2392, 408, 5566, 29901, 13, 462, 9651, 4436, 29889, 4397, 29898, 2392, 15646, 29898, 735, 29883, 29892, 1180, 29922, 1062, 29918, 2671, 29889, 19973, 876, 13, 462, 9651, 12725, 29918, 3364, 353, 7700, 13, 462, 1678, 565, 451, 12725, 29918, 3364, 29901, 13, 462, 4706, 6773, 13, 462, 1678, 565, 1294, 29918, 1767, 29889, 17588, 322, 7431, 29898, 1062, 29918, 1767, 29889, 17588, 29897, 1405, 29871, 29900, 29901, 13, 462, 4706, 4567, 29918, 1062, 353, 7700, 13, 9651, 565, 4567, 29918, 1062, 29901, 13, 18884, 565, 995, 338, 903, 27259, 29901, 13, 462, 1678, 4436, 29889, 4397, 29898, 2392, 15646, 29898, 18552, 292, 2392, 3285, 1180, 29922, 2671, 29889, 19973, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 4436, 29889, 4397, 29898, 13, 462, 4706, 4829, 15646, 29898, 8516, 3624, 3664, 15930, 287, 2392, 3285, 1180, 29922, 2671, 29889, 19973, 29897, 13, 462, 1678, 1723, 13, 4706, 565, 7431, 29898, 12523, 29897, 1405, 29871, 29900, 29901, 13, 9651, 12020, 15758, 362, 2392, 29898, 12523, 29892, 1067, 29879, 29897, 29871, 396, 1134, 29901, 11455, 13, 13, 4706, 736, 1819, 13, 13, 13, 1990, 12048, 19933, 14683, 1542, 29911, 2868, 7895, 29898, 1627, 15933, 5029, 29889, 5841, 15933, 2642, 1125, 13, 1678, 9995, 4205, 16398, 4193, 29901, 3139, 1746, 1024, 10614, 411, 4954, 1649, 1062, 16159, 947, 29915, 29873, 760, 310, 13, 1678, 18981, 3767, 12425, 14683, 29892, 2012, 1304, 304, 9025, 7338, 575, 4127, 4682, 13, 1678, 363, 383, 29950, 8193, 9724, 3321, 3630, 28025, 29889, 13, 13, 1678, 450, 1580, 19933, 29915, 29879, 5639, 29889, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 8989, 703, 10299, 19933, 14683, 1542, 29911, 2868, 7895, 613, 1040, 29922, 5574, 29897, 13, 13, 1678, 788, 3321, 29901, 19229, 29889, 1293, 29961, 13, 4706, 285, 29882, 381, 8768, 29889, 10299, 19933, 14683, 1542, 29911, 2868, 7895, 2528, 3321, 1542, 13, 1678, 4514, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1202, 3321, 613, 13, 4706, 3611, 543, 2528, 3321, 6942, 411, 5639, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 4035, 303, 749, 9129, 297, 278, 2924, 310, 5639, 304, 19905, 29892, 7344, 470, 29908, 13, 9651, 376, 26371, 749, 278, 1580, 19933, 29889, 1222, 9422, 29901, 383, 2759, 262, 29892, 21353, 10492, 29892, 9408, 6040, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 2117, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 5030, 613, 13, 4706, 3611, 543, 3306, 310, 5639, 2117, 613, 13, 4706, 6139, 29922, 8516, 29892, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 13284, 29901, 285, 29882, 381, 8768, 29889, 22930, 537, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 5030, 5946, 613, 13, 4706, 3611, 543, 7895, 13284, 613, 13, 4706, 6139, 543, 1576, 13284, 313, 24623, 470, 916, 5645, 29897, 310, 445, 2924, 310, 5639, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 6139, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 8216, 613, 13, 4706, 3611, 543, 7895, 6139, 613, 13, 4706, 6139, 543, 1576, 1426, 950, 6139, 310, 278, 2924, 310, 5639, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 6139, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 8216, 613, 3611, 543, 17657, 1746, 363, 4954, 8216, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 5518, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 15388, 613, 13, 4706, 3611, 543, 7895, 5518, 613, 13, 4706, 6139, 543, 1576, 1134, 310, 5518, 310, 278, 5639, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 9212, 24679, 22930, 537, 29901, 285, 29882, 381, 8768, 29889, 22930, 537, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1195, 12539, 24679, 22930, 537, 613, 13, 4706, 3611, 543, 8140, 12539, 7977, 613, 13, 4706, 6139, 543, 1576, 9212, 7977, 304, 367, 4195, 287, 297, 278, 5639, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 4706, 396, 14542, 625, 310, 3630, 28025, 29889, 474, 29889, 29872, 9212, 24679, 29961, 29916, 29962, 13, 4706, 697, 29918, 974, 29918, 13011, 543, 1195, 12539, 24679, 613, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 12403, 29922, 8824, 29892, 13, 1678, 1723, 13, 13, 1678, 9212, 24679, 1231, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1195, 12539, 24679, 1231, 613, 13, 4706, 3611, 543, 8140, 12539, 7977, 613, 13, 4706, 6139, 543, 1576, 9212, 7977, 304, 367, 4195, 287, 297, 278, 5639, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 4706, 396, 14542, 625, 310, 3630, 28025, 29889, 474, 29889, 29872, 9212, 24679, 29961, 29916, 29962, 13, 4706, 697, 29918, 974, 29918, 13011, 543, 1195, 12539, 24679, 613, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 12403, 29922, 8824, 29892, 13, 1678, 1723, 13, 1678, 9212, 24679, 1231, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 29918, 1195, 12539, 24679, 1231, 613, 13, 4706, 3611, 543, 17657, 1746, 363, 4954, 1195, 12539, 24679, 1231, 29952, 1412, 613, 13, 1678, 1723, 13, 13, 1678, 10223, 362, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1457, 862, 362, 613, 13, 4706, 3611, 543, 10299, 19933, 5639, 10223, 362, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 24780, 9068, 393, 881, 367, 7436, 304, 278, 5639, 363, 445, 376, 13, 9651, 376, 14380, 310, 1580, 19933, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 10223, 362, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 1457, 862, 362, 613, 3611, 543, 17657, 1746, 363, 4954, 1457, 862, 362, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 1134, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1853, 613, 13, 4706, 3611, 543, 11885, 310, 5639, 6942, 411, 278, 2924, 310, 1580, 19933, 613, 13, 4706, 6139, 543, 1576, 1134, 310, 5639, 1304, 304, 1712, 445, 2924, 310, 1580, 19933, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 732, 4632, 29918, 3084, 1061, 29898, 1457, 29922, 5574, 29892, 2758, 29918, 276, 1509, 29922, 5574, 29897, 13, 1678, 822, 12725, 29918, 650, 29918, 974, 29918, 13011, 29918, 29946, 29900, 29896, 29953, 29898, 13, 4706, 1067, 29879, 29892, 1819, 29901, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 29962, 13, 1678, 1723, 1599, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 5387, 13, 4706, 9995, 991, 597, 1636, 29889, 4415, 29955, 29889, 990, 29914, 29888, 29882, 381, 29914, 689, 1446, 29889, 1420, 29937, 16957, 13, 4706, 319, 2846, 3161, 505, 263, 7348, 310, 901, 1135, 697, 848, 1134, 363, 1009, 2793, 29889, 13, 4706, 2178, 1316, 3161, 505, 263, 1024, 393, 4893, 278, 883, 302, 15755, 29961, 29916, 1822, 13, 4706, 450, 376, 15755, 29876, 29908, 760, 310, 278, 1024, 338, 4868, 29892, 322, 278, 14704, 29916, 18017, 338, 8611, 411, 13, 4706, 278, 3611, 29899, 29883, 1463, 1024, 310, 278, 1134, 393, 338, 2869, 1304, 29889, 13, 4706, 450, 1591, 1776, 3697, 1269, 310, 1438, 2983, 9479, 29889, 13, 13, 4706, 10619, 29879, 393, 505, 263, 7348, 310, 848, 1134, 2609, 12312, 448, 896, 1818, 505, 263, 13, 4706, 7472, 21008, 537, 310, 29871, 29896, 29889, 1932, 3386, 292, 385, 2777, 310, 385, 1543, 411, 263, 13, 4706, 7348, 310, 4072, 29892, 278, 4148, 292, 1788, 1818, 1653, 263, 2323, 1543, 411, 263, 13, 4706, 848, 1134, 10434, 515, 4249, 278, 1051, 310, 21905, 848, 4072, 29889, 13, 4706, 9995, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 9621, 353, 426, 13, 9651, 376, 1195, 12539, 24679, 1115, 6796, 1195, 12539, 24679, 22930, 537, 613, 376, 1195, 12539, 24679, 1231, 3108, 13, 4706, 500, 13, 4706, 363, 10944, 29892, 4235, 297, 697, 29918, 974, 29918, 13011, 29918, 9621, 29889, 7076, 7295, 13, 9651, 4974, 1067, 29879, 17255, 9621, 1649, 29961, 9621, 29961, 29900, 29962, 1822, 2671, 29918, 3888, 29889, 17833, 3366, 650, 29918, 974, 29918, 13011, 3108, 1275, 10944, 13, 9651, 3734, 353, 313, 13, 18884, 1067, 29879, 17255, 9621, 1649, 29961, 9621, 29961, 29900, 29962, 1822, 2671, 29918, 3888, 29889, 17833, 3366, 650, 29918, 974, 29918, 13011, 29918, 12403, 3108, 13, 18884, 338, 5852, 13, 9651, 1723, 13, 9651, 1476, 353, 7700, 13, 9651, 363, 1746, 297, 4235, 29901, 13, 18884, 565, 1746, 297, 1819, 322, 1819, 29961, 2671, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 565, 1476, 338, 5852, 29901, 13, 462, 4706, 12020, 7865, 2392, 29898, 13, 462, 9651, 376, 10773, 310, 697, 1746, 995, 338, 3806, 515, 376, 13, 462, 9651, 285, 29908, 1366, 1051, 426, 9621, 1118, 541, 2355, 2999, 3850, 13, 462, 4706, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1476, 353, 5852, 13, 9651, 565, 3734, 338, 5852, 322, 1476, 338, 7700, 29901, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29908, 1252, 1103, 738, 310, 1746, 995, 515, 445, 1051, 426, 9621, 1836, 1159, 13, 13, 4706, 736, 1819, 13, 13, 13, 1990, 12048, 19933, 14683, 1542, 29911, 2868, 7895, 2528, 3321, 29898, 1627, 15933, 5029, 29889, 5841, 15933, 2642, 1125, 13, 1678, 9995, 4205, 16398, 4193, 29901, 3139, 1746, 1024, 10614, 411, 4954, 1649, 1062, 16159, 947, 29915, 29873, 760, 310, 13, 1678, 18981, 3767, 12425, 14683, 29892, 2012, 1304, 304, 9025, 7338, 575, 4127, 4682, 13, 1678, 363, 383, 29950, 8193, 9724, 3321, 3630, 28025, 29889, 13, 13, 1678, 3462, 3321, 6942, 411, 5639, 29889, 13, 1678, 3323, 303, 749, 9129, 297, 278, 2924, 310, 5639, 304, 19905, 29892, 7344, 470, 13, 1678, 26371, 749, 278, 1580, 19933, 29889, 1222, 9422, 29901, 383, 2759, 262, 29892, 21353, 10492, 29892, 9408, 6040, 29889, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 8989, 703, 10299, 19933, 14683, 1542, 29911, 2868, 7895, 2528, 3321, 613, 1040, 29922, 5574, 29897, 13, 13, 1678, 788, 3321, 3399, 519, 1168, 1547, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1202, 3321, 3399, 519, 1168, 1547, 613, 13, 4706, 3611, 543, 2528, 3321, 6942, 411, 5639, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 4035, 303, 749, 9129, 297, 278, 2924, 310, 5639, 304, 19905, 29892, 7344, 470, 29908, 13, 9651, 376, 26371, 749, 278, 1580, 19933, 29889, 1222, 9422, 29901, 383, 2759, 262, 29892, 21353, 10492, 29892, 9408, 6040, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 4706, 396, 14542, 625, 310, 3630, 28025, 29889, 474, 29889, 29872, 788, 3321, 29961, 29916, 29962, 13, 4706, 697, 29918, 974, 29918, 13011, 543, 1202, 3321, 613, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 12403, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 788, 3321, 7422, 29901, 285, 29882, 381, 8768, 29889, 7422, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 1202, 3321, 7422, 613, 13, 4706, 3611, 543, 2528, 3321, 6942, 411, 5639, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 4035, 303, 749, 9129, 297, 278, 2924, 310, 5639, 304, 19905, 29892, 7344, 470, 29908, 13, 9651, 376, 26371, 749, 278, 1580, 19933, 29889, 1222, 9422, 29901, 383, 2759, 262, 29892, 21353, 10492, 29892, 9408, 6040, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 4706, 396, 14542, 625, 310, 3630, 28025, 29889, 474, 29889, 29872, 788, 3321, 29961, 29916, 29962, 13, 4706, 697, 29918, 974, 29918, 13011, 543, 1202, 3321, 613, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 12403, 29922, 5574, 29892, 13, 4706, 396, 4443, 29901, 2391, 287, 18981, 5167, 29898, 29879, 29897, 881, 367, 6068, 408, 12105, 29889, 13, 4706, 14115, 29918, 5679, 29918, 8768, 29922, 3366, 4035, 303, 749, 12436, 13, 1678, 1723, 13, 13, 1678, 732, 4632, 29918, 3084, 1061, 29898, 1457, 29922, 5574, 29892, 2758, 29918, 276, 1509, 29922, 5574, 29897, 13, 1678, 822, 12725, 29918, 650, 29918, 974, 29918, 13011, 29918, 29946, 29947, 29896, 29941, 29898, 13, 4706, 1067, 29879, 29892, 1819, 29901, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 29962, 13, 1678, 1723, 1599, 19229, 29889, 21533, 29961, 710, 29892, 19229, 29889, 10773, 5387, 13, 4706, 9995, 991, 597, 1636, 29889, 4415, 29955, 29889, 990, 29914, 29888, 29882, 381, 29914, 689, 1446, 29889, 1420, 29937, 16957, 13, 4706, 319, 2846, 3161, 505, 263, 7348, 310, 901, 1135, 697, 848, 1134, 363, 1009, 2793, 29889, 13, 4706, 2178, 1316, 3161, 505, 263, 1024, 393, 4893, 278, 883, 302, 15755, 29961, 29916, 1822, 13, 4706, 450, 376, 15755, 29876, 29908, 760, 310, 278, 1024, 338, 4868, 29892, 322, 278, 14704, 29916, 18017, 338, 8611, 411, 13, 4706, 278, 3611, 29899, 29883, 1463, 1024, 310, 278, 1134, 393, 338, 2869, 1304, 29889, 13, 4706, 450, 1591, 1776, 3697, 1269, 310, 1438, 2983, 9479, 29889, 13, 13, 4706, 10619, 29879, 393, 505, 263, 7348, 310, 848, 1134, 2609, 12312, 448, 896, 1818, 505, 263, 13, 4706, 7472, 21008, 537, 310, 29871, 29896, 29889, 1932, 3386, 292, 385, 2777, 310, 385, 1543, 411, 263, 13, 4706, 7348, 310, 4072, 29892, 278, 4148, 292, 1788, 1818, 1653, 263, 2323, 1543, 411, 263, 13, 4706, 848, 1134, 10434, 515, 4249, 278, 1051, 310, 21905, 848, 4072, 29889, 13, 4706, 9995, 13, 4706, 697, 29918, 974, 29918, 13011, 29918, 9621, 353, 426, 13, 9651, 376, 1202, 3321, 1115, 6796, 1202, 3321, 3399, 519, 1168, 1547, 613, 376, 1202, 3321, 7422, 3108, 13, 4706, 500, 13, 4706, 363, 10944, 29892, 4235, 297, 697, 29918, 974, 29918, 13011, 29918, 9621, 29889, 7076, 7295, 13, 9651, 4974, 1067, 29879, 17255, 9621, 1649, 29961, 9621, 29961, 29900, 29962, 1822, 2671, 29918, 3888, 29889, 17833, 3366, 650, 29918, 974, 29918, 13011, 3108, 1275, 10944, 13, 9651, 3734, 353, 313, 13, 18884, 1067, 29879, 17255, 9621, 1649, 29961, 9621, 29961, 29900, 29962, 1822, 2671, 29918, 3888, 29889, 17833, 3366, 650, 29918, 974, 29918, 13011, 29918, 12403, 3108, 13, 18884, 338, 5852, 13, 9651, 1723, 13, 9651, 1476, 353, 7700, 13, 9651, 363, 1746, 297, 4235, 29901, 13, 18884, 565, 1746, 297, 1819, 322, 1819, 29961, 2671, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 565, 1476, 338, 5852, 29901, 13, 462, 4706, 12020, 7865, 2392, 29898, 13, 462, 9651, 376, 10773, 310, 697, 1746, 995, 338, 3806, 515, 376, 13, 462, 9651, 285, 29908, 1366, 1051, 426, 9621, 1118, 541, 2355, 2999, 3850, 13, 462, 4706, 1723, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1476, 353, 5852, 13, 9651, 565, 3734, 338, 5852, 322, 1476, 338, 7700, 29901, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29908, 1252, 1103, 738, 310, 1746, 995, 515, 445, 1051, 426, 9621, 1836, 1159, 13, 13, 4706, 736, 1819, 13, 13, 13, 1990, 12048, 19933, 14683, 1542, 29911, 2868, 3481, 1847, 29898, 1627, 15933, 5029, 29889, 5841, 15933, 2642, 1125, 13, 1678, 9995, 4205, 16398, 4193, 29901, 3139, 1746, 1024, 10614, 411, 4954, 1649, 1062, 16159, 947, 29915, 29873, 760, 310, 13, 1678, 18981, 3767, 12425, 14683, 29892, 2012, 1304, 304, 9025, 7338, 575, 4127, 4682, 13, 1678, 363, 383, 29950, 8193, 9724, 3321, 3630, 28025, 29889, 13, 13, 1678, 12048, 19933, 11415, 1434, 6724, 29889, 13, 1678, 3789, 310, 11994, 363, 2225, 20525, 29914, 27882, 310, 278, 1580, 19933, 472, 263, 3342, 13, 1678, 10430, 7292, 29892, 7536, 278, 6724, 1889, 29889, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 8989, 703, 10299, 19933, 14683, 1542, 29911, 2868, 3481, 1847, 613, 1040, 29922, 5574, 29897, 13, 13, 1678, 15278, 29901, 285, 29882, 381, 8768, 29889, 1231, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 2611, 4080, 613, 13, 4706, 3611, 543, 13504, 20525, 15278, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 2528, 3245, 1426, 950, 11994, 363, 278, 2225, 20525, 470, 8608, 310, 376, 13, 9651, 376, 1552, 1580, 19933, 29889, 1152, 2777, 29892, 525, 1184, 371, 312, 515, 3578, 14060, 545, 29915, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 1678, 15278, 1649, 1062, 29901, 285, 29882, 381, 8768, 29889, 29943, 29950, 8193, 18213, 3321, 17657, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13995, 543, 29918, 2611, 4080, 613, 3611, 543, 17657, 1746, 363, 4954, 2611, 4080, 16159, 1213, 13, 1678, 1723, 13, 13, 1678, 4236, 18984, 29901, 285, 29882, 381, 8768, 29889, 18984, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 3317, 18984, 613, 13, 4706, 3611, 543, 7976, 12539, 2225, 20525, 931, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 1576, 7472, 931, 7292, 310, 2225, 20525, 310, 278, 1580, 19933, 411, 1438, 376, 13, 9651, 376, 1116, 2187, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 10430, 24399, 3709, 29901, 285, 29882, 381, 8768, 29889, 3399, 519, 1168, 1547, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 12863, 1535, 24399, 3709, 613, 13, 4706, 3611, 543, 5776, 546, 1535, 4021, 3709, 613, 13, 4706, 6139, 7607, 13, 9651, 376, 3112, 4021, 11057, 278, 7292, 310, 10430, 29892, 607, 2931, 7093, 385, 376, 13, 9651, 376, 15693, 26841, 310, 11415, 29889, 11790, 2187, 393, 526, 451, 4475, 304, 10430, 29908, 13, 9651, 376, 1122, 367, 16459, 297, 278, 15278, 1543, 1213, 13, 4706, 10353, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 13, 1678, 10430, 6069, 29901, 285, 29882, 381, 8768, 29889, 6069, 1542, 353, 8989, 29898, 13, 4706, 6213, 29892, 13, 4706, 13995, 543, 12863, 1535, 6069, 613, 13, 4706, 3611, 543, 5776, 546, 1535, 3464, 613, 13, 4706, 6139, 543, 1576, 10430, 7292, 363, 445, 731, 310, 11415, 11994, 19602, 13, 4706, 396, 565, 2875, 338, 1543, 310, 445, 6503, 29889, 13, 4706, 1543, 29918, 6799, 29922, 5574, 29892, 13, 1678, 1723, 13, 2 ]
python/clean_json_step2.py
mfalling/covid19-random_scripts
0
99220
<reponame>mfalling/covid19-random_scripts<gh_stars>0 # FOR USF SAIL # ~ Mihir import csv import pandas as pd import numpy as np import requests import re from bs4 import BeautifulSoup import string import glob import sys import os import signal from requests.exceptions import Timeout #****************** NOTE **************# # Made for USC stuff, USF LATER # #**************************************# #---------Default, always turn url to title tags ------------# turning_url_to_title = False #------------------------------------------------------------# #-------- UPDATE OUT FILE NAME HERE!!!--------------# out_csv_name= r'USC_march_100K_file_final' #---------------------------------------------------# #make a save directory try: os.mkdir("./100K_March/") # <---- Here except OSError as e: print("Directory exists. Please change both folders names in this block to whatever.") #exit() final_path = './100K_March/' # <--- Current directory # UPDATE NUM SAMPLE HERE!!! (Without replacement, DON'T NEED IT YET) #rowsToSample= 100 #--------------------------------------# #----------------------------------- read the all processed bot files -------------------------------------# # since not every user got a bot score, we will need to attach them seperately path = r'C:/Users/ThinkPad/SpyderProjects/JsonStuff/USC_MARCH_STUFF_OLD/all_bots_scores' # use your path all_files = glob.glob(path + "/*.csv") #----------------------------------------------------------------------------------------------------------# li = [] for filename in all_files: df = pd.read_csv(filename, index_col=None, header=0, encoding= 'utf-8-sig',low_memory=False) li.append(df) df_botscores = pd.concat(li, axis=0, ignore_index=True) #---------------------------------------- read the 100k screen names ---------------------------------------------# # Recall that we have already have 100K samples of usernames for botometer so let's import those screen_names path = r'C:/Users/ThinkPad/SpyderProjects/JsonStuff/USC_MARCH_STUFF_OLD/rand_100k_screen_names' # use your path all_files = glob.glob(path + "/*.csv") #----------------------------------------------------------------------------------------------------------------# del li[:] for filename in all_files: df = pd.read_csv(filename, index_col=None, header=0, encoding= 'utf-8-sig',low_memory=False) li.append(df) df_100k = pd.concat(li, axis=0, ignore_index=True) #------ join the 100k screen_name with main_frame (that is to keep screen_names we have bot scores for) # create a column marking df_100 values df_100k['marker'] = 1 #--->Read file by file now# #--------------------------------------- read in all usc data csv files ------------------------------------------# #Read the csvs and make a dataframe path = r'C:/Users/ThinkPad/SpyderProjects/JsonStuff/USC_MARCH_STUFF_OLD/JSONL_TO_CSV_USC_MARCH' # use your path all_files = glob.glob(path + "/*.csv") #-----------------------------------------------------------------------------------------------------------------# del li[:] for filename in all_files: df = pd.read_csv(filename, index_col=None, header=0, encoding= 'utf-8-sig',low_memory=False) li.append(df) df_main= pd.concat(li, axis=0, ignore_index=True) #------- # join the two, keeping all of df1's indices df_joined = pd.merge(df_main, df_100k, on=['user_screen_name'], how='left') # extract desired columns where marker is NaN df_joined= df_joined[pd.notnull(df_joined['marker'])][df_main.columns] #df_joined.to_csv(exportFileName, encoding='utf-8-sig', index=False) #------ now merge the file again df_joined_bots = pd.merge(df_joined,df_botscores, on = ['user_screen_name'],how='left') #df_joined_bots.to_csv(exportFileName, encoding='utf-8-sig', index=False) #------ replace urls with <title> tag #(1) function to get title tag from URL #NOTE: For twitter urls, this will not work, because they don't have "title" even if it # exists in the console when looking at a browser # function that eventually gets the title tags from url def get_title_from_url(url): try: #check if it's a word of https string if(url.startswith('http')): #check if url is valid or returns an html, otherwise cut the time try: page = requests.get(url, timeout=5) except Timeout: # return dead url return '' #if the url is valid, sometimes phisy/ssl-missing site throw error html = BeautifulSoup(page.content, 'html.parser') #finally get the title if everyting is good page_title = html.find('title').text.strip() return page_title else: return url except: return '' #(2) Finally write the csv file file_name = ''.join([out_csv_name, '_utf-8', '.csv']) save_path = os.path.abspath( os.path.join( final_path, file_name ) ) if(turning_url_to_title): # iterate over rows with iterrows() for index, row in df_joined_bots.iterrows(): # access data using column names # do this to prevent Null error that comes from split fn splitting Null df_joined_bots['tweet_text'] = df_joined_bots['tweet_text'].fillna("") df_joined_bots['retweet_text'] = df_joined_bots['retweet_text'].fillna("") df_joined_bots['quoted_text'] = df_joined_bots['quoted_text'].fillna("") #first let's take care of tweet_text s = df_joined_bots.at[index, 'tweet_text'] l = list(map(lambda x: x, s.split())) m = list(map(get_title_from_url, l)) n = ' '.join(m) df_joined_bots.at[index, 'tweet_text']= n del s,l,m,n # then take care of retweets s = df_joined_bots.at[index, 'retweet_text'] l = list(map(lambda x: x, s.split())) m = list(map(get_title_from_url, l)) n = ' '.join(m) df_joined_bots.at[index, 'retweet_text']= n del s, l, m, n # lastly, quoted_text s = df_joined_bots.at[index, 'quoted_text'] l = list(map(lambda x: x, s.split())) m = list(map(get_title_from_url, l)) n = ' '.join(m) df_joined_bots.at[index, 'quoted_text'] = n del s, l, m, n df_joined_bots.to_csv(save_path, encoding='utf-8-sig', index=False) else: #if not wanting to convert urls to csv, go straight to write the file df_joined_bots.to_csv(save_path, encoding='utf-8-sig', index=False) #EOF
[ 1, 529, 276, 1112, 420, 29958, 29885, 11950, 292, 29914, 24542, 333, 29896, 29929, 29899, 8172, 29918, 16713, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 15842, 3148, 29943, 16698, 6227, 30004, 13, 29937, 3695, 29281, 381, 30004, 13, 30004, 13, 5215, 11799, 30004, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 7274, 30004, 13, 5215, 337, 30004, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 30004, 13, 5215, 1347, 30004, 13, 5215, 13149, 30004, 13, 5215, 10876, 30004, 13, 5215, 2897, 30004, 13, 5215, 7182, 30004, 13, 3166, 7274, 29889, 11739, 29879, 1053, 5974, 449, 30004, 13, 30004, 13, 29937, 7775, 1068, 6058, 29923, 334, 4189, 2328, 29930, 29937, 30004, 13, 29937, 259, 18266, 363, 3148, 29907, 6433, 29892, 3148, 29943, 365, 1299, 1001, 418, 396, 30004, 13, 29937, 7775, 7775, 2328, 1068, 29937, 30004, 13, 30004, 13, 29937, 1378, 29899, 4592, 29892, 2337, 2507, 3142, 304, 3611, 8282, 448, 1378, 5634, 29937, 30004, 13, 685, 292, 29918, 2271, 29918, 517, 29918, 3257, 353, 29871, 7700, 30004, 13, 29937, 2683, 2683, 2683, 9072, 29937, 30004, 13, 30004, 13, 30004, 13, 29937, 1378, 16924, 19474, 24080, 27085, 379, 27267, 21004, 9072, 489, 29937, 30004, 13, 449, 29918, 7638, 29918, 978, 29922, 364, 29915, 3308, 29907, 29918, 29885, 1279, 29918, 29896, 29900, 29900, 29968, 29918, 1445, 29918, 8394, 29915, 30004, 13, 29937, 2683, 2683, 2683, 5634, 29937, 30004, 13, 30004, 13, 29937, 5675, 263, 4078, 3884, 30004, 13, 2202, 29901, 30004, 13, 259, 2897, 29889, 11256, 3972, 703, 6904, 29896, 29900, 29900, 29968, 29918, 29924, 1279, 29914, 1159, 396, 529, 807, 2266, 30004, 13, 19499, 438, 29173, 408, 321, 29901, 30004, 13, 259, 1596, 703, 9882, 4864, 29889, 3529, 1735, 1716, 16495, 2983, 297, 445, 2908, 304, 6514, 23157, 30004, 13, 259, 396, 13322, 26471, 13, 30004, 13, 8394, 29918, 2084, 353, 19283, 29896, 29900, 29900, 29968, 29918, 29924, 1279, 22208, 396, 529, 5634, 9626, 3884, 30004, 13, 30004, 13, 29937, 16924, 28019, 16698, 3580, 1307, 379, 27267, 21004, 313, 3047, 449, 16920, 29892, 360, 1164, 29915, 29911, 14693, 3352, 13315, 612, 2544, 8443, 13, 29937, 5727, 1762, 17708, 29922, 29871, 29896, 29900, 29900, 30004, 13, 29937, 2683, 2683, 22158, 29937, 30004, 13, 30004, 13, 29937, 2683, 2683, 5634, 1303, 278, 599, 19356, 9225, 2066, 448, 2683, 2683, 807, 29937, 30004, 13, 29937, 1951, 451, 1432, 1404, 2355, 263, 9225, 8158, 29892, 591, 674, 817, 304, 10641, 963, 409, 546, 2486, 30004, 13, 2084, 353, 364, 29915, 29907, 8419, 5959, 29914, 1349, 682, 20369, 29914, 29903, 2272, 672, 25119, 29914, 8148, 855, 3096, 29914, 3308, 29907, 29918, 1529, 29934, 3210, 29918, 1254, 29965, 4198, 29918, 5607, 29928, 29914, 497, 29918, 29890, 1862, 29918, 1557, 2361, 29915, 396, 671, 596, 2224, 30004, 13, 497, 29918, 5325, 353, 13149, 29889, 23705, 29898, 2084, 718, 376, 5515, 29889, 7638, 1159, 30004, 13, 30004, 13, 29937, 2683, 2683, 2683, 2683, 2683, 2683, 28400, 29937, 30004, 13, 30004, 13, 492, 353, 5159, 30004, 13, 30004, 13, 1454, 10422, 297, 599, 29918, 5325, 29901, 30004, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 9507, 29892, 2380, 29918, 1054, 29922, 8516, 29892, 4839, 29922, 29900, 29892, 8025, 29922, 525, 9420, 29899, 29947, 29899, 18816, 742, 677, 29918, 14834, 29922, 8824, 8443, 13, 1678, 619, 29889, 4397, 29898, 2176, 8443, 13, 30004, 13, 2176, 29918, 7451, 1557, 2361, 353, 10518, 29889, 17685, 29898, 492, 29892, 9685, 29922, 29900, 29892, 11455, 29918, 2248, 29922, 5574, 8443, 13, 30004, 13, 29937, 2683, 2683, 1378, 1303, 278, 29871, 29896, 29900, 29900, 29895, 4315, 2983, 448, 2683, 2683, 9072, 29937, 30004, 13, 29937, 3599, 497, 393, 591, 505, 2307, 505, 29871, 29896, 29900, 29900, 29968, 11916, 310, 502, 824, 1280, 363, 9225, 8328, 577, 1235, 29915, 29879, 1053, 1906, 4315, 29918, 7039, 30004, 13, 2084, 353, 364, 29915, 29907, 8419, 5959, 29914, 1349, 682, 20369, 29914, 29903, 2272, 672, 25119, 29914, 8148, 855, 3096, 29914, 3308, 29907, 29918, 1529, 29934, 3210, 29918, 1254, 29965, 4198, 29918, 5607, 29928, 29914, 9502, 29918, 29896, 29900, 29900, 29895, 29918, 10525, 29918, 7039, 29915, 396, 671, 596, 2224, 30004, 13, 497, 29918, 5325, 353, 13149, 29889, 23705, 29898, 2084, 718, 376, 5515, 29889, 7638, 1159, 30004, 13, 30004, 13, 29937, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 29937, 30004, 13, 30004, 13, 6144, 619, 7503, 29962, 30004, 13, 30004, 13, 1454, 10422, 297, 599, 29918, 5325, 29901, 30004, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 9507, 29892, 2380, 29918, 1054, 29922, 8516, 29892, 4839, 29922, 29900, 29892, 8025, 29922, 525, 9420, 29899, 29947, 29899, 18816, 742, 677, 29918, 14834, 29922, 8824, 8443, 13, 1678, 619, 29889, 4397, 29898, 2176, 8443, 13, 30004, 13, 2176, 29918, 29896, 29900, 29900, 29895, 353, 10518, 29889, 17685, 29898, 492, 29892, 9685, 29922, 29900, 29892, 11455, 29918, 2248, 29922, 5574, 8443, 13, 30004, 13, 29937, 22158, 5988, 278, 29871, 29896, 29900, 29900, 29895, 4315, 29918, 978, 411, 1667, 29918, 2557, 313, 5747, 338, 304, 3013, 4315, 29918, 7039, 591, 505, 9225, 19435, 363, 8443, 13, 29937, 1653, 263, 1897, 2791, 292, 4489, 29918, 29896, 29900, 29900, 1819, 30004, 13, 2176, 29918, 29896, 29900, 29900, 29895, 1839, 22976, 2033, 353, 29871, 29896, 30004, 13, 30004, 13, 29937, 489, 976, 6359, 934, 491, 934, 1286, 29937, 30004, 13, 30004, 13, 29937, 2683, 2683, 26589, 1303, 297, 599, 502, 29883, 848, 11799, 2066, 448, 2683, 2683, 1378, 29899, 29937, 30004, 13, 29937, 6359, 278, 5939, 4270, 322, 1207, 263, 12205, 30004, 13, 2084, 353, 364, 29915, 29907, 8419, 5959, 29914, 1349, 682, 20369, 29914, 29903, 2272, 672, 25119, 29914, 8148, 855, 3096, 29914, 3308, 29907, 29918, 1529, 29934, 3210, 29918, 1254, 29965, 4198, 29918, 5607, 29928, 29914, 7249, 29931, 29918, 4986, 29918, 29907, 7597, 29918, 3308, 29907, 29918, 1529, 29934, 3210, 29915, 396, 671, 596, 2224, 30004, 13, 497, 29918, 5325, 353, 13149, 29889, 23705, 29898, 2084, 718, 376, 5515, 29889, 7638, 1159, 30004, 13, 29937, 2683, 2683, 2683, 2683, 2683, 2683, 2683, 29899, 29937, 30004, 13, 30004, 13, 6144, 619, 7503, 29962, 30004, 13, 30004, 13, 1454, 10422, 297, 599, 29918, 5325, 29901, 30004, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 9507, 29892, 2380, 29918, 1054, 29922, 8516, 29892, 4839, 29922, 29900, 29892, 8025, 29922, 525, 9420, 29899, 29947, 29899, 18816, 742, 677, 29918, 14834, 29922, 8824, 8443, 13, 1678, 619, 29889, 4397, 29898, 2176, 8443, 13, 30004, 13, 2176, 29918, 3396, 29922, 10518, 29889, 17685, 29898, 492, 29892, 9685, 29922, 29900, 29892, 11455, 29918, 2248, 29922, 5574, 8443, 13, 30004, 13, 29937, 26589, 30004, 13, 30004, 13, 29937, 5988, 278, 1023, 29892, 12515, 599, 310, 4489, 29896, 29915, 29879, 16285, 30004, 13, 2176, 29918, 2212, 1312, 353, 10518, 29889, 14634, 29898, 2176, 29918, 3396, 29892, 4489, 29918, 29896, 29900, 29900, 29895, 29892, 373, 29922, 1839, 1792, 29918, 10525, 29918, 978, 7464, 920, 2433, 1563, 1495, 30004, 13, 30004, 13, 30004, 13, 29937, 6597, 7429, 4341, 988, 17456, 338, 18780, 30004, 13, 2176, 29918, 2212, 1312, 29922, 4489, 29918, 2212, 1312, 29961, 15926, 29889, 1333, 4304, 29898, 2176, 29918, 2212, 1312, 1839, 22976, 11287, 3816, 2176, 29918, 3396, 29889, 13099, 29962, 30004, 13, 30004, 13, 29937, 2176, 29918, 2212, 1312, 29889, 517, 29918, 7638, 29898, 15843, 17020, 29892, 8025, 2433, 9420, 29899, 29947, 29899, 18816, 742, 2380, 29922, 8824, 8443, 13, 30004, 13, 29937, 22158, 1286, 10366, 278, 934, 1449, 30004, 13, 2176, 29918, 2212, 1312, 29918, 29890, 1862, 353, 10518, 29889, 14634, 29898, 2176, 29918, 2212, 1312, 29892, 2176, 29918, 7451, 1557, 2361, 29892, 373, 353, 6024, 1792, 29918, 10525, 29918, 978, 7464, 3525, 2433, 1563, 1495, 30004, 13, 30004, 13, 29937, 2176, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 517, 29918, 7638, 29898, 15843, 17020, 29892, 8025, 2433, 9420, 29899, 29947, 29899, 18816, 742, 2380, 29922, 8824, 8443, 13, 30004, 13, 29937, 22158, 5191, 23942, 411, 529, 3257, 29958, 4055, 30004, 13, 29937, 29898, 29896, 29897, 740, 304, 679, 3611, 4055, 515, 3988, 30004, 13, 29937, 12256, 29923, 29901, 1152, 23394, 23942, 29892, 445, 674, 451, 664, 29892, 1363, 896, 1016, 29915, 29873, 505, 376, 3257, 29908, 1584, 565, 372, 30004, 13, 29937, 539, 4864, 297, 278, 2991, 746, 3063, 472, 263, 4714, 30004, 13, 30004, 13, 29937, 740, 393, 10201, 4947, 278, 3611, 8282, 515, 3142, 30004, 13, 1753, 679, 29918, 3257, 29918, 3166, 29918, 2271, 29898, 2271, 1125, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 396, 3198, 565, 372, 29915, 29879, 263, 1734, 310, 2045, 1347, 30004, 13, 4706, 565, 29898, 2271, 29889, 27382, 2541, 877, 1124, 8785, 29901, 965, 6756, 13, 9651, 396, 3198, 565, 3142, 338, 2854, 470, 3639, 385, 3472, 29892, 6467, 5700, 278, 931, 30004, 13, 9651, 1018, 29901, 30004, 13, 18884, 1813, 353, 7274, 29889, 657, 29898, 2271, 29892, 11815, 29922, 29945, 8443, 13, 9651, 5174, 5974, 449, 29901, 30004, 13, 18884, 396, 736, 7123, 3142, 30004, 13, 18884, 736, 6629, 30004, 13, 9651, 396, 361, 278, 3142, 338, 2854, 29892, 6041, 1374, 13344, 29914, 16265, 29899, 27259, 3268, 3183, 1059, 30004, 13, 9651, 3472, 353, 25685, 29903, 1132, 29898, 3488, 29889, 3051, 29892, 525, 1420, 29889, 16680, 1495, 30004, 13, 9651, 396, 4951, 635, 679, 278, 3611, 565, 1432, 1259, 338, 1781, 30004, 13, 9651, 1813, 29918, 3257, 353, 3472, 29889, 2886, 877, 3257, 2824, 726, 29889, 17010, 580, 965, 6756, 13, 9651, 736, 1813, 29918, 3257, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 3142, 30004, 13, 1678, 5174, 29901, 30004, 13, 4706, 736, 6629, 30004, 13, 30004, 13, 29937, 29898, 29906, 29897, 9788, 2436, 278, 11799, 934, 30004, 13, 1445, 29918, 978, 353, 525, 4286, 7122, 4197, 449, 29918, 7638, 29918, 978, 29892, 22868, 9420, 29899, 29947, 742, 15300, 7638, 2033, 8443, 13, 7620, 29918, 2084, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 30004, 13, 1678, 2897, 29889, 2084, 29889, 7122, 29898, 30004, 13, 4706, 2186, 29918, 2084, 29892, 934, 29918, 978, 30004, 13, 1678, 1723, 30004, 13, 8443, 13, 30004, 13, 361, 29898, 685, 292, 29918, 2271, 29918, 517, 29918, 3257, 1125, 30004, 13, 1678, 396, 13649, 975, 4206, 411, 4256, 5727, 26471, 13, 1678, 363, 2380, 29892, 1948, 297, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 1524, 5727, 7295, 30004, 13, 4706, 396, 2130, 848, 773, 1897, 2983, 30004, 13, 4706, 396, 437, 445, 304, 5557, 19014, 1059, 393, 5304, 515, 6219, 7876, 24368, 19014, 30004, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 29873, 16668, 29918, 726, 2033, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 29873, 16668, 29918, 726, 13359, 5589, 1056, 703, 1159, 30004, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 2267, 16668, 29918, 726, 2033, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 2267, 16668, 29918, 726, 13359, 5589, 1056, 703, 1159, 30004, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 339, 5715, 29918, 726, 2033, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 1839, 339, 5715, 29918, 726, 13359, 5589, 1056, 703, 1159, 30004, 13, 30004, 13, 4706, 396, 4102, 1235, 29915, 29879, 2125, 2562, 310, 7780, 300, 29918, 726, 30004, 13, 4706, 269, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 29873, 16668, 29918, 726, 2033, 30004, 13, 4706, 301, 353, 1051, 29898, 1958, 29898, 2892, 921, 29901, 921, 29892, 269, 29889, 5451, 22130, 30004, 13, 4706, 286, 353, 1051, 29898, 1958, 29898, 657, 29918, 3257, 29918, 3166, 29918, 2271, 29892, 301, 876, 30004, 13, 4706, 302, 353, 525, 15300, 7122, 29898, 29885, 8443, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 29873, 16668, 29918, 726, 2033, 29922, 302, 30004, 13, 30004, 13, 4706, 628, 269, 29892, 29880, 29892, 29885, 29892, 29876, 30004, 13, 30004, 13, 4706, 396, 769, 2125, 2562, 310, 3240, 705, 1691, 30004, 13, 4706, 269, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 2267, 16668, 29918, 726, 2033, 30004, 13, 4706, 301, 353, 1051, 29898, 1958, 29898, 2892, 921, 29901, 921, 29892, 269, 29889, 5451, 22130, 30004, 13, 4706, 286, 353, 1051, 29898, 1958, 29898, 657, 29918, 3257, 29918, 3166, 29918, 2271, 29892, 301, 876, 30004, 13, 4706, 302, 353, 525, 15300, 7122, 29898, 29885, 8443, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 2267, 16668, 29918, 726, 2033, 29922, 302, 30004, 13, 30004, 13, 4706, 628, 269, 29892, 301, 29892, 286, 29892, 302, 30004, 13, 30004, 13, 4706, 396, 1833, 368, 29892, 23153, 29918, 726, 30004, 13, 4706, 269, 353, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 339, 5715, 29918, 726, 2033, 30004, 13, 4706, 301, 353, 1051, 29898, 1958, 29898, 2892, 921, 29901, 921, 29892, 269, 29889, 5451, 22130, 30004, 13, 4706, 286, 353, 1051, 29898, 1958, 29898, 657, 29918, 3257, 29918, 3166, 29918, 2271, 29892, 301, 876, 30004, 13, 4706, 302, 353, 525, 15300, 7122, 29898, 29885, 8443, 13, 4706, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 271, 29961, 2248, 29892, 525, 339, 5715, 29918, 726, 2033, 353, 302, 30004, 13, 30004, 13, 4706, 628, 269, 29892, 301, 29892, 286, 29892, 302, 30004, 13, 30004, 13, 1678, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 517, 29918, 7638, 29898, 7620, 29918, 2084, 29892, 8025, 2433, 9420, 29899, 29947, 29899, 18816, 742, 2380, 29922, 8824, 8443, 13, 30004, 13, 2870, 29901, 30004, 13, 1678, 396, 361, 451, 24507, 304, 3588, 23942, 304, 11799, 29892, 748, 7812, 304, 2436, 278, 934, 30004, 13, 1678, 4489, 29918, 2212, 1312, 29918, 29890, 1862, 29889, 517, 29918, 7638, 29898, 7620, 29918, 2084, 29892, 8025, 2433, 9420, 29899, 29947, 29899, 18816, 742, 2380, 29922, 8824, 8443, 13, 30004, 13, 29937, 29923, 9800, 2 ]
setup.py
yvesf/flask-mediabrowser
21
165849
#!/usr/bin/env python3 from distutils.core import setup setup(name='flask-mediabrowser', version='0.0.1', description='HTTP media browsing and streaming/transcoding', author='<NAME>', author_email='<EMAIL>', url='https://www.xapek.org/git/yvesf/flask-mediabrowser', packages=['mediabrowser'], include_package_data=True, # use MANIFEST.in during install scripts=['flask-mediabrowser'], install_requires=['Flask==0.10.1'] )
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 3166, 1320, 13239, 29889, 3221, 1053, 6230, 13, 13, 14669, 29898, 978, 2433, 1579, 1278, 29899, 4210, 370, 8777, 742, 13, 418, 1873, 2433, 29900, 29889, 29900, 29889, 29896, 742, 13, 418, 6139, 2433, 10493, 5745, 3347, 2976, 322, 24820, 29914, 3286, 29883, 3689, 742, 13, 418, 4148, 2433, 29966, 5813, 29958, 742, 13, 418, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 418, 3142, 2433, 991, 597, 1636, 29889, 29916, 4085, 29895, 29889, 990, 29914, 5559, 29914, 29891, 1960, 29888, 29914, 1579, 1278, 29899, 4210, 370, 8777, 742, 13, 418, 9741, 29922, 1839, 4210, 370, 8777, 7464, 13, 418, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 29871, 396, 671, 341, 2190, 6545, 29923, 1254, 29889, 262, 2645, 2601, 13, 418, 12078, 29922, 1839, 1579, 1278, 29899, 4210, 370, 8777, 7464, 13, 418, 2601, 29918, 276, 339, 2658, 29922, 1839, 8754, 1278, 1360, 29900, 29889, 29896, 29900, 29889, 29896, 2033, 13, 418, 1723, 13, 2 ]
mmtbx/programs/emringer.py
jbeilstenedmands/cctbx_project
0
138522
from __future__ import division, print_function try: from phenix.program_template import ProgramTemplate except ImportError: from libtbx.program_template import ProgramTemplate import os import libtbx.phil from libtbx.utils import Sorry from libtbx import easy_pickle import mmtbx.ringer.emringer # ============================================================================= program_citations = libtbx.phil.parse(''' citation { article_id = emringer1 authors = <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> title = Side-chain-directed model and map validation for 3D Electron Cryomicroscopy. journal = Nature Methods volume = 10 pages = 943-46 year = 2015 doi_id = "10.1038/nmeth.3541" pmid = 26280328 external = True } citation { article_id = emringer2 authors = <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> title = Automated electron-density sampling reveals widespread conformational polymorphism in proteins. journal = Protein Sci. volume = 7 pages = 1420-31 year = 2010 doi_id = "" pmid = 20499387 external = True } ''') # ============================================================================= master_phil_str = ''' include scope libtbx.phil.interface.tracking_params include scope mmtbx.ringer.emringer.master_params map_label = 2FOFCWT,PH2FOFCWT .type = str .input_size = 200 .short_caption = 2Fo-FC map labels .help = Labels for 2Fo-Fc map coefficients show_gui = False .type = bool output_base = None .type = str output_dir = None .type = path .short_caption = Output directory quiet = False .type = bool .short_caption = no graphs .help = Don't output files or graphs ''' # ============================================================================= class Program(ProgramTemplate): description = ''' Program for calculating the EMRinger score.\n Minimum required inputs: Model file Map file (or file with map coefficients) How to run: phenix.emringer model.pdb map.ccp4 ''' datatypes = ['model', 'real_map', 'phil', 'map_coefficients'] citations = program_citations master_phil_str = master_phil_str # --------------------------------------------------------------------------- def validate(self): print('Validating inputs', file=self.logger) self.data_manager.has_models(raise_sorry=True) if not (self.data_manager.has_real_maps() or self.data_manager.has_map_coefficients()): raise Sorry("Supply a map file or a file with map coefficients.") elif (self.data_manager.has_real_maps() and self.data_manager.has_map_coefficients()): raise Sorry("Supply either a map file or a file with map coefficients.") # --------------------------------------------------------------------------- def run(self): map_inp = None miller_array = None print('Using model: %s' % self.data_manager.get_default_model_name(), file=self.logger) model = self.data_manager.get_model() if self.data_manager.has_map_coefficients(): miller_arrays = self.data_manager.get_miller_arrays() miller_array = self.find_label(miller_arrays = miller_arrays) print('Using miller array: %s' % miller_array.info().label_string(), file=self.logger) elif self.data_manager.has_real_maps(): print('Using map: %s' % self.data_manager.get_default_real_map_name(), file=self.logger) map_inp = self.data_manager.get_real_map() print("CCP4 map statistics:", file=self.logger) map_inp.show_summary(out=self.logger, prefix=" ") if (self.params.output_base is None) : pdb_base = os.path.basename(self.data_manager.get_default_model_name()) self.params.output_base = os.path.splitext(pdb_base)[0] + "_emringer" if not self.params.quiet: plots_dir = self.params.output_base + "_plots" if (not os.path.isdir(plots_dir)) : os.makedirs(plots_dir) task_obj = mmtbx.ringer.emringer.emringer( model = model, miller_array = miller_array, map_inp = map_inp, params = self.params, out = self.logger) task_obj.validate() task_obj.run() self.results = task_obj.get_results() ringer_result = self.results.ringer_result if not self.params.quiet: # save as pickle easy_pickle.dump("%s.pkl" % self.params.output_base, ringer_result) print ('Wrote %s.pkl' % self.params.output_base, file=self.logger) # save as CSV csv = "\n".join([ r.format_csv() for r in ringer_result]) open("%s.csv" % self.params.output_base, "w").write(csv) print ('Wrote %s.csv' % self.params.output_base, file=self.logger) scoring_result = self.results.scoring_result scoring_result.show_summary(out = self.logger) #rolling_result = self.results.rolling_result # It would be good to have central code for this # --------------------------------------------------------------------------- def find_label(self, miller_arrays): best_guess = None best_labels = [] all_labels = [] miller_array = None for array in miller_arrays: label = array.info().label_string().replace(" ", "") if (self.params.map_label is not None): if (label == self.params.map_label.replace(" ", "")): miller_array = array return miller_array elif (self.params.map_label is None): if (array.is_complex_array()): all_labels.append(label) if (label.startswith("2FOFCWT") or label.startswith("2mFoDFc") or label.startswith("FWT")) : best_guess = array best_labels.append(label) if (miller_array is None): if (len(all_labels) == 0) : raise Sorry("No valid (pre-weighted) map coefficients found in file.") elif (len(best_labels) == 0) : raise Sorry("Couldn't automatically determine appropriate map labels. "+ "Choices:\n %s" % " \n".join(all_labels)) elif (len(best_labels) > 1) : raise Sorry("Multiple appropriate map coefficients found in file. "+ "Choices:\n %s" % "\n ".join(best_labels)) elif (len(best_labels) == 1): miller_array = best_guess print(" Guessing %s for input map coefficients"% best_labels[0], file=self.logger) return miller_array # --------------------------------------------------------------------------- def get_results(self): return self.results
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8542, 29892, 1596, 29918, 2220, 13, 2202, 29901, 13, 29871, 515, 17292, 861, 29889, 8860, 29918, 6886, 1053, 7835, 6733, 13, 19499, 16032, 2392, 29901, 13, 29871, 515, 619, 3116, 29890, 29916, 29889, 8860, 29918, 6886, 1053, 7835, 6733, 13, 5215, 2897, 13, 5215, 619, 3116, 29890, 29916, 29889, 561, 309, 13, 3166, 619, 3116, 29890, 29916, 29889, 13239, 1053, 8221, 13, 3166, 619, 3116, 29890, 29916, 1053, 4780, 29918, 23945, 280, 13, 5215, 286, 4378, 29890, 29916, 29889, 5393, 261, 29889, 331, 5393, 261, 13, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 13, 8860, 29918, 20752, 800, 353, 619, 3116, 29890, 29916, 29889, 561, 309, 29889, 5510, 877, 4907, 13, 29883, 7018, 426, 13, 29871, 4274, 29918, 333, 353, 953, 5393, 261, 29896, 13, 29871, 15717, 353, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 29958, 13, 29871, 3611, 353, 19160, 29899, 14153, 29899, 11851, 287, 1904, 322, 2910, 8845, 363, 29871, 29941, 29928, 28251, 22121, 290, 2357, 1557, 2270, 29889, 13, 29871, 8955, 353, 17677, 8108, 29879, 13, 29871, 7977, 353, 29871, 29896, 29900, 13, 29871, 6515, 353, 29871, 29929, 29946, 29941, 29899, 29946, 29953, 13, 29871, 1629, 353, 29871, 29906, 29900, 29896, 29945, 13, 29871, 13102, 29918, 333, 353, 376, 29896, 29900, 29889, 29896, 29900, 29941, 29947, 29914, 22882, 621, 29889, 29941, 29945, 29946, 29896, 29908, 13, 29871, 282, 6563, 353, 29871, 29906, 29953, 29906, 29947, 29900, 29941, 29906, 29947, 13, 29871, 7029, 353, 5852, 13, 29913, 13, 13, 29883, 7018, 426, 13, 29871, 4274, 29918, 333, 353, 953, 5393, 261, 29906, 13, 29871, 15717, 353, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 10202, 529, 5813, 29958, 13, 29871, 3611, 353, 15854, 630, 11966, 29899, 21518, 537, 23460, 10320, 1338, 281, 2247, 29886, 949, 14670, 1288, 24324, 28611, 297, 3279, 1144, 29889, 13, 29871, 8955, 353, 14409, 262, 5636, 29889, 13, 29871, 7977, 353, 29871, 29955, 13, 29871, 6515, 353, 29871, 29896, 29946, 29906, 29900, 29899, 29941, 29896, 13, 29871, 1629, 353, 29871, 29906, 29900, 29896, 29900, 13, 29871, 13102, 29918, 333, 353, 5124, 13, 29871, 282, 6563, 353, 29871, 29906, 29900, 29946, 29929, 29929, 29941, 29947, 29955, 13, 29871, 7029, 353, 5852, 13, 29913, 13, 4907, 1495, 13, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 13, 6207, 29918, 561, 309, 29918, 710, 353, 14550, 13, 2856, 6874, 619, 3116, 29890, 29916, 29889, 561, 309, 29889, 13248, 29889, 11294, 292, 29918, 7529, 13, 2856, 6874, 286, 4378, 29890, 29916, 29889, 5393, 261, 29889, 331, 5393, 261, 29889, 6207, 29918, 7529, 13, 1958, 29918, 1643, 353, 29871, 29906, 5800, 8610, 17755, 29892, 19689, 29906, 5800, 8610, 17755, 13, 29871, 869, 1853, 353, 851, 13, 29871, 869, 2080, 29918, 2311, 353, 29871, 29906, 29900, 29900, 13, 29871, 869, 12759, 29918, 6671, 353, 29871, 29906, 29943, 29877, 29899, 8610, 2910, 11073, 13, 29871, 869, 8477, 353, 15796, 29879, 363, 29871, 29906, 29943, 29877, 29899, 29943, 29883, 2910, 16127, 13, 4294, 29918, 23569, 353, 7700, 13, 29871, 869, 1853, 353, 6120, 13, 4905, 29918, 3188, 353, 6213, 13, 29871, 869, 1853, 353, 851, 13, 4905, 29918, 3972, 353, 6213, 13, 29871, 869, 1853, 353, 2224, 13, 29871, 869, 12759, 29918, 6671, 353, 10604, 3884, 13, 339, 2035, 353, 7700, 13, 29871, 869, 1853, 353, 6120, 13, 29871, 869, 12759, 29918, 6671, 353, 694, 18445, 13, 29871, 869, 8477, 353, 3872, 29915, 29873, 1962, 2066, 470, 18445, 13, 12008, 13, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 25512, 13, 13, 1990, 7835, 29898, 9283, 6733, 1125, 13, 13, 29871, 6139, 353, 14550, 13, 9283, 363, 25202, 278, 382, 21055, 5621, 8158, 7790, 29876, 13, 13, 8140, 12539, 3734, 10970, 29901, 13, 29871, 8125, 934, 13, 29871, 7315, 934, 313, 272, 934, 411, 2910, 16127, 29897, 13, 13, 5328, 304, 1065, 29901, 13, 29871, 17292, 861, 29889, 331, 5393, 261, 1904, 29889, 29886, 2585, 2910, 29889, 617, 29886, 29946, 13, 12008, 13, 13, 29871, 1418, 271, 7384, 353, 6024, 4299, 742, 525, 6370, 29918, 1958, 742, 525, 561, 309, 742, 525, 1958, 29918, 1111, 8462, 29879, 2033, 13, 13, 29871, 7537, 800, 353, 1824, 29918, 20752, 800, 13, 29871, 5835, 29918, 561, 309, 29918, 710, 353, 5835, 29918, 561, 309, 29918, 710, 13, 13, 13, 29871, 396, 448, 2683, 2683, 2683, 2683, 28400, 13, 29871, 822, 12725, 29898, 1311, 1125, 13, 1678, 1596, 877, 7211, 1218, 10970, 742, 934, 29922, 1311, 29889, 21707, 29897, 13, 1678, 1583, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 9794, 29898, 22692, 29918, 29879, 3818, 29922, 5574, 29897, 13, 1678, 565, 451, 313, 1311, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 6370, 29918, 10339, 580, 470, 13, 4706, 1583, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 1958, 29918, 1111, 8462, 29879, 580, 1125, 13, 418, 12020, 8221, 703, 20182, 368, 263, 2910, 934, 470, 263, 934, 411, 2910, 16127, 23157, 13, 1678, 25342, 313, 1311, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 6370, 29918, 10339, 580, 322, 13, 4706, 1583, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 1958, 29918, 1111, 8462, 29879, 580, 1125, 13, 418, 12020, 8221, 703, 20182, 368, 2845, 263, 2910, 934, 470, 263, 934, 411, 2910, 16127, 23157, 13, 13, 29871, 396, 448, 2683, 2683, 2683, 2683, 28400, 13, 29871, 822, 1065, 29898, 1311, 1125, 13, 1678, 2910, 29918, 262, 29886, 353, 6213, 13, 1678, 3533, 261, 29918, 2378, 353, 6213, 13, 13, 1678, 1596, 877, 15156, 1904, 29901, 1273, 29879, 29915, 1273, 1583, 29889, 1272, 29918, 12847, 29889, 657, 29918, 4381, 29918, 4299, 29918, 978, 3285, 13, 418, 934, 29922, 1311, 29889, 21707, 29897, 13, 1678, 1904, 353, 1583, 29889, 1272, 29918, 12847, 29889, 657, 29918, 4299, 580, 13, 13, 1678, 565, 1583, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 1958, 29918, 1111, 8462, 29879, 7295, 13, 418, 3533, 261, 29918, 2378, 29879, 353, 1583, 29889, 1272, 29918, 12847, 29889, 657, 29918, 29885, 5495, 29918, 2378, 29879, 580, 13, 418, 3533, 261, 29918, 2378, 353, 1583, 29889, 2886, 29918, 1643, 29898, 29885, 5495, 29918, 2378, 29879, 353, 3533, 261, 29918, 2378, 29879, 29897, 13, 418, 1596, 877, 15156, 3533, 261, 1409, 29901, 1273, 29879, 29915, 1273, 3533, 261, 29918, 2378, 29889, 3888, 2141, 1643, 29918, 1807, 3285, 13, 4706, 934, 29922, 1311, 29889, 21707, 29897, 13, 1678, 25342, 1583, 29889, 1272, 29918, 12847, 29889, 5349, 29918, 6370, 29918, 10339, 7295, 13, 418, 1596, 877, 15156, 2910, 29901, 1273, 29879, 29915, 1273, 1583, 29889, 1272, 29918, 12847, 29889, 657, 29918, 4381, 29918, 6370, 29918, 1958, 29918, 978, 3285, 13, 4706, 934, 29922, 1311, 29889, 21707, 29897, 13, 418, 2910, 29918, 262, 29886, 353, 1583, 29889, 1272, 29918, 12847, 29889, 657, 29918, 6370, 29918, 1958, 580, 13, 418, 1596, 703, 4174, 29925, 29946, 2910, 13964, 29901, 613, 934, 29922, 1311, 29889, 21707, 29897, 13, 418, 2910, 29918, 262, 29886, 29889, 4294, 29918, 7727, 29898, 449, 29922, 1311, 29889, 21707, 29892, 10944, 543, 29871, 16521, 13, 13, 1678, 565, 313, 1311, 29889, 7529, 29889, 4905, 29918, 3188, 338, 6213, 29897, 584, 13, 418, 282, 2585, 29918, 3188, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 1311, 29889, 1272, 29918, 12847, 29889, 657, 29918, 4381, 29918, 4299, 29918, 978, 3101, 13, 418, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 29886, 2585, 29918, 3188, 9601, 29900, 29962, 718, 11119, 331, 5393, 261, 29908, 13, 13, 1678, 565, 451, 1583, 29889, 7529, 29889, 339, 2035, 29901, 13, 418, 24580, 29918, 3972, 353, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 718, 11119, 26762, 29908, 13, 418, 565, 313, 1333, 2897, 29889, 2084, 29889, 275, 3972, 29898, 26762, 29918, 3972, 876, 584, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 26762, 29918, 3972, 29897, 13, 13, 1678, 3414, 29918, 5415, 353, 286, 4378, 29890, 29916, 29889, 5393, 261, 29889, 331, 5393, 261, 29889, 331, 5393, 261, 29898, 13, 418, 1904, 4706, 353, 1904, 29892, 13, 418, 3533, 261, 29918, 2378, 353, 3533, 261, 29918, 2378, 29892, 13, 418, 2910, 29918, 262, 29886, 418, 353, 2910, 29918, 262, 29886, 29892, 13, 418, 8636, 539, 353, 1583, 29889, 7529, 29892, 13, 418, 714, 3986, 353, 1583, 29889, 21707, 29897, 13, 1678, 3414, 29918, 5415, 29889, 15480, 580, 13, 1678, 3414, 29918, 5415, 29889, 3389, 580, 13, 1678, 1583, 29889, 9902, 353, 3414, 29918, 5415, 29889, 657, 29918, 9902, 580, 13, 13, 1678, 364, 5621, 29918, 2914, 353, 1583, 29889, 9902, 29889, 5393, 261, 29918, 2914, 13, 13, 1678, 565, 451, 1583, 29889, 7529, 29889, 339, 2035, 29901, 13, 418, 396, 4078, 408, 5839, 280, 13, 418, 4780, 29918, 23945, 280, 29889, 15070, 11702, 29879, 29889, 29886, 6321, 29908, 1273, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 29892, 364, 5621, 29918, 2914, 29897, 13, 418, 1596, 6702, 29956, 4859, 1273, 29879, 29889, 29886, 6321, 29915, 1273, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 29892, 934, 29922, 1311, 29889, 21707, 29897, 13, 418, 396, 4078, 408, 16874, 13, 418, 11799, 353, 6634, 29876, 1642, 7122, 4197, 364, 29889, 4830, 29918, 7638, 580, 363, 364, 297, 364, 5621, 29918, 2914, 2314, 13, 418, 1722, 11702, 29879, 29889, 7638, 29908, 1273, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 29892, 376, 29893, 2564, 3539, 29898, 7638, 29897, 13, 418, 1596, 6702, 29956, 4859, 1273, 29879, 29889, 7638, 29915, 1273, 1583, 29889, 7529, 29889, 4905, 29918, 3188, 29892, 934, 29922, 1311, 29889, 21707, 29897, 13, 13, 1678, 26654, 29918, 2914, 353, 1583, 29889, 9902, 29889, 1557, 8253, 29918, 2914, 13, 1678, 26654, 29918, 2914, 29889, 4294, 29918, 7727, 29898, 449, 353, 1583, 29889, 21707, 29897, 13, 13, 1678, 396, 22155, 29918, 2914, 353, 1583, 29889, 9902, 29889, 22155, 29918, 2914, 13, 13, 29871, 396, 739, 723, 367, 1781, 304, 505, 6555, 775, 363, 445, 13, 29871, 396, 448, 2683, 2683, 2683, 2683, 28400, 13, 29871, 822, 1284, 29918, 1643, 29898, 1311, 29892, 3533, 261, 29918, 2378, 29879, 1125, 13, 1678, 1900, 29918, 2543, 404, 353, 6213, 13, 1678, 1900, 29918, 21134, 353, 5159, 13, 1678, 599, 29918, 21134, 353, 5159, 13, 1678, 3533, 261, 29918, 2378, 353, 6213, 13, 1678, 363, 1409, 297, 3533, 261, 29918, 2378, 29879, 29901, 13, 418, 3858, 353, 1409, 29889, 3888, 2141, 1643, 29918, 1807, 2141, 6506, 703, 9162, 20569, 13, 418, 565, 313, 1311, 29889, 7529, 29889, 1958, 29918, 1643, 338, 451, 6213, 1125, 13, 4706, 565, 313, 1643, 1275, 1583, 29889, 7529, 29889, 1958, 29918, 1643, 29889, 6506, 703, 9162, 5124, 22164, 13, 3986, 3533, 261, 29918, 2378, 353, 1409, 13, 3986, 736, 3533, 261, 29918, 2378, 13, 418, 25342, 313, 1311, 29889, 7529, 29889, 1958, 29918, 1643, 338, 6213, 1125, 13, 4706, 565, 313, 2378, 29889, 275, 29918, 19676, 29918, 2378, 580, 1125, 13, 3986, 599, 29918, 21134, 29889, 4397, 29898, 1643, 29897, 13, 3986, 565, 313, 1643, 29889, 27382, 2541, 703, 29906, 5800, 8610, 17755, 1159, 470, 3858, 29889, 27382, 2541, 703, 29906, 29885, 29943, 29877, 4037, 29883, 1159, 470, 13, 795, 3858, 29889, 27382, 2541, 703, 29943, 17755, 5783, 584, 13, 9651, 1900, 29918, 2543, 404, 353, 1409, 13, 9651, 1900, 29918, 21134, 29889, 4397, 29898, 1643, 29897, 13, 1678, 565, 313, 29885, 5495, 29918, 2378, 338, 6213, 1125, 13, 418, 565, 313, 2435, 29898, 497, 29918, 21134, 29897, 1275, 29871, 29900, 29897, 584, 13, 4706, 12020, 8221, 703, 3782, 2854, 313, 1457, 29899, 7915, 287, 29897, 2910, 16127, 1476, 297, 934, 23157, 13, 418, 25342, 313, 2435, 29898, 13318, 29918, 21134, 29897, 1275, 29871, 29900, 29897, 584, 13, 4706, 12020, 8221, 703, 23323, 29876, 29915, 29873, 6336, 8161, 8210, 2910, 11073, 29889, 15691, 13, 3986, 376, 15954, 1575, 3583, 29876, 29871, 1273, 29879, 29908, 1273, 376, 29871, 320, 29876, 1642, 7122, 29898, 497, 29918, 21134, 876, 13, 418, 25342, 313, 2435, 29898, 13318, 29918, 21134, 29897, 1405, 29871, 29896, 29897, 584, 13, 4706, 12020, 8221, 703, 15329, 552, 8210, 2910, 16127, 1476, 297, 934, 29889, 15691, 13, 3986, 376, 15954, 1575, 3583, 29876, 29871, 1273, 29879, 29908, 1273, 6634, 29876, 29871, 11393, 7122, 29898, 13318, 29918, 21134, 876, 13, 418, 25342, 313, 2435, 29898, 13318, 29918, 21134, 29897, 1275, 29871, 29896, 1125, 13, 4706, 3533, 261, 29918, 2378, 353, 1900, 29918, 2543, 404, 13, 4706, 1596, 703, 29871, 2088, 404, 292, 1273, 29879, 363, 1881, 2910, 16127, 29908, 29995, 1900, 29918, 21134, 29961, 29900, 1402, 934, 29922, 1311, 29889, 21707, 29897, 13, 4706, 736, 3533, 261, 29918, 2378, 13, 13, 29871, 396, 448, 2683, 2683, 2683, 2683, 28400, 13, 29871, 822, 679, 29918, 9902, 29898, 1311, 1125, 13, 1678, 736, 1583, 29889, 9902, 13, 13, 2 ]
RobotWorld.py
madalynlmillen/MadalynMillenCapstone
0
192907
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Classes for a simple kinematic robot arm simulation This code used matplotlib for generating graphics for CS 471/510. The MIT License (MIT) Copyright (c) 2015 <NAME> (<EMAIL>) 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. ''' import numpy as np from copy import deepcopy from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import matplotlib.patches as patches import sys class Link: def __init__(self, name, length, color='b', width=0.5, parent=None): self.name = name; self.current_image = -1 self.length = length; self.color = color; self.width = width; self.angle = 0.0; self.total_angle = 0.0; self.base = (0.0, 0.0) self.parent = parent; self.total_angle = self.total_angle + self.angle; self.tip = (self.base[0] + self.length*np.cos(self.total_angle), self.base[0] + self.length*np.sin(self.total_angle)); self.normal = (-np.sin(self.total_angle),np.cos(self.total_angle)) #print "link ",self.name," base=",self.base," tip=",self.tip def updateTip(self, angle): self.angle = deepcopy(angle); if (self.parent is not None): self.base = deepcopy(self.parent.tip) self.total_angle = deepcopy(self.parent.total_angle); else: self.base = (0.0, 0.0); self.total_angle = 0.0; self.total_angle = self.total_angle + self.angle; #print " Update link ",self.name," base = ",self.base, " angle=",self.angle," total angle=",self.total_angle self.tip = (self.base[0] + self.length*np.cos(self.total_angle), self.base[1] + self.length*np.sin(self.total_angle)); #print "link ",self.name," angle=",self.angle," base=",self.base," tip=",self.tip # Define vector normal to the link (for later distance calculation) self.normal = (-np.sin(self.total_angle), np.cos(self.total_angle)); def drawLink(self, ax): #print "draw link ",self.name," angle=",self.angle," base=",self.base," tip=",self.tip #surf = ax2.plot(( self.base[0], self.tip[0]), (self.base[1], self.tip[1]), # linewidth=self.width, color=self.color); center = ((self.base[0]+self.tip[0])/2.0, (self.base[1]+self.tip[1])/2.0) corner = ( (self.base[0] - self.normal[0]*self.width*0.5), (self.base[1] - self.normal[1]*self.width*0.5) ) ax.add_patch(patches.Rectangle(corner,self.length, self.width, angle=(self.total_angle*180.0/np.pi), color=self.color)); def drawTip(self, ax): ax.plot(self.tip[0], self.tip[1],color=self.color); class RobotArm: def __init__(self, links): self.links = links; # Update the link positions given angles for each link relative its parent link # Assuming processing from fixed base up to final child link def updateLinks(self, angles): if (len(angles) != len(self.links)): print "Invalid angles! - need one per link"; sys.exit(-1) # Assuming list of angles with one angle for each link for link,angle in enumerate(angles): self.links[link].updateTip(angle) # Simple collision checking for circular obstacles # Returns None for collision free, or a color for object that cause the collision def checkCollisions(self, objects): collision = False; # Check all objects for obj in objects: #print "object ",obj.name # Against all links for link in self.links: # Vector from link base to object lowerleft dX = ( (obj.lowerLeft[0] - link.base[0]), (obj.lowerLeft[1] - link.base[1]) ) dist = dX[0]*link.normal[0] + dX[1]*link.normal[1] val = np.fabs(dist) # check distance from obstacle lowerLeft to line along a link if (val < (link.width/2.0 + obj.width/2.0)): #print "potential collision" # Calculate the projection of vector to obstacle along the link dY = (dX[0] - dist*link.normal[0], dX[1]-dist*link.normal[1]) # Distance along the link proj = dY[0]*np.cos(link.total_angle) + dY[1]*np.sin(link.total_angle) if ((proj >= 0.0) and (proj <= (link.length+obj.width))): print " Collision between link ",link.name," and obstacle ",obj.name, " at dist=",dist, " proj=",proj return obj.color; # return the first collision encountered return None; # Draw each arm def drawArm(self, ax): for link in self.links: link.drawLink(ax) # Draw the final end effector position def drawEE(self, ax): self.links[-1].drawTip(ax) # Return the position (x,y) of the end effector (tip of last link) def getEndEffector(self): return self.links[-1].tip; # Simple rectangular obstacle class Obstacle: def __init__(self, name, lowerLeft, width, height, color, angle=0.0): self.name = name self.lowerLeft = lowerLeft self.width = width self.height = height self.color = color self.angle = angle def drawObstacle(self,ax2): ax2.add_patch(patches.Rectangle(self.lowerLeft,self.width, self.height, angle=self.angle, color=self.color)); # Class to hold the robot and obstacles class RobotWorld: def __init__(self, robot, obstacles): self.robot = robot; self.obstacles = obstacles; # Draw all the obstacles on the axis def drawObstacles(self,ax2): for obj in self.obstacles: obj.drawObstacle(ax2); # Draw a small patch for the robot end effector def drawRobotEndEffector(self, ax): self.robot.links[-1].drawTip(ax) # Draw the robot def drawRobot(self, ax): self.robot.drawArm(ax); # Draw both robot arm and obstacles def drawWorld(self, ax): self.drawRobot(ax); self.drawObstacles(ax); # Update the angles of the robot links def updateRobotArm(self, angles): return self.robot.updateLinks(angles); # Check for collision between current robot arm position and the obstacles def checkCollisions(self): return self.robot.checkCollisions(self.obstacles)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 12008, 13, 29871, 4134, 267, 363, 263, 2560, 19015, 19217, 19964, 5075, 17402, 13, 29871, 910, 775, 1304, 22889, 363, 14655, 18533, 363, 21107, 29871, 29946, 29955, 29896, 29914, 29945, 29896, 29900, 29889, 13, 1678, 450, 341, 1806, 19245, 313, 26349, 29897, 13, 1678, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 529, 5813, 29958, 313, 29966, 26862, 6227, 12948, 13, 1678, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 1678, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 1678, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 1678, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 1678, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 1678, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 1678, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 13, 1678, 599, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 1678, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 1678, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 1678, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 1678, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 1678, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 1678, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 13, 1678, 6093, 7791, 7818, 12982, 1525, 29889, 13, 12008, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 3509, 1053, 6483, 8552, 13, 3166, 286, 572, 29918, 10154, 29895, 1169, 29889, 29885, 5317, 29941, 29881, 1053, 319, 9100, 29941, 29928, 13, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 22889, 29889, 5041, 267, 408, 13261, 267, 13, 13, 5215, 10876, 13, 13, 1990, 6645, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 3309, 29892, 2927, 2433, 29890, 742, 2920, 29922, 29900, 29889, 29945, 29892, 3847, 29922, 8516, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 29936, 13, 13, 4706, 1583, 29889, 3784, 29918, 3027, 353, 448, 29896, 13, 4706, 1583, 29889, 2848, 353, 3309, 29936, 13, 4706, 1583, 29889, 2780, 353, 2927, 29936, 13, 4706, 1583, 29889, 2103, 353, 2920, 29936, 13, 4706, 1583, 29889, 2521, 539, 353, 29871, 29900, 29889, 29900, 29936, 13, 4706, 1583, 29889, 7827, 29918, 2521, 353, 29871, 29900, 29889, 29900, 29936, 13, 4706, 1583, 29889, 3188, 4706, 353, 313, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29897, 13, 4706, 1583, 29889, 3560, 353, 3847, 29936, 13, 4706, 1583, 29889, 7827, 29918, 2521, 353, 1583, 29889, 7827, 29918, 2521, 718, 1583, 29889, 2521, 29936, 13, 4706, 1583, 29889, 12632, 353, 313, 1311, 29889, 3188, 29961, 29900, 29962, 718, 1583, 29889, 2848, 29930, 9302, 29889, 3944, 29898, 1311, 29889, 7827, 29918, 2521, 511, 13, 462, 1678, 1583, 29889, 3188, 29961, 29900, 29962, 718, 1583, 29889, 2848, 29930, 9302, 29889, 5223, 29898, 1311, 29889, 7827, 29918, 2521, 2483, 13, 4706, 1583, 29889, 8945, 353, 8521, 9302, 29889, 5223, 29898, 1311, 29889, 7827, 29918, 2521, 511, 9302, 29889, 3944, 29898, 1311, 29889, 7827, 29918, 2521, 876, 13, 13, 4706, 396, 2158, 376, 2324, 9162, 1311, 29889, 978, 1699, 2967, 543, 29892, 1311, 29889, 3188, 1699, 6872, 543, 29892, 1311, 29889, 12632, 13, 13, 13, 1678, 822, 2767, 29911, 666, 29898, 1311, 29892, 10696, 1125, 13, 4706, 1583, 29889, 2521, 353, 6483, 8552, 29898, 2521, 416, 13, 13, 4706, 565, 313, 1311, 29889, 3560, 338, 451, 6213, 1125, 13, 9651, 1583, 29889, 3188, 4706, 353, 6483, 8552, 29898, 1311, 29889, 3560, 29889, 12632, 29897, 13, 9651, 1583, 29889, 7827, 29918, 2521, 353, 6483, 8552, 29898, 1311, 29889, 3560, 29889, 7827, 29918, 2521, 416, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 3188, 4706, 353, 313, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 416, 13, 9651, 1583, 29889, 7827, 29918, 2521, 353, 29871, 29900, 29889, 29900, 29936, 13, 13, 4706, 1583, 29889, 7827, 29918, 2521, 353, 1583, 29889, 7827, 29918, 2521, 718, 1583, 29889, 2521, 29936, 13, 13, 4706, 396, 2158, 376, 10318, 1544, 9162, 1311, 29889, 978, 1699, 2967, 353, 9162, 1311, 29889, 3188, 29892, 376, 10696, 543, 29892, 1311, 29889, 2521, 1699, 3001, 10696, 543, 29892, 1311, 29889, 7827, 29918, 2521, 13, 13, 4706, 1583, 29889, 12632, 353, 313, 1311, 29889, 3188, 29961, 29900, 29962, 718, 1583, 29889, 2848, 29930, 9302, 29889, 3944, 29898, 1311, 29889, 7827, 29918, 2521, 511, 13, 462, 1678, 1583, 29889, 3188, 29961, 29896, 29962, 718, 1583, 29889, 2848, 29930, 9302, 29889, 5223, 29898, 1311, 29889, 7827, 29918, 2521, 2483, 13, 4706, 396, 2158, 376, 2324, 9162, 1311, 29889, 978, 1699, 10696, 543, 29892, 1311, 29889, 2521, 1699, 2967, 543, 29892, 1311, 29889, 3188, 1699, 6872, 543, 29892, 1311, 29889, 12632, 13, 13, 13, 4706, 396, 22402, 4608, 4226, 304, 278, 1544, 313, 1454, 2678, 5418, 13944, 29897, 13, 4706, 1583, 29889, 8945, 353, 8521, 9302, 29889, 5223, 29898, 1311, 29889, 7827, 29918, 2521, 511, 7442, 29889, 3944, 29898, 1311, 29889, 7827, 29918, 2521, 2483, 13, 13, 1678, 822, 4216, 6595, 29898, 1311, 29892, 4853, 1125, 13, 4706, 396, 2158, 376, 4012, 1544, 9162, 1311, 29889, 978, 1699, 10696, 543, 29892, 1311, 29889, 2521, 1699, 2967, 543, 29892, 1311, 29889, 3188, 1699, 6872, 543, 29892, 1311, 29889, 12632, 13, 13, 4706, 396, 7610, 29888, 353, 4853, 29906, 29889, 5317, 3552, 1583, 29889, 3188, 29961, 29900, 1402, 1583, 29889, 12632, 29961, 29900, 11724, 313, 1311, 29889, 3188, 29961, 29896, 1402, 1583, 29889, 12632, 29961, 29896, 11724, 13, 4706, 396, 18884, 1196, 2103, 29922, 1311, 29889, 2103, 29892, 2927, 29922, 1311, 29889, 2780, 416, 13, 13, 4706, 4818, 353, 5135, 1311, 29889, 3188, 29961, 29900, 10062, 1311, 29889, 12632, 29961, 29900, 2314, 29914, 29906, 29889, 29900, 29892, 313, 1311, 29889, 3188, 29961, 29896, 10062, 1311, 29889, 12632, 29961, 29896, 2314, 29914, 29906, 29889, 29900, 29897, 13, 4706, 11155, 353, 313, 313, 1311, 29889, 3188, 29961, 29900, 29962, 448, 1583, 29889, 8945, 29961, 29900, 14178, 1311, 29889, 2103, 29930, 29900, 29889, 29945, 511, 13, 462, 259, 313, 1311, 29889, 3188, 29961, 29896, 29962, 448, 1583, 29889, 8945, 29961, 29896, 14178, 1311, 29889, 2103, 29930, 29900, 29889, 29945, 29897, 1723, 13, 13, 4706, 4853, 29889, 1202, 29918, 5041, 29898, 5041, 267, 29889, 7364, 2521, 29898, 2616, 1089, 29892, 1311, 29889, 2848, 29892, 1583, 29889, 2103, 29892, 10696, 7607, 1311, 29889, 7827, 29918, 2521, 29930, 29896, 29947, 29900, 29889, 29900, 29914, 9302, 29889, 1631, 511, 2927, 29922, 1311, 29889, 2780, 2483, 13, 13, 13, 1678, 822, 4216, 29911, 666, 29898, 1311, 29892, 4853, 1125, 13, 4706, 4853, 29889, 5317, 29898, 1311, 29889, 12632, 29961, 29900, 1402, 1583, 29889, 12632, 29961, 29896, 1402, 2780, 29922, 1311, 29889, 2780, 416, 13, 13, 13, 1990, 6417, 327, 27429, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2988, 1125, 13, 13, 4706, 1583, 29889, 4965, 353, 2988, 29936, 13, 13, 1678, 396, 10318, 278, 1544, 11909, 2183, 23619, 363, 1269, 1544, 6198, 967, 3847, 1544, 13, 1678, 396, 17090, 9068, 515, 4343, 2967, 701, 304, 2186, 2278, 1544, 13, 1678, 822, 2767, 6595, 29879, 29898, 1311, 29892, 23619, 1125, 13, 13, 4706, 565, 313, 2435, 29898, 19536, 29897, 2804, 7431, 29898, 1311, 29889, 4965, 22164, 13, 9651, 1596, 376, 13919, 23619, 29991, 448, 817, 697, 639, 1544, 1769, 13, 9651, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 4706, 396, 17090, 1051, 310, 23619, 411, 697, 10696, 363, 1269, 1544, 13, 4706, 363, 1544, 29892, 2521, 297, 26985, 29898, 19536, 1125, 13, 9651, 1583, 29889, 4965, 29961, 2324, 1822, 5504, 29911, 666, 29898, 2521, 29897, 13, 13, 1678, 396, 12545, 22369, 8454, 363, 19308, 14979, 23435, 13, 1678, 396, 16969, 6213, 363, 22369, 3889, 29892, 470, 263, 2927, 363, 1203, 393, 4556, 278, 22369, 13, 1678, 822, 1423, 28377, 12112, 29898, 1311, 29892, 3618, 1125, 13, 13, 4706, 22369, 353, 7700, 29936, 13, 13, 4706, 396, 5399, 599, 3618, 13, 4706, 363, 5446, 297, 3618, 29901, 13, 13, 9651, 396, 2158, 376, 3318, 9162, 5415, 29889, 978, 13, 13, 9651, 396, 11454, 303, 599, 2988, 13, 9651, 363, 1544, 297, 1583, 29889, 4965, 29901, 13, 13, 18884, 396, 16510, 515, 1544, 2967, 304, 1203, 5224, 1563, 13, 18884, 270, 29990, 353, 313, 313, 5415, 29889, 13609, 8091, 29961, 29900, 29962, 448, 1544, 29889, 3188, 29961, 29900, 11724, 313, 5415, 29889, 13609, 8091, 29961, 29896, 29962, 448, 1544, 29889, 3188, 29961, 29896, 2314, 1723, 13, 13, 18884, 1320, 353, 270, 29990, 29961, 29900, 14178, 2324, 29889, 8945, 29961, 29900, 29962, 718, 270, 29990, 29961, 29896, 14178, 2324, 29889, 8945, 29961, 29896, 29962, 13, 18884, 659, 353, 7442, 29889, 29888, 6897, 29898, 5721, 29897, 13, 18884, 396, 1423, 5418, 515, 14979, 6436, 5224, 8091, 304, 1196, 3412, 263, 1544, 13, 18884, 565, 313, 791, 529, 313, 2324, 29889, 2103, 29914, 29906, 29889, 29900, 718, 5446, 29889, 2103, 29914, 29906, 29889, 29900, 22164, 13, 462, 1678, 396, 2158, 376, 17765, 2556, 22369, 29908, 13, 13, 462, 1678, 396, 20535, 403, 278, 18246, 310, 4608, 304, 14979, 6436, 3412, 278, 1544, 13, 462, 1678, 270, 29979, 353, 313, 29881, 29990, 29961, 29900, 29962, 448, 1320, 29930, 2324, 29889, 8945, 29961, 29900, 1402, 270, 29990, 29961, 29896, 29962, 29899, 5721, 29930, 2324, 29889, 8945, 29961, 29896, 2314, 13, 13, 462, 1678, 396, 6652, 749, 3412, 278, 1544, 13, 462, 1678, 410, 29926, 353, 270, 29979, 29961, 29900, 14178, 9302, 29889, 3944, 29898, 2324, 29889, 7827, 29918, 2521, 29897, 718, 270, 29979, 29961, 29896, 14178, 9302, 29889, 5223, 29898, 2324, 29889, 7827, 29918, 2521, 29897, 13, 13, 462, 1678, 565, 5135, 20865, 6736, 29871, 29900, 29889, 29900, 29897, 322, 313, 20865, 5277, 313, 2324, 29889, 2848, 29974, 5415, 29889, 2103, 876, 1125, 13, 462, 4706, 1596, 376, 13435, 2459, 1546, 1544, 9162, 2324, 29889, 978, 1699, 322, 14979, 6436, 9162, 5415, 29889, 978, 29892, 376, 472, 1320, 543, 29892, 5721, 29892, 376, 410, 29926, 543, 29892, 20865, 13, 462, 4706, 736, 5446, 29889, 2780, 29936, 396, 736, 278, 937, 22369, 18169, 13, 13, 4706, 736, 6213, 29936, 13, 13, 13, 1678, 396, 18492, 1269, 5075, 13, 1678, 822, 4216, 27429, 29898, 1311, 29892, 4853, 1125, 13, 4706, 363, 1544, 297, 1583, 29889, 4965, 29901, 13, 9651, 1544, 29889, 4012, 6595, 29898, 1165, 29897, 13, 13, 1678, 396, 18492, 278, 2186, 1095, 2779, 272, 2602, 13, 1678, 822, 4216, 17896, 29898, 1311, 29892, 4853, 1125, 13, 539, 1583, 29889, 4965, 14352, 29896, 1822, 4012, 29911, 666, 29898, 1165, 29897, 13, 13, 1678, 396, 7106, 278, 2602, 313, 29916, 29892, 29891, 29897, 310, 278, 1095, 2779, 272, 313, 12632, 310, 1833, 1544, 29897, 13, 1678, 822, 679, 5044, 29923, 600, 3019, 29898, 1311, 1125, 13, 9651, 736, 1583, 29889, 4965, 14352, 29896, 1822, 12632, 29936, 13, 13, 29937, 12545, 7705, 6825, 14979, 6436, 13, 1990, 4250, 303, 6436, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 5224, 8091, 29892, 2920, 29892, 3171, 29892, 2927, 29892, 10696, 29922, 29900, 29889, 29900, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 13609, 8091, 353, 5224, 8091, 13, 4706, 1583, 29889, 2103, 353, 2920, 13, 4706, 1583, 29889, 3545, 353, 3171, 13, 4706, 1583, 29889, 2780, 353, 2927, 13, 4706, 1583, 29889, 2521, 353, 10696, 13, 13, 1678, 822, 4216, 6039, 303, 6436, 29898, 1311, 29892, 1165, 29906, 1125, 13, 4706, 4853, 29906, 29889, 1202, 29918, 5041, 29898, 5041, 267, 29889, 7364, 2521, 29898, 1311, 29889, 13609, 8091, 29892, 1311, 29889, 2103, 29892, 1583, 29889, 3545, 29892, 10696, 29922, 1311, 29889, 2521, 29892, 2927, 29922, 1311, 29889, 2780, 2483, 13, 13, 13, 29937, 4134, 304, 4808, 278, 19964, 322, 14979, 23435, 13, 1990, 6417, 327, 14058, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19964, 29892, 14979, 23435, 1125, 13, 4706, 1583, 29889, 307, 7451, 418, 353, 19964, 29936, 13, 4706, 1583, 29889, 711, 303, 23435, 29871, 353, 14979, 23435, 29936, 13, 13, 1678, 396, 18492, 599, 278, 14979, 23435, 373, 278, 9685, 13, 1678, 822, 4216, 6039, 303, 23435, 29898, 1311, 29892, 1165, 29906, 1125, 13, 4706, 363, 5446, 297, 1583, 29889, 711, 303, 23435, 29901, 13, 9651, 5446, 29889, 4012, 6039, 303, 6436, 29898, 1165, 29906, 416, 13, 13, 1678, 396, 18492, 263, 2319, 13261, 363, 278, 19964, 1095, 2779, 272, 13, 1678, 822, 4216, 21860, 327, 5044, 29923, 600, 3019, 29898, 1311, 29892, 4853, 1125, 13, 539, 1583, 29889, 307, 7451, 29889, 4965, 14352, 29896, 1822, 4012, 29911, 666, 29898, 1165, 29897, 13, 13, 1678, 396, 18492, 278, 19964, 13, 1678, 822, 4216, 21860, 327, 29898, 1311, 29892, 4853, 1125, 13, 4706, 1583, 29889, 307, 7451, 29889, 4012, 27429, 29898, 1165, 416, 13, 13, 1678, 396, 18492, 1716, 19964, 5075, 322, 14979, 23435, 13, 1678, 822, 4216, 14058, 29898, 1311, 29892, 4853, 1125, 13, 4706, 1583, 29889, 4012, 21860, 327, 29898, 1165, 416, 13, 4706, 1583, 29889, 4012, 6039, 303, 23435, 29898, 1165, 416, 13, 13, 1678, 396, 10318, 278, 23619, 310, 278, 19964, 2988, 13, 1678, 822, 2767, 21860, 327, 27429, 29898, 1311, 29892, 23619, 1125, 13, 4706, 736, 1583, 29889, 307, 7451, 29889, 5504, 6595, 29879, 29898, 19536, 416, 13, 13, 1678, 396, 5399, 363, 22369, 1546, 1857, 19964, 5075, 2602, 322, 278, 14979, 23435, 13, 1678, 822, 1423, 28377, 12112, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 307, 7451, 29889, 3198, 28377, 12112, 29898, 1311, 29889, 711, 303, 23435, 29897, 2 ]
examples/ordering.py
F483/easyapi
0
50134
#!/usr/bin/env python # coding: utf-8 # Copyright (c) 2015 <NAME> <<EMAIL>> # License: MIT (see LICENSE file) import apigen class Ordering(apigen.Definition): @apigen.command() def first(self): return "first" @apigen.command() def second(self): return "second" @apigen.command() def third(self): return "third" @apigen.command() def fourth(self): return "fourth" if __name__ == "__main__": apigen.run(Ordering)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 19245, 29901, 341, 1806, 313, 4149, 365, 2965, 1430, 1660, 934, 29897, 13, 13, 13, 5215, 3095, 2101, 13, 13, 13, 1990, 8170, 292, 29898, 481, 2101, 29889, 14683, 1125, 13, 13, 1678, 732, 481, 2101, 29889, 6519, 580, 13, 1678, 822, 937, 29898, 1311, 1125, 13, 4706, 736, 376, 4102, 29908, 13, 13, 1678, 732, 481, 2101, 29889, 6519, 580, 13, 1678, 822, 1473, 29898, 1311, 1125, 13, 4706, 736, 376, 7496, 29908, 13, 13, 1678, 732, 481, 2101, 29889, 6519, 580, 13, 1678, 822, 4654, 29898, 1311, 1125, 13, 4706, 736, 376, 22585, 29908, 13, 13, 1678, 732, 481, 2101, 29889, 6519, 580, 13, 1678, 822, 11582, 29898, 1311, 1125, 13, 4706, 736, 376, 17823, 386, 29908, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 3095, 2101, 29889, 3389, 29898, 7514, 292, 29897, 13, 2 ]
pysectprop/general/__init__.py
Pretsdaya/pysectprop
1
153596
from .generalsection import GeneralSection from .materialsection import MaterialSection from .compositesection import CompositeSection from .cripplingsection import CripplingSection from .thinwalledsection import ThinWalledSection from .material import Material
[ 1, 515, 869, 4738, 1435, 428, 1053, 4593, 13438, 13, 3166, 869, 15388, 2042, 1053, 17582, 13438, 13, 3166, 869, 22410, 277, 968, 428, 1053, 24497, 568, 13438, 13, 3166, 869, 699, 407, 1847, 2042, 1053, 315, 374, 407, 1847, 13438, 13, 3166, 869, 386, 262, 29893, 4212, 2042, 1053, 498, 262, 29956, 4212, 13438, 13, 3166, 869, 15388, 1053, 17582, 13, 2 ]
migrations/versions/1e7e4cedd1f1_.py
pavel-yas1405/teamwork
0
1603855
"""empty message Revision ID: 1e7e4cedd1f1 Revises: Create Date: 2022-04-15 15:04:47.007855 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '1e7e4cedd1f1' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('cocktail', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('country', sa.String(length=64), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.Column('region', sa.String(length=128), nullable=True), sa.Column('recipe', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_cocktail_country'), 'cocktail', ['country'], unique=False) op.create_index(op.f('ix_cocktail_name'), 'cocktail', ['name'], unique=True) op.create_index(op.f('ix_cocktail_region'), 'cocktail', ['region'], unique=False) op.create_table('ingredient', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=64), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_ingredient_name'), 'ingredient', ['name'], unique=True) op.create_table('origin', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=True), sa.Column('country', sa.String(), nullable=True), sa.Column('region', sa.String(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=64), nullable=True), sa.Column('password', sa.String(length=128), nullable=True), sa.Column('role', sa.String(length=10), nullable=True), sa.Column('email', sa.String(length=50), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_user_role'), 'user', ['role'], unique=False) op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True) op.create_table('cocktail_ingredient', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cocktail_id', sa.Integer(), nullable=False), sa.Column('ingredient_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['cocktail_id'], ['cocktail.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['ingredient_id'], ['ingredient.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('cocktail_id', 'ingredient_id', name='cocktail_id_ingredient_id_unq') ) op.create_table('cocktail_origin', sa.Column('id', sa.Integer(), nullable=False), sa.Column('cocktail_id', sa.Integer(), nullable=False), sa.Column('origin_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['cocktail_id'], ['cocktail.id'], ondelete='CASCADE'), sa.ForeignKeyConstraint(['origin_id'], ['origin.id'], ondelete='CASCADE'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('cocktail_id', 'origin_id', name='cocktail_id_origin_id_unq') ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('cocktail_origin') op.drop_table('cocktail_ingredient') op.drop_index(op.f('ix_user_username'), table_name='user') op.drop_index(op.f('ix_user_role'), table_name='user') op.drop_table('user') op.drop_table('origin') op.drop_index(op.f('ix_ingredient_name'), table_name='ingredient') op.drop_table('ingredient') op.drop_index(op.f('ix_cocktail_region'), table_name='cocktail') op.drop_index(op.f('ix_cocktail_name'), table_name='cocktail') op.drop_index(op.f('ix_cocktail_country'), table_name='cocktail') op.drop_table('cocktail') # ### end Alembic commands ###
[ 1, 9995, 6310, 2643, 13, 13, 1123, 4924, 3553, 29901, 29871, 29896, 29872, 29955, 29872, 29946, 1133, 29881, 29896, 29888, 29896, 13, 1123, 1730, 267, 29901, 29871, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29906, 29906, 29899, 29900, 29946, 29899, 29896, 29945, 29871, 29896, 29945, 29901, 29900, 29946, 29901, 29946, 29955, 29889, 29900, 29900, 29955, 29947, 29945, 29945, 13, 13, 15945, 29908, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 525, 29896, 29872, 29955, 29872, 29946, 1133, 29881, 29896, 29888, 29896, 29915, 13, 3204, 29918, 276, 4924, 353, 6213, 13, 17519, 29918, 21134, 353, 6213, 13, 2716, 1975, 29918, 265, 353, 6213, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 24956, 18237, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 29898, 2848, 29922, 29953, 29946, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 13509, 742, 872, 29889, 1231, 29898, 2848, 29922, 29953, 29946, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12803, 742, 872, 29889, 1231, 29898, 2848, 29922, 29896, 29906, 29947, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 4361, 412, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 13509, 5477, 525, 24956, 18237, 742, 6024, 13509, 7464, 5412, 29922, 8824, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 978, 5477, 525, 24956, 18237, 742, 6024, 978, 7464, 5412, 29922, 5574, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 12803, 5477, 525, 24956, 18237, 742, 6024, 12803, 7464, 5412, 29922, 8824, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 292, 1127, 993, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 29898, 2848, 29922, 29953, 29946, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 292, 1127, 993, 29918, 978, 5477, 525, 292, 1127, 993, 742, 6024, 978, 7464, 5412, 29922, 5574, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 12574, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 13509, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12803, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 1792, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 6786, 742, 872, 29889, 1231, 29898, 2848, 29922, 29953, 29946, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 5630, 742, 872, 29889, 1231, 29898, 2848, 29922, 29896, 29906, 29947, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12154, 742, 872, 29889, 1231, 29898, 2848, 29922, 29896, 29900, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 5269, 742, 872, 29889, 1231, 29898, 2848, 29922, 29945, 29900, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 1792, 29918, 12154, 5477, 525, 1792, 742, 6024, 12154, 7464, 5412, 29922, 8824, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 1792, 29918, 6786, 5477, 525, 1792, 742, 6024, 6786, 7464, 5412, 29922, 5574, 29897, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 24956, 18237, 29918, 292, 1127, 993, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 24956, 18237, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 292, 1127, 993, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 24956, 18237, 29918, 333, 7464, 6024, 24956, 18237, 29889, 333, 7464, 373, 8143, 2433, 29907, 3289, 5454, 2287, 5477, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 292, 1127, 993, 29918, 333, 7464, 6024, 292, 1127, 993, 29889, 333, 7464, 373, 8143, 2433, 29907, 3289, 5454, 2287, 5477, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 5477, 13, 1678, 872, 29889, 8110, 802, 21529, 877, 24956, 18237, 29918, 333, 742, 525, 292, 1127, 993, 29918, 333, 742, 1024, 2433, 24956, 18237, 29918, 333, 29918, 292, 1127, 993, 29918, 333, 29918, 348, 29939, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 24956, 18237, 29918, 12574, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 24956, 18237, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 12574, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 24956, 18237, 29918, 333, 7464, 6024, 24956, 18237, 29889, 333, 7464, 373, 8143, 2433, 29907, 3289, 5454, 2287, 5477, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 12574, 29918, 333, 7464, 6024, 12574, 29889, 333, 7464, 373, 8143, 2433, 29907, 3289, 5454, 2287, 5477, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 5477, 13, 1678, 872, 29889, 8110, 802, 21529, 877, 24956, 18237, 29918, 333, 742, 525, 12574, 29918, 333, 742, 1024, 2433, 24956, 18237, 29918, 333, 29918, 12574, 29918, 333, 29918, 348, 29939, 1495, 13, 1678, 1723, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 24956, 18237, 29918, 12574, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 24956, 18237, 29918, 292, 1127, 993, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 1792, 29918, 6786, 5477, 1591, 29918, 978, 2433, 1792, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 1792, 29918, 12154, 5477, 1591, 29918, 978, 2433, 1792, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 1792, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 12574, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 292, 1127, 993, 29918, 978, 5477, 1591, 29918, 978, 2433, 292, 1127, 993, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 292, 1127, 993, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 12803, 5477, 1591, 29918, 978, 2433, 24956, 18237, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 978, 5477, 1591, 29918, 978, 2433, 24956, 18237, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2248, 29898, 459, 29889, 29888, 877, 861, 29918, 24956, 18237, 29918, 13509, 5477, 1591, 29918, 978, 2433, 24956, 18237, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 24956, 18237, 1495, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 2 ]
instauto/api/actions/structs/friendships.py
marvic2409/instauto
0
29668
from . import common as cmmn import logging import uuid from typing import Optional from instauto.api.structs import Surface logger = logging.getLogger(__name__) class _Base(cmmn.Base): _csrftoken: str = None radio_type: str = 'wifi-none' device_id: str = None _uid: str = None _uuid: str = None user_id: str = None def __init__(self, **kwargs): super().__init__(**kwargs) self._enable_datapoint_from_client('_csrftoken') self._enable_datapoint_from_client('device_id') self._enable_datapoint_from_client('_uid') self._enable_datapoint_from_client('_uuid') self._custom_data['uuid'] = self.State.required self._custom_data['user_id'] = self.State.required self._custom_data['endpoint'] = self.State.required self._custom_data['surface'] = self.State.optional class Create(_Base): def __init__(self, user_id: str, **kwargs): """Use this to create a friendship, i.e. follow a user.""" super().__init__(**kwargs) self._data['endpoint'] = 'create' self._data['user_id'] = user_id class Destroy(_Base): def __init__(self, user_id: str, surface: Optional[Surface] = None, **kwargs): """Use this to 'destroy' a friendship, i.e. unfollow.""" super().__init__(**kwargs) self._data['endpoint'] = 'destroy' self._data['user_id'] = user_id self._data['surface'] = surface self._defaults['surface'] = surface.profile class Remove(_Base): def __init__(self, user_id: str, **kwargs): super().__init__(**kwargs) self._data['endpoint'] = 'remove_follower' self._data['user_id'] = user_id class Show(cmmn.Base): """Retrieves the following information for a friendship: { "blocking": False, "followed_by": False, "following": False, "incoming_request": False, "is_bestie": False, "is_blocking_reel": False, "is_muting_reel": False, "is_private": False, "is_restricted": False, "muting": False, "outgoing_request": False, "status": "ok" } """ def __init__(self, user_id: str, **kwargs): super().__init__(**kwargs) self._custom_data['user_id'] = self.State.required self._custom_data['endpoint'] = self.State.required self._data['user_id'] = user_id self._data['endpoint'] = cmmn.Base.State.required class GetBase(cmmn.Base): def __init__(self, user_id: str, surface: Optional[Surface] = None, **kwargs): super().__init__(**kwargs) self._custom_data['user_id'] = self.State.required self._custom_data['rank_token'] = self.State.required self._custom_data['search_surface'] = self.State.required self._custom_data['max_id'] = self.State.required self._custom_data['page'] = self.State.required self._data['user_id'] = user_id self._data['search_surface'] = surface self._defaults['search_surface'] = Surface.follow_list self._defaults['rank_token'] = uuid.uuid4() self._defaults['max_id'] = None self._defaults['page'] = 0 # The requests for getting followers and your following, look exactly the same # but we want to keep them in seperate structs for clarity. GetFollowers = GetFollowing = GetBase class PendingRequests: def __init__(self): pass class ApproveRequest(cmmn.Base): def __init__(self, user_id: str, **kwargs): super().__init__(**kwargs) self._enable_datapoint_from_client('_csrftoken') self._enable_datapoint_from_client('_uid') self._enable_datapoint_from_client('_uuid') self._custom_data['radio_type'] = self.State.required self._custom_data['surface'] = self.State.required self._custom_data['user_id'] = self.State.required self._data['user_id'] = user_id self._defaults['surface'] = Surface.follow_requests self._defaults['radio_type'] = 'wifi-none'
[ 1, 515, 869, 1053, 3619, 408, 274, 4317, 29876, 13, 13, 5215, 12183, 13, 5215, 318, 5416, 13, 3166, 19229, 1053, 28379, 13, 3166, 832, 6921, 29889, 2754, 29889, 4984, 29879, 1053, 6298, 2161, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 903, 5160, 29898, 29883, 4317, 29876, 29889, 5160, 1125, 13, 1678, 903, 2395, 9600, 6979, 29901, 851, 353, 6213, 13, 1678, 7155, 29918, 1853, 29901, 851, 353, 525, 29893, 6832, 29899, 9290, 29915, 13, 1678, 4742, 29918, 333, 29901, 851, 353, 6213, 13, 1678, 903, 5416, 29901, 851, 353, 6213, 13, 1678, 903, 25118, 29901, 851, 353, 6213, 13, 1678, 1404, 29918, 333, 29901, 851, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 2395, 9600, 6979, 1495, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 10141, 29918, 333, 1495, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 5416, 1495, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 25118, 1495, 13, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 25118, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 1792, 29918, 333, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 29734, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 7610, 2161, 2033, 353, 1583, 29889, 2792, 29889, 25253, 13, 13, 13, 1990, 6204, 7373, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 3579, 19290, 1125, 13, 4706, 9995, 11403, 445, 304, 1653, 263, 27994, 29892, 474, 29889, 29872, 29889, 1101, 263, 1404, 1213, 15945, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 1272, 1839, 29734, 2033, 353, 525, 3258, 29915, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 13, 13, 1990, 15435, 4727, 7373, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 7101, 29901, 28379, 29961, 18498, 2161, 29962, 353, 6213, 29892, 3579, 19290, 1125, 13, 4706, 9995, 11403, 445, 304, 525, 20524, 29915, 263, 27994, 29892, 474, 29889, 29872, 29889, 443, 23031, 1213, 15945, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 1272, 1839, 29734, 2033, 353, 525, 20524, 29915, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 4706, 1583, 3032, 1272, 1839, 7610, 2161, 2033, 353, 7101, 13, 4706, 1583, 3032, 4381, 29879, 1839, 7610, 2161, 2033, 353, 7101, 29889, 10185, 13, 13, 13, 1990, 15154, 7373, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 1272, 1839, 29734, 2033, 353, 525, 5992, 29918, 23031, 261, 29915, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 13, 13, 1990, 7704, 29898, 29883, 4317, 29876, 29889, 5160, 1125, 13, 1678, 9995, 8015, 2546, 1960, 278, 1494, 2472, 363, 263, 27994, 29901, 13, 1678, 426, 13, 418, 376, 1271, 292, 1115, 7700, 29892, 13, 418, 376, 23031, 287, 29918, 1609, 1115, 7700, 29892, 13, 418, 376, 23031, 292, 1115, 7700, 29892, 13, 418, 376, 262, 11506, 29918, 3827, 1115, 7700, 29892, 13, 418, 376, 275, 29918, 13318, 347, 1115, 7700, 29892, 13, 418, 376, 275, 29918, 1271, 292, 29918, 276, 295, 1115, 7700, 29892, 13, 418, 376, 275, 29918, 6149, 292, 29918, 276, 295, 1115, 7700, 29892, 13, 418, 376, 275, 29918, 9053, 1115, 7700, 29892, 13, 418, 376, 275, 29918, 5060, 4146, 287, 1115, 7700, 29892, 13, 418, 376, 6149, 292, 1115, 7700, 29892, 13, 418, 376, 449, 17696, 29918, 3827, 1115, 7700, 29892, 13, 418, 376, 4882, 1115, 376, 554, 29908, 13, 1678, 500, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 1792, 29918, 333, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 29734, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 4706, 1583, 3032, 1272, 1839, 29734, 2033, 353, 274, 4317, 29876, 29889, 5160, 29889, 2792, 29889, 12403, 13, 13, 13, 1990, 3617, 5160, 29898, 29883, 4317, 29876, 29889, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 7101, 29901, 28379, 29961, 18498, 2161, 29962, 353, 6213, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 1792, 29918, 333, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 10003, 29918, 6979, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 4478, 29918, 7610, 2161, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 3317, 29918, 333, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 3488, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 4706, 1583, 3032, 1272, 1839, 4478, 29918, 7610, 2161, 2033, 353, 7101, 13, 13, 4706, 1583, 3032, 4381, 29879, 1839, 4478, 29918, 7610, 2161, 2033, 353, 6298, 2161, 29889, 23031, 29918, 1761, 13, 4706, 1583, 3032, 4381, 29879, 1839, 10003, 29918, 6979, 2033, 353, 318, 5416, 29889, 25118, 29946, 580, 13, 4706, 1583, 3032, 4381, 29879, 1839, 3317, 29918, 333, 2033, 353, 6213, 13, 4706, 1583, 3032, 4381, 29879, 1839, 3488, 2033, 353, 29871, 29900, 13, 13, 13, 29937, 450, 7274, 363, 2805, 1101, 414, 322, 596, 1494, 29892, 1106, 3721, 278, 1021, 13, 29937, 541, 591, 864, 304, 3013, 963, 297, 409, 21194, 2281, 29879, 363, 7542, 537, 29889, 13, 2577, 29943, 2952, 414, 353, 3617, 29943, 2952, 292, 353, 3617, 5160, 13, 13, 13, 1990, 349, 2548, 3089, 29879, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1209, 13, 13, 13, 1990, 28268, 345, 3089, 29898, 29883, 4317, 29876, 29889, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29918, 333, 29901, 851, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 2395, 9600, 6979, 1495, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 5416, 1495, 13, 4706, 1583, 3032, 12007, 29918, 4130, 481, 2461, 29918, 3166, 29918, 4645, 877, 29918, 25118, 1495, 13, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 13399, 29918, 1853, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 7610, 2161, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 4706, 1583, 3032, 6341, 29918, 1272, 1839, 1792, 29918, 333, 2033, 353, 1583, 29889, 2792, 29889, 12403, 13, 13, 4706, 1583, 3032, 1272, 1839, 1792, 29918, 333, 2033, 353, 1404, 29918, 333, 13, 13, 4706, 1583, 3032, 4381, 29879, 1839, 7610, 2161, 2033, 353, 6298, 2161, 29889, 23031, 29918, 24830, 13, 4706, 1583, 3032, 4381, 29879, 1839, 13399, 29918, 1853, 2033, 353, 525, 29893, 6832, 29899, 9290, 29915, 13, 2 ]
yamanifest/manifest.py
coecms/yamanifest
2
82014
#!/usr/bin/env python """ Copyright 2017 ARC Centre of Excellence for Climate Systems Science author: <NAME> <<EMAIL>> 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 from six.moves import zip import os import sys import yaml import copy import subprocess import multiprocessing as mp from collections import defaultdict from .hashing import hash, supported_hashes from yamanifest.utils import find_files class HashExists(Exception): """Trying to add a hashed value when one already exists""" class FilePathNonexistent(Exception): """Trying to check a hashed value when there is none""" class HashNonexistent(Exception): """Trying to check a hashed value when there is none""" class Manifest(object): """A manifest object Attributes: path: a Path object for the manifest file data: an dictionary of manifest items """ def __init__(self, path, hashes=None, **kwargs): """ Return a Manifest object, initialised with a path to the manifest file. Optionally specify default order of hashes to use when checking manifest validity """ self.path = path self.data = {} self.header = {} try: self.numproc = mp.cpu_count() except NotImplementedError: self.numproc = 1 for key, val in kwargs.items(): setattr(self, key, val) self.iter = 0 if hashes is None: self.hashes = set(['binhash','md5']) else: self.hashes = set(hashes) # self.lookup = {} # Meta data for the yamanifest file version. This is file type # version, not library version. Use update in case extra meta # data was defined in arguments self.header.update({ 'format':'yamanifest', 'version':1.0 }) def __iter__(self): """ Iterator method """ for file in self.data: yield file def __len__(self): """ Return the number of filepaths in the manifest object """ return len(self.data) def load(self): """ Load manifest from YAML file """ try: with open(self.path, 'r') as file: self.header, self.data = yaml.safe_load_all(file) if "format" not in self.header: raise ValueError('Not yamanifest format') if self.header["format"] != 'yamanifest': raise ValueError('Not yamanifest format: {}'.format(self.header["format"])) except Exception as e: sys.stderr.write('Error parsing yamanifest file: {} :: {}\n'.format(self.path,str(e))) raise # self._make_lookup() # Allow chaining a load to creating a new instance return self def dump(self): """ Dump manifest from YAML file """ with open(self.path, 'w') as file: file.write(yaml.dump_all([self.header, self.data], default_flow_style=False)) def delete(self, filepath): """ Delete item for filepath in manifest """ del(self.data[filepath]) def add(self, filepaths=None, hashfn=None, force=False, shortcircuit=False, fullpaths=None): """ Add hash value for filepath given a hashing function (hashfn). If no filepaths defined, default to all current filepaths, and in this way can add a hash to all existing filepaths. If there is already a hash value only overwrite if force=True, otherwise raise exception. """ if filepaths is None: filepaths = self.data.keys() else: if type(filepaths) is str: filepaths = [filepaths,] if fullpaths is None: fullpaths = [None] * len(filepaths) else: if type(fullpaths) is str: fullpaths = [fullpaths,] assert(len(filepaths) == len(fullpaths)) tmpfilepaths = [] tmpfns = [] results = defaultdict(dict) for (filepath,fullpath) in zip(filepaths,fullpaths): # These must be defined so that queries do not fail later if filepath not in self.data: self.data[filepath] = {} if 'hashes' not in self.data[filepath]: self.data[filepath]["hashes"] = {} if fullpath is None: self.data[filepath]['fullpath'] = os.path.realpath(filepath) else: self.data[filepath]['fullpath'] = fullpath if hashfn is None: fns = self.hashes else: if type(hashfn) is str: fns = [hashfn,] else: fns = hashfn # Need to add any hash function we use to the list of default hashes for fn in fns: self.hashes.add(fn) for fn in fns: if fn in self.data[filepath]["hashes"] and not force: # Don't try and add a hash if it already exists continue tmpfilepaths.append(filepath) tmpfns.append(fn) results = self.calc_hashes(tmpfilepaths, tmpfns) for filepath in results: # Get dict of current hashes for filepath hashes = {} if "hashes" in self.data[filepath]: hashes = copy.deepcopy(self.data[filepath]["hashes"]) fns = [] if hashfn is None: fns = self.hashes else: if type(hashfn) is str: fns = [hashfn,] else: fns = hashfn for fn in fns: # if fn not in results[filepath]: # continue hashval = results[filepath][fn] # If we've used an incompatible hashing function it will return # None and we will silently discard this hash, or if the filepath # is unhashable if hashval is not None: if fn in hashes: if hashes[fn] != hashval: if not force: continue # Set new value for this hash function hashes[fn] = hashval if shortcircuit: break # Only save data to manifest if a hash was successfully generated or # there were existing hashes, else delete it if len(hashes) > 0: self.data[filepath]["hashes"] = hashes else: del(self.data[filepath]) def contains(self, filepath): """ Return True if filepath is in manifest """ return filepath in self.data def get(self, filepath, hashfn): """ Return hash value for filepath and hash function. Return None if not defined """ hashval = None if self.contains(filepath): if hashfn in self.data[filepath]["hashes"]: hashval = self.data[filepath]["hashes"][hashfn] # Check we have a valid hash value (can't just be whitespace) if not hashval.strip(): hashval = False # else: # print("hash value not defined {}".format(hashval)) # else: # print("hash {} not in manifest".format(hashfn)) # else: # print("{} not in manifest".format(filepath)) return hashval def calc_hashes(self, filepaths, hashfns): """ Calculate hash values for a number of filepaths and hash function combinations """ # print("Spawning pool") pool = mp.Pool(processes=self.numproc) #,maxtasksperchild=50) results = defaultdict(dict) # print("Queuing jobs") for filepath, fn in zip(filepaths,hashfns): results[filepath][fn] = pool.apply_async(hash, args=(self.data[filepath]["fullpath"], fn)) pool.close() pool.join() # print("Retrieving results") for filepath, fn in zip(filepaths,hashfns): # Get result of multiprocessing step. Be careful altering this # loop, as this is saving the result back to the dictionary results[filepath][fn] = results[filepath][fn].get() return results def check_file(self, filepaths, hashfn=None, hashvals=None, shortcircuit=False, condition=all): """ Check hash value for a filepath given a hashing function (hashfn) matches stored hash value. Return values of non-matching hashes if hashvals dict supplied. If shortcircuit is True, will return True or False result with first True/False result """ if type(filepaths) is str: filepaths = [ filepaths ] status = [] if hashvals is not None: if type(hashvals) is dict: tmphashvals = defaultdict(dict) else: print("yamanifest :: manifest :: check_items :: hashvals must be a dict") raise results = defaultdict(dict) tmpfilepaths = [] tmpfns = [] for filepath in filepaths: fns = [] if self.contains(filepath): hashes = self.data[filepath]["hashes"] else: raise FilePathNonexistent('{} does not exist in manifest'.format(filepath)) if hashfn == None: if self.hashes is not None: fns = self.hashes else: fns = hashes.keys() elif type(hashfn) is str: fns = [hashfn,] else: fns = hashfn for fn in fns: # Ignore hash test if it does not exist in the manifest. Need this behaviour # so we can cascade hashes which in some cases are incompatible with certain # file types, e.g. nchash if fn in hashes: tmpfilepaths.append(filepath) tmpfns.append(fn) results = self.calc_hashes(tmpfilepaths, tmpfns) for filepath in filepaths: if filepath in results: filestatus = [] for fn in results[filepath]: if fn in self.data[filepath]["hashes"]: # Get result of multiprocessing step hashval = results[filepath][fn] if hashval == self.data[filepath]["hashes"][fn]: filestatus.append(True) if shortcircuit: break else: continue else: # Save these values if given list in which to return them if hashvals is not None: tmphashvals[filepath][fn] = hashval # Should only get here if fn does not exist in manifest, or differs in value filestatus.append(False) if shortcircuit: break # Only return True for a filepath if there was at least one # True hash. Ensures filepaths with no hash are False and must # be regenerated status.append(condition(filestatus) and len(filestatus)>0) else: # Fall here when hash specified but was not in manifest status.append(False) if hashvals is not None: hashvals.update(tmphashvals) return condition(status) def check(self, hashvals=None, **args): """ Check hash value for all filepaths given a hashing function (hashfn) matches stored hash value """ if hashvals is not None: if type(hashvals) is dict: hashvals.clear() else: print("yamanifest :: manifest :: check_items :: hashvals must be a dict") raise return self.check_file(filepaths=self.data.keys(),hashvals=hashvals,**args) def fullpath(self, filepath): """ Return fullpath string for filepath. None if not defined """ if self.contains(filepath): return self.data[filepath]['fullpath'] else: return None def equals(self, other, paths=True): """ Test if this manifest is the same as another manifest object. Made this a bound method instead of overriding __eq__ as need to qualify if equality also includes file paths """ if isinstance(self, other.__class__): for file in self: if file not in other.data: return False if paths: if self.data[file]['fullpath'] != other.data[file]['fullpath']: return False for fn, val in self.data[file]["hashes"].items(): if fn not in other.data[file]["hashes"]: return False if other.data[file]["hashes"][fn] != val: return False return True else: return NotImplemented def find(self, hashfn, hashval): """ Find a hashfn value in a manifest. Return filepath on success, None otherwise """ for filepath in self.data: if hashval == self.get(filepath, hashfn) and hashval is not None: return filepath return None def find_from_lookup(self, hashfn, hashval): """ Find a hashfn value in a manifest. Return filepath on success, None otherwise """ if (hashfn,hashval) in self.lookup: return self.lookup[(hashfn,hashval)] else: return None def _make_lookup(self): for filepath in self: for fn in self.data[filepath]["hashes"]: self._add_lookup(filepath,fn) def _add_lookup(self,filepath,hashfn): hashval = self.data[filepath]["hashes"][hashfn] self.lookup[(hashfn,hashval)] = filepath def update(self, other, newpath=None): """ Add one manifest to another. Optionally replace path in fullpath with new path """ mftmp = {} if newpath is not None: # Make a copy so we don't alter other mftmp = copy.deepcopy(other) # Cannot safely iterate over keys as the dict is being changed so iterate # over a precomputed list for filepath in list(other.data.keys()): mftmp.data[os.path.normpath(os.path.join(newpath,os.path.basename(filepath)))] = other.data[filepath] del mftmp.data[filepath] else: mftmp = other self.data.update(mftmp.data) def update_matching_hashes(self, other): """ Update (add) hashes from other manifest where a match exists between a common hash """ for filepath in self: for hashfn in self.data[filepath]["hashes"]: hashval = self.data[filepath]["hashes"][hashfn] newfilepath = other.find(hashfn,hashval) if newfilepath is not None: # Check other hashes are consistent? self.data[filepath]["hashes"].update(other.data[newfilepath]["hashes"]) break @classmethod def find_manifest(cls, dirpath): """ Search a directory path and find first manifest file, return Manifest object else None """ for file in find_files(dirpath, ["*.yml","*.yaml"]): try: mftmp = cls(file) mftmp.load() except: pass finally: if len(mftmp) > 0: return mftmp return None
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 15945, 29908, 13, 11882, 1266, 29871, 29906, 29900, 29896, 29955, 9033, 29907, 11319, 310, 1222, 3729, 663, 363, 2233, 6490, 23985, 9327, 13, 13, 8921, 29901, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 13, 29931, 293, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 6293, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 3492, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 2525, 2222, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 5721, 7541, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29956, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 13393, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 13400, 800, 1090, 278, 19245, 29889, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 29892, 8380, 29918, 5215, 13, 13, 3166, 4832, 29889, 13529, 267, 1053, 14319, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 343, 8807, 13, 5215, 3509, 13, 5215, 1014, 5014, 13, 5215, 6674, 307, 985, 292, 408, 22326, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 3166, 869, 8568, 292, 1053, 6608, 29892, 6969, 29918, 8568, 267, 13, 3166, 343, 13533, 7004, 29889, 13239, 1053, 1284, 29918, 5325, 13, 13, 1990, 11874, 24217, 29898, 2451, 1125, 13, 1678, 9995, 15870, 292, 304, 788, 263, 6608, 287, 995, 746, 697, 2307, 4864, 15945, 29908, 13, 13, 1990, 3497, 2605, 8516, 29916, 9696, 29898, 2451, 1125, 13, 1678, 9995, 15870, 292, 304, 1423, 263, 6608, 287, 995, 746, 727, 338, 5642, 15945, 29908, 13, 13, 1990, 11874, 8516, 29916, 9696, 29898, 2451, 1125, 13, 1678, 9995, 15870, 292, 304, 1423, 263, 6608, 287, 995, 746, 727, 338, 5642, 15945, 29908, 13, 13, 1990, 2315, 7004, 29898, 3318, 1125, 13, 1678, 9995, 29909, 10419, 1203, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 2224, 29901, 263, 10802, 1203, 363, 278, 10419, 934, 13, 4706, 848, 29901, 385, 8600, 310, 10419, 4452, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2224, 29892, 6608, 267, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 7106, 263, 2315, 7004, 1203, 29892, 2847, 3368, 411, 263, 2224, 13, 4706, 304, 278, 10419, 934, 29889, 10831, 635, 6084, 2322, 13, 4706, 1797, 310, 6608, 267, 304, 671, 746, 8454, 10419, 2854, 537, 13, 4706, 9995, 13, 4706, 1583, 29889, 2084, 353, 2224, 13, 4706, 1583, 29889, 1272, 353, 6571, 13, 4706, 1583, 29889, 6672, 353, 6571, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 1949, 15439, 353, 22326, 29889, 21970, 29918, 2798, 580, 13, 4706, 5174, 2216, 1888, 2037, 287, 2392, 29901, 13, 9651, 1583, 29889, 1949, 15439, 353, 29871, 29896, 13, 4706, 363, 1820, 29892, 659, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 731, 5552, 29898, 1311, 29892, 1820, 29892, 659, 29897, 13, 4706, 1583, 29889, 1524, 353, 29871, 29900, 13, 4706, 565, 6608, 267, 338, 6213, 29901, 13, 9651, 1583, 29889, 8568, 267, 353, 731, 18959, 2109, 8568, 3788, 3487, 29945, 11287, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 8568, 267, 353, 731, 29898, 8568, 267, 29897, 13, 4706, 396, 1583, 29889, 20401, 353, 6571, 13, 4706, 396, 20553, 848, 363, 278, 343, 13533, 7004, 934, 1873, 29889, 910, 338, 934, 1134, 13, 4706, 396, 1873, 29892, 451, 3489, 1873, 29889, 4803, 2767, 297, 1206, 4805, 12700, 13, 4706, 396, 848, 471, 3342, 297, 6273, 13, 4706, 1583, 29889, 6672, 29889, 5504, 3319, 525, 4830, 22099, 29891, 13533, 7004, 742, 525, 3259, 2396, 29896, 29889, 29900, 5615, 13, 13, 632, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 9995, 13, 4706, 20504, 1061, 1158, 13, 4706, 9995, 13, 4706, 363, 934, 297, 1583, 29889, 1272, 29901, 13, 9651, 7709, 934, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 9995, 13, 4706, 7106, 278, 1353, 310, 934, 24772, 297, 278, 10419, 1203, 13, 4706, 9995, 13, 4706, 736, 7431, 29898, 1311, 29889, 1272, 29897, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16012, 10419, 515, 612, 23956, 934, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 411, 1722, 29898, 1311, 29889, 2084, 29892, 525, 29878, 1495, 408, 934, 29901, 13, 18884, 1583, 29889, 6672, 29892, 1583, 29889, 1272, 353, 343, 8807, 29889, 11177, 29918, 1359, 29918, 497, 29898, 1445, 29897, 13, 9651, 565, 376, 4830, 29908, 451, 297, 1583, 29889, 6672, 29901, 13, 18884, 12020, 7865, 2392, 877, 3664, 343, 13533, 7004, 3402, 1495, 13, 9651, 565, 1583, 29889, 6672, 3366, 4830, 3108, 2804, 525, 29891, 13533, 7004, 2396, 13, 18884, 12020, 7865, 2392, 877, 3664, 343, 13533, 7004, 3402, 29901, 6571, 4286, 4830, 29898, 1311, 29889, 6672, 3366, 4830, 3108, 876, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 10876, 29889, 303, 20405, 29889, 3539, 877, 2392, 13755, 343, 13533, 7004, 934, 29901, 6571, 4761, 426, 1012, 29876, 4286, 4830, 29898, 1311, 29889, 2084, 29892, 710, 29898, 29872, 4961, 13, 9651, 12020, 13, 632, 13, 4706, 396, 1583, 3032, 5675, 29918, 20401, 580, 13, 13, 4706, 396, 29408, 9704, 292, 263, 2254, 304, 4969, 263, 716, 2777, 13, 4706, 736, 1583, 13, 308, 13, 1678, 822, 16766, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 360, 3427, 10419, 515, 612, 23956, 934, 13, 4706, 9995, 13, 4706, 411, 1722, 29898, 1311, 29889, 2084, 29892, 525, 29893, 1495, 408, 934, 29901, 13, 9651, 934, 29889, 3539, 29898, 25162, 29889, 15070, 29918, 497, 4197, 1311, 29889, 6672, 29892, 1583, 29889, 1272, 1402, 2322, 29918, 1731, 29918, 3293, 29922, 8824, 876, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 9995, 13, 4706, 21267, 2944, 363, 934, 2084, 297, 10419, 13, 4706, 9995, 13, 4706, 628, 29898, 1311, 29889, 1272, 29961, 1445, 2084, 2314, 13, 13, 1678, 822, 788, 29898, 1311, 29892, 934, 24772, 29922, 8516, 29892, 6608, 9144, 29922, 8516, 29892, 4889, 29922, 8824, 29892, 3273, 6034, 3121, 29922, 8824, 29892, 2989, 24772, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 3462, 6608, 995, 363, 934, 2084, 2183, 263, 756, 2790, 740, 313, 8568, 9144, 467, 13, 4706, 960, 694, 934, 24772, 3342, 29892, 2322, 304, 599, 1857, 934, 24772, 29892, 322, 297, 13, 4706, 445, 982, 508, 788, 263, 6608, 304, 599, 5923, 934, 24772, 29889, 13, 4706, 960, 727, 338, 2307, 263, 6608, 995, 871, 26556, 565, 4889, 29922, 5574, 29892, 13, 4706, 6467, 12020, 3682, 29889, 13, 4706, 9995, 13, 13, 4706, 565, 934, 24772, 338, 6213, 29901, 13, 9651, 934, 24772, 353, 1583, 29889, 1272, 29889, 8149, 580, 13, 4706, 1683, 29901, 13, 9651, 565, 1134, 29898, 1445, 24772, 29897, 338, 851, 29901, 13, 18884, 934, 24772, 353, 518, 1445, 24772, 26073, 13, 13, 4706, 565, 2989, 24772, 338, 6213, 29901, 13, 9651, 2989, 24772, 353, 518, 8516, 29962, 334, 7431, 29898, 1445, 24772, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 1134, 29898, 8159, 24772, 29897, 338, 851, 29901, 13, 18884, 2989, 24772, 353, 518, 8159, 24772, 26073, 13, 9651, 4974, 29898, 2435, 29898, 1445, 24772, 29897, 1275, 7431, 29898, 8159, 24772, 876, 13, 13, 4706, 13128, 1445, 24772, 353, 5159, 13, 4706, 13128, 29888, 1983, 353, 5159, 13, 13, 4706, 2582, 353, 2322, 8977, 29898, 8977, 29897, 13, 13, 4706, 363, 313, 1445, 2084, 29892, 8159, 2084, 29897, 297, 14319, 29898, 1445, 24772, 29892, 8159, 24772, 1125, 13, 632, 13, 9651, 396, 4525, 1818, 367, 3342, 577, 393, 9365, 437, 451, 4418, 2678, 13, 9651, 565, 934, 2084, 451, 297, 1583, 29889, 1272, 29901, 13, 18884, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 353, 6571, 13, 13, 9651, 565, 525, 8568, 267, 29915, 451, 297, 1583, 29889, 1272, 29961, 1445, 2084, 5387, 13, 18884, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 353, 6571, 13, 13, 9651, 565, 2989, 2084, 338, 6213, 29901, 13, 18884, 1583, 29889, 1272, 29961, 1445, 2084, 22322, 8159, 2084, 2033, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 1445, 2084, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 1272, 29961, 1445, 2084, 22322, 8159, 2084, 2033, 353, 2989, 2084, 13, 13, 9651, 565, 6608, 9144, 338, 6213, 29901, 13, 18884, 285, 1983, 353, 1583, 29889, 8568, 267, 13, 9651, 1683, 29901, 13, 18884, 565, 1134, 29898, 8568, 9144, 29897, 338, 851, 29901, 13, 462, 1678, 285, 1983, 353, 518, 8568, 9144, 26073, 13, 18884, 1683, 29901, 13, 462, 1678, 285, 1983, 353, 6608, 9144, 13, 18884, 396, 20768, 304, 788, 738, 6608, 740, 591, 671, 304, 278, 1051, 310, 2322, 6608, 267, 13, 18884, 363, 7876, 297, 285, 1983, 29901, 13, 462, 1678, 1583, 29889, 8568, 267, 29889, 1202, 29898, 9144, 29897, 13, 13, 9651, 363, 7876, 297, 285, 1983, 29901, 13, 18884, 565, 7876, 297, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 322, 451, 4889, 29901, 13, 462, 1678, 396, 3872, 29915, 29873, 1018, 322, 788, 263, 6608, 565, 372, 2307, 4864, 13, 462, 1678, 6773, 13, 18884, 13128, 1445, 24772, 29889, 4397, 29898, 1445, 2084, 29897, 13, 18884, 13128, 29888, 1983, 29889, 4397, 29898, 9144, 29897, 13, 308, 13, 4706, 2582, 353, 1583, 29889, 28667, 29918, 8568, 267, 29898, 7050, 1445, 24772, 29892, 13128, 29888, 1983, 29897, 13, 462, 13, 4706, 363, 934, 2084, 297, 2582, 29901, 13, 13, 9651, 396, 3617, 9657, 310, 1857, 6608, 267, 363, 934, 2084, 13, 9651, 6608, 267, 353, 6571, 13, 9651, 565, 376, 8568, 267, 29908, 297, 1583, 29889, 1272, 29961, 1445, 2084, 5387, 13, 18884, 6608, 267, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 20068, 13, 462, 13, 9651, 285, 1983, 353, 5159, 13, 9651, 565, 6608, 9144, 338, 6213, 29901, 13, 18884, 285, 1983, 353, 1583, 29889, 8568, 267, 13, 9651, 1683, 29901, 13, 18884, 565, 1134, 29898, 8568, 9144, 29897, 338, 851, 29901, 13, 462, 1678, 285, 1983, 353, 518, 8568, 9144, 26073, 13, 18884, 1683, 29901, 13, 462, 1678, 285, 1983, 353, 6608, 9144, 13, 13, 9651, 363, 7876, 297, 285, 1983, 29901, 13, 13, 18884, 396, 565, 7876, 451, 297, 2582, 29961, 1445, 2084, 5387, 13, 18884, 396, 268, 6773, 13, 13, 18884, 6608, 791, 353, 2582, 29961, 1445, 2084, 3816, 9144, 29962, 13, 462, 13, 18884, 396, 960, 591, 29915, 345, 1304, 385, 297, 23712, 756, 2790, 740, 372, 674, 736, 13, 18884, 396, 6213, 322, 591, 674, 4047, 2705, 2313, 538, 445, 6608, 29892, 470, 565, 278, 934, 2084, 13, 18884, 396, 338, 443, 8568, 519, 13, 18884, 565, 6608, 791, 338, 451, 6213, 29901, 13, 462, 1678, 565, 7876, 297, 6608, 267, 29901, 13, 462, 4706, 565, 6608, 267, 29961, 9144, 29962, 2804, 6608, 791, 29901, 13, 462, 9651, 565, 451, 4889, 29901, 13, 462, 18884, 6773, 13, 462, 632, 13, 462, 1678, 396, 3789, 716, 995, 363, 445, 6608, 740, 13, 462, 1678, 6608, 267, 29961, 9144, 29962, 353, 6608, 791, 13, 13, 462, 1678, 565, 3273, 6034, 3121, 29901, 13, 462, 4706, 2867, 13, 13, 9651, 396, 9333, 4078, 848, 304, 10419, 565, 263, 6608, 471, 8472, 5759, 470, 13, 9651, 396, 727, 892, 5923, 6608, 267, 29892, 1683, 5217, 372, 13, 9651, 565, 7431, 29898, 8568, 267, 29897, 1405, 29871, 29900, 29901, 13, 18884, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 353, 6608, 267, 13, 9651, 1683, 29901, 13, 18884, 628, 29898, 1311, 29889, 1272, 29961, 1445, 2084, 2314, 13, 13, 1678, 822, 3743, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 9995, 13, 4706, 7106, 5852, 565, 934, 2084, 338, 297, 10419, 13, 4706, 9995, 13, 13, 4706, 736, 934, 2084, 297, 1583, 29889, 1272, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 934, 2084, 29892, 6608, 9144, 1125, 13, 4706, 9995, 13, 4706, 7106, 6608, 995, 363, 934, 2084, 322, 6608, 740, 29889, 7106, 6213, 565, 451, 3342, 13, 4706, 9995, 13, 13, 4706, 6608, 791, 353, 6213, 13, 4706, 565, 1583, 29889, 11516, 29898, 1445, 2084, 1125, 13, 9651, 565, 6608, 9144, 297, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29901, 13, 18884, 6608, 791, 353, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29961, 8568, 9144, 29962, 13, 18884, 396, 5399, 591, 505, 263, 2854, 6608, 995, 313, 3068, 29915, 29873, 925, 367, 24358, 29897, 13, 18884, 565, 451, 6608, 791, 29889, 17010, 7295, 13, 462, 1678, 6608, 791, 353, 7700, 13, 18884, 396, 1683, 29901, 13, 18884, 396, 268, 1596, 703, 8568, 995, 451, 3342, 6571, 1642, 4830, 29898, 8568, 791, 876, 13, 9651, 396, 1683, 29901, 13, 18884, 396, 1596, 703, 8568, 6571, 451, 297, 10419, 1642, 4830, 29898, 8568, 9144, 876, 13, 4706, 396, 1683, 29901, 13, 9651, 396, 1596, 703, 8875, 451, 297, 10419, 1642, 4830, 29898, 1445, 2084, 876, 13, 13, 4706, 736, 6608, 791, 13, 308, 13, 1678, 822, 22235, 29918, 8568, 267, 29898, 1311, 29892, 934, 24772, 29892, 6608, 29888, 1983, 1125, 13, 4706, 9995, 13, 4706, 20535, 403, 6608, 1819, 363, 263, 1353, 310, 934, 24772, 322, 6608, 740, 18240, 13, 4706, 9995, 13, 308, 13, 4706, 396, 1596, 703, 5592, 1450, 1076, 11565, 1159, 13, 4706, 11565, 353, 22326, 29889, 11426, 29898, 5014, 267, 29922, 1311, 29889, 1949, 15439, 29897, 396, 29892, 655, 486, 1278, 29879, 546, 5145, 29922, 29945, 29900, 29897, 13, 13, 4706, 2582, 353, 2322, 8977, 29898, 8977, 29897, 13, 13, 4706, 396, 1596, 703, 8654, 26420, 17643, 1159, 13, 4706, 363, 934, 2084, 29892, 7876, 297, 14319, 29898, 1445, 24772, 29892, 8568, 29888, 1983, 1125, 13, 9651, 2582, 29961, 1445, 2084, 3816, 9144, 29962, 353, 11565, 29889, 7302, 29918, 12674, 29898, 8568, 29892, 6389, 7607, 1311, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8159, 2084, 12436, 7876, 876, 13, 13, 4706, 11565, 29889, 5358, 580, 13, 4706, 11565, 29889, 7122, 580, 13, 13, 4706, 396, 1596, 703, 8015, 2546, 1747, 2582, 1159, 13, 4706, 363, 934, 2084, 29892, 7876, 297, 14319, 29898, 1445, 24772, 29892, 8568, 29888, 1983, 1125, 13, 9651, 396, 3617, 1121, 310, 6674, 307, 985, 292, 4331, 29889, 1522, 16010, 10551, 292, 445, 13, 9651, 396, 2425, 29892, 408, 445, 338, 14238, 278, 1121, 1250, 304, 278, 8600, 13, 9651, 2582, 29961, 1445, 2084, 3816, 9144, 29962, 353, 2582, 29961, 1445, 2084, 3816, 9144, 1822, 657, 580, 13, 13, 4706, 736, 2582, 13, 13, 1678, 822, 1423, 29918, 1445, 29898, 1311, 29892, 934, 24772, 29892, 6608, 9144, 29922, 8516, 29892, 6608, 791, 29879, 29922, 8516, 29892, 3273, 6034, 3121, 29922, 8824, 29892, 4195, 29922, 497, 1125, 13, 4706, 9995, 13, 4706, 5399, 6608, 995, 363, 263, 934, 2084, 2183, 263, 756, 2790, 740, 313, 8568, 9144, 29897, 13, 4706, 7087, 6087, 6608, 995, 29889, 7106, 1819, 310, 1661, 29899, 4352, 292, 6608, 267, 13, 4706, 565, 6608, 791, 29879, 9657, 19056, 29889, 960, 3273, 6034, 3121, 338, 5852, 29892, 674, 736, 5852, 13, 4706, 470, 7700, 1121, 411, 937, 5852, 29914, 8824, 1121, 13, 4706, 9995, 13, 13, 4706, 565, 1134, 29898, 1445, 24772, 29897, 338, 851, 29901, 13, 9651, 934, 24772, 353, 518, 934, 24772, 4514, 13, 13, 4706, 4660, 353, 5159, 13, 13, 4706, 565, 6608, 791, 29879, 338, 451, 6213, 29901, 13, 9651, 565, 1134, 29898, 8568, 791, 29879, 29897, 338, 9657, 29901, 13, 18884, 27702, 561, 1161, 791, 29879, 353, 2322, 8977, 29898, 8977, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 29891, 13533, 7004, 4761, 10419, 4761, 1423, 29918, 7076, 4761, 6608, 791, 29879, 1818, 367, 263, 9657, 1159, 13, 18884, 12020, 13, 632, 13, 4706, 2582, 353, 2322, 8977, 29898, 8977, 29897, 13, 13, 4706, 13128, 1445, 24772, 353, 5159, 13, 4706, 13128, 29888, 1983, 353, 5159, 13, 13, 4706, 363, 934, 2084, 297, 934, 24772, 29901, 13, 13, 9651, 285, 1983, 353, 5159, 13, 13, 9651, 565, 1583, 29889, 11516, 29898, 1445, 2084, 1125, 13, 18884, 6608, 267, 353, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 13, 9651, 1683, 29901, 13, 18884, 12020, 3497, 2605, 8516, 29916, 9696, 877, 8875, 947, 451, 1863, 297, 10419, 4286, 4830, 29898, 1445, 2084, 876, 13, 632, 13, 9651, 565, 6608, 9144, 1275, 6213, 29901, 13, 18884, 565, 1583, 29889, 8568, 267, 338, 451, 6213, 29901, 13, 462, 1678, 285, 1983, 353, 1583, 29889, 8568, 267, 13, 18884, 1683, 29901, 13, 462, 1678, 285, 1983, 353, 6608, 267, 29889, 8149, 580, 13, 9651, 25342, 1134, 29898, 8568, 9144, 29897, 338, 851, 29901, 13, 18884, 285, 1983, 353, 518, 8568, 9144, 26073, 13, 9651, 1683, 29901, 13, 18884, 285, 1983, 353, 6608, 9144, 13, 462, 13, 9651, 363, 7876, 297, 285, 1983, 29901, 13, 18884, 396, 18076, 487, 6608, 1243, 565, 372, 947, 451, 1863, 297, 278, 10419, 29889, 20768, 445, 10468, 13, 18884, 396, 577, 591, 508, 3209, 6332, 6608, 267, 607, 297, 777, 4251, 526, 297, 23712, 411, 3058, 13, 18884, 396, 934, 4072, 29892, 321, 29889, 29887, 29889, 302, 305, 1161, 13, 18884, 565, 7876, 297, 6608, 267, 29901, 13, 462, 1678, 13128, 1445, 24772, 29889, 4397, 29898, 1445, 2084, 29897, 13, 462, 1678, 13128, 29888, 1983, 29889, 4397, 29898, 9144, 29897, 13, 13, 4706, 2582, 353, 1583, 29889, 28667, 29918, 8568, 267, 29898, 7050, 1445, 24772, 29892, 13128, 29888, 1983, 29897, 13, 13, 4706, 363, 934, 2084, 297, 934, 24772, 29901, 13, 13, 9651, 565, 934, 2084, 297, 2582, 29901, 13, 18884, 977, 342, 2389, 353, 5159, 13, 13, 18884, 363, 7876, 297, 2582, 29961, 1445, 2084, 5387, 13, 462, 1678, 565, 7876, 297, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29901, 13, 462, 4706, 396, 3617, 1121, 310, 6674, 307, 985, 292, 4331, 13, 462, 4706, 6608, 791, 353, 2582, 29961, 1445, 2084, 3816, 9144, 29962, 13, 462, 4706, 565, 6608, 791, 1275, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29961, 9144, 5387, 13, 462, 9651, 977, 342, 2389, 29889, 4397, 29898, 5574, 29897, 13, 462, 9651, 565, 3273, 6034, 3121, 29901, 13, 462, 18884, 2867, 13, 462, 9651, 1683, 29901, 13, 462, 18884, 6773, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 396, 16913, 1438, 1819, 565, 2183, 1051, 297, 607, 304, 736, 963, 13, 462, 9651, 565, 6608, 791, 29879, 338, 451, 6213, 29901, 13, 462, 18884, 27702, 561, 1161, 791, 29879, 29961, 1445, 2084, 3816, 9144, 29962, 353, 6608, 791, 13, 13, 462, 1678, 396, 10575, 871, 679, 1244, 565, 7876, 947, 451, 1863, 297, 10419, 29892, 470, 2923, 414, 297, 995, 13, 462, 1678, 977, 342, 2389, 29889, 4397, 29898, 8824, 29897, 13, 13, 462, 1678, 565, 3273, 6034, 3121, 29901, 13, 462, 4706, 2867, 13, 13, 18884, 396, 9333, 736, 5852, 363, 263, 934, 2084, 565, 727, 471, 472, 3203, 697, 13, 18884, 396, 5852, 6608, 29889, 22521, 1973, 934, 24772, 411, 694, 6608, 526, 7700, 322, 1818, 13, 18884, 396, 367, 1072, 759, 630, 13, 18884, 4660, 29889, 4397, 29898, 16122, 29898, 1777, 342, 2389, 29897, 322, 7431, 29898, 1777, 342, 2389, 15410, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 14053, 1244, 746, 6608, 6790, 541, 471, 451, 297, 10419, 13, 18884, 4660, 29889, 4397, 29898, 8824, 29897, 13, 13, 4706, 565, 6608, 791, 29879, 338, 451, 6213, 29901, 13, 9651, 6608, 791, 29879, 29889, 5504, 29898, 18276, 561, 1161, 791, 29879, 29897, 13, 13, 4706, 736, 4195, 29898, 4882, 29897, 13, 13, 1678, 822, 1423, 29898, 1311, 29892, 6608, 791, 29879, 29922, 8516, 29892, 3579, 5085, 1125, 13, 4706, 9995, 13, 4706, 5399, 6608, 995, 363, 599, 934, 24772, 2183, 263, 756, 2790, 740, 313, 8568, 9144, 29897, 13, 4706, 7087, 6087, 6608, 995, 13, 4706, 9995, 13, 13, 4706, 565, 6608, 791, 29879, 338, 451, 6213, 29901, 13, 9651, 565, 1134, 29898, 8568, 791, 29879, 29897, 338, 9657, 29901, 13, 18884, 6608, 791, 29879, 29889, 8551, 580, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 29891, 13533, 7004, 4761, 10419, 4761, 1423, 29918, 7076, 4761, 6608, 791, 29879, 1818, 367, 263, 9657, 1159, 13, 18884, 12020, 13, 632, 13, 4706, 736, 1583, 29889, 3198, 29918, 1445, 29898, 1445, 24772, 29922, 1311, 29889, 1272, 29889, 8149, 3285, 8568, 791, 29879, 29922, 8568, 791, 29879, 29892, 1068, 5085, 29897, 13, 13, 1678, 822, 2989, 2084, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 9995, 13, 4706, 7106, 2989, 2084, 1347, 363, 934, 2084, 29889, 6213, 565, 451, 3342, 13, 4706, 9995, 13, 13, 4706, 565, 1583, 29889, 11516, 29898, 1445, 2084, 1125, 13, 9651, 736, 1583, 29889, 1272, 29961, 1445, 2084, 22322, 8159, 2084, 2033, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 308, 13, 1678, 822, 15743, 29898, 1311, 29892, 916, 29892, 10898, 29922, 5574, 1125, 13, 4706, 9995, 13, 4706, 4321, 565, 445, 10419, 338, 278, 1021, 408, 1790, 10419, 1203, 29889, 13, 4706, 18266, 445, 263, 3216, 1158, 2012, 310, 20831, 292, 4770, 1837, 1649, 408, 817, 304, 29871, 13, 4706, 4021, 1598, 565, 17193, 884, 7805, 934, 10898, 13, 4706, 9995, 13, 4706, 565, 338, 8758, 29898, 1311, 29892, 916, 17255, 1990, 1649, 1125, 13, 13, 9651, 363, 934, 297, 1583, 29901, 13, 18884, 565, 934, 451, 297, 916, 29889, 1272, 29901, 13, 462, 1678, 736, 7700, 13, 18884, 565, 10898, 29901, 13, 462, 1678, 565, 1583, 29889, 1272, 29961, 1445, 22322, 8159, 2084, 2033, 2804, 916, 29889, 1272, 29961, 1445, 22322, 8159, 2084, 2033, 29901, 13, 462, 4706, 736, 7700, 13, 18884, 363, 7876, 29892, 659, 297, 1583, 29889, 1272, 29961, 1445, 29962, 3366, 8568, 267, 16862, 7076, 7295, 13, 462, 1678, 565, 7876, 451, 297, 916, 29889, 1272, 29961, 1445, 29962, 3366, 8568, 267, 3108, 29901, 13, 462, 4706, 736, 7700, 13, 462, 1678, 565, 916, 29889, 1272, 29961, 1445, 29962, 3366, 8568, 267, 3108, 29961, 9144, 29962, 2804, 659, 29901, 13, 462, 4706, 736, 7700, 13, 13, 9651, 736, 5852, 13, 13, 4706, 1683, 29901, 13, 9651, 736, 2216, 1888, 2037, 287, 13, 13, 1678, 822, 1284, 29898, 1311, 29892, 6608, 9144, 29892, 6608, 791, 1125, 13, 4706, 9995, 13, 4706, 10987, 263, 6608, 9144, 995, 297, 263, 10419, 29889, 7106, 934, 2084, 373, 2551, 29892, 6213, 6467, 13, 4706, 9995, 13, 4706, 363, 934, 2084, 297, 1583, 29889, 1272, 29901, 13, 9651, 565, 6608, 791, 1275, 1583, 29889, 657, 29898, 1445, 2084, 29892, 6608, 9144, 29897, 322, 6608, 791, 338, 451, 6213, 29901, 13, 18884, 736, 934, 2084, 13, 13, 4706, 736, 6213, 13, 13, 308, 13, 1678, 822, 1284, 29918, 3166, 29918, 20401, 29898, 1311, 29892, 6608, 9144, 29892, 6608, 791, 1125, 13, 4706, 9995, 13, 4706, 10987, 263, 6608, 9144, 995, 297, 263, 10419, 29889, 7106, 934, 2084, 373, 2551, 29892, 6213, 6467, 13, 4706, 9995, 13, 4706, 565, 313, 8568, 9144, 29892, 8568, 791, 29897, 297, 1583, 29889, 20401, 29901, 13, 9651, 736, 1583, 29889, 20401, 15625, 8568, 9144, 29892, 8568, 791, 4638, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 13, 1678, 822, 903, 5675, 29918, 20401, 29898, 1311, 1125, 13, 4706, 363, 934, 2084, 297, 1583, 29901, 13, 9651, 363, 7876, 297, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29901, 13, 18884, 1583, 3032, 1202, 29918, 20401, 29898, 1445, 2084, 29892, 9144, 29897, 13, 13, 1678, 822, 903, 1202, 29918, 20401, 29898, 1311, 29892, 1445, 2084, 29892, 8568, 9144, 1125, 13, 4706, 6608, 791, 353, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29961, 8568, 9144, 29962, 13, 4706, 1583, 29889, 20401, 15625, 8568, 9144, 29892, 8568, 791, 4638, 353, 934, 2084, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 916, 29892, 716, 2084, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 3462, 697, 10419, 304, 1790, 29889, 10831, 635, 5191, 2224, 297, 2989, 2084, 411, 716, 2224, 13, 4706, 9995, 13, 4706, 286, 615, 1526, 353, 6571, 13, 4706, 565, 716, 2084, 338, 451, 6213, 29901, 13, 9651, 396, 8561, 263, 3509, 577, 591, 1016, 29915, 29873, 10551, 916, 13, 9651, 286, 615, 1526, 353, 3509, 29889, 24535, 8552, 29898, 1228, 29897, 13, 9651, 396, 15808, 23511, 13649, 975, 6611, 408, 278, 9657, 338, 1641, 3939, 577, 13649, 13, 9651, 396, 975, 263, 758, 12097, 287, 1051, 13, 9651, 363, 934, 2084, 297, 1051, 29898, 1228, 29889, 1272, 29889, 8149, 580, 1125, 13, 18884, 286, 615, 1526, 29889, 1272, 29961, 359, 29889, 2084, 29889, 12324, 2084, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1482, 2084, 29892, 359, 29889, 2084, 29889, 6500, 3871, 29898, 1445, 2084, 876, 4638, 353, 916, 29889, 1272, 29961, 1445, 2084, 29962, 13, 18884, 628, 286, 615, 1526, 29889, 1272, 29961, 1445, 2084, 29962, 13, 4706, 1683, 29901, 13, 9651, 286, 615, 1526, 353, 916, 13, 13, 4706, 1583, 29889, 1272, 29889, 5504, 29898, 29885, 615, 1526, 29889, 1272, 29897, 13, 13, 1678, 822, 2767, 29918, 4352, 292, 29918, 8568, 267, 29898, 1311, 29892, 916, 1125, 13, 4706, 9995, 13, 4706, 10318, 313, 1202, 29897, 6608, 267, 515, 916, 10419, 988, 263, 1993, 4864, 1546, 263, 3619, 13, 4706, 6608, 13, 4706, 9995, 13, 4706, 363, 934, 2084, 297, 1583, 29901, 13, 9651, 363, 6608, 9144, 297, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29901, 13, 18884, 6608, 791, 353, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 3108, 29961, 8568, 9144, 29962, 13, 18884, 716, 1445, 2084, 353, 916, 29889, 2886, 29898, 8568, 9144, 29892, 8568, 791, 29897, 13, 18884, 565, 716, 1445, 2084, 338, 451, 6213, 29901, 13, 462, 1678, 396, 5399, 916, 6608, 267, 526, 13747, 29973, 13, 462, 1678, 1583, 29889, 1272, 29961, 1445, 2084, 29962, 3366, 8568, 267, 16862, 5504, 29898, 1228, 29889, 1272, 29961, 1482, 1445, 2084, 29962, 3366, 8568, 267, 20068, 13, 462, 1678, 2867, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1284, 29918, 29135, 29898, 25932, 29892, 4516, 2084, 1125, 13, 4706, 9995, 13, 4706, 11856, 263, 3884, 2224, 322, 1284, 937, 10419, 934, 29892, 736, 2315, 7004, 1203, 1683, 6213, 29871, 13, 4706, 9995, 13, 4706, 363, 934, 297, 1284, 29918, 5325, 29898, 3972, 2084, 29892, 6796, 10521, 21053, 3284, 10521, 25162, 3108, 1125, 13, 9651, 1018, 29901, 13, 18884, 286, 615, 1526, 353, 1067, 29879, 29898, 1445, 29897, 29871, 13, 18884, 286, 615, 1526, 29889, 1359, 580, 13, 9651, 5174, 29901, 13, 18884, 1209, 13, 9651, 7146, 29901, 13, 18884, 565, 7431, 29898, 29885, 615, 1526, 29897, 1405, 29871, 29900, 29901, 13, 462, 1678, 736, 286, 615, 1526, 13, 13, 4706, 736, 6213, 13, 2 ]
project/bin/countwords.py
privong/still-magic
0
65943
<filename>project/bin/countwords.py<gh_stars>0 #!/usr/bin/env python ''' Read one or more text files given as command-line arguments, or standard input if no filenames are given, and produce a two-column CSV of words and counts. ''' import sys import re import csv from collections import Counter PUNC = re.compile(r'",;.') WORD = re.compile(r'\b[_\'\(]*(.+?)[_\'\)]*\b') def main(filenames): ''' Read standard input or one or more files and report results. ''' results = Counter() if not filenames: process(sys.stdin, results) else: for fn in filenames: with open(fn, 'r') as reader: process(reader, results) report(sys.stdout, results) def process(reader, results): ''' Extract and count words from stream. ''' raw = reader.read() cooked = PUNC.sub('', raw) words = WORD.findall(cooked) results.update(words) def report(writer, results): ''' Report results to stream. ''' writer = csv.writer(writer) for (key, value) in results.items(): writer.writerow((key, value)) if __name__ == '__main__': main(sys.argv[1:])
[ 1, 529, 9507, 29958, 4836, 29914, 2109, 29914, 2798, 9303, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 12008, 13, 6359, 697, 470, 901, 1426, 2066, 2183, 408, 1899, 29899, 1220, 6273, 29892, 470, 3918, 1881, 13, 361, 694, 977, 264, 1280, 526, 2183, 29892, 322, 7738, 263, 1023, 29899, 4914, 16874, 310, 3838, 322, 18139, 29889, 13, 12008, 13, 13, 13, 5215, 10876, 13, 5215, 337, 13, 5215, 11799, 13, 3166, 16250, 1053, 315, 5336, 13, 13, 13, 29925, 3904, 29907, 353, 337, 29889, 12198, 29898, 29878, 29915, 613, 29936, 29889, 1495, 13, 17013, 353, 337, 29889, 12198, 29898, 29878, 12764, 29890, 29961, 3187, 12764, 29898, 14178, 11891, 29974, 7897, 29961, 3187, 12764, 4638, 17710, 29890, 1495, 13, 13, 13, 1753, 1667, 29898, 1777, 264, 1280, 1125, 13, 1678, 14550, 13, 1678, 7523, 3918, 1881, 470, 697, 470, 901, 2066, 322, 3461, 2582, 29889, 13, 1678, 14550, 13, 1678, 2582, 353, 315, 5336, 580, 13, 1678, 565, 451, 977, 264, 1280, 29901, 13, 4706, 1889, 29898, 9675, 29889, 4172, 262, 29892, 2582, 29897, 13, 1678, 1683, 29901, 13, 4706, 363, 7876, 297, 977, 264, 1280, 29901, 13, 9651, 411, 1722, 29898, 9144, 29892, 525, 29878, 1495, 408, 9591, 29901, 13, 18884, 1889, 29898, 16950, 29892, 2582, 29897, 13, 1678, 3461, 29898, 9675, 29889, 25393, 29892, 2582, 29897, 13, 13, 13, 1753, 1889, 29898, 16950, 29892, 2582, 1125, 13, 1678, 14550, 13, 1678, 7338, 1461, 322, 2302, 3838, 515, 4840, 29889, 13, 1678, 14550, 13, 1678, 10650, 353, 9591, 29889, 949, 580, 13, 1678, 7984, 287, 353, 349, 3904, 29907, 29889, 1491, 877, 742, 10650, 29897, 13, 1678, 3838, 353, 399, 25593, 29889, 2886, 497, 29898, 1111, 12504, 29897, 13, 1678, 2582, 29889, 5504, 29898, 9303, 29897, 13, 13, 13, 1753, 3461, 29898, 13236, 29892, 2582, 1125, 13, 1678, 14550, 13, 1678, 13969, 2582, 304, 4840, 29889, 13, 1678, 14550, 13, 1678, 9227, 353, 11799, 29889, 13236, 29898, 13236, 29897, 13, 1678, 363, 313, 1989, 29892, 995, 29897, 297, 2582, 29889, 7076, 7295, 13, 4706, 9227, 29889, 13236, 340, 3552, 1989, 29892, 995, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 29898, 9675, 29889, 19218, 29961, 29896, 29901, 2314, 13, 13, 2 ]
REMD_analysis/REMD_tpr_prep.py
wehs7661/REMD_analysis
1
127564
#!/usr/bin/env python import os import sys def main(): s = 'This Python script prepares all files needed to run a replica exchange, including' \ ' .mdp files and .tpr files, given the .gro file(s) and a template .mdp file.' \ ' The .gro file could be only one common .gro file for all the replicas, or one for' \ ' each replica. (Check REMD_conf_prep.py for methods for preparing one .gro for each' \ ' replica.) In addition, a job submission script can also be generated.' print(s) # First request user input platform = input('Are you using this script locally or in HPC? (local/HPC): ') jobname = input("Please input the name of the job: ") prefix = input("Please input the prefix of the file names: ") N = input("Please input the number of replicas: ") nodes = input("Please input the number of requested nodes: ") simutime = input("Please input the simulation time (in hour): ") HPC = input("Will the job be submitted to Summit or Bridges? ") conf = input("Are the configurations for different states the same? (yes/no) ") jobscript = input("Do you want to write a job submission script? (yes/no) ") sub = input("Do you want to submit the job? (yes/no) ") # REMD = input('Are you preparaing HREMD or TREMD? (HREMD/TREMD)') # Identify the current working platform if platform == 'HPC': gmx_cmd = 'gmx_mpi' if HPC == 'Summit' or HPC == 'summit': os.system('ml gromacs/2018.3') elif HPC == 'Bridges' or HPC == 'bridges': os.system('module load gromacs/2018_cpu') os.system('module load mpi/intel_mpi') else: print('Error: Wrong HPC specified. Available options are Summit and Bridges.') sys.exit() elif platform == 'local': gmx_cmd = 'gmx' else: print('Error: Wrong platform specified. Available options are local and HPC.') # Prepare all the input files print('Preparaing the files needed for the Hamiltonian replica exchange ...') for i in range(int(N)): if conf == 'yes': os.system('mkdir state_%s' % i) os.system('cp *gro *top *ndx state_%s' % i) elif conf == 'no': os.system('cp *top *ndx *state_%s' % i) else: print('Bad input for the question: Are the configurations for different states the same? (yes/no') sys.exit() os.system('cp *template.mdp state_%s/%s.mdp' % (i, prefix)) os.system('sed -i -e "s/init-lambda-state = X/init-lambda-state = %s/g" state_%s/%s.mdp' %(i, i, prefix)) os.chdir('state_%s' % i) os.system('%s grompp -f %s.mdp -c %s.gro -p %s.top -n %s.ndx -o %s.tpr -maxwarn 4' % (gmx_cmd, prefix, prefix, prefix, prefix, prefix)) os.chdir('../') # Write the job submission script and submit it if needed if jobscript == 'yes': print('Writing job submission script ...') job_dir = '' for i in range(int(N)): job_dir += 'state_%s ' %i job_dict = {'jobname': jobname, 'N': N, 'N_cube': int(N) ** 3, 'nodes': nodes, 'simutime': simutime, 'prefix': prefix, 'job_dir': job_dir, 'task-per-nodes': int(int(N) / int(nodes)), 'cpus-per-task-s': int(24 / (int(N) / int(nodes))), 'cpus-per-tasks-b': int(28 / (int(N) / int(nodes)))} if HPC == 'Summit' or HPC == 'summit': text = """#!/bin/sh #SBATCH --job-name {jobname} #SBATCH --qos normal #SBATCH --nodes={nodes} #SBATCH --tasks-per-node={tasks-per-nodes} #SBATCH --cpus-per-task={cpus-per-tasks-s} #SBATCH --time {simutime}:00:00 #SBATCH --partition shas module load gromacs/2018.3 # export OMP_NUM_THREADS=24 sbatch HREMD_run.sh -d=afterok:$SLURM_JOB_ID if [ -f state_0/{prefix}.cpt ]; then mpirun -np {N} gmx_mpi mdrun -deffnm {prefix} -dhdl {prefix}_dhdl.xvg -replex 100 -nex {N_cube} -multidir {job_dir} -cpi {prefix}.cpt -noappend else mpirun -np {N} gmx_mpi mdrun -deffnm {prefix} -dhdl {prefix}_dhdl.xvg -replex 100 -nex {N_cube} -multidir {job_dir} fi """.format(**job_dict) outfile = open('HREMD_run.sh', 'w') outfile.write(text) if sub == 'yes': os.system('sbatch HREMD_run.sh') print('Job submitted!') elif sub == 'no': pass else: print('Error: Bad input for the question: Do you want to submit the job? (yes/no).') if HPC == 'Bridges' or HPC == 'bridges': text = """#!/bin/sh #SBATCH -N {nodes} #SBATCH -p RM #SBATCH -t {simutime}:00:00 #SBATCH --ntasks-per-node={task-per-nodes} module load gromacs/2018_cpu module load mpi/intel_mpi # export OMP_NUM_THREADS=24 sbatch HREMD_run.sh -d=afterok:$SLURM_JOB_ID if [ -f state_0/{prefix}.cpt ]; then mpirun -np {N} gmx_mpi mdrun -deffnm {prefix} -dhdl {prefix}_dhdl.xvg -replex 100 -nex {N_cube} -multidir {job_dir} -cpi {prefix}.cpt -noappend else mpirun -np {N} gmx_mpi mdrun -deffnm {prefix} -dhdl {prefix}_dhdl.xvg -replex 100 -nex {N_cube} -multidir {job_dir} fi """.format(**job_dict) outfile = open('HREMD_run.sh', 'w') outfile.write(text) if sub == 'yes': os.system('sbatch HREMD_run.sh') print('Job submitted!') elif sub == 'no': pass else: print('Error: Bad input for the question: Do you want to submit the job? (yes/no).') # Check if all the files were successfully generated # mdout.mdp, PLCpep7.mdp, PLCpep.ndx, PLCpep7.top, PLCpep7.tpr
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 1753, 1667, 7295, 13, 1678, 269, 353, 525, 4013, 5132, 2471, 10223, 267, 599, 2066, 4312, 304, 1065, 263, 1634, 10123, 14523, 29892, 3704, 29915, 320, 13, 4706, 525, 869, 3487, 29886, 2066, 322, 869, 29873, 558, 2066, 29892, 2183, 278, 869, 17170, 934, 29898, 29879, 29897, 322, 263, 4472, 869, 3487, 29886, 934, 6169, 320, 13, 4706, 525, 450, 869, 17170, 934, 1033, 367, 871, 697, 3619, 869, 17170, 934, 363, 599, 278, 1634, 506, 294, 29892, 470, 697, 363, 29915, 320, 13, 4706, 525, 1269, 1634, 10123, 29889, 313, 5596, 5195, 5773, 29918, 5527, 29918, 15287, 29889, 2272, 363, 3519, 363, 10223, 292, 697, 869, 17170, 363, 1269, 29915, 320, 13, 4706, 525, 1634, 10123, 1846, 512, 6124, 29892, 263, 4982, 29240, 2471, 508, 884, 367, 5759, 6169, 29871, 13, 13, 1678, 1596, 29898, 29879, 29897, 13, 13, 268, 13, 1678, 396, 3824, 2009, 1404, 1881, 13, 1678, 7481, 353, 1881, 877, 17506, 366, 773, 445, 2471, 12430, 470, 297, 379, 9026, 29973, 313, 2997, 29914, 3954, 29907, 1125, 25710, 13, 1678, 4982, 978, 353, 1881, 703, 12148, 1881, 278, 1024, 310, 278, 4982, 29901, 16521, 13, 1678, 10944, 353, 1881, 703, 12148, 1881, 278, 10944, 310, 278, 934, 2983, 29901, 16521, 13, 1678, 405, 353, 1881, 703, 12148, 1881, 278, 1353, 310, 1634, 506, 294, 29901, 16521, 13, 1678, 7573, 353, 1881, 703, 12148, 1881, 278, 1353, 310, 13877, 7573, 29901, 16521, 13, 1678, 1027, 329, 603, 353, 1881, 703, 12148, 1881, 278, 17402, 931, 313, 262, 7234, 1125, 16521, 13, 1678, 379, 9026, 353, 1881, 703, 12984, 278, 4982, 367, 18397, 304, 6991, 2415, 470, 1771, 333, 2710, 29973, 16521, 13, 1678, 1970, 353, 1881, 703, 17506, 278, 22920, 363, 1422, 5922, 278, 1021, 29973, 313, 3582, 29914, 1217, 29897, 16521, 29871, 13, 1678, 4982, 2154, 353, 1881, 703, 6132, 366, 864, 304, 2436, 263, 4982, 29240, 2471, 29973, 313, 3582, 29914, 1217, 29897, 16521, 13, 1678, 1014, 353, 1881, 703, 6132, 366, 864, 304, 9752, 278, 4982, 29973, 313, 3582, 29914, 1217, 29897, 16521, 13, 1678, 396, 5195, 5773, 353, 1881, 877, 17506, 366, 10223, 29874, 292, 379, 1525, 5773, 470, 323, 1525, 5773, 29973, 313, 29950, 1525, 5773, 29914, 29911, 1525, 5773, 29897, 1495, 13, 268, 13, 13, 1678, 396, 13355, 1598, 278, 1857, 1985, 7481, 13, 1678, 565, 7481, 1275, 525, 3954, 29907, 2396, 13, 4706, 330, 16838, 29918, 9006, 353, 525, 29887, 16838, 29918, 1526, 29875, 29915, 13, 4706, 565, 379, 9026, 1275, 525, 11139, 2415, 29915, 470, 379, 9026, 1275, 525, 2083, 2415, 2396, 13, 9651, 2897, 29889, 5205, 877, 828, 330, 456, 16815, 29914, 29906, 29900, 29896, 29947, 29889, 29941, 1495, 13, 4706, 25342, 379, 9026, 1275, 525, 29933, 2429, 2710, 29915, 470, 379, 9026, 1275, 525, 19515, 2710, 2396, 13, 9651, 2897, 29889, 5205, 877, 5453, 2254, 330, 456, 16815, 29914, 29906, 29900, 29896, 29947, 29918, 21970, 1495, 13, 9651, 2897, 29889, 5205, 877, 5453, 2254, 286, 1631, 29914, 524, 295, 29918, 1526, 29875, 1495, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 2392, 29901, 399, 29373, 379, 9026, 6790, 29889, 7740, 3106, 3987, 526, 6991, 2415, 322, 1771, 333, 2710, 29889, 1495, 13, 9651, 10876, 29889, 13322, 580, 13, 1678, 25342, 7481, 1275, 525, 2997, 2396, 13, 4706, 330, 16838, 29918, 9006, 353, 525, 29887, 16838, 29915, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 2392, 29901, 399, 29373, 7481, 6790, 29889, 7740, 3106, 3987, 526, 1887, 322, 379, 9026, 29889, 1495, 13, 13, 268, 13, 1678, 396, 349, 3445, 598, 599, 278, 1881, 2066, 13, 1678, 1596, 877, 6572, 22752, 292, 278, 2066, 4312, 363, 278, 27752, 1634, 10123, 14523, 2023, 1495, 13, 1678, 363, 474, 297, 3464, 29898, 524, 29898, 29940, 22164, 13, 4706, 565, 1970, 1275, 525, 3582, 2396, 13, 9651, 2897, 29889, 5205, 877, 11256, 3972, 2106, 29918, 29995, 29879, 29915, 1273, 474, 29897, 13, 9651, 2897, 29889, 5205, 877, 6814, 334, 17170, 334, 3332, 334, 299, 29916, 2106, 29918, 29995, 29879, 29915, 1273, 474, 29897, 13, 4706, 25342, 1970, 1275, 525, 1217, 2396, 13, 9651, 2897, 29889, 5205, 877, 6814, 334, 3332, 334, 299, 29916, 334, 3859, 29918, 29995, 29879, 29915, 1273, 474, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 22050, 1881, 363, 278, 1139, 29901, 4683, 278, 22920, 363, 1422, 5922, 278, 1021, 29973, 313, 3582, 29914, 1217, 1495, 13, 9651, 10876, 29889, 13322, 580, 13, 13, 4706, 2897, 29889, 5205, 877, 6814, 334, 6886, 29889, 3487, 29886, 2106, 29918, 29995, 29879, 22584, 29879, 29889, 3487, 29886, 29915, 1273, 313, 29875, 29892, 10944, 876, 13, 4706, 2897, 29889, 5205, 877, 8485, 448, 29875, 448, 29872, 376, 29879, 29914, 2344, 29899, 2892, 29899, 3859, 4706, 353, 1060, 29914, 2344, 29899, 2892, 29899, 3859, 4706, 353, 1273, 29879, 29914, 29887, 29908, 2106, 29918, 29995, 29879, 22584, 29879, 29889, 3487, 29886, 29915, 1273, 29898, 29875, 29892, 474, 29892, 10944, 876, 13, 4706, 2897, 29889, 305, 3972, 877, 3859, 29918, 29995, 29879, 29915, 1273, 474, 29897, 13, 4706, 2897, 29889, 5205, 877, 29995, 29879, 330, 456, 407, 448, 29888, 1273, 29879, 29889, 3487, 29886, 448, 29883, 1273, 29879, 29889, 17170, 448, 29886, 1273, 29879, 29889, 3332, 448, 29876, 1273, 29879, 29889, 299, 29916, 448, 29877, 1273, 29879, 29889, 29873, 558, 448, 3317, 25442, 29871, 29946, 29915, 1273, 313, 29887, 16838, 29918, 9006, 29892, 10944, 29892, 10944, 29892, 10944, 29892, 10944, 29892, 10944, 876, 13, 4706, 2897, 29889, 305, 3972, 877, 6995, 1495, 13, 268, 13, 13, 1678, 396, 14350, 278, 4982, 29240, 2471, 322, 9752, 372, 565, 4312, 13, 1678, 565, 4982, 2154, 1275, 525, 3582, 2396, 13, 4706, 1596, 877, 29956, 768, 292, 4982, 29240, 2471, 2023, 1495, 13, 13, 4706, 4982, 29918, 3972, 353, 6629, 13, 4706, 363, 474, 297, 3464, 29898, 524, 29898, 29940, 22164, 13, 9651, 4982, 29918, 3972, 4619, 525, 3859, 29918, 29995, 29879, 525, 1273, 29875, 13, 308, 13, 4706, 4982, 29918, 8977, 353, 11117, 9057, 978, 2396, 4982, 978, 29892, 525, 29940, 2396, 405, 29892, 525, 29940, 29918, 29883, 4003, 2396, 938, 29898, 29940, 29897, 3579, 29871, 29941, 29892, 525, 18010, 2396, 7573, 29892, 29871, 13, 462, 1678, 525, 3601, 329, 603, 2396, 1027, 329, 603, 29892, 525, 13506, 2396, 10944, 29892, 525, 9057, 29918, 3972, 2396, 4982, 29918, 3972, 29892, 29871, 13, 462, 1678, 525, 7662, 29899, 546, 29899, 18010, 2396, 938, 29898, 524, 29898, 29940, 29897, 847, 938, 29898, 18010, 8243, 29871, 13, 462, 1678, 525, 6814, 375, 29899, 546, 29899, 7662, 29899, 29879, 2396, 938, 29898, 29906, 29946, 847, 313, 524, 29898, 29940, 29897, 847, 938, 29898, 18010, 876, 511, 29871, 13, 462, 1678, 525, 6814, 375, 29899, 546, 29899, 20673, 29899, 29890, 2396, 938, 29898, 29906, 29947, 847, 313, 524, 29898, 29940, 29897, 847, 938, 29898, 18010, 876, 2915, 13, 308, 13, 4706, 565, 379, 9026, 1275, 525, 11139, 2415, 29915, 470, 379, 9026, 1275, 525, 2083, 2415, 2396, 13, 9651, 1426, 353, 9995, 29937, 14708, 2109, 29914, 845, 13, 29937, 1744, 14789, 1192, 9057, 29899, 978, 426, 9057, 978, 29913, 13, 29937, 1744, 14789, 1192, 29939, 359, 4226, 13, 29937, 1744, 14789, 1192, 18010, 3790, 18010, 29913, 13, 29937, 1744, 14789, 1192, 20673, 29899, 546, 29899, 3177, 3790, 20673, 29899, 546, 29899, 18010, 29913, 13, 29937, 1744, 14789, 1192, 6814, 375, 29899, 546, 29899, 7662, 3790, 6814, 375, 29899, 546, 29899, 20673, 29899, 29879, 29913, 13, 29937, 1744, 14789, 1192, 2230, 426, 3601, 329, 603, 6177, 29900, 29900, 29901, 29900, 29900, 13, 29937, 1744, 14789, 1192, 16707, 528, 294, 13, 13, 5453, 2254, 330, 456, 16815, 29914, 29906, 29900, 29896, 29947, 29889, 29941, 13, 13, 29937, 5609, 438, 3580, 29918, 13967, 29918, 4690, 16310, 29903, 29922, 29906, 29946, 13, 13, 29879, 16175, 379, 1525, 5773, 29918, 3389, 29889, 845, 448, 29881, 29922, 7045, 554, 17178, 12750, 4574, 29924, 29918, 29967, 14824, 29918, 1367, 13, 13, 361, 518, 448, 29888, 2106, 29918, 29900, 19248, 13506, 1836, 29883, 415, 12940, 769, 13, 1678, 22326, 381, 348, 448, 9302, 426, 29940, 29913, 330, 16838, 29918, 1526, 29875, 22821, 3389, 448, 311, 600, 22882, 426, 13506, 29913, 448, 12744, 11671, 426, 13506, 2403, 12744, 11671, 29889, 29916, 29894, 29887, 448, 276, 10709, 29871, 29896, 29900, 29900, 448, 13996, 426, 29940, 29918, 29883, 4003, 29913, 448, 4713, 333, 381, 426, 9057, 29918, 3972, 29913, 448, 29883, 1631, 426, 13506, 1836, 29883, 415, 448, 1217, 4397, 13, 2870, 13, 1678, 22326, 381, 348, 448, 9302, 426, 29940, 29913, 330, 16838, 29918, 1526, 29875, 22821, 3389, 448, 311, 600, 22882, 426, 13506, 29913, 448, 12744, 11671, 426, 13506, 2403, 12744, 11671, 29889, 29916, 29894, 29887, 448, 276, 10709, 29871, 29896, 29900, 29900, 448, 13996, 426, 29940, 29918, 29883, 4003, 29913, 448, 4713, 333, 381, 426, 9057, 29918, 3972, 29913, 13, 7241, 13, 9651, 5124, 1642, 4830, 29898, 1068, 9057, 29918, 8977, 29897, 13, 9651, 714, 1445, 353, 1722, 877, 29950, 1525, 5773, 29918, 3389, 29889, 845, 742, 525, 29893, 1495, 13, 9651, 714, 1445, 29889, 3539, 29898, 726, 29897, 13, 13, 9651, 565, 1014, 1275, 525, 3582, 2396, 13, 18884, 2897, 29889, 5205, 877, 29879, 16175, 379, 1525, 5773, 29918, 3389, 29889, 845, 1495, 13, 18884, 1596, 877, 11947, 18397, 29991, 1495, 13, 9651, 25342, 1014, 1275, 525, 1217, 2396, 13, 18884, 1209, 13, 9651, 1683, 29901, 29871, 13, 18884, 1596, 877, 2392, 29901, 9178, 1881, 363, 278, 1139, 29901, 1938, 366, 864, 304, 9752, 278, 4982, 29973, 313, 3582, 29914, 1217, 467, 1495, 13, 308, 13, 4706, 565, 379, 9026, 1275, 525, 29933, 2429, 2710, 29915, 470, 379, 9026, 1275, 525, 19515, 2710, 2396, 13, 9651, 1426, 353, 9995, 29937, 14708, 2109, 29914, 845, 13, 29937, 1744, 14789, 448, 29940, 426, 18010, 29913, 13, 29937, 1744, 14789, 448, 29886, 390, 29924, 13, 29937, 1744, 14789, 448, 29873, 426, 3601, 329, 603, 6177, 29900, 29900, 29901, 29900, 29900, 13, 29937, 1744, 14789, 1192, 593, 1278, 29879, 29899, 546, 29899, 3177, 3790, 7662, 29899, 546, 29899, 18010, 29913, 13, 13, 5453, 2254, 330, 456, 16815, 29914, 29906, 29900, 29896, 29947, 29918, 21970, 13, 5453, 2254, 286, 1631, 29914, 524, 295, 29918, 1526, 29875, 13, 13, 29937, 5609, 438, 3580, 29918, 13967, 29918, 4690, 16310, 29903, 29922, 29906, 29946, 13, 13, 29879, 16175, 379, 1525, 5773, 29918, 3389, 29889, 845, 448, 29881, 29922, 7045, 554, 17178, 12750, 4574, 29924, 29918, 29967, 14824, 29918, 1367, 13, 361, 518, 448, 29888, 2106, 29918, 29900, 19248, 13506, 1836, 29883, 415, 12940, 769, 13, 1678, 22326, 381, 348, 448, 9302, 426, 29940, 29913, 330, 16838, 29918, 1526, 29875, 22821, 3389, 448, 311, 600, 22882, 426, 13506, 29913, 448, 12744, 11671, 426, 13506, 2403, 12744, 11671, 29889, 29916, 29894, 29887, 448, 276, 10709, 29871, 29896, 29900, 29900, 448, 13996, 426, 29940, 29918, 29883, 4003, 29913, 448, 4713, 333, 381, 426, 9057, 29918, 3972, 29913, 448, 29883, 1631, 426, 13506, 1836, 29883, 415, 448, 1217, 4397, 13, 2870, 13, 1678, 22326, 381, 348, 448, 9302, 426, 29940, 29913, 330, 16838, 29918, 1526, 29875, 22821, 3389, 448, 311, 600, 22882, 426, 13506, 29913, 448, 12744, 11671, 426, 13506, 2403, 12744, 11671, 29889, 29916, 29894, 29887, 448, 276, 10709, 29871, 29896, 29900, 29900, 448, 13996, 426, 29940, 29918, 29883, 4003, 29913, 448, 4713, 333, 381, 426, 9057, 29918, 3972, 29913, 13, 7241, 13, 9651, 5124, 1642, 4830, 29898, 1068, 9057, 29918, 8977, 29897, 13, 9651, 714, 1445, 353, 1722, 877, 29950, 1525, 5773, 29918, 3389, 29889, 845, 742, 525, 29893, 1495, 13, 9651, 714, 1445, 29889, 3539, 29898, 726, 29897, 13, 13, 9651, 565, 1014, 1275, 525, 3582, 2396, 13, 18884, 2897, 29889, 5205, 877, 29879, 16175, 379, 1525, 5773, 29918, 3389, 29889, 845, 1495, 13, 18884, 1596, 877, 11947, 18397, 29991, 1495, 13, 9651, 25342, 1014, 1275, 525, 1217, 2396, 13, 18884, 1209, 13, 9651, 1683, 29901, 29871, 13, 18884, 1596, 877, 2392, 29901, 9178, 1881, 363, 278, 1139, 29901, 1938, 366, 864, 304, 9752, 278, 4982, 29973, 313, 3582, 29914, 1217, 467, 1495, 13, 13, 13, 1678, 396, 5399, 565, 599, 278, 2066, 892, 8472, 5759, 13, 1678, 396, 22821, 449, 29889, 3487, 29886, 29892, 349, 12182, 412, 29886, 29955, 29889, 3487, 29886, 29892, 349, 12182, 412, 29886, 29889, 299, 29916, 29892, 349, 12182, 412, 29886, 29955, 29889, 3332, 29892, 349, 12182, 412, 29886, 29955, 29889, 29873, 558, 13, 2 ]
db_interfacer/interfacer.py
VenkatSubramaniam/SDI
0
43758
<reponame>VenkatSubramaniam/SDI #!/usr/bin/env python # coding: utf-8 from typing import Dict import psycopg2 as pg class DBInterfacer: def __init__(self, uname: str, pword: str, db: str, port: str) -> None: self.connection, self.cursor = self._establish_postgres_connection(uname, pword, db, port) def _establish_postgres_connection(self, uname: str, pword: str, db: str, port: str) -> None: try: self._create_db(uname, pword, db, port) connection = pg.connect(user=uname, password=pword, port=port, database=db) # do we have to create this before? The db, I mean. return connection, connection.cursor() except (Exception, psycopg2.Error) as error: raise Exception("We were unsuccessful in connecting to postgres. Are you sure you set up your database as requested?") def commit(self) -> None: self.connection.commit() @staticmethod def _create_db(uname: str, pword: str, db: str, port: str) -> None: with pg.connect(user=uname, password=<PASSWORD>, port=port, database="postgres") as conn: conn.set_isolation_level(pg.extensions.ISOLATION_LEVEL_AUTOCOMMIT) cur = conn.cursor() cur.execute(f"select exists(SELECT datname FROM pg_catalog.pg_database WHERE lower(datname) = lower('{db}'))") if not cur.fetchone()[0]: cur.execute(f"create database {db};") def create_table(self, table: str, schema: Dict[str, str]) -> None: self.cursor.execute(f"create table {table} ({self._parse_schema(schema)});") self.commit() @staticmethod def _parse_schema(schema: Dict[str, str], key: bool=None) -> str: if key: pass #TODO return ", ".join([" ".join(item) for item in schema.items()]) def stringify(self, table:str, row: Dict[str, str], keys: object) -> None: stringify = ["'"+row[key]+"'" for key in keys] query = f"insert into {table} ({', '.join(keys)}) values ({', '.join(stringify)})" self.cursor.execute(query) def insert_row(self, table:str, row: Dict[str, str]) -> None: keys = row.keys() self.cursor.execute(f"insert into {table} ({', '.join(keys)}) values ({', '.join([row[key] for key in keys])})") # try: # self.cursor.execute(f"insert into {table} ({', '.join(keys)}) values ({', '.join([row[key] for key in keys])})") # except: # self.stringify(table, row, keys)
[ 1, 529, 276, 1112, 420, 29958, 29963, 5842, 271, 4035, 2572, 273, 2829, 29914, 29903, 4571, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 3166, 19229, 1053, 360, 919, 13, 5215, 6529, 29891, 9708, 29887, 29906, 408, 23822, 13, 13, 13, 1990, 6535, 4074, 17470, 261, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 443, 420, 29901, 851, 29892, 282, 1742, 29901, 851, 29892, 4833, 29901, 851, 29892, 2011, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 9965, 29892, 1583, 29889, 18127, 353, 1583, 3032, 342, 370, 1674, 29918, 2490, 7201, 29918, 9965, 29898, 348, 420, 29892, 282, 1742, 29892, 4833, 29892, 2011, 29897, 13, 13, 1678, 822, 903, 342, 370, 1674, 29918, 2490, 7201, 29918, 9965, 29898, 1311, 29892, 443, 420, 29901, 851, 29892, 282, 1742, 29901, 851, 29892, 4833, 29901, 851, 29892, 2011, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 3258, 29918, 2585, 29898, 348, 420, 29892, 282, 1742, 29892, 4833, 29892, 2011, 29897, 13, 9651, 3957, 353, 23822, 29889, 6915, 29898, 1792, 29922, 348, 420, 29892, 4800, 29922, 29886, 1742, 29892, 2011, 29922, 637, 29892, 2566, 29922, 2585, 29897, 29871, 396, 437, 591, 505, 304, 1653, 445, 1434, 29973, 450, 4833, 29892, 306, 2099, 29889, 13, 9651, 736, 3957, 29892, 3957, 29889, 18127, 580, 13, 4706, 5174, 313, 2451, 29892, 6529, 29891, 9708, 29887, 29906, 29889, 2392, 29897, 408, 1059, 29901, 13, 9651, 12020, 8960, 703, 4806, 892, 443, 8698, 1319, 297, 16791, 304, 1400, 7201, 29889, 4683, 366, 1854, 366, 731, 701, 596, 2566, 408, 13877, 29973, 1159, 13, 13, 1678, 822, 9063, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 9965, 29889, 15060, 580, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 3258, 29918, 2585, 29898, 348, 420, 29901, 851, 29892, 282, 1742, 29901, 851, 29892, 4833, 29901, 851, 29892, 2011, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 411, 23822, 29889, 6915, 29898, 1792, 29922, 348, 420, 29892, 4800, 29922, 29966, 25711, 17013, 10202, 2011, 29922, 637, 29892, 2566, 543, 2490, 7201, 1159, 408, 11009, 29901, 13, 9651, 11009, 29889, 842, 29918, 275, 22671, 29918, 5563, 29898, 4061, 29889, 24299, 29889, 3235, 5607, 8098, 29918, 1307, 29963, 6670, 29918, 20656, 29949, 3217, 7428, 1806, 29897, 13, 9651, 3151, 353, 11009, 29889, 18127, 580, 13, 13, 9651, 3151, 29889, 7978, 29898, 29888, 29908, 2622, 4864, 29898, 6404, 1418, 978, 3895, 23822, 29918, 28045, 29889, 4061, 29918, 9803, 5754, 5224, 29898, 4130, 978, 29897, 353, 5224, 877, 29912, 2585, 29913, 8785, 1159, 13, 9651, 565, 451, 3151, 29889, 9155, 650, 580, 29961, 29900, 5387, 13, 18884, 3151, 29889, 7978, 29898, 29888, 29908, 3258, 2566, 426, 2585, 3400, 1159, 13, 13, 1678, 822, 1653, 29918, 2371, 29898, 1311, 29892, 1591, 29901, 851, 29892, 10938, 29901, 360, 919, 29961, 710, 29892, 851, 2314, 1599, 6213, 29901, 13, 4706, 1583, 29889, 18127, 29889, 7978, 29898, 29888, 29908, 3258, 1591, 426, 2371, 29913, 21313, 1311, 3032, 5510, 29918, 11010, 29898, 11010, 2915, 416, 1159, 13, 4706, 1583, 29889, 15060, 580, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 5510, 29918, 11010, 29898, 11010, 29901, 360, 919, 29961, 710, 29892, 851, 1402, 1820, 29901, 6120, 29922, 8516, 29897, 1599, 851, 29901, 13, 4706, 565, 1820, 29901, 13, 9651, 1209, 396, 4986, 3970, 13, 4706, 736, 9162, 11393, 7122, 29898, 3366, 11393, 7122, 29898, 667, 29897, 363, 2944, 297, 10938, 29889, 7076, 580, 2314, 13, 13, 1678, 822, 1347, 1598, 29898, 1311, 29892, 1591, 29901, 710, 29892, 1948, 29901, 360, 919, 29961, 710, 29892, 851, 1402, 6611, 29901, 1203, 29897, 1599, 6213, 29901, 13, 4706, 1347, 1598, 353, 6796, 11838, 29974, 798, 29961, 1989, 10062, 29908, 11838, 363, 1820, 297, 6611, 29962, 13, 4706, 2346, 353, 285, 29908, 7851, 964, 426, 2371, 29913, 21313, 742, 15300, 7122, 29898, 8149, 26972, 1819, 21313, 742, 15300, 7122, 29898, 22070, 26972, 29908, 13, 4706, 1583, 29889, 18127, 29889, 7978, 29898, 1972, 29897, 13, 268, 13, 1678, 822, 4635, 29918, 798, 29898, 1311, 29892, 1591, 29901, 710, 29892, 1948, 29901, 360, 919, 29961, 710, 29892, 851, 2314, 1599, 6213, 29901, 13, 4706, 6611, 353, 1948, 29889, 8149, 580, 13, 4706, 1583, 29889, 18127, 29889, 7978, 29898, 29888, 29908, 7851, 964, 426, 2371, 29913, 21313, 742, 15300, 7122, 29898, 8149, 26972, 1819, 21313, 742, 15300, 7122, 4197, 798, 29961, 1989, 29962, 363, 1820, 297, 6611, 2314, 1800, 1159, 13, 4706, 396, 1018, 29901, 13, 4706, 396, 268, 1583, 29889, 18127, 29889, 7978, 29898, 29888, 29908, 7851, 964, 426, 2371, 29913, 21313, 742, 15300, 7122, 29898, 8149, 26972, 1819, 21313, 742, 15300, 7122, 4197, 798, 29961, 1989, 29962, 363, 1820, 297, 6611, 2314, 1800, 1159, 13, 4706, 396, 5174, 29901, 13, 4706, 396, 268, 1583, 29889, 22070, 29898, 2371, 29892, 1948, 29892, 6611, 29897, 13, 2 ]
twitcher/owsproxy.py
Ouranosinc/twitcher
0
64226
""" The owsproxy is based on `papyrus_ogcproxy <https://github.com/elemoine/papyrus_ogcproxy>`_ See also: https://github.com/nive/outpost/blob/master/outpost/proxy.py """ import urllib import requests from pyramid.response import Response from pyramid.settings import asbool from twitcher._compat import urlparse from twitcher.owsexceptions import OWSAccessForbidden, OWSAccessFailed from twitcher.utils import replace_caps_url from twitcher.store import servicestore_factory import logging LOGGER = logging.getLogger(__name__) allowed_content_types = ( "application/xml", # XML "text/xml", "text/xml;charset=ISO-8859-1" "application/vnd.ogc.se_xml", # OGC Service Exception "application/vnd.ogc.se+xml", # OGC Service Exception # "application/vnd.ogc.success+xml", # OGC Success (SLD Put) "application/vnd.ogc.wms_xml", # WMS Capabilities # "application/vnd.ogc.gml", # GML # "application/vnd.ogc.sld+xml", # SLD "application/vnd.google-earth.kml+xml", # KML "application/vnd.google-earth.kmz", "image/png", # PNG "image/png;mode=32bit", "image/gif", # GIF "image/jpeg", # JPEG "application/json", # JSON "application/json;charset=ISO-8859-1", ) # TODO: configure allowed hosts allowed_hosts = ( # list allowed hosts here (no port limiting) # "localhost", ) # requests.models.Reponse defaults its chunk size to 128 bytes, which is very slow class BufferedResponse(): def __init__(self, resp): self.resp = resp def __iter__(self): return self.resp.iter_content(64 * 1024) def _send_request(request, service, extra_path=None, request_params=None): # TODO: fix way to build url url = service['url'] if extra_path: url += '/' + extra_path if request_params: url += '?' + request_params LOGGER.debug('url = %s', url) # forward request to target (without Host Header) h = dict(request.headers) h.pop("Host", h) h['Accept-Encoding'] = None # service_type = service['type'] if service_type and (service_type.lower() != 'wps'): try: resp_iter = requests.request(method=request.method.upper(), url=url, data=request.body, headers=h, stream=True) except Exception as e: return OWSAccessFailed("Request failed: {}".format(e.message)) # Headers meaningful only for a single transport-level connection HopbyHop = ['Connection', 'Keep-Alive', 'Public', 'Proxy-Authenticate', 'Transfer-Encoding', 'Upgrade'] return Response(app_iter=BufferedResponse(resp_iter), headers={k: v for k, v in resp_iter.headers.iteritems() if k not in HopbyHop}) else: try: resp = requests.request(method=request.method.upper(), url=url, data=request.body, headers=h) except Exception, e: return OWSAccessFailed("Request failed: {}".format(e.message)) if resp.ok is False: if 'ExceptionReport' in resp.content: pass else: return OWSAccessFailed("Response is not ok: {}".format(resp.reason)) # check for allowed content types ct = None # LOGGER.debug("headers=", resp.headers) if "Content-Type" in resp.headers: ct = resp.headers["Content-Type"] if not ct.split(";")[0] in allowed_content_types: msg = "Content type is not allowed: {}.".format(ct) LOGGER.error(msg) return OWSAccessForbidden(msg) else: # return OWSAccessFailed("Could not get content type from response.") LOGGER.warn("Could not get content type from response") try: if ct in ['text/xml', 'application/xml', 'text/xml;charset=ISO-8859-1']: # replace urls in xml content proxy_url = request.route_url('owsproxy', service_name=service['name']) # TODO: where do i need to replace urls? content = replace_caps_url(resp.content, proxy_url, service.get('url')) else: # raw content content = resp.content except Exception: return OWSAccessFailed("Could not decode content.") headers = {} if ct: headers["Content-Type"] = ct return Response(content, status=resp.status_code, headers=headers) def owsproxy_url(request): url = request.params.get("url") if url is None: return OWSAccessFailed("URL param is missing.") service_type = request.GET.get('service', 'wps') or request.GET.get('SERVICE', 'wps') # check for full url parsed_url = urlparse(url) if not parsed_url.netloc or parsed_url.scheme not in ("http", "https"): return OWSAccessFailed("Not a valid URL.") return _send_request(request, service=dict(url=url, name='external', service_type=service_type)) def owsproxy(request): """ TODO: use ows exceptions """ try: service_name = request.matchdict.get('service_name') extra_path = request.matchdict.get('extra_path') store = servicestore_factory(request.registry) service = store.fetch_by_name(service_name) except Exception as err: return OWSAccessFailed("Could not find service: {}.".format(err.message)) else: return _send_request(request, service, extra_path, request_params=request.query_string) def owsproxy_delegate(request): """ Delegates owsproxy request to external twitcher service. """ twitcher_url = request.registry.settings.get('twitcher.url') protected_path = request.registry.settings.get('twitcher.ows_proxy_protected_path', '/ows') url = twitcher_url + protected_path + '/proxy' if request.matchdict.get('service_name'): url += '/' + request.matchdict.get('service_name') if request.matchdict.get('access_token'): url += '/' + request.matchdict.get('service_name') url += '?' + urllib.urlencode(request.params) LOGGER.debug("delegate to owsproxy: %s", url) # forward request to target (without Host Header) # h = dict(request.headers) # h.pop("Host", h) resp = requests.request(method=request.method.upper(), url=url, data=request.body, headers=request.headers, verify=False) return Response(resp.content, status=resp.status_code, headers=resp.headers) def includeme(config): settings = config.registry.settings protected_path = settings.get('twitcher.ows_proxy_protected_path', '/ows') if asbool(settings.get('twitcher.ows_proxy', True)): LOGGER.debug('Twitcher {}/proxy enabled.'.format(protected_path)) config.add_route('owsproxy', protected_path + '/proxy/{service_name}') # TODO: maybe configure extra path config.add_route('owsproxy_extra', protected_path + '/proxy/{service_name}/{extra_path:.*}') config.add_route('owsproxy_secured', protected_path + '/proxy/{service_name}/{access_token}') # use delegation mode? if asbool(settings.get('twitcher.ows_proxy_delegate', False)): LOGGER.debug('Twitcher {}/proxy delegation mode enabled.'.format(protected_path)) config.add_view(owsproxy_delegate, route_name='owsproxy') config.add_view(owsproxy_delegate, route_name='owsproxy_secured') else: # include twitcher config config.include('twitcher.config') # include mongodb config.include('twitcher.db') config.add_view(owsproxy, route_name='owsproxy') config.add_view(owsproxy, route_name='owsproxy_secured') config.add_view(owsproxy, route_name='owsproxy_extra') # use /owsproxy? if asbool(settings.get('twitcher.ows_proxy_url', True)): LOGGER.debug('Twitcher /owsproxy enabled.') config.add_route('owsproxy_url', '/owsproxy') config.add_view(owsproxy_url, route_name='owsproxy_url')
[ 1, 9995, 13, 1576, 288, 5652, 14701, 338, 2729, 373, 421, 29886, 481, 29646, 29918, 468, 29883, 14701, 529, 991, 597, 3292, 29889, 510, 29914, 20461, 29877, 457, 29914, 29886, 481, 29646, 29918, 468, 29883, 14701, 13885, 29918, 13, 13, 13393, 884, 29901, 2045, 597, 3292, 29889, 510, 29914, 29876, 573, 29914, 449, 2490, 29914, 10054, 29914, 6207, 29914, 449, 2490, 29914, 14701, 29889, 2272, 13, 15945, 29908, 13, 13, 5215, 3142, 1982, 13, 5215, 7274, 13, 13, 3166, 11451, 2572, 333, 29889, 5327, 1053, 13291, 13, 3166, 11451, 2572, 333, 29889, 11027, 1053, 408, 11227, 13, 13, 3166, 3252, 2335, 261, 3032, 12667, 1053, 3142, 5510, 13, 13, 3166, 3252, 2335, 261, 29889, 340, 14167, 1441, 29879, 1053, 438, 7811, 6638, 2831, 29890, 4215, 29892, 438, 7811, 6638, 17776, 13, 3166, 3252, 2335, 261, 29889, 13239, 1053, 5191, 29918, 29883, 2547, 29918, 2271, 13, 3166, 3252, 2335, 261, 29889, 8899, 1053, 3348, 293, 22818, 29918, 14399, 13, 13, 13, 5215, 12183, 13, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 24622, 29918, 3051, 29918, 8768, 353, 313, 13, 1678, 376, 6214, 29914, 3134, 613, 462, 539, 396, 6560, 13, 1678, 376, 726, 29914, 3134, 613, 13, 1678, 376, 726, 29914, 3134, 29936, 3090, 842, 29922, 29096, 29899, 29947, 29947, 29945, 29929, 29899, 29896, 29908, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 344, 29918, 3134, 613, 9651, 396, 438, 8766, 6692, 8960, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 344, 29974, 3134, 613, 9651, 396, 438, 8766, 6692, 8960, 13, 1678, 396, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 8698, 29974, 3134, 613, 418, 396, 438, 8766, 21397, 313, 29903, 10249, 12065, 29897, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 29893, 1516, 29918, 3134, 613, 965, 396, 399, 4345, 5915, 11614, 13, 1678, 396, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 29887, 828, 613, 795, 396, 402, 1988, 13, 1678, 396, 376, 6214, 29914, 29894, 299, 29889, 468, 29883, 29889, 29879, 430, 29974, 3134, 613, 3986, 396, 317, 10249, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 799, 386, 29889, 29895, 828, 29974, 3134, 613, 29871, 396, 476, 1988, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 799, 386, 29889, 8848, 29920, 613, 13, 1678, 376, 3027, 29914, 2732, 613, 462, 632, 396, 349, 9312, 13, 1678, 376, 3027, 29914, 2732, 29936, 8513, 29922, 29941, 29906, 2966, 613, 13, 1678, 376, 3027, 29914, 18660, 613, 462, 632, 396, 402, 6545, 13, 1678, 376, 3027, 29914, 26568, 613, 462, 9651, 396, 435, 4162, 29954, 13, 1678, 376, 6214, 29914, 3126, 613, 462, 418, 396, 4663, 13, 1678, 376, 6214, 29914, 3126, 29936, 3090, 842, 29922, 29096, 29899, 29947, 29947, 29945, 29929, 29899, 29896, 613, 13, 29897, 13, 13, 29937, 14402, 29901, 10822, 6068, 18982, 13, 24622, 29918, 23525, 353, 313, 13, 1678, 396, 1051, 6068, 18982, 1244, 313, 1217, 2011, 4046, 292, 29897, 13, 1678, 396, 376, 7640, 613, 13, 29897, 13, 13, 13, 29937, 7274, 29889, 9794, 29889, 5612, 265, 344, 21274, 967, 19875, 2159, 304, 29871, 29896, 29906, 29947, 6262, 29892, 607, 338, 1407, 5232, 13, 1990, 22217, 5103, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4613, 1125, 13, 4706, 1583, 29889, 13713, 353, 4613, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 13713, 29889, 1524, 29918, 3051, 29898, 29953, 29946, 334, 29871, 29896, 29900, 29906, 29946, 29897, 13, 13, 13, 1753, 903, 6717, 29918, 3827, 29898, 3827, 29892, 2669, 29892, 4805, 29918, 2084, 29922, 8516, 29892, 2009, 29918, 7529, 29922, 8516, 1125, 13, 13, 1678, 396, 14402, 29901, 2329, 982, 304, 2048, 3142, 13, 1678, 3142, 353, 2669, 1839, 2271, 2033, 13, 1678, 565, 4805, 29918, 2084, 29901, 13, 4706, 3142, 4619, 8207, 29915, 718, 4805, 29918, 2084, 13, 1678, 565, 2009, 29918, 7529, 29901, 13, 4706, 3142, 4619, 525, 17901, 718, 2009, 29918, 7529, 13, 1678, 25401, 17070, 29889, 8382, 877, 2271, 353, 1273, 29879, 742, 3142, 29897, 13, 13, 1678, 396, 6375, 2009, 304, 3646, 313, 14037, 16956, 19345, 29897, 13, 1678, 298, 353, 9657, 29898, 3827, 29889, 13662, 29897, 13, 1678, 298, 29889, 7323, 703, 8514, 613, 298, 29897, 13, 1678, 298, 1839, 23965, 29899, 14934, 2033, 353, 6213, 13, 13, 1678, 396, 13, 1678, 2669, 29918, 1853, 353, 2669, 1839, 1853, 2033, 13, 1678, 565, 2669, 29918, 1853, 322, 313, 5509, 29918, 1853, 29889, 13609, 580, 2804, 525, 29893, 567, 29374, 13, 4706, 1018, 29901, 13, 9651, 4613, 29918, 1524, 353, 7274, 29889, 3827, 29898, 5696, 29922, 3827, 29889, 5696, 29889, 21064, 3285, 3142, 29922, 2271, 29892, 848, 29922, 3827, 29889, 2587, 29892, 9066, 29922, 29882, 29892, 13, 462, 462, 308, 4840, 29922, 5574, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 736, 438, 7811, 6638, 17776, 703, 3089, 5229, 29901, 6571, 1642, 4830, 29898, 29872, 29889, 4906, 876, 13, 13, 4706, 396, 12252, 414, 6593, 1319, 871, 363, 263, 2323, 8608, 29899, 5563, 3957, 13, 4706, 20727, 1609, 29950, 459, 353, 6024, 5350, 742, 525, 9598, 1022, 29899, 29909, 9258, 742, 525, 19858, 742, 525, 14048, 29899, 6444, 4173, 403, 742, 525, 4300, 571, 29899, 14934, 742, 525, 3373, 8228, 2033, 13, 4706, 736, 13291, 29898, 932, 29918, 1524, 29922, 7701, 287, 5103, 29898, 13713, 29918, 1524, 511, 13, 462, 4706, 9066, 3790, 29895, 29901, 325, 363, 413, 29892, 325, 297, 4613, 29918, 1524, 29889, 13662, 29889, 1524, 7076, 580, 565, 413, 451, 297, 20727, 1609, 29950, 459, 1800, 13, 1678, 1683, 29901, 13, 4706, 1018, 29901, 13, 9651, 4613, 353, 7274, 29889, 3827, 29898, 5696, 29922, 3827, 29889, 5696, 29889, 21064, 3285, 3142, 29922, 2271, 29892, 848, 29922, 3827, 29889, 2587, 29892, 9066, 29922, 29882, 29897, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 9651, 736, 438, 7811, 6638, 17776, 703, 3089, 5229, 29901, 6571, 1642, 4830, 29898, 29872, 29889, 4906, 876, 13, 13, 4706, 565, 4613, 29889, 554, 338, 7700, 29901, 13, 9651, 565, 525, 2451, 13020, 29915, 297, 4613, 29889, 3051, 29901, 13, 18884, 1209, 13, 9651, 1683, 29901, 13, 18884, 736, 438, 7811, 6638, 17776, 703, 5103, 338, 451, 3431, 29901, 6571, 1642, 4830, 29898, 13713, 29889, 23147, 876, 13, 13, 4706, 396, 1423, 363, 6068, 2793, 4072, 13, 4706, 274, 29873, 353, 6213, 13, 4706, 396, 25401, 17070, 29889, 8382, 703, 13662, 543, 29892, 4613, 29889, 13662, 29897, 13, 4706, 565, 376, 3916, 29899, 1542, 29908, 297, 4613, 29889, 13662, 29901, 13, 9651, 274, 29873, 353, 4613, 29889, 13662, 3366, 3916, 29899, 1542, 3108, 13, 9651, 565, 451, 274, 29873, 29889, 5451, 703, 29936, 1159, 29961, 29900, 29962, 297, 6068, 29918, 3051, 29918, 8768, 29901, 13, 18884, 10191, 353, 376, 3916, 1134, 338, 451, 6068, 29901, 6571, 1213, 29889, 4830, 29898, 312, 29897, 13, 18884, 25401, 17070, 29889, 2704, 29898, 7645, 29897, 13, 18884, 736, 438, 7811, 6638, 2831, 29890, 4215, 29898, 7645, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 736, 438, 7811, 6638, 17776, 703, 23323, 451, 679, 2793, 1134, 515, 2933, 23157, 13, 9651, 25401, 17070, 29889, 25442, 703, 23323, 451, 679, 2793, 1134, 515, 2933, 1159, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 274, 29873, 297, 6024, 726, 29914, 3134, 742, 525, 6214, 29914, 3134, 742, 525, 726, 29914, 3134, 29936, 3090, 842, 29922, 29096, 29899, 29947, 29947, 29945, 29929, 29899, 29896, 2033, 29901, 13, 18884, 396, 5191, 23942, 297, 4903, 2793, 13, 18884, 10166, 29918, 2271, 353, 2009, 29889, 13134, 29918, 2271, 877, 1242, 14701, 742, 2669, 29918, 978, 29922, 5509, 1839, 978, 11287, 13, 18884, 396, 14402, 29901, 988, 437, 474, 817, 304, 5191, 23942, 29973, 13, 18884, 2793, 353, 5191, 29918, 29883, 2547, 29918, 2271, 29898, 13713, 29889, 3051, 29892, 10166, 29918, 2271, 29892, 2669, 29889, 657, 877, 2271, 8785, 13, 9651, 1683, 29901, 13, 18884, 396, 10650, 2793, 13, 18884, 2793, 353, 4613, 29889, 3051, 13, 4706, 5174, 8960, 29901, 13, 9651, 736, 438, 7811, 6638, 17776, 703, 23323, 451, 21822, 2793, 23157, 13, 13, 4706, 9066, 353, 6571, 13, 4706, 565, 274, 29873, 29901, 13, 9651, 9066, 3366, 3916, 29899, 1542, 3108, 353, 274, 29873, 13, 4706, 736, 13291, 29898, 3051, 29892, 4660, 29922, 13713, 29889, 4882, 29918, 401, 29892, 9066, 29922, 13662, 29897, 13, 13, 13, 1753, 288, 5652, 14701, 29918, 2271, 29898, 3827, 1125, 13, 1678, 3142, 353, 2009, 29889, 7529, 29889, 657, 703, 2271, 1159, 13, 1678, 565, 3142, 338, 6213, 29901, 13, 4706, 736, 438, 7811, 6638, 17776, 703, 4219, 1828, 338, 4567, 23157, 13, 13, 1678, 2669, 29918, 1853, 353, 2009, 29889, 7194, 29889, 657, 877, 5509, 742, 525, 29893, 567, 1495, 470, 2009, 29889, 7194, 29889, 657, 877, 6304, 19059, 742, 525, 29893, 567, 1495, 13, 1678, 396, 1423, 363, 2989, 3142, 13, 1678, 21213, 29918, 2271, 353, 3142, 5510, 29898, 2271, 29897, 13, 1678, 565, 451, 21213, 29918, 2271, 29889, 1212, 2029, 470, 21213, 29918, 2271, 29889, 816, 2004, 451, 297, 4852, 1124, 613, 376, 991, 29908, 1125, 13, 4706, 736, 438, 7811, 6638, 17776, 703, 3664, 263, 2854, 3988, 23157, 13, 1678, 736, 903, 6717, 29918, 3827, 29898, 3827, 29892, 2669, 29922, 8977, 29898, 2271, 29922, 2271, 29892, 1024, 2433, 23176, 742, 2669, 29918, 1853, 29922, 5509, 29918, 1853, 876, 13, 13, 13, 1753, 288, 5652, 14701, 29898, 3827, 1125, 13, 1678, 9995, 13, 1678, 14402, 29901, 671, 288, 5652, 15283, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 2669, 29918, 978, 353, 2009, 29889, 4352, 8977, 29889, 657, 877, 5509, 29918, 978, 1495, 13, 4706, 4805, 29918, 2084, 353, 2009, 29889, 4352, 8977, 29889, 657, 877, 17833, 29918, 2084, 1495, 13, 4706, 3787, 353, 3348, 293, 22818, 29918, 14399, 29898, 3827, 29889, 1727, 6020, 29897, 13, 4706, 2669, 353, 3787, 29889, 9155, 29918, 1609, 29918, 978, 29898, 5509, 29918, 978, 29897, 13, 1678, 5174, 8960, 408, 4589, 29901, 13, 4706, 736, 438, 7811, 6638, 17776, 703, 23323, 451, 1284, 2669, 29901, 6571, 1213, 29889, 4830, 29898, 3127, 29889, 4906, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 903, 6717, 29918, 3827, 29898, 3827, 29892, 2669, 29892, 4805, 29918, 2084, 29892, 2009, 29918, 7529, 29922, 3827, 29889, 1972, 29918, 1807, 29897, 13, 13, 13, 1753, 288, 5652, 14701, 29918, 21234, 29898, 3827, 1125, 13, 1678, 9995, 13, 1678, 897, 1397, 1078, 288, 5652, 14701, 2009, 304, 7029, 3252, 2335, 261, 2669, 29889, 13, 1678, 9995, 13, 1678, 3252, 2335, 261, 29918, 2271, 353, 2009, 29889, 1727, 6020, 29889, 11027, 29889, 657, 877, 7516, 2335, 261, 29889, 2271, 1495, 13, 1678, 6364, 29918, 2084, 353, 2009, 29889, 1727, 6020, 29889, 11027, 29889, 657, 877, 7516, 2335, 261, 29889, 1242, 29918, 14701, 29918, 24681, 29918, 2084, 742, 8207, 1242, 1495, 13, 1678, 3142, 353, 3252, 2335, 261, 29918, 2271, 718, 6364, 29918, 2084, 718, 8207, 14701, 29915, 13, 1678, 565, 2009, 29889, 4352, 8977, 29889, 657, 877, 5509, 29918, 978, 29374, 13, 4706, 3142, 4619, 8207, 29915, 718, 2009, 29889, 4352, 8977, 29889, 657, 877, 5509, 29918, 978, 1495, 13, 4706, 565, 2009, 29889, 4352, 8977, 29889, 657, 877, 5943, 29918, 6979, 29374, 13, 9651, 3142, 4619, 8207, 29915, 718, 2009, 29889, 4352, 8977, 29889, 657, 877, 5509, 29918, 978, 1495, 13, 1678, 3142, 4619, 525, 17901, 718, 3142, 1982, 29889, 2271, 12508, 29898, 3827, 29889, 7529, 29897, 13, 1678, 25401, 17070, 29889, 8382, 703, 21234, 304, 288, 5652, 14701, 29901, 1273, 29879, 613, 3142, 29897, 13, 1678, 396, 6375, 2009, 304, 3646, 313, 14037, 16956, 19345, 29897, 13, 1678, 396, 298, 353, 9657, 29898, 3827, 29889, 13662, 29897, 13, 1678, 396, 298, 29889, 7323, 703, 8514, 613, 298, 29897, 13, 1678, 4613, 353, 7274, 29889, 3827, 29898, 5696, 29922, 3827, 29889, 5696, 29889, 21064, 3285, 3142, 29922, 2271, 29892, 848, 29922, 3827, 29889, 2587, 29892, 13, 462, 9651, 9066, 29922, 3827, 29889, 13662, 29892, 11539, 29922, 8824, 29897, 13, 1678, 736, 13291, 29898, 13713, 29889, 3051, 29892, 4660, 29922, 13713, 29889, 4882, 29918, 401, 29892, 9066, 29922, 13713, 29889, 13662, 29897, 13, 13, 13, 1753, 3160, 1004, 29898, 2917, 1125, 13, 1678, 6055, 353, 2295, 29889, 1727, 6020, 29889, 11027, 13, 1678, 6364, 29918, 2084, 353, 6055, 29889, 657, 877, 7516, 2335, 261, 29889, 1242, 29918, 14701, 29918, 24681, 29918, 2084, 742, 8207, 1242, 1495, 13, 1678, 565, 408, 11227, 29898, 11027, 29889, 657, 877, 7516, 2335, 261, 29889, 1242, 29918, 14701, 742, 5852, 22164, 13, 4706, 25401, 17070, 29889, 8382, 877, 27418, 2335, 261, 6571, 29914, 14701, 9615, 29889, 4286, 4830, 29898, 24681, 29918, 2084, 876, 13, 13, 4706, 2295, 29889, 1202, 29918, 13134, 877, 1242, 14701, 742, 6364, 29918, 2084, 718, 8207, 14701, 19248, 5509, 29918, 978, 29913, 1495, 13, 4706, 396, 14402, 29901, 5505, 10822, 4805, 2224, 13, 4706, 2295, 29889, 1202, 29918, 13134, 877, 1242, 14701, 29918, 17833, 742, 6364, 29918, 2084, 718, 8207, 14701, 19248, 5509, 29918, 978, 6822, 29912, 17833, 29918, 2084, 29901, 29889, 4044, 1495, 13, 4706, 2295, 29889, 1202, 29918, 13134, 877, 1242, 14701, 29918, 3471, 2955, 742, 6364, 29918, 2084, 718, 8207, 14701, 19248, 5509, 29918, 978, 6822, 29912, 5943, 29918, 6979, 29913, 1495, 13, 13, 4706, 396, 671, 16000, 362, 4464, 29973, 13, 4706, 565, 408, 11227, 29898, 11027, 29889, 657, 877, 7516, 2335, 261, 29889, 1242, 29918, 14701, 29918, 21234, 742, 7700, 22164, 13, 9651, 25401, 17070, 29889, 8382, 877, 27418, 2335, 261, 6571, 29914, 14701, 16000, 362, 4464, 9615, 29889, 4286, 4830, 29898, 24681, 29918, 2084, 876, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29918, 21234, 29892, 5782, 29918, 978, 2433, 1242, 14701, 1495, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29918, 21234, 29892, 5782, 29918, 978, 2433, 1242, 14701, 29918, 3471, 2955, 1495, 13, 4706, 1683, 29901, 13, 9651, 396, 3160, 3252, 2335, 261, 2295, 13, 9651, 2295, 29889, 2856, 877, 7516, 2335, 261, 29889, 2917, 1495, 13, 9651, 396, 3160, 23290, 13, 9651, 2295, 29889, 2856, 877, 7516, 2335, 261, 29889, 2585, 1495, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29892, 5782, 29918, 978, 2433, 1242, 14701, 1495, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29892, 5782, 29918, 978, 2433, 1242, 14701, 29918, 3471, 2955, 1495, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29892, 5782, 29918, 978, 2433, 1242, 14701, 29918, 17833, 1495, 13, 4706, 396, 671, 847, 1242, 14701, 29973, 13, 4706, 565, 408, 11227, 29898, 11027, 29889, 657, 877, 7516, 2335, 261, 29889, 1242, 29918, 14701, 29918, 2271, 742, 5852, 22164, 13, 9651, 25401, 17070, 29889, 8382, 877, 27418, 2335, 261, 847, 1242, 14701, 9615, 29889, 1495, 13, 9651, 2295, 29889, 1202, 29918, 13134, 877, 1242, 14701, 29918, 2271, 742, 8207, 1242, 14701, 1495, 13, 9651, 2295, 29889, 1202, 29918, 1493, 29898, 1242, 14701, 29918, 2271, 29892, 5782, 29918, 978, 2433, 1242, 14701, 29918, 2271, 1495, 13, 2 ]
experiments/2d_shallowwater/gen.py
flabowski/POD-UQNN
15
13884
<gh_stars>10-100 """POD-NN modeling for 1D, unsteady Burger Equation.""" #%% Imports import sys import os import pickle import numpy as np sys.path.append(os.path.join("..", "..")) from poduqnn.podnnmodel import PodnnModel from poduqnn.mesh import read_multi_space_sol_input_mesh from poduqnn.handling import clean_dir, split_dataset from hyperparams import HP as hp resdir = "cache" clean_dir(resdir) # Getting data from the files # fake_x = np.zeros(hp["n_s"] + hp["n_s_tst"]) # test_size = hp["n_s_tst"] / (hp["n_s"] + hp["n_s_tst"]) # train_tst_idx = split_dataset(fake_x, fake_x, test_size, idx_only=True) train_tst_idx = ([129, 13, 161, 10, 3, 4, 68, 19, 108, 63, 62, 147, 117, 113, 165, 80, 124, 33, 41, 37, 79, 184, 154, 83, 102, 190, 195, 148, 46, 114, 16, 155, 121, 104, 120, 58, 53, 78, 160, 193, 126, 115, 95, 127, 166, 131, 49, 100, 84, 35, 12, 27, 118, 167, 66, 56, 106, 175, 143, 97, 87, 1, 183, 111, 36, 158, 153, 199, 17, 31, 177, 194, 182, 59, 187, 130, 163, 92, 48, 96, 82, 6, 123, 98, 192, 43, 26, 181, 170, 134, 72, 50, 24, 174, 122, 103, 71, 138, 110, 7, 65, 51, 28, 173, 172, 34, 90, 119, 185, 15, 186, 101, 85, 60, 75, 39, 38, 5, 141, 89, 57, 144, 64, 67, 171, 157, 94, 70, 142, 54, 74, 146, 191, 112, 107, 189, 30, 32, 133, 169, 151, 23, 21, 99, 2, 22, 116, 91, 145, 178, 137, 135, 40, 73, 47, 52, 25, 93, 128, 88, 109, 44, 29, 198, 159, 125, 11, 45, 197, 149, 69, 188, 164, 0, 18, 176, 9, 168, 77, 132], [76, 42, 179, 61, 105, 136, 86, 196, 8, 14, 139, 20, 150, 152, 180, 162, 140, 81, 55, 156]) with open(os.path.join("cache", "train_tst_idx.pkl"), "wb") as f: pickle.dump(train_tst_idx, f) datadir = "data" mu_path = os.path.join(datadir, "INPUT_MONTE_CARLO.dat") # x_mesh, connectivity, X_v, U = \ # read_multi_space_sol_input_mesh(hp["n_s"], 1, 1, train_tst_idx[0], # hp["mesh_idx"], datadir, mu_path, # hp["mu_idx"]) # np.save(os.path.join("cache", "x_mesh.npy"), x_mesh) # np.save(os.path.join("cache", "connectivity.npy"), connectivity) # np.save(os.path.join("cache", "X_v.npy"), X_v) # np.save(os.path.join("cache", "U.npy"), U) x_mesh = np.load(os.path.join("cache", "x_mesh.npy")) connectivity = np.load(os.path.join("cache", "connectivity.npy")) X_v = np.load(os.path.join("cache", "X_v.npy")) U = np.load(os.path.join("cache", "U.npy")) # x_mesh = np.load(os.path.join("cache", "x_mesh.npy")) # connectivity = np.load(os.path.join("cache", "connectivity.npy")) # X_v = np.load(os.path.join("cache", "X_v.npy")) # U = np.load(os.path.join("cache", "U.npy")) #%% Init the model model = PodnnModel(resdir, hp["n_v"], x_mesh, hp["n_t"]) #%% Generate the dataset from the mesh and params X_v_train, v_train, \ X_v_val, v_val, \ U_val = model.convert_multigpu_data(U, X_v, hp["train_val"], hp["eps"]) model.initVNNs(hp["n_M"], hp["h_layers"], hp["lr"], hp["lambda"], hp["adv_eps"], hp["soft_0"], hp["norm"])
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 15945, 29908, 13152, 29928, 29899, 10262, 1904, 292, 363, 29871, 29896, 29928, 29892, 443, 303, 1479, 29891, 6640, 914, 11243, 362, 1213, 15945, 13, 29937, 7686, 1954, 4011, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 5839, 280, 13, 5215, 12655, 408, 7442, 13, 13, 9675, 29889, 2084, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 703, 636, 613, 376, 636, 5783, 13, 3166, 2532, 29884, 29939, 15755, 29889, 15334, 15755, 4299, 1053, 8594, 15755, 3195, 13, 3166, 2532, 29884, 29939, 15755, 29889, 4467, 29882, 1053, 1303, 29918, 9910, 29918, 3493, 29918, 2929, 29918, 2080, 29918, 4467, 29882, 13, 3166, 2532, 29884, 29939, 15755, 29889, 3179, 1847, 1053, 5941, 29918, 3972, 29892, 6219, 29918, 24713, 13, 13, 3166, 11266, 7529, 1053, 379, 29925, 408, 298, 29886, 13, 13, 690, 3972, 353, 376, 8173, 29908, 13, 14941, 29918, 3972, 29898, 690, 3972, 29897, 13, 13, 29937, 24162, 848, 515, 278, 2066, 13, 29937, 25713, 29918, 29916, 353, 7442, 29889, 3298, 359, 29898, 28887, 3366, 29876, 29918, 29879, 3108, 718, 298, 29886, 3366, 29876, 29918, 29879, 29918, 29873, 303, 20068, 13, 29937, 1243, 29918, 2311, 353, 298, 29886, 3366, 29876, 29918, 29879, 29918, 29873, 303, 3108, 847, 313, 28887, 3366, 29876, 29918, 29879, 3108, 718, 298, 29886, 3366, 29876, 29918, 29879, 29918, 29873, 303, 20068, 13, 29937, 7945, 29918, 29873, 303, 29918, 13140, 353, 6219, 29918, 24713, 29898, 29888, 1296, 29918, 29916, 29892, 25713, 29918, 29916, 29892, 1243, 29918, 2311, 29892, 22645, 29918, 6194, 29922, 5574, 29897, 13, 14968, 29918, 29873, 303, 29918, 13140, 353, 9310, 29896, 29906, 29929, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29953, 29896, 29892, 29871, 29896, 29900, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29953, 29947, 29892, 29871, 29896, 29929, 29892, 29871, 29896, 29900, 29947, 29892, 29871, 29953, 29941, 29892, 29871, 29953, 29906, 29892, 29871, 29896, 29946, 29955, 29892, 29871, 29896, 29896, 29955, 29892, 29871, 29896, 29896, 29941, 29892, 29871, 29896, 29953, 29945, 29892, 29871, 29947, 29900, 29892, 29871, 29896, 29906, 29946, 29892, 29871, 29941, 29941, 29892, 29871, 29946, 29896, 29892, 29871, 29941, 29955, 29892, 29871, 29955, 29929, 29892, 29871, 29896, 29947, 29946, 29892, 29871, 29896, 29945, 29946, 29892, 29871, 29947, 29941, 29892, 29871, 29896, 29900, 29906, 29892, 29871, 29896, 29929, 29900, 29892, 29871, 29896, 29929, 29945, 29892, 29871, 29896, 29946, 29947, 29892, 29871, 29946, 29953, 29892, 29871, 29896, 29896, 29946, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29945, 29945, 29892, 29871, 29896, 29906, 29896, 29892, 29871, 29896, 29900, 29946, 29892, 29871, 29896, 29906, 29900, 29892, 29871, 29945, 29947, 29892, 29871, 29945, 29941, 29892, 29871, 29955, 29947, 29892, 29871, 29896, 29953, 29900, 29892, 29871, 29896, 29929, 29941, 29892, 29871, 29896, 29906, 29953, 29892, 29871, 29896, 29896, 29945, 29892, 29871, 29929, 29945, 29892, 29871, 29896, 29906, 29955, 29892, 29871, 29896, 29953, 29953, 29892, 29871, 29896, 29941, 29896, 29892, 29871, 29946, 29929, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29947, 29946, 29892, 29871, 29941, 29945, 29892, 29871, 29896, 29906, 29892, 29871, 29906, 29955, 29892, 29871, 29896, 29896, 29947, 29892, 29871, 29896, 29953, 29955, 29892, 29871, 29953, 29953, 29892, 29871, 29945, 29953, 29892, 29871, 29896, 29900, 29953, 29892, 29871, 29896, 29955, 29945, 29892, 29871, 29896, 29946, 29941, 29892, 29871, 29929, 29955, 29892, 29871, 29947, 29955, 29892, 29871, 29896, 29892, 29871, 29896, 29947, 29941, 29892, 29871, 29896, 29896, 29896, 29892, 29871, 29941, 29953, 29892, 29871, 29896, 29945, 29947, 29892, 29871, 29896, 29945, 29941, 29892, 29871, 29896, 29929, 29929, 29892, 29871, 29896, 29955, 29892, 29871, 29941, 29896, 29892, 29871, 29896, 29955, 29955, 29892, 29871, 29896, 29929, 29946, 29892, 29871, 29896, 29947, 29906, 29892, 29871, 29945, 29929, 29892, 29871, 29896, 29947, 29955, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29896, 29953, 29941, 29892, 29871, 29929, 29906, 29892, 29871, 29946, 29947, 29892, 29871, 29929, 29953, 29892, 29871, 29947, 29906, 29892, 29871, 29953, 29892, 29871, 29896, 29906, 29941, 29892, 29871, 29929, 29947, 29892, 29871, 29896, 29929, 29906, 29892, 29871, 29946, 29941, 29892, 29871, 29906, 29953, 29892, 29871, 29896, 29947, 29896, 29892, 29871, 29896, 29955, 29900, 29892, 29871, 29896, 29941, 29946, 29892, 29871, 29955, 29906, 29892, 29871, 29945, 29900, 29892, 29871, 29906, 29946, 29892, 29871, 29896, 29955, 29946, 29892, 29871, 29896, 29906, 29906, 29892, 29871, 29896, 29900, 29941, 29892, 29871, 29955, 29896, 29892, 29871, 29896, 29941, 29947, 29892, 29871, 29896, 29896, 29900, 29892, 29871, 29955, 29892, 29871, 29953, 29945, 29892, 29871, 29945, 29896, 29892, 29871, 29906, 29947, 29892, 29871, 29896, 29955, 29941, 29892, 29871, 29896, 29955, 29906, 29892, 29871, 29941, 29946, 29892, 29871, 29929, 29900, 29892, 29871, 29896, 29896, 29929, 29892, 29871, 29896, 29947, 29945, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29947, 29953, 29892, 29871, 29896, 29900, 29896, 29892, 29871, 29947, 29945, 29892, 29871, 29953, 29900, 29892, 29871, 29955, 29945, 29892, 29871, 29941, 29929, 29892, 29871, 29941, 29947, 29892, 29871, 29945, 29892, 29871, 29896, 29946, 29896, 29892, 29871, 29947, 29929, 29892, 29871, 29945, 29955, 29892, 29871, 29896, 29946, 29946, 29892, 29871, 29953, 29946, 29892, 29871, 29953, 29955, 29892, 29871, 29896, 29955, 29896, 29892, 29871, 29896, 29945, 29955, 29892, 29871, 29929, 29946, 29892, 29871, 29955, 29900, 29892, 29871, 29896, 29946, 29906, 29892, 29871, 29945, 29946, 29892, 29871, 29955, 29946, 29892, 29871, 29896, 29946, 29953, 29892, 29871, 29896, 29929, 29896, 29892, 29871, 29896, 29896, 29906, 29892, 29871, 29896, 29900, 29955, 29892, 29871, 29896, 29947, 29929, 29892, 29871, 29941, 29900, 29892, 29871, 29941, 29906, 29892, 29871, 29896, 29941, 29941, 29892, 29871, 29896, 29953, 29929, 29892, 29871, 29896, 29945, 29896, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29896, 29892, 29871, 29929, 29929, 29892, 29871, 29906, 29892, 29871, 29906, 29906, 29892, 29871, 29896, 29896, 29953, 29892, 29871, 29929, 29896, 29892, 29871, 29896, 29946, 29945, 29892, 29871, 29896, 29955, 29947, 29892, 29871, 29896, 29941, 29955, 29892, 29871, 29896, 29941, 29945, 29892, 29871, 29946, 29900, 29892, 29871, 29955, 29941, 29892, 29871, 29946, 29955, 29892, 29871, 29945, 29906, 29892, 29871, 29906, 29945, 29892, 29871, 29929, 29941, 29892, 29871, 29896, 29906, 29947, 29892, 29871, 29947, 29947, 29892, 29871, 29896, 29900, 29929, 29892, 29871, 29946, 29946, 29892, 29871, 29906, 29929, 29892, 29871, 29896, 29929, 29947, 29892, 29871, 29896, 29945, 29929, 29892, 29871, 29896, 29906, 29945, 29892, 29871, 29896, 29896, 29892, 29871, 29946, 29945, 29892, 29871, 29896, 29929, 29955, 29892, 29871, 29896, 29946, 29929, 29892, 29871, 29953, 29929, 29892, 29871, 29896, 29947, 29947, 29892, 29871, 29896, 29953, 29946, 29892, 29871, 29900, 29892, 29871, 29896, 29947, 29892, 29871, 29896, 29955, 29953, 29892, 29871, 29929, 29892, 29871, 29896, 29953, 29947, 29892, 29871, 29955, 29955, 29892, 29871, 29896, 29941, 29906, 1402, 518, 29955, 29953, 29892, 29871, 29946, 29906, 29892, 29871, 29896, 29955, 29929, 29892, 29871, 29953, 29896, 29892, 29871, 29896, 29900, 29945, 29892, 29871, 29896, 29941, 29953, 29892, 29871, 29947, 29953, 29892, 29871, 29896, 29929, 29953, 29892, 29871, 29947, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29941, 29929, 29892, 29871, 29906, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29945, 29906, 29892, 29871, 29896, 29947, 29900, 29892, 29871, 29896, 29953, 29906, 29892, 29871, 29896, 29946, 29900, 29892, 29871, 29947, 29896, 29892, 29871, 29945, 29945, 29892, 29871, 29896, 29945, 29953, 2314, 13, 2541, 1722, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 14968, 29918, 29873, 303, 29918, 13140, 29889, 29886, 6321, 4968, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 268, 5839, 280, 29889, 15070, 29898, 14968, 29918, 29873, 303, 29918, 13140, 29892, 285, 29897, 13, 13, 4130, 328, 381, 353, 376, 1272, 29908, 13, 2589, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4130, 328, 381, 29892, 376, 1177, 12336, 29918, 22877, 4330, 29918, 29907, 1718, 3927, 29889, 4130, 1159, 13, 29937, 921, 29918, 4467, 29882, 29892, 4511, 2068, 29892, 1060, 29918, 29894, 29892, 501, 353, 320, 13, 29937, 308, 1303, 29918, 9910, 29918, 3493, 29918, 2929, 29918, 2080, 29918, 4467, 29882, 29898, 28887, 3366, 29876, 29918, 29879, 12436, 29871, 29896, 29892, 29871, 29896, 29892, 7945, 29918, 29873, 303, 29918, 13140, 29961, 29900, 1402, 13, 29937, 462, 462, 308, 298, 29886, 3366, 4467, 29882, 29918, 13140, 12436, 1418, 328, 381, 29892, 3887, 29918, 2084, 29892, 13, 29937, 462, 462, 308, 298, 29886, 3366, 2589, 29918, 13140, 20068, 13, 29937, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29916, 29918, 4467, 29882, 29889, 29876, 2272, 4968, 921, 29918, 4467, 29882, 29897, 13, 29937, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 6915, 2068, 29889, 29876, 2272, 4968, 4511, 2068, 29897, 13, 29937, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29990, 29918, 29894, 29889, 29876, 2272, 4968, 1060, 29918, 29894, 29897, 13, 29937, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29965, 29889, 29876, 2272, 4968, 501, 29897, 13, 13, 29916, 29918, 4467, 29882, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29916, 29918, 4467, 29882, 29889, 29876, 2272, 5783, 13, 6915, 2068, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 6915, 2068, 29889, 29876, 2272, 5783, 13, 29990, 29918, 29894, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29990, 29918, 29894, 29889, 29876, 2272, 5783, 13, 29965, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29965, 29889, 29876, 2272, 5783, 13, 13, 13, 29937, 921, 29918, 4467, 29882, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29916, 29918, 4467, 29882, 29889, 29876, 2272, 5783, 13, 29937, 4511, 2068, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 6915, 2068, 29889, 29876, 2272, 5783, 13, 29937, 1060, 29918, 29894, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29990, 29918, 29894, 29889, 29876, 2272, 5783, 13, 29937, 501, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 703, 8173, 613, 376, 29965, 29889, 29876, 2272, 5783, 13, 13, 29937, 7686, 10886, 278, 1904, 13, 4299, 353, 8594, 15755, 3195, 29898, 690, 3972, 29892, 298, 29886, 3366, 29876, 29918, 29894, 12436, 921, 29918, 4467, 29882, 29892, 298, 29886, 3366, 29876, 29918, 29873, 20068, 13, 13, 29937, 7686, 3251, 403, 278, 8783, 515, 278, 27716, 322, 8636, 13, 29990, 29918, 29894, 29918, 14968, 29892, 325, 29918, 14968, 29892, 320, 13, 1678, 1060, 29918, 29894, 29918, 791, 29892, 325, 29918, 791, 29892, 320, 13, 1678, 501, 29918, 791, 353, 1904, 29889, 13441, 29918, 4713, 335, 3746, 29918, 1272, 29898, 29965, 29892, 1060, 29918, 29894, 29892, 298, 29886, 3366, 14968, 29918, 791, 12436, 298, 29886, 3366, 8961, 20068, 13, 13, 13, 4299, 29889, 2344, 29963, 10262, 29879, 29898, 28887, 3366, 29876, 29918, 29924, 12436, 298, 29886, 3366, 29882, 29918, 29277, 12436, 298, 29886, 3366, 29212, 12436, 298, 29886, 3366, 2892, 12436, 13, 1669, 298, 29886, 3366, 17263, 29918, 8961, 12436, 298, 29886, 3366, 2695, 29918, 29900, 12436, 298, 29886, 3366, 12324, 20068, 13, 2 ]
annotation_data/responsibility.py
levon003/icwsm-cancer-journeys
0
88424
from collections import Counter from tqdm import tqdm import itertools import pandas as pd import numpy as np from db import get_annotation_db from journal import get_journal_text, get_journal_info, get_journal_text_representation responsibility_labels = ["communicating", "info_filtering", "clinical_decisions", "preparation", "symptom_management", "coordinating_support", "sharing_medical_info", "compliance", "managing_transitions", "financial_management", "continued_monitoring", "giving_back", "behavior_changes"] responsibility_codes = ["CO", "IF", "CD", "PR", "ST", "CS", "SM", "CP", "MT", "FM", "CM", "GB", "BC"] responsibility_label_to_code_map = {resp_label: responsibility_codes[i] for i, resp_label in enumerate(responsibility_labels)} responsibility_labels_with_support_management = responsibility_labels + ["support_management"] responsibility_labels_with_none = responsibility_labels + ["none"] responsibility_labels_with_all = responsibility_labels + ["none", "support_management"] """ This is the set of responsibility labels with Cohen's kappa > 0.4 """ high_irr_responsibility_labels = ["coordinating_support", "sharing_medical_info", "compliance", "financial_management", "giving_back", "behavior_changes"] high_irr_responsibility_codes = [responsibility_codes[responsibility_labels.index(resp_label)] for resp_label in high_irr_responsibility_labels] def sort_responsibility_list(responsibility_list): return sorted(responsibility_list, key=lambda responsibility: responsibility_labels_with_all.index(responsibility)) def get_labels_from_responsibility_string(responsibility_string, include_none=False, warn_on_legacy_responsibilities=True): """ :param responsibility_string: :param include_none: If 'none' should be included in the returned list when no other responsibilities are present :return: """ if responsibility_string == "": return ['none'] if include_none else [] labels = responsibility_string.split('|') if len(labels) == 0: print("WARNING: No responsibilities identified, including none") if include_none: labels = ['none'] if not include_none and "none" in labels: labels.remove("none") # For legacy reasons, we handle support_management, but we replace it with the newer version of the codebook if "support_management" in labels: labels.remove("support_management") labels.append("sharing_medical_info") labels.append("coordinating_support") if warn_on_legacy_responsibilities: print("WARNING: Replaced support management with its newer codes.") # we sort the responsibility list to ensure they will always appear in a standard order # will throw an exception if an invalid responsibility occurred in the string labels = sort_responsibility_list(labels) return labels def get_responsibility_annotations(conflict_resolution_strategy="or"): try: db = get_annotation_db() # the most recent version of the annotation guidance was set at this date, # so we restrict to since this time period created_at = '2018-08-23' cursor = db.execute(""" SELECT a.site_id, a.journal_oid, a.data, a.username, c.correct_username FROM journalAnnotation a LEFT JOIN journalAnnotationConflictResolution c ON a.site_id = c.site_id AND a.journal_oid = c.journal_oid AND a.annotation_type = c.annotation_type WHERE a.annotation_type = "journal_patient_responsibilities" AND a.data <> "" AND a.created >= ? GROUP BY a.site_id, a.journal_oid, a.username ORDER BY a.id DESC """, (created_at,)) responsibility_annotations = [] # Sort the returned annotations so that we can group by the individual journals def group_by_journal_function(row): return row['site_id'], row['journal_oid'] # group by the journals, writing a single line for each journal in the dataset all_rows = cursor.fetchall() all_rows.sort(key=group_by_journal_function) for key, group in itertools.groupby(all_rows, group_by_journal_function): rows = list(group) site_id, journal_oid = key # We are considering all of the annotations for a single journal here data = None responsibilities = None if len(rows) == 1: assert rows[0]['correct_username'] is None or rows[0]['correct_username'] == "" annotator_usernames = rows[0]['username'] conflict_status = "SINGLE USER" data = rows[0]['data'] else: # 2 or more annotators # get the list of annotator names annotator_usernames = "|".join(sorted([row['username'] for row in rows])) if rows[0]['correct_username'] is not None and rows[0]['correct_username'] != "": # this annotation was corrected! correct_username = rows[0]['correct_username'] conflict_status = "RESOLVED" data = None for row in rows: if row['username'] == correct_username: data = row['data'] if data is None: raise ValueError("Annotation unexpectedly lacks data.") if data is None: # this condition implies an invalid correction in the database print( f"WARNING: {correct_username} not found in {annotator_usernames}. Replacing with 'unknown'.") data = 'unknown' else: # no correction for this journal responsibilities, conflict_status = \ resolve_responsibility_annotation_conflicts(rows, resolution_strategy=conflict_resolution_strategy) if data is None and responsibilities is None: raise ValueError("Unexpected and unhandled conflicts between a journal's responsibility annotations.") if responsibilities is None: responsibilities = get_labels_from_responsibility_string(data) responsibility_annotation_data = {'site_id': site_id, 'journal_oid': journal_oid, 'conflict_status': conflict_status, 'responsibilities': responsibilities} responsibility_annotations.append(responsibility_annotation_data) return responsibility_annotations finally: db.close() def get_responsibility_annotations_dataframe(): df = get_responsibility_annotations_by_username_dataframe() responsibility_annotations = [] # group by the journals, writing a single line for each journal in the dataset for key, group in df.groupby(by=['site_id', 'journal_oid']): rows = group site_id, journal_oid = key # We are considering all of the annotations for a single journal here responsibilities = None if len(rows) == 1: row = rows.iloc[0] assert row['correct_username'] is None or row['correct_username'] == "" annotator_usernames = row['username'] conflict_status = "SINGLE USER" responsibilities = row.responsibilities else: # 2 or more annotators first_row = rows.iloc[0] if first_row['correct_username'] is not None and first_row['correct_username'] != "": # this annotation was corrected! correct_username = first_row['correct_username'] conflict_status = "RESOLVED" selected_row = rows[rows.username == correct_username] if len(selected_row) == 0: # this condition implies an invalid correction in the database print( f"WARNING: {correct_username} not found in {annotator_usernames}. Replacing with 'unknown'.") responsibilities = ['unknown'] elif len(selected_row) > 1: raise ValueError("Multiple annotations from same username.") else: responsibilities = selected_row.iloc[0].responsibilities else: # no correction for this journal # use the or strategy conflict_status = 'CONFLICT' responsibility_sets = rows.apply(lambda row: set(row.responsibilities), axis=1) included_responsibilities = set() for responsibility_set in responsibility_sets: included_responsibilities = included_responsibilities | responsibility_set if len(included_responsibilities) == 0: responsibilities = ['unknown'] else: responsibilities = sort_responsibility_list(list(included_responsibilities)) if responsibilities is None: raise ValueError("Unexpected and unhandled conflicts between a journal's responsibility annotations.") responsibility_annotation_data = {'site_id': site_id, 'journal_oid': journal_oid, 'conflict_status': conflict_status, 'responsibilities': responsibilities} responsibility_annotations.append(responsibility_annotation_data) return pd.DataFrame(responsibility_annotations) def get_responsibility_annotations_by_username(): try: db = get_annotation_db() created_at = '2018-08-23' cursor = db.execute(""" SELECT a.site_id, a.journal_oid, a.data, a.username, c.correct_username FROM journalAnnotation a LEFT JOIN journalAnnotationConflictResolution c ON a.site_id = c.site_id AND a.journal_oid = c.journal_oid AND a.annotation_type = c.annotation_type WHERE a.annotation_type = "journal_patient_responsibilities" AND a.data <> "" AND a.created >= ? GROUP BY a.site_id, a.journal_oid, a.username ORDER BY a.id DESC """, (created_at,)) responsibility_annotations = [] rows = cursor.fetchall() for row in rows: site_id, journal_oid = row['site_id'], row['journal_oid'] username = row['username'] is_corrected = row['correct_username'] is not None and row['correct_username'] != "" responsibilities = get_labels_from_responsibility_string(row['data']) responsibility_annotation_data = {'site_id': site_id, 'journal_oid': journal_oid, 'username': username, 'responsibilities': responsibilities, 'is_corrected': is_corrected} responsibility_annotations.append(responsibility_annotation_data) return responsibility_annotations finally: db.close() def get_responsibility_annotations_by_username_dataframe(): """Fixed version of get_responsibility_annotations_by_username() which should be preferred.""" try: db = get_annotation_db() created_at = '2018-08-23' cursor = db.execute(""" SELECT a.site_id, a.journal_oid, a.data, a.username, a.id, c.correct_username FROM journalAnnotation a LEFT JOIN journalAnnotationConflictResolution c ON a.site_id = c.site_id AND a.journal_oid = c.journal_oid AND a.annotation_type = c.annotation_type WHERE a.annotation_type = "journal_patient_responsibilities" AND a.data <> "" AND a.created >= ? GROUP BY a.site_id, a.journal_oid, a.username, a.id ORDER BY a.id DESC """, (created_at,)) responsibility_annotations = [] rows = cursor.fetchall() for row in rows: site_id, journal_oid = row['site_id'], row['journal_oid'] username = row['username'] correct_username = row['correct_username'] responsibilities = get_labels_from_responsibility_string(row['data']) responsibility_annotation_data = {'site_id': site_id, 'journal_oid': journal_oid, 'username': username, 'correct_username': correct_username, 'responsibilities': responsibilities, 'id': row['id']} responsibility_annotations.append(responsibility_annotation_data) responsibility_df = pd.DataFrame(responsibility_annotations) new_df_inds = [group.id.idxmax() for key, group in responsibility_df.groupby(by=['site_id', 'journal_oid', 'username'])] new_df = responsibility_df.loc[new_df_inds].copy() new_df.reset_index(inplace=True) return new_df finally: db.close() def resolve_responsibility_annotation_conflicts(rows, allow_majority_agreement=True, resolution_strategy="or"): """ :param rows: Rows of annotations containing 'data' :param allow_majority_agreement: If annotation sets with at least one set of complete agreement ought to be allowed as a no-conflict situation :param resolution_strategy: View the source for the exact implementation of each approach. Valid values are: 'none', 'empty', 'min2', 'and', 'or' (default) :return: The responsibilities, as resolved from any conflict, and a string describing the status of conflict resolution """ combinations = [(combo[0]['data'] == combo[1]['data'], combo[0]['data']) for combo in itertools.combinations(rows, 2)] agreements = [data for is_match, data in combinations if is_match is True] responsibilities = None # this function resolves conflicts, assigning this list of responsibilities if len(agreements) == len(combinations): # all annotators agree conflict_status = "NO CONFLICT" data = agreements[0] elif allow_majority_agreement and len(agreements) >= 1: # at least one pair of annotators agree # note that this isn't the same as majority agreement if > 3 annotators have annotated a single journal # but at the time of implementation that will never happen conflict_status = "MINIMAL CONFLICT" data = agreements[0] else: # no agreements between any of the annotators! # this annotation was not corrected and there is no absolute agreement # In this situation, we'll resolve based on the resolution strategy conflict_status = "CONFLICT" if resolution_strategy == "none": data = "" responsibilities = ['none'] elif resolution_strategy == "empty": data = "" responsibilities = [] elif resolution_strategy == "min2": # this strategy includes all annotations used at least twice between annotators data = "" responsibility_lists = [get_labels_from_responsibility_string(row['data']) for row in rows] rep_counter = Counter(list(itertools.chain(*responsibility_lists))) responsibilities = [] for responsibility, count in rep_counter.most_common(): if count < 2: # only include responsibilities that occur at least twice break responsibilities.append(responsibility) elif resolution_strategy == "and": # includes all responsibilities selected by all annotators responsibility_sets = [set(get_labels_from_responsibility_string(row['data'])) for row in rows] responsibilities = sort_responsibility_list(list(set.intersection(*responsibility_sets))) elif resolution_strategy == "or" or resolution_strategy == "all_checked": # includes all responsibilities present among the annotations responsibility_sets = [set(get_labels_from_responsibility_string(row['data'])) for row in rows] responsibilities = sort_responsibility_list(list(set.union(*responsibility_sets))) else: raise ValueError(f"Resolution strategy f{resolution_strategy} unknown.") if responsibilities is None: responsibilities = get_labels_from_responsibility_string(data) return responsibilities, conflict_status def get_annotated_responsibility_df(conflict_score_cost=0.1): """ :return: Pandas DataFrame with the following columns: site_id, journal_oid, is_annotated, conflict_status, responsibilities, {responsibility_name}_score, journal_text """ responsibility_annotations = get_responsibility_annotations() df_entries = [] for ra in tqdm(responsibility_annotations): site_id, journal_oid = ra['site_id'], ra['journal_oid'] responsibilities = ra['responsibilities'] journal_text = get_journal_text(site_id, journal_oid) if journal_text is None: continue conflict_status = ra['conflict_status'] new_entry = {'site_id': site_id, 'journal_oid': journal_oid, 'is_annotated': True, 'conflict_status': ra['conflict_status'], 'responsibilities': responsibilities, 'journal_text': journal_text} for resp_label in responsibility_labels: score = int(resp_label in responsibilities) if conflict_status == "CONFLICT" and score == 1: score -= conflict_score_cost new_entry[resp_label + "_score"] = score df_entries.append(new_entry) df = pd.DataFrame(df_entries) return df def get_annotated_responsibility_df_fixed(conflict_score_cost=0.1, resp_subset=responsibility_labels): """ :return: Pandas DataFrame with the following columns: site_id, journal_oid, is_annotated, conflict_status, responsibilities, {responsibility_name}_score, journal_text """ df = get_responsibility_annotations_dataframe() df['journal_text'] = df.apply(lambda row: get_journal_text(row.site_id, row.journal_oid), axis=1) df.drop(df[df.journal_text.isna()].index, inplace=True) assert np.sum(df.journal_text.isna()) == 0 df['is_annotated'] = True for resp_label in resp_subset: df[resp_label + "_score"] = df.apply(lambda row: int(resp_label in row.responsibilities) - conflict_score_cost if row.conflict_status == "CONFLICT" else int(resp_label in row.responsibilities), axis=1) df.reset_index(inplace=True) return df def add_journals_to_responsibility_df(df, new_entries): """ Add the given [unannotated] journals to the given df. :param df: A df generated by get_annotated_responsibility_df() :param new_entries: A list of dictionaries containing the keys 'site_id' and 'journal_oid' :return: The new dataframe containing both. """ df_entries = [] for e in tqdm(new_entries): site_id, journal_oid = e['site_id'], e['journal_oid'] journal_text = get_journal_text(site_id, journal_oid) if journal_text is None: continue new_entry = {'site_id': site_id, 'journal_oid': journal_oid, 'is_annotated': False, 'conflict_status': None, 'responsibilities': [], 'journal_text': journal_text} df_entries.append(new_entry) unannotated_df = pd.DataFrame(df_entries) new_df = pd.concat([df, unannotated_df], ignore_index=True) new_df.drop_duplicates(subset=['site_id', 'journal_oid'], keep='first', inplace=True) return new_df def add_sites_to_responsibility_df(df, new_entries, drop_duplicate_journals=True): """ Add the given [unannotated] sites to the given df. :param df: A df generated by get_annotated_responsibility_df() :param new_entries: A list of integer site_ids :return: The new dataframe containing all journals in the sites indicated by new_entries """ df_entries = [] for site_id in tqdm(new_entries): journals = get_journal_info(site_id) for journal in journals: journal_text = get_journal_text_representation(journal) if journal_text is None: continue new_entry = {'site_id': site_id, 'journal_oid': journal['journal_oid'], 'is_annotated': False, 'conflict_status': None, 'responsibilities': [], 'journal_text': journal_text} df_entries.append(new_entry) unannotated_df = pd.DataFrame(df_entries) new_df = pd.concat([df, unannotated_df], ignore_index=True) if drop_duplicate_journals: new_df.drop_duplicates(subset=['site_id', 'journal_oid'], keep='first', inplace=True) return new_df
[ 1, 515, 16250, 1053, 315, 5336, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 5215, 4256, 8504, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 4833, 1053, 679, 29918, 18317, 29918, 2585, 13, 3166, 8955, 1053, 679, 29918, 29926, 4659, 29918, 726, 29892, 679, 29918, 29926, 4659, 29918, 3888, 29892, 679, 29918, 29926, 4659, 29918, 726, 29918, 276, 26081, 13, 13, 26679, 4127, 29918, 21134, 353, 6796, 27820, 1218, 613, 376, 3888, 29918, 4572, 292, 613, 376, 695, 262, 936, 29918, 311, 3476, 1080, 613, 376, 1457, 862, 362, 613, 376, 11967, 415, 290, 29918, 21895, 613, 13, 462, 308, 376, 1111, 4194, 1218, 29918, 5924, 613, 376, 845, 4362, 29918, 2168, 936, 29918, 3888, 613, 376, 2388, 13036, 613, 13, 462, 308, 376, 1171, 6751, 29918, 3286, 2187, 613, 376, 4951, 273, 1455, 29918, 21895, 613, 376, 1285, 262, 6742, 29918, 3712, 2105, 292, 613, 376, 29887, 4357, 29918, 1627, 613, 13, 462, 308, 376, 915, 16300, 29918, 25990, 3108, 13, 26679, 4127, 29918, 18137, 353, 6796, 3217, 613, 376, 6545, 613, 376, 6530, 613, 376, 10593, 613, 376, 1254, 613, 376, 9295, 613, 376, 17061, 613, 376, 6271, 613, 376, 11490, 613, 376, 22192, 613, 376, 24494, 613, 376, 7210, 613, 376, 5371, 3108, 13, 26679, 4127, 29918, 1643, 29918, 517, 29918, 401, 29918, 1958, 353, 426, 13713, 29918, 1643, 29901, 23134, 29918, 18137, 29961, 29875, 29962, 363, 474, 29892, 4613, 29918, 1643, 297, 26985, 29898, 26679, 4127, 29918, 21134, 2915, 13, 26679, 4127, 29918, 21134, 29918, 2541, 29918, 5924, 29918, 21895, 353, 23134, 29918, 21134, 718, 6796, 5924, 29918, 21895, 3108, 13, 26679, 4127, 29918, 21134, 29918, 2541, 29918, 9290, 353, 23134, 29918, 21134, 718, 6796, 9290, 3108, 13, 26679, 4127, 29918, 21134, 29918, 2541, 29918, 497, 353, 23134, 29918, 21134, 718, 6796, 9290, 613, 376, 5924, 29918, 21895, 3108, 13, 13, 15945, 29908, 13, 4013, 338, 278, 731, 310, 23134, 11073, 411, 315, 14899, 29915, 29879, 413, 8055, 1405, 29871, 29900, 29889, 29946, 13, 15945, 29908, 13, 9812, 29918, 381, 29878, 29918, 26679, 4127, 29918, 21134, 353, 6796, 1111, 4194, 1218, 29918, 5924, 613, 376, 845, 4362, 29918, 2168, 936, 29918, 3888, 613, 376, 2388, 13036, 613, 376, 4951, 273, 1455, 29918, 21895, 613, 376, 29887, 4357, 29918, 1627, 613, 376, 915, 16300, 29918, 25990, 3108, 13, 9812, 29918, 381, 29878, 29918, 26679, 4127, 29918, 18137, 353, 518, 26679, 4127, 29918, 18137, 29961, 26679, 4127, 29918, 21134, 29889, 2248, 29898, 13713, 29918, 1643, 4638, 363, 4613, 29918, 1643, 297, 1880, 29918, 381, 29878, 29918, 26679, 4127, 29918, 21134, 29962, 13, 13, 13, 1753, 2656, 29918, 26679, 4127, 29918, 1761, 29898, 26679, 4127, 29918, 1761, 1125, 13, 1678, 736, 12705, 29898, 26679, 4127, 29918, 1761, 29892, 1820, 29922, 2892, 23134, 29901, 23134, 29918, 21134, 29918, 2541, 29918, 497, 29889, 2248, 29898, 26679, 4127, 876, 13, 13, 13, 1753, 679, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 26679, 4127, 29918, 1807, 29892, 3160, 29918, 9290, 29922, 8824, 29892, 13, 462, 462, 3986, 29383, 29918, 265, 29918, 1397, 4135, 29918, 26679, 747, 9770, 29922, 5574, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 3207, 23134, 29918, 1807, 29901, 13, 1678, 584, 3207, 3160, 29918, 9290, 29901, 960, 525, 9290, 29915, 881, 367, 5134, 297, 278, 4133, 1051, 746, 694, 916, 5544, 747, 9770, 526, 2198, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 565, 23134, 29918, 1807, 1275, 376, 1115, 13, 4706, 736, 6024, 9290, 2033, 565, 3160, 29918, 9290, 1683, 5159, 13, 1678, 11073, 353, 23134, 29918, 1807, 29889, 5451, 877, 29989, 1495, 13, 1678, 565, 7431, 29898, 21134, 29897, 1275, 29871, 29900, 29901, 13, 4706, 1596, 703, 29956, 25614, 29901, 1939, 5544, 747, 9770, 15659, 29892, 3704, 5642, 1159, 13, 4706, 565, 3160, 29918, 9290, 29901, 13, 9651, 11073, 353, 6024, 9290, 2033, 13, 1678, 565, 451, 3160, 29918, 9290, 322, 376, 9290, 29908, 297, 11073, 29901, 13, 4706, 11073, 29889, 5992, 703, 9290, 1159, 13, 1678, 396, 1152, 25000, 9590, 29892, 591, 4386, 2304, 29918, 21895, 29892, 541, 591, 5191, 372, 411, 278, 20687, 1873, 310, 278, 775, 2909, 13, 1678, 565, 376, 5924, 29918, 21895, 29908, 297, 11073, 29901, 13, 4706, 11073, 29889, 5992, 703, 5924, 29918, 21895, 1159, 13, 4706, 11073, 29889, 4397, 703, 845, 4362, 29918, 2168, 936, 29918, 3888, 1159, 13, 4706, 11073, 29889, 4397, 703, 1111, 4194, 1218, 29918, 5924, 1159, 13, 4706, 565, 29383, 29918, 265, 29918, 1397, 4135, 29918, 26679, 747, 9770, 29901, 13, 9651, 1596, 703, 29956, 25614, 29901, 10088, 433, 1133, 2304, 10643, 411, 967, 20687, 11561, 23157, 13, 1678, 396, 591, 2656, 278, 23134, 1051, 304, 9801, 896, 674, 2337, 2615, 297, 263, 3918, 1797, 13, 1678, 396, 674, 3183, 385, 3682, 565, 385, 8340, 23134, 10761, 297, 278, 1347, 13, 1678, 11073, 353, 2656, 29918, 26679, 4127, 29918, 1761, 29898, 21134, 29897, 13, 1678, 736, 11073, 13, 13, 13, 1753, 679, 29918, 26679, 4127, 29918, 6735, 800, 29898, 5527, 29176, 29918, 9778, 918, 29918, 710, 8963, 543, 272, 29908, 1125, 13, 1678, 1018, 29901, 13, 4706, 4833, 353, 679, 29918, 18317, 29918, 2585, 580, 13, 4706, 396, 278, 1556, 7786, 1873, 310, 278, 17195, 27323, 471, 731, 472, 445, 2635, 29892, 13, 4706, 396, 577, 591, 9250, 304, 1951, 445, 931, 3785, 13, 4706, 2825, 29918, 271, 353, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29947, 29899, 29906, 29941, 29915, 13, 4706, 10677, 353, 4833, 29889, 7978, 703, 15945, 13, 9651, 5097, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 1272, 29892, 263, 29889, 6786, 29892, 274, 29889, 15728, 29918, 6786, 29871, 13, 9651, 3895, 8955, 21978, 263, 19246, 8780, 8955, 21978, 16376, 29176, 12375, 918, 274, 29871, 13, 9651, 6732, 263, 29889, 2746, 29918, 333, 353, 274, 29889, 2746, 29918, 333, 5300, 263, 29889, 29926, 4659, 29918, 3398, 353, 274, 29889, 29926, 4659, 29918, 3398, 5300, 263, 29889, 18317, 29918, 1853, 353, 274, 29889, 18317, 29918, 1853, 29871, 13, 9651, 5754, 263, 29889, 18317, 29918, 1853, 353, 376, 29926, 4659, 29918, 5031, 993, 29918, 26679, 747, 9770, 29908, 5300, 263, 29889, 1272, 15271, 5124, 13, 9651, 5300, 263, 29889, 11600, 6736, 1577, 13, 9651, 15345, 6770, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 6786, 29871, 13, 9651, 15606, 6770, 263, 29889, 333, 23050, 13, 4706, 5124, 613, 313, 11600, 29918, 271, 29892, 876, 13, 13, 4706, 23134, 29918, 6735, 800, 353, 5159, 13, 13, 4706, 396, 20025, 278, 4133, 25495, 577, 393, 591, 508, 2318, 491, 278, 5375, 21824, 1338, 13, 4706, 822, 2318, 29918, 1609, 29918, 29926, 4659, 29918, 2220, 29898, 798, 1125, 13, 9651, 736, 1948, 1839, 2746, 29918, 333, 7464, 1948, 1839, 29926, 4659, 29918, 3398, 2033, 13, 13, 4706, 396, 2318, 491, 278, 21824, 1338, 29892, 5007, 263, 2323, 1196, 363, 1269, 8955, 297, 278, 8783, 13, 4706, 599, 29918, 5727, 353, 10677, 29889, 9155, 497, 580, 13, 4706, 599, 29918, 5727, 29889, 6605, 29898, 1989, 29922, 2972, 29918, 1609, 29918, 29926, 4659, 29918, 2220, 29897, 13, 4706, 363, 1820, 29892, 2318, 297, 4256, 8504, 29889, 27789, 29898, 497, 29918, 5727, 29892, 2318, 29918, 1609, 29918, 29926, 4659, 29918, 2220, 1125, 13, 9651, 4206, 353, 1051, 29898, 2972, 29897, 13, 9651, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 1820, 13, 9651, 396, 1334, 526, 13858, 599, 310, 278, 25495, 363, 263, 2323, 8955, 1244, 13, 13, 9651, 848, 353, 6213, 13, 9651, 5544, 747, 9770, 353, 6213, 13, 9651, 565, 7431, 29898, 5727, 29897, 1275, 29871, 29896, 29901, 13, 18884, 4974, 4206, 29961, 29900, 22322, 15728, 29918, 6786, 2033, 338, 6213, 470, 4206, 29961, 29900, 22322, 15728, 29918, 6786, 2033, 1275, 5124, 13, 18884, 9732, 1061, 29918, 375, 824, 1280, 353, 4206, 29961, 29900, 22322, 6786, 2033, 13, 18884, 14529, 29918, 4882, 353, 376, 29903, 4214, 1307, 3148, 1001, 29908, 13, 18884, 848, 353, 4206, 29961, 29900, 22322, 1272, 2033, 13, 9651, 1683, 29901, 29871, 396, 29871, 29906, 470, 901, 9732, 4097, 13, 18884, 396, 679, 278, 1051, 310, 9732, 1061, 2983, 13, 18884, 9732, 1061, 29918, 375, 824, 1280, 353, 376, 29989, 1642, 7122, 29898, 24582, 4197, 798, 1839, 6786, 2033, 363, 1948, 297, 4206, 12622, 13, 18884, 565, 4206, 29961, 29900, 22322, 15728, 29918, 6786, 2033, 338, 451, 6213, 322, 4206, 29961, 29900, 22322, 15728, 29918, 6786, 2033, 2804, 376, 1115, 13, 462, 1678, 396, 445, 17195, 471, 24114, 29991, 13, 462, 1678, 1959, 29918, 6786, 353, 4206, 29961, 29900, 22322, 15728, 29918, 6786, 2033, 13, 462, 1678, 14529, 29918, 4882, 353, 376, 15989, 5607, 29963, 3352, 29908, 13, 462, 1678, 848, 353, 6213, 13, 462, 1678, 363, 1948, 297, 4206, 29901, 13, 462, 4706, 565, 1948, 1839, 6786, 2033, 1275, 1959, 29918, 6786, 29901, 13, 462, 9651, 848, 353, 1948, 1839, 1272, 2033, 13, 462, 9651, 565, 848, 338, 6213, 29901, 13, 462, 18884, 12020, 7865, 2392, 703, 21978, 15668, 368, 425, 4684, 848, 23157, 13, 462, 1678, 565, 848, 338, 6213, 29901, 13, 462, 4706, 396, 445, 4195, 10469, 385, 8340, 26385, 297, 278, 2566, 13, 462, 4706, 1596, 29898, 13, 462, 9651, 285, 29908, 29956, 25614, 29901, 426, 15728, 29918, 6786, 29913, 451, 1476, 297, 426, 6735, 1061, 29918, 375, 824, 1280, 1836, 10088, 433, 3277, 411, 525, 26690, 4286, 1159, 13, 462, 4706, 848, 353, 525, 26690, 29915, 13, 18884, 1683, 29901, 29871, 396, 694, 26385, 363, 445, 8955, 13, 462, 1678, 5544, 747, 9770, 29892, 14529, 29918, 4882, 353, 320, 13, 462, 4706, 8814, 29918, 26679, 4127, 29918, 18317, 29918, 5527, 506, 1372, 29898, 5727, 29892, 13, 462, 462, 462, 462, 1678, 10104, 29918, 710, 8963, 29922, 5527, 29176, 29918, 9778, 918, 29918, 710, 8963, 29897, 13, 9651, 565, 848, 338, 6213, 322, 5544, 747, 9770, 338, 6213, 29901, 13, 18884, 12020, 7865, 2392, 703, 29965, 13996, 6021, 322, 443, 3179, 839, 28792, 1546, 263, 8955, 29915, 29879, 23134, 25495, 23157, 13, 9651, 565, 5544, 747, 9770, 338, 6213, 29901, 13, 18884, 5544, 747, 9770, 353, 679, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 1272, 29897, 13, 9651, 23134, 29918, 18317, 29918, 1272, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 462, 795, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 462, 795, 525, 5527, 29176, 29918, 4882, 2396, 14529, 29918, 4882, 29892, 13, 462, 462, 795, 525, 26679, 747, 9770, 2396, 5544, 747, 9770, 29913, 13, 9651, 23134, 29918, 6735, 800, 29889, 4397, 29898, 26679, 4127, 29918, 18317, 29918, 1272, 29897, 13, 4706, 736, 23134, 29918, 6735, 800, 13, 1678, 7146, 29901, 13, 4706, 4833, 29889, 5358, 580, 13, 13, 308, 13, 1753, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1272, 2557, 7295, 13, 1678, 4489, 353, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1609, 29918, 6786, 29918, 1272, 2557, 580, 13, 13, 1678, 23134, 29918, 6735, 800, 353, 5159, 13, 13, 1678, 396, 2318, 491, 278, 21824, 1338, 29892, 5007, 263, 2323, 1196, 363, 1269, 8955, 297, 278, 8783, 13, 1678, 363, 1820, 29892, 2318, 297, 4489, 29889, 27789, 29898, 1609, 29922, 1839, 2746, 29918, 333, 742, 525, 29926, 4659, 29918, 3398, 2033, 1125, 13, 4706, 4206, 353, 2318, 13, 4706, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 1820, 13, 4706, 396, 1334, 526, 13858, 599, 310, 278, 25495, 363, 263, 2323, 8955, 1244, 13, 13, 4706, 5544, 747, 9770, 353, 6213, 13, 4706, 565, 7431, 29898, 5727, 29897, 1275, 29871, 29896, 29901, 13, 9651, 1948, 353, 4206, 29889, 309, 542, 29961, 29900, 29962, 13, 9651, 4974, 1948, 1839, 15728, 29918, 6786, 2033, 338, 6213, 470, 1948, 1839, 15728, 29918, 6786, 2033, 1275, 5124, 13, 9651, 9732, 1061, 29918, 375, 824, 1280, 353, 1948, 1839, 6786, 2033, 13, 9651, 14529, 29918, 4882, 353, 376, 29903, 4214, 1307, 3148, 1001, 29908, 13, 9651, 5544, 747, 9770, 353, 1948, 29889, 26679, 747, 9770, 13, 4706, 1683, 29901, 29871, 396, 29871, 29906, 470, 901, 9732, 4097, 13, 9651, 937, 29918, 798, 353, 4206, 29889, 309, 542, 29961, 29900, 29962, 13, 9651, 565, 937, 29918, 798, 1839, 15728, 29918, 6786, 2033, 338, 451, 6213, 322, 937, 29918, 798, 1839, 15728, 29918, 6786, 2033, 2804, 376, 1115, 13, 18884, 396, 445, 17195, 471, 24114, 29991, 13, 18884, 1959, 29918, 6786, 353, 937, 29918, 798, 1839, 15728, 29918, 6786, 2033, 13, 18884, 14529, 29918, 4882, 353, 376, 15989, 5607, 29963, 3352, 29908, 13, 18884, 4629, 29918, 798, 353, 4206, 29961, 5727, 29889, 6786, 1275, 1959, 29918, 6786, 29962, 13, 13, 18884, 565, 7431, 29898, 8391, 29918, 798, 29897, 1275, 29871, 29900, 29901, 13, 462, 1678, 396, 445, 4195, 10469, 385, 8340, 26385, 297, 278, 2566, 13, 462, 1678, 1596, 29898, 13, 462, 4706, 285, 29908, 29956, 25614, 29901, 426, 15728, 29918, 6786, 29913, 451, 1476, 297, 426, 6735, 1061, 29918, 375, 824, 1280, 1836, 10088, 433, 3277, 411, 525, 26690, 4286, 1159, 13, 462, 1678, 5544, 747, 9770, 353, 6024, 26690, 2033, 13, 18884, 25342, 7431, 29898, 8391, 29918, 798, 29897, 1405, 29871, 29896, 29901, 13, 462, 1678, 12020, 7865, 2392, 703, 15329, 552, 25495, 515, 1021, 8952, 23157, 13, 18884, 1683, 29901, 13, 462, 1678, 5544, 747, 9770, 353, 4629, 29918, 798, 29889, 309, 542, 29961, 29900, 1822, 26679, 747, 9770, 13, 9651, 1683, 29901, 29871, 396, 694, 26385, 363, 445, 8955, 13, 18884, 396, 671, 278, 470, 13705, 13, 18884, 14529, 29918, 4882, 353, 525, 6007, 29943, 5265, 1783, 29915, 13, 18884, 23134, 29918, 7224, 353, 4206, 29889, 7302, 29898, 2892, 1948, 29901, 731, 29898, 798, 29889, 26679, 747, 9770, 511, 9685, 29922, 29896, 29897, 13, 18884, 5134, 29918, 26679, 747, 9770, 353, 731, 580, 13, 18884, 363, 23134, 29918, 842, 297, 23134, 29918, 7224, 29901, 13, 462, 1678, 5134, 29918, 26679, 747, 9770, 353, 5134, 29918, 26679, 747, 9770, 891, 23134, 29918, 842, 13, 18884, 565, 7431, 29898, 11707, 287, 29918, 26679, 747, 9770, 29897, 1275, 29871, 29900, 29901, 13, 462, 1678, 5544, 747, 9770, 353, 6024, 26690, 2033, 13, 18884, 1683, 29901, 13, 462, 1678, 5544, 747, 9770, 353, 2656, 29918, 26679, 4127, 29918, 1761, 29898, 1761, 29898, 11707, 287, 29918, 26679, 747, 9770, 876, 13, 4706, 565, 5544, 747, 9770, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 703, 29965, 13996, 6021, 322, 443, 3179, 839, 28792, 1546, 263, 8955, 29915, 29879, 23134, 25495, 23157, 13, 4706, 23134, 29918, 18317, 29918, 1272, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 462, 3986, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 462, 3986, 525, 5527, 29176, 29918, 4882, 2396, 14529, 29918, 4882, 29892, 13, 462, 462, 3986, 525, 26679, 747, 9770, 2396, 5544, 747, 9770, 29913, 13, 4706, 23134, 29918, 6735, 800, 29889, 4397, 29898, 26679, 4127, 29918, 18317, 29918, 1272, 29897, 13, 1678, 736, 10518, 29889, 17271, 29898, 26679, 4127, 29918, 6735, 800, 29897, 13, 13, 13, 1753, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1609, 29918, 6786, 7295, 13, 1678, 1018, 29901, 13, 4706, 4833, 353, 679, 29918, 18317, 29918, 2585, 580, 13, 4706, 2825, 29918, 271, 353, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29947, 29899, 29906, 29941, 29915, 13, 4706, 10677, 353, 4833, 29889, 7978, 703, 15945, 13, 462, 1678, 5097, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 1272, 29892, 263, 29889, 6786, 29892, 274, 29889, 15728, 29918, 6786, 29871, 13, 462, 1678, 3895, 8955, 21978, 263, 19246, 8780, 8955, 21978, 16376, 29176, 12375, 918, 274, 29871, 13, 462, 1678, 6732, 263, 29889, 2746, 29918, 333, 353, 274, 29889, 2746, 29918, 333, 5300, 263, 29889, 29926, 4659, 29918, 3398, 353, 274, 29889, 29926, 4659, 29918, 3398, 5300, 263, 29889, 18317, 29918, 1853, 353, 274, 29889, 18317, 29918, 1853, 29871, 13, 462, 1678, 5754, 263, 29889, 18317, 29918, 1853, 353, 376, 29926, 4659, 29918, 5031, 993, 29918, 26679, 747, 9770, 29908, 5300, 263, 29889, 1272, 15271, 5124, 13, 462, 1678, 5300, 263, 29889, 11600, 6736, 1577, 13, 462, 1678, 15345, 6770, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 6786, 29871, 13, 462, 1678, 15606, 6770, 263, 29889, 333, 23050, 13, 18884, 5124, 613, 313, 11600, 29918, 271, 29892, 876, 13, 13, 4706, 23134, 29918, 6735, 800, 353, 5159, 13, 4706, 4206, 353, 10677, 29889, 9155, 497, 580, 13, 4706, 363, 1948, 297, 4206, 29901, 13, 9651, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 1948, 1839, 2746, 29918, 333, 7464, 1948, 1839, 29926, 4659, 29918, 3398, 2033, 13, 9651, 8952, 353, 1948, 1839, 6786, 2033, 13, 9651, 338, 29918, 15728, 287, 353, 1948, 1839, 15728, 29918, 6786, 2033, 338, 451, 6213, 322, 1948, 1839, 15728, 29918, 6786, 2033, 2804, 5124, 13, 9651, 5544, 747, 9770, 353, 679, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 798, 1839, 1272, 11287, 13, 9651, 23134, 29918, 18317, 29918, 1272, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 462, 795, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 462, 795, 525, 6786, 2396, 8952, 29892, 13, 462, 462, 795, 525, 26679, 747, 9770, 2396, 5544, 747, 9770, 29892, 13, 462, 462, 795, 525, 275, 29918, 15728, 287, 2396, 338, 29918, 15728, 287, 29913, 13, 9651, 23134, 29918, 6735, 800, 29889, 4397, 29898, 26679, 4127, 29918, 18317, 29918, 1272, 29897, 13, 4706, 736, 23134, 29918, 6735, 800, 13, 1678, 7146, 29901, 13, 4706, 4833, 29889, 5358, 580, 13, 308, 13, 308, 13, 1753, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1609, 29918, 6786, 29918, 1272, 2557, 7295, 13, 1678, 9995, 26262, 1873, 310, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1609, 29918, 6786, 580, 607, 881, 367, 16389, 1213, 15945, 13, 1678, 1018, 29901, 13, 4706, 4833, 353, 679, 29918, 18317, 29918, 2585, 580, 13, 4706, 2825, 29918, 271, 353, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29947, 29899, 29906, 29941, 29915, 13, 4706, 10677, 353, 4833, 29889, 7978, 703, 15945, 13, 462, 1678, 5097, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 1272, 29892, 263, 29889, 6786, 29892, 263, 29889, 333, 29892, 274, 29889, 15728, 29918, 6786, 13, 462, 1678, 3895, 8955, 21978, 263, 19246, 8780, 8955, 21978, 16376, 29176, 12375, 918, 274, 29871, 13, 462, 1678, 6732, 263, 29889, 2746, 29918, 333, 353, 274, 29889, 2746, 29918, 333, 5300, 263, 29889, 29926, 4659, 29918, 3398, 353, 274, 29889, 29926, 4659, 29918, 3398, 5300, 263, 29889, 18317, 29918, 1853, 353, 274, 29889, 18317, 29918, 1853, 29871, 13, 462, 1678, 5754, 263, 29889, 18317, 29918, 1853, 353, 376, 29926, 4659, 29918, 5031, 993, 29918, 26679, 747, 9770, 29908, 5300, 263, 29889, 1272, 15271, 5124, 13, 462, 1678, 5300, 263, 29889, 11600, 6736, 1577, 13, 462, 1678, 15345, 6770, 263, 29889, 2746, 29918, 333, 29892, 263, 29889, 29926, 4659, 29918, 3398, 29892, 263, 29889, 6786, 29892, 263, 29889, 333, 13, 462, 1678, 15606, 6770, 263, 29889, 333, 23050, 13, 18884, 5124, 613, 313, 11600, 29918, 271, 29892, 876, 13, 13, 4706, 23134, 29918, 6735, 800, 353, 5159, 13, 4706, 4206, 353, 10677, 29889, 9155, 497, 580, 13, 4706, 363, 1948, 297, 4206, 29901, 13, 9651, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 1948, 1839, 2746, 29918, 333, 7464, 1948, 1839, 29926, 4659, 29918, 3398, 2033, 13, 9651, 8952, 353, 1948, 1839, 6786, 2033, 13, 9651, 1959, 29918, 6786, 353, 1948, 1839, 15728, 29918, 6786, 2033, 13, 9651, 5544, 747, 9770, 353, 679, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 798, 1839, 1272, 11287, 13, 9651, 23134, 29918, 18317, 29918, 1272, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 462, 795, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 462, 795, 525, 6786, 2396, 8952, 29892, 13, 462, 462, 795, 525, 15728, 29918, 6786, 2396, 1959, 29918, 6786, 29892, 13, 462, 462, 795, 525, 26679, 747, 9770, 2396, 5544, 747, 9770, 29892, 13, 462, 462, 795, 525, 333, 2396, 1948, 1839, 333, 2033, 29913, 13, 9651, 23134, 29918, 6735, 800, 29889, 4397, 29898, 26679, 4127, 29918, 18317, 29918, 1272, 29897, 13, 308, 13, 4706, 23134, 29918, 2176, 353, 10518, 29889, 17271, 29898, 26679, 4127, 29918, 6735, 800, 29897, 13, 4706, 716, 29918, 2176, 29918, 12772, 353, 518, 2972, 29889, 333, 29889, 13140, 3317, 580, 29871, 13, 462, 539, 363, 1820, 29892, 2318, 29871, 13, 462, 539, 297, 23134, 29918, 2176, 29889, 27789, 29898, 1609, 29922, 1839, 2746, 29918, 333, 742, 525, 29926, 4659, 29918, 3398, 742, 525, 6786, 2033, 4638, 13, 4706, 716, 29918, 2176, 353, 23134, 29918, 2176, 29889, 2029, 29961, 1482, 29918, 2176, 29918, 12772, 1822, 8552, 580, 13, 4706, 716, 29918, 2176, 29889, 12071, 29918, 2248, 29898, 262, 6689, 29922, 5574, 29897, 13, 308, 13, 4706, 736, 716, 29918, 2176, 13, 1678, 7146, 29901, 13, 4706, 4833, 29889, 5358, 580, 13, 13, 13, 1753, 8814, 29918, 26679, 4127, 29918, 18317, 29918, 5527, 506, 1372, 29898, 5727, 29892, 2758, 29918, 21355, 537, 29918, 351, 276, 882, 29922, 5574, 29892, 10104, 29918, 710, 8963, 543, 272, 29908, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 3207, 4206, 29901, 390, 1242, 310, 25495, 6943, 525, 1272, 29915, 13, 1678, 584, 3207, 2758, 29918, 21355, 537, 29918, 351, 276, 882, 29901, 960, 17195, 6166, 411, 472, 3203, 697, 731, 310, 4866, 17327, 12722, 304, 367, 13, 1678, 6068, 408, 263, 694, 29899, 5527, 29176, 6434, 13, 1678, 584, 3207, 10104, 29918, 710, 8963, 29901, 4533, 278, 2752, 363, 278, 2684, 5314, 310, 1269, 2948, 29889, 13, 1678, 15758, 1819, 526, 29901, 525, 9290, 742, 525, 6310, 742, 525, 1195, 29906, 742, 525, 392, 742, 525, 272, 29915, 313, 4381, 29897, 13, 1678, 584, 2457, 29901, 450, 5544, 747, 9770, 29892, 408, 11527, 515, 738, 14529, 29892, 13, 1678, 322, 263, 1347, 20766, 278, 4660, 310, 14529, 10104, 13, 1678, 9995, 13, 1678, 18240, 353, 17288, 510, 833, 29961, 29900, 22322, 1272, 2033, 1275, 419, 833, 29961, 29896, 22322, 1272, 7464, 419, 833, 29961, 29900, 22322, 1272, 11287, 13, 462, 1678, 363, 419, 833, 297, 4256, 8504, 29889, 510, 2109, 800, 29898, 5727, 29892, 29871, 29906, 4638, 13, 1678, 8571, 4110, 353, 518, 1272, 363, 338, 29918, 4352, 29892, 848, 297, 18240, 565, 338, 29918, 4352, 338, 5852, 29962, 13, 13, 1678, 5544, 747, 9770, 353, 6213, 29871, 396, 445, 740, 3770, 1960, 28792, 29892, 23188, 445, 1051, 310, 5544, 747, 9770, 13, 13, 1678, 565, 7431, 29898, 351, 276, 4110, 29897, 1275, 7431, 29898, 510, 2109, 800, 1125, 29871, 396, 599, 9732, 4097, 8661, 13, 4706, 14529, 29918, 4882, 353, 376, 6632, 8707, 29943, 5265, 1783, 29908, 13, 4706, 848, 353, 8571, 4110, 29961, 29900, 29962, 13, 1678, 25342, 2758, 29918, 21355, 537, 29918, 351, 276, 882, 322, 7431, 29898, 351, 276, 4110, 29897, 6736, 29871, 29896, 29901, 29871, 396, 472, 3203, 697, 5101, 310, 9732, 4097, 8661, 13, 4706, 396, 4443, 393, 445, 3508, 29915, 29873, 278, 1021, 408, 13638, 17327, 565, 1405, 29871, 29941, 9732, 4097, 505, 9732, 630, 263, 2323, 8955, 13, 4706, 396, 541, 472, 278, 931, 310, 5314, 393, 674, 2360, 3799, 13, 4706, 14529, 29918, 4882, 353, 376, 16173, 2260, 29931, 8707, 29943, 5265, 1783, 29908, 13, 4706, 848, 353, 8571, 4110, 29961, 29900, 29962, 13, 1678, 1683, 29901, 29871, 396, 694, 8571, 4110, 1546, 738, 310, 278, 9732, 4097, 29991, 13, 4706, 396, 445, 17195, 471, 451, 24114, 322, 727, 338, 694, 8380, 17327, 13, 4706, 396, 512, 445, 6434, 29892, 591, 29915, 645, 8814, 2729, 373, 278, 10104, 13705, 13, 4706, 14529, 29918, 4882, 353, 376, 6007, 29943, 5265, 1783, 29908, 13, 4706, 565, 10104, 29918, 710, 8963, 1275, 376, 9290, 1115, 13, 9651, 848, 353, 5124, 13, 9651, 5544, 747, 9770, 353, 6024, 9290, 2033, 13, 4706, 25342, 10104, 29918, 710, 8963, 1275, 376, 6310, 1115, 13, 9651, 848, 353, 5124, 13, 9651, 5544, 747, 9770, 353, 5159, 13, 4706, 25342, 10104, 29918, 710, 8963, 1275, 376, 1195, 29906, 1115, 13, 9651, 396, 445, 13705, 7805, 599, 25495, 1304, 472, 3203, 8951, 1546, 9732, 4097, 13, 9651, 848, 353, 5124, 13, 9651, 23134, 29918, 21513, 353, 518, 657, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 798, 1839, 1272, 11287, 363, 1948, 297, 4206, 29962, 13, 9651, 1634, 29918, 11808, 353, 315, 5336, 29898, 1761, 29898, 1524, 8504, 29889, 14153, 10456, 26679, 4127, 29918, 21513, 4961, 13, 9651, 5544, 747, 9770, 353, 5159, 13, 9651, 363, 23134, 29892, 2302, 297, 1634, 29918, 11808, 29889, 3242, 29918, 9435, 7295, 13, 18884, 565, 2302, 529, 29871, 29906, 29901, 29871, 396, 871, 3160, 5544, 747, 9770, 393, 6403, 472, 3203, 8951, 13, 462, 1678, 2867, 13, 18884, 5544, 747, 9770, 29889, 4397, 29898, 26679, 4127, 29897, 13, 4706, 25342, 10104, 29918, 710, 8963, 1275, 376, 392, 1115, 13, 9651, 396, 7805, 599, 5544, 747, 9770, 4629, 491, 599, 9732, 4097, 13, 9651, 23134, 29918, 7224, 353, 518, 842, 29898, 657, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 798, 1839, 1272, 25901, 363, 1948, 297, 4206, 29962, 13, 9651, 5544, 747, 9770, 353, 2656, 29918, 26679, 4127, 29918, 1761, 29898, 1761, 29898, 842, 29889, 1639, 2042, 10456, 26679, 4127, 29918, 7224, 4961, 13, 4706, 25342, 10104, 29918, 710, 8963, 1275, 376, 272, 29908, 470, 10104, 29918, 710, 8963, 1275, 376, 497, 29918, 11238, 1115, 13, 9651, 396, 7805, 599, 5544, 747, 9770, 2198, 4249, 278, 25495, 13, 9651, 23134, 29918, 7224, 353, 518, 842, 29898, 657, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 798, 1839, 1272, 25901, 363, 1948, 297, 4206, 29962, 13, 9651, 5544, 747, 9770, 353, 2656, 29918, 26679, 4127, 29918, 1761, 29898, 1761, 29898, 842, 29889, 13094, 10456, 26679, 4127, 29918, 7224, 4961, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29908, 12375, 918, 13705, 285, 29912, 9778, 918, 29918, 710, 8963, 29913, 9815, 23157, 13, 1678, 565, 5544, 747, 9770, 338, 6213, 29901, 13, 4706, 5544, 747, 9770, 353, 679, 29918, 21134, 29918, 3166, 29918, 26679, 4127, 29918, 1807, 29898, 1272, 29897, 13, 1678, 736, 5544, 747, 9770, 29892, 14529, 29918, 4882, 13, 13, 13, 1753, 679, 29918, 6735, 630, 29918, 26679, 4127, 29918, 2176, 29898, 5527, 29176, 29918, 13628, 29918, 18253, 29922, 29900, 29889, 29896, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 2457, 29901, 349, 7086, 3630, 4308, 411, 278, 1494, 4341, 29901, 13, 4706, 3268, 29918, 333, 29892, 8955, 29918, 3398, 29892, 338, 29918, 6735, 630, 29892, 14529, 29918, 4882, 29892, 5544, 747, 9770, 29892, 426, 26679, 4127, 29918, 978, 2403, 13628, 29892, 8955, 29918, 726, 13, 13, 1678, 9995, 13, 1678, 23134, 29918, 6735, 800, 353, 679, 29918, 26679, 4127, 29918, 6735, 800, 580, 13, 1678, 4489, 29918, 26586, 353, 5159, 13, 1678, 363, 1153, 297, 260, 29939, 18933, 29898, 26679, 4127, 29918, 6735, 800, 1125, 13, 4706, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 1153, 1839, 2746, 29918, 333, 7464, 1153, 1839, 29926, 4659, 29918, 3398, 2033, 13, 4706, 5544, 747, 9770, 353, 1153, 1839, 26679, 747, 9770, 2033, 13, 4706, 8955, 29918, 726, 353, 679, 29918, 29926, 4659, 29918, 726, 29898, 2746, 29918, 333, 29892, 8955, 29918, 3398, 29897, 13, 4706, 565, 8955, 29918, 726, 338, 6213, 29901, 13, 9651, 6773, 13, 4706, 14529, 29918, 4882, 353, 1153, 1839, 5527, 29176, 29918, 4882, 2033, 13, 4706, 716, 29918, 8269, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 268, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 268, 525, 275, 29918, 6735, 630, 2396, 5852, 29892, 13, 462, 268, 525, 5527, 29176, 29918, 4882, 2396, 1153, 1839, 5527, 29176, 29918, 4882, 7464, 13, 462, 268, 525, 26679, 747, 9770, 2396, 5544, 747, 9770, 29892, 13, 462, 268, 525, 29926, 4659, 29918, 726, 2396, 8955, 29918, 726, 29913, 13, 4706, 363, 4613, 29918, 1643, 297, 23134, 29918, 21134, 29901, 13, 9651, 8158, 353, 938, 29898, 13713, 29918, 1643, 297, 5544, 747, 9770, 29897, 13, 9651, 565, 14529, 29918, 4882, 1275, 376, 6007, 29943, 5265, 1783, 29908, 322, 8158, 1275, 29871, 29896, 29901, 13, 18884, 8158, 22361, 14529, 29918, 13628, 29918, 18253, 13, 9651, 716, 29918, 8269, 29961, 13713, 29918, 1643, 718, 11119, 13628, 3108, 353, 8158, 13, 4706, 4489, 29918, 26586, 29889, 4397, 29898, 1482, 29918, 8269, 29897, 13, 1678, 4489, 353, 10518, 29889, 17271, 29898, 2176, 29918, 26586, 29897, 13, 1678, 736, 4489, 13, 13, 13, 1753, 679, 29918, 6735, 630, 29918, 26679, 4127, 29918, 2176, 29918, 20227, 29898, 5527, 29176, 29918, 13628, 29918, 18253, 29922, 29900, 29889, 29896, 29892, 4613, 29918, 6484, 29922, 26679, 4127, 29918, 21134, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 2457, 29901, 349, 7086, 3630, 4308, 411, 278, 1494, 4341, 29901, 13, 4706, 3268, 29918, 333, 29892, 8955, 29918, 3398, 29892, 338, 29918, 6735, 630, 29892, 14529, 29918, 4882, 29892, 5544, 747, 9770, 29892, 426, 26679, 4127, 29918, 978, 2403, 13628, 29892, 8955, 29918, 726, 13, 13, 1678, 9995, 13, 1678, 4489, 353, 679, 29918, 26679, 4127, 29918, 6735, 800, 29918, 1272, 2557, 580, 13, 1678, 4489, 1839, 29926, 4659, 29918, 726, 2033, 353, 4489, 29889, 7302, 29898, 2892, 1948, 29901, 679, 29918, 29926, 4659, 29918, 726, 29898, 798, 29889, 2746, 29918, 333, 29892, 1948, 29889, 29926, 4659, 29918, 3398, 511, 9685, 29922, 29896, 29897, 13, 1678, 4489, 29889, 8865, 29898, 2176, 29961, 2176, 29889, 29926, 4659, 29918, 726, 29889, 275, 1056, 580, 1822, 2248, 29892, 297, 6689, 29922, 5574, 29897, 13, 1678, 4974, 7442, 29889, 2083, 29898, 2176, 29889, 29926, 4659, 29918, 726, 29889, 275, 1056, 3101, 1275, 29871, 29900, 13, 1678, 4489, 1839, 275, 29918, 6735, 630, 2033, 353, 5852, 13, 1678, 363, 4613, 29918, 1643, 297, 4613, 29918, 6484, 29901, 13, 4706, 4489, 29961, 13713, 29918, 1643, 718, 11119, 13628, 3108, 353, 4489, 29889, 7302, 29898, 2892, 1948, 29901, 938, 29898, 13713, 29918, 1643, 297, 1948, 29889, 26679, 747, 9770, 29897, 448, 14529, 29918, 13628, 29918, 18253, 565, 1948, 29889, 5527, 29176, 29918, 4882, 1275, 376, 6007, 29943, 5265, 1783, 29908, 1683, 938, 29898, 13713, 29918, 1643, 297, 1948, 29889, 26679, 747, 9770, 511, 9685, 29922, 29896, 29897, 13, 1678, 4489, 29889, 12071, 29918, 2248, 29898, 262, 6689, 29922, 5574, 29897, 13, 1678, 736, 4489, 13, 13, 13, 1753, 788, 29918, 29926, 2905, 1338, 29918, 517, 29918, 26679, 4127, 29918, 2176, 29898, 2176, 29892, 716, 29918, 26586, 1125, 13, 1678, 9995, 13, 1678, 3462, 278, 2183, 518, 348, 6735, 630, 29962, 21824, 1338, 304, 278, 2183, 4489, 29889, 13, 13, 1678, 584, 3207, 4489, 29901, 319, 4489, 5759, 491, 679, 29918, 6735, 630, 29918, 26679, 4127, 29918, 2176, 580, 13, 1678, 584, 3207, 716, 29918, 26586, 29901, 319, 1051, 310, 21503, 4314, 6943, 278, 6611, 525, 2746, 29918, 333, 29915, 322, 525, 29926, 4659, 29918, 3398, 29915, 13, 1678, 584, 2457, 29901, 450, 716, 12205, 6943, 1716, 29889, 13, 1678, 9995, 13, 1678, 4489, 29918, 26586, 353, 5159, 13, 1678, 363, 321, 297, 260, 29939, 18933, 29898, 1482, 29918, 26586, 1125, 13, 4706, 3268, 29918, 333, 29892, 8955, 29918, 3398, 353, 321, 1839, 2746, 29918, 333, 7464, 321, 1839, 29926, 4659, 29918, 3398, 2033, 13, 4706, 8955, 29918, 726, 353, 679, 29918, 29926, 4659, 29918, 726, 29898, 2746, 29918, 333, 29892, 8955, 29918, 3398, 29897, 13, 4706, 565, 8955, 29918, 726, 338, 6213, 29901, 13, 9651, 6773, 13, 4706, 716, 29918, 8269, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 268, 525, 29926, 4659, 29918, 3398, 2396, 8955, 29918, 3398, 29892, 13, 462, 268, 525, 275, 29918, 6735, 630, 2396, 7700, 29892, 13, 462, 268, 525, 5527, 29176, 29918, 4882, 2396, 6213, 29892, 13, 462, 268, 525, 26679, 747, 9770, 2396, 19997, 13, 462, 268, 525, 29926, 4659, 29918, 726, 2396, 8955, 29918, 726, 29913, 13, 4706, 4489, 29918, 26586, 29889, 4397, 29898, 1482, 29918, 8269, 29897, 13, 1678, 443, 6735, 630, 29918, 2176, 353, 10518, 29889, 17271, 29898, 2176, 29918, 26586, 29897, 13, 1678, 716, 29918, 2176, 353, 10518, 29889, 17685, 4197, 2176, 29892, 443, 6735, 630, 29918, 2176, 1402, 11455, 29918, 2248, 29922, 5574, 29897, 13, 1678, 716, 29918, 2176, 29889, 8865, 29918, 20908, 15815, 29898, 6484, 29922, 1839, 2746, 29918, 333, 742, 525, 29926, 4659, 29918, 3398, 7464, 3013, 2433, 4102, 742, 297, 6689, 29922, 5574, 29897, 13, 1678, 736, 716, 29918, 2176, 13, 13, 13, 1753, 788, 29918, 16315, 29918, 517, 29918, 26679, 4127, 29918, 2176, 29898, 2176, 29892, 716, 29918, 26586, 29892, 5768, 29918, 20908, 5926, 29918, 29926, 2905, 1338, 29922, 5574, 1125, 13, 1678, 9995, 13, 1678, 3462, 278, 2183, 518, 348, 6735, 630, 29962, 11840, 304, 278, 2183, 4489, 29889, 13, 13, 1678, 584, 3207, 4489, 29901, 319, 4489, 5759, 491, 679, 29918, 6735, 630, 29918, 26679, 4127, 29918, 2176, 580, 13, 1678, 584, 3207, 716, 29918, 26586, 29901, 319, 1051, 310, 6043, 3268, 29918, 4841, 13, 1678, 584, 2457, 29901, 450, 716, 12205, 6943, 599, 21824, 1338, 297, 278, 11840, 18694, 491, 716, 29918, 26586, 13, 1678, 9995, 13, 1678, 4489, 29918, 26586, 353, 5159, 13, 1678, 363, 3268, 29918, 333, 297, 260, 29939, 18933, 29898, 1482, 29918, 26586, 1125, 13, 4706, 21824, 1338, 353, 679, 29918, 29926, 4659, 29918, 3888, 29898, 2746, 29918, 333, 29897, 13, 4706, 363, 8955, 297, 21824, 1338, 29901, 13, 9651, 8955, 29918, 726, 353, 679, 29918, 29926, 4659, 29918, 726, 29918, 276, 26081, 29898, 29926, 4659, 29897, 13, 9651, 565, 8955, 29918, 726, 338, 6213, 29901, 13, 18884, 6773, 13, 9651, 716, 29918, 8269, 353, 11117, 2746, 29918, 333, 2396, 3268, 29918, 333, 29892, 13, 462, 308, 525, 29926, 4659, 29918, 3398, 2396, 8955, 1839, 29926, 4659, 29918, 3398, 7464, 13, 462, 308, 525, 275, 29918, 6735, 630, 2396, 7700, 29892, 13, 462, 308, 525, 5527, 29176, 29918, 4882, 2396, 6213, 29892, 13, 462, 308, 525, 26679, 747, 9770, 2396, 19997, 13, 462, 308, 525, 29926, 4659, 29918, 726, 2396, 8955, 29918, 726, 29913, 13, 9651, 4489, 29918, 26586, 29889, 4397, 29898, 1482, 29918, 8269, 29897, 13, 1678, 443, 6735, 630, 29918, 2176, 353, 10518, 29889, 17271, 29898, 2176, 29918, 26586, 29897, 13, 1678, 716, 29918, 2176, 353, 10518, 29889, 17685, 4197, 2176, 29892, 443, 6735, 630, 29918, 2176, 1402, 11455, 29918, 2248, 29922, 5574, 29897, 13, 1678, 565, 5768, 29918, 20908, 5926, 29918, 29926, 2905, 1338, 29901, 13, 4706, 716, 29918, 2176, 29889, 8865, 29918, 20908, 15815, 29898, 6484, 29922, 1839, 2746, 29918, 333, 742, 525, 29926, 4659, 29918, 3398, 7464, 3013, 2433, 4102, 742, 297, 6689, 29922, 5574, 29897, 13, 1678, 736, 716, 29918, 2176, 13, 2 ]
model/ff.py
nashory/rtic-gcn-pytorch
6
188555
import torch import torch.nn as nn from block import fusions from model.base import ImageEncoderTextEncoderBase class FeatureFusionMethod(ImageEncoderTextEncoderBase): """FeatureFusionMethod""" def __init__(self, cfg, texts): super(FeatureFusionMethod, self).__init__(cfg, texts) ff_type = cfg.TRAIN.MODEL.composer_model.name assert ff_type in fusions.__dict__, f"Invalid fusion method is given: {ff_type}" _in_c = [self.out_feature_image, self.out_feature_text] _out_c = self.out_feature_image self.model["fusion"] = fusions.__dict__[ff_type](_in_c, _out_c) # define model self.model = nn.ModuleDict(self.model) def compose_img_text(self, f_img, f_text): return self.model["fusion"]((f_img, f_text))
[ 1, 1053, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 3166, 2908, 1053, 16451, 1080, 13, 13, 3166, 1904, 29889, 3188, 1053, 7084, 8566, 6119, 1626, 8566, 6119, 5160, 13, 13, 13, 1990, 5169, 1535, 29943, 3958, 4062, 29898, 2940, 8566, 6119, 1626, 8566, 6119, 5160, 1125, 13, 1678, 9995, 19132, 29943, 3958, 4062, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 274, 16434, 29892, 26442, 1125, 13, 4706, 2428, 29898, 19132, 29943, 3958, 4062, 29892, 1583, 467, 1649, 2344, 12035, 16859, 29892, 26442, 29897, 13, 4706, 14336, 29918, 1853, 353, 274, 16434, 29889, 29911, 4717, 1177, 29889, 20387, 29931, 29889, 22410, 261, 29918, 4299, 29889, 978, 13, 4706, 4974, 14336, 29918, 1853, 297, 16451, 1080, 17255, 8977, 1649, 29892, 285, 29908, 13919, 21736, 1158, 338, 2183, 29901, 426, 600, 29918, 1853, 5038, 13, 4706, 903, 262, 29918, 29883, 353, 518, 1311, 29889, 449, 29918, 14394, 29918, 3027, 29892, 1583, 29889, 449, 29918, 14394, 29918, 726, 29962, 13, 4706, 903, 449, 29918, 29883, 353, 1583, 29889, 449, 29918, 14394, 29918, 3027, 13, 4706, 1583, 29889, 4299, 3366, 29888, 3958, 3108, 353, 16451, 1080, 17255, 8977, 1649, 29961, 600, 29918, 1853, 850, 29918, 262, 29918, 29883, 29892, 903, 449, 29918, 29883, 29897, 13, 13, 4706, 396, 4529, 1904, 13, 4706, 1583, 29889, 4299, 353, 302, 29876, 29889, 7355, 21533, 29898, 1311, 29889, 4299, 29897, 13, 13, 1678, 822, 27435, 29918, 2492, 29918, 726, 29898, 1311, 29892, 285, 29918, 2492, 29892, 285, 29918, 726, 1125, 13, 4706, 736, 1583, 29889, 4299, 3366, 29888, 3958, 29908, 850, 29898, 29888, 29918, 2492, 29892, 285, 29918, 726, 876, 13, 2 ]
videoSources.py
mralext20/neos-video-backend
1
179524
youtubePlaylists = [ "PLxAzjHbHvNcUvcajBsGW2VI6fyIWa4sVl", # ProbablePrime "PLjux6EKYfu0045V_-s5l9biu55fzbWFAO", # Deloious Jax "PLoAvz0_U4_3wuXXrl8IbyJIYZFdeIgyHm", # Frooxius "PLSa764cPPsV9saKq_9Sb_izfwgI9cY-8u", # CuriosVR.. coffee "PLWhfKbDgR4zD-o31sgHqesncjt49Jxou7", # AMoB tutorials "PLFYjCoKo3ivA67rj20lIsmUG2AQoavYHG", # <NAME> "<KEY>", # Turk "PLSB-6Ok84ZR0Ow4ziNWuFLGTgf3M1JDKT", # sirkitree "PL<KEY>", # dev tips from Mystic Forge "PLxzYbxVivbzR5z8FQ<KEY>", # jiink's neos tutorials "PLpwEkiuuwBpACPqbsPKuJOLTQsFz4Q-7C", # Nicole+ "PLh_pMt0Xa7j8UQJ3fzJMvdTHduACp4jpP", # Engi ]
[ 1, 366, 29873, 4003, 13454, 21513, 353, 518, 13, 1678, 376, 7390, 29916, 16748, 29926, 29950, 29890, 29950, 29894, 29940, 29883, 29965, 29894, 1113, 29926, 29933, 29879, 29954, 29956, 29906, 18118, 29953, 29888, 29891, 29902, 29956, 29874, 29946, 29879, 29963, 29880, 613, 29871, 396, 1019, 29890, 519, 4040, 603, 13, 1678, 376, 7390, 29926, 1314, 29953, 29923, 29968, 29979, 21154, 29900, 29900, 29946, 29945, 29963, 29918, 29899, 29879, 29945, 29880, 29929, 5365, 29884, 29945, 29945, 29888, 29920, 29890, 29956, 4519, 29949, 613, 29871, 396, 5556, 29877, 2738, 435, 1165, 13, 1678, 376, 29925, 3410, 12810, 29920, 29900, 29918, 29965, 29946, 29918, 29941, 29893, 29884, 6247, 2096, 29947, 29902, 1609, 29967, 29902, 29979, 29999, 29943, 311, 29902, 1927, 29950, 29885, 613, 29871, 396, 25022, 2251, 2482, 13, 1678, 376, 7390, 17618, 29955, 29953, 29946, 29883, 18009, 29879, 29963, 29929, 4977, 29968, 29939, 29918, 29929, 29903, 29890, 29918, 466, 25051, 29887, 29902, 29929, 29883, 29979, 29899, 29947, 29884, 613, 29871, 396, 10837, 2363, 29963, 29934, 636, 26935, 13, 1678, 376, 7390, 8809, 29888, 29968, 29890, 29928, 29887, 29934, 29946, 29920, 29928, 29899, 29877, 29941, 29896, 5311, 29950, 29939, 267, 17608, 22779, 29946, 29929, 29967, 29916, 283, 29955, 613, 29871, 396, 13862, 29877, 29933, 25410, 13, 1678, 376, 7390, 29943, 29979, 29926, 7967, 29968, 29877, 29941, 440, 29909, 29953, 29955, 29878, 29926, 29906, 29900, 29880, 3624, 29885, 23338, 29906, 29909, 29984, 29877, 485, 29979, 29950, 29954, 613, 29871, 396, 529, 5813, 29958, 13, 1678, 9872, 10818, 28341, 29871, 396, 16559, 13, 1678, 376, 7390, 1744, 29899, 29953, 20434, 29947, 29946, 29999, 29934, 29900, 29949, 29893, 29946, 2526, 29940, 29956, 29884, 10536, 23799, 29887, 29888, 29941, 29924, 29896, 29967, 17359, 29911, 613, 29871, 396, 269, 6793, 277, 929, 13, 1678, 376, 7390, 29966, 10818, 28341, 29871, 396, 2906, 25562, 515, 22890, 293, 1152, 479, 13, 1678, 376, 7390, 29916, 29920, 29979, 29890, 29916, 29963, 440, 29890, 29920, 29934, 29945, 29920, 29947, 29943, 29984, 29966, 10818, 28341, 29871, 396, 19841, 682, 29915, 29879, 452, 359, 25410, 13, 1678, 376, 7390, 29886, 29893, 29923, 1984, 29884, 7262, 29933, 29886, 2477, 29925, 29939, 5824, 21738, 29884, 29967, 5607, 29911, 29984, 29879, 29943, 29920, 29946, 29984, 29899, 29955, 29907, 613, 29871, 396, 405, 23249, 29974, 13, 1678, 376, 7390, 29882, 29918, 29886, 29924, 29873, 29900, 29990, 29874, 29955, 29926, 29947, 29965, 29984, 29967, 29941, 29888, 29920, 29967, 29924, 27491, 4690, 700, 2477, 29886, 29946, 16865, 29925, 613, 29871, 396, 2201, 29875, 13, 29962, 13, 2 ]
harvester/sharekit/tests/factories.py
surfedushare/search-portal
2
38420
<gh_stars>1-10 import os import factory from datetime import datetime from urllib.parse import quote from django.conf import settings from django.utils.timezone import make_aware from sharekit.models import SharekitMetadataHarvest class SharekitMetadataHarvestFactory(factory.django.DjangoModelFactory): class Meta: model = SharekitMetadataHarvest strategy = factory.BUILD_STRATEGY class Params: set = "edusources" is_initial = True is_empty = False number = 0 is_restricted = False since = factory.Maybe( "is_initial", make_aware(datetime(year=1970, month=1, day=1)), make_aware(datetime(year=2020, month=2, day=10, hour=13, minute=8, second=39, microsecond=315000)) ) set_specification = "edusources" status = 200 head = { "content-type": "application/json" } @factory.lazy_attribute def set_specification(self): return "edusourcesprivate" if self.is_restricted else "edusources" @factory.lazy_attribute def uri(self): base = f"api.acc.surfsharekit.nl/api/jsonapi/channel/v1/{self.set_specification}/repoItems?" modified_parameter = quote(f"filter[modified][GE]={self.since:%Y-%m-%dT%H:%M:%SZ}", safe="=") page_size_parameter = quote("page[size]=25", safe="=") page_number_parameter = quote(f"page[number]={self.number+1}", safe="=") if self.is_initial and self.number > 0: params = [modified_parameter, page_number_parameter, page_size_parameter] else: params = [modified_parameter, page_size_parameter] return base + "&".join(params) @factory.lazy_attribute def request(self): return { "args": [self.set_specification, f"{self.since:%Y-%m-%dT%H:%M:%SZ}"], "kwargs": {}, "method": "get", "url": "https://" + self.uri, "headers": {}, "data": {} } @factory.lazy_attribute def body(self): if self.is_empty: response_type = "empty" elif self.is_initial: response_type = "initial" else: response_type = "delta" response_file = f"sharekit-api.{response_type}.{self.number}.json" response_file_path = os.path.join(settings.BASE_DIR, "sharekit", "fixtures", response_file) with open(response_file_path, "r") as response: response_string = response.read() # We modify the reference to the own link to indicate the link has restricted materials if necessary if self.is_restricted: return response_string.replace("/edusources/", "/edusourcesprivate/") return response_string @classmethod def create_common_sharekit_responses(cls, include_delta=False, is_restricted=False): cls.create(is_initial=True, number=0, is_restricted=is_restricted) cls.create(is_initial=True, number=1, is_restricted=is_restricted) if include_delta: cls.create(is_initial=False, number=0, is_restricted=is_restricted)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 12529, 13, 3166, 12865, 1053, 12865, 13, 3166, 3142, 1982, 29889, 5510, 1053, 14978, 13, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 13239, 29889, 2230, 8028, 1053, 1207, 29918, 28327, 13, 13, 3166, 6232, 7354, 29889, 9794, 1053, 26849, 7354, 18417, 21972, 10147, 13, 13, 13, 1990, 26849, 7354, 18417, 21972, 10147, 5126, 29898, 14399, 29889, 14095, 29889, 29928, 5364, 3195, 5126, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 26849, 7354, 18417, 21972, 10147, 13, 4706, 13705, 353, 12529, 29889, 29933, 25282, 29918, 10810, 3040, 29954, 29979, 13, 13, 1678, 770, 1459, 2232, 29901, 13, 4706, 731, 353, 376, 287, 375, 2863, 29908, 13, 4706, 338, 29918, 11228, 353, 5852, 13, 4706, 338, 29918, 6310, 353, 7700, 13, 4706, 1353, 353, 29871, 29900, 13, 4706, 338, 29918, 5060, 4146, 287, 353, 7700, 13, 13, 1678, 1951, 353, 12529, 29889, 22762, 29898, 13, 4706, 376, 275, 29918, 11228, 613, 13, 4706, 1207, 29918, 28327, 29898, 12673, 29898, 6360, 29922, 29896, 29929, 29955, 29900, 29892, 4098, 29922, 29896, 29892, 2462, 29922, 29896, 8243, 13, 4706, 1207, 29918, 28327, 29898, 12673, 29898, 6360, 29922, 29906, 29900, 29906, 29900, 29892, 4098, 29922, 29906, 29892, 2462, 29922, 29896, 29900, 29892, 7234, 29922, 29896, 29941, 29892, 11015, 29922, 29947, 29892, 1473, 29922, 29941, 29929, 29892, 9200, 7496, 29922, 29941, 29896, 29945, 29900, 29900, 29900, 876, 13, 1678, 1723, 13, 1678, 731, 29918, 6550, 2450, 353, 376, 287, 375, 2863, 29908, 13, 1678, 4660, 353, 29871, 29906, 29900, 29900, 13, 1678, 2343, 353, 426, 13, 4706, 376, 3051, 29899, 1853, 1115, 376, 6214, 29914, 3126, 29908, 13, 1678, 500, 13, 13, 1678, 732, 14399, 29889, 433, 1537, 29918, 12715, 13, 1678, 822, 731, 29918, 6550, 2450, 29898, 1311, 1125, 13, 4706, 736, 376, 287, 375, 2863, 9053, 29908, 565, 1583, 29889, 275, 29918, 5060, 4146, 287, 1683, 376, 287, 375, 2863, 29908, 13, 13, 1678, 732, 14399, 29889, 433, 1537, 29918, 12715, 13, 1678, 822, 21333, 29898, 1311, 1125, 13, 4706, 2967, 353, 285, 29908, 2754, 29889, 5753, 29889, 7610, 29888, 13653, 7354, 29889, 12938, 29914, 2754, 29914, 3126, 2754, 29914, 12719, 29914, 29894, 29896, 19248, 1311, 29889, 842, 29918, 6550, 2450, 6822, 20095, 6913, 3026, 13, 4706, 9120, 29918, 15501, 353, 14978, 29898, 29888, 29908, 4572, 29961, 1545, 2164, 3816, 1692, 29962, 3790, 1311, 29889, 16076, 16664, 29979, 19222, 29885, 19222, 29881, 29911, 29995, 29950, 16664, 29924, 16664, 29903, 29999, 17671, 9109, 543, 543, 29897, 13, 4706, 1813, 29918, 2311, 29918, 15501, 353, 14978, 703, 3488, 29961, 2311, 13192, 29906, 29945, 613, 9109, 543, 543, 29897, 13, 4706, 1813, 29918, 4537, 29918, 15501, 353, 14978, 29898, 29888, 29908, 3488, 29961, 4537, 29962, 3790, 1311, 29889, 4537, 29974, 29896, 17671, 9109, 543, 543, 29897, 13, 4706, 565, 1583, 29889, 275, 29918, 11228, 322, 1583, 29889, 4537, 1405, 29871, 29900, 29901, 13, 9651, 8636, 353, 518, 1545, 2164, 29918, 15501, 29892, 1813, 29918, 4537, 29918, 15501, 29892, 1813, 29918, 2311, 29918, 15501, 29962, 13, 4706, 1683, 29901, 13, 9651, 8636, 353, 518, 1545, 2164, 29918, 15501, 29892, 1813, 29918, 2311, 29918, 15501, 29962, 13, 4706, 736, 2967, 718, 376, 29987, 1642, 7122, 29898, 7529, 29897, 13, 13, 1678, 732, 14399, 29889, 433, 1537, 29918, 12715, 13, 1678, 822, 2009, 29898, 1311, 1125, 13, 4706, 736, 426, 13, 9651, 376, 5085, 1115, 518, 1311, 29889, 842, 29918, 6550, 2450, 29892, 285, 29908, 29912, 1311, 29889, 16076, 16664, 29979, 19222, 29885, 19222, 29881, 29911, 29995, 29950, 16664, 29924, 16664, 29903, 29999, 5038, 1402, 13, 9651, 376, 19290, 1115, 24335, 13, 9651, 376, 5696, 1115, 376, 657, 613, 13, 9651, 376, 2271, 1115, 376, 991, 597, 29908, 718, 1583, 29889, 5338, 29892, 13, 9651, 376, 13662, 1115, 24335, 13, 9651, 376, 1272, 1115, 6571, 13, 4706, 500, 13, 13, 1678, 732, 14399, 29889, 433, 1537, 29918, 12715, 13, 1678, 822, 3573, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 275, 29918, 6310, 29901, 13, 9651, 2933, 29918, 1853, 353, 376, 6310, 29908, 13, 4706, 25342, 1583, 29889, 275, 29918, 11228, 29901, 13, 9651, 2933, 29918, 1853, 353, 376, 11228, 29908, 13, 4706, 1683, 29901, 13, 9651, 2933, 29918, 1853, 353, 376, 4181, 29908, 13, 4706, 2933, 29918, 1445, 353, 285, 29908, 13653, 7354, 29899, 2754, 29889, 29912, 5327, 29918, 1853, 1836, 29912, 1311, 29889, 4537, 1836, 3126, 29908, 13, 4706, 2933, 29918, 1445, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 11027, 29889, 25416, 29918, 9464, 29892, 376, 13653, 7354, 613, 376, 7241, 486, 1973, 613, 2933, 29918, 1445, 29897, 13, 4706, 411, 1722, 29898, 5327, 29918, 1445, 29918, 2084, 29892, 376, 29878, 1159, 408, 2933, 29901, 13, 9651, 2933, 29918, 1807, 353, 2933, 29889, 949, 580, 13, 9651, 396, 1334, 6623, 278, 3407, 304, 278, 1914, 1544, 304, 12266, 278, 1544, 756, 22078, 17279, 565, 5181, 13, 9651, 565, 1583, 29889, 275, 29918, 5060, 4146, 287, 29901, 13, 18884, 736, 2933, 29918, 1807, 29889, 6506, 11974, 287, 375, 2863, 29914, 613, 5591, 287, 375, 2863, 9053, 29914, 1159, 13, 9651, 736, 2933, 29918, 1807, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1653, 29918, 9435, 29918, 13653, 7354, 29918, 26679, 267, 29898, 25932, 29892, 3160, 29918, 4181, 29922, 8824, 29892, 338, 29918, 5060, 4146, 287, 29922, 8824, 1125, 13, 4706, 1067, 29879, 29889, 3258, 29898, 275, 29918, 11228, 29922, 5574, 29892, 1353, 29922, 29900, 29892, 338, 29918, 5060, 4146, 287, 29922, 275, 29918, 5060, 4146, 287, 29897, 13, 4706, 1067, 29879, 29889, 3258, 29898, 275, 29918, 11228, 29922, 5574, 29892, 1353, 29922, 29896, 29892, 338, 29918, 5060, 4146, 287, 29922, 275, 29918, 5060, 4146, 287, 29897, 13, 4706, 565, 3160, 29918, 4181, 29901, 13, 9651, 1067, 29879, 29889, 3258, 29898, 275, 29918, 11228, 29922, 8824, 29892, 1353, 29922, 29900, 29892, 338, 29918, 5060, 4146, 287, 29922, 275, 29918, 5060, 4146, 287, 29897, 13, 2 ]
mergeKsortedlist.py
ZhouLihua/leetcode
2
15645
#Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None import sys class Solution(object): def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode """ temp = ListNode(-1) result = temp null_lists = 0 while lists: while null_lists > 0: lists.remove(None) null_lists -= 1 min_node = ListNode(sys.maxint) order = -1 for index, node in enumerate(lists): if not node: null_lists += 1 continue if node.val < min_node.val: order, min_node = index, node if order != -1: temp.next = ListNode(min_node.val) temp = temp.next lists[order] = lists[order].next return result.next
[ 1, 396, 14683, 363, 1809, 368, 29899, 2324, 287, 1051, 29889, 13, 1990, 2391, 4247, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 921, 1125, 13, 4706, 1583, 29889, 791, 353, 921, 13, 4706, 1583, 29889, 4622, 353, 6213, 13, 13, 5215, 10876, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 10366, 29968, 1293, 29879, 29898, 1311, 29892, 8857, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 8857, 29901, 2391, 29961, 1293, 4247, 29962, 13, 4706, 584, 29878, 1853, 29901, 2391, 4247, 13, 4706, 9995, 13, 4706, 5694, 353, 2391, 4247, 6278, 29896, 29897, 13, 4706, 1121, 353, 5694, 13, 4706, 1870, 29918, 21513, 353, 29871, 29900, 13, 4706, 1550, 8857, 29901, 13, 9651, 1550, 1870, 29918, 21513, 1405, 29871, 29900, 29901, 13, 18884, 8857, 29889, 5992, 29898, 8516, 29897, 13, 18884, 1870, 29918, 21513, 22361, 29871, 29896, 13, 9651, 1375, 29918, 3177, 353, 2391, 4247, 29898, 9675, 29889, 3317, 524, 29897, 13, 9651, 1797, 353, 448, 29896, 13, 9651, 363, 2380, 29892, 2943, 297, 26985, 29898, 21513, 1125, 13, 18884, 565, 451, 2943, 29901, 13, 462, 1678, 1870, 29918, 21513, 4619, 29871, 29896, 13, 462, 1678, 6773, 13, 18884, 565, 2943, 29889, 791, 529, 1375, 29918, 3177, 29889, 791, 29901, 13, 462, 1678, 1797, 29892, 1375, 29918, 3177, 353, 2380, 29892, 2943, 13, 9651, 565, 1797, 2804, 448, 29896, 29901, 13, 18884, 5694, 29889, 4622, 353, 2391, 4247, 29898, 1195, 29918, 3177, 29889, 791, 29897, 13, 18884, 5694, 353, 5694, 29889, 4622, 13, 18884, 8857, 29961, 2098, 29962, 353, 8857, 29961, 2098, 1822, 4622, 13, 13, 4706, 736, 1121, 29889, 4622, 13, 2 ]
moulin/yaml_wrapper.py
Deedone/moulin
0
112787
# SPDX-License-Identifier: Apache-2.0 # Copyright 2021 EPAM Systems """ Wrappers for yaml.Node that provide better API """ from typing import Optional, List, Tuple, Iterator, Union from yaml.nodes import MappingNode, ScalarNode, SequenceNode, Node from yaml.constructor import SafeConstructor from yaml.representer import SafeRepresenter from yaml import Mark from moulin.yaml_helpers import YAMLProcessingError yaml_constructor = SafeConstructor() class _YamlDefaultValue: """ Helper class that have the same API as YamlValue, but is constructed from a primitive type. It is used to provide default value in YamlValue.get() method """ def __init__(self, val: Union[bool, str, int, float, None]): self._val = val def __bool__(self): return self._val is not None @property def as_bool(self) -> bool: "Get the boolean value" if not isinstance(self._val, bool): raise TypeError("Expected boolean value") return self._val @property def as_str(self) -> str: "Get the string value" if not isinstance(self._val, str): raise TypeError("Expected boolean value") return self._val @property def as_int(self) -> int: "Get the integer value" if not isinstance(self._val, int): raise TypeError("Expected boolean value") return self._val @property def as_float(self) -> float: "Get the floating point value" if not isinstance(self._val, int): raise TypeError("Expected boolean value") return self._val class YamlValue: # pylint: disable=too-few-public-methods """Wrapper for yaml.Node class. It provides type-safe access to YAML nodes""" def __init__(self, node: Node): self._node = node if isinstance(node, ScalarNode): self._val = yaml_constructor.construct_object(node) else: self._val = None @property def mark(self) -> Mark: "Get the start mark for YAML Node" return self._node.start_mark @property def as_bool(self) -> bool: "Get the boolean value" if not isinstance(self._val, bool): raise YAMLProcessingError(f"Expected boolean value, got {type(self._val)}", self.mark) return self._val @property def as_str(self) -> str: "Get the string value" if not isinstance(self._val, str): raise YAMLProcessingError(f"Expected string value, got {type(self._val)}", self.mark) return self._val @property def as_int(self) -> int: "Get the integer value" if not isinstance(self._val, int): raise YAMLProcessingError(f"Expected integer value, got {type(self._val)}", self.mark) return self._val @property def as_float(self) -> float: "Get the floating point value" if not isinstance(self._val, int): raise YAMLProcessingError(f"Expected floating point value, got {type(self._val)}", self.mark) return self._val @property def is_list(self) -> bool: """Check if this node represents a list""" return isinstance(self._node, SequenceNode) def _get(self, name: str) -> Optional["YamlValue"]: "Get optional value by name" if not isinstance(self._node, MappingNode): raise YAMLProcessingError("Mapping node is expected", self.mark) for key, val in self._node.value: if key.value == name: return YamlValue(val) return None def get(self, name: str, default) -> Union["YamlValue", _YamlDefaultValue]: "Get optional value by name" val = self._get(name) if val: return val return _YamlDefaultValue(default) def keys(self) -> List[str]: """Get all keys for this mapping""" if not isinstance(self._node, MappingNode): raise YAMLProcessingError("Mapping node is expected", self.mark) return [key.value for key, _ in self._node.value] def items(self) -> List[Tuple[str, "YamlValue"]]: """Get all items for this mapping""" if not isinstance(self._node, MappingNode): raise YAMLProcessingError("Mapping node is expected", self.mark) return [(key.value, YamlValue(val)) for key, val in self._node.value] def replace_value(self, val: Union[str, int, bool, float]): "Set a new value for a scalar node" if not isinstance(self._node, ScalarNode): raise YAMLProcessingError("Can't replace value for a non-scalar node", self.mark) self._node.value = val def __getitem__(self, idx: Union[str, int]) -> "YamlValue": if isinstance(idx, int): if not isinstance(self._node, SequenceNode): raise YAMLProcessingError("SequenceNode node is expected", self.mark) return YamlValue(self._node.value[idx]) if isinstance(idx, str): val = self._get(idx) if not val: raise YAMLProcessingError(f"Key '{idx}' is mandatory", self.mark) return val raise KeyError("Key should have either type 'str' or 'int'") def __setitem__(self, idx: Union[str, int], val: Union[str, int, bool, float]): if isinstance(idx, int): if not isinstance(self._node, SequenceNode): raise YAMLProcessingError("SequenceNode node is expected", self.mark) self._node.value[idx].replace_value(val) if isinstance(idx, str): item = self._get(idx) if item: item.replace_value(val) else: representer = SafeRepresenter() key_node = representer.represent_str(idx) if isinstance(val, str): val_node = representer.represent_str(val) elif isinstance(val, int): val_node = representer.represent_int(val) elif isinstance(val, bool): val_node = representer.represent_bool(val) else: val_node = representer.represent_float(val) self._node.value.append((key_node, val_node)) raise KeyError("Key should have either type 'str' or 'int'") def __iter__(self) -> Iterator["YamlValue"]: for item in self._node.value: yield YamlValue(item) def __len__(self) -> int: return len(self._node.value)
[ 1, 396, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 13380, 29899, 29906, 29889, 29900, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 16502, 5194, 23985, 13, 15945, 29908, 13, 29956, 336, 22437, 363, 343, 8807, 29889, 4247, 393, 3867, 2253, 3450, 13, 15945, 29908, 13, 13, 3166, 19229, 1053, 28379, 29892, 2391, 29892, 12603, 552, 29892, 20504, 1061, 29892, 7761, 13, 13, 3166, 343, 8807, 29889, 18010, 1053, 341, 20304, 4247, 29892, 317, 1052, 279, 4247, 29892, 922, 3910, 4247, 29892, 9071, 13, 3166, 343, 8807, 29889, 27821, 1053, 5701, 1725, 23770, 13, 3166, 343, 8807, 29889, 276, 6338, 261, 1053, 5701, 1725, 1123, 6338, 261, 13, 3166, 343, 8807, 1053, 4485, 13, 3166, 29442, 1915, 29889, 25162, 29918, 3952, 6774, 1053, 612, 23956, 7032, 292, 2392, 13, 13, 25162, 29918, 27821, 353, 5701, 1725, 23770, 580, 13, 13, 13, 1990, 903, 29979, 8807, 4592, 1917, 29901, 13, 1678, 9995, 13, 1678, 6162, 546, 770, 393, 505, 278, 1021, 3450, 408, 612, 8807, 1917, 29892, 541, 338, 13, 1678, 13319, 515, 263, 19269, 1134, 29889, 739, 338, 1304, 304, 3867, 2322, 13, 1678, 995, 297, 612, 8807, 1917, 29889, 657, 580, 1158, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 659, 29901, 7761, 29961, 11227, 29892, 851, 29892, 938, 29892, 5785, 29892, 6213, 29962, 1125, 13, 4706, 1583, 3032, 791, 353, 659, 13, 13, 1678, 822, 4770, 11227, 12035, 1311, 1125, 13, 4706, 736, 1583, 3032, 791, 338, 451, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 11227, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 376, 2577, 278, 7223, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 6120, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 7223, 995, 1159, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 710, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 376, 2577, 278, 1347, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 7223, 995, 1159, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 524, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 376, 2577, 278, 6043, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 938, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 7223, 995, 1159, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 7411, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 376, 2577, 278, 16526, 1298, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 938, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 7223, 995, 1159, 13, 4706, 736, 1583, 3032, 791, 13, 13, 13, 1990, 612, 8807, 1917, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 29888, 809, 29899, 3597, 29899, 23515, 13, 1678, 9995, 15646, 363, 343, 8807, 29889, 4247, 770, 29889, 739, 8128, 1134, 29899, 11177, 2130, 304, 612, 23956, 7573, 15945, 29908, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2943, 29901, 9071, 1125, 13, 4706, 1583, 3032, 3177, 353, 2943, 13, 4706, 565, 338, 8758, 29898, 3177, 29892, 317, 1052, 279, 4247, 1125, 13, 9651, 1583, 3032, 791, 353, 343, 8807, 29918, 27821, 29889, 11433, 29918, 3318, 29898, 3177, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 791, 353, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2791, 29898, 1311, 29897, 1599, 4485, 29901, 13, 4706, 376, 2577, 278, 1369, 2791, 363, 612, 23956, 9071, 29908, 13, 4706, 736, 1583, 3032, 3177, 29889, 2962, 29918, 3502, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 11227, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 376, 2577, 278, 7223, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 6120, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 29898, 29888, 29908, 1252, 6021, 7223, 995, 29892, 2355, 426, 1853, 29898, 1311, 3032, 791, 2915, 613, 1583, 29889, 3502, 29897, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 710, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 376, 2577, 278, 1347, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 851, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 29898, 29888, 29908, 1252, 6021, 1347, 995, 29892, 2355, 426, 1853, 29898, 1311, 3032, 791, 2915, 613, 1583, 29889, 3502, 29897, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 524, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 376, 2577, 278, 6043, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 938, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 29898, 29888, 29908, 1252, 6021, 6043, 995, 29892, 2355, 426, 1853, 29898, 1311, 3032, 791, 2915, 613, 1583, 29889, 3502, 29897, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 408, 29918, 7411, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 376, 2577, 278, 16526, 1298, 995, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 791, 29892, 938, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 29898, 29888, 29908, 1252, 6021, 16526, 1298, 995, 29892, 2355, 426, 1853, 29898, 1311, 3032, 791, 2915, 613, 13, 462, 462, 418, 1583, 29889, 3502, 29897, 13, 4706, 736, 1583, 3032, 791, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 1761, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 5596, 565, 445, 2943, 11524, 263, 1051, 15945, 29908, 13, 4706, 736, 338, 8758, 29898, 1311, 3032, 3177, 29892, 922, 3910, 4247, 29897, 13, 13, 1678, 822, 903, 657, 29898, 1311, 29892, 1024, 29901, 851, 29897, 1599, 28379, 3366, 29979, 8807, 1917, 3108, 29901, 13, 4706, 376, 2577, 13136, 995, 491, 1024, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 341, 20304, 4247, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 703, 15845, 2943, 338, 3806, 613, 1583, 29889, 3502, 29897, 13, 4706, 363, 1820, 29892, 659, 297, 1583, 3032, 3177, 29889, 1767, 29901, 13, 9651, 565, 1820, 29889, 1767, 1275, 1024, 29901, 13, 18884, 736, 612, 8807, 1917, 29898, 791, 29897, 13, 4706, 736, 6213, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1024, 29901, 851, 29892, 2322, 29897, 1599, 7761, 3366, 29979, 8807, 1917, 613, 903, 29979, 8807, 4592, 1917, 5387, 13, 4706, 376, 2577, 13136, 995, 491, 1024, 29908, 13, 4706, 659, 353, 1583, 3032, 657, 29898, 978, 29897, 13, 4706, 565, 659, 29901, 13, 9651, 736, 659, 13, 4706, 736, 903, 29979, 8807, 4592, 1917, 29898, 4381, 29897, 13, 13, 1678, 822, 6611, 29898, 1311, 29897, 1599, 2391, 29961, 710, 5387, 13, 4706, 9995, 2577, 599, 6611, 363, 445, 10417, 15945, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 341, 20304, 4247, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 703, 15845, 2943, 338, 3806, 613, 1583, 29889, 3502, 29897, 13, 4706, 736, 518, 1989, 29889, 1767, 363, 1820, 29892, 903, 297, 1583, 3032, 3177, 29889, 1767, 29962, 13, 13, 1678, 822, 4452, 29898, 1311, 29897, 1599, 2391, 29961, 23215, 552, 29961, 710, 29892, 376, 29979, 8807, 1917, 3108, 5387, 13, 4706, 9995, 2577, 599, 4452, 363, 445, 10417, 15945, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 341, 20304, 4247, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 703, 15845, 2943, 338, 3806, 613, 1583, 29889, 3502, 29897, 13, 4706, 736, 17288, 1989, 29889, 1767, 29892, 612, 8807, 1917, 29898, 791, 876, 363, 1820, 29892, 659, 297, 1583, 3032, 3177, 29889, 1767, 29962, 13, 13, 1678, 822, 5191, 29918, 1767, 29898, 1311, 29892, 659, 29901, 7761, 29961, 710, 29892, 938, 29892, 6120, 29892, 5785, 29962, 1125, 13, 4706, 376, 2697, 263, 716, 995, 363, 263, 17336, 2943, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 317, 1052, 279, 4247, 1125, 13, 9651, 12020, 612, 23956, 7032, 292, 2392, 703, 6028, 29915, 29873, 5191, 995, 363, 263, 1661, 29899, 19529, 279, 2943, 613, 1583, 29889, 3502, 29897, 13, 4706, 1583, 3032, 3177, 29889, 1767, 353, 659, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 22645, 29901, 7761, 29961, 710, 29892, 938, 2314, 1599, 376, 29979, 8807, 1917, 1115, 13, 4706, 565, 338, 8758, 29898, 13140, 29892, 938, 1125, 13, 9651, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 922, 3910, 4247, 1125, 13, 18884, 12020, 612, 23956, 7032, 292, 2392, 703, 20529, 4247, 2943, 338, 3806, 613, 1583, 29889, 3502, 29897, 13, 9651, 736, 612, 8807, 1917, 29898, 1311, 3032, 3177, 29889, 1767, 29961, 13140, 2314, 13, 4706, 565, 338, 8758, 29898, 13140, 29892, 851, 1125, 13, 9651, 659, 353, 1583, 3032, 657, 29898, 13140, 29897, 13, 9651, 565, 451, 659, 29901, 13, 18884, 12020, 612, 23956, 7032, 292, 2392, 29898, 29888, 29908, 2558, 22372, 13140, 10162, 338, 9619, 7606, 613, 1583, 29889, 3502, 29897, 13, 9651, 736, 659, 13, 4706, 12020, 7670, 2392, 703, 2558, 881, 505, 2845, 1134, 525, 710, 29915, 470, 525, 524, 29915, 1159, 13, 13, 1678, 822, 4770, 842, 667, 12035, 1311, 29892, 22645, 29901, 7761, 29961, 710, 29892, 938, 1402, 659, 29901, 7761, 29961, 710, 29892, 938, 29892, 6120, 29892, 5785, 29962, 1125, 13, 4706, 565, 338, 8758, 29898, 13140, 29892, 938, 1125, 13, 9651, 565, 451, 338, 8758, 29898, 1311, 3032, 3177, 29892, 922, 3910, 4247, 1125, 13, 18884, 12020, 612, 23956, 7032, 292, 2392, 703, 20529, 4247, 2943, 338, 3806, 613, 1583, 29889, 3502, 29897, 13, 9651, 1583, 3032, 3177, 29889, 1767, 29961, 13140, 1822, 6506, 29918, 1767, 29898, 791, 29897, 13, 4706, 565, 338, 8758, 29898, 13140, 29892, 851, 1125, 13, 9651, 2944, 353, 1583, 3032, 657, 29898, 13140, 29897, 13, 9651, 565, 2944, 29901, 13, 18884, 2944, 29889, 6506, 29918, 1767, 29898, 791, 29897, 13, 9651, 1683, 29901, 13, 18884, 2755, 261, 353, 5701, 1725, 1123, 6338, 261, 580, 13, 18884, 1820, 29918, 3177, 353, 2755, 261, 29889, 276, 6338, 29918, 710, 29898, 13140, 29897, 13, 18884, 565, 338, 8758, 29898, 791, 29892, 851, 1125, 13, 462, 1678, 659, 29918, 3177, 353, 2755, 261, 29889, 276, 6338, 29918, 710, 29898, 791, 29897, 13, 18884, 25342, 338, 8758, 29898, 791, 29892, 938, 1125, 13, 462, 1678, 659, 29918, 3177, 353, 2755, 261, 29889, 276, 6338, 29918, 524, 29898, 791, 29897, 13, 18884, 25342, 338, 8758, 29898, 791, 29892, 6120, 1125, 13, 462, 1678, 659, 29918, 3177, 353, 2755, 261, 29889, 276, 6338, 29918, 11227, 29898, 791, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 659, 29918, 3177, 353, 2755, 261, 29889, 276, 6338, 29918, 7411, 29898, 791, 29897, 13, 18884, 1583, 3032, 3177, 29889, 1767, 29889, 4397, 3552, 1989, 29918, 3177, 29892, 659, 29918, 3177, 876, 13, 4706, 12020, 7670, 2392, 703, 2558, 881, 505, 2845, 1134, 525, 710, 29915, 470, 525, 524, 29915, 1159, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 29897, 1599, 20504, 1061, 3366, 29979, 8807, 1917, 3108, 29901, 13, 4706, 363, 2944, 297, 1583, 3032, 3177, 29889, 1767, 29901, 13, 9651, 7709, 612, 8807, 1917, 29898, 667, 29897, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 29897, 1599, 938, 29901, 13, 4706, 736, 7431, 29898, 1311, 3032, 3177, 29889, 1767, 29897, 13, 2 ]
.ycm_extra_conf.py
zaucy/bazel-compilation-database
1
21027
#!/usr/bin/python # Copyright 2018 GRAIL, 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. """Configuration file for YouCompleteMe to fetch C++ compilation flags from Bazel. See https://github.com/ycm-core/YouCompleteMe#c-family-semantic-completion for how YCM works. In that section: For Option 1 (compilation database), use the generate.sh script in this repository. For Option 2 (.ycm_extra_conf.py), symlink this file to the root of your workspace and bazel's output_base, or set it as your global config. """ from __future__ import print_function import json import os import re import shlex import subprocess import sys import xml.etree.ElementTree as ElementTree _BAZEL = os.getenv("BAZEL_COMPDB_BAZEL_PATH") or "bazel" def bazel_info(): """Returns a dict containing key values from bazel info.""" bazel_info_dict = dict() try: out = subprocess.check_output([_BAZEL, 'info']).decode('utf-8').strip().split('\n') except subprocess.CalledProcessError as err: # This exit code is returned when this command is run outside of a bazel workspace. if err.returncode == 2: sys.exit(0) for line in out: key_val = line.strip().partition(": ") bazel_info_dict[key_val[0]] = key_val[2] return bazel_info_dict def bazel_query(args): """Executes bazel query with the given args and returns the output.""" # TODO: switch to cquery when it supports siblings and less crash-y with external repos. query_cmd = [_BAZEL, 'query'] + args proc = subprocess.Popen(query_cmd, stdout=subprocess.PIPE) return proc.communicate()[0].decode('utf-8') def file_to_target(filepath): """Returns a string that works as a bazel target specification for the given file.""" if not filepath.startswith("external/"): # The file path relative to repo root works for genfiles and binfiles too. return filepath # For external repos, we have to find the owner package manually. repo_prefix = re.sub('external/([^/]*).*', '@\\1//', filepath) filepath = re.sub('external/[^/]*/', '', filepath) # Find out which package is the owner of this file. query_result = bazel_query(['-k', repo_prefix+'...', '--output=package']) packages = [package.strip() for package in query_result.split('\n')] owner = "" for package in packages: package = package[len(repo_prefix):] if filepath.startswith(package) and len(package) > len(owner): owner = package return repo_prefix + owner + ":" + os.path.relpath(filepath, owner) def standardize_file_target(file_target): """For file targets that are not source files, return the target that generated them. This is needed because rdeps of generated files do not include targets that reference their generating rules. https://github.com/bazelbuild/bazel/issues/4949 """ query_result = bazel_query(['--output=xml', file_target]) if not query_result: sys.exit("Empty query response for {}. It is probably not handled by bazel".format(file_target)) target_xml = ElementTree.fromstringlist(query_result.split('\n')) source_element = target_xml.find('source-file') if source_element is not None: return file_target generated_element = target_xml.find('generated-file') if generated_element is not None: return generated_element.get('generating-rule') sys.exit("Error parsing query xml for " + file_target + ":\n" + query_result) def get_aspects_filepath(label, bazel_bin): """Gets the file path for the generated aspects file that contains the compile commands json entries. """ target_path = re.sub(':', '/', label) target_path = re.sub('^@(.*)//', 'external/\\1/', target_path) target_path = re.sub('^/*', '', target_path) relative_file_path = target_path + '.compile_commands.json' return os.path.join(bazel_bin, *relative_file_path.split('/')) def get_compdb_json(aspects_filepath, bazel_exec_root): """Returns the JSON string read from the file after necessary processing.""" compdb_json_str = "[\n" with open(aspects_filepath, 'r') as aspects_file: compdb_json_str += aspects_file.read() compdb_json_str += "\n]" return re.sub('__EXEC_ROOT__', bazel_exec_root, compdb_json_str) def get_flags(filepath, compdb_json_str): """Gets the compile command flags from the compile command for the file.""" compdb_dict = json.loads(compdb_json_str) for entry in compdb_dict: if entry['file'] != filepath: continue command = entry['command'] return shlex.split(command)[1:] # This could imply we are fetching the wrong compile_commands.json or there # is a bug in aspects.bzl. sys.exit("File {f} not present in the compilation database".format(f=filepath)) def standardize_flags(flags, bazel_workspace): """Modifies flags obtained from the compile command for compilation outside of bazel.""" # We need to add the workspace directly because the files symlinked in the # execroot during a build disappear after a different build action. flags.extend(['-iquote', bazel_workspace]) return flags def cfamily_settings(filename): """Returns C-family settings as a dict with at least a 'flags' key that points to an array of strings as flags. """ bazel_info_dict = bazel_info() bazel_bin = bazel_info_dict['bazel-bin'] bazel_genfiles = bazel_info_dict['bazel-genfiles'] bazel_exec_root = bazel_info_dict['execution_root'] bazel_workspace = bazel_info_dict['workspace'] os.chdir(bazel_workspace) # Valid prefixes for the file, in decreasing order of specificity. file_prefix = [p for p in [bazel_genfiles, bazel_bin, bazel_exec_root, bazel_workspace] if filename.startswith(p)] if not file_prefix: sys.exit("Not a valid file: " + filename) filepath = os.path.relpath(filename, file_prefix[0]) file_target = standardize_file_target(file_to_target(filepath)) # File path relative to execroot, as it will appear in the compile command. if file_prefix[0].startswith(bazel_exec_root): filepath = os.path.relpath(filename, bazel_exec_root) cc_rules = "cc_(library|binary|test|inc_library|proto_library)" query_result = bazel_query([('kind("{cc_rules}", rdeps(siblings({f}), {f}, 1))' .format(f=file_target, cc_rules=cc_rules)), '--keep_going']) labels = [label.partition(" ")[0] for label in query_result.split('\n') if label] if not labels: sys.exit("No cc rules depend on this source file.") repository_override = '--override_repository=bazel_compdb=' + os.path.dirname( os.path.realpath(__file__)) aspect_definition = '--aspects=@bazel_compdb//:aspects.bzl%compilation_database_aspect' bazel_aspects = [ _BAZEL, 'build', aspect_definition, repository_override, '--output_groups=compdb_files,header_files', ] + labels proc = subprocess.Popen(bazel_aspects, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate() if proc.returncode != 0: errors = [e for e in out.splitlines() + err.splitlines() if e.startswith("ERROR:")] if errors: raise Exception('/'.join(errors)) else: raise Exception(err) aspects_filepath = get_aspects_filepath(labels[0], bazel_bin) compdb_json = get_compdb_json(aspects_filepath, bazel_exec_root) flags = standardize_flags(get_flags(filepath, compdb_json), bazel_workspace) return { 'flags': flags, 'include_paths_relative_to_dir': bazel_exec_root, } #pylint: disable=C0103 def Settings(**kwargs): """Function that is called by YCM with language and filename arguments, and expects a dict of language-specific settings. """ if kwargs['language'] == 'cfamily': return cfamily_settings(kwargs['filename']) return {} # For testing; needs exactly one argument as path of file. if __name__ == '__main__': filename = os.path.abspath(sys.argv[1]) print(Settings(language='cfamily', filename=filename))
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 402, 4717, 6227, 29892, 9266, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 15945, 29908, 8614, 934, 363, 887, 17813, 6816, 304, 6699, 315, 1817, 14835, 13449, 515, 13, 29933, 834, 295, 29889, 13, 13, 13393, 2045, 597, 3292, 29889, 510, 29914, 29891, 4912, 29899, 3221, 29914, 3492, 17813, 6816, 29937, 29883, 29899, 11922, 29899, 12846, 7716, 29899, 5729, 12757, 363, 13, 3525, 612, 24494, 1736, 29889, 512, 393, 4004, 29901, 13, 2831, 10831, 29871, 29896, 313, 2388, 8634, 2566, 511, 671, 278, 5706, 29889, 845, 2471, 297, 445, 13, 19033, 29889, 13, 2831, 10831, 29871, 29906, 14544, 29891, 4912, 29918, 17833, 29918, 5527, 29889, 2272, 511, 9878, 828, 682, 445, 934, 304, 278, 3876, 310, 596, 13, 1287, 3493, 322, 12741, 295, 29915, 29879, 1962, 29918, 3188, 29892, 470, 731, 372, 408, 596, 5534, 2295, 29889, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 528, 2506, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 5215, 4903, 29889, 300, 929, 29889, 2642, 9643, 408, 10619, 9643, 13, 13, 13, 29918, 5688, 29999, 6670, 353, 2897, 29889, 657, 6272, 703, 5688, 29999, 6670, 29918, 21514, 4051, 29918, 5688, 29999, 6670, 29918, 10145, 1159, 470, 376, 27975, 295, 29908, 13, 13, 13, 1753, 12741, 295, 29918, 3888, 7295, 13, 1678, 9995, 11609, 29879, 263, 9657, 6943, 1820, 1819, 515, 12741, 295, 5235, 1213, 15945, 13, 13, 1678, 12741, 295, 29918, 3888, 29918, 8977, 353, 9657, 580, 13, 1678, 1018, 29901, 13, 4706, 714, 353, 1014, 5014, 29889, 3198, 29918, 4905, 4197, 29918, 5688, 29999, 6670, 29892, 525, 3888, 2033, 467, 13808, 877, 9420, 29899, 29947, 2824, 17010, 2141, 5451, 28909, 29876, 1495, 13, 1678, 5174, 1014, 5014, 29889, 29907, 4212, 7032, 2392, 408, 4589, 29901, 13, 4706, 396, 910, 6876, 775, 338, 4133, 746, 445, 1899, 338, 1065, 5377, 310, 263, 12741, 295, 664, 3493, 29889, 13, 4706, 565, 4589, 29889, 2457, 401, 1275, 29871, 29906, 29901, 13, 9651, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 1678, 363, 1196, 297, 714, 29901, 13, 4706, 1820, 29918, 791, 353, 1196, 29889, 17010, 2141, 16707, 703, 29901, 16521, 13, 4706, 12741, 295, 29918, 3888, 29918, 8977, 29961, 1989, 29918, 791, 29961, 29900, 5262, 353, 1820, 29918, 791, 29961, 29906, 29962, 13, 13, 1678, 736, 12741, 295, 29918, 3888, 29918, 8977, 13, 13, 1753, 12741, 295, 29918, 1972, 29898, 5085, 1125, 13, 1678, 9995, 5379, 2667, 12741, 295, 2346, 411, 278, 2183, 6389, 322, 3639, 278, 1962, 1213, 15945, 13, 13, 1678, 396, 14402, 29901, 4607, 304, 274, 1972, 746, 372, 11286, 27767, 18964, 322, 3109, 8095, 29899, 29891, 411, 7029, 17573, 29889, 13, 1678, 2346, 29918, 9006, 353, 23160, 5688, 29999, 6670, 29892, 525, 1972, 2033, 718, 6389, 13, 1678, 9580, 353, 1014, 5014, 29889, 29925, 3150, 29898, 1972, 29918, 9006, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 736, 9580, 29889, 27820, 403, 580, 29961, 29900, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 13, 1753, 934, 29918, 517, 29918, 5182, 29898, 1445, 2084, 1125, 13, 1678, 9995, 11609, 29879, 263, 1347, 393, 1736, 408, 263, 12741, 295, 3646, 21992, 363, 278, 2183, 934, 1213, 15945, 13, 1678, 565, 451, 934, 2084, 29889, 27382, 2541, 703, 23176, 12975, 1125, 13, 4706, 396, 450, 934, 2224, 6198, 304, 13761, 3876, 1736, 363, 2531, 5325, 322, 9016, 5325, 2086, 29889, 13, 4706, 736, 934, 2084, 13, 13, 1678, 396, 1152, 7029, 17573, 29892, 591, 505, 304, 1284, 278, 12271, 3577, 7522, 29889, 13, 1678, 13761, 29918, 13506, 353, 337, 29889, 1491, 877, 23176, 29914, 4197, 29985, 29914, 14178, 467, 29930, 742, 18803, 1966, 29896, 458, 742, 934, 2084, 29897, 13, 1678, 934, 2084, 353, 337, 29889, 1491, 877, 23176, 29914, 22896, 29914, 29962, 3877, 742, 15516, 934, 2084, 29897, 13, 13, 1678, 396, 10987, 714, 607, 3577, 338, 278, 12271, 310, 445, 934, 29889, 13, 1678, 2346, 29918, 2914, 353, 12741, 295, 29918, 1972, 18959, 29899, 29895, 742, 13761, 29918, 13506, 23097, 856, 742, 525, 489, 4905, 29922, 5113, 11287, 13, 1678, 9741, 353, 518, 5113, 29889, 17010, 580, 363, 3577, 297, 2346, 29918, 2914, 29889, 5451, 28909, 29876, 1495, 29962, 13, 13, 1678, 12271, 353, 5124, 13, 1678, 363, 3577, 297, 9741, 29901, 13, 4706, 3577, 353, 3577, 29961, 2435, 29898, 20095, 29918, 13506, 1125, 29962, 13, 4706, 565, 934, 2084, 29889, 27382, 2541, 29898, 5113, 29897, 322, 7431, 29898, 5113, 29897, 1405, 7431, 29898, 20348, 1125, 13, 9651, 12271, 353, 3577, 13, 13, 1678, 736, 13761, 29918, 13506, 718, 12271, 718, 376, 6160, 718, 2897, 29889, 2084, 29889, 2674, 2084, 29898, 1445, 2084, 29892, 12271, 29897, 13, 13, 1753, 3918, 675, 29918, 1445, 29918, 5182, 29898, 1445, 29918, 5182, 1125, 13, 1678, 9995, 2831, 934, 22525, 393, 526, 451, 2752, 2066, 29892, 736, 278, 3646, 393, 5759, 963, 29889, 13, 13, 1678, 910, 338, 4312, 1363, 364, 311, 567, 310, 5759, 2066, 437, 451, 3160, 22525, 393, 3407, 13, 1678, 1009, 14655, 6865, 29889, 13, 1678, 2045, 597, 3292, 29889, 510, 29914, 27975, 295, 4282, 29914, 27975, 295, 29914, 12175, 29914, 29946, 29929, 29946, 29929, 13, 1678, 9995, 13, 13, 1678, 2346, 29918, 2914, 353, 12741, 295, 29918, 1972, 18959, 489, 4905, 29922, 3134, 742, 934, 29918, 5182, 2314, 13, 1678, 565, 451, 2346, 29918, 2914, 29901, 13, 4706, 10876, 29889, 13322, 703, 8915, 2346, 2933, 363, 426, 1836, 739, 338, 3117, 451, 16459, 491, 12741, 295, 1642, 4830, 29898, 1445, 29918, 5182, 876, 13, 13, 1678, 3646, 29918, 3134, 353, 10619, 9643, 29889, 3166, 1807, 1761, 29898, 1972, 29918, 2914, 29889, 5451, 28909, 29876, 8785, 13, 1678, 2752, 29918, 5029, 353, 3646, 29918, 3134, 29889, 2886, 877, 4993, 29899, 1445, 1495, 13, 1678, 565, 2752, 29918, 5029, 338, 451, 6213, 29901, 13, 4706, 736, 934, 29918, 5182, 13, 13, 1678, 5759, 29918, 5029, 353, 3646, 29918, 3134, 29889, 2886, 877, 13525, 29899, 1445, 1495, 13, 1678, 565, 5759, 29918, 5029, 338, 451, 6213, 29901, 13, 4706, 736, 5759, 29918, 5029, 29889, 657, 877, 4738, 1218, 29899, 7491, 1495, 13, 13, 1678, 10876, 29889, 13322, 703, 2392, 13755, 2346, 4903, 363, 376, 718, 934, 29918, 5182, 718, 376, 3583, 29876, 29908, 718, 2346, 29918, 2914, 29897, 13, 13, 1753, 679, 29918, 294, 1103, 29879, 29918, 1445, 2084, 29898, 1643, 29892, 12741, 295, 29918, 2109, 1125, 13, 1678, 9995, 29954, 1691, 278, 934, 2224, 363, 278, 5759, 21420, 934, 393, 3743, 278, 13, 1678, 6633, 8260, 4390, 9976, 29889, 13, 1678, 9995, 13, 13, 1678, 3646, 29918, 2084, 353, 337, 29889, 1491, 877, 29901, 742, 8207, 742, 3858, 29897, 13, 1678, 3646, 29918, 2084, 353, 337, 29889, 1491, 877, 29985, 29992, 28104, 29897, 458, 742, 525, 23176, 29914, 1966, 29896, 29914, 742, 3646, 29918, 2084, 29897, 13, 1678, 3646, 29918, 2084, 353, 337, 29889, 1491, 877, 29985, 5515, 742, 15516, 3646, 29918, 2084, 29897, 13, 1678, 6198, 29918, 1445, 29918, 2084, 353, 3646, 29918, 2084, 718, 15300, 12198, 29918, 26381, 29889, 3126, 29915, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 27975, 295, 29918, 2109, 29892, 334, 22925, 29918, 1445, 29918, 2084, 29889, 5451, 11219, 8785, 13, 13, 1753, 679, 29918, 2388, 2585, 29918, 3126, 29898, 294, 1103, 29879, 29918, 1445, 2084, 29892, 12741, 295, 29918, 4258, 29918, 4632, 1125, 13, 1678, 9995, 11609, 29879, 278, 4663, 1347, 1303, 515, 278, 934, 1156, 5181, 9068, 1213, 15945, 13, 13, 1678, 752, 2585, 29918, 3126, 29918, 710, 353, 376, 7110, 29876, 29908, 13, 1678, 411, 1722, 29898, 294, 1103, 29879, 29918, 1445, 2084, 29892, 525, 29878, 1495, 408, 21420, 29918, 1445, 29901, 13, 4706, 752, 2585, 29918, 3126, 29918, 710, 4619, 21420, 29918, 1445, 29889, 949, 580, 13, 1678, 752, 2585, 29918, 3126, 29918, 710, 4619, 6634, 29876, 18017, 13, 1678, 736, 337, 29889, 1491, 877, 1649, 5746, 11206, 29918, 21289, 1649, 742, 12741, 295, 29918, 4258, 29918, 4632, 29892, 752, 2585, 29918, 3126, 29918, 710, 29897, 13, 13, 1753, 679, 29918, 15764, 29898, 1445, 2084, 29892, 752, 2585, 29918, 3126, 29918, 710, 1125, 13, 1678, 9995, 29954, 1691, 278, 6633, 1899, 13449, 515, 278, 6633, 1899, 363, 278, 934, 1213, 15945, 13, 13, 1678, 752, 2585, 29918, 8977, 353, 4390, 29889, 18132, 29898, 2388, 2585, 29918, 3126, 29918, 710, 29897, 13, 1678, 363, 6251, 297, 752, 2585, 29918, 8977, 29901, 13, 4706, 565, 6251, 1839, 1445, 2033, 2804, 934, 2084, 29901, 13, 9651, 6773, 13, 4706, 1899, 353, 6251, 1839, 6519, 2033, 13, 4706, 736, 528, 2506, 29889, 5451, 29898, 6519, 9601, 29896, 17531, 13, 13, 1678, 396, 910, 1033, 22366, 591, 526, 6699, 292, 278, 2743, 6633, 29918, 26381, 29889, 3126, 470, 727, 13, 1678, 396, 338, 263, 6494, 297, 21420, 29889, 29890, 29920, 29880, 29889, 13, 1678, 10876, 29889, 13322, 703, 2283, 426, 29888, 29913, 451, 2198, 297, 278, 14835, 2566, 1642, 4830, 29898, 29888, 29922, 1445, 2084, 876, 13, 13, 1753, 3918, 675, 29918, 15764, 29898, 15764, 29892, 12741, 295, 29918, 1287, 3493, 1125, 13, 1678, 9995, 2111, 11057, 13449, 7625, 515, 278, 6633, 1899, 363, 14835, 5377, 310, 12741, 295, 1213, 15945, 13, 13, 1678, 396, 1334, 817, 304, 788, 278, 664, 3493, 4153, 1363, 278, 2066, 9878, 828, 682, 287, 297, 278, 13, 1678, 396, 2279, 4632, 2645, 263, 2048, 25417, 1156, 263, 1422, 2048, 3158, 29889, 13, 1678, 13449, 29889, 21843, 18959, 29899, 29875, 1396, 742, 12741, 295, 29918, 1287, 3493, 2314, 13, 13, 1678, 736, 13449, 13, 13, 1753, 274, 11922, 29918, 11027, 29898, 9507, 1125, 13, 1678, 9995, 11609, 29879, 315, 29899, 11922, 6055, 408, 263, 9657, 411, 472, 3203, 263, 525, 15764, 29915, 1820, 393, 13, 1678, 3291, 304, 385, 1409, 310, 6031, 408, 13449, 29889, 13, 1678, 9995, 13, 13, 1678, 12741, 295, 29918, 3888, 29918, 8977, 353, 12741, 295, 29918, 3888, 580, 13, 1678, 12741, 295, 29918, 2109, 353, 12741, 295, 29918, 3888, 29918, 8977, 1839, 27975, 295, 29899, 2109, 2033, 13, 1678, 12741, 295, 29918, 1885, 5325, 353, 12741, 295, 29918, 3888, 29918, 8977, 1839, 27975, 295, 29899, 1885, 5325, 2033, 13, 1678, 12741, 295, 29918, 4258, 29918, 4632, 353, 12741, 295, 29918, 3888, 29918, 8977, 1839, 22256, 29918, 4632, 2033, 13, 1678, 12741, 295, 29918, 1287, 3493, 353, 12741, 295, 29918, 3888, 29918, 8977, 1839, 1287, 3493, 2033, 13, 13, 1678, 2897, 29889, 305, 3972, 29898, 27975, 295, 29918, 1287, 3493, 29897, 13, 1678, 396, 15758, 10944, 267, 363, 278, 934, 29892, 297, 9263, 5832, 1797, 310, 2702, 537, 29889, 13, 1678, 934, 29918, 13506, 353, 518, 29886, 363, 282, 297, 518, 27975, 295, 29918, 1885, 5325, 29892, 12741, 295, 29918, 2109, 29892, 12741, 295, 29918, 4258, 29918, 4632, 29892, 12741, 295, 29918, 1287, 3493, 29962, 13, 462, 259, 565, 10422, 29889, 27382, 2541, 29898, 29886, 4638, 13, 1678, 565, 451, 934, 29918, 13506, 29901, 13, 4706, 10876, 29889, 13322, 703, 3664, 263, 2854, 934, 29901, 376, 718, 10422, 29897, 13, 13, 1678, 934, 2084, 353, 2897, 29889, 2084, 29889, 2674, 2084, 29898, 9507, 29892, 934, 29918, 13506, 29961, 29900, 2314, 13, 1678, 934, 29918, 5182, 353, 3918, 675, 29918, 1445, 29918, 5182, 29898, 1445, 29918, 517, 29918, 5182, 29898, 1445, 2084, 876, 13, 13, 1678, 396, 3497, 2224, 6198, 304, 2279, 4632, 29892, 408, 372, 674, 2615, 297, 278, 6633, 1899, 29889, 13, 1678, 565, 934, 29918, 13506, 29961, 29900, 1822, 27382, 2541, 29898, 27975, 295, 29918, 4258, 29918, 4632, 1125, 13, 4706, 934, 2084, 353, 2897, 29889, 2084, 29889, 2674, 2084, 29898, 9507, 29892, 12741, 295, 29918, 4258, 29918, 4632, 29897, 13, 13, 1678, 21759, 29918, 19238, 353, 376, 617, 23538, 5258, 29989, 19541, 29989, 1688, 29989, 3742, 29918, 5258, 29989, 17529, 29918, 5258, 5513, 13, 1678, 2346, 29918, 2914, 353, 12741, 295, 29918, 1972, 4197, 877, 14380, 703, 29912, 617, 29918, 19238, 17671, 364, 311, 567, 29898, 29879, 747, 18964, 3319, 29888, 9594, 426, 29888, 1118, 29871, 29896, 876, 29915, 13, 462, 462, 869, 4830, 29898, 29888, 29922, 1445, 29918, 5182, 29892, 21759, 29918, 19238, 29922, 617, 29918, 19238, 8243, 525, 489, 17462, 29918, 17696, 11287, 13, 13, 1678, 11073, 353, 518, 1643, 29889, 16707, 703, 376, 9601, 29900, 29962, 363, 3858, 297, 2346, 29918, 2914, 29889, 5451, 28909, 29876, 1495, 565, 3858, 29962, 13, 13, 1678, 565, 451, 11073, 29901, 13, 4706, 10876, 29889, 13322, 703, 3782, 21759, 6865, 8839, 373, 445, 2752, 934, 23157, 13, 13, 1678, 9810, 29918, 15752, 353, 525, 489, 15752, 29918, 19033, 29922, 27975, 295, 29918, 2388, 2585, 2433, 718, 2897, 29889, 2084, 29889, 25721, 29898, 13, 4706, 2897, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 13, 13, 1678, 9565, 29918, 16553, 353, 525, 489, 294, 1103, 29879, 29922, 29992, 27975, 295, 29918, 2388, 2585, 458, 29901, 294, 1103, 29879, 29889, 29890, 29920, 29880, 29995, 2388, 8634, 29918, 9803, 29918, 294, 1103, 29915, 13, 13, 1678, 12741, 295, 29918, 294, 1103, 29879, 353, 518, 13, 4706, 903, 5688, 29999, 6670, 29892, 13, 4706, 525, 4282, 742, 13, 4706, 9565, 29918, 16553, 29892, 13, 4706, 9810, 29918, 15752, 29892, 13, 4706, 525, 489, 4905, 29918, 13155, 29922, 2388, 2585, 29918, 5325, 29892, 6672, 29918, 5325, 742, 13, 1678, 4514, 718, 11073, 13, 1678, 9580, 353, 1014, 5014, 29889, 29925, 3150, 29898, 27975, 295, 29918, 294, 1103, 29879, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 380, 20405, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 714, 29892, 4589, 353, 9580, 29889, 27820, 403, 580, 13, 1678, 565, 9580, 29889, 2457, 401, 2804, 29871, 29900, 29901, 13, 4706, 4436, 353, 518, 29872, 363, 321, 297, 714, 29889, 5451, 9012, 580, 718, 4589, 29889, 5451, 9012, 580, 13, 462, 29871, 565, 321, 29889, 27382, 2541, 703, 11432, 29901, 13531, 13, 4706, 565, 4436, 29901, 13, 9651, 12020, 8960, 11219, 4286, 7122, 29898, 12523, 876, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 29898, 3127, 29897, 13, 13, 1678, 21420, 29918, 1445, 2084, 353, 679, 29918, 294, 1103, 29879, 29918, 1445, 2084, 29898, 21134, 29961, 29900, 1402, 12741, 295, 29918, 2109, 29897, 13, 13, 1678, 752, 2585, 29918, 3126, 353, 679, 29918, 2388, 2585, 29918, 3126, 29898, 294, 1103, 29879, 29918, 1445, 2084, 29892, 12741, 295, 29918, 4258, 29918, 4632, 29897, 13, 1678, 13449, 353, 3918, 675, 29918, 15764, 29898, 657, 29918, 15764, 29898, 1445, 2084, 29892, 752, 2585, 29918, 3126, 511, 12741, 295, 29918, 1287, 3493, 29897, 13, 13, 1678, 736, 426, 13, 4706, 525, 15764, 2396, 13449, 29892, 13, 4706, 525, 2856, 29918, 24772, 29918, 22925, 29918, 517, 29918, 3972, 2396, 12741, 295, 29918, 4258, 29918, 4632, 29892, 13, 4706, 500, 13, 13, 29937, 2272, 27854, 29901, 11262, 29922, 29907, 29900, 29896, 29900, 29941, 13, 1753, 19215, 29898, 1068, 19290, 1125, 13, 1678, 9995, 6678, 393, 338, 2000, 491, 612, 24494, 411, 4086, 322, 10422, 6273, 29892, 13, 1678, 322, 23347, 263, 9657, 310, 4086, 29899, 14940, 6055, 29889, 13, 1678, 9995, 13, 1678, 565, 9049, 5085, 1839, 11675, 2033, 1275, 525, 6854, 1344, 29891, 2396, 13, 4706, 736, 274, 11922, 29918, 11027, 29898, 19290, 1839, 9507, 11287, 13, 1678, 736, 6571, 13, 13, 29937, 1152, 6724, 29936, 4225, 3721, 697, 2980, 408, 2224, 310, 934, 29889, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 10422, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 1678, 1596, 29898, 9585, 29898, 11675, 2433, 6854, 1344, 29891, 742, 10422, 29922, 9507, 876, 13, 2 ]
src/sites/nefilim.py
LAC-Japan/ransomwatch
244
47732
from datetime import datetime import logging from bs4 import BeautifulSoup from db.models import Victim from net.proxy import Proxy from .sitecrawler import SiteCrawler import time class Nefilim(SiteCrawler): actor = "Nefilim" def _handle_page(self, soup): victim_list = soup.find_all("header", class_="entry-header") for victim in victim_list: victim_title = victim.find("h2", class_="entry-title").text.strip() victim_name = victim_title[0:victim_title.find(". Part")] meta = victim.find("div", class_="entry-meta") published = meta.find("time", class_="entry-date").attrs["datetime"] published_dt = datetime.strptime( published.strip()[:-6], "%Y-%m-%dT%H:%M:%S") victim_leak_site = meta.find("span", class_="posted-on").find("a").attrs["href"] q = self.session.query(Victim).filter_by( url=victim_leak_site, site=self.site) if q.count() == 0: # new victim v = Victim(name=victim_name, url=victim_leak_site, published=published_dt, first_seen=datetime.utcnow(), last_seen=datetime.utcnow(), site=self.site) self.session.add(v) self.new_victims.append(v) else: # already seen, update last_seen v = q.first() v.last_seen = datetime.utcnow() self.current_victims.append(v) self.session.commit() # server was timing out so slows it down a bit time.sleep(1.0) def scrape_victims(self): with Proxy() as p: r = p.get(f"{self.url}", headers=self.headers) soup = BeautifulSoup(r.content.decode(), "html.parser") page_count = 0 while True: page_nav = soup.find("div", class_="nav-previous") if page_nav is None: break url = page_nav.find("a").attrs["href"] r = p.get(f"{url}", headers=self.headers) soup = BeautifulSoup(r.content.decode(), "html.parser") self._handle_page(soup)
[ 1, 515, 12865, 1053, 12865, 13, 5215, 12183, 13, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 13, 13, 3166, 4833, 29889, 9794, 1053, 7229, 326, 13, 3166, 7787, 29889, 14701, 1053, 1019, 3594, 13, 3166, 869, 2746, 29883, 1610, 1358, 1053, 10781, 29907, 1610, 1358, 13, 5215, 931, 13, 13, 1990, 405, 1389, 309, 326, 29898, 17033, 29907, 1610, 1358, 1125, 13, 1678, 11339, 353, 376, 29940, 1389, 309, 326, 29908, 13, 13, 268, 13, 1678, 822, 903, 8411, 29918, 3488, 29898, 1311, 29892, 22300, 1125, 13, 4706, 28985, 29918, 1761, 353, 22300, 29889, 2886, 29918, 497, 703, 6672, 613, 770, 29918, 543, 8269, 29899, 6672, 1159, 13, 4706, 363, 28985, 297, 28985, 29918, 1761, 29901, 13, 9651, 28985, 29918, 3257, 353, 28985, 29889, 2886, 703, 29882, 29906, 613, 770, 29918, 543, 8269, 29899, 3257, 2564, 726, 29889, 17010, 580, 13, 632, 13, 9651, 28985, 29918, 978, 353, 28985, 29918, 3257, 29961, 29900, 29901, 29894, 919, 326, 29918, 3257, 29889, 2886, 17350, 3455, 13531, 13, 632, 13, 9651, 12700, 353, 28985, 29889, 2886, 703, 4563, 613, 770, 29918, 543, 8269, 29899, 7299, 1159, 13, 632, 13, 9651, 6369, 353, 12700, 29889, 2886, 703, 2230, 613, 770, 29918, 543, 8269, 29899, 1256, 2564, 5552, 29879, 3366, 12673, 3108, 13, 9651, 6369, 29918, 6008, 353, 12865, 29889, 710, 415, 603, 29898, 13, 18884, 6369, 29889, 17010, 580, 7503, 29899, 29953, 1402, 11860, 29979, 19222, 29885, 19222, 29881, 29911, 29995, 29950, 16664, 29924, 16664, 29903, 1159, 13, 632, 13, 9651, 28985, 29918, 280, 557, 29918, 2746, 353, 12700, 29889, 2886, 703, 9653, 613, 770, 29918, 543, 2490, 287, 29899, 265, 2564, 2886, 703, 29874, 2564, 5552, 29879, 3366, 12653, 3108, 13, 308, 13, 632, 13, 9651, 3855, 353, 1583, 29889, 7924, 29889, 1972, 29898, 29963, 919, 326, 467, 4572, 29918, 1609, 29898, 13, 18884, 3142, 29922, 29894, 919, 326, 29918, 280, 557, 29918, 2746, 29892, 3268, 29922, 1311, 29889, 2746, 29897, 13, 13, 9651, 565, 3855, 29889, 2798, 580, 1275, 29871, 29900, 29901, 13, 18884, 396, 716, 28985, 13, 18884, 325, 353, 7229, 326, 29898, 978, 29922, 29894, 919, 326, 29918, 978, 29892, 3142, 29922, 29894, 919, 326, 29918, 280, 557, 29918, 2746, 29892, 6369, 29922, 5467, 3726, 29918, 6008, 29892, 13, 462, 9651, 937, 29918, 28026, 29922, 12673, 29889, 329, 29883, 3707, 3285, 1833, 29918, 28026, 29922, 12673, 29889, 329, 29883, 3707, 3285, 3268, 29922, 1311, 29889, 2746, 29897, 13, 18884, 1583, 29889, 7924, 29889, 1202, 29898, 29894, 29897, 13, 18884, 1583, 29889, 1482, 29918, 29894, 919, 9893, 29889, 4397, 29898, 29894, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 2307, 3595, 29892, 2767, 1833, 29918, 28026, 13, 18884, 325, 353, 3855, 29889, 4102, 580, 13, 18884, 325, 29889, 4230, 29918, 28026, 353, 12865, 29889, 329, 29883, 3707, 580, 13, 9651, 1583, 29889, 3784, 29918, 29894, 919, 9893, 29889, 4397, 29898, 29894, 29897, 13, 4706, 1583, 29889, 7924, 29889, 15060, 580, 13, 308, 13, 4706, 396, 1923, 471, 28750, 714, 577, 5232, 29879, 372, 1623, 263, 2586, 13, 4706, 931, 29889, 17059, 29898, 29896, 29889, 29900, 29897, 13, 308, 13, 1678, 822, 24559, 412, 29918, 29894, 919, 9893, 29898, 1311, 1125, 13, 4706, 411, 1019, 3594, 580, 408, 282, 29901, 13, 9651, 364, 353, 282, 29889, 657, 29898, 29888, 29908, 29912, 1311, 29889, 2271, 17671, 9066, 29922, 1311, 29889, 13662, 29897, 13, 13, 9651, 22300, 353, 25685, 29903, 1132, 29898, 29878, 29889, 3051, 29889, 13808, 3285, 376, 1420, 29889, 16680, 1159, 13, 13, 9651, 1813, 29918, 2798, 353, 29871, 29900, 13, 9651, 1550, 5852, 29901, 13, 18884, 1813, 29918, 6654, 353, 22300, 29889, 2886, 703, 4563, 613, 770, 29918, 543, 6654, 29899, 24957, 1159, 13, 18884, 565, 1813, 29918, 6654, 338, 6213, 29901, 13, 462, 1678, 2867, 13, 462, 13, 18884, 3142, 353, 1813, 29918, 6654, 29889, 2886, 703, 29874, 2564, 5552, 29879, 3366, 12653, 3108, 13, 18884, 364, 353, 282, 29889, 657, 29898, 29888, 29908, 29912, 2271, 17671, 9066, 29922, 1311, 29889, 13662, 29897, 13, 18884, 22300, 353, 25685, 29903, 1132, 29898, 29878, 29889, 3051, 29889, 13808, 3285, 376, 1420, 29889, 16680, 1159, 13, 18884, 1583, 3032, 8411, 29918, 3488, 29898, 29879, 1132, 29897, 2 ]
tests/components/synology_dsm/test_config_flow.py
dzmitov/core
1
54375
"""Tests for the Synology DSM config flow.""" import logging from unittest.mock import MagicMock, Mock, patch import pytest from homeassistant import data_entry_flow from homeassistant.components.synology_dsm.const import ( CONF_VOLUMES, DEFAULT_NAME, DEFAULT_PORT, DEFAULT_PORT_SSL, DEFAULT_SSL, DOMAIN, ) from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_USER from homeassistant.const import ( CONF_DISKS, CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_PORT, CONF_SSL, CONF_USERNAME, ) from homeassistant.helpers.typing import HomeAssistantType from tests.common import MockConfigEntry _LOGGER = logging.getLogger(__name__) NAME = "My Syno" HOST = "nas.meontheinternet.com" SERIAL = "mySerial" HOST_2 = "nas.worldwide.me" SERIAL_2 = "mySerial2" PORT = 1234 SSL = True USERNAME = "Home_Assistant" PASSWORD = "password" @pytest.fixture(name="service") def mock_controller_service(): """Mock a successful service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.login = Mock(return_value=True) service_mock.return_value.information = Mock(serial=SERIAL) service_mock.return_value.utilisation = Mock(cpu_user_load=1) service_mock.return_value.storage = Mock(disks_ids=[], volumes_ids=[]) yield service_mock @pytest.fixture(name="service_login_failed") def mock_controller_service_login_failed(): """Mock a failed login.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.login = Mock(return_value=False) yield service_mock @pytest.fixture(name="service_failed") def mock_controller_service_failed(): """Mock a failed service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.login = Mock(return_value=True) service_mock.return_value.information = Mock(serial=None) service_mock.return_value.utilisation = Mock(cpu_user_load=None) service_mock.return_value.storage = Mock(disks_ids=None, volumes_ids=None) yield service_mock async def test_user(hass: HomeAssistantType, service: MagicMock): """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" # test with all provided result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={ CONF_NAME: NAME, CONF_HOST: HOST, CONF_PORT: PORT, CONF_SSL: SSL, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, }, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == HOST assert result["data"][CONF_NAME] == NAME assert result["data"][CONF_HOST] == HOST assert result["data"][CONF_PORT] == PORT assert result["data"][CONF_SSL] == SSL assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD assert result["data"].get(CONF_DISKS) is None assert result["data"].get(CONF_VOLUMES) is None service.return_value.information = Mock(serial=SERIAL_2) # test without port + False SSL result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={ CONF_NAME: NAME, CONF_HOST: HOST, CONF_SSL: False, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, }, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["result"].unique_id == SERIAL_2 assert result["title"] == HOST assert result["data"][CONF_NAME] == NAME assert result["data"][CONF_HOST] == HOST assert result["data"][CONF_PORT] == DEFAULT_PORT assert not result["data"][CONF_SSL] assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD assert result["data"].get(CONF_DISKS) is None assert result["data"].get(CONF_VOLUMES) is None async def test_import(hass: HomeAssistantType, service: MagicMock): """Test import step.""" # import with minimum setup result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["result"].unique_id == SERIAL assert result["title"] == HOST assert result["data"][CONF_NAME] == DEFAULT_NAME assert result["data"][CONF_HOST] == HOST assert result["data"][CONF_PORT] == DEFAULT_PORT_SSL assert result["data"][CONF_SSL] == DEFAULT_SSL assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD assert result["data"].get(CONF_DISKS) is None assert result["data"].get(CONF_VOLUMES) is None service.return_value.information = Mock(serial=SERIAL_2) # import with all result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={ CONF_NAME: NAME, CONF_HOST: HOST_2, CONF_PORT: PORT, CONF_SSL: SSL, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, CONF_DISKS: ["sda", "sdb", "sdc"], CONF_VOLUMES: ["volume_1"], }, ) assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["result"].unique_id == SERIAL_2 assert result["title"] == HOST_2 assert result["data"][CONF_NAME] == NAME assert result["data"][CONF_HOST] == HOST_2 assert result["data"][CONF_PORT] == PORT assert result["data"][CONF_SSL] == SSL assert result["data"][CONF_USERNAME] == USERNAME assert result["data"][CONF_PASSWORD] == PASSWORD assert result["data"][CONF_DISKS] == ["sda", "sdb", "sdc"] assert result["data"][CONF_VOLUMES] == ["volume_1"] async def test_abort_if_already_setup(hass: HomeAssistantType, service: MagicMock): """Test we abort if the account is already setup.""" MockConfigEntry( domain=DOMAIN, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, unique_id=SERIAL, ).add_to_hass(hass) # Should fail, same HOST:PORT (import) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "already_configured" # Should fail, same HOST:PORT (flow) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT assert result["reason"] == "already_configured" async def test_login_failed(hass: HomeAssistantType, service_login_failed: MagicMock): """Test when we have errors during connection.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["errors"] == {CONF_USERNAME: "login"} async def test_connection_failed(hass: HomeAssistantType, service_failed: MagicMock): """Test when we have errors during connection.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["errors"] == {"base": "unknown"}
[ 1, 9995, 24376, 363, 278, 10829, 3002, 360, 17061, 2295, 4972, 1213, 15945, 13, 5215, 12183, 13, 3166, 443, 27958, 29889, 17640, 1053, 26494, 18680, 29892, 26297, 29892, 13261, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 3271, 465, 22137, 1053, 848, 29918, 8269, 29918, 1731, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 19274, 3002, 29918, 29881, 3844, 29889, 3075, 1053, 313, 13, 1678, 8707, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29892, 13, 1678, 22236, 29918, 5813, 29892, 13, 1678, 22236, 29918, 15082, 29892, 13, 1678, 22236, 29918, 15082, 29918, 18641, 29892, 13, 1678, 22236, 29918, 18641, 29892, 13, 1678, 11662, 29032, 29892, 13, 29897, 13, 3166, 3271, 465, 22137, 29889, 2917, 29918, 26586, 1053, 7791, 4574, 4741, 29918, 29902, 3580, 8476, 29892, 7791, 4574, 4741, 29918, 11889, 13, 3166, 3271, 465, 22137, 29889, 3075, 1053, 313, 13, 1678, 8707, 29943, 29918, 23711, 17557, 29892, 13, 1678, 8707, 29943, 29918, 20832, 29892, 13, 1678, 8707, 29943, 29918, 5813, 29892, 13, 1678, 8707, 29943, 29918, 25711, 17013, 29892, 13, 1678, 8707, 29943, 29918, 15082, 29892, 13, 1678, 8707, 29943, 29918, 18641, 29892, 13, 1678, 8707, 29943, 29918, 11889, 5813, 29892, 13, 29897, 13, 3166, 3271, 465, 22137, 29889, 3952, 6774, 29889, 1017, 15702, 1053, 8778, 7900, 22137, 1542, 13, 13, 3166, 6987, 29889, 9435, 1053, 26297, 3991, 9634, 13, 13, 29918, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 5813, 353, 376, 3421, 10829, 29877, 29908, 13, 20832, 353, 376, 22911, 29889, 1004, 609, 12880, 725, 300, 29889, 510, 29908, 13, 6304, 25758, 353, 376, 1357, 9125, 29908, 13, 20832, 29918, 29906, 353, 376, 22911, 29889, 11526, 8157, 29889, 1004, 29908, 13, 6304, 25758, 29918, 29906, 353, 376, 1357, 9125, 29906, 29908, 13, 15082, 353, 29871, 29896, 29906, 29941, 29946, 13, 18641, 353, 5852, 13, 11889, 5813, 353, 376, 11184, 29918, 7900, 22137, 29908, 13, 25711, 17013, 353, 376, 5630, 29908, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 978, 543, 5509, 1159, 13, 1753, 11187, 29918, 8299, 29918, 5509, 7295, 13, 1678, 9995, 18680, 263, 9150, 2669, 1213, 15945, 13, 1678, 411, 13261, 29898, 13, 4706, 376, 5184, 465, 22137, 29889, 14036, 29889, 19274, 3002, 29918, 29881, 3844, 29889, 2917, 29918, 1731, 29889, 29216, 3002, 8452, 29924, 29908, 13, 1678, 1723, 408, 2669, 29918, 17640, 29901, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 7507, 353, 26297, 29898, 2457, 29918, 1767, 29922, 5574, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 19678, 353, 26297, 29898, 15550, 29922, 6304, 25758, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 4422, 4371, 353, 26297, 29898, 21970, 29918, 1792, 29918, 1359, 29922, 29896, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 12925, 353, 26297, 29898, 2218, 2039, 29918, 4841, 11759, 1402, 18167, 29918, 4841, 11759, 2314, 13, 4706, 7709, 2669, 29918, 17640, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 978, 543, 5509, 29918, 7507, 29918, 26061, 1159, 13, 1753, 11187, 29918, 8299, 29918, 5509, 29918, 7507, 29918, 26061, 7295, 13, 1678, 9995, 18680, 263, 5229, 6464, 1213, 15945, 13, 1678, 411, 13261, 29898, 13, 4706, 376, 5184, 465, 22137, 29889, 14036, 29889, 19274, 3002, 29918, 29881, 3844, 29889, 2917, 29918, 1731, 29889, 29216, 3002, 8452, 29924, 29908, 13, 1678, 1723, 408, 2669, 29918, 17640, 29901, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 7507, 353, 26297, 29898, 2457, 29918, 1767, 29922, 8824, 29897, 13, 4706, 7709, 2669, 29918, 17640, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 978, 543, 5509, 29918, 26061, 1159, 13, 1753, 11187, 29918, 8299, 29918, 5509, 29918, 26061, 7295, 13, 1678, 9995, 18680, 263, 5229, 2669, 1213, 15945, 13, 1678, 411, 13261, 29898, 13, 4706, 376, 5184, 465, 22137, 29889, 14036, 29889, 19274, 3002, 29918, 29881, 3844, 29889, 2917, 29918, 1731, 29889, 29216, 3002, 8452, 29924, 29908, 13, 1678, 1723, 408, 2669, 29918, 17640, 29901, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 7507, 353, 26297, 29898, 2457, 29918, 1767, 29922, 5574, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 19678, 353, 26297, 29898, 15550, 29922, 8516, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 4422, 4371, 353, 26297, 29898, 21970, 29918, 1792, 29918, 1359, 29922, 8516, 29897, 13, 4706, 2669, 29918, 17640, 29889, 2457, 29918, 1767, 29889, 12925, 353, 26297, 29898, 2218, 2039, 29918, 4841, 29922, 8516, 29892, 18167, 29918, 4841, 29922, 8516, 29897, 13, 4706, 7709, 2669, 29918, 17640, 13, 13, 13, 12674, 822, 1243, 29918, 1792, 29898, 29882, 465, 29901, 8778, 7900, 22137, 1542, 29892, 2669, 29901, 26494, 18680, 1125, 13, 1678, 9995, 3057, 1404, 2295, 1213, 15945, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 848, 29922, 8516, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 19094, 13, 1678, 4974, 1121, 3366, 10568, 29918, 333, 3108, 1275, 376, 1792, 29908, 13, 13, 1678, 396, 1243, 411, 599, 4944, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 13, 4706, 848, 3790, 13, 9651, 8707, 29943, 29918, 5813, 29901, 27085, 29892, 13, 9651, 8707, 29943, 29918, 20832, 29901, 379, 3718, 29892, 13, 9651, 8707, 29943, 29918, 15082, 29901, 349, 8476, 29892, 13, 9651, 8707, 29943, 29918, 18641, 29901, 17122, 29892, 13, 9651, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 13, 9651, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 29892, 13, 4706, 2981, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 27045, 29918, 3919, 13207, 13, 1678, 4974, 1121, 3366, 2914, 16862, 13092, 29918, 333, 1275, 26996, 25758, 13, 1678, 4974, 1121, 3366, 3257, 3108, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 5813, 29962, 1275, 27085, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 20832, 29962, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 15082, 29962, 1275, 349, 8476, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 18641, 29962, 1275, 17122, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 11889, 5813, 29962, 1275, 3148, 1001, 5813, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 25711, 17013, 29962, 1275, 17687, 1799, 17013, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 23711, 17557, 29897, 338, 6213, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29897, 338, 6213, 13, 13, 1678, 2669, 29889, 2457, 29918, 1767, 29889, 19678, 353, 26297, 29898, 15550, 29922, 6304, 25758, 29918, 29906, 29897, 13, 1678, 396, 1243, 1728, 2011, 718, 7700, 17122, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 13, 4706, 848, 3790, 13, 9651, 8707, 29943, 29918, 5813, 29901, 27085, 29892, 13, 9651, 8707, 29943, 29918, 20832, 29901, 379, 3718, 29892, 13, 9651, 8707, 29943, 29918, 18641, 29901, 7700, 29892, 13, 9651, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 13, 9651, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 29892, 13, 4706, 2981, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 27045, 29918, 3919, 13207, 13, 1678, 4974, 1121, 3366, 2914, 16862, 13092, 29918, 333, 1275, 26996, 25758, 29918, 29906, 13, 1678, 4974, 1121, 3366, 3257, 3108, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 5813, 29962, 1275, 27085, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 20832, 29962, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 15082, 29962, 1275, 22236, 29918, 15082, 13, 1678, 4974, 451, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 18641, 29962, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 11889, 5813, 29962, 1275, 3148, 1001, 5813, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 25711, 17013, 29962, 1275, 17687, 1799, 17013, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 23711, 17557, 29897, 338, 6213, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29897, 338, 6213, 13, 13, 13, 12674, 822, 1243, 29918, 5215, 29898, 29882, 465, 29901, 8778, 7900, 22137, 1542, 29892, 2669, 29901, 26494, 18680, 1125, 13, 1678, 9995, 3057, 1053, 4331, 1213, 15945, 13, 1678, 396, 1053, 411, 9212, 6230, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 29902, 3580, 8476, 1118, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 27045, 29918, 3919, 13207, 13, 1678, 4974, 1121, 3366, 2914, 16862, 13092, 29918, 333, 1275, 26996, 25758, 13, 1678, 4974, 1121, 3366, 3257, 3108, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 5813, 29962, 1275, 22236, 29918, 5813, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 20832, 29962, 1275, 379, 3718, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 15082, 29962, 1275, 22236, 29918, 15082, 29918, 18641, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 18641, 29962, 1275, 22236, 29918, 18641, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 11889, 5813, 29962, 1275, 3148, 1001, 5813, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 25711, 17013, 29962, 1275, 17687, 1799, 17013, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 23711, 17557, 29897, 338, 6213, 13, 1678, 4974, 1121, 3366, 1272, 16862, 657, 29898, 6007, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29897, 338, 6213, 13, 13, 1678, 2669, 29889, 2457, 29918, 1767, 29889, 19678, 353, 26297, 29898, 15550, 29922, 6304, 25758, 29918, 29906, 29897, 13, 1678, 396, 1053, 411, 599, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 29902, 3580, 8476, 1118, 13, 4706, 848, 3790, 13, 9651, 8707, 29943, 29918, 5813, 29901, 27085, 29892, 13, 9651, 8707, 29943, 29918, 20832, 29901, 379, 3718, 29918, 29906, 29892, 13, 9651, 8707, 29943, 29918, 15082, 29901, 349, 8476, 29892, 13, 9651, 8707, 29943, 29918, 18641, 29901, 17122, 29892, 13, 9651, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 13, 9651, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 29892, 13, 9651, 8707, 29943, 29918, 23711, 17557, 29901, 6796, 29879, 1388, 613, 376, 29879, 2585, 613, 376, 4928, 29883, 12436, 13, 9651, 8707, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29901, 6796, 24623, 29918, 29896, 12436, 13, 4706, 2981, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 27045, 29918, 3919, 13207, 13, 1678, 4974, 1121, 3366, 2914, 16862, 13092, 29918, 333, 1275, 26996, 25758, 29918, 29906, 13, 1678, 4974, 1121, 3366, 3257, 3108, 1275, 379, 3718, 29918, 29906, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 5813, 29962, 1275, 27085, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 20832, 29962, 1275, 379, 3718, 29918, 29906, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 15082, 29962, 1275, 349, 8476, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 18641, 29962, 1275, 17122, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 11889, 5813, 29962, 1275, 3148, 1001, 5813, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 25711, 17013, 29962, 1275, 17687, 1799, 17013, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 23711, 17557, 29962, 1275, 6796, 29879, 1388, 613, 376, 29879, 2585, 613, 376, 4928, 29883, 3108, 13, 1678, 4974, 1121, 3366, 1272, 3108, 29961, 6007, 29943, 29918, 29963, 5607, 29965, 2303, 29903, 29962, 1275, 6796, 24623, 29918, 29896, 3108, 13, 13, 13, 12674, 822, 1243, 29918, 370, 441, 29918, 361, 29918, 284, 2040, 29918, 14669, 29898, 29882, 465, 29901, 8778, 7900, 22137, 1542, 29892, 2669, 29901, 26494, 18680, 1125, 13, 1678, 9995, 3057, 591, 27450, 565, 278, 3633, 338, 2307, 6230, 1213, 15945, 13, 1678, 26297, 3991, 9634, 29898, 13, 4706, 5354, 29922, 3970, 29032, 29892, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 4706, 5412, 29918, 333, 29922, 6304, 25758, 29892, 13, 1678, 13742, 1202, 29918, 517, 29918, 29882, 465, 29898, 29882, 465, 29897, 13, 13, 1678, 396, 10575, 4418, 29892, 1021, 379, 3718, 29901, 15082, 313, 5215, 29897, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 29902, 3580, 8476, 1118, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 2882, 8476, 13, 1678, 4974, 1121, 3366, 23147, 3108, 1275, 376, 284, 2040, 29918, 2917, 2955, 29908, 13, 13, 1678, 396, 10575, 4418, 29892, 1021, 379, 3718, 29901, 15082, 313, 1731, 29897, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 2882, 8476, 13, 1678, 4974, 1121, 3366, 23147, 3108, 1275, 376, 284, 2040, 29918, 2917, 2955, 29908, 13, 13, 13, 12674, 822, 1243, 29918, 7507, 29918, 26061, 29898, 29882, 465, 29901, 8778, 7900, 22137, 1542, 29892, 2669, 29918, 7507, 29918, 26061, 29901, 26494, 18680, 1125, 13, 1678, 9995, 3057, 746, 591, 505, 4436, 2645, 3957, 1213, 15945, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 19094, 13, 1678, 4974, 1121, 3366, 12523, 3108, 1275, 426, 6007, 29943, 29918, 11889, 5813, 29901, 376, 7507, 9092, 13, 13, 13, 12674, 822, 1243, 29918, 9965, 29918, 26061, 29898, 29882, 465, 29901, 8778, 7900, 22137, 1542, 29892, 2669, 29918, 26061, 29901, 26494, 18680, 1125, 13, 1678, 9995, 3057, 746, 591, 505, 4436, 2645, 3957, 1213, 15945, 13, 1678, 1121, 353, 7272, 298, 465, 29889, 2917, 29918, 26586, 29889, 1731, 29889, 12674, 29918, 2344, 29898, 13, 4706, 11662, 29032, 29892, 13, 4706, 3030, 3790, 29908, 4993, 1115, 7791, 4574, 4741, 29918, 11889, 1118, 13, 4706, 848, 3790, 6007, 29943, 29918, 20832, 29901, 379, 3718, 29892, 8707, 29943, 29918, 11889, 5813, 29901, 3148, 1001, 5813, 29892, 8707, 29943, 29918, 25711, 17013, 29901, 17687, 1799, 17013, 1118, 13, 1678, 1723, 13, 1678, 4974, 1121, 3366, 1853, 3108, 1275, 848, 29918, 8269, 29918, 1731, 29889, 15989, 8647, 29918, 11116, 29918, 19094, 13, 1678, 4974, 1121, 3366, 12523, 3108, 1275, 8853, 3188, 1115, 376, 26690, 9092, 13, 2 ]
test.py
minizon/Mask_RCNN_KP
1
46953
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 11 21:22:59 2018 @author: pami4 """ #CUDA_VISIBLE_DEVICES=0 python from pycocotools.coco import COCO import coco import numpy as np from matplotlib import pyplot as plt import visualize import custom_utils config = coco.CocoConfig() config.GPU_COUNT = 1 import CustomDataset data_train=CustomDataset.CocoDataset() data_train.load_coco("..","train", year=2014) data_train.prepare() #import CustomDataGenerator #data_gen=CustomDataGenerator.data_generator(data_train, config, batch_size=2, shuffle=False, augment=False) from CustomDataGenerator import CustomDatasetIterator_MaskRCNN data_gen = CustomDatasetIterator_MaskRCNN(data_train, config, mode="val", shuffle=False, batch_size=2, augment=True) #plt.imshow((images[0]+config.MEAN_PIXEL).astype(np.uint8)) import model as modellib model=modellib.MaskRCNN(mode="training", config=config, model_dir="logs") model.load_weights("logs/coco20180327T1023/mask_rcnn_coco_0050.h5", by_name=True, skip_mismatch=True) #model.load_weights("/home/pami4/.keras/models/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5", by_name=True) inputs, outputs= next(data_gen) outs=model.keras_model.predict(inputs) #out_kp_vs = outs[18] #np.where(out_kp_vs) # # #out_kp_masks=outs[19] images = inputs[0] rois = outs[8] img_idx=0 visualize.draw_boxes((images[img_idx]+config.MEAN_PIXEL).astype(np.uint8), boxes=rois[img_idx][:10]*np.array([1024,1024,1024,1024])) plt.show() #layer=model.keras_model.get_layer(name='kp_mask_bilinear_up') #layer.get_weights()[0].shape kp_masks=outs[-3] kp_vs = outs[-4] target_masks = outs[-1] target_class_ids=outs[-2] pred_kp_masks=outs[10] pred_masks = outs[6] #target_class_ids.shape img_idx=0 index=1 visualize.draw_boxes((images[img_idx]+config.MEAN_PIXEL).astype(np.uint8), boxes=rois[img_idx][index:index+1]*np.array([1024,1024,1024,1024])) plt.show() custom_utils.showKPs((images[img_idx]+config.MEAN_PIXEL).astype(np.uint8), rois[img_idx][index]*np.array([1024,1024,1024,1024]),kp_vs[img_idx][index], kp_masks[img_idx][index], target_masks[img_idx][index]) plt.imshow(np.sum(kp_masks[1][index], axis=2)) plt.show() #custom_utils.showKPs((images[1]+config.MEAN_PIXEL).astype(np.uint8), rois[1][index]*np.array([1024,1024,1024,1024]),kp_vs[1][index], kp_masks[1][index]) #pred_kp_masks=outs[10] #pred_masks = outs[6] #custom_utils.showKPs((images[1]+config.MEAN_PIXEL).astype(np.uint8), rois[1][index]*np.array([1024,1024,1024,1024]),kp_vs[1][index], pred_kp_masks[1][index]) custom_utils.showKPs((images[img_idx]+config.MEAN_PIXEL).astype(np.uint8), rois[img_idx][index]*np.array([1024,1024,1024,1024]),kp_vs[img_idx][index], pred_kp_masks[img_idx][index], pred_masks[img_idx][index][:,:,1]) from imp import reload
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 8991, 1085, 29871, 29896, 29896, 29871, 29906, 29896, 29901, 29906, 29906, 29901, 29945, 29929, 29871, 29906, 29900, 29896, 29947, 13, 13, 29992, 8921, 29901, 282, 4479, 29946, 13, 15945, 29908, 13, 13, 29937, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 29922, 29900, 3017, 13, 3166, 282, 11078, 542, 327, 8789, 29889, 29883, 6235, 1053, 4810, 3217, 13, 5215, 274, 6235, 13, 5215, 12655, 408, 7442, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 5215, 7604, 675, 13, 13, 5215, 2888, 29918, 13239, 13, 13, 2917, 353, 274, 6235, 29889, 29907, 6235, 3991, 580, 13, 2917, 29889, 29954, 7056, 29918, 18736, 353, 29871, 29896, 13, 13, 5215, 8701, 16390, 24541, 13, 1272, 29918, 14968, 29922, 7281, 16390, 24541, 29889, 29907, 6235, 16390, 24541, 580, 13, 1272, 29918, 14968, 29889, 1359, 29918, 29883, 6235, 703, 636, 3284, 14968, 613, 1629, 29922, 29906, 29900, 29896, 29946, 29897, 13, 1272, 29918, 14968, 29889, 19125, 580, 13, 13, 29937, 5215, 8701, 1469, 21575, 13, 29937, 1272, 29918, 1885, 29922, 7281, 1469, 21575, 29889, 1272, 29918, 27959, 29898, 1272, 29918, 14968, 29892, 2295, 29892, 9853, 29918, 2311, 29922, 29906, 29892, 528, 21897, 29922, 8824, 29892, 18765, 29922, 8824, 29897, 13, 3166, 8701, 1469, 21575, 1053, 8701, 16390, 24541, 20277, 29918, 19832, 10363, 10262, 13, 1272, 29918, 1885, 353, 8701, 16390, 24541, 20277, 29918, 19832, 10363, 10262, 29898, 1272, 29918, 14968, 29892, 2295, 29892, 4464, 543, 791, 613, 528, 21897, 29922, 8824, 29892, 13, 462, 462, 308, 9853, 29918, 2311, 29922, 29906, 29892, 18765, 29922, 5574, 29897, 13, 13, 29937, 572, 29873, 29889, 326, 4294, 3552, 8346, 29961, 29900, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 13, 13, 5215, 1904, 408, 1904, 1982, 13, 4299, 29922, 4299, 1982, 29889, 19832, 10363, 10262, 29898, 8513, 543, 26495, 613, 2295, 29922, 2917, 29892, 1904, 29918, 3972, 543, 20756, 1159, 13, 4299, 29889, 1359, 29918, 705, 5861, 703, 20756, 29914, 29883, 6235, 29906, 29900, 29896, 29947, 29900, 29941, 29906, 29955, 29911, 29896, 29900, 29906, 29941, 29914, 13168, 29918, 2214, 15755, 29918, 29883, 6235, 29918, 29900, 29900, 29945, 29900, 29889, 29882, 29945, 613, 491, 29918, 978, 29922, 5574, 29892, 14383, 29918, 29885, 1608, 905, 29922, 5574, 29897, 13, 29937, 4299, 29889, 1359, 29918, 705, 5861, 11974, 5184, 29914, 29886, 4479, 29946, 6294, 3946, 294, 29914, 9794, 29914, 690, 1212, 29945, 29900, 29918, 705, 5861, 29918, 13264, 29918, 6229, 29918, 2098, 292, 29918, 13264, 29918, 22178, 1379, 29918, 1333, 459, 29889, 29882, 29945, 613, 491, 29918, 978, 29922, 5574, 29897, 13, 13, 2080, 29879, 29892, 14391, 29922, 2446, 29898, 1272, 29918, 1885, 29897, 13, 13, 17718, 29922, 4299, 29889, 3946, 294, 29918, 4299, 29889, 27711, 29898, 2080, 29879, 29897, 13, 13, 29937, 449, 29918, 29895, 29886, 29918, 4270, 353, 714, 29879, 29961, 29896, 29947, 29962, 13, 29937, 9302, 29889, 3062, 29898, 449, 29918, 29895, 29886, 29918, 4270, 29897, 13, 29937, 13, 29937, 13, 29937, 449, 29918, 29895, 29886, 29918, 13168, 29879, 29922, 17718, 29961, 29896, 29929, 29962, 13, 13, 8346, 353, 10970, 29961, 29900, 29962, 13, 307, 275, 353, 714, 29879, 29961, 29947, 29962, 13, 2492, 29918, 13140, 29922, 29900, 13, 20119, 675, 29889, 4012, 29918, 1884, 267, 3552, 8346, 29961, 2492, 29918, 13140, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 16273, 29922, 307, 275, 29961, 2492, 29918, 13140, 3816, 29901, 29896, 29900, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 12622, 13, 572, 29873, 29889, 4294, 580, 13, 13, 29937, 13148, 29922, 4299, 29889, 3946, 294, 29918, 4299, 29889, 657, 29918, 13148, 29898, 978, 2433, 29895, 29886, 29918, 13168, 29918, 18152, 457, 279, 29918, 786, 1495, 13, 29937, 13148, 29889, 657, 29918, 705, 5861, 580, 29961, 29900, 1822, 12181, 13, 13, 29895, 29886, 29918, 13168, 29879, 29922, 17718, 14352, 29941, 29962, 13, 29895, 29886, 29918, 4270, 353, 714, 29879, 14352, 29946, 29962, 13, 5182, 29918, 13168, 29879, 353, 714, 29879, 14352, 29896, 29962, 13, 5182, 29918, 1990, 29918, 4841, 29922, 17718, 14352, 29906, 29962, 13, 11965, 29918, 29895, 29886, 29918, 13168, 29879, 29922, 17718, 29961, 29896, 29900, 29962, 13, 11965, 29918, 13168, 29879, 353, 714, 29879, 29961, 29953, 29962, 13, 29937, 5182, 29918, 1990, 29918, 4841, 29889, 12181, 13, 13, 13, 13, 2492, 29918, 13140, 29922, 29900, 13, 2248, 29922, 29896, 13, 20119, 675, 29889, 4012, 29918, 1884, 267, 3552, 8346, 29961, 2492, 29918, 13140, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 16273, 29922, 307, 275, 29961, 2492, 29918, 13140, 3816, 2248, 29901, 2248, 29974, 29896, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 12622, 13, 572, 29873, 29889, 4294, 580, 13, 13, 6341, 29918, 13239, 29889, 4294, 29968, 29925, 29879, 3552, 8346, 29961, 2492, 29918, 13140, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 696, 275, 29961, 2492, 29918, 13140, 3816, 2248, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 11724, 29895, 29886, 29918, 4270, 29961, 2492, 29918, 13140, 3816, 2248, 1402, 413, 29886, 29918, 13168, 29879, 29961, 2492, 29918, 13140, 3816, 2248, 1402, 3646, 29918, 13168, 29879, 29961, 2492, 29918, 13140, 3816, 2248, 2314, 13, 13, 572, 29873, 29889, 326, 4294, 29898, 9302, 29889, 2083, 29898, 29895, 29886, 29918, 13168, 29879, 29961, 29896, 3816, 2248, 1402, 9685, 29922, 29906, 876, 13, 572, 29873, 29889, 4294, 580, 13, 13, 29937, 6341, 29918, 13239, 29889, 4294, 29968, 29925, 29879, 3552, 8346, 29961, 29896, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 696, 275, 29961, 29896, 3816, 2248, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 11724, 29895, 29886, 29918, 4270, 29961, 29896, 3816, 2248, 1402, 413, 29886, 29918, 13168, 29879, 29961, 29896, 3816, 2248, 2314, 13, 13, 29937, 11965, 29918, 29895, 29886, 29918, 13168, 29879, 29922, 17718, 29961, 29896, 29900, 29962, 13, 29937, 11965, 29918, 13168, 29879, 353, 714, 29879, 29961, 29953, 29962, 13, 29937, 6341, 29918, 13239, 29889, 4294, 29968, 29925, 29879, 3552, 8346, 29961, 29896, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 696, 275, 29961, 29896, 3816, 2248, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 11724, 29895, 29886, 29918, 4270, 29961, 29896, 3816, 2248, 1402, 4450, 29918, 29895, 29886, 29918, 13168, 29879, 29961, 29896, 3816, 2248, 2314, 13, 6341, 29918, 13239, 29889, 4294, 29968, 29925, 29879, 3552, 8346, 29961, 2492, 29918, 13140, 10062, 2917, 29889, 2303, 2190, 29918, 2227, 29990, 6670, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 511, 696, 275, 29961, 2492, 29918, 13140, 3816, 2248, 14178, 9302, 29889, 2378, 4197, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 29892, 29896, 29900, 29906, 29946, 11724, 29895, 29886, 29918, 4270, 29961, 2492, 29918, 13140, 3816, 2248, 1402, 4450, 29918, 29895, 29886, 29918, 13168, 29879, 29961, 2492, 29918, 13140, 3816, 2248, 1402, 4450, 29918, 13168, 29879, 29961, 2492, 29918, 13140, 3816, 2248, 3816, 29901, 29892, 29901, 29892, 29896, 2314, 13, 13, 3166, 2411, 1053, 19763, 13, 2 ]
preprocessing/her2_split_and_imbalance.py
minotm/NTA
1
143853
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created 2022 @author: <NAME> """ from Levenshtein import distance as levenshtein_distance import pandas as pd import numpy as np from sklearn.model_selection import train_test_split print('Now Executing Trastuzumab Train/Val/Test Splitting...') """ This script serves to split the trastuzumab (her2) data into training, validation, and testing sets. The train and validation sets are selected to be an edit distance of 7 or less from the wild type trastuzumab. The test set is an edit distance of 8 or greater from the wild type Inputs ---------- labeled trastuzumab data from Mason et. al 2021 github repo: https://github.com/dahjan/DMS_opt mHER_H3_AgPos.csv mHER_H3_AgNeg.csv Outputs ------- csv files containing training, validation, and testing sets """ def add_LD_to_df(antigen_ID, data_frame): ''' Function to add Edit Distance (Levenshtein Distance) from wt for each sequence to dataframe Parameters ---------- antigen_ID : str corresponds to the antigen identity. in this case, her2 data_frame : pandas.DataFrame dataframe containing all sequence & label data Returns ------- data_frame : pandas.DataFrame input dataframe with an added column containing the Levenshtein Distance from the wild type for each sequence in the dataframe ''' if antigen_ID == 'her2': wt_str = 'WGGDGFYAMK' LD_arr = [] for i in range(len(data_frame)): LD_arr.append( levenshtein_distance(wt_str, data_frame['AASeq'].iloc[i]) ) data_frame['LD'] = LD_arr return data_frame def class_balance_binary(data_frame): ''' Function to class balance dataset Parameters ---------- data_frame : pandas.DataFrame dataframe containing all sequence & label data Returns ------- data_frame : pandas.DataFrame class balanced dataframe. number of positive examples is equal to the number of negatives ''' positives = data_frame[data_frame['AgClass'] == 1].copy() negatives = data_frame[data_frame['AgClass'] == 0].copy() min_list = min([len(ls) for ls in [positives, negatives]]) positives = positives[: int(np.round(min_list))] negatives = negatives[: int(np.round(min_list))] return positives, negatives her2_path_local = '../data/her2/' pos = pd.read_csv(her2_path_local + 'mHER_H3_AgPos.csv') neg = pd.read_csv(her2_path_local + 'mHER_H3_AgNeg.csv') def combine_df_list_and_shuffle(df_list, keep = False): ''' combines two dataframes, drops duplicates, & shuffles Parameters ---------- data_frame : pandas.DataFrame dataframe containing all sequence & label data keep: bool whether or not to keep duplicates Returns ------- data_frame : pandas.DataFrame combined, shuffled dataframe ''' frames = df_list common_cols = list(set.intersection(*(set(df.columns) for df in frames))) combined_df = pd.concat([df[common_cols] for df in frames], ignore_index=True).drop_duplicates(subset='AASeq', keep=keep) np.random.seed(0) combined_df = combined_df.reindex(np.random.permutation(combined_df.index)) return combined_df all_data_frames = [pos.copy(), neg.copy()] data_frame = combine_df_list_and_shuffle(all_data_frames, keep = False) data_frame = add_LD_to_df('her2', data_frame) selected_LD_split = 7 train_df = data_frame[data_frame['LD'] <= selected_LD_split] test_df_initial = data_frame[data_frame['LD'] > selected_LD_split] #Function to drop duplicates from two dataframes def drop_test_seqs(train_df, test_df, seq_name): ''' Function serves as a check to prevent dataleakage between training & test or training & val sets Parameters ---------- train_df : pandas.DataFrame train dataframe test_df : pandas.DataFrame test dataframe seq_name : str corresponds to the dataframe column name containing sequences. Returns ------- out_df : TYPE train dataframe without test sequences ''' train_df = train_df.copy() train_df['df'] = 'train' test_df_copy = test_df.copy() test_df_copy['df'] = 'test' frames = [train_df.copy(),test_df_copy] common_cols = list(set.intersection(*(set(df.columns) for df in frames))) concat_df = pd.concat([df[common_cols] for df in frames], ignore_index=True) concat_df = concat_df.drop_duplicates(subset=[seq_name],keep=False) out_df = concat_df[concat_df['df'] == 'train'] return out_df train_df = drop_test_seqs(train_df, test_df_initial, 'AASeq') def drop_and_rename_columns(df): df = df.copy() df = df.rename(columns = {'AASeq': 'aaseq', 'AgClass': 'target'}) df = df.drop(columns = ['Unnamed: 0', 'Fraction', 'NucSeq', 'Count', 'df']) return df #Balance test set & save to csv test_df = test_df_initial.copy() test_df['df'] = 'test' #add to df to facilitate using the function below test_df = drop_and_rename_columns(test_df) test_positives = test_df[test_df['target'] == 1] test_negs = test_df[test_df['target'] == 0].sample(n = int(len(test_positives)), random_state = 1) test_df = test_positives.append(test_negs,ignore_index = True) test_df = test_df.reindex(np.random.permutation(test_df.index)) out_path = '../data/her2/' test_df.to_csv(out_path + 'her2_test.csv', index=False) train_df = drop_and_rename_columns(train_df) #Class balance full training data set & shuffle dataframe initial_train_pos = train_df[train_df['target'] == 1] initial_train_neg = train_df[train_df['target'] == 0] initial_train_neg = initial_train_neg[initial_train_neg['LD'] != 3] #drop the single LD 3 seq from df. required for sklearn train test stratifying later in script initial_train_pos = initial_train_pos[initial_train_pos['LD'] != 2] #drop the two LD 2 seq from df. required for sklearn train test stratifying later in script minlen = min([len(initial_train_pos),len(initial_train_neg) ]) initial_train_pos = initial_train_pos.sample(n = minlen, random_state = 1) initial_train_neg = initial_train_neg.sample(n = minlen, random_state = 1) train_df = pd.DataFrame() train_df = initial_train_pos.append(initial_train_neg, ignore_index = True) train_df = train_df.sample(n = int(len(train_df)), random_state = 1) #Batch training & val sets with different quantities of class imbalance using positives as the minority class class_imbalance_qty_list = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 1.0] train_df_master_copy = train_df.copy() for imbal_qty in class_imbalance_qty_list: #artificially increase class imbalance in training set by downsampling positives train_positives = train_df_master_copy[train_df_master_copy['target'] == 1] train_negs = train_df_master_copy[train_df_master_copy['target'] == 0] #new downsampling method using sklearn & edit distance if imbal_qty != 1.0: train_positives, x_discard, y_train, y_discard = train_test_split(train_positives, train_positives['target'], test_size = 1 - imbal_qty, random_state = 1, shuffle = True, stratify = train_positives['LD']) elif imbal_qty == 1.0: train_truncated = train_positives #split val set from training & maintain LD distribution per class train_positives, val_positives, y_train, y_val = train_test_split(train_positives, train_positives['target'], test_size = 1 - 0.8, random_state = 1, shuffle = True, stratify = train_positives['LD']) train_negs, val_negs, y_train, y_val = train_test_split(train_negs, train_negs['target'], test_size = 1 - 0.8, random_state = 1, shuffle = True, stratify = train_negs['LD']) train_df = train_positives.append(train_negs,ignore_index = True) train_df = train_df.reindex(np.random.permutation(train_df.index)) val_df = val_positives.append(val_negs,ignore_index = True) val_df = val_df.reindex(np.random.permutation(val_df.index)) train_df = drop_test_seqs(train_df, val_df, 'aaseq') train_df = train_df.drop(columns = ['df']) train_df = train_df.drop(columns = ['LD']) val_df = val_df.drop(columns = ['LD']) out_str_train = out_path + 'her2_train_imbal_' + str(imbal_qty) + '.csv' out_str_val = out_path + 'her2_val_imbal_' + str(imbal_qty) + '.csv' train_df.to_csv(out_str_train, index=False) val_df.to_csv(out_str_val, index=False)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 29871, 29906, 29900, 29906, 29906, 13, 13, 29992, 8921, 29901, 529, 5813, 29958, 13, 15945, 29908, 13, 3166, 951, 9852, 29882, 371, 262, 1053, 5418, 408, 454, 9852, 29882, 371, 262, 29918, 19244, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 13, 13, 2158, 877, 10454, 11080, 17068, 1605, 579, 3365, 398, 370, 28186, 29914, 1440, 29914, 3057, 317, 572, 5367, 856, 1495, 13, 13, 15945, 29908, 13, 4013, 2471, 19700, 304, 6219, 278, 534, 579, 3365, 398, 370, 313, 2276, 29906, 29897, 848, 964, 6694, 29892, 8845, 29892, 322, 6724, 6166, 29889, 450, 7945, 13, 392, 8845, 6166, 526, 4629, 304, 367, 385, 3863, 5418, 310, 29871, 29955, 470, 3109, 515, 278, 8775, 1134, 534, 579, 3365, 398, 370, 29889, 450, 29871, 13, 1688, 731, 338, 385, 3863, 5418, 310, 29871, 29947, 470, 7621, 515, 278, 8775, 1134, 13, 13, 4290, 29879, 13, 28400, 13, 29880, 24025, 534, 579, 3365, 398, 370, 848, 515, 28095, 634, 29889, 394, 29871, 29906, 29900, 29906, 29896, 18546, 13761, 29901, 2045, 597, 3292, 29889, 510, 29914, 29881, 801, 8931, 29914, 29928, 4345, 29918, 3670, 13, 29885, 4448, 29918, 29950, 29941, 29918, 14769, 9135, 29889, 7638, 13, 29885, 4448, 29918, 29950, 29941, 29918, 14769, 29940, 387, 29889, 7638, 13, 13, 6466, 29879, 13, 26589, 13, 7638, 2066, 6943, 6694, 29892, 8845, 29892, 322, 6724, 6166, 13, 15945, 29908, 268, 13, 13, 1753, 788, 29918, 10249, 29918, 517, 29918, 2176, 29898, 424, 2101, 29918, 1367, 29892, 848, 29918, 2557, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 788, 7641, 6652, 749, 313, 3226, 9852, 29882, 371, 262, 6652, 749, 29897, 515, 281, 29873, 363, 1269, 5665, 304, 12205, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 3677, 2101, 29918, 1367, 584, 851, 13, 4706, 16161, 304, 278, 3677, 2101, 10110, 29889, 297, 445, 1206, 29892, 902, 29906, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 12205, 6943, 599, 5665, 669, 3858, 848, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 1881, 12205, 411, 385, 2715, 1897, 6943, 278, 951, 9852, 29882, 371, 262, 6652, 749, 515, 278, 8775, 1134, 13, 4706, 363, 1269, 5665, 297, 278, 12205, 13, 1678, 14550, 13, 268, 13, 1678, 565, 3677, 2101, 29918, 1367, 1275, 525, 2276, 29906, 2396, 13, 4706, 281, 29873, 29918, 710, 353, 525, 29956, 26788, 29928, 29954, 29943, 29979, 5194, 29968, 29915, 13, 1678, 365, 29928, 29918, 2749, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 1272, 29918, 2557, 22164, 13, 4706, 365, 29928, 29918, 2749, 29889, 4397, 29898, 454, 9852, 29882, 371, 262, 29918, 19244, 29898, 14554, 29918, 710, 29892, 848, 29918, 2557, 1839, 29909, 3289, 1837, 13359, 309, 542, 29961, 29875, 2314, 1723, 13, 1678, 848, 29918, 2557, 1839, 10249, 2033, 353, 365, 29928, 29918, 2749, 13, 268, 13, 1678, 736, 848, 29918, 2557, 13, 13, 1753, 770, 29918, 5521, 749, 29918, 19541, 29898, 1272, 29918, 2557, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 770, 17346, 8783, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 12205, 6943, 599, 5665, 669, 3858, 848, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 770, 6411, 8362, 12205, 29889, 1353, 310, 6374, 6455, 338, 5186, 304, 278, 1353, 310, 3480, 5056, 13, 1678, 14550, 13, 1678, 13686, 3145, 353, 848, 29918, 2557, 29961, 1272, 29918, 2557, 1839, 14769, 2385, 2033, 1275, 29871, 29896, 1822, 8552, 580, 13, 1678, 3480, 5056, 353, 848, 29918, 2557, 29961, 1272, 29918, 2557, 1839, 14769, 2385, 2033, 1275, 29871, 29900, 1822, 8552, 580, 13, 1678, 1375, 29918, 1761, 353, 1375, 4197, 2435, 29898, 3137, 29897, 363, 19375, 297, 518, 1066, 277, 3145, 29892, 3480, 5056, 24960, 13, 1678, 13686, 3145, 353, 13686, 3145, 7503, 938, 29898, 9302, 29889, 14486, 29898, 1195, 29918, 1761, 28166, 29871, 13, 1678, 3480, 5056, 353, 3480, 5056, 7503, 938, 29898, 9302, 29889, 14486, 29898, 1195, 29918, 1761, 28166, 29871, 13, 1678, 736, 13686, 3145, 29892, 3480, 5056, 13, 13, 13, 2276, 29906, 29918, 2084, 29918, 2997, 353, 525, 6995, 1272, 29914, 2276, 29906, 22208, 13, 13, 1066, 353, 10518, 29889, 949, 29918, 7638, 29898, 2276, 29906, 29918, 2084, 29918, 2997, 718, 525, 29885, 4448, 29918, 29950, 29941, 29918, 14769, 9135, 29889, 7638, 1495, 13, 10052, 353, 10518, 29889, 949, 29918, 7638, 29898, 2276, 29906, 29918, 2084, 29918, 2997, 718, 525, 29885, 4448, 29918, 29950, 29941, 29918, 14769, 29940, 387, 29889, 7638, 1495, 13, 13, 1753, 14405, 29918, 2176, 29918, 1761, 29918, 392, 29918, 845, 21897, 29898, 2176, 29918, 1761, 29892, 3013, 353, 7700, 1125, 13, 1678, 14550, 13, 1678, 4145, 1475, 1023, 848, 19935, 29892, 4441, 567, 20955, 29892, 669, 528, 3096, 793, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 12205, 6943, 599, 5665, 669, 3858, 848, 13, 1678, 3013, 29901, 6120, 13, 4706, 3692, 470, 451, 304, 3013, 20955, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 848, 29918, 2557, 584, 11701, 29889, 17271, 13, 4706, 12420, 29892, 528, 3096, 839, 12205, 13, 1678, 14550, 13, 1678, 16608, 353, 4489, 29918, 1761, 13, 1678, 3619, 29918, 22724, 353, 1051, 29898, 842, 29889, 1639, 2042, 10456, 29898, 842, 29898, 2176, 29889, 13099, 29897, 363, 4489, 297, 16608, 4961, 13, 1678, 12420, 29918, 2176, 353, 10518, 29889, 17685, 4197, 2176, 29961, 9435, 29918, 22724, 29962, 363, 4489, 297, 16608, 1402, 11455, 29918, 2248, 29922, 5574, 467, 8865, 29918, 20908, 15815, 29898, 6484, 2433, 29909, 3289, 1837, 742, 3013, 29922, 17462, 29897, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 29900, 29897, 13, 1678, 12420, 29918, 2176, 353, 12420, 29918, 2176, 29889, 276, 2248, 29898, 9302, 29889, 8172, 29889, 546, 6149, 362, 29898, 17743, 1312, 29918, 2176, 29889, 2248, 876, 13, 1678, 736, 12420, 29918, 2176, 13, 13, 497, 29918, 1272, 29918, 19935, 353, 518, 1066, 29889, 8552, 3285, 3480, 29889, 8552, 580, 29962, 13, 1272, 29918, 2557, 353, 14405, 29918, 2176, 29918, 1761, 29918, 392, 29918, 845, 21897, 29898, 497, 29918, 1272, 29918, 19935, 29892, 3013, 353, 7700, 29897, 13, 1272, 29918, 2557, 353, 788, 29918, 10249, 29918, 517, 29918, 2176, 877, 2276, 29906, 742, 848, 29918, 2557, 29897, 13, 13, 13, 8391, 29918, 10249, 29918, 5451, 353, 29871, 29955, 13, 14968, 29918, 2176, 353, 848, 29918, 2557, 29961, 1272, 29918, 2557, 1839, 10249, 2033, 5277, 4629, 29918, 10249, 29918, 5451, 29962, 13, 1688, 29918, 2176, 29918, 11228, 353, 848, 29918, 2557, 29961, 1272, 29918, 2557, 1839, 10249, 2033, 1405, 4629, 29918, 10249, 29918, 5451, 29962, 13, 13, 29937, 6678, 304, 5768, 20955, 515, 1023, 848, 19935, 13, 1753, 5768, 29918, 1688, 29918, 11762, 29879, 29898, 14968, 29918, 2176, 29892, 1243, 29918, 2176, 29892, 19359, 29918, 978, 1125, 13, 1678, 14550, 13, 1678, 6680, 19700, 408, 263, 1423, 304, 5557, 848, 280, 557, 482, 1546, 6694, 669, 1243, 470, 6694, 669, 659, 6166, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 7945, 29918, 2176, 584, 11701, 29889, 17271, 13, 4706, 7945, 12205, 13, 1678, 1243, 29918, 2176, 584, 11701, 29889, 17271, 13, 4706, 1243, 12205, 13, 1678, 19359, 29918, 978, 584, 851, 13, 4706, 16161, 304, 278, 12205, 1897, 1024, 6943, 15602, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 714, 29918, 2176, 584, 323, 6959, 13, 4706, 7945, 12205, 1728, 1243, 15602, 13, 1678, 14550, 13, 1678, 7945, 29918, 2176, 353, 7945, 29918, 2176, 29889, 8552, 580, 13, 1678, 7945, 29918, 2176, 1839, 2176, 2033, 353, 525, 14968, 29915, 13, 1678, 1243, 29918, 2176, 29918, 8552, 353, 1243, 29918, 2176, 29889, 8552, 580, 13, 1678, 1243, 29918, 2176, 29918, 8552, 1839, 2176, 2033, 353, 525, 1688, 29915, 13, 1678, 16608, 353, 518, 14968, 29918, 2176, 29889, 8552, 3285, 1688, 29918, 2176, 29918, 8552, 29962, 13, 1678, 3619, 29918, 22724, 353, 1051, 29898, 842, 29889, 1639, 2042, 10456, 29898, 842, 29898, 2176, 29889, 13099, 29897, 363, 4489, 297, 16608, 4961, 13, 1678, 3022, 271, 29918, 2176, 353, 10518, 29889, 17685, 4197, 2176, 29961, 9435, 29918, 22724, 29962, 363, 4489, 297, 16608, 1402, 11455, 29918, 2248, 29922, 5574, 29897, 13, 1678, 3022, 271, 29918, 2176, 353, 3022, 271, 29918, 2176, 29889, 8865, 29918, 20908, 15815, 29898, 6484, 11759, 11762, 29918, 978, 1402, 17462, 29922, 8824, 29897, 13, 1678, 714, 29918, 2176, 353, 3022, 271, 29918, 2176, 29961, 17685, 29918, 2176, 1839, 2176, 2033, 1275, 525, 14968, 2033, 13, 1678, 736, 714, 29918, 2176, 13, 13, 14968, 29918, 2176, 353, 5768, 29918, 1688, 29918, 11762, 29879, 29898, 14968, 29918, 2176, 29892, 1243, 29918, 2176, 29918, 11228, 29892, 525, 29909, 3289, 1837, 1495, 13, 13, 1753, 5768, 29918, 392, 29918, 1267, 420, 29918, 13099, 29898, 2176, 1125, 13, 1678, 4489, 353, 4489, 29889, 8552, 580, 13, 1678, 4489, 353, 4489, 29889, 1267, 420, 29898, 13099, 353, 11117, 29909, 3289, 1837, 2396, 525, 29874, 559, 29939, 742, 525, 14769, 2385, 2396, 525, 5182, 29915, 1800, 13, 1678, 4489, 353, 4489, 29889, 8865, 29898, 13099, 353, 6024, 2525, 17514, 29901, 29871, 29900, 742, 525, 29943, 13857, 742, 525, 29940, 1682, 23718, 742, 525, 3981, 742, 525, 2176, 11287, 13, 1678, 736, 4489, 13, 268, 13, 29937, 22031, 749, 1243, 731, 669, 4078, 304, 11799, 29871, 13, 1688, 29918, 2176, 353, 1243, 29918, 2176, 29918, 11228, 29889, 8552, 580, 13, 1688, 29918, 2176, 1839, 2176, 2033, 353, 525, 1688, 29915, 396, 1202, 304, 4489, 304, 16089, 10388, 773, 278, 740, 2400, 13, 1688, 29918, 2176, 353, 5768, 29918, 392, 29918, 1267, 420, 29918, 13099, 29898, 1688, 29918, 2176, 29897, 13, 1688, 29918, 1066, 277, 3145, 353, 1243, 29918, 2176, 29961, 1688, 29918, 2176, 1839, 5182, 2033, 1275, 29871, 29896, 29962, 13, 1688, 29918, 10052, 29879, 353, 1243, 29918, 2176, 29961, 1688, 29918, 2176, 1839, 5182, 2033, 1275, 29871, 29900, 1822, 11249, 29898, 29876, 353, 938, 29898, 2435, 29898, 1688, 29918, 1066, 277, 3145, 8243, 4036, 29918, 3859, 353, 29871, 29896, 29897, 13, 1688, 29918, 2176, 353, 1243, 29918, 1066, 277, 3145, 29889, 4397, 29898, 1688, 29918, 10052, 29879, 29892, 17281, 29918, 2248, 353, 5852, 29897, 13, 1688, 29918, 2176, 353, 1243, 29918, 2176, 29889, 276, 2248, 29898, 9302, 29889, 8172, 29889, 546, 6149, 362, 29898, 1688, 29918, 2176, 29889, 2248, 876, 13, 13, 449, 29918, 2084, 353, 525, 6995, 1272, 29914, 2276, 29906, 22208, 13, 1688, 29918, 2176, 29889, 517, 29918, 7638, 29898, 449, 29918, 2084, 718, 525, 2276, 29906, 29918, 1688, 29889, 7638, 742, 2380, 29922, 8824, 29897, 13, 13, 13, 14968, 29918, 2176, 353, 5768, 29918, 392, 29918, 1267, 420, 29918, 13099, 29898, 14968, 29918, 2176, 29897, 13, 13, 29937, 2385, 17346, 2989, 6694, 848, 731, 669, 528, 21897, 12205, 13, 11228, 29918, 14968, 29918, 1066, 353, 7945, 29918, 2176, 29961, 14968, 29918, 2176, 1839, 5182, 2033, 1275, 29871, 29896, 29962, 13, 11228, 29918, 14968, 29918, 10052, 353, 7945, 29918, 2176, 29961, 14968, 29918, 2176, 1839, 5182, 2033, 1275, 29871, 29900, 29962, 13, 13, 11228, 29918, 14968, 29918, 10052, 353, 2847, 29918, 14968, 29918, 10052, 29961, 11228, 29918, 14968, 29918, 10052, 1839, 10249, 2033, 2804, 29871, 29941, 29962, 396, 8865, 278, 2323, 365, 29928, 29871, 29941, 19359, 515, 4489, 29889, 3734, 363, 2071, 19668, 7945, 1243, 26742, 9215, 2678, 297, 2471, 13, 11228, 29918, 14968, 29918, 1066, 353, 2847, 29918, 14968, 29918, 1066, 29961, 11228, 29918, 14968, 29918, 1066, 1839, 10249, 2033, 2804, 29871, 29906, 29962, 396, 8865, 278, 1023, 365, 29928, 29871, 29906, 19359, 515, 4489, 29889, 3734, 363, 2071, 19668, 7945, 1243, 26742, 9215, 2678, 297, 2471, 13, 13, 1195, 2435, 353, 1375, 4197, 2435, 29898, 11228, 29918, 14968, 29918, 1066, 511, 2435, 29898, 11228, 29918, 14968, 29918, 10052, 29897, 29871, 2314, 13, 11228, 29918, 14968, 29918, 1066, 353, 2847, 29918, 14968, 29918, 1066, 29889, 11249, 29898, 29876, 353, 1375, 2435, 29892, 4036, 29918, 3859, 353, 29871, 29896, 29897, 13, 11228, 29918, 14968, 29918, 10052, 353, 2847, 29918, 14968, 29918, 10052, 29889, 11249, 29898, 29876, 353, 1375, 2435, 29892, 4036, 29918, 3859, 353, 29871, 29896, 29897, 13, 13, 13, 14968, 29918, 2176, 353, 10518, 29889, 17271, 580, 13, 14968, 29918, 2176, 353, 2847, 29918, 14968, 29918, 1066, 29889, 4397, 29898, 11228, 29918, 14968, 29918, 10052, 29892, 11455, 29918, 2248, 353, 5852, 29897, 13, 14968, 29918, 2176, 353, 7945, 29918, 2176, 29889, 11249, 29898, 29876, 353, 938, 29898, 2435, 29898, 14968, 29918, 2176, 8243, 4036, 29918, 3859, 353, 29871, 29896, 29897, 13, 13, 29937, 23145, 6694, 669, 659, 6166, 411, 1422, 26855, 310, 770, 527, 5521, 749, 773, 13686, 3145, 408, 278, 9461, 537, 770, 13, 1990, 29918, 326, 5521, 749, 29918, 29939, 1017, 29918, 1761, 353, 518, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29906, 29892, 29871, 29900, 29889, 29941, 29892, 29871, 29900, 29889, 29946, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29953, 29892, 29871, 29900, 29889, 29955, 29892, 29871, 29900, 29889, 29947, 29892, 29871, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29929, 29945, 29892, 29871, 29896, 29889, 29900, 29962, 29871, 13, 13, 13, 14968, 29918, 2176, 29918, 6207, 29918, 8552, 353, 7945, 29918, 2176, 29889, 8552, 580, 13, 1454, 527, 5521, 29918, 29939, 1017, 297, 770, 29918, 326, 5521, 749, 29918, 29939, 1017, 29918, 1761, 29901, 13, 1678, 396, 442, 928, 616, 368, 7910, 770, 527, 5521, 749, 297, 6694, 731, 491, 1623, 13445, 10335, 13686, 3145, 13, 1678, 7945, 29918, 1066, 277, 3145, 353, 7945, 29918, 2176, 29918, 6207, 29918, 8552, 29961, 14968, 29918, 2176, 29918, 6207, 29918, 8552, 1839, 5182, 2033, 1275, 29871, 29896, 29962, 13, 1678, 7945, 29918, 10052, 29879, 353, 7945, 29918, 2176, 29918, 6207, 29918, 8552, 29961, 14968, 29918, 2176, 29918, 6207, 29918, 8552, 1839, 5182, 2033, 1275, 29871, 29900, 29962, 13, 268, 13, 1678, 396, 1482, 1623, 13445, 10335, 1158, 773, 2071, 19668, 669, 3863, 5418, 13, 1678, 565, 527, 5521, 29918, 29939, 1017, 2804, 29871, 29896, 29889, 29900, 29901, 13, 4706, 7945, 29918, 1066, 277, 3145, 29892, 921, 29918, 2218, 7543, 29892, 343, 29918, 14968, 29892, 343, 29918, 2218, 7543, 353, 7945, 29918, 1688, 29918, 5451, 29898, 14968, 29918, 1066, 277, 3145, 29892, 7945, 29918, 1066, 277, 3145, 1839, 5182, 7464, 1243, 29918, 2311, 353, 29871, 29896, 448, 527, 5521, 29918, 29939, 1017, 29892, 13, 462, 462, 462, 462, 29871, 4036, 29918, 3859, 353, 29871, 29896, 29892, 528, 21897, 353, 5852, 29892, 26742, 1598, 353, 7945, 29918, 1066, 277, 3145, 1839, 10249, 11287, 632, 13, 1678, 25342, 527, 5521, 29918, 29939, 1017, 1275, 29871, 29896, 29889, 29900, 29901, 13, 4706, 7945, 29918, 509, 4661, 630, 353, 7945, 29918, 1066, 277, 3145, 268, 13, 268, 13, 1678, 396, 5451, 659, 731, 515, 6694, 669, 7344, 365, 29928, 4978, 639, 770, 13, 1678, 7945, 29918, 1066, 277, 3145, 29892, 659, 29918, 1066, 277, 3145, 29892, 343, 29918, 14968, 29892, 343, 29918, 791, 353, 7945, 29918, 1688, 29918, 5451, 29898, 14968, 29918, 1066, 277, 3145, 29892, 7945, 29918, 1066, 277, 3145, 1839, 5182, 7464, 1243, 29918, 2311, 353, 29871, 29896, 448, 29871, 29900, 29889, 29947, 29892, 13, 462, 462, 462, 795, 4036, 29918, 3859, 353, 29871, 29896, 29892, 528, 21897, 353, 5852, 29892, 26742, 1598, 353, 7945, 29918, 1066, 277, 3145, 1839, 10249, 11287, 13, 268, 13, 1678, 7945, 29918, 10052, 29879, 29892, 659, 29918, 10052, 29879, 29892, 343, 29918, 14968, 29892, 343, 29918, 791, 353, 7945, 29918, 1688, 29918, 5451, 29898, 14968, 29918, 10052, 29879, 29892, 7945, 29918, 10052, 29879, 1839, 5182, 7464, 1243, 29918, 2311, 353, 29871, 29896, 448, 29871, 29900, 29889, 29947, 29892, 13, 462, 462, 462, 3986, 4036, 29918, 3859, 353, 29871, 29896, 29892, 528, 21897, 353, 5852, 29892, 26742, 1598, 353, 7945, 29918, 10052, 29879, 1839, 10249, 11287, 13, 13, 1678, 7945, 29918, 2176, 353, 7945, 29918, 1066, 277, 3145, 29889, 4397, 29898, 14968, 29918, 10052, 29879, 29892, 17281, 29918, 2248, 353, 5852, 29897, 13, 1678, 7945, 29918, 2176, 353, 7945, 29918, 2176, 29889, 276, 2248, 29898, 9302, 29889, 8172, 29889, 546, 6149, 362, 29898, 14968, 29918, 2176, 29889, 2248, 876, 13, 13, 1678, 659, 29918, 2176, 353, 659, 29918, 1066, 277, 3145, 29889, 4397, 29898, 791, 29918, 10052, 29879, 29892, 17281, 29918, 2248, 353, 5852, 29897, 13, 1678, 659, 29918, 2176, 353, 659, 29918, 2176, 29889, 276, 2248, 29898, 9302, 29889, 8172, 29889, 546, 6149, 362, 29898, 791, 29918, 2176, 29889, 2248, 876, 13, 268, 13, 13, 1678, 7945, 29918, 2176, 353, 5768, 29918, 1688, 29918, 11762, 29879, 29898, 14968, 29918, 2176, 29892, 659, 29918, 2176, 29892, 525, 29874, 559, 29939, 1495, 13, 1678, 7945, 29918, 2176, 353, 7945, 29918, 2176, 29889, 8865, 29898, 13099, 353, 6024, 2176, 11287, 13, 1678, 7945, 29918, 2176, 353, 7945, 29918, 2176, 29889, 8865, 29898, 13099, 353, 6024, 10249, 11287, 13, 1678, 659, 29918, 2176, 353, 659, 29918, 2176, 29889, 8865, 29898, 13099, 353, 6024, 10249, 11287, 13, 268, 13, 1678, 714, 29918, 710, 29918, 14968, 353, 714, 29918, 2084, 718, 525, 2276, 29906, 29918, 14968, 29918, 326, 5521, 29918, 29915, 718, 29871, 851, 29898, 326, 5521, 29918, 29939, 1017, 29897, 718, 15300, 7638, 29915, 13, 1678, 714, 29918, 710, 29918, 791, 353, 714, 29918, 2084, 718, 525, 2276, 29906, 29918, 791, 29918, 326, 5521, 29918, 29915, 718, 29871, 851, 29898, 326, 5521, 29918, 29939, 1017, 29897, 718, 15300, 7638, 29915, 13, 1678, 7945, 29918, 2176, 29889, 517, 29918, 7638, 29898, 449, 29918, 710, 29918, 14968, 29892, 2380, 29922, 8824, 29897, 13, 1678, 659, 29918, 2176, 29889, 517, 29918, 7638, 29898, 449, 29918, 710, 29918, 791, 29892, 2380, 29922, 8824, 29897, 13, 2 ]
crops/migrations/0004_crop_gardens.py
LukasBaecker/be-stadtlabor
1
164728
<filename>crops/migrations/0004_crop_gardens.py # Generated by Django 3.1 on 2022-01-18 20:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('gardens', '0007_auto_20211231_2258'), ('crops', '0003_auto_20211205_1004'), ] operations = [ migrations.AddField( model_name='crop', name='gardens', field=models.ManyToManyField(to='gardens.Garden'), ), ]
[ 1, 529, 9507, 29958, 24077, 567, 29914, 26983, 800, 29914, 29900, 29900, 29900, 29946, 29918, 29883, 1336, 29918, 29887, 538, 575, 29889, 2272, 13, 29937, 3251, 630, 491, 15337, 29871, 29941, 29889, 29896, 373, 29871, 29906, 29900, 29906, 29906, 29899, 29900, 29896, 29899, 29896, 29947, 29871, 29906, 29900, 29901, 29946, 29896, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 29887, 538, 575, 742, 525, 29900, 29900, 29900, 29955, 29918, 6921, 29918, 29906, 29900, 29906, 29896, 29896, 29906, 29941, 29896, 29918, 29906, 29906, 29945, 29947, 5477, 13, 4706, 6702, 24077, 567, 742, 525, 29900, 29900, 29900, 29941, 29918, 6921, 29918, 29906, 29900, 29906, 29896, 29896, 29906, 29900, 29945, 29918, 29896, 29900, 29900, 29946, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 29883, 1336, 742, 13, 9651, 1024, 2433, 29887, 538, 575, 742, 13, 9651, 1746, 29922, 9794, 29889, 14804, 1762, 14804, 3073, 29898, 517, 2433, 29887, 538, 575, 29889, 29954, 7879, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
tests/tensor/sum_test.py
kbrodt/tor4
0
29496
from tor4 import tensor def test_tensor_sum(): a = tensor(data=[-1, 1, 2]) a_sum = a.sum() assert a_sum.tolist() == 2 assert not a_sum.requires_grad def test_tensor_sum_backward(): a = tensor(data=[-1, 1, 2.0], requires_grad=True) a_sum = a.sum() a_sum.backward() assert a_sum.tolist() == 2 assert a_sum.requires_grad assert a.grad.tolist() == [1, 1, 1] def test_tensor_sum_backward2(): a = tensor(data=[-1, 1, 2.0], requires_grad=True) a_sum = a.sum() a_sum.backward(tensor(3)) assert a_sum.tolist() == 2 assert a_sum.requires_grad assert a.grad.tolist() == [3, 3, 3] def test_tensor_sum1_backward(): a = tensor(data=[[-1, 1, 2], [1, 2, 3.0]], requires_grad=True) a_sum = a.sum(dim=1) a_sum.backward(tensor(data=[2, 3])) assert a_sum.tolist() == [2, 6] assert a_sum.requires_grad assert a.grad.tolist() == [[2, 2, 2], [3, 3, 3]] def test_tensor_sum2_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum(dim=1) a_sum.backward(tensor(data=[[2], [3]])) assert a_sum.tolist() == [[2], [6]] assert a_sum.requires_grad assert a.grad.tolist() == [[[2], [2], [2]], [[3], [3], [3]]] def test_tensor_sum3_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum() a_sum.backward() assert a_sum.tolist() == 8 assert a_sum.requires_grad assert a.grad.tolist() == [[[1], [1], [1]], [[1], [1], [1]]] def test_tensor_sum4_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum(dim=(1, 0)) a_sum.backward() assert a_sum.tolist() == [8] assert a_sum.requires_grad assert a.grad.tolist() == [[[1], [1], [1]], [[1], [1], [1]]] def test_tensor_sum_keepdim1_backward(): a = tensor(data=[[-1, 1, 2], [1, 2, 3.0]], requires_grad=True) a_sum = a.sum(dim=1, keepdim=True) a_sum.backward(tensor(data=[[2], [3]])) assert a_sum.tolist() == [[2], [6]] assert a_sum.requires_grad assert a.grad.tolist() == [[2, 2, 2], [3, 3, 3]] def test_tensor_sum_keepdim2_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum(dim=1, keepdim=True) a_sum.backward(tensor(data=[[[2]], [[3]]])) assert a_sum.tolist() == [[[2]], [[6]]] assert a_sum.requires_grad assert a.grad.tolist() == [[[2], [2], [2]], [[3], [3], [3]]] def test_tensor_sum_keepdim3_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum() a_sum.backward() assert a_sum.tolist() == 8 assert a_sum.requires_grad assert a.grad.tolist() == [[[1], [1], [1]], [[1], [1], [1]]] def test_tensor_sum_keepdim4_backward(): a = tensor(data=[[[-1], [1], [2]], [[1], [2], [3.0]]], requires_grad=True) a_sum = a.sum(dim=(1, 0), keepdim=True) a_sum.backward() assert a_sum.tolist() == [[[8]]] assert a_sum.requires_grad assert a.grad.tolist() == [[[1], [1], [1]], [[1], [1], [1]]]
[ 1, 515, 4842, 29946, 1053, 12489, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 11759, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 2314, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 29871, 29906, 13, 1678, 4974, 451, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 11759, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29889, 29900, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 580, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 29871, 29906, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 518, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 1627, 1328, 29906, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 11759, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29889, 29900, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 580, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 29898, 20158, 29898, 29941, 876, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 29871, 29906, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 518, 29941, 29892, 29871, 29941, 29892, 29871, 29941, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29896, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 1402, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29889, 29900, 20526, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 29922, 29896, 29897, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 29898, 20158, 29898, 1272, 11759, 29906, 29892, 29871, 29941, 12622, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 518, 29906, 29892, 29871, 29953, 29962, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29906, 29892, 29871, 29906, 29892, 29871, 29906, 1402, 518, 29941, 29892, 29871, 29941, 29892, 29871, 29941, 5262, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29906, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 29922, 29896, 29897, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 29898, 20158, 29898, 1272, 29922, 8999, 29906, 1402, 518, 29941, 5262, 876, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 5519, 29906, 1402, 518, 29953, 5262, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29906, 1402, 518, 29906, 1402, 518, 29906, 20526, 5519, 29941, 1402, 518, 29941, 1402, 518, 29941, 5262, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29941, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 580, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 29871, 29947, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29896, 1402, 518, 29896, 1402, 518, 29896, 20526, 5519, 29896, 1402, 518, 29896, 1402, 518, 29896, 5262, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29946, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 7607, 29896, 29892, 29871, 29900, 876, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 518, 29947, 29962, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29896, 1402, 518, 29896, 1402, 518, 29896, 20526, 5519, 29896, 1402, 518, 29896, 1402, 518, 29896, 5262, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 17462, 6229, 29896, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 29899, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 1402, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29889, 29900, 20526, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 29922, 29896, 29892, 3013, 6229, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 29898, 20158, 29898, 1272, 29922, 8999, 29906, 1402, 518, 29941, 5262, 876, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 5519, 29906, 1402, 518, 29953, 5262, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29906, 29892, 29871, 29906, 29892, 29871, 29906, 1402, 518, 29941, 29892, 29871, 29941, 29892, 29871, 29941, 5262, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 17462, 6229, 29906, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 29922, 29896, 29892, 3013, 6229, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 29898, 20158, 29898, 1272, 29922, 8999, 29961, 29906, 20526, 5519, 29941, 5262, 12622, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 5519, 29961, 29906, 20526, 5519, 29953, 5262, 29962, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29906, 1402, 518, 29906, 1402, 518, 29906, 20526, 5519, 29941, 1402, 518, 29941, 1402, 518, 29941, 5262, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 17462, 6229, 29941, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 580, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 29871, 29947, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29896, 1402, 518, 29896, 1402, 518, 29896, 20526, 5519, 29896, 1402, 518, 29896, 1402, 518, 29896, 5262, 29962, 13, 13, 13, 1753, 1243, 29918, 20158, 29918, 2083, 29918, 17462, 6229, 29946, 29918, 1627, 1328, 7295, 13, 1678, 263, 353, 12489, 29898, 1272, 29922, 8999, 14352, 29896, 1402, 518, 29896, 1402, 518, 29906, 20526, 5519, 29896, 1402, 518, 29906, 1402, 518, 29941, 29889, 29900, 5262, 1402, 6858, 29918, 5105, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 353, 263, 29889, 2083, 29898, 6229, 7607, 29896, 29892, 29871, 29900, 511, 3013, 6229, 29922, 5574, 29897, 13, 1678, 263, 29918, 2083, 29889, 1627, 1328, 580, 13, 13, 1678, 4974, 263, 29918, 2083, 29889, 25027, 391, 580, 1275, 5519, 29961, 29947, 5262, 29962, 13, 1678, 4974, 263, 29918, 2083, 29889, 276, 339, 2658, 29918, 5105, 13, 1678, 4974, 263, 29889, 5105, 29889, 25027, 391, 580, 1275, 5519, 29961, 29896, 1402, 518, 29896, 1402, 518, 29896, 20526, 5519, 29896, 1402, 518, 29896, 1402, 518, 29896, 5262, 29962, 13, 2 ]
zapi/views.py
zyn777/7pi
0
56981
import logging from django.contrib import auth from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect from django.shortcuts import render from zapi.forms import LoginForm logger = logging.getLogger(__name__) def index(request): return render(request, "index.html") def login(request): if request.method == 'GET': form = LoginForm() return render(request, 'login.html', {'form': form}) else: form = LoginForm(request.POST) if form.is_valid(): username = request.POST.get('username', '') password = request.POST.get('password', '') user = auth.authenticate(username=username, password=password) if user and user.is_active: auth.login(request, user) logger.info("+" * 100) logger.info(f"({username}) 登陆了") logger.info("+" * 100) return HttpResponseRedirect('/') else: logger.error("x" * 100) logger.error(f"({username}) 尝试登录,输入了错误的密码({password})") logger.error("x" * 100) return render(request, 'login.html', {'form': form, 'error_msg': "用户名或密码错误"}) else: return render(request, 'login.html', {'form': form}) @login_required def logout(request): logger.info("-" * 100) logger.info(f"({request.user.username}) 登出了") logger.info("-" * 100) auth.logout(request) return HttpResponseRedirect("login")
[ 1, 1053, 12183, 13, 13, 3166, 9557, 29889, 21570, 1053, 4817, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 19557, 4097, 1053, 6464, 29918, 12403, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 13, 3166, 503, 2754, 29889, 9514, 1053, 19130, 2500, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 2380, 29898, 3827, 1125, 13, 1678, 736, 4050, 29898, 3827, 29892, 376, 2248, 29889, 1420, 1159, 13, 13, 13, 1753, 6464, 29898, 3827, 1125, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 7194, 2396, 13, 4706, 883, 353, 19130, 2500, 580, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 7507, 29889, 1420, 742, 11117, 689, 2396, 883, 1800, 13, 1678, 1683, 29901, 13, 4706, 883, 353, 19130, 2500, 29898, 3827, 29889, 5438, 29897, 13, 4706, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 9651, 8952, 353, 2009, 29889, 5438, 29889, 657, 877, 6786, 742, 27255, 13, 9651, 4800, 353, 2009, 29889, 5438, 29889, 657, 877, 5630, 742, 27255, 13, 9651, 1404, 353, 4817, 29889, 27218, 403, 29898, 6786, 29922, 6786, 29892, 4800, 29922, 5630, 29897, 13, 9651, 565, 1404, 322, 1404, 29889, 275, 29918, 4925, 29901, 13, 18884, 4817, 29889, 7507, 29898, 3827, 29892, 1404, 29897, 13, 18884, 17927, 29889, 3888, 703, 13578, 334, 29871, 29896, 29900, 29900, 29897, 13, 18884, 17927, 29889, 3888, 29898, 29888, 29908, 3319, 6786, 1800, 29871, 31451, 236, 156, 137, 30743, 1159, 13, 18884, 17927, 29889, 3888, 703, 13578, 334, 29871, 29896, 29900, 29900, 29897, 13, 18884, 736, 9056, 5103, 24735, 11219, 1495, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 2704, 703, 29916, 29908, 334, 29871, 29896, 29900, 29900, 29897, 13, 18884, 17927, 29889, 2704, 29898, 29888, 29908, 3319, 6786, 1800, 29871, 232, 179, 160, 31787, 31451, 31283, 30214, 31573, 30752, 30743, 31745, 235, 178, 178, 30210, 31461, 31183, 3319, 5630, 1800, 1159, 13, 18884, 17927, 29889, 2704, 703, 29916, 29908, 334, 29871, 29896, 29900, 29900, 29897, 13, 18884, 736, 4050, 29898, 3827, 29892, 525, 7507, 29889, 1420, 742, 11117, 689, 2396, 883, 29892, 525, 2704, 29918, 7645, 2396, 376, 30406, 31229, 30548, 31391, 31461, 31183, 31745, 235, 178, 178, 29908, 1800, 13, 4706, 1683, 29901, 13, 9651, 736, 4050, 29898, 3827, 29892, 525, 7507, 29889, 1420, 742, 11117, 689, 2396, 883, 1800, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 1480, 449, 29898, 3827, 1125, 13, 1678, 17927, 29889, 3888, 703, 29899, 29908, 334, 29871, 29896, 29900, 29900, 29897, 13, 1678, 17927, 29889, 3888, 29898, 29888, 29908, 3319, 3827, 29889, 1792, 29889, 6786, 1800, 29871, 31451, 30544, 30743, 1159, 13, 1678, 17927, 29889, 3888, 703, 29899, 29908, 334, 29871, 29896, 29900, 29900, 29897, 13, 1678, 4817, 29889, 1188, 449, 29898, 3827, 29897, 13, 1678, 736, 9056, 5103, 24735, 703, 7507, 1159, 13, 2 ]
Plugins/Aspose.Email Java for Python/tests/ProgrammingEmail/ManageAttachments/ManageAttachments.py
aspose-email/Aspose.Email-for-Java
24
3464
<gh_stars>10-100 # To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. #if __name__ == "__main__": # print "Hello World" from ProgrammingEmail import ManageAttachments import jpype import os.path asposeapispath = os.path.join(os.path.abspath("./../../../"), "lib/") dataDir = os.path.join(os.path.abspath("./"), "data/") print "You need to put your Aspose.Email for Java APIs .jars in this folder:\n"+asposeapispath #print dataDir jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % asposeapispath) hw = ManageAttachments(dataDir) hw.main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 1763, 1735, 445, 19405, 4839, 29892, 6755, 19245, 12252, 414, 297, 8010, 21582, 29889, 13, 29937, 1763, 1735, 445, 4472, 934, 29892, 6755, 27564, 891, 6789, 9884, 13, 29937, 322, 1722, 278, 4472, 297, 278, 6920, 29889, 13, 13, 29937, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29937, 1678, 1596, 376, 10994, 2787, 29908, 13, 13, 3166, 7835, 4056, 9823, 1053, 2315, 482, 4165, 496, 1860, 13, 5215, 432, 29886, 668, 13, 5215, 2897, 29889, 2084, 13, 13, 294, 4220, 11355, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 703, 6904, 21546, 6995, 4968, 376, 1982, 29914, 1159, 13, 1272, 9170, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 703, 6904, 4968, 376, 1272, 29914, 1159, 13, 13, 2158, 376, 3492, 817, 304, 1925, 596, 26562, 852, 29889, 9823, 363, 3355, 23649, 869, 29926, 1503, 297, 445, 4138, 3583, 29876, 17969, 294, 4220, 11355, 2084, 13, 13, 29937, 2158, 848, 9170, 13, 16865, 668, 29889, 2962, 29967, 9219, 29898, 16865, 668, 29889, 657, 4592, 29967, 9219, 2605, 3285, 11663, 29928, 1645, 29889, 1062, 29889, 3972, 29879, 16328, 29879, 29908, 1273, 408, 4220, 11355, 2084, 29897, 13, 13, 26828, 353, 2315, 482, 4165, 496, 1860, 29898, 1272, 9170, 29897, 13, 26828, 29889, 3396, 580, 2 ]
example/train.py
prodmodel/prodmodel
53
135154
from sklearn import tree def train(X, y): clf = tree.DecisionTreeClassifier(max_depth=10, random_state=0) clf = clf.fit(X, y) return clf
[ 1, 515, 2071, 19668, 1053, 5447, 13, 13, 13, 1753, 7945, 29898, 29990, 29892, 343, 1125, 13, 29871, 1067, 29888, 353, 5447, 29889, 6185, 2459, 9643, 2385, 3709, 29898, 3317, 29918, 19488, 29922, 29896, 29900, 29892, 4036, 29918, 3859, 29922, 29900, 29897, 13, 29871, 1067, 29888, 353, 1067, 29888, 29889, 9202, 29898, 29990, 29892, 343, 29897, 13, 29871, 736, 1067, 29888, 13, 2 ]
sarcopenia_ai/apps/slice_detection/predict.py
notmatthancock/sarcopenia-ai
9
102791
<filename>sarcopenia_ai/apps/slice_detection/predict.py<gh_stars>1-10 import SimpleITK as sitk import cv2 from sarcopenia_ai.apps.slice_detection.utils import place_line_on_img, decode_slice_detection_prediction, \ preprocess_sitk_image_for_slice_detection, adjust_detected_position_spacing from sarcopenia_ai.core.input_parser import InputParser from sarcopenia_ai.core.model_wrapper import BaseModelWrapper, allocate_tf_gpu_devices from sarcopenia_ai.io import load_image from sarcopenia_ai.preprocessing.preprocessing import to256 def parse_inputs(): parser = InputParser() parser.add_argument('--batch_size', type=int, default=3 , help='number of distinct images to samples from in a given batch') parser.add_argument('--ds_factor', type=int, default=2, help='output downsampling factor') parser.add_argument('--input_spacing', type=int, default=1, help='spacing of input image') parser.add_argument('--cuda_devices', type=str, default='0,1') parser.add_argument('--model_path', type=str, default='/data/slice_detection/') parser.add_argument('--output_path', type=str, default='.') parser.add_argument('--image', type=str, default=[], nargs='+') parser.add_argument('--workers', type=int, default=2) parser.add_argument('--prob_threshold', type=float, default=0.1) args = parser.parse() return args def load_model(model_path): # Setup model model_wrapper = BaseModelWrapper(model_path, name=None, config=None, data_loader=None, is_multi_gpu=False ) model_wrapper.setup_model() print(model_wrapper.model.summary()) return model_wrapper.model def main(): args = parse_inputs() # GPU allocation options args.num_gpus, args.cuda_devices = allocate_tf_gpu_devices(args.cuda_devices) args.is_multi_gpu = args.num_gpus > 1 print(args) # Setup model model_wrapper = BaseModelWrapper(args.model_path) model_wrapper.setup_model() for image_path in args.image: print(image_path) sitk_image, image_name = load_image(image_path) image2d = preprocess_sitk_image_for_slice_detection(sitk_image) spacing = sitk_image.GetSpacing() print('direction', sitk_image.GetDirection()) print('spacing', spacing) print('image shape', image2d.shape) preds = model_wrapper.model.predict(image2d) pred_z, prob = decode_slice_detection_prediction(preds) slice_z = adjust_detected_position_spacing(pred_z, spacing) if prob > args.prob_threshold: print('Slice detected at position {} with confidence {}'.format(slice_z, prob)) image = sitk.GetArrayFromImage(sitk_image) print(image.shape) slice_image = image[slice_z, :, :] image2d = place_line_on_img(image2d[0], pred_z, pred_z, r=1) cv2.imwrite(f'/{args.output_path}/{image_name}_slice.jpg', to256(slice_image)) cv2.imwrite(f'/{args.output_path}/{image_name}_frontal.jpg', to256(image2d)) else: print('slice not detected') if __name__ == '__main__': main()
[ 1, 529, 9507, 29958, 29879, 5666, 3150, 423, 29918, 1794, 29914, 13371, 29914, 18337, 29918, 29881, 2650, 428, 29914, 27711, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 12545, 1806, 29968, 408, 7845, 29895, 13, 5215, 13850, 29906, 13, 13, 3166, 269, 5666, 3150, 423, 29918, 1794, 29889, 13371, 29889, 18337, 29918, 29881, 2650, 428, 29889, 13239, 1053, 2058, 29918, 1220, 29918, 265, 29918, 2492, 29892, 21822, 29918, 18337, 29918, 29881, 2650, 428, 29918, 11965, 2463, 29892, 320, 13, 1678, 758, 5014, 29918, 29879, 277, 29895, 29918, 3027, 29918, 1454, 29918, 18337, 29918, 29881, 2650, 428, 29892, 10365, 29918, 4801, 26458, 29918, 3283, 29918, 1028, 9390, 13, 3166, 269, 5666, 3150, 423, 29918, 1794, 29889, 3221, 29889, 2080, 29918, 16680, 1053, 10567, 11726, 13, 3166, 269, 5666, 3150, 423, 29918, 1794, 29889, 3221, 29889, 4299, 29918, 17699, 1053, 7399, 3195, 15646, 29892, 23632, 29918, 13264, 29918, 29887, 3746, 29918, 3359, 1575, 13, 3166, 269, 5666, 3150, 423, 29918, 1794, 29889, 601, 1053, 2254, 29918, 3027, 13, 3166, 269, 5666, 3150, 423, 29918, 1794, 29889, 1457, 19170, 29889, 1457, 19170, 1053, 304, 29906, 29945, 29953, 13, 13, 13, 1753, 6088, 29918, 2080, 29879, 7295, 13, 1678, 13812, 353, 10567, 11726, 580, 13, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16175, 29918, 2311, 742, 1134, 29922, 524, 29892, 2322, 29922, 29941, 13, 462, 4706, 1919, 1371, 2433, 4537, 310, 8359, 4558, 304, 11916, 515, 297, 263, 2183, 9853, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 6289, 29918, 19790, 742, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29892, 1371, 2433, 4905, 1623, 13445, 10335, 7329, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2080, 29918, 1028, 9390, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29892, 1371, 2433, 1028, 9390, 310, 1881, 1967, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29883, 6191, 29918, 3359, 1575, 742, 1134, 29922, 710, 29892, 2322, 2433, 29900, 29892, 29896, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4299, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 29914, 1272, 29914, 18337, 29918, 29881, 2650, 428, 29914, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4905, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 3027, 742, 1134, 29922, 710, 29892, 2322, 11759, 1402, 302, 5085, 2433, 29974, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1287, 414, 742, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 22795, 29918, 386, 12268, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29896, 29897, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 580, 13, 13, 1678, 736, 6389, 13, 13, 13, 1753, 2254, 29918, 4299, 29898, 4299, 29918, 2084, 1125, 13, 1678, 396, 3789, 786, 1904, 13, 1678, 1904, 29918, 17699, 353, 7399, 3195, 15646, 29898, 4299, 29918, 2084, 29892, 13, 462, 462, 268, 1024, 29922, 8516, 29892, 13, 462, 462, 268, 2295, 29922, 8516, 29892, 13, 462, 462, 268, 848, 29918, 12657, 29922, 8516, 29892, 13, 462, 462, 268, 338, 29918, 9910, 29918, 29887, 3746, 29922, 8824, 13, 462, 462, 268, 1723, 13, 1678, 1904, 29918, 17699, 29889, 14669, 29918, 4299, 580, 13, 13, 1678, 1596, 29898, 4299, 29918, 17699, 29889, 4299, 29889, 7727, 3101, 13, 13, 1678, 736, 1904, 29918, 17699, 29889, 4299, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6389, 353, 6088, 29918, 2080, 29879, 580, 13, 13, 1678, 396, 22796, 24082, 3987, 13, 1678, 6389, 29889, 1949, 29918, 29887, 13364, 29892, 6389, 29889, 29883, 6191, 29918, 3359, 1575, 353, 23632, 29918, 13264, 29918, 29887, 3746, 29918, 3359, 1575, 29898, 5085, 29889, 29883, 6191, 29918, 3359, 1575, 29897, 13, 1678, 6389, 29889, 275, 29918, 9910, 29918, 29887, 3746, 353, 6389, 29889, 1949, 29918, 29887, 13364, 1405, 29871, 29896, 13, 13, 1678, 1596, 29898, 5085, 29897, 13, 13, 1678, 396, 3789, 786, 1904, 13, 1678, 1904, 29918, 17699, 353, 7399, 3195, 15646, 29898, 5085, 29889, 4299, 29918, 2084, 29897, 13, 1678, 1904, 29918, 17699, 29889, 14669, 29918, 4299, 580, 13, 13, 1678, 363, 1967, 29918, 2084, 297, 6389, 29889, 3027, 29901, 13, 4706, 1596, 29898, 3027, 29918, 2084, 29897, 13, 4706, 7845, 29895, 29918, 3027, 29892, 1967, 29918, 978, 353, 2254, 29918, 3027, 29898, 3027, 29918, 2084, 29897, 13, 13, 4706, 1967, 29906, 29881, 353, 758, 5014, 29918, 29879, 277, 29895, 29918, 3027, 29918, 1454, 29918, 18337, 29918, 29881, 2650, 428, 29898, 29879, 277, 29895, 29918, 3027, 29897, 13, 13, 4706, 29250, 353, 7845, 29895, 29918, 3027, 29889, 2577, 5592, 9390, 580, 13, 4706, 1596, 877, 20845, 742, 7845, 29895, 29918, 3027, 29889, 2577, 21602, 3101, 13, 4706, 1596, 877, 1028, 9390, 742, 29250, 29897, 13, 4706, 1596, 877, 3027, 8267, 742, 1967, 29906, 29881, 29889, 12181, 29897, 13, 13, 4706, 4450, 29879, 353, 1904, 29918, 17699, 29889, 4299, 29889, 27711, 29898, 3027, 29906, 29881, 29897, 13, 13, 4706, 4450, 29918, 29920, 29892, 2070, 353, 21822, 29918, 18337, 29918, 29881, 2650, 428, 29918, 11965, 2463, 29898, 11965, 29879, 29897, 13, 4706, 22780, 29918, 29920, 353, 10365, 29918, 4801, 26458, 29918, 3283, 29918, 1028, 9390, 29898, 11965, 29918, 29920, 29892, 29250, 29897, 13, 13, 4706, 565, 2070, 1405, 6389, 29889, 22795, 29918, 386, 12268, 29901, 13, 9651, 1596, 877, 29903, 5897, 17809, 472, 2602, 6571, 411, 16420, 6571, 4286, 4830, 29898, 18337, 29918, 29920, 29892, 2070, 876, 13, 9651, 1967, 353, 7845, 29895, 29889, 2577, 2588, 4591, 2940, 29898, 29879, 277, 29895, 29918, 3027, 29897, 13, 9651, 1596, 29898, 3027, 29889, 12181, 29897, 13, 9651, 22780, 29918, 3027, 353, 1967, 29961, 18337, 29918, 29920, 29892, 584, 29892, 584, 29962, 13, 9651, 1967, 29906, 29881, 353, 2058, 29918, 1220, 29918, 265, 29918, 2492, 29898, 3027, 29906, 29881, 29961, 29900, 1402, 4450, 29918, 29920, 29892, 4450, 29918, 29920, 29892, 364, 29922, 29896, 29897, 13, 13, 9651, 13850, 29906, 29889, 326, 3539, 29898, 29888, 29915, 19248, 5085, 29889, 4905, 29918, 2084, 6822, 29912, 3027, 29918, 978, 2403, 18337, 29889, 6173, 742, 304, 29906, 29945, 29953, 29898, 18337, 29918, 3027, 876, 13, 13, 9651, 13850, 29906, 29889, 326, 3539, 29898, 29888, 29915, 19248, 5085, 29889, 4905, 29918, 2084, 6822, 29912, 3027, 29918, 978, 2403, 8862, 284, 29889, 6173, 742, 304, 29906, 29945, 29953, 29898, 3027, 29906, 29881, 876, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 18337, 451, 17809, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
scrape.py
shuaibi27/uiuc-course-scraper
1
94106
<filename>scrape.py import argparse, requests, json from bs4 import BeautifulSoup parser = argparse.ArgumentParser() parser.add_argument("--subject") args = parser.parse_args() data = requests.get('http://catalog.illinois.edu/courses-of-instruction/' + str(args.subject)) if data.status_code >= 400: print('Status Code: ' + str(data.status_code)) exit() html = BeautifulSoup(data.text, 'html.parser') container = html.find('div', {'class': 'courses'}) courses = {} for courseblock in container.find_all('div', {'class': 'courseblock'}): title = courseblock.find('p', {'class': 'courseblocktitle'}).text desc = courseblock.find('p', {'class': 'courseblockdesc'}).text.replace('\xa0', ' ').replace('\n', '') name = title[:len(str(args.subject)) + 4].replace('\xa0', ' ') label = title[len(str(args.subject)) + 7 : title.find('credit:') - 3] hours = title[title.find('credit:') + 8 : -2] key = name.replace(' ', '').lower() courses[key] = { 'name': name, 'label': label, 'hours': hours, 'description': desc } # print(name + ' | ' + label + ' | ' + hours) # print(desc + '\n') with open(args.subject + '.json', 'w') as outfile: json.dump(courses, outfile)
[ 1, 529, 9507, 29958, 1557, 336, 412, 29889, 2272, 13, 5215, 1852, 5510, 29892, 7274, 29892, 4390, 13, 3166, 24512, 29946, 1053, 25685, 29903, 1132, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 16680, 29889, 1202, 29918, 23516, 703, 489, 16009, 1159, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1272, 353, 7274, 29889, 657, 877, 1124, 597, 28045, 29889, 453, 12387, 29889, 6085, 29914, 29883, 29781, 29899, 974, 29899, 2611, 4080, 22208, 718, 851, 29898, 5085, 29889, 16009, 876, 13, 13, 361, 848, 29889, 4882, 29918, 401, 6736, 29871, 29946, 29900, 29900, 29901, 13, 1678, 1596, 877, 5709, 5920, 29901, 525, 718, 851, 29898, 1272, 29889, 4882, 29918, 401, 876, 13, 1678, 6876, 580, 13, 13, 1420, 353, 25685, 29903, 1132, 29898, 1272, 29889, 726, 29892, 525, 1420, 29889, 16680, 1495, 13, 7611, 353, 3472, 29889, 2886, 877, 4563, 742, 11117, 1990, 2396, 525, 29883, 29781, 29915, 1800, 13, 29883, 29781, 353, 6571, 13, 13, 1454, 3236, 1271, 297, 5639, 29889, 2886, 29918, 497, 877, 4563, 742, 11117, 1990, 2396, 525, 15775, 1271, 10827, 1125, 13, 1678, 3611, 353, 3236, 1271, 29889, 2886, 877, 29886, 742, 11117, 1990, 2396, 525, 15775, 1271, 3257, 29915, 7690, 726, 13, 1678, 5153, 353, 3236, 1271, 29889, 2886, 877, 29886, 742, 11117, 1990, 2396, 525, 15775, 1271, 14273, 29915, 7690, 726, 29889, 6506, 28909, 17367, 29900, 742, 525, 525, 467, 6506, 28909, 29876, 742, 27255, 13, 13, 1678, 1024, 353, 3611, 7503, 2435, 29898, 710, 29898, 5085, 29889, 16009, 876, 718, 29871, 29946, 1822, 6506, 28909, 17367, 29900, 742, 525, 25710, 13, 1678, 3858, 353, 3611, 29961, 2435, 29898, 710, 29898, 5085, 29889, 16009, 876, 718, 29871, 29955, 584, 3611, 29889, 2886, 877, 11944, 277, 29901, 1495, 448, 29871, 29941, 29962, 13, 1678, 6199, 353, 3611, 29961, 3257, 29889, 2886, 877, 11944, 277, 29901, 1495, 718, 29871, 29947, 584, 448, 29906, 29962, 13, 13, 1678, 1820, 353, 1024, 29889, 6506, 877, 13420, 525, 2824, 13609, 580, 13, 1678, 21888, 29961, 1989, 29962, 353, 426, 13, 4706, 525, 978, 2396, 1024, 29892, 13, 4706, 525, 1643, 2396, 3858, 29892, 13, 4706, 525, 29882, 2470, 2396, 6199, 29892, 13, 4706, 525, 8216, 2396, 5153, 13, 1678, 500, 13, 13, 1678, 396, 1596, 29898, 978, 718, 525, 891, 525, 718, 3858, 718, 525, 891, 525, 718, 6199, 29897, 13, 1678, 396, 1596, 29898, 14273, 718, 11297, 29876, 1495, 13, 13, 2541, 1722, 29898, 5085, 29889, 16009, 718, 15300, 3126, 742, 525, 29893, 1495, 408, 714, 1445, 29901, 13, 1678, 4390, 29889, 15070, 29898, 29883, 29781, 29892, 714, 1445, 29897, 2 ]
{{cookiecutter.directory_name}}/apps/core/querysets/soft_delete.py
zurek11/django-project-template
0
90801
from django.db.models import QuerySet from django.utils import timezone class SoftDeleteQuerySet(QuerySet): def delete(self): return super(SoftDeleteQuerySet, self).update(deleted_at=timezone.now(), is_deleted=True) def hard_delete(self): return super(SoftDeleteQuerySet, self).delete() def alive(self): return self.filter(is_deleted=False) def dead(self): return self.exclude(is_deleted=True)
[ 1, 515, 9557, 29889, 2585, 29889, 9794, 1053, 13641, 2697, 13, 3166, 9557, 29889, 13239, 1053, 29431, 13, 13, 13, 1990, 1105, 615, 12498, 3010, 2697, 29898, 3010, 2697, 1125, 13, 1678, 822, 5217, 29898, 1311, 1125, 13, 4706, 736, 2428, 29898, 6295, 615, 12498, 3010, 2697, 29892, 1583, 467, 5504, 29898, 311, 22742, 29918, 271, 29922, 2230, 8028, 29889, 3707, 3285, 338, 29918, 311, 22742, 29922, 5574, 29897, 13, 13, 1678, 822, 2898, 29918, 8143, 29898, 1311, 1125, 13, 4706, 736, 2428, 29898, 6295, 615, 12498, 3010, 2697, 29892, 1583, 467, 8143, 580, 13, 13, 1678, 822, 18758, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4572, 29898, 275, 29918, 311, 22742, 29922, 8824, 29897, 13, 13, 1678, 822, 7123, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 735, 2325, 29898, 275, 29918, 311, 22742, 29922, 5574, 29897, 13, 2 ]
code/tokenization.py
kcarnold/counterfactual-lm
2
1610577
import re import string from nltk.tokenize import RegexpTokenizer, PunktSentenceTokenizer WORD_RE = re.compile(r'\w+(?:[\',:]\w+)*') END_PUNCT = set('.,?!:') def token_spans(text): for match in re.finditer(r'[^-/\s]+', text): start, end = match.span() token_match = WORD_RE.search(text, start, end) if token_match is not None: span = token_match.span() yield span tok_end = span[1] if tok_end < end and text[tok_end] in END_PUNCT: yield tok_end, tok_end + 1 START_DOC = '<D>' START_PARA = '<P>' START_SENT = '<S>' END_SENT = '</S>' paragraph_re = re.compile(r'(?:[ ]*[^\s][^\n]*[\n]?)+') paragraph_tokenizer = RegexpTokenizer(paragraph_re) sentence_tokenizer = PunktSentenceTokenizer() def tokenize(doc): res = [START_DOC] afters = [] end_of_prev_para = 0 for para_start, para_end in paragraph_tokenizer.span_tokenize(doc): afters.append(doc[end_of_prev_para:para_start]) para = doc[para_start:para_end] end_of_prev_para = para_end end_of_prev_sentence = 0 res.append(START_PARA) for sent_start, sent_end in sentence_tokenizer.span_tokenize(para): sent = para[sent_start:sent_end] tspans = list(token_spans(sent)) if not tspans: continue afters.append(para[end_of_prev_sentence:sent_start]) end_of_prev_sentence = sent_end res.append(START_SENT) end_of_prev_token = 0 for tok_start, tok_end in tspans: afters.append(sent[end_of_prev_token:tok_start]) res.append(sent[tok_start:tok_end]) end_of_prev_token = tok_end res.append(END_SENT) afters.append(sent[end_of_prev_token:]) end_of_prev_para -= len(para) - end_of_prev_sentence afters.append(doc[end_of_prev_para:]) return res, afters def tokenize_mid_document(doc_so_far): if len(doc_so_far.strip()) == 0: return [START_DOC, START_PARA, START_SENT, ''], ['', '', '', ''] tok_list, afters = tokenize(doc_so_far) if doc_so_far.endswith('\n\n'): # starting a new paragraph if tok_list[-1] in [START_PARA, START_SENT]: print("Huh? Ended with double-newlines but also with start-of-para?", repr(tok_list[-5:])) tok_list += [START_PARA, START_SENT, ''] afters += ['', '', ''] else: assert tok_list[-1] == END_SENT if tok_list[-2] in '.?!': # Real EOS tok_list += [START_SENT, ''] afters += ['', ''] elif doc_so_far[-1] in string.whitespace: # The last EOS was spurious, but we're not mid-word. tok_list[-1] = "" else: # The last EOS was spurious, but we ARE mid-word. tok_list.pop(-1) after = afters.pop(-1) afters[-1] += after return tok_list, afters
[ 1, 1053, 337, 13, 5215, 1347, 13, 3166, 302, 1896, 29895, 29889, 6979, 675, 1053, 2169, 4548, 6066, 3950, 29892, 349, 11087, 29903, 296, 663, 6066, 3950, 13, 13, 17013, 29918, 1525, 353, 337, 29889, 12198, 29898, 29878, 12764, 29893, 29974, 10780, 29901, 7110, 742, 29901, 10725, 29893, 29974, 11877, 1495, 13, 11794, 29918, 29925, 3904, 1783, 353, 731, 877, 1696, 29973, 29991, 29901, 1495, 13, 13, 1753, 5993, 29918, 1028, 550, 29898, 726, 1125, 13, 1678, 363, 1993, 297, 337, 29889, 2886, 1524, 29898, 29878, 29915, 29961, 21583, 7998, 29879, 10062, 742, 1426, 1125, 13, 4706, 1369, 29892, 1095, 353, 1993, 29889, 9653, 580, 13, 4706, 5993, 29918, 4352, 353, 399, 25593, 29918, 1525, 29889, 4478, 29898, 726, 29892, 1369, 29892, 1095, 29897, 13, 4706, 565, 5993, 29918, 4352, 338, 451, 6213, 29901, 13, 9651, 10638, 353, 5993, 29918, 4352, 29889, 9653, 580, 13, 9651, 7709, 10638, 13, 9651, 304, 29895, 29918, 355, 353, 10638, 29961, 29896, 29962, 13, 9651, 565, 304, 29895, 29918, 355, 529, 1095, 322, 1426, 29961, 17082, 29918, 355, 29962, 297, 11056, 29918, 29925, 3904, 1783, 29901, 13, 18884, 7709, 304, 29895, 29918, 355, 29892, 304, 29895, 29918, 355, 718, 29871, 29896, 13, 13, 13, 25826, 29918, 28665, 353, 12801, 29928, 16299, 13, 25826, 29918, 16320, 29909, 353, 12801, 29925, 16299, 13, 25826, 29918, 29903, 3919, 353, 12801, 29903, 16299, 13, 11794, 29918, 29903, 3919, 353, 525, 829, 29903, 16299, 13, 13, 26956, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 10780, 10834, 4514, 29930, 29961, 3823, 29879, 3816, 3823, 29876, 14178, 7110, 29876, 29962, 29973, 7240, 1495, 13, 26956, 29918, 6979, 3950, 353, 2169, 4548, 6066, 3950, 29898, 26956, 29918, 276, 29897, 13, 18616, 663, 29918, 6979, 3950, 353, 349, 11087, 29903, 296, 663, 6066, 3950, 580, 13, 13, 1753, 5993, 675, 29898, 1514, 1125, 13, 1678, 620, 353, 518, 25826, 29918, 28665, 29962, 13, 1678, 1156, 29879, 353, 5159, 13, 1678, 1095, 29918, 974, 29918, 16304, 29918, 22752, 353, 29871, 29900, 13, 1678, 363, 1702, 29918, 2962, 29892, 1702, 29918, 355, 297, 14880, 29918, 6979, 3950, 29889, 9653, 29918, 6979, 675, 29898, 1514, 1125, 13, 4706, 1156, 29879, 29889, 4397, 29898, 1514, 29961, 355, 29918, 974, 29918, 16304, 29918, 22752, 29901, 22752, 29918, 2962, 2314, 13, 4706, 1702, 353, 1574, 29961, 22752, 29918, 2962, 29901, 22752, 29918, 355, 29962, 13, 4706, 1095, 29918, 974, 29918, 16304, 29918, 22752, 353, 1702, 29918, 355, 13, 4706, 1095, 29918, 974, 29918, 16304, 29918, 18616, 663, 353, 29871, 29900, 13, 4706, 620, 29889, 4397, 29898, 25826, 29918, 16320, 29909, 29897, 13, 4706, 363, 2665, 29918, 2962, 29892, 2665, 29918, 355, 297, 10541, 29918, 6979, 3950, 29889, 9653, 29918, 6979, 675, 29898, 22752, 1125, 13, 9651, 2665, 353, 1702, 29961, 18616, 29918, 2962, 29901, 18616, 29918, 355, 29962, 13, 9651, 260, 1028, 550, 353, 1051, 29898, 6979, 29918, 1028, 550, 29898, 18616, 876, 13, 9651, 565, 451, 260, 1028, 550, 29901, 13, 18884, 6773, 13, 9651, 1156, 29879, 29889, 4397, 29898, 22752, 29961, 355, 29918, 974, 29918, 16304, 29918, 18616, 663, 29901, 18616, 29918, 2962, 2314, 13, 9651, 1095, 29918, 974, 29918, 16304, 29918, 18616, 663, 353, 2665, 29918, 355, 13, 9651, 620, 29889, 4397, 29898, 25826, 29918, 29903, 3919, 29897, 13, 9651, 1095, 29918, 974, 29918, 16304, 29918, 6979, 353, 29871, 29900, 13, 9651, 363, 304, 29895, 29918, 2962, 29892, 304, 29895, 29918, 355, 297, 260, 1028, 550, 29901, 13, 18884, 1156, 29879, 29889, 4397, 29898, 18616, 29961, 355, 29918, 974, 29918, 16304, 29918, 6979, 29901, 17082, 29918, 2962, 2314, 13, 18884, 620, 29889, 4397, 29898, 18616, 29961, 17082, 29918, 2962, 29901, 17082, 29918, 355, 2314, 13, 18884, 1095, 29918, 974, 29918, 16304, 29918, 6979, 353, 304, 29895, 29918, 355, 13, 9651, 620, 29889, 4397, 29898, 11794, 29918, 29903, 3919, 29897, 13, 9651, 1156, 29879, 29889, 4397, 29898, 18616, 29961, 355, 29918, 974, 29918, 16304, 29918, 6979, 29901, 2314, 13, 4706, 1095, 29918, 974, 29918, 16304, 29918, 22752, 22361, 7431, 29898, 22752, 29897, 448, 1095, 29918, 974, 29918, 16304, 29918, 18616, 663, 13, 1678, 1156, 29879, 29889, 4397, 29898, 1514, 29961, 355, 29918, 974, 29918, 16304, 29918, 22752, 29901, 2314, 13, 1678, 736, 620, 29892, 1156, 29879, 13, 13, 13, 1753, 5993, 675, 29918, 6563, 29918, 3225, 29898, 1514, 29918, 578, 29918, 15641, 1125, 13, 1678, 565, 7431, 29898, 1514, 29918, 578, 29918, 15641, 29889, 17010, 3101, 1275, 29871, 29900, 29901, 13, 4706, 736, 518, 25826, 29918, 28665, 29892, 6850, 8322, 29918, 16320, 29909, 29892, 6850, 8322, 29918, 29903, 3919, 29892, 6629, 1402, 6024, 742, 15516, 15516, 525, 2033, 13, 1678, 304, 29895, 29918, 1761, 29892, 1156, 29879, 353, 5993, 675, 29898, 1514, 29918, 578, 29918, 15641, 29897, 13, 1678, 565, 1574, 29918, 578, 29918, 15641, 29889, 1975, 2541, 28909, 29876, 29905, 29876, 29374, 13, 4706, 396, 6257, 263, 716, 14880, 13, 4706, 565, 304, 29895, 29918, 1761, 14352, 29896, 29962, 297, 518, 25826, 29918, 16320, 29909, 29892, 6850, 8322, 29918, 29903, 3919, 5387, 13, 9651, 1596, 703, 29950, 16099, 29973, 2796, 287, 411, 3765, 29899, 1482, 9012, 541, 884, 411, 1369, 29899, 974, 29899, 22752, 29973, 613, 2062, 29898, 17082, 29918, 1761, 14352, 29945, 29901, 12622, 13, 4706, 304, 29895, 29918, 1761, 4619, 518, 25826, 29918, 16320, 29909, 29892, 6850, 8322, 29918, 29903, 3919, 29892, 525, 2033, 13, 4706, 1156, 29879, 4619, 6024, 742, 15516, 525, 2033, 13, 1678, 1683, 29901, 13, 4706, 4974, 304, 29895, 29918, 1761, 14352, 29896, 29962, 1275, 11056, 29918, 29903, 3919, 13, 4706, 565, 304, 29895, 29918, 1761, 14352, 29906, 29962, 297, 15300, 29973, 29991, 2396, 13, 9651, 396, 8195, 382, 3267, 13, 9651, 304, 29895, 29918, 1761, 4619, 518, 25826, 29918, 29903, 3919, 29892, 525, 2033, 13, 9651, 1156, 29879, 4619, 6024, 742, 525, 2033, 13, 4706, 25342, 1574, 29918, 578, 29918, 15641, 14352, 29896, 29962, 297, 1347, 29889, 1332, 3246, 3535, 29901, 13, 9651, 396, 450, 1833, 382, 3267, 471, 805, 332, 2738, 29892, 541, 591, 29915, 276, 451, 7145, 29899, 1742, 29889, 13, 9651, 304, 29895, 29918, 1761, 14352, 29896, 29962, 353, 5124, 13, 4706, 1683, 29901, 13, 9651, 396, 450, 1833, 382, 3267, 471, 805, 332, 2738, 29892, 541, 591, 319, 1525, 7145, 29899, 1742, 29889, 13, 9651, 304, 29895, 29918, 1761, 29889, 7323, 6278, 29896, 29897, 13, 9651, 1156, 353, 1156, 29879, 29889, 7323, 6278, 29896, 29897, 13, 9651, 1156, 29879, 14352, 29896, 29962, 4619, 1156, 13, 13, 1678, 736, 304, 29895, 29918, 1761, 29892, 1156, 29879, 13, 13, 2 ]
mars/core/entity/core.py
chineking/mars
1
196835
# Copyright 1999-2021 Alibaba Group Holding 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. from ...serialization.serializables import ( Serializable, FieldTypes, DictField, ReferenceField, ) from ...utils import AttributeDict from ..base import Base class EntityData(Base): __slots__ = ("_siblings",) type_name = None # required fields _op = ReferenceField("op", "mars.core.operand.base.Operand") # optional fields _extra_params = DictField("extra_params", key_type=FieldTypes.string) def __init__(self, *args, **kwargs): extras = AttributeDict( (k, kwargs.pop(k)) for k in set(kwargs) - set(self._FIELDS) ) kwargs["_extra_params"] = kwargs.pop("_extra_params", extras) super().__init__(*args, **kwargs) @property def op(self): return self._op @property def inputs(self): return self.op.inputs @inputs.setter def inputs(self, new_inputs): self.op.inputs = new_inputs def is_sparse(self): return self.op.is_sparse() issparse = is_sparse @property def extra_params(self): return self._extra_params def build_graph(self, **kw): from ..graph.builder.utils import build_graph return build_graph([self], **kw) def visualize(self, graph_attrs=None, node_attrs=None, **kw): from graphviz import Source g = self.build_graph(**kw) dot = g.to_dot( graph_attrs=graph_attrs, node_attrs=node_attrs, result_chunk_keys={c.key for c in self.chunks}, ) return Source(dot) def _need_execution(self): # pylint: disable=no-self-use # some tileable may generate unknown meta, # they need to be executed first return False class Entity(Serializable): _allow_data_type_ = () type_name = None _data = ReferenceField("data", EntityData) def __init__(self, data=None, **kw): super().__init__(_data=data, **kw) def __dir__(self): obj_dir = object.__dir__(self) if self._data is not None: obj_dir = sorted(set(dir(self._data) + obj_dir)) return obj_dir def __str__(self): return self._data.__str__() def __repr__(self): return self._data.__repr__() def _check_data(self, data): if data is not None and not isinstance(data, self._allow_data_type_): raise TypeError(f"Expect {self._allow_data_type_}, got {type(data)}") @property def data(self): return self._data @data.setter def data(self, new_data): self._check_data(new_data) self._data = new_data def __copy__(self): return self.copy() def copy(self): return self.copy_to(type(self)(None)) def copy_to(self, target): target.data = self._data return target def copy_from(self, obj): self.data = obj.data def tiles(self): from .tileables import handler new_entity = self.copy() new_entity.data = handler.tiles(self.data) return new_entity def __getattr__(self, attr): return getattr(self._data, attr) def __setattr__(self, key, value): try: object.__setattr__(self, key, value) except AttributeError: return setattr(self._data, key, value) def _need_execution(self): return self._data._need_execution() ENTITY_TYPE = (Entity, EntityData)
[ 1, 396, 14187, 1266, 29871, 29896, 29929, 29929, 29929, 29899, 29906, 29900, 29906, 29896, 319, 1982, 5363, 6431, 21771, 292, 19806, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 2023, 15550, 2133, 29889, 15550, 466, 1849, 1053, 313, 13, 1678, 18896, 13902, 29892, 13, 1678, 8989, 10562, 29892, 13, 1678, 360, 919, 3073, 29892, 13, 1678, 12105, 3073, 29892, 13, 29897, 13, 3166, 2023, 13239, 1053, 23833, 21533, 13, 3166, 6317, 3188, 1053, 7399, 13, 13, 13, 1990, 14945, 1469, 29898, 5160, 1125, 13, 1678, 4770, 2536, 1862, 1649, 353, 4852, 29918, 29879, 747, 18964, 613, 29897, 13, 1678, 1134, 29918, 978, 353, 6213, 13, 13, 1678, 396, 3734, 4235, 13, 1678, 903, 459, 353, 12105, 3073, 703, 459, 613, 376, 29885, 1503, 29889, 3221, 29889, 3372, 392, 29889, 3188, 29889, 7094, 392, 1159, 13, 1678, 396, 13136, 4235, 13, 1678, 903, 17833, 29918, 7529, 353, 360, 919, 3073, 703, 17833, 29918, 7529, 613, 1820, 29918, 1853, 29922, 3073, 10562, 29889, 1807, 29897, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 429, 10678, 353, 23833, 21533, 29898, 13, 9651, 313, 29895, 29892, 9049, 5085, 29889, 7323, 29898, 29895, 876, 363, 413, 297, 731, 29898, 19290, 29897, 448, 731, 29898, 1311, 3032, 3738, 6670, 8452, 29897, 13, 4706, 1723, 13, 4706, 9049, 5085, 3366, 29918, 17833, 29918, 7529, 3108, 353, 9049, 5085, 29889, 7323, 703, 29918, 17833, 29918, 7529, 613, 429, 10678, 29897, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1015, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 459, 13, 13, 1678, 732, 6799, 13, 1678, 822, 10970, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 459, 29889, 2080, 29879, 13, 13, 1678, 732, 2080, 29879, 29889, 842, 357, 13, 1678, 822, 10970, 29898, 1311, 29892, 716, 29918, 2080, 29879, 1125, 13, 4706, 1583, 29889, 459, 29889, 2080, 29879, 353, 716, 29918, 2080, 29879, 13, 13, 1678, 822, 338, 29918, 29879, 5510, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 459, 29889, 275, 29918, 29879, 5510, 580, 13, 13, 1678, 1721, 5510, 353, 338, 29918, 29879, 5510, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4805, 29918, 7529, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 17833, 29918, 7529, 13, 13, 1678, 822, 2048, 29918, 4262, 29898, 1311, 29892, 3579, 11022, 1125, 13, 4706, 515, 6317, 4262, 29889, 16409, 29889, 13239, 1053, 2048, 29918, 4262, 13, 13, 4706, 736, 2048, 29918, 4262, 4197, 1311, 1402, 3579, 11022, 29897, 13, 13, 1678, 822, 7604, 675, 29898, 1311, 29892, 3983, 29918, 5552, 29879, 29922, 8516, 29892, 2943, 29918, 5552, 29879, 29922, 8516, 29892, 3579, 11022, 1125, 13, 4706, 515, 3983, 29894, 466, 1053, 7562, 13, 13, 4706, 330, 353, 1583, 29889, 4282, 29918, 4262, 29898, 1068, 11022, 29897, 13, 4706, 8329, 353, 330, 29889, 517, 29918, 6333, 29898, 13, 9651, 3983, 29918, 5552, 29879, 29922, 4262, 29918, 5552, 29879, 29892, 13, 9651, 2943, 29918, 5552, 29879, 29922, 3177, 29918, 5552, 29879, 29892, 13, 9651, 1121, 29918, 29812, 29918, 8149, 3790, 29883, 29889, 1989, 363, 274, 297, 1583, 29889, 305, 18801, 1118, 13, 4706, 1723, 13, 13, 4706, 736, 7562, 29898, 6333, 29897, 13, 13, 1678, 822, 903, 26180, 29918, 22256, 29898, 1311, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 1509, 13, 4706, 396, 777, 25900, 519, 1122, 5706, 9815, 12700, 29892, 13, 4706, 396, 896, 817, 304, 367, 8283, 937, 13, 4706, 736, 7700, 13, 13, 13, 1990, 14945, 29898, 9125, 13902, 1125, 13, 1678, 903, 9536, 29918, 1272, 29918, 1853, 29918, 353, 3861, 13, 1678, 1134, 29918, 978, 353, 6213, 13, 13, 1678, 903, 1272, 353, 12105, 3073, 703, 1272, 613, 14945, 1469, 29897, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 29922, 8516, 29892, 3579, 11022, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 7373, 1272, 29922, 1272, 29892, 3579, 11022, 29897, 13, 13, 1678, 822, 4770, 3972, 12035, 1311, 1125, 13, 4706, 5446, 29918, 3972, 353, 1203, 17255, 3972, 12035, 1311, 29897, 13, 4706, 565, 1583, 3032, 1272, 338, 451, 6213, 29901, 13, 9651, 5446, 29918, 3972, 353, 12705, 29898, 842, 29898, 3972, 29898, 1311, 3032, 1272, 29897, 718, 5446, 29918, 3972, 876, 13, 4706, 736, 5446, 29918, 3972, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 3032, 1272, 17255, 710, 1649, 580, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 1583, 3032, 1272, 17255, 276, 558, 1649, 580, 13, 13, 1678, 822, 903, 3198, 29918, 1272, 29898, 1311, 29892, 848, 1125, 13, 4706, 565, 848, 338, 451, 6213, 322, 451, 338, 8758, 29898, 1272, 29892, 1583, 3032, 9536, 29918, 1272, 29918, 1853, 29918, 1125, 13, 9651, 12020, 20948, 29898, 29888, 29908, 1252, 1103, 426, 1311, 3032, 9536, 29918, 1272, 29918, 1853, 29918, 1118, 2355, 426, 1853, 29898, 1272, 2915, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 822, 848, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1272, 13, 13, 1678, 732, 1272, 29889, 842, 357, 13, 1678, 822, 848, 29898, 1311, 29892, 716, 29918, 1272, 1125, 13, 4706, 1583, 3032, 3198, 29918, 1272, 29898, 1482, 29918, 1272, 29897, 13, 4706, 1583, 3032, 1272, 353, 716, 29918, 1272, 13, 13, 1678, 822, 4770, 8552, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 8552, 580, 13, 13, 1678, 822, 3509, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 8552, 29918, 517, 29898, 1853, 29898, 1311, 5033, 8516, 876, 13, 13, 1678, 822, 3509, 29918, 517, 29898, 1311, 29892, 3646, 1125, 13, 4706, 3646, 29889, 1272, 353, 1583, 3032, 1272, 13, 4706, 736, 3646, 13, 13, 1678, 822, 3509, 29918, 3166, 29898, 1311, 29892, 5446, 1125, 13, 4706, 1583, 29889, 1272, 353, 5446, 29889, 1272, 13, 13, 1678, 822, 260, 5475, 29898, 1311, 1125, 13, 4706, 515, 869, 29873, 488, 1849, 1053, 7834, 13, 13, 4706, 716, 29918, 10041, 353, 1583, 29889, 8552, 580, 13, 4706, 716, 29918, 10041, 29889, 1272, 353, 7834, 29889, 1376, 267, 29898, 1311, 29889, 1272, 29897, 13, 4706, 736, 716, 29918, 10041, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 12421, 1125, 13, 4706, 736, 679, 5552, 29898, 1311, 3032, 1272, 29892, 12421, 29897, 13, 13, 1678, 822, 4770, 842, 5552, 12035, 1311, 29892, 1820, 29892, 995, 1125, 13, 4706, 1018, 29901, 13, 9651, 1203, 17255, 842, 5552, 12035, 1311, 29892, 1820, 29892, 995, 29897, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 736, 731, 5552, 29898, 1311, 3032, 1272, 29892, 1820, 29892, 995, 29897, 13, 13, 1678, 822, 903, 26180, 29918, 22256, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 1272, 3032, 26180, 29918, 22256, 580, 13, 13, 13, 3919, 11937, 29918, 11116, 353, 313, 6691, 29892, 14945, 1469, 29897, 13, 2 ]
home/admin.py
abdulshak1999/notes
2
155122
<filename>home/admin.py from django.contrib import admin from home.models import Note class NoteAdmin(admin.ModelAdmin): prepopulated_fields = { 'slug': ('title', ) } admin.site.register(Note, NoteAdmin)
[ 1, 529, 9507, 29958, 5184, 29914, 6406, 29889, 2272, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 3271, 29889, 9794, 1053, 3940, 13, 13, 13, 1990, 3940, 12754, 29898, 6406, 29889, 3195, 12754, 1125, 13, 1678, 758, 7323, 7964, 29918, 9621, 353, 426, 13, 4706, 525, 29517, 2396, 6702, 3257, 742, 1723, 13, 1678, 500, 13, 13, 13, 6406, 29889, 2746, 29889, 9573, 29898, 9842, 29892, 3940, 12754, 29897, 13, 2 ]
qiskit/chemistry/drivers/fcidumpd/dumper.py
sorin-bolos/qiskit-aqua
2
65742
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. """FCIDump dumper.""" from typing import List, Optional from io import TextIOWrapper import itertools import numpy as np def dump(outpath: str, norb: int, nelec: int, hijs: List[float], hijkls: List[float], einact: float, ms2: int = 0, orbsym: Optional[List[int]] = None, isym: int = 1 ) -> None: # pylint: disable=wrong-spelling-in-docstring """Generates a FCIDump output. Args: outpath: Path to the output file. norb: The number of orbitals. nelec: The number of electrons. hijs: The pair of alpha and beta 1-electron integrals. The latter may be None. hijkls: The triplet of alpha/alpha, beta/alpha and beta/beta 2-electron integrals. The latter two may be None. einact: The inactive energy. ms2: 2*S, where S is the spin quantum number. orbsym: A list of spatial symmetries of the orbitals. isym: The spatial symmetry of the wave function. """ hij, hij_b = hijs hijkl, hijkl_ba, hijkl_bb = hijkls # assert that either all beta variables are None or all of them are not assert all([h is None for h in [hij_b, hijkl_ba, hijkl_bb]]) \ or all([h is not None for h in [hij_b, hijkl_ba, hijkl_bb]]) assert norb == hij.shape[0] == hijkl.shape[0] mos = range(norb) with open(outpath, 'w') as outfile: # print header outfile.write('&FCI NORB={:4d},NELEC={:4d},MS2={:4d}\n'.format(norb, nelec, ms2)) if orbsym is None: outfile.write(' ORBSYM=' + '1,'*norb + '\n') else: assert len(orbsym) == norb outfile.write(' ORBSYM=' + ','.join(orbsym) + '\n') outfile.write(' ISYM={:d},\n/&END\n'.format(isym)) # append 2e integrals _dump_2e_ints(hijkl, mos, outfile) if hijkl_ba is not None: _dump_2e_ints(hijkl_ba.transpose(), mos, outfile, beta=1) if hijkl_bb is not None: _dump_2e_ints(hijkl_bb, mos, outfile, beta=2) # append 1e integrals _dump_1e_ints(hij, mos, outfile) if hij_b is not None: _dump_1e_ints(hij_b, mos, outfile, beta=True) # TODO append MO energies (last three indices are 0) # append inactive energy _write_to_outfile(outfile, einact, (0, 0, 0, 0)) def _dump_1e_ints(hij: List[float], mos: List[int], outfile: TextIOWrapper, beta: bool = False) -> None: idx_offset = 1 if not beta else 1+len(mos) hij_elements = set() for i, j in itertools.product(mos, repeat=2): if i == j: _write_to_outfile(outfile, hij[i][j], (i+idx_offset, j+idx_offset, 0, 0)) continue if (j, i) in hij_elements and np.isclose(hij[i][j], hij[j][i]): continue _write_to_outfile(outfile, hij[i][j], (i+idx_offset, j+idx_offset, 0, 0)) hij_elements.add((i, j)) def _dump_2e_ints(hijkl: List[float], mos: List[int], outfile: TextIOWrapper, beta: int = 0) -> None: idx_offsets = [1, 1] for b in range(beta): idx_offsets[1-b] += len(mos) hijkl_elements = set() # pylint: disable=invalid-name for elem in itertools.product(mos, repeat=4): if np.isclose(hijkl[elem], 0.0, atol=1e-14): continue if len(set(elem)) == 1: _write_to_outfile(outfile, hijkl[elem], (*[e+idx_offsets[0] for e in elem[:2]], *[e+idx_offsets[1] for e in elem[2:]])) continue if beta != 1 and elem[::-1] in hijkl_elements and \ np.isclose(hijkl[elem], hijkl[elem[::-1]]): continue bra_perms = set(itertools.permutations(elem[:2])) ket_perms = set(itertools.permutations(elem[2:])) if beta == 1: permutations = itertools.product(bra_perms, ket_perms) else: permutations = itertools.chain( itertools.product(bra_perms, ket_perms), itertools.product(ket_perms, bra_perms) ) for perm in {e1 + e2 for e1, e2 in permutations}: if perm in hijkl_elements and np.isclose(hijkl[elem], hijkl[perm]): break else: _write_to_outfile(outfile, hijkl[elem], (*[e+idx_offsets[0] for e in elem[:2]], *[e+idx_offsets[1] for e in elem[2:]])) hijkl_elements.add(elem) def _write_to_outfile(outfile: str, value: float, indices: List[int]): outfile.write('{:23.16E}{:4d}{:4d}{:4d}{:4d}\n'.format(value, *indices))
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 910, 775, 338, 760, 310, 660, 3873, 277, 29889, 13, 29937, 13, 29937, 313, 29907, 29897, 14187, 1266, 27955, 29871, 29906, 29900, 29906, 29900, 29889, 13, 29937, 13, 29937, 910, 775, 338, 7794, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 29889, 887, 1122, 13, 29937, 4017, 263, 3509, 310, 445, 19405, 297, 278, 365, 2965, 1430, 1660, 29889, 3945, 934, 297, 278, 3876, 3884, 13, 29937, 310, 445, 2752, 5447, 470, 472, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 29889, 13, 29937, 13, 29937, 3139, 26278, 470, 16291, 1736, 310, 445, 775, 1818, 11551, 445, 13, 29937, 3509, 1266, 8369, 29892, 322, 9120, 2066, 817, 304, 8677, 263, 8369, 23941, 13, 29937, 393, 896, 505, 1063, 10551, 287, 515, 278, 2441, 29879, 29889, 13, 13, 15945, 29908, 8610, 1367, 3427, 270, 398, 546, 1213, 15945, 13, 13, 3166, 19229, 1053, 2391, 29892, 28379, 13, 3166, 12013, 1053, 3992, 5971, 15646, 13, 5215, 4256, 8504, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 16766, 29898, 449, 2084, 29901, 851, 29892, 3643, 29890, 29901, 938, 29892, 452, 280, 29883, 29901, 938, 29892, 4147, 29879, 29901, 2391, 29961, 7411, 1402, 4147, 29895, 3137, 29901, 2391, 29961, 7411, 1402, 1011, 627, 29901, 5785, 29892, 13, 308, 10887, 29906, 29901, 938, 353, 29871, 29900, 29892, 470, 5824, 962, 29901, 28379, 29961, 1293, 29961, 524, 5262, 353, 6213, 29892, 338, 962, 29901, 938, 353, 29871, 29896, 13, 308, 1723, 1599, 6213, 29901, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 15866, 549, 29899, 1028, 7807, 29899, 262, 29899, 1514, 1807, 13, 1678, 9995, 5631, 1078, 263, 7992, 1367, 3427, 1962, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 714, 2084, 29901, 10802, 304, 278, 1962, 934, 29889, 13, 4706, 3643, 29890, 29901, 450, 1353, 310, 16980, 1338, 29889, 13, 4706, 452, 280, 29883, 29901, 450, 1353, 310, 27149, 29889, 13, 4706, 4147, 29879, 29901, 450, 5101, 310, 15595, 322, 21762, 29871, 29896, 29899, 15436, 1617, 3990, 1338, 29889, 450, 7480, 1122, 367, 6213, 29889, 13, 4706, 4147, 29895, 3137, 29901, 450, 21954, 29873, 310, 15595, 29914, 2312, 29892, 21762, 29914, 2312, 322, 21762, 29914, 3571, 29871, 29906, 29899, 15436, 1617, 3990, 1338, 29889, 450, 13, 9651, 7480, 1023, 1122, 367, 6213, 29889, 13, 4706, 1011, 627, 29901, 450, 297, 4925, 5864, 29889, 13, 4706, 10887, 29906, 29901, 29871, 29906, 29930, 29903, 29892, 988, 317, 338, 278, 10917, 12101, 1353, 29889, 13, 4706, 470, 5824, 962, 29901, 319, 1051, 310, 18652, 9682, 2722, 310, 278, 16980, 1338, 29889, 13, 4706, 338, 962, 29901, 450, 18652, 18446, 310, 278, 10742, 740, 29889, 13, 1678, 9995, 13, 1678, 4147, 29892, 4147, 29918, 29890, 353, 4147, 29879, 13, 1678, 4147, 6321, 29892, 4147, 6321, 29918, 2291, 29892, 4147, 6321, 29918, 1327, 353, 4147, 29895, 3137, 13, 1678, 396, 4974, 393, 2845, 599, 21762, 3651, 526, 6213, 470, 599, 310, 963, 526, 451, 13, 1678, 4974, 599, 4197, 29882, 338, 6213, 363, 298, 297, 518, 29882, 823, 29918, 29890, 29892, 4147, 6321, 29918, 2291, 29892, 4147, 6321, 29918, 1327, 24960, 320, 13, 4706, 470, 599, 4197, 29882, 338, 451, 6213, 363, 298, 297, 518, 29882, 823, 29918, 29890, 29892, 4147, 6321, 29918, 2291, 29892, 4147, 6321, 29918, 1327, 24960, 13, 1678, 4974, 3643, 29890, 1275, 4147, 29889, 12181, 29961, 29900, 29962, 1275, 4147, 6321, 29889, 12181, 29961, 29900, 29962, 13, 1678, 19767, 353, 3464, 29898, 29876, 11831, 29897, 13, 1678, 411, 1722, 29898, 449, 2084, 29892, 525, 29893, 1495, 408, 714, 1445, 29901, 13, 4706, 396, 1596, 4839, 13, 4706, 714, 1445, 29889, 3539, 877, 29987, 29943, 8426, 405, 1955, 29933, 3790, 29901, 29946, 29881, 1118, 8186, 1307, 29907, 3790, 29901, 29946, 29881, 1118, 4345, 29906, 3790, 29901, 29946, 29881, 1012, 29876, 4286, 4830, 29898, 29876, 11831, 29892, 452, 280, 29883, 29892, 10887, 29906, 876, 13, 4706, 565, 470, 5824, 962, 338, 6213, 29901, 13, 9651, 714, 1445, 29889, 3539, 877, 6323, 9851, 29979, 29924, 2433, 718, 525, 29896, 5501, 29930, 29876, 11831, 718, 11297, 29876, 1495, 13, 4706, 1683, 29901, 13, 9651, 4974, 7431, 29898, 272, 5824, 962, 29897, 1275, 3643, 29890, 13, 9651, 714, 1445, 29889, 3539, 877, 6323, 9851, 29979, 29924, 2433, 718, 13420, 4286, 7122, 29898, 272, 5824, 962, 29897, 718, 11297, 29876, 1495, 13, 4706, 714, 1445, 29889, 3539, 877, 8519, 29979, 29924, 3790, 29901, 29881, 7570, 29876, 29914, 29987, 11794, 29905, 29876, 4286, 4830, 29898, 275, 962, 876, 13, 4706, 396, 9773, 29871, 29906, 29872, 3990, 1338, 13, 4706, 903, 15070, 29918, 29906, 29872, 29918, 9466, 29898, 29882, 823, 6321, 29892, 19767, 29892, 714, 1445, 29897, 13, 4706, 565, 4147, 6321, 29918, 2291, 338, 451, 6213, 29901, 13, 9651, 903, 15070, 29918, 29906, 29872, 29918, 9466, 29898, 29882, 823, 6321, 29918, 2291, 29889, 3286, 4220, 3285, 19767, 29892, 714, 1445, 29892, 21762, 29922, 29896, 29897, 13, 4706, 565, 4147, 6321, 29918, 1327, 338, 451, 6213, 29901, 13, 9651, 903, 15070, 29918, 29906, 29872, 29918, 9466, 29898, 29882, 823, 6321, 29918, 1327, 29892, 19767, 29892, 714, 1445, 29892, 21762, 29922, 29906, 29897, 13, 4706, 396, 9773, 29871, 29896, 29872, 3990, 1338, 13, 4706, 903, 15070, 29918, 29896, 29872, 29918, 9466, 29898, 29882, 823, 29892, 19767, 29892, 714, 1445, 29897, 13, 4706, 565, 4147, 29918, 29890, 338, 451, 6213, 29901, 13, 9651, 903, 15070, 29918, 29896, 29872, 29918, 9466, 29898, 29882, 823, 29918, 29890, 29892, 19767, 29892, 714, 1445, 29892, 21762, 29922, 5574, 29897, 13, 4706, 396, 14402, 9773, 16999, 18190, 583, 313, 4230, 2211, 16285, 526, 29871, 29900, 29897, 13, 4706, 396, 9773, 297, 4925, 5864, 13, 4706, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29892, 1011, 627, 29892, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 13, 13, 1753, 903, 15070, 29918, 29896, 29872, 29918, 9466, 29898, 29882, 823, 29901, 2391, 29961, 7411, 1402, 19767, 29901, 2391, 29961, 524, 1402, 714, 1445, 29901, 3992, 5971, 15646, 29892, 13, 462, 29871, 21762, 29901, 6120, 353, 7700, 29897, 1599, 6213, 29901, 13, 1678, 22645, 29918, 10289, 353, 29871, 29896, 565, 451, 21762, 1683, 29871, 29896, 29974, 2435, 29898, 7681, 29897, 13, 1678, 4147, 29918, 17664, 353, 731, 580, 13, 1678, 363, 474, 29892, 432, 297, 4256, 8504, 29889, 4704, 29898, 7681, 29892, 12312, 29922, 29906, 1125, 13, 4706, 565, 474, 1275, 432, 29901, 13, 9651, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29892, 4147, 29961, 29875, 3816, 29926, 1402, 313, 29875, 29974, 13140, 29918, 10289, 29892, 432, 29974, 13140, 29918, 10289, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 9651, 6773, 13, 4706, 565, 313, 29926, 29892, 474, 29897, 297, 4147, 29918, 17664, 322, 7442, 29889, 275, 5358, 29898, 29882, 823, 29961, 29875, 3816, 29926, 1402, 4147, 29961, 29926, 3816, 29875, 29962, 1125, 13, 9651, 6773, 13, 4706, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29892, 4147, 29961, 29875, 3816, 29926, 1402, 313, 29875, 29974, 13140, 29918, 10289, 29892, 432, 29974, 13140, 29918, 10289, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 4706, 4147, 29918, 17664, 29889, 1202, 3552, 29875, 29892, 432, 876, 13, 13, 13, 1753, 903, 15070, 29918, 29906, 29872, 29918, 9466, 29898, 29882, 823, 6321, 29901, 2391, 29961, 7411, 1402, 19767, 29901, 2391, 29961, 524, 1402, 714, 1445, 29901, 3992, 5971, 15646, 29892, 13, 462, 29871, 21762, 29901, 938, 353, 29871, 29900, 29897, 1599, 6213, 29901, 13, 1678, 22645, 29918, 2696, 7224, 353, 518, 29896, 29892, 29871, 29896, 29962, 13, 1678, 363, 289, 297, 3464, 29898, 3571, 1125, 13, 4706, 22645, 29918, 2696, 7224, 29961, 29896, 29899, 29890, 29962, 4619, 7431, 29898, 7681, 29897, 13, 1678, 4147, 6321, 29918, 17664, 353, 731, 580, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 20965, 29899, 978, 13, 1678, 363, 21268, 297, 4256, 8504, 29889, 4704, 29898, 7681, 29892, 12312, 29922, 29946, 1125, 13, 4706, 565, 7442, 29889, 275, 5358, 29898, 29882, 823, 6321, 29961, 20461, 1402, 29871, 29900, 29889, 29900, 29892, 472, 324, 29922, 29896, 29872, 29899, 29896, 29946, 1125, 13, 9651, 6773, 13, 4706, 565, 7431, 29898, 842, 29898, 20461, 876, 1275, 29871, 29896, 29901, 13, 9651, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29892, 4147, 6321, 29961, 20461, 1402, 3070, 29961, 29872, 29974, 13140, 29918, 2696, 7224, 29961, 29900, 29962, 363, 321, 297, 21268, 7503, 29906, 20526, 13, 462, 462, 462, 268, 334, 29961, 29872, 29974, 13140, 29918, 2696, 7224, 29961, 29896, 29962, 363, 321, 297, 21268, 29961, 29906, 29901, 5262, 876, 13, 9651, 6773, 13, 4706, 565, 21762, 2804, 29871, 29896, 322, 21268, 29961, 1057, 29899, 29896, 29962, 297, 4147, 6321, 29918, 17664, 322, 320, 13, 18884, 7442, 29889, 275, 5358, 29898, 29882, 823, 6321, 29961, 20461, 1402, 4147, 6321, 29961, 20461, 29961, 1057, 29899, 29896, 5262, 1125, 13, 9651, 6773, 13, 4706, 4105, 29918, 546, 1516, 353, 731, 29898, 1524, 8504, 29889, 546, 6149, 800, 29898, 20461, 7503, 29906, 12622, 13, 4706, 413, 300, 29918, 546, 1516, 353, 731, 29898, 1524, 8504, 29889, 546, 6149, 800, 29898, 20461, 29961, 29906, 29901, 12622, 13, 4706, 565, 21762, 1275, 29871, 29896, 29901, 13, 9651, 20005, 800, 353, 4256, 8504, 29889, 4704, 29898, 2634, 29918, 546, 1516, 29892, 413, 300, 29918, 546, 1516, 29897, 13, 4706, 1683, 29901, 13, 9651, 20005, 800, 353, 4256, 8504, 29889, 14153, 29898, 13, 18884, 4256, 8504, 29889, 4704, 29898, 2634, 29918, 546, 1516, 29892, 413, 300, 29918, 546, 1516, 511, 13, 18884, 4256, 8504, 29889, 4704, 29898, 7873, 29918, 546, 1516, 29892, 4105, 29918, 546, 1516, 29897, 13, 9651, 1723, 13, 4706, 363, 3635, 297, 426, 29872, 29896, 718, 321, 29906, 363, 321, 29896, 29892, 321, 29906, 297, 20005, 800, 6177, 13, 9651, 565, 3635, 297, 4147, 6321, 29918, 17664, 322, 7442, 29889, 275, 5358, 29898, 29882, 823, 6321, 29961, 20461, 1402, 4147, 6321, 29961, 17858, 29962, 1125, 13, 18884, 2867, 13, 4706, 1683, 29901, 13, 9651, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29892, 4147, 6321, 29961, 20461, 1402, 3070, 29961, 29872, 29974, 13140, 29918, 2696, 7224, 29961, 29900, 29962, 363, 321, 297, 21268, 7503, 29906, 20526, 13, 462, 462, 462, 268, 334, 29961, 29872, 29974, 13140, 29918, 2696, 7224, 29961, 29896, 29962, 363, 321, 297, 21268, 29961, 29906, 29901, 5262, 876, 13, 9651, 4147, 6321, 29918, 17664, 29889, 1202, 29898, 20461, 29897, 13, 13, 13, 1753, 903, 3539, 29918, 517, 29918, 449, 1445, 29898, 449, 1445, 29901, 851, 29892, 995, 29901, 5785, 29892, 16285, 29901, 2391, 29961, 524, 29962, 1125, 13, 1678, 714, 1445, 29889, 3539, 877, 25641, 29906, 29941, 29889, 29896, 29953, 29923, 1157, 29901, 29946, 29881, 1157, 29901, 29946, 29881, 1157, 29901, 29946, 29881, 1157, 29901, 29946, 29881, 1012, 29876, 4286, 4830, 29898, 1767, 29892, 334, 513, 1575, 876, 13, 2 ]
super_laser_gui.py
hemmerlinglab/Prehistoric-Data-Acquisition
0
93855
<filename>super_laser_gui.py import sys, os, serial, datetime, time import numpy as np from configparser import ConfigParser import scipy from scipy.interpolate import interp1d import fileinput from simple_pid import PID from wlm import * # shouldn't need this -> from Fiber import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * from matplotlib.backends.qt_compat import QtCore, QtWidgets, is_pyqt5 if is_pyqt5(): from matplotlib.backends.backend_qt5agg import ( FigureCanvas, NavigationToolbar2QT as NavigationToolbar) else: from matplotlib.backends.backend_qt4agg import ( FigureCanvas, NavigationToolbar2QT as NavigationToolbar) from matplotlib.figure import Figure class App(QWidget): def __init__(self): super().__init__() self.title = 'Super Laser Locker' self.left = 0 self.top = 0 self.width = 1500 self.height = 400 self.set_point = 0 # THz self.update_interval = 1 # ms self.no_of_points = 100 self.no_of_arduinos = 1 self.wlm = WavelengthMeter() self.initUI() self.timer = QTimer() self.timer.timeout.connect(self.tick) self.timer.start(self.update_interval) def tick(self): all_freq_reads = self.wlm.frequencies for laser in self.laser_objs.keys(): freq_read = all_freq_reads[int(self.laser_objs[laser].chan) - 1] if freq_read >= 0: freq_mess = freq_read if self.laser_objs[laser].lockable and self.laser_objs[laser].lock_check.isChecked(): control = self.laser_objs[laser].my_pid(freq_mess) ard_num = int(4095.0/20 * control + 4095.0/2.0) mystr = '{:04d}'.format(ard_num).encode('utf-8') self.laser_objs[laser].my_ard.ser.write(mystr) elif freq_read == -3.0: freq_mess = 'UNDER' elif freq_read == -4.0: freq_mess = 'OVER' else: freq_mess = 'ERROR' self.laser_objs[laser].update_frequency(freq_mess) def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.main_layout = QHBoxLayout() self.laser_objs = {} self.lasers = read_config() for las in self.lasers.keys(): newlas = Laser() newlas.update_name(las) newlas.update_lockable(self.lasers[las]['lockable']) newlas.update_channel(self.lasers[las]['chan']) newlas.filename = self.lasers[las]['setfile'] # if newlas.lockable: # newlas.my_ard = Arduino(self.lasers[las]['com_port']) # else: # print('arduino not created') newlas.get_setpoint() self.main_layout.addWidget(newlas) self.laser_objs[las] = newlas self.setLayout(self.main_layout) self.show() class Laser(QWidget): def __init__(self): super().__init__() self.name = '' self.type = '' self.chan = 0 self.lockable = True self.locking = False self.frequency = 0 self.setpoint = 0 self.p = 100 self.i = 1000 self.d = 0 self.ard_mess = 2048 self.offset = 0 self.fstep = 50 self.filename = '' self.basefolder = 'z:\\' self.my_pid = PID(self.p,self.i,self.d,self.setpoint,sample_time = 0.01, output_limits = [-10,10]) self.my_ard = '' self.layout = QGridLayout() self.name_label = QLabel(self.name) name_font = QFont("Times",30,QFont.Bold) self.name_label.setFont(name_font) self.set_label = QLabel('Setpoint (THz):') self.ard_label = QLabel('Control Value:') self.off_label = QLabel('Set Offset (THz):') self.step_label = QLabel('Step Size (MHz):') self.p_label = QLabel('P:') self.i_label = QLabel('I:') self.d_label = QLabel('D:') self.freq_value = QLabel("{0:.6f}".format(self.frequency)) self.set_value = QLineEdit("{0:.6f}".format(self.setpoint)) self.ard_value = QLabel(str(self.ard_mess)) self.off_value = QLineEdit("{0:.6f}".format(self.offset)) self.step_value = QLineEdit(str(self.fstep)) self.p_value = QLineEdit(str(self.p)) self.i_value = QLineEdit(str(self.i)) self.d_value = QLineEdit(str(self.d)) self.scan_label = QLabel('Frequency Shift (MHz):') self.laser_scan = QSpinBox() self.laser_scan.setMinimum(-5000) self.laser_scan.setMaximum(5000) self.laser_scan.setSingleStep(np.int(self.fstep)) self.laser_scan.valueChanged.connect(self.set_setpoint) self.laser_scan.valueChanged.connect(self.set_fstep) self.p_value.returnPressed.connect(self.update_p) self.i_value.returnPressed.connect(self.update_i) self.d_value.returnPressed.connect(self.update_d) self.pid_label = QLabel('PID Values') self.lock_check = QCheckBox('Lock') self.layout.addWidget(self.name_label,0,0) self.layout.addWidget(QLabel('THz'),0,2) self.layout.addWidget(self.freq_value,0,1) self.layout.addWidget(self.lock_check,1,0) self.layout.addWidget(self.ard_label,2,0) self.layout.addWidget(self.ard_value,2,1) self.layout.addWidget(self.set_label,3,0) self.layout.addWidget(self.set_value,3,1) self.layout.addWidget(self.scan_label,4,0) self.layout.addWidget(self.laser_scan,4,1) self.layout.addWidget(self.off_label,5,0) self.layout.addWidget(self.off_value,5,1) self.layout.addWidget(self.step_label,6,0) self.layout.addWidget(self.step_value,6,1) self.layout.addWidget(self.pid_label,7,0) self.layout.addWidget(self.p_label,8,0) self.layout.addWidget(self.p_value,8,1) self.layout.addWidget(self.i_label,9,0) self.layout.addWidget(self.i_value,9,1) self.layout.addWidget(self.d_label,10,0) self.layout.addWidget(self.d_value,10,1) self.setLayout(self.layout) def update_frequency(self,new_freq): nf = new_freq self.frequency = nf try: self.freq_value.setText("{0:.6f}".format(nf)) except: self.freq_value.setText(nf) def update_name(self,new_name): nn = str(new_name) self.name = nn self.name_label.setText(nn) def update_channel(self,new_chan): nc = int(new_chan) self.chan = new_chan def update_p(self): self.p = np.float(self.p_value.text()) self.my_pid.Kp = self.p def update_i(self): self.i = np.float(self.i_value.text()) self.my_pid.Ki = self.i def update_d(self): self.d = np.float(self.d_value.text()) self.my_pid.Kd = self.d # def update_type(self,new_type): # nt = str(new_type) # self.type = nt # self.type_label.setText(nt) def update_lockable(self,new_lockable): if new_lockable == 'True': nl = True else: nl = False self.lockable = nl if not self.lockable: self.ard_label.hide() self.ard_value.hide() self.scan_label.hide() self.laser_scan.hide() self.off_label.hide() self.off_value.hide() self.step_label.hide() self.step_value.hide() self.pid_label.hide() self.p_label.hide() self.p_value.hide() self.i_label.hide() self.i_value.hide() self.d_value.hide() self.d_label.hide() self.lock_check.hide() def set_fstep(self): new_fstep = np.int(self.step_value.text()) self.laser_scan.setSingleStep(new_fstep) self.fstep = new_fstep def set_setpoint(self): ns = np.float(self.offset) + np.float(self.fstep)*1e-6 filepath = self.basefolder + self.filename file = open(filepath,'w') file.write(str(ns)) file.close() self.setpoint = ns self.set_value.setText("{0:.6f}".format(ns)) self.my_pid.setpoint = self.setpoint def get_setpoint(self): filepath = self.basefolder + self.filename file = open(filepath,'r') new_set = np.float(file.readline()) file.close() self.setpoint = new_set self.set_value.setText("{0:.6f}".format(new_set)) self.off_value.setText("{0:.6f}".format(new_set)) def update_ardmess(self,new_mess): nm = new_mess self.ard_mess = new_mess self.ard_label.setText(new_mess) class Arduino(): def __init__(self,com_port): serial_port = com_port baud_rate = 9600; try: self.ser = serial.Serial(serial_port, baud_rate, bytesize=serial.SEVENBITS, parity=serial.PARITY_ODD, stopbits=serial.STOPBITS_ONE, timeout=1) except: try: ser.close() except: print ("Serial port already closed" ) self.ser = serial.Serial(serial_port, baud_rate, bytesize=serial.SEVENBITS, parity=serial.PARITY_ODD, stopbits=serial.STOPBITS_ONE, timeout=1) def read_config(filename = 'laser_config.ini'): config = ConfigParser() config.read(filename) laser_ids = config.sections() # make dictionary out of config lasers = {} for l in laser_ids: opts = config.options(l) lasers[l] = {} for o in opts: lasers[l][o] = config.get(l, o) return lasers def set_dark(app): dark_palette = QPalette() dark_palette.setColor(QPalette.Window, QColor(53, 53, 53)) dark_palette.setColor(QPalette.WindowText, Qt.white) dark_palette.setColor(QPalette.Base, QColor(25, 25, 25)) dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ToolTipBase, Qt.white) dark_palette.setColor(QPalette.ToolTipText, Qt.white) dark_palette.setColor(QPalette.Text, Qt.white) dark_palette.setColor(QPalette.Button, QColor(53, 53, 53)) dark_palette.setColor(QPalette.ButtonText, Qt.white) dark_palette.setColor(QPalette.BrightText, Qt.red) dark_palette.setColor(QPalette.Link, QColor(42, 130, 218)) dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218)) dark_palette.setColor(QPalette.HighlightedText, Qt.black) app.setPalette(dark_palette) app.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }") if __name__ == '__main__': app = QApplication(sys.argv) app.setStyle('Fusion') set_dark(app) ex = App() sys.exit(app.exec_())
[ 1, 529, 9507, 29958, 9136, 29918, 3333, 261, 29918, 23569, 29889, 2272, 13, 5215, 10876, 29892, 2897, 29892, 7797, 29892, 12865, 29892, 931, 13, 5215, 12655, 408, 7442, 13, 3166, 2295, 16680, 1053, 12782, 11726, 13, 5215, 4560, 2272, 13, 3166, 4560, 2272, 29889, 1639, 3733, 403, 1053, 1006, 29886, 29896, 29881, 13, 5215, 934, 2080, 13, 3166, 2560, 29918, 5935, 1053, 349, 1367, 13, 3166, 281, 21457, 1053, 334, 13, 13, 29937, 9273, 29915, 29873, 817, 445, 1599, 515, 383, 12347, 1053, 334, 13, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 28707, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 334, 13, 13, 3166, 22889, 29889, 1627, 1975, 29889, 17915, 29918, 12667, 1053, 14705, 9203, 29892, 14705, 8801, 29879, 29892, 338, 29918, 2272, 17915, 29945, 13, 361, 338, 29918, 2272, 17915, 29945, 7295, 13, 1678, 515, 22889, 29889, 1627, 1975, 29889, 27852, 29918, 17915, 29945, 16170, 1053, 313, 13, 4706, 11479, 21960, 29892, 23001, 12229, 1646, 29906, 29984, 29911, 408, 23001, 12229, 1646, 29897, 13, 2870, 29901, 13, 1678, 515, 22889, 29889, 1627, 1975, 29889, 27852, 29918, 17915, 29946, 16170, 1053, 313, 13, 4706, 11479, 21960, 29892, 23001, 12229, 1646, 29906, 29984, 29911, 408, 23001, 12229, 1646, 29897, 13, 3166, 22889, 29889, 4532, 1053, 11479, 13, 13, 13, 13, 1990, 2401, 29898, 29984, 8801, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 3257, 353, 525, 19111, 7413, 261, 365, 8658, 29915, 13, 4706, 1583, 29889, 1563, 353, 29871, 29900, 13, 4706, 1583, 29889, 3332, 353, 29871, 29900, 13, 4706, 1583, 29889, 2103, 353, 29871, 29896, 29945, 29900, 29900, 13, 4706, 1583, 29889, 3545, 353, 29871, 29946, 29900, 29900, 13, 4706, 1583, 29889, 842, 29918, 3149, 353, 29871, 29900, 396, 3446, 29920, 13, 4706, 1583, 29889, 5504, 29918, 19207, 353, 29871, 29896, 396, 10887, 13, 4706, 1583, 29889, 1217, 29918, 974, 29918, 9748, 353, 29871, 29896, 29900, 29900, 13, 4706, 1583, 29889, 1217, 29918, 974, 29918, 538, 29884, 8226, 353, 29871, 29896, 13, 13, 4706, 1583, 29889, 29893, 21457, 353, 399, 6447, 1477, 29924, 1308, 580, 13, 308, 13, 13, 4706, 1583, 29889, 2344, 3120, 580, 13, 4706, 1583, 29889, 20404, 353, 660, 14745, 580, 13, 4706, 1583, 29889, 20404, 29889, 15619, 29889, 6915, 29898, 1311, 29889, 24667, 29897, 13, 4706, 1583, 29889, 20404, 29889, 2962, 29898, 1311, 29889, 5504, 29918, 19207, 29897, 13, 308, 13, 13, 1678, 822, 16892, 29898, 1311, 1125, 13, 4706, 599, 29918, 29888, 7971, 29918, 949, 29879, 353, 1583, 29889, 29893, 21457, 29889, 10745, 339, 15942, 13, 13, 4706, 363, 1869, 261, 297, 1583, 29889, 3333, 261, 29918, 711, 1315, 29889, 8149, 7295, 13, 9651, 3005, 29939, 29918, 949, 353, 599, 29918, 29888, 7971, 29918, 949, 29879, 29961, 524, 29898, 1311, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 5083, 29897, 448, 29871, 29896, 29962, 13, 9651, 565, 3005, 29939, 29918, 949, 6736, 29871, 29900, 29901, 13, 18884, 3005, 29939, 29918, 12062, 353, 3005, 29939, 29918, 949, 13, 18884, 565, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 908, 519, 322, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 908, 29918, 3198, 29889, 275, 17817, 7295, 13, 462, 1678, 2761, 353, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 1357, 29918, 5935, 29898, 29888, 7971, 29918, 12062, 29897, 13, 462, 1678, 564, 29881, 29918, 1949, 353, 938, 29898, 29946, 29900, 29929, 29945, 29889, 29900, 29914, 29906, 29900, 334, 2761, 718, 29871, 29946, 29900, 29929, 29945, 29889, 29900, 29914, 29906, 29889, 29900, 29897, 13, 462, 1678, 590, 710, 353, 22372, 29901, 29900, 29946, 29881, 29913, 4286, 4830, 29898, 538, 29918, 1949, 467, 12508, 877, 9420, 29899, 29947, 1495, 13, 462, 1678, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 1357, 29918, 538, 29889, 643, 29889, 3539, 29898, 1357, 710, 29897, 13, 13, 9651, 25342, 3005, 29939, 29918, 949, 1275, 448, 29941, 29889, 29900, 29901, 13, 18884, 3005, 29939, 29918, 12062, 353, 525, 18783, 1001, 29915, 13, 9651, 25342, 3005, 29939, 29918, 949, 1275, 448, 29946, 29889, 29900, 29901, 29871, 13, 18884, 3005, 29939, 29918, 12062, 353, 525, 29949, 5348, 29915, 13, 9651, 1683, 29901, 13, 18884, 3005, 29939, 29918, 12062, 353, 525, 11432, 29915, 13, 13, 9651, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 261, 1822, 5504, 29918, 10745, 23860, 29898, 29888, 7971, 29918, 12062, 29897, 13, 13, 1678, 822, 2069, 3120, 29898, 1311, 1125, 13, 4706, 1583, 29889, 842, 5907, 7030, 29898, 1311, 29889, 3257, 29897, 13, 4706, 1583, 29889, 842, 7999, 7843, 29898, 1311, 29889, 1563, 29892, 1583, 29889, 3332, 29892, 1583, 29889, 2103, 29892, 1583, 29889, 3545, 29897, 13, 13, 4706, 1583, 29889, 3396, 29918, 2680, 353, 660, 29950, 3313, 3453, 580, 13, 13, 4706, 1583, 29889, 3333, 261, 29918, 711, 1315, 353, 6571, 13, 4706, 1583, 29889, 3333, 414, 353, 1303, 29918, 2917, 580, 13, 13, 4706, 363, 1869, 297, 1583, 29889, 3333, 414, 29889, 8149, 7295, 13, 9651, 716, 3333, 353, 7413, 261, 580, 13, 9651, 716, 3333, 29889, 5504, 29918, 978, 29898, 3333, 29897, 13, 9651, 716, 3333, 29889, 5504, 29918, 908, 519, 29898, 1311, 29889, 3333, 414, 29961, 3333, 22322, 908, 519, 11287, 13, 9651, 716, 3333, 29889, 5504, 29918, 12719, 29898, 1311, 29889, 3333, 414, 29961, 3333, 22322, 5083, 11287, 13, 9651, 716, 3333, 29889, 9507, 353, 1583, 29889, 3333, 414, 29961, 3333, 22322, 842, 1445, 2033, 13, 9651, 396, 565, 716, 3333, 29889, 908, 519, 29901, 13, 9651, 396, 268, 716, 3333, 29889, 1357, 29918, 538, 353, 826, 28955, 29898, 1311, 29889, 3333, 414, 29961, 3333, 22322, 510, 29918, 637, 11287, 13, 9651, 396, 1683, 29901, 13, 9651, 396, 268, 1596, 877, 538, 29884, 1789, 451, 2825, 1495, 13, 9651, 716, 3333, 29889, 657, 29918, 842, 3149, 580, 13, 9651, 1583, 29889, 3396, 29918, 2680, 29889, 1202, 8801, 29898, 1482, 3333, 29897, 13, 9651, 1583, 29889, 3333, 261, 29918, 711, 1315, 29961, 3333, 29962, 353, 716, 3333, 13, 13, 4706, 1583, 29889, 842, 3453, 29898, 1311, 29889, 3396, 29918, 2680, 29897, 13, 4706, 1583, 29889, 4294, 580, 13, 13, 13, 1990, 7413, 261, 29898, 29984, 8801, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 978, 353, 6629, 13, 4706, 1583, 29889, 1853, 353, 6629, 13, 4706, 1583, 29889, 5083, 353, 29871, 29900, 13, 4706, 1583, 29889, 908, 519, 353, 5852, 13, 4706, 1583, 29889, 908, 292, 353, 7700, 13, 4706, 1583, 29889, 10745, 23860, 353, 29871, 29900, 13, 4706, 1583, 29889, 842, 3149, 353, 29871, 29900, 13, 4706, 1583, 29889, 29886, 353, 29871, 29896, 29900, 29900, 13, 4706, 1583, 29889, 29875, 353, 29871, 29896, 29900, 29900, 29900, 13, 4706, 1583, 29889, 29881, 353, 29871, 29900, 13, 4706, 1583, 29889, 538, 29918, 12062, 353, 29871, 29906, 29900, 29946, 29947, 13, 4706, 1583, 29889, 10289, 353, 29871, 29900, 13, 4706, 1583, 29889, 29888, 10568, 353, 29871, 29945, 29900, 13, 4706, 1583, 29889, 9507, 353, 6629, 13, 4706, 1583, 29889, 3188, 12083, 353, 525, 29920, 22298, 29915, 13, 4706, 1583, 29889, 1357, 29918, 5935, 353, 349, 1367, 29898, 1311, 29889, 29886, 29892, 1311, 29889, 29875, 29892, 1311, 29889, 29881, 29892, 1311, 29889, 842, 3149, 29892, 11249, 29918, 2230, 353, 29871, 29900, 29889, 29900, 29896, 29892, 1962, 29918, 12514, 353, 21069, 29896, 29900, 29892, 29896, 29900, 2314, 13, 4706, 1583, 29889, 1357, 29918, 538, 353, 6629, 13, 13, 4706, 1583, 29889, 2680, 353, 660, 5756, 3453, 580, 13, 13, 4706, 1583, 29889, 978, 29918, 1643, 353, 660, 4775, 29898, 1311, 29889, 978, 29897, 13, 4706, 1024, 29918, 5657, 353, 660, 9824, 703, 29164, 613, 29941, 29900, 29892, 29984, 9824, 29889, 29933, 1025, 29897, 13, 4706, 1583, 29889, 978, 29918, 1643, 29889, 842, 9824, 29898, 978, 29918, 5657, 29897, 13, 4706, 1583, 29889, 842, 29918, 1643, 353, 660, 4775, 877, 2697, 3149, 313, 4690, 29920, 1125, 1495, 13, 4706, 1583, 29889, 538, 29918, 1643, 353, 660, 4775, 877, 4809, 7865, 29901, 1495, 13, 4706, 1583, 29889, 2696, 29918, 1643, 353, 660, 4775, 877, 2697, 5947, 842, 313, 4690, 29920, 1125, 1495, 13, 4706, 1583, 29889, 10568, 29918, 1643, 353, 660, 4775, 877, 14448, 21179, 313, 29924, 12661, 1125, 1495, 13, 4706, 1583, 29889, 29886, 29918, 1643, 353, 660, 4775, 877, 29925, 29901, 1495, 13, 4706, 1583, 29889, 29875, 29918, 1643, 353, 660, 4775, 877, 29902, 29901, 1495, 13, 4706, 1583, 29889, 29881, 29918, 1643, 353, 660, 4775, 877, 29928, 29901, 1495, 13, 13, 4706, 1583, 29889, 29888, 7971, 29918, 1767, 353, 660, 4775, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1311, 29889, 10745, 23860, 876, 13, 4706, 1583, 29889, 842, 29918, 1767, 353, 660, 3542, 6103, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1311, 29889, 842, 3149, 876, 13, 4706, 1583, 29889, 538, 29918, 1767, 353, 660, 4775, 29898, 710, 29898, 1311, 29889, 538, 29918, 12062, 876, 13, 4706, 1583, 29889, 2696, 29918, 1767, 353, 660, 3542, 6103, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1311, 29889, 10289, 876, 13, 4706, 1583, 29889, 10568, 29918, 1767, 353, 660, 3542, 6103, 29898, 710, 29898, 1311, 29889, 29888, 10568, 876, 13, 4706, 1583, 29889, 29886, 29918, 1767, 353, 660, 3542, 6103, 29898, 710, 29898, 1311, 29889, 29886, 876, 13, 4706, 1583, 29889, 29875, 29918, 1767, 353, 660, 3542, 6103, 29898, 710, 29898, 1311, 29889, 29875, 876, 13, 4706, 1583, 29889, 29881, 29918, 1767, 353, 660, 3542, 6103, 29898, 710, 29898, 1311, 29889, 29881, 876, 13, 13, 4706, 1583, 29889, 16192, 29918, 1643, 353, 660, 4775, 877, 23923, 23860, 1383, 2027, 313, 29924, 12661, 1125, 1495, 13, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 353, 660, 5592, 262, 3313, 580, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 842, 8140, 12539, 6278, 29945, 29900, 29900, 29900, 29897, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 842, 7976, 12539, 29898, 29945, 29900, 29900, 29900, 29897, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 842, 15771, 14448, 29898, 9302, 29889, 524, 29898, 1311, 29889, 29888, 10568, 876, 13, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 1767, 7590, 29889, 6915, 29898, 1311, 29889, 842, 29918, 842, 3149, 29897, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 1767, 7590, 29889, 6915, 29898, 1311, 29889, 842, 29918, 29888, 10568, 29897, 13, 4706, 1583, 29889, 29886, 29918, 1767, 29889, 2457, 24104, 29889, 6915, 29898, 1311, 29889, 5504, 29918, 29886, 29897, 13, 4706, 1583, 29889, 29875, 29918, 1767, 29889, 2457, 24104, 29889, 6915, 29898, 1311, 29889, 5504, 29918, 29875, 29897, 13, 4706, 1583, 29889, 29881, 29918, 1767, 29889, 2457, 24104, 29889, 6915, 29898, 1311, 29889, 5504, 29918, 29881, 29897, 13, 13, 4706, 1583, 29889, 5935, 29918, 1643, 353, 660, 4775, 877, 29925, 1367, 2630, 1041, 1495, 13, 4706, 1583, 29889, 908, 29918, 3198, 353, 660, 28360, 877, 16542, 1495, 13, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 978, 29918, 1643, 29892, 29900, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 2239, 1107, 877, 4690, 29920, 5477, 29900, 29892, 29906, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29888, 7971, 29918, 1767, 29892, 29900, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 908, 29918, 3198, 29892, 29896, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 538, 29918, 1643, 29892, 29906, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 538, 29918, 1767, 29892, 29906, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 842, 29918, 1643, 29892, 29941, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 842, 29918, 1767, 29892, 29941, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 16192, 29918, 1643, 29892, 29946, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 3333, 261, 29918, 16192, 29892, 29946, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 2696, 29918, 1643, 29892, 29945, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 2696, 29918, 1767, 29892, 29945, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 10568, 29918, 1643, 29892, 29953, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 10568, 29918, 1767, 29892, 29953, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 5935, 29918, 1643, 29892, 29955, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29886, 29918, 1643, 29892, 29947, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29886, 29918, 1767, 29892, 29947, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29875, 29918, 1643, 29892, 29929, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29875, 29918, 1767, 29892, 29929, 29892, 29896, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29881, 29918, 1643, 29892, 29896, 29900, 29892, 29900, 29897, 13, 4706, 1583, 29889, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29881, 29918, 1767, 29892, 29896, 29900, 29892, 29896, 29897, 13, 308, 13, 4706, 1583, 29889, 842, 3453, 29898, 1311, 29889, 2680, 29897, 13, 13, 1678, 822, 2767, 29918, 10745, 23860, 29898, 1311, 29892, 1482, 29918, 29888, 7971, 1125, 13, 4706, 302, 29888, 353, 716, 29918, 29888, 7971, 13, 4706, 1583, 29889, 10745, 23860, 353, 302, 29888, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 29888, 7971, 29918, 1767, 29889, 12038, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 29876, 29888, 876, 13, 4706, 5174, 29901, 13, 9651, 1583, 29889, 29888, 7971, 29918, 1767, 29889, 12038, 29898, 29876, 29888, 29897, 13, 13, 1678, 822, 2767, 29918, 978, 29898, 1311, 29892, 1482, 29918, 978, 1125, 13, 4706, 302, 29876, 353, 851, 29898, 1482, 29918, 978, 29897, 13, 4706, 1583, 29889, 978, 353, 302, 29876, 13, 4706, 1583, 29889, 978, 29918, 1643, 29889, 12038, 29898, 15755, 29897, 13, 13, 1678, 822, 2767, 29918, 12719, 29898, 1311, 29892, 1482, 29918, 5083, 1125, 13, 4706, 302, 29883, 353, 938, 29898, 1482, 29918, 5083, 29897, 13, 4706, 1583, 29889, 5083, 353, 716, 29918, 5083, 13, 13, 1678, 822, 2767, 29918, 29886, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29886, 353, 7442, 29889, 7411, 29898, 1311, 29889, 29886, 29918, 1767, 29889, 726, 3101, 13, 4706, 1583, 29889, 1357, 29918, 5935, 29889, 29968, 29886, 353, 1583, 29889, 29886, 13, 13, 1678, 822, 2767, 29918, 29875, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29875, 353, 7442, 29889, 7411, 29898, 1311, 29889, 29875, 29918, 1767, 29889, 726, 3101, 13, 4706, 1583, 29889, 1357, 29918, 5935, 29889, 29968, 29875, 353, 1583, 29889, 29875, 13, 13, 1678, 822, 2767, 29918, 29881, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29881, 353, 7442, 29889, 7411, 29898, 1311, 29889, 29881, 29918, 1767, 29889, 726, 3101, 13, 4706, 1583, 29889, 1357, 29918, 5935, 29889, 29968, 29881, 353, 1583, 29889, 29881, 13, 13, 1678, 396, 822, 2767, 29918, 1853, 29898, 1311, 29892, 1482, 29918, 1853, 1125, 13, 1678, 396, 259, 302, 29873, 353, 851, 29898, 1482, 29918, 1853, 29897, 13, 1678, 396, 259, 1583, 29889, 1853, 353, 302, 29873, 13, 1678, 396, 259, 1583, 29889, 1853, 29918, 1643, 29889, 12038, 29898, 593, 29897, 13, 13, 13, 1678, 822, 2767, 29918, 908, 519, 29898, 1311, 29892, 1482, 29918, 908, 519, 1125, 13, 4706, 565, 716, 29918, 908, 519, 1275, 525, 5574, 2396, 13, 9651, 302, 29880, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 302, 29880, 353, 7700, 13, 4706, 1583, 29889, 908, 519, 353, 302, 29880, 13, 4706, 565, 451, 1583, 29889, 908, 519, 29901, 13, 9651, 1583, 29889, 538, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 538, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 16192, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 3333, 261, 29918, 16192, 29889, 11458, 580, 13, 9651, 1583, 29889, 2696, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 2696, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 10568, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 10568, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 5935, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 29886, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 29886, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 29875, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 29875, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 29881, 29918, 1767, 29889, 11458, 580, 13, 9651, 1583, 29889, 29881, 29918, 1643, 29889, 11458, 580, 13, 9651, 1583, 29889, 908, 29918, 3198, 29889, 11458, 580, 13, 13, 1678, 822, 731, 29918, 29888, 10568, 29898, 1311, 1125, 13, 4706, 716, 29918, 29888, 10568, 353, 7442, 29889, 524, 29898, 1311, 29889, 10568, 29918, 1767, 29889, 726, 3101, 13, 4706, 1583, 29889, 3333, 261, 29918, 16192, 29889, 842, 15771, 14448, 29898, 1482, 29918, 29888, 10568, 29897, 13, 4706, 1583, 29889, 29888, 10568, 353, 716, 29918, 29888, 10568, 13, 13, 13, 1678, 822, 731, 29918, 842, 3149, 29898, 1311, 1125, 13, 4706, 17534, 353, 7442, 29889, 7411, 29898, 1311, 29889, 10289, 29897, 718, 7442, 29889, 7411, 29898, 1311, 29889, 29888, 10568, 11877, 29896, 29872, 29899, 29953, 13, 4706, 934, 2084, 353, 1583, 29889, 3188, 12083, 718, 1583, 29889, 9507, 13, 4706, 934, 353, 1722, 29898, 1445, 2084, 5501, 29893, 1495, 13, 4706, 934, 29889, 3539, 29898, 710, 29898, 1983, 876, 13, 4706, 934, 29889, 5358, 580, 13, 4706, 1583, 29889, 842, 3149, 353, 17534, 13, 4706, 1583, 29889, 842, 29918, 1767, 29889, 12038, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1983, 876, 13, 4706, 1583, 29889, 1357, 29918, 5935, 29889, 842, 3149, 353, 1583, 29889, 842, 3149, 13, 13, 13, 1678, 822, 679, 29918, 842, 3149, 29898, 1311, 1125, 13, 4706, 934, 2084, 353, 1583, 29889, 3188, 12083, 718, 1583, 29889, 9507, 13, 4706, 934, 353, 1722, 29898, 1445, 2084, 5501, 29878, 1495, 13, 4706, 716, 29918, 842, 353, 7442, 29889, 7411, 29898, 1445, 29889, 949, 1220, 3101, 13, 4706, 934, 29889, 5358, 580, 13, 13, 4706, 1583, 29889, 842, 3149, 353, 716, 29918, 842, 13, 4706, 1583, 29889, 842, 29918, 1767, 29889, 12038, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1482, 29918, 842, 876, 13, 4706, 1583, 29889, 2696, 29918, 1767, 29889, 12038, 703, 29912, 29900, 29901, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 1482, 29918, 842, 876, 13, 13, 13, 1678, 822, 2767, 29918, 538, 12062, 29898, 1311, 29892, 1482, 29918, 12062, 1125, 13, 4706, 302, 29885, 353, 716, 29918, 12062, 13, 4706, 1583, 29889, 538, 29918, 12062, 353, 716, 29918, 12062, 13, 4706, 1583, 29889, 538, 29918, 1643, 29889, 12038, 29898, 1482, 29918, 12062, 29897, 13, 13, 13, 1990, 826, 28955, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 510, 29918, 637, 1125, 13, 4706, 7797, 29918, 637, 353, 419, 29918, 637, 13, 4706, 9922, 566, 29918, 10492, 353, 29871, 29929, 29953, 29900, 29900, 29936, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 643, 353, 7797, 29889, 9125, 29898, 15550, 29918, 637, 29892, 9922, 566, 29918, 10492, 29892, 29871, 13, 462, 9651, 6262, 675, 29922, 15550, 29889, 1660, 29963, 1430, 22698, 29903, 29892, 29871, 13, 462, 9651, 610, 537, 29922, 15550, 29889, 16320, 11937, 29918, 29949, 7858, 29892, 29871, 13, 462, 9651, 5040, 14836, 29922, 15550, 29889, 1254, 4590, 22698, 29903, 29918, 12413, 29892, 29871, 13, 462, 9651, 11815, 29922, 29896, 29897, 13, 4706, 5174, 29901, 13, 9651, 1018, 29901, 13, 18884, 724, 29889, 5358, 580, 13, 9651, 5174, 29901, 13, 18884, 1596, 4852, 9125, 2011, 2307, 5764, 29908, 1723, 13, 18884, 1583, 29889, 643, 353, 7797, 29889, 9125, 29898, 15550, 29918, 637, 29892, 9922, 566, 29918, 10492, 29892, 29871, 13, 462, 9651, 6262, 675, 29922, 15550, 29889, 1660, 29963, 1430, 22698, 29903, 29892, 29871, 13, 462, 9651, 610, 537, 29922, 15550, 29889, 16320, 11937, 29918, 29949, 7858, 29892, 29871, 13, 462, 9651, 5040, 14836, 29922, 15550, 29889, 1254, 4590, 22698, 29903, 29918, 12413, 29892, 29871, 13, 462, 9651, 11815, 29922, 29896, 29897, 13, 13, 13, 13, 13, 13, 1753, 1303, 29918, 2917, 29898, 9507, 353, 525, 3333, 261, 29918, 2917, 29889, 2172, 29374, 13, 1678, 2295, 353, 12782, 11726, 580, 13, 1678, 2295, 29889, 949, 29898, 9507, 29897, 13, 13, 1678, 1869, 261, 29918, 4841, 353, 2295, 29889, 27117, 580, 13, 1678, 396, 1207, 8600, 714, 310, 2295, 13, 13, 1678, 1869, 414, 353, 6571, 13, 13, 1678, 363, 301, 297, 1869, 261, 29918, 4841, 29901, 13, 4706, 29111, 353, 2295, 29889, 6768, 29898, 29880, 29897, 13, 308, 13, 4706, 1869, 414, 29961, 29880, 29962, 353, 6571, 13, 4706, 363, 288, 297, 29111, 29901, 13, 9651, 1869, 414, 29961, 29880, 3816, 29877, 29962, 353, 2295, 29889, 657, 29898, 29880, 29892, 288, 29897, 13, 13, 1678, 736, 1869, 414, 13, 13, 13, 1753, 731, 29918, 26031, 29898, 932, 1125, 13, 1678, 6501, 29918, 29886, 26456, 353, 660, 29925, 26456, 580, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 5907, 29892, 660, 3306, 29898, 29945, 29941, 29892, 29871, 29945, 29941, 29892, 29871, 29945, 29941, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 5907, 1626, 29892, 14705, 29889, 10921, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 5160, 29892, 660, 3306, 29898, 29906, 29945, 29892, 29871, 29906, 29945, 29892, 29871, 29906, 29945, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 2499, 725, 403, 5160, 29892, 660, 3306, 29898, 29945, 29941, 29892, 29871, 29945, 29941, 29892, 29871, 29945, 29941, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 12229, 29911, 666, 5160, 29892, 14705, 29889, 10921, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 12229, 29911, 666, 1626, 29892, 14705, 29889, 10921, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 1626, 29892, 14705, 29889, 10921, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 3125, 29892, 660, 3306, 29898, 29945, 29941, 29892, 29871, 29945, 29941, 29892, 29871, 29945, 29941, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 3125, 1626, 29892, 14705, 29889, 10921, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 29933, 1266, 1626, 29892, 14705, 29889, 1127, 29897, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 6595, 29892, 660, 3306, 29898, 29946, 29906, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29906, 29896, 29947, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 16382, 4366, 29892, 660, 3306, 29898, 29946, 29906, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29906, 29896, 29947, 876, 13, 1678, 6501, 29918, 29886, 26456, 29889, 842, 3306, 29898, 29984, 29925, 26456, 29889, 16382, 4366, 287, 1626, 29892, 14705, 29889, 8517, 29897, 13, 1678, 623, 29889, 842, 29925, 26456, 29898, 26031, 29918, 29886, 26456, 29897, 13, 1678, 623, 29889, 842, 5568, 10654, 703, 29984, 12229, 29911, 666, 426, 2927, 29901, 396, 17156, 600, 29936, 3239, 29899, 2780, 29901, 396, 29906, 29874, 29947, 29906, 1388, 29936, 5139, 29901, 29871, 29896, 1756, 7773, 4796, 29936, 500, 1159, 13, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 623, 353, 660, 4873, 29898, 9675, 29889, 19218, 29897, 13, 1678, 623, 29889, 842, 5568, 877, 29943, 3958, 1495, 13, 1678, 731, 29918, 26031, 29898, 932, 29897, 13, 1678, 429, 353, 2401, 580, 13, 1678, 10876, 29889, 13322, 29898, 932, 29889, 4258, 29918, 3101, 2 ]
wwwdccn/proceedings/migrations/0001_initial.py
lfpratik/dccnsys
16
191605
# Generated by Django 2.2.4 on 2019-10-01 15:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('submissions', '0006_auto_20190905_1746'), ('conferences', '0014_artifactdescriptor_mandatory'), ] operations = [ migrations.CreateModel( name='VolumeAssignment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('active', models.BooleanField(default=False)), ('proc_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='conferences.ProceedingType')), ('submission', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='submissions.Submission')), ('volume', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='conferences.ProceedingVolume')), ], ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29946, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29900, 29899, 29900, 29896, 29871, 29896, 29945, 29901, 29900, 29945, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 2847, 353, 5852, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 1491, 29885, 6847, 742, 525, 29900, 29900, 29900, 29953, 29918, 6921, 29918, 29906, 29900, 29896, 29929, 29900, 29929, 29900, 29945, 29918, 29896, 29955, 29946, 29953, 5477, 13, 4706, 6702, 535, 10662, 742, 525, 29900, 29900, 29896, 29946, 29918, 8813, 2783, 11709, 29918, 29885, 392, 7606, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 24679, 7900, 10194, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 4925, 742, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 8243, 13, 18884, 6702, 15439, 29918, 1853, 742, 4733, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 10490, 29918, 10074, 29892, 304, 2433, 535, 10662, 29889, 1184, 3947, 292, 1542, 1495, 511, 13, 18884, 6702, 1491, 6737, 742, 4733, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 1491, 29885, 6847, 29889, 4035, 6737, 1495, 511, 13, 18884, 6702, 24623, 742, 4733, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 10490, 29918, 10074, 29892, 304, 2433, 535, 10662, 29889, 1184, 3947, 292, 24679, 1495, 511, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
visualize_code_vec.py
sonoisa/code2vec
22
172361
<filename>visualize_code_vec.py import torch from tensorboardX import SummaryWriter vec_path = "./output/code.vec" writer = SummaryWriter() with open(vec_path, "r", encoding="utf-8") as f: labels = [] vectors = [] first = True for line in f.readlines(): if first: first = False continue line = line.strip(' \r\n\t') data = line.split("\t") word = data[0] vector = [float(x) for x in data[1].split(" ")] labels.append(word) vectors.append(vector) writer.add_embedding(torch.FloatTensor(vectors), metadata=labels)
[ 1, 529, 9507, 29958, 20119, 675, 29918, 401, 29918, 2003, 29889, 2272, 13, 5215, 4842, 305, 13, 3166, 12489, 3377, 29990, 1053, 6991, 5219, 10507, 13, 13, 2003, 29918, 2084, 353, 376, 6904, 4905, 29914, 401, 29889, 2003, 29908, 13, 13, 13236, 353, 6991, 5219, 10507, 580, 13, 13, 2541, 1722, 29898, 2003, 29918, 2084, 29892, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 13, 1678, 11073, 353, 5159, 13, 1678, 12047, 353, 5159, 13, 1678, 937, 353, 5852, 13, 1678, 363, 1196, 297, 285, 29889, 949, 9012, 7295, 13, 4706, 565, 937, 29901, 13, 9651, 937, 353, 7700, 13, 9651, 6773, 13, 4706, 1196, 353, 1196, 29889, 17010, 877, 320, 29878, 29905, 29876, 29905, 29873, 1495, 13, 4706, 848, 353, 1196, 29889, 5451, 14182, 29873, 1159, 13, 4706, 1734, 353, 848, 29961, 29900, 29962, 13, 4706, 4608, 353, 518, 7411, 29898, 29916, 29897, 363, 921, 297, 848, 29961, 29896, 1822, 5451, 703, 376, 4638, 13, 4706, 11073, 29889, 4397, 29898, 1742, 29897, 13, 4706, 12047, 29889, 4397, 29898, 8111, 29897, 13, 13, 13236, 29889, 1202, 29918, 17987, 8497, 29898, 7345, 305, 29889, 11031, 29911, 6073, 29898, 345, 14359, 511, 15562, 29922, 21134, 29897, 13, 2 ]
fastestimator/backend/cast.py
hanskrupakar/fastestimator
57
68066
# Copyright 2019 The FastEstimator 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. # ============================================================================== from typing import Collection, TypeVar, Union import numpy as np import tensorflow as tf import torch from fastestimator.util.util import STRING_TO_TF_DTYPE, STRING_TO_TORCH_DTYPE Tensor = TypeVar('Tensor', tf.Tensor, torch.Tensor, np.ndarray) def cast(data: Union[Collection, Tensor], dtype: str) -> Union[Collection, Tensor]: """Cast the data to a specific data type recursively. This method can be used with Numpy data: ```python data = {"x": np.ones((10,15)), "y":[np.ones((4)), np.ones((5, 3))], "z":{"key":np.ones((2,2))}} fe.backend.to_type(data) # {'x': dtype('float64'), 'y': [dtype('float64'), dtype('float64')], 'z': {'key': dtype('float64')}} data = fe.backend.cast(data, "float16") fe.backend.to_type(data) # {'x': dtype('float16'), 'y': [dtype('float16'), dtype('float16')], 'z': {'key': dtype('float16')}} ``` This method can be used with TensorFlow tensors: ```python data = {"x": tf.ones((10,15)), "y":[tf.ones((4)), tf.ones((5, 3))], "z":{"key":tf.ones((2,2))}} fe.backend.to_type(data) # {'x': tf.float32, 'y': [tf.float32, tf.float32], 'z': {'key': tf.float32}} data = fe.backend.cast(data, "uint8") fe.backend.to_type(data) # {'x': tf.uint8, 'y': [tf.uint8, tf.uint8], 'z': {'key': tf.uint8}} ``` This method can be used with PyTorch tensors: ```python data = {"x": torch.ones((10,15)), "y":[torch.ones((4)), torch.ones((5, 3))], "z":{"key":torch.ones((2,2))}} fe.backend.to_type(data) # {'x': torch.float32, 'y': [torch.float32, torch.float32], 'z': {'key': torch.float32}} data = fe.backend.cast(data, "float64") fe.backend.to_type(data) # {'x': torch.float64, 'y': [torch.float64, torch.float64], 'z': {'key': torch.float64}} ``` Args: data: A tensor or possibly nested collection of tensors. dtype: Target data type, can be one of following: uint8, int8, int16, int32, int64, float16, float32, float64. Returns: A collection with the same structure as `data` with target data type. """ if isinstance(data, dict): return {key: cast(value, dtype) for (key, value) in data.items()} elif isinstance(data, list): return [cast(val, dtype) for val in data] elif isinstance(data, tuple): return tuple([cast(val, dtype) for val in data]) elif isinstance(data, set): return set([cast(val, dtype) for val in data]) elif tf.is_tensor(data): return tf.cast(data, STRING_TO_TF_DTYPE[dtype]) elif isinstance(data, torch.Tensor): return data.type(STRING_TO_TORCH_DTYPE[dtype]) else: return np.array(data, dtype=dtype)
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 450, 23786, 12787, 326, 1061, 13189, 943, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 13, 3166, 19229, 1053, 14348, 29892, 5167, 9037, 29892, 7761, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 5215, 4842, 305, 13, 13, 3166, 5172, 342, 326, 1061, 29889, 4422, 29889, 4422, 1053, 29486, 4214, 29918, 4986, 29918, 8969, 29918, 29928, 11116, 29892, 29486, 4214, 29918, 4986, 29918, 29911, 1955, 3210, 29918, 29928, 11116, 13, 13, 29911, 6073, 353, 5167, 9037, 877, 29911, 6073, 742, 15886, 29889, 29911, 6073, 29892, 4842, 305, 29889, 29911, 6073, 29892, 7442, 29889, 299, 2378, 29897, 13, 13, 13, 1753, 4320, 29898, 1272, 29901, 7761, 29961, 7196, 29892, 323, 6073, 1402, 26688, 29901, 851, 29897, 1599, 7761, 29961, 7196, 29892, 323, 6073, 5387, 13, 1678, 9995, 15738, 278, 848, 304, 263, 2702, 848, 1134, 8304, 3598, 29889, 13, 13, 259, 910, 1158, 508, 367, 1304, 411, 11848, 2272, 848, 29901, 13, 1678, 7521, 4691, 13, 1678, 848, 353, 8853, 29916, 1115, 7442, 29889, 2873, 3552, 29896, 29900, 29892, 29896, 29945, 8243, 376, 29891, 1115, 29961, 9302, 29889, 2873, 3552, 29946, 8243, 7442, 29889, 2873, 3552, 29945, 29892, 29871, 29941, 876, 1402, 376, 29920, 28819, 1989, 1115, 9302, 29889, 2873, 3552, 29906, 29892, 29906, 876, 930, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 13, 1678, 396, 11117, 29916, 2396, 26688, 877, 7411, 29953, 29946, 5477, 525, 29891, 2396, 518, 29881, 1853, 877, 7411, 29953, 29946, 5477, 26688, 877, 7411, 29953, 29946, 1495, 1402, 525, 29920, 2396, 11117, 1989, 2396, 26688, 877, 7411, 29953, 29946, 1495, 930, 13, 1678, 848, 353, 1238, 29889, 27852, 29889, 4384, 29898, 1272, 29892, 376, 7411, 29896, 29953, 1159, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 13, 1678, 396, 11117, 29916, 2396, 26688, 877, 7411, 29896, 29953, 5477, 525, 29891, 2396, 518, 29881, 1853, 877, 7411, 29896, 29953, 5477, 26688, 877, 7411, 29896, 29953, 1495, 1402, 525, 29920, 2396, 11117, 1989, 2396, 26688, 877, 7411, 29896, 29953, 1495, 930, 13, 1678, 7521, 13, 13, 1678, 910, 1158, 508, 367, 1304, 411, 323, 6073, 17907, 25187, 943, 29901, 13, 1678, 7521, 4691, 13, 1678, 848, 353, 8853, 29916, 1115, 15886, 29889, 2873, 3552, 29896, 29900, 29892, 29896, 29945, 8243, 376, 29891, 1115, 29961, 13264, 29889, 2873, 3552, 29946, 8243, 15886, 29889, 2873, 3552, 29945, 29892, 29871, 29941, 876, 1402, 376, 29920, 28819, 1989, 1115, 13264, 29889, 2873, 3552, 29906, 29892, 29906, 876, 930, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 396, 11117, 29916, 2396, 15886, 29889, 7411, 29941, 29906, 29892, 525, 29891, 2396, 518, 13264, 29889, 7411, 29941, 29906, 29892, 15886, 29889, 7411, 29941, 29906, 1402, 525, 29920, 2396, 11117, 1989, 2396, 15886, 29889, 7411, 29941, 29906, 930, 13, 1678, 848, 353, 1238, 29889, 27852, 29889, 4384, 29898, 1272, 29892, 376, 13470, 29947, 1159, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 396, 11117, 29916, 2396, 15886, 29889, 13470, 29947, 29892, 525, 29891, 2396, 518, 13264, 29889, 13470, 29947, 29892, 15886, 29889, 13470, 29947, 1402, 525, 29920, 2396, 11117, 1989, 2396, 15886, 29889, 13470, 29947, 930, 13, 1678, 7521, 13, 13, 1678, 910, 1158, 508, 367, 1304, 411, 10772, 29911, 25350, 25187, 943, 29901, 13, 1678, 7521, 4691, 13, 1678, 848, 353, 8853, 29916, 1115, 4842, 305, 29889, 2873, 3552, 29896, 29900, 29892, 29896, 29945, 8243, 376, 29891, 1115, 29961, 7345, 305, 29889, 2873, 3552, 29946, 8243, 4842, 305, 29889, 2873, 3552, 29945, 29892, 29871, 29941, 876, 1402, 376, 29920, 28819, 1989, 1115, 7345, 305, 29889, 2873, 3552, 29906, 29892, 29906, 876, 930, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 396, 11117, 29916, 2396, 4842, 305, 29889, 7411, 29941, 29906, 29892, 525, 29891, 2396, 518, 7345, 305, 29889, 7411, 29941, 29906, 29892, 4842, 305, 29889, 7411, 29941, 29906, 1402, 525, 29920, 2396, 11117, 1989, 2396, 4842, 305, 29889, 7411, 29941, 29906, 930, 13, 1678, 848, 353, 1238, 29889, 27852, 29889, 4384, 29898, 1272, 29892, 376, 7411, 29953, 29946, 1159, 13, 1678, 1238, 29889, 27852, 29889, 517, 29918, 1853, 29898, 1272, 29897, 396, 11117, 29916, 2396, 4842, 305, 29889, 7411, 29953, 29946, 29892, 525, 29891, 2396, 518, 7345, 305, 29889, 7411, 29953, 29946, 29892, 4842, 305, 29889, 7411, 29953, 29946, 1402, 525, 29920, 2396, 11117, 1989, 2396, 4842, 305, 29889, 7411, 29953, 29946, 930, 13, 1678, 7521, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 848, 29901, 319, 12489, 470, 10075, 9322, 4333, 310, 25187, 943, 29889, 13, 4706, 26688, 29901, 17157, 848, 1134, 29892, 508, 367, 697, 310, 1494, 29901, 13122, 29947, 29892, 938, 29947, 29892, 938, 29896, 29953, 29892, 938, 29941, 29906, 29892, 938, 29953, 29946, 29892, 5785, 29896, 29953, 29892, 5785, 29941, 29906, 29892, 5785, 29953, 29946, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 319, 4333, 411, 278, 1021, 3829, 408, 421, 1272, 29952, 411, 3646, 848, 1134, 29889, 13, 1678, 9995, 13, 1678, 565, 338, 8758, 29898, 1272, 29892, 9657, 1125, 13, 4706, 736, 426, 1989, 29901, 4320, 29898, 1767, 29892, 26688, 29897, 363, 313, 1989, 29892, 995, 29897, 297, 848, 29889, 7076, 28296, 13, 1678, 25342, 338, 8758, 29898, 1272, 29892, 1051, 1125, 13, 4706, 736, 518, 4384, 29898, 791, 29892, 26688, 29897, 363, 659, 297, 848, 29962, 13, 1678, 25342, 338, 8758, 29898, 1272, 29892, 18761, 1125, 13, 4706, 736, 18761, 4197, 4384, 29898, 791, 29892, 26688, 29897, 363, 659, 297, 848, 2314, 13, 1678, 25342, 338, 8758, 29898, 1272, 29892, 731, 1125, 13, 4706, 736, 731, 4197, 4384, 29898, 791, 29892, 26688, 29897, 363, 659, 297, 848, 2314, 13, 1678, 25342, 15886, 29889, 275, 29918, 20158, 29898, 1272, 1125, 13, 4706, 736, 15886, 29889, 4384, 29898, 1272, 29892, 29486, 4214, 29918, 4986, 29918, 8969, 29918, 29928, 11116, 29961, 29881, 1853, 2314, 13, 1678, 25342, 338, 8758, 29898, 1272, 29892, 4842, 305, 29889, 29911, 6073, 1125, 13, 4706, 736, 848, 29889, 1853, 29898, 20785, 29918, 4986, 29918, 29911, 1955, 3210, 29918, 29928, 11116, 29961, 29881, 1853, 2314, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 2378, 29898, 1272, 29892, 26688, 29922, 29881, 1853, 29897, 13, 2 ]
amp_reconstruct_betterRes.py
kseetharam/genPolaron
0
100273
<filename>amp_reconstruct_betterRes.py<gh_stars>0 import numpy as np import xarray as xr import pf_dynamic_sph as pfs from timeit import default_timer as timer import time import os # import matplotlib # import matplotlib.pyplot as plt if __name__ == "__main__": # ---- INITIALIZE GRIDS ---- (Lx, Ly, Lz) = (60, 60, 60) (dx, dy, dz) = (0.25, 0.25, 0.25) higherCutoff = False; cutoffRat = 1.0 betterResolution = True; resRat = 0.5 # (Lx, Ly, Lz) = (21, 21, 21) # (dx, dy, dz) = (0.375, 0.375, 0.375) # higherCutoff = False; cutoffRat = 1.0 # betterResolution = False; resRat = 1.0 NGridPoints_cart = (1 + 2 * Lx / dx) * (1 + 2 * Ly / dy) * (1 + 2 * Lz / dz) print(NGridPoints_cart) # Toggle parameters toggleDict = {'Dynamics': 'real'} # ---- SET OUTPUT DATA FOLDER ---- mRat = 1.0 datapath = '/Users/kis/Dropbox/VariationalResearch/HarvardOdyssey/genPol_data/NGridPoints_{:.2E}'.format(NGridPoints_cart) if higherCutoff is True: datapath = datapath + '_cutoffRat_{:.2f}'.format(cutoffRat) if betterResolution is True: datapath = datapath + '_resRat_{:.2f}'.format(resRat) datapath = datapath + '/massRatio={:.1f}'.format(mRat) if toggleDict['Dynamics'] == 'real': innerdatapath = datapath + '/redyn' elif toggleDict['Dynamics'] == 'imaginary': innerdatapath = datapath + '/imdyn' innerdatapath = innerdatapath + '_spherical' interpdatapath = innerdatapath + '/interp' if os.path.isdir(interpdatapath) is False: os.mkdir(interpdatapath) # # Analysis of Total Dataset aIBi = -5 Pnorm_des = 4.0 # Pnorm_des = 3.0 # Pnorm_des = 2.067 # Pnorm_des = 1.8 # Pnorm_des = 1.4 # Pnorm_des = 1.34 # Pnorm_des = 1.28 # Pnorm_des = 1.04 # Pnorm_des = 1.22 # Pnorm_des = 1.1 # Pnorm_des = 0.8 # Pnorm_des = 0.52 qds = xr.open_dataset(innerdatapath + '/P_{:.3f}_aIBi_{:.2f}.nc'.format(Pnorm_des * 0.7926654595212022, aIBi)) n0 = qds.attrs['n0']; gBB = qds.attrs['gBB']; mI = qds.attrs['mI']; mB = qds.attrs['mB'] nu = np.sqrt(n0 * gBB / mB) mc = mI * nu P = qds.attrs['P'] qds_P = qds qds_P.coords['P'] = np.array(P) tVals = qds['tc'].values # print(tVals.size) # tVals = tVals[np.array([-1])] print(P, P / mc, mRat, aIBi) # print(tVals) # tind = 5 # t = tVals[tind] # import matplotlib.pyplot as plt # tVals_full = qds['t'].values # vImp_Vals = (P - qds['Pph'].values) / mc # fig, ax = plt.subplots() # ax.plot(tVals_full, vImp_Vals, 'b-') # ax.plot(tVals_full, np.ones(tVals_full.size), 'k--') # plt.show() for tind, t in enumerate(tVals): print(tind, t) # # FULL RECONSTRUCTION OF 3D CARTESIAN BETA_K FROM 2D SPHERICAL BETA_K (doing actual interpolation in 2D spherical instead of 3D nonlinear cartesian) CSAmp_ds = (qds_P['Real_CSAmp'] + 1j * qds_P['Imag_CSAmp']).sel(tc=t); CSAmp_ds.attrs = qds.attrs; CSAmp_ds.attrs['Nph'] = qds_P['Nph'].sel(t=t).values # Generate data # dkxL = 1e-2; dkyL = 1e-2; dkzL = 1e-2 # linDimList = [(2, 2)] dkxL = 5e-2; dkyL = 5e-2; dkzL = 5e-2 linDimList = [(10, 10)] for ldtup in linDimList: tupstart = timer() linDimMajor, linDimMinor = ldtup print('lDM: {0}, lDm: {1}'.format(linDimMajor, linDimMinor)) interp_ds = pfs.reconstructMomDists(CSAmp_ds, linDimMajor, linDimMinor, dkxL, dkyL, dkzL) interp_ds.to_netcdf(interpdatapath + '/InterpDat_P_{:.2f}_aIBi_{:.2f}_t_{:.2f}_lDM_{:.2f}_lDm_{:.2f}.nc'.format(P, aIBi, t, linDimMajor, linDimMinor)) tupend = timer() print('Total Time: {0}'.format(tupend - tupstart)) time.sleep(2) print('\n')
[ 1, 529, 9507, 29958, 1160, 29918, 276, 11433, 29918, 6878, 357, 1666, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12655, 408, 7442, 13, 5215, 921, 2378, 408, 921, 29878, 13, 5215, 282, 29888, 29918, 16626, 29918, 29879, 561, 408, 282, 5847, 13, 3166, 931, 277, 1053, 2322, 29918, 20404, 408, 12237, 13, 5215, 931, 13, 5215, 2897, 13, 29937, 1053, 22889, 13, 29937, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 396, 23250, 2672, 1806, 25758, 29902, 10721, 18016, 1367, 29903, 23250, 13, 13, 1678, 313, 29931, 29916, 29892, 8626, 29892, 365, 29920, 29897, 353, 313, 29953, 29900, 29892, 29871, 29953, 29900, 29892, 29871, 29953, 29900, 29897, 13, 1678, 313, 8235, 29892, 13475, 29892, 9275, 29897, 353, 313, 29900, 29889, 29906, 29945, 29892, 29871, 29900, 29889, 29906, 29945, 29892, 29871, 29900, 29889, 29906, 29945, 29897, 13, 1678, 6133, 29907, 329, 2696, 353, 7700, 29936, 5700, 2696, 29934, 271, 353, 29871, 29896, 29889, 29900, 13, 1678, 2253, 12375, 918, 353, 5852, 29936, 620, 29934, 271, 353, 29871, 29900, 29889, 29945, 13, 13, 1678, 396, 313, 29931, 29916, 29892, 8626, 29892, 365, 29920, 29897, 353, 313, 29906, 29896, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29896, 29897, 13, 1678, 396, 313, 8235, 29892, 13475, 29892, 9275, 29897, 353, 313, 29900, 29889, 29941, 29955, 29945, 29892, 29871, 29900, 29889, 29941, 29955, 29945, 29892, 29871, 29900, 29889, 29941, 29955, 29945, 29897, 13, 1678, 396, 6133, 29907, 329, 2696, 353, 7700, 29936, 5700, 2696, 29934, 271, 353, 29871, 29896, 29889, 29900, 13, 1678, 396, 2253, 12375, 918, 353, 7700, 29936, 620, 29934, 271, 353, 29871, 29896, 29889, 29900, 13, 13, 1678, 405, 5756, 20325, 29918, 13823, 353, 313, 29896, 718, 29871, 29906, 334, 365, 29916, 847, 15414, 29897, 334, 313, 29896, 718, 29871, 29906, 334, 8626, 847, 13475, 29897, 334, 313, 29896, 718, 29871, 29906, 334, 365, 29920, 847, 9275, 29897, 13, 13, 1678, 1596, 29898, 29940, 5756, 20325, 29918, 13823, 29897, 13, 13, 1678, 396, 323, 9804, 4128, 13, 13, 1678, 20429, 21533, 353, 11117, 29928, 2926, 1199, 2396, 525, 6370, 10827, 13, 13, 1678, 396, 23250, 11368, 19474, 12336, 360, 8254, 383, 5607, 8032, 23250, 13, 13, 1678, 286, 29934, 271, 353, 29871, 29896, 29889, 29900, 13, 13, 1678, 1418, 481, 493, 353, 8207, 5959, 29914, 29895, 275, 29914, 15063, 1884, 29914, 10444, 1288, 1666, 2842, 29914, 21972, 16927, 29949, 29881, 952, 7759, 29914, 1885, 7713, 29918, 1272, 29914, 29940, 5756, 20325, 648, 29901, 29889, 29906, 29923, 29913, 4286, 4830, 29898, 29940, 5756, 20325, 29918, 13823, 29897, 13, 13, 1678, 565, 6133, 29907, 329, 2696, 338, 5852, 29901, 13, 4706, 1418, 481, 493, 353, 1418, 481, 493, 718, 22868, 7582, 2696, 29934, 271, 648, 29901, 29889, 29906, 29888, 29913, 4286, 4830, 29898, 7582, 2696, 29934, 271, 29897, 13, 1678, 565, 2253, 12375, 918, 338, 5852, 29901, 13, 4706, 1418, 481, 493, 353, 1418, 481, 493, 718, 22868, 690, 29934, 271, 648, 29901, 29889, 29906, 29888, 29913, 4286, 4830, 29898, 690, 29934, 271, 29897, 13, 1678, 1418, 481, 493, 353, 1418, 481, 493, 718, 8207, 25379, 29934, 20819, 3790, 29901, 29889, 29896, 29888, 29913, 4286, 4830, 29898, 29885, 29934, 271, 29897, 13, 13, 1678, 565, 20429, 21533, 1839, 29928, 2926, 1199, 2033, 1275, 525, 6370, 2396, 13, 4706, 6426, 4130, 481, 493, 353, 1418, 481, 493, 718, 8207, 1127, 948, 29915, 13, 1678, 25342, 20429, 21533, 1839, 29928, 2926, 1199, 2033, 1275, 525, 326, 351, 3821, 2396, 13, 4706, 6426, 4130, 481, 493, 353, 1418, 481, 493, 718, 8207, 326, 29881, 948, 29915, 13, 1678, 6426, 4130, 481, 493, 353, 6426, 4130, 481, 493, 718, 22868, 29879, 8096, 936, 29915, 13, 13, 1678, 1006, 29886, 4130, 481, 493, 353, 6426, 4130, 481, 493, 718, 8207, 1639, 29886, 29915, 13, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 3972, 29898, 1639, 29886, 4130, 481, 493, 29897, 338, 7700, 29901, 13, 4706, 2897, 29889, 11256, 3972, 29898, 1639, 29886, 4130, 481, 493, 29897, 13, 13, 1678, 396, 396, 24352, 310, 14990, 13373, 24541, 13, 13, 1678, 263, 8979, 29875, 353, 448, 29945, 13, 13, 1678, 349, 12324, 29918, 2783, 353, 29871, 29946, 29889, 29900, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29941, 29889, 29900, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29906, 29889, 29900, 29953, 29955, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29947, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29946, 13, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29941, 29946, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29906, 29947, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29900, 29946, 13, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29906, 29906, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29896, 29889, 29896, 13, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29900, 29889, 29947, 13, 1678, 396, 349, 12324, 29918, 2783, 353, 29871, 29900, 29889, 29945, 29906, 13, 13, 1678, 3855, 6289, 353, 921, 29878, 29889, 3150, 29918, 24713, 29898, 3993, 4130, 481, 493, 718, 8207, 29925, 648, 29901, 29889, 29941, 29888, 2403, 29874, 8979, 29875, 648, 29901, 29889, 29906, 29888, 1836, 17608, 4286, 4830, 29898, 29925, 12324, 29918, 2783, 334, 29871, 29900, 29889, 29955, 29929, 29906, 29953, 29953, 29945, 29946, 29945, 29929, 29945, 29906, 29896, 29906, 29900, 29906, 29906, 29892, 263, 8979, 29875, 876, 13, 1678, 302, 29900, 353, 3855, 6289, 29889, 5552, 29879, 1839, 29876, 29900, 8219, 330, 14388, 353, 3855, 6289, 29889, 5552, 29879, 1839, 29887, 14388, 8219, 286, 29902, 353, 3855, 6289, 29889, 5552, 29879, 1839, 29885, 29902, 8219, 286, 29933, 353, 3855, 6289, 29889, 5552, 29879, 1839, 29885, 29933, 2033, 13, 1678, 4948, 353, 7442, 29889, 3676, 29898, 29876, 29900, 334, 330, 14388, 847, 286, 29933, 29897, 13, 1678, 286, 29883, 353, 286, 29902, 334, 4948, 13, 1678, 349, 353, 3855, 6289, 29889, 5552, 29879, 1839, 29925, 2033, 13, 1678, 3855, 6289, 29918, 29925, 353, 3855, 6289, 13, 1678, 3855, 6289, 29918, 29925, 29889, 1111, 4339, 1839, 29925, 2033, 353, 7442, 29889, 2378, 29898, 29925, 29897, 13, 1678, 260, 29963, 1338, 353, 3855, 6289, 1839, 14246, 13359, 5975, 13, 1678, 396, 1596, 29898, 29873, 29963, 1338, 29889, 2311, 29897, 13, 1678, 396, 260, 29963, 1338, 353, 260, 29963, 1338, 29961, 9302, 29889, 2378, 4197, 29899, 29896, 2314, 29962, 13, 13, 1678, 1596, 29898, 29925, 29892, 349, 847, 286, 29883, 29892, 286, 29934, 271, 29892, 263, 8979, 29875, 29897, 13, 1678, 396, 1596, 29898, 29873, 29963, 1338, 29897, 13, 1678, 396, 260, 513, 353, 29871, 29945, 13, 1678, 396, 260, 353, 260, 29963, 1338, 29961, 29873, 513, 29962, 13, 13, 1678, 396, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 1678, 396, 260, 29963, 1338, 29918, 8159, 353, 3855, 6289, 1839, 29873, 13359, 5975, 13, 1678, 396, 325, 24192, 29918, 29963, 1338, 353, 313, 29925, 448, 3855, 6289, 1839, 29925, 561, 13359, 5975, 29897, 847, 286, 29883, 13, 1678, 396, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 580, 13, 1678, 396, 4853, 29889, 5317, 29898, 29873, 29963, 1338, 29918, 8159, 29892, 325, 24192, 29918, 29963, 1338, 29892, 525, 29890, 29899, 1495, 13, 1678, 396, 4853, 29889, 5317, 29898, 29873, 29963, 1338, 29918, 8159, 29892, 7442, 29889, 2873, 29898, 29873, 29963, 1338, 29918, 8159, 29889, 2311, 511, 525, 29895, 489, 1495, 13, 1678, 396, 14770, 29889, 4294, 580, 13, 13, 1678, 363, 260, 513, 29892, 260, 297, 26985, 29898, 29873, 29963, 1338, 1125, 13, 4706, 1596, 29898, 29873, 513, 29892, 260, 29897, 13, 4706, 396, 396, 383, 3299, 5195, 6007, 10810, 29965, 9838, 8079, 29871, 29941, 29928, 315, 8322, 2890, 29902, 2190, 350, 2544, 29909, 29918, 29968, 3895, 29871, 29906, 29928, 10937, 4448, 2965, 1964, 350, 2544, 29909, 29918, 29968, 313, 1867, 292, 3935, 29694, 297, 29871, 29906, 29928, 26903, 936, 2012, 310, 29871, 29941, 29928, 1661, 10660, 7774, 18970, 29897, 13, 13, 4706, 315, 8132, 1526, 29918, 6289, 353, 313, 29939, 6289, 29918, 29925, 1839, 21713, 29918, 29907, 8132, 1526, 2033, 718, 29871, 29896, 29926, 334, 3855, 6289, 29918, 29925, 1839, 1888, 351, 29918, 29907, 8132, 1526, 2033, 467, 2838, 29898, 14246, 29922, 29873, 416, 315, 8132, 1526, 29918, 6289, 29889, 5552, 29879, 353, 3855, 6289, 29889, 5552, 29879, 29936, 315, 8132, 1526, 29918, 6289, 29889, 5552, 29879, 1839, 29940, 561, 2033, 353, 3855, 6289, 29918, 29925, 1839, 29940, 561, 13359, 2838, 29898, 29873, 29922, 29873, 467, 5975, 13, 13, 4706, 396, 3251, 403, 848, 13, 13, 4706, 396, 270, 29895, 29916, 29931, 353, 29871, 29896, 29872, 29899, 29906, 29936, 270, 3459, 29931, 353, 29871, 29896, 29872, 29899, 29906, 29936, 270, 29895, 29920, 29931, 353, 29871, 29896, 29872, 29899, 29906, 13, 4706, 396, 6276, 16142, 1293, 353, 17288, 29906, 29892, 29871, 29906, 4638, 13, 13, 4706, 270, 29895, 29916, 29931, 353, 29871, 29945, 29872, 29899, 29906, 29936, 270, 3459, 29931, 353, 29871, 29945, 29872, 29899, 29906, 29936, 270, 29895, 29920, 29931, 353, 29871, 29945, 29872, 29899, 29906, 13, 4706, 6276, 16142, 1293, 353, 17288, 29896, 29900, 29892, 29871, 29896, 29900, 4638, 13, 13, 4706, 363, 301, 6008, 786, 297, 6276, 16142, 1293, 29901, 13, 9651, 260, 786, 2962, 353, 12237, 580, 13, 9651, 6276, 16142, 29924, 1175, 272, 29892, 6276, 16142, 8140, 272, 353, 301, 6008, 786, 13, 9651, 1596, 877, 29880, 23560, 29901, 426, 29900, 1118, 301, 29928, 29885, 29901, 426, 29896, 29913, 4286, 4830, 29898, 1915, 16142, 29924, 1175, 272, 29892, 6276, 16142, 8140, 272, 876, 13, 9651, 1006, 29886, 29918, 6289, 353, 282, 5847, 29889, 276, 11433, 29924, 290, 29928, 2879, 29898, 29907, 8132, 1526, 29918, 6289, 29892, 6276, 16142, 29924, 1175, 272, 29892, 6276, 16142, 8140, 272, 29892, 270, 29895, 29916, 29931, 29892, 270, 3459, 29931, 29892, 270, 29895, 29920, 29931, 29897, 13, 9651, 1006, 29886, 29918, 6289, 29889, 517, 29918, 1212, 29883, 2176, 29898, 1639, 29886, 4130, 481, 493, 718, 8207, 4074, 29886, 16390, 29918, 29925, 648, 29901, 29889, 29906, 29888, 2403, 29874, 8979, 29875, 648, 29901, 29889, 29906, 29888, 2403, 29873, 648, 29901, 29889, 29906, 29888, 2403, 29880, 23560, 648, 29901, 29889, 29906, 29888, 2403, 29880, 29928, 29885, 648, 29901, 29889, 29906, 29888, 1836, 17608, 4286, 4830, 29898, 29925, 29892, 263, 8979, 29875, 29892, 260, 29892, 6276, 16142, 29924, 1175, 272, 29892, 6276, 16142, 8140, 272, 876, 13, 9651, 260, 786, 355, 353, 12237, 580, 13, 9651, 1596, 877, 11536, 5974, 29901, 426, 29900, 29913, 4286, 4830, 29898, 29873, 786, 355, 448, 260, 786, 2962, 876, 13, 9651, 931, 29889, 17059, 29898, 29906, 29897, 13, 9651, 1596, 28909, 29876, 1495, 13, 2 ]
algorithms/maths/chinese_remainder_theorem.py
hbqdev/algorithms
22,426
7072
<reponame>hbqdev/algorithms<filename>algorithms/maths/chinese_remainder_theorem.py from algorithms.maths.gcd import gcd from typing import List def solve_chinese_remainder(num : List[int], rem : List[int]): """ Computes the smallest x that satisfies the chinese remainder theorem for a system of equations. The system of equations has the form: x % num[0] = rem[0] x % num[1] = rem[1] ... x % num[k - 1] = rem[k - 1] Where k is the number of elements in num and rem, k > 0. All numbers in num needs to be pariwise coprime otherwise an exception is raised returns x: the smallest value for x that satisfies the system of equations """ if not len(num) == len(rem): raise Exception("num and rem should have equal length") if not len(num) > 0: raise Exception("Lists num and rem need to contain at least one element") for n in num: if not n > 1: raise Exception("All numbers in num needs to be > 1") if not _check_coprime(num): raise Exception("All pairs of numbers in num are not coprime") k = len(num) x = 1 while True: i = 0 while i < k: if x % num[i] != rem[i]: break i += 1 if i == k: return x else: x += 1 def _check_coprime(l : List[int]): for i in range(len(l)): for j in range(len(l)): if i == j: continue if gcd(l[i], l[j]) != 1: return False return True
[ 1, 529, 276, 1112, 420, 29958, 29882, 29890, 29939, 3359, 29914, 9564, 12404, 29966, 9507, 29958, 9564, 12404, 29914, 755, 29879, 29914, 305, 8233, 29918, 1745, 475, 672, 29918, 14648, 29889, 2272, 13, 3166, 14009, 29889, 755, 29879, 29889, 29887, 2252, 1053, 330, 2252, 13, 3166, 19229, 1053, 2391, 13, 13, 1753, 4505, 29918, 305, 8233, 29918, 1745, 475, 672, 29898, 1949, 584, 2391, 29961, 524, 1402, 1083, 584, 2391, 29961, 524, 29962, 1125, 13, 1678, 9995, 13, 1678, 11796, 267, 278, 19087, 921, 393, 17150, 278, 521, 8233, 21162, 9185, 13, 1678, 363, 263, 1788, 310, 10693, 29889, 13, 1678, 450, 1788, 310, 10693, 756, 278, 883, 29901, 13, 1678, 921, 1273, 954, 29961, 29900, 29962, 353, 1083, 29961, 29900, 29962, 13, 1678, 921, 1273, 954, 29961, 29896, 29962, 353, 1083, 29961, 29896, 29962, 13, 1678, 2023, 13, 1678, 921, 1273, 954, 29961, 29895, 448, 29871, 29896, 29962, 353, 1083, 29961, 29895, 448, 29871, 29896, 29962, 13, 1678, 6804, 413, 338, 278, 1353, 310, 3161, 297, 954, 322, 1083, 29892, 413, 1405, 29871, 29900, 29889, 13, 1678, 2178, 3694, 297, 954, 4225, 304, 367, 610, 29875, 3538, 5614, 29878, 603, 6467, 385, 3682, 338, 10425, 13, 1678, 3639, 921, 29901, 278, 19087, 995, 363, 921, 393, 17150, 278, 1788, 310, 10693, 13, 1678, 9995, 13, 1678, 565, 451, 7431, 29898, 1949, 29897, 1275, 7431, 29898, 1745, 1125, 13, 4706, 12020, 8960, 703, 1949, 322, 1083, 881, 505, 5186, 3309, 1159, 13, 1678, 565, 451, 7431, 29898, 1949, 29897, 1405, 29871, 29900, 29901, 13, 4706, 12020, 8960, 703, 1293, 29879, 954, 322, 1083, 817, 304, 1712, 472, 3203, 697, 1543, 1159, 13, 1678, 363, 302, 297, 954, 29901, 13, 4706, 565, 451, 302, 1405, 29871, 29896, 29901, 13, 9651, 12020, 8960, 703, 3596, 3694, 297, 954, 4225, 304, 367, 1405, 29871, 29896, 1159, 13, 1678, 565, 451, 903, 3198, 29918, 9708, 29878, 603, 29898, 1949, 1125, 13, 4706, 12020, 8960, 703, 3596, 11000, 310, 3694, 297, 954, 526, 451, 5614, 29878, 603, 1159, 13, 1678, 413, 353, 7431, 29898, 1949, 29897, 13, 1678, 921, 353, 29871, 29896, 13, 1678, 1550, 5852, 29901, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 1550, 474, 529, 413, 29901, 13, 9651, 565, 921, 1273, 954, 29961, 29875, 29962, 2804, 1083, 29961, 29875, 5387, 13, 18884, 2867, 13, 9651, 474, 4619, 29871, 29896, 13, 4706, 565, 474, 1275, 413, 29901, 13, 9651, 736, 921, 13, 4706, 1683, 29901, 13, 9651, 921, 4619, 29871, 29896, 13, 13, 1753, 903, 3198, 29918, 9708, 29878, 603, 29898, 29880, 584, 2391, 29961, 524, 29962, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29880, 22164, 13, 4706, 363, 432, 297, 3464, 29898, 2435, 29898, 29880, 22164, 13, 9651, 565, 474, 1275, 432, 29901, 13, 18884, 6773, 13, 9651, 565, 330, 2252, 29898, 29880, 29961, 29875, 1402, 301, 29961, 29926, 2314, 2804, 29871, 29896, 29901, 13, 18884, 736, 7700, 13, 1678, 736, 5852, 13, 2 ]
subcommands/play_category.py
brunomateus/open_source_android_apps
2
93199
"""Scrape Google Play category data from Google Play.""" import argparse import json import logging import os from lxml.html import html5parser import requests from util.parse import parse_package_details __log__ = logging.getLogger(__name__) PLAY_STORE_LINK = 'https://play.google.com/store/apps/details?id={}' CATEGORY_DIR = 'categories' HEADERS = { 'Accept-Language': 'en,en-GB;q=0.8,en-US;q=0.7,de;q=0.5,de-DE;q=0.3,nl;q=0.2' } def get_play_page(package_name): url = PLAY_STORE_LINK.format(package_name) __log__.info('Request %s', url) return requests.get(url, headers=HEADERS) def find_category_string(html_text): parser = html5parser.fromstring(html_text) try: category_link = parser.cssselect('.category')[0] category_span = category_link.cssselect('[itemprop=genre]')[0] return category_span.text except IndexError as e: __log__.exception('Cannot match category in HTML') return None def write_category_file(package_name, category, details_dir): category_path = os.path.join(details_dir, CATEGORY_DIR) os.makedirs(category_path, exist_ok=True) file_name = '{}.json'.format(package_name) file_path = os.path.join(category_path, file_name) with open(file_path, 'w') as json_file: json.dump({ 'packageName': package_name, 'appCategory': category }, json_file) __log__.info('Wrote %s', file_path) def define_cmdline_arguments(parser: argparse.ArgumentParser): """Add arguments to parser.""" parser.add_argument( 'PLAY_STORE_DETAILS_DIR', type=str, help='Directory containing JSON files with details from Google Play.') parser.set_defaults(func=_main) def _main(args): """Pass arguments to respective function.""" __log__.info('------- Arguments: -------') __log__.info('PLAY_STORE_DETAILS_DIR: %s', args.PLAY_STORE_DETAILS_DIR) for package_name, _ in parse_package_details(args.PLAY_STORE_DETAILS_DIR): response = get_play_page(package_name) category = find_category_string(response.text) if not category: continue __log__.info('Found category "%s" for %s', category, package_name) write_category_file(package_name, category, args.PLAY_STORE_DETAILS_DIR)
[ 1, 9995, 4421, 336, 412, 5087, 7412, 7663, 848, 515, 5087, 7412, 1213, 15945, 13, 13, 5215, 1852, 5510, 13, 5215, 4390, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 3166, 301, 3134, 29889, 1420, 1053, 3472, 29945, 16680, 13, 5215, 7274, 13, 13, 3166, 3667, 29889, 5510, 1053, 6088, 29918, 5113, 29918, 14144, 13, 13, 13, 1649, 1188, 1649, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 23714, 29968, 353, 525, 991, 597, 1456, 29889, 3608, 29889, 510, 29914, 8899, 29914, 13371, 29914, 14144, 29973, 333, 3790, 10162, 13, 29907, 3040, 29954, 18929, 29918, 9464, 353, 525, 20683, 29915, 13, 23252, 23598, 353, 426, 13, 1678, 525, 23965, 29899, 21233, 2396, 525, 264, 29892, 264, 29899, 7210, 29936, 29939, 29922, 29900, 29889, 29947, 29892, 264, 29899, 3308, 29936, 29939, 29922, 29900, 29889, 29955, 29892, 311, 29936, 29939, 29922, 29900, 29889, 29945, 29892, 311, 29899, 2287, 29936, 29939, 29922, 29900, 29889, 29941, 29892, 12938, 29936, 29939, 29922, 29900, 29889, 29906, 29915, 13, 1678, 500, 13, 13, 13, 1753, 679, 29918, 1456, 29918, 3488, 29898, 5113, 29918, 978, 1125, 13, 1678, 3142, 353, 349, 18799, 29918, 1254, 29949, 1525, 29918, 23714, 29968, 29889, 4830, 29898, 5113, 29918, 978, 29897, 13, 1678, 4770, 1188, 26914, 3888, 877, 3089, 1273, 29879, 742, 3142, 29897, 13, 1678, 736, 7274, 29889, 657, 29898, 2271, 29892, 9066, 29922, 23252, 23598, 29897, 13, 13, 13, 1753, 1284, 29918, 7320, 29918, 1807, 29898, 1420, 29918, 726, 1125, 13, 1678, 13812, 353, 3472, 29945, 16680, 29889, 3166, 1807, 29898, 1420, 29918, 726, 29897, 13, 1678, 1018, 29901, 13, 4706, 7663, 29918, 2324, 353, 13812, 29889, 4268, 2622, 12839, 7320, 29861, 29900, 29962, 13, 4706, 7663, 29918, 9653, 353, 7663, 29918, 2324, 29889, 4268, 2622, 877, 29961, 667, 7728, 29922, 1885, 276, 29962, 29861, 29900, 29962, 13, 4706, 736, 7663, 29918, 9653, 29889, 726, 13, 1678, 5174, 11374, 2392, 408, 321, 29901, 13, 4706, 4770, 1188, 26914, 11739, 877, 29089, 1993, 7663, 297, 4544, 1495, 13, 4706, 736, 6213, 13, 13, 13, 1753, 2436, 29918, 7320, 29918, 1445, 29898, 5113, 29918, 978, 29892, 7663, 29892, 4902, 29918, 3972, 1125, 13, 1678, 7663, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 14144, 29918, 3972, 29892, 315, 3040, 29954, 18929, 29918, 9464, 29897, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 7320, 29918, 2084, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 934, 29918, 978, 353, 22372, 1836, 3126, 4286, 4830, 29898, 5113, 29918, 978, 29897, 13, 1678, 934, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7320, 29918, 2084, 29892, 934, 29918, 978, 29897, 13, 1678, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29893, 1495, 408, 4390, 29918, 1445, 29901, 13, 4706, 4390, 29889, 15070, 3319, 13, 9651, 525, 5113, 1170, 2396, 3577, 29918, 978, 29892, 13, 9651, 525, 932, 10900, 2396, 7663, 13, 9651, 2981, 4390, 29918, 1445, 29897, 13, 1678, 4770, 1188, 26914, 3888, 877, 29956, 4859, 1273, 29879, 742, 934, 29918, 2084, 29897, 13, 13, 13, 1753, 4529, 29918, 9006, 1220, 29918, 25699, 29898, 16680, 29901, 1852, 5510, 29889, 15730, 11726, 1125, 13, 1678, 9995, 2528, 6273, 304, 13812, 1213, 15945, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 525, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 2287, 6040, 6227, 29903, 29918, 9464, 742, 1134, 29922, 710, 29892, 13, 4706, 1371, 2433, 9882, 6943, 4663, 2066, 411, 4902, 515, 5087, 7412, 29889, 1495, 13, 1678, 13812, 29889, 842, 29918, 4381, 29879, 29898, 9891, 29922, 29918, 3396, 29897, 13, 13, 13, 1753, 903, 3396, 29898, 5085, 1125, 13, 1678, 9995, 7129, 6273, 304, 18067, 740, 1213, 15945, 13, 1678, 4770, 1188, 26914, 3888, 877, 26589, 11842, 9331, 29901, 448, 22158, 1495, 13, 1678, 4770, 1188, 26914, 3888, 877, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 2287, 6040, 6227, 29903, 29918, 9464, 29901, 1273, 29879, 742, 6389, 29889, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 2287, 6040, 6227, 29903, 29918, 9464, 29897, 13, 13, 1678, 363, 3577, 29918, 978, 29892, 903, 297, 6088, 29918, 5113, 29918, 14144, 29898, 5085, 29889, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 2287, 6040, 6227, 29903, 29918, 9464, 1125, 13, 4706, 2933, 353, 679, 29918, 1456, 29918, 3488, 29898, 5113, 29918, 978, 29897, 13, 4706, 7663, 353, 1284, 29918, 7320, 29918, 1807, 29898, 5327, 29889, 726, 29897, 13, 4706, 565, 451, 7663, 29901, 13, 9651, 6773, 13, 4706, 4770, 1188, 26914, 3888, 877, 9692, 7663, 11860, 29879, 29908, 363, 1273, 29879, 742, 7663, 29892, 3577, 29918, 978, 29897, 13, 4706, 2436, 29918, 7320, 29918, 1445, 29898, 5113, 29918, 978, 29892, 7663, 29892, 6389, 29889, 29925, 18799, 29918, 1254, 29949, 1525, 29918, 2287, 6040, 6227, 29903, 29918, 9464, 29897, 13, 2 ]
Freshmen.bundle/Contents/Code/__init__.py
OmicronTheta/pgma
0
76223
<reponame>OmicronTheta/pgma # Freshmen.net Plex Agent import re, os, platform, urllib from difflib import SequenceMatcher #Fix HTTPS errors when connecting to Facebox (neural.vigue.me) and Thumbor CDN (cdn.vigue.me) import certifi import requests PLUGIN_LOG_TITLE = 'Freshmen' # Log Title VERSION_NO = '2019.03.11.1' # Delay used when requesting HTML, may be good to have to prevent being # banned from the site REQUEST_DELAY = 0 # URLS BASE_URL = 'https://www.freshmen.net%s' # Example Video Details URL # https://www.helixstudios.net/video/3437/hosing-him-down.html BASE_VIDEO_DETAILS_URL = 'https://www.freshmen.net/content/%s' # Example Search URL: # https://www.helixstudios.net/videos/?q=Hosing+Him+Down BASE_SEARCH_URL = 'https://www.freshmen.net/search?q=%s' # File names to match for this agent file_name_pattern = re.compile(Prefs['regex']) # Example File Name: # https://media.helixstudios.com/scenes/hx111_scene2/hx111_scene2_member_1080p.mp4 # FILENAME_PATTERN = re.compile("") # TITLE_PATTERN = re.compile("") def Start(): HTTP.CacheTime = CACHE_1WEEK HTTP.Headers['User-agent'] = 'Mozilla/4.0 (compatible; MSIE 8.0; ' \ 'Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; ' \ '.NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)' class Freshmen(Agent.Movies): name = 'Freshmen' languages = [Locale.Language.NoLanguage, Locale.Language.English] primary_provider = False fallback_agent = ['com.plexapp.agents.gayporncollector'] contributes_to = ['com.plexapp.agents.cockporn'] def Log(self, message, *args): if Prefs['debug']: Log(PLUGIN_LOG_TITLE + ' - ' + message, *args) def intTest(self, s): try: int(s) return int(s) except ValueError: return False def similar(self, a, b): return SequenceMatcher(None, a, b).ratio() def search(self, results, media, lang, manual): self.Log('-----------------------------------------------------------------------') self.Log('SEARCH CALLED v.%s', VERSION_NO) self.Log('SEARCH - Platform: %s %s', platform.system(), platform.release()) self.Log('SEARCH - media.title - %s', media.title) self.Log('SEARCH - media.items[0].parts[0].file - %s', media.items[0].parts[0].file) self.Log('SEARCH - media.primary_metadata.title - %s', media.primary_metadata.title) self.Log('SEARCH - media.items - %s', media.items) self.Log('SEARCH - media.filename - %s', media.filename) self.Log('SEARCH - lang - %s', lang) self.Log('SEARCH - manual - %s', manual) self.Log('SEARCH - Prefs->cover - %s', Prefs['cover']) self.Log('SEARCH - Prefs->folders - %s', Prefs['folders']) self.Log('SEARCH - Prefs->regex - %s', Prefs['regex']) if not media.items[0].parts[0].file: return path_and_file = media.items[0].parts[0].file.lower() self.Log('SEARCH - File Path: %s', path_and_file) (file_dir, basename) = os.path.split(os.path.splitext(path_and_file)[0]) final_dir = os.path.split(file_dir)[1] self.Log('SEARCH - Enclosing Folder: %s', final_dir) if Prefs['folders'] != "*": folder_list = re.split(',\s*', Prefs['folders'].lower()) if final_dir not in folder_list: self.Log('SEARCH - Skipping %s because the folder %s is not in the acceptable folders list: %s', basename, final_dir, ','.join(folder_list)) return m = file_name_pattern.search(basename) if not m: self.Log('SEARCH - Skipping %s because the file name is not in the expected format.', basename) return self.Log('SEARCH - File Name: %s', basename) groups = m.groupdict() clip_name = groups['clip_name'] movie_url_name = re.sub('\s+', '+', clip_name) movie_url = BASE_VIDEO_DETAILS_URL % movie_url_name search_query_raw = list() for piece in clip_name.split(' '): if re.search('^[0-9A-Za-z]*$', piece.replace('!', '')) is not None: search_query_raw.append(piece) self.Log('SEARCH - Video URL: %s', movie_url) html = HTML.ElementFromURL(movie_url, sleep=REQUEST_DELAY) video_title = html.xpath('//*[@id="top"]/main/div/div/div[2]/div[2]/div[1]/div[1]/div/h1') results.Append(MetadataSearchResult(id = movie_url, name = video_title, score = 100, lang = lang)) def update(self, metadata, media, lang, force=False): self.Log('UPDATE CALLED') if not media.items[0].parts[0].file: return file_path = media.items[0].parts[0].file self.Log('UPDATE - File Path: %s', file_path) self.Log('UPDATE - Video URL: %s', metadata.id) url = metadata.id # Fetch HTML html = HTML.ElementFromURL(url, sleep=REQUEST_DELAY) # Set tagline to URL metadata.tagline = url titlelist = html.xpath('//div[@class="left"]/div/h1/span/text()') video_title = '' for titlepart in titlelist: video_title += str(titlepart) self.Log('UPDATE - video_title: "%s"', video_title) valid_image_names = list() i = 0 video_image_list = html.xpath('//*[@class="gallery article"]/a/img') try: coverPrefs = Prefs['cover'] for image in video_image_list: if i <= (self.intTest(coverPrefs)-1) or coverPrefs == "all available": i = i + 1 poster_url = image.get('src') valid_image_names.append(poster_url) #self.Log(poster_url) metadata.posters[poster_url]=Proxy.Media(HTTP.Request(poster_url), sort_order = i) except Exception as e: self.Log('UPDATE - Error getting posters: %s', e) pass # Try to get description text try: raw_about_text = html.xpath("//div[@class='left']/div[@class='more always-visible']/text()[2]")[0] if "a" not in raw_about_text: raw_about_text = html.xpath("//div[@class='left']/div[@class='more always-visible']/p/text()")[0] self.Log('UPDATE - Description: %s', raw_about_text) metadata.summary=raw_about_text except Exception as e: self.Log('UPDATE - Error getting description text: %s', e) pass # Try to get release date try: release_date=html.xpath('//*[@id="tab_comment"]/div[last()]/div[1]/text()')[1].split()[1]; self.Log('UPDATE - Release Date - New: %s', release_date) metadata.originally_available_at = Datetime.ParseDate(release_date).date() metadata.year = metadata.originally_available_at.year except Exception as e: self.Log('UPDATE - Error getting release date: %s', e) pass # Try to get and process the video cast try: metadata.roles.clear() rolethumbs = list(); actor_image_list = html.xpath('//div[@class="actor"]/*[@class="photo"]/img') for actor_image in actor_image_list: headshot_url_hi_res = actor_image.get('src'); rolethumbs.append(headshot_url_hi_res) htmlcast = html.xpath("//div[@class='actor']/div[@class='name']/text()") self.Log('UPDATE - cast: "%s"', htmlcast) index = 0 for cast in htmlcast: cname = cast.strip() if (len(cname) > 0): role = metadata.roles.new() role.name = cname role.photo = rolethumbs[index] index += 1 except Exception as e: self.Log('UPDATE - Error getting video cast: %s', e) pass # Try to get and process the video genres metadata.genres.add("Freshmen") metadata.collections.add("Freshmen") metadata.posters.validate_keys(valid_image_names) metadata.content_rating = 'X' metadata.title = video_title metadata.studio = "Freshmen"
[ 1, 529, 276, 1112, 420, 29958, 5673, 293, 1617, 17458, 29914, 4061, 655, 13, 29937, 383, 3781, 1527, 29889, 1212, 349, 2506, 28330, 13, 5215, 337, 29892, 2897, 29892, 7481, 29892, 3142, 1982, 13, 3166, 2923, 1982, 1053, 922, 3910, 9652, 261, 13, 13, 29937, 29943, 861, 7331, 29903, 4436, 746, 16791, 304, 10635, 1884, 313, 484, 3631, 29889, 29894, 12137, 29889, 1004, 29897, 322, 498, 3774, 272, 7307, 29940, 313, 13687, 29889, 29894, 12137, 29889, 1004, 29897, 13, 5215, 2284, 6832, 13, 5215, 7274, 13, 13, 13, 7390, 23338, 1177, 29918, 14480, 29918, 29911, 1806, 1307, 353, 525, 29943, 3781, 1527, 29915, 12, 29937, 4522, 18527, 13, 13, 16358, 29918, 6632, 353, 525, 29906, 29900, 29896, 29929, 29889, 29900, 29941, 29889, 29896, 29896, 29889, 29896, 29915, 13, 13, 29937, 5556, 388, 1304, 746, 2009, 292, 4544, 29892, 1122, 367, 1781, 304, 505, 304, 5557, 1641, 13, 29937, 289, 11310, 515, 278, 3268, 13, 16244, 29918, 2287, 18799, 353, 29871, 29900, 13, 13, 29937, 3988, 29903, 13, 25416, 29918, 4219, 353, 525, 991, 597, 1636, 29889, 29888, 3781, 1527, 29889, 1212, 29995, 29879, 29915, 13, 13, 29937, 8741, 13987, 25577, 3988, 13, 29937, 2045, 597, 1636, 29889, 3952, 861, 18082, 2363, 29889, 1212, 29914, 9641, 29914, 29941, 29946, 29941, 29955, 29914, 29882, 14556, 29899, 26994, 29899, 3204, 29889, 1420, 13, 25416, 29918, 13044, 29923, 29949, 29918, 2287, 6040, 6227, 29903, 29918, 4219, 353, 525, 991, 597, 1636, 29889, 29888, 3781, 1527, 29889, 1212, 29914, 3051, 22584, 29879, 29915, 13, 13, 29937, 8741, 11856, 3988, 29901, 13, 29937, 2045, 597, 1636, 29889, 3952, 861, 18082, 2363, 29889, 1212, 29914, 29894, 7958, 13401, 29939, 29922, 29950, 14556, 29974, 29950, 326, 29974, 6767, 13, 25416, 29918, 1660, 1718, 3210, 29918, 4219, 353, 525, 991, 597, 1636, 29889, 29888, 3781, 1527, 29889, 1212, 29914, 4478, 29973, 29939, 16328, 29879, 29915, 13, 13, 29937, 3497, 2983, 304, 1993, 363, 445, 10823, 13, 1445, 29918, 978, 29918, 11037, 353, 337, 29889, 12198, 29898, 29925, 24539, 1839, 13087, 11287, 13, 13, 29937, 8741, 3497, 4408, 29901, 13, 29937, 2045, 597, 9799, 29889, 3952, 861, 18082, 2363, 29889, 510, 29914, 1557, 25487, 29914, 29882, 29916, 29896, 29896, 29896, 29918, 24645, 29906, 29914, 29882, 29916, 29896, 29896, 29896, 29918, 24645, 29906, 29918, 14242, 29918, 29896, 29900, 29947, 29900, 29886, 29889, 1526, 29946, 13, 29937, 24080, 5813, 29918, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 703, 1159, 13, 29937, 323, 1806, 1307, 29918, 29925, 1299, 4945, 29940, 353, 337, 29889, 12198, 703, 1159, 13, 13, 1753, 7370, 7295, 13, 12, 10493, 29889, 10408, 2481, 353, 315, 2477, 9606, 29918, 29896, 8851, 29923, 29968, 13, 12, 10493, 29889, 18163, 1839, 2659, 29899, 14748, 2033, 353, 525, 29924, 2112, 2911, 29914, 29946, 29889, 29900, 313, 23712, 29936, 341, 5425, 29923, 29871, 29947, 29889, 29900, 29936, 525, 320, 13, 4706, 525, 7685, 405, 29911, 29871, 29953, 29889, 29906, 29936, 1605, 1693, 29914, 29946, 29889, 29900, 29936, 27146, 4174, 29906, 29936, 869, 6006, 17332, 29934, 29871, 29906, 29889, 29900, 29889, 29945, 29900, 29955, 29906, 29955, 29936, 525, 320, 13, 4706, 15300, 6006, 17332, 29934, 29871, 29941, 29889, 29945, 29889, 29941, 29900, 29955, 29906, 29929, 29936, 869, 6006, 17332, 29934, 29871, 29941, 29889, 29900, 29889, 29941, 29900, 29955, 29906, 29929, 29936, 8213, 7817, 9609, 29871, 29953, 29889, 29900, 16029, 13, 13, 1990, 383, 3781, 1527, 29898, 19661, 29889, 29924, 586, 583, 1125, 13, 12, 978, 353, 525, 29943, 3781, 1527, 29915, 13, 12, 29880, 8737, 353, 518, 3524, 744, 29889, 21233, 29889, 3782, 21233, 29892, 5976, 744, 29889, 21233, 29889, 24636, 29962, 13, 12, 16072, 29918, 18121, 353, 7700, 13, 12, 11950, 1627, 29918, 14748, 353, 6024, 510, 29889, 10709, 932, 29889, 351, 1237, 29889, 29887, 388, 29886, 1398, 15914, 272, 2033, 13, 12, 1285, 5026, 29918, 517, 353, 6024, 510, 29889, 10709, 932, 29889, 351, 1237, 29889, 24956, 29886, 1398, 2033, 13, 13, 12, 1753, 4522, 29898, 1311, 29892, 2643, 29892, 334, 5085, 1125, 13, 12, 12, 361, 349, 24539, 1839, 8382, 2033, 29901, 13, 12, 12, 12, 3403, 29898, 7390, 23338, 1177, 29918, 14480, 29918, 29911, 1806, 1307, 718, 525, 448, 525, 718, 2643, 29892, 334, 5085, 29897, 13, 13, 12, 1753, 938, 3057, 29898, 1311, 29892, 269, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 524, 29898, 29879, 29897, 13, 12, 12, 12, 2457, 938, 29898, 29879, 29897, 13, 12, 12, 19499, 7865, 2392, 29901, 13, 12, 12, 12, 2457, 7700, 13, 13, 12, 1753, 2788, 29898, 1311, 29892, 263, 29892, 289, 1125, 13, 12, 12, 2457, 922, 3910, 9652, 261, 29898, 8516, 29892, 263, 29892, 289, 467, 3605, 601, 580, 13, 13, 12, 1753, 2740, 29898, 1311, 29892, 2582, 29892, 5745, 29892, 6361, 29892, 12219, 1125, 13, 12, 12, 1311, 29889, 3403, 877, 2683, 2683, 2683, 2683, 26589, 1495, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 315, 1964, 20566, 325, 29889, 29995, 29879, 742, 478, 1001, 13381, 29918, 6632, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 28096, 29901, 1273, 29879, 1273, 29879, 742, 7481, 29889, 5205, 3285, 7481, 29889, 14096, 3101, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 5745, 29889, 3257, 448, 1273, 29879, 742, 5745, 29889, 3257, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 448, 1273, 29879, 742, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 5745, 29889, 16072, 29918, 19635, 29889, 3257, 448, 1273, 29879, 742, 5745, 29889, 16072, 29918, 19635, 29889, 3257, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 5745, 29889, 7076, 448, 1273, 29879, 742, 5745, 29889, 7076, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 5745, 29889, 9507, 448, 1273, 29879, 742, 5745, 29889, 9507, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 6361, 448, 1273, 29879, 742, 6361, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 12219, 448, 1273, 29879, 742, 12219, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 349, 24539, 976, 11911, 448, 1273, 29879, 742, 349, 24539, 1839, 11911, 11287, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 349, 24539, 976, 8771, 414, 448, 1273, 29879, 742, 349, 24539, 1839, 8771, 414, 11287, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 349, 24539, 976, 13087, 448, 1273, 29879, 742, 349, 24539, 1839, 13087, 11287, 13, 13, 12, 12, 361, 451, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 29901, 13, 12, 12, 12, 2457, 13, 13, 12, 12, 2084, 29918, 392, 29918, 1445, 353, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 29889, 13609, 580, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 3497, 10802, 29901, 1273, 29879, 742, 2224, 29918, 392, 29918, 1445, 29897, 13, 13, 12, 12, 29898, 1445, 29918, 3972, 29892, 2362, 3871, 29897, 353, 2897, 29889, 2084, 29889, 5451, 29898, 359, 29889, 2084, 29889, 23579, 568, 486, 29898, 2084, 29918, 392, 29918, 1445, 9601, 29900, 2314, 13, 12, 12, 8394, 29918, 3972, 353, 2897, 29889, 2084, 29889, 5451, 29898, 1445, 29918, 3972, 9601, 29896, 29962, 13, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 1174, 11291, 292, 383, 3194, 29901, 1273, 29879, 742, 2186, 29918, 3972, 29897, 13, 13, 12, 12, 361, 349, 24539, 1839, 8771, 414, 2033, 2804, 26345, 1115, 13, 12, 12, 12, 12083, 29918, 1761, 353, 337, 29889, 5451, 29317, 29905, 29879, 29930, 742, 349, 24539, 1839, 8771, 414, 13359, 13609, 3101, 13, 12, 12, 12, 361, 2186, 29918, 3972, 451, 297, 4138, 29918, 1761, 29901, 13, 12, 12, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 28551, 3262, 1273, 29879, 1363, 278, 4138, 1273, 29879, 338, 451, 297, 278, 22691, 16495, 1051, 29901, 1273, 29879, 742, 2362, 3871, 29892, 2186, 29918, 3972, 29892, 13420, 4286, 7122, 29898, 12083, 29918, 1761, 876, 13, 12, 12, 12, 12, 2457, 13, 13, 12, 12, 29885, 353, 934, 29918, 978, 29918, 11037, 29889, 4478, 29898, 6500, 3871, 29897, 13, 12, 12, 361, 451, 286, 29901, 13, 12, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 28551, 3262, 1273, 29879, 1363, 278, 934, 1024, 338, 451, 297, 278, 3806, 3402, 29889, 742, 2362, 3871, 29897, 13, 12, 12, 12, 2457, 13, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 3497, 4408, 29901, 1273, 29879, 742, 2362, 3871, 29897, 13, 13, 12, 12, 13155, 353, 286, 29889, 2972, 8977, 580, 13, 12, 12, 24049, 29918, 978, 353, 6471, 1839, 24049, 29918, 978, 2033, 13, 12, 12, 27362, 29918, 2271, 29918, 978, 353, 337, 29889, 1491, 28909, 29879, 29974, 742, 525, 29974, 742, 20102, 29918, 978, 29897, 13, 12, 12, 27362, 29918, 2271, 353, 350, 8127, 29918, 13044, 29923, 29949, 29918, 2287, 6040, 6227, 29903, 29918, 4219, 1273, 14064, 29918, 2271, 29918, 978, 13, 12, 12, 4478, 29918, 1972, 29918, 1610, 353, 1051, 580, 13, 12, 12, 1454, 8424, 297, 20102, 29918, 978, 29889, 5451, 877, 525, 1125, 13, 12, 12, 12, 361, 337, 29889, 4478, 877, 29985, 29961, 29900, 29899, 29929, 29909, 29899, 29999, 29874, 29899, 29920, 14178, 29938, 742, 8424, 29889, 6506, 877, 29991, 742, 6629, 876, 338, 451, 6213, 29901, 13, 12, 12, 12, 12, 4478, 29918, 1972, 29918, 1610, 29889, 4397, 29898, 12343, 346, 29897, 13, 13, 12, 12, 1311, 29889, 3403, 877, 1660, 1718, 3210, 448, 13987, 3988, 29901, 1273, 29879, 742, 14064, 29918, 2271, 29897, 13, 12, 12, 1420, 353, 4544, 29889, 2642, 4591, 4219, 29898, 27362, 29918, 2271, 29892, 8709, 29922, 16244, 29918, 2287, 18799, 29897, 13, 12, 12, 9641, 29918, 3257, 353, 3472, 29889, 23635, 877, 458, 29930, 17548, 333, 543, 3332, 3108, 29914, 3396, 29914, 4563, 29914, 4563, 29914, 4563, 29961, 29906, 16261, 4563, 29961, 29906, 16261, 4563, 29961, 29896, 16261, 4563, 29961, 29896, 16261, 4563, 29914, 29882, 29896, 1495, 13, 12, 12, 9902, 29889, 18277, 29898, 18417, 7974, 3591, 29898, 333, 353, 14064, 29918, 2271, 29892, 1024, 353, 4863, 29918, 3257, 29892, 8158, 353, 29871, 29896, 29900, 29900, 29892, 6361, 353, 6361, 876, 13, 13, 12, 1753, 2767, 29898, 1311, 29892, 15562, 29892, 5745, 29892, 6361, 29892, 4889, 29922, 8824, 1125, 13, 12, 12, 1311, 29889, 3403, 877, 14474, 315, 1964, 20566, 1495, 13, 13, 12, 12, 361, 451, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 29901, 13, 12, 12, 12, 2457, 13, 13, 12, 12, 1445, 29918, 2084, 353, 5745, 29889, 7076, 29961, 29900, 1822, 20895, 29961, 29900, 1822, 1445, 13, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 3497, 10802, 29901, 1273, 29879, 742, 934, 29918, 2084, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 13987, 3988, 29901, 1273, 29879, 742, 15562, 29889, 333, 29897, 13, 12, 12, 2271, 353, 15562, 29889, 333, 13, 13, 12, 12, 29937, 383, 3486, 4544, 13, 12, 12, 1420, 353, 4544, 29889, 2642, 4591, 4219, 29898, 2271, 29892, 8709, 29922, 16244, 29918, 2287, 18799, 29897, 13, 13, 12, 12, 29937, 3789, 4055, 1220, 304, 3988, 13, 12, 12, 19635, 29889, 4039, 1220, 353, 3142, 13, 13, 12, 12, 3257, 1761, 353, 3472, 29889, 23635, 877, 458, 4563, 17548, 1990, 543, 1563, 3108, 29914, 4563, 29914, 29882, 29896, 29914, 9653, 29914, 726, 580, 1495, 13, 12, 12, 9641, 29918, 3257, 353, 6629, 13, 12, 12, 1454, 3611, 1595, 297, 3611, 1761, 29901, 13, 12, 12, 12, 9641, 29918, 3257, 4619, 851, 29898, 3257, 1595, 29897, 13, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4863, 29918, 3257, 29901, 11860, 29879, 29908, 742, 4863, 29918, 3257, 29897, 13, 12, 12, 3084, 29918, 3027, 29918, 7039, 353, 1051, 580, 13, 12, 12, 29875, 353, 29871, 29900, 13, 12, 12, 9641, 29918, 3027, 29918, 1761, 353, 3472, 29889, 23635, 877, 458, 29930, 17548, 1990, 543, 29887, 23365, 4274, 3108, 29914, 29874, 29914, 2492, 1495, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 11911, 29925, 24539, 353, 349, 24539, 1839, 11911, 2033, 13, 12, 12, 12, 1454, 1967, 297, 4863, 29918, 3027, 29918, 1761, 29901, 13, 12, 12, 12, 12, 361, 474, 5277, 313, 1311, 29889, 524, 3057, 29898, 11911, 29925, 24539, 6817, 29896, 29897, 470, 4612, 29925, 24539, 1275, 376, 497, 3625, 1115, 13, 12, 12, 12, 12, 12, 29875, 353, 474, 718, 29871, 29896, 13, 12, 12, 12, 12, 12, 2490, 261, 29918, 2271, 353, 1967, 29889, 657, 877, 4351, 1495, 13, 12, 12, 12, 12, 12, 3084, 29918, 3027, 29918, 7039, 29889, 4397, 29898, 2490, 261, 29918, 2271, 29897, 13, 12, 12, 12, 12, 12, 29937, 1311, 29889, 3403, 29898, 2490, 261, 29918, 2271, 29897, 13, 12, 12, 12, 12, 12, 19635, 29889, 2490, 414, 29961, 2490, 261, 29918, 2271, 13192, 14048, 29889, 10572, 29898, 10493, 29889, 3089, 29898, 2490, 261, 29918, 2271, 511, 2656, 29918, 2098, 353, 474, 29897, 13, 12, 12, 19499, 8960, 408, 321, 29901, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4829, 2805, 1400, 414, 29901, 1273, 29879, 742, 321, 29897, 13, 12, 12, 12, 3364, 13, 13, 12, 12, 29937, 3967, 304, 679, 6139, 1426, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 1610, 29918, 12717, 29918, 726, 353, 3472, 29889, 23635, 703, 458, 4563, 17548, 1990, 2433, 1563, 2033, 29914, 4563, 17548, 1990, 2433, 5514, 2337, 29899, 12872, 2033, 29914, 726, 580, 29961, 29906, 29962, 1159, 29961, 29900, 29962, 13, 12, 12, 12, 361, 376, 29874, 29908, 451, 297, 10650, 29918, 12717, 29918, 726, 29901, 13, 12, 12, 12, 12, 1610, 29918, 12717, 29918, 726, 353, 3472, 29889, 23635, 703, 458, 4563, 17548, 1990, 2433, 1563, 2033, 29914, 4563, 17548, 1990, 2433, 5514, 2337, 29899, 12872, 2033, 29914, 29886, 29914, 726, 580, 1159, 29961, 29900, 29962, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 12953, 29901, 1273, 29879, 742, 10650, 29918, 12717, 29918, 726, 29897, 13, 12, 12, 12, 19635, 29889, 7727, 29922, 1610, 29918, 12717, 29918, 726, 13, 12, 12, 19499, 8960, 408, 321, 29901, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4829, 2805, 6139, 1426, 29901, 1273, 29879, 742, 321, 29897, 13, 12, 12, 12, 3364, 13, 13, 12, 12, 29937, 3967, 304, 679, 6507, 2635, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 14096, 29918, 1256, 29922, 1420, 29889, 23635, 877, 458, 29930, 17548, 333, 543, 3891, 29918, 9342, 3108, 29914, 4563, 29961, 4230, 580, 16261, 4563, 29961, 29896, 16261, 726, 580, 29861, 29896, 1822, 5451, 580, 29961, 29896, 1385, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 23708, 4712, 448, 1570, 29901, 1273, 29879, 742, 6507, 29918, 1256, 29897, 13, 12, 12, 12, 19635, 29889, 12574, 635, 29918, 16515, 29918, 271, 353, 13373, 5410, 29889, 12914, 2539, 29898, 14096, 29918, 1256, 467, 1256, 580, 13, 12, 12, 12, 19635, 29889, 6360, 353, 15562, 29889, 12574, 635, 29918, 16515, 29918, 271, 29889, 6360, 13, 12, 12, 19499, 8960, 408, 321, 29901, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4829, 2805, 6507, 2635, 29901, 1273, 29879, 742, 321, 29897, 13, 12, 12, 12, 3364, 13, 13, 12, 12, 29937, 3967, 304, 679, 322, 1889, 278, 4863, 4320, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 19635, 29889, 307, 793, 29889, 8551, 580, 13, 12, 12, 12, 12154, 386, 3774, 29879, 353, 1051, 890, 13, 12, 12, 12, 7168, 29918, 3027, 29918, 1761, 353, 3472, 29889, 23635, 877, 458, 4563, 17548, 1990, 543, 7168, 3108, 5515, 17548, 1990, 543, 21596, 3108, 29914, 2492, 1495, 13, 12, 12, 12, 1454, 11339, 29918, 3027, 297, 11339, 29918, 3027, 29918, 1761, 29901, 13, 12, 12, 12, 12, 2813, 8962, 29918, 2271, 29918, 2918, 29918, 690, 353, 11339, 29918, 3027, 29889, 657, 877, 4351, 2157, 13, 12, 12, 12, 12, 12154, 386, 3774, 29879, 29889, 4397, 29898, 2813, 8962, 29918, 2271, 29918, 2918, 29918, 690, 29897, 13, 12, 12, 12, 1420, 4384, 353, 3472, 29889, 23635, 703, 458, 4563, 17548, 1990, 2433, 7168, 2033, 29914, 4563, 17548, 1990, 2433, 978, 2033, 29914, 726, 580, 1159, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4320, 29901, 11860, 29879, 29908, 742, 3472, 4384, 29897, 13, 12, 12, 12, 2248, 353, 29871, 29900, 13, 12, 12, 12, 1454, 4320, 297, 3472, 4384, 29901, 13, 12, 12, 12, 12, 29883, 978, 353, 4320, 29889, 17010, 580, 13, 12, 12, 12, 12, 361, 313, 2435, 29898, 29883, 978, 29897, 1405, 29871, 29900, 1125, 13, 12, 12, 12, 12, 12, 12154, 353, 15562, 29889, 307, 793, 29889, 1482, 580, 13, 12, 12, 12, 12, 12, 12154, 29889, 978, 353, 274, 978, 13, 12, 12, 12, 12, 12, 12154, 29889, 21596, 353, 6297, 386, 3774, 29879, 29961, 2248, 29962, 13, 12, 12, 12, 12, 2248, 4619, 29871, 29896, 13, 12, 12, 19499, 8960, 408, 321, 29901, 13, 12, 12, 12, 1311, 29889, 3403, 877, 14474, 448, 4829, 2805, 4863, 4320, 29901, 1273, 29879, 742, 321, 29897, 13, 12, 12, 12, 3364, 13, 13, 12, 12, 29937, 3967, 304, 679, 322, 1889, 278, 4863, 2531, 690, 13, 12, 12, 19635, 29889, 1885, 690, 29889, 1202, 703, 29943, 3781, 1527, 1159, 13, 12, 12, 19635, 29889, 29027, 29889, 1202, 703, 29943, 3781, 1527, 1159, 13, 12, 12, 19635, 29889, 2490, 414, 29889, 15480, 29918, 8149, 29898, 3084, 29918, 3027, 29918, 7039, 29897, 13, 12, 12, 19635, 29889, 3051, 29918, 29741, 353, 525, 29990, 29915, 13, 12, 12, 19635, 29889, 3257, 353, 4863, 29918, 3257, 13, 12, 12, 19635, 29889, 12073, 353, 376, 29943, 3781, 1527, 29908, 13, 13, 2 ]
GEOS_Util/coupled_diagnostics/verification/HadCRUT3/__init__.py
GEOS-ESM/GMAO_Shared
1
49882
<reponame>GEOS-ESM/GMAO_Shared import os import netCDF4 as nc import scipy as sp from g5lib import dset __all__=['ctl'] class Ctl(dset.NCDset): def __init__(self): name='HadCRUT3' flist=['/discover/nobackup/projects/gmao/oceanval/verification/HadCRUT3/HadCRUT3.nc'] f=nc.Dataset(flist[0]) tt=f.variables['t'] time=nc.num2date(tt[:],tt.units) undef=f.variables['temp'].missing_value f.close() super(Ctl,self).__init__(flist,time=time,undef=undef,name=name, lonname='longitude', latname='latitude', levname='unspecified', timename='t') def get_hadcrut3gl(self,annual=False): ''' Gets HadCRUT3 globaly averaged T anomalies ''' if not annual: # Return monthly data return sp.loadtxt('/discover/nobackup/projects/gmao/oceanval/verification/HadCRUT3/hadcrut3gl.txt', usecols=range(1,13))[0::2].flatten() else: # Return annual means return sp.loadtxt('/discover/nobackup/projects/gmao/oceanval/verification/HadCRUT3/hadcrut3gl.txt', usecols=range(1,13))[0::2].mean(1) ctl=Ctl()
[ 1, 529, 276, 1112, 420, 29958, 1692, 3267, 29899, 2890, 29924, 29914, 29954, 1529, 29949, 29918, 21741, 13, 5215, 2897, 13, 5215, 7787, 29907, 4037, 29946, 408, 302, 29883, 13, 5215, 4560, 2272, 408, 805, 13, 3166, 330, 29945, 1982, 1053, 270, 842, 13, 13, 1649, 497, 1649, 29922, 1839, 16948, 2033, 13, 13, 1990, 315, 15206, 29898, 29881, 842, 29889, 29940, 6530, 842, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1024, 2433, 29950, 328, 11341, 2692, 29941, 29915, 13, 308, 13, 4706, 1652, 391, 29922, 1839, 29914, 2218, 11911, 29914, 29876, 711, 547, 786, 29914, 16418, 29914, 29887, 655, 29877, 29914, 29877, 11956, 791, 29914, 369, 2450, 29914, 29950, 328, 11341, 2692, 29941, 29914, 29950, 328, 11341, 2692, 29941, 29889, 17608, 2033, 13, 4706, 285, 29922, 17608, 29889, 16390, 24541, 29898, 1579, 391, 29961, 29900, 2314, 13, 4706, 260, 29873, 29922, 29888, 29889, 20897, 1839, 29873, 2033, 13, 4706, 931, 29922, 17608, 29889, 1949, 29906, 1256, 29898, 698, 7503, 1402, 698, 29889, 348, 1169, 29897, 13, 4706, 563, 1389, 29922, 29888, 29889, 20897, 1839, 7382, 13359, 27259, 29918, 1767, 13, 4706, 285, 29889, 5358, 580, 13, 13, 4706, 2428, 29898, 29907, 15206, 29892, 1311, 467, 1649, 2344, 12035, 1579, 391, 29892, 2230, 29922, 2230, 29892, 870, 1389, 29922, 870, 1389, 29892, 978, 29922, 978, 29892, 13, 462, 462, 23123, 978, 2433, 5426, 4279, 742, 13, 462, 462, 3405, 978, 2433, 5066, 4279, 742, 13, 462, 462, 14453, 978, 2433, 348, 6550, 2164, 742, 13, 462, 462, 5335, 3871, 2433, 29873, 1495, 13, 308, 13, 1678, 822, 679, 29918, 21312, 7283, 329, 29941, 3820, 29898, 1311, 29892, 812, 950, 29922, 8824, 1125, 13, 4706, 14550, 13, 4706, 402, 1691, 14302, 11341, 2692, 29941, 5534, 29891, 4759, 4063, 323, 29342, 284, 583, 13, 4706, 14550, 13, 4706, 565, 451, 17568, 29901, 13, 9651, 396, 7106, 4098, 368, 848, 13, 9651, 736, 805, 29889, 1359, 3945, 11219, 2218, 11911, 29914, 29876, 711, 547, 786, 29914, 16418, 29914, 29887, 655, 29877, 29914, 29877, 11956, 791, 29914, 369, 2450, 29914, 29950, 328, 11341, 2692, 29941, 29914, 21312, 7283, 329, 29941, 3820, 29889, 3945, 742, 671, 22724, 29922, 3881, 29898, 29896, 29892, 29896, 29941, 876, 29961, 29900, 1057, 29906, 1822, 1579, 8606, 580, 13, 4706, 1683, 29901, 13, 9651, 396, 7106, 17568, 2794, 13, 9651, 736, 805, 29889, 1359, 3945, 11219, 2218, 11911, 29914, 29876, 711, 547, 786, 29914, 16418, 29914, 29887, 655, 29877, 29914, 29877, 11956, 791, 29914, 369, 2450, 29914, 29950, 328, 11341, 2692, 29941, 29914, 21312, 7283, 329, 29941, 3820, 29889, 3945, 742, 671, 22724, 29922, 3881, 29898, 29896, 29892, 29896, 29941, 876, 29961, 29900, 1057, 29906, 1822, 12676, 29898, 29896, 29897, 13, 268, 13, 13, 16948, 29922, 29907, 15206, 580, 13, 2 ]
.venv/Lib/site-packages/pdoc/cli.py
JohanK91/MethodDice
0
22707
#!/usr/bin/env python3 """pdoc's CLI interface and helper functions.""" import argparse import ast import importlib import inspect import os import os.path as path import json import re import sys import warnings from contextlib import contextmanager from functools import lru_cache from http.server import BaseHTTPRequestHandler, HTTPServer from typing import Dict, List, Sequence from warnings import warn import pdoc parser = argparse.ArgumentParser( description="Automatically generate API docs for Python modules.", epilog="Further documentation is available at <https://pdoc3.github.io/pdoc/doc>.", ) aa = parser.add_argument mode_aa = parser.add_mutually_exclusive_group().add_argument aa( '--version', action='version', version='%(prog)s ' + pdoc.__version__) aa( "modules", type=str, metavar='MODULE', nargs="+", help="The Python module name. This may be an import path resolvable in " "the current environment, or a file path to a Python module or " "package.", ) aa( "-c", "--config", type=str, metavar='OPTION=VALUE', action='append', default=[], help="Override template options. This is an alternative to using " "a custom config.mako file in --template-dir. This option " "can be specified multiple times.", ) aa( "--filter", type=str, metavar='STRING', default=None, help="Comma-separated list of filters. When specified, " "only identifiers containing the specified string " "will be shown in the output. Search is case sensitive. " "Has no effect when --http is set.", ) aa( "-f", "--force", action="store_true", help="Overwrite any existing generated (--output-dir) files.", ) mode_aa( "--html", action="store_true", help="When set, the output will be HTML formatted.", ) mode_aa( "--pdf", action="store_true", help="When set, the specified modules will be printed to standard output, " "formatted in Markdown-Extra, compatible with most " "Markdown-(to-HTML-)to-PDF converters.", ) aa( "--html-dir", type=str, help=argparse.SUPPRESS, ) aa( "-o", "--output-dir", type=str, metavar='DIR', help="The directory to output generated HTML/markdown files to " "(default: ./html for --html).", ) aa( "--html-no-source", action="store_true", help=argparse.SUPPRESS, ) aa( "--overwrite", action="store_true", help=argparse.SUPPRESS, ) aa( "--external-links", action="store_true", help=argparse.SUPPRESS, ) aa( "--template-dir", type=str, metavar='DIR', default=None, help="Specify a directory containing Mako templates " "(html.mako, text.mako, config.mako and/or any templates they include). " "Alternatively, put your templates in $XDG_CONFIG_HOME/pdoc and " "pdoc will automatically find them.", ) aa( "--link-prefix", type=str, help=argparse.SUPPRESS, ) aa( "--close-stdin", action="store_true", help="When set, stdin will be closed before importing, to account for " "ill-behaved modules that block on stdin." ) DEFAULT_HOST, DEFAULT_PORT = 'localhost', 8080 def _check_host_port(s): if s and ':' not in s: raise argparse.ArgumentTypeError( "'{}' doesn't match '[HOST]:[PORT]'. " "Specify `--http :` to use default hostname and port.".format(s)) return s aa( "--http", default='', type=_check_host_port, metavar='HOST:PORT', help="When set, pdoc will run as an HTTP server providing documentation " "for specified modules. If you just want to use the default hostname " "and port ({}:{}), set the parameter to :.".format(DEFAULT_HOST, DEFAULT_PORT), ) aa( "--skip-errors", action="store_true", help="Upon unimportable modules, warn instead of raising." ) args = argparse.Namespace() class _WebDoc(BaseHTTPRequestHandler): args = None # Set before server instantiated template_config = None def do_HEAD(self): status = 200 if self.path != "/": status = self.check_modified() self.send_response(status) self.send_header("Content-type", "text/html; charset=utf-8") self.end_headers() def check_modified(self): try: module = pdoc.import_module(self.import_path_from_req_url) new_etag = str(os.stat(module.__file__).st_mtime) except ImportError: return 404 old_etag = self.headers.get('If-None-Match', new_etag) if old_etag == new_etag: # Don't log repeating checks self.log_request = lambda *args, **kwargs: None return 304 return 205 def do_GET(self): # Deny favicon shortcut early. if self.path == "/favicon.ico": return None importlib.invalidate_caches() code = 200 if self.path == "/": modules = [pdoc.import_module(module, reload=True) for module in self.args.modules] modules = sorted((module.__name__, inspect.getdoc(module)) for module in modules) out = pdoc._render_template('/html.mako', modules=modules, **self.template_config) elif self.path.endswith(".ext"): # External links are a bit weird. You should view them as a giant # hack. Basically, the idea is to "guess" where something lives # when documenting another module and hope that guess can actually # track something down in a more global context. # # The idea here is to start specific by looking for HTML that # exists that matches the full external path given. Then trim off # one component at the end and try again. # # If no HTML is found, then we ask `pdoc` to do its thang on the # parent module in the external path. If all goes well, that # module will then be able to find the external identifier. import_path = self.path[:-4].lstrip("/") resolved = self.resolve_ext(import_path) if resolved is None: # Try to generate the HTML... print("Generating HTML for %s on the fly..." % import_path, file=sys.stderr) try: out = pdoc.html(import_path.split(".")[0], **self.template_config) except Exception as e: print('Error generating docs: {}'.format(e), file=sys.stderr) # All hope is lost. code = 404 out = "External identifier <code>%s</code> not found." % import_path else: return self.redirect(resolved) # Redirect '/pdoc' to '/pdoc/' so that relative links work # (results in '/pdoc/cli.html' instead of 'cli.html') elif not self.path.endswith(('/', '.html')): return self.redirect(self.path + '/') # Redirect '/pdoc/index.html' to '/pdoc/' so it's more pretty elif self.path.endswith(pdoc._URL_PACKAGE_SUFFIX): return self.redirect(self.path[:-len(pdoc._URL_PACKAGE_SUFFIX)] + '/') else: try: out = self.html() except Exception: import traceback from html import escape code = 404 out = "Error importing module <code>{}</code>:\n\n<pre>{}</pre>".format( self.import_path_from_req_url, escape(traceback.format_exc())) out = out.replace('\n', '<br>') self.send_response(code) self.send_header("Content-type", "text/html; charset=utf-8") self.end_headers() self.echo(out) def redirect(self, location): self.send_response(302) self.send_header("Location", location) self.end_headers() def echo(self, s): self.wfile.write(s.encode("utf-8")) def html(self): """ Retrieves and sends the HTML belonging to the path given in URL. This method is smart and will look for HTML files already generated and account for whether they are stale compared to the source code. """ return pdoc.html(self.import_path_from_req_url, reload=True, http_server=True, external_links=True, skip_errors=args.skip_errors, **self.template_config) def resolve_ext(self, import_path): def exists(p): p = path.join(args.output_dir, p) pkg = path.join(p, pdoc._URL_PACKAGE_SUFFIX.lstrip('/')) mod = p + pdoc._URL_MODULE_SUFFIX if path.isfile(pkg): return pkg[len(args.output_dir):] elif path.isfile(mod): return mod[len(args.output_dir):] return None parts = import_path.split(".") for i in range(len(parts), 0, -1): p = path.join(*parts[0:i]) realp = exists(p) if realp is not None: return "/%s#%s" % (realp.lstrip("/"), import_path) return None @property def import_path_from_req_url(self): pth = self.path.split('#')[0].lstrip('/') for suffix in ('/', pdoc._URL_PACKAGE_SUFFIX, pdoc._URL_INDEX_MODULE_SUFFIX, pdoc._URL_MODULE_SUFFIX): if pth.endswith(suffix): pth = pth[:-len(suffix)] break return pth.replace('/', '.') def module_path(m: pdoc.Module, ext: str): return path.join(args.output_dir, *re.sub(r'\.html$', ext, m.url()).split('/')) def _quit_if_exists(m: pdoc.Module, ext: str): if args.force: return paths = [module_path(m, ext)] if m.is_package: # If package, make sure the dir doesn't exist either paths.append(path.dirname(paths[0])) for pth in paths: if path.lexists(pth): print("File '%s' already exists. Delete it, or run with --force" % pth, file=sys.stderr) sys.exit(1) @contextmanager def _open_write_file(filename): try: with open(filename, 'w', encoding='utf-8') as f: yield f print(filename) # print created file path to stdout except Exception: try: os.unlink(filename) except Exception: pass raise def recursive_write_files(m: pdoc.Module, ext: str, **kwargs): assert ext in ('.html', '.md') filepath = module_path(m, ext=ext) dirpath = path.dirname(filepath) if not os.access(dirpath, os.R_OK): os.makedirs(dirpath) with _open_write_file(filepath) as f: if ext == '.html': f.write(m.html(**kwargs)) elif ext == '.md': f.write(m.text(**kwargs)) for submodule in m.submodules(): recursive_write_files(submodule, ext=ext, **kwargs) def _flatten_submodules(modules: Sequence[pdoc.Module]): for module in modules: yield module for submodule in module.submodules(): yield from _flatten_submodules((submodule,)) def _print_pdf(modules, **kwargs): modules = list(_flatten_submodules(modules)) print(pdoc._render_template('/pdf.mako', modules=modules, **kwargs)) def _warn_deprecated(option, alternative='', use_config_mako=False): msg = 'Program option `{}` is deprecated.'.format(option) if alternative: msg += ' Use `' + alternative + '`' if use_config_mako: msg += ' or override config.mako template' msg += '.' warn(msg, DeprecationWarning, stacklevel=2) def _generate_lunr_search(modules: List[pdoc.Module], index_docstrings: bool, template_config: dict): """Generate index.js for search""" def trim_docstring(docstring): return re.sub(r''' \s+| # whitespace sequences \s+[-=~]{3,}\s+| # title underlines ^[ \t]*[`~]{3,}\w*$| # code blocks \s*[`#*]+\s*| # common markdown chars \s*([^\w\d_>])\1\s*| # sequences of punct of the same kind \s*</?\w*[^>]*>\s* # simple HTML tags ''', ' ', docstring, flags=re.VERBOSE | re.MULTILINE) def recursive_add_to_index(dobj): info = { 'ref': dobj.refname, 'url': to_url_id(dobj.module), } if index_docstrings: info['doc'] = trim_docstring(dobj.docstring) if isinstance(dobj, pdoc.Function): info['func'] = 1 index.append(info) for member_dobj in getattr(dobj, 'doc', {}).values(): recursive_add_to_index(member_dobj) @lru_cache() def to_url_id(module): url = module.url() if url not in url_cache: url_cache[url] = len(url_cache) return url_cache[url] index = [] # type: List[Dict] url_cache = {} # type: Dict[str, int] for top_module in modules: recursive_add_to_index(top_module) urls = sorted(url_cache.keys(), key=url_cache.__getitem__) main_path = args.output_dir with _open_write_file(path.join(main_path, 'index.js')) as f: f.write("URLS=") json.dump(urls, f, indent=0, separators=(',', ':')) f.write(";\nINDEX=") json.dump(index, f, indent=0, separators=(',', ':')) # Generate search.html with _open_write_file(path.join(main_path, 'doc-search.html')) as f: rendered_template = pdoc._render_template('/search.mako', **template_config) f.write(rendered_template) def main(_args=None): """ Command-line entry point """ global args args = _args or parser.parse_args() warnings.simplefilter("once", DeprecationWarning) if args.close_stdin: sys.stdin.close() if (args.html or args.http) and not args.output_dir: args.output_dir = 'html' if args.html_dir: _warn_deprecated('--html-dir', '--output-dir') args.output_dir = args.html_dir if args.overwrite: _warn_deprecated('--overwrite', '--force') args.force = args.overwrite template_config = {} for config_str in args.config: try: key, value = config_str.split('=', 1) value = ast.literal_eval(value) template_config[key] = value except Exception: raise ValueError( 'Error evaluating --config statement "{}". ' 'Make sure string values are quoted?' .format(config_str) ) if args.html_no_source: _warn_deprecated('--html-no-source', '-c show_source_code=False', True) template_config['show_source_code'] = False if args.link_prefix: _warn_deprecated('--link-prefix', '-c link_prefix="foo"', True) template_config['link_prefix'] = args.link_prefix if args.external_links: _warn_deprecated('--external-links') template_config['external_links'] = True if args.template_dir is not None: if not path.isdir(args.template_dir): print('Error: Template dir {!r} is not a directory'.format(args.template_dir), file=sys.stderr) sys.exit(1) pdoc.tpl_lookup.directories.insert(0, args.template_dir) # Support loading modules specified as python paths relative to cwd sys.path.append(os.getcwd()) # Virtual environment handling for pdoc script run from system site try: venv_dir = os.environ['VIRTUAL_ENV'] except KeyError: pass # pdoc was not invoked while in a virtual environment else: from glob import glob from distutils.sysconfig import get_python_lib libdir = get_python_lib(prefix=venv_dir) sys.path.append(libdir) # Resolve egg-links from `setup.py develop` or `pip install -e` # XXX: Welcome a more canonical approach for pth in glob(path.join(libdir, '*.egg-link')): try: with open(pth) as f: sys.path.append(path.join(libdir, f.readline().rstrip())) except IOError: warn('Invalid egg-link in venv: {!r}'.format(pth)) if args.http: template_config['link_prefix'] = "/" # Run the HTTP server. _WebDoc.args = args # Pass params to HTTPServer xP _WebDoc.template_config = template_config host, _, port = args.http.partition(':') host = host or DEFAULT_HOST port = int(port or DEFAULT_PORT) print('Starting pdoc server on {}:{}'.format(host, port), file=sys.stderr) httpd = HTTPServer((host, port), _WebDoc) print("pdoc server ready at http://%s:%d" % (host, port), file=sys.stderr) # Allow tests to perform `pdoc.cli._httpd.shutdown()` global _httpd _httpd = httpd try: httpd.serve_forever() finally: httpd.server_close() sys.exit(0) docfilter = None if args.filter and args.filter.strip(): def docfilter(obj, _filters=args.filter.strip().split(',')): return any(f in obj.refname or isinstance(obj, pdoc.Class) and f in obj.doc for f in _filters) modules = [pdoc.Module(module, docfilter=docfilter, skip_errors=args.skip_errors) for module in args.modules] pdoc.link_inheritance() if args.pdf: _print_pdf(modules, **template_config) import textwrap print(""" PDF-ready markdown written to standard output. ^^^^^^^^^^^^^^^ Convert this file to PDF using e.g. Pandoc: {PANDOC_CMD} or using Python-Markdown and Chrome/Chromium/WkHtmlToPDF: markdown_py --extension=meta \\ --extension=abbr \\ --extension=attr_list \\ --extension=def_list \\ --extension=fenced_code \\ --extension=footnotes \\ --extension=tables \\ --extension=admonition \\ --extension=smarty \\ --extension=toc \\ pdf.md > pdf.html chromium --headless --disable-gpu --print-to-pdf=pdf.pdf pdf.html wkhtmltopdf --encoding utf8 -s A4 --print-media-type pdf.html pdf.pdf or similar, at your own discretion.""".format(PANDOC_CMD=textwrap.indent(_PANDOC_COMMAND, ' ')), file=sys.stderr) sys.exit(0) for module in modules: if args.html: _quit_if_exists(module, ext='.html') recursive_write_files(module, ext='.html', **template_config) elif args.output_dir: # Generate text files _quit_if_exists(module, ext='.md') recursive_write_files(module, ext='.md', **template_config) else: sys.stdout.write(module.text(**template_config)) # Two blank lines between two modules' texts sys.stdout.write(os.linesep * (1 + 2 * int(module != modules[-1]))) lunr_config = pdoc._get_config(**template_config).get('lunr_search') if lunr_config is not None: _generate_lunr_search( modules, lunr_config.get("index_docstrings", True), template_config) _PANDOC_COMMAND = '''\ pandoc --metadata=title:"MyProject Documentation" \\ --from=markdown+abbreviations+tex_math_single_backslash \\ --pdf-engine=xelatex --variable=mainfont:"DejaVu Sans" \\ --toc --toc-depth=4 --output=pdf.pdf pdf.md\ ''' if __name__ == "__main__": main(parser.parse_args())
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 29886, 1514, 29915, 29879, 24492, 5067, 322, 16876, 3168, 1213, 15945, 13, 13, 5215, 1852, 5510, 13, 5215, 8717, 13, 5215, 1053, 1982, 13, 5215, 16096, 13, 5215, 2897, 13, 5215, 2897, 29889, 2084, 408, 2224, 13, 5215, 4390, 13, 5215, 337, 13, 5215, 10876, 13, 5215, 18116, 13, 3166, 3030, 1982, 1053, 3030, 12847, 13, 3166, 2090, 312, 8789, 1053, 301, 582, 29918, 8173, 13, 3166, 1732, 29889, 2974, 1053, 7399, 10493, 3089, 4598, 29892, 7331, 6004, 13, 3166, 19229, 1053, 360, 919, 29892, 2391, 29892, 922, 3910, 13, 3166, 18116, 1053, 29383, 13, 13, 5215, 282, 1514, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 1678, 6139, 543, 28451, 19574, 5706, 3450, 10561, 363, 5132, 10585, 19602, 13, 1678, 9358, 26140, 543, 29943, 332, 721, 5106, 338, 3625, 472, 529, 991, 597, 29886, 1514, 29941, 29889, 3292, 29889, 601, 29914, 29886, 1514, 29914, 1514, 15513, 613, 13, 29897, 13, 7340, 353, 13812, 29889, 1202, 29918, 23516, 13, 8513, 29918, 7340, 353, 13812, 29889, 1202, 29918, 6149, 1474, 29918, 735, 7009, 573, 29918, 2972, 2141, 1202, 29918, 23516, 13, 13, 7340, 29898, 13, 1678, 525, 489, 3259, 742, 3158, 2433, 3259, 742, 1873, 2433, 29995, 29898, 29097, 29897, 29879, 525, 718, 282, 1514, 17255, 3259, 1649, 29897, 13, 7340, 29898, 13, 1678, 376, 7576, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1539, 485, 279, 2433, 6720, 14849, 1307, 742, 13, 1678, 302, 5085, 543, 29974, 613, 13, 1678, 1371, 543, 1576, 5132, 3883, 1024, 29889, 910, 1122, 367, 385, 1053, 2224, 3770, 29894, 519, 297, 376, 13, 1678, 376, 1552, 1857, 5177, 29892, 470, 263, 934, 2224, 304, 263, 5132, 3883, 470, 376, 13, 1678, 376, 5113, 19602, 13, 29897, 13, 7340, 29898, 13, 1678, 11663, 29883, 613, 376, 489, 2917, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1539, 485, 279, 2433, 14094, 2725, 29922, 19143, 742, 13, 1678, 3158, 2433, 4397, 742, 13, 1678, 2322, 11759, 1402, 13, 1678, 1371, 543, 4640, 4472, 3987, 29889, 910, 338, 385, 8671, 304, 773, 376, 13, 308, 376, 29874, 2888, 2295, 29889, 29885, 4614, 934, 297, 1192, 6886, 29899, 3972, 29889, 910, 2984, 376, 13, 308, 376, 3068, 367, 6790, 2999, 3064, 19602, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 4572, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1539, 485, 279, 2433, 20785, 742, 13, 1678, 2322, 29922, 8516, 29892, 13, 1678, 1371, 543, 1523, 655, 29899, 25048, 630, 1051, 310, 18094, 29889, 1932, 6790, 29892, 376, 13, 308, 376, 6194, 2893, 14903, 6943, 278, 6790, 1347, 376, 13, 308, 376, 14043, 367, 4318, 297, 278, 1962, 29889, 11856, 338, 1206, 20502, 29889, 376, 13, 308, 376, 14510, 694, 2779, 746, 1192, 1124, 338, 731, 19602, 13, 29897, 13, 7340, 29898, 13, 1678, 11663, 29888, 613, 376, 489, 10118, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 543, 3563, 3539, 738, 5923, 5759, 313, 489, 4905, 29899, 3972, 29897, 2066, 19602, 13, 29897, 13, 8513, 29918, 7340, 29898, 13, 1678, 376, 489, 1420, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 543, 10401, 731, 29892, 278, 1962, 674, 367, 4544, 20917, 19602, 13, 29897, 13, 8513, 29918, 7340, 29898, 13, 1678, 376, 489, 5140, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 543, 10401, 731, 29892, 278, 6790, 10585, 674, 367, 13350, 304, 3918, 1962, 29892, 376, 13, 308, 376, 689, 19667, 297, 4485, 3204, 29899, 18126, 29892, 15878, 411, 1556, 376, 13, 308, 376, 9802, 3204, 17722, 517, 29899, 7020, 15805, 517, 29899, 8493, 5486, 2153, 19602, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 1420, 29899, 3972, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29892, 13, 29897, 13, 7340, 29898, 13, 1678, 11663, 29877, 613, 376, 489, 4905, 29899, 3972, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1539, 485, 279, 2433, 9464, 742, 13, 1678, 1371, 543, 1576, 3884, 304, 1962, 5759, 4544, 29914, 3502, 3204, 2066, 304, 376, 13, 308, 18227, 4381, 29901, 11431, 1420, 363, 1192, 1420, 467, 613, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 1420, 29899, 1217, 29899, 4993, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29892, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 957, 3539, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29892, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 23176, 29899, 4965, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29892, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 6886, 29899, 3972, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1539, 485, 279, 2433, 9464, 742, 13, 1678, 2322, 29922, 8516, 29892, 13, 1678, 1371, 543, 10299, 1598, 263, 3884, 6943, 341, 4614, 17475, 376, 13, 308, 18227, 1420, 29889, 29885, 4614, 29892, 1426, 29889, 29885, 4614, 29892, 2295, 29889, 29885, 4614, 322, 29914, 272, 738, 17475, 896, 3160, 467, 376, 13, 308, 376, 2499, 725, 6703, 29892, 1925, 596, 17475, 297, 395, 29990, 29928, 29954, 29918, 25903, 29918, 17353, 29914, 29886, 1514, 322, 376, 13, 308, 376, 29886, 1514, 674, 6336, 1284, 963, 19602, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 2324, 29899, 13506, 613, 13, 1678, 1134, 29922, 710, 29892, 13, 1678, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29892, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 5358, 29899, 4172, 262, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 543, 10401, 731, 29892, 3659, 262, 674, 367, 5764, 1434, 28348, 29892, 304, 3633, 363, 376, 13, 308, 376, 453, 29899, 915, 8708, 287, 10585, 393, 2908, 373, 3659, 262, 1213, 13, 29897, 13, 13, 23397, 29918, 20832, 29892, 22236, 29918, 15082, 353, 525, 7640, 742, 29871, 29947, 29900, 29947, 29900, 13, 13, 13, 1753, 903, 3198, 29918, 3069, 29918, 637, 29898, 29879, 1125, 13, 1678, 565, 269, 322, 525, 11283, 451, 297, 269, 29901, 13, 4706, 12020, 1852, 5510, 29889, 15730, 1542, 2392, 29898, 13, 9651, 13577, 8875, 29915, 1838, 29915, 29873, 1993, 525, 29961, 20832, 5387, 29961, 15082, 29962, 4286, 376, 13, 9651, 376, 10299, 1598, 22974, 1124, 584, 29952, 304, 671, 2322, 3495, 978, 322, 2011, 1213, 29889, 4830, 29898, 29879, 876, 13, 1678, 736, 269, 13, 13, 13, 7340, 29898, 13, 1678, 376, 489, 1124, 613, 13, 1678, 2322, 2433, 742, 13, 1678, 1134, 29922, 29918, 3198, 29918, 3069, 29918, 637, 29892, 13, 1678, 1539, 485, 279, 2433, 20832, 29901, 15082, 742, 13, 1678, 1371, 543, 10401, 731, 29892, 282, 1514, 674, 1065, 408, 385, 7331, 1923, 13138, 5106, 376, 13, 308, 376, 1454, 6790, 10585, 29889, 960, 366, 925, 864, 304, 671, 278, 2322, 3495, 978, 376, 13, 308, 376, 392, 2011, 21313, 6177, 8875, 511, 731, 278, 3443, 304, 584, 1213, 29889, 4830, 29898, 23397, 29918, 20832, 29892, 22236, 29918, 15082, 511, 13, 29897, 13, 7340, 29898, 13, 1678, 376, 489, 11014, 29899, 12523, 613, 13, 1678, 3158, 543, 8899, 29918, 3009, 613, 13, 1678, 1371, 543, 29965, 1112, 443, 5215, 519, 10585, 29892, 29383, 2012, 310, 29263, 1213, 13, 29897, 13, 13, 5085, 353, 1852, 5510, 29889, 23335, 580, 13, 13, 13, 1990, 903, 3609, 14526, 29898, 5160, 10493, 3089, 4598, 1125, 13, 1678, 6389, 353, 6213, 29871, 396, 3789, 1434, 1923, 13213, 630, 13, 1678, 4472, 29918, 2917, 353, 6213, 13, 13, 1678, 822, 437, 29918, 23252, 29898, 1311, 1125, 13, 4706, 4660, 353, 29871, 29906, 29900, 29900, 13, 4706, 565, 1583, 29889, 2084, 2804, 5591, 1115, 13, 9651, 4660, 353, 1583, 29889, 3198, 29918, 1545, 2164, 580, 13, 13, 4706, 1583, 29889, 6717, 29918, 5327, 29898, 4882, 29897, 13, 4706, 1583, 29889, 6717, 29918, 6672, 703, 3916, 29899, 1853, 613, 376, 726, 29914, 1420, 29936, 17425, 29922, 9420, 29899, 29947, 1159, 13, 4706, 1583, 29889, 355, 29918, 13662, 580, 13, 13, 1678, 822, 1423, 29918, 1545, 2164, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 3883, 353, 282, 1514, 29889, 5215, 29918, 5453, 29898, 1311, 29889, 5215, 29918, 2084, 29918, 3166, 29918, 7971, 29918, 2271, 29897, 13, 9651, 716, 29918, 300, 351, 353, 851, 29898, 359, 29889, 6112, 29898, 5453, 17255, 1445, 1649, 467, 303, 29918, 29885, 2230, 29897, 13, 4706, 5174, 16032, 2392, 29901, 13, 9651, 736, 29871, 29946, 29900, 29946, 13, 13, 4706, 2030, 29918, 300, 351, 353, 1583, 29889, 13662, 29889, 657, 877, 3644, 29899, 8516, 29899, 9652, 742, 716, 29918, 300, 351, 29897, 13, 4706, 565, 2030, 29918, 300, 351, 1275, 716, 29918, 300, 351, 29901, 13, 9651, 396, 3872, 29915, 29873, 1480, 28769, 12747, 13, 9651, 1583, 29889, 1188, 29918, 3827, 353, 14013, 334, 5085, 29892, 3579, 19290, 29901, 6213, 13, 9651, 736, 29871, 29941, 29900, 29946, 13, 13, 4706, 736, 29871, 29906, 29900, 29945, 13, 13, 1678, 822, 437, 29918, 7194, 29898, 1311, 1125, 13, 4706, 396, 3384, 29891, 5025, 4144, 21697, 4688, 29889, 13, 4706, 565, 1583, 29889, 2084, 1275, 5591, 29888, 485, 4144, 29889, 1417, 1115, 13, 9651, 736, 6213, 13, 13, 4706, 1053, 1982, 29889, 262, 15480, 29918, 29883, 14520, 580, 13, 4706, 775, 353, 29871, 29906, 29900, 29900, 13, 4706, 565, 1583, 29889, 2084, 1275, 5591, 1115, 13, 9651, 10585, 353, 518, 29886, 1514, 29889, 5215, 29918, 5453, 29898, 5453, 29892, 19763, 29922, 5574, 29897, 13, 462, 539, 363, 3883, 297, 1583, 29889, 5085, 29889, 7576, 29962, 13, 9651, 10585, 353, 12705, 3552, 5453, 17255, 978, 1649, 29892, 16096, 29889, 657, 1514, 29898, 5453, 876, 13, 462, 632, 363, 3883, 297, 10585, 29897, 13, 9651, 714, 353, 282, 1514, 3032, 9482, 29918, 6886, 11219, 1420, 29889, 29885, 4614, 742, 13, 462, 462, 4706, 10585, 29922, 7576, 29892, 13, 462, 462, 4706, 3579, 1311, 29889, 6886, 29918, 2917, 29897, 13, 4706, 25342, 1583, 29889, 2084, 29889, 1975, 2541, 17350, 1062, 29908, 1125, 13, 9651, 396, 3985, 2988, 526, 263, 2586, 13543, 29889, 887, 881, 1776, 963, 408, 263, 28396, 13, 9651, 396, 15833, 29889, 13702, 29892, 278, 2969, 338, 304, 376, 2543, 404, 29908, 988, 1554, 12080, 13, 9651, 396, 746, 1842, 292, 1790, 3883, 322, 4966, 393, 4140, 508, 2869, 13, 9651, 396, 5702, 1554, 1623, 297, 263, 901, 5534, 3030, 29889, 13, 9651, 396, 13, 9651, 396, 450, 2969, 1244, 338, 304, 1369, 2702, 491, 3063, 363, 4544, 393, 13, 9651, 396, 4864, 393, 7087, 278, 2989, 7029, 2224, 2183, 29889, 1987, 17151, 1283, 13, 9651, 396, 697, 4163, 472, 278, 1095, 322, 1018, 1449, 29889, 13, 9651, 396, 13, 9651, 396, 960, 694, 4544, 338, 1476, 29892, 769, 591, 2244, 421, 29886, 1514, 29952, 304, 437, 967, 266, 574, 373, 278, 13, 9651, 396, 3847, 3883, 297, 278, 7029, 2224, 29889, 960, 599, 5771, 1532, 29892, 393, 13, 9651, 396, 3883, 674, 769, 367, 2221, 304, 1284, 278, 7029, 15882, 29889, 13, 13, 9651, 1053, 29918, 2084, 353, 1583, 29889, 2084, 7503, 29899, 29946, 1822, 29880, 17010, 11974, 1159, 13, 9651, 11527, 353, 1583, 29889, 17863, 29918, 1062, 29898, 5215, 29918, 2084, 29897, 13, 9651, 565, 11527, 338, 6213, 29901, 29871, 396, 3967, 304, 5706, 278, 4544, 856, 13, 18884, 1596, 703, 5631, 1218, 4544, 363, 1273, 29879, 373, 278, 11340, 17794, 1273, 1053, 29918, 2084, 29892, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 18884, 1018, 29901, 13, 462, 1678, 714, 353, 282, 1514, 29889, 1420, 29898, 5215, 29918, 2084, 29889, 5451, 17350, 1159, 29961, 29900, 1402, 3579, 1311, 29889, 6886, 29918, 2917, 29897, 13, 18884, 5174, 8960, 408, 321, 29901, 13, 462, 1678, 1596, 877, 2392, 14655, 10561, 29901, 6571, 4286, 4830, 29898, 29872, 511, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 462, 1678, 396, 2178, 4966, 338, 5714, 29889, 13, 462, 1678, 775, 353, 29871, 29946, 29900, 29946, 13, 462, 1678, 714, 353, 376, 25865, 15882, 529, 401, 29958, 29995, 29879, 829, 401, 29958, 451, 1476, 1213, 1273, 1053, 29918, 2084, 13, 9651, 1683, 29901, 13, 18884, 736, 1583, 29889, 17886, 29898, 9778, 1490, 29897, 13, 4706, 396, 4367, 1088, 8207, 29886, 1514, 29915, 304, 8207, 29886, 1514, 22208, 577, 393, 6198, 2988, 664, 13, 4706, 396, 313, 9902, 297, 8207, 29886, 1514, 29914, 11303, 29889, 1420, 29915, 2012, 310, 525, 11303, 29889, 1420, 1495, 13, 4706, 25342, 451, 1583, 29889, 2084, 29889, 1975, 2541, 29898, 11219, 742, 15300, 1420, 8785, 29901, 13, 9651, 736, 1583, 29889, 17886, 29898, 1311, 29889, 2084, 718, 8207, 1495, 13, 4706, 396, 4367, 1088, 8207, 29886, 1514, 29914, 2248, 29889, 1420, 29915, 304, 8207, 29886, 1514, 22208, 577, 372, 29915, 29879, 901, 5051, 13, 4706, 25342, 1583, 29889, 2084, 29889, 1975, 2541, 29898, 29886, 1514, 3032, 4219, 29918, 29925, 11375, 10461, 29918, 14605, 29943, 25634, 1125, 13, 9651, 736, 1583, 29889, 17886, 29898, 1311, 29889, 2084, 7503, 29899, 2435, 29898, 29886, 1514, 3032, 4219, 29918, 29925, 11375, 10461, 29918, 14605, 29943, 25634, 4638, 718, 8207, 1495, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 714, 353, 1583, 29889, 1420, 580, 13, 9651, 5174, 8960, 29901, 13, 18884, 1053, 9637, 1627, 13, 18884, 515, 3472, 1053, 10169, 13, 18884, 775, 353, 29871, 29946, 29900, 29946, 13, 18884, 714, 353, 376, 2392, 28348, 3883, 529, 401, 29958, 8875, 829, 401, 29958, 3583, 29876, 29905, 29876, 29966, 1457, 29958, 8875, 829, 1457, 29958, 1642, 4830, 29898, 13, 462, 1678, 1583, 29889, 5215, 29918, 2084, 29918, 3166, 29918, 7971, 29918, 2271, 29892, 10169, 29898, 15003, 1627, 29889, 4830, 29918, 735, 29883, 22130, 13, 18884, 714, 353, 714, 29889, 6506, 28909, 29876, 742, 12801, 1182, 29958, 1495, 13, 13, 4706, 1583, 29889, 6717, 29918, 5327, 29898, 401, 29897, 13, 4706, 1583, 29889, 6717, 29918, 6672, 703, 3916, 29899, 1853, 613, 376, 726, 29914, 1420, 29936, 17425, 29922, 9420, 29899, 29947, 1159, 13, 4706, 1583, 29889, 355, 29918, 13662, 580, 13, 4706, 1583, 29889, 8057, 29898, 449, 29897, 13, 13, 1678, 822, 6684, 29898, 1311, 29892, 4423, 1125, 13, 4706, 1583, 29889, 6717, 29918, 5327, 29898, 29941, 29900, 29906, 29897, 13, 4706, 1583, 29889, 6717, 29918, 6672, 703, 6508, 613, 4423, 29897, 13, 4706, 1583, 29889, 355, 29918, 13662, 580, 13, 13, 1678, 822, 2916, 29898, 1311, 29892, 269, 1125, 13, 4706, 1583, 29889, 29893, 1445, 29889, 3539, 29898, 29879, 29889, 12508, 703, 9420, 29899, 29947, 5783, 13, 13, 1678, 822, 3472, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 19338, 1960, 322, 16003, 278, 4544, 23329, 304, 278, 2224, 2183, 297, 13, 4706, 3988, 29889, 910, 1158, 338, 15040, 322, 674, 1106, 363, 4544, 2066, 2307, 13, 4706, 5759, 322, 3633, 363, 3692, 896, 526, 380, 744, 9401, 304, 13, 4706, 278, 2752, 775, 29889, 13, 4706, 9995, 13, 4706, 736, 282, 1514, 29889, 1420, 29898, 1311, 29889, 5215, 29918, 2084, 29918, 3166, 29918, 7971, 29918, 2271, 29892, 13, 462, 308, 19763, 29922, 5574, 29892, 1732, 29918, 2974, 29922, 5574, 29892, 7029, 29918, 4965, 29922, 5574, 29892, 13, 462, 308, 14383, 29918, 12523, 29922, 5085, 29889, 11014, 29918, 12523, 29892, 13, 462, 308, 3579, 1311, 29889, 6886, 29918, 2917, 29897, 13, 13, 1678, 822, 8814, 29918, 1062, 29898, 1311, 29892, 1053, 29918, 2084, 1125, 13, 4706, 822, 4864, 29898, 29886, 1125, 13, 9651, 282, 353, 2224, 29889, 7122, 29898, 5085, 29889, 4905, 29918, 3972, 29892, 282, 29897, 13, 9651, 282, 9415, 353, 2224, 29889, 7122, 29898, 29886, 29892, 282, 1514, 3032, 4219, 29918, 29925, 11375, 10461, 29918, 14605, 29943, 25634, 29889, 29880, 17010, 11219, 8785, 13, 9651, 878, 353, 282, 718, 282, 1514, 3032, 4219, 29918, 6720, 14849, 1307, 29918, 14605, 29943, 25634, 13, 13, 9651, 565, 2224, 29889, 275, 1445, 29898, 15865, 1125, 13, 18884, 736, 282, 9415, 29961, 2435, 29898, 5085, 29889, 4905, 29918, 3972, 1125, 29962, 13, 9651, 25342, 2224, 29889, 275, 1445, 29898, 1545, 1125, 13, 18884, 736, 878, 29961, 2435, 29898, 5085, 29889, 4905, 29918, 3972, 1125, 29962, 13, 9651, 736, 6213, 13, 13, 4706, 5633, 353, 1053, 29918, 2084, 29889, 5451, 17350, 1159, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 20895, 511, 29871, 29900, 29892, 448, 29896, 1125, 13, 9651, 282, 353, 2224, 29889, 7122, 10456, 20895, 29961, 29900, 29901, 29875, 2314, 13, 9651, 1855, 29886, 353, 4864, 29898, 29886, 29897, 13, 9651, 565, 1855, 29886, 338, 451, 6213, 29901, 13, 18884, 736, 5591, 29995, 29879, 29937, 29995, 29879, 29908, 1273, 313, 6370, 29886, 29889, 29880, 17010, 11974, 4968, 1053, 29918, 2084, 29897, 13, 4706, 736, 6213, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1053, 29918, 2084, 29918, 3166, 29918, 7971, 29918, 2271, 29898, 1311, 1125, 13, 4706, 282, 386, 353, 1583, 29889, 2084, 29889, 5451, 14237, 29861, 29900, 1822, 29880, 17010, 11219, 1495, 13, 4706, 363, 25557, 297, 6702, 29914, 742, 13, 462, 539, 282, 1514, 3032, 4219, 29918, 29925, 11375, 10461, 29918, 14605, 29943, 25634, 29892, 13, 462, 539, 282, 1514, 3032, 4219, 29918, 27992, 29918, 6720, 14849, 1307, 29918, 14605, 29943, 25634, 29892, 13, 462, 539, 282, 1514, 3032, 4219, 29918, 6720, 14849, 1307, 29918, 14605, 29943, 25634, 1125, 13, 9651, 565, 282, 386, 29889, 1975, 2541, 29898, 2146, 600, 861, 1125, 13, 18884, 282, 386, 353, 282, 386, 7503, 29899, 2435, 29898, 2146, 600, 861, 4638, 13, 18884, 2867, 13, 4706, 736, 282, 386, 29889, 6506, 11219, 742, 15300, 1495, 13, 13, 13, 1753, 3883, 29918, 2084, 29898, 29885, 29901, 282, 1514, 29889, 7355, 29892, 1294, 29901, 851, 1125, 13, 1678, 736, 2224, 29889, 7122, 29898, 5085, 29889, 4905, 29918, 3972, 29892, 334, 276, 29889, 1491, 29898, 29878, 12764, 29889, 1420, 29938, 742, 1294, 29892, 286, 29889, 2271, 16655, 5451, 11219, 8785, 13, 13, 13, 1753, 903, 28358, 29918, 361, 29918, 9933, 29898, 29885, 29901, 282, 1514, 29889, 7355, 29892, 1294, 29901, 851, 1125, 13, 1678, 565, 6389, 29889, 10118, 29901, 13, 4706, 736, 13, 13, 1678, 10898, 353, 518, 5453, 29918, 2084, 29898, 29885, 29892, 1294, 4638, 13, 1678, 565, 286, 29889, 275, 29918, 5113, 29901, 29871, 396, 960, 3577, 29892, 1207, 1854, 278, 4516, 1838, 29915, 29873, 1863, 2845, 13, 4706, 10898, 29889, 4397, 29898, 2084, 29889, 25721, 29898, 24772, 29961, 29900, 12622, 13, 13, 1678, 363, 282, 386, 297, 10898, 29901, 13, 4706, 565, 2224, 29889, 2506, 2879, 29898, 29886, 386, 1125, 13, 9651, 1596, 703, 2283, 14210, 29879, 29915, 2307, 4864, 29889, 21267, 372, 29892, 470, 1065, 411, 1192, 10118, 29908, 1273, 282, 386, 29892, 13, 462, 29871, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 13, 29992, 4703, 12847, 13, 1753, 903, 3150, 29918, 3539, 29918, 1445, 29898, 9507, 1125, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 9507, 29892, 525, 29893, 742, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 9651, 7709, 285, 13, 9651, 1596, 29898, 9507, 29897, 29871, 396, 1596, 2825, 934, 2224, 304, 27591, 13, 1678, 5174, 8960, 29901, 13, 4706, 1018, 29901, 13, 9651, 2897, 29889, 348, 2324, 29898, 9507, 29897, 13, 4706, 5174, 8960, 29901, 13, 9651, 1209, 13, 4706, 12020, 13, 13, 13, 1753, 16732, 29918, 3539, 29918, 5325, 29898, 29885, 29901, 282, 1514, 29889, 7355, 29892, 1294, 29901, 851, 29892, 3579, 19290, 1125, 13, 1678, 4974, 1294, 297, 313, 4286, 1420, 742, 15300, 3487, 1495, 13, 1678, 934, 2084, 353, 3883, 29918, 2084, 29898, 29885, 29892, 1294, 29922, 1062, 29897, 13, 13, 1678, 4516, 2084, 353, 2224, 29889, 25721, 29898, 1445, 2084, 29897, 13, 1678, 565, 451, 2897, 29889, 5943, 29898, 3972, 2084, 29892, 2897, 29889, 29934, 29918, 8949, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 3972, 2084, 29897, 13, 13, 1678, 411, 903, 3150, 29918, 3539, 29918, 1445, 29898, 1445, 2084, 29897, 408, 285, 29901, 13, 4706, 565, 1294, 1275, 15300, 1420, 2396, 13, 9651, 285, 29889, 3539, 29898, 29885, 29889, 1420, 29898, 1068, 19290, 876, 13, 4706, 25342, 1294, 1275, 15300, 3487, 2396, 13, 9651, 285, 29889, 3539, 29898, 29885, 29889, 726, 29898, 1068, 19290, 876, 13, 13, 1678, 363, 1014, 5453, 297, 286, 29889, 1491, 7576, 7295, 13, 4706, 16732, 29918, 3539, 29918, 5325, 29898, 1491, 5453, 29892, 1294, 29922, 1062, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 903, 1579, 8606, 29918, 1491, 7576, 29898, 7576, 29901, 922, 3910, 29961, 29886, 1514, 29889, 7355, 29962, 1125, 13, 1678, 363, 3883, 297, 10585, 29901, 13, 4706, 7709, 3883, 13, 4706, 363, 1014, 5453, 297, 3883, 29889, 1491, 7576, 7295, 13, 9651, 7709, 515, 903, 1579, 8606, 29918, 1491, 7576, 3552, 1491, 5453, 29892, 876, 13, 13, 13, 1753, 903, 2158, 29918, 5140, 29898, 7576, 29892, 3579, 19290, 1125, 13, 1678, 10585, 353, 1051, 7373, 1579, 8606, 29918, 1491, 7576, 29898, 7576, 876, 13, 1678, 1596, 29898, 29886, 1514, 3032, 9482, 29918, 6886, 11219, 5140, 29889, 29885, 4614, 742, 10585, 29922, 7576, 29892, 3579, 19290, 876, 13, 13, 13, 1753, 903, 25442, 29918, 311, 17990, 630, 29898, 3385, 29892, 8671, 2433, 742, 671, 29918, 2917, 29918, 29885, 4614, 29922, 8824, 1125, 13, 1678, 10191, 353, 525, 9283, 2984, 421, 8875, 29952, 338, 18164, 29889, 4286, 4830, 29898, 3385, 29897, 13, 1678, 565, 8671, 29901, 13, 4706, 10191, 4619, 525, 4803, 16218, 718, 8671, 718, 525, 20497, 13, 4706, 565, 671, 29918, 2917, 29918, 29885, 4614, 29901, 13, 9651, 10191, 4619, 525, 470, 5712, 2295, 29889, 29885, 4614, 4472, 29915, 13, 4706, 10191, 4619, 525, 6169, 13, 1678, 29383, 29898, 7645, 29892, 897, 1457, 9252, 22709, 29892, 5096, 5563, 29922, 29906, 29897, 13, 13, 13, 1753, 903, 17158, 29918, 29880, 348, 29878, 29918, 4478, 29898, 7576, 29901, 2391, 29961, 29886, 1514, 29889, 7355, 1402, 13, 462, 3986, 2380, 29918, 1514, 19651, 29901, 6120, 29892, 13, 462, 3986, 4472, 29918, 2917, 29901, 9657, 1125, 13, 1678, 9995, 5631, 403, 2380, 29889, 1315, 363, 2740, 15945, 29908, 13, 13, 1678, 822, 17151, 29918, 1514, 1807, 29898, 1514, 1807, 1125, 13, 4706, 736, 337, 29889, 1491, 29898, 29878, 12008, 13, 9651, 320, 29879, 29974, 29989, 462, 259, 396, 24358, 15602, 13, 9651, 320, 29879, 29974, 14352, 29922, 30022, 3199, 29941, 29892, 1012, 29879, 29974, 29989, 539, 396, 3611, 1090, 9012, 13, 9651, 6228, 29961, 320, 29873, 14178, 29961, 29952, 30022, 3199, 29941, 29892, 1012, 29893, 29394, 29989, 259, 396, 775, 10930, 13, 9651, 320, 29879, 29930, 29961, 29952, 29937, 29930, 29962, 3124, 29879, 29930, 29989, 3986, 396, 3619, 2791, 3204, 22524, 13, 9651, 320, 29879, 29930, 4197, 3823, 29893, 29905, 29881, 29918, 29958, 29962, 2144, 29896, 29905, 29879, 29930, 29989, 259, 396, 15602, 310, 6035, 312, 310, 278, 1021, 2924, 13, 9651, 320, 29879, 29930, 829, 29973, 29905, 29893, 29930, 22896, 29958, 14178, 14247, 29879, 29930, 268, 396, 2560, 4544, 8282, 13, 4706, 6629, 742, 525, 13420, 1574, 1807, 29892, 13449, 29922, 276, 29889, 5348, 8456, 1660, 891, 337, 29889, 29924, 8647, 6227, 8895, 29897, 13, 13, 1678, 822, 16732, 29918, 1202, 29918, 517, 29918, 2248, 29898, 29881, 5415, 1125, 13, 4706, 5235, 353, 426, 13, 9651, 525, 999, 2396, 20129, 29926, 29889, 999, 978, 29892, 13, 9651, 525, 2271, 2396, 304, 29918, 2271, 29918, 333, 29898, 29881, 5415, 29889, 5453, 511, 13, 4706, 500, 13, 4706, 565, 2380, 29918, 1514, 19651, 29901, 13, 9651, 5235, 1839, 1514, 2033, 353, 17151, 29918, 1514, 1807, 29898, 29881, 5415, 29889, 1514, 1807, 29897, 13, 4706, 565, 338, 8758, 29898, 29881, 5415, 29892, 282, 1514, 29889, 6678, 1125, 13, 9651, 5235, 1839, 9891, 2033, 353, 29871, 29896, 13, 4706, 2380, 29889, 4397, 29898, 3888, 29897, 13, 4706, 363, 4509, 29918, 29881, 5415, 297, 679, 5552, 29898, 29881, 5415, 29892, 525, 1514, 742, 6571, 467, 5975, 7295, 13, 9651, 16732, 29918, 1202, 29918, 517, 29918, 2248, 29898, 14242, 29918, 29881, 5415, 29897, 13, 13, 1678, 732, 29880, 582, 29918, 8173, 580, 13, 1678, 822, 304, 29918, 2271, 29918, 333, 29898, 5453, 1125, 13, 4706, 3142, 353, 3883, 29889, 2271, 580, 13, 4706, 565, 3142, 451, 297, 3142, 29918, 8173, 29901, 13, 9651, 3142, 29918, 8173, 29961, 2271, 29962, 353, 7431, 29898, 2271, 29918, 8173, 29897, 13, 4706, 736, 3142, 29918, 8173, 29961, 2271, 29962, 13, 13, 1678, 2380, 353, 5159, 29871, 396, 1134, 29901, 2391, 29961, 21533, 29962, 13, 1678, 3142, 29918, 8173, 353, 6571, 29871, 396, 1134, 29901, 360, 919, 29961, 710, 29892, 938, 29962, 13, 1678, 363, 2246, 29918, 5453, 297, 10585, 29901, 13, 4706, 16732, 29918, 1202, 29918, 517, 29918, 2248, 29898, 3332, 29918, 5453, 29897, 13, 1678, 23942, 353, 12705, 29898, 2271, 29918, 8173, 29889, 8149, 3285, 1820, 29922, 2271, 29918, 8173, 17255, 657, 667, 1649, 29897, 13, 13, 1678, 1667, 29918, 2084, 353, 6389, 29889, 4905, 29918, 3972, 13, 1678, 411, 903, 3150, 29918, 3539, 29918, 1445, 29898, 2084, 29889, 7122, 29898, 3396, 29918, 2084, 29892, 525, 2248, 29889, 1315, 8785, 408, 285, 29901, 13, 4706, 285, 29889, 3539, 703, 4219, 29903, 543, 29897, 13, 4706, 4390, 29889, 15070, 29898, 26045, 29892, 285, 29892, 29536, 29922, 29900, 29892, 2903, 4097, 7607, 742, 742, 525, 29901, 8785, 13, 4706, 285, 29889, 3539, 703, 10436, 29876, 27992, 543, 29897, 13, 4706, 4390, 29889, 15070, 29898, 2248, 29892, 285, 29892, 29536, 29922, 29900, 29892, 2903, 4097, 7607, 742, 742, 525, 29901, 8785, 13, 13, 1678, 396, 3251, 403, 2740, 29889, 1420, 13, 1678, 411, 903, 3150, 29918, 3539, 29918, 1445, 29898, 2084, 29889, 7122, 29898, 3396, 29918, 2084, 29892, 525, 1514, 29899, 4478, 29889, 1420, 8785, 408, 285, 29901, 13, 4706, 13751, 29918, 6886, 353, 282, 1514, 3032, 9482, 29918, 6886, 11219, 4478, 29889, 29885, 4614, 742, 3579, 6886, 29918, 2917, 29897, 13, 4706, 285, 29889, 3539, 29898, 9482, 287, 29918, 6886, 29897, 13, 13, 13, 1753, 1667, 7373, 5085, 29922, 8516, 1125, 13, 1678, 9995, 10516, 29899, 1220, 6251, 1298, 9995, 13, 1678, 5534, 6389, 13, 1678, 6389, 353, 903, 5085, 470, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 18116, 29889, 12857, 4572, 703, 10646, 613, 897, 1457, 9252, 22709, 29897, 13, 13, 1678, 565, 6389, 29889, 5358, 29918, 4172, 262, 29901, 13, 4706, 10876, 29889, 4172, 262, 29889, 5358, 580, 13, 13, 1678, 565, 313, 5085, 29889, 1420, 470, 6389, 29889, 1124, 29897, 322, 451, 6389, 29889, 4905, 29918, 3972, 29901, 13, 4706, 6389, 29889, 4905, 29918, 3972, 353, 525, 1420, 29915, 13, 13, 1678, 565, 6389, 29889, 1420, 29918, 3972, 29901, 13, 4706, 903, 25442, 29918, 311, 17990, 630, 877, 489, 1420, 29899, 3972, 742, 525, 489, 4905, 29899, 3972, 1495, 13, 4706, 6389, 29889, 4905, 29918, 3972, 353, 6389, 29889, 1420, 29918, 3972, 13, 1678, 565, 6389, 29889, 957, 3539, 29901, 13, 4706, 903, 25442, 29918, 311, 17990, 630, 877, 489, 957, 3539, 742, 525, 489, 10118, 1495, 13, 4706, 6389, 29889, 10118, 353, 6389, 29889, 957, 3539, 13, 13, 1678, 4472, 29918, 2917, 353, 6571, 13, 1678, 363, 2295, 29918, 710, 297, 6389, 29889, 2917, 29901, 13, 4706, 1018, 29901, 13, 9651, 1820, 29892, 995, 353, 2295, 29918, 710, 29889, 5451, 877, 29922, 742, 29871, 29896, 29897, 13, 9651, 995, 353, 8717, 29889, 20889, 284, 29918, 14513, 29898, 1767, 29897, 13, 9651, 4472, 29918, 2917, 29961, 1989, 29962, 353, 995, 13, 4706, 5174, 8960, 29901, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 525, 2392, 6161, 1218, 1192, 2917, 3229, 376, 8875, 1642, 525, 13, 18884, 525, 9984, 1854, 1347, 1819, 526, 23153, 17901, 13, 18884, 869, 4830, 29898, 2917, 29918, 710, 29897, 13, 9651, 1723, 13, 13, 1678, 565, 6389, 29889, 1420, 29918, 1217, 29918, 4993, 29901, 13, 4706, 903, 25442, 29918, 311, 17990, 630, 877, 489, 1420, 29899, 1217, 29899, 4993, 742, 17411, 29883, 1510, 29918, 4993, 29918, 401, 29922, 8824, 742, 5852, 29897, 13, 4706, 4472, 29918, 2917, 1839, 4294, 29918, 4993, 29918, 401, 2033, 353, 7700, 13, 1678, 565, 6389, 29889, 2324, 29918, 13506, 29901, 13, 4706, 903, 25442, 29918, 311, 17990, 630, 877, 489, 2324, 29899, 13506, 742, 17411, 29883, 1544, 29918, 13506, 543, 5431, 29908, 742, 5852, 29897, 13, 4706, 4472, 29918, 2917, 1839, 2324, 29918, 13506, 2033, 353, 6389, 29889, 2324, 29918, 13506, 13, 1678, 565, 6389, 29889, 23176, 29918, 4965, 29901, 13, 4706, 903, 25442, 29918, 311, 17990, 630, 877, 489, 23176, 29899, 4965, 1495, 13, 4706, 4472, 29918, 2917, 1839, 23176, 29918, 4965, 2033, 353, 5852, 13, 13, 1678, 565, 6389, 29889, 6886, 29918, 3972, 338, 451, 6213, 29901, 13, 4706, 565, 451, 2224, 29889, 275, 3972, 29898, 5085, 29889, 6886, 29918, 3972, 1125, 13, 9651, 1596, 877, 2392, 29901, 25663, 4516, 426, 29991, 29878, 29913, 338, 451, 263, 3884, 4286, 4830, 29898, 5085, 29889, 6886, 29918, 3972, 511, 13, 462, 29871, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 4706, 282, 1514, 29889, 29873, 572, 29918, 20401, 29889, 11851, 3842, 29889, 7851, 29898, 29900, 29892, 6389, 29889, 6886, 29918, 3972, 29897, 13, 13, 1678, 396, 18601, 8363, 10585, 6790, 408, 3017, 10898, 6198, 304, 274, 9970, 13, 1678, 10876, 29889, 2084, 29889, 4397, 29898, 359, 29889, 657, 29883, 9970, 3101, 13, 13, 1678, 396, 19181, 5177, 11415, 363, 282, 1514, 2471, 1065, 515, 1788, 3268, 13, 1678, 1018, 29901, 13, 4706, 6003, 29894, 29918, 3972, 353, 2897, 29889, 21813, 1839, 29963, 8193, 29911, 29965, 1964, 29918, 25838, 2033, 13, 1678, 5174, 7670, 2392, 29901, 13, 4706, 1209, 29871, 396, 282, 1514, 471, 451, 22336, 1550, 297, 263, 6901, 5177, 13, 1678, 1683, 29901, 13, 4706, 515, 13149, 1053, 13149, 13, 4706, 515, 1320, 13239, 29889, 9675, 2917, 1053, 679, 29918, 4691, 29918, 1982, 13, 4706, 4303, 3972, 353, 679, 29918, 4691, 29918, 1982, 29898, 13506, 29922, 854, 29894, 29918, 3972, 29897, 13, 4706, 10876, 29889, 2084, 29889, 4397, 29898, 1982, 3972, 29897, 13, 4706, 396, 24062, 345, 19710, 29899, 4965, 515, 421, 14669, 29889, 2272, 2693, 29952, 470, 421, 13096, 2601, 448, 29872, 29952, 13, 4706, 396, 22615, 29901, 21829, 263, 901, 24420, 2948, 13, 4706, 363, 282, 386, 297, 13149, 29898, 2084, 29889, 7122, 29898, 1982, 3972, 29892, 525, 10521, 387, 29887, 29899, 2324, 8785, 29901, 13, 9651, 1018, 29901, 13, 18884, 411, 1722, 29898, 29886, 386, 29897, 408, 285, 29901, 13, 462, 1678, 10876, 29889, 2084, 29889, 4397, 29898, 2084, 29889, 7122, 29898, 1982, 3972, 29892, 285, 29889, 949, 1220, 2141, 29878, 17010, 22130, 13, 9651, 5174, 10663, 2392, 29901, 13, 18884, 29383, 877, 13919, 19710, 29899, 2324, 297, 6003, 29894, 29901, 426, 29991, 29878, 29913, 4286, 4830, 29898, 29886, 386, 876, 13, 13, 1678, 565, 6389, 29889, 1124, 29901, 13, 4706, 4472, 29918, 2917, 1839, 2324, 29918, 13506, 2033, 353, 5591, 29908, 13, 13, 4706, 396, 7525, 278, 7331, 1923, 29889, 13, 4706, 903, 3609, 14526, 29889, 5085, 353, 6389, 29871, 396, 6978, 8636, 304, 7331, 6004, 921, 29925, 13, 4706, 903, 3609, 14526, 29889, 6886, 29918, 2917, 353, 4472, 29918, 2917, 13, 13, 4706, 3495, 29892, 17117, 2011, 353, 6389, 29889, 1124, 29889, 16707, 877, 29901, 1495, 13, 4706, 3495, 353, 3495, 470, 22236, 29918, 20832, 13, 4706, 2011, 353, 938, 29898, 637, 470, 22236, 29918, 15082, 29897, 13, 13, 4706, 1596, 877, 4763, 292, 282, 1514, 1923, 373, 426, 6177, 8875, 4286, 4830, 29898, 3069, 29892, 2011, 511, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 4706, 1732, 29881, 353, 7331, 6004, 3552, 3069, 29892, 2011, 511, 903, 3609, 14526, 29897, 13, 4706, 1596, 703, 29886, 1514, 1923, 7960, 472, 1732, 597, 29995, 29879, 16664, 29881, 29908, 1273, 313, 3069, 29892, 2011, 511, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 13, 4706, 396, 29408, 6987, 304, 2189, 421, 29886, 1514, 29889, 11303, 3032, 1124, 29881, 29889, 845, 329, 3204, 2555, 13, 4706, 5534, 903, 1124, 29881, 13, 4706, 903, 1124, 29881, 353, 1732, 29881, 13, 13, 4706, 1018, 29901, 13, 9651, 1732, 29881, 29889, 16349, 29918, 1079, 369, 580, 13, 4706, 7146, 29901, 13, 9651, 1732, 29881, 29889, 2974, 29918, 5358, 580, 13, 9651, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 1678, 1574, 4572, 353, 6213, 13, 1678, 565, 6389, 29889, 4572, 322, 6389, 29889, 4572, 29889, 17010, 7295, 13, 4706, 822, 1574, 4572, 29898, 5415, 29892, 903, 26705, 29922, 5085, 29889, 4572, 29889, 17010, 2141, 5451, 29898, 3788, 22164, 13, 9651, 736, 738, 29898, 29888, 297, 5446, 29889, 999, 978, 470, 13, 462, 539, 338, 8758, 29898, 5415, 29892, 282, 1514, 29889, 2385, 29897, 322, 285, 297, 5446, 29889, 1514, 13, 462, 539, 363, 285, 297, 903, 26705, 29897, 13, 13, 1678, 10585, 353, 518, 29886, 1514, 29889, 7355, 29898, 5453, 29892, 1574, 4572, 29922, 1514, 4572, 29892, 13, 462, 965, 14383, 29918, 12523, 29922, 5085, 29889, 11014, 29918, 12523, 29897, 13, 1669, 363, 3883, 297, 6389, 29889, 7576, 29962, 13, 1678, 282, 1514, 29889, 2324, 29918, 262, 27069, 749, 580, 13, 13, 1678, 565, 6389, 29889, 5140, 29901, 13, 4706, 903, 2158, 29918, 5140, 29898, 7576, 29892, 3579, 6886, 29918, 2917, 29897, 13, 4706, 1053, 1426, 6312, 13, 4706, 1596, 703, 15945, 13, 8493, 29899, 2040, 2791, 3204, 3971, 304, 3918, 1962, 29889, 13, 462, 795, 6228, 16672, 16672, 16672, 16672, 16672, 16672, 16672, 13, 18455, 445, 934, 304, 11328, 773, 321, 29889, 29887, 29889, 349, 392, 542, 29901, 13, 13, 29912, 29925, 2190, 28665, 29918, 29907, 5773, 29913, 13, 13, 272, 773, 5132, 29899, 9802, 3204, 322, 10228, 29914, 1451, 456, 1974, 29914, 29956, 29895, 10922, 1762, 8493, 29901, 13, 13, 1678, 2791, 3204, 29918, 2272, 1192, 17588, 29922, 7299, 308, 2474, 13, 18884, 1192, 17588, 29922, 370, 1182, 308, 2474, 13, 18884, 1192, 17588, 29922, 5552, 29918, 1761, 1678, 2474, 13, 18884, 1192, 17588, 29922, 1753, 29918, 1761, 268, 2474, 13, 18884, 1192, 17588, 29922, 29888, 9223, 29918, 401, 29871, 2474, 13, 18884, 1192, 17588, 29922, 6661, 16953, 1678, 2474, 13, 18884, 1192, 17588, 29922, 24051, 539, 2474, 13, 18884, 1192, 17588, 29922, 328, 3712, 654, 259, 2474, 13, 18884, 1192, 17588, 29922, 3844, 442, 29891, 539, 2474, 13, 18884, 1192, 17588, 29922, 517, 29883, 3986, 2474, 13, 18884, 13552, 29889, 3487, 1405, 13552, 29889, 1420, 13, 13, 1678, 25173, 1974, 1192, 2813, 2222, 1192, 20472, 29899, 29887, 3746, 1192, 2158, 29899, 517, 29899, 5140, 29922, 5140, 29889, 5140, 13552, 29889, 1420, 13, 13, 1678, 281, 29895, 1420, 3332, 2176, 1192, 22331, 23616, 29947, 448, 29879, 319, 29946, 1192, 2158, 29899, 9799, 29899, 1853, 13552, 29889, 1420, 13552, 29889, 5140, 13, 13, 272, 2788, 29892, 472, 596, 1914, 766, 4838, 291, 1213, 29908, 1642, 4830, 29898, 29925, 2190, 28665, 29918, 29907, 5773, 29922, 726, 6312, 29889, 12860, 7373, 29925, 2190, 28665, 29918, 19795, 1529, 2797, 29892, 525, 1678, 525, 8243, 13, 795, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 1678, 363, 3883, 297, 10585, 29901, 13, 4706, 565, 6389, 29889, 1420, 29901, 13, 9651, 903, 28358, 29918, 361, 29918, 9933, 29898, 5453, 29892, 1294, 2433, 29889, 1420, 1495, 13, 9651, 16732, 29918, 3539, 29918, 5325, 29898, 5453, 29892, 1294, 2433, 29889, 1420, 742, 3579, 6886, 29918, 2917, 29897, 13, 4706, 25342, 6389, 29889, 4905, 29918, 3972, 29901, 29871, 396, 3251, 403, 1426, 2066, 13, 9651, 903, 28358, 29918, 361, 29918, 9933, 29898, 5453, 29892, 1294, 2433, 29889, 3487, 1495, 13, 9651, 16732, 29918, 3539, 29918, 5325, 29898, 5453, 29892, 1294, 2433, 29889, 3487, 742, 3579, 6886, 29918, 2917, 29897, 13, 4706, 1683, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 5453, 29889, 726, 29898, 1068, 6886, 29918, 2917, 876, 13, 9651, 396, 7803, 9654, 3454, 1546, 1023, 10585, 29915, 26442, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 359, 29889, 1915, 968, 29886, 334, 313, 29896, 718, 29871, 29906, 334, 938, 29898, 5453, 2804, 10585, 14352, 29896, 29962, 4961, 13, 13, 1678, 25081, 29878, 29918, 2917, 353, 282, 1514, 3032, 657, 29918, 2917, 29898, 1068, 6886, 29918, 2917, 467, 657, 877, 29880, 348, 29878, 29918, 4478, 1495, 13, 1678, 565, 25081, 29878, 29918, 2917, 338, 451, 6213, 29901, 13, 4706, 903, 17158, 29918, 29880, 348, 29878, 29918, 4478, 29898, 13, 9651, 10585, 29892, 25081, 29878, 29918, 2917, 29889, 657, 703, 2248, 29918, 1514, 19651, 613, 5852, 511, 4472, 29918, 2917, 29897, 13, 13, 13, 29918, 29925, 2190, 28665, 29918, 19795, 1529, 2797, 353, 14550, 29905, 13, 29886, 392, 542, 1192, 19635, 29922, 3257, 6160, 3421, 7653, 10854, 362, 29908, 1669, 2474, 13, 539, 1192, 3166, 29922, 3502, 3204, 29974, 370, 1030, 1403, 800, 29974, 4776, 29918, 755, 29918, 14369, 29918, 1627, 17057, 29871, 2474, 13, 539, 1192, 5140, 29899, 10599, 29922, 29916, 295, 403, 29916, 1192, 11918, 29922, 3396, 5657, 6160, 2772, 1764, 29963, 29884, 27677, 29908, 259, 2474, 13, 539, 1192, 517, 29883, 1192, 517, 29883, 29899, 19488, 29922, 29946, 1192, 4905, 29922, 5140, 29889, 5140, 29871, 13552, 29889, 3487, 29905, 13, 12008, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 29898, 16680, 29889, 5510, 29918, 5085, 3101, 13, 2 ]
application/model/_base.py
keysona/blog
0
5785
<gh_stars>0 from flask_sqlalchemy import SQLAlchemy, Model # class BaseModel(Model): # def save(self): # db.session.add(self) # db.session.commit(self) # def delete(self): # db.session. db = SQLAlchemy()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 29784, 29918, 2850, 284, 305, 6764, 1053, 3758, 2499, 305, 6764, 29892, 8125, 13, 13, 29937, 770, 7399, 3195, 29898, 3195, 1125, 13, 13, 29937, 822, 4078, 29898, 1311, 1125, 13, 29937, 268, 4833, 29889, 7924, 29889, 1202, 29898, 1311, 29897, 13, 29937, 268, 4833, 29889, 7924, 29889, 15060, 29898, 1311, 29897, 13, 13, 29937, 822, 5217, 29898, 1311, 1125, 13, 29937, 268, 4833, 29889, 7924, 29889, 13, 13, 2585, 353, 3758, 2499, 305, 6764, 580, 13, 2 ]
Project-2/Ishan Pandey/main_gui.py
Mercury1508/IEEE-LEAD-2.0
1
180159
<filename>Project-2/Ishan Pandey/main_gui.py from tkinter import * from PIL import ImageTk import PIL.Image import os root = Tk() root.title("Main GUI") root.geometry("800x550") root.configure(background='white') def google_search(): os.system('python google_search.py') def job_search(): os.system("python job_scrapper_gui.py") def job_compare(): os.system("python job_compare.py") option_frame = LabelFrame(root,bg="white",borderwidth=0,highlightthickness=0) google_frame = LabelFrame(option_frame,bg="white",borderwidth=0,highlightthickness=0) google_img = ImageTk.PhotoImage(PIL.Image.open("./Images\google.png")) google_img_label = Label(google_frame,image = google_img,bg='white') google_button = Button(google_frame,text="Google search",bg="white",fg="#135EC2",font=('Bahnschrift Light', 13, 'bold'),command=google_search) job_search_frame = LabelFrame(option_frame,bg="white",borderwidth=0,highlightthickness=0) job_search_img = ImageTk.PhotoImage(PIL.Image.open("./Images\logo.png")) job_search_img_label = Label(job_search_frame,image = job_search_img,bg='white') job_search_button = Button(job_search_frame,text="Job Search",bg="white",fg="#135EC2",font=('Bahnschrift Light', 13, 'bold'),command=job_search) job_compare_frame = LabelFrame(option_frame,bg="white",borderwidth=0,highlightthickness=0) job_compare_img = ImageTk.PhotoImage(PIL.Image.open("./Images\compare1.png")) job_compare_img_label=Label(job_compare_frame,image = job_compare_img,bg='white') job_compare_button = Button(job_compare_frame,text="Compare",bg="white",fg="#135EC2",font=('Bahnschrift Light', 13, 'bold'),command=job_compare) option_frame.pack(pady=50,padx=50) google_frame.pack(pady=10,padx=10) google_img_label.pack(side=LEFT,padx=10) google_button.pack(pady=25) job_search_frame.pack(pady=25,padx=5) job_search_img_label.pack(side=LEFT,padx=10) job_search_button.pack(padx=5,pady=10) job_compare_frame.pack(pady=30,padx=2) job_compare_img_label.pack(side=LEFT,padx=10) job_compare_button.pack(padx=5,pady=5) root.mainloop()
[ 1, 529, 9507, 29958, 7653, 29899, 29906, 29914, 29902, 845, 273, 349, 4182, 29891, 29914, 3396, 29918, 23569, 29889, 2272, 13, 3166, 18883, 1639, 1053, 334, 13, 3166, 349, 6227, 1053, 7084, 29911, 29895, 13, 5215, 349, 6227, 29889, 2940, 13, 5215, 2897, 29871, 13, 13, 4632, 353, 323, 29895, 580, 13, 4632, 29889, 3257, 703, 6330, 14839, 1159, 13, 4632, 29889, 19156, 703, 29947, 29900, 29900, 29916, 29945, 29945, 29900, 1159, 13, 4632, 29889, 17591, 29898, 7042, 2433, 10921, 1495, 13, 13, 1753, 5386, 29918, 4478, 7295, 13, 1678, 2897, 29889, 5205, 877, 4691, 5386, 29918, 4478, 29889, 2272, 1495, 13, 13, 1753, 4982, 29918, 4478, 7295, 13, 1678, 2897, 29889, 5205, 703, 4691, 4982, 29918, 1557, 6794, 29918, 23569, 29889, 2272, 1159, 13, 13, 1753, 4982, 29918, 18307, 7295, 13, 1678, 2897, 29889, 5205, 703, 4691, 4982, 29918, 18307, 29889, 2272, 1159, 13, 13, 3385, 29918, 2557, 353, 15796, 4308, 29898, 4632, 29892, 16264, 543, 10921, 613, 11466, 2103, 29922, 29900, 29892, 28970, 27996, 2264, 29922, 29900, 29897, 13, 13, 3608, 29918, 2557, 353, 15796, 4308, 29898, 3385, 29918, 2557, 29892, 16264, 543, 10921, 613, 11466, 2103, 29922, 29900, 29892, 28970, 27996, 2264, 29922, 29900, 29897, 13, 3608, 29918, 2492, 353, 7084, 29911, 29895, 29889, 25971, 2940, 29898, 2227, 29931, 29889, 2940, 29889, 3150, 703, 6904, 20163, 29905, 3608, 29889, 2732, 5783, 13, 3608, 29918, 2492, 29918, 1643, 353, 15796, 29898, 3608, 29918, 2557, 29892, 3027, 353, 5386, 29918, 2492, 29892, 16264, 2433, 10921, 1495, 13, 3608, 29918, 3092, 353, 11025, 29898, 3608, 29918, 2557, 29892, 726, 543, 14207, 2740, 613, 16264, 543, 10921, 613, 16434, 9880, 29896, 29941, 29945, 11206, 29906, 613, 5657, 29922, 877, 29933, 5422, 13827, 12790, 742, 29871, 29896, 29941, 29892, 525, 8934, 5477, 6519, 29922, 3608, 29918, 4478, 29897, 13, 13, 9057, 29918, 4478, 29918, 2557, 353, 15796, 4308, 29898, 3385, 29918, 2557, 29892, 16264, 543, 10921, 613, 11466, 2103, 29922, 29900, 29892, 28970, 27996, 2264, 29922, 29900, 29897, 13, 9057, 29918, 4478, 29918, 2492, 353, 7084, 29911, 29895, 29889, 25971, 2940, 29898, 2227, 29931, 29889, 2940, 29889, 3150, 703, 6904, 20163, 29905, 14569, 29889, 2732, 5783, 13, 9057, 29918, 4478, 29918, 2492, 29918, 1643, 353, 15796, 29898, 9057, 29918, 4478, 29918, 2557, 29892, 3027, 353, 4982, 29918, 4478, 29918, 2492, 29892, 16264, 2433, 10921, 1495, 13, 9057, 29918, 4478, 29918, 3092, 353, 11025, 29898, 9057, 29918, 4478, 29918, 2557, 29892, 726, 543, 11947, 11856, 613, 16264, 543, 10921, 613, 16434, 9880, 29896, 29941, 29945, 11206, 29906, 613, 5657, 29922, 877, 29933, 5422, 13827, 12790, 742, 29871, 29896, 29941, 29892, 525, 8934, 5477, 6519, 29922, 9057, 29918, 4478, 29897, 13, 13, 9057, 29918, 18307, 29918, 2557, 353, 15796, 4308, 29898, 3385, 29918, 2557, 29892, 16264, 543, 10921, 613, 11466, 2103, 29922, 29900, 29892, 28970, 27996, 2264, 29922, 29900, 29897, 13, 9057, 29918, 18307, 29918, 2492, 353, 7084, 29911, 29895, 29889, 25971, 2940, 29898, 2227, 29931, 29889, 2940, 29889, 3150, 703, 6904, 20163, 29905, 18307, 29896, 29889, 2732, 5783, 13, 9057, 29918, 18307, 29918, 2492, 29918, 1643, 29922, 4775, 29898, 9057, 29918, 18307, 29918, 2557, 29892, 3027, 353, 4982, 29918, 18307, 29918, 2492, 29892, 16264, 2433, 10921, 1495, 13, 9057, 29918, 18307, 29918, 3092, 353, 11025, 29898, 9057, 29918, 18307, 29918, 2557, 29892, 726, 543, 6843, 598, 613, 16264, 543, 10921, 613, 16434, 9880, 29896, 29941, 29945, 11206, 29906, 613, 5657, 29922, 877, 29933, 5422, 13827, 12790, 742, 29871, 29896, 29941, 29892, 525, 8934, 5477, 6519, 29922, 9057, 29918, 18307, 29897, 13, 13, 3385, 29918, 2557, 29889, 4058, 29898, 29886, 3714, 29922, 29945, 29900, 29892, 8305, 29916, 29922, 29945, 29900, 29897, 13, 13, 3608, 29918, 2557, 29889, 4058, 29898, 29886, 3714, 29922, 29896, 29900, 29892, 8305, 29916, 29922, 29896, 29900, 29897, 13, 3608, 29918, 2492, 29918, 1643, 29889, 4058, 29898, 2975, 29922, 28024, 29892, 8305, 29916, 29922, 29896, 29900, 29897, 13, 3608, 29918, 3092, 29889, 4058, 29898, 29886, 3714, 29922, 29906, 29945, 29897, 13, 13, 9057, 29918, 4478, 29918, 2557, 29889, 4058, 29898, 29886, 3714, 29922, 29906, 29945, 29892, 8305, 29916, 29922, 29945, 29897, 13, 9057, 29918, 4478, 29918, 2492, 29918, 1643, 29889, 4058, 29898, 2975, 29922, 28024, 29892, 8305, 29916, 29922, 29896, 29900, 29897, 13, 9057, 29918, 4478, 29918, 3092, 29889, 4058, 29898, 8305, 29916, 29922, 29945, 29892, 29886, 3714, 29922, 29896, 29900, 29897, 13, 13, 9057, 29918, 18307, 29918, 2557, 29889, 4058, 29898, 29886, 3714, 29922, 29941, 29900, 29892, 8305, 29916, 29922, 29906, 29897, 13, 9057, 29918, 18307, 29918, 2492, 29918, 1643, 29889, 4058, 29898, 2975, 29922, 28024, 29892, 8305, 29916, 29922, 29896, 29900, 29897, 13, 9057, 29918, 18307, 29918, 3092, 29889, 4058, 29898, 8305, 29916, 29922, 29945, 29892, 29886, 3714, 29922, 29945, 29897, 13, 13, 13, 13, 13, 4632, 29889, 3396, 7888, 580, 13, 2 ]
InterpretationTechniques/featureExamination/iceForPredictor.py
HelenaMaria112/PredictionInterpreter
1
24454
<gh_stars>1-10 ''' Created on 04.10.2019 @author: areb ''' import pycebox.ice as pIce from Connections.predictor import * import matplotlib.pyplot as plt from InterpretationTechniques.PlotAndShow import * # https://github.com/AustinRochford/PyCEbox/blob/master/pycebox/ice.py def plotIce(data, pr): ''' :param data: pandas dataframe with datasets where each row represents a dataset :param resultColumnName: Name of column in data that contains actual results :param pr: Predictor of ML-System saves and plots ICE ''' pr.setReturnDistanceOfClass(True) resultColumnName = pr.resultColumn for i in pr.listOfNumericalColumns: data[i]= data[i].astype(float).round(2).astype(str) data = pr.encode(data) columnCombinations = pr.unsortedColumnCombinations(data, resultColumnName) for columnCombination in columnCombinations: if not isinstance(columnCombination, tuple): iceResult = pIce.ice(data, columnCombination, pr.predict, num_grid_points=None) ax = pIce.ice_plot(iceResult, frac_to_plot=1., plot_points=True, point_kwargs=None, x_quantile=False, plot_pdp=True, centered=False, centered_quantile=0., color_by=None, cmap=None, ax=None, pdp_kwargs=None) ax.set_ylabel("Distance to Hyperplane of true result") ax.set_xlabel(columnCombination) ax.set_title("ICE for " + columnCombination) lines = ax.lines for lineIndex in range(len(lines)): lines[lineIndex].set_label("Dataset "+str(lineIndex)) lines[len(lines)-1].set_label("Pdp") #ax.legend(loc='upper left', bbox_to_anchor=(1, 1)) for line in ax.lines: line.set_color("k") line._linewidth = 0.5 lines[-1].linewidth=1 lines[-1].set_color("r") xValues = pr.encodingDictionary[columnCombination] ax.set_xticks(np.arange(1, len(xValues), 1)) ax.set_xticklabels(xValues[1:]) ax.tick_params(axis='both', which='major', labelsize=6) ax.tick_params(axis='both', which='minor', labelsize=6) plt.xticks(rotation=90) saveName="ice"+str(columnCombination) save(saveName, plt=plt) def bspSammlung(data): import pandas as pd pr= Predictor(returnDistanceOfClass=True) d = data.sample(3) y = pd.DataFrame(index=range(9), columns=d.columns) for i in range(len(d)): y.iloc[3 * i + 0] = d.iloc[i] y.iloc[3 * i + 0].loc["brutto"] = d.iloc[0].loc["brutto"] y.iloc[3 * i + 1] = d.iloc[i] y.iloc[3 * i + 1].loc["brutto"] = d.iloc[1].loc["brutto"] y.iloc[3 * i + 2] = d.iloc[i] y.iloc[3 * i + 2].loc["brutto"] = d.iloc[2].loc["brutto"] y.loc[:]["gknto"] = pr.predict(y).astype(str) ystr = "" for r in range(len(y)): for c in range(len(y.columns)): ystr = ystr + y.iloc[r, c][0:min(50, len(y.iloc[r, c]))] + " \n" ystr = ystr + "\n" f = open("bspDaten.txt", "w+") f.write(ystr) f.close() import pandas as pd d = data.sample(3) y = pd.DataFrame(index=range(9), columns=d.columns) for i in range(len(d)): y.iloc[3 * i + 0] = d.iloc[i] y.iloc[3 * i + 0].loc["text"] = d.iloc[0].loc["text"] y.iloc[3 * i + 1] = d.iloc[i] y.iloc[3 * i + 1].loc["text"] = d.iloc[1].loc["text"] y.iloc[3 * i + 2] = d.iloc[i] y.iloc[3 * i + 2].loc["text"] = d.iloc[2].loc["text"] y.loc[:]["gknto"] = pr.predict(y).astype(str) ystr = "" for r in range(len(y)): for c in range(len(y.columns)): ystr = ystr + y.iloc[r, c][0:min(50, len(y.iloc[r, c]))] + " \n" ystr = ystr + "\n" f = open("bspDaten.txt", "w+") f.write(ystr) f.close() def writedataToFileWPredictionhead3(data, pr): d=data[:3] y = pd.DataFrame(index=range(9), columns=(d.columns)) for i in range(len(d)): y.iloc[3 * i + 0] = d.iloc[i] y.iloc[3 * i + 0].loc["text"] = d.iloc[0].loc["text"] y.iloc[3 * i + 1] = d.iloc[i] y.iloc[3 * i + 1].loc["text"] = d.iloc[1].loc["text"] y.iloc[3 * i + 2] = d.iloc[i] y.iloc[3 * i + 2].loc["text"] = d.iloc[2].loc["text"] y["Result"] = pr.predict(y).astype(str) ystr = "" for r in range(len(y)): for c in range(len(y.columns)): ystr = ystr + y.iloc[r, c][:min(10, len(y.iloc[r, c])-1)] + " \n" ystr = ystr + "\n" f = open("bspDaten.txt", "w+") f.write(ystr) f.close()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 12008, 13, 20399, 373, 29871, 29900, 29946, 29889, 29896, 29900, 29889, 29906, 29900, 29896, 29929, 13, 13, 29992, 8921, 29901, 526, 29890, 13, 12008, 13, 5215, 11451, 346, 1884, 29889, 625, 408, 282, 29902, 346, 13, 3166, 1281, 484, 1953, 29889, 27711, 272, 1053, 334, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 4124, 19819, 362, 29911, 5309, 1240, 1912, 29889, 20867, 2855, 8964, 1053, 334, 13, 13, 29937, 2045, 597, 3292, 29889, 510, 29914, 29909, 504, 262, 29934, 2878, 4006, 29914, 19737, 4741, 1884, 29914, 10054, 29914, 6207, 29914, 2272, 346, 1884, 29914, 625, 29889, 2272, 13, 1753, 6492, 29902, 346, 29898, 1272, 29892, 544, 1125, 13, 1678, 14550, 13, 1678, 584, 3207, 848, 29901, 11701, 12205, 411, 20035, 988, 1269, 1948, 11524, 263, 8783, 13, 1678, 584, 3207, 1121, 4409, 1170, 29901, 4408, 310, 1897, 297, 848, 393, 3743, 3935, 2582, 13, 1678, 584, 3207, 544, 29901, 21099, 919, 272, 310, 23158, 29899, 3924, 13, 1678, 27401, 322, 24580, 306, 4741, 13, 1678, 14550, 13, 1678, 544, 29889, 842, 11609, 27469, 2776, 2385, 29898, 5574, 29897, 13, 1678, 1121, 4409, 1170, 353, 544, 29889, 2914, 4409, 13, 1678, 363, 474, 297, 544, 29889, 1761, 2776, 29940, 4680, 936, 14289, 29901, 13, 4706, 848, 29961, 29875, 13192, 848, 29961, 29875, 1822, 579, 668, 29898, 7411, 467, 14486, 29898, 29906, 467, 579, 668, 29898, 710, 29897, 13, 1678, 848, 353, 544, 29889, 12508, 29898, 1272, 29897, 13, 13, 1678, 1897, 1523, 2109, 800, 353, 544, 29889, 348, 24582, 4409, 1523, 2109, 800, 29898, 1272, 29892, 1121, 4409, 1170, 29897, 13, 1678, 363, 1897, 1523, 2109, 362, 297, 1897, 1523, 2109, 800, 29901, 13, 4706, 565, 451, 338, 8758, 29898, 4914, 1523, 2109, 362, 29892, 18761, 1125, 13, 9651, 14890, 3591, 353, 282, 29902, 346, 29889, 625, 29898, 1272, 29892, 1897, 1523, 2109, 362, 29892, 544, 29889, 27711, 29892, 954, 29918, 7720, 29918, 9748, 29922, 8516, 29897, 13, 13, 9651, 4853, 353, 282, 29902, 346, 29889, 625, 29918, 5317, 29898, 625, 3591, 29892, 285, 945, 29918, 517, 29918, 5317, 29922, 29896, 1696, 13, 462, 795, 6492, 29918, 9748, 29922, 5574, 29892, 1298, 29918, 19290, 29922, 8516, 29892, 13, 462, 795, 921, 29918, 12150, 488, 29922, 8824, 29892, 6492, 29918, 29886, 6099, 29922, 5574, 29892, 13, 462, 795, 24764, 29922, 8824, 29892, 24764, 29918, 12150, 488, 29922, 29900, 1696, 13, 462, 795, 2927, 29918, 1609, 29922, 8516, 29892, 274, 1958, 29922, 8516, 29892, 13, 462, 795, 4853, 29922, 8516, 29892, 282, 6099, 29918, 19290, 29922, 8516, 29897, 13, 9651, 4853, 29889, 842, 29918, 29891, 1643, 703, 27469, 304, 26078, 22116, 310, 1565, 1121, 1159, 13, 9651, 4853, 29889, 842, 29918, 29916, 1643, 29898, 4914, 1523, 2109, 362, 29897, 13, 9651, 4853, 29889, 842, 29918, 3257, 703, 12107, 363, 376, 718, 1897, 1523, 2109, 362, 29897, 13, 9651, 3454, 353, 4853, 29889, 9012, 13, 9651, 363, 1196, 3220, 297, 3464, 29898, 2435, 29898, 9012, 22164, 13, 18884, 3454, 29961, 1220, 3220, 1822, 842, 29918, 1643, 703, 16390, 24541, 15691, 710, 29898, 1220, 3220, 876, 13, 9651, 3454, 29961, 2435, 29898, 9012, 6817, 29896, 1822, 842, 29918, 1643, 703, 29925, 6099, 1159, 13, 9651, 396, 1165, 29889, 26172, 29898, 2029, 2433, 21064, 2175, 742, 289, 1884, 29918, 517, 29918, 25367, 7607, 29896, 29892, 29871, 29896, 876, 13, 13, 9651, 363, 1196, 297, 4853, 29889, 9012, 29901, 13, 18884, 1196, 29889, 842, 29918, 2780, 703, 29895, 1159, 13, 18884, 1196, 3032, 16292, 353, 29871, 29900, 29889, 29945, 13, 9651, 3454, 14352, 29896, 1822, 16292, 29922, 29896, 13, 9651, 3454, 14352, 29896, 1822, 842, 29918, 2780, 703, 29878, 1159, 13, 9651, 921, 9065, 353, 544, 29889, 22331, 11513, 29961, 4914, 1523, 2109, 362, 29962, 13, 9651, 4853, 29889, 842, 29918, 486, 7358, 29898, 9302, 29889, 279, 927, 29898, 29896, 29892, 7431, 29898, 29916, 9065, 511, 29871, 29896, 876, 13, 9651, 4853, 29889, 842, 29918, 486, 860, 21134, 29898, 29916, 9065, 29961, 29896, 29901, 2314, 13, 9651, 4853, 29889, 24667, 29918, 7529, 29898, 8990, 2433, 20313, 742, 607, 2433, 21355, 742, 3858, 2311, 29922, 29953, 29897, 13, 9651, 4853, 29889, 24667, 29918, 7529, 29898, 8990, 2433, 20313, 742, 607, 2433, 1195, 272, 742, 3858, 2311, 29922, 29953, 29897, 13, 9651, 14770, 29889, 486, 7358, 29898, 5450, 362, 29922, 29929, 29900, 29897, 13, 9651, 4078, 1170, 543, 625, 17969, 710, 29898, 4914, 1523, 2109, 362, 29897, 13, 9651, 4078, 29898, 7620, 1170, 29892, 14770, 29922, 572, 29873, 29897, 13, 13, 1753, 289, 1028, 22966, 9191, 29898, 1272, 1125, 13, 1678, 1053, 11701, 408, 10518, 13, 1678, 544, 29922, 21099, 919, 272, 29898, 2457, 27469, 2776, 2385, 29922, 5574, 29897, 13, 1678, 270, 353, 848, 29889, 11249, 29898, 29941, 29897, 13, 1678, 343, 353, 10518, 29889, 17271, 29898, 2248, 29922, 3881, 29898, 29929, 511, 4341, 29922, 29881, 29889, 13099, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29881, 22164, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 1822, 2029, 3366, 1182, 17317, 3108, 353, 270, 29889, 309, 542, 29961, 29900, 1822, 2029, 3366, 1182, 17317, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 1822, 2029, 3366, 1182, 17317, 3108, 353, 270, 29889, 309, 542, 29961, 29896, 1822, 2029, 3366, 1182, 17317, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 1822, 2029, 3366, 1182, 17317, 3108, 353, 270, 29889, 309, 542, 29961, 29906, 1822, 2029, 3366, 1182, 17317, 3108, 13, 1678, 343, 29889, 2029, 7503, 29962, 3366, 29887, 3959, 517, 3108, 353, 544, 29889, 27711, 29898, 29891, 467, 579, 668, 29898, 710, 29897, 13, 1678, 343, 710, 353, 5124, 13, 1678, 363, 364, 297, 3464, 29898, 2435, 29898, 29891, 22164, 13, 4706, 363, 274, 297, 3464, 29898, 2435, 29898, 29891, 29889, 13099, 22164, 13, 9651, 343, 710, 353, 343, 710, 718, 343, 29889, 309, 542, 29961, 29878, 29892, 274, 3816, 29900, 29901, 1195, 29898, 29945, 29900, 29892, 7431, 29898, 29891, 29889, 309, 542, 29961, 29878, 29892, 274, 12622, 29962, 718, 376, 29871, 320, 29876, 29908, 13, 4706, 343, 710, 353, 343, 710, 718, 6634, 29876, 29908, 13, 1678, 285, 353, 1722, 703, 29890, 1028, 29928, 2579, 29889, 3945, 613, 376, 29893, 29974, 1159, 13, 1678, 285, 29889, 3539, 29898, 29891, 710, 29897, 13, 1678, 285, 29889, 5358, 580, 13, 13, 1678, 1053, 11701, 408, 10518, 13, 1678, 270, 353, 848, 29889, 11249, 29898, 29941, 29897, 13, 1678, 343, 353, 10518, 29889, 17271, 29898, 2248, 29922, 3881, 29898, 29929, 511, 4341, 29922, 29881, 29889, 13099, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29881, 22164, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29900, 1822, 2029, 3366, 726, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29896, 1822, 2029, 3366, 726, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29906, 1822, 2029, 3366, 726, 3108, 13, 1678, 343, 29889, 2029, 7503, 29962, 3366, 29887, 3959, 517, 3108, 353, 544, 29889, 27711, 29898, 29891, 467, 579, 668, 29898, 710, 29897, 13, 1678, 343, 710, 353, 5124, 13, 1678, 363, 364, 297, 3464, 29898, 2435, 29898, 29891, 22164, 13, 4706, 363, 274, 297, 3464, 29898, 2435, 29898, 29891, 29889, 13099, 22164, 13, 9651, 343, 710, 353, 343, 710, 718, 343, 29889, 309, 542, 29961, 29878, 29892, 274, 3816, 29900, 29901, 1195, 29898, 29945, 29900, 29892, 7431, 29898, 29891, 29889, 309, 542, 29961, 29878, 29892, 274, 12622, 29962, 718, 376, 29871, 320, 29876, 29908, 13, 4706, 343, 710, 353, 343, 710, 718, 6634, 29876, 29908, 13, 1678, 285, 353, 1722, 703, 29890, 1028, 29928, 2579, 29889, 3945, 613, 376, 29893, 29974, 1159, 13, 1678, 285, 29889, 3539, 29898, 29891, 710, 29897, 13, 1678, 285, 29889, 5358, 580, 13, 13, 1753, 2044, 287, 532, 1762, 2283, 29956, 23084, 2463, 2813, 29941, 29898, 1272, 29892, 544, 1125, 13, 1678, 270, 29922, 1272, 7503, 29941, 29962, 13, 1678, 343, 353, 10518, 29889, 17271, 29898, 2248, 29922, 3881, 29898, 29929, 511, 4341, 7607, 29881, 29889, 13099, 876, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29881, 22164, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29900, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29900, 1822, 2029, 3366, 726, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29896, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29896, 1822, 2029, 3366, 726, 3108, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 29962, 353, 270, 29889, 309, 542, 29961, 29875, 29962, 13, 4706, 343, 29889, 309, 542, 29961, 29941, 334, 474, 718, 29871, 29906, 1822, 2029, 3366, 726, 3108, 353, 270, 29889, 309, 542, 29961, 29906, 1822, 2029, 3366, 726, 3108, 13, 13, 1678, 343, 3366, 3591, 3108, 353, 544, 29889, 27711, 29898, 29891, 467, 579, 668, 29898, 710, 29897, 13, 1678, 343, 710, 353, 5124, 13, 1678, 363, 364, 297, 3464, 29898, 2435, 29898, 29891, 22164, 13, 4706, 363, 274, 297, 3464, 29898, 2435, 29898, 29891, 29889, 13099, 22164, 13, 9651, 343, 710, 353, 343, 710, 718, 343, 29889, 309, 542, 29961, 29878, 29892, 274, 3816, 29901, 1195, 29898, 29896, 29900, 29892, 7431, 29898, 29891, 29889, 309, 542, 29961, 29878, 29892, 274, 2314, 29899, 29896, 4638, 718, 376, 29871, 320, 29876, 29908, 13, 4706, 343, 710, 353, 343, 710, 718, 6634, 29876, 29908, 13, 1678, 285, 353, 1722, 703, 29890, 1028, 29928, 2579, 29889, 3945, 613, 376, 29893, 29974, 1159, 13, 1678, 285, 29889, 3539, 29898, 29891, 710, 29897, 13, 1678, 285, 29889, 5358, 580, 2 ]
examples/exp_neurips19_MRM.py
xyguo/trimmedEM
0
105911
<reponame>xyguo/trimmedEM<gh_stars>0 import sys import numpy as np from trimmedEM import TrimmedEM from utils.grader import MRMGrader from utils.data_gen import regression_mixture, add_outliers # Experiment for Mixture of Regression Model epsilons = [0, 0.05, 0.1, 0.15, 0.2] # epsilons = [0] n_samples = 2000 mrm_sigma = 0.2 dim = 100 # sparsities = np.array([0.4, 0.2, 0.1, 0.05]) * dim # sparsities = np.array([32, 24, 16, 12, 8, 4, 2]) sparsities = np.array([15, 13, 11, 9, 7, 5, 3]) sparsities = sparsities.astype(np.int) mrm_g = MRMGrader(sigma=mrm_sigma) results_MRM = { 'eps-1': np.array(epsilons), 'err-1': [], 'sparsity-1': np.array(sparsities), 'n_samples-1': n_samples, 'dim-1': dim, 'true-beta-1': [], } n_iters = 101 n_repeats = 20 ## type 1: error v.s. n_samples / (sparsity * log(dim)), for different epsilon print("==================\ntype 1: error v.s. n_samples / (sparsity * log(dim)), for different epsilon") for r in range(n_repeats): print("===\nRepeat {}".format(r)) err_rates = [[] for _ in range(len(epsilons))] for i, eps in enumerate(results_MRM['eps-1']): n_outliers = np.int(results_MRM['n_samples-1'] * eps) results_MRM['true-beta-1'].append([]) for s in results_MRM['sparsity-1']: # re-generate data with different sparsity effective_idxs = np.random.choice(dim, size=s, replace=False) true_beta = np.zeros(dim) true_beta[effective_idxs] = 5 results_MRM['true-beta-1'][i].append(true_beta) # generate data X, Y = regression_mixture(n_samples=n_samples, n_features=dim, mean=true_beta, sigma=mrm_sigma, subspace=effective_idxs) # corrupt data arbitrarily XY = add_outliers(np.hstack((X, Y[:, np.newaxis])), n_outliers=n_outliers, dist_factor=50) X_corrupted, Y_corrupted = XY[:, :-1], XY[:, -1].ravel() # set initial point for gradient descent init_distortion = np.linalg.norm(true_beta) * \ np.random.randn(results_MRM['dim-1']) / \ (4 * np.sqrt(dim)) beta0 = true_beta + init_distortion model = TrimmedEM(n_iters=n_iters, eta=0.1, sparsity=s, alpha=0.0, grader=mrm_g, init_val=beta0) model.fit(X_corrupted, Y_corrupted) err_rates[i].append(model.loss(groundtruth=true_beta)) # print("eps={}, sparsity={}, loss={}, loss / true_beta={}" # .format(eps, s, err_rates[i][-1], err_rates[i][-1] / np.linalg.norm(true_beta))) results_MRM['err-1'].append(np.array(err_rates)) results_MRM['err-1'] = np.array(results_MRM['err-1']) results_MRM['true-beta-1'] = results_MRM['true-beta-1'] true_beta_norms = np.zeros(shape=(len(epsilons), len(sparsities))) for e in range(len(epsilons)): for s in range(len(sparsities)): true_beta_norms[e,s] = np.linalg.norm(results_MRM['true-beta-1'][e][s]) print("err-1:") print(np.mean(results_MRM['err-1'], axis=0) / true_beta_norms) ## type 2: error v.s. n_iterations, for different epsilon print("===============\nType 2: error v.s. n_iterations, for different eps\n") true_sparsity = 7 dim = 100 epsilons = [0, 0.05, 0.1, 0.15, 0.2] results_MRM['eps-2'] = np.array(epsilons) results_MRM['err-2'] = [] results_MRM['sparsity-2'] = true_sparsity results_MRM['n_samples-2'] = n_samples results_MRM['dim-2'] = dim results_MRM['true-beta-2'] = [] for r in range(n_repeats): print("===\nRepeat {}".format(r)) effective_idxs = np.random.choice(dim, size=true_sparsity, replace=False) true_beta = np.zeros(dim) true_beta[effective_idxs] = 50 results_MRM['true-beta-2'].append(true_beta) X, Y = regression_mixture(n_samples=results_MRM['n_samples-2'], n_features=results_MRM['dim-2'], mean=true_beta, sigma=mrm_sigma, subspace=effective_idxs) err_rates = [] for i, eps in enumerate(results_MRM['eps-2']): init_distortion = np.linalg.norm(results_MRM['true-beta-2'][-1]) * \ np.random.randn(results_MRM['dim-2']) / \ (4 * np.sqrt(results_MRM['dim-2'])) beta0 = results_MRM['true-beta-2'][-1] + init_distortion n_outliers = np.int(results_MRM['n_samples-2'] * eps) # corrupt data arbitrarily XY = add_outliers(np.hstack((X, Y[:, np.newaxis])), n_outliers=n_outliers, dist_factor=50) X_corrupted, Y_corrupted = XY[:, :-1], XY[:, -1].ravel() model = TrimmedEM(n_iters=n_iters, eta=0.1, sparsity=results_MRM['sparsity-2'], alpha=0.0, grader=mrm_g, init_val=beta0, groundtruth=results_MRM['true-beta-2'][-1], record_all_loss=True) model.fit(X_corrupted, Y_corrupted) err_rates.append(model.iteration_losses) # print("eps={}, final_loss={}".format(eps, err_rates[-1][-1])) results_MRM['err-2'].append(np.array(err_rates)) results_MRM['err-2'] = np.array(results_MRM['err-2']) results_MRM['true-beta-2'] = np.array(results_MRM['true-beta-2']) print("err-2:") # print(np.min(np.mean(results_MRM['err-2'] / # np.linalg.norm(results_MRM['true-beta-2'], axis=1)[:, np.newaxis, np.newaxis], # axis=0), # axis=1)) print(np.mean(results_MRM['err-2'] / np.linalg.norm(results_MRM['true-beta-2'], axis=1)[:, np.newaxis, np.newaxis], axis=0)[:, -1]) ## type III: error v.s. n_iterations, for different dim print("=================\ntype III: error v.s. n_iterations, for different dim") results_MRM['eps-3'] = 0.2 results_MRM['err-3'] = [] results_MRM['n_samples-3'] = n_samples results_MRM['dim-3'] = np.array([i * 40 for i in range(2, 7)]) # results_MRM['sparsity-3'] = (results_MRM['dim-3'] * 0.05).astype(np.int) results_MRM['sparsity-3'] = 7 results_MRM['true-beta-3'] = [] n_outliers = np.int(results_MRM['n_samples-3'] * results_MRM['eps-3']) for r in range(n_repeats): print("===\nRepeat {}".format(r)) err_rates = [] for i, d in enumerate(results_MRM['dim-3']): effective_idxs = np.random.choice(d, size=results_MRM['sparsity-3'], replace=False) true_beta = np.zeros(d) true_beta[effective_idxs] = 10 init_distortion = np.linalg.norm(true_beta) * \ np.random.randn(d) / \ (4 * np.sqrt(d)) beta0 = true_beta + init_distortion if r == 0: results_MRM['true-beta-3'].append(true_beta) X, Y = regression_mixture(n_samples=results_MRM['n_samples-3'], n_features=d, mean=true_beta, sigma=mrm_sigma, subspace=effective_idxs) # corrupt data arbitrarily XY = add_outliers(np.hstack((X, Y[:, np.newaxis])), n_outliers=n_outliers, dist_factor=50) X_corrupted, Y_corrupted = XY[:, :-1], XY[:, -1].ravel() model = TrimmedEM(n_iters=n_iters, eta=0.1, sparsity=results_MRM['sparsity-3'], alpha=0.0, grader=mrm_g, init_val=beta0, groundtruth=true_beta, record_all_loss=True) model.fit(X_corrupted, Y_corrupted) err_rates.append(model.iteration_losses) # print("dim={}, final_loss={}".format(d, err_rates[-1][-1])) results_MRM['err-3'].append(np.array(err_rates)) results_MRM['err-3'] = np.array(results_MRM['err-3']) true_beta_norm = np.array([np.linalg.norm(x) for x in results_MRM['true-beta-3']]) print("err-3:") # print(np.min(np.mean(results_MRM['err-3'], axis=0), axis=1) / true_beta_norm) print(np.mean(results_MRM['err-3'], axis=0)[:, -1] / true_beta_norm) filename_MRM = "../results_for_MRM_20190830" np.savez(filename_MRM, **results_MRM) sys.exit(0)
[ 1, 529, 276, 1112, 420, 29958, 3594, 2543, 29877, 29914, 15450, 2168, 12665, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 10876, 13, 5215, 12655, 408, 7442, 13, 3166, 17151, 2168, 12665, 1053, 1605, 326, 2168, 12665, 13, 3166, 3667, 29879, 29889, 629, 1664, 1053, 29751, 29924, 3338, 1664, 13, 3166, 3667, 29879, 29889, 1272, 29918, 1885, 1053, 17855, 29918, 2460, 15546, 29892, 788, 29918, 449, 27801, 13, 13, 29937, 1222, 15362, 363, 5493, 15546, 310, 2169, 23881, 8125, 13, 8961, 309, 787, 353, 518, 29900, 29892, 29871, 29900, 29889, 29900, 29945, 29892, 29871, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29896, 29945, 29892, 29871, 29900, 29889, 29906, 29962, 13, 29937, 321, 567, 309, 787, 353, 518, 29900, 29962, 13, 29876, 29918, 27736, 353, 29871, 29906, 29900, 29900, 29900, 13, 29885, 1758, 29918, 3754, 353, 29871, 29900, 29889, 29906, 13, 6229, 353, 29871, 29896, 29900, 29900, 13, 29937, 805, 1503, 1907, 353, 7442, 29889, 2378, 4197, 29900, 29889, 29946, 29892, 29871, 29900, 29889, 29906, 29892, 29871, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29900, 29945, 2314, 334, 3964, 13, 29937, 805, 1503, 1907, 353, 7442, 29889, 2378, 4197, 29941, 29906, 29892, 29871, 29906, 29946, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29906, 29892, 29871, 29947, 29892, 29871, 29946, 29892, 29871, 29906, 2314, 13, 29879, 862, 29879, 1907, 353, 7442, 29889, 2378, 4197, 29896, 29945, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29896, 29892, 29871, 29929, 29892, 29871, 29955, 29892, 29871, 29945, 29892, 29871, 29941, 2314, 13, 29879, 862, 29879, 1907, 353, 805, 1503, 1907, 29889, 579, 668, 29898, 9302, 29889, 524, 29897, 13, 13, 29885, 1758, 29918, 29887, 353, 29751, 29924, 3338, 1664, 29898, 3754, 29922, 29885, 1758, 29918, 3754, 29897, 13, 9902, 29918, 21055, 29924, 353, 426, 13, 1678, 525, 8961, 29899, 29896, 2396, 7442, 29889, 2378, 29898, 8961, 309, 787, 511, 13, 1678, 525, 3127, 29899, 29896, 2396, 19997, 13, 1678, 525, 29879, 862, 29879, 537, 29899, 29896, 2396, 7442, 29889, 2378, 29898, 29879, 862, 29879, 1907, 511, 13, 1678, 525, 29876, 29918, 27736, 29899, 29896, 2396, 302, 29918, 27736, 29892, 13, 1678, 525, 6229, 29899, 29896, 2396, 3964, 29892, 13, 1678, 525, 3009, 29899, 3571, 29899, 29896, 2396, 19997, 13, 29913, 13, 29876, 29918, 277, 414, 353, 29871, 29896, 29900, 29896, 13, 29876, 29918, 276, 412, 1446, 353, 29871, 29906, 29900, 13, 2277, 1134, 29871, 29896, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 27736, 847, 313, 29879, 862, 29879, 537, 334, 1480, 29898, 6229, 8243, 363, 1422, 321, 3232, 13, 2158, 703, 9166, 1360, 29905, 593, 668, 29871, 29896, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 27736, 847, 313, 29879, 862, 29879, 537, 334, 1480, 29898, 6229, 8243, 363, 1422, 321, 3232, 1159, 13, 1454, 364, 297, 3464, 29898, 29876, 29918, 276, 412, 1446, 1125, 13, 1678, 1596, 703, 1360, 2013, 29876, 1123, 11666, 6571, 1642, 4830, 29898, 29878, 876, 13, 1678, 4589, 29918, 29878, 1078, 353, 518, 2636, 363, 903, 297, 3464, 29898, 2435, 29898, 8961, 309, 787, 28166, 13, 1678, 363, 474, 29892, 321, 567, 297, 26985, 29898, 9902, 29918, 21055, 29924, 1839, 8961, 29899, 29896, 2033, 1125, 13, 4706, 302, 29918, 449, 27801, 353, 7442, 29889, 524, 29898, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29896, 2033, 334, 321, 567, 29897, 13, 4706, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29896, 13359, 4397, 4197, 2314, 13, 4706, 363, 269, 297, 2582, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29896, 2033, 29901, 13, 9651, 396, 337, 29899, 17158, 848, 411, 1422, 805, 1503, 537, 13, 9651, 11828, 29918, 333, 10351, 353, 7442, 29889, 8172, 29889, 16957, 29898, 6229, 29892, 2159, 29922, 29879, 29892, 5191, 29922, 8824, 29897, 13, 9651, 1565, 29918, 3571, 353, 7442, 29889, 3298, 359, 29898, 6229, 29897, 13, 9651, 1565, 29918, 3571, 29961, 15987, 573, 29918, 333, 10351, 29962, 353, 29871, 29945, 13, 9651, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29896, 2033, 29961, 29875, 1822, 4397, 29898, 3009, 29918, 3571, 29897, 13, 13, 9651, 396, 5706, 848, 13, 9651, 1060, 29892, 612, 353, 17855, 29918, 2460, 15546, 29898, 29876, 29918, 27736, 29922, 29876, 29918, 27736, 29892, 302, 29918, 22100, 29922, 6229, 29892, 13, 462, 462, 418, 2099, 29922, 3009, 29918, 3571, 29892, 269, 2934, 29922, 29885, 1758, 29918, 3754, 29892, 13, 462, 462, 418, 1014, 3493, 29922, 15987, 573, 29918, 333, 10351, 29897, 13, 9651, 396, 1034, 6685, 848, 9727, 6275, 13, 9651, 1060, 29979, 353, 788, 29918, 449, 27801, 29898, 9302, 29889, 29882, 1429, 3552, 29990, 29892, 612, 7503, 29892, 7442, 29889, 1482, 8990, 2314, 511, 13, 462, 795, 302, 29918, 449, 27801, 29922, 29876, 29918, 449, 27801, 29892, 13, 462, 795, 1320, 29918, 19790, 29922, 29945, 29900, 29897, 13, 9651, 1060, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 353, 1060, 29979, 7503, 29892, 8956, 29896, 1402, 1060, 29979, 7503, 29892, 448, 29896, 1822, 336, 955, 580, 13, 13, 9651, 396, 731, 2847, 1298, 363, 16030, 26815, 13, 9651, 2069, 29918, 5721, 441, 291, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 3009, 29918, 3571, 29897, 334, 320, 13, 462, 795, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29896, 11287, 847, 320, 13, 462, 795, 313, 29946, 334, 7442, 29889, 3676, 29898, 6229, 876, 13, 9651, 21762, 29900, 353, 1565, 29918, 3571, 718, 2069, 29918, 5721, 441, 291, 13, 13, 9651, 1904, 353, 1605, 326, 2168, 12665, 29898, 29876, 29918, 277, 414, 29922, 29876, 29918, 277, 414, 29892, 13, 462, 795, 634, 29874, 29922, 29900, 29889, 29896, 29892, 805, 1503, 537, 29922, 29879, 29892, 13, 462, 795, 15595, 29922, 29900, 29889, 29900, 29892, 867, 1664, 29922, 29885, 1758, 29918, 29887, 29892, 13, 462, 795, 2069, 29918, 791, 29922, 3571, 29900, 29897, 13, 9651, 1904, 29889, 9202, 29898, 29990, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 29897, 13, 9651, 4589, 29918, 29878, 1078, 29961, 29875, 1822, 4397, 29898, 4299, 29889, 6758, 29898, 2057, 509, 2806, 29922, 3009, 29918, 3571, 876, 13, 9651, 396, 1596, 703, 8961, 3790, 1118, 805, 1503, 537, 3790, 1118, 6410, 3790, 1118, 6410, 847, 1565, 29918, 3571, 3790, 5038, 13, 9651, 396, 539, 869, 4830, 29898, 8961, 29892, 269, 29892, 4589, 29918, 29878, 1078, 29961, 29875, 3816, 29899, 29896, 1402, 4589, 29918, 29878, 1078, 29961, 29875, 3816, 29899, 29896, 29962, 847, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 3009, 29918, 3571, 4961, 13, 1678, 2582, 29918, 21055, 29924, 1839, 3127, 29899, 29896, 13359, 4397, 29898, 9302, 29889, 2378, 29898, 3127, 29918, 29878, 1078, 876, 13, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29896, 2033, 353, 7442, 29889, 2378, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29896, 11287, 13, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29896, 2033, 353, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29896, 2033, 13, 3009, 29918, 3571, 29918, 12324, 29879, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 2435, 29898, 8961, 309, 787, 511, 7431, 29898, 29879, 862, 29879, 1907, 4961, 13, 1454, 321, 297, 3464, 29898, 2435, 29898, 8961, 309, 787, 22164, 13, 1678, 363, 269, 297, 3464, 29898, 2435, 29898, 29879, 862, 29879, 1907, 22164, 13, 4706, 1565, 29918, 3571, 29918, 12324, 29879, 29961, 29872, 29892, 29879, 29962, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29896, 2033, 29961, 29872, 3816, 29879, 2314, 13, 2158, 703, 3127, 29899, 29896, 29901, 1159, 13, 2158, 29898, 9302, 29889, 12676, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29896, 7464, 9685, 29922, 29900, 29897, 847, 1565, 29918, 3571, 29918, 12324, 29879, 29897, 13, 13, 2277, 1134, 29871, 29906, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 1524, 800, 29892, 363, 1422, 321, 3232, 13, 2158, 703, 4936, 2751, 1360, 2013, 29876, 1542, 29871, 29906, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 1524, 800, 29892, 363, 1422, 321, 567, 29905, 29876, 1159, 13, 3009, 29918, 29879, 862, 29879, 537, 353, 29871, 29955, 13, 6229, 353, 29871, 29896, 29900, 29900, 13, 8961, 309, 787, 353, 518, 29900, 29892, 29871, 29900, 29889, 29900, 29945, 29892, 29871, 29900, 29889, 29896, 29892, 29871, 29900, 29889, 29896, 29945, 29892, 29871, 29900, 29889, 29906, 29962, 13, 13, 9902, 29918, 21055, 29924, 1839, 8961, 29899, 29906, 2033, 353, 7442, 29889, 2378, 29898, 8961, 309, 787, 29897, 13, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 2033, 353, 5159, 13, 9902, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29906, 2033, 353, 1565, 29918, 29879, 862, 29879, 537, 13, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29906, 2033, 353, 302, 29918, 27736, 13, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29906, 2033, 353, 3964, 13, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 2033, 353, 5159, 13, 13, 1454, 364, 297, 3464, 29898, 29876, 29918, 276, 412, 1446, 1125, 13, 1678, 1596, 703, 1360, 2013, 29876, 1123, 11666, 6571, 1642, 4830, 29898, 29878, 876, 13, 1678, 11828, 29918, 333, 10351, 353, 7442, 29889, 8172, 29889, 16957, 29898, 6229, 29892, 2159, 29922, 3009, 29918, 29879, 862, 29879, 537, 29892, 5191, 29922, 8824, 29897, 13, 1678, 1565, 29918, 3571, 353, 7442, 29889, 3298, 359, 29898, 6229, 29897, 13, 1678, 1565, 29918, 3571, 29961, 15987, 573, 29918, 333, 10351, 29962, 353, 29871, 29945, 29900, 13, 1678, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 13359, 4397, 29898, 3009, 29918, 3571, 29897, 13, 1678, 1060, 29892, 612, 353, 17855, 29918, 2460, 15546, 29898, 29876, 29918, 27736, 29922, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29906, 7464, 13, 462, 795, 302, 29918, 22100, 29922, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29906, 7464, 13, 462, 795, 2099, 29922, 3009, 29918, 3571, 29892, 269, 2934, 29922, 29885, 1758, 29918, 3754, 29892, 13, 462, 795, 1014, 3493, 29922, 15987, 573, 29918, 333, 10351, 29897, 13, 1678, 4589, 29918, 29878, 1078, 353, 5159, 13, 1678, 363, 474, 29892, 321, 567, 297, 26985, 29898, 9902, 29918, 21055, 29924, 1839, 8961, 29899, 29906, 2033, 1125, 13, 4706, 2069, 29918, 5721, 441, 291, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 2033, 14352, 29896, 2314, 334, 320, 13, 462, 3986, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29906, 11287, 847, 320, 13, 462, 3986, 313, 29946, 334, 7442, 29889, 3676, 29898, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29906, 25901, 13, 4706, 21762, 29900, 353, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 2033, 14352, 29896, 29962, 718, 2069, 29918, 5721, 441, 291, 13, 4706, 302, 29918, 449, 27801, 353, 7442, 29889, 524, 29898, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29906, 2033, 334, 321, 567, 29897, 13, 13, 4706, 396, 1034, 6685, 848, 9727, 6275, 13, 4706, 1060, 29979, 353, 788, 29918, 449, 27801, 29898, 9302, 29889, 29882, 1429, 3552, 29990, 29892, 612, 7503, 29892, 7442, 29889, 1482, 8990, 2314, 511, 13, 462, 3986, 302, 29918, 449, 27801, 29922, 29876, 29918, 449, 27801, 29892, 13, 462, 3986, 1320, 29918, 19790, 29922, 29945, 29900, 29897, 13, 4706, 1060, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 353, 1060, 29979, 7503, 29892, 8956, 29896, 1402, 1060, 29979, 7503, 29892, 448, 29896, 1822, 336, 955, 580, 13, 13, 4706, 1904, 353, 1605, 326, 2168, 12665, 29898, 29876, 29918, 277, 414, 29922, 29876, 29918, 277, 414, 29892, 634, 29874, 29922, 29900, 29889, 29896, 29892, 13, 462, 3986, 805, 1503, 537, 29922, 9902, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29906, 7464, 13, 462, 3986, 15595, 29922, 29900, 29889, 29900, 29892, 867, 1664, 29922, 29885, 1758, 29918, 29887, 29892, 13, 462, 3986, 2069, 29918, 791, 29922, 3571, 29900, 29892, 13, 462, 3986, 5962, 509, 2806, 29922, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 2033, 14352, 29896, 1402, 13, 462, 3986, 2407, 29918, 497, 29918, 6758, 29922, 5574, 29897, 13, 4706, 1904, 29889, 9202, 29898, 29990, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 29897, 13, 4706, 4589, 29918, 29878, 1078, 29889, 4397, 29898, 4299, 29889, 1524, 362, 29918, 6758, 267, 29897, 13, 4706, 396, 1596, 703, 8961, 3790, 1118, 2186, 29918, 6758, 3790, 29913, 1642, 4830, 29898, 8961, 29892, 4589, 29918, 29878, 1078, 14352, 29896, 3816, 29899, 29896, 12622, 13, 1678, 2582, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 13359, 4397, 29898, 9302, 29889, 2378, 29898, 3127, 29918, 29878, 1078, 876, 13, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 2033, 353, 7442, 29889, 2378, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 11287, 13, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 2033, 353, 7442, 29889, 2378, 29898, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 11287, 13, 2158, 703, 3127, 29899, 29906, 29901, 1159, 13, 29937, 1596, 29898, 9302, 29889, 1195, 29898, 9302, 29889, 12676, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 2033, 847, 13, 29937, 462, 418, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 7464, 9685, 29922, 29896, 29897, 7503, 29892, 7442, 29889, 1482, 8990, 29892, 7442, 29889, 1482, 8990, 1402, 13, 29937, 462, 418, 9685, 29922, 29900, 511, 13, 29937, 795, 9685, 29922, 29896, 876, 13, 2158, 29898, 9302, 29889, 12676, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29906, 2033, 847, 13, 795, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29906, 7464, 9685, 29922, 29896, 29897, 7503, 29892, 7442, 29889, 1482, 8990, 29892, 7442, 29889, 1482, 8990, 1402, 13, 795, 9685, 29922, 29900, 29897, 7503, 29892, 448, 29896, 2314, 13, 13, 2277, 1134, 4786, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 1524, 800, 29892, 363, 1422, 3964, 13, 2158, 703, 9166, 2013, 593, 668, 4786, 29901, 1059, 325, 29889, 29879, 29889, 302, 29918, 1524, 800, 29892, 363, 1422, 3964, 1159, 13, 9902, 29918, 21055, 29924, 1839, 8961, 29899, 29941, 2033, 353, 29871, 29900, 29889, 29906, 13, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 2033, 353, 5159, 13, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29941, 2033, 353, 302, 29918, 27736, 13, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29941, 2033, 353, 7442, 29889, 2378, 4197, 29875, 334, 29871, 29946, 29900, 363, 474, 297, 3464, 29898, 29906, 29892, 29871, 29955, 29897, 2314, 13, 29937, 2582, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29941, 2033, 353, 313, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29941, 2033, 334, 29871, 29900, 29889, 29900, 29945, 467, 579, 668, 29898, 9302, 29889, 524, 29897, 13, 9902, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29941, 2033, 353, 29871, 29955, 13, 9902, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29941, 2033, 353, 5159, 13, 13, 29876, 29918, 449, 27801, 353, 7442, 29889, 524, 29898, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29941, 2033, 334, 2582, 29918, 21055, 29924, 1839, 8961, 29899, 29941, 11287, 13, 1454, 364, 297, 3464, 29898, 29876, 29918, 276, 412, 1446, 1125, 13, 1678, 1596, 703, 1360, 2013, 29876, 1123, 11666, 6571, 1642, 4830, 29898, 29878, 876, 13, 1678, 4589, 29918, 29878, 1078, 353, 5159, 13, 1678, 363, 474, 29892, 270, 297, 26985, 29898, 9902, 29918, 21055, 29924, 1839, 6229, 29899, 29941, 2033, 1125, 13, 4706, 11828, 29918, 333, 10351, 353, 7442, 29889, 8172, 29889, 16957, 29898, 29881, 29892, 2159, 29922, 9902, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29941, 7464, 13, 462, 462, 3986, 5191, 29922, 8824, 29897, 13, 4706, 1565, 29918, 3571, 353, 7442, 29889, 3298, 359, 29898, 29881, 29897, 13, 4706, 1565, 29918, 3571, 29961, 15987, 573, 29918, 333, 10351, 29962, 353, 29871, 29896, 29900, 13, 4706, 2069, 29918, 5721, 441, 291, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 3009, 29918, 3571, 29897, 334, 320, 13, 462, 3986, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29881, 29897, 847, 320, 13, 462, 3986, 313, 29946, 334, 7442, 29889, 3676, 29898, 29881, 876, 13, 4706, 21762, 29900, 353, 1565, 29918, 3571, 718, 2069, 29918, 5721, 441, 291, 13, 13, 4706, 565, 364, 1275, 29871, 29900, 29901, 13, 9651, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29941, 13359, 4397, 29898, 3009, 29918, 3571, 29897, 13, 4706, 1060, 29892, 612, 353, 17855, 29918, 2460, 15546, 29898, 29876, 29918, 27736, 29922, 9902, 29918, 21055, 29924, 1839, 29876, 29918, 27736, 29899, 29941, 7464, 13, 462, 462, 29871, 302, 29918, 22100, 29922, 29881, 29892, 13, 462, 462, 29871, 2099, 29922, 3009, 29918, 3571, 29892, 13, 462, 462, 29871, 269, 2934, 29922, 29885, 1758, 29918, 3754, 29892, 13, 462, 462, 29871, 1014, 3493, 29922, 15987, 573, 29918, 333, 10351, 29897, 13, 13, 4706, 396, 1034, 6685, 848, 9727, 6275, 13, 4706, 1060, 29979, 353, 788, 29918, 449, 27801, 29898, 9302, 29889, 29882, 1429, 3552, 29990, 29892, 612, 7503, 29892, 7442, 29889, 1482, 8990, 2314, 511, 13, 462, 3986, 302, 29918, 449, 27801, 29922, 29876, 29918, 449, 27801, 29892, 13, 462, 3986, 1320, 29918, 19790, 29922, 29945, 29900, 29897, 13, 4706, 1060, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 353, 1060, 29979, 7503, 29892, 8956, 29896, 1402, 1060, 29979, 7503, 29892, 448, 29896, 1822, 336, 955, 580, 13, 13, 4706, 1904, 353, 1605, 326, 2168, 12665, 29898, 29876, 29918, 277, 414, 29922, 29876, 29918, 277, 414, 29892, 634, 29874, 29922, 29900, 29889, 29896, 29892, 13, 462, 3986, 805, 1503, 537, 29922, 9902, 29918, 21055, 29924, 1839, 29879, 862, 29879, 537, 29899, 29941, 7464, 13, 462, 3986, 15595, 29922, 29900, 29889, 29900, 29892, 867, 1664, 29922, 29885, 1758, 29918, 29887, 29892, 13, 462, 3986, 2069, 29918, 791, 29922, 3571, 29900, 29892, 13, 462, 3986, 5962, 509, 2806, 29922, 3009, 29918, 3571, 29892, 2407, 29918, 497, 29918, 6758, 29922, 5574, 29897, 13, 4706, 1904, 29889, 9202, 29898, 29990, 29918, 2616, 14214, 29892, 612, 29918, 2616, 14214, 29897, 13, 4706, 4589, 29918, 29878, 1078, 29889, 4397, 29898, 4299, 29889, 1524, 362, 29918, 6758, 267, 29897, 13, 4706, 396, 1596, 703, 6229, 3790, 1118, 2186, 29918, 6758, 3790, 29913, 1642, 4830, 29898, 29881, 29892, 4589, 29918, 29878, 1078, 14352, 29896, 3816, 29899, 29896, 12622, 13, 1678, 2582, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 13359, 4397, 29898, 9302, 29889, 2378, 29898, 3127, 29918, 29878, 1078, 876, 13, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 2033, 353, 7442, 29889, 2378, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 11287, 13, 3009, 29918, 3571, 29918, 12324, 353, 7442, 29889, 2378, 4197, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29916, 29897, 363, 921, 297, 2582, 29918, 21055, 29924, 1839, 3009, 29899, 3571, 29899, 29941, 2033, 2314, 13, 2158, 703, 3127, 29899, 29941, 29901, 1159, 13, 29937, 1596, 29898, 9302, 29889, 1195, 29898, 9302, 29889, 12676, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 7464, 9685, 29922, 29900, 511, 9685, 29922, 29896, 29897, 847, 1565, 29918, 3571, 29918, 12324, 29897, 13, 2158, 29898, 9302, 29889, 12676, 29898, 9902, 29918, 21055, 29924, 1839, 3127, 29899, 29941, 7464, 9685, 29922, 29900, 29897, 7503, 29892, 448, 29896, 29962, 847, 1565, 29918, 3571, 29918, 12324, 29897, 13, 13, 9507, 29918, 21055, 29924, 353, 376, 6995, 9902, 29918, 1454, 29918, 21055, 29924, 29918, 29906, 29900, 29896, 29929, 29900, 29947, 29941, 29900, 29908, 13, 9302, 29889, 7620, 29920, 29898, 9507, 29918, 21055, 29924, 29892, 3579, 9902, 29918, 21055, 29924, 29897, 13, 13, 9675, 29889, 13322, 29898, 29900, 29897, 13, 2 ]
datahub_core/printable.py
grovesy/datahub
67
40886
<reponame>grovesy/datahub<filename>datahub_core/printable.py from pprint import pformat class Printable: def __repr__(self): return "<" + type(self).__name__ + "> " + pformat(vars(self), indent=4, width=1)
[ 1, 529, 276, 1112, 420, 29958, 17170, 1960, 29891, 29914, 1272, 29882, 431, 29966, 9507, 29958, 1272, 29882, 431, 29918, 3221, 29914, 2158, 519, 29889, 2272, 13, 3166, 282, 2158, 1053, 282, 4830, 13, 13, 1990, 13905, 519, 29901, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 13, 4706, 736, 9872, 29908, 718, 1134, 29898, 1311, 467, 1649, 978, 1649, 718, 376, 29958, 376, 718, 282, 4830, 29898, 16908, 29898, 1311, 511, 29536, 29922, 29946, 29892, 2920, 29922, 29896, 29897, 13, 2 ]
src/zope/app/content/__init__.py
zopefoundation/zope.app.content
0
8270
<reponame>zopefoundation/zope.app.content<filename>src/zope/app/content/__init__.py ############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Content Type convenience lookup functions.""" from zope.interface import provider from zope.interface import providedBy from zope.schema.interfaces import IVocabularyFactory from zope.app.content.interfaces import IContentType from zope.componentvocabulary.vocabulary import UtilityVocabulary from zope.security.proxy import removeSecurityProxy def queryType(object, interface): """Returns the object's interface which implements interface. >>> from zope.interface import Interface >>> class IContentType(Interface): ... pass >>> from zope.interface import Interface, implementer, directlyProvides >>> class I(Interface): ... pass >>> class J(Interface): ... pass >>> directlyProvides(I, IContentType) >>> @implementer(I) ... class C(object): ... pass >>> @implementer(J, I) ... class D(object): ... pass >>> obj = C() >>> c1_ctype = queryType(obj, IContentType) >>> c1_ctype.__name__ 'I' >>> class I1(I): ... pass >>> class I2(I1): ... pass >>> class I3(Interface): ... pass >>> @implementer(I1) ... class C1(object): ... pass >>> obj1 = C1() >>> c1_ctype = queryType(obj1, IContentType) >>> c1_ctype.__name__ 'I' >>> @implementer(I2) ... class C2(object): ... pass >>> obj2 = C2() >>> c2_ctype = queryType(obj2, IContentType) >>> c2_ctype.__name__ 'I' >>> @implementer(I3) ... class C3(object): ... pass >>> obj3 = C3() If Interface doesn't provide `IContentType`, `queryType` returns ``None``. >>> c3_ctype = queryType(obj3, IContentType) >>> c3_ctype >>> c3_ctype is None True >>> class I4(I): ... pass >>> directlyProvides(I4, IContentType) >>> @implementer(I4) ... class C4(object): ... pass >>> obj4 = C4() >>> c4_ctype = queryType(obj4, IContentType) >>> c4_ctype.__name__ 'I4' """ # Remove the security proxy, so that we can introspect the type of the # object's interfaces. naked = removeSecurityProxy(object) object_iro = providedBy(naked).__iro__ for iface in object_iro: if interface.providedBy(iface): return iface return None def queryContentType(object): """Returns the interface implemented by object which implements :class:`zope.app.content.interfaces.IContentType`. >>> from zope.interface import Interface, implementer, directlyProvides >>> class I(Interface): ... pass >>> directlyProvides(I, IContentType) >>> @implementer(I) ... class C(object): ... pass >>> obj = C() >>> c1_ctype = queryContentType(obj) >>> c1_ctype.__name__ 'I' """ return queryType(object, IContentType) @provider(IVocabularyFactory) class ContentTypesVocabulary(UtilityVocabulary): interface = IContentType
[ 1, 529, 276, 1112, 420, 29958, 29920, 2300, 11940, 362, 29914, 29920, 2300, 29889, 932, 29889, 3051, 29966, 9507, 29958, 4351, 29914, 29920, 2300, 29914, 932, 29914, 3051, 29914, 1649, 2344, 26914, 2272, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29906, 796, 2300, 10606, 322, 2866, 1091, 29560, 29889, 13, 29937, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 910, 7047, 338, 4967, 304, 278, 1326, 12112, 310, 278, 796, 2300, 5236, 19245, 29892, 13, 29937, 10079, 29871, 29906, 29889, 29896, 313, 29999, 7390, 467, 29871, 319, 3509, 310, 278, 796, 7390, 881, 10259, 1384, 445, 4978, 29889, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 29908, 5300, 13764, 29979, 5300, 15149, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 13, 29937, 399, 1718, 29934, 13566, 29059, 319, 1525, 28657, 13875, 8890, 29928, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 6093, 306, 3580, 5265, 3352, 13, 29937, 399, 1718, 29934, 13566, 29059, 8079, 323, 1806, 1307, 29892, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 319, 12739, 25580, 2672, 15860, 1177, 1692, 13780, 29892, 5300, 383, 1806, 8186, 1799, 13, 29937, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 13, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 15945, 29908, 3916, 5167, 29703, 16280, 3168, 1213, 15945, 13, 13, 3166, 503, 2300, 29889, 13248, 1053, 13113, 13, 3166, 503, 2300, 29889, 13248, 1053, 4944, 2059, 13, 3166, 503, 2300, 29889, 11010, 29889, 1639, 8726, 1053, 6599, 542, 370, 352, 653, 5126, 13, 3166, 503, 2300, 29889, 932, 29889, 3051, 29889, 1639, 8726, 1053, 306, 3916, 1542, 13, 3166, 503, 2300, 29889, 9700, 29894, 542, 370, 352, 653, 29889, 29894, 542, 370, 352, 653, 1053, 22310, 537, 29963, 542, 370, 352, 653, 13, 3166, 503, 2300, 29889, 8926, 29889, 14701, 1053, 3349, 13228, 14048, 13, 13, 13, 1753, 2346, 1542, 29898, 3318, 29892, 5067, 1125, 13, 1678, 9995, 11609, 29879, 278, 1203, 29915, 29879, 5067, 607, 10703, 5067, 29889, 13, 13, 1678, 8653, 515, 503, 2300, 29889, 13248, 1053, 25796, 13, 1678, 8653, 770, 306, 3916, 1542, 29898, 10448, 1125, 13, 1678, 2023, 1678, 1209, 13, 1678, 8653, 515, 503, 2300, 29889, 13248, 1053, 25796, 29892, 2334, 261, 29892, 4153, 1184, 29894, 2247, 13, 1678, 8653, 770, 306, 29898, 10448, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 770, 435, 29898, 10448, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 4153, 1184, 29894, 2247, 29898, 29902, 29892, 306, 3916, 1542, 29897, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29897, 13, 1678, 2023, 770, 315, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29967, 29892, 306, 29897, 13, 1678, 2023, 770, 360, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 13, 1678, 8653, 5446, 353, 315, 580, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 353, 2346, 1542, 29898, 5415, 29892, 306, 3916, 1542, 29897, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 17255, 978, 1649, 13, 1678, 525, 29902, 29915, 13, 1678, 8653, 770, 306, 29896, 29898, 29902, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 770, 306, 29906, 29898, 29902, 29896, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 770, 306, 29941, 29898, 10448, 1125, 13, 1678, 2023, 268, 1209, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29896, 29897, 13, 1678, 2023, 770, 315, 29896, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 13, 1678, 8653, 5446, 29896, 353, 315, 29896, 580, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 353, 2346, 1542, 29898, 5415, 29896, 29892, 306, 3916, 1542, 29897, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 17255, 978, 1649, 13, 1678, 525, 29902, 29915, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29906, 29897, 13, 1678, 2023, 770, 315, 29906, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 5446, 29906, 353, 315, 29906, 580, 13, 1678, 8653, 274, 29906, 29918, 312, 668, 353, 2346, 1542, 29898, 5415, 29906, 29892, 306, 3916, 1542, 29897, 13, 1678, 8653, 274, 29906, 29918, 312, 668, 17255, 978, 1649, 13, 1678, 525, 29902, 29915, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29941, 29897, 13, 1678, 2023, 770, 315, 29941, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 5446, 29941, 353, 315, 29941, 580, 13, 13, 1678, 960, 25796, 1838, 29915, 29873, 3867, 421, 29902, 3916, 1542, 1673, 421, 1972, 1542, 29952, 3639, 4954, 8516, 29952, 1412, 13, 13, 1678, 8653, 274, 29941, 29918, 312, 668, 353, 2346, 1542, 29898, 5415, 29941, 29892, 306, 3916, 1542, 29897, 13, 1678, 8653, 274, 29941, 29918, 312, 668, 13, 1678, 8653, 274, 29941, 29918, 312, 668, 338, 6213, 13, 1678, 5852, 13, 1678, 8653, 770, 306, 29946, 29898, 29902, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 4153, 1184, 29894, 2247, 29898, 29902, 29946, 29892, 306, 3916, 1542, 29897, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29946, 29897, 13, 1678, 2023, 770, 315, 29946, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 5446, 29946, 353, 315, 29946, 580, 13, 1678, 8653, 274, 29946, 29918, 312, 668, 353, 2346, 1542, 29898, 5415, 29946, 29892, 306, 3916, 1542, 29897, 13, 1678, 8653, 274, 29946, 29918, 312, 668, 17255, 978, 1649, 13, 1678, 525, 29902, 29946, 29915, 13, 13, 1678, 9995, 13, 1678, 396, 15154, 278, 6993, 10166, 29892, 577, 393, 591, 508, 25956, 1103, 278, 1134, 310, 278, 13, 1678, 396, 1203, 29915, 29879, 19510, 29889, 13, 1678, 302, 12535, 353, 3349, 13228, 14048, 29898, 3318, 29897, 13, 1678, 1203, 29918, 3350, 353, 4944, 2059, 29898, 8546, 287, 467, 1649, 3350, 1649, 13, 1678, 363, 565, 815, 297, 1203, 29918, 3350, 29901, 13, 4706, 565, 5067, 29889, 16123, 2618, 2059, 29898, 361, 815, 1125, 13, 9651, 736, 565, 815, 13, 1678, 736, 6213, 13, 13, 13, 1753, 2346, 3916, 1542, 29898, 3318, 1125, 13, 1678, 9995, 11609, 29879, 278, 5067, 8762, 491, 1203, 607, 10703, 13, 1678, 584, 1990, 18078, 29920, 2300, 29889, 932, 29889, 3051, 29889, 1639, 8726, 29889, 29902, 3916, 1542, 1412, 13, 13, 1678, 8653, 515, 503, 2300, 29889, 13248, 1053, 25796, 29892, 2334, 261, 29892, 4153, 1184, 29894, 2247, 13, 1678, 8653, 770, 306, 29898, 10448, 1125, 13, 1678, 2023, 268, 1209, 13, 1678, 8653, 4153, 1184, 29894, 2247, 29898, 29902, 29892, 306, 3916, 1542, 29897, 13, 13, 1678, 8653, 732, 326, 2037, 261, 29898, 29902, 29897, 13, 1678, 2023, 770, 315, 29898, 3318, 1125, 13, 1678, 2023, 268, 1209, 13, 13, 1678, 8653, 5446, 353, 315, 580, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 353, 2346, 3916, 1542, 29898, 5415, 29897, 13, 1678, 8653, 274, 29896, 29918, 312, 668, 17255, 978, 1649, 13, 1678, 525, 29902, 29915, 13, 13, 1678, 9995, 13, 1678, 736, 2346, 1542, 29898, 3318, 29892, 306, 3916, 1542, 29897, 13, 13, 13, 29992, 18121, 29898, 5667, 542, 370, 352, 653, 5126, 29897, 13, 1990, 10576, 10562, 29963, 542, 370, 352, 653, 29898, 7270, 537, 29963, 542, 370, 352, 653, 1125, 13, 1678, 5067, 353, 306, 3916, 1542, 13, 2 ]
serial_for_humans/utils.py
PeterMitrano/SerialForHumans
0
182525
<reponame>PeterMitrano/SerialForHumans<gh_stars>0 from asciimatics.event import KeyboardEvent from asciimatics.widgets import Frame, TextBox, Text class MyTextBox(TextBox): def __init__(self, height, label=None, name=None, as_string=False, on_change=None): super(TextBox, self).__init__(height, label, name, as_string, on_change) self.disabled = True class MyFrame(Frame): def __init__(self, screen, model, data=None): super(MyFrame, self).__init__(screen, screen.height, screen.width, hover_focus=True, has_border=False, reduce_cpu=True, data=data) self._model = model self.screen = screen # Set up color scheme self.palette['background'] = (0, 0, 0) self.palette['borders'] = (7, 0, 0) self.palette['title'] = (7, 0, 0) self.palette['label'] = (2, 0, 0) self.palette['disabled'] = (7, 0, 0) self.palette['edit_text'] = (7, 0, 0) self.palette['focus_edit_text'] = (7, 0, 0) self.palette['button'] = (2, 0, 0) self.palette['focus_button'] = (2, 1, 0) self.palette['control'] = (7, 0, 0) self.palette['focus_control'] = (7, 0, 0) self.palette['selected_control'] = (7, 0, 0) self.palette['selected_focus_control'] = (7, 1, 0) self.palette['field'] = (7, 0, 0) self.palette['focus_field'] = (7, 0, 0) self.palette['selected_field'] = (0, 0, 7) self.palette['selected_focus_field'] = (0, 0, 7) class InputText(Text): KEY_ENTER = 10 def __init__(self, writer, label=None, name=None, on_change=None): super(InputText, self).__init__(label, name, on_change) self.writer = writer def process_event(self, event): if isinstance(event, KeyboardEvent): if event.key_code == InputText.KEY_ENTER: message_to_write = self.value self.value = "" self.reset() self.writer(message_to_write) else: return super().process_event(event) else: return super().process_event(event)
[ 1, 529, 276, 1112, 420, 29958, 23686, 29924, 277, 12776, 29914, 9125, 2831, 29950, 398, 550, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 408, 455, 15840, 1199, 29889, 3696, 1053, 7670, 3377, 2624, 13, 3166, 408, 455, 15840, 1199, 29889, 8030, 29879, 1053, 12218, 29892, 3992, 3313, 29892, 3992, 13, 13, 13, 1990, 1619, 15102, 29898, 15102, 1125, 13, 13, 4706, 822, 4770, 2344, 12035, 1311, 29892, 3171, 29892, 3858, 29922, 8516, 29892, 1024, 29922, 8516, 29892, 408, 29918, 1807, 29922, 8824, 29892, 13, 462, 268, 373, 29918, 3167, 29922, 8516, 1125, 13, 9651, 2428, 29898, 15102, 29892, 1583, 467, 1649, 2344, 12035, 3545, 29892, 3858, 29892, 1024, 29892, 408, 29918, 1807, 29892, 373, 29918, 3167, 29897, 13, 9651, 1583, 29889, 18279, 353, 5852, 13, 13, 13, 1990, 1619, 4308, 29898, 4308, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4315, 29892, 1904, 29892, 848, 29922, 8516, 1125, 13, 4706, 2428, 29898, 3421, 4308, 29892, 1583, 467, 1649, 2344, 12035, 10525, 29892, 4315, 29889, 3545, 29892, 4315, 29889, 2103, 29892, 16758, 29918, 18037, 29922, 5574, 29892, 13, 462, 462, 418, 756, 29918, 11466, 29922, 8824, 29892, 10032, 29918, 21970, 29922, 5574, 29892, 848, 29922, 1272, 29897, 13, 4706, 1583, 3032, 4299, 353, 1904, 13, 4706, 1583, 29889, 10525, 353, 4315, 13, 13, 4706, 396, 3789, 701, 2927, 11380, 13, 4706, 1583, 29889, 29886, 26456, 1839, 7042, 2033, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 29890, 20488, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 3257, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 1643, 2033, 353, 313, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 18279, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 5628, 29918, 726, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 18037, 29918, 5628, 29918, 726, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 3092, 2033, 353, 313, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 18037, 29918, 3092, 2033, 353, 313, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 6451, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 18037, 29918, 6451, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 8391, 29918, 6451, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 8391, 29918, 18037, 29918, 6451, 2033, 353, 313, 29955, 29892, 29871, 29896, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 2671, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 18037, 29918, 2671, 2033, 353, 313, 29955, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 8391, 29918, 2671, 2033, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29955, 29897, 13, 4706, 1583, 29889, 29886, 26456, 1839, 8391, 29918, 18037, 29918, 2671, 2033, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29955, 29897, 13, 13, 13, 1990, 10567, 1626, 29898, 1626, 1125, 13, 13, 1678, 14636, 29918, 3919, 1001, 353, 29871, 29896, 29900, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9227, 29892, 3858, 29922, 8516, 29892, 1024, 29922, 8516, 29892, 373, 29918, 3167, 29922, 8516, 1125, 13, 4706, 2428, 29898, 4290, 1626, 29892, 1583, 467, 1649, 2344, 12035, 1643, 29892, 1024, 29892, 373, 29918, 3167, 29897, 13, 4706, 1583, 29889, 13236, 353, 9227, 13, 13, 1678, 822, 1889, 29918, 3696, 29898, 1311, 29892, 1741, 1125, 13, 4706, 565, 338, 8758, 29898, 3696, 29892, 7670, 3377, 2624, 1125, 13, 9651, 565, 1741, 29889, 1989, 29918, 401, 1275, 10567, 1626, 29889, 10818, 29918, 3919, 1001, 29901, 13, 18884, 2643, 29918, 517, 29918, 3539, 353, 1583, 29889, 1767, 13, 18884, 1583, 29889, 1767, 353, 5124, 13, 18884, 1583, 29889, 12071, 580, 13, 18884, 1583, 29889, 13236, 29898, 4906, 29918, 517, 29918, 3539, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 2428, 2141, 5014, 29918, 3696, 29898, 3696, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 2428, 2141, 5014, 29918, 3696, 29898, 3696, 29897, 2 ]
migrations/versions/dd503a5987b5_.py
atwh0405/miniblog
0
40362
<reponame>atwh0405/miniblog """empty message Revision ID: dd503a5987b5 Revises: <KEY> Create Date: 2016-08-30 16:48:54.954000 """ # revision identifiers, used by Alembic. revision = 'dd503a5987b5' down_revision = '<KEY>' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('users', sa.Column('name', sa.String(length=64), nullable=True)) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.drop_column('users', 'name') ### end Alembic commands ###
[ 1, 529, 276, 1112, 420, 29958, 271, 1332, 29900, 29946, 29900, 29945, 29914, 1195, 747, 1188, 13, 15945, 29908, 6310, 2643, 13, 13, 1123, 4924, 3553, 29901, 24488, 29945, 29900, 29941, 29874, 29945, 29929, 29947, 29955, 29890, 29945, 13, 1123, 1730, 267, 29901, 529, 10818, 29958, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29953, 29899, 29900, 29947, 29899, 29941, 29900, 29871, 29896, 29953, 29901, 29946, 29947, 29901, 29945, 29946, 29889, 29929, 29945, 29946, 29900, 29900, 29900, 13, 13, 15945, 29908, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 525, 1289, 29945, 29900, 29941, 29874, 29945, 29929, 29947, 29955, 29890, 29945, 29915, 13, 3204, 29918, 276, 4924, 353, 12801, 10818, 16299, 13, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 1202, 29918, 4914, 877, 7193, 742, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 29898, 2848, 29922, 29953, 29946, 511, 1870, 519, 29922, 5574, 876, 13, 1678, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 8865, 29918, 4914, 877, 7193, 742, 525, 978, 1495, 13, 1678, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 2 ]
src/payu_payment/serializers.py
wilantury/payu_integration_backend
0
60895
<filename>src/payu_payment/serializers.py from rest_framework import serializers from .models import LogPurchase class LogPurchaseSerializer(serializers.ModelSerializer): class Meta: model = LogPurchase fields = '__all__'
[ 1, 529, 9507, 29958, 4351, 29914, 10472, 29884, 29918, 27825, 29914, 15550, 19427, 29889, 2272, 13, 13, 3166, 1791, 29918, 4468, 1053, 7797, 19427, 13, 3166, 869, 9794, 1053, 4522, 29925, 27574, 13, 13, 13, 1990, 4522, 29925, 27574, 17679, 29898, 15550, 19427, 29889, 3195, 17679, 1125, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 4522, 29925, 27574, 13, 4706, 4235, 353, 525, 1649, 497, 1649, 29915, 2 ]
product/views/classy_views.py
bootandy/flask-sample
2
157199
<gh_stars>1-10 from flask import Flask, render_template from flask.ext.classy import FlaskView from product import app from product.models import * class UserView(FlaskView): def index(self): users = User.objects() return render_template('users/index.html', users=users) def get(self, id): user = User.objects.get(id=id) return render_template('users/single.html', user=user) UserView.register(app)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 29784, 1053, 2379, 1278, 29892, 4050, 29918, 6886, 13, 3166, 29784, 29889, 1062, 29889, 1990, 29891, 1053, 2379, 1278, 1043, 13, 13, 3166, 3234, 1053, 623, 13, 3166, 3234, 29889, 9794, 1053, 334, 13, 13, 13, 1990, 4911, 1043, 29898, 8754, 1278, 1043, 1125, 13, 1678, 822, 2380, 29898, 1311, 1125, 13, 4706, 4160, 353, 4911, 29889, 12650, 580, 13, 4706, 736, 4050, 29918, 6886, 877, 7193, 29914, 2248, 29889, 1420, 742, 4160, 29922, 7193, 29897, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1178, 1125, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 333, 29922, 333, 29897, 13, 4706, 736, 4050, 29918, 6886, 877, 7193, 29914, 14369, 29889, 1420, 742, 1404, 29922, 1792, 29897, 13, 13, 13, 2659, 1043, 29889, 9573, 29898, 932, 29897, 13, 2 ]
FortressOfSolitude/_FortressOfSolitude/NeutrinoKey/models.py
BDD16/FortressOfSolitude
0
27852
""" DBA 1337_TECH, AUSTIN TEXAS © MAY 2020 Proof of Concept code, No liabilities or warranties expressed or implied. """ # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from datetime import datetime from .cryptoutils import CryptoTools from base64 import b64encode, b64decode from django.contrib.auth import get_user_model from random import random # Create your models here. # Constants LENGTH_OF_KEK = 32 # 256 bits or 32 bytes LENGTH_OF_DEK = 32 # 256 bits or 32 bytes LENGTH_OF_SALT = 32 # 256 bits or 32 bytes ''' KeyMold is a models.Manager clas extension that includes creating a Kek and retrieving a kek no inputs ''' class KeyMold(models.Manager): def _create_kek(request, **kwargs): pwd = <PASSWORD>.user.password # print("deriving kek") self.kek = DeriveKek_default(pwd) return self.kek def get_queryset(self): qs = models.QuerySet(self.model) if self._db is not None: qs = qs.using('default') return qs ''' TelescopeCoord is a models.Manager that allows to find the neutron star that will be used for the keyMold to make a Key Encryption Key [kek]. no inputs ''' class TelescopeCoord(models.Manager): def get_queryset(self): qs = models.QuerySet(self.model) if self._db is not None: qs = qs.using('default') return qs ''' QuasiPlasma is a models.Manager that allows for deriving Data Encryption Keys [DEKs] and retrieving deks from the neutron stars plasma. no inputs ''' class QuasiPlasma(models.Manager): def _create_dek(request, **kwargs): pwd = request.user.password self.dek = DeriveDek_default(pwd) return self.dek def get_queryset(self): qs = models.QuerySet(self.model) if self._db is not None: qs = qs.using('default') return qs ''' KEK is the Key encryption Key [KEK] model.Model class extension that has the ability to derive a new KEK as well as wrap the KEK. no inputs ''' class KEK(models.Model): # Never should the key be passed as clear text always use the wrap or unwrap functions crypto = CryptoTools() kek = None wrappedKek = None result_wrapped_nonce = models.CharField(max_length=128, default=b64encode(int(55).to_bytes(4, 'big'))) result_wrapped_kek = models.CharField(max_length=128, default=None) objects = TelescopeCoord() class Meta: verbose_name = 'KEK' def unwrap_key(self, password): if isinstance(password, str) and self.kek == None and self.wrappedKek == None: self.crypto.nonce = b64decode(self.result_wrapped_nonce) self.kek = self.crypto.AesDecryptEAX(b64decode(self.result_wrapped_kek), self.crypto.Sha256(password.encode())) if isinstance(password, bytes) and self.kek == None and self.wrappedKek == None: if isinstance(self.result_wrapped_nonce, str): result_wrapped_nonce = (self.result_wrapped_nonce.encode()).replace(b"b'", b'') result_wrapped_nonce = result_wrapped_nonce[:-1] result_wrapped_nonce = result_wrapped_nonce + b'=' * (len(self.result_wrapped_nonce) % 4) self.crypto.nonce = b64decode(result_wrapped_nonce) else: self.crypto.nonce = b64decode(self.result_wrapped_nonce) # print("wrappedKek: " + self.result_wrapped_kek) if isinstance(self.result_wrapped_kek, str): result_wrapped_kek = (self.result_wrapped_kek.encode()).replace(b"b'", b'') result_wrapped_kek = result_wrapped_kek[:-1] result_wrapped_kek = result_wrapped_kek + b'=' * (len(result_wrapped_kek) % 4) elif isinstance(self.result_wrapped_kek, bytes): result_wrapped_kek = self.result_wrapped_kek self.kek = self.crypto.AesDecryptEAX(b64decode(result_wrapped_kek), CryptoTools().Sha256(password)) else: try: self.crypto.nonce = b64decode(self.result_wrapped_nonce) if not isinstance(password, bytes): password = password.encode() self.kek = self.crypto.AesDecryptEAX(b64decode(self.result_wrapped_kek), self.crypto.Sha256(password)) self.wrappedKek = None except: print('someone has attempted to spoof the KEK (key encryption key)') return self.kek def wrap_key(self, password): if isinstance(password, str) and self.kek == None: self.kek = self.crypto.AesEncryptEAX(data, self.crypto.Sha256(password.encode())) self.wrappedKek = self.kek self.kek = None elif isinstance(password, bytes) and self.kek == None: self.kek = self.crypto.AesEncryptEAX(data, self.crypto.Sha256(password)) self.wrappedKek = b64encode(self.kek) self.kek = None elif self.kek != None: try: # print("ATTEMPTING WRAPPING KEK") self.crypto.nonce = b64decode(self.result_wrapped_nonce) # print("set nonce") if isinstance(password, bytes): self.wrappedKek = b64encode(self.crypto.AesEncryptEAX(self.kek, self.crypto.Sha256(password))) else: self.wrappedKek = b64encode( self.crypto.AesEncryptEAX(self.kek, self.crypto.Sha256(password.encode()))) self.kek = None except OSError as ERROR: print(ERROR) print('Wrapping KEK (key encryption key) was unsuccessful') return self.wrappedKek ''' using the model of KEK unwrap and wrap the kek then unwrap the dek then pass the dek to a more useable object perhaps this will also fetch the dek that is associated with that data model, so needs to be a manytomany relation. DEK is a models.Model or Data Encryption Key class that allows to store, derive, and wrap Data Encryption Keys from a KEK and Salt ''' class DEK(models.Model): crypto = CryptoTools() dek = None wrappedDek = None SALT = None result_wrapped_nonce = models.CharField(max_length=128, default=b64encode(int(55).to_bytes(4, 'big'))) result_wrappedDek = models.CharField(max_length=128) result_SALT = models.CharField(max_length=45) kek_to_retrieve = models.ManyToManyField(KEK) objects = KeyMold() class Meta: verbose_name = 'DEK' def wrap_key(self, kek, password): if isinstance(kek, KEK) and isinstance(password, str): kek.unwrap_key(password) self.crypto.nonce = b64decode(kek.result_wrapped_nonce) # print(self.result_wrappedDek) self.dek = self.crypto.AesEncryptEAX(b64decode(self.result_wrappedDek), kek.kek) kek.wrap_key(password) return self.dek elif isinstance(kek, KEK) and isinstance(password, bytes): kek.unwrap_key(password) self.crypto.nonce = b64decode(kek.result_wrapped_nonce) self.dek = self.crypto.AesEncryptEAX(self.result_wrappedDek, kek.kek) kek.wrap_key(password) return self.dek else: try: kek.unwrap_key(password) self.crypto.nonce = b64decode(kek.result_wrapped_nonce) self.dek = self.crypto.AesEncryptEAX(self.result_wrappedDek, self.crypto.Sha256(kek.kek)) kek.wrap_key(password) return self.dek except: print('someone has attempted to spoof the DEK (data encryption key)') def unwrap_key(self, kek, password): if isinstance(kek, KEK) and isinstance(password, str): master = kek.unwrap_key(password.encode()) self.crypto.nonce = b64decode(self.result_wrapped_nonce) self.dek = self.crypto.AesDecryptEAX(b64decode(self.result_wrappedDek), self.crypto.Sha256(master)) kek.wrap_key(password) return self.dek elif isinstance(kek, KEK) and isinstance(password, bytes): kek.unwrap_key(password) if isinstance(self.result_wrapped_nonce, str): print("NONCEDEK_STR:" + self.result_wrapped_nonce) result_wrapped_nonce = (self.result_wrapped_nonce.encode()).replace(b"b'", b'') result_wrapped_nonce = result_wrapped_nonce[:-1] result_wrapped_nonce = result_wrapped_nonce + b'=' * (len(result_wrapped_nonce) % 4) self.crypto.nonce = b64decode(result_wrapped_nonce) print(b'NONCEDEK>' + result_wrapped_nonce) elif isinstance(self.result_wrapped_nonce, bytes): print("YOLO") self.crypto.nonce = b64decode(self.result_wrapped_nonce) if (not isinstance(self.result_wrappedDek, bytes)): print("did we make it here" + str(self.result_wrappedDek)) result_wrappedDek = (self.result_wrappedDek.encode()).replace(b"b'", b'') result_wrappedDek = result_wrappedDek[:-1] print("did we make it here" + str(result_wrappedDek)) wrapper = result_wrappedDek + b'=' * (len(result_wrappedDek) % 4) print("wrapper" + str(wrapper)) else: print(self.result_wrappedDek) result_wrappedDek = self.result_wrappedDek.replace(b"b'", b'') result_wrappedDek = result_wrappedDek wrapper = result_wrappedDek + b'=' * (len(result_wrappedDek) % 4) cryptoObj = CryptoTools() print(wrapper) self.dek = self.crypto.AesDecryptEAX(b64decode(wrapper), cryptoObj.Sha256(kek.kek)) kek.wrap_key(password) return self.dek else: try: if not isinstance(password, bytes): password = password.encode() else: password = password kek.unwrap_key(password) self.crypto.nonce = b64decode(self.result_wrapped_nonce) # print("about to decrypt dek") self.dek = self.crypto.AesDecryptEAX(b64decode(self.result_wrappedDek), self.crypto.Sha256(kek.kek)) kek.wrap_key(password) return self.dek except: print('someone has attempted to spoof the KEK2 (key encryption key)') ''' function to DeriveKek_default from an arbitrary password ''' def DeriveKek_default(password): crypto = CryptoTools() if len(crypto.Sha256(password.encode())) != LENGTH_OF_KEK: print('ERROR> NOT ENOUGH BYTES IN PASSWORD FOR DEK, NEED 32') if isinstance(password, str): somekek = crypto.Sha256(bytes(password.encode())) somekek = crypto.AesEncryptEAX(password.encode(), somekek) k = KEK(result_wrapped_kek=b64encode(somekek)) k.save() return k elif isinstance(password, bytes): somekek = crypto.Sha256(bytes(password.encode())) somekek = crypto.AesEncryptEAX(password.encode(), somekek) k = KEK(result_wrapped_kek=b64encode(somekek), result_wrapped_nonce=crypto.nonce) k.save() return k else: print("ERROR>UNABLE TO GENERATE WRAPPED KEK, USE A CORRECT KEY FORMAT FOR WRAPPING") ''' NeutronCore is a models.Model type class that allow for KEKs to be generated through a kek generator, time_generated, and of course the kek object this is the model for when you need access to multiple KEKS for a single user USE CASE: is old data relies on older KEKs but that older KEK is still active but the user happened to change their password which would entail creating a new password and from that time the DEK chain would change to the newly created KEK wrapped using the newly changed password. ''' class NeutronCore(models.Model): kek = models.ForeignKey( get_user_model(), related_name='KEK', on_delete=models.CASCADE, default=1) kekgenerator = models.ManyToManyField(KEK, related_name='KEK') time_generated = models.DateTimeField('date star collapsed', auto_now_add=True) objects = KeyMold() class Meta: verbose_name = 'neutron core' ordering = ['-time_generated'] get_latest_by = 'time_generated' def DeriveKek(self, password): crypto = CryptoTools() if len(crypto.Sha256(password.encode())) != LENGTH_OF_KEK: print('ERROR> NOT ENOUGH BYTES IN PASSWORD FOR DEK, NEED 32') if isinstance(password, str): somekek = crypto.Sha256(bytes(password.encode())) somekek = crypto.AesEncryptEAX(password.encode(), somekek) k = KEK(result_wrapped_kek=b64encode(somekek), result_wrapped_nonce=b64encode(crypto.nonce)) k.save() return k elif isinstance(password, bytes): somekek = crypto.Sha256(bytes(password.encode())) somekek = crypto.AesEncryptEAX(password.encode(), somekek) k = KEK(result_wrapped_kek=b64encode(somekek), result_wrapped_nonce=b64encode(crypto.nonce)) k.save() return k else: print("ERROR>UNABLE TO GENERATE WRAPPED KEK, USE A CORRECT KEY FORMAT FOR WRAPPING") def DeriveDek_default(password): crypto = CryptoTools() kekForDek = NeutronCore(get_user_model()).DeriveKek(password) if isinstance(kekForDek, KEK): if password != None and isinstance(password, str): # Generate DEK based off this formula sha256(256 bit SALT + KEK) self.SALT = crypto.RandomNumber(32) crypto.nonce = b64decode(kekForDek.result_wrapped_nonce) DerivedDek = crypto.Sha256(bytes(kekForDek.result_SALT) + crypto.AesDecryptEAX( bytes(b64decode(str(kekForDek.result_wrapped_kek).encode())), crypto.Sha256(bytes(password.encode())))) dekgenerator = DerivedDek dek = DerivedDek dek = DEK.wrap_key(dek, password) newDek = DEK(result_wrappedDek=b64encode(dek), result_SALT=kekForDek.result_SALT, kek_to_retrieve=kekForDek, result_wrapped_nonce=b64encode(crypto.nonce)) newDek.save() return newDek ''' NeutronMatterCollector is for generating a Data Encryption Key [DEK] no inputs ''' class NeutronMatterCollector(models.Model): dekgenerator = models.ManyToManyField(DEK, related_name='kek_for_dek_generator') # length of 32 bytes (256bits) in base64 is 44, but will need to include an = ending and null so extending to 45. try: # print(get_user_model().user) kekForDek = models.ForeignKey( KEK, related_name='KEK_obj', on_delete=models.CASCADE, default=1) dek = models.ForeignKey( DEK, related_name='DEK_obj', on_delete=models.CASCADE, default=1) except: try: print("unable to locate KEK for username creating new one, this could be due to a new user") kekForDek = models.ForeignKey(KEK, related_name='KEK_obj', on_delete=models.CASCADE, default=1) dek = models.ForeignKey(DEK, related_name='DEK_obj', on_delete=models.CASCADE, default=1) print("successfully made a KEK and DEK") except: print("unable to create KEK") print(get_user_model().natural_key(get_user_model())) time_generated = models.DateTimeField('date integrated', auto_now_add=datetime.now().strftime("%Y-%m-%d %H:%M:%S")) objects = QuasiPlasma() class Meta: verbose_name = 'neutron matter collector' ordering = ['-time_generated'] get_latest_by = 'time_generated' def DeriveDek(self, password): crypto = CryptoTools() if isinstance(NeutronMatterCollector.kekForDek, KEK): if password != None and isinstance(password, str): # Generate DEK based off this formula sha256(256 bit SALT + KEK) self.SALT = crypto.RandomNumber(32) crypto.nonce = b64decode(NeutronMatterCollector.kekForDek.result_wrapped_nonce) DerivedDek = crypto.Sha256(bytes(self.SALT) + crypto.AesDecryptEAX( bytes(b64decode(str(self.kekForDek.result_wrapped_kek).encode())), crypto.Sha256(bytes(password.encode())))) self.dekgenerator = DerivedDek dek = DerivedDek dek = DEK.wrap_key(dek, password) newDek = DEK(result_wrappedDek=b64encode(dek), result_SALT=b64encode(self.SALT), kek_to_retrieve=self.dekgenerator) newDek.save() return newDek else: self.kekForDek = NeutronCore(get_user_model()).DeriveKek(password) if isinstance(self.kekForDek, KEK): if password != None and isinstance(password, str): # Generate DEK based off this formula sha256(256 bit SALT + KEK) self.SALT = crypto.RandomNumber(32) crypto.nonce = b64decode(self.kekForDek.result_wrapped_nonce) # print(self.kekForDek.result_wrapped_nonce) # print(self.kekForDek.result_wrapped_kek) # print(password) DerivedDek = crypto.Sha256( bytes(self.SALT) + crypto.AesDecryptEAX(b64decode(self.kekForDek.result_wrapped_kek), crypto.Sha256(bytes(password.encode())))) # self.dekgenerator.id.set(self.request.user) dek = DerivedDek # newkey = DEK() # newkey.dek = dek # dek = DEK.wrap_key(newkey, kek=self.kekForDek, password=password.encode()) dek = crypto.AesEncryptEAX(dek, crypto.Sha256( crypto.AesDecryptEAX(b64decode(self.kekForDek.result_wrapped_kek), crypto.Sha256(bytes(password.encode()))))) newDek = DEK(result_wrappedDek=b64encode(dek), result_SALT=b64encode(self.SALT), result_wrapped_nonce=b64encode(crypto.nonce), id=self.id) # newDek.kek_to_retrieve.set(self.dekgenerator) # self.time_generated = models.DateTimeField('date integrated', auto_now_add=datetime.now().strftime("%Y-%m-%d %H:%M:%S")) self.save() newDek.save() self.dekgenerator.add(newDek) self.save() return newDek class KryptonianSpeak: def db_for_read(self, model, **hints): return 'default' def db_for_write(self, model, **hints): return 'default' def allow_relation(self, obj1, obj2, **hints): return True ''' db_list = ('default', 'superHeros', 'icePick', 'neutronStarMatter', 'neutronStarMold') if obj1._state.db in db_list and obj2._state.db in db_list: return True return None ''' def allow_migrate(self, db, app_label, model_name=None, **hints): return True
[ 1, 9995, 13, 4051, 29909, 29871, 29896, 29941, 29941, 29955, 29918, 4330, 3210, 29892, 319, 17321, 1177, 323, 5746, 3289, 29871, 30211, 14861, 29979, 29871, 29906, 29900, 29906, 29900, 13, 28116, 310, 1281, 1547, 775, 29892, 1939, 619, 11614, 470, 1370, 21867, 583, 13384, 470, 2411, 2957, 29889, 13, 15945, 29908, 13, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 3166, 12865, 1053, 12865, 13, 3166, 869, 29883, 4641, 449, 2719, 1053, 315, 17929, 24183, 13, 3166, 2967, 29953, 29946, 1053, 289, 29953, 29946, 12508, 29892, 289, 29953, 29946, 13808, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 3166, 4036, 1053, 4036, 13, 13, 29937, 6204, 596, 4733, 1244, 29889, 13, 13, 29937, 5798, 1934, 13, 19433, 29918, 9800, 29918, 6059, 29968, 353, 29871, 29941, 29906, 29871, 396, 29871, 29906, 29945, 29953, 9978, 470, 29871, 29941, 29906, 6262, 13, 19433, 29918, 9800, 29918, 2287, 29968, 353, 29871, 29941, 29906, 29871, 396, 29871, 29906, 29945, 29953, 9978, 470, 29871, 29941, 29906, 6262, 13, 19433, 29918, 9800, 29918, 29903, 1964, 29911, 353, 29871, 29941, 29906, 29871, 396, 29871, 29906, 29945, 29953, 9978, 470, 29871, 29941, 29906, 6262, 13, 13, 12008, 13, 2558, 29924, 1025, 338, 263, 4733, 29889, 3260, 22215, 6081, 393, 7805, 4969, 263, 476, 1416, 322, 5663, 15387, 263, 413, 1416, 13, 1217, 10970, 13, 12008, 13, 13, 13, 1990, 7670, 29924, 1025, 29898, 9794, 29889, 3260, 1125, 13, 13, 1678, 822, 903, 3258, 29918, 446, 29895, 29898, 3827, 29892, 3579, 19290, 1125, 13, 4706, 282, 9970, 353, 529, 25711, 17013, 15513, 1792, 29889, 5630, 13, 4706, 396, 1596, 703, 672, 4357, 413, 1416, 1159, 13, 4706, 1583, 29889, 446, 29895, 353, 2452, 573, 29968, 1416, 29918, 4381, 29898, 29886, 9970, 29897, 13, 4706, 736, 1583, 29889, 446, 29895, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 3855, 29879, 353, 4733, 29889, 3010, 2697, 29898, 1311, 29889, 4299, 29897, 13, 4706, 565, 1583, 3032, 2585, 338, 451, 6213, 29901, 13, 9651, 3855, 29879, 353, 3855, 29879, 29889, 4746, 877, 4381, 1495, 13, 4706, 736, 3855, 29879, 13, 13, 13, 12008, 13, 29911, 5830, 4338, 7967, 536, 338, 263, 4733, 29889, 3260, 393, 6511, 304, 1284, 278, 11553, 1617, 5810, 393, 674, 367, 1304, 363, 278, 1820, 29924, 1025, 304, 1207, 263, 7670, 11346, 14272, 7670, 518, 446, 29895, 1822, 13, 1217, 10970, 13, 12008, 13, 13, 13, 1990, 323, 5830, 4338, 7967, 536, 29898, 9794, 29889, 3260, 1125, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 3855, 29879, 353, 4733, 29889, 3010, 2697, 29898, 1311, 29889, 4299, 29897, 13, 4706, 565, 1583, 3032, 2585, 338, 451, 6213, 29901, 13, 9651, 3855, 29879, 353, 3855, 29879, 29889, 4746, 877, 4381, 1495, 13, 4706, 736, 3855, 29879, 13, 13, 13, 12008, 13, 2182, 6840, 3247, 25392, 338, 263, 4733, 29889, 3260, 393, 6511, 363, 589, 4357, 3630, 11346, 14272, 4813, 952, 518, 2287, 29968, 29879, 29962, 322, 5663, 15387, 316, 2039, 515, 278, 11553, 1617, 10819, 715, 25392, 29889, 13, 1217, 10970, 13, 12008, 13, 13, 13, 1990, 751, 6840, 3247, 25392, 29898, 9794, 29889, 3260, 1125, 13, 13, 1678, 822, 903, 3258, 29918, 25950, 29898, 3827, 29892, 3579, 19290, 1125, 13, 4706, 282, 9970, 353, 2009, 29889, 1792, 29889, 5630, 13, 4706, 1583, 29889, 25950, 353, 2452, 573, 29928, 1416, 29918, 4381, 29898, 29886, 9970, 29897, 13, 4706, 736, 1583, 29889, 25950, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 3855, 29879, 353, 4733, 29889, 3010, 2697, 29898, 1311, 29889, 4299, 29897, 13, 4706, 565, 1583, 3032, 2585, 338, 451, 6213, 29901, 13, 9651, 3855, 29879, 353, 3855, 29879, 29889, 4746, 877, 4381, 1495, 13, 4706, 736, 3855, 29879, 13, 13, 13, 12008, 13, 6059, 29968, 338, 278, 7670, 20956, 7670, 518, 6059, 29968, 29962, 1904, 29889, 3195, 770, 6081, 393, 756, 278, 11509, 304, 21340, 263, 716, 476, 29923, 29968, 408, 1532, 408, 12244, 278, 476, 29923, 29968, 29889, 13, 1217, 10970, 13, 12008, 13, 13, 13, 1990, 476, 29923, 29968, 29898, 9794, 29889, 3195, 1125, 13, 1678, 396, 12391, 881, 278, 1820, 367, 4502, 408, 2821, 1426, 2337, 671, 278, 12244, 470, 443, 6312, 3168, 13, 1678, 274, 17929, 353, 315, 17929, 24183, 580, 13, 1678, 413, 1416, 353, 6213, 13, 1678, 21021, 29968, 1416, 353, 6213, 13, 1678, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 2322, 29922, 29890, 29953, 29946, 12508, 29898, 524, 29898, 29945, 29945, 467, 517, 29918, 13193, 29898, 29946, 29892, 525, 3752, 29915, 4961, 13, 1678, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 2322, 29922, 8516, 29897, 13, 13, 1678, 3618, 353, 323, 5830, 4338, 7967, 536, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 525, 6059, 29968, 29915, 13, 13, 1678, 822, 443, 6312, 29918, 1989, 29898, 1311, 29892, 4800, 1125, 13, 4706, 565, 338, 8758, 29898, 5630, 29892, 851, 29897, 322, 1583, 29889, 446, 29895, 1275, 6213, 322, 1583, 29889, 29893, 336, 2986, 29968, 1416, 1275, 6213, 29901, 13, 9651, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 1583, 29889, 446, 29895, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 511, 13, 462, 462, 462, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 29889, 12508, 22130, 13, 13, 4706, 565, 338, 8758, 29898, 5630, 29892, 6262, 29897, 322, 1583, 29889, 446, 29895, 1275, 6213, 322, 1583, 29889, 29893, 336, 2986, 29968, 1416, 1275, 6213, 29901, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29892, 851, 1125, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 313, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29889, 12508, 16655, 6506, 29898, 29890, 29908, 29890, 29915, 613, 289, 29915, 1495, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 7503, 29899, 29896, 29962, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 718, 289, 29915, 2433, 334, 313, 2435, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 1273, 29871, 29946, 29897, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 396, 1596, 703, 29893, 336, 2986, 29968, 1416, 29901, 376, 718, 1583, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29897, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29892, 851, 1125, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 353, 313, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29889, 12508, 16655, 6506, 29898, 29890, 29908, 29890, 29915, 613, 289, 29915, 1495, 13, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 353, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 7503, 29899, 29896, 29962, 13, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 353, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 718, 289, 29915, 2433, 334, 313, 2435, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29897, 1273, 29871, 29946, 29897, 13, 9651, 25342, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29892, 6262, 1125, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 446, 29895, 353, 1583, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 13, 9651, 1583, 29889, 446, 29895, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 511, 315, 17929, 24183, 2141, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 876, 13, 13, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 565, 451, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 462, 1678, 4800, 353, 4800, 29889, 12508, 580, 13, 18884, 1583, 29889, 446, 29895, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 511, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 876, 13, 18884, 1583, 29889, 29893, 336, 2986, 29968, 1416, 353, 6213, 13, 9651, 5174, 29901, 13, 18884, 1596, 877, 5372, 650, 756, 16388, 304, 13345, 974, 278, 476, 29923, 29968, 313, 1989, 20956, 1820, 29897, 1495, 13, 13, 13, 4706, 736, 1583, 29889, 446, 29895, 13, 13, 1678, 822, 12244, 29918, 1989, 29898, 1311, 29892, 4800, 1125, 13, 4706, 565, 338, 8758, 29898, 5630, 29892, 851, 29897, 322, 1583, 29889, 446, 29895, 1275, 6213, 29901, 13, 9651, 1583, 29889, 446, 29895, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1272, 29892, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 29889, 12508, 22130, 13, 9651, 1583, 29889, 29893, 336, 2986, 29968, 1416, 353, 1583, 29889, 446, 29895, 13, 9651, 1583, 29889, 446, 29895, 353, 6213, 13, 13, 4706, 25342, 338, 8758, 29898, 5630, 29892, 6262, 29897, 322, 1583, 29889, 446, 29895, 1275, 6213, 29901, 13, 9651, 1583, 29889, 446, 29895, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1272, 29892, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 876, 13, 9651, 1583, 29889, 29893, 336, 2986, 29968, 1416, 353, 289, 29953, 29946, 12508, 29898, 1311, 29889, 446, 29895, 29897, 13, 9651, 1583, 29889, 446, 29895, 353, 6213, 13, 4706, 25342, 1583, 29889, 446, 29895, 2804, 6213, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 1596, 703, 1299, 4330, 3580, 29911, 4214, 399, 29934, 20576, 4214, 476, 29923, 29968, 1159, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 396, 1596, 703, 842, 1661, 346, 1159, 13, 18884, 565, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 462, 1678, 1583, 29889, 29893, 336, 2986, 29968, 1416, 353, 289, 29953, 29946, 12508, 29898, 1311, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1311, 29889, 446, 29895, 29892, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 4961, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 29889, 29893, 336, 2986, 29968, 1416, 353, 289, 29953, 29946, 12508, 29898, 13, 462, 4706, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1311, 29889, 446, 29895, 29892, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 29889, 12508, 580, 4961, 13, 13, 18884, 1583, 29889, 446, 29895, 353, 6213, 13, 9651, 5174, 438, 29173, 408, 14431, 29901, 13, 18884, 1596, 29898, 11432, 29897, 13, 18884, 1596, 877, 29956, 336, 3262, 476, 29923, 29968, 313, 1989, 20956, 1820, 29897, 471, 443, 8698, 1319, 1495, 13, 13, 4706, 736, 1583, 29889, 29893, 336, 2986, 29968, 1416, 13, 13, 13, 12008, 13, 4746, 278, 1904, 310, 476, 29923, 29968, 443, 6312, 322, 12244, 278, 413, 1416, 769, 443, 6312, 278, 316, 29895, 769, 1209, 278, 316, 29895, 304, 263, 901, 671, 519, 1203, 13, 546, 4252, 445, 674, 884, 6699, 278, 316, 29895, 393, 338, 6942, 411, 393, 848, 1904, 29892, 577, 4225, 304, 367, 263, 1784, 15135, 1384, 8220, 29889, 13, 13, 2287, 29968, 338, 263, 4733, 29889, 3195, 470, 3630, 11346, 14272, 7670, 770, 393, 6511, 304, 3787, 29892, 21340, 29892, 322, 12244, 3630, 11346, 14272, 4813, 952, 515, 263, 476, 29923, 29968, 322, 27903, 13, 12008, 13, 13, 13, 1990, 5012, 29968, 29898, 9794, 29889, 3195, 1125, 13, 1678, 274, 17929, 353, 315, 17929, 24183, 580, 13, 1678, 316, 29895, 353, 6213, 13, 1678, 21021, 29928, 1416, 353, 6213, 13, 1678, 317, 1964, 29911, 353, 6213, 13, 1678, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 2322, 29922, 29890, 29953, 29946, 12508, 29898, 524, 29898, 29945, 29945, 467, 517, 29918, 13193, 29898, 29946, 29892, 525, 3752, 29915, 4961, 13, 1678, 1121, 29918, 29893, 336, 2986, 29928, 1416, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29897, 13, 13, 1678, 1121, 29918, 29903, 1964, 29911, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29946, 29945, 29897, 13, 1678, 413, 1416, 29918, 517, 29918, 276, 509, 2418, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 6059, 29968, 29897, 13, 13, 1678, 3618, 353, 7670, 29924, 1025, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 525, 2287, 29968, 29915, 13, 13, 1678, 822, 12244, 29918, 1989, 29898, 1311, 29892, 413, 1416, 29892, 4800, 1125, 13, 4706, 565, 338, 8758, 29898, 446, 29895, 29892, 476, 29923, 29968, 29897, 322, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 9651, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29897, 13, 9651, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 446, 29895, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 396, 1596, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29897, 13, 9651, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 511, 413, 1416, 29889, 446, 29895, 29897, 13, 9651, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 9651, 736, 1583, 29889, 25950, 13, 13, 4706, 25342, 338, 8758, 29898, 446, 29895, 29892, 476, 29923, 29968, 29897, 322, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 9651, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29897, 13, 13, 9651, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 446, 29895, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 13, 9651, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29892, 413, 1416, 29889, 446, 29895, 29897, 13, 9651, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 9651, 736, 1583, 29889, 25950, 13, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29897, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 446, 29895, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 13, 18884, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29892, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 446, 29895, 29889, 446, 29895, 876, 13, 18884, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 18884, 736, 1583, 29889, 25950, 13, 13, 9651, 5174, 29901, 13, 18884, 1596, 877, 5372, 650, 756, 16388, 304, 13345, 974, 278, 5012, 29968, 313, 1272, 20956, 1820, 29897, 1495, 13, 13, 1678, 822, 443, 6312, 29918, 1989, 29898, 1311, 29892, 413, 1416, 29892, 4800, 1125, 13, 4706, 565, 338, 8758, 29898, 446, 29895, 29892, 476, 29923, 29968, 29897, 322, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 9651, 5835, 353, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29889, 12508, 3101, 13, 13, 9651, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 511, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 6207, 876, 13, 13, 9651, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 9651, 736, 1583, 29889, 25950, 13, 13, 4706, 25342, 338, 8758, 29898, 446, 29895, 29892, 476, 29923, 29968, 29897, 322, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 9651, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29897, 13, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29892, 851, 1125, 13, 18884, 1596, 703, 29940, 1164, 4741, 2287, 29968, 29918, 10810, 6160, 718, 1583, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 313, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29889, 12508, 16655, 6506, 29898, 29890, 29908, 29890, 29915, 613, 289, 29915, 1495, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 7503, 29899, 29896, 29962, 13, 18884, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 353, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 718, 289, 29915, 2433, 334, 313, 2435, 29898, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 1273, 29871, 29946, 29897, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 1596, 29898, 29890, 29915, 29940, 1164, 4741, 2287, 29968, 16299, 718, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 13, 9651, 25342, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29892, 6262, 1125, 13, 18884, 1596, 703, 29979, 29949, 3927, 1159, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 13, 9651, 565, 313, 1333, 338, 8758, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29892, 6262, 22164, 13, 18884, 1596, 703, 18361, 591, 1207, 372, 1244, 29908, 718, 851, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 876, 13, 18884, 1121, 29918, 29893, 336, 2986, 29928, 1416, 353, 313, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29889, 12508, 16655, 6506, 29898, 29890, 29908, 29890, 29915, 613, 289, 29915, 1495, 13, 18884, 1121, 29918, 29893, 336, 2986, 29928, 1416, 353, 1121, 29918, 29893, 336, 2986, 29928, 1416, 7503, 29899, 29896, 29962, 13, 18884, 1596, 703, 18361, 591, 1207, 372, 1244, 29908, 718, 851, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 876, 13, 18884, 14476, 353, 1121, 29918, 29893, 336, 2986, 29928, 1416, 718, 289, 29915, 2433, 334, 313, 2435, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29897, 1273, 29871, 29946, 29897, 13, 18884, 1596, 703, 17699, 29908, 718, 851, 29898, 17699, 876, 13, 13, 9651, 1683, 29901, 13, 18884, 1596, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29897, 13, 18884, 1121, 29918, 29893, 336, 2986, 29928, 1416, 353, 1583, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29889, 6506, 29898, 29890, 29908, 29890, 29915, 613, 289, 29915, 1495, 13, 18884, 1121, 29918, 29893, 336, 2986, 29928, 1416, 353, 1121, 29918, 29893, 336, 2986, 29928, 1416, 13, 18884, 14476, 353, 1121, 29918, 29893, 336, 2986, 29928, 1416, 718, 289, 29915, 2433, 334, 313, 2435, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29897, 1273, 29871, 29946, 29897, 13, 13, 9651, 274, 17929, 9930, 353, 315, 17929, 24183, 580, 13, 9651, 1596, 29898, 17699, 29897, 13, 9651, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 17699, 511, 274, 17929, 9930, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 446, 29895, 29889, 446, 29895, 876, 13, 9651, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 13, 9651, 736, 1583, 29889, 25950, 13, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 565, 451, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 462, 1678, 4800, 353, 4800, 29889, 12508, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 4800, 353, 4800, 13, 13, 18884, 413, 1416, 29889, 26238, 29918, 1989, 29898, 5630, 29897, 13, 18884, 1583, 29889, 29883, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 396, 1596, 703, 12717, 304, 1602, 4641, 316, 29895, 1159, 13, 18884, 1583, 29889, 25950, 353, 1583, 29889, 29883, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 2914, 29918, 29893, 336, 2986, 29928, 1416, 511, 1583, 29889, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 446, 29895, 29889, 446, 29895, 876, 13, 13, 18884, 413, 1416, 29889, 6312, 29918, 1989, 29898, 5630, 29897, 13, 18884, 736, 1583, 29889, 25950, 13, 9651, 5174, 29901, 13, 18884, 1596, 877, 5372, 650, 756, 16388, 304, 13345, 974, 278, 476, 29923, 29968, 29906, 313, 1989, 20956, 1820, 29897, 1495, 13, 13, 13, 12008, 13, 2220, 304, 2452, 573, 29968, 1416, 29918, 4381, 515, 385, 11472, 4800, 13, 12008, 13, 13, 13, 1753, 2452, 573, 29968, 1416, 29918, 4381, 29898, 5630, 1125, 13, 1678, 274, 17929, 353, 315, 17929, 24183, 580, 13, 1678, 565, 7431, 29898, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 29889, 12508, 22130, 2804, 365, 1430, 29954, 4690, 29918, 9800, 29918, 6059, 29968, 29901, 13, 4706, 1596, 877, 11432, 29958, 6058, 382, 6632, 23338, 29950, 6770, 29911, 2890, 2672, 17687, 1799, 17013, 15842, 5012, 29968, 29892, 14693, 3352, 29871, 29941, 29906, 1495, 13, 1678, 565, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 4706, 777, 446, 29895, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 22130, 13, 4706, 777, 446, 29895, 353, 274, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 5630, 29889, 12508, 3285, 777, 446, 29895, 29897, 13, 4706, 413, 353, 476, 29923, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29922, 29890, 29953, 29946, 12508, 29898, 5372, 446, 29895, 876, 13, 4706, 413, 29889, 7620, 580, 13, 4706, 736, 413, 13, 13, 1678, 25342, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 4706, 777, 446, 29895, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 22130, 13, 4706, 777, 446, 29895, 353, 274, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 5630, 29889, 12508, 3285, 777, 446, 29895, 29897, 13, 4706, 413, 353, 476, 29923, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29922, 29890, 29953, 29946, 12508, 29898, 5372, 446, 29895, 511, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29922, 29883, 17929, 29889, 5464, 346, 29897, 13, 4706, 413, 29889, 7620, 580, 13, 4706, 736, 413, 13, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 11432, 29958, 3904, 6181, 7495, 402, 1430, 1001, 3040, 399, 29934, 20576, 3352, 476, 29923, 29968, 29892, 501, 1660, 319, 315, 1955, 26282, 14636, 383, 12054, 1299, 15842, 399, 29934, 20576, 4214, 1159, 13, 13, 13, 12008, 13, 8139, 329, 1617, 9203, 338, 263, 4733, 29889, 3195, 1134, 770, 393, 2758, 363, 476, 29923, 29968, 29879, 304, 367, 5759, 1549, 263, 413, 1416, 15299, 29892, 931, 29918, 13525, 29892, 322, 310, 3236, 278, 413, 1416, 1203, 13, 1366, 338, 278, 1904, 363, 746, 366, 817, 2130, 304, 2999, 476, 29923, 17557, 363, 263, 2323, 1404, 13, 13, 17171, 29134, 29901, 338, 2030, 848, 337, 3687, 373, 9642, 476, 29923, 29968, 29879, 541, 393, 9642, 476, 29923, 29968, 338, 1603, 6136, 13, 4187, 278, 1404, 9559, 304, 1735, 1009, 4800, 607, 723, 875, 737, 4969, 263, 716, 4800, 322, 515, 393, 931, 278, 5012, 29968, 9704, 723, 1735, 304, 278, 15141, 13, 11600, 476, 29923, 29968, 21021, 773, 278, 15141, 3939, 4800, 29889, 13, 12008, 13, 13, 13, 1990, 2448, 329, 1617, 9203, 29898, 9794, 29889, 3195, 1125, 13, 1678, 413, 1416, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 679, 29918, 1792, 29918, 4299, 3285, 4475, 29918, 978, 2433, 6059, 29968, 742, 13, 4706, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 4706, 2322, 29922, 29896, 29897, 13, 13, 1678, 413, 1416, 27959, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 6059, 29968, 29892, 4475, 29918, 978, 2433, 6059, 29968, 1495, 13, 13, 1678, 931, 29918, 13525, 353, 4733, 29889, 11384, 3073, 877, 1256, 5810, 784, 23384, 742, 4469, 29918, 3707, 29918, 1202, 29922, 5574, 29897, 13, 13, 1678, 3618, 353, 7670, 29924, 1025, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 525, 17821, 1617, 7136, 29915, 13, 4706, 20520, 353, 6024, 29899, 2230, 29918, 13525, 2033, 13, 4706, 679, 29918, 12333, 29918, 1609, 353, 525, 2230, 29918, 13525, 29915, 13, 13, 1678, 822, 2452, 573, 29968, 1416, 29898, 1311, 29892, 4800, 1125, 13, 4706, 274, 17929, 353, 315, 17929, 24183, 580, 13, 4706, 565, 7431, 29898, 29883, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 5630, 29889, 12508, 22130, 2804, 365, 1430, 29954, 4690, 29918, 9800, 29918, 6059, 29968, 29901, 13, 9651, 1596, 877, 11432, 29958, 6058, 382, 6632, 23338, 29950, 6770, 29911, 2890, 2672, 17687, 1799, 17013, 15842, 5012, 29968, 29892, 14693, 3352, 29871, 29941, 29906, 1495, 13, 4706, 565, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 9651, 777, 446, 29895, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 22130, 13, 9651, 777, 446, 29895, 353, 274, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 5630, 29889, 12508, 3285, 777, 446, 29895, 29897, 13, 9651, 413, 353, 476, 29923, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29922, 29890, 29953, 29946, 12508, 29898, 5372, 446, 29895, 511, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29922, 29890, 29953, 29946, 12508, 29898, 29883, 17929, 29889, 5464, 346, 876, 13, 9651, 413, 29889, 7620, 580, 13, 9651, 736, 413, 13, 13, 4706, 25342, 338, 8758, 29898, 5630, 29892, 6262, 1125, 13, 9651, 777, 446, 29895, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 22130, 13, 9651, 777, 446, 29895, 353, 274, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 5630, 29889, 12508, 3285, 777, 446, 29895, 29897, 13, 9651, 413, 353, 476, 29923, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29922, 29890, 29953, 29946, 12508, 29898, 5372, 446, 29895, 511, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29922, 29890, 29953, 29946, 12508, 29898, 29883, 17929, 29889, 5464, 346, 876, 13, 9651, 413, 29889, 7620, 580, 13, 9651, 736, 413, 13, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 11432, 29958, 3904, 6181, 7495, 402, 1430, 1001, 3040, 399, 29934, 20576, 3352, 476, 29923, 29968, 29892, 501, 1660, 319, 315, 1955, 26282, 14636, 383, 12054, 1299, 15842, 399, 29934, 20576, 4214, 1159, 13, 13, 13, 1753, 2452, 573, 29928, 1416, 29918, 4381, 29898, 5630, 1125, 13, 1678, 274, 17929, 353, 315, 17929, 24183, 580, 13, 13, 13, 1678, 413, 1416, 2831, 29928, 1416, 353, 2448, 329, 1617, 9203, 29898, 657, 29918, 1792, 29918, 4299, 16655, 15383, 573, 29968, 1416, 29898, 5630, 29897, 13, 1678, 565, 338, 8758, 29898, 446, 29895, 2831, 29928, 1416, 29892, 476, 29923, 29968, 1125, 13, 4706, 565, 4800, 2804, 6213, 322, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 9651, 396, 3251, 403, 5012, 29968, 2729, 1283, 445, 7063, 528, 29874, 29906, 29945, 29953, 29898, 29906, 29945, 29953, 2586, 317, 1964, 29911, 718, 476, 29923, 29968, 29897, 13, 9651, 1583, 29889, 29903, 1964, 29911, 353, 274, 17929, 29889, 17875, 4557, 29898, 29941, 29906, 29897, 13, 13, 9651, 274, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 9651, 2452, 2347, 29928, 1416, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29903, 1964, 29911, 29897, 718, 274, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 13, 18884, 6262, 29898, 29890, 29953, 29946, 13808, 29898, 710, 29898, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 467, 12508, 3101, 511, 13, 18884, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 580, 13697, 13, 9651, 316, 29895, 27959, 353, 2452, 2347, 29928, 1416, 13, 9651, 316, 29895, 353, 2452, 2347, 29928, 1416, 13, 9651, 316, 29895, 353, 5012, 29968, 29889, 6312, 29918, 1989, 29898, 25950, 29892, 4800, 29897, 13, 9651, 716, 29928, 1416, 353, 5012, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29922, 29890, 29953, 29946, 12508, 29898, 25950, 511, 1121, 29918, 29903, 1964, 29911, 29922, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29903, 1964, 29911, 29892, 13, 462, 308, 413, 1416, 29918, 517, 29918, 276, 509, 2418, 29922, 446, 29895, 2831, 29928, 1416, 29892, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29922, 29890, 29953, 29946, 12508, 29898, 29883, 17929, 29889, 5464, 346, 876, 13, 9651, 716, 29928, 1416, 29889, 7620, 580, 13, 9651, 736, 716, 29928, 1416, 13, 13, 13, 12008, 13, 8139, 329, 1617, 29924, 2620, 28916, 272, 338, 363, 14655, 263, 3630, 11346, 14272, 7670, 518, 2287, 29968, 29962, 13, 1217, 10970, 13, 12008, 13, 13, 13, 1990, 2448, 329, 1617, 29924, 2620, 28916, 272, 29898, 9794, 29889, 3195, 1125, 13, 1678, 316, 29895, 27959, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 2287, 29968, 29892, 13, 462, 462, 3986, 4475, 29918, 978, 2433, 446, 29895, 29918, 1454, 29918, 25950, 29918, 27959, 1495, 29871, 396, 3309, 310, 29871, 29941, 29906, 6262, 313, 29906, 29945, 29953, 14836, 29897, 297, 2967, 29953, 29946, 338, 29871, 29946, 29946, 29892, 541, 674, 817, 304, 3160, 385, 353, 17140, 322, 1870, 577, 23771, 304, 29871, 29946, 29945, 29889, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 1596, 29898, 657, 29918, 1792, 29918, 4299, 2141, 1792, 29897, 13, 4706, 413, 1416, 2831, 29928, 1416, 353, 4733, 29889, 27755, 2558, 29898, 13, 9651, 476, 29923, 29968, 29892, 4475, 29918, 978, 2433, 6059, 29968, 29918, 5415, 742, 13, 9651, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 2322, 29922, 29896, 29897, 13, 4706, 316, 29895, 353, 4733, 29889, 27755, 2558, 29898, 13, 9651, 5012, 29968, 29892, 4475, 29918, 978, 2433, 2287, 29968, 29918, 5415, 742, 13, 9651, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 9651, 2322, 29922, 29896, 29897, 13, 1678, 5174, 29901, 13, 4706, 1018, 29901, 13, 9651, 1596, 703, 348, 519, 304, 26694, 476, 29923, 29968, 363, 8952, 4969, 716, 697, 29892, 445, 1033, 367, 2861, 304, 263, 716, 1404, 1159, 13, 9651, 413, 1416, 2831, 29928, 1416, 353, 4733, 29889, 27755, 2558, 29898, 6059, 29968, 29892, 4475, 29918, 978, 2433, 6059, 29968, 29918, 5415, 742, 13, 462, 462, 3986, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 2322, 29922, 29896, 29897, 13, 9651, 316, 29895, 353, 4733, 29889, 27755, 2558, 29898, 2287, 29968, 29892, 4475, 29918, 978, 2433, 2287, 29968, 29918, 5415, 742, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 2322, 29922, 29896, 29897, 13, 9651, 1596, 703, 8698, 3730, 1754, 263, 476, 29923, 29968, 322, 5012, 29968, 1159, 13, 13, 4706, 5174, 29901, 13, 9651, 1596, 703, 348, 519, 304, 1653, 476, 29923, 29968, 1159, 13, 9651, 1596, 29898, 657, 29918, 1792, 29918, 4299, 2141, 25047, 29918, 1989, 29898, 657, 29918, 1792, 29918, 4299, 22130, 13, 13, 1678, 931, 29918, 13525, 353, 4733, 29889, 11384, 3073, 877, 1256, 23387, 742, 4469, 29918, 3707, 29918, 1202, 29922, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 5783, 13, 13, 1678, 3618, 353, 751, 6840, 3247, 25392, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 525, 17821, 1617, 4383, 6314, 272, 29915, 13, 4706, 20520, 353, 6024, 29899, 2230, 29918, 13525, 2033, 13, 4706, 679, 29918, 12333, 29918, 1609, 353, 525, 2230, 29918, 13525, 29915, 13, 13, 1678, 822, 2452, 573, 29928, 1416, 29898, 1311, 29892, 4800, 1125, 13, 4706, 274, 17929, 353, 315, 17929, 24183, 580, 13, 4706, 565, 338, 8758, 29898, 8139, 329, 1617, 29924, 2620, 28916, 272, 29889, 446, 29895, 2831, 29928, 1416, 29892, 476, 29923, 29968, 1125, 13, 9651, 565, 4800, 2804, 6213, 322, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 18884, 396, 3251, 403, 5012, 29968, 2729, 1283, 445, 7063, 528, 29874, 29906, 29945, 29953, 29898, 29906, 29945, 29953, 2586, 317, 1964, 29911, 718, 476, 29923, 29968, 29897, 13, 18884, 1583, 29889, 29903, 1964, 29911, 353, 274, 17929, 29889, 17875, 4557, 29898, 29941, 29906, 29897, 13, 18884, 274, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 8139, 329, 1617, 29924, 2620, 28916, 272, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 18884, 2452, 2347, 29928, 1416, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 1311, 29889, 29903, 1964, 29911, 29897, 718, 274, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 13, 462, 1678, 6262, 29898, 29890, 29953, 29946, 13808, 29898, 710, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 467, 12508, 3101, 511, 13, 462, 1678, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 580, 13697, 13, 18884, 1583, 29889, 25950, 27959, 353, 2452, 2347, 29928, 1416, 13, 18884, 316, 29895, 353, 2452, 2347, 29928, 1416, 13, 18884, 316, 29895, 353, 5012, 29968, 29889, 6312, 29918, 1989, 29898, 25950, 29892, 4800, 29897, 13, 18884, 716, 29928, 1416, 353, 5012, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29922, 29890, 29953, 29946, 12508, 29898, 25950, 511, 1121, 29918, 29903, 1964, 29911, 29922, 29890, 29953, 29946, 12508, 29898, 1311, 29889, 29903, 1964, 29911, 511, 13, 462, 632, 413, 1416, 29918, 517, 29918, 276, 509, 2418, 29922, 1311, 29889, 25950, 27959, 29897, 13, 18884, 716, 29928, 1416, 29889, 7620, 580, 13, 18884, 736, 716, 29928, 1416, 13, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 446, 29895, 2831, 29928, 1416, 353, 2448, 329, 1617, 9203, 29898, 657, 29918, 1792, 29918, 4299, 16655, 15383, 573, 29968, 1416, 29898, 5630, 29897, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29892, 476, 29923, 29968, 1125, 13, 18884, 565, 4800, 2804, 6213, 322, 338, 8758, 29898, 5630, 29892, 851, 1125, 13, 462, 1678, 396, 3251, 403, 5012, 29968, 2729, 1283, 445, 7063, 528, 29874, 29906, 29945, 29953, 29898, 29906, 29945, 29953, 2586, 317, 1964, 29911, 718, 476, 29923, 29968, 29897, 13, 462, 1678, 1583, 29889, 29903, 1964, 29911, 353, 274, 17929, 29889, 17875, 4557, 29898, 29941, 29906, 29897, 13, 462, 1678, 274, 17929, 29889, 5464, 346, 353, 289, 29953, 29946, 13808, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 462, 1678, 396, 1596, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 5464, 346, 29897, 13, 462, 1678, 396, 1596, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 29897, 13, 462, 1678, 396, 1596, 29898, 5630, 29897, 13, 462, 1678, 2452, 2347, 29928, 1416, 353, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13, 462, 4706, 6262, 29898, 1311, 29889, 29903, 1964, 29911, 29897, 718, 274, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 511, 13, 462, 462, 462, 18884, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 580, 13697, 13, 462, 1678, 396, 1583, 29889, 25950, 27959, 29889, 333, 29889, 842, 29898, 1311, 29889, 3827, 29889, 1792, 29897, 13, 13, 462, 1678, 316, 29895, 353, 2452, 2347, 29928, 1416, 13, 462, 1678, 396, 716, 1989, 353, 5012, 29968, 580, 13, 462, 1678, 396, 716, 1989, 29889, 25950, 353, 316, 29895, 13, 462, 1678, 396, 316, 29895, 353, 5012, 29968, 29889, 6312, 29918, 1989, 29898, 1482, 1989, 29892, 413, 1416, 29922, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29892, 4800, 29922, 5630, 29889, 12508, 3101, 13, 462, 1678, 316, 29895, 353, 274, 17929, 29889, 29909, 267, 8566, 4641, 29923, 6604, 29898, 25950, 29892, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13, 462, 4706, 274, 17929, 29889, 29909, 267, 6185, 4641, 29923, 6604, 29898, 29890, 29953, 29946, 13808, 29898, 1311, 29889, 446, 29895, 2831, 29928, 1416, 29889, 2914, 29918, 29893, 336, 2986, 29918, 446, 29895, 511, 13, 462, 462, 632, 274, 17929, 29889, 29903, 2350, 29906, 29945, 29953, 29898, 13193, 29898, 5630, 29889, 12508, 22130, 4961, 13, 462, 1678, 716, 29928, 1416, 353, 5012, 29968, 29898, 2914, 29918, 29893, 336, 2986, 29928, 1416, 29922, 29890, 29953, 29946, 12508, 29898, 25950, 511, 1121, 29918, 29903, 1964, 29911, 29922, 29890, 29953, 29946, 12508, 29898, 1311, 29889, 29903, 1964, 29911, 511, 13, 462, 462, 1121, 29918, 29893, 336, 2986, 29918, 5464, 346, 29922, 29890, 29953, 29946, 12508, 29898, 29883, 17929, 29889, 5464, 346, 511, 1178, 29922, 1311, 29889, 333, 29897, 13, 462, 1678, 396, 716, 29928, 1416, 29889, 446, 29895, 29918, 517, 29918, 276, 509, 2418, 29889, 842, 29898, 1311, 29889, 25950, 27959, 29897, 13, 462, 1678, 396, 1583, 29889, 2230, 29918, 13525, 353, 4733, 29889, 11384, 3073, 877, 1256, 23387, 742, 4469, 29918, 3707, 29918, 1202, 29922, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 5783, 13, 462, 1678, 1583, 29889, 7620, 580, 13, 462, 1678, 716, 29928, 1416, 29889, 7620, 580, 13, 462, 1678, 1583, 29889, 25950, 27959, 29889, 1202, 29898, 1482, 29928, 1416, 29897, 13, 462, 1678, 1583, 29889, 7620, 580, 13, 462, 1678, 736, 716, 29928, 1416, 13, 13, 13, 1990, 476, 4641, 25813, 10649, 557, 29901, 13, 13, 1678, 822, 4833, 29918, 1454, 29918, 949, 29898, 1311, 29892, 1904, 29892, 3579, 29882, 9466, 1125, 13, 4706, 736, 525, 4381, 29915, 13, 13, 1678, 822, 4833, 29918, 1454, 29918, 3539, 29898, 1311, 29892, 1904, 29892, 3579, 29882, 9466, 1125, 13, 4706, 736, 525, 4381, 29915, 13, 13, 1678, 822, 2758, 29918, 23445, 29898, 1311, 29892, 5446, 29896, 29892, 5446, 29906, 29892, 3579, 29882, 9466, 1125, 13, 4706, 736, 5852, 13, 4706, 14550, 13, 4706, 4833, 29918, 1761, 353, 6702, 4381, 742, 525, 9136, 29950, 9672, 742, 525, 625, 29925, 860, 742, 525, 17821, 1617, 16213, 29924, 2620, 742, 525, 17821, 1617, 16213, 29924, 1025, 1495, 13, 4706, 565, 5446, 29896, 3032, 3859, 29889, 2585, 297, 4833, 29918, 1761, 322, 5446, 29906, 3032, 3859, 29889, 2585, 297, 4833, 29918, 1761, 29901, 13, 9651, 736, 5852, 13, 4706, 736, 6213, 13, 4706, 14550, 13, 13, 1678, 822, 2758, 29918, 26983, 403, 29898, 1311, 29892, 4833, 29892, 623, 29918, 1643, 29892, 1904, 29918, 978, 29922, 8516, 29892, 3579, 29882, 9466, 1125, 13, 4706, 736, 5852, 13, 2 ]
tests/test_json_to_mako.py
melexis/json-to-mako
0
186121
<filename>tests/test_json_to_mako.py from unittest import TestCase from mlx.json_to_mako import json_to_mako_wrapper class TestJsonToMako(TestCase): def test_help(self): with self.assertRaises(SystemExit) as ex: json_to_mako_wrapper(['--help']) self.assertEqual(0, ex.exception.code) def test_version(self): with self.assertRaises(SystemExit) as ex: json_to_mako_wrapper(['--version']) self.assertEqual(0, ex.exception.code) def test_example_single_input(self): json_to_mako_wrapper(['--input', 'example/family.json', '--input', 'example/work.json', '--template', 'example/address-book.mako', '--output', 'tests/address-book.html']) def test_example_dual_input(self): json_to_mako_wrapper(['--input', 'example/family.json', '--template', 'example/address-book.mako', '--output', 'tests/address-book.html']) def test_example_no_input(self): with self.assertRaises(SystemExit) as ex: json_to_mako_wrapper(['--template', 'example/address-book.mako', '--output', 'tests/address-book.html']) self.assertEqual(2, ex.exception.code) def test_example_no_template(self): with self.assertRaises(SystemExit) as ex: json_to_mako_wrapper(['--input', 'example/family.json', '--input', 'example/work.json', '--output', 'tests/address-book.html']) self.assertEqual(2, ex.exception.code) def test_example_no_output(self): with self.assertRaises(SystemExit) as ex: json_to_mako_wrapper(['--input', 'example/family.json', '--input', 'example/work.json', '--template', 'example/address-book.mako']) self.assertEqual(2, ex.exception.code)
[ 1, 529, 9507, 29958, 21150, 29914, 1688, 29918, 3126, 29918, 517, 29918, 29885, 4614, 29889, 2272, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 3166, 286, 29880, 29916, 29889, 3126, 29918, 517, 29918, 29885, 4614, 1053, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 13, 13, 13, 1990, 4321, 8148, 1762, 29924, 4614, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 8477, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 429, 29901, 13, 9651, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 8477, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 429, 29889, 11739, 29889, 401, 29897, 13, 13, 1678, 822, 1243, 29918, 3259, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 429, 29901, 13, 9651, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 3259, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 429, 29889, 11739, 29889, 401, 29897, 13, 13, 1678, 822, 1243, 29918, 4773, 29918, 14369, 29918, 2080, 29898, 1311, 1125, 13, 4706, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 2080, 742, 525, 4773, 29914, 11922, 29889, 3126, 742, 13, 462, 795, 525, 489, 2080, 742, 525, 4773, 29914, 1287, 29889, 3126, 742, 13, 462, 795, 525, 489, 6886, 742, 525, 4773, 29914, 7328, 29899, 2909, 29889, 29885, 4614, 742, 13, 462, 795, 525, 489, 4905, 742, 525, 21150, 29914, 7328, 29899, 2909, 29889, 1420, 11287, 13, 13, 1678, 822, 1243, 29918, 4773, 29918, 700, 284, 29918, 2080, 29898, 1311, 1125, 13, 4706, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 2080, 742, 525, 4773, 29914, 11922, 29889, 3126, 742, 13, 462, 795, 525, 489, 6886, 742, 525, 4773, 29914, 7328, 29899, 2909, 29889, 29885, 4614, 742, 13, 462, 795, 525, 489, 4905, 742, 525, 21150, 29914, 7328, 29899, 2909, 29889, 1420, 11287, 13, 13, 1678, 822, 1243, 29918, 4773, 29918, 1217, 29918, 2080, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 429, 29901, 13, 9651, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 6886, 742, 525, 4773, 29914, 7328, 29899, 2909, 29889, 29885, 4614, 742, 13, 462, 462, 29871, 525, 489, 4905, 742, 525, 21150, 29914, 7328, 29899, 2909, 29889, 1420, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29892, 429, 29889, 11739, 29889, 401, 29897, 13, 13, 1678, 822, 1243, 29918, 4773, 29918, 1217, 29918, 6886, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 429, 29901, 13, 9651, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 2080, 742, 525, 4773, 29914, 11922, 29889, 3126, 742, 13, 462, 462, 29871, 525, 489, 2080, 742, 525, 4773, 29914, 1287, 29889, 3126, 742, 13, 462, 462, 29871, 525, 489, 4905, 742, 525, 21150, 29914, 7328, 29899, 2909, 29889, 1420, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29892, 429, 29889, 11739, 29889, 401, 29897, 13, 13, 1678, 822, 1243, 29918, 4773, 29918, 1217, 29918, 4905, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 429, 29901, 13, 9651, 4390, 29918, 517, 29918, 29885, 4614, 29918, 17699, 18959, 489, 2080, 742, 525, 4773, 29914, 11922, 29889, 3126, 742, 13, 462, 462, 29871, 525, 489, 2080, 742, 525, 4773, 29914, 1287, 29889, 3126, 742, 13, 462, 462, 29871, 525, 489, 6886, 742, 525, 4773, 29914, 7328, 29899, 2909, 29889, 29885, 4614, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29892, 429, 29889, 11739, 29889, 401, 29897, 13, 2 ]
setup.py
goude/thxtime
0
149857
<filename>setup.py from setuptools import setup, find_packages setup( name="thxtime", version="2.0.0", packages=find_packages(), )
[ 1, 529, 9507, 29958, 14669, 29889, 2272, 13, 3166, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 14669, 29898, 13, 1678, 1024, 543, 386, 486, 603, 613, 13, 1678, 1873, 543, 29906, 29889, 29900, 29889, 29900, 613, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 29897, 13, 2 ]
mcml_convolution.py
harveyiliu/mcml-photon-scattering-python
3
79345
<filename>mcml_convolution.py import numpy as np from scipy import integrate import mcml_photon_scattering class Beam: """Beam class - incident light beam class Parameters to describe a photon beam. Pencil: infinitely narrow beam. This is default for the beam from the mcml output. Flat: Flat beam with radius R. Gaussian: Gaussian with 1/e2 radius R. Others: general beam described by points with interpolation. Class instance variables: type - incident beam type, FLAT or GAUSSIAN P - total beam power/energy [W or J] R - beam radius, defined as 1/e^2 for Gaussian beam [cm] Methods: """ def __init__(self): self.type = None self.P = 0 self.R = 0 class Node: """Node class - node link list binary tree class Data structures for the binary tree used to store part of the integrand evaluation. Class instance variables: x - x grid node position y - y grid node position left - left node pointer right - right node pointer Methods: """ def __init__(self): self.x = None self.y = None self.left = None self.right = None def fill_node(x, y): l = Node() l.x = x l.y = y return l def search_node(tree, x): l = tree found = False while (l != None and found == False): if x < l.x: l = l.left elif x > l.x: l = l.right else: found = True return l def insert_node(tree, x, y): l1 = None l2 = tree while l2 != None: l1 = l2 if x < l2.x: l2 = l2.left else: l2 = l2.right if l1 == None: # Empty tree. tree = fill_node(x, y) elif x < l1.x: l1.left = fill_node(x, y) else: l1.right = fill_node(x, y) class ConvVar: """ConvVar class - convoluation variables class A global structure to pass the current coordinate of the physical quantities being evaluated and the pointers of the input and output parameters to the integration function. Class instance variables: r - r position iz - iz index ia - ia index tree - A tree to store ITheta() & ExpBessI0(). Methods: """ def __init__(self): self.r = 0 self.iz = 0 self.ia = 0 self.tree = None # A tree to store ITheta() & ExpBessI0(). class ConvInput: """ConvInput class - beam convolution input class Input parameters for each independent run. z and r are for the cylindrical coordinate system. [cm] a is for the angle alpha between the photon exiting direction and the surface normal. [radian] The grid line separations in z, r, and alpha directions are dz, dr, and da respectively. The numbers of grid lines in z, r, and alpha directions are nz, nr, and na respectively. The member layerspecs will point to an array of structures which store parameters of each layer. This array has (number_layers + 2) elements. One element is for a layer. The layers 0 and (num_layers + 1) are for top ambient medium and the bottom ambient medium respectively. For convolution, the grid line separations in z, and alpha directions are still dz, and da respectively. The numbers of grid lines in z, and alpha directions are still nz, and na respectively. However, the grid line separation and the number of grid lines in r direction are drc and nrc respectively. Class instance variables: beam - incident beam class instance object drc - convolution r grid separation.[cm] nrc - convolution array range 0..nrc-1. eps - relative error in convolution Methods: """ def __init__(self, mcmlModel, beamType = 'FLAT', P = 1, R = 0): self.beam = Beam() if beamType.lower() == 'FLAT'.lower(): self.beam.type = 'FLAT' # incident beam of finite size elif beamType.lower() == 'GAUSSIAN'.lower(): self.beam.type = 'GAUSSIAN' else: self.beam.type = 'FLAT' self.mcmlModel = mcmlModel self.convVar = ConvVar() self.beam.P = P self.beam.R = np.maximum(R, 1e-5) # minimum radius required minR = 1.2*(R + mcmlModel.nr*mcmlModel.dr) self.drc = np.maximum(mcmlModel.dr, minR/200) self.nrc = int(minR/self.drc) class MCMLConv(ConvInput): """MCMLConv class - multi-layered photon scattering model beam convolution inherits from ConvInput beam setup Structures for scored physical quantities from mcml and to be convolved for photon beams of finite size. Therefore, "Out" here means the output of both mcml and conv. The member allocated is used to keep the status of the arrays. It is set to 1 if all the arrays are allocated and assigned values. It is set to 0 otherwise. z and r represent z and r coordinates of the cylindrical coordinate system. [cm] a is the angle alpha between the photon exiting direction and the normal to the surfaces. [radian] See comments of the InputStruct. See manual for the physcial quantities. Class instance variables: Rd_rac - convolved data. [J/(cm2 sr)] Rd_rc - 1D radial distribution of diffuse reflectance [J/cm2] A_rzc - 2D probability density in turbid media over r & z [J/cm3] Tt_rac - 2D distribution of total transmittance [J/(cm2 sr)] Tt_rc - 1D radial distribution of transmittance [J/cm2] Methods: """ def __init__(self, mcmlModel, beamType = 'FLAT', P = 1, R = 0): # extend the ConvInput base class instance variables ConvInput.__init__(self, mcmlModel, beamType, P, R) # initialize the model grid arrays self.Rd_rac = np.matrix(np.zeros((self.nrc, self.mcmlModel.na))) self.Rd_rc = np.zeros(self.nrc) self.A_rzc = np.matrix(np.zeros((self.nrc, self.mcmlModel.nz))) self.Tt_rac = np.matrix(np.zeros((self.nrc, self.mcmlModel.na))) self.Tt_rc = np.zeros(self.nrc) self.F_rzc = np.matrix(np.zeros((self.nrc, self.mcmlModel.nz))) def run_conv(self): self.conv_Rd_ra() self.conv_Rd_r() self.conv_A_rz() self.conv_Tt_ra() self.conv_Tt_r() self.conv_A2F() def conv_Rd_ra(self): P = self.beam.P R = self.beam.R for irc in range(self.nrc): rc = (irc + 0.5)*self.drc self.convVar.r = rc self.convVar.tree = None # init the tree for ia in range(self.mcmlModel.na): self.convVar.ia = ia if self.beam.type.lower() == 'FLAT'.lower(): self.Rd_rac[irc, ia] = 2*P/(R*R) \ *flat_integration(Rd_ra_FG_integrand, self) else : # Gaussian self.Rd_rac[irc, ia] = 4*P/(R*R) \ *Gauss_integration(Rd_ra_FG_integrand, self) def conv_Rd_r(self): P = self.beam.P R = self.beam.R for irc in range(self.nrc): rc = (irc + 0.5)*self.drc self.convVar.r = rc if self.beam.type.lower() == 'FLAT'.lower(): self.Rd_rc[irc] = 2*P/(R*R) \ *flat_integration(Rd_r_FG_integrand, self) else : # Gaussian self.Rd_rc[irc] = 4*P/(R*R) \ *Gauss_integration(Rd_r_FG_integrand, self) def conv_A_rz(self): P = self.beam.P R = self.beam.R for irc in range(self.nrc): rc = (irc + 0.5)*self.drc self.convVar.r = rc self.convVar.tree = None # init the tree for iz in range(self.mcmlModel.nz): self.convVar.iz = iz if self.beam.type.lower() == 'FLAT'.lower(): self.A_rzc[irc, iz] = 2*P/(R*R) \ *flat_integration(A_rz_FG_integrand, self) else: # Gaussian self.A_rzc[irc, iz] = 4*P/(R*R) \ *Gauss_integration(A_rz_FG_integrand, self) def conv_Tt_ra(self): P = self.beam.P R = self.beam.R for irc in range(self.nrc): rc = (irc + 0.5)*self.drc self.convVar.r = rc self.convVar.tree = None # init the tree for ia in range(self.mcmlModel.na): self.convVar.ia = ia if self.beam.type.lower() == 'FLAT'.lower(): self.Tt_rac[irc, ia] = 2*P/(R*R) \ *flat_integration(Tt_ra_FG_integrand, self) else: # Gaussian self.Tt_rac[irc, ia] = 4*P/(R*R) \ *Gauss_integration(Tt_ra_FG_integrand, self) def conv_Tt_r(self): P = self.beam.P R = self.beam.R for irc in range(self.nrc): rc = (irc + 0.5)*self.drc self.convVar.r = rc if self.beam.type.lower() == 'FLAT'.lower(): self.Tt_rc[irc] = 2*P/(R*R) \ *flat_integration(Tt_r_FG_integrand, self) else : # Gaussian self.Tt_rc[irc] = 4*P/(R*R) \ *Gauss_integration(Tt_r_FG_integrand, self) def conv_A2F(self): nz = self.mcmlModel.nz for irc in range(self.nrc): for iz in range(nz): mua = self.mcmlModel.get_mua_at_iz(iz) if (mua > 0.0): self.F_rzc[irc, iz] = self.A_rzc[irc, iz]/mua # F in J/cm2 def center_half_max_depth(self): nz = self.mcmlModel.nz dz = self.mcmlModel.dz depth = 0 for iz in range(nz): if self.F_rzc[0, iz] <= 0.5*self.F_rzc[0, 0]: depth = (iz + 0.5)*dz break return depth def surface_half_max_width(self): width = 0 for irc in range(self.nrc): if self.F_rzc[irc, 0] <= 0.5*self.F_rzc[0, 0]: width = 2*(irc + 0.5)*self.drc break return width def I_theta(r, r2, R): if R >= (r + r2): temp = 1 elif np.fabs(r - r2) <= R: temp = (r*r + r2*r2 - R*R)/(2*r*r2) if np.fabs(temp) > 1: temp = np.sign(temp) temp = np.arccos(temp)/np.pi else : # R < fabs(r-r2) temp = 0 return temp def modified_Bess_I0(x): # Modified Bessel function exp(-x) I0(x), for x >=0. # We modified from the original bessi0(). Instead of # I0(x) itself, it returns I0(x) exp(-x). ax = np.fabs(x) if ax < 3.75: y = x/3.75 y *= y ans = np.exp(-ax)*(1.0 + y*(3.5156229 + y*(3.0899424 + y*(1.2067492 \ + y*(0.2659732 + y*(0.360768e-1 + y*0.45813e-2)))))) else: y = 3.75/ax ans = (1/(ax**0.5))*(0.39894228 + y*(0.1328592e-1 \ + y*(0.225319e-2 + y*(-0.157565e-2 + y*(0.916281e-2 \ + y*(-0.2057706e-1 + y*(0.2635537e-1 + y*(-0.1647633e-1 \ + y * 0.392377e-2)))))))) return ans def exp_Bess_I0(r, r2, R): _RR = 1/(R*R) x = 4*r*r2*_RR y = 2*(r2*r2 + r*r)*_RR expbess = np.exp(-y + x)*modified_Bess_I0(x) return expbess def RT_ra_interp(r2, RT_ra, mcmlConv): # Interpolate for the arrays Rd_ra[] or Tt_ra[]. nr = mcmlConv.mcmlModel.nr ir2 = r2/mcmlConv.mcmlModel.dr ia = mcmlConv.convVar.ia if nr < 3: RT_at_r2 = RT_ra[0, ia] elif ir2 < (nr - 1.5): # interpolation ir2lo = np.maximum(0, int(ir2 - 0.5)) # truncation RT_lo = RT_ra[ir2lo, ia] RT_hi = RT_ra[ir2lo + 1, ia] RT_at_r2 = RT_lo + (RT_hi - RT_lo)*(ir2 - ir2lo - 0.5) else: # extrapolation ir2lo = nr - 3 RT_lo = RT_ra[ir2lo, ia] RT_hi = RT_ra[ir2lo + 1, ia] if RT_lo >= RT_hi: # Noise test RT_at_r2 = RT_lo + (RT_hi - RT_lo)*(ir2 - ir2lo - 0.5) else: RT_at_r2 = 0.0 return np.maximum(0, RT_at_r2) def RT_r_interp(r2, RT_r, mcmlConv): # Interpolate for the arrays Rd_r[] or Tt_r[]. nr = mcmlConv.mcmlModel.nr ir2 = r2/mcmlConv.mcmlModel.dr if nr < 3: RT_at_r2 = RT_r[0] elif ir2 < (nr - 1.5): # interpolation ir2lo = np.maximum(0, int(ir2 - 0.5)) # truncation RT_lo = RT_r[ir2lo] RT_hi = RT_r[ir2lo + 1] RT_at_r2 = RT_lo + (RT_hi - RT_lo)*(ir2 - ir2lo - 0.5) else: # extrapolation ir2lo = nr - 3 RT_lo = RT_r[ir2lo] RT_hi = RT_r[ir2lo + 1] if RT_lo >= RT_hi: # Noise test RT_at_r2 = RT_lo + (RT_hi - RT_lo)*(ir2 - ir2lo - 0.5) else: RT_at_r2 = 0.0 return np.maximum(0, RT_at_r2) def A_rz_interp(r2, mcmlConv): # Interpolate for the arrays A_rz[] A_rz = mcmlConv.mcmlModel.A_rz nr = mcmlConv.mcmlModel.nr ir2 = r2/mcmlConv.mcmlModel.dr iz = mcmlConv.convVar.iz if nr < 3: A_at_r2 = A_rz[0, iz] elif ir2 < (nr - 1.5): # interpolation ir2lo = np.maximum(0, int(ir2 - 0.5)) # truncation A_lo = A_rz[ir2lo, iz] A_hi = A_rz[ir2lo + 1, iz] A_at_r2 = A_lo + (A_hi - A_lo)*(ir2 - ir2lo - 0.5) else: # extrapolation ir2lo = nr - 3 A_lo = A_rz[ir2lo, iz] A_hi = A_rz[ir2lo + 1, iz] if A_lo >= A_hi: # Noise test A_at_r2 = A_lo + (A_hi - A_lo)*(ir2 - ir2lo - 0.5) else: A_at_r2 = 0.0 return np.maximum(0, A_at_r2) def Rd_ra_FG_integrand(r2, mcmlConv): # Convolution integrand for either flat or gaussian beams. # See comments for A_rzFGIntegrand(). # r" in the integration. RT_ra = mcmlConv.mcmlModel.Rd_ra Rd_at_r2 = RT_ra_interp(r2, RT_ra, mcmlConv) R = mcmlConv.beam.R r = mcmlConv.convVar.r tree = mcmlConv.convVar.tree link = search_node(tree, r2) if link != None: # f in tree. f = link.y else: if mcmlConv.beam.type.lower() == 'FLAT'.lower(): f = I_theta(r, r2, R) else: # Gaussian f = exp_Bess_I0(r, r2, R) insert_node(tree, r2, f) f *= Rd_at_r2*r2 return f def Rd_r_FG_integrand(r2, mcmlConv): # Convolution integrand for either flat or gaussian beams. # See comments for A_rzFGIntegrand(). # r" in the integration RT_r = mcmlConv.mcmlModel.Rd_r Rd_at_r2 = RT_r_interp(r2, RT_r, mcmlConv) R = mcmlConv.beam.R r = mcmlConv.convVar.r if mcmlConv.beam.type.lower() == 'FLAT'.lower(): f = Rd_at_r2*I_theta(r, r2, R)*r2 else : # Gaussian f = Rd_at_r2*exp_Bess_I0(r, r2, R)*r2 return f def A_rz_FG_integrand(r2, mcmlConv): # Convolution integrand for either flat or gaussian beams. # Return the integrand for the convolution integral. # r2 is the r" in the formula shown in the manual. # When r2 is in the range of recorded array, interpolation # is used to evaluate the diffuse reflectance at r2. # Note that since the last grid elements collect all the # photon weight that falls beyond the grid system, we should # avoid using them in the convolution. # r" in the integration A_at_r2 = A_rz_interp(r2, mcmlConv) R = mcmlConv.beam.R r = mcmlConv.convVar.r tree = mcmlConv.convVar.tree link = search_node(tree, r2) if link != None: # f in tree f = link.y else: if mcmlConv.beam.type.lower() == 'FLAT'.lower(): f = I_theta(r, r2, R) else: # Gaussian f = exp_Bess_I0(r, r2, R) insert_node(tree, r2, f) f *= A_at_r2*r2 return f def Tt_ra_FG_integrand(r2, mcmlConv): # Convolution integrand for either flat or gaussian beams. # See comments for A_rzFGIntegrand(). # r" in the integration. TT_ra = mcmlConv.mcmlModel.Tt_ra Tt_at_r2 = RT_ra_interp(r2, TT_ra, mcmlConv) R = mcmlConv.beam.R r = mcmlConv.convVar.r tree = mcmlConv.convVar.tree link = search_node(tree, r2) if link != None: # f in tree f = link.y else: if mcmlConv.beam.type.lower() == 'FLAT'.lower(): f = I_theta(r, r2, R) else : # Gaussian f = exp_Bess_I0(r, r2, R) insert_node(tree, r2, f) f *= Tt_at_r2*r2 return f def Tt_r_FG_integrand(r2, mcmlConv): # Convolution integrand for either flat or gaussian beams. # See comments for A_rzFGIntegrand(). # r" in the integration TT_r = mcmlConv.mcmlModel.Tt_r Tt_at_r2 = RT_r_interp(r2, TT_r, mcmlConv) R = mcmlConv.beam.R r = mcmlConv.convVar.r if mcmlConv.beam.type.lower() == 'FLAT'.lower(): f = Tt_at_r2*I_theta(r, r2, R)*r2 else : # Gaussian f = Tt_at_r2*exp_Bess_I0(r, r2, R)*r2 return f def flat_integration(func, mcmlConv): rc = mcmlConv.convVar.r R = mcmlConv.beam.R b_max = (mcmlConv.mcmlModel.nr - 0.5)*mcmlConv.mcmlModel.dr a = np.maximum(0, rc - R) b = np.minimum(b_max, rc + R) if (a >= b): return 0 else: return integrate.quad(func, a, b, args=(mcmlConv,), \ epsabs=1.0e-4, epsrel=1.0e-5, limit=500)[0] def Gauss_integration(func, mcmlConv): # Used by convolution over Gaussian beam. Ignore the value # beyond GAUSSLIMIT radius. GAUSSLIMIT = 4 rc = mcmlConv.convVar.r R = mcmlConv.beam.R b_max = (mcmlConv.mcmlModel.nr - 0.5)*mcmlConv.mcmlModel.dr a = np.maximum(0, (rc - GAUSSLIMIT * R)) b = np.minimum(b_max, (rc + GAUSSLIMIT * R)) if (a >= b): return 0 else: return integrate.quad(func, a, b, args=(mcmlConv,), \ epsabs=1.0e-4, epsrel=1.0e-5, limit=500)[0]
[ 1, 529, 9507, 29958, 14047, 828, 29918, 535, 4068, 29889, 2272, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 4560, 2272, 1053, 22782, 13, 5215, 286, 29883, 828, 29918, 561, 327, 265, 29918, 1557, 2620, 292, 13, 13, 1990, 1522, 314, 29901, 13, 1678, 9995, 3629, 314, 770, 448, 15134, 3578, 22913, 770, 13, 4706, 12662, 2699, 304, 8453, 263, 6731, 265, 22913, 29889, 13, 4706, 349, 3977, 309, 29901, 29047, 12474, 22913, 29889, 910, 338, 2322, 363, 278, 13, 9651, 22913, 515, 278, 286, 29883, 828, 1962, 29889, 13, 4706, 2379, 271, 29901, 12, 29943, 5066, 22913, 411, 11855, 390, 29889, 13, 4706, 22477, 29901, 12, 29954, 17019, 411, 29871, 29896, 29914, 29872, 29906, 11855, 390, 29889, 13, 4706, 438, 3341, 29901, 2498, 22913, 5439, 491, 3291, 411, 29694, 29889, 13, 4706, 4134, 2777, 3651, 29901, 13, 9651, 1134, 448, 15134, 22913, 1134, 29892, 383, 29931, 1299, 470, 402, 25951, 1799, 29902, 2190, 13, 9651, 349, 448, 3001, 22913, 3081, 29914, 27548, 518, 29956, 470, 435, 29962, 13, 9651, 390, 448, 22913, 11855, 29892, 3342, 408, 29871, 29896, 29914, 29872, 29985, 29906, 363, 22477, 22913, 518, 4912, 29962, 13, 4706, 8108, 29879, 29901, 13, 632, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 1853, 353, 6213, 13, 4706, 1583, 29889, 29925, 353, 29871, 29900, 13, 4706, 1583, 29889, 29934, 353, 29871, 29900, 13, 13, 13, 1990, 9071, 29901, 13, 1678, 9995, 4247, 770, 448, 2943, 1544, 1051, 7581, 5447, 770, 13, 4706, 3630, 12286, 363, 278, 7581, 5447, 1304, 304, 3787, 760, 310, 13, 4706, 278, 3990, 392, 17983, 29889, 13, 308, 13, 4706, 4134, 2777, 3651, 29901, 13, 9651, 921, 448, 921, 6856, 2943, 2602, 13, 9651, 343, 448, 343, 6856, 2943, 2602, 13, 9651, 2175, 448, 2175, 2943, 4879, 13, 9651, 1492, 448, 1492, 2943, 4879, 965, 13, 4706, 8108, 29879, 29901, 13, 632, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 29916, 353, 6213, 13, 4706, 1583, 29889, 29891, 353, 6213, 13, 4706, 1583, 29889, 1563, 353, 6213, 13, 4706, 1583, 29889, 1266, 353, 6213, 13, 29871, 13, 1678, 13, 1753, 5445, 29918, 3177, 29898, 29916, 29892, 343, 1125, 13, 1678, 301, 353, 9071, 580, 13, 1678, 301, 29889, 29916, 353, 921, 13, 1678, 301, 29889, 29891, 353, 343, 13, 1678, 736, 301, 13, 13, 13, 1753, 2740, 29918, 3177, 29898, 8336, 29892, 921, 1125, 13, 1678, 301, 353, 5447, 13, 1678, 1476, 353, 7700, 13, 1678, 1550, 313, 29880, 2804, 6213, 322, 1476, 1275, 7700, 1125, 13, 4706, 565, 921, 529, 301, 29889, 29916, 29901, 13, 9651, 301, 353, 301, 29889, 1563, 13, 4706, 25342, 921, 1405, 301, 29889, 29916, 29901, 13, 9651, 301, 353, 301, 29889, 1266, 13, 4706, 1683, 29901, 13, 9651, 1476, 353, 5852, 13, 1678, 736, 301, 13, 13, 1753, 4635, 29918, 3177, 29898, 8336, 29892, 921, 29892, 343, 1125, 13, 1678, 301, 29896, 353, 6213, 13, 1678, 301, 29906, 353, 5447, 13, 1678, 1550, 301, 29906, 2804, 6213, 29901, 13, 4706, 301, 29896, 353, 301, 29906, 13, 4706, 565, 921, 529, 301, 29906, 29889, 29916, 29901, 13, 9651, 301, 29906, 353, 301, 29906, 29889, 1563, 13, 4706, 1683, 29901, 13, 9651, 301, 29906, 353, 301, 29906, 29889, 1266, 13, 13, 1678, 565, 301, 29896, 1275, 6213, 29901, 12, 12, 29937, 2812, 2349, 5447, 29889, 13, 4706, 5447, 353, 5445, 29918, 3177, 29898, 29916, 29892, 343, 29897, 13, 1678, 25342, 921, 529, 301, 29896, 29889, 29916, 29901, 13, 4706, 301, 29896, 29889, 1563, 353, 5445, 29918, 3177, 29898, 29916, 29892, 343, 29897, 13, 1678, 1683, 29901, 13, 4706, 301, 29896, 29889, 1266, 353, 5445, 29918, 3177, 29898, 29916, 29892, 343, 29897, 13, 13, 13, 13, 1990, 1281, 29894, 9037, 29901, 13, 1678, 9995, 1168, 29894, 9037, 770, 448, 378, 1555, 29884, 362, 3651, 770, 13, 4706, 319, 5534, 3829, 304, 1209, 278, 1857, 14821, 310, 278, 13, 4706, 9128, 26855, 1641, 19030, 322, 278, 12589, 310, 278, 13, 4706, 1881, 322, 1962, 4128, 304, 278, 13465, 740, 29889, 13, 308, 13, 4706, 4134, 2777, 3651, 29901, 13, 9651, 364, 448, 364, 2602, 13, 9651, 5951, 448, 5951, 2380, 13, 632, 423, 448, 29871, 423, 2380, 13, 9651, 5447, 448, 319, 5447, 304, 3787, 306, 17458, 580, 669, 12027, 29933, 404, 29902, 29900, 2141, 9651, 13, 4706, 8108, 29879, 29901, 13, 632, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 29878, 353, 29871, 29900, 13, 4706, 1583, 29889, 466, 353, 29871, 29900, 13, 4706, 1583, 29889, 423, 353, 29871, 29900, 13, 4706, 1583, 29889, 8336, 353, 6213, 418, 396, 319, 5447, 304, 3787, 306, 17458, 580, 669, 12027, 29933, 404, 29902, 29900, 2141, 13, 13, 13, 1990, 1281, 29894, 4290, 29901, 13, 1678, 9995, 1168, 29894, 4290, 770, 448, 22913, 26851, 1881, 770, 13, 4706, 10567, 4128, 363, 1269, 7417, 1065, 29889, 13, 4706, 503, 322, 364, 526, 363, 278, 20396, 513, 16888, 14821, 1788, 29889, 518, 4912, 29962, 13, 4706, 263, 338, 363, 278, 10696, 15595, 1546, 278, 6731, 265, 6876, 292, 13, 4706, 5305, 322, 278, 7101, 4226, 29889, 518, 3665, 713, 29962, 13, 4706, 450, 6856, 1196, 2903, 800, 297, 503, 29892, 364, 29892, 322, 15595, 13, 4706, 18112, 526, 9275, 29892, 4192, 29892, 322, 1146, 8307, 29889, 29871, 450, 3694, 13, 4706, 310, 6856, 3454, 297, 503, 29892, 364, 29892, 322, 15595, 18112, 526, 13, 4706, 302, 29920, 29892, 17114, 29892, 322, 1055, 8307, 29889, 13, 4706, 450, 4509, 15359, 412, 2395, 674, 1298, 304, 385, 1409, 310, 13, 4706, 12286, 607, 3787, 4128, 310, 1269, 7546, 29889, 13, 4706, 910, 1409, 756, 313, 4537, 29918, 29277, 718, 29871, 29906, 29897, 3161, 29889, 3118, 13, 4706, 1543, 338, 363, 263, 7546, 29889, 13, 4706, 450, 15359, 29871, 29900, 322, 313, 1949, 29918, 29277, 718, 29871, 29896, 29897, 526, 363, 2246, 25040, 13, 4706, 18350, 322, 278, 5970, 25040, 18350, 8307, 29889, 13, 4706, 1152, 26851, 29892, 278, 6856, 1196, 2903, 800, 297, 503, 29892, 322, 15595, 13, 4706, 18112, 526, 1603, 9275, 29892, 322, 1146, 8307, 29889, 29871, 450, 3694, 13, 4706, 310, 6856, 3454, 297, 503, 29892, 322, 15595, 18112, 526, 1603, 13, 4706, 302, 29920, 29892, 322, 1055, 8307, 29889, 2398, 29892, 278, 6856, 1196, 23683, 13, 4706, 322, 278, 1353, 310, 6856, 3454, 297, 364, 5305, 526, 270, 2214, 322, 13, 4706, 302, 2214, 8307, 29889, 13, 4706, 4134, 2777, 3651, 29901, 13, 9651, 22913, 448, 15134, 22913, 770, 2777, 1203, 13, 9651, 270, 2214, 448, 26851, 364, 6856, 23683, 7226, 4912, 29962, 13, 9651, 302, 2214, 448, 26851, 1409, 3464, 29871, 29900, 636, 29876, 2214, 29899, 29896, 29889, 13, 9651, 321, 567, 448, 6198, 1059, 297, 26851, 9651, 13, 4706, 8108, 29879, 29901, 13, 632, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 286, 29883, 828, 3195, 29892, 22913, 1542, 353, 525, 10536, 1299, 742, 349, 353, 29871, 29896, 29892, 390, 353, 29871, 29900, 1125, 13, 4706, 1583, 29889, 915, 314, 353, 1522, 314, 580, 13, 4706, 565, 22913, 1542, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 9651, 1583, 29889, 915, 314, 29889, 1853, 353, 525, 10536, 1299, 29915, 418, 396, 15134, 22913, 310, 8093, 2159, 13, 4706, 25342, 22913, 1542, 29889, 13609, 580, 1275, 525, 12739, 29965, 1799, 29902, 2190, 4286, 13609, 7295, 13, 9651, 1583, 29889, 915, 314, 29889, 1853, 353, 525, 12739, 29965, 1799, 29902, 2190, 29915, 29871, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 915, 314, 29889, 1853, 353, 525, 10536, 1299, 29915, 13, 4706, 1583, 29889, 14047, 828, 3195, 353, 286, 29883, 828, 3195, 13, 4706, 1583, 29889, 20580, 9037, 353, 1281, 29894, 9037, 580, 13, 4706, 1583, 29889, 915, 314, 29889, 29925, 353, 349, 13, 4706, 1583, 29889, 915, 314, 29889, 29934, 353, 7442, 29889, 27525, 398, 29898, 29934, 29892, 29871, 29896, 29872, 29899, 29945, 29897, 539, 396, 9212, 11855, 3734, 13, 4706, 1375, 29934, 353, 29871, 29896, 29889, 29906, 16395, 29934, 718, 286, 29883, 828, 3195, 29889, 22230, 29930, 14047, 828, 3195, 29889, 7707, 29897, 13, 4706, 1583, 29889, 29881, 2214, 353, 7442, 29889, 27525, 398, 29898, 14047, 828, 3195, 29889, 7707, 29892, 1375, 29934, 29914, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 29876, 2214, 353, 938, 29898, 1195, 29934, 29914, 1311, 29889, 29881, 2214, 29897, 13, 632, 13, 13, 13, 1990, 21271, 1988, 1168, 29894, 29898, 1168, 29894, 4290, 1125, 13, 1678, 9995, 12513, 1988, 1168, 29894, 770, 448, 2473, 29899, 13148, 287, 6731, 265, 14801, 292, 1904, 22913, 26851, 13, 4706, 7846, 1169, 515, 1281, 29894, 4290, 22913, 6230, 13, 4706, 28771, 1973, 363, 15569, 9128, 26855, 13, 4706, 515, 286, 29883, 828, 322, 304, 367, 378, 1555, 1490, 363, 6731, 265, 13, 4706, 367, 2232, 310, 8093, 2159, 29889, 29871, 7857, 29892, 376, 3744, 29908, 13, 4706, 1244, 2794, 278, 1962, 310, 1716, 286, 29883, 828, 322, 7602, 29889, 13, 4706, 450, 4509, 19591, 338, 1304, 304, 3013, 278, 4660, 13, 4706, 310, 278, 7049, 29889, 29871, 739, 338, 731, 304, 29871, 29896, 565, 599, 278, 7049, 13, 4706, 526, 19591, 322, 9859, 1819, 29889, 29871, 739, 338, 731, 304, 13, 308, 29900, 6467, 29889, 13, 4706, 503, 322, 364, 2755, 503, 322, 364, 10350, 310, 278, 13, 4706, 20396, 513, 16888, 14821, 1788, 29889, 518, 4912, 29962, 13, 4706, 263, 338, 278, 10696, 15595, 1546, 278, 6731, 265, 6876, 292, 13, 4706, 5305, 322, 278, 4226, 304, 278, 28001, 29889, 518, 3665, 713, 29962, 13, 4706, 2823, 6589, 310, 278, 10567, 19560, 29889, 13, 4706, 2823, 12219, 363, 278, 4824, 1455, 26855, 29889, 13, 4706, 4134, 2777, 3651, 29901, 13, 9651, 390, 29881, 29918, 945, 448, 378, 1555, 1490, 848, 29889, 518, 29967, 14571, 4912, 29906, 27236, 4638, 13, 9651, 390, 29881, 29918, 2214, 448, 29871, 29896, 29928, 28373, 4978, 310, 2923, 1509, 9432, 749, 518, 29967, 29914, 4912, 29906, 29962, 13, 9651, 319, 29918, 11987, 29883, 448, 29871, 29906, 29928, 6976, 9027, 297, 7013, 23883, 5745, 975, 364, 669, 503, 518, 29967, 29914, 4912, 29941, 29962, 13, 9651, 323, 29873, 29918, 945, 448, 29871, 29906, 29928, 4978, 310, 3001, 1301, 18344, 749, 518, 29967, 14571, 4912, 29906, 27236, 4638, 13, 9651, 323, 29873, 29918, 2214, 448, 29871, 29896, 29928, 28373, 4978, 310, 1301, 18344, 749, 518, 29967, 29914, 4912, 29906, 29962, 13, 4706, 8108, 29879, 29901, 13, 632, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 286, 29883, 828, 3195, 29892, 22913, 1542, 353, 525, 10536, 1299, 742, 349, 353, 29871, 29896, 29892, 390, 353, 29871, 29900, 1125, 13, 4706, 396, 10985, 278, 1281, 29894, 4290, 2967, 770, 2777, 3651, 13, 4706, 1281, 29894, 4290, 17255, 2344, 12035, 1311, 29892, 286, 29883, 828, 3195, 29892, 22913, 1542, 29892, 349, 29892, 390, 29897, 13, 4706, 396, 11905, 278, 1904, 6856, 7049, 268, 13, 4706, 1583, 29889, 29934, 29881, 29918, 945, 353, 7442, 29889, 5344, 29898, 9302, 29889, 3298, 359, 3552, 1311, 29889, 29876, 2214, 29892, 1583, 29889, 14047, 828, 3195, 29889, 1056, 4961, 13, 4706, 1583, 29889, 29934, 29881, 29918, 2214, 353, 7442, 29889, 3298, 359, 29898, 1311, 29889, 29876, 2214, 29897, 13, 4706, 1583, 29889, 29909, 29918, 11987, 29883, 353, 7442, 29889, 5344, 29898, 9302, 29889, 3298, 359, 3552, 1311, 29889, 29876, 2214, 29892, 1583, 29889, 14047, 828, 3195, 29889, 29876, 29920, 4961, 13, 4706, 1583, 29889, 29911, 29873, 29918, 945, 353, 7442, 29889, 5344, 29898, 9302, 29889, 3298, 359, 3552, 1311, 29889, 29876, 2214, 29892, 1583, 29889, 14047, 828, 3195, 29889, 1056, 4961, 13, 4706, 1583, 29889, 29911, 29873, 29918, 2214, 353, 7442, 29889, 3298, 359, 29898, 1311, 29889, 29876, 2214, 29897, 13, 4706, 1583, 29889, 29943, 29918, 11987, 29883, 353, 7442, 29889, 5344, 29898, 9302, 29889, 3298, 359, 3552, 1311, 29889, 29876, 2214, 29892, 1583, 29889, 14047, 828, 3195, 29889, 29876, 29920, 4961, 13, 13, 268, 13, 1678, 822, 1065, 29918, 20580, 29898, 1311, 1125, 13, 4706, 1583, 29889, 20580, 29918, 29934, 29881, 29918, 336, 580, 13, 4706, 1583, 29889, 20580, 29918, 29934, 29881, 29918, 29878, 580, 13, 4706, 1583, 29889, 20580, 29918, 29909, 29918, 11987, 580, 13, 4706, 1583, 29889, 20580, 29918, 29911, 29873, 29918, 336, 580, 13, 4706, 1583, 29889, 20580, 29918, 29911, 29873, 29918, 29878, 580, 13, 4706, 1583, 29889, 20580, 29918, 29909, 29906, 29943, 580, 13, 13, 268, 13, 1678, 822, 7602, 29918, 29934, 29881, 29918, 336, 29898, 1311, 1125, 13, 4706, 349, 353, 1583, 29889, 915, 314, 29889, 29925, 13, 4706, 390, 353, 1583, 29889, 915, 314, 29889, 29934, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 364, 29883, 353, 313, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 9651, 1583, 29889, 20580, 9037, 29889, 29878, 353, 364, 29883, 13, 9651, 1583, 29889, 20580, 9037, 29889, 8336, 353, 6213, 268, 12, 29937, 2069, 278, 5447, 13, 9651, 363, 29871, 423, 297, 3464, 29898, 1311, 29889, 14047, 828, 3195, 29889, 1056, 1125, 13, 18884, 1583, 29889, 20580, 9037, 29889, 423, 353, 29871, 423, 13, 18884, 565, 1583, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 462, 1678, 1583, 29889, 29934, 29881, 29918, 945, 29961, 2076, 29892, 29871, 423, 29962, 353, 29871, 29906, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 20620, 29918, 27925, 29898, 29934, 29881, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 18884, 1683, 12, 29901, 539, 396, 22477, 13, 462, 1678, 1583, 29889, 29934, 29881, 29918, 945, 29961, 2076, 29892, 29871, 423, 29962, 353, 29871, 29946, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 29954, 11214, 29918, 27925, 29898, 29934, 29881, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 13, 13, 1678, 822, 7602, 29918, 29934, 29881, 29918, 29878, 29898, 1311, 1125, 13, 4706, 349, 353, 1583, 29889, 915, 314, 29889, 29925, 13, 4706, 390, 353, 1583, 29889, 915, 314, 29889, 29934, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 364, 29883, 353, 313, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 9651, 1583, 29889, 20580, 9037, 29889, 29878, 353, 364, 29883, 13, 9651, 565, 1583, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 18884, 1583, 29889, 29934, 29881, 29918, 2214, 29961, 2076, 29962, 353, 29871, 29906, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 1678, 334, 20620, 29918, 27925, 29898, 29934, 29881, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 9651, 1683, 12, 29901, 539, 396, 22477, 13, 18884, 1583, 29889, 29934, 29881, 29918, 2214, 29961, 2076, 29962, 353, 29871, 29946, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 1678, 334, 29954, 11214, 29918, 27925, 29898, 29934, 29881, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 13, 13, 13, 1678, 822, 7602, 29918, 29909, 29918, 11987, 29898, 1311, 1125, 13, 4706, 349, 353, 1583, 29889, 915, 314, 29889, 29925, 13, 4706, 390, 353, 1583, 29889, 915, 314, 29889, 29934, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 364, 29883, 353, 313, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 9651, 1583, 29889, 20580, 9037, 29889, 29878, 353, 364, 29883, 13, 9651, 1583, 29889, 20580, 9037, 29889, 8336, 353, 6213, 268, 12, 29937, 2069, 278, 5447, 13, 9651, 363, 5951, 297, 3464, 29898, 1311, 29889, 14047, 828, 3195, 29889, 29876, 29920, 1125, 13, 18884, 1583, 29889, 20580, 9037, 29889, 466, 353, 5951, 13, 18884, 565, 1583, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 462, 1678, 1583, 29889, 29909, 29918, 11987, 29883, 29961, 2076, 29892, 5951, 29962, 353, 29871, 29906, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 20620, 29918, 27925, 29898, 29909, 29918, 11987, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 18884, 1683, 29901, 539, 396, 22477, 13, 462, 1678, 1583, 29889, 29909, 29918, 11987, 29883, 29961, 2076, 29892, 5951, 29962, 353, 29871, 29946, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 29954, 11214, 29918, 27925, 29898, 29909, 29918, 11987, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 268, 13, 13, 13, 1678, 822, 7602, 29918, 29911, 29873, 29918, 336, 29898, 1311, 1125, 13, 4706, 349, 353, 1583, 29889, 915, 314, 29889, 29925, 13, 4706, 390, 353, 1583, 29889, 915, 314, 29889, 29934, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 364, 29883, 353, 313, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 9651, 1583, 29889, 20580, 9037, 29889, 29878, 353, 364, 29883, 13, 9651, 1583, 29889, 20580, 9037, 29889, 8336, 353, 6213, 4706, 396, 2069, 278, 5447, 13, 9651, 363, 29871, 423, 297, 3464, 29898, 1311, 29889, 14047, 828, 3195, 29889, 1056, 1125, 13, 18884, 1583, 29889, 20580, 9037, 29889, 423, 353, 29871, 423, 13, 18884, 565, 1583, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 462, 1678, 1583, 29889, 29911, 29873, 29918, 945, 29961, 2076, 29892, 29871, 423, 29962, 353, 29871, 29906, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 20620, 29918, 27925, 29898, 29911, 29873, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 18884, 1683, 29901, 539, 396, 22477, 13, 462, 1678, 1583, 29889, 29911, 29873, 29918, 945, 29961, 2076, 29892, 29871, 423, 29962, 353, 29871, 29946, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 4706, 334, 29954, 11214, 29918, 27925, 29898, 29911, 29873, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 13, 13, 1678, 822, 7602, 29918, 29911, 29873, 29918, 29878, 29898, 1311, 1125, 13, 4706, 349, 353, 1583, 29889, 915, 314, 29889, 29925, 13, 4706, 390, 353, 1583, 29889, 915, 314, 29889, 29934, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 364, 29883, 353, 313, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 9651, 1583, 29889, 20580, 9037, 29889, 29878, 353, 364, 29883, 13, 9651, 565, 1583, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 18884, 1583, 29889, 29911, 29873, 29918, 2214, 29961, 2076, 29962, 353, 29871, 29906, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 1678, 334, 20620, 29918, 27925, 29898, 29911, 29873, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 9651, 1683, 12, 29901, 539, 396, 22477, 13, 18884, 1583, 29889, 29911, 29873, 29918, 2214, 29961, 2076, 29962, 353, 29871, 29946, 29930, 29925, 14571, 29934, 29930, 29934, 29897, 320, 13, 462, 1678, 334, 29954, 11214, 29918, 27925, 29898, 29911, 29873, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29892, 1583, 29897, 13, 13, 1678, 822, 7602, 29918, 29909, 29906, 29943, 29898, 1311, 1125, 13, 4706, 302, 29920, 353, 1583, 29889, 14047, 828, 3195, 29889, 29876, 29920, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 363, 5951, 297, 3464, 29898, 29876, 29920, 1125, 13, 18884, 286, 3357, 353, 1583, 29889, 14047, 828, 3195, 29889, 657, 29918, 2589, 29874, 29918, 271, 29918, 466, 29898, 466, 29897, 13, 18884, 565, 313, 2589, 29874, 1405, 29871, 29900, 29889, 29900, 1125, 13, 462, 1678, 1583, 29889, 29943, 29918, 11987, 29883, 29961, 2076, 29892, 5951, 29962, 353, 1583, 29889, 29909, 29918, 11987, 29883, 29961, 2076, 29892, 5951, 16261, 2589, 29874, 259, 396, 383, 297, 435, 29914, 4912, 29906, 13, 13, 13, 13, 268, 13, 1678, 822, 4818, 29918, 24498, 29918, 3317, 29918, 19488, 29898, 1311, 1125, 13, 4706, 302, 29920, 353, 1583, 29889, 14047, 828, 3195, 29889, 29876, 29920, 13, 4706, 9275, 353, 1583, 29889, 14047, 828, 3195, 29889, 5601, 13, 4706, 10809, 353, 29871, 29900, 13, 4706, 363, 5951, 297, 3464, 29898, 29876, 29920, 1125, 13, 9651, 565, 1583, 29889, 29943, 29918, 11987, 29883, 29961, 29900, 29892, 5951, 29962, 5277, 29871, 29900, 29889, 29945, 29930, 1311, 29889, 29943, 29918, 11987, 29883, 29961, 29900, 29892, 29871, 29900, 5387, 13, 18884, 10809, 353, 313, 466, 718, 29871, 29900, 29889, 29945, 11877, 5601, 13, 18884, 2867, 13, 4706, 736, 10809, 13, 13, 13, 1678, 822, 7101, 29918, 24498, 29918, 3317, 29918, 2103, 29898, 1311, 1125, 13, 4706, 2920, 353, 29871, 29900, 13, 4706, 363, 29871, 2076, 297, 3464, 29898, 1311, 29889, 29876, 2214, 1125, 13, 9651, 565, 1583, 29889, 29943, 29918, 11987, 29883, 29961, 2076, 29892, 29871, 29900, 29962, 5277, 29871, 29900, 29889, 29945, 29930, 1311, 29889, 29943, 29918, 11987, 29883, 29961, 29900, 29892, 29871, 29900, 5387, 13, 18884, 2920, 353, 29871, 29906, 16395, 2076, 718, 29871, 29900, 29889, 29945, 11877, 1311, 29889, 29881, 2214, 13, 18884, 2867, 13, 4706, 736, 2920, 268, 13, 632, 13, 13, 539, 13, 13, 13, 1753, 306, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 1125, 13, 1678, 565, 390, 6736, 313, 29878, 718, 364, 29906, 1125, 13, 4706, 5694, 353, 29871, 29896, 13, 1678, 25342, 7442, 29889, 29888, 6897, 29898, 29878, 448, 364, 29906, 29897, 5277, 390, 29901, 13, 4706, 5694, 353, 313, 29878, 29930, 29878, 718, 364, 29906, 29930, 29878, 29906, 448, 390, 29930, 29934, 6802, 29898, 29906, 29930, 29878, 29930, 29878, 29906, 29897, 13, 4706, 565, 7442, 29889, 29888, 6897, 29898, 7382, 29897, 1405, 29871, 29896, 29901, 13, 9651, 5694, 353, 7442, 29889, 4530, 29898, 7382, 29897, 13, 4706, 5694, 353, 7442, 29889, 279, 617, 359, 29898, 7382, 6802, 9302, 29889, 1631, 13, 1678, 1683, 12, 29901, 12, 12, 29937, 390, 529, 285, 6897, 29898, 29878, 29899, 29878, 29906, 29897, 13, 4706, 5694, 353, 29871, 29900, 13, 1678, 736, 5694, 13, 13, 13, 13, 13, 1753, 9120, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29916, 1125, 13, 29937, 3382, 2164, 350, 25583, 740, 1518, 6278, 29916, 29897, 306, 29900, 29898, 29916, 511, 363, 921, 6736, 29900, 29889, 13, 29937, 1334, 9120, 515, 278, 2441, 289, 404, 29875, 29900, 2141, 8669, 310, 13, 29937, 306, 29900, 29898, 29916, 29897, 3528, 29892, 372, 3639, 306, 29900, 29898, 29916, 29897, 1518, 6278, 29916, 467, 13, 13, 1678, 4853, 353, 7442, 29889, 29888, 6897, 29898, 29916, 29897, 13, 1678, 565, 4853, 529, 29871, 29941, 29889, 29955, 29945, 29901, 13, 4706, 343, 353, 921, 29914, 29941, 29889, 29955, 29945, 13, 4706, 343, 334, 29922, 343, 13, 4706, 6063, 353, 7442, 29889, 4548, 6278, 1165, 11877, 29898, 29896, 29889, 29900, 718, 343, 16395, 29941, 29889, 29945, 29896, 29945, 29953, 29906, 29906, 29929, 718, 343, 16395, 29941, 29889, 29900, 29947, 29929, 29929, 29946, 29906, 29946, 718, 343, 16395, 29896, 29889, 29906, 29900, 29953, 29955, 29946, 29929, 29906, 320, 13, 9651, 718, 343, 16395, 29900, 29889, 29906, 29953, 29945, 29929, 29955, 29941, 29906, 718, 343, 16395, 29900, 29889, 29941, 29953, 29900, 29955, 29953, 29947, 29872, 29899, 29896, 718, 343, 29930, 29900, 29889, 29946, 29945, 29947, 29896, 29941, 29872, 29899, 29906, 13697, 876, 13, 1678, 1683, 29901, 13, 4706, 343, 353, 29871, 29941, 29889, 29955, 29945, 29914, 1165, 13, 4706, 6063, 353, 313, 29896, 14571, 1165, 1068, 29900, 29889, 29945, 876, 16395, 29900, 29889, 29941, 29929, 29947, 29929, 29946, 29906, 29906, 29947, 718, 343, 16395, 29900, 29889, 29896, 29941, 29906, 29947, 29945, 29929, 29906, 29872, 29899, 29896, 320, 13, 9651, 718, 343, 16395, 29900, 29889, 29906, 29906, 29945, 29941, 29896, 29929, 29872, 29899, 29906, 718, 343, 29930, 6278, 29900, 29889, 29896, 29945, 29955, 29945, 29953, 29945, 29872, 29899, 29906, 718, 343, 16395, 29900, 29889, 29929, 29896, 29953, 29906, 29947, 29896, 29872, 29899, 29906, 320, 13, 9651, 718, 343, 29930, 6278, 29900, 29889, 29906, 29900, 29945, 29955, 29955, 29900, 29953, 29872, 29899, 29896, 718, 343, 16395, 29900, 29889, 29906, 29953, 29941, 29945, 29945, 29941, 29955, 29872, 29899, 29896, 718, 343, 29930, 6278, 29900, 29889, 29896, 29953, 29946, 29955, 29953, 29941, 29941, 29872, 29899, 29896, 320, 13, 9651, 718, 343, 334, 29871, 29900, 29889, 29941, 29929, 29906, 29941, 29955, 29955, 29872, 29899, 29906, 13697, 13697, 13, 1678, 736, 6063, 13, 13, 13, 13, 1753, 1518, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 1125, 13, 1678, 903, 29934, 29934, 353, 29871, 29896, 14571, 29934, 29930, 29934, 29897, 13, 1678, 921, 353, 29871, 29946, 29930, 29878, 29930, 29878, 29906, 29930, 29918, 29934, 29934, 13, 1678, 343, 353, 29871, 29906, 16395, 29878, 29906, 29930, 29878, 29906, 718, 364, 29930, 29878, 11877, 29918, 29934, 29934, 13, 1678, 1518, 29890, 404, 353, 7442, 29889, 4548, 6278, 29891, 718, 921, 11877, 1545, 2164, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29916, 29897, 13, 1678, 736, 1518, 29890, 404, 13, 13, 13, 1753, 390, 29911, 29918, 336, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 390, 29911, 29918, 336, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 4124, 3733, 403, 363, 278, 7049, 390, 29881, 29918, 336, 2636, 470, 323, 29873, 29918, 336, 29961, 1822, 13, 1678, 17114, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 22230, 13, 13, 1678, 3805, 29906, 353, 364, 29906, 29914, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 7707, 13, 268, 423, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 423, 13, 1678, 565, 17114, 529, 29871, 29941, 29901, 13, 4706, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 336, 29961, 29900, 29892, 29871, 423, 29962, 13, 1678, 25342, 3805, 29906, 529, 313, 22230, 448, 29871, 29896, 29889, 29945, 1125, 539, 12, 29937, 29694, 13, 4706, 3805, 29906, 417, 353, 7442, 29889, 27525, 398, 29898, 29900, 29892, 938, 29898, 381, 29906, 448, 29871, 29900, 29889, 29945, 876, 12, 1678, 396, 21022, 362, 13, 4706, 390, 29911, 29918, 417, 353, 390, 29911, 29918, 336, 29961, 381, 29906, 417, 29892, 29871, 423, 29962, 13, 4706, 390, 29911, 29918, 2918, 353, 390, 29911, 29918, 336, 29961, 381, 29906, 417, 718, 29871, 29896, 29892, 29871, 423, 29962, 13, 4706, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 417, 718, 313, 13079, 29918, 2918, 448, 390, 29911, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 1678, 1683, 29901, 12, 12, 12, 29937, 1294, 2390, 22671, 13, 4706, 3805, 29906, 417, 353, 17114, 448, 29871, 29941, 13, 4706, 390, 29911, 29918, 417, 353, 390, 29911, 29918, 336, 29961, 381, 29906, 417, 29892, 29871, 423, 29962, 13, 4706, 390, 29911, 29918, 2918, 353, 390, 29911, 29918, 336, 29961, 381, 29906, 417, 718, 29871, 29896, 29892, 29871, 423, 29962, 13, 4706, 565, 390, 29911, 29918, 417, 6736, 390, 29911, 29918, 2918, 29901, 12, 12, 29937, 1939, 895, 1243, 13, 9651, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 417, 718, 313, 13079, 29918, 2918, 448, 390, 29911, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 4706, 1683, 29901, 13, 9651, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 29871, 29900, 29889, 29900, 13, 1678, 736, 7442, 29889, 27525, 398, 29898, 29900, 29892, 390, 29911, 29918, 271, 29918, 29878, 29906, 29897, 13, 13, 13, 13, 13, 1753, 390, 29911, 29918, 29878, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 390, 29911, 29918, 29878, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 4124, 3733, 403, 363, 278, 7049, 390, 29881, 29918, 29878, 2636, 470, 323, 29873, 29918, 29878, 29961, 1822, 13, 1678, 17114, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 22230, 13, 13, 1678, 3805, 29906, 353, 364, 29906, 29914, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 7707, 13, 1678, 565, 17114, 529, 29871, 29941, 29901, 13, 4706, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 29878, 29961, 29900, 29962, 13, 1678, 25342, 3805, 29906, 529, 313, 22230, 448, 29871, 29896, 29889, 29945, 1125, 418, 396, 29694, 13, 4706, 3805, 29906, 417, 353, 7442, 29889, 27525, 398, 29898, 29900, 29892, 938, 29898, 381, 29906, 448, 29871, 29900, 29889, 29945, 876, 539, 396, 21022, 362, 13, 4706, 390, 29911, 29918, 417, 353, 390, 29911, 29918, 29878, 29961, 381, 29906, 417, 29962, 13, 4706, 390, 29911, 29918, 2918, 353, 390, 29911, 29918, 29878, 29961, 381, 29906, 417, 718, 29871, 29896, 29962, 13, 4706, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 417, 718, 313, 13079, 29918, 2918, 448, 390, 29911, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 1678, 1683, 29901, 965, 396, 1294, 2390, 22671, 13, 4706, 3805, 29906, 417, 353, 17114, 448, 29871, 29941, 13, 4706, 390, 29911, 29918, 417, 353, 390, 29911, 29918, 29878, 29961, 381, 29906, 417, 29962, 13, 4706, 390, 29911, 29918, 2918, 353, 390, 29911, 29918, 29878, 29961, 381, 29906, 417, 718, 29871, 29896, 29962, 13, 4706, 565, 390, 29911, 29918, 417, 6736, 390, 29911, 29918, 2918, 29901, 418, 396, 1939, 895, 1243, 13, 9651, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 417, 718, 313, 13079, 29918, 2918, 448, 390, 29911, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 4706, 1683, 29901, 13, 9651, 390, 29911, 29918, 271, 29918, 29878, 29906, 353, 29871, 29900, 29889, 29900, 13, 1678, 736, 7442, 29889, 27525, 398, 29898, 29900, 29892, 390, 29911, 29918, 271, 29918, 29878, 29906, 29897, 13, 13, 13, 13, 13, 1753, 319, 29918, 11987, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 4124, 3733, 403, 363, 278, 7049, 319, 29918, 11987, 2636, 13, 1678, 319, 29918, 11987, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 29909, 29918, 11987, 13, 1678, 17114, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 22230, 13, 13, 1678, 3805, 29906, 353, 364, 29906, 29914, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 7707, 13, 1678, 5951, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 466, 13, 1678, 565, 17114, 529, 29871, 29941, 29901, 13, 4706, 319, 29918, 271, 29918, 29878, 29906, 353, 319, 29918, 11987, 29961, 29900, 29892, 5951, 29962, 13, 1678, 25342, 3805, 29906, 529, 313, 22230, 448, 29871, 29896, 29889, 29945, 1125, 539, 396, 29694, 13, 4706, 3805, 29906, 417, 353, 7442, 29889, 27525, 398, 29898, 29900, 29892, 938, 29898, 381, 29906, 448, 29871, 29900, 29889, 29945, 876, 259, 396, 21022, 362, 13, 4706, 319, 29918, 417, 353, 319, 29918, 11987, 29961, 381, 29906, 417, 29892, 5951, 29962, 13, 4706, 319, 29918, 2918, 353, 319, 29918, 11987, 29961, 381, 29906, 417, 718, 29871, 29896, 29892, 5951, 29962, 13, 4706, 319, 29918, 271, 29918, 29878, 29906, 353, 319, 29918, 417, 718, 313, 29909, 29918, 2918, 448, 319, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 1678, 1683, 29901, 539, 396, 1294, 2390, 22671, 13, 4706, 3805, 29906, 417, 353, 17114, 448, 29871, 29941, 13, 4706, 319, 29918, 417, 353, 319, 29918, 11987, 29961, 381, 29906, 417, 29892, 5951, 29962, 13, 4706, 319, 29918, 2918, 353, 319, 29918, 11987, 29961, 381, 29906, 417, 718, 29871, 29896, 29892, 5951, 29962, 13, 4706, 565, 319, 29918, 417, 6736, 319, 29918, 2918, 29901, 539, 396, 1939, 895, 1243, 13, 9651, 319, 29918, 271, 29918, 29878, 29906, 353, 319, 29918, 417, 718, 313, 29909, 29918, 2918, 448, 319, 29918, 417, 11877, 29898, 381, 29906, 448, 3805, 29906, 417, 448, 29871, 29900, 29889, 29945, 29897, 13, 4706, 1683, 29901, 13, 9651, 319, 29918, 271, 29918, 29878, 29906, 353, 29871, 29900, 29889, 29900, 13, 1678, 736, 7442, 29889, 27525, 398, 29898, 29900, 29892, 319, 29918, 271, 29918, 29878, 29906, 29897, 13, 13, 13, 13, 13, 13, 13, 13, 1753, 390, 29881, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 1678, 396, 1281, 4068, 3990, 392, 363, 2845, 12151, 470, 330, 17019, 367, 2232, 29889, 13, 1678, 396, 2823, 6589, 363, 319, 29918, 11987, 29943, 29954, 23573, 392, 2141, 13, 1678, 396, 364, 29908, 297, 278, 13465, 29889, 13, 13, 1678, 390, 29911, 29918, 336, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 29934, 29881, 29918, 336, 13, 1678, 390, 29881, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 336, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 390, 29911, 29918, 336, 29892, 286, 29883, 828, 1168, 29894, 29897, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 364, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 5447, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 8336, 13, 1678, 1544, 353, 2740, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29897, 13, 1678, 565, 1544, 2804, 6213, 29901, 12, 1678, 396, 285, 297, 5447, 29889, 13, 4706, 285, 353, 1544, 29889, 29891, 13, 1678, 1683, 29901, 13, 4706, 565, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 9651, 285, 353, 306, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 1683, 29901, 12, 12, 12, 29937, 22477, 13, 9651, 285, 353, 1518, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 4635, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29892, 285, 29897, 13, 13, 1678, 285, 334, 29922, 390, 29881, 29918, 271, 29918, 29878, 29906, 29930, 29878, 29906, 13, 1678, 736, 285, 13, 13, 13, 13, 13, 13, 1753, 390, 29881, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 1281, 4068, 3990, 392, 363, 2845, 12151, 470, 330, 17019, 367, 2232, 29889, 13, 29937, 2823, 6589, 363, 319, 29918, 11987, 29943, 29954, 23573, 392, 2141, 13, 29937, 364, 29908, 297, 278, 13465, 13, 13, 1678, 390, 29911, 29918, 29878, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 29934, 29881, 29918, 29878, 13, 1678, 390, 29881, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 29878, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 390, 29911, 29918, 29878, 29892, 286, 29883, 828, 1168, 29894, 29897, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 364, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 565, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 4706, 285, 353, 390, 29881, 29918, 271, 29918, 29878, 29906, 29930, 29902, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 11877, 29878, 29906, 13, 1678, 1683, 12, 29901, 539, 396, 22477, 13, 4706, 285, 353, 390, 29881, 29918, 271, 29918, 29878, 29906, 29930, 4548, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 11877, 29878, 29906, 13, 1678, 736, 285, 13, 13, 13, 13, 13, 1753, 319, 29918, 11987, 29918, 29943, 29954, 29918, 14146, 392, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 1281, 4068, 3990, 392, 363, 2845, 12151, 470, 330, 17019, 367, 2232, 29889, 13, 29937, 7106, 278, 3990, 392, 363, 278, 26851, 10160, 29889, 13, 29937, 364, 29906, 338, 278, 364, 29908, 297, 278, 7063, 4318, 297, 278, 12219, 29889, 13, 29937, 1932, 364, 29906, 338, 297, 278, 3464, 310, 10478, 1409, 29892, 29694, 13, 29937, 338, 1304, 304, 14707, 278, 2923, 1509, 9432, 749, 472, 364, 29906, 29889, 13, 29937, 3940, 393, 1951, 278, 1833, 6856, 3161, 6314, 599, 278, 13, 29937, 6731, 265, 7688, 393, 20074, 8724, 278, 6856, 1788, 29892, 591, 881, 13, 29937, 4772, 773, 963, 297, 278, 26851, 29889, 13, 29937, 364, 29908, 297, 278, 13465, 13, 13, 1678, 319, 29918, 271, 29918, 29878, 29906, 353, 319, 29918, 11987, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 29897, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 364, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 5447, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 8336, 13, 1678, 1544, 353, 2740, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29897, 13, 1678, 565, 1544, 2804, 6213, 29901, 4706, 396, 285, 297, 5447, 13, 4706, 285, 353, 1544, 29889, 29891, 13, 1678, 1683, 29901, 13, 4706, 565, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 9651, 285, 353, 306, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 1683, 29901, 539, 396, 22477, 13, 9651, 285, 353, 1518, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 4635, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29892, 285, 29897, 13, 13, 1678, 285, 334, 29922, 319, 29918, 271, 29918, 29878, 29906, 29930, 29878, 29906, 13, 1678, 736, 285, 13, 13, 13, 13, 13, 1753, 323, 29873, 29918, 336, 29918, 29943, 29954, 29918, 14146, 392, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 1281, 4068, 3990, 392, 363, 2845, 12151, 470, 330, 17019, 367, 2232, 29889, 13, 29937, 2823, 6589, 363, 319, 29918, 11987, 29943, 29954, 23573, 392, 2141, 13, 29937, 364, 29908, 297, 278, 13465, 29889, 13, 13, 1678, 323, 29911, 29918, 336, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 29911, 29873, 29918, 336, 13, 1678, 323, 29873, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 336, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 323, 29911, 29918, 336, 29892, 286, 29883, 828, 1168, 29894, 29897, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 364, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 5447, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 8336, 13, 1678, 1544, 353, 2740, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29897, 13, 1678, 565, 1544, 2804, 6213, 29901, 4706, 396, 285, 297, 5447, 13, 4706, 285, 353, 1544, 29889, 29891, 13, 1678, 1683, 29901, 13, 4706, 565, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 9651, 285, 353, 306, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 1683, 12, 29901, 539, 396, 22477, 13, 9651, 285, 353, 1518, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 29897, 13, 4706, 4635, 29918, 3177, 29898, 8336, 29892, 364, 29906, 29892, 285, 29897, 13, 13, 1678, 285, 334, 29922, 323, 29873, 29918, 271, 29918, 29878, 29906, 29930, 29878, 29906, 13, 1678, 736, 285, 13, 13, 13, 13, 13, 1753, 323, 29873, 29918, 29878, 29918, 29943, 29954, 29918, 14146, 392, 29898, 29878, 29906, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 1281, 4068, 3990, 392, 363, 2845, 12151, 470, 330, 17019, 367, 2232, 29889, 13, 29937, 2823, 6589, 363, 319, 29918, 11987, 29943, 29954, 23573, 392, 2141, 13, 29937, 364, 29908, 297, 278, 13465, 13, 13, 1678, 323, 29911, 29918, 29878, 353, 286, 29883, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 29911, 29873, 29918, 29878, 13, 1678, 323, 29873, 29918, 271, 29918, 29878, 29906, 353, 390, 29911, 29918, 29878, 29918, 1639, 29886, 29898, 29878, 29906, 29892, 323, 29911, 29918, 29878, 29892, 286, 29883, 828, 1168, 29894, 29897, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 364, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 565, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 1853, 29889, 13609, 580, 1275, 525, 10536, 1299, 4286, 13609, 7295, 13, 4706, 285, 353, 323, 29873, 29918, 271, 29918, 29878, 29906, 29930, 29902, 29918, 3416, 29898, 29878, 29892, 364, 29906, 29892, 390, 11877, 29878, 29906, 13, 1678, 1683, 12, 29901, 539, 396, 22477, 13, 4706, 285, 353, 323, 29873, 29918, 271, 29918, 29878, 29906, 29930, 4548, 29918, 29933, 404, 29918, 29902, 29900, 29898, 29878, 29892, 364, 29906, 29892, 390, 11877, 29878, 29906, 13, 1678, 736, 285, 13, 13, 13, 13, 1753, 12151, 29918, 27925, 29898, 9891, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 1678, 364, 29883, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 289, 29918, 3317, 353, 313, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 22230, 448, 29871, 29900, 29889, 29945, 11877, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 7707, 13, 1678, 263, 353, 7442, 29889, 27525, 398, 29898, 29900, 29892, 364, 29883, 448, 390, 29897, 13, 1678, 289, 353, 7442, 29889, 1195, 12539, 29898, 29890, 29918, 3317, 29892, 364, 29883, 718, 390, 29897, 13, 13, 1678, 565, 313, 29874, 6736, 289, 1125, 13, 4706, 736, 29871, 29900, 13, 1678, 1683, 29901, 13, 4706, 736, 22782, 29889, 3425, 29898, 9891, 29892, 263, 29892, 289, 29892, 6389, 7607, 14047, 828, 1168, 29894, 29892, 511, 320, 13, 9651, 321, 567, 6897, 29922, 29896, 29889, 29900, 29872, 29899, 29946, 29892, 321, 567, 2674, 29922, 29896, 29889, 29900, 29872, 29899, 29945, 29892, 4046, 29922, 29945, 29900, 29900, 9601, 29900, 29962, 13, 13, 13, 13, 1753, 402, 11214, 29918, 27925, 29898, 9891, 29892, 286, 29883, 828, 1168, 29894, 1125, 13, 29937, 501, 8485, 491, 26851, 975, 22477, 22913, 29889, 29871, 18076, 487, 278, 995, 13, 29937, 8724, 402, 25951, 1799, 5265, 26349, 11855, 29889, 13, 13, 1678, 402, 25951, 1799, 5265, 26349, 353, 29871, 29946, 13, 1678, 364, 29883, 353, 286, 29883, 828, 1168, 29894, 29889, 20580, 9037, 29889, 29878, 13, 1678, 390, 353, 286, 29883, 828, 1168, 29894, 29889, 915, 314, 29889, 29934, 13, 1678, 289, 29918, 3317, 353, 313, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 22230, 448, 29871, 29900, 29889, 29945, 11877, 14047, 828, 1168, 29894, 29889, 14047, 828, 3195, 29889, 7707, 13, 1678, 263, 353, 7442, 29889, 27525, 398, 29898, 29900, 29892, 313, 2214, 448, 402, 25951, 1799, 5265, 26349, 334, 390, 876, 13, 1678, 289, 353, 7442, 29889, 1195, 12539, 29898, 29890, 29918, 3317, 29892, 313, 2214, 718, 402, 25951, 1799, 5265, 26349, 334, 390, 876, 13, 13, 1678, 565, 313, 29874, 6736, 289, 1125, 13, 4706, 736, 29871, 29900, 13, 1678, 1683, 29901, 13, 4706, 736, 22782, 29889, 3425, 29898, 9891, 29892, 263, 29892, 289, 29892, 6389, 7607, 14047, 828, 1168, 29894, 29892, 511, 320, 13, 9651, 321, 567, 6897, 29922, 29896, 29889, 29900, 29872, 29899, 29946, 29892, 321, 567, 2674, 29922, 29896, 29889, 29900, 29872, 29899, 29945, 29892, 4046, 29922, 29945, 29900, 29900, 9601, 29900, 29962, 13, 13, 13, 632, 13, 2 ]
data/studio21_generated/introductory/3172/starter_code.py
vijaykumawat256/Prompt-Summarization
0
75442
<filename>data/studio21_generated/introductory/3172/starter_code.py def parse_fen(string):
[ 1, 529, 9507, 29958, 1272, 29914, 12073, 29906, 29896, 29918, 13525, 29914, 23333, 2199, 706, 29914, 29941, 29896, 29955, 29906, 29914, 303, 4254, 29918, 401, 29889, 2272, 13, 1753, 6088, 29918, 11350, 29898, 1807, 1125, 13, 12, 2 ]
tests/rest_t/app_t/test_security.py
maxfischer2781/tardis
4
104728
from tardis.exceptions.tardisexceptions import TardisError from tardis.rest.app.security import ( create_access_token, check_authorization, check_authentication, get_algorithm, get_secret_key, get_user, hash_password, TokenData, ) from tardis.utilities.attributedict import AttributeDict from fastapi import HTTPException, status from fastapi.security import SecurityScopes from jose import JWTError from datetime import datetime, timedelta from unittest import TestCase from unittest.mock import patch class TestSecurity(TestCase): mock_config_patcher = None @classmethod def setUpClass(cls) -> None: cls.mock_config_patcher = patch("tardis.rest.app.security.Configuration") cls.mock_config = cls.mock_config_patcher.start() @classmethod def tearDownClass(cls) -> None: cls.mock_config_patcher.stop() def setUp(self) -> None: self.secret_key = ( "689e7af69a70ad0d97f771371738be00452e81e128a876491c1d373dfbcca949" ) self.algorithm = "HS256" self.infinite_resources_get_token = "<KEY>" # noqa B950 self.limited_resources_get_token = "<KEY>" # noqa B950 self.infinite_resources_get_update_token = "<KEY>" # noqa B950 def mocked_get_user(user_name): if user_name == "test": return AttributeDict( user_name="test", hashed_password="<PASSWORD>", # noqa B509 scopes=["resources:get"], ) return None config = self.mock_config.return_value config.Services.restapi.secret_key = self.secret_key config.Services.restapi.algorithm = self.algorithm config.Services.restapi.get_user.side_effect = mocked_get_user @staticmethod def clear_lru_cache(): get_algorithm.cache_clear() get_secret_key.cache_clear() get_user.cache_clear() @patch("tardis.rest.app.security.datetime") def test_create_access_token(self, mocked_datetime): self.clear_lru_cache() token = create_access_token(user_name="test", scopes=["resources:get"]) self.assertEqual(token, self.infinite_resources_get_token) self.clear_lru_cache() token = create_access_token( user_name="test", scopes=["resources:get"], secret_key="c2ac5e498f6287c58fa941d0d2cfaf2dc271762a7ba03dcfc3ceb91bb1895d05", # noqa B950 algorithm=self.algorithm, ) self.assertEqual( token, "<KEY>", # noqa B950 ) self.clear_lru_cache() mocked_datetime.utcnow.return_value = datetime.utcfromtimestamp(0) token = create_access_token( user_name="test", scopes=["resources:get"], expires_delta=timedelta(minutes=15), ) self.assertEqual(token, self.limited_resources_get_token) self.clear_lru_cache() token = create_access_token( user_name="test", scopes=["resources:get", "resources:put"] ) self.assertEqual(token, self.infinite_resources_get_update_token) def test_check_authorization(self): self.clear_lru_cache() security_scopes = SecurityScopes(["resources:get"]) token_data = check_authorization( security_scopes, self.infinite_resources_get_token ) self.assertEqual( token_data, TokenData(scopes=security_scopes.scopes, user_name="test") ) security_scopes = SecurityScopes(["resources:put"]) with self.assertRaises(HTTPException) as he: check_authorization(security_scopes, self.infinite_resources_get_token) self.assertEqual(he.exception.status_code, status.HTTP_401_UNAUTHORIZED) self.assertEqual(he.exception.detail, "Not enough permissions") token_data = check_authorization( security_scopes, self.infinite_resources_get_update_token ) self.assertEqual( token_data, TokenData(scopes=["resources:get", "resources:put"], user_name="test"), ) security_scopes = SecurityScopes() check_authorization(security_scopes, self.infinite_resources_get_token) with self.assertRaises(HTTPException) as he: check_authorization(security_scopes, "1234567890abdcef") self.assertEqual(he.exception.status_code, status.HTTP_401_UNAUTHORIZED) self.assertEqual(he.exception.detail, "Could not validate credentials") @patch("tardis.rest.app.security.jwt") def test_check_authorization_jwt_error(self, mocked_jwt): mocked_jwt.decode.side_effect = JWTError with self.assertRaises(HTTPException) as he: check_authorization(SecurityScopes(), self.infinite_resources_get_token) self.assertEqual(he.exception.status_code, status.HTTP_401_UNAUTHORIZED) self.assertEqual(he.exception.detail, "Could not validate credentials") mocked_jwt.decode.side_effect = None def test_check_authentication(self): self.clear_lru_cache() with self.assertRaises(HTTPException) as he: check_authentication(user_name="fails", password="<PASSWORD>") self.assertEqual(he.exception.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(he.exception.detail, "Incorrect username or password") self.clear_lru_cache() with self.assertRaises(HTTPException) as he: check_authentication(user_name="test", password="<PASSWORD>") self.assertEqual(he.exception.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(he.exception.detail, "Incorrect username or password") self.clear_lru_cache() self.assertEqual( check_authentication(user_name="test", password="<PASSWORD>"), { "hashed_password": <PASSWORD>", # noqa B509 "scopes": ["resources:get"], "user_name": "test", }, ) def test_get_algorithm(self): self.clear_lru_cache() self.assertEqual(get_algorithm(), self.algorithm) self.clear_lru_cache() self.mock_config.side_effect = AttributeError with self.assertRaises(TardisError): get_algorithm() self.mock_config.side_effect = None def test_get_secret_key(self): self.clear_lru_cache() self.assertEqual(get_secret_key(), self.secret_key) self.clear_lru_cache() self.mock_config.side_effect = AttributeError with self.assertRaises(TardisError): get_secret_key() self.mock_config.side_effect = None def test_get_user(self): self.clear_lru_cache() self.assertEqual( get_user("test"), { "hashed_password": <PASSWORD>", # noqa B509 "scopes": ["resources:get"], "user_name": "test", }, ) self.clear_lru_cache() self.mock_config.side_effect = AttributeError with self.assertRaises(TardisError): get_user("test") self.mock_config.side_effect = None @patch("tardis.rest.app.security.gensalt") def test_hash_password(self, mocked_gensalt): mocked_gensalt.return_value = b"$2b$12$aQ1hv6.1AJSfLL/u4ttm7u" self.assertEqual( hash_password("<PASSWORD>"), b"$2b$12$aQ1hv6.1AJSfLL/u4ttm7uyhV2r1fDdzUw2719FE7Fznq9w6EK1xe", )
[ 1, 515, 11364, 275, 29889, 11739, 29879, 29889, 29873, 538, 275, 11739, 29879, 1053, 323, 538, 275, 2392, 13, 3166, 11364, 275, 29889, 5060, 29889, 932, 29889, 8926, 1053, 313, 13, 1678, 1653, 29918, 5943, 29918, 6979, 29892, 13, 1678, 1423, 29918, 8921, 2133, 29892, 13, 1678, 1423, 29918, 23055, 29892, 13, 1678, 679, 29918, 20567, 29892, 13, 1678, 679, 29918, 19024, 29918, 1989, 29892, 13, 1678, 679, 29918, 1792, 29892, 13, 1678, 6608, 29918, 5630, 29892, 13, 1678, 25159, 1469, 29892, 13, 29897, 13, 3166, 11364, 275, 29889, 4422, 1907, 29889, 1131, 7541, 919, 1053, 23833, 21533, 13, 13, 3166, 5172, 2754, 1053, 7331, 2451, 29892, 4660, 13, 3166, 5172, 2754, 29889, 8926, 1053, 14223, 4421, 459, 267, 13, 3166, 432, 852, 1053, 435, 17755, 2392, 13, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 3166, 443, 27958, 29889, 17640, 1053, 13261, 13, 13, 13, 1990, 4321, 13228, 29898, 3057, 8259, 1125, 13, 1678, 11187, 29918, 2917, 29918, 5041, 261, 353, 6213, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 731, 3373, 2385, 29898, 25932, 29897, 1599, 6213, 29901, 13, 4706, 1067, 29879, 29889, 17640, 29918, 2917, 29918, 5041, 261, 353, 13261, 703, 29873, 538, 275, 29889, 5060, 29889, 932, 29889, 8926, 29889, 8614, 1159, 13, 4706, 1067, 29879, 29889, 17640, 29918, 2917, 353, 1067, 29879, 29889, 17640, 29918, 2917, 29918, 5041, 261, 29889, 2962, 580, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 734, 279, 6767, 2385, 29898, 25932, 29897, 1599, 6213, 29901, 13, 4706, 1067, 29879, 29889, 17640, 29918, 2917, 29918, 5041, 261, 29889, 9847, 580, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 19024, 29918, 1989, 353, 313, 13, 9651, 376, 29953, 29947, 29929, 29872, 29955, 2142, 29953, 29929, 29874, 29955, 29900, 328, 29900, 29881, 29929, 29955, 29888, 29955, 29955, 29896, 29941, 29955, 29896, 29955, 29941, 29947, 915, 29900, 29900, 29946, 29945, 29906, 29872, 29947, 29896, 29872, 29896, 29906, 29947, 29874, 29947, 29955, 29953, 29946, 29929, 29896, 29883, 29896, 29881, 29941, 29955, 29941, 2176, 29890, 17630, 29929, 29946, 29929, 29908, 13, 4706, 1723, 13, 4706, 1583, 29889, 20567, 353, 376, 14851, 29906, 29945, 29953, 29908, 13, 13, 4706, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 353, 9872, 10818, 11903, 29871, 396, 694, 25621, 350, 29929, 29945, 29900, 13, 4706, 1583, 29889, 29044, 29918, 13237, 29918, 657, 29918, 6979, 353, 9872, 10818, 11903, 29871, 396, 694, 25621, 350, 29929, 29945, 29900, 13, 4706, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 5504, 29918, 6979, 353, 9872, 10818, 11903, 29871, 396, 694, 25621, 350, 29929, 29945, 29900, 13, 13, 4706, 822, 11187, 287, 29918, 657, 29918, 1792, 29898, 1792, 29918, 978, 1125, 13, 9651, 565, 1404, 29918, 978, 1275, 376, 1688, 1115, 13, 18884, 736, 23833, 21533, 29898, 13, 462, 1678, 1404, 29918, 978, 543, 1688, 613, 13, 462, 1678, 6608, 287, 29918, 5630, 543, 29966, 25711, 17013, 28341, 29871, 396, 694, 25621, 350, 29945, 29900, 29929, 13, 462, 1678, 16505, 267, 29922, 3366, 13237, 29901, 657, 12436, 13, 18884, 1723, 13, 9651, 736, 6213, 13, 13, 4706, 2295, 353, 1583, 29889, 17640, 29918, 2917, 29889, 2457, 29918, 1767, 13, 4706, 2295, 29889, 13779, 29889, 5060, 2754, 29889, 19024, 29918, 1989, 353, 1583, 29889, 19024, 29918, 1989, 13, 4706, 2295, 29889, 13779, 29889, 5060, 2754, 29889, 20567, 353, 1583, 29889, 20567, 13, 4706, 2295, 29889, 13779, 29889, 5060, 2754, 29889, 657, 29918, 1792, 29889, 2975, 29918, 15987, 353, 11187, 287, 29918, 657, 29918, 1792, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2821, 29918, 29880, 582, 29918, 8173, 7295, 13, 4706, 679, 29918, 20567, 29889, 8173, 29918, 8551, 580, 13, 4706, 679, 29918, 19024, 29918, 1989, 29889, 8173, 29918, 8551, 580, 13, 4706, 679, 29918, 1792, 29889, 8173, 29918, 8551, 580, 13, 13, 1678, 732, 5041, 703, 29873, 538, 275, 29889, 5060, 29889, 932, 29889, 8926, 29889, 12673, 1159, 13, 1678, 822, 1243, 29918, 3258, 29918, 5943, 29918, 6979, 29898, 1311, 29892, 11187, 287, 29918, 12673, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 13, 4706, 5993, 353, 1653, 29918, 5943, 29918, 6979, 29898, 1792, 29918, 978, 543, 1688, 613, 16505, 267, 29922, 3366, 13237, 29901, 657, 20068, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6979, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 29897, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 13, 4706, 5993, 353, 1653, 29918, 5943, 29918, 6979, 29898, 13, 9651, 1404, 29918, 978, 543, 1688, 613, 13, 9651, 16505, 267, 29922, 3366, 13237, 29901, 657, 12436, 13, 9651, 7035, 29918, 1989, 543, 29883, 29906, 562, 29945, 29872, 29946, 29929, 29947, 29888, 29953, 29906, 29947, 29955, 29883, 29945, 29947, 5444, 29929, 29946, 29896, 29881, 29900, 29881, 29906, 6854, 2142, 29906, 13891, 29906, 29955, 29896, 29955, 29953, 29906, 29874, 29955, 2291, 29900, 29941, 29881, 6854, 29883, 29941, 346, 29890, 29929, 29896, 1327, 29896, 29947, 29929, 29945, 29881, 29900, 29945, 613, 29871, 396, 694, 25621, 350, 29929, 29945, 29900, 13, 9651, 5687, 29922, 1311, 29889, 20567, 29892, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 5993, 29892, 13, 9651, 9872, 10818, 28341, 29871, 396, 694, 25621, 350, 29929, 29945, 29900, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 11187, 287, 29918, 12673, 29889, 329, 29883, 3707, 29889, 2457, 29918, 1767, 353, 12865, 29889, 329, 29883, 3166, 16394, 29898, 29900, 29897, 13, 4706, 5993, 353, 1653, 29918, 5943, 29918, 6979, 29898, 13, 9651, 1404, 29918, 978, 543, 1688, 613, 13, 9651, 16505, 267, 29922, 3366, 13237, 29901, 657, 12436, 13, 9651, 1518, 2658, 29918, 4181, 29922, 9346, 287, 2554, 29898, 1195, 2667, 29922, 29896, 29945, 511, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6979, 29892, 1583, 29889, 29044, 29918, 13237, 29918, 657, 29918, 6979, 29897, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 5993, 353, 1653, 29918, 5943, 29918, 6979, 29898, 13, 9651, 1404, 29918, 978, 543, 1688, 613, 16505, 267, 29922, 3366, 13237, 29901, 657, 613, 376, 13237, 29901, 649, 3108, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6979, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 5504, 29918, 6979, 29897, 13, 13, 1678, 822, 1243, 29918, 3198, 29918, 8921, 2133, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 6993, 29918, 21785, 267, 353, 14223, 4421, 459, 267, 29898, 3366, 13237, 29901, 657, 20068, 13, 4706, 5993, 29918, 1272, 353, 1423, 29918, 8921, 2133, 29898, 13, 9651, 6993, 29918, 21785, 267, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 5993, 29918, 1272, 29892, 25159, 1469, 29898, 21785, 267, 29922, 8926, 29918, 21785, 267, 29889, 21785, 267, 29892, 1404, 29918, 978, 543, 1688, 1159, 13, 4706, 1723, 13, 13, 4706, 6993, 29918, 21785, 267, 353, 14223, 4421, 459, 267, 29898, 3366, 13237, 29901, 649, 20068, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10493, 2451, 29897, 408, 540, 29901, 13, 9651, 1423, 29918, 8921, 2133, 29898, 8926, 29918, 21785, 267, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 16432, 29892, 376, 3664, 3307, 11239, 1159, 13, 13, 4706, 5993, 29918, 1272, 353, 1423, 29918, 8921, 2133, 29898, 13, 9651, 6993, 29918, 21785, 267, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 5504, 29918, 6979, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 5993, 29918, 1272, 29892, 13, 9651, 25159, 1469, 29898, 21785, 267, 29922, 3366, 13237, 29901, 657, 613, 376, 13237, 29901, 649, 12436, 1404, 29918, 978, 543, 1688, 4968, 13, 4706, 1723, 13, 13, 4706, 6993, 29918, 21785, 267, 353, 14223, 4421, 459, 267, 580, 13, 4706, 1423, 29918, 8921, 2133, 29898, 8926, 29918, 21785, 267, 29892, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 29897, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10493, 2451, 29897, 408, 540, 29901, 13, 9651, 1423, 29918, 8921, 2133, 29898, 8926, 29918, 21785, 267, 29892, 376, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29900, 370, 29881, 346, 29888, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 16432, 29892, 376, 23323, 451, 12725, 16140, 1159, 13, 13, 1678, 732, 5041, 703, 29873, 538, 275, 29889, 5060, 29889, 932, 29889, 8926, 29889, 29926, 14554, 1159, 13, 1678, 822, 1243, 29918, 3198, 29918, 8921, 2133, 29918, 29926, 14554, 29918, 2704, 29898, 1311, 29892, 11187, 287, 29918, 29926, 14554, 1125, 13, 4706, 11187, 287, 29918, 29926, 14554, 29889, 13808, 29889, 2975, 29918, 15987, 353, 435, 17755, 2392, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10493, 2451, 29897, 408, 540, 29901, 13, 9651, 1423, 29918, 8921, 2133, 29898, 13228, 4421, 459, 267, 3285, 1583, 29889, 262, 18925, 29918, 13237, 29918, 657, 29918, 6979, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 16432, 29892, 376, 23323, 451, 12725, 16140, 1159, 13, 13, 4706, 11187, 287, 29918, 29926, 14554, 29889, 13808, 29889, 2975, 29918, 15987, 353, 6213, 13, 13, 1678, 822, 1243, 29918, 3198, 29918, 23055, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10493, 2451, 29897, 408, 540, 29901, 13, 9651, 1423, 29918, 23055, 29898, 1792, 29918, 978, 543, 29888, 2234, 613, 4800, 543, 29966, 25711, 17013, 29958, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 16432, 29892, 376, 797, 15728, 8952, 470, 4800, 1159, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 10493, 2451, 29897, 408, 540, 29901, 13, 9651, 1423, 29918, 23055, 29898, 1792, 29918, 978, 543, 1688, 613, 4800, 543, 29966, 25711, 17013, 29958, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 354, 29889, 11739, 29889, 16432, 29892, 376, 797, 15728, 8952, 470, 4800, 1159, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1423, 29918, 23055, 29898, 1792, 29918, 978, 543, 1688, 613, 4800, 543, 29966, 25711, 17013, 29958, 4968, 13, 9651, 426, 13, 18884, 376, 8568, 287, 29918, 5630, 1115, 529, 25711, 17013, 28341, 29871, 396, 694, 25621, 350, 29945, 29900, 29929, 13, 18884, 376, 21785, 267, 1115, 6796, 13237, 29901, 657, 12436, 13, 18884, 376, 1792, 29918, 978, 1115, 376, 1688, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 20567, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 657, 29918, 20567, 3285, 1583, 29889, 20567, 29897, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 23833, 2392, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 29911, 538, 275, 2392, 1125, 13, 9651, 679, 29918, 20567, 580, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 6213, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 19024, 29918, 1989, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 657, 29918, 19024, 29918, 1989, 3285, 1583, 29889, 19024, 29918, 1989, 29897, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 23833, 2392, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 29911, 538, 275, 2392, 1125, 13, 9651, 679, 29918, 19024, 29918, 1989, 580, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 6213, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 1792, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 679, 29918, 1792, 703, 1688, 4968, 13, 9651, 426, 13, 18884, 376, 8568, 287, 29918, 5630, 1115, 529, 25711, 17013, 28341, 29871, 396, 694, 25621, 350, 29945, 29900, 29929, 13, 18884, 376, 21785, 267, 1115, 6796, 13237, 29901, 657, 12436, 13, 18884, 376, 1792, 29918, 978, 1115, 376, 1688, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 8551, 29918, 29880, 582, 29918, 8173, 580, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 23833, 2392, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 29911, 538, 275, 2392, 1125, 13, 9651, 679, 29918, 1792, 703, 1688, 1159, 13, 4706, 1583, 29889, 17640, 29918, 2917, 29889, 2975, 29918, 15987, 353, 6213, 13, 13, 1678, 732, 5041, 703, 29873, 538, 275, 29889, 5060, 29889, 932, 29889, 8926, 29889, 17397, 1997, 1159, 13, 1678, 822, 1243, 29918, 8568, 29918, 5630, 29898, 1311, 29892, 11187, 287, 29918, 17397, 1997, 1125, 13, 4706, 11187, 287, 29918, 17397, 1997, 29889, 2457, 29918, 1767, 353, 289, 29908, 29938, 29906, 29890, 29938, 29896, 29906, 29938, 29874, 29984, 29896, 29882, 29894, 29953, 29889, 29896, 29909, 8700, 29888, 2208, 29914, 29884, 29946, 698, 29885, 29955, 29884, 29908, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 6608, 29918, 5630, 28945, 25711, 17013, 29958, 4968, 13, 9651, 289, 29908, 29938, 29906, 29890, 29938, 29896, 29906, 29938, 29874, 29984, 29896, 29882, 29894, 29953, 29889, 29896, 29909, 8700, 29888, 2208, 29914, 29884, 29946, 698, 29885, 29955, 8631, 29882, 29963, 29906, 29878, 29896, 29888, 29928, 5601, 29965, 29893, 29906, 29955, 29896, 29929, 16359, 29955, 29943, 3749, 29939, 29929, 29893, 29953, 29923, 29968, 29896, 17115, 613, 13, 4706, 1723, 13, 2 ]
Codeup/6068.py
lkc263/Algorithm_Study_Python
0
171366
score = int(input()) if score >= 90: print("A") elif score >= 70: print("B") elif score >= 40: print("C") else: print("D")
[ 1, 29871, 13, 13628, 353, 938, 29898, 2080, 3101, 13, 13, 361, 8158, 6736, 29871, 29929, 29900, 29901, 13, 1678, 1596, 703, 29909, 1159, 13, 23681, 8158, 6736, 29871, 29955, 29900, 29901, 13, 1678, 1596, 703, 29933, 1159, 13, 23681, 8158, 6736, 29871, 29946, 29900, 29901, 13, 1678, 1596, 703, 29907, 1159, 13, 2870, 29901, 13, 1678, 1596, 703, 29928, 1159, 2 ]
ambari-server/src/test/python/stacks/test_ambari_configuration.py
thaibui/ambari
0
1616463
""" 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. """ import os from mock.mock import MagicMock, patch from unittest import TestCase # Mock classes for reading from a file class MagicFile(object): def __init__(self, data): self.data = data def read(self): return self.data def __exit__(self, exc_type, exc_val, exc_tb): pass def __enter__(self): return self pass class TestAmbariConfiguration(TestCase): def setUp(self): import imp self.test_directory = os.path.dirname(os.path.abspath(__file__)) relative_path = '../../../main/resources/stacks/ambari_configuration.py' ambari_configuration_path = os.path.abspath(os.path.join(self.test_directory, relative_path)) class_name = 'AmbariConfiguration' with open(ambari_configuration_path, 'rb') as fp: ambari_configuration_impl = imp.load_module('ambari_configuration', fp, ambari_configuration_path, ('.py', 'rb', imp.PY_SOURCE)) self.ambari_configuration_class = getattr(ambari_configuration_impl, class_name) def testMissingData(self): ambari_configuration = self.ambari_configuration_class('{}') self.assertIsNone(ambari_configuration.get_ambari_server_configuration()) self.assertIsNone(ambari_configuration.get_ambari_server_properties()) def testMissingSSOConfiguration(self): services_json = { "ambari-server-configuration": { } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNone(ambari_configuration.get_ambari_sso_configuration()) self.assertIsNone(ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.property")) self.assertFalse(ambari_configuration.should_enable_sso("AMBARI")) def testMissingAmbariProperties(self): services_json = { "ambari-server-configuration": { } } ambari_configuration = self.ambari_configuration_class(services_json) ambari_sso_details = ambari_configuration.get_ambari_sso_details() self.assertFalse(ambari_sso_details.is_jwt_enabled()) self.assertIsNone(ambari_sso_details.get_jwt_audiences()) self.assertIsNone(ambari_sso_details.get_jwt_cookie_name()) self.assertIsNone(ambari_sso_details.get_jwt_provider_url()) self.assertIsNone(ambari_sso_details.get_jwt_public_key_file()) self.assertIsNone(ambari_sso_details.get_jwt_public_key()) def testAmbariSSOConfigurationNotManagingServices(self): services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.enabled_services": "AMBARI" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("AMBARI", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertFalse(ambari_configuration.is_managing_services()) self.assertFalse(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.manage_services" : "false", "ambari.sso.enabled_services" : "AMBARI, RANGER" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("AMBARI, RANGER", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertFalse(ambari_configuration.is_managing_services()) self.assertFalse(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_enable_sso("RANGER")) self.assertFalse(ambari_configuration.should_disable_sso("RANGER")) services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.manage_services" : "false", "ambari.sso.enabled_services" : "*" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("*", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertFalse(ambari_configuration.is_managing_services()) self.assertFalse(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_enable_sso("RANGER")) self.assertFalse(ambari_configuration.should_disable_sso("RANGER")) def testAmbariSSOConfigurationManagingServices(self): services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.manage_services" : "true", "ambari.sso.enabled_services": "AMBARI" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("AMBARI", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertTrue(ambari_configuration.is_managing_services()) self.assertTrue(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_enable_sso("RANGER")) self.assertTrue(ambari_configuration.should_disable_sso("RANGER")) services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.manage_services" : "true", "ambari.sso.enabled_services" : "AMBARI, RANGER" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("AMBARI, RANGER", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertTrue(ambari_configuration.is_managing_services()) self.assertTrue(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) self.assertTrue(ambari_configuration.should_enable_sso("RANGER")) self.assertFalse(ambari_configuration.should_disable_sso("RANGER")) services_json = { "ambari-server-configuration": { "sso-configuration": { "ambari.sso.manage_services" : "true", "ambari.sso.enabled_services" : "*" } } } ambari_configuration = self.ambari_configuration_class(services_json) self.assertIsNotNone(ambari_configuration.get_ambari_sso_configuration()) self.assertEquals("*", ambari_configuration.get_ambari_sso_configuration_value("ambari.sso.enabled_services")) self.assertTrue(ambari_configuration.is_managing_services()) self.assertTrue(ambari_configuration.should_enable_sso("AMBARI")) self.assertFalse(ambari_configuration.should_disable_sso("AMBARI")) self.assertTrue(ambari_configuration.should_enable_sso("RANGER")) self.assertFalse(ambari_configuration.should_disable_sso("RANGER")) def testAmbariJWTProperties(self): services_json = { "ambari-server-properties": { "authentication.jwt.publicKey": "/etc/ambari-server/conf/jwt-cert.pem", "authentication.jwt.enabled": "true", "authentication.jwt.providerUrl": "https://knox.ambari.apache.org", "authentication.jwt.cookieName": "hadoop-jwt", "authentication.jwt.audiences": "" }, "ambari-server-configuration": { } } ambari_configuration = self.ambari_configuration_class(services_json) ambari_sso_details = ambari_configuration.get_ambari_sso_details() self.assertTrue(ambari_sso_details.is_jwt_enabled()) self.assertEquals('', ambari_sso_details.get_jwt_audiences()) self.assertEquals('hadoop-jwt', ambari_sso_details.get_jwt_cookie_name()) self.assertEquals('https://knox.ambari.apache.org', ambari_sso_details.get_jwt_provider_url()) self.assertEquals('/etc/ambari-server/conf/jwt-cert.pem', ambari_sso_details.get_jwt_public_key_file()) self.assertIsNone(ambari_sso_details.get_jwt_public_key()) # This is none since the file does not exist for unit tests. @patch("os.path.isfile", new=MagicMock(return_value=True)) @patch('__builtin__.open') def testReadCertFileWithHeaderAndFooter(self, open_mock): mock_file = MagicFile( '-----BEGIN CERTIFICATE-----\n' 'MIIE3DCCA8SgAwIBAgIJAKfbOMmFyOlNMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD\n' '................................................................\n' 'dXRpbmcxFzAVBgNVBAMTDmNsb3VkYnJlYWstcmdsMSUwIwYJKoZIhvcNAQkBFhZy\n' '-----END CERTIFICATE-----\n') open_mock.side_effect = [mock_file, mock_file, mock_file, mock_file] services_json = { "ambari-server-properties": { "authentication.jwt.publicKey": "/etc/ambari-server/conf/jwt-cert.pem", "authentication.jwt.enabled": "true", "authentication.jwt.providerUrl": "https://knox.ambari.apache.org", "authentication.jwt.cookieName": "hadoop-jwt", "authentication.jwt.audiences": "" }, "ambari-server-configuration": { } } ambari_configuration = self.ambari_configuration_class(services_json) ambari_sso_details = ambari_configuration.get_ambari_sso_details() self.assertEquals('-----BEGIN CERTIFICATE-----\n' 'MIIE3DCCA8SgAwIBAgIJAKfbOMmFyOlNMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD\n' '................................................................\n' 'dXRpbmcxFzAVBgNVBAMTDmNsb3VkYnJlYWstcmdsMSUwIwYJKoZIhvcNAQkBFhZy\n' '-----END CERTIFICATE-----', ambari_sso_details.get_jwt_public_key(True, False)) self.assertEquals('-----BEGIN CERTIFICATE-----' 'MIIE3DCCA8SgAwIBAgIJAKfbOMmFyOlNMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD' '................................................................' '<KEY>' '-----END CERTIFICATE-----', ambari_sso_details.get_jwt_public_key(True, True)) self.assertEquals('<KEY>' '................................................................\n' '<KEY>', ambari_sso_details.get_jwt_public_key(False, False)) self.assertEquals('<KEY>' '................................................................' '<KEY>', ambari_sso_details.get_jwt_public_key(False, True)) @patch("os.path.isfile", new=MagicMock(return_value=True)) @patch('__builtin__.open') def testReadCertFileWithoutHeaderAndFooter(self, open_mock): mock_file = MagicFile( '<KEY>' '................................................................\n' 'dXRpbmcxFzAVBgNVBAMTDmNsb3VkYnJlYWstcmdsMSUwIwYJKoZIhvcNAQkBFhZy\n') open_mock.side_effect = [mock_file, mock_file, mock_file, mock_file] services_json = { "ambari-server-properties": { "authentication.jwt.publicKey": "/etc/ambari-server/conf/jwt-cert.pem", "authentication.jwt.enabled": "true", "authentication.jwt.providerUrl": "https://knox.ambari.apache.org", "authentication.jwt.cookieName": "hadoop-jwt", "authentication.jwt.audiences": "" }, "ambari-server-configuration": { } } ambari_configuration = self.ambari_configuration_class(services_json) ambari_sso_details = ambari_configuration.get_ambari_sso_details() self.assertEquals('-----BEGIN CERTIFICATE-----\n' '<KEY>' '................................................................\n' '<KEY>' '-----END CERTIFICATE-----', ambari_sso_details.get_jwt_public_key(True, False)) self.assertEquals('-----BEGIN CERTIFICATE-----' '<KEY>' '................................................................' '<KEY>' '-----END CERTIFICATE-----', ambari_sso_details.get_jwt_public_key(True, True)) self.assertEquals('<KEY>' '................................................................\n' '<KEY>', ambari_sso_details.get_jwt_public_key(False, False)) self.assertEquals('<KEY>' '................................................................' '<KEY>', ambari_sso_details.get_jwt_public_key(False, True))
[ 1, 9995, 13, 29931, 293, 21144, 304, 278, 13380, 18540, 10606, 313, 3289, 29943, 29897, 1090, 697, 13, 272, 901, 17737, 3406, 19405, 8571, 4110, 29889, 29871, 2823, 278, 6058, 12107, 934, 13, 5721, 7541, 411, 445, 664, 363, 5684, 2472, 13, 1727, 20272, 3509, 1266, 27428, 29889, 29871, 450, 3339, 29943, 7794, 11259, 445, 934, 13, 517, 366, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 13, 29908, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 13, 2541, 278, 19245, 29889, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 2525, 2222, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 5721, 7541, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29956, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 13393, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 13400, 800, 1090, 278, 19245, 29889, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 13, 3166, 11187, 29889, 17640, 1053, 26494, 18680, 29892, 13261, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 13, 29937, 26297, 4413, 363, 5183, 515, 263, 934, 13, 1990, 26494, 2283, 29898, 3318, 1125, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 848, 1125, 13, 1678, 1583, 29889, 1272, 353, 848, 13, 13, 29871, 822, 1303, 29898, 1311, 1125, 13, 1678, 736, 1583, 29889, 1272, 13, 13, 29871, 822, 4770, 13322, 12035, 1311, 29892, 5566, 29918, 1853, 29892, 5566, 29918, 791, 29892, 5566, 29918, 22625, 1125, 13, 1678, 1209, 13, 13, 29871, 822, 4770, 5893, 12035, 1311, 1125, 13, 1678, 736, 1583, 13, 3364, 13, 13, 1990, 4321, 6833, 29890, 1306, 8614, 29898, 3057, 8259, 1125, 13, 13, 29871, 822, 731, 3373, 29898, 1311, 1125, 13, 1678, 1053, 2411, 13, 1678, 1583, 29889, 1688, 29918, 12322, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 876, 13, 13, 1678, 6198, 29918, 2084, 353, 525, 21546, 6995, 3396, 29914, 13237, 29914, 1429, 29879, 29914, 1117, 1306, 29918, 13305, 29889, 2272, 29915, 13, 1678, 3181, 1306, 29918, 13305, 29918, 2084, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1688, 29918, 12322, 29892, 6198, 29918, 2084, 876, 13, 1678, 770, 29918, 978, 353, 525, 6833, 29890, 1306, 8614, 29915, 13, 13, 1678, 411, 1722, 29898, 1117, 1306, 29918, 13305, 29918, 2084, 29892, 525, 6050, 1495, 408, 285, 29886, 29901, 13, 418, 3181, 1306, 29918, 13305, 29918, 13699, 353, 2411, 29889, 1359, 29918, 5453, 877, 1117, 1306, 29918, 13305, 742, 285, 29886, 29892, 13, 462, 462, 462, 29871, 3181, 1306, 29918, 13305, 29918, 2084, 29892, 13, 462, 462, 462, 29871, 313, 4286, 2272, 742, 525, 6050, 742, 2411, 29889, 20055, 29918, 27839, 4741, 876, 13, 13, 1678, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 353, 679, 5552, 29898, 1117, 1306, 29918, 13305, 29918, 13699, 29892, 770, 29918, 978, 29897, 13, 13, 29871, 822, 1243, 18552, 292, 1469, 29898, 1311, 1125, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 877, 8875, 1495, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 2974, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 2974, 29918, 11330, 3101, 13, 13, 29871, 822, 1243, 18552, 292, 1799, 29949, 8614, 29898, 1311, 1125, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 6799, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 13, 29871, 822, 1243, 18552, 292, 6833, 29890, 1306, 11857, 29898, 1311, 1125, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 3181, 1306, 29918, 29879, 578, 29918, 14144, 353, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 14144, 580, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 275, 29918, 29926, 14554, 29918, 17590, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 15052, 819, 778, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 21509, 29918, 978, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 18121, 29918, 2271, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29918, 1445, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 3101, 13, 13, 29871, 822, 1243, 6833, 29890, 1306, 1799, 29949, 8614, 3664, 2517, 6751, 13779, 29898, 1311, 1125, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 1115, 376, 5194, 29933, 1718, 29902, 29908, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 5194, 29933, 1718, 29902, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 1171, 482, 29918, 9916, 29908, 584, 376, 4541, 613, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 29908, 584, 376, 5194, 29933, 1718, 29902, 29892, 390, 2190, 17070, 29908, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 5194, 29933, 1718, 29902, 29892, 390, 2190, 17070, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 1171, 482, 29918, 9916, 29908, 584, 376, 4541, 613, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 29908, 584, 376, 20605, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 29930, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 13, 29871, 822, 1243, 6833, 29890, 1306, 1799, 29949, 8614, 2517, 6751, 13779, 29898, 1311, 1125, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 1171, 482, 29918, 9916, 29908, 584, 376, 3009, 613, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 1115, 376, 5194, 29933, 1718, 29902, 29908, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 5194, 29933, 1718, 29902, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 1171, 482, 29918, 9916, 29908, 584, 376, 3009, 613, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 29908, 584, 376, 5194, 29933, 1718, 29902, 29892, 390, 2190, 17070, 29908, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 5194, 29933, 1718, 29902, 29892, 390, 2190, 17070, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 4706, 376, 29879, 578, 29899, 13305, 1115, 426, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 1171, 482, 29918, 9916, 29908, 584, 376, 3009, 613, 13, 3986, 376, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 29908, 584, 376, 20605, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1117, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 3101, 13, 1678, 1583, 29889, 9294, 14776, 703, 29930, 613, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 13305, 29918, 1767, 703, 1117, 1306, 29889, 29879, 578, 29889, 17590, 29918, 9916, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 275, 29918, 1171, 6751, 29918, 9916, 3101, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 5194, 29933, 1718, 29902, 5783, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 12007, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 1678, 1583, 29889, 9294, 8824, 29898, 1117, 1306, 29918, 13305, 29889, 9344, 29918, 20472, 29918, 29879, 578, 703, 29934, 2190, 17070, 5783, 13, 13, 29871, 822, 1243, 6833, 29890, 1306, 29967, 17755, 11857, 29898, 1311, 1125, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 11330, 1115, 426, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 3597, 2558, 1115, 5591, 7070, 29914, 1117, 1306, 29899, 2974, 29914, 5527, 29914, 29926, 14554, 29899, 6327, 29889, 29886, 331, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 17590, 1115, 376, 3009, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 18121, 5983, 1115, 376, 991, 597, 29895, 1217, 29916, 29889, 1117, 1306, 29889, 4288, 29889, 990, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 21509, 1170, 1115, 376, 22075, 29899, 29926, 14554, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 15052, 819, 778, 1115, 5124, 13, 418, 2981, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 3181, 1306, 29918, 29879, 578, 29918, 14144, 353, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 14144, 580, 13, 1678, 1583, 29889, 9294, 5574, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 275, 29918, 29926, 14554, 29918, 17590, 3101, 13, 1678, 1583, 29889, 9294, 14776, 877, 742, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 15052, 819, 778, 3101, 13, 1678, 1583, 29889, 9294, 14776, 877, 22075, 29899, 29926, 14554, 742, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 21509, 29918, 978, 3101, 13, 1678, 1583, 29889, 9294, 14776, 877, 991, 597, 29895, 1217, 29916, 29889, 1117, 1306, 29889, 4288, 29889, 990, 742, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 18121, 29918, 2271, 3101, 13, 1678, 1583, 29889, 9294, 14776, 11219, 7070, 29914, 1117, 1306, 29899, 2974, 29914, 5527, 29914, 29926, 14554, 29899, 6327, 29889, 29886, 331, 742, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29918, 1445, 3101, 13, 1678, 1583, 29889, 9294, 3624, 8516, 29898, 1117, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 3101, 29871, 396, 910, 338, 5642, 1951, 278, 934, 947, 451, 1863, 363, 5190, 6987, 29889, 13, 13, 13, 29871, 732, 5041, 703, 359, 29889, 2084, 29889, 275, 1445, 613, 716, 29922, 19095, 293, 18680, 29898, 2457, 29918, 1767, 29922, 5574, 876, 13, 29871, 732, 5041, 877, 1649, 16145, 262, 26914, 3150, 1495, 13, 29871, 822, 1243, 6359, 20455, 2283, 3047, 7850, 2855, 13440, 261, 29898, 1311, 29892, 1722, 29918, 17640, 1125, 13, 1678, 11187, 29918, 1445, 353, 26494, 2283, 29898, 13, 418, 525, 23648, 29933, 17958, 315, 20161, 6545, 2965, 3040, 807, 2612, 29876, 29915, 13, 418, 525, 29924, 2687, 29923, 29941, 29928, 4174, 29909, 29947, 29903, 29887, 29909, 29893, 29902, 5688, 29887, 29902, 29967, 22311, 14943, 6488, 29885, 29943, 29891, 29949, 29880, 29940, 1529, 29900, 8766, 29903, 29939, 29954, 5425, 29890, 29941, 29928, 29984, 29923, 14388, 13356, 5194, 6259, 29895, 25566, 2774, 29907, 29984, 29979, 29928, 29905, 29876, 29915, 13, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 418, 525, 29881, 29990, 29934, 29886, 5838, 18904, 29943, 29920, 7520, 29933, 29887, 29940, 24281, 5194, 24495, 29885, 29940, 20778, 29941, 29963, 29895, 29979, 29876, 29967, 29880, 29979, 29956, 303, 9006, 29879, 4345, 29965, 29893, 29902, 29893, 29979, 29967, 29968, 29877, 29999, 29902, 29882, 7071, 3521, 29984, 29895, 28062, 29882, 29999, 29891, 29905, 29876, 29915, 13, 418, 525, 23648, 11794, 315, 20161, 6545, 2965, 3040, 807, 2612, 29876, 1495, 13, 1678, 1722, 29918, 17640, 29889, 2975, 29918, 15987, 353, 518, 17640, 29918, 1445, 29892, 11187, 29918, 1445, 29892, 11187, 29918, 1445, 29892, 11187, 29918, 1445, 29962, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 11330, 1115, 426, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 3597, 2558, 1115, 5591, 7070, 29914, 1117, 1306, 29899, 2974, 29914, 5527, 29914, 29926, 14554, 29899, 6327, 29889, 29886, 331, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 17590, 1115, 376, 3009, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 18121, 5983, 1115, 376, 991, 597, 29895, 1217, 29916, 29889, 1117, 1306, 29889, 4288, 29889, 990, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 21509, 1170, 1115, 376, 22075, 29899, 29926, 14554, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 15052, 819, 778, 1115, 5124, 13, 418, 2981, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 3181, 1306, 29918, 29879, 578, 29918, 14144, 353, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 14144, 580, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 23648, 29933, 17958, 315, 20161, 6545, 2965, 3040, 807, 2612, 29876, 29915, 13, 462, 418, 525, 29924, 2687, 29923, 29941, 29928, 4174, 29909, 29947, 29903, 29887, 29909, 29893, 29902, 5688, 29887, 29902, 29967, 22311, 14943, 6488, 29885, 29943, 29891, 29949, 29880, 29940, 1529, 29900, 8766, 29903, 29939, 29954, 5425, 29890, 29941, 29928, 29984, 29923, 14388, 13356, 5194, 6259, 29895, 25566, 2774, 29907, 29984, 29979, 29928, 29905, 29876, 29915, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 462, 418, 525, 29881, 29990, 29934, 29886, 5838, 18904, 29943, 29920, 7520, 29933, 29887, 29940, 24281, 5194, 24495, 29885, 29940, 20778, 29941, 29963, 29895, 29979, 29876, 29967, 29880, 29979, 29956, 303, 9006, 29879, 4345, 29965, 29893, 29902, 29893, 29979, 29967, 29968, 29877, 29999, 29902, 29882, 7071, 3521, 29984, 29895, 28062, 29882, 29999, 29891, 29905, 29876, 29915, 13, 462, 418, 525, 23648, 11794, 315, 20161, 6545, 2965, 3040, 23648, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 5574, 29892, 7700, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 23648, 29933, 17958, 315, 20161, 6545, 2965, 3040, 23648, 29915, 13, 462, 418, 525, 29924, 2687, 29923, 29941, 29928, 4174, 29909, 29947, 29903, 29887, 29909, 29893, 29902, 5688, 29887, 29902, 29967, 22311, 14943, 6488, 29885, 29943, 29891, 29949, 29880, 29940, 1529, 29900, 8766, 29903, 29939, 29954, 5425, 29890, 29941, 29928, 29984, 29923, 14388, 13356, 5194, 6259, 29895, 25566, 2774, 29907, 29984, 29979, 29928, 29915, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29915, 13, 462, 418, 12801, 10818, 16299, 13, 462, 418, 525, 23648, 11794, 315, 20161, 6545, 2965, 3040, 23648, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 5574, 29892, 5852, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 29966, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 462, 418, 12801, 10818, 29958, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 8824, 29892, 7700, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 29966, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29915, 13, 462, 418, 12801, 10818, 29958, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 8824, 29892, 5852, 876, 13, 13, 29871, 732, 5041, 703, 359, 29889, 2084, 29889, 275, 1445, 613, 716, 29922, 19095, 293, 18680, 29898, 2457, 29918, 1767, 29922, 5574, 876, 13, 29871, 732, 5041, 877, 1649, 16145, 262, 26914, 3150, 1495, 13, 29871, 822, 1243, 6359, 20455, 2283, 3047, 449, 7850, 2855, 13440, 261, 29898, 1311, 29892, 1722, 29918, 17640, 1125, 13, 1678, 11187, 29918, 1445, 353, 26494, 2283, 29898, 13, 418, 12801, 10818, 16299, 13, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 418, 525, 29881, 29990, 29934, 29886, 5838, 18904, 29943, 29920, 7520, 29933, 29887, 29940, 24281, 5194, 24495, 29885, 29940, 20778, 29941, 29963, 29895, 29979, 29876, 29967, 29880, 29979, 29956, 303, 9006, 29879, 4345, 29965, 29893, 29902, 29893, 29979, 29967, 29968, 29877, 29999, 29902, 29882, 7071, 3521, 29984, 29895, 28062, 29882, 29999, 29891, 29905, 29876, 1495, 13, 1678, 1722, 29918, 17640, 29889, 2975, 29918, 15987, 353, 518, 17640, 29918, 1445, 29892, 11187, 29918, 1445, 29892, 11187, 29918, 1445, 29892, 11187, 29918, 1445, 29962, 13, 13, 1678, 5786, 29918, 3126, 353, 426, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 11330, 1115, 426, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 3597, 2558, 1115, 5591, 7070, 29914, 1117, 1306, 29899, 2974, 29914, 5527, 29914, 29926, 14554, 29899, 6327, 29889, 29886, 331, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 17590, 1115, 376, 3009, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 18121, 5983, 1115, 376, 991, 597, 29895, 1217, 29916, 29889, 1117, 1306, 29889, 4288, 29889, 990, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 21509, 1170, 1115, 376, 22075, 29899, 29926, 14554, 613, 13, 4706, 376, 23055, 29889, 29926, 14554, 29889, 15052, 819, 778, 1115, 5124, 13, 418, 2981, 13, 418, 376, 1117, 1306, 29899, 2974, 29899, 13305, 1115, 426, 13, 418, 500, 13, 1678, 500, 13, 13, 1678, 3181, 1306, 29918, 13305, 353, 1583, 29889, 1117, 1306, 29918, 13305, 29918, 1990, 29898, 9916, 29918, 3126, 29897, 13, 1678, 3181, 1306, 29918, 29879, 578, 29918, 14144, 353, 3181, 1306, 29918, 13305, 29889, 657, 29918, 1117, 1306, 29918, 29879, 578, 29918, 14144, 580, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 23648, 29933, 17958, 315, 20161, 6545, 2965, 3040, 807, 2612, 29876, 29915, 13, 462, 418, 12801, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 462, 418, 12801, 10818, 16299, 13, 462, 418, 525, 23648, 11794, 315, 20161, 6545, 2965, 3040, 23648, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 5574, 29892, 7700, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 23648, 29933, 17958, 315, 20161, 6545, 2965, 3040, 23648, 29915, 13, 462, 418, 12801, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29915, 13, 462, 418, 12801, 10818, 16299, 13, 462, 418, 525, 23648, 11794, 315, 20161, 6545, 2965, 3040, 23648, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 5574, 29892, 5852, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 29966, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29905, 29876, 29915, 13, 462, 418, 12801, 10818, 29958, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 8824, 29892, 7700, 876, 13, 13, 1678, 1583, 29889, 9294, 14776, 877, 29966, 10818, 16299, 13, 462, 418, 525, 25285, 25285, 25285, 25285, 29915, 13, 462, 418, 12801, 10818, 29958, 742, 13, 462, 418, 3181, 1306, 29918, 29879, 578, 29918, 14144, 29889, 657, 29918, 29926, 14554, 29918, 3597, 29918, 1989, 29898, 8824, 29892, 5852, 876, 13, 13, 2 ]
eclcli/network/v2/fic_service.py
hanasuke/eclcli
32
1605159
<reponame>hanasuke/eclcli from eclcli.common import command from eclcli.common import utils from ..networkclient.common import utils as to_obj class ListFICService(command.Lister): def get_parser(self, prog_name): parser = super(ListFICService, self).get_parser(prog_name) return parser def take_action(self, parsed_args): network_client = self.app.client_manager.network columns = ( 'id', 'name', 'zone', ) column_headers = ( 'ID', 'Name', 'Zone', ) data = [to_obj.FICService(ficsv) for ficsv in network_client.list_fic_services().get('fic_services')] return (column_headers, (utils.get_item_properties( s, columns, ) for s in data)) class ShowFICService(command.ShowOne): def get_parser(self, prog_name): parser = super(ShowFICService, self).get_parser(prog_name) parser.add_argument( 'fic_service_id', metavar="FIC_SERVICE_ID", help="ID of FIC Service to show." ) return parser def take_action(self, parsed_args): network_client = self.app.client_manager.network ficsv_id = parsed_args.fic_service_id dic = network_client.show_fic_service(ficsv_id).get('fic_service') columns = utils.get_columns(dic) obj = to_obj.FICService(dic) data = utils.get_item_properties( obj, columns, ) return columns, data
[ 1, 529, 276, 1112, 420, 29958, 5403, 294, 29884, 446, 29914, 687, 29880, 11303, 13, 3166, 321, 695, 11303, 29889, 9435, 1053, 1899, 13, 3166, 321, 695, 11303, 29889, 9435, 1053, 3667, 29879, 13, 3166, 6317, 11618, 4645, 29889, 9435, 1053, 3667, 29879, 408, 304, 29918, 5415, 13, 13, 13, 1990, 2391, 29943, 2965, 3170, 29898, 6519, 29889, 29931, 1531, 1125, 13, 1678, 822, 679, 29918, 16680, 29898, 1311, 29892, 410, 29887, 29918, 978, 1125, 13, 4706, 13812, 353, 2428, 29898, 1293, 29943, 2965, 3170, 29892, 1583, 467, 657, 29918, 16680, 29898, 29097, 29918, 978, 29897, 13, 4706, 736, 13812, 13, 13, 1678, 822, 2125, 29918, 2467, 29898, 1311, 29892, 21213, 29918, 5085, 1125, 13, 4706, 3564, 29918, 4645, 353, 1583, 29889, 932, 29889, 4645, 29918, 12847, 29889, 11618, 13, 13, 4706, 4341, 353, 313, 13, 9651, 525, 333, 742, 13, 9651, 525, 978, 742, 13, 9651, 525, 8028, 742, 13, 4706, 1723, 13, 4706, 1897, 29918, 13662, 353, 313, 13, 9651, 525, 1367, 742, 13, 9651, 525, 1170, 742, 13, 9651, 525, 18482, 742, 13, 4706, 1723, 13, 13, 4706, 848, 353, 518, 517, 29918, 5415, 29889, 29943, 2965, 3170, 29898, 29888, 1199, 29894, 29897, 363, 285, 1199, 29894, 297, 13, 18884, 3564, 29918, 4645, 29889, 1761, 29918, 9639, 29918, 9916, 2141, 657, 877, 9639, 29918, 9916, 1495, 29962, 13, 13, 4706, 736, 313, 4914, 29918, 13662, 29892, 13, 18884, 313, 13239, 29889, 657, 29918, 667, 29918, 11330, 29898, 13, 462, 1678, 269, 29892, 4341, 29892, 13, 18884, 1723, 363, 269, 297, 848, 876, 13, 13, 13, 1990, 7704, 29943, 2965, 3170, 29898, 6519, 29889, 8964, 6716, 1125, 13, 1678, 822, 679, 29918, 16680, 29898, 1311, 29892, 410, 29887, 29918, 978, 1125, 13, 4706, 13812, 353, 2428, 29898, 8964, 29943, 2965, 3170, 29892, 1583, 467, 657, 29918, 16680, 29898, 29097, 29918, 978, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 525, 9639, 29918, 5509, 29918, 333, 742, 13, 9651, 1539, 485, 279, 543, 29943, 2965, 29918, 6304, 19059, 29918, 1367, 613, 13, 9651, 1371, 543, 1367, 310, 383, 2965, 6692, 304, 1510, 1213, 13, 4706, 1723, 13, 4706, 736, 13812, 13, 13, 1678, 822, 2125, 29918, 2467, 29898, 1311, 29892, 21213, 29918, 5085, 1125, 13, 4706, 3564, 29918, 4645, 353, 1583, 29889, 932, 29889, 4645, 29918, 12847, 29889, 11618, 13, 13, 4706, 285, 1199, 29894, 29918, 333, 353, 21213, 29918, 5085, 29889, 9639, 29918, 5509, 29918, 333, 13, 13, 4706, 12124, 353, 3564, 29918, 4645, 29889, 4294, 29918, 9639, 29918, 5509, 29898, 29888, 1199, 29894, 29918, 333, 467, 657, 877, 9639, 29918, 5509, 1495, 13, 4706, 4341, 353, 3667, 29879, 29889, 657, 29918, 13099, 29898, 27774, 29897, 13, 4706, 5446, 353, 304, 29918, 5415, 29889, 29943, 2965, 3170, 29898, 27774, 29897, 13, 4706, 848, 353, 3667, 29879, 29889, 657, 29918, 667, 29918, 11330, 29898, 13, 9651, 5446, 29892, 4341, 29892, 1723, 13, 4706, 736, 4341, 29892, 848, 13, 2 ]
tools/debug/run_role.py
cheretbe/ansible-playbooks
0
62777
#!/usr/bin/env python3 import sys import os import types import subprocess import json import yaml import shutil def run_dialog(parameters): dialog_cmd = ["dialog"] + parameters dialog_env = os.environ.copy() # By default dialog returns 255 on ESC. It gets mixed up with error code -1 # converted to unsigned 8-bit. We set DIALOG_ESC variable to use the same # code as Cancel since we don't need to distinguish ESC and Cancel. dialog_env["DIALOG_ESC"] = "1" proc = subprocess.Popen(dialog_cmd, stderr = subprocess.PIPE, env=dialog_env) stderr = proc.communicate()[1] if proc.returncode == 1: sys.exit("Cancelled by user") elif proc.returncode != 0: print(stderr.decode("utf-8")) raise subprocess.CalledProcessError(proc.returncode, dialog_cmd, output=stderr) else: return stderr.decode("utf-8") def load_roles(): roles = [] for dir_entry in os.listdir("/opt/ansible-playbooks"): full_path = os.path.join("/opt/ansible-playbooks", dir_entry) if os.path.isdir(full_path): role_info = read_role_info(dir_entry, full_path) if not role_info is None: roles.append(role_info) return roles def read_role_info(role_name, role_path): role_info = None if os.path.isfile(os.path.join(role_path, "tasks", "main.yml")): role_info = types.SimpleNamespace() role_info.name = role_name vars_file = os.path.join(role_path, "defaults", "main.yml") if os.path.isfile(vars_file): with open(vars_file, "r") as f: role_info.default_vars = yaml.safe_load(f) else: role_info.default_vars = None return role_info def save_config(): os.makedirs(os.path.dirname(config_file_name), exist_ok=True) with open(config_file_name, "w", encoding="utf-8") as f: json.dump(config, f, ensure_ascii=False, indent=4) if shutil.which("dialog") is None: sys.exit("ERROR: Command 'dialog' is not found. Please install corresponding package") config_file_name = os.path.expanduser("~/.cache/cheretbe/ansible-playbooks/run_role_cfg.json") if os.path.isfile(config_file_name): with open(config_file_name) as f: config = json.load(f) else: config = {} roles = load_roles() roles.sort(key=lambda x: x.name) last_used_role = config.get("last_used_role", None) last_used_role_idx = None dialog_list = [] for idx, i in enumerate(roles): dialog_list += [str(idx), i.name] if last_used_role and (i.name == last_used_role): last_used_role_idx = idx dialog_params = ["--keep-tite", "--no-tags", "--menu", "Select a role:", "0", "0", "0"] + dialog_list if not last_used_role_idx is None: dialog_params = ["--default-item", str(last_used_role_idx)] + dialog_params selection = run_dialog(dialog_params) current_role = roles[int(selection)].name config["last_used_role"] = current_role save_config() print(f"Using role '{current_role}'") role_default_vars = roles[int(selection)].default_vars last_used_custom_vars = None if config.get("custom_vars", None): last_used_custom_vars = config["custom_vars"].get(current_role, None) current_role_vars = {} if not role_default_vars is None: caption_length = 0 for var_name in role_default_vars: if len(var_name) > caption_length: caption_length = len(var_name) dialog_list = [] for idx, key in enumerate(role_default_vars): var_value = "" if last_used_custom_vars: if key in last_used_custom_vars: var_value = last_used_custom_vars[key] dialog_list += [key + ":", str(idx + 1), "2", var_value, str(idx + 1), str(caption_length + 4), "100", "0"] selection = run_dialog(["--keep-tite", "--no-tags", "--form", f"Override variable values for role '{current_role}':", "0", "0", "0"] + dialog_list) dialog_vars = selection.split("\n") for idx, key in enumerate(role_default_vars): if dialog_vars[idx]: current_role_vars[key] = dialog_vars[idx] if not config.get("custom_vars", None): config["custom_vars"] = {} config["custom_vars"][current_role] = current_role_vars save_config() inventory = json.loads(subprocess.check_output(["ansible-inventory", "--list", "--export"])) inventory_groups = [] for group in inventory["all"]["children"]: if group in inventory: inventory_groups.append(group) if len(inventory_groups) == 0: subprocess.run(["ansible-inventory", "--list"]) sys.exit("ERROR: No groups were found in the inventory. Check inventory configuration") last_used_group = config.get("last_used_group", None) if last_used_group == "all": last_used_group_idx = "all" else: last_used_group_idx = None dialog_list = ["all", "All hosts"] for idx, i in enumerate(inventory_groups): dialog_list += [str(idx), i] if last_used_group and i == last_used_group: last_used_group_idx = idx # --menu <text> <height> <width> <menu height> <tag1> <item1> ... dialog_params = ["--keep-tite", "--no-tags", "--menu", "Select a group:", "0", "0", "0"] + dialog_list if not last_used_group_idx is None: dialog_params = ["--default-item", str(last_used_group_idx)] + dialog_params selection = run_dialog(dialog_params) if selection == "all": print("Using all hosts") current_group = None config["last_used_group"] = "all" else: current_group = inventory_groups[int(selection)] print(f"Using group '{current_group}'") config["last_used_group"] = current_group save_config() hosts_subset = [] if current_group: inventory_hosts = [] for host in inventory[current_group]["hosts"]: inventory_hosts.append(host) last_used_hosts = inventory_hosts if not config.get("hosts", None) is None: last_used_hosts = config["hosts"].get(current_group, inventory_hosts) dialog_list = [] for idx, i in enumerate(inventory_hosts): item_state = "on" if i in last_used_hosts else "off" dialog_list += [str(idx), i, item_state] selection = run_dialog(["--keep-tite", "--no-tags", "--checklist", f"Select hosts ({current_group}):", "0", "0", "0"] + dialog_list) current_hosts = [] for host_idx in selection.split(): current_hosts.append(inventory_hosts[int(host_idx)]) if len(current_hosts) == 0: sys.exit("No hosts were selected. Exiting") print("Using hosts", current_hosts) hosts_subset = ["-l", ",".join(current_hosts)] if not config.get("hosts", None): config["hosts"] = {} config["hosts"][current_group] = current_hosts save_config() ansible_playbook_cmd = ["ansible-playbook", "/opt/ansible-playbooks/run_role.yml", "--extra-vars", f"role_name={current_role}"] + hosts_subset if len(current_role_vars) != 0: ansible_playbook_cmd += ["--extra-vars", json.dumps(current_role_vars)] subprocess.check_call(ansible_playbook_cmd)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 4072, 13, 5215, 1014, 5014, 13, 5215, 4390, 13, 5215, 343, 8807, 13, 5215, 528, 4422, 13, 13, 1753, 1065, 29918, 15901, 29898, 16744, 1125, 13, 1678, 7928, 29918, 9006, 353, 6796, 15901, 3108, 718, 4128, 13, 1678, 7928, 29918, 6272, 353, 2897, 29889, 21813, 29889, 8552, 580, 13, 1678, 396, 2648, 2322, 7928, 3639, 29871, 29906, 29945, 29945, 373, 382, 7187, 29889, 739, 4947, 12849, 701, 411, 1059, 775, 448, 29896, 13, 1678, 396, 11543, 304, 12780, 29871, 29947, 29899, 2966, 29889, 1334, 731, 22471, 1964, 29949, 29954, 29918, 2890, 29907, 2286, 304, 671, 278, 1021, 13, 1678, 396, 775, 408, 1815, 2242, 1951, 591, 1016, 29915, 29873, 817, 304, 20820, 382, 7187, 322, 1815, 2242, 29889, 13, 1678, 7928, 29918, 6272, 3366, 4571, 1964, 29949, 29954, 29918, 2890, 29907, 3108, 353, 376, 29896, 29908, 13, 1678, 9580, 353, 1014, 5014, 29889, 29925, 3150, 29898, 15901, 29918, 9006, 29892, 380, 20405, 353, 1014, 5014, 29889, 2227, 4162, 29892, 8829, 29922, 15901, 29918, 6272, 29897, 13, 1678, 380, 20405, 353, 9580, 29889, 27820, 403, 580, 29961, 29896, 29962, 13, 1678, 565, 9580, 29889, 2457, 401, 1275, 29871, 29896, 29901, 13, 4706, 10876, 29889, 13322, 703, 19420, 839, 491, 1404, 1159, 13, 1678, 25342, 9580, 29889, 2457, 401, 2804, 29871, 29900, 29901, 13, 4706, 1596, 29898, 303, 20405, 29889, 13808, 703, 9420, 29899, 29947, 5783, 13, 4706, 12020, 1014, 5014, 29889, 29907, 4212, 7032, 2392, 29898, 15439, 29889, 2457, 401, 29892, 7928, 29918, 9006, 29892, 1962, 29922, 303, 20405, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 380, 20405, 29889, 13808, 703, 9420, 29899, 29947, 1159, 13, 13, 1753, 2254, 29918, 307, 793, 7295, 13, 1678, 16178, 353, 5159, 13, 1678, 363, 4516, 29918, 8269, 297, 2897, 29889, 1761, 3972, 11974, 3670, 29914, 550, 1821, 29899, 1456, 12733, 29908, 1125, 13, 4706, 2989, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 11974, 3670, 29914, 550, 1821, 29899, 1456, 12733, 613, 4516, 29918, 8269, 29897, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 3972, 29898, 8159, 29918, 2084, 1125, 13, 9651, 6297, 29918, 3888, 353, 1303, 29918, 12154, 29918, 3888, 29898, 3972, 29918, 8269, 29892, 2989, 29918, 2084, 29897, 13, 9651, 565, 451, 6297, 29918, 3888, 338, 6213, 29901, 13, 18884, 16178, 29889, 4397, 29898, 12154, 29918, 3888, 29897, 13, 1678, 736, 16178, 13, 13, 1753, 1303, 29918, 12154, 29918, 3888, 29898, 12154, 29918, 978, 29892, 6297, 29918, 2084, 1125, 13, 1678, 6297, 29918, 3888, 353, 6213, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 12154, 29918, 2084, 29892, 376, 20673, 613, 376, 3396, 29889, 21053, 5783, 29901, 13, 4706, 6297, 29918, 3888, 353, 4072, 29889, 15427, 23335, 580, 13, 4706, 6297, 29918, 3888, 29889, 978, 353, 6297, 29918, 978, 13, 4706, 24987, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 12154, 29918, 2084, 29892, 376, 4381, 29879, 613, 376, 3396, 29889, 21053, 1159, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 16908, 29918, 1445, 1125, 13, 9651, 411, 1722, 29898, 16908, 29918, 1445, 29892, 376, 29878, 1159, 408, 285, 29901, 13, 18884, 6297, 29918, 3888, 29889, 4381, 29918, 16908, 353, 343, 8807, 29889, 11177, 29918, 1359, 29898, 29888, 29897, 13, 4706, 1683, 29901, 13, 9651, 6297, 29918, 3888, 29889, 4381, 29918, 16908, 353, 6213, 13, 1678, 736, 6297, 29918, 3888, 13, 13, 1753, 4078, 29918, 2917, 7295, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 359, 29889, 2084, 29889, 25721, 29898, 2917, 29918, 1445, 29918, 978, 511, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 411, 1722, 29898, 2917, 29918, 1445, 29918, 978, 29892, 376, 29893, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 13, 4706, 4390, 29889, 15070, 29898, 2917, 29892, 285, 29892, 9801, 29918, 294, 18869, 29922, 8824, 29892, 29536, 29922, 29946, 29897, 13, 13, 13, 361, 528, 4422, 29889, 4716, 703, 15901, 1159, 338, 6213, 29901, 13, 1678, 10876, 29889, 13322, 703, 11432, 29901, 10516, 525, 15901, 29915, 338, 451, 1476, 29889, 3529, 2601, 6590, 3577, 1159, 13, 13, 2917, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 18837, 1792, 703, 30022, 6294, 8173, 29914, 4630, 300, 915, 29914, 550, 1821, 29899, 1456, 12733, 29914, 3389, 29918, 12154, 29918, 16859, 29889, 3126, 1159, 13, 361, 2897, 29889, 2084, 29889, 275, 1445, 29898, 2917, 29918, 1445, 29918, 978, 1125, 13, 1678, 411, 1722, 29898, 2917, 29918, 1445, 29918, 978, 29897, 408, 285, 29901, 13, 4706, 2295, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 2870, 29901, 13, 1678, 2295, 353, 6571, 13, 13, 307, 793, 353, 2254, 29918, 307, 793, 580, 13, 307, 793, 29889, 6605, 29898, 1989, 29922, 2892, 921, 29901, 921, 29889, 978, 29897, 13, 13, 4230, 29918, 3880, 29918, 12154, 353, 2295, 29889, 657, 703, 4230, 29918, 3880, 29918, 12154, 613, 6213, 29897, 13, 4230, 29918, 3880, 29918, 12154, 29918, 13140, 353, 6213, 13, 15901, 29918, 1761, 353, 5159, 13, 1454, 22645, 29892, 474, 297, 26985, 29898, 307, 793, 1125, 13, 1678, 7928, 29918, 1761, 4619, 518, 710, 29898, 13140, 511, 474, 29889, 978, 29962, 13, 1678, 565, 1833, 29918, 3880, 29918, 12154, 322, 313, 29875, 29889, 978, 1275, 1833, 29918, 3880, 29918, 12154, 1125, 13, 4706, 1833, 29918, 3880, 29918, 12154, 29918, 13140, 353, 22645, 13, 15901, 29918, 7529, 353, 6796, 489, 17462, 29899, 29873, 568, 613, 376, 489, 1217, 29899, 11338, 613, 376, 489, 6510, 613, 376, 3549, 263, 6297, 29901, 613, 13, 1678, 376, 29900, 613, 376, 29900, 613, 376, 29900, 3108, 718, 7928, 29918, 1761, 13, 361, 451, 1833, 29918, 3880, 29918, 12154, 29918, 13140, 338, 6213, 29901, 13, 1678, 7928, 29918, 7529, 353, 6796, 489, 4381, 29899, 667, 613, 851, 29898, 4230, 29918, 3880, 29918, 12154, 29918, 13140, 4638, 718, 7928, 29918, 7529, 13, 21731, 353, 1065, 29918, 15901, 29898, 15901, 29918, 7529, 29897, 13, 13, 3784, 29918, 12154, 353, 16178, 29961, 524, 29898, 21731, 29897, 1822, 978, 13, 2917, 3366, 4230, 29918, 3880, 29918, 12154, 3108, 353, 1857, 29918, 12154, 13, 7620, 29918, 2917, 580, 13, 2158, 29898, 29888, 29908, 15156, 6297, 22372, 3784, 29918, 12154, 10162, 1159, 13, 13, 12154, 29918, 4381, 29918, 16908, 353, 16178, 29961, 524, 29898, 21731, 29897, 1822, 4381, 29918, 16908, 13, 4230, 29918, 3880, 29918, 6341, 29918, 16908, 353, 6213, 13, 361, 2295, 29889, 657, 703, 6341, 29918, 16908, 613, 6213, 1125, 13, 1678, 1833, 29918, 3880, 29918, 6341, 29918, 16908, 353, 2295, 3366, 6341, 29918, 16908, 16862, 657, 29898, 3784, 29918, 12154, 29892, 6213, 29897, 13, 3784, 29918, 12154, 29918, 16908, 353, 6571, 13, 361, 451, 6297, 29918, 4381, 29918, 16908, 338, 6213, 29901, 13, 1678, 5777, 683, 29918, 2848, 353, 29871, 29900, 13, 1678, 363, 722, 29918, 978, 297, 6297, 29918, 4381, 29918, 16908, 29901, 13, 4706, 565, 7431, 29898, 1707, 29918, 978, 29897, 1405, 5777, 683, 29918, 2848, 29901, 13, 9651, 5777, 683, 29918, 2848, 353, 7431, 29898, 1707, 29918, 978, 29897, 13, 1678, 7928, 29918, 1761, 353, 5159, 13, 1678, 363, 22645, 29892, 1820, 297, 26985, 29898, 12154, 29918, 4381, 29918, 16908, 1125, 13, 4706, 722, 29918, 1767, 353, 5124, 13, 4706, 565, 1833, 29918, 3880, 29918, 6341, 29918, 16908, 29901, 13, 9651, 565, 1820, 297, 1833, 29918, 3880, 29918, 6341, 29918, 16908, 29901, 13, 18884, 722, 29918, 1767, 353, 1833, 29918, 3880, 29918, 6341, 29918, 16908, 29961, 1989, 29962, 13, 4706, 7928, 29918, 1761, 4619, 518, 1989, 718, 29242, 613, 851, 29898, 13140, 718, 29871, 29896, 511, 376, 29906, 613, 722, 29918, 1767, 29892, 851, 29898, 13140, 718, 29871, 29896, 511, 13, 9651, 851, 29898, 6671, 29918, 2848, 718, 29871, 29946, 511, 376, 29896, 29900, 29900, 613, 376, 29900, 3108, 13, 1678, 9262, 353, 1065, 29918, 15901, 29898, 3366, 489, 17462, 29899, 29873, 568, 613, 376, 489, 1217, 29899, 11338, 613, 13, 4706, 376, 489, 689, 613, 285, 29908, 4640, 2286, 1819, 363, 6297, 22372, 3784, 29918, 12154, 29913, 2396, 613, 376, 29900, 613, 376, 29900, 613, 376, 29900, 3108, 718, 13, 4706, 7928, 29918, 1761, 29897, 13, 1678, 7928, 29918, 16908, 353, 9262, 29889, 5451, 14182, 29876, 1159, 13, 1678, 363, 22645, 29892, 1820, 297, 26985, 29898, 12154, 29918, 4381, 29918, 16908, 1125, 13, 4706, 565, 7928, 29918, 16908, 29961, 13140, 5387, 13, 9651, 1857, 29918, 12154, 29918, 16908, 29961, 1989, 29962, 353, 7928, 29918, 16908, 29961, 13140, 29962, 13, 13, 361, 451, 2295, 29889, 657, 703, 6341, 29918, 16908, 613, 6213, 1125, 13, 1678, 2295, 3366, 6341, 29918, 16908, 3108, 353, 6571, 13, 2917, 3366, 6341, 29918, 16908, 3108, 29961, 3784, 29918, 12154, 29962, 353, 1857, 29918, 12154, 29918, 16908, 13, 7620, 29918, 2917, 580, 13, 13, 262, 23886, 353, 4390, 29889, 18132, 29898, 1491, 5014, 29889, 3198, 29918, 4905, 29898, 3366, 550, 1821, 29899, 262, 23886, 613, 13, 1678, 376, 489, 1761, 613, 376, 489, 15843, 3108, 876, 13, 13, 262, 23886, 29918, 13155, 353, 5159, 13, 1454, 2318, 297, 11817, 706, 3366, 497, 3108, 3366, 11991, 3108, 29901, 13, 1678, 565, 2318, 297, 11817, 706, 29901, 13, 4706, 11817, 706, 29918, 13155, 29889, 4397, 29898, 2972, 29897, 13, 13, 361, 7431, 29898, 262, 23886, 29918, 13155, 29897, 1275, 29871, 29900, 29901, 13, 1678, 1014, 5014, 29889, 3389, 29898, 3366, 550, 1821, 29899, 262, 23886, 613, 376, 489, 1761, 20068, 13, 1678, 10876, 29889, 13322, 703, 11432, 29901, 1939, 6471, 892, 1476, 297, 278, 11817, 706, 29889, 5399, 11817, 706, 5285, 1159, 13, 13, 4230, 29918, 3880, 29918, 2972, 353, 2295, 29889, 657, 703, 4230, 29918, 3880, 29918, 2972, 613, 6213, 29897, 13, 361, 1833, 29918, 3880, 29918, 2972, 1275, 376, 497, 1115, 13, 1678, 1833, 29918, 3880, 29918, 2972, 29918, 13140, 353, 376, 497, 29908, 13, 2870, 29901, 13, 1678, 1833, 29918, 3880, 29918, 2972, 29918, 13140, 353, 6213, 13, 15901, 29918, 1761, 353, 6796, 497, 613, 376, 3596, 18982, 3108, 13, 1454, 22645, 29892, 474, 297, 26985, 29898, 262, 23886, 29918, 13155, 1125, 13, 1678, 7928, 29918, 1761, 4619, 518, 710, 29898, 13140, 511, 474, 29962, 13, 1678, 565, 1833, 29918, 3880, 29918, 2972, 322, 474, 1275, 1833, 29918, 3880, 29918, 2972, 29901, 13, 4706, 1833, 29918, 3880, 29918, 2972, 29918, 13140, 353, 22645, 13, 13, 29937, 1192, 6510, 529, 726, 29958, 529, 3545, 29958, 529, 2103, 29958, 529, 6510, 3171, 29958, 529, 4039, 29896, 29958, 529, 667, 29896, 29958, 2023, 13, 15901, 29918, 7529, 353, 6796, 489, 17462, 29899, 29873, 568, 613, 376, 489, 1217, 29899, 11338, 613, 376, 489, 6510, 613, 376, 3549, 263, 2318, 29901, 613, 13, 1678, 376, 29900, 613, 376, 29900, 613, 376, 29900, 3108, 718, 7928, 29918, 1761, 13, 361, 451, 1833, 29918, 3880, 29918, 2972, 29918, 13140, 338, 6213, 29901, 13, 1678, 7928, 29918, 7529, 353, 6796, 489, 4381, 29899, 667, 613, 851, 29898, 4230, 29918, 3880, 29918, 2972, 29918, 13140, 4638, 718, 7928, 29918, 7529, 13, 21731, 353, 1065, 29918, 15901, 29898, 15901, 29918, 7529, 29897, 13, 361, 9262, 1275, 376, 497, 1115, 13, 1678, 1596, 703, 15156, 599, 18982, 1159, 13, 1678, 1857, 29918, 2972, 353, 6213, 13, 1678, 2295, 3366, 4230, 29918, 3880, 29918, 2972, 3108, 353, 376, 497, 29908, 13, 2870, 29901, 13, 1678, 1857, 29918, 2972, 353, 11817, 706, 29918, 13155, 29961, 524, 29898, 21731, 4638, 13, 1678, 1596, 29898, 29888, 29908, 15156, 2318, 22372, 3784, 29918, 2972, 10162, 1159, 13, 1678, 2295, 3366, 4230, 29918, 3880, 29918, 2972, 3108, 353, 1857, 29918, 2972, 13, 7620, 29918, 2917, 580, 13, 13, 23525, 29918, 6484, 353, 5159, 13, 361, 1857, 29918, 2972, 29901, 13, 1678, 11817, 706, 29918, 23525, 353, 5159, 13, 1678, 363, 3495, 297, 11817, 706, 29961, 3784, 29918, 2972, 29962, 3366, 23525, 3108, 29901, 13, 4706, 11817, 706, 29918, 23525, 29889, 4397, 29898, 3069, 29897, 13, 13, 1678, 1833, 29918, 3880, 29918, 23525, 353, 11817, 706, 29918, 23525, 13, 1678, 565, 451, 2295, 29889, 657, 703, 23525, 613, 6213, 29897, 338, 6213, 29901, 13, 4706, 1833, 29918, 3880, 29918, 23525, 353, 2295, 3366, 23525, 16862, 657, 29898, 3784, 29918, 2972, 29892, 11817, 706, 29918, 23525, 29897, 13, 1678, 7928, 29918, 1761, 353, 5159, 13, 1678, 363, 22645, 29892, 474, 297, 26985, 29898, 262, 23886, 29918, 23525, 1125, 13, 4706, 2944, 29918, 3859, 353, 376, 265, 29908, 565, 474, 297, 1833, 29918, 3880, 29918, 23525, 1683, 376, 2696, 29908, 13, 4706, 7928, 29918, 1761, 4619, 518, 710, 29898, 13140, 511, 474, 29892, 2944, 29918, 3859, 29962, 13, 1678, 9262, 353, 1065, 29918, 15901, 29898, 3366, 489, 17462, 29899, 29873, 568, 613, 376, 489, 1217, 29899, 11338, 613, 13, 4706, 376, 489, 3198, 1761, 613, 285, 29908, 3549, 18982, 21313, 3784, 29918, 2972, 29913, 1125, 613, 376, 29900, 613, 376, 29900, 613, 376, 29900, 3108, 718, 13, 4706, 7928, 29918, 1761, 29897, 13, 1678, 1857, 29918, 23525, 353, 5159, 13, 1678, 363, 3495, 29918, 13140, 297, 9262, 29889, 5451, 7295, 13, 4706, 1857, 29918, 23525, 29889, 4397, 29898, 262, 23886, 29918, 23525, 29961, 524, 29898, 3069, 29918, 13140, 29897, 2314, 13, 13, 1678, 565, 7431, 29898, 3784, 29918, 23525, 29897, 1275, 29871, 29900, 29901, 13, 4706, 10876, 29889, 13322, 703, 3782, 18982, 892, 4629, 29889, 1222, 11407, 1159, 13, 1678, 1596, 703, 15156, 18982, 613, 1857, 29918, 23525, 29897, 13, 1678, 18982, 29918, 6484, 353, 6796, 29899, 29880, 613, 9162, 1642, 7122, 29898, 3784, 29918, 23525, 4638, 13, 13, 1678, 565, 451, 2295, 29889, 657, 703, 23525, 613, 6213, 1125, 13, 4706, 2295, 3366, 23525, 3108, 353, 6571, 13, 1678, 2295, 3366, 23525, 3108, 29961, 3784, 29918, 2972, 29962, 353, 1857, 29918, 23525, 13, 1678, 4078, 29918, 2917, 580, 13, 13, 550, 1821, 29918, 1456, 2909, 29918, 9006, 353, 6796, 550, 1821, 29899, 1456, 2909, 613, 5591, 3670, 29914, 550, 1821, 29899, 1456, 12733, 29914, 3389, 29918, 12154, 29889, 21053, 613, 13, 1678, 376, 489, 17833, 29899, 16908, 613, 285, 29908, 12154, 29918, 978, 3790, 3784, 29918, 12154, 29913, 3108, 718, 18982, 29918, 6484, 13, 361, 7431, 29898, 3784, 29918, 12154, 29918, 16908, 29897, 2804, 29871, 29900, 29901, 13, 1678, 385, 1687, 29918, 1456, 2909, 29918, 9006, 4619, 6796, 489, 17833, 29899, 16908, 613, 4390, 29889, 29881, 17204, 29898, 3784, 29918, 12154, 29918, 16908, 4638, 13, 1491, 5014, 29889, 3198, 29918, 4804, 29898, 550, 1821, 29918, 1456, 2909, 29918, 9006, 29897, 2 ]
Flo et toto/Exercices/Commande.py
geverartsdev/TechnofuturTIC
0
1609242
<gh_stars>0 print---- imprimmer int---- entier float---- décimal str---- texte bool---- booléen if...(true/false):----Si elif...():----Si autres else :----Autres input()----Entre while()----Tant que len()----Longueur upper()----Minuscules -> Majuscules lower()----Majuscules -> Minuscules dict----Dictionnaire import----importer (import random) for...in----Pour chauqe ... dans/du... range----portée split()---- séparation des caractère class---- classe __init__()---- initialisation self----moi
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 2158, 807, 527, 9469, 1050, 13, 524, 807, 875, 631, 13, 7411, 807, 4224, 3039, 13, 710, 807, 19696, 371, 13, 11227, 807, 6120, 29948, 264, 13, 361, 856, 29898, 3009, 29914, 4541, 1125, 807, 25598, 13, 23681, 856, 7295, 807, 25598, 10890, 13, 2870, 584, 807, 27932, 13, 2080, 580, 807, 5292, 276, 13, 8000, 580, 807, 29911, 424, 712, 13, 2435, 580, 807, 8208, 434, 332, 13, 21064, 580, 807, 8140, 375, 21337, 1599, 6973, 375, 21337, 13, 13609, 580, 807, 29924, 1175, 375, 21337, 1599, 3080, 375, 21337, 13, 8977, 807, 29928, 2463, 15421, 13, 5215, 807, 326, 18505, 313, 5215, 4036, 29897, 13, 1454, 856, 262, 807, 29925, 473, 521, 585, 29939, 29872, 2023, 1465, 29914, 700, 856, 13, 3881, 807, 637, 1318, 13, 5451, 580, 807, 7019, 862, 362, 553, 1559, 627, 1908, 13, 1990, 807, 17792, 13, 1678, 4770, 2344, 1649, 580, 807, 2847, 4371, 13, 1678, 1583, 807, 4346, 29875, 13, 13, 13, 13, 2 ]
azure/functions/_abc.py
DalavanCloud/azure-functions-python-worker
1
181437
import abc import typing T = typing.TypeVar('T') class Out(abc.ABC, typing.Generic[T]): @abc.abstractmethod def set(self, val: T) -> None: pass @abc.abstractmethod def get(self) -> T: pass class Context(abc.ABC): @property @abc.abstractmethod def invocation_id(self) -> str: pass @property @abc.abstractmethod def function_name(self) -> str: pass @property @abc.abstractmethod def function_directory(self) -> str: pass class HttpRequest(abc.ABC): @property @abc.abstractmethod def method(self) -> str: pass @property @abc.abstractmethod def url(self) -> str: pass @property @abc.abstractmethod def headers(self) -> typing.Mapping[str, str]: pass @property @abc.abstractmethod def params(self) -> typing.Mapping[str, str]: pass def get_body(self) -> bytes: pass class HttpResponse(abc.ABC): @property @abc.abstractmethod def status_code(self) -> int: pass @property @abc.abstractmethod def headers(self) -> typing.MutableMapping[str, str]: pass @abc.abstractmethod def get_body(self) -> bytes: pass
[ 1, 1053, 25638, 13, 5215, 19229, 13, 13, 13, 29911, 353, 19229, 29889, 1542, 9037, 877, 29911, 1495, 13, 13, 13, 1990, 4451, 29898, 10736, 29889, 19658, 29892, 19229, 29889, 15809, 29961, 29911, 29962, 1125, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 731, 29898, 1311, 29892, 659, 29901, 323, 29897, 1599, 6213, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29898, 1311, 29897, 1599, 323, 29901, 13, 4706, 1209, 13, 13, 13, 1990, 15228, 29898, 10736, 29889, 19658, 1125, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 2437, 10610, 29918, 333, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 740, 29918, 978, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 740, 29918, 12322, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 13, 1990, 9056, 3089, 29898, 10736, 29889, 19658, 1125, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 1158, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 3142, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 9066, 29898, 1311, 29897, 1599, 19229, 29889, 15845, 29961, 710, 29892, 851, 5387, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 8636, 29898, 1311, 29897, 1599, 19229, 29889, 15845, 29961, 710, 29892, 851, 5387, 13, 4706, 1209, 13, 13, 1678, 822, 679, 29918, 2587, 29898, 1311, 29897, 1599, 6262, 29901, 13, 4706, 1209, 13, 13, 13, 1990, 9056, 5103, 29898, 10736, 29889, 19658, 1125, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 4660, 29918, 401, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 6799, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 9066, 29898, 1311, 29897, 1599, 19229, 29889, 15211, 15845, 29961, 710, 29892, 851, 5387, 13, 4706, 1209, 13, 13, 1678, 732, 10736, 29889, 16595, 5696, 13, 1678, 822, 679, 29918, 2587, 29898, 1311, 29897, 1599, 6262, 29901, 13, 4706, 1209, 13, 2 ]
scvelo/logging.py
saksham219/scvelo
0
1611908
"""Logging and Profiling """ from . import settings from datetime import datetime from time import time as get_time from platform import python_version _VERBOSITY_LEVELS_FROM_STRINGS = {'error': 0, 'warn': 1, 'info': 2, 'hint': 3} def info(*args, **kwargs): return msg(*args, v='info', **kwargs) def error(*args, **kwargs): args = ('Error:',) + args return msg(*args, v='error', **kwargs) def warn(*args, **kwargs): args = ('WARNING:',) + args return msg(*args, v='warn', **kwargs) def hint(*args, **kwargs): return msg(*args, v='hint', **kwargs) def _settings_verbosity_greater_or_equal_than(v): if isinstance(settings.verbosity, str): settings_v = _VERBOSITY_LEVELS_FROM_STRINGS[settings.verbosity] else: settings_v = settings.verbosity return settings_v >= v def msg(*msg, v=4, time=False, memory=False, reset=False, end='\n', no_indent=False, t=None, m=None, r=None): """Write message to logging output. Log output defaults to standard output but can be set to a file by setting `sc.settings.log_file = 'mylogfile.txt'`. v : {'error', 'warn', 'info', 'hint'} or int, (default: 4) 0/'error', 1/'warn', 2/'info', 3/'hint', 4, 5, 6... time, t : bool, optional (default: False) Print timing information; restart the clock. memory, m : bool, optional (default: Faulse) Print memory information. reset, r : bool, optional (default: False) Reset timing and memory measurement. Is automatically reset when passing one of ``time`` or ``memory``. end : str (default: '\n') Same meaning as in builtin ``print()`` function. no_indent : bool (default: False) Do not indent for ``v >= 4``. """ # variable shortcuts if t is not None: time = t if m is not None: memory = m if r is not None: reset = r if isinstance(v, str): v = _VERBOSITY_LEVELS_FROM_STRINGS[v] if v == 3: # insert "--> " before hints msg = ('-->',) + msg if v >= 4 and not no_indent: msg = (' ',) + msg if _settings_verbosity_greater_or_equal_than(v): if not time and not memory and len(msg) > 0: _write_log(*msg, end=end) if reset: try: settings._previous_memory_usage, _ = get_memory_usage() except: pass settings._previous_time = get_time() if time: elapsed = get_passed_time() msg = msg + ('({})'.format(_sec_to_str(elapsed)),) _write_log(*msg, end=end) if memory: _write_log(get_memory_usage(), end=end) m = msg def _write_log(*msg, end='\n'): """Write message to log output, ignoring the verbosity level. This is the most basic function. Parameters ---------- *msg : One or more arguments to be formatted as string. Same behavior as print function. """ from .settings import logfile if logfile == '': print(*msg, end=end) else: out = '' for s in msg: out += str(s) + ' ' with open(logfile, 'a') as f: f.write(out + end) def _sec_to_str(t): """Format time in seconds. Parameters ---------- t : int Time in seconds. """ from functools import reduce return "%d:%02d:%02d.%02d" % \ reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(t*100,), 100, 60, 60]) def get_passed_time(): now = get_time() elapsed = now - settings._previous_time settings._previous_time = now return elapsed def print_passed_time(): now = get_time() elapsed = now - settings._previous_time settings._previous_time = now from functools import reduce elapsed = "%d:%02d:%02d.%02d" % reduce(lambda ll, b: divmod(ll[0], b) + ll[1:], [(elapsed*100,), 100, 60, 60]) return elapsed def print_version(): from . import __version__ _write_log('Running scvelo', __version__, '(python ' + python_version() + ')', 'on {}.'.format(get_date_string())) def print_versions(): for mod in ['scvelo', 'scanpy', 'anndata', 'loompy', 'numpy', 'scipy', 'matplotlib', 'sklearn', 'pandas']: mod_name = mod[0] if isinstance(mod, tuple) else mod mod_install = mod[1] if isinstance(mod, tuple) else mod try: print('{}=={}'.format(mod_install, __import__(mod_name).__version__), end=' ') except (ImportError, AttributeError): pass print() def get_date_string(): return datetime.now().strftime("%Y-%m-%d %H:%M") from anndata.logging import print_memory_usage from anndata.logging import get_memory_usage from sys import stdout class ProgressReporter: def __init__(self, total, interval=3): self.count = 0 self.total = total self.timestamp = get_time() self.interval = interval def update(self): self.count += 1 if settings.verbosity > 1 and (get_time() - self.timestamp > self.interval or self.count == self.total): self.timestamp = get_time() percent = int(self.count * 100 / self.total) stdout.write('\r' + '... %d%%' % percent) stdout.flush() def finish(self): if settings.verbosity > 1: stdout.write('\r') stdout.flush()
[ 1, 9995, 3403, 3460, 322, 23202, 292, 13, 15945, 29908, 13, 13, 3166, 869, 1053, 6055, 13, 3166, 12865, 1053, 12865, 13, 3166, 931, 1053, 931, 408, 679, 29918, 2230, 13, 3166, 7481, 1053, 3017, 29918, 3259, 13, 13, 13, 29918, 5348, 29933, 3267, 11937, 29918, 1307, 29963, 6670, 29903, 29918, 21482, 29918, 20785, 29903, 353, 11117, 2704, 2396, 29871, 29900, 29892, 525, 25442, 2396, 29871, 29896, 29892, 525, 3888, 2396, 29871, 29906, 29892, 525, 29882, 524, 2396, 29871, 29941, 29913, 13, 13, 13, 1753, 5235, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 736, 10191, 10456, 5085, 29892, 325, 2433, 3888, 742, 3579, 19290, 29897, 13, 13, 13, 1753, 1059, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 6389, 353, 6702, 2392, 29901, 742, 29897, 718, 6389, 13, 1678, 736, 10191, 10456, 5085, 29892, 325, 2433, 2704, 742, 3579, 19290, 29897, 13, 13, 13, 1753, 29383, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 6389, 353, 6702, 29956, 25614, 29901, 742, 29897, 718, 6389, 13, 1678, 736, 10191, 10456, 5085, 29892, 325, 2433, 25442, 742, 3579, 19290, 29897, 13, 13, 13, 1753, 13182, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 736, 10191, 10456, 5085, 29892, 325, 2433, 29882, 524, 742, 3579, 19290, 29897, 13, 13, 13, 1753, 903, 11027, 29918, 18248, 359, 537, 29918, 7979, 1008, 29918, 272, 29918, 11745, 29918, 27603, 29898, 29894, 1125, 13, 1678, 565, 338, 8758, 29898, 11027, 29889, 18248, 359, 537, 29892, 851, 1125, 13, 4706, 6055, 29918, 29894, 353, 903, 5348, 29933, 3267, 11937, 29918, 1307, 29963, 6670, 29903, 29918, 21482, 29918, 20785, 29903, 29961, 11027, 29889, 18248, 359, 537, 29962, 13, 1678, 1683, 29901, 13, 4706, 6055, 29918, 29894, 353, 6055, 29889, 18248, 359, 537, 13, 1678, 736, 6055, 29918, 29894, 6736, 325, 13, 13, 13, 1753, 10191, 10456, 7645, 29892, 325, 29922, 29946, 29892, 931, 29922, 8824, 29892, 3370, 29922, 8824, 29892, 10092, 29922, 8824, 29892, 1095, 2433, 29905, 29876, 742, 13, 4706, 694, 29918, 12860, 29922, 8824, 29892, 260, 29922, 8516, 29892, 286, 29922, 8516, 29892, 364, 29922, 8516, 1125, 13, 1678, 9995, 6113, 2643, 304, 12183, 1962, 29889, 13, 1678, 4522, 1962, 21274, 304, 3918, 1962, 541, 508, 367, 731, 304, 263, 934, 13, 1678, 491, 4444, 421, 1557, 29889, 11027, 29889, 1188, 29918, 1445, 353, 525, 1357, 1188, 1445, 29889, 3945, 29915, 1412, 13, 1678, 325, 584, 11117, 2704, 742, 525, 25442, 742, 525, 3888, 742, 525, 29882, 524, 10827, 470, 938, 29892, 313, 4381, 29901, 29871, 29946, 29897, 13, 308, 29900, 22208, 2704, 742, 29871, 29896, 22208, 25442, 742, 29871, 29906, 22208, 3888, 742, 29871, 29941, 22208, 29882, 524, 742, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 856, 13, 1678, 931, 29892, 260, 584, 6120, 29892, 13136, 313, 4381, 29901, 7700, 29897, 13, 4706, 13905, 28750, 2472, 29936, 10715, 278, 12006, 29889, 13, 1678, 3370, 29892, 286, 584, 6120, 29892, 13136, 313, 4381, 29901, 7748, 19994, 29897, 13, 4706, 13905, 3370, 2472, 29889, 13, 1678, 10092, 29892, 364, 584, 6120, 29892, 13136, 313, 4381, 29901, 7700, 29897, 13, 4706, 2538, 300, 28750, 322, 3370, 20039, 29889, 1317, 6336, 10092, 13, 4706, 746, 6819, 697, 310, 4954, 2230, 16159, 470, 4954, 14834, 29952, 1412, 13, 1678, 1095, 584, 851, 313, 4381, 29901, 11297, 29876, 1495, 13, 4706, 19491, 6593, 408, 297, 4240, 262, 4954, 2158, 2555, 29952, 740, 29889, 13, 1678, 694, 29918, 12860, 584, 6120, 313, 4381, 29901, 7700, 29897, 13, 4706, 1938, 451, 29536, 363, 4954, 29894, 6736, 29871, 29946, 29952, 1412, 13, 1678, 9995, 13, 1678, 396, 2286, 21697, 29879, 13, 1678, 565, 260, 338, 451, 6213, 29901, 931, 353, 260, 13, 1678, 565, 286, 338, 451, 6213, 29901, 3370, 353, 286, 13, 1678, 565, 364, 338, 451, 6213, 29901, 10092, 353, 364, 13, 1678, 565, 338, 8758, 29898, 29894, 29892, 851, 1125, 13, 4706, 325, 353, 903, 5348, 29933, 3267, 11937, 29918, 1307, 29963, 6670, 29903, 29918, 21482, 29918, 20785, 29903, 29961, 29894, 29962, 13, 1678, 565, 325, 1275, 29871, 29941, 29901, 29871, 396, 4635, 376, 15110, 376, 1434, 26085, 13, 4706, 10191, 353, 6702, 15110, 742, 29897, 718, 10191, 13, 1678, 565, 325, 6736, 29871, 29946, 322, 451, 694, 29918, 12860, 29901, 13, 4706, 10191, 353, 6702, 259, 13420, 29897, 718, 10191, 13, 1678, 565, 903, 11027, 29918, 18248, 359, 537, 29918, 7979, 1008, 29918, 272, 29918, 11745, 29918, 27603, 29898, 29894, 1125, 13, 4706, 565, 451, 931, 322, 451, 3370, 322, 7431, 29898, 7645, 29897, 1405, 29871, 29900, 29901, 13, 9651, 903, 3539, 29918, 1188, 10456, 7645, 29892, 1095, 29922, 355, 29897, 13, 4706, 565, 10092, 29901, 13, 9651, 1018, 29901, 13, 18884, 6055, 3032, 24957, 29918, 14834, 29918, 21125, 29892, 903, 353, 679, 29918, 14834, 29918, 21125, 580, 13, 9651, 5174, 29901, 13, 18884, 1209, 13, 9651, 6055, 3032, 24957, 29918, 2230, 353, 679, 29918, 2230, 580, 13, 4706, 565, 931, 29901, 13, 9651, 560, 28170, 353, 679, 29918, 3364, 287, 29918, 2230, 580, 13, 9651, 10191, 353, 10191, 718, 6702, 3319, 1800, 4286, 4830, 7373, 3471, 29918, 517, 29918, 710, 29898, 295, 28170, 8243, 29897, 13, 9651, 903, 3539, 29918, 1188, 10456, 7645, 29892, 1095, 29922, 355, 29897, 13, 4706, 565, 3370, 29901, 13, 9651, 903, 3539, 29918, 1188, 29898, 657, 29918, 14834, 29918, 21125, 3285, 1095, 29922, 355, 29897, 13, 13, 29885, 353, 10191, 13, 13, 13, 1753, 903, 3539, 29918, 1188, 10456, 7645, 29892, 1095, 2433, 29905, 29876, 29374, 13, 1678, 9995, 6113, 2643, 304, 1480, 1962, 29892, 5330, 8253, 278, 9750, 359, 537, 3233, 29889, 13, 1678, 910, 338, 278, 1556, 6996, 740, 29889, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 334, 7645, 584, 13, 4706, 3118, 470, 901, 6273, 304, 367, 20917, 408, 1347, 29889, 19491, 6030, 408, 1596, 13, 4706, 740, 29889, 13, 1678, 9995, 13, 1678, 515, 869, 11027, 1053, 1480, 1445, 13, 1678, 565, 1480, 1445, 1275, 525, 2396, 13, 4706, 1596, 10456, 7645, 29892, 1095, 29922, 355, 29897, 13, 1678, 1683, 29901, 13, 4706, 714, 353, 6629, 13, 4706, 363, 269, 297, 10191, 29901, 13, 9651, 714, 4619, 851, 29898, 29879, 29897, 718, 525, 525, 13, 4706, 411, 1722, 29898, 1188, 1445, 29892, 525, 29874, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 449, 718, 1095, 29897, 13, 13, 13, 1753, 903, 3471, 29918, 517, 29918, 710, 29898, 29873, 1125, 13, 1678, 9995, 5809, 931, 297, 6923, 29889, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 260, 584, 938, 13, 4706, 5974, 297, 6923, 29889, 13, 1678, 9995, 13, 1678, 515, 2090, 312, 8789, 1053, 10032, 13, 1678, 736, 11860, 29881, 16664, 29900, 29906, 29881, 16664, 29900, 29906, 29881, 29889, 29995, 29900, 29906, 29881, 29908, 1273, 320, 13, 4706, 10032, 29898, 2892, 11148, 29892, 289, 29901, 1933, 1545, 29898, 645, 29961, 29900, 1402, 289, 29897, 718, 11148, 29961, 29896, 29901, 1402, 13, 1669, 17288, 29873, 29930, 29896, 29900, 29900, 29892, 511, 29871, 29896, 29900, 29900, 29892, 29871, 29953, 29900, 29892, 29871, 29953, 29900, 2314, 13, 13, 13, 1753, 679, 29918, 3364, 287, 29918, 2230, 7295, 13, 1678, 1286, 353, 679, 29918, 2230, 580, 13, 1678, 560, 28170, 353, 1286, 448, 6055, 3032, 24957, 29918, 2230, 13, 1678, 6055, 3032, 24957, 29918, 2230, 353, 1286, 13, 1678, 736, 560, 28170, 13, 13, 13, 1753, 1596, 29918, 3364, 287, 29918, 2230, 7295, 13, 1678, 1286, 353, 679, 29918, 2230, 580, 13, 1678, 560, 28170, 353, 1286, 448, 6055, 3032, 24957, 29918, 2230, 13, 1678, 6055, 3032, 24957, 29918, 2230, 353, 1286, 13, 13, 1678, 515, 2090, 312, 8789, 1053, 10032, 13, 1678, 560, 28170, 353, 11860, 29881, 16664, 29900, 29906, 29881, 16664, 29900, 29906, 29881, 29889, 29995, 29900, 29906, 29881, 29908, 1273, 10032, 29898, 2892, 11148, 29892, 289, 29901, 1933, 1545, 29898, 645, 29961, 29900, 1402, 289, 29897, 718, 11148, 29961, 29896, 29901, 1402, 17288, 295, 28170, 29930, 29896, 29900, 29900, 29892, 511, 29871, 29896, 29900, 29900, 29892, 29871, 29953, 29900, 29892, 29871, 29953, 29900, 2314, 13, 1678, 736, 560, 28170, 13, 13, 13, 1753, 1596, 29918, 3259, 7295, 13, 1678, 515, 869, 1053, 4770, 3259, 1649, 13, 1678, 903, 3539, 29918, 1188, 877, 27795, 885, 955, 29877, 742, 4770, 3259, 1649, 29892, 525, 29898, 4691, 525, 718, 3017, 29918, 3259, 580, 718, 25710, 742, 525, 265, 426, 1836, 4286, 4830, 29898, 657, 29918, 1256, 29918, 1807, 22130, 13, 13, 13, 1753, 1596, 29918, 26100, 7295, 13, 1678, 363, 878, 297, 6024, 1557, 955, 29877, 742, 525, 16192, 2272, 742, 525, 273, 299, 532, 742, 525, 417, 290, 2272, 742, 525, 23749, 742, 525, 26167, 2272, 742, 525, 2922, 17357, 742, 525, 808, 19668, 742, 525, 15112, 2033, 29901, 13, 4706, 878, 29918, 978, 353, 878, 29961, 29900, 29962, 565, 338, 8758, 29898, 1545, 29892, 18761, 29897, 1683, 878, 13, 4706, 878, 29918, 6252, 353, 878, 29961, 29896, 29962, 565, 338, 8758, 29898, 1545, 29892, 18761, 29897, 1683, 878, 13, 4706, 1018, 29901, 1596, 877, 8875, 1360, 8875, 4286, 4830, 29898, 1545, 29918, 6252, 29892, 4770, 5215, 12035, 1545, 29918, 978, 467, 1649, 3259, 1649, 511, 1095, 2433, 29871, 25710, 13, 4706, 5174, 313, 17518, 2392, 29892, 23833, 2392, 1125, 1209, 13, 1678, 1596, 580, 13, 13, 13, 1753, 679, 29918, 1256, 29918, 1807, 7295, 13, 1678, 736, 12865, 29889, 3707, 2141, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 1159, 13, 13, 13, 3166, 385, 299, 532, 29889, 21027, 1053, 1596, 29918, 14834, 29918, 21125, 13, 3166, 385, 299, 532, 29889, 21027, 1053, 679, 29918, 14834, 29918, 21125, 13, 13, 13, 3166, 10876, 1053, 27591, 13, 1990, 20018, 5612, 9555, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3001, 29892, 7292, 29922, 29941, 1125, 13, 4706, 1583, 29889, 2798, 353, 29871, 29900, 13, 4706, 1583, 29889, 7827, 353, 3001, 13, 4706, 1583, 29889, 16394, 353, 679, 29918, 2230, 580, 13, 4706, 1583, 29889, 19207, 353, 7292, 13, 13, 1678, 822, 2767, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2798, 4619, 29871, 29896, 13, 4706, 565, 6055, 29889, 18248, 359, 537, 1405, 29871, 29896, 322, 313, 657, 29918, 2230, 580, 448, 1583, 29889, 16394, 1405, 1583, 29889, 19207, 470, 1583, 29889, 2798, 1275, 1583, 29889, 7827, 1125, 13, 9651, 1583, 29889, 16394, 353, 679, 29918, 2230, 580, 13, 9651, 10151, 353, 938, 29898, 1311, 29889, 2798, 334, 29871, 29896, 29900, 29900, 847, 1583, 29889, 7827, 29897, 13, 9651, 27591, 29889, 3539, 28909, 29878, 29915, 718, 525, 856, 1273, 29881, 7686, 29915, 1273, 10151, 29897, 13, 9651, 27591, 29889, 23126, 580, 13, 13, 1678, 822, 8341, 29898, 1311, 1125, 13, 4706, 565, 6055, 29889, 18248, 359, 537, 1405, 29871, 29896, 29901, 13, 9651, 27591, 29889, 3539, 28909, 29878, 1495, 13, 9651, 27591, 29889, 23126, 580, 13, 2 ]
spider/bookinfo/items.py
leitelyaya/Broadview-analysing-sales-figures
5
65250
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class BookinfoItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() coverImage = scrapy.Field() #"cover.jpg", classify = scrapy.Field() #"分类", index = scrapy.Field() #"列表页中的排名", pageNo = scrapy.Field() #"列表中的第几页", content = scrapy.Field() #"html内容"
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 22402, 1244, 278, 4733, 363, 596, 885, 2390, 287, 4452, 13, 29937, 13, 29937, 2823, 5106, 297, 29901, 13, 29937, 1732, 597, 1514, 29889, 1557, 336, 2272, 29889, 990, 29914, 264, 29914, 12333, 29914, 3332, 1199, 29914, 7076, 29889, 1420, 13, 13, 5215, 24559, 2272, 13, 13, 13, 1990, 6726, 3888, 2001, 29898, 1557, 336, 2272, 29889, 2001, 1125, 13, 1678, 396, 4529, 278, 4235, 363, 596, 2944, 1244, 763, 29901, 13, 1678, 396, 1024, 353, 24559, 2272, 29889, 3073, 580, 13, 1678, 4612, 2940, 353, 24559, 2272, 29889, 3073, 580, 396, 29908, 11911, 29889, 6173, 613, 13, 1678, 770, 1598, 259, 353, 24559, 2272, 29889, 3073, 580, 396, 29908, 30748, 30832, 613, 13, 1678, 2380, 418, 353, 24559, 2272, 29889, 3073, 580, 396, 29908, 31025, 30746, 31610, 30275, 30210, 233, 145, 149, 30548, 613, 13, 1678, 1813, 3782, 268, 353, 24559, 2272, 29889, 3073, 580, 396, 29908, 31025, 30746, 30275, 30210, 30622, 232, 138, 163, 31610, 613, 13, 1678, 2793, 1678, 353, 24559, 2272, 29889, 3073, 580, 396, 29908, 1420, 30728, 31294, 29908, 13, 2 ]
search_engine/worker.py
Dhruvacube/search-engine
0
29121
import importlib from uvicorn.workers import UvicornWorker class DynamicUvicornWorker(UvicornWorker): """ This class is called `DynamicUvicornWorker` because it assigns values according to the module available Union['asyncio', 'uvloop'] It also set `lifespan` to `off` :) """ spam_spec = importlib.util.find_spec("uvloop") found = spam_spec is not None if found: CONFIG_KWARGS = {"loop": "uvloop", "http": "auto", "lifespan": "off"} else: CONFIG_KWARGS = {"loop": "auto", "http": "auto", "lifespan": "off"}
[ 1, 1053, 1053, 1982, 13, 13, 3166, 318, 26311, 1398, 29889, 1287, 414, 1053, 501, 26311, 1398, 16164, 13, 13, 13, 1990, 27747, 29965, 26311, 1398, 16164, 29898, 29965, 26311, 1398, 16164, 1125, 13, 1678, 9995, 13, 1678, 910, 770, 338, 2000, 421, 24001, 29965, 26311, 1398, 16164, 29952, 1363, 372, 3566, 29879, 1819, 13, 1678, 5034, 304, 278, 3883, 3625, 7761, 1839, 294, 948, 3934, 742, 525, 4090, 7888, 2033, 13, 1678, 739, 884, 731, 421, 29880, 361, 267, 8357, 29952, 304, 421, 2696, 29952, 4248, 13, 1678, 9995, 13, 13, 1678, 805, 314, 29918, 6550, 353, 1053, 1982, 29889, 4422, 29889, 2886, 29918, 6550, 703, 4090, 7888, 1159, 13, 1678, 1476, 353, 805, 314, 29918, 6550, 338, 451, 6213, 13, 1678, 565, 1476, 29901, 13, 4706, 8707, 18667, 29918, 29968, 29956, 1718, 10749, 353, 8853, 7888, 1115, 376, 4090, 7888, 613, 376, 1124, 1115, 376, 6921, 613, 376, 29880, 361, 267, 8357, 1115, 376, 2696, 9092, 13, 1678, 1683, 29901, 13, 4706, 8707, 18667, 29918, 29968, 29956, 1718, 10749, 353, 8853, 7888, 1115, 376, 6921, 613, 376, 1124, 1115, 376, 6921, 613, 376, 29880, 361, 267, 8357, 1115, 376, 2696, 9092, 13, 2 ]
randstrip.py
itec78/fumcaso
0
74929
<reponame>itec78/fumcaso<filename>randstrip.py #!/usr/bin/python3 from PIL import Image from PIL import ImageFont from PIL import ImageDraw import csv import random import os import json fileDir = os.path.dirname(os.path.abspath(__file__)) def replaceText(text,config): """This function replace $WILDCARD with a word found in subs.csv subs.csv definition is 1st colum $WILDCARD, subsequent columns, possible values (chosen at random), delimiter is ;""" with open(config["csvLocation"]+"/"+config["csvSubs"]) as subs: csvReader = csv.reader(subs,delimiter=";") for row in csvReader: if text.find(row[0]) != -1: text = text.replace(row[0],row[random.randint(1,len(row)-1)],1) return text print("Parsing error \""+text+"\" not found") quit() def fetchText(indText,config): """This function fetch the text for the image with two characters rtext.csv definition is: 1st column the name of the file (i.e. B001.png), 2nd number of actors (at the moment they are limited to two; then a couple of columns or each actor with x and y coord of the strings; after the coords the outcomes, one column for each actor Delimiter is ; and line feeds @, if there aren't any options, it returns 0 (no text) It returns two arrays, coords is a tuple (x,y) and result is the outcome""" with open(config["csvLocation"]+"/"+config["csvSpeech"]) as rtext: csvReader = csv.reader(rtext,delimiter=';') for row in csvReader: if row[0]==indText: noActors = int(row[1]) if noActors == 0: return 0 else: firstElement = 2+(noActors*2) lastElement = len(row)-(noActors-1) randQuote = random.randrange(firstElement,lastElement,noActors) coords = [] result = [] for x in range(0,noActors): coords.append((row[2+x*2],row[3+x*2])) result.append(row[randQuote+x]) return coords,result def fetchVign(config): """This functions fetch an image, randomly, chosen from a markov tree defined in ram.csv ram.csv definition is: 1st column the name of the image (without extension), subsequent columns, possible outcomes chosen randomly It returns an array with the file names""" starts = [] startdest = [] nvign = 0 currVign = "000" story = [] with open(config["csvLocation"]+"/"+config["csvTree"]) as ram: csvReader = csv.reader(ram) for row in csvReader: starts.append(row[0]) startdest.append(row) while nvign <100: story.append(startdest[starts.index(currVign)][random.randint(1,len(startdest[starts.index(currVign)])-1)]) currVign = story[nvign] if currVign == "END": return story story[nvign]+=".png" nvign +=1 print("tree with no END") quit() def addThing(indVign,config): """This function adds a small image (object) to a larger image obj.csv definition is: name of the image (i.e. A001.png), x-coord, y-coord, subsequent columns possible outcomes It returns a tuple (object file name, x, y)""" with open(config["csvLocation"]+"/"+config["csvObj"]) as obj: csvReader = csv.reader(obj) for row in csvReader: if row[0] == indVign: return row[random.randint(3,len(row)-1)],row[1],row[2] return 0 def writeStrip(story,config): """This function creates the strip returning an image object that could be saved or viewed. It takes an array with filenames as parameter The first image is always 000, then appends to strip the files, then decorates it fetching text and adding objects. If the object is an R, then repeats the last object.""" strip = [] for indVign in story: try: vign = Image.open(config["imagesLocation"]+"/"+indVign).convert('RGBA') addtext = ImageDraw.Draw(vign) fnt = ImageFont.truetype(config["font"],config["fontSize"]) textVign = fetchText(indVign,config) if textVign!=0: try: for x in range(len(textVign[0])): text_vign = textVign[1][x] try: while text_vign.find('$') != -1: text_vign = replaceText(text_vign,config) except AttributeError as err: print("Problem parsing:") print(textVign) print(err) quit() text_vign = text_vign.replace('@','\n') addtext.multiline_text((int(textVign[0][x][0]),int(textVign[0][x][1])),text_vign,fill="#000000",font=fnt,align="center") except TypeError: print("Problem finding text for:") print(indVign) quit() obj = addThing(indVign,config) if obj!=0: if obj[0] == 'R': objImg = Image.open(config["imagesLocation"]+"/"+prevObj[0]) else: prevObj = obj objImg = Image.open(config["imagesLocation"]+"/"+obj[0]) vign.paste(objImg,(int(obj[1]),int(obj[2]))) strip.append(vign) except FileNotFoundError: pass image = Image.new('RGBA',(config["xSize"],config["ySize"])) xshift=0 for vign in strip: image.paste(vign,(xshift,0)) xshift += config["panelLength"] ImageDraw.Draw(image).rectangle([0,0,config["xSize"]-1,config["ySize"]-1], fill=None, outline="black", width=1) return image def createStrip(config,specialPlatform=""): """Create strip and save it createStrip(str path/filename)""" try: story = fetchVign(config) finalStrip = writeStrip(story,config) if specialPlatform == "android": return finalStrip else: finalStrip.save(config["saveLocation"]+config["filename"]) return 0 except Exception as err: return err def readConfig(profile=False,platform=False): """Read configuration file""" try: with open(fileDir+"/config.json") as f: config = json.load(f) except IOError: print("config.json not found") return False if not(profile): profile = config["defaultProfile"] else: profile = profile[0] try: checkProfile = config[profile] except KeyError: print("Profile "+profile+" not found") quit() saveLocation = checkLocal(config[profile]["saveLocation"]) imagesLocation = checkLocal(config[profile]["imagesLocation"]) csvLocation = checkLocal(config[profile]["csvLocation"]) csvTree = config[profile]["csvTree"] csvSpeech = config[profile]["csvSpeech"] csvSubs = config[profile]["csvSubs"] csvObj = config[profile]["csvObj"] font = checkLocal(config[profile]["font"]) fontSize = int((config[profile]["fontSize"])) xSize = config[profile]["xSize"] ySize = config[profile]["ySize"] panelLength = config[profile]["panelLength"] if platform: token = checkLocal(config[profile][platform]["token"]) filename = checkLocal(config[profile][platform]["filename"]) try: text = config[profile][platform]["text"] except KeyError: text = False return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"fontSize":fontSize,"font":font,"token":token,"filename":filename,"xSize":xSize,"ySize":ySize,"panelLength":panelLength,"csvTree":csvTree,"csvSpeech":csvSpeech,"csvSubs":csvSubs,"csvObj":csvObj,"text":text} filename = config[profile]["filename"] return {"saveLocation":saveLocation,"imagesLocation":imagesLocation,"csvLocation":csvLocation,"fontSize":fontSize,"font":font,"filename":filename,"xSize":xSize,"ySize":ySize,"panelLength":panelLength,"csvTree":csvTree,"csvSpeech":csvSpeech,"csvSubs":csvSubs,"csvObj":csvObj} def checkLocal(directory): """Checks if it's a relative or absolute path""" if directory[0] == ".": return fileDir + directory[1:] else: return directory if __name__ == "__main__": import argparse parser = argparse.ArgumentParser() parser.add_argument('-s','--story',metavar='story',default='',nargs=4,help='name of the images') parser.add_argument('-a','--a4',default=False,action='store_true',help='print on an A4 in PDF, needs -o output, disables -x xsize') parser.add_argument('-m','--multiple',metavar='multiple',default=[1],nargs=1,type=int,help='multiple output (int >0), if no output -o specified, it just tests the stories') parser.add_argument('-x','--xsize',metavar='xsize',default=0,type=int,nargs=1,help='resize image x') parser.add_argument('-p','--profile',metavar='profile',default="",type=str,nargs=1,help='profile') parser.add_argument('-o','--output',metavar='output',const=True,default=False,nargs="?",help='output file, if name not specified, default path will be used') args = parser.parse_args() if args.multiple[0] <= 0: #Wrong multiple choice quit() config = readConfig(profile=args.profile) if args.output == True: #Output on but no filename specified fileName = config["saveLocation"]+config["filename"] elif type(args.output) == str: #Output specified fileName = args.output pdfs = list() #Prepare a list for the PDF for ist in range(0,args.multiple[0]): if (args.story == ''): #No story specified story = fetchVign(config) else: story = [] #Story specified for x in args.story: story.append(x) finalStrip = writeStrip(story,config) if args.a4: #Prints a PDF finalStrip = finalStrip.resize((2249,516)) pdfs.append(finalStrip) else: if args.xsize != 0: #Resize specified finalStrip = finalStrip.resize((args.xsize[0],int(args.xsize[0]/2400*500))) if args.multiple[0] == 1: #No multiple selected if args.output == False: finalStrip.show() else: finalStrip.save(fileName) else: #Multiple selected if args.output == False: print(story) else: finalStrip.save(fileName + str(ist).zfill(3) + ".png") if args.a4: ypos = 100 nopage = 0 if args.output == False: print("Output not specified") quit() pagePdf = list() for pag in range(0,int((args.multiple[0]-1)/6+1)): image = Image.new('RGB',(2479,3508),(255,255,255)) fnt = ImageFont.truetype(config["font"],config["fontSize"]) ImageDraw.Draw(image).text((2479 - 500, 3508 - 200),"https://github.com/oloturia/fumcaso",fill="black",font=fnt) pagePdf.append(image) for ist,strip_num in enumerate(range(0,args.multiple[0])): pagePdf[nopage].paste(pdfs[strip_num],box=(110,ypos)) ypos += 516 + 20 if ypos > 3508-569: ypos = 100 nopage += 1 if fileName[len(fileName)-4:] != ".pdf": fileName += ".pdf" pagePdf[0].save(fileName, resolution=300, save_all=True, append_images=pagePdf[1:])
[ 1, 529, 276, 1112, 420, 29958, 568, 29883, 29955, 29947, 29914, 29888, 398, 9398, 29877, 29966, 9507, 29958, 9502, 17010, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29941, 13, 3166, 349, 6227, 1053, 7084, 13, 3166, 349, 6227, 1053, 7084, 9824, 13, 3166, 349, 6227, 1053, 7084, 8537, 13, 5215, 11799, 13, 5215, 4036, 13, 5215, 2897, 13, 5215, 4390, 13, 13, 1445, 9170, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 876, 13, 13, 13, 1753, 5191, 1626, 29898, 726, 29892, 2917, 1125, 13, 12, 15945, 29908, 4013, 740, 5191, 395, 29956, 6227, 12696, 17011, 411, 263, 1734, 1476, 297, 11684, 29889, 7638, 13, 12, 1491, 29879, 29889, 7638, 5023, 338, 29871, 29896, 303, 784, 398, 395, 29956, 6227, 12696, 17011, 29892, 15352, 4341, 29892, 1950, 1819, 313, 305, 7749, 472, 4036, 511, 28552, 338, 2056, 15945, 29908, 13, 12, 2541, 1722, 29898, 2917, 3366, 7638, 6508, 3108, 13578, 12975, 29974, 2917, 3366, 7638, 4035, 29879, 20068, 408, 11684, 29901, 29871, 13, 12, 12, 7638, 6982, 353, 11799, 29889, 16950, 29898, 1491, 29879, 29892, 6144, 19657, 543, 29936, 1159, 29871, 13, 12, 12, 1454, 1948, 297, 11799, 6982, 29901, 13, 12, 12, 12, 361, 1426, 29889, 2886, 29898, 798, 29961, 29900, 2314, 2804, 448, 29896, 29901, 13, 12, 12, 12, 12, 726, 353, 1426, 29889, 6506, 29898, 798, 29961, 29900, 1402, 798, 29961, 8172, 29889, 9502, 524, 29898, 29896, 29892, 2435, 29898, 798, 6817, 29896, 29897, 1402, 29896, 29897, 13, 12, 12, 12, 12, 2457, 1426, 13, 12, 12, 2158, 703, 29925, 1503, 292, 1059, 13218, 17969, 726, 13578, 5931, 451, 1476, 1159, 13, 12, 12, 28358, 580, 13, 13, 1753, 6699, 1626, 29898, 513, 1626, 29892, 2917, 1125, 13, 12, 15945, 29908, 4013, 740, 6699, 278, 1426, 363, 278, 1967, 411, 1023, 4890, 13, 12, 29878, 726, 29889, 7638, 5023, 338, 29901, 29871, 29896, 303, 1897, 278, 1024, 310, 278, 934, 313, 29875, 29889, 29872, 29889, 350, 29900, 29900, 29896, 29889, 2732, 511, 29871, 29906, 299, 1353, 310, 29701, 313, 271, 278, 3256, 13, 12, 19562, 526, 9078, 304, 1023, 29936, 769, 263, 7303, 310, 4341, 470, 1269, 11339, 411, 921, 322, 343, 29311, 310, 278, 6031, 29936, 1156, 278, 1302, 4339, 278, 714, 26807, 29892, 29871, 13, 12, 650, 1897, 363, 1269, 11339, 13, 12, 13157, 19657, 338, 2056, 322, 1196, 1238, 5779, 732, 29892, 565, 727, 9455, 29915, 29873, 738, 3987, 29892, 372, 3639, 29871, 29900, 313, 1217, 1426, 29897, 13, 12, 3112, 3639, 1023, 7049, 29892, 1302, 4339, 338, 263, 18761, 313, 29916, 29892, 29891, 29897, 322, 1121, 338, 278, 21957, 15945, 29908, 13, 12, 2541, 1722, 29898, 2917, 3366, 7638, 6508, 3108, 13578, 12975, 29974, 2917, 3366, 7638, 10649, 5309, 20068, 408, 364, 726, 29901, 13, 12, 12, 7638, 6982, 353, 11799, 29889, 16950, 29898, 29878, 726, 29892, 6144, 19657, 2433, 29936, 1495, 13, 12, 12, 1454, 1948, 297, 11799, 6982, 29901, 13, 12, 12, 12, 361, 1948, 29961, 29900, 29962, 1360, 513, 1626, 29901, 13, 12, 12, 12, 12, 1217, 2865, 943, 353, 938, 29898, 798, 29961, 29896, 2314, 13, 12, 12, 12, 12, 361, 694, 2865, 943, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 12, 12, 2457, 29871, 29900, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 4102, 2642, 353, 29871, 29906, 17108, 1217, 2865, 943, 29930, 29906, 29897, 13, 12, 12, 12, 12, 12, 4230, 2642, 353, 7431, 29898, 798, 6817, 29898, 1217, 2865, 943, 29899, 29896, 29897, 13, 12, 12, 12, 12, 12, 9502, 2182, 866, 353, 4036, 29889, 9502, 3881, 29898, 4102, 2642, 29892, 4230, 2642, 29892, 1217, 2865, 943, 29897, 13, 12, 12, 12, 12, 12, 1111, 4339, 353, 5159, 13, 12, 12, 12, 12, 12, 2914, 353, 5159, 13, 12, 12, 12, 12, 12, 1454, 921, 297, 3464, 29898, 29900, 29892, 1217, 2865, 943, 1125, 13, 12, 12, 12, 12, 12, 12, 1111, 4339, 29889, 4397, 3552, 798, 29961, 29906, 29974, 29916, 29930, 29906, 1402, 798, 29961, 29941, 29974, 29916, 29930, 29906, 12622, 13, 12, 12, 12, 12, 12, 12, 2914, 29889, 4397, 29898, 798, 29961, 9502, 2182, 866, 29974, 29916, 2314, 13, 12, 12, 12, 12, 12, 2457, 1302, 4339, 29892, 2914, 13, 13, 12, 12, 12, 12, 13, 1753, 6699, 29963, 647, 29898, 2917, 1125, 13, 12, 15945, 29908, 4013, 3168, 6699, 385, 1967, 29892, 20459, 29892, 10434, 515, 263, 2791, 586, 5447, 3342, 297, 13472, 29889, 7638, 13, 12, 2572, 29889, 7638, 5023, 338, 29901, 29871, 29896, 303, 1897, 278, 1024, 310, 278, 1967, 313, 14037, 6081, 511, 15352, 4341, 29892, 1950, 714, 26807, 10434, 20459, 13, 12, 3112, 3639, 385, 1409, 411, 278, 934, 2983, 15945, 29908, 13, 12, 27382, 353, 5159, 13, 12, 2962, 7854, 353, 5159, 13, 12, 29876, 29894, 647, 353, 29871, 29900, 13, 12, 21962, 29963, 647, 353, 376, 29900, 29900, 29900, 29908, 13, 12, 24098, 353, 5159, 13, 12, 2541, 1722, 29898, 2917, 3366, 7638, 6508, 3108, 13578, 12975, 29974, 2917, 3366, 7638, 9643, 20068, 408, 13472, 29901, 13, 12, 12, 7638, 6982, 353, 11799, 29889, 16950, 29898, 2572, 29897, 13, 12, 12, 1454, 1948, 297, 11799, 6982, 29901, 13, 12, 12, 12, 27382, 29889, 4397, 29898, 798, 29961, 29900, 2314, 13, 12, 12, 12, 2962, 7854, 29889, 4397, 29898, 798, 29897, 13, 12, 8000, 302, 29894, 647, 529, 29896, 29900, 29900, 29901, 13, 12, 12, 24098, 29889, 4397, 29898, 2962, 7854, 29961, 27382, 29889, 2248, 29898, 21962, 29963, 647, 29897, 3816, 8172, 29889, 9502, 524, 29898, 29896, 29892, 2435, 29898, 2962, 7854, 29961, 27382, 29889, 2248, 29898, 21962, 29963, 647, 29897, 2314, 29899, 29896, 29897, 2314, 13, 12, 12, 21962, 29963, 647, 353, 5828, 29961, 29876, 29894, 647, 29962, 13, 12, 12, 361, 16256, 29963, 647, 1275, 376, 11794, 1115, 13, 12, 12, 12, 2457, 5828, 13, 12, 12, 24098, 29961, 29876, 29894, 647, 10062, 29569, 2732, 29908, 13, 12, 12, 29876, 29894, 647, 4619, 29896, 13, 12, 2158, 703, 8336, 411, 694, 11056, 1159, 13, 12, 28358, 580, 13, 12, 12, 13, 1753, 788, 1349, 292, 29898, 513, 29963, 647, 29892, 2917, 1125, 13, 12, 15945, 29908, 4013, 740, 12778, 263, 2319, 1967, 313, 3318, 29897, 304, 263, 7200, 1967, 13, 12, 5415, 29889, 7638, 5023, 338, 29901, 1024, 310, 278, 1967, 313, 29875, 29889, 29872, 29889, 319, 29900, 29900, 29896, 29889, 2732, 511, 921, 29899, 1111, 536, 29892, 343, 29899, 1111, 536, 29892, 15352, 4341, 1950, 714, 26807, 13, 12, 3112, 3639, 263, 18761, 313, 3318, 934, 1024, 29892, 921, 29892, 343, 5513, 15945, 13, 12, 2541, 1722, 29898, 2917, 3366, 7638, 6508, 3108, 13578, 12975, 29974, 2917, 3366, 7638, 9930, 20068, 408, 5446, 29901, 13, 12, 12, 7638, 6982, 353, 11799, 29889, 16950, 29898, 5415, 29897, 13, 12, 12, 1454, 1948, 297, 11799, 6982, 29901, 13, 12, 12, 12, 361, 1948, 29961, 29900, 29962, 1275, 1399, 29963, 647, 29901, 13, 12, 12, 12, 12, 2457, 1948, 29961, 8172, 29889, 9502, 524, 29898, 29941, 29892, 2435, 29898, 798, 6817, 29896, 29897, 1402, 798, 29961, 29896, 1402, 798, 29961, 29906, 29962, 13, 12, 12, 2457, 29871, 29900, 13, 13, 1753, 2436, 855, 6472, 29898, 24098, 29892, 2917, 1125, 13, 12, 15945, 29908, 4013, 740, 10017, 278, 17820, 7863, 385, 1967, 1203, 393, 1033, 367, 7160, 470, 24774, 29889, 739, 4893, 385, 1409, 411, 977, 264, 1280, 408, 3443, 13, 12, 1576, 937, 1967, 338, 2337, 29871, 29900, 29900, 29900, 29892, 769, 623, 1975, 304, 17820, 278, 2066, 29892, 769, 10200, 1078, 372, 6699, 292, 1426, 322, 4417, 3618, 29889, 960, 278, 1203, 338, 385, 390, 29892, 769, 13, 12, 276, 412, 1446, 278, 1833, 1203, 1213, 15945, 13, 12, 17010, 353, 5159, 13, 12, 1454, 1399, 29963, 647, 297, 5828, 29901, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 29894, 647, 353, 7084, 29889, 3150, 29898, 2917, 3366, 8346, 6508, 3108, 13578, 12975, 29974, 513, 29963, 647, 467, 13441, 877, 29934, 29954, 5688, 1495, 13, 12, 12, 12, 1202, 726, 353, 7084, 8537, 29889, 8537, 29898, 29894, 647, 29897, 13, 12, 12, 12, 29888, 593, 353, 7084, 9824, 29889, 509, 14484, 668, 29898, 2917, 3366, 5657, 12436, 2917, 3366, 5657, 3505, 20068, 13, 12, 12, 12, 726, 29963, 647, 353, 6699, 1626, 29898, 513, 29963, 647, 29892, 2917, 29897, 13, 12, 12, 12, 13, 12, 12, 12, 361, 1426, 29963, 647, 19216, 29900, 29901, 13, 12, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 12, 1454, 921, 297, 3464, 29898, 2435, 29898, 726, 29963, 647, 29961, 29900, 12622, 29901, 13, 12, 12, 12, 12, 12, 12, 726, 29918, 29894, 647, 353, 1426, 29963, 647, 29961, 29896, 3816, 29916, 29962, 13, 12, 12, 12, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 8000, 1426, 29918, 29894, 647, 29889, 2886, 877, 29938, 1495, 2804, 448, 29896, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 726, 29918, 29894, 647, 353, 5191, 1626, 29898, 726, 29918, 29894, 647, 29892, 2917, 29897, 13, 12, 12, 12, 12, 12, 12, 19499, 23833, 2392, 408, 4589, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 703, 26604, 13755, 29901, 1159, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 726, 29963, 647, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 3127, 29897, 13, 12, 12, 12, 12, 12, 12, 12, 28358, 580, 13, 12, 12, 12, 12, 12, 12, 726, 29918, 29894, 647, 353, 1426, 29918, 29894, 647, 29889, 6506, 877, 29992, 3788, 29905, 29876, 1495, 13, 12, 12, 12, 12, 12, 12, 1202, 726, 29889, 4713, 309, 457, 29918, 726, 3552, 524, 29898, 726, 29963, 647, 29961, 29900, 3816, 29916, 3816, 29900, 11724, 524, 29898, 726, 29963, 647, 29961, 29900, 3816, 29916, 3816, 29896, 2314, 511, 726, 29918, 29894, 647, 29892, 5589, 9880, 29900, 29900, 29900, 29900, 29900, 29900, 613, 5657, 29922, 29888, 593, 29892, 2520, 543, 5064, 1159, 13, 12, 12, 12, 12, 19499, 20948, 29901, 13, 12, 12, 12, 12, 12, 2158, 703, 26604, 9138, 1426, 363, 29901, 1159, 13, 12, 12, 12, 12, 12, 2158, 29898, 513, 29963, 647, 29897, 13, 12, 12, 12, 12, 12, 28358, 580, 13, 12, 12, 12, 12, 12, 13, 12, 12, 12, 5415, 353, 788, 1349, 292, 29898, 513, 29963, 647, 29892, 2917, 29897, 13, 12, 12, 12, 361, 5446, 19216, 29900, 29901, 13, 12, 12, 12, 12, 361, 5446, 29961, 29900, 29962, 1275, 525, 29934, 2396, 13, 12, 12, 12, 12, 12, 5415, 25518, 353, 7084, 29889, 3150, 29898, 2917, 3366, 8346, 6508, 3108, 13578, 12975, 29974, 16304, 9930, 29961, 29900, 2314, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 16304, 9930, 353, 5446, 13, 12, 12, 12, 12, 12, 5415, 25518, 353, 7084, 29889, 3150, 29898, 2917, 3366, 8346, 6508, 3108, 13578, 12975, 29974, 5415, 29961, 29900, 2314, 13, 12, 12, 12, 12, 29894, 647, 29889, 16179, 29898, 5415, 25518, 22657, 524, 29898, 5415, 29961, 29896, 11724, 524, 29898, 5415, 29961, 29906, 29962, 4961, 13, 12, 12, 12, 17010, 29889, 4397, 29898, 29894, 647, 29897, 13, 12, 12, 19499, 3497, 17413, 2392, 29901, 13, 12, 12, 12, 3364, 13, 12, 3027, 353, 7084, 29889, 1482, 877, 29934, 29954, 5688, 742, 29898, 2917, 3366, 29916, 3505, 12436, 2917, 3366, 29891, 3505, 3108, 876, 13, 12, 29916, 10889, 29922, 29900, 13, 12, 1454, 325, 647, 297, 17820, 29901, 13, 12, 12, 3027, 29889, 16179, 29898, 29894, 647, 22657, 29916, 10889, 29892, 29900, 876, 13, 12, 12, 29916, 10889, 4619, 2295, 3366, 15119, 6513, 3108, 13, 12, 2940, 8537, 29889, 8537, 29898, 3027, 467, 1621, 2521, 4197, 29900, 29892, 29900, 29892, 2917, 3366, 29916, 3505, 3108, 29899, 29896, 29892, 2917, 3366, 29891, 3505, 3108, 29899, 29896, 1402, 5445, 29922, 8516, 29892, 27887, 543, 8517, 613, 2920, 29922, 29896, 29897, 13, 12, 2457, 1967, 13, 13, 1753, 1653, 855, 6472, 29898, 2917, 29892, 18732, 21889, 13776, 1125, 13, 12, 15945, 29908, 4391, 17820, 322, 4078, 372, 13, 12, 3258, 855, 6472, 29898, 710, 2224, 29914, 9507, 5513, 15945, 13, 13, 12, 2202, 29901, 13, 12, 12, 24098, 353, 6699, 29963, 647, 29898, 2917, 29897, 13, 12, 12, 8394, 855, 6472, 353, 2436, 855, 6472, 29898, 24098, 29892, 2917, 29897, 13, 12, 12, 361, 4266, 21889, 1275, 376, 2843, 1115, 13, 12, 12, 12, 2457, 2186, 855, 6472, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 8394, 855, 6472, 29889, 7620, 29898, 2917, 3366, 7620, 6508, 3108, 29974, 2917, 3366, 9507, 20068, 13, 12, 12, 12, 2457, 29871, 29900, 13, 12, 19499, 8960, 408, 4589, 29901, 13, 12, 12, 2457, 4589, 13, 13, 1753, 1303, 3991, 29898, 10185, 29922, 8824, 29892, 12120, 29922, 8824, 1125, 13, 12, 15945, 29908, 6359, 5285, 934, 15945, 29908, 13, 12, 2202, 29901, 13, 12, 12, 2541, 1722, 29898, 1445, 9170, 13578, 29914, 2917, 29889, 3126, 1159, 408, 285, 29901, 13, 12, 12, 12, 2917, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 12, 19499, 10663, 2392, 29901, 13, 12, 12, 2158, 703, 2917, 29889, 3126, 451, 1476, 1159, 13, 12, 12, 2457, 7700, 13, 12, 361, 451, 29898, 10185, 1125, 13, 12, 12, 10185, 353, 2295, 3366, 4381, 13909, 3108, 13, 12, 2870, 29901, 13, 12, 12, 10185, 353, 8722, 29961, 29900, 29962, 13, 12, 2202, 29901, 13, 12, 12, 3198, 13909, 353, 2295, 29961, 10185, 29962, 13, 12, 19499, 7670, 2392, 29901, 13, 12, 12, 2158, 703, 13909, 15691, 10185, 13578, 451, 1476, 1159, 13, 12, 12, 28358, 580, 13, 12, 7620, 6508, 353, 1423, 7717, 29898, 2917, 29961, 10185, 29962, 3366, 7620, 6508, 20068, 13, 12, 8346, 6508, 353, 1423, 7717, 29898, 2917, 29961, 10185, 29962, 3366, 8346, 6508, 20068, 13, 12, 7638, 6508, 353, 1423, 7717, 29898, 2917, 29961, 10185, 29962, 3366, 7638, 6508, 20068, 13, 12, 7638, 9643, 353, 2295, 29961, 10185, 29962, 3366, 7638, 9643, 3108, 13, 12, 7638, 10649, 5309, 353, 2295, 29961, 10185, 29962, 3366, 7638, 10649, 5309, 3108, 13, 12, 7638, 4035, 29879, 353, 2295, 29961, 10185, 29962, 3366, 7638, 4035, 29879, 3108, 13, 12, 7638, 9930, 353, 2295, 29961, 10185, 29962, 3366, 7638, 9930, 3108, 13, 12, 5657, 353, 1423, 7717, 29898, 2917, 29961, 10185, 29962, 3366, 5657, 20068, 13, 12, 5657, 3505, 353, 938, 3552, 2917, 29961, 10185, 29962, 3366, 5657, 3505, 3108, 876, 13, 12, 29916, 3505, 353, 2295, 29961, 10185, 29962, 3366, 29916, 3505, 3108, 13, 12, 29891, 3505, 353, 2295, 29961, 10185, 29962, 3366, 29891, 3505, 3108, 13, 12, 15119, 6513, 353, 2295, 29961, 10185, 29962, 3366, 15119, 6513, 3108, 13, 12, 361, 7481, 29901, 13, 12, 12, 6979, 353, 1423, 7717, 29898, 2917, 29961, 10185, 3816, 12120, 29962, 3366, 6979, 20068, 13, 12, 12, 9507, 353, 1423, 7717, 29898, 2917, 29961, 10185, 3816, 12120, 29962, 3366, 9507, 20068, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 726, 353, 2295, 29961, 10185, 3816, 12120, 29962, 3366, 726, 3108, 13, 12, 12, 19499, 7670, 2392, 29901, 13, 12, 12, 12, 726, 353, 7700, 13, 12, 12, 13, 12, 12, 2457, 8853, 7620, 6508, 1115, 7620, 6508, 1699, 8346, 6508, 1115, 8346, 6508, 1699, 7638, 6508, 1115, 7638, 6508, 1699, 5657, 3505, 1115, 5657, 3505, 1699, 5657, 1115, 5657, 1699, 6979, 1115, 6979, 1699, 9507, 1115, 9507, 1699, 29916, 3505, 1115, 29916, 3505, 1699, 29891, 3505, 1115, 29891, 3505, 1699, 15119, 6513, 1115, 15119, 6513, 1699, 7638, 9643, 1115, 7638, 9643, 1699, 7638, 10649, 5309, 1115, 7638, 10649, 5309, 1699, 7638, 4035, 29879, 1115, 7638, 4035, 29879, 1699, 7638, 9930, 1115, 7638, 9930, 1699, 726, 1115, 726, 29913, 13, 12, 9507, 353, 2295, 29961, 10185, 29962, 3366, 9507, 3108, 13, 12, 2457, 8853, 7620, 6508, 1115, 7620, 6508, 1699, 8346, 6508, 1115, 8346, 6508, 1699, 7638, 6508, 1115, 7638, 6508, 1699, 5657, 3505, 1115, 5657, 3505, 1699, 5657, 1115, 5657, 1699, 9507, 1115, 9507, 1699, 29916, 3505, 1115, 29916, 3505, 1699, 29891, 3505, 1115, 29891, 3505, 1699, 15119, 6513, 1115, 15119, 6513, 1699, 7638, 9643, 1115, 7638, 9643, 1699, 7638, 10649, 5309, 1115, 7638, 10649, 5309, 1699, 7638, 4035, 29879, 1115, 7638, 4035, 29879, 1699, 7638, 9930, 1115, 7638, 9930, 29913, 13, 12, 12, 13, 1753, 1423, 7717, 29898, 12322, 1125, 13, 12, 15945, 29908, 5596, 29879, 565, 372, 29915, 29879, 263, 6198, 470, 8380, 2224, 15945, 29908, 13, 12, 361, 3884, 29961, 29900, 29962, 1275, 11393, 1115, 13, 12, 12, 2457, 934, 9170, 718, 3884, 29961, 29896, 17531, 13, 12, 2870, 29901, 13, 12, 12, 2457, 3884, 13, 12, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 5215, 1852, 5510, 13, 13, 13, 12, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29879, 3788, 489, 24098, 742, 2527, 485, 279, 2433, 24098, 742, 4381, 2433, 742, 29876, 5085, 29922, 29946, 29892, 8477, 2433, 978, 310, 278, 4558, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29874, 3788, 489, 29874, 29946, 742, 4381, 29922, 8824, 29892, 2467, 2433, 8899, 29918, 3009, 742, 8477, 2433, 2158, 373, 385, 319, 29946, 297, 11328, 29892, 4225, 448, 29877, 1962, 29892, 766, 1849, 448, 29916, 921, 2311, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29885, 3788, 489, 20787, 742, 2527, 485, 279, 2433, 20787, 742, 4381, 11759, 29896, 1402, 29876, 5085, 29922, 29896, 29892, 1853, 29922, 524, 29892, 8477, 2433, 20787, 1962, 313, 524, 1405, 29900, 511, 565, 694, 1962, 448, 29877, 6790, 29892, 372, 925, 6987, 278, 15874, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29916, 3788, 489, 29916, 2311, 742, 2527, 485, 279, 2433, 29916, 2311, 742, 4381, 29922, 29900, 29892, 1853, 29922, 524, 29892, 29876, 5085, 29922, 29896, 29892, 8477, 2433, 21476, 1967, 921, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29886, 3788, 489, 10185, 742, 2527, 485, 279, 2433, 10185, 742, 4381, 543, 613, 1853, 29922, 710, 29892, 29876, 5085, 29922, 29896, 29892, 8477, 2433, 10185, 1495, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29877, 3788, 489, 4905, 742, 2527, 485, 279, 2433, 4905, 742, 3075, 29922, 5574, 29892, 4381, 29922, 8824, 29892, 29876, 5085, 543, 29973, 613, 8477, 2433, 4905, 934, 29892, 565, 1024, 451, 6790, 29892, 2322, 2224, 674, 367, 1304, 1495, 13, 12, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 12, 13, 12, 361, 6389, 29889, 20787, 29961, 29900, 29962, 5277, 29871, 29900, 29901, 12, 12, 12, 29937, 29956, 29373, 2999, 7348, 13, 12, 12, 28358, 580, 13, 12, 2917, 353, 1303, 3991, 29898, 10185, 29922, 5085, 29889, 10185, 29897, 13, 12, 12, 13, 12, 361, 6389, 29889, 4905, 1275, 5852, 29901, 12, 12, 12, 12, 29937, 6466, 373, 541, 694, 10422, 6790, 13, 12, 12, 28926, 353, 2295, 3366, 7620, 6508, 3108, 29974, 2917, 3366, 9507, 3108, 13, 12, 23681, 1134, 29898, 5085, 29889, 4905, 29897, 1275, 851, 29901, 12, 12, 29937, 6466, 6790, 13, 12, 12, 12, 28926, 353, 6389, 29889, 4905, 13, 13, 13, 12, 5140, 29879, 353, 1051, 580, 29871, 12, 12, 12, 12, 12, 12, 29937, 29925, 3445, 598, 263, 1051, 363, 278, 11328, 13, 12, 12, 13, 12, 1454, 1752, 297, 3464, 29898, 29900, 29892, 5085, 29889, 20787, 29961, 29900, 29962, 1125, 13, 12, 12, 361, 313, 5085, 29889, 24098, 1275, 6629, 1125, 12, 12, 12, 29937, 3782, 5828, 6790, 13, 12, 12, 12, 24098, 353, 6699, 29963, 647, 29898, 2917, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 24098, 353, 5159, 12, 12, 12, 12, 12, 29937, 29359, 6790, 13, 12, 12, 12, 1454, 921, 297, 6389, 29889, 24098, 29901, 13, 12, 12, 12, 12, 24098, 29889, 4397, 29898, 29916, 29897, 13, 12, 12, 8394, 855, 6472, 353, 2436, 855, 6472, 29898, 24098, 29892, 2917, 29897, 13, 12, 12, 13, 12, 12, 361, 6389, 29889, 29874, 29946, 29901, 12, 12, 12, 12, 12, 12, 29937, 4040, 9466, 263, 11328, 13, 12, 12, 12, 8394, 855, 6472, 353, 2186, 855, 6472, 29889, 21476, 3552, 29906, 29906, 29946, 29929, 29892, 29945, 29896, 29953, 876, 13, 12, 12, 12, 5140, 29879, 29889, 4397, 29898, 8394, 855, 6472, 29897, 13, 12, 12, 2870, 29901, 12, 12, 12, 12, 12, 12, 12, 13, 12, 12, 12, 361, 6389, 29889, 29916, 2311, 2804, 29871, 29900, 29901, 12, 12, 12, 29937, 1666, 675, 6790, 13, 12, 12, 12, 12, 8394, 855, 6472, 353, 2186, 855, 6472, 29889, 21476, 3552, 5085, 29889, 29916, 2311, 29961, 29900, 1402, 524, 29898, 5085, 29889, 29916, 2311, 29961, 29900, 16261, 29906, 29946, 29900, 29900, 29930, 29945, 29900, 29900, 4961, 13, 12, 12, 12, 12, 13, 12, 12, 12, 13, 12, 12, 12, 361, 6389, 29889, 20787, 29961, 29900, 29962, 1275, 29871, 29896, 29901, 12, 29937, 3782, 2999, 4629, 13, 12, 12, 12, 12, 361, 6389, 29889, 4905, 1275, 7700, 29901, 13, 12, 12, 12, 12, 12, 8394, 855, 6472, 29889, 4294, 580, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 8394, 855, 6472, 29889, 7620, 29898, 28926, 29897, 13, 12, 12, 12, 2870, 29901, 12, 12, 12, 12, 12, 12, 29937, 15329, 552, 4629, 13, 12, 12, 12, 12, 361, 6389, 29889, 4905, 1275, 7700, 29901, 13, 12, 12, 12, 12, 12, 2158, 29898, 24098, 29897, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 8394, 855, 6472, 29889, 7620, 29898, 28926, 718, 851, 29898, 391, 467, 29920, 5589, 29898, 29941, 29897, 718, 11393, 2732, 1159, 13, 12, 13, 12, 361, 6389, 29889, 29874, 29946, 29901, 13, 12, 12, 29891, 1066, 353, 29871, 29896, 29900, 29900, 13, 12, 12, 29876, 459, 482, 353, 29871, 29900, 13, 12, 12, 361, 6389, 29889, 4905, 1275, 7700, 29901, 13, 12, 12, 12, 2158, 703, 6466, 451, 6790, 1159, 13, 12, 12, 12, 28358, 580, 13, 12, 12, 12, 13, 12, 12, 3488, 29925, 2176, 353, 1051, 580, 13, 12, 12, 1454, 10203, 297, 3464, 29898, 29900, 29892, 524, 3552, 5085, 29889, 20787, 29961, 29900, 29962, 29899, 29896, 6802, 29953, 29974, 29896, 22164, 13, 12, 12, 12, 3027, 353, 7084, 29889, 1482, 877, 28212, 742, 29898, 29906, 29946, 29955, 29929, 29892, 29941, 29945, 29900, 29947, 21336, 29906, 29945, 29945, 29892, 29906, 29945, 29945, 29892, 29906, 29945, 29945, 876, 13, 12, 12, 12, 29888, 593, 353, 7084, 9824, 29889, 509, 14484, 668, 29898, 2917, 3366, 5657, 12436, 2917, 3366, 5657, 3505, 20068, 13, 12, 12, 12, 2940, 8537, 29889, 8537, 29898, 3027, 467, 726, 3552, 29906, 29946, 29955, 29929, 448, 29871, 29945, 29900, 29900, 29892, 29871, 29941, 29945, 29900, 29947, 448, 29871, 29906, 29900, 29900, 511, 29908, 991, 597, 3292, 29889, 510, 29914, 324, 327, 26607, 29914, 29888, 398, 9398, 29877, 613, 5589, 543, 8517, 613, 5657, 29922, 29888, 593, 29897, 13, 12, 12, 12, 3488, 29925, 2176, 29889, 4397, 29898, 3027, 29897, 13, 12, 12, 12, 13, 12, 12, 1454, 1752, 29892, 17010, 29918, 1949, 297, 26985, 29898, 3881, 29898, 29900, 29892, 5085, 29889, 20787, 29961, 29900, 12622, 29901, 13, 12, 12, 12, 3488, 29925, 2176, 29961, 29876, 459, 482, 1822, 16179, 29898, 5140, 29879, 29961, 17010, 29918, 1949, 1402, 1884, 7607, 29896, 29896, 29900, 29892, 29891, 1066, 876, 13, 12, 12, 12, 29891, 1066, 4619, 29871, 29945, 29896, 29953, 718, 29871, 29906, 29900, 13, 12, 12, 12, 361, 343, 1066, 1405, 29871, 29941, 29945, 29900, 29947, 29899, 29945, 29953, 29929, 29901, 13, 12, 12, 12, 12, 29891, 1066, 353, 29871, 29896, 29900, 29900, 13, 12, 12, 12, 12, 29876, 459, 482, 4619, 29871, 29896, 13, 12, 12, 361, 29729, 29961, 2435, 29898, 28926, 6817, 29946, 17531, 2804, 11393, 5140, 1115, 13, 12, 12, 12, 12, 28926, 4619, 11393, 5140, 29908, 13, 12, 12, 3488, 29925, 2176, 29961, 29900, 1822, 7620, 29898, 28926, 29892, 10104, 29922, 29941, 29900, 29900, 29892, 4078, 29918, 497, 29922, 5574, 29892, 9773, 29918, 8346, 29922, 3488, 29925, 2176, 29961, 29896, 29901, 2314, 13, 2 ]
mass/tensorflow_nets/naive-fusion/naive_fusion_net.py
pquochuy/xsleepnet
15
129514
import tensorflow as tf from nn_basic_layers import * from filterbank_shape import FilterbankShape from ops import * class Naive_Fusion_Net(object): def __init__(self, config): # Placeholders for input, output and dropout self.config = config self.input_x1 = tf.placeholder(tf.float32,shape=[None, self.config.epoch_seq_len, self.config.deep_ntime, self.config.nchannel],name='input_x1') self.input_x2 = tf.placeholder(tf.float32, [None, self.config.epoch_seq_len, self.config.seq_frame_seq_len, self.config.seq_ndim, self.config.nchannel], name="input_x2") self.input_y = tf.placeholder(tf.float32, [None, self.config.epoch_seq_len, self.config.nclass], name="input_y") self.dropout_rnn = tf.placeholder(tf.float32, name="dropout_rnn") self.dropout_cnn = tf.placeholder(tf.float32, name="dropout_cnn") self.istraining = tf.placeholder(tf.bool, name='istraining') # idicate training for batch normmalization self.seq_frame_seq_len = tf.placeholder(tf.int32, [None]) # for the dynamic RNN self.epoch_seq_len = tf.placeholder(tf.int32, [None]) # for the dynamic RNN self.construct_fcnnrnn_net() self.construct_seqsleepnet() self.score = [] self.prediction = [] with tf.variable_scope("output_layer"): for i in range(self.config.epoch_seq_len): score_i = fc(tf.concat([tf.squeeze(self.deep_rnn_out[:,i,:]), tf.squeeze(self.seq_rnn_out2[:,i,:])], 1), self.config.seq_nhidden2 * 2 + self.config.deep_nhidden * 2, self.config.nclass, name="joint_output", relu=False) pred_i = tf.argmax(score_i, 1, name="pred-%s" % i) self.score.append(score_i) self.prediction.append(pred_i) self.output_loss = 0 with tf.name_scope("output-loss"): for i in range(self.config.epoch_seq_len): loss_i = tf.nn.softmax_cross_entropy_with_logits(labels=tf.squeeze(self.input_y[:,i,:]), logits=self.score[i]) loss_i = tf.reduce_sum(loss_i, axis=[0]) self.output_loss += loss_i self.output_loss = self.output_loss/self.config.epoch_seq_len # average over sequence length self.accuracy = [] with tf.name_scope("accuracy"): for i in range(self.config.epoch_seq_len): correct_prediction_i = tf.equal(self.prediction[i], tf.argmax(tf.squeeze(self.input_y[:,i,:]), 1)) accuracy_i = tf.reduce_mean(tf.cast(correct_prediction_i, "float"), name="accuracy-%s" % i) self.accuracy.append(accuracy_i) # add on regularization except for the filter bank layers with tf.name_scope("l2_loss"): vars = tf.trainable_variables() except_vars_eeg = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='seq_filterbank-layer-eeg') except_vars_eog = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='seq_filterbank-layer-eog') except_vars_emg = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='seq_filterbank-layer-emg') l2_loss = tf.add_n([ tf.nn.l2_loss(v) for v in vars if v not in except_vars_eeg and v not in except_vars_eog and v not in except_vars_emg]) self.loss = self.output_loss + self.config.l2_reg_lambda*l2_loss ############################################################# # Construct fcnnrnn here ############################################################# def construct_fcnnrnn_net(self): self.g_enc_depths = [16, 16, 32, 32, 64, 64, 128, 128, 256] deep_X = tf.reshape(self.input_x1, [-1, self.config.deep_ntime, self.config.nchannel]) with tf.device('/gpu:0'), tf.variable_scope("deep_all_cnn_layer") as scope: deep_cnn_feat = self.all_convolution_block(deep_X,"all_conv_block") deep_num_cnn_feat = 6*self.g_enc_depths[-1] deep_cnn_feat = tf.reshape(deep_cnn_feat, [-1, deep_num_cnn_feat]) print("deep_cnn_feat") print(deep_cnn_feat.get_shape()) deep_rnn_input = tf.reshape(deep_cnn_feat, [-1, self.config.epoch_seq_len, deep_num_cnn_feat]) # bidirectional sequence-level recurrent layer with tf.device('/gpu:0'), tf.variable_scope("deep_epoch_rnn_layer") as scope: deep_fw_cell, deep_bw_cell = bidirectional_recurrent_layer(self.config.deep_nhidden, self.config.deep_nlayer, input_keep_prob=self.dropout_rnn, output_keep_prob=self.dropout_rnn) self.deep_rnn_out, self.deep_rnn_state = bidirectional_recurrent_layer_output(deep_fw_cell, deep_bw_cell, deep_rnn_input, self.epoch_seq_len, scope=scope) print(self.deep_rnn_out.get_shape()) ############################################################# # End deepsleepnet here ############################################################# ############################################################# # Construct seqsleepnet here ############################################################# def construct_seqsleepnet(self): filtershape = FilterbankShape() #triangular filterbank self.Wbl = tf.constant(filtershape.lin_tri_filter_shape(nfilt=self.config.seq_nfilter, nfft=self.config.seq_nfft, samplerate=self.config.seq_samplerate, lowfreq=self.config.seq_lowfreq, highfreq=self.config.seq_highfreq), dtype=tf.float32, name="W-filter-shape-eeg") with tf.device('/gpu:0'), tf.variable_scope("seq_filterbank-layer-eeg"): # Temporarily crush the feature_mat's dimensions Xeeg = tf.reshape(tf.squeeze(self.input_x2[:,:,:,:,0]), [-1, self.config.seq_ndim]) # first filter bank layer self.Weeg = tf.Variable(tf.random_normal([self.config.seq_ndim, self.config.seq_nfilter],dtype=tf.float32)) # non-negative constraints self.Weeg = tf.sigmoid(self.Weeg) # mask matrix should be replaced by shape-specific filter bank, e.g. triangular,rectangle. self.Wfb = tf.multiply(self.Weeg,self.Wbl) HWeeg = tf.matmul(Xeeg, self.Wfb) # filtering HWeeg = tf.reshape(HWeeg, [-1, self.config.epoch_seq_len, self.config.seq_frame_seq_len, self.config.seq_nfilter]) if(self.config.nchannel > 1): with tf.device('/gpu:0'), tf.variable_scope("seq_filterbank-layer-eog"): # Temporarily crush the feature_mat's dimensions Xeog = tf.reshape(tf.squeeze(self.input_x2[:,:,:,:,1]), [-1, self.config.seq_ndim]) # first filter bank layer self.Weog = tf.Variable(tf.random_normal([self.config.seq_ndim, self.config.seq_nfilter],dtype=tf.float32)) # non-negative constraints self.Weog = tf.sigmoid(self.Weog) # mask matrix should be replaced by shape-specific filter bank, e.g. triangular,rectangle. self.Wfb = tf.multiply(self.Weog,self.Wbl) HWeog = tf.matmul(Xeog, self.Wfb) # filtering HWeog = tf.reshape(HWeog, [-1, self.config.epoch_seq_len, self.config.seq_frame_seq_len, self.config.seq_nfilter]) if(self.config.nchannel > 2): with tf.device('/gpu:0'), tf.variable_scope("seq_filterbank-layer-emg"): # Temporarily crush the feature_mat's dimensions Xemg = tf.reshape(tf.squeeze(self.input_x2[:,:,:,:,2]), [-1, self.config.seq_ndim]) # first filter bank layer self.Wemg = tf.Variable(tf.random_normal([self.config.seq_ndim, self.config.seq_nfilter],dtype=tf.float32)) # non-negative constraints self.Wemg = tf.sigmoid(self.Wemg) # mask matrix should be replaced by shape-specific filter bank, e.g. triangular,rectangle. self.Wfb = tf.multiply(self.Wemg,self.Wbl) HWemg = tf.matmul(Xemg, self.Wfb) # filtering HWemg = tf.reshape(HWemg, [-1, self.config.epoch_seq_len, self.config.seq_frame_seq_len, self.config.seq_nfilter]) if(self.config.nchannel > 2): X2 = tf.concat([HWeeg, HWeog, HWemg], axis = 3) elif(self.config.nchannel > 1): X2 = tf.concat([HWeeg, HWeog], axis = 3) else: X2 = HWeeg X2 = tf.reshape(X2, [-1, self.config.seq_frame_seq_len, self.config.seq_nfilter*self.config.nchannel]) # bidirectional epoch-level recurrent layer with tf.variable_scope("seq_frame_rnn_layer") as scope: seq_fw_cell1, seq_bw_cell1 = bidirectional_recurrent_layer_bn(self.config.seq_nhidden1, self.config.seq_nlayer1, seq_len=self.config.seq_frame_seq_len, is_training=self.istraining, input_keep_prob=self.dropout_rnn, # we have dropouted in the convolutional layer output_keep_prob=self.dropout_rnn) seq_rnn_out1, seq_rnn_state1 = bidirectional_recurrent_layer_output(seq_fw_cell1, seq_bw_cell1, X2, self.seq_frame_seq_len, scope=scope) print(seq_rnn_out1.get_shape()) with tf.variable_scope("seq_frame_attention_layer"): self.seq_attention_out1, _ = attention(seq_rnn_out1, self.config.seq_attention_size1) print(self.seq_attention_out1.get_shape()) seq_e_rnn_input = tf.reshape(self.seq_attention_out1, [-1, self.config.epoch_seq_len, self.config.seq_nhidden1*2]) # bidirectional seq-level recurrent layer with tf.variable_scope("seq_epoch_rnn_layer") as scope: seq_fw_cell2, seq_bw_cell2 = bidirectional_recurrent_layer_bn(self.config.seq_nhidden2, self.config.seq_nlayer2, seq_len=self.config.epoch_seq_len, is_training=self.istraining, input_keep_prob=self.dropout_rnn, # we have dropouted the output of frame-wise rnn output_keep_prob=self.dropout_rnn) self.seq_rnn_out2, self.seq_rnn_state2 = bidirectional_recurrent_layer_output(seq_fw_cell2, seq_bw_cell2, seq_e_rnn_input, self.epoch_seq_len, scope=scope) print(self.seq_rnn_out2.get_shape()) ############################################################# # End seqsleepnet ############################################################ def all_convolution_block(self, input, name): in_dims = input.get_shape().as_list() print(in_dims) h_i = input if len(in_dims) == 2: h_i = tf.expand_dims(input, -1) elif len(in_dims) < 2 or len(in_dims) > 3: raise ValueError('Generator input must be 2-D or 3-D') kwidth = 31 with tf.variable_scope(name, reuse=tf.AUTO_REUSE) as scope: for layer_idx, layer_depth in enumerate(self.g_enc_depths): bias_init = tf.constant_initializer(0.) h_i_dwn = downconv(h_i, layer_depth, kwidth=kwidth, init=tf.truncated_normal_initializer(stddev=0.02), bias_init=bias_init, name='enc_{}'.format(layer_idx)) print("h_i_dwn") print(h_i_dwn.get_shape()) print('Downconv {} -> {}'.format(h_i.get_shape(),h_i_dwn.get_shape())) h_i = h_i_dwn print('-- Enc: leakyrelu activation --') h_i = leakyrelu(h_i) if(layer_idx < len(self.g_enc_depths) - 1): h_i = dropout(h_i, self.dropout_cnn) return h_i
[ 1, 1053, 26110, 408, 15886, 13, 3166, 302, 29876, 29918, 16121, 29918, 29277, 1053, 334, 13, 3166, 4175, 9157, 29918, 12181, 1053, 19916, 9157, 24111, 13, 3166, 288, 567, 1053, 334, 13, 13, 1990, 4465, 573, 29918, 29943, 3958, 29918, 6779, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 396, 15484, 8948, 414, 363, 1881, 29892, 1962, 322, 5768, 449, 13, 4706, 1583, 29889, 2917, 353, 2295, 13, 4706, 1583, 29889, 2080, 29918, 29916, 29896, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 12181, 11759, 8516, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 24535, 29918, 593, 603, 29892, 1583, 29889, 2917, 29889, 29876, 12719, 1402, 978, 2433, 2080, 29918, 29916, 29896, 1495, 13, 4706, 1583, 29889, 2080, 29918, 29916, 29906, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 518, 8516, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 299, 326, 29892, 1583, 29889, 2917, 29889, 29876, 12719, 1402, 1024, 543, 2080, 29918, 29916, 29906, 1159, 13, 4706, 1583, 29889, 2080, 29918, 29891, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 518, 8516, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 29876, 1990, 1402, 1024, 543, 2080, 29918, 29891, 1159, 13, 4706, 1583, 29889, 8865, 449, 29918, 29878, 15755, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 1024, 543, 8865, 449, 29918, 29878, 15755, 1159, 13, 4706, 1583, 29889, 8865, 449, 29918, 29883, 15755, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 1024, 543, 8865, 449, 29918, 29883, 15755, 1159, 13, 4706, 1583, 29889, 12496, 2827, 353, 15886, 29889, 27074, 29898, 13264, 29889, 11227, 29892, 1024, 2433, 12496, 2827, 1495, 396, 1178, 9593, 6694, 363, 9853, 6056, 5156, 2133, 13, 13, 4706, 1583, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 353, 15886, 29889, 27074, 29898, 13264, 29889, 524, 29941, 29906, 29892, 518, 8516, 2314, 396, 363, 278, 7343, 390, 10262, 13, 4706, 1583, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 353, 15886, 29889, 27074, 29898, 13264, 29889, 524, 29941, 29906, 29892, 518, 8516, 2314, 396, 363, 278, 7343, 390, 10262, 13, 13, 4706, 1583, 29889, 11433, 29918, 13801, 15755, 29878, 15755, 29918, 1212, 580, 13, 4706, 1583, 29889, 11433, 29918, 11762, 17059, 1212, 580, 13, 13, 4706, 1583, 29889, 13628, 353, 5159, 13, 4706, 1583, 29889, 11965, 2463, 353, 5159, 13, 4706, 411, 15886, 29889, 11918, 29918, 6078, 703, 4905, 29918, 13148, 29908, 1125, 13, 9651, 363, 474, 297, 3464, 29898, 1311, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 1125, 13, 18884, 8158, 29918, 29875, 353, 285, 29883, 29898, 13264, 29889, 17685, 4197, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 24535, 29918, 29878, 15755, 29918, 449, 7503, 29892, 29875, 29892, 29901, 11724, 15886, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 11762, 29918, 29878, 15755, 29918, 449, 29906, 7503, 29892, 29875, 29892, 29901, 2314, 1402, 29871, 29896, 511, 13, 462, 18884, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 10892, 29906, 334, 29871, 29906, 718, 1583, 29889, 2917, 29889, 24535, 29918, 29876, 10892, 334, 29871, 29906, 29892, 13, 462, 18884, 1583, 29889, 2917, 29889, 29876, 1990, 29892, 13, 462, 18884, 1024, 543, 12090, 29918, 4905, 613, 13, 462, 18884, 1104, 29884, 29922, 8824, 29897, 13, 18884, 4450, 29918, 29875, 353, 15886, 29889, 1191, 3317, 29898, 13628, 29918, 29875, 29892, 29871, 29896, 29892, 1024, 543, 11965, 19222, 29879, 29908, 1273, 474, 29897, 13, 18884, 1583, 29889, 13628, 29889, 4397, 29898, 13628, 29918, 29875, 29897, 13, 18884, 1583, 29889, 11965, 2463, 29889, 4397, 29898, 11965, 29918, 29875, 29897, 13, 13, 4706, 1583, 29889, 4905, 29918, 6758, 353, 29871, 29900, 13, 4706, 411, 15886, 29889, 978, 29918, 6078, 703, 4905, 29899, 6758, 29908, 1125, 13, 9651, 363, 474, 297, 3464, 29898, 1311, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 1125, 13, 18884, 6410, 29918, 29875, 353, 15886, 29889, 15755, 29889, 2695, 3317, 29918, 19128, 29918, 296, 14441, 29918, 2541, 29918, 1188, 1169, 29898, 21134, 29922, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 2080, 29918, 29891, 7503, 29892, 29875, 29892, 29901, 11724, 1480, 1169, 29922, 1311, 29889, 13628, 29961, 29875, 2314, 13, 18884, 6410, 29918, 29875, 353, 15886, 29889, 17469, 29918, 2083, 29898, 6758, 29918, 29875, 29892, 9685, 11759, 29900, 2314, 13, 18884, 1583, 29889, 4905, 29918, 6758, 4619, 6410, 29918, 29875, 13, 4706, 1583, 29889, 4905, 29918, 6758, 353, 1583, 29889, 4905, 29918, 6758, 29914, 1311, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 396, 6588, 975, 5665, 3309, 13, 13, 4706, 1583, 29889, 562, 2764, 4135, 353, 5159, 13, 4706, 411, 15886, 29889, 978, 29918, 6078, 703, 562, 2764, 4135, 29908, 1125, 13, 9651, 363, 474, 297, 3464, 29898, 1311, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 1125, 13, 18884, 1959, 29918, 11965, 2463, 29918, 29875, 353, 15886, 29889, 11745, 29898, 1311, 29889, 11965, 2463, 29961, 29875, 1402, 15886, 29889, 1191, 3317, 29898, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 2080, 29918, 29891, 7503, 29892, 29875, 29892, 29901, 11724, 29871, 29896, 876, 13, 18884, 13600, 29918, 29875, 353, 15886, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 4384, 29898, 15728, 29918, 11965, 2463, 29918, 29875, 29892, 376, 7411, 4968, 1024, 543, 562, 2764, 4135, 19222, 29879, 29908, 1273, 474, 29897, 13, 18884, 1583, 29889, 562, 2764, 4135, 29889, 4397, 29898, 562, 2764, 4135, 29918, 29875, 29897, 13, 13, 4706, 396, 788, 373, 4943, 2133, 5174, 363, 278, 4175, 9124, 15359, 13, 4706, 411, 15886, 29889, 978, 29918, 6078, 703, 29880, 29906, 29918, 6758, 29908, 1125, 13, 9651, 24987, 259, 353, 15886, 29889, 14968, 519, 29918, 20897, 580, 13, 9651, 5174, 29918, 16908, 29918, 29872, 387, 353, 15886, 29889, 657, 29918, 10855, 29898, 13264, 29889, 9527, 15506, 29889, 29954, 28902, 1964, 29918, 26865, 29902, 6181, 29903, 29892, 6874, 2433, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 29872, 387, 1495, 13, 9651, 5174, 29918, 16908, 29918, 29872, 468, 353, 15886, 29889, 657, 29918, 10855, 29898, 13264, 29889, 9527, 15506, 29889, 29954, 28902, 1964, 29918, 26865, 29902, 6181, 29903, 29892, 6874, 2433, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 29872, 468, 1495, 13, 9651, 5174, 29918, 16908, 29918, 331, 29887, 353, 15886, 29889, 657, 29918, 10855, 29898, 13264, 29889, 9527, 15506, 29889, 29954, 28902, 1964, 29918, 26865, 29902, 6181, 29903, 29892, 6874, 2433, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 331, 29887, 1495, 13, 9651, 301, 29906, 29918, 6758, 353, 15886, 29889, 1202, 29918, 29876, 4197, 15886, 29889, 15755, 29889, 29880, 29906, 29918, 6758, 29898, 29894, 29897, 363, 325, 297, 24987, 13, 462, 1678, 565, 325, 451, 297, 5174, 29918, 16908, 29918, 29872, 387, 322, 325, 451, 297, 5174, 29918, 16908, 29918, 29872, 468, 322, 325, 451, 297, 5174, 29918, 16908, 29918, 331, 29887, 2314, 13, 9651, 1583, 29889, 6758, 353, 1583, 29889, 4905, 29918, 6758, 718, 1583, 29889, 2917, 29889, 29880, 29906, 29918, 1727, 29918, 2892, 29930, 29880, 29906, 29918, 6758, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 7346, 2277, 13, 1678, 396, 1281, 4984, 285, 29883, 15755, 29878, 15755, 1244, 13, 1678, 835, 13383, 13383, 13383, 7346, 2277, 13, 1678, 822, 3386, 29918, 13801, 15755, 29878, 15755, 29918, 1212, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29887, 29918, 3977, 29918, 19488, 29879, 353, 518, 29896, 29953, 29892, 29871, 29896, 29953, 29892, 29871, 29941, 29906, 29892, 29871, 29941, 29906, 29892, 29871, 29953, 29946, 29892, 29871, 29953, 29946, 29892, 29871, 29896, 29906, 29947, 29892, 29871, 29896, 29906, 29947, 29892, 29871, 29906, 29945, 29953, 29962, 13, 4706, 6483, 29918, 29990, 353, 15886, 29889, 690, 14443, 29898, 1311, 29889, 2080, 29918, 29916, 29896, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 24535, 29918, 593, 603, 29892, 1583, 29889, 2917, 29889, 29876, 12719, 2314, 13, 13, 4706, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 703, 24535, 29918, 497, 29918, 29883, 15755, 29918, 13148, 1159, 408, 6874, 29901, 13, 9651, 6483, 29918, 29883, 15755, 29918, 1725, 271, 353, 1583, 29889, 497, 29918, 535, 4068, 29918, 1271, 29898, 24535, 29918, 29990, 1699, 497, 29918, 20580, 29918, 1271, 1159, 13, 9651, 6483, 29918, 1949, 29918, 29883, 15755, 29918, 1725, 271, 353, 29871, 29953, 29930, 1311, 29889, 29887, 29918, 3977, 29918, 19488, 29879, 14352, 29896, 29962, 13, 9651, 6483, 29918, 29883, 15755, 29918, 1725, 271, 353, 15886, 29889, 690, 14443, 29898, 24535, 29918, 29883, 15755, 29918, 1725, 271, 29892, 21069, 29896, 29892, 6483, 29918, 1949, 29918, 29883, 15755, 29918, 1725, 271, 2314, 13, 9651, 1596, 703, 24535, 29918, 29883, 15755, 29918, 1725, 271, 1159, 13, 9651, 1596, 29898, 24535, 29918, 29883, 15755, 29918, 1725, 271, 29889, 657, 29918, 12181, 3101, 13, 9651, 6483, 29918, 29878, 15755, 29918, 2080, 353, 15886, 29889, 690, 14443, 29898, 24535, 29918, 29883, 15755, 29918, 1725, 271, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 6483, 29918, 1949, 29918, 29883, 15755, 29918, 1725, 271, 2314, 13, 13, 4706, 396, 21000, 8684, 284, 5665, 29899, 5563, 1162, 1264, 7546, 13, 4706, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 703, 24535, 29918, 1022, 2878, 29918, 29878, 15755, 29918, 13148, 1159, 408, 6874, 29901, 13, 9651, 6483, 29918, 25051, 29918, 3729, 29892, 6483, 29918, 29890, 29893, 29918, 3729, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29898, 1311, 29889, 2917, 29889, 24535, 29918, 29876, 10892, 29892, 13, 462, 462, 462, 462, 965, 1583, 29889, 2917, 29889, 24535, 29918, 12938, 2747, 29892, 13, 462, 462, 462, 462, 965, 1881, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29892, 13, 462, 462, 462, 462, 965, 1962, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29897, 13, 9651, 1583, 29889, 24535, 29918, 29878, 15755, 29918, 449, 29892, 1583, 29889, 24535, 29918, 29878, 15755, 29918, 3859, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29918, 4905, 29898, 24535, 29918, 25051, 29918, 3729, 29892, 13, 462, 462, 462, 462, 18884, 6483, 29918, 29890, 29893, 29918, 3729, 29892, 13, 462, 462, 462, 462, 18884, 6483, 29918, 29878, 15755, 29918, 2080, 29892, 13, 462, 462, 462, 462, 18884, 1583, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 13, 462, 462, 462, 462, 18884, 6874, 29922, 6078, 29897, 13, 9651, 1596, 29898, 1311, 29889, 24535, 29918, 29878, 15755, 29918, 449, 29889, 657, 29918, 12181, 3101, 13, 4706, 835, 13383, 13383, 13383, 7346, 2277, 13, 4706, 396, 2796, 316, 8961, 5436, 1212, 1244, 13, 4706, 835, 13383, 13383, 13383, 7346, 2277, 13, 13, 1678, 835, 13383, 13383, 13383, 7346, 2277, 13, 1678, 396, 1281, 4984, 19359, 17059, 1212, 1244, 13, 1678, 835, 13383, 13383, 13383, 7346, 2277, 13, 1678, 822, 3386, 29918, 11762, 17059, 1212, 29898, 1311, 1125, 13, 4706, 4175, 12181, 353, 19916, 9157, 24111, 580, 13, 4706, 396, 3626, 6825, 4175, 9157, 13, 4706, 1583, 29889, 29956, 2204, 353, 15886, 29889, 23362, 29898, 4572, 12181, 29889, 1915, 29918, 3626, 29918, 4572, 29918, 12181, 29898, 29876, 1777, 29873, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 29892, 13, 462, 462, 462, 18884, 302, 600, 29873, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 29876, 600, 29873, 29892, 13, 462, 462, 462, 18884, 3514, 20069, 403, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 13445, 20069, 403, 29892, 13, 462, 462, 462, 18884, 4482, 29888, 7971, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 677, 29888, 7971, 29892, 13, 462, 462, 462, 18884, 1880, 29888, 7971, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 9812, 29888, 7971, 511, 13, 462, 1669, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 29892, 13, 462, 1669, 1024, 543, 29956, 29899, 4572, 29899, 12181, 29899, 29872, 387, 1159, 13, 13, 4706, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 29872, 387, 29908, 1125, 13, 9651, 396, 6789, 1971, 6275, 2181, 1878, 278, 4682, 29918, 2922, 29915, 29879, 13391, 13, 9651, 1060, 29872, 387, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 2080, 29918, 29916, 29906, 7503, 29892, 29901, 29892, 29901, 29892, 29901, 29892, 29900, 11724, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 299, 326, 2314, 13, 9651, 396, 937, 4175, 9124, 7546, 13, 9651, 1583, 29889, 4806, 387, 353, 15886, 29889, 16174, 29898, 13264, 29889, 8172, 29918, 8945, 4197, 1311, 29889, 2917, 29889, 11762, 29918, 299, 326, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 1402, 29881, 1853, 29922, 13264, 29889, 7411, 29941, 29906, 876, 13, 9651, 396, 1661, 29899, 22198, 11938, 13, 9651, 1583, 29889, 4806, 387, 353, 15886, 29889, 18816, 29885, 3398, 29898, 1311, 29889, 4806, 387, 29897, 13, 9651, 396, 11105, 4636, 881, 367, 8611, 491, 8267, 29899, 14940, 4175, 9124, 29892, 321, 29889, 29887, 29889, 3367, 6825, 29892, 1621, 2521, 29889, 13, 9651, 1583, 29889, 29956, 14943, 353, 15886, 29889, 18056, 368, 29898, 1311, 29889, 4806, 387, 29892, 1311, 29889, 29956, 2204, 29897, 13, 9651, 379, 4806, 387, 353, 15886, 29889, 2922, 16109, 29898, 29990, 29872, 387, 29892, 1583, 29889, 29956, 14943, 29897, 396, 21166, 13, 9651, 379, 4806, 387, 353, 15886, 29889, 690, 14443, 29898, 29950, 4806, 387, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 2314, 13, 13, 4706, 565, 29898, 1311, 29889, 2917, 29889, 29876, 12719, 1405, 29871, 29896, 1125, 13, 9651, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 29872, 468, 29908, 1125, 13, 18884, 396, 6789, 1971, 6275, 2181, 1878, 278, 4682, 29918, 2922, 29915, 29879, 13391, 13, 18884, 1060, 29872, 468, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 2080, 29918, 29916, 29906, 7503, 29892, 29901, 29892, 29901, 29892, 29901, 29892, 29896, 11724, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 299, 326, 2314, 13, 18884, 396, 937, 4175, 9124, 7546, 13, 18884, 1583, 29889, 4806, 468, 353, 15886, 29889, 16174, 29898, 13264, 29889, 8172, 29918, 8945, 4197, 1311, 29889, 2917, 29889, 11762, 29918, 299, 326, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 1402, 29881, 1853, 29922, 13264, 29889, 7411, 29941, 29906, 876, 13, 18884, 396, 1661, 29899, 22198, 11938, 13, 18884, 1583, 29889, 4806, 468, 353, 15886, 29889, 18816, 29885, 3398, 29898, 1311, 29889, 4806, 468, 29897, 13, 18884, 396, 11105, 4636, 881, 367, 8611, 491, 8267, 29899, 14940, 4175, 9124, 29892, 321, 29889, 29887, 29889, 3367, 6825, 29892, 1621, 2521, 29889, 13, 18884, 1583, 29889, 29956, 14943, 353, 15886, 29889, 18056, 368, 29898, 1311, 29889, 4806, 468, 29892, 1311, 29889, 29956, 2204, 29897, 13, 18884, 379, 4806, 468, 353, 15886, 29889, 2922, 16109, 29898, 29990, 29872, 468, 29892, 1583, 29889, 29956, 14943, 29897, 396, 21166, 13, 18884, 379, 4806, 468, 353, 15886, 29889, 690, 14443, 29898, 29950, 4806, 468, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 2314, 13, 13, 4706, 565, 29898, 1311, 29889, 2917, 29889, 29876, 12719, 1405, 29871, 29906, 1125, 13, 9651, 411, 15886, 29889, 10141, 11219, 29887, 3746, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 4572, 9157, 29899, 13148, 29899, 331, 29887, 29908, 1125, 13, 18884, 396, 6789, 1971, 6275, 2181, 1878, 278, 4682, 29918, 2922, 29915, 29879, 13391, 13, 18884, 1060, 331, 29887, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 29879, 802, 29872, 911, 29898, 1311, 29889, 2080, 29918, 29916, 29906, 7503, 29892, 29901, 29892, 29901, 29892, 29901, 29892, 29906, 11724, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 299, 326, 2314, 13, 18884, 396, 937, 4175, 9124, 7546, 13, 18884, 1583, 29889, 29956, 331, 29887, 353, 15886, 29889, 16174, 29898, 13264, 29889, 8172, 29918, 8945, 4197, 1311, 29889, 2917, 29889, 11762, 29918, 299, 326, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 1402, 29881, 1853, 29922, 13264, 29889, 7411, 29941, 29906, 876, 13, 18884, 396, 1661, 29899, 22198, 11938, 13, 18884, 1583, 29889, 29956, 331, 29887, 353, 15886, 29889, 18816, 29885, 3398, 29898, 1311, 29889, 29956, 331, 29887, 29897, 13, 18884, 396, 11105, 4636, 881, 367, 8611, 491, 8267, 29899, 14940, 4175, 9124, 29892, 321, 29889, 29887, 29889, 3367, 6825, 29892, 1621, 2521, 29889, 13, 18884, 1583, 29889, 29956, 14943, 353, 15886, 29889, 18056, 368, 29898, 1311, 29889, 29956, 331, 29887, 29892, 1311, 29889, 29956, 2204, 29897, 13, 18884, 379, 29956, 331, 29887, 353, 15886, 29889, 2922, 16109, 29898, 29990, 331, 29887, 29892, 1583, 29889, 29956, 14943, 29897, 396, 21166, 13, 18884, 379, 29956, 331, 29887, 353, 15886, 29889, 690, 14443, 29898, 29950, 29956, 331, 29887, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 2314, 13, 13, 4706, 565, 29898, 1311, 29889, 2917, 29889, 29876, 12719, 1405, 29871, 29906, 1125, 13, 9651, 1060, 29906, 353, 15886, 29889, 17685, 4197, 29950, 4806, 387, 29892, 379, 4806, 468, 29892, 379, 29956, 331, 29887, 1402, 9685, 353, 29871, 29941, 29897, 13, 4706, 25342, 29898, 1311, 29889, 2917, 29889, 29876, 12719, 1405, 29871, 29896, 1125, 13, 9651, 1060, 29906, 353, 15886, 29889, 17685, 4197, 29950, 4806, 387, 29892, 379, 4806, 468, 1402, 9685, 353, 29871, 29941, 29897, 13, 4706, 1683, 29901, 13, 9651, 1060, 29906, 353, 379, 4806, 387, 13, 4706, 1060, 29906, 353, 15886, 29889, 690, 14443, 29898, 29990, 29906, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 4572, 29930, 1311, 29889, 2917, 29889, 29876, 12719, 2314, 13, 13, 4706, 396, 21000, 8684, 284, 21502, 305, 29899, 5563, 1162, 1264, 7546, 13, 4706, 411, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 2557, 29918, 29878, 15755, 29918, 13148, 1159, 408, 6874, 29901, 13, 9651, 19359, 29918, 25051, 29918, 3729, 29896, 29892, 19359, 29918, 29890, 29893, 29918, 3729, 29896, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29918, 11197, 29898, 1311, 29889, 2917, 29889, 11762, 29918, 29876, 10892, 29896, 29892, 13, 462, 462, 462, 462, 29871, 1583, 29889, 2917, 29889, 11762, 29918, 12938, 2747, 29896, 29892, 13, 462, 462, 462, 462, 29871, 19359, 29918, 2435, 29922, 1311, 29889, 2917, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 13, 462, 462, 462, 462, 29871, 338, 29918, 26495, 29922, 1311, 29889, 12496, 2827, 29892, 13, 462, 462, 462, 462, 29871, 1881, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29892, 396, 591, 505, 5768, 449, 287, 297, 278, 26851, 284, 7546, 13, 462, 462, 462, 462, 29871, 1962, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29897, 13, 9651, 19359, 29918, 29878, 15755, 29918, 449, 29896, 29892, 19359, 29918, 29878, 15755, 29918, 3859, 29896, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29918, 4905, 29898, 11762, 29918, 25051, 29918, 3729, 29896, 29892, 13, 462, 462, 462, 462, 462, 1678, 19359, 29918, 29890, 29893, 29918, 3729, 29896, 29892, 13, 462, 462, 462, 462, 462, 1678, 1060, 29906, 29892, 13, 462, 462, 462, 462, 462, 1678, 1583, 29889, 11762, 29918, 2557, 29918, 11762, 29918, 2435, 29892, 13, 462, 462, 462, 462, 462, 1678, 6874, 29922, 6078, 29897, 13, 9651, 1596, 29898, 11762, 29918, 29878, 15755, 29918, 449, 29896, 29889, 657, 29918, 12181, 3101, 13, 13, 4706, 411, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 2557, 29918, 1131, 2509, 29918, 13148, 29908, 1125, 13, 9651, 1583, 29889, 11762, 29918, 1131, 2509, 29918, 449, 29896, 29892, 903, 353, 8570, 29898, 11762, 29918, 29878, 15755, 29918, 449, 29896, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 1131, 2509, 29918, 2311, 29896, 29897, 13, 9651, 1596, 29898, 1311, 29889, 11762, 29918, 1131, 2509, 29918, 449, 29896, 29889, 657, 29918, 12181, 3101, 13, 13, 4706, 19359, 29918, 29872, 29918, 29878, 15755, 29918, 2080, 353, 15886, 29889, 690, 14443, 29898, 1311, 29889, 11762, 29918, 1131, 2509, 29918, 449, 29896, 29892, 21069, 29896, 29892, 1583, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 1583, 29889, 2917, 29889, 11762, 29918, 29876, 10892, 29896, 29930, 29906, 2314, 13, 4706, 396, 21000, 8684, 284, 19359, 29899, 5563, 1162, 1264, 7546, 13, 4706, 411, 15886, 29889, 11918, 29918, 6078, 703, 11762, 29918, 1022, 2878, 29918, 29878, 15755, 29918, 13148, 1159, 408, 6874, 29901, 13, 9651, 19359, 29918, 25051, 29918, 3729, 29906, 29892, 19359, 29918, 29890, 29893, 29918, 3729, 29906, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29918, 11197, 29898, 1311, 29889, 2917, 29889, 11762, 29918, 29876, 10892, 29906, 29892, 13, 462, 462, 462, 462, 29871, 1583, 29889, 2917, 29889, 11762, 29918, 12938, 2747, 29906, 29892, 13, 462, 462, 462, 462, 29871, 19359, 29918, 2435, 29922, 1311, 29889, 2917, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 13, 462, 462, 462, 462, 29871, 338, 29918, 26495, 29922, 1311, 29889, 12496, 2827, 29892, 13, 462, 462, 462, 462, 29871, 1881, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29892, 396, 591, 505, 5768, 449, 287, 278, 1962, 310, 3515, 29899, 3538, 364, 15755, 13, 462, 462, 462, 462, 29871, 1962, 29918, 17462, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 29878, 15755, 29897, 13, 9651, 1583, 29889, 11762, 29918, 29878, 15755, 29918, 449, 29906, 29892, 1583, 29889, 11762, 29918, 29878, 15755, 29918, 3859, 29906, 353, 21000, 8684, 284, 29918, 3757, 1264, 29918, 13148, 29918, 4905, 29898, 11762, 29918, 25051, 29918, 3729, 29906, 29892, 13, 462, 462, 462, 462, 632, 19359, 29918, 29890, 29893, 29918, 3729, 29906, 29892, 13, 462, 462, 462, 462, 632, 19359, 29918, 29872, 29918, 29878, 15755, 29918, 2080, 29892, 13, 462, 462, 462, 462, 632, 1583, 29889, 1022, 2878, 29918, 11762, 29918, 2435, 29892, 13, 462, 462, 462, 462, 632, 6874, 29922, 6078, 29897, 13, 9651, 1596, 29898, 1311, 29889, 11762, 29918, 29878, 15755, 29918, 449, 29906, 29889, 657, 29918, 12181, 3101, 13, 4706, 835, 13383, 13383, 13383, 7346, 2277, 13, 4706, 396, 2796, 19359, 17059, 1212, 13, 4706, 835, 13383, 13383, 13383, 7346, 29937, 13, 13, 13, 1678, 822, 599, 29918, 535, 4068, 29918, 1271, 29898, 1311, 29892, 1881, 29892, 1024, 1125, 13, 4706, 297, 29918, 6229, 29879, 353, 1881, 29889, 657, 29918, 12181, 2141, 294, 29918, 1761, 580, 13, 4706, 1596, 29898, 262, 29918, 6229, 29879, 29897, 13, 4706, 298, 29918, 29875, 353, 1881, 13, 4706, 565, 7431, 29898, 262, 29918, 6229, 29879, 29897, 1275, 29871, 29906, 29901, 13, 9651, 298, 29918, 29875, 353, 15886, 29889, 18837, 29918, 6229, 29879, 29898, 2080, 29892, 448, 29896, 29897, 13, 4706, 25342, 7431, 29898, 262, 29918, 6229, 29879, 29897, 529, 29871, 29906, 470, 7431, 29898, 262, 29918, 6229, 29879, 29897, 1405, 29871, 29941, 29901, 13, 9651, 12020, 7865, 2392, 877, 21575, 1881, 1818, 367, 29871, 29906, 29899, 29928, 470, 29871, 29941, 29899, 29928, 1495, 13, 4706, 413, 2103, 353, 29871, 29941, 29896, 13, 13, 4706, 411, 15886, 29889, 11918, 29918, 6078, 29898, 978, 29892, 24270, 29922, 13264, 29889, 20656, 29949, 29918, 1525, 17171, 29897, 408, 6874, 29901, 13, 9651, 363, 7546, 29918, 13140, 29892, 7546, 29918, 19488, 297, 26985, 29898, 1311, 29889, 29887, 29918, 3977, 29918, 19488, 29879, 1125, 13, 18884, 24003, 29918, 2344, 353, 15886, 29889, 23362, 29918, 11228, 3950, 29898, 29900, 1846, 13, 18884, 298, 29918, 29875, 29918, 29881, 1233, 353, 1623, 20580, 29898, 29882, 29918, 29875, 29892, 7546, 29918, 19488, 29892, 413, 2103, 29922, 29895, 2103, 29892, 13, 462, 462, 259, 2069, 29922, 13264, 29889, 509, 4661, 630, 29918, 8945, 29918, 11228, 3950, 29898, 4172, 3359, 29922, 29900, 29889, 29900, 29906, 511, 13, 462, 462, 259, 24003, 29918, 2344, 29922, 29890, 3173, 29918, 2344, 29892, 13, 462, 462, 259, 1024, 2433, 3977, 648, 29913, 4286, 4830, 29898, 13148, 29918, 13140, 876, 13, 18884, 1596, 703, 29882, 29918, 29875, 29918, 29881, 1233, 1159, 13, 18884, 1596, 29898, 29882, 29918, 29875, 29918, 29881, 1233, 29889, 657, 29918, 12181, 3101, 13, 18884, 1596, 877, 6767, 20580, 6571, 1599, 6571, 4286, 4830, 29898, 29882, 29918, 29875, 29889, 657, 29918, 12181, 3285, 29882, 29918, 29875, 29918, 29881, 1233, 29889, 657, 29918, 12181, 22130, 13, 18884, 298, 29918, 29875, 353, 298, 29918, 29875, 29918, 29881, 1233, 13, 18884, 1596, 877, 489, 11346, 29901, 24993, 29891, 2674, 29884, 26229, 1192, 1495, 13, 18884, 298, 29918, 29875, 353, 24993, 29891, 2674, 29884, 29898, 29882, 29918, 29875, 29897, 13, 18884, 565, 29898, 13148, 29918, 13140, 529, 7431, 29898, 1311, 29889, 29887, 29918, 3977, 29918, 19488, 29879, 29897, 448, 29871, 29896, 1125, 13, 462, 1678, 298, 29918, 29875, 353, 5768, 449, 29898, 29882, 29918, 29875, 29892, 1583, 29889, 8865, 449, 29918, 29883, 15755, 29897, 13, 4706, 736, 298, 29918, 29875, 13, 13, 13, 13, 13, 13, 2 ]
support.py
Soarxyn/PEF-Structural-Analysis
4
38358
<reponame>Soarxyn/PEF-Structural-Analysis from typing import Tuple from enum import Enum from auxiliary.algebra import Vector3, psin, pcos # this is an auxiliary class used for initializing the Support class's members' values class SupportType(Enum): SIMPLE: Tuple = (1, 0) # tuple values are the number PINNED: Tuple = (2, 0) # of forces and the number FIXED: Tuple = (2, 1) # of moments, in that order # this is a class that defines one of three support types: simple, pinned or fixed class Support: def __init__(self, name: str, angle: float = 0): # this member is the reaction vector from the support # its values are used for solving the system self.reaction: Vector3 = Vector3(0, 0, 0) if SupportType[name].value[0] > 1: self.reaction.x = 1 self.reaction.y = 1 else: self.reaction.x = pcos(angle) self.reaction.y = psin(angle) if SupportType[name].value[1] == 1: self.reaction.z = 1
[ 1, 529, 276, 1112, 420, 29958, 6295, 279, 29916, 948, 29914, 4162, 29943, 29899, 19560, 3631, 29899, 21067, 4848, 13, 3166, 19229, 1053, 12603, 552, 13, 3166, 14115, 1053, 1174, 398, 13, 3166, 29587, 653, 29889, 15742, 1053, 16510, 29941, 29892, 282, 5223, 29892, 282, 3944, 13, 13, 29937, 445, 338, 385, 29587, 653, 770, 1304, 363, 2847, 5281, 278, 18601, 770, 29915, 29879, 5144, 29915, 1819, 13, 1990, 18601, 1542, 29898, 16854, 1125, 13, 12, 5425, 3580, 1307, 29901, 12603, 552, 353, 313, 29896, 29892, 29871, 29900, 29897, 29871, 396, 18761, 1819, 526, 278, 1353, 13, 12, 29925, 1177, 29940, 3352, 29901, 12603, 552, 353, 313, 29906, 29892, 29871, 29900, 29897, 29871, 396, 310, 8249, 322, 278, 1353, 13, 12, 25634, 3352, 29901, 12603, 552, 353, 313, 29906, 29892, 29871, 29896, 29897, 259, 396, 310, 19462, 29892, 297, 393, 1797, 13, 13, 29937, 445, 338, 263, 770, 393, 17645, 697, 310, 2211, 2304, 4072, 29901, 2560, 29892, 282, 27464, 470, 4343, 13, 1990, 18601, 29901, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 851, 29892, 10696, 29901, 5785, 353, 29871, 29900, 1125, 13, 12, 12, 29937, 445, 4509, 338, 278, 19848, 4608, 515, 278, 2304, 13, 12, 12, 29937, 967, 1819, 526, 1304, 363, 17069, 278, 1788, 13, 12, 12, 1311, 29889, 276, 2467, 29901, 16510, 29941, 353, 16510, 29941, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 13, 12, 12, 361, 18601, 1542, 29961, 978, 1822, 1767, 29961, 29900, 29962, 1405, 29871, 29896, 29901, 13, 12, 12, 12, 1311, 29889, 276, 2467, 29889, 29916, 353, 29871, 29896, 13, 12, 12, 12, 1311, 29889, 276, 2467, 29889, 29891, 353, 29871, 29896, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1311, 29889, 276, 2467, 29889, 29916, 353, 282, 3944, 29898, 2521, 29897, 13, 12, 12, 12, 1311, 29889, 276, 2467, 29889, 29891, 353, 282, 5223, 29898, 2521, 29897, 13, 13, 12, 12, 361, 18601, 1542, 29961, 978, 1822, 1767, 29961, 29896, 29962, 1275, 29871, 29896, 29901, 13, 12, 12, 12, 1311, 29889, 276, 2467, 29889, 29920, 353, 29871, 29896, 13, 2 ]
tests/conftest.py
starlinglab/integrity-backend
1
125048
import pytest @pytest.fixture def reverse_geocode_mocker(mocker): def patch(return_value): mocker.patch( "integritybackend.geocoder.Geocoder.reverse_geocode", lambda *_: return_value, ) return patch
[ 1, 1053, 11451, 1688, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 11837, 29918, 24756, 401, 29918, 29885, 8658, 29898, 29885, 8658, 1125, 13, 1678, 822, 13261, 29898, 2457, 29918, 1767, 1125, 13, 4706, 286, 8658, 29889, 5041, 29898, 13, 9651, 376, 14146, 537, 27852, 29889, 479, 542, 6119, 29889, 7999, 542, 6119, 29889, 24244, 29918, 24756, 401, 613, 13, 9651, 14013, 334, 29918, 29901, 736, 29918, 1767, 29892, 13, 4706, 1723, 13, 13, 1678, 736, 13261, 13, 2 ]
stocks/helper.py
arminbhy/stock-market-analysis
1
190933
<reponame>arminbhy/stock-market-analysis #!/usr/bin/env python import numpy import pystache def _direction_to_str(direction): if direction == 1: return "Positive" if direction == -1: return "Negative" return "None" def _direction(a,b): if a > b: return 1 if a == b: return 0 return -1 def _rsi(v): if v > 70: return 'Over-Bought' if v < 30: return 'Over-Sold' if v > 60: return 'Almost-Over-Bought' if v < 40: return 'Almost-Over-Sold' return 'Avearge' class Helper: 'Class for everything related to ticker' def __init__(self, data): self.data = data def len(self): return len(self.data) def last_value(self): return self.data[len(self.data) - 1] def min(self, n=14): return min(self.data[len(self.data) - n:]) def max(self, n=14): return max(self.data[len(self.data) - n:]) def days_since_min(self, n=14): group = self.data[len(self.data) - n:] group.reverse() return group.index(self.min(n)) def days_since_max(self, n=14): group = self.data[len(self.data) - n:] group.reverse() return group.index(self.max(n)) def direction(self): return _direction( self.data[len(self.data) - 1], self.data[len(self.data) - 2] ) def direction_str(self): return _direction_to_str(self.direction()) def direction_compareto_average(self, n=14): return _direction( self.data[len(self.data) - 1], numpy.mean(self.data[len(self.data) - n:])) def direction_since_max_or_min(self, n=14): return self.direction_compareto_average( min(self.days_since_max(n), self.days_since_min(n)) + 1) def report(self, n=14): return pystache.render('Direction {{direction}}, Value {{value}}, {{n}}D Min {{min}}, Max {{max}}, Days Since Min {{since_min}}, Max {{since_max}}', { 'n' : n, 'direction' : _direction_to_str(self.direction()), 'value' : round(self.data[len(self.data) - 1],2), 'min' : round(self.min(n),2), 'max' : round(self.max(n),2), 'since_min' : self.days_since_min(n), 'since_max' : self.days_since_max(n) }) class RSIHelper(Helper): def status(self): return _rsi(self.data[len(self.data) - 1]) def min_status(self, n=14): return _rsi(self.min(n)) def max_status(self, n=14): return _rsi(self.max(n))
[ 1, 529, 276, 1112, 420, 29958, 279, 1195, 29890, 5819, 29914, 17712, 29899, 28549, 29899, 15916, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 5215, 12655, 13, 5215, 282, 858, 1829, 13, 13, 1753, 903, 20845, 29918, 517, 29918, 710, 29898, 20845, 1125, 13, 1678, 565, 5305, 1275, 29871, 29896, 29901, 13, 4706, 736, 376, 9135, 3321, 29908, 13, 1678, 565, 5305, 1275, 448, 29896, 29901, 13, 4706, 736, 376, 29940, 387, 1230, 29908, 13, 1678, 736, 376, 8516, 29908, 13, 13, 1753, 903, 20845, 29898, 29874, 29892, 29890, 1125, 13, 1678, 565, 263, 1405, 289, 29901, 13, 4706, 736, 29871, 29896, 13, 1678, 565, 263, 1275, 289, 29901, 13, 4706, 736, 29871, 29900, 13, 1678, 736, 448, 29896, 13, 13, 1753, 903, 29878, 1039, 29898, 29894, 1125, 13, 1678, 565, 325, 1405, 29871, 29955, 29900, 29901, 13, 4706, 736, 525, 3563, 29899, 29933, 1774, 29915, 13, 1678, 565, 325, 529, 29871, 29941, 29900, 29901, 13, 4706, 736, 525, 3563, 29899, 29903, 1025, 29915, 13, 1678, 565, 325, 1405, 29871, 29953, 29900, 29901, 13, 4706, 736, 525, 2499, 3242, 29899, 3563, 29899, 29933, 1774, 29915, 13, 1678, 565, 325, 529, 29871, 29946, 29900, 29901, 13, 4706, 736, 525, 2499, 3242, 29899, 3563, 29899, 29903, 1025, 29915, 13, 1678, 736, 525, 29909, 345, 279, 479, 29915, 13, 13, 1990, 6162, 546, 29901, 13, 1678, 525, 2385, 363, 4129, 4475, 304, 260, 6541, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 1125, 13, 4706, 1583, 29889, 1272, 353, 848, 13, 13, 1678, 822, 7431, 29898, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 1272, 29897, 13, 13, 1678, 822, 1833, 29918, 1767, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29896, 29962, 13, 13, 1678, 822, 1375, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 1375, 29898, 1311, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 302, 29901, 2314, 13, 13, 1678, 822, 4236, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 4236, 29898, 1311, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 302, 29901, 2314, 13, 13, 1678, 822, 3841, 29918, 16076, 29918, 1195, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 2318, 353, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 302, 17531, 13, 4706, 2318, 29889, 24244, 580, 13, 4706, 736, 2318, 29889, 2248, 29898, 1311, 29889, 1195, 29898, 29876, 876, 13, 13, 1678, 822, 3841, 29918, 16076, 29918, 3317, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 2318, 353, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 302, 17531, 13, 4706, 2318, 29889, 24244, 580, 13, 4706, 736, 2318, 29889, 2248, 29898, 1311, 29889, 3317, 29898, 29876, 876, 13, 13, 1678, 822, 5305, 29898, 1311, 1125, 13, 4706, 736, 903, 20845, 29898, 13, 9651, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29896, 1402, 13, 9651, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29906, 29962, 1723, 13, 13, 1678, 822, 5305, 29918, 710, 29898, 1311, 1125, 13, 4706, 736, 903, 20845, 29918, 517, 29918, 710, 29898, 1311, 29889, 20845, 3101, 13, 13, 1678, 822, 5305, 29918, 18307, 517, 29918, 12483, 482, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 903, 20845, 29898, 13, 9651, 1583, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29896, 1402, 13, 9651, 12655, 29889, 12676, 29898, 1311, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 302, 29901, 12622, 13, 13, 1678, 822, 5305, 29918, 16076, 29918, 3317, 29918, 272, 29918, 1195, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 1583, 29889, 20845, 29918, 18307, 517, 29918, 12483, 482, 29898, 13, 9651, 1375, 29898, 1311, 29889, 16700, 29918, 16076, 29918, 3317, 29898, 29876, 511, 29871, 13, 18884, 1583, 29889, 16700, 29918, 16076, 29918, 1195, 29898, 29876, 876, 718, 29871, 29896, 29897, 13, 13, 1678, 822, 3461, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 282, 858, 1829, 29889, 9482, 877, 21602, 8620, 20845, 11656, 7865, 8620, 1767, 11656, 8620, 29876, 930, 29928, 3080, 8620, 1195, 11656, 5918, 8620, 3317, 11656, 24728, 4001, 3080, 8620, 16076, 29918, 1195, 11656, 5918, 8620, 16076, 29918, 3317, 930, 742, 426, 13, 9651, 525, 29876, 29915, 584, 302, 29892, 13, 9651, 525, 20845, 29915, 584, 903, 20845, 29918, 517, 29918, 710, 29898, 1311, 29889, 20845, 25739, 13, 9651, 525, 1767, 29915, 584, 4513, 29898, 1311, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29896, 1402, 29906, 511, 13, 9651, 525, 1195, 29915, 584, 4513, 29898, 1311, 29889, 1195, 29898, 29876, 511, 29906, 511, 13, 9651, 525, 3317, 29915, 584, 4513, 29898, 1311, 29889, 3317, 29898, 29876, 511, 29906, 511, 13, 9651, 525, 16076, 29918, 1195, 29915, 584, 1583, 29889, 16700, 29918, 16076, 29918, 1195, 29898, 29876, 511, 13, 9651, 525, 16076, 29918, 3317, 29915, 584, 1583, 29889, 16700, 29918, 16076, 29918, 3317, 29898, 29876, 29897, 13, 9651, 5615, 13, 13, 1990, 390, 5425, 10739, 29898, 10739, 1125, 13, 1678, 822, 4660, 29898, 1311, 1125, 13, 4706, 736, 903, 29878, 1039, 29898, 1311, 29889, 1272, 29961, 2435, 29898, 1311, 29889, 1272, 29897, 448, 29871, 29896, 2314, 13, 13, 1678, 822, 1375, 29918, 4882, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 903, 29878, 1039, 29898, 1311, 29889, 1195, 29898, 29876, 876, 13, 13, 1678, 822, 4236, 29918, 4882, 29898, 1311, 29892, 302, 29922, 29896, 29946, 1125, 13, 4706, 736, 903, 29878, 1039, 29898, 1311, 29889, 3317, 29898, 29876, 876, 13, 13, 2 ]
src/discriminator_cnn_ver.py
samirsahoo007/Conditional-SeqGAN-Tensorflow
51
46765
# -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ discriminator.py ] # Synopsis [ Discriminator model ] # Author [ <NAME> (Andi611) ] # Copyright [ Copyleft(c), NTUEE, NTU, Taiwan ] """*********************************************************************************************""" ############### # IMPORTATION # ############### import math import tensorflow as tf from configuration import config, BUCKETS ####################### # CLASS DISCRIMINATOR # ####################### """ A CNN Discriminator model for text classification: Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer. """ class Discriminator(object): ################## # INITIALIZATION # ################## """ Loads Discriminator parameters and construct model. """ def __init__(self, config, vocab_size): #--general settings--# self.vocab_size = vocab_size self.max_seq_len = BUCKETS[-1][0] + BUCKETS[-1][1] self.batch_size = config.batch_size #--discriminator hyper-parameters--# self.lr = config.d_lr self.embedding_dim = config.d_embedding_dim self.num_class = config.d_num_class self.l2_reg_lambda = config.d_l2_reg_lambda self.dropout_keep_prob = tf.get_variable(name='dropout_keep_prob', shape=[], initializer=tf.constant_initializer(config.d_dropout_keep_prob)) #--discriminator constant-parameters--# self.filter_sizes = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20] self.num_filters = [100, 200, 200, 200, 200, 100, 100, 100, 100, 100, 160, 160] #--placeholders--# self.input_x = tf.placeholder('int32', [None, self.max_seq_len], name='input_x') self.input_y = tf.placeholder('float32', [None, self.num_class], name='input_y') #--construct model--# self.build_model() ############### # BUILD MODEL # ############### """ Construct tensorflow model. """ def build_model(self): with tf.variable_scope('discriminator'): #--embedding layer--# with tf.device('/cpu:0'), tf.variable_scope('word_embedding'): self.W = tf.get_variable(name='W', shape=[self.vocab_size, self.embedding_dim], initializer=tf.truncated_normal_initializer(stddev=6/math.sqrt(self.embedding_dim))) self.word_embedding = tf.nn.embedding_lookup(params=self.W, ids=self.input_x) self.word_embedding_expanded = tf.expand_dims(input=self.word_embedding, axis=-1) #--convolution+maxpool layer for each filter size--# pooled_outputs = [] for filter_size, num_filter in zip(self.filter_sizes, self.num_filters): with tf.variable_scope('conv_maxpool_%s' % filter_size): #--convolution layer--# filter_shape = [filter_size, self.embedding_dim, 1, num_filter] W = tf.get_variable(name='W', shape=filter_shape, initializer=tf.truncated_normal_initializer(stddev=0.1)) b = tf.get_variable(name='b', shape=[num_filter], initializer=tf.constant_initializer(0.1)) conv = tf.nn.conv2d(input=self.word_embedding_expanded, filter=W, strides=[1, 1, 1, 1], padding='VALID', name='conv') #--add bias and nonlinearity--# conv_b = tf.nn.bias_add(value=conv, bias=b, name='conv_b') h = tf.nn.relu(conv_b, name='relu') #--maxpooling--# pooled = tf.nn.max_pool(value=h, ksize=[1, self.max_seq_len - filter_size + 1, 1, 1], strides=[1, 1, 1, 1], padding='VALID', name='max_pooling') pooled_outputs.append(pooled) #--combine all the pooled features--# total_num_filters = sum(self.num_filters) self.h_pool = tf.concat(values=pooled_outputs, axis=3) self.h_pool_flat = tf.reshape(self.h_pool, [-1, total_num_filters]) #--add highway--# with tf.name_scope('highway'): self.h_highway = self._highway(input_=self.h_pool_flat, size=self.h_pool_flat.get_shape()[1], num_layers=1, bias=0) #--add dropout--# with tf.name_scope('dropout'): self.h_drop = tf.nn.dropout(x=self.h_highway, keep_prob=self.dropout_keep_prob) #--l2 regularization loss--# l2_loss = tf.constant(0.0) #--final (unnormalized) scores and predictions--# with tf.name_scope('output'): W = tf.get_variable(name='W', shape=[total_num_filters, self.num_class], initializer=tf.truncated_normal_initializer(stddev=0.1)) b = tf.get_variable(name='b', shape=[self.num_class], initializer=tf.constant_initializer(0.1)) l2_loss += tf.nn.l2_loss(W) l2_loss += tf.nn.l2_loss(b) self.scores = tf.nn.xw_plus_b(self.h_drop, W, b, name="scores") self.ypred_for_auc = tf.nn.softmax(self.scores) self.predictions = tf.argmax(self.scores, 1, name="predictions") #--calculat mean cross-entropy loss--# with tf.name_scope("loss"): losses = tf.nn.softmax_cross_entropy_with_logits_v2(logits=self.scores, labels=self.input_y) self.loss = tf.reduce_mean(losses) + self.l2_reg_lambda * l2_loss #--train_op--# self.optimizer = tf.train.AdamOptimizer(self.lr) self.params = [param for param in tf.trainable_variables() if 'discriminator' in param.name] gradients = self.optimizer.compute_gradients(loss=self.loss, var_list=self.params, aggregation_method=2) self.train_op = self.optimizer.apply_gradients(gradients) #****************************************************# #***************** HELPER FUNCTIONS *****************# #****************************************************# ############ # _HIGHWAY # ############ """ Called by build_model(). Highway Network (cf. http://arxiv.org/abs/1505.00387). t = sigmoid(Wy + b) z = t * g(Wy + b) + (1 - t) * y where g is nonlinearity, t is transform gate, and (1 - t) is carry gate. borrowed from https://github.com/mkroutikov/tf-lstm-char-cnn. """ def _highway(self, input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway'): with tf.variable_scope(scope): for idx in range(num_layers): g = f(self._linear(input_, size, scope='highway_lin_%d' % idx)) t = tf.sigmoid(self._linear(input_, size, scope='highway_gate_%d' % idx) + bias) output = t * g + (1. - t) * input_ input_ = output return output ########### # _LINEAR # ########### """ Called by _highway(). An alternative to tf.nn.rnn_cell._linear function, which has been removed in Tensorfow 1.0.1 Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k] Args: input_: a tensor or a list of 2D, batch x n, Tensors. output_size: int, second dimension of W[i]. scope: VariableScope for the created subgraph; defaults to "Linear". Returns: A 2D Tensor with shape [batch x output_size] equal to sum_i(input_[i] * W[i]), where W[i]s are newly created matrices. Raises: ValueError: if some of the arguments has unspecified or wrong shape. """ def _linear(self, input_, output_size, scope=None): shape = input_.get_shape().as_list() if len(shape) != 2: raise ValueError("Linear is expecting 2D arguments: %s" % str(shape)) if not shape[1]: raise ValueError("Linear expects shape[1] of arguments: %s" % str(shape)) input_size = shape[1] with tf.variable_scope(scope or "SimpleLinear"): matrix = tf.get_variable("Matrix", [output_size, input_size], dtype=input_.dtype) bias_term = tf.get_variable("Bias", [output_size], dtype=input_.dtype) return tf.matmul(input_, tf.transpose(matrix)) + bias_term ######## # MAIN # ######## """ For testing and debug purpose """ if __name__ == '__main__': discriminator = Discriminator(config)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 396, 13, 15945, 29908, 7775, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 15945, 29908, 13, 29937, 259, 3497, 1170, 268, 518, 2313, 20386, 1061, 29889, 2272, 4514, 13, 29937, 259, 10829, 15368, 268, 518, 8565, 20386, 1061, 1904, 4514, 13, 29937, 259, 13361, 539, 518, 529, 5813, 29958, 313, 2855, 29875, 29953, 29896, 29896, 29897, 4514, 13, 29937, 259, 14187, 1266, 1678, 518, 10061, 1508, 615, 29898, 29883, 511, 405, 29911, 4462, 29923, 29892, 405, 29911, 29965, 29892, 27807, 4514, 13, 15945, 29908, 7775, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 15945, 29908, 13, 13, 13, 7346, 4136, 2277, 29937, 13, 29937, 306, 3580, 8476, 8098, 396, 13, 7346, 4136, 2277, 29937, 13, 5215, 5844, 13, 5215, 26110, 408, 15886, 13, 3166, 5285, 1053, 2295, 29892, 350, 29965, 7077, 2544, 29903, 13, 13, 13, 13383, 4136, 2277, 29937, 13, 29937, 315, 4375, 1799, 28657, 29907, 3960, 16173, 1299, 1955, 396, 13, 13383, 4136, 2277, 29937, 13, 15945, 29908, 13, 12, 29909, 29696, 8565, 20386, 1061, 1904, 363, 1426, 12965, 29901, 13, 12, 15922, 267, 385, 23655, 7546, 29892, 5643, 491, 263, 26851, 284, 29892, 4236, 29899, 10109, 292, 322, 4964, 3317, 7546, 29889, 13, 15945, 29908, 13, 1990, 8565, 20386, 1061, 29898, 3318, 1125, 13, 13, 12, 13383, 2277, 13, 12, 29937, 2672, 1806, 25758, 26664, 8098, 396, 13, 12, 13383, 2277, 13, 12, 15945, 29908, 13, 12, 12, 5896, 29879, 8565, 20386, 1061, 4128, 322, 3386, 1904, 29889, 13, 12, 15945, 29908, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 2295, 29892, 7931, 370, 29918, 2311, 1125, 13, 13, 12, 12, 29937, 489, 17492, 6055, 489, 29937, 13, 12, 12, 1311, 29889, 29894, 542, 370, 29918, 2311, 353, 7931, 370, 29918, 2311, 13, 12, 12, 1311, 29889, 3317, 29918, 11762, 29918, 2435, 353, 350, 29965, 7077, 2544, 29903, 14352, 29896, 3816, 29900, 29962, 718, 350, 29965, 7077, 2544, 29903, 14352, 29896, 3816, 29896, 29962, 13, 12, 12, 1311, 29889, 16175, 29918, 2311, 353, 2295, 29889, 16175, 29918, 2311, 13, 13, 12, 12, 29937, 489, 2218, 29883, 20386, 1061, 11266, 29899, 16744, 489, 29937, 13, 12, 12, 1311, 29889, 29212, 353, 2295, 29889, 29881, 29918, 29212, 13, 12, 12, 1311, 29889, 17987, 8497, 29918, 6229, 353, 2295, 29889, 29881, 29918, 17987, 8497, 29918, 6229, 13, 12, 12, 1311, 29889, 1949, 29918, 1990, 353, 2295, 29889, 29881, 29918, 1949, 29918, 1990, 13, 12, 12, 1311, 29889, 29880, 29906, 29918, 1727, 29918, 2892, 353, 2295, 29889, 29881, 29918, 29880, 29906, 29918, 1727, 29918, 2892, 13, 12, 12, 1311, 29889, 8865, 449, 29918, 17462, 29918, 22795, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 8865, 449, 29918, 17462, 29918, 22795, 742, 8267, 11759, 1402, 2847, 3950, 29922, 13264, 29889, 23362, 29918, 11228, 3950, 29898, 2917, 29889, 29881, 29918, 8865, 449, 29918, 17462, 29918, 22795, 876, 13, 12, 12, 13, 12, 12, 29937, 489, 2218, 29883, 20386, 1061, 4868, 29899, 16744, 489, 29937, 13, 12, 12, 1311, 29889, 4572, 29918, 29879, 7093, 353, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29945, 29892, 29871, 29906, 29900, 29962, 13, 12, 12, 1311, 29889, 1949, 29918, 26705, 353, 518, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29953, 29900, 29892, 29871, 29896, 29953, 29900, 29962, 13, 13, 12, 12, 29937, 489, 6689, 8948, 414, 489, 29937, 13, 12, 12, 1311, 29889, 2080, 29918, 29916, 353, 15886, 29889, 27074, 877, 524, 29941, 29906, 742, 518, 8516, 29892, 1583, 29889, 3317, 29918, 11762, 29918, 2435, 1402, 1024, 2433, 2080, 29918, 29916, 1495, 13, 12, 12, 1311, 29889, 2080, 29918, 29891, 353, 15886, 29889, 27074, 877, 7411, 29941, 29906, 742, 518, 8516, 29892, 1583, 29889, 1949, 29918, 1990, 1402, 1024, 2433, 2080, 29918, 29891, 1495, 13, 13, 12, 12, 29937, 489, 11433, 1904, 489, 29937, 13, 12, 12, 1311, 29889, 4282, 29918, 4299, 580, 13, 13, 13, 12, 7346, 4136, 2277, 29937, 13, 12, 29937, 350, 25282, 16999, 2287, 29931, 396, 13, 12, 7346, 4136, 2277, 29937, 13, 12, 15945, 29908, 13, 12, 12, 1168, 4984, 26110, 1904, 29889, 13, 12, 15945, 29908, 13, 12, 1753, 2048, 29918, 4299, 29898, 1311, 1125, 13, 12, 12, 2541, 15886, 29889, 11918, 29918, 6078, 877, 2218, 29883, 20386, 1061, 29374, 13, 13, 12, 12, 12, 29937, 489, 17987, 8497, 7546, 489, 29937, 13, 12, 12, 12, 2541, 15886, 29889, 10141, 11219, 21970, 29901, 29900, 5477, 15886, 29889, 11918, 29918, 6078, 877, 1742, 29918, 17987, 8497, 29374, 13, 12, 12, 12, 12, 1311, 29889, 29956, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 29956, 742, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 8267, 11759, 1311, 29889, 29894, 542, 370, 29918, 2311, 29892, 1583, 29889, 17987, 8497, 29918, 6229, 1402, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2847, 3950, 29922, 13264, 29889, 509, 4661, 630, 29918, 8945, 29918, 11228, 3950, 29898, 4172, 3359, 29922, 29953, 29914, 755, 29889, 3676, 29898, 1311, 29889, 17987, 8497, 29918, 6229, 4961, 13, 12, 12, 12, 12, 1311, 29889, 1742, 29918, 17987, 8497, 353, 15886, 29889, 15755, 29889, 17987, 8497, 29918, 20401, 29898, 7529, 29922, 1311, 29889, 29956, 29892, 18999, 29922, 1311, 29889, 2080, 29918, 29916, 29897, 13, 12, 12, 12, 12, 1311, 29889, 1742, 29918, 17987, 8497, 29918, 18837, 287, 353, 15886, 29889, 18837, 29918, 6229, 29879, 29898, 2080, 29922, 1311, 29889, 1742, 29918, 17987, 8497, 29892, 9685, 10457, 29896, 29897, 13, 13, 12, 12, 12, 29937, 489, 535, 4068, 29974, 3317, 10109, 7546, 363, 1269, 4175, 2159, 489, 29937, 13, 12, 12, 12, 1129, 29877, 839, 29918, 4905, 29879, 353, 5159, 13, 12, 12, 12, 1454, 4175, 29918, 2311, 29892, 954, 29918, 4572, 297, 14319, 29898, 1311, 29889, 4572, 29918, 29879, 7093, 29892, 1583, 29889, 1949, 29918, 26705, 1125, 13, 12, 12, 12, 12, 2541, 15886, 29889, 11918, 29918, 6078, 877, 20580, 29918, 3317, 10109, 29918, 29995, 29879, 29915, 1273, 4175, 29918, 2311, 1125, 13, 13, 12, 12, 12, 12, 12, 29937, 489, 535, 4068, 7546, 489, 29937, 13, 12, 12, 12, 12, 12, 4572, 29918, 12181, 353, 518, 4572, 29918, 2311, 29892, 1583, 29889, 17987, 8497, 29918, 6229, 29892, 29871, 29896, 29892, 954, 29918, 4572, 29962, 13, 12, 12, 12, 12, 12, 29956, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 29956, 742, 8267, 29922, 4572, 29918, 12181, 29892, 2847, 3950, 29922, 13264, 29889, 509, 4661, 630, 29918, 8945, 29918, 11228, 3950, 29898, 4172, 3359, 29922, 29900, 29889, 29896, 876, 13, 12, 12, 12, 12, 12, 29890, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 29890, 742, 8267, 11759, 1949, 29918, 4572, 1402, 2847, 3950, 29922, 13264, 29889, 23362, 29918, 11228, 3950, 29898, 29900, 29889, 29896, 876, 13, 12, 12, 12, 12, 12, 20580, 353, 15886, 29889, 15755, 29889, 20580, 29906, 29881, 29898, 2080, 29922, 1311, 29889, 1742, 29918, 17987, 8497, 29918, 18837, 287, 29892, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4572, 29922, 29956, 29892, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 710, 2247, 11759, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 1402, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12791, 2433, 26707, 742, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 978, 2433, 20580, 1495, 13, 12, 12, 12, 12, 12, 29937, 489, 1202, 24003, 322, 1661, 10660, 537, 489, 29937, 13, 12, 12, 12, 12, 12, 20580, 29918, 29890, 353, 15886, 29889, 15755, 29889, 29890, 3173, 29918, 1202, 29898, 1767, 29922, 20580, 29892, 24003, 29922, 29890, 29892, 1024, 2433, 20580, 29918, 29890, 1495, 13, 12, 12, 12, 12, 12, 29882, 353, 15886, 29889, 15755, 29889, 2674, 29884, 29898, 20580, 29918, 29890, 29892, 1024, 2433, 2674, 29884, 1495, 13, 12, 12, 12, 12, 12, 29937, 489, 3317, 10109, 292, 489, 29937, 13, 12, 12, 12, 12, 12, 1129, 29877, 839, 353, 15886, 29889, 15755, 29889, 3317, 29918, 10109, 29898, 1767, 29922, 29882, 29892, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2039, 675, 11759, 29896, 29892, 1583, 29889, 3317, 29918, 11762, 29918, 2435, 448, 4175, 29918, 2311, 718, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 1402, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 710, 2247, 11759, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 1402, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12791, 2433, 26707, 742, 13, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 978, 2433, 3317, 29918, 10109, 292, 1495, 13, 12, 12, 12, 12, 12, 1129, 29877, 839, 29918, 4905, 29879, 29889, 4397, 29898, 1129, 29877, 839, 29897, 13, 12, 12, 12, 13, 12, 12, 12, 29937, 489, 17743, 457, 599, 278, 772, 29877, 839, 5680, 489, 29937, 13, 12, 12, 12, 7827, 29918, 1949, 29918, 26705, 353, 2533, 29898, 1311, 29889, 1949, 29918, 26705, 29897, 13, 12, 12, 12, 1311, 29889, 29882, 29918, 10109, 353, 15886, 29889, 17685, 29898, 5975, 29922, 1129, 29877, 839, 29918, 4905, 29879, 29892, 9685, 29922, 29941, 29897, 13, 12, 12, 12, 1311, 29889, 29882, 29918, 10109, 29918, 20620, 353, 15886, 29889, 690, 14443, 29898, 1311, 29889, 29882, 29918, 10109, 29892, 21069, 29896, 29892, 3001, 29918, 1949, 29918, 26705, 2314, 13, 13, 12, 12, 12, 29937, 489, 1202, 29469, 489, 29937, 13, 12, 12, 12, 2541, 15886, 29889, 978, 29918, 6078, 877, 9812, 1582, 29374, 13, 12, 12, 12, 12, 1311, 29889, 29882, 29918, 9812, 1582, 353, 1583, 3032, 9812, 1582, 29898, 2080, 29918, 29922, 1311, 29889, 29882, 29918, 10109, 29918, 20620, 29892, 2159, 29922, 1311, 29889, 29882, 29918, 10109, 29918, 20620, 29889, 657, 29918, 12181, 580, 29961, 29896, 1402, 954, 29918, 29277, 29922, 29896, 29892, 24003, 29922, 29900, 29897, 13, 13, 12, 12, 12, 29937, 489, 1202, 5768, 449, 489, 29937, 13, 12, 12, 12, 2541, 15886, 29889, 978, 29918, 6078, 877, 8865, 449, 29374, 13, 12, 12, 12, 12, 1311, 29889, 29882, 29918, 8865, 353, 15886, 29889, 15755, 29889, 8865, 449, 29898, 29916, 29922, 1311, 29889, 29882, 29918, 9812, 1582, 29892, 3013, 29918, 22795, 29922, 1311, 29889, 8865, 449, 29918, 17462, 29918, 22795, 29897, 13, 13, 12, 12, 12, 29937, 489, 29880, 29906, 4943, 2133, 6410, 489, 29937, 13, 12, 12, 12, 29880, 29906, 29918, 6758, 353, 15886, 29889, 23362, 29898, 29900, 29889, 29900, 29897, 13, 13, 12, 12, 12, 29937, 489, 8394, 313, 5963, 2759, 1891, 29897, 19435, 322, 27303, 489, 29937, 13, 12, 12, 12, 2541, 15886, 29889, 978, 29918, 6078, 877, 4905, 29374, 13, 12, 12, 12, 12, 29956, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 29956, 742, 8267, 11759, 7827, 29918, 1949, 29918, 26705, 29892, 1583, 29889, 1949, 29918, 1990, 1402, 2847, 3950, 29922, 13264, 29889, 509, 4661, 630, 29918, 8945, 29918, 11228, 3950, 29898, 4172, 3359, 29922, 29900, 29889, 29896, 876, 13, 12, 12, 12, 12, 29890, 353, 15886, 29889, 657, 29918, 11918, 29898, 978, 2433, 29890, 742, 8267, 11759, 1311, 29889, 1949, 29918, 1990, 1402, 2847, 3950, 29922, 13264, 29889, 23362, 29918, 11228, 3950, 29898, 29900, 29889, 29896, 876, 13, 12, 12, 12, 12, 29880, 29906, 29918, 6758, 4619, 15886, 29889, 15755, 29889, 29880, 29906, 29918, 6758, 29898, 29956, 29897, 13, 12, 12, 12, 12, 29880, 29906, 29918, 6758, 4619, 15886, 29889, 15755, 29889, 29880, 29906, 29918, 6758, 29898, 29890, 29897, 13, 12, 12, 12, 12, 1311, 29889, 1557, 2361, 353, 15886, 29889, 15755, 29889, 29916, 29893, 29918, 11242, 29918, 29890, 29898, 1311, 29889, 29882, 29918, 8865, 29892, 399, 29892, 289, 29892, 1024, 543, 1557, 2361, 1159, 13, 12, 12, 12, 12, 1311, 29889, 1478, 1127, 29918, 1454, 29918, 14766, 353, 15886, 29889, 15755, 29889, 2695, 3317, 29898, 1311, 29889, 1557, 2361, 29897, 13, 12, 12, 12, 12, 1311, 29889, 27711, 1080, 353, 15886, 29889, 1191, 3317, 29898, 1311, 29889, 1557, 2361, 29892, 29871, 29896, 29892, 1024, 543, 27711, 1080, 1159, 13, 13, 12, 12, 12, 29937, 489, 15807, 271, 2099, 4891, 29899, 296, 14441, 6410, 489, 29937, 13, 12, 12, 12, 2541, 15886, 29889, 978, 29918, 6078, 703, 6758, 29908, 1125, 13, 12, 12, 12, 12, 6758, 267, 353, 15886, 29889, 15755, 29889, 2695, 3317, 29918, 19128, 29918, 296, 14441, 29918, 2541, 29918, 1188, 1169, 29918, 29894, 29906, 29898, 1188, 1169, 29922, 1311, 29889, 1557, 2361, 29892, 11073, 29922, 1311, 29889, 2080, 29918, 29891, 29897, 13, 12, 12, 12, 12, 1311, 29889, 6758, 353, 15886, 29889, 17469, 29918, 12676, 29898, 6758, 267, 29897, 718, 1583, 29889, 29880, 29906, 29918, 1727, 29918, 2892, 334, 301, 29906, 29918, 6758, 13, 13, 12, 12, 29937, 489, 14968, 29918, 459, 489, 29937, 13, 12, 12, 1311, 29889, 20640, 3950, 353, 15886, 29889, 14968, 29889, 3253, 314, 20624, 326, 3950, 29898, 1311, 29889, 29212, 29897, 13, 12, 12, 1311, 29889, 7529, 353, 518, 3207, 363, 1828, 297, 15886, 29889, 14968, 519, 29918, 20897, 580, 565, 525, 2218, 29883, 20386, 1061, 29915, 297, 1828, 29889, 978, 29962, 13, 12, 12, 5105, 10070, 353, 1583, 29889, 20640, 3950, 29889, 26017, 29918, 5105, 10070, 29898, 6758, 29922, 1311, 29889, 6758, 29892, 722, 29918, 1761, 29922, 1311, 29889, 7529, 29892, 11404, 362, 29918, 5696, 29922, 29906, 29897, 13, 12, 12, 1311, 29889, 14968, 29918, 459, 353, 1583, 29889, 20640, 3950, 29889, 7302, 29918, 5105, 10070, 29898, 5105, 10070, 29897, 13, 13, 13, 12, 29937, 7775, 7775, 7775, 2328, 29937, 12, 13, 12, 29937, 7775, 29930, 379, 6670, 13171, 383, 28700, 29903, 334, 7775, 29937, 13, 12, 29937, 7775, 7775, 7775, 2328, 29937, 13, 13, 13, 12, 7346, 4136, 13, 12, 29937, 903, 29950, 6259, 29950, 12982, 29979, 396, 13, 12, 7346, 4136, 13, 12, 15945, 29908, 13, 12, 12, 29907, 4212, 491, 2048, 29918, 4299, 2141, 22080, 8527, 313, 6854, 29889, 1732, 597, 279, 26560, 29889, 990, 29914, 6897, 29914, 29896, 29945, 29900, 29945, 29889, 29900, 29900, 29941, 29947, 29955, 467, 13, 12, 12, 29873, 353, 4365, 29885, 3398, 29898, 29956, 29891, 718, 289, 29897, 13, 12, 12, 29920, 353, 260, 334, 330, 29898, 29956, 29891, 718, 289, 29897, 718, 313, 29896, 448, 260, 29897, 334, 343, 13, 12, 12, 3062, 330, 338, 1661, 10660, 537, 29892, 260, 338, 4327, 12417, 29892, 322, 313, 29896, 448, 260, 29897, 338, 8677, 12417, 29889, 13, 12, 12, 4089, 798, 287, 515, 2045, 597, 3292, 29889, 510, 29914, 11256, 14608, 638, 586, 29914, 13264, 29899, 20155, 29885, 29899, 3090, 29899, 29883, 15755, 29889, 13, 12, 15945, 29908, 13, 12, 1753, 903, 9812, 1582, 29898, 1311, 29892, 1881, 3383, 2159, 29892, 954, 29918, 29277, 29922, 29896, 29892, 24003, 10457, 29906, 29889, 29900, 29892, 285, 29922, 13264, 29889, 15755, 29889, 2674, 29884, 29892, 6874, 2433, 16382, 1582, 29374, 13, 12, 12, 2541, 15886, 29889, 11918, 29918, 6078, 29898, 6078, 1125, 13, 12, 12, 12, 1454, 22645, 297, 3464, 29898, 1949, 29918, 29277, 1125, 13, 12, 12, 12, 12, 29887, 353, 285, 29898, 1311, 3032, 10660, 29898, 2080, 3383, 2159, 29892, 6874, 2433, 9812, 1582, 29918, 1915, 29918, 29995, 29881, 29915, 1273, 22645, 876, 13, 12, 12, 12, 12, 29873, 353, 15886, 29889, 18816, 29885, 3398, 29898, 1311, 3032, 10660, 29898, 2080, 3383, 2159, 29892, 6874, 2433, 9812, 1582, 29918, 17062, 29918, 29995, 29881, 29915, 1273, 22645, 29897, 718, 24003, 29897, 13, 12, 12, 12, 12, 4905, 353, 260, 334, 330, 718, 313, 29896, 29889, 448, 260, 29897, 334, 1881, 29918, 13, 12, 12, 12, 12, 2080, 29918, 353, 1962, 13, 12, 12, 2457, 1962, 13, 13, 13, 12, 7346, 2277, 29937, 13, 12, 29937, 903, 18521, 1718, 396, 13, 12, 7346, 2277, 29937, 13, 12, 15945, 29908, 12, 13, 12, 12, 29907, 4212, 491, 903, 9812, 1582, 2141, 13, 12, 12, 2744, 8671, 304, 15886, 29889, 15755, 29889, 29878, 15755, 29918, 3729, 3032, 10660, 740, 29892, 607, 756, 1063, 6206, 297, 323, 575, 4877, 340, 29871, 29896, 29889, 29900, 29889, 29896, 13, 12, 12, 12697, 2910, 29901, 1962, 29961, 29895, 29962, 353, 2533, 29918, 29875, 29898, 14609, 29961, 29895, 29892, 474, 29962, 334, 1881, 29918, 29961, 29875, 29962, 1723, 718, 350, 3173, 29961, 29895, 29962, 13, 12, 12, 7883, 29901, 13, 12, 12, 12, 2080, 29918, 29901, 263, 12489, 470, 263, 1051, 310, 29871, 29906, 29928, 29892, 9853, 921, 302, 29892, 323, 575, 943, 29889, 13, 12, 12, 12, 4905, 29918, 2311, 29901, 938, 29892, 1473, 9927, 310, 399, 29961, 29875, 1822, 13, 12, 12, 12, 6078, 29901, 28736, 15289, 363, 278, 2825, 1014, 4262, 29936, 21274, 304, 376, 12697, 1642, 13, 12, 12, 11609, 29879, 29901, 13, 12, 12, 12, 29909, 29871, 29906, 29928, 323, 6073, 411, 8267, 518, 16175, 921, 1962, 29918, 2311, 29962, 5186, 304, 13, 12, 12, 12, 2083, 29918, 29875, 29898, 2080, 29918, 29961, 29875, 29962, 334, 399, 29961, 29875, 11724, 988, 399, 29961, 29875, 29962, 29879, 526, 15141, 2825, 13516, 29889, 13, 12, 12, 29934, 1759, 267, 29901, 13, 12, 12, 12, 1917, 2392, 29901, 565, 777, 310, 278, 6273, 756, 443, 6550, 2164, 470, 2743, 8267, 29889, 13, 12, 15945, 29908, 13, 12, 1753, 903, 10660, 29898, 1311, 29892, 1881, 3383, 1962, 29918, 2311, 29892, 6874, 29922, 8516, 1125, 13, 13, 12, 12, 12181, 353, 1881, 5396, 657, 29918, 12181, 2141, 294, 29918, 1761, 580, 13, 12, 12, 361, 7431, 29898, 12181, 29897, 2804, 29871, 29906, 29901, 13, 12, 12, 12, 22692, 7865, 2392, 703, 12697, 338, 16120, 29871, 29906, 29928, 6273, 29901, 1273, 29879, 29908, 1273, 851, 29898, 12181, 876, 13, 12, 12, 361, 451, 8267, 29961, 29896, 5387, 13, 12, 12, 12, 22692, 7865, 2392, 703, 12697, 23347, 8267, 29961, 29896, 29962, 310, 6273, 29901, 1273, 29879, 29908, 1273, 851, 29898, 12181, 876, 13, 12, 12, 2080, 29918, 2311, 353, 8267, 29961, 29896, 29962, 13, 13, 12, 12, 2541, 15886, 29889, 11918, 29918, 6078, 29898, 6078, 470, 376, 15427, 12697, 29908, 1125, 13, 12, 12, 12, 5344, 353, 15886, 29889, 657, 29918, 11918, 703, 14609, 613, 518, 4905, 29918, 2311, 29892, 1881, 29918, 2311, 1402, 26688, 29922, 2080, 5396, 29881, 1853, 29897, 13, 12, 12, 12, 29890, 3173, 29918, 8489, 353, 15886, 29889, 657, 29918, 11918, 703, 29933, 3173, 613, 518, 4905, 29918, 2311, 1402, 26688, 29922, 2080, 5396, 29881, 1853, 29897, 13, 13, 12, 12, 2457, 15886, 29889, 2922, 16109, 29898, 2080, 3383, 15886, 29889, 3286, 4220, 29898, 5344, 876, 718, 24003, 29918, 8489, 13, 13, 13, 7346, 13, 29937, 14861, 1177, 396, 13, 7346, 13, 15945, 29908, 13, 12, 2831, 6724, 322, 4744, 6437, 13, 15945, 29908, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 2218, 29883, 20386, 1061, 353, 8565, 20386, 1061, 29898, 2917, 29897, 13, 13, 2 ]
template/__init__.py
khanhcsc/tts-bot
0
172512
<gh_stars>0 from template.bot import Bot from template.context import Context from template.handle import handle
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 4472, 29889, 7451, 1053, 11273, 13, 3166, 4472, 29889, 4703, 1053, 15228, 13, 3166, 4472, 29889, 8411, 1053, 4386, 13, 2 ]
statuspage_io.py
spyder007/pi-monitoring
0
20606
<reponame>spyder007/pi-monitoring import logging import statuspage_io_client import configuration from enums import OpLevel logger = logging.getLogger(__name__) class Incident: """Incident Class This class represents the details about a Statuspage.io incident Attributes: name: The incident name. description: The incident description. """ name: str = "Incident Name" description: str = "Incident Description" class IncidentResult: """IncidentResult Class This class represents information about incidents created or resolved as part of a status change Attributes: incidentCreated: True if an incident was created, false otherwise. incidentResolved: True if an incident was created, false otherwise. """ incidentCreated: bool = False incidentResolved: bool = False incident: Incident def __init__(self): self.incidentCreated = False self.incidentResolved = False self.incident = Incident() class StatusResult: """StatusResult Class This class represents information about actions taken during a check and update. Attributes: statusChanged: True if the status has changed from the previous check, false otherwise. incidentResult: An instance of [IncidentResult][statuspage_io.IncidentResult]. """ statusChanged: bool = False incidentResult: IncidentResult = IncidentResult() def __init__(self): self.incidentResult = IncidentResult() class StatusPageOperator: """StatusResult Class This class represents information about actions taken during a check and update. Attributes: config: An instance of [StatusPageSettings][configuration.StatusPageSettings] which contains settings for Statuspage.io communication client: An instance of [StatusPageClient][statuspage_io_client.StatusPageClient], built from the configuration values provided. """ config: configuration.StatusPageSettings = configuration.StatusPageSettings() client: statuspage_io_client.StatusPageClient def __init__(self, statusPageConfig: configuration.StatusPageSettings): """ Constructor Initialize the instance using the provided [StatusPageSettings][configuration.StatusPageSettings]. """ self.config = statusPageConfig self.client = statuspage_io_client.StatusPageClient( self.config.apiKey, self.config.pageId) def IsConfigured(self) -> bool: """ Validate configuration data Returns: True if the operator has a valid configuration, False otherwise. """ return self.config.apiKey != "" def UpdateComponentStatus(self, componentId: str, opLevel: OpLevel, incidentDetails: Incident = {}) -> StatusResult: """ Update Component Status Using the provided OpLevel, determine the component's statuspage.io status. If the incoming `opLevel` is [Operational][enums.OpLevel] and the statuspage.io status is not, the component's status will be changed to `operational`, and any open incidents for that component will be resolved. If the incoming `opLevel` is any other value and the statuspage.io status is operational, the component's status will be changed to `major_outage` and an incident will be created using the provided `incidentDetails` Args: componentId: The component ID to check opLevel: The current OpLevel for the provided component incidentDetails: An instance of [Incident][statuspage_io.Incident] which has the details of the incident to be created, if necessary. Returns: An instance of [StatusResult][statuspage_io.StatusResult] """ if opLevel == OpLevel.Operational: componentStatus = "operational" else: componentStatus = "major_outage" if (componentStatus not in self.client.component_status_list): raise ValueError(str.format( "Invalid status '{0}'. Valid values are {1}", componentStatus, self.client.component_status_list)) result = StatusResult() component = self.client.getComponent(componentId) if (component.status != componentStatus): result.statusChanged = True logger.info("Changing status from %s to %s", component.status, componentStatus) self._updateComponentStatus(componentId, componentStatus) result.incidentResult = self._processIncidentOnStatusChange( componentId, componentStatus, incidentDetails) return result def _updateComponentStatus(self, componentId, newComponentStatus): if (newComponentStatus not in self.client.component_status_list): raise ValueError(str.format( "Invalid status '{0}'. Valid values are {1}", newComponentStatus, self.client.component_status_list)) logger.debug("Setting component status to %s: %s", newComponentStatus, componentId) payload = {"component": {"status": newComponentStatus}} self.client.updateComponent(componentId, payload) def _filter_set(self, incidents, componentId): def iterator_func(incident): for comp in incident.components: if comp.id == componentId: return True return False return filter(iterator_func, incidents) def _getAssociatedIncident(self, componentId): result = self.client.getUnresolvedIncidents() return list(self._filter_set(result, componentId)) def _processIncidentOnStatusChange(self, componentId: str, newComponentStatus: str, incidentDetails: Incident) -> IncidentResult: ''' Create or Close incidents based on the incoming component status For now, if it's operational, close open incidents, and if it's not operational, create a new ticket if one isn't already open for this component. Future state will involve more detail around outage and maintenance ''' incidentResult = IncidentResult() incidentResult.incident = incidentDetails associatedIncidents = self._getAssociatedIncident(componentId) asscIncidentCount = len(associatedIncidents) logger.info("Associated Incidents for %s: %d", componentId, asscIncidentCount) if (newComponentStatus == "operational" and asscIncidentCount > 0): for incident in associatedIncidents: self._closeIncident(incident.id) incidentResult.incidentResolved = True elif (newComponentStatus == "major_outage" and asscIncidentCount == 0): self._createIncident( componentId, newComponentStatus, incidentDetails) incidentResult.incidentCreated = True return incidentResult def _closeIncident(self, incidentId): logger.info("Closing incident %s", incidentId) payload = {"incident": {"status": "resolved"}} self.client.updateIncident(incidentId, payload) def _createIncident(self, componentId, newComponentStatus: str, incidentDetails: Incident): logger.info("Creating incident: Component %s - New Component Status %s", componentId, newComponentStatus) payload = {"incident": { "name": incidentDetails.name, "status": "investigating", "body": incidentDetails.description, "component_ids": [componentId], "components": {componentId: newComponentStatus} } } self.client.createIncident(payload)
[ 1, 529, 276, 1112, 420, 29958, 1028, 29891, 672, 29900, 29900, 29955, 29914, 1631, 29899, 3712, 2105, 292, 13, 5215, 12183, 13, 5215, 4660, 3488, 29918, 601, 29918, 4645, 13, 5215, 5285, 13, 3166, 427, 6762, 1053, 6461, 10108, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 9266, 1693, 29901, 13, 1678, 9995, 797, 29883, 1693, 4134, 13, 13, 1678, 910, 770, 11524, 278, 4902, 1048, 263, 16034, 3488, 29889, 601, 15134, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 1024, 29901, 450, 15134, 1024, 29889, 13, 4706, 6139, 29901, 450, 15134, 6139, 29889, 13, 13, 1678, 9995, 13, 1678, 1024, 29901, 851, 353, 376, 797, 29883, 1693, 4408, 29908, 13, 1678, 6139, 29901, 851, 353, 376, 797, 29883, 1693, 12953, 29908, 13, 13, 13, 1990, 9266, 1693, 3591, 29901, 13, 1678, 9995, 797, 29883, 1693, 3591, 4134, 13, 13, 1678, 910, 770, 11524, 2472, 1048, 5528, 16719, 2825, 470, 11527, 408, 760, 310, 263, 4660, 1735, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 15134, 20399, 29901, 5852, 565, 385, 15134, 471, 2825, 29892, 2089, 6467, 29889, 13, 4706, 15134, 12375, 1490, 29901, 5852, 565, 385, 15134, 471, 2825, 29892, 2089, 6467, 29889, 13, 13, 1678, 9995, 13, 1678, 15134, 20399, 29901, 6120, 353, 7700, 13, 1678, 15134, 12375, 1490, 29901, 6120, 353, 7700, 13, 1678, 15134, 29901, 9266, 1693, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 3742, 1693, 20399, 353, 7700, 13, 4706, 1583, 29889, 3742, 1693, 12375, 1490, 353, 7700, 13, 4706, 1583, 29889, 3742, 1693, 353, 9266, 1693, 580, 13, 13, 13, 1990, 16034, 3591, 29901, 13, 1678, 9995, 5709, 3591, 4134, 13, 13, 1678, 910, 770, 11524, 2472, 1048, 8820, 4586, 2645, 263, 1423, 322, 2767, 29889, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 4660, 7590, 29901, 5852, 565, 278, 4660, 756, 3939, 515, 278, 3517, 1423, 29892, 2089, 6467, 29889, 13, 4706, 15134, 3591, 29901, 530, 2777, 310, 518, 797, 29883, 1693, 3591, 3816, 4882, 3488, 29918, 601, 29889, 797, 29883, 1693, 3591, 1822, 13, 13, 1678, 9995, 13, 1678, 4660, 7590, 29901, 6120, 353, 7700, 13, 1678, 15134, 3591, 29901, 9266, 1693, 3591, 353, 9266, 1693, 3591, 580, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 3742, 1693, 3591, 353, 9266, 1693, 3591, 580, 13, 13, 13, 1990, 16034, 5074, 26486, 29901, 13, 1678, 9995, 5709, 3591, 4134, 13, 13, 1678, 910, 770, 11524, 2472, 1048, 8820, 4586, 2645, 263, 1423, 322, 2767, 29889, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 2295, 29901, 530, 2777, 310, 518, 5709, 5074, 9585, 3816, 13305, 29889, 5709, 5074, 9585, 29962, 607, 3743, 6055, 363, 16034, 3488, 29889, 601, 12084, 29871, 13, 4706, 3132, 29901, 530, 2777, 310, 518, 5709, 5074, 4032, 3816, 4882, 3488, 29918, 601, 29918, 4645, 29889, 5709, 5074, 4032, 1402, 4240, 515, 278, 5285, 1819, 4944, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 2295, 29901, 5285, 29889, 5709, 5074, 9585, 353, 5285, 29889, 5709, 5074, 9585, 580, 13, 1678, 3132, 29901, 4660, 3488, 29918, 601, 29918, 4645, 29889, 5709, 5074, 4032, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4660, 5074, 3991, 29901, 5285, 29889, 5709, 5074, 9585, 1125, 13, 4706, 9995, 1281, 18769, 13, 13, 4706, 25455, 278, 2777, 773, 278, 4944, 518, 5709, 5074, 9585, 3816, 13305, 29889, 5709, 5074, 9585, 1822, 13, 13, 4706, 9995, 13, 4706, 1583, 29889, 2917, 353, 4660, 5074, 3991, 13, 4706, 1583, 29889, 4645, 353, 4660, 3488, 29918, 601, 29918, 4645, 29889, 5709, 5074, 4032, 29898, 13, 9651, 1583, 29889, 2917, 29889, 2754, 2558, 29892, 1583, 29889, 2917, 29889, 3488, 1204, 29897, 13, 13, 1678, 822, 1317, 3991, 2955, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 15758, 403, 5285, 848, 13, 13, 4706, 16969, 29901, 13, 9651, 5852, 565, 278, 5455, 756, 263, 2854, 5285, 29892, 7700, 6467, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 2917, 29889, 2754, 2558, 2804, 5124, 13, 13, 1678, 822, 10318, 5308, 5709, 29898, 1311, 29892, 4163, 1204, 29901, 851, 29892, 1015, 10108, 29901, 6461, 10108, 29892, 15134, 10602, 29901, 9266, 1693, 353, 426, 1800, 1599, 16034, 3591, 29901, 13, 4706, 9995, 10318, 15924, 16034, 13, 13, 4706, 5293, 278, 4944, 6461, 10108, 29892, 8161, 278, 4163, 29915, 29879, 4660, 3488, 29889, 601, 4660, 29889, 29871, 13, 13, 4706, 960, 278, 23235, 421, 459, 10108, 29952, 338, 518, 7094, 1288, 3816, 264, 6762, 29889, 11746, 10108, 29962, 322, 278, 4660, 3488, 29889, 601, 4660, 338, 451, 29892, 278, 4163, 29915, 29879, 4660, 674, 367, 3939, 304, 421, 3372, 1288, 1673, 322, 738, 1722, 5528, 16719, 363, 393, 4163, 674, 367, 11527, 29889, 13, 13, 4706, 960, 278, 23235, 421, 459, 10108, 29952, 338, 738, 916, 995, 322, 278, 4660, 3488, 29889, 601, 4660, 338, 1751, 1288, 29892, 278, 4163, 29915, 29879, 4660, 674, 367, 3939, 304, 421, 21355, 29918, 449, 482, 29952, 322, 385, 15134, 674, 367, 2825, 773, 278, 4944, 421, 3742, 1693, 10602, 29952, 13, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 4163, 1204, 29901, 450, 4163, 3553, 304, 1423, 13, 9651, 1015, 10108, 29901, 450, 1857, 6461, 10108, 363, 278, 4944, 4163, 13, 9651, 15134, 10602, 29901, 530, 2777, 310, 518, 797, 29883, 1693, 3816, 4882, 3488, 29918, 601, 29889, 797, 29883, 1693, 29962, 607, 756, 278, 4902, 310, 278, 15134, 304, 367, 2825, 29892, 565, 5181, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 530, 2777, 310, 518, 5709, 3591, 3816, 4882, 3488, 29918, 601, 29889, 5709, 3591, 29962, 13, 4706, 9995, 13, 13, 4706, 565, 1015, 10108, 1275, 6461, 10108, 29889, 7094, 1288, 29901, 13, 9651, 4163, 5709, 353, 376, 3372, 1288, 29908, 13, 4706, 1683, 29901, 13, 9651, 4163, 5709, 353, 376, 21355, 29918, 449, 482, 29908, 13, 13, 4706, 565, 313, 9700, 5709, 451, 297, 1583, 29889, 4645, 29889, 9700, 29918, 4882, 29918, 1761, 1125, 13, 9651, 12020, 7865, 2392, 29898, 710, 29889, 4830, 29898, 13, 18884, 376, 13919, 4660, 22372, 29900, 29913, 4286, 29871, 15758, 1819, 526, 426, 29896, 17671, 4163, 5709, 29892, 1583, 29889, 4645, 29889, 9700, 29918, 4882, 29918, 1761, 876, 13, 13, 4706, 1121, 353, 16034, 3591, 580, 13, 4706, 4163, 353, 1583, 29889, 4645, 29889, 657, 5308, 29898, 9700, 1204, 29897, 13, 13, 4706, 565, 313, 9700, 29889, 4882, 2804, 4163, 5709, 1125, 13, 9651, 1121, 29889, 4882, 7590, 353, 5852, 13, 9651, 17927, 29889, 3888, 703, 1451, 9776, 4660, 515, 1273, 29879, 304, 1273, 29879, 613, 13, 462, 4706, 4163, 29889, 4882, 29892, 4163, 5709, 29897, 13, 9651, 1583, 3032, 5504, 5308, 5709, 29898, 9700, 1204, 29892, 4163, 5709, 29897, 13, 9651, 1121, 29889, 3742, 1693, 3591, 353, 1583, 3032, 5014, 797, 29883, 1693, 2951, 5709, 7277, 29898, 13, 18884, 4163, 1204, 29892, 4163, 5709, 29892, 15134, 10602, 29897, 13, 13, 4706, 736, 1121, 13, 13, 1678, 822, 903, 5504, 5308, 5709, 29898, 1311, 29892, 4163, 1204, 29892, 716, 5308, 5709, 1125, 13, 4706, 565, 313, 1482, 5308, 5709, 451, 297, 1583, 29889, 4645, 29889, 9700, 29918, 4882, 29918, 1761, 1125, 13, 9651, 12020, 7865, 2392, 29898, 710, 29889, 4830, 29898, 13, 18884, 376, 13919, 4660, 22372, 29900, 29913, 4286, 29871, 15758, 1819, 526, 426, 29896, 17671, 716, 5308, 5709, 29892, 1583, 29889, 4645, 29889, 9700, 29918, 4882, 29918, 1761, 876, 13, 13, 4706, 17927, 29889, 8382, 703, 29020, 4163, 4660, 304, 1273, 29879, 29901, 1273, 29879, 613, 13, 462, 268, 716, 5308, 5709, 29892, 4163, 1204, 29897, 13, 4706, 20092, 353, 8853, 9700, 1115, 8853, 4882, 1115, 716, 5308, 5709, 930, 13, 4706, 1583, 29889, 4645, 29889, 5504, 5308, 29898, 9700, 1204, 29892, 20092, 29897, 13, 13, 1678, 822, 903, 4572, 29918, 842, 29898, 1311, 29892, 5528, 16719, 29892, 4163, 1204, 1125, 13, 4706, 822, 20380, 29918, 9891, 29898, 3742, 1693, 1125, 13, 9651, 363, 752, 297, 15134, 29889, 14036, 29901, 13, 18884, 565, 752, 29889, 333, 1275, 4163, 1204, 29901, 13, 462, 1678, 736, 5852, 13, 9651, 736, 7700, 13, 13, 4706, 736, 4175, 29898, 17609, 29918, 9891, 29892, 5528, 16719, 29897, 13, 13, 1678, 822, 903, 657, 29254, 630, 797, 29883, 1693, 29898, 1311, 29892, 4163, 1204, 1125, 13, 4706, 1121, 353, 1583, 29889, 4645, 29889, 657, 2525, 9778, 1490, 797, 29883, 16719, 580, 13, 4706, 736, 1051, 29898, 1311, 3032, 4572, 29918, 842, 29898, 2914, 29892, 4163, 1204, 876, 13, 13, 1678, 822, 903, 5014, 797, 29883, 1693, 2951, 5709, 7277, 29898, 1311, 29892, 4163, 1204, 29901, 851, 29892, 716, 5308, 5709, 29901, 851, 29892, 15134, 10602, 29901, 9266, 1693, 29897, 1599, 9266, 1693, 3591, 29901, 13, 4706, 14550, 6204, 470, 23186, 5528, 16719, 2729, 373, 278, 23235, 4163, 4660, 13, 13, 4706, 1152, 1286, 29892, 565, 372, 29915, 29879, 1751, 1288, 29892, 3802, 1722, 5528, 16719, 29892, 322, 565, 372, 29915, 29879, 451, 1751, 1288, 29892, 1653, 263, 716, 29871, 13, 4706, 23381, 565, 697, 3508, 29915, 29873, 2307, 1722, 363, 445, 4163, 29889, 29871, 16367, 2106, 674, 25135, 901, 9493, 2820, 714, 482, 322, 25413, 13, 4706, 14550, 13, 4706, 15134, 3591, 353, 9266, 1693, 3591, 580, 13, 4706, 15134, 3591, 29889, 3742, 1693, 353, 15134, 10602, 13, 308, 13, 4706, 6942, 797, 29883, 16719, 353, 1583, 3032, 657, 29254, 630, 797, 29883, 1693, 29898, 9700, 1204, 29897, 13, 4706, 1223, 29883, 797, 29883, 1693, 3981, 353, 7431, 29898, 21264, 630, 797, 29883, 16719, 29897, 13, 4706, 17927, 29889, 3888, 703, 29254, 630, 9266, 16719, 363, 1273, 29879, 29901, 1273, 29881, 613, 13, 462, 1678, 4163, 1204, 29892, 1223, 29883, 797, 29883, 1693, 3981, 29897, 13, 13, 4706, 565, 313, 1482, 5308, 5709, 1275, 376, 3372, 1288, 29908, 322, 1223, 29883, 797, 29883, 1693, 3981, 1405, 29871, 29900, 1125, 13, 9651, 363, 15134, 297, 6942, 797, 29883, 16719, 29901, 13, 18884, 1583, 3032, 5358, 797, 29883, 1693, 29898, 3742, 1693, 29889, 333, 29897, 13, 18884, 15134, 3591, 29889, 3742, 1693, 12375, 1490, 353, 5852, 13, 13, 4706, 25342, 313, 1482, 5308, 5709, 1275, 376, 21355, 29918, 449, 482, 29908, 322, 1223, 29883, 797, 29883, 1693, 3981, 1275, 29871, 29900, 1125, 13, 9651, 1583, 3032, 3258, 797, 29883, 1693, 29898, 13, 18884, 4163, 1204, 29892, 716, 5308, 5709, 29892, 15134, 10602, 29897, 13, 9651, 15134, 3591, 29889, 3742, 1693, 20399, 353, 5852, 13, 13, 4706, 736, 15134, 3591, 13, 13, 1678, 822, 903, 5358, 797, 29883, 1693, 29898, 1311, 29892, 15134, 1204, 1125, 13, 4706, 17927, 29889, 3888, 703, 29907, 5409, 292, 15134, 1273, 29879, 613, 15134, 1204, 29897, 13, 4706, 20092, 353, 8853, 3742, 1693, 1115, 8853, 4882, 1115, 376, 9778, 1490, 29908, 930, 13, 4706, 1583, 29889, 4645, 29889, 5504, 797, 29883, 1693, 29898, 3742, 1693, 1204, 29892, 20092, 29897, 13, 13, 1678, 822, 903, 3258, 797, 29883, 1693, 29898, 1311, 29892, 4163, 1204, 29892, 716, 5308, 5709, 29901, 851, 29892, 15134, 10602, 29901, 9266, 1693, 1125, 13, 4706, 17927, 29889, 3888, 703, 9832, 1218, 15134, 29901, 15924, 1273, 29879, 448, 1570, 15924, 16034, 1273, 29879, 613, 13, 462, 1678, 4163, 1204, 29892, 716, 5308, 5709, 29897, 13, 4706, 20092, 353, 8853, 3742, 1693, 1115, 13, 462, 259, 426, 13, 462, 539, 376, 978, 1115, 15134, 10602, 29889, 978, 29892, 13, 462, 539, 376, 4882, 1115, 376, 11569, 5286, 1218, 613, 13, 462, 539, 376, 2587, 1115, 15134, 10602, 29889, 8216, 29892, 13, 462, 539, 376, 9700, 29918, 4841, 1115, 518, 9700, 1204, 1402, 13, 462, 539, 376, 14036, 1115, 426, 9700, 1204, 29901, 716, 5308, 5709, 29913, 13, 462, 259, 500, 13, 462, 259, 500, 13, 4706, 1583, 29889, 4645, 29889, 3258, 797, 29883, 1693, 29898, 23813, 29897, 13, 2 ]
AR_Proxies.py
maquinolopez/ProxyUQ
0
114906
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 12 11:00:26 2022 @author: jac """ from numpy import array from pandas import read_csv, unique from ProxyUQ import ProxyUQ from pyplotfuncmc import PlotSolnsMC cat = read_csv("AtmosphericRivers/AR_Cat.csv") ARivers = [] for y in unique(cat['Year']): tmp = cat.loc[cat['Year'] == y] intensity = 0 for index, row in tmp.iterrows(): #intensity += row['Hours']*row['Category'] intensity += row['IWV max'] #print("%d - %f" % (y,intensity)) ARivers += [[y,intensity]] ARivers = array(ARivers) #rt = ProxyUQ( "AtmosphericRivers/LL14", p_list=[1,2,3,4,5,6], y_by=1) ax, quan = PlotSolnsMC( rt[0], rt[4]) ax.plot( 1950-ARivers[:,0], ARivers[:,1]/5000+0.1, '-') ax.set_ylabel("Al/Si") ax.set_xlabel("y BP")
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 15050, 2627, 29871, 29896, 29906, 29871, 29896, 29896, 29901, 29900, 29900, 29901, 29906, 29953, 29871, 29906, 29900, 29906, 29906, 13, 13, 29992, 8921, 29901, 432, 562, 13, 15945, 29908, 13, 13, 3166, 12655, 1053, 1409, 13, 13, 3166, 11701, 1053, 1303, 29918, 7638, 29892, 5412, 13, 13, 3166, 1019, 3594, 29965, 29984, 1053, 1019, 3594, 29965, 29984, 13, 3166, 11451, 5317, 9891, 14047, 1053, 18399, 13296, 1983, 12513, 13, 13, 13, 4117, 353, 1303, 29918, 7638, 703, 4178, 7681, 8096, 293, 29934, 1536, 29914, 1718, 29918, 9694, 29889, 7638, 1159, 13, 13, 1718, 1536, 353, 5159, 13, 1454, 343, 297, 5412, 29898, 4117, 1839, 12883, 2033, 1125, 13, 1678, 13128, 353, 6635, 29889, 2029, 29961, 4117, 1839, 12883, 2033, 1275, 343, 29962, 13, 1678, 26171, 353, 29871, 29900, 13, 1678, 363, 2380, 29892, 1948, 297, 13128, 29889, 1524, 5727, 7295, 13, 4706, 396, 524, 575, 537, 4619, 1948, 1839, 29950, 2470, 2033, 29930, 798, 1839, 10900, 2033, 13, 4706, 26171, 4619, 1948, 1839, 29902, 29956, 29963, 4236, 2033, 13, 1678, 396, 2158, 11702, 29881, 448, 1273, 29888, 29908, 1273, 313, 29891, 29892, 524, 575, 537, 876, 13, 1678, 9033, 1536, 4619, 5519, 29891, 29892, 524, 575, 537, 5262, 13, 1718, 1536, 353, 1409, 29898, 1718, 1536, 29897, 13, 13, 13, 13, 13, 29937, 2273, 353, 1019, 3594, 29965, 29984, 29898, 376, 4178, 7681, 8096, 293, 29934, 1536, 29914, 2208, 29896, 29946, 613, 282, 29918, 1761, 11759, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29892, 29953, 1402, 343, 29918, 1609, 29922, 29896, 29897, 13, 1165, 29892, 29195, 353, 18399, 13296, 1983, 12513, 29898, 364, 29873, 29961, 29900, 1402, 364, 29873, 29961, 29946, 2314, 13, 1165, 29889, 5317, 29898, 29871, 29896, 29929, 29945, 29900, 29899, 1718, 1536, 7503, 29892, 29900, 1402, 9033, 1536, 7503, 29892, 29896, 16261, 29945, 29900, 29900, 29900, 29974, 29900, 29889, 29896, 29892, 17411, 1495, 13, 1165, 29889, 842, 29918, 29891, 1643, 703, 2499, 29914, 25598, 1159, 13, 1165, 29889, 842, 29918, 29916, 1643, 703, 29891, 350, 29925, 1159, 13, 13, 2 ]
flask_sspi/_common.py
ceprio/flask-sspi
0
122944
import sspi, sspicon import win32api import base64 import logging logger = logging.getLogger(__name__) from flask import Response from flask import _request_ctx_stack as stack from flask import make_response from flask import request, session, g import threading from functools import wraps from socket import gethostname import os import datetime from uuid import uuid4 _PKG_NAME = 'NTLM' # OR 'Negotiate' in future implementations (for kerberos) _sessions = {} # There is going to be one _sessions per process _sessions_lock = threading.Lock() # each process may have threads # time before a user needs to be re-authenticated _session_duration = 30 # in minutes, don't change dynamically def _user_context_processor(): if hasattr(g, "current_user") and g.current_user is not None: return dict(current_user=g.current_user) else: return {} def init_sspi(app, service='HTTP', hostname=gethostname(), package='NTLM', add_context_processor=True, session_duration=None): ''' Configure the SSPI service, and validate the presence of the appropriate informations if necessary. :param app: a flask application :type app: flask.Flask :param service: GSSAPI service name :type service: str :param hostname: hostname the service runs under :type hostname: str :param package: package the service runs under ('NTLM') ('Negotiate' is not yet implemented) :type package: str :param add_context_processor: Adds a context processor that find the current_user name from flask g variable content :type add_context_processor: bool :param session_duration: in minutes, time before a user needs to be re-authenticated :type session_duration: int ''' global _SERVICE_NAME _SERVICE_NAME = "%s@%s" % (service, hostname) _PKG_NAME = package if session_duration: _session_duration = session_duration if add_context_processor: app.context_processor(_user_context_processor) def _unauthorized(token): ''' Indicate that authentication is required :param token: token for the next negotiation or None for the first try :type token: str ''' if not token: return Response('Unauthorized', 401, {'WWW-Authenticate': 'NTLM', 'server':'Microsoft-IIS/8.5'}, mimetype='text/html') # this can also be Negotiate but does not work on my server else: return Response('Unauthorized', 401, {'WWW-Authenticate': token, 'server':'Microsoft-HTTPAPI/2.0'}, mimetype='text/html') # this can also be Negotiate but does not work on my server def _forbidden(): ''' Indicate a complete authentication failure ''' return Response('Forbidden', 403) def _get_user_name(): try: return win32api.GetUserName() except win32api.error as details: # Seeing 'access denied' errors here for non-local users (presumably # without permission to login locally). Get the fully-qualified # username, although a side-effect of these permission-denied errors # is a lack of Python codecs - so printing the Unicode value fails. # So just return the repr(), and avoid codecs completely. return repr(win32api.GetUserNameEx(win32api.NameSamCompatible)) def _sspi_authenticate(token): ''' Performs GSSAPI Negotiate Authentication On success also stashes the server response token for mutual authentication at the top of request context with the name sspi_token, along with the authenticated user principal with the name sspi_user. @param token: Authentication Token @type token: str @returns sspi return code or None on failure and token @rtype: str or None ''' global _sessions, _sessions_lock uuid = session['uuid'] if token.startswith(_PKG_NAME): recv_token_encoded = ''.join(token.split()[1:]) recv_token = base64.b64decode(recv_token_encoded) with _sessions_lock: _sa = _sessions[uuid]['sa'] lock = _sessions[uuid]['lock'] lock.acquire() try: error_code, token = _sa.authorize(recv_token) except sspi.error as details: logger.debug(f"sspi.error: {details}") # TODO: Close _sa? with _sessions_lock: del _sessions[uuid] return None, None finally: lock.release() token = token[0].Buffer if token: token = f"{_PKG_NAME} {base64.b64encode(token).decode('utf-8')}" return error_code, token # standard exit; different error codes for different stages raise Exception("Wrong authentication mode") def cleanup_sessions(): # cleanup other entries according to 'last_access' global _sessions, _sessions_lock with _sessions_lock: del_sessions = [] for key, d in _sessions.items(): if d['lock'].locked(): continue if _session_duration * 60 < (datetime.datetime.now() - d['last_access']).seconds: del_sessions.append(key) for key in del_sessions: del _sessions[key] def _init_session(): global _sessions, _sessions_lock logger.debug("Init session") if 'uuid' not in session: session['uuid'] = uuid = uuid4().bytes # init uuid on client else: uuid = session['uuid'] with _sessions_lock: if uuid not in _sessions: # make sure _sessions[uuid] = { 'sa': sspi.ServerAuth(_PKG_NAME), 'lock': threading.Lock(), 'last_access': datetime.datetime.now(), } cleanup_sessions() def _sspi_handler(session): global _sessions, _sessions_lock if 'uuid' not in session or session['uuid'] not in _sessions: _init_session() uuid = session['uuid'] if 'username' in _sessions[uuid]: # 'username' is used to know if sspi authorized if _session_duration * 60 < (datetime.datetime.now() - _sessions[uuid]['last_access']).seconds: logger.debug('timed out.') with _sessions_lock: if uuid in _sessions: # make sure del _sessions[uuid] _init_session() else: logger.debug('Already authenticated') with _sessions[uuid]['lock']: _sessions[uuid]['last_access'] = datetime.datetime.now() return None token_encoded = None recv_token_encoded = request.headers.get("Authorization") if recv_token_encoded: logger.debug(f"recv:{recv_token_encoded}") rc, token_encoded = _sspi_authenticate(recv_token_encoded) if rc == sspicon.SECPKG_NEGOTIATION_COMPLETE: logger.debug("Negotiation complete") return None elif rc not in (sspicon.SEC_I_CONTINUE_NEEDED, sspicon.SEC_I_COMPLETE_NEEDED, sspicon.SEC_I_COMPLETE_AND_CONTINUE): logger.debug(f"Forbiden rc={rc}") return _forbidden() logger.debug(f"Unauthorized yet, continue: {token_encoded}") return _unauthorized(token_encoded) # token is None on fist pass class Impersonate(): ''' Class that creates a context for the impersonalisation of the client user. May be used to get his name or group appartenance. Could also be used to make trusted connections with databases (not tested). Preferred usage: with Impersonate(): ... ''' def __init__(self, _session=None): """ If _session is passed as argument IT MUST BE LOCKED. This allows the use of Impersonate within a locked session context. """ self._session = _session def open(self): ''' Start of the impersonalisation ''' global _sessions, _sessions_lock if not self._session: uuid = session['uuid'] with _sessions_lock: _sessions[uuid]['lock'].acquire() # make sure to unlock self.lock = _sessions[uuid]['lock'] self._sa = _sessions[uuid]['sa'] else: self._sa = self._session['sa'] self._sa.ctxt.ImpersonateSecurityContext() def close(self): ''' End of the impersonalisation ''' if self._sa: self._sa.ctxt.RevertSecurityContext() self._sa = None if not self._session: self.lock.release() def __del__(self): if self._sa: self.close() def __enter__(self): self.open() return self def __exit__(self, type, value, tb): self.close() def requires_authentication(function): ''' Require that the wrapped view function only be called by users authenticated with SSPI. The view function will have the authenticated users principal passed to it as its first argument. :param function: flask view function :type function: function :returns: decorated function :rtype: function ''' global _sessions, _sessions_lock @wraps(function) def decorated(*args, **kwargs): ret = _sspi_handler(session) if ret is not None: return ret else: uuid = session['uuid'] with _sessions_lock: _session = _sessions[uuid] lock = _session['lock'] lock.acquire() try: if 'username' not in _session: # get username through impersonalisation with Impersonate(_session): current_user = _get_user_name() g.current_user = current_user _session['username'] = current_user _session['last_access'] = datetime.datetime.now() else: g.current_user = _session['username'] finally: lock.release() # call route function response = function(g.current_user, *args, **kwargs) response = make_response(response) return response return decorated def authenticate(function): ''' Require that the wrapped view function only be called by users authenticated with SSPI. :param function: flask view function :type function: function :returns: decorated function :rtype: function ''' global _sessions, _sessions_lock @wraps(function) def decorated(*args, **kwargs): ret = _sspi_handler(session) if ret is not None: return ret else: uuid = session['uuid'] with _sessions_lock: _session = _sessions[uuid] lock = _session['lock'] lock.acquire() try: if 'username' not in _session: # get username through impersonalisation with Impersonate(_session): current_user = _get_user_name() g.current_user = current_user _session['username'] = current_user _session['last_access'] = datetime.datetime.now() else: g.current_user = _session['username'] finally: lock.release() # call route function response = function(*args, **kwargs) if response: response = make_response(response) return response return decorated
[ 1, 1053, 269, 1028, 29875, 29892, 269, 1028, 4144, 30004, 13, 5215, 5401, 29941, 29906, 2754, 30004, 13, 5215, 2967, 29953, 29946, 30004, 13, 5215, 12183, 30004, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 8443, 13, 30004, 13, 3166, 29784, 1053, 13291, 30004, 13, 3166, 29784, 1053, 903, 3827, 29918, 13073, 29918, 1429, 408, 5096, 30004, 13, 3166, 29784, 1053, 1207, 29918, 5327, 30004, 13, 3166, 29784, 1053, 2009, 29892, 4867, 29892, 330, 30004, 13, 5215, 3244, 292, 30004, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 30004, 13, 3166, 9909, 1053, 330, 621, 520, 978, 30004, 13, 5215, 2897, 30004, 13, 5215, 12865, 30004, 13, 3166, 318, 5416, 1053, 318, 5416, 29946, 30004, 13, 30004, 13, 29918, 21738, 29954, 29918, 5813, 353, 525, 29940, 14632, 29924, 29915, 29871, 396, 6323, 525, 29940, 387, 15297, 403, 29915, 297, 5434, 20240, 313, 1454, 13023, 495, 359, 8443, 13, 29918, 29879, 10964, 353, 6571, 29871, 396, 1670, 338, 2675, 304, 367, 697, 903, 29879, 10964, 639, 1889, 6756, 13, 29918, 29879, 10964, 29918, 908, 353, 3244, 292, 29889, 16542, 580, 29871, 396, 1269, 1889, 1122, 505, 9717, 30004, 13, 29937, 931, 1434, 263, 1404, 4225, 304, 367, 337, 29899, 27218, 630, 30004, 13, 29918, 7924, 29918, 19708, 353, 29871, 29941, 29900, 29871, 396, 297, 6233, 29892, 1016, 29915, 29873, 1735, 11200, 30004, 13, 30004, 13, 30004, 13, 1753, 903, 1792, 29918, 4703, 29918, 26482, 7295, 30004, 13, 1678, 565, 756, 5552, 29898, 29887, 29892, 376, 3784, 29918, 1792, 1159, 322, 330, 29889, 3784, 29918, 1792, 338, 451, 6213, 29901, 30004, 13, 4706, 736, 9657, 29898, 3784, 29918, 1792, 29922, 29887, 29889, 3784, 29918, 1792, 8443, 13, 1678, 1683, 29901, 30004, 13, 4706, 736, 6571, 30004, 13, 30004, 13, 30004, 13, 1753, 2069, 29918, 893, 1631, 29898, 932, 29892, 2669, 2433, 10493, 742, 3495, 978, 29922, 29887, 621, 520, 978, 3285, 3577, 2433, 29940, 14632, 29924, 742, 788, 29918, 4703, 29918, 26482, 29922, 5574, 29892, 4867, 29918, 19708, 29922, 8516, 1125, 30004, 13, 1678, 14550, 30004, 13, 1678, 1281, 4532, 278, 5886, 2227, 2669, 29892, 322, 12725, 278, 10122, 310, 278, 30004, 13, 1678, 8210, 19313, 565, 5181, 22993, 13, 30004, 13, 1678, 584, 3207, 623, 29901, 263, 29784, 2280, 30004, 13, 1678, 584, 1853, 623, 29901, 29784, 29889, 8754, 1278, 30004, 13, 1678, 584, 3207, 2669, 29901, 402, 1799, 8787, 2669, 1024, 30004, 13, 1678, 584, 1853, 2669, 29901, 851, 30004, 13, 1678, 584, 3207, 3495, 978, 29901, 3495, 978, 278, 2669, 6057, 1090, 30004, 13, 1678, 584, 1853, 3495, 978, 29901, 851, 30004, 13, 1678, 584, 3207, 3577, 29901, 3577, 278, 2669, 6057, 1090, 6702, 29940, 14632, 29924, 1495, 6702, 29940, 387, 15297, 403, 29915, 338, 451, 3447, 8762, 8443, 13, 1678, 584, 1853, 3577, 29901, 851, 30004, 13, 1678, 584, 3207, 788, 29918, 4703, 29918, 26482, 29901, 3462, 29879, 263, 3030, 21433, 393, 1284, 278, 1857, 29918, 1792, 1024, 515, 29784, 330, 2286, 2793, 30004, 13, 1678, 584, 1853, 788, 29918, 4703, 29918, 26482, 29901, 6120, 30004, 13, 1678, 584, 3207, 4867, 29918, 19708, 29901, 297, 6233, 29892, 931, 1434, 263, 1404, 4225, 304, 367, 337, 29899, 27218, 630, 30004, 13, 1678, 584, 1853, 4867, 29918, 19708, 29901, 938, 30004, 13, 1678, 14550, 30004, 13, 1678, 5534, 903, 6304, 19059, 29918, 5813, 30004, 13, 1678, 903, 6304, 19059, 29918, 5813, 353, 11860, 29879, 29992, 29995, 29879, 29908, 1273, 313, 5509, 29892, 3495, 978, 8443, 13, 1678, 903, 21738, 29954, 29918, 5813, 353, 3577, 30004, 13, 30004, 13, 1678, 565, 4867, 29918, 19708, 29901, 30004, 13, 4706, 903, 7924, 29918, 19708, 353, 4867, 29918, 19708, 30004, 13, 30004, 13, 1678, 565, 788, 29918, 4703, 29918, 26482, 29901, 30004, 13, 4706, 623, 29889, 4703, 29918, 26482, 7373, 1792, 29918, 4703, 29918, 26482, 8443, 13, 30004, 13, 30004, 13, 1753, 903, 348, 8921, 1891, 29898, 6979, 1125, 30004, 13, 1678, 14550, 30004, 13, 1678, 1894, 9593, 393, 10760, 338, 3734, 30004, 13, 1678, 6756, 13, 1678, 584, 3207, 5993, 29901, 5993, 363, 278, 2446, 3480, 327, 11685, 470, 6213, 363, 278, 937, 1018, 30004, 13, 1678, 584, 1853, 5993, 29901, 851, 30004, 13, 1678, 14550, 30004, 13, 1678, 565, 451, 5993, 29901, 30004, 13, 4706, 736, 13291, 877, 29965, 1056, 329, 2015, 1891, 742, 29871, 29946, 29900, 29896, 29892, 11117, 29956, 29956, 29956, 29899, 6444, 4173, 403, 2396, 525, 29940, 14632, 29924, 742, 525, 2974, 22099, 11277, 29899, 2687, 29903, 29914, 29947, 29889, 29945, 16675, 286, 17528, 668, 2433, 726, 29914, 1420, 1495, 29871, 396, 445, 508, 884, 367, 12610, 15297, 403, 541, 947, 451, 664, 373, 590, 1923, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 736, 13291, 877, 29965, 1056, 329, 2015, 1891, 742, 29871, 29946, 29900, 29896, 29892, 11117, 29956, 29956, 29956, 29899, 6444, 4173, 403, 2396, 5993, 29892, 525, 2974, 22099, 11277, 29899, 10493, 8787, 29914, 29906, 29889, 29900, 16675, 286, 17528, 668, 2433, 726, 29914, 1420, 1495, 29871, 396, 445, 508, 884, 367, 12610, 15297, 403, 541, 947, 451, 664, 373, 590, 1923, 30004, 13, 30004, 13, 30004, 13, 1753, 903, 1454, 29890, 4215, 7295, 30004, 13, 1678, 14550, 30004, 13, 1678, 1894, 9593, 263, 4866, 10760, 10672, 30004, 13, 1678, 14550, 30004, 13, 1678, 736, 13291, 877, 2831, 29890, 4215, 742, 29871, 29946, 29900, 29941, 8443, 13, 30004, 13, 30004, 13, 1753, 903, 657, 29918, 1792, 29918, 978, 7295, 30004, 13, 268, 1018, 29901, 30004, 13, 308, 736, 5401, 29941, 29906, 2754, 29889, 2577, 28129, 26471, 13, 268, 5174, 5401, 29941, 29906, 2754, 29889, 2704, 408, 4902, 29901, 30004, 13, 308, 396, 2823, 292, 525, 5943, 17935, 29915, 4436, 1244, 363, 1661, 29899, 2997, 4160, 313, 4569, 24873, 30004, 13, 308, 396, 1728, 10751, 304, 6464, 12430, 467, 29871, 3617, 278, 8072, 29899, 15380, 2164, 30004, 13, 308, 396, 8952, 29892, 5998, 263, 2625, 29899, 15987, 310, 1438, 10751, 29899, 1145, 1000, 4436, 30004, 13, 308, 396, 338, 263, 10225, 310, 5132, 775, 2395, 448, 577, 14010, 278, 23862, 995, 8465, 22993, 13, 308, 396, 1105, 925, 736, 278, 2062, 3285, 322, 4772, 775, 2395, 6446, 22993, 13, 308, 736, 2062, 29898, 5080, 29941, 29906, 2754, 29889, 2577, 28129, 1252, 29898, 5080, 29941, 29906, 2754, 29889, 1170, 22966, 14644, 1821, 876, 30004, 13, 30004, 13, 30004, 13, 1753, 903, 893, 1631, 29918, 27218, 403, 29898, 6979, 1125, 30004, 13, 1678, 14550, 30004, 13, 1678, 2431, 9514, 402, 1799, 8787, 12610, 15297, 403, 27241, 30004, 13, 30004, 13, 1678, 1551, 2551, 884, 380, 1161, 267, 278, 1923, 2933, 5993, 363, 5478, 950, 10760, 30004, 13, 1678, 472, 278, 2246, 310, 2009, 3030, 411, 278, 1024, 269, 1028, 29875, 29918, 6979, 29892, 3412, 411, 278, 30004, 13, 1678, 15585, 630, 1404, 5882, 411, 278, 1024, 269, 1028, 29875, 29918, 1792, 22993, 13, 30004, 13, 1678, 732, 3207, 5993, 29901, 27241, 25159, 30004, 13, 1678, 732, 1853, 5993, 29901, 851, 30004, 13, 1678, 732, 18280, 269, 1028, 29875, 736, 775, 470, 6213, 373, 10672, 322, 5993, 30004, 13, 1678, 732, 29878, 1853, 29901, 851, 470, 6213, 30004, 13, 1678, 14550, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 1678, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 1678, 565, 5993, 29889, 27382, 2541, 7373, 21738, 29954, 29918, 5813, 1125, 30004, 13, 4706, 1162, 29894, 29918, 6979, 29918, 26716, 353, 525, 4286, 7122, 29898, 6979, 29889, 5451, 580, 29961, 29896, 29901, 2314, 30004, 13, 4706, 1162, 29894, 29918, 6979, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 3757, 29894, 29918, 6979, 29918, 26716, 8443, 13, 4706, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 9651, 903, 4977, 353, 903, 29879, 10964, 29961, 25118, 22322, 4977, 2033, 30004, 13, 9651, 7714, 353, 903, 29879, 10964, 29961, 25118, 22322, 908, 2033, 30004, 13, 9651, 7714, 29889, 562, 1548, 26471, 13, 4706, 1018, 29901, 30004, 13, 9651, 1059, 29918, 401, 29892, 5993, 353, 903, 4977, 29889, 8921, 675, 29898, 3757, 29894, 29918, 6979, 8443, 13, 4706, 5174, 269, 1028, 29875, 29889, 2704, 408, 4902, 29901, 30004, 13, 9651, 17927, 29889, 8382, 29898, 29888, 29908, 893, 1631, 29889, 2704, 29901, 426, 14144, 27195, 30004, 13, 9651, 396, 29871, 14402, 29901, 23186, 903, 4977, 29973, 30004, 13, 9651, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 18884, 628, 29871, 903, 29879, 10964, 29961, 25118, 29962, 30004, 13, 9651, 736, 6213, 29892, 6213, 30004, 13, 4706, 7146, 29901, 30004, 13, 9651, 7714, 29889, 14096, 26471, 13, 4706, 5993, 353, 5993, 29961, 29900, 1822, 7701, 30004, 13, 4706, 565, 5993, 29901, 30004, 13, 9651, 5993, 353, 285, 29908, 29912, 29918, 21738, 29954, 29918, 5813, 29913, 426, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 6979, 467, 13808, 877, 9420, 29899, 29947, 1495, 5038, 30004, 13, 4706, 736, 1059, 29918, 401, 29892, 5993, 29871, 396, 3918, 6876, 29936, 1422, 1059, 11561, 363, 1422, 22950, 30004, 13, 1678, 12020, 8960, 703, 29956, 29373, 10760, 4464, 1159, 30004, 13, 30004, 13, 1753, 5941, 786, 29918, 29879, 10964, 7295, 30004, 13, 1678, 396, 5941, 786, 916, 9976, 5034, 304, 525, 4230, 29918, 5943, 29915, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 1678, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 4706, 628, 29918, 29879, 10964, 353, 5159, 30004, 13, 4706, 363, 1820, 29892, 270, 297, 903, 29879, 10964, 29889, 7076, 7295, 30004, 13, 9651, 565, 270, 1839, 908, 13359, 29113, 7295, 30004, 13, 18884, 6773, 30004, 13, 9651, 565, 903, 7924, 29918, 19708, 334, 29871, 29953, 29900, 529, 313, 12673, 29889, 12673, 29889, 3707, 580, 448, 270, 1839, 4230, 29918, 5943, 2033, 467, 23128, 29901, 30004, 13, 18884, 628, 29918, 29879, 10964, 29889, 4397, 29898, 1989, 8443, 13, 4706, 363, 1820, 297, 628, 29918, 29879, 10964, 29901, 30004, 13, 9651, 628, 903, 29879, 10964, 29961, 1989, 29962, 30004, 13, 30004, 13, 1753, 903, 2344, 29918, 7924, 7295, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 1678, 17927, 29889, 8382, 703, 6644, 4867, 1159, 30004, 13, 1678, 565, 525, 25118, 29915, 451, 297, 4867, 29901, 30004, 13, 4706, 4867, 1839, 25118, 2033, 353, 318, 5416, 353, 318, 5416, 29946, 2141, 13193, 29871, 396, 2069, 318, 5416, 373, 3132, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 1678, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 4706, 565, 318, 5416, 451, 297, 903, 29879, 10964, 29901, 29871, 396, 1207, 1854, 30004, 13, 9651, 903, 29879, 10964, 29961, 25118, 29962, 353, 3336, 13, 18884, 525, 4977, 2396, 269, 1028, 29875, 29889, 6004, 6444, 7373, 21738, 29954, 29918, 5813, 511, 30004, 13, 18884, 525, 908, 2396, 3244, 292, 29889, 16542, 3285, 30004, 13, 18884, 525, 4230, 29918, 5943, 2396, 12865, 29889, 12673, 29889, 3707, 3285, 30004, 13, 18884, 4970, 13, 1678, 5941, 786, 29918, 29879, 10964, 26471, 13, 30004, 13, 1753, 903, 893, 1631, 29918, 13789, 29898, 7924, 1125, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 1678, 565, 525, 25118, 29915, 451, 297, 4867, 470, 4867, 1839, 25118, 2033, 451, 297, 903, 29879, 10964, 29901, 30004, 13, 4706, 903, 2344, 29918, 7924, 26471, 13, 1678, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 1678, 565, 525, 6786, 29915, 297, 903, 29879, 10964, 29961, 25118, 5387, 29871, 396, 525, 6786, 29915, 338, 1304, 304, 1073, 565, 269, 1028, 29875, 4148, 1891, 30004, 13, 4706, 565, 903, 7924, 29918, 19708, 334, 29871, 29953, 29900, 529, 313, 12673, 29889, 12673, 29889, 3707, 580, 448, 903, 29879, 10964, 29961, 25118, 22322, 4230, 29918, 5943, 2033, 467, 23128, 29901, 30004, 13, 9651, 17927, 29889, 8382, 877, 9346, 287, 714, 29889, 1495, 30004, 13, 9651, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 18884, 565, 318, 5416, 297, 903, 29879, 10964, 29901, 29871, 396, 1207, 1854, 30004, 13, 462, 1678, 628, 903, 29879, 10964, 29961, 25118, 29962, 30004, 13, 9651, 903, 2344, 29918, 7924, 26471, 13, 4706, 1683, 29901, 30004, 13, 9651, 17927, 29889, 8382, 877, 2499, 2040, 15585, 630, 1495, 30004, 13, 9651, 411, 903, 29879, 10964, 29961, 25118, 22322, 908, 2033, 29901, 30004, 13, 18884, 903, 29879, 10964, 29961, 25118, 22322, 4230, 29918, 5943, 2033, 353, 12865, 29889, 12673, 29889, 3707, 26471, 13, 9651, 736, 6213, 30004, 13, 1678, 5993, 29918, 26716, 353, 6213, 30004, 13, 1678, 1162, 29894, 29918, 6979, 29918, 26716, 353, 2009, 29889, 13662, 29889, 657, 703, 25471, 1159, 30004, 13, 1678, 565, 1162, 29894, 29918, 6979, 29918, 26716, 29901, 30004, 13, 4706, 17927, 29889, 8382, 29898, 29888, 29908, 3757, 29894, 26254, 3757, 29894, 29918, 6979, 29918, 26716, 27195, 30004, 13, 4706, 364, 29883, 29892, 5993, 29918, 26716, 353, 903, 893, 1631, 29918, 27218, 403, 29898, 3757, 29894, 29918, 6979, 29918, 26716, 8443, 13, 4706, 565, 364, 29883, 1275, 269, 1028, 4144, 29889, 1660, 6271, 29968, 29954, 29918, 8186, 29954, 2891, 29902, 8098, 29918, 21514, 18476, 29901, 30004, 13, 9651, 17927, 29889, 8382, 703, 29940, 387, 327, 11685, 4866, 1159, 30004, 13, 9651, 736, 6213, 30004, 13, 4706, 25342, 364, 29883, 451, 297, 313, 893, 29886, 4144, 29889, 1660, 29907, 29918, 29902, 29918, 22412, 1177, 4462, 29918, 8186, 29923, 2287, 29928, 29892, 269, 1028, 4144, 29889, 1660, 29907, 29918, 29902, 29918, 21514, 18476, 29918, 8186, 29923, 2287, 29928, 29892, 269, 1028, 4144, 29889, 1660, 29907, 29918, 29902, 29918, 21514, 18476, 29918, 9468, 29918, 22412, 1177, 4462, 1125, 30004, 13, 9651, 17927, 29889, 8382, 29898, 29888, 29908, 2831, 29890, 3615, 364, 29883, 3790, 2214, 27195, 30004, 13, 9651, 736, 903, 1454, 29890, 4215, 26471, 13, 1678, 17927, 29889, 8382, 29898, 29888, 29908, 29965, 1056, 329, 2015, 1891, 3447, 29892, 6773, 29901, 426, 6979, 29918, 26716, 27195, 30004, 13, 1678, 736, 903, 348, 8921, 1891, 29898, 6979, 29918, 26716, 29897, 29871, 396, 5993, 338, 6213, 373, 285, 391, 1209, 30004, 13, 30004, 13, 30004, 13, 1990, 14305, 1330, 403, 7295, 30004, 13, 1678, 14550, 30004, 13, 1678, 4134, 393, 10017, 263, 3030, 363, 278, 2411, 1330, 284, 4371, 310, 278, 3132, 1404, 29889, 6756, 13, 1678, 2610, 367, 1304, 304, 679, 670, 1024, 470, 2318, 27119, 749, 29889, 6527, 884, 367, 1304, 30004, 13, 1678, 304, 1207, 9311, 287, 12368, 411, 21218, 313, 1333, 9528, 467, 30004, 13, 1678, 6756, 13, 1678, 4721, 14373, 8744, 29901, 30004, 13, 4706, 411, 14305, 1330, 403, 7295, 30004, 13, 9651, 2023, 30004, 13, 1678, 14550, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 903, 7924, 29922, 8516, 1125, 30004, 13, 4706, 9995, 960, 903, 7924, 338, 4502, 408, 2980, 13315, 341, 17321, 20700, 11247, 7077, 3352, 22993, 13, 4706, 910, 6511, 278, 671, 310, 14305, 1330, 403, 2629, 263, 22822, 4867, 3030, 22993, 13, 4706, 9995, 30004, 13, 4706, 1583, 3032, 7924, 353, 903, 7924, 30004, 13, 30004, 13, 1678, 822, 1722, 29898, 1311, 1125, 30004, 13, 4706, 14550, 30004, 13, 4706, 7370, 310, 278, 2411, 1330, 284, 4371, 30004, 13, 4706, 14550, 30004, 13, 4706, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 4706, 565, 451, 1583, 3032, 7924, 29901, 30004, 13, 9651, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 9651, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 18884, 903, 29879, 10964, 29961, 25118, 22322, 908, 13359, 562, 1548, 580, 396, 1207, 1854, 304, 443, 908, 30004, 13, 18884, 1583, 29889, 908, 353, 903, 29879, 10964, 29961, 25118, 22322, 908, 2033, 30004, 13, 18884, 1583, 3032, 4977, 353, 903, 29879, 10964, 29961, 25118, 22322, 4977, 2033, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 1583, 3032, 4977, 353, 1583, 3032, 7924, 1839, 4977, 2033, 30004, 13, 4706, 1583, 3032, 4977, 29889, 312, 486, 29889, 24192, 1330, 403, 13228, 2677, 26471, 13, 30004, 13, 1678, 822, 3802, 29898, 1311, 1125, 30004, 13, 4706, 14550, 30004, 13, 4706, 2796, 310, 278, 2411, 1330, 284, 4371, 30004, 13, 4706, 14550, 30004, 13, 4706, 565, 1583, 3032, 4977, 29901, 30004, 13, 9651, 1583, 3032, 4977, 29889, 312, 486, 29889, 1123, 1765, 13228, 2677, 26471, 13, 9651, 1583, 3032, 4977, 353, 6213, 30004, 13, 9651, 565, 451, 1583, 3032, 7924, 29901, 30004, 13, 18884, 1583, 29889, 908, 29889, 14096, 26471, 13, 30004, 13, 1678, 822, 4770, 6144, 12035, 1311, 1125, 30004, 13, 4706, 565, 1583, 3032, 4977, 29901, 30004, 13, 9651, 1583, 29889, 5358, 26471, 13, 30004, 13, 1678, 822, 4770, 5893, 12035, 1311, 1125, 30004, 13, 4706, 1583, 29889, 3150, 26471, 13, 4706, 736, 1583, 30004, 13, 30004, 13, 1678, 822, 4770, 13322, 12035, 1311, 29892, 1134, 29892, 995, 29892, 260, 29890, 1125, 30004, 13, 4706, 1583, 29889, 5358, 26471, 13, 30004, 13, 30004, 13, 1753, 6858, 29918, 23055, 29898, 2220, 1125, 30004, 13, 1678, 14550, 30004, 13, 1678, 830, 1548, 393, 278, 21021, 1776, 740, 871, 367, 2000, 491, 4160, 30004, 13, 1678, 15585, 630, 411, 5886, 2227, 29889, 450, 1776, 740, 674, 505, 278, 15585, 630, 30004, 13, 1678, 4160, 5882, 4502, 304, 372, 408, 967, 937, 2980, 22993, 13, 30004, 13, 1678, 584, 3207, 740, 29901, 29784, 1776, 740, 30004, 13, 1678, 584, 1853, 740, 29901, 740, 30004, 13, 1678, 584, 18280, 29901, 10200, 630, 740, 30004, 13, 1678, 584, 29878, 1853, 29901, 740, 30004, 13, 1678, 14550, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 30004, 13, 1678, 732, 29893, 336, 567, 29898, 2220, 8443, 13, 1678, 822, 10200, 630, 10456, 5085, 29892, 3579, 19290, 1125, 30004, 13, 4706, 3240, 353, 903, 893, 1631, 29918, 13789, 29898, 7924, 8443, 13, 4706, 565, 3240, 338, 451, 6213, 29901, 30004, 13, 9651, 736, 3240, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 9651, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 18884, 903, 7924, 353, 903, 29879, 10964, 29961, 25118, 29962, 30004, 13, 18884, 7714, 353, 903, 7924, 1839, 908, 2033, 30004, 13, 18884, 7714, 29889, 562, 1548, 26471, 13, 9651, 1018, 29901, 30004, 13, 18884, 565, 525, 6786, 29915, 451, 297, 903, 7924, 29901, 30004, 13, 462, 1678, 396, 679, 8952, 1549, 2411, 1330, 284, 4371, 30004, 13, 462, 1678, 411, 14305, 1330, 403, 7373, 7924, 1125, 30004, 13, 462, 4706, 1857, 29918, 1792, 353, 903, 657, 29918, 1792, 29918, 978, 26471, 13, 462, 1678, 330, 29889, 3784, 29918, 1792, 353, 1857, 29918, 1792, 30004, 13, 462, 1678, 903, 7924, 1839, 6786, 2033, 353, 1857, 29918, 1792, 30004, 13, 462, 1678, 903, 7924, 1839, 4230, 29918, 5943, 2033, 353, 12865, 29889, 12673, 29889, 3707, 26471, 13, 18884, 1683, 29901, 30004, 13, 462, 1678, 330, 29889, 3784, 29918, 1792, 353, 903, 7924, 1839, 6786, 2033, 30004, 13, 9651, 7146, 29901, 30004, 13, 18884, 7714, 29889, 14096, 26471, 13, 9651, 396, 1246, 5782, 740, 30004, 13, 9651, 2933, 353, 740, 29898, 29887, 29889, 3784, 29918, 1792, 29892, 334, 5085, 29892, 3579, 19290, 8443, 13, 9651, 2933, 353, 1207, 29918, 5327, 29898, 5327, 8443, 13, 9651, 736, 2933, 30004, 13, 30004, 13, 1678, 736, 10200, 630, 30004, 13, 30004, 13, 30004, 13, 1753, 15585, 403, 29898, 2220, 1125, 30004, 13, 1678, 14550, 30004, 13, 1678, 830, 1548, 393, 278, 21021, 1776, 740, 871, 367, 2000, 491, 4160, 30004, 13, 1678, 15585, 630, 411, 5886, 2227, 29889, 6756, 13, 1678, 6756, 13, 1678, 584, 3207, 740, 29901, 29784, 1776, 740, 30004, 13, 1678, 584, 1853, 740, 29901, 740, 30004, 13, 1678, 584, 18280, 29901, 10200, 630, 740, 30004, 13, 1678, 584, 29878, 1853, 29901, 740, 30004, 13, 1678, 14550, 30004, 13, 1678, 5534, 903, 29879, 10964, 29892, 903, 29879, 10964, 29918, 908, 30004, 13, 30004, 13, 1678, 732, 29893, 336, 567, 29898, 2220, 8443, 13, 1678, 822, 10200, 630, 10456, 5085, 29892, 3579, 19290, 1125, 30004, 13, 4706, 3240, 353, 903, 893, 1631, 29918, 13789, 29898, 7924, 8443, 13, 4706, 565, 3240, 338, 451, 6213, 29901, 30004, 13, 9651, 736, 3240, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 318, 5416, 353, 4867, 1839, 25118, 2033, 30004, 13, 9651, 411, 903, 29879, 10964, 29918, 908, 29901, 30004, 13, 18884, 903, 7924, 353, 903, 29879, 10964, 29961, 25118, 29962, 30004, 13, 18884, 7714, 353, 903, 7924, 1839, 908, 2033, 30004, 13, 18884, 7714, 29889, 562, 1548, 26471, 13, 9651, 1018, 29901, 30004, 13, 18884, 565, 525, 6786, 29915, 451, 297, 903, 7924, 29901, 30004, 13, 462, 1678, 396, 679, 8952, 1549, 2411, 1330, 284, 4371, 30004, 13, 462, 1678, 411, 14305, 1330, 403, 7373, 7924, 1125, 30004, 13, 462, 4706, 1857, 29918, 1792, 353, 903, 657, 29918, 1792, 29918, 978, 26471, 13, 462, 1678, 330, 29889, 3784, 29918, 1792, 353, 1857, 29918, 1792, 30004, 13, 462, 1678, 903, 7924, 1839, 6786, 2033, 353, 1857, 29918, 1792, 30004, 13, 462, 1678, 903, 7924, 1839, 4230, 29918, 5943, 2033, 353, 12865, 29889, 12673, 29889, 3707, 26471, 13, 18884, 1683, 29901, 30004, 13, 462, 1678, 330, 29889, 3784, 29918, 1792, 353, 903, 7924, 1839, 6786, 2033, 30004, 13, 9651, 7146, 29901, 30004, 13, 18884, 7714, 29889, 14096, 26471, 13, 9651, 396, 1246, 5782, 740, 30004, 13, 9651, 2933, 353, 740, 10456, 5085, 29892, 3579, 19290, 8443, 13, 9651, 565, 2933, 29901, 30004, 13, 18884, 2933, 353, 1207, 29918, 5327, 29898, 5327, 8443, 13, 9651, 736, 2933, 30004, 13, 30004, 13, 1678, 736, 10200, 630, 30004, 13, 2 ]
app/improving_agent/src/template_queries/drug_may_treat_disease.py
suihuanglab/evidARA
0
69481
<reponame>suihuanglab/evidARA<filename>app/improving_agent/src/template_queries/drug_may_treat_disease.py from improving_agent.models import Edge, EdgeBinding, NodeBinding, Result from improving_agent.src.biolink.spoke_biolink_constants import SPOKE_LABEL_COMPOUND from improving_agent.exceptions import TemplateQuerySpecError, UnmatchedIdentifierError from improving_agent.src.basic_query import BasicQuery from improving_agent.src.normalization.edge_normalization import ( BIOLINK_TREATS, BIOLINK_DISEASE, KNOWLEDGE_TYPE_INFERRED, SUPPORTED_INFERRED_DRUG_SUBJ ) from improving_agent.src.provenance import IMPROVING_AGENT_PROVENANCE_ATTR from improving_agent.src.psev import get_psev_scores from improving_agent.util import get_evidara_logger logger = get_evidara_logger(__name__) CYPHER_COMPOUND_SEARCH = """ MATCH (c:Compound) WHERE c.identifier in $identifiers RETURN c """ def extract_compound_result(record, querier): node_info = record['c'] identifier = node_info['identifier'] result_node = querier.make_result_node(node_info, identifier) return identifier, result_node def compound_search(tx, identifiers, querier): records = tx.run(CYPHER_COMPOUND_SEARCH, identifiers=identifiers) result_nodes = {} for record in records: identifier, result_node = extract_compound_result(record, querier) result_nodes[identifier] = result_node return result_nodes class DrugMayTreatDisease: template_query_name = 'Drug -- may treat -- Disease' # TODO: abstract if possible once other templates are known def __init__(self, qnodes, qedges, query_options, max_results): # query config self.qnodes = qnodes self.qedges = qedges self.query_options = query_options self.max_results = max_results # convenience references self.edge_id_treats = list(self.qedges.keys())[0] self.node_id_compound = self.qedges[self.edge_id_treats].subject self.node_id_disease = self.qedges[self.edge_id_treats].object # results self.knowledge_graph = None @staticmethod def matches_template(qedges, qnodes): if len(qedges) > 1: return False for qedge in qedges.values(): if ( qedge.knowledge_type != KNOWLEDGE_TYPE_INFERRED or qedge.predicates != [BIOLINK_TREATS] ): return False if len(qnodes) != 2: return False if not all(cat in SUPPORTED_INFERRED_DRUG_SUBJ for cat in qnodes[qedge.subject].categories): return False if qnodes[qedge.object].categories != [BIOLINK_DISEASE]: return False return True def make_result_edge(self, subj_id, obj_id): return Edge( predicate='biolink:treats', subject=subj_id, object=obj_id, attributes=[IMPROVING_AGENT_PROVENANCE_ATTR] ) def do_query(self, session): logger.info(f'Doing template query: {self.template_query_name}') # first get psev scores for concept; if we don't have it there's # no point continuing if len(self.query_options['psev_context']) > 1: raise TemplateQuerySpecError( f'For template query={self.template_query_name} imProving Agent ' 'expects exactly one disease specified on the object node. Disease ' 'identifier must map to Disease Ontology via the Node Normalizer.' ) disease_concept = self.query_options['psev_context'][0] compound_psev_scores = get_psev_scores([disease_concept], node_type=SPOKE_LABEL_COMPOUND)[disease_concept] if not compound_psev_scores: raise UnmatchedIdentifierError( f'No ML predictions available for disease equivalent to {disease_concept}' ) # do lookup basic_query = BasicQuery( self.qnodes, self.qedges, self.query_options, self.max_results ) results, knowledge_graph = basic_query.do_query(session) # sort compound_psev_scores count_to_get = self.max_results - len(results) sorted_compound_scores = { k: v for k, v in sorted(compound_psev_scores.items(), key=lambda item: item[1])[:count_to_get] } # remove the known to treat compounds from the top scored for node in knowledge_graph['nodes'].values(): for attribute in node.attributes: if attribute.original_attribute_name == 'identifier': try: sorted_compound_scores.pop(attribute.value) except KeyError: continue if not sorted_compound_scores: return results, knowledge_graph # now we can add the remaining highly scored results self.knowledge_graph = knowledge_graph new_results = [] node_ids = list(sorted_compound_scores.keys()) result_nodes = session.read_transaction(compound_search, node_ids, basic_query) for i, id_ in enumerate(result_nodes): result_edge = self.make_result_edge(id_, disease_concept) self.knowledge_graph['edges'][f'inferred_{i}'] = result_edge self.knowledge_graph['nodes'][id_] = result_nodes[id_] new_results.append(Result( node_bindings={self.node_id_disease: NodeBinding(disease_concept), self.node_id_compound: NodeBinding(id_)}, edge_bindings={self.edge_id_treats: EdgeBinding(f'inferred_{i}')}, score=sorted_compound_scores[id_] )) results = sorted(results + new_results, key=lambda x: x.score, reverse=True) return results, self.knowledge_graph
[ 1, 529, 276, 1112, 420, 29958, 29879, 1481, 6905, 574, 8205, 29914, 5750, 333, 1718, 29909, 29966, 9507, 29958, 932, 29914, 326, 771, 1747, 29918, 14748, 29914, 4351, 29914, 6886, 29918, 339, 6358, 29914, 29881, 11124, 29918, 13029, 29918, 2484, 271, 29918, 29881, 895, 559, 29889, 2272, 13, 3166, 4857, 1747, 29918, 14748, 29889, 9794, 1053, 21086, 29892, 21086, 9270, 29892, 9071, 9270, 29892, 7867, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4351, 29889, 5365, 324, 682, 29889, 1028, 6946, 29918, 5365, 324, 682, 29918, 3075, 1934, 1053, 10937, 29949, 6059, 29918, 24461, 6670, 29918, 21514, 29949, 18783, 13, 3166, 4857, 1747, 29918, 14748, 29889, 11739, 29879, 1053, 25663, 3010, 10299, 2392, 29892, 853, 4352, 287, 12889, 2392, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4351, 29889, 16121, 29918, 1972, 1053, 19219, 3010, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4351, 29889, 8945, 2133, 29889, 12864, 29918, 8945, 2133, 1053, 313, 13, 1678, 350, 29902, 5607, 1177, 29968, 29918, 29911, 1525, 1299, 29903, 29892, 13, 1678, 350, 29902, 5607, 1177, 29968, 29918, 4571, 1660, 8127, 29892, 13, 1678, 476, 6632, 29956, 20566, 1692, 29918, 11116, 29918, 24065, 1001, 19386, 29892, 13, 1678, 317, 4897, 15082, 3352, 29918, 24065, 1001, 19386, 29918, 8353, 23338, 29918, 20633, 29967, 13, 29897, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4351, 29889, 771, 854, 749, 1053, 306, 3580, 1672, 29963, 4214, 29918, 10051, 3919, 29918, 8618, 29963, 1430, 23219, 29918, 1299, 5659, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4351, 29889, 27358, 29894, 1053, 679, 29918, 27358, 29894, 29918, 1557, 2361, 13, 3166, 4857, 1747, 29918, 14748, 29889, 4422, 1053, 679, 29918, 5750, 333, 2518, 29918, 21707, 13, 13, 21707, 353, 679, 29918, 5750, 333, 2518, 29918, 21707, 22168, 978, 1649, 29897, 13, 13, 29907, 29979, 29925, 4448, 29918, 21514, 29949, 18783, 29918, 1660, 1718, 3210, 353, 9995, 13, 1678, 341, 14789, 313, 29883, 29901, 6843, 618, 29897, 13, 1678, 5754, 274, 29889, 25378, 297, 395, 1693, 14903, 13, 1678, 28081, 24015, 274, 13, 15945, 29908, 13, 13, 13, 1753, 6597, 29918, 2388, 618, 29918, 2914, 29898, 11651, 29892, 22320, 631, 1125, 13, 1678, 2943, 29918, 3888, 353, 2407, 1839, 29883, 2033, 13, 1678, 15882, 353, 2943, 29918, 3888, 1839, 25378, 2033, 13, 1678, 1121, 29918, 3177, 353, 22320, 631, 29889, 5675, 29918, 2914, 29918, 3177, 29898, 3177, 29918, 3888, 29892, 15882, 29897, 13, 1678, 736, 15882, 29892, 1121, 29918, 3177, 13, 13, 13, 1753, 752, 618, 29918, 4478, 29898, 7508, 29892, 2893, 14903, 29892, 22320, 631, 1125, 13, 1678, 6475, 353, 25568, 29889, 3389, 29898, 29907, 29979, 29925, 4448, 29918, 21514, 29949, 18783, 29918, 1660, 1718, 3210, 29892, 2893, 14903, 29922, 1693, 14903, 29897, 13, 1678, 1121, 29918, 18010, 353, 6571, 13, 1678, 363, 2407, 297, 6475, 29901, 13, 4706, 15882, 29892, 1121, 29918, 3177, 353, 6597, 29918, 2388, 618, 29918, 2914, 29898, 11651, 29892, 22320, 631, 29897, 13, 4706, 1121, 29918, 18010, 29961, 25378, 29962, 353, 1121, 29918, 3177, 13, 1678, 736, 1121, 29918, 18010, 13, 13, 13, 1990, 360, 11124, 12703, 29911, 276, 271, 29928, 895, 559, 29901, 13, 1678, 4472, 29918, 1972, 29918, 978, 353, 525, 29928, 11124, 1192, 1122, 7539, 1192, 360, 895, 559, 29915, 13, 13, 1678, 396, 14402, 29901, 9846, 565, 1950, 2748, 916, 17475, 526, 2998, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3855, 18010, 29892, 3855, 287, 2710, 29892, 2346, 29918, 6768, 29892, 4236, 29918, 9902, 1125, 13, 4706, 396, 2346, 2295, 13, 4706, 1583, 29889, 29939, 18010, 353, 3855, 18010, 13, 4706, 1583, 29889, 29939, 287, 2710, 353, 3855, 287, 2710, 13, 4706, 1583, 29889, 1972, 29918, 6768, 353, 2346, 29918, 6768, 13, 4706, 1583, 29889, 3317, 29918, 9902, 353, 4236, 29918, 9902, 13, 13, 4706, 396, 29703, 9282, 13, 4706, 1583, 29889, 12864, 29918, 333, 29918, 2484, 1446, 353, 1051, 29898, 1311, 29889, 29939, 287, 2710, 29889, 8149, 3101, 29961, 29900, 29962, 13, 4706, 1583, 29889, 3177, 29918, 333, 29918, 2388, 618, 353, 1583, 29889, 29939, 287, 2710, 29961, 1311, 29889, 12864, 29918, 333, 29918, 2484, 1446, 1822, 16009, 13, 4706, 1583, 29889, 3177, 29918, 333, 29918, 29881, 895, 559, 353, 1583, 29889, 29939, 287, 2710, 29961, 1311, 29889, 12864, 29918, 333, 29918, 2484, 1446, 1822, 3318, 13, 13, 4706, 396, 2582, 13, 4706, 1583, 29889, 28385, 5485, 29918, 4262, 353, 6213, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 7087, 29918, 6886, 29898, 29939, 287, 2710, 29892, 3855, 18010, 1125, 13, 4706, 565, 7431, 29898, 29939, 287, 2710, 29897, 1405, 29871, 29896, 29901, 13, 9651, 736, 7700, 13, 4706, 363, 3855, 12864, 297, 3855, 287, 2710, 29889, 5975, 7295, 13, 9651, 565, 313, 13, 18884, 3855, 12864, 29889, 28385, 5485, 29918, 1853, 2804, 476, 6632, 29956, 20566, 1692, 29918, 11116, 29918, 24065, 1001, 19386, 13, 18884, 470, 3855, 12864, 29889, 11965, 293, 1078, 2804, 518, 12809, 5607, 1177, 29968, 29918, 29911, 1525, 1299, 29903, 29962, 13, 632, 1125, 13, 18884, 736, 7700, 13, 4706, 565, 7431, 29898, 29939, 18010, 29897, 2804, 29871, 29906, 29901, 13, 9651, 736, 7700, 13, 4706, 565, 451, 599, 29898, 4117, 297, 317, 4897, 15082, 3352, 29918, 24065, 1001, 19386, 29918, 8353, 23338, 29918, 20633, 29967, 13, 462, 259, 363, 6635, 13, 462, 259, 297, 3855, 18010, 29961, 29939, 12864, 29889, 16009, 1822, 20683, 1125, 13, 9651, 736, 7700, 13, 4706, 565, 3855, 18010, 29961, 29939, 12864, 29889, 3318, 1822, 20683, 2804, 518, 12809, 5607, 1177, 29968, 29918, 4571, 1660, 8127, 5387, 13, 9651, 736, 7700, 13, 13, 4706, 736, 5852, 13, 13, 1678, 822, 1207, 29918, 2914, 29918, 12864, 29898, 1311, 29892, 1014, 29926, 29918, 333, 29892, 5446, 29918, 333, 1125, 13, 4706, 736, 21086, 29898, 13, 9651, 24384, 2433, 5365, 324, 682, 29901, 2484, 1446, 742, 13, 9651, 4967, 29922, 1491, 29926, 29918, 333, 29892, 13, 9651, 1203, 29922, 5415, 29918, 333, 29892, 13, 9651, 8393, 11759, 29902, 3580, 1672, 29963, 4214, 29918, 10051, 3919, 29918, 8618, 29963, 1430, 23219, 29918, 1299, 5659, 29962, 13, 4706, 1723, 13, 13, 1678, 822, 437, 29918, 1972, 29898, 1311, 29892, 4867, 1125, 13, 4706, 17927, 29889, 3888, 29898, 29888, 29915, 6132, 292, 4472, 2346, 29901, 426, 1311, 29889, 6886, 29918, 1972, 29918, 978, 29913, 1495, 13, 4706, 396, 937, 679, 10927, 29894, 19435, 363, 6964, 29936, 565, 591, 1016, 29915, 29873, 505, 372, 727, 29915, 29879, 13, 4706, 396, 694, 1298, 3133, 292, 13, 4706, 565, 7431, 29898, 1311, 29889, 1972, 29918, 6768, 1839, 27358, 29894, 29918, 4703, 11287, 1405, 29871, 29896, 29901, 13, 9651, 12020, 25663, 3010, 10299, 2392, 29898, 13, 18884, 285, 29915, 2831, 4472, 2346, 3790, 1311, 29889, 6886, 29918, 1972, 29918, 978, 29913, 527, 1184, 1747, 28330, 525, 13, 18884, 525, 17854, 29879, 3721, 697, 17135, 6790, 373, 278, 1203, 2943, 29889, 360, 895, 559, 525, 13, 18884, 525, 25378, 1818, 2910, 304, 360, 895, 559, 18265, 3002, 3025, 278, 9071, 21981, 3950, 6169, 13, 9651, 1723, 13, 4706, 17135, 29918, 535, 1547, 353, 1583, 29889, 1972, 29918, 6768, 1839, 27358, 29894, 29918, 4703, 2033, 29961, 29900, 29962, 13, 4706, 752, 618, 29918, 27358, 29894, 29918, 1557, 2361, 353, 679, 29918, 27358, 29894, 29918, 1557, 2361, 4197, 29881, 895, 559, 29918, 535, 1547, 1402, 2943, 29918, 1853, 29922, 5550, 29949, 6059, 29918, 24461, 6670, 29918, 21514, 29949, 18783, 9601, 29881, 895, 559, 29918, 535, 1547, 29962, 13, 4706, 565, 451, 752, 618, 29918, 27358, 29894, 29918, 1557, 2361, 29901, 13, 9651, 12020, 853, 4352, 287, 12889, 2392, 29898, 13, 18884, 285, 29915, 3782, 23158, 27303, 3625, 363, 17135, 7126, 304, 426, 29881, 895, 559, 29918, 535, 1547, 10162, 13, 9651, 1723, 13, 13, 4706, 396, 437, 16280, 13, 4706, 6996, 29918, 1972, 353, 19219, 3010, 29898, 13, 9651, 1583, 29889, 29939, 18010, 29892, 13, 9651, 1583, 29889, 29939, 287, 2710, 29892, 13, 9651, 1583, 29889, 1972, 29918, 6768, 29892, 13, 9651, 1583, 29889, 3317, 29918, 9902, 13, 4706, 1723, 13, 4706, 2582, 29892, 7134, 29918, 4262, 353, 6996, 29918, 1972, 29889, 1867, 29918, 1972, 29898, 7924, 29897, 13, 13, 4706, 396, 2656, 752, 618, 29918, 27358, 29894, 29918, 1557, 2361, 13, 4706, 2302, 29918, 517, 29918, 657, 353, 1583, 29889, 3317, 29918, 9902, 448, 7431, 29898, 9902, 29897, 13, 4706, 12705, 29918, 2388, 618, 29918, 1557, 2361, 353, 426, 13, 9651, 413, 29901, 325, 13, 9651, 363, 413, 29892, 325, 13, 9651, 297, 12705, 29898, 2388, 618, 29918, 27358, 29894, 29918, 1557, 2361, 29889, 7076, 3285, 1820, 29922, 2892, 2944, 29901, 2944, 29961, 29896, 2314, 7503, 2798, 29918, 517, 29918, 657, 29962, 13, 4706, 500, 13, 13, 4706, 396, 3349, 278, 2998, 304, 7539, 752, 3885, 515, 278, 2246, 15569, 13, 4706, 363, 2943, 297, 7134, 29918, 4262, 1839, 18010, 13359, 5975, 7295, 13, 9651, 363, 5352, 297, 2943, 29889, 15697, 29901, 13, 18884, 565, 5352, 29889, 13492, 29918, 12715, 29918, 978, 1275, 525, 25378, 2396, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 12705, 29918, 2388, 618, 29918, 1557, 2361, 29889, 7323, 29898, 12715, 29889, 1767, 29897, 13, 462, 1678, 5174, 7670, 2392, 29901, 13, 462, 4706, 6773, 13, 13, 4706, 565, 451, 12705, 29918, 2388, 618, 29918, 1557, 2361, 29901, 13, 9651, 736, 2582, 29892, 7134, 29918, 4262, 13, 13, 4706, 396, 1286, 591, 508, 788, 278, 9886, 10712, 15569, 2582, 13, 4706, 1583, 29889, 28385, 5485, 29918, 4262, 353, 7134, 29918, 4262, 13, 4706, 716, 29918, 9902, 353, 5159, 13, 13, 4706, 2943, 29918, 4841, 353, 1051, 29898, 24582, 29918, 2388, 618, 29918, 1557, 2361, 29889, 8149, 3101, 13, 4706, 1121, 29918, 18010, 353, 4867, 29889, 949, 29918, 20736, 29898, 2388, 618, 29918, 4478, 29892, 2943, 29918, 4841, 29892, 6996, 29918, 1972, 29897, 13, 13, 4706, 363, 474, 29892, 1178, 29918, 297, 26985, 29898, 2914, 29918, 18010, 1125, 13, 9651, 1121, 29918, 12864, 353, 1583, 29889, 5675, 29918, 2914, 29918, 12864, 29898, 333, 3383, 17135, 29918, 535, 1547, 29897, 13, 9651, 1583, 29889, 28385, 5485, 29918, 4262, 1839, 287, 2710, 2033, 29961, 29888, 29915, 262, 14373, 648, 29875, 29913, 2033, 353, 1121, 29918, 12864, 13, 9651, 1583, 29889, 28385, 5485, 29918, 4262, 1839, 18010, 2033, 29961, 333, 29918, 29962, 353, 1121, 29918, 18010, 29961, 333, 29918, 29962, 13, 9651, 716, 29918, 9902, 29889, 4397, 29898, 3591, 29898, 13, 18884, 2943, 29918, 5355, 886, 3790, 1311, 29889, 3177, 29918, 333, 29918, 29881, 895, 559, 29901, 9071, 9270, 29898, 29881, 895, 559, 29918, 535, 1547, 511, 13, 462, 1669, 1583, 29889, 3177, 29918, 333, 29918, 2388, 618, 29901, 9071, 9270, 29898, 333, 29918, 19230, 13, 18884, 7636, 29918, 5355, 886, 3790, 1311, 29889, 12864, 29918, 333, 29918, 2484, 1446, 29901, 21086, 9270, 29898, 29888, 29915, 262, 14373, 648, 29875, 29913, 1495, 1118, 13, 18884, 8158, 29922, 24582, 29918, 2388, 618, 29918, 1557, 2361, 29961, 333, 29918, 29962, 13, 632, 876, 13, 13, 4706, 2582, 353, 12705, 29898, 9902, 718, 716, 29918, 9902, 29892, 1820, 29922, 2892, 921, 29901, 921, 29889, 13628, 29892, 11837, 29922, 5574, 29897, 13, 4706, 736, 2582, 29892, 1583, 29889, 28385, 5485, 29918, 4262, 13, 2 ]
src/sellers/migrations/0002_rename_description_seller_descr.py
evis-market/web-interface-backend
2
61431
# Generated by Django 3.2.7 on 2021-10-03 15:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sellers', '0001_initial'), ] operations = [ migrations.RenameField( model_name='seller', old_name='description', new_name='descr', ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29941, 29889, 29906, 29889, 29955, 373, 29871, 29906, 29900, 29906, 29896, 29899, 29896, 29900, 29899, 29900, 29941, 29871, 29896, 29945, 29901, 29900, 29929, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 29879, 28257, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 29934, 3871, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 29879, 4539, 742, 13, 9651, 2030, 29918, 978, 2433, 8216, 742, 13, 9651, 716, 29918, 978, 2433, 2783, 7283, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
src/utils/auto_node_create.py
MoD-i/data-exchange-backend
0
95033
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # created_on: 2018-07-27 21:37 """ auto_node_create.py AIM: Automatically: 1. Install Multichain 2. Check/Use or Create new Node 3. Connect Node with MoD-i Blockchain Pre-requisites: 1. OS: Linux(Debian) or Windows 2. `sudo` password in Linux 3. Python >= 3.6 """ import os import subprocess import requests import socket import getpass from pathlib import Path import re import sys import logging __version__ = '1.0.0' __author__ = '<NAME> <<EMAIL>>' __copyright__ = 'Copyright (C) 2018 MoD-i. All rights reserved.' __license__ = 'Distributed under terms of the MIT license.' logger = logging.getLogger(__name__) HOSTNAME = socket.gethostname() USER = getpass.getuser() COUNT = 0 SUFFIX = 'node' HOME_DIR = str(Path.home()) BASE_NAME = f'{HOSTNAME}-{USER}-{SUFFIX}' NODE_NAME = f'{BASE_NAME}{COUNT}' NODE_DIR = os.path.join(HOME_DIR, NODE_NAME) REGEX = re.escape(BASE_NAME) + r'[0-9]+' RE_OBJ = re.compile(REGEX, re.IGNORECASE) EXISTING_NODES = [] ## # check if all-ready a MoD-i created default node present # default node name: {hostname}-{count}-node ## def check_node(): found = 0 for dirs in os.listdir(HOME_DIR): if RE_OBJ.match(dirs): found += 1 EXISTING_NODES.append(dirs) return found def create_node(): global NODE_DIR if len(EXISTING_NODES) > 0: logger.warning('Creating another node.') last_node_no = max(map(lambda node: int(node[-1]), EXISTING_NODES)) new_node_no = last_node_no + 1 os.mkdir(os.path.join(HOME_DIR, BASE_NAME + str(new_node_no))) NODE_DIR = str(os.path.join(HOME_DIR, BASE_NAME + str(new_node_no))) else: logger.warning('Creating new node.') os.mkdir(NODE_DIR) def connect_node(): global NODE_DIR print('command\n:', NODE_DIR) # p = subprocess.run(['multichaind', f'-datadir={NODE_DIR}', '[email protected]:2657'], shell=True, # p = subprocess.run(['multichaind -datadir=/home/toran/mint-ThinkPad-L440-root-node0 [email protected]:2657'], shell=True, p = subprocess.run([f'multichaind -datadir={NODE_DIR} [email protected]:2657'], shell=True, stdout=subprocess.PIPE) res = p.stdout.decode() print(res) def install_multichain(): # TODO: check if already installed and skip os.chdir('/tmp/') subprocess.run(['wget', 'https://www.multichain.com/download/multichain-1.0.5.tar.gz']) subprocess.run(['tar', '-xvzf', 'multichain-1.0.5.tar.gz']) os.chdir('multichain-1.0.5') subprocess.run(['sudo', 'mv', 'multichaind', 'multichain-cli', 'multichain-util', '/usr/local/bin']) if __name__ == '__main__': found = check_node() if found==1: print(f'There is already {found} nodes linked to the MoD-i blockchain') elif found>1: print(f'There are already {found} nodes linked to the MoD-i blockchain') while True: if found == 0: user_inp = input("Do you want to create a node [y/n] : ") else: user_inp = input("Do you still want to create a new node [y/n] : ") if user_inp.lower() in ('n', 'no'): logger.info('Aborted. Exiting.') sys.exit() elif user_inp.lower() in ('y', 'yes'): install_multichain() logger.info('multichain installed') create_node() logger.info('One node created.') connect_node() logger.info('Node connected.') # TODO: Tell datadir, chain name etc sys.exit() else: print('Please enter a valid option') logger.info('Invaid option entered.')
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 325, 326, 29901, 29888, 3977, 29922, 9420, 29899, 29947, 13, 29937, 2825, 29918, 265, 29901, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29955, 29899, 29906, 29955, 29871, 29906, 29896, 29901, 29941, 29955, 13, 13, 15945, 29908, 13, 6921, 29918, 3177, 29918, 3258, 29889, 2272, 13, 13, 29909, 7833, 29901, 15854, 19574, 29901, 13, 308, 29896, 29889, 16052, 9683, 436, 475, 13, 308, 29906, 29889, 5399, 29914, 11403, 470, 6204, 716, 9071, 13, 308, 29941, 29889, 14971, 9071, 411, 4546, 29928, 29899, 29875, 15658, 14153, 13, 6572, 29899, 276, 7680, 3246, 29901, 13, 268, 29896, 29889, 6570, 29901, 8074, 29898, 10251, 713, 29897, 470, 3852, 13, 268, 29906, 29889, 421, 15360, 29952, 4800, 297, 8074, 13, 268, 29941, 29889, 5132, 6736, 29871, 29941, 29889, 29953, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 1014, 5014, 13, 5215, 7274, 13, 5215, 9909, 13, 5215, 679, 3364, 13, 3166, 2224, 1982, 1053, 10802, 13, 5215, 337, 13, 5215, 10876, 13, 5215, 12183, 13, 13, 13, 1649, 3259, 1649, 353, 525, 29896, 29889, 29900, 29889, 29900, 29915, 13, 1649, 8921, 1649, 353, 12801, 5813, 29958, 29871, 3532, 26862, 6227, 6778, 29915, 13, 1649, 8552, 1266, 1649, 353, 525, 11882, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29947, 4546, 29928, 29899, 29875, 29889, 2178, 10462, 21676, 6169, 13, 1649, 506, 1947, 1649, 353, 525, 13398, 7541, 1090, 4958, 310, 278, 341, 1806, 19405, 6169, 13, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 20832, 5813, 353, 9909, 29889, 29887, 621, 520, 978, 580, 13, 11889, 353, 679, 3364, 29889, 657, 1792, 580, 13, 18736, 353, 29871, 29900, 13, 14605, 29943, 25634, 353, 525, 3177, 29915, 13, 17353, 29918, 9464, 353, 851, 29898, 2605, 29889, 5184, 3101, 13, 25416, 29918, 5813, 353, 285, 29915, 29912, 20832, 5813, 7402, 29912, 11889, 7402, 29912, 14605, 29943, 25634, 10162, 13, 6632, 2287, 29918, 5813, 353, 285, 29915, 29912, 25416, 29918, 5813, 1157, 18736, 10162, 13, 6632, 2287, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 17353, 29918, 9464, 29892, 11698, 2287, 29918, 5813, 29897, 13, 1525, 1692, 29990, 353, 337, 29889, 21587, 29898, 25416, 29918, 5813, 29897, 718, 364, 29915, 29961, 29900, 29899, 29929, 10062, 29915, 13, 1525, 29918, 14824, 29967, 353, 337, 29889, 12198, 29898, 1525, 1692, 29990, 29892, 337, 29889, 6259, 6632, 1525, 23487, 29897, 13, 5746, 9047, 4214, 29918, 6632, 2287, 29903, 353, 5159, 13, 13, 13, 2277, 13, 29937, 1423, 565, 599, 29899, 2040, 263, 4546, 29928, 29899, 29875, 2825, 2322, 2943, 2198, 29871, 13, 29937, 2322, 2943, 1024, 29901, 426, 28988, 7402, 29912, 2798, 7402, 3177, 13, 2277, 13, 13, 1753, 1423, 29918, 3177, 7295, 13, 1678, 1476, 353, 29871, 29900, 13, 13, 1678, 363, 4516, 29879, 297, 2897, 29889, 1761, 3972, 29898, 17353, 29918, 9464, 1125, 13, 4706, 565, 5195, 29918, 14824, 29967, 29889, 4352, 29898, 3972, 29879, 1125, 13, 9651, 1476, 4619, 29871, 29896, 13, 9651, 8528, 9047, 4214, 29918, 6632, 2287, 29903, 29889, 4397, 29898, 3972, 29879, 29897, 13, 1678, 736, 1476, 29871, 13, 13, 13, 1753, 1653, 29918, 3177, 7295, 13, 1678, 5534, 11698, 2287, 29918, 9464, 13, 1678, 565, 7431, 29898, 5746, 9047, 4214, 29918, 6632, 2287, 29903, 29897, 1405, 29871, 29900, 29901, 13, 4706, 17927, 29889, 27392, 877, 9832, 1218, 1790, 2943, 29889, 1495, 13, 4706, 1833, 29918, 3177, 29918, 1217, 353, 4236, 29898, 1958, 29898, 2892, 2943, 29901, 938, 29898, 3177, 14352, 29896, 11724, 8528, 9047, 4214, 29918, 6632, 2287, 29903, 876, 13, 4706, 716, 29918, 3177, 29918, 1217, 353, 1833, 29918, 3177, 29918, 1217, 718, 29871, 29896, 13, 4706, 2897, 29889, 11256, 3972, 29898, 359, 29889, 2084, 29889, 7122, 29898, 17353, 29918, 9464, 29892, 350, 8127, 29918, 5813, 718, 851, 29898, 1482, 29918, 3177, 29918, 1217, 4961, 13, 4706, 11698, 2287, 29918, 9464, 353, 851, 29898, 359, 29889, 2084, 29889, 7122, 29898, 17353, 29918, 9464, 29892, 350, 8127, 29918, 5813, 718, 851, 29898, 1482, 29918, 3177, 29918, 1217, 4961, 13, 1678, 1683, 29901, 13, 4706, 17927, 29889, 27392, 877, 9832, 1218, 716, 2943, 29889, 1495, 13, 4706, 2897, 29889, 11256, 3972, 29898, 6632, 2287, 29918, 9464, 29897, 13, 13, 268, 13, 1753, 4511, 29918, 3177, 7295, 13, 1678, 5534, 11698, 2287, 29918, 9464, 13, 1678, 1596, 877, 6519, 29905, 29876, 29901, 742, 11698, 2287, 29918, 9464, 29897, 13, 1678, 396, 282, 353, 1014, 5014, 29889, 3389, 18959, 4713, 436, 475, 29881, 742, 285, 28560, 4130, 328, 381, 3790, 6632, 2287, 29918, 9464, 29913, 742, 525, 1271, 29899, 14153, 29992, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29896, 29955, 29889, 29941, 29906, 29901, 29906, 29953, 29945, 29955, 7464, 6473, 29922, 5574, 29892, 29871, 13, 1678, 396, 282, 353, 1014, 5014, 29889, 3389, 18959, 4713, 436, 475, 29881, 448, 4130, 328, 381, 14327, 5184, 29914, 7345, 273, 29914, 29885, 524, 29899, 1349, 682, 20369, 29899, 29931, 29946, 29946, 29900, 29899, 4632, 29899, 3177, 29900, 2908, 29899, 14153, 29992, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29896, 29955, 29889, 29941, 29906, 29901, 29906, 29953, 29945, 29955, 7464, 6473, 29922, 5574, 29892, 29871, 13, 1678, 282, 353, 1014, 5014, 29889, 3389, 4197, 29888, 29915, 4713, 436, 475, 29881, 448, 4130, 328, 381, 3790, 6632, 2287, 29918, 9464, 29913, 2908, 29899, 14153, 29992, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29896, 29955, 29889, 29941, 29906, 29901, 29906, 29953, 29945, 29955, 7464, 6473, 29922, 5574, 29892, 29871, 13, 4706, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 620, 353, 282, 29889, 25393, 29889, 13808, 580, 13, 1678, 1596, 29898, 690, 29897, 13, 13, 13, 1753, 2601, 29918, 4713, 436, 475, 7295, 13, 1678, 396, 14402, 29901, 1423, 565, 2307, 5130, 322, 14383, 13, 1678, 2897, 29889, 305, 3972, 11219, 7050, 29914, 1495, 13, 1678, 1014, 5014, 29889, 3389, 18959, 29893, 657, 742, 525, 991, 597, 1636, 29889, 4713, 436, 475, 29889, 510, 29914, 10382, 29914, 4713, 436, 475, 29899, 29896, 29889, 29900, 29889, 29945, 29889, 12637, 29889, 18828, 11287, 13, 1678, 1014, 5014, 29889, 3389, 18959, 12637, 742, 17411, 29916, 29894, 29920, 29888, 742, 525, 4713, 436, 475, 29899, 29896, 29889, 29900, 29889, 29945, 29889, 12637, 29889, 18828, 11287, 13, 1678, 2897, 29889, 305, 3972, 877, 4713, 436, 475, 29899, 29896, 29889, 29900, 29889, 29945, 1495, 13, 1678, 1014, 5014, 29889, 3389, 18959, 15360, 742, 525, 29324, 742, 525, 4713, 436, 475, 29881, 742, 525, 4713, 436, 475, 29899, 11303, 742, 525, 4713, 436, 475, 29899, 4422, 742, 8207, 4855, 29914, 2997, 29914, 2109, 11287, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1476, 353, 1423, 29918, 3177, 580, 13, 1678, 565, 1476, 1360, 29896, 29901, 13, 4706, 1596, 29898, 29888, 29915, 8439, 338, 2307, 426, 11940, 29913, 7573, 9024, 304, 278, 4546, 29928, 29899, 29875, 2908, 14153, 1495, 13, 1678, 25342, 1476, 29958, 29896, 29901, 13, 4706, 1596, 29898, 29888, 29915, 8439, 526, 2307, 426, 11940, 29913, 7573, 9024, 304, 278, 4546, 29928, 29899, 29875, 2908, 14153, 1495, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 565, 1476, 1275, 29871, 29900, 29901, 13, 9651, 1404, 29918, 262, 29886, 353, 1881, 703, 6132, 366, 864, 304, 1653, 263, 2943, 518, 29891, 29914, 29876, 29962, 584, 16521, 13, 4706, 1683, 29901, 632, 13, 9651, 1404, 29918, 262, 29886, 353, 1881, 703, 6132, 366, 1603, 864, 304, 1653, 263, 716, 2943, 518, 29891, 29914, 29876, 29962, 584, 16521, 13, 4706, 565, 1404, 29918, 262, 29886, 29889, 13609, 580, 297, 6702, 29876, 742, 525, 1217, 29374, 13, 9651, 17927, 29889, 3888, 877, 4920, 18054, 29889, 1222, 11407, 29889, 1495, 13, 9651, 10876, 29889, 13322, 580, 13, 4706, 25342, 1404, 29918, 262, 29886, 29889, 13609, 580, 297, 6702, 29891, 742, 525, 3582, 29374, 13, 9651, 2601, 29918, 4713, 436, 475, 580, 13, 9651, 17927, 29889, 3888, 877, 4713, 436, 475, 5130, 1495, 13, 9651, 1653, 29918, 3177, 580, 13, 9651, 17927, 29889, 3888, 877, 6716, 2943, 2825, 29889, 1495, 13, 9651, 4511, 29918, 3177, 580, 13, 9651, 17927, 29889, 3888, 877, 4247, 6631, 29889, 1495, 13, 9651, 396, 14402, 29901, 24948, 1418, 328, 381, 29892, 9704, 1024, 2992, 13, 9651, 10876, 29889, 13322, 580, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 12148, 3896, 263, 2854, 2984, 1495, 13, 9651, 17927, 29889, 3888, 877, 797, 1564, 333, 2984, 7802, 29889, 1495, 13, 2 ]
src/terial/web/views/classifier_views.py
keunhong/photoshape
81
69563
<reponame>keunhong/photoshape import logging import math import subprocess import json from collections import defaultdict from pathlib import Path import aiohttp_jinja2 import uuid from aiohttp import web import numpy as np from multidict import MultiDict import toolbox.web from terial import config, models, controllers from terial.classifier.inference.utils import compute_weighted_scores from terial.database import session_scope logger = logging.getLogger(__name__) def get_model_inference_dir(snapshot_name, model_name): snapshot_dir = config.BRDF_CLASSIFIER_SNAPSHOTS_DIR / snapshot_name return snapshot_dir / 'inference' / model_name @aiohttp_jinja2.template('classifier/list_models.html') async def list_models(request: web.Request): models_by_snapshot = defaultdict(list) snapshot_paths = list(reversed(sorted( (config.BRDF_CLASSIFIER_DIR_REMOTE / 'lmdb').iterdir()))) snapshot_paths.extend(reversed(sorted( config.BRDF_CLASSIFIER_SNAPSHOTS_DIR.iterdir()))) for snapshot_path in snapshot_paths: snapshot_name = snapshot_path.name checkpoint_dir = Path(config.BRDF_CLASSIFIER_DIR_REMOTE, 'checkpoints', snapshot_name) if not checkpoint_dir.exists(): continue model_json_paths = reversed(sorted( checkpoint_dir.glob('*/model_params.json'))) for model_json_path in model_json_paths: model_name = model_json_path.parent.name with model_json_path.open('r') as f: model_params = json.load(f) best_stats_path = model_json_path.parent / 'model_best_stats.json' if best_stats_path.exists(): with best_stats_path.open('r') as f: best_stats = json.load(f) else: best_stats = None snapshot_name = snapshot_path.name model_inference_dir = (config.BRDF_CLASSIFIER_DIR_REMOTE / 'inference' / snapshot_name / model_name) if model_inference_dir.exists(): inference_epochs = [p.name for p in model_inference_dir.iterdir()] else: inference_epochs = [] models_by_snapshot[snapshot_name].append({ 'params': model_params, 'best_stats': best_stats, 'snapshot_name': snapshot_path.name, 'model_name': model_json_path.parent.name, 'model_path': str(model_json_path), 'inference_epochs': inference_epochs, }) return { 'models_by_snapshot': models_by_snapshot, } @aiohttp_jinja2.template('classifier/list_models_ablation.html') async def list_models_ablation(request: web.Request): models_by_snapshot = defaultdict(list) snapshot_paths = list(reversed(sorted( (config.BRDF_CLASSIFIER_DIR_REMOTE / 'lmdb').iterdir()))) snapshot_paths.extend(reversed(sorted( config.BRDF_CLASSIFIER_SNAPSHOTS_DIR.iterdir()))) for snapshot_path in snapshot_paths: snapshot_name = snapshot_path.name checkpoint_dir = Path(config.BRDF_CLASSIFIER_DIR_REMOTE, 'checkpoints', snapshot_name) if not checkpoint_dir.exists(): continue model_json_paths = reversed(sorted( checkpoint_dir.glob('*/model_params.json'))) for model_json_path in model_json_paths: model_name = model_json_path.parent.name with model_json_path.open('r') as f: model_params = json.load(f) best_stats_path = model_json_path.parent / 'model_best_stats.json' if best_stats_path.exists(): with best_stats_path.open('r') as f: best_stats = json.load(f) else: best_stats = None train_stats_path = model_json_path.parent / 'model_train_stats.json' if train_stats_path.exists(): try: with train_stats_path.open('r') as f: train_stats = json.load(f) except json.JSONDecodeError: train_stats = None else: train_stats = None snapshot_name = snapshot_path.name model_inference_dir = (config.BRDF_CLASSIFIER_DIR_REMOTE / 'inference' / snapshot_name / model_name) if model_inference_dir.exists(): inference_epochs = [p.name for p in model_inference_dir.iterdir()] else: inference_epochs = [] models_by_snapshot[snapshot_name].append({ 'params': model_params, 'best_stats': best_stats, 'train_stats': train_stats, 'snapshot_name': snapshot_path.name, 'model_name': model_json_path.parent.name, 'model_path': str(model_json_path), 'inference_epochs': inference_epochs, }) return { 'models_by_snapshot': models_by_snapshot, } async def download_blend_file(request: web.Request): inference_path = request.query.get('inference_path', None) if not inference_path: raise web.HTTPNotFound() inference_path = Path(inference_path) if not inference_path.exists(): raise web.HTTPNotFound() animate = request.query.get('animate', 'false') == 'true' no_floor = request.query.get('no_floor', 'false') == 'true' scene_type = request.query.get('type', 'inferred') if scene_type not in {'inferred', 'mtl'}: raise web.HTTPBadRequest(text="Invalid scene type.") filename = Path('/tmp', f'{uuid.uuid4()}.blend') command = [ 'python', '-m', 'terial.classifier.rendering.create_blend_file', str(inference_path), filename, '--pack-assets', '--type', scene_type, '--use-weighted-scores', # '--use-minc-substances', ] if animate: command.append('--animate') if no_floor: command.append('--no-floor') logger.info('Launching command %s', str(command)) subprocess.call(command) if animate: out_name = f'{inference_path.stem}.{scene_type}.anim.blend' else: out_name = f'{inference_path.stem}.{scene_type}.blend' response = web.StreamResponse( status=200, headers=MultiDict({ 'Content-Disposition': f'attachment; filename={out_name}' }), ) await response.prepare(request) with filename.open('rb') as f: await response.write(f.read()) await response.write_eof() return response @aiohttp_jinja2.template('classifier/inference_results_detailed.html') async def show_inference_results_detailed(request): return await show_inference_results(request) @aiohttp_jinja2.template('classifier/inference_results_simple.html') async def show_inference_results_simple(request): return await show_inference_results(request) async def show_inference_results(request: web.Request): snapshot_name = request.match_info.get('snapshot') model_name = request.match_info.get('model') epoch = request.match_info.get('epoch') page = int(request.query.get('page', 0)) page_size = int(request.query.get('page_size', 12)) topk = int(request.query.get('topk', 3)) shape_ids = request.query.get('shape_ids', None) pair_ids = request.query.get('pair_ids', None) shape_source = request.query.get('shape_source', None) shape_category = request.query.get('shape_category', None) max_dist = float(request.query.get('max_dist', config.INFERENCE_MAX_DIST)) if shape_ids is not None: shape_ids = shape_ids.replace(' ', '').strip(', ') shape_ids = [int(i) for i in shape_ids.split(',')] if pair_ids is not None: pair_ids = pair_ids.replace(' ', '').strip(', ') pair_ids = [int(i) for i in pair_ids.split(',')] if model_name is None: raise web.HTTPBadRequest() if snapshot_name is None: raise web.HTTPBadRequest() snapshot_dir = config.BRDF_CLASSIFIER_DIR_REMOTE / 'snapshots' / snapshot_name if not snapshot_dir.exists(): snapshot_dir = config.BRDF_CLASSIFIER_DIR_REMOTE / 'lmdb' / snapshot_name if not snapshot_dir.exists(): raise web.HTTPNotFound() inference_dir = (config.BRDF_CLASSIFIER_DIR_REMOTE / 'inference' / snapshot_name / model_name / epoch) if not inference_dir.exists(): raise web.HTTPNotFound() if (snapshot_dir / 'snapshot.json').exists(): with (snapshot_dir / 'snapshot.json').open('r') as f: snapshot_dict = json.load(f) else: with (snapshot_dir / 'meta.json').open('r') as f: snapshot_dict = json.load(f) filters = [] if shape_ids: filters.append(models.Shape.id.in_(shape_ids)) if pair_ids: filters.append(models.ExemplarShapePair.id.in_(pair_ids)) if shape_source: filters.append(models.Shape.source == shape_source) if shape_category: filters.append(models.Shape.category == shape_category) if topk: filters.append(models.ExemplarShapePair.rank <= topk) with session_scope() as sess: materials, _ = controllers.fetch_materials(sess) mat_by_id = { m.id: m for m in materials } shapes, count, pair_count = controllers.fetch_shapes_with_pairs( sess, page=page, page_size=page_size, filters=filters, max_dist=max_dist) results_by_shape = _aggregate_shape_inferences( inference_dir, mat_by_id, shapes, topk=topk, max_dist=max_dist) n_pages = int(math.ceil(count / page_size)) return { 'snapshot_name': snapshot_name, 'dataset_name': snapshot_dict.get( 'dataset_name', snapshot_dict.get('dataset', '<unknown dataset>')), 'model_name': model_name, 'epoch': epoch, 'cur_page': page, 'page_size': page_size, 'n_total': count, 'n_pairs': pair_count, 'n_pages': n_pages, 'results_by_shape': results_by_shape, 'mat_by_id': mat_by_id, } def _aggregate_shape_inferences(inference_dir, mat_by_id, shapes, topk, max_dist): results_by_shape = defaultdict(list) for shape in shapes: pairs = shape.get_topk_pairs(topk, max_dist) for pair in pairs: pair_inference = compute_pair_inference( inference_dir, mat_by_id, pair) if pair_inference is None: continue results_by_shape[pair.shape].append(pair_inference) return results_by_shape def compute_pair_inference(inference_dir, mat_by_id, pair): # seg_substances = compute_segment_substances(pair, return_ids=True) seg_substances = None json_path = Path(inference_dir, f'{pair.id}.json') if not json_path.exists(): logger.info('JSON path %s does not exist', json_path) return None with json_path.open('r') as f: inference_dict = json.load(f) try: seg_map = pair.load_data(config.PAIR_SHAPE_CLEAN_SEGMENT_MAP_NAME) - 1 except FileNotFoundError: seg_map = pair.load_data(config.PAIR_SHAPE_CLEAN_SEGMENT_MAP_NAME_OLD) - 1 seg_mask_by_seg_id = {} for seg_id in np.unique(seg_map): if seg_id == -1: continue seg_mask_by_seg_id[str(seg_id)] = toolbox.web.image_to_base64( (seg_map == seg_id).astype(np.uint8) * 255) # _remove_disabled_materials(inference_dict, mat_by_id) compute_weighted_scores(inference_dict, mat_by_id, sort=True, force_substances=True) rend_baseline_path = (config.BRDF_CLASSIFIER_DIR_REMOTE / 'inference' / 'random' / 'renderings-cropped' / f'{pair.id}.inferred.0000.jpg') rend_minc_inferred_path = (inference_dir.parent / '45-minc-subst' / 'renderings-cropped' / f'{pair.id}.inferred.0000.jpg') rend_inferred_path = (inference_dir / 'renderings-cropped' / f'{pair.id}.inferred.0000.jpg') # if not rend_inferred_path.exists(): # rend_inferred_path = (inference_dir / 'renderings-aligned-cropped' # / f'{pair.id}.inferred.0000.jpg') # if not rend_inferred_path.exists(): # rend_inferred_path = (inference_dir / 'renderings-cropped' # / f'{pair.id}.inferred.0000.jpg') rend_inferred_frontal_path = (inference_dir / 'renderings-frontal' / f'{pair.id}.inferred.0000.jpg') rend_mtl_path = (config.BRDF_CLASSIFIER_DIR_REMOTE / 'inference' / 'default' / 'renderings-cropped' / f'{pair.id}.mtl.0000.jpg') # rend_mtl_path = (inference_dir / 'renderings' # / f'{pair.id}.mtl.0000.png') rendering_path = inference_dir / 'renderings' / f'{pair.id}.png' return { 'pair': pair, 'shape': pair.shape, 'exemplar': pair.exemplar, 'seg_mask_by_seg_id': seg_mask_by_seg_id, 'rend_inferred_path': rend_inferred_path, 'rend_inferred_frontal_path': rend_inferred_frontal_path, 'rend_minc_inferred_path': rend_minc_inferred_path, 'rend_mtl_path': rend_mtl_path, 'rend_baseline_path': rend_baseline_path, 'rendering_path': rendering_path, 'inference_path': json_path, **inference_dict, } def _remove_disabled_materials(inference_dict, mat_by_id): for seg_id, seg_topk in inference_dict['segments'].items(): seg_new_topk = [] for match in seg_topk['material']: mat = mat_by_id[match['id']] if mat.enabled: seg_new_topk.append(match) seg_topk['material'] = seg_new_topk
[ 1, 529, 276, 1112, 420, 29958, 446, 348, 29882, 549, 29914, 561, 15788, 14443, 13, 5215, 12183, 13, 5215, 5844, 13, 5215, 1014, 5014, 13, 5215, 4390, 13, 3166, 16250, 1053, 2322, 8977, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 5215, 263, 601, 1124, 29918, 28789, 1764, 29906, 13, 13, 5215, 318, 5416, 13, 3166, 263, 601, 1124, 1053, 1856, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 1773, 333, 919, 1053, 14974, 21533, 13, 13, 5215, 5780, 1884, 29889, 2676, 13, 3166, 1935, 616, 1053, 2295, 29892, 4733, 29892, 21385, 13, 3166, 1935, 616, 29889, 1990, 3709, 29889, 262, 1659, 29889, 13239, 1053, 10272, 29918, 7915, 287, 29918, 1557, 2361, 13, 3166, 1935, 616, 29889, 9803, 1053, 4867, 29918, 6078, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 679, 29918, 4299, 29918, 262, 1659, 29918, 3972, 29898, 29879, 14551, 29918, 978, 29892, 1904, 29918, 978, 1125, 13, 1678, 22395, 29918, 3972, 353, 2295, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 19296, 3301, 7068, 2891, 29903, 29918, 9464, 847, 22395, 29918, 978, 13, 1678, 736, 22395, 29918, 3972, 847, 525, 262, 1659, 29915, 847, 1904, 29918, 978, 13, 13, 13, 29992, 29874, 601, 1124, 29918, 28789, 1764, 29906, 29889, 6886, 877, 1990, 3709, 29914, 1761, 29918, 9794, 29889, 1420, 1495, 13, 12674, 822, 1051, 29918, 9794, 29898, 3827, 29901, 1856, 29889, 3089, 1125, 13, 1678, 4733, 29918, 1609, 29918, 29879, 14551, 353, 2322, 8977, 29898, 1761, 29897, 13, 13, 1678, 22395, 29918, 24772, 353, 1051, 29898, 276, 874, 287, 29898, 24582, 29898, 13, 4706, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 21457, 2585, 2824, 1524, 3972, 580, 4961, 13, 13, 1678, 22395, 29918, 24772, 29889, 21843, 29898, 276, 874, 287, 29898, 24582, 29898, 13, 4706, 2295, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 19296, 3301, 7068, 2891, 29903, 29918, 9464, 29889, 1524, 3972, 580, 4961, 13, 13, 13, 1678, 363, 22395, 29918, 2084, 297, 22395, 29918, 24772, 29901, 13, 4706, 22395, 29918, 978, 353, 22395, 29918, 2084, 29889, 978, 13, 4706, 1423, 3149, 29918, 3972, 353, 10802, 29898, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 29892, 13, 462, 795, 525, 3198, 9748, 742, 22395, 29918, 978, 29897, 13, 4706, 565, 451, 1423, 3149, 29918, 3972, 29889, 9933, 7295, 13, 9651, 6773, 13, 4706, 1904, 29918, 3126, 29918, 24772, 353, 18764, 287, 29898, 24582, 29898, 13, 9651, 1423, 3149, 29918, 3972, 29889, 23705, 877, 3877, 4299, 29918, 7529, 29889, 3126, 29915, 4961, 13, 4706, 363, 1904, 29918, 3126, 29918, 2084, 297, 1904, 29918, 3126, 29918, 24772, 29901, 13, 9651, 1904, 29918, 978, 353, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 29889, 978, 13, 9651, 411, 1904, 29918, 3126, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 18884, 1904, 29918, 7529, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 9651, 1900, 29918, 16202, 29918, 2084, 353, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 847, 525, 4299, 29918, 13318, 29918, 16202, 29889, 3126, 29915, 13, 9651, 565, 1900, 29918, 16202, 29918, 2084, 29889, 9933, 7295, 13, 18884, 411, 1900, 29918, 16202, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 462, 1678, 1900, 29918, 16202, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 9651, 1683, 29901, 13, 18884, 1900, 29918, 16202, 353, 6213, 13, 13, 9651, 22395, 29918, 978, 353, 22395, 29918, 2084, 29889, 978, 13, 13, 9651, 1904, 29918, 262, 1659, 29918, 3972, 353, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 262, 1659, 29915, 13, 462, 462, 259, 847, 22395, 29918, 978, 847, 1904, 29918, 978, 29897, 13, 9651, 565, 1904, 29918, 262, 1659, 29918, 3972, 29889, 9933, 7295, 13, 18884, 27262, 29918, 1022, 2878, 29879, 353, 518, 29886, 29889, 978, 363, 282, 297, 1904, 29918, 262, 1659, 29918, 3972, 29889, 1524, 3972, 580, 29962, 13, 9651, 1683, 29901, 13, 18884, 27262, 29918, 1022, 2878, 29879, 353, 5159, 13, 13, 9651, 4733, 29918, 1609, 29918, 29879, 14551, 29961, 29879, 14551, 29918, 978, 1822, 4397, 3319, 13, 18884, 525, 7529, 2396, 1904, 29918, 7529, 29892, 13, 18884, 525, 13318, 29918, 16202, 2396, 1900, 29918, 16202, 29892, 13, 18884, 525, 29879, 14551, 29918, 978, 2396, 22395, 29918, 2084, 29889, 978, 29892, 13, 18884, 525, 4299, 29918, 978, 2396, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 29889, 978, 29892, 13, 18884, 525, 4299, 29918, 2084, 2396, 851, 29898, 4299, 29918, 3126, 29918, 2084, 511, 13, 18884, 525, 262, 1659, 29918, 1022, 2878, 29879, 2396, 27262, 29918, 1022, 2878, 29879, 29892, 13, 9651, 5615, 13, 13, 1678, 736, 426, 13, 4706, 525, 9794, 29918, 1609, 29918, 29879, 14551, 2396, 4733, 29918, 1609, 29918, 29879, 14551, 29892, 13, 1678, 500, 13, 13, 13, 29992, 29874, 601, 1124, 29918, 28789, 1764, 29906, 29889, 6886, 877, 1990, 3709, 29914, 1761, 29918, 9794, 29918, 12478, 362, 29889, 1420, 1495, 13, 12674, 822, 1051, 29918, 9794, 29918, 12478, 362, 29898, 3827, 29901, 1856, 29889, 3089, 1125, 13, 1678, 4733, 29918, 1609, 29918, 29879, 14551, 353, 2322, 8977, 29898, 1761, 29897, 13, 13, 1678, 22395, 29918, 24772, 353, 1051, 29898, 276, 874, 287, 29898, 24582, 29898, 13, 4706, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 21457, 2585, 2824, 1524, 3972, 580, 4961, 13, 13, 1678, 22395, 29918, 24772, 29889, 21843, 29898, 276, 874, 287, 29898, 24582, 29898, 13, 4706, 2295, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 19296, 3301, 7068, 2891, 29903, 29918, 9464, 29889, 1524, 3972, 580, 4961, 13, 13, 1678, 363, 22395, 29918, 2084, 297, 22395, 29918, 24772, 29901, 13, 4706, 22395, 29918, 978, 353, 22395, 29918, 2084, 29889, 978, 13, 4706, 1423, 3149, 29918, 3972, 353, 10802, 29898, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 29892, 525, 3198, 9748, 742, 13, 462, 795, 22395, 29918, 978, 29897, 13, 4706, 565, 451, 1423, 3149, 29918, 3972, 29889, 9933, 7295, 13, 9651, 6773, 13, 4706, 1904, 29918, 3126, 29918, 24772, 353, 18764, 287, 29898, 24582, 29898, 13, 9651, 1423, 3149, 29918, 3972, 29889, 23705, 877, 3877, 4299, 29918, 7529, 29889, 3126, 29915, 4961, 13, 4706, 363, 1904, 29918, 3126, 29918, 2084, 297, 1904, 29918, 3126, 29918, 24772, 29901, 13, 9651, 1904, 29918, 978, 353, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 29889, 978, 13, 9651, 411, 1904, 29918, 3126, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 18884, 1904, 29918, 7529, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 9651, 1900, 29918, 16202, 29918, 2084, 353, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 847, 525, 4299, 29918, 13318, 29918, 16202, 29889, 3126, 29915, 13, 9651, 565, 1900, 29918, 16202, 29918, 2084, 29889, 9933, 7295, 13, 18884, 411, 1900, 29918, 16202, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 462, 1678, 1900, 29918, 16202, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 9651, 1683, 29901, 13, 18884, 1900, 29918, 16202, 353, 6213, 13, 13, 9651, 7945, 29918, 16202, 29918, 2084, 353, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 847, 525, 4299, 29918, 14968, 29918, 16202, 29889, 3126, 29915, 13, 9651, 565, 7945, 29918, 16202, 29918, 2084, 29889, 9933, 7295, 13, 18884, 1018, 29901, 13, 462, 1678, 411, 7945, 29918, 16202, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 462, 4706, 7945, 29918, 16202, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 18884, 5174, 4390, 29889, 7249, 2772, 401, 2392, 29901, 13, 462, 1678, 7945, 29918, 16202, 353, 6213, 13, 9651, 1683, 29901, 13, 18884, 7945, 29918, 16202, 353, 6213, 13, 13, 9651, 22395, 29918, 978, 353, 22395, 29918, 2084, 29889, 978, 13, 13, 9651, 1904, 29918, 262, 1659, 29918, 3972, 353, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 262, 1659, 29915, 13, 462, 462, 259, 847, 22395, 29918, 978, 847, 1904, 29918, 978, 29897, 13, 9651, 565, 1904, 29918, 262, 1659, 29918, 3972, 29889, 9933, 7295, 13, 18884, 27262, 29918, 1022, 2878, 29879, 353, 518, 29886, 29889, 978, 363, 282, 297, 1904, 29918, 262, 1659, 29918, 3972, 29889, 1524, 3972, 580, 29962, 13, 9651, 1683, 29901, 13, 18884, 27262, 29918, 1022, 2878, 29879, 353, 5159, 13, 13, 9651, 4733, 29918, 1609, 29918, 29879, 14551, 29961, 29879, 14551, 29918, 978, 1822, 4397, 3319, 13, 18884, 525, 7529, 2396, 1904, 29918, 7529, 29892, 13, 18884, 525, 13318, 29918, 16202, 2396, 1900, 29918, 16202, 29892, 13, 18884, 525, 14968, 29918, 16202, 2396, 7945, 29918, 16202, 29892, 13, 18884, 525, 29879, 14551, 29918, 978, 2396, 22395, 29918, 2084, 29889, 978, 29892, 13, 18884, 525, 4299, 29918, 978, 2396, 1904, 29918, 3126, 29918, 2084, 29889, 3560, 29889, 978, 29892, 13, 18884, 525, 4299, 29918, 2084, 2396, 851, 29898, 4299, 29918, 3126, 29918, 2084, 511, 13, 18884, 525, 262, 1659, 29918, 1022, 2878, 29879, 2396, 27262, 29918, 1022, 2878, 29879, 29892, 13, 9651, 5615, 13, 13, 1678, 736, 426, 13, 4706, 525, 9794, 29918, 1609, 29918, 29879, 14551, 2396, 4733, 29918, 1609, 29918, 29879, 14551, 29892, 13, 1678, 500, 13, 13, 13, 12674, 822, 5142, 29918, 2204, 355, 29918, 1445, 29898, 3827, 29901, 1856, 29889, 3089, 1125, 13, 1678, 27262, 29918, 2084, 353, 2009, 29889, 1972, 29889, 657, 877, 262, 1659, 29918, 2084, 742, 6213, 29897, 13, 1678, 565, 451, 27262, 29918, 2084, 29901, 13, 4706, 12020, 1856, 29889, 10493, 17413, 580, 13, 1678, 27262, 29918, 2084, 353, 10802, 29898, 262, 1659, 29918, 2084, 29897, 13, 1678, 565, 451, 27262, 29918, 2084, 29889, 9933, 7295, 13, 4706, 12020, 1856, 29889, 10493, 17413, 580, 13, 13, 1678, 26015, 353, 2009, 29889, 1972, 29889, 657, 877, 20131, 742, 525, 4541, 1495, 1275, 525, 3009, 29915, 13, 1678, 694, 29918, 14939, 353, 2009, 29889, 1972, 29889, 657, 877, 1217, 29918, 14939, 742, 525, 4541, 1495, 1275, 525, 3009, 29915, 13, 1678, 9088, 29918, 1853, 353, 2009, 29889, 1972, 29889, 657, 877, 1853, 742, 525, 262, 14373, 1495, 13, 1678, 565, 9088, 29918, 1853, 451, 297, 11117, 262, 14373, 742, 525, 4378, 29880, 29915, 6177, 13, 4706, 12020, 1856, 29889, 10493, 22050, 3089, 29898, 726, 543, 13919, 9088, 1134, 23157, 13, 13, 1678, 10422, 353, 10802, 11219, 7050, 742, 285, 29915, 29912, 25118, 29889, 25118, 29946, 580, 1836, 2204, 355, 1495, 13, 13, 1678, 1899, 353, 518, 13, 4706, 525, 4691, 742, 17411, 29885, 742, 525, 357, 616, 29889, 1990, 3709, 29889, 9482, 292, 29889, 3258, 29918, 2204, 355, 29918, 1445, 742, 13, 4706, 851, 29898, 262, 1659, 29918, 2084, 511, 10422, 29892, 13, 4706, 525, 489, 4058, 29899, 16596, 742, 13, 4706, 525, 489, 1853, 742, 9088, 29918, 1853, 29892, 13, 4706, 525, 489, 1509, 29899, 7915, 287, 29899, 1557, 2361, 742, 13, 4706, 396, 525, 489, 1509, 29899, 1195, 29883, 29899, 22492, 2925, 742, 13, 1678, 4514, 13, 1678, 565, 26015, 29901, 13, 4706, 1899, 29889, 4397, 877, 489, 20131, 1495, 13, 13, 1678, 565, 694, 29918, 14939, 29901, 13, 4706, 1899, 29889, 4397, 877, 489, 1217, 29899, 14939, 1495, 13, 13, 1678, 17927, 29889, 3888, 877, 17641, 292, 1899, 1273, 29879, 742, 851, 29898, 6519, 876, 13, 13, 1678, 1014, 5014, 29889, 4804, 29898, 6519, 29897, 13, 1678, 565, 26015, 29901, 13, 4706, 714, 29918, 978, 353, 285, 29915, 29912, 262, 1659, 29918, 2084, 29889, 303, 331, 1836, 29912, 24645, 29918, 1853, 1836, 11576, 29889, 2204, 355, 29915, 13, 1678, 1683, 29901, 13, 4706, 714, 29918, 978, 353, 285, 29915, 29912, 262, 1659, 29918, 2084, 29889, 303, 331, 1836, 29912, 24645, 29918, 1853, 1836, 2204, 355, 29915, 13, 13, 1678, 2933, 353, 1856, 29889, 3835, 5103, 29898, 13, 4706, 4660, 29922, 29906, 29900, 29900, 29892, 13, 4706, 9066, 29922, 15329, 21533, 3319, 13, 9651, 525, 3916, 29899, 4205, 3283, 2396, 285, 29915, 14930, 358, 29936, 10422, 3790, 449, 29918, 978, 10162, 13, 4706, 500, 511, 13, 1678, 1723, 13, 1678, 7272, 2933, 29889, 19125, 29898, 3827, 29897, 13, 1678, 411, 10422, 29889, 3150, 877, 6050, 1495, 408, 285, 29901, 13, 4706, 7272, 2933, 29889, 3539, 29898, 29888, 29889, 949, 3101, 13, 1678, 7272, 2933, 29889, 3539, 29918, 29872, 974, 580, 13, 13, 1678, 736, 2933, 13, 13, 13, 29992, 29874, 601, 1124, 29918, 28789, 1764, 29906, 29889, 6886, 877, 1990, 3709, 29914, 262, 1659, 29918, 9902, 29918, 29881, 11881, 29889, 1420, 1495, 13, 12674, 822, 1510, 29918, 262, 1659, 29918, 9902, 29918, 29881, 11881, 29898, 3827, 1125, 13, 1678, 736, 7272, 1510, 29918, 262, 1659, 29918, 9902, 29898, 3827, 29897, 13, 13, 13, 29992, 29874, 601, 1124, 29918, 28789, 1764, 29906, 29889, 6886, 877, 1990, 3709, 29914, 262, 1659, 29918, 9902, 29918, 12857, 29889, 1420, 1495, 13, 12674, 822, 1510, 29918, 262, 1659, 29918, 9902, 29918, 12857, 29898, 3827, 1125, 13, 1678, 736, 7272, 1510, 29918, 262, 1659, 29918, 9902, 29898, 3827, 29897, 13, 13, 13, 12674, 822, 1510, 29918, 262, 1659, 29918, 9902, 29898, 3827, 29901, 1856, 29889, 3089, 1125, 13, 1678, 22395, 29918, 978, 353, 2009, 29889, 4352, 29918, 3888, 29889, 657, 877, 29879, 14551, 1495, 13, 1678, 1904, 29918, 978, 353, 2009, 29889, 4352, 29918, 3888, 29889, 657, 877, 4299, 1495, 13, 1678, 21502, 305, 353, 2009, 29889, 4352, 29918, 3888, 29889, 657, 877, 1022, 2878, 1495, 13, 1678, 1813, 353, 938, 29898, 3827, 29889, 1972, 29889, 657, 877, 3488, 742, 29871, 29900, 876, 13, 1678, 1813, 29918, 2311, 353, 938, 29898, 3827, 29889, 1972, 29889, 657, 877, 3488, 29918, 2311, 742, 29871, 29896, 29906, 876, 13, 1678, 2246, 29895, 353, 938, 29898, 3827, 29889, 1972, 29889, 657, 877, 3332, 29895, 742, 29871, 29941, 876, 13, 1678, 8267, 29918, 4841, 353, 2009, 29889, 1972, 29889, 657, 877, 12181, 29918, 4841, 742, 6213, 29897, 13, 1678, 5101, 29918, 4841, 353, 2009, 29889, 1972, 29889, 657, 877, 18784, 29918, 4841, 742, 6213, 29897, 13, 1678, 8267, 29918, 4993, 353, 2009, 29889, 1972, 29889, 657, 877, 12181, 29918, 4993, 742, 6213, 29897, 13, 1678, 8267, 29918, 7320, 353, 2009, 29889, 1972, 29889, 657, 877, 12181, 29918, 7320, 742, 6213, 29897, 13, 1678, 4236, 29918, 5721, 353, 5785, 29898, 3827, 29889, 1972, 29889, 657, 877, 3317, 29918, 5721, 742, 2295, 29889, 24065, 1001, 1430, 4741, 29918, 12648, 29918, 4571, 1254, 876, 13, 1678, 565, 8267, 29918, 4841, 338, 451, 6213, 29901, 13, 4706, 8267, 29918, 4841, 353, 8267, 29918, 4841, 29889, 6506, 877, 13420, 525, 2824, 17010, 29317, 25710, 13, 4706, 8267, 29918, 4841, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 8267, 29918, 4841, 29889, 5451, 29317, 1495, 29962, 13, 13, 1678, 565, 5101, 29918, 4841, 338, 451, 6213, 29901, 13, 4706, 5101, 29918, 4841, 353, 5101, 29918, 4841, 29889, 6506, 877, 13420, 525, 2824, 17010, 29317, 25710, 13, 4706, 5101, 29918, 4841, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 5101, 29918, 4841, 29889, 5451, 29317, 1495, 29962, 13, 13, 1678, 565, 1904, 29918, 978, 338, 6213, 29901, 13, 4706, 12020, 1856, 29889, 10493, 22050, 3089, 580, 13, 13, 1678, 565, 22395, 29918, 978, 338, 6213, 29901, 13, 4706, 12020, 1856, 29889, 10493, 22050, 3089, 580, 13, 13, 1678, 22395, 29918, 3972, 353, 2295, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 29879, 8971, 845, 1862, 29915, 847, 22395, 29918, 978, 13, 1678, 565, 451, 22395, 29918, 3972, 29889, 9933, 7295, 13, 4706, 22395, 29918, 3972, 353, 2295, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 21457, 2585, 29915, 847, 22395, 29918, 978, 13, 1678, 565, 451, 22395, 29918, 3972, 29889, 9933, 7295, 13, 4706, 12020, 1856, 29889, 10493, 17413, 580, 13, 13, 1678, 27262, 29918, 3972, 353, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 847, 525, 262, 1659, 29915, 13, 462, 268, 847, 22395, 29918, 978, 847, 1904, 29918, 978, 847, 21502, 305, 29897, 13, 13, 1678, 565, 451, 27262, 29918, 3972, 29889, 9933, 7295, 13, 4706, 12020, 1856, 29889, 10493, 17413, 580, 13, 13, 1678, 565, 313, 29879, 14551, 29918, 3972, 847, 525, 29879, 14551, 29889, 3126, 2824, 9933, 7295, 13, 4706, 411, 313, 29879, 14551, 29918, 3972, 847, 525, 29879, 14551, 29889, 3126, 2824, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 9651, 22395, 29918, 8977, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 1678, 1683, 29901, 13, 4706, 411, 313, 29879, 14551, 29918, 3972, 847, 525, 7299, 29889, 3126, 2824, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 9651, 22395, 29918, 8977, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 18094, 353, 5159, 13, 1678, 565, 8267, 29918, 4841, 29901, 13, 4706, 18094, 29889, 4397, 29898, 9794, 29889, 24111, 29889, 333, 29889, 262, 23538, 12181, 29918, 4841, 876, 13, 13, 1678, 565, 5101, 29918, 4841, 29901, 13, 4706, 18094, 29889, 4397, 29898, 9794, 29889, 1252, 16305, 279, 24111, 20547, 29889, 333, 29889, 262, 23538, 18784, 29918, 4841, 876, 13, 13, 1678, 565, 8267, 29918, 4993, 29901, 13, 4706, 18094, 29889, 4397, 29898, 9794, 29889, 24111, 29889, 4993, 1275, 8267, 29918, 4993, 29897, 13, 13, 1678, 565, 8267, 29918, 7320, 29901, 13, 4706, 18094, 29889, 4397, 29898, 9794, 29889, 24111, 29889, 7320, 1275, 8267, 29918, 7320, 29897, 13, 13, 1678, 565, 2246, 29895, 29901, 13, 4706, 18094, 29889, 4397, 29898, 9794, 29889, 1252, 16305, 279, 24111, 20547, 29889, 10003, 5277, 2246, 29895, 29897, 13, 13, 1678, 411, 4867, 29918, 6078, 580, 408, 27937, 29901, 13, 4706, 17279, 29892, 903, 353, 21385, 29889, 9155, 29918, 15388, 29879, 29898, 29879, 404, 29897, 13, 4706, 1775, 29918, 1609, 29918, 333, 353, 426, 13, 9651, 286, 29889, 333, 29901, 286, 363, 286, 297, 17279, 13, 4706, 500, 13, 4706, 25834, 29892, 2302, 29892, 5101, 29918, 2798, 353, 21385, 29889, 9155, 29918, 845, 11603, 29918, 2541, 29918, 29886, 7121, 29898, 13, 9651, 27937, 29892, 1813, 29922, 3488, 29892, 13, 9651, 1813, 29918, 2311, 29922, 3488, 29918, 2311, 29892, 13, 9651, 18094, 29922, 26705, 29892, 13, 9651, 4236, 29918, 5721, 29922, 3317, 29918, 5721, 29897, 13, 13, 4706, 2582, 29918, 1609, 29918, 12181, 353, 903, 26193, 403, 29918, 12181, 29918, 262, 10662, 29898, 13, 9651, 27262, 29918, 3972, 29892, 13, 9651, 1775, 29918, 1609, 29918, 333, 29892, 13, 9651, 25834, 29892, 2246, 29895, 29922, 3332, 29895, 29892, 4236, 29918, 5721, 29922, 3317, 29918, 5721, 29897, 13, 13, 1678, 302, 29918, 12292, 353, 938, 29898, 755, 29889, 27696, 29898, 2798, 847, 1813, 29918, 2311, 876, 13, 13, 1678, 736, 426, 13, 4706, 525, 29879, 14551, 29918, 978, 2396, 22395, 29918, 978, 29892, 13, 4706, 525, 24713, 29918, 978, 2396, 22395, 29918, 8977, 29889, 657, 29898, 13, 9651, 525, 24713, 29918, 978, 742, 22395, 29918, 8977, 29889, 657, 877, 24713, 742, 12801, 26690, 8783, 29958, 1495, 511, 13, 4706, 525, 4299, 29918, 978, 2396, 1904, 29918, 978, 29892, 13, 4706, 525, 1022, 2878, 2396, 21502, 305, 29892, 13, 4706, 525, 2764, 29918, 3488, 2396, 1813, 29892, 13, 4706, 525, 3488, 29918, 2311, 2396, 1813, 29918, 2311, 29892, 13, 4706, 525, 29876, 29918, 7827, 2396, 2302, 29892, 13, 4706, 525, 29876, 29918, 29886, 7121, 2396, 5101, 29918, 2798, 29892, 13, 4706, 525, 29876, 29918, 12292, 2396, 302, 29918, 12292, 29892, 13, 4706, 525, 9902, 29918, 1609, 29918, 12181, 2396, 2582, 29918, 1609, 29918, 12181, 29892, 13, 4706, 525, 2922, 29918, 1609, 29918, 333, 2396, 1775, 29918, 1609, 29918, 333, 29892, 13, 1678, 500, 13, 13, 13, 1753, 903, 26193, 403, 29918, 12181, 29918, 262, 10662, 29898, 262, 1659, 29918, 3972, 29892, 13, 462, 18884, 1775, 29918, 1609, 29918, 333, 29892, 25834, 29892, 13, 462, 18884, 2246, 29895, 29892, 4236, 29918, 5721, 1125, 13, 1678, 2582, 29918, 1609, 29918, 12181, 353, 2322, 8977, 29898, 1761, 29897, 13, 1678, 363, 8267, 297, 25834, 29901, 13, 4706, 11000, 353, 8267, 29889, 657, 29918, 3332, 29895, 29918, 29886, 7121, 29898, 3332, 29895, 29892, 4236, 29918, 5721, 29897, 13, 4706, 363, 5101, 297, 11000, 29901, 13, 9651, 5101, 29918, 262, 1659, 353, 10272, 29918, 18784, 29918, 262, 1659, 29898, 13, 18884, 27262, 29918, 3972, 29892, 1775, 29918, 1609, 29918, 333, 29892, 5101, 29897, 13, 9651, 565, 5101, 29918, 262, 1659, 338, 6213, 29901, 13, 18884, 6773, 13, 9651, 2582, 29918, 1609, 29918, 12181, 29961, 18784, 29889, 12181, 1822, 4397, 29898, 18784, 29918, 262, 1659, 29897, 13, 1678, 736, 2582, 29918, 1609, 29918, 12181, 13, 13, 13, 1753, 10272, 29918, 18784, 29918, 262, 1659, 29898, 262, 1659, 29918, 3972, 29892, 1775, 29918, 1609, 29918, 333, 29892, 5101, 1125, 13, 1678, 396, 2377, 29918, 22492, 2925, 353, 10272, 29918, 28192, 29918, 22492, 2925, 29898, 18784, 29892, 736, 29918, 4841, 29922, 5574, 29897, 13, 1678, 2377, 29918, 22492, 2925, 353, 6213, 13, 1678, 4390, 29918, 2084, 353, 10802, 29898, 262, 1659, 29918, 3972, 29892, 285, 29915, 29912, 18784, 29889, 333, 1836, 3126, 1495, 13, 1678, 565, 451, 4390, 29918, 2084, 29889, 9933, 7295, 13, 4706, 17927, 29889, 3888, 877, 7249, 2224, 1273, 29879, 947, 451, 1863, 742, 4390, 29918, 2084, 29897, 13, 4706, 736, 6213, 13, 13, 1678, 411, 4390, 29918, 2084, 29889, 3150, 877, 29878, 1495, 408, 285, 29901, 13, 4706, 27262, 29918, 8977, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 2377, 29918, 1958, 353, 5101, 29889, 1359, 29918, 1272, 29898, 2917, 29889, 7228, 8193, 29918, 7068, 3301, 29923, 29918, 29907, 1307, 2190, 29918, 1660, 29954, 13780, 29918, 23827, 29918, 5813, 29897, 448, 29871, 29896, 13, 1678, 5174, 3497, 17413, 2392, 29901, 13, 4706, 2377, 29918, 1958, 353, 5101, 29889, 1359, 29918, 1272, 29898, 2917, 29889, 7228, 8193, 29918, 7068, 3301, 29923, 29918, 29907, 1307, 2190, 29918, 1660, 29954, 13780, 29918, 23827, 29918, 5813, 29918, 5607, 29928, 29897, 448, 29871, 29896, 13, 1678, 2377, 29918, 13168, 29918, 1609, 29918, 10199, 29918, 333, 353, 6571, 13, 1678, 363, 2377, 29918, 333, 297, 7442, 29889, 13092, 29898, 10199, 29918, 1958, 1125, 13, 4706, 565, 2377, 29918, 333, 1275, 448, 29896, 29901, 13, 9651, 6773, 13, 4706, 2377, 29918, 13168, 29918, 1609, 29918, 10199, 29918, 333, 29961, 710, 29898, 10199, 29918, 333, 4638, 353, 5780, 1884, 29889, 2676, 29889, 3027, 29918, 517, 29918, 3188, 29953, 29946, 29898, 13, 9651, 313, 10199, 29918, 1958, 1275, 2377, 29918, 333, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 334, 29871, 29906, 29945, 29945, 29897, 13, 13, 1678, 396, 903, 5992, 29918, 18279, 29918, 15388, 29879, 29898, 262, 1659, 29918, 8977, 29892, 1775, 29918, 1609, 29918, 333, 29897, 13, 1678, 10272, 29918, 7915, 287, 29918, 1557, 2361, 29898, 262, 1659, 29918, 8977, 29892, 1775, 29918, 1609, 29918, 333, 29892, 2656, 29922, 5574, 29892, 13, 462, 9651, 4889, 29918, 22492, 2925, 29922, 5574, 29897, 13, 13, 1678, 7697, 29918, 6500, 5570, 29918, 2084, 353, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 13, 462, 3986, 847, 525, 262, 1659, 29915, 847, 525, 8172, 29915, 847, 525, 9482, 886, 29899, 24077, 2986, 29915, 13, 462, 3986, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 7697, 29918, 1195, 29883, 29918, 262, 14373, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 29889, 3560, 847, 525, 29946, 29945, 29899, 1195, 29883, 29899, 22492, 29915, 13, 462, 1669, 847, 525, 9482, 886, 29899, 24077, 2986, 29915, 13, 462, 1669, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 7697, 29918, 262, 14373, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 847, 525, 9482, 886, 29899, 24077, 2986, 29915, 13, 462, 3986, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 396, 565, 451, 7697, 29918, 262, 14373, 29918, 2084, 29889, 9933, 7295, 13, 1678, 396, 268, 7697, 29918, 262, 14373, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 847, 525, 9482, 886, 29899, 13671, 29899, 24077, 2986, 29915, 13, 1678, 396, 462, 965, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 396, 565, 451, 7697, 29918, 262, 14373, 29918, 2084, 29889, 9933, 7295, 13, 1678, 396, 268, 7697, 29918, 262, 14373, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 847, 525, 9482, 886, 29899, 24077, 2986, 29915, 13, 1678, 396, 462, 965, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 7697, 29918, 262, 14373, 29918, 8862, 284, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 847, 525, 9482, 886, 29899, 8862, 284, 29915, 13, 462, 3986, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 262, 14373, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 7697, 29918, 4378, 29880, 29918, 2084, 353, 313, 2917, 29889, 15176, 4037, 29918, 13875, 1799, 29902, 3738, 1001, 29918, 9464, 29918, 1525, 29924, 2891, 29923, 13, 462, 3986, 847, 525, 262, 1659, 29915, 847, 525, 4381, 29915, 847, 525, 9482, 886, 29899, 24077, 2986, 29915, 13, 462, 3986, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 4378, 29880, 29889, 29900, 29900, 29900, 29900, 29889, 6173, 1495, 13, 1678, 396, 7697, 29918, 4378, 29880, 29918, 2084, 353, 313, 262, 1659, 29918, 3972, 847, 525, 9482, 886, 29915, 13, 1678, 396, 462, 29871, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 4378, 29880, 29889, 29900, 29900, 29900, 29900, 29889, 2732, 1495, 13, 13, 1678, 15061, 29918, 2084, 353, 27262, 29918, 3972, 847, 525, 9482, 886, 29915, 847, 285, 29915, 29912, 18784, 29889, 333, 1836, 2732, 29915, 13, 13, 1678, 736, 426, 13, 4706, 525, 18784, 2396, 5101, 29892, 13, 4706, 525, 12181, 2396, 5101, 29889, 12181, 29892, 13, 4706, 525, 735, 16305, 279, 2396, 5101, 29889, 735, 16305, 279, 29892, 13, 4706, 525, 10199, 29918, 13168, 29918, 1609, 29918, 10199, 29918, 333, 2396, 2377, 29918, 13168, 29918, 1609, 29918, 10199, 29918, 333, 29892, 13, 4706, 525, 28759, 29918, 262, 14373, 29918, 2084, 2396, 7697, 29918, 262, 14373, 29918, 2084, 29892, 13, 4706, 525, 28759, 29918, 262, 14373, 29918, 8862, 284, 29918, 2084, 2396, 7697, 29918, 262, 14373, 29918, 8862, 284, 29918, 2084, 29892, 13, 4706, 525, 28759, 29918, 1195, 29883, 29918, 262, 14373, 29918, 2084, 2396, 7697, 29918, 1195, 29883, 29918, 262, 14373, 29918, 2084, 29892, 13, 4706, 525, 28759, 29918, 4378, 29880, 29918, 2084, 2396, 7697, 29918, 4378, 29880, 29918, 2084, 29892, 13, 4706, 525, 28759, 29918, 6500, 5570, 29918, 2084, 2396, 7697, 29918, 6500, 5570, 29918, 2084, 29892, 13, 4706, 525, 9482, 292, 29918, 2084, 2396, 15061, 29918, 2084, 29892, 13, 4706, 525, 262, 1659, 29918, 2084, 2396, 4390, 29918, 2084, 29892, 13, 4706, 3579, 262, 1659, 29918, 8977, 29892, 13, 1678, 500, 13, 13, 13, 1753, 903, 5992, 29918, 18279, 29918, 15388, 29879, 29898, 262, 1659, 29918, 8977, 29892, 1775, 29918, 1609, 29918, 333, 1125, 13, 1678, 363, 2377, 29918, 333, 29892, 2377, 29918, 3332, 29895, 297, 27262, 29918, 8977, 1839, 10199, 1860, 13359, 7076, 7295, 13, 4706, 2377, 29918, 1482, 29918, 3332, 29895, 353, 5159, 13, 4706, 363, 1993, 297, 2377, 29918, 3332, 29895, 1839, 15388, 2033, 29901, 13, 9651, 1775, 353, 1775, 29918, 1609, 29918, 333, 29961, 4352, 1839, 333, 2033, 29962, 13, 9651, 565, 1775, 29889, 17590, 29901, 13, 18884, 2377, 29918, 1482, 29918, 3332, 29895, 29889, 4397, 29898, 4352, 29897, 13, 4706, 2377, 29918, 3332, 29895, 1839, 15388, 2033, 353, 2377, 29918, 1482, 29918, 3332, 29895, 2 ]
stve/application/__init__.py
TE-ToshiakiTanaka/stve
0
182245
from stve.application.stvetestrunner import StveTestRunner
[ 1, 515, 380, 345, 29889, 6214, 29889, 303, 5990, 342, 27492, 1053, 624, 345, 3057, 16802, 13, 2 ]
meiduo_mall/apps/carts/views.py
wuhaogithub/wuhao_project_2019_10
0
168457
import json from django.http import JsonResponse from django.shortcuts import render # Create your views here. from django.views import View from django_redis import get_redis_connection from apps.goods.models import SKU from utils.response_code import RETCODE """ 1. 如果用户未登录,可以实现添加购物车的功能. 如果用户登录,也可以实现添加购物车的功能. 2.如果用户未登录, 我们要保存 商品id,商品数量,商品的选中状态 如果用户登录, 我们要保存 用户id, 商品id,商品数量,商品的选中状态 3.如果用户未登录, 保存在 浏览器中 cookie中 如果用户登录, 保存在数据库中 (为了让大家更好的学习redis)我们把数据保存到redis中 4. 如果用户未登录, cookie的数据格式 { sku_id:{count:5,selected:True}, sku_id:{count:2,selected:False}, sku_id:{count:7,selected:True}, } 如果用户登录, Redis .Redis的数据是保存在内存中, 我们要尽量少的占用内存空间 user_id ,sku_id,count,selected 1, 100,2,True 101,5,False 102,10,True 103,10,False key 100:2 selected_100:True 101:5 selected_101:False 102:10 selected_102:True 103:10 selected_103:False hash user_id 100:2 101:5 102:10 103:10 set 选中的在集合中 selected_user_id [100,102] hash user_id 100:2 101:-5 102:10 103:-10 5. { sku_id:{count:5,selected:True}, sku_id:{count:2,selected:False}, sku_id:{count:7,selected:True}, } base64 1G = 1024MB 1M=1024KB 1KB=1024B 1B=8bite 比特位 0 1 A 0100 0001 0100 0001 0100 0001 0100 0001 A A A 010000 010100 000101 000001 x y z a 5.1 将字典转换为二进制 5.2 再进行base64编码 http://doc.redisfans.com/ """ from django.contrib.auth.mixins import LoginRequiredMixin class CartsView(View): """ 1.功能分析 用户行为: 前端行为: 当用户点击加入购物车的时候,前端要收集用户信息,sku_id,count,默认是选中 后端行为: 2. 分析后端实现的大体步骤 1.接收数据,判断商品信息 2.先获取用户信息 3.根据用户是否登陆来判断 4.登陆用户操作数据(redis) 4.1 连接数据库 4.2 操作数据库 4.3 返回相应 5.未登录用户操作cookie 5.1 组织数据 5.2 对数据进行编码 5.3 设置cookie 5.4 返回相应 6.返回相应 3.确定请求方式和路由 POST carts """ def post(self,request): # 1.接收数据,判断商品信息 data=json.loads(request.body.decode()) sku_id=data.get('sku_id') count=data.get('count') if not all([sku_id,count]): return JsonResponse({'code':RETCODE.PARAMERR,'errmsg':'参数不全'}) try: sku=SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return JsonResponse({'code':RETCODE.NODATAERR,'errmsg':'没有此商品'}) try: count=int(count) except Exception: return JsonResponse({'code':RETCODE.PARAMERR,'errmsg':"参数错误"}) #添加购物车默认就是选中 selected=True # 2.先获取用户信息 user=request.user # 3.根据用户是否登陆来判断 # is_authenticated 是认证用户(注册用户) if user.is_authenticated: # 4.登陆用户操作数据(redis) # 4.1 连接数据库 redis_conn = get_redis_connection('carts') # 4.2 操作数据库 # hash key: # sku_id:count # field:value # field:value # 需要累加数据 # redis_conn.hset('carts_%s'%user.id,sku_id,count) # 一 创建管道 pl=redis_conn.pipeline() # 二 将指令收集到管道中 pl.hincrby('carts_%s' % user.id, sku_id, count) # set pl.sadd('selected_%s' % user.id, sku_id) # 三 执行管道 pl.execute() # redis_conn.hincrby('carts_%s'%user.id,sku_id,count) # # set # # redis_conn.sadd('selected_%s'%user.id,sku_id) # 4.3 返回相应 return JsonResponse({'code':RETCODE.OK,'errmsg':'ok'}) else: # 5.未登录用户操作cookie # 5.0 先获取cookie中 可能存在的数据 carts_str=request.COOKIES.get('carts') if carts_str is None: #说明没有购物车数据 cookie_data = { sku_id: {'count': count, 'selected': True} } else: #说明有购物车数据 # 先base64解码 decode_data=base64.b64decode(carts_str) # 再bytes转字典 cookie_data=pickle.loads(decode_data) # 再需要进行判断 # {1:{count:5,selected:True}} # 商品id是否在字典中 # 1 if sku_id in cookie_data: #累加数量 origin_count=cookie_data[sku_id]['count'] # count=origin_count+count count+=origin_count #更新字典数据 cookie_data[sku_id]={'count':count,'selected':True} else: cookie_data[sku_id]={'count':count,'selected':True} # 5.1 组织数据 """ { sku_id:{count:5,selected:True}, sku_id:{count:2,selected:False}, sku_id:{count:7,selected:True}, } """ # 5.2 对数据进行编码 # 字典转bytes cookie_bytes=pickle.dumps(cookie_data) # base64编码 cookie_str=base64.b64encode(cookie_bytes) # 5.3 设置cookie response=JsonResponse({'code':RETCODE.OK,'errmsg':'ok'}) response.set_cookie('carts',cookie_str,max_age=7*24*3600) # 5.4 返回相应 return response """ 1.功能分析 用户行为: 前端行为: 后端行为: 2. 分析后端实现的大体步骤 1.先获取用户信息 2.如果用户为登陆,则从cookie中获取信息 { sku_id:{count:5,selected:True}, sku_id:{count:2,selected:False}, sku_id:{count:7,selected:True}, } 2.1 获取商品id 2.2 根据商品id进行商品信息的查询 2.3 将对象转换为字典 2.4 返回相应 3.如果用户登陆,则从redis中获取信息 3.1 连接redis 3.2 获取redis数据 hash sku_id:count set [sku_id,sku_id] 3.3 获取商品id 3.4 根据商品id进行商品信息的查询 3.5 将对象转换为字典 3.6 返回相应 1.先获取用户信息 2.如果用户为登陆,则从cookie中获取信息 { sku_id:{count:5,selected:True}, sku_id:{count:2,selected:False}, sku_id:{count:7,selected:True}, } 3.如果用户登陆,则从redis中获取信息 3.1 连接redis 3.2 获取redis数据 hash sku_id:count set [sku_id,sku_id] 4 获取商品id 5 根据商品id进行商品信息的查询 6 将对象转换为字典 7 返回相应 3.确定请求方式和路由 """ def get(self,request): # # 1.先获取用户信息 user=request.user if user.is_authenticated: # 3.如果用户登陆,则从redis中获取信息 # 3.1 连接redis redis_conn = get_redis_connection('carts') # 3.2 获取redis数据 # hash sku_id:count # {sku_id:count,sku_id:count,....} # {1:10,2:20} id_counts=redis_conn.hgetall('carts_%s'%user.id) # set [sku_id,sku_id] # [sku_id,sku_id] # [1] selected_ids=redis_conn.smembers('selected_%s'%user.id) #将redis数据转换为cookie格式 # cookie_str = {sku_id:{count:5,selected:True}} cookie_dict = {} for sku_id,count in id_counts.items(): # if sku_id in selected_ids: # selected=True # else: # selected=False cookie_dict[int(sku_id)]={ 'count':int(count), 'selected':sku_id in selected_ids } else: # 2.如果用户为登陆,则从cookie中获取信息 # { # sku_id:{count:5,selected:True}, # sku_id:{count:2,selected:False}, # sku_id:{count:7,selected:True}, # } # cookie_data=request.COOKIES.get('carts') if cookie_data is not None: #先进行base64解码 cookie_dict=pickle.loads(base64.b64decode(cookie_data)) else: cookie_dict={} # 4 获取商品id -- 因为redis的数据结构和cookie的数据结构不一致 # 我们应该让他们的数据一致 # cookie_dict = { # sku_id:{count:5,selected:True}, # sku_id:{count:2,selected:False}, # sku_id:{count:7,selected:True}, # } ids=cookie_dict.keys() #[1,2,3,4,5,6] # 5 根据商品id进行商品信息的查询 carts_list=[] for id in ids: sku=SKU.objects.get(id=id) # 6 将对象转换为字典 carts_list.append({ 'id':sku.id, 'name':sku.name, 'count': cookie_dict.get(sku.id).get('count'), 'selected': str(cookie_dict.get(sku.id).get('selected')), # 将True,转'True',方便json解析 'default_image_url':sku.default_image.url, 'price':str(sku.price), # 从Decimal('10.2')中取出'10.2',方便json解析 'amount':str(sku.price * cookie_dict.get(sku.id).get('count')), }) # 7 返回相应 return render(request,'cart.html',context={'cart_skus':carts_list}) """ 1.功能分析 用户行为: 用户可能会点击某一个商品的数量/选中状态 前端行为: 前端需要收集 点击的 sku_id,count,selected 以及用户信息 后端行为: 实现更新 2. 分析后端实现的大体步骤 1.接收数据 2.验证数据 3.获取用户信息 4.登陆用户更新redis 4.1 连接redis 4.2 更新数据 4.3 返回相应 5.未登录用户更新cookie 5.1 获取cookie中的数据,并进行判断 如果有数据则需要进行解码 5.2 更新数据 cart={} 5.3 将字典进行编码 5.4 设置cookie 5.5 返回相应 3.确定请求方式和路由 """ def put(self,request): # 1.接收数据 data=json.loads(request.body.decode()) sku_id=data.get('sku_id') count=data.get('count') selected=data.get('selected') # 2.验证数据(省略) try: sku=SKU.objects.get(id=sku_id) except SKU.DoesNotExist: return JsonResponse({'code':RETCODE.NODATAERR,'errmsg':'没有此信息'}) # 3.获取用户信息 user=request.user if user.is_authenticated: # 4.登陆用户更新redis # 4.1 连接redis redis_conn = get_redis_connection('carts') # 4.2 更新数据 #hash redis_conn.hset('carts_%s'%user.id,sku_id,count) # set if selected: redis_conn.sadd('selected_%s'%user.id,sku_id) else: redis_conn.srem('selected_%s'%user.id,sku_id) # 4.3 返回相应 data={ 'count':count, 'id':sku_id, 'selected':selected, 'name': sku.name, 'default_image_url': sku.default_image.url, 'price': sku.price, 'amount': sku.price * count, } return JsonResponse({'code':RETCODE.OK,'errmsg':'ok','cart_sku':data}) else: # 5.未登录用户更新cookie # 5.1 获取cookie中的数据,并进行判断 cookie_str=request.COOKIES.get('carts') if cookie_str is not None: # 如果有数据则需要进行解码 cookie_dict=pickle.loads(base64.b64decode(cookie_str)) else: cookie_dict={} # 5.2 更新数据 cart={} # sku_id 是否在字典列表中 # carts = {sku_id:{count:5,selected:True}} if sku_id in cookie_dict: cookie_dict[sku_id]={ 'count':count, 'selected':selected } # 5.3 将字典进行编码 cookie_data=base64.b64encode(pickle.dumps(cookie_dict)) # 5.4 设置cookie data = { 'count': count, 'id': sku_id, 'selected': selected, 'name': sku.name, 'default_image_url': sku.default_image.url, 'price': sku.price, 'amount': sku.price * count, } response = JsonResponse({'code': RETCODE.OK, 'errmsg': 'ok', 'cart_sku': data}) response.set_cookie('carts',cookie_data,max_age=7*24*3600) # 5.5 返回相应 return response """ 1.功能分析 用户行为: 前端行为: 后端行为: 2. 分析后端实现的大体步骤 1.接收数据 2.验证数据 3.获取用户信息,并进行判断 4.登陆则操作redis 4.1 连接redis 4.2 hash set 4.3 返回相应 5.未登录则操作cookie 5.1 先获取cookie数据,并进行判断 如果有数据,则进行解码 5.2 删除数据 {} 5.3 对数据进行编码 5.4 设置cookie数据 5.5 返回相应 3.确定请求方式和路由 """ def delete(self,request): # 1.接收数据 data=json.loads(request.body.decode()) sku_id=data.get('sku_id') # 2.验证数据 try: # sku=SKU.objects.get(id=sku_id) # pk primary key 主键 sku=SKU.objects.get(pk=sku_id) except SKU.DoesNotExist: return JsonResponse({'code':RETCODE.NODATAERR,'errmsg':'没有此数据'}) # 3.获取用户信息,并进行判断 user = request.user if user.is_authenticated: # 4.登陆则操作redis # 4.1 连接redis redis_conn = get_redis_connection('carts') # 4.2 hash redis_conn.hdel('carts_%s'%user.id,sku_id) # set redis_conn.srem('selected_%s'%user.id,sku_id) # 4.3 返回相应 return JsonResponse({'code':RETCODE.OK,'errmsg':'ok'}) else: # 5.未登录则操作cookie # 5.1 先获取cookie数据,并进行判断 cookie_str=request.COOKIES.get('carts') if cookie_str is not None: # 如果有数据,则进行解码 cookie_dict=pickle.loads(base64.b64decode(cookie_str)) else: cookie_dict={} # 5.2 删除数据 {} if sku_id in cookie_dict: del cookie_dict[sku_id] # 5.3 对数据进行编码 cookie_data=base64.b64encode(pickle.dumps(cookie_dict)) # 5.4 设置cookie数据 response= JsonResponse({'code': RETCODE.OK, 'errmsg': 'ok'}) response.set_cookie('carts',cookie_data,max_age=7*24*3600) # 5.5 返回相应 return response """ 1.功能分析 用户行为: 当用户在未登录的情况下,添加了几样商品到购物车中 当用户登陆的时候,实现了购物车数据添加到redis中 前端行为: 登陆的时候,把cookie数据给后端 后端行为: 登陆的时候,将cookie数据合并到redis中 2. 分析后端实现的大体步骤 登陆的时候,将cookie数据合并到redis中 1.获取cookie数据,用户信息 2.删除cookie信息 3.把cookie数据加入到redis中 3.确定请求方式和路由 抽象的事务具体化 1.获取cookie数据 cookie { 1:{count:5,selected:False}, 3:{count:5,selected:True}, } 2.把redis数据读取下来 redis hash {1:100,2:100} set {1,2} 初始化一个字典 一个列表用于记录选中的id 一个列表用于记录未选中的id 3. 对cookie数据进行遍历 合并 new_update_hash {1:5,3:5} 更新到redis中 new_update_selected_set {3} 更新到reids中 new_update_unselected_set {1} 更新到reids中 4.将合并的数据更新到redis中 1.当cookie中和redis中都有相同的商品时,数量怎么办? 产品1: 以cookie为主, v 产品2: 以Redis为主, 产品3: 以Redis+cookie为主, 2.cookie中有数据,redis中没有 将cookie中的数据,添加到redis中 3.redis中已有的数据,不动 """ ######################以下代码为编码################################ import pickle import base64 # 组织数据 carts={ '1':{'count':5,'selected':True} } # 5.1 将字典转换为二进制 bytes_data=pickle.dumps(carts) # 5.2 再进行base64编码 encode_data=base64.b64encode(bytes_data) encode_data #####################以下代码为解码##################################### # 5.3 先将base64解码 decode_data=base64.b64decode(encode_data) # 5.4 将bytes类型转换为字典 pickle.loads(decode_data)
[ 1, 1053, 4390, 13, 13, 3166, 9557, 29889, 1124, 1053, 14355, 5103, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 3166, 9557, 29889, 7406, 1053, 4533, 13, 3166, 9557, 29918, 1127, 275, 1053, 679, 29918, 1127, 275, 29918, 9965, 13, 13, 3166, 11446, 29889, 16773, 29879, 29889, 9794, 1053, 18581, 29965, 13, 3166, 3667, 29879, 29889, 5327, 29918, 401, 1053, 28081, 16524, 13, 13, 15945, 29908, 13, 13, 29896, 29889, 29871, 30847, 30801, 30406, 31229, 31295, 31451, 31283, 29892, 30682, 30651, 31195, 31424, 31538, 30666, 235, 183, 176, 30834, 235, 192, 169, 30210, 31134, 30815, 29889, 13, 1678, 30847, 30801, 30406, 31229, 31451, 31283, 29892, 30953, 30682, 30651, 31195, 31424, 31538, 30666, 235, 183, 176, 30834, 235, 192, 169, 30210, 31134, 30815, 29889, 13, 13, 29906, 29889, 30847, 30801, 30406, 31229, 31295, 31451, 31283, 29892, 29871, 30672, 31381, 30698, 30982, 30946, 29871, 31427, 31399, 333, 29892, 31427, 31399, 30354, 31180, 29892, 31427, 31399, 30210, 31333, 30275, 31531, 31613, 13, 259, 30847, 30801, 30406, 31229, 31451, 31283, 29892, 29871, 30672, 31381, 30698, 30982, 30946, 29871, 30406, 31229, 333, 29892, 29871, 31427, 31399, 333, 29892, 31427, 31399, 30354, 31180, 29892, 31427, 31399, 30210, 31333, 30275, 31531, 31613, 13, 13, 29941, 29889, 30847, 30801, 30406, 31229, 31295, 31451, 31283, 29892, 259, 30982, 30946, 30505, 29871, 233, 184, 146, 235, 170, 139, 30943, 30275, 259, 15327, 30275, 13, 259, 30847, 30801, 30406, 31229, 31451, 31283, 29892, 268, 30982, 30946, 30505, 30354, 30763, 31700, 30275, 259, 313, 30573, 30743, 235, 177, 172, 30257, 30613, 31100, 31076, 30210, 30415, 231, 188, 163, 1127, 275, 29897, 30672, 31381, 233, 141, 141, 30354, 30763, 30982, 30946, 30780, 1127, 275, 30275, 13, 13, 13, 29946, 29889, 29871, 30847, 30801, 30406, 31229, 31295, 31451, 31283, 29892, 29871, 15327, 30210, 30354, 30763, 31168, 30607, 13, 1678, 426, 13, 4706, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 4706, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 4706, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 1678, 500, 13, 13, 268, 30847, 30801, 30406, 31229, 31451, 31283, 29892, 4367, 275, 29871, 869, 9039, 275, 30210, 30354, 30763, 30392, 30982, 30946, 30505, 30728, 30946, 30275, 29892, 13, 268, 30672, 31381, 30698, 232, 179, 192, 31180, 31022, 30210, 232, 144, 163, 30406, 30728, 30946, 30816, 31016, 13, 13, 1678, 1404, 29918, 333, 1919, 18181, 29918, 333, 29892, 2798, 29892, 8391, 13, 13, 268, 29896, 29892, 965, 29896, 29900, 29900, 29892, 29906, 29892, 5574, 13, 462, 29896, 29900, 29896, 29892, 29945, 29892, 8824, 13, 462, 29896, 29900, 29906, 29892, 29896, 29900, 29892, 5574, 13, 462, 29896, 29900, 29941, 29892, 29896, 29900, 29892, 8824, 13, 13, 13, 13, 1678, 1820, 3986, 29896, 29900, 29900, 29901, 29906, 13, 18884, 4629, 29918, 29896, 29900, 29900, 29901, 5574, 13, 13, 462, 29896, 29900, 29896, 29901, 29945, 13, 18884, 4629, 29918, 29896, 29900, 29896, 29901, 8824, 13, 13, 462, 29896, 29900, 29906, 29901, 29896, 29900, 13, 18884, 4629, 29918, 29896, 29900, 29906, 29901, 5574, 13, 13, 462, 29896, 29900, 29941, 29901, 29896, 29900, 13, 18884, 4629, 29918, 29896, 29900, 29941, 29901, 8824, 13, 13, 9651, 6608, 13, 1678, 1404, 29918, 333, 418, 29896, 29900, 29900, 29901, 29906, 13, 462, 29896, 29900, 29896, 29901, 29945, 13, 462, 29896, 29900, 29906, 29901, 29896, 29900, 13, 462, 29896, 29900, 29941, 29901, 29896, 29900, 13, 9651, 731, 259, 31333, 30275, 30210, 30505, 30893, 30733, 30275, 13, 8391, 29918, 1792, 29918, 333, 259, 518, 29896, 29900, 29900, 29892, 29896, 29900, 29906, 29962, 13, 13, 13, 18884, 6608, 13, 1678, 1404, 29918, 333, 418, 29896, 29900, 29900, 29901, 29906, 13, 462, 29896, 29900, 29896, 13018, 29945, 13, 462, 29896, 29900, 29906, 29901, 29896, 29900, 13, 462, 29896, 29900, 29941, 13018, 29896, 29900, 13, 13, 13, 29945, 29889, 13, 13, 29912, 13, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 29913, 13, 13, 3188, 29953, 29946, 13, 13, 13, 29896, 29954, 353, 29871, 29896, 29900, 29906, 29946, 9486, 13, 29896, 29924, 29922, 29896, 29900, 29906, 29946, 26067, 13, 29896, 26067, 29922, 29896, 29900, 29906, 29946, 29933, 13, 29896, 29933, 29922, 29947, 29890, 568, 29871, 31419, 31141, 30956, 259, 29900, 259, 29896, 13, 13, 29909, 1678, 29900, 29896, 29900, 29900, 29871, 29900, 29900, 29900, 29896, 13, 13, 29900, 29896, 29900, 29900, 29871, 29900, 29900, 29900, 29896, 1678, 29900, 29896, 29900, 29900, 29871, 29900, 29900, 29900, 29896, 1678, 29900, 29896, 29900, 29900, 29871, 29900, 29900, 29900, 29896, 13, 29909, 1669, 319, 965, 319, 13, 13, 13, 29900, 29896, 29900, 29900, 29900, 29900, 418, 29900, 29896, 29900, 29896, 29900, 29900, 1678, 29900, 29900, 29900, 29896, 29900, 29896, 418, 29900, 29900, 29900, 29900, 29900, 29896, 13, 29916, 1669, 343, 1678, 503, 3986, 263, 13, 13, 13, 259, 29945, 29889, 29896, 29871, 30998, 30578, 31259, 31415, 31640, 30573, 30685, 31174, 31072, 13, 13, 259, 29945, 29889, 29906, 29871, 31733, 31174, 30448, 3188, 29953, 29946, 31795, 31183, 13, 13, 1124, 597, 1514, 29889, 1127, 4492, 550, 29889, 510, 29914, 13, 13, 15945, 29908, 13, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 28084, 1144, 1053, 19130, 19347, 29924, 861, 262, 13, 13, 1990, 315, 5708, 1043, 29898, 1043, 1125, 13, 13, 1678, 9995, 13, 268, 29896, 29889, 31134, 30815, 30748, 233, 161, 147, 13, 268, 30406, 31229, 30448, 30573, 29901, 13, 268, 30658, 234, 174, 178, 30448, 30573, 29901, 4706, 30948, 30406, 31229, 30940, 31768, 30666, 30752, 235, 183, 176, 30834, 235, 192, 169, 30210, 30594, 31974, 29892, 30658, 234, 174, 178, 30698, 31997, 30893, 30406, 31229, 30689, 31021, 29892, 18181, 29918, 333, 29892, 2798, 29892, 31735, 31439, 30392, 31333, 30275, 13, 268, 30822, 234, 174, 178, 30448, 30573, 29901, 13, 13, 268, 29906, 29889, 29871, 30748, 233, 161, 147, 30822, 234, 174, 178, 31195, 31424, 30210, 30257, 30988, 233, 176, 168, 236, 173, 167, 13, 13, 308, 29896, 29889, 31092, 31997, 30354, 30763, 29892, 31791, 31683, 31427, 31399, 30689, 31021, 13, 308, 29906, 29889, 31244, 31024, 30683, 30406, 31229, 30689, 31021, 13, 308, 29941, 29889, 31393, 30763, 30406, 31229, 30392, 31191, 31451, 236, 156, 137, 30805, 31791, 31683, 13, 308, 29946, 29889, 31451, 236, 156, 137, 30406, 31229, 31904, 30732, 30354, 30763, 29898, 1127, 275, 29897, 13, 632, 29946, 29889, 29896, 29871, 31903, 31092, 30354, 30763, 31700, 13, 632, 29946, 29889, 29906, 29871, 31904, 30732, 30354, 30763, 31700, 13, 632, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 308, 29945, 29889, 31295, 31451, 31283, 30406, 31229, 31904, 30732, 21509, 13, 632, 29945, 29889, 29896, 29871, 31263, 234, 190, 138, 30354, 30763, 13, 632, 29945, 29889, 29906, 29871, 30783, 30354, 30763, 31174, 30448, 31795, 31183, 13, 632, 29945, 29889, 29941, 29871, 30872, 30669, 21509, 13, 632, 29945, 29889, 29946, 29871, 31086, 30742, 30990, 31370, 13, 308, 29953, 29889, 31086, 30742, 30990, 31370, 13, 13, 268, 29941, 29889, 31835, 30495, 31088, 31376, 30525, 30607, 30503, 30874, 31272, 13, 4706, 11971, 4706, 274, 5708, 13, 1678, 9995, 13, 1678, 822, 1400, 29898, 1311, 29892, 3827, 1125, 13, 13, 4706, 396, 29871, 29896, 29889, 31092, 31997, 30354, 30763, 29892, 31791, 31683, 31427, 31399, 30689, 31021, 13, 4706, 848, 29922, 3126, 29889, 18132, 29898, 3827, 29889, 2587, 29889, 13808, 3101, 13, 4706, 2071, 29884, 29918, 333, 29922, 1272, 29889, 657, 877, 18181, 29918, 333, 1495, 13, 4706, 2302, 29922, 1272, 29889, 657, 877, 2798, 1495, 13, 4706, 565, 451, 599, 4197, 18181, 29918, 333, 29892, 2798, 29962, 1125, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 16320, 5194, 21662, 5501, 3127, 7645, 22099, 31125, 30354, 30413, 30753, 29915, 1800, 13, 4706, 1018, 29901, 13, 9651, 2071, 29884, 29922, 16033, 29965, 29889, 12650, 29889, 657, 29898, 333, 29922, 18181, 29918, 333, 29897, 13, 4706, 5174, 18581, 29965, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 6632, 14573, 21662, 5501, 3127, 7645, 22099, 31423, 30417, 31389, 31427, 31399, 29915, 1800, 13, 13, 4706, 1018, 29901, 13, 9651, 2302, 29922, 524, 29898, 2798, 29897, 13, 4706, 5174, 8960, 29901, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 16320, 5194, 21662, 5501, 3127, 7645, 2396, 29908, 31125, 30354, 31745, 235, 178, 178, 29908, 1800, 13, 4706, 396, 31538, 30666, 235, 183, 176, 30834, 235, 192, 169, 31735, 31439, 31238, 30392, 31333, 30275, 13, 4706, 4629, 29922, 5574, 13, 4706, 396, 29871, 29906, 29889, 31244, 31024, 30683, 30406, 31229, 30689, 31021, 13, 4706, 1404, 29922, 3827, 29889, 1792, 13, 4706, 396, 29871, 29941, 29889, 31393, 30763, 30406, 31229, 30392, 31191, 31451, 236, 156, 137, 30805, 31791, 31683, 13, 4706, 396, 338, 29918, 27218, 630, 29871, 30392, 31439, 235, 178, 132, 30406, 31229, 29898, 31368, 232, 137, 143, 30406, 31229, 29897, 13, 4706, 565, 1404, 29889, 275, 29918, 27218, 630, 29901, 13, 9651, 396, 29871, 29946, 29889, 31451, 236, 156, 137, 30406, 31229, 31904, 30732, 30354, 30763, 29898, 1127, 275, 29897, 13, 9651, 396, 418, 29946, 29889, 29896, 29871, 31903, 31092, 30354, 30763, 31700, 13, 9651, 29825, 29918, 13082, 353, 679, 29918, 1127, 275, 29918, 9965, 877, 29883, 5708, 1495, 13, 9651, 396, 418, 29946, 29889, 29906, 29871, 31904, 30732, 30354, 30763, 31700, 13, 9651, 396, 6608, 259, 1820, 29901, 13, 9651, 396, 1669, 2071, 29884, 29918, 333, 29901, 2798, 13, 9651, 396, 1669, 1746, 29901, 1767, 13, 9651, 396, 1669, 1746, 29901, 1767, 13, 9651, 396, 29871, 31383, 30698, 234, 183, 178, 30666, 30354, 30763, 13, 9651, 396, 29825, 29918, 13082, 29889, 29882, 842, 877, 29883, 5708, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29892, 2798, 29897, 13, 13, 9651, 396, 29871, 30287, 29871, 31441, 30886, 31624, 30397, 13, 9651, 715, 29922, 1127, 275, 29918, 13082, 29889, 13096, 5570, 580, 13, 9651, 396, 29871, 30685, 29871, 30998, 31084, 31650, 31997, 30893, 30780, 31624, 30397, 30275, 13, 9651, 715, 29889, 29882, 3742, 29878, 1609, 877, 29883, 5708, 29918, 29995, 29879, 29915, 1273, 1404, 29889, 333, 29892, 2071, 29884, 29918, 333, 29892, 2302, 29897, 13, 9651, 396, 731, 13, 13, 9651, 715, 29889, 29879, 1202, 877, 8391, 29918, 29995, 29879, 29915, 1273, 1404, 29889, 333, 29892, 2071, 29884, 29918, 333, 29897, 13, 9651, 396, 29871, 30457, 29871, 233, 140, 170, 30448, 31624, 30397, 13, 9651, 715, 29889, 7978, 580, 13, 13, 9651, 396, 29825, 29918, 13082, 29889, 29882, 3742, 29878, 1609, 877, 29883, 5708, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29892, 2798, 29897, 13, 9651, 396, 396, 731, 13, 9651, 396, 13, 9651, 396, 29825, 29918, 13082, 29889, 29879, 1202, 877, 8391, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29897, 13, 9651, 396, 418, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 8949, 5501, 3127, 7645, 22099, 554, 29915, 1800, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 29871, 29945, 29889, 31295, 31451, 31283, 30406, 31229, 31904, 30732, 21509, 13, 13, 9651, 396, 29871, 29945, 29889, 29900, 29871, 31244, 31024, 30683, 21509, 30275, 29871, 30682, 30815, 30946, 30505, 30210, 30354, 30763, 13, 9651, 274, 5708, 29918, 710, 29922, 3827, 29889, 3217, 8949, 29059, 29889, 657, 877, 29883, 5708, 1495, 13, 9651, 565, 274, 5708, 29918, 710, 338, 6213, 29901, 13, 18884, 396, 31639, 30592, 31423, 30417, 235, 183, 176, 30834, 235, 192, 169, 30354, 30763, 13, 18884, 15327, 29918, 1272, 353, 426, 13, 462, 1678, 2071, 29884, 29918, 333, 29901, 11117, 2798, 2396, 2302, 29892, 525, 8391, 2396, 5852, 29913, 13, 18884, 500, 13, 9651, 1683, 29901, 13, 18884, 396, 31639, 30592, 30417, 235, 183, 176, 30834, 235, 192, 169, 30354, 30763, 13, 18884, 396, 29871, 31244, 3188, 29953, 29946, 31201, 31183, 13, 18884, 21822, 29918, 1272, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 29883, 5708, 29918, 710, 29897, 13, 18884, 396, 29871, 31733, 13193, 31415, 30578, 31259, 13, 18884, 15327, 29918, 1272, 29922, 23945, 280, 29889, 18132, 29898, 13808, 29918, 1272, 29897, 13, 18884, 396, 29871, 31733, 31383, 30698, 31174, 30448, 31791, 31683, 13, 18884, 396, 426, 29896, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 930, 13, 18884, 396, 29871, 31427, 31399, 333, 30392, 31191, 30505, 30578, 31259, 30275, 13, 18884, 396, 29871, 29896, 13, 18884, 565, 2071, 29884, 29918, 333, 297, 15327, 29918, 1272, 29901, 13, 13, 462, 1678, 396, 234, 183, 178, 30666, 30354, 31180, 13, 462, 1678, 3978, 29918, 2798, 29922, 21509, 29918, 1272, 29961, 18181, 29918, 333, 22322, 2798, 2033, 13, 462, 1678, 396, 2302, 29922, 12574, 29918, 2798, 29974, 2798, 13, 462, 1678, 2302, 23661, 12574, 29918, 2798, 13, 462, 1678, 396, 31100, 30374, 30578, 31259, 30354, 30763, 13, 462, 1678, 15327, 29918, 1272, 29961, 18181, 29918, 333, 29962, 3790, 29915, 2798, 2396, 2798, 5501, 8391, 2396, 5574, 29913, 13, 18884, 1683, 29901, 13, 462, 1678, 15327, 29918, 1272, 29961, 18181, 29918, 333, 29962, 3790, 29915, 2798, 2396, 2798, 5501, 8391, 2396, 5574, 29913, 13, 13, 9651, 396, 418, 29945, 29889, 29896, 29871, 31263, 234, 190, 138, 30354, 30763, 13, 9651, 9995, 13, 9651, 426, 13, 18884, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 18884, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 18884, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 9651, 500, 13, 9651, 9995, 13, 13, 9651, 396, 418, 29945, 29889, 29906, 29871, 30783, 30354, 30763, 31174, 30448, 31795, 31183, 13, 9651, 396, 259, 30578, 31259, 31415, 13193, 13, 9651, 15327, 29918, 13193, 29922, 23945, 280, 29889, 29881, 17204, 29898, 21509, 29918, 1272, 29897, 13, 9651, 396, 29871, 2967, 29953, 29946, 31795, 31183, 13, 9651, 15327, 29918, 710, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 21509, 29918, 13193, 29897, 13, 9651, 396, 418, 29945, 29889, 29941, 29871, 30872, 30669, 21509, 13, 9651, 2933, 29922, 8148, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 8949, 5501, 3127, 7645, 22099, 554, 29915, 1800, 13, 13, 9651, 2933, 29889, 842, 29918, 21509, 877, 29883, 5708, 742, 21509, 29918, 710, 29892, 3317, 29918, 482, 29922, 29955, 29930, 29906, 29946, 29930, 29941, 29953, 29900, 29900, 29897, 13, 13, 9651, 396, 418, 29945, 29889, 29946, 29871, 31086, 30742, 30990, 31370, 13, 9651, 736, 2933, 13, 13, 1678, 9995, 13, 268, 29896, 29889, 31134, 30815, 30748, 233, 161, 147, 13, 308, 30406, 31229, 30448, 30573, 29901, 13, 308, 30658, 234, 174, 178, 30448, 30573, 29901, 13, 308, 30822, 234, 174, 178, 30448, 30573, 29901, 13, 13, 268, 29906, 29889, 29871, 30748, 233, 161, 147, 30822, 234, 174, 178, 31195, 31424, 30210, 30257, 30988, 233, 176, 168, 236, 173, 167, 13, 13, 632, 29896, 29889, 31244, 31024, 30683, 30406, 31229, 30689, 31021, 13, 632, 29906, 29889, 30847, 30801, 30406, 31229, 30573, 31451, 236, 156, 137, 29892, 31403, 31594, 21509, 30275, 31024, 30683, 30689, 31021, 13, 18884, 426, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 18884, 500, 13, 462, 29906, 29889, 29896, 29871, 31024, 30683, 31427, 31399, 333, 13, 462, 29906, 29889, 29906, 29871, 31393, 30763, 31427, 31399, 333, 31174, 30448, 31427, 31399, 30689, 31021, 30210, 31213, 235, 178, 165, 13, 462, 29906, 29889, 29941, 29871, 30998, 30783, 31133, 31415, 31640, 30573, 30578, 31259, 13, 462, 29906, 29889, 29946, 29871, 31086, 30742, 30990, 31370, 13, 632, 29941, 29889, 30847, 30801, 30406, 31229, 31451, 236, 156, 137, 29892, 31403, 31594, 1127, 275, 30275, 31024, 30683, 30689, 31021, 13, 462, 29941, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 462, 29941, 29889, 29906, 29871, 31024, 30683, 1127, 275, 30354, 30763, 13, 18884, 6608, 1678, 2071, 29884, 29918, 333, 29901, 2798, 13, 18884, 731, 268, 518, 18181, 29918, 333, 29892, 18181, 29918, 333, 29962, 13, 462, 29941, 29889, 29941, 29871, 31024, 30683, 31427, 31399, 333, 13, 462, 29941, 29889, 29946, 29871, 31393, 30763, 31427, 31399, 333, 31174, 30448, 31427, 31399, 30689, 31021, 30210, 31213, 235, 178, 165, 13, 462, 29941, 29889, 29945, 29871, 30998, 30783, 31133, 31415, 31640, 30573, 30578, 31259, 13, 462, 29941, 29889, 29953, 29871, 31086, 30742, 30990, 31370, 13, 13, 13, 13, 632, 29896, 29889, 31244, 31024, 30683, 30406, 31229, 30689, 31021, 13, 632, 29906, 29889, 30847, 30801, 30406, 31229, 30573, 31451, 236, 156, 137, 29892, 31403, 31594, 21509, 30275, 31024, 30683, 30689, 31021, 13, 18884, 426, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 462, 1678, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 18884, 500, 13, 13, 632, 29941, 29889, 30847, 30801, 30406, 31229, 31451, 236, 156, 137, 29892, 31403, 31594, 1127, 275, 30275, 31024, 30683, 30689, 31021, 13, 462, 29941, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 462, 29941, 29889, 29906, 29871, 31024, 30683, 1127, 275, 30354, 30763, 13, 18884, 6608, 1678, 2071, 29884, 29918, 333, 29901, 2798, 13, 18884, 731, 268, 518, 18181, 29918, 333, 29892, 18181, 29918, 333, 29962, 13, 632, 29946, 29871, 31024, 30683, 31427, 31399, 333, 13, 632, 29945, 29871, 31393, 30763, 31427, 31399, 333, 31174, 30448, 31427, 31399, 30689, 31021, 30210, 31213, 235, 178, 165, 13, 632, 29953, 29871, 30998, 30783, 31133, 31415, 31640, 30573, 30578, 31259, 13, 632, 29955, 29871, 31086, 30742, 30990, 31370, 13, 13, 13, 268, 29941, 29889, 31835, 30495, 31088, 31376, 30525, 30607, 30503, 30874, 31272, 13, 1678, 9995, 13, 1678, 822, 679, 29898, 1311, 29892, 3827, 1125, 13, 4706, 396, 13, 4706, 396, 29871, 29896, 29889, 31244, 31024, 30683, 30406, 31229, 30689, 31021, 13, 4706, 1404, 29922, 3827, 29889, 1792, 13, 4706, 565, 1404, 29889, 275, 29918, 27218, 630, 29901, 13, 9651, 396, 29871, 29941, 29889, 30847, 30801, 30406, 31229, 31451, 236, 156, 137, 29892, 31403, 31594, 1127, 275, 30275, 31024, 30683, 30689, 31021, 13, 9651, 396, 418, 29941, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 9651, 29825, 29918, 13082, 353, 679, 29918, 1127, 275, 29918, 9965, 877, 29883, 5708, 1495, 13, 9651, 396, 418, 29941, 29889, 29906, 29871, 31024, 30683, 1127, 275, 30354, 30763, 13, 9651, 396, 268, 6608, 1678, 2071, 29884, 29918, 333, 29901, 2798, 13, 9651, 396, 426, 18181, 29918, 333, 29901, 2798, 29892, 18181, 29918, 333, 29901, 2798, 29892, 3045, 29913, 13, 9651, 396, 426, 29896, 29901, 29896, 29900, 29892, 29906, 29901, 29906, 29900, 29913, 13, 9651, 1178, 29918, 2798, 29879, 29922, 1127, 275, 29918, 13082, 29889, 29882, 657, 497, 877, 29883, 5708, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29897, 13, 13, 9651, 396, 268, 731, 268, 518, 18181, 29918, 333, 29892, 18181, 29918, 333, 29962, 13, 9651, 396, 518, 18181, 29918, 333, 29892, 18181, 29918, 333, 29962, 13, 9651, 396, 518, 29896, 29962, 13, 9651, 4629, 29918, 4841, 29922, 1127, 275, 29918, 13082, 29889, 3844, 13415, 877, 8391, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29897, 13, 13, 9651, 396, 30998, 1127, 275, 30354, 30763, 31415, 31640, 30573, 21509, 31168, 30607, 13, 9651, 396, 29871, 15327, 29918, 710, 353, 426, 18181, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 930, 13, 9651, 15327, 29918, 8977, 353, 6571, 13, 9651, 363, 2071, 29884, 29918, 333, 29892, 2798, 297, 1178, 29918, 2798, 29879, 29889, 7076, 7295, 13, 18884, 396, 565, 2071, 29884, 29918, 333, 297, 4629, 29918, 4841, 29901, 13, 18884, 396, 268, 4629, 29922, 5574, 13, 18884, 396, 1683, 29901, 13, 18884, 396, 268, 4629, 29922, 8824, 13, 18884, 15327, 29918, 8977, 29961, 524, 29898, 18181, 29918, 333, 4638, 3790, 13, 462, 1678, 525, 2798, 2396, 524, 29898, 2798, 511, 13, 462, 1678, 525, 8391, 2396, 18181, 29918, 333, 297, 4629, 29918, 4841, 13, 18884, 500, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 29871, 29906, 29889, 30847, 30801, 30406, 31229, 30573, 31451, 236, 156, 137, 29892, 31403, 31594, 21509, 30275, 31024, 30683, 30689, 31021, 13, 9651, 396, 268, 426, 13, 9651, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 9651, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 9651, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 9651, 396, 268, 500, 13, 9651, 396, 13, 9651, 15327, 29918, 1272, 29922, 3827, 29889, 3217, 8949, 29059, 29889, 657, 877, 29883, 5708, 1495, 13, 9651, 565, 15327, 29918, 1272, 338, 451, 6213, 29901, 13, 18884, 396, 31244, 31174, 30448, 3188, 29953, 29946, 31201, 31183, 13, 18884, 15327, 29918, 8977, 29922, 23945, 280, 29889, 18132, 29898, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 21509, 29918, 1272, 876, 13, 9651, 1683, 29901, 13, 18884, 15327, 29918, 8977, 3790, 29913, 13, 13, 4706, 396, 29871, 29946, 29871, 31024, 30683, 31427, 31399, 333, 29871, 1192, 29871, 31570, 30573, 1127, 275, 30210, 30354, 30763, 31320, 31901, 30503, 21509, 30210, 30354, 30763, 31320, 31901, 30413, 30287, 235, 138, 183, 13, 4706, 396, 29871, 30672, 31381, 31370, 31751, 235, 177, 172, 31221, 31381, 30210, 30354, 30763, 30287, 235, 138, 183, 13, 4706, 396, 259, 15327, 29918, 8977, 353, 426, 13, 4706, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 4706, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29906, 29892, 8391, 29901, 8824, 1118, 13, 4706, 396, 308, 2071, 29884, 29918, 333, 26254, 2798, 29901, 29955, 29892, 8391, 29901, 5574, 1118, 13, 4706, 396, 268, 500, 13, 4706, 18999, 29922, 21509, 29918, 8977, 29889, 8149, 580, 29871, 14330, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 29892, 29953, 29962, 13, 13, 4706, 396, 29871, 29945, 29871, 31393, 30763, 31427, 31399, 333, 31174, 30448, 31427, 31399, 30689, 31021, 30210, 31213, 235, 178, 165, 13, 4706, 274, 5708, 29918, 1761, 29922, 2636, 13, 4706, 363, 1178, 297, 18999, 29901, 13, 9651, 2071, 29884, 29922, 16033, 29965, 29889, 12650, 29889, 657, 29898, 333, 29922, 333, 29897, 13, 9651, 396, 29871, 29953, 29871, 30998, 30783, 31133, 31415, 31640, 30573, 30578, 31259, 13, 9651, 274, 5708, 29918, 1761, 29889, 4397, 3319, 13, 18884, 525, 333, 2396, 18181, 29889, 333, 29892, 13, 18884, 525, 978, 2396, 18181, 29889, 978, 29892, 13, 18884, 525, 2798, 2396, 15327, 29918, 8977, 29889, 657, 29898, 18181, 29889, 333, 467, 657, 877, 2798, 5477, 13, 18884, 525, 8391, 2396, 851, 29898, 21509, 29918, 8977, 29889, 657, 29898, 18181, 29889, 333, 467, 657, 877, 8391, 1495, 511, 29871, 396, 29871, 30998, 5574, 30214, 31415, 29915, 5574, 29915, 30214, 30525, 231, 193, 194, 3126, 31201, 233, 161, 147, 13, 18884, 525, 4381, 29918, 3027, 29918, 2271, 2396, 18181, 29889, 4381, 29918, 3027, 29889, 2271, 29892, 13, 18884, 525, 9175, 2396, 710, 29898, 18181, 29889, 9175, 511, 396, 29871, 31594, 23307, 877, 29896, 29900, 29889, 29906, 1495, 30275, 30683, 30544, 29915, 29896, 29900, 29889, 29906, 29915, 30214, 30525, 231, 193, 194, 3126, 31201, 233, 161, 147, 13, 18884, 525, 14506, 2396, 710, 29898, 18181, 29889, 9175, 334, 15327, 29918, 8977, 29889, 657, 29898, 18181, 29889, 333, 467, 657, 877, 2798, 1495, 511, 13, 13, 9651, 5615, 13, 13, 4706, 396, 29871, 29955, 29871, 31086, 30742, 30990, 31370, 13, 4706, 736, 4050, 29898, 3827, 5501, 13823, 29889, 1420, 742, 4703, 3790, 29915, 13823, 29918, 808, 375, 2396, 29883, 5708, 29918, 1761, 1800, 13, 13, 1678, 9995, 13, 268, 29896, 29889, 31134, 30815, 30748, 233, 161, 147, 13, 308, 30406, 31229, 30448, 30573, 29901, 4706, 30406, 31229, 30682, 30815, 30437, 30940, 31768, 233, 162, 147, 30287, 30502, 31427, 31399, 30210, 30354, 31180, 29914, 31333, 30275, 31531, 31613, 13, 308, 30658, 234, 174, 178, 30448, 30573, 29901, 4706, 30658, 234, 174, 178, 31383, 30698, 31997, 30893, 29871, 30940, 31768, 30210, 2071, 29884, 29918, 333, 29892, 2798, 29892, 8391, 29871, 30651, 31436, 30406, 31229, 30689, 31021, 13, 308, 30822, 234, 174, 178, 30448, 30573, 29901, 4706, 31195, 31424, 31100, 30374, 13, 13, 268, 29906, 29889, 29871, 30748, 233, 161, 147, 30822, 234, 174, 178, 31195, 31424, 30210, 30257, 30988, 233, 176, 168, 236, 173, 167, 13, 632, 29896, 29889, 31092, 31997, 30354, 30763, 13, 632, 29906, 29889, 236, 173, 143, 235, 178, 132, 30354, 30763, 13, 632, 29941, 29889, 31024, 30683, 30406, 31229, 30689, 31021, 13, 632, 29946, 29889, 31451, 236, 156, 137, 30406, 31229, 31100, 30374, 1127, 275, 13, 462, 29946, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 462, 29946, 29889, 29906, 29871, 31100, 30374, 30354, 30763, 13, 462, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 632, 29945, 29889, 31295, 31451, 31283, 30406, 31229, 31100, 30374, 21509, 13, 462, 29945, 29889, 29896, 29871, 31024, 30683, 21509, 30275, 30210, 30354, 30763, 29892, 31666, 31174, 30448, 31791, 31683, 13, 462, 268, 30847, 30801, 30417, 30354, 30763, 31403, 31383, 30698, 31174, 30448, 31201, 31183, 13, 462, 29945, 29889, 29906, 29871, 31100, 30374, 30354, 30763, 29871, 7774, 3790, 29913, 13, 462, 29945, 29889, 29941, 29871, 30998, 30578, 31259, 31174, 30448, 31795, 31183, 13, 462, 29945, 29889, 29946, 29871, 30872, 30669, 21509, 13, 462, 29945, 29889, 29945, 29871, 31086, 30742, 30990, 31370, 13, 13, 268, 29941, 29889, 31835, 30495, 31088, 31376, 30525, 30607, 30503, 30874, 31272, 13, 1678, 9995, 13, 1678, 822, 1925, 29898, 1311, 29892, 3827, 1125, 13, 4706, 396, 29871, 29896, 29889, 31092, 31997, 30354, 30763, 13, 4706, 848, 29922, 3126, 29889, 18132, 29898, 3827, 29889, 2587, 29889, 13808, 3101, 13, 4706, 2071, 29884, 29918, 333, 29922, 1272, 29889, 657, 877, 18181, 29918, 333, 1495, 13, 4706, 2302, 29922, 1272, 29889, 657, 877, 2798, 1495, 13, 4706, 4629, 29922, 1272, 29889, 657, 877, 8391, 1495, 13, 4706, 396, 29871, 29906, 29889, 236, 173, 143, 235, 178, 132, 30354, 30763, 29898, 31600, 234, 152, 168, 29897, 13, 4706, 1018, 29901, 13, 9651, 2071, 29884, 29922, 16033, 29965, 29889, 12650, 29889, 657, 29898, 333, 29922, 18181, 29918, 333, 29897, 13, 4706, 5174, 18581, 29965, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 6632, 14573, 21662, 5501, 3127, 7645, 22099, 31423, 30417, 31389, 30689, 31021, 29915, 1800, 13, 4706, 396, 29871, 29941, 29889, 31024, 30683, 30406, 31229, 30689, 31021, 13, 4706, 1404, 29922, 3827, 29889, 1792, 13, 4706, 565, 1404, 29889, 275, 29918, 27218, 630, 29901, 13, 9651, 396, 29871, 29946, 29889, 31451, 236, 156, 137, 30406, 31229, 31100, 30374, 1127, 275, 13, 9651, 396, 418, 29946, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 9651, 29825, 29918, 13082, 353, 679, 29918, 1127, 275, 29918, 9965, 877, 29883, 5708, 1495, 13, 9651, 396, 418, 29946, 29889, 29906, 29871, 31100, 30374, 30354, 30763, 13, 9651, 396, 8568, 13, 9651, 29825, 29918, 13082, 29889, 29882, 842, 877, 29883, 5708, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29892, 2798, 29897, 13, 9651, 396, 731, 13, 9651, 565, 4629, 29901, 13, 18884, 29825, 29918, 13082, 29889, 29879, 1202, 877, 8391, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29897, 13, 9651, 1683, 29901, 13, 18884, 29825, 29918, 13082, 29889, 29879, 1745, 877, 8391, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29897, 13, 9651, 396, 418, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 9651, 848, 3790, 13, 18884, 525, 2798, 2396, 2798, 29892, 13, 18884, 525, 333, 2396, 18181, 29918, 333, 29892, 13, 18884, 525, 8391, 2396, 8391, 29892, 13, 18884, 525, 978, 2396, 2071, 29884, 29889, 978, 29892, 13, 18884, 525, 4381, 29918, 3027, 29918, 2271, 2396, 2071, 29884, 29889, 4381, 29918, 3027, 29889, 2271, 29892, 13, 18884, 525, 9175, 2396, 2071, 29884, 29889, 9175, 29892, 13, 18884, 525, 14506, 2396, 2071, 29884, 29889, 9175, 334, 2302, 29892, 13, 9651, 500, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 8949, 5501, 3127, 7645, 22099, 554, 3788, 13823, 29918, 18181, 2396, 1272, 1800, 13, 13, 4706, 1683, 29901, 13, 13, 9651, 396, 29871, 29945, 29889, 31295, 31451, 31283, 30406, 31229, 31100, 30374, 21509, 13, 9651, 396, 418, 29945, 29889, 29896, 29871, 31024, 30683, 21509, 30275, 30210, 30354, 30763, 29892, 31666, 31174, 30448, 31791, 31683, 13, 9651, 15327, 29918, 710, 29922, 3827, 29889, 3217, 8949, 29059, 29889, 657, 877, 29883, 5708, 1495, 13, 9651, 565, 15327, 29918, 710, 338, 451, 6213, 29901, 13, 18884, 396, 3986, 30847, 30801, 30417, 30354, 30763, 31403, 31383, 30698, 31174, 30448, 31201, 31183, 13, 18884, 15327, 29918, 8977, 29922, 23945, 280, 29889, 18132, 29898, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 21509, 29918, 710, 876, 13, 9651, 1683, 29901, 13, 18884, 15327, 29918, 8977, 3790, 29913, 13, 9651, 396, 418, 29945, 29889, 29906, 29871, 31100, 30374, 30354, 30763, 29871, 7774, 3790, 29913, 13, 9651, 396, 2071, 29884, 29918, 333, 29871, 30392, 31191, 30505, 30578, 31259, 31025, 30746, 30275, 13, 9651, 396, 274, 5708, 353, 426, 18181, 29918, 333, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 930, 13, 9651, 565, 2071, 29884, 29918, 333, 297, 15327, 29918, 8977, 29901, 13, 18884, 15327, 29918, 8977, 29961, 18181, 29918, 333, 29962, 3790, 13, 462, 1678, 525, 2798, 2396, 2798, 29892, 13, 462, 1678, 525, 8391, 2396, 8391, 13, 18884, 500, 13, 9651, 396, 418, 29945, 29889, 29941, 29871, 30998, 30578, 31259, 31174, 30448, 31795, 31183, 13, 9651, 15327, 29918, 1272, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 23945, 280, 29889, 29881, 17204, 29898, 21509, 29918, 8977, 876, 13, 9651, 396, 418, 29945, 29889, 29946, 29871, 30872, 30669, 21509, 13, 9651, 848, 353, 426, 13, 18884, 525, 2798, 2396, 2302, 29892, 13, 18884, 525, 333, 2396, 2071, 29884, 29918, 333, 29892, 13, 18884, 525, 8391, 2396, 4629, 29892, 13, 18884, 525, 978, 2396, 2071, 29884, 29889, 978, 29892, 13, 18884, 525, 4381, 29918, 3027, 29918, 2271, 2396, 2071, 29884, 29889, 4381, 29918, 3027, 29889, 2271, 29892, 13, 18884, 525, 9175, 2396, 2071, 29884, 29889, 9175, 29892, 13, 18884, 525, 14506, 2396, 2071, 29884, 29889, 9175, 334, 2302, 29892, 13, 9651, 500, 13, 9651, 2933, 353, 14355, 5103, 3319, 29915, 401, 2396, 28081, 16524, 29889, 8949, 29892, 525, 3127, 7645, 2396, 525, 554, 742, 525, 13823, 29918, 18181, 2396, 848, 1800, 13, 9651, 2933, 29889, 842, 29918, 21509, 877, 29883, 5708, 742, 21509, 29918, 1272, 29892, 3317, 29918, 482, 29922, 29955, 29930, 29906, 29946, 29930, 29941, 29953, 29900, 29900, 29897, 13, 13, 9651, 396, 418, 29945, 29889, 29945, 29871, 31086, 30742, 30990, 31370, 13, 13, 9651, 736, 2933, 13, 13, 1678, 9995, 13, 268, 29896, 29889, 31134, 30815, 30748, 233, 161, 147, 13, 308, 30406, 31229, 30448, 30573, 29901, 13, 308, 30658, 234, 174, 178, 30448, 30573, 29901, 13, 308, 30822, 234, 174, 178, 30448, 30573, 29901, 13, 13, 268, 29906, 29889, 29871, 30748, 233, 161, 147, 30822, 234, 174, 178, 31195, 31424, 30210, 30257, 30988, 233, 176, 168, 236, 173, 167, 13, 632, 29896, 29889, 31092, 31997, 30354, 30763, 13, 632, 29906, 29889, 236, 173, 143, 235, 178, 132, 30354, 30763, 13, 632, 29941, 29889, 31024, 30683, 30406, 31229, 30689, 31021, 29892, 31666, 31174, 30448, 31791, 31683, 13, 632, 29946, 29889, 31451, 236, 156, 137, 31403, 31904, 30732, 1127, 275, 13, 462, 29946, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 462, 29946, 29889, 29906, 6608, 13, 462, 1678, 731, 13, 462, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 632, 29945, 29889, 31295, 31451, 31283, 31403, 31904, 30732, 21509, 13, 462, 29945, 29889, 29896, 29871, 31244, 31024, 30683, 21509, 30354, 30763, 29892, 31666, 31174, 30448, 31791, 31683, 13, 462, 268, 30847, 30801, 30417, 30354, 30763, 29892, 31403, 31174, 30448, 31201, 31183, 13, 462, 29945, 29889, 29906, 29871, 31916, 31152, 30354, 30763, 29871, 6571, 13, 462, 29945, 29889, 29941, 29871, 30783, 30354, 30763, 31174, 30448, 31795, 31183, 13, 462, 29945, 29889, 29946, 29871, 30872, 30669, 21509, 30354, 30763, 13, 462, 29945, 29889, 29945, 29871, 31086, 30742, 30990, 31370, 13, 13, 268, 29941, 29889, 31835, 30495, 31088, 31376, 30525, 30607, 30503, 30874, 31272, 13, 1678, 9995, 13, 1678, 822, 5217, 29898, 1311, 29892, 3827, 1125, 13, 4706, 396, 29871, 29896, 29889, 31092, 31997, 30354, 30763, 13, 4706, 848, 29922, 3126, 29889, 18132, 29898, 3827, 29889, 2587, 29889, 13808, 3101, 13, 4706, 2071, 29884, 29918, 333, 29922, 1272, 29889, 657, 877, 18181, 29918, 333, 1495, 13, 4706, 396, 29871, 29906, 29889, 236, 173, 143, 235, 178, 132, 30354, 30763, 13, 4706, 1018, 29901, 13, 9651, 396, 2071, 29884, 29922, 16033, 29965, 29889, 12650, 29889, 657, 29898, 333, 29922, 18181, 29918, 333, 29897, 13, 9651, 396, 282, 29895, 7601, 1820, 29871, 30888, 236, 151, 177, 13, 9651, 2071, 29884, 29922, 16033, 29965, 29889, 12650, 29889, 657, 29898, 20571, 29922, 18181, 29918, 333, 29897, 13, 4706, 5174, 18581, 29965, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 6632, 14573, 21662, 5501, 3127, 7645, 22099, 31423, 30417, 31389, 30354, 30763, 29915, 1800, 13, 4706, 396, 29871, 29941, 29889, 31024, 30683, 30406, 31229, 30689, 31021, 29892, 31666, 31174, 30448, 31791, 31683, 13, 4706, 1404, 353, 2009, 29889, 1792, 13, 4706, 565, 1404, 29889, 275, 29918, 27218, 630, 29901, 13, 9651, 396, 29871, 29946, 29889, 31451, 236, 156, 137, 31403, 31904, 30732, 1127, 275, 13, 9651, 396, 418, 29946, 29889, 29896, 29871, 31903, 31092, 1127, 275, 13, 9651, 29825, 29918, 13082, 353, 679, 29918, 1127, 275, 29918, 9965, 877, 29883, 5708, 1495, 13, 9651, 396, 418, 29946, 29889, 29906, 6608, 13, 9651, 29825, 29918, 13082, 29889, 29882, 6144, 877, 29883, 5708, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29897, 13, 9651, 396, 308, 731, 13, 9651, 29825, 29918, 13082, 29889, 29879, 1745, 877, 8391, 29918, 29995, 29879, 29915, 29995, 1792, 29889, 333, 29892, 18181, 29918, 333, 29897, 13, 9651, 396, 418, 29946, 29889, 29941, 29871, 31086, 30742, 30990, 31370, 13, 9651, 736, 14355, 5103, 3319, 29915, 401, 2396, 1525, 29911, 16524, 29889, 8949, 5501, 3127, 7645, 22099, 554, 29915, 1800, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 29871, 29945, 29889, 31295, 31451, 31283, 31403, 31904, 30732, 21509, 13, 9651, 396, 418, 29945, 29889, 29896, 29871, 31244, 31024, 30683, 21509, 30354, 30763, 29892, 31666, 31174, 30448, 31791, 31683, 13, 9651, 15327, 29918, 710, 29922, 3827, 29889, 3217, 8949, 29059, 29889, 657, 877, 29883, 5708, 1495, 13, 9651, 565, 15327, 29918, 710, 338, 451, 6213, 29901, 13, 18884, 396, 3986, 30847, 30801, 30417, 30354, 30763, 29892, 31403, 31174, 30448, 31201, 31183, 13, 18884, 15327, 29918, 8977, 29922, 23945, 280, 29889, 18132, 29898, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 21509, 29918, 710, 876, 13, 9651, 1683, 29901, 13, 18884, 15327, 29918, 8977, 3790, 29913, 13, 9651, 396, 418, 29945, 29889, 29906, 29871, 31916, 31152, 30354, 30763, 29871, 6571, 13, 9651, 565, 2071, 29884, 29918, 333, 297, 15327, 29918, 8977, 29901, 13, 18884, 628, 15327, 29918, 8977, 29961, 18181, 29918, 333, 29962, 13, 9651, 396, 418, 29945, 29889, 29941, 29871, 30783, 30354, 30763, 31174, 30448, 31795, 31183, 13, 9651, 15327, 29918, 1272, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 23945, 280, 29889, 29881, 17204, 29898, 21509, 29918, 8977, 876, 13, 9651, 396, 418, 29945, 29889, 29946, 29871, 30872, 30669, 21509, 30354, 30763, 13, 9651, 2933, 29922, 14355, 5103, 3319, 29915, 401, 2396, 28081, 16524, 29889, 8949, 29892, 525, 3127, 7645, 2396, 525, 554, 29915, 1800, 13, 9651, 2933, 29889, 842, 29918, 21509, 877, 29883, 5708, 742, 21509, 29918, 1272, 29892, 3317, 29918, 482, 29922, 29955, 29930, 29906, 29946, 29930, 29941, 29953, 29900, 29900, 29897, 13, 9651, 396, 418, 29945, 29889, 29945, 29871, 31086, 30742, 30990, 31370, 13, 9651, 736, 2933, 13, 13, 15945, 29908, 13, 29896, 29889, 31134, 30815, 30748, 233, 161, 147, 13, 268, 30406, 31229, 30448, 30573, 29901, 4706, 30948, 30406, 31229, 30505, 31295, 31451, 31283, 30210, 30993, 232, 137, 184, 30557, 29892, 31538, 30666, 30743, 232, 138, 163, 31819, 31427, 31399, 30780, 235, 183, 176, 30834, 235, 192, 169, 30275, 13, 462, 30948, 30406, 31229, 31451, 236, 156, 137, 30210, 30594, 31974, 29892, 31195, 31424, 30743, 235, 183, 176, 30834, 235, 192, 169, 30354, 30763, 31538, 30666, 30780, 1127, 275, 30275, 13, 268, 30658, 234, 174, 178, 30448, 30573, 29901, 13, 462, 31451, 236, 156, 137, 30210, 30594, 31974, 29892, 233, 141, 141, 21509, 30354, 30763, 31999, 30822, 234, 174, 178, 13, 268, 30822, 234, 174, 178, 30448, 30573, 29901, 418, 31451, 236, 156, 137, 30210, 30594, 31974, 29892, 30998, 21509, 30354, 30763, 30733, 31666, 30780, 1127, 275, 30275, 13, 13, 29906, 29889, 29871, 30748, 233, 161, 147, 30822, 234, 174, 178, 31195, 31424, 30210, 30257, 30988, 233, 176, 168, 236, 173, 167, 13, 308, 31451, 236, 156, 137, 30210, 30594, 31974, 29892, 30998, 21509, 30354, 30763, 30733, 31666, 30780, 1127, 275, 30275, 13, 13, 308, 29896, 29889, 31024, 30683, 21509, 30354, 30763, 29892, 30406, 31229, 30689, 31021, 13, 308, 29906, 29889, 31916, 31152, 21509, 30689, 31021, 13, 308, 29941, 29889, 233, 141, 141, 21509, 30354, 30763, 30666, 30752, 30780, 1127, 275, 30275, 13, 13, 13, 13, 13, 29941, 29889, 31835, 30495, 31088, 31376, 30525, 30607, 30503, 30874, 31272, 13, 13, 13, 233, 141, 192, 31133, 30210, 30745, 31358, 232, 136, 186, 30988, 30705, 13, 13, 29896, 29889, 31024, 30683, 21509, 30354, 30763, 13, 21509, 13, 1678, 426, 13, 308, 29896, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 8824, 1118, 13, 308, 29941, 26254, 2798, 29901, 29945, 29892, 8391, 29901, 5574, 1118, 13, 1678, 500, 13, 13, 29906, 29889, 233, 141, 141, 1127, 275, 30354, 30763, 235, 178, 190, 30683, 30557, 30805, 13, 13, 1127, 275, 13, 13, 1678, 6608, 29871, 426, 29896, 29901, 29896, 29900, 29900, 29892, 29906, 29901, 29896, 29900, 29900, 29913, 13, 1678, 731, 259, 426, 29896, 29892, 29906, 29913, 13, 13, 31120, 31020, 30705, 30287, 30502, 30578, 31259, 13, 30287, 30502, 31025, 30746, 30406, 30909, 31410, 31283, 31333, 30275, 30210, 333, 13, 30287, 30502, 31025, 30746, 30406, 30909, 31410, 31283, 31295, 31333, 30275, 30210, 333, 13, 29941, 29889, 29871, 30783, 21509, 30354, 30763, 31174, 30448, 236, 132, 144, 232, 145, 137, 13, 30733, 31666, 13, 29871, 716, 29918, 5504, 29918, 8568, 1669, 426, 29896, 29901, 29945, 29892, 29941, 29901, 29945, 29913, 4706, 31100, 30374, 30780, 1127, 275, 30275, 13, 29871, 716, 29918, 5504, 29918, 8391, 29918, 842, 539, 426, 29941, 29913, 9651, 31100, 30374, 30780, 276, 4841, 30275, 13, 29871, 716, 29918, 5504, 29918, 348, 8391, 29918, 842, 268, 426, 29896, 29913, 9651, 31100, 30374, 30780, 276, 4841, 30275, 13, 13, 29946, 29889, 30998, 30733, 31666, 30210, 30354, 30763, 31100, 30374, 30780, 1127, 275, 30275, 13, 13, 13, 13, 13, 13, 29896, 29889, 30948, 21509, 30275, 30503, 1127, 275, 30275, 30769, 30417, 30990, 30980, 30210, 31427, 31399, 30594, 29892, 30354, 31180, 233, 131, 145, 31882, 232, 141, 161, 29973, 13, 268, 231, 189, 170, 31399, 29896, 29901, 29871, 30651, 21509, 30573, 30888, 29892, 632, 325, 13, 268, 231, 189, 170, 31399, 29906, 29901, 29871, 30651, 9039, 275, 30573, 30888, 29892, 13, 268, 231, 189, 170, 31399, 29941, 29901, 29871, 30651, 9039, 275, 29974, 21509, 30573, 30888, 29892, 13, 13, 29906, 29889, 21509, 30275, 30417, 30354, 30763, 29892, 1127, 275, 30275, 31423, 30417, 13, 268, 30998, 21509, 30275, 30210, 30354, 30763, 29892, 31538, 30666, 30780, 1127, 275, 30275, 13, 29941, 29889, 1127, 275, 30275, 31290, 30417, 30210, 30354, 30763, 29892, 30413, 30846, 13, 13, 15945, 29908, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13383, 4136, 2277, 30651, 30557, 30690, 31183, 30573, 31795, 31183, 13383, 13383, 13, 13, 5215, 5839, 280, 13, 5215, 2967, 29953, 29946, 13, 29937, 29871, 31263, 234, 190, 138, 30354, 30763, 13, 29883, 5708, 3790, 13, 1678, 525, 29896, 2396, 10998, 2798, 2396, 29945, 5501, 8391, 2396, 5574, 29913, 13, 29913, 13, 29937, 29871, 29945, 29889, 29896, 29871, 30998, 30578, 31259, 31415, 31640, 30573, 30685, 31174, 31072, 13, 13193, 29918, 1272, 29922, 23945, 280, 29889, 29881, 17204, 29898, 29883, 5708, 29897, 13, 13, 29937, 29871, 29945, 29889, 29906, 29871, 31733, 31174, 30448, 3188, 29953, 29946, 31795, 31183, 13, 12508, 29918, 1272, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 13193, 29918, 1272, 29897, 13, 12508, 29918, 1272, 13, 13, 13383, 4136, 29937, 30651, 30557, 30690, 31183, 30573, 31201, 31183, 13383, 13383, 4136, 29937, 13, 29937, 29871, 29945, 29889, 29941, 29871, 31244, 30998, 3188, 29953, 29946, 31201, 31183, 13, 13808, 29918, 1272, 29922, 3188, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 12508, 29918, 1272, 29897, 13, 29937, 29871, 29945, 29889, 29946, 29871, 30998, 13193, 30832, 30883, 31415, 31640, 30573, 30578, 31259, 13, 23945, 280, 29889, 18132, 29898, 13808, 29918, 1272, 29897, 13, 13, 2 ]
mlsriracha/deploy.py
awcchungster/mlsriracha
0
49078
<filename>mlsriracha/deploy.py<gh_stars>0 from mlsriracha.plugins.azureml.deploy import AzureMlDeploy from mlsriracha.plugins.gcpvertex.deploy import GcpVertexDeploy from mlsriracha.plugins.awssagemaker.deploy import AwsSageMakerDeploy class DeployAdapter: def __init__(self, provider: str): self.provider_name = provider.lower() print('This is a prediction job') try: provider except NameError: raise RuntimeError(f'{str} is not a valid provider') if provider.lower() == 'azureml': print('Using Azure ML as a provider') self.provider_obj = AzureMlDeploy() elif provider.lower() == 'gcpvertex': print('Using GCP Vertex as a provider') self.provider_obj = GcpVertexDeploy() elif provider.lower() == 'awssagemaker': print('Using AWS SageMaker as a provider') self.provider_obj = AwsSageMakerDeploy() else: raise RuntimeError(f'{str} is not a valid provider') def model_artifact(self, filename: str): return self.provider_obj.model_artifact(filename) def endpoint_metadata(self): return self.provider_obj.endpoint_metadata()
[ 1, 529, 9507, 29958, 828, 29879, 374, 336, 5815, 29914, 16519, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 286, 3137, 374, 336, 5815, 29889, 12800, 29889, 17688, 828, 29889, 16519, 1053, 12634, 29924, 29880, 8498, 2376, 13, 3166, 286, 3137, 374, 336, 5815, 29889, 12800, 29889, 29887, 6814, 369, 4776, 29889, 16519, 1053, 402, 6814, 22479, 8498, 2376, 13, 3166, 286, 3137, 374, 336, 5815, 29889, 12800, 29889, 1450, 893, 13904, 5790, 29889, 16519, 1053, 319, 5652, 29903, 482, 29924, 5790, 8498, 2376, 13, 13, 1990, 10034, 2376, 6168, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13113, 29901, 851, 1125, 13, 4706, 1583, 29889, 18121, 29918, 978, 353, 13113, 29889, 13609, 580, 13, 13, 4706, 1596, 877, 4013, 338, 263, 18988, 4982, 1495, 13, 4706, 1018, 29901, 13113, 13, 4706, 5174, 4408, 2392, 29901, 29871, 13, 9651, 12020, 24875, 2392, 29898, 29888, 29915, 29912, 710, 29913, 338, 451, 263, 2854, 13113, 1495, 13, 308, 13, 4706, 565, 13113, 29889, 13609, 580, 1275, 525, 17688, 828, 2396, 13, 9651, 1596, 877, 15156, 12634, 23158, 408, 263, 13113, 1495, 13, 9651, 1583, 29889, 18121, 29918, 5415, 353, 12634, 29924, 29880, 8498, 2376, 580, 13, 4706, 25342, 13113, 29889, 13609, 580, 1275, 525, 29887, 6814, 369, 4776, 2396, 13, 9651, 1596, 877, 15156, 402, 6271, 1798, 4776, 408, 263, 13113, 1495, 13, 9651, 1583, 29889, 18121, 29918, 5415, 353, 402, 6814, 22479, 8498, 2376, 580, 13, 4706, 25342, 13113, 29889, 13609, 580, 1275, 525, 1450, 893, 13904, 5790, 2396, 13, 9651, 1596, 877, 15156, 15540, 317, 482, 29924, 5790, 408, 263, 13113, 1495, 13, 9651, 1583, 29889, 18121, 29918, 5415, 353, 319, 5652, 29903, 482, 29924, 5790, 8498, 2376, 580, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 29888, 29915, 29912, 710, 29913, 338, 451, 263, 2854, 13113, 1495, 13, 13, 1678, 822, 1904, 29918, 8813, 29898, 1311, 29892, 10422, 29901, 851, 1125, 13, 4706, 736, 1583, 29889, 18121, 29918, 5415, 29889, 4299, 29918, 8813, 29898, 9507, 29897, 13, 13, 1678, 822, 16248, 29918, 19635, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 18121, 29918, 5415, 29889, 29734, 29918, 19635, 580, 2 ]
kcsd/utility_functions.py
mczerwinski/kCSD-python
0
151846
<gh_stars>0 # -*- coding: utf-8 -*- """ These are some useful functions used in CSD methods, They include CSD source profiles to be used as ground truths, placement of electrodes in 1D, 2D and 3D., etc These scripts are based on Grzegorz Parka's, Google Summer of Code 2014, INFC/pykCSD This was written by : <NAME>, <NAME>, <NAME> Laboratory of Neuroinformatics, Nencki Institute of Experimental Biology, Warsaw. N-D Bresenham line algo Copyright 2012 <NAME> 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 __future__ import print_function, division, absolute_import import numpy as np import os import pickle from scipy import interpolate import json import sys import kcsd try: from joblib.parallel import Parallel, delayed PARALLEL_AVAILABLE = True except ImportError: PARALLEL_AVAILABLE = False raise_errror = """Unknown electrode position file format. Load either one column file (or a one row file) with x positions, y positions, z positions, or a 3 column file with x and y and z positions. """ def load_swc(path): """Load swc morphology from file Used for sKCSD Parameters ---------- path : str Returns ------- morphology : np.array """ morphology = np.loadtxt(path) return morphology def save_sim(path,k): """ Save estimated CSD, potential and cell morphology to file. Used for saving sKCSD results Parameters: ----------- path : str k : sKCSD object """ est_csd = k.values('CSD', transformation=None) est_pot = k.values("POT", transformation=None) np.save(os.path.join(path, "csd.npy"), est_csd) print("Save csd, ", os.path.join(path, "csd.npy")) np.save(os.path.join(path, "pot.npy"), est_pot) print("Save pot, ", os.path.join(path, "pot.npy")) cell_data = {'morphology':k.cell.morphology.tolist(), 'ele_pos':k.cell.ele_pos.tolist(), 'n_src':k.cell.n_src} with open(os.path.join(path, "cell_data"), 'w') as handle: json.dump(cell_data, handle) def load_sim(path): """ Load sKCSD estimation results (CSD, potential and cell specifics). Parameters ---------- path: str Returns ------- est_csd : np.array est_pot : np.array cell_obj : sKCSDcell object """ est_csd = np.load(os.path.join(path, "csd.npy")) est_pot = np.load(os.path.join(path, "pot.npy")) try: with open(os.path.join(path, "cell_data"), 'r') as handle: cell_data = json.load(handle) except Exception as error: print('Could not load', os.path.join(path, "cell_data")) return est_csd, est_pot, None morphology = np.array(cell_data['morphology']) ele_pos = np.array(cell_data['ele_pos']) cell_obj = kcsd.sKCSDcell(morphology, ele_pos, cell_data['n_src']) return est_csd, est_pot, cell_obj def load_elpos(path): """Load electrode postions. File format: text file, one column, x of all the electrodes, y of all the electrodes, z of all the electrodes Parameters ---------- path : str Returns ------- ele_pos : np.array """ raw_ele_pos = np.loadtxt(path) if len(raw_ele_pos.shape) == 1: if raw_ele_pos.shape[0]%3: raise Exception('Unknown electrode position file format.') else: n_el = raw_ele_pos.shape[0]//3 ele_pos = np.zeros(shape=(n_el, 3)) ele_pos[:, 0] = raw_ele_pos[:n_el] ele_pos[:, 1] = raw_ele_pos[n_el:2 * n_el] ele_pos[:, 2] = raw_ele_pos[2 * n_el:] elif len(raw_ele_pos.shape) == 2: if raw_ele_pos.shape[1] == 1: if raw_ele_pos.shape[0]%3: raise Exception('Unknown electrode position file format.') else: n_el = raw_ele_pos.shape[0]/3 ele_pos = np.zeros(shape=(n_el, 3)) ele_pos[:, 0] = raw_ele_pos[:n_el] ele_pos[:, 1] = raw_ele_pos[n_el:2 * n_el] ele_pos[:, 2] = raw_ele_pos[2 * n_el:] elif raw_ele_pos.shape[0] == 1: if raw_ele_pos.shape[1]%3: raise Exception('Unknown electrode position file format.') else: n_el = raw_ele_pos.shape[1]/3 ele_pos = np.zeros(shape=(n_el,3)) ele_pos[:, 0] = raw_ele_pos[:n_el] ele_pos[:, 1] = raw_ele_pos[n_el:2 * n_el] ele_pos[:, 2] = raw_ele_pos[2 * n_el:] elif raw_ele_pos.shape[1] == 3: ele_pos = raw_ele_pos else: raise Exception('Unknown electrode position file format.') else: raise Exception('Unknown electrode position file format.') return ele_pos def check_for_duplicated_electrodes(elec_pos): """Checks for duplicate electrodes Parameters ---------- elec_pos : np.array Returns ------- has_duplicated_elec : Boolean """ unique_elec_pos = np.vstack({tuple(row) for row in elec_pos}) has_duplicated_elec = unique_elec_pos.shape == elec_pos.shape return has_duplicated_elec def distribute_srcs_1D(X, n_src, ext_x, R_init): """Distribute sources in 1D equally spaced Parameters ---------- X : np.arrays points at which CSD will be estimated n_src : int number of sources to be included in the model ext_x : floats how much should the sources extend the area X R_init : float Same as R in 1D case Returns ------- X_src : np.arrays positions of the sources R : float effective radius of the basis element """ X_src = np.mgrid[(np.min(X) - ext_x):(np.max(X) + ext_x): np.complex(0, n_src)] R = R_init return X_src, R def distribute_srcs_2D(X, Y, n_src, ext_x, ext_y, R_init): """Distribute n_src's in the given area evenly Parameters ---------- X, Y : np.arrays points at which CSD will be estimated n_src : int demanded number of sources to be included in the model ext_x, ext_y : floats how should the sources extend the area X, Y R_init : float demanded radius of the basis element Returns ------- X_src, Y_src : np.arrays positions of the sources nx, ny : ints number of sources in directions x,y new n_src = nx * ny may not be equal to the demanded number of sources R : float effective radius of the basis element """ Lx = np.max(X) - np.min(X) Ly = np.max(Y) - np.min(Y) Lx_n = Lx + (2 * ext_x) Ly_n = Ly + (2 * ext_y) [nx, ny, Lx_nn, Ly_nn, ds] = get_src_params_2D(Lx_n, Ly_n, n_src) ext_x_n = (Lx_nn - Lx) / 2 ext_y_n = (Ly_nn - Ly) / 2 X_src, Y_src = np.mgrid[(np.min(X) - ext_x_n):(np.max(X) + ext_x_n): np.complex(0, nx), (np.min(Y) - ext_y_n):(np.max(Y) + ext_y_n): np.complex(0, ny)] # d = round(R_init / ds) R = R_init # R = d * ds return X_src, Y_src, R def get_src_params_2D(Lx, Ly, n_src): """Distribute n_src sources evenly in a rectangle of size Lx * Ly Parameters ---------- Lx, Ly : floats lengths in the directions x, y of the area, the sources should be placed n_src : int demanded number of sources Returns ------- nx, ny : ints number of sources in directions x, y new n_src = nx * ny may not be equal to the demanded number of sources Lx_n, Ly_n : floats updated lengths in the directions x, y ds : float spacing between the sources """ coeff = [Ly, Lx - Ly, -Lx * n_src] rts = np.roots(coeff) r = [r for r in rts if type(r) is not complex and r > 0] nx = r[0] ny = n_src / nx ds = Lx / (nx - 1) nx = np.floor(nx) + 1 ny = np.floor(ny) + 1 Lx_n = (nx - 1) * ds Ly_n = (ny - 1) * ds return (nx, ny, Lx_n, Ly_n, ds) def distribute_srcs_3D(X, Y, Z, n_src, ext_x, ext_y, ext_z, R_init): """Distribute n_src sources evenly in a rectangle of size Lx * Ly * Lz Parameters ---------- X, Y, Z : np.arrays points at which CSD will be estimated n_src : int desired number of sources we want to include in the model ext_x, ext_y, ext_z : floats how should the sources extend over the area X,Y,Z R_init : float demanded radius of the basis element Returns ------- X_src, Y_src, Z_src : np.arrays positions of the sources in 3D space nx, ny, nz : ints number of sources in directions x,y,z new n_src = nx * ny * nz may not be equal to the demanded number of sources R : float updated radius of the basis element """ Lx = np.max(X) - np.min(X) Ly = np.max(Y) - np.min(Y) Lz = np.max(Z) - np.min(Z) Lx_n = Lx + 2 * ext_x Ly_n = Ly + 2 * ext_y Lz_n = Lz + 2 * ext_z (nx, ny, nz, Lx_nn, Ly_nn, Lz_nn, ds) = get_src_params_3D(Lx_n, Ly_n, Lz_n, n_src) ext_x_n = (Lx_nn - Lx) / 2 ext_y_n = (Ly_nn - Ly) / 2 ext_z_n = (Lz_nn - Lz) / 2 X_src, Y_src, Z_src = np.mgrid[(np.min(X) - ext_x_n):(np.max(X) + ext_x_n): np.complex(0, nx), (np.min(Y) - ext_y_n):(np.max(Y) + ext_y_n): np.complex(0, ny), (np.min(Z) - ext_z_n):(np.max(Z) + ext_z_n): np.complex(0, nz)] # d = np.round(R_init / ds) R = R_init return (X_src, Y_src, Z_src, R) def get_src_params_3D(Lx, Ly, Lz, n_src): """Helps to evenly distribute n_src sources in a cuboid of size Lx * Ly * Lz Parameters ---------- Lx, Ly, Lz : floats lengths in the directions x, y, z of the area, the sources should be placed n_src : int demanded number of sources to be included in the model Returns ------- nx, ny, nz : ints number of sources in directions x, y, z new n_src = nx * ny * nz may not be equal to the demanded number of sources Lx_n, Ly_n, Lz_n : floats updated lengths in the directions x, y, z ds : float spacing between the sources (grid nodes) """ V = Lx * Ly * Lz V_unit = V / n_src L_unit = V_unit**(1. / 3.) nx = np.ceil(Lx / L_unit) ny = np.ceil(Ly / L_unit) nz = np.ceil(Lz / L_unit) ds = Lx / (nx - 1) Lx_n = (nx - 1) * ds Ly_n = (ny - 1) * ds Lz_n = (nz - 1) * ds return (nx, ny, nz, Lx_n, Ly_n, Lz_n, ds) def L_model_fast(k_pot, pots, lamb, i): """Method for Fast L-curve computation Parameters ---------- k_pot : np.array pots : list lambd : list i : int Returns ------- modelnorm : float residual : float """ k_inv = np.linalg.inv(k_pot + lamb*np.identity(k_pot.shape[0])) beta_new = np.dot(k_inv, pots) V_est = np.dot(k_pot, beta_new) modelnorm = np.einsum('ij,ji->i', beta_new.T, V_est) residual = np.linalg.norm(V_est - pots) modelnorm = np.max(modelnorm) return modelnorm, residual def parallel_search(k_pot, pots, lambdas, n_jobs=4): """Method for Parallel L-curve computation Parameters ---------- k_pot : np.array pots : list lambdas : list Returns ------- modelnormseq : list residualseq : list """ if PARALLEL_AVAILABLE: jobs = (delayed(L_model_fast)(k_pot, pots, lamb, i) for i, lamb in enumerate(lambdas)) modelvsres = Parallel(n_jobs=n_jobs, backend='threading')(jobs) else: # Please verify this! modelvsres = [] for i, lamb in enumerate(lambdas): modelvsres.append(L_model_fast(k_pot, pots, lamb, i)) modelnormseq, residualseq = zip(*modelvsres) return modelnormseq, residualseq def _bresenhamline_nslope(slope): """ Normalize slope for Bresenham's line algorithm. >>> s = np.array([[-2, -2, -2, 0]]) >>> _bresenhamline_nslope(s) array([[-1., -1., -1., 0.]]) >>> s = np.array([[0, 0, 0, 0]]) >>> _bresenhamline_nslope(s) array([[ 0., 0., 0., 0.]]) >>> s = np.array([[0, 0, 9, 0]]) >>> _bresenhamline_nslope(s) array([[ 0., 0., 1., 0.]]) """ scale = np.amax(np.abs(slope), axis=1).reshape(-1, 1) zeroslope = (scale == 0).all(1) scale[zeroslope] = np.ones(1) normalizedslope = np.array(slope, dtype=np.double) / scale normalizedslope[zeroslope] = np.zeros(slope[0].shape) return normalizedslope def _bresenhamlines(start, end, max_iter): """ Returns npts lines of length max_iter each. (npts x max_iter x dimension) >>> s = np.array([[3, 1, 9, 0],[0, 0, 3, 0]]) >>> _bresenhamlines(s, np.zeros(s.shape[1]), max_iter=-1) array([[[ 3, 1, 8, 0], [ 2, 1, 7, 0], [ 2, 1, 6, 0], [ 2, 1, 5, 0], [ 1, 0, 4, 0], [ 1, 0, 3, 0], [ 1, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0]], <BLANKLINE> [[ 0, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0], [ 0, 0, -1, 0], [ 0, 0, -2, 0], [ 0, 0, -3, 0], [ 0, 0, -4, 0], [ 0, 0, -5, 0], [ 0, 0, -6, 0]]]) """ if max_iter == -1: max_iter = np.amax(np.amax(np.abs(end - start), axis=1)) npts, dim = start.shape nslope = _bresenhamline_nslope(end - start) # steps to iterate on stepseq = np.arange(1, max_iter + 1) stepmat = np.tile(stepseq, (dim, 1)).T # some hacks for broadcasting properly bline = start[:, np.newaxis, :] + nslope[:, np.newaxis, :] * stepmat # Approximate to nearest int return np.array(np.rint(bline), dtype=start.dtype) def bresenhamline(start, end, max_iter=5): """ Returns a list of points from (start, end] by ray tracing a line b/w the points. Parameters: start: An array of start points (number of points x dimension) end: An end points (1 x dimension) or An array of end point corresponding to each start point (number of points x dimension) max_iter: Max points to traverse. if -1, maximum number of required points are traversed Returns: linevox (n x dimension) A cumulative array of all points traversed by all the lines so far. >>> s = np.array([[3, 1, 9, 0],[0, 0, 3, 0]]) >>> bresenhamline(s, np.zeros(s.shape[1]), max_iter=-1) array([[ 3, 1, 8, 0], [ 2, 1, 7, 0], [ 2, 1, 6, 0], [ 2, 1, 5, 0], [ 1, 0, 4, 0], [ 1, 0, 3, 0], [ 1, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0], [ 0, 0, 2, 0], [ 0, 0, 1, 0], [ 0, 0, 0, 0], [ 0, 0, -1, 0], [ 0, 0, -2, 0], [ 0, 0, -3, 0], [ 0, 0, -4, 0], [ 0, 0, -5, 0], [ 0, 0, -6, 0]]) """ # Return the points as a single array return _bresenhamlines(start, end, max_iter).reshape(-1, start.shape[-1]) class LoadData(object): def __init__(self,path): self.Func = {} self.Path = {} self.path = path self.get_paths() self.load('morphology') self.load('electrode_positions') self.load('LFP') def assign(self,what, value): if what == 'morphology': self.morphology = value elif what == 'electrode_positions': self.ele_pos = value elif what == 'LFP': self.LFP = value def sub_dir_path(self,d): return filter(os.path.isdir, [os.path.join(d,f) for f in os.listdir(d)]) def get_fname(self,d,fnames): if len(fnames) == 1: return os.path.join(d,fnames[0]) else: paths = [] for fname in fnames: paths.append(os.path.join(d,fname)) return paths def get_paths(self): dir_list = self.sub_dir_path(self.path) for drc in dir_list: files = os.listdir(drc) if drc.endswith("morphology"): self.path_morphology = self.get_fname(drc,files) self.Path['morphology'] = self.path_morphology self.Func['morphology'] = load_swc if drc.endswith("positions"): self.path_ele_pos = self.get_fname(drc,files) self.Path["electrode_positions"] = self.path_ele_pos self.Func["electrode_positions"] = load_elpos if drc.endswith("LFP"): self.path_LFP = self.get_fname(drc,files) self.Path["LFP"] = self.path_LFP self.Func["LFP"] = np.loadtxt def load(self, what, func=None, path=None): if not func: func = self.Func[what] if not path: path = self.Path[what] #print(what,'unknown file type. Currently recognized file types are morphology, electrode_positions, LFP') #return if isinstance(path,list): for p in path: if p.endswith('swc'): path = p break try: f = open(path) except IOError: print('Could not open file',path) self.assign(what,None) return try: data = func(f) self.assign(what,data) except ValueError: print('Could not load file',path) self.assign(what,None) f.close() return print('Load',path) f.close()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 1349, 968, 526, 777, 5407, 3168, 1304, 297, 315, 7230, 3519, 29892, 13, 15597, 3160, 315, 7230, 2752, 28723, 304, 367, 1304, 408, 5962, 8760, 29879, 29892, 13, 29886, 9552, 310, 28118, 2783, 297, 29871, 29896, 29928, 29892, 29871, 29906, 29928, 322, 29871, 29941, 29928, 1696, 2992, 13, 1349, 968, 12078, 526, 2729, 373, 1632, 28530, 272, 29920, 4815, 29874, 29915, 29879, 29892, 13, 14207, 13329, 310, 5920, 29871, 29906, 29900, 29896, 29946, 29892, 2672, 8610, 29914, 2272, 29895, 29907, 7230, 13, 4013, 471, 3971, 491, 584, 13, 29966, 5813, 10202, 529, 5813, 10202, 529, 5813, 29958, 13, 29931, 3717, 7606, 310, 2448, 2192, 262, 4830, 1199, 29892, 13, 29940, 264, 22736, 8907, 310, 1222, 27910, 3457, 3002, 29892, 9149, 1450, 29889, 13, 13, 13, 29940, 29899, 29928, 27209, 264, 3391, 1196, 24673, 14187, 1266, 29871, 29906, 29900, 29896, 29906, 529, 5813, 29958, 13, 13, 27293, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 13, 29874, 3509, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 13, 517, 5376, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 13, 1552, 10462, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 13, 392, 29914, 272, 19417, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 13, 275, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 1576, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 13, 262, 599, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 13, 28350, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 13, 5746, 15094, 1799, 6323, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 13, 9800, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 13, 1177, 11698, 382, 29963, 3919, 24972, 9818, 6093, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 13, 7698, 1529, 1692, 29903, 6323, 438, 29911, 4448, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 13, 1955, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 13, 1955, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 7791, 7818, 12982, 1525, 29889, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 29892, 8542, 29892, 8380, 29918, 5215, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 5215, 5839, 280, 13, 3166, 4560, 2272, 1053, 20064, 403, 13, 5215, 4390, 13, 5215, 10876, 13, 5215, 413, 2395, 29881, 13, 13, 2202, 29901, 13, 1678, 515, 4982, 1982, 29889, 23482, 1053, 1459, 6553, 29892, 29801, 13, 1678, 349, 1718, 1964, 1307, 29931, 29918, 26612, 6227, 6181, 353, 5852, 13, 19499, 16032, 2392, 29901, 13, 1678, 349, 1718, 1964, 1307, 29931, 29918, 26612, 6227, 6181, 353, 7700, 13, 13, 268, 13, 22692, 29918, 3127, 729, 353, 9995, 14148, 28118, 311, 2602, 934, 3402, 29889, 13, 5896, 2845, 697, 1897, 934, 313, 272, 263, 697, 1948, 934, 29897, 411, 921, 11909, 29892, 13, 29891, 11909, 29892, 503, 11909, 29892, 470, 263, 29871, 29941, 1897, 934, 411, 921, 322, 343, 322, 503, 11909, 29889, 13, 15945, 29908, 13, 13, 1753, 2254, 29918, 2774, 29883, 29898, 2084, 1125, 13, 1678, 9995, 5896, 2381, 29883, 18131, 3002, 515, 934, 13, 13, 1678, 501, 8485, 363, 269, 29968, 29907, 7230, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2224, 584, 851, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 18131, 3002, 584, 7442, 29889, 2378, 13, 1678, 9995, 13, 1678, 18131, 3002, 353, 7442, 29889, 1359, 3945, 29898, 2084, 29897, 13, 1678, 736, 18131, 3002, 13, 13, 13, 1753, 4078, 29918, 3601, 29898, 2084, 29892, 29895, 1125, 13, 1678, 9995, 13, 1678, 16913, 15899, 315, 7230, 29892, 7037, 322, 3038, 18131, 3002, 304, 934, 29889, 13, 268, 13, 1678, 501, 8485, 363, 14238, 269, 29968, 29907, 7230, 2582, 13, 268, 13, 1678, 12662, 2699, 29901, 13, 1678, 448, 28400, 13, 1678, 2224, 584, 851, 13, 1678, 413, 584, 269, 29968, 29907, 7230, 1203, 13, 539, 13, 1678, 9995, 13, 1678, 707, 29918, 2395, 29881, 353, 413, 29889, 5975, 877, 29907, 7230, 742, 13852, 29922, 8516, 29897, 13, 1678, 707, 29918, 17765, 353, 413, 29889, 5975, 703, 29925, 2891, 613, 13852, 29922, 8516, 29897, 13, 1678, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 2395, 29881, 29889, 29876, 2272, 4968, 707, 29918, 2395, 29881, 29897, 13, 1678, 1596, 703, 11371, 274, 4928, 29892, 9162, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 2395, 29881, 29889, 29876, 2272, 5783, 13, 1678, 7442, 29889, 7620, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 17765, 29889, 29876, 2272, 4968, 707, 29918, 17765, 29897, 13, 1678, 1596, 703, 11371, 3104, 29892, 9162, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 17765, 29889, 29876, 2272, 5783, 13, 1678, 3038, 29918, 1272, 353, 11117, 29885, 5676, 3002, 2396, 29895, 29889, 3729, 29889, 29885, 5676, 3002, 29889, 25027, 391, 3285, 13, 462, 525, 6146, 29918, 1066, 2396, 29895, 29889, 3729, 29889, 6146, 29918, 1066, 29889, 25027, 391, 3285, 13, 462, 525, 29876, 29918, 4351, 2396, 29895, 29889, 3729, 29889, 29876, 29918, 4351, 29913, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 3729, 29918, 1272, 4968, 525, 29893, 1495, 408, 4386, 29901, 13, 4706, 4390, 29889, 15070, 29898, 3729, 29918, 1272, 29892, 4386, 29897, 13, 13, 13, 1753, 2254, 29918, 3601, 29898, 2084, 1125, 13, 1678, 9995, 13, 1678, 16012, 269, 29968, 29907, 7230, 23248, 2582, 313, 29907, 7230, 29892, 7037, 322, 3038, 2702, 29879, 467, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2224, 29901, 851, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 707, 29918, 2395, 29881, 584, 7442, 29889, 2378, 13, 1678, 707, 29918, 17765, 584, 7442, 29889, 2378, 13, 1678, 3038, 29918, 5415, 584, 269, 29968, 29907, 7230, 3729, 1203, 13, 1678, 9995, 13, 1678, 707, 29918, 2395, 29881, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 2395, 29881, 29889, 29876, 2272, 5783, 13, 1678, 707, 29918, 17765, 353, 7442, 29889, 1359, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 17765, 29889, 29876, 2272, 5783, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 3729, 29918, 1272, 4968, 525, 29878, 1495, 408, 4386, 29901, 13, 9651, 3038, 29918, 1272, 353, 4390, 29889, 1359, 29898, 8411, 29897, 13, 1678, 5174, 8960, 408, 1059, 29901, 13, 4706, 1596, 877, 23323, 451, 2254, 742, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 376, 3729, 29918, 1272, 5783, 13, 4706, 736, 707, 29918, 2395, 29881, 29892, 707, 29918, 17765, 29892, 6213, 13, 1678, 18131, 3002, 353, 7442, 29889, 2378, 29898, 3729, 29918, 1272, 1839, 29885, 5676, 3002, 11287, 13, 1678, 4552, 29918, 1066, 353, 7442, 29889, 2378, 29898, 3729, 29918, 1272, 1839, 6146, 29918, 1066, 11287, 13, 1678, 3038, 29918, 5415, 353, 413, 2395, 29881, 29889, 29879, 29968, 29907, 7230, 3729, 29898, 29885, 5676, 3002, 29892, 4552, 29918, 1066, 29892, 3038, 29918, 1272, 1839, 29876, 29918, 4351, 11287, 13, 1678, 736, 707, 29918, 2395, 29881, 29892, 707, 29918, 17765, 29892, 3038, 29918, 5415, 13, 13, 13, 1753, 2254, 29918, 295, 1066, 29898, 2084, 1125, 13, 1678, 9995, 5896, 28118, 311, 1400, 1080, 29889, 13, 13, 1678, 3497, 3402, 29901, 1426, 934, 29892, 697, 1897, 29892, 921, 310, 599, 278, 28118, 2783, 29892, 343, 310, 13, 1678, 599, 278, 28118, 2783, 29892, 503, 310, 599, 278, 28118, 2783, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2224, 584, 851, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 4552, 29918, 1066, 584, 7442, 29889, 2378, 13, 1678, 9995, 13, 1678, 10650, 29918, 6146, 29918, 1066, 353, 7442, 29889, 1359, 3945, 29898, 2084, 29897, 13, 1678, 565, 7431, 29898, 1610, 29918, 6146, 29918, 1066, 29889, 12181, 29897, 1275, 29871, 29896, 29901, 13, 4706, 565, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29900, 29962, 29995, 29941, 29901, 13, 9651, 12020, 8960, 877, 14148, 28118, 311, 2602, 934, 3402, 29889, 1495, 13, 4706, 1683, 29901, 13, 9651, 302, 29918, 295, 353, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29900, 29962, 458, 29941, 13, 9651, 4552, 29918, 1066, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 29876, 29918, 295, 29892, 29871, 29941, 876, 13, 9651, 4552, 29918, 1066, 7503, 29892, 29871, 29900, 29962, 353, 10650, 29918, 6146, 29918, 1066, 7503, 29876, 29918, 295, 29962, 13, 9651, 4552, 29918, 1066, 7503, 29892, 29871, 29896, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29876, 29918, 295, 29901, 29906, 334, 302, 29918, 295, 29962, 13, 9651, 4552, 29918, 1066, 7503, 29892, 29871, 29906, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29906, 334, 302, 29918, 295, 17531, 13, 1678, 25342, 7431, 29898, 1610, 29918, 6146, 29918, 1066, 29889, 12181, 29897, 1275, 29871, 29906, 29901, 13, 4706, 565, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29896, 29962, 1275, 29871, 29896, 29901, 13, 9651, 565, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29900, 29962, 29995, 29941, 29901, 13, 18884, 12020, 8960, 877, 14148, 28118, 311, 2602, 934, 3402, 29889, 1495, 13, 9651, 1683, 29901, 13, 18884, 302, 29918, 295, 353, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29900, 16261, 29941, 13, 18884, 4552, 29918, 1066, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 29876, 29918, 295, 29892, 29871, 29941, 876, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29900, 29962, 353, 10650, 29918, 6146, 29918, 1066, 7503, 29876, 29918, 295, 29962, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29896, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29876, 29918, 295, 29901, 29906, 334, 302, 29918, 295, 29962, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29906, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29906, 334, 302, 29918, 295, 17531, 13, 4706, 25342, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29900, 29962, 1275, 29871, 29896, 29901, 13, 9651, 565, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29896, 29962, 29995, 29941, 29901, 13, 18884, 12020, 8960, 877, 14148, 28118, 311, 2602, 934, 3402, 29889, 1495, 13, 9651, 1683, 29901, 13, 18884, 302, 29918, 295, 353, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29896, 16261, 29941, 13, 18884, 4552, 29918, 1066, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 29876, 29918, 295, 29892, 29941, 876, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29900, 29962, 353, 10650, 29918, 6146, 29918, 1066, 7503, 29876, 29918, 295, 29962, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29896, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29876, 29918, 295, 29901, 29906, 334, 302, 29918, 295, 29962, 13, 18884, 4552, 29918, 1066, 7503, 29892, 29871, 29906, 29962, 353, 10650, 29918, 6146, 29918, 1066, 29961, 29906, 334, 302, 29918, 295, 17531, 13, 4706, 25342, 10650, 29918, 6146, 29918, 1066, 29889, 12181, 29961, 29896, 29962, 1275, 29871, 29941, 29901, 13, 9651, 4552, 29918, 1066, 353, 10650, 29918, 6146, 29918, 1066, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 877, 14148, 28118, 311, 2602, 934, 3402, 29889, 1495, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 877, 14148, 28118, 311, 2602, 934, 3402, 29889, 1495, 13, 1678, 736, 4552, 29918, 1066, 13, 13, 13, 1753, 1423, 29918, 1454, 29918, 20908, 9169, 29918, 15436, 307, 2783, 29898, 6146, 29883, 29918, 1066, 1125, 13, 1678, 9995, 5596, 29879, 363, 7929, 28118, 2783, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 4552, 29883, 29918, 1066, 584, 7442, 29889, 2378, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 756, 29918, 20908, 9169, 29918, 6146, 29883, 584, 11185, 13, 1678, 9995, 13, 1678, 5412, 29918, 6146, 29883, 29918, 1066, 353, 7442, 29889, 29894, 1429, 3319, 23583, 29898, 798, 29897, 363, 1948, 297, 4552, 29883, 29918, 1066, 1800, 13, 1678, 756, 29918, 20908, 9169, 29918, 6146, 29883, 353, 5412, 29918, 6146, 29883, 29918, 1066, 29889, 12181, 1275, 4552, 29883, 29918, 1066, 29889, 12181, 13, 1678, 736, 756, 29918, 20908, 9169, 29918, 6146, 29883, 13, 13, 13, 1753, 1320, 2666, 29918, 4351, 29879, 29918, 29896, 29928, 29898, 29990, 29892, 302, 29918, 4351, 29892, 1294, 29918, 29916, 29892, 390, 29918, 2344, 1125, 13, 1678, 9995, 13398, 2666, 8974, 297, 29871, 29896, 29928, 18018, 26325, 287, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1060, 584, 7442, 29889, 2378, 29879, 13, 4706, 3291, 472, 607, 315, 7230, 674, 367, 15899, 13, 1678, 302, 29918, 4351, 584, 938, 13, 4706, 1353, 310, 8974, 304, 367, 5134, 297, 278, 1904, 13, 1678, 1294, 29918, 29916, 584, 5685, 1446, 13, 4706, 920, 1568, 881, 278, 8974, 10985, 278, 4038, 1060, 13, 1678, 390, 29918, 2344, 584, 5785, 13, 4706, 19491, 408, 390, 297, 29871, 29896, 29928, 1206, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1060, 29918, 4351, 584, 7442, 29889, 2378, 29879, 13, 4706, 11909, 310, 278, 8974, 13, 1678, 390, 584, 5785, 13, 4706, 11828, 11855, 310, 278, 8405, 1543, 13, 1678, 9995, 13, 1678, 1060, 29918, 4351, 353, 7442, 29889, 29885, 7720, 15625, 9302, 29889, 1195, 29898, 29990, 29897, 448, 1294, 29918, 29916, 1125, 29898, 9302, 29889, 3317, 29898, 29990, 29897, 718, 1294, 29918, 29916, 1125, 13, 462, 268, 7442, 29889, 19676, 29898, 29900, 29892, 302, 29918, 4351, 4638, 13, 1678, 390, 353, 390, 29918, 2344, 13, 1678, 736, 1060, 29918, 4351, 29892, 390, 13, 13, 13, 1753, 1320, 2666, 29918, 4351, 29879, 29918, 29906, 29928, 29898, 29990, 29892, 612, 29892, 302, 29918, 4351, 29892, 1294, 29918, 29916, 29892, 1294, 29918, 29891, 29892, 390, 29918, 2344, 1125, 13, 1678, 9995, 13398, 2666, 302, 29918, 4351, 29915, 29879, 297, 278, 2183, 4038, 1584, 368, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1060, 29892, 612, 584, 7442, 29889, 2378, 29879, 13, 4706, 3291, 472, 607, 315, 7230, 674, 367, 15899, 13, 1678, 302, 29918, 4351, 584, 938, 13, 4706, 24432, 1353, 310, 8974, 304, 367, 5134, 297, 278, 1904, 13, 1678, 1294, 29918, 29916, 29892, 1294, 29918, 29891, 584, 5685, 1446, 13, 4706, 920, 881, 278, 8974, 10985, 278, 4038, 1060, 29892, 612, 13, 1678, 390, 29918, 2344, 584, 5785, 13, 4706, 24432, 11855, 310, 278, 8405, 1543, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1060, 29918, 4351, 29892, 612, 29918, 4351, 584, 7442, 29889, 2378, 29879, 13, 4706, 11909, 310, 278, 8974, 13, 1678, 302, 29916, 29892, 7098, 584, 938, 29879, 13, 4706, 1353, 310, 8974, 297, 18112, 921, 29892, 29891, 13, 4706, 716, 302, 29918, 4351, 353, 302, 29916, 334, 7098, 1122, 451, 367, 5186, 304, 278, 24432, 1353, 310, 8974, 13, 1678, 390, 584, 5785, 13, 4706, 11828, 11855, 310, 278, 8405, 1543, 13, 1678, 9995, 13, 1678, 365, 29916, 353, 7442, 29889, 3317, 29898, 29990, 29897, 448, 7442, 29889, 1195, 29898, 29990, 29897, 13, 1678, 8626, 353, 7442, 29889, 3317, 29898, 29979, 29897, 448, 7442, 29889, 1195, 29898, 29979, 29897, 13, 1678, 365, 29916, 29918, 29876, 353, 365, 29916, 718, 313, 29906, 334, 1294, 29918, 29916, 29897, 13, 1678, 8626, 29918, 29876, 353, 8626, 718, 313, 29906, 334, 1294, 29918, 29891, 29897, 13, 1678, 518, 23818, 29892, 7098, 29892, 365, 29916, 29918, 15755, 29892, 8626, 29918, 15755, 29892, 18031, 29962, 353, 679, 29918, 4351, 29918, 7529, 29918, 29906, 29928, 29898, 29931, 29916, 29918, 29876, 29892, 8626, 29918, 29876, 29892, 302, 29918, 4351, 29897, 13, 1678, 1294, 29918, 29916, 29918, 29876, 353, 313, 29931, 29916, 29918, 15755, 448, 365, 29916, 29897, 847, 29871, 29906, 13, 1678, 1294, 29918, 29891, 29918, 29876, 353, 313, 29931, 29891, 29918, 15755, 448, 8626, 29897, 847, 29871, 29906, 13, 1678, 1060, 29918, 4351, 29892, 612, 29918, 4351, 353, 7442, 29889, 29885, 7720, 15625, 9302, 29889, 1195, 29898, 29990, 29897, 448, 1294, 29918, 29916, 29918, 29876, 1125, 29898, 9302, 29889, 3317, 29898, 29990, 29897, 718, 1294, 29918, 29916, 29918, 29876, 1125, 13, 462, 9651, 7442, 29889, 19676, 29898, 29900, 29892, 302, 29916, 511, 13, 462, 9651, 313, 9302, 29889, 1195, 29898, 29979, 29897, 448, 1294, 29918, 29891, 29918, 29876, 1125, 29898, 9302, 29889, 3317, 29898, 29979, 29897, 718, 1294, 29918, 29891, 29918, 29876, 1125, 13, 462, 9651, 7442, 29889, 19676, 29898, 29900, 29892, 7098, 4638, 13, 1678, 396, 270, 353, 4513, 29898, 29934, 29918, 2344, 847, 18031, 29897, 13, 1678, 390, 353, 390, 29918, 2344, 29871, 396, 390, 353, 270, 334, 18031, 13, 1678, 736, 1060, 29918, 4351, 29892, 612, 29918, 4351, 29892, 390, 13, 13, 13, 1753, 679, 29918, 4351, 29918, 7529, 29918, 29906, 29928, 29898, 29931, 29916, 29892, 8626, 29892, 302, 29918, 4351, 1125, 13, 1678, 9995, 13398, 2666, 302, 29918, 4351, 8974, 1584, 368, 297, 263, 16701, 310, 2159, 365, 29916, 334, 8626, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 365, 29916, 29892, 8626, 584, 5685, 1446, 13, 4706, 27497, 297, 278, 18112, 921, 29892, 343, 310, 278, 4038, 29892, 13, 4706, 278, 8974, 881, 367, 7180, 13, 1678, 302, 29918, 4351, 584, 938, 13, 4706, 24432, 1353, 310, 8974, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 302, 29916, 29892, 7098, 584, 938, 29879, 13, 4706, 1353, 310, 8974, 297, 18112, 921, 29892, 343, 13, 4706, 716, 302, 29918, 4351, 353, 302, 29916, 334, 7098, 1122, 451, 367, 5186, 304, 278, 24432, 1353, 310, 8974, 13, 1678, 365, 29916, 29918, 29876, 29892, 8626, 29918, 29876, 584, 5685, 1446, 13, 4706, 4784, 27497, 297, 278, 18112, 921, 29892, 343, 13, 1678, 18031, 584, 5785, 13, 4706, 29250, 1546, 278, 8974, 13, 1678, 9995, 13, 1678, 1302, 12352, 353, 518, 29931, 29891, 29892, 365, 29916, 448, 8626, 29892, 448, 29931, 29916, 334, 302, 29918, 4351, 29962, 13, 1678, 364, 1372, 353, 7442, 29889, 307, 1862, 29898, 1111, 12352, 29897, 13, 1678, 364, 353, 518, 29878, 363, 364, 297, 364, 1372, 565, 1134, 29898, 29878, 29897, 338, 451, 4280, 322, 364, 1405, 29871, 29900, 29962, 13, 1678, 302, 29916, 353, 364, 29961, 29900, 29962, 13, 1678, 7098, 353, 302, 29918, 4351, 847, 302, 29916, 13, 1678, 18031, 353, 365, 29916, 847, 313, 23818, 448, 29871, 29896, 29897, 13, 1678, 302, 29916, 353, 7442, 29889, 14939, 29898, 23818, 29897, 718, 29871, 29896, 13, 1678, 7098, 353, 7442, 29889, 14939, 29898, 1460, 29897, 718, 29871, 29896, 13, 1678, 365, 29916, 29918, 29876, 353, 313, 23818, 448, 29871, 29896, 29897, 334, 18031, 13, 1678, 8626, 29918, 29876, 353, 313, 1460, 448, 29871, 29896, 29897, 334, 18031, 13, 1678, 736, 313, 23818, 29892, 7098, 29892, 365, 29916, 29918, 29876, 29892, 8626, 29918, 29876, 29892, 18031, 29897, 13, 13, 13, 1753, 1320, 2666, 29918, 4351, 29879, 29918, 29941, 29928, 29898, 29990, 29892, 612, 29892, 796, 29892, 302, 29918, 4351, 29892, 1294, 29918, 29916, 29892, 1294, 29918, 29891, 29892, 1294, 29918, 29920, 29892, 390, 29918, 2344, 1125, 13, 1678, 9995, 13398, 2666, 302, 29918, 4351, 8974, 1584, 368, 297, 263, 16701, 310, 2159, 365, 29916, 334, 8626, 334, 365, 29920, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1060, 29892, 612, 29892, 796, 584, 7442, 29889, 2378, 29879, 13, 4706, 3291, 472, 607, 315, 7230, 674, 367, 15899, 13, 1678, 302, 29918, 4351, 584, 938, 13, 4706, 7429, 1353, 310, 8974, 591, 864, 304, 3160, 297, 278, 1904, 13, 1678, 1294, 29918, 29916, 29892, 1294, 29918, 29891, 29892, 1294, 29918, 29920, 584, 5685, 1446, 13, 4706, 920, 881, 278, 8974, 10985, 975, 278, 4038, 1060, 29892, 29979, 29892, 29999, 13, 1678, 390, 29918, 2344, 584, 5785, 13, 4706, 24432, 11855, 310, 278, 8405, 1543, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1060, 29918, 4351, 29892, 612, 29918, 4351, 29892, 796, 29918, 4351, 584, 7442, 29889, 2378, 29879, 13, 4706, 11909, 310, 278, 8974, 297, 29871, 29941, 29928, 2913, 13, 1678, 302, 29916, 29892, 7098, 29892, 302, 29920, 584, 938, 29879, 13, 4706, 1353, 310, 8974, 297, 18112, 921, 29892, 29891, 29892, 29920, 13, 4706, 716, 302, 29918, 4351, 353, 302, 29916, 334, 7098, 334, 302, 29920, 1122, 451, 367, 5186, 304, 278, 24432, 1353, 310, 13, 4706, 8974, 13, 13, 1678, 390, 584, 5785, 13, 4706, 4784, 11855, 310, 278, 8405, 1543, 13, 1678, 9995, 13, 1678, 365, 29916, 353, 7442, 29889, 3317, 29898, 29990, 29897, 448, 7442, 29889, 1195, 29898, 29990, 29897, 13, 1678, 8626, 353, 7442, 29889, 3317, 29898, 29979, 29897, 448, 7442, 29889, 1195, 29898, 29979, 29897, 13, 1678, 365, 29920, 353, 7442, 29889, 3317, 29898, 29999, 29897, 448, 7442, 29889, 1195, 29898, 29999, 29897, 13, 1678, 365, 29916, 29918, 29876, 353, 365, 29916, 718, 29871, 29906, 334, 1294, 29918, 29916, 13, 1678, 8626, 29918, 29876, 353, 8626, 718, 29871, 29906, 334, 1294, 29918, 29891, 13, 1678, 365, 29920, 29918, 29876, 353, 365, 29920, 718, 29871, 29906, 334, 1294, 29918, 29920, 13, 1678, 313, 23818, 29892, 7098, 29892, 302, 29920, 29892, 365, 29916, 29918, 15755, 29892, 8626, 29918, 15755, 29892, 365, 29920, 29918, 15755, 29892, 18031, 29897, 353, 679, 29918, 4351, 29918, 7529, 29918, 29941, 29928, 29898, 29931, 29916, 29918, 29876, 29892, 13, 462, 462, 462, 795, 8626, 29918, 29876, 29892, 13, 462, 462, 462, 795, 365, 29920, 29918, 29876, 29892, 13, 462, 462, 462, 795, 302, 29918, 4351, 29897, 13, 1678, 1294, 29918, 29916, 29918, 29876, 353, 313, 29931, 29916, 29918, 15755, 448, 365, 29916, 29897, 847, 29871, 29906, 13, 1678, 1294, 29918, 29891, 29918, 29876, 353, 313, 29931, 29891, 29918, 15755, 448, 8626, 29897, 847, 29871, 29906, 13, 1678, 1294, 29918, 29920, 29918, 29876, 353, 313, 29931, 29920, 29918, 15755, 448, 365, 29920, 29897, 847, 29871, 29906, 13, 1678, 1060, 29918, 4351, 29892, 612, 29918, 4351, 29892, 796, 29918, 4351, 353, 7442, 29889, 29885, 7720, 15625, 9302, 29889, 1195, 29898, 29990, 29897, 448, 1294, 29918, 29916, 29918, 29876, 1125, 29898, 9302, 29889, 3317, 29898, 29990, 29897, 718, 1294, 29918, 29916, 29918, 29876, 1125, 13, 462, 462, 259, 7442, 29889, 19676, 29898, 29900, 29892, 302, 29916, 511, 13, 462, 462, 259, 313, 9302, 29889, 1195, 29898, 29979, 29897, 448, 1294, 29918, 29891, 29918, 29876, 1125, 29898, 9302, 29889, 3317, 29898, 29979, 29897, 718, 1294, 29918, 29891, 29918, 29876, 1125, 13, 462, 462, 259, 7442, 29889, 19676, 29898, 29900, 29892, 7098, 511, 13, 462, 462, 259, 313, 9302, 29889, 1195, 29898, 29999, 29897, 448, 1294, 29918, 29920, 29918, 29876, 1125, 29898, 9302, 29889, 3317, 29898, 29999, 29897, 718, 1294, 29918, 29920, 29918, 29876, 1125, 13, 462, 462, 259, 7442, 29889, 19676, 29898, 29900, 29892, 302, 29920, 4638, 13, 1678, 396, 270, 353, 7442, 29889, 14486, 29898, 29934, 29918, 2344, 847, 18031, 29897, 13, 1678, 390, 353, 390, 29918, 2344, 13, 1678, 736, 313, 29990, 29918, 4351, 29892, 612, 29918, 4351, 29892, 796, 29918, 4351, 29892, 390, 29897, 13, 13, 13, 1753, 679, 29918, 4351, 29918, 7529, 29918, 29941, 29928, 29898, 29931, 29916, 29892, 8626, 29892, 365, 29920, 29892, 302, 29918, 4351, 1125, 13, 1678, 9995, 7658, 567, 304, 1584, 368, 1320, 2666, 302, 29918, 4351, 8974, 297, 263, 13630, 3398, 310, 2159, 365, 29916, 334, 8626, 334, 365, 29920, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 365, 29916, 29892, 8626, 29892, 365, 29920, 584, 5685, 1446, 13, 4706, 27497, 297, 278, 18112, 921, 29892, 343, 29892, 503, 310, 278, 4038, 29892, 13, 4706, 278, 8974, 881, 367, 7180, 13, 1678, 302, 29918, 4351, 584, 938, 13, 4706, 24432, 1353, 310, 8974, 304, 367, 5134, 297, 278, 1904, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 302, 29916, 29892, 7098, 29892, 302, 29920, 584, 938, 29879, 13, 4706, 1353, 310, 8974, 297, 18112, 921, 29892, 343, 29892, 503, 13, 4706, 716, 302, 29918, 4351, 353, 302, 29916, 334, 7098, 334, 302, 29920, 1122, 451, 367, 5186, 304, 278, 24432, 1353, 310, 13, 4706, 8974, 13, 1678, 365, 29916, 29918, 29876, 29892, 8626, 29918, 29876, 29892, 365, 29920, 29918, 29876, 584, 5685, 1446, 13, 4706, 4784, 27497, 297, 278, 18112, 921, 29892, 343, 29892, 503, 13, 1678, 18031, 584, 5785, 13, 4706, 29250, 1546, 278, 8974, 313, 7720, 7573, 29897, 13, 1678, 9995, 13, 1678, 478, 353, 365, 29916, 334, 8626, 334, 365, 29920, 13, 1678, 478, 29918, 5441, 353, 478, 847, 302, 29918, 4351, 13, 1678, 365, 29918, 5441, 353, 478, 29918, 5441, 1068, 29898, 29896, 29889, 847, 29871, 29941, 1846, 13, 1678, 302, 29916, 353, 7442, 29889, 27696, 29898, 29931, 29916, 847, 365, 29918, 5441, 29897, 13, 1678, 7098, 353, 7442, 29889, 27696, 29898, 29931, 29891, 847, 365, 29918, 5441, 29897, 13, 1678, 302, 29920, 353, 7442, 29889, 27696, 29898, 29931, 29920, 847, 365, 29918, 5441, 29897, 13, 1678, 18031, 353, 365, 29916, 847, 313, 23818, 448, 29871, 29896, 29897, 13, 1678, 365, 29916, 29918, 29876, 353, 313, 23818, 448, 29871, 29896, 29897, 334, 18031, 13, 1678, 8626, 29918, 29876, 353, 313, 1460, 448, 29871, 29896, 29897, 334, 18031, 13, 1678, 365, 29920, 29918, 29876, 353, 313, 29876, 29920, 448, 29871, 29896, 29897, 334, 18031, 13, 1678, 736, 313, 23818, 29892, 7098, 29892, 302, 29920, 29892, 365, 29916, 29918, 29876, 29892, 8626, 29918, 29876, 29892, 365, 29920, 29918, 29876, 29892, 18031, 29897, 13, 13, 13, 1753, 365, 29918, 4299, 29918, 11255, 29898, 29895, 29918, 17765, 29892, 282, 1862, 29892, 301, 1117, 29892, 474, 1125, 13, 1678, 9995, 4062, 363, 23786, 365, 29899, 2764, 345, 16287, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 413, 29918, 17765, 584, 7442, 29889, 2378, 13, 1678, 282, 1862, 584, 1051, 13, 1678, 301, 1117, 29881, 584, 1051, 13, 1678, 474, 584, 938, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1904, 12324, 584, 5785, 13, 1678, 10995, 950, 584, 5785, 13, 13, 1678, 9995, 13, 1678, 413, 29918, 11569, 353, 7442, 29889, 29880, 979, 29887, 29889, 11569, 29898, 29895, 29918, 17765, 718, 301, 1117, 29930, 9302, 29889, 22350, 29898, 29895, 29918, 17765, 29889, 12181, 29961, 29900, 12622, 13, 1678, 21762, 29918, 1482, 353, 7442, 29889, 6333, 29898, 29895, 29918, 11569, 29892, 282, 1862, 29897, 13, 1678, 478, 29918, 342, 353, 7442, 29889, 6333, 29898, 29895, 29918, 17765, 29892, 21762, 29918, 1482, 29897, 13, 1678, 1904, 12324, 353, 7442, 29889, 29872, 1144, 398, 877, 823, 29892, 2397, 976, 29875, 742, 21762, 29918, 1482, 29889, 29911, 29892, 478, 29918, 342, 29897, 13, 1678, 10995, 950, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29963, 29918, 342, 448, 282, 1862, 29897, 13, 1678, 1904, 12324, 353, 7442, 29889, 3317, 29898, 1545, 3478, 555, 29897, 13, 1678, 736, 1904, 12324, 29892, 10995, 950, 13, 13, 13, 1753, 8943, 29918, 4478, 29898, 29895, 29918, 17765, 29892, 282, 1862, 29892, 301, 1117, 17370, 29892, 302, 29918, 9057, 29879, 29922, 29946, 1125, 13, 1678, 9995, 4062, 363, 1459, 6553, 365, 29899, 2764, 345, 16287, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 413, 29918, 17765, 584, 7442, 29889, 2378, 13, 1678, 282, 1862, 584, 1051, 13, 1678, 301, 1117, 17370, 584, 1051, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1904, 12324, 11762, 584, 1051, 13, 1678, 10995, 950, 11762, 584, 1051, 13, 13, 1678, 9995, 13, 1678, 565, 349, 1718, 1964, 1307, 29931, 29918, 26612, 6227, 6181, 29901, 13, 4706, 17643, 353, 313, 18829, 287, 29898, 29931, 29918, 4299, 29918, 11255, 5033, 29895, 29918, 17765, 29892, 282, 1862, 29892, 301, 1117, 29892, 474, 29897, 13, 18884, 363, 474, 29892, 301, 1117, 297, 26985, 29898, 29880, 1117, 17370, 876, 13, 4706, 1904, 4270, 690, 353, 1459, 6553, 29898, 29876, 29918, 9057, 29879, 29922, 29876, 29918, 9057, 29879, 29892, 14998, 2433, 7097, 292, 1495, 29898, 9057, 29879, 29897, 13, 1678, 1683, 29901, 13, 4706, 396, 3529, 11539, 445, 29991, 13, 4706, 1904, 4270, 690, 353, 5159, 13, 4706, 363, 474, 29892, 301, 1117, 297, 26985, 29898, 29880, 1117, 17370, 1125, 13, 9651, 1904, 4270, 690, 29889, 4397, 29898, 29931, 29918, 4299, 29918, 11255, 29898, 29895, 29918, 17765, 29892, 282, 1862, 29892, 301, 1117, 29892, 474, 876, 13, 1678, 1904, 12324, 11762, 29892, 10995, 950, 11762, 353, 14319, 10456, 4299, 4270, 690, 29897, 13, 1678, 736, 1904, 12324, 11762, 29892, 10995, 950, 11762, 13, 13, 13, 1753, 903, 16105, 264, 3391, 1220, 29918, 1983, 417, 412, 29898, 29879, 417, 412, 1125, 13, 1678, 9995, 13, 1678, 21981, 675, 24968, 363, 27209, 264, 3391, 29915, 29879, 1196, 5687, 29889, 13, 1678, 8653, 269, 353, 7442, 29889, 2378, 4197, 14352, 29906, 29892, 448, 29906, 29892, 448, 29906, 29892, 29871, 29900, 24960, 13, 1678, 8653, 903, 16105, 264, 3391, 1220, 29918, 1983, 417, 412, 29898, 29879, 29897, 13, 1678, 1409, 4197, 14352, 29896, 1696, 448, 29896, 1696, 448, 29896, 1696, 259, 29900, 5586, 2314, 13, 1678, 8653, 269, 353, 7442, 29889, 2378, 4197, 29961, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 24960, 13, 1678, 8653, 903, 16105, 264, 3391, 1220, 29918, 1983, 417, 412, 29898, 29879, 29897, 13, 1678, 1409, 4197, 29961, 29871, 29900, 1696, 259, 29900, 1696, 259, 29900, 1696, 259, 29900, 5586, 2314, 13, 1678, 8653, 269, 353, 7442, 29889, 2378, 4197, 29961, 29900, 29892, 29871, 29900, 29892, 29871, 29929, 29892, 29871, 29900, 24960, 13, 1678, 8653, 903, 16105, 264, 3391, 1220, 29918, 1983, 417, 412, 29898, 29879, 29897, 13, 1678, 1409, 4197, 29961, 29871, 29900, 1696, 259, 29900, 1696, 259, 29896, 1696, 259, 29900, 5586, 2314, 13, 1678, 9995, 13, 1678, 6287, 353, 7442, 29889, 314, 1165, 29898, 9302, 29889, 6897, 29898, 29879, 417, 412, 511, 9685, 29922, 29896, 467, 690, 14443, 6278, 29896, 29892, 29871, 29896, 29897, 13, 1678, 24786, 417, 412, 353, 313, 7052, 1275, 29871, 29900, 467, 497, 29898, 29896, 29897, 13, 1678, 6287, 29961, 3298, 359, 417, 412, 29962, 353, 7442, 29889, 2873, 29898, 29896, 29897, 13, 1678, 4226, 1891, 29879, 417, 412, 353, 7442, 29889, 2378, 29898, 29879, 417, 412, 29892, 26688, 29922, 9302, 29889, 8896, 29897, 847, 6287, 13, 1678, 4226, 1891, 29879, 417, 412, 29961, 3298, 359, 417, 412, 29962, 353, 7442, 29889, 3298, 359, 29898, 29879, 417, 412, 29961, 29900, 1822, 12181, 29897, 13, 1678, 736, 4226, 1891, 29879, 417, 412, 13, 13, 1753, 903, 16105, 264, 3391, 9012, 29898, 2962, 29892, 1095, 29892, 4236, 29918, 1524, 1125, 13, 1678, 9995, 13, 1678, 16969, 302, 16485, 3454, 310, 3309, 4236, 29918, 1524, 1269, 29889, 313, 29876, 16485, 921, 4236, 29918, 1524, 921, 9927, 29897, 29871, 13, 1678, 8653, 269, 353, 7442, 29889, 2378, 4197, 29961, 29941, 29892, 29871, 29896, 29892, 29871, 29929, 29892, 29871, 29900, 16272, 29900, 29892, 29871, 29900, 29892, 29871, 29941, 29892, 29871, 29900, 24960, 13, 1678, 8653, 903, 16105, 264, 3391, 9012, 29898, 29879, 29892, 7442, 29889, 3298, 359, 29898, 29879, 29889, 12181, 29961, 29896, 11724, 4236, 29918, 1524, 10457, 29896, 29897, 13, 1678, 1409, 4197, 8999, 29871, 29941, 29892, 259, 29896, 29892, 259, 29947, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29955, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29953, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29945, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29946, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29941, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29900, 29892, 259, 29900, 20526, 13, 1678, 529, 13367, 2190, 29968, 18521, 29958, 13, 965, 5519, 29871, 29900, 29892, 259, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29941, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29946, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29945, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29953, 29892, 259, 29900, 5262, 2314, 13, 1678, 9995, 13, 1678, 565, 4236, 29918, 1524, 1275, 448, 29896, 29901, 13, 4706, 4236, 29918, 1524, 353, 7442, 29889, 314, 1165, 29898, 9302, 29889, 314, 1165, 29898, 9302, 29889, 6897, 29898, 355, 448, 1369, 511, 9685, 29922, 29896, 876, 13, 1678, 302, 16485, 29892, 3964, 353, 1369, 29889, 12181, 13, 1678, 17534, 417, 412, 353, 903, 16105, 264, 3391, 1220, 29918, 1983, 417, 412, 29898, 355, 448, 1369, 29897, 13, 13, 1678, 396, 6576, 304, 13649, 373, 13, 1678, 4331, 11762, 353, 7442, 29889, 279, 927, 29898, 29896, 29892, 4236, 29918, 1524, 718, 29871, 29896, 29897, 13, 1678, 4331, 2922, 353, 7442, 29889, 29873, 488, 29898, 10568, 11762, 29892, 313, 6229, 29892, 29871, 29896, 8106, 29911, 13, 13, 1678, 396, 777, 447, 4684, 363, 12672, 292, 6284, 13, 1678, 289, 1220, 353, 1369, 7503, 29892, 7442, 29889, 1482, 8990, 29892, 584, 29962, 718, 17534, 417, 412, 7503, 29892, 7442, 29889, 1482, 8990, 29892, 584, 29962, 334, 4331, 2922, 13, 13, 1678, 396, 28268, 2657, 403, 304, 20471, 938, 13, 1678, 736, 7442, 29889, 2378, 29898, 9302, 29889, 29878, 524, 29898, 29890, 1220, 511, 26688, 29922, 2962, 29889, 29881, 1853, 29897, 13, 13, 1753, 289, 690, 264, 3391, 1220, 29898, 2962, 29892, 1095, 29892, 4236, 29918, 1524, 29922, 29945, 1125, 13, 1678, 9995, 13, 1678, 16969, 263, 1051, 310, 3291, 515, 313, 2962, 29892, 1095, 29962, 491, 15570, 16703, 292, 263, 1196, 289, 29914, 29893, 278, 13, 1678, 3291, 29889, 13, 1678, 12662, 2699, 29901, 13, 4706, 1369, 29901, 530, 1409, 310, 1369, 3291, 313, 4537, 310, 3291, 921, 9927, 29897, 13, 4706, 1095, 29901, 259, 530, 1095, 3291, 313, 29896, 921, 9927, 29897, 13, 9651, 470, 530, 1409, 310, 1095, 1298, 6590, 304, 1269, 1369, 1298, 13, 18884, 313, 4537, 310, 3291, 921, 9927, 29897, 13, 4706, 4236, 29918, 1524, 29901, 5918, 3291, 304, 29370, 29889, 565, 448, 29896, 29892, 7472, 1353, 310, 3734, 13, 462, 29871, 3291, 526, 13310, 287, 13, 1678, 16969, 29901, 13, 4706, 1196, 1365, 29916, 313, 29876, 921, 9927, 29897, 319, 13299, 28524, 1409, 310, 599, 3291, 13310, 287, 491, 13, 4706, 599, 278, 3454, 577, 2215, 29889, 13, 1678, 8653, 269, 353, 7442, 29889, 2378, 4197, 29961, 29941, 29892, 29871, 29896, 29892, 29871, 29929, 29892, 29871, 29900, 16272, 29900, 29892, 29871, 29900, 29892, 29871, 29941, 29892, 29871, 29900, 24960, 13, 1678, 8653, 289, 690, 264, 3391, 1220, 29898, 29879, 29892, 7442, 29889, 3298, 359, 29898, 29879, 29889, 12181, 29961, 29896, 11724, 4236, 29918, 1524, 10457, 29896, 29897, 13, 1678, 1409, 4197, 29961, 29871, 29941, 29892, 259, 29896, 29892, 259, 29947, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29955, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29953, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29906, 29892, 259, 29896, 29892, 259, 29945, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29946, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29941, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29896, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29941, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29946, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29945, 29892, 259, 29900, 1402, 13, 965, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29953, 29892, 259, 29900, 24960, 13, 1678, 9995, 13, 1678, 396, 7106, 278, 3291, 408, 263, 2323, 1409, 13, 1678, 736, 903, 16105, 264, 3391, 9012, 29898, 2962, 29892, 1095, 29892, 4236, 29918, 1524, 467, 690, 14443, 6278, 29896, 29892, 1369, 29889, 12181, 14352, 29896, 2314, 13, 13, 13, 1990, 16012, 1469, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2084, 1125, 13, 4706, 1583, 29889, 14400, 353, 6571, 13, 4706, 1583, 29889, 2605, 353, 6571, 13, 4706, 1583, 29889, 2084, 353, 2224, 13, 4706, 1583, 29889, 657, 29918, 24772, 580, 13, 4706, 1583, 29889, 1359, 877, 29885, 5676, 3002, 1495, 13, 4706, 1583, 29889, 1359, 877, 15436, 307, 311, 29918, 1066, 2187, 1495, 13, 4706, 1583, 29889, 1359, 877, 29931, 26353, 1495, 13, 13, 1678, 822, 3566, 29898, 1311, 29892, 5816, 29892, 995, 1125, 13, 4706, 565, 825, 1275, 525, 29885, 5676, 3002, 2396, 13, 9651, 1583, 29889, 29885, 5676, 3002, 353, 995, 13, 4706, 25342, 825, 1275, 525, 15436, 307, 311, 29918, 1066, 2187, 2396, 13, 9651, 1583, 29889, 6146, 29918, 1066, 353, 995, 13, 4706, 25342, 825, 1275, 525, 29931, 26353, 2396, 13, 9651, 1583, 29889, 29931, 26353, 353, 995, 13, 632, 13, 1678, 822, 1014, 29918, 3972, 29918, 2084, 29898, 1311, 29892, 29881, 1125, 13, 4706, 736, 29871, 4175, 29898, 359, 29889, 2084, 29889, 275, 3972, 29892, 518, 359, 29889, 2084, 29889, 7122, 29898, 29881, 29892, 29888, 29897, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 29881, 29897, 2314, 13, 13, 1678, 822, 679, 29918, 29888, 978, 29898, 1311, 29892, 29881, 29892, 29888, 7039, 1125, 13, 4706, 565, 7431, 29898, 29888, 7039, 29897, 1275, 29871, 29896, 29901, 13, 9651, 736, 2897, 29889, 2084, 29889, 7122, 29898, 29881, 29892, 29888, 7039, 29961, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 10898, 353, 5159, 13, 9651, 363, 285, 978, 297, 285, 7039, 29901, 13, 18884, 10898, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 29898, 29881, 29892, 29888, 978, 876, 13, 9651, 736, 10898, 13, 308, 13, 1678, 822, 679, 29918, 24772, 29898, 1311, 1125, 13, 13, 4706, 4516, 29918, 1761, 353, 1583, 29889, 1491, 29918, 3972, 29918, 2084, 29898, 1311, 29889, 2084, 29897, 13, 4706, 363, 270, 2214, 297, 4516, 29918, 1761, 29901, 13, 9651, 2066, 353, 2897, 29889, 1761, 3972, 29898, 29881, 2214, 29897, 13, 9651, 565, 270, 2214, 29889, 1975, 2541, 703, 29885, 5676, 3002, 29908, 1125, 13, 18884, 1583, 29889, 2084, 29918, 29885, 5676, 3002, 353, 1583, 29889, 657, 29918, 29888, 978, 29898, 29881, 2214, 29892, 5325, 29897, 13, 18884, 1583, 29889, 2605, 1839, 29885, 5676, 3002, 2033, 353, 1583, 29889, 2084, 29918, 29885, 5676, 3002, 13, 18884, 1583, 29889, 14400, 1839, 29885, 5676, 3002, 2033, 353, 2254, 29918, 2774, 29883, 13, 9651, 565, 270, 2214, 29889, 1975, 2541, 703, 1066, 2187, 29908, 1125, 13, 18884, 1583, 29889, 2084, 29918, 6146, 29918, 1066, 353, 1583, 29889, 657, 29918, 29888, 978, 29898, 29881, 2214, 29892, 5325, 29897, 13, 18884, 1583, 29889, 2605, 3366, 15436, 307, 311, 29918, 1066, 2187, 3108, 353, 1583, 29889, 2084, 29918, 6146, 29918, 1066, 13, 18884, 1583, 29889, 14400, 3366, 15436, 307, 311, 29918, 1066, 2187, 3108, 353, 2254, 29918, 295, 1066, 13, 9651, 565, 270, 2214, 29889, 1975, 2541, 703, 29931, 26353, 29908, 1125, 13, 18884, 1583, 29889, 2084, 29918, 29931, 26353, 353, 1583, 29889, 657, 29918, 29888, 978, 29898, 29881, 2214, 29892, 5325, 29897, 13, 18884, 1583, 29889, 2605, 3366, 29931, 26353, 3108, 353, 1583, 29889, 2084, 29918, 29931, 26353, 13, 18884, 1583, 29889, 14400, 3366, 29931, 26353, 3108, 353, 7442, 29889, 1359, 3945, 13, 462, 1678, 13, 462, 13, 1678, 822, 2254, 29898, 1311, 29892, 825, 29892, 3653, 29922, 8516, 29892, 2224, 29922, 8516, 1125, 13, 4706, 565, 451, 3653, 29901, 13, 9651, 3653, 353, 1583, 29889, 14400, 29961, 5816, 29962, 13, 13, 4706, 565, 451, 2224, 29901, 13, 632, 13, 9651, 2224, 353, 1583, 29889, 2605, 29961, 5816, 29962, 13, 9651, 396, 2158, 29898, 5816, 5501, 26690, 934, 1134, 29889, 15447, 14831, 934, 4072, 526, 18131, 3002, 29892, 28118, 311, 29918, 1066, 2187, 29892, 365, 26353, 1495, 13, 9651, 396, 2457, 13, 13, 4706, 565, 338, 8758, 29898, 2084, 29892, 1761, 1125, 13, 9651, 363, 282, 297, 2224, 29901, 13, 18884, 565, 282, 29889, 1975, 2541, 877, 2774, 29883, 29374, 13, 462, 1678, 2224, 353, 282, 13, 462, 1678, 2867, 13, 4706, 1018, 29901, 13, 9651, 285, 353, 1722, 29898, 2084, 29897, 13, 4706, 5174, 10663, 2392, 29901, 13, 9651, 1596, 877, 23323, 451, 1722, 934, 742, 2084, 29897, 13, 9651, 1583, 29889, 16645, 29898, 5816, 29892, 8516, 29897, 13, 9651, 736, 13, 13, 4706, 1018, 29901, 13, 9651, 848, 353, 3653, 29898, 29888, 29897, 13, 9651, 1583, 29889, 16645, 29898, 5816, 29892, 1272, 29897, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 1596, 877, 23323, 451, 2254, 934, 742, 2084, 29897, 13, 9651, 1583, 29889, 16645, 29898, 5816, 29892, 8516, 29897, 13, 9651, 285, 29889, 5358, 580, 13, 9651, 736, 13, 4706, 1596, 877, 5896, 742, 2084, 29897, 13, 4706, 285, 29889, 5358, 580, 13, 2 ]
Examples/AdvancedUsage/LoadingOptions/ViewProtectedDocument.py
groupdocs-viewer-cloud/groupdocs-viewer-cloud-python-samples
0
84375
<filename>Examples/AdvancedUsage/LoadingOptions/ViewProtectedDocument.py # Import modules import groupdocs_viewer_cloud from Common import Common # This example demonstrates how to render password-protected documents class ViewProtectedDocument: @classmethod def Run(cls): apiInstance = groupdocs_viewer_cloud.ViewApi.from_config(Common.GetConfig()) view_options = groupdocs_viewer_cloud.ViewOptions() view_options.file_info = groupdocs_viewer_cloud.FileInfo() view_options.file_info.file_path = "SampleFiles/password_protected.docx" view_options.file_info.password = "<PASSWORD>" view_options.view_format = "HTML" request = groupdocs_viewer_cloud.CreateViewRequest(view_options) response = apiInstance.create_view(request) print("ViewProtectedDocument completed: " + str(len(response.pages)))
[ 1, 529, 9507, 29958, 1252, 9422, 29914, 3253, 16858, 27573, 29914, 23456, 5856, 29914, 1043, 1184, 371, 2954, 6268, 29889, 2272, 13, 29937, 16032, 10585, 13, 5215, 2318, 2640, 29918, 29894, 15580, 29918, 9274, 13, 3166, 13103, 1053, 13103, 13, 13, 29937, 910, 1342, 9004, 1078, 920, 304, 4050, 4800, 29899, 24681, 10701, 13, 1990, 4533, 1184, 371, 2954, 6268, 29901, 13, 1678, 732, 1990, 5696, 259, 13, 1678, 822, 7525, 29898, 25932, 1125, 13, 4706, 7882, 4998, 353, 2318, 2640, 29918, 29894, 15580, 29918, 9274, 29889, 1043, 11713, 29889, 3166, 29918, 2917, 29898, 18877, 29889, 2577, 3991, 3101, 13, 4706, 1776, 29918, 6768, 353, 2318, 2640, 29918, 29894, 15580, 29918, 9274, 29889, 1043, 5856, 580, 13, 4706, 1776, 29918, 6768, 29889, 1445, 29918, 3888, 353, 2318, 2640, 29918, 29894, 15580, 29918, 9274, 29889, 2283, 3401, 580, 13, 4706, 1776, 29918, 6768, 29889, 1445, 29918, 3888, 29889, 1445, 29918, 2084, 353, 376, 17708, 10547, 29914, 5630, 29918, 24681, 29889, 1514, 29916, 29908, 13, 4706, 1776, 29918, 6768, 29889, 1445, 29918, 3888, 29889, 5630, 353, 9872, 25711, 17013, 11903, 13, 4706, 1776, 29918, 6768, 29889, 1493, 29918, 4830, 353, 376, 7020, 29908, 13, 13, 4706, 2009, 353, 2318, 2640, 29918, 29894, 15580, 29918, 9274, 29889, 4391, 1043, 3089, 29898, 1493, 29918, 6768, 29897, 13, 4706, 2933, 353, 7882, 4998, 29889, 3258, 29918, 1493, 29898, 3827, 29897, 13, 4706, 1596, 703, 1043, 1184, 371, 2954, 6268, 8676, 29901, 376, 718, 851, 29898, 2435, 29898, 5327, 29889, 12292, 4961, 13, 2 ]
tests/init.py
Animenosekai/yuno
1
19482
<filename>tests/init.py import inspect import pathlib import sys import yuno # CONSTANTS TEST_OBJECT = { "a": 1, "b": 2, "c": 3, "test_dict": { "a": 1, "b": 2, "c": 3 }, "float": 1.1, "int": 1, "test_list": [1, 2, 3], "null": None, "string": "test", "boolean": True } TEST_LIST = [ "string", 1, 1.1, None, [1, 2, 3], TEST_OBJECT, True ] TEST_DOCUMENT = {"_id": "test_document", "hello": "world", "test_list": TEST_LIST, "test_dict": TEST_OBJECT, "boolean": True, "float": 1.1, "int": 1, "null": None, "string": "test"} KEPT_DATABASES = {'admin', 'local', 'config'} REALTIME_TIMEOUT = 5 # UTILITY FUNCTIONS def get_args(func): return inspect.signature(func).parameters.keys() STEP = f"CI/Testing - v{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" def log(message): try: yuno.utils.logging.log(message, yuno.utils.logging.LogLevels.INFO, step=STEP) except Exception: pass def close(mongo: yuno.MongoDB, client: yuno.YunoClient): log("Closing the client connection") client.close() if mongo.__process__ is not None: log("Stopping MongoDB") mongo.close() # INITIALIZATION FUNCTIONS f = pathlib.Path("./MONGO_PORT") if f.is_file(): MONGO_PORT = int(f.read_text().replace(" ", "")) else: MONGO_PORT = 27017 def init_mongo(): log("Initializing MongoDB with port: " + str(MONGO_PORT)) mongo = yuno.MongoDB(port=MONGO_PORT, db_path="./test", log_config={"path": "./test.log"}) try: log("Starting MongoDB") mongo.start() except RuntimeError: log("MongoDB seems to be already running?") return mongo def init_client(): mongo = init_mongo() client = yuno.YunoClient(mongo) for database in set(client.database_names()).difference({'admin', 'local', 'config'}): log(f"Dropping database: {database}") del client[database] return mongo, client def init_database(): mongo, client = init_client() log("Initializing Database") database = yuno.YunoDatabase(client, "test") log("Cleaning up the database") for collection in database.list_collection_names(): log(f"Dropping collection: {collection}") del database[collection] return mongo, client, database def init_collection(): mongo, client, database = init_database() log("Initializing collection") collection = yuno.YunoCollection(database, "test") log("Cleaning up the collection") for document in collection.find(include=["_id"]): log(f"Deleting document: {document.__id__}") del collection[document.__id__] return mongo, client, database, collection def init_document(): mongo, client, database, collection = init_collection() log("Initializing Document") collection.test_document = TEST_DOCUMENT return mongo, client, database, collection, collection.test_document # DECORATORS def use_mongo(func): def wrapper(*args, **kwargs): mongo = init_mongo() avail = get_args(func) if "mongo" in avail: kwargs["mongo"] = mongo result = func(*args, **kwargs) if mongo.__process__ is not None: log("Stopping MongoDB") mongo.close() return result return wrapper def use_client(func): def wrapper(*args, **kwargs): mongo, client = init_client() avail = get_args(func) for arg, value in [("mongo", mongo), ("client", client)]: if arg in avail: kwargs[arg] = value result = func(*args, **kwargs) close(mongo, client) return result return wrapper def use_database(func): def wrapper(*args, **kwargs): mongo, client, database = init_database() avail = get_args(func) for arg, value in [("mongo", mongo), ("client", client), ("database", database)]: if arg in avail: kwargs[arg] = value result = func(*args, **kwargs) close(mongo, client) return result return wrapper def use_collection(func): def wrapper(*args, **kwargs): mongo, client, database, collection = init_collection() avail = get_args(func) for arg, value in [("mongo", mongo), ("client", client), ("database", database), ("collection", collection)]: if arg in avail: kwargs[arg] = value result = func(*args, **kwargs) close(mongo, client) return result return wrapper def verification_callback(obj): log(f"cursor ~ Verifying object {obj}") return obj def use_cursor(func): def wrapper(*args, **kwargs): mongo, client, database, collection = init_collection() collection.hello = {'_id': "hello", 'hello': "world"} cursor = yuno.cursor.Cursor(collection.__collection__.find({"_id": "hello"}), verification=verification_callback) avail = get_args(func) for arg, value in [("mongo", mongo), ("client", client), ("database", database), ("collection", collection), ("cursor", cursor)]: if arg in avail: kwargs[arg] = value result = func(*args, **kwargs) close(mongo, client) return result return wrapper def use_document(func): def wrapper(*args, **kwargs): mongo, client, database, collection, document = init_document() avail = get_args(func) for arg, value in [("mongo", mongo), ("client", client), ("database", database), ("collection", collection), ("document", document)]: if arg in avail: kwargs[arg] = value result = func(*args, **kwargs) close(mongo, client) return result return wrapper
[ 1, 529, 9507, 29958, 21150, 29914, 2344, 29889, 2272, 13, 5215, 16096, 13, 5215, 2224, 1982, 13, 5215, 10876, 13, 13, 5215, 343, 9447, 13, 13, 29937, 8707, 1254, 2190, 9375, 13, 13, 18267, 29918, 14824, 17637, 353, 426, 13, 1678, 376, 29874, 1115, 29871, 29896, 29892, 13, 1678, 376, 29890, 1115, 29871, 29906, 29892, 13, 1678, 376, 29883, 1115, 29871, 29941, 29892, 13, 1678, 376, 1688, 29918, 8977, 1115, 426, 13, 4706, 376, 29874, 1115, 29871, 29896, 29892, 13, 4706, 376, 29890, 1115, 29871, 29906, 29892, 13, 4706, 376, 29883, 1115, 29871, 29941, 13, 1678, 2981, 13, 1678, 376, 7411, 1115, 29871, 29896, 29889, 29896, 29892, 13, 1678, 376, 524, 1115, 29871, 29896, 29892, 13, 1678, 376, 1688, 29918, 1761, 1115, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 1402, 13, 1678, 376, 4304, 1115, 6213, 29892, 13, 1678, 376, 1807, 1115, 376, 1688, 613, 13, 1678, 376, 20054, 1115, 5852, 13, 29913, 13, 13, 18267, 29918, 24360, 353, 518, 13, 1678, 376, 1807, 613, 13, 268, 29896, 29892, 13, 268, 29896, 29889, 29896, 29892, 13, 1678, 6213, 29892, 13, 1678, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 1402, 13, 1678, 17067, 1254, 29918, 14824, 17637, 29892, 13, 1678, 5852, 13, 29962, 13, 13, 18267, 29918, 28665, 5005, 3919, 353, 8853, 29918, 333, 1115, 376, 1688, 29918, 3225, 613, 376, 12199, 1115, 376, 11526, 613, 376, 1688, 29918, 1761, 1115, 17067, 1254, 29918, 24360, 29892, 376, 1688, 29918, 8977, 1115, 17067, 1254, 29918, 14824, 17637, 29892, 13, 462, 376, 20054, 1115, 5852, 29892, 376, 7411, 1115, 29871, 29896, 29889, 29896, 29892, 376, 524, 1115, 29871, 29896, 29892, 376, 4304, 1115, 6213, 29892, 376, 1807, 1115, 376, 1688, 9092, 13, 13, 13, 6059, 7982, 29918, 25832, 27982, 29903, 353, 11117, 6406, 742, 525, 2997, 742, 525, 2917, 10827, 13, 13, 1525, 1964, 15307, 29918, 15307, 12015, 353, 29871, 29945, 13, 13, 29937, 501, 29911, 6227, 11937, 383, 28700, 29903, 13, 13, 13, 1753, 679, 29918, 5085, 29898, 9891, 1125, 13, 1678, 736, 16096, 29889, 4530, 1535, 29898, 9891, 467, 16744, 29889, 8149, 580, 13, 13, 13, 1254, 15488, 353, 285, 29908, 8426, 29914, 3057, 292, 448, 325, 29912, 9675, 29889, 3259, 29918, 3888, 29889, 21355, 1836, 29912, 9675, 29889, 3259, 29918, 3888, 29889, 1195, 272, 1836, 29912, 9675, 29889, 3259, 29918, 3888, 29889, 29885, 2357, 5038, 13, 13, 13, 1753, 1480, 29898, 4906, 1125, 13, 1678, 1018, 29901, 13, 4706, 343, 9447, 29889, 13239, 29889, 21027, 29889, 1188, 29898, 4906, 29892, 343, 9447, 29889, 13239, 29889, 21027, 29889, 3403, 10108, 29879, 29889, 11690, 29892, 4331, 29922, 1254, 15488, 29897, 13, 1678, 5174, 8960, 29901, 13, 4706, 1209, 13, 13, 13, 1753, 3802, 29898, 29885, 7443, 29901, 343, 9447, 29889, 29924, 7443, 4051, 29892, 3132, 29901, 343, 9447, 29889, 29979, 9447, 4032, 1125, 13, 1678, 1480, 703, 29907, 5409, 292, 278, 3132, 3957, 1159, 13, 1678, 3132, 29889, 5358, 580, 13, 1678, 565, 19476, 17255, 5014, 1649, 338, 451, 6213, 29901, 13, 4706, 1480, 703, 20754, 3262, 29004, 1159, 13, 4706, 19476, 29889, 5358, 580, 13, 13, 13, 29937, 2672, 1806, 25758, 26664, 8098, 383, 28700, 29903, 13, 29888, 353, 2224, 1982, 29889, 2605, 703, 6904, 22877, 17080, 29918, 15082, 1159, 13, 361, 285, 29889, 275, 29918, 1445, 7295, 13, 1678, 341, 1164, 17080, 29918, 15082, 353, 938, 29898, 29888, 29889, 949, 29918, 726, 2141, 6506, 703, 9162, 5124, 876, 13, 2870, 29901, 13, 1678, 341, 1164, 17080, 29918, 15082, 353, 29871, 29906, 29955, 29900, 29896, 29955, 13, 13, 13, 1753, 2069, 29918, 29885, 7443, 7295, 13, 1678, 1480, 703, 15514, 5281, 29004, 411, 2011, 29901, 376, 718, 851, 29898, 22877, 17080, 29918, 15082, 876, 13, 1678, 19476, 353, 343, 9447, 29889, 29924, 7443, 4051, 29898, 637, 29922, 22877, 17080, 29918, 15082, 29892, 4833, 29918, 2084, 543, 6904, 1688, 613, 1480, 29918, 2917, 3790, 29908, 2084, 1115, 376, 6904, 1688, 29889, 1188, 29908, 1800, 13, 1678, 1018, 29901, 13, 4706, 1480, 703, 4763, 292, 29004, 1159, 13, 4706, 19476, 29889, 2962, 580, 13, 1678, 5174, 24875, 2392, 29901, 13, 4706, 1480, 703, 29924, 7443, 4051, 2444, 304, 367, 2307, 2734, 29973, 1159, 13, 1678, 736, 19476, 13, 13, 13, 1753, 2069, 29918, 4645, 7295, 13, 1678, 19476, 353, 2069, 29918, 29885, 7443, 580, 13, 1678, 3132, 353, 343, 9447, 29889, 29979, 9447, 4032, 29898, 29885, 7443, 29897, 13, 1678, 363, 2566, 297, 731, 29898, 4645, 29889, 9803, 29918, 7039, 16655, 29881, 17678, 3319, 29915, 6406, 742, 525, 2997, 742, 525, 2917, 10827, 1125, 13, 4706, 1480, 29898, 29888, 29908, 29928, 307, 3262, 2566, 29901, 426, 9803, 27195, 13, 4706, 628, 3132, 29961, 9803, 29962, 13, 13, 1678, 736, 19476, 29892, 3132, 13, 13, 13, 1753, 2069, 29918, 9803, 7295, 13, 1678, 19476, 29892, 3132, 353, 2069, 29918, 4645, 580, 13, 1678, 1480, 703, 15514, 5281, 5470, 1159, 13, 1678, 2566, 353, 343, 9447, 29889, 29979, 9447, 9112, 29898, 4645, 29892, 376, 1688, 1159, 13, 1678, 1480, 703, 29907, 14044, 292, 701, 278, 2566, 1159, 13, 1678, 363, 4333, 297, 2566, 29889, 1761, 29918, 10855, 29918, 7039, 7295, 13, 4706, 1480, 29898, 29888, 29908, 29928, 307, 3262, 4333, 29901, 426, 10855, 27195, 13, 4706, 628, 2566, 29961, 10855, 29962, 13, 13, 1678, 736, 19476, 29892, 3132, 29892, 2566, 13, 13, 13, 1753, 2069, 29918, 10855, 7295, 13, 1678, 19476, 29892, 3132, 29892, 2566, 353, 2069, 29918, 9803, 580, 13, 1678, 1480, 703, 15514, 5281, 4333, 1159, 13, 1678, 4333, 353, 343, 9447, 29889, 29979, 9447, 7196, 29898, 9803, 29892, 376, 1688, 1159, 13, 1678, 1480, 703, 29907, 14044, 292, 701, 278, 4333, 1159, 13, 1678, 363, 1842, 297, 4333, 29889, 2886, 29898, 2856, 29922, 3366, 29918, 333, 3108, 1125, 13, 4706, 1480, 29898, 29888, 29908, 2772, 1026, 292, 1842, 29901, 426, 3225, 17255, 333, 1649, 27195, 13, 4706, 628, 4333, 29961, 3225, 17255, 333, 1649, 29962, 13, 1678, 736, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 13, 13, 13, 1753, 2069, 29918, 3225, 7295, 13, 1678, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 353, 2069, 29918, 10855, 580, 13, 1678, 1480, 703, 15514, 5281, 10854, 1159, 13, 1678, 4333, 29889, 1688, 29918, 3225, 353, 17067, 1254, 29918, 28665, 5005, 3919, 13, 1678, 736, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 29892, 4333, 29889, 1688, 29918, 3225, 13, 13, 29937, 5012, 29907, 1955, 1299, 24125, 13, 13, 13, 1753, 671, 29918, 29885, 7443, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 353, 2069, 29918, 29885, 7443, 580, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 565, 376, 29885, 7443, 29908, 297, 20847, 29901, 13, 9651, 9049, 5085, 3366, 29885, 7443, 3108, 353, 19476, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 565, 19476, 17255, 5014, 1649, 338, 451, 6213, 29901, 13, 9651, 1480, 703, 20754, 3262, 29004, 1159, 13, 9651, 19476, 29889, 5358, 580, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 13, 13, 1753, 671, 29918, 4645, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 29892, 3132, 353, 2069, 29918, 4645, 580, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 363, 1852, 29892, 995, 297, 518, 703, 29885, 7443, 613, 19476, 511, 4852, 4645, 613, 3132, 4638, 29901, 13, 9651, 565, 1852, 297, 20847, 29901, 13, 18884, 9049, 5085, 29961, 1191, 29962, 353, 995, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 3802, 29898, 29885, 7443, 29892, 3132, 29897, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 13, 13, 1753, 671, 29918, 9803, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 29892, 3132, 29892, 2566, 353, 2069, 29918, 9803, 580, 13, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 363, 1852, 29892, 995, 297, 518, 703, 29885, 7443, 613, 19476, 511, 4852, 4645, 613, 3132, 511, 4852, 9803, 613, 2566, 4638, 29901, 13, 9651, 565, 1852, 297, 20847, 29901, 13, 18884, 9049, 5085, 29961, 1191, 29962, 353, 995, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 3802, 29898, 29885, 7443, 29892, 3132, 29897, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 13, 13, 1753, 671, 29918, 10855, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 353, 2069, 29918, 10855, 580, 13, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 363, 1852, 29892, 995, 297, 518, 703, 29885, 7443, 613, 19476, 511, 4852, 4645, 613, 3132, 511, 4852, 9803, 613, 2566, 511, 4852, 10855, 613, 4333, 4638, 29901, 13, 9651, 565, 1852, 297, 20847, 29901, 13, 18884, 9049, 5085, 29961, 1191, 29962, 353, 995, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 3802, 29898, 29885, 7443, 29892, 3132, 29897, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 13, 13, 1753, 1147, 2450, 29918, 14035, 29898, 5415, 1125, 13, 1678, 1480, 29898, 29888, 29908, 18127, 3695, 1798, 9215, 1203, 426, 5415, 27195, 13, 1678, 736, 5446, 13, 13, 13, 1753, 671, 29918, 18127, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 353, 2069, 29918, 10855, 580, 13, 4706, 4333, 29889, 12199, 353, 11117, 29918, 333, 2396, 376, 12199, 613, 525, 12199, 2396, 376, 11526, 9092, 13, 4706, 10677, 353, 343, 9447, 29889, 18127, 29889, 19890, 29898, 10855, 17255, 10855, 26914, 2886, 3319, 29908, 29918, 333, 1115, 376, 12199, 9092, 511, 1147, 2450, 29922, 369, 2450, 29918, 14035, 29897, 13, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 363, 1852, 29892, 995, 297, 518, 703, 29885, 7443, 613, 19476, 511, 4852, 4645, 613, 3132, 511, 4852, 9803, 613, 2566, 511, 4852, 10855, 613, 4333, 511, 4852, 18127, 613, 10677, 4638, 29901, 13, 9651, 565, 1852, 297, 20847, 29901, 13, 18884, 9049, 5085, 29961, 1191, 29962, 353, 995, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 3802, 29898, 29885, 7443, 29892, 3132, 29897, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 13, 13, 1753, 671, 29918, 3225, 29898, 9891, 1125, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 19476, 29892, 3132, 29892, 2566, 29892, 4333, 29892, 1842, 353, 2069, 29918, 3225, 580, 13, 13, 4706, 20847, 353, 679, 29918, 5085, 29898, 9891, 29897, 13, 4706, 363, 1852, 29892, 995, 297, 518, 703, 29885, 7443, 613, 19476, 511, 4852, 4645, 613, 3132, 511, 4852, 9803, 613, 2566, 511, 4852, 10855, 613, 4333, 511, 4852, 3225, 613, 1842, 4638, 29901, 13, 9651, 565, 1852, 297, 20847, 29901, 13, 18884, 9049, 5085, 29961, 1191, 29962, 353, 995, 13, 13, 4706, 1121, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 3802, 29898, 29885, 7443, 29892, 3132, 29897, 13, 4706, 736, 1121, 13, 1678, 736, 14476, 13, 2 ]
picosb/soc/cpu.py
mwbrown/picorv-sandbox
0
114017
from amaranth import * from .bus import NativeBusMaster class PicoRV32(NativeBusMaster): def __init__(self) -> None: super().__init__() self.rv_trap = Signal() def elaborate(self, platform): m = super().elaborate(platform) m.submodules += Instance("picorv32", p_PROGADDR_RESET = C(0x10000000, Shape(32)), # 32'h 1000_0000, p_PROGADDR_IRQ = C(0x10000010, Shape(32)), # 32'h 1000_0010, p_COMPRESSED_ISA = C(1), i_clk = ClockSignal(), i_resetn = ~ResetSignal(), o_trap = self.rv_trap, # Native memory interface o_mem_valid = self.mem_valid_o, o_mem_addr = self.mem_addr_o, o_mem_wdata = self.mem_wdata_o, o_mem_wstrb = self.mem_byte_wr_ena_o, o_mem_instr = self.mem_instr_o, i_mem_ready = self.mem_ready_i, i_mem_rdata = self.mem_rdata_i, # Memory lookahead interface (ignored) o_mem_la_read = Signal(), o_mem_la_write = Signal(), o_mem_la_addr = Signal(32), o_mem_la_wdata = Signal(32), o_mem_la_wstrb = Signal(4), # Coprocessor interface (not implemented) o_pcpi_valid = Signal(), o_pcpi_insn = Signal(32), o_pcpi_rs1 = Signal(32), o_pcpi_rs2 = Signal(32), i_pcpi_wr = C(0), #(1'b0), i_pcpi_rd = C(0, Shape(32)), #(32'b0), i_pcpi_wait = C(0), #(1'b0), i_pcpi_ready = C(0), #(1'b0), # IRQ interface (not implemented) i_irq = C(0, Shape(32)), #(32'b0), o_eoi = Signal(32), # Trace interface (ignored) o_trace_valid = Signal(), o_trace_data = Signal(36) ) return m
[ 1, 29871, 13, 3166, 626, 279, 9716, 1053, 334, 13, 3166, 869, 8262, 1053, 19042, 16890, 19203, 13, 13, 1990, 349, 1417, 29934, 29963, 29941, 29906, 29898, 11024, 16890, 19203, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29897, 1599, 6213, 29901, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 15291, 29918, 29873, 2390, 353, 9954, 284, 580, 13, 13, 1678, 822, 19430, 29898, 1311, 29892, 7481, 1125, 13, 4706, 286, 353, 2428, 2141, 295, 3717, 403, 29898, 12120, 29897, 13, 13, 4706, 286, 29889, 1491, 7576, 4619, 2799, 749, 703, 16447, 272, 29894, 29941, 29906, 613, 13, 13, 9651, 282, 29918, 8618, 29954, 3035, 8353, 29918, 1525, 10490, 353, 315, 29898, 29900, 29916, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29892, 1383, 4085, 29898, 29941, 29906, 8243, 396, 29871, 29941, 29906, 29915, 29882, 29871, 29896, 29900, 29900, 29900, 29918, 29900, 29900, 29900, 29900, 29892, 13, 9651, 282, 29918, 8618, 29954, 3035, 8353, 29918, 8193, 29984, 353, 315, 29898, 29900, 29916, 29896, 29900, 29900, 29900, 29900, 29900, 29896, 29900, 29892, 1383, 4085, 29898, 29941, 29906, 8243, 259, 396, 29871, 29941, 29906, 29915, 29882, 29871, 29896, 29900, 29900, 29900, 29918, 29900, 29900, 29896, 29900, 29892, 13, 9651, 282, 29918, 21514, 15989, 1660, 29928, 29918, 3235, 29909, 353, 315, 29898, 29896, 511, 13, 13, 9651, 474, 29918, 20495, 353, 315, 908, 10140, 284, 3285, 13, 9651, 474, 29918, 12071, 29876, 353, 3695, 27175, 10140, 284, 3285, 13, 9651, 288, 29918, 29873, 2390, 353, 1583, 29889, 15291, 29918, 29873, 2390, 29892, 13, 13, 9651, 396, 19042, 3370, 5067, 13, 9651, 288, 29918, 6954, 29918, 3084, 353, 1583, 29889, 6954, 29918, 3084, 29918, 29877, 29892, 13, 9651, 288, 29918, 6954, 29918, 10030, 353, 1583, 29889, 6954, 29918, 10030, 29918, 29877, 29892, 13, 9651, 288, 29918, 6954, 29918, 29893, 1272, 353, 1583, 29889, 6954, 29918, 29893, 1272, 29918, 29877, 29892, 13, 9651, 288, 29918, 6954, 29918, 29893, 710, 29890, 353, 1583, 29889, 6954, 29918, 10389, 29918, 15866, 29918, 2386, 29918, 29877, 29892, 13, 9651, 288, 29918, 6954, 29918, 262, 710, 353, 1583, 29889, 6954, 29918, 262, 710, 29918, 29877, 29892, 13, 9651, 474, 29918, 6954, 29918, 2040, 353, 1583, 29889, 6954, 29918, 2040, 29918, 29875, 29892, 13, 9651, 474, 29918, 6954, 29918, 29878, 1272, 353, 1583, 29889, 6954, 29918, 29878, 1272, 29918, 29875, 29892, 13, 13, 9651, 396, 18914, 1106, 29874, 2813, 5067, 313, 647, 4395, 29897, 13, 9651, 288, 29918, 6954, 29918, 433, 29918, 949, 353, 9954, 284, 3285, 13, 9651, 288, 29918, 6954, 29918, 433, 29918, 3539, 353, 9954, 284, 3285, 13, 9651, 288, 29918, 6954, 29918, 433, 29918, 10030, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 9651, 288, 29918, 6954, 29918, 433, 29918, 29893, 1272, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 9651, 288, 29918, 6954, 29918, 433, 29918, 29893, 710, 29890, 353, 9954, 284, 29898, 29946, 511, 13, 13, 9651, 396, 10061, 307, 985, 272, 5067, 313, 1333, 8762, 29897, 13, 9651, 288, 29918, 6739, 1631, 29918, 3084, 353, 9954, 284, 3285, 13, 9651, 288, 29918, 6739, 1631, 29918, 1144, 29876, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 9651, 288, 29918, 6739, 1631, 29918, 2288, 29896, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 9651, 288, 29918, 6739, 1631, 29918, 2288, 29906, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 9651, 474, 29918, 6739, 1631, 29918, 15866, 353, 315, 29898, 29900, 511, 27355, 29896, 29915, 29890, 29900, 511, 13, 9651, 474, 29918, 6739, 1631, 29918, 5499, 353, 315, 29898, 29900, 29892, 1383, 4085, 29898, 29941, 29906, 8243, 27355, 29941, 29906, 29915, 29890, 29900, 511, 13, 9651, 474, 29918, 6739, 1631, 29918, 10685, 353, 315, 29898, 29900, 511, 27355, 29896, 29915, 29890, 29900, 511, 13, 9651, 474, 29918, 6739, 1631, 29918, 2040, 353, 315, 29898, 29900, 511, 27355, 29896, 29915, 29890, 29900, 511, 13, 13, 9651, 396, 23292, 29984, 5067, 313, 1333, 8762, 29897, 13, 9651, 474, 29918, 381, 29939, 353, 315, 29898, 29900, 29892, 1383, 4085, 29898, 29941, 29906, 8243, 27355, 29941, 29906, 29915, 29890, 29900, 511, 13, 9651, 288, 29918, 29872, 7768, 353, 9954, 284, 29898, 29941, 29906, 511, 13, 13, 9651, 396, 20597, 5067, 313, 647, 4395, 29897, 13, 9651, 288, 29918, 15003, 29918, 3084, 353, 9954, 284, 3285, 13, 9651, 288, 29918, 15003, 29918, 1272, 353, 9954, 284, 29898, 29941, 29953, 29897, 13, 4706, 1723, 13, 13, 4706, 736, 286, 13, 2 ]
mjt/mjt/report/lot_wise_production_summary/lot_wise_production_summary.py
hamzaali15/mjt
0
188291
# Copyright (c) 2013, earthians and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe def execute(filters=None): columns = get_columns() data = get_data(filters) return columns, data def get_columns(): columns = [ { "fieldname": "lot_no", "fieldtype": "Link", "label": "Lot No", "options": "Batch", "width": 150 }, { "fieldname": "department", "fieldtype": "Link", "label": "Department", "options": "Manufacturing Department", "width": 150 }, { "fieldname": "quality_name", "fieldtype": "Data", "label": "Quality Name", "width": 150 }, { "fieldname": "party_code", "fieldtype": "Link", "label": "Party Code", "options": "Supplier", "width": 150 }, { "fieldname": "supplier_name", "fieldtype": "Data", "label": "Party Name", "width": 200, 'fetch_from': 'party_code.supplier_name' }, { "fieldname": "design_no", "fieldtype": "Link", "label": "Design No", "options": "Design", "width": 150 }, { "fieldname": "design_name", "fieldtype": "Data", "label": "Design Name", "width": 150 }, { "fieldname": "in_qty", "fieldtype": "Float", "label": "In Qty", "width": 100 }, { "fieldname": "out_qty", "fieldtype": "Float", "label": "Out Qty", "width": 100 }, { "fieldname": "shortage", "fieldtype": "Float", "label": "Over / Shortage", "width": 120 }, { "fieldname": "shortage_per", "fieldtype": "Float", "label": "Over / Shortage (%)", "width": 140 } ] return columns def get_data(filters): lst = [] query = """select tpi.lot_no as lot_no from `tabProcess Order` as tp inner join `tabProcess Order Item` as tpi on tp.name = tpi.parent where tpi.lot_no is not null and tp.docstatus = 1""" if filters.get('from_date'): query += " and tp.date >= '{0}'".format(filters.get('from_date')) if filters.get('to_date'): query += " and tp.date <= '{0}'".format(filters.get('to_date')) if filters.get('company'): query += " and tp.company = '{0}'".format(filters.get('company')) if filters.get('lot'): query += " and tpi.lot_no like '{0}'".format(filters.get('lot')) if filters.get('department'): query += " and tp.department = '{0}'".format(filters.get('department')) if filters.get('quality_code'): query += " and tpi.quality_code = '{0}'".format(filters.get('quality_code')) # query += """ group by tp.department,tpi.party_name,tpi.quality_name,tpi.design_no # order by tpi.lot_no,tp.department""" result = frappe.db.sql(query, as_dict=True) lot_lst = [] for r in result: if r['lot_no']: lot_no = str(r['lot_no'].split("-")[0]) lot_lst.append(lot_no) if lot_lst: for r in set(lot_lst): lot_like = "%" + r + "%" query = """select tpi.lot_no as lot_no, tp.department as department, tpi.party_name as party_code, ts.supplier_name as supplier_name, tpi.quality_name as quality_name, tpi.quality_code as quality_code, tp.process_name as process_name, tpi.design_no as design, d.design as design_name, sum(tpi.quantity) as in_qty, 0 as out_qty from `tabProcess Order` as tp left join `tabProcess Order Item` as tpi on tp.name = tpi.parent left join `tabSupplier` as ts on ts.name = tpi.party_name left join `tabDesign` as d on d.name = tpi.design_no where tpi.lot_no like '{0}' and tpi.lot_no is not null and tpi.party_name is not null and tp.docstatus = 1""".format(lot_like) if filters.get('from_date'): query += " and tp.date >= '{0}'".format(filters.get('from_date')) if filters.get('to_date'): query += " and tp.date <= '{0}'".format(filters.get('to_date')) if filters.get('company'): query += " and tp.company = '{0}'".format(filters.get('company')) if filters.get('lot'): query += " and tpi.lot_no like '{0}'".format(filters.get('lot')) if filters.get('department'): query += " and tp.department = '{0}'".format(filters.get('department')) if filters.get('quality_code'): query += " and tpi.quality_code = '{0}'".format(filters.get('quality_code')) query += """ group by tp.department,tpi.party_name,tpi.quality_name,tpi.design_no order by tpi.lot_no,tp.department""" result2 = frappe.db.sql(query, as_dict=True) for res in result2: query2 = """select sum(tpfi.quantity) as out_qty from `tabProcess Order` as tp left join `tabProcess Order Finish Item` as tpfi on tp.name = tpfi.parent where tpfi.lot_no like '{0}' and tp.department = '{1}' and tpfi.quality_code = '{2}' and tpfi.party_name = '{3}' and tp.docstatus = 1""".format(lot_like, res.department, res.quality_code, res.party_code) if filters.get('from_date'): query2 += " and tp.date >= '{0}'".format(filters.get('from_date')) if filters.get('to_date'): query2 += " and tp.date <= '{0}'".format(filters.get('to_date')) if filters.get('company'): query2 += " and tp.company = '{0}'".format(filters.get('company')) if res.design: query2 += " and tpfi.design_no = '{0}' ".format(res.design) else: query2 += " and tpfi.design_no is null" result3 = frappe.db.sql(query2, as_dict=True) if result3: if result3[0].out_qty: res['out_qty'] = result3[0].out_qty lst.append({ "lot_no": r, "department": res.department, "party_code": res.party_code, "supplier_name": res.supplier_name, "quality_name": res.quality_name, "process_name": res.process_name, "design_no": res.design, "design_name": res.design_name, "in_qty": res.in_qty, "out_qty": res.out_qty, "shortage": res.out_qty - res.in_qty, "shortage_per": ((res.out_qty - res.in_qty) * 100) / res.in_qty if res.in_qty else 0 }) return lst
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29941, 29892, 8437, 5834, 322, 17737, 29560, 13, 29937, 1152, 19405, 2472, 29892, 3113, 1074, 19405, 29889, 3945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 5215, 5227, 4798, 13, 13, 1753, 6222, 29898, 26705, 29922, 8516, 1125, 13, 12, 13099, 353, 679, 29918, 13099, 580, 13, 12, 1272, 353, 679, 29918, 1272, 29898, 26705, 29897, 13, 12, 2457, 4341, 29892, 848, 13, 13, 1753, 679, 29918, 13099, 7295, 13, 12, 13099, 353, 518, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 8276, 29918, 1217, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 6595, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 29931, 327, 1939, 613, 13, 12, 12, 12, 29908, 6768, 1115, 376, 23145, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 311, 8076, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 6595, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 8498, 442, 358, 613, 13, 12, 12, 12, 29908, 6768, 1115, 376, 2517, 9765, 3864, 10317, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 29567, 29918, 978, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 1469, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 24399, 537, 4408, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 22633, 29918, 401, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 6595, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 7439, 29891, 5920, 613, 13, 12, 12, 12, 29908, 6768, 1115, 376, 20182, 4926, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 19303, 4926, 29918, 978, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 1469, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 7439, 29891, 4408, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29906, 29900, 29900, 29892, 13, 12, 12, 12, 29915, 9155, 29918, 3166, 2396, 525, 22633, 29918, 401, 29889, 19303, 4926, 29918, 978, 29915, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 13892, 29918, 1217, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 6595, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 4002, 647, 1939, 613, 13, 12, 12, 12, 29908, 6768, 1115, 376, 4002, 647, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 13892, 29918, 978, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 1469, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 4002, 647, 4408, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29945, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 262, 29918, 29939, 1017, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 11031, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 797, 660, 1017, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29900, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 449, 29918, 29939, 1017, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 11031, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 3744, 660, 1017, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29900, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 12759, 482, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 11031, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 3563, 847, 13899, 482, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29906, 29900, 13, 12, 12, 1118, 13, 12, 12, 29912, 13, 12, 12, 12, 29908, 2671, 978, 1115, 376, 12759, 482, 29918, 546, 613, 13, 12, 12, 12, 29908, 2671, 1853, 1115, 376, 11031, 613, 13, 12, 12, 12, 29908, 1643, 1115, 376, 3563, 847, 13899, 482, 313, 10997, 613, 13, 12, 12, 12, 29908, 2103, 1115, 29871, 29896, 29946, 29900, 13, 12, 12, 29913, 13, 12, 29962, 13, 12, 2457, 4341, 13, 13, 1753, 679, 29918, 1272, 29898, 26705, 1125, 13, 12, 20155, 353, 5159, 13, 12, 1972, 353, 9995, 2622, 29871, 13, 12, 12, 12, 29873, 1631, 29889, 8276, 29918, 1217, 408, 3287, 29918, 1217, 13, 12, 12, 12, 3166, 421, 3891, 7032, 8170, 29952, 408, 260, 29886, 13, 12, 12, 12, 3993, 5988, 421, 3891, 7032, 8170, 10976, 29952, 408, 260, 1631, 373, 260, 29886, 29889, 978, 353, 260, 1631, 29889, 3560, 12, 12, 12, 12, 13, 12, 12, 12, 3062, 260, 1631, 29889, 8276, 29918, 1217, 338, 451, 1870, 322, 260, 29886, 29889, 1514, 4882, 353, 29871, 29896, 15945, 29908, 13, 12, 361, 18094, 29889, 657, 877, 3166, 29918, 1256, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 1256, 6736, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 3166, 29918, 1256, 8785, 13, 12, 361, 18094, 29889, 657, 877, 517, 29918, 1256, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 1256, 5277, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 517, 29918, 1256, 8785, 13, 12, 361, 18094, 29889, 657, 877, 14518, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 14518, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 14518, 8785, 13, 12, 361, 18094, 29889, 657, 877, 8276, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 1631, 29889, 8276, 29918, 1217, 763, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 8276, 8785, 13, 12, 361, 18094, 29889, 657, 877, 311, 8076, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 311, 8076, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 311, 8076, 8785, 13, 12, 361, 18094, 29889, 657, 877, 29567, 29918, 401, 29374, 13, 12, 12, 1972, 4619, 376, 322, 260, 1631, 29889, 29567, 29918, 401, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 29567, 29918, 401, 8785, 13, 12, 29937, 2346, 4619, 9995, 2318, 491, 260, 29886, 29889, 311, 8076, 29892, 29873, 1631, 29889, 22633, 29918, 978, 29892, 29873, 1631, 29889, 29567, 29918, 978, 29892, 29873, 1631, 29889, 13892, 29918, 1217, 13, 12, 29937, 29871, 12, 12, 12, 12, 12, 2098, 491, 260, 1631, 29889, 8276, 29918, 1217, 29892, 9392, 29889, 311, 8076, 15945, 29908, 13, 12, 2914, 353, 5227, 4798, 29889, 2585, 29889, 2850, 29898, 1972, 29892, 408, 29918, 8977, 29922, 5574, 29897, 13, 12, 8276, 29918, 20155, 353, 5159, 13, 12, 1454, 364, 297, 1121, 29901, 13, 12, 12, 361, 364, 1839, 8276, 29918, 1217, 2033, 29901, 13, 12, 12, 12, 8276, 29918, 1217, 353, 851, 29898, 29878, 1839, 8276, 29918, 1217, 13359, 5451, 703, 29899, 1159, 29961, 29900, 2314, 13, 12, 12, 12, 8276, 29918, 20155, 29889, 4397, 29898, 8276, 29918, 1217, 29897, 13, 12, 361, 3287, 29918, 20155, 29901, 13, 12, 12, 1454, 364, 297, 731, 29898, 8276, 29918, 20155, 1125, 13, 12, 12, 12, 8276, 29918, 4561, 353, 11860, 29908, 718, 364, 718, 11860, 29908, 13, 12, 12, 12, 1972, 353, 9995, 2622, 29871, 13, 12, 12, 12, 12, 12, 29873, 1631, 29889, 8276, 29918, 1217, 408, 3287, 29918, 1217, 29892, 13, 12, 12, 12, 12, 12, 9392, 29889, 311, 8076, 408, 14311, 29892, 13, 12, 12, 12, 12, 12, 29873, 1631, 29889, 22633, 29918, 978, 408, 6263, 29918, 401, 29892, 13, 12, 12, 12, 12, 12, 1372, 29889, 19303, 4926, 29918, 978, 408, 1462, 4926, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29873, 1631, 29889, 29567, 29918, 978, 408, 11029, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29873, 1631, 29889, 29567, 29918, 401, 408, 11029, 29918, 401, 29892, 13, 12, 12, 12, 12, 12, 9392, 29889, 5014, 29918, 978, 408, 1889, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29873, 1631, 29889, 13892, 29918, 1217, 408, 2874, 29892, 13, 12, 12, 12, 12, 12, 29881, 29889, 13892, 408, 2874, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 2083, 29898, 29873, 1631, 29889, 22640, 29897, 408, 297, 29918, 29939, 1017, 29892, 13, 12, 12, 12, 12, 12, 29900, 408, 714, 29918, 29939, 1017, 13, 12, 12, 12, 12, 12, 3166, 421, 3891, 7032, 8170, 29952, 408, 260, 29886, 13, 12, 12, 12, 12, 12, 1563, 5988, 421, 3891, 7032, 8170, 10976, 29952, 408, 260, 1631, 373, 260, 29886, 29889, 978, 353, 260, 1631, 29889, 3560, 12, 12, 12, 12, 13, 12, 12, 12, 12, 12, 1563, 5988, 421, 3891, 20182, 4926, 29952, 408, 18696, 373, 18696, 29889, 978, 353, 260, 1631, 29889, 22633, 29918, 978, 13, 12, 12, 12, 12, 12, 1563, 5988, 421, 3891, 4002, 647, 29952, 408, 270, 373, 270, 29889, 978, 353, 260, 1631, 29889, 13892, 29918, 1217, 13, 12, 12, 12, 12, 12, 3062, 260, 1631, 29889, 8276, 29918, 1217, 763, 22372, 29900, 10162, 322, 260, 1631, 29889, 8276, 29918, 1217, 338, 451, 1870, 322, 260, 1631, 29889, 22633, 29918, 978, 338, 451, 1870, 322, 260, 29886, 29889, 1514, 4882, 353, 29871, 29896, 15945, 1642, 4830, 29898, 8276, 29918, 4561, 29897, 13, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 3166, 29918, 1256, 29374, 13, 12, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 1256, 6736, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 3166, 29918, 1256, 8785, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 517, 29918, 1256, 29374, 13, 12, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 1256, 5277, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 517, 29918, 1256, 8785, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 14518, 29374, 13, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 14518, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 14518, 8785, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 8276, 29374, 13, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 1631, 29889, 8276, 29918, 1217, 763, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 8276, 8785, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 311, 8076, 29374, 13, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 29886, 29889, 311, 8076, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 311, 8076, 8785, 13, 12, 12, 12, 361, 18094, 29889, 657, 877, 29567, 29918, 401, 29374, 13, 12, 12, 12, 12, 1972, 4619, 376, 322, 260, 1631, 29889, 29567, 29918, 401, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 29567, 29918, 401, 8785, 13, 13, 12, 12, 12, 1972, 4619, 9995, 2318, 491, 260, 29886, 29889, 311, 8076, 29892, 29873, 1631, 29889, 22633, 29918, 978, 29892, 29873, 1631, 29889, 29567, 29918, 978, 29892, 29873, 1631, 29889, 13892, 29918, 1217, 13, 12, 12, 12, 12, 12, 2098, 491, 260, 1631, 29889, 8276, 29918, 1217, 29892, 9392, 29889, 311, 8076, 15945, 29908, 13, 12, 12, 12, 2914, 29906, 353, 5227, 4798, 29889, 2585, 29889, 2850, 29898, 1972, 29892, 408, 29918, 8977, 29922, 5574, 29897, 13, 12, 12, 12, 1454, 620, 297, 1121, 29906, 29901, 13, 12, 12, 12, 12, 1972, 29906, 353, 9995, 2622, 29871, 12, 12, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12, 2083, 29898, 9392, 7241, 29889, 22640, 29897, 408, 714, 29918, 29939, 1017, 13, 12, 12, 12, 12, 12, 12, 12, 3166, 421, 3891, 7032, 8170, 29952, 408, 260, 29886, 13, 12, 12, 12, 12, 12, 12, 12, 1563, 5988, 421, 3891, 7032, 8170, 4231, 728, 10976, 29952, 408, 260, 29886, 7241, 373, 260, 29886, 29889, 978, 353, 260, 29886, 7241, 29889, 3560, 13, 12, 12, 12, 12, 12, 12, 12, 3062, 260, 29886, 7241, 29889, 8276, 29918, 1217, 763, 22372, 29900, 10162, 29871, 13, 12, 12, 12, 12, 12, 12, 12, 392, 260, 29886, 29889, 311, 8076, 353, 22372, 29896, 10162, 29871, 13, 12, 12, 12, 12, 12, 12, 12, 392, 260, 29886, 7241, 29889, 29567, 29918, 401, 353, 22372, 29906, 10162, 13, 12, 12, 12, 12, 12, 12, 12, 392, 260, 29886, 7241, 29889, 22633, 29918, 978, 353, 22372, 29941, 10162, 12, 12, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 12, 12, 12, 392, 260, 29886, 29889, 1514, 4882, 353, 29871, 29896, 15945, 1642, 4830, 29898, 8276, 29918, 4561, 29892, 620, 29889, 311, 8076, 29892, 620, 29889, 29567, 29918, 401, 29892, 620, 29889, 22633, 29918, 401, 29897, 13, 13, 12, 12, 12, 12, 361, 18094, 29889, 657, 877, 3166, 29918, 1256, 29374, 13, 12, 12, 12, 12, 12, 1972, 29906, 4619, 376, 322, 260, 29886, 29889, 1256, 6736, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 3166, 29918, 1256, 8785, 13, 12, 12, 12, 12, 361, 18094, 29889, 657, 877, 517, 29918, 1256, 29374, 13, 12, 12, 12, 12, 12, 1972, 29906, 4619, 376, 322, 260, 29886, 29889, 1256, 5277, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 517, 29918, 1256, 8785, 13, 12, 12, 12, 12, 361, 18094, 29889, 657, 877, 14518, 29374, 13, 12, 12, 12, 12, 12, 1972, 29906, 4619, 376, 322, 260, 29886, 29889, 14518, 353, 22372, 29900, 10162, 1642, 4830, 29898, 26705, 29889, 657, 877, 14518, 8785, 13, 12, 12, 12, 12, 361, 620, 29889, 13892, 29901, 13, 12, 12, 12, 12, 12, 1972, 29906, 4619, 376, 322, 260, 29886, 7241, 29889, 13892, 29918, 1217, 353, 22372, 29900, 10162, 11393, 4830, 29898, 690, 29889, 13892, 29897, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 1972, 29906, 4619, 376, 322, 260, 29886, 7241, 29889, 13892, 29918, 1217, 338, 1870, 29908, 13, 13, 12, 12, 12, 12, 2914, 29941, 353, 5227, 4798, 29889, 2585, 29889, 2850, 29898, 1972, 29906, 29892, 408, 29918, 8977, 29922, 5574, 29897, 13, 12, 12, 12, 12, 361, 1121, 29941, 29901, 13, 12, 12, 12, 12, 12, 361, 1121, 29941, 29961, 29900, 1822, 449, 29918, 29939, 1017, 29901, 13, 12, 12, 12, 12, 12, 12, 690, 1839, 449, 29918, 29939, 1017, 2033, 353, 1121, 29941, 29961, 29900, 1822, 449, 29918, 29939, 1017, 13, 12, 12, 12, 12, 20155, 29889, 4397, 3319, 13, 12, 12, 12, 12, 12, 29908, 8276, 29918, 1217, 1115, 364, 29892, 13, 12, 12, 12, 12, 12, 29908, 311, 8076, 1115, 620, 29889, 311, 8076, 29892, 13, 12, 12, 12, 12, 12, 29908, 22633, 29918, 401, 1115, 620, 29889, 22633, 29918, 401, 29892, 13, 12, 12, 12, 12, 12, 29908, 19303, 4926, 29918, 978, 1115, 620, 29889, 19303, 4926, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29908, 29567, 29918, 978, 1115, 620, 29889, 29567, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29908, 5014, 29918, 978, 1115, 620, 29889, 5014, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29908, 13892, 29918, 1217, 1115, 620, 29889, 13892, 29892, 13, 12, 12, 12, 12, 12, 29908, 13892, 29918, 978, 1115, 620, 29889, 13892, 29918, 978, 29892, 13, 12, 12, 12, 12, 12, 29908, 262, 29918, 29939, 1017, 1115, 620, 29889, 262, 29918, 29939, 1017, 29892, 13, 12, 12, 12, 12, 12, 29908, 449, 29918, 29939, 1017, 1115, 620, 29889, 449, 29918, 29939, 1017, 29892, 13, 12, 12, 12, 12, 12, 29908, 12759, 482, 1115, 620, 29889, 449, 29918, 29939, 1017, 448, 620, 29889, 262, 29918, 29939, 1017, 29892, 13, 12, 12, 12, 12, 12, 29908, 12759, 482, 29918, 546, 1115, 5135, 690, 29889, 449, 29918, 29939, 1017, 448, 620, 29889, 262, 29918, 29939, 1017, 29897, 334, 29871, 29896, 29900, 29900, 29897, 847, 620, 29889, 262, 29918, 29939, 1017, 565, 620, 29889, 262, 29918, 29939, 1017, 1683, 29871, 29900, 13, 12, 12, 12, 12, 1800, 13, 12, 12, 2457, 24471, 2 ]
check_data_integrity/__init__.py
mpmuc84/helper-scripts
4
79200
""" This package contains the modules for both the script checking for data inconsistencies in an opencast instance as well as for the script for fixing some of those inconsistencies and modules shared by both scripts. """
[ 1, 9995, 13, 4013, 3577, 3743, 278, 10585, 363, 1716, 278, 2471, 8454, 363, 848, 22435, 8244, 2478, 297, 385, 1722, 4384, 13, 8758, 408, 1532, 408, 363, 278, 2471, 363, 27826, 777, 310, 1906, 22435, 8244, 2478, 322, 10585, 7258, 491, 1716, 12078, 29889, 13, 15945, 29908, 2 ]
relancer-exp/original_notebooks/wenruliu_adult-income-dataset/decision-tree-f1-98-acc-99-auc-99.py
Chenguang-Zhu/relancer
1
91073
#!/usr/bin/env python # coding: utf-8 # # Import Base Packages # In[ ]: import pandas as pd import numpy as np import warnings warnings.filterwarnings('ignore') # # Interface function to feature engineering data # In[ ]: from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import PolynomialFeatures column_names = [ 'age', 'workclass', 'fnlwgt', 'education', 'educational-num', 'marital-status', 'occupation', 'relationship', 'race', 'gender', 'capital-gain', 'capital-loss', 'hours-per-week', 'native-country', 'income' ] columns_to_encoding = [ 'workclass', 'marital-status', 'occupation', 'relationship', 'race', 'gender' ] columns_to_normalize = [ 'age', 'educational-num', 'hours-per-week', 'capital-gain', 'capital-loss' ] le = LabelEncoder() scaler = StandardScaler() pl = PolynomialFeatures(2, include_bias=False) def feature_engineering(filename, train=True): df = pd.read_csv(filename, index_col=False) df.drop(['fnlwgt', 'education', 'native-country'], axis=1, inplace=True) df = pd.get_dummies(df, columns=columns_to_encoding) df["income"] = le.fit_transform(df['income']) if train: X_temp = pl.fit_transform(df[columns_to_normalize]) X_temp = scaler.fit_transform(X_temp) df.drop(columns_to_normalize, axis=1, inplace=True) X_train = np.hstack((df.values, X_temp)) y_train = df['income'] columns_names = pl.get_feature_names(df.columns) return np.hstack((df.columns.values, columns_names)), X_train, y_train else: X_temp = pl.transform(df[columns_to_normalize]) X_temp = scaler.transform(X_temp) df.drop(columns_to_normalize, axis=1, inplace=True) X_test = np.hstack((df.values, X_temp)) y_test = df['income'] columns_names = pl.get_feature_names(df.columns) return np.hstack((df.columns.values, columns_names)), X_test, y_test # # Load Data # In[ ]: columns_names, X, y = feature_engineering("../../../input/wenruliu_adult-income-dataset/adult.csv", train=True) # In[ ]: from sklearn.model_selection import train_test_split def rmnan(X, y): X_, y_ = [], [] for x, yt in zip(X, y): if np.isnan(x).any() or np.isnan(yt).any(): continue X_.append(x) y_.append(yt) return np.array(X_), np.array(y_) X, y = rmnan(X, y) # In[ ]: X, X_test, y, y_test = train_test_split(X, y, test_size=0.30, random_state=42) y.shape, y_test.shape # # Find Best number of components to PCA # In[ ]: from sklearn.tree import DecisionTreeClassifier from sklearn.decomposition import PCA from sklearn.model_selection import RandomizedSearchCV from sklearn.metrics import make_scorer from sklearn.metrics import fbeta_score from sklearn.metrics import accuracy_score from sklearn.model_selection import RepeatedStratifiedKFold param_distribution = { 'max_depth': np.arange(1, 15), } scoring = { 'Accuracy': make_scorer(accuracy_score), 'F1_Score': make_scorer(fbeta_score, beta=1, average='micro'), } # In[ ]: result = [] kf = RepeatedStratifiedKFold(n_splits=2, n_repeats=2) for fold, (train_index, test_index) in enumerate(kf.split(X, y)): X_tr, X_tst = X[train_index], X[test_index] y_tr, y_tst = y[train_index], y[test_index] for i in range(1, 20): # train pca = PCA(i) X_t = pca.fit_transform(X_tr) search_cv = RandomizedSearchCV(DecisionTreeClassifier(), param_distribution, scoring=scoring, n_jobs=-1, cv=RepeatedStratifiedKFold(n_splits=2, n_repeats=2), refit='F1_Score') search_cv.fit(X_t, y_tr) model = search_cv.best_estimator_ # test X_t = pca.transform(X_tst) y_pred = model.predict(X_t) # model evaluation f1 = fbeta_score(y_tst, y_pred, beta=1) acc = accuracy_score(y_tst, y_pred) print(f"fold: {fold} - cp:{i} train: {search_cv.best_score_} test: f1={f1}, acc={acc}") result.append((fold, i, acc, f1, pca, model)) # In[ ]: best_f1 = 0 best_model = None for fold, n, acc, f1, pca, model in result: if best_f1 < f1: best_f1 = f1 best_model=(fold, n, acc, f1, pca, model) pca_components = best_model[1] pca_components # # Get best model with best pca_components number # In[ ]: result, metrics_ = [], [] kf = RepeatedStratifiedKFold(n_splits=10, n_repeats=1) for fold, (train_index, test_index) in enumerate(kf.split(X, y)): X_train, X_test = X[train_index], X[test_index] y_train, y_test = y[train_index], y[test_index] # train pca = PCA(pca_components) X_t = pca.fit_transform(X_train) search_cv = RandomizedSearchCV(DecisionTreeClassifier(), param_distribution, scoring=scoring, n_jobs=-1, cv=RepeatedStratifiedKFold(n_splits=10, n_repeats=1), refit='F1_Score') search_cv.fit(X_t, y_train) model = search_cv.best_estimator_ # test X_t = pca.transform(X_test) y_pred = model.predict(X_t) # model evaluation f1 = fbeta_score(y_test, y_pred, beta=1) acc = accuracy_score(y_test, y_pred) print(f"fold: {fold} - cp:{pca_components} train: {search_cv.best_score_} test: f1={f1}, acc={acc}") result.append((X_train, y_train, X_test, y_test, fold, i, acc, f1, pca, model)) metrics_.append((f1, acc)) # In[ ]: best_f1 = 0 best_model = None for X_train, y_train, X_test, y_test, fold, n, acc, f1, pca, model in result: if best_f1 < f1: best_f1 = f1 best_model=(X_train, y_train, X_test, y_test, fold, n, acc, f1, pca, model) X_train, y_train, X_test, y_test = X, y, X_test, y_test #best_model[:4] # # Analyse Model Result # In[ ]: from sklearn import metrics pca, model = best_model[-2], best_model[-1] probs = model.predict_proba(pca.transform(X_test)) preds = probs[:,1] fpr, tpr, threshold = metrics.roc_curve(y_test, preds) roc_auc = metrics.auc(fpr, tpr) # method I: plt import matplotlib.pyplot as plt plt.title('Receiver Operating Characteristic') plt.plot(fpr, tpr, 'b', label = 'AUC = %0.2f' % roc_auc) plt.legend(loc = 'lower right') plt.plot([0, 1], [0, 1],'r--') plt.xlim([0, 1]) plt.ylim([0, 1]) plt.ylabel('True Positive Rate') plt.xlabel('False Positive Rate') print() # In[ ]: f1_r, acc_r = [], [] for f1, acc in metrics_: f1_r.append(f1) acc_r.append(acc) f1_r, acc_r = np.array(f1_r), np.array(acc_r) l = f1_r.shape[0] plt.title(f'F1 Score in Folds(PCA components = {pca_components})') plt.plot(range(l), f1_r, 'r', label = 'F1 Score') plt.plot(range(l), acc_r, 'b', label = 'Accuracy') plt.legend(loc = 'lower right') plt.xticks(range(l)) plt.xlim([0, l - 1]) plt.ylim([0.95, 1]) plt.ylabel('F1 Score') plt.xlabel('Fold') plt.grid() print() # ## Plot feature importances # In[ ]: def plot_feature_importances(clf, X_train, y_train=None, top_n=10, figsize=(8,8), print_table=False, title="Feature Importances"): # https://www.kaggle.com/grfiv4/plotting-feature-importances __name__ = "plot_feature_importances" import pandas as pd import numpy as np import matplotlib.pyplot as plt X_train = pd.DataFrame(data=X_train, columns=[f"PC{i}" for i in range(1, X_train.shape[1] + 1)]) feat_imp = pd.DataFrame({'importance':clf.feature_importances_}) feat_imp['feature'] = X_train.columns feat_imp.sort_values(by='importance', ascending=False, inplace=True) feat_imp = feat_imp.iloc[:top_n] feat_imp.sort_values(by='importance', inplace=True) feat_imp = feat_imp.set_index('feature', drop=True) feat_imp.plot.barh(title=title, figsize=figsize) plt.xlabel('Feature Importance Score') print() if print_table: from IPython.display import display print("Top {} features in descending order of importance".format(top_n)) print(feat_imp.sort_values(by='importance', ascending=False)) return feat_imp pca, clf = best_model[-2], best_model[-1] feature_importance = plot_feature_importances(clf, pca.transform(X_train), top_n=X_train.shape[1], title=clf.__class__.__name__) # ## Get Features Used to Generate PCA Components # In[ ]: # https://stackoverflow.com/questions/22348668/pca-decomposition-with-python-features-relevances pca, clf = best_model[-2], best_model[-1] index_components = [int(x[2:]) for x in feature_importance.index.values] def features_used_to_generate_pca_components(index_components, pca, clf, columns_names): for i in index_components: index_features = np.abs(pca.components_[i - 1]).argsort()[:4] features = columns_names[index_features] print(f'PC{i}') print(f'Features:') for f in features: print("\t" + f) print() features_used_to_generate_pca_components(index_components, pca, clf, columns_names) # ## Confusion Matrix # In[ ]: from sklearn.metrics import confusion_matrix pca, clf = best_model[-2], best_model[-1] y_pred = clf.predict(pca.transform(X_test)) cm = confusion_matrix(y_test, y_pred) cm # In[ ]: import itertools def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): """ This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. """ if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization') print(cm) plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) print() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=45) plt.yticks(tick_marks, classes) fmt = '.2f' if normalize else 'd' thresh = cm.max() / 2. for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])): plt.text(j, i, format(cm[i, j], fmt), horizontalalignment="center", color="white" if cm[i, j] > thresh else "black") plt.ylabel('True label') plt.xlabel('Predicted label') plt.tight_layout() plot_confusion_matrix(cm, [0, 1], True) # ## Classification Report # In[ ]: from sklearn.metrics import classification_report print(classification_report(y_test, y_pred)) # # Save Best Model # In[ ]: from sklearn.tree import export_graphviz # Export as dot file export_graphviz(best_model[-1], out_file='tree.dot', class_names = [">= 50K", "< 50K"], rounded = True, proportion = False, precision = 2, filled = True) # Convert to png using system command (requires Graphviz) from subprocess import call call(['dot', '-Tpng', 'tree.dot', '-o', 'tree.png', '-Gdpi=600']) # Display in jupyter notebook from IPython.display import Image Image(filename = 'tree.png') # In[ ]: from sklearn.externals import joblib joblib.dump(best_model, 'lgr.joblib')
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 396, 16032, 7399, 18744, 1179, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 13, 5215, 18116, 13, 25442, 886, 29889, 4572, 25442, 886, 877, 17281, 1495, 13, 13, 13, 29937, 396, 25796, 740, 304, 4682, 21639, 848, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 15796, 8566, 6119, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 2043, 9222, 8263, 3698, 13, 13, 4914, 29918, 7039, 353, 518, 525, 482, 742, 525, 1287, 1990, 742, 525, 9144, 29880, 29893, 4141, 742, 525, 287, 1682, 362, 742, 525, 287, 1682, 1288, 29899, 1949, 742, 525, 3034, 2410, 29899, 4882, 742, 525, 26601, 742, 525, 2674, 800, 4034, 742, 525, 25525, 742, 525, 26098, 742, 525, 5030, 2410, 29899, 29887, 475, 742, 525, 5030, 2410, 29899, 6758, 742, 525, 29882, 2470, 29899, 546, 29899, 18448, 742, 525, 11487, 29899, 13509, 742, 525, 262, 2763, 29915, 4514, 29871, 13, 13, 13099, 29918, 517, 29918, 22331, 353, 518, 525, 1287, 1990, 742, 525, 3034, 2410, 29899, 4882, 742, 525, 26601, 742, 525, 2674, 800, 4034, 742, 525, 25525, 742, 525, 26098, 29915, 4514, 29871, 13, 13, 13099, 29918, 517, 29918, 8945, 675, 353, 518, 525, 482, 742, 525, 287, 1682, 1288, 29899, 1949, 742, 525, 29882, 2470, 29899, 546, 29899, 18448, 742, 525, 5030, 2410, 29899, 29887, 475, 742, 525, 5030, 2410, 29899, 6758, 29915, 4514, 29871, 13, 13, 280, 353, 15796, 8566, 6119, 580, 13, 19529, 261, 353, 10117, 29636, 261, 580, 13, 572, 353, 2043, 9222, 8263, 3698, 29898, 29906, 29892, 3160, 29918, 29890, 3173, 29922, 8824, 29897, 13, 13, 1753, 4682, 29918, 10599, 3241, 29898, 9507, 29892, 7945, 29922, 5574, 1125, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 9507, 29892, 2380, 29918, 1054, 29922, 8824, 29897, 308, 13, 1678, 4489, 29889, 8865, 18959, 9144, 29880, 29893, 4141, 742, 525, 287, 1682, 362, 742, 525, 11487, 29899, 13509, 7464, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 1678, 4489, 353, 10518, 29889, 657, 29918, 29881, 23824, 583, 29898, 2176, 29892, 4341, 29922, 13099, 29918, 517, 29918, 22331, 29897, 13, 1678, 4489, 3366, 262, 2763, 3108, 353, 454, 29889, 9202, 29918, 9067, 29898, 2176, 1839, 262, 2763, 11287, 13, 1678, 565, 7945, 29901, 13, 4706, 1060, 29918, 7382, 353, 715, 29889, 9202, 29918, 9067, 29898, 2176, 29961, 13099, 29918, 517, 29918, 8945, 675, 2314, 13, 4706, 1060, 29918, 7382, 353, 8716, 261, 29889, 9202, 29918, 9067, 29898, 29990, 29918, 7382, 29897, 13, 4706, 4489, 29889, 8865, 29898, 13099, 29918, 517, 29918, 8945, 675, 29892, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 1060, 29918, 14968, 353, 7442, 29889, 29882, 1429, 3552, 2176, 29889, 5975, 29892, 1060, 29918, 7382, 876, 13, 4706, 343, 29918, 14968, 353, 4489, 1839, 262, 2763, 2033, 13, 4706, 4341, 29918, 7039, 353, 715, 29889, 657, 29918, 14394, 29918, 7039, 29898, 2176, 29889, 13099, 29897, 13, 4706, 736, 7442, 29889, 29882, 1429, 3552, 2176, 29889, 13099, 29889, 5975, 29892, 4341, 29918, 7039, 8243, 1060, 29918, 14968, 29892, 343, 29918, 14968, 13, 1678, 1683, 29901, 13, 4706, 1060, 29918, 7382, 353, 715, 29889, 9067, 29898, 2176, 29961, 13099, 29918, 517, 29918, 8945, 675, 2314, 13, 4706, 1060, 29918, 7382, 353, 8716, 261, 29889, 9067, 29898, 29990, 29918, 7382, 29897, 13, 4706, 4489, 29889, 8865, 29898, 13099, 29918, 517, 29918, 8945, 675, 29892, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 29897, 13, 4706, 1060, 29918, 1688, 353, 7442, 29889, 29882, 1429, 3552, 2176, 29889, 5975, 29892, 1060, 29918, 7382, 876, 13, 4706, 343, 29918, 1688, 353, 4489, 1839, 262, 2763, 2033, 13, 4706, 4341, 29918, 7039, 353, 715, 29889, 657, 29918, 14394, 29918, 7039, 29898, 2176, 29889, 13099, 29897, 13, 4706, 736, 7442, 29889, 29882, 1429, 3552, 2176, 29889, 13099, 29889, 5975, 29892, 4341, 29918, 7039, 8243, 1060, 29918, 1688, 29892, 343, 29918, 1688, 13, 13, 13, 29937, 396, 16012, 3630, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 13099, 29918, 7039, 29892, 1060, 29892, 343, 353, 4682, 29918, 10599, 3241, 703, 21546, 6995, 2080, 29914, 15556, 29878, 352, 5871, 29918, 328, 499, 29899, 262, 2763, 29899, 24713, 29914, 328, 499, 29889, 7638, 613, 7945, 29922, 5574, 29897, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 1753, 20241, 13707, 29898, 29990, 29892, 343, 1125, 13, 1678, 1060, 3383, 343, 29918, 353, 19997, 5159, 268, 13, 1678, 363, 921, 29892, 343, 29873, 297, 14319, 29898, 29990, 29892, 343, 1125, 462, 13, 4706, 565, 7442, 29889, 275, 13707, 29898, 29916, 467, 1384, 580, 470, 7442, 29889, 275, 13707, 29898, 3637, 467, 1384, 7295, 13, 9651, 6773, 13, 4706, 1060, 5396, 4397, 29898, 29916, 29897, 13, 4706, 343, 5396, 4397, 29898, 3637, 29897, 308, 13, 1678, 736, 7442, 29889, 2378, 29898, 29990, 29918, 511, 7442, 29889, 2378, 29898, 29891, 19925, 13, 13, 29990, 29892, 343, 353, 20241, 13707, 29898, 29990, 29892, 343, 29897, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 29990, 29892, 1060, 29918, 1688, 29892, 343, 29892, 343, 29918, 1688, 353, 7945, 29918, 1688, 29918, 5451, 29898, 29990, 29892, 343, 29892, 1243, 29918, 2311, 29922, 29900, 29889, 29941, 29900, 29892, 4036, 29918, 3859, 29922, 29946, 29906, 29897, 13, 29891, 29889, 12181, 29892, 343, 29918, 1688, 29889, 12181, 13, 13, 13, 29937, 396, 10987, 6407, 1353, 310, 7117, 304, 349, 5454, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 8336, 1053, 3826, 2459, 9643, 2385, 3709, 13, 3166, 2071, 19668, 29889, 311, 510, 3283, 1053, 349, 5454, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 16968, 1891, 7974, 15633, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 1207, 29918, 1557, 9386, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 285, 3571, 29918, 13628, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 13600, 29918, 13628, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 830, 412, 630, 5015, 271, 2164, 29968, 29943, 1025, 13, 13, 3207, 29918, 27691, 353, 426, 525, 3317, 29918, 19488, 2396, 7442, 29889, 279, 927, 29898, 29896, 29892, 29871, 29896, 29945, 511, 500, 29871, 13, 13, 1557, 8253, 353, 426, 525, 7504, 332, 4135, 2396, 1207, 29918, 1557, 9386, 29898, 562, 2764, 4135, 29918, 13628, 511, 525, 29943, 29896, 29918, 20097, 2396, 1207, 29918, 1557, 9386, 29898, 29888, 3571, 29918, 13628, 29892, 21762, 29922, 29896, 29892, 6588, 2433, 29885, 2357, 5477, 500, 29871, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 2914, 353, 5159, 13, 29895, 29888, 353, 830, 412, 630, 5015, 271, 2164, 29968, 29943, 1025, 29898, 29876, 29918, 23579, 1169, 29922, 29906, 29892, 302, 29918, 276, 412, 1446, 29922, 29906, 29897, 13, 1454, 900, 29881, 29892, 313, 14968, 29918, 2248, 29892, 1243, 29918, 2248, 29897, 297, 26985, 29898, 29895, 29888, 29889, 5451, 29898, 29990, 29892, 343, 22164, 13, 1678, 1060, 29918, 509, 29892, 1060, 29918, 29873, 303, 353, 1060, 29961, 14968, 29918, 2248, 1402, 1060, 29961, 1688, 29918, 2248, 29962, 13, 1678, 343, 29918, 509, 29892, 343, 29918, 29873, 303, 353, 343, 29961, 14968, 29918, 2248, 1402, 343, 29961, 1688, 29918, 2248, 29962, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 29871, 29906, 29900, 1125, 13, 4706, 396, 7945, 13, 4706, 282, 1113, 353, 349, 5454, 29898, 29875, 29897, 13, 4706, 1060, 29918, 29873, 353, 282, 1113, 29889, 9202, 29918, 9067, 29898, 29990, 29918, 509, 29897, 13, 4706, 2740, 29918, 11023, 353, 16968, 1891, 7974, 15633, 29898, 6185, 2459, 9643, 2385, 3709, 3285, 1828, 29918, 27691, 29892, 26654, 29922, 1557, 8253, 29892, 302, 29918, 9057, 29879, 10457, 29896, 29892, 13850, 29922, 1123, 412, 630, 5015, 271, 2164, 29968, 29943, 1025, 29898, 29876, 29918, 23579, 1169, 29922, 29906, 29892, 302, 29918, 276, 412, 1446, 29922, 29906, 511, 2143, 277, 2433, 29943, 29896, 29918, 20097, 1495, 29871, 13, 4706, 2740, 29918, 11023, 29889, 9202, 29898, 29990, 29918, 29873, 29892, 343, 29918, 509, 29897, 13, 4706, 1904, 353, 2740, 29918, 11023, 29889, 13318, 29918, 342, 326, 1061, 29918, 308, 13, 13, 4706, 396, 1243, 13, 4706, 1060, 29918, 29873, 353, 282, 1113, 29889, 9067, 29898, 29990, 29918, 29873, 303, 29897, 13, 4706, 343, 29918, 11965, 353, 1904, 29889, 27711, 29898, 29990, 29918, 29873, 29897, 13, 13, 4706, 396, 1904, 17983, 13, 4706, 285, 29896, 353, 285, 3571, 29918, 13628, 29898, 29891, 29918, 29873, 303, 29892, 343, 29918, 11965, 29892, 21762, 29922, 29896, 29897, 13, 4706, 1035, 353, 13600, 29918, 13628, 29898, 29891, 29918, 29873, 303, 29892, 343, 29918, 11965, 29897, 13, 308, 13, 4706, 1596, 29898, 29888, 29908, 8771, 29901, 426, 8771, 29913, 448, 21447, 26254, 29875, 29913, 7945, 29901, 426, 4478, 29918, 11023, 29889, 13318, 29918, 13628, 29918, 29913, 1243, 29901, 285, 29896, 3790, 29888, 29896, 1118, 1035, 3790, 5753, 27195, 13, 13, 4706, 1121, 29889, 4397, 3552, 8771, 29892, 474, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 876, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 13318, 29918, 29888, 29896, 353, 29871, 29900, 13, 13318, 29918, 4299, 353, 6213, 13, 1454, 900, 29881, 29892, 302, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 297, 1121, 29901, 13, 1678, 565, 1900, 29918, 29888, 29896, 529, 285, 29896, 29901, 13, 4706, 1900, 29918, 29888, 29896, 353, 285, 29896, 13, 4706, 1900, 29918, 4299, 7607, 8771, 29892, 302, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 29897, 13, 29886, 1113, 29918, 14036, 353, 1900, 29918, 4299, 29961, 29896, 29962, 13, 13, 29886, 1113, 29918, 14036, 13, 13, 13, 29937, 396, 3617, 1900, 1904, 411, 1900, 282, 1113, 29918, 14036, 1353, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 2914, 29892, 21556, 29918, 353, 19997, 5159, 13, 29895, 29888, 353, 830, 412, 630, 5015, 271, 2164, 29968, 29943, 1025, 29898, 29876, 29918, 23579, 1169, 29922, 29896, 29900, 29892, 302, 29918, 276, 412, 1446, 29922, 29896, 29897, 13, 1454, 900, 29881, 29892, 313, 14968, 29918, 2248, 29892, 1243, 29918, 2248, 29897, 297, 26985, 29898, 29895, 29888, 29889, 5451, 29898, 29990, 29892, 343, 22164, 13, 1678, 1060, 29918, 14968, 29892, 1060, 29918, 1688, 353, 1060, 29961, 14968, 29918, 2248, 1402, 1060, 29961, 1688, 29918, 2248, 29962, 13, 1678, 343, 29918, 14968, 29892, 343, 29918, 1688, 353, 343, 29961, 14968, 29918, 2248, 1402, 343, 29961, 1688, 29918, 2248, 29962, 13, 268, 13, 1678, 396, 7945, 13, 1678, 282, 1113, 353, 349, 5454, 29898, 29886, 1113, 29918, 14036, 29897, 13, 1678, 1060, 29918, 29873, 353, 282, 1113, 29889, 9202, 29918, 9067, 29898, 29990, 29918, 14968, 29897, 13, 1678, 2740, 29918, 11023, 353, 16968, 1891, 7974, 15633, 29898, 6185, 2459, 9643, 2385, 3709, 3285, 1828, 29918, 27691, 29892, 26654, 29922, 1557, 8253, 29892, 302, 29918, 9057, 29879, 10457, 29896, 29892, 13850, 29922, 1123, 412, 630, 5015, 271, 2164, 29968, 29943, 1025, 29898, 29876, 29918, 23579, 1169, 29922, 29896, 29900, 29892, 302, 29918, 276, 412, 1446, 29922, 29896, 511, 2143, 277, 2433, 29943, 29896, 29918, 20097, 1495, 29871, 13, 1678, 2740, 29918, 11023, 29889, 9202, 29898, 29990, 29918, 29873, 29892, 343, 29918, 14968, 29897, 13, 1678, 1904, 353, 2740, 29918, 11023, 29889, 13318, 29918, 342, 326, 1061, 29918, 308, 13, 13, 1678, 396, 1243, 13, 1678, 1060, 29918, 29873, 353, 282, 1113, 29889, 9067, 29898, 29990, 29918, 1688, 29897, 13, 1678, 343, 29918, 11965, 353, 1904, 29889, 27711, 29898, 29990, 29918, 29873, 29897, 13, 13, 1678, 396, 1904, 17983, 13, 1678, 285, 29896, 353, 285, 3571, 29918, 13628, 29898, 29891, 29918, 1688, 29892, 343, 29918, 11965, 29892, 21762, 29922, 29896, 29897, 13, 1678, 1035, 353, 13600, 29918, 13628, 29898, 29891, 29918, 1688, 29892, 343, 29918, 11965, 29897, 13, 13, 1678, 1596, 29898, 29888, 29908, 8771, 29901, 426, 8771, 29913, 448, 21447, 26254, 29886, 1113, 29918, 14036, 29913, 7945, 29901, 426, 4478, 29918, 11023, 29889, 13318, 29918, 13628, 29918, 29913, 1243, 29901, 285, 29896, 3790, 29888, 29896, 1118, 1035, 3790, 5753, 27195, 13, 13, 1678, 1121, 29889, 4397, 3552, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 29892, 900, 29881, 29892, 474, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 876, 13, 1678, 21556, 5396, 4397, 3552, 29888, 29896, 29892, 1035, 876, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 13318, 29918, 29888, 29896, 353, 29871, 29900, 13, 13318, 29918, 4299, 353, 6213, 13, 1454, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 29892, 900, 29881, 29892, 302, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 297, 1121, 29901, 13, 1678, 565, 1900, 29918, 29888, 29896, 529, 285, 29896, 29901, 13, 4706, 1900, 29918, 29888, 29896, 353, 285, 29896, 13, 4706, 1900, 29918, 4299, 7607, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 29892, 900, 29881, 29892, 302, 29892, 1035, 29892, 285, 29896, 29892, 282, 1113, 29892, 1904, 29897, 13, 13, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 353, 1060, 29892, 343, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 396, 13318, 29918, 4299, 7503, 29946, 29962, 13, 13, 13, 29937, 396, 11597, 29891, 344, 8125, 7867, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 1053, 21556, 13, 13, 29886, 1113, 29892, 1904, 353, 1900, 29918, 4299, 14352, 29906, 1402, 1900, 29918, 4299, 14352, 29896, 29962, 13, 771, 5824, 353, 1904, 29889, 27711, 29918, 771, 2291, 29898, 29886, 1113, 29889, 9067, 29898, 29990, 29918, 1688, 876, 13, 11965, 29879, 353, 2070, 29879, 7503, 29892, 29896, 29962, 13, 29888, 558, 29892, 260, 558, 29892, 16897, 353, 21556, 29889, 10198, 29918, 2764, 345, 29898, 29891, 29918, 1688, 29892, 4450, 29879, 29897, 13, 10198, 29918, 14766, 353, 21556, 29889, 14766, 29898, 29888, 558, 29892, 260, 558, 29897, 13, 13, 29937, 1158, 306, 29901, 14770, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 572, 29873, 29889, 3257, 877, 22068, 6607, 1218, 26804, 4695, 1495, 13, 572, 29873, 29889, 5317, 29898, 29888, 558, 29892, 260, 558, 29892, 525, 29890, 742, 3858, 353, 525, 29909, 23129, 353, 1273, 29900, 29889, 29906, 29888, 29915, 1273, 696, 29883, 29918, 14766, 29897, 13, 572, 29873, 29889, 26172, 29898, 2029, 353, 525, 13609, 1492, 1495, 13, 572, 29873, 29889, 5317, 4197, 29900, 29892, 29871, 29896, 1402, 518, 29900, 29892, 29871, 29896, 1402, 29915, 29878, 489, 1495, 13, 572, 29873, 29889, 29916, 2576, 4197, 29900, 29892, 29871, 29896, 2314, 13, 572, 29873, 29889, 29891, 2576, 4197, 29900, 29892, 29871, 29896, 2314, 13, 572, 29873, 29889, 29891, 1643, 877, 5574, 10321, 3321, 390, 403, 1495, 13, 572, 29873, 29889, 29916, 1643, 877, 8824, 10321, 3321, 390, 403, 1495, 13, 2158, 580, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 29888, 29896, 29918, 29878, 29892, 1035, 29918, 29878, 353, 19997, 5159, 13, 1454, 285, 29896, 29892, 1035, 297, 21556, 29918, 29901, 13, 1678, 285, 29896, 29918, 29878, 29889, 4397, 29898, 29888, 29896, 29897, 13, 1678, 1035, 29918, 29878, 29889, 4397, 29898, 5753, 29897, 13, 13, 29888, 29896, 29918, 29878, 29892, 1035, 29918, 29878, 353, 7442, 29889, 2378, 29898, 29888, 29896, 29918, 29878, 511, 7442, 29889, 2378, 29898, 5753, 29918, 29878, 29897, 13, 29880, 353, 285, 29896, 29918, 29878, 29889, 12181, 29961, 29900, 29962, 13, 572, 29873, 29889, 3257, 29898, 29888, 29915, 29943, 29896, 2522, 487, 297, 383, 3361, 29898, 29925, 5454, 7117, 353, 426, 29886, 1113, 29918, 14036, 1800, 1495, 13, 572, 29873, 29889, 5317, 29898, 3881, 29898, 29880, 511, 285, 29896, 29918, 29878, 29892, 525, 29878, 742, 3858, 353, 525, 29943, 29896, 2522, 487, 1495, 13, 572, 29873, 29889, 5317, 29898, 3881, 29898, 29880, 511, 1035, 29918, 29878, 29892, 525, 29890, 742, 3858, 353, 525, 7504, 332, 4135, 1495, 13, 572, 29873, 29889, 26172, 29898, 2029, 353, 525, 13609, 1492, 1495, 13, 572, 29873, 29889, 486, 7358, 29898, 3881, 29898, 29880, 876, 13, 572, 29873, 29889, 29916, 2576, 4197, 29900, 29892, 301, 448, 29871, 29896, 2314, 13, 572, 29873, 29889, 29891, 2576, 4197, 29900, 29889, 29929, 29945, 29892, 29871, 29896, 2314, 13, 572, 29873, 29889, 29891, 1643, 877, 29943, 29896, 2522, 487, 1495, 13, 572, 29873, 29889, 29916, 1643, 877, 29943, 1025, 1495, 13, 572, 29873, 29889, 7720, 580, 13, 2158, 580, 13, 13, 13, 29937, 444, 18399, 4682, 1053, 2925, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 1753, 6492, 29918, 14394, 29918, 5215, 2925, 29898, 695, 29888, 29892, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29922, 8516, 29892, 2246, 29918, 29876, 29922, 29896, 29900, 29892, 2537, 2311, 7607, 29947, 29892, 29947, 511, 1596, 29918, 2371, 29922, 8824, 29892, 3611, 543, 19132, 16032, 2925, 29908, 1125, 29871, 13, 29937, 268, 2045, 597, 1636, 29889, 29895, 351, 6234, 29889, 510, 29914, 629, 29888, 440, 29946, 29914, 5317, 1259, 29899, 14394, 29899, 5215, 2925, 13, 1678, 4770, 978, 1649, 353, 376, 5317, 29918, 14394, 29918, 5215, 2925, 29908, 13, 268, 13, 1678, 1053, 11701, 408, 10518, 13, 1678, 1053, 12655, 29871, 408, 7442, 13, 1678, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 268, 13, 1678, 1060, 29918, 14968, 353, 10518, 29889, 17271, 29898, 1272, 29922, 29990, 29918, 14968, 29892, 4341, 11759, 29888, 29908, 9026, 29912, 29875, 5038, 363, 474, 297, 3464, 29898, 29896, 29892, 1060, 29918, 14968, 29889, 12181, 29961, 29896, 29962, 718, 29871, 29896, 29897, 2314, 13, 268, 13, 1678, 1238, 271, 29918, 6574, 353, 10518, 29889, 17271, 3319, 29915, 5215, 749, 2396, 695, 29888, 29889, 14394, 29918, 5215, 2925, 29918, 1800, 268, 13, 1678, 1238, 271, 29918, 6574, 1839, 14394, 2033, 353, 1060, 29918, 14968, 29889, 13099, 13, 1678, 1238, 271, 29918, 6574, 29889, 6605, 29918, 5975, 29898, 1609, 2433, 5215, 749, 742, 12066, 2548, 29922, 8824, 29892, 297, 6689, 29922, 5574, 29897, 13, 1678, 1238, 271, 29918, 6574, 353, 1238, 271, 29918, 6574, 29889, 309, 542, 7503, 3332, 29918, 29876, 29962, 13, 268, 13, 1678, 1238, 271, 29918, 6574, 29889, 6605, 29918, 5975, 29898, 1609, 2433, 5215, 749, 742, 297, 6689, 29922, 5574, 29897, 13, 1678, 1238, 271, 29918, 6574, 353, 1238, 271, 29918, 6574, 29889, 842, 29918, 2248, 877, 14394, 742, 5768, 29922, 5574, 29897, 13, 1678, 1238, 271, 29918, 6574, 29889, 5317, 29889, 1646, 29882, 29898, 3257, 29922, 3257, 29892, 2537, 2311, 29922, 1003, 2311, 29897, 13, 1678, 14770, 29889, 29916, 1643, 877, 19132, 16032, 749, 2522, 487, 1495, 13, 1678, 1596, 580, 13, 268, 13, 1678, 565, 1596, 29918, 2371, 29901, 13, 4706, 515, 5641, 1656, 29889, 4990, 1053, 2479, 13, 4706, 1596, 703, 7031, 6571, 5680, 297, 5153, 2548, 1797, 310, 13500, 1642, 4830, 29898, 3332, 29918, 29876, 876, 13, 4706, 1596, 29898, 1725, 271, 29918, 6574, 29889, 6605, 29918, 5975, 29898, 1609, 2433, 5215, 749, 742, 12066, 2548, 29922, 8824, 876, 13, 308, 13, 1678, 736, 1238, 271, 29918, 6574, 13, 13, 29886, 1113, 29892, 1067, 29888, 353, 1900, 29918, 4299, 14352, 29906, 1402, 1900, 29918, 4299, 14352, 29896, 29962, 13, 14394, 29918, 5215, 749, 353, 6492, 29918, 14394, 29918, 5215, 2925, 29898, 695, 29888, 29892, 282, 1113, 29889, 9067, 29898, 29990, 29918, 14968, 511, 2246, 29918, 29876, 29922, 29990, 29918, 14968, 29889, 12181, 29961, 29896, 1402, 3611, 29922, 695, 29888, 17255, 1990, 1649, 17255, 978, 1649, 29897, 13, 13, 13, 29937, 444, 3617, 5169, 3698, 501, 8485, 304, 3251, 403, 349, 5454, 422, 9340, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 29937, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29906, 29906, 29941, 29946, 29947, 29953, 29953, 29947, 29914, 29886, 1113, 29899, 311, 510, 3283, 29899, 2541, 29899, 4691, 29899, 22100, 29899, 276, 2608, 2925, 13, 29886, 1113, 29892, 1067, 29888, 353, 1900, 29918, 4299, 14352, 29906, 1402, 1900, 29918, 4299, 14352, 29896, 29962, 13, 2248, 29918, 14036, 353, 518, 524, 29898, 29916, 29961, 29906, 29901, 2314, 363, 921, 297, 4682, 29918, 5215, 749, 29889, 2248, 29889, 5975, 29962, 13, 1753, 5680, 29918, 3880, 29918, 517, 29918, 17158, 29918, 29886, 1113, 29918, 14036, 29898, 2248, 29918, 14036, 29892, 282, 1113, 29892, 1067, 29888, 29892, 4341, 29918, 7039, 1125, 268, 13, 1678, 363, 474, 297, 2380, 29918, 14036, 29901, 13, 4706, 2380, 29918, 22100, 353, 7442, 29889, 6897, 29898, 29886, 1113, 29889, 14036, 29918, 29961, 29875, 448, 29871, 29896, 14664, 5085, 441, 580, 7503, 29946, 29962, 13, 4706, 5680, 353, 4341, 29918, 7039, 29961, 2248, 29918, 22100, 29962, 13, 4706, 1596, 29898, 29888, 29915, 9026, 29912, 29875, 29913, 1495, 13, 4706, 1596, 29898, 29888, 29915, 8263, 3698, 29901, 1495, 13, 4706, 363, 285, 297, 5680, 29901, 13, 9651, 1596, 14182, 29873, 29908, 718, 285, 29897, 13, 4706, 1596, 580, 13, 308, 13, 22100, 29918, 3880, 29918, 517, 29918, 17158, 29918, 29886, 1113, 29918, 14036, 29898, 2248, 29918, 14036, 29892, 282, 1113, 29892, 1067, 29888, 29892, 4341, 29918, 7039, 29897, 13, 13, 13, 29937, 444, 10811, 3958, 22513, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 14679, 29918, 5344, 13, 13, 29886, 1113, 29892, 1067, 29888, 353, 1900, 29918, 4299, 14352, 29906, 1402, 1900, 29918, 4299, 14352, 29896, 29962, 13, 13, 29891, 29918, 11965, 353, 1067, 29888, 29889, 27711, 29898, 29886, 1113, 29889, 9067, 29898, 29990, 29918, 1688, 876, 13, 13, 4912, 353, 14679, 29918, 5344, 29898, 29891, 29918, 1688, 29892, 343, 29918, 11965, 29897, 13, 4912, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 5215, 4256, 8504, 13, 13, 1753, 6492, 29918, 5527, 3958, 29918, 5344, 29898, 4912, 29892, 4413, 29892, 4226, 675, 29922, 8824, 29892, 3611, 2433, 16376, 3958, 4636, 742, 274, 1958, 29922, 572, 29873, 29889, 4912, 29889, 10358, 1041, 1125, 29871, 13, 1678, 9995, 910, 740, 14677, 322, 24580, 278, 14679, 4636, 29889, 21981, 2133, 508, 367, 7436, 491, 4444, 421, 8945, 675, 29922, 5574, 1412, 9995, 29871, 13, 1678, 565, 4226, 675, 29901, 13, 4706, 7477, 353, 7477, 29889, 579, 668, 877, 7411, 1495, 847, 7477, 29889, 2083, 29898, 8990, 29922, 29896, 29897, 7503, 29892, 7442, 29889, 1482, 8990, 29962, 13, 4706, 1596, 703, 19077, 1891, 14679, 4636, 1159, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 16376, 3958, 4636, 29892, 1728, 4226, 2133, 1495, 13, 13, 1678, 1596, 29898, 4912, 29897, 13, 13, 1678, 14770, 29889, 326, 4294, 29898, 4912, 29892, 29694, 2433, 28502, 342, 742, 274, 1958, 29922, 29883, 1958, 29897, 13, 1678, 14770, 29889, 3257, 29898, 3257, 29897, 13, 1678, 1596, 580, 13, 1678, 16892, 29918, 22848, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 13203, 876, 13, 1678, 14770, 29889, 486, 7358, 29898, 24667, 29918, 22848, 29892, 4413, 29892, 13733, 29922, 29946, 29945, 29897, 13, 1678, 14770, 29889, 3637, 7358, 29898, 24667, 29918, 22848, 29892, 4413, 29897, 13, 13, 1678, 19200, 353, 15300, 29906, 29888, 29915, 565, 4226, 675, 1683, 525, 29881, 29915, 13, 1678, 266, 3781, 353, 7477, 29889, 3317, 580, 847, 29871, 29906, 29889, 13, 1678, 363, 474, 29892, 432, 297, 4256, 8504, 29889, 4704, 29898, 3881, 29898, 4912, 29889, 12181, 29961, 29900, 11724, 3464, 29898, 4912, 29889, 12181, 29961, 29896, 12622, 29901, 13, 4706, 14770, 29889, 726, 29898, 29926, 29892, 474, 29892, 3402, 29898, 4912, 29961, 29875, 29892, 432, 1402, 19200, 511, 14698, 2520, 358, 543, 5064, 613, 2927, 543, 10921, 29908, 565, 7477, 29961, 29875, 29892, 432, 29962, 1405, 266, 3781, 1683, 376, 8517, 1159, 29871, 13, 13, 1678, 14770, 29889, 29891, 1643, 877, 5574, 3858, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 23084, 18186, 3858, 1495, 13, 1678, 14770, 29889, 29873, 523, 29918, 2680, 580, 13, 268, 13, 5317, 29918, 5527, 3958, 29918, 5344, 29898, 4912, 29892, 518, 29900, 29892, 29871, 29896, 1402, 5852, 29897, 13, 13, 13, 29937, 444, 23236, 13969, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 12965, 29918, 12276, 13, 13, 2158, 29898, 1990, 2450, 29918, 12276, 29898, 29891, 29918, 1688, 29892, 343, 29918, 11965, 876, 13, 13, 13, 29937, 396, 16913, 6407, 8125, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 8336, 1053, 5609, 29918, 4262, 29894, 466, 13, 29937, 1222, 637, 408, 8329, 934, 13, 15843, 29918, 4262, 29894, 466, 29898, 13318, 29918, 4299, 14352, 29896, 1402, 714, 29918, 1445, 2433, 8336, 29889, 6333, 742, 29871, 770, 29918, 7039, 353, 518, 1013, 29922, 29871, 29945, 29900, 29968, 613, 9872, 29871, 29945, 29900, 29968, 12436, 28240, 353, 5852, 29892, 18618, 353, 7700, 29892, 16716, 353, 29871, 29906, 29892, 10423, 353, 5852, 29897, 29871, 13, 13, 29937, 14806, 304, 282, 865, 773, 1788, 1899, 313, 276, 339, 2658, 12367, 29894, 466, 29897, 13, 3166, 1014, 5014, 1053, 1246, 13, 4804, 18959, 6333, 742, 17411, 29911, 2732, 742, 525, 8336, 29889, 6333, 742, 17411, 29877, 742, 525, 8336, 29889, 2732, 742, 17411, 29954, 29881, 1631, 29922, 29953, 29900, 29900, 11287, 13, 13, 29937, 17440, 297, 432, 786, 25547, 451, 19273, 13, 3166, 5641, 1656, 29889, 4990, 1053, 7084, 13, 2940, 29898, 9507, 353, 525, 8336, 29889, 2732, 1495, 13, 13, 13, 29937, 512, 29961, 4514, 29901, 13, 13, 13, 3166, 2071, 19668, 29889, 735, 725, 1338, 1053, 4982, 1982, 13, 13, 9057, 1982, 29889, 15070, 29898, 13318, 29918, 4299, 29892, 525, 29880, 629, 29889, 9057, 1982, 1495, 13, 13, 2 ]
sdk/python/pulumi_azure/core/get_resources.py
apollo2030/pulumi-azure
0
137009
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from typing import Union from .. import utilities, tables class GetResourcesResult: """ A collection of values returned by getResources. """ def __init__(__self__, name=None, required_tags=None, resource_group_name=None, resources=None, type=None, id=None): if name and not isinstance(name, str): raise TypeError("Expected argument 'name' to be a str") __self__.name = name """ The name of this Resource. """ if required_tags and not isinstance(required_tags, dict): raise TypeError("Expected argument 'required_tags' to be a dict") __self__.required_tags = required_tags if resource_group_name and not isinstance(resource_group_name, str): raise TypeError("Expected argument 'resource_group_name' to be a str") __self__.resource_group_name = resource_group_name if resources and not isinstance(resources, list): raise TypeError("Expected argument 'resources' to be a list") __self__.resources = resources """ One or more `resource` blocks as defined below. """ if type and not isinstance(type, str): raise TypeError("Expected argument 'type' to be a str") __self__.type = type """ The type of this Resource. (e.g. `Microsoft.Network/virtualNetworks`). """ if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") __self__.id = id """ id is the provider-assigned unique ID for this managed resource. """ class AwaitableGetResourcesResult(GetResourcesResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetResourcesResult( name=self.name, required_tags=self.required_tags, resource_group_name=self.resource_group_name, resources=self.resources, type=self.type, id=self.id) def get_resources(name=None,required_tags=None,resource_group_name=None,type=None,opts=None): """ Use this data source to access information about existing resources. :param str name: The name of the Resource. :param dict required_tags: A mapping of tags which the resource has to have in order to be included in the result. :param str resource_group_name: The name of the Resource group where the Resources are located. :param str type: The Resource Type of the Resources you want to list (e.g. `Microsoft.Network/virtualNetworks`). A full list of available Resource Types can be found [here](https://docs.microsoft.com/en-us/azure/azure-resource-manager/azure-services-resource-providers). > This content is derived from https://github.com/terraform-providers/terraform-provider-azurerm/blob/master/website/docs/d/resources.html.markdown. """ __args__ = dict() __args__['name'] = name __args__['requiredTags'] = required_tags __args__['resourceGroupName'] = resource_group_name __args__['type'] = type if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = utilities.get_version() __ret__ = pulumi.runtime.invoke('azure:core/getResources:getResources', __args__, opts=opts).value return AwaitableGetResourcesResult( name=__ret__.get('name'), required_tags=__ret__.get('requiredTags'), resource_group_name=__ret__.get('resourceGroupName'), resources=__ret__.get('resources'), type=__ret__.get('type'), id=__ret__.get('id'))
[ 1, 396, 14137, 29922, 9420, 29899, 29947, 13, 29937, 18610, 399, 25614, 29901, 445, 934, 471, 5759, 491, 278, 27477, 15547, 20839, 689, 16230, 313, 13264, 1885, 29897, 21704, 29889, 18610, 13, 29937, 18610, 1938, 451, 3863, 491, 1361, 6521, 366, 29915, 276, 3058, 366, 1073, 825, 366, 526, 2599, 29991, 18610, 13, 13, 5215, 4390, 13, 5215, 18116, 13, 5215, 9505, 15547, 13, 5215, 9505, 15547, 29889, 15634, 13, 3166, 19229, 1053, 7761, 13, 3166, 6317, 1053, 3667, 1907, 29892, 6131, 13, 13, 1990, 3617, 13770, 3591, 29901, 13, 1678, 9995, 13, 1678, 319, 4333, 310, 1819, 4133, 491, 679, 13770, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1649, 1311, 1649, 29892, 1024, 29922, 8516, 29892, 3734, 29918, 11338, 29922, 8516, 29892, 6503, 29918, 2972, 29918, 978, 29922, 8516, 29892, 7788, 29922, 8516, 29892, 1134, 29922, 8516, 29892, 1178, 29922, 8516, 1125, 13, 4706, 565, 1024, 322, 451, 338, 8758, 29898, 978, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 978, 29915, 304, 367, 263, 851, 1159, 13, 4706, 4770, 1311, 26914, 978, 353, 1024, 13, 4706, 9995, 13, 4706, 450, 1024, 310, 445, 18981, 29889, 13, 4706, 9995, 13, 4706, 565, 3734, 29918, 11338, 322, 451, 338, 8758, 29898, 12403, 29918, 11338, 29892, 9657, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 12403, 29918, 11338, 29915, 304, 367, 263, 9657, 1159, 13, 4706, 4770, 1311, 26914, 12403, 29918, 11338, 353, 3734, 29918, 11338, 13, 4706, 565, 6503, 29918, 2972, 29918, 978, 322, 451, 338, 8758, 29898, 10314, 29918, 2972, 29918, 978, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 10314, 29918, 2972, 29918, 978, 29915, 304, 367, 263, 851, 1159, 13, 4706, 4770, 1311, 26914, 10314, 29918, 2972, 29918, 978, 353, 6503, 29918, 2972, 29918, 978, 13, 4706, 565, 7788, 322, 451, 338, 8758, 29898, 13237, 29892, 1051, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 13237, 29915, 304, 367, 263, 1051, 1159, 13, 4706, 4770, 1311, 26914, 13237, 353, 7788, 13, 4706, 9995, 13, 4706, 3118, 470, 901, 421, 10314, 29952, 10930, 408, 3342, 2400, 29889, 13, 4706, 9995, 13, 4706, 565, 1134, 322, 451, 338, 8758, 29898, 1853, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 1853, 29915, 304, 367, 263, 851, 1159, 13, 4706, 4770, 1311, 26914, 1853, 353, 1134, 13, 4706, 9995, 13, 4706, 450, 1134, 310, 445, 18981, 29889, 313, 29872, 29889, 29887, 29889, 421, 11277, 29889, 13724, 29914, 18714, 13724, 29879, 12913, 13, 4706, 9995, 13, 4706, 565, 1178, 322, 451, 338, 8758, 29898, 333, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 333, 29915, 304, 367, 263, 851, 1159, 13, 4706, 4770, 1311, 26914, 333, 353, 1178, 13, 4706, 9995, 13, 4706, 1178, 338, 278, 13113, 29899, 465, 12961, 5412, 3553, 363, 445, 8745, 6503, 29889, 13, 4706, 9995, 13, 1990, 319, 10685, 519, 2577, 13770, 3591, 29898, 2577, 13770, 3591, 1125, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 4746, 29899, 23362, 29899, 1688, 13, 1678, 822, 4770, 20675, 12035, 1311, 1125, 13, 4706, 565, 7700, 29901, 13, 9651, 7709, 1583, 13, 4706, 736, 3617, 13770, 3591, 29898, 13, 9651, 1024, 29922, 1311, 29889, 978, 29892, 13, 9651, 3734, 29918, 11338, 29922, 1311, 29889, 12403, 29918, 11338, 29892, 13, 9651, 6503, 29918, 2972, 29918, 978, 29922, 1311, 29889, 10314, 29918, 2972, 29918, 978, 29892, 13, 9651, 7788, 29922, 1311, 29889, 13237, 29892, 13, 9651, 1134, 29922, 1311, 29889, 1853, 29892, 13, 9651, 1178, 29922, 1311, 29889, 333, 29897, 13, 13, 1753, 679, 29918, 13237, 29898, 978, 29922, 8516, 29892, 12403, 29918, 11338, 29922, 8516, 29892, 10314, 29918, 2972, 29918, 978, 29922, 8516, 29892, 1853, 29922, 8516, 29892, 25707, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 4803, 445, 848, 2752, 304, 2130, 2472, 1048, 5923, 7788, 29889, 13, 268, 13, 1678, 584, 3207, 851, 1024, 29901, 450, 1024, 310, 278, 18981, 29889, 13, 1678, 584, 3207, 9657, 3734, 29918, 11338, 29901, 319, 10417, 310, 8282, 607, 278, 6503, 756, 304, 505, 297, 1797, 304, 367, 5134, 297, 278, 1121, 29889, 13, 1678, 584, 3207, 851, 6503, 29918, 2972, 29918, 978, 29901, 450, 1024, 310, 278, 18981, 2318, 988, 278, 27562, 526, 5982, 29889, 13, 1678, 584, 3207, 851, 1134, 29901, 450, 18981, 5167, 310, 278, 27562, 366, 864, 304, 1051, 313, 29872, 29889, 29887, 29889, 421, 11277, 29889, 13724, 29914, 18714, 13724, 29879, 12913, 319, 2989, 1051, 310, 3625, 18981, 28025, 508, 367, 1476, 518, 4150, 850, 991, 597, 2640, 29889, 4994, 29889, 510, 29914, 264, 29899, 375, 29914, 17688, 29914, 17688, 29899, 10314, 29899, 12847, 29914, 17688, 29899, 9916, 29899, 10314, 29899, 771, 29454, 467, 13, 13, 1678, 1405, 910, 2793, 338, 10723, 515, 2045, 597, 3292, 29889, 510, 29914, 27331, 689, 29899, 771, 29454, 29914, 27331, 689, 29899, 18121, 29899, 834, 332, 837, 29914, 10054, 29914, 6207, 29914, 22942, 29914, 2640, 29914, 29881, 29914, 13237, 29889, 1420, 29889, 3502, 3204, 29889, 13, 1678, 9995, 13, 1678, 4770, 5085, 1649, 353, 9657, 580, 13, 13, 1678, 4770, 5085, 1649, 1839, 978, 2033, 353, 1024, 13, 1678, 4770, 5085, 1649, 1839, 12403, 28089, 2033, 353, 3734, 29918, 11338, 13, 1678, 4770, 5085, 1649, 1839, 10314, 4782, 1170, 2033, 353, 6503, 29918, 2972, 29918, 978, 13, 1678, 4770, 5085, 1649, 1839, 1853, 2033, 353, 1134, 13, 1678, 565, 29111, 338, 6213, 29901, 13, 4706, 29111, 353, 9505, 15547, 29889, 20731, 5856, 580, 13, 1678, 565, 29111, 29889, 3259, 338, 6213, 29901, 13, 4706, 29111, 29889, 3259, 353, 3667, 1907, 29889, 657, 29918, 3259, 580, 13, 1678, 4770, 2267, 1649, 353, 9505, 15547, 29889, 15634, 29889, 9772, 877, 17688, 29901, 3221, 29914, 657, 13770, 29901, 657, 13770, 742, 4770, 5085, 1649, 29892, 29111, 29922, 25707, 467, 1767, 13, 13, 1678, 736, 319, 10685, 519, 2577, 13770, 3591, 29898, 13, 4706, 1024, 29922, 1649, 2267, 26914, 657, 877, 978, 5477, 13, 4706, 3734, 29918, 11338, 29922, 1649, 2267, 26914, 657, 877, 12403, 28089, 5477, 13, 4706, 6503, 29918, 2972, 29918, 978, 29922, 1649, 2267, 26914, 657, 877, 10314, 4782, 1170, 5477, 13, 4706, 7788, 29922, 1649, 2267, 26914, 657, 877, 13237, 5477, 13, 4706, 1134, 29922, 1649, 2267, 26914, 657, 877, 1853, 5477, 13, 4706, 1178, 29922, 1649, 2267, 26914, 657, 877, 333, 8785, 13, 2 ]
LiveFeedPythonScripts/FeedFromOtherDevice/Share PC Screen With Android/screenshot.py
viveksb007/LiveFeed
10
176527
import time import cv2 import pyscreenshot as ImageGrab import numpy as np class Screenshot(object): def get_frame(self): img = np.array(ImageGrab.grab().convert('RGB'), dtype=np.uint8) img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) ret2, jpeg = cv2.imencode('.jpg', img) return jpeg.tostring() def __del__(self): self.cam.release()
[ 1, 1053, 931, 13, 5215, 13850, 29906, 13, 5215, 282, 952, 24546, 8711, 408, 7084, 29954, 4201, 13, 5215, 12655, 408, 7442, 13, 13, 1990, 317, 24546, 8711, 29898, 3318, 1125, 13, 1678, 822, 679, 29918, 2557, 29898, 1311, 1125, 13, 4706, 10153, 353, 7442, 29889, 2378, 29898, 2940, 29954, 4201, 29889, 3874, 29890, 2141, 13441, 877, 28212, 5477, 26688, 29922, 9302, 29889, 13470, 29947, 29897, 13, 4706, 10153, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 28212, 29906, 29933, 14345, 29897, 13, 4706, 3240, 29906, 29892, 432, 29886, 387, 353, 13850, 29906, 29889, 326, 12508, 12839, 6173, 742, 10153, 29897, 13, 4706, 736, 432, 29886, 387, 29889, 517, 1807, 580, 13, 13, 1678, 822, 4770, 6144, 12035, 1311, 1125, 13, 4706, 1583, 29889, 11108, 29889, 14096, 580, 13, 2 ]
sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/search_get_schema_response.py
tzhanl/azure-sdk-for-python
1
7092
# 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 msrest.serialization import Model class SearchGetSchemaResponse(Model): """The get schema operation response. :param metadata: The metadata from search results. :type metadata: ~azure.mgmt.loganalytics.models.SearchMetadata :param value: The array of result values. :type value: list[~azure.mgmt.loganalytics.models.SearchSchemaValue] """ _attribute_map = { 'metadata': {'key': 'metadata', 'type': 'SearchMetadata'}, 'value': {'key': 'value', 'type': '[SearchSchemaValue]'}, } def __init__(self, **kwargs): super(SearchGetSchemaResponse, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.value = kwargs.get('value', None)
[ 1, 396, 14137, 29922, 9420, 29899, 29947, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 29899, 13, 29937, 14187, 1266, 313, 29883, 29897, 7783, 15025, 29889, 2178, 10462, 21676, 29889, 13, 29937, 10413, 21144, 1090, 278, 341, 1806, 19245, 29889, 2823, 19245, 29889, 3945, 297, 278, 2060, 3876, 363, 13, 29937, 19405, 2472, 29889, 13, 29937, 13, 29937, 5920, 5759, 491, 7783, 313, 29934, 29897, 11133, 15078, 5920, 3251, 1061, 29889, 13, 29937, 678, 6916, 1122, 4556, 10240, 6030, 322, 674, 367, 5714, 565, 278, 775, 338, 13, 29937, 1072, 759, 630, 29889, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 29899, 13, 13, 3166, 10887, 5060, 29889, 15550, 2133, 1053, 8125, 13, 13, 13, 1990, 11856, 2577, 12763, 5103, 29898, 3195, 1125, 13, 1678, 9995, 1576, 679, 10938, 5858, 2933, 29889, 13, 13, 1678, 584, 3207, 15562, 29901, 450, 15562, 515, 2740, 2582, 29889, 13, 1678, 584, 1853, 15562, 29901, 3695, 17688, 29889, 29885, 29887, 4378, 29889, 1188, 7054, 22026, 29889, 9794, 29889, 7974, 18417, 13, 1678, 584, 3207, 995, 29901, 450, 1409, 310, 1121, 1819, 29889, 13, 1678, 584, 1853, 995, 29901, 1051, 29961, 30022, 17688, 29889, 29885, 29887, 4378, 29889, 1188, 7054, 22026, 29889, 9794, 29889, 7974, 12763, 1917, 29962, 13, 1678, 9995, 13, 13, 1678, 903, 12715, 29918, 1958, 353, 426, 13, 4706, 525, 19635, 2396, 11117, 1989, 2396, 525, 19635, 742, 525, 1853, 2396, 525, 7974, 18417, 16675, 13, 4706, 525, 1767, 2396, 11117, 1989, 2396, 525, 1767, 742, 525, 1853, 2396, 525, 29961, 7974, 12763, 1917, 29962, 16675, 13, 1678, 500, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 7974, 2577, 12763, 5103, 29892, 1583, 467, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 1583, 29889, 19635, 353, 9049, 5085, 29889, 657, 877, 19635, 742, 6213, 29897, 13, 4706, 1583, 29889, 1767, 353, 9049, 5085, 29889, 657, 877, 1767, 742, 6213, 29897, 13, 2 ]