blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
5
261
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
45
license_type
stringclasses
2 values
repo_name
stringlengths
8
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
72 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
530k
616M
star_events_count
int64
0
102k
fork_events_count
int64
0
24.6k
gha_license_id
stringclasses
9 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
40 values
src_encoding
stringclasses
10 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
11
4.05M
extension
stringclasses
25 values
content
stringlengths
10
4.04M
authors
sequencelengths
1
1
author_id
stringclasses
578 values
92329172eff2e4b3144e1abe0fa2c4fa8e730893
947d4102433b136ac65e6bbebd28ca51c53d1f5f
/ansible/library/reduce_and_add_sonic_images.py
baf99702c89fb32e4cb5718a65e1c501a6c3a86c
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
SW-CSA/sonic-mgmt
eac574040a20cea724208a442f7492f840dd1ec3
d50a683dc3ab0206e1fef9230c136b4c19b084f1
refs/heads/201811
2023-09-01T13:14:29.166752
2019-03-21T08:08:43
2019-03-21T08:08:43
142,762,730
2
5
NOASSERTION
2019-11-05T06:55:46
2018-07-29T13:21:25
Python
UTF-8
Python
false
false
4,535
py
#!/usr/bin/python DOCUMENTATION = ''' module: reduce_and_add_sonic_images version_added: "1.0" short_description: remove excessive sonic images and install new image if specified description: remove excessive sonic images from the target device. Note that this version doesn't guarantee to remove older images. Images in the 'Available' list that are not 'Current' or 'Next' wil subject to removal. Options: - option-name: disk_used_pcent description: maximum disk used percentage after removing old images required: False Default: 50 - option-name: new_image_url description: url pointing to the new image required: False Default: None ''' import sys from ansible.module_utils.basic import * def exec_command(module, cmd, ignore_error=False, msg="executing command"): rc, out, err = module.run_command(cmd) if not ignore_error and rc != 0: module.fail_json(msg="Failed %s: rc=%d, out=%s, err=%s" % (msg, rc, out, err)) return out def get_sonic_image_removal_candidates(module): keep = set() images = set() out = exec_command(module, cmd="sonic_installer list", msg="listing sonic images") lines = out.split('\n') for line in lines: line = line.strip() if line.startswith("Current:") or line.startswith("Next:"): keep.add(line.split()[1].strip()) elif line != "Available:" and len(line) > 0: images.add(line) return (images - keep) def get_disk_free_size(module, partition): out = exec_command(module, cmd="df -BM --output=avail %s" % partition, msg="checking disk available size") avail = int(out.split('\n')[1][:-1]) return avail def get_disk_used_percent(module, partition): out = exec_command(module, cmd="df -BM --output=pcent %s" % partition, msg="checking disk available percent") pcent = int(out.split('\n')[1][:-1]) return pcent def reduce_installed_sonic_images(module, disk_used_pcent): images = get_sonic_image_removal_candidates(module) while len(images) > 0: pcent = get_disk_used_percent(module, "/host") if pcent < disk_used_pcent: break # Randomly choose an old image to remove. On a system with # developer built images and offical build images mix-installed # it is hard to compare image tag to find 'oldest' image. img = images.pop() exec_command(module, cmd="sonic_installer remove %s -y" % img, ignore_error=True) def install_new_sonic_image(module, new_image_url): if not new_image_url: return avail = get_disk_free_size(module, "/host") if avail >= 1500: # There is enough space to install directly exec_command(module, cmd="sonic_installer install %s -y" % new_image_url, msg="installing new image") else: # Create a tmpfs partition to download image to install exec_command(module, cmd="mkdir -p /tmp/tmpfs", ignore_error=True) exec_command(module, cmd="umount /tmp/tmpfs", ignore_error=True) exec_command(module, cmd="mount -t tmpfs -o size=1000M tmpfs /tmp/tmpfs", msg="mounting tmpfs") exec_command(module, cmd="curl -o /tmp/tmpfs/sonic-image %s" % new_image_url, msg="downloading new image") exec_command(module, cmd="sonic_installer install /tmp/tmpfs/sonic-image -y", msg="installing new image") exec_command(module, cmd="sync", ignore_error=True) exec_command(module, cmd="umount /tmp/tmpfs", ignore_error=True) exec_command(module, cmd="rm -rf /tmp/tmpfs", ignore_error=True) def main(): module = AnsibleModule( argument_spec=dict( disk_used_pcent=dict(required=False, type='int', default=8), new_image_url=dict(required=False, type='str', default=None), ), supports_check_mode=False) disk_used_pcent = module.params['disk_used_pcent'] new_image_url = module.params['new_image_url'] try: reduce_installed_sonic_images(module, disk_used_pcent) install_new_sonic_image(module, new_image_url) except: err = str(sys.exc_info()) module.fail_json(msg="Error: %s" % err) module.exit_json() if __name__ == '__main__': main()
e2af38a57db25a75aa48387c6f0b689a2d5076bc
0074cb7e3c51bb0dbe72e62898351b656cdac866
/playfair_encryption&decryption.py
05ed3790502985e6063fa10dbf30451956a631f1
[]
no_license
mohitparekh7/rsa-and-playfair_cipher-PYTHON
089723fed4c532f668da8dcefa889f76552b826d
09230da145d9ce882fb5670161ea4690c38da764
refs/heads/main
2023-01-28T06:06:15.574385
2020-12-03T06:09:20
2020-12-03T06:09:20
303,096,977
0
1
null
2020-10-20T14:49:01
2020-10-11T10:40:13
Python
UTF-8
Python
false
false
3,245
py
key=input("Enter key ") # initializing the key key=key.upper() key=key.replace(" ", "") def matrix(x,y,initial): return [[initial for i in range(x)] for j in range(y)] result=[] for ch in key: # storing the key into the matrix if ch not in result: if ch=='J': result.append('I') else: result.append(ch) flag=0 for i in range(65,91): #storing all the other characters into the matrix if chr(i) not in result: if i==73 and chr(74) not in result: result.append("I") flag=1 elif flag==0 and i==73 or i==74: pass else: result.append(chr(i)) k=0 encryptedMatrix=matrix(5,5,0) #initialize the matrix for i in range(0,5): # creating the 5x5 matrix with the input for j in range(0,5): encryptedMatrix[i][j]=result[k] k+=1 def locationIndex(c): # get location of each character loc=[] if c=='J': c='I' for i ,j in enumerate(encryptedMatrix): for k,l in enumerate(j): if c==l: loc.append(i) loc.append(k) return loc def encrypt(): # Encryption msg=str(input("ENTER MSG:")) msg=msg.upper() msg=msg.replace(" ", "") i=0 for s in range(0,len(msg)+1,2): if s<len(msg)-1: if msg[s]==msg[s+1]: msg=msg[:s+1]+'Z'+msg[s+1:] if len(msg)%2!=0: msg=msg[:]+'Z' print("CIPHER TEXT:",end=' ') while i<len(msg): loc=[] loc=locationIndex(msg[i]) loc1=[] loc1=locationIndex(msg[i+1]) if loc[1]==loc1[1]: print("{}{}".format(encryptedMatrix[(loc[0]+1)%5][loc[1]],encryptedMatrix[(loc1[0]+1)%5][loc1[1]]).lower(),end='') elif loc[0]==loc1[0]: print("{}{}".format(encryptedMatrix[loc[0]][(loc[1]+1)%5],encryptedMatrix[loc1[0]][(loc1[1]+1)%5]).lower(),end='') else: print("{}{}".format(encryptedMatrix[loc[0]][loc1[1]],encryptedMatrix[loc1[0]][loc[1]]).lower(),end='') i=i+2 def decrypt(): # Decryption msg=str(input("ENTER CIPHER TEXT: ")) msg=msg.upper() msg=msg.replace(" ", "") print("PLAIN TEXT: ",end=' ') i=0 while i<len(msg): loc=[] loc=locationIndex(msg[i]) loc1=[] loc1=locationIndex(msg[i+1]) if loc[1]==loc1[1]: print("{}{}".format(encryptedMatrix[(loc[0]-1)%5][loc[1]],encryptedMatrix[(loc1[0]-1)%5][loc1[1]]).lower(),end='') elif loc[0]==loc1[0]: print("{}{}".format(encryptedMatrix[loc[0]][(loc[1]-1)%5],encryptedMatrix[loc1[0]][(loc1[1]-1)%5]).lower(),end='') else: print("{}{}".format(encryptedMatrix[loc[0]][loc1[1]],encryptedMatrix[loc1[0]][loc[1]]).lower(),end='') i=i+2 while(1): print("\n1.Encryption \n2.Decryption \n3.Exit \n") choice = int(input("Enter your choice: ")) if choice==1: encrypt() elif choice==2: decrypt() elif choice==3: exit() else: print("Choose correct choice")
8e759a2bc6dd93cdbe910a915123e8a386e26006
8aff2ffdb6d17c046579b8e58d7084390cd3d616
/Python/Nucleo/BuildGraf.py
1c2a3bf120739866209aec206e9fc18bc21d1615
[ "MIT" ]
permissive
galexbh/Network-of-interconnected-servers
45309a7de5b6b1ce750ed4c069c6a71b847112de
e97618ccb44e608c1cfe022f25763424b93de449
refs/heads/master
2022-11-22T20:57:30.437818
2020-07-31T15:46:44
2020-07-31T15:46:44
null
0
0
null
null
null
null
UTF-8
Python
false
false
4,713
py
# -*- coding: utf-8 -*- #Clase para los vertices. class Vertex: def __init__(self,name): self.name = name self.edges ={} self.weight = None #Utilizada para agregar una arista a un vertices, recibiendo sus caracteristicas. def addEdge(self,node,distance,bandwidth,usersOnline,traffic,meanType): self.edges[node.name] = self.getWeight(distance,bandwidth,usersOnline,traffic,meanType) #Retortnar el peso calculado. def getWeight(self,distance,bandwidth,usersOnline,traffic,meanType): subTotalForDistance = self.decreaseInReliability(distance,meanType) subtTotalForBandwidth = self.calculateForBandwidth(bandwidth,usersOnline,traffic) totalReliabilty = subTotalForDistance + subtTotalForBandwidth if(totalReliabilty < 0): totalReliabilty = 0 if(totalReliabilty > 1): totalReliabilty = 1 totalReliabilty = "{0:.2f}".format(totalReliabilty) self.weight = totalReliabilty return float(self.weight) def decreaseInReliability(self,distance,meanType): reliability = None partition = None if(meanType == 'CAT5'): reliability = 0.98 decrease = 0.02 #Disminucion de confiabilidad% partition = 50 #Cada partition metros if(meanType == 'CAT6'): reliability = 0.98 decrease = 0.01 partition = 50 if(meanType == 'Fibra-Optica' or meanType == 'Fibra-Óptica'): reliability = 0.90 decrease = 0.05 partition = 100 if(meanType == 'Wifi' or meanType == "WIFI"): reliability = 0.7 decrease = 0.06 partition = 6 if(meanType == 'Coaxial'): reliability = 1 decrease = 0.04 partition = 100 if(meanType == 'Par-Trenzado'): reliability = 1 decrease = 0.01 partition = 100 subTotalForDistance = (int(distance)/partition)*decrease totalDistanceDecrease = reliability - subTotalForDistance return totalDistanceDecrease def calculateForBandwidth(self,bandwidth,usersOnline,traffic): bandwidth = int(bandwidth) usersOnline = int(usersOnline) traffic = int(traffic) subtTotalForBandwidth = (traffic - bandwidth)/usersOnline #mbps percentage = (subtTotalForBandwidth/bandwidth)*100 reliability = 0 if(percentage >=1 and percentage < 25): reliability = 0.05 if(percentage >=25 and percentage < 50): reliability = 0.10 if(percentage >=50 and percentage < 75): reliability = 0.15 if(percentage >= 75 and percentage <=100): reliability = 0.20 if(percentage < 1): reliability = 0 return reliability #Clase para gestion de los vertices en el grafo. class Graph: def __init__(self): self.vertices = {} #{A:{B:10}} #Agregar vertice. def addVertex(self,vertex): self.vertices["%s" % (vertex.name)] = vertex.edges #imrpimir el grafo. def printGraph(self): graf = self.vertices for k,v in graf.items(): for aris,w in v.items(): print("Vertice:%s\tArista:%s - peso:%s" % (k,aris,w)) #Busca el peso entre un Vertice y Otro. def searchEdgeWeight(self,nameVertex1,nameVertex2): for k,v in self.vertices.items(): #k = str, v = dict if(k == nameVertex1): for aris,w in v.items(): if(aris == nameVertex2): return w #Retorna el peso entre las aristas. #------------------------------------------------------------------------------------------------------------------- #Clase para encontrar las rutas de un grafo. class BuildPaths: def __init__(self): self.stack = [] self.paths = [] #Encuentra y guarda TODAS las rutas entre un vertice origen, a un destino. def findPaths(self,start,destination,dict): self.stack.append([start]) #Agrega el vertice inicio. while self.stack: #Mientras la cola tenga valores. tempPath = self.stack.pop() #Extra el ultimo indice de la lista. key = tempPath[-1] #Extrae el ultimo valor del elemento. for i in self.subtractLists(dict[key],tempPath): #Llama a la funcion que 'resta' los elementos de las listas dadas, devolviendo otra lista. if i == destination: #Stop si el valor de la 'resta' es el destino deseado. self.paths.append(tempPath + [i]) #Se agrega a la variable de rutas. else: self.stack.append(tempPath + [i]) #En caso que no sea el valor destino, se sigue agregando rutas, volviendo al while. #'Resta' los valores de las listas dadas. #ejm: ['A','B','C'] - ['A','C'] = ['B'] def subtractLists(self,listaA,listaB): listTemp = [] for i in listaA: #print(i[0]) if i[0] in listaB: pass else: listTemp.append(i[0]) return listTemp def getPaths(self): return self.paths
9c435a42cdc60fb08b9624fc926efccf8f66c4b1
5da5473ff3026165a47f98744bac82903cf008e0
/packages/google-cloud-alloydb/google/cloud/alloydb_v1/services/alloy_db_admin/transports/grpc_asyncio.py
1472c7e2d2d253937db5f0bc67d4dde86f67efb8
[ "Apache-2.0" ]
permissive
googleapis/google-cloud-python
ed61a5f03a476ab6053870f4da7bc5534e25558b
93c4e63408c65129422f65217325f4e7d41f7edf
refs/heads/main
2023-09-04T09:09:07.852632
2023-08-31T22:49:26
2023-08-31T22:49:26
16,316,451
2,792
917
Apache-2.0
2023-09-14T21:45:18
2014-01-28T15:51:47
Python
UTF-8
Python
false
false
50,442
py
# -*- coding: utf-8 -*- # Copyright 2023 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union import warnings from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.protobuf import empty_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.alloydb_v1.types import resources, service from .base import DEFAULT_CLIENT_INFO, AlloyDBAdminTransport from .grpc import AlloyDBAdminGrpcTransport class AlloyDBAdminGrpcAsyncIOTransport(AlloyDBAdminTransport): """gRPC AsyncIO backend transport for AlloyDBAdmin. Service describing handlers for resources This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation and call it. It sends protocol buffers over the wire using gRPC (which is built on top of HTTP/2); the ``grpcio`` package must be installed. """ _grpc_channel: aio.Channel _stubs: Dict[str, Callable] = {} @classmethod def create_channel( cls, host: str = "alloydb.googleapis.com", credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is ignored if ``channel`` is provided. scopes (Optional[Sequence[str]]): A optional list of scopes needed for this service. These are only used when credentials are not specified and are passed to :func:`google.auth.default`. quota_project_id (Optional[str]): An optional project to use for billing and quota. kwargs (Optional[dict]): Keyword arguments, which are passed to the channel creation. Returns: aio.Channel: A gRPC AsyncIO channel object. """ return grpc_helpers_async.create_channel( host, credentials=credentials, credentials_file=credentials_file, quota_project_id=quota_project_id, default_scopes=cls.AUTH_SCOPES, scopes=scopes, default_host=cls.DEFAULT_HOST, **kwargs, ) def __init__( self, *, host: str = "alloydb.googleapis.com", credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, channel: Optional[aio.Channel] = None, api_mtls_endpoint: Optional[str] = None, client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. Args: host (Optional[str]): The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. This argument is ignored if ``channel`` is provided. credentials_file (Optional[str]): A file with credentials that can be loaded with :func:`google.auth.load_credentials_from_file`. This argument is ignored if ``channel`` is provided. scopes (Optional[Sequence[str]]): A optional list of scopes needed for this service. These are only used when credentials are not specified and are passed to :func:`google.auth.default`. channel (Optional[aio.Channel]): A ``Channel`` instance through which to make calls. api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from ``client_cert_source`` or application default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for the grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, both in PEM format. It is used to configure a mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): The client info used to send a user-agent string along with API requests. If ``None``, then default info will be used. Generally, you only need to set this if you're developing your own client library. always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. Raises: google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport creation failed for any reason. google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials self._stubs: Dict[str, Callable] = {} self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) if client_cert_source: warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: # Ignore credentials if a channel was passed. credentials = False # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None else: if api_mtls_endpoint: host = api_mtls_endpoint # Create SSL credentials with client_cert_source or application # default SSL credentials. if client_cert_source: cert, key = client_cert_source() self._ssl_channel_credentials = grpc.ssl_channel_credentials( certificate_chain=cert, private_key=key ) else: self._ssl_channel_credentials = SslCredentials().ssl_credentials else: if client_cert_source_for_mtls and not ssl_channel_credentials: cert, key = client_cert_source_for_mtls() self._ssl_channel_credentials = grpc.ssl_channel_credentials( certificate_chain=cert, private_key=key ) # The base transport sets the host, credentials and scopes super().__init__( host=host, credentials=credentials, credentials_file=credentials_file, scopes=scopes, quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, api_audience=api_audience, ) if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, # use the credentials which are saved credentials=self._credentials, # Set ``credentials_file`` to ``None`` here as # the credentials that we saved earlier should be used. credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), ("grpc.max_receive_message_length", -1), ], ) # Wrap messages. This must be done after self._grpc_channel exists self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: """Create the channel designed to connect to this service. This property caches on the instance; repeated calls return the same channel. """ # Return the channel from cache. return self._grpc_channel @property def operations_client(self) -> operations_v1.OperationsAsyncClient: """Create the client designed to process long-running operations. This property caches on the instance; repeated calls return the same client. """ # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel ) # Return the client from cache. return self._operations_client @property def list_clusters( self, ) -> Callable[ [service.ListClustersRequest], Awaitable[service.ListClustersResponse] ]: r"""Return a callable for the list clusters method over gRPC. Lists Clusters in a given project and location. Returns: Callable[[~.ListClustersRequest], Awaitable[~.ListClustersResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_clusters" not in self._stubs: self._stubs["list_clusters"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/ListClusters", request_serializer=service.ListClustersRequest.serialize, response_deserializer=service.ListClustersResponse.deserialize, ) return self._stubs["list_clusters"] @property def get_cluster( self, ) -> Callable[[service.GetClusterRequest], Awaitable[resources.Cluster]]: r"""Return a callable for the get cluster method over gRPC. Gets details of a single Cluster. Returns: Callable[[~.GetClusterRequest], Awaitable[~.Cluster]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_cluster" not in self._stubs: self._stubs["get_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/GetCluster", request_serializer=service.GetClusterRequest.serialize, response_deserializer=resources.Cluster.deserialize, ) return self._stubs["get_cluster"] @property def create_cluster( self, ) -> Callable[[service.CreateClusterRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the create cluster method over gRPC. Creates a new Cluster in a given project and location. Returns: Callable[[~.CreateClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_cluster" not in self._stubs: self._stubs["create_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateCluster", request_serializer=service.CreateClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_cluster"] @property def update_cluster( self, ) -> Callable[[service.UpdateClusterRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the update cluster method over gRPC. Updates the parameters of a single Cluster. Returns: Callable[[~.UpdateClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_cluster" not in self._stubs: self._stubs["update_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/UpdateCluster", request_serializer=service.UpdateClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_cluster"] @property def delete_cluster( self, ) -> Callable[[service.DeleteClusterRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the delete cluster method over gRPC. Deletes a single Cluster. Returns: Callable[[~.DeleteClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_cluster" not in self._stubs: self._stubs["delete_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/DeleteCluster", request_serializer=service.DeleteClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_cluster"] @property def promote_cluster( self, ) -> Callable[[service.PromoteClusterRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the promote cluster method over gRPC. Promotes a SECONDARY cluster. This turns down replication from the PRIMARY cluster and promotes a secondary cluster into its own standalone cluster. Imperative only. Returns: Callable[[~.PromoteClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "promote_cluster" not in self._stubs: self._stubs["promote_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/PromoteCluster", request_serializer=service.PromoteClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["promote_cluster"] @property def restore_cluster( self, ) -> Callable[[service.RestoreClusterRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the restore cluster method over gRPC. Creates a new Cluster in a given project and location, with a volume restored from the provided source, either a backup ID or a point-in-time and a source cluster. Returns: Callable[[~.RestoreClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restore_cluster" not in self._stubs: self._stubs["restore_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/RestoreCluster", request_serializer=service.RestoreClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["restore_cluster"] @property def create_secondary_cluster( self, ) -> Callable[ [service.CreateSecondaryClusterRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create secondary cluster method over gRPC. Creates a cluster of type SECONDARY in the given location using the primary cluster as the source. Returns: Callable[[~.CreateSecondaryClusterRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_secondary_cluster" not in self._stubs: self._stubs["create_secondary_cluster"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateSecondaryCluster", request_serializer=service.CreateSecondaryClusterRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_secondary_cluster"] @property def list_instances( self, ) -> Callable[ [service.ListInstancesRequest], Awaitable[service.ListInstancesResponse] ]: r"""Return a callable for the list instances method over gRPC. Lists Instances in a given project and location. Returns: Callable[[~.ListInstancesRequest], Awaitable[~.ListInstancesResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_instances" not in self._stubs: self._stubs["list_instances"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/ListInstances", request_serializer=service.ListInstancesRequest.serialize, response_deserializer=service.ListInstancesResponse.deserialize, ) return self._stubs["list_instances"] @property def get_instance( self, ) -> Callable[[service.GetInstanceRequest], Awaitable[resources.Instance]]: r"""Return a callable for the get instance method over gRPC. Gets details of a single Instance. Returns: Callable[[~.GetInstanceRequest], Awaitable[~.Instance]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_instance" not in self._stubs: self._stubs["get_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/GetInstance", request_serializer=service.GetInstanceRequest.serialize, response_deserializer=resources.Instance.deserialize, ) return self._stubs["get_instance"] @property def create_instance( self, ) -> Callable[[service.CreateInstanceRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the create instance method over gRPC. Creates a new Instance in a given project and location. Returns: Callable[[~.CreateInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_instance" not in self._stubs: self._stubs["create_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateInstance", request_serializer=service.CreateInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_instance"] @property def create_secondary_instance( self, ) -> Callable[ [service.CreateSecondaryInstanceRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the create secondary instance method over gRPC. Creates a new SECONDARY Instance in a given project and location. Returns: Callable[[~.CreateSecondaryInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_secondary_instance" not in self._stubs: self._stubs["create_secondary_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateSecondaryInstance", request_serializer=service.CreateSecondaryInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_secondary_instance"] @property def batch_create_instances( self, ) -> Callable[ [service.BatchCreateInstancesRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the batch create instances method over gRPC. Creates new instances under the given project, location and cluster. There can be only one primary instance in a cluster. If the primary instance exists in the cluster as well as this request, then API will throw an error. The primary instance should exist before any read pool instance is created. If the primary instance is a part of the request payload, then the API will take care of creating instances in the correct order. This method is here to support Google-internal use cases, and is not meant for external customers to consume. Please do not start relying on it; its behavior is subject to change without notice. Returns: Callable[[~.BatchCreateInstancesRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_instances" not in self._stubs: self._stubs["batch_create_instances"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/BatchCreateInstances", request_serializer=service.BatchCreateInstancesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["batch_create_instances"] @property def update_instance( self, ) -> Callable[[service.UpdateInstanceRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the update instance method over gRPC. Updates the parameters of a single Instance. Returns: Callable[[~.UpdateInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_instance" not in self._stubs: self._stubs["update_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/UpdateInstance", request_serializer=service.UpdateInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_instance"] @property def delete_instance( self, ) -> Callable[[service.DeleteInstanceRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the delete instance method over gRPC. Deletes a single Instance. Returns: Callable[[~.DeleteInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_instance" not in self._stubs: self._stubs["delete_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/DeleteInstance", request_serializer=service.DeleteInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_instance"] @property def failover_instance( self, ) -> Callable[ [service.FailoverInstanceRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the failover instance method over gRPC. Forces a Failover for a highly available instance. Failover promotes the HA standby instance as the new primary. Imperative only. Returns: Callable[[~.FailoverInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "failover_instance" not in self._stubs: self._stubs["failover_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/FailoverInstance", request_serializer=service.FailoverInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["failover_instance"] @property def inject_fault( self, ) -> Callable[[service.InjectFaultRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the inject fault method over gRPC. Injects fault in an instance. Imperative only. Returns: Callable[[~.InjectFaultRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "inject_fault" not in self._stubs: self._stubs["inject_fault"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/InjectFault", request_serializer=service.InjectFaultRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["inject_fault"] @property def restart_instance( self, ) -> Callable[ [service.RestartInstanceRequest], Awaitable[operations_pb2.Operation] ]: r"""Return a callable for the restart instance method over gRPC. Restart an Instance in a cluster. Imperative only. Returns: Callable[[~.RestartInstanceRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restart_instance" not in self._stubs: self._stubs["restart_instance"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/RestartInstance", request_serializer=service.RestartInstanceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["restart_instance"] @property def list_backups( self, ) -> Callable[[service.ListBackupsRequest], Awaitable[service.ListBackupsResponse]]: r"""Return a callable for the list backups method over gRPC. Lists Backups in a given project and location. Returns: Callable[[~.ListBackupsRequest], Awaitable[~.ListBackupsResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_backups" not in self._stubs: self._stubs["list_backups"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/ListBackups", request_serializer=service.ListBackupsRequest.serialize, response_deserializer=service.ListBackupsResponse.deserialize, ) return self._stubs["list_backups"] @property def get_backup( self, ) -> Callable[[service.GetBackupRequest], Awaitable[resources.Backup]]: r"""Return a callable for the get backup method over gRPC. Gets details of a single Backup. Returns: Callable[[~.GetBackupRequest], Awaitable[~.Backup]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_backup" not in self._stubs: self._stubs["get_backup"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/GetBackup", request_serializer=service.GetBackupRequest.serialize, response_deserializer=resources.Backup.deserialize, ) return self._stubs["get_backup"] @property def create_backup( self, ) -> Callable[[service.CreateBackupRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the create backup method over gRPC. Creates a new Backup in a given project and location. Returns: Callable[[~.CreateBackupRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_backup" not in self._stubs: self._stubs["create_backup"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateBackup", request_serializer=service.CreateBackupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["create_backup"] @property def update_backup( self, ) -> Callable[[service.UpdateBackupRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the update backup method over gRPC. Updates the parameters of a single Backup. Returns: Callable[[~.UpdateBackupRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_backup" not in self._stubs: self._stubs["update_backup"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/UpdateBackup", request_serializer=service.UpdateBackupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["update_backup"] @property def delete_backup( self, ) -> Callable[[service.DeleteBackupRequest], Awaitable[operations_pb2.Operation]]: r"""Return a callable for the delete backup method over gRPC. Deletes a single Backup. Returns: Callable[[~.DeleteBackupRequest], Awaitable[~.Operation]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_backup" not in self._stubs: self._stubs["delete_backup"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/DeleteBackup", request_serializer=service.DeleteBackupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["delete_backup"] @property def list_supported_database_flags( self, ) -> Callable[ [service.ListSupportedDatabaseFlagsRequest], Awaitable[service.ListSupportedDatabaseFlagsResponse], ]: r"""Return a callable for the list supported database flags method over gRPC. Lists SupportedDatabaseFlags for a given project and location. Returns: Callable[[~.ListSupportedDatabaseFlagsRequest], Awaitable[~.ListSupportedDatabaseFlagsResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_supported_database_flags" not in self._stubs: self._stubs[ "list_supported_database_flags" ] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/ListSupportedDatabaseFlags", request_serializer=service.ListSupportedDatabaseFlagsRequest.serialize, response_deserializer=service.ListSupportedDatabaseFlagsResponse.deserialize, ) return self._stubs["list_supported_database_flags"] @property def list_users( self, ) -> Callable[[service.ListUsersRequest], Awaitable[service.ListUsersResponse]]: r"""Return a callable for the list users method over gRPC. Lists Users in a given project and location. Returns: Callable[[~.ListUsersRequest], Awaitable[~.ListUsersResponse]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_users" not in self._stubs: self._stubs["list_users"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/ListUsers", request_serializer=service.ListUsersRequest.serialize, response_deserializer=service.ListUsersResponse.deserialize, ) return self._stubs["list_users"] @property def get_user(self) -> Callable[[service.GetUserRequest], Awaitable[resources.User]]: r"""Return a callable for the get user method over gRPC. Gets details of a single User. Returns: Callable[[~.GetUserRequest], Awaitable[~.User]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_user" not in self._stubs: self._stubs["get_user"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/GetUser", request_serializer=service.GetUserRequest.serialize, response_deserializer=resources.User.deserialize, ) return self._stubs["get_user"] @property def create_user( self, ) -> Callable[[service.CreateUserRequest], Awaitable[resources.User]]: r"""Return a callable for the create user method over gRPC. Creates a new User in a given project, location, and cluster. Returns: Callable[[~.CreateUserRequest], Awaitable[~.User]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_user" not in self._stubs: self._stubs["create_user"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/CreateUser", request_serializer=service.CreateUserRequest.serialize, response_deserializer=resources.User.deserialize, ) return self._stubs["create_user"] @property def update_user( self, ) -> Callable[[service.UpdateUserRequest], Awaitable[resources.User]]: r"""Return a callable for the update user method over gRPC. Updates the parameters of a single User. Returns: Callable[[~.UpdateUserRequest], Awaitable[~.User]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_user" not in self._stubs: self._stubs["update_user"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/UpdateUser", request_serializer=service.UpdateUserRequest.serialize, response_deserializer=resources.User.deserialize, ) return self._stubs["update_user"] @property def delete_user( self, ) -> Callable[[service.DeleteUserRequest], Awaitable[empty_pb2.Empty]]: r"""Return a callable for the delete user method over gRPC. Deletes a single User. Returns: Callable[[~.DeleteUserRequest], Awaitable[~.Empty]]: A function that, when called, will call the underlying RPC on the server. """ # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_user" not in self._stubs: self._stubs["delete_user"] = self.grpc_channel.unary_unary( "/google.cloud.alloydb.v1.AlloyDBAdmin/DeleteUser", request_serializer=service.DeleteUserRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, ) return self._stubs["delete_user"] def close(self): return self.grpc_channel.close() @property def delete_operation( self, ) -> Callable[[operations_pb2.DeleteOperationRequest], None]: r"""Return a callable for the delete_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_operation" not in self._stubs: self._stubs["delete_operation"] = self.grpc_channel.unary_unary( "/google.longrunning.Operations/DeleteOperation", request_serializer=operations_pb2.DeleteOperationRequest.SerializeToString, response_deserializer=None, ) return self._stubs["delete_operation"] @property def cancel_operation( self, ) -> Callable[[operations_pb2.CancelOperationRequest], None]: r"""Return a callable for the cancel_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, ) return self._stubs["cancel_operation"] @property def get_operation( self, ) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]: r"""Return a callable for the get_operation method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_operation" not in self._stubs: self._stubs["get_operation"] = self.grpc_channel.unary_unary( "/google.longrunning.Operations/GetOperation", request_serializer=operations_pb2.GetOperationRequest.SerializeToString, response_deserializer=operations_pb2.Operation.FromString, ) return self._stubs["get_operation"] @property def list_operations( self, ) -> Callable[ [operations_pb2.ListOperationsRequest], operations_pb2.ListOperationsResponse ]: r"""Return a callable for the list_operations method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_operations" not in self._stubs: self._stubs["list_operations"] = self.grpc_channel.unary_unary( "/google.longrunning.Operations/ListOperations", request_serializer=operations_pb2.ListOperationsRequest.SerializeToString, response_deserializer=operations_pb2.ListOperationsResponse.FromString, ) return self._stubs["list_operations"] @property def list_locations( self, ) -> Callable[ [locations_pb2.ListLocationsRequest], locations_pb2.ListLocationsResponse ]: r"""Return a callable for the list locations method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: self._stubs["list_locations"] = self.grpc_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, ) return self._stubs["list_locations"] @property def get_location( self, ) -> Callable[[locations_pb2.GetLocationRequest], locations_pb2.Location]: r"""Return a callable for the list locations method over gRPC.""" # Generate a "stub function" on-the-fly which will actually make # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: self._stubs["get_location"] = self.grpc_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, ) return self._stubs["get_location"] __all__ = ("AlloyDBAdminGrpcAsyncIOTransport",)
db98033897b4a03b67eadb5d8c0e7a324bc82fb5
1ebbe757b1143b774b7894f5c38552d7a03f45c2
/hm/python/Complexe.py
6f7a0a8d36ce98aa4191352b4261abdee27c4b70
[]
no_license
bertrandh123/2019-npfl104
92b5705a3851b2078a082df1a6a1a8604ec36fb8
496335f35beaa414f8b827d16c55b1b17b217329
refs/heads/master
2020-04-29T09:48:40.461869
2019-03-20T18:08:08
2019-03-20T18:08:08
176,038,978
0
0
null
null
null
null
UTF-8
Python
false
false
606
py
class Complexe: def __init__(self,re,im): self.re,self.im=re,im def add(self,r,i): self.re+=r self.im+=i def sub(self,r,i): self.re+=-r self.im+=-i def __str__(self): if self.im>0: print(str(self.re)+'+'+str(self.im)+'i') else: print(str(self.re)+str(self.im)+'i') print ("\n########## Class Complexe ##########\n") C=Complexe(4,-2) print('C=Complexe(4,-2)') print("C.__str__()") print(C.__str__()) C.add(1,6) print('C.add(1,6)') print("C.__str__()") print(C.__str__()) print ("\n######## End Class Complexe ########\n")
3d87924ec7d7fd9fcc0bcf9142588b70d3044ea6
04e2a63c2a393ec3782a482b1734b6462c885d5d
/univelcity/open_file.py
a5d41c60faaaf3883d1b9e76f60d5a9ad4ae687c
[]
no_license
AzeezBello/_python
c1d671efbca2ed2ca7d65513efd2c55b496ddad7
266bc5aed9bfb93ea93b07712b48406331a9a327
refs/heads/master
2020-05-17T18:09:49.133120
2019-05-16T07:08:50
2019-05-16T07:08:50
183,876,279
0
0
null
null
null
null
UTF-8
Python
false
false
3,299
py
# file = open("death_causes.csv", "r") # index = 0 # for line in file: # index += 1 # print(line.split(",")) # if index == 3: # break # # Year,Cause Name,Cause Name,State,Deaths,Age-adjusted Death Rate # file = open("death_causes.csv", "r") # deaths = 0 # count = 0 # for line in file: # if count == 0: # pass # else: # raw = line.split(",") # print(raw) # if raw[0] == "2014": # deaths += int(raw[4]) # count += 1 # print(deaths/365) # Year,Cause Name,Cause Name,State,Deaths,Age-adjusted Death Rate # with open("twist.txt", "r") as file: # for line in file: # print(line) # file.close() import pymysql.cursors class Mortality: def __init__(self, year, cause_name_full, cause_name, state, deaths, age_adjusted_death_rate): self.year = (year) self.cause_name_full = cause_name_full self.cause_name = cause_name self.state = state self.deaths = (deaths) self.age_adjusted_death_rate = age_adjusted_death_rate[:-1] # Connect to the database connection = pymysql.connect(host='localhost', user='root', password='', db='db', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) def create_table(name): with connection.cursor() as cursor: # Create a new record try: sql = f"""CREATE TABLE {name} (id int NOT NULL PRIMARY KEY AUTO_INCREMENT, year INT(4), cause_name_full TEXT, cause_name TEXT, state VARCHAR(50), deaths VARCHAR(50), age_adjusted_death_rate VARCHAR(50))""" cursor.execute(sql) connection.commit() except: # connection is not autocommit by default. So you must commit to save # your changes. print('Table Exists') def open_file(): file = open("death_causes.csv", "r") count = 0 for line in file: if count == 0: pass else: raw = line.split(",") # print(raw) new_mortality_object = Mortality( year = raw[0], cause_name_full = raw[1], cause_name= raw[2], state = raw[3], deaths = raw[4], age_adjusted_death_rate = raw[5]) post_to_db(new_mortality_object) count += 1 def post_to_db(mortality_object): with connection.cursor() as cursor: # Create a new record sql = f"""insert into mortality_rate (year, cause_name_full, cause_name, state, deaths, age_adjusted_death_rate) values ("{mortality_object.year}", "{mortality_object.cause_name_full}", "{mortality_object.cause_name}", "{mortality_object.state}", "{mortality_object.deaths}", "{mortality_object.age_adjusted_death_rate}")""" # print(sql) cursor.execute(sql) connection.commit() #CREATE TABLE IN DATABASE create_table("mortality_rate") #THEN PUSH FILES INTO TABLE open_file()
81eb6216326223d83778b2d3bd64fbec29228251
73758dde83d1a1823c103e1a4ba71e7c95168f71
/nsd2002/py02/day03/game_role.py
65eea729683ff4a6c379867472ab679b07dec8fa
[]
no_license
tonggh220/md_5_nsd_notes
07ffdee7c23963a7a461f2a2340143b0e97bd9e1
a58a021ad4c7fbdf7df327424dc518f4044c5116
refs/heads/master
2023-07-02T01:34:38.798929
2021-05-12T08:48:40
2021-05-12T08:48:40
393,885,415
0
0
null
null
null
null
UTF-8
Python
false
false
922
py
class Role: def __init__(self, name, weapon): # 构造器方法,实例化时自动调用,注意,self不是关键字,可以是任何自定义的变量 # 绑定在实例身上的属性,在类中任意位置可见可用 self.name = name self.weapon = weapon def show_me(self): # 绑定在实例身上的属性,在类中任意位置可见可用 print('我是%s,我擅用%s' % (self.name, self.weapon)) def speak(self, words): # 没有绑定在实例身上的变量,只是局部变量,只能用在函数中 hh = 'Hahaha' print(hh) print(words) if __name__ == '__main__': # 实例本身将会自动作为第一个参数传递,本例中是lb lb = Role('吕布', '方天画戟') # 实例化,创建具体的对象 print(lb.name, lb.weapon) lb.show_me() lb.speak('马中赤兔,人中吕布')
0332c4d5e620cd87f9b70d77e4f57a67c07e72a3
3b89c0a97ac6b58b6923a213bc8471e11ad4fe69
/python/CodingExercises/MoveSpacesFrontString.py
af9641cf57932b4daa0e84d62d196bc3aa65de22
[]
no_license
ksayee/programming_assignments
b187adca502ecf7ff7b51dc849d5d79ceb90d4a6
13bc1c44e1eef17fc36724f20b060c3339c280ea
refs/heads/master
2021-06-30T07:19:34.192277
2021-06-23T05:11:32
2021-06-23T05:11:32
50,700,556
1
3
null
null
null
null
UTF-8
Python
false
false
1,116
py
''' Move spaces to front of string in single traversal Given a string that has set of words and spaces, write a program to move all spaces to front of string, by traversing the string only once. Examples: Input : str = "geeks for geeks" Output : ste = " geeksforgeeks" Input : str = "move these spaces to beginning" Output : str = " movethesespacestobeginning" There were four space characters in input, all of them should be shifted in front. ''' def MoveSpacesFrontString(str1): output_list=[] lst=str1.split(' ') prev_word='' for word in lst: if len(word)==0: output_list.append(' ') else: if len(prev_word)>0: output_list.append(' ') prev_word=word output_list.append(''.join(lst)) return ''.join(output_list) def main(): str1="geeks for geeks" print(MoveSpacesFrontString(str1)) str1 = "move these spaces to beginning" print(MoveSpacesFrontString(str1)) str1 = "move these spaces to beginning" print(MoveSpacesFrontString(str1)) if __name__=='__main__': main()
dc105c937af95e74bf4880b57361a7470c141909
fb8cbebdf034b2f478943752d5443afc82c6eef5
/tuirer/venv/lib/python3.6/site-packages/jedi/evaluate/dynamic.py
fe9d28e5d70906257d64b55fcc219bbc2f5d3c6a
[]
no_license
fariasjr/CitiTuirer
f64e0ec93ef088f8140bb0961d2ad4ed3b59448a
deb3f7a9c2d45b8a7f54639037f097b99abdac11
refs/heads/master
2020-03-24T05:10:36.261050
2018-08-01T20:24:30
2018-08-01T20:24:30
142,477,521
0
0
null
null
null
null
UTF-8
Python
false
false
8,165
py
""" One of the really important features of |jedi| is to have an option to understand code like this:: def foo(bar): bar. # completion here foo(1) There's no doubt wheter bar is an ``int`` or not, but if there's also a call like ``foo('str')``, what would happen? Well, we'll just show both. Because that's what a human would expect. It works as follows: - |Jedi| sees a param - search for function calls named ``foo`` - execute these calls and check the input. """ from jedi import debug, settings from jedi.evaluate import imports from jedi.evaluate.arguments import TreeArguments from jedi.evaluate.base_context import ContextSet from jedi.evaluate.cache import evaluator_function_cache from jedi.evaluate.context import ModuleContext, instance from jedi.evaluate.helpers import is_stdlib_path from jedi.evaluate.param import create_default_params from jedi.evaluate.utils import to_list from jedi.parser_utils import get_parent_scope from parso.python import tree MAX_PARAM_SEARCHES = 20 class MergedExecutedParams(object): """ Simulates being a parameter while actually just being multiple params. """ def __init__(self, executed_params): self._executed_params = executed_params def infer(self): return ContextSet.from_sets(p.infer() for p in self._executed_params) @debug.increase_indent def search_params(evaluator, execution_context, funcdef): """ A dynamic search for param values. If you try to complete a type: >>> def func(foo): ... foo >>> func(1) >>> func("") It is not known what the type ``foo`` without analysing the whole code. You have to look for all calls to ``func`` to find out what ``foo`` possibly is. """ if not settings.dynamic_params: return create_default_params(execution_context, funcdef) evaluator.dynamic_params_depth += 1 try: path = execution_context.get_root_context().py__file__() if path is not None and is_stdlib_path(path): # We don't want to search for usages in the stdlib. Usually people # don't work with it (except if you are a core maintainer, sorry). # This makes everything slower. Just disable it and run the tests, # you will see the slowdown, especially in 3.6. return create_default_params(execution_context, funcdef) if funcdef.type == 'lambdef': string_name = _get_lambda_name(funcdef) if string_name is None: return create_default_params(execution_context, funcdef) else: string_name = funcdef.name.value debug.dbg('Dynamic param search in %s.', string_name, color='MAGENTA') try: module_context = execution_context.get_root_context() function_executions = _search_function_executions( evaluator, module_context, funcdef, string_name=string_name, ) if function_executions: zipped_params = zip(*list( function_execution.get_params() for function_execution in function_executions )) params = [MergedExecutedParams(executed_params) for executed_params in zipped_params] # Evaluate the ExecutedParams to types. else: return create_default_params(execution_context, funcdef) finally: debug.dbg('Dynamic param result finished', color='MAGENTA') return params finally: evaluator.dynamic_params_depth -= 1 @evaluator_function_cache(default=None) @to_list def _search_function_executions(evaluator, module_context, funcdef, string_name): """ Returns a list of param names. """ compare_node = funcdef if string_name == '__init__': cls = get_parent_scope(funcdef) if isinstance(cls, tree.Class): string_name = cls.name.value compare_node = cls found_executions = False i = 0 for for_mod_context in imports.get_modules_containing_name( evaluator, [module_context], string_name): if not isinstance(module_context, ModuleContext): return for name, trailer in _get_possible_nodes(for_mod_context, string_name): i += 1 # This is a simple way to stop Jedi's dynamic param recursion # from going wild: The deeper Jedi's in the recursion, the less # code should be evaluated. if i * evaluator.dynamic_params_depth > MAX_PARAM_SEARCHES: return random_context = evaluator.create_context(for_mod_context, name) for function_execution in _check_name_for_execution( evaluator, random_context, compare_node, name, trailer): found_executions = True yield function_execution # If there are results after processing a module, we're probably # good to process. This is a speed optimization. if found_executions: return def _get_lambda_name(node): stmt = node.parent if stmt.type == 'expr_stmt': first_operator = next(stmt.yield_operators(), None) if first_operator == '=': first = stmt.children[0] if first.type == 'name': return first.value return None def _get_possible_nodes(module_context, func_string_name): try: names = module_context.tree_node.get_used_names()[func_string_name] except KeyError: return for name in names: bracket = name.get_next_leaf() trailer = bracket.parent if trailer.type == 'trailer' and bracket == '(': yield name, trailer def _check_name_for_execution(evaluator, context, compare_node, name, trailer): from jedi.evaluate.context.function import FunctionExecutionContext def create_func_excs(): arglist = trailer.children[1] if arglist == ')': arglist = None args = TreeArguments(evaluator, context, arglist, trailer) if value_node.type == 'classdef': created_instance = instance.TreeInstance( evaluator, value.parent_context, value, args ) for execution in created_instance.create_init_executions(): yield execution else: yield value.get_function_execution(args) for value in evaluator.goto_definitions(context, name): value_node = value.tree_node if compare_node == value_node: for func_execution in create_func_excs(): yield func_execution elif isinstance(value.parent_context, FunctionExecutionContext) and \ compare_node.type == 'funcdef': # Here we're trying to find decorators by checking the first # parameter. It's not very generic though. Should find a better # solution that also applies to nested decorators. params = value.parent_context.get_params() if len(params) != 1: continue values = params[0].infer() nodes = [v.tree_node for v in values] if nodes == [compare_node]: # Found a decorator. module_context = context.get_root_context() execution_context = next(create_func_excs()) for name, trailer in _get_possible_nodes(module_context, params[0].string_name): if value_node.start_pos < name.start_pos < value_node.end_pos: random_context = evaluator.create_context(execution_context, name) iterator = _check_name_for_execution( evaluator, random_context, compare_node, name, trailer ) for function_execution in iterator: yield function_execution
8518901c7fdfc473318b9f996ce5871326d2e0c8
e96f82c65d7b0b5acf1f98e573b695afda122698
/Amusing Joke.py
315cbfec9e418b84ae68d1a3a06a79c9b8f506d7
[]
no_license
devinemonk/CodeForces-Python
66525fe4b91a2fe780603931f81ec4aa30082315
def55f4c8651ebe70920c8d8e01ed09e4aeafd4e
refs/heads/master
2023-08-17T23:34:48.621928
2023-08-07T22:02:02
2023-08-07T22:02:02
288,174,825
2
0
null
null
null
null
UTF-8
Python
false
false
227
py
s=input()+input() s=s.upper() d={} for i in range(ord('A'),ord('Z')+1): d[chr(i)]=0 for i in s: d[i]+=1 c=input() for i in c: d[i]-=1 for i in d: if d[i]!=0: print("NO") exit() print("YES")
7bcb8b925acf750edd56ecb347e2fd0945a767c0
18831623126751bfe3dc7f7d8291de2066a01c06
/sha2.py
f8d889959b2819e7e473b5237b3b2431d76715d4
[]
no_license
mnoalett/ringzer0-ctf
e8fbe3ee3722c56c5b03831c21522ca4ef14dab1
fd76d83fe8a9d42ca7798c9dff43fc8e3d6645b1
refs/heads/master
2020-04-14T12:58:34.373073
2019-01-02T15:17:09
2019-01-02T15:17:09
163,855,742
0
0
null
null
null
null
UTF-8
Python
false
false
982
py
import hashlib import requests import re url = "https://ringzer0ctf.com/login" url_res = "https://ringzer0ctf.com/challenges/57/" payload = {'username': 'xxx', 'password': 'xxx'} hash_regex = "-----BEGINHASH-----<br\/>(\w+)" salt_regex = "-----BEGINSALT-----<br\/>(\w+)" flag = "FLAG-\w+" session = requests.Session() session.post(url, data=payload) contents = session.get(url_res) message = re.sub(r'\s+', '', contents.text) sha1 = re.search(hash_regex,message) sha1 = sha1.group(1) salt = re.search(salt_regex,message) salt = salt.group(1) print("sha1: "+sha1) print("salt: "+salt) for i in range(0,9999): num = str(i).encode('utf-8') encoded1 = hashlib.sha1(salt+num).hexdigest() encoded2 = hashlib.sha1(num+salt).hexdigest() if(encoded1==sha1 or encoded2==sha1): trovato = i print("Cracked: " + num) break url_res = url_res + str(trovato) response = session.post(url_res) flg = re.search(flag,response.text) print(flg.group())
9adaaa8a0991643c934d8ca118ce9b52964bcf0c
6de78731b9626459b95718dc15398850143b024c
/CNN/Keras/predict_bigtiff.py
e5f0623974d96eaa2f45b6a13c55cf2d772a35d7
[]
no_license
ghx1234/RSDataProcess
08999e83b6693df161af088112d66fbad1189c4a
098b51d4f25923968b00ac5bd40e3f2440d5b33a
refs/heads/master
2022-12-01T05:59:29.056334
2020-08-14T14:55:24
2020-08-14T14:55:24
265,778,277
5
1
null
null
null
null
UTF-8
Python
false
false
2,390
py
import os import sys import numpy as np from PIL import Image import gdal import rasterio import tensorflow as tf from model import * def z_score(x): return (x - np.mean(x)) / np.std(x, ddof=1) def read_img(path): with rasterio.open(path) as ds: data = ds.read( out_shape=(ds.count, 512, 512), # resampling=Resampling.bilinear ) data = z_score(data) img = np.transpose(data, (1, 2, 0)) # (batch, H, W, B) return img def predict(image): # resize to max dimension of images from training dataset w, h, _ = image.shape res = model.predict(np.expand_dims(image, 0)) sess =tf.Session() activate = tf.nn.log_softmax(res) res = sess.run(activate) labels = np.argmax(np.array(res).squeeze(), -1) # remove padding and resize back to original image labels = np.array(Image.fromarray(labels.astype('uint8'))) # labels = np.array(Image.fromarray(labels.astype('uint8')).resize((h, w))) return labels if __name__=='__main__': in_folder = '/home/zhoudengji/ghx/code/predict/img' out_folder = '/home/zhoudengji/ghx/code/predict/predict/WO' model = mwen(pretrained_weights=None, input_shape=(None, 512, 512, 4), class_num=2) model.load_weights('/home/zhoudengji/ghx/code/unet-master/womtfe/weights-04-0.98.hdf5') for name in os.listdir(in_folder): img_path = os.path.join(in_folder, name) ds = gdal.Open(img_path) result = gdal.GetDriverByName("GTiff").Create(os.path.join(out_folder, name), int(np.floor(ds.RasterXSize / 512)) * 512, int(np.floor(ds.RasterYSize / 512)) * 512, 1, gdal.GDT_Byte) 2 ###这里最好不要像这样直接一块一块的取,需要去掉带边缘信息的像素 for x in range(int(np.floor(ds.RasterXSize / 512))): for y in range(int(np.floor(ds.RasterYSize / 512))): img = ds.ReadAsArray(x * 512, y * 512, 512, 512) img = z_score(img) img = np.transpose(img, (1, 2, 0)) img = predict(img) result.GetRasterBand(1).WriteArray(img, xoff=x * 512, yoff=y * 512) result.SetGeoTransform(ds.GetGeoTransform()) # 写入仿射变换参数 result.SetProjection(ds.GetProjection()) # 写入投影
238a9c00d0ee9241b740aa701da20a49250c30a6
e2d1036d29aa0cb2b46a2be6bba91a1c5d5556aa
/Self_Driving/train_and_val_predictor_single.py
e78f4a5f3db9afeca4b4ca2227c502d16a57b727
[]
no_license
Liuzy0908/SB3-Carla
79eaad128ba649c202bee27dded6e240e76863ac
f9cfb9108463ed15aee81c36abdb4eb87c15be6c
refs/heads/main
2023-08-17T02:04:46.085064
2021-02-14T04:58:32
2021-02-14T04:58:32
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,540
py
import numpy as np import torch import argparse import os.path as osp import torch.nn as nn from models.model_predictor_single_resnet18 import Predictor_single from dataset.sem_predictor_single_roadline import Sem_predictor_single import wandb argparser = argparse.ArgumentParser(description=__doc__) argparser.add_argument( '--lr', type=float, default=1e-4, help='learning rate (default: 1e-4)') argparser.add_argument( '--wandb-username', type=str, help='account username of wandb') argparser.add_argument( '--wandb-project', type=str, help='project name of wandb') argparser.add_argument( '--dataset-dir', type=str, help='relative directory of training dataset') argparser.add_argument( '--save-dir', type=str, help='relative directory to save the weight files') argparser.add_argument( '--train-batch', type=int, default=64, help='batch size for training') argparser.add_argument( '--test-batch', type=int, default=64, help='batch size for validation') argparser.add_argument( '--num-epochs', type=int, default=20, help='number of epochs to train') args = argparser.parse_args() wandb.init(entity=args.wandb_username, project=args.wandb_project) config = wandb.config config.batch_size = args.train_batch config.test_batch_size = args.test_batch config.epochs = args.num_epochs config.lr = args.lr config.log_interval = 10 all_sem_cls = [7] train_dataset = Sem_predictor_single(args.dataset_dir, all_sem_cls, 'train') train_loader = torch.utils.data.DataLoader( train_dataset, batch_size=config.batch_size, shuffle=True, num_workers=10, pin_memory=True, sampler=None) test_dataset = Sem_predictor_single(args.dataset_dir, all_sem_cls, 'test') test_loader = torch.utils.data.DataLoader( test_dataset, batch_size=config.test_batch_size, shuffle=False, num_workers=6, pin_memory=True, sampler=None) lmbda = lambda epoch: 0.95 if epoch < 10 else 0.9 models = [] optimizers = [] for sem_id in range(13): if sem_id not in all_sem_cls: models.append(None) optimizers.append(None) else: model = Predictor_single().cuda() wandb.watch(model, log='all') models.append(model) optimizer = torch.optim.Adam(model.parameters(), args.lr) optimizers.append(optimizer) scheduler = torch.optim.lr_scheduler.LambdaLR(optimizer, lr_lambda=lmbda) def train(epoch, train_loader, models): for model in models: if model: model.train() keep_ratio = 0.99 ave_losses = {} for sem_id in range(13): ave_losses[sem_id] = 0 for i, (image, label) in enumerate(train_loader, 1): for sem_id in all_sem_cls: image_iter = image[sem_id].cuda() # (B, 1, 48, 48) target = label[sem_id].cuda() # (B, 1) pred_dis = models[sem_id](image_iter).cuda() # (B, 1) loss_fn_dis = nn.MSELoss().cuda() loss = loss_fn_dis(pred_dis, target) optimizers[sem_id].zero_grad() loss.backward() optimizers[sem_id].step() if i == 1: ave_losses[sem_id] = loss else: ave_losses[sem_id] = ave_losses[sem_id] * keep_ratio + loss * (1 - keep_ratio) if i % 50 == 1: print('epoch {}, {}/{}, total_loss={:.4f}' .format(epoch, i, len(train_loader), sum(ave_losses.values()))) for sem_id in all_sem_cls: wandb.log({'train loss %02d' % sem_id: ave_losses[sem_id]}) def test(epoch, test_loader, models): print('start validation') for model in models: if model: model.eval() with torch.no_grad(): ave_losses = {} for sem_id in range(13): ave_losses[sem_id] = 0 example_images = [] for i, (image, label) in enumerate(test_loader, 1): for sem_id in all_sem_cls: image_iter = image[sem_id].cuda() # (B, 1, 48, 48) target = label[sem_id].cuda() # (B, 1) pred_dis = models[sem_id](image_iter).cuda() # (B, 1) loss_fn_dis = nn.MSELoss().cuda() loss = loss_fn_dis(pred_dis, target) if i == 1: ave_losses[sem_id] = loss else: ave_losses[sem_id] = ave_losses[sem_id] * (i - 1) / i + loss * 1 / i if i == 1: if sem_id == 12: for j in range(len(image[12])): example_images.append(wandb.Image(image[12][j], caption="Pred: {}, Truth: {}".format(pred_dis[j], target[j]))) print('batch', i, '/', len(test_loader)) wandb.log({'Examples': example_images}) for sem_id in all_sem_cls: wandb.log({'test loss %02d' % sem_id: ave_losses[sem_id]}) if __name__ == "__main__": test(0, test_loader, models) for epoch in range(1, config.epochs+1): train(epoch, train_loader, models) test(epoch, test_loader, models) scheduler.step() save_path = args.save_dir for sem_id in all_sem_cls: torch.save(models[sem_id].state_dict(), osp.join(save_path, str(sem_id), 'epoch-%02d.pth' % (epoch))) wandb.save(osp.join(save_path, str(sem_id), 'epoch-%02d.pth' % (epoch)))
6967044ffd32e1f589f9a6643e7ba3dba2822a94
7c19d1198bff566c7cde15ddf5876470b05815cf
/sentiments_neural_network_cpu.py
d8001d8b47cb8a46f4f9b9b620a7b04ac45ae867
[]
no_license
nikil21/Sentiment-Analysis
48bf2123f1f10ef98c9bb838da6a79b556231426
94f91dcf1dd6016dff734ec66cda6e492e22510a
refs/heads/main
2023-06-28T11:00:09.163564
2021-08-04T14:14:02
2021-08-04T14:14:02
392,713,780
0
0
null
null
null
null
UTF-8
Python
false
false
3,046
py
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' os.environ['CUDA_VISIBLE_DEVICES'] = '-1' import tensorflow.compat.v1 as tf tf.disable_v2_behavior() from create_sentiment_featuresets import create_feature_sets_and_labels #from tensorflow.examples.tutorials.mnist import input_data import pickle import numpy as np train_x,train_y,test_x,test_y = create_feature_sets_and_labels('pos.txt','neg.txt') n_classes = 2 batch_size = 100 hm_epochs = 10 n_nodes_hl1 = 1500 n_nodes_hl2 = 1500 n_nodes_hl3 = 1500 W1 = tf.Variable(tf.random.normal([len(train_x[0]), n_nodes_hl1])) B1 = tf.Variable(tf.random.normal([n_nodes_hl1])) W2 = tf.Variable(tf.random.normal([n_nodes_hl1, n_nodes_hl2])) B2 = tf.Variable(tf.random.normal([n_nodes_hl2])) W3 = tf.Variable(tf.random.normal([n_nodes_hl2, n_nodes_hl3])) B3 = tf.Variable(tf.random.normal([n_nodes_hl3])) W4 = tf.Variable(tf.random.normal([n_nodes_hl3, n_classes])) B4 = tf.Variable(tf.random.normal([n_classes])) x = tf.placeholder('float') y = tf.placeholder('float') hidden_1_layer = {'f_fum':n_nodes_hl1, 'weight': W1, 'bias':B1} hidden_2_layer = {'f_fum':n_nodes_hl2, 'weight':W2, 'bias':B2} hidden_3_layer = {'f_fum':n_nodes_hl3, 'weight':W3, 'bias':B3} output_layer = {'f_fum':None, 'weight': W4, 'bias': B4,} # Nothing changes def neural_network_model(data): l1 = tf.add(tf.matmul(data,hidden_1_layer['weight']), hidden_1_layer['bias']) l1 = tf.nn.relu(l1) l2 = tf.add(tf.matmul(l1,hidden_2_layer['weight']), hidden_2_layer['bias']) l2 = tf.nn.relu(l2) l3 = tf.add(tf.matmul(l2,hidden_3_layer['weight']), hidden_3_layer['bias']) l3 = tf.nn.relu(l3) output = tf.matmul(l3,output_layer['weight']) + output_layer['bias'] return output def train_neural_network(x): prediction = neural_network_model(x) # OLD VERSION: #cost = tf.reduce_mean( tf.nn.softmax_cross_entropy_with_logits(prediction,y) ) # NEW: cost = tf.reduce_mean( tf.nn.softmax_cross_entropy_with_logits(logits=prediction, labels=y)) optimizer = tf.train.AdamOptimizer(learning_rate=0.001).minimize(cost) with tf.Session() as sess: # OLD: #sess.run(tf.initialize_all_variables()) # NEW: sess.run(tf.global_variables_initializer()) for epoch in range(hm_epochs): epoch_loss = 0 i=0 while i < len(train_x): start = i end = i+batch_size batch_x = np.array(train_x[start:end]) batch_y = np.array(train_y[start:end]) _, c = sess.run([optimizer, cost], feed_dict={x: batch_x, y: batch_y}) epoch_loss += c i+=batch_size print('Epoch', epoch+1, 'completed out of',hm_epochs,'loss:',epoch_loss) correct = tf.equal(tf.argmax(prediction, 1), tf.argmax(y, 1)) accuracy = tf.reduce_mean(tf.cast(correct, 'float')) print('Accuracy:',accuracy.eval({x:test_x, y:test_y})) train_neural_network(x)
1daefdaaf3cdc9dbbd4d888acd5c05d94d6285dd
85c337f0364f1452c068b7e93421b3e24af85358
/MzManage/manage.py
362fb7bb3d7af3d8d0dfab2d09b3c4fb6b0b78a7
[]
no_license
hornLK/AuthSystemWeb
9518f23453f910e17c516db26ea3a00fe0d0c806
c2c03ff2133151889a2ecc205a753a0eb2bbfd91
refs/heads/master
2022-12-14T19:18:00.560077
2018-04-19T12:39:14
2018-04-19T12:39:14
130,317,561
0
0
null
2022-12-08T00:59:04
2018-04-20T06:17:08
JavaScript
UTF-8
Python
false
false
540
py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "MzManage.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv)
347502a5063ca3f7fdbb96e81aadf62f71a48dae
97e534b26a76bf0d954e166841179979748bcfa2
/objects/migrations/0046_auto_20180625_0823.py
d6855e81eb891d0362368b4d406690be5fbde2c7
[]
no_license
mehdi1361/http_server
3a8bd73ce44307ee2b7761d1211671ca8cb0f3ba
d8a962c55165ef0237bfb26d27d9cfa11a415a5d
refs/heads/develop
2022-12-11T00:44:11.089407
2019-01-20T12:02:48
2019-01-20T12:02:48
166,656,299
0
0
null
2022-12-07T23:53:22
2019-01-20T12:02:05
HTML
UTF-8
Python
false
false
958
py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-06-25 08:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('objects', '0045_auto_20180625_0724'), ] operations = [ migrations.AddField( model_name='league', name='play_off_start_gem_1', field=models.PositiveIntegerField(blank=True, null=True, verbose_name='play off start gem 1'), ), migrations.AddField( model_name='league', name='play_off_start_gem_2', field=models.PositiveIntegerField(blank=True, null=True, verbose_name='play off start gem 2'), ), migrations.AlterField( model_name='league', name='play_off_start_gem', field=models.PositiveIntegerField(blank=True, null=True, verbose_name='play off start gem '), ), ]
3fb2a9f1ae58ad0743c9d750da7afc275cf304bf
0cc4eb3cb54f8394c127ace62d3108fdb5230c85
/.spack-env/view/lib/python3.7/test/test_multibytecodec.py
7384d370794ac8065a971022cc5463d45a9edc2d
[]
no_license
jacobmerson/spack-develop-env
5b2d76f58c0b64ae97c64f77a3c4d33a770c71c8
5fca20ca343b1a76f05fc635c87f94ed25417d94
refs/heads/master
2022-07-04T02:22:50.264727
2020-05-06T05:13:50
2020-05-06T05:13:50
261,657,112
0
0
null
null
null
null
UTF-8
Python
false
false
151
py
/lore/mersoj/spack/spack/opt/spack/linux-rhel7-x86_64/gcc-7.3.0/python-3.7.7-oihhthdoxtgh4krvzpputn5ozwcnq2by/lib/python3.7/test/test_multibytecodec.py
b6fb7824bcb1ed5a6f2dcd398fe4e45eb19507f4
74a8defffc8d01804e5f65b0c5857accd8ff144b
/predict.py
3e6f0ba84f1bc671c92dbbd02cefa346d4cf94fc
[]
no_license
DanferWang/NUS-SoC-Summer-Workshop
cb75bbd27ac52829384c984991255ac68407b8bc
68f1e3f27634cb131b2c9032be16ee20b2ee7d5f
refs/heads/master
2021-10-07T13:53:45.010267
2021-10-05T15:13:42
2021-10-05T15:13:42
202,662,046
4
0
null
null
null
null
UTF-8
Python
false
false
940
py
from __future__ import print_function from tensorflow.python.keras.models import load_model import tensorflow as tf import numpy as numpy from PIL import Image MODEL_NAME='flowers.hd5' dict={0:'daisy',1:'dandelion',2:'roses',3:'sunflowers',4:'tulips'} graph = tf.compat.v1.get_default_graph() def classify(model,image): global graph with graph.as_default(): result=model.predict(image) themax=np.argmax(result) return(dict[themax],result[0][themax],themax) def load_image(image_fname): img=Image.open(image_fname) img=img.resize((249,249)) imgarray=np.array(img)/255.0 final=np.expand_dims(imgarray,axis=0) return final def main(): model=load_model(MODEL_NAME) img=load_image("what.jpg") label,prob,_=classify(model,img) print "We think with certainty %3.2f that it is %s."%(prob,label) if __name__=="__main___": main()
914e5a276b7849b267a4458ca7c0afd16ec3f18e
3f73ce74b6fdfb7966abb71a98f4986edd727c5f
/lib/config.py
9d9e5784d61265a408685b6fae7a08e8e51d01e0
[ "MIT" ]
permissive
yuta-komura/amateras
9c2efd310b18f159b1354864d65f9894ab93737f
cf8cc8fe0b5d8c382090fd1784a3ce96e6953157
refs/heads/master
2023-01-21T19:57:18.763894
2020-11-25T04:02:28
2020-11-25T04:02:28
297,432,974
0
0
null
null
null
null
UTF-8
Python
false
false
695
py
from enum import Enum PROJECT_DIR = __file__.replace("/lib/config.py", "") class HistoricalPrice(Enum): TIME_FRAME = 60 # minutes CHANNEL_WIDTH = 67 class DATABASE(Enum): class TRADINGBOT(Enum): HOST = "*********" USER = "*********" PASSWORD = "*********" DATABASE = "*********" class Bitflyer(Enum): class Api(Enum): KEY = "*********" SECRET = "*********" class DirPath(Enum): PROJECT = PROJECT_DIR class FilePath(Enum): WARNING_MP3 = PROJECT_DIR + "/sound/WARNING.mp3" ERROR_MP3 = PROJECT_DIR + "/sound/ERROR.mp3" SYSTEM_LOG = PROJECT_DIR + "/log/system.log" AA = PROJECT_DIR + "/document/AA.txt"
bdc1adf3b722a4189eb19fb531d5aaf9776a50da
a528b0a05da4cab12a6c73c8d6de8aeab607d00c
/sortByHeaderStr.py
625f46be5d2a1ef01b35df56a7f9b0889ee0a0f2
[]
no_license
mahassani/SynCom_scripts
77d007d64ccb66d7e01c216fdbb8b90a34095f99
67ff5ecff1c0cb084e83b8fbe678408db497a776
refs/heads/master
2021-06-21T19:28:33.697395
2017-08-17T15:33:05
2017-08-17T15:33:05
100,614,899
0
1
null
null
null
null
UTF-8
Python
false
false
1,478
py
#!/usr/bin/python #Author: Benli Chai #This Python script sort reads by a unique substring in the header. Requires Biopython 1.51 or later from Bio import SeqIO import itertools, sys #Setup variables (could parse command line args instead) format = 'fasta' def sortByTag(iter): handles = {}#list of opened output file handles handle = open('notag.fa', 'w') handles['notag'] = handle for read in iter: find = 0 #switch notag and tagged reads for tag in tagList: if read.id.split(';')[0].split('_')[0] == tag: find = 1 if not tag in handles.keys():#new sample new output handler name = tag + '.fa' handle = open(name, 'w') handles[tag] = handle SeqIO.write(read, handle, format) else: handle = handles[tag] SeqIO.write(read, handle, format) break#find the barcode then break out if find == 0:#no tag was found for this pair of reads handle = handles['notag'] SeqIO.write(read, handle, format) for handle in handles.values():#close all the output file handles handle.close() if len(sys.argv) != 3: print 'sortByTag.py <ReadFile.fasta> <tagfile> ' sys.exit() #Main# #sequence input handles ReadFile = SeqIO.parse(open(sys.argv[1], "rU"), format) #get sample and tags tagFile = open(sys.argv[2], 'r').readlines() hash = {} tagList = [] for line in tagFile: tag = line.strip() if not tag in tagList: tagList.append(tag) else: print 'Duplicated tag', line.strip() sys.exit() sortByTag(ReadFile)
87d2c895c4c15dd4c38376f740c302e94c9d1a8d
cbe1a042417584da2ad2ebdeb046f438953ddf4a
/web_crawler/naver_review.py
e24acd0c893897c1b68f8bd11e67ff2211129ab5
[]
no_license
sjknight79/Police_study_200810
36f13276e6379deeb3972192fec1a5320924dc8d
94329b820f854696dcefa3798ccdb4c469822adf
refs/heads/master
2022-11-30T13:00:53.272355
2020-08-12T00:28:37
2020-08-12T00:28:37
285,436,413
0
0
null
null
null
null
UTF-8
Python
false
false
430
py
import requests from bs4 import BeautifulSoup url = "https://movie.naver.com/movie/bi/mi/review.nhn?code=188909" res = requests.get(url) # print(res.text) soup = BeautifulSoup(res.content, 'html.parser') # print(soup.prettify()) ul = soup.find("ul", class_="rvw_list_area") # print(ul) lis = ul.find_all("li") for i, li in enumerate(lis): print(i, "="*50) print(li.a.text) print(li.span.em.text)
6517fec4d77570a3b3058385a4b8b69313b8a877
6ed5b3ef5c24d9b24bff329d7d69a54908386014
/ALDS1_9_A.py
ed191daedd9af5fedc5e2c2a200be721b6352afa
[]
no_license
python-practicing/Aizu_Online_Judge
cb954b806329fc3332916b9120eb8d77965b896c
364e205c0f345c2387019bee269fb1075ffdf761
refs/heads/main
2023-04-27T07:56:28.485550
2021-05-16T07:45:53
2021-05-16T07:45:53
356,594,797
0
0
null
null
null
null
UTF-8
Python
false
false
860
py
import math n = int(input()) heap_elements = list(map(int, input().split())) for i in range(1, n+1): key = heap_elements[i-1] if i == 1: left_key = heap_elements[1] right_key = heap_elements[2] print(f'node {i}: key = {key}, left key = {left_key}, right key = {right_key}, ') else: parent_key = heap_elements[math.floor(i / 2) - 1] if 2*i <= n-1: left_key = heap_elements[2*i-1] right_key = heap_elements[2*i] print(f'node {i}: key = {key}, parent key = {parent_key}, left key = {left_key}, right key = {right_key}, ') elif 2*i == n: left_key = heap_elements[2*i-1] print(f'node {i}: key = {key}, parent key = {parent_key}, left key = {left_key}, ') else: print(f'node {i}: key = {key}, parent key = {parent_key}, ')
3f9c5087daf02fa4d3f63eed410bf3cac7690a7a
5936b0f025944d265cc64d31ef93bc578d5ae6a2
/home/migrations/0002_load_initial_data.py
aa10fce4bdfc1b079fe4363502f83665c2758cfe
[]
no_license
crowdbotics-apps/smiley-18358
b4e91ddeaf525aedf990ec1df65d65fb583f4b7c
7935dd2fad196a7b573c1126905af5fcf93110b0
refs/heads/master
2022-11-06T07:02:33.512245
2020-06-23T20:08:09
2020-06-23T20:08:09
274,497,439
0
0
null
null
null
null
UTF-8
Python
false
false
1,278
py
from django.db import migrations def create_customtext(apps, schema_editor): CustomText = apps.get_model("home", "CustomText") customtext_title = "smiley" CustomText.objects.create(title=customtext_title) def create_homepage(apps, schema_editor): HomePage = apps.get_model("home", "HomePage") homepage_body = """ <h1 class="display-4 text-center">smiley</h1> <p class="lead"> This is the sample application created and deployed from the Crowdbotics app. You can view list of packages selected for this application below. </p>""" HomePage.objects.create(body=homepage_body) def create_site(apps, schema_editor): Site = apps.get_model("sites", "Site") custom_domain = "smiley-18358.botics.co" site_params = { "name": "smiley", } if custom_domain: site_params["domain"] = custom_domain Site.objects.update_or_create(defaults=site_params, id=1) class Migration(migrations.Migration): dependencies = [ ("home", "0001_initial"), ("sites", "0002_alter_domain_unique"), ] operations = [ migrations.RunPython(create_customtext), migrations.RunPython(create_homepage), migrations.RunPython(create_site), ]
3c41505b6df63f203fef498970b71945aa8ac5d8
b3b68efa404a7034f0d5a1c10b281ef721f8321a
/Scripts/simulation/situations/complex/looping_interaction_situation.py
a00207c4f468d786c117ad5289444841aeb74d90
[ "Apache-2.0" ]
permissive
velocist/TS4CheatsInfo
62195f3333076c148b2a59f926c9fb5202f1c6fb
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
refs/heads/main
2023-03-08T01:57:39.879485
2021-02-13T21:27:38
2021-02-13T21:27:38
337,543,310
1
0
null
null
null
null
UTF-8
Python
false
false
9,478
py
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\situations\complex\looping_interaction_situation.py # Compiled at: 2020-10-01 19:10:21 # Size of source mod 2**32: 12943 bytes from event_testing.test_events import TestEvent from event_testing.tests import TunableTestSet from interactions.base.interaction import InteractionFailureOptions from interactions.context import InteractionContext, QueueInsertStrategy from interactions.interaction_finisher import FinishingType from interactions.priority import Priority from sims4.tuning.tunable import Tunable, TunablePackSafeReference from singletons import DEFAULT from situations.situation import Situation from situations.situation_complex import SituationComplexCommon, SituationStateData, CommonSituationState, TunableSituationJobAndRoleState import interactions.aop, routing, services, situations, operator OBJECT_TOKEN = 'object_id' class RunInteractionState(CommonSituationState): FACTORY_TUNABLES = {'max_retry_attempts': Tunable(description='\n The number of times the Sim can fail to successfully run the \n tuned interaction before giving up and moving on to the next \n object as a target.\n ', tunable_type=int, default=3)} def __init__(self, *args, targets=None, interaction=None, max_retry_attempts=None, basic_extra=None, previous_si=None, **kwargs): (super().__init__)(*args, **kwargs) self.targets = targets self.interaction = interaction self._retry_count = 0 self._target = None self.max_retry_attempts = max_retry_attempts self.basic_extra = basic_extra self._previous_si = previous_si self._interaction_instance = None def on_activate(self, reader=None): if not self.find_target_and_push_interaction(): if not self.targets: self.owner._self_destruct() else: self.retry_interaction() return self._test_event_register(TestEvent.InteractionStart) self._test_event_register(TestEvent.InteractionExitedPipeline) def handle_event(self, sim_info, event, resolver): if event == TestEvent.InteractionStart: if resolver.interaction is self._interaction_instance: if self._additional_tests(sim_info, event, resolver): self._on_interaction_of_interest_start() return elif event == TestEvent.InteractionExitedPipeline: if resolver.interaction is self._interaction_instance and self._additional_tests(sim_info, event, resolver): if resolver.interaction.has_been_user_canceled: self.cancel_interaction() return if not resolver.interaction.is_finishing_naturally: self._on_interaction_of_interest_failure() return def _on_interaction_of_interest_start(self): self.owner.advance_to_next_object((self.targets), previous_si=(self._interaction_instance)) def _on_interaction_of_interest_failure(self): self.retry_interaction() def _additional_tests(self, sim_info, event, resolver): return self.owner.is_sim_in_situation(sim_info.get_sim_instance()) def cancel_interaction(self): self.owner._self_destruct() def timer_expired(self): self.owner.advance_to_next_object(previous_si=(self._interaction_instance)) def find_target_and_push_interaction(self): if self.targets is None: self.owner._self_destruct() return sim = self.owner.initiating_sim_info.get_sim_instance() failed_connectivity_obj = None for obj in sorted((self.targets), key=(operator.attrgetter('part_group_index'))): if self._previous_si is not None: context = self._previous_si.context.clone_for_continuation(self._previous_si) else: context = InteractionContext(sim, (InteractionContext.SOURCE_SCRIPT), (Priority.High), insert_strategy=(QueueInsertStrategy.FIRST)) resolver = self.interaction.get_resolver(target=obj, context=context) if not self.owner.tests.run_tests(resolver): self.targets.remove(obj) continue if not obj.is_connected(sim): failed_connectivity_obj = obj self.targets.remove(obj) continue self.targets.remove(obj) self._target = obj return self.push_interaction(context=context) if failed_connectivity_obj is not None: route_fail_context = InteractionContext(sim, (InteractionContext.SOURCE_SCRIPT), (Priority.High), insert_strategy=(QueueInsertStrategy.NEXT)) result = sim.push_super_affordance((InteractionFailureOptions.ROUTE_FAILURE_AFFORDANCE), failed_connectivity_obj, route_fail_context, interaction_name=self.interaction.get_name(target=failed_connectivity_obj, context=route_fail_context), interaction_icon_info=self.interaction.get_icon_info(target=failed_connectivity_obj, context=route_fail_context)) return False def push_interaction(self, context=DEFAULT): for sim in self.owner.all_sims_in_situation_gen(): if context is DEFAULT: context = InteractionContext(sim, (InteractionContext.SOURCE_SCRIPT), (Priority.High), insert_strategy=(QueueInsertStrategy.NEXT)) aop = interactions.aop.AffordanceObjectPair(self.interaction, self._target, self.interaction, None) test_result, execute_result = aop.test_and_execute(context) self._interaction_instance = execute_result[1] if self.basic_extra: if self._interaction_instance is not None: self._interaction_instance.add_additional_instance_basic_extra(self.basic_extra) return test_result def retry_interaction(self): self._retry_count += 1 if self._retry_count < self.max_retry_attempts: self.push_interaction() else: self._retry_count = 0 self.owner.advance_to_next_object((self.targets), previous_si=(self._interaction_instance)) class LoopingInteractionSituation(situations.situation_complex.SituationComplexCommon): INSTANCE_TUNABLES = {'tendor_job_and_role_state':TunableSituationJobAndRoleState(description='\n Job and Role State for the Sim in this situation.\n '), 'interaction':TunablePackSafeReference(description='\n The interaction that the Sim will run in looping succession on\n the object(s) specified if the tests pass.\n ', manager=services.affordance_manager()), 'tests':TunableTestSet(description='\n The tests that muss pass for the Sim to run the tuned interaction\n with the object as the target.\n '), 'run_interaction_state':RunInteractionState.TunableFactory(description='\n Situation State used to run the tuned interaction on a specific\n object.\n ', tuning_group=SituationComplexCommon.SITUATION_STATE_GROUP)} REMOVE_INSTANCE_TUNABLES = Situation.NON_USER_FACING_REMOVE_INSTANCE_TUNABLES def __init__(self, *args, **kwargs): (super().__init__)(*args, **kwargs) reader = self._seed.custom_init_params_reader self.targets = None self._retry_count = 0 self.interaction_override = self._seed.extra_kwargs.get('interaction', None) self.basic_extra = self._seed.extra_kwargs.get('basic_extra', ()) if reader is None: self._target_id = self._seed.extra_kwargs.get('default_target_id', None) else: self._target_id = reader.read_uint64(OBJECT_TOKEN, None) if self._target_id is not None: target = services.object_manager().get(self._target_id) if target.parts: self.targets = set(target.parts) else: self.targets = set((target,)) @classmethod def default_job(cls): pass @classmethod def _states(cls): return (SituationStateData(1, RunInteractionState, factory=(cls.run_interaction_state)),) @classmethod def _get_tuned_job_and_default_role_state_tuples(cls): return [(cls.tendor_job_and_role_state.job, cls.tendor_job_and_role_state.role_state)] def _on_set_sim_job(self, sim, job_type): super()._on_set_sim_job(sim, job_type) self._change_state(self.run_interaction_state(targets=(self.targets), interaction=(self.looping_interaction), basic_extra=(self.basic_extra))) def advance_to_next_object(self, targets, previous_si=None): self._change_state(self.run_interaction_state(targets=targets, interaction=(self.looping_interaction), basic_extra=(self.basic_extra), previous_si=previous_si)) @property def looping_interaction(self): if self.interaction_override is not None: return self.interaction_override return self.interaction
ae671c59180030aef4bf58a5dbb0cd5abbc89454
e5dc2651bcce866d89537014221cd345b4e2d103
/codeitsuisse/routes/parasite.py
3fad245cec992636ce7bf3cdfa33825b513ce067
[]
no_license
borische1322/CodeITSuisse
f748aa6fb2adaff9e8eca01998757e945d0d80f4
76f0a117656975652132eaa0da8aa1b58629d198
refs/heads/master
2023-08-14T22:31:48.765960
2021-09-25T10:27:08
2021-09-25T10:27:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
6,957
py
import logging import json from flask import request, jsonify from codeitsuisse import app global p1ANS global test p2Ans=0 again1=1 again2=1 test=0 logger = logging.getLogger(__name__) @app.route('/parasite', methods=['POST']) def evaluate_parasite(): global text data = request.get_json() logging.info("data sent for evaluation {}".format(data)) #inputValue = data.get("input") result = [] for test_case in data: result.append(main(test_case["room"],test_case["grid"],test_case["interestedIndividuals"])) return jsonify(result) def target(inputTarget): targry_array=[] for i in inputTarget: x=i.rsplit(',') targry_array.append(x) return targry_array def locationParasite(x): #x=[[0, 3],[0, 1]] parasite=[] for i in range(len(x)): for j in range(len(x[i])): if x[i][j]==3: parasite.append(i) parasite.append(j) return parasite def noHealth(inputGrid): i=0 j=0 while i<len(inputGrid): while j<len(inputGrid[i]): if inputGrid[i][j]==1: return False else: j+=1 j=0 i+=1 return True def make_stepForP2(m): global again1 for i in range(len(m)): for j in range(len(m[i])): if m[i][j] == 3: if i>0 and m[i-1][j] == 1: m[i-1][j] = 3 again1+=1 if j>0 and m[i][j-1] == 1 : m[i][j-1] = 3 again1+=1 if i<len(m)-1 and m[i+1][j] == 1 : m[i+1][j] = 3 again1+=1 if j<len(m[i])-1 and m[i][j+1] == 1 : m[i][j+1] = 3 again1+=1 def isolatedForp2(m): for i in range(len(m)-1): for j in range(len(m[i])-1): if m[i][j]==1: if i==0 and j==0: if m[i][j+1]==0 and m[i+1][j]==0: return True elif i==len(m)-1 and j==0: if m[i][j+1]==0 and m[i-1][j]==0: return True elif i==0 and j==len(m[i])-1: if m[i][j-1]==0 and m[i+1][j]==0: return True elif i==len(m)-1 and j==len(m[i])-1: return True else: if (m[i-1][j] ==0 and i>0) and (m[i][j-1]==0 and j>0) and (m[i+1][j]==0 and i<len(m[1])-1) and (m[i][j+1]==0 and j<len(m[1])-1) : return True return False def p2(grid): global p2Ans global again1 if isolatedForp2(grid)==True: p2Ans=-1 else: while noHealth(grid)==False and again1>0: make_stepForP2(grid) p2Ans+=1 again1-=1 return p2Ans def p1(inputGrid, inputTarget): global p1_value p1 = target(inputTarget) #p1_ans[len(p1)] p1_ans=[] parasite = locationParasite(inputGrid) x = parasite[0] y = parasite[1] #print(x) #print(y) i=0 while i<len(p1): p1_value = 0 if solve(inputGrid,x,y,int(p1[i][0]),int(p1[i][1])) == True: #p1_ans[i] = p1_value p1_ans.append(p1_value) i+=1 else: p1_ans.append(-1) i+=1 p1_finalAns=dict(zip(inputTarget,p1_ans)) return p1_finalAns def solve(m,x,y,p1_x,p1_y): global p1_value global test #print(p1_value) #Base case if y > len(m)-1 or x > len(m[0])-1: p1_value -= 1 return False if x == p1_x and y == p1_y : return True if m[x][y] != 1 and test != 0: p1_value -= 1 return False test+=1 #print("fuck") #recursive case if solve(m,x,y+1,p1_x,p1_y) == True : #right p1_value += 1 return True if solve(m,x+1,y,p1_x,p1_y) == True : #down p1_value += 1 return True if solve(m,x,y-1,p1_x,p1_y) == True : #left p1_value += 1 return True if solve(m,x-1,y,p1_x,p1_y) == True : #up p1_value += 1 return True #Backtracking return False def p1test(grid,inputTarget): global p1ANS global again1 p1target=target() p1ANS=[] for i in p1target: steps=0 if isolatedForp1(grid,int(i[0]),int(i[1]))==True: print(-1) else: while noHealth()==False and again1>0: if grid[int(i[0])][int(i[1])]!=3: make_stepForP2(grid) steps+=1 again1-=1 else: break p1ANS.append(steps) p1_finalAns=dict(zip(inputTarget,p1ANS)) return p1_finalAnsdef p1test(grid,inputTarget): global p1ANS global again1 p1target=target() p1ANS=[] for i in p1target: steps=0 if isolatedForp1(grid,int(i[0]),int(i[1]))==True: print(-1) else: while noHealth()==False and again1>0: if grid[int(i[0])][int(i[1])]!=3: make_stepForP2(grid) steps+=1 again1-=1 else: break p1ANS.append(steps) p1_finalAns=dict(zip(inputTarget,p1ANS)) return p1_finalAns def isolatedForp1(m,i,j): if m[i][j]==1: if i==0 and j==0: if m[i][j+1]==0 and m[i+1][j]==0: return True elif i==len(m)-1 and j==0: if m[i][j+1]==0 and m[i-1][j]==0: return True elif i==0 and j==len(m[i])-1: if m[i][j-1]==0 and m[i+1][j]==0: return True elif i==len(m)-1 and j==len(m[i])-1: return True else: if (m[i-1][j] ==0 and i>0) and (m[i][j-1]==0 and j>0) and (m[i+1][j]==0 and i<len(m[1])-1) and (m[i][j+1]==0 and j<len(m[1])-1) : return True elif m[i][j]==0: return True else: return False def make_stepForP1(m): global again1 for i in range(len(m)): for j in range(len(m[i])): if m[i][j] == 3: if i>0 and m[i-1][j] == 1: m[i-1][j] = 3 again1+=1 if j>0 and m[i][j-1] == 1 : m[i][j-1] = 3 again1+=1 if i<len(m)-1 and m[i+1][j] == 1 : m[i+1][j] = 3 again1+=1 if j<len(m[i])-1 and m[i][j+1] == 1 : m[i][j+1] = 3 again1+=1 def main(inputRoom,inputGrid,inputTarget): p1_ans=p1(inputGrid, inputTarget) p2_ans=p2(inputGrid) p3_ans=-1 p4_ans=1 finalAns={'room':inputRoom,'p1':p1_ans,'p2':p2_ans,'p3':p3_ans,'p4':p4_ans} return finalAns
6d3e6d6192178fdbd567a66120eb0aeb0b1077a1
a281d09ed91914b134028c3a9f11f0beb69a9089
/contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_stellar_address.py
e90bce385fe104a9ad05fb1b06683e925a02a2db
[ "Apache-2.0" ]
permissive
CarstenFrommhold/great_expectations
4e67bbf43d21bc414f56d576704259a4eca283a5
23d61c5ed26689d6ff9cec647cc35712ad744559
refs/heads/develop
2023-01-08T10:01:12.074165
2022-11-29T18:50:18
2022-11-29T18:50:18
311,708,429
0
0
Apache-2.0
2020-11-10T15:52:05
2020-11-10T15:52:04
null
UTF-8
Python
false
false
6,125
py
""" This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ import json from typing import Optional import coinaddrvalidator from great_expectations.core.expectation_configuration import ExpectationConfiguration from great_expectations.exceptions import InvalidExpectationConfigurationError from great_expectations.execution_engine import PandasExecutionEngine from great_expectations.expectations.expectation import ColumnMapExpectation from great_expectations.expectations.metrics import ( ColumnMapMetricProvider, column_condition_partial, ) def is_valid_stellar_address(addr: str) -> bool: try: res = coinaddrvalidator.validate("xlm", addr).valid return res except Exception as e: return False # This class defines a Metric to support your Expectation. # For most ColumnMapExpectations, the main business logic for calculation will live in this class. class ColumnValuesToBeValidStellarAddress(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_stellar_address" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pandas(cls, column, **kwargs): return column.apply(lambda x: is_valid_stellar_address(x)) # This method defines the business logic for evaluating your metric when using a SqlAlchemyExecutionEngine # @column_condition_partial(engine=SqlAlchemyExecutionEngine) # def _sqlalchemy(cls, column, _dialect, **kwargs): # raise NotImplementedError # This method defines the business logic for evaluating your metric when using a SparkDFExecutionEngine # @column_condition_partial(engine=SparkDFExecutionEngine) # def _spark(cls, column, **kwargs): # raise NotImplementedError # This class defines the Expectation itself class ExpectColumnValuesToBeValidStellarAddress(ColumnMapExpectation): """Expect column values to be valid Stellar address""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "all_valid": [ "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH", "GBTA54J4LY5BAQWA4KECII66TPTU3V6DXPBPNVXIPMHN5W6QFATWRXY5", "GCINDD6LNZSYPND4WRQL6NRFGOAXMAMK7M3QP2JXWC5634BY4DSZ4YG2", "GDKRCHSD2YUW3X6FXRAVOOZZ2IOMWSGM6SH6I56VCX6V2DTPG7FO626W", ], "some_other": [ "1BoatSLRHtKNngkdXEeobR76b53LETtpyT", "n2nzi7xDTrMVK9stGpbK3BtrpBCJfH7LRQ", "3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC", "bc1qxneu85dnhx33asv8da45x55qyeu44ek9h3vngxdsare", ], }, "tests": [ { "title": "basic_positive_test", "exact_match_out": False, "include_in_gallery": True, "in": {"column": "all_valid"}, "out": { "success": True, }, }, { "title": "basic_negative_test", "exact_match_out": False, "include_in_gallery": True, "in": {"column": "some_other", "mostly": 1}, "out": { "success": False, }, }, ], } ] # This is the id string of the Metric used by this Expectation. # For most Expectations, it will be the same as the `condition_metric_name` defined in your Metric class above. map_metric = "column_values.valid_stellar_address" # This is a list of parameter names that can affect whether the Expectation evaluates to True or False success_keys = ("mostly",) # This dictionary contains default values for any parameters that should have default values default_kwarg_values = {} def validate_configuration( self, configuration: Optional[ExpectationConfiguration] ) -> None: """ Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that necessary configuration arguments have been provided for the validation of the expectation. Args: configuration (OPTIONAL[ExpectationConfiguration]): \ An optional Expectation Configuration entry that will be used to configure the expectation Returns: None. Raises InvalidExpectationConfigurationError if the config is not validated successfully """ super().validate_configuration(configuration) if configuration is None: configuration = self.configuration # # Check other things in configuration.kwargs and raise Exceptions if needed # try: # assert ( # ... # ), "message" # assert ( # ... # ), "message" # except AssertionError as e: # raise InvalidExpectationConfigurationError(str(e)) return True # This object contains metadata for display in the public Gallery library_metadata = { "maturity": "experimental", "tags": [ "hackathon-22", "experimental", "typed-entities", ], # Tags for this Expectation in the Gallery "contributors": [ # Github handles for all contributors to this Expectation. "@szecsip", # Don't forget to add your github handle here! ], "requirements": ["coinaddrvalidator"], } if __name__ == "__main__": ExpectColumnValuesToBeValidStellarAddress().print_diagnostic_checklist()
ae46d3018ef730c3d8c886c21676d65c05981388
8cc2c6e674477b425f9d799da39ebf71a0403e4b
/QAf.py
fbe6e0ac68e9d258a54c997f07be8019b3d555bd
[]
no_license
Amrit-stack/Python-assignments-III
85f2c427013c56a7e2e1529374aa8bb648619c2a
92e19702a87255529a06ac73b9a092dfae558741
refs/heads/master
2022-11-21T11:44:02.867852
2020-07-12T12:53:34
2020-07-12T12:53:34
279,063,884
0
0
null
null
null
null
UTF-8
Python
false
false
507
py
def binary_search (arr, left, right, x): if right >= left: mid = left + (right - left) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr, left, mid-1, x) else: return binary_search(arr, mid + 1, right, x) else: return -1 arr = [ 2, 3, 4, 10, 40 ] x = 40 result = binary_search(arr, 0, len(arr)-1, x) if result != -1: print ("Element is present at index % d" % result) else: print ("Element is not present in array")
f5557d5ff6492966343a1b46c76dde955a03f5a7
b15a9d9c7374c4a1fa5ec3ef63603a8c57e8681f
/Design-Patterns-Python/memento/caretaker.py
6a143d567f4390a284f8bff63c8f3a579f175f00
[]
no_license
gohils/zemr_notebook
3f7490ef7a2559655746c3e2e0dbfb835a83891e
00d53cea9970df44160c51e6ad2bdeadfae2c91f
refs/heads/master
2023-08-04T14:32:35.428016
2023-07-20T11:51:08
2023-07-20T11:51:08
222,027,451
0
0
null
null
null
null
UTF-8
Python
false
false
761
py
"The Save/Restore Game functionality" class CareTaker(): "Guardian. Provides a narrow interface to the mementos" def __init__(self, originator): self._originator = originator self._mementos = [] def save(self): "Store a new Memento of the Characters current state" print("CareTaker: Game Save") memento = self._originator.memento self._mementos.append(memento) def restore(self, index): """ Replace the Characters current attributes with the state stored in the saved Memento """ print("CareTaker: Restoring Characters attributes from Memento") memento = self._mementos[index] self._originator.memento = memento
0a84c7d2819c6909abef3aa8cf9c8e577efad451
13f4a06cd439f579e34bf38406a9d5647fe7a0f3
/nn_ns/parsing/IterParser/ParseResultAST.py
205e7e97ea49432cf019048a7b1198e730ce036c
[]
no_license
edt-yxz-zzd/python3_src
43d6c2a8ef2a618f750b59e207a2806132076526
41f3a506feffb5f33d4559e5b69717d9bb6303c9
refs/heads/master
2023-05-12T01:46:28.198286
2023-05-01T13:46:32
2023-05-01T13:46:32
143,530,977
2
2
null
null
null
null
UTF-8
Python
false
false
346
py
from sand.types.NonMathTree import NonMathTree, LeafNode, OrientedNode, UnorientedNode class ParseResultAST(NonMathTree): class __UnboxedTypeID__:pass class ConRuleNode(OrientedNode, ParseResultAST):pass class AltRuleNode(UnorientedNode, ParseResultAST):pass class TerminalNode(LeafNode, ParseResultAST):pass
4b94ea0efb14d60e69e0110fd84977c9ba7a7611
50948d4cb10dcb1cc9bc0355918478fb2841322a
/azure-mgmt-compute/azure/mgmt/compute/v2018_04_01/models/virtual_machine_scale_set_public_ip_address_configuration_py3.py
76a82b78db8773b9a74688ddbdadeac51ed6ec07
[ "MIT" ]
permissive
xiafu-msft/azure-sdk-for-python
de9cd680b39962702b629a8e94726bb4ab261594
4d9560cfd519ee60667f3cc2f5295a58c18625db
refs/heads/master
2023-08-12T20:36:24.284497
2019-05-22T00:55:16
2019-05-22T00:55:16
187,986,993
1
0
MIT
2020-10-02T01:17:02
2019-05-22T07:33:46
Python
UTF-8
Python
false
false
2,197
py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serialization import Model class VirtualMachineScaleSetPublicIPAddressConfiguration(Model): """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. All required parameters must be populated in order to send to Azure. :param name: Required. The publicIP address configuration name. :type name: str :param idle_timeout_in_minutes: The idle timeout of the public IP address. :type idle_timeout_in_minutes: int :param dns_settings: The dns settings to be applied on the publicIP addresses . :type dns_settings: ~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings :param ip_tags: The list of IP tags associated with the public IP address. :type ip_tags: list[~azure.mgmt.compute.v2018_04_01.models.VirtualMachineScaleSetIpTag] """ _validation = { 'name': {'required': True}, } _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineScaleSetIpTag]'}, } def __init__(self, *, name: str, idle_timeout_in_minutes: int=None, dns_settings=None, ip_tags=None, **kwargs) -> None: super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) self.name = name self.idle_timeout_in_minutes = idle_timeout_in_minutes self.dns_settings = dns_settings self.ip_tags = ip_tags
a772879e485592a2933d28abf327fa778c4be088
7ac5ea4a31eb2e382b144206febe663b9531afaa
/main.py
15b43fdf66c16250ee9931fc50883bc1306bf1a1
[]
no_license
roseate8/SOC-prediction
0e3b04d8286c319192627034987b80cdb85d8b08
7e664a2fa111004a215639113e3aab72e08e6d6e
refs/heads/master
2020-09-17T05:58:34.678938
2020-05-25T18:50:42
2020-05-25T18:50:42
224,012,465
0
0
null
null
null
null
UTF-8
Python
false
false
3,664
py
from battery import Battery from kalman import ExtendedKalmanFilter as EKF from protocol import launch_experiment_protocol import numpy as np import math as m def get_EKF(R0, R1, C1, std_dev, time_step): # initial state (SoC is intentionally set to a wrong value) # x = [[SoC], [RC voltage]] x = np.matrix([[0.5],\ [0.0]]) exp_coeff = m.exp(-time_step/(C1*R1)) # state transition model F = np.matrix([[1, 0 ],\ [0, exp_coeff]]) # control-input model B = np.matrix([[-time_step/(Q_tot * 3600)],\ [ R1*(1-exp_coeff)]]) # variance from std_dev var = std_dev ** 2 # measurement noise R = var # state covariance P = np.matrix([[var, 0],\ [0, var]]) # process noise covariance matrix Q = np.matrix([[var/50, 0],\ [0, var/50]]) def HJacobian(x): return np.matrix([[battery_simulation.OCV_model.deriv(x[0,0]), -1]]) def Hx(x): return battery_simulation.OCV_model(x[0,0]) - x[1,0] return EKF(x, F, B, P, Q, R, Hx, HJacobian) def plot_everything(time, true_voltage, mes_voltage, true_SoC, estim_SoC, current): import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(311) ax2 = fig.add_subplot(312) ax3 = fig.add_subplot(313) # ax1 = plt.axes([0, 0, 3, 5]) # ax2 = plt.axes([0, 0, 3, 5]) # ax3 = plt.axes([0, 0, 3, 5]) # title, labels ax1.set_title('') ax1.set_xlabel('Time / s') ax1.set_ylabel('voltage / V') ax2.set_xlabel('Time / s') ax2.set_ylabel('Soc') ax3.set_xlabel('Time / s') ax3.set_ylabel('Current / A') ax1.plot(time, true_voltage, label="True voltage") ax1.plot(time, mes_voltage, label="Mesured voltage") ax2.plot(time, true_SoC, label="True SoC") ax2.plot(time, estim_SoC, label="Estimated SoC") ax3.plot(time, current, label="Current") ax1.legend() ax2.legend() ax3.legend() plt.show() # for i in len(true_SoC): # print(true_SoC[i] - estim_SoC[i]) if __name__ == '__main__': # total capacity Q_tot = 3.2 # Thevenin model values R0 = 0.062 R1 = 0.01 C1 = 3000 # time period time_step = 10 battery_simulation = Battery(Q_tot, R0, R1, C1) # discharged battery battery_simulation.actual_capacity = 0 # measurement noise standard deviation std_dev = 0.015 #get configured EKF Kf = get_EKF(R0, R1, C1, std_dev, time_step) time = [0] true_SoC = [battery_simulation.state_of_charge] estim_SoC = [Kf.x[0,0]] true_voltage = [battery_simulation.voltage] mes_voltage = [battery_simulation.voltage + np.random.normal(0,0.1,1)[0]] current = [battery_simulation.current] def update_all(actual_current): battery_simulation.current = actual_current battery_simulation.update(time_step) time.append(time[-1]+time_step) current.append(actual_current) true_voltage.append(battery_simulation.voltage) mes_voltage.append(battery_simulation.voltage + np.random.normal(0, std_dev, 1)[0]) Kf.predict(u=actual_current) Kf.update(mes_voltage[-1] + R0 * actual_current) true_SoC.append(battery_simulation.state_of_charge) estim_SoC.append(Kf.x[0,0]) return battery_simulation.voltage #mes_voltage[-1] # launch experiment launch_experiment_protocol(Q_tot, time_step, update_all) # plot stuff plot_everything(time, true_voltage, mes_voltage, true_SoC, estim_SoC, current)
0a5b6982fcdfc59b094c36f964a57334db398003
81f943eab36ac03e9d58677722a86aac512e108d
/knn.py
20dea10bc4c17d7b83926809981d3fffbdbb39da
[]
no_license
Ritika-Singhal/KNN-Algorithm
39595e55967a2fd1db941c017d7d37175fe7c8ef
e46c5cd5053db3be04560eeef2b337cda8cecb62
refs/heads/master
2020-07-31T06:52:37.944109
2019-09-24T07:28:08
2019-09-24T07:28:08
210,521,620
0
0
null
null
null
null
UTF-8
Python
false
false
2,364
py
import numpy as np from collections import Counter class KNN: def __init__(self, k, distance_function): """ :param k: int :param distance_function """ self.k = k self.distance_function = distance_function def train(self, features, labels): """ In this function, features is simply training data which is a 2D list with float values. :param features: List[List[float]] :param labels: List[int] """ self.train_features = features self.train_labels = labels def predict(self, features): """ This function takes 2D list of test data points, similar to those from train function. Here, I process every test data point, reuse the get_k_neighbours function to find the nearest k neighbours for each test data point, find the majority of labels for these neighbours as the predict label for that testing data point. Thus, got N predicted label for N test data point. This function returns a list of predicted labels for all test data points. :param features: List[List[float]] :return: List[int] """ test_features = features test_labels = [] for i in range(len(test_features)): k_neighbors = Counter(self.get_k_neighbors(test_features[i])) majority_label = k_neighbors.most_common(1)[0][0] test_labels.append(majority_label) return test_labels def get_k_neighbors(self, point): """ This function takes one single data point and finds k-nearest neighbours in the training set. We already have the k value, distance function and stored all training data in KNN class with the train function. This function returns a list of labels of all k neighours. :param point: List[float] :return: List[int] """ dist_list = [] for i in range(len(self.train_features)): dist_list.append((self.distance_function(point, self.train_features[i]), self.train_labels[i])) distances = np.array(dist_list, dtype=({'names':('distance', 'label'), 'formats':(float, int)})) distances = np.sort(distances, order='distance') return distances['label'][:self.k] if __name__ == '__main__': print(np.__version__)
4673777d1c1a994069de18c0acda79831f581168
611055f18da392e5a63b2d80ce102701201981eb
/src/apps/comentarios/admin.py
52f74fce4df52fd09dd0fe7013e06fc2089b1463
[]
no_license
danielhuamani/django-backbone
facf6f2ced78991577957bd2f8bb8c42255cd795
6523e19d8599753ccf28b6a2d4f511ec0fe0f1c7
refs/heads/master
2021-01-10T12:47:26.514543
2015-11-18T17:12:02
2015-11-18T17:12:02
45,657,924
0
0
null
null
null
null
UTF-8
Python
false
false
129
py
from django.contrib import admin from .models import Comentario # Register your models here. # admin.site.register(Comentario)
76347a0bc807d2e3b00e30fef2748954370b3171
99c4d4a6592fded0e8e59652484ab226ac0bd38c
/code/batch-2/dn5 - tviti/M-17135-2263.py
9deedfe8d85e527c7a5c6e89ba8391269f3c8492
[]
no_license
benquick123/code-profiling
23e9aa5aecb91753e2f1fecdc3f6d62049a990d5
0d496d649247776d121683d10019ec2a7cba574c
refs/heads/master
2021-10-08T02:53:50.107036
2018-12-06T22:56:38
2018-12-06T22:56:38
126,011,752
0
0
null
null
null
null
UTF-8
Python
false
false
7,569
py
def unikati(s): sez = [] for x in s: if x not in sez: sez.append(x) return sez def avtor(tvit): a = "" for x in range(len(tvit)): if tvit[x] == ":": break else: a += tvit[x] return a def izloci_besedo(beseda): beseda_1 = "" for x in range(len(beseda)): if beseda[x].isalnum() == True: beseda_1 += beseda[x] elif beseda[x] == "-" and beseda[x-1].isalnum() == True and beseda[x+1].isalnum() == True: beseda_1 += beseda[x] return beseda_1 def vsi_avtorji(tviti): sez = [] for x in tviti: avtor_ime = avtor(x) if avtor_ime not in sez: sez.append(avtor_ime) return sez def se_zacne_z(tvit, c): sez = tvit.split() sez_besed = [] for x in sez: if x[0] == c: if x[-1].isalnum() == True: sez_besed.append(x[1:]) else: sez_besed.append(x[1:-1]) return sez_besed def vse_afne(tviti): sez_imen = [] for x in tviti: besede = x.split() for x in besede: if x[0] == "@": if x[-1].isalnum() == True: if x[1:] not in sez_imen: sez_imen.append(x[1:]) else: if x[1:-1] not in sez_imen: sez_imen.append(x[1:-1]) return sez_imen def vse_osebe(tviti): sez = vse_afne(tviti) sez_imen = vsi_avtorji(tviti) n = 0 for x in range(len(sez)): if sez[n] not in sez_imen: sez_imen.append(sez[n]) n += 1 sez = sorted(sez_imen) return sez def vsi_hashtagi(tviti): sez = [] for x in tviti: besede = x.split() for x in besede: if x[0] == "#": if x[-1].isalnum() == True: if x[1:] not in sez: sez.append(x[1:]) else: if x[1:-1] not in sez: sez.append(x[1:-1]) return sez def zberi_se_zacne_z(tviti, c): sez_besed = [] for x in tviti: sez = x.split() for x in sez: if x[0] == c: if x[-1].isalnum() == True: if x[1:] not in sez_besed: sez_besed.append(x[1:]) else: if x[1:-1] not in sez_besed: sez_besed.append(x[1:-1]) return sez_besed def custva(tviti, hashtagi): sez_imen = [] for x in tviti: sez = x.split() avtor = sez[0][:-1] for x in sez: if x[0] == "#": if x[1:] in hashtagi and avtor not in sez_imen: sez_imen.append(avtor) return sorted(sez_imen) def se_poznata(tviti, oseba1, oseba2): zakljucek = False sez = [oseba1, oseba2] for x in sez: for y in tviti: besede = y.split() for s in besede: sez_besed = [] if s[0] == "@": if besede[0][:-1] == x: if s[-1].isalnum() == True: if s[1:] not in sez_besed: sez_besed.append(s[1:]) else: if s[1:-1] not in sez_besed: sez_besed.append(s[1:-1]) for d in sez_besed: if x == oseba1: if oseba2 in sez_besed: zakljucek = True else: if oseba1 in sez_besed: zakljucek = True return zakljucek import unittest class TestTviti(unittest.TestCase): tviti = [ "sandra: Spet ta dež. #dougcajt", "berta: @sandra Delaj domačo za #programiranje1", "sandra: @berta Ne maram #programiranje1 #krneki", "ana: kdo so te @berta, @cilka, @dani? #krneki", "cilka: jst sm pa #luft", "benjamin: pogrešam ano #zalosten", "ema: @benjamin @ana #split? po dvopičju, za začetek?", ] def test_unikat(self): self.assertEqual(unikati([1, 2, 1, 1, 3, 2]), [1, 2, 3]) self.assertEqual(unikati([1, 3, 2, 1, 1, 3, 2]), [1, 3, 2]) self.assertEqual(unikati([1, 5, 4, 3, 2]), [1, 5, 4, 3, 2]) self.assertEqual(unikati([1, 1, 1, 1, 1]), [1]) self.assertEqual(unikati([1]), [1]) self.assertEqual(unikati([]), []) self.assertEqual(unikati(["Ana", "Berta", "Cilka", "Berta"]), ["Ana", "Berta", "Cilka"]) def test_avtor(self): self.assertEqual(avtor("janez: pred dvopičjem avtor, potem besedilo"), "janez") self.assertEqual(avtor("ana: malo krajse ime"), "ana") self.assertEqual(avtor("benjamin: pomembne so tri stvari: prva, druga in tretja"), "benjamin") def test_vsi_avtorji(self): self.assertEqual(vsi_avtorji(self.tviti), ["sandra", "berta", "ana", "cilka", "benjamin", "ema"]) self.assertEqual(vsi_avtorji(self.tviti[:3]), ["sandra", "berta"]) def test_izloci_besedo(self): self.assertEqual(izloci_besedo("@ana"), "ana") self.assertEqual(izloci_besedo("@@ana!!!"), "ana") self.assertEqual(izloci_besedo("ana"), "ana") self.assertEqual(izloci_besedo("!#$%\"=%/%()/Ben-jamin'"), "Ben-jamin") def test_vse_na_crko(self): self.assertEqual(se_zacne_z("Benjamin $je $skocil! Visoko!", "$"), ["je", "skocil"]) self.assertEqual(se_zacne_z("Benjamin $je $skocil! #Visoko!", "$"), ["je", "skocil"]) self.assertEqual(se_zacne_z("ana: kdo so te @berta, @cilka, @dani? #krneki", "@"), ["berta", "cilka", "dani"]) def test_zberi_na_crko(self): self.assertEqual(zberi_se_zacne_z(self.tviti, "@"), ['sandra', 'berta', 'cilka', 'dani', 'benjamin', 'ana']) self.assertEqual(zberi_se_zacne_z(self.tviti, "#"), ['dougcajt', 'programiranje1', 'krneki', 'luft', 'zalosten', 'split']) def test_vse_afne(self): self.assertEqual(vse_afne(self.tviti), ['sandra', 'berta', 'cilka', 'dani', 'benjamin', 'ana']) def test_vsi_hashtagi(self): self.assertEqual(vsi_hashtagi(self.tviti), ['dougcajt', 'programiranje1', 'krneki', 'luft', 'zalosten', 'split']) def test_vse_osebe(self): self.assertEqual(vse_osebe(self.tviti), ['ana', 'benjamin', 'berta', 'cilka', 'dani', 'ema', 'sandra']) class TestDodatna(unittest.TestCase): tviti = [ "sandra: Spet ta dež. #dougcajt", "berta: @sandra Delaj domačo za #programiranje1", "sandra: @berta Ne maram #programiranje1 #krneki", "ana: kdo so te @berta, @cilka, @dani? #krneki", "cilka: jst sm pa #luft", "benjamin: pogrešam ano #zalosten", "ema: @benjamin @ana #split? po dvopičju, za začetek?", ] def test_custva(self): self.assertEqual(custva(self.tviti, ["dougcajt", "krneki"]), ["ana", "sandra"]) self.assertEqual(custva(self.tviti, ["luft"]), ["cilka"]) self.assertEqual(custva(self.tviti, ["meh"]), []) def test_se_poznata(self): self.assertTrue(se_poznata(self.tviti, "ana", "berta")) self.assertTrue(se_poznata(self.tviti, "ema", "ana")) self.assertFalse(se_poznata(self.tviti, "sandra", "ana")) self.assertFalse(se_poznata(self.tviti, "cilka", "luft")) self.assertFalse(se_poznata(self.tviti, "cilka", "balon")) if __name__ == "__main__": unittest.main()
56f8397cd80c31bf0258a6c8726c43dfa3581ba0
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5688567749672960_1/Python/Jakube/A.py
4b619d8aaec440fa7678ace44a08aae319de1d8e
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Python
false
false
1,162
py
def splitter(number): s = str(number) return int(s[:len(s)//2] or "0"), int(s[len(s)//2:]), len(s[len(s)//2:]) def compute(number): steps = 0 while number: # get second part of the number half1, half2, l = splitter(number) if half2 == 0: steps += 1 number -= 1 half1, half2, l = splitter(number) steps += half2 - 1 number -= half2 -1 number = half1 * 10**l + 1 if number == 1: return steps + 1 # switch if str(number) != str(number)[::-1]: number = int(str(number)[::-1]) steps += 1 mi = int(str(number)[1:] or str(number)) number -= mi steps += mi def read_number(f): return int(f.readline().strip()) def main(): with open('A-large.in', 'r') as f: test_cases = read_number(f) for test_case in range(test_cases): number = read_number(f) #print(number) print('Case #{}: {}'.format(test_case + 1, compute(number))) if __name__ == '__main__': main()
f3c46d47d4582718dfb6dd5b01fc9693777fc6bd
f576f0ea3725d54bd2551883901b25b863fe6688
/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_dns_management_client.py
27d21876b1846ae591194de288047cefd6a1b680
[ "MIT", "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later" ]
permissive
Azure/azure-sdk-for-python
02e3838e53a33d8ba27e9bcc22bd84e790e4ca7c
c2ca191e736bb06bfbbbc9493e8325763ba990bb
refs/heads/main
2023-09-06T09:30:13.135012
2023-09-06T01:08:06
2023-09-06T01:08:06
4,127,088
4,046
2,755
MIT
2023-09-14T21:48:49
2012-04-24T16:46:12
Python
UTF-8
Python
false
false
5,306
py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import DnsManagementClientConfiguration from .operations import DnsResourceReferenceOperations, DnssecConfigsOperations, RecordSetsOperations, ZonesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword """The DNS Management Client. :ivar dnssec_configs: DnssecConfigsOperations operations :vartype dnssec_configs: azure.mgmt.dns.v2023_07_01_preview.aio.operations.DnssecConfigsOperations :ivar record_sets: RecordSetsOperations operations :vartype record_sets: azure.mgmt.dns.v2023_07_01_preview.aio.operations.RecordSetsOperations :ivar zones: ZonesOperations operations :vartype zones: azure.mgmt.dns.v2023_07_01_preview.aio.operations.ZonesOperations :ivar dns_resource_reference: DnsResourceReferenceOperations operations :vartype dns_resource_reference: azure.mgmt.dns.v2023_07_01_preview.aio.operations.DnsResourceReferenceOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: self._config = DnsManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.dnssec_configs = DnssecConfigsOperations( self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" ) self.record_sets = RecordSetsOperations( self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" ) self.zones = ZonesOperations( self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" ) self.dns_resource_reference = DnsResourceReferenceOperations( self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") <HttpRequest [GET], url: 'https://www.example.org/'> >>> response = await client._send_request(request) <AsyncHttpResponse: 200 OK> For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request :param request: The network request you want to make. Required. :type request: ~azure.core.rest.HttpRequest :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. :rtype: ~azure.core.rest.AsyncHttpResponse """ request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() async def __aenter__(self) -> "DnsManagementClient": await self._client.__aenter__() return self async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details)
bc72cc0f0343ca37bc40790a466c5e2c0b09be43
2f46c6463d4f871a72d4296c3dae00f029e892f1
/src/cogent3/maths/stats/jackknife.py
33192edc584ffa4dc6506935473a1e778893a7bd
[ "BSD-3-Clause" ]
permissive
BrendanBeaton/cogent3
a09376c55f24da837690219157770ad94e917579
e10f4f933921d52b000096b7c016190a1602add6
refs/heads/master
2022-12-02T07:59:11.112306
2020-06-30T05:40:33
2020-06-30T05:40:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,782
py
import numpy as np from cogent3.util.table import Table __author__ = "Anuj Pahwa, Gavin Huttley" __copyright__ = "Copyright 2007-2020, The Cogent Project" __credits__ = ["Anuj Pahwa", "Gavin Huttley"] __license__ = "BSD-3" __version__ = "2020.6.30a" __maintainer__ = "Gavin Huttley" __email__ = "[email protected]" __status__ = "Production" def index_gen(length): data = tuple(range(length)) def gen(i): temp = list(data) temp.pop(i) return temp return gen class JackknifeStats(object): """Computes the jackknife statistic for a particular statistical function as outlined by 'Tukey's Jackknife Method' Biometry by Sokal/Rohlf.""" def __init__(self, length, calc_stat, gen_index=index_gen): """ Parameters ---------- length : int The length of the data set (since data is not passed to this class). calc_stat : callable A callback function that computes the required statistic of a defined dataset. gen_index A callback function that generates a list of indices that are used to sub-sample the dataset. """ super(JackknifeStats, self).__init__() self.n = length self.calc_stat = calc_stat self.gen_index = gen_index(self.n) self._subset_statistics = None self._pseudovalues = None self._jackknifed_stat = None self._sample_statistic = None self._standard_error = None def jackknife(self): """Computes the jackknife statistics and standard error""" n = self.n n_minus_1 = n - 1 # compute the statistic in question on the whole data set self._sample_statistic = self.calc_stat(list(range(self.n))) n_sample_statistic = n * self._sample_statistic # compute the jackknife statistic for the data by removing an element # in each iteration and computing the statistic. subset_statistics = [] pseudovalues = [] for index in range(self.n): stat = self.calc_stat(self.gen_index(index)) subset_statistics.append(stat) pseudovalue = n_sample_statistic - n_minus_1 * stat pseudovalues.append(pseudovalue) self._pseudovalues = np.array(pseudovalues) self._subset_statistics = np.array(subset_statistics) self._jackknifed_stat = self._pseudovalues.mean(axis=0) # Compute the approximate standard error of the jackknifed estimate # of the statistic variance = np.square(self._pseudovalues - self._jackknifed_stat).sum(axis=0) variance_norm = np.divide(variance, n * n_minus_1) self._standard_error = np.sqrt(variance_norm) @property def sample_stat(self): if self._sample_statistic is None: self.jackknife() return self._sample_statistic @property def jackknifed_stat(self): if self._jackknifed_stat is None: self.jackknife() return self._jackknifed_stat @property def standard_error(self): if self._standard_error is None: self.jackknife() return self._standard_error @property def sub_sample_stats(self): """Return a table of the sub-sample statistics""" # if the statistics haven't been run yet. if self._subset_statistics is None: self.jackknife() # generate table title = "Subsample Stats" rows = [] for index in range(self.n): row = [index] subset_statistics = self._subset_statistics[index] try: for value in subset_statistics: row.append(value) except TypeError: row.append(subset_statistics) rows.append(row) header = ["i"] subset_stats = self._subset_statistics[0] try: num_datasets = len(subset_stats) for i in range(num_datasets): header.append("Stat_%s-i" % i) except TypeError: header.append("Stat-i") return Table(data=rows, header=header, title=title) @property def pseudovalues(self): """Return a table of the Pseudovalues""" # if the statistics haven't been run yet. if self._pseudovalues is None: self.jackknife() # detailed table title = "Pseudovalues" rows = [] for index in range(self.n): row = [index] pseudovalues = self._pseudovalues[index] try: for value in pseudovalues: row.append(value) except TypeError: row.append(pseudovalues) rows.append(row) header = ["i"] pseudovalues = self._pseudovalues[0] try: num_datasets = len(pseudovalues) for i in range(num_datasets): header.append("Pseudovalue_%s-i" % i) except TypeError: header.append("Pseudovalue-i") return Table(data=rows, header=header, title=title) @property def summary_stats(self): """Return a summary table with the statistic value(s) calculated for the the full data-set, the jackknife statistics and standard errors.""" # if the statistics haven't been run yet. if self._jackknifed_stat is None: self.jackknife() header = ["Sample Stat", "Jackknife Stat", "Standard Error"] title = "Summary Statistics" rows = np.vstack( (self._sample_statistic, self._jackknifed_stat, self._standard_error) ) rows = rows.transpose() return Table(header=header, data=rows, title=title)
44adf6b6092d9e48ed92769805836377be265962
2b694821034ac1415b7610849a58af92e8af3f64
/main.py
1a8062ba765b25800027bdc97d89b6a9423395ac
[]
no_license
HermesSJC/PythonTranslate
25d1d4bc7a77ccaa9caa8c0f48da401eb120cb3a
14c0df89ef4b554908e34cd8811a776374edf695
refs/heads/master
2020-04-12T19:37:47.266709
2019-04-16T05:20:12
2019-04-16T05:20:12
162,713,991
0
0
null
null
null
null
UTF-8
Python
false
false
259
py
from MainWindow import MainWindow from PySide2.QtWidgets import QApplication import sys def main(): app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_()) if __name__ == '__main__': main()
8a2fa77e9a860b3b2ac21b16b7d0e7fe45df1e7a
f5a87723b69e4c52f4f95c27c4d3bdbbe801212b
/homeassistant/components/pi_hole/config_flow.py
5acaffd13b1b53afe90082e2186b85a02de9055d
[ "Apache-2.0" ]
permissive
craigjmidwinter/home-assistant
b5ef821213dfeacb67e12fa6a5f76cfd898b9aff
68ca0a05c8a849ba374539e3c6a883555a567abf
refs/heads/dev
2023-07-20T00:00:10.335031
2021-12-04T00:13:16
2021-12-04T00:13:16
75,567,206
1
0
Apache-2.0
2023-09-13T06:57:26
2016-12-04T21:57:33
Python
UTF-8
Python
false
false
6,146
py
"""Config flow to configure the Pi-hole integration.""" from __future__ import annotations import logging from typing import Any from hole import Hole from hole.exceptions import HoleError import voluptuous as vol from homeassistant import config_entries from homeassistant.components.pi_hole.const import ( CONF_LOCATION, CONF_STATISTICS_ONLY, DEFAULT_LOCATION, DEFAULT_NAME, DEFAULT_SSL, DEFAULT_STATISTICS_ONLY, DEFAULT_VERIFY_SSL, DOMAIN, ) from homeassistant.const import ( CONF_API_KEY, CONF_HOST, CONF_NAME, CONF_PORT, CONF_SSL, CONF_VERIFY_SSL, ) from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers.aiohttp_client import async_get_clientsession _LOGGER = logging.getLogger(__name__) class PiHoleFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): """Handle a Pi-hole config flow.""" VERSION = 1 def __init__(self) -> None: """Initialize the config flow.""" self._config: dict = {} async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initiated by the user.""" return await self.async_step_init(user_input) async def async_step_import( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initiated by import.""" return await self.async_step_init(user_input, is_import=True) async def async_step_init( self, user_input: dict[str, Any] | None, is_import: bool = False ) -> FlowResult: """Handle init step of a flow.""" errors = {} if user_input is not None: host = ( user_input[CONF_HOST] if is_import else f"{user_input[CONF_HOST]}:{user_input[CONF_PORT]}" ) name = user_input[CONF_NAME] location = user_input[CONF_LOCATION] tls = user_input[CONF_SSL] verify_tls = user_input[CONF_VERIFY_SSL] endpoint = f"{host}/{location}" if await self._async_endpoint_existed(endpoint): return self.async_abort(reason="already_configured") try: await self._async_try_connect(host, location, tls, verify_tls) except HoleError as ex: _LOGGER.debug("Connection failed: %s", ex) if is_import: _LOGGER.error("Failed to import: %s", ex) return self.async_abort(reason="cannot_connect") errors["base"] = "cannot_connect" else: self._config = { CONF_HOST: host, CONF_NAME: name, CONF_LOCATION: location, CONF_SSL: tls, CONF_VERIFY_SSL: verify_tls, } if is_import: api_key = user_input.get(CONF_API_KEY) return self.async_create_entry( title=name, data={ **self._config, CONF_STATISTICS_ONLY: api_key is None, CONF_API_KEY: api_key, }, ) self._config[CONF_STATISTICS_ONLY] = user_input[CONF_STATISTICS_ONLY] if self._config[CONF_STATISTICS_ONLY]: return self.async_create_entry(title=name, data=self._config) return await self.async_step_api_key() user_input = user_input or {} return self.async_show_form( step_id="user", data_schema=vol.Schema( { vol.Required(CONF_HOST, default=user_input.get(CONF_HOST, "")): str, vol.Required( CONF_PORT, default=user_input.get(CONF_PORT, 80) ): vol.Coerce(int), vol.Required( CONF_NAME, default=user_input.get(CONF_NAME, DEFAULT_NAME) ): str, vol.Required( CONF_LOCATION, default=user_input.get(CONF_LOCATION, DEFAULT_LOCATION), ): str, vol.Required( CONF_STATISTICS_ONLY, default=user_input.get( CONF_STATISTICS_ONLY, DEFAULT_STATISTICS_ONLY ), ): bool, vol.Required( CONF_SSL, default=user_input.get(CONF_SSL, DEFAULT_SSL), ): bool, vol.Required( CONF_VERIFY_SSL, default=user_input.get(CONF_VERIFY_SSL, DEFAULT_VERIFY_SSL), ): bool, } ), errors=errors, ) async def async_step_api_key( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle step to setup API key.""" if user_input is not None: return self.async_create_entry( title=self._config[CONF_NAME], data={ **self._config, CONF_API_KEY: user_input.get(CONF_API_KEY, ""), }, ) return self.async_show_form( step_id="api_key", data_schema=vol.Schema({vol.Optional(CONF_API_KEY): str}), ) async def _async_endpoint_existed(self, endpoint: str) -> bool: existing_endpoints = [ f"{entry.data.get(CONF_HOST)}/{entry.data.get(CONF_LOCATION)}" for entry in self._async_current_entries() ] return endpoint in existing_endpoints async def _async_try_connect( self, host: str, location: str, tls: bool, verify_tls: bool ) -> None: session = async_get_clientsession(self.hass, verify_tls) pi_hole = Hole(host, session, location=location, tls=tls) await pi_hole.get_data()
9789466f6317a7c47b259e2c07f2ba93c65a8d5a
c0baf3c55b538ffd083fdf8b94e034323fcd980d
/Crawl Table.py
babe1280fdc2f52bb95e09b2d817d98cf6a8ce93
[]
no_license
krishna5737/Crawlers
9c96d15970f1a794c5c1c7f7fbae9a014bfe7015
0b2d3ae430ad77bb748476f1f9a12b320948db81
refs/heads/master
2020-03-17T05:32:35.491855
2018-05-14T07:23:46
2018-05-14T07:23:46
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,322
py
#import libraries BeautifulSoup, csv, urllib.request import bs4 as bs import urllib.request import csv def input_url(): #try to open the url using urllib if true return the url flag = 0 while (flag == 0): try: url = input("Enter URL: ") urllib.request.urlopen(url) flag = 1 except ValueError: print("Sorry, the url entered by you is not correct") continue return(url) def input_table_number(tables_in_page): while True: table_number = int(input("Enter Table :")) if(table_number>tables_in_page): print("Table number you want to export doesnot exist on page") continue elif(table_number <=0): print("Please enter valid table number") continue else: break return(table_number-1) def write_table_to_csv(url,output_csv,table_number,tables): out_file = open(output_csv,'w') #open the csv in which user want tables to be written csvwriter = csv.writer(out_file) table_rows = tables[table_number].find_all('tr') #find all table rows in ith table for tr in table_rows: td = tr.find_all('td') or tr.find_all('th') #append table data to td if the tag is td(table data) or th(table header) row = [i.text for i in td] # extract text from table data(remove tags) print(row) #print the data to terminal csvwriter.writerow(row)#write the data to csv def main(): #Check if the url entered by user is correct or not #Keep asking for correct url untill the url is valid url = input_url() source = urllib.request.urlopen(url) #open url using urllib soup = bs.BeautifulSoup(source,'lxml') #convert the url in htmltags using beautifulsoup #calculate number of tables on current page tables = soup.find_all('table') tables_in_page = len(tables) #Check if the table_number entered by user is correct or not #table_number should be a positive integer and less than total tables on age table_number = input_table_number(tables_in_page) #prompt user to enter the table name in which he wants data to be exported output_csv = input("Enter Output (CSV) filename: ") #write data to table write_table_to_csv(url,output_csv,table_number,tables) main()
e0b15df612ba3b856357439a9d6586d0186b146e
c0c4fe8f9aff2e7684fcaf10329f963873753b2a
/src/biotite/sequence/sequence.py
1a6b8230a35cd5b6afd265692459ee224fe40473
[ "BSD-3-Clause" ]
permissive
thomasnevolianis/biotite
85e1b9d6a1fbb5d9f81501a8ebc617bc26388ab9
916371eb602cfcacb2d5356659298ef38fa01fcc
refs/heads/master
2022-11-30T19:40:53.017368
2020-08-04T07:00:59
2020-08-04T07:00:59
285,375,415
0
0
BSD-3-Clause
2020-08-05T18:41:48
2020-08-05T18:41:47
null
UTF-8
Python
false
false
11,010
py
# This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. """ The module contains the :class:`Sequence` superclass and :class:`GeneralSequence`. """ __name__ = "biotite.sequence" __author__ = "Patrick Kunzmann" __all__ = ["Sequence"] import numbers import abc import numpy as np from .alphabet import Alphabet, LetterAlphabet from ..copyable import Copyable _size_uint8 = np.iinfo(np.uint8 ).max +1 _size_uint16 = np.iinfo(np.uint16).max +1 _size_uint32 = np.iinfo(np.uint32).max +1 class Sequence(Copyable, metaclass=abc.ABCMeta): """ The abstract base class for all sequence types. A :class:`Sequence` can be seen as a succession of symbols, that are elements in the allowed set of symbols, the :class:`Alphabet`. Internally, a :class:`Sequence` object uses a *NumPy* :class:`ndarray` of integers, where each integer represents a symbol. The :class:`Alphabet` of a :class:`Sequence` object is used to encode each symbol, that is used to create the :class:`Sequence`, into an integer. These integer values are called symbol code, the encoding of an entire sequence of symbols is called sequence code. The size of the symbol code type in the array is determined by the size of the :class:`Alphabet`: If the :class:`Alphabet` contains 256 symbols or less, one byte is used per array element; if the :class:`Alphabet` contains between 257 and 65536 symbols, two bytes are used, and so on. Two :class:`Sequence` objects are equal if they are instances of the same class, have the same :class:`Alphabet` and have equal sequence codes. Comparison with a string or list of symbols evaluates always to false. A :class:`Sequence` can be indexed by any 1-D index a :class:`ndarray` accepts. If the index is a single integer, the decoded symbol at that position is returned, otherwise a subsequence is returned. Individual symbols of the sequence can also be exchanged in indexed form: If the an integer is used as index, the item is treated as a symbol. Any other index (slice, index list, boolean mask) expects multiple symbols, either as list of symbols, as :class:`ndarray` containing a sequence code or another :class:`Sequence` instance. Concatenation of two sequences is achieved with the '+' operator. Each subclass of :class:`Sequence` needs to overwrite the abstract method :func:`get_alphabet()`, which specifies the alphabet the :class:`Sequence` uses. Parameters ---------- sequence : iterable object, optional The symbol sequence, the :class:`Sequence` is initialized with. For alphabets containing single letter strings, this parameter may also be a :class`str` object. By default the sequence is empty. Attributes ---------- code : ndarray The sequence code. symbols : list The list of symbols, represented by the sequence. The list is generated by decoding the sequence code, when this attribute is accessed. When this attribute is modified, the new list of symbols is encoded into the sequence code. alphabet : Alphabet The alphabet of this sequence. Cannot be set. Equal to `get_alphabet()`. Examples -------- Creating a DNA sequence from string and print the symbols and the code: >>> dna_seq = NucleotideSequence("ACGTA") >>> print(dna_seq) ACGTA >>> print(dna_seq.code) [0 1 2 3 0] >>> print(dna_seq.symbols) ['A' 'C' 'G' 'T' 'A'] >>> print(list(dna_seq)) ['A', 'C', 'G', 'T', 'A'] Sequence indexing: >>> print(dna_seq[1:3]) CG >>> print(dna_seq[[0,2,4]]) AGA >>> print(dna_seq[np.array([False,False,True,True,True])]) GTA Sequence manipulation: >>> dna_copy = dna_seq.copy() >>> dna_copy[2] = "C" >>> print(dna_copy) ACCTA >>> dna_copy = dna_seq.copy() >>> dna_copy[0:2] = dna_copy[3:5] >>> print(dna_copy) TAGTA >>> dna_copy = dna_seq.copy() >>> dna_copy[np.array([True,False,False,False,True])] = "T" >>> print(dna_copy) TCGTT >>> dna_copy = dna_seq.copy() >>> dna_copy[1:4] = np.array([0,1,2]) >>> print(dna_copy) AACGA Reverse sequence: >>> dna_seq_rev = dna_seq.reverse() >>> print(dna_seq_rev) ATGCA Concatenate the two sequences: >>> dna_seq_concat = dna_seq + dna_seq_rev >>> print(dna_seq_concat) ACGTAATGCA """ def __init__(self, sequence=()): self.symbols = sequence def copy(self, new_seq_code=None): """ Copy the object. Parameters ---------- new_seq_code : ndarray, optional If this parameter is set, the sequence code is set to this value, rather than the original sequence code. Returns ------- copy A copy of this object. """ # Override in order to achieve better performance, # in case only a subsequence is needed, # because not the entire sequence code is copied then clone = self.__copy_create__() if new_seq_code is None: clone.code = np.copy(self.code) else: clone.code = new_seq_code self.__copy_fill__(clone) return clone @property def symbols(self): return self.get_alphabet().decode_multiple(self.code) @symbols.setter def symbols(self, value): alph = self.get_alphabet() dtype = Sequence._dtype(len(alph)) self._seq_code = alph.encode_multiple(value, dtype) @property def code(self): return self._seq_code @code.setter def code(self, value): dtype = Sequence._dtype(len(self.get_alphabet())) if not isinstance(value, np.ndarray): raise TypeError("Sequence code must be an integer ndarray") self._seq_code = value.astype(dtype, copy=False) @property def alphabet(self): return self.get_alphabet() @abc.abstractmethod def get_alphabet(self): """ Get the :class:`Alphabet` of the :class:`Sequence`. This method must be overwritten, when subclassing :class:`Sequence`. Returns ------- alphabet : Alphabet :class:`Sequence` alphabet. """ pass def reverse(self): """ Reverse the :class:`Sequence`. Returns ------- reversed : Sequence The reversed :class:`Sequence`. Examples -------- >>> dna_seq = NucleotideSequence("ACGTA") >>> dna_seq_rev = dna_seq.reverse() >>> print(dna_seq_rev) ATGCA """ reversed_code = np.flip(np.copy(self._seq_code), axis=0) reversed = self.copy(reversed_code) return reversed def is_valid(self): """ Check, if the sequence contains a valid sequence code. A sequence code is valid, if at each sequence position the code is smaller than the size of the alphabet. Invalid code means that the code cannot be decoded into symbols. Furthermore invalid code can lead to serious errors in alignments, since the substitution matrix is indexed with an invalid index. Returns ------- valid : bool True, if the sequence is valid, false otherwise. """ return (self.code < len(self.get_alphabet())).all() def get_symbol_frequency(self): """ Get the number of occurences of each symbol in the sequence. If a symbol does not occur in the sequence, but it is in the alphabet, its number of occurences is 0. Returns ------- frequency : dict A dictionary containing the symbols as keys and the corresponding number of occurences in the sequence as values. """ frequencies = {} for code, symbol in enumerate(self.get_alphabet()): frequencies[symbol] = len(np.nonzero((self._seq_code == code))[0]) return frequencies def __getitem__(self, index): alph = self.get_alphabet() sub_seq = self._seq_code.__getitem__(index) if isinstance(sub_seq, np.ndarray): return self.copy(sub_seq) else: return alph.decode(sub_seq) def __setitem__(self, index, item): alph = self.get_alphabet() if isinstance(index, numbers.Integral): # Expect a single symbol code = alph.encode(item) else: # Expect multiple symbols if isinstance(item, Sequence): code = item.code elif isinstance(item, np.ndarray): code = item else: # Default: item is iterable object of symbols code = alph.encode_multiple(item) self._seq_code.__setitem__(index, code) def __len__(self): return len(self._seq_code) def __iter__(self): alph = self.get_alphabet() i = 0 while i < len(self): yield alph.decode(self._seq_code[i]) i += 1 def __eq__(self, item): if not isinstance(item, type(self)): return False if self.get_alphabet() != item.get_alphabet(): return False return np.array_equal(self._seq_code, item._seq_code) def __str__(self): alph = self.get_alphabet() if isinstance(alph, LetterAlphabet): return alph.decode_multiple(self._seq_code, as_bytes=True)\ .tobytes().decode("ASCII") else: return "".join(alph.decode_multiple(self._seq_code)) def __add__(self, sequence): if self.get_alphabet().extends(sequence.get_alphabet()): new_code = np.concatenate((self._seq_code, sequence._seq_code)) new_seq = self.copy(new_code) return new_seq elif sequence.get_alphabet().extends(self.get_alphabet()): new_code = np.concatenate((self._seq_code, sequence._seq_code)) new_seq = sequence.copy(new_code) return new_seq else: raise ValueError("The sequences alphabets are not compatible") @staticmethod def _dtype(alphabet_size): if alphabet_size <= _size_uint8: return np.uint8 elif alphabet_size <= _size_uint16: return np.uint16 elif alphabet_size <= _size_uint32: return np.uint32 else: return np.uint64
95ee6d9028cb4c1c7c5a614b96db2580eee8344c
e859d4604615e4ff3c6730554b12ae7b09e86286
/django-stubs/db/models/fields/files.pyi
bb53d5944104eade0990047b3af0abafb3dbaff7
[ "BSD-3-Clause" ]
permissive
microblag/django-stubs
d91655c346279424cf5e57b80a0b104dceb86ddc
d0eb05832551d344f06ec3e83cb850866a4d37c2
refs/heads/master
2020-04-18T05:18:24.887114
2019-02-06T04:02:28
2019-02-06T04:02:28
167,273,694
0
0
null
2019-01-24T00:12:42
2019-01-24T00:12:42
null
UTF-8
Python
false
false
2,954
pyi
from typing import Any, Callable, List, Optional, Type, Union from django.core.checks.messages import Error from django.core.files.base import File from django.core.files.images import ImageFile from django.core.files.storage import FileSystemStorage, Storage from django.db.models.base import Model from django.db.models.fields import Field from django.forms import fields as form_fields class FieldFile(File): instance: Model = ... field: FileField = ... storage: FileSystemStorage = ... def __init__(self, instance: Model, field: FileField, name: Optional[str]) -> None: ... file: Any = ... @property def path(self) -> str: ... @property def url(self) -> str: ... @property def size(self) -> int: ... def save(self, name: str, content: File, save: bool = ...) -> None: ... def delete(self, save: bool = ...) -> None: ... @property def closed(self) -> bool: ... class FileDescriptor: field: FileField = ... def __init__(self, field: FileField) -> None: ... def __get__(self, instance: Optional[Model], cls: Type[Model] = ...) -> Union[FieldFile, FileDescriptor]: ... def __set__(self, instance: Model, value: Optional[Any]) -> None: ... class FileField(Field): attr_class: Any = ... descriptor_class: Any = ... description: Any = ... storage: Any = ... upload_to: Any = ... def __init__( self, verbose_name: Optional[str] = ..., name: Optional[str] = ..., upload_to: Union[Callable, str] = ..., storage: Optional[Storage] = ..., **kwargs: Any ) -> None: ... def check(self, **kwargs: Any) -> List[Error]: ... def deconstruct(self) -> Any: ... def get_internal_type(self) -> str: ... def get_prep_value(self, value: Union[FieldFile, str]) -> str: ... def pre_save(self, model_instance: Model, add: bool) -> FieldFile: ... def generate_filename(self, instance: Optional[Model], filename: str) -> str: ... def save_form_data(self, instance: Model, data: Optional[Union[bool, File, str]]) -> None: ... def formfield(self, **kwargs: Any) -> form_fields.FileField: ... class ImageFileDescriptor(FileDescriptor): field: ImageField def __set__(self, instance: Model, value: Optional[str]) -> None: ... class ImageFieldFile(ImageFile, FieldFile): field: ImageField def delete(self, save: bool = ...) -> None: ... class ImageField(FileField): def __init__( self, verbose_name: Optional[str] = ..., name: Optional[str] = ..., width_field: Optional[str] = ..., height_field: Optional[str] = ..., **kwargs: Any ) -> None: ... def check(self, **kwargs: Any) -> List[Any]: ... def deconstruct(self) -> Any: ... def update_dimension_fields(self, instance: Model, force: bool = ..., *args: Any, **kwargs: Any) -> None: ... def formfield(self, **kwargs: Any) -> form_fields.ImageField: ...
10f7c480f2212599841736bdfdf28fe0de43ab30
9183f1bc6a78c04552c4fbcf095415ed1603cc8b
/plants.py
e27d021cefa3c05b201c14a36e1417aa1412fe58
[]
no_license
Alexander4127/plant-searcher-app
4c942a8d0533d55ffac68fe0f897448db2b55545
d120292a6ed753c9f848375ec139e91d0b70f8d5
refs/heads/main
2023-09-05T14:36:26.613002
2021-10-25T16:14:35
2021-10-25T16:14:35
385,708,708
0
0
null
null
null
null
UTF-8
Python
false
false
10,297
py
import requests from bs4 import BeautifulSoup import pandas as pd import numpy as np class PlantFinder: def __init__(self): self._categories = [] self._spec_desc = [] self._data = pd.DataFrame() self._pests = pd.DataFrame() self._all_colours = set() self.collect_info() self.find_colours() self.get_pests() def collect_info(self): number_pages = 29 plant_refs = [] for cur_number in range(1, number_pages): url = f'http://www.pro-landshaft.ru/plants/catalog/{cur_number}/' soup = BeautifulSoup(requests.get(url).content, 'html.parser') for tag in soup.find_all('li', soup.body.strong.parent.parent.parent.ul)[3:][:-14]: plant_refs.append(tag.a['href']) url = f'http://www.pro-landshaft.ru/plants/catalog/1/' soup = BeautifulSoup(requests.get(url).content, 'html.parser') cat = soup.find_all('ul', soup.body.strong.parent.parent.parent)[1] self._categories = [tag.text.strip() for tag in soup.find_all('li', cat)[-14:]] photos = [] common_desc = [] plant_cat = [] pages_refs = [] for ref in plant_refs[:10]: url = f'http://www.pro-landshaft.ru{ref}' soup = BeautifulSoup(requests.get(url).content, 'html.parser') info = soup.body.find_all('p') cur_cat = [tag.text.strip() for tag in info[1].find_all('a')] first_type = 0 cur_photo = '' while not info[first_type].text.startswith('Описание'): if info[first_type].img and not cur_photo: cur_photo = 'http://www.pro-landshaft.ru{}'.format(info[first_type].img['src']) first_type += 1 if first_type == len(info): first_type = 5 break common_info = info[first_type].text.strip()[8:] first_type += 1 if not common_info: common_info = info[first_type].text.strip() if info[first_type].img and not cur_photo: cur_photo = 'http://www.pro-landshaft.ru{}'.format(info[first_type].img['src'].replace(' ', '%20')) first_type += 1 if not common_info: common_info = info[first_type].text.strip() for cur_type in range(first_type, len(info)): if info[first_type].img and not cur_photo: cur_photo = 'http://www.pro-landshaft.ru{}'.format(info[first_type].img['src'].replace(' ', '%20')) if info[cur_type].strong: if info[cur_type].font or not info[cur_type].text.strip(): break plant_cat.append([int(cat in cur_cat) for cat in self._categories]) photos.append(cur_photo) common_desc.append(common_info) pages_refs.append(url) self._spec_desc.append(info[cur_type].text.strip()) names = [' '.join(string.split()[:2]).strip(',').strip(' –') for string in self._spec_desc] df1 = pd.DataFrame( { 'Name': names, 'General Description': common_desc, 'Special Description': self._spec_desc, 'Photo': photos, 'Link Page': pages_refs } ) df2 = pd.DataFrame(np.array(plant_cat), columns=self._categories) self._data = pd.concat([df1, df2], axis=1) def find_colours(self): url = 'https://colorscheme.ru/color-names.html' soup = BeautifulSoup(requests.get(url).content, 'html.parser') colours = set() for tag in soup.find_all('td'): if tag.text.strip(): word = tag.text.strip().split()[-1] if 'а' < word[0] < 'я' or 'А' < word[0] < 'Я': colours.add(word) colours = list(colours) for i in range(len(colours)): colours[i] = colours[i].lower() if '-' in colours[i]: colours[i] = colours[i][colours[i].rfind('-') + 1:] if colours[i].endswith('ый') or colours[i].endswith('ий'): self._all_colours.add(colours[i][:-2]) colours_exist = [''] * len(self._spec_desc) for i in range(len(self._spec_desc)): string = self._spec_desc[i] for colour in self._all_colours: if colour in string: colours_exist[i] += colour + ' ' self._data = pd.concat([self._data, pd.DataFrame({'Colours': colours_exist})], axis=1) def get_pests(self): photos = [] links = [] names = [] info = [] for j in range(1, 7): url = f'http://www.udec.ru/vrediteli/page/{j}' soup = BeautifulSoup(requests.get(url).content, 'html.parser') result = [child for child in soup.find('h1').parent.children][3].find_all('div') for k in range(0, len(result), 2): cur_pest = result[k] finded_tags = cur_pest.find_all('a') if len(finded_tags) < 2 or not self.check_pest(finded_tags[1].text): continue if 'belyanka' in finded_tags[0]['href']: continue photos.append(finded_tags[0].img['src']) links.append(finded_tags[0]['href']) names.append(finded_tags[1].text.strip()) classes = BeautifulSoup(requests.get(links[-1]).content, 'html.parser').find_all('p') for i in range(len(classes)): if self.check_obj(classes[i]) and not self.check_obj(classes[i + 1]): all_info = '' counter = i + 1 while counter < len(classes) and not \ ((not classes[counter].strong and classes[counter].text.strip().startswith('Меры')) or (classes[counter].strong and classes[counter].strong.text.strip().startswith('Меры'))): all_info += classes[counter].text.strip() counter += 1 info.append(all_info) break self._pests = pd.DataFrame( { 'Name': names, 'Info': info, 'Photo': photos, 'Link': links } ) def __call__(self, plant_types, plant_colour, plant_name): plant_name = plant_name.lower() if plant_name: indexes = self._data.apply(lambda row: plant_name in row['Name'].lower(), axis=1) else: indexes = self._data.apply(lambda row: self.match_query(row, plant_types, plant_colour), axis=1) if self._data[indexes].empty: return None result = self._data[indexes].sample(1) form_data = { "res_plant_name": result["Name"].values[0], "general_desc": result["General Description"].values[0], "spec_desc": result["Special Description"].values[0], "photo_ref": result["Photo"].values[0], "page_ref": result["Link Page"].values[0] } name = result['Name'].values[0] key_word = name.split()[0][:-1].lower() indexes = self._pests.apply(lambda row: key_word in row['Info'].lower(), axis=1) if not self._pests[indexes].empty: pest = self._pests[indexes].sample(1) form_data['pest_name'] = pest['Name'].values[0] form_data['pest_info'] = pest['Info'].values[0] form_data['pest_photo'] = pest['Photo'].values[0] form_data['pest_link'] = pest['Link Page'].values[0] else: form_data['pest_name'] = 'nothing' return form_data @staticmethod def check_pest(string): for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": if letter in string: return True return False @staticmethod def good_start(string): for start in ['Семья', 'Семейство', 'Ряд']: if string.startswith(start): return True return False def check_obj(self, obj): return (not obj.strong and self.good_start(obj.text.strip())) or \ (obj.strong and self.good_start(obj.strong.text.strip())) @staticmethod def match_query(row, cur_types, cur_colour): for cur_type in cur_types: if not row[cur_type]: return False return cur_colour[:-2] in row['Colours'] class RandomWeedInfo: def __init__(self): self._weeds = pd.DataFrame() self.get_weeds() @staticmethod def check_weed(string): for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": if letter in string: return True return False def get_weeds(self): photo = [] link = [] info = [] name = [] for k in range(1, 4): url = f'http://www.udec.ru/sornyaki/page/{k}' soup = BeautifulSoup(requests.get(url).content, 'html.parser') result = soup.body.find('h1').parent.div.find_all('div') for i in range(1, len(result), 2): found_tags = result[i].find_all('a') if len(found_tags) < 2 or not self.check_weed(found_tags[1].text): continue photo.append(found_tags[0].img['src']) link.append(found_tags[0]['href']) name.append(found_tags[1].text.strip()) classes = BeautifulSoup(requests.get(link[-1]).content, 'html.parser').find_all('p')[3:][:-1] all_info = '' for cur_class in classes: all_info += cur_class.text.strip() + '\n' info.append(all_info) self._weeds = pd.DataFrame( { 'Name': name, 'Info': info, 'Photo': photo, 'Link': link } ) def __call__(self): return self._weeds.sample(1)
4c838e38957b8e229ba09084ca17679920d4a87a
85a9ffeccb64f6159adbd164ff98edf4ac315e33
/pysnmp/XYPLEX-LAT1-MIB.py
9115a68e1bcae47973be45f12f9172c3ebd1ff1c
[ "Apache-2.0" ]
permissive
agustinhenze/mibs.snmplabs.com
5d7d5d4da84424c5f5a1ed2752f5043ae00019fb
1fc5c07860542b89212f4c8ab807057d9a9206c7
refs/heads/master
2020-12-26T12:41:41.132395
2019-08-16T15:51:41
2019-08-16T15:53:57
237,512,469
0
0
Apache-2.0
2020-01-31T20:41:36
2020-01-31T20:41:35
null
UTF-8
Python
false
false
19,721
py
# # PySNMP MIB module XYPLEX-LAT1-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-LAT1-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:40:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibIdentifier, IpAddress, Counter32, enterprises, NotificationType, Integer32, Bits, iso, Counter64, Gauge32, TimeTicks, Unsigned32, ModuleIdentity, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "IpAddress", "Counter32", "enterprises", "NotificationType", "Integer32", "Bits", "iso", "Counter64", "Gauge32", "TimeTicks", "Unsigned32", "ModuleIdentity", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") xyplex = MibIdentifier((1, 3, 6, 1, 4, 1, 33)) lat = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 3)) latAnnounceServices = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latAnnounceServices.setStatus('mandatory') latCircuitTimer = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(30, 200))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latCircuitTimer.setStatus('mandatory') latIdentificationLengthLimit = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latIdentificationLengthLimit.setStatus('mandatory') latKeepaliveTimer = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 180))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latKeepaliveTimer.setStatus('mandatory') latMulticastTimer = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 180))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latMulticastTimer.setStatus('mandatory') latNodeLimit = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latNodeLimit.setStatus('mandatory') latNumber = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 32767))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latNumber.setStatus('mandatory') latRetransmitLimit = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 120))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latRetransmitLimit.setStatus('mandatory') latLocalServiceGroups = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: latLocalServiceGroups.setStatus('mandatory') latGroupPurge = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latGroupPurge.setStatus('mandatory') latNodePurge = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latNodePurge.setStatus('mandatory') latNodesRejected = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodesRejected.setStatus('mandatory') latInMessages = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInMessages.setStatus('mandatory') latOutMessages = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latOutMessages.setStatus('mandatory') latInSessionsAccepted = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInSessionsAccepted.setStatus('mandatory') latInSessionsRejected = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInSessionsRejected.setStatus('mandatory') latAddressChange = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latAddressChange.setStatus('mandatory') latInDuplicates = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInDuplicates.setStatus('mandatory') latOutRetransmits = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latOutRetransmits.setStatus('mandatory') latInBadMessages = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInBadMessages.setStatus('mandatory') latInBadSlots = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInBadSlots.setStatus('mandatory') latInBadMulticasts = MibScalar((1, 3, 6, 1, 4, 1, 33, 3, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latInBadMulticasts.setStatus('mandatory') latPortTable = MibTable((1, 3, 6, 1, 4, 1, 33, 3, 23), ) if mibBuilder.loadTexts: latPortTable.setStatus('mandatory') latPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 3, 23, 1), ).setIndexNames((0, "XYPLEX-LAT1-MIB", "latPortIndex")) if mibBuilder.loadTexts: latPortEntry.setStatus('mandatory') latPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 23, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latPortIndex.setStatus('mandatory') latPortAuthorizedGroups = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 23, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: latPortAuthorizedGroups.setStatus('mandatory') latPortAutoPrompt = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 23, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latPortAutoPrompt.setStatus('mandatory') latPortCurrentGroups = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 23, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: latPortCurrentGroups.setStatus('mandatory') latPortRemoteModification = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 23, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latPortRemoteModification.setStatus('mandatory') latOfferedServiceTable = MibTable((1, 3, 6, 1, 4, 1, 33, 3, 24), ) if mibBuilder.loadTexts: latOfferedServiceTable.setStatus('mandatory') latOfferedServiceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 3, 24, 1), ).setIndexNames((0, "XYPLEX-LAT1-MIB", "latOfferedServiceName")) if mibBuilder.loadTexts: latOfferedServiceEntry.setStatus('mandatory') latOfferedServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServiceName.setStatus('mandatory') latOfferedServiceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2))).clone('valid')).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServiceStatus.setStatus('mandatory') latOfferedServiceAllowConnections = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServiceAllowConnections.setStatus('mandatory') latOfferedServiceIdentification = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServiceIdentification.setStatus('mandatory') latOfferedServicePassword = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServicePassword.setStatus('mandatory') latOfferedServicePortMap = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 6), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServicePortMap.setStatus('mandatory') latOfferedServiceQueuing = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 24, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latOfferedServiceQueuing.setStatus('mandatory') latVisibleServiceTable = MibTable((1, 3, 6, 1, 4, 1, 33, 3, 25), ) if mibBuilder.loadTexts: latVisibleServiceTable.setStatus('mandatory') latVisibleServiceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 3, 25, 1), ).setIndexNames((0, "XYPLEX-LAT1-MIB", "latVisibleServiceName")) if mibBuilder.loadTexts: latVisibleServiceEntry.setStatus('mandatory') latVisibleServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceName.setStatus('mandatory') latVisibleServiceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("available", 1), ("unavailable", 2), ("unknown", 3), ("unreachable", 4), ("reachable", 5), ("connected", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceStatus.setStatus('mandatory') latVisibleServiceNode = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceNode.setStatus('mandatory') latVisibleServiceConnectedSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceConnectedSessions.setStatus('mandatory') latVisibleServiceIdentification = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceIdentification.setStatus('mandatory') latVisibleServiceRating = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 25, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latVisibleServiceRating.setStatus('mandatory') latNodeTable = MibTable((1, 3, 6, 1, 4, 1, 33, 3, 26), ) if mibBuilder.loadTexts: latNodeTable.setStatus('mandatory') latNodeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 3, 26, 1), ).setIndexNames((0, "XYPLEX-LAT1-MIB", "latNodeName")) if mibBuilder.loadTexts: latNodeEntry.setStatus('mandatory') latNodeName = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeName.setStatus('mandatory') latNodeStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("available", 1), ("unavailable", 2), ("unknown", 3), ("unreachable", 4), ("reachable", 5), ("connected", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeStatus.setStatus('mandatory') latNodeConnectedSessions = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 3), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeConnectedSessions.setStatus('mandatory') latNodeAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeAddress.setStatus('mandatory') latNodeDataLinkFrame = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeDataLinkFrame.setStatus('mandatory') latNodeIdentification = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeIdentification.setStatus('mandatory') latNodeGroups = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: latNodeGroups.setStatus('mandatory') latNodeServiceNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeServiceNumber.setStatus('mandatory') latNodeZero = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ready", 1), ("execute", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: latNodeZero.setStatus('mandatory') latNodeZeroTime = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 10), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeZeroTime.setStatus('mandatory') latNodeInMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInMessages.setStatus('mandatory') latNodeOutMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeOutMessages.setStatus('mandatory') latNodeInSlots = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInSlots.setStatus('mandatory') latNodeOutSlots = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeOutSlots.setStatus('mandatory') latNodeInBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInBytes.setStatus('mandatory') latNodeOutBytes = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeOutBytes.setStatus('mandatory') latNodeAddressChange = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeAddressChange.setStatus('mandatory') latNodeInDuplicates = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInDuplicates.setStatus('mandatory') latNodeOutRetransmits = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeOutRetransmits.setStatus('mandatory') latNodeInBadMessages = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInBadMessages.setStatus('mandatory') latNodeInBadSlots = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInBadSlots.setStatus('mandatory') latNodeInSessionsAccepted = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInSessionsAccepted.setStatus('mandatory') latNodeInSessionsRejected = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 3, 26, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: latNodeInSessionsRejected.setStatus('mandatory') mibBuilder.exportSymbols("XYPLEX-LAT1-MIB", latNodeLimit=latNodeLimit, latOfferedServiceStatus=latOfferedServiceStatus, latInBadSlots=latInBadSlots, latOfferedServiceIdentification=latOfferedServiceIdentification, latMulticastTimer=latMulticastTimer, latOfferedServiceEntry=latOfferedServiceEntry, latVisibleServiceTable=latVisibleServiceTable, latNodeStatus=latNodeStatus, xyplex=xyplex, latOfferedServiceQueuing=latOfferedServiceQueuing, latVisibleServiceConnectedSessions=latVisibleServiceConnectedSessions, latPortCurrentGroups=latPortCurrentGroups, latOutMessages=latOutMessages, latNodeInBytes=latNodeInBytes, latVisibleServiceRating=latVisibleServiceRating, latInBadMessages=latInBadMessages, lat=lat, latGroupPurge=latGroupPurge, latNodeZero=latNodeZero, latKeepaliveTimer=latKeepaliveTimer, latInMessages=latInMessages, latInSessionsRejected=latInSessionsRejected, latNodeAddressChange=latNodeAddressChange, latCircuitTimer=latCircuitTimer, latNodeOutRetransmits=latNodeOutRetransmits, latRetransmitLimit=latRetransmitLimit, latOfferedServiceAllowConnections=latOfferedServiceAllowConnections, latOfferedServicePortMap=latOfferedServicePortMap, latVisibleServiceNode=latVisibleServiceNode, latAnnounceServices=latAnnounceServices, latNodeZeroTime=latNodeZeroTime, latNodeDataLinkFrame=latNodeDataLinkFrame, latNodeTable=latNodeTable, latVisibleServiceStatus=latVisibleServiceStatus, latNodeConnectedSessions=latNodeConnectedSessions, latNodeInSessionsRejected=latNodeInSessionsRejected, latNodeInBadSlots=latNodeInBadSlots, latOfferedServiceName=latOfferedServiceName, latNodeEntry=latNodeEntry, latNodeOutSlots=latNodeOutSlots, latInSessionsAccepted=latInSessionsAccepted, latVisibleServiceName=latVisibleServiceName, latNodePurge=latNodePurge, latNodeOutMessages=latNodeOutMessages, latOfferedServiceTable=latOfferedServiceTable, latInBadMulticasts=latInBadMulticasts, latNodeInMessages=latNodeInMessages, latNodeInSlots=latNodeInSlots, latPortTable=latPortTable, latOfferedServicePassword=latOfferedServicePassword, latNodeGroups=latNodeGroups, latPortAutoPrompt=latPortAutoPrompt, latLocalServiceGroups=latLocalServiceGroups, latNodeServiceNumber=latNodeServiceNumber, latPortEntry=latPortEntry, latPortRemoteModification=latPortRemoteModification, latIdentificationLengthLimit=latIdentificationLengthLimit, latNumber=latNumber, latVisibleServiceIdentification=latVisibleServiceIdentification, latNodeIdentification=latNodeIdentification, latNodeOutBytes=latNodeOutBytes, latNodeInBadMessages=latNodeInBadMessages, latInDuplicates=latInDuplicates, latNodeName=latNodeName, latVisibleServiceEntry=latVisibleServiceEntry, latAddressChange=latAddressChange, latPortIndex=latPortIndex, latNodeAddress=latNodeAddress, latNodeInDuplicates=latNodeInDuplicates, latNodeInSessionsAccepted=latNodeInSessionsAccepted, latPortAuthorizedGroups=latPortAuthorizedGroups, latNodesRejected=latNodesRejected, latOutRetransmits=latOutRetransmits)
11b93de78ab70c6b13026e2928e725308a40b872
498f06792cf33c7925808ff2ab77374eec77e2f0
/test.py
85f4eb863ce68753257fbf2751ed5f9c400326bd
[]
no_license
NameLacker/hello-world
dcdd0e273a2c494c6a8e0cb49cdff635015b0e5a
a7627473ec9f5fb1a762aeeff49b8eca6cced9a0
refs/heads/master
2020-04-04T01:00:21.826230
2018-11-01T05:31:47
2018-11-01T05:31:47
155,664,299
0
0
null
2018-11-01T05:30:07
2018-11-01T05:03:04
null
UTF-8
Python
false
false
653
py
import numpy as np # import heapq # a = np.array([[1,np.nan,2.1,5],[1.3,2,3,2],[1,2,6,2],[2, 1,7,2]], dtype='float32') ##### 处理nan,inf###### # nan = np.isnan(a) # print(nan) # a[nan] = 0 # print(a) ##### 处理nan,inf###### ##### 找最大值索引###### # a = np.array([2,34,1,5,5]) # c = a.argsort()[-3:][::-1] # c = (-a).argsort()[:2] # print(c) # a = np.random.randint(0, 10, 6) # b = np.random.randint(0, 10, 6) # c = np.random.randint(0, 10, 6) # d = np.row_stack((a, b)) # d = np.row_stack((c ,d)) ##### 处理nan,inf###### a = np.array([ [1,2,3], [2,3,4], [2,3,5] ]) print(a[:,2])
09e0f6c4d47782c5b4710ab60f4a4e5b02c290a1
314de118562454e7b72406905af4906c6f528794
/xor.py
00e42149ed2c304906bab3bb6f57eee37250aa8e
[]
no_license
AkhilSinghania/XOR_Backprop
bc03b0e153d4fb058ec3cb463e810b45e4ca3891
539e287c050c04c1be8ede3cef71d06ada456112
refs/heads/master
2021-01-23T00:09:41.475833
2017-03-22T08:50:45
2017-03-22T08:50:45
85,703,098
1
0
null
null
null
null
UTF-8
Python
false
false
2,013
py
import sys import numpy as np def sigmoid(x): #Activation Function used in forward propagation return 1/(1+np.exp(-x)) def sigmoidDash(x): #Derivative of sigmoid function #Activation function used in back propagation return x*(1-x) #Given Data x = np.array(([0,0],[0,1],[1,0],[1,1])) #4x2 matrix #Actual Output (The Output expected by the result of our neural network) y = np.array(([0],[1],[1],[1])) #4x1 matrix #Command for generating the same random numbers every time #Makes it easy for Debugging np.random.seed(1) #Intializing random synapse weights W1 = np.random.randn(2,4) #2x4 matrix W2 = np.random.randn(4,1) #4x1 vector for i in range(500000): #Forward propagation layer1 = x #input layer layer2 = sigmoid(np.dot(layer1,W1)) #4x4 matrix, Hidden layer layer3 = sigmoid(np.dot(layer2,W2)) #4x1 vector, Output layer #^In Forward propgation we first multiply the #values of each node with weights of the synapses #and then use the activation function to get the #value for the node in next layer #Calculating Error layer3_error = y - layer3 #4x1 vector #Backward propagation layer3_Delta = layer3_error*sigmoidDash(layer3) #4x1 vector layer2_error = layer3_Delta.dot(W2.T) #4x4 matrix layer2_Delta = layer2_error*sigmoidDash(layer2) #4x4 matrix #^In Backward propgation we first use the derivative #(Derivative - slope of the Activation Function) #of activation function and then multiply the error #of that particular layer to get a value Delta for #that particular layer. This Delta value is then #multiplied with the weight of the synapses to get #the error in the previous layer. This goes till the #second layer as there is no error in the input layer. #Performing Gradient Descent To change the weights accordingly W2 += layer2.T.dot(layer3_Delta) #4x1 vector W1 += layer1.T.dot(layer2_Delta) #2x4 matrix #Printing the Output print ("Output:") print (layer3)
9af8ed039c844e9b466786e5d8b703d49786ae92
cb79ccd823e4a40fce3534d8fb8ba9094e08a5b8
/Model/category.py
4084a855416dcb83ab04fd199e533a50e631ae4d
[ "MIT" ]
permissive
ouldevloper/booksmanagement
55b811f03b499415da341fd44fb6de89223fd1d8
ca518107c178c326c091a16d7a2348c0c29a44ca
refs/heads/main
2023-03-27T19:51:33.286285
2021-04-03T00:34:11
2021-04-03T00:34:11
352,447,646
2
0
null
null
null
null
UTF-8
Python
false
false
461
py
# @Author: Abdellah Oulahyane # @Date: 2021-03-24 07:01:27 # @Last Modified by: Abdellah Oulahyane # @Last Modified time: 2021-03-28 04:11:31 # @Contact fb.com/maruki00 from Model.sys.Model import Model class Category(Model): def __init__(self, id=None, label=None, description=None ): self.id = id self.label = label self.description = description
a8b3d3d08593ea6f9f48b305c4117d8e4a37ed90
5b92536804e0abd77e0385e78c5412173c0829b6
/resume_parsing.py
d2e54450e609de224956a8b64a9fb035cea0cdff
[]
no_license
deepikavemuri/pythonPractise
f2a1e51460b3f647583fde36f0cf0818c1a75095
f16c663bb8c09f557edf2418a6a6b990e2a77853
refs/heads/main
2023-03-04T20:10:39.909848
2021-02-03T07:39:56
2021-02-03T07:39:56
335,537,508
0
0
null
null
null
null
UTF-8
Python
false
false
605
py
import nltk import os resume_folder = '/home/anantharam/Deepika/Resumes_text' resumes = os.listdir(resume_folder) for resume_path in resumes: document = open(resume_folder + "/" + resume_path) x = document.read() x = x.replace("\n", " ") print(x) job_keyWords = ['Python', 'C', 'Finance'] #lines = x.split('\n') #words = [] s = "" # temp = open(keyword_content, 'a+') words = nltk.word_tokenize(x) print(words) for word in words: if word in job_keyWords: f = open(word+'.txt', 'a+') #print(s) if word not in temp: s += word f.write(resume_path + ",") f.close()
f15ea5350f91db08607111b1b3da17afdb7e9df0
e10a6d844a286db26ef56469e31dc8488a8c6f0e
/compositional_rl/gwob/examples/web_environment_example.py
db65accda519a7ce01ec591613e7c7d0385b57be
[ "Apache-2.0", "CC-BY-4.0" ]
permissive
Jimmy-INL/google-research
54ad5551f97977f01297abddbfc8a99a7900b791
5573d9c5822f4e866b6692769963ae819cb3f10d
refs/heads/master
2023-04-07T19:43:54.483068
2023-03-24T16:27:28
2023-03-24T16:32:17
282,682,170
1
0
Apache-2.0
2020-07-26T15:50:32
2020-07-26T15:50:31
null
UTF-8
Python
false
false
6,400
py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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. """Example execution of a rule-based optimal policy on gminiwob shopping.""" import time from absl import app from absl import flags from absl import logging from CoDE import test_websites from CoDE import utils from CoDE import vocabulary_node from CoDE import web_environment flags.DEFINE_string("data_dep_path", None, "Data dep path for local miniwob files.") flags.DEFINE_boolean( "run_headless_mode", False, "Run in headless mode. On borg, this should always be true.") flags.DEFINE_boolean( "use_conceptual", False, "If true, use abstract web navigation where it is assumed to known which profile field corresponds to which element." ) FLAGS = flags.FLAGS def run_policy_on_shopping_website(): """Run an optimal policy on the shopping website and visualize in browser.""" # Create a generic web environment to which we will add primitives and # transitions to create a shopping website. These parameters will work to # observe a simple policy running but they might be insufficient in a training # setting as observations will be converted into arrays and these parameters # are used to shape them. In this example, they don't have that effect. env = web_environment.GMiniWoBWebEnvironment( base_url="file://{}/".format(FLAGS.data_dep_path), subdomain="gminiwob.generic_website", profile_length=5, number_of_fields=5, use_only_profile_key=False, number_of_dom_elements=150, dom_attribute_sequence_length=5, keyboard_action_size=5, kwargs_dict={ "headless": FLAGS.run_headless_mode, "threading": False }, step_limit=25, global_vocabulary=vocabulary_node.LockedVocabulary(), use_conceptual=FLAGS.use_conceptual) # Create a shopping website design with difficulty = 3. website = test_websites.create_shopping_website(3) design = test_websites.generate_website_design_from_created_website( website) # Design the actual environment. env.design_environment( design, auto_num_pages=True) # Make sure raw_state=True as this will return raw observations not numpy # arrays. state = env.reset(raw_state=True) # Optimal sequences of elements to visit. Some might be redundant and will be # skipped. optimal_actions = [ "group_next_p0", "group_username", "group_password", "group_rememberme", "group_captcha", "group_stayloggedin", "group_next_p1", "group_next_p2", "group_name_first", "group_name_last", "group_address_line1", "group_address_line2", "group_city", "group_postal_code", "group_state", "group_submit_p2", ] # Corresponding pages of these elements: # [0, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3] reward = 0.0 logging.info("Utterance: %s", str(state.utterance)) logging.info("\n\n") logging.info("All available primitives: %s", str(env.get_all_actionable_primitives())) logging.info("\n\n") # Iterate over all optimal actions. For each action, iterate over all elements # in the current observation. If an element matches, execute the optimal # action and continue. # Iterate over optimal actions. for action in optimal_actions: logging.info("Element at focus: %s", str(action)) # Iterate over all elements in the current observation. # order_dom_elements returns an ordered list of DOM elements to make the # order and elements consistent. for i, element in enumerate( utils.order_dom_elements(state.dom_elements, html_id_prefix=None)): # If HTML if of the element matches the action, execute the action. if element.id == action.replace("group", "actionable"): logging.info("Acting on (%s)", str(element)) logging.info("\tAttributes of the element: %s", str(utils.dom_attributes(element, 5))) # Get the corresponding profile fields. profile_keys = env.raw_profile.keys # Execute the (element index, profile field index) action on the # website. Environment step function accepts a single scalar action. # We flatten the action from a tuple to a scalar which is deflattened # back to a tuple in the step function. if action[len("group") + 1:] in profile_keys and not FLAGS.use_conceptual: logging.info("Profile: %s, Element ID: %s", str(profile_keys.index(action[len("group") + 1:])), str(action[len("group") + 1:])) # action=element_index + profile_field_index * number_of_elements # This is converted back into a tuple using a simple modulo # arithmetic. state, r, _, _ = env.step( i + profile_keys.index(action[len("group") + 1:]) * env.number_of_dom_elements, True) else: # This is the case where we have abstract navigation problem. logging.info("Element ID: %s", str(action[len("group") + 1:])) # We don't need to convert a tuple into a scalar because in this case # the environment expects the index of the element. state, r, _, _ = env.step(i, True) logging.info("Current reward: %f", r) reward += r if not FLAGS.run_headless_mode: # wait 1 sec so that the action can be observed on the browser. time.sleep(1) break logging.info("Final reward: %f", reward) if not FLAGS.run_headless_mode: # wait 30 secs so that the users can inspect the html in the browser. time.sleep(30) def main(argv): if len(argv) > 1: raise app.UsageError("Too many command-line arguments.") run_policy_on_shopping_website() if __name__ == "__main__": app.run(main)
d591cfa31e9c148bfac88be4aefee2acdd0a8266
fc39e431bcf4ead647b3c4a2b8fb8dc772928852
/Indoor_Webapp_B/Indoor_Webapp_B/Indoor_Webapp_B/manage.py
eec6c95947e4ab94a6f3118584215b324c299e0c
[ "BSD-3-Clause" ]
permissive
DavidTF85/IndooeAir-Webapp-B
c129414be094c39a00fa397e4eed16dc39f7bb14
579f7593116d743e566e16219370c98e2937844b
refs/heads/master
2020-09-12T08:32:24.099793
2019-11-18T05:24:55
2019-11-18T05:24:55
222,369,279
0
0
null
null
null
null
UTF-8
Python
false
false
656
py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Indoor_Webapp_B.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main()
1dccfb0f90cf749916c6492d1e8a811a652e9e72
39b916e8969712a31195586ba6666744342b0fcf
/inheritance.py
b94276e67bcb37d6bdd1c591fbef51731a5cbdf0
[]
no_license
bhumphris/Inheritance
165391f1e4125d63d6fd7bb7447fb3860f52020a
e61a833c9b4eb49981fa91db31b53b7f450cfc03
refs/heads/master
2020-06-13T15:48:09.292442
2016-12-02T05:27:28
2016-12-02T05:27:28
75,363,130
0
0
null
null
null
null
UTF-8
Python
false
false
597
py
import officeFurniture def main(): desk = officeFurniture.Desk("Desk", "Metal", 48, 20, 36, 2, "Left", 3, 155.50) print("Product: " + desk.get_category()) print("Material: " + desk.get_material()) print("Length: " + str(desk.get_length())) print("Width: " + str(desk.get_width())) print("Height: " + str(desk.get_height())) print("Number of Drawers: " + str(desk.get_drawers())) print("Location of Drawers: " + desk.get_location()) print("Quantity: " + str(desk.get_quantity())) print("Price: ${:0,.2f}\n".format(desk.get_price())) print desk main()
86e497f7d8b7f8e601d5bdf3d3d634b51fbc04bf
e82b761f53d6a3ae023ee65a219eea38e66946a0
/All_In_One/addons/hair_tool/curves_resample.py
bbf794543f831be09e4c96a6a4ed9485f74a8093
[]
no_license
2434325680/Learnbgame
f3a050c28df588cbb3b14e1067a58221252e2e40
7b796d30dfd22b7706a93e4419ed913d18d29a44
refs/heads/master
2023-08-22T23:59:55.711050
2021-10-17T07:26:07
2021-10-17T07:26:07
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,061
py
# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # Copyright (C) 2017 JOSECONSCO # Created by JOSECONSCO import bpy import math import numpy as np from bpy.props import EnumProperty, FloatProperty, BoolProperty, IntProperty, StringProperty from .resample2d import interpol_Catmull_Rom, get_strand_proportions class HT_OT_CurvesResample(bpy.types.Operator): bl_label = "Curve resample" bl_idname = "object.curve_resample" bl_description = "Change ammount of points on curve" bl_options = {"REGISTER", "UNDO"} hairType: bpy.props.EnumProperty(name="Output Curve Type", default="NURBS", items=(("BEZIER", "Bezier", ""), ("NURBS", "Nurbs", ""), ("POLY", "Poly", ""))) # bezierRes: IntProperty(name="Bezier resolution", default=3, min=1, max=12) t_in_y: IntProperty(name="Strand Segments", default=8, min=3, max=20) uniformPointSpacing: BoolProperty(name="Uniform spacing", description="Distribute stand points with uniform spacing", default=False) equalPointCount: BoolProperty(name="Equal point count", description="Give all cures same points count \n" "If disabled shorter curves will have less points", default=False) onlySelection: BoolProperty(name="Only Selected", description="Affect only selected points", default=False) def invoke(self, context, event): particleObj = context.active_object if particleObj.mode == 'EDIT': self.onlySelection = True elif particleObj.mode == 'OBJECT': self.onlySelection = False Curve = context.active_object if not Curve.type == 'CURVE': self.report({'INFO'}, 'Use operator on curve type object') return {"CANCELLED"} self.input_spline_type = Curve.data.splines[0].type self.hairType = self.input_spline_type # hair type - output spline if self.input_spline_type == 'NURBS': self.nurbs_order = Curve.data.splines[0].order_u if len(Curve.data.splines) > 0: # do get initnial value for resampling t polyline = Curve.data.splines[0] # take first spline len for resampling if polyline.type == 'NURBS' or polyline.type == 'POLY': self.t_in_y = len(polyline.points) else: self.t_in_y = len(polyline.bezier_points) self.bezierRes = Curve.data.resolution_u return self.execute(context) def execute(self, context): curveObj = context.active_object if curveObj.type != 'CURVE': self.report({'INFO'}, 'Works only on curves') return {"CANCELLED"} pointsList = [] pointsRadius = [] pointsTilt = [] selectedSplines = [] if self.onlySelection: for polyline in curveObj.data.splines: if polyline.type == 'NURBS' or polyline.type == 'POLY': if any(point.select == True for point in polyline.points): selectedSplines.append(polyline) else: if any(point.select_control_point == True for point in polyline.bezier_points): selectedSplines.append(polyline) if not selectedSplines: selectedSplines = curveObj.data.splines else: selectedSplines = curveObj.data.splines for polyline in selectedSplines: # for strand point if polyline.type == 'NURBS' or polyline.type == 'POLY': points = polyline.points else: points = polyline.bezier_points if len(points) > 1: # skip single points pointsList.append([point.co.to_3d() for point in points]) pointsRadius.append([point.radius for point in points]) pointsTilt.append([point.tilt for point in points]) backup_mat_indices = [spline.material_index for spline in selectedSplines] interpolRad = [] interpolTilt = [] splinePointsList = interpol_Catmull_Rom(pointsList, self.t_in_y, uniform_spacing = self.uniformPointSpacing, same_point_count=self.equalPointCount) if self.equalPointCount: # each output spline will have same point count t_ins_y = [i / (self.t_in_y - 1) for i in range(self.t_in_y)] for radii, tilts in zip(pointsRadius, pointsTilt): # per strand t_rad = [i / (len(radii) - 1) for i in range(len(radii))] interpolRad.append(np.interp(t_ins_y, t_rad, radii)) # first arg len() = out len interpolTilt.append(np.interp(t_ins_y, t_rad, tilts)) # first arg len() = out len else: # shorter output splines will have less points lens = [len(x) for x in splinePointsList] for radii, tilts, strandLen in zip(pointsRadius, pointsTilt, lens): # per strand t_ins_Normalized = [i / (strandLen - 1) for i in range(strandLen)] t_rad = [[i / (len(radii) - 1) for i in range(len(radii))]] interpolRad.append(np.interp(t_ins_Normalized, t_rad[0], radii)) # first arg len() = out len interpolTilt.append(np.interp(t_ins_Normalized, t_rad[0], tilts)) # first arg len() = out len curveData = curveObj.data # spline_type = if self.onlySelection: for spline in selectedSplines: curveData.splines.remove(spline) else: curveData.splines.clear() newSplines = [] for k, splinePoints in enumerate(splinePointsList): # for each strand/ring curveLenght = len(splinePoints) polyline = curveData.splines.new(self.hairType) newSplines.append(polyline) if self.hairType == 'BEZIER': polyline.bezier_points.add(curveLenght - 1) elif self.hairType == 'POLY' or self.hairType == 'NURBS': polyline.points.add(curveLenght - 1) if self.hairType == 'NURBS': polyline.order_u = self.nurbs_order if self.input_spline_type == 'NURBS' else 3 polyline.use_endpoint_u = True np_splinePointsOnes = np.ones((len(splinePoints), 4)) # 4 coord x,y,z ,1 np_splinePointsOnes[:, :3] = splinePoints if self.hairType == 'BEZIER': polyline.bezier_points.foreach_set('co', np_splinePointsOnes[:, :3]) polyline.bezier_points.foreach_set('radius', interpolRad[k]) polyline.bezier_points.foreach_set('tilt', interpolTilt[k]) polyline.bezier_points.foreach_set('handle_left_type', 'AUTO') polyline.bezier_points.foreach_set('handle_right_type', 'AUTO') else: polyline.points.foreach_set('co', np_splinePointsOnes.ravel()) polyline.points.foreach_set('radius', interpolRad[k]) polyline.points.foreach_set('tilt', interpolTilt[k]) curveData.resolution_u = self.bezierRes # bpy.ops.object.curve_uv_refresh() for backup_mat, newSpline in zip(backup_mat_indices, newSplines): newSpline.material_index = backup_mat return {"FINISHED"}
2690dfe618649e308a0dc47ef332ab5e56e29930
84c38b838ca74cf80fe276d272537b1b840bfe6d
/Battleship.py
6ff503cc58f958d7415b052af718a3ad315768e3
[]
no_license
Chruffman/Personal-Projects
9c385a145e02661cf0dddc76d6f2b5034a6a35f9
d271573b4e48c3026d0cc09d4483c218bc3dfa97
refs/heads/master
2021-01-21T05:17:07.536173
2018-07-24T13:37:50
2018-07-24T13:37:50
83,166,561
0
0
null
null
null
null
UTF-8
Python
false
false
1,247
py
# my attempt at the Battleship! assignment from codeacademy.com from random import randint board = [] for quadrant in range(6): board.append(['O'] * 6) def display_board(board): for row in board: print (" ".join(row)) print ("Let's play Battleship!") display_board(board) def new_row(board): return randint(0, len(board) - 1) def new_col(board): return randint(0, len(board) - 1) game_row = new_row(board) game_col = new_col(board) print (game_col) print (game_row) guess = 0 for guess in range(5): guess += 1 user_row = int(input("Guess row: ")) user_col = int(input("Guess column: ")) if user_row == game_row and user_col == game_col: print ("You sunk my battleship! Curses!!") print ("You win!") break else: if user_row not in range(6) or user_col not in range(6): print ("Your guess is not even in the ocean. Maybe improve your aim?") elif board[user_row][user_col] == 'X': print ("You have already unsuccessfully guessed that sector of the game board.") else: if guess == 5: print ("Game Over.") else: print ("You missed my battleship!") board[user_row][user_col] = 'X' print ("Guess", guess + 1) display_board(board)
a2f7ae216b410776277bf51f39352e0afd7a8354
cb892c75961eeae4e9c968403e823565d2b0056e
/periodic1D.py
ce67dcd6b4588f63f65e9a66e3aeef14fbdecd90
[]
no_license
victorstorchan/signal-processing
7deb60ed1e3f7ae09553cbe0faf6fce3fec97fc8
a51e9855cb8cb7a63ecbab9fac645fc4846b03a7
refs/heads/master
2021-01-19T03:02:07.791676
2016-07-16T12:32:27
2016-07-16T12:32:27
52,238,889
0
0
null
null
null
null
UTF-8
Python
false
false
1,917
py
import numpy as np import matplotlib.pyplot as plt from cmath import polar from math import sqrt #definition of the boxcars signals def boxcar(x,i): if x-i<-1 or x-i>1: return 0 else: return 1 x= np.arange(-2.,2.,0.05) n=len(x) print(n) True_signal=np.zeros(n) for i in range(n): True_signal[i]=boxcar(x[i],0) #plt.plot(x,True_signal) #plt.axis([-2,2,-1,2]) #plt.show() #definitions of the shifted signals y=np.zeros(n,dtype=complex) y2=np.zeros(n,dtype=complex) base=np.zeros(n,dtype=complex) vector_of_shift=[0,3,10,30]#shifts are integer in discrete version len_shift=len(vector_of_shift) #signal with shift: shifted_signals=np.zeros((len_shift,n),dtype=complex) shifted_signals_1=np.zeros((len_shift,n),dtype=complex) for k in range(n): base[k]=boxcar(x[k],0) max_shift=max(vector_of_shift) base_period=np.lib.pad(base, (max_shift, 0), 'wrap') for s in range(len_shift): for k in range(n): if k-vector_of_shift[s]<0: y[k]=base_period[max_shift-vector_of_shift[s]-1+k] y2[k]=base_period[max_shift-vector_of_shift[s]-1+k]*np.exp(2J*np.pi*k/n) else: y[k]=boxcar(x[k-vector_of_shift[s]],0) y2[k]=boxcar(x[k-vector_of_shift[s]],0)*np.exp(2J*np.pi*k/n) randvect=np.random.normal(0,0.1,n) shifted_signals[s] =y#+ randvect shifted_signals_1[s]=y2#+ randvect A=np.fft.fft(shifted_signals) A_1=np.fft.fft(shifted_signals_1).conjugate() A_star=np.zeros((len_shift,n),dtype=complex) for i in range(len_shift): A_star[i] = A[i]*A_1[i] A_star_matrix=np.matrix(A_star) A_star_transpose=A_star_matrix.getH() A_prod1=A_star_matrix*A_star_transpose A_prod=A_prod1/A_prod1[0,0] (V,sigma,V_star)=np.linalg.svd(A_prod,full_matrices=1) v1=V_star[0].getH() #the shifts are recovered: output=np.zeros(len_shift,dtype=complex) for i in range(len_shift): output[i]=-n*polar(-v1[i,0])[1]/(2*np.pi) output
19ebe0e0280c2829c58678866cdc0eb3a1da7611
bbe6f37f7347cb83f08846d505ac4aa6bc0031e6
/purity_fb/purity_fb_1dot9/apis/arrays_api.py
7bd8335e17e2cf1d85d4d5361d2a51ff900af97e
[ "Apache-2.0" ]
permissive
bsamz-ps/purity_fb_python_client
02ff7213075cf1948e2db7b0835cc5fcc56f328a
11f27ef0c72d8aac1fc4e1ed036cca038b85dfa4
refs/heads/master
2021-02-19T08:11:04.042758
2020-02-12T23:56:08
2020-02-12T23:56:08
245,294,511
0
0
NOASSERTION
2020-03-06T00:14:27
2020-03-06T00:14:26
null
UTF-8
Python
false
false
43,419
py
# coding: utf-8 """ Pure Storage FlashBlade REST 1.9 Python SDK Pure Storage FlashBlade REST 1.9 Python SDK. Compatible with REST API versions 1.0 - 1.9. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/). OpenAPI spec version: 1.9 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import sys import os import re # python 2 and python 3 compatibility library from six import iteritems from ..configuration import Configuration from ..api_client import ApiClient class ArraysApi(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen """ def __init__(self, api_client=None): config = Configuration() if api_client: self.api_client = api_client else: if not config.api_client: config.api_client = ApiClient() self.api_client = config.api_client def list_arrays(self, **kwargs): """ List arrays This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: ArrayResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_with_http_info(**kwargs) else: (data) = self.list_arrays_with_http_info(**kwargs) return data def list_arrays_with_http_info(self, **kwargs): """ List arrays This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :return: ArrayResponse If the method is called asynchronously, returns the request thread. """ all_params = [] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_http_specific_performance(self, **kwargs): """ List instant or historical http specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_http_specific_performance(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayHttpPerformanceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_http_specific_performance_with_http_info(**kwargs) else: (data) = self.list_arrays_http_specific_performance_with_http_info(**kwargs) return data def list_arrays_http_specific_performance_with_http_info(self, **kwargs): """ List instant or historical http specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_http_specific_performance_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayHttpPerformanceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['start_time', 'end_time', 'resolution'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_http_specific_performance" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/http-specific-performance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayHttpPerformanceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_nfs_specific_performance(self, **kwargs): """ List instant or historical nfs specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_nfs_specific_performance(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayNfsPerformanceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_nfs_specific_performance_with_http_info(**kwargs) else: (data) = self.list_arrays_nfs_specific_performance_with_http_info(**kwargs) return data def list_arrays_nfs_specific_performance_with_http_info(self, **kwargs): """ List instant or historical nfs specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_nfs_specific_performance_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayNfsPerformanceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['start_time', 'end_time', 'resolution'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_nfs_specific_performance" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/nfs-specific-performance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayNfsPerformanceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_performance(self, **kwargs): """ List instant or historical array performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_performance(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param str protocol: to sample performance of a certain protocol :return: ArrayPerformanceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_performance_with_http_info(**kwargs) else: (data) = self.list_arrays_performance_with_http_info(**kwargs) return data def list_arrays_performance_with_http_info(self, **kwargs): """ List instant or historical array performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_performance_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param str protocol: to sample performance of a certain protocol :return: ArrayPerformanceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['start_time', 'end_time', 'resolution', 'protocol'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_performance" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) if 'protocol' in params: query_params.append(('protocol', params['protocol'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/performance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayPerformanceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_performance_replication(self, **kwargs): """ List instant or historical array replication performance. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_performance_replication(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param int start_time: Time to start sample in milliseconds since epoch. :param str type: to sample space of either file systems, object store, or all :return: ArrayPerformanceReplicationResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_performance_replication_with_http_info(**kwargs) else: (data) = self.list_arrays_performance_replication_with_http_info(**kwargs) return data def list_arrays_performance_replication_with_http_info(self, **kwargs): """ List instant or historical array replication performance. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_performance_replication_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param int start_time: Time to start sample in milliseconds since epoch. :param str type: to sample space of either file systems, object store, or all :return: ArrayPerformanceReplicationResponse If the method is called asynchronously, returns the request thread. """ all_params = ['end_time', 'resolution', 'start_time', 'type'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_performance_replication" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'type' in params: query_params.append(('type', params['type'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/performance/replication', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayPerformanceReplicationResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_s3_specific_performance(self, **kwargs): """ List instant or historical object store specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_s3_specific_performance(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayS3PerformanceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_s3_specific_performance_with_http_info(**kwargs) else: (data) = self.list_arrays_s3_specific_performance_with_http_info(**kwargs) return data def list_arrays_s3_specific_performance_with_http_info(self, **kwargs): """ List instant or historical object store specific performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_s3_specific_performance_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :return: ArrayS3PerformanceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['start_time', 'end_time', 'resolution'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_s3_specific_performance" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/s3-specific-performance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayS3PerformanceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_arrays_space(self, **kwargs): """ List instant or historical array space This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_space(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param str type: to sample space of either file systems, object store, or all :return: ArraySpaceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_arrays_space_with_http_info(**kwargs) else: (data) = self.list_arrays_space_with_http_info(**kwargs) return data def list_arrays_space_with_http_info(self, **kwargs): """ List instant or historical array space This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_arrays_space_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param int start_time: Time to start sample in milliseconds since epoch. :param int end_time: Time to end sample in milliseconds since epoch. :param int resolution: sample frequency in milliseconds :param str type: to sample space of either file systems, object store, or all :return: ArraySpaceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['start_time', 'end_time', 'resolution', 'type'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_arrays_space" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'start_time' in params: query_params.append(('start_time', params['start_time'])) if 'end_time' in params: query_params.append(('end_time', params['end_time'])) if 'resolution' in params: query_params.append(('resolution', params['resolution'])) if 'type' in params: query_params.append(('type', params['type'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/space', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArraySpaceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def list_clients_performance(self, **kwargs): """ List client performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_clients_performance(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param list[str] names: A comma-separated list of resource names. This cannot be provided together with the ids query parameters. :param str filter: The filter to be used for query. :param str sort: The way to order the results. :param int limit: limit, should be >= 0 :return: ClientPerformanceResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.list_clients_performance_with_http_info(**kwargs) else: (data) = self.list_clients_performance_with_http_info(**kwargs) return data def list_clients_performance_with_http_info(self, **kwargs): """ List client performance This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.list_clients_performance_with_http_info(callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param list[str] names: A comma-separated list of resource names. This cannot be provided together with the ids query parameters. :param str filter: The filter to be used for query. :param str sort: The way to order the results. :param int limit: limit, should be >= 0 :return: ClientPerformanceResponse If the method is called asynchronously, returns the request thread. """ all_params = ['names', 'filter', 'sort', 'limit'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_clients_performance" % key ) params[key] = val del params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'names' in params: query_params.append(('names', params['names'])) collection_formats['names'] = 'csv' if 'filter' in params: query_params.append(('filter', params['filter'])) if 'sort' in params: query_params.append(('sort', params['sort'])) if 'limit' in params: query_params.append(('limit', params['limit'])) header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.\ select_header_content_type(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays/clients/performance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ClientPerformanceResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats) def update_arrays(self, array_settings, **kwargs): """ Update arrays This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.update_arrays(array_settings, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param PureArray array_settings: (required) :return: ArrayResponse If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('callback'): return self.update_arrays_with_http_info(array_settings, **kwargs) else: (data) = self.update_arrays_with_http_info(array_settings, **kwargs) return data def update_arrays_with_http_info(self, array_settings, **kwargs): """ Update arrays This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.update_arrays_with_http_info(array_settings, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param PureArray array_settings: (required) :return: ArrayResponse If the method is called asynchronously, returns the request thread. """ all_params = ['array_settings'] all_params.append('callback') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') params = locals() for key, val in iteritems(params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method update_arrays" % key ) params[key] = val del params['kwargs'] # verify the required parameter 'array_settings' is set if ('array_settings' not in params) or (params['array_settings'] is None): raise ValueError("Missing the required parameter `array_settings` when calling `update_arrays`") collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'array_settings' in params: body_params = params['array_settings'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json']) # Authentication setting auth_settings = ['AuthTokenHeader'] return self.api_client.call_api('/1.9/arrays', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='ArrayResponse', auth_settings=auth_settings, callback=params.get('callback'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
bb7d789c7df59f3ef3d4b7d31cc5b89a64bbb3c6
51cbd904e17e45f6adb5303c3532a6ff0519ab42
/sdk/tables/azure-data-tables/tests/test_table_service_properties_cosmos.py
139f3c1973a4a4d8f57e5f7f63813ae8c7bfbeef
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
heaths/azure-sdk-for-python
203e9a6052d7dff5b5f2346bced86b9406be3419
77feaf14471eba6642f5c7ae2f3f06981ff361d7
refs/heads/master
2022-07-26T06:46:57.067502
2021-04-15T21:35:26
2021-04-15T21:35:26
239,629,447
0
0
MIT
2020-02-10T22:46:20
2020-02-10T22:46:19
null
UTF-8
Python
false
false
9,896
py
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import time import pytest from devtools_testutils import AzureTestCase from azure.core.exceptions import HttpResponseError from azure.data.tables import ( TableServiceClient, TableAnalyticsLogging, Metrics, RetentionPolicy, CorsRule ) from _shared.testcase import TableTestCase from preparers import CosmosPreparer # ------------------------------------------------------------------------------ class TableServicePropertiesTest(AzureTestCase, TableTestCase): # --Helpers----------------------------------------------------------------- def _assert_properties_default(self, prop): assert prop is not None self._assert_logging_equal(prop['analytics_logging'], TableAnalyticsLogging()) self._assert_metrics_equal(prop['hour_metrics'], Metrics()) self._assert_metrics_equal(prop['minute_metrics'], Metrics()) self._assert_cors_equal(prop['cors'], list()) def _assert_logging_equal(self, log1, log2): if log1 is None or log2 is None: assert log1 == log2 return assert log1.version == log2.version assert log1.read == log2.read assert log1.write == log2.write assert log1.delete == log2.delete self._assert_retention_equal(log1.retention_policy, log2.retention_policy) def _assert_delete_retention_policy_equal(self, policy1, policy2): if policy1 is None or policy2 is None: assert policy1 == policy2 return assert policy1.enabled == policy2.enabled assert policy1.days == policy2.days def _assert_static_website_equal(self, prop1, prop2): if prop1 is None or prop2 is None: assert prop1 == prop2 return assert prop1.enabled == prop2.enabled assert prop1.index_document == prop2.index_document assert prop1.error_document404_path == prop2.error_document404_path def _assert_delete_retention_policy_not_equal(self, policy1, policy2): if policy1 is None or policy2 is None: assert policy1 != policy2 return assert not (policy1.enabled == policy2.enabled and policy1.days == policy2.days) def _assert_metrics_equal(self, metrics1, metrics2): if metrics1 is None or metrics2 is None: assert metrics1 == metrics2 return assert metrics1.version == metrics2.version assert metrics1.enabled == metrics2.enabled assert metrics1.include_apis == metrics2.include_apis self._assert_retention_equal(metrics1.retention_policy, metrics2.retention_policy) def _assert_cors_equal(self, cors1, cors2): if cors1 is None or cors2 is None: assert cors1 == cors2 return assert len(cors1) == len(cors2) for i in range(0, len(cors1)): rule1 = cors1[i] rule2 = cors2[i] assert len(rule1.allowed_origins) == len(rule2.allowed_origins) assert len(rule1.allowed_methods) == len(rule2.allowed_methods) assert rule1.max_age_in_seconds == rule2.max_age_in_seconds assert len(rule1.exposed_headers) == len(rule2.exposed_headers) assert len(rule1.allowed_headers) == len(rule2.allowed_headers) def _assert_retention_equal(self, ret1, ret2): assert ret1.enabled == ret2.enabled assert ret1.days == ret2.days # --Test cases per service --------------------------------------- @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_table_service_properties(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange url = self.account_url(tables_cosmos_account_name, "cosmos") tsc = TableServiceClient(url, tables_primary_cosmos_account_key) # Act resp = tsc.set_service_properties( analytics_logging=TableAnalyticsLogging(), hour_metrics=Metrics(), minute_metrics=Metrics(), cors=list()) # Assert assert resp is None self._assert_properties_default(tsc.get_service_properties()) if self.is_live: sleep(SLEEP_DELAY) # --Test cases per feature --------------------------------------- @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_set_logging(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange url = self.account_url(tables_cosmos_account_name, "cosmos") tsc = TableServiceClient(url, tables_primary_cosmos_account_key) logging = TableAnalyticsLogging(read=True, write=True, delete=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act tsc.set_service_properties(analytics_logging=logging) # Assert received_props = tsc.get_service_properties() self._assert_logging_equal(received_props['analytics_logging'], logging) if self.is_live: time.sleep(30) @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_set_hour_metrics(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange url = self.account_url(tables_cosmos_account_name, "cosmos") tsc = TableServiceClient(url, tables_primary_cosmos_account_key) hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act tsc.set_service_properties(hour_metrics=hour_metrics) # Assert received_props = tsc.get_service_properties() self._assert_metrics_equal(received_props['hour_metrics'], hour_metrics) if self.is_live: sleep(SLEEP_DELAY) @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_set_minute_metrics(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange url = self.account_url(tables_cosmos_account_name, "cosmos") tsc = TableServiceClient(url, tables_primary_cosmos_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5)) # Act tsc.set_service_properties(minute_metrics=minute_metrics) # Assert received_props = tsc.get_service_properties() self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics) if self.is_live: sleep(SLEEP_DELAY) @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_set_cors(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange url = self.account_url(tables_cosmos_account_name, "cosmos") tsc = TableServiceClient(url, tables_primary_cosmos_account_key) cors_rule1 = CorsRule(['www.xyz.com'], ['GET']) allowed_origins = ['www.xyz.com', "www.ab.com", "www.bc.com"] allowed_methods = ['GET', 'PUT'] max_age_in_seconds = 500 exposed_headers = ["x-ms-meta-data*", "x-ms-meta-source*", "x-ms-meta-abc", "x-ms-meta-bcd"] allowed_headers = ["x-ms-meta-data*", "x-ms-meta-target*", "x-ms-meta-xyz", "x-ms-meta-foo"] cors_rule2 = CorsRule( allowed_origins, allowed_methods, max_age_in_seconds=max_age_in_seconds, exposed_headers=exposed_headers, allowed_headers=allowed_headers) cors = [cors_rule1, cors_rule2] # Act tsc.set_service_properties(cors=cors) # Assert received_props = tsc.get_service_properties() self._assert_cors_equal(received_props['cors'], cors) if self.is_live: sleep(SLEEP_DELAY) # --Test cases for errors --------------------------------------- @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_too_many_cors_rules(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key) cors = [] for i in range(0, 6): cors.append(CorsRule(['www.xyz.com'], ['GET'])) # Assert pytest.raises(HttpResponseError, tsc.set_service_properties, None, None, None, cors) if self.is_live: sleep(SLEEP_DELAY) @pytest.mark.skip("Cosmos Tables does not yet support service properties") @CosmosPreparer() def test_retention_too_long(self, tables_cosmos_account_name, tables_primary_cosmos_account_key): # Arrange tsc = TableServiceClient(self.account_url(tables_cosmos_account_name, "cosmos"), tables_primary_cosmos_account_key) minute_metrics = Metrics(enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=366)) # Assert pytest.raises(HttpResponseError, tsc.set_service_properties, None, None, minute_metrics) if self.is_live: sleep(SLEEP_DELAY) class TestTableUnitTest(TableTestCase): def test_retention_no_days(self): # Assert pytest.raises(ValueError, RetentionPolicy, True, None)
bc54e1b48cf35f7afe4085bcfc57748031ff30b5
8ac0beeda7da3f6059f47dbd71f90a375589b8eb
/Ubiquiti/EdgeRouter-Lite.py
5c1e1a6a434fbfc723d8a192f78062264691d878
[]
no_license
evgenyzorin/Paramiko
f98dbabdb0954c4e55ecd88604de6ba81d421e6c
9deb3d6d0491717524117dfd2c1a9cb4c968d016
refs/heads/main
2023-09-02T16:43:13.279258
2021-11-11T08:34:49
2021-11-11T08:34:49
390,994,305
1
0
null
null
null
null
UTF-8
Python
false
false
1,628
py
from paramiko import SSHClient, AutoAddPolicy from datetime import datetime import re start_time = datetime.now() def send_show_command( devices, username, password, command, max_bytes=60000, delay=1, ): client = SSHClient() client.load_system_host_keys() client.set_missing_host_key_policy(AutoAddPolicy()) info = {} for device in devices: print(f'\n---------- Connecting device {device} ----------\n') client.connect( hostname=device, username=username, password=password, look_for_keys=False, allow_agent=False, ) stdin, stdout, sterr = client.exec_command(command) output = stdout.readlines() for line in output[3:]: data = [i.strip() for i in line.split(' ') if i] if re.search('[a-zA-Z]', data[0]): interface = data[0] info[interface] = { 'ip': [data[1]], 'state': data[2].split('/')[0], 'link': data[2].split('/')[1], 'description': data[3], } else: info[interface]['ip'].append(data[0]) print(info) if __name__ == '__main__': devices = ['192.168.1.1', '192.168.1.2'] command = '/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces' send_show_command(devices, 'ubnt', 'ubnt', command) run_time = datetime.now() - start_time print(f'\n---------- Elapsed time: {run_time} ----------\n')
c0b9fba0df580154ea29be2dc724cbe802318450
b8120b9a99b1aab3fa423bc28173b10523084301
/app/views.py
3980e892431891877c72c44e2da6ae5298a24185
[]
no_license
Trailblazerr1/iiita-hacks-musify
e0cc22a95b164399462750e5667b886090ca17bb
d7ab39622306e48e280fb350b9f416b64dc95f37
refs/heads/master
2020-12-25T14:38:34.028923
2016-09-12T11:28:49
2016-09-12T11:28:49
67,906,279
0
0
null
null
null
null
UTF-8
Python
false
false
4,195
py
""" Definition of views. """ from django.shortcuts import render from django.http import HttpRequest from django.template import RequestContext from datetime import datetime from app.forms import PostForm from django.http import HttpResponseRedirect from clarifai.client import ClarifaiApi import requests import json import gensim import os.path BASE = os.path.dirname(os.path.abspath(__file__)) word_model = gensim.models.Word2Vec.load_word2vec_format(os.path.join(BASE, 'vectors.bin'),binary=True) genres = ['abstract', 'accordion', 'afrikaans', 'afrobeat', 'ambient', 'andean', 'anime', 'axe', 'balearic', 'banda', 'bangla', 'barbershop', 'baroque', 'bassline', 'bebop', 'bemani', 'bhangra', 'bluegrass', 'blues', 'bolero', 'boogaloo', 'bounce', 'breakbeat', 'breaks', 'britpop', 'broadway', 'byzantine', 'cabaret', 'cajun', 'calypso', 'cantopop', 'capoeira', 'carnatic', 'ccm', 'cello', 'celtic', 'chanson', 'choral', 'choro', 'christmas', 'clarinet', 'classical', 'comedy', 'comic', 'commons', 'consort', 'corrosion', 'country', 'dancehall', 'demoscene', 'desi', 'didgeridoo', 'disco', 'dixieland', 'downtempo', 'drama', 'drone', 'dub', 'ebm', 'edm', 'electro', 'electronic', 'electronica', 'emo', 'environmental', 'eurovision', 'exotica', 'experimental', 'fado', 'fake', 'filmi', 'flamenco', 'folk', 'footwork', 'freestyle', 'funk', 'gabba', 'galego', 'gamelan', 'glitch', 'gospel', 'grime', 'grindcore', 'grunge', 'guidance', 'hardcore', 'harp', 'hawaiian', 'healing', 'hollywood', 'house', 'idol', 'industrial', 'jazz', 'jerk', 'judaica', 'juggalo', 'jungle', 'klezmer', 'latin', 'lds', 'lilith', 'liturgical', 'lounge', 'lowercase', 'maghreb', 'magyar', 'mallet', 'mambo', 'medieval', 'meditation', 'melancholia', 'merengue', 'metal', 'metalcore', 'minimal', 'mizrahi', 'monastic', 'morna', 'motivation', 'motown', 'neoclassical', 'nepali', 'neurofunk', 'ninja', 'noise', 'nursery', 'oi', 'opera', 'oratory', 'orchestral', 'outsider'] def home(request): return render(request, 'app/home.html') def Developers(request): return render(request, 'app/Developers.html') def playlist(request): assert isinstance(request, HttpRequest) if request.method == 'GET': form = PostForm() else: form = PostForm(request.POST) # Bind data from request.POST into a PostForm if form.is_valid(): imgURL = form.cleaned_data['content'] app_id = "DbZ4NzfrPL-K_CHHf4y4srnvBUSgMo4Dz9BIbeXt" app_secret = "crjTy-8St_kiFkL0wZZCFyrcoWJyOdets8Fa1BNi" clarifai_api = ClarifaiApi(app_id,app_secret) tags = '' embedLink = '' try: result = clarifai_api.tag_image_urls(imgURL) except: #if url is invalid based on clarifai API call tags = 'invalid url' imgURL = '' if tags!='invalid url': tagList = result['results'][0]['result']['tag']['classes'] bestGenre = imgscore(tagList,genres) r = requests.get('https://api.spotify.com/v1/search?q=%22'+bestGenre+'%22&type=playlist') jsonStuff = r.json() uri = jsonStuff['playlists']['items'][0]['uri'] embedLink = "https://embed.spotify.com/?uri="+uri return render( request, 'app/playlist.html', { 'form': form, 'imgsrc': imgURL, 'debugText': tags, 'playlistURI': embedLink, 'year':datetime.now().year, } ) return render( request, 'app/playlist.html', { 'form': form, 'imgsrc': '', 'debugText': '', 'playlistURI': '', 'year':datetime.now().year, } ) def imgscore(words,genres): l = 0.0 summ = [] for genre in genres: for word in words: try: simScore = word_model.similarity(genre,word) l += simScore except: pass summ.append(l) l = 0 return(genres[summ.index(max(summ))])
58893a54c197fb68eeb0d035302bf64d8d6e53e9
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/3/gD3.py
aa7152104068969fce4fab0f59d40adbf339df10
[]
no_license
G4te-Keep3r/HowdyHackers
46bfad63eafe5ac515da363e1c75fa6f4b9bca32
fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2
refs/heads/master
2020-08-01T12:08:10.782018
2016-11-13T20:45:50
2016-11-13T20:45:50
73,624,224
0
1
null
null
null
null
UTF-8
Python
false
false
486
py
import sys def printFunction(lineRemaining): if lineRemaining[0] == '"' and lineRemaining[-1] == '"': if len(lineRemaining) > 2: #data to print lineRemaining = lineRemaining[1:-1] print ' '.join(lineRemaining) else: print def main(fileName): with open(fileName) as f: for line in f: data = line.split() if data[0] == 'gD3': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
1a8b3763c8a94e48cf8da659c686babc72716600
80abe7427ca501da06a9507cefa52d5c290f2833
/Chapter04/topic_modeling.py
841891d56168915143ec57282aeab11713c75372
[]
no_license
CodedQuen/Raspberry-Pi-3-Cookbook-for-Python-Programmers
7910c9cf9ebaf6f42510bd531bf965fd03e6efe8
4a77452c4510fd9c7da62099a93fdbc95a86245a
refs/heads/master
2022-06-10T04:36:59.316284
2020-05-05T10:18:33
2020-05-05T10:18:33
261,421,883
0
0
null
null
null
null
UTF-8
Python
false
false
2,220
py
from nltk.tokenize import RegexpTokenizer from nltk.stem.snowball import SnowballStemmer from gensim import models, corpora from nltk.corpus import stopwords # Load input words def load_words(in_file): element = [] with open(in_file, 'r') as f: for line in f.readlines(): element.append(line[:-1]) return element # Class to preprocedure of text class Preprocedure(object): # Initialize various operators def __init__(self): # Create a regular expression tokenizer self.tokenizer = RegexpTokenizer(r'\w+') # get the list of stop words self.english_stop_words= stopwords.words('english') # Create a Snowball stemmer self.snowball_stemmer = SnowballStemmer('english') # Tokenizing, stop word removal, and stemming def procedure(self, in_data): # Tokenize the string token = self.tokenizer.tokenize(in_data.lower()) # Remove the stop words tokenized_stopwords = [x for x in token if not x in self.english_stop_words] # Perform stemming on the tokens token_stemming = [self.snowball_stemmer.stem(x) for x in tokenized_stopwords] return token_stemming if __name__=='__main__': # File containing linewise input data in_file = 'data_topic_modeling.txt' # Load words element = load_words(in_file) # Create a preprocedure object preprocedure = Preprocedure() # Create a list for processed documents processed_tokens = [preprocedure.procedure(x) for x in element] # Create a dictionary based on the tokenized documents dict_tokens = corpora.Dictionary(processed_tokens) corpus = [dict_tokens.doc2bow(text) for text in processed_tokens] # Generate the LDA model based on the corpus we just created num_of_topics = 2 num_of_words = 4 ldamodel = models.ldamodel.LdaModel(corpus, num_topics=num_of_topics, id2word=dict_tokens, passes=25) print "Most contributing words to the topics:" for item in ldamodel.print_topics(num_topics=num_of_topics, num_words=num_of_words): print "\nTopic", item[0], "==>", item[1]
4968c79739666e8ad2edd13f77a4d5034eea9c2e
649bd422025e421d86025743eac324c9b882a2e8
/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp45_9000.py
4d4f26e616aa9b6ced1b2bb6742aa541c91b1e07
[]
no_license
scheuclu/atom_class
36ddee1f6a5995872e858add151c5942c109847c
0c9a8c63d9b38898c1869fe8983126cef17662cd
refs/heads/master
2021-01-21T10:52:28.448221
2017-03-07T23:04:41
2017-03-07T23:04:41
83,489,471
0
0
null
null
null
null
UTF-8
Python
false
false
68,965
py
ITEM: TIMESTEP 9000 ITEM: NUMBER OF ATOMS 2048 ITEM: BOX BOUNDS pp pp pp 7.1778912625688207e-01 4.6482210873740115e+01 7.1778912625688207e-01 4.6482210873740115e+01 7.1778912625688207e-01 4.6482210873740115e+01 ITEM: ATOMS id type xs ys zs 8 1 0.128064 0.0616737 0.0601487 35 1 0.0656057 0.120012 0.0619676 130 1 0.0685266 0.0608412 0.125938 165 1 0.131318 0.120832 0.125956 1268 1 0.497119 0.93268 0.182308 1361 1 0.496588 0.750478 0.240454 133 1 0.126633 1.00601 0.124891 1460 1 0.500803 0.688928 0.435722 12 1 0.250297 0.0562202 0.0614448 39 1 0.192212 0.12316 0.0614049 43 1 0.310904 0.126252 0.0601463 134 1 0.189034 0.058369 0.123643 138 1 0.309645 0.0635839 0.120587 169 1 0.251645 0.126535 0.118547 137 1 0.247687 0.998671 0.125268 1505 1 -0.00176351 0.879562 0.375917 1090 1 0.0589042 0.812625 -0.00200376 16 1 0.373189 0.060716 0.0622224 47 1 0.438316 0.126239 0.0610428 142 1 0.437451 0.0601493 0.122661 173 1 0.378996 0.12285 0.11939 141 1 0.372617 1.00299 0.12081 15 1 0.439286 0.00251552 0.0601038 1124 1 0.000200366 0.942055 0.0542765 40 1 0.123702 0.18568 0.0616187 67 1 0.0646421 0.253388 0.0630245 72 1 0.12164 0.314239 0.0652134 162 1 0.0610812 0.179524 0.12545 194 1 0.0576994 0.309699 0.127795 197 1 0.123288 0.249691 0.120972 1641 1 0.243923 0.878471 0.504706 353 1 -4.25247e-05 0.36814 0.246475 42 1 0.312772 0.188421 -0.000934665 44 1 0.251675 0.196724 0.0615479 71 1 0.188218 0.252487 0.0601214 75 1 0.317639 0.248913 0.0683485 76 1 0.249202 0.315718 0.0597648 166 1 0.186483 0.190151 0.118945 170 1 0.318594 0.185733 0.127466 198 1 0.185731 0.312591 0.120281 201 1 0.248152 0.254854 0.127487 202 1 0.31761 0.313972 0.119253 340 1 0.49425 0.316618 0.314526 48 1 0.378232 0.186003 0.0651367 79 1 0.438053 0.251286 0.0629577 80 1 0.37839 0.312127 0.0577043 174 1 0.440193 0.18599 0.127182 205 1 0.380049 0.250952 0.125125 206 1 0.437785 0.319056 0.121805 1473 1 0.00366176 0.754869 0.374141 1169 1 0.501797 0.496945 0.123152 99 1 0.0652059 0.377204 0.0671047 104 1 0.130785 0.437832 0.0599418 226 1 0.0653255 0.431762 0.124595 229 1 0.130258 0.376473 0.121647 1157 1 0.125964 0.494957 0.124186 1645 1 0.372234 0.871195 0.501377 1281 1 -0.00107149 0.500479 0.250666 180 1 0.503362 0.186886 0.188477 103 1 0.186807 0.373728 0.0608981 107 1 0.317603 0.377198 0.0633315 108 1 0.252165 0.438418 0.061388 230 1 0.188993 0.439229 0.120675 233 1 0.247896 0.378781 0.126012 234 1 0.312021 0.441367 0.124453 1035 1 0.312601 0.505172 0.0603768 1236 1 0.495387 0.816815 0.186807 77 1 0.376869 0.246907 -0.0038311 111 1 0.439765 0.373956 0.0617845 112 1 0.378935 0.440822 0.0633536 237 1 0.376515 0.378723 0.125523 238 1 0.439402 0.436295 0.128258 1165 1 0.374516 0.498781 0.128345 10 1 0.313335 0.0635035 0.00239691 1518 1 0.436539 0.939934 0.372265 404 1 0.495014 0.0614877 0.441303 1027 1 0.0615267 0.494489 0.0656524 1032 1 0.122919 0.560398 0.0604642 1059 1 0.0600784 0.625129 0.0666329 1154 1 0.0623433 0.560911 0.129236 1189 1 0.125564 0.623536 0.126188 1517 1 0.373563 0.872828 0.38073 526 1 0.434098 0.0635261 0.499805 45 1 0.376622 0.127572 -0.00151715 1161 1 0.252976 0.505641 0.124012 1031 1 0.189052 0.500772 0.060167 1036 1 0.247119 0.565256 0.0624889 1063 1 0.186865 0.62311 0.0601622 1067 1 0.314961 0.628527 0.0609443 1158 1 0.183851 0.55771 0.121548 1162 1 0.315458 0.566389 0.12391 1193 1 0.24685 0.618006 0.126501 73 1 0.255723 0.254866 0.00159523 276 1 0.498132 0.0616439 0.312336 292 1 -0.000855735 0.18199 0.313154 1039 1 0.440855 0.498033 0.0604513 1040 1 0.377536 0.565027 0.0617404 1071 1 0.435508 0.62586 0.0629231 1166 1 0.434639 0.560493 0.127884 1197 1 0.373824 0.627258 0.126695 1064 1 0.12404 0.684612 0.0676066 1091 1 0.0625377 0.750335 0.0570339 1096 1 0.124176 0.812646 0.0626356 1186 1 0.0654683 0.685662 0.133279 1218 1 0.0631242 0.812612 0.128775 1221 1 0.119685 0.749536 0.126446 1538 1 0.0579054 0.562888 0.500989 1519 1 0.438729 0.881673 0.43737 1058 1 0.0632657 0.683946 -0.00315472 401 1 0.496951 1.00103 0.375212 1068 1 0.248596 0.682303 0.0628255 1095 1 0.187501 0.744823 0.0615051 1099 1 0.311162 0.748619 0.0570169 1100 1 0.251631 0.812802 0.0618844 1190 1 0.185829 0.686611 0.12615 1194 1 0.313421 0.683137 0.125319 1222 1 0.186526 0.81082 0.120182 1225 1 0.25031 0.751117 0.123451 1226 1 0.3149 0.811161 0.119609 1072 1 0.373794 0.686397 0.0575702 1103 1 0.441103 0.74609 0.0642725 1104 1 0.381761 0.808032 0.0629057 1198 1 0.438451 0.683202 0.123451 1229 1 0.37382 0.743217 0.120781 1230 1 0.433988 0.812488 0.123951 1396 1 0.495325 0.940886 0.309992 1476 1 0.00279954 0.815318 0.443657 4 1 0.00268231 0.0581827 0.0581558 1093 1 0.126199 0.745718 0.00234561 497 1 0.499164 0.378573 0.375227 522 1 0.312447 0.0605191 0.497947 1520 1 0.371576 0.93517 0.437435 3 1 0.0674949 0.994957 0.0630218 1123 1 0.059326 0.877502 0.0597483 1128 1 0.127883 0.931594 0.0623519 1250 1 0.0612731 0.937854 0.126495 1253 1 0.126191 0.876586 0.126658 1156 1 -0.000827386 0.558044 0.189483 589 1 0.370624 0.25181 0.503365 129 1 -0.00192829 1.00219 0.127046 148 1 0.502587 0.0619035 0.182207 7 1 0.184516 0.00143089 0.0600096 11 1 0.31236 0.99826 0.0663178 1127 1 0.186899 0.874887 0.0576461 1131 1 0.312698 0.878384 0.0579517 1132 1 0.248208 0.933403 0.0584845 1254 1 0.188238 0.93732 0.123193 1257 1 0.246739 0.874119 0.123142 1258 1 0.311784 0.936281 0.126723 132 1 -0.00453866 0.060552 0.186355 1135 1 0.435933 0.875127 0.0621282 1136 1 0.374582 0.937844 0.0647127 1261 1 0.379724 0.87299 0.120824 1262 1 0.433606 0.936288 0.122994 1297 1 0.498803 0.504573 0.251608 391 1 0.187404 0.999118 0.431824 557 1 0.37392 0.118721 0.498954 1153 1 0.00459273 0.494908 0.129415 136 1 0.126202 0.0553161 0.18993 163 1 0.063299 0.118718 0.187807 258 1 0.0611069 0.0584147 0.248711 264 1 0.124113 0.0614263 0.311048 291 1 0.062736 0.121139 0.31029 293 1 0.120955 0.120757 0.24694 395 1 0.31049 0.996986 0.43848 140 1 0.253893 0.0587744 0.186075 167 1 0.190556 0.121815 0.184051 171 1 0.312374 0.12346 0.188044 262 1 0.185705 0.0606897 0.243929 266 1 0.318322 0.0643545 0.246972 268 1 0.254636 0.0607924 0.303566 295 1 0.188235 0.120335 0.310605 297 1 0.244366 0.126288 0.245577 299 1 0.307617 0.125499 0.305123 267 1 0.309122 1.00017 0.313908 139 1 0.314734 0.991987 0.190697 263 1 0.185965 0.00462774 0.30789 1514 1 0.316488 0.935734 0.374018 144 1 0.370596 0.0619032 0.18186 175 1 0.441004 0.121214 0.183745 270 1 0.43291 0.0621934 0.246724 272 1 0.376497 0.0602291 0.312762 301 1 0.375449 0.130513 0.251919 303 1 0.438854 0.131573 0.312911 269 1 0.374654 -0.00598033 0.252123 143 1 0.437153 0.997103 0.182541 271 1 0.436365 -0.000629748 0.30798 1510 1 0.182019 0.943842 0.372819 617 1 0.250249 0.372187 0.497785 168 1 0.122791 0.187429 0.183995 195 1 0.0644383 0.248276 0.185065 200 1 0.122152 0.310914 0.1798 290 1 0.0639428 0.185573 0.250313 296 1 0.126817 0.17894 0.306485 322 1 0.0559255 0.305244 0.245609 323 1 0.0654555 0.245803 0.306491 325 1 0.127957 0.249944 0.246626 328 1 0.116928 0.309366 0.308294 172 1 0.2443 0.185926 0.182907 199 1 0.183147 0.251222 0.183258 203 1 0.312839 0.255755 0.183768 204 1 0.25383 0.318898 0.186369 294 1 0.185169 0.186456 0.242955 298 1 0.315348 0.194168 0.246951 300 1 0.246326 0.189627 0.307702 326 1 0.183193 0.316005 0.244495 327 1 0.1863 0.247557 0.312364 329 1 0.244554 0.251722 0.241651 330 1 0.313695 0.316519 0.247436 331 1 0.309809 0.253944 0.304844 332 1 0.246241 0.313833 0.307104 176 1 0.380015 0.190715 0.189758 207 1 0.437748 0.257997 0.187061 208 1 0.371477 0.317926 0.184364 302 1 0.437641 0.188309 0.24775 304 1 0.376547 0.193029 0.314082 333 1 0.377482 0.252986 0.249123 334 1 0.439004 0.317249 0.25003 335 1 0.437498 0.252285 0.315218 336 1 0.372407 0.317601 0.307845 1516 1 0.248167 0.936888 0.429475 1511 1 0.185505 0.882182 0.435153 1515 1 0.308149 0.873553 0.444158 1513 1 0.247877 0.874089 0.374604 227 1 0.0625331 0.369948 0.189446 232 1 0.121308 0.433538 0.188408 354 1 0.0612573 0.43898 0.247824 355 1 0.057687 0.37272 0.315501 357 1 0.121019 0.372975 0.250506 360 1 0.129054 0.43409 0.310108 1285 1 0.123928 0.499269 0.254047 585 1 0.252917 0.25314 0.499642 231 1 0.183807 0.370497 0.182229 235 1 0.309773 0.378042 0.183419 236 1 0.251048 0.444848 0.185051 358 1 0.186144 0.428092 0.24612 359 1 0.185041 0.372116 0.315725 361 1 0.251042 0.378036 0.24217 362 1 0.308691 0.43621 0.248735 363 1 0.311324 0.377282 0.305445 364 1 0.250553 0.434796 0.309524 1163 1 0.31277 0.506061 0.193779 1289 1 0.246192 0.497117 0.251662 1291 1 0.307341 0.502717 0.305753 17 1 0.503331 1.00092 -5.03253e-05 239 1 0.440343 0.374374 0.18613 240 1 0.376163 0.439988 0.186013 365 1 0.36885 0.378075 0.24027 366 1 0.434448 0.436328 0.247742 367 1 0.432639 0.375712 0.308075 368 1 0.373493 0.438174 0.306483 1167 1 0.436377 0.50294 0.186794 1295 1 0.434196 0.501743 0.316836 1293 1 0.378371 0.506905 0.253384 513 1 -0.00189259 0.00212709 0.500858 100 1 0.00119801 0.433537 0.0591184 9 1 0.256534 -0.00239472 -0.000735999 1283 1 0.0554452 0.499757 0.314319 1155 1 0.0640344 0.496992 0.188687 1160 1 0.120713 0.561963 0.189574 1187 1 0.0555345 0.624932 0.193093 1282 1 0.0617456 0.562975 0.252934 1288 1 0.121432 0.561162 0.31374 1315 1 0.0621049 0.631199 0.307189 1317 1 0.122939 0.62413 0.252207 1482 1 0.313295 0.812849 0.381979 1287 1 0.187668 0.494741 0.312467 1159 1 0.184026 0.49741 0.193531 1164 1 0.246418 0.561055 0.18888 1191 1 0.183611 0.625925 0.189048 1195 1 0.31032 0.627134 0.187905 1286 1 0.18642 0.561543 0.251511 1290 1 0.31083 0.565743 0.251574 1292 1 0.242998 0.561689 0.306627 1319 1 0.183334 0.621946 0.314476 1321 1 0.24408 0.625062 0.248175 1323 1 0.305154 0.622023 0.312297 389 1 0.119706 0.00123357 0.373769 1168 1 0.372108 0.562352 0.18918 1199 1 0.435448 0.627945 0.185547 1294 1 0.437751 0.569058 0.250806 1296 1 0.375338 0.570543 0.31563 1325 1 0.37646 0.626183 0.249524 1327 1 0.439703 0.625323 0.312478 578 1 0.0636694 0.313191 0.496664 1506 1 0.0637973 0.938676 0.371425 1512 1 0.121737 0.941106 0.440084 1509 1 0.127189 0.878438 0.372776 1192 1 0.123046 0.688033 0.187845 1219 1 0.0613539 0.752188 0.190863 1224 1 0.127652 0.812703 0.186383 1314 1 0.0591187 0.693024 0.251135 1320 1 0.125504 0.687539 0.315291 1346 1 0.0624753 0.814741 0.251216 1347 1 0.0631136 0.753759 0.315603 1349 1 0.12229 0.751867 0.25143 1352 1 0.126677 0.81769 0.310533 1196 1 0.24688 0.688359 0.18463 1223 1 0.182295 0.752967 0.181997 1227 1 0.30992 0.748346 0.186609 1228 1 0.248295 0.816616 0.184981 1318 1 0.183483 0.685925 0.246744 1322 1 0.311265 0.683378 0.251826 1324 1 0.250927 0.687423 0.312015 1350 1 0.186261 0.81377 0.242094 1351 1 0.185594 0.753797 0.309324 1353 1 0.245452 0.752787 0.248648 1354 1 0.309983 0.810458 0.251481 1355 1 0.309267 0.750401 0.31391 1356 1 0.250346 0.812691 0.312997 1200 1 0.371615 0.686802 0.189665 1231 1 0.438037 0.745254 0.184269 1232 1 0.372234 0.808338 0.186221 1326 1 0.439108 0.686839 0.248975 1328 1 0.37254 0.685192 0.312443 1357 1 0.374662 0.74914 0.252853 1358 1 0.436601 0.816136 0.252206 1359 1 0.434355 0.752433 0.307619 1360 1 0.37066 0.815408 0.311074 1507 1 0.0585493 0.884574 0.436326 261 1 0.126547 0.998641 0.249606 259 1 0.0594185 1.0002 0.312242 131 1 0.0649599 -0.000253709 0.189757 1251 1 0.0668458 0.875254 0.187111 1256 1 0.125963 0.937016 0.183067 1378 1 0.0623391 0.939438 0.249718 1379 1 0.0599284 0.876582 0.313747 1381 1 0.126176 0.8777 0.251222 1384 1 0.128308 0.938884 0.309896 1581 1 0.374494 0.624682 0.501411 1479 1 0.18626 0.751787 0.439931 135 1 0.189054 0.997703 0.189372 265 1 0.251625 0.998369 0.248092 1255 1 0.187301 0.87938 0.18865 1259 1 0.316432 0.873808 0.187525 1260 1 0.251329 0.938428 0.186274 1382 1 0.187403 0.935852 0.250142 1383 1 0.188878 0.879769 0.312023 1385 1 0.250392 0.873387 0.249988 1386 1 0.31777 0.937031 0.254483 1387 1 0.307981 0.877218 0.315473 1388 1 0.246757 0.943671 0.315454 1450 1 0.312723 0.682158 0.376817 1452 1 0.253781 0.683369 0.436627 1263 1 0.433699 0.873106 0.188809 1264 1 0.374185 0.938183 0.185338 1389 1 0.371537 0.871141 0.247088 1390 1 0.436308 0.939597 0.249144 1391 1 0.434023 0.874305 0.311302 1392 1 0.375665 0.933085 0.310433 387 1 0.0616342 -0.00413245 0.436958 386 1 0.061482 0.0645407 0.377282 392 1 0.125507 0.062929 0.433097 419 1 0.0623716 0.124048 0.440118 421 1 0.121817 0.123526 0.375256 1446 1 0.187947 0.694219 0.378533 49 1 0.503626 0.122465 -0.00107789 393 1 0.253311 0.00025499 0.375897 390 1 0.187879 0.0606267 0.372048 394 1 0.308753 0.0645111 0.371937 396 1 0.24491 0.0633844 0.431491 423 1 0.184229 0.128727 0.43889 425 1 0.247658 0.128347 0.370059 427 1 0.309858 0.124829 0.428876 1249 1 0.00151478 0.877134 0.125833 1345 1 -0.00295084 0.756632 0.25095 397 1 0.372053 0.996971 0.368989 1481 1 0.255394 0.752909 0.378186 399 1 0.433472 0.998522 0.431204 398 1 0.437591 0.0632107 0.374811 400 1 0.372645 0.0628344 0.433534 429 1 0.377469 0.123785 0.368173 431 1 0.438543 0.122898 0.436122 484 1 0.00409659 0.440692 0.436626 1441 1 -0.0068194 0.627821 0.372784 1265 1 0.494599 0.874101 0.122291 1442 1 0.0664961 0.688396 0.376874 1480 1 0.123934 0.81997 0.440747 418 1 0.0637774 0.180642 0.375111 424 1 0.123416 0.188513 0.440106 450 1 0.0544253 0.305643 0.370747 451 1 0.0601029 0.24719 0.438875 453 1 0.123568 0.242505 0.375501 456 1 0.126368 0.308182 0.43273 1425 1 0.497515 0.501303 0.373066 422 1 0.187695 0.184892 0.37189 426 1 0.314613 0.189756 0.368818 428 1 0.251995 0.191165 0.437135 454 1 0.190124 0.311263 0.378359 455 1 0.192624 0.250081 0.437269 457 1 0.253342 0.248993 0.372108 458 1 0.306355 0.310842 0.365423 459 1 0.316976 0.254395 0.433986 460 1 0.250403 0.313012 0.436974 385 1 0.000979362 0.00155035 0.380446 625 1 0.503331 0.38075 0.493764 1457 1 0.500379 0.6232 0.376257 1486 1 0.441174 0.811765 0.372593 430 1 0.436814 0.190487 0.375901 432 1 0.369854 0.185121 0.436502 461 1 0.379987 0.252477 0.373166 462 1 0.435111 0.314155 0.37515 463 1 0.435808 0.248453 0.438508 464 1 0.372998 0.322606 0.430709 1485 1 0.370153 0.750663 0.376384 613 1 0.122453 0.370397 0.499864 1487 1 0.436175 0.751309 0.436427 483 1 0.0670427 0.374222 0.431024 488 1 0.124863 0.44224 0.439126 485 1 0.127392 0.372986 0.373951 482 1 0.0674446 0.440693 0.373924 1411 1 0.064305 0.508125 0.439929 1456 1 0.378168 0.684986 0.436154 492 1 0.25016 0.439669 0.439326 490 1 0.312402 0.438412 0.369941 489 1 0.251863 0.376475 0.372708 491 1 0.307602 0.378521 0.430293 486 1 0.189511 0.437104 0.37443 487 1 0.187667 0.374361 0.437045 1415 1 0.188102 0.497499 0.435269 13 1 0.374241 -0.00255023 -0.000359928 1454 1 0.435673 0.690608 0.368103 494 1 0.436172 0.433352 0.375688 496 1 0.366255 0.438591 0.440752 493 1 0.370309 0.378001 0.365833 495 1 0.438949 0.373918 0.440165 1423 1 0.43322 0.498099 0.438377 1421 1 0.37631 0.500472 0.379461 1448 1 0.124443 0.69231 0.439071 388 1 -0.00533016 0.0629443 0.435993 1488 1 0.380978 0.814464 0.438349 1541 1 0.126678 0.502835 0.500573 1478 1 0.190813 0.808273 0.370274 1413 1 0.123012 0.502973 0.371588 1410 1 0.0607055 0.562531 0.37427 1416 1 0.126555 0.564325 0.440526 1443 1 0.0551028 0.628838 0.434272 1445 1 0.124618 0.628114 0.379744 1417 1 0.244448 0.497896 0.377885 1419 1 0.308974 0.500663 0.437795 1420 1 0.252069 0.559832 0.436869 1451 1 0.312574 0.618023 0.437868 1449 1 0.247743 0.620668 0.369153 1447 1 0.188116 0.626933 0.434837 1414 1 0.18501 0.561148 0.374979 1418 1 0.312203 0.560582 0.375451 1474 1 0.0650418 0.810559 0.375563 1329 1 0.50307 0.626445 0.249104 1484 1 0.240829 0.818129 0.439789 1453 1 0.372352 0.62291 0.378206 1424 1 0.376493 0.558007 0.439394 1455 1 0.43975 0.622962 0.443268 1422 1 0.438703 0.564425 0.373907 1475 1 0.0625113 0.752007 0.436975 1483 1 0.313634 0.751432 0.440339 1477 1 0.12918 0.754293 0.375045 1428 1 0.501697 0.563966 0.439711 1377 1 0.00204575 0.88003 0.253538 581 1 0.124903 0.250088 0.500275 1508 1 -0.00273591 0.939249 0.439701 46 1 0.441079 0.191083 0.0010372 161 1 0.000474957 0.121225 0.123844 97 1 -0.000383631 0.375334 -0.00143242 1140 1 0.498168 0.936939 0.0639151 1348 1 0.000430207 0.820489 0.314469 554 1 0.308173 0.187619 0.503906 590 1 0.434946 0.315694 0.50067 1060 1 0.000283365 0.687329 0.0698193 558 1 0.434819 0.18843 0.498072 1613 1 0.375005 0.747603 0.49975 372 1 0.501764 0.436281 0.31196 481 1 -0.00368022 0.377331 0.376243 1252 1 -0.0027364 0.941933 0.190192 433 1 0.497631 0.128759 0.37169 244 1 0.493577 0.43504 0.191685 1057 1 0.00204069 0.620631 0.00297113 1130 1 0.315573 0.937904 -0.00502408 1649 1 0.498916 0.874683 0.501422 228 1 -0.00200904 0.434553 0.186008 1028 1 0.00315237 0.558347 0.0668672 1393 1 0.500582 0.879586 0.253306 1092 1 -0.00146861 0.81369 0.066918 1605 1 0.123715 0.753241 0.499682 621 1 0.373023 0.378521 0.499891 1606 1 0.182793 0.817679 0.503344 582 1 0.184832 0.310355 0.497341 1129 1 0.250855 0.876582 -0.00081003 622 1 0.436628 0.435307 0.494339 1570 1 0.0557331 0.687147 0.496177 525 1 0.375579 0.000476324 0.49662 1573 1 0.126049 0.62329 0.498433 106 1 0.318575 0.432571 0.00458534 1569 1 -0.00179041 0.626512 0.503961 1574 1 0.187604 0.688748 0.496477 553 1 0.248271 0.119414 0.49558 1638 1 0.181406 0.939375 0.495799 521 1 0.248845 0.997398 0.497308 1134 1 0.436521 0.934922 0.00318348 514 1 0.0639809 0.0624754 0.493387 1033 1 0.251168 0.499266 0.000795641 81 1 0.506075 0.253019 0.00445748 1097 1 0.249724 0.746816 -0.00142485 518 1 0.183962 0.0664155 0.498152 614 1 0.182307 0.431586 0.498387 41 1 0.255728 0.126562 0.000835616 110 1 0.444605 0.432251 -0.00183524 1061 1 0.123987 0.62438 0.0031953 520 1 0.1252 0.0614843 0.555557 547 1 0.0620314 0.117144 0.557257 642 1 0.0695546 0.0614315 0.62409 677 1 0.124684 0.123272 0.622116 1700 1 0.00101246 0.686352 0.689902 2032 1 0.382164 0.938479 0.932941 2030 1 0.438879 0.93587 0.870083 772 1 0.000769592 0.0639141 0.80914 524 1 0.249243 0.0578783 0.564704 551 1 0.186384 0.121689 0.562887 555 1 0.309132 0.119411 0.56206 646 1 0.185935 0.0632394 0.628386 650 1 0.316229 0.0577595 0.627406 681 1 0.248625 0.11828 0.624511 523 1 0.31149 0.999273 0.561799 516 1 0.00543394 0.0619777 0.558973 649 1 0.256109 0.998104 0.622261 528 1 0.370896 0.0623663 0.558815 559 1 0.439948 0.120926 0.564551 654 1 0.437496 0.060425 0.626761 685 1 0.37294 0.121981 0.62437 653 1 0.373905 0.996316 0.623087 552 1 0.128424 0.188985 0.558243 579 1 0.0658063 0.254733 0.562862 584 1 0.123058 0.315951 0.563262 674 1 0.069042 0.184711 0.617286 706 1 0.0632727 0.309538 0.627352 709 1 0.126787 0.247377 0.623286 2029 1 0.373736 0.871884 0.878657 1668 1 -0.00322596 0.556349 0.687148 556 1 0.248287 0.182616 0.565385 583 1 0.191475 0.250634 0.562061 587 1 0.312262 0.254455 0.563499 588 1 0.25086 0.319155 0.559572 678 1 0.182991 0.185403 0.626886 682 1 0.310511 0.190577 0.624665 710 1 0.183807 0.310926 0.629449 713 1 0.246675 0.252406 0.626801 714 1 0.30826 0.312735 0.626267 721 1 0.499692 0.251525 0.627053 1602 1 0.0634611 0.815875 0.501439 560 1 0.374148 0.182946 0.561241 591 1 0.438979 0.251241 0.564756 592 1 0.37642 0.314363 0.564962 686 1 0.43576 0.189289 0.628774 717 1 0.377889 0.248524 0.625526 718 1 0.438718 0.311342 0.625345 2031 1 0.437497 0.873803 0.934551 1972 1 0.5019 0.691596 0.935257 1542 1 0.190403 0.560185 0.501972 1122 1 0.0643881 0.938714 0.995185 1577 1 0.249501 0.622202 0.493308 611 1 0.0647631 0.381704 0.563061 616 1 0.124809 0.44203 0.564227 738 1 0.067576 0.435805 0.624297 741 1 0.120532 0.369286 0.626147 1539 1 0.0614148 0.496667 0.5546 785 1 0.496098 0.00729805 0.755923 615 1 0.183843 0.369891 0.562052 619 1 0.31387 0.375183 0.560677 620 1 0.246567 0.434126 0.561779 742 1 0.187952 0.435324 0.62375 745 1 0.250269 0.375017 0.62337 746 1 0.307137 0.437961 0.625603 1547 1 0.310666 0.493485 0.564088 1637 1 0.120413 0.877746 0.498637 1841 1 0.500554 0.617498 0.74947 1034 1 0.315394 0.565924 1.00062 586 1 0.313461 0.314567 0.500037 623 1 0.439689 0.3762 0.554473 624 1 0.378293 0.433515 0.562361 749 1 0.376815 0.37412 0.625711 750 1 0.441483 0.433155 0.623068 1551 1 0.440196 0.497052 0.562824 1545 1 0.247598 0.500915 0.503279 1677 1 0.377979 0.496442 0.618921 5 1 0.125092 -0.00122863 0.999796 2001 1 0.500095 0.751921 0.868954 2028 1 0.253593 0.938916 0.939473 1620 1 0.498964 0.808977 0.564461 2033 1 0.49929 0.87612 0.874744 1669 1 0.126548 0.49681 0.625604 1544 1 0.121288 0.558284 0.565014 1571 1 0.0649863 0.622401 0.559259 1666 1 0.066144 0.566567 0.626786 1701 1 0.127124 0.63037 0.621908 529 1 0.496955 0.99654 0.500628 1921 1 0.00747398 0.495076 0.87411 2022 1 0.191032 0.94071 0.881071 2023 1 0.185459 0.8737 0.931692 1543 1 0.18956 0.496925 0.564153 1673 1 0.246998 0.496656 0.625166 1548 1 0.246164 0.563319 0.567943 1575 1 0.189166 0.627398 0.555903 1579 1 0.311763 0.625529 0.56077 1670 1 0.183615 0.564274 0.625936 1674 1 0.313972 0.562675 0.62347 1705 1 0.253001 0.631474 0.623704 913 1 0.502791 -0.000818464 0.873867 1101 1 0.372137 0.745685 0.998709 2026 1 0.315568 0.938672 0.876853 1552 1 0.373497 0.56169 0.563755 1583 1 0.442366 0.622568 0.557136 1678 1 0.440243 0.558172 0.628136 1709 1 0.38304 0.619133 0.62553 69 1 0.125565 0.250724 0.999599 1956 1 -0.000383628 0.682693 0.942352 1576 1 0.121276 0.686595 0.554888 1603 1 0.0612514 0.75145 0.56451 1608 1 0.119952 0.815358 0.562637 1698 1 0.0618077 0.685391 0.621662 1730 1 0.0621077 0.813463 0.627909 1733 1 0.12351 0.746574 0.624574 2025 1 0.254117 0.872117 0.881552 1889 1 0.00289885 0.8733 0.749938 1580 1 0.246303 0.686729 0.560345 1607 1 0.182497 0.749602 0.561968 1611 1 0.312015 0.747644 0.561952 1612 1 0.249163 0.811222 0.561529 1702 1 0.18781 0.684923 0.62066 1706 1 0.315301 0.684025 0.619984 1734 1 0.191343 0.812623 0.623524 1737 1 0.250353 0.748512 0.619576 1738 1 0.313558 0.810855 0.625193 38 1 0.188321 0.181934 0.998308 1828 1 -0.000513273 0.685702 0.819317 618 1 0.306673 0.436612 0.497459 2036 1 0.495081 0.938197 0.934182 2027 1 0.314586 0.873128 0.941012 903 1 0.190126 0.00398837 0.936317 1584 1 0.376808 0.688728 0.564426 1615 1 0.435037 0.755162 0.5658 1616 1 0.371832 0.81082 0.564382 1710 1 0.439745 0.682303 0.631958 1741 1 0.376171 0.745633 0.628114 1742 1 0.432461 0.812463 0.625196 1745 1 0.496975 0.752634 0.625064 549 1 0.123384 0.12405 0.497774 515 1 0.0658499 0.00152715 0.558977 645 1 0.126165 -0.00134032 0.624454 1635 1 0.0614402 0.873821 0.56618 1640 1 0.123325 0.933014 0.564167 1762 1 0.0631879 0.936491 0.62538 1765 1 0.127916 0.879116 0.625718 899 1 0.0641856 0.00329544 0.932782 1844 1 0.496915 0.687471 0.812969 78 1 0.439879 0.31461 0.997363 519 1 0.179943 0.996041 0.56107 1639 1 0.19275 0.875621 0.56564 1643 1 0.312943 0.872063 0.565332 1644 1 0.251443 0.939321 0.563903 1766 1 0.189092 0.94488 0.63143 1769 1 0.25143 0.871309 0.628565 1770 1 0.311967 0.933079 0.622045 1609 1 0.247552 0.747915 0.497445 2021 1 0.120144 0.88256 0.874696 527 1 0.434637 1.00254 0.560988 1647 1 0.435411 0.871619 0.561278 1648 1 0.371687 0.933975 0.55749 1773 1 0.372113 0.869834 0.626625 1774 1 0.437131 0.937785 0.622254 648 1 0.128144 0.060344 0.689507 675 1 0.0658383 0.123003 0.687604 770 1 0.0649177 0.0584914 0.749177 776 1 0.129528 0.0639422 0.814545 803 1 0.0627353 0.123328 0.813568 805 1 0.124035 0.122701 0.756365 2004 1 0.500024 0.806016 0.935548 652 1 0.252486 0.0627011 0.693495 679 1 0.189165 0.124869 0.687546 683 1 0.311096 0.12053 0.685537 774 1 0.185466 0.0635735 0.751981 778 1 0.318642 0.0637514 0.747924 780 1 0.251565 0.0682328 0.804002 807 1 0.187824 0.127145 0.818492 809 1 0.256308 0.132971 0.75025 811 1 0.313425 0.128423 0.812978 651 1 0.311877 1.00376 0.689711 775 1 0.188251 1.00088 0.812737 656 1 0.374677 0.0598313 0.684786 687 1 0.43767 0.129643 0.685866 782 1 0.434758 0.0684076 0.748523 784 1 0.374975 0.0638139 0.809596 813 1 0.379181 0.129412 0.749224 815 1 0.437811 0.131277 0.813431 655 1 0.438101 0.999534 0.683654 781 1 0.378789 0.000257986 0.753879 2024 1 0.122624 0.94071 0.936278 2018 1 0.0634879 0.941297 0.874987 2019 1 0.0635621 0.876498 0.934276 680 1 0.125075 0.183995 0.68791 707 1 0.0617235 0.245558 0.68734 712 1 0.124222 0.30845 0.687831 802 1 0.058063 0.187908 0.754036 808 1 0.120604 0.185896 0.815781 834 1 0.0655173 0.310641 0.751144 835 1 0.0638357 0.250911 0.812259 837 1 0.124285 0.245025 0.751237 840 1 0.128938 0.310005 0.811305 74 1 0.314128 0.31754 0.998792 684 1 0.24331 0.185909 0.688476 711 1 0.177855 0.247423 0.691821 715 1 0.314849 0.251358 0.685957 716 1 0.248559 0.314482 0.688561 806 1 0.182076 0.18509 0.756064 810 1 0.314632 0.194219 0.751943 812 1 0.251294 0.19536 0.808977 838 1 0.193888 0.310782 0.75041 839 1 0.186394 0.250827 0.813107 841 1 0.250045 0.24792 0.746821 842 1 0.310415 0.318716 0.749517 843 1 0.310144 0.253408 0.814508 844 1 0.25293 0.312187 0.81184 688 1 0.371408 0.185408 0.686972 719 1 0.441456 0.252327 0.687947 720 1 0.377403 0.312806 0.687223 814 1 0.437544 0.191535 0.749737 816 1 0.379531 0.191721 0.809123 845 1 0.373657 0.257614 0.746037 846 1 0.437825 0.316792 0.748212 847 1 0.440331 0.250742 0.8137 848 1 0.380056 0.309283 0.812902 901 1 0.128005 1.002 0.87877 689 1 0.502466 0.127875 0.629971 739 1 0.0590572 0.372999 0.685292 744 1 0.125998 0.435789 0.686343 866 1 0.0630369 0.435272 0.744382 867 1 0.0661926 0.370599 0.816054 869 1 0.126378 0.375738 0.749024 872 1 0.125712 0.435658 0.816784 1795 1 0.0673327 0.493409 0.813619 1667 1 0.0658716 0.497613 0.686039 1797 1 0.125086 0.501089 0.752967 788 1 0.494573 0.0655753 0.815541 743 1 0.185363 0.369822 0.685931 747 1 0.311593 0.373152 0.685958 748 1 0.248053 0.438257 0.6876 870 1 0.186172 0.440431 0.752426 871 1 0.190672 0.374886 0.811558 873 1 0.246638 0.377787 0.744758 874 1 0.311009 0.433426 0.747932 875 1 0.313853 0.372448 0.812982 876 1 0.249846 0.441052 0.814486 1671 1 0.18509 0.49641 0.690037 1968 1 0.376138 0.689756 0.932822 751 1 0.435219 0.37501 0.685503 752 1 0.373261 0.433558 0.682414 877 1 0.376586 0.378119 0.750996 878 1 0.442056 0.440662 0.749711 879 1 0.434425 0.378142 0.812494 880 1 0.37375 0.436949 0.812714 1679 1 0.441082 0.497717 0.683315 1805 1 0.380133 0.49615 0.742611 1966 1 0.439915 0.683673 0.875231 1672 1 0.129863 0.556937 0.687069 1699 1 0.0679603 0.626171 0.684144 1794 1 0.0608389 0.559489 0.747781 1800 1 0.124687 0.565789 0.815442 1827 1 0.0611083 0.626375 0.814135 1829 1 0.124351 0.622965 0.75111 1803 1 0.313956 0.499045 0.805342 1675 1 0.315422 0.499847 0.679389 1801 1 0.24954 0.498486 0.745632 1799 1 0.183453 0.50165 0.814458 1676 1 0.24704 0.560233 0.682967 1703 1 0.182789 0.624701 0.683993 1707 1 0.310272 0.621649 0.680478 1798 1 0.192547 0.561008 0.747299 1802 1 0.313432 0.559943 0.736448 1804 1 0.255885 0.559547 0.804673 1831 1 0.188803 0.620465 0.812385 1833 1 0.252584 0.621464 0.744144 1835 1 0.31339 0.623473 0.808585 1807 1 0.444045 0.496419 0.812799 1680 1 0.375743 0.557727 0.687213 1711 1 0.434572 0.618982 0.692617 1806 1 0.438702 0.556047 0.752676 1808 1 0.374728 0.558782 0.811723 1837 1 0.369941 0.623853 0.749582 1839 1 0.442174 0.625764 0.813109 1098 1 0.311401 0.810499 1.00112 2000 1 0.370608 0.807447 0.937775 1998 1 0.439687 0.810809 0.873357 1997 1 0.372108 0.74922 0.873494 1704 1 0.124216 0.688792 0.689716 1731 1 0.0610832 0.74718 0.68525 1736 1 0.127672 0.816897 0.687367 1826 1 0.0660012 0.686859 0.748803 1832 1 0.120691 0.686161 0.812593 1858 1 0.06687 0.815638 0.749184 1859 1 0.060878 0.755193 0.811528 1861 1 0.123573 0.750358 0.751073 1864 1 0.125723 0.814094 0.815879 1708 1 0.249107 0.687188 0.689129 1735 1 0.18336 0.75312 0.687098 1739 1 0.308805 0.749167 0.684725 1740 1 0.25103 0.812255 0.688481 1830 1 0.183798 0.679317 0.749402 1834 1 0.311282 0.683835 0.744492 1836 1 0.246313 0.685096 0.807236 1862 1 0.185159 0.815209 0.751692 1863 1 0.184277 0.746929 0.812556 1865 1 0.256086 0.753628 0.753478 1866 1 0.315212 0.812857 0.749824 1867 1 0.316363 0.754449 0.818707 1868 1 0.24399 0.812049 0.812279 1999 1 0.438136 0.749902 0.936928 1712 1 0.376723 0.678836 0.686753 1743 1 0.437488 0.752592 0.686741 1744 1 0.377647 0.807766 0.690475 1838 1 0.443063 0.683938 0.748302 1840 1 0.378601 0.687034 0.810061 1869 1 0.374412 0.748409 0.749611 1870 1 0.43531 0.810878 0.751591 1871 1 0.436487 0.749059 0.813649 1872 1 0.374771 0.816162 0.811894 1094 1 0.184275 0.813751 1.00006 1037 1 0.377651 0.500212 1.0059 643 1 0.0627477 0.999088 0.684968 771 1 0.0622834 0.00176828 0.81241 773 1 0.128141 1.00016 0.749953 1763 1 0.064928 0.876625 0.689129 1768 1 0.128783 0.940735 0.688995 1890 1 0.0643719 0.94109 0.748633 1891 1 0.0636711 0.875622 0.81075 1893 1 0.124011 0.875721 0.751191 1896 1 0.122063 0.940665 0.812498 1924 1 -9.15941e-05 0.558299 0.938115 777 1 0.253906 1.00259 0.751776 779 1 0.315163 -4.91504e-05 0.81568 647 1 0.192497 -0.0018102 0.690699 1767 1 0.186667 0.874582 0.686758 1771 1 0.315797 0.872878 0.683573 1772 1 0.255723 0.937383 0.691268 1894 1 0.186952 0.93287 0.753131 1895 1 0.188184 0.878345 0.822254 1897 1 0.248833 0.874148 0.751524 1898 1 0.309811 0.934713 0.757969 1899 1 0.311599 0.871811 0.814511 1900 1 0.252106 0.93861 0.816369 783 1 0.439167 0.00265187 0.812783 1775 1 0.439821 0.87562 0.684281 1776 1 0.375032 0.936154 0.688809 1901 1 0.377669 0.876218 0.753351 1902 1 0.443638 0.936719 0.745094 1903 1 0.442777 0.875933 0.810228 1904 1 0.375997 0.935555 0.811775 1652 1 0.496284 0.942102 0.567092 641 1 0.00583405 -0.000729188 0.626502 898 1 0.0656409 0.0613879 0.872653 904 1 0.128965 0.0615661 0.936436 931 1 0.0646859 0.125792 0.939081 933 1 0.123158 0.1227 0.877064 66 1 0.0667541 0.318446 1.00308 1553 1 0.496333 0.497818 0.495367 905 1 0.252212 -0.000515712 0.873837 907 1 0.316797 0.00256747 0.937643 902 1 0.192867 0.0579331 0.87141 906 1 0.30993 0.0578507 0.873908 908 1 0.255848 0.0661966 0.941086 935 1 0.188536 0.126679 0.934543 937 1 0.255764 0.12635 0.869793 939 1 0.313528 0.128651 0.935081 817 1 0.49848 0.122159 0.747947 1954 1 0.0628528 0.686256 0.880316 911 1 0.44012 -0.00062172 0.936532 1992 1 0.128489 0.803033 0.940007 909 1 0.377323 -0.000555195 0.880394 910 1 0.435144 0.0662903 0.872931 912 1 0.374392 0.0644014 0.932288 941 1 0.373501 0.120075 0.868099 943 1 0.43519 0.121372 0.937937 1989 1 0.122644 0.746169 0.872713 1987 1 0.0566181 0.751223 0.936875 993 1 0.002283 0.375032 0.873466 1825 1 0.00831613 0.621926 0.74935 930 1 0.057479 0.186685 0.875131 936 1 0.124741 0.197046 0.937448 962 1 0.0625304 0.309159 0.87567 963 1 0.0634229 0.253453 0.939809 965 1 0.122379 0.252331 0.875638 968 1 0.125329 0.312801 0.938262 1962 1 0.313662 0.683625 0.869927 596 1 0.50317 0.310605 0.557573 1777 1 0.500341 0.874694 0.619993 1990 1 0.190841 0.803354 0.879944 545 1 0.000210539 0.125893 0.500407 934 1 0.182126 0.191902 0.875103 938 1 0.31078 0.191278 0.87352 940 1 0.252625 0.193488 0.93802 966 1 0.186174 0.310545 0.876022 967 1 0.186962 0.248848 0.942272 969 1 0.248885 0.253433 0.872793 970 1 0.311417 0.310923 0.876214 971 1 0.318257 0.253325 0.933843 972 1 0.249684 0.313198 0.933435 628 1 0.499814 0.43959 0.563793 1986 1 0.0679391 0.817274 0.881029 644 1 -0.00413542 0.059809 0.685675 1764 1 -0.00239757 0.935258 0.689887 564 1 0.496008 0.188126 0.560233 973 1 0.37734 0.246656 0.872191 944 1 0.379304 0.187944 0.939822 942 1 0.437963 0.189432 0.876325 976 1 0.377693 0.317216 0.939963 975 1 0.445605 0.251 0.935826 974 1 0.43981 0.315061 0.876877 1933 1 0.376676 0.493609 0.872272 1964 1 0.251253 0.684854 0.930565 995 1 0.065405 0.372423 0.933533 1000 1 0.131195 0.440757 0.937235 994 1 0.0623419 0.437682 0.876508 997 1 0.129821 0.376075 0.877737 1070 1 0.439844 0.685526 1.00024 1996 1 0.244597 0.810608 0.942471 998 1 0.188776 0.438275 0.875176 1001 1 0.247382 0.373357 0.869666 999 1 0.190468 0.374702 0.932058 1004 1 0.251272 0.438337 0.932547 1002 1 0.313205 0.432893 0.875032 1003 1 0.311337 0.377111 0.938028 1927 1 0.195429 0.499868 0.934253 1960 1 0.126727 0.691984 0.939132 1 1 0.00436475 -0.00241054 0.995194 1935 1 0.442247 0.498514 0.940102 1934 1 0.441526 0.557328 0.87553 1993 1 0.252614 0.743656 0.872804 1965 1 0.37562 0.620681 0.877935 1991 1 0.191553 0.745422 0.93741 109 1 0.380828 0.378579 0.998134 1008 1 0.38016 0.436389 0.938704 1007 1 0.441756 0.374978 0.937109 1005 1 0.374192 0.375073 0.87169 1006 1 0.439812 0.434921 0.874401 1995 1 0.311004 0.746776 0.936522 1925 1 0.1211 0.500347 0.877627 1923 1 0.0637427 0.497157 0.940242 1922 1 0.0625044 0.559499 0.876071 1928 1 0.123482 0.558739 0.940673 1955 1 0.0644578 0.617384 0.941844 1957 1 0.127067 0.627237 0.871958 1994 1 0.306606 0.811408 0.883031 1963 1 0.316981 0.62152 0.934884 1961 1 0.254675 0.622994 0.869286 1932 1 0.257294 0.56127 0.934142 1931 1 0.315863 0.493316 0.93957 1959 1 0.185295 0.627024 0.93562 1929 1 0.248636 0.498787 0.871531 1926 1 0.187637 0.563845 0.882306 1930 1 0.312421 0.554027 0.870825 1967 1 0.443323 0.624893 0.932696 1936 1 0.370298 0.558216 0.938878 1958 1 0.186658 0.683648 0.874892 1713 1 0.49757 0.616914 0.624328 1892 1 -0.00184886 0.938747 0.809186 532 1 0.500031 0.0575155 0.558523 945 1 0.500772 0.125648 0.878398 868 1 0.0040553 0.43254 0.80903 580 1 0.000708972 0.313294 0.563444 1684 1 0.501952 0.557779 0.687804 1572 1 -0.000500131 0.691335 0.562045 1860 1 0.00188093 0.816538 0.812663 1988 1 0.00372531 0.813429 0.935963 1953 1 0.00363215 0.624622 0.877699 961 1 -0.00342324 0.24952 0.878047 820 1 0.503476 0.182313 0.817508 929 1 -0.00448578 0.127354 0.876885 900 1 -0.00396885 0.0639565 0.935706 1857 1 0.0077197 0.753349 0.747233 660 1 0.493946 0.0625243 0.686755 1793 1 0.0047145 0.495927 0.746367 1646 1 0.435662 0.937587 0.497279 1062 1 0.191883 0.685639 0.998671 1133 1 0.374119 0.875547 0.996237 561 1 0.497688 0.124364 0.50119 98 1 0.0642239 0.436234 1.00015 1029 1 0.128821 0.500517 1.00361 1065 1 0.250203 0.618174 0.995509 105 1 0.249247 0.37787 0.999124 1069 1 0.379797 0.623686 0.992217 550 1 0.194661 0.186846 0.501945 1038 1 0.441785 0.563918 0.997964 1026 1 0.0671187 0.557065 1.0065 34 1 0.0665448 0.188376 1.00363 102 1 0.190836 0.439952 1.00093 70 1 0.184921 0.313895 0.996719 2 1 0.0637328 0.0622296 0.997802 1610 1 0.309213 0.812236 0.500618 610 1 0.0617435 0.438763 0.497906 1634 1 0.0625082 0.941941 0.503477 546 1 0.0644266 0.186581 0.506098 1126 1 0.186882 0.933918 0.994815 1614 1 0.441367 0.812064 0.49812 1582 1 0.4429 0.690711 0.501556 1025 1 0.00243718 0.496597 0.999772 1642 1 0.306481 0.932868 0.499309 14 1 0.437802 0.0577394 0.997652 1066 1 0.310036 0.681924 0.995108 1578 1 0.312167 0.685176 0.494693 1550 1 0.433493 0.558617 0.503146 37 1 0.127922 0.121828 0.99816 101 1 0.129734 0.375202 0.997699 1030 1 0.184218 0.563112 1.00199 577 1 -0.00212934 0.244826 0.502702 1137 1 0.496396 0.875431 0.999107 1102 1 0.440556 0.815455 0.99997 609 1 -0.00116001 0.379188 0.501298 1125 1 0.124189 0.873875 0.995099 1549 1 0.375342 0.499072 0.503484 6 1 0.19694 0.0674476 0.996059 517 1 0.125504 0.00435885 0.49665 1546 1 0.31015 0.561599 0.507038 24 1 0.626399 0.0573837 0.0620094 51 1 0.569128 0.123393 0.0632087 146 1 0.561952 0.0651107 0.127877 181 1 0.626327 0.122176 0.122112 121 1 0.747134 0.375143 -0.00464349 18 1 0.560791 0.0655138 0.00158793 19 1 0.567621 0.997209 0.0621821 28 1 0.75148 0.0641966 0.0647518 55 1 0.692542 0.120706 0.0623231 59 1 0.810665 0.126596 0.063853 150 1 0.690125 0.0594092 0.128109 154 1 0.809862 0.0581578 0.125649 185 1 0.747725 0.127995 0.131601 153 1 0.751709 0.998759 0.133326 23 1 0.687474 1.00078 0.0638551 260 1 1.00127 0.0647922 0.314466 36 1 1.00096 0.182041 0.0592992 32 1 0.872741 0.0637825 0.0606589 63 1 0.935846 0.124073 0.0650631 158 1 0.935715 0.0623437 0.124332 189 1 0.870769 0.123871 0.126185 157 1 0.874158 -0.00109471 0.119846 1492 1 0.504118 0.812252 0.436539 31 1 0.941162 0.998157 0.0582881 56 1 0.625941 0.190568 0.0675596 83 1 0.560225 0.249685 0.0709225 88 1 0.626287 0.316939 0.0644042 178 1 0.566142 0.189259 0.133365 210 1 0.564529 0.314105 0.127352 213 1 0.626413 0.253021 0.132879 1536 1 0.872164 0.939144 0.441238 449 1 0.998967 0.2439 0.371248 20 1 0.500967 0.0603355 0.0611252 1535 1 0.938574 0.873295 0.43828 60 1 0.75152 0.191677 0.067389 87 1 0.686276 0.252742 0.0679084 91 1 0.811584 0.252902 0.0645685 92 1 0.747356 0.308827 0.0662207 182 1 0.68967 0.192822 0.129438 186 1 0.808864 0.187231 0.123336 214 1 0.686486 0.319176 0.132663 217 1 0.749654 0.250111 0.132529 218 1 0.812716 0.313058 0.129589 116 1 0.498315 0.437946 0.0670291 289 1 1.0012 0.122863 0.252484 1049 1 0.750592 0.494831 -0.000278839 64 1 0.871194 0.182681 0.068798 95 1 0.936523 0.242788 0.0708239 96 1 0.87915 0.315597 0.0640727 190 1 0.940601 0.179758 0.129022 221 1 0.874443 0.247053 0.127375 222 1 0.938344 0.314722 0.124155 126 1 0.940549 0.440688 -0.00584294 337 1 0.499266 0.259721 0.255032 53 1 0.626557 0.123389 0.00283229 115 1 0.564066 0.38222 0.061024 120 1 0.627999 0.44224 0.0637311 242 1 0.56656 0.438885 0.128978 245 1 0.625999 0.374625 0.128706 1173 1 0.62977 0.502677 0.125671 119 1 0.687136 0.379375 0.063297 123 1 0.811731 0.370608 0.0596388 124 1 0.751973 0.439314 0.0664706 246 1 0.691414 0.435713 0.126975 249 1 0.753198 0.371848 0.125352 250 1 0.812756 0.431806 0.125983 1047 1 0.689587 0.500318 0.0689718 1561 1 0.750699 0.499362 0.5044 127 1 0.936279 0.376923 0.0558252 128 1 0.872876 0.436011 0.060464 253 1 0.873533 0.374079 0.127734 254 1 0.935464 0.435373 0.12306 1534 1 0.938435 0.947133 0.378054 1043 1 0.560857 0.502843 0.0616467 1048 1 0.624805 0.561807 0.0650246 1075 1 0.56369 0.620688 0.0650105 1170 1 0.561483 0.561674 0.128812 1205 1 0.632945 0.627039 0.122394 89 1 0.752108 0.248007 0.00119117 1051 1 0.815899 0.499205 0.0699382 1177 1 0.753016 0.49875 0.12346 1052 1 0.746027 0.562174 0.0632045 1079 1 0.687681 0.626921 0.0642752 1083 1 0.812019 0.625144 0.0619209 1174 1 0.688241 0.564369 0.124893 1178 1 0.812419 0.561752 0.128513 1209 1 0.7495 0.626379 0.12455 1105 1 0.500748 0.748029 -0.000474966 598 1 0.688593 0.311383 0.502429 30 1 0.941167 0.0630112 -6.47857e-05 1181 1 0.882246 0.499666 0.123565 1055 1 0.939488 0.494432 0.0609133 1056 1 0.876927 0.558049 0.0627759 1087 1 0.941936 0.626067 0.0633304 1182 1 0.938323 0.554363 0.127973 1213 1 0.876933 0.621234 0.123099 1533 1 0.875767 0.878181 0.376209 1053 1 0.87603 0.503417 0.00284468 1149 1 0.876159 0.876313 0.00210626 22 1 0.685798 0.0655557 -0.000597379 1364 1 0.498441 0.812949 0.309874 1080 1 0.627009 0.687896 0.0668721 1107 1 0.564198 0.749335 0.0661631 1112 1 0.624278 0.813019 0.0635718 1202 1 0.562684 0.691889 0.128063 1234 1 0.562453 0.820092 0.129344 1237 1 0.62981 0.753055 0.126427 465 1 0.503834 0.250517 0.377166 84 1 0.499112 0.312148 0.0631002 1537 1 0.995842 0.49859 0.493157 1084 1 0.751238 0.684951 0.057661 1111 1 0.686711 0.75061 0.0671969 1115 1 0.815331 0.749606 0.0657126 1116 1 0.753793 0.805134 0.0645913 1206 1 0.68759 0.688848 0.12561 1210 1 0.809828 0.685595 0.121423 1238 1 0.691506 0.815457 0.122813 1241 1 0.750402 0.746865 0.126272 1242 1 0.816504 0.809113 0.130981 212 1 0.504838 0.31512 0.183909 637 1 0.878332 0.376708 0.498344 90 1 0.814058 0.310888 0.00203436 1088 1 0.875141 0.685287 0.0659761 1119 1 0.942222 0.751437 0.0601177 1120 1 0.875243 0.815143 0.0679469 1214 1 0.936526 0.689404 0.124881 1245 1 0.876961 0.75139 0.124961 1246 1 0.937681 0.812435 0.125173 407 1 0.690365 0.00416773 0.43904 149 1 0.627509 0.999859 0.125985 1139 1 0.555724 0.876777 0.0587742 1144 1 0.626344 0.934276 0.0630045 1266 1 0.565858 0.934227 0.123201 1269 1 0.625854 0.873164 0.127484 420 1 0.997661 0.189904 0.438993 177 1 0.499892 0.124136 0.121665 50 1 0.558885 0.188503 -0.00183613 1532 1 0.749237 0.942934 0.438125 468 1 0.503894 0.316023 0.435197 1412 1 0.995999 0.562911 0.435046 27 1 0.805684 0.0020473 0.0579308 1143 1 0.6862 0.873127 0.0624444 1147 1 0.811813 0.87246 0.0636943 1148 1 0.748896 0.936742 0.0598553 1270 1 0.689207 0.937451 0.124815 1273 1 0.75261 0.876919 0.124818 1274 1 0.816338 0.93598 0.124011 62 1 0.929887 0.184326 0.00225384 436 1 0.498285 0.190925 0.440001 1089 1 1.0043 0.750887 0.00110582 225 1 0.998286 0.373808 0.124073 1151 1 0.939448 0.877288 0.0647018 1152 1 0.874055 0.938479 0.0574861 1277 1 0.877001 0.876588 0.130924 1278 1 0.939212 0.937828 0.123423 1531 1 0.811773 0.872399 0.442003 1530 1 0.815692 0.935998 0.370798 152 1 0.626527 0.0646744 0.185552 179 1 0.562604 0.127133 0.184483 274 1 0.55994 0.0607368 0.24737 280 1 0.624229 0.0641817 0.315419 307 1 0.558075 0.124656 0.31255 309 1 0.619585 0.125554 0.248222 277 1 0.623903 0.00155706 0.251003 147 1 0.566657 -0.00708448 0.18413 156 1 0.747393 0.0650819 0.187682 183 1 0.681318 0.125598 0.189112 187 1 0.812724 0.12481 0.187469 278 1 0.681987 0.0578485 0.25069 282 1 0.810175 0.0570482 0.244455 284 1 0.743005 0.064281 0.313457 311 1 0.683918 0.121742 0.31048 313 1 0.746081 0.125577 0.25012 315 1 0.813855 0.124746 0.312645 281 1 0.743419 -0.00163245 0.249864 283 1 0.811966 0.00988793 0.31442 151 1 0.686569 0.994615 0.187699 1529 1 0.752064 0.885585 0.378473 160 1 0.873094 0.0583237 0.183269 191 1 0.940276 0.120001 0.188919 286 1 0.935403 0.0609867 0.250638 288 1 0.871732 0.0636187 0.314754 317 1 0.878297 0.117543 0.247656 319 1 0.94055 0.124761 0.312327 285 1 0.875682 1.00398 0.250372 159 1 0.936573 0.998677 0.188263 1527 1 0.687548 0.8803 0.439749 184 1 0.623357 0.19094 0.190932 211 1 0.557477 0.254581 0.191985 216 1 0.62441 0.313523 0.192085 306 1 0.562656 0.192125 0.250491 312 1 0.617915 0.189762 0.310203 338 1 0.567204 0.313978 0.25679 339 1 0.562825 0.252283 0.31273 341 1 0.626044 0.251465 0.25013 344 1 0.634351 0.313854 0.310816 1526 1 0.683496 0.943375 0.37458 209 1 0.495059 0.245963 0.124139 188 1 0.749056 0.188543 0.18898 215 1 0.68662 0.250302 0.193292 219 1 0.813533 0.249404 0.187642 220 1 0.754578 0.314291 0.189746 310 1 0.687238 0.185585 0.255127 314 1 0.811393 0.186446 0.249862 316 1 0.750716 0.191159 0.313574 342 1 0.695194 0.3167 0.247933 343 1 0.687677 0.249811 0.314641 345 1 0.749955 0.24828 0.247321 346 1 0.816086 0.314364 0.24951 347 1 0.813691 0.252189 0.309905 348 1 0.750108 0.312268 0.310734 1566 1 0.937206 0.5645 0.497417 192 1 0.872576 0.184583 0.185538 223 1 0.930222 0.247659 0.184436 224 1 0.873957 0.315106 0.18587 318 1 0.93404 0.184579 0.246518 320 1 0.872808 0.18723 0.312327 349 1 0.871422 0.245333 0.246785 350 1 0.932937 0.307128 0.249369 351 1 0.932197 0.249593 0.310561 352 1 0.873114 0.312677 0.313165 500 1 0.49818 0.438073 0.433481 405 1 0.618308 1.00107 0.376128 403 1 0.56116 1.00065 0.436654 243 1 0.565488 0.370796 0.194017 248 1 0.623906 0.435321 0.194627 370 1 0.561381 0.442843 0.250657 371 1 0.562229 0.376432 0.314919 373 1 0.630369 0.376981 0.253648 376 1 0.627152 0.440744 0.312374 1299 1 0.56074 0.503584 0.309368 1301 1 0.627739 0.500863 0.249164 1525 1 0.626846 0.875706 0.374005 247 1 0.687605 0.378971 0.188348 251 1 0.816702 0.374796 0.191324 252 1 0.751907 0.438688 0.190764 374 1 0.687907 0.441711 0.247966 375 1 0.691284 0.377807 0.31381 377 1 0.756052 0.373455 0.250226 378 1 0.812192 0.435866 0.254067 379 1 0.811052 0.379165 0.311514 380 1 0.746239 0.439716 0.309231 1303 1 0.687375 0.502855 0.310039 255 1 0.938987 0.372358 0.186859 256 1 0.874585 0.434938 0.190311 381 1 0.876132 0.373183 0.24982 382 1 0.939547 0.435715 0.249803 383 1 0.940315 0.374917 0.309483 384 1 0.877112 0.432247 0.313713 1528 1 0.626326 0.941703 0.437469 1171 1 0.560198 0.503369 0.190573 1176 1 0.629624 0.569354 0.183701 1203 1 0.564167 0.625842 0.187202 1298 1 0.565303 0.566679 0.248547 1304 1 0.625224 0.560892 0.312594 1331 1 0.563836 0.624798 0.308937 1333 1 0.6295 0.621272 0.251887 1307 1 0.813554 0.494678 0.315562 1175 1 0.690326 0.500886 0.184464 1179 1 0.818176 0.502332 0.187223 1305 1 0.754885 0.503189 0.250601 1180 1 0.747396 0.559749 0.178471 1207 1 0.690935 0.625492 0.187462 1211 1 0.80858 0.627457 0.186713 1302 1 0.689262 0.556031 0.247502 1306 1 0.809424 0.563652 0.252903 1308 1 0.746103 0.561675 0.307773 1335 1 0.687871 0.6278 0.316868 1337 1 0.748447 0.624246 0.250279 1339 1 0.811867 0.624245 0.313207 1183 1 0.942947 0.497219 0.190815 1311 1 0.935515 0.499938 0.313956 1309 1 0.872336 0.499664 0.255478 1184 1 0.878004 0.558334 0.18806 1215 1 0.932909 0.623217 0.19029 1310 1 0.936606 0.559162 0.250335 1312 1 0.874764 0.565642 0.31578 1341 1 0.866591 0.620323 0.248564 1343 1 0.932963 0.626077 0.316859 1522 1 0.5613 0.933637 0.37552 1523 1 0.56598 0.878902 0.439201 530 1 0.558157 0.0635147 0.497017 1208 1 0.62729 0.683205 0.182406 1235 1 0.563978 0.753216 0.185366 1240 1 0.626695 0.814612 0.188029 1330 1 0.564838 0.687784 0.249435 1336 1 0.626283 0.689862 0.311601 1362 1 0.560157 0.809616 0.247972 1363 1 0.568586 0.752848 0.316687 1365 1 0.627499 0.748197 0.249301 1368 1 0.630481 0.815408 0.31868 25 1 0.743762 0.00530171 -0.00434486 1332 1 0.504929 0.694435 0.307064 1472 1 0.874234 0.693798 0.438284 1212 1 0.752717 0.688854 0.184415 1239 1 0.689571 0.757897 0.191435 1243 1 0.814315 0.750896 0.192066 1244 1 0.747304 0.814934 0.191123 1334 1 0.688464 0.68811 0.243511 1338 1 0.813803 0.686647 0.252243 1340 1 0.753326 0.692242 0.314621 1366 1 0.689818 0.818837 0.255166 1367 1 0.688748 0.752748 0.315006 1369 1 0.752134 0.750355 0.256118 1370 1 0.808156 0.814049 0.252722 1371 1 0.812666 0.753459 0.318654 1372 1 0.749297 0.813962 0.31357 1503 1 0.93913 0.750093 0.44067 1216 1 0.870858 0.688393 0.191009 1247 1 0.932469 0.751796 0.193049 1248 1 0.876798 0.813966 0.188085 1342 1 0.932146 0.689624 0.248402 1344 1 0.874926 0.688589 0.31051 1373 1 0.87476 0.753937 0.25347 1374 1 0.940045 0.818557 0.251944 1375 1 0.940855 0.750224 0.315017 1376 1 0.877197 0.814635 0.315132 1621 1 0.625842 0.754317 0.502859 257 1 1.00056 1.00335 0.251495 1501 1 0.87711 0.751429 0.374278 275 1 0.562135 0.00157285 0.316362 1267 1 0.558077 0.875087 0.192856 1272 1 0.627612 0.935189 0.191423 1394 1 0.562675 0.937239 0.245528 1395 1 0.562815 0.877199 0.312535 1397 1 0.625178 0.871771 0.252176 1400 1 0.621324 0.93477 0.311059 1504 1 0.877075 0.807644 0.437581 279 1 0.685421 0.99602 0.313104 155 1 0.810611 0.999327 0.186718 1271 1 0.688447 0.872861 0.189733 1275 1 0.813736 0.874178 0.186308 1276 1 0.745509 0.936299 0.194416 1398 1 0.68642 0.936438 0.254259 1399 1 0.689264 0.877546 0.314222 1401 1 0.749206 0.879059 0.251246 1402 1 0.807056 0.936569 0.253101 1403 1 0.811045 0.873497 0.315128 1404 1 0.751885 0.943789 0.316185 287 1 0.938713 0.000483162 0.308656 1279 1 0.938701 0.873123 0.190021 1280 1 0.872766 0.941256 0.189545 1405 1 0.874899 0.874592 0.245922 1406 1 0.929566 0.937995 0.250949 1407 1 0.933783 0.879961 0.314496 1408 1 0.877066 0.941669 0.314366 1380 1 0.998659 0.941054 0.312307 402 1 0.558265 0.060602 0.375813 408 1 0.620313 0.0682182 0.437008 435 1 0.555667 0.127692 0.435529 437 1 0.622625 0.130653 0.377408 1316 1 0.997946 0.689577 0.318756 1042 1 0.56249 0.564875 -0.00282372 1041 1 0.501524 0.497927 -0.00452964 452 1 1.0021 0.307144 0.438702 1470 1 0.937341 0.689029 0.382574 409 1 0.753021 -0.00092366 0.37568 411 1 0.814901 1.00091 0.435851 406 1 0.683113 0.0623334 0.375204 410 1 0.809491 0.0651039 0.377121 412 1 0.749293 0.061342 0.438738 439 1 0.679536 0.126744 0.442413 441 1 0.746317 0.124035 0.379538 443 1 0.806858 0.127981 0.44535 1172 1 0.50147 0.563695 0.184205 1494 1 0.687964 0.816248 0.380681 1462 1 0.691297 0.690319 0.379678 415 1 0.93017 0.00799177 0.437365 1466 1 0.810122 0.684164 0.380375 1495 1 0.690644 0.756526 0.445918 413 1 0.870813 0.00453861 0.373829 414 1 0.93683 0.0685827 0.375239 416 1 0.873511 0.066177 0.437316 445 1 0.872332 0.127983 0.373344 447 1 0.933267 0.131241 0.439119 601 1 0.751013 0.250811 0.50185 1653 1 0.623233 0.879187 0.504394 472 1 0.630641 0.318209 0.434524 469 1 0.630933 0.246899 0.37193 467 1 0.568244 0.256945 0.436316 434 1 0.564443 0.189482 0.376455 440 1 0.61976 0.189431 0.441288 466 1 0.563533 0.311114 0.371584 1044 1 0.499505 0.561926 0.0637179 442 1 0.805569 0.182486 0.381608 438 1 0.69162 0.183468 0.374521 471 1 0.685088 0.247099 0.440329 473 1 0.751998 0.247862 0.375144 474 1 0.812794 0.316446 0.373299 444 1 0.745523 0.190573 0.440185 475 1 0.80826 0.253556 0.43643 476 1 0.750052 0.315558 0.438847 470 1 0.691867 0.312157 0.374491 1468 1 0.748035 0.68663 0.445906 1499 1 0.811555 0.752183 0.438162 1565 1 0.876794 0.499229 0.499817 1502 1 0.936755 0.812917 0.377779 1498 1 0.812308 0.812212 0.37293 1108 1 0.503369 0.80935 0.0639841 1458 1 0.565434 0.687178 0.370264 566 1 0.681689 0.186346 0.503035 479 1 0.937811 0.248827 0.439996 480 1 0.874524 0.311738 0.441792 478 1 0.935466 0.307722 0.38129 477 1 0.873857 0.248389 0.375406 446 1 0.933488 0.187279 0.377199 448 1 0.868713 0.189084 0.438119 164 1 0.995929 0.181515 0.188601 1490 1 0.563986 0.817228 0.377347 1073 1 0.498721 0.626729 -0.00120564 499 1 0.56465 0.378642 0.435035 504 1 0.628946 0.443282 0.436079 501 1 0.62468 0.373385 0.367899 498 1 0.559649 0.443346 0.374542 1427 1 0.561905 0.505425 0.434401 1429 1 0.624059 0.50078 0.372679 1464 1 0.625624 0.689332 0.436164 508 1 0.747801 0.441489 0.438185 507 1 0.812376 0.377122 0.440751 506 1 0.810007 0.434113 0.378169 505 1 0.751756 0.376641 0.37226 503 1 0.689509 0.377169 0.436528 502 1 0.693328 0.440835 0.374794 1433 1 0.751441 0.501759 0.368061 1435 1 0.810674 0.50166 0.436403 1496 1 0.626953 0.814239 0.440216 1493 1 0.628667 0.75222 0.382282 58 1 0.815506 0.185342 0.00289469 512 1 0.872972 0.441895 0.432139 511 1 0.937802 0.370963 0.43853 510 1 0.937571 0.435915 0.378947 509 1 0.87491 0.370873 0.375597 1439 1 0.935458 0.500094 0.434809 196 1 0.994652 0.306055 0.186161 1426 1 0.567772 0.568696 0.374452 1432 1 0.625505 0.563538 0.438437 1459 1 0.564636 0.631296 0.433894 1461 1 0.626579 0.624993 0.37657 1491 1 0.559137 0.746751 0.438681 1500 1 0.749717 0.818052 0.439105 1431 1 0.691916 0.501164 0.442349 1463 1 0.68841 0.62397 0.439778 1436 1 0.751012 0.564175 0.435274 1434 1 0.810591 0.562142 0.374977 1430 1 0.688389 0.55918 0.375962 1467 1 0.806719 0.626823 0.441497 1465 1 0.749899 0.627537 0.374793 1497 1 0.746086 0.755554 0.373734 1233 1 0.503187 0.755399 0.126017 1437 1 0.875349 0.50203 0.374693 1438 1 0.934309 0.560364 0.37365 1440 1 0.871699 0.560766 0.436652 1469 1 0.870525 0.620823 0.378926 1471 1 0.938264 0.627157 0.434858 1524 1 0.496185 0.940243 0.439518 1633 1 1.00172 0.878616 0.504525 61 1 0.871642 0.119607 0.0011204 308 1 0.499633 0.188804 0.313705 145 1 0.504333 0.994294 0.123138 117 1 0.62515 0.376624 -0.000608342 1145 1 0.74768 0.871998 0.00237672 638 1 0.939468 0.435891 0.492934 1593 1 0.747953 0.625482 0.502839 602 1 0.812945 0.310314 0.496508 1521 1 0.49993 0.87722 0.369943 1618 1 0.562803 0.817464 0.500522 630 1 0.687523 0.438248 0.500669 1113 1 0.753883 0.744308 -0.00149954 1185 1 0.994837 0.621112 0.129289 52 1 0.504674 0.185094 0.0658266 1081 1 0.745937 0.623211 -0.00339365 1045 1 0.620626 0.501386 0.00174516 1489 1 0.501104 0.750688 0.369697 1076 1 0.504736 0.684138 0.0665576 1444 1 0.996142 0.690878 0.436632 193 1 1.00331 0.238795 0.130464 305 1 0.499736 0.12483 0.249097 1284 1 0.998863 0.561875 0.317813 68 1 0.997609 0.315429 0.0636683 1201 1 0.502786 0.622181 0.123368 1217 1 0.999789 0.756978 0.133099 356 1 0.999547 0.439591 0.311844 634 1 0.81745 0.438837 0.498112 565 1 0.616012 0.126036 0.500062 1313 1 0.994137 0.625911 0.250877 1562 1 0.807679 0.559778 0.501099 1300 1 0.498344 0.566131 0.308456 1220 1 1.00136 0.82078 0.189322 1204 1 0.501695 0.686336 0.181146 1409 1 0.999563 0.501652 0.380515 321 1 0.993202 0.245019 0.249001 324 1 0.992403 0.309718 0.313357 273 1 0.500007 0.00198396 0.243554 369 1 0.498232 0.377285 0.25234 417 1 1.00032 0.129007 0.379843 1188 1 0.992419 0.691663 0.186962 241 1 0.502051 0.37949 0.127642 542 1 0.937185 0.0660915 0.500223 65 1 0.995246 0.243345 0.00801298 1597 1 0.876699 0.629893 0.495671 1558 1 0.690422 0.559202 0.499397 570 1 0.809431 0.191819 0.504315 114 1 0.566464 0.439002 0.000394092 541 1 0.871073 0.00384553 0.500574 86 1 0.68729 0.312034 0.00363204 122 1 0.812474 0.438638 -0.000130935 629 1 0.629611 0.378429 0.497702 626 1 0.559494 0.441416 0.494976 1086 1 0.935866 0.683333 0.00237814 1054 1 0.941694 0.558137 0.00338406 29 1 0.870304 0.00348507 0.000223778 93 1 0.875994 0.249718 0.0049311 534 1 0.681723 0.0633942 0.498693 57 1 0.751511 0.127965 0.00476684 593 1 0.505982 0.253682 0.497061 1077 1 0.625851 0.621929 -0.00332039 1662 1 0.935855 0.937067 0.499988 1085 1 0.873431 0.621288 0.00138137 54 1 0.68633 0.183964 0.00610228 1046 1 0.685568 0.559875 0.00519794 85 1 0.624662 0.248726 0.00791486 82 1 0.565603 0.31359 0.00707315 1050 1 0.80921 0.560008 0.00321695 94 1 0.940609 0.308038 0.00391409 536 1 0.625322 0.062472 0.558766 563 1 0.556949 0.125799 0.563134 658 1 0.556974 0.0651907 0.625805 693 1 0.623279 0.121473 0.626061 1716 1 0.502676 0.68355 0.687987 964 1 0.997863 0.313622 0.937494 612 1 0.99744 0.437776 0.563421 605 1 0.871862 0.248038 0.499288 540 1 0.749348 0.0676328 0.56802 567 1 0.682601 0.124021 0.560771 571 1 0.811639 0.130597 0.558475 662 1 0.686986 0.0596153 0.625566 666 1 0.812254 0.0704029 0.624109 697 1 0.745141 0.128796 0.626354 539 1 0.813371 0.00516001 0.565823 535 1 0.684509 0.00879617 0.558864 665 1 0.747587 -0.000768396 0.622979 573 1 0.869875 0.130677 0.5004 544 1 0.870994 0.0698446 0.559107 575 1 0.934832 0.12301 0.563343 670 1 0.941061 0.058981 0.620028 701 1 0.877958 0.129353 0.622136 865 1 0.998904 0.37032 0.746496 2017 1 1.00193 0.872715 0.870714 568 1 0.62191 0.186143 0.559143 595 1 0.559993 0.246587 0.558802 600 1 0.624292 0.315724 0.560503 690 1 0.561991 0.190172 0.618902 722 1 0.5643 0.312528 0.619067 725 1 0.624324 0.252563 0.621387 1630 1 0.934644 0.814651 0.501791 708 1 0.995448 0.310251 0.685878 916 1 0.501195 0.0620524 0.937784 1556 1 0.50485 0.560217 0.554625 572 1 0.745244 0.185298 0.560453 599 1 0.687589 0.251222 0.560771 603 1 0.808188 0.249005 0.562985 604 1 0.75041 0.320739 0.56141 694 1 0.68279 0.183606 0.621421 698 1 0.810656 0.189816 0.624987 726 1 0.692483 0.310118 0.623854 729 1 0.747327 0.247687 0.621291 730 1 0.811239 0.31678 0.620938 594 1 0.564511 0.319748 0.494181 1009 1 0.500801 0.372506 0.874704 576 1 0.87617 0.189442 0.564486 607 1 0.938401 0.255454 0.562257 608 1 0.87255 0.311964 0.563538 702 1 0.934881 0.194001 0.622701 733 1 0.872414 0.250092 0.626786 734 1 0.940491 0.311363 0.623376 657 1 0.501465 -8.35426e-06 0.62827 1626 1 0.810919 0.810424 0.504714 1748 1 0.498836 0.808089 0.684966 627 1 0.560569 0.377551 0.557422 632 1 0.621339 0.43656 0.559066 754 1 0.566227 0.435943 0.623454 757 1 0.62872 0.375508 0.624749 1685 1 0.627772 0.499044 0.618845 948 1 0.502606 0.188208 0.941444 631 1 0.68434 0.379782 0.564112 635 1 0.815663 0.377107 0.556827 636 1 0.753588 0.439804 0.562911 758 1 0.689017 0.444568 0.617908 761 1 0.747615 0.380071 0.623627 762 1 0.816019 0.436476 0.619469 1563 1 0.813404 0.50218 0.558655 1940 1 0.500806 0.558225 0.938726 639 1 0.932937 0.374114 0.565059 640 1 0.878583 0.433338 0.56324 765 1 0.875328 0.375627 0.626322 766 1 0.938332 0.435913 0.625389 1969 1 0.499989 0.626589 0.873156 1812 1 0.501469 0.563651 0.811574 996 1 0.997996 0.43519 0.93533 1555 1 0.564437 0.50315 0.56559 1560 1 0.627349 0.564549 0.564105 1587 1 0.563104 0.628817 0.559946 1682 1 0.564776 0.566266 0.62483 1717 1 0.626337 0.624624 0.624624 2048 1 0.871762 0.938841 0.939904 1078 1 0.683879 0.690427 1.00457 2047 1 0.944842 0.880436 0.933027 1697 1 1.00031 0.623375 0.626068 1559 1 0.689595 0.505491 0.56136 1689 1 0.748269 0.500969 0.622262 1564 1 0.746978 0.563856 0.565633 1591 1 0.686047 0.624792 0.563861 1595 1 0.814867 0.62293 0.557879 1686 1 0.688904 0.566735 0.628971 1690 1 0.817024 0.559547 0.624429 1721 1 0.756174 0.624915 0.628337 1109 1 0.622291 0.751406 1.00274 897 1 0.999246 -0.000199348 0.87137 1636 1 0.99962 0.945255 0.564407 1567 1 0.938298 0.497593 0.555053 1693 1 0.87871 0.499384 0.620143 1568 1 0.878825 0.565272 0.557921 1599 1 0.93702 0.624369 0.558547 1694 1 0.938108 0.560984 0.623898 1725 1 0.878455 0.620249 0.622291 538 1 0.806525 0.0659754 0.498967 801 1 1.00328 0.118854 0.747926 2046 1 0.938885 0.936418 0.872195 1592 1 0.627181 0.687899 0.564434 1619 1 0.56711 0.748129 0.563199 1624 1 0.620577 0.812764 0.564626 1714 1 0.558512 0.686243 0.622796 1746 1 0.558114 0.817806 0.624538 1749 1 0.622949 0.752937 0.623957 1985 1 0.995786 0.750227 0.871195 932 1 0.999549 0.187425 0.938107 1596 1 0.752931 0.68556 0.565132 1623 1 0.692979 0.744269 0.568313 1627 1 0.811505 0.752953 0.569103 1628 1 0.750011 0.811748 0.562083 1718 1 0.685374 0.683351 0.631438 1722 1 0.811315 0.684821 0.62996 1750 1 0.684378 0.812834 0.624209 1753 1 0.748827 0.748821 0.631811 1754 1 0.811281 0.813537 0.620341 769 1 0.999109 1.00139 0.749438 2045 1 0.875785 0.876496 0.875492 1600 1 0.876891 0.685602 0.567467 1631 1 0.940018 0.754874 0.564231 1632 1 0.879106 0.814098 0.56508 1726 1 0.940999 0.687491 0.623961 1757 1 0.883496 0.749336 0.626381 1758 1 0.939541 0.812969 0.629241 692 1 0.500266 0.186378 0.688749 1629 1 0.874021 0.750915 0.506283 661 1 0.622158 0.00449964 0.619363 531 1 0.560233 1.00567 0.56513 1651 1 0.559258 0.879336 0.562622 1656 1 0.62419 0.942147 0.560284 1778 1 0.565557 0.938511 0.624277 1781 1 0.623855 0.874624 0.626736 1665 1 1.00748 0.498998 0.620336 1655 1 0.684187 0.875369 0.564893 1659 1 0.814426 0.871892 0.56137 1660 1 0.742218 0.940053 0.565675 1782 1 0.685652 0.941839 0.623132 1785 1 0.747062 0.869051 0.623618 1786 1 0.80971 0.930268 0.624084 1876 1 0.496342 0.816999 0.810411 543 1 0.932523 1.00281 0.557369 1908 1 0.499746 0.941596 0.811795 705 1 1.00212 0.251947 0.622211 669 1 0.871775 0.00361138 0.623722 1663 1 0.939148 0.874875 0.561579 1664 1 0.875997 0.93799 0.568577 1789 1 0.872542 0.874506 0.626179 1790 1 0.939192 0.932791 0.630551 1681 1 0.503629 0.497027 0.62483 1780 1 0.498765 0.934745 0.679071 804 1 0.997422 0.184158 0.813409 664 1 0.627271 0.0601409 0.685426 691 1 0.565941 0.128575 0.690841 786 1 0.559622 0.0658013 0.748491 792 1 0.627584 0.064903 0.813809 819 1 0.560589 0.125 0.808166 821 1 0.620769 0.130373 0.75405 1589 1 0.623839 0.626579 0.501788 1121 1 0.998939 0.875463 0.999492 533 1 0.618971 0.00292298 0.497034 668 1 0.742139 0.0584481 0.687584 695 1 0.682224 0.12257 0.694772 699 1 0.81052 0.121399 0.693913 790 1 0.689454 0.0626318 0.752552 794 1 0.811836 0.0634171 0.755254 796 1 0.747585 0.0624971 0.819465 823 1 0.688556 0.127147 0.816757 825 1 0.749392 0.122334 0.752643 827 1 0.811429 0.127344 0.813882 667 1 0.812364 1.00063 0.685275 795 1 0.816004 0.999431 0.818825 663 1 0.682667 0.99898 0.689761 2044 1 0.746812 0.941721 0.937823 672 1 0.871814 0.0624039 0.689467 703 1 0.936911 0.12361 0.68494 798 1 0.934803 0.0630345 0.752354 800 1 0.874098 0.0629309 0.807341 829 1 0.874331 0.127244 0.749442 831 1 0.934905 0.123984 0.809759 797 1 0.87674 -0.00247329 0.744326 799 1 0.936047 1.00162 0.813415 671 1 0.939969 0.999533 0.681244 2043 1 0.806757 0.876815 0.940463 562 1 0.56055 0.190649 0.499631 1905 1 0.503122 0.872178 0.74862 696 1 0.61906 0.189812 0.686182 723 1 0.563554 0.251978 0.683638 728 1 0.623487 0.311416 0.687015 818 1 0.565543 0.190244 0.753721 824 1 0.624495 0.186816 0.81336 850 1 0.563858 0.31271 0.748633 851 1 0.562415 0.251142 0.814918 853 1 0.624037 0.250433 0.747587 856 1 0.627397 0.314262 0.8071 1106 1 0.557646 0.816034 1.00007 537 1 0.747764 0.00397396 0.507671 881 1 0.501367 0.378589 0.752078 700 1 0.748854 0.181919 0.691497 727 1 0.688633 0.249179 0.684047 731 1 0.812315 0.245172 0.68564 732 1 0.750013 0.311632 0.688534 822 1 0.682909 0.18638 0.750714 826 1 0.812937 0.187746 0.74981 828 1 0.747349 0.189095 0.814274 854 1 0.684612 0.310711 0.747626 855 1 0.682596 0.254286 0.812538 857 1 0.743739 0.248992 0.752974 858 1 0.812493 0.312174 0.754229 859 1 0.813311 0.247397 0.815295 860 1 0.751907 0.30934 0.818567 2042 1 0.809775 0.931431 0.878068 704 1 0.875345 0.183001 0.685343 735 1 0.935888 0.249331 0.689062 736 1 0.874943 0.312578 0.686174 830 1 0.938798 0.184145 0.748192 832 1 0.877421 0.189836 0.810633 861 1 0.873203 0.251209 0.751017 862 1 0.933223 0.311169 0.753581 863 1 0.937261 0.246006 0.818539 864 1 0.875986 0.311697 0.817803 2041 1 0.753224 0.87313 0.880036 755 1 0.568413 0.377973 0.682617 760 1 0.630767 0.439139 0.679265 882 1 0.570177 0.437219 0.744051 883 1 0.570915 0.375776 0.808601 885 1 0.63012 0.375877 0.742863 888 1 0.633499 0.435155 0.809437 1683 1 0.558615 0.499968 0.687144 1813 1 0.621802 0.498097 0.74813 2039 1 0.693006 0.877149 0.937045 759 1 0.693425 0.370259 0.690498 763 1 0.812873 0.371135 0.683095 764 1 0.756854 0.437174 0.688998 886 1 0.692636 0.438108 0.749422 887 1 0.689366 0.368 0.809596 889 1 0.757108 0.376778 0.75229 890 1 0.816451 0.438146 0.758123 891 1 0.816428 0.374932 0.814084 892 1 0.749291 0.438011 0.815293 1691 1 0.817056 0.500862 0.685414 1687 1 0.693493 0.496023 0.684844 1815 1 0.688592 0.501278 0.806312 1601 1 0.998189 0.754268 0.502528 767 1 0.933847 0.369134 0.68879 768 1 0.871057 0.436601 0.688753 893 1 0.870529 0.378615 0.753002 894 1 0.943409 0.436824 0.743745 895 1 0.937449 0.373579 0.80945 896 1 0.874899 0.441281 0.81802 1823 1 0.942449 0.494705 0.81412 1695 1 0.938484 0.498794 0.68575 2038 1 0.691888 0.937276 0.873613 1811 1 0.559121 0.50428 0.817591 1688 1 0.62612 0.560816 0.694434 1715 1 0.564187 0.622806 0.687051 1810 1 0.562691 0.560746 0.7513 1816 1 0.627087 0.560966 0.810439 1843 1 0.559977 0.621766 0.814617 1845 1 0.623712 0.623612 0.751228 1729 1 1.00013 0.747548 0.630251 1819 1 0.81315 0.49982 0.818719 1817 1 0.758853 0.494661 0.754225 1692 1 0.752753 0.559629 0.688283 1719 1 0.687413 0.622474 0.688208 1723 1 0.813085 0.621628 0.688465 1814 1 0.692384 0.557774 0.747116 1818 1 0.812081 0.559051 0.752692 1820 1 0.753566 0.56161 0.815999 1847 1 0.685996 0.624265 0.814222 1849 1 0.751825 0.622149 0.751699 1851 1 0.806525 0.629769 0.814625 980 1 0.505173 0.309955 0.938578 1821 1 0.877986 0.496722 0.755167 1696 1 0.878416 0.561154 0.691421 1727 1 0.943979 0.623766 0.690566 1822 1 0.938179 0.557336 0.749561 1824 1 0.875555 0.557864 0.813673 1853 1 0.878844 0.620584 0.753113 1855 1 0.940516 0.621467 0.812577 1970 1 0.562234 0.683599 0.874746 2003 1 0.565206 0.751521 0.931953 919 1 0.684777 -0.000733749 0.937477 915 1 0.56012 0.00314353 0.938457 1720 1 0.620777 0.687804 0.685316 1747 1 0.560711 0.750954 0.685767 1752 1 0.623764 0.80684 0.686901 1842 1 0.564344 0.684536 0.75137 1848 1 0.620227 0.695391 0.818099 1874 1 0.562116 0.809047 0.747475 1875 1 0.557328 0.751046 0.808235 1877 1 0.626192 0.749637 0.750225 1880 1 0.621461 0.814826 0.807445 1657 1 0.748273 0.877904 0.506938 1724 1 0.74805 0.683513 0.69098 1751 1 0.687248 0.747585 0.685905 1755 1 0.809384 0.748575 0.687537 1756 1 0.750784 0.810564 0.684731 1846 1 0.680453 0.684082 0.747696 1850 1 0.810418 0.68499 0.752482 1852 1 0.74561 0.689966 0.80796 1878 1 0.689452 0.808681 0.751353 1879 1 0.686631 0.754991 0.816165 1881 1 0.748396 0.747956 0.751364 1882 1 0.811778 0.807653 0.749222 1883 1 0.807825 0.74864 0.815081 1884 1 0.750378 0.810323 0.814202 1873 1 0.497291 0.750275 0.748411 1728 1 0.876274 0.684836 0.688409 1759 1 0.940906 0.749516 0.687253 1760 1 0.872447 0.815215 0.685213 1854 1 0.939587 0.689197 0.7534 1856 1 0.873771 0.683549 0.818779 1885 1 0.875026 0.748425 0.744299 1886 1 0.93935 0.808856 0.749772 1887 1 0.940536 0.750408 0.805916 1888 1 0.875129 0.805023 0.810404 2035 1 0.556951 0.875988 0.935812 2005 1 0.625805 0.757625 0.872902 2034 1 0.559633 0.939547 0.881616 849 1 0.505127 0.250352 0.750096 787 1 0.558821 0.00642062 0.813555 789 1 0.622831 1.00284 0.751289 659 1 0.562421 0.00203701 0.68384 1779 1 0.561884 0.873383 0.688255 1784 1 0.622887 0.941366 0.686612 1906 1 0.55966 0.940337 0.744563 1907 1 0.565816 0.875564 0.817619 1909 1 0.622652 0.876514 0.748345 1912 1 0.617159 0.944797 0.813923 597 1 0.62102 0.252387 0.500119 791 1 0.688918 0.000783335 0.812899 793 1 0.750694 0.997785 0.747805 1783 1 0.686848 0.871823 0.684479 1787 1 0.811307 0.874835 0.685088 1788 1 0.748542 0.938221 0.682997 1910 1 0.691385 0.936201 0.755806 1911 1 0.688208 0.866743 0.81146 1913 1 0.751226 0.877366 0.749807 1914 1 0.811462 0.937178 0.748253 1915 1 0.812733 0.869273 0.814524 1916 1 0.757647 0.936847 0.811652 676 1 0.999854 0.182777 0.685994 1791 1 0.936226 0.870022 0.688916 1792 1 0.874802 0.940387 0.685478 1917 1 0.870605 0.870524 0.748474 1918 1 0.933182 0.937886 0.750115 1919 1 0.936879 0.874111 0.810951 1920 1 0.871283 0.933245 0.813103 2037 1 0.628068 0.879637 0.873067 569 1 0.743699 0.122476 0.501843 2040 1 0.621598 0.93978 0.937904 914 1 0.560943 0.0674181 0.878163 920 1 0.625091 0.0611309 0.939245 947 1 0.568297 0.128436 0.942293 949 1 0.622393 0.128463 0.877283 2002 1 0.563369 0.814542 0.875334 1604 1 0.99996 0.813945 0.563422 923 1 0.805848 0.0017076 0.938255 921 1 0.744716 1.00342 0.877845 918 1 0.684697 0.0644241 0.878342 922 1 0.814268 0.0646317 0.874942 924 1 0.749963 0.0645557 0.938535 951 1 0.688286 0.12416 0.944795 953 1 0.74636 0.128287 0.875295 955 1 0.810841 0.12852 0.94104 2008 1 0.629585 0.814612 0.940006 925 1 0.870467 1.00266 0.877614 927 1 0.937247 0.00326639 0.93371 926 1 0.939468 0.0634824 0.87061 928 1 0.87102 0.0642136 0.936497 957 1 0.875367 0.120898 0.87383 959 1 0.934677 0.120527 0.936538 1978 1 0.809506 0.682327 0.879261 724 1 0.503809 0.318288 0.689616 2007 1 0.683377 0.744481 0.939626 2012 1 0.747433 0.80837 0.938459 917 1 0.624562 0.00574954 0.874169 2011 1 0.81626 0.745914 0.935858 1974 1 0.685672 0.686945 0.87286 1732 1 1.003 0.811539 0.690171 981 1 0.629624 0.252615 0.877941 984 1 0.626765 0.316597 0.939235 946 1 0.566239 0.186211 0.876354 952 1 0.627737 0.186192 0.941404 978 1 0.570169 0.317655 0.873013 979 1 0.567208 0.252272 0.940322 2009 1 0.745983 0.746627 0.877851 753 1 0.501764 0.375525 0.624536 986 1 0.813331 0.3068 0.875724 982 1 0.687458 0.312745 0.875132 987 1 0.810207 0.24842 0.939045 988 1 0.749635 0.31242 0.937339 983 1 0.68818 0.24945 0.950164 954 1 0.809998 0.186491 0.876473 985 1 0.748975 0.252041 0.875545 956 1 0.748851 0.183594 0.941937 950 1 0.68887 0.187529 0.878488 1949 1 0.87815 0.497724 0.880476 960 1 0.876985 0.187249 0.940719 991 1 0.936117 0.250267 0.941917 990 1 0.939163 0.316104 0.871925 992 1 0.877545 0.312238 0.940899 989 1 0.87271 0.247128 0.882044 958 1 0.936924 0.183863 0.878661 2006 1 0.688937 0.808202 0.877927 1980 1 0.744133 0.686892 0.938205 1141 1 0.626704 0.876756 1.0024 1016 1 0.62572 0.437293 0.937641 1013 1 0.631051 0.371723 0.87399 1011 1 0.562207 0.376738 0.938612 1010 1 0.56888 0.439529 0.872285 1941 1 0.625402 0.500207 0.875065 2010 1 0.814097 0.807761 0.876261 1982 1 0.940689 0.684629 0.88008 1020 1 0.748326 0.437711 0.937416 1019 1 0.810363 0.371185 0.935978 1018 1 0.814029 0.439091 0.875558 1017 1 0.750213 0.374236 0.873206 1014 1 0.689296 0.44098 0.875965 1015 1 0.688852 0.376123 0.937827 1943 1 0.686868 0.501243 0.937859 2015 1 0.937968 0.749522 0.939175 1984 1 0.877805 0.680759 0.938687 1761 1 1.00206 0.875274 0.629442 1024 1 0.87215 0.437322 0.938089 1023 1 0.934393 0.370703 0.941714 1022 1 0.942514 0.435539 0.874602 1021 1 0.8746 0.375117 0.877044 1951 1 0.941059 0.498927 0.936765 1950 1 0.940629 0.560551 0.872508 1796 1 1.00021 0.560498 0.814115 1976 1 0.624748 0.679174 0.934401 2013 1 0.878327 0.746568 0.876442 1625 1 0.750481 0.755356 0.501492 1939 1 0.563477 0.498332 0.939609 1938 1 0.560713 0.563156 0.87779 1944 1 0.627556 0.559827 0.942673 1971 1 0.563215 0.626392 0.937767 1973 1 0.62268 0.625045 0.87347 2016 1 0.872151 0.813186 0.938218 2014 1 0.938355 0.812786 0.876374 1947 1 0.81307 0.499735 0.939189 1945 1 0.747324 0.497183 0.873345 1979 1 0.810351 0.622731 0.940126 1942 1 0.68228 0.564514 0.872138 1946 1 0.815006 0.563061 0.877181 1948 1 0.747778 0.559284 0.941944 1975 1 0.685148 0.620222 0.937031 1977 1 0.751177 0.624491 0.874837 1983 1 0.938361 0.617133 0.936982 1981 1 0.879137 0.620079 0.874074 1952 1 0.874636 0.562907 0.93847 737 1 0.997941 0.373913 0.621445 1117 1 0.879044 0.744647 1.00546 1012 1 0.503286 0.436653 0.935444 884 1 0.505884 0.434705 0.816171 1118 1 0.93839 0.809876 0.997263 1588 1 0.499899 0.688481 0.563406 977 1 0.505543 0.25315 0.876481 833 1 0.998674 0.251342 0.750867 756 1 0.502317 0.436516 0.688344 1937 1 0.502036 0.499138 0.877494 1661 1 0.877441 0.878671 0.500302 1586 1 0.566439 0.688273 0.496768 1809 1 0.505914 0.493486 0.752876 2020 1 1.0002 0.940374 0.935096 836 1 1.00101 0.311922 0.811263 1554 1 0.564346 0.562004 0.498796 852 1 0.506821 0.310508 0.808788 1074 1 0.563563 0.687265 1.00346 1540 1 0.998003 0.558044 0.558027 673 1 1.00738 0.124951 0.623239 740 1 1.00124 0.43656 0.682158 548 1 0.998463 0.185125 0.564347 1654 1 0.689232 0.939878 0.499937 1658 1 0.808957 0.938682 0.507323 1585 1 0.504732 0.628264 0.496457 1082 1 0.814379 0.684687 1.00247 21 1 0.61988 0.000150999 1.00165 1110 1 0.690073 0.809348 1.00194 118 1 0.688528 0.438766 0.996812 1146 1 0.8104 0.939979 1.00041 1114 1 0.816671 0.81506 1.00052 113 1 0.4993 0.371679 0.998608 125 1 0.87007 0.371168 1.0022 1650 1 0.558143 0.937179 0.504975 1150 1 0.94005 0.938008 0.996478 1617 1 0.501506 0.753439 0.504246 606 1 0.935426 0.313179 0.50003 633 1 0.744173 0.381078 0.49725 1590 1 0.683331 0.692264 0.502539 1557 1 0.623861 0.500824 0.50135 26 1 0.808787 0.068226 1.00226 1622 1 0.685959 0.813626 0.507248 1594 1 0.815898 0.692924 0.504871 33 1 0.998463 0.122122 0.998915 574 1 0.935994 0.188305 0.502992 1598 1 0.93674 0.691651 0.503403 1138 1 0.561145 0.937173 0.995046 1142 1 0.684473 0.937888 1.00198
25b980a0be5f061c6bdc488b9c6e51969e8a81c7
ceb5b7c3882b2bf3f53219356e914462c680f059
/azure-mgmt-compute/azure/mgmt/compute/containerservice/v2017_01_31/models/container_service_client_enums.py
279f5dcb9d3ff37bd26b6e9a9c88b555f28c3dff
[ "MIT" ]
permissive
codalab/azure-sdk-for-python
b712da2a377cfa526e0ffa4fa40408e6a81e48e3
f4c92d02d46fcdee9da430a18a394b108a2f8920
refs/heads/master
2021-01-19T14:40:23.567035
2017-04-11T22:49:13
2017-04-11T22:49:13
88,180,409
1
0
null
2017-04-13T15:36:45
2017-04-13T15:36:44
null
UTF-8
Python
false
false
2,291
py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from enum import Enum class ContainerServiceOchestratorTypes(Enum): swarm = "Swarm" dcos = "DCOS" custom = "Custom" kubernetes = "Kubernetes" class ContainerServiceVMSizeTypes(Enum): standard_a0 = "Standard_A0" standard_a1 = "Standard_A1" standard_a2 = "Standard_A2" standard_a3 = "Standard_A3" standard_a4 = "Standard_A4" standard_a5 = "Standard_A5" standard_a6 = "Standard_A6" standard_a7 = "Standard_A7" standard_a8 = "Standard_A8" standard_a9 = "Standard_A9" standard_a10 = "Standard_A10" standard_a11 = "Standard_A11" standard_d1 = "Standard_D1" standard_d2 = "Standard_D2" standard_d3 = "Standard_D3" standard_d4 = "Standard_D4" standard_d11 = "Standard_D11" standard_d12 = "Standard_D12" standard_d13 = "Standard_D13" standard_d14 = "Standard_D14" standard_d1_v2 = "Standard_D1_v2" standard_d2_v2 = "Standard_D2_v2" standard_d3_v2 = "Standard_D3_v2" standard_d4_v2 = "Standard_D4_v2" standard_d5_v2 = "Standard_D5_v2" standard_d11_v2 = "Standard_D11_v2" standard_d12_v2 = "Standard_D12_v2" standard_d13_v2 = "Standard_D13_v2" standard_d14_v2 = "Standard_D14_v2" standard_g1 = "Standard_G1" standard_g2 = "Standard_G2" standard_g3 = "Standard_G3" standard_g4 = "Standard_G4" standard_g5 = "Standard_G5" standard_ds1 = "Standard_DS1" standard_ds2 = "Standard_DS2" standard_ds3 = "Standard_DS3" standard_ds4 = "Standard_DS4" standard_ds11 = "Standard_DS11" standard_ds12 = "Standard_DS12" standard_ds13 = "Standard_DS13" standard_ds14 = "Standard_DS14" standard_gs1 = "Standard_GS1" standard_gs2 = "Standard_GS2" standard_gs3 = "Standard_GS3" standard_gs4 = "Standard_GS4" standard_gs5 = "Standard_GS5"
3b30e4f81446dc8646720b7e1ef823a4cf0e1cba
e67822aa34c5d121978732b33a2bf85613b8fc41
/chapter4/problem5.py
2867d2e1eef48d0f06bdb66e7338affb6a062460
[]
no_license
Kwon1995-2/BC_Python
c3a6cb450fbe728d368a840c03c0817e8dcc46fa
d3df813498a72367dc8f6a4f9efbbbca072de700
refs/heads/master
2023-03-18T21:39:45.621360
2021-03-20T13:50:39
2021-03-20T13:50:39
298,744,227
0
0
null
null
null
null
UTF-8
Python
false
false
295
py
""" 크기가 같은 두개의 리스트 L, M을 생성하고 두 리스트의 각 요소 합으로 구성되는 새로운 리스트를 생성하라 L=[1,2,3] M=[4,5,6] => [5, 7, 9]""" L = [1,2,3] M = [4, 5, 6] LM = [] for i in range(0,len(L)): LM.insert(i, L[i]+M[i]) print(LM)
47cb81c305f5950abd06d4b86fb817c6ec52f5fa
1d9ad7aa473191dad19a64b8a72a4677db221e93
/main.py
62666cef8f1456cdbb69389b0e988ba4da7db633
[]
no_license
ethicalhacker7217/PyStudio
1884329209ec487f95300ee30521a51761d5bc3c
176756fa396d3156803b400ffac2c5ac658a27cc
refs/heads/main
2023-04-25T07:00:09.446229
2021-05-15T05:20:09
2021-05-15T05:20:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,752
py
from tkinter import * from tkinter.filedialog import asksaveasfile,askopenfilename import subprocess compiler = Tk() compiler.title('PyStudio') File_path = '' def set_file_path(path): global File_path() File_path = path def run(): if File_path == '': save_prompt = Toplevel() text = Label(save_prompt, text='Please save your code') text.pack() command = f'python{File_path}' process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True ) output, error = process.communicate() code_output.insert('1.0', output) code_output.insert('1.0', error) def Save_as(): if File_path == '': path = asksaveasfile(filetypes=['Python Files','*.py']) else: path = File_path with open(path,'w') as file: code = editor.get('1.0',END) file.write(code) set_file_path(path) def Open(): path = askopenfilename(filetypes=['Python Files','*.py']) with open(path,'r') as file: code = editor.get('1.0',END) file.read() editor.delete('1.0',END) editor.insert('1.0', code) set_file_path(path) menu_bar = Menu(compiler) file_menu = Menu(menu_bar, tearoff=0) file_menu.add_command(label='Open', command=Open) file_menu.add_command(label='Save', command=Save_as) file_menu.add_command(label='Save As', command=Save_as) file_menu.add_command(label='Exit', command=exit) menu_bar.add_cascade(label = 'File', menu=file_menu) run_bar = Menu(menu_bar, tearoff=0) run_bar.add_command(label='Run', command=run) menu_bar.add_cascade(label='Run', menu=run_bar) compiler.config(menu=menu_bar) editor = Text() editor.pack() code_output = Text(height=7) code_output.pack compiler.mainloop()
3f37df8301b6e1dbb044c648cb837c0f03ffdbc6
a1582cec6239f627c6740b391d751f429675ee39
/test_todo.py
039a3c22c18438751c553f7c5c877b02e940182e
[]
no_license
SolbiatiAlessandro/todos
7cabfd35d6c7d3cdd3232051be4a96c667d55f21
b85e74c4fc220dccc5a0a05a288465b2da98f6d0
refs/heads/master
2020-03-28T18:56:09.847298
2018-10-15T15:07:01
2018-10-15T15:07:01
148,928,531
1
0
null
null
null
null
UTF-8
Python
false
false
638
py
import unittest import todo from os import path dir_path = path.dirname(path.realpath(__file__)) class testTODO( unittest.TestCase ): def test_readElems( self ): self.assertIsNotNone( todo.readElems() ) def test_todoDone( self ): with open(dir_path+'/todos','a') as f: f.write('"[test elem]" 0') #import pdb;pdb.set_trace() elems = todo.readElems() self.assertEqual( "[test elem]", elems[0][1] ) todo.todoDone() elems = todo.readElems() self.assertNotEqual( "[test elem]", elems[0][1] ) if __name__ == '__main__': unittest.main()
88842d784deeecde1c87e82ab837462e8ead03f9
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
/ZZsnGAjYLyosG9zmH_12.py
aa9e707c08223592b4481ac84b90ac438ecda630
[]
no_license
daniel-reich/ubiquitous-fiesta
26e80f0082f8589e51d359ce7953117a3da7d38c
9af2700dbe59284f5697e612491499841a6c126f
refs/heads/master
2023-04-05T06:40:37.328213
2021-04-06T20:17:44
2021-04-06T20:17:44
355,318,759
0
0
null
null
null
null
UTF-8
Python
false
false
206
py
def flash(fc): var1, oper, var2 = fc return var1 + var2 if oper == '+' else var1 - var2 if oper == '-' else var1 * var2 if oper == 'x' else round(var1 / var2, 2) if oper == '/' and var2 else None
da9bfaca059b92580491b71e850ef87666555b90
9baa968c71efebb42c70c130de930cb4810ded31
/OS_IMUDataConversion.py
05e2d59dff4bb385de0ff7c99c81dc6fa852ff76
[]
no_license
jravenhorst909/MoveShelf_IMU_analyser
02cdc0e7f54f9120611106314ad8c055dfb7ad22
cadc3c405b4f61f4d44a29783824889e1f204360
refs/heads/main
2023-02-12T20:46:16.826991
2021-01-06T10:21:20
2021-01-06T10:21:20
311,619,156
8
1
null
2021-01-06T10:21:21
2020-11-10T10:12:03
Python
UTF-8
Python
false
false
1,582
py
# -*- coding: utf-8 -*- """ Created on Thu Oct 8 13:28:40 2020 @author: Joris Ravenhorst """ import opensim as osim def IMUdata_conversion(trial_dir_path,TrialName): # Build an Xsens Settings Object. # Instantiate the Reader Settings Class xsensSettings = osim.XsensDataReaderSettings('myIMUMappings.xml') # Instantiate an XsensDataReader xsens = osim.XsensDataReader(xsensSettings) # Read in seprate tables of data from the specified IMU file(s) tables = xsens.read(trial_dir_path) # get the trial name from the settings trialID = xsensSettings.get_trial_prefix() # Get Orientation Data as quaternions quatTable = xsens.getOrientationsTable(tables) # Write to file osim.STOFileAdapterQuaternion.write(quatTable, trial_dir_path +'/'+ trialID + '_orientations.sto') # OPTIONAL: # # Get Acceleration Data # accelTable = xsens.getLinearAccelerationsTable(tables) # # Write to file # osim.STOFileAdapterVec3.write(accelTable, trial_dir_path +'/'+ trialID + '_linearAccelerations.sto') # # Get Magnetic (North) Heading Data # magTable = xsens.getMagneticHeadingTable(tables) # # Write to file # osim.STOFileAdapterVec3.write(magTable, trial_dir_path +'/'+ trialID + '_magneticNorthHeadings.sto') # # Get Angular Velocity Data # angVelTable = xsens.getAngularVelocityTable(tables) # # Write to file # osim.STOFileAdapterVec3.write(angVelTable, trial_dir_path +'/'+ trialID + '_angularVelocities.sto') return trialID
bec5d5fbb09b6260d514209bc438f344d215832b
ac5e52a3fc52dde58d208746cddabef2e378119e
/exps-sblp/sblp_ut=3.5_rd=1_rw=0.04_rn=4_u=0.075-0.325_p=harmonic-2/sched=RUN_trial=30/sched.py
a85202e958d39e172c17afa700742b708255c6d6
[]
no_license
ricardobtxr/experiment-scripts
1e2abfcd94fb0ef5a56c5d7dffddfe814752eef1
7bcebff7ac2f2822423f211f1162cd017a18babb
refs/heads/master
2023-04-09T02:37:41.466794
2021-04-25T03:27:16
2021-04-25T03:27:16
358,926,457
0
0
null
null
null
null
UTF-8
Python
false
false
495
py
-S 0 -X RUN -Q 0 -L 2 84 250 -S 1 -X RUN -Q 0 -L 2 80 250 -S 0 -X RUN -Q 0 -L 2 74 250 -S 0 -X RUN -Q 0 -L 2 59 250 -S 2 -X RUN -Q 1 -L 1 57 200 -S 2 -X RUN -Q 1 -L 1 48 175 -S 2 -X RUN -Q 1 -L 1 40 125 -S 2 -X RUN -Q 1 -L 1 33 300 -S 3 -X RUN -Q 2 -L 1 29 100 -S 3 -X RUN -Q 2 -L 1 27 125 -S 3 -X RUN -Q 2 -L 1 21 100 -S 3 -X RUN -Q 2 -L 1 19 150 -S 4 -X RUN -Q 3 -L 1 19 100 -S 4 -X RUN -Q 3 -L 1 15 100 -S 4 -X RUN -Q 3 -L 1 14 100
6dcb83acc4bf4107889ebbe1f7af8432518e95eb
3a022998c1fa28408e6d38845f29730579d22a20
/rootsofcube.py
88f22babfd0f3217b9e57c2e5a715534a2a49d56
[]
no_license
nandishaivalli/APS2020
1cd69fbade6fd2069f6b72dc5e8815d905c73836
57bcbe919c92692c61093e01304815c0f29222dc
refs/heads/master
2020-12-20T20:58:23.523106
2020-05-16T07:44:33
2020-05-16T07:44:33
236,208,138
0
0
null
null
null
null
UTF-8
Python
false
false
252
py
#using formula find the roots of cubic eqn a = 3 b = 4 c = 4 d = 3 #ax3+bx2+cx+d=0 p = (-1*b)/(3*a) q = p**3 + (b*c-3*a*d)/(6*a**2) r = c/(3*a) x = (q+(q**2 + (r-p**2)**3)**0.5)**(1/3) + (q-(q**2 + (r-p**2)**3)**0.5)**(1/3) + p print(x)
c2abb820a33634fbd4d2baa8cc40894fd5ffc9db
afea9757be324c8def68955a12be11d71ce6ad35
/willyanealves/customer_service/migrations/0018_remove_customerservice_serviceitem.py
5389c0887e5e5598bfdb43884190c5126c6d8681
[]
no_license
bergpb/willyane-alves
c713cac3ec3a68005f3b8145985693d2477ba706
8b2b9922ba35bf2043f2345228f03d80dbd01098
refs/heads/master
2023-02-10T19:57:50.893172
2021-01-11T16:17:14
2021-01-11T16:17:14
null
0
0
null
null
null
null
UTF-8
Python
false
false
368
py
# Generated by Django 3.1.2 on 2020-11-16 14:18 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('customer_service', '0017_auto_20201116_1115'), ] operations = [ migrations.RemoveField( model_name='customerservice', name='serviceitem', ), ]
07030cbb64db6488b93f8e7f03c975d1d39c099d
df5cd640098a10e754a9552187fc5ad8c50df90c
/colour/examples/algebra/examples_interpolation.py
4acf509db6a9fd00459d7e4bce455a3a20c6b8ca
[ "BSD-3-Clause" ]
permissive
ofek/colour
d4963c9b77b0d119cf3ef3296dbf5369167472df
04f4863ef49093a93244c1fedafd1d5e2b1b76da
refs/heads/develop
2021-07-08T05:33:14.220392
2017-09-29T22:34:14
2017-09-29T22:34:14
105,406,461
0
0
null
2017-09-30T23:06:18
2017-09-30T23:06:18
null
UTF-8
Python
false
false
3,265
py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Showcases interpolation computations. """ import pylab import colour from colour.plotting import * # noqa from colour.utilities.verbose import message_box message_box('Interpolation Computations') message_box(('Comparing "Sprague (1880)" and "Cubic Spline" recommended ' 'interpolation methods to "Pchip" method.')) uniform_spd_data = { 340: 0.0000, 360: 0.0000, 380: 0.0000, 400: 0.0641, 420: 0.0645, 440: 0.0562, 460: 0.0537, 480: 0.0559, 500: 0.0651, 520: 0.0705, 540: 0.0772, 560: 0.0870, 580: 0.1128, 600: 0.1360, 620: 0.1511, 640: 0.1688, 660: 0.1996, 680: 0.2397, 700: 0.2852, 720: 0.0000, 740: 0.0000, 760: 0.0000, 780: 0.0000, 800: 0.0000, 820: 0.0000 } non_uniform_spd_data = { 340.1: 0.0000, 360: 0.0000, 380: 0.0000, 400: 0.0641, 420: 0.0645, 440: 0.0562, 460: 0.0537, 480: 0.0559, 500: 0.0651, 520: 0.0705, 540: 0.0772, 560: 0.0870, 580: 0.1128, 600: 0.1360, 620: 0.1511, 640: 0.1688, 660: 0.1996, 680: 0.2397, 700: 0.2852, 720: 0.0000, 740: 0.0000, 760: 0.0000, 780: 0.0000, 800: 0.0000, 820.9: 0.0000 } base_spd = colour.SpectralPowerDistribution('Reference', uniform_spd_data) uniform_interpolated_spd = colour.SpectralPowerDistribution( 'Uniform - Sprague Interpolation', uniform_spd_data) uniform_pchip_interpolated_spd = colour.SpectralPowerDistribution( 'Uniform - Pchip Interpolation', uniform_spd_data) non_uniform_interpolated_spd = colour.SpectralPowerDistribution( 'Non Uniform - Cubic Spline Interpolation', non_uniform_spd_data) uniform_interpolated_spd.interpolate(colour.SpectralShape(interval=1)) uniform_pchip_interpolated_spd.interpolate( colour.SpectralShape(interval=1), method='Pchip') non_uniform_interpolated_spd.interpolate(colour.SpectralShape(interval=1)) shape = base_spd.shape x_limit_min, x_limit_max, y_limit_min, y_limit_max = [], [], [], [] pylab.plot( base_spd.wavelengths, base_spd.values, 'ro-', label=base_spd.name, linewidth=2) pylab.plot( uniform_interpolated_spd.wavelengths, uniform_interpolated_spd.values, label=uniform_interpolated_spd.name, linewidth=2) pylab.plot( uniform_pchip_interpolated_spd.wavelengths, uniform_pchip_interpolated_spd.values, label=uniform_pchip_interpolated_spd.name, linewidth=2) pylab.plot( non_uniform_interpolated_spd.wavelengths, non_uniform_interpolated_spd.values, label=non_uniform_interpolated_spd.name, linewidth=2) x_limit_min.append(shape.start) x_limit_max.append(shape.end) y_limit_min.append(min(base_spd.values)) y_limit_max.append(max(base_spd.values)) settings = { 'x_label': 'Wavelength $\\lambda$ (nm)', 'y_label': 'Spectral Power Distribution', 'x_tighten': True, 'legend': True, 'legend_location': 'upper left', 'x_ticker': True, 'y_ticker': True, 'limits': (min(x_limit_min), max(x_limit_max), min(y_limit_min), max(y_limit_max)) } boundaries(**settings) decorate(**settings) display(**settings)
dfa355b0aa14dd76ed80003014bdb0d64e25c20b
84fe91caa2209022b8300a7f42dea0b78db41e12
/action/test/test_watermark.py
acb7ae6abfbc2f7e2d4e76c4d1d2bf2991c3c0c8
[ "MIT" ]
permissive
mshemanskyi/image-batch-processor
6b579f1e3442262a9abb5a0cd8f6731a23ebf13b
dd7e0d9bc77fd06fe0f94c4f4fd025323633d9f7
refs/heads/master
2023-01-10T10:03:52.523962
2020-11-07T21:18:47
2020-11-07T21:18:47
303,668,070
0
0
MIT
2020-11-07T20:27:36
2020-10-13T10:33:10
Python
UTF-8
Python
false
false
677
py
import unittest from action.watermark import watermarkImage, watermarkText import cv2 as cv import numpy as np class WatermarkTest((unittest.TestCase)): @classmethod def setUpClass(self): self.testImage = cv.imread('examples/img1.jpg') self.watermarkLogo = cv.imread('examples/wm-logo.png') def setUp(self): pass def test_watermak__image_action(self): wmi = watermarkImage(self.testImage, self.watermarkLogo) self.assertTrue(np.any(self.testImage != wmi)) def test_watarmark_text_action(self): wmi = watermarkText(self.testImage, 'watermarkLogo') self.assertTrue(np.any(self.testImage != wmi))
e5473522c26a9ba7d2654c9fa7a954d97bb4ed88
f855be082bd55159cf6f77be034a78ecf2020232
/actions/actions.py
9501206f8fdb9634b4fe7561bdb7409868ff48ea
[]
no_license
athenasaurav/venkat
64e3b9522bbcceb141d87f4b04498dcfd7f10969
bfb7a767793483a6a8663e1e112a20c03433b2df
refs/heads/main
2023-03-27T11:32:52.246192
2021-03-16T18:01:55
2021-03-16T18:01:55
348,443,833
0
0
null
null
null
null
UTF-8
Python
false
false
12,129
py
# This files contains your custom actions which can be used to run # custom Python code. # # See this guide on how to implement these action: # https://rasa.com/docs/rasa/custom-actions # This is a simple example for a custom action which utters "Hello World!" from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.events import Form, AllSlotsReset, Restarted class ActionHelloWorld(Action): def name(self) -> Text: return "action_greet" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Hi human, I'm sure you want something 😃 I'm sure you are gonna ask me something") return [] class ActionPostAccommodationServicesHotel(Action): def name(self) -> Text: return "action_post_Accommodation_Services_Hotel" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Hotel") return [] class ActionPostCityAttractionSpa(Action): def name(self) -> Text: return "action_post_city_attraction_spa" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Spa") return [] class ActionPostEducationalSuppliesDealers(Action): def name(self) -> Text: return "action_post_Educational_Supplies_Dealers" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Education supplies dealers") return [] class ActionPostEducationalSuppliesDealersBookShop(Action): def name(self) -> Text: return "action_post_Educational_Supplies_Dealers_book_shop" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Book Services") return [] class ActionPostAccountant(Action): def name(self) -> Text: return "action_post_Accountant" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Accountant") return [] class ActionPostInsurance(Action): def name(self) -> Text: return "action_post_Insurance" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Insurance") return [] class ActionPostATM(Action): def name(self) -> Text: return "action_post_ATM" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="ATM") return [] class ActionPostGovernmentOffices(Action): def name(self) -> Text: return "action_post_Government_Offices" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="GOVT OFFICE") return [] class ActionPostNightlife(Action): def name(self) -> Text: return "action_post_Nightlife" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Nightlife") return [] class ActionPostNightlifeHookah(Action): def name(self) -> Text: return "action_post_Nightlife_Hookah" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Nightlife Hookah") return [] class ActionPostSchools(Action): def name(self) -> Text: return "action_post_Schools" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Schools") return [] class ActionPostSchoolsRetakers(Action): def name(self) -> Text: return "action_post_Schools_Retakers" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Schools Retakers") return [] class ActionPostGamesCenters(Action): def name(self) -> Text: return "action_post_Games_Centers" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Game Centers") return [] class ActionPostFoodandDininglocation(Action): def name(self) -> Text: return "action_post_Food_and_Dining_location" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Food_and_Dining_location") return [] class ActionPostFoodandDiningFoodProductSuppliers(Action): def name(self) -> Text: return "action_post_Food_and_Dining_Food_Product_Suppliers" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Food_and_Dining_Food_Product_Suppliers") return [] class ActionPostFoodandDiningRestaurant(Action): def name(self) -> Text: return "action_post_Food_and_Dining_Restaurant" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Food_and_Dining_Restaurant") return [] class ActionPostFoodandDiningSeafood(Action): def name(self) -> Text: return "action_post_Food_and_Dining_Seafood" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Food_and_Dining_Seafood") return [] class ActionPostFoodandDiningSweet(Action): def name(self) -> Text: return "action_post_Food_and_Dining_Sweet" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Food_and_Dining_Sweet") return [] class ActionPostGrocery(Action): def name(self) -> Text: return "action_post_Grocery" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="Grocery") return [] class ActionPostClinicsAndDoctorsType(Action): def name(self) -> Text: return "action_post_Clinics_and_Doctors_type" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Clinics_and_Doctors_type") return [] class ActionPostClinicsandDoctorstypeChiropractors(Action): def name(self) -> Text: return "action_post_Clinics_and_Doctors_type_Chiropractors" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Clinics_and_Doctors_type_Chiropractors") return [] class ActionPostClinicsandDoctorstypeDentists(Action): def name(self) -> Text: return "action_post_Clinics_and_Doctors_type_Dentists" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Clinics_and_Doctors_type_Dentists") return [] class ActionPostEmergencyServices(Action): def name(self) -> Text: return "action_post_Emergency_Services" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Emergency_Services") return [] class ActionPostLegalService(Action): def name(self) -> Text: return "action_post_Legal_Service" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Legal_Service") return [] class ActionPostLegalServiceAdvocates(Action): def name(self) -> Text: return "action_post_Legal_Service_Advocates" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Legal_Service_Advocates") return [] class ActionPostLegalServiceImmigration(Action): def name(self) -> Text: return "action_post_Legal_Service_Immigration" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Legal_Service_Immigration") return [] class ActionPostLegalServicePassport(Action): def name(self) -> Text: return "action_post_Legal_Service_Passport" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Legal_Service_Passport") return [] class ActionPostFuneralsandMemorials(Action): def name(self) -> Text: return "action_post_Funerals_and_Memorials" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Funerals_and_Memorials") return [] class ActionPostGardenandLawn(Action): def name(self) -> Text: return "action_post_Garden_and_Lawn" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Garden_and_Lawn") return [] class ActionPostGardenandLawnGarden(Action): def name(self) -> Text: return "action_post_Garden_and_Lawn_Garden" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Garden_and_Lawn_Garden") return [] class ActionPostGardenandLawnIrrigation(Action): def name(self) -> Text: return "action_post_Garden_and_Lawn_Irrigation" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text="action_post_Garden_and_Lawn_Irrigation") return [] class ActionRestarted(Action): def name(self): return "action_restart" def run(self, dispatcher, tracker, domain): dispatcher.utter_template("utter_reset_full", tracker) return [Form(None), AllSlotsReset(None), Restarted(None)]
1f20faa1db5d79da116d4b083125c2a17a098fc2
2485df18e7584efc0652ab5693ca299a29bf315a
/Finance/Monte-Carlo/Python/Pricing.py
443d07a10067c4ceebbe99b11a406d8ee136e2d2
[]
no_license
lesibius/Programming-For-Fun
c16a576dcb91ff12e7ae8116386d4ac89c5e40c0
ae7e19e6ba78f4f95bbbf64f0d222f16d6b22b1d
refs/heads/master
2020-05-29T08:41:19.938610
2017-02-17T10:50:23
2017-02-17T10:50:23
69,820,991
0
0
null
null
null
null
UTF-8
Python
false
false
9,485
py
# -*- coding: utf-8 -*- """ Created on Wed Jan 18 10:28:21 2017 @author: clem """ import math import numpy.random import scipy.stats import matplotlib.pyplot as plt import sklearn.utils as sku class Path: """ Class to represent the path of a random variable following a Brownian motion (e.g. stock price) """ def __init__(self,s0,nPeriod,deltaT): """ Parameters ---------- s0: float Initial value of the random variable nPeriod: int Number of period to generate deltaT: float Inter-period time interval Returns ------- None """ self.NPeriod = nPeriod self.DeltaT = deltaT self.Values = [s0 for i in range(nPeriod)] def GetLastItem(self): """ Returns the last value of the Path instance Parameters ---------- None Returns ------- type: float Last value of the Path instance """ return self.Values[self.NPeriod-1] def __setitem__(self,ind,item): """ Set the value of an item in the Path value list Parameters ---------- ind: int Index in the random variable path list item: Value to set Returns ------- None """ self.Values[ind] = item def __getitem__(self,ind): """ Returns a value of an item from the Path value list with the index provided Parameters ---------- ind: int Index of the item to return Returns ------- type: float Value of the random variable at the given index """ return self.Values[ind] def GetItemByDate(self,date): """ Return the value of the random variable at a given date Parameters ---------- date: float Date for which the random variable value should be returned Returns ------- type: float Value of the random variable at the selected date """ frac, ind = math.modf(date / self.DeltaT) ind=int(ind) if frac < 0.000001: return self[ind] else: return frac*self[ind]+(1-frac)*self[ind+1] def Plot(self): """ Plot a graph of the path Parameters ---------- None Returns ------- None """ plt.plot([self.DeltaT * period for period in range(self.NPeriod)],self.Values) class PathGenerator: """ Class generating Path instances to price derivatives """ def __init__(self,nPath,totaltime,deltaT,model, drift, vol,**kwargs): """ Parameters ---------- nPath: int Number of path to generate totaltime: float Total time of each path deltaT: float Time interval between two periods drift: float/function Drift of the Brownian motion model: str Name of the model to use. Currently, only "black-scholes" supported vol: float/function Volatility of the Brownian motion **kwargs: optional arguments to provide for certain model """ self.TotalTime = totaltime self.NPath = nPath self.NPeriod = int(totaltime/deltaT) self.DeltaT = deltaT self.Drift = drift self.Vol = vol if model.lower() in ['bs','black-scholes','black scholes','merton','black-scholes-merton','black scholes merton']: self.DriftFun = self._BSDriftFun self.VolFun = self._BSVolFun def _BSDriftFun(self,S,t,rt,sigmat): """ Drift function used by the Black-Scholes-Merton model """ return self.Drift * S def _BSVolFun(self,S,t,r,sigmat): """ Volatility function used by the Black-Scholes-Merton model """ return self.Vol * S * numpy.random.normal(0.0,1.0) def _initPaths(self,s0): """ Init the attribute Paths as a list of Path instance Parameters ---------- s0: float Initial value of the random variable Returns ------- None """ self.Paths = [Path(s0,self.NPeriod,self.DeltaT) for i in range(self.NPath)] def GeneratePaths(self,s0): """ Generate the Path instance to price derivatives Parameters ---------- s0: float Initial value of the random variable Returns ------- None """ self._initPaths(s0) for i in range(self.NPath): S = s0 for j in range(self.NPeriod-1): t = (j+1)*self.DeltaT S = S + self.DriftFun(S,t,0.01,0) * self.DeltaT + self.VolFun(S,t,0.01,0) * math.sqrt(self.DeltaT) self.Paths[i][j+1] = S def Discount(self,date): """ Returns the discount factor for a given date Warnings -------- Only provide the discount factor, and do not implement r=f(t) yet Parameters ---------- date: float Date of the cash flow Returns ------- type: float Discount factor for the selected date """ return math.exp(-date * 0.01) def __getitem__(self,ind): """ Return a Path instance from the path list Parameters ---------- ind: int Index of the Path instance Returns ------- type: Path Path at the ind index """ return self.Paths[ind] def __iter__(self): """ Returns an iterable list of the Path instance Parameters ---------- None Returns ------- type: list List of Path instance """ for path in self.Paths: yield path class Option: """ Option class """ def __init__(self,payoff,underlying,expiry=None): """ Parameters ---------- payoff: function(Path -> float) Payoff function underlying: PathGenerator Underlying PathGenerator instance expiry: float (optional) Expiry date (or last expirty date) of the derivative """ self.Underlying = underlying self.Payoff = payoff if expiry is None: self.Expiry = underlying.TotalTime else: self.Expiry = expiry def _GetValue(self,path): """ Compute the value at expiry date of the option" Parameters ---------- path: Path Path for which the value should be computed Returns ------- type: float Value at expiry """ return self.Payoff(path) * self.Underlying.Discount(self.Expiry) def Price(self,nbootstrap = 1000): """ Compute the option price using simulations Parameters ---------- None Returns ------- type: float Option price at t = 0 """ tmpval = [] for path in self.Underlying: tmpval.append(self._GetValue(path)) #av = mean(tmpval) #st = (1.0/sqrt(self.Underlying.NPath))*numpy.std(tmpval) #Dirty bootstrap procedure. Fall far from the closed form solution for OTM put #But still better than without actually bootstrap = [mean(sku.resample(tmpval)) for i in range(nbootstrap)] av = mean(bootstrap) st = numpy.std(bootstrap) return [av - 1.96 * st, av ,av + 1.96 * st] #Filled with some data ~ today libor = 0.76944/100.0 S0 = 2267.89 r = 12.0 * math.log(1+libor/12.0) sigma =0.06 #0.1177 K = 2250.0 t=1.0/12.0 nperiod = 1000 npath = 2000 pg = PathGenerator(npath,t,t/nperiod,'bs',r,sigma) pg.GeneratePaths(S0) plainvanillacall = Option(lambda x: max(x.GetLastItem() - K,0),pg) plainvanillaput = Option(lambda x: max(K - x.GetLastItem(),0),pg) print("Call price data: {}".format(plainvanillacall.Price())) print("Put price data: {}".format(plainvanillaput.Price())) N = lambda x: scipy.stats.norm.cdf(x) d1 = (1.0/(sigma *math.sqrt(t))) * (math.log(S0/K)+(r+(sigma**2.0)/2.0)*t) d2 = d1 - sigma * math.sqrt(t) print("Closed form call: {}".format(S0 * N(d1) - K * math.exp(-r*t) * N(d2))) print("Closed form put: {}".format(-S0 * N(-d1) + K * math.exp(-r*t) * N(-d2))) from matplotlib.ticker import FuncFormatter """ plt.hist([p.GetLastItem() for p in pg.Paths],bins=10) def to_percent(y,position): return str(100*y/npath) + '%' formatter = FuncFormatter(to_percent) plt.gca().yaxis.set_major_formatter(formatter) """ print(mean([p.GetLastItem() for p in pg.Paths])) print(S0 * math.exp(r * plainvanillacall.Expiry)) pg.Paths[0].Plot() #plt.gca().set_ylim([0,2500])
396451adf046ae9a1e9a93d08c731002c02b4a78
5a52ccea88f90dd4f1acc2819997fce0dd5ffb7d
/alipay/aop/api/response/AntMerchantExpandIndirectOnlineModifyResponse.py
deb575d50e426359ce6993ae14225946249fa464
[ "Apache-2.0" ]
permissive
alipay/alipay-sdk-python-all
8bd20882852ffeb70a6e929038bf88ff1d1eff1c
1fad300587c9e7e099747305ba9077d4cd7afde9
refs/heads/master
2023-08-27T21:35:01.778771
2023-08-23T07:12:26
2023-08-23T07:12:26
133,338,689
247
70
Apache-2.0
2023-04-25T04:54:02
2018-05-14T09:40:54
Python
UTF-8
Python
false
false
805
py
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AntMerchantExpandIndirectOnlineModifyResponse(AlipayResponse): def __init__(self): super(AntMerchantExpandIndirectOnlineModifyResponse, self).__init__() self._sub_merchant_id = None @property def sub_merchant_id(self): return self._sub_merchant_id @sub_merchant_id.setter def sub_merchant_id(self, value): self._sub_merchant_id = value def parse_response_content(self, response_content): response = super(AntMerchantExpandIndirectOnlineModifyResponse, self).parse_response_content(response_content) if 'sub_merchant_id' in response: self.sub_merchant_id = response['sub_merchant_id']
caef2901988d4c4ef7134aa4f7bd5d6bc5e027cf
e180e68c468557b186d083869c005c98abdf539a
/Testing Hardcoded format/test12.py
45c8d0b0c94ebea29eb0ddab7264b94cf3c404aa
[]
no_license
singhalshubh/Notification-system-Testing-using-selenium
8a58977d7d63c1216e420363f408826e9bfccf7a
e460e7ceeb63e5eea9a914be0ed84febaebe47c7
refs/heads/master
2020-03-21T21:33:03.046748
2020-01-17T09:53:24
2020-01-17T09:53:24
139,069,652
0
0
null
null
null
null
UTF-8
Python
false
false
2,514
py
__author__= 'shubh' import unittest from selenium import webdriver class signup(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() def test_unsubscribe_community(self): user ="raghav" pwd= "sha123#56su" driver = webdriver.Firefox() driver.maximize_window() #For maximizing window driver.implicitly_wait(20) #gives an implicit wait for 20 seconds driver.get("http://127.0.0.1:8000/") driver.find_element_by_xpath('//a [@href="/login/?next=/"]').click() driver.get("http://localhost:8000/login/?next=/") elem = driver.find_element_by_id("id_username") elem.send_keys(user) elem = driver.find_element_by_id("id_password") elem.send_keys(pwd) driver.find_element_by_class_name('btn-block').click() driver.find_element_by_xpath('//a [@href="/communities/"]').click() driver.find_element_by_xpath('//a [@href="/community-view/1/"]').click() driver.find_element_by_id("join-us").click() driver.find_element_by_xpath('//a [@href="/logout/"]').click() driver.get("http://127.0.0.1:8000/") user ="shubh" pwd= "sha123#56su" driver.find_element_by_xpath('//a [@href="/login/?next=/"]').click() driver.get("http://localhost:8000/login/?next=/") elem = driver.find_element_by_id("id_username") elem.send_keys(user) elem = driver.find_element_by_id("id_password") elem.send_keys(pwd) driver.find_element_by_class_name('btn-block').click() driver.find_element_by_xpath('//a [@href="/communities/"]').click() driver.find_element_by_xpath('//a [@href="/community-view/2/"]').click() driver.find_element_by_xpath('//a [@href="/manage_community/2/"]').click() name = "raghav" Role = "author" elem = driver.find_element_by_id("username") elem.send_keys(name) elem = driver.find_element_by_id("role") elem.send_keys(Role) #specify the class driver.find_element_by_class_name('btn-block').click() driver.find_element_by_xpath('//a [@href="/logout/"]').click() driver.get("http://127.0.0.1:8000/") user ="raghav" pwd= "sha123#56su" driver.find_element_by_xpath('//a [@href="/login/?next=/"]').click() driver.get("http://localhost:8000/login/?next=/") elem = driver.find_element_by_id("id_username") elem.send_keys(user) elem = driver.find_element_by_id("id_password") elem.send_keys(pwd) driver.find_element_by_class_name('btn-block').click() driver.find_element_by_xpath('//a [@href="/notifications/"]').click() def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
2e6669b326e3edda7be0bf7c377f290405bcf0c3
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2671/60590/241334.py
25e5fee553d7db62878bfa4165d65ebdfde7331c
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
314
py
def cal(w): if w==1: return 2 if w==2: return 3 elif w==3: return 5 else: w2=2 w3=3 for i in range(w-2): temp=w2+w3 w2=w3 w3=temp return temp t = int(input()) for i in range(t): w=int(input()) print(2**w-cal(w))
635ba9cef3c47552319481c624406b556a3d4b17
ac5e52a3fc52dde58d208746cddabef2e378119e
/exps-sblp-obt/sblp_ut=3.5_rd=1_rw=0.04_rn=4_u=0.075-0.325_p=harmonic-2/sched=RUN_trial=0/params.py
aff20aa8732740d3ec888ec12ac9538f67a70364
[]
no_license
ricardobtxr/experiment-scripts
1e2abfcd94fb0ef5a56c5d7dffddfe814752eef1
7bcebff7ac2f2822423f211f1162cd017a18babb
refs/heads/master
2023-04-09T02:37:41.466794
2021-04-25T03:27:16
2021-04-25T03:27:16
358,926,457
0
0
null
null
null
null
UTF-8
Python
false
false
247
py
{'cpus': 4, 'duration': 30, 'final_util': '3.570619', 'max_util': '3.5', 'periods': 'harmonic-2', 'release_master': False, 'res_distr': '1', 'res_nmb': '4', 'res_weight': '0.04', 'scheduler': 'RUN', 'trial': 0, 'utils': 'uni-medium-3'}
81ead41af15f2e458481b49604b4fc00b30f8ecc
9cbd22ce203ab7f40d6e02a7ee2b565461369b45
/bagbankde/items.py
768a82202c55a20a6a785aed852583aebad99500
[]
no_license
hristo-grudev/bagbankde
a506ed6af28db7ad4c609d7fbd922d5a699b64d6
1afcb0454b9e498c4b4eccb233b7d2aa15823513
refs/heads/main
2023-03-26T14:09:08.641400
2021-03-18T14:16:31
2021-03-18T14:16:31
349,100,217
0
0
null
null
null
null
UTF-8
Python
false
false
136
py
import scrapy class BagbankdeItem(scrapy.Item): title = scrapy.Field() description = scrapy.Field() date = scrapy.Field()
b70b6252b5bca3bad1bd930541510f86d3f7360e
167c6b1238c0e3f8f17e3659ae4e34a8dff3908d
/task1.py
bbb51409030000b6d4014178effcd77099474735
[]
no_license
Pajke123/ORS-PA-18-Homework07
8345ae8758601e9b42e76f0ac324adb005802727
fdd7c0c853f0fd70616295145e8ebef04677808f
refs/heads/master
2020-05-21T01:02:13.703392
2019-04-30T12:53:10
2019-04-30T12:53:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
549
py
""" =================== TASK 1 ==================== * Name: Roll The Dice * * Write a script that will simulate rolling the * dice. The script should fetch the number of times * the dice should be "rolled" as user input. * At the end, the script should print how many times * each number appeared (1 - 6). * * Note: Please describe in details possible cases * in which your solution might not work. * * Note: You can use `rand` module to simulate dice * rolling. =================================================== """ # Write your script here
6a1e6c2874181f6c5859c830e394359834617163
747f759311d404af31c0f80029e88098193f6269
/extra-addons/training_doc/__init__.py
4cb47ad014a13cc816addb240e952f246358cbea
[]
no_license
sgeerish/sirr_production
9b0d0f7804a928c0c582ddb4ccb7fcc084469a18
1081f3a5ff8864a31b2dcd89406fac076a908e78
refs/heads/master
2020-05-19T07:21:37.047958
2013-09-15T13:03:36
2013-09-15T13:03:36
9,648,444
0
1
null
null
null
null
UTF-8
Python
false
false
1,097
py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved. # Jesús Martín <[email protected]> # $Id$ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import training_doc import wizard
6c043811b2da3f373efa06bc8156705996b15ee9
9743d5fd24822f79c156ad112229e25adb9ed6f6
/xai/brain/wordbase/adverbs/_never.py
d9002c9003bf7b8c0007df237bda667fddc3bf4d
[ "MIT" ]
permissive
cash2one/xai
de7adad1758f50dd6786bf0111e71a903f039b64
e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6
refs/heads/master
2021-01-19T12:33:54.964379
2017-01-28T02:00:50
2017-01-28T02:00:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
393
py
#calss header class _NEVER(): def __init__(self,): self.name = "NEVER" self.definitions = [u'not at any time or not on any occasion: '] self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'adverbs' def run(self, obj1, obj2): self.jsondata[obj2] = {} self.jsondata[obj2]['properties'] = self.name.lower() return self.jsondata
9f281fc9d686425e97b54cdc34eb570c1fe19b42
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p02709/s208022099.py
7c3413420f8ed9fc0b8a40a4b007da745e363f1f
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
681
py
from sys import stdin def main(): n = int(stdin.readline()) a = list(map(int, stdin.readline().split())) a2 = [[a[i], i] for i in range(n)] a2.sort(reverse=True) dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)] ans = 0 for i in range(n + 1): for j in range(n + 1 - i): s1 = s2 = 0 if i > 0: s1 = dp[i - 1][j] + a2[i + j - 1][0] * (a2[i + j - 1][1] - (i - 1)) if j > 0: s2 = dp[i][j - 1] + a2[i + j - 1][0] * ((n - j) - a2[i + j - 1][1]) dp[i][j] = max(s1, s2) ans = max(ans, dp[i][n - i]) print(ans) if __name__ == "__main__": main()
a23647b52f355989359adaa6265a6bedbe23c029
64bf39b96a014b5d3f69b3311430185c64a7ff0e
/intro-ansible/venv3/lib/python3.8/site-packages/ansible_collections/fortinet/fortios/plugins/modules/fortios_system_replacemsg_image.py
f4603def9e807083a0568dc573aa96c96a7409b3
[ "MIT" ]
permissive
SimonFangCisco/dne-dna-code
7072eba7da0389e37507b7a2aa5f7d0c0735a220
2ea7d4f00212f502bc684ac257371ada73da1ca9
refs/heads/master
2023-03-10T23:10:31.392558
2021-02-25T15:04:36
2021-02-25T15:04:36
342,274,373
0
0
MIT
2021-02-25T14:39:22
2021-02-25T14:39:22
null
UTF-8
Python
false
false
9,507
py
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019-2020 Fortinet, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. __metaclass__ = type ANSIBLE_METADATA = {'status': ['preview'], 'supported_by': 'community', 'metadata_version': '1.1'} DOCUMENTATION = ''' --- module: fortios_system_replacemsg_image short_description: Configure replacement message images in Fortinet's FortiOS and FortiGate. description: - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and replacemsg_image category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.0 version_added: "2.9" author: - Link Zheng (@chillancezen) - Jie Xue (@JieX19) - Hongbin Lu (@fgtdev-hblu) - Frank Shen (@frankshen01) - Miguel Angel Munoz (@mamunozgonzalez) - Nicolas Thomas (@thomnico) notes: - Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks requirements: - ansible>=2.9.0 options: access_token: description: - Token-based authentication. Generated from GUI of Fortigate. type: str required: false vdom: description: - Virtual domain, among those defined previously. A vdom is a virtual instance of the FortiGate that can be configured and used as a different unit. type: str default: root state: description: - Indicates whether to create or remove the object. type: str required: true choices: - present - absent system_replacemsg_image: description: - Configure replacement message images. default: null type: dict suboptions: image_base64: description: - Image data. type: str image_type: description: - Image type. type: str choices: - gif - jpg - tiff - png name: description: - Image name. required: true type: str ''' EXAMPLES = ''' - hosts: fortigates collections: - fortinet.fortios connection: httpapi vars: vdom: "root" ansible_httpapi_use_ssl: yes ansible_httpapi_validate_certs: no ansible_httpapi_port: 443 tasks: - name: Configure replacement message images. fortios_system_replacemsg_image: vdom: "{{ vdom }}" state: "present" access_token: "<your_own_value>" system_replacemsg_image: image_base64: "<your_own_value>" image_type: "gif" name: "default_name_5" ''' RETURN = ''' build: description: Build number of the fortigate image returned: always type: str sample: '1547' http_method: description: Last method used to provision the content into FortiGate returned: always type: str sample: 'PUT' http_status: description: Last result given by FortiGate on last operation applied returned: always type: str sample: "200" mkey: description: Master key (id) used in the last call to FortiGate returned: success type: str sample: "id" name: description: Name of the table used to fulfill the request returned: always type: str sample: "urlfilter" path: description: Path of the table used to fulfill the request returned: always type: str sample: "webfilter" revision: description: Internal revision number returned: always type: str sample: "17.0.2.10658" serial: description: Serial number of the unit returned: always type: str sample: "FGVMEVYYQT3AB5352" status: description: Indication of the operation's result returned: always type: str sample: "success" vdom: description: Virtual domain used returned: always type: str sample: "root" version: description: Version of the FortiGate returned: always type: str sample: "v5.6.3" ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.connection import Connection from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import FortiOSHandler from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import check_legacy_fortiosapi from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import FAIL_SOCKET_MSG def filter_system_replacemsg_image_data(json): option_list = ['image_base64', 'image_type', 'name'] dictionary = {} for attribute in option_list: if attribute in json and json[attribute] is not None: dictionary[attribute] = json[attribute] return dictionary def underscore_to_hyphen(data): if isinstance(data, list): for i, elem in enumerate(data): data[i] = underscore_to_hyphen(elem) elif isinstance(data, dict): new_data = {} for k, v in data.items(): new_data[k.replace('_', '-')] = underscore_to_hyphen(v) data = new_data return data def system_replacemsg_image(data, fos): vdom = data['vdom'] state = data['state'] system_replacemsg_image_data = data['system_replacemsg_image'] filtered_data = underscore_to_hyphen(filter_system_replacemsg_image_data(system_replacemsg_image_data)) if state == "present": return fos.set('system', 'replacemsg-image', data=filtered_data, vdom=vdom) elif state == "absent": return fos.delete('system', 'replacemsg-image', mkey=filtered_data['name'], vdom=vdom) else: fos._module.fail_json(msg='state must be present or absent!') def is_successful_status(status): return status['status'] == "success" or \ status['http_method'] == "DELETE" and status['http_status'] == 404 def fortios_system(data, fos): if data['system_replacemsg_image']: resp = system_replacemsg_image(data, fos) else: fos._module.fail_json(msg='missing task body: %s' % ('system_replacemsg_image')) return not is_successful_status(resp), \ resp['status'] == "success" and \ (resp['revision_changed'] if 'revision_changed' in resp else True), \ resp def main(): mkeyname = 'name' fields = { "access_token": {"required": False, "type": "str", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "state": {"required": True, "type": "str", "choices": ["present", "absent"]}, "system_replacemsg_image": { "required": False, "type": "dict", "default": None, "options": { "image_base64": {"required": False, "type": "str"}, "image_type": {"required": False, "type": "str", "choices": ["gif", "jpg", "tiff", "png"]}, "name": {"required": True, "type": "str"} } } } check_legacy_fortiosapi() module = AnsibleModule(argument_spec=fields, supports_check_mode=False) versions_check_result = None if module._socket_path: connection = Connection(module._socket_path) if 'access_token' in module.params: connection.set_option('access_token', module.params['access_token']) fos = FortiOSHandler(connection, module, mkeyname) is_error, has_changed, result = fortios_system(module.params, fos) versions_check_result = connection.get_system_version() else: module.fail_json(**FAIL_SOCKET_MSG) if versions_check_result and versions_check_result['matched'] is False: module.warn("Ansible has detected version mismatch between FortOS system and galaxy, see more details by specifying option -vvv") if not is_error: if versions_check_result and versions_check_result['matched'] is False: module.exit_json(changed=has_changed, version_check_warning=versions_check_result, meta=result) else: module.exit_json(changed=has_changed, meta=result) else: if versions_check_result and versions_check_result['matched'] is False: module.fail_json(msg="Error in repo", version_check_warning=versions_check_result, meta=result) else: module.fail_json(msg="Error in repo", meta=result) if __name__ == '__main__': main()
7fb23836dea8df7c484419d39675673ff83ad1f1
2b3bed35a29bfd46d660e0c7ccad84416c76e5a2
/python/Activity_8.py
a561a351665c5d8661db11834c9644e8b16a4d9d
[]
no_license
Sreevara-lab/sdet
76a738dbeb91df6e2bff659ac6e8e2955517758e
e9bcfba1509b3cfa4ca64dd8c3846c9b0faefefd
refs/heads/main
2023-03-13T08:47:51.836330
2021-02-28T13:51:54
2021-02-28T13:51:54
336,749,624
0
0
null
2021-02-07T09:33:34
2021-02-07T09:33:34
null
UTF-8
Python
false
false
199
py
numList = [10, 20, 30, 40, 30] print("Given list is ", numList) firstElement = numList[0] lastElement = numList[-1] if (firstElement == lastElement): print(True) else: print(False)
4c6c5d18a00823a83ef35c263e076351815ec55a
98591a80b7881385dc15a7aee3298aed68efbc32
/MODEL1302010025/model.py
7776531980fb768cf4985182c7a6bdc908a3c3e7
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
biomodels/MODEL1302010025
9f49612839a3c29dd8034bf17a58a6caa3e1a8eb
852113c7356661180c266a701e56dc8bc789a898
refs/heads/master
2020-12-24T14:44:47.764710
2014-10-16T05:57:03
2014-10-16T05:57:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
427
py
import os path = os.path.dirname(os.path.realpath(__file__)) sbmlFilePath = os.path.join(path, 'MODEL1302010025.xml') with open(sbmlFilePath,'r') as f: sbmlString = f.read() def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: return True if module_exists('libsbml'): import libsbml sbml = libsbml.readSBMLFromString(sbmlString)
b614b1cddfff224c044d48a2c548725eaceab370
c6a053873e7936744f06fb739210c1d0e5bdaf3e
/Credicoop_dashboard/funciones_para_dashboard/pagina_inicio.py
5d86496bfe0326d544cdf6c4fc5eb98e6badaebd
[]
no_license
sebasur90/Dashboard-Banco-Credicoop
e35c48ffc9aa8601ec4c18c4f33f9da06c2e2704
04f2445712d08bae688b3091b577f14de0a05a30
refs/heads/main
2023-07-08T02:43:31.764893
2021-08-12T00:19:38
2021-08-12T00:19:38
395,142,970
0
0
null
null
null
null
UTF-8
Python
false
false
5,458
py
from funciones_para_dashboard import clases import dash_html_components as html import pathlib import dash_bootstrap_components as dbc from datetime import datetime mov = clases.Movimientos() mov = mov.datos def total_dias(): fecha_inicio = mov.sort_values( by=['fecha']).reset_index(drop=True).fecha.iloc[0] fecha_inicio = datetime.strptime(fecha_inicio, '%Y-%m-%d') fecha_actual = datetime.now() fecha_total_dias = (fecha_actual-fecha_inicio).days fecha_total_anos = round((fecha_actual-fecha_inicio).days/365) fecha_total_meses = round((fecha_actual-fecha_inicio).days/30) return fecha_total_dias, fecha_total_anos, fecha_total_meses def total_datos(): return len(mov) def sumas(): cred_usd = round(mov.credito_usd_ccl.sum()) cred_p = round(mov.credito.sum()) deb_usd = round(mov.debito_usd_ccl.sum()) deb_p = round(mov.debito.sum()) return cred_usd, cred_p, deb_usd, deb_p def ultima_fecha_informada(): fecha = mov.sort_values(by=['fecha']).reset_index(drop=True).fecha.iloc[-1] return fecha def ultimo_valor_dolar(): dolar = round(mov.sort_values(by=['fecha']).reset_index( drop=True).ccl.iloc[-1], 2) return dolar layout = html.Div([ html.H1("Dashboard Credicoop", className='titulo'), html.Div([dbc.CardDeck([ dbc.Card( dbc.CardBody( [html.P("Total datos", className="card-text"), html.H2(total_datos(), className="card-dato"), ])), dbc.Card( dbc.CardBody( [html.P("Total dias transcurridos", className="card-text", ), html.H2(total_dias()[0], className="card-dato"), ])), dbc.Card( dbc.CardBody( [html.P("Total ingresos en USD", className="card-text", ), html.H2(sumas()[0], className="card-dato"), html.P("en pesos \n" + str(sumas()[1]), className="card-text", ), ])), dbc.Card( dbc.CardBody( [html.P("Cotizacion dolar CCL", className="card-text", ), html.H2(ultimo_valor_dolar(), className="card-dato"), ] ) ), ], className="div_tarjetas_deck" )], className="div_tarjetas_1"), html.Div([ dbc.CardDeck( [ dbc.Card( [ dbc.CardBody( [ html.H4( "Ingresos", className="card-title"), html.P( "Sueldos historicos y graficos comparativos en pesos y en dolar contado" "con liquidacion. " "Mapas de calor y mas...", className="card-text", ), dbc.Button("Ingresar", color="primary", href="/pagina_ingresos", className="boton_ir_pagina"), ] ), ], style={"width": "30rem"} ), dbc.Card( [ dbc.CardBody( [ html.H4("Egresos", className="card-title"), html.P( "Gastos historicos y graficos comparativos de su evolucion en el tiempo ", className="card-text", ), dbc.Button("Ingresar", color="primary", href="/pagina_egresos", className="boton_ir_pagina"), ] ), ], style={"width": "30rem"} ), dbc.Card( [ dbc.CardBody( [ html.H4("Movimientos", className="card-title"), html.P( "Detalle de movimientos de cuenta historicos. ", className="card-text", ), dbc.Button("Ingresar", color="primary", href="/movimientos", id="boton_ir_pagina"), ] ), ], style={"width": "30rem"} ) ])], className="div_tarjetas_2") ], className="fondo_inicio")
d006fc415b4fe1c51b8845692542c12bc729eb38
9e14489270b26edbdafe7c168eb3cfa014df36a4
/tests/test_integration/test_smartcontract_event.py
73b0eda2ffb4171a8142b4404517d5461f850de4
[ "MIT" ]
permissive
aergoio/herapy
7b62a04bf9becb0b701594f7bfcb5530c8d477ab
cf8a6ab0fd50c12b0f5f3ca85ff015eda5108863
refs/heads/develop
2023-08-10T09:40:47.529167
2020-03-25T06:58:30
2020-03-25T06:58:30
148,101,359
7
4
MIT
2023-09-01T15:00:48
2018-09-10T05:00:38
Python
UTF-8
Python
false
false
6,108
py
import aergo.herapy as herapy def test_sc_event(aergo) -> None: print("------ Payload -----------") """ function constructor(name) contract.event("movie", "robocop", 1, "I'll be back") end function movie_event(name) contract.event("movie", "arnold", 2, "It's mine") contract.event("movie", "terminator", 3, "No, it's mine") end function ani_event(name) contract.event("a-time!!") contract.event("a-time!!", "pinn", "Adventure time!!", false, bignum.number("999999999999999"), {"princess bubble gum", 1} ) contract.event("a-time!!", "Jake", "Adventure time!!", false, {"whatever", 1, {true, false}, bignum.number("999999999999999")} ) contract.event("movie", "yoda", 3, "i'm not the ani character.") end abi.register(movie_event, ani_event) """ payload_str = "D1ZsfUyj4q8GA6AtbW81TzSTSvqaeUvcsePsaZufptRK5qSb83fyXRWdE" \ "gGhLWs17JfRNrM4iLjGe54fkyvsyjHVgFCHqTzJWK4Yz8uQwRqzF5x1g1twZ3jPP1Xt" \ "J95y43RD48qXGoeeoDsmmNErQJCux6d4eLZwE344bz5hM1DdWEd22yE6ogC37RLRtRZ" \ "5FFKm3HkxaM67G7VqWfsX5t2Tmd23Myn62hkAdNWjSBaWizqyi6ENB3VD2YJGG82bVe" \ "q9a4zMQdK58Wxnfcfqo14Vo9Y9jsY8A5QYNRi6uotRfiYt3LFrPjPBWgyQRn4qFQypS" \ "W5vfgFZvv9VBdFPGgoMN5zeBp7VNWXvE5o8CGAf3fuFu2gCGLS4DfCtQe7VNnsCUi7U" \ "1AdmdupqoxMHM6kCfEtk77YyiaaSTm4xUSt7R2hwzs2Xnfh8CLxMaH2cg3rsWF4fefs" \ "5KvnjN3F1q43og6BueK66o8NssyY41kAtincbYhDC8oHaBkMTdXD6mkhb3QECwn8dh8" \ "k9a3KTys1tdUzf99nqpK5YrAcZFDjbrmmmtcBYwZg6zdRAkQnJptvr25HzeHMfbfERH" \ "8P1XzYmjqYynFvUNv4utuWZ7avS2xvJoZph3nSa8Xuhbdw6TFLVCDZVfZB6j8kQbJnb" \ "1DoEEtvhPHLMP4StcgiE9grGQuduZ5iHYtS8Nk696Fq6Y9gzp19bWD3VKarq1XuueM6" \ "FNrzCQNY22nov4mxbM8vcxp4axdjmZNWLcdttFycazorxCNbn1YBQFzGPGzstJPN72R" \ "B9dxV17cb1TuREKTF7mVLLeahgHsY4eVnA1m5Z8U7tFKswRDTGeXv6vCt7MstVBztdd" \ "4sRfHTXKdFCgfoQk2zwzGS8FEVgxAP3Y4Tip4nuQd8hVyTiaApFmNnkD9byxUNCc44T" \ "r9LAnRycc239HGpZjWBwsJvmb4jsY2fuEELXfSgQf4yZhnbcPC4DYPQLDRXc8E6DdLz" \ "ixMk7cAfUZqododk9SWzjB9FSKtzVYWiKuyg2uZoRaxDmrtZpe6pXL8F4pzt2P2HEG6" \ "jyFn5MT9PBWhkj11vqAjWpdRgNAbTKEb5zk9ZeER9YUAT8etk2VFpAGqmGnv9CTEQr2" \ "rfDQeNgNYzoy44mNZonhi4n4zo9h2HmrSsatWa8oxbJJYihGs7zD65TiqRfnKg43Xx5" \ "qD" payload = herapy.utils.decode_address(payload_str) print(''.join('{:d} '.format(x) for x in payload)) byte_code_len = int.from_bytes(payload[:4], byteorder='little') print("payload: byte code length = ", byte_code_len) print("------ Set Sender Account -----------") sender_private_key = "6hbRWgddqcg2ZHE5NipM1xgwBDAKqLnCKhGvADWrWE18xAbX8sW" sender_account = aergo.new_account(private_key=sender_private_key) print(" > Sender Address: {}".format(sender_account.address)) print(herapy.utils.convert_bytes_to_int_str(bytes(sender_account.address))) print("------ Deploy SC -----------") tx, result = aergo.deploy_sc(amount=0, payload=payload, args=1234, retry_nonce=5) print(" > TX: {}".format(tx.tx_hash)) print("{}".format(str(tx))) assert result.status == herapy.CommitStatus.TX_OK, \ " > ERROR[{0}]: {1}".format(result.status, result.detail) print(" > result[{0}] : {1}".format(result.tx_id, result.status.name)) print(herapy.utils.convert_bytes_to_int_str(bytes(tx.tx_hash))) aergo.wait_tx_result(tx.tx_hash) print("------ Check deployment of SC -----------") print(" > TX: {}".format(tx.tx_hash)) result = aergo.get_tx_result(tx.tx_hash) assert result.status == herapy.TxResultStatus.CREATED, \ " > ERROR[{0}]:{1}: {2}".format( result.contract_address, result.status, result.detail) sc_address = result.contract_address print(" > SC Address: {}".format(sc_address)) print("------ Get events -----------") events = aergo.get_events(sc_address, "movie", with_desc=True, arg_filter={0: 'arnold'}) print("how many 'arnold' in movie? {}".format(len(events))) assert len(events) == 0 events = aergo.get_events(sc_address, "movie", with_desc=True, arg_filter={0: 'robocop'}) print("how many 'robocop' in movie? {}".format(len(events))) assert len(events) == 1 event_block_no = 0 for i, e in enumerate(events): event_block_no = e.block_height print("[{}] Event: {}".format(i, str(e))) events = aergo.get_events( sc_address, "movie", end_block_no=event_block_no - 1) print("in history: how many movie? {}".format(len(events))) assert len(events) == 0 events = aergo.get_events( sc_address, "movie", start_block_no=event_block_no + 1) print("after: how many movie? {}".format(len(events))) assert len(events) == 0 print("------ Call SC -----------") tx, result = aergo.call_sc(sc_address, "movie_event") print("movie_event tx hash: {}".format(str(tx.tx_hash))) aergo.wait_tx_result(tx.tx_hash) print("------ Get events -----------") events = aergo.get_events(sc_address, "movie") print("how many 'movie'? {}".format(len(events))) assert len(events) == 3 for i, e in enumerate(events): print("[{}] Event: {}".format(i, str(e))) events = aergo.get_events(sc_address, "a-time!!") print("how many 'a-time!!'? {}".format(len(events))) assert len(events) == 0 print("------ Call SC -----------") tx, result = aergo.call_sc(sc_address, "ani_event") print("ani_event tx hash: {}".format(str(tx.tx_hash))) aergo.wait_tx_result(tx.tx_hash) print("------ Get events -----------") events = aergo.get_events(sc_address, "movie") print("how many 'movie'? {}".format(len(events))) assert len(events) == 4 events = aergo.get_events(sc_address, "a-time!!") print("how many 'a-time!!'? {}".format(len(events))) assert len(events) == 3 for i, e in enumerate(events): print("[{}] Event: {}".format(i, str(e)))
53ef131a0b9babc5af8fa15c91c4fca6cc7de93c
69c882c678103b182988fb60d3e898d569980f1c
/Day 4/day4prog4.py
5f6224da0ba42f841f9b5541f0a3d0a63e87733b
[]
no_license
gittygupta/stcet-python
44be9d91cdd6215879d9f04497214819228821be
e77456172746ee76b6e2a901ddb0c3dbe457f82a
refs/heads/master
2022-03-05T11:37:08.720226
2019-12-01T00:56:03
2019-12-01T00:56:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
135
py
n=2 while n<1000: flag=1 for i in range (2,n): if n%i==0: flag=0 if flag==1: print(n) n+=1
c73896b41397d024ffcb55baeaa9f677221d9361
6e8d58340f2be5f00d55e2629052c0bbc9dcf390
/eggs/Cheetah-2.2.2-py2.6-linux-x86_64-ucs4.egg/Cheetah/Tools/MondoReport.py
d0fada29f11cec17ce7def984ffabddd6bbf15ad
[ "CC-BY-2.5", "MIT" ]
permissive
JCVI-Cloud/galaxy-tools-prok
e57389750d33ac766e1658838cdb0aaf9a59c106
3c44ecaf4b2e1f2d7269eabef19cbd2e88b3a99c
refs/heads/master
2021-05-02T06:23:05.414371
2014-03-21T18:12:43
2014-03-21T18:12:43
6,092,693
0
2
NOASSERTION
2020-07-25T20:38:17
2012-10-05T15:57:38
Python
UTF-8
Python
false
false
12,935
py
""" @@TR: This code is pretty much unsupported. MondoReport.py -- Batching module for Python and Cheetah. Version 2001-Nov-18. Doesn't do much practical yet, but the companion testMondoReport.py passes all its tests. -Mike Orr (Iron) TODO: BatchRecord.prev/next/prev_batches/next_batches/query, prev.query, next.query. How about Report: .page(), .all(), .summary()? Or PageBreaker. """ import operator, types try: from Cheetah.NameMapper import valueForKey as lookup_func except ImportError: def lookup_func(obj, name): if hasattr(obj, name): return getattr(obj, name) else: return obj[name] # Raises KeyError. ########## CONSTANTS ############################## True, False = (1==1), (1==0) numericTypes = types.IntType, types.LongType, types.FloatType ########## PUBLIC GENERIC FUNCTIONS ############################## class NegativeError(ValueError): pass def isNumeric(v): return type(v) in numericTypes def isNonNegative(v): ret = isNumeric(v) if ret and v < 0: raise NegativeError(v) def isNotNone(v): return v is not None def Roman(n): n = int(n) # Raises TypeError. if n < 1: raise ValueError("roman numeral for zero or negative undefined: " + n) roman = '' while n >= 1000: n = n - 1000 roman = roman + 'M' while n >= 500: n = n - 500 roman = roman + 'D' while n >= 100: n = n - 100 roman = roman + 'C' while n >= 50: n = n - 50 roman = roman + 'L' while n >= 10: n = n - 10 roman = roman + 'X' while n >= 5: n = n - 5 roman = roman + 'V' while n < 5 and n >= 1: n = n - 1 roman = roman + 'I' roman = roman.replace('DCCCC', 'CM') roman = roman.replace('CCCC', 'CD') roman = roman.replace('LXXXX', 'XC') roman = roman.replace('XXXX', 'XL') roman = roman.replace('VIIII', 'IX') roman = roman.replace('IIII', 'IV') return roman def sum(lis): return reduce(operator.add, lis, 0) def mean(lis): """Always returns a floating-point number. """ lis_len = len(lis) if lis_len == 0: return 0.00 # Avoid ZeroDivisionError (not raised for floats anyway) total = float( sum(lis) ) return total / lis_len def median(lis): lis = lis[:] lis.sort() return lis[int(len(lis)/2)] def variance(lis): raise NotImplementedError() def variance_n(lis): raise NotImplementedError() def standardDeviation(lis): raise NotImplementedError() def standardDeviation_n(lis): raise NotImplementedError() class IndexFormats: """Eight ways to display a subscript index. ("Fifty ways to leave your lover....") """ def __init__(self, index, item=None): self._index = index self._number = index + 1 self._item = item def index(self): return self._index __call__ = index def number(self): return self._number def even(self): return self._number % 2 == 0 def odd(self): return not self.even() def even_i(self): return self._index % 2 == 0 def odd_i(self): return not self.even_i() def letter(self): return self.Letter().lower() def Letter(self): n = ord('A') + self._index return chr(n) def roman(self): return self.Roman().lower() def Roman(self): return Roman(self._number) def item(self): return self._item ########## PRIVATE CLASSES ############################## class ValuesGetterMixin: def __init__(self, origList): self._origList = origList def _getValues(self, field=None, criteria=None): if field: ret = [lookup_func(elm, field) for elm in self._origList] else: ret = self._origList if criteria: ret = filter(criteria, ret) return ret class RecordStats(IndexFormats, ValuesGetterMixin): """The statistics that depend on the current record. """ def __init__(self, origList, index): record = origList[index] # Raises IndexError. IndexFormats.__init__(self, index, record) ValuesGetterMixin.__init__(self, origList) def length(self): return len(self._origList) def first(self): return self._index == 0 def last(self): return self._index >= len(self._origList) - 1 def _firstOrLastValue(self, field, currentIndex, otherIndex): currentValue = self._origList[currentIndex] # Raises IndexError. try: otherValue = self._origList[otherIndex] except IndexError: return True if field: currentValue = lookup_func(currentValue, field) otherValue = lookup_func(otherValue, field) return currentValue != otherValue def firstValue(self, field=None): return self._firstOrLastValue(field, self._index, self._index - 1) def lastValue(self, field=None): return self._firstOrLastValue(field, self._index, self._index + 1) # firstPage and lastPage not implemented. Needed? def percentOfTotal(self, field=None, suffix='%', default='N/A', decimals=2): rec = self._origList[self._index] if field: val = lookup_func(rec, field) else: val = rec try: lis = self._getValues(field, isNumeric) except NegativeError: return default total = sum(lis) if total == 0.00: # Avoid ZeroDivisionError. return default val = float(val) try: percent = (val / total) * 100 except ZeroDivisionError: return default if decimals == 0: percent = int(percent) else: percent = round(percent, decimals) if suffix: return str(percent) + suffix # String. else: return percent # Numeric. def __call__(self): # Overrides IndexFormats.__call__ """This instance is not callable, so we override the super method. """ raise NotImplementedError() def prev(self): if self._index == 0: return None else: length = self.length() start = self._index - length return PrevNextPage(self._origList, length, start) def next(self): if self._index + self.length() == self.length(): return None else: length = self.length() start = self._index + length return PrevNextPage(self._origList, length, start) def prevPages(self): raise NotImplementedError() def nextPages(self): raise NotImplementedError() prev_batches = prevPages next_batches = nextPages def summary(self): raise NotImplementedError() def _prevNextHelper(self, start,end,size,orphan,sequence): """Copied from Zope's DT_InSV.py's "opt" function. """ if size < 1: if start > 0 and end > 0 and end >= start: size=end+1-start else: size=7 if start > 0: try: sequence[start-1] except: start=len(sequence) # if start > l: start=l if end > 0: if end < start: end=start else: end=start+size-1 try: sequence[end+orphan-1] except: end=len(sequence) # if l - end < orphan: end=l elif end > 0: try: sequence[end-1] except: end=len(sequence) # if end > l: end=l start=end+1-size if start - 1 < orphan: start=1 else: start=1 end=start+size-1 try: sequence[end+orphan-1] except: end=len(sequence) # if l - end < orphan: end=l return start,end,size class Summary(ValuesGetterMixin): """The summary statistics, that don't depend on the current record. """ def __init__(self, origList): ValuesGetterMixin.__init__(self, origList) def sum(self, field=None): lis = self._getValues(field, isNumeric) return sum(lis) total = sum def count(self, field=None): lis = self._getValues(field, isNotNone) return len(lis) def min(self, field=None): lis = self._getValues(field, isNotNone) return min(lis) # Python builtin function min. def max(self, field=None): lis = self._getValues(field, isNotNone) return max(lis) # Python builtin function max. def mean(self, field=None): """Always returns a floating point number. """ lis = self._getValues(field, isNumeric) return mean(lis) average = mean def median(self, field=None): lis = self._getValues(field, isNumeric) return median(lis) def variance(self, field=None): raiseNotImplementedError() def variance_n(self, field=None): raiseNotImplementedError() def standardDeviation(self, field=None): raiseNotImplementedError() def standardDeviation_n(self, field=None): raiseNotImplementedError() class PrevNextPage: def __init__(self, origList, size, start): end = start + size self.start = IndexFormats(start, origList[start]) self.end = IndexFormats(end, origList[end]) self.length = size ########## MAIN PUBLIC CLASS ############################## class MondoReport: _RecordStatsClass = RecordStats _SummaryClass = Summary def __init__(self, origlist): self._origList = origlist def page(self, size, start, overlap=0, orphan=0): """Returns list of ($r, $a, $b) """ if overlap != 0: raise NotImplementedError("non-zero overlap") if orphan != 0: raise NotImplementedError("non-zero orphan") origList = self._origList origList_len = len(origList) start = max(0, start) end = min( start + size, len(self._origList) ) mySlice = origList[start:end] ret = [] for rel in range(size): abs_ = start + rel r = mySlice[rel] a = self._RecordStatsClass(origList, abs_) b = self._RecordStatsClass(mySlice, rel) tup = r, a, b ret.append(tup) return ret batch = page def all(self): origList_len = len(self._origList) return self.page(origList_len, 0, 0, 0) def summary(self): return self._SummaryClass(self._origList) """ ********************************** Return a pageful of records from a sequence, with statistics. in : origlist, list or tuple. The entire set of records. This is usually a list of objects or a list of dictionaries. page, int >= 0. Which page to display. size, int >= 1. How many records per page. widow, int >=0. Not implemented. orphan, int >=0. Not implemented. base, int >=0. Number of first page (usually 0 or 1). out: list of (o, b) pairs. The records for the current page. 'o' is the original element from 'origlist' unchanged. 'b' is a Batch object containing meta-info about 'o'. exc: IndexError if 'page' or 'size' is < 1. If 'origlist' is empty or 'page' is too high, it returns an empty list rather than raising an error. origlist_len = len(origlist) start = (page + base) * size end = min(start + size, origlist_len) ret = [] # widow, orphan calculation: adjust 'start' and 'end' up and down, # Set 'widow', 'orphan', 'first_nonwidow', 'first_nonorphan' attributes. for i in range(start, end): o = origlist[i] b = Batch(origlist, size, i) tup = o, b ret.append(tup) return ret def prev(self): # return a PrevNextPage or None def next(self): # return a PrevNextPage or None def prev_batches(self): # return a list of SimpleBatch for the previous batches def next_batches(self): # return a list of SimpleBatch for the next batches ########## PUBLIC MIXIN CLASS FOR CHEETAH TEMPLATES ############## class MondoReportMixin: def batch(self, origList, size=None, start=0, overlap=0, orphan=0): bat = MondoReport(origList) return bat.batch(size, start, overlap, orphan) def batchstats(self, origList): bat = MondoReport(origList) return bat.stats() """ # vim: shiftwidth=4 tabstop=4 expandtab textwidth=79
b2ff512a0df75117ebd57c2d358a5b6aadc8575c
d55df3ef17af53557c3492eb3c88457b0317e2d4
/88.两个大数的总和.py
f107635a6d1aa650a9e5e5b8ac4d029f8dd2dcc6
[]
no_license
maryyang1234/hello-world
3b5e1aa0149089ccf171b0555a11b9f8b1c2575f
055ba2ee4f373b4abed1bf5d03860fd2e2d3b3f5
refs/heads/master
2020-05-03T23:28:34.367561
2019-05-26T10:02:26
2019-05-26T10:02:26
178,866,578
0
0
null
null
null
null
UTF-8
Python
false
false
145
py
def sumofTwo(str1,str2): return int(str1)+int(str2) str1 ="7777555511111111" str2 ="3332222221111" print(sumofTwo(str1, str2))
ce7373e5f2d9c30b4958356208d0130ebc49cf20
aba65f60a0e8b97290b014740456ba53a46dc400
/UniqueAI2021SummerCampMission-main/Bayes/Gaussian_Bayes.py
a0cb6822fd11f077c1a0fd48ba461e5f4d4c665b
[ "MIT" ]
permissive
MeteoricShower/UniqueAISummerCampMission--lxy
749576697a789ebb4915026b305efbcc48916502
86fef35961e49efdbe03d5433e055cef58cd2617
refs/heads/main
2023-06-30T13:50:09.064513
2021-07-24T02:04:05
2021-07-24T02:04:05
384,844,879
0
0
null
null
null
null
UTF-8
Python
false
false
3,644
py
# -*- coding=utf-8 -*- # @Time :2021/6/17 11:45 # @Author :LiZeKai # @Site : # @File : Gaussian_Bayes.py # @Software : PyCharm """ 对于连续性数据, 使用GaussBayes 以乳腺癌数据集为例 """ from collections import Counter import numpy as np import pandas as pd import sklearn.model_selection as sml import math from numpy import ndarray, exp, pi, sqrt class GaussBayes: def __init__(self): self.prior = None self.var = None self.avg = None self.likelihood = None self.tag_num = None # calculate the prior probability of p_c def GetPrior(self, label): count_0=0 count_1=0 for i in label: if i==0: count_0+=1 else: count_1+=1 self.prior = [count_0 / len(label), count_1 / len(label)] pass # calculate the average def GetAverage(self, data, label): self.avg=np.zeros((data.shape[1],2),dtype=np.double) for i in range(data.shape[1]): sum_0=0 sum_1=0 count_0 = 0 count_1 = 0 for j in range(data.shape[0]): if label[j]==0: sum_0+=data[j][i] count_0 += 1 elif label[j]==1: sum_1+=data[j][i] count_1 += 1 self.avg[i][0]=sum_0/count_0 self.avg[i][1]=sum_1/count_1 pass # calculate the std def GetStd(self, data, label): self.var = np.zeros((data.shape[1], 2), dtype=np.double) for i in range(data.shape[1]): temp_0 = np.zeros(data.shape[1],dtype=np.double) temp_1 = np.zeros(data.shape[1], dtype=np.double) for j in range(data.shape[0]): if label[j]==0: temp_0 = np.append(temp_0,data[j][i]) elif label[j]==1: temp_1 = np.append(temp_1,data[j][i]) self.var[i][0]=temp_0.var() self.var[i][1]=temp_1.var() pass # calculate the likelihood based on the density function def GetLikelihood(self, x): pc_0 = np.ones(x.shape[0], dtype=np.double) pc_1 = np.ones(x.shape[0], dtype=np.double) for i in range(x.shape[0]): for j in range(x.shape[1]): pc_0[i] *= 1 / (pow(2 * math.pi, 0.5) * self.var[j][0]) * math.exp( -(pow(x[i][j] - self.avg[j][0], 2) / (2 * self.var[j][0]))) pc_1[i] *= 1 / (pow(2 * math.pi, 0.5) * self.var[j][1]) * math.exp( -(pow(x[i][j] - self.avg[j][1], 2) / (2 * self.var[j][1]))) return pc_0, pc_1 pass def fit(self, data, label): self.tag_num = len(np.unique(label)) self.GetPrior(label) self.GetAverage(data, label) self.GetStd(data, label) def predict(self, data): result = [] for i in range(len(test_x)): if self.GetLikelihood(data)[0][i] * self.prior[0] > self.GetLikelihood(data)[1][i] * self.prior[1]: result.append(0) else: result.append(1) return result if __name__ == '__main__': data = pd.read_csv('breast_cancer.csv', header=None) x, y = np.array(data.iloc[:, :-1]), np.array(data.iloc[:, -1]) train_x, test_x, train_y, test_y = sml.train_test_split(x, y, test_size=0.2, random_state=0) model = GaussBayes() model.fit(train_x, train_y) pred_y = model.predict(test_x) correct = np.sum(pred_y == test_y).astype(float) print("Accuracy:", correct / len(test_y))
e8260f00d26c3348cc6276437be51441e4c6c23d
63556137b4e0d590b6cc542bc97bac1ba9fbb1b0
/A06.Q005.py
3a1f816a0899cedd2ec38b0f4c2496cb2164088e
[]
no_license
BrennoBernardoDeAraujo/ALGORITMOS-2019.2
3217109d1258b23ce4f8ef5f65091803c249415f
f9f5ff7f47991a8998329eaeb80b83dfbef8058e
refs/heads/master
2020-07-10T07:57:29.052167
2019-11-29T04:23:11
2019-11-29T04:23:11
204,211,365
1
0
null
null
null
null
UTF-8
Python
false
false
699
py
""" A06.Q005 - Leia uma matriz de ordem n, informada pelo usuário. Calcule a soma dos elementos que estão acima da diagonal principal.""" ordem = int(input('Digite a ordem da matriz: ')) def cria_matriz(): matriz = [] for i in range(ordem): matriz.append([0]*ordem) return matriz elemento_matriz = cria_matriz() resultado = 0 for i in range(ordem): for j in range(ordem): elemento_matriz[i][j] = int( input(f'Digite os elementos [{str(i+1)}][{str(j+1)}]: ')) if j > i: resultado = resultado + elemento_matriz[i][j] print( f'O resultado da soma do diagonal principal da matriz é: {resultado} ')
4872c9f499225b41609f8f51dd238b18e51fe7d8
e079006d43a545baf2e63ef20dfefd6e778f42c2
/Stark/urls.py
d2264c2278b9bed2c799e1f8f8b6ca59594e745d
[]
no_license
wailaifeike/myAdmin
34a41f1f8c7b04defa92d1ed3872888ff5295445
8f79f8232767bae73d0fd0c326232ca33203c7e2
refs/heads/master
2020-04-07T11:10:29.225049
2018-11-20T01:55:46
2018-11-20T01:55:46
158,315,189
0
0
null
null
null
null
UTF-8
Python
false
false
115
py
from django.conf.urls import url,include from Stark import views urlpatterns = [ url(r'',views.acc_login) ]
6f83f7dc50cbc2028bf2c6b1e578b94c2a593cb0
d2c4934325f5ddd567963e7bd2bdc0673f92bc40
/tests/artificial/transf_Quantization/trend_Lag1Trend/cycle_12/ar_/test_artificial_1024_Quantization_Lag1Trend_12__100.py
009dead988ececca3e907ac0f1dc2250b82392ff
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jmabry/pyaf
797acdd585842474ff4ae1d9db5606877252d9b8
afbc15a851a2445a7824bf255af612dc429265af
refs/heads/master
2020-03-20T02:14:12.597970
2018-12-17T22:08:11
2018-12-17T22:08:11
137,104,552
0
0
BSD-3-Clause
2018-12-17T22:08:12
2018-06-12T17:15:43
Python
UTF-8
Python
false
false
275
py
import pyaf.Bench.TS_datasets as tsds import pyaf.tests.artificial.process_artificial_dataset as art art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 12, transform = "Quantization", sigma = 0.0, exog_count = 100, ar_order = 0);
fae7d19d653a4b12515cdbcd3f1631d31fd95118
247db0fd637c6eb357f4be4eb8440e80ab50c323
/captureandupload.py
e7966b68e6d8816cb183704cb979243e189ce2d0
[]
no_license
Akshitha296/Class102
40db773267a1773451da4360e353bdb10f89b5ad
127f32396daf4bb1d68c63da9b45b92acd09fb2e
refs/heads/main
2023-04-04T16:08:32.079047
2021-04-05T02:06:24
2021-04-05T02:06:24
354,690,884
0
0
null
null
null
null
UTF-8
Python
false
false
1,137
py
import cv2 import time import random import dropbox startTime = time.time() def take_snapshot(): rand = random.randint(1, 1000000) videoCaptureObject = cv2.VideoCapture(0) result = True while(result): ret, frame = videoCaptureObject.read() print(ret) img_name = "img"+str(rand)+".png" cv2.imwrite(img_name, frame) startTime = time.time() result = False return(img_name) print("Snapshot Taken. File name is " + img_name) videoCaptureObject.release() cv2.destroyAllWindows() def upload_file(img_name): access_token = 'OgTQw6cs2QcAAAAAAAAAAQzJXCPbcAV6gnWbO-83_A_4hb-ANP53LhNAkKWevbOP' file_from = img_name file_to = "/DontLookAtMyPCImWatchingU/" + img_name dbx = dropbox.Dropbox(access_token) with open(file_from, 'rb') as f: dbx.files_upload(f.read(), file_to, mode = dropbox.files.WriteMode.overwrite) print("File uploaded to dropbox.") def main(): while(True): if(time.time()-startTime>=300): name = take_snapshot() upload_file(name) main()
e13db41af418a2896e05121c9e2d591d24eaa882
9b6b3f4b30e9bd8a821d8df16bd71e62b9c6eb98
/day2/data_structs/conversion_4.py
eedfdf0af2d6d721cb076e44d17b34e8eb93b27a
[]
no_license
shobhit-nigam/snape_mar
b7f2155cfcd83482230c339fe45f9ea851061318
b7b33a767cc00d35a22e40c940b4331e4898c8d5
refs/heads/main
2023-03-25T05:44:21.244078
2021-03-26T05:27:28
2021-03-26T05:27:28
350,555,721
1
1
null
null
null
null
UTF-8
Python
false
false
330
py
# sorted avengers = {'captain':'shield', 'ironman':'suit', 'hulk':['smash', 'science'], 'black widow':'energy'} xmen = ['mystique', 'magneto', 'wolverine'] dc = ('wonder woman', 'batman', 'flash') stra = "hello" print(list(stra)) print(sorted(stra)) print(sorted(dc)) print(sorted(xmen)) print(sorted(avengers))
2a8a2fea5ef6b27e5ad95edd93fb19dddb4b601a
f445450ac693b466ca20b42f1ac82071d32dd991
/generated_tempdir_2019_09_15_163300/generated_part005222.py
554f9ec93f4279524a546fb6081ae0f1d20c7b74
[]
no_license
Upabjojr/rubi_generated
76e43cbafe70b4e1516fb761cabd9e5257691374
cd35e9e51722b04fb159ada3d5811d62a423e429
refs/heads/master
2020-07-25T17:26:19.227918
2019-09-15T15:41:48
2019-09-15T15:41:48
208,357,412
4
1
null
null
null
null
UTF-8
Python
false
false
4,004
py
from sympy.abc import * from matchpy.matching.many_to_one import CommutativeMatcher from matchpy import * from matchpy.utils import VariableWithCount from collections import deque from multiset import Multiset from sympy.integrals.rubi.constraints import * from sympy.integrals.rubi.utility_function import * from sympy.integrals.rubi.rules.miscellaneous_integration import * from sympy import * class CommutativeMatcher68381(CommutativeMatcher): _instance = None patterns = { 0: (0, Multiset({0: 1}), [ (VariableWithCount('i2.2.1.2.2.0', 1, 1, S(0)), Add) ]), 1: (1, Multiset({1: 1}), [ (VariableWithCount('i2.4.0', 1, 1, S(0)), Add) ]) } subjects = {} subjects_by_id = {} bipartite = BipartiteGraph() associative = Add max_optional_count = 1 anonymous_patterns = set() def __init__(self): self.add_subject(None) @staticmethod def get(): if CommutativeMatcher68381._instance is None: CommutativeMatcher68381._instance = CommutativeMatcher68381() return CommutativeMatcher68381._instance @staticmethod def get_match_iter(subject): subjects = deque([subject]) if subject is not None else deque() subst0 = Substitution() # State 68380 subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.2.1.2.2.1.0_1', S(1)) except ValueError: pass else: pass # State 68382 if len(subjects) >= 1: tmp2 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.2.1.2.2.1.0', tmp2) except ValueError: pass else: pass # State 68383 if len(subjects) == 0: pass # 0: x*d yield 0, subst2 subjects.appendleft(tmp2) subst1 = Substitution(subst0) try: subst1.try_add_variable('i2.4.1.0_1', S(1)) except ValueError: pass else: pass # State 68600 if len(subjects) >= 1: tmp5 = subjects.popleft() subst2 = Substitution(subst1) try: subst2.try_add_variable('i2.4.1.0', tmp5) except ValueError: pass else: pass # State 68601 if len(subjects) == 0: pass # 1: x*f yield 1, subst2 subjects.appendleft(tmp5) if len(subjects) >= 1 and isinstance(subjects[0], Mul): tmp7 = subjects.popleft() associative1 = tmp7 associative_type1 = type(tmp7) subjects8 = deque(tmp7._args) matcher = CommutativeMatcher68385.get() tmp9 = subjects8 subjects8 = [] for s in tmp9: matcher.add_subject(s) for pattern_index, subst1 in matcher.match(tmp9, subst0): pass if pattern_index == 0: pass # State 68386 if len(subjects) == 0: pass # 0: x*d yield 0, subst1 if pattern_index == 1: pass # State 68602 if len(subjects) == 0: pass # 1: x*f yield 1, subst1 subjects.appendleft(tmp7) return yield from .generated_part005223 import * from matchpy.matching.many_to_one import CommutativeMatcher from collections import deque from matchpy.utils import VariableWithCount from multiset import Multiset
e01adaee84f82114314f03c60f964781241c70ad
6d9a29bd76cdfcda472eccccc16a5d2f4478ac25
/jinhuiz2-hw6.py
8848729034b97043df180e276352930b9f7698d1
[]
no_license
Jinhuiz2/IE598_F18_HW6
0c16af3d60f4fa41cdac73999286df5a7b96cb6d
a44e21aa600085d1747feef4bb38e82381ee4275
refs/heads/master
2020-03-31T07:03:57.205667
2018-10-08T02:21:44
2018-10-08T02:21:44
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,626
py
from sklearn import datasets from sklearn.tree import DecisionTreeClassifier from sklearn.cross_validation import train_test_split from sklearn import preprocessing from sklearn.metrics import accuracy_score import numpy as np from sklearn.model_selection import cross_val_score #From Iris dataset get iris data, split it with 90% training and 10% test iris = datasets.load_iris() X, y = iris.data, iris.target in_sample = [] out_sample = [] for k in range(1,11): X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.1, random_state=k) scaler = preprocessing.StandardScaler().fit(X_train) dt = DecisionTreeClassifier(max_depth = 6, criterion = 'gini', random_state = 1) dt.fit(X_train, y_train) y_pred_out = dt.predict(X_test) y_pred_in = dt.predict(X_train) out_sample_score = accuracy_score(y_test, y_pred_out) in_sample_score = accuracy_score(y_train, y_pred_in) in_sample.append(in_sample_score) out_sample.append(out_sample_score) print('Random State: %d, in_sample: %.3f, out_sample: %.3f'%(k, in_sample_score, out_sample_score)) in_sample_mean = np.mean(in_sample_score) in_sample_std = np.std(in_sample_score) out_sample_mean = np.mean(out_sample_score) out_sample_std = np.std(out_sample_score) print('In sample mean: %.f' %in_sample_mean) print('In sample standard deviation: %.f' %in_sample_std) print('Out sample mean: %.f' %out_sample_mean) print('Out sample standard deviation: %.f' %out_sample_std) print('\n') in_sample = [] out_sample = [] X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.1, random_state=k) scaler = preprocessing.StandardScaler().fit(X_train) dt = DecisionTreeClassifier(max_depth = 6, criterion = 'gini', random_state = 1) dt.fit(X_train, y_train) y_pred_out = dt.predict(X_test) y_pred_in = dt.predict(X_train) in_sample_score = cross_val_score(dt, X_train, y_train, cv=10) out_sample_score = accuracy_score(y_test, y_pred_out) in_sample.append(in_sample_score) out_sample.append(out_sample_score) print('In sample CV score for every fold:') for i in in_sample_score: print(i) print('Mean of sample CV score: ', np.mean(in_sample_score)) print('Standard deviation of sample CV score: ', np.std(in_sample_score)) print('\n') print("My name is {Jinhui Zhang}") print("My NetID is: {jinhuiz2}") print("I hereby certify that I have read the University policy on Academic Integrity and that I am not in violation.")
b327a3211d631a84607b97fdcdf51a868070f337
34ff00df4e369bb9d4843a8f7bbc74449e95103c
/snake/snake_script.py
2696e2f6f543122d9e6866660e4afb2cf94450e1
[]
no_license
Coritiba019/Jogos-Pygame
f3ad6d1a7cb95eb3c4569c0411f7476905225f8e
33d4d63ef25bfcb0d826d87c08d1a4e5f1045349
refs/heads/main
2023-04-02T07:55:27.702739
2021-04-09T02:26:09
2021-04-09T02:26:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,699
py
import pygame import random from pygame.locals import * from snake.snake import Snake from snake.apple import Apple """ Created by Igor Lovatto Resende N USP 10439099 """ class SnakeGame: FONT_SIZE = 18 PRIME_NUMBERS = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] BLOCK_SIZE = 20 # Size of blocks def __init__(self, screen_size): self.screen_size = screen_size // self.BLOCK_SIZE # The width and height of the screen in number of blocks def mul(self, t, n): return (t[0] * n, t[1] * n) def on_grid_random(self): """ This function calculate a random position for a object on the screen :returns: tuple: Random position """ x = random.randint(0, self.screen_size - 2) y = random.randint(0, self.screen_size - 2) return (x, y) def collision(self, c1, c2): return (c1[0] == c2[0]) and (c1[1] == c2[1]) def prime_apple_randomizer(self): """ This function choose a random prime number from the self.PRIME_NUMBERS list :return: int: Random prime number """ number = random.choice(self.PRIME_NUMBERS) return int(number) def normal_apple_randomizer(self): """ This function chosse a not-prime random number between 0 and 99 :return: int: """ number = random.randint(0 ,99) while number in self.PRIME_NUMBERS: number = random.randint(0, 99) return number def main(self, screen): screen.fill((0, 0, 0)) tutorial1 = """Geraldo é uma cobrinha sapeca e que vive faminta. Sua comida favorita é a fruta maça.""" tutorial2 = """Porém Geraldo é bem especifico, ele só come maçãs que são de numero primo no pé.""" tutorial3 = """INSTRUÇÔES""" tutorial4 = """Para isso ajude Geraldo a se alimentar capturando apenas as maçãs com numeros primos""" tutorial5 = """E utilizando as setas do teclado para se mover""" ##### TUTORIAL ######################## score_font = pygame.font.Font('freesansbold.ttf', 13) score_screen = score_font.render(f'{tutorial1}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 10) screen.blit(score_screen, score_rect) score_font = pygame.font.Font('freesansbold.ttf', 13) score_screen = score_font.render(f'{tutorial2}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 50) screen.blit(score_screen, score_rect) score_font = pygame.font.Font('freesansbold.ttf', 13) score_screen = score_font.render(f'{tutorial3}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 100) screen.blit(score_screen, score_rect) score_font = pygame.font.Font('freesansbold.ttf', 13) score_screen = score_font.render(f'{tutorial4}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 150) screen.blit(score_screen, score_rect) score_font = pygame.font.Font('freesansbold.ttf', 13) score_screen = score_font.render(f'{tutorial5}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 200) screen.blit(score_screen, score_rect) pygame.display.update() pygame.time.wait(9000) snake_skin = pygame.Surface((self.BLOCK_SIZE, self.BLOCK_SIZE)) snake_skin.fill((255, 255, 255)) self.snake = Snake(snake_skin, self.screen_size) prime_apple_sprite = pygame.Surface((self.BLOCK_SIZE, self.BLOCK_SIZE)) prime_apple_sprite.fill((255, 0, 0)) prime_apple = Apple( prime_apple_sprite, # sprite self.on_grid_random(), # pos self.prime_apple_randomizer(), # num pygame.font.SysFont("arial", self.FONT_SIZE) # font ) normal_apple_sprite = pygame.Surface((self.BLOCK_SIZE, self.BLOCK_SIZE)) normal_apple_sprite.fill((255, 0, 0)) normal_apple = Apple( normal_apple_sprite, # sprite self.on_grid_random(), # pos self.normal_apple_randomizer(), # num pygame.font.SysFont("arial", self.FONT_SIZE) # font ) clock = pygame.time.Clock() while True: """ This is the main looping of the game, resposible for update the screen,snake and apples """ clock.tick(10 if self.snake.fast else 5) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() exit() if event.type == KEYDOWN: self.snake.listen(event) if event.key == K_ESCAPE: return if self.snake.collision(prime_apple.pos): prime_apple.change(self.on_grid_random(), self.prime_apple_randomizer()) normal_apple.change(self.on_grid_random(), self.normal_apple_randomizer()) self.snake.grow() self.snake.counter = self.snake.counter+ 1 if self.snake.collision(normal_apple.pos): self.snake.snake_reset() prime_apple.change(self.on_grid_random(), self.prime_apple_randomizer()) normal_apple.change(self.on_grid_random(), self.normal_apple_randomizer()) if self.snake.boundry_collision():# Check the collision with boudaries game_over = True self.game_over_screen(screen) return self.snake.update() screen.fill((0, 0, 0)) prime_apple.drawn(screen, 20) normal_apple.drawn(screen, 20) self.snake.drawn(screen, self.BLOCK_SIZE) pygame.display.update() def game_over_screen(self, screen): """ This is the Game over menu looping. Responsible for the game-over screen and score """ while True: game_over_font = pygame.font.Font('freesansbold.ttf', 75) game_over_screen = game_over_font.render(f'Game Over', True, (255, 255, 255)) game_over_rect = game_over_screen.get_rect() game_over_rect.midtop = (600 / 2, 10) screen.blit(game_over_screen, game_over_rect) score_font = pygame.font.Font('freesansbold.ttf', 30) score_screen = score_font.render(f'Pontuação final: {self.snake.counter}', True, (255, 255, 255)) score_rect = score_screen.get_rect() score_rect.midtop = (600 / 2, 100) screen.blit(score_screen, score_rect) pygame.display.update() pygame.time.wait(500) while True: for event in pygame.event.get(): if event.type == QUIT: pygame.quit() exit() elif event.type == KEYDOWN: if event.key == K_RETURN or event.key == K_KP_ENTER: self.main(screen) elif event.key == K_ESCAPE: return if __name__ == '__main__': pygame.init() screen_size = 20 block_size = 30 screen = pygame.display.set_mode((screen_size * block_size, screen_size * block_size)) pygame.display.set_caption('Snake') game = SnakeGame(screen_size * block_size) game.main(screen) pygame.quit() exit()