blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
281
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
6
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
313 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
18.2k
668M
star_events_count
int64
0
102k
fork_events_count
int64
0
38.2k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
107 values
src_encoding
stringclasses
20 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
4
6.02M
extension
stringclasses
78 values
content
stringlengths
2
6.02M
authors
listlengths
1
1
author
stringlengths
0
175
1d0479b10748363c8598f680dd8ac691974f0c9e
11060ca244940baef96a51d794d73aab44fc31c6
/src/brainstorming/tornado/modbus/pymodbus/__init__.py
0bb3d9b53e2360b44fb5246e72a6c065e1fdb427
[]
no_license
D3f0/txscada
eb54072b7311068a181c05a03076a0b835bb0fe1
f8e1fd067a1d001006163e8c3316029f37af139c
refs/heads/master
2020-12-24T06:27:17.042056
2016-07-27T17:17:56
2016-07-27T17:17:56
3,565,335
9
1
null
null
null
null
UTF-8
Python
false
false
1,280
py
""" Pymodbus: Modbus Protocol Implementation ----------------------------------------- This package can supply modbus clients and servers: client: - Can perform single get/set on discretes and registers - Can perform multiple get/set on discretes and registers - Working on diagnostic/file/pipe/setting/info requets - Can fully scrape a host to be cloned server: - Can function as a fully implemented TCP modbus server - Working on creating server control context - Working on serial communication - Working on funtioning as a RTU/ASCII - Can mimic a server based on the supplied input data TwistedModbus is built on top of the Pymodbus developed from code by: Copyright (c) 2001-2005 S.W.A.C. GmbH, Germany. Copyright (c) 2001-2005 S.W.A.C. Bohemia s.r.o., Czech Republic. Hynek Petrak <[email protected]> Released under the the GPLv2 """ from pymodbus.version import _version __version__ = _version.short().split('+')[0] #---------------------------------------------------------------------------# # Block unhandled logging #---------------------------------------------------------------------------# import logging class NullHandler(logging.Handler): def emit(self, record): pass h = NullHandler() logging.getLogger("pymodbus").addHandler(h)
[ "devnull@localhost" ]
devnull@localhost
ecd8d07132fc023bd95ecb028e217314c73808bb
45846afd99534f4282bf7eac24de37e9b470f603
/Task4_HSV_Red_Tracker.py
346cb18230c06ccd319cbab12563b5e3cac626a9
[]
no_license
therealhuy/180DA-WarmUp
e27c44fe2bb205badcdf6f4eac89d61a0c07ffd8
94700c1e9003b9790af73c2d8448f0f85d0c1f3d
refs/heads/main
2023-01-10T13:11:33.113062
2020-11-12T20:59:43
2020-11-12T20:59:43
300,744,767
0
0
null
null
null
null
UTF-8
Python
false
false
2,003
py
''' This file tracks red objects (in this case I'm using a Tesla bookmark) The following code is adapted from the OpenCV tutorials (changing color space) and contours in particular. Drawing the bounding boxes was taken from stackoverflow, the tutorial was confusing me. Makes sense what s/he did. Modified it to work when no red contours are present (would crash due to attempting to due np.argmax of empty array) ''' import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): # Take each frame from camera _, frame = cap.read() # Convert BGR to HSV hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # define range of blue color in HSV lower_red = np.array([0,130,130]) upper_red = np.array([10,255,255]) # Threshold the HSV image to get only red colors mask = cv2.inRange(hsv, lower_red, upper_red) # Bitwise-AND mask and original image res = cv2.bitwise_and(frame,frame, mask= mask) cv2.imshow('mask',mask) cv2.imshow('res',res) ''' Code within this was taken from https://stackoverflow.com/questions/16538774/dealing-with-contours-and-bounding-rectangle-in-opencv-2-4-python-2-7 The code below basically finds the largest contour and then creates the bounding rectangle. Added in if areas: statement to prevent crash when no red color/contour is found ''' contours, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) areas = [cv2.contourArea(c) for c in contours] if areas: max_index = np.argmax(areas) cnt=contours[max_index] areas = [cv2.contourArea(c) for c in contours] max_index = np.argmax(areas) cnt=contours[max_index] x,y,w,h = cv2.boundingRect(cnt) cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),2) # ------------------------------------------------------------------- cv2.imshow('frame',frame) #cv2.imshow('im4',im4) k = cv2.waitKey(5) & 0xFF if k == 27: break cv2.destroyAllWindows()
d79b27996f9bf2eba24a2b437fc7fa50f14daa8a
3990af3b0f5ea1597ffb6e58530d185127790ade
/example_cBioF_usage/TPOT_pipeline_MO.py
88f8af42eebe792338eb72d0b169acd6c5277ca4
[]
no_license
TimBeishuizen/cBioF
47e0ddc540dfbd44346b7cf4323130b38147db2d
f8ef965ad904e72157527f258bdc7760a795b99a
refs/heads/master
2020-03-30T16:01:19.879298
2018-10-16T08:43:02
2018-10-16T08:43:02
151,389,837
0
0
null
null
null
null
UTF-8
Python
false
false
1,462
py
import numpy as np import pandas as pd from sklearn.ensemble import ExtraTreesClassifier, RandomForestClassifier from sklearn.feature_selection import RFE, SelectPercentile, f_classif from sklearn.model_selection import train_test_split from sklearn.pipeline import make_pipeline, make_union from sklearn.preprocessing import Binarizer from sklearn.svm import LinearSVC from tpot.builtins import StackingEstimator # NOTE: Make sure that the class is labeled 'target' in the data file tpot_data = pd.read_csv('PATH/TO/DATA/FILE', sep='COLUMN_SEPARATOR', dtype=np.float64) features = tpot_data.drop('target', axis=1).values training_features, testing_features, training_target, testing_target = \ train_test_split(features, tpot_data['target'].values, random_state=42) # Score on the training set was:0.04583703480408602 exported_pipeline = make_pipeline( SelectPercentile(score_func=f_classif, percentile=45), RFE(estimator=ExtraTreesClassifier(criterion="entropy", max_features=0.35000000000000003, n_estimators=100), step=0.9500000000000001), Binarizer(threshold=0.8), StackingEstimator(estimator=RandomForestClassifier(bootstrap=False, criterion="gini", max_features=0.25, min_samples_leaf=19, min_samples_split=19, n_estimators=100)), LinearSVC(C=10.0, dual=False, loss="squared_hinge", penalty="l1", tol=0.1) ) exported_pipeline.fit(training_features, training_target) results = exported_pipeline.predict(testing_features)
3701dcb0526d0abec2a1850baf3176ed362ec0d1
d0eb582894eff3c44e3de4bd50f571f9d9ab3a02
/venv/lib/python3.7/site-packages/flake8/plugins/pyflakes.py
018d1c98a1f847fa743d847fa6d66a99ac4dbc0c
[ "MIT" ]
permissive
tdle94/app-store-scrapper
159187ef3825213d40425215dd9c9806b415769e
ed75880bac0c9ef685b2c1bf57a6997901abface
refs/heads/master
2022-12-20T21:10:59.621305
2020-10-28T00:32:21
2020-10-28T00:32:21
247,291,364
1
2
MIT
2022-12-08T03:53:08
2020-03-14T14:25:44
Python
UTF-8
Python
false
false
6,021
py
"""Plugin built-in to Flake8 to treat pyflakes as a plugin.""" # -*- coding: utf-8 -*- from __future__ import absolute_import try: # The 'demandimport' breaks pyflakes and flake8.plugins.pyflakes from mercurial import demandimport except ImportError: pass else: demandimport.disable() import os from typing import List import pyflakes import pyflakes.checker from flake8 import utils FLAKE8_PYFLAKES_CODES = { "UnusedImport": "F401", "ImportShadowedByLoopVar": "F402", "ImportStarUsed": "F403", "LateFutureImport": "F404", "ImportStarUsage": "F405", "ImportStarNotPermitted": "F406", "FutureFeatureNotDefined": "F407", "MultiValueRepeatedKeyLiteral": "F601", "MultiValueRepeatedKeyVariable": "F602", "TooManyExpressionsInStarredAssignment": "F621", "TwoStarredExpressions": "F622", "AssertTuple": "F631", "IsLiteral": "F632", "InvalidPrintSyntax": "F633", "BreakOutsideLoop": "F701", "ContinueOutsideLoop": "F702", "ContinueInFinally": "F703", "YieldOutsideFunction": "F704", "ReturnWithArgsInsideGenerator": "F705", "ReturnOutsideFunction": "F706", "DefaultExceptNotLast": "F707", "DoctestSyntaxError": "F721", "ForwardAnnotationSyntaxError": "F722", "CommentAnnotationSyntaxError": "F723", "RedefinedWhileUnused": "F811", "RedefinedInListComp": "F812", "UndefinedName": "F821", "UndefinedExport": "F822", "UndefinedLocal": "F823", "DuplicateArgument": "F831", "UnusedVariable": "F841", "RaiseNotImplemented": "F901", } class FlakesChecker(pyflakes.checker.Checker): """Subclass the Pyflakes checker to conform with the flake8 API.""" name = "pyflakes" version = pyflakes.__version__ with_doctest = False include_in_doctest = [] # type: List[str] exclude_from_doctest = [] # type: List[str] def __init__(self, tree, file_tokens, filename): """Initialize the PyFlakes plugin with an AST tree and filename.""" filename = utils.normalize_path(filename) with_doctest = self.with_doctest included_by = [ include for include in self.include_in_doctest if include != "" and filename.startswith(include) ] if included_by: with_doctest = True for exclude in self.exclude_from_doctest: if exclude != "" and filename.startswith(exclude): with_doctest = False overlaped_by = [ include for include in included_by if include.startswith(exclude) ] if overlaped_by: with_doctest = True super(FlakesChecker, self).__init__( tree, filename=filename, withDoctest=with_doctest, file_tokens=file_tokens, ) @classmethod def add_options(cls, parser): """Register options for PyFlakes on the Flake8 OptionManager.""" parser.add_option( "--builtins", parse_from_config=True, comma_separated_list=True, help="define more built-ins, comma separated", ) parser.add_option( "--doctests", default=False, action="store_true", parse_from_config=True, help="check syntax of the doctests", ) parser.add_option( "--include-in-doctest", default="", dest="include_in_doctest", parse_from_config=True, comma_separated_list=True, normalize_paths=True, help="Run doctests only on these files", type="string", ) parser.add_option( "--exclude-from-doctest", default="", dest="exclude_from_doctest", parse_from_config=True, comma_separated_list=True, normalize_paths=True, help="Skip these files when running doctests", type="string", ) @classmethod def parse_options(cls, options): """Parse option values from Flake8's OptionManager.""" if options.builtins: cls.builtIns = cls.builtIns.union(options.builtins) cls.with_doctest = options.doctests included_files = [] for included_file in options.include_in_doctest: if included_file == "": continue if not included_file.startswith((os.sep, "./", "~/")): included_files.append("./" + included_file) else: included_files.append(included_file) cls.include_in_doctest = utils.normalize_paths(included_files) excluded_files = [] for excluded_file in options.exclude_from_doctest: if excluded_file == "": continue if not excluded_file.startswith((os.sep, "./", "~/")): excluded_files.append("./" + excluded_file) else: excluded_files.append(excluded_file) cls.exclude_from_doctest = utils.normalize_paths(excluded_files) inc_exc = set(cls.include_in_doctest).intersection( cls.exclude_from_doctest ) if inc_exc: raise ValueError( '"%s" was specified in both the ' "include-in-doctest and exclude-from-doctest " "options. You are not allowed to specify it in " "both for doctesting." % inc_exc ) def run(self): """Run the plugin.""" for message in self.messages: col = getattr(message, "col", 0) yield ( message.lineno, col, "{} {}".format( FLAKE8_PYFLAKES_CODES.get(type(message).__name__, "F999"), message.message % message.message_args, ), message.__class__, )
d334f13335a62cb992368549de87da8292848dcd
9e068ebd43b0092c760cdb5eefb4301259c45a9e
/59CriandoMenuDeOpções.py
2ea92f32b469d54f5f056fd71e1835c61d4d1bc4
[]
no_license
patriciadamasceno33/Python
7c950aa4ed2a80b9efc0fc668938c107474323f4
06d6e24544c0722856be4ade988293a3781cd6e1
refs/heads/master
2023-06-30T15:53:27.580214
2021-08-08T01:36:51
2021-08-08T01:36:51
378,244,343
0
0
null
null
null
null
UTF-8
Python
false
false
1,020
py
from time import sleep n1 = int(input('Primeiro Valor: ')) n2 = int(input('Segundo valor: ')) op = 0 while op != 5: print(''' 1 - Somar 2 - Multiplicar 3 - Maior 4 - Novos números 5 = Sair ''') op = int(input('Escolha sua opcao: ')) if op == 1: result = n1 + n2 print('A soma entre {} + {} é: {}'.format(n1, n2, result)) elif op == 2: result = n1 * n2 print('A multiplicação entre {} e {} é: {}'.format(n1, n2, result)) elif op == 3: if n1 > n2: result = n1 print('O maior numero entre {} e {} é: {}'.format(n1, n2, result)) else: result = n2 print('O maior numero entre {} e {} é: {}'.format(n1, n2, result)) elif op == 4: n1 = int(input('Primeiro Valor: ')) n2 = int(input('Segundo valor: ')) elif op == 5: print('Saindo...') else: print('Opção inválida. Tente novamente!') print('-'*40) sleep(2) print('Fim do programa')
dcb20cccaebebc176ef2304d0cd72b988c59f03b
6262baab2309a5d20a20b96096e8f3878d3dffe3
/resource/migrations/0001_initial.py
7c45a4d82e62846dfa317f155ef1b40fb08fc7a9
[]
no_license
vovaminof/ctsw-rest
0cae51232c910ce9433476cd1da3813f5bf77125
96862fceddef63d4910a08561e2c178f2008ba16
refs/heads/master
2020-03-25T07:10:44.312145
2018-08-04T16:54:45
2018-08-04T16:54:45
143,545,571
0
0
null
null
null
null
UTF-8
Python
false
false
1,571
py
# Generated by Django 2.0.5 on 2018-06-10 04:30 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('active', models.BooleanField(default=True)), ('name', models.CharField(max_length=128)), ('name_pl', models.CharField(max_length=128, null=True)), ('name_en', models.CharField(max_length=128, null=True)), ('order', models.PositiveIntegerField(default=0)), ], options={ 'ordering': ('order',), }, ), migrations.CreateModel( name='Resource', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('active', models.BooleanField(default=True)), ('name', models.CharField(max_length=128)), ('name_pl', models.CharField(max_length=128, null=True)), ('name_en', models.CharField(max_length=128, null=True)), ('link', models.CharField(max_length=256)), ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='resource.Category')), ], ), ]
620cd2171907d5b1e5e1ef3c3d3379f91f34ad8e
54564fcd4205990d5610f39dcb0e3a778037591d
/data_plotting.py
f34746099759f8f86a409e9809ede5cf771f9af8
[]
no_license
amishasacheti/Sign-Language-Recognition-using-SVM
bb50592016f6be37c8422a156679aa3c9c8a2663
42967d80338f2dcb80c659a1f2d858866c08bc06
refs/heads/master
2022-11-16T12:56:24.808663
2020-07-16T18:31:51
2020-07-16T18:31:51
270,957,824
0
0
null
null
null
null
UTF-8
Python
false
false
2,676
py
#display dataset in 3D #STEP 1 import pandas as pd import numpy as np import math from mpl_toolkits import mplot3d %matplotlib inline import matplotlib.pyplot as plt data= np.loadtxt('D:\\final sem project\\dataset of coordinates\\1-hand_gestures\\afternoon_apurve_7.txt') count=len(data) bone_list = [[1, 2],[2,3],[2,4],[3,5],[4,6],[5,7],[6,8],[7,9],[8,10],[2,11],[11,12],[12,13],[12,14],[13,15],[14,16],[15,17],[17,19],[16,18],[18,20]] lis=[[2,3],[3,5],[2,5],[2,4],[4,6],[2,6]] lis = np.array(lis) - 1 lis1=[[3,5],[5,7],[3,7],[4,6],[6,8],[4,8]] lis1 = np.array(lis1) - 1 lis2=[[9,5],[5,7],[9,7],[10,6],[6,8],[10,8]] lis2 = np.array(lis2) - 1 print(count) bone_list = np.array(bone_list) - 1 def findangle(x1,x2,x3,y1,y2,y3,z1,z2,z3): cl=np.array([x1-x3,y1-y3,z1-z3]) cr=np.array([x2-x3,y2-y3,z2-z3]) modcl=np.linalg.norm(cl) modcr=np.linalg.norm(cr) m=modcl*modcr l=np.cross(cl,cr) n=l/m k=np.array([0,0,1]) d=np.dot(n,k) modn=np.linalg.norm(n) modk=np.linalg.norm(k) a=d/(modn*modk) theta=math.acos(a) #angle in radian theta1=(math.pi)-theta angle=(theta1*180)/math.pi #angle in degree #print(angle) #print(theta1*180/math.pi) return angle for i in range(count): #fig, ax = plt.subplots(1, figsize=(3, 8)) fig = plt.figure() #ax = plt.axes(projection='3d') ax = fig.add_subplot(1, 2, 2, projection='3d') ax.set_title('Skeleton') #plt.title('Skeleton') #plt.xlim(-0.8,0.4) #plt.ylim(-1.5,1.5) x=data[i][0::3] y=data[i][1::3] z=data[i][2::3] #ax.scatter(x, y,s=40) ax.scatter3D(x, z,y,s=40) ax.set_xlim(-0.2,0.5) ax.set_ylim(-0.8,1.5) ax.set_zlim(0,2) for bone in bone_list: ax.plot([x[bone[0]], x[bone[1]]],[z[bone[0]], z[bone[1]]], [y[bone[0]], y[bone[1]]],'r') #ax.plot([x[bone[0]], x[bone[1]]], [y[bone[0]], y[bone[1]]],[z[bone[0]], z[bone[1]]], 'r') #ax.plot([z[bone[0]], z[bone[1]]], [x[bone[0]], x[bone[1]]], [y[bone[0]], y[bone[1]]],'r') #display dataset in 2D for i in range(count): fig, ax = plt.subplots(1, figsize=(8, 8)) #fig = plt.figure() #ax = plt.axes(projection='3d') #ax = fig.add_subplot(1, 2, 2, projection='3d') #ax.set_title('Skeleton') plt.title('Skeleton') plt.xlim(-0.8,0.4) plt.ylim(-1.5,1.5) x=data[i][0::3] y=data[i][1::3] z=data[i][2::3] ax.scatter(x, y,s=40) #ax.scatter3D(x, y, z,s=40) #ax.set_xlim(-0.8,-0.1) #ax.set_ylim(-0.5,1.5) #ax.set_zlim(-3,4) for bone in bone_list: ax.plot([x[bone[0]], x[bone[1]]], [y[bone[0]], y[bone[1]]], 'r')
e12591f9ecc1c8fed16803eb18ce0eecbd9e27a2
a5a05ad635d0af5ad97d7a39e1851fc6d4f14d16
/app/models/City.py
57774b71668f18cf2b9ebaf779ba76c5992d71b7
[]
no_license
zyqingning/flask_crud-master
a43a625dcbd0dd51c65de8beec19747b00109210
51af3fa8e1582aa67f07b9b46e601d553deb0a55
refs/heads/master
2023-02-04T14:11:22.064669
2020-03-08T14:57:35
2020-03-08T14:57:35
245,834,017
0
0
null
2023-02-02T05:59:33
2020-03-08T14:56:51
HTML
UTF-8
Python
false
false
449
py
from sqlalchemy import Column, Integer,String,VARCHAR from app.models.Base import Base class City(Base): id = Column(Integer(11), primary_key=True) city_name = Column(VARCHAR(24), nullable=False) pid = Column(Integer(11), nullable=False) deep = Column(Integer(2), nullable=False) pinyin = Column(VARCHAR(100),nullable=False) ext_id = Column(Integer(10), nullable=False) ext_name = Column(VARCHAR(100), nullable=False)
ac8fcee7be310f87e1cf6a7479d7dec05c585cc6
6413fe58b04ac2a7efe1e56050ad42d0e688adc6
/tempenv/lib/python3.7/site-packages/dash_bootstrap_components/_components/CardText.py
c0146873ce75910bc6733eabc85670d925f82320
[ "MIT" ]
permissive
tytechortz/Denver_temperature
7f91e0ac649f9584147d59193568f6ec7efe3a77
9d9ea31cd7ec003e8431dcbb10a3320be272996d
refs/heads/master
2022-12-09T06:22:14.963463
2019-10-09T16:30:52
2019-10-09T16:30:52
170,581,559
1
0
MIT
2022-06-21T23:04:21
2019-02-13T21:22:53
Python
UTF-8
Python
false
false
3,332
py
# AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class CardText(Component): """A CardText component. Keyword arguments: - children (a list of or a singular dash component, string or number; optional): The children of this component - id (string; optional): The ID of this component, used to identify dash components in callbacks. The ID needs to be unique across all of the components in an app. - style (dict; optional): Defines CSS styles which will override styles previously set. - className (string; optional): Often used with CSS to style elements with common properties. - key (string; optional): A unique identifier for the component, used to improve performance by React.js while rendering components See https://reactjs.org/docs/lists-and-keys.html for more info - tag (string; optional): HTML tag to use for the card text, default: p - color (string; optional): Text color, options: primary, secondary, success, warning, danger, info, muted, light, dark, body, white, black-50, white-50.""" @_explicitize_args def __init__(self, children=None, id=Component.UNDEFINED, style=Component.UNDEFINED, className=Component.UNDEFINED, key=Component.UNDEFINED, tag=Component.UNDEFINED, color=Component.UNDEFINED, **kwargs): self._prop_names = ['children', 'id', 'style', 'className', 'key', 'tag', 'color'] self._type = 'CardText' self._namespace = 'dash_bootstrap_components/_components' self._valid_wildcard_attributes = [] self.available_properties = ['children', 'id', 'style', 'className', 'key', 'tag', 'color'] self.available_wildcard_properties = [] _explicit_args = kwargs.pop('_explicit_args') _locals = locals() _locals.update(kwargs) # For wildcard attrs args = {k: _locals[k] for k in _explicit_args if k != 'children'} for k in []: if k not in args: raise TypeError( 'Required argument `' + k + '` was not specified.') super(CardText, self).__init__(children=children, **args) def __repr__(self): if(any(getattr(self, c, None) is not None for c in self._prop_names if c is not self._prop_names[0]) or any(getattr(self, c, None) is not None for c in self.__dict__.keys() if any(c.startswith(wc_attr) for wc_attr in self._valid_wildcard_attributes))): props_string = ', '.join([c+'='+repr(getattr(self, c, None)) for c in self._prop_names if getattr(self, c, None) is not None]) wilds_string = ', '.join([c+'='+repr(getattr(self, c, None)) for c in self.__dict__.keys() if any([c.startswith(wc_attr) for wc_attr in self._valid_wildcard_attributes])]) return ('CardText(' + props_string + (', ' + wilds_string if wilds_string != '' else '') + ')') else: return ( 'CardText(' + repr(getattr(self, self._prop_names[0], None)) + ')')
da83ca1a7a657675498be211e45ed7ce42cbc865
abd7eb1a20c1941dfa48bc9bd6520777ee141caf
/GenPass-Tools/gopass.py
f2f59aab7dc13292177b69cfde0bcc5d453ee64e
[]
no_license
Open-Insecure/PassList
447a848d39845233193eedf6fe393c644a691772
70bb0b52bc42b3a2a528136aeaccc855c101b39f
refs/heads/master
2020-12-30T14:19:31.037471
2017-05-13T02:38:13
2017-05-13T02:38:13
91,303,828
1
0
null
2017-05-15T06:43:44
2017-05-15T06:43:44
null
UTF-8
Python
false
false
4,722
py
#!/usr/bin/env python # -*-coding:utf-8-*- from os.path import exists import optparse import sys __author__ = 'kkk' __date__ = '2016/1/1' R = '\033[31m' # red G = '\033[32m' # green B = '\033[34m' # blue W = '\033[0m' # white (normal) """ 字典生成,攻击个人账号""" def banner(): print B + ''' _______________ ( Your password? ) --------------- o ^__^ o (oo)\_______ (__)\ )\/\/ ||----w | || || [gopass -n xx-xx -b yy-yy-yy] [sort uniq --> good job] ''' + W def print_err(err): sys.exit(R + '[-] ' + err + W) def main(): number = ['00','000','001','111','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017'] letter = [] spe = ['!','@','#','$','%','^','&','*','!@#','!!'] #特殊字符 number += [n for n in range(30)] letter += [chr(l) for l in range(97,123)] parser = optparse.OptionParser('n[ame] b[irth] m[obile] w[save] p[sswd] t[ype] o[ther] >') parser.add_option('-n','--name',dest='name',type='string',\ help='Specify target name') parser.add_option('-b','--birth',dest='birth',type='string',\ help='Specify target birthday') parser.add_option('-m','--mobile',dest='mobile',type='string',\ help='Specify target mobile') parser.add_option('-w','--write',dest='save_f',type='string',\ help='Specify save file') parser.add_option('-p','--pass',dest='pass_f',type='string',\ help='Specify other password wordlist') parser.add_option('-t','--type',dest='type1',type='string',\ help='[number, letter, spe, all]') parser.add_option('-o','--other',dest='other',type='string',\ help='Specify Favorite things [Company,like]') (options, args) = parser.parse_args() name = options.name birth = options.birth mobile = options.mobile save_f = options.save_f pass_f = options.pass_f ty = options.type1 other = options.other if name == None and birth == None: parser.print_help() print_err('Specify target name and birth,using --help') name_list = name.split('-') # 姓 xing = name_list[0] # 名 ming = ''.join(x for x in name_list[1:]) # 姓名结合 xm = name.replace('-','') # 姓名首字母 szm = ''.join(x[0] for x in name_list) # 姓全称名缩写 xm2 = xing + ''.join(x[0] for x in name_list[1:]) # zhang,wei,zhangwei,zhangw,zw name_x = [xing,ming,xm,xm2,szm] birth_list = birth.split('-') # 年 year = birth_list[0] # 年月组合 year2 = year + birth_list[1] # 月日 mothday = ''.join(x for x in birth_list[1:]) # 年后两位与月日结合 year3 = year[2:] + mothday # 年月日 nyr = birth.replace('-','') # 1990,199001,900122,0122,19900122 birth_x = [year,year2,year3,mothday,nyr] #[dic_list.append(n) for n in name_x] dic_list = [n for n in name_x] dic_list += [n.upper() for n in name_x] dic_list += [b for b in birth_x] dic_list += [n+b for n in name_x for b in birth_x] dic_list += [b+n for n in name_x for b in birth_x] dic_list += [n.upper()+b for n in name_x for b in birth_x] dic_list += [b+n.upper() for n in name_x for b in birth_x] dic_list += [n+mobile for n in name_x if mobile] dic_list += [n.upper()+mobile for n in name_x if mobile] # 判断是否使用特殊字符 if ty: # 在姓名后增加数字类 if ty == 'number': [dic_list.append(n+str(nn)) for n in name_x for nn in number] [dic_list.append(str(nn)+n) for n in name_x for nn in number] # 在姓名后增加字母,默认全体小写字母 elif ty == 'letter': [dic_list.append(n+l) for n in name_x for l in letter] # 在姓名后增加特殊符合 elif ty == 'spe': [dic_list.append(n+s) for n in name_x for s in spe] # 全部使用 elif ty == 'all': [dic_list.append(n+str(nn)) for n in name_x for nn in number] [dic_list.append(n+l) for n in name_x for l in letter] [dic_list.append(n+s) for n in name_x for s in spe] else: print_err('Type [number,letter,spe,all]') # 判断是否使用其他 if other: dic_list += [n+str(other) for n in name_x] dic_list += [b+str(other) for b in birth_x] dic_list += [n+b+str(other) for n in name_x for b in birth_x] dic_list += [str(other)] # 判断是否使用弱密码 if pass_f: if exists(pass_f): with open(pass_f,'r') as f: other_list = [x.rstrip() for x in f.readlines() ] dic_list += other_list dic_list += [n+o for n in name_x for o in other_list] dic_list += [b+o for b in birth_x for o in other_list] else: print_err('File not found!') # 保存 if save_f: with open(save_f,'w') as f: [f.writelines(x+'\n') for x in dic_list ] # 不保存就打印出来 else: for x in dic_list: print G + x if __name__ == '__main__': banner() main()
9b73114f7ea4cb451dfbd939500b3c97b30e2d8a
673440c09033912157d1c3767d5308f95755e76a
/ManachersAlgo.py
34e2ae34f01f3af98fb2e6b72aa5e397af5e4c02
[]
no_license
jagadeshwarrao/programming
414193b1c538e37684378233d0532bd786d63b32
1b343251a8ad6a81e307d31b2025b11e0b28a707
refs/heads/master
2023-02-02T19:26:21.187561
2020-12-21T18:21:00
2020-12-21T18:21:00
274,644,612
1
0
null
null
null
null
UTF-8
Python
false
false
1,482
py
def findLongestPalindromicString(text): N = len(text) if N == 0: return N = 2*N+1 L = [0] * N L[0] = 0 L[1] = 1 C = 1 R = 2 i = 0 iMirror = 0 maxLPSLength = 0 maxLPSCenterPosition = 0 start = -1 end = -1 diff = -1 for i in xrange(2,N): iMirror = 2*C-i L[i] = 0 diff = R - i if diff > 0: L[i] = min(L[iMirror], diff) try: while ((i+L[i]) < N and (i-L[i]) > 0) and \ (((i+L[i]+1) % 2 == 0) or \ (text[(i+L[i]+1)/2] == text[(i-L[i]-1)/2])): L[i]+=1 except Exception as e: pass if L[i] > maxLPSLength: maxLPSLength = L[i] maxLPSCenterPosition = i if i + L[i] > R: C = i R = i + L[i] start = (maxLPSCenterPosition - maxLPSLength) / 2 end = start + maxLPSLength - 1 print "LPS of string is " + text + " : ", print text[start:end+1], print "\n", text1 = "babcbabcbaccba" findLongestPalindromicString(text1) text2 = "abaaba" findLongestPalindromicString(text2) text3 = "abababa" findLongestPalindromicString(text3) text4 = "abcbabcbabcba" findLongestPalindromicString(text4) text5 = "forgeeksskeegfor" findLongestPalindromicString(text5) text6 = "caba" findLongestPalindromicString(text6) text7 = "abacdfgdcaba" findLongestPalindromicString(text7) text8 = "abacdfgdcabba" findLongestPalindromicString(text8) text9 = "abacdedcaba" findLongestPalindromicString(text9)
85370d51f765fc9fea6e6a92b81857238daebf61
22d1217a7e8e6cf50bf576c3ede7903b337d641f
/music_scrapper_tt/middlewares.py
fe54885868b95ca801ae521e9b65cc00441aa6be
[]
no_license
06rajesh/music_scraper_tt
4a3351f6fd0eb231385a047ba732eb36bb5d3adc
04f6e1055e1383aa74a552075809fc810040fc4d
refs/heads/master
2020-12-21T21:30:44.047214
2020-01-30T22:05:50
2020-01-30T22:05:50
236,568,518
1
0
null
null
null
null
UTF-8
Python
false
false
3,615
py
# -*- coding: utf-8 -*- # Define here the models for your spider middleware # # See documentation in: # https://docs.scrapy.org/en/latest/topics/spider-middleware.html from scrapy import signals class MusicScrapperTtSpiderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrapy acts as if the spider middleware does not modify the # passed objects. @classmethod def from_crawler(cls, crawler): # This method is used by Scrapy to create your spiders. s = cls() crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) return s def process_spider_input(self, response, spider): # Called for each response that goes through the spider # middleware and into the spider. # Should return None or raise an exception. return None def process_spider_output(self, response, result, spider): # Called with the results returned from the Spider, after # it has processed the response. # Must return an iterable of Request, dict or Item objects. for i in result: yield i def process_spider_exception(self, response, exception, spider): # Called when a spider or process_spider_input() method # (from other spider middleware) raises an exception. # Should return either None or an iterable of Request, dict # or Item objects. pass def process_start_requests(self, start_requests, spider): # Called with the start requests of the spider, and works # similarly to the process_spider_output() method, except # that it doesn’t have a response associated. # Must return only requests (not items). for r in start_requests: yield r def spider_opened(self, spider): spider.logger.info('Spider opened: %s' % spider.name) class MusicScrapperTtDownloaderMiddleware(object): # Not all methods need to be defined. If a method is not defined, # scrapy acts as if the downloader middleware does not modify the # passed objects. @classmethod def from_crawler(cls, crawler): # This method is used by Scrapy to create your spiders. s = cls() crawler.signals.connect(s.spider_opened, signal=signals.spider_opened) return s def process_request(self, request, spider): # Called for each request that goes through the downloader # middleware. # Must either: # - return None: continue processing this request # - or return a Response object # - or return a Request object # - or raise IgnoreRequest: process_exception() methods of # installed downloader middleware will be called return None def process_response(self, request, response, spider): # Called with the response returned from the downloader. # Must either; # - return a Response object # - return a Request object # - or raise IgnoreRequest return response def process_exception(self, request, exception, spider): # Called when a download handler or a process_request() # (from other downloader middleware) raises an exception. # Must either: # - return None: continue processing this exception # - return a Response object: stops process_exception() chain # - return a Request object: stops process_exception() chain pass def spider_opened(self, spider): spider.logger.info('Spider opened: %s' % spider.name)
25e21e843b4abe6d09488f0c8ef76ef4b0042a4a
97878d748b985bca6996636fea9093f5a644ce0c
/ritohelper.py
b4f49aae62509ffe3fdff1119bc03ccb9a348ad0
[]
no_license
Summarum/lolinfo
acada8d81939c76c41e17dbd948dec5b7e3d2e73
5f2406114deb738bf352513a5ec0dbf5d0acaa36
refs/heads/master
2021-01-22T22:44:49.165076
2017-03-20T12:46:13
2017-03-20T12:46:13
85,575,485
0
0
null
null
null
null
UTF-8
Python
false
false
353
py
import sys import json from urllib2 import urlopen riotKey = 'RGAPI-EAFA68C5-28DC-4BCB-835A-66DEAFE6427E' apiURL = urlopen('https://'+sys.argv[1]+'.api.pvp.net/api/lol/'+sys.argv[1]+'/v1.4/summoner/by-name/'+sys.argv[2]+'?api_key='+riotKey) rawJSON = apiURL.read() convertedJSON=json.loads(rawJSON) value = convertedJSON['summarum']['id'] print value
3609cbd86fe366108bed83305f57d5ac02c3ce24
a2dc75a80398dee58c49fa00759ac99cfefeea36
/bluebottle/bb_projects/migrations/0018_auto_20210302_1417.py
69d49b4e0234875309c1a920a6cf0af3e76ba9e8
[ "BSD-2-Clause" ]
permissive
onepercentclub/bluebottle
e38b0df2218772adf9febb8c6e25a2937889acc0
2b5f3562584137c8c9f5392265db1ab8ee8acf75
refs/heads/master
2023-08-29T14:01:50.565314
2023-08-24T11:18:58
2023-08-24T11:18:58
13,149,527
15
9
BSD-3-Clause
2023-09-13T10:46:20
2013-09-27T12:09:13
Python
UTF-8
Python
false
false
956
py
# -*- coding: utf-8 -*- # Generated by Django 1.11.17 on 2021-03-02 13:17 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('bb_projects', '0017_auto_20210302_1417'), ('projects', '0095_auto_20210302_1417'), ('suggestions', '0005_auto_20210302_1417'), ('initiatives', '0030_auto_20210302_1405'), ('members', '0041_auto_20210302_1416'), ] state_operations = [ migrations.DeleteModel( name='ProjectTheme', ), migrations.DeleteModel( name='ProjectThemeTranslation', ), ] operations = [ migrations.SeparateDatabaseAndState( state_operations=state_operations ), migrations.DeleteModel( name='ProjectPhase', ), migrations.DeleteModel( name='ProjectPhaseTranslation', ), ]
d44d5a84fcb47ddaa80fe9b1efb34dd60130c6c4
f7ee49080d4b940e68afbd89357743d9d0e6d32e
/tools/viz/asohelper.py
b1746ab01205c09873f11ebd2450332cf6fbd19f
[ "MIT" ]
permissive
anujpathania/HotSniper
eae261d202ea43f7f529e94c4982995621bd7908
9cd2a8f6473625372d45f9ca315019ce190b143d
refs/heads/master
2023-08-17T20:23:34.313699
2023-08-15T16:28:07
2023-08-15T16:28:07
87,197,006
63
28
NOASSERTION
2023-09-06T16:39:22
2017-04-04T14:31:28
C
UTF-8
Python
false
false
267
py
def get_fp_addsub(f): return f["addpd"] + f["addsd"] + f["addss"] + f["addps"] + f["subpd"] + f["subsd"] + f["subss"] + f["subps"] def get_fp_muldiv(f): return f["mulpd"] + f["mulsd"] + f["mulss"] + f["mulps"] + f["divpd"] + f["divsd"] + f["divss"] + f["divps"]
f2acacf75129142364d47c4372031342a19566a9
1554150a9720ebf35cd11c746f69169b595dca10
/tk_practise/shape_display_view.py
908a4219294e3677bf29d3a5afa33665d56b7ca5
[]
no_license
andrewili/shape-grammar-engine
37a809f8cf78b133f8f1c3f9cf13a7fbbb564713
2859d8021442542561bdd1387deebc85e26f2d03
refs/heads/master
2021-01-18T22:46:51.221257
2016-05-31T21:15:28
2016-05-31T21:15:28
14,129,359
1
0
null
null
null
null
UTF-8
Python
false
false
7,640
py
# shape_display_view.py import Tkinter as tk import tkFileDialog import tkFont import ttk class Observable(object): def __init__(self): self.observers = [] def broadcast(self, widget): for observer in self.observers: observer.respond(widget) def add_observer(self, observer): self.observers.append(observer) class View(tk.Toplevel, Observable): def __init__(self, master): tk.Toplevel.__init__(self, master) self.protocol('WM_DELETE_WINDOW', self.master.destroy) Observable.__init__(self) self.title('Shape display 2014-04-03') self.text_var_a = tk.StringVar() self.text_var_b = tk.StringVar() self.text_var_c = tk.StringVar() self.label_width = 28 self.label_height = 15 self.label_font = ('Andale Mono', '11') self.background_color = '#EEEEEE' self._make_main_frame() self._make_label_frame_a( 0, 0) self._make_spacer( 1, 0) self._make_label_frame_b( 2, 0) self._make_spacer( 3, 0) self._make_label_frame_buttons( 4, 0) self._make_spacer( 5, 0) self._make_label_frame_c( 6, 0) def _make_main_frame(self): self.mainframe = ttk.Frame( self, padding='10 10 10 10') self.mainframe.grid( column=0, row=0, sticky='NSEW') self.mainframe.rowconfigure( 0, weight=1) self.mainframe.columnconfigure( 0, weight=1) def _make_label_frame_a(self, column_in, row_in): self.label_frame_a = ttk.LabelFrame( self.mainframe) self.label_frame_a.grid( column=column_in, row=row_in, sticky='EW') self.canvas_a = self.make_canvas( self.label_frame_a, 0, 0) self.get_lshape_a_button = ttk.Button( self.label_frame_a, width=15, text='Get A', command=(self.get_lshape_a)) self.get_lshape_a_button.grid( column=0, row=2) self.label_a = tk.Label( self.label_frame_a, width=self.label_width, height=self.label_height, textvariable=self.text_var_a, anchor=tk.NW, justify=tk.LEFT, font=self.label_font) self.label_a.grid( column=0, row=3) def _make_label_frame_b(self, column_in, row_in): self.label_frame_b = ttk.LabelFrame( self.mainframe) self.label_frame_b.grid( column=column_in, row=row_in, sticky='EW') self.canvas_b = self.make_canvas( self.label_frame_b, 0, 0) self.get_lshape_b_button = ttk.Button( self.label_frame_b, width=15, text='Get B', command=self.get_lshape_b) self.get_lshape_b_button.grid( column=0, row=2) self.label_b = tk.Label( self.label_frame_b, width=self.label_width, height=self.label_height, textvariable=self.text_var_b, anchor=tk.NW, justify=tk.LEFT, font=self.label_font) self.label_b.grid( column=0, row=3) def _make_label_frame_buttons(self, column_in, row_in): self.label_frame_buttons = ttk.LabelFrame( self.mainframe) self.label_frame_buttons.grid( column=column_in, row=row_in, sticky='NEW') self.result_button_frame_spacer_upper = tk.Label( self.label_frame_buttons, height=5, background=self.background_color) self.result_button_frame_spacer_upper.grid( column=0, row=0) self.get_lshape_a_plus_b_button = ttk.Button( self.label_frame_buttons, width=15, text='A + B', command=self.get_lshape_a_plus_b) self.get_lshape_a_plus_b_button.grid( column=0, row=1) self.get_lshape_a_minus_b_button = ttk.Button( self.label_frame_buttons, width=15, text='A - B', command=self.get_lshape_a_minus_b) self.get_lshape_a_minus_b_button.grid( column=0, row=2) self.get_lshape_a_sub_lshape_b_button = ttk.Button( self.label_frame_buttons, width=15, text='A <= B', command=self.get_lshape_a_sub_lshape_b) self.get_lshape_a_sub_lshape_b_button.grid( column=0, row=3) self.result_button_frame_spacer_lower = tk.Label( self.label_frame_buttons, height=17, background=self.background_color) self.result_button_frame_spacer_lower.grid( column=0, row=4) def _make_label_frame_c(self, column_in, row_in): self.label_frame_c = ttk.LabelFrame( self.mainframe) self.label_frame_c.grid( column=column_in, row=row_in, sticky='NEW') self.canvas_c = self.make_canvas( self.label_frame_c, 0, 0) self.spacer_c = tk.Label( self.label_frame_c, width=2, background=self.background_color, text=' ') self.spacer_c.grid( column=0, row=1) self.label_c = tk.Label( self.label_frame_c, width=self.label_width, height=self.label_height, textvariable=self.text_var_c, anchor=tk.NW, justify=tk.LEFT, font=self.label_font) self.label_c.grid( column=0, row=2) def make_canvas(self, parent, column_in, row_in): canvas = tk.Canvas( parent, width=200, height=200, background='#DDDDDD') # use constant canvas.xview_moveto(0) # move origin to visible area canvas.yview_moveto(0) canvas.grid( column=column_in, row=row_in, sticky='EW') return canvas def _make_spacer(self, column_in, row_in): self.spacer = tk.Label( self.mainframe, width=2, background=self.background_color, text=' ') self.spacer.grid( column=column_in, row=row_in) ## def make_spacer_above_buttons(self, column_in, row_in): ## spacer = tk.Label( ## self.mainframe, ## width=2, ## height=5, ## text=' ') ## spacer.grid( ## column=column_in, ## row=row_in) def get_lshape_a(self): self.file_a = tkFileDialog.askopenfile() self.broadcast(self.get_lshape_a_button) def get_lshape_b(self): self.file_b = tkFileDialog.askopenfile() self.broadcast(self.get_lshape_b_button) def get_lshape_a_plus_b(self): self.broadcast(self.get_lshape_a_plus_b_button) def get_lshape_a_minus_b(self): self.broadcast(self.get_lshape_a_minus_b_button) def get_lshape_a_sub_lshape_b(self): self.broadcast(self.get_lshape_a_sub_lshape_b_button) if __name__ == '__main__': import doctest doctest.testfile('tests/shape_display_view_test.txt')
b3cf8a2a7df390f336d567d193e3c7b558bce83b
3e41ec4d8c82d0f8333eada932988d580d0b8e15
/NQueens/nqueens.py
b8939c0e6f6c27dbf7862e794708c1977fc694d8
[]
no_license
Rakavee/Algorithms
3a68eb380b6b46f93677779c0b054e8e1c2a6dbc
98432dbb97829658997f693d08cb8a1938317a7e
refs/heads/master
2020-04-29T08:55:57.530330
2019-03-20T20:59:36
2019-03-20T20:59:36
175,895,052
0
0
null
null
null
null
UTF-8
Python
false
false
3,970
py
# coding: utf-8 # Source: https://www.sanfoundry.com/python-program-solve-n-queen-problem-without-recursion/ # Source does not use linked lists. # # Linked List implementation of Non-Recursive N-Queens Problem # In[1]: class Node: def __init__(self, right=None, left=None, up=None, down=None, data=None): self.right = right self.left = left self.up = up self.down = down self.data = data # In[2]: class nQueensBoard: def __init__(self, size): self.size = size self.queen_columns = [] #queen_columns[r]=c where r,c denotes the position of the queens on the board. self.nodes=[ [0]*self.size for _ in range(self.size) ] for i in range(self.size): for j in range(self.size): self.nodes[i][j] = Node(data=0) if i > 0: self.nodes[i][j].up = self.nodes[i-1][j] self.nodes[i-1][j].down = self.nodes[i][j] if j > 0: self.nodes[i][j].left = self.nodes[i][j-1] self.nodes[i][j-1].right = self.nodes[i][j] def isSafe(self, column): row = len(self.queen_columns) # check column for qc in self.queen_columns: if column == qc: return False # check diagonal for qr, qc in enumerate(self.queen_columns): if qc - qr == column - row: return False # check other diagonal for qr, qc in enumerate(self.queen_columns): if ((self.size - qc) - qr == (self.size - column) - row): return False return True def print_board(self): current_node = self.nodes[0][0] next_row = current_node.down while(current_node): print("| ",current_node.data, end = " ") if(current_node.right != None): current_node = current_node.right elif(current_node.down != None): current_node = next_row next_row = current_node.down print(' |\n') else: print(' |') break print("................................................................") def fill_board(self): for row in range(self.size): for column in range(self.size): if column == self.queen_columns[row]: self.nodes[row][column].data = "Q" #print('|Q', end=' ') else: self.nodes[row][column].data = "-" #print('|-', end=' ') #print("|") #print("................................................................") self.print_board() def populate(self, size): number_of_solutions = 0 row = 0 column = 0 # iterate over rows of board while True: while column < size: if self.isSafe(column): self.queen_columns.append(column) row += 1 column = 0 break else: column += 1 # if could not find column to place in or if board is full if (column == size or row == size): if row == size: self.fill_board() print() number_of_solutions += 1 self.queen_columns.pop() row -= 1 #backtrack try: prev_column = self.queen_columns.pop() except IndexError: break row -= 1 column = 1 + prev_column print('Number of solutions:', number_of_solutions) # In[3]: n = int(input('Enter n: ')) board1 = nQueensBoard(size = n) board1.populate(n)
2e4eef4d153f95bea110073a05421b1d94936321
9669f20cb574d2da7138890f148dfb71dc7752ca
/Game/Space.py
548c88a1d9ab61c099d1ed1eeb0a58b89691705a
[]
no_license
kamalbowselvam/Organism
83d84a8d5cc2795565a7d663f214a90f162e919e
4893d06320619310c338e57ab6fa560c921ae155
refs/heads/master
2021-07-07T23:11:08.583263
2020-07-10T21:12:41
2020-07-10T21:12:41
142,669,268
1
0
null
null
null
null
UTF-8
Python
false
false
2,470
py
from PyQt5.QtCore import QTimer from PyQt5.QtCore import Qt, QObject, QUrl, QPointF, QLineF from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent,QMediaPlaylist from PyQt5.QtWidgets import QGraphicsItem, QGraphicsPolygonItem, QGraphicsLineItem from PyQt5.QtGui import QBrush, QImage, QPolygonF, QPen from Grounds.PlayGround import PlayGround from Grounds.PlayGroundView import PlayGroundView from Players.Enemy import Enemy from Players.Player import Player from Players.Tower import Tower from Players.Alien import Alien import resoruces class Game(QObject): def __init__(self): super(Game,self).__init__() self.scene = PlayGround() self.scene.setBackgroundBrush(QBrush(QImage(":/Resources/images/BackGround.png"))) self.view = PlayGroundView() self.view.setScene(self.scene) self.player = Player() self.addToGround(self.player) self.tower = Tower() self.addToGround(self.tower) self.gameObjectPosition(self.tower,200,450) # self.alien = Alien() # self.addToGround(self.alien) self.backgroundMusic = QMediaPlayer() self.playList = QMediaPlaylist() self.playList.addMedia(QMediaContent(QUrl("qrc:/Resources/sounds/Game_Background.mp3"))) self.playList.setPlaybackMode(QMediaPlaylist.Loop) self.backgroundMusic.setPlaylist(self.playList) self.backgroundMusic.setVolume(2) self.backgroundMusic.play() self.changeFocus(self.player) self.gameObjectPosition(self.player,750/2,550) self.setSize() self.spawnEnemies() def setSize(self): self.view.setFixedSize(800, 600) self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) def addToGround(self,item): self.scene.addItem(item) def changeFocus(self,item): item.setFlag(QGraphicsItem.ItemIsFocusable) item.setFocus() def playMusic(self): pass def gameObjectPosition(self,item,x,y): item.setPos(x,y) def spawnEnemies(self): self.enemyTimer = QTimer() self.enemyTimer.timeout.connect(lambda: self.launchEnemies()) self.enemyTimer.start(5000) def launchEnemies(self): enemy1 = Enemy() enemy2 = Enemy() self.scene.addItem(enemy1) self.scene.addItem(enemy2) def start(self): self.view.show()
6677355c1c7383d94b434226fae40b8cf76ba2d0
bdf86d69efc1c5b21950c316ddd078ad8a2f2ec0
/venv/Lib/site-packages/twisted/plugins/twisted_core.py
a66ad7f0104dc02e960fa9fecfcfe59830bb8d40
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
DuaNoDo/PythonProject
543e153553c58e7174031b910fd6451399afcc81
2c5c8aa89dda4dec2ff4ca7171189788bf8b5f2c
refs/heads/master
2020-05-07T22:22:29.878944
2019-06-14T07:44:35
2019-06-14T07:44:35
180,941,166
1
1
null
2019-06-04T06:27:29
2019-04-12T06:05:42
Python
UTF-8
Python
false
false
588
py
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. from __future__ import absolute_import, division from twisted.internet.endpoints import ( _SystemdParser, _TCP6ServerParser, _StandardIOParser, _TLSClientEndpointParser) from twisted.protocols.haproxy._parser import ( HAProxyServerParser as _HAProxyServerParser ) systemdEndpointParser = _SystemdParser() tcp6ServerEndpointParser = _TCP6ServerParser() stdioEndpointParser = _StandardIOParser() tlsClientEndpointParser = _TLSClientEndpointParser() _haProxyServerEndpointParser = _HAProxyServerParser()
5f734dd61d2dc73ff8eb5d7a63974db7dc11b249
98aae6242ce9c03d873bd1ccc900aa7c0785bdfc
/index.py
44ad0dfb833fea8a3fc968732092dc51c2eca67d
[]
no_license
CarlosTorres0929/SQLite
5cdb4c9098cb4405382a3aea3a01f73ea79d8918
b14723cbafda23036d05750750f2e70781fd5d8e
refs/heads/master
2020-09-10T20:30:47.094536
2019-11-15T02:24:54
2019-11-15T02:24:54
221,827,111
1
0
null
null
null
null
UTF-8
Python
false
false
921
py
import sqlite3 conexion = sqlite3.connect('ejemplo.db') # Creamos el cursor cursor = conexion.cursor() # Ahora crearemos una tabla de usuarios para almacenar nombres, edades y emails # cursor.execute("CREATE TABLE usuarios (nombre VARCHAR(100), edad INTEGER, email VARCHAR(100))") # Guardamos los cambios haciendo un commit # cursor.execute("INSERT INTO usuarios VALUES ('Carlos',21,'[email protected]')") #cursor.execute("SELECT * FROM usuarios") #print(cursor) #usuario = cursor.fetchone() #print(usuario[2]) #usuarios = [ # ('Veronica',25,'[email protected]'), # ('ibarguen',32,'[email protected]'), # ('yuli',40,'[email protected]'), #] #cursor.executemany("INSERT INTO usuarios VALUES (?,?,?)", usuarios) #cursor.execute("SELECT * FROM usuarios") #usuarios = cursor.fetchall() #for usuario in usuarios: #print("Nombre: ",usuario[0],"Email: ",usuario[2]) conexion.commit() conexion.close()
b0b4eea997a14d786631185ea489b042e1b6f259
e48833b214d2673ac885f054172c78ff3db43c0a
/projectX6_orm/projectX6_orm/settings.py
32c8a7e1965b80ab9f2d0497289508cf6704f8fd
[]
no_license
abhay2701/summertraining
17fa4e3c077599e2330ad47db587f867674bae62
c5c8e32cbf3f0b1810cf32a0f186411d679b19f6
refs/heads/master
2020-06-03T22:19:19.551629
2019-06-13T11:50:00
2019-06-13T11:50:00
191,754,541
0
0
null
null
null
null
UTF-8
Python
false
false
3,190
py
""" Django settings for projectX6_orm project. Generated by 'django-admin startproject' using Django 1.11.17. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATE_DIR=os.path.join(BASE_DIR,"templates") # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '0lna-4ea%wpug6!6@@yqpsrvpw%wa7_&vx68e61)*+a!4(+i!e' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'app', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'projectX6_orm.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_DIR], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'projectX6_orm.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/1.11/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/'
dcce7008aeaa2f6a8191887d40a8f758804f095e
75a54aa657a37be88fd96fc39856156452770aa4
/reviews_analytics.py
d6cc40a22050844fbb0809d88f622c891d5c6caf
[]
no_license
smileymak2/reviews_analytics
54e7f4c93af4af2341ba2afa29af45edf7b6ef51
c9ae91c6815e89d8cd4094ca3579db4dc5c8794e
refs/heads/main
2023-06-01T11:33:10.929883
2021-06-13T09:44:08
2021-06-13T09:44:08
376,487,792
0
0
null
null
null
null
UTF-8
Python
false
false
672
py
data = [] count = 0 with open('reviews.txt', 'r') as f: for line in f: data.append(line) count += 1 if count % 100000 == 0: print(len(data)) print('檔案讀取完了, 總共有', len(data), '筆資料') sum_len = 0 for d in data: sum_len += len(d) print('留言的平均長度為', sum_len / len(data), '筆') new = [] for d in data: if len(d) < 100: new.append(d) print('一共有', len(new), '筆留言長度小於100') print(new[0]) print('共有', len(new[0]), '字母') print(new[5]) print('共有', len(new[5]), '字母') good = [] for d in data: if 'good' in d: good.append(d) print('一共有', len(good), '筆留言含有good') print(good[0])
faa874034f386b9cb6efe06855a52bfea58d1d2a
a8c240cbcc9de81a12e2858357d677061182ad9a
/server.py
92319cd174fbdae4861d23e17aaa58261241242b
[ "Apache-2.0" ]
permissive
saiflakhani/cumminsPrototype
956b8242bf176474e4da4f38575670833419cb7b
8c3c08b3ebd90fcb32dc206657292053c4540818
refs/heads/master
2023-02-28T14:12:50.085810
2021-02-03T15:22:41
2021-02-03T15:22:41
335,256,582
0
0
null
null
null
null
UTF-8
Python
false
false
1,917
py
""" Main module of the server file """ # 3rd party moudles from flask import render_template, Flask import connexion import db import mqtt_messaging from flask_cors import CORS, cross_origin from config import FLASK_HOST, FLASK_PORT import logging from art import tprint # Create the application instance app = Flask(__name__, template_folder="./frontend", static_folder="./frontend") app2 = connexion.App(__name__, specification_dir="./") app2.app = Flask(__name__, template_folder="./frontend", static_folder="./frontend", static_url_path="/") cors = CORS(app2.app) # Read the swagger.yml file to configure the endpoints app2.add_api("swagger.yml") # api_doc(app2.app, config_path='swagger.yml', url_prefix='/api/ui_new', title='API doc') # app2.app.after_request(set_cors_headers_on_response) log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) # create a URL route in our application for "/" @app2.route("/") @cross_origin() def home(): """ This function just responds to the browser URL localhost:5000/ :return: the rendered template "home.html" """ return render_template('home.html') @app2.route("/jitsi") @cross_origin() def jitsi(): """ This function just responds to the browser URL localhost:5000/ :return: the rendered template "home.html" """ return render_template('jitsi.html') ## FOR CORS def set_cors_headers_on_response(response): response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With' response.headers['Access-Control-Allow-Methods'] = 'OPTIONS' return response if __name__ == "__main__": tprint("CUMMINS", font="starwars") print("Creating all tables...") db.create_all_tables() print("Initialising MQTT...") mqtt_messaging.init_mqtt() app2.run(host=FLASK_HOST, port=FLASK_PORT, debug=False)
ac75b4bcad0db11a6a4a445c63f3cf1f7500903a
2288c4fa9a573f674c45b389523b862d29ba1573
/CCS source code/chat.py
3d785f7a9ede4cf95f7a0576c205836b4b1aa04e
[]
no_license
new482/community-chat-system
d8e03ed2601bcecfcea07ba4a0dc307fa7752fe5
16271cc9fa7ab228490b34eab49f99388f377035
refs/heads/master
2021-01-10T07:08:56.607580
2015-11-25T18:08:18
2015-11-25T18:08:18
46,878,285
0
0
null
null
null
null
UTF-8
Python
false
false
19,575
py
#!/usr/bin/env python import socket import sys import select import os import string import struct import time import fcntl import thread from datetime import datetime as dt MCAST_GRP = '224.1.1.1' MCAST_PORT = 8888 addressInNetwork = [] send_address = (MCAST_GRP, MCAST_PORT) # Set the address to send to s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # Create Datagram Socket (UDP) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # Make Socket Reusable s.setblocking(False) # Set socket to non-blocking mode s.bind((MCAST_GRP, MCAST_PORT)) mreq = struct.pack("4sl", socket.inet_aton(MCAST_GRP), socket.INADDR_ANY) s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) print "Accepting connections on port", hex(MCAST_PORT) def getLine(): inputReady,outputReady,exceptionReady = select.select([sys.stdin],[],[],0.0001) for socketSelect in inputReady: if socketSelect == sys.stdin: input = sys.stdin.readline() return input return False def checkBug(checkRoom): flag = False try: roomNumber = int(checkRoom) if (roomNumber==1) or (roomNumber==2) or (roomNumber==3) or (roomNumber==4): flag = True except: pass return flag def getip(name): s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) return socket.inet_ntoa( fcntl.ioctl( s.fileno(), 0x8915, struct.pack('256s',name[:15]) )[20:24] ) def sendRequestFiles(): print "REQUEST FILES" s.sendto("ASK-FILE", send_address) def mergefile(file, fileName): masterContent = "" someOneContent = file.split("\n") myfile = open(fileName, 'r') myfile = myfile.read() myContent = myfile.split("\n") for index1 in range(len(myContent)): if myContent[index1]: masterContent += myContent[index1] + "\n" for index2 in range(len(someOneContent)): if someOneContent[index2] not in masterContent: if someOneContent[index2]: masterContent += someOneContent[index2] + "\n" sortBydate(masterContent,fileName) myfile.close() def mergeuserfile(file, filename): if "***@user" in file: container = file.split("***@user") file = container[1] masteruser = "" updatinguser = file.split("\n") myuserfile = open(filename, 'r') myuserfile = myuserfile.read() checkuserfile = myuserfile.split("\n") for index1 in range(len(checkuserfile)): if checkuserfile[index1]: masteruser += checkuserfile[index1] + "\n" for index2 in range(len(updatinguser)): if updatinguser[index2] not in masteruser: if updatinguser[index2]: masteruser += updatinguser[index2] + "\n" writefile = open(filename,'w') writefile.write(masteruser) writefile.close() def sortBydate(file,fileName): masterSorted = "" splitLine = file.split('\n') spliterSize = len(splitLine) - 1 for outline in range(spliterSize): outdate = dt.strptime('Mon Jan 01 00:00:00 3000', "%a %b %d %H:%M:%S %Y") outString = "" for inline in range(spliterSize): inspliteLine = splitLine[inline].split('|') indateTemp = inspliteLine[2] indate = dt.strptime(indateTemp, "%a %b %d %H:%M:%S %Y") if splitLine[inline] not in masterSorted: if outdate > indate : outdate = indate outString = splitLine[inline] masterSorted += outString + "\n" writefile = open(fileName, 'w') writefile.write(masterSorted) writefile.close() def callThread(): #start thread dispatch thread.start_new_thread(dispatch, ()) def dispatch(): time.sleep(86400) #delete history every 24 hours deleteHistory() def deleteHistory(): f1 = open('log1.txt', 'w') f1.write("") f1.close() f2 = open('log2.txt', 'w') f2.write("") f2.close() f3 = open('log3.txt', 'w') f3.write("") f3.close() f4 = open('log4.txt', 'w') f4.write("") f4.close() def signin(): while True: registered = raw_input("Do you have an account? [Yes/No]") if registered.lower() == "yes": while True: id = raw_input("Username:") pw = raw_input("Password:") userlist = open('userlist.txt', 'r') loginuser = id+"||!^"+pw islogin = userlist.read() checklogin = islogin.split("\n") for index1 in range(len(checklogin)): if loginuser == checklogin[index1]: #print loginuser logginguser = loginuser.split("||!^") loguser = logginguser[0] print "Logged in as: %s" % (loguser) return loguser print "Username or password is invalid" elif registered.lower() == "no": signup() def signup(): while True: newid = raw_input("Set your username:") newpwd = raw_input("Your password:") chkpwd = raw_input("Password confirmation:") signupdelimeter = "||!^" if newpwd == chkpwd: userlist = open('userlist.txt','r') existuser = newid+signupdelimeter content = userlist.read() if existuser in content: print "This username has already been taken" else: userlist.close() userlist = open('userlist.txt','a') insertuser = newid+signupdelimeter+newpwd userlist.write('%s' %(insertuser)) userlist.write('\n') userlist.close() newuser = open('newuser.txt','a') newuser.write('%s' %(insertuser)) newuser.write('\n') newuser.close() print "Your account has been created" return else: print "Password does not match" def checktime(starttime): start = starttime end = time.time() elapse = end - start if elapse > 5: timetoupdate() start = time.time() #print "user sent" return start def timetoupdate(): newuserlist = open('userlist.txt','r') chkuser = newuserlist.read() s.sendto("***@user"+chkuser,send_address) #Split Message def spliter(msg, n): for i in xrange(0, len(msg), n): yield msg[i:i+n] def main(): maxtime = 1500 timeout = 0 isRoomSelected = 0 isSendAsk = 0 isFinishRequest = 0 myAddress = getip('wlan0') callThread() currentuser = signin() starttime = time.time() message_header = "HEADER" message1 = [] message2 = [] message3 = [] message4 = [] message5 = [] full_msg1 = "" full_msg2 = "" full_msg3 = "" full_msg4 = "" full_msg5 = "" MTU = 1500 isHeader1 = True isHeader2 = True isHeader3 = True isHeader4 = True isHeader5 = True isSendHeader1 = True isSendHeader2 = True isSendHeader3 = True isSendHeader4 = True isSendHeader5 = True #print starttime #print "This is in main loop" #print currentuser while True: try: if isRoomSelected == 0: if isSendAsk == 0: sendRequestFiles() isSendAsk =1 while isFinishRequest == 0: if timeout == maxtime: isFinishRequest = 1 else: timeout = timeout + 1 message, address = s.recvfrom(8192) print "Merge File" ##MTU:before goto merge, concat message first if "***1H" in message: if message_header in message: message = message.split("***1H") data = message[1] message_size1 = int(str(data[len(message_header):])) elif "***2H" in message: if message_header in message: message = message.split("***2H") data = message[1] message_size2 = int(str(data[len(message_header):])) elif "***3H" in message: if message_header in message: message = message.split("***3H") data = message[1] message_size3 = int(str(data[len(message_header):])) elif "***4H" in message: if message_header in message: message = message.split("***4H") data = message[1] message_size4 = int(str(data[len(message_header):])) elif "***5H" in message: if message_header in message: message = message.split("***5H") data = message[1] message_size5 = int(str(data[len(message_header):])) elif "***@1Z" in message: container = message.split("***@1Z") mergefile(container[1], "log1.txt") elif "***@1SZ" in message: print "Merge fragment" container = message.split("***@1SZ") #print container[0]+container[1] message1.append(container[1]) full_msg1 = "".join(message1) print "full_msg"+str(len(full_msg1)) if len(full_msg1) >= message_size1: print "msg-size"+str(message_size1) mergefile(full_msg1, "log1.txt") print "After Merge" elif "***@2Z" in message: container = message.split("***@2Z") mergefile(container[1], "log2.txt") elif "***@2SZ" in message: print "Prepare Merge" container = message.split("***@2SZ") #print container[0]+container[1] message2.append(container[1]) full_msg2 = "".join(message2) print "full_msg"+str(len(full_msg2)) if len(full_msg2) >= message_size2: print "msg-size"+str(message_size2) mergefile(full_msg2, "log2.txt") print "After Merge" elif "***@3Z" in message: container = message.split("***@3Z") mergefile(container[1], "log3.txt") elif "***@3SZ" in message: print "Prepare Merge" container = message.split("***@3SZ") #print container[0]+container[1] message3.append(container[1]) full_msg3 = "".join(message3) print "full_msg"+str(len(full_msg3)) if len(full_msg3) >= message_size3: print "msg-size"+str(message_size3) mergefile(full_msg3, "log3.txt") print "After Merge" elif "***@4Z" in message: container = message.split("***@4Z") mergefile(container[1], "log4.txt") elif "***@4SZ" in message: print "Prepare Merge" container = message.split("***@4SZ") #print container[0]+container[1] message4.append(container[1]) full_msg4 = "".join(message4) print "full_msg"+str(len(full_msg4)) if len(full_msg4) >= message_size4: print "msg-size"+str(message_size4) mergefile(full_msg4, "log4.txt") print "After Merge" elif "***@user" in message: container = message.split("***@user") mergeuserfile(container[1], "userlist.txt") elif "***@userS" in message: print "Prepare Merge" container = message.split("***@userS") #print container[0]+container[1] message5.append(container[1]) full_msg5 = "".join(message5) print "full_msg"+str(len(full_msg5)) if len(full_msg5) >= message_size5: print "msg-size"+str(message_size5) mergefile(full_msg5, "userlist.txt") print "After Merge" roomNumber = raw_input("Enter Room Number [1,2,3,4]: ") if checkBug(roomNumber): isRoomSelected = 1 f0 = open('log'+roomNumber +'.txt', 'r') #print chat history print(f0.read()) f0.close() else: message, address = s.recvfrom(8192) starttime = checktime(starttime) if message != "ASK-FILE": if "||!^" in message: mergeuserfile(message,'userlist.txt') elif "***@1Z" not in message and "***@2Z" not in message and "***@3Z" not in message and "***@4Z" not in message and "***@user" not in message: message = message.split("|") RCVTime = message[0] RCVRoom = message[1] RCVInput = message[2] RCVcurrentuser = message[3] f1 = open('log1.txt', 'a') f2 = open('log2.txt', 'a') f3 = open('log3.txt', 'a') f4 = open('log4.txt', 'a') if RCVRoom == "1" : f1.write('%s|%s|%s|%s|%s'.rstrip('\n') %(RCVcurrentuser,address,RCVTime,RCVRoom,RCVInput)) elif RCVRoom == "2" : f2.write('%s|%s|%s|%s|%s'.rstrip('\n') %(RCVcurrentuser,address,RCVTime,RCVRoom,RCVInput)) elif RCVRoom == "3" : f3.write('%s|%s|%s|%s|%s'.rstrip('\n') %(RCVcurrentuser,address,RCVTime,RCVRoom,RCVInput)) elif RCVRoom == "4" : f4.write('%s|%s|%s|%s|%s'.rstrip('\n') %(RCVcurrentuser,address,RCVTime,RCVRoom,RCVInput)) f1.close() f2.close() f3.close() f4.close() if RCVInput and roomNumber == RCVRoom: print RCVcurrentuser, address , RCVTime , RCVRoom , RCVInput else: if myAddress not in address: if message == "ASK-FILE": print "SEND FILES" ff1 = open('log1.txt', 'r') ff2 = open('log2.txt', 'r') ff3 = open('log3.txt', 'r') ff4 = open('log4.txt', 'r') readuserlist = open('userlist.txt', 'r') file1 = ff1.read() file2 = ff2.read() file3 = ff3.read() file4 = ff4.read() alluser = readuserlist.read() ##Handle MTU if len(file1) < MTU: print "file1 < MTU" s.sendto("***@1Z"+file1, send_address) else: print "file1 > MTU" if isSendHeader1: header = "HEADER" + str(len(file1)) if (len(header) < 20): blank = 20 - len(header) header = header + (' ' * blank) s.sendto("***1H"+header, send_address) isSendHeader1 = False for data in spliter(file1,MTU): print str(len(data)) s.sendto("***@1SZ"+data, send_address) if len(file2) < MTU: print "file2 < MTU" s.sendto("***@2Z"+file2, send_address) else: print "file2 > MTU" if isSendHeader2: header = "HEADER" + str(len(file2)) if (len(header) < 20): blank = 20 - len(header) header = header + (' ' * blank) s.sendto("***2H"+header, send_address) isSendHeader2 = False for data in spliter(file2,MTU): print str(len(data)) s.sendto("***@2SZ"+data, send_address) if len(file3) < MTU: print "file3 < MTU" s.sendto("***@3Z"+file3, send_address) else: print "file3 > MTU" if isSendHeader3: header = "HEADER" + str(len(file3)) if (len(header) < 20): blank = 20 - len(header) header = header + (' ' * blank) s.sendto("***3H"+header, send_address) isSendHeader3 = False for data in spliter(file3,MTU): print str(len(data)) s.sendto("***@3SZ"+data, send_address) if len(file4) < MTU: print "file4 < MTU" s.sendto("***@4Z"+file4, send_address) else: print "file4 > MTU" if isSendHeader4: header = "HEADER" + str(len(file4)) if (len(header) < 20): blank = 20 - len(header) header = header + (' ' * blank) s.sendto("***4H"+header, send_address) isSendHeader4 = False for data in spliter(file4,MTU): print str(len(data)) s.sendto("***@4SZ"+data, send_address) if len(alluser) < MTU: print "alluserfile < MTU" s.sendto("***@user"+alluser, send_address) else: print "alluserfile > MTU" if isSendHeader5: header = "HEADER" + str(len(alluser)) if (len(header) < 20): blank = 20 - len(header) header = header + (' ' * blank) s.sendto("***5H"+header, send_address) isSendHeader5 = False for data in spliter(alluser,MTU): print str(len(data)) s.sendto("***@userS"+data, send_address) ff1.close() ff2.close() ff3.close() ff4.close() readuserlist.close() print "END SEND FILES" except: pass input = getLine() if input: localtime = time.asctime(time.localtime(time.time())) s.sendto(localtime+"|"+roomNumber+"|"+input+"|"+currentuser, send_address) if __name__ == '__main__': main()
5cd97eef24dc0d66d8ad96a005553d4bd3d1f235
ba5c0aebbca1038995a5f9dce60278184f348ff9
/triplesum.py
effa4594c2f062f2366f8b72a874204f9159e48f
[ "MIT" ]
permissive
rresender/python-samples
fda485aaa016867612885589898dd9a56cd558c9
2fb2330f59f3cc0c6b975381e22268a758773b69
refs/heads/master
2020-09-17T01:13:30.786118
2020-02-28T15:44:05
2020-02-28T15:44:05
223,943,288
0
0
null
null
null
null
UTF-8
Python
false
false
588
py
def triplets(a, b, c): a = distinct(a) b = distinct(b) c = distinct(c) ini = mid = end = triple = 0 while mid < len(b): while ini < len(a) and a[ini] <= b[mid]: ini += 1 while end < len(c) and c[end] <= b[mid]: end += 1 triple += ini * end mid += 1 return triple def distinct(x): return list(sorted(set(x))) if __name__ == '__main__': triplets([3, 5, 7],[3, 6],[4, 6, 9]) triplets([1, 3, 5],[2, 3],[1, 2, 3]) print(triplets([1, 3, 5, 7],[5, 7, 9],[7, 9, 11, 13])) print(triplets([1, 4, 5],[2, 3, 3],[1, 2, 3]))
0fbc3c0d1ea493c7b8c03b62c9104b1f4803931c
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/2/ef3.py
7ea48f160f18a4c7e1914e1c32d84b3d8df9be75
[]
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] == 'eF3': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
5bc8073cfa36a998bb67cbfb0078c319d984d68b
f561a219c57bd75790d3155acac6f54299a88b08
/city/migrations/0010_auto_20170406_1957.py
c4a0d52767af5f7c0852ea55762bea83e23cf8ea
[]
no_license
ujjwalagrawal17/OfferCartServer
1e81cf2dc17f19fa896062c2a084e6b232a8929e
b3cd1c5f8eecc167b6f4baebed3c4471140d905f
refs/heads/master
2020-12-30T15:31:04.380084
2017-05-24T18:26:20
2017-05-24T18:26:20
91,155,405
1
0
null
null
null
null
UTF-8
Python
false
false
472
py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-04-06 19:57 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('city', '0009_auto_20170406_1951'), ] operations = [ migrations.AlterField( model_name='citydata', name='name', field=models.CharField(blank=True, max_length=255, null=True), ), ]
0fc0e4812b3eb8ad4a7e249f78fe06865f06f248
759cd1775924f87c20efcd76173a04d08ce3be33
/osa11-18_tilauskirja/test/test_tilauskirja3.py
5f454d32a7816d2095d79336bd0fc6e262af873d
[]
no_license
niinasaarelainen/ohja-2020-python
7ea454a012d58a6a0f74990785e2471f8d9d9558
85fdf86ec954664d261567ca72d319861924f55d
refs/heads/main
2023-02-05T10:02:47.742550
2020-12-20T15:35:39
2020-12-20T15:35:39
323,090,427
0
0
null
null
null
null
UTF-8
Python
false
false
4,973
py
import unittest from unittest.mock import patch from tmc import points, reflect from tmc.utils import load, load_module, reload_module, get_stdout, check_source from functools import reduce import os import os.path import textwrap from random import choice, randint from datetime import date, datetime, timedelta exercise = 'src.koodi' def f(attr: list): return ",".join(attr) def s(l: list): return "\n".join(l) def ss(l: list): return "\n".join([f'{s}' for s in l]) def tt(x): status = "EI VALMIS" if not x[3] else "VALMIS" return f"{x[0]} ({x[1]} tuntia), koodari {x[2]} {status}" def ook(val, tt): if len(val) != len(tt): return False for v in val: ouk = False for t in tt: if ok(v, t[0], t[1], t[2], t[3]): ouk = True if not ouk: return False return True def ok(tehtava, kuvaus, koodari, tyomaara, status=False): return tehtava.kuvaus == kuvaus and tehtava.koodari == koodari and tehtava.tyomaara == tyomaara and tehtava.on_valmis() == status @points('11.tilauskirja_osa4') class TilauskirjaOsa4Test(unittest.TestCase): @classmethod def setUpClass(cls): with patch('builtins.input', side_effect=["0"]): cls.module = load_module(exercise, 'fi') def test_1_koodarin_status(self): reload_module(self.module) from src.koodi import Tilauskirja, Tehtava koodi = """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) t.koodarin_status("Antti") """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) try: val = t.koodarin_status("Antti") except Exception as e: self.fail(f'Koodin {koodi}suoritus aiheutti virheen\n{e}\nOnhan metodi koodarin_status(self, koodari: str) määritelty?') taip = str(type(val)).replace("<class '","").replace("'>","") self.assertTrue(type(val) == type(()), f"Kon suoritetaan{koodi}paluuarvon pitäisi olla tuple, nyt sen tyyppi on {taip}") odotettu = 4 self.assertTrue(len(val)==odotettu, f"Kun suoritetaan {koodi}\npitäisi palauttaa tuple, jonka pituus on {odotettu}, palautetun tuplen pituus oli {len(val)}") valx = val for i in [0,1,2,3]: val = valx[i] taip = str(type(val)).replace("<class '","").replace("'>","") self.assertTrue(type(val) == type(1), f"Kon suoritetaan{koodi}palautetun tuplen pitäisi sisältää kokonaislukuja, nyt mukana on arvo, jonka tyyppi on {taip}. Palautettu tuple on {valx}") val = valx odotettu = (0, 1, 0, 10) self.assertTrue(val==odotettu, f"Kun suoritetaan {koodi}\npitäisi palauttaa {odotettu}, nuyt palautettiin {val}") def test_2_koodarin_status(self): reload_module(self.module) from src.koodi import Tilauskirja, Tehtava koodi = """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) t.lisaa_tilaus("tee mobiilipeli", "Antti", 5) t.lisaa_tilaus("koodaa pygamella jotain", "Antti", 50) t.lisaa_tilaus("koodaa parempi facebook", "joona", 5000) t.merkkaa_valmiiksi(1) t.merkkaa_valmiiksi(2) t.koodarin_status("Antti") """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) t.lisaa_tilaus("tee mobiilipeli", "Antti", 5) t.lisaa_tilaus("koodaa pygamella jotain", "Antti", 50) t.lisaa_tilaus("koodaa parempi facebook", "joona", 5000) til = t.kaikki_tilaukset() id1 = til[0].id id2 = til[1].id try: t.merkkaa_valmiiksi(id1) t.merkkaa_valmiiksi(id2) except Exception as e: self.fail(f'Koodin {koodi}suoritus aiheutti virheen\n{e}\nOnhan metodi merkkaa_valmiiksi(self, id: int) määritelty?') try: val = t.koodarin_status("Antti") except Exception as e: self.fail(f'Koodin {koodi}suoritus aiheutti virheen\n{e}\nOnhan metodi koodarin_status(self, koodari: str) määritelty?') odotettu = (2, 1, 15, 50) self.assertTrue(val==odotettu, f"Kun suoritetaan {koodi}\npitäisi palauttaa {odotettu}, nuyt palautettiin {val}") def test_4_koodarin_status_tuottaa_poikkeuksen(self): reload_module(self.module) from src.koodi import Tilauskirja, Tehtava koodi = """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) t.koodarin_status("JohnDoe") """ t = Tilauskirja() t.lisaa_tilaus("koodaa webbikauppa", "Antti", 10) ok = False try: val = t.koodarin_status("JohnDoe") except ValueError: ok = True except Exception as e: self.fail(f'Koodin {koodi}suoritus aiheutti virheen\n{e}') self.assertTrue(ok, f'Koodin {koodi}suorituksen pitäisi tuottaa poikkeus ValueError') if __name__ == '__main__': unittest.main()
9a01b747a9686a0b88880483eecbb1d9200693b3
79bef6363f16219fe66f9166f2a168db16f5670d
/http/EcoSim/home/views.py
c7d434682ae223ffc10485202701484ab2365256
[]
no_license
HuzenDevHouse/Eco-Simul
ce0da34185ef130323626af37cc3e2096cc96686
ce826a85576b32b49cbd2d562c5a3978b32b93a7
refs/heads/master
2021-09-02T11:54:58.321392
2018-01-02T10:37:04
2018-01-02T10:37:04
104,362,918
1
1
null
null
null
null
UTF-8
Python
false
false
214
py
from django.shortcuts import render from django.http import HttpResponse def index(request): msg = "Welcome To Page" return render(request, 'home/index.html', {'message': msg}) # Create your views here.
a40784738ed092668081456e1b724bb29a5780e8
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2790/60589/243105.py
230152d093784ddcfff077a0a0b37bbdb892f405
[]
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
350
py
nm=input().split(' ') n=int(nm[0]) m=int(nm[1]) a=list(map(int,input().split(' '))) b=list(map(int,input().split(' '))) ans=[] a.sort() for e in b: has=False for i in range(n): if a[i]>e: has=True ans.append(i) break if not has: ans.append(n) ans=list(map(str,ans)) print(' '.join(ans))
5e6dc7c003bc33b62f4505e8b5de7f9ddd5eb95c
8128d30cde54ab3b3cd6ff3ee91949e241c2344a
/In Progress - Data Science Scholarship Program Powered by Bertelsmann/Lesson 24 - Data Type and Operators/Scripts/006 - len.py
c1db3eca3854f95757b2d98e8923033446cc8947
[ "Apache-2.0" ]
permissive
Ranganaths/Courses
213927733aceff2ab26ddb1c9960f89e0e23b36e
879dbcd758aa4f16aa8cc0c2e595a7b16912a9cf
refs/heads/master
2020-03-23T17:46:34.947373
2018-07-19T21:39:12
2018-07-19T21:39:12
null
0
0
null
null
null
null
UTF-8
Python
false
false
649
py
''' Quiz: len() Use string concatenation and the len() function to find the length of a certain movie star's actual full name. Store that length in the name_length variable. Don't forget that there are spaces in between the different parts of a name! ''' given_name = "William" middle_names = "Bradley" family_name = "Pitt" #todo: calculate how long this name is name_length = len(given_name + " " + middle_names + " " + family_name) # Now we check to make sure that the name fits within the driving license character limit # Nothing you need to do here driving_license_character_limit = 28 print(name_length <= driving_license_character_limit)
243ff6fb2682b150f69e6ebee075bb6e21f72971
dcf887939f3d4f53ddf73e05e21114aa07b86a18
/app/views.py
e2fa29ff792f1f4dbbac522b3d2a7176738d8bb8
[]
no_license
Dyepitech/Epytodo
771905e8eb1fadb3bbe9c65da8148eeed1568a9e
d91cb0788d1404f1731618c43d3c23f9b284c29b
refs/heads/master
2022-11-18T02:55:50.471008
2020-07-13T13:01:05
2020-07-13T13:01:05
270,681,527
0
0
null
null
null
null
UTF-8
Python
false
false
1,828
py
from app import app from flask import render_template, session from flask import jsonify from flask import Flask, request import pymysql as sql from app import controller from app import models @app.route('/', methods=['GET']) def route_index(): return models.main_page() @app.route('/register', methods=['POST', 'GET']) def route_register(): if request.method == "POST": try: data = controller.user_sql(json_data=request.json, form_data=request.form) return models.create_user(data) except: return jsonify(error="internal error") else: return render_template("register.html") @app.route('/login', methods=['POST', 'GET']) def route_login(): if request.method == "POST": try: data = controller.user_sql(json_data=request.json, form_data=request.form) return models.check_user(data) except: return (jsonify(error="internal error"), models.main_page()) else: return render_template("login.html") @app.route('/task', methods=['GET']) def route_user_task(): try: return models.display_all_task() except: return jsonify(error="internal error") @app.route('/delete/task/<id_task>', methods=['POST']) def route_user_task_del(id_task): try: return models.task_delete(id_task=id_task) except: return jsonify(error="internal error") @app.route('/todo', methods=['POST', 'GET']) def route_addtask(): if request.method == "POST": try: data = controller.task_sql(json_data=request.json, form_data=request.form) return models.create_task(data=data) except Exception as e: print(e) return jsonify(error="internal error") else: return render_template("todo.html")
d2f61390d6b2c4b81f9dcb27acbe7b81d9e4cc13
16734d189c2bafa9c66fdc989126b7d9aa95c478
/Python/flask/counter/server.py
1c6c4ef1a9e0e7f137e799fcf25543dac002609e
[]
no_license
Ericksmith/CD-projects
3dddd3a3819341be7202f11603cf793a2067c140
3b06b6e289d241c2f1115178c693d304280c2502
refs/heads/master
2021-08-15T17:41:32.329647
2017-11-18T01:18:04
2017-11-18T01:18:04
104,279,162
0
0
null
null
null
null
UTF-8
Python
false
false
534
py
from flask import Flask, session, render_template, request, redirect app = Flask(__name__) app.secret_key = "Dojo" @app.route('/') def index(): if session.get('counter') == None: session['counter'] = 0 session['counter'] += 1 return render_template('index.html', counter = session['counter']) @app.route('/doubleCount') def doubleCount(): session['counter'] += 2 return redirect('/') @app.route('/countReset') def countReset(): session['counter'] = 0 return redirect('/') app.run(debug=True)
0a79edc64c01026d73147c2ba199040dde418acb
0d75e69be45600c5ef5f700e409e8522b9678a02
/IWDjangoAssignment1/settings.py
fbefbb96d64fcd6e7f9d12d0300504134dbaecd7
[]
no_license
sdrsnadkry/IWDjangoAssignment1
28d4d6c264aac250e66a7be568fee29f1700464b
6eb533d8bbdae68a6952113511626405e718cac6
refs/heads/master
2022-11-29T07:53:37.374821
2020-07-18T03:27:52
2020-07-18T03:27:52
280,572,491
0
0
null
null
null
null
UTF-8
Python
false
false
3,138
py
""" Django settings for IWDjangoAssignment1 project. Generated by 'django-admin startproject' using Django 3.0.7. For more information on this file, see https://docs.djangoproject.com/en/3.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '%g^opnnuo)*09sbtnne1)v9%b%r&k$166ox+no@$%eeshu42ho' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'blog' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'IWDjangoAssignment1.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'IWDjangoAssignment1.wsgi.application' # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = '/static/'
9962922584c412b05fbb00dc271d5fd91f46fe79
23611933f0faba84fc82a1bc0a85d97cf45aba99
/google-cloud-sdk/.install/.backup/lib/third_party/ruamel/yaml/resolver.py
84227072e066b8f2528baaf4a25c43995cd4061a
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
KaranToor/MA450
1f112d1caccebdc04702a77d5a6cee867c15f75c
c98b58aeb0994e011df960163541e9379ae7ea06
refs/heads/master
2021-06-21T06:17:42.585908
2020-12-24T00:36:28
2020-12-24T00:36:28
79,285,433
1
1
Apache-2.0
2020-12-24T00:38:09
2017-01-18T00:05:44
Python
UTF-8
Python
false
false
14,599
py
# coding: utf-8 from __future__ import absolute_import import re try: from .error import * # NOQA from .nodes import * # NOQA from .compat import string_types except (ImportError, ValueError): # for Jython from ruamel.yaml.error import * # NOQA from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.compat import string_types __all__ = ['BaseResolver', 'Resolver', 'VersionedResolver'] _DEFAULT_VERSION = (1, 2) class ResolverError(YAMLError): pass class BaseResolver(object): DEFAULT_SCALAR_TAG = u'tag:yaml.org,2002:str' DEFAULT_SEQUENCE_TAG = u'tag:yaml.org,2002:seq' DEFAULT_MAPPING_TAG = u'tag:yaml.org,2002:map' yaml_implicit_resolvers = {} yaml_path_resolvers = {} def __init__(self): self._loader_version = None self.resolver_exact_paths = [] self.resolver_prefix_paths = [] @classmethod def add_implicit_resolver(cls, tag, regexp, first): if 'yaml_implicit_resolvers' not in cls.__dict__: cls.yaml_implicit_resolvers = cls.yaml_implicit_resolvers.copy() if first is None: first = [None] for ch in first: cls.yaml_implicit_resolvers.setdefault(ch, []).append( (tag, regexp)) @classmethod def add_path_resolver(cls, tag, path, kind=None): # Note: `add_path_resolver` is experimental. The API could be changed. # `new_path` is a pattern that is matched against the path from the # root to the node that is being considered. `node_path` elements are # tuples `(node_check, index_check)`. `node_check` is a node class: # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` # matches any kind of a node. `index_check` could be `None`, a boolean # value, a string value, or a number. `None` and `False` match against # any _value_ of sequence and mapping nodes. `True` matches against # any _key_ of a mapping node. A string `index_check` matches against # a mapping value that corresponds to a scalar key which content is # equal to the `index_check` value. An integer `index_check` matches # against a sequence value with the index equal to `index_check`. if 'yaml_path_resolvers' not in cls.__dict__: cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() new_path = [] for element in path: if isinstance(element, (list, tuple)): if len(element) == 2: node_check, index_check = element elif len(element) == 1: node_check = element[0] index_check = True else: raise ResolverError("Invalid path element: %s" % element) else: node_check = None index_check = element if node_check is str: node_check = ScalarNode elif node_check is list: node_check = SequenceNode elif node_check is dict: node_check = MappingNode elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ and not isinstance(node_check, string_types) \ and node_check is not None: raise ResolverError("Invalid node checker: %s" % node_check) if not isinstance(index_check, (string_types, int)) \ and index_check is not None: raise ResolverError("Invalid index checker: %s" % index_check) new_path.append((node_check, index_check)) if kind is str: kind = ScalarNode elif kind is list: kind = SequenceNode elif kind is dict: kind = MappingNode elif kind not in [ScalarNode, SequenceNode, MappingNode] \ and kind is not None: raise ResolverError("Invalid node kind: %s" % kind) cls.yaml_path_resolvers[tuple(new_path), kind] = tag def descend_resolver(self, current_node, current_index): if not self.yaml_path_resolvers: return exact_paths = {} prefix_paths = [] if current_node: depth = len(self.resolver_prefix_paths) for path, kind in self.resolver_prefix_paths[-1]: if self.check_resolver_prefix(depth, path, kind, current_node, current_index): if len(path) > depth: prefix_paths.append((path, kind)) else: exact_paths[kind] = self.yaml_path_resolvers[path, kind] else: for path, kind in self.yaml_path_resolvers: if not path: exact_paths[kind] = self.yaml_path_resolvers[path, kind] else: prefix_paths.append((path, kind)) self.resolver_exact_paths.append(exact_paths) self.resolver_prefix_paths.append(prefix_paths) def ascend_resolver(self): if not self.yaml_path_resolvers: return self.resolver_exact_paths.pop() self.resolver_prefix_paths.pop() def check_resolver_prefix(self, depth, path, kind, current_node, current_index): node_check, index_check = path[depth-1] if isinstance(node_check, string_types): if current_node.tag != node_check: return elif node_check is not None: if not isinstance(current_node, node_check): return if index_check is True and current_index is not None: return if (index_check is False or index_check is None) \ and current_index is None: return if isinstance(index_check, string_types): if not (isinstance(current_index, ScalarNode) and index_check == current_index.value): return elif isinstance(index_check, int) and not isinstance(index_check, bool): if index_check != current_index: return return True def resolve(self, kind, value, implicit): if kind is ScalarNode and implicit[0]: if value == u'': resolvers = self.yaml_implicit_resolvers.get(u'', []) else: resolvers = self.yaml_implicit_resolvers.get(value[0], []) resolvers += self.yaml_implicit_resolvers.get(None, []) for tag, regexp in resolvers: if regexp.match(value): return tag implicit = implicit[1] if self.yaml_path_resolvers: exact_paths = self.resolver_exact_paths[-1] if kind in exact_paths: return exact_paths[kind] if None in exact_paths: return exact_paths[None] if kind is ScalarNode: return self.DEFAULT_SCALAR_TAG elif kind is SequenceNode: return self.DEFAULT_SEQUENCE_TAG elif kind is MappingNode: return self.DEFAULT_MAPPING_TAG @property def processing_version(self): return None class Resolver(BaseResolver): pass Resolver.add_implicit_resolver( u'tag:yaml.org,2002:bool', re.compile(u'''^(?:yes|Yes|YES|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF)$''', re.X), list(u'yYnNtTfFoO')) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:float', re.compile(u'''^(?: [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) |\\.[0-9_]+(?:[eE][-+][0-9]+)? |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]* |[-+]?\\.(?:inf|Inf|INF) |\\.(?:nan|NaN|NAN))$''', re.X), list(u'-+0123456789.')) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:int', re.compile(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ |[-+]?(?:0|[1-9][0-9_]*) |[-+]?0x[0-9a-fA-F_]+ |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), list(u'-+0123456789')) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:merge', re.compile(u'^(?:<<)$'), [u'<']) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:null', re.compile(u'''^(?: ~ |null|Null|NULL | )$''', re.X), [u'~', u'n', u'N', u'']) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:timestamp', re.compile(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? (?:[Tt]|[ \\t]+)[0-9][0-9]? :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)? (?:[ \\t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), list(u'0123456789')) Resolver.add_implicit_resolver( u'tag:yaml.org,2002:value', re.compile(u'^(?:=)$'), [u'=']) # The following resolver is only for documentation purposes. It cannot work # because plain scalars cannot start with '!', '&', or '*'. Resolver.add_implicit_resolver( u'tag:yaml.org,2002:yaml', re.compile(u'^(?:!|&|\\*)$'), list(u'!&*')) # resolvers consist of # - a list of applicable version # - a tag # - a regexp # - a list of first characters to match implicit_resolvers = [ ([(1, 2)], u'tag:yaml.org,2002:bool', re.compile(u'''^(?:true|True|TRUE|false|False|FALSE)$''', re.X), list(u'tTfF')), ([(1, 1)], u'tag:yaml.org,2002:bool', re.compile(u'''^(?:yes|Yes|YES|no|No|NO |true|True|TRUE|false|False|FALSE |on|On|ON|off|Off|OFF)$''', re.X), list(u'yYnNtTfFoO')), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:float', re.compile(u'''^(?: [-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+]?[0-9]+)? |[-+]?(?:[0-9][0-9_]*)(?:[eE][-+]?[0-9]+) |\\.[0-9_]+(?:[eE][-+][0-9]+)? |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]* |[-+]?\\.(?:inf|Inf|INF) |\\.(?:nan|NaN|NAN))$''', re.X), list(u'-+0123456789.')), ([(1, 2)], u'tag:yaml.org,2002:int', re.compile(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ |[-+]?(?:0|[1-9][0-9_]*) |[-+]?0x[0-9a-fA-F_]+)$''', re.X), list(u'-+0123456789')), ([(1, 1)], u'tag:yaml.org,2002:int', re.compile(u'''^(?:[-+]?0b[0-1_]+ |[-+]?0o?[0-7_]+ |[-+]?(?:0|[1-9][0-9_]*) |[-+]?0x[0-9a-fA-F_]+ |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), list(u'-+0123456789')), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:merge', re.compile(u'^(?:<<)$'), [u'<']), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:null', re.compile(u'''^(?: ~ |null|Null|NULL | )$''', re.X), [u'~', u'n', u'N', u'']), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:timestamp', re.compile(u'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? (?:[Tt]|[ \\t]+)[0-9][0-9]? :[0-9][0-9] :[0-9][0-9] (?:\\.[0-9]*)? (?:[ \\t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), list(u'0123456789')), ([(1, 2), (1, 1)], u'tag:yaml.org,2002:value', re.compile(u'^(?:=)$'), [u'=']), # The following resolver is only for documentation purposes. It cannot work # because plain scalars cannot start with '!', '&', or '*'. ([(1, 2), (1, 1)], u'tag:yaml.org,2002:yaml', re.compile(u'^(?:!|&|\\*)$'), list(u'!&*')), ] class VersionedResolver(BaseResolver): """ contrary to the "normal" resolver, the smart resolver delays loading the pattern matching rules. That way it can decide to load 1.1 rules or the (default) 1.2 that no longer support octal without 0o, sexagesimals and Yes/No/On/Off booleans. """ def __init__(self, version=None): BaseResolver.__init__(self) self._loader_version = self.get_loader_version(version) self._version_implicit_resolver = {} def add_version_implicit_resolver(self, version, tag, regexp, first): if first is None: first = [None] impl_resolver = self._version_implicit_resolver.setdefault(version, {}) for ch in first: impl_resolver.setdefault(ch, []).append((tag, regexp)) def get_loader_version(self, version): if version is None or isinstance(version, tuple): return version if isinstance(version, list): return tuple(version) # assume string return tuple(map(int, version.split(u'.'))) @property def resolver(self): """ select the resolver based on the version we are parsing """ version = self.processing_version if version not in self._version_implicit_resolver: for x in implicit_resolvers: if version in x[0]: self.add_version_implicit_resolver(version, x[1], x[2], x[3]) return self._version_implicit_resolver[version] def resolve(self, kind, value, implicit): if kind is ScalarNode and implicit[0]: if value == u'': resolvers = self.resolver.get(u'', []) else: resolvers = self.resolver.get(value[0], []) resolvers += self.resolver.get(None, []) for tag, regexp in resolvers: if regexp.match(value): return tag implicit = implicit[1] if self.yaml_path_resolvers: exact_paths = self.resolver_exact_paths[-1] if kind in exact_paths: return exact_paths[kind] if None in exact_paths: return exact_paths[None] if kind is ScalarNode: return self.DEFAULT_SCALAR_TAG elif kind is SequenceNode: return self.DEFAULT_SEQUENCE_TAG elif kind is MappingNode: return self.DEFAULT_MAPPING_TAG @property def processing_version(self): try: version = self.yaml_version except AttributeError: # dumping version = self.use_version if version is None: version = self._loader_version if version is None: version = _DEFAULT_VERSION return version
a56781d9e56b8944daecd740c91b397ccf679d04
62d3d2e963c3da6d15206ac807cc2190938f61d6
/mrcnn/utils.py
13ea2a150f6351ea6638b50f5cf1a9c1dbd70403
[]
no_license
pykwok/Mask_RCNN-Nuclei
dfa8bc0956ad0ba17a8fb836f923177ee1385a94
aac1da5fad1fd2d484d6cbafa51c27d5b049a3e9
refs/heads/master
2023-04-04T13:43:43.747566
2021-04-21T07:51:09
2021-04-21T07:51:09
360,053,949
0
0
null
null
null
null
UTF-8
Python
false
false
36,210
py
""" Mask R-CNN Common utility functions and classes. Copyright (c) 2017 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Written by Waleed Abdulla """ import sys import os import logging import math import random import numpy as np import tensorflow as tf import scipy import skimage.color import skimage.io import skimage.transform import urllib.request import shutil import warnings from distutils.version import LooseVersion # URL from which to download the latest COCO trained weights COCO_MODEL_URL = "https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5" ############################################################ # Bounding Boxes ############################################################ def extract_bboxes(mask): """Compute bounding boxes from masks. mask: [height, width, num_instances]. Mask pixels are either 1 or 0. Returns: bbox array [num_instances, (y1, x1, y2, x2)]. """ boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32) for i in range(mask.shape[-1]): m = mask[:, :, i] # Bounding box. horizontal_indicies = np.where(np.any(m, axis=0))[0] vertical_indicies = np.where(np.any(m, axis=1))[0] if horizontal_indicies.shape[0]: x1, x2 = horizontal_indicies[[0, -1]] y1, y2 = vertical_indicies[[0, -1]] # x2 and y2 should not be part of the box. Increment by 1. x2 += 1 y2 += 1 else: # No mask for this instance. Might happen due to # resizing or cropping. Set bbox to zeros x1, x2, y1, y2 = 0, 0, 0, 0 boxes[i] = np.array([y1, x1, y2, x2]) return boxes.astype(np.int32) def compute_iou(box, boxes, box_area, boxes_area): """Calculates IoU of the given box with the array of the given boxes. box: 1D vector [y1, x1, y2, x2] boxes: [boxes_count, (y1, x1, y2, x2)] box_area: float. the area of 'box' boxes_area: array of length boxes_count. Note: the areas are passed in rather than calculated here for efficiency. Calculate once in the caller to avoid duplicate work. """ # Calculate intersection areas y1 = np.maximum(box[0], boxes[:, 0]) y2 = np.minimum(box[2], boxes[:, 2]) x1 = np.maximum(box[1], boxes[:, 1]) x2 = np.minimum(box[3], boxes[:, 3]) intersection = np.maximum(x2 - x1, 0) * np.maximum(y2 - y1, 0) union = box_area + boxes_area[:] - intersection[:] iou = intersection / union return iou def compute_overlaps(boxes1, boxes2): """Computes IoU overlaps between two sets of boxes. boxes1, boxes2: [N, (y1, x1, y2, x2)]. For better performance, pass the largest set first and the smaller second. """ # Areas of anchors and GT boxes area1 = (boxes1[:, 2] - boxes1[:, 0]) * (boxes1[:, 3] - boxes1[:, 1]) area2 = (boxes2[:, 2] - boxes2[:, 0]) * (boxes2[:, 3] - boxes2[:, 1]) # Compute overlaps to generate matrix [boxes1 count, boxes2 count] # Each cell contains the IoU value. overlaps = np.zeros((boxes1.shape[0], boxes2.shape[0])) for i in range(overlaps.shape[1]): box2 = boxes2[i] overlaps[:, i] = compute_iou(box2, boxes1, area2[i], area1) return overlaps def compute_overlaps_masks(masks1, masks2): """Computes IoU overlaps between two sets of masks. masks1, masks2: [Height, Width, instances] """ # If either set of masks is empty return empty result if masks1.shape[-1] == 0 or masks2.shape[-1] == 0: return np.zeros((masks1.shape[-1], masks2.shape[-1])) # flatten masks and compute their areas masks1 = np.reshape(masks1 > .5, (-1, masks1.shape[-1])).astype(np.float32) masks2 = np.reshape(masks2 > .5, (-1, masks2.shape[-1])).astype(np.float32) area1 = np.sum(masks1, axis=0) area2 = np.sum(masks2, axis=0) # intersections and union intersections = np.dot(masks1.T, masks2) union = area1[:, None] + area2[None, :] - intersections overlaps = intersections / union return overlaps def non_max_suppression(boxes, scores, threshold): """Performs non-maximum suppression and returns indices of kept boxes. boxes: [N, (y1, x1, y2, x2)]. Notice that (y2, x2) lays outside the box. scores: 1-D array of box scores. threshold: Float. IoU threshold to use for filtering. """ assert boxes.shape[0] > 0 if boxes.dtype.kind != "f": boxes = boxes.astype(np.float32) # Compute box areas y1 = boxes[:, 0] x1 = boxes[:, 1] y2 = boxes[:, 2] x2 = boxes[:, 3] area = (y2 - y1) * (x2 - x1) # Get indicies of boxes sorted by scores (highest first) ixs = scores.argsort()[::-1] pick = [] while len(ixs) > 0: # Pick top box and add its index to the list i = ixs[0] pick.append(i) # Compute IoU of the picked box with the rest iou = compute_iou(boxes[i], boxes[ixs[1:]], area[i], area[ixs[1:]]) # Identify boxes with IoU over the threshold. This # returns indices into ixs[1:], so add 1 to get # indices into ixs. remove_ixs = np.where(iou > threshold)[0] + 1 # Remove indices of the picked and overlapped boxes. ixs = np.delete(ixs, remove_ixs) ixs = np.delete(ixs, 0) return np.array(pick, dtype=np.int32) def apply_box_deltas(boxes, deltas): """Applies the given deltas to the given boxes. boxes: [N, (y1, x1, y2, x2)]. Note that (y2, x2) is outside the box. deltas: [N, (dy, dx, log(dh), log(dw))] """ boxes = boxes.astype(np.float32) # Convert to y, x, h, w height = boxes[:, 2] - boxes[:, 0] width = boxes[:, 3] - boxes[:, 1] center_y = boxes[:, 0] + 0.5 * height center_x = boxes[:, 1] + 0.5 * width # Apply deltas center_y += deltas[:, 0] * height center_x += deltas[:, 1] * width height *= np.exp(deltas[:, 2]) width *= np.exp(deltas[:, 3]) # Convert back to y1, x1, y2, x2 y1 = center_y - 0.5 * height x1 = center_x - 0.5 * width y2 = y1 + height x2 = x1 + width return np.stack([y1, x1, y2, x2], axis=1) def box_refinement_graph(box, gt_box): """Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)] """ box = tf.cast(box, tf.float32) gt_box = tf.cast(gt_box, tf.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_width = gt_box[:, 3] - gt_box[:, 1] gt_center_y = gt_box[:, 0] + 0.5 * gt_height gt_center_x = gt_box[:, 1] + 0.5 * gt_width dy = (gt_center_y - center_y) / height dx = (gt_center_x - center_x) / width dh = tf.log(gt_height / height) dw = tf.log(gt_width / width) result = tf.stack([dy, dx, dh, dw], axis=1) return result def box_refinement(box, gt_box): """Compute refinement needed to transform box to gt_box. box and gt_box are [N, (y1, x1, y2, x2)]. (y2, x2) is assumed to be outside the box. """ box = box.astype(np.float32) gt_box = gt_box.astype(np.float32) height = box[:, 2] - box[:, 0] width = box[:, 3] - box[:, 1] center_y = box[:, 0] + 0.5 * height center_x = box[:, 1] + 0.5 * width gt_height = gt_box[:, 2] - gt_box[:, 0] gt_width = gt_box[:, 3] - gt_box[:, 1] gt_center_y = gt_box[:, 0] + 0.5 * gt_height gt_center_x = gt_box[:, 1] + 0.5 * gt_width dy = (gt_center_y - center_y) / height dx = (gt_center_x - center_x) / width dh = np.log(gt_height / height) dw = np.log(gt_width / width) return np.stack([dy, dx, dh, dw], axis=1) ############################################################ # Dataset ############################################################ class Dataset(object): """The base class for dataset classes. To use it, create a new class that adds functions specific to the dataset you want to use. For example: class CatsAndDogsDataset(Dataset): def load_cats_and_dogs(self): ... def load_mask(self, image_id): ... def image_reference(self, image_id): ... See COCODataset and ShapesDataset as examples. """ def __init__(self, class_map=None): self._image_ids = [] self.image_info = [] # Background is always the first class self.class_info = [{"source": "", "id": 0, "name": "BG"}] self.source_class_ids = {} def add_class(self, source, class_id, class_name): assert "." not in source, "Source name cannot contain a dot" # Does the class exist already? for info in self.class_info: if info['source'] == source and info["id"] == class_id: # source.class_id combination already available, skip return # Add the class self.class_info.append({ "source": source, "id": class_id, "name": class_name, }) def add_image(self, source, image_id, path, **kwargs): image_info = { "id": image_id, "source": source, "path": path, } image_info.update(kwargs) self.image_info.append(image_info) def image_reference(self, image_id): """Return a link to the image in its source Website or details about the image that help looking it up or debugging it. Override for your dataset, but pass to this function if you encounter images not in your dataset. """ return "" def prepare(self, class_map=None): """Prepares the Dataset class for use. TODO: class map is not supported yet. When done, it should handle mapping classes from different datasets to the same class ID. """ def clean_name(name): """Returns a shorter version of object names for cleaner display.""" return ",".join(name.split(",")[:1]) # Build (or rebuild) everything else from the info dicts. self.num_classes = len(self.class_info) self.class_ids = np.arange(self.num_classes) self.class_names = [clean_name(c["name"]) for c in self.class_info] self.num_images = len(self.image_info) self._image_ids = np.arange(self.num_images) # Mapping from source class and image IDs to internal IDs self.class_from_source_map = {"{}.{}".format(info['source'], info['id']): id for info, id in zip(self.class_info, self.class_ids)} self.image_from_source_map = {"{}.{}".format(info['source'], info['id']): id for info, id in zip(self.image_info, self.image_ids)} # Map sources to class_ids they support self.sources = list(set([i['source'] for i in self.class_info])) self.source_class_ids = {} # Loop over datasets for source in self.sources: self.source_class_ids[source] = [] # Find classes that belong to this dataset for i, info in enumerate(self.class_info): # Include BG class in all datasets if i == 0 or source == info['source']: self.source_class_ids[source].append(i) def map_source_class_id(self, source_class_id): """Takes a source class ID and returns the int class ID assigned to it. For example: dataset.map_source_class_id("coco.12") -> 23 """ return self.class_from_source_map[source_class_id] def get_source_class_id(self, class_id, source): """Map an internal class ID to the corresponding class ID in the source dataset.""" info = self.class_info[class_id] assert info['source'] == source return info['id'] @property def image_ids(self): return self._image_ids def source_image_link(self, image_id): """Returns the path or URL to the image. Override this to return a URL to the image if it's available online for easy debugging. """ return self.image_info[image_id]["path"] def load_image(self, image_id): """Load the specified image and return a [H,W,3] Numpy array. """ # Load image image = skimage.io.imread(self.image_info[image_id]['path']) # If grayscale. Convert to RGB for consistency. if image.ndim != 3: image = skimage.color.gray2rgb(image) # If has an alpha channel, remove it for consistency if image.shape[-1] == 4: image = image[..., :3] return image def load_mask(self, image_id): """Load instance masks for the given image. Different datasets use different ways to store masks. Override this method to load instance masks and return them in the form of am array of binary masks of shape [height, width, instances]. Returns: masks: A bool array of shape [height, width, instance count] with a binary mask per instance. class_ids: a 1D array of class IDs of the instance masks. """ # Override this function to load a mask from your dataset. # Otherwise, it returns an empty mask. logging.warning("You are using the default load_mask(), maybe you need to define your own one.") mask = np.empty([0, 0, 0]) class_ids = np.empty([0], np.int32) return mask, class_ids def resize_image(image, min_dim=None, max_dim=None, min_scale=None, mode="square"): """Resizes an image keeping the aspect ratio unchanged. min_dim: if provided, resizes the image such that it's smaller dimension == min_dim max_dim: if provided, ensures that the image longest side doesn't exceed this value. min_scale: if provided, ensure that the image is scaled up by at least this percent even if min_dim doesn't require it. mode: Resizing mode. none: No resizing. Return the image unchanged. square: Resize and pad with zeros to get a square image of size [max_dim, max_dim]. pad64: Pads width and height with zeros to make them multiples of 64. If min_dim or min_scale are provided, it scales the image up before padding. max_dim is ignored in this mode. The multiple of 64 is needed to ensure smooth scaling of feature maps up and down the 6 levels of the FPN pyramid (2**6=64). crop: Picks random crops from the image. First, scales the image based on min_dim and min_scale, then picks a random crop of size min_dim x min_dim. Can be used in training only. max_dim is not used in this mode. Returns: image: the resized image window: (y1, x1, y2, x2). If max_dim is provided, padding might be inserted in the returned image. If so, this window is the coordinates of the image part of the full image (excluding the padding). The x2, y2 pixels are not included. scale: The scale factor used to resize the image padding: Padding added to the image [(top, bottom), (left, right), (0, 0)] """ # Keep track of image dtype and return results in the same dtype image_dtype = image.dtype # Default window (y1, x1, y2, x2) and default scale == 1. h, w = image.shape[:2] window = (0, 0, h, w) scale = 1 padding = [(0, 0), (0, 0), (0, 0)] crop = None if mode == "none": return image, window, scale, padding, crop # Scale? if min_dim: # Scale up but not down scale = max(1, min_dim / min(h, w)) if min_scale and scale < min_scale: scale = min_scale # Does it exceed max dim? if max_dim and mode == "square": image_max = max(h, w) if round(image_max * scale) > max_dim: scale = max_dim / image_max # Resize image using bilinear interpolation if scale != 1: image = resize(image, (round(h * scale), round(w * scale)), preserve_range=True) # Need padding or cropping? if mode == "square": # Get new height and width h, w = image.shape[:2] top_pad = (max_dim - h) // 2 bottom_pad = max_dim - h - top_pad left_pad = (max_dim - w) // 2 right_pad = max_dim - w - left_pad padding = [(top_pad, bottom_pad), (left_pad, right_pad), (0, 0)] image = np.pad(image, padding, mode='constant', constant_values=0) window = (top_pad, left_pad, h + top_pad, w + left_pad) elif mode == "pad64": h, w = image.shape[:2] # Both sides must be divisible by 64 assert min_dim % 64 == 0, "Minimum dimension must be a multiple of 64" # Height if h % 64 > 0: max_h = h - (h % 64) + 64 top_pad = (max_h - h) // 2 bottom_pad = max_h - h - top_pad else: top_pad = bottom_pad = 0 # Width if w % 64 > 0: max_w = w - (w % 64) + 64 left_pad = (max_w - w) // 2 right_pad = max_w - w - left_pad else: left_pad = right_pad = 0 padding = [(top_pad, bottom_pad), (left_pad, right_pad), (0, 0)] image = np.pad(image, padding, mode='constant', constant_values=0) window = (top_pad, left_pad, h + top_pad, w + left_pad) elif mode == "crop": # Pick a random crop h, w = image.shape[:2] y = random.randint(0, (h - min_dim)) x = random.randint(0, (w - min_dim)) crop = (y, x, min_dim, min_dim) image = image[y:y + min_dim, x:x + min_dim] window = (0, 0, min_dim, min_dim) else: raise Exception("Mode {} not supported".format(mode)) return image.astype(image_dtype), window, scale, padding, crop def resize_mask(mask, scale, padding, crop=None): """Resizes a mask using the given scale and padding. Typically, you get the scale and padding from resize_image() to ensure both, the image and the mask, are resized consistently. scale: mask scaling factor padding: Padding to add to the mask in the form [(top, bottom), (left, right), (0, 0)] """ # Suppress warning from scipy 0.13.0, the output shape of zoom() is # calculated with round() instead of int() with warnings.catch_warnings(): warnings.simplefilter("ignore") mask = scipy.ndimage.zoom(mask, zoom=[scale, scale, 1], order=0) if crop is not None: y, x, h, w = crop mask = mask[y:y + h, x:x + w] else: mask = np.pad(mask, padding, mode='constant', constant_values=0) return mask def minimize_mask(bbox, mask, mini_shape): """Resize masks to a smaller version to reduce memory load. Mini-masks can be resized back to image scale using expand_masks() See inspect_data.ipynb notebook for more details. """ mini_mask = np.zeros(mini_shape + (mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): # Pick slice and cast to bool in case load_mask() returned wrong dtype m = mask[:, :, i].astype(bool) y1, x1, y2, x2 = bbox[i][:4] m = m[y1:y2, x1:x2] if m.size == 0: raise Exception("Invalid bounding box with area of zero") # Resize with bilinear interpolation m = resize(m, mini_shape) mini_mask[:, :, i] = np.around(m).astype(np.bool) return mini_mask def expand_mask(bbox, mini_mask, image_shape): """Resizes mini masks back to image size. Reverses the change of minimize_mask(). See inspect_data.ipynb notebook for more details. """ mask = np.zeros(image_shape[:2] + (mini_mask.shape[-1],), dtype=bool) for i in range(mask.shape[-1]): m = mini_mask[:, :, i] y1, x1, y2, x2 = bbox[i][:4] h = y2 - y1 w = x2 - x1 # Resize with bilinear interpolation m = resize(m, (h, w)) mask[y1:y2, x1:x2, i] = np.around(m).astype(np.bool) return mask # TODO: Build and use this function to reduce code duplication def mold_mask(mask, config): pass def unmold_mask(mask, bbox, image_shape): """Converts a mask generated by the neural network to a format similar to its original shape. mask: [height, width] of type float. A small, typically 28x28 mask. bbox: [y1, x1, y2, x2]. The box to fit the mask in. Returns a binary mask with the same size as the original image. """ threshold = 0.5 y1, x1, y2, x2 = bbox mask = resize(mask, (y2 - y1, x2 - x1)) mask = np.where(mask >= threshold, 1, 0).astype(np.bool) # Put the mask in the right location. full_mask = np.zeros(image_shape[:2], dtype=np.bool) full_mask[y1:y2, x1:x2] = mask return full_mask ############################################################ # Anchors ############################################################ def generate_anchors(scales, ratios, shape, feature_stride, anchor_stride): """ scales: 锚框尺寸(面积),举例:(32, 64, 128, 256, 512) 1D array of anchor sizes in pixels. Example: [32, 64, 128] ratios: 锚框长宽比,举例: (0.5,1,2) 1D array of anchor ratios of width/height. Example: [0.5, 1, 2] shape: 特征图尺寸,举例: [(256,256),(128,128),(64,64),(32,32),(16,16)] [height, width] spatial shape of the feature map over which to generate anchors.大特征图尺寸对应小锚框面积,可以更便于检测小目标物体 feature_stride: 特征层相对原图的下采样倍率(下采样倍率也可以理解为该特征层生成的锚框中心点在原图中的间隔) 举例:feature_strides = (4,8,16,32,64) Stride of the feature map relative to the image in pixels. anchor_stride: 锚框滑动步长(滑动步长可控制锚框生成数量,若anchor_stride=2,则会间隔1个像素点生成锚框) Stride of anchors on the feature map. For example, if the value is 2 then generate anchors for every other feature map pixel. """ # Get all combinations of scales and ratios # 根据scales和ratios生成2D的网格 scales, ratios = np.meshgrid(np.array(scales), np.array(ratios)) scales = scales.flatten() ratios = ratios.flatten() # Enumerate heights and widths from scales and ratios # 计算不同ratio锚框的高度和宽度 heights = scales / np.sqrt(ratios) widths = scales * np.sqrt(ratios) # Enumerate shifts in feature space # 特征层像素点采样,映射回原始图像,得到每个锚框的中心点坐标,(256,256) shifts_y = np.arange(0, shape[0], anchor_stride) * feature_stride shifts_x = np.arange(0, shape[1], anchor_stride) * feature_stride shifts_x, shifts_y = np.meshgrid(shifts_x, shifts_y) # Enumerate combinations of shifts, widths, and heights # 根据宽度和锚框x方向的中心,得到宽度和x方向中心的对应矩阵,(256×256,3) box_widths, box_centers_x = np.meshgrid(widths, shifts_x) box_heights, box_centers_y = np.meshgrid(heights, shifts_y) # Reshape to get a list of (y, x) and a list of (h, w) # 沿着新轴axis=2堆叠矩阵,此时(256×256,3,2),再reshape为(256×256×3,2), # 每行为一个锚框的中心点坐标和高度/宽度尺寸 box_centers = np.stack( [box_centers_y, box_centers_x], axis=2).reshape([-1, 2]) box_sizes = np.stack([box_heights, box_widths], axis=2).reshape([-1, 2]) # Convert to corner coordinates (y1, x1, y2, x2) # 沿着轴axis=1(列方向)拼接中心点和尺寸,得到(256*256*3,4) boxes = np.concatenate([box_centers - 0.5 * box_sizes, box_centers + 0.5 * box_sizes], axis=1) return boxes def generate_pyramid_anchors(scales, ratios, feature_shapes, feature_strides, anchor_stride): """Generate anchors at different levels of a feature pyramid. Each scale is associated with a level of the pyramid, but each ratio is used in all levels of the pyramid. 在不同特征层中锚框的尺寸是不同的,但是3种长宽比都是通用的。 Returns: anchors: [N, (y1, x1, y2, x2)]. All generated anchors in one array. Sorted with the same order of the given scales. So, anchors of scale[0] come first, then anchors of scale[1], and so on. """ # Anchors #[anchor_count, (y1, x1, y2, x2)] # anchor[i]各元素的shape如下: #(128*128*3, 4),(64*64*3, 4),(32*32*3, 4),(16*16*3, 4),(8*8*3, 4) anchors = [] for i in range(len(scales)): anchors.append(generate_anchors(scales[i], ratios, feature_shapes[i], feature_strides[i], anchor_stride)) return np.concatenate(anchors, axis=0) ############################################################ # Miscellaneous ############################################################ def trim_zeros(x): """It's common to have tensors larger than the available data and pad with zeros. This function removes rows that are all zeros. x: [rows, columns]. """ assert len(x.shape) == 2 return x[~np.all(x == 0, axis=1)] def compute_matches(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5, score_threshold=0.0): """Finds matches between prediction and ground truth instances. Returns: gt_match: 1-D array. For each GT box it has the index of the matched predicted box. pred_match: 1-D array. For each predicted box, it has the index of the matched ground truth box. overlaps: [pred_boxes, gt_boxes] IoU overlaps. """ # Trim zero padding # TODO: cleaner to do zero unpadding upstream gt_boxes = trim_zeros(gt_boxes) gt_masks = gt_masks[..., :gt_boxes.shape[0]] pred_boxes = trim_zeros(pred_boxes) pred_scores = pred_scores[:pred_boxes.shape[0]] # Sort predictions by score from high to low indices = np.argsort(pred_scores)[::-1] pred_boxes = pred_boxes[indices] pred_class_ids = pred_class_ids[indices] pred_scores = pred_scores[indices] pred_masks = pred_masks[..., indices] # Compute IoU overlaps [pred_masks, gt_masks] overlaps = compute_overlaps_masks(pred_masks, gt_masks) # Loop through predictions and find matching ground truth boxes match_count = 0 pred_match = -1 * np.ones([pred_boxes.shape[0]]) gt_match = -1 * np.ones([gt_boxes.shape[0]]) for i in range(len(pred_boxes)): # Find best matching ground truth box # 1. Sort matches by score sorted_ixs = np.argsort(overlaps[i])[::-1] # 2. Remove low scores low_score_idx = np.where(overlaps[i, sorted_ixs] < score_threshold)[0] if low_score_idx.size > 0: sorted_ixs = sorted_ixs[:low_score_idx[0]] # 3. Find the match for j in sorted_ixs: # If ground truth box is already matched, go to next one if gt_match[j] > -1: continue # If we reach IoU smaller than the threshold, end the loop iou = overlaps[i, j] if iou < iou_threshold: break # Do we have a match? if pred_class_ids[i] == gt_class_ids[j]: match_count += 1 gt_match[j] = i pred_match[i] = j break return gt_match, pred_match, overlaps def compute_ap(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5): """Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different class score thresholds. recalls: List of recall values at different class score thresholds. overlaps: [pred_boxes, gt_boxes] IoU overlaps. """ # Get matches and overlaps gt_match, pred_match, overlaps = compute_matches( gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold) # Compute precision and recall at each prediction box step precisions = np.cumsum(pred_match > -1) / (np.arange(len(pred_match)) + 1) recalls = np.cumsum(pred_match > -1).astype(np.float32) / len(gt_match) # Pad with start and end values to simplify the math precisions = np.concatenate([[0], precisions, [0]]) recalls = np.concatenate([[0], recalls, [1]]) # Ensure precision values decrease but don't increase. This way, the # precision value at each recall threshold is the maximum it can be # for all following recall thresholds, as specified by the VOC paper. for i in range(len(precisions) - 2, -1, -1): precisions[i] = np.maximum(precisions[i], precisions[i + 1]) # Compute mean AP over recall range indices = np.where(recalls[:-1] != recalls[1:])[0] + 1 mAP = np.sum((recalls[indices] - recalls[indices - 1]) * precisions[indices]) return mAP, precisions, recalls, overlaps def compute_ap_range(gt_box, gt_class_id, gt_mask, pred_box, pred_class_id, pred_score, pred_mask, iou_thresholds=None, verbose=1): """Compute AP over a range or IoU thresholds. Default range is 0.5-0.95.""" # Default is 0.5 to 0.95 with increments of 0.05 iou_thresholds = iou_thresholds or np.arange(0.5, 1.0, 0.05) # Compute AP over range of IoU thresholds AP = [] for iou_threshold in iou_thresholds: ap, precisions, recalls, overlaps =\ compute_ap(gt_box, gt_class_id, gt_mask, pred_box, pred_class_id, pred_score, pred_mask, iou_threshold=iou_threshold) if verbose: print("AP @{:.2f}:\t {:.3f}".format(iou_threshold, ap)) AP.append(ap) AP = np.array(AP).mean() if verbose: print("AP @{:.2f}-{:.2f}:\t {:.3f}".format( iou_thresholds[0], iou_thresholds[-1], AP)) return AP def compute_recall(pred_boxes, gt_boxes, iou): """Compute the recall at the given IoU threshold. It's an indication of how many GT boxes were found by the given prediction boxes. pred_boxes: [N, (y1, x1, y2, x2)] in image coordinates gt_boxes: [N, (y1, x1, y2, x2)] in image coordinates """ # Measure overlaps overlaps = compute_overlaps(pred_boxes, gt_boxes) iou_max = np.max(overlaps, axis=1) iou_argmax = np.argmax(overlaps, axis=1) positive_ids = np.where(iou_max >= iou)[0] matched_gt_boxes = iou_argmax[positive_ids] recall = len(set(matched_gt_boxes)) / gt_boxes.shape[0] return recall, positive_ids # ## Batch Slicing # Some custom layers support a batch size of 1 only, and require a lot of work # to support batches greater than 1. This function slices an input tensor # across the batch dimension and feeds batches of size 1. Effectively, # an easy way to support batches > 1 quickly with little code modification. # In the long run, it's more efficient to modify the code to support large # batches and getting rid of this function. Consider this a temporary solution def batch_slice(inputs, graph_fn, batch_size, names=None): """Splits inputs into slices and feeds each slice to a copy of the given computation graph and then combines the results. It allows you to run a graph on a batch of inputs even if the graph is written to support one instance only. inputs: list of tensors. All must have the same first dimension length graph_fn: A function that returns a TF tensor that's part of a graph. batch_size: number of slices to divide the data into. names: If provided, assigns names to the resulting tensors. """ if not isinstance(inputs, list): inputs = [inputs] outputs = [] # 此处针对batch轴,逐个处理,以batch=3为例说明,[3,261888,4] for i in range(batch_size): # 抽出batch[i],inputs_slice为[261888.4] inputs_slice = [x[i] for x in inputs] # output_slice为[6000,4] output_slice = graph_fn(*inputs_slice) if not isinstance(output_slice, (tuple, list)): output_slice = [output_slice] outputs.append(output_slice) # Change outputs from a list of slices where each is # a list of outputs to a list of outputs and each has # a list of slices # output内结构为[[b0],[b1],[b2]],每个元素的shape都为[6000,4] # zip解压后output结构为[(b0,b1,b2)] outputs = list(zip(*outputs)) if names is None: names = [None] * len(outputs) # tf.stack沿着新轴堆叠数据,axis=0时意味着会增加一个newaxis=0 # zip打包时,o=(b0,b1,b2),并且沿着axis=0进行stack堆叠,还原为原始的inputs.shape # result结构为tf.Tensor->[b1,b2,b3],shape为[3,6000,4] result = [tf.stack(o, axis=0, name=n) for o, n in zip(outputs, names)] if len(result) == 1: result = result[0] return result def download_trained_weights(coco_model_path, verbose=1): """Download COCO trained weights from Releases. coco_model_path: local path of COCO trained weights """ if verbose > 0: print("Downloading pretrained model to " + coco_model_path + " ...") with urllib.request.urlopen(COCO_MODEL_URL) as resp, open(coco_model_path, 'wb') as out: shutil.copyfileobj(resp, out) if verbose > 0: print("... done downloading pretrained model!") def norm_boxes(boxes, shape): """Converts boxes from pixel coordinates to normalized coordinates. boxes: [N, (y1, x1, y2, x2)] in pixel coordinates shape: [..., (height, width)] in pixels Note: In pixel coordinates (y2, x2) is outside the box. But in normalized coordinates it's inside the box. Returns: [N, (y1, x1, y2, x2)] in normalized coordinates """ h, w = shape scale = np.array([h - 1, w - 1, h - 1, w - 1]) shift = np.array([0, 0, 1, 1]) return np.divide((boxes - shift), scale).astype(np.float32) def denorm_boxes(boxes, shape): """Converts boxes from normalized coordinates to pixel coordinates. boxes: [N, (y1, x1, y2, x2)] in normalized coordinates shape: [..., (height, width)] in pixels Note: In pixel coordinates (y2, x2) is outside the box. But in normalized coordinates it's inside the box. Returns: [N, (y1, x1, y2, x2)] in pixel coordinates """ h, w = shape scale = np.array([h - 1, w - 1, h - 1, w - 1]) shift = np.array([0, 0, 1, 1]) return np.around(np.multiply(boxes, scale) + shift).astype(np.int32) def resize(image, output_shape, order=1, mode='constant', cval=0, clip=True, preserve_range=False, anti_aliasing=False, anti_aliasing_sigma=None): """A wrapper for Scikit-Image resize(). Scikit-Image generates warnings on every call to resize() if it doesn't receive the right parameters. The right parameters depend on the version of skimage. This solves the problem by using different parameters per version. And it provides a central place to control resizing defaults. """ if LooseVersion(skimage.__version__) >= LooseVersion("0.14"): # New in 0.14: anti_aliasing. Default it to False for backward # compatibility with skimage 0.13. return skimage.transform.resize( image, output_shape, order=order, mode=mode, cval=cval, clip=clip, preserve_range=preserve_range, anti_aliasing=anti_aliasing, anti_aliasing_sigma=anti_aliasing_sigma) else: return skimage.transform.resize( image, output_shape, order=order, mode=mode, cval=cval, clip=clip, preserve_range=preserve_range)
0f0b067eadadf6cff18f712f55ed2b7ec00786ef
63c0956de38186a496c8a541a17335bc974fc843
/venv/bin/wheel
a68a9bb6376bfebea998b887b4e2fbb2c6991ba9
[]
no_license
cslovexhy/Tetris
9c043209d0a164c6dfa14c26c523b69938fb7718
772df27779a109076e416913088765db20333ba1
refs/heads/master
2021-04-28T20:57:42.128153
2018-02-18T10:08:21
2018-02-18T10:08:21
121,940,151
0
0
null
null
null
null
UTF-8
Python
false
false
250
#!/Users/huayuxu/PycharmProjects/Tetris/venv/bin/python # -*- coding: utf-8 -*- import re import sys from wheel.tool import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
2fab698a835f6624b452851681c6fd6b63874538
11959bb8d2c1d07b67fbc9da27b25f0434dc5393
/src/data/spiders/pinkbike/pinkbike/spiders/spider.py
8dd43531f7179eceee80b02fb09cc626ea6d81bd
[]
no_license
louweal/wordgame
758cb24f4986266c6e323111c6dedffded3d63df
2d03b46ff5c985d8e28c421c3558a5dfe57cc452
refs/heads/master
2021-06-04T05:56:28.945210
2020-04-20T14:18:56
2020-04-20T14:18:56
93,235,514
3
0
null
null
null
null
UTF-8
Python
false
false
862
py
import scrapy from scrapy.conf import settings class WordsSpider(scrapy.Spider): name = "pinkbike" custom_settings = { 'DOWNLOAD_DELAY': 2, 'CONCURRENT_REQUESTS_PER_DOMAIN': 1, 'ROBOTSTXT_OBEY': False } def start_requests(self): urls = [] for i in range(1, 2748): #2747 urls.append('https://www.pinkbike.com/forum/listcomments/?threadid=107062&pagenum='+str(i)) for url in urls: yield scrapy.Request(url=url, callback=self.parse) def parse(self, response): for item in response.xpath('//div[contains(@id,"commentid")]'): word = item.xpath('normalize-space(table/tr/td[@class="forum-message"]/table/tr/td[@class="padding10"]/text())').extract() author = item.xpath('normalize-space(table/tr/td/div[contains(@class,"forum-author2")]/div/a/text())').extract_first() yield { 'word': word, 'author': author }
0d8f674c48e3adb385b7c926884753ba8996a6ae
faa5ec6d832db22ebac4e0ecb109977b3aa9efa2
/myapp/api/serializers.py
23a91d91805db05994b03c837039fcbefecde7dd
[]
no_license
hulk-baba/documentSE
81f240553309b2cfd8537a9d5587606125ce0d01
944748d27bfc6d5e91e01063c1e38b4aa1553776
refs/heads/master
2021-01-23T06:15:19.082453
2018-02-13T02:11:24
2018-02-13T02:11:24
86,347,922
0
0
null
null
null
null
UTF-8
Python
false
false
209
py
from myapps.models import Documents from rest_framework import serializers class DocumentSerializers(serializers.HyperlinkedModelSerializer): class Meta: model = Documents fields = ('Document','keyword')
9b4d79f7d378c8eb47d4f656f32305c8efc4ff83
a2d36e471988e0fae32e9a9d559204ebb065ab7f
/huaweicloud-sdk-ocr/huaweicloudsdkocr/v1/model/passport_result.py
7d18f30f08e2ae7da04b81723bcf468ba27a7646
[ "Apache-2.0" ]
permissive
zhouxy666/huaweicloud-sdk-python-v3
4d878a90b8e003875fc803a61414788e5e4c2c34
cc6f10a53205be4cb111d3ecfef8135ea804fa15
refs/heads/master
2023-09-02T07:41:12.605394
2021-11-12T03:20:11
2021-11-12T03:20:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
14,941
py
# coding: utf-8 import re import six from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization class PassportResult: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_types = { 'passport_type': 'str', 'country_code': 'str', 'passport_number': 'str', 'nationality': 'str', 'surname': 'str', 'given_name': 'str', 'sex': 'str', 'date_of_birth': 'str', 'date_of_expiry': 'str', 'date_of_issue': 'str', 'place_of_birth': 'str', 'place_of_issue': 'str', 'issuing_authority': 'str', 'confidence': 'object', 'extra_info': 'object' } attribute_map = { 'passport_type': 'passport_type', 'country_code': 'country_code', 'passport_number': 'passport_number', 'nationality': 'nationality', 'surname': 'surname', 'given_name': 'given_name', 'sex': 'sex', 'date_of_birth': 'date_of_birth', 'date_of_expiry': 'date_of_expiry', 'date_of_issue': 'date_of_issue', 'place_of_birth': 'place_of_birth', 'place_of_issue': 'place_of_issue', 'issuing_authority': 'issuing_authority', 'confidence': 'confidence', 'extra_info': 'extra_info' } def __init__(self, passport_type=None, country_code=None, passport_number=None, nationality=None, surname=None, given_name=None, sex=None, date_of_birth=None, date_of_expiry=None, date_of_issue=None, place_of_birth=None, place_of_issue=None, issuing_authority=None, confidence=None, extra_info=None): """PassportResult - a model defined in huaweicloud sdk""" self._passport_type = None self._country_code = None self._passport_number = None self._nationality = None self._surname = None self._given_name = None self._sex = None self._date_of_birth = None self._date_of_expiry = None self._date_of_issue = None self._place_of_birth = None self._place_of_issue = None self._issuing_authority = None self._confidence = None self._extra_info = None self.discriminator = None if passport_type is not None: self.passport_type = passport_type if country_code is not None: self.country_code = country_code if passport_number is not None: self.passport_number = passport_number if nationality is not None: self.nationality = nationality if surname is not None: self.surname = surname if given_name is not None: self.given_name = given_name if sex is not None: self.sex = sex if date_of_birth is not None: self.date_of_birth = date_of_birth if date_of_expiry is not None: self.date_of_expiry = date_of_expiry if date_of_issue is not None: self.date_of_issue = date_of_issue if place_of_birth is not None: self.place_of_birth = place_of_birth if place_of_issue is not None: self.place_of_issue = place_of_issue if issuing_authority is not None: self.issuing_authority = issuing_authority if confidence is not None: self.confidence = confidence if extra_info is not None: self.extra_info = extra_info @property def passport_type(self): """Gets the passport_type of this PassportResult. 护照类型(P:普通因私护照、W:外交护照、G:公务护照)(英文)。 :return: The passport_type of this PassportResult. :rtype: str """ return self._passport_type @passport_type.setter def passport_type(self, passport_type): """Sets the passport_type of this PassportResult. 护照类型(P:普通因私护照、W:外交护照、G:公务护照)(英文)。 :param passport_type: The passport_type of this PassportResult. :type: str """ self._passport_type = passport_type @property def country_code(self): """Gets the country_code of this PassportResult. 护照签发国的国家码(英文)。 :return: The country_code of this PassportResult. :rtype: str """ return self._country_code @country_code.setter def country_code(self, country_code): """Sets the country_code of this PassportResult. 护照签发国的国家码(英文)。 :param country_code: The country_code of this PassportResult. :type: str """ self._country_code = country_code @property def passport_number(self): """Gets the passport_number of this PassportResult. 护照号码(英文)。 :return: The passport_number of this PassportResult. :rtype: str """ return self._passport_number @passport_number.setter def passport_number(self, passport_number): """Sets the passport_number of this PassportResult. 护照号码(英文)。 :param passport_number: The passport_number of this PassportResult. :type: str """ self._passport_number = passport_number @property def nationality(self): """Gets the nationality of this PassportResult. 护照持有人国籍(英文)。 :return: The nationality of this PassportResult. :rtype: str """ return self._nationality @nationality.setter def nationality(self, nationality): """Sets the nationality of this PassportResult. 护照持有人国籍(英文)。 :param nationality: The nationality of this PassportResult. :type: str """ self._nationality = nationality @property def surname(self): """Gets the surname of this PassportResult. 姓(英文)。 :return: The surname of this PassportResult. :rtype: str """ return self._surname @surname.setter def surname(self, surname): """Sets the surname of this PassportResult. 姓(英文)。 :param surname: The surname of this PassportResult. :type: str """ self._surname = surname @property def given_name(self): """Gets the given_name of this PassportResult. 名字(英文)。 :return: The given_name of this PassportResult. :rtype: str """ return self._given_name @given_name.setter def given_name(self, given_name): """Sets the given_name of this PassportResult. 名字(英文)。 :param given_name: The given_name of this PassportResult. :type: str """ self._given_name = given_name @property def sex(self): """Gets the sex of this PassportResult. 性别(英文)。 :return: The sex of this PassportResult. :rtype: str """ return self._sex @sex.setter def sex(self, sex): """Sets the sex of this PassportResult. 性别(英文)。 :param sex: The sex of this PassportResult. :type: str """ self._sex = sex @property def date_of_birth(self): """Gets the date_of_birth of this PassportResult. 出生日期(英文)。 :return: The date_of_birth of this PassportResult. :rtype: str """ return self._date_of_birth @date_of_birth.setter def date_of_birth(self, date_of_birth): """Sets the date_of_birth of this PassportResult. 出生日期(英文)。 :param date_of_birth: The date_of_birth of this PassportResult. :type: str """ self._date_of_birth = date_of_birth @property def date_of_expiry(self): """Gets the date_of_expiry of this PassportResult. 护照有效期(英文)。 :return: The date_of_expiry of this PassportResult. :rtype: str """ return self._date_of_expiry @date_of_expiry.setter def date_of_expiry(self, date_of_expiry): """Sets the date_of_expiry of this PassportResult. 护照有效期(英文)。 :param date_of_expiry: The date_of_expiry of this PassportResult. :type: str """ self._date_of_expiry = date_of_expiry @property def date_of_issue(self): """Gets the date_of_issue of this PassportResult. 护照签发日期(英文)。 :return: The date_of_issue of this PassportResult. :rtype: str """ return self._date_of_issue @date_of_issue.setter def date_of_issue(self, date_of_issue): """Sets the date_of_issue of this PassportResult. 护照签发日期(英文)。 :param date_of_issue: The date_of_issue of this PassportResult. :type: str """ self._date_of_issue = date_of_issue @property def place_of_birth(self): """Gets the place_of_birth of this PassportResult. 出生地(英文)。 :return: The place_of_birth of this PassportResult. :rtype: str """ return self._place_of_birth @place_of_birth.setter def place_of_birth(self, place_of_birth): """Sets the place_of_birth of this PassportResult. 出生地(英文)。 :param place_of_birth: The place_of_birth of this PassportResult. :type: str """ self._place_of_birth = place_of_birth @property def place_of_issue(self): """Gets the place_of_issue of this PassportResult. 签发地(英文)。 :return: The place_of_issue of this PassportResult. :rtype: str """ return self._place_of_issue @place_of_issue.setter def place_of_issue(self, place_of_issue): """Sets the place_of_issue of this PassportResult. 签发地(英文)。 :param place_of_issue: The place_of_issue of this PassportResult. :type: str """ self._place_of_issue = place_of_issue @property def issuing_authority(self): """Gets the issuing_authority of this PassportResult. 签发机构(英文),其中对中国的英文简写统一输出为P.R.China。 :return: The issuing_authority of this PassportResult. :rtype: str """ return self._issuing_authority @issuing_authority.setter def issuing_authority(self, issuing_authority): """Sets the issuing_authority of this PassportResult. 签发机构(英文),其中对中国的英文简写统一输出为P.R.China。 :param issuing_authority: The issuing_authority of this PassportResult. :type: str """ self._issuing_authority = issuing_authority @property def confidence(self): """Gets the confidence of this PassportResult. 相关字段的置信度信息,置信度越大,表示本次识别的对应字段的可靠性越高,在统计意义上,置信度越大,准确率越高。 置信度由算法给出,不直接等价于对应字段的准确率。 :return: The confidence of this PassportResult. :rtype: object """ return self._confidence @confidence.setter def confidence(self, confidence): """Sets the confidence of this PassportResult. 相关字段的置信度信息,置信度越大,表示本次识别的对应字段的可靠性越高,在统计意义上,置信度越大,准确率越高。 置信度由算法给出,不直接等价于对应字段的准确率。 :param confidence: The confidence of this PassportResult. :type: object """ self._confidence = confidence @property def extra_info(self): """Gets the extra_info of this PassportResult. 默认为空。对于部分常见国家的护照OCR服务,extra_info内会包含护照上由本地官方语言描述的字段信息及其他信息。 如中国护照,里面会包含汉字表达的姓名、出生地等信息。 :return: The extra_info of this PassportResult. :rtype: object """ return self._extra_info @extra_info.setter def extra_info(self, extra_info): """Sets the extra_info of this PassportResult. 默认为空。对于部分常见国家的护照OCR服务,extra_info内会包含护照上由本地官方语言描述的字段信息及其他信息。 如中国护照,里面会包含汉字表达的姓名、出生地等信息。 :param extra_info: The extra_info of this PassportResult. :type: object """ self._extra_info = extra_info def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: if attr in self.sensitive_list: result[attr] = "****" else: result[attr] = value return result def to_str(self): """Returns the string representation of the model""" import simplejson as json if six.PY2: import sys reload(sys) sys.setdefaultencoding("utf-8") return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) def __repr__(self): """For `print`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, PassportResult): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """Returns true if both objects are not equal""" return not self == other
3495f596b1c1d7cb79884261ce080ad49e5967d2
ac8eee756bbdc69c688a4f748cca625d5f064b9a
/spam_api/spam_api/wsgi.py
a6c1060edd85cf22ad0d71827a7db8f47cfc477e
[]
no_license
matiaschaud/TP-ProgramacionAvanzada
a15bdd7be5a2b1f4fbd29d4acabc8980072713ef
6e162f31ad91abde688229eb4f6aeb6ef60ebbee
refs/heads/main
2023-03-18T00:39:22.515287
2021-03-01T23:52:15
2021-03-01T23:52:15
316,798,024
0
0
null
null
null
null
UTF-8
Python
false
false
393
py
""" WSGI config for spam_api project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'spam_api.settings') application = get_wsgi_application()
00525edd9f91bf0763fa8d35db247a55724a0f90
ad13583673551857615498b9605d9dcab63bb2c3
/output/models/nist_data/atomic/duration/schema_instance/nistschema_sv_iv_atomic_duration_enumeration_2_xsd/__init__.py
aa2a5364c28c8263b4cba85ac2516304e22deade
[ "MIT" ]
permissive
tefra/xsdata-w3c-tests
397180205a735b06170aa188f1f39451d2089815
081d0908382a0e0b29c8ee9caca6f1c0e36dd6db
refs/heads/main
2023-08-03T04:25:37.841917
2023-07-29T17:10:13
2023-07-30T12:11:13
239,622,251
2
0
MIT
2023-07-25T14:19:04
2020-02-10T21:59:47
Python
UTF-8
Python
false
false
381
py
from output.models.nist_data.atomic.duration.schema_instance.nistschema_sv_iv_atomic_duration_enumeration_2_xsd.nistschema_sv_iv_atomic_duration_enumeration_2 import ( NistschemaSvIvAtomicDurationEnumeration2, NistschemaSvIvAtomicDurationEnumeration2Type, ) __all__ = [ "NistschemaSvIvAtomicDurationEnumeration2", "NistschemaSvIvAtomicDurationEnumeration2Type", ]
514a299a64c3bb30347bba5a25c3b98d681ecc46
313c9f5891993971c7104937caece9504c2b3007
/playground/env/bin/pip3.6
719376daf30ac55b4afcef14072baf8f565874c4
[]
no_license
lolegoogle1015/get_in_python
0dc51214ef320dfbb74a1c105baae176525cb66f
b3da667ab8252ebbe3d04c63320ac5fff04b80ed
refs/heads/master
2022-12-22T09:19:30.518602
2020-11-26T17:35:53
2020-11-26T17:35:53
251,711,874
0
1
null
2022-12-12T20:49:00
2020-03-31T19:36:35
Python
UTF-8
Python
false
false
240
6
#!/home/oleh/Study/Python/playground/env/bin/python3 # -*- coding: utf-8 -*- import re import sys from pip import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
787a5bbbc0f89f35de62c6a9df56fe8e236de8b7
5fc9b2e04599fdca46803ebcd5865b3fbc6b14ad
/main.py
4e992e98e830d15fab412584525e688f16b5ba70
[]
no_license
Yizong98/bookblog_Cataglogue
e112ddd55149e1bcb02263a29e5c422eb36d8331
65cbfcbf54a749787f38e140dd558fcfa2541027
refs/heads/master
2020-05-02T23:39:03.867095
2019-03-28T21:55:29
2019-03-28T21:55:29
178,286,124
0
0
null
null
null
null
UTF-8
Python
false
false
17,977
py
import requests from flask import make_response import json import httplib2 from oauth2client.client import FlowExchangeError from oauth2client.client import flow_from_clientsecrets import string import random from flask import session as login_session from database_setup import Book, Base, MenuItem, Author, User from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine, asc from flask import Flask, render_template, request, redirect,\ jsonify, url_for, flash app = Flask(__name__) CLIENT_ID = json.loads( open('client_secrets.json', 'r').read())['web']['client_id'] APPLICATION_NAME = "Books Recommendation Application" # Connect to Database and create database session engine = create_engine('sqlite:///bookscatalogue.db?check_same_thread=False') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) session = DBSession() # Create anti-forgery state token @app.route('/login') def showLogin(): state = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in xrange(32)) login_session['state'] = state # return "The current session state is %s" % login_session['state'] return render_template('login.html', STATE=state) @app.route('/fbconnect', methods=['POST']) def fbconnect(): if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response access_token = request.data print "access token received %s " % access_token # Use token to get user info from API userinfo_url = "https://graph.facebook.com/me" url = '%s?access_token=%s&fields=name,id,email,picture' % ( userinfo_url, access_token) h = httplib2.Http() result = h.request(url, 'GET')[1] # print "url sent for API access:%s"% url # print "API JSON result: %s" % result data = json.loads(result) login_session['provider'] = 'facebook' login_session['username'] = data["name"] login_session['email'] = data["email"] login_session['facebook_id'] = data["id"] # The token must be stored in the login_session in order to properly logout login_session['access_token'] = access_token # Get user picture login_session['picture'] = data["picture"]["data"]["url"] # see if user exists user_id = getUserID(login_session['email']) if not user_id: user_id = createUser(login_session) login_session['user_id'] = user_id # create display output output = '' output += '<h1>Welcome, ' output += login_session['username'] output += '!</h1>' output += '<img src="' output += login_session['picture'] output += ' " style = "width: 300px; height: 300px;border-radius: 150px\ ;-webkit-border-radius: 150px;-moz-border-radius: 150px;"> ' flash("Now logged in as %s" % login_session['username']) return output @app.route('/fbdisconnect') def fbdisconnect(): facebook_id = login_session['facebook_id'] # The access token must me included to successfully logout access_token = login_session['access_token'] url = 'https://graph.facebook.com/%s/permissions?access_token=%s' % ( facebook_id, access_token) h = httplib2.Http() print("AFTER ", login_session['username']) result = h.request(url, 'DELETE')[1] return "you have been logged out" @app.route('/gconnect', methods=['POST']) def gconnect(): # Validate state token if request.args.get('state') != login_session['state']: response = make_response(json.dumps('Invalid state parameter.'), 401) response.headers['Content-Type'] = 'application/json' return response # Obtain authorization code code = request.data try: # Upgrade the authorization code into a credentials object oauth_flow = flow_from_clientsecrets('client_secrets.json', scope='') oauth_flow.redirect_uri = 'postmessage' credentials = oauth_flow.step2_exchange(code) except FlowExchangeError: response = make_response( json.dumps('Failed to upgrade the authorization code.'), 401) response.headers['Content-Type'] = 'application/json' return response # Check that the access token is valid. access_token = credentials.access_token url = ('https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=%s' % access_token) h = httplib2.Http() result = json.loads(h.request(url, 'GET')[1]) # If there was an error in the access token info, abort. if result.get('error') is not None: print("WTF") response = make_response(json.dumps(result.get('error')), 500) response.headers['Content-Type'] = 'application/json' return response # Verify that the access token is used for the intended user. gplus_id = credentials.id_token['sub'] if result['user_id'] != gplus_id: response = make_response( json.dumps("Token's user ID doesn't match given user ID."), 401) response.headers['Content-Type'] = 'application/json' return response # Verify that the access token is valid for this app. if result['issued_to'] != CLIENT_ID: response = make_response( json.dumps("Token's client ID does not match app's."), 401) print "Token's client ID does not match app's." response.headers['Content-Type'] = 'application/json' return response stored_access_token = login_session.get('access_token') stored_gplus_id = login_session.get('gplus_id') if stored_access_token is not None and gplus_id == stored_gplus_id: response = make_response(json.dumps('Current user is \ already connected.'), 200) response.headers['Content-Type'] = 'application/json' return response # Store the access token in the session for later use. login_session['access_token'] = credentials.access_token login_session['gplus_id'] = gplus_id # Get user info userinfo_url = "https://www.googleapis.com/oauth2/v1/userinfo" params = {'access_token': credentials.access_token, 'alt': 'json'} answer = requests.get(userinfo_url, params=params) data = answer.json() login_session['username'] = data['name'] login_session['picture'] = data['picture'] login_session['email'] = data['email'] # ADD PROVIDER TO LOGIN SESSION login_session['provider'] = 'google' # see if user exists, if it doesn't make a new one user_id = getUserID(data["email"]) if not user_id: user_id = createUser(login_session) login_session['user_id'] = user_id output = '' output += '<h1>Welcome, ' output += login_session['username'] output += '!</h1>' output += '<img src="' output += login_session['picture'] output += ' " style = "width: 300px; height: 300px;border-radius: 150px;\ -webkit-border-radius: 150px;-moz-border-radius: 150px;"> ' flash("you are now logged in as %s" % login_session['username']) print "done!" return output @app.route('/gdisconnect') def gdisconnect(): access_token = login_session.get('access_token') if access_token is None: print 'Access Token is None' response = make_response(json.dumps( 'Current user not connected.'), 401) response.headers['Content-Type'] = 'application/json' return response print 'In gdisconnect access token is %s', access_token print 'User name is: ' print login_session['username'] url = 'https://accounts.google.com/o/oauth2/revoke?token=%s' \ % login_session['access_token'] h = httplib2.Http() result = h.request(url, 'GET')[0] print 'result is ' print result # When valid status, make response if result['status'] == '200': response = make_response(json.dumps('Successfully disconnected.'), 200) response.headers['Content-Type'] = 'application/json' return response else: response = make_response(json.dumps( 'Failed to revoke token for given user.', 400)) response.headers['Content-Type'] = 'application/json' return response # Show all categories @app.route('/') @app.route('/book/') def showBooks(): books = session.query(Book).order_by(asc(Book.name)) menuitems = session.query(MenuItem).order_by(asc(MenuItem.author_name)) names = set(item.author_name for item in menuitems) if 'username' not in login_session: return render_template('publicbooks.html', books=books, items=names) else: return render_template('books.html', books=books, items=names) # Create a new Book @app.route('/book/new/', methods=['GET', 'POST']) def newBook(): if 'username' not in login_session: return redirect('/login') if request.method == 'POST': # When post, add new book newBook = Book(name=request.form['name'], user_id=login_session['user_id']) session.add(newBook) flash('New Book %s Successfully Created' % newBook.name) session.commit() return redirect(url_for('showBooks')) else: return render_template('newBook.html') # Edit a Book @app.route('/book/<int:book_id>/edit/', methods=['GET', 'POST']) def editBook(book_id): if 'username' not in login_session: return redirect('/login') editedBook = session.query(Book).filter_by(id=book_id).one() # if id doesnt match, disokay alert if editedBook.user_id != login_session['user_id']: return "<script>function myFunction() \ {alert('You are not authorized to edit this book.\ Please create your own book in order to edit.');}\ </script><body onload='myFunction()'>" if request.method == 'POST': if request.form['name']: editedBook.name = request.form['name'] flash('Book Successfully Edited %s' % editedBook.name) return redirect(url_for('showBooks')) else: return render_template('editBook.html', book=editedBook) # Delete a Book @app.route('/book/<int:book_id>/delete/', methods=['GET', 'POST']) def deleteBook(book_id): if 'username' not in login_session: return redirect('/login') bookToDelete = session.query(Book).filter_by(id=book_id).one() print(bookToDelete.user_id) # if id doesnt match, disokay alert if bookToDelete.user_id != login_session['user_id']: return "<script>function myFunction() \ {alert('You are not authorized to delete this book!\ Please create your own book in order to delete.');}\ </script><body onload='myFunction()'>" # see if post request if request.method == 'POST': session.delete(bookToDelete) session.query(MenuItem).filter_by(book_id=bookToDelete.id).delete() flash('%s Successfully Deleted' % bookToDelete.name) session.commit() return redirect(url_for('showBooks', book_id=book_id)) else: # if it is Get, go to the delete page return render_template('deleteBook.html', book=bookToDelete) # Show a book menu @app.route('/book/<int:book_id>/') @app.route('/book/<int:book_id>/menu/') def showMenu(book_id): book = session.query(Book).filter_by(id=book_id).one() creator = getUserInfo(book.user_id) items = session.query(MenuItem).filter_by(book_id=book_id).all() print("HAHIDHSIDUHSDIU") print('username' not in login_session) print(login_session) if 'username' not in login_session or \ creator.id != login_session['user_id']: return render_template('publicmenu.html', items=items, book=book, creator=creator) else: return render_template('menu.html', items=items, book=book, creator=creator) # Create a new menu item @app.route('/book/<int:book_id>/menu/new/', methods=['GET', 'POST']) def newMenuItem(book_id): if 'username' not in login_session: return redirect('/login') book = session.query(Book).filter_by(id=book_id).one() # if id doesnt match, disokay alert if login_session['user_id'] != book.user_id: return "<script>function myFunction() \ {alert('You are not authorized to add menu items\ to this book.\ Please create your own book in order to add items.');\ }</script><body onload='myFunction()'>" # add wgen post request if request.method == 'POST': newItem = MenuItem(name=request.form['name'], description=request.form['description'], price=request.form['price'], author_name=request.form['author_name'], book_id=book_id, user_id=book.user_id) session.add(newItem) session.commit() flash('New Menu %s Item Successfully Created' % (newItem.name)) return redirect(url_for('showMenu', book_id=book_id)) else: return render_template('newmenuitem.html', book_id=book_id) # Edit a menu item @app.route('/book/<int:book_id>/menu/<int:menu_id>/edit', methods=['GET', 'POST']) def editMenuItem(book_id, menu_id): if 'username' not in login_session: return redirect('/login') editedItem = session.query(MenuItem).filter_by(id=menu_id).one() book = session.query(Book).filter_by(id=book_id).one() # if id doesnt match, disokay alert if login_session['user_id'] != book.user_id: return "<script>function myFunction() \ {alert('You are not authorized to edit menu \ items to this book.\ Please create your own book in order to edit items.');\ }</script><body onload='myFunction()'>" # delete wgen post request if request.method == 'POST': print(request.form) if request.form['name']: editedItem.name = request.form['name'] if request.form['description']: editedItem.description = request.form['description'] if request.form['price']: editedItem.price = request.form['price'] if request.form['author_name']: print("ITEM", editedItem.author_name) editedItem.author_name = request.form['author_name'] session.add(editedItem) session.commit() flash('Menu Item Successfully Edited') return redirect(url_for('showMenu', book_id=book_id)) else: return render_template('editmenuitem.html', book_id=book_id, menu_id=menu_id, item=editedItem) # Delete a menu item @app.route('/book/<int:book_id>/menu/<int:menu_id>/delete', methods=['GET', 'POST']) def deleteMenuItem(book_id, menu_id): if 'username' not in login_session: return redirect('/login') book = session.query(Book).filter_by(id=book_id).one() itemToDelete = session.query(MenuItem).filter_by(id=menu_id).one() # if id doesnt match, disokay alert if login_session['user_id'] != book.user_id: return "<script>function myFunction() \ {alert('You are not authorized \ to delete menu items to this book. \ Please create your own book in order to delete items.');\ }</script><body onload='myFunction()'>" if request.method == 'POST': # delete wgen post request session.delete(itemToDelete) session.commit() flash('Menu Item Successfully Deleted') return redirect(url_for('showMenu', book_id=book_id)) else: return render_template('deleteMenuItem.html', item=itemToDelete) # JSON APIs to view book Information @app.route('/book/<int:book_id>/menu/JSON') def BookMenuJSON(book_id): print(session.query(Book).filter_by(id=book_id).one()) book = session.query(Book).filter_by(id=book_id).one() items = session.query(MenuItem).filter_by(book_id=book_id).all() return jsonify(MenuItems=[i.serialize for i in items]) @app.route('/book/<int:book_id>/menu/<int:menu_id>/JSON') def menuItemJSON(book_id, menu_id): Menu_Item = session.query(MenuItem).filter_by(id=menu_id).one() return jsonify(Menu_Item=Menu_Item.serialize) @app.route('/book/JSON') def BooksJSON(): books = session.query(Book).all() return jsonify(books=[r.serialize for r in books]) def createUser(login_session): # Add user newUser = User(name=login_session['username'], email=login_session[ 'email'], picture=login_session['picture']) session.add(newUser) session.commit() user = session.query(User).filter_by(email=login_session['email']).one() return user.id def getUserInfo(user_id): user = session.query(User).filter_by(id=user_id).one() return user def getUserID(email): try: user = session.query(User).filter_by(email=email).one() return user.id except: return None # Disconnect based on provider @app.route('/disconnect') def disconnect(): # check whether user in session if 'provider' in login_session: if login_session['provider'] == 'google': gdisconnect() del login_session['gplus_id'] del login_session['access_token'] if login_session['provider'] == 'facebook': fbdisconnect() del login_session['facebook_id'] # delete all session info when closerd del login_session['username'] del login_session['email'] del login_session['picture'] del login_session['user_id'] del login_session['provider'] flash("You have successfully been logged out.") return redirect(url_for('showBooks')) else: flash("You were not logged in") return redirect(url_for('showBooks')) if __name__ == '__main__': app.secret_key = 'super_secret_key' app.debug = True app.run(host='0.0.0.0', port=8000)
c702a1355b9688ac31eb5f513f2d151be4f47134
f242b489b9d3db618cf04415d4a7d490bac36db0
/Archives_Homework/src/archivesziped.py
2b15451a84885e66b830d42976855d566e4d935e
[]
no_license
LABETE/Python2_Homework
e33d92d4f8a1867a850430600ccc7baf7ebc6dad
b24207b74c7883c220efc28d315e386dedead41d
refs/heads/master
2016-08-12T19:04:05.304348
2015-05-27T04:05:18
2015-05-27T04:05:18
36,182,485
0
0
null
null
null
null
UTF-8
Python
false
false
710
py
import zipfile import os import glob def zippedfiles(zipfilename): path = os.getcwd() zip_file = os.path.join(path, os.path.basename(zipfilename)+".zip") files_to_zip = [os.path.basename(fn) for fn in glob.glob(zipfilename+"\*") if os.path.isfile(fn)] zf = zipfile.ZipFile(zip_file, "w", zipfile.ZIP_DEFLATED) file_to_zip = os.path.split(zipfilename) file_to_zip = file_to_zip[-1] for file in files_to_zip: zf.write(os.path.join(path,file),os.path.join(file_to_zip,file)) list_ziped_files = zf.namelist() zf.close() sorted_ziped_files = [] for file in list_ziped_files: sorted_ziped_files.append(file.replace("/","\\")) return sorted_ziped_files
71f9088eb2850508d7b32b8291db9c48eaf63ed4
649bd422025e421d86025743eac324c9b882a2e8
/exam/1_three-dimensional_atomic_system/dump/phasetrans/temp50_8000.py
bb136f85f5c8e67ef30d0a736db52e8c424e4cff
[]
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,893
py
ITEM: TIMESTEP 8000 ITEM: NUMBER OF ATOMS 2048 ITEM: BOX BOUNDS pp pp pp 6.8399774235701472e-01 4.6516002257638277e+01 6.8399774235701472e-01 4.6516002257638277e+01 6.8399774235701472e-01 4.6516002257638277e+01 ITEM: ATOMS id type xs ys zs 8 1 0.125275 0.0524332 0.0700987 35 1 0.055693 0.119442 0.0648769 130 1 0.0616181 0.0547876 0.124558 165 1 0.126576 0.11896 0.126558 117 1 0.629185 0.381969 0.00479994 147 1 0.562191 0.00221148 0.189248 1039 1 0.436585 0.503297 0.061793 12 1 0.252674 0.0544219 0.058728 39 1 0.182635 0.120352 0.0618921 43 1 0.314606 0.119882 0.0651928 134 1 0.187246 0.0604005 0.122769 138 1 0.317592 0.0604458 0.123622 169 1 0.252452 0.122122 0.124648 82 1 0.558777 0.315202 0.00646483 85 1 0.618607 0.255592 0.00203588 397 1 0.37019 -0.00249033 0.372018 271 1 0.440397 -0.000869142 0.309943 259 1 0.060496 -0.00193926 0.308511 16 1 0.375499 0.0603909 0.0657616 47 1 0.436956 0.12426 0.0635057 142 1 0.436794 0.0616845 0.131913 173 1 0.373818 0.124945 0.126361 20 1 0.500724 0.0683344 0.0697854 518 1 0.188316 0.0599628 0.502126 1043 1 0.559323 0.496893 0.0600433 121 1 0.744977 0.378285 0.00809734 177 1 0.496375 0.128972 0.129971 24 1 0.619914 0.0621852 0.0615539 51 1 0.560747 0.123861 0.0670863 146 1 0.557121 0.0657963 0.127899 181 1 0.623399 0.125702 0.1258 512 1 0.87847 0.440042 0.440048 135 1 0.18672 0.00215882 0.190384 28 1 0.747809 0.0567115 0.0638979 55 1 0.686831 0.117041 0.0587394 59 1 0.821391 0.126433 0.0628188 150 1 0.685996 0.0634803 0.122317 154 1 0.808534 0.0601883 0.126617 185 1 0.749955 0.123422 0.121806 122 1 0.813307 0.441177 0.00224049 511 1 0.933441 0.37016 0.43958 86 1 0.688381 0.315152 0.00723756 267 1 0.305731 0.000642363 0.309925 403 1 0.564603 7.83976e-05 0.438374 161 1 0.98911 0.121528 0.125743 4 1 1.00032 0.0577103 0.0613343 32 1 0.875994 0.0551447 0.0584332 63 1 0.933112 0.117627 0.0604438 158 1 0.940662 0.0556838 0.122455 189 1 0.876372 0.128137 0.123092 510 1 0.938072 0.439574 0.370386 405 1 0.625534 -0.000763179 0.374656 137 1 0.24609 -0.0027281 0.127834 40 1 0.12264 0.187154 0.064434 67 1 0.0621523 0.246944 0.0598532 72 1 0.125549 0.306594 0.0622905 162 1 0.0583119 0.181749 0.122893 194 1 0.058968 0.312171 0.127075 197 1 0.119212 0.246858 0.123427 68 1 0.00112882 0.310166 0.0644128 193 1 1.00337 0.250352 0.128425 36 1 0.994991 0.188341 0.0624711 53 1 0.621827 0.118643 -0.00124165 570 1 0.811756 0.183528 0.504084 44 1 0.244967 0.184196 0.0642356 71 1 0.188147 0.248519 0.0633854 75 1 0.303371 0.245034 0.0600301 76 1 0.246176 0.318303 0.0653256 166 1 0.18216 0.182365 0.126476 170 1 0.30957 0.182367 0.124042 198 1 0.185137 0.31214 0.124392 201 1 0.249644 0.248747 0.12439 202 1 0.310898 0.313749 0.129209 1411 1 0.0649441 0.496923 0.440246 1419 1 0.308126 0.495667 0.440822 1031 1 0.181989 0.496211 0.0597779 48 1 0.364943 0.186716 0.0619609 79 1 0.434004 0.247066 0.0590481 80 1 0.36766 0.310752 0.0656114 174 1 0.43521 0.190688 0.125649 205 1 0.366921 0.245658 0.125254 206 1 0.433675 0.309355 0.124266 52 1 0.498767 0.183013 0.0615933 209 1 0.497324 0.254251 0.127659 1427 1 0.568519 0.49429 0.436818 263 1 0.189523 0.000990593 0.310561 84 1 0.498894 0.307384 0.065758 56 1 0.622955 0.185115 0.0640302 83 1 0.562237 0.249481 0.0663199 88 1 0.624964 0.318461 0.0650322 178 1 0.566754 0.186921 0.126492 210 1 0.56921 0.308622 0.127212 213 1 0.628612 0.251258 0.130193 395 1 0.31312 -0.0022712 0.433694 60 1 0.747822 0.184389 0.0631689 87 1 0.683456 0.248918 0.064574 91 1 0.812381 0.250316 0.0612225 92 1 0.753786 0.315455 0.0633242 182 1 0.688258 0.186508 0.123109 186 1 0.810621 0.188832 0.12471 214 1 0.688962 0.31556 0.126657 217 1 0.749284 0.251193 0.120148 218 1 0.817371 0.311749 0.128465 49 1 0.495497 0.128481 -0.00224216 265 1 0.248562 0.0063132 0.247857 393 1 0.244096 0.000473523 0.37808 606 1 0.934114 0.30689 0.500771 64 1 0.872013 0.191676 0.0537877 95 1 0.934179 0.250345 0.0603664 96 1 0.870875 0.315334 0.0639238 190 1 0.937174 0.187316 0.125603 221 1 0.87279 0.245532 0.123346 222 1 0.934524 0.305976 0.127856 385 1 -0.0038265 0.00827323 0.378861 99 1 0.05997 0.372612 0.0624401 104 1 0.120514 0.435591 0.0593198 226 1 0.0673868 0.437571 0.12167 229 1 0.125455 0.375979 0.116444 550 1 0.188235 0.184894 0.499874 1161 1 0.247494 0.500671 0.125602 509 1 0.87392 0.37827 0.373062 590 1 0.43866 0.313227 0.497585 1153 1 0.00142726 0.500154 0.127384 151 1 0.681864 0.00248686 0.185075 391 1 0.184335 0.000527043 0.441033 1165 1 0.371129 0.497274 0.125852 257 1 -0.000722187 -0.0021065 0.247572 103 1 0.184689 0.374186 0.0593363 107 1 0.31269 0.375578 0.0581362 108 1 0.246532 0.438378 0.0621988 230 1 0.184564 0.44092 0.120139 233 1 0.25054 0.379865 0.126184 234 1 0.315735 0.433948 0.115661 111 1 0.431998 0.372218 0.0607526 112 1 0.370097 0.434042 0.0569016 237 1 0.371124 0.369449 0.126185 238 1 0.429018 0.436489 0.124979 241 1 0.497142 0.372591 0.126605 116 1 0.492474 0.435492 0.0661674 153 1 0.746881 -0.00351767 0.124165 508 1 0.751862 0.438625 0.432939 507 1 0.810479 0.373301 0.435856 593 1 0.49481 0.252887 0.496526 115 1 0.557046 0.376685 0.0680944 120 1 0.622822 0.43363 0.0680285 242 1 0.556513 0.440184 0.133747 245 1 0.622741 0.372414 0.127897 119 1 0.683351 0.380104 0.069721 123 1 0.819333 0.373428 0.0694191 124 1 0.755192 0.44184 0.0674971 246 1 0.685507 0.444619 0.128739 249 1 0.754461 0.378796 0.124713 250 1 0.81934 0.437737 0.126296 506 1 0.81597 0.443169 0.372735 573 1 0.876193 0.12455 0.498012 1159 1 0.189929 0.499101 0.190003 1155 1 0.0661853 0.494945 0.183006 505 1 0.7567 0.376026 0.373672 269 1 0.38028 -0.000995045 0.248845 225 1 0.00140618 0.378519 0.122551 100 1 0.99722 0.438281 0.0627536 127 1 0.940094 0.373136 0.0656695 128 1 0.880842 0.435283 0.0671569 253 1 0.876499 0.375233 0.12917 254 1 0.935618 0.442535 0.130081 503 1 0.693837 0.375691 0.436161 136 1 0.130032 0.0577017 0.185799 163 1 0.0622222 0.123473 0.191151 258 1 0.0618529 0.0603591 0.245699 264 1 0.119866 0.0609495 0.316587 291 1 0.0616754 0.128749 0.313389 293 1 0.124726 0.121152 0.253429 132 1 1.00366 0.0666796 0.186091 502 1 0.691358 0.43324 0.375588 140 1 0.253535 0.063444 0.185774 167 1 0.186052 0.119076 0.187346 171 1 0.308814 0.126064 0.189942 262 1 0.183941 0.0647644 0.257193 266 1 0.309982 0.0633069 0.245493 268 1 0.255611 0.0623238 0.311484 295 1 0.188015 0.123768 0.311465 297 1 0.251724 0.123683 0.249312 299 1 0.314813 0.127527 0.314328 1289 1 0.250522 0.500426 0.252412 144 1 0.376605 0.0623253 0.192652 175 1 0.433705 0.125159 0.19272 270 1 0.438075 0.063988 0.257555 272 1 0.376435 0.0652942 0.316689 301 1 0.373117 0.118548 0.253367 303 1 0.439181 0.126787 0.318896 19 1 0.560558 0.00104114 0.0690607 500 1 0.504023 0.431466 0.434951 1413 1 0.124008 0.497642 0.375293 276 1 0.500628 0.0630437 0.317454 305 1 0.496777 0.123844 0.254675 148 1 0.495672 0.065702 0.189262 152 1 0.624977 0.064086 0.185297 179 1 0.563084 0.12722 0.189447 274 1 0.558808 0.0673548 0.247966 280 1 0.628174 0.0628327 0.302833 307 1 0.564124 0.123972 0.310662 309 1 0.630232 0.121424 0.242136 1299 1 0.566599 0.499947 0.316063 498 1 0.562864 0.432113 0.374401 526 1 0.439744 0.0655042 0.499322 275 1 0.562759 0.00257009 0.312551 156 1 0.749968 0.0622159 0.186322 183 1 0.686991 0.125795 0.182222 187 1 0.812156 0.12108 0.183956 278 1 0.689955 0.0594975 0.249463 282 1 0.810719 0.0635833 0.249408 284 1 0.755152 0.0520319 0.313863 311 1 0.692497 0.120989 0.315162 313 1 0.751691 0.120688 0.24523 315 1 0.807939 0.12176 0.309793 499 1 0.565468 0.369109 0.434116 289 1 -0.00201895 0.123361 0.254482 501 1 0.63035 0.373314 0.366725 260 1 -0.000380063 0.0581724 0.316554 160 1 0.874388 0.0635622 0.186119 191 1 0.935696 0.122384 0.191213 286 1 0.931742 0.0579076 0.249366 288 1 0.874633 0.0621917 0.310625 317 1 0.871151 0.123195 0.251103 319 1 0.935115 0.122973 0.313743 168 1 0.124861 0.181999 0.18609 195 1 0.0693674 0.252688 0.188914 200 1 0.13126 0.313201 0.186735 290 1 0.0601946 0.184571 0.250954 296 1 0.126871 0.185965 0.313751 322 1 0.0616025 0.311995 0.253695 323 1 0.0572014 0.251001 0.31574 325 1 0.122313 0.250848 0.254287 328 1 0.125773 0.319958 0.315956 164 1 1.00063 0.185065 0.189062 172 1 0.248334 0.189026 0.184437 199 1 0.186781 0.24843 0.187984 203 1 0.313618 0.25066 0.192746 204 1 0.244636 0.310183 0.187102 294 1 0.18889 0.187028 0.25177 298 1 0.317703 0.187292 0.255181 300 1 0.248049 0.186243 0.318227 326 1 0.190467 0.310967 0.253694 327 1 0.18858 0.25014 0.317268 329 1 0.249769 0.245222 0.248566 330 1 0.313377 0.308267 0.252065 331 1 0.313374 0.248078 0.31365 332 1 0.252545 0.314851 0.311563 176 1 0.370371 0.185437 0.191674 207 1 0.439425 0.246783 0.196445 208 1 0.371415 0.31286 0.185663 302 1 0.433668 0.185326 0.251421 304 1 0.375948 0.190314 0.313465 333 1 0.379412 0.251983 0.254961 334 1 0.439711 0.312241 0.253663 335 1 0.438017 0.251382 0.315074 336 1 0.375193 0.314662 0.310975 340 1 0.505232 0.315173 0.312396 180 1 0.500039 0.186295 0.191424 337 1 0.501246 0.251567 0.255027 212 1 0.496234 0.313262 0.187513 308 1 0.501838 0.188552 0.310634 184 1 0.630361 0.18977 0.184386 211 1 0.559389 0.247819 0.192429 216 1 0.631821 0.314822 0.188217 306 1 0.564115 0.185223 0.252794 312 1 0.629103 0.185063 0.30847 338 1 0.569682 0.308022 0.253439 339 1 0.570209 0.248414 0.312682 341 1 0.631747 0.246689 0.250928 344 1 0.630342 0.314927 0.309583 188 1 0.753959 0.187356 0.185688 215 1 0.694445 0.25086 0.188963 219 1 0.812279 0.247236 0.183254 220 1 0.752743 0.320611 0.187919 310 1 0.689261 0.185336 0.243944 314 1 0.810073 0.186657 0.249921 316 1 0.748746 0.183796 0.309732 342 1 0.694492 0.320974 0.25128 343 1 0.694612 0.25713 0.307742 345 1 0.754485 0.252744 0.251958 346 1 0.8128 0.31294 0.244411 347 1 0.811905 0.252534 0.314156 348 1 0.752137 0.315317 0.309686 196 1 0.996599 0.314622 0.180825 292 1 1.00046 0.190175 0.31441 324 1 -0.00416669 0.317721 0.314576 321 1 0.000911338 0.251834 0.247826 192 1 0.872715 0.182099 0.187069 223 1 0.935426 0.243171 0.18871 224 1 0.880947 0.311094 0.1893 318 1 0.938047 0.184405 0.248423 320 1 0.871554 0.182515 0.311965 349 1 0.877234 0.250605 0.253622 350 1 0.939175 0.311894 0.25019 351 1 0.937758 0.247174 0.308245 352 1 0.877321 0.313384 0.306403 411 1 0.811961 0.00100094 0.440472 46 1 0.433533 0.186141 -0.000616561 227 1 0.0658652 0.374047 0.184487 232 1 0.128632 0.434663 0.187634 354 1 0.0678034 0.439872 0.25225 355 1 0.0617209 0.37569 0.311168 357 1 0.130175 0.375455 0.249329 360 1 0.128666 0.434545 0.311615 356 1 1.00012 0.436321 0.310084 504 1 0.625252 0.434702 0.443334 113 1 0.49685 0.378797 0.00225695 231 1 0.189851 0.375179 0.183973 235 1 0.31036 0.370212 0.189248 236 1 0.248064 0.439971 0.180328 358 1 0.189958 0.43286 0.245724 359 1 0.195322 0.379217 0.309987 361 1 0.251186 0.371979 0.247694 362 1 0.307869 0.440392 0.24672 363 1 0.311123 0.374146 0.312531 364 1 0.252787 0.439078 0.305073 493 1 0.369872 0.378909 0.375474 114 1 0.560023 0.437184 -0.00146678 495 1 0.434231 0.36992 0.435994 1297 1 0.499846 0.50412 0.251622 239 1 0.434901 0.371877 0.195412 240 1 0.374815 0.429233 0.188789 365 1 0.369274 0.373995 0.247718 366 1 0.427429 0.436427 0.255609 367 1 0.434864 0.373794 0.313992 368 1 0.368342 0.439149 0.312526 369 1 0.506779 0.372495 0.256039 244 1 0.494947 0.430412 0.190969 372 1 0.497215 0.434517 0.310592 277 1 0.622488 0.00310053 0.248512 1421 1 0.370078 0.495775 0.378936 494 1 0.438776 0.441141 0.377444 287 1 0.93451 -0.000581836 0.3172 496 1 0.377097 0.434583 0.441454 243 1 0.562879 0.370764 0.188731 248 1 0.622365 0.439639 0.182946 370 1 0.555512 0.438536 0.245991 371 1 0.570988 0.37934 0.309405 373 1 0.629533 0.376554 0.246913 376 1 0.626845 0.436742 0.307212 247 1 0.693106 0.380936 0.184976 251 1 0.816769 0.378511 0.187922 252 1 0.760006 0.439337 0.182568 374 1 0.683277 0.441651 0.245188 375 1 0.691997 0.381449 0.308978 377 1 0.749134 0.384162 0.245002 378 1 0.813362 0.440505 0.249992 379 1 0.815174 0.374103 0.310167 380 1 0.752788 0.440853 0.312655 497 1 0.496321 0.373674 0.374651 38 1 0.18858 0.194051 0.00152719 228 1 -0.00061946 0.437908 0.185375 353 1 0.00221678 0.378326 0.243058 255 1 0.939928 0.380092 0.183881 256 1 0.875097 0.442181 0.185089 381 1 0.878542 0.380172 0.244063 382 1 0.937914 0.439782 0.245908 383 1 0.9344 0.378243 0.307808 384 1 0.876709 0.442965 0.309751 50 1 0.560246 0.186099 0.000872627 1167 1 0.426487 0.498473 0.195197 1423 1 0.442568 0.495815 0.439192 386 1 0.0605286 0.0741717 0.382352 392 1 0.125108 0.0625699 0.436912 419 1 0.0690514 0.135868 0.443591 421 1 0.12458 0.130016 0.373592 388 1 0.997825 0.0640415 0.446233 417 1 1.0034 0.134298 0.377381 1415 1 0.192298 0.503811 0.435246 1295 1 0.434311 0.50107 0.31388 390 1 0.182978 0.0648384 0.372241 394 1 0.313614 0.0606214 0.376549 396 1 0.246154 0.0673198 0.441908 423 1 0.182464 0.124011 0.442589 425 1 0.24554 0.122171 0.377801 427 1 0.310732 0.124461 0.434754 78 1 0.439612 0.310033 0.002018 389 1 0.126422 -0.000391148 0.378946 585 1 0.245788 0.245831 0.499483 398 1 0.434782 0.0583538 0.379076 400 1 0.373881 0.0580505 0.439282 429 1 0.371447 0.12134 0.381348 431 1 0.443496 0.125576 0.440868 81 1 0.496731 0.247286 -0.00151338 1429 1 0.629374 0.491005 0.379029 404 1 0.499904 0.0591644 0.437739 433 1 0.506756 0.124516 0.373246 402 1 0.56267 0.0579228 0.375341 408 1 0.626523 0.0633241 0.439132 435 1 0.560292 0.127019 0.444884 437 1 0.622554 0.11925 0.375672 487 1 0.182877 0.377795 0.439403 406 1 0.685368 0.0572457 0.373184 410 1 0.814564 0.0610824 0.369814 412 1 0.756194 0.0665419 0.440036 439 1 0.693601 0.119483 0.438917 441 1 0.751889 0.121168 0.373412 443 1 0.814097 0.127512 0.437423 486 1 0.18789 0.438475 0.37521 492 1 0.249807 0.43693 0.447123 414 1 0.932316 0.0644499 0.382764 416 1 0.874438 0.0659964 0.447086 445 1 0.871253 0.11953 0.372377 447 1 0.936808 0.132414 0.436863 491 1 0.313525 0.375715 0.435679 489 1 0.242458 0.37707 0.378779 1163 1 0.306723 0.500018 0.18609 418 1 0.0649552 0.192759 0.379161 424 1 0.133522 0.193597 0.440728 450 1 0.0574928 0.316002 0.375403 451 1 0.0656448 0.253648 0.441216 453 1 0.121717 0.256546 0.372897 456 1 0.125206 0.313591 0.436359 449 1 1.00106 0.248526 0.377819 77 1 0.369152 0.244393 0.00519506 490 1 0.304265 0.439911 0.376255 422 1 0.186855 0.193832 0.377395 426 1 0.3107 0.185156 0.376822 428 1 0.24507 0.185965 0.432234 454 1 0.189094 0.317555 0.374734 455 1 0.190236 0.250987 0.434792 457 1 0.255451 0.256071 0.373133 458 1 0.315247 0.314521 0.373333 459 1 0.309062 0.248267 0.438736 460 1 0.248639 0.310952 0.440933 629 1 0.630594 0.371211 0.496101 625 1 0.502912 0.368335 0.499646 430 1 0.436622 0.186099 0.376119 432 1 0.371374 0.190029 0.438597 461 1 0.369845 0.251917 0.372258 462 1 0.433113 0.311783 0.378494 463 1 0.431551 0.2487 0.43656 464 1 0.374082 0.313924 0.435888 468 1 0.505789 0.308597 0.431623 118 1 0.690406 0.445135 0.00711041 1433 1 0.751987 0.500545 0.373653 436 1 0.507268 0.191503 0.431551 465 1 0.507928 0.242982 0.372468 466 1 0.566708 0.313723 0.369081 440 1 0.629399 0.18093 0.434339 434 1 0.563279 0.186624 0.365837 467 1 0.572898 0.248158 0.43907 469 1 0.631549 0.247373 0.36795 472 1 0.634693 0.311807 0.435404 488 1 0.124849 0.441146 0.436271 474 1 0.813675 0.313773 0.375124 442 1 0.811116 0.188621 0.374541 444 1 0.755456 0.187115 0.441106 473 1 0.749352 0.247172 0.371041 475 1 0.812491 0.249281 0.443674 470 1 0.690011 0.31918 0.368648 471 1 0.686217 0.249916 0.436673 476 1 0.747473 0.308543 0.431833 438 1 0.689085 0.185946 0.372502 482 1 0.0591115 0.443409 0.371504 483 1 0.0666077 0.380195 0.439242 452 1 0.992585 0.309521 0.43498 477 1 0.872036 0.249661 0.380288 420 1 0.000553346 0.187583 0.436936 448 1 0.8758 0.190131 0.442231 480 1 0.8726 0.31081 0.436664 446 1 0.935056 0.188087 0.373036 479 1 0.933283 0.246491 0.438527 478 1 0.937181 0.30887 0.373998 485 1 0.12172 0.38201 0.371918 481 1 0.996763 0.378385 0.37694 484 1 0.992663 0.438829 0.434315 1553 1 0.502103 0.496841 0.498846 1055 1 0.937843 0.499356 0.0624657 273 1 0.500204 0.00387479 0.25242 21 1 0.619268 0.000905519 0.00227541 155 1 0.81501 0.00014099 0.190314 90 1 0.811367 0.311814 0.00137175 1285 1 0.128182 0.499018 0.246301 1431 1 0.686755 0.497907 0.442855 1417 1 0.248388 0.501897 0.372361 577 1 0.00128273 0.246963 0.497633 582 1 0.188902 0.309943 0.498519 578 1 0.0557411 0.313581 0.498177 125 1 0.878502 0.374255 -0.000702241 557 1 0.37073 0.124266 0.500574 633 1 0.751862 0.372625 0.498465 18 1 0.552554 0.0651696 0.00435307 69 1 0.123021 0.248902 -0.00370827 637 1 0.870534 0.374045 0.494995 41 1 0.25227 0.123435 0.00193999 73 1 0.246631 0.254953 0.00320193 101 1 0.124262 0.373423 0.00214216 34 1 0.0589355 0.182273 0.00673058 558 1 0.439946 0.190376 0.491329 621 1 0.376034 0.369274 0.50379 97 1 -0.000415093 0.37177 0.00336964 58 1 0.805271 0.179441 -0.00142972 54 1 0.684661 0.180691 0.00276046 6 1 0.192467 0.0590213 0.000853212 102 1 0.184805 0.438561 0.00107606 26 1 0.811599 0.061485 0.00352554 89 1 0.744864 0.244662 0.00308647 74 1 0.312452 0.315216 0.00115518 65 1 0.99676 0.247599 0.00376918 609 1 0.990732 0.37149 0.496292 37 1 0.124931 0.132362 0.00306417 98 1 0.0657646 0.442464 -0.00280968 520 1 0.125524 0.0638617 0.56188 547 1 0.0659808 0.123097 0.56819 642 1 0.0658016 0.061886 0.624484 677 1 0.126159 0.124929 0.625086 673 1 0.999189 0.125459 0.626666 93 1 0.875777 0.255133 1.00199 921 1 0.74815 0.000460717 0.875456 524 1 0.252091 0.0572195 0.564048 551 1 0.186413 0.122502 0.560904 555 1 0.319572 0.131882 0.564111 646 1 0.189207 0.063987 0.624761 650 1 0.315345 0.0619518 0.622212 681 1 0.251996 0.127907 0.621018 1695 1 0.933893 0.500271 0.684607 1941 1 0.623806 0.498919 0.874514 542 1 0.936413 0.0594249 0.504971 528 1 0.37705 0.0615907 0.560516 559 1 0.439015 0.127812 0.556624 654 1 0.443992 0.0549569 0.62632 685 1 0.379661 0.127214 0.618276 532 1 0.500496 0.0638964 0.560844 689 1 0.50462 0.128176 0.627047 1689 1 0.751282 0.499692 0.632069 586 1 0.310669 0.312791 0.494839 514 1 0.0628666 0.0618707 0.496416 781 1 0.379513 0.00499161 0.750569 536 1 0.622621 0.0571451 0.564948 563 1 0.559061 0.126422 0.562662 658 1 0.56224 0.0688272 0.625393 693 1 0.627517 0.123776 0.629261 546 1 0.0653231 0.193418 0.500946 1803 1 0.315142 0.497802 0.816773 14 1 0.441759 0.0672902 0.997374 601 1 0.749888 0.254476 0.500229 540 1 0.758661 0.0678208 0.567378 567 1 0.685567 0.124198 0.569349 571 1 0.819727 0.120528 0.562834 662 1 0.685344 0.0614185 0.624517 666 1 0.821275 0.0651819 0.63014 697 1 0.753268 0.126563 0.626426 661 1 0.624196 0.00368177 0.631185 1809 1 0.508631 0.505684 0.745013 62 1 0.936575 0.190192 1.00072 29 1 0.871462 0.00213121 0.99784 110 1 0.435657 0.437321 1.00435 516 1 0.99786 0.0716583 0.56199 996 1 0.997944 0.438531 0.935663 544 1 0.877367 0.062453 0.55995 575 1 0.934454 0.126884 0.56327 670 1 0.931905 0.0627556 0.627768 701 1 0.878187 0.129257 0.62782 515 1 0.0648278 -0.00281249 0.55872 552 1 0.123232 0.187969 0.560814 579 1 0.0608053 0.255615 0.561765 584 1 0.123948 0.31466 0.558474 674 1 0.064458 0.186942 0.631155 706 1 0.0643131 0.309058 0.62446 709 1 0.123503 0.248347 0.621941 580 1 -0.00372522 0.314828 0.560734 705 1 0.999326 0.250114 0.623209 777 1 0.25607 -0.00257122 0.745076 663 1 0.685112 -0.000900688 0.689102 30 1 0.939087 0.0570406 1.00206 1679 1 0.446635 0.50295 0.684274 556 1 0.25177 0.184586 0.565992 583 1 0.185487 0.24569 0.560674 587 1 0.311419 0.250325 0.560791 588 1 0.246433 0.306751 0.559187 678 1 0.184211 0.186363 0.628395 682 1 0.314686 0.186134 0.624454 710 1 0.186902 0.309659 0.620353 713 1 0.244517 0.24789 0.624694 714 1 0.309722 0.310512 0.620808 560 1 0.381851 0.189021 0.559495 591 1 0.437465 0.252388 0.562125 592 1 0.372224 0.310518 0.560495 686 1 0.444101 0.187084 0.626455 717 1 0.383068 0.24784 0.624619 718 1 0.437454 0.313894 0.622922 596 1 0.502794 0.310829 0.561982 564 1 0.498636 0.189033 0.562648 523 1 0.314728 0.00210603 0.560625 773 1 0.125341 0.00564625 0.749099 721 1 0.502036 0.248482 0.623416 568 1 0.621898 0.187727 0.569837 595 1 0.568819 0.256275 0.564755 600 1 0.631123 0.315527 0.562168 690 1 0.56318 0.193018 0.625238 722 1 0.567904 0.314803 0.629501 725 1 0.62473 0.250678 0.626229 779 1 0.314402 -0.00151518 0.810305 913 1 0.498265 -0.00321982 0.873319 572 1 0.751892 0.193032 0.564018 599 1 0.68936 0.252011 0.571567 603 1 0.809745 0.252912 0.567233 604 1 0.748857 0.312562 0.562591 694 1 0.690173 0.185172 0.627023 698 1 0.817888 0.186332 0.626528 726 1 0.68953 0.314483 0.629646 729 1 0.754108 0.254278 0.628016 730 1 0.813563 0.316284 0.626046 634 1 0.807781 0.437293 0.498871 1567 1 0.940818 0.501329 0.563482 10 1 0.315197 0.0546459 0.998801 33 1 0.995233 0.120877 0.997509 548 1 0.00876758 0.186169 0.565901 576 1 0.873495 0.185508 0.561963 607 1 0.941229 0.247449 0.560208 608 1 0.878436 0.313204 0.560935 702 1 0.939696 0.185789 0.623704 733 1 0.875437 0.247375 0.623246 734 1 0.935181 0.306222 0.624226 602 1 0.81065 0.311771 0.505378 126 1 0.94064 0.432282 0.997026 611 1 0.0616222 0.376244 0.569655 616 1 0.126389 0.436856 0.566742 738 1 0.0654033 0.436975 0.62473 741 1 0.122709 0.374611 0.627321 769 1 0.00234852 0.0040723 0.751022 737 1 1.00039 0.37437 0.62526 1024 1 0.870541 0.432505 0.937213 1805 1 0.376572 0.495761 0.752527 614 1 0.186281 0.436364 0.500145 1929 1 0.251071 0.503398 0.873288 615 1 0.186932 0.373501 0.562401 619 1 0.310988 0.369963 0.557302 620 1 0.247907 0.43756 0.567286 742 1 0.187171 0.440196 0.626988 745 1 0.25092 0.373038 0.622809 746 1 0.314123 0.437807 0.627237 1023 1 0.933678 0.374415 0.935882 57 1 0.751061 0.118486 1.00252 566 1 0.694625 0.178944 0.503505 623 1 0.443964 0.381497 0.560754 624 1 0.375935 0.437914 0.567978 749 1 0.373072 0.371117 0.621401 750 1 0.441755 0.436793 0.622937 628 1 0.508439 0.438387 0.567438 753 1 0.50249 0.369798 0.623516 1795 1 0.0680139 0.496921 0.817023 923 1 0.81505 -0.00299176 0.93023 1797 1 0.124797 0.494565 0.7545 1022 1 0.937339 0.437521 0.868823 627 1 0.563492 0.372319 0.565606 632 1 0.627209 0.435765 0.558897 754 1 0.567104 0.435507 0.625451 757 1 0.628692 0.376433 0.629195 1937 1 0.504501 0.500762 0.87685 1563 1 0.809727 0.501278 0.563689 631 1 0.688578 0.373975 0.564067 635 1 0.808935 0.373558 0.561259 636 1 0.752666 0.441817 0.567418 758 1 0.686823 0.438498 0.621677 761 1 0.748459 0.374813 0.624475 762 1 0.808268 0.438443 0.62981 1021 1 0.873599 0.377862 0.871218 61 1 0.877154 0.117904 0.998128 42 1 0.304219 0.18717 1.00052 1799 1 0.184603 0.497245 0.809724 2 1 0.0592654 0.0604957 1.00122 612 1 -0.00291966 0.438938 0.567328 639 1 0.939057 0.379554 0.56461 640 1 0.86552 0.435267 0.561297 765 1 0.872841 0.376993 0.627532 766 1 0.93928 0.438334 0.62905 993 1 0.997611 0.378485 0.87607 1793 1 0.995578 0.503242 0.744058 771 1 0.0611653 0.00478981 0.811443 1925 1 0.129507 0.497173 0.877507 1923 1 0.0638308 0.504705 0.933462 648 1 0.125312 0.0645273 0.682663 675 1 0.0622054 0.124661 0.684607 770 1 0.0599226 0.0616294 0.746958 776 1 0.129899 0.0604782 0.814284 803 1 0.0660322 0.122811 0.816235 805 1 0.122404 0.127686 0.75363 772 1 1.00416 0.0687619 0.819225 915 1 0.559955 0.00296863 0.938722 519 1 0.184443 -0.00910927 0.559073 652 1 0.253348 0.0640687 0.684763 679 1 0.187708 0.127434 0.687972 683 1 0.310623 0.12224 0.691784 774 1 0.191477 0.0669668 0.748921 778 1 0.314552 0.0636012 0.749903 780 1 0.251788 0.0606666 0.812188 807 1 0.190384 0.121301 0.814232 809 1 0.249848 0.124207 0.755063 811 1 0.313599 0.131145 0.81265 1053 1 0.880147 0.490422 1.0069 1933 1 0.379073 0.501022 0.874506 1667 1 0.0648859 0.500747 0.68688 656 1 0.382271 0.0627836 0.676605 687 1 0.43787 0.124528 0.683629 782 1 0.440445 0.0614457 0.74378 784 1 0.378527 0.0638554 0.813454 813 1 0.377069 0.129557 0.750245 815 1 0.43392 0.126668 0.811834 817 1 0.496021 0.130501 0.751876 788 1 0.495958 0.067682 0.821056 660 1 0.500691 0.0635231 0.691581 664 1 0.625148 0.0623164 0.690394 691 1 0.560616 0.12605 0.688891 786 1 0.561187 0.0631957 0.759012 792 1 0.625195 0.0619915 0.818201 819 1 0.563644 0.126651 0.814319 821 1 0.623088 0.126598 0.752071 535 1 0.691286 0.00134141 0.560226 990 1 0.946748 0.311087 0.879251 668 1 0.748541 0.0651572 0.691122 695 1 0.688494 0.12412 0.690562 699 1 0.812999 0.126318 0.690873 790 1 0.687037 0.0637855 0.752341 794 1 0.815486 0.0641048 0.754268 796 1 0.750975 0.0652244 0.814181 823 1 0.692757 0.121106 0.816474 825 1 0.753194 0.125212 0.755096 827 1 0.815816 0.128007 0.816598 958 1 0.936756 0.189067 0.87861 964 1 1.00518 0.307707 0.939031 994 1 0.064142 0.436486 0.873443 1691 1 0.808896 0.500912 0.694092 801 1 1.00115 0.122023 0.746438 644 1 0.996425 0.0659065 0.681497 672 1 0.87403 0.0674217 0.690164 703 1 0.93844 0.124577 0.689339 798 1 0.939566 0.0636997 0.746606 800 1 0.874424 0.0654601 0.818716 829 1 0.873557 0.128163 0.753664 831 1 0.933537 0.123992 0.815098 680 1 0.125712 0.183856 0.688334 707 1 0.0606057 0.247923 0.682792 712 1 0.124531 0.307174 0.686383 802 1 0.0583723 0.185823 0.745808 808 1 0.126394 0.188489 0.810823 834 1 0.064089 0.308091 0.748341 835 1 0.0554834 0.244574 0.806071 837 1 0.117743 0.244787 0.746616 840 1 0.120456 0.308784 0.807761 804 1 -0.00649249 0.184962 0.811227 836 1 0.000971131 0.316833 0.812033 833 1 0.999188 0.248977 0.750027 676 1 0.995967 0.181489 0.688514 684 1 0.24745 0.187238 0.685951 711 1 0.185722 0.24804 0.690427 715 1 0.312925 0.249333 0.688948 716 1 0.246378 0.313475 0.683468 806 1 0.186668 0.182163 0.750254 810 1 0.307533 0.192239 0.746639 812 1 0.249342 0.189313 0.807176 838 1 0.183117 0.30728 0.752601 839 1 0.189342 0.244879 0.812941 841 1 0.246804 0.250025 0.746706 842 1 0.32037 0.312974 0.747729 843 1 0.31631 0.254785 0.815557 844 1 0.254387 0.311896 0.810043 688 1 0.376831 0.187691 0.687436 719 1 0.442717 0.253548 0.689523 720 1 0.380616 0.314007 0.682196 814 1 0.436519 0.190436 0.752801 816 1 0.374504 0.188289 0.818978 845 1 0.376884 0.25271 0.745083 846 1 0.437692 0.313277 0.752375 847 1 0.435952 0.252671 0.821449 848 1 0.376395 0.315892 0.814558 724 1 0.498807 0.313279 0.688757 852 1 0.502062 0.314804 0.818081 692 1 0.505519 0.18841 0.687943 849 1 0.501978 0.251614 0.748763 820 1 0.497977 0.192851 0.810848 696 1 0.623583 0.186498 0.683228 723 1 0.564634 0.250542 0.691842 728 1 0.627713 0.310404 0.688208 818 1 0.563563 0.18663 0.75102 824 1 0.627747 0.18218 0.821927 850 1 0.561651 0.315859 0.747374 851 1 0.562338 0.249984 0.809234 853 1 0.629576 0.250992 0.753565 856 1 0.631019 0.313328 0.816407 700 1 0.744943 0.183953 0.695917 727 1 0.687955 0.251329 0.693922 731 1 0.807551 0.245063 0.690058 732 1 0.750494 0.318386 0.684729 822 1 0.684198 0.181005 0.753404 826 1 0.809777 0.194577 0.755911 828 1 0.748606 0.186788 0.810937 854 1 0.688762 0.316043 0.748139 855 1 0.692718 0.250314 0.81436 857 1 0.749115 0.254642 0.754153 858 1 0.811203 0.309358 0.749324 859 1 0.809979 0.247911 0.818871 860 1 0.746212 0.31264 0.812161 708 1 1.00125 0.312259 0.68958 704 1 0.87956 0.192165 0.690935 735 1 0.939809 0.250499 0.686428 736 1 0.874176 0.308407 0.68 830 1 0.936228 0.184718 0.753388 832 1 0.872394 0.189605 0.818815 861 1 0.872665 0.254661 0.746892 862 1 0.938158 0.309703 0.749341 863 1 0.938332 0.24954 0.813898 864 1 0.87309 0.304879 0.814245 1005 1 0.372345 0.376523 0.875702 739 1 0.066964 0.369716 0.686358 744 1 0.125845 0.437711 0.685311 866 1 0.0584013 0.440385 0.747779 867 1 0.0585787 0.377739 0.806291 869 1 0.125693 0.374197 0.743293 872 1 0.125656 0.434444 0.814931 865 1 0.997626 0.376724 0.747026 740 1 0.998862 0.436218 0.687237 743 1 0.186784 0.376839 0.686499 747 1 0.312185 0.36811 0.67958 748 1 0.251346 0.436798 0.68547 870 1 0.18667 0.435758 0.748506 871 1 0.185648 0.376315 0.804861 873 1 0.251924 0.372342 0.741554 874 1 0.316103 0.435145 0.746005 875 1 0.314533 0.376668 0.812755 876 1 0.253255 0.43484 0.807277 1020 1 0.757524 0.439004 0.93935 751 1 0.442692 0.376365 0.682044 752 1 0.377857 0.433119 0.681883 877 1 0.375791 0.375459 0.747118 878 1 0.440166 0.435229 0.748558 879 1 0.441228 0.376954 0.815383 880 1 0.377109 0.433026 0.818929 881 1 0.497237 0.377221 0.744318 884 1 0.502473 0.440294 0.814457 756 1 0.501644 0.437889 0.683695 755 1 0.562233 0.378585 0.686682 760 1 0.622389 0.443601 0.693733 882 1 0.561518 0.434401 0.751978 883 1 0.568747 0.373091 0.817475 885 1 0.623237 0.370562 0.749724 888 1 0.626202 0.441925 0.810593 1019 1 0.814265 0.375477 0.934915 759 1 0.683395 0.380932 0.687335 763 1 0.811626 0.377612 0.694129 764 1 0.741246 0.436623 0.68632 886 1 0.689556 0.438787 0.747395 887 1 0.685338 0.378282 0.812015 889 1 0.750683 0.374587 0.749568 890 1 0.809148 0.440894 0.75171 891 1 0.810737 0.373108 0.81345 892 1 0.751886 0.439707 0.81405 1018 1 0.8089 0.43857 0.87185 932 1 -0.00139067 0.188227 0.934265 960 1 0.873608 0.189582 0.939844 1008 1 0.378646 0.434393 0.942404 1007 1 0.438422 0.376476 0.935622 868 1 -0.00322461 0.429838 0.811978 1017 1 0.749348 0.375384 0.877974 767 1 0.931064 0.36753 0.687908 768 1 0.873003 0.432752 0.691938 893 1 0.872208 0.375758 0.757565 894 1 0.934229 0.438475 0.747136 895 1 0.937075 0.370027 0.810846 896 1 0.870936 0.441832 0.813234 1014 1 0.687353 0.441906 0.875553 1015 1 0.690772 0.378207 0.942622 1012 1 0.500155 0.440277 0.940036 898 1 0.0623248 0.0642602 0.879142 904 1 0.118934 0.0606588 0.942175 931 1 0.0649516 0.122943 0.937379 933 1 0.127568 0.128076 0.874174 929 1 0.0020116 0.127227 0.879112 900 1 0.000759682 0.0580404 0.937114 1006 1 0.442363 0.439766 0.876755 655 1 0.440283 -0.00440078 0.690931 902 1 0.186514 0.0599845 0.879195 906 1 0.312865 0.0577353 0.876842 908 1 0.250388 0.0619363 0.937411 935 1 0.187488 0.120401 0.936534 937 1 0.250578 0.128261 0.873995 939 1 0.306174 0.124009 0.940178 1013 1 0.631858 0.379579 0.877206 1004 1 0.248726 0.438826 0.941135 991 1 0.936328 0.24801 0.938436 998 1 0.192004 0.441633 0.873182 910 1 0.435063 0.0664207 0.877788 912 1 0.371204 0.0613356 0.938753 941 1 0.375281 0.124237 0.877438 943 1 0.435176 0.128495 0.940504 997 1 0.128259 0.373247 0.873797 999 1 0.183635 0.377579 0.93355 1000 1 0.124682 0.437692 0.937206 916 1 0.496021 0.0638796 0.93013 945 1 0.497796 0.131062 0.869381 914 1 0.562106 0.0621735 0.870541 920 1 0.621225 0.0627722 0.935179 947 1 0.555101 0.124235 0.933678 949 1 0.627007 0.123545 0.883042 1003 1 0.314062 0.373484 0.941452 1010 1 0.56777 0.436764 0.878561 918 1 0.685272 0.0617715 0.8761 922 1 0.809491 0.0668833 0.875016 924 1 0.750606 0.0587638 0.936149 951 1 0.686164 0.123329 0.943057 953 1 0.748621 0.128465 0.881093 955 1 0.80936 0.119788 0.943434 954 1 0.813262 0.182569 0.883106 1001 1 0.245843 0.374754 0.873702 992 1 0.875366 0.311137 0.935597 926 1 0.939654 0.0571989 0.874369 928 1 0.875721 0.0579646 0.933855 957 1 0.881501 0.125554 0.88184 959 1 0.940154 0.129154 0.937744 1002 1 0.312477 0.43945 0.879926 1016 1 0.631367 0.437664 0.941382 930 1 0.0631577 0.189292 0.872901 936 1 0.131946 0.18546 0.939778 962 1 0.0609175 0.316977 0.878404 963 1 0.0594037 0.246884 0.938557 965 1 0.121602 0.253437 0.874446 968 1 0.126396 0.315904 0.935129 961 1 0.00618091 0.253252 0.872069 1009 1 0.505048 0.374378 0.881498 659 1 0.564112 0.000313111 0.697867 934 1 0.187702 0.185483 0.877061 938 1 0.310193 0.18682 0.874728 940 1 0.248697 0.192445 0.940741 966 1 0.188006 0.315751 0.871711 967 1 0.185932 0.254188 0.937601 969 1 0.254067 0.250618 0.879714 970 1 0.313372 0.315896 0.880142 971 1 0.308971 0.253453 0.940975 972 1 0.248096 0.318922 0.93818 1665 1 1.00504 0.502219 0.627696 973 1 0.371827 0.246622 0.879983 944 1 0.367218 0.186894 0.940248 942 1 0.434586 0.185436 0.877877 976 1 0.372303 0.309884 0.937771 975 1 0.437151 0.251545 0.936483 974 1 0.436656 0.316681 0.878 980 1 0.499514 0.312311 0.940522 1011 1 0.569355 0.378616 0.94259 977 1 0.499196 0.252373 0.87663 948 1 0.501463 0.188216 0.941911 979 1 0.563463 0.256291 0.939447 978 1 0.568817 0.314161 0.87457 952 1 0.62445 0.190336 0.941478 946 1 0.560133 0.193137 0.877198 984 1 0.632297 0.312627 0.937261 981 1 0.622814 0.248405 0.874814 989 1 0.874215 0.245897 0.878404 995 1 0.0611582 0.379388 0.93988 985 1 0.743129 0.248928 0.880185 950 1 0.690116 0.18858 0.87746 983 1 0.68358 0.244777 0.946425 987 1 0.811481 0.250363 0.93999 956 1 0.750726 0.186112 0.940921 988 1 0.741936 0.312444 0.942305 982 1 0.687216 0.311794 0.87762 986 1 0.814728 0.308126 0.87866 1685 1 0.6295 0.493627 0.619179 1543 1 0.187167 0.501426 0.563635 643 1 0.0602964 0.00475864 0.684338 641 1 0.997968 0.00494186 0.623149 909 1 0.377731 -0.00170585 0.873262 1921 1 1.0057 0.496602 0.868729 1551 1 0.44039 0.495161 0.561508 1693 1 0.873414 0.494796 0.625838 667 1 0.812774 0.00453597 0.688845 1673 1 0.251885 0.497124 0.620386 797 1 0.874212 0.00243609 0.754186 1823 1 0.934529 0.499321 0.807704 1539 1 0.0615874 0.500951 0.55893 539 1 0.816023 0.0048805 0.562021 795 1 0.812928 0.00434707 0.818067 789 1 0.627697 0.00840436 0.753961 651 1 0.319954 0.0025621 0.687941 610 1 0.0589303 0.435337 0.506906 105 1 0.24089 0.374379 1.00066 569 1 0.751551 0.122976 0.503359 622 1 0.443689 0.432758 0.494647 1545 1 0.246696 0.501417 0.500115 45 1 0.371948 0.125041 1.00151 630 1 0.693003 0.438045 0.500933 106 1 0.308707 0.439522 1.00032 1557 1 0.624405 0.499578 0.50257 66 1 0.0629527 0.306414 1.00113 574 1 0.938259 0.188895 0.50279 617 1 0.251624 0.372984 0.498373 1549 1 0.382075 0.496172 0.497808 549 1 0.12002 0.124954 0.504357 109 1 0.377409 0.370399 0.999678 22 1 0.689833 0.0552659 0.996218 538 1 0.809879 0.0612325 0.501937 530 1 0.563769 0.0647628 0.496823 565 1 0.633057 0.120381 0.501727 534 1 0.684511 0.0590615 0.499053 94 1 0.940736 0.316053 0.996672 554 1 0.311841 0.18481 0.493428 605 1 0.869494 0.248031 0.503454 545 1 0.000836314 0.12669 0.50278 561 1 0.500815 0.130687 0.499463 562 1 0.562096 0.192935 0.501964 594 1 0.570494 0.310475 0.499598 70 1 0.187414 0.314215 0.995436 638 1 0.933817 0.441414 0.507004 613 1 0.122757 0.37728 0.507067 553 1 0.252168 0.122383 0.508927 529 1 0.498064 0.00196686 0.499332 598 1 0.688452 0.31158 0.505736 626 1 0.56153 0.432213 0.497876 589 1 0.377595 0.251464 0.500018 581 1 0.126411 0.253789 0.501567 597 1 0.632957 0.249846 0.506381 522 1 0.309035 0.0629851 0.498933 618 1 0.316785 0.43753 0.50408 25 1 0.749943 -0.00168218 0.997284 17 1 0.49784 0.000533077 0.998945 1032 1 0.121715 0.567841 0.0581706 1059 1 0.0616712 0.632312 0.0590649 1154 1 0.0668507 0.564922 0.128135 1189 1 0.12706 0.624978 0.125792 1303 1 0.686887 0.498546 0.314272 1036 1 0.250307 0.561842 0.0534581 1063 1 0.180995 0.626577 0.0572035 1067 1 0.310624 0.623542 0.0587446 1158 1 0.18258 0.560827 0.121246 1162 1 0.308894 0.561083 0.121626 1193 1 0.246429 0.621927 0.122397 1173 1 0.621947 0.505216 0.12766 1629 1 0.875252 0.754415 0.498359 1102 1 0.431371 0.811515 -0.00203503 1040 1 0.376473 0.561546 0.0713141 1071 1 0.436994 0.631784 0.0608481 1166 1 0.435664 0.574914 0.127145 1197 1 0.371056 0.634962 0.125361 1201 1 0.495674 0.624502 0.123397 1044 1 0.492512 0.562788 0.0683873 1047 1 0.68566 0.507362 0.0642785 517 1 0.121843 0.999391 0.500467 1546 1 0.316595 0.558534 0.50038 1048 1 0.618157 0.563253 0.0658057 1075 1 0.560056 0.619988 0.0637044 1170 1 0.553979 0.563105 0.130893 1205 1 0.620652 0.62695 0.125706 133 1 0.129687 0.996889 0.130186 1052 1 0.759816 0.570334 0.0602691 1079 1 0.686675 0.625583 0.0662786 1083 1 0.824588 0.627803 0.0653205 1174 1 0.690572 0.562662 0.132245 1178 1 0.813236 0.561508 0.119607 1209 1 0.751394 0.625113 0.12683 1281 1 1.00264 0.498659 0.24712 415 1 0.940064 1.00001 0.440506 1185 1 0.00563966 0.632158 0.125392 1028 1 0.00406876 0.566774 0.066571 1056 1 0.878185 0.564284 0.0647284 1087 1 0.937085 0.628354 0.0647682 1182 1 0.944624 0.559645 0.122583 1213 1 0.87754 0.629943 0.12905 1045 1 0.626538 0.502703 0.00472309 1042 1 0.557895 0.565848 -4.2701e-05 1085 1 0.879041 0.628087 -0.00349504 1064 1 0.120961 0.693895 0.0592766 1091 1 0.06427 0.753337 0.0686125 1096 1 0.127912 0.811978 0.0604893 1186 1 0.0636492 0.694901 0.124809 1218 1 0.0650339 0.816282 0.124318 1221 1 0.123373 0.753015 0.122607 1092 1 1.00294 0.817077 0.0630367 1217 1 -0.000805195 0.75495 0.126156 1060 1 0.00126228 0.690008 0.0632966 1586 1 0.563567 0.690822 0.496718 261 1 0.122902 1.00619 0.251651 1605 1 0.128644 0.749996 0.499853 1068 1 0.245016 0.686358 0.0632761 1095 1 0.188588 0.753489 0.0615379 1099 1 0.312404 0.750153 0.0625773 1100 1 0.257501 0.815589 0.0634385 1190 1 0.187525 0.684084 0.124199 1194 1 0.307564 0.686689 0.122865 1222 1 0.188318 0.817391 0.126886 1225 1 0.252275 0.748299 0.121161 1226 1 0.314937 0.808751 0.132515 1183 1 0.943527 0.503742 0.188071 159 1 0.934929 0.997384 0.19163 1577 1 0.249622 0.623964 0.497687 1072 1 0.374436 0.688799 0.0597274 1103 1 0.429683 0.748748 0.060813 1104 1 0.373338 0.815769 0.062906 1198 1 0.437623 0.686373 0.126556 1229 1 0.377494 0.745402 0.126998 1230 1 0.433103 0.815047 0.129973 1076 1 0.498948 0.690233 0.0619703 1283 1 0.060422 0.498188 0.311456 1233 1 0.498495 0.744624 0.129327 1108 1 0.488201 0.807763 0.0638636 1080 1 0.622932 0.686512 0.0619411 1107 1 0.559558 0.755266 0.0617867 1112 1 0.624624 0.812892 0.062648 1202 1 0.561138 0.683853 0.126457 1234 1 0.551942 0.809339 0.125371 1237 1 0.620598 0.751361 0.124696 1121 1 0.00222625 0.87474 -0.00380614 1653 1 0.621082 0.876555 0.502236 1084 1 0.751101 0.688458 0.0621534 1111 1 0.690671 0.746166 0.0587766 1115 1 0.808717 0.755329 0.0591742 1116 1 0.745896 0.811557 0.0679755 1206 1 0.689732 0.69046 0.126955 1210 1 0.812617 0.690122 0.122513 1238 1 0.685509 0.813125 0.123392 1241 1 0.746 0.747968 0.125197 1242 1 0.813708 0.814098 0.120523 1293 1 0.366437 0.501874 0.250438 1425 1 0.501839 0.498269 0.373598 1088 1 0.872866 0.690598 0.0618325 1119 1 0.94286 0.749331 0.0666618 1120 1 0.874339 0.812162 0.0577234 1214 1 0.939711 0.688254 0.124692 1245 1 0.875113 0.753353 0.127667 1246 1 0.934144 0.817553 0.124331 1307 1 0.817828 0.501377 0.311828 131 1 0.0615363 0.997756 0.186416 1077 1 0.628349 0.629333 0.0031508 1566 1 0.936575 0.564584 0.503887 1123 1 0.0644805 0.875521 0.0628198 1128 1 0.126806 0.937585 0.0666707 1250 1 0.0679056 0.935841 0.127669 1253 1 0.131115 0.875295 0.122201 1249 1 1.00515 0.879547 0.122952 1533 1 0.881335 0.873469 0.374849 1534 1 0.940824 0.939057 0.376195 1175 1 0.687935 0.504504 0.191872 1535 1 0.943041 0.875542 0.43515 1437 1 0.876973 0.500721 0.380491 413 1 0.879143 1.00133 0.379559 1127 1 0.186066 0.875013 0.0612147 1131 1 0.312193 0.878664 0.0588556 1132 1 0.248783 0.935129 0.0608904 1254 1 0.190455 0.934945 0.129257 1257 1 0.254604 0.872662 0.126508 1258 1 0.312866 0.938911 0.125445 1051 1 0.816155 0.49904 0.0629992 1536 1 0.87725 0.936287 0.440134 1135 1 0.438942 0.8733 0.0627346 1136 1 0.374587 0.937643 0.0655574 1261 1 0.370496 0.875887 0.127913 1262 1 0.439128 0.93388 0.125012 1140 1 0.507943 0.934898 0.0635214 1508 1 1.00509 0.935257 0.439047 1265 1 0.498689 0.875527 0.127143 1139 1 0.561208 0.868516 0.0677095 1144 1 0.618581 0.936126 0.0606493 1266 1 0.565271 0.937027 0.132392 1269 1 0.621961 0.872361 0.127206 3 1 0.0639591 0.991686 0.0643275 1309 1 0.882284 0.498878 0.251772 1574 1 0.192255 0.689824 0.499608 1291 1 0.313018 0.500621 0.318242 1143 1 0.681852 0.874426 0.0654438 1147 1 0.804714 0.877641 0.0584946 1148 1 0.746199 0.94011 0.0589346 1270 1 0.682049 0.935619 0.121647 1273 1 0.74752 0.878423 0.122561 1274 1 0.808199 0.942216 0.121547 279 1 0.68551 1.00126 0.312557 129 1 0.996903 0.993736 0.124855 1124 1 0.999152 0.937574 0.0561965 1151 1 0.936 0.872348 0.0578794 1152 1 0.870815 0.940113 0.0551809 1277 1 0.869429 0.872687 0.12394 1278 1 0.929386 0.939536 0.124844 1609 1 0.255309 0.747883 0.502076 1637 1 0.130453 0.873371 0.50203 1638 1 0.179995 0.93641 0.49511 1570 1 0.0573561 0.684387 0.498821 1526 1 0.687828 0.937728 0.371948 1160 1 0.126535 0.558021 0.185438 1187 1 0.0625849 0.627249 0.185935 1282 1 0.0668974 0.562065 0.248558 1288 1 0.12167 0.560324 0.312224 1315 1 0.0706615 0.624181 0.313929 1317 1 0.130958 0.62377 0.24505 1284 1 0.00583151 0.56208 0.311712 1313 1 0.007804 0.626392 0.246614 1156 1 0.00325178 0.560362 0.190504 1164 1 0.248346 0.562304 0.18593 1191 1 0.185545 0.615842 0.186141 1195 1 0.309533 0.629962 0.188631 1286 1 0.190109 0.559101 0.2482 1290 1 0.307518 0.566744 0.247822 1292 1 0.24783 0.559053 0.31428 1319 1 0.188528 0.626011 0.306953 1321 1 0.251783 0.628622 0.250871 1323 1 0.308972 0.626553 0.314718 1301 1 0.620955 0.500173 0.24822 1168 1 0.372323 0.568245 0.185107 1199 1 0.441574 0.629817 0.192618 1294 1 0.434733 0.563222 0.251903 1296 1 0.36959 0.566993 0.310323 1325 1 0.372018 0.626694 0.254867 1327 1 0.439468 0.624887 0.313214 1172 1 0.496074 0.560856 0.189455 1300 1 0.502 0.563502 0.312809 1329 1 0.504016 0.626479 0.254757 1176 1 0.619255 0.567381 0.185008 1203 1 0.559547 0.625154 0.190205 1298 1 0.56322 0.561931 0.247879 1304 1 0.627577 0.560903 0.313331 1331 1 0.561998 0.62292 0.317784 1333 1 0.621152 0.625519 0.254165 1527 1 0.688257 0.879298 0.439768 1529 1 0.756309 0.875139 0.382016 1180 1 0.752097 0.566632 0.189051 1207 1 0.685926 0.625369 0.191161 1211 1 0.81425 0.631948 0.191688 1302 1 0.682449 0.56371 0.250367 1306 1 0.816242 0.556228 0.250204 1308 1 0.750756 0.558764 0.315113 1335 1 0.688926 0.622243 0.320634 1337 1 0.744045 0.624396 0.255784 1339 1 0.811534 0.623805 0.312182 1562 1 0.816823 0.567625 0.502108 1530 1 0.813764 0.934873 0.378408 1589 1 0.623979 0.627296 0.499207 1184 1 0.8822 0.567041 0.183521 1215 1 0.944192 0.627492 0.188116 1310 1 0.942895 0.561307 0.2488 1312 1 0.871949 0.564178 0.317006 1341 1 0.879107 0.625579 0.25412 1343 1 0.947007 0.621961 0.307385 1192 1 0.131115 0.683966 0.183892 1219 1 0.0674389 0.754704 0.186592 1224 1 0.126161 0.813969 0.186523 1314 1 0.0680224 0.692986 0.243581 1320 1 0.126281 0.68697 0.30416 1346 1 0.0571668 0.810959 0.24972 1347 1 0.0632005 0.746613 0.308281 1349 1 0.129488 0.747931 0.249182 1352 1 0.127164 0.809826 0.314396 1188 1 0.00507888 0.690892 0.186988 1345 1 0.00119322 0.751227 0.244817 1196 1 0.247488 0.688214 0.19084 1223 1 0.18768 0.750946 0.182794 1227 1 0.309612 0.744724 0.186045 1228 1 0.251547 0.815544 0.184866 1318 1 0.186781 0.6868 0.246305 1322 1 0.309913 0.693617 0.253738 1324 1 0.248787 0.688404 0.313608 1350 1 0.185313 0.818744 0.245398 1351 1 0.194534 0.75138 0.306693 1353 1 0.247522 0.752039 0.24131 1354 1 0.311966 0.808804 0.250631 1355 1 0.318769 0.749812 0.319295 1356 1 0.255141 0.811673 0.309447 1200 1 0.373618 0.689974 0.191056 1231 1 0.438985 0.748685 0.189063 1232 1 0.374066 0.809357 0.188052 1326 1 0.442114 0.68661 0.252265 1328 1 0.368889 0.68516 0.313499 1357 1 0.37505 0.750256 0.2486 1358 1 0.435675 0.809763 0.249417 1359 1 0.436239 0.754246 0.309111 1360 1 0.373417 0.811788 0.316779 1332 1 0.500049 0.685031 0.309796 1364 1 0.493384 0.811419 0.314839 1236 1 0.493758 0.812526 0.18729 1361 1 0.50298 0.750074 0.254949 1204 1 0.500542 0.686042 0.193227 1208 1 0.626463 0.687101 0.1895 1235 1 0.561809 0.743136 0.190024 1240 1 0.624091 0.813931 0.190819 1330 1 0.558909 0.682731 0.254824 1336 1 0.621751 0.687577 0.317314 1362 1 0.561151 0.809282 0.24729 1363 1 0.560923 0.751605 0.313449 1365 1 0.620337 0.746647 0.25373 1368 1 0.619167 0.811617 0.312153 1212 1 0.749953 0.689576 0.190487 1239 1 0.684874 0.750061 0.19079 1243 1 0.810815 0.750069 0.180552 1244 1 0.740926 0.812283 0.185744 1334 1 0.681465 0.684111 0.258028 1338 1 0.813945 0.686986 0.255509 1340 1 0.750426 0.682372 0.313888 1366 1 0.68451 0.809603 0.250364 1367 1 0.68515 0.75078 0.317402 1369 1 0.749066 0.748293 0.249999 1370 1 0.809101 0.811979 0.24609 1371 1 0.808129 0.753293 0.311989 1372 1 0.745064 0.815517 0.312779 1220 1 0.997129 0.81781 0.184856 1348 1 -0.00222909 0.812497 0.310994 1316 1 1.00169 0.688033 0.313816 1216 1 0.884783 0.686724 0.188919 1247 1 0.938346 0.754136 0.184036 1248 1 0.870493 0.810986 0.185505 1342 1 0.940497 0.697332 0.24778 1344 1 0.87516 0.690957 0.313535 1373 1 0.876843 0.752874 0.246913 1374 1 0.937188 0.815144 0.245444 1375 1 0.934454 0.75563 0.311306 1376 1 0.876809 0.816196 0.314339 1531 1 0.815934 0.880372 0.438833 1251 1 0.063532 0.8739 0.186984 1256 1 0.121762 0.937233 0.196024 1378 1 0.0574043 0.936701 0.250249 1379 1 0.0597172 0.873829 0.316658 1381 1 0.116849 0.875623 0.252252 1384 1 0.125787 0.938801 0.310536 1380 1 1.00136 0.943533 0.315823 1252 1 -0.00719188 0.933372 0.188372 1377 1 0.000626505 0.874252 0.252552 1532 1 0.749315 0.937218 0.439146 521 1 0.251074 0.998802 0.499269 1171 1 0.559622 0.503346 0.185738 283 1 0.814911 0.999185 0.309557 1255 1 0.18963 0.877231 0.189236 1259 1 0.313979 0.873929 0.189178 1260 1 0.247089 0.940716 0.18969 1382 1 0.188948 0.939913 0.25003 1383 1 0.188957 0.88221 0.308799 1385 1 0.25237 0.873644 0.250073 1386 1 0.311225 0.936164 0.248267 1387 1 0.316593 0.877136 0.308029 1388 1 0.247721 0.938262 0.307538 1601 1 1.00287 0.745976 0.499002 1523 1 0.562289 0.877394 0.434541 1528 1 0.62368 0.936603 0.436911 1263 1 0.437507 0.871587 0.19179 1264 1 0.373388 0.935549 0.188737 1389 1 0.371978 0.870534 0.249594 1390 1 0.43236 0.932902 0.249249 1391 1 0.431744 0.87349 0.314904 1392 1 0.367343 0.943442 0.310988 1268 1 0.49613 0.942611 0.192611 1396 1 0.498309 0.940553 0.312688 1393 1 0.495566 0.873869 0.254638 1267 1 0.55879 0.875119 0.189005 1272 1 0.626573 0.938225 0.193183 1394 1 0.561531 0.936594 0.256259 1395 1 0.560652 0.877109 0.312856 1397 1 0.613699 0.872482 0.25069 1400 1 0.621341 0.936871 0.314367 1525 1 0.627109 0.876284 0.375568 1271 1 0.683787 0.874683 0.19115 1275 1 0.805979 0.87157 0.183801 1276 1 0.748843 0.937192 0.184868 1398 1 0.683795 0.93504 0.25202 1399 1 0.682418 0.868532 0.310272 1401 1 0.747778 0.8721 0.248649 1402 1 0.806683 0.933345 0.243771 1403 1 0.809781 0.870982 0.31444 1404 1 0.750575 0.942409 0.311777 1522 1 0.568476 0.938155 0.37469 1279 1 0.936667 0.879047 0.183324 1280 1 0.869915 0.934088 0.183769 1405 1 0.869442 0.876882 0.247866 1406 1 0.935316 0.934466 0.25651 1407 1 0.937645 0.878023 0.314223 1408 1 0.869478 0.930122 0.312236 1618 1 0.558346 0.818018 0.495463 409 1 0.751877 0.997656 0.376386 1305 1 0.751083 0.503607 0.25313 31 1 0.938918 0.993971 0.0595803 1521 1 0.499042 0.872796 0.378732 1410 1 0.0611685 0.558666 0.37236 1416 1 0.124895 0.55738 0.4352 1443 1 0.0585368 0.619816 0.436514 1445 1 0.128295 0.623593 0.376054 1412 1 -0.00511925 0.559094 0.434686 1518 1 0.429338 0.934582 0.374578 1520 1 0.368746 0.93849 0.434462 1420 1 0.249614 0.559223 0.440058 1451 1 0.310651 0.622121 0.437585 1449 1 0.254881 0.627728 0.377366 1447 1 0.190128 0.623913 0.431953 1414 1 0.182718 0.559378 0.375554 1418 1 0.309217 0.562676 0.377359 1287 1 0.185557 0.496251 0.315317 1513 1 0.24923 0.871408 0.377254 1519 1 0.438981 0.875852 0.437862 1453 1 0.371147 0.623254 0.373739 1424 1 0.376015 0.560756 0.435194 1455 1 0.440931 0.627496 0.434591 1422 1 0.434185 0.564586 0.375465 1457 1 0.499021 0.621627 0.375451 399 1 0.435781 0.998262 0.435986 285 1 0.873823 0.991237 0.249447 1515 1 0.309767 0.871154 0.438312 1428 1 0.499274 0.559046 0.436223 1461 1 0.627532 0.62128 0.377358 1426 1 0.561017 0.563377 0.380348 1432 1 0.624385 0.558574 0.439741 1459 1 0.564936 0.629283 0.433041 1516 1 0.243371 0.941488 0.436029 1439 1 0.936035 0.501341 0.442321 1465 1 0.749842 0.6271 0.376215 1467 1 0.818775 0.625488 0.43319 1430 1 0.688356 0.560756 0.377042 1434 1 0.812255 0.56429 0.371967 1436 1 0.752582 0.560079 0.43764 1463 1 0.6852 0.625221 0.434697 1441 1 0.00271455 0.622554 0.37461 1471 1 0.938708 0.63051 0.43707 1438 1 0.938892 0.566292 0.376081 1440 1 0.875538 0.565926 0.440249 1469 1 0.878442 0.629384 0.377523 1517 1 0.369907 0.873471 0.376734 1476 1 -0.00205133 0.813843 0.438686 1444 1 1.00295 0.69014 0.432799 1442 1 0.0594544 0.686268 0.376092 1480 1 0.125826 0.807929 0.433515 1448 1 0.122875 0.687167 0.439435 1474 1 0.0628083 0.803157 0.368584 1475 1 0.0626622 0.747058 0.435888 1477 1 0.127658 0.74637 0.374414 27 1 0.812492 0.996393 0.0573933 1514 1 0.304735 0.936493 0.374044 1483 1 0.313317 0.753826 0.439837 1484 1 0.251557 0.810212 0.433527 1478 1 0.188966 0.809655 0.373595 1481 1 0.253348 0.754507 0.37018 1482 1 0.314378 0.813887 0.374181 1479 1 0.186687 0.747945 0.43732 1450 1 0.312347 0.687888 0.375176 1452 1 0.246967 0.692478 0.433 1446 1 0.184662 0.685646 0.372736 387 1 0.059819 0.996559 0.444224 1510 1 0.189233 0.939003 0.371997 1485 1 0.373222 0.751334 0.381681 1487 1 0.439064 0.747618 0.438346 1488 1 0.374672 0.818554 0.43901 1454 1 0.433267 0.689598 0.374128 1486 1 0.432846 0.811075 0.375356 1456 1 0.370856 0.682 0.436742 1492 1 0.495949 0.809054 0.435028 157 1 0.86951 1.00007 0.122763 1511 1 0.186527 0.872679 0.433213 1554 1 0.562263 0.562083 0.498531 1460 1 0.50128 0.687409 0.433488 1490 1 0.564563 0.816574 0.377383 1464 1 0.627441 0.693265 0.433895 1496 1 0.626276 0.816663 0.44033 1493 1 0.621618 0.756969 0.376451 1491 1 0.560487 0.750884 0.436007 1489 1 0.495182 0.747261 0.374968 1458 1 0.56136 0.687997 0.373122 15 1 0.43886 0.99837 0.0661381 145 1 0.502061 0.998971 0.126287 1524 1 0.498596 0.942905 0.435549 1311 1 0.939826 0.505939 0.311161 1177 1 0.755036 0.503349 0.122794 1500 1 0.752654 0.816531 0.439862 1462 1 0.683735 0.689609 0.372878 1466 1 0.814883 0.695254 0.371277 1495 1 0.689798 0.751189 0.440071 1494 1 0.689714 0.817538 0.375928 1497 1 0.752119 0.75071 0.371818 1499 1 0.81757 0.753319 0.442051 1498 1 0.816359 0.816792 0.376829 1468 1 0.758943 0.689901 0.435008 141 1 0.37926 0.996956 0.125584 1501 1 0.875586 0.757677 0.374581 1502 1 0.937234 0.813755 0.377404 1472 1 0.879784 0.689667 0.435922 1503 1 0.940379 0.752745 0.437804 1504 1 0.874789 0.813964 0.44151 1473 1 0.998996 0.748867 0.377621 1470 1 0.935574 0.694226 0.375132 1027 1 0.0630402 0.505923 0.0647134 1505 1 0.00163839 0.865616 0.37522 1512 1 0.122327 0.93801 0.434384 1507 1 0.0651597 0.874576 0.433315 1506 1 0.0623006 0.935816 0.371439 1509 1 0.12684 0.872495 0.370074 23 1 0.681281 1.00332 0.0594739 1581 1 0.376718 0.620121 0.496259 1138 1 0.55985 0.939291 -0.00527113 1179 1 0.817582 0.505416 0.181763 1409 1 0.998398 0.498384 0.375285 143 1 0.434076 0.996829 0.186154 1169 1 0.491819 0.499414 0.128149 1617 1 0.507275 0.751725 0.5037 1181 1 0.877898 0.505283 0.122545 1035 1 0.303984 0.50144 0.0598503 139 1 0.311676 1.00027 0.191663 1435 1 0.814263 0.499071 0.435391 1558 1 0.688104 0.564027 0.494503 281 1 0.746327 0.998349 0.245585 7 1 0.187342 0.997578 0.0612022 401 1 0.500298 0.998467 0.375144 1041 1 0.497624 0.500507 0.0027068 149 1 0.622862 1.00579 0.125069 11 1 0.312364 0.994636 0.0589504 407 1 0.689776 0.998976 0.43672 1157 1 0.124453 0.499193 0.123292 1625 1 0.754245 0.751947 0.499718 1133 1 0.379333 0.87645 0.00433359 1630 1 0.939589 0.818684 0.497831 1602 1 0.0624248 0.80829 0.496981 1118 1 0.945462 0.813824 0.0028551 1606 1 0.191759 0.809705 0.495776 1578 1 0.314001 0.68385 0.496994 1654 1 0.68549 0.936014 0.501924 1590 1 0.690937 0.689704 0.496772 1597 1 0.874596 0.625219 0.502794 1649 1 0.501961 0.87894 0.497578 1086 1 0.943626 0.692214 -0.00210998 1050 1 0.821328 0.561013 0.00402726 1593 1 0.750899 0.625729 0.49321 1641 1 0.250538 0.871392 0.494655 1101 1 0.374015 0.751625 -0.00503186 1569 1 0.000439008 0.616241 0.495876 1117 1 0.874925 0.752791 0.00135664 1585 1 0.498932 0.624482 0.494888 1582 1 0.439247 0.691173 0.495928 1122 1 0.0613826 0.934935 -0.00411627 1594 1 0.813257 0.685659 0.499193 537 1 0.750446 1.003 0.502718 1062 1 0.185078 0.690943 -0.000245368 1090 1 0.0648525 0.816219 0.00915597 1134 1 0.439022 0.938354 0.00250492 1565 1 0.874667 0.507588 0.500929 1073 1 0.49627 0.630764 0.00113541 1034 1 0.316371 0.562343 0.00231866 1074 1 0.561711 0.69066 -0.00303642 1029 1 0.124776 0.501807 -0.0011992 1125 1 0.124445 0.875274 0.000452497 1097 1 0.249183 0.74711 0.00546758 1646 1 0.440972 0.934649 0.498205 1094 1 0.188996 0.811667 -0.00309176 1046 1 0.688175 0.5659 0.00168993 533 1 0.629569 0.999487 0.500569 1642 1 0.308214 0.936802 0.497924 1561 1 0.753588 0.508058 0.50157 1037 1 0.375002 0.497151 0.00203905 1544 1 0.133447 0.564449 0.562189 1571 1 0.0646566 0.620318 0.557352 1666 1 0.060153 0.562098 0.619907 1701 1 0.124849 0.618741 0.624188 1540 1 0.999379 0.564449 0.564047 1089 1 0.0092556 0.751752 0.999647 543 1 0.937682 1.00057 0.565929 1626 1 0.810945 0.819892 0.501923 1548 1 0.254086 0.561466 0.564433 1575 1 0.192699 0.622116 0.563968 1579 1 0.319346 0.620002 0.560847 1670 1 0.194754 0.56137 0.621976 1674 1 0.316945 0.558397 0.621505 1705 1 0.249582 0.62051 0.625002 665 1 0.750057 1.00272 0.627789 787 1 0.556509 0.999525 0.812686 1945 1 0.748936 0.508214 0.872051 1552 1 0.379749 0.561068 0.561698 1583 1 0.444072 0.628255 0.56081 1678 1 0.440255 0.557738 0.624733 1709 1 0.378092 0.623257 0.621349 1713 1 0.504357 0.627914 0.622961 1556 1 0.50313 0.565516 0.556891 5 1 0.121442 0.997591 1.0034 649 1 0.258422 1.00202 0.627106 1542 1 0.189079 0.563436 0.499143 1560 1 0.628424 0.563608 0.561023 1587 1 0.562177 0.627014 0.556307 1682 1 0.560294 0.562965 0.622431 1717 1 0.624671 0.623783 0.615322 2020 1 0.000863728 0.934337 0.938129 2045 1 0.875019 0.874272 0.876578 1126 1 0.185089 0.936479 0.998429 1110 1 0.689663 0.813515 1.00335 785 1 0.500901 0.997086 0.748589 1137 1 0.503442 0.872045 1.00092 2046 1 0.942066 0.930309 0.877995 1564 1 0.75395 0.570179 0.565234 1591 1 0.694451 0.628956 0.5575 1595 1 0.813989 0.628531 0.561198 1686 1 0.689409 0.561277 0.619258 1690 1 0.814444 0.563848 0.625658 1721 1 0.750695 0.625326 0.625561 1538 1 0.0584311 0.557696 0.497014 1559 1 0.69123 0.506397 0.552585 2047 1 0.932282 0.873175 0.935241 531 1 0.562015 0.996847 0.560289 1697 1 0.996887 0.627351 0.624838 1568 1 0.880656 0.559646 0.56448 1599 1 0.936122 0.63359 0.561708 1694 1 0.937673 0.564325 0.630537 1725 1 0.875527 0.631788 0.626377 1671 1 0.184229 0.500444 0.69033 1681 1 0.504575 0.501505 0.623992 917 1 0.623832 0.997916 0.878155 2048 1 0.874445 0.938379 0.932399 1576 1 0.125209 0.681267 0.560457 1603 1 0.0683837 0.751514 0.56336 1608 1 0.128158 0.815593 0.561894 1698 1 0.0656035 0.681206 0.621456 1730 1 0.064919 0.811165 0.625158 1733 1 0.127084 0.741582 0.621914 1572 1 0.000794183 0.685282 0.558283 1604 1 0.00350272 0.810224 0.561377 1811 1 0.562375 0.503329 0.812415 671 1 0.937286 0.99984 0.686299 1662 1 0.9407 0.934756 0.501228 1580 1 0.249634 0.688392 0.563032 1607 1 0.191583 0.751072 0.559473 1611 1 0.313616 0.748409 0.562293 1612 1 0.253374 0.809825 0.560585 1702 1 0.190176 0.688268 0.622708 1706 1 0.306041 0.688041 0.622683 1734 1 0.192714 0.812085 0.621464 1737 1 0.252952 0.749426 0.623536 1738 1 0.319707 0.805484 0.625552 1149 1 0.870459 0.878182 0.994714 1687 1 0.688264 0.500562 0.683708 1584 1 0.374766 0.688335 0.551848 1615 1 0.439381 0.749817 0.560173 1616 1 0.374465 0.810478 0.559825 1710 1 0.434519 0.684502 0.618618 1741 1 0.376268 0.746955 0.620297 1742 1 0.436238 0.807579 0.624285 1620 1 0.497616 0.812345 0.558024 799 1 0.943184 0.998446 0.813568 1588 1 0.499529 0.691119 0.558674 1745 1 0.500429 0.750488 0.623042 1592 1 0.626863 0.6922 0.56052 1619 1 0.563963 0.757713 0.560905 1624 1 0.630053 0.810659 0.562348 1714 1 0.562286 0.687974 0.622654 1746 1 0.565916 0.813237 0.627399 1749 1 0.624667 0.754438 0.621528 1596 1 0.751488 0.688853 0.55813 1623 1 0.694306 0.748452 0.560733 1627 1 0.80824 0.754493 0.561851 1628 1 0.753852 0.816664 0.564267 1718 1 0.684269 0.68848 0.623161 1722 1 0.806804 0.687811 0.624449 1750 1 0.691281 0.816123 0.623048 1753 1 0.743573 0.752031 0.626269 1754 1 0.812479 0.810152 0.624459 897 1 0.00395908 0.99722 0.876938 1058 1 0.0632007 0.688635 0.992157 1729 1 0.998461 0.742309 0.6236 1600 1 0.872136 0.690492 0.565375 1631 1 0.937396 0.749965 0.565498 1632 1 0.874713 0.816162 0.55887 1726 1 0.93298 0.68805 0.623701 1757 1 0.874326 0.752917 0.619809 1758 1 0.936213 0.81463 0.625085 907 1 0.314407 0.997684 0.936342 541 1 0.876224 0.996557 0.497835 1635 1 0.0633006 0.872804 0.564593 1640 1 0.124442 0.931566 0.564762 1762 1 0.0644993 0.940607 0.628306 1765 1 0.12297 0.87447 0.628351 1761 1 -0.00249914 0.871997 0.622248 783 1 0.437328 1.00319 0.80877 1807 1 0.438902 0.497491 0.812607 653 1 0.375685 0.997082 0.622285 1639 1 0.196307 0.873668 0.55734 1643 1 0.310891 0.872998 0.558296 1644 1 0.24813 0.937161 0.561104 1766 1 0.19348 0.933046 0.624211 1769 1 0.254392 0.871717 0.623237 1770 1 0.320446 0.931077 0.6243 2038 1 0.683238 0.938508 0.879905 911 1 0.433256 0.997959 0.931586 1813 1 0.626061 0.502571 0.751615 1541 1 0.130418 0.499241 0.502822 1647 1 0.440957 0.87592 0.557155 1648 1 0.375681 0.933441 0.555439 1773 1 0.379953 0.874255 0.623655 1774 1 0.438453 0.939619 0.625629 1652 1 0.49587 0.939341 0.560899 1777 1 0.498857 0.879322 0.627146 1931 1 0.312058 0.498006 0.935586 13 1 0.377136 0.996827 1.00082 1145 1 0.740595 0.878605 0.993973 1651 1 0.564603 0.874311 0.561279 1656 1 0.626993 0.940393 0.563673 1778 1 0.563274 0.93634 0.625095 1781 1 0.624357 0.876953 0.62632 1661 1 0.877753 0.881023 0.502267 1129 1 0.257532 0.873075 1.00029 901 1 0.123328 0.994839 0.876723 1655 1 0.684507 0.878361 0.566495 1659 1 0.809579 0.876813 0.563256 1660 1 0.750382 0.939681 0.564861 1782 1 0.686473 0.940953 0.625593 1785 1 0.7491 0.885203 0.629631 1786 1 0.817073 0.940061 0.623636 2039 1 0.686448 0.874831 0.933646 2041 1 0.746415 0.877557 0.870894 1636 1 0.00307385 0.938742 0.566645 1663 1 0.939682 0.872022 0.562957 1664 1 0.875413 0.93884 0.56465 1789 1 0.873105 0.876735 0.619914 1790 1 0.935873 0.939546 0.631653 2042 1 0.81398 0.94038 0.868366 1645 1 0.375277 0.877042 0.492675 1672 1 0.125742 0.567474 0.68905 1699 1 0.0650245 0.627186 0.685968 1794 1 0.0634767 0.558739 0.750008 1800 1 0.124067 0.558202 0.808437 1827 1 0.0638958 0.626834 0.816552 1829 1 0.126159 0.625509 0.751375 1796 1 0.00277203 0.557061 0.809037 1668 1 -0.000968911 0.563338 0.690794 1825 1 -0.0035692 0.623789 0.752513 2043 1 0.806807 0.875857 0.932465 1927 1 0.185365 0.496475 0.937041 1573 1 0.124059 0.62239 0.498264 1819 1 0.812783 0.500997 0.814928 1676 1 0.249844 0.559795 0.688387 1703 1 0.188081 0.626839 0.68375 1707 1 0.31741 0.618112 0.681576 1798 1 0.18593 0.558756 0.749725 1802 1 0.310471 0.558985 0.745502 1804 1 0.248855 0.563032 0.809221 1831 1 0.189847 0.623106 0.813037 1833 1 0.250761 0.623821 0.744863 1835 1 0.310986 0.623085 0.809597 1675 1 0.3068 0.500973 0.683339 1547 1 0.311837 0.502402 0.560293 2044 1 0.751878 0.939796 0.930179 1680 1 0.374414 0.556392 0.691071 1711 1 0.436455 0.626449 0.689386 1806 1 0.442528 0.557653 0.747232 1808 1 0.379384 0.55499 0.811114 1837 1 0.378694 0.625046 0.752976 1839 1 0.437135 0.622136 0.8165 1684 1 0.503678 0.567306 0.68819 1812 1 0.499077 0.562895 0.806877 645 1 0.126228 1.00006 0.624336 775 1 0.186714 1.00239 0.814147 925 1 0.883097 0.993309 0.87376 1841 1 0.498988 0.624418 0.74633 1688 1 0.627658 0.564116 0.683416 1715 1 0.568535 0.624808 0.68278 1810 1 0.562426 0.568602 0.751361 1816 1 0.626851 0.56362 0.815728 1843 1 0.560028 0.628879 0.813586 1845 1 0.62536 0.620504 0.749742 1669 1 0.120956 0.502144 0.623355 1692 1 0.750799 0.562636 0.685563 1719 1 0.685386 0.630651 0.686153 1723 1 0.810926 0.625225 0.687565 1814 1 0.68583 0.566877 0.750844 1818 1 0.809576 0.563716 0.753437 1820 1 0.745722 0.566661 0.81427 1847 1 0.684203 0.627273 0.812373 1849 1 0.746243 0.625179 0.749441 1851 1 0.812615 0.626917 0.811308 1817 1 0.745705 0.50449 0.751043 1696 1 0.873175 0.561119 0.691849 1727 1 0.934909 0.627762 0.686009 1822 1 0.931526 0.560455 0.749728 1824 1 0.873473 0.56339 0.809509 1853 1 0.875115 0.625077 0.751275 1855 1 0.935628 0.621296 0.812487 1704 1 0.128353 0.687419 0.687036 1731 1 0.0624458 0.749185 0.680977 1736 1 0.126492 0.809005 0.68228 1826 1 0.0626662 0.687756 0.748832 1832 1 0.126421 0.68845 0.810168 1858 1 0.0579624 0.806499 0.750453 1859 1 0.0606473 0.748772 0.809209 1861 1 0.13064 0.749438 0.748301 1864 1 0.124227 0.806204 0.809976 1700 1 0.995563 0.685984 0.6892 1860 1 0.995019 0.81191 0.809201 1732 1 1.00309 0.810711 0.686971 1708 1 0.250159 0.685853 0.680615 1735 1 0.190362 0.75191 0.684892 1739 1 0.315214 0.747058 0.68696 1740 1 0.25414 0.807774 0.683647 1830 1 0.190069 0.684259 0.74909 1834 1 0.311503 0.684859 0.742192 1836 1 0.249772 0.685546 0.811707 1862 1 0.191032 0.806741 0.74821 1863 1 0.192016 0.748192 0.810913 1865 1 0.252272 0.748536 0.747568 1866 1 0.314758 0.811125 0.74459 1867 1 0.315964 0.750692 0.812291 1868 1 0.250269 0.812055 0.811199 1712 1 0.375727 0.687755 0.68842 1743 1 0.439335 0.745449 0.685267 1744 1 0.379293 0.810855 0.689029 1838 1 0.436331 0.685491 0.750921 1840 1 0.375588 0.683401 0.813939 1869 1 0.37619 0.749875 0.753553 1870 1 0.437795 0.814525 0.751945 1871 1 0.439881 0.750127 0.812518 1872 1 0.372108 0.816812 0.809356 1844 1 0.496822 0.687781 0.810134 1876 1 0.501962 0.815038 0.815758 1748 1 0.497237 0.810692 0.687718 1716 1 0.503429 0.687379 0.685986 1873 1 0.495596 0.754803 0.751711 1720 1 0.623234 0.691168 0.683254 1747 1 0.561822 0.746678 0.688943 1752 1 0.62373 0.809945 0.690518 1842 1 0.564834 0.682752 0.748047 1848 1 0.624805 0.686352 0.809741 1874 1 0.561698 0.815739 0.750216 1875 1 0.558197 0.751414 0.811255 1877 1 0.620116 0.75156 0.752428 1880 1 0.624575 0.813017 0.809978 1724 1 0.749695 0.68847 0.685493 1751 1 0.692576 0.75171 0.691689 1755 1 0.812207 0.749685 0.689627 1756 1 0.749694 0.811715 0.685778 1846 1 0.682914 0.685384 0.746585 1850 1 0.808761 0.689406 0.748818 1852 1 0.750147 0.684627 0.809722 1878 1 0.687442 0.814716 0.75264 1879 1 0.688421 0.745465 0.805799 1881 1 0.750549 0.745269 0.755008 1882 1 0.814445 0.812236 0.749477 1883 1 0.814526 0.747811 0.811441 1884 1 0.750966 0.810878 0.813855 1857 1 1.00055 0.74676 0.748371 1828 1 0.999797 0.685621 0.814724 1728 1 0.874359 0.692927 0.685177 1759 1 0.935113 0.751386 0.685838 1760 1 0.878554 0.815465 0.689273 1854 1 0.937625 0.690272 0.756341 1856 1 0.874865 0.680569 0.812533 1885 1 0.876878 0.745312 0.744364 1886 1 0.936606 0.81289 0.744156 1887 1 0.935144 0.752766 0.809087 1888 1 0.874985 0.813923 0.810937 1054 1 0.933773 0.562501 1.00197 1935 1 0.436164 0.493586 0.943566 1763 1 0.0570808 0.872898 0.690979 1768 1 0.120113 0.940396 0.692057 1890 1 0.0599289 0.935941 0.752742 1891 1 0.0603491 0.874171 0.811264 1893 1 0.11836 0.869928 0.753907 1896 1 0.119479 0.936572 0.815576 1764 1 0.000587651 0.938981 0.686254 1892 1 0.997989 0.936065 0.809648 669 1 0.87525 1.00082 0.622063 1767 1 0.185409 0.876519 0.682263 1771 1 0.315855 0.868842 0.682275 1772 1 0.25333 0.93391 0.68384 1894 1 0.186512 0.940192 0.754582 1895 1 0.184396 0.874766 0.816194 1897 1 0.249595 0.875838 0.744818 1898 1 0.31729 0.936801 0.74917 1899 1 0.316197 0.874947 0.806292 1900 1 0.251744 0.939438 0.81398 2032 1 0.372291 0.935891 0.938567 793 1 0.752671 1.00292 0.75358 2031 1 0.440417 0.873806 0.938492 2036 1 0.498717 0.935052 0.936645 1775 1 0.436292 0.87185 0.682143 1776 1 0.372363 0.939642 0.682178 1901 1 0.377733 0.878103 0.742968 1902 1 0.434621 0.94068 0.748254 1903 1 0.440949 0.877744 0.808887 1904 1 0.374612 0.940379 0.810598 1780 1 0.498357 0.938675 0.685176 1908 1 0.497885 0.936358 0.81057 2034 1 0.561596 0.937942 0.875203 1905 1 0.499698 0.876385 0.748598 1779 1 0.560653 0.87373 0.684396 1784 1 0.624667 0.940247 0.68461 1906 1 0.561714 0.934762 0.743289 1907 1 0.561507 0.873982 0.810609 1909 1 0.621615 0.876934 0.74495 1912 1 0.624151 0.940617 0.807941 2022 1 0.189438 0.937087 0.873853 2035 1 0.563116 0.87774 0.940744 1783 1 0.683499 0.877728 0.687337 1787 1 0.816142 0.87639 0.685653 1788 1 0.749469 0.945155 0.689621 1910 1 0.683608 0.939472 0.748244 1911 1 0.68994 0.880196 0.809725 1913 1 0.750276 0.878997 0.745199 1914 1 0.812371 0.938209 0.750121 1915 1 0.808821 0.876404 0.811848 1916 1 0.751605 0.939809 0.811659 2040 1 0.624284 0.938812 0.936492 1889 1 0.998915 0.877016 0.749526 2037 1 0.627021 0.878236 0.869657 1791 1 0.943058 0.876104 0.683335 1792 1 0.872441 0.935864 0.692832 1917 1 0.874912 0.874786 0.750304 1918 1 0.936578 0.935364 0.747597 1919 1 0.935686 0.870484 0.812714 1920 1 0.876345 0.933042 0.814227 1922 1 0.0598053 0.559942 0.872448 1928 1 0.116202 0.562056 0.933603 1955 1 0.0585485 0.626865 0.93349 1957 1 0.121644 0.620798 0.87369 1953 1 0.998159 0.61874 0.871652 1613 1 0.372995 0.749493 0.494059 1683 1 0.562126 0.500085 0.685815 2033 1 0.504096 0.876593 0.87142 1069 1 0.374998 0.629647 0.997714 1963 1 0.311739 0.618649 0.94006 1961 1 0.259275 0.625926 0.873923 1932 1 0.252961 0.563199 0.939143 1959 1 0.187297 0.621825 0.942989 1926 1 0.193467 0.564888 0.874499 1930 1 0.317255 0.557799 0.877785 2025 1 0.253493 0.866269 0.874627 1936 1 0.377765 0.562829 0.938849 1967 1 0.433961 0.621471 0.940017 1934 1 0.435654 0.562077 0.881666 1965 1 0.375511 0.621949 0.878579 1969 1 0.503433 0.621496 0.873674 1951 1 0.935487 0.4973 0.935862 1065 1 0.244818 0.629342 1.00228 1142 1 0.679744 0.940952 1.00109 1109 1 0.624767 0.747934 1.00184 1940 1 0.497119 0.56007 0.934872 1938 1 0.56431 0.562656 0.881153 1944 1 0.627597 0.567574 0.939445 1971 1 0.561067 0.628287 0.944055 1973 1 0.620562 0.62835 0.875667 1 1 0.00329005 0.994882 0.999917 1106 1 0.559736 0.809859 0.998724 1977 1 0.745861 0.62926 0.871193 1975 1 0.688323 0.625623 0.932612 1948 1 0.759051 0.568097 0.937553 1979 1 0.811881 0.626106 0.938558 1942 1 0.683962 0.56681 0.873431 1946 1 0.813183 0.571473 0.874804 1082 1 0.81224 0.69003 1.00469 919 1 0.687864 0.994137 0.936215 1924 1 0.995052 0.559324 0.934904 1952 1 0.874799 0.562317 0.937959 1981 1 0.882694 0.621163 0.876466 1983 1 0.937337 0.627719 0.934794 1950 1 0.942886 0.557449 0.870673 1821 1 0.873224 0.49879 0.7471 1960 1 0.126522 0.687872 0.929854 1986 1 0.0632014 0.809921 0.877494 1987 1 0.0628483 0.746406 0.930625 1989 1 0.126333 0.745166 0.873321 1992 1 0.128642 0.811757 0.937595 1954 1 0.0562704 0.691498 0.870361 1956 1 0.998305 0.689523 0.933859 1555 1 0.56407 0.502544 0.559914 2023 1 0.188958 0.874097 0.938295 1993 1 0.243855 0.744864 0.876653 1996 1 0.245077 0.806083 0.932613 1964 1 0.242984 0.689504 0.93746 1990 1 0.183286 0.812189 0.874878 1991 1 0.183763 0.750015 0.932907 1962 1 0.308427 0.690318 0.877091 1958 1 0.186886 0.681878 0.871247 1995 1 0.309234 0.751481 0.939355 1994 1 0.313128 0.806002 0.871636 1999 1 0.441324 0.754029 0.936749 1997 1 0.383068 0.748423 0.873873 1998 1 0.437888 0.811204 0.873891 2000 1 0.373983 0.815435 0.933359 1966 1 0.434238 0.688331 0.878521 1968 1 0.369423 0.689442 0.933577 2004 1 0.503045 0.815979 0.934707 2001 1 0.500555 0.748847 0.874876 1972 1 0.502321 0.69202 0.932432 2028 1 0.248705 0.927938 0.933591 1537 1 -0.00274391 0.500186 0.501767 2026 1 0.313428 0.940455 0.869253 2030 1 0.442086 0.935365 0.875314 1970 1 0.561659 0.690496 0.873941 2005 1 0.623243 0.749278 0.868146 2002 1 0.566664 0.816006 0.873047 1976 1 0.624508 0.690296 0.934492 2003 1 0.564927 0.75646 0.934028 2008 1 0.627931 0.81462 0.929203 2029 1 0.375035 0.878642 0.870559 2027 1 0.311085 0.868752 0.933349 2009 1 0.749594 0.752537 0.877064 2006 1 0.689335 0.81297 0.869296 1974 1 0.683598 0.690973 0.873378 1978 1 0.807354 0.690828 0.877604 2007 1 0.684895 0.751344 0.940095 2012 1 0.742412 0.812389 0.93529 2011 1 0.810711 0.751031 0.941425 1980 1 0.751219 0.685419 0.937169 2010 1 0.815091 0.808893 0.871499 1939 1 0.559919 0.496837 0.944788 1985 1 0.99722 0.751333 0.874381 2013 1 0.871301 0.746353 0.87604 2015 1 0.934167 0.751994 0.939537 2016 1 0.870999 0.810128 0.939054 2014 1 0.935759 0.814163 0.874564 1982 1 0.933062 0.684558 0.871836 1984 1 0.870724 0.687759 0.937976 1988 1 -0.00323919 0.810109 0.937338 2024 1 0.125453 0.929988 0.936786 2019 1 0.061587 0.871006 0.939559 2017 1 0.996311 0.868225 0.880542 2021 1 0.123169 0.869693 0.878729 2018 1 0.0605042 0.928374 0.873854 1677 1 0.375135 0.498685 0.627513 1026 1 0.0583489 0.559385 1.00121 899 1 0.0672077 0.992376 0.935996 903 1 0.190662 0.995224 0.937853 1657 1 0.749682 0.878825 0.503697 1114 1 0.802834 0.818563 0.998536 905 1 0.253656 0.999949 0.877429 1949 1 0.875962 0.504327 0.873764 1801 1 0.246156 0.496629 0.750929 1815 1 0.687592 0.499882 0.811973 1081 1 0.750845 0.630232 1.00522 657 1 0.508139 1.00053 0.625324 1947 1 0.820622 0.502124 0.940751 647 1 0.187213 1.00075 0.688299 1943 1 0.687174 0.506906 0.938086 1658 1 0.809314 0.938185 0.506405 791 1 0.687918 0.998292 0.814542 1025 1 0.99635 0.501498 0.99953 1141 1 0.626297 0.866976 0.996425 927 1 0.942169 0.997789 0.93717 1057 1 0.997483 0.616952 0.998874 527 1 0.440011 1.002 0.56236 1078 1 0.688072 0.689488 0.994851 1093 1 0.12574 0.754405 0.999195 1070 1 0.441225 0.69082 0.995138 1598 1 0.936816 0.694074 0.498993 1038 1 0.437533 0.561805 1.00167 1066 1 0.309826 0.690516 0.998251 1098 1 0.314916 0.814412 1.0003 9 1 0.25033 0.995246 0.996732 1650 1 0.558985 0.933986 0.499585 1610 1 0.314395 0.812355 0.501407 1621 1 0.626644 0.755709 0.494251 1130 1 0.308346 0.936685 0.993011 1614 1 0.433756 0.810042 0.500739 1033 1 0.247501 0.49737 0.999418 1105 1 0.499805 0.748177 0.997368 1113 1 0.748941 0.75063 0.997297 1622 1 0.687039 0.814739 0.507809 1049 1 0.754615 0.506527 1.00246 1633 1 0.00583256 0.87585 0.502233 1030 1 0.183248 0.557276 0.9963 513 1 0.998055 0.996316 0.504671 1061 1 0.117877 0.629023 0.989176 1634 1 0.0697254 0.934708 0.50406 1150 1 0.936624 0.934626 0.992364 1550 1 0.43939 0.559519 0.49382 1146 1 0.81007 0.93828 0.991674 525 1 0.372889 0.995584 0.499587
04c9978ad6a95cfed263e81ffc0cdeaba8a93b6c
ab460d3c0c3cbc4bd45542caea46fed8b1ee8c26
/dprs/common/sftp/PySFTPAuthException.py
a6d9b4cf620bb2d34ac77e41957792eefe8c126a
[ "Unlicense" ]
permissive
sone777/automl-dprs
8c7f977402f6819565c45acd1cb27d8d53c40144
63572d1877079d8390b0e4a3153edf470056acf0
refs/heads/main
2023-09-03T21:54:43.440111
2021-11-02T14:44:35
2021-11-02T14:44:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
288
py
# -*- coding: utf-8 -*- # Author : Jin Kim # e-mail : [email protected] # Powered by Seculayer © 2020 AI Service Model Team, R&D Center. class PySFTPAuthException(Exception): def __str__(self): return "[ERROR-C0001] Authentication failed. check username and password!"
8403194c971606033bb11b869b9d4c323b5903ff
2e00546708761532e0081dc9be928b58307c5941
/setup.py
6f30596ede067a7daf4e98a7a4a82ac3164c7708
[ "BSD-3-Clause" ]
permissive
gijs/bulbs
5f16b9d748face55f514f73c849745af91a8bd97
650e03d1ee635d0d8f40557f4697b3a85b88cdff
refs/heads/master
2021-01-18T06:23:04.496132
2011-07-15T15:00:49
2011-07-15T15:00:49
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,726
py
""" Bulbs ----- Bulbs is a Python persistence framework for graph databases that connects to Rexster. """ from setuptools import Command, setup class run_audit(Command): """Audits source code using PyFlakes for following issues: - Names which are used but not defined or used before they are defined. - Names which are redefined without having been used. """ description = "Audit source code with PyFlakes" user_options = [] def initialize_options(self): all = None def finalize_options(self): pass def run(self): import os, sys try: import pyflakes.scripts.pyflakes as flakes except ImportError: print "Audit requires PyFlakes installed in your system.""" sys.exit(-1) dirs = ['bulbs', 'tests'] # Add example directories #for dir in ['blog',]: # dirs.append(os.path.join('examples', dir)) # TODO: Add test subdirectories warns = 0 for dir in dirs: for filename in os.listdir(dir): if filename.endswith('.py') and filename != '__init__.py': warns += flakes.checkPath(os.path.join(dir, filename)) if warns > 0: print ("Audit finished with total %d warnings." % warns) else: print ("No problems found in sourcecode.") def run_tests(): import os, sys sys.path.append(os.path.join(os.path.dirname(__file__), 'tests')) from bulbs_tests import suite return suite() setup ( name = 'Bulbs', version = '0.2-dev', url = 'http://bulbflow.com', license = 'BSD', author = 'James Thornton', author_email = '[email protected]', description = 'A Python persistence framework for graph databases that ' 'connects to Rexster.', long_description = __doc__, keywords = "graph database DB persistence framework rexster gremlin", packages = ['bulbs'], zip_safe=False, platforms='any', install_requires=[ 'httplib2>=0.7.1', 'simplejson>=2.1.6', ], classifiers = [ "Programming Language :: Python", "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Topic :: Database", "Topic :: Database :: Front-Ends", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Distributed Computing", ], cmdclass={'audit': run_audit}, test_suite='__main__.run_tests' )
fb4c0158df41aa9f4f260853f8e1938e3784bd0a
c6f6dd7f8733af191c52a0365f71f4a2c3bc7000
/venv/bin/pip3.7
4574a3c87d9c826184f69885850998e5208d43c3
[]
no_license
gruni1992/AirlineChecker
20c79d75160a7829ce2c61305d521ce1a7144919
4ea8de9c6f42735bb0dae184a842a7f2be686fb4
refs/heads/master
2020-10-01T03:29:22.517770
2019-12-11T23:31:57
2019-12-11T23:31:57
227,445,330
0
0
null
null
null
null
UTF-8
Python
false
false
423
7
#!/Users/tobiasgrunwald/PycharmProjects/AirlineChecker/venv/bin/python # EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3.7' __requires__ = 'pip==19.0.3' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('pip==19.0.3', 'console_scripts', 'pip3.7')() )
b71941a91b5406892fc0962d46ddbf6b15406fb4
64d923ab490341af97c4e7f6d91bf0e6ccefdf4b
/tensorforce/core/networks/auto.py
6a445b051b06ae683e4435e6f34e5c608037ef5b
[ "Apache-2.0" ]
permissive
tensorforce/tensorforce
38d458fedeeaa481adf083397829cea434d020cd
1bf4c3abb471062fb66f9fe52852437756fd527b
refs/heads/master
2023-08-17T17:35:34.578444
2023-08-14T20:14:08
2023-08-14T20:14:08
85,491,050
1,312
246
Apache-2.0
2023-08-14T20:14:10
2017-03-19T16:24:22
Python
UTF-8
Python
false
false
7,625
py
# Copyright 2020 Tensorforce Team. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== import logging from tensorforce import TensorforceError from tensorforce.core.networks import LayeredNetwork class AutoNetwork(LayeredNetwork): """ Network whose architecture is automatically configured based on input types and shapes, offering high-level customization (specification key: `auto`). Args: size (int > 0): Layer size, before concatenation if multiple states (<span style="color:#00C000"><b>default</b></span>: 64). depth (int > 0): Number of layers per state, before concatenation if multiple states (<span style="color:#00C000"><b>default</b></span>: 2). final_size (int > 0): Layer size after concatenation if multiple states (<span style="color:#00C000"><b>default</b></span>: layer size). final_depth (int > 0): Number of layers after concatenation if multiple states (<span style="color:#00C000"><b>default</b></span>: 1). rnn (false | [parameter](../modules/parameters.html), int >= 0): Whether to add an LSTM cell with internal state as last layer, and if so, horizon of the LSTM for truncated backpropagation through time (<span style="color:#00C000"><b>default</b></span>: false). device (string): Device name (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module). l2_regularization (float >= 0.0): Scalar controlling L2 regularization (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module). name (string): <span style="color:#0000C0"><b>internal use</b></span>. inputs_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>. outputs (iter[string]): <span style="color:#0000C0"><b>internal use</b></span>. """ def __init__( self, *, size=64, depth=2, final_size=None, final_depth=1, rnn=False, device=None, l2_regularization=None, name=None, inputs_spec=None, outputs=None, # Deprecated internal_rnn=None ): if internal_rnn is not None: raise TensorforceError.deprecated( name='AutoNetwork', argument='internal_rnn', replacement='rnn' ) if len(inputs_spec) == 1: if final_size is not None: raise TensorforceError.invalid( name='AutoNetwork', argument='final_size', condition='input size = 1' ) if final_depth is not None and final_depth != 1: raise TensorforceError.invalid( name='AutoNetwork', argument='final_depth', condition='input size = 1' ) if len(inputs_spec) > 8: logging.warning("Large number of state components {} which may cause poor performance, " "consider merging components where possible.".format(len(inputs_spec))) if outputs is not None: raise TensorforceError.invalid( name='policy', argument='single_output', condition='AutoNetwork' ) if final_size is None: final_size = size if final_depth is None: final_depth = 0 layers = list() for input_name, spec in inputs_spec.items(): if len(inputs_spec) == 1: state_layers = layers else: state_layers = list() layers.append(state_layers) # Retrieve input state if input_name is None: prefix = '' else: prefix = input_name + '_' state_layers.append(dict( type='retrieve', name=(prefix + 'retrieve'), tensors=(input_name,) )) # Embed bool and int states requires_embedding = (spec.type == 'bool' or spec.type == 'int') if spec.type == 'int' and spec.num_values is None: if input_name is None: raise TensorforceError.required( name='state', argument='num_values', condition='state type is int' ) else: raise TensorforceError.required( name=(input_name + ' state'), argument='num_values', condition='state type is int' ) if requires_embedding: state_layers.append(dict( type='embedding', name=(prefix + 'embedding'), size=size )) # Shape-specific layer type if spec.rank == 1 - requires_embedding: layer = 'dense' elif spec.rank == 2 - requires_embedding: layer = 'conv1d' elif spec.rank == 3 - requires_embedding: layer = 'conv2d' elif spec.rank == 0: state_layers.append(dict(type='flatten', name=(prefix + 'flatten'))) layer = 'dense' else: raise TensorforceError.value( name='AutoNetwork', argument='input rank', value=spec.rank, hint='>= 3' ) # Repeat layer according to depth (one less if embedded) for n in range(depth - requires_embedding): state_layers.append(dict( type=layer, name='{}{}{}'.format(prefix, layer, n), size=size )) # Max pool if rank greater than one if spec.rank > 1 - requires_embedding: state_layers.append(dict( type='pooling', name=(prefix + 'pooling'), reduction='max' )) # Register state-specific embedding if input_name is not None: state_layers.append(dict( type='register', name=(prefix + 'register'), tensor=(input_name + '-embedding') )) # Final combined layers if len(inputs_spec) == 1: final_layers = layers else: final_layers = list() layers.append(final_layers) # Retrieve state-specific embeddings final_layers.append(dict( type='retrieve', name='retrieve', tensors=tuple(input_name + '-embedding' for input_name in inputs_spec), aggregation='concat' )) # Repeat layer according to depth for n in range(final_depth): final_layers.append(dict(type='dense', name=('dense' + str(n)), size=final_size)) # Rnn if rnn is not None and rnn is not False: final_layers.append(dict(type='lstm', name='lstm', size=final_size, horizon=rnn)) super().__init__( layers=layers, device=device, l2_regularization=l2_regularization, name=name, inputs_spec=inputs_spec, outputs=outputs )
bf809fa31669a6db995f706f5243cd48a837b0ab
8f5a3c0b51599d3daac814fd7d7aaaef85de6c1a
/Sports/live_tennis.1m.py
5cf2d105b865a0bccebc52b5c44f3bc30a9775a5
[]
no_license
chrisidefix/bitbar-plugins
d3fc46ae0b24e05ac77bf326863e6f7d091d9b7b
10c66222f4fb21666aabfd7ddc5d976bc2ef062a
refs/heads/master
2021-01-20T00:36:59.380506
2016-03-30T14:33:04
2016-03-30T14:33:04
55,046,126
0
0
null
2016-03-30T08:29:44
2016-03-30T08:29:44
null
UTF-8
Python
false
false
4,332
py
#!/usr/local/bin/python # -*- coding: utf-8 -*- # <bitbar.title>Live Tennis Scores</bitbar.title> # <bitbar.version>v1.0</bitbar.version> # <bitbar.author>Anup Sam Abraham</bitbar.author> # <bitbar.author.github>anupsabraham</bitbar.author.github> # <bitbar.desc>Show live scores for tennis matches using ATP World Tour api</bitbar.desc> # <bitbar.image>http://i.imgur.com/5kOPKVv.png</bitbar.image> # <bitbar.dependencies></bitbar.dependencies> # <bitbar.abouturl></bitbar.abouturl> import urllib2 import json atpworldtour_base_url = "http://www.atpworldtour.com" inital_scores_url = atpworldtour_base_url + "/en/-/ajax/Scores/GetInitialScores" nbsp = "&nbsp;" # for stripping &nbsp; from data team_keys = ['TeamOne', 'TeamTwo'] set_key_names = ['SetOne', 'SetTwo', 'SetThree', 'SetFour', 'SetFive'] inital_scores_response = urllib2.urlopen(inital_scores_url) initial_scores_data = json.load(inital_scores_response) tournaments = initial_scores_data['liveScores']['Tournaments'] final_matches_list = [] for each_tournament in tournaments: matches = each_tournament['Matches'] for match in matches: match_data = {} teams = [] for team_name in team_keys: team_data = {} # get the player(s) name for each team player_name = match[team_name]['PlayerOneName'] if match[team_name]['PlayerTwoName'].strip(): player_name += " / " + match[team_name]['PlayerTwoName'] if match[team_name]['TeamStatus'] == "now-serving": player_name += "*" team_data['player_name'] = player_name # get the scores score_string = "" set_score_list = [] for set_name in set_key_names: if set_name in match[team_name]['Scores'] and match[team_name]['Scores'][set_name] != nbsp: score_string += match[team_name]['Scores'][set_name] set_score_list.append(int(match[team_name]['Scores'][set_name])) score_string += " " if "CurrentScore" in match[team_name]['Scores'] and match[team_name]['Scores']['CurrentScore'] != nbsp: score_string += match[team_name]['Scores']["CurrentScore"] team_data['score'] = score_string team_data['set_score_list'] = set_score_list teams.append(team_data) set_lead = [0,0] if not match['MatchInfo'].strip(): # if matchinfo is not present in the json response, generate a match info # Calculate the total number of sets won by each team/player for x in xrange(5): if len(teams[0]['set_score_list']) > x and len(teams[0]['set_score_list']) > x: if (teams[0]['set_score_list'][x] - 2) >= teams[1]['set_score_list'][x] and teams[0]['set_score_list'][x] >= 6: set_lead[0] += 1 elif (teams[1]['set_score_list'][x] - 2) >= teams[0]['set_score_list'][x] and teams[1]['set_score_list'][x] >= 6: set_lead[1] += 1 if set_lead[0] > set_lead[1]: match_data['info'] = "%s leads by %s set%s to %s" %(teams[0]['player_name'], set_lead[0], "s" if set_lead[0] > 1 else "", set_lead[1]) elif set_lead[1] > set_lead[0]: match_data['info'] = "%s leads by %s set%s to %s" %(teams[1]['player_name'], set_lead[1], "s" if set_lead[1] > 1 else "", set_lead[0]) elif not (set_lead[0] & set_lead[1]): match_data['info'] = "First set in progress" else: match_data['info'] = "Both won %s set%s each" %(set_lead[0], "s" if set_lead[0] > 1 else "") else: match_data['info'] = match['MatchInfo'] match_data['url'] = atpworldtour_base_url + match['StatsLink'] match_data['team_data'] = teams final_matches_list.append(match_data) if final_matches_list: print "🎾%s" % len(final_matches_list) print "---" for match in final_matches_list: print match['info'] + " | size=15 color=blue href=" + match['url'] for team in match['team_data']: print team['score'] + " " + team['player_name'] + " | size=13" print "---" else: print "🎾"
1e0ee01251f67ed10b637c3a87ce579476bbe16d
7f0694d3186a1294123db11ba7e02babc11f89e7
/Dash_App_and_Models/model1.py
5abfdc20e91e4628200a1920b63de837365b1890
[]
no_license
Nwosu-Ihueze/final_project
47e05cde1ace4ddede7446578794d0444fb03e88
1783d576ce5238008ffaa57fbad56f61c4fd41e5
refs/heads/master
2022-04-09T06:12:16.409124
2020-03-04T21:49:28
2020-03-04T21:49:28
null
0
0
null
null
null
null
UTF-8
Python
false
false
886
py
import pandas as pd import numpy as np from scipy import sparse from lightfm import LightFM from sklearn.metrics.pairwise import cosine_similarity from lightfm.evaluation import auc_score from lightfm.evaluation import precision_at_k,recall_at_k from surprise import Dataset, Reader from surprise import SVD from surprise import accuracy from surprise.model_selection import cross_validate, train_test_split, RandomizedSearchCV df = pd.read_csv('skindataall.csv', index_col=[0]) data = df[['User_id', 'Product_Url', 'Rating_Stars']] reader = Reader(line_format='user item rating', sep=',') data = Dataset.load_from_df(data, reader=reader) trainset, testset = train_test_split(data, test_size=.2) svd = SVD() svd.fit(trainset) predictions = svd.test(testset) accuracy.rmse(predictions) accuracy.mae(predictions) dump.dump('svd_model', algo=svd, predictions=predictions, verbose=1)
7739df99512578f0171dbfb7fc76a3ce076b6ff8
f0c7d9f0a11ffc4688426ac322a8393037794254
/day10/json/json_readme.py
5d57b22bc6f8a53cfe6c61890d79aa64c6f8d306
[]
no_license
AndroidIosWebEmbeddedFirmwareDver/python3LearningNote
fd19b72fdcddfa2e440c14856ecb0ef609ed525a
83294f9820edeade9446938852a510351c2e49db
refs/heads/master
2020-03-07T21:12:36.214027
2018-04-02T07:29:49
2018-04-02T07:29:49
127,720,470
1
0
null
null
null
null
UTF-8
Python
false
false
1,687
py
# # # # TODO;Python3 JSON 数据解析 """ JSON (JavaScript Object Notation) 是一种轻量级的数据交换格式。它基于ECMAScript的一个子集。 Python3 中可以使用 json 模块来对 JSON 数据进行编解码,它包含了两个函数: json.dumps(): 对数据进行编码。 json.loads(): 对数据进行解码。 在json的编解码过程中,python 的原始类型与json类型会相互转换,具体的转化对照如下: Python 编码为 JSON 类型转换对应表: ----------------------------------------------------- Python JSON ----------------------------------------------------- dict object list, tuple array str string int, float, int- & float-derived Enums number True true False false None null ----------------------------------------------------- JSON 解码为 Python 类型转换对应表: ----------------------------------------------------- JSON Python ----------------------------------------------------- object dict array list string str number (int) int number (real) float true True false False null None ----------------------------------------------------- """
bd30293088449cc6e3717512ad35e784ff32fadf
06a456087f2e49baa3aac361c55a3df986e1834d
/hom_step4.py
dcef3346754c6ab1508d511145f5c75b87ffa25a
[]
no_license
rjanssen96/discrete_structures
b9ccaeafeace34cabb4c508712b6feb456d82b7c
4529c705e4823a0ac877482f2b9214a37ca48af9
refs/heads/master
2020-04-09T08:52:02.648970
2019-01-08T08:10:46
2019-01-08T08:10:46
160,211,410
0
0
null
null
null
null
UTF-8
Python
false
false
2,384
py
# (Step 4) Obtain the general solution of degree 2+, nvm 1+ def find_general_solution_2(all_r_and_m_test): test_general_sol = "s(n)=" u = 1 # counter for adding a + between root sections a = 1 # chose which theorem to use based on the multiplicities # loop through all multiplicities, if any of them is > 1, then set boolean equal to True, default is false difficult_theorem = False for x in all_r_and_m_test.values(): if x > 1: difficult_theorem = True # print(difficult_theorem) if difficult_theorem == True: # if some multiplicitie(s) > 1 for x in all_r_and_m_test: # x is the values of the roots i = 0 # power of the n in every root section counter, resets for every root test_general_sol = test_general_sol + "(" for y in range(0, all_r_and_m_test[x]): # for the length of the multiplicity excluding the boundaries # print(y) # if y == 0: # to prevent one to many + # test_general_sol = test_general_sol + "Alpha_" + str(a) + "*n**" + str(i) # elif y > 0: test_general_sol = test_general_sol + "+Alpha_" + str(a) + "*n**" + str(i) i = i + 1 # power counter a = a + 1 # alpha counter # prevents one to many * at the end if u == len(all_r_and_m_test): test_general_sol = test_general_sol + ")(" + str(x) + ")**n" elif u != len(all_r_and_m_test): test_general_sol = test_general_sol + ")(" + str(x) + ")**n+" else: print("Never lucky m8") u = u + 1 elif difficult_theorem == False: # when all multiplicities are 1 for x in all_r_and_m_test: if x == 0: # So that the equation doesn't start with + test_general_sol = test_general_sol + "Alpha_" + str(a) + "*(" + str(x) + ")**n" elif x != 0: test_general_sol = test_general_sol + "+Alpha_" + str(a) + "*(" + str(x) + ")**n" a = a + 1 # replace all the *n**0 with "", cuz anything to the 0th power is 1 # and replace anything to the power 1 to just that thing test_general_sol = test_general_sol.replace("*n**0", "") test_general_sol = test_general_sol.replace("**1", "") return test_general_sol
2e6261677ddc3501e9d60c2a0868e8ae1938e26e
f33e2e9e10a7c8a5ecc9997f86548bad071ce33e
/alerta/app/exceptions.py
6c0b0caccf525a16c4431797256c413948898f77
[ "Apache-2.0" ]
permissive
sasha-astiadi/alerta
01f1136adbfc26f79935c1c44e9ca3d49efd6f00
f9a33f50af562e5d0a470e1091e9d696d76558f4
refs/heads/master
2023-03-16T10:35:42.300274
2018-01-23T14:06:42
2018-01-23T14:06:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
431
py
class AlertaException(IOError): pass class RejectException(AlertaException): """The alert was rejected because the format did not meet the required policy.""" pass class RateLimit(AlertaException): """Too many alerts have been received for a resource or from an origin.""" pass class BlackoutPeriod(AlertaException): """Alert was not processed becauese it was sent during a blackout period.""" pass
5406a0bd1a39311a7a0f09d7800aa9d20636919f
c631e9756210bab774afda2b228853cb93ae28fe
/src/test/test_trainer_attention.py
5e4bbec6ab8ba0a3a905e64b3e3157bbcaafa0c8
[]
no_license
AIRob/pytorch-chat-bot
9a9af2078ef4ee6b5ce5a10a75977fb0b5adfe6a
1b604f9fecee70e519a930525afaa83facbfaf68
refs/heads/master
2020-03-27T10:00:35.117537
2017-12-09T01:38:40
2017-12-09T01:38:40
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,541
py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from unittest import TestCase from data.data_loader_attention import DataLoaderAttention from models.encoder import Encoder from models.decoder import Decoder from models.trainer import Trainer class TestTrainerAttention(TestCase): def test_train_method(self): file_name = 'test/test_data/attention_test.txt' fine_tune_model_name = '../models/glove_model_40.pth' self.test_data_loader_attention = DataLoaderAttention(file_name=file_name) self.test_data_loader_attention.load_data() source2index, index2source, target2index, index2target, train_data = \ self.test_data_loader_attention.load_data() EMBEDDING_SIZE = 50 HIDDEN_SIZE = 32 encoder = Encoder(len(source2index), EMBEDDING_SIZE, HIDDEN_SIZE, 3, True) decoder = Decoder(len(target2index), EMBEDDING_SIZE, HIDDEN_SIZE*2) self.trainer = Trainer( fine_tune_model=fine_tune_model_name ) self.trainer.train_attention(train_data=train_data, source2index=source2index, target2index=target2index, index2source=index2source, index2target=index2target, encoder_model=encoder, decoder_model=decoder, )
683e3738c5937bb596285d3eda2385c7b56b00c8
faf5d559e70e5434ae3fbd603b0c6217d321477a
/News/constans/www_4908_cn.py
eba1c5b80647e2ca183e270b62de43781489f247
[]
no_license
roceys/NewsCrawlerPG
50780b42740d9cbce1af037636fa169440d7292a
84f32942f07205858973dcc2ad44caae989553eb
refs/heads/master
2020-12-04T15:57:53.462780
2016-07-12T05:21:08
2016-07-12T05:21:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
819
py
# coding: utf-8 SPIDER_NAME = "spider:news:www_4908_cn" # START_URLS = [""] # CLASS_NAME = "" CRAWL_SOURCE = u"奇趣网" DOMAIN = "www.4908.com" # AJAX = True ITEMS_XPATH = "//div[@class='summary']/h3" TITLE_XPATH = "./a/text()" URL_XPATH = "./a/@href" # SUMMARY_XPATH = "" # THUMB_XPATH = "" # EXTRACTOR_CLS = "News.extractor." # CUSTOM_SETTINGS = { # # } CATEGORIES = { u"奇趣动物": ("http://www.4908.cn/html/Animals/", 31, 30, 4), u"趣闻轶事": ("http://www.4908.cn/html/QuWenYiShi/", 31, 30, 4), u"世界之最": ("http://www.4908.cn/html/ShiJieZhiZui/", 31, 30, 3), u"科学探秘": ("http://www.4908.cn/html/YuZhou/", 14, 120, 4), u"野史逸闻": ("http://www.4908.cn/html/YeShiYiWen/", 13, 120, 4), u"热点扫描": ("http://www.4908.cn/html/SheHuiReDian/", 2, 120, 3), }
4aadfcd20a040ed6e5cbe84affd38b0320fa6928
e12385c85e41d98bc3104f3e4dde22025a0b6365
/m5stack-u105/examples/test_saw.py
f4472bdcdd32643ae248bca4c8a0e8d2eb67553a
[]
no_license
mchobby/esp8266-upy
6ee046856ec03c900ebde594967dd50c5f0a8e21
75184da49e8578315a26bc42d9c3816ae5d5afe8
refs/heads/master
2023-08-04T15:11:03.031121
2023-07-27T15:43:08
2023-07-27T15:43:08
72,998,023
47
30
null
2021-06-20T16:12:59
2016-11-06T15:00:57
Python
UTF-8
Python
false
false
515
py
""" Test the MicroPython driver for M5Stack U105, DDS unit (AD9833), I2C grove. Set SAWTOOTH signal output (this have fixed frequency) * Author(s): 30 may 2021: Meurisse D. (shop.mchobby.be) - Initial Writing """ from machine import I2C from mdds import * from time import sleep # Pico - I2C(0) - sda=GP8, scl=GP9 i2c = I2C(0) # M5Stack core # i2c = I2C( sda=Pin(21), scl=Pin(22) ) dds = DDS(i2c) # Generates the SAW TOOTH signal at 55.9Hz (fixed frequency) dds.quick_out( SAWTOOTH_MODE, freq=1, phase=0 )
d8f1945073a82d83a780f2b1c557761a8de3d924
95a5cc3e42774ca8e02135e207980aed7d34a606
/Page/login.py
3d1dc0081c80cd57ad87bb0f79b30514daf0a7cb
[]
no_license
xiaozhang3358/HouTai
783caa4f50c2117719de44fc3b4f41d2eb7af2fa
0d47cff22604c45493086d7faa2c316d1c386535
refs/heads/master
2020-04-22T03:45:02.881442
2019-02-11T08:58:26
2019-02-11T08:58:26
160,893,538
0
0
null
null
null
null
UTF-8
Python
false
false
567
py
import Page from Base.base import Base class PageLogin(Base): # 输入用户名 def page_login_username(self,username): self.base_input_text(Page.username,username) # 输入密码 def page_login_pwd(self,pwd): self.base_input_text(Page.pwd,pwd) # 点击登录 def page_login_btn(self): self.base_click_btn(Page.login_btn) # 封装登录方法 def page_login(self): self.page_login_username('admini') self.page_login_pwd('admin') self.page_login_btn() print('--------------')
eb8d51fb5ca54be0611768c70ffc111e7f16e59f
d51611481c8e5d827f440357e8298f5047a72d2a
/UserAPP/Douar.py
9c4e214b53a8c96dabf65c1afb7bd87c82b52c73
[]
no_license
oudacias/GeoProject
82c15c0f7f205cd7e64ebdc4ddb7fae9b15d7ee9
3c9e5699f75d84e2e6f8a11c4e3201233f2357a4
refs/heads/master
2023-08-18T10:19:01.858274
2021-09-30T14:30:59
2021-09-30T14:30:59
386,601,211
0
0
null
null
null
null
UTF-8
Python
false
false
6,428
py
import tkinter as tk from tkinter import ttk from tkinter import * from tkinter.messagebox import * from UserAPP.Douar_BE import Douar class AddDouar(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) self.title("Douar") self.geometry("801x450+240+100") self.resizable(0, 0) #self.iconbitmap(r'C:\Users\LAILA\PycharmProjects\IFE_GIS\icons\iconlogo.ico') self.config(bg="#F7F9F9") self.dr = Douar() # -------------------------------------------------------------TREEVIEW------------------------------------------------- global tree style = ttk.Style(self) style.theme_use('clam') style.configure("Treeview", background="#FFFFFF", foreground="#14566D") style.configure("Treeview.Heading", background="#B0D9E8", foreground="#14566D") self.tree = ttk.Treeview(self) self.tree.place(x=5, y=5, width=778, height=425) ysb = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview) ysb.place(x=782, y=5, height=439) xsb = ttk.Scrollbar(self, orient='horizontal', command=self.tree.xview) xsb.place(x=5, y=430, width=778) self.tree['yscroll'] = ysb.set self.tree['xscroll'] = xsb.set col_name = self.dr.columnName() self.tree["columns"] = ("0", "1", "2", "3", "4", "5") self.tree['show'] = 'headings' for c in range(len(self.tree["columns"])): self.tree.column(c, width=100) self.tree.heading(c, text=col_name[c]) douars = self.dr.select() index = iid = 0 for item in douars: self.tree.insert("", index, iid, values=item) index = iid = index + 1 #self.tree.selection_set(self.tree.get_children()[0]) self.tree.bind("<Double-1>", self.OnDoubleClick) # ---------------------- AFFICHAGE DE LIGNE SELECTIONNEE ------------------- def OnDoubleClick(self, event): try: self.row_selected = self.tree.item(self.tree.selection()) value = self.row_selected['values'][0] verf = self.dr.verifyDr(str(value)) if verf == True: self.root = tk.Tk() self.root.title("Douar") self.root.resizable(0, 0) self.root.geometry("370x187+450+190") self.root.config(bg="#F7F9F9") self.frameDoubleClick() elif verf == False: showerror("Douar", "Veuillez sélectionner un douar") except: showerror("Douar", "Veuillez sélectionner un douar") def frameDoubleClick(self): frame_labels = LabelFrame(self.root, text="Modifier/Supprimer", font=("Helvetica", 13), bg="#F7F9F9") frame_labels.place(x=10, y=7, width=350, height=170) self.row_selected = self.tree.item(self.tree.selection()) value = self.row_selected['values'][0] colonnes = self.dr.select_colName() valeurs = self.dr.select_colValue(str(value)) i =0 self.h = [None] * len(colonnes) for j in range(len(colonnes)): label = tk.Label(frame_labels, text=''.join(colonnes[j]), font="Helvetica", pady=10, padx=20, bg="#F7F9F9").grid(row=i+2, column=0) nb = StringVar() nb.set(i) frm = Frame(frame_labels, bg="#4EB1FA", bd=1, relief=FLAT, width=40) frm.grid(row=i+2, column=1) if i == 1: self.h[i] = Entry(frm, textvariable=nb, relief=FLAT, width=32, justify=RIGHT) else: self.h[i] = Entry(frm, textvariable=nb, relief=FLAT, width=32) self.h[i].insert(1, valeurs[0][j]) self.h[i].grid(row=i+2, column=1) i = i+1 button = Button(frame_labels, text="Modifier", command=self.modification, font=("Times New Roman", 11), bg="#4EB1FA",fg="#FFFFFF", relief=FLAT, activebackground="#4EB1FA", activeforeground="#000000") button.place(x=110, y=100) button = Button(frame_labels, text="Supprimer", command=self.suppr, font=("Times New Roman", 11), fg="#FFFFFF", bg="#FF862E", relief=FLAT, activebackground="#FF8A02", activeforeground="#000000") button.place(x=180, y=100) #--------------------- MODIFICATION ----------------- def modification(self): if self.h[0].get() != '': tab = [] for i in range(len(self.h)): tab.append(self.h[i].get()) self.dr.update_colValue(tab, str(self.row_selected['values'][0])) x = self.tree.selection()[0] self.tree.delete(*self.tree.get_children()) douars = self.dr.select() index = iid = 0 for item in douars: self.tree.insert("", index, iid, values=item) index = iid = index + 1 self.root.destroy() else: showerror("Douar", "Veuillez remplir le champ") #--------------------- SUPPRESSION -------------------- def suppr(self): self.popinfos = tk.Toplevel() self.popinfos.title('Suppression') self.popinfos.resizable(0, 0) self.popinfos.config(bg="#F7F9F9") self.popinfos.geometry("360x120+500+300") label = tk.Label(self.popinfos, text="Voulez-vous supprimer ce douar?", font=("Helvetica", 12), pady=13, padx=20, bg="#F7F9F9").place(x=45, y=15) btn1 = tk.Button(self.popinfos, text='Oui', command=self.supprimer, font=("Times New Roman", 11), bg="#4EB1FA",fg="#FFFFFF", relief=FLAT, activebackground="#4EB1FA", activeforeground="#000000") btn1.place(x=148, y=70) btn2 = tk.Button(self.popinfos, text='Non', command=self.annuler, font=("Times New Roman", 11), fg="#FFFFFF", bg="#FF862E", relief=FLAT, activebackground="#FF8A02", activeforeground="#000000") btn2.place(x=200, y=70) def supprimer(self): self.dr.deleteDr(str(self.row_selected['values'][0])) self.root.destroy() self.popinfos.destroy() x = self.tree.selection()[0] self.tree.delete(x) def annuler(self): self.root.destroy() self.popinfos.destroy() '''if __name__ == "__main__": app = AddDouar() app.mainloop()'''
4b50ee25fadef6900d12808a2218ca9d4a650918
a1ab35f212ce1f1aec40232aed181f5fdf4c1532
/app/__init__.py
743641a040dfb89ca467f49cb3bb39ca38dac94d
[ "MIT" ]
permissive
TERESIA012/App_Pitch
5d77e5a3ee393fc41f5df741aa0209cf7e058bc0
86ed3fb682e32686d98ce2258a937314300801a1
refs/heads/master
2023-07-31T09:53:36.641419
2021-09-21T19:35:20
2021-09-21T19:35:20
407,357,436
0
0
null
null
null
null
UTF-8
Python
false
false
1,369
py
from flask import Flask from flask_bootstrap import Bootstrap from config import config_options from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_uploads import UploadSet,configure_uploads,IMAGES from flask_mail import Mail from flask_wtf.csrf import CSRFProtect from flask_simplemde import SimpleMDE mail = Mail() login_manager = LoginManager() csrf = CSRFProtect() simple = SimpleMDE() login_manager.session_protection = 'strong' login_manager.login_view = 'auth.login' bootstrap = Bootstrap() db = SQLAlchemy() photos = UploadSet('photos',IMAGES) def create_app(config_name): app = Flask(__name__) # Creating the app configurations app.config.from_object(config_options[config_name]) config_options[config_name].init_app(app) # Initializing flask extensions bootstrap.init_app(app) db.init_app(app) login_manager.init_app(app) mail.init_app(app) # Registering the blueprint csrf.init_app(app) simple.init_app(app) from .main import main as main_blueprint app.register_blueprint(main_blueprint) from .auth import auth as auth_blueprint app.register_blueprint(auth_blueprint,url_prefix = '/auth') # setting config # from .requests import configure_request # configure_request(app) configure_uploads(app,photos) return app
3e8a9a28a574de2e199c1dabb8e289720915ee65
3060eebbf820d63f934cadb05e398fe76a2f66c8
/quiz/urls.py
cda386e07def41159a07a60d5217c2fbf9cc4c22
[]
no_license
patwardhanakshay8/sadhyam
2ddc38ff37b2d4f413a66b96c7f6b62a1534cff5
f40f7aa0385686d2ffa2bab6e1db0036bd30cbfc
refs/heads/master
2021-01-12T08:03:21.085056
2017-01-01T10:06:21
2017-01-01T10:06:21
77,112,395
0
0
null
null
null
null
UTF-8
Python
false
false
440
py
from django.conf.urls import include, url from tastypie.api import Api from quiz.api import * v1_api = Api(api_name='v1') v1_api.register(UserResource()) v1_api.register(ExamResource()) v1_api.register(SubjectResource()) v1_api.register(ChapterResource()) v1_api.register(QuestionResource()) v1_api.register(TestTemplateResource()) v1_api.register(TemplateDetailResource()) urlpatterns = [ url(r'^',include(v1_api.urls)), ]
af52e6f20b3ecca41269977c3a43d8cccbd8acb3
ebd7d8407df9b809d3c670fc3734d21c8c3b31d1
/assertions/positive_lookbehind.py
1facd1cdb73f4a616843b629fb36e31bb1288f11
[]
no_license
desireevl/hackerrank-regex-solutions
941fc8b877f13149ee87a7f943ca1309393b09ff
659e980294aef2d60fe7f32bcd1f20d3a7134e3c
refs/heads/master
2021-11-23T22:58:00.893639
2021-11-04T00:58:57
2021-11-04T00:58:57
106,813,056
7
2
null
2021-11-04T00:58:58
2017-10-13T10:52:57
Python
UTF-8
Python
false
false
59
py
Regex_Pattern = r"(?<=[1,3,5,7,9])\d" # Do not delete 'r'.
9fcb3eadb820f402f6e00fa52c618598388b3961
0a919e7ec5f92ff64aa7f55b545799d0fa7cf0ac
/scripts/splitDetectionsFileByImage.py
25dafc8ae7ea163329e745e62cae10dd68eea46e
[ "MIT" ]
permissive
Lan1991Xu/localization-agent
cda74d8525f6c2b6cf9e32a660eb0f24e0701b1a
d280acf355307b74e68dca9ec80ab293f0d18642
refs/heads/master
2020-07-02T14:32:17.255176
2015-05-06T19:55:39
2015-05-06T19:55:39
null
0
0
null
null
null
null
UTF-8
Python
false
false
512
py
import os,sys import utils as cu if __name__ == "__main__": params = cu.loadParams("detectionsFile outputDir") f = open(params['detectionsFile']) line = f.readline() img = '' imgOut = open(params['outputDir'] + '/tmp.region_rank','w') while line != '': parts = line.split() if parts[0] != img: imgOut.close() imgOut = open(params['outputDir'] + '/' + parts[0] + '.region_rank','w') img = parts[0] imgOut.write(line) line = f.readline() imgOut.close() f.close()
ba426f1e79cb391d274343cd87e1ffbf76f2fa37
1fc6750d4553b1c7c81837ec1855377f444dacdd
/Test/pigLatin/__init__.py
9cf86a56f5cbda3cf701a8ef4cf627a73908d109
[]
no_license
Yasaman1997/My_Python_Training
a6234c86ef911a366e02ce0d0ed177a0a68157d5
11d0496ba97d97f16a3d168aacdda5a6e47abcf7
refs/heads/master
2023-03-19T08:33:42.057127
2021-03-16T07:43:57
2021-03-16T07:43:57
91,189,940
4
0
null
null
null
null
UTF-8
Python
false
false
96
py
def Pig_Latin(s): s = raw_input( "input a word") while(s!=null): print s+s(0) + "ay"
b93fb2b73c84f3d98b04cf2b4bac0a01950f0d18
83108020d0ea05e4441bf79ff704daf6d3514f4c
/sending_email/email_sender.py
c435a7ab6c5a95934b2afcdafecc54531d831e7d
[]
no_license
poojaurkude/sending_email
e5fbb0fc4cb9d59aeba7bc47982dfbaefbc77e9a
39085f9fb69f5cf6cbf3ca225bde2c6591dbd87c
refs/heads/master
2022-12-12T18:59:17.377151
2020-09-05T16:32:17
2020-09-05T16:32:17
293,113,840
0
0
null
null
null
null
UTF-8
Python
false
false
547
py
import smtplib from email.message import EmailMessage from string import Template from pathlib import Path html = Path('index.html') email = EmailMessage() email['from'] = 'Pooja Urkude' email['to'] = '[email protected]' email['subject'] = 'You won 1,000,000 dollars!' email.set_content(html.substitute({'name': 'TinTin'}), 'html') with smtplib.SMTP(host='smtp.gmail.com', port=587) as smtp: smtp.ehlo() smtp.starttls() smtp.login('[email protected]', 'password') smtp.send_message(email) print('all good boss!')
9b793ddce7fe3af92f4a2dd5c7401ce55c990206
ed36064525bad62959d9ab739edeea477bf29c1c
/2019-10-12-hitcon/lost_key/chall.py
2d51b7278c7440004f88be66401a91b0ef5844a7
[]
no_license
p4-team/ctf
2dae496622c8403d7539b21f0e9a286e9889195a
8280caff137e42b26cb55f2c62411c7c512088de
refs/heads/master
2023-08-12T03:21:31.021612
2023-04-26T23:57:29
2023-04-26T23:57:29
42,933,477
1,899
366
null
2022-06-07T21:51:40
2015-09-22T12:53:15
Python
UTF-8
Python
false
false
848
py
#!/usr/bin/env python from Crypto.Util.number import * import os,sys sys.stdin = os.fdopen(sys.stdin.fileno(), 'r', 0) sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) def read_key(): key_file = open("key") n,e,d = map(int,key_file.readlines()[:3]) return n,e,d def calc(n,p,input): data = "X: "+input num = bytes_to_long(data) res = pow(num,p,n) return long_to_bytes(res).encode('hex') def read_flag(): flag = open('flag').read() assert len(flag) >= 50 assert len(flag) <= 60 prefix = os.urandom(68) return prefix+flag if __name__ == '__main__': n,e,d = read_key() flag = calc(n,e,read_flag()) print 'Here is the flag!', flag for i in xrange(100): m = raw_input('give me your X value: ') try: m = m.decode('hex')[:15] print calc(n,e,m) except: print 'no' exit(0)
bb9d5fc7810f0c52be7c03285202c98cac4f701f
89d7ea3933cf6e1615d4aec2212ba84b19860afb
/venv/Scripts/pip-script.py
a0ed26bf344dcd4d667ed64588b2062d0a41cc17
[]
no_license
tanghu123/PythonOOP
4fc024b2136f4fde0d9a2407ce41e40715272f85
865fcb8f1e99b1d72bb663b62e47e7f779a4d997
refs/heads/master
2020-03-30T00:36:19.645843
2018-09-27T05:24:14
2018-09-27T05:24:14
null
0
0
null
null
null
null
UTF-8
Python
false
false
414
py
#!C:\Users\HuTang\PycharmProjects\PythonOOP\venv\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip' __requires__ = 'pip==10.0.1' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('pip==10.0.1', 'console_scripts', 'pip')() )
e5cfae9f86cb329040c77db72efe87b83cd9d6e0
6f6a6b38d6e50c60a61bb047718114fabe3dad88
/main/views.py
18495a384ad663e7f63d4236e2c79116cc6670e0
[]
no_license
marexv/kodiRecommenderDemo
8e2df390810bd56961b810b2ce666daa7c97a56a
52363fee2ca3a7a69b5bd8bf399a6a05dd85da69
refs/heads/master
2021-04-12T01:52:13.391900
2018-04-15T18:50:42
2018-04-15T18:50:42
125,814,634
0
0
null
null
null
null
UTF-8
Python
false
false
2,269
py
import json from django.http import HttpResponse from django.shortcuts import render from main.models import Movie from main.forms import movieForm from main.graph_as_dict import get_recommendations # Create your views here. def autocomplete(request): """Function for autocompleting search form.""" data = request.GET term = data.get("term") if term: movies = Movie.objects.filter(title__icontains=term) else: movies = Movie.objects.all() results = [] for movie in movies: movies_json = {} movies_json['id'] = movie.movie_id movies_json['label'] = movie.title movies_json['value'] = movie.title results.append(movies_json) data = json.dumps(results) mimetype = 'application/json' return HttpResponse(data, mimetype) def index(request): if request.method == 'POST': form = movieForm(request.POST) if form.is_valid(): title = form.cleaned_data['title'] form = movieForm() if Movie.objects.filter(title=title).exists(): movie = Movie.objects.filter(title=title)[0] # Chanege Algorithms here: recommendations = get_recommendations(movie) return render( request, "main/index.html", {"form":form, "status": "Here are your recommendations,", "explanation": "Why soo basic :/ ?", "anchor" : "recommender", "recommendations":recommendations}) else: return render(request, "main/index.html", {"form": form, "status": "Movie not found", "anchor" : "page-top", "recommendations": None}) else: print("form is not valid") else: form = movieForm() return render( request, 'main/index.html', {"form": form, "status": None, "anchor" : "page-top", "recommendations": None})
b9d235139763b0caf8b97d85cbbb806f13bf35d3
4e37f4d13cdb57e2821960bca8d41a02bbfbdafa
/src/backend/base/authentication.py
03ac7b13d7361072a9147a51bf75266dd69f8d48
[]
no_license
PranayMohan1/pustak-back
996475494125d1dceb493e2979db41d0ebd4903b
9fb742d1122e974af873d555c4066762fe8f8a96
refs/heads/main
2023-03-18T05:29:20.916915
2021-01-05T07:55:14
2021-01-05T07:55:14
326,926,106
0
0
null
null
null
null
UTF-8
Python
false
false
190
py
from rest_framework.authentication import TokenAuthentication from ..accounts.models import AuthTokenModel class SportTokenAuthentication(TokenAuthentication): model = AuthTokenModel
6d94d35803c6000f6e08ea10fd49958495575880
3b9ce3dbe01de365b3525f155f7ba115a3c7ca92
/streetview/.svn/text-base/settings-dove.py.svn-base
c773f01a5b27c931b7508f57ef2b0248ea3c8398
[]
no_license
smooney27/CANVAS
d3743991e35db674cee0dfb03daf7724c612a7f5
d1e1cd699652dd40c18aa67a38269725395ec78f
refs/heads/master
2021-01-20T23:09:18.337784
2017-11-22T08:34:24
2017-11-22T08:34:24
101,840,483
0
0
null
null
null
null
UTF-8
Python
false
false
4,187
import os.path # Django settings for streetview project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'beh', # Or path to database file if using sqlite3. 'USER': 'sjm2186', # Not used with sqlite3. 'PASSWORD': 'beh', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # On Unix systems, a value of None will cause Django to use the same # timezone as the operating system. # If running in a Windows environment this must be set to the same as your # system time zone. TIME_ZONE = 'America/New_York' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). # Examples: "http://media.lawrence.com", "http://example.com/media/" MEDIA_URL = '' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". ADMIN_MEDIA_PREFIX = '/streetview/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = '0)c-o-c@__f)ns!w(5$#j!(35n10)2ona$(1o*etcyfa#k(tk!' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # 'streetview.middleware.ImpersonateMiddleware' ) TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.request", "django.contrib.messages.context_processors.messages" ) ROOT_URLCONF = 'streetview.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os.path.join(os.path.dirname(__file__), 'templates'), ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', # Uncomment the next line to enable the admin: 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'ratestreets', ) LOGIN_URL = '/streetview/accounts/login' LOGIN_REDIRECT_URL = '/' APP_BASE_URL = '' STATIC_DOC_ROOT = os.path.join(os.path.dirname(__file__), 'static') import logging logging.basicConfig( level = logging.DEBUG, format = '%(asctime)s %(levelname)s %(message)s', )
d04e9de9a1c3e8805f81d233500ea425bbc2a27d
55646e56d6bb31ae0913eb71879f49efdfaf904f
/scribbli/profiles/constants.py
1dc3127b96a3d1fc9dcffb567188491d639a6e3d
[]
no_license
jacobbridges/scribbli-mvp
2d8851aba018b54431af0eb8cb030d02d35f173f
c24f2f1a2a19480a6b5f69ffbcccf0269d156140
refs/heads/master
2023-02-22T11:37:12.239845
2021-06-17T04:10:30
2021-06-17T04:10:30
156,637,826
0
0
null
2023-02-15T20:18:03
2018-11-08T02:20:53
Python
UTF-8
Python
false
false
328
py
class RoleChoices(object): Guest = 0 User = 1 Moderator = 2 Admin = 3 @staticmethod def as_choices(): return ( (RoleChoices.Guest, "Guest"), (RoleChoices.User, "User"), (RoleChoices.Moderator, "Moderator"), (RoleChoices.Admin, "Admin"), )
dd575001b5eb0379c4912709aaf10eb08a098885
3a37b6ce2c1c481f6aded64b2d0c4421f7db1210
/hpc_bin/ncl_varlist
1e41532af22ee130e28cb123cfbc92cf31c13340
[]
no_license
dbreusch/pythonExamples
99c24dc1d28b8c3be3b4fadd30a05d8ae317b0c0
7b8c06208fefcadf918cb9517ac313535c4df010
refs/heads/master
2022-10-13T12:21:52.182752
2020-06-14T23:10:50
2020-06-14T23:10:50
265,911,840
0
0
null
null
null
null
UTF-8
Python
false
false
2,768
#!/usr/bin/env python # ncl_varlist: # take a ncl_filedump output and create a usable variable catalog from it # output file columns: # 1 - preferred short name: manually change to preferred name as desired # 2 - short name: for reference # 3 - long name: as the var exists in the source file # 4+ - var description # Note that the short and long names are the same for WRF but # different for ERA datasets. import pdb, sys, os, commands nargin = len(sys.argv) if nargin < 2: print "Syntax: ncl_varlist ifn [ofn]" print " ifn = input file name" print " ofn = output file name, defaults to ifn.out" sys.exit() ifn = sys.argv[1] if nargin < 3: ofn = ifn+".out" else: ofn = sys.argv[2] print "Output in "+ofn ifile = open( ifn, "r" ) data = ifile.readlines() ifile.close() ofile = open( ofn, "w" ) invar = 0 global_ds = 0 nlev = "" longname = "" #global_patt = "%-7s%-7s%-15s" global_patt = "%-15s%-15s%-15s" regional_patt = "%-20s%-20s%-20s" for index in range(len(data)): # if index < 12: # continue # if "variables:" in data[index]: # continue args = data[index].split() if len(args) == 0: continue # ERA-Interim if "g4_lat_" in args[0]: nlat = args[2] global_ds = 1 continue if "g4_lon_" in args[0]: nlon = args[2] global_ds = 1 continue if "lv_ISBL" in args[0]: nlev = args[2] global_ds = 1 continue # PWRF if ("west_east" in args[0]) and (not args[0].endswith("stag")): nlat = args[2] global_ds = 0 continue if ("south_north" in args[0]) and (not args[0].endswith("stag")): nlon = args[2] global_ds = 0 continue if ("bottom_top" in args[0]) and (not args[0].endswith("stag")): nlev = args[2] global_ds = 0 continue if ("float" in args[0]) or ("integer" in args[0]) or ("character" in args[0]): # pdb.set_trace() if invar == 1: # print short name twice to support changing default value later if global_ds == 1: opatt = global_patt else: opatt = regional_patt s = opatt % (sname, sname, varname) ofile.write( s+" " ) if len(longname) > 0: for nn in longname: ofile.write( nn+" " ) ofile.write( "\n" ) # print varname invar = 0 varname = args[1] if global_ds == 1: p = varname.split('_') if (not "lat" in varname) and (not "lon" in varname): sname = p[0] else: sname = p[1] else: sname = varname invar = 1 continue if ("description" in args[0]) or ("long_name" in args[0]): longname = args[2:] continue ofile.close() if global_ds == 1: print nlat+" Lat x "+nlon+" Lon" else: print nlat+" West-East x "+nlon+" South-North" if len(nlev)>0: print nlev+" Levels"
0019b031e7d6ea4b5ef94a7edb66ce0b397327aa
e289f23d5762fe60fa63b7326666a9bbeeeaba06
/pi.py
73b1d9094138ed3e39cb6596ccbd2c38b47031de
[]
no_license
banaabraham/personal_insight
cc1f426b3e07f788caa79d49a802021ce0bdce6d
603c9a194467905c5a0b956c953a5954556c8925
refs/heads/master
2021-01-23T16:04:52.665388
2017-09-07T09:58:07
2017-09-07T09:58:07
102,721,197
0
0
null
null
null
null
UTF-8
Python
false
false
1,892
py
import tweepy from watson_developer_cloud import PersonalityInsightsV2 as PersonalityInsights def analyze(handle): CONSUMER_KEY='' CONSUMER_SECRET='' OAUTH_TOKEN='' OAUTH_TOKEN_SECRET='' auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(OAUTH_TOKEN, OAUTH_TOKEN_SECRET) api = tweepy.API(auth) print (api) statuses = api.user_timeline(screen_name = handle, count=100) text = "" for status in statuses: text += (status._json)['text'] #ibm bluemix personal insight credentials pi_username = '' pi_password = '' personality_insights = PersonalityInsights(username=pi_username, password=pi_password) pi_result = personality_insights.profile(text) return pi_result def flatten(orig): data = {} for c in orig['tree']['children']: if 'children' in c: for c2 in c['children']: if 'children' in c2: for c3 in c2['children']: if 'children' in c3: for c4 in c3['children']: if (c4['category'] == 'personality'): data[c4['id']] = c4['percentage'] if 'children' not in c3: if (c3['category'] == 'personality'): data[c3['id']] = c3['percentage'] return data def compare(dict1, dict2): compared_data = {} for keys in dict1: if dict1[keys] != dict2[keys]: compared_data[keys]=abs(dict1[keys] - dict2[keys]) return compared_data user_handle= '@codeacademy' user_result = analyze(user_handle) user = flatten(user_result) print("user: %s" %(user_handle)) for k in user.keys(): print ("%s -> %f" %(k,user[k]*100))
8d2b3d6ccb85c1f38dea9e5a9999d0743003224d
652a407eda737fc5694f668544b614a816573b22
/Python/baseline_solution.py
5dbf9be547606b18a8f5ddd15f1582277735ef81
[]
no_license
akshaymehra24/who-is-more-influential
3e9ad6be76d6036d8c95085bdd19df1425686256
5d2db5280882cb2af0183b93d2d66dfe02d7f332
refs/heads/master
2021-01-11T07:54:23.656000
2016-12-06T01:04:19
2016-12-06T01:04:19
72,068,871
2
1
null
2016-12-06T01:04:21
2016-10-27T03:48:29
Python
UTF-8
Python
false
false
3,289
py
#!/usr/bin/python # -*- coding: utf8 -*- # SAMPLE SUBMISSION TO THE BIG DATA HACKATHON 13-14 April 2013 'Influencers in a Social Network' # .... more info on Kaggle and links to go here # # written by Ferenc Huszár, PeerIndex from os.path import join from sklearn import linear_model # from sklearn.metrics import roc_auc_score import numpy as np ########################### # LOADING TRAINING DATA ########################### DATA_DIR = 'C:/Users/Patrick/PycharmProjects/who-is-more-influential/Original Dataset' OUTPUT_DIR = 'C:/Users/Patrick/PycharmProjects/who-is-more-influential/Python' trainfile = open(join(DATA_DIR, 'train.csv')) header = trainfile.next().rstrip().split(',') y_train = [] X_train_A = [] X_train_B = [] for line in trainfile: splitted = line.rstrip().split(',') label = int(splitted[0]) A_features = [float(item) for item in splitted[1:12]] B_features = [float(item) for item in splitted[12:]] y_train.append(label) X_train_A.append(A_features) X_train_B.append(B_features) trainfile.close() y_train = np.array(y_train) X_train_A = np.array(X_train_A) X_train_B = np.array(X_train_B) ########################### # EXAMPLE BASELINE SOLUTION USING SCIKIT-LEARN # # using scikit-learn LogisticRegression module without fitting intercept # to make it more interesting instead of using the raw features we transform them logarithmically # the input to the classifier will be the difference between transformed features of A and B # the method roughly follows this procedure, except that we already start with pairwise data # http://fseoane.net/blog/2012/learning-to-rank-with-scikit-learn-the-pairwise-transform/ ########################### def transform_features(x): return np.log(1+x) X_train = transform_features(X_train_A) - transform_features(X_train_B) model = linear_model.LogisticRegression(fit_intercept=False) model.fit(X_train, y_train) # compute AuC score on the training data (BTW this is kind of useless due to overfitting, but hey, this is only an example solution) p_train = model.predict_proba(X_train) p_train = p_train[:,1:2] # print 'AuC score on training data:', roc_auc_score(y_train, p_train.T) ########################### # READING TEST DATA ########################### testfile = open(join(DATA_DIR, 'test.csv')) #ignore the test header testfile.next() X_test_A = [] X_test_B = [] for line in testfile: splitted = line.rstrip().split(',') A_features = [float(item) for item in splitted[0:11]] B_features = [float(item) for item in splitted[11:]] X_test_A.append(A_features) X_test_B.append(B_features) testfile.close() X_test_A = np.array(X_test_A) X_test_B = np.array(X_test_B) # transform features in the same way as for training to ensure consistency X_test = transform_features(X_test_A) - transform_features(X_test_B) # compute probabilistic predictions p_test = model.predict_proba(X_test) #only need the probability of the 1 class p_test = p_test[:,1:2] ########################### # WRITING SUBMISSION FILE ########################### predfile = open(join(OUTPUT_DIR, 'predictions.csv'), 'w+') print >> predfile, ','.join(['Id', 'Choice']) row_id = 1 for line in p_test: print >> predfile, ','.join([str(row_id), str(line[0])]) row_id += 1 predfile.close()
2bfe0ce34f0883cb0a19b9e1ddc4a134e88153f8
bbea9b1f64284c9ca95d9f72f35e06aa39522c67
/Scripts/plot_MS-FIGURE_4b_v2.py
179017277abe54d6e9bf27d6a766bc9dfc223aaa
[ "MIT" ]
permissive
zmlabe/ModelBiasesANN
1e70c150bd8897fa5fb822daf8ffad0ee581c5f1
cece4a4b01ca1950f73c4d23fb379458778c221e
refs/heads/main
2023-05-23T06:05:23.826345
2022-07-22T18:36:27
2022-07-22T18:36:27
339,145,668
7
0
null
null
null
null
UTF-8
Python
false
false
4,625
py
""" Script to plot figure 4b Author : Zachary M. Labe Date : 12 July 2021 Version : 2 """ ### Import packages import sys import matplotlib.pyplot as plt import matplotlib.colors as c import numpy as np import palettable.cubehelix as cm import palettable.scientific.sequential as sss import palettable.cartocolors.qualitative as cc import cmocean as cmocean import cmasher as cmr import calc_Utilities as UT import scipy.stats as sts ### Plotting defaults plt.rc('text',usetex=True) plt.rc('font',**{'family':'sans-serif','sans-serif':['Avant Garde']}) ### Set parameters directorydata = '/Users/zlabe/Documents/Research/ModelComparison/Data/MSFigures_v2/' directoryfigure = '/Users/zlabe/Desktop/ModelComparison_v1/MSFigures_v2/' variablesall = ['T2M'] yearsall = np.arange(1950,2019+1,1) allDataLabels = ['CanESM2','MPI','CSIRO-MK3.6','EC-EARTH','GFDL-CM3','GFDL-ESM2M','LENS','MM-Mean'] letters = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"] ### Read in frequency data globef = np.load(directorydata + 'CountingIterations_%s.npz' % ('SMILEGlobe')) arcticf = np.load(directorydata + 'CountingIterations_%s.npz' % ('LowerArctic')) gmeanff = globef['mmean'] ggfdlff = globef['gfdlcm'] ameanff = arcticf['mmean'] agfdlff = arcticf['gfdlcm'] ############################################################################### ############################################################################### ############################################################################### def adjust_spines(ax, spines): for loc, spine in ax.spines.items(): if loc in spines: spine.set_position(('outward', 5)) else: spine.set_color('none') if 'left' in spines: ax.yaxis.set_ticks_position('left') else: ax.yaxis.set_ticks([]) if 'bottom' in spines: ax.xaxis.set_ticks_position('bottom') else: ax.xaxis.set_ticks([]) ### Begin plot fig = plt.figure(figsize=(8,6)) ax = plt.subplot(211) adjust_spines(ax, ['left', 'bottom']) ax.spines['top'].set_color('none') ax.spines['right'].set_color('none') ax.spines['left'].set_color('dimgrey') ax.spines['bottom'].set_color('dimgrey') ax.spines['left'].set_linewidth(2) ax.spines['bottom'].set_linewidth(2) ax.tick_params('both',length=4,width=2,which='major',color='dimgrey') ax.yaxis.grid(zorder=1,color='darkgrey',alpha=0.35,clip_on=False,linewidth=0.5) x=np.arange(1950,2019+1,1) plt.plot(yearsall,gmeanff,linewidth=5,color='k',alpha=1,zorder=3,clip_on=False) plt.yticks(np.arange(0,101,10),map(str,np.round(np.arange(0,101,10),2)),size=9) plt.xticks(np.arange(1950,2030+1,10),map(str,np.arange(1950,2030+1,10)),size=9) plt.xlim([1950,2020]) plt.ylim([0,100]) plt.text(1949,104,r'\textbf{[a]}',color='dimgrey', fontsize=7,ha='center') plt.text(2022,50,r'\textbf{GLOBAL}',color='dimgrey',fontsize=25,rotation=270, ha='center',va='center') plt.ylabel(r'\textbf{Frequency of Label}',color='k',fontsize=10) ############################################################################### ax = plt.subplot(212) adjust_spines(ax, ['left', 'bottom']) ax.spines['top'].set_color('none') ax.spines['right'].set_color('none') ax.spines['left'].set_color('dimgrey') ax.spines['bottom'].set_color('dimgrey') ax.spines['left'].set_linewidth(2) ax.spines['bottom'].set_linewidth(2) ax.tick_params('both',length=4,width=2,which='major',color='dimgrey') ax.yaxis.grid(zorder=1,color='darkgrey',alpha=0.35,clip_on=False,linewidth=0.5) x=np.arange(1950,2019+1,1) plt.plot(yearsall,ameanff,linewidth=5,color='k',alpha=1,zorder=3,clip_on=False,label=r'\textbf{MM-Mean}') plt.plot(yearsall,agfdlff,linewidth=4,color=plt.cm.CMRmap(0.6),alpha=1,zorder=3,clip_on=False,label=r'\textbf{GFDL-CM3}', linestyle='--',dashes=(1,0.3)) plt.yticks(np.arange(0,101,10),map(str,np.round(np.arange(0,101,10),2)),size=9) plt.xticks(np.arange(1950,2030+1,10),map(str,np.arange(1950,2030+1,10)),size=9) plt.xlim([1950,2020]) plt.ylim([0,100]) plt.text(1949,104,r'\textbf{[b]}',color='dimgrey', fontsize=7,ha='center') leg = plt.legend(shadow=False,fontsize=11,loc='upper center', bbox_to_anchor=(0.5,1.22),fancybox=True,ncol=4,frameon=False, handlelength=5,handletextpad=1) plt.ylabel(r'\textbf{Frequency of Label}',color='k',fontsize=10) plt.text(2022,50,r'\textbf{ARCTIC}',color='dimgrey',fontsize=25,rotation=270, ha='center',va='center') plt.tight_layout() plt.subplots_adjust(hspace=0.4) plt.savefig(directoryfigure + 'MS-Figure_4b_v2_Poster.png',dpi=1000)
9dc5656c44d68a159c40f4f8ba7a718cfc88e307
e40d4c4996dc26f9c52be95182bbe97041916959
/crawl_product_data/crawl_product_data/spiders/shopee_spider_2.py
07e11b749c5142e34de805420d6821cad78bb3a1
[]
no_license
dukeantt/crawl-ecommerce-site
18a5cd7b19682b0ac5c4415d1badf8ad3ec2e131
9fdd884aae57d51ffdc98bcb7df5c7b560c7909c
refs/heads/master
2021-05-19T05:05:24.914852
2020-06-15T03:08:49
2020-06-15T03:08:49
251,539,743
0
0
null
null
null
null
UTF-8
Python
false
false
4,258
py
# -*- coding: utf-8 -*- import logging import scrapy import json from datetime import date class ShopeeItemSpider(scrapy.Spider): name = 'shopee-item' allowed_domains = ['shopee.vn'] cat_api = 'https://shopee.vn/api/v2/search_items/?by=relevancy&keyword={}' \ '%C5%A9i&limit=50&match_id=8851&newest={}&order=desc&page_type=search&version=2 ' item_api = "https://shopee.vn/api/v2/item/get?itemid={}&shopid={}" shop_api = "https://shopee.vn/api/v2/shop/get?shopid={}" item_url = "https://shopee.vn/product/{}/{}" search_text = "Xe đẩy, nôi cũi" item_limit = 50 cat_id = 1979 start_id = 0 max_retry_empty_list = 3 item_topic = 'shopee_items_raw' review_topic = 'shopee_reviews_raw' @classmethod def from_crawler(cls, crawler, *args, **kwargs): return cls(item_topic=crawler.settings.get('SHOPEE_ITEMS_TOPIC'), review_topic=crawler.settings.get('SHOPEE_REVIEWS_TOPIC'), crawler=crawler, *args, **kwargs) def __init__(self, item_topic, review_topic, *args, **kwargs): self.item_topic = item_topic self.review_topic = review_topic super(ShopeeItemSpider, self).__init__(*args, **kwargs) def start_requests(self): url = self.cat_api.format(self.search_text, self.start_id) yield scrapy.Request(url, callback=self.parse_item_list, cb_kwargs={'first_id': self.start_id, 'retry': 0}) def parse_item_list(self, response, first_id, retry): jsonresponse = json.loads(response.text) item_list = jsonresponse.get('items', []) # for item in item_list: if item_list: for idx, item in enumerate(item_list): itemid, shopid = item['itemid'], item['shopid'] api_url = self.item_api.format(itemid, shopid) yield scrapy.Request(api_url, callback=self.parse_item_api, cb_kwargs={'itemid': itemid, 'shopid': shopid}) if first_id < 5000: offset = first_id + self.item_limit url = self.cat_api.format(self.search_text, offset) if not item_list: retry += 1 yield scrapy.Request(url, callback=self.parse_item_list, cb_kwargs={'first_id': offset, 'retry': retry}) def parse_item_api(self, response, itemid, shopid): api_response = json.loads(response.text) if not 'item' in api_response \ or not api_response['item'] \ or not api_response['item']['price']: logging.warning("Potentially banned!!! Response: %s", response.text) url = self.item_url.format(shopid, itemid) item = api_response['item'] name = item['name'] name = name.replace("🌟", "") name = name.replace("\"", "") price = str(item['price'] / 100000) item_id = itemid shop_api_url = self.shop_api.format(shopid) yield scrapy.Request(shop_api_url, callback=self.parse_shop_api, cb_kwargs={'prod_name': name, 'price': price, 'item_id': item_id, 'product_url': url}) def parse_shop_api(self, response, prod_name, price, item_id, product_url): api_response = json.loads(response.text) shop_data = api_response['data'] shop_id = shop_data['shopid'] shop_url = "" shop_owner = "" shop_name = "" if "username" in shop_data['account']: shop_owner = shop_data['account']['username'] shop_url = "https://shopee.vn/" + shop_owner if "name" in shop_data: shop_name = shop_data['name'] today = date.today() yield { 'product_id': item_id, 'product_url': product_url, 'name': prod_name, 'price': price, 'shop_id': shop_id, 'shop_url': shop_url, 'shop_name': shop_name, 'shop_owner': shop_owner, 'date': today, }
94f2e5f2a0f4bd54fc15ad8cbf7272cf787b7ddc
be98229ba927965c411987d5a5efa7712c81e97d
/tests/majority_class_label.py
9d0b5c99e49ff6fab3167e3a376f3df2716ab6ae
[]
no_license
nlp-course-test/lab1-2
ef9f4aa13dc9d7d4ca01c22cb77161b1814b6166
decf65d1084c33cb6d6af0f4b63e0ea30cad878a
refs/heads/master
2022-12-10T19:01:59.062856
2020-09-07T21:32:22
2020-09-07T21:32:22
293,636,582
0
0
null
null
null
null
UTF-8
Python
false
false
144
py
test = {'name': 'majority_class_label', 'points': 1, 'suites': [{'cases': [], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
df29ce0065bc8879edf1477b027727bb68956cf3
8bfeed4026eb1faa92ba5ffc4f2f83d1285ade9a
/wineomas/urls.py
34c1ee2d1cacbad40abf11a2fcff3d484163a9ce
[]
no_license
ugochukwu2017/wineomas
ab4b66738c3ca9bf98a7f8b56c8558f3c9bdcefb
e0e759bd0629dc210abfb4a05d3bc00b5779c10d
refs/heads/master
2020-12-30T09:58:19.353412
2017-08-05T23:24:02
2017-08-05T23:24:02
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,068
py
"""wineomas URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url,include from django.contrib import admin from . import views urlpatterns = [ url(r'^reviews/', include('reviews.urls', namespace="reviews")), url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('registration.backends.simple.urls')), url('^accounts/', include('django.contrib.auth.urls', namespace="auth")), url(r'^$',views.hello_world,name='welcome'), ]
87934c23053f09c259a1ce2e6270ea821fc90da6
520baeba0e86b0bab3c5590f40b868ca4306dc7e
/hazelcast/protocol/codec/count_down_latch_get_count_codec.py
345de04de3a44161676bfb0d96b360bac2e606ad
[ "Apache-2.0" ]
permissive
mustafaiman/hazelcast-python-client
69f27367162045bbfa4e66e7adadcfd254dfab21
85f29f975c91520075d0461327e38ab93c2e78c2
refs/heads/master
2021-01-18T04:23:10.740371
2015-12-11T14:26:06
2015-12-11T14:26:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,038
py
from hazelcast.serialization.data import * from hazelcast.serialization.bits import * from hazelcast.protocol.client_message import ClientMessage from hazelcast.protocol.custom_codec import * from hazelcast.protocol.codec.count_down_latch_message_type import * REQUEST_TYPE = COUNTDOWNLATCH_GETCOUNT RESPONSE_TYPE = 102 RETRYABLE = True def calculate_size(name): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) return data_size def encode_request(name): """ Encode request into client_message""" client_message = ClientMessage(payload_size=calculate_size(name)) client_message.set_message_type(REQUEST_TYPE) client_message.set_retryable(RETRYABLE) client_message.append_str(name) client_message.update_frame_length() return client_message def decode_response(client_message): """ Decode response from client message""" parameters = dict(response=None) parameters['response'] = client_message.read_int() return parameters
6db9b78246aef370efc8ef609a33b1dadab124a8
53e58c213232e02250e64f48b97403ca86cd02f9
/18/mc/ExoDiBosonResonances/EDBRTreeMaker/test/crab3_analysisM4500_R_0-7.py
fc7eba74e67b0348603262470fab519845902f68
[]
no_license
xdlyu/fullRunII_ntuple_102X
32e79c3bbc704cfaa00c67ab5124d40627fdacaf
d420b83eb9626a8ff1c79af5d34779cb805d57d8
refs/heads/master
2020-12-23T15:39:35.938678
2020-05-01T14:41:38
2020-05-01T14:41:38
237,192,426
0
2
null
null
null
null
UTF-8
Python
false
false
2,160
py
from WMCore.Configuration import Configuration name = 'WWW' steam_dir = 'xulyu' config = Configuration() config.section_("General") config.General.requestName = 'M4500_R0-7_off' config.General.transferLogs = True config.section_("JobType") config.JobType.pluginName = 'Analysis' config.JobType.inputFiles = ['Autumn18_V19_MC_L1FastJet_AK4PFchs.txt','Autumn18_V19_MC_L2Relative_AK4PFchs.txt','Autumn18_V19_MC_L3Absolute_AK4PFchs.txt','Autumn18_V19_MC_L1FastJet_AK8PFchs.txt','Autumn18_V19_MC_L2Relative_AK8PFchs.txt','Autumn18_V19_MC_L3Absolute_AK8PFchs.txt','Autumn18_V19_MC_L1FastJet_AK8PFPuppi.txt','Autumn18_V19_MC_L2Relative_AK8PFPuppi.txt','Autumn18_V19_MC_L3Absolute_AK8PFPuppi.txt','Autumn18_V19_MC_L1FastJet_AK4PFPuppi.txt','Autumn18_V19_MC_L2Relative_AK4PFPuppi.txt','Autumn18_V19_MC_L3Absolute_AK4PFPuppi.txt'] #config.JobType.inputFiles = ['PHYS14_25_V2_All_L1FastJet_AK4PFchs.txt','PHYS14_25_V2_All_L2Relative_AK4PFchs.txt','PHYS14_25_V2_All_L3Absolute_AK4PFchs.txt','PHYS14_25_V2_All_L1FastJet_AK8PFchs.txt','PHYS14_25_V2_All_L2Relative_AK8PFchs.txt','PHYS14_25_V2_All_L3Absolute_AK8PFchs.txt'] # Name of the CMSSW configuration file #config.JobType.psetName = 'bkg_ana.py' config.JobType.psetName = 'analysis_sig.py' #config.JobType.allowUndistributedCMSSW = True config.JobType.allowUndistributedCMSSW = True config.section_("Data") #config.Data.inputDataset = '/WJetsToLNu_13TeV-madgraph-pythia8-tauola/Phys14DR-PU20bx25_PHYS14_25_V1-v1/MINIAODSIM' config.Data.inputDataset = '/WkkToWRadionToWWW_M4500-R0-7_TuneCP5_13TeV-madgraph/RunIIAutumn18MiniAOD-102X_upgrade2018_realistic_v15-v1/MINIAODSIM' #config.Data.inputDBS = 'global' config.Data.inputDBS = 'global' config.Data.splitting = 'FileBased' config.Data.unitsPerJob =20 config.Data.totalUnits = -1 config.Data.publication = False config.Data.outLFNDirBase = '/store/group/dpg_trigger/comm_trigger/TriggerStudiesGroup/STEAM/' + steam_dir + '/' + name + '/' # This string is used to construct the output dataset name config.Data.outputDatasetTag = 'M4500_R0-7_off' config.section_("Site") # Where the output files will be transmitted to config.Site.storageSite = 'T2_CH_CERN'
c9094676d71491d916b51175c368a27754374bc2
1ede7746b648d08ac7666a1b2659fe829e9a182a
/LTPC1-2020-2/Pratica08/pograma07.py
5cb06ca749c029fef13aeeebf50815362261d4a4
[]
no_license
Kurt-Cobai/FATEC-MECATRONICA-1600792021035-KURT
de8fe0216d34268eb2b43b9879529f8d45546335
e1e21be84941479007069a3032be30fc46a6ceac
refs/heads/master
2023-01-19T11:45:40.161176
2020-12-04T00:52:10
2020-12-04T00:52:10
293,789,856
0
0
null
null
null
null
UTF-8
Python
false
false
453
py
preco = input ( "Informe um preço:" ) posicao = 0 posicao_da_virgula = - 1 enquanto posicao < len ( preco ): if preco [ posicao ] == ',' : posicao_da_virgula = posicao posicao = posicao + 1 se posicao_da_virgula == - 1 : imprimir ( "O valor redes" , preco , "reais" ) mais : print ( "O valor prestado foi de" , preco [: posicao_da_virgula ], "reais" ) print ( "com" , preco [ posicao_da_virgula + 1 :], "centavos" )
002d679d51e628b968db319430289a8f91c8f629
71d757af0de13c7f4a0fa39578c3abea3451372b
/network/mar6.py
767bf1068852aae7055a94f78967350e5932090a
[]
no_license
bh0085/compbio
039421d04317ae878f222d6448144be88aa95f69
95bc24ea34346ff4b9a120e317d08518277f268c
refs/heads/master
2021-03-12T19:57:22.421467
2013-02-05T16:45:37
2013-02-05T16:45:37
947,034
0
0
null
null
null
null
UTF-8
Python
false
false
1,293
py
import compbio.network.netutils as nu import numpy as np trgs, tfs = nu.parse_net() gname = 'FBgn0036754' tg = trgs[gname] weights = tg['weights'] wsort = np.argsort(weights) tf_sel = [tg['tfs'][i] for i in wsort[:8]] orders = [[1,5], [1,6], [7,0], 0,2,3,4,5] for o in orders[0:3]: ctfs = [tf_sel[i] for i in o] tg_intersection = [ tg for tg in tfs[ctfs[0]]['targets'] if tg in tfs[ctfs[1]]['targets']] tg_union = [tfs[ctfs[0]]['targets'] ] tg_union = tg_union + [ tg for tg in tfs[ctfs[1]]['targets'] if not tg in tg_union] print float(len(tg_intersection)) / float(len(tg_union)) o2 = [[[i,j] for i in range(8) if not i == j] for j in range(8)] o2prime = [] for o in o2: o2prime.extend(o) o2 = o2prime similarities = [] for o in o2: ctfs = [tf_sel[i] for i in o] tg_intersection = [ tg for tg in tfs[ctfs[0]]['targets'] if tg in tfs[ctfs[1]]['targets']] tg_union = [tfs[ctfs[0]]['targets'] ] tg_union = tg_union + [ tg for tg in tfs[ctfs[1]]['targets'] if not tg in tg_union] similarities.append(float(len(tg_intersection)) / float(len(tg_union))) mean_sim = np.mean(np.array(similarities)) print mean_sim print len(tfs) print tf_sel
2c5fb7e7df1692ef206b0c450637079eaf951da3
1682f1d59d678f5cb210dd03d191cc7ad0b71ce3
/apps/challenge/migrations/0016_auto_20200210_1801.py
baf9c004a845ed9480ac9a5dc4c714e32dddded8
[]
no_license
SharifAIChallenge/AIC20-Backend
8ee05614696313bf981162a91deb164d5e2a7b2a
d813f5a43b2d788874d2daac399d9e4bab6dc02e
refs/heads/master
2022-12-11T07:25:59.440091
2020-03-14T17:23:56
2020-03-14T17:23:56
234,036,763
10
1
null
2022-12-08T03:26:45
2020-01-15T08:42:08
Python
UTF-8
Python
false
false
540
py
# Generated by Django 2.2.9 on 2020-02-10 18:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('challenge', '0015_auto_20200202_1552'), ] operations = [ migrations.RenameField( model_name='tournament', old_name='end_time', new_name='submit_deadline', ), migrations.AlterField( model_name='tournament', name='start_time', field=models.DateTimeField(), ), ]
3393a8d836b455d0cb754edb1ec870771dbee269
c4544c22c0618451746795090e07c80bc85a0877
/static_demo/static_demo/urls.py
9928d4f92b406cd67d5c5cef03defa2f295f2c2a
[]
no_license
RelaxedDong/Django_course
35f7027dc552ad148d2dc8679a19a1ffb12b8d14
2965089d15e4c80cd6402d362ee37f8cc675c08b
refs/heads/master
2022-01-09T14:28:40.503099
2019-05-24T07:07:03
2019-05-24T07:07:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
981
py
"""static_demo URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from book import views #导入配置 from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('',views.index) ] + static(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS[0])
4e49c89e0fbdb98a60acc97a9cf18de3fbf8f51d
0b796d8977b5fdee276078ef9d4c6784476bc441
/hw4/p4.py
bd7d3d63f0670fc6c7489ac880e5557241b68d78
[]
no_license
JohnnyBarber/Mathematical-Modeling
f372b6f67ef6a5f4a6867dd07d9a55c3114a8e19
3cb5e60f9c5d5765b6d48138ca3ae53001f065a8
refs/heads/master
2020-04-27T19:34:17.009168
2019-03-08T23:21:36
2019-03-08T23:21:36
174,624,367
0
0
null
null
null
null
UTF-8
Python
false
false
1,886
py
# -*- coding: utf-8 -*- """ Created on Wed Mar 7 16:08:27 2018 @author: Jiaqi Li """ #!/usr/bin/python from pylab import * import csv from scipy.stats import norm as gaussian from scipy.optimize import fmin def main(): height = loadtxt('p4 data.txt', delimiter=',') x = height[:,0] y = height[:,1] m = height.shape[0] z = [] for i in range(m): z += [x[i]]*int(y[i]) n = len(z) z = array(z) # slow, inaccurate method def fit_likelihood(a): return -sum(log(gaussian.pdf((z-a[0])/a[1])/a[1])) objective = fit_likelihood a = [64.,6.] result = fmin(objective, a) mu, sigma = result[0], result[1] print( "Numerical Parameter fits: ", (mu, sigma)) print( "\tAverage Log-Likelihood: ", fit_likelihood(result)/n) # fast, exact method mu = sum(z)/float(n) sigma = sqrt(sum((z-mu)**2)/n) print( "Exact Parameter fits: ", (mu,sigma)) print( "\tAverage Log-Likelihood: ", fit_likelihood((mu,sigma))/n) print( "\tn = : ", fit_likelihood((mu,sigma))/n) u = linspace(min(z)*.95,max(z)*1.05, 256) figure(1, figsize=(8,16)) subplot(3,1,1) plot(u, n*gaussian.pdf((u-mu)/sigma)/sigma, 'b-') width = .3 bar_ob = bar(x-width*.5, y, width, color='k') xlim(min(u), max(u)) ylabel('Count', fontsize=18) title('Best Fit Gaussian: $\mu = %f$, $\sigma = %f$'%(mu,sigma), fontsize=18) subplot(3,1,2) q = linspace(0,1,n) plot(z,q,'ko', u, gaussian.cdf((u-mu)/sigma),'b-') xlabel('Height (inches)', fontsize=18) ylabel('Cumulative Probability', fontsize=18) xlim(min(u), max(u)) subplot(3,1,3) plot(gaussian.cdf((z-mu)/sigma), q, 'o', q, q, 'k-') xlabel('Expected probability', fontsize=18) ylabel('Observed probability', fontsize=18) savefig('height_gaussian.png', bbox_inches='tight') show() main() k = [1] k*2
4f2c670e47574d434ef9fe7b5dad37d66659a9e9
3f1ff6db6cda96264517484ed7b54bf3e95584cb
/loop.py
4f3b5a47ba5dcdae8fa7013dc0c296394585eb27
[]
no_license
kartikeysingh1311/guvi
187eb69288498bc301f4f70c5dbcee8c67c0a4f4
00eb938fe98746ad281ae95a39ca618d3e540abb
refs/heads/master
2020-04-01T23:47:17.381914
2018-10-21T05:22:51
2018-10-21T05:22:51
153,773,236
0
0
null
null
null
null
UTF-8
Python
false
false
56
py
x=int(input()) for i in range(x): print("Hello")
d17d03b122098ab613344e4b358eed9ab77ba30c
87827abfa180096cc316bb99a26a09947b1f8758
/mozbadges/site/helpers.py
5333ffe39dca3bc9b7be04e04ac651324a198e08
[ "BSD-3-Clause" ]
permissive
adamlofting/mozilla-badges
65e6c4e5be0c0bcc5c943229ea2705e8dec9d666
d6c54e830edb08ee6df3dc5190be1408c4797286
refs/heads/master
2020-04-08T22:07:29.269596
2014-07-29T14:52:55
2014-07-29T14:52:55
null
0
0
null
null
null
null
UTF-8
Python
false
false
897
py
from jingo import register as jingo_register from django_browserid.helpers import browserid_button, browserid_info from mozbadges.compat import _lazy as _, reverse @jingo_register.function def persona_info(): # For consistency return browserid_info() @jingo_register.function def persona_login(text='Sign in', color=None, next='', link_class='browserid-login persona-button', attrs=None, fallback_href='#'): if color: if 'persona-button' not in link_class: link_class += ' persona-button {0}'.format(color) else: link_class += ' ' + color return browserid_button(_(text), next, link_class, attrs, fallback_href) @jingo_register.function def persona_logout(text='Sign out', next='', link_class='browserid-logout', attrs=None): return browserid_button(_(text), next, link_class, attrs, reverse('browserid.logout'))
1e215bc242fca5e9220e2fe7e015281cf4b594b5
f0858aae73097c49e995ff3526a91879354d1424
/nova/api/openstack/compute/contrib/hosts.py
9fbefd7309b945e6eb8b63e717634091b4a2e30f
[ "Apache-2.0" ]
permissive
bopopescu/nested_quota_final
7a13f7c95e9580909d91db83c46092148ba1403b
7c3454883de9f5368fa943924540eebe157a319d
refs/heads/master
2022-11-20T16:14:28.508150
2015-02-16T17:47:59
2015-02-16T17:47:59
282,100,691
0
0
Apache-2.0
2020-07-24T02:14:02
2020-07-24T02:14:02
null
UTF-8
Python
false
false
12,946
py
# Copyright (c) 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """The hosts admin extension.""" import webob.exc from nova.api.openstack import extensions from nova import compute from nova import exception from nova.i18n import _ from nova import objects from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) authorize = extensions.extension_authorizer('compute', 'hosts') class HostController(object): """The Hosts API controller for the OpenStack API.""" def __init__(self): self.api = compute.HostAPI() super(HostController, self).__init__() def index(self, req): """Returns a dict in the format: | {'hosts': [{'host_name': 'some.host.name', | 'service': 'cells', | 'zone': 'internal'}, | {'host_name': 'some.other.host.name', | 'service': 'cells', | 'zone': 'internal'}, | {'host_name': 'some.celly.host.name', | 'service': 'cells', | 'zone': 'internal'}, | {'host_name': 'console1.host.com', | 'service': 'consoleauth', | 'zone': 'internal'}, | {'host_name': 'network1.host.com', | 'service': 'network', | 'zone': 'internal'}, | {'host_name': 'netwwork2.host.com', | 'service': 'network', | 'zone': 'internal'}, | {'host_name': 'compute1.host.com', | 'service': 'compute', | 'zone': 'nova'}, | {'host_name': 'compute2.host.com', | 'service': 'compute', | 'zone': 'nova'}, | {'host_name': 'sched1.host.com', | 'service': 'scheduler', | 'zone': 'internal'}, | {'host_name': 'sched2.host.com', | 'service': 'scheduler', | 'zone': 'internal'}, | {'host_name': 'vol1.host.com', | 'service': 'volume', | 'zone': 'internal'}]} """ context = req.environ['nova.context'] authorize(context) filters = {'disabled': False} zone = req.GET.get('zone', None) if zone: filters['availability_zone'] = zone services = self.api.service_get_all(context, filters=filters, set_zones=True) hosts = [] for service in services: hosts.append({'host_name': service['host'], 'service': service['topic'], 'zone': service['availability_zone']}) return {'hosts': hosts} def update(self, req, id, body): """Updates a specified body. :param body: example format {'status': 'enable', 'maintenance_mode': 'enable'} """ def read_enabled(orig_val, msg): """Checks a specified orig_val and returns True for 'enabled' and False for 'disabled'. :param orig_val: A string with either 'enable' or 'disable'. May be surrounded by whitespace, and case doesn't matter :param msg: The message to be passed to HTTPBadRequest. A single %s will be replaced with orig_val. """ val = orig_val.strip().lower() if val == "enable": return True elif val == "disable": return False else: raise webob.exc.HTTPBadRequest(explanation=msg % orig_val) context = req.environ['nova.context'] authorize(context) # See what the user wants to 'update' params = {k.strip().lower(): v for k, v in body.iteritems()} orig_status = status = params.pop('status', None) orig_maint_mode = maint_mode = params.pop('maintenance_mode', None) # Validate the request if len(params) > 0: # Some extra param was passed. Fail. explanation = _("Invalid update setting: '%s'") % params.keys()[0] raise webob.exc.HTTPBadRequest(explanation=explanation) if orig_status is not None: status = read_enabled(orig_status, _("Invalid status: '%s'")) if orig_maint_mode is not None: maint_mode = read_enabled(orig_maint_mode, _("Invalid mode: '%s'")) if status is None and maint_mode is None: explanation = _("'status' or 'maintenance_mode' needed for " "host update") raise webob.exc.HTTPBadRequest(explanation=explanation) # Make the calls and merge the results result = {'host': id} if status is not None: result['status'] = self._set_enabled_status(context, id, status) if maint_mode is not None: result['maintenance_mode'] = self._set_host_maintenance(context, id, maint_mode) return result def _set_host_maintenance(self, context, host_name, mode=True): """Start/Stop host maintenance window. On start, it triggers guest VMs evacuation. """ LOG.audit(_("Putting host %(host_name)s in maintenance mode " "%(mode)s."), {'host_name': host_name, 'mode': mode}) try: result = self.api.set_host_maintenance(context, host_name, mode) except NotImplementedError: msg = _("Virt driver does not implement host maintenance mode.") raise webob.exc.HTTPNotImplemented(explanation=msg) except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) except exception.ComputeServiceUnavailable as e: raise webob.exc.HTTPBadRequest(explanation=e.format_message()) if result not in ("on_maintenance", "off_maintenance"): raise webob.exc.HTTPBadRequest(explanation=result) return result def _set_enabled_status(self, context, host_name, enabled): """Sets the specified host's ability to accept new instances. :param enabled: a boolean - if False no new VMs will be able to start on the host """ if enabled: LOG.audit(_("Enabling host %s.") % host_name) else: LOG.audit(_("Disabling host %s.") % host_name) try: result = self.api.set_host_enabled(context, host_name=host_name, enabled=enabled) except NotImplementedError: msg = _("Virt driver does not implement host disabled status.") raise webob.exc.HTTPNotImplemented(explanation=msg) except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) except exception.ComputeServiceUnavailable as e: raise webob.exc.HTTPBadRequest(explanation=e.format_message()) if result not in ("enabled", "disabled"): raise webob.exc.HTTPBadRequest(explanation=result) return result def _host_power_action(self, req, host_name, action): """Reboots, shuts down or powers up the host.""" context = req.environ['nova.context'] authorize(context) try: result = self.api.host_power_action(context, host_name=host_name, action=action) except NotImplementedError: msg = _("Virt driver does not implement host power management.") raise webob.exc.HTTPNotImplemented(explanation=msg) except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) except exception.ComputeServiceUnavailable as e: raise webob.exc.HTTPBadRequest(explanation=e.format_message()) return {"host": host_name, "power_action": result} def startup(self, req, id): return self._host_power_action(req, host_name=id, action="startup") def shutdown(self, req, id): return self._host_power_action(req, host_name=id, action="shutdown") def reboot(self, req, id): return self._host_power_action(req, host_name=id, action="reboot") @staticmethod def _get_total_resources(host_name, compute_node): return {'resource': {'host': host_name, 'project': '(total)', 'cpu': compute_node['vcpus'], 'memory_mb': compute_node['memory_mb'], 'disk_gb': compute_node['local_gb']}} @staticmethod def _get_used_now_resources(host_name, compute_node): return {'resource': {'host': host_name, 'project': '(used_now)', 'cpu': compute_node['vcpus_used'], 'memory_mb': compute_node['memory_mb_used'], 'disk_gb': compute_node['local_gb_used']}} @staticmethod def _get_resource_totals_from_instances(host_name, instances): cpu_sum = 0 mem_sum = 0 hdd_sum = 0 for instance in instances: cpu_sum += instance['vcpus'] mem_sum += instance['memory_mb'] hdd_sum += instance['root_gb'] + instance['ephemeral_gb'] return {'resource': {'host': host_name, 'project': '(used_max)', 'cpu': cpu_sum, 'memory_mb': mem_sum, 'disk_gb': hdd_sum}} @staticmethod def _get_resources_by_project(host_name, instances): # Getting usage resource per project project_map = {} for instance in instances: resource = project_map.setdefault(instance['project_id'], {'host': host_name, 'project': instance['project_id'], 'cpu': 0, 'memory_mb': 0, 'disk_gb': 0}) resource['cpu'] += instance['vcpus'] resource['memory_mb'] += instance['memory_mb'] resource['disk_gb'] += (instance['root_gb'] + instance['ephemeral_gb']) return project_map def show(self, req, id): """Shows the physical/usage resource given by hosts. :param id: hostname :returns: expected to use HostShowTemplate. ex.:: {'host': {'resource':D},..} D: {'host': 'hostname','project': 'admin', 'cpu': 1, 'memory_mb': 2048, 'disk_gb': 30} """ context = req.environ['nova.context'] host_name = id try: compute_node = ( objects.ComputeNode.get_first_node_by_host_for_old_compat( context, host_name)) except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e.format_message()) except exception.AdminRequired: msg = _("Describe-resource is admin only functionality") raise webob.exc.HTTPForbidden(explanation=msg) instances = self.api.instance_get_all_by_host(context, host_name) resources = [self._get_total_resources(host_name, compute_node)] resources.append(self._get_used_now_resources(host_name, compute_node)) resources.append(self._get_resource_totals_from_instances(host_name, instances)) by_proj_resources = self._get_resources_by_project(host_name, instances) for resource in by_proj_resources.itervalues(): resources.append({'resource': resource}) return {'host': resources} class Hosts(extensions.ExtensionDescriptor): """Admin-only host administration.""" name = "Hosts" alias = "os-hosts" namespace = "http://docs.openstack.org/compute/ext/hosts/api/v1.1" updated = "2011-06-29T00:00:00Z" def get_resources(self): resources = [extensions.ResourceExtension('os-hosts', HostController(), collection_actions={'update': 'PUT'}, member_actions={"startup": "GET", "shutdown": "GET", "reboot": "GET"})] return resources
d037f32ce137bd1213e2015c9ec0f59704e69b3b
1671cbf89e22d5fb12b9380ee8469dee98862275
/setup.py
c4f78b0da1d6f6752a31e1f97de46080a78947e9
[ "MIT" ]
permissive
VicenteAR/mloq-test
12315d2ab69fc8da492bbc3373728fa4e7c5ed56
38cab68bc5efe5c5f683e10ff30ef14fbed22ab7
refs/heads/master
2023-03-05T13:36:38.754448
2021-02-09T18:46:09
2021-02-09T18:46:09
337,502,085
0
0
null
null
null
null
UTF-8
Python
false
false
1,295
py
from importlib.machinery import SourceFileLoader from pathlib import Path from setuptools import find_packages, setup version = SourceFileLoader( "mloq_test.version", str(Path(__file__).parent / "mloq_test" / "version.py"), ).load_module() with open(Path(__file__).with_name("README.md"), encoding="utf-8") as f: long_description = f.read() setup( name="mloq_test", description="Creation of new project using mloq.", long_description=long_description, long_description_content_type="text/markdown", packages=find_packages(), version=version.__version__, license="MIT", author="Vicente Arjona Romano", author_email="", url="", keywords=["Machine learning", "artificial intelligence"], tests_require=["pytest>=5.3.5", "hypothesis>=5.6.0"], extras_require={}, install_requires=[], package_data={"": ["README.md"]}, classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: Other/Proprietary License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Topic :: Software Development :: Libraries", ], )
cdb462d8f9dd594cae3d7de86231e3ea41c070cc
b8c622e51bcffa2531cd13b59fc8d5490382cb2a
/relational_models/examples/urls.py
8a60bb573a8847298c97e32055039afe9d373a05
[]
no_license
anur/django_templates
630059568497c2f907089ecdeeca55dcb5f4c824
e55e7ae94062ffa930ec8b4559d0251e296e231d
refs/heads/master
2022-04-13T12:01:17.031406
2020-04-07T23:09:22
2020-04-07T23:09:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
125
py
from django.urls import path from . import views urlpatterns = [ path('', views.template_view, name="template_view"), ]
c0c0c40c4421b78fb74b7276471ce3e8d9e591d9
e876989dc598d6e1a48c2bcfdec1ab091cdc8e3d
/migrations/0001_initial.py
caf9f21d0a4286404cbbfabbe91b3dc09b12e816
[]
no_license
quanted/hwbi_app
dfb7541f143a6ec130b1728b4ca1968179eb757b
80b401eea49e42c29e1982f2fa6bf4593f33a169
refs/heads/dev
2021-01-12T03:32:52.629880
2020-02-17T15:00:16
2020-02-17T15:00:16
78,229,818
2
0
null
2020-04-03T13:37:32
2017-01-06T18:42:03
Python
UTF-8
Python
false
false
2,041
py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-29 20:13 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='BaselineScore', fields=[ ('county_FIPS', models.TextField(max_length=5, primary_key=True, serialize=False)), ('stateID', models.TextField(max_length=2)), ('state', models.TextField(max_length=20)), ('county', models.TextField(max_length=30)), ('serviceID', models.TextField(max_length=3)), ('serviceName', models.TextField(max_length=10)), ('description', models.TextField(max_length=50)), ('serviceType', models.TextField(max_length=15)), ('name', models.TextField(max_length=15)), ], options={ 'ordering': ('state', 'county', 'serviceID'), }, ), migrations.CreateModel( name='Domain', fields=[ ('domainID', models.TextField(max_length=10, primary_key=True, serialize=False)), ('domainName', models.TextField(max_length=25)), ('name', models.TextField(max_length=20)), ], ), migrations.CreateModel( name='Service', fields=[ ('serviceID', models.TextField(max_length=3, primary_key=True, serialize=False)), ('serviceTypeID', models.TextField(max_length=10)), ('serviceName', models.TextField(max_length=50)), ('serviceTypeName', models.TextField(max_length=10)), ('description', models.TextField(max_length=50)), ('name', models.TextField(max_length=50)), ], options={ 'ordering': ('serviceID', 'serviceName'), }, ), ]
21a86b46c8032fc41d1ddd1e1ebd07a990320841
a1372b7c523a1865d685809e3c5d887b108650a3
/f5lbaasdriver/test/tempest/plugin.py
2174a5bc842cf72392f0834f292f27a9607d5ed8
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
sapcc/f5-openstack-lbaasv2-driver
40effa342bea504c779eccd6828ae236b956c478
923f085dc71540a1399d439098081fe6cf2c82df
refs/heads/master
2021-01-11T21:01:07.544680
2019-10-23T06:20:10
2019-10-23T06:20:10
81,066,211
1
1
Apache-2.0
2019-10-23T06:20:11
2017-02-06T08:43:55
Python
UTF-8
Python
false
false
1,432
py
# Copyright 2015 # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os from tempest import config from tempest.test_discover import plugins from f5lbaasdriver.test.tempest import config as project_config class F5LBaaSv2DriverTempestPlugin(plugins.TempestPlugin): def load_tests(self): base_path = os.path.split(os.path.dirname( os.path.abspath(__file__)))[0] test_dir = "f5lbaasdriver/test/tempest/tests" full_test_dir = os.path.join(base_path, test_dir) return full_test_dir, base_path def register_opts(self, conf): config.register_opt_group(conf, project_config.f5_lbaasv2_driver_group, project_config.f5_lbaasv2_driver_opts) def get_opt_lists(self): return [(project_config.f5_lbaasv2_driver_group.name, project_config.f5_lbaasv2_driver_opts)]
c2636d7dbc2e6eae32c63003498b67df7c85ade0
ea7f859964ff0c06223b72cb9288522620c89409
/handle_blog/__init__.py
b33a2639e3e7de4499a5cdfc96d400090f036bf7
[]
no_license
mudou192/TornadoBlog
50c86ee25a50c1f165e6470aefcb7a773cfb50b3
fb709ad5b368377cf8fdc247e71d51a97062b9b5
refs/heads/master
2021-01-18T19:53:01.832829
2017-04-05T09:22:11
2017-04-05T09:22:11
86,919,046
0
0
null
null
null
null
UTF-8
Python
false
false
7,862
py
#coding=utf8 ''' Created on 2016-12-8 @author: xuwei @summary: 浏览页面 ''' import time,os,re,json from common.traceback_error import get_err_msg from common.config import Config from setting import BlogDataPath from setting import ImageDataPath from mysql_contate import MySQLHandler as MysqlHandler from common.basehandler import NoAuthHandler from common.basehandler import AuthHandler class CreateBlogHandler(AuthHandler): def do_something(self): try: flag = self.check_request_type('get') if not flag: raise Exception('Request type error') is_admin = self.check_admin() if not is_admin: raise Exception('No permission error') group_infos = MysqlHandler.select_group_info(is_admin) datetime = time.strftime("%Y-%m-%d %H:%M:%S") self.render('createBlog.html',datetime = datetime,Check = '0',Privacy = 0,Subject = '',Content = '',PostUrl = '/saveblog', GroupInfos = group_infos,IsAdmin = is_admin) except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.') class EditBlogHandler(AuthHandler): def get_url_values(self,urls): if len(urls) == 2: blogId = urls[1] else: raise Exception('Request url error') return blogId def get_file_content(self,FileName): filename = os.path.join(BlogDataPath,FileName) with open(filename,'rb') as fp: content = fp.read() return content def do_something(self): try: flag = self.check_request_type('get') if not flag: raise Exception('Request type error') is_admin = self.check_admin() if not is_admin: raise Exception('No permission error') urls = self.get_url_parts() BlogId = self.get_url_values(urls) info = MysqlHandler.select_blog_info(BlogId,is_admin) group_infos = MysqlHandler.select_group_info(is_admin) GroupCode = info[0] Subject = info[1] FileName = info[2] datetime = info[3] Privacy = info[5] if Privacy == 0: Privacy = False PostUrl = '/uploadblog?blogId=%s&filename=%s'%(BlogId,FileName) Content = self.get_file_content(FileName) self.render('createBlog.html',datetime = datetime,Check = GroupCode,Privacy = Privacy,Subject = Subject,Content = Content, PostUrl = PostUrl,GroupInfos = group_infos,IsAdmin = is_admin) except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.') class SaveBlogHander(AuthHandler): def save_file(self,message): filename = os.path.join(BlogDataPath,time.strftime("%Y%m%d%H%M%S") + ".html") with open(filename,'wb') as fp: fp.write(message) return os.path.split(filename)[1] def do_something(self): try: flag = self.check_request_type('post') if not flag: raise Exception('Request type error') is_admin = self.check_admin() if not is_admin: raise Exception('No permission error') username = self.get_current_user() groupcode = self.get_argument('category') subject = self.get_argument('subject') message = self.get_argument('message') privacy = self.get_argument('privacy') FileName = self.save_file(message) Addtime = time.strftime("%Y-%m-%d %H:%M:%S") MysqlHandler.insertdata(subject, username, Addtime, FileName, groupcode, privacy) self.redirect('/') except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.') class UploadBlogHander(AuthHandler): def save_file(self,message,filename): filename = os.path.join(BlogDataPath,filename) with open(filename,'wb') as fp: fp.write(message) def do_something(self): try: flag = self.check_request_type('post') if not flag: raise Exception('Request type error') is_admin = self.check_admin() if not is_admin: raise Exception('No permission error') blogId = self.get_argument('blogId') filename = self.get_argument('filename') groupcode = self.get_argument('category') subject = self.get_argument('subject') message = self.get_argument('message') privacy = self.get_argument('privacy') self.save_file(message,filename) UpdateTime = time.strftime("%Y-%m-%d %H:%M:%S") MysqlHandler.updatablog(subject,UpdateTime,groupcode,blogId,privacy) self.redirect('/') except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.') class WatchBlogHandler(NoAuthHandler): def get_url_values(self,urls): if len(urls) == 2: blogId = urls[1] else: raise Exception('Request url error') return blogId def get_file_content(self,FileName): filename = os.path.join(BlogDataPath,FileName) with open(filename,'rb') as fp: content = fp.read() return content def do_something(self): try: flag = self.check_request_type('get') if not flag: raise Exception('Request type error') is_admin = self.check_admin() urls = self.get_url_parts() blogId = self.get_url_values(urls) info = MysqlHandler.select_blog_info(blogId,is_admin) if info: GroupCode = info[0] Subject = info[1] FileName = info[2] datetime = info[3] Views = info[4] Privacy = info[5] else: self.redirect('/') return group_infos = MysqlHandler.select_group_info(is_admin) lastpagenum,lasttitle = MysqlHandler.get_last_next_blog_info(blogId,GroupCode,IsLast=True) nextpagenum,nexttitle = MysqlHandler.get_last_next_blog_info(blogId,GroupCode,IsLast=False) blogdata = self.get_file_content(FileName) blogInfo = [Subject,datetime,blogdata,Views] self.render('blog.html', BlogInfo = blogInfo,GroupInfos = group_infos,BlogId = blogId,IsAdmin = is_admin, lastpagenum=lastpagenum,lasttitle=lasttitle,nextpagenum=nextpagenum,nexttitle=nexttitle,Privacy = Privacy) except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.') class DelBlogHandler(AuthHandler): def get_url_values(self,urls): if len(urls) == 2: blogId = urls[1] else: raise Exception('Request url error') return blogId def do_something(self): try: flag = self.check_request_type('get') if not flag: raise Exception('Request type error') is_admin = self.check_admin() if not is_admin: raise Exception('No permission error') urls = self.get_url_parts() BlogId = self.get_url_values(urls) MysqlHandler.del_blog(BlogId) self.redirect('/') except: get_err_msg() self.render('error.html',message = 'Something wrong with the server.')
7fee07df651ff18964eca7846fe20d623465fb46
e51f0c3cb7e9d2c6adafa0271b6f808301a8a278
/bin/sendEmail.py
04165f8ac9dc61e42b061a2cb93bd07ce703c13d
[]
no_license
anke5156/hipDataLoad
61c481e961e062b3e7e7de2de05fef51ef0d0f77
e7422c3467574446d6e67ca0a3675aecb35bc178
refs/heads/master
2022-07-04T00:03:15.315392
2020-05-05T09:07:21
2020-05-05T09:07:21
258,818,813
1
0
null
null
null
null
UTF-8
Python
false
false
1,300
py
#!/usr/bin/python # -*- coding: UTF-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header ''' @author: anke @contact: [email protected] @file: sendEmail.py @time: 2020/4/27 10:11 AM @desc: ''' class Mail(object): def __init__(self): self.mailhost = 'smtp.qq.com' self.mailport = '465' self.mailuser = '[email protected]' self.mailpass = '' self.receiver = '[email protected]' def send(self, subjecttxt='NB Health Report', ctt=''): message = MIMEText(ctt, 'plain', 'utf-8') message['from'] = Header('NB office', 'utf-8') message['to'] = Header('Monitor', 'utf-8') message['Subject'] = Header(subjecttxt, 'utf-8') try: smtpObj = smtplib.SMTP(self.mailhost, self.mailport) # smtpObj.ehlo() # smtpObj.starttls() smtpObj.login(self.mailuser, self.mailpass) smtpObj.sendmail(self.mailuser, self.receiver, message.as_string()) smtpObj.quit() print('send mail successfully!') except smtplib.SMTPException as e: print('send mail error: %s' % e) if __name__ == '__main__': mail = Mail() mail.send('NB Health Report', 'ALL Healthy')
08b6a5445417b9f2181b89f274c6b1c9883307d9
4f672b97bf290d664d63662943fe5d07ab594940
/mysite/mysite/settings.py
46673a1f048e3b982ece75572223c14ec8e3885b
[ "Apache-2.0" ]
permissive
tylerelston/cmput404-lab4
9d265b4e193347e06554a1fefa58ac9fc3c581f1
4b71823be1b6abfbecc1972ba8c72b52ac8ecd7e
refs/heads/main
2023-08-19T02:51:32.198851
2021-09-30T00:40:52
2021-09-30T00:40:52
411,855,058
0
0
null
null
null
null
UTF-8
Python
false
false
3,092
py
""" Django settings for mysite project. Generated by 'django-admin startproject' using Django 3.1.6. For more information on this file, see https://docs.djangoproject.com/en/3.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '97m^b&x$7__&)d2+%g&*wt-aqd*8$*qm^@ts4-k5$np_0)qh2a' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'polls.apps.PollsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'mysite.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'mysite.wsgi.application' # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.1/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/'
71e80c8baff21dad8146daa3a3b794eb395334e5
4c63edb34dbc6e7d3a07da10f25f23469824d36c
/session5/add.py
076ae05115291ea142b026360211d4a9e23d32e5
[]
no_license
KKAiser97/trantrungkien-fundamentals-c4e26
59a3c22433dfec85a778a8fc231f429080a6abc3
0812ad0061e6ff1aeb7928dfc3464f7b7f2cb193
refs/heads/master
2020-04-19T16:12:49.364161
2019-03-17T09:47:59
2019-03-17T09:47:59
168,297,639
0
0
null
null
null
null
UTF-8
Python
false
false
93
py
# fruitful func def add(x,y): s=x+y print(s) return s t=add(3,5) print(t)
11d717a2f9e739efed56345d3582c110d0476657
670340c954be7ea599661ab282149943a737509e
/main.py
af92e165ae8bb88e62e01452056296f8fda5b357
[]
no_license
eason-lee/tweet
f4d430afb953139d6fe486bc5562da300adcf7b0
2be38a816a947b74bf52d96ec082274c55214028
refs/heads/master
2020-09-16T23:21:44.826990
2016-10-06T03:51:22
2016-10-06T03:51:22
67,691,313
0
0
null
null
null
null
UTF-8
Python
false
false
427
py
from app import init_app from app import models def rebuild_db(): # 必须初始化 app 才能操作数据库 app = init_app() db = models.db db.drop_all() db.create_all() print('auth rebuild database') def run(): config = dict( # host = '0.0.0.0', # port = 3000, debug=True, ) init_app().run(**config) if __name__ == '__main__': # rebuild_db() run()
71cd78ee38557b185c3fa322794243305c8f1384
afdfe1d456fa784c6ec281e27dfb9b232ec14de5
/app/server/models/user.py
d38cb2a35f45ba1bdc6f0d6d1eac3f9849ffffe1
[]
no_license
ebubekir/library-api
438d8bcd4e23450bd3a8ab2b581a92eab5cbab9f
02ce55d0e8484afa6394012f8b046843089c2a8e
refs/heads/main
2023-04-14T13:26:05.805151
2021-04-26T23:39:37
2021-04-26T23:39:37
361,742,025
0
0
null
null
null
null
UTF-8
Python
false
false
875
py
from typing import Optional from pydantic import BaseModel, Field class UserSchema(BaseModel): firstname: str = Field(...) lastname: str = Field(...) class Config: schema_extra = { "example":{ "firstname": "John", "lastname": "Doe" } } class UpdateUserModel(BaseModel): firstname: Optional[str] lastname: Optional[str] class Config: schema_extra = { "example":{ "firstname": "Mike", "lastname": "Doe" } } def ResponseModel(data, message): return { "data":[data], "code":200, "message":message } def ErrorResponseModel(error, code, message): return { "error": error, "code": code, "message": message }
fd8a249b1f44b14a3c11896e5a12e1c86a1988e9
372a0eb8d3be3d40b9dfb5cf45a7df2149d2dd0d
/charles/Week 07/lab08/lab08.py
198fffad72e36dfcdfe4b7505ec51e6fe007c177
[]
no_license
charlesfrye/cs61a-summer2015
5d14b679e5bea53cfa26c2a6a86720e8e77c322c
1f5c0fbf5dce5d1322285595ca964493d9adbdfe
refs/heads/master
2016-08-07T06:06:09.335913
2015-08-21T00:33:25
2015-08-21T00:33:25
38,509,126
0
0
null
null
null
null
UTF-8
Python
false
false
2,460
py
## Linked Lists and Sets ## # Linked Lists class Link: """A linked list. >>> s = Link(1, Link(2, Link(3, Link(4)))) >>> len(s) 4 >>> s[2] 3 >>> s Link(1, Link(2, Link(3, Link(4)))) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self.rest = rest def __getitem__(self, i): if i == 0: return self.first else: return self.rest[i-1] def __len__(self): return 1 + len(self.rest) def __repr__(self): if self.rest is not Link.empty: rest_str = ', ' + repr(self.rest) else: rest_str = '' return 'Link({0}{1})'.format(repr(self.first), rest_str) def slice_link(link, start, end): """Slices a Link from start to end (as with a normal Python list). >>> link = Link(3, Link(1, Link(4, Link(1, Link(5, Link(9)))))) >>> slice_link(link, 1, 4) Link(1, Link(4, Link(1))) """ if start == end: return Link.empty return Link(link[start],slice_link(link.rest,0,end-1-start)) # Sets def union(s1, s2): """Returns the union of two sets. >>> r = {0, 6, 6} >>> s = {1, 2, 3, 4} >>> t = union(s, {1, 6}) >>> t {1, 2, 3, 4, 6} >>> union(r, t) {0, 1, 2, 3, 4, 6} """ union_set = set() for element in s1: union_set.add(element) for element in s2: union_set.add(element) return union_set def intersection(s1, s2): """Returns the intersection of two sets. >>> r = {0, 1, 4, 0} >>> s = {1, 2, 3, 4} >>> t = intersection(s, {3, 4, 2}) >>> t {2, 3, 4} >>> intersection(r, t) {4} """ intersect = set() for element in s1: if element in s2: intersect.add(element) return intersect def extra_elem(a,b): """B contains every element in A, and has one additional member, find the additional member. >>> extra_elem(['dog', 'cat', 'monkey'], ['dog', 'cat', 'monkey', 'giraffe']) 'giraffe' >>> extra_elem([1, 2, 3, 4, 5], [1, 2, 3, 4, 5, 6]) 6 """ return list(set(b)-set(a))[0] def find_duplicates(lst): """Returns True if lst has any duplicates and False if it does not. >>> find_duplicates([1, 2, 3, 4, 5]) False >>> find_duplicates([1, 2, 3, 4, 2]) True """ return len(set(lst)) != len(lst)