hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
11 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
251
max_stars_repo_name
stringlengths
4
130
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
251
max_issues_repo_name
stringlengths
4
130
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
116k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
251
max_forks_repo_name
stringlengths
4
130
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
1
1.05M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.04M
alphanum_fraction
float64
0
1
e3c3ec76a20176afe22ba2e37b489b70bdc6e8aa
20,109
py
Python
AwesomeService/coveo-blitz-thrift/src/main/python/awesome/AwesomeService.py
coveord/Blitz-2015
9d8a0fbc3b4ca7cfdce9a3aea0efec205070e946
[ "Apache-2.0" ]
4
2015-01-13T00:27:20.000Z
2015-01-19T21:21:18.000Z
AwesomeService/coveo-blitz-thrift/src/main/python/awesome/AwesomeService.py
Coveo/Blitz-2015
9d8a0fbc3b4ca7cfdce9a3aea0efec205070e946
[ "Apache-2.0" ]
null
null
null
AwesomeService/coveo-blitz-thrift/src/main/python/awesome/AwesomeService.py
Coveo/Blitz-2015
9d8a0fbc3b4ca7cfdce9a3aea0efec205070e946
[ "Apache-2.0" ]
1
2016-03-11T18:35:02.000Z
2016-03-11T18:35:02.000Z
# # Autogenerated by Thrift Compiler (0.9.2) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TException, TApplicationException from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol, TProtocol try: from thrift.protocol import fastbinary except: fastbinary = None # HELPER FUNCTIONS AND STRUCTURES
28.892241
188
0.675369
e3c455dcd759b47e6ff022d0f28b6d8b03f6c49a
10,382
py
Python
src/org_setup/resources/organizations.py
gilyas/aws-control-tower-org-setup-sample
65c1a1a0c7b7bb362dff1924f38f63bd8c3a8e41
[ "MIT-0" ]
null
null
null
src/org_setup/resources/organizations.py
gilyas/aws-control-tower-org-setup-sample
65c1a1a0c7b7bb362dff1924f38f63bd8c3a8e41
[ "MIT-0" ]
null
null
null
src/org_setup/resources/organizations.py
gilyas/aws-control-tower-org-setup-sample
65c1a1a0c7b7bb362dff1924f38f63bd8c3a8e41
[ "MIT-0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: MIT-0 * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from functools import lru_cache import json from typing import List, Dict, Optional, Iterable, Any from aws_lambda_powertools import Logger import boto3 import botocore from ..constants import AI_OPT_OUT_POLICY_NAME, AI_OPT_OUT_POLICY from ..exceptions import OrganizationNotFoundException logger = Logger(child=True) __all__ = ["Organizations"]
37.345324
119
0.573974
e3c4a465fcdd23d8bc979d0237347d3db4337947
2,095
py
Python
clint/textui/core.py
mpmman/clint
9d3693d644b8587d985972b6075d970096f6439e
[ "0BSD" ]
1,230
2015-01-03T05:39:25.000Z
2020-02-18T12:36:03.000Z
clint/textui/core.py
not-kennethreitz/clint
9d3693d644b8587d985972b6075d970096f6439e
[ "0BSD" ]
50
2015-01-06T17:58:20.000Z
2018-03-19T13:25:22.000Z
clint/textui/core.py
not-kennethreitz/clint
9d3693d644b8587d985972b6075d970096f6439e
[ "0BSD" ]
153
2015-01-03T03:56:25.000Z
2020-02-13T20:59:03.000Z
# -*- coding: utf-8 -*- """ clint.textui.core ~~~~~~~~~~~~~~~~~ Core TextUI functionality for Puts/Indent/Writer. """ from __future__ import absolute_import import sys from contextlib import contextmanager from .formatters import max_width, min_width, _get_max_width_context from .cols import columns from ..utils import tsplit __all__ = ('puts', 'puts_err', 'indent', 'dedent', 'columns', 'max_width', 'min_width', 'STDOUT', 'STDERR') STDOUT = sys.stdout.write STDERR = sys.stderr.write NEWLINES = ('\n', '\r', '\r\n') INDENT_STRINGS = [] # Private def _indent(indent=0, quote='', indent_char=' '): """Indent util function, compute new indent_string""" if indent > 0: indent_string = ''.join(( str(quote), (indent_char * (indent - len(quote))) )) else: indent_string = ''.join(( ('\x08' * (-1 * (indent - len(quote)))), str(quote)) ) if len(indent_string): INDENT_STRINGS.append(indent_string) # Public def puts(s='', newline=True, stream=STDOUT): """Prints given string to stdout.""" max_width_ctx = _get_max_width_context() if max_width_ctx: cols, separator = max_width_ctx[-1] s = max_width(s, cols, separator) if newline: s = tsplit(s, NEWLINES) s = map(str, s) indent = ''.join(INDENT_STRINGS) s = (str('\n' + indent)).join(s) _str = ''.join(( ''.join(INDENT_STRINGS), str(s), '\n' if newline else '' )) stream(_str) def puts_err(s='', newline=True, stream=STDERR): """Prints given string to stderr.""" puts(s, newline, stream) def dedent(): """Dedent next strings, use only if you use indent otherwise than as a context.""" INDENT_STRINGS.pop() def indent(indent=4, quote=''): """Indentation manager, return an indentation context manager.""" _indent(indent, quote) return _indent_context()
21.822917
74
0.602864
e3c6cfd741e8bd9adaeac0bf0d16ec2396131aa6
636
py
Python
setup.py
mluciarr/McComplex
e83b5d11ab772a6bdc6233d318f7da5f67b3c5ce
[ "MIT" ]
null
null
null
setup.py
mluciarr/McComplex
e83b5d11ab772a6bdc6233d318f7da5f67b3c5ce
[ "MIT" ]
null
null
null
setup.py
mluciarr/McComplex
e83b5d11ab772a6bdc6233d318f7da5f67b3c5ce
[ "MIT" ]
1
2021-04-14T22:43:33.000Z
2021-04-14T22:43:33.000Z
#!/usr/bin/env python from distutils.core import setup import setuptools setup(name='McComplex', version='1.0', description="""This program reconstructs macrocomplexes of protein-protein and protein-(DNA/RNA) from a list of files of binary interactions of its chains""", author='Maria Luca Romero, Ferran Pegenaute, Ipek Yaren', author_email='ferran.pegenaute01@estudiant.upf.edu', long_description=open('README.md').read(), install_requires=['biopython >= 1.73.0','argparse >= 1.1.0', 'pysimplelog'], packages=['McComplex', 'McComplex.functions'], license='LICENSE.txt', url='https://github.com/ferranpgp/McCrocomplex')
37.411765
84
0.748428
e3c83e726d786e7b9f87a1f14f06ff2aa47d4a9b
1,277
py
Python
pymitools/girder/metadataPresets.py
chapmanbe/pymitools
be0f4a3f56dd6c8bb89678368c49e09b3333232c
[ "Apache-2.0" ]
null
null
null
pymitools/girder/metadataPresets.py
chapmanbe/pymitools
be0f4a3f56dd6c8bb89678368c49e09b3333232c
[ "Apache-2.0" ]
null
null
null
pymitools/girder/metadataPresets.py
chapmanbe/pymitools
be0f4a3f56dd6c8bb89678368c49e09b3333232c
[ "Apache-2.0" ]
null
null
null
"""Metadata presets for commonly used keywords.""" presets = { chest : {"Anatomical Region": {"ID": "0001443", "Name": "chest", "Ontology Acronym": "UBERON", "Ontology Name": "Uber Anatomy Ontology", "Resource URL": "http://purl.obolibrary.org/obo/UBERON_0001443"}}, abdomen : {"Anatomical Region": {"ID": "0000916", "Name": "abdomen", "Ontology Acronym": "UBERON", "Ontology Name": "Uber Anatomy Ontology", "Resource URL": "http://purl.obolibrary.org/obo/UBERON_0000916"}}, neck : {"Anatomical Region": {"ID": "0000974", "Name": "neck", "Ontology Acronym": "UBERON", "Ontology Name": "Uber Anatomy Ontology", "Resource URL": "http://purl.obolibrary.org/obo/UBERON_0000974"}}, head : {"Anatomical Region": {"ID": "0000033", "Name": "head", "Ontology Acronym": "UBERON", "Ontology Name": "Uber Anatomy Ontology", "Resource URL": "http://purl.obolibrary.org/obo/UBERON_0000033"}}}
29.697674
66
0.473767
e3c99e6c753a7603c000c4cebf8d2e0f312189b5
901
py
Python
data/colors-extractor.py
imlolman/Flat-UI-Colors-Chrome-App
d12010360dfeb1d38e8923dbe0fa5c51640b7314
[ "BSD-Source-Code" ]
1
2021-04-23T13:33:16.000Z
2021-04-23T13:33:16.000Z
data/colors-extractor.py
imlolman/Flat-UI-Colors-Chrome-App
d12010360dfeb1d38e8923dbe0fa5c51640b7314
[ "BSD-Source-Code" ]
null
null
null
data/colors-extractor.py
imlolman/Flat-UI-Colors-Chrome-App
d12010360dfeb1d38e8923dbe0fa5c51640b7314
[ "BSD-Source-Code" ]
null
null
null
from bs4 import BeautifulSoup import json source = open('html-source.html', encoding="utf8").read() soup = BeautifulSoup(source, 'html.parser') # Prittified to look and understand the structure of Code # prittified = soup.prettify().encode("utf-8") # open('prettified.html', 'wb').write(prittified) color_sets = [] for sets in soup.find_all("a", {"class": "smallpalette-container"}): set = {} set['name'] = sets.find( 'div', {"class": "name"}).contents[0].replace('\n ', '') set['emoji'] = sets.find('span', {"class": "emoji"}).string set['colors'] = [] for color in sets.find_all("div", {"class": "color"}): set['colors'].append(color['style'].replace( 'background: ', "").replace(';', "")) color_sets.append(set) open('colors_data.json', 'w+').write(json.dumps(color_sets)) print('Check file `colors_data.json` Updated Color Sets.')
32.178571
71
0.627081
e3ca5e822898bbe283aa33628cdf89af94b959cf
2,005
py
Python
preprocessing.py
Y-greatigr/Covid19_Model
30fc0af1ac6c7f68bf072607ee0db194f8c8093a
[ "MIT" ]
null
null
null
preprocessing.py
Y-greatigr/Covid19_Model
30fc0af1ac6c7f68bf072607ee0db194f8c8093a
[ "MIT" ]
null
null
null
preprocessing.py
Y-greatigr/Covid19_Model
30fc0af1ac6c7f68bf072607ee0db194f8c8093a
[ "MIT" ]
null
null
null
# . # . import numpy as np import os import options as opt import datetime from sklearn.model_selection import train_test_split from sklearn.preprocessing import Normalizer import joblib if __name__ == "__main__": # data = load() # x, y x, y = labeling(data, sight=opt.SIGHT, y_n=opt.Y_N) x = x.reshape((-1, opt.SIGHT, 1)) # train, test xtrain, xtest, ytrain ,ytest = train_test_split(x, y, test_size=opt.TEST_SIZE) joblib.dump([xtrain, xtest, ytrain, ytest], 'traintest.joblib') # print(xtrain.shape) print(ytrain.shape) print(xtest.shape) print(ytest.shape)
28.642857
98
0.551122
e3cac54ed59276bd1cf21b47cfa19280c29a0b7c
20,168
py
Python
colorpy/colorpy-0.1.0/illuminants.py
gmweir/QuasiOptics
0974178984f845597c5209217613c26edf931ed0
[ "MIT" ]
1
2020-11-06T18:16:00.000Z
2020-11-06T18:16:00.000Z
colorpy/colorpy-0.1.1/illuminants.py
gmweir/QuasiOptics
0974178984f845597c5209217613c26edf931ed0
[ "MIT" ]
null
null
null
colorpy/colorpy-0.1.1/illuminants.py
gmweir/QuasiOptics
0974178984f845597c5209217613c26edf931ed0
[ "MIT" ]
null
null
null
''' illuminants.py - Definitions of some standard illuminants. Description: Illuminants are spectrums, normalized so that Y = 1.0. Spectrums are 2D numpy arrays, with one row for each wavelength, with the first column holding the wavelength in nm, and the second column the intensity. The spectrums have a wavelength increment of 1 nm. Functions: init () - Initialize CIE Illuminant D65. This runs on module startup. get_illuminant_D65 () - Get CIE Illuminant D65, as a spectrum, normalized to Y = 1.0. CIE standard illuminant D65 represents a phase of natural daylight with a correlated color temperature of approximately 6504 K. (Wyszecki, p. 144) In the interest of standardization the CIE recommends that D65 be used whenever possible. Otherwise, D55 or D75 are recommended. (Wyszecki, p. 145) (ColorPy does not currently provide D55 or D75, however.) get_illuminant_A () - Get CIE Illuminant A, as a spectrum, normalized to Y = 1.0. This is actually a blackbody illuminant for T = 2856 K. (Wyszecki, p. 143) get_blackbody_illuminant (T_K) - Get the spectrum of a blackbody at the given temperature, normalized to Y = 1.0. get_constant_illuminant () - Get an illuminant, with spectrum constant over wavelength, normalized to Y = 1.0. scale_illuminant (illuminant, scaling) - Scale the illuminant intensity by the specfied factor. References: Wyszecki and Stiles, Color Science: Concepts and Methods, Quantitative Data and Formulae, 2nd edition, John Wiley, 1982. Wiley Classics Library Edition 2000. ISBN 0-471-39918-3. CVRL Color and Vision Database - http://cvrl.ioo.ucl.ac.uk/index.htm - (accessed 17 Sep 2008) Color and Vision Research Laboratories. Provides a set of data sets related to color vision. ColorPy uses the tables from this site for the 1931 CIE XYZ matching functions, and for Illuminant D65, both at 1 nm wavelength increments. CIE Standards - http://cvrl.ioo.ucl.ac.uk/cie.htm - (accessed 17 Sep 2008) CIE standards as maintained by CVRL. The 1931 CIE XYZ and D65 tables that ColorPy uses were obtained from the following files, linked here: http://cvrl.ioo.ucl.ac.uk/database/data/cmfs/ciexyz31_1.txt http://cvrl.ioo.ucl.ac.uk/database/data/cie/Illuminantd65.txt CIE International Commission on Illumination - http://www.cie.co.at/ - (accessed 17 Sep 2008) Official website of the CIE. There are tables of the standard functions (matching functions, illuminants) here: http://www.cie.co.at/main/freepubs.html http://www.cie.co.at/publ/abst/datatables15_2004/x2.txt http://www.cie.co.at/publ/abst/datatables15_2004/y2.txt http://www.cie.co.at/publ/abst/datatables15_2004/z2.txt http://www.cie.co.at/publ/abst/datatables15_2004/sid65.txt ColorPy does not use these specific files. License: Copyright (C) 2008 Mark Kness Author - Mark Kness - mkness@alumni.utexas.net This file is part of ColorPy. ColorPy is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ColorPy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with ColorPy. If not, see <http://www.gnu.org/licenses/>. ''' import math, numpy import colormodels import ciexyz import blackbody import plots # table of CIE Illuminant D65 spectrum. # data from: http://cvrl.ioo.ucl.ac.uk/database/data/cie/Illuminantd65.txt # massaged into this format. _Illuminant_D65_table = [ [ 300, 0.034100 ], [ 301, 0.360140 ], [ 302, 0.686180 ], [ 303, 1.012220 ], [ 304, 1.338260 ], [ 305, 1.664300 ], [ 306, 1.990340 ], [ 307, 2.316380 ], [ 308, 2.642420 ], [ 309, 2.968460 ], [ 310, 3.294500 ], [ 311, 4.988650 ], [ 312, 6.682800 ], [ 313, 8.376950 ], [ 314, 10.071100 ], [ 315, 11.765200 ], [ 316, 13.459400 ], [ 317, 15.153500 ], [ 318, 16.847700 ], [ 319, 18.541800 ], [ 320, 20.236000 ], [ 321, 21.917700 ], [ 322, 23.599500 ], [ 323, 25.281200 ], [ 324, 26.963000 ], [ 325, 28.644700 ], [ 326, 30.326500 ], [ 327, 32.008200 ], [ 328, 33.690000 ], [ 329, 35.371700 ], [ 330, 37.053500 ], [ 331, 37.343000 ], [ 332, 37.632600 ], [ 333, 37.922100 ], [ 334, 38.211600 ], [ 335, 38.501100 ], [ 336, 38.790700 ], [ 337, 39.080200 ], [ 338, 39.369700 ], [ 339, 39.659300 ], [ 340, 39.948800 ], [ 341, 40.445100 ], [ 342, 40.941400 ], [ 343, 41.437700 ], [ 344, 41.934000 ], [ 345, 42.430200 ], [ 346, 42.926500 ], [ 347, 43.422800 ], [ 348, 43.919100 ], [ 349, 44.415400 ], [ 350, 44.911700 ], [ 351, 45.084400 ], [ 352, 45.257000 ], [ 353, 45.429700 ], [ 354, 45.602300 ], [ 355, 45.775000 ], [ 356, 45.947700 ], [ 357, 46.120300 ], [ 358, 46.293000 ], [ 359, 46.465600 ], [ 360, 46.638300 ], [ 361, 47.183400 ], [ 362, 47.728500 ], [ 363, 48.273500 ], [ 364, 48.818600 ], [ 365, 49.363700 ], [ 366, 49.908800 ], [ 367, 50.453900 ], [ 368, 50.998900 ], [ 369, 51.544000 ], [ 370, 52.089100 ], [ 371, 51.877700 ], [ 372, 51.666400 ], [ 373, 51.455000 ], [ 374, 51.243700 ], [ 375, 51.032300 ], [ 376, 50.820900 ], [ 377, 50.609600 ], [ 378, 50.398200 ], [ 379, 50.186900 ], [ 380, 49.975500 ], [ 381, 50.442800 ], [ 382, 50.910000 ], [ 383, 51.377300 ], [ 384, 51.844600 ], [ 385, 52.311800 ], [ 386, 52.779100 ], [ 387, 53.246400 ], [ 388, 53.713700 ], [ 389, 54.180900 ], [ 390, 54.648200 ], [ 391, 57.458900 ], [ 392, 60.269500 ], [ 393, 63.080200 ], [ 394, 65.890900 ], [ 395, 68.701500 ], [ 396, 71.512200 ], [ 397, 74.322900 ], [ 398, 77.133600 ], [ 399, 79.944200 ], [ 400, 82.754900 ], [ 401, 83.628000 ], [ 402, 84.501100 ], [ 403, 85.374200 ], [ 404, 86.247300 ], [ 405, 87.120400 ], [ 406, 87.993600 ], [ 407, 88.866700 ], [ 408, 89.739800 ], [ 409, 90.612900 ], [ 410, 91.486000 ], [ 411, 91.680600 ], [ 412, 91.875200 ], [ 413, 92.069700 ], [ 414, 92.264300 ], [ 415, 92.458900 ], [ 416, 92.653500 ], [ 417, 92.848100 ], [ 418, 93.042600 ], [ 419, 93.237200 ], [ 420, 93.431800 ], [ 421, 92.756800 ], [ 422, 92.081900 ], [ 423, 91.406900 ], [ 424, 90.732000 ], [ 425, 90.057000 ], [ 426, 89.382100 ], [ 427, 88.707100 ], [ 428, 88.032200 ], [ 429, 87.357200 ], [ 430, 86.682300 ], [ 431, 88.500600 ], [ 432, 90.318800 ], [ 433, 92.137100 ], [ 434, 93.955400 ], [ 435, 95.773600 ], [ 436, 97.591900 ], [ 437, 99.410200 ], [ 438, 101.228000 ], [ 439, 103.047000 ], [ 440, 104.865000 ], [ 441, 106.079000 ], [ 442, 107.294000 ], [ 443, 108.508000 ], [ 444, 109.722000 ], [ 445, 110.936000 ], [ 446, 112.151000 ], [ 447, 113.365000 ], [ 448, 114.579000 ], [ 449, 115.794000 ], [ 450, 117.008000 ], [ 451, 117.088000 ], [ 452, 117.169000 ], [ 453, 117.249000 ], [ 454, 117.330000 ], [ 455, 117.410000 ], [ 456, 117.490000 ], [ 457, 117.571000 ], [ 458, 117.651000 ], [ 459, 117.732000 ], [ 460, 117.812000 ], [ 461, 117.517000 ], [ 462, 117.222000 ], [ 463, 116.927000 ], [ 464, 116.632000 ], [ 465, 116.336000 ], [ 466, 116.041000 ], [ 467, 115.746000 ], [ 468, 115.451000 ], [ 469, 115.156000 ], [ 470, 114.861000 ], [ 471, 114.967000 ], [ 472, 115.073000 ], [ 473, 115.180000 ], [ 474, 115.286000 ], [ 475, 115.392000 ], [ 476, 115.498000 ], [ 477, 115.604000 ], [ 478, 115.711000 ], [ 479, 115.817000 ], [ 480, 115.923000 ], [ 481, 115.212000 ], [ 482, 114.501000 ], [ 483, 113.789000 ], [ 484, 113.078000 ], [ 485, 112.367000 ], [ 486, 111.656000 ], [ 487, 110.945000 ], [ 488, 110.233000 ], [ 489, 109.522000 ], [ 490, 108.811000 ], [ 491, 108.865000 ], [ 492, 108.920000 ], [ 493, 108.974000 ], [ 494, 109.028000 ], [ 495, 109.082000 ], [ 496, 109.137000 ], [ 497, 109.191000 ], [ 498, 109.245000 ], [ 499, 109.300000 ], [ 500, 109.354000 ], [ 501, 109.199000 ], [ 502, 109.044000 ], [ 503, 108.888000 ], [ 504, 108.733000 ], [ 505, 108.578000 ], [ 506, 108.423000 ], [ 507, 108.268000 ], [ 508, 108.112000 ], [ 509, 107.957000 ], [ 510, 107.802000 ], [ 511, 107.501000 ], [ 512, 107.200000 ], [ 513, 106.898000 ], [ 514, 106.597000 ], [ 515, 106.296000 ], [ 516, 105.995000 ], [ 517, 105.694000 ], [ 518, 105.392000 ], [ 519, 105.091000 ], [ 520, 104.790000 ], [ 521, 105.080000 ], [ 522, 105.370000 ], [ 523, 105.660000 ], [ 524, 105.950000 ], [ 525, 106.239000 ], [ 526, 106.529000 ], [ 527, 106.819000 ], [ 528, 107.109000 ], [ 529, 107.399000 ], [ 530, 107.689000 ], [ 531, 107.361000 ], [ 532, 107.032000 ], [ 533, 106.704000 ], [ 534, 106.375000 ], [ 535, 106.047000 ], [ 536, 105.719000 ], [ 537, 105.390000 ], [ 538, 105.062000 ], [ 539, 104.733000 ], [ 540, 104.405000 ], [ 541, 104.369000 ], [ 542, 104.333000 ], [ 543, 104.297000 ], [ 544, 104.261000 ], [ 545, 104.225000 ], [ 546, 104.190000 ], [ 547, 104.154000 ], [ 548, 104.118000 ], [ 549, 104.082000 ], [ 550, 104.046000 ], [ 551, 103.641000 ], [ 552, 103.237000 ], [ 553, 102.832000 ], [ 554, 102.428000 ], [ 555, 102.023000 ], [ 556, 101.618000 ], [ 557, 101.214000 ], [ 558, 100.809000 ], [ 559, 100.405000 ], [ 560, 100.000000 ], [ 561, 99.633400 ], [ 562, 99.266800 ], [ 563, 98.900300 ], [ 564, 98.533700 ], [ 565, 98.167100 ], [ 566, 97.800500 ], [ 567, 97.433900 ], [ 568, 97.067400 ], [ 569, 96.700800 ], [ 570, 96.334200 ], [ 571, 96.279600 ], [ 572, 96.225000 ], [ 573, 96.170300 ], [ 574, 96.115700 ], [ 575, 96.061100 ], [ 576, 96.006500 ], [ 577, 95.951900 ], [ 578, 95.897200 ], [ 579, 95.842600 ], [ 580, 95.788000 ], [ 581, 95.077800 ], [ 582, 94.367500 ], [ 583, 93.657300 ], [ 584, 92.947000 ], [ 585, 92.236800 ], [ 586, 91.526600 ], [ 587, 90.816300 ], [ 588, 90.106100 ], [ 589, 89.395800 ], [ 590, 88.685600 ], [ 591, 88.817700 ], [ 592, 88.949700 ], [ 593, 89.081800 ], [ 594, 89.213800 ], [ 595, 89.345900 ], [ 596, 89.478000 ], [ 597, 89.610000 ], [ 598, 89.742100 ], [ 599, 89.874100 ], [ 600, 90.006200 ], [ 601, 89.965500 ], [ 602, 89.924800 ], [ 603, 89.884100 ], [ 604, 89.843400 ], [ 605, 89.802600 ], [ 606, 89.761900 ], [ 607, 89.721200 ], [ 608, 89.680500 ], [ 609, 89.639800 ], [ 610, 89.599100 ], [ 611, 89.409100 ], [ 612, 89.219000 ], [ 613, 89.029000 ], [ 614, 88.838900 ], [ 615, 88.648900 ], [ 616, 88.458900 ], [ 617, 88.268800 ], [ 618, 88.078800 ], [ 619, 87.888700 ], [ 620, 87.698700 ], [ 621, 87.257700 ], [ 622, 86.816700 ], [ 623, 86.375700 ], [ 624, 85.934700 ], [ 625, 85.493600 ], [ 626, 85.052600 ], [ 627, 84.611600 ], [ 628, 84.170600 ], [ 629, 83.729600 ], [ 630, 83.288600 ], [ 631, 83.329700 ], [ 632, 83.370700 ], [ 633, 83.411800 ], [ 634, 83.452800 ], [ 635, 83.493900 ], [ 636, 83.535000 ], [ 637, 83.576000 ], [ 638, 83.617100 ], [ 639, 83.658100 ], [ 640, 83.699200 ], [ 641, 83.332000 ], [ 642, 82.964700 ], [ 643, 82.597500 ], [ 644, 82.230200 ], [ 645, 81.863000 ], [ 646, 81.495800 ], [ 647, 81.128500 ], [ 648, 80.761300 ], [ 649, 80.394000 ], [ 650, 80.026800 ], [ 651, 80.045600 ], [ 652, 80.064400 ], [ 653, 80.083100 ], [ 654, 80.101900 ], [ 655, 80.120700 ], [ 656, 80.139500 ], [ 657, 80.158300 ], [ 658, 80.177000 ], [ 659, 80.195800 ], [ 660, 80.214600 ], [ 661, 80.420900 ], [ 662, 80.627200 ], [ 663, 80.833600 ], [ 664, 81.039900 ], [ 665, 81.246200 ], [ 666, 81.452500 ], [ 667, 81.658800 ], [ 668, 81.865200 ], [ 669, 82.071500 ], [ 670, 82.277800 ], [ 671, 81.878400 ], [ 672, 81.479100 ], [ 673, 81.079700 ], [ 674, 80.680400 ], [ 675, 80.281000 ], [ 676, 79.881600 ], [ 677, 79.482300 ], [ 678, 79.082900 ], [ 679, 78.683600 ], [ 680, 78.284200 ], [ 681, 77.427900 ], [ 682, 76.571600 ], [ 683, 75.715300 ], [ 684, 74.859000 ], [ 685, 74.002700 ], [ 686, 73.146500 ], [ 687, 72.290200 ], [ 688, 71.433900 ], [ 689, 70.577600 ], [ 690, 69.721300 ], [ 691, 69.910100 ], [ 692, 70.098900 ], [ 693, 70.287600 ], [ 694, 70.476400 ], [ 695, 70.665200 ], [ 696, 70.854000 ], [ 697, 71.042800 ], [ 698, 71.231500 ], [ 699, 71.420300 ], [ 700, 71.609100 ], [ 701, 71.883100 ], [ 702, 72.157100 ], [ 703, 72.431100 ], [ 704, 72.705100 ], [ 705, 72.979000 ], [ 706, 73.253000 ], [ 707, 73.527000 ], [ 708, 73.801000 ], [ 709, 74.075000 ], [ 710, 74.349000 ], [ 711, 73.074500 ], [ 712, 71.800000 ], [ 713, 70.525500 ], [ 714, 69.251000 ], [ 715, 67.976500 ], [ 716, 66.702000 ], [ 717, 65.427500 ], [ 718, 64.153000 ], [ 719, 62.878500 ], [ 720, 61.604000 ], [ 721, 62.432200 ], [ 722, 63.260300 ], [ 723, 64.088500 ], [ 724, 64.916600 ], [ 725, 65.744800 ], [ 726, 66.573000 ], [ 727, 67.401100 ], [ 728, 68.229300 ], [ 729, 69.057400 ], [ 730, 69.885600 ], [ 731, 70.405700 ], [ 732, 70.925900 ], [ 733, 71.446000 ], [ 734, 71.966200 ], [ 735, 72.486300 ], [ 736, 73.006400 ], [ 737, 73.526600 ], [ 738, 74.046700 ], [ 739, 74.566900 ], [ 740, 75.087000 ], [ 741, 73.937600 ], [ 742, 72.788100 ], [ 743, 71.638700 ], [ 744, 70.489300 ], [ 745, 69.339800 ], [ 746, 68.190400 ], [ 747, 67.041000 ], [ 748, 65.891600 ], [ 749, 64.742100 ], [ 750, 63.592700 ], [ 751, 61.875200 ], [ 752, 60.157800 ], [ 753, 58.440300 ], [ 754, 56.722900 ], [ 755, 55.005400 ], [ 756, 53.288000 ], [ 757, 51.570500 ], [ 758, 49.853100 ], [ 759, 48.135600 ], [ 760, 46.418200 ], [ 761, 48.456900 ], [ 762, 50.495600 ], [ 763, 52.534400 ], [ 764, 54.573100 ], [ 765, 56.611800 ], [ 766, 58.650500 ], [ 767, 60.689200 ], [ 768, 62.728000 ], [ 769, 64.766700 ], [ 770, 66.805400 ], [ 771, 66.463100 ], [ 772, 66.120900 ], [ 773, 65.778600 ], [ 774, 65.436400 ], [ 775, 65.094100 ], [ 776, 64.751800 ], [ 777, 64.409600 ], [ 778, 64.067300 ], [ 779, 63.725100 ], [ 780, 63.382800 ], [ 781, 63.474900 ], [ 782, 63.567000 ], [ 783, 63.659200 ], [ 784, 63.751300 ], [ 785, 63.843400 ], [ 786, 63.935500 ], [ 787, 64.027600 ], [ 788, 64.119800 ], [ 789, 64.211900 ], [ 790, 64.304000 ], [ 791, 63.818800 ], [ 792, 63.333600 ], [ 793, 62.848400 ], [ 794, 62.363200 ], [ 795, 61.877900 ], [ 796, 61.392700 ], [ 797, 60.907500 ], [ 798, 60.422300 ], [ 799, 59.937100 ], [ 800, 59.451900 ], [ 801, 58.702600 ], [ 802, 57.953300 ], [ 803, 57.204000 ], [ 804, 56.454700 ], [ 805, 55.705400 ], [ 806, 54.956200 ], [ 807, 54.206900 ], [ 808, 53.457600 ], [ 809, 52.708300 ], [ 810, 51.959000 ], [ 811, 52.507200 ], [ 812, 53.055300 ], [ 813, 53.603500 ], [ 814, 54.151600 ], [ 815, 54.699800 ], [ 816, 55.248000 ], [ 817, 55.796100 ], [ 818, 56.344300 ], [ 819, 56.892400 ], [ 820, 57.440600 ], [ 821, 57.727800 ], [ 822, 58.015000 ], [ 823, 58.302200 ], [ 824, 58.589400 ], [ 825, 58.876500 ], [ 826, 59.163700 ], [ 827, 59.450900 ], [ 828, 59.738100 ], [ 829, 60.025300 ], [ 830, 60.312500 ] ] _Illuminant_D65 = None def init (): '''Initialize CIE Illuminant D65. This runs on module startup.''' table_size = len (_Illuminant_D65_table) first_wl = _Illuminant_D65_table [0][0] last_wl = _Illuminant_D65_table [-1][0] # for now, only consider the part in the normal visible range (360-830 nm) first_index = ciexyz.start_wl_nm - first_wl table_first = _Illuminant_D65_table [first_index][0] assert (table_first == 360), 'Mismatch finding 360 nm entry in D65 table' global _Illuminant_D65 _Illuminant_D65 = ciexyz.empty_spectrum() (num_wl, num_cols) = _Illuminant_D65.shape for i in xrange (0, num_wl): _Illuminant_D65 [i][1] = _Illuminant_D65_table [first_index + i][1] # normalization - illuminant is scaled so that Y = 1.0 xyz = ciexyz.xyz_from_spectrum (_Illuminant_D65) scaling = 1.0 / xyz [1] _Illuminant_D65 [:,1] *= scaling # # Get any of the available illuminants - D65, A, any blackbody, or a constant spectrum. # ColorPy does not currently provide D55 or D75. # def get_illuminant_D65 (): '''Get CIE Illuminant D65, as a spectrum, normalized to Y = 1.0. CIE standard illuminant D65 represents a phase of natural daylight with a correlated color temperature of approximately 6504 K. (Wyszecki, p. 144) In the interest of standardization the CIE recommends that D65 be used whenever possible. Otherwise, D55 or D75 are recommended. (Wyszecki, p. 145) (ColorPy does not currently provide D55 or D75, however.)''' illuminant = _Illuminant_D65.copy() return illuminant def get_illuminant_A (): '''Get CIE Illuminant A, as a spectrum, normalized to Y = 1.0. This is actually a blackbody illuminant for T = 2856 K. (Wyszecki, p. 143)''' illuminant = get_blackbody_illuminant (2856.0) return illuminant def get_blackbody_illuminant (T_K): '''Get the spectrum of a blackbody at the given temperature, normalized to Y = 1.0.''' illuminant = blackbody.blackbody_spectrum (T_K) xyz = ciexyz.xyz_from_spectrum (illuminant) if xyz [1] != 0.0: scaling = 1.0 / xyz [1] illuminant [:,1] *= scaling return illuminant def get_constant_illuminant (): '''Get an illuminant, with spectrum constant over wavelength, normalized to Y = 1.0.''' illuminant = ciexyz.empty_spectrum() (num_wl, num_cols) = illuminant.shape for i in xrange (0, num_wl): illuminant [i][1] = 1.0 xyz = ciexyz.xyz_from_spectrum (illuminant) if xyz [1] != 0.0: scaling = 1.0 / xyz [1] illuminant [:,1] *= scaling return illuminant # Scale an illuminant by an arbitrary factor def scale_illuminant (illuminant, scaling): '''Scale the illuminant intensity by the specfied factor.''' illuminant [:,1] *= scaling return illuminant # Initialize at module startup init() # Figures - Plot some of the illuminants def figures (): '''Plot spectra for several illuminants.''' # D65 plots.spectrum_plot ( get_illuminant_D65(), 'CIE Illuminant D65', 'Illuminant-D65') # A plots.spectrum_plot ( get_illuminant_A(), 'CIE Illuminant A', 'Illuminant-A') # Constant plots.spectrum_plot ( get_constant_illuminant(), 'Constant Illuminant', 'Illuminant-Const') # Blackbody (5778) plots.spectrum_plot ( get_blackbody_illuminant (5778.0), '5778 K Illuminant', 'Illuminant-5778')
27.741403
106
0.555881
e3cb6664659c1efec8fe41651c43927d133e5bf2
10,046
py
Python
tests/unit/test_functions.py
noahsa/scikit-hts
db067f416172d18f7d0127150c45419883260d54
[ "MIT" ]
null
null
null
tests/unit/test_functions.py
noahsa/scikit-hts
db067f416172d18f7d0127150c45419883260d54
[ "MIT" ]
null
null
null
tests/unit/test_functions.py
noahsa/scikit-hts
db067f416172d18f7d0127150c45419883260d54
[ "MIT" ]
null
null
null
import numpy import pandas import hts.hierarchy from hts.functions import ( _create_bl_str_col, get_agg_series, get_hierarchichal_df, to_sum_mat, )
31.993631
86
0.429723
e3cbbca95424c00d63673acba3c061a2db999558
644
py
Python
tests/settings.py
team23/django_t10e
f25e8ac6507e05968d2dbf1003ec4cb9f35b627e
[ "BSD-3-Clause" ]
null
null
null
tests/settings.py
team23/django_t10e
f25e8ac6507e05968d2dbf1003ec4cb9f35b627e
[ "BSD-3-Clause" ]
2
2016-03-22T15:31:38.000Z
2016-04-05T08:59:39.000Z
tests/settings.py
team23/django_t10e
f25e8ac6507e05968d2dbf1003ec4cb9f35b627e
[ "BSD-3-Clause" ]
null
null
null
import os import warnings warnings.simplefilter('always') test_dir = os.path.dirname(os.path.abspath(__file__)) DATABASES = { 'default': { 'NAME': os.path.join(test_dir, 'db.sqlite'), 'ENGINE': 'django.db.backends.sqlite3', }, } USE_I18N = True USE_L10N = True INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.staticfiles', 'django_t10e', 'tests', ] STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ) MIDDLEWARE_CLASSES = () TEMPLATE_DIRS = ( os.path.join(test_dir, 'templates'), ) STATIC_URL = '/static/' SECRET_KEY = '0' SITE_ID = 1
16.512821
62
0.669255
e3cc45c059a23522906c2bbff40ce8bfec753ce5
3,101
py
Python
medium/380-Insert Delete GetRandom O(1).py
Davidxswang/leetcode
d554b7f5228f14c646f726ddb91014a612673e06
[ "Apache-2.0" ]
2
2020-05-08T02:17:17.000Z
2020-05-17T04:55:56.000Z
medium/380-Insert Delete GetRandom O(1).py
Davidxswang/leetcode
d554b7f5228f14c646f726ddb91014a612673e06
[ "Apache-2.0" ]
null
null
null
medium/380-Insert Delete GetRandom O(1).py
Davidxswang/leetcode
d554b7f5228f14c646f726ddb91014a612673e06
[ "Apache-2.0" ]
null
null
null
""" https://leetcode.com/problems/insert-delete-getrandom-o1/ Implement the RandomizedSet class: bool insert(int val) Inserts an item val into the set if not present. Returns true if the item was not present, false otherwise. bool remove(int val) Removes an item val from the set if present. Returns true if the item was present, false otherwise. int getRandom() Returns a random element from the current set of elements (it's guaranteed that at least one element exists when this method is called). Each element must have the same probability of being returned. Follow up: Could you implement the functions of the class with each function works in average O(1) time? Example 1: Input ["RandomizedSet", "insert", "remove", "insert", "getRandom", "remove", "insert", "getRandom"] [[], [1], [2], [2], [], [1], [2], []] Output [null, true, false, true, 2, true, false, 2] Explanation RandomizedSet randomizedSet = new RandomizedSet(); randomizedSet.insert(1); // Inserts 1 to the set. Returns true as 1 was inserted successfully. randomizedSet.remove(2); // Returns false as 2 does not exist in the set. randomizedSet.insert(2); // Inserts 2 to the set, returns true. Set now contains [1,2]. randomizedSet.getRandom(); // getRandom() should return either 1 or 2 randomly. randomizedSet.remove(1); // Removes 1 from the set, returns true. Set now contains [2]. randomizedSet.insert(2); // 2 was already in the set, so return false. randomizedSet.getRandom(); // Since 2 is the only number in the set, getRandom() will always return 2. Constraints: -231 <= val <= 231 - 1 At most 105 calls will be made to insert, remove, and getRandom. There will be at least one element in the data structure when getRandom is called. """ # time complexity: O(1), space complexity: O(n) # Your RandomizedSet object will be instantiated and called as such: # obj = RandomizedSet() # param_1 = obj.insert(val) # param_2 = obj.remove(val) # param_3 = obj.getRandom()
35.643678
215
0.660755
e3cd17e1ce16cc51bbf2c4408a071cf80ad1dcea
851
py
Python
src/main/generic_cpu/test3/generic_cpu.py
cicerone/kosim
a9f718a19019c11fd6e6c6fc0164d4d214bbb5e2
[ "BSL-1.0" ]
2
2019-11-15T19:15:36.000Z
2022-03-14T12:53:18.000Z
src/main/generic_cpu/test3/generic_cpu.py
cicerone/kosim
a9f718a19019c11fd6e6c6fc0164d4d214bbb5e2
[ "BSL-1.0" ]
null
null
null
src/main/generic_cpu/test3/generic_cpu.py
cicerone/kosim
a9f718a19019c11fd6e6c6fc0164d4d214bbb5e2
[ "BSL-1.0" ]
null
null
null
#!/usr/bin/env python #============================================================================================== # Copyright (c) 2009 Kotys LLC. Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # Author: Cicerone Mihalache # Support: kosim@kotys.biz #============================================================================================== import sys import libkosim_generic_cpu_test3 as kosim_generic_cpu #print len(sys.argv) #for arg in sys.argv: # print "arg(%s)\n" % (arg) opt_builder = kosim_generic_cpu.OptionsBuilder() for arg in sys.argv: opt_builder.SetArgument(arg) opt_builder.BuildArgv() opt_builder.InitProgramOptions() kosim_generic_cpu.run_sim() print "--- Test DONE ---"
31.518519
95
0.551116
e3cfcef261416f1b7213e8dce2b540fc137ab1f5
7,491
py
Python
smartools/patches/sheets.py
davocarli/smartools
57e6233efe8da6b34557f99e8d7c24eef77cfd9d
[ "MIT" ]
2
2021-01-01T17:34:02.000Z
2021-01-07T13:23:00.000Z
smartools/patches/sheets.py
davocarli/smartools
57e6233efe8da6b34557f99e8d7c24eef77cfd9d
[ "MIT" ]
null
null
null
smartools/patches/sheets.py
davocarli/smartools
57e6233efe8da6b34557f99e8d7c24eef77cfd9d
[ "MIT" ]
null
null
null
import smartsheet # from smartsheet.smartsheet import fresh_operation from .__smartools import SmartoolsObject, access_levels, RequirementError from .typed_list import SmartoolsTypedList smart = smartsheet.Smartsheet("INIT") smart.Sheets # Perform Monkey Patch smartsheet.sheets.Sheets = SmartoolsSheets smartsheet.models.sheet.TypedList = SmartoolsTypedList smartsheet.models.row.TypedList = SmartoolsTypedList
34.84186
165
0.707916
e3cfd1eba8567bcfd38dbc01b741198461b5c024
3,119
py
Python
modules/persons/application/controllers/v1/phone/create_phone_controller.py
eduardolujan/hexagonal_architecture_django
8055927cb460bc40f3a2651c01a9d1da696177e8
[ "BSD-3-Clause" ]
6
2020-08-09T23:41:08.000Z
2021-03-16T22:05:40.000Z
modules/persons/application/controllers/v1/phone/create_phone_controller.py
eduardolujan/hexagonal_architecture_django
8055927cb460bc40f3a2651c01a9d1da696177e8
[ "BSD-3-Clause" ]
1
2020-10-02T02:59:38.000Z
2020-10-02T02:59:38.000Z
modules/persons/application/controllers/v1/phone/create_phone_controller.py
eduardolujan/hexagonal_architecture_django
8055927cb460bc40f3a2651c01a9d1da696177e8
[ "BSD-3-Clause" ]
2
2021-03-16T22:05:43.000Z
2021-04-30T06:35:25.000Z
# -*- coding: utf-8 -*- # Infra from modules.shared.infrastructure.log import LoggerDecorator, PyLoggerService # Application from modules.persons.application.create import PhoneCreator from modules.persons.application.create.command import CreatePhoneCommand # Domain from modules.shared.domain.http import status as http_status from modules.shared.domain.requests import Request from modules.shared.domain.responses import Response from modules.shared.domain.serializers import SerializerManager from modules.shared.domain.repository import UnitOfWork from modules.shared.domain.bus.event import EventBus from modules.persons.domain.repository import PhoneRepository
36.267442
83
0.631613
e3cfd93cdd0841ab2b66bf374189846ddaaf186d
5,651
py
Python
tests/test_dispatch_sparql_query_model_catalog.py
KnowledgeCaptureAndDiscovery/OBA_sparql
9c1c28902ab3d6561b3b6a0f8a7d284688d86326
[ "Apache-2.0" ]
5
2020-05-12T22:00:16.000Z
2021-11-08T22:16:11.000Z
tests/test_dispatch_sparql_query_model_catalog.py
KnowledgeCaptureAndDiscovery/OBA_sparql
9c1c28902ab3d6561b3b6a0f8a7d284688d86326
[ "Apache-2.0" ]
24
2019-09-26T23:20:11.000Z
2022-01-14T14:19:14.000Z
tests/test_dispatch_sparql_query_model_catalog.py
KnowledgeCaptureAndDiscovery/OBA_sparql
9c1c28902ab3d6561b3b6a0f8a7d284688d86326
[ "Apache-2.0" ]
1
2021-12-01T14:56:09.000Z
2021-12-01T14:56:09.000Z
import json import logging import unittest from typing import Dict from SPARQLWrapper import JSONLD from obasparql.query_manager import QueryManager, QUERIES_TYPES, QUERY_TYPE_GET_ONE_USER from obasparql.utils import generate_uri from tests.settings import * logger = logging.getLogger('testing') graph_user = generate_uri(model_catalog_graph_base, "mint@isi.edu") if __name__ == '__main__': unittest.main()
36.694805
463
0.585914
e3d014948574aa9afc4263cc074b784b2bb1665c
1,538
py
Python
cogs/ObjectCache.py
Deivedux/Shiramine
bbaf651a4ccd5f65c8aef1eb09ba8899bb2958db
[ "MIT" ]
6
2019-03-20T15:15:31.000Z
2022-02-23T20:11:24.000Z
cogs/ObjectCache.py
Deivedux/Shiramine
bbaf651a4ccd5f65c8aef1eb09ba8899bb2958db
[ "MIT" ]
1
2021-11-20T00:25:48.000Z
2021-11-20T00:25:48.000Z
cogs/ObjectCache.py
Deivedux/Shiramine
bbaf651a4ccd5f65c8aef1eb09ba8899bb2958db
[ "MIT" ]
8
2019-11-22T05:56:40.000Z
2021-12-04T17:38:38.000Z
import time import json import sqlite3 import os conn = sqlite3.connect('configs/Database.db') c = conn.cursor() start_time = time.time() with open('configs/config.json') as json_data: config = json.load(json_data) server_config_raw = c.execute("SELECT * FROM ServerConfig").fetchall() server_config = {} for i in server_config_raw: server_cache(i) del server_config_raw db_response = c.execute("SELECT * FROM URLFilters").fetchall() url_filters = dict() for i in db_response: url_filter_cache(i) response_string = {} for i in os.listdir('./languages'): if i.endswith('.json'): with open(os.path.join('./languages', i)) as file: response = json.load(file) response_string[i.strip('.json')] = response
27.464286
80
0.737321
e3d079b0ac366654644d7bfe8c3c51abdf0bef18
308
py
Python
Afvaldienst/__init__.py
xirixiz/python-afvalwijzer-afvalstoffendienst
ef76b07033848a6f7092e941c6c4a3ec214f2842
[ "MIT" ]
1
2019-10-28T12:26:14.000Z
2019-10-28T12:26:14.000Z
Afvaldienst/__init__.py
xirixiz/afvaldienst
ef76b07033848a6f7092e941c6c4a3ec214f2842
[ "MIT" ]
3
2020-09-11T08:38:50.000Z
2020-09-23T07:08:44.000Z
Afvaldienst/__init__.py
xirixiz/python-afvalwijzer-afvalstoffendienst
ef76b07033848a6f7092e941c6c4a3ec214f2842
[ "MIT" ]
null
null
null
__author__ = 'Bram van Dartel - xirixiz' __author_email__ = 'spam@rootrulez.com' __license__ = 'MIT' __maintainer_email__ = 'spam@rootrulez.com' __url__ = 'https://github.com/xirixiz/afvaldienst', __version__ = '1.1.4' from .Afvaldienst import Afvaldienst from .AfvaldienstScraper import AfvaldienstScraper
30.8
51
0.788961
e3d0ea8dfddd487de8fd53ee32a9b4f750e83af2
4,749
py
Python
src/python_lib_for_me/date.py
silverag-corgi/python-lib-for-me
ed30c7b879396ca6af53c762d7c919b0ea44bea7
[ "MIT" ]
null
null
null
src/python_lib_for_me/date.py
silverag-corgi/python-lib-for-me
ed30c7b879396ca6af53c762d7c919b0ea44bea7
[ "MIT" ]
1
2022-02-06T08:21:56.000Z
2022-02-06T15:48:26.000Z
src/python_lib_for_me/date.py
silverag-corgi/python-lib-for-me
ed30c7b879396ca6af53c762d7c919b0ea44bea7
[ "MIT" ]
null
null
null
''' ''' import calendar from datetime import date, datetime, timedelta from typing import Iterator from zoneinfo import ZoneInfo from dateutil.relativedelta import relativedelta def get_first_date_of_this_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=0) base_date_by_month_day: date = base_date_by_month.replace( day=1 ) return base_date_by_month_day def get_last_date_of_this_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=0) base_date_by_month_day: date = base_date_by_month.replace( day=calendar.monthrange(base_date_by_month.year, base_date_by_month.month)[1] ) return base_date_by_month_day def get_first_date_of_next_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=1) base_date_by_month_day: date = base_date_by_month.replace( day=1 ) return base_date_by_month_day def get_last_date_of_next_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=1) base_date_by_month_day: date = base_date_by_month.replace( day=calendar.monthrange(base_date_by_month.year, base_date_by_month.month)[1] ) return base_date_by_month_day def get_first_date_of_last_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=-1) base_date_by_month_day: date = base_date_by_month.replace( day=1 ) return base_date_by_month_day def get_last_date_of_last_month(base_date: date) -> date: ''' Args: base_date (date): Returns: date: ''' base_date_by_month: date = base_date + relativedelta(months=-1) base_date_by_month_day: date = base_date_by_month.replace( day=calendar.monthrange(base_date_by_month.year, base_date_by_month.month)[1] ) return base_date_by_month_day def convert_timestamp_to_jst( src_timestamp: str, src_timestamp_format: str = '%Y-%m-%d %H:%M:%S%z', jst_timestamp_format: str = '%Y-%m-%d %H:%M:%S' ) -> str: ''' JST Args: src_timestamp (str) : src_timestamp_format (str, optional) : jst_timestamp_format (str, optional) : (JST) Returns: str: (JST) ''' src_datetime: datetime = datetime.strptime(src_timestamp, src_timestamp_format) jst_datetime: datetime = src_datetime.astimezone(ZoneInfo('Japan')) jst_timestamp: str = datetime.strftime(jst_datetime, jst_timestamp_format) return jst_timestamp def convert_timestamp_to_utc( src_timestamp: str, src_timestamp_format: str = '%Y-%m-%d %H:%M:%S%z', utc_timestamp_format: str = '%Y-%m-%d %H:%M:%S' ) -> str: ''' UTC Args: src_timestamp (str) : src_timestamp_format (str, optional) : utc_timestamp_format (str, optional) : (UTC) Returns: str: (UTC) ''' src_datetime: datetime = datetime.strptime(src_timestamp, src_timestamp_format) utc_datetime: datetime = src_datetime.astimezone(ZoneInfo('UTC')) utc_timestamp: str = datetime.strftime(utc_datetime, utc_timestamp_format) return utc_timestamp
24.863874
90
0.606443
e3d1710232166bf85532195c15df881b2381f79f
267
py
Python
tpi/main.py
karajan1001/tpi
c7259a8fea023797058deaf487700645df5fe210
[ "Apache-2.0" ]
5
2021-09-04T05:02:59.000Z
2021-09-30T18:23:42.000Z
tpi/main.py
karajan1001/tpi
c7259a8fea023797058deaf487700645df5fe210
[ "Apache-2.0" ]
14
2021-09-07T15:17:27.000Z
2021-10-08T01:09:41.000Z
tpi/main.py
karajan1001/tpi
c7259a8fea023797058deaf487700645df5fe210
[ "Apache-2.0" ]
6
2021-09-06T08:52:04.000Z
2022-02-07T21:43:48.000Z
import argparse import logging log = logging.getLogger(__name__)
16.6875
48
0.715356
e3d176bb8a4ef4588c81f92f7a9d84251d18fd27
2,948
py
Python
catkin_ws/src/easter_egg_hunt/scripts/waypoint_states.py
pdscraml/bunny-hunter
7d6951f5cbcc46ec31c8b17dc66a6297cc4d7536
[ "Apache-2.0" ]
null
null
null
catkin_ws/src/easter_egg_hunt/scripts/waypoint_states.py
pdscraml/bunny-hunter
7d6951f5cbcc46ec31c8b17dc66a6297cc4d7536
[ "Apache-2.0" ]
null
null
null
catkin_ws/src/easter_egg_hunt/scripts/waypoint_states.py
pdscraml/bunny-hunter
7d6951f5cbcc46ec31c8b17dc66a6297cc4d7536
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # Intro to Robotics - EE5900 - Spring 2017 # Final Project # Philip (Team Lead) # Ian # Akhil # # Revision: v1.2 # imports import rospy import smach import smach_ros import time import actionlib from easter_egg_hunt.srv import EnableDiscovery from move_base_msgs.msg import MoveBaseGoal, MoveBaseAction from ar_track_alvar_msgs.msg._AlvarMarkers import AlvarMarkers from easter_egg_hunt.msg import DiscoveredWaypoints
33.123596
142
0.684871
e3d20c80e3fd93f5b987a741bdb20323be97f451
209
py
Python
templates/hello/views.py
cesarau04/python-react-webapp
305f69693313065a9ebbe116a34fd27111c86851
[ "0BSD" ]
null
null
null
templates/hello/views.py
cesarau04/python-react-webapp
305f69693313065a9ebbe116a34fd27111c86851
[ "0BSD" ]
1
2021-03-10T10:17:52.000Z
2021-03-10T10:17:52.000Z
templates/hello/views.py
cesarau04/python-react-webapp
305f69693313065a9ebbe116a34fd27111c86851
[ "0BSD" ]
null
null
null
from flask import render_template, Blueprint hello_blueprint = Blueprint('hello', __name__)
23.222222
46
0.760766
e3d2b660c79791266d30c8a38f66f8ca7ec0c0c0
682
py
Python
project/api/views.py
akxen/pyomo-drf-docker
9299561e61ce0cc6b40968e078aea84bded1228b
[ "Apache-2.0" ]
null
null
null
project/api/views.py
akxen/pyomo-drf-docker
9299561e61ce0cc6b40968e078aea84bded1228b
[ "Apache-2.0" ]
null
null
null
project/api/views.py
akxen/pyomo-drf-docker
9299561e61ce0cc6b40968e078aea84bded1228b
[ "Apache-2.0" ]
null
null
null
from django.shortcuts import render from django.http import HttpResponse from rest_framework import status from rest_framework.views import APIView from rest_framework.response import Response from .serializers import ModelDataSerializer from .optimisation.model import run_model
31
78
0.758065
e3d5b6ff47680e0205ffd2a767cb7c6b5cf84622
1,456
py
Python
icees_api/features/qgraph_utils.py
xu-hao/ddcr-api
f69c80a84d413078bd36985b6579d2bc32329b8f
[ "MIT" ]
2
2018-10-03T16:58:57.000Z
2021-10-04T22:10:48.000Z
icees_api/features/qgraph_utils.py
xu-hao/ddcr-api
f69c80a84d413078bd36985b6579d2bc32329b8f
[ "MIT" ]
195
2019-06-26T17:56:33.000Z
2022-03-30T20:46:05.000Z
icees_api/features/qgraph_utils.py
xu-hao/ddcr-api
f69c80a84d413078bd36985b6579d2bc32329b8f
[ "MIT" ]
5
2018-09-10T19:45:29.000Z
2020-10-26T17:59:05.000Z
"""Query graph utilities.""" import re from bmt import Toolkit BMT = Toolkit() def get_subcategories(category): """Get sub-categories, according to the Biolink model.""" return [ descendant.replace("_", "") for descendant in BMT.get_descendants(category, formatted=True, reflexive=True) ] def camelcase_to_snakecase(string): """Convert CamelCase to snake_case.""" return re.sub(r"(?<!^)(?=[A-Z])", "_", string).lower() def get_subpredicates(predicate): """Get sub-predicates, according to the Biolink model.""" curies = BMT.get_descendants(predicate, formatted=True, reflexive=True) return [ "biolink:" + camelcase_to_snakecase(curie[8:]) for curie in curies ] def normalize_qgraph(qgraph): """Normalize query graph.""" for node in qgraph["nodes"].values(): node["categories"] = [ descendant for category in node.get("categories", None) or ["biolink:NamedThing"] for descendant in get_subcategories(category) ] if "biolink:SmallMolecule" in node["categories"]: node["categories"].append("biolink:ChemicalSubstance") node.pop("is_set", None) for edge in qgraph["edges"].values(): edge["predicates"] = [ descendant for predicate in edge.get("predicates", None) or ["biolink:related_to"] for descendant in get_subpredicates(predicate) ]
30.333333
87
0.632555
e3d5f08a740b483f1653463909ea2ce9beb6acde
3,493
py
Python
toy-evolve/weno.py
IanHawke/toy-evolve
a1490327dd19492e2c0bb0d9c6909abe8b167135
[ "MIT" ]
null
null
null
toy-evolve/weno.py
IanHawke/toy-evolve
a1490327dd19492e2c0bb0d9c6909abe8b167135
[ "MIT" ]
null
null
null
toy-evolve/weno.py
IanHawke/toy-evolve
a1490327dd19492e2c0bb0d9c6909abe8b167135
[ "MIT" ]
null
null
null
import numpy C_3 = numpy.array([1, 2]) / 3 a_3 = numpy.array([[3, -1], [1, 1]]) / 2 sigma_3 = numpy.array([[[1, 0], [-2, 1]], [[1, 0], [-2, 1]]]) C_5 = numpy.array([1, 6, 3]) / 10 a_5 = numpy.array([[11, -7, 2], [2, 5, -1], [-1, 5, 2]]) / 6 sigma_5 = numpy.array([[[40, 0, 0], [-124, 100, 0], [44, -76, 16] ], [[16, 0, 0], [-52, 52, 0], [20, -52, 16] ], [[16, 0, 0], [-76, 44, 0], [100, -124, 40] ] ]) / 12 C_all = { 2 : C_3, 3 : C_5 } a_all = { 2 : a_3, 3 : a_5 } sigma_all = { 2 : sigma_3, 3 : sigma_5 }
32.342593
80
0.488405
e3d6ee49185d1368971f9d3c026c6acc53822813
2,832
py
Python
tests/test_optimize.py
ricosjp/siml
8fc07d798cdedd77622c16221ee44a575d36bad0
[ "Apache-2.0" ]
11
2020-12-28T16:22:33.000Z
2021-11-14T17:09:27.000Z
tests/test_optimize.py
ricosjp/siml
8fc07d798cdedd77622c16221ee44a575d36bad0
[ "Apache-2.0" ]
null
null
null
tests/test_optimize.py
ricosjp/siml
8fc07d798cdedd77622c16221ee44a575d36bad0
[ "Apache-2.0" ]
2
2021-04-28T09:41:47.000Z
2021-07-01T21:18:51.000Z
from pathlib import Path import shutil import unittest import numpy as np import siml.optimize as optimize import siml.setting as setting
35.848101
77
0.611935
e3d7620b8331f1df9da2a2562c6b4d96e926fba0
1,773
py
Python
demo.py
natekspencer/vivintpy
ea65b05871b3f13326ba370112357a6696793bf6
[ "MIT" ]
3
2022-02-10T14:08:59.000Z
2022-03-30T18:55:25.000Z
demo.py
natekspencer/pyvivint
ea65b05871b3f13326ba370112357a6696793bf6
[ "MIT" ]
null
null
null
demo.py
natekspencer/pyvivint
ea65b05871b3f13326ba370112357a6696793bf6
[ "MIT" ]
2
2021-10-31T01:43:26.000Z
2021-11-21T13:33:55.000Z
import asyncio import logging import os import pubnub from vivintpy.account import Account from vivintpy.devices import VivintDevice from vivintpy.devices.camera import MOTION_DETECTED, Camera from vivintpy.exceptions import VivintSkyApiMfaRequiredError pubnub.set_stream_logger(name="pubnub", level=logging.ERROR) if __name__ == "__main__": asyncio.run(main())
31.105263
87
0.648054
e3db1939642019da218fde1bd068b8be2f4606ff
3,811
py
Python
qanda/views.py
Fnechz/StakeOverflow-Clone
7f17bdb80ebc23a2a5210eb31db6121c5d41e70c
[ "MIT" ]
null
null
null
qanda/views.py
Fnechz/StakeOverflow-Clone
7f17bdb80ebc23a2a5210eb31db6121c5d41e70c
[ "MIT" ]
null
null
null
qanda/views.py
Fnechz/StakeOverflow-Clone
7f17bdb80ebc23a2a5210eb31db6121c5d41e70c
[ "MIT" ]
null
null
null
from django.contrib.auth.mixins import LoginRequiredMixin from django.http.response import HttpResponseRedirect, HttpResponseBadRequest from django.urls.base import reverse from django.utils import timezone from django.views.generic import ( CreateView, DayArchiveView, DetailView, RedirectView, TemplateView, UpdateView, ) from qanda.forms import QuestionForm, AnswerForm, AnswerAcceptanceForm from qanda.models import Question, Answer from qanda.service.elasticsearch import search_for_questions from django.shortcuts import render # Creating my views here.
26.282759
78
0.708738
e3ddafddccd1aee845e95e14e1da8e8b355c53a4
92,214
py
Python
incubator/bootstrap_cli/__main__.py
cognitedata/inso-bootstrap-cli
d2ed0e575703acc7af2a11212357b6fd439f5279
[ "Apache-2.0" ]
null
null
null
incubator/bootstrap_cli/__main__.py
cognitedata/inso-bootstrap-cli
d2ed0e575703acc7af2a11212357b6fd439f5279
[ "Apache-2.0" ]
7
2022-02-16T12:46:33.000Z
2022-03-30T15:58:45.000Z
incubator/bootstrap_cli/__main__.py
cognitedata/inso-bootstrap-cli
d2ed0e575703acc7af2a11212357b6fd439f5279
[ "Apache-2.0" ]
null
null
null
# 888 888 # 888 888 # 888 888 # .d8888b 88888b. 8888b. 88888b. .d88b. .d88b. 888 .d88b. .d88b. # d88P" 888 "88b "88b 888 "88b d88P"88b d8P Y8b 888 d88""88b d88P"88b # 888 888 888 .d888888 888 888 888 888 88888888 888 888 888 888 888 # Y88b. 888 888 888 888 888 888 Y88b 888 Y8b. 888 Y88..88P Y88b 888 # "Y8888P 888 888 "Y888888 888 888 "Y88888 "Y8888 888 "Y88P" "Y88888 # 888 888 # Y8b d88P Y8b d88P # "Y88P" "Y88P" # # 210504 mh: # * Adding support for minimum groups and project capabilities for read and owner Groups # * Exception handling for root-groups to avoid duplicate groups and projects capabilities # 210610 mh: # * Adding RAW DBs and Datasets for Groups {env}:allprojects:{owner/read} and {env}:{group}:allprojects:{owner/read} # * Adding functionality for updating dataset details (external id, description, etc) based on the config.yml # 210910 pa: # * extended acl_default_types by labels, relationships, functions # * removed labels from acl_admin_types # * functions don't have dataset scope # 211013 pa: # * renamed "adfs" to "aad" terminology => aad_mappings # * for AAD 'root:client' and 'root:user' can be merged into 'root' # 211014 pa: # * adding new capabilities # extractionpipelinesAcl # extractionrunsAcl # 211108 pa: # * adding new capabilities # entitymatchingAcl # * refactor list of acl types which only support "all" scope # acl_all_scope_only_types # * support "labels" for non admin groups # 211110 pa: # * adding new capabilities # sessionsAcl # 220202 pa: # * adding new capabilities # typesAcl # 220216 pa: # * adding 'generate_special_groups()' to handle # 'extractors' and 'transformations' and their 'aad_mappings' # * configurable through `deploy --with-special-groups=[yes|no]` parameter # * adding new capabilities: # transformationsAcl (replacing the need for magic "transformations" CDF Group) # 220404 pa: # * v1.4.0 limited datasets for 'owner' that they cannot edit or create datasets # * removed `datasets:write` capability # * moved that capability to action_dimensions['admin'] # 220405 sd: # * v1.5.0 added dry-run mode as global parameter for all commands # 220405 pa: # * v1.6.0 # * removed 'transformation' acl from 'acl_all_scope_only_types' # as it now supports dataset scopes too! # * refactor variable names to match the new documentation # 1. group_types_dimensions > group_bootstrap_hierarchy # 2. group_type > ns_name (namespace: src, ca, uc) # 3. group_prefix > node_name (src:001:sap) # 220406 pa/sd: # * v1.7.0 # * added 'diagram' command which creates a Mermaid (diagram as code) output # 220406 pa: # * v1.7.1 # * started to use '# fmt:skip' to save intended multiline formatted and indented code # from black auto-format # 220420 pa: # * v.1.9.2 # * fixed Poetry on Windows issues # 220422 pa: # * v1.10.0 # * issue #28 possibility to skip creation of RAW DBs # * added '--with-raw-capability' parameter for 'deploy' and 'diagram' commands # 220424 pa: # * introduced CommandMode enums to support more detailed BootstrapCore initialization # * started with validation-functions ('validate_config_is_cdf_project_in_mappings') # * for 'diagram' command # - made 'cognite' section optional # - added support for parameter '--cdf-project' to explicit diagram a specific CDF Project # - Added cdf-project name to diagram "IdP Groups for CDF: <>" subgraph title # - renamed mermaid properties from 'name/short' to 'id_name/display' # * documented config-deploy-example-v2.yml # 220511 pa: v2.0.0 release :) import logging import time # from dataclasses import dataclass, field from datetime import datetime from enum import Enum from itertools import islice from pathlib import Path from typing import Any, Dict, List, Optional, Set, Tuple, TypeVar import click import pandas as pd import yaml from click import Context from cognite.client.data_classes import DataSet, Group from cognite.client.data_classes.data_sets import DataSetUpdate from cognite.extractorutils.configtools import CogniteClient from dotenv import load_dotenv # cli internal from incubator.bootstrap_cli import __version__ from incubator.bootstrap_cli.configuration import ( BootstrapConfigError, BootstrapDeleteConfig, BootstrapDeployConfig, BootstrapValidationError, CommandMode, SharedAccess, YesNoType, ) from incubator.bootstrap_cli.mermaid_generator.mermaid import ( AssymetricNode, DottedEdge, Edge, GraphRegistry, Node, RoundedNode, SubroutineNode, TrapezNode, ) # ''' # 888 888 888 .d888 d8b # 888 888 888 d88P" Y8P # 888 888 888 888 # .d88b. 888 .d88b. 88888b. 8888b. 888 .d8888b .d88b. 88888b. 888888 888 .d88b. .d8888b # d88P"88b 888 d88""88b 888 "88b "88b 888 d88P" d88""88b 888 "88b 888 888 d88P"88b 88K # 888 888 888 888 888 888 888 .d888888 888 888 888 888 888 888 888 888 888 888 "Y8888b. # Y88b 888 888 Y88..88P 888 d88P 888 888 888 Y88b. Y88..88P 888 888 888 888 Y88b 888 X88 # "Y88888 888 "Y88P" 88888P" "Y888888 888 "Y8888P "Y88P" 888 888 888 888 "Y88888 88888P' # 888 888 # Y8b d88P Y8b d88P # "Y88P" "Y88P" # ''' _logger = logging.getLogger(__name__) # because within f'' strings no backslash-character is allowed NEWLINE = "\n" # capabilities (acl) which only support scope: {"all":{}} acl_all_scope_only_types = set( [ "projects", "sessions", "functions", "entitymatching", "types", "threed", ] ) # lookup of non-default actions per capability (acl) and role (owner/read/admin) action_dimensions = { # owner datasets might only need READ and OWNER "owner": { # else ["READ","WRITE"] "raw": ["READ", "WRITE", "LIST"], "datasets": ["READ", "OWNER"], "groups": ["LIST"], "projects": ["LIST"], "sessions": ["LIST", "CREATE"], "threed": ["READ", "CREATE", "UPDATE", "DELETE"], }, "read": { # else ["READ"] "raw": ["READ", "LIST"], "groups": ["LIST"], "projects": ["LIST"], "sessions": ["LIST"], }, "admin": { "datasets": ["READ", "WRITE", "OWNER"], "groups": ["LIST", "READ", "CREATE", "UPDATE", "DELETE"], "projects": ["READ", "UPDATE", "LIST"], }, } # # GENERIC configurations # extend when new capability (acl) is available # check if action_dimensions must be extended with non-default capabilities: # which are owner: ["READ","WRITE"] # and read: ["READ"]) # acl_default_types = [ "assets", "datasets", "entitymatching", "events", "extractionPipelines", "extractionRuns", "files", "functions", "groups", "labels", "projects", "raw", "relationships", "sequences", "sessions", "timeSeries", "transformations", "types", "threed", ] # give precedence when merging over acl_default_types acl_admin_types = list(action_dimensions["admin"].keys()) # ''' # 888888b. 888 888 .d8888b. # 888 "88b 888 888 d88P Y88b # 888 .88P 888 888 888 888 # 8888888K. .d88b. .d88b. 888888 .d8888b 888888 888d888 8888b. 88888b. 888 .d88b. 888d888 .d88b. # 888 "Y88b d88""88b d88""88b 888 88K 888 888P" "88b 888 "88b 888 d88""88b 888P" d8P Y8b # 888 888 888 888 888 888 888 "Y8888b. 888 888 .d888888 888 888 888 888 888 888 888 88888888 # 888 d88P Y88..88P Y88..88P Y88b. X88 Y88b. 888 888 888 888 d88P Y88b d88P Y88..88P 888 Y8b. # 8888888P" "Y88P" "Y88P" "Y888 88888P' "Y888 888 "Y888888 88888P" "Y8888P" "Y88P" 888 "Y8888 # 888 # 888 # 888 # ''' # type-hint for ExtpipesCore instance response T_BootstrapCore = TypeVar("T_BootstrapCore", bound="BootstrapCore") def generate_group_name_and_capabilities( self, action: str = None, ns_name: str = None, node_name: str = None, root_account: str = None ) -> Tuple[str, List[Dict[str, Any]]]: """Create the group-name and its capabilities. The function supports following levels expressed by parameter combinations: - core: {action} + {ns_name} + {node_name} - namespace: {action} + {ns_name} - top-level: {action} - root: {root_account} Args: action (str, optional): One of the action_dimensions ["read", "owner"]. Defaults to None. ns_name (str, optional): Namespace like "src" or "uc". Defaults to None. node_name (str, optional): Core group like "src:001:sap" or "uc:003:demand". Defaults to None. root_account (str, optional): Name of the root-account. Defaults to None. Returns: Tuple[str, List[Dict[str, Any]]]: group-name and list of capabilities """ capabilities = [] # detail level like cdf:src:001:public:read if action and ns_name and node_name: # group for each dedicated group-core id group_name_full_qualified = f"{BootstrapCore.GROUP_NAME_PREFIX}{node_name}:{action}" [ capabilities.append( # type: ignore { f"{acl_type}Acl": self.acl_template( # check for acl specific owner actions, else default actions=self.generate_default_action(shared_action, acl_type), scope=self.generate_scope(acl_type, scope_ctx), ) } ) for acl_type in acl_default_types for shared_action, scope_ctx in self.get_scope_ctx_groupedby_action(action, ns_name, node_name).items() # don't create empty scopes # enough to check one as they have both same length, but that's more explicit if scope_ctx["raw"] and scope_ctx["datasets"] ] # group-type level like cdf:src:all:read elif action and ns_name: # 'all' groups on group-type level # (access to all datasets/ raw-dbs which belong to this group-type) group_name_full_qualified = ( f"{BootstrapCore.GROUP_NAME_PREFIX}{ns_name}:{BootstrapCore.AGGREGATED_LEVEL_NAME}:{action}" ) [ capabilities.append( # type: ignore { f"{acl_type}Acl": self.acl_template( # check for acl specific owner actions, else default actions=self.generate_default_action(shared_action, acl_type), scope=self.generate_scope(acl_type, scope_ctx), ) } ) for acl_type in acl_default_types for shared_action, scope_ctx in self.get_scope_ctx_groupedby_action(action, ns_name).items() # don't create empty scopes # enough to check one as they have both same length, but that's more explicit if scope_ctx["raw"] and scope_ctx["datasets"] ] # top level like cdf:all:read elif action: # 'all' groups on action level (no limits to datasets or raw-dbs) group_name_full_qualified = ( f"{BootstrapCore.GROUP_NAME_PREFIX}{BootstrapCore.AGGREGATED_LEVEL_NAME}:{action}" ) [ capabilities.append( # type: ignore { f"{acl_type}Acl": self.acl_template( # check for acl specific owner actions, else default actions=self.generate_default_action(action, acl_type), # scope = { "all": {} } # create scope for all raw_dbs and datasets scope=self.generate_scope(acl_type, self.all_scope_ctx), ) } ) for acl_type in acl_default_types ] # root level like cdf:root elif root_account: # no parameters # all (no limits) group_name_full_qualified = f"{BootstrapCore.GROUP_NAME_PREFIX}{root_account}" # all default ACLs [ capabilities.append( # type: ignore { f"{acl_type}Acl": self.acl_template( # check for acl specific owner actions, else default actions=self.generate_default_action("owner", acl_type), scope={"all": {}}, ) } ) # skipping admin types from default types to avoid duplicates for acl_type in (set(acl_default_types) - set(acl_admin_types)) ] # plus admin ACLs [ capabilities.append( # type: ignore { f"{acl_admin_type}Acl": self.acl_template( # check for acl specific owner actions, else default actions=self.generate_admin_action(acl_admin_type), scope={"all": {}}, ) } ) for acl_admin_type in acl_admin_types ] return group_name_full_qualified, capabilities def get_group_ids_by_name(self, group_name: str) -> List[int]: """Lookup if CDF Group name exists (could be more than one!) and return list of all CDF Group IDs Args: group_name (str): CDF Group name to check Returns: List[int]: of CDF Group IDs """ return self.deployed["groups"].query("name == @group_name")["id"].tolist() # return self.deployed["groups"].query("name == @group_payload['name']")["id"].tolist() # TODO 220203 pa: explicit providing 'group_name' # to bypass a strange bug under Docker which throws a # pandas.core.computation.ops.UndefinedVariableError: # name 'str_0_0x900xd80x90xec0x870x7f0x00x0' is not defined def create_group( self, group_name: str, group_capabilities: Dict[str, Any] = None, idp_mapping: Tuple[str] = None, ) -> Group: """Creating a CDF Group - with upsert support the same way Fusion updates CDF Groups if a group with the same name exists: 1. a new group with the same name will be created 2. then the old group will be deleted (by its 'id') - with support of explicit given aad-mapping or internal lookup from config Args: group_name (str): name of the CDF Group (always prefixed with GROUP_NAME_PREFIX) group_capabilities (List[Dict[str, Any]], optional): Defining the CDF Group capabilities. aad_mapping (Tuple[str, str], optional): Tuple of ({AAD SourceID}, {AAD SourceName}) to link the CDF Group to Returns: Group: the new created CDF Group """ idp_source_id, idp_source_name = None, None if idp_mapping: # explicit given # TODO: change from tuple to dataclass if len(idp_mapping) != 2: raise ValueError(f"Expected a tuple of length 2, got {idp_mapping=} instead") idp_source_id, idp_source_name = idp_mapping else: # check lookup from provided config mapping = self.bootstrap_config.get_idp_cdf_mapping_for_group( cdf_project=self.cdf_project, cdf_group=group_name ) # unpack idp_source_id, idp_source_name = mapping.idp_source_id, mapping.idp_source_name # check if group already exists, if yes it will be deleted after a new one is created old_group_ids = self.get_group_ids_by_name(group_name) new_group = Group(name=group_name, capabilities=group_capabilities) if idp_source_id: # inject (both will be pushed through the API call!) new_group.source_id = idp_source_id # 'S-314159-1234' new_group.source = idp_source_name # type: ignore # print(f"group_create_object:<{group_create_object}>") # overwrite new_group as it now contains id too if self.is_dry_run: _logger.info(f"Dry run - Creating group with name: <{new_group.name}>") _logger.debug(f"Dry run - Creating group details: <{new_group}>") else: new_group = self.client.iam.groups.create(new_group) # if the group name existed before, delete those groups now # same upsert approach Fusion is using to update a CDF Group: create new with changes => then delete old one if old_group_ids: if self.is_dry_run: _logger.info(f"Dry run - Deleting groups with ids: <{old_group_ids}>") else: self.client.iam.groups.delete(old_group_ids) return new_group """ "Special CDF Groups" are groups which don't have capabilities but have an effect by their name only. 1. 'transformations' group: grants access to "Fusion > Integrate > Transformations" 2. 'extractors' group: grants access to "Fusion > Integrate > Extract Data" which allows dowload of extractors Both of them are about getting deprecated in the near future (time of writing: Q4 '21). - 'transformations' can already be replaced with dedicated 'transformationsAcl' capabilities - 'extractors' only used to grant access to extractor-download page """ # generate all groups - iterating through the 3-level hierarchy def load_deployed_config_from_cdf(self, groups_only=False) -> None: """Load CDF Groups, Datasets and RAW DBs as pd.DataFrames and store them in 'self.deployed' dictionary. Args: groups_only (bool, optional): Limit to CDF Groups only (used by 'prepare' command). Defaults to False. """ NOLIMIT = -1 # # Groups # groups_df = self.client.iam.groups.list(all=True).to_pandas() available_group_columns = [ column for column in groups_df.columns if column in ["name", "id", "sourceId", "capabilities"] ] # fmt: skip if groups_only: # # early exit # self.deployed = {"groups": groups_df[available_group_columns]} return # # Data Sets # datasets_df = self.client.data_sets.list(limit=NOLIMIT).to_pandas() if len(datasets_df) == 0: # create an empty dataframe with columns, as SDK responded with no columns datasets_df = pd.DataFrame(columns=["name", "id"]) else: datasets_df = datasets_df[["name", "id"]] # # RAW DBs # rawdbs_df = self.client.raw.databases.list(limit=NOLIMIT).to_pandas() if len(rawdbs_df) == 0: # create an empty dataframe with columns, as SDK responded with no columns rawdbs_df = pd.DataFrame(columns=["name"]) else: rawdbs_df = rawdbs_df[["name"]] # store DataFrames # deployed: Dict[str, pd.DataFrame] self.deployed = { "groups": groups_df[available_group_columns], "datasets": datasets_df, "raw_dbs": rawdbs_df, } # prepare a yaml for "delete" job """ ### create / delete * new in config * delete removed from config """ # ''' # oo.ooooo. oooo d8b .ooooo. oo.ooooo. .oooo. oooo d8b .ooooo. # 888' `88b `888""8P d88' `88b 888' `88b `P )88b `888""8P d88' `88b # 888 888 888 888ooo888 888 888 .oP"888 888 888ooo888 # 888 888 888 888 .o 888 888 d8( 888 888 888 .o # 888bod8P' d888b `Y8bod8P' 888bod8P' `Y888""8o d888b `Y8bod8P' # 888 888 # o888o o888o # ''' # ''' # .o8 oooo . # "888 `888 .o8 # .oooo888 .ooooo. 888 .ooooo. .o888oo .ooooo. # d88' `888 d88' `88b 888 d88' `88b 888 d88' `88b # 888 888 888ooo888 888 888ooo888 888 888ooo888 # 888 888 888 .o 888 888 .o 888 . 888 .o # `Y8bod88P" `Y8bod8P' o888o `Y8bod8P' "888" `Y8bod8P' # ''' # ''' # .o8 oooo # "888 `888 # .oooo888 .ooooo. oo.ooooo. 888 .ooooo. oooo ooo # d88' `888 d88' `88b 888' `88b 888 d88' `88b `88. .8' # 888 888 888ooo888 888 888 888 888 888 `88..8' # 888 888 888 .o 888 888 888 888 888 `888' # `Y8bod88P" `Y8bod8P' 888bod8P' o888o `Y8bod8P' .8' # 888 .o..P' # o888o `Y8P' # ''' # ''' # .o8 o8o # "888 `"' # .oooo888 oooo .oooo. .oooooooo oooo d8b .oooo. ooo. .oo. .oo. # d88' `888 `888 `P )88b 888' `88b `888""8P `P )88b `888P"Y88bP"Y88b # 888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 # 888 888 888 d8( 888 `88bod8P' 888 d8( 888 888 888 888 # `Y8bod88P" o888o `Y888""8o `8oooooo. d888b `Y888""8o o888o o888o o888o # d" YD # "Y88888P' # ''' # # finished inline helper-methods # starting diagram logic # if not self.with_raw_capability: # no RAW DBs means no access to RAW at all # which means no 'rawAcl' capability to create # remove it form the default types _logger.info("Without RAW_DBS and 'rawAcl' capability") acl_default_types.remove("raw") # sorting relationship output into potential subgraphs graph = GraphRegistry() # top subgraphs (three columns layout) # provide Subgraphs with a 'subgraph_name' and a 'subgraph_short_name' # using the SubgraphTypes enum 'name' (default) and 'value' properties idp_group = graph.get_or_create( SubgraphTypes.idp, f"{SubgraphTypes.idp.value} for CDF: '{diagram_cdf_project}'" ) owner = graph.get_or_create(SubgraphTypes.owner, SubgraphTypes.owner.value) read = graph.get_or_create(SubgraphTypes.read, SubgraphTypes.read.value) # nested subgraphs core_cdf_owner = graph.get_or_create(SubgraphTypes.core_cdf_owner, SubgraphTypes.core_cdf_owner.value) ns_cdf_owner = graph.get_or_create(SubgraphTypes.ns_cdf_owner, SubgraphTypes.ns_cdf_owner.value) core_cdf_read = graph.get_or_create(SubgraphTypes.core_cdf_read, SubgraphTypes.core_cdf_read.value) ns_cdf_read = graph.get_or_create(SubgraphTypes.ns_cdf_read, SubgraphTypes.ns_cdf_read.value) scope_owner = graph.get_or_create(SubgraphTypes.scope_owner, SubgraphTypes.scope_owner.value) scope_read = graph.get_or_create(SubgraphTypes.scope_read, SubgraphTypes.scope_read.value) # add the three top level groups to our graph graph.elements.extend( [ idp_group, owner, read, # doc_group ] ) # add/nest the owner-subgraphs to its parent subgraph owner.elements.extend( [ core_cdf_owner, ns_cdf_owner, scope_owner, ] ) # add/nest the read-subgraphs to its parent subgraph read.elements.extend( [ core_cdf_read, ns_cdf_read, scope_read, ] ) # permutate the combinations for action in ["read", "owner"]: # action_dimensions w/o 'admin' for ns in self.bootstrap_config.namespaces: for ns_node in ns.ns_nodes: # group for each dedicated group-type id group_to_graph(graph, action, ns.ns_name, ns_node.node_name) # 'all' groups on group-type level # (access to all datasets/ raw-dbs which belong to this group-type) group_to_graph(graph, action, ns.ns_name) # 'all' groups on action level (no limits to datasets or raw-dbs) group_to_graph(graph, action) # all (no limits + admin) # 211013 pa: for AAD root:client and root:user can be merged into 'root' # for root_account in ["root:client", "root:user"]: for root_account in ["root"]: group_to_graph(graph, root_account=root_account) mermaid_code = graph.to_mermaid() _logger.info(f"Generated {len(mermaid_code)} characters") markdown_wrapper_template = """ ## auto-generated by bootstrap-cli ```mermaid {mermaid_code} ```""" # print to stdout that only the diagram can be piped to clipboard or file print( markdown_wrapper_template.format(mermaid_code=mermaid_code) if to_markdown == YesNoType.yes else mermaid_code ) # ''' # 888 d8b 888 # 888 Y8P 888 # 888 888 # .d8888b 888 888 .d8888b 888 888 # d88P" 888 888 d88P" 888 .88P # 888 888 888 888 888888K # Y88b. 888 888 Y88b. 888 "88b # "Y8888P 888 888 "Y8888P 888 888 # ''' bootstrap_cli.add_command(deploy) bootstrap_cli.add_command(prepare) bootstrap_cli.add_command(delete) bootstrap_cli.add_command(diagram) if __name__ == "__main__": main()
42.241869
134
0.560934
e3e011a21c49b5509fea872c5fc1398a8616f542
4,440
py
Python
pyhcl/passes/expand_memory.py
raybdzhou/PyChip-py-hcl
08edc6ad4d2978eb417482f6f92678f8f9a1e3c7
[ "MIT" ]
null
null
null
pyhcl/passes/expand_memory.py
raybdzhou/PyChip-py-hcl
08edc6ad4d2978eb417482f6f92678f8f9a1e3c7
[ "MIT" ]
null
null
null
pyhcl/passes/expand_memory.py
raybdzhou/PyChip-py-hcl
08edc6ad4d2978eb417482f6f92678f8f9a1e3c7
[ "MIT" ]
null
null
null
from typing import List, Dict from pyhcl.ir.low_ir import * from pyhcl.ir.low_prim import * from pyhcl.passes._pass import Pass from pyhcl.passes.utils import get_binary_width DEFAULT_READ_LATENCY = 0 DEFAULT_WRITE_LATENCY = 1
45.773196
156
0.533333
e3e0c634baf400be713a2f06ce7ace7a4e212de8
2,071
py
Python
ClydeLog.py
bnadeau/open-test-jig
99891aa96740eac267352d76a45b9dd5e1f55e0e
[ "Apache-2.0" ]
null
null
null
ClydeLog.py
bnadeau/open-test-jig
99891aa96740eac267352d76a45b9dd5e1f55e0e
[ "Apache-2.0" ]
null
null
null
ClydeLog.py
bnadeau/open-test-jig
99891aa96740eac267352d76a45b9dd5e1f55e0e
[ "Apache-2.0" ]
null
null
null
import logging import time import os BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) format = "%(asctime)s %(levelname)-10s %(message)s" id = time.strftime("%Y%m%d-%H%M%S") #These are the sequences need to get colored ouput RESET_SEQ = "\033[0m" COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[1m" COLORS = { 'WARNING': YELLOW, 'INFO': WHITE, 'DEBUG': BLUE, 'CRITICAL': YELLOW, 'ERROR': RED, 'PASS': GREEN } PASS_LEVEL_NUM = 45 logging.addLevelName(PASS_LEVEL_NUM, 'PASS') logging.Logger.success = success log = getLogger() log.setLevel(logging.DEBUG) # Make sure log directory exists if not os.path.exists('log'): os.makedirs('log') # Log to file formatter = logging.Formatter(format) filehandler = logging.FileHandler("log/clyde_%s.log" % id, "w") filehandler.setLevel(logging.INFO) filehandler.setFormatter(formatter) log.addHandler(filehandler) COLOR_FORMAT = formatter_message(format, True) color_formatter = ColoredFormatter(COLOR_FORMAT) # Log to stdout too streamhandler = logging.StreamHandler() streamhandler.setLevel(logging.DEBUG) streamhandler.setFormatter(color_formatter) log.addHandler(streamhandler)
27.25
84
0.713182
e3e15e7f00bea2796ee5bd52b11a09a192eae24f
4,485
py
Python
private_market/test.py
sigmoid3/Dapper
469ddca6de3b5e977bcba05de57b9e07bf46dd13
[ "MIT" ]
974
2015-01-01T08:37:37.000Z
2022-03-29T16:41:11.000Z
private_market/test.py
sigmoid3/Dapper
469ddca6de3b5e977bcba05de57b9e07bf46dd13
[ "MIT" ]
45
2015-05-04T15:57:26.000Z
2022-03-22T14:40:24.000Z
private_market/test.py
sigmoid3/Dapper
469ddca6de3b5e977bcba05de57b9e07bf46dd13
[ "MIT" ]
414
2015-01-05T14:43:01.000Z
2022-03-28T18:30:58.000Z
from ethereum import tester as t from ethereum import utils if __name__ == '__main__': test()
50.965909
85
0.716611
e3e284f2bcaf4183ceaa0d76915531a74b397b67
14,338
py
Python
meshreg/visualize/samplevis.py
jonashein/handobjectnet_baseline
29175be4528f68b8a2aa6dc6aa37ee0a042f93ab
[ "MIT" ]
2
2021-07-09T15:10:44.000Z
2021-07-11T12:42:13.000Z
meshreg/visualize/samplevis.py
jonashein/handobjectnet_baseline
29175be4528f68b8a2aa6dc6aa37ee0a042f93ab
[ "MIT" ]
null
null
null
meshreg/visualize/samplevis.py
jonashein/handobjectnet_baseline
29175be4528f68b8a2aa6dc6aa37ee0a042f93ab
[ "MIT" ]
null
null
null
import torch import numpy as np from libyana.visutils.viz2d import visualize_joints_2d from meshreg.datasets.queries import BaseQueries, TransQueries from meshreg.visualize import consistdisplay
46.401294
119
0.522597
e3e49196e82b3c1f79806bdd2aeb6e1bcf532ba4
3,185
py
Python
api_app/api/dependencies/workspaces.py
gauravagrwal/AzureTRE
f3cb1e40e4926f8b196add807b05abec46bb36fc
[ "MIT" ]
71
2021-03-04T15:10:18.000Z
2022-03-29T16:37:37.000Z
api_app/api/dependencies/workspaces.py
gauravagrwal/AzureTRE
f3cb1e40e4926f8b196add807b05abec46bb36fc
[ "MIT" ]
1,498
2021-03-05T07:28:00.000Z
2022-03-31T16:28:06.000Z
api_app/api/dependencies/workspaces.py
gauravagrwal/AzureTRE
f3cb1e40e4926f8b196add807b05abec46bb36fc
[ "MIT" ]
60
2021-04-30T10:09:26.000Z
2022-03-30T12:39:27.000Z
from fastapi import Depends, HTTPException, Path, status from pydantic import UUID4 from api.dependencies.database import get_repository from db.errors import EntityDoesNotExist, ResourceIsNotDeployed from db.repositories.user_resources import UserResourceRepository from db.repositories.workspace_services import WorkspaceServiceRepository from db.repositories.workspaces import WorkspaceRepository from models.domain.user_resource import UserResource from models.domain.workspace import Workspace from models.domain.workspace_service import WorkspaceService from resources import strings
56.875
224
0.82292
e3e5cb6c2267ca3e81be3aad88376455fe125b55
14,828
py
Python
nnef_tools/conversion/tensorflow/tf_pb_to_tf_py.py
rgiduthuri/NNEF-Tools
8a9971f897fb5a110dd254e0c20077213f257700
[ "Apache-2.0" ]
null
null
null
nnef_tools/conversion/tensorflow/tf_pb_to_tf_py.py
rgiduthuri/NNEF-Tools
8a9971f897fb5a110dd254e0c20077213f257700
[ "Apache-2.0" ]
null
null
null
nnef_tools/conversion/tensorflow/tf_pb_to_tf_py.py
rgiduthuri/NNEF-Tools
8a9971f897fb5a110dd254e0c20077213f257700
[ "Apache-2.0" ]
null
null
null
# Copyright (c) 2017 The Khronos Group Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import division, print_function, absolute_import import typing from functools import partial import numpy as np import six from nnef_tools.conversion import shape_fixer from nnef_tools.core import utils from nnef_tools.io.tensorflow.tf_graph import * from nnef_tools.io.tensorflow.tf_pb import tf_pb_eval, tf_pb_shape_inference _tf_py_dtype_by_tf_pb_dtype = { 'DT_INVALID': None, 'DT_HALF': 'float16', 'DT_FLOAT': 'float32', 'DT_DOUBLE': 'float64', 'DT_INT8': 'int8', 'DT_INT16': 'int16', 'DT_INT32': 'int32', 'DT_INT64': 'int64', 'DT_UINT8': 'uint8', 'DT_UINT16': 'uint16', 'DT_UINT32': 'uint32', 'DT_UINT64': 'uint64', 'DT_BOOL': 'bool', 'DT_STRING': 'string', 'DT_COMPLEX64': 'complex64', 'DT_COMPLEX128': 'complex128', } # noinspection PyProtectedMember # See: https://www.tensorflow.org/api_docs/cc/ DefaultConverters = { # attribless: "Abs": partial(generic_converter, target_name="tf.abs"), "Add": partial(generic_converter, target_name="tf.add"), "BatchToSpaceND": partial(generic_converter, target_name="tf.batch_to_space"), "BiasAdd": partial(generic_converter, target_name="tf.nn.bias_add"), "Ceil": partial(generic_converter, target_name="tf.ceil"), "Elu": partial(generic_converter, target_name="tf.nn.elu"), "Equal": partial(generic_converter, target_name="tf.equal"), "Exp": partial(generic_converter, target_name="tf.exp"), "Floor": partial(generic_converter, target_name="tf.floor"), "Greater": partial(generic_converter, target_name="tf.greater"), "GreaterEqual": partial(generic_converter, target_name="tf.greater_equal"), "Identity": partial(generic_converter, target_name="tf.identity"), "LeakyRelu": partial(generic_converter, target_name="tf.nn.leaky_relu"), "Less": partial(generic_converter, target_name="tf.less"), "LessEqual": partial(generic_converter, target_name="tf.less_equal"), "Log": partial(generic_converter, target_name="tf.log"), "LogicalAnd": partial(generic_converter, target_name="tf.logical_and"), "LogicalNot": partial(generic_converter, target_name="tf.logical_not"), "LogicalOr": partial(generic_converter, target_name="tf.logical_or"), "Maximum": partial(generic_converter, target_name="tf.maximum"), "Minimum": partial(generic_converter, target_name="tf.minimum"), "Mul": partial(generic_converter, target_name="tf.multiply"), "Neg": partial(generic_converter, target_name="tf.negative"), "NotEqual": partial(generic_converter, target_name="tf.not_equal"), "Pow": partial(generic_converter, target_name="tf.pow"), "RealDiv": partial(generic_converter, target_name="tf.divide"), "Relu": partial(generic_converter, target_name="tf.nn.relu"), "Relu6": partial(generic_converter, target_name="tf.nn.relu6"), "Round": partial(generic_converter, target_name="tf.round"), "Rsqrt": partial(generic_converter, target_name="tf.rsqrt"), "Sigmoid": partial(generic_converter, target_name="tf.nn.sigmoid"), "Sign": partial(generic_converter, target_name="tf.sign"), "Softmax": partial(generic_converter, target_name="tf.nn.softmax", new_attribs={'axis': -1}), "Softplus": partial(generic_converter, target_name="tf.nn.softplus"), "Softsign": partial(generic_converter, target_name="tf.nn.softsign"), "Sqrt": partial(generic_converter, target_name="tf.sqrt"), "Square": partial(generic_converter, target_name="tf.square"), "Sub": partial(generic_converter, target_name="tf.subtract"), "Tanh": partial(generic_converter, target_name="tf.nn.tanh"), "Select": partial(generic_converter, target_name="tf.where"), 'ClipByValue': partial(generic_converter, target_name='tf.clip_by_value'), # more complex: "AvgPool": partial(generic_converter, target_name="tf.nn.avg_pool"), "Conv2D": partial(generic_converter, target_name="tf.nn.conv2d"), "Conv3D": partial(generic_converter, target_name="tf.nn.conv3d"), "Conv2DBackpropInput": partial(generic_converter, target_name="tf.nn.conv2d_transpose", input_to_attrib_dict={0: "output_shape"}, revert_inputs=True), "Conv3DBackpropInputV2": partial(generic_converter, target_name="tf.nn.conv3d_transpose", input_to_attrib_dict={0: "output_shape"}, revert_inputs=True), # "CudnnRNN": None, "DepthwiseConv2dNative": partial(generic_converter, target_name="tf.nn.depthwise_conv2d_native"), "FusedBatchNorm": partial(generic_converter, target_name="tf.nn.fused_batch_norm"), "LRN": partial(generic_converter, target_name="tf.nn.lrn"), "MatMul": partial(generic_converter, target_name="tf.matmul"), "MaxPool": partial(generic_converter, target_name="tf.nn.max_pool"), "MaxPoolWithArgmax": partial(generic_converter, target_name="tf.nn.max_pool_with_argmax"), "Pack": partial(generic_converter, target_name="tf.stack"), # "Placeholder": None, # "PlaceholderWithDefault": None, "Shape": partial(generic_converter, target_name="tf.shape"), "Squeeze": partial(generic_converter, target_name="tf.squeeze", attrib_name_dict={"squeeze_dims": "axis"}), # even more complex: "ExpandDims": partial(generic_converter, target_name="tf.expand_dims", input_to_attrib_dict={1: "axis"}), "ArgMin": partial(generic_converter, target_name="tf.argmin", input_to_attrib_dict={1: "axis"}), "ArgMax": partial(generic_converter, target_name="tf.argmax", input_to_attrib_dict={1: "axis"}), "Max": partial(generic_converter, target_name="tf.reduce_max", attrib_name_dict={"keep_dims": "keepdims"}, input_to_attrib_dict={1: "axis"}, list_attribs=['axis']), "Min": partial(generic_converter, target_name="tf.reduce_min", attrib_name_dict={"keep_dims": "keepdims"}, input_to_attrib_dict={1: "axis"}, list_attribs=['axis']), "Mean": partial(generic_converter, target_name="tf.reduce_mean", attrib_name_dict={"keep_dims": "keepdims"}, input_to_attrib_dict={1: "axis"}, list_attribs=['axis']), "ConcatV2": partial(generic_converter, target_name="tf.concat", input_to_attrib_dict={-1: "axis"}), "Pad": partial(generic_converter, target_name="tf.pad", input_to_attrib_dict={1: "paddings"}, new_attribs={'mode': 'CONSTANT', 'constant_values': 0.0}), "MirrorPad": partial(generic_converter, target_name="tf.pad", input_to_attrib_dict={1: "paddings"}, new_attribs={'constant_values': 0.0}), "Reshape": partial(generic_converter, target_name="tf.reshape", input_to_attrib_dict={1: "shape"}), "ResizeArea": partial(generic_converter, target_name="tf.image.resize_area", input_to_attrib_dict={1: "size"}), "ResizeBilinear": partial(generic_converter, target_name="tf.image.resize_bilinear", input_to_attrib_dict={1: "size"}), "ResizeNearestNeighbor": partial(generic_converter, target_name="tf.image.resize_nearest_neighbor", input_to_attrib_dict={1: "size"}), "Slice": partial(generic_converter, target_name="tf.slice", input_to_attrib_dict={1: "begin", 2: "size"}), "SpaceToBatchND": partial(generic_converter, target_name="tf.space_to_batch"), "Split": partial(generic_converter, target_name="tf.split", attrib_name_dict={'num_split': 'num_or_size_splits'}, input_to_attrib_dict={0: "axis"}), "SplitV": partial(generic_converter, target_name="tf.split", input_to_attrib_dict={1: "num_or_size_splits", 2: "axis"}), "StridedSlice": partial(generic_converter, target_name="tf.strided_slice", input_to_attrib_dict={1: "begin", 2: "end", 3: "strides"}), "Sum": partial(generic_converter, target_name="tf.reduce_sum", input_to_attrib_dict={1: "axis"}, attrib_name_dict={"keep_dims": "keepdims"}, list_attribs=['axis']), "Transpose": partial(generic_converter, target_name="tf.transpose", input_to_attrib_dict={1: "perm"}), "Tile": partial(generic_converter, target_name="tf.tile", input_to_attrib_dict={1: "multiples"}), "Cast": convert_cast, "Sin": partial(generic_converter, target_name="tf.sin"), "Cos": partial(generic_converter, target_name="tf.cos"), "Any": partial(generic_converter, target_name="tf.reduce_any", attrib_name_dict={"keep_dims": "keepdims"}, input_to_attrib_dict={1: "axis"}, list_attribs=['axis']), "All": partial(generic_converter, target_name="tf.reduce_all", attrib_name_dict={"keep_dims": "keepdims"}, input_to_attrib_dict={1: "axis"}, list_attribs=['axis']), }
50.435374
115
0.658956
e3e5d7bb420ff6920778e91d10161cbdad69e4fa
1,015
py
Python
CS1410/p5test.py
Davidjbennett/DavidBennett.github.io
09a2652b7ace8741bf23c6432abd58ee790b9f0c
[ "MIT" ]
3
2021-05-18T16:17:29.000Z
2022-01-20T15:46:59.000Z
CS1410/p5test.py
Davidjbennett/DavidBennett
09a2652b7ace8741bf23c6432abd58ee790b9f0c
[ "MIT" ]
null
null
null
CS1410/p5test.py
Davidjbennett/DavidBennett
09a2652b7ace8741bf23c6432abd58ee790b9f0c
[ "MIT" ]
null
null
null
import unittest from payroll import * if __name__ == '__main__': unittest.main()
39.038462
113
0.629557
e3e6303d7750f26636e0532318d99a61631c9c10
17,884
py
Python
EXOSIMS/Completeness/BrownCompleteness.py
dgarrett622/EXOSIMS
ce41adc8c162b6330eb9cefee83f3a395bcff614
[ "BSD-3-Clause" ]
null
null
null
EXOSIMS/Completeness/BrownCompleteness.py
dgarrett622/EXOSIMS
ce41adc8c162b6330eb9cefee83f3a395bcff614
[ "BSD-3-Clause" ]
2
2016-08-13T18:39:39.000Z
2020-06-26T00:18:37.000Z
EXOSIMS/Completeness/BrownCompleteness.py
douglase/EXOSIMS
ce41adc8c162b6330eb9cefee83f3a395bcff614
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- import time import numpy as np from scipy import interpolate import astropy.units as u import astropy.constants as const import os, inspect try: import cPickle as pickle except: import pickle import hashlib from EXOSIMS.Prototypes.Completeness import Completeness from EXOSIMS.util.eccanom import eccanom from EXOSIMS.util.deltaMag import deltaMag
42.08
109
0.537575
e3e6feda3445e87c646510a9a3a710d5ae1d2df6
1,418
py
Python
pylsp/plugins/hover.py
nemethf/python-lsp-server
34be02a6ce37bab7fb9ba1845006c0af16fb7efc
[ "MIT" ]
1
2021-07-08T01:27:25.000Z
2021-07-08T01:27:25.000Z
pylsp/plugins/hover.py
nemethf/python-lsp-server
34be02a6ce37bab7fb9ba1845006c0af16fb7efc
[ "MIT" ]
null
null
null
pylsp/plugins/hover.py
nemethf/python-lsp-server
34be02a6ce37bab7fb9ba1845006c0af16fb7efc
[ "MIT" ]
null
null
null
# Copyright 2017-2020 Palantir Technologies, Inc. # Copyright 2021- Python Language Server Contributors. import logging from pylsp import hookimpl, _utils log = logging.getLogger(__name__)
28.36
74
0.662906
e3e789b09b4bc5d5bd9a4f91dddf897a4ef4d03a
4,753
py
Python
LocStat/pipelines/output.py
nhtoshiaki/LocStat
0196d627d1f16a778cbc8f1996d217d8fee72afb
[ "MIT" ]
null
null
null
LocStat/pipelines/output.py
nhtoshiaki/LocStat
0196d627d1f16a778cbc8f1996d217d8fee72afb
[ "MIT" ]
null
null
null
LocStat/pipelines/output.py
nhtoshiaki/LocStat
0196d627d1f16a778cbc8f1996d217d8fee72afb
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import items def write_extension_statistic(self, root_dir_item): """ Writes the table with the number of lines and bytes for each file extension. """ if self.file and not self.file.closed: self.file.write(f'{"Extensao":<10} | {"Linhas":^15} | ' f'{"Bytes":^15}\n') self.file.write(f'{"":=<11}|{"":=^17}|{"":=^16}\n') if 'index' in root_dir_item: for ext, info in root_dir_item['index'].items(): if len(ext) == 0: ext = '<outros>' amount_lines, amount_bytes = 0, 0 perc_lines, perc_bytes = 0, 0 if 'amount_lines' in info: amount_lines = info['amount_lines'] if 'amount_bytes' in info: amount_bytes = info['amount_bytes'] if 'amount_lines' in root_dir_item and \ root_dir_item['amount_lines'] != 0: perc_lines = int(100 * amount_lines / root_dir_item['amount_lines']) if 'amount_bytes' in root_dir_item and \ root_dir_item['amount_bytes'] != 0: perc_bytes = int(100 * amount_bytes / root_dir_item['amount_bytes']) self.file.write(f'{ext:<10} | {amount_lines:>7} ' f'({perc_lines:>3} %) | ' f'{amount_bytes:>6} ' f'({perc_bytes:>3} %)\n') def write_tree_structure(self, root_dir_item): """ Writes the repository file structure. """ def _tree_structure(file_item, depth): """ Recursive function to create the file structure. """ structure = '' for i in range(depth - 1): structure += '| ' structure += '|-- ' if 'name' in file_item: if isinstance(file_item, items.DirectoryItem): structure += f'[{file_item["name"]}]\n' if 'children' in file_item \ and type(file_item['children']) is list: for child in file_item['children']: structure += \ _tree_structure(child, depth + 1) elif isinstance(file_item, items.TextFileItem): structure += f'{file_item["name"]}' if 'amount_lines' in file_item: structure += f' ({file_item["amount_lines"]} linhas)' structure += '\n' return structure if self.file and not self.file.closed: structure = '' if 'repository_name' in root_dir_item: structure += f'[{root_dir_item["repository_name"]}]\n' if 'children' in root_dir_item and type(root_dir_item['children'])\ is list: for child in root_dir_item['children']: structure += _tree_structure(child, 1) self.file.write(structure)
37.722222
79
0.487482
e3e858c279c7da79f073153068c7d9c2b91c90b3
736
py
Python
greensinversion/regularization.py
isuthermography/greensinversion
92f272a3649bb2f6b132f8cd239edd68dd2a6a62
[ "Unlicense" ]
1
2020-07-25T23:23:04.000Z
2020-07-25T23:23:04.000Z
greensinversion/regularization.py
isuthermography/greensinversion
92f272a3649bb2f6b132f8cd239edd68dd2a6a62
[ "Unlicense" ]
1
2018-10-04T01:43:25.000Z
2018-11-28T17:59:12.000Z
greensinversion/regularization.py
isuthermography/greensinversion
92f272a3649bb2f6b132f8cd239edd68dd2a6a62
[ "Unlicense" ]
1
2020-07-25T23:23:06.000Z
2020-07-25T23:23:06.000Z
import numpy as np
36.8
319
0.716033
e3e870bbf5df4a845585a4326902f3311e5fcf1d
1,563
py
Python
examples/telebot.py
b3ntuz1/words
5d14439e18d9462a02a836afc3497a188bfc3224
[ "MIT" ]
null
null
null
examples/telebot.py
b3ntuz1/words
5d14439e18d9462a02a836afc3497a188bfc3224
[ "MIT" ]
null
null
null
examples/telebot.py
b3ntuz1/words
5d14439e18d9462a02a836afc3497a188bfc3224
[ "MIT" ]
null
null
null
import flask import telebot import words from dotenv import load_dotenv load_dotenv() app = flask.Flask(__name__) bot = telebot.TeleBot(environ.get("TG_TOKEN"), threaded=False) WEBHOOK_URL_PATH = "/%s/" % (environ.get("TG_TOKEN")) # # Remove webhook, it fails sometimes the set if there is a previous webhook # bot.remove_webhook() # time.sleep(1) # # Set webhook # bot.set_webhook(url=environ.get("WEBHOOK_URL") + WEBHOOK_URL_PATH)
31.26
106
0.68778
e3e8a02a4a0c93dadb97549166e65600c319f251
547
py
Python
lvsfunc/__init__.py
DeadNews/lvsfunc
15bc8b99595c5066c15f4aba9fb9989e1068a9ee
[ "MIT" ]
null
null
null
lvsfunc/__init__.py
DeadNews/lvsfunc
15bc8b99595c5066c15f4aba9fb9989e1068a9ee
[ "MIT" ]
null
null
null
lvsfunc/__init__.py
DeadNews/lvsfunc
15bc8b99595c5066c15f4aba9fb9989e1068a9ee
[ "MIT" ]
null
null
null
""" lvsfunc, a collection of VapourSynth functions and wrappers written and/or modified by LightArrowsEXE. If you spot any issues, please do not hesitate to send in a Pull Request or reach out to me on Discord (LightArrowsEXE#0476)! """ # flake8: noqa from . import aa, comparison, deinterlace, denoise, misc, scale # Aliases: comp = comparison.compare diff = comparison.tvbd_diff ef = misc.edgefixer qden = denoise.quick_denoise rfs = misc.replace_ranges scomp = comparison.stack_compare sraa = aa.upscaled_sraa src = misc.source
26.047619
106
0.758684
e3e90ea49def6ec58ac5f2b5f001c13fe85417ac
529
py
Python
Roman_to_Integer.py
sujitmandal/leetCode
b52bfd68cd93243765a94a190807f9b79ec4b4af
[ "MIT" ]
null
null
null
Roman_to_Integer.py
sujitmandal/leetCode
b52bfd68cd93243765a94a190807f9b79ec4b4af
[ "MIT" ]
null
null
null
Roman_to_Integer.py
sujitmandal/leetCode
b52bfd68cd93243765a94a190807f9b79ec4b4af
[ "MIT" ]
null
null
null
roman_dict = { "I" : 1, "V" : 5, "X" : 10, "L" : 50, "C" : 100, "D" : 500, "M" : 1000 } obj = Solution() obj.romanToInt("III") obj.romanToInt("XXVII") obj.romanToInt("IV")
18.241379
40
0.478261
e3ea89a73be617f94a289a935e3c1a5396be4890
4,214
py
Python
utils/warmup.py
hengwei-chan/3D_SBDD
eda6d51aaf01ef25581a46920a25161678fab76d
[ "MIT" ]
67
2021-12-02T05:53:44.000Z
2022-03-31T07:21:26.000Z
utils/warmup.py
hengwei-chan/3D_SBDD
eda6d51aaf01ef25581a46920a25161678fab76d
[ "MIT" ]
13
2021-12-05T14:23:46.000Z
2022-03-25T21:07:20.000Z
utils/warmup.py
hengwei-chan/3D_SBDD
eda6d51aaf01ef25581a46920a25161678fab76d
[ "MIT" ]
16
2022-01-11T11:48:24.000Z
2022-03-27T19:20:58.000Z
""" MIT License Copyright (c) 2019 Ildoo Kim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ from torch.optim.lr_scheduler import _LRScheduler from torch.optim.lr_scheduler import ReduceLROnPlateau
48.436782
152
0.685809
e3eab184db32babbdcd60c4ea7969530ce380571
2,154
py
Python
src/ee/deployers.py
marcelotrevisani/ee
933d6a80402b30943ca3df4a1a120047f7163a4b
[ "MIT" ]
5
2021-12-09T21:54:35.000Z
2021-12-14T11:25:57.000Z
src/ee/deployers.py
marcelotrevisani/ee
933d6a80402b30943ca3df4a1a120047f7163a4b
[ "MIT" ]
6
2021-12-09T21:04:19.000Z
2022-02-11T11:19:44.000Z
src/ee/deployers.py
marcelotrevisani/ee
933d6a80402b30943ca3df4a1a120047f7163a4b
[ "MIT" ]
2
2021-02-12T20:20:26.000Z
2021-12-14T11:24:24.000Z
import abc import logging from typing import List from ee.models import EnvironmentDefinition logger = logging.getLogger(__name__)
27.615385
80
0.597029
e3eb6d0f0d638a2beae2a17150b8764d8ef995b7
2,946
py
Python
vb_simulation_pkgs/example_pkgs/pkg_moveit_examples/scripts/node_eg2_predefined_pose.py
ROBODITYA/Eyantra-2021-Vargi-Bots
f1c6a82c46e6e84486a4832b3fbcd02625849447
[ "MIT" ]
1
2021-07-13T07:05:29.000Z
2021-07-13T07:05:29.000Z
vb_simulation_pkgs/example_pkgs/pkg_moveit_examples/scripts/node_eg2_predefined_pose.py
TejasPhutane/Eyantra-2021-Vargi-Bots
ab84a1304101850be8c0f69cfe6de70d53c33189
[ "MIT" ]
1
2021-06-05T07:58:03.000Z
2021-06-05T07:58:03.000Z
vb_simulation_pkgs/example_pkgs/pkg_moveit_examples/scripts/node_eg2_predefined_pose.py
ROBODITYA/Eyantra-2021-Vargi-Bots
f1c6a82c46e6e84486a4832b3fbcd02625849447
[ "MIT" ]
null
null
null
#! /usr/bin/env python import rospy import sys import copy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg import actionlib if __name__ == '__main__': main()
37.291139
163
0.681942
e3ecff00be006576e1644fd5e646a6c21330ba43
5,047
py
Python
plugins/pelican_gist/plugin.py
kura/kura.io
7f9ba2140b93bba86d1367e41706ad72f9e672bf
[ "MIT" ]
13
2015-02-19T22:14:07.000Z
2021-02-07T14:16:34.000Z
plugins/pelican_gist/plugin.py
kura/kura.gg
42c8e0a7a6d9480297df004452b073883ff9693e
[ "MIT" ]
2
2015-07-28T10:02:57.000Z
2017-07-28T18:08:59.000Z
plugins/pelican_gist/plugin.py
kura/kura.io
7f9ba2140b93bba86d1367e41706ad72f9e672bf
[ "MIT" ]
7
2015-08-26T16:52:00.000Z
2019-10-11T05:32:37.000Z
# -*- coding: utf-8 -*- """ Gist embedding plugin for Pelican ================================= This plugin allows you to embed `Gists`_ into your posts. .. _Gists: https://gist.github.com/ """ from __future__ import unicode_literals import hashlib import logging import os import re import codecs import pygments logger = logging.getLogger(__name__) gist_regex = re.compile( r'(<p>\[gist:id\=([0-9a-fA-F]+)(,file\=([^\],]+))?(,filetype\=([a-zA-Z]+))?\]</p>)') gist_template = """<div class="gist"> <script src='{{script_url}}' crossorigin='anonymous'></script> <noscript> {{code}} </noscript> </div>""" def fetch_gist(gist_id, filename=None): """Fetch a gist and return the contents as a string.""" import requests url = gist_url(gist_id, filename) response = requests.get(url) if response.status_code != 200: raise Exception('Got a bad status looking up gist.') body = response.text if not body: raise Exception('Unable to get the gist contents.') return body def setup_gist(pelican): """Setup the default settings.""" pelican.settings.setdefault('GIST_CACHE_ENABLED', True) pelican.settings.setdefault('GIST_CACHE_LOCATION', '/tmp/gist-cache') pelican.settings.setdefault('GIST_PYGMENTS_STYLE', 'default') pelican.settings.setdefault('GIST_PYGMENTS_LINENUM', False) # Make sure the gist cache directory exists cache_base = pelican.settings.get('GIST_CACHE_LOCATION') if not os.path.exists(cache_base): os.makedirs(cache_base) def render_code(code, filetype, pygments_style): """Renders a piece of code into HTML. Highlights syntax if filetype is specfied""" if filetype: lexer = pygments.lexers.get_lexer_by_name(filetype) formatter = pygments.formatters.HtmlFormatter(style=pygments_style) return pygments.highlight(code, lexer, formatter) else: return "<pre><code>{}</code></pre>".format(code) def replace_gist_tags(generator): """Replace gist tags in the article content.""" from jinja2 import Template template = Template(gist_template) should_cache = generator.context.get('GIST_CACHE_ENABLED') cache_location = generator.context.get('GIST_CACHE_LOCATION') pygments_style = generator.context.get('GIST_PYGMENTS_STYLE') body = None for article in generator.articles: for match in gist_regex.findall(article._content): gist_id = match[1] filename = None filetype = None if match[3]: filename = match[3] if match[5]: filetype = match[5] logger.info('[gist]: Found gist id {} with filename {} and filetype {}'.format( gist_id, filename, filetype, )) if should_cache: body = get_cache(cache_location, gist_id, filename) # Fetch the gist if not body: logger.info('[gist]: Gist did not exist in cache, fetching...') body = fetch_gist(gist_id, filename) if should_cache: logger.info('[gist]: Saving gist to cache...') set_cache(cache_location, gist_id, body, filename) else: logger.info('[gist]: Found gist in cache.') # Create a context to render with context = generator.context.copy() context.update({ 'script_url': script_url(gist_id, filename), 'code': render_code(body, filetype, pygments_style) }) # Render the template replacement = template.render(context) article._content = article._content.replace(match[0], replacement) def register(): """Plugin registration.""" from pelican import signals signals.initialized.connect(setup_gist) signals.article_generator_finalized.connect(replace_gist_tags)
30.96319
91
0.624529
e3ed166cf5e760668330d7ff8e4a946c7c875bce
1,188
py
Python
ass1/rsc/ts.py
suryaavala/network
291b59dce961448b2a9b92b6a0754ec994a6fb91
[ "MIT" ]
null
null
null
ass1/rsc/ts.py
suryaavala/network
291b59dce961448b2a9b92b6a0754ec994a6fb91
[ "MIT" ]
null
null
null
ass1/rsc/ts.py
suryaavala/network
291b59dce961448b2a9b92b6a0754ec994a6fb91
[ "MIT" ]
null
null
null
import time from socket import * import sys host = sys.argv[1] #port = sys.argv[2] #message = sys.argv[2] sock = socket(AF_INET, SOCK_DGRAM) sock.settimeout(1) sock.bind((str(host),0)) print(sock.getsockname(),sock.getsockname()[1]) port = 5967 for message in 'abcdefghijklmnopqrstuvwxyz': sock.sendto(message.encode('ascii'), (str(host), int(port))) print ("sent message: {} to address {}".format(message, (host,port))) print('*******sleeping*********') #time.sleep(10) print ('*********woke up**********') for message in 'abcdefghijklmnopqrstuvwxyz': sock.sendto(message.encode('ascii'), (str(host), int(port))) print ("sent message: {} to address {}".format(message, (host,port))) #message_list = ["souce#","dest#","seq_nb","ack nb","ACK","SYN","FIN","RST",str("surya avinash avala data sfkjgd tjgt df".encode('ascii'))] pay_load = "surya avinash avala data sfkjgd tjgt df" header = ["souce#","dest#","seq_nb","ack nb","ACK","SYN","FIN","RST"] message = ("+".join(header)+"+"+pay_load) print("final message: {}".format(message)) sock.sendto(message.encode("ascii"), (str(host), int(port))) print ("sent message: {} to address {}".format(message, (host,port)))
32.108108
139
0.653199
e3edc74364411dacd749db536296fed60fe22954
26,799
py
Python
django/docs/ref/contrib/auth.txt.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
django/docs/ref/contrib/auth.txt.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
django/docs/ref/contrib/auth.txt.py
roshanba/mangal
f7b428811dc07214009cc33f0beb665ead402038
[ "bzip2-1.0.6", "MIT" ]
null
null
null
XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXXXX XXXXXXXX XXX XXXXXXXXX XXXXXXXX XXX XXX XXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXX XXXXXXX XXX XXXX XXXXXXX XX XXX XXXXX XX XXXXX XXXXXXXXXX XX XXX XX XXXXXXXXX XXXXXXXXXXXXXX XXX XXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXX XXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXX XXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXX XXXXXX XXXXXX XX XXXXXXX XXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXX XXXXXXXXX XXXXXXX XX XXXXXXXXXXX XXXXXXXX XXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XXXXXXXXX XXX XXXXXXX XXXXXXXXXXXXX XXXXXX XXXXXX XXXXXX XXXXX XXX XXXXX XXXXXXXXXXX XXX XXXXXXXXXXXXXX XXXXXX XX XXXXXXXXXX XXX XXXX XXX XXXXXX XX XXX XXXX X XXXXXX XXXXXXX XXXXXX XXX X XXXXXXXXXXXX XXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXX XXXXX XXXX XXX XXXXXXXXXXX XXXXXXXX XXXXXXXXXXXX XXX XXXXXX XXXXXXX XXXXXXXXX XXXXXXX XX XXXX XXXXXXXXXXXXXXXXXX XXXXXXX XXXXX XXX XXXX XXXXXX XXXXXX XXXXXXX XXXX XXX XXXXXXXXXX XX XXXX XXXX XX XXXXXXXX XX XXXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XX XXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXX XXXXXXXXX XXXX XX XX XXX XXXXXXXXXXX XX XXXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XX XXXXXXXXXXX XXXXX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXXX XX XXXXXXXXXXX XXXXXXXX XXXXXXXXX X XXXX XXX XXX XXXXXXXX XXXXXX XXX XXXXXXXXX XXXXXXX XXXXXXX XXXXX XXX XXX XXXXXXXXXX XXX XXXXXXXXX XXX XX XXXXXXXXXXX XXXX XXX XXX XXXXXXX XXX XXXXXXXXXX XXX XXX XXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXX XXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXX XXXX XXXX XXX XXXXXX XXX XXXXX XXXXX XX XXXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXX XXXX XXXX XXXXXXX XXXXXX XX XXXXXXXXXX XXXXXXX XX XXXXXXXXX XXXX XXX XXX XXXX XXXX XX XXXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXX XXXX XXXX XX XXXX XXXXXXXXXXXX XXXX XXX XXXXXXX XXXX XX XXXXXX XXX XXXXXXX XXXX XXXXX XXXXXX XXXX XXXXXXX XXXXXXXXXXX XXXXXXX XXXXXXX XX XXX XXX XXXX XXX XXX XXX XXXXXXXXXXXXXX XXXXXXXX XXXXXX XXXXXXXX XX XXXXX XXX XXX XXXXXXXXXXXXX XXXX XXX XXX XXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXX XX XXXXX XXXXXXXX XXXXX XX XXXXXX XX XXXX XXXXX XXXXXX XXXX XXXX XX XXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX XXXXXXX XXXXXXXX XXXXXX XX XXXXX XXXX XXX XXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXX XX XXX XXXXXX XXXXX XXX XXXXXX XXXXXXXXX XXX XXXXXXXX XXXXXX XX XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXX XXXX XXXX XXX XXX XXXXXXXXXXX XXXXXXX XXXXXXXXXX XXXXXXXXX XXXXX XX XXXXXXXXXXX XXXXXXXXXX X XXXXXXXX XX XXX XXXXXX XXXX XXXXXX XX XXXXXXXXXXX XXXXXXXXXXX X XXXXXXXX XXXXXXXXXXX XXXX XXX XXXXXXX XXX XXXXXXXX XX XXX XX XXX XXXXXXX XXXXXXXXX XX XXXXXXX XXXX XXX XXXXXXX XX XXXXXXXX XXXXXXXXXX XXXXXXXXXX XX XXXXXXX XXXXXXXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXX XX XXXXXX XXXXXXXX XXX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XX XXXXXX XXXXXXXXXXX XXXX XX X XXX XX XXXX XX XXX XXXX XXX XXXX XXXXXXXXXXXXXX XXXX XXXX XXX XXXXX XXX XXXXXXXXXXX XXX XXXXXXX XXXXX XX XXX XXXX XX XXXXXX XX XXX X XXXXX XXXXXXXX XXXX XXXXXX XXXXXXXX XXX XXXX XXXXX XXXX XXXXXXXXX XX XXXXXXXXXXXXXXXX XX XXXX XXX XXXXXXX XX XXX XXXX XXXXXXXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXX XXXXXXXXX XXXXXXXXX XXXXXX XXX XXXXXX XXXX XXXX XXXXXXXXX XX XXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXX XXXXXXXXX XXXXX XX XXXXXX XXXXXXXXXX XXXX XX X XXX XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXX XXX XXXXXX XXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXX XXXXXXXXXX XXXXXXX XXXXXXX XX XXXXXXX XXXXXXXXXXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXX XXXXXXX XXX XXXXXXXX XXX XXX XXXXX XXXXX XXX XXXXXXXX XXXXX XXX XX XXXXXXX XXXX XXX XXXXXX XXX XXXX XXXXXX XXXXXXX XX XXXXXXXXXXX XXX XXXXXXXX XXXXXXXXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX X XXXXX XX XXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXX XXXXXX XXXXXXXX XX XXX XXXXX XXX XXXXXXX XXXXXX XXXX XX XXX XXXXXXXX XXXXXXXX XXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXX XXXXXXXXXXXXXXXX XX XXXXXXXXX XXX XXXXXXXX XXXX XX XXX XX XX XXXXXXXX XXXXXXXXX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXX XX XXX XXXXX XXX XXXXXX XX XXX XXXXXXX XXXXXXXX XXX XXX XXXXX XXXXX XXXXX XXXX XX XXX XXXXXXXX XXXXXXX XX XXXXXX XXX XXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXX XXX XXXX XX XXXXXX XX XXXXXXXX XXXX XXXX XXXXX XXX XXXX XX XXXXXX X XXXXX XXXXXX XXX X XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXX XXXX XXXXX XXXXXX XXXXXXXXX XXXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXX XXX XXXX XXXX XX XXXXXXXXXXXXXX XXX XXXX XXXXXXXXXXX XXXXX XXXXX XXXXXXX XX XXXXXXXX XXXXXXXX XXXXXX XXXX XX XX XXXX XXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXX XXX XXXX XXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX X XXX XX XXXXXXXXXX XXXXXXX XXXX XXX XXXX XXX XXXXXXXXX XX XXXXXXX XX XXXXXX XXX XXXX XXXXXXX XXX XXXX XXXXXXXXXXX XXX XXXX XXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX X XXX XX XXXXXXXXXX XXXXXXX XXXX XXX XXXX XXXX XXXXXXX XXXXX XXXXXXX XX XXXXXXX XX XXXXXX XXX XXXX XXXXXXX XXX XXXXX XXXXXXXXXXX XXX XXXX XXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX X XXX XX XXXXXXXXXX XXXXXXX XXXX XXX XXXX XXXX XXXX XXXXXXX XXXXX XXX XXXX XXXXXXXXXXXX XX XXXXXXX XX XXXXXX XXX XXXX XXXXXXX XXX XXXXXXXXXXX XXX XXXX XXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXXXXX XX XXX XXXX XXX XXX XXXXXXXXX XXXXXXXXXXX XXXXX XXXX XX XX XXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXX XXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXX XX XXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXXX XXX XX XXXXXX XXXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXX XX XXXXXXX XX XXXXXX XXX XXXX XXXXXX XXXXX XXXXX XXX X XXXXXXXXXX XXX XXX XXXXXX XXX XXX XXXX XXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXXXXX XX XXX XXXX XXX XXXX XX XXX XXXXXXXXX XXXXXXXXXXXX XXXXX XXXX XXXX XX XX XXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XX XXX XXXX XX XXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXXX XXX XX XXXXXX XXXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXX XX XXXXXXX XX XXXXXX XXX XXXX XXXXXX XXXXX XXXXX XXX XXXXXXXXXXX XXX XXX XXXXXX XXX XXX XXX XXXXXXXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXX XX XXX XXXX XXX XXX XXXXXXXXXXX XX XXX XXXXX XXXXXXX XXXX XXXXXX XXX XXXXXXX XX XXX XXXX XX XXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXXX XXX XX XXXXXX XXXXXXXXXX XXXX XXXXXX XXXX XXXXXX XXXXXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXX XXXXX XX XXXXX XX XXX XXXXX XX XXXXXXXXXXXXXX XX XXXXXXXXX XXXXXX XXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXX XXX XXXXXX XX XXX XXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXX XXXXXXX XXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXX X XXXXXX XXXXXXX XXXX XXX XXX XXXXXXXXX XXXXXX XXXXXXX XXX XXXXXXXX XX XXX XXXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXX XXXXX XXX XXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XX XXXXXX XXX XXXXXX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXX XXXXXXXXX XX XXXXXXXXXX XXX XXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XX XXXXXXXXX XX XX XXXXXXXX XX XXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXXXXXX XXX XXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXX XXX XXXXXX XXXXXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXX XX XXXXX XXXXXXX XXXXXXXXX XXXXXX XX X XXXXXXXXXXXX XXXX XXXXX XXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXX XXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXX XX XXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXX XXXX XXXX XXX XXXXX XXXXXXXXXX XXXXXXXX XXXXXX XX XXX XXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXXXXX XX XX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XX XXXXX XXXXXXXX XX XX XXXXX XXX XXXX XXX XXXXXXXX XXXXXX XX XXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXX XXXXXXX XXXX XXXXXX XXXXXX XX XX XXXXXXXXXX XXXXXXX XXXX XXXXXXXX XXXXXX XXX XXXXXXXX XX XXXXXX XXX XXXXX XXXXXXXXXXXX XX XXXXXX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXX XXX XXXXXX XXXX XXXXXXX XXXXXXXXXXX XX XXXXXXXXXXX XX XXXXXX XX XXX XXXX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXX XXXXXX XXXX XXX XXX XXXXXXXXXX XX XXXX XXX XXX XXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXX XX XXXX XXXX XX XXXXX XX XXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X XXXXX XXXX XXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXX XXXXX XXXXXXXXXXXX X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXX XXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXX XXX XXXXX XXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXX XXX XXXXX XXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXX XX XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXX XXXXXXX XX XXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXX XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXX XXXXXXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXX XXXXXX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXX XXX XXXXXXXX XXXXX XXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XX XXXX XXXX XXX XXXXXXX XXXX XX XXX XXXXXXXXX XX XXXXXXXXX XX XXX XXXX XXXXXXXX XXXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXX XXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXX XXXXXXXXX XXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXX XXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XXXXXXXX XXXXXX XXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXXX XXXXXXXXX X XXXXXXXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXXXXX XXXXX XXXXXXXX X XXXXXX XXX XXXX XXXXXXXXX XXXXXX XX XXXXXXXXXXX XXXXXXXX XXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XXXXXXXX XXXXXXXXXXXXXXX XXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXX XXXXXXXX XXXXXXXXXXX XXXXXXX XXXX XXX XXXXX XXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXX XXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXX XXXXXX XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXX XXX XXXXXXXXX XXXXXXX XX XXXXXXX XXXXXXXXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXX XXXXXXXXX XXX XXXXXXXXXX XX XXXXXX XXX XXXXXXXXXX XXX XXXXXXXXXX XXXXXXXX XXXXXXXXXX XXXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXX XXXXXXXXXXXX XXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X XXXXX XXXXXXXXX XXXXXXXX XXXX XXXXX XXXXXXX XXX XXXXXXXX XX XXXXXXXX XX XXXXXX XXXXXX XXXXXX XXXXXX XXX XXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X XXXXX XXXXXXXXX XXXXXXXX XXXXXXX XXXXXXXXXXX XX XXXXXXXX XX XXXXXX XXXXXX XXXXXX XXXXXX XXX XXXXXX XXX XXXXXXX XXXXXXXXX XXX XXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXX XXXXX XXX XXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXX XXXXXXXXX XXXX XXX XXXXXXXXX XXXXXXXXXXXXX XXXXXXXXXXXXXXXXXX XXXX XXX XX XXXX XXX XXXXXXXXXXXX XXXX X XXXX XXXX XX XX XXXX XX XXXXXXXXXX XXXXXXXXXXXXXX XXXX XXXX X XXXX XXXX XX XXXXXXXXXXXXX XXXXXXXXX XXXX XXXX XXXX XXXXXXX XXXXXXXXXX XXX XXXXX XX XXX XXXX XXXX XXXX XXXXXX XXX XXXXXXXXXXX XXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXX XXX XXXX XXXXXXXX XXXX XXXX XXXXXX XXX XX XXXXXXXXXX XXXXXXXXXXXXXXX XXXX XXXX XXX XXXXXX XXXXXX XX XXXXXXX XXXXXXXXXX XX XXXXXX XXX XXXXX XX XXX XXXX XXXX XXXX XXXXXX XXX XX XXXXXXXX XX XXX XXXX XXX XXX XXXXXXXXXXXXXX XXXXXXXXXXX XXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXX XXX XXXX XXXXXXXX XXXX XXXX XXXXXX XXX XX XXXXXXXX XX XXX XXXX XXX XXX XXXXXXXXXXXXXX XX XXXXXXXXXX XXXXXXXXXXXXXXXXX XXXX XXXX XXX XXXX XXXXXX XX XXXXX XXXXXXXXXXXX XXXXXXXXXX XXX XXXX XX XXX XXXXXX XXXX XXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX X XXXXXXXXXX XX XXXXXXX XXXXXXXXX XXXXXXXXXX XXX XXXX XXXXXXXXXXX XXXX XXXX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXX XXX XXXXXX XXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXX XXXXXXXX X XXX XX XXXXXXXXXXX XXXXXXXXX XXXXXXXXXX XXXXXXXXX XXXX XXX XX XXXX XX XXX XXXXX XX XXXX XX XXX XXXXXXX XXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XX XXX XXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXXXXXXXX XXXXXXX XXXXXXXX XXXX XXXXXXX XXXXXXX XXX XXXXXXXXXXXXXX XXXXXXXX XXXX XXXX XXXX XXXXXXX XXX XXXXXXXXXXX XX XXX XX XXX XXXX XXX XXX XX XXXXX XXXX XXX XXXXXXXXXXXXXX XXXXXXXXX XXX XXX XXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXXXXXXXX XXXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXX XXXXXXXX XXX XXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXX X XXXX XXXXX XXXX XXXXXXXX XXXXXXX XXXXXXXXXXXXXXX XXX XXX XXXXXXXX XXXXXXXX XX XXXXXXXX XX XXXX XXXXXX XXX XXXX XXX XXXXXXX XX XXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XX XXXXX XXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XX XXXXX XXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXX XXX XX XXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXX XXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXXX XXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXX XX XXXXXXXXXXXX XXX XXX XXXXXXXXXX XXXXXX XXXXXXXXX XX XXXXXXX XXXXXXXXXXXX XXXX XX XXX XXXXXXX XXXXXXXXXXXXXX XXXXXXX XXXX XX XXXXXXX XX XXXXXXXXXXXXX XXXXX XXXXXXXXXXX XXXXXXXXXX XX X XXXX XXXXXXXXXX XXX XXXXXXXXX XXX XXXXXXXX XXXXXXX XXXX XXXXXX XXX XXXX XXXXXXXXXX XX XXX XXXXXXXXX XXX XXXXXX XXXX XXXXXX XX XX XXX XXXXX XXXXXXXXX XX XXXXXXXXXXXXXX XXXX XXXXXXXXXXXXXXXXX XXXXX XXX XXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXX XXXXXXX XXX XXXXXXX XXXXXXXXXXX XXXXX XX XXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XX XXXXXX XX XX XXXXXX XX X XXXXXXXXX XXX XXXXXXXXXXXXXXX XXXXXXXXXXXX XXX XXXX XXXXXXX XXXX XXX XXXXXXXXX XXXX XXXXX XXXX XXXXXXXXX XX XXXXX XXX XX XXXXXXXXXXX XX XXXXX XX XXX XXXXXXX XXXXXXXXXXXXXXXXX XXXX XXXXXX XX XXXXXX XX XX XXXXXX XX X XXXXXXXXXX XXX XXXXXX XXXXXX XXXXXXX XX XXXXXXX XX XXXXX XXXXXXXX XX XXXXX XX XXX XXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXXXXXXX XXXXXXXXX XXXXX XX XXXXXXXXXXXX XXXXXXXXXXXX XXXX XXXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XX XXXXXXXXXXXX XX XXXXXXXXX XX XXXXX XX XXXXX X XXXXXXXX XXXX XXXXXXXXXX XXXXX XXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XX XXXXXXXXXXXXX XXXX XX XXXXXXXXX XXXXXXXXXXX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XX XXXXXXXX XX XX XXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXX XX XX XX XXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXX XXX XX XXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXX XXX XXXX XXXXX XXX XXXX XXXXXXXXXXXX XXXXXXX XX XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXX XXX XX XXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXX XXX XXXX XXX XXXXXXXXXXX XX XXX XXXXXX XXXX XXXXXXX XXXXXXX XX XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXX XXX XX XXXXXXXXXX XXXXXXX XXX XXXXXXXXXXXX XXXX XXXXXXXXX XXXX XXXX XXXXXXXXXXX XXX XXXXX XXXXXXXXXXXX XXXXXXX XX XXXXX XXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXX XXXXX XXXXXXXXX XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXX XX XXXXXXXXXXXX XXX XXX XXXXXXXXXX XXXXXX XXXXXXXXX XXXXXXX XXXXXXXXX XX XXX XXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXX XXXXXXX XXX XXXXXXXXXXXX XXX XXX XXXXXXXXXXX XX XXX XXX XXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXX XXX XXXX XX XXXXXXX XX XXXXXXXXXXXXX XX XXXXX XXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXX XXXXXXXX XXXXX XXXX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XXXXXX XXXXXXX XXXXXXXXX XXX XXXXX XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XXXXXX XXXX XXXXX XXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXX XXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XXX XXXXXX XXXXX XXX XXXX XXX XXXXXXXXXX XXXXXXXX XXXXXX XX XXX XXXX XX XXXXXXX XXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XX X XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXX XX XXXXX XXXXXXXX XX XX XXXXX XXX XXXX XXX XXXXXXXX XXXXXX XX XXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXX XXXXXXX XXXX XXXXXX XXXXXX XX XX XXXXXXXXXX XXXXXXX XXXX XXXXXXXX XXXXXX XXX XXXXXXXX XX XXXXXX XXX XXXXX XXXXXXXXXXXX XX XXXXXX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXX XXXXXXXXXX XXX XXXXXX XXXX XXXXXXX XXXXXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XX XXXXXXX XXXXXX XXXXXXXX XXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXX XXXXXXXXX XXXX XXXXX XXXX XXXXXXXX XXXXXX XXXXXX XXXX XX XXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XX XX XXXXXXX XXXXXXXX XXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXX XXX XXXX XXXXXXX XX XXXX XXXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XX XXXXXXXXXXXXX XXXXX XXXXXXXXX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXX XX XXX XXXX XXXX XXXXXXXX XXX XXX XXXXXX XXXX XXX XXXXXXXXXXXXXX XXXXXXX XXXX XXXXXXXX XXXX XXXX XXXXX XXX XXXXXXXX XXXXX XXXXXXXXXX XX XXXXXXXX XX XXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XXXXXXXX XX XXXXXXXXXX XXXXXXXXXX XXXXXXX XX XXX X XXXX XXXXXX XX XXXXXXX XX XXX XXXXXXX XX XXX XXXXXXXX XXXXXXXX XX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX XXX XXXXXXXX XXXXXX XX XXXXXXXXXXXXXXX XX XXXXXXXXXX XXXXXXXX XXXX XXXXXX XXXXXXX XXX XXXX XXXXXX XXXX XXX XXXXX XXXXXXXXX XXXXXXXX X XXX XXXX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXX XXXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXXXXXXXX XXX X XXXXXXXX XXXXXX XXXX XXX XXXXX XXXXXXXX XX XXX XXXXX XX XXX XXXXXXXXX XXXXXXXXXXX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XX XXXXXXXX XX XX XXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXX XX XX XX XXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXX XXX XXXXXXXX XX XXX XXXXXXXXXXXX XXXXX XXXXXXXXX XXXX XX XXXXXXXXXXXX XXXXX XX XXXXX XX XX XXX XX XXXXXX X XXXX XXXXXXX XXXXXXX XXX XXXXXXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXX XXXXXXXXXX X XXXXX XXXXXXX XXXXX XXXX XXXXXX XX XXXXXX XXXXXXXXXXX XXXXX X XXX XXXX XX XXXXXXXX XXX XXX XX XXXX XX XXXXXXX XXXXXX XXXXX XXXXXXXX XXXX XX XXXXXXX XXX XXXXXX XXXXXX XXXXX XX XXXXXXXXXX XX XX XXXX XXXXXXXXXX XXXXXXX XXX XXXX XXXXXXX XXXXXXXXXXX XX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXX XXX XX XXXXXXXX XX XX XXXXXX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXX XX XX XX XXX XXXXXXXXX XX XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXX XXX XXXX XX XXXXXXX XX XXXXXXXXXXXXX XXXX XXXXXX XXXXXXX XXXXXXXXX XXX XXXXX XXXX XXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XXXXXX XXXX XXXXX XXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXX XXX XXXXXXXX XX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXX XX XXXXXXX XXXXXX XXXXXXXX XXXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXX XXXXXXX XXXXXXXXX XXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXX XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX XXXXXXXXXXXXXXXXX XXXXXXX XXX XXXX XXXXX XXXXXXXX XXXXXXXXXX XXXX XXX XXXXX XXXXXXXXXXXXX XXXXXXXX XX XXXXXX XX XXX XXXXXXXXXXXXXX XXXXXXX XXXXXX XX XXX XXXXXXX XX XXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XX XXXX XXX XXXXXXXXX XXXXXXXXXXXXXX XXXXXX XX XXXXXXXX XXX XXXX XXXXX XXXXXXXX XXX XXXX XXXXXXXX XXX XXXXXXX XX XXXXXXX XXX XXXX XXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXX XXXXXXX XX XXXXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX XXX XXXXXXXXXXXXXX XXXXXXX XXXXXX XX XXX XXXXXXX XX XX XXXXXX XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X XXXX XXXXX XXXXXXXX XX XXX XXXXXXXXX XXXXXXXXXXXXXX XXXXXXX XX XX XXX XXXXXXX XXXX XXXX XXXXXXX XXXXXXXXX
38.12091
96
0.79044
e3efc019f189a8a6987dd98946e89c72d64fa190
2,218
py
Python
BIA 660 - Web Analytics/Assignments/Assignment 2/webcounter.py
ParasGarg/Stevens-Computer-Science-Courses-Materials
13015e6e83471d89ae29474857fe83a81994420f
[ "MIT" ]
25
2017-03-23T04:51:18.000Z
2022-03-03T21:51:11.000Z
BIA 660 - Web Analytics/Assignments/Assignment 2/webcounter.py
vaishnavimecit/Stevens-Computer-Science-Courses-Materials
13015e6e83471d89ae29474857fe83a81994420f
[ "MIT" ]
null
null
null
BIA 660 - Web Analytics/Assignments/Assignment 2/webcounter.py
vaishnavimecit/Stevens-Computer-Science-Courses-Materials
13015e6e83471d89ae29474857fe83a81994420f
[ "MIT" ]
19
2018-05-10T05:17:05.000Z
2022-03-12T05:18:58.000Z
""" A script that reads a file from the web and returns the all the words having frequency in between two words passed """ import re from nltk.corpus import stopwords import requests from operator import itemgetter if __name__=='__main__': word1 = "park" word2 = "amazon" print(run('http://tedlappas.com/wp-content/uploads/2016/09/textfile.txt', word1, word2))
35.774194
175
0.626691
e3f2542b1e8fcfc1c962b23f153fdbfa31f29be1
4,487
py
Python
dev/archery/archery/integration/util.py
palmerlao/arrow
4e680c46ad5aa76ba1dc85574c4e96a51450364f
[ "Apache-2.0" ]
null
null
null
dev/archery/archery/integration/util.py
palmerlao/arrow
4e680c46ad5aa76ba1dc85574c4e96a51450364f
[ "Apache-2.0" ]
8
2020-04-10T19:03:51.000Z
2021-01-21T01:06:28.000Z
dev/archery/archery/integration/util.py
signavio/arrow
866e6a82e2794b151235c19b8c5cbf1fcaf780ef
[ "CC-BY-3.0", "Apache-2.0", "CC0-1.0" ]
null
null
null
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import contextlib import io import os import socket import string import subprocess import sys import threading import uuid import numpy as np RANDS_CHARS = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1)) # SKIP categories SKIP_ARROW = 'arrow' SKIP_FLIGHT = 'flight' ARROW_ROOT_DEFAULT = os.environ.get( 'ARROW_ROOT', os.path.abspath(__file__).rsplit("/", 5)[0] ) printer = _Printer() log = printer.print def rands(nchars): """ Generate one random byte string. See `rands_array` if you want to create an array of random strings. """ return ''.join(np.random.choice(RANDS_CHARS, nchars)) # Adapted from CPython def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM): """Returns an unused port that should be suitable for binding. This is achieved by creating a temporary socket with the same family and type as the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to the specified host address (defaults to 0.0.0.0) with the port set to 0, eliciting an unused ephemeral port from the OS. The temporary socket is then closed and deleted, and the ephemeral port is returned. """ with socket.socket(family, socktype) as tempsock: tempsock.bind(('', 0)) port = tempsock.getsockname()[1] del tempsock return port
28.398734
77
0.654558
e3f2b53a7343d04d14b8c9e8a2dd45c0ae9f242e
4,715
py
Python
python/src/cmdline/write_struct.py
hgmelectronics/xcpsetup
646d22537f58e59c3fe324da08c4dbe0d5881efa
[ "BSD-2-Clause" ]
null
null
null
python/src/cmdline/write_struct.py
hgmelectronics/xcpsetup
646d22537f58e59c3fe324da08c4dbe0d5881efa
[ "BSD-2-Clause" ]
null
null
null
python/src/cmdline/write_struct.py
hgmelectronics/xcpsetup
646d22537f58e59c3fe324da08c4dbe0d5881efa
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/python3 import argparse import ctypes import json import sys if not '..' in sys.path: sys.path.append('..') from comm import BoardTypes from comm import CANInterface from comm import XCPConnection from util import plugins from util import ctypesdict from util import config import argProc plugins.loadPlugins() config.loadSysConfigs() parser = argparse.ArgumentParser(description="writes data to a board using a preparsed C struct to define layout in memory") parser.add_argument('-c', nargs='*', help='Extra configuration files to load', dest='configFiles', default=[]) parser.add_argument('-d', help="CAN device URI", dest="deviceURI", default=None) parser.add_argument('-T', help="Target device type (ibem,cda,cs2) for automatic XCP ID selection", dest="targetType", default=None) parser.add_argument('-i', help="Target ID or range of IDs (e.g. 2, 1-3, recovery) for automatic XCP ID selection", dest="targetID", default=None) parser.add_argument('-l', help="Location of config structure in form <segment>:<baseaddr>", default="0:0", dest="structLocation") parser.add_argument('-s', help="Pickled structure definition", dest="structSpec") parser.add_argument('-D', help="Dump all XCP traffic, for debugging purposes", dest="dumpTraffic", action="store_true", default=False) parser.add_argument('-r', help='Maximum times to retry read-modify-write operation', dest='maxAttempts', type=int, default=10) parser.add_argument('inputFile', help="Input file name (if range of IDs specified must contain a {} to be replaced with the ID)", default=None) args = parser.parse_args() config.loadConfigs(args.configFiles) BoardTypes.SetupBoardTypes() try: boardType = BoardTypes.types[args.targetType] except KeyError: print('Could not find board type ' + str(args.targetType)) sys.exit(1) try: ConfigType = argProc.GetStructType(args.structSpec) structSegment,structBaseaddr = argProc.GetStructLocation(args.structLocation) except argProc.ArgError as exc: print(str(exc)) sys.exit(1) with CANInterface.MakeInterface(args.deviceURI) as interface: targetSlaves = boardType.SlaveListFromIdxArg(args.targetID) if len(targetSlaves) == 0: slaves = boardType.GetSlaves(interface) for i in range(0, len(slaves)): print(str(i) + ': ' + slaves[i][0].description() + ', ID ' + str(slaves[i][1])) index = int(input('Slave: ')) if index >= len(slaves): exit targetSlaves = [slaves[index]] for targetSlave in targetSlaves: if targetSlave[1] != None: print('Connecting to target addr ' + targetSlave[0].description() + ', ID ' + str(targetSlave[1])) else: print('Connecting to target addr ' + targetSlave[0].description()) for attempt in range(1, args.maxAttempts + 1): try: inFile = OpenInFile(args.inputFile, targetSlave[1]) inDict = json.loads(inFile.read()) inFile.close() conn = boardType.Connect(interface, targetSlave, args.dumpTraffic) # Read the existing data from the board - in case the dict we have loaded does not cover the entire struct conn.set_cal_page(structSegment, 0) dataBuffer = conn.upload(XCPConnection.Pointer(structBaseaddr, 0), ctypes.sizeof(ConfigType)) dataStruct = ConfigType.from_buffer_copy(dataBuffer) # Set the data in the struct from the existing one writeDataStruct = dataStruct # Merge in data from the loaded dictionary ctypesdict.setfromdict(writeDataStruct, inDict) writeDataBuffer=bytes(memoryview(writeDataStruct)) # Write the new buffer to the board conn.download(XCPConnection.Pointer(structBaseaddr, 0), writeDataBuffer) conn.nvwrite() try: conn.close() except XCPConnection.Error: pass # swallow any errors when closing connection due to bad target implementations - we really don't care print('Write OK') writeOK = True break except XCPConnection.Error as err: print('Write failure (' + str(err) + '), attempt #' + str(attempt)) writeOK = False if not writeOK: sys.exit(1)
42.477477
145
0.634783
e3f35c53bc5f2d93179fd278d659372e135f798d
2,383
py
Python
doc/python_api/examples/bpy.types.Depsgraph.1.py
rbabari/blender
6daa85f14b2974abfc3d0f654c5547f487bb3b74
[ "Naumen", "Condor-1.1", "MS-PL" ]
365
2015-02-10T15:10:55.000Z
2022-03-03T15:50:51.000Z
doc/python_api/examples/bpy.types.Depsgraph.1.py
rbabari/blender
6daa85f14b2974abfc3d0f654c5547f487bb3b74
[ "Naumen", "Condor-1.1", "MS-PL" ]
45
2015-01-09T15:34:20.000Z
2021-10-05T14:44:23.000Z
doc/python_api/examples/bpy.types.Depsgraph.1.py
rbabari/blender
6daa85f14b2974abfc3d0f654c5547f487bb3b74
[ "Naumen", "Condor-1.1", "MS-PL" ]
172
2015-01-25T15:16:53.000Z
2022-01-31T08:25:36.000Z
""" Dependency graph: Evaluated ID example ++++++++++++++++++++++++++++++++++++++ This example demonstrates access to the evaluated ID (such as object, material, etc.) state from an original ID. This is needed every time one needs to access state with animation, constraints, and modifiers taken into account. """ import bpy if __name__ == "__main__": register()
39.065574
99
0.675619
e3f5aaf3ddf858989f83bcba1743ef73978162e1
2,411
py
Python
upgrade-insecure-requests/support/generate.py
Thezone1975/wpt
9e201113cf36aefe07fe9c14caa47705d541e141
[ "BSD-3-Clause" ]
1
2019-09-10T22:45:24.000Z
2019-09-10T22:45:24.000Z
upgrade-insecure-requests/support/generate.py
Thezone1975/wpt
9e201113cf36aefe07fe9c14caa47705d541e141
[ "BSD-3-Clause" ]
3
2017-10-06T15:45:34.000Z
2018-09-11T12:49:57.000Z
upgrade-insecure-requests/support/generate.py
Thezone1975/wpt
9e201113cf36aefe07fe9c14caa47705d541e141
[ "BSD-3-Clause" ]
null
null
null
# Usage: execute # $ python support/generate.py # at wpt/upgrade-insecure-requests/. # # Note: Some tests (link-upgrade.sub.https.html and # websocket-upgrade.https.html) are not covered by this generator script. template = '''<!DOCTYPE html> <html> <head> <!-- Generated by wpt/upgrade-insecure-requests/support/generate.py -->%(additionalMeta)s <title>Upgrade Insecure Requests: %(name)s.</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="./support/testharness-helper.sub.js"></script> <script src="/common/security-features/resources/common.sub.js"></script> <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> </head> <body> <script> const tests = %(generatorName)s(ResourceType.%(resourceType)s, %(sameOriginOnly)s); tests.forEach(test => testMap['%(name)s'](test)); </script> </body> </html> ''' # resourceType is |ResourceType| in testharness-helper.sub.js. for name, resourceType in [ ('image', 'IMAGE'), ('iframe', 'FRAME'), ('animation-worklet', 'WORKLET'), ('audio-worklet', 'WORKLET'), ('layout-worklet', 'WORKLET'), ('paint-worklet', 'WORKLET'), ('worker', 'WORKER'), ('module-worker', 'WORKER'), ('worker-subresource-xhr', 'FETCH'), ('worker-subresource-fetch', 'FETCH'), ('shared-worker', 'SHARED_WORKER')]: # TODO(https://crbug.com/989399): Add tests for subresource requests on shared # workers, and main/subresource requests on service workers. sameOriginOnly = 'false' if resourceType == 'WORKER' or resourceType == 'SHARED_WORKER': sameOriginOnly = 'true' types = [('', 'generateTests'), ('-redirect', 'generateRedirectTests')] if name == 'module-worker' or resourceType == 'WORKLET': types.append(('-import', 'generateModuleImportTests')) for typeName, generatorName in types: filename = '%s%s-upgrade.https.html' % (name, typeName) with open(filename, 'w') as html_file: html_file.write(template % { 'name': name, 'additionalMeta': getLong(filename), 'resourceType': resourceType, 'generatorName': generatorName, 'sameOriginOnly': sameOriginOnly})
37.092308
89
0.690585
e3f5cd033fa43c92ae4a7eb4ce55f52eab4be962
424
py
Python
model_constructor/mxresnet.py
ayasyrev/model_constructor
3759a02dd9f7aa1ca3e6a4a5aefe72380886207e
[ "Apache-2.0" ]
3
2020-08-02T09:18:27.000Z
2021-12-22T07:43:37.000Z
model_constructor/mxresnet.py
ayasyrev/model_constructor
3759a02dd9f7aa1ca3e6a4a5aefe72380886207e
[ "Apache-2.0" ]
16
2020-11-09T11:35:13.000Z
2021-12-23T13:04:54.000Z
model_constructor/mxresnet.py
ayasyrev/model_constructor
3759a02dd9f7aa1ca3e6a4a5aefe72380886207e
[ "Apache-2.0" ]
2
2020-04-08T20:56:48.000Z
2021-01-20T13:37:52.000Z
from functools import partial from .activations import Mish from .net import Net __all__ = ['mxresnet_parameters', 'mxresnet34', 'mxresnet50'] mxresnet_parameters = {'stem_sizes': [3, 32, 64, 64], 'act_fn': Mish()} mxresnet34 = partial(Net, name='MXResnet32', expansion=1, layers=[3, 4, 6, 3], **mxresnet_parameters) mxresnet50 = partial(Net, name='MXResnet50', expansion=4, layers=[3, 4, 6, 3], **mxresnet_parameters)
32.615385
101
0.71934
e3f60625a8143b4d147e2f952742a97ef41ee31f
1,242
py
Python
1.undersampling.py
Moons08/TalkingData-Fraud-Detection
c88fb8b5358f6057603b7725ed2767fab47c51c6
[ "MIT" ]
1
2019-01-18T06:20:54.000Z
2019-01-18T06:20:54.000Z
1.undersampling.py
Moons08/LightGBM-tutorial-Fraud_Detection
c88fb8b5358f6057603b7725ed2767fab47c51c6
[ "MIT" ]
null
null
null
1.undersampling.py
Moons08/LightGBM-tutorial-Fraud_Detection
c88fb8b5358f6057603b7725ed2767fab47c51c6
[ "MIT" ]
null
null
null
import os import pandas as pd from imblearn.under_sampling import RandomUnderSampler from contextlib import contextmanager import psutil import time with timer_memory('undersampling'): under_sampling()
26.425532
82
0.587762
e3f69e5b14024599fb273e979ccbc45a1c411ded
8,652
py
Python
spydrnet/plugins/namespace_manager/tests/test_edif_namespace.py
ganeshgore/spydrnet
22672b8fc7d63461a71077bd20f29df6d38e96f4
[ "BSD-3-Clause" ]
34
2020-03-12T15:40:49.000Z
2022-02-28T07:13:47.000Z
spydrnet/plugins/namespace_manager/tests/test_edif_namespace.py
ganeshgore/spydrnet
22672b8fc7d63461a71077bd20f29df6d38e96f4
[ "BSD-3-Clause" ]
104
2020-01-06T20:32:19.000Z
2022-01-02T00:20:14.000Z
spydrnet/plugins/namespace_manager/tests/test_edif_namespace.py
ganeshgore/spydrnet
22672b8fc7d63461a71077bd20f29df6d38e96f4
[ "BSD-3-Clause" ]
10
2020-09-02T20:24:00.000Z
2022-02-24T16:10:07.000Z
import unittest import spydrnet as sdn def test_duplicate_definition_elements(self): def1 = self.gen_definition() port = def1.create_port() instance = def1.create_child() cable = def1.create_cable() port['EDIF.identifier'] = "my_lib" instance['EDIF.identifier'] = "my_lib" cable['EDIF.identifier'] = "my_lib" def test_rename(self): netlist = self.gen_netlist() lib1 = netlist.create_library() lib1['EDIF.identifier'] = "my_lib1" lib1['EDIF.identifier'] = "my_lib2" lib1['EDIF.identifier'] = "my_lib1" lib2 = netlist.create_library() lib2['EDIF.identifier'] = "my_lib2" def1 = lib1.create_definition() def1['EDIF.identifier'] = "my_lib1" def1['EDIF.identifier'] = "my_lib2" def1['EDIF.identifier'] = "my_lib1" def2 = lib1.create_definition() def2['EDIF.identifier'] = "my_lib2" c = def1.create_cable() c['EDIF.identifier'] = "&1" c['EDIF.identifier'] = "&2" c['EDIF.identifier'] = "&1" p = def1.create_port() p['EDIF.identifier'] = "&1" p['EDIF.identifier'] = "&2" p['EDIF.identifier'] = "&1" i = def1.create_child() i['EDIF.identifier'] = "&1" i['EDIF.identifier'] = "&2" i['EDIF.identifier'] = "&1" def test_remove(self): netlist = self.gen_netlist() lib1 = netlist.create_library() lib1['EDIF.identifier'] = "my_lib1" netlist.remove_library(lib1) lib2 = netlist.create_library() lib2['EDIF.identifier'] = "my_lib1" def1 = lib2.create_definition() def1['EDIF.identifier'] = "my_lib1" lib2.remove_definition(def1) def2 = lib2.create_definition() def2['EDIF.identifier'] = "my_lib1" c1 = def2.create_cable() c2 = def2.create_cable() p1 = def2.create_port() p2 = def2.create_port() i1 = def2.create_child() i2 = def2.create_child() c1['EDIF.identifier'] = "&1" def2.remove_cable(c1) c2['EDIF.identifier'] = "&1" p1['EDIF.identifier'] = "&1" def2.remove_port(p1) p2['EDIF.identifier'] = "&1" i1['EDIF.identifier'] = "&1" def2.remove_child(i1) i2['EDIF.identifier'] = "&1" def test_orphaned_add(self): netlist = self.gen_netlist() lib1 = sdn.Library() lib1["EDIF.identifier"] = '&1' netlist.add_library(lib1) # TODO: rename an object # TODO: orphan an object and see what happens
33.66537
66
0.592811
e3f744a34f5cd637c13b66b21c7bdf2144d67708
3,344
py
Python
tf_agents/benchmark/distribution_strategy_utils.py
FlorisHoogenboom/agents
2cd5a61e1838b52012271f1fb8617c29a55279a9
[ "Apache-2.0" ]
16
2020-09-23T06:21:49.000Z
2022-03-28T05:45:04.000Z
tf_agents/benchmark/distribution_strategy_utils.py
FlorisHoogenboom/agents
2cd5a61e1838b52012271f1fb8617c29a55279a9
[ "Apache-2.0" ]
null
null
null
tf_agents/benchmark/distribution_strategy_utils.py
FlorisHoogenboom/agents
2cd5a61e1838b52012271f1fb8617c29a55279a9
[ "Apache-2.0" ]
6
2020-10-09T06:33:23.000Z
2022-02-03T16:16:36.000Z
# coding=utf-8 # Copyright 2018 The TF-Agents Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Lint as: python2, python3 """Helper functions for running models in a distributed setting.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from six.moves import range import tensorflow as tf # pylint: disable=g-explicit-tensorflow-version-import def get_distribution_strategy(distribution_strategy="default", num_gpus=0, num_packs=-1): """Return a DistributionStrategy for running the model. Args: distribution_strategy: a string specifying which distribution strategy to use. Accepted values are 'off', 'default', 'one_device', and 'mirrored' case insensitive. 'off' means not to use Distribution Strategy; 'default' means to choose from `MirroredStrategy`or `OneDeviceStrategy` according to the number of GPUs. num_gpus: Number of GPUs to run this model. num_packs: Optional. Sets the `num_packs` in `tf.distribute.NcclAllReduce`. Returns: tf.distribute.DistibutionStrategy object. Raises: ValueError: if `distribution_strategy` is 'off' or 'one_device' and `num_gpus` is larger than 1; or `num_gpus` is negative. """ if num_gpus < 0: raise ValueError("`num_gpus` can not be negative.") distribution_strategy = distribution_strategy.lower() if distribution_strategy == "off": if num_gpus > 1: raise ValueError("When {} GPUs are specified, distribution_strategy " "cannot be set to 'off'.".format(num_gpus)) return None if (distribution_strategy == "one_device" or (distribution_strategy == "default" and num_gpus <= 1)): if num_gpus == 0: return tf.distribute.OneDeviceStrategy("device:CPU:0") else: if num_gpus > 1: raise ValueError("`OneDeviceStrategy` can not be used for more than " "one device.") return tf.distribute.OneDeviceStrategy("device:GPU:0") if distribution_strategy in ("mirrored", "default"): if num_gpus == 0: assert distribution_strategy == "mirrored" devices = ["device:CPU:0"] else: devices = ["device:GPU:%d" % i for i in range(num_gpus)] cross_device_ops = None if num_packs > -1: cross_device_ops = tf.distribute.NcclAllReduce(num_packs=num_packs) return tf.distribute.MirroredStrategy(devices=devices, cross_device_ops=cross_device_ops)
34.474227
80
0.696172
e3f85ec084254dfe08068ef5fd90d188baae09d8
72
py
Python
barbarism.py
Matimed/Barbarism
4892092f24f314bc6cfacc1c780436dc59fc90ac
[ "MIT" ]
2
2021-09-09T14:03:40.000Z
2021-11-03T03:35:55.000Z
barbarism.py
Matimed/Barbarism
4892092f24f314bc6cfacc1c780436dc59fc90ac
[ "MIT" ]
null
null
null
barbarism.py
Matimed/Barbarism
4892092f24f314bc6cfacc1c780436dc59fc90ac
[ "MIT" ]
null
null
null
import pygame as pg pg.init() from src.main import Main main = Main()
10.285714
25
0.708333
e3f8f7b3257c5bd12d8d3490e725fe8a7a51ecb9
388
py
Python
frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py
anandpdoshi/frappe
b3546f1ebcac3480eccf5d19371ca534e7ce79bb
[ "MIT" ]
null
null
null
frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py
anandpdoshi/frappe
b3546f1ebcac3480eccf5d19371ca534e7ce79bb
[ "MIT" ]
null
null
null
frappe/patches/v7_0/desktop_icons_hidden_by_admin_as_blocked.py
anandpdoshi/frappe
b3546f1ebcac3480eccf5d19371ca534e7ce79bb
[ "MIT" ]
5
2016-06-20T08:48:11.000Z
2018-12-12T09:42:31.000Z
import frappe
43.111111
88
0.737113
e3f9d1e7fbd73db26f8548fce222535435572494
3,985
py
Python
gen_mirror_json.py
Ashwin4RC/api
e6fc38b5ef8510ab4a11cb492fe49b9ed2cbcc58
[ "Apache-2.0" ]
null
null
null
gen_mirror_json.py
Ashwin4RC/api
e6fc38b5ef8510ab4a11cb492fe49b9ed2cbcc58
[ "Apache-2.0" ]
null
null
null
gen_mirror_json.py
Ashwin4RC/api
e6fc38b5ef8510ab4a11cb492fe49b9ed2cbcc58
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # pylint: disable=missing-docstring,invalid-name,broad-except,cell-var-from-loop import hashlib import json import os import sys from utils import get_date_from_zip, get_metadata_from_zip ALLOWED_BUILDTYPES = ["Alpha", "Beta", "Official", "Gapps"] ALLOWED_VERSIONS = ["9.0", "10"] FILE_BASE: str = os.getenv("FILE_BASE", "/mnt/builds") DEBUG = False builds: dict = {} zips: dict = {} for file in [ os.path.join(dp, file) for dp, dn, fn in os.walk(FILE_BASE) for file in fn ]: try: if file.split(".")[-1] != "zip": continue zip_name = file.replace(FILE_BASE, "") if zip_name.split(".")[0].split("-")[-1] == "img": continue version, buildtype, device, builddate = get_metadata_from_zip(zip_name) if buildtype not in ALLOWED_BUILDTYPES: if DEBUG: print( f"{zip_name} has a buildtype of {buildtype}, which is not allowed!", file=sys.stderr, ) continue if version not in ALLOWED_VERSIONS: if DEBUG: print( f"{zip_name} has a version of {version}, which is not allowed!", file=sys.stderr, ) continue if device in zips: for build in zips[device]: if buildtype in zips[device]: if builddate > get_date_from_zip(zips[device][buildtype]): zips[device][buildtype] = zip_name else: raise Exception else: zips[device][buildtype] = zip_name else: zips[device] = {} zips[device][buildtype] = zip_name except Exception as e: continue for key, value in zips.items(): for device in value: file = zips[key][device] try: filename = file.split("/")[-1] if file[0] == "/": file = file[1:] file = os.path.join(FILE_BASE, file) img_file = os.path.isfile(file.replace('.zip', '-img.zip')) boot_img = os.path.isfile(file.replace('.zip', '-boot.img')) sha256_file = file.replace(".zip", ".sha256") version, buildtype, device, builddate = get_metadata_from_zip(file) if os.path.isfile(sha256_file): if DEBUG: print( f"SHA256 for {filename} already exists, skipping!", file=sys.stderr, ) else: print(f"Hashing SHA256 for {filename}!", file=sys.stderr) sha256 = hashlib.sha256() with open(file, "rb") as f: for buf in iter(lambda: f.read(128 * 1024), b""): sha256.update(buf) f = open(sha256_file, "w") f.write(sha256.hexdigest()) f.close() f = open(sha256_file, "r") zip_sha256 = f.read() f.close() builds.setdefault(device, []).append( { "sha256": zip_sha256, "size": os.path.getsize(file), "date": "{}-{}-{}".format( builddate[0:4], builddate[4:6], builddate[6:8] ), "filename": filename, "filepath": file.replace(filename, "").replace(FILE_BASE, ""), "version": version, "type": buildtype.lower(), "fastboot_images": img_file, "boot_image": boot_img, } ) except IndexError: continue # pylint: disable=consider-iterating-dictionary for device in builds.keys(): builds[device] = sorted(builds[device], key=lambda x: x["date"]) print(json.dumps(builds, sort_keys=True, indent=4))
36.227273
88
0.496863
e3f9dc11cb81a8cb80e6cd940f8a035848122990
431
py
Python
button/take_screen.py
PitPietro/gpiozero-pyqt5
0384d34348841d193c025a1909d909d1bf772a7d
[ "MIT" ]
null
null
null
button/take_screen.py
PitPietro/gpiozero-pyqt5
0384d34348841d193c025a1909d909d1bf772a7d
[ "MIT" ]
null
null
null
button/take_screen.py
PitPietro/gpiozero-pyqt5
0384d34348841d193c025a1909d909d1bf772a7d
[ "MIT" ]
null
null
null
import os # from signal import pause from gpiozero import Button from datetime import datetime take_screen()
21.55
77
0.605568
e3fb07a9be04e9aa4d5249fcb856df6a2aede22a
1,435
py
Python
year2020/day21.py
3schwartz/AdventOfCode
32f259c4e20c3c4834718411f1053b6a11f71c86
[ "MIT" ]
null
null
null
year2020/day21.py
3schwartz/AdventOfCode
32f259c4e20c3c4834718411f1053b6a11f71c86
[ "MIT" ]
null
null
null
year2020/day21.py
3schwartz/AdventOfCode
32f259c4e20c3c4834718411f1053b6a11f71c86
[ "MIT" ]
null
null
null
import common lines = common.get_lines('day21_data.txt') food_dict = {} all_ingredients = [] for line in lines: ingredients, allergens = line.split(' (contains ') allergens = allergens[:-1].split(', ') ingredients = ingredients.split(' ') all_ingredients.extend(ingredients) for allergen in allergens: if food_dict.get(allergen) is None: food_dict[allergen] = set(ingredients) else: food_dict[allergen] = food_dict[allergen].intersection(set(ingredients)) safe_ingredients = set(all_ingredients) \ .difference(set(ingredient for value in food_dict.values() for ingredient in value)) print(f"Part 1: {sum(ingredient in safe_ingredients for ingredient in all_ingredients)}") while any(len(ingredients) > 1 for ingredients in food_dict.values()): for allergen, ingredients in food_dict.items(): if len(ingredients) == 1: for inner_allergen, inner_ingredients in food_dict.items(): if allergen == inner_allergen: continue ingredient = next(iter(ingredients)) if ingredient in inner_ingredients: food_dict[inner_allergen].remove(ingredient) names = list(food_dict.keys()) names.sort() print(f"Part 2: {','.join(next(iter(food_dict[allergen])) for allergen in names)}")
32.613636
90
0.627875
e3fb126e341fe57625eff17359d622708faa18e2
4,279
py
Python
src/model_evaluation.py
Littleote/Analisis_de_contrasenyes
3837153e82b9da0c6f8ed1c372103944f3acaca6
[ "MIT" ]
null
null
null
src/model_evaluation.py
Littleote/Analisis_de_contrasenyes
3837153e82b9da0c6f8ed1c372103944f3acaca6
[ "MIT" ]
null
null
null
src/model_evaluation.py
Littleote/Analisis_de_contrasenyes
3837153e82b9da0c6f8ed1c372103944f3acaca6
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ @author: david """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np from sklearn.model_selection import KFold from sklearn.metrics import confusion_matrix, classification_report from sklearn.metrics import PrecisionRecallDisplay, RocCurveDisplay
40.752381
117
0.475111
e3fb3094156efbfadeca185946c48f3c4d800789
1,632
py
Python
setup.py
zhuzhenping/hf_at_py
edbbefc7dd1d476ed7fd62ad9635888cfc5fcb44
[ "Apache-2.0" ]
130
2017-03-10T02:01:38.000Z
2021-01-10T03:55:30.000Z
setup.py
zhuzhenping/hf_at_py
edbbefc7dd1d476ed7fd62ad9635888cfc5fcb44
[ "Apache-2.0" ]
3
2018-11-30T00:07:50.000Z
2020-12-01T13:01:13.000Z
setup.py
zhuzhenping/hf_at_py
edbbefc7dd1d476ed7fd62ad9635888cfc5fcb44
[ "Apache-2.0" ]
69
2017-04-01T13:57:21.000Z
2020-10-07T11:29:45.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/20 8:15 # @Author : HaiFeng # @Email : 24918700@qq.com from setuptools import setup import os this_directory = os.path.abspath(os.path.dirname(__file__)) # # long_description = read_file('readme.md') long_description_content_type = 'text/markdown' # markdown # talib os.system('pipreqs . --encoding=utf8 --force') # requirements.txt setup( name='hfpy', # python_requires='>=3.6.0', # python version='0.2.2', # description="Hai Feng Future Trading Platform with SE", # PyPI long_description=long_description, # Readme long_description_content_type=long_description_content_type, # markdown author="HaiFeng", # author_email='haifengat@vip.qq.com', url='https://github.com/haifengat/hf_at_py', # find_packages() # packages=find_packages(), packages=['hfpy'], install_requires=read_requirements('requirements.txt'), # include_package_data=True, license="MIT License", platforms="any", classifiers=[ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], )
29.142857
84
0.674632
e3fbc1eef6b6ab6c9a1ff3c81478fc53b610ea00
6,478
py
Python
web_console_v2/api/fedlearner_webconsole/scheduler/transaction.py
chen1i/fedlearner
981514dadbd0aa49ae87d185dd247d310e35605c
[ "Apache-2.0" ]
5
2020-04-14T06:37:45.000Z
2021-04-26T15:58:01.000Z
web_console_v2/api/fedlearner_webconsole/scheduler/transaction.py
chen1i/fedlearner
981514dadbd0aa49ae87d185dd247d310e35605c
[ "Apache-2.0" ]
1
2020-04-27T03:01:27.000Z
2020-04-27T03:01:27.000Z
web_console_v2/api/fedlearner_webconsole/scheduler/transaction.py
chen1i/fedlearner
981514dadbd0aa49ae87d185dd247d310e35605c
[ "Apache-2.0" ]
13
2020-02-20T05:56:52.000Z
2020-06-08T07:11:25.000Z
# Copyright 2020 The FedLearner Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # coding: utf-8 from fedlearner_webconsole.db import db from fedlearner_webconsole.rpc.client import RpcClient from fedlearner_webconsole.workflow.models import ( Workflow, WorkflowState, TransactionState, VALID_TRANSITIONS ) from fedlearner_webconsole.proto import common_pb2
39.742331
78
0.636153
e3fd5d581d1b57f36ef591f8271741509e6dd229
4,636
py
Python
src/openeo_grass_gis_driver/models/schema_base.py
marcjansen/openeo-grassgis-driver
57b309819fdc456fba02cd1ab8fe6731ddfbb66a
[ "Apache-2.0" ]
7
2018-03-16T17:26:14.000Z
2022-03-09T08:19:10.000Z
src/openeo_grass_gis_driver/models/schema_base.py
marcjansen/openeo-grassgis-driver
57b309819fdc456fba02cd1ab8fe6731ddfbb66a
[ "Apache-2.0" ]
70
2018-03-09T11:28:12.000Z
2022-02-17T09:06:17.000Z
src/openeo_grass_gis_driver/models/schema_base.py
marcjansen/openeo-grassgis-driver
57b309819fdc456fba02cd1ab8fe6731ddfbb66a
[ "Apache-2.0" ]
13
2018-03-12T09:58:24.000Z
2022-02-23T10:40:11.000Z
# -*- coding: utf-8 -*- import json from typing import List, Optional from flask import make_response __author__ = "Sren Gebbert" __copyright__ = "Copyright 2018, Sren Gebbert, mundialis" __maintainer__ = "Sren Gebbert" __email__ = "soerengebbert@googlemail.com"
24.659574
85
0.613891
e3fdd8b8cbc3926690972bd648e3656a84878e8f
1,457
py
Python
plugins/maya/inventory/action_update_namespace.py
davidlatwe/reveries-config
4a282dd64a32a9b87bd1a070759b6425ff785d68
[ "MIT" ]
3
2020-04-01T10:51:17.000Z
2021-08-05T18:35:23.000Z
plugins/maya/inventory/action_update_namespace.py
davidlatwe/reveries-config
4a282dd64a32a9b87bd1a070759b6425ff785d68
[ "MIT" ]
null
null
null
plugins/maya/inventory/action_update_namespace.py
davidlatwe/reveries-config
4a282dd64a32a9b87bd1a070759b6425ff785d68
[ "MIT" ]
1
2020-07-05T12:06:30.000Z
2020-07-05T12:06:30.000Z
import avalon.api
29.734694
75
0.671929
e3fff047d0d4657b650e98281fbe2b1e51ff6026
3,694
py
Python
src/outpost/django/salt/serializers.py
medunigraz/outpost.django.salt
bb8d3cefeaa8444ce15979689abdd93ed993304b
[ "BSD-2-Clause" ]
null
null
null
src/outpost/django/salt/serializers.py
medunigraz/outpost.django.salt
bb8d3cefeaa8444ce15979689abdd93ed993304b
[ "BSD-2-Clause" ]
null
null
null
src/outpost/django/salt/serializers.py
medunigraz/outpost.django.salt
bb8d3cefeaa8444ce15979689abdd93ed993304b
[ "BSD-2-Clause" ]
null
null
null
import logging import gpg from rest_framework import serializers from .conf import settings from . import models logger = logging.getLogger(__name__)
32.403509
88
0.674066
e3fff64e6905d157f27dedffc36bcf8b6222a9c6
11,950
py
Python
demosauruswebapp/demosaurus/link_thesaurus.py
KBNLresearch/Demosaurus
9235e315d9eef9d8d64f94a90ab4fc8220670ef2
[ "Apache-2.0" ]
1
2020-06-25T16:39:35.000Z
2020-06-25T16:39:35.000Z
demosauruswebapp/demosaurus/link_thesaurus.py
KBNLresearch/Demosaurus
9235e315d9eef9d8d64f94a90ab4fc8220670ef2
[ "Apache-2.0" ]
6
2020-03-06T12:31:38.000Z
2021-09-20T15:08:17.000Z
demosauruswebapp/demosaurus/link_thesaurus.py
KBNLresearch/Demosaurus
9235e315d9eef9d8d64f94a90ab4fc8220670ef2
[ "Apache-2.0" ]
null
null
null
from flask import ( Blueprint, flash, g, redirect, render_template, get_template_attribute, request, url_for, jsonify ) #from ....dataprocessing import # dataprocessin .read_rdf import from demosauruswebapp.demosaurus.db import get_db import pandas as pd from nltk.metrics import distance as nl_distance import re import numpy as np from scipy.spatial import distance as spatial_distance from scipy import stats import json import time import unidecode import string bp = Blueprint('link_thesaurus', __name__) punctuation_remover = str.maketrans(string.punctuation, ' '*len(string.punctuation)) #map punctuation to space def score_class_based(author_ppn, publication_classes, name): """ Determine score (0-1) and confidence (0-1) for an author given the publication and their known publications Based on information in fields corresponding to items in publication_classes (e.g. genres, subjects, ...) author_ppn: the pica identifier of the candidate author (string) publication_classes: the information of the publication to be compared to a dictionary of lists: keys are class names that correspond to database information (e.g. "CBK_genre") values are a list of identifiers that correspond to publication (e.g. ["330", "135", "322", "334"]) name: a string that indicates how to interpret the score (e.g. "genre") """ if sum([len(v) for k,v in publication_classes.items()]) == 0: # Nothing to base score on. Return zero or something else? score = 0 confidence = 0 else: # Obtain a list of known publication counts from the database known_info = obtain_similarity_data(author_ppn, publication_classes.keys()) if len(known_info) == 0: # no information available to make a sane comparison score = 0 confidence = 0 else: # Add a column with the new publication to compare with for c,l in publication_classes.items(): for v in l: if type(v)== dict: try: known_info.loc[known_info[c]==v['identifier'],'newPublication']=1 except: print('Cannot add publication info to dataframe for comparison') else: try: known_info.loc[known_info[c]==v,'newPublication']=1 except: print('Cannot add publication info to dataframe for comparison') # score = 1- cosine distance between array of known publications and new publication # intuition: # if there are no overlapping genres, distance = 1 so score is 0 # if there is little overlap, the score is close to 0 # if the new publication is very similar to known publications, the score is close to 1 known_info = known_info.fillna(0) try: score = 1 - spatial_distance.cosine(known_info.knownPublications, known_info.newPublication) assert not np.isnan(score) known = known_info.knownPublications.sum() confidence= known/(known+20) # need approx. 20 datapoints to make a somewhat reliable estimate (50% sure) # Temporary fix to get some estimate on reliability except: #print('class based score is undefined for', author_ppn, publication_classes) score = 0 confidence = 0 return pd.Series([score, confidence], index = [name+'_score', name+'_confidence'])
49.585062
139
0.647699
5401d3f8943311c53015fddf7d9a9c7b00d0c8d8
6,784
py
Python
solver.py
IvoryCandy/char-rnn
a21f3b198770c6c9bef0171bf31b2a1710066da8
[ "Apache-2.0" ]
null
null
null
solver.py
IvoryCandy/char-rnn
a21f3b198770c6c9bef0171bf31b2a1710066da8
[ "Apache-2.0" ]
null
null
null
solver.py
IvoryCandy/char-rnn
a21f3b198770c6c9bef0171bf31b2a1710066da8
[ "Apache-2.0" ]
null
null
null
import math import numpy as np import torch from torch import nn from torch.backends import cudnn from torch.utils.data import DataLoader from tqdm import tqdm from model import CharRNN from data import TextDataset, TextConverter
31.849765
119
0.599204
540226b4bbeda54cd1c6e6f8ca8daa02d21b75b8
17,360
py
Python
mayday_control/scripts/motion_control.py
LasseBoerresen/Mayday
3e40d9f3eb2727f78cfa915e19fb5706b6a53514
[ "MIT" ]
2
2020-08-20T15:44:44.000Z
2021-09-27T07:21:59.000Z
mayday_control/scripts/motion_control.py
LasseBoerresen/Mayday
3e40d9f3eb2727f78cfa915e19fb5706b6a53514
[ "MIT" ]
9
2018-03-02T15:21:22.000Z
2020-11-07T12:23:09.000Z
mayday_control/scripts/motion_control.py
LasseBoerresen/Mayday
3e40d9f3eb2727f78cfa915e19fb5706b6a53514
[ "MIT" ]
null
null
null
#!/usr/bin/env python import time import random import math import unittest import numpy as np import pandas as pd import std_msgs from std_msgs.msg import String # from control_msgs.msg import JointControllerState # from gazebo_msgs.msg import LinkStates # import matplotlib.pyplot as plt import dynamixel_adapter ######## OBS must load pycharm in terminal after sourceing ros setup and catkin setup ####### # Load the urdf_parser_py manifest, you use your own package # name on the condition but in this case, you need to depend on # urdf_parser_py. # import roslib; # import roslib.load_manifest('urdfdom_py') # import rospy import sys from urdf_parser_py.urdf import URDF # tensorflow not installed for 2.7 # import tensorflow as tf # from tensorflow.contrib import learn from collections import OrderedDict import pprint import logging # OBS using rospy for logging instead #logging.basicConfig(format='%{asctime}s %{levelname}-8s %{message}s', level='DEBUG') #logger = logging.getLogger(__name__) # OBS Use rospy.logdebug or rospy.loginfo etc instead # FORMAT = '%(asctime)s %(levelname)-8s: %(message)s' # logging.basicConfig(format=FORMAT, level=logging.DEBUG) # logger = logging.getLogger(__name__) # logger.debug('testmsg') pp = pprint.PrettyPrinter() # Should mayday be modelled as an object? Probably. It could be Initiated by the xacro file. TAU = math.pi * 2.0 # class GameRunner: # def __init__(self, sess, model, env, memory, max_eps, min_eps, # decay, render=True): # self._sess = sess # self._env = env # self._model = model # self._memory = memory # self._render = render # self._max_eps = max_eps # self._min_eps = min_eps # self._decay = decay # self._eps = self._max_eps # self._steps = 0 # self._reward_store = [] # self._max_x_store = [] # # def run(self): # state = self._env.reset() # tot_reward = 0 # max_x = -100 # while True: # if self._render: # self._env.render() # # action = self._choose_action(state) # next_state, reward, done, info = self._env.step(action) # if next_state[0] >= 0.1: # reward += 10 # elif next_state[0] >= 0.25: # reward += 20 # elif next_state[0] >= 0.5: # reward += 100 # # if next_state[0] > max_x: # max_x = next_state[0] # # is the game complete? If so, set the next state to # # None for storage sake # if done: # next_state = None # # self._memory.add_sample((state, action, reward, next_state)) # self._replay() # # # exponentially decay the eps value # self._steps += 1 # self._eps = MIN_EPSILON + (MAX_EPSILON - MIN_EPSILON) * math.exp(-LAMBDA * self._steps) # # # move the agent to the next state and accumulate the reward # state = next_state # tot_reward += reward # # # if the game is done, break the loop # if done: # self._reward_store.append(tot_reward) # self._max_x_store.append(max_x) # break # # print("Step {}, Total reward: {}, Eps: {}".format(self._steps, tot_reward, self._eps)) # # def _choose_action(self, state): # """ # # :param state: # :return: # """ # # if random.random() < self._eps: # return random.randint(0, self._model.num_actions - 1) # else: # return np.argmax(self._model.predict_one(state, self._sess)) # # def _replay(self): # """ # # :return: # """ # # batch = self._memory.sample(self._model.batch_size) # states = np.array([val[0] for val in batch]) # next_states = np.array([(np.zeros(self._model.num_states) # if val[3] is None else val[3]) for val in batch]) # # predict Q(s,a) given the batch of states # q_s_a = self._model.predict_batch(states, self._sess) # # predict Q(s',a') - so that we can do gamma * max(Q(s'a')) below # q_s_a_d = self._model.predict_batch(next_states, self._sess) # # setup training arrays # x = np.zeros((len(batch), self._model.num_states)) # y = np.zeros((len(batch), self._model.num_actions)) # for i, b in enumerate(batch): # state, action, reward, next_state = b[0], b[1], b[2], b[3] # # get the current q values for all actions in state # current_q = q_s_a[i] # # update the q value for action # if next_state is None: # # in this case, the game completed after action, so there is no max Q(s',a') # # prediction possible # current_q[action] = reward # else: # current_q[action] = reward + GAMMA * np.amax(q_s_a_d[i]) # x[i] = state # y[i] = current_q # self._model.train_batch(self._sess, x, y) # # # if __name__ == "__main__": # env_name = 'MountainCar-v0' # env = gym.make(env_name) # # num_states = env.env.observation_space.shape[0] # num_actions = env.env.action_space.n # # model = Model(num_states, num_actions, BATCH_SIZE) # mem = Memory(50000) # # with tf.Session() as sess: # sess.run(model.var_init) # gr = GameRunner(sess, model, env, mem, MAX_EPSILON, MIN_EPSILON, # LAMBDA) # num_episodes = 300 # cnt = 0 # while cnt < num_episodes: # if cnt % 10 == 0: # print('Episode {} of {}'.format(cnt+1, num_episodes)) # gr.run() # cnt += 1 # plt.plot(gr.reward_store) # plt.show() # plt.close("all") # plt.plot(gr.max_x_store) # plt.show() def main(): """ This script should initiate all the legs in a safe position, then move them to the initial standing resting position and await commands. Commands should come from remote control. Robot state should mirror gazebo, no matter whether it comes from the real robot. States are taken from a subscription, and commands are published. :return: """ try: # Run robot, including initialization of legs and idle for commands. robot = Robot() except rospy.ROSInterruptException: pass if __name__ == '__main__': main()
33.643411
120
0.589286
5402f5bc7398b19a2c1f22b4890e4f4b84f51e3e
10,278
py
Python
venv/lib/python3.9/site-packages/trio/socket.py
almmello/frozen
c9928491f694b56a0023926bc763c703ba1fd75a
[ "BSD-2-Clause" ]
3
2022-02-26T17:16:34.000Z
2022-03-04T15:04:00.000Z
venv/lib/python3.9/site-packages/trio/socket.py
almmello/frozen
c9928491f694b56a0023926bc763c703ba1fd75a
[ "BSD-2-Clause" ]
20
2021-05-03T18:02:23.000Z
2022-03-12T12:01:04.000Z
venv/lib/python3.9/site-packages/trio/socket.py
almmello/frozen
c9928491f694b56a0023926bc763c703ba1fd75a
[ "BSD-2-Clause" ]
1
2022-03-28T09:19:34.000Z
2022-03-28T09:19:34.000Z
# This is a public namespace, so we don't want to expose any non-underscored # attributes that aren't actually part of our public API. But it's very # annoying to carefully always use underscored names for module-level # temporaries, imports, etc. when implementing the module. So we put the # implementation in an underscored module, and then re-export the public parts # here. # We still have some underscore names though but only a few. from . import _socket import sys import typing as _t # The socket module exports a bunch of platform-specific constants. We want to # re-export them. Since the exact set of constants varies depending on Python # version, platform, the libc installed on the system where Python was built, # etc., we figure out which constants to re-export dynamically at runtime (see # below). But that confuses static analysis tools like jedi and mypy. So this # import statement statically lists every constant that *could* be # exported. It always fails at runtime, since no single Python build exports # all these constants, but it lets static analysis tools understand what's # going on. There's a test in test_exports.py to make sure that the list is # kept up to date. try: # fmt: off from socket import ( # type: ignore CMSG_LEN, CMSG_SPACE, CAPI, AF_UNSPEC, AF_INET, AF_UNIX, AF_IPX, AF_APPLETALK, AF_INET6, AF_ROUTE, AF_LINK, AF_SNA, PF_SYSTEM, AF_SYSTEM, SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_SEQPACKET, SOCK_RDM, SO_DEBUG, SO_ACCEPTCONN, SO_REUSEADDR, SO_KEEPALIVE, SO_DONTROUTE, SO_BROADCAST, SO_USELOOPBACK, SO_LINGER, SO_OOBINLINE, SO_REUSEPORT, SO_SNDBUF, SO_RCVBUF, SO_SNDLOWAT, SO_RCVLOWAT, SO_SNDTIMEO, SO_RCVTIMEO, SO_ERROR, SO_TYPE, LOCAL_PEERCRED, SOMAXCONN, SCM_RIGHTS, SCM_CREDS, MSG_OOB, MSG_PEEK, MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, MSG_TRUNC, MSG_CTRUNC, MSG_WAITALL, MSG_EOF, SOL_SOCKET, SOL_IP, SOL_TCP, SOL_UDP, IPPROTO_IP, IPPROTO_HOPOPTS, IPPROTO_ICMP, IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_IPV4, IPPROTO_IPIP, IPPROTO_TCP, IPPROTO_EGP, IPPROTO_PUP, IPPROTO_UDP, IPPROTO_IDP, IPPROTO_HELLO, IPPROTO_ND, IPPROTO_TP, IPPROTO_ROUTING, IPPROTO_FRAGMENT, IPPROTO_RSVP, IPPROTO_GRE, IPPROTO_ESP, IPPROTO_AH, IPPROTO_ICMPV6, IPPROTO_NONE, IPPROTO_DSTOPTS, IPPROTO_XTP, IPPROTO_EON, IPPROTO_PIM, IPPROTO_IPCOMP, IPPROTO_SCTP, IPPROTO_RAW, IPPROTO_MAX, SYSPROTO_CONTROL, IPPORT_RESERVED, IPPORT_USERRESERVED, INADDR_ANY, INADDR_BROADCAST, INADDR_LOOPBACK, INADDR_UNSPEC_GROUP, INADDR_ALLHOSTS_GROUP, INADDR_MAX_LOCAL_GROUP, INADDR_NONE, IP_OPTIONS, IP_HDRINCL, IP_TOS, IP_TTL, IP_RECVOPTS, IP_RECVRETOPTS, IP_RECVDSTADDR, IP_RETOPTS, IP_MULTICAST_IF, IP_MULTICAST_TTL, IP_MULTICAST_LOOP, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_DEFAULT_MULTICAST_TTL, IP_DEFAULT_MULTICAST_LOOP, IP_MAX_MEMBERSHIPS, IPV6_JOIN_GROUP, IPV6_LEAVE_GROUP, IPV6_MULTICAST_HOPS, IPV6_MULTICAST_IF, IPV6_MULTICAST_LOOP, IPV6_UNICAST_HOPS, IPV6_V6ONLY, IPV6_CHECKSUM, IPV6_RECVTCLASS, IPV6_RTHDR_TYPE_0, IPV6_TCLASS, TCP_NODELAY, TCP_MAXSEG, TCP_KEEPINTVL, TCP_KEEPCNT, TCP_FASTOPEN, TCP_NOTSENT_LOWAT, EAI_ADDRFAMILY, EAI_AGAIN, EAI_BADFLAGS, EAI_FAIL, EAI_FAMILY, EAI_MEMORY, EAI_NODATA, EAI_NONAME, EAI_OVERFLOW, EAI_SERVICE, EAI_SOCKTYPE, EAI_SYSTEM, EAI_BADHINTS, EAI_PROTOCOL, EAI_MAX, AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST, AI_NUMERICSERV, AI_MASK, AI_ALL, AI_V4MAPPED_CFG, AI_ADDRCONFIG, AI_V4MAPPED, AI_DEFAULT, NI_MAXHOST, NI_MAXSERV, NI_NOFQDN, NI_NUMERICHOST, NI_NAMEREQD, NI_NUMERICSERV, NI_DGRAM, SHUT_RD, SHUT_WR, SHUT_RDWR, EBADF, EAGAIN, EWOULDBLOCK, AF_ASH, AF_ATMPVC, AF_ATMSVC, AF_AX25, AF_BLUETOOTH, AF_BRIDGE, AF_ECONET, AF_IRDA, AF_KEY, AF_LLC, AF_NETBEUI, AF_NETLINK, AF_NETROM, AF_PACKET, AF_PPPOX, AF_ROSE, AF_SECURITY, AF_WANPIPE, AF_X25, BDADDR_ANY, BDADDR_LOCAL, FD_SETSIZE, IPV6_DSTOPTS, IPV6_HOPLIMIT, IPV6_HOPOPTS, IPV6_NEXTHOP, IPV6_PKTINFO, IPV6_RECVDSTOPTS, IPV6_RECVHOPLIMIT, IPV6_RECVHOPOPTS, IPV6_RECVPKTINFO, IPV6_RECVRTHDR, IPV6_RTHDR, IPV6_RTHDRDSTOPTS, MSG_ERRQUEUE, NETLINK_DNRTMSG, NETLINK_FIREWALL, NETLINK_IP6_FW, NETLINK_NFLOG, NETLINK_ROUTE, NETLINK_USERSOCK, NETLINK_XFRM, PACKET_BROADCAST, PACKET_FASTROUTE, PACKET_HOST, PACKET_LOOPBACK, PACKET_MULTICAST, PACKET_OTHERHOST, PACKET_OUTGOING, POLLERR, POLLHUP, POLLIN, POLLMSG, POLLNVAL, POLLOUT, POLLPRI, POLLRDBAND, POLLRDNORM, POLLWRNORM, SIOCGIFINDEX, SIOCGIFNAME, SOCK_CLOEXEC, TCP_CORK, TCP_DEFER_ACCEPT, TCP_INFO, TCP_KEEPIDLE, TCP_LINGER2, TCP_QUICKACK, TCP_SYNCNT, TCP_WINDOW_CLAMP, AF_ALG, AF_CAN, AF_RDS, AF_TIPC, AF_VSOCK, ALG_OP_DECRYPT, ALG_OP_ENCRYPT, ALG_OP_SIGN, ALG_OP_VERIFY, ALG_SET_AEAD_ASSOCLEN, ALG_SET_AEAD_AUTHSIZE, ALG_SET_IV, ALG_SET_KEY, ALG_SET_OP, ALG_SET_PUBKEY, CAN_BCM, CAN_BCM_RX_CHANGED, CAN_BCM_RX_DELETE, CAN_BCM_RX_READ, CAN_BCM_RX_SETUP, CAN_BCM_RX_STATUS, CAN_BCM_RX_TIMEOUT, CAN_BCM_TX_DELETE, CAN_BCM_TX_EXPIRED, CAN_BCM_TX_READ, CAN_BCM_TX_SEND, CAN_BCM_TX_SETUP, CAN_BCM_TX_STATUS, CAN_EFF_FLAG, CAN_EFF_MASK, CAN_ERR_FLAG, CAN_ERR_MASK, CAN_ISOTP, CAN_RAW, CAN_RAW_ERR_FILTER, CAN_RAW_FD_FRAMES, CAN_RAW_FILTER, CAN_RAW_LOOPBACK, CAN_RAW_RECV_OWN_MSGS, CAN_RTR_FLAG, CAN_SFF_MASK, IOCTL_VM_SOCKETS_GET_LOCAL_CID, IPV6_DONTFRAG, IPV6_PATHMTU, IPV6_RECVPATHMTU, IP_TRANSPARENT, MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_FASTOPEN, MSG_MORE, MSG_NOSIGNAL, NETLINK_CRYPTO, PF_CAN, PF_PACKET, PF_RDS, SCM_CREDENTIALS, SOCK_NONBLOCK, SOL_ALG, SOL_CAN_BASE, SOL_CAN_RAW, SOL_TIPC, SO_BINDTODEVICE, SO_DOMAIN, SO_MARK, SO_PASSCRED, SO_PASSSEC, SO_PEERCRED, SO_PEERSEC, SO_PRIORITY, SO_PROTOCOL, SO_VM_SOCKETS_BUFFER_MAX_SIZE, SO_VM_SOCKETS_BUFFER_MIN_SIZE, SO_VM_SOCKETS_BUFFER_SIZE, TCP_CONGESTION, TCP_USER_TIMEOUT, TIPC_ADDR_ID, TIPC_ADDR_NAME, TIPC_ADDR_NAMESEQ, TIPC_CFG_SRV, TIPC_CLUSTER_SCOPE, TIPC_CONN_TIMEOUT, TIPC_CRITICAL_IMPORTANCE, TIPC_DEST_DROPPABLE, TIPC_HIGH_IMPORTANCE, TIPC_IMPORTANCE, TIPC_LOW_IMPORTANCE, TIPC_MEDIUM_IMPORTANCE, TIPC_NODE_SCOPE, TIPC_PUBLISHED, TIPC_SRC_DROPPABLE, TIPC_SUBSCR_TIMEOUT, TIPC_SUB_CANCEL, TIPC_SUB_PORTS, TIPC_SUB_SERVICE, TIPC_TOP_SRV, TIPC_WAIT_FOREVER, TIPC_WITHDRAWN, TIPC_ZONE_SCOPE, VMADDR_CID_ANY, VMADDR_CID_HOST, VMADDR_PORT_ANY, VM_SOCKETS_INVALID_VERSION, MSG_BCAST, MSG_MCAST, RCVALL_MAX, RCVALL_OFF, RCVALL_ON, RCVALL_SOCKETLEVELONLY, SIO_KEEPALIVE_VALS, SIO_LOOPBACK_FAST_PATH, SIO_RCVALL, SO_EXCLUSIVEADDRUSE, HCI_FILTER, BTPROTO_SCO, BTPROTO_HCI, HCI_TIME_STAMP, SOL_RDS, BTPROTO_L2CAP, BTPROTO_RFCOMM, HCI_DATA_DIR, SOL_HCI, CAN_BCM_RX_ANNOUNCE_RESUME, CAN_BCM_RX_CHECK_DLC, CAN_BCM_RX_FILTER_ID, CAN_BCM_RX_NO_AUTOTIMER, CAN_BCM_RX_RTR_FRAME, CAN_BCM_SETTIMER, CAN_BCM_STARTTIMER, CAN_BCM_TX_ANNOUNCE, CAN_BCM_TX_COUNTEVT, CAN_BCM_TX_CP_CAN_ID, CAN_BCM_TX_RESET_MULTI_IDX, IPPROTO_CBT, IPPROTO_ICLFXBM, IPPROTO_IGP, IPPROTO_L2TP, IPPROTO_PGM, IPPROTO_RDP, IPPROTO_ST, AF_QIPCRTR, CAN_BCM_CAN_FD_FRAME, IPPROTO_MOBILE, IPV6_USE_MIN_MTU, MSG_NOTIFICATION, SO_SETFIB, CAN_J1939, CAN_RAW_JOIN_FILTERS, IPPROTO_UDPLITE, J1939_EE_INFO_NONE, J1939_EE_INFO_TX_ABORT, J1939_FILTER_MAX, J1939_IDLE_ADDR, J1939_MAX_UNICAST_ADDR, J1939_NLA_BYTES_ACKED, J1939_NLA_PAD, J1939_NO_ADDR, J1939_NO_NAME, J1939_NO_PGN, J1939_PGN_ADDRESS_CLAIMED, J1939_PGN_ADDRESS_COMMANDED, J1939_PGN_MAX, J1939_PGN_PDU1_MAX, J1939_PGN_REQUEST, SCM_J1939_DEST_ADDR, SCM_J1939_DEST_NAME, SCM_J1939_ERRQUEUE, SCM_J1939_PRIO, SO_J1939_ERRQUEUE, SO_J1939_FILTER, SO_J1939_PROMISC, SO_J1939_SEND_PRIO, UDPLITE_RECV_CSCOV, UDPLITE_SEND_CSCOV ) # fmt: on except ImportError: pass # Dynamically re-export whatever constants this particular Python happens to # have: import socket as _stdlib_socket _bad_symbols: _t.Set[str] = set() if sys.platform == "win32": # See https://github.com/python-trio/trio/issues/39 # Do not import for windows platform # (you can still get it from stdlib socket, of course, if you want it) _bad_symbols.add("SO_REUSEADDR") globals().update( { _name: getattr(_stdlib_socket, _name) for _name in _stdlib_socket.__all__ # type: ignore if _name.isupper() and _name not in _bad_symbols } ) # import the overwrites from ._socket import ( fromfd, from_stdlib_socket, getprotobyname, socketpair, getnameinfo, socket, getaddrinfo, set_custom_hostname_resolver, set_custom_socket_factory, SocketType, ) # not always available so expose only if if sys.platform == "win32" or not _t.TYPE_CHECKING: try: from ._socket import fromshare except ImportError: pass # expose these functions to trio.socket from socket import ( gaierror, herror, gethostname, ntohs, htonl, htons, inet_aton, inet_ntoa, inet_pton, inet_ntop, ) # not always available so expose only if if sys.platform != "win32" or not _t.TYPE_CHECKING: try: from socket import sethostname, if_nameindex, if_nametoindex, if_indextoname except ImportError: pass # get names used by Trio that we define on our own from ._socket import IPPROTO_IPV6 # Not defined in all python versions and platforms but sometimes needed if not _t.TYPE_CHECKING: try: TCP_NOTSENT_LOWAT except NameError: # Hopefully will show up in 3.7: # https://github.com/python/cpython/pull/477 if sys.platform == "darwin": TCP_NOTSENT_LOWAT = 0x201 elif sys.platform == "linux": TCP_NOTSENT_LOWAT = 25 if _t.TYPE_CHECKING: IP_BIND_ADDRESS_NO_PORT: int else: try: IP_BIND_ADDRESS_NO_PORT except NameError: if sys.platform == "linux": IP_BIND_ADDRESS_NO_PORT = 24 del sys
48.481132
84
0.748784
54036005b75aaa482dfeae48fd25d054393283e1
2,258
py
Python
tests/test_encoders.py
alxlampe/d3rlpy
af7e6bd018a51f95138d121f59c50dc36ec87e3a
[ "MIT" ]
null
null
null
tests/test_encoders.py
alxlampe/d3rlpy
af7e6bd018a51f95138d121f59c50dc36ec87e3a
[ "MIT" ]
null
null
null
tests/test_encoders.py
alxlampe/d3rlpy
af7e6bd018a51f95138d121f59c50dc36ec87e3a
[ "MIT" ]
null
null
null
import pytest from d3rlpy.models.torch.encoders import PixelEncoder from d3rlpy.models.torch.encoders import PixelEncoderWithAction from d3rlpy.models.torch.encoders import VectorEncoder from d3rlpy.models.torch.encoders import VectorEncoderWithAction from d3rlpy.encoders import create_encoder_factory from d3rlpy.encoders import PixelEncoderFactory from d3rlpy.encoders import VectorEncoderFactory
35.84127
77
0.740478
5406dab8bc4f61a6b8581ae628a67e2632c2d5cd
2,217
py
Python
cam/03_face_recognition.py
kimtaehoho/osscap2020
7980ab742a1a90fb4405eeabe941504a0b859d20
[ "Apache-2.0" ]
null
null
null
cam/03_face_recognition.py
kimtaehoho/osscap2020
7980ab742a1a90fb4405eeabe941504a0b859d20
[ "Apache-2.0" ]
10
2020-10-12T04:45:01.000Z
2020-11-29T12:40:55.000Z
cam/03_face_recognition.py
kimtaehoho/osscap2020
7980ab742a1a90fb4405eeabe941504a0b859d20
[ "Apache-2.0" ]
1
2020-10-12T12:28:42.000Z
2020-10-12T12:28:42.000Z
# -*- coding: utf-8 -*- #import game from glob import glob file1 = glob("01_face_dataset.py") file2 = glob("02_face_training.py") import facedataset import facetrain import cv2 import numpy as np import os from PIL import Image #facedataset.first() #facetrain.second() recognizer = cv2.face.LBPHFaceRecognizer_create() recognizer.read('trainer/trainer.yml') cascadePath = "haarcascades/haarcascade_frontalface_default.xml" faceCascade = cv2.CascadeClassifier(cascadePath); font = cv2.FONT_HERSHEY_SIMPLEX #iniciate id counter id = 0 # names related to ids: example ==> loze: id=1, etc # . names = ['None', 'kkh', 'kth', 'ldh'] # Initialize and start realtime video capture cam = cv2.VideoCapture(0) cam.set(3, 640) # set video widht cam.set(4, 480) # set video height # Define min window size to be recognized as a face minW = 0.1*cam.get(3) minH = 0.1*cam.get(4) while True: ret, img =cam.read() #img = cv2.flip(img, -1) # Flip vertically gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces = faceCascade.detectMultiScale( gray, scaleFactor = 1.2, minNeighbors = 5, minSize = (int(minW), int(minH)), ) for(x,y,w,h) in faces: cv2.rectangle(img, (x,y), (x+w,y+h), (0,255,0), 2) id, confidence = recognizer.predict(gray[y:y+h,x:x+w]) # Check if confidence is less them 100 ==> "0" is perfect match if (confidence < 100): id = names[id] confidence = " {0}%".format(round(100 - confidence)) #game.start() else: facedataset.first() facetrain.second() #exec(open(file1.read()) #exec(open(file2.read()) #game.start() confidence = " {0}%".format(round(100 - confidence)) cv2.putText(img, str(id), (x+5,y-5), font, 1, (255,255,255), 2) cv2.putText(img, str(confidence), (x+5,y+h-5), font, 1, (255,255,0), 1) cv2.imshow('camera',img) k = cv2.waitKey(10) & 0xff # Press 'ESC' for exiting video if k == 27: break # Do a bit of cleanup print("\n [INFO] Exiting Program and cleanup stuff") cam.release() cv2.destroyAllWindows()
28.063291
81
0.620207
540828fed7b9b1cf90bafa38feea72b4a282cfd0
1,047
py
Python
deprecated/dpr/code/encoder.py
eunaoeh/mrc-level2-nlp-01
caa893ca7d689200b3528377901d59fa9ca452ac
[ "MIT" ]
1
2021-11-25T04:30:51.000Z
2021-11-25T04:30:51.000Z
deprecated/dpr/code/encoder.py
eunaoeh/mrc-level2-nlp-01
caa893ca7d689200b3528377901d59fa9ca452ac
[ "MIT" ]
null
null
null
deprecated/dpr/code/encoder.py
eunaoeh/mrc-level2-nlp-01
caa893ca7d689200b3528377901d59fa9ca452ac
[ "MIT" ]
5
2021-11-21T22:53:40.000Z
2022-02-23T09:22:25.000Z
from transformers import ( RobertaModel, RobertaPreTrainedModel, BertModel, BertPreTrainedModel, )
25.536585
83
0.685769
5408382e17eaa39a39eec48a1a272c02bf244807
3,395
py
Python
tutorial/calculator/calculator.002.py
UltraStudioLTD/pyTermTk
a1e96b0e7f43906b9fda0b16f19f427919a055c2
[ "MIT" ]
1
2022-02-28T16:33:25.000Z
2022-02-28T16:33:25.000Z
tutorial/calculator/calculator.002.py
UltraStudioLTD/pyTermTk
a1e96b0e7f43906b9fda0b16f19f427919a055c2
[ "MIT" ]
null
null
null
tutorial/calculator/calculator.002.py
UltraStudioLTD/pyTermTk
a1e96b0e7f43906b9fda0b16f19f427919a055c2
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2022 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import TermTk as ttk # Create a root object (it is a widget that represent the terminal) root = ttk.TTk() # Create a window and attach it to the root (parent=root) calculatorWin = ttk.TTkWindow( parent=root, pos=(1, 1), size=(30, 17), title="My first Calculator" ) # Create a grid layout and set it as default for the window winLayout = ttk.TTkGridLayout() calculatorWin.setLayout(winLayout) # Define the Label and attach it to the grid layout at # Position (Row/Col) (0,0) and (Row/Col)Span (1,4) # I force the Max Height to 1 in order to avoid this widget to resize vertically resLabel = ttk.TTkLabel(text="Results", maxHeight=1) winLayout.addWidget(resLabel, 0, 0, 1, 4) # Define the Numeric Buttons and attach them to the grid layout btn1 = ttk.TTkButton(border=True, text="1") btn2 = ttk.TTkButton(border=True, text="2") btn3 = ttk.TTkButton(border=True, text="3") btn4 = ttk.TTkButton(border=True, text="4") btn5 = ttk.TTkButton(border=True, text="5") btn6 = ttk.TTkButton(border=True, text="6") btn7 = ttk.TTkButton(border=True, text="7") btn8 = ttk.TTkButton(border=True, text="8") btn9 = ttk.TTkButton(border=True, text="9") winLayout.addWidget(btn1, 1, 0) # Colspan/Rowspan are defaulted to 1 if not specified winLayout.addWidget(btn2, 1, 1) winLayout.addWidget(btn3, 1, 2) winLayout.addWidget(btn4, 2, 0) winLayout.addWidget(btn5, 2, 1) winLayout.addWidget(btn6, 2, 2) winLayout.addWidget(btn7, 3, 0) winLayout.addWidget(btn8, 3, 1) winLayout.addWidget(btn9, 3, 2) # Adding the "0" button on the bottom which alignment is # Position (Row/Col) (4,0) (Row/Col)span (1,2) # Just to show off I am using another way to attach it to the grid layout winLayout.addWidget(btn0 := ttk.TTkButton(border=True, text="0"), 4, 0, 1, 2) # Define the 2 algebric buttons winLayout.addWidget(btnAdd := ttk.TTkButton(border=True, text="+"), 1, 3) winLayout.addWidget(btnSub := ttk.TTkButton(border=True, text="-"), 2, 3) # The Enter "=" button (2 rows wide) winLayout.addWidget(btnRes := ttk.TTkButton(border=True, text="="), 3, 3, 2, 1) # Last but not least an extrabutton just for fun winLayout.addWidget(mysteryButton := ttk.TTkButton(border=True, text="?"), 4, 2) # Start the Main loop root.mainloop()
40.903614
86
0.742268
5408f0d69dd4b712a3e36a300e74e57a1812c78d
4,433
py
Python
dags/clix_static_visuals_dag.py
CLIxIndia-Dev/clix_dashboard_backend_AF
4dc2f48fdd1ea312977f8237cec9b9fd71cc20b4
[ "Apache-2.0" ]
null
null
null
dags/clix_static_visuals_dag.py
CLIxIndia-Dev/clix_dashboard_backend_AF
4dc2f48fdd1ea312977f8237cec9b9fd71cc20b4
[ "Apache-2.0" ]
null
null
null
dags/clix_static_visuals_dag.py
CLIxIndia-Dev/clix_dashboard_backend_AF
4dc2f48fdd1ea312977f8237cec9b9fd71cc20b4
[ "Apache-2.0" ]
1
2020-03-17T06:40:25.000Z
2020-03-17T06:40:25.000Z
# This DAG is for running python scripts to generate static visualisation data # from syncthing every month end import airflow from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator from airflow.operators.dummy_operator import DummyOperator from datetime import date, timedelta, datetime import scripts.sync_school_data as sync_school_data import scripts.process_raw_school_data as process_raw_school_data import config.clix_config as clix_config tools_modules_server_logs_datapath = clix_config.local_dst_state_data_logs # -------------------------------------------------------------------------------- # set default arguments # -------------------------------------------------------------------------------- default_args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': airflow.utils.dates.days_ago(1), #'email': ['airflow@example.com'], 'email_on_failure': False, 'email_on_retry': False, 'retries': 1, 'retry_delay': timedelta(minutes=5), 'provide_context': True, # 'queue': 'bash_queue', # 'pool': 'backfill', # 'priority_weight': 10, # 'end_date': datetime(2016, 1, 1), } dag = DAG( 'clix_static_visuals_dag', default_args=default_args, schedule_interval= '@monthly') # -------------------------------------------------------------------------------- # Each state is synced independently. We have four states and syncthing data folders # corresponding to those states are synced through sync_school_data # -------------------------------------------------------------------------------- #sshHook = SSHHook(conn_id=<YOUR CONNECTION ID FROM THE UI>) #dummy_operator = DummyOperator(task_id='dummy_task', retries=3, dag=dag) list_of_state_vis = [] for each_state in clix_config.static_visuals_states: src = clix_config.remote_src_static_vis + each_state dst = clix_config.local_dst_static_vis + each_state list_of_tasks_chunks = [] #sync_state_data = SSHExecuteOperator( task_id="task1", #bash_command= rsync -avzhe ssh {0}@{1}:{2} {3}".format(user, ip, src, dst), #ssh_hook=sshHook, #dag=dag) sync_state_data = PythonOperator( task_id='sync_state_data_' + each_state, python_callable=sync_school_data.rsync_data_ssh, op_kwargs={'state': each_state, 'src': src, 'dst': dst, 'static_flag': True}, dag=dag, retries=0) # For parallel processing of files in the list of schools updated # we use three parallel tasks each taking the portion of the list # of files. This is done instead of generating tasks dynamically. # number of schools chunks is set to clix_config.num_school_chunks # refer: https://stackoverflow.com/questions/55672724/airflow-creating-dynamic-tasks-from-xcom for each in list(range(clix_config.num_school_chunks)): if each_state == 'ts': each_state_new = 'tg' elif each_state == 'cg': each_state_new = 'ct' else: each_state_new = each_state process_state_raw_data = PythonOperator( task_id='process_raw_state_data_' + str(each) + '_' + each_state_new, python_callable=process_raw_school_data.process_school_data, op_kwargs={'state': each_state_new, 'chunk': each}, dag=dag) list_of_tasks_chunks.append(process_state_raw_data) sync_state_data.set_downstream(process_state_raw_data) combine_state_chunks = PythonOperator( task_id='combine_chunks_' + each_state_new, python_callable=process_raw_school_data.combine_chunks, op_kwargs={'state': each_state_new}, dag=dag) list_of_tasks_chunks >> combine_state_chunks get_state_static_vis_data = PythonOperator( task_id = 'get_static_vis_' + each_state_new, python_callable = process_raw_school_data.get_state_static_vis_data, op_kwargs = {'state': each_state_new, 'all_states_flag': False}, dag=dag) list_of_state_vis.append(get_state_static_vis_data) combine_state_chunks >> get_state_static_vis_data get_static_vis_data_all = PythonOperator( task_id = 'get_static_vis_data_allstates', python_callable = process_raw_school_data.get_state_static_vis_data, op_kwargs = {'state': None, 'all_states_flag': True}, dag=dag) list_of_state_vis >> get_static_vis_data_all
39.230088
98
0.676291
540b37aa828992718d326e40cc3e8c5c7baaf141
67
py
Python
nadl/__init__.py
siAyush/nadl
8aa698231e1d198bf823a58c84f139f6f93bc7df
[ "MIT" ]
7
2021-05-18T11:16:49.000Z
2021-05-30T20:25:12.000Z
nadl/__init__.py
siAyush/nadl
8aa698231e1d198bf823a58c84f139f6f93bc7df
[ "MIT" ]
null
null
null
nadl/__init__.py
siAyush/nadl
8aa698231e1d198bf823a58c84f139f6f93bc7df
[ "MIT" ]
1
2022-03-02T19:52:25.000Z
2022-03-02T19:52:25.000Z
from nadl.tensor import Tensor from nadl.parameter import Parameter
33.5
36
0.865672
540d12bf750ecb2e910c29f067d4164a9bcaf207
30,598
py
Python
file.py
Tawfiq-MoonHacker/metis_video
8d63ac458b8b6bfa48a1ec5476dc47be1987f42a
[ "Apache-2.0" ]
null
null
null
file.py
Tawfiq-MoonHacker/metis_video
8d63ac458b8b6bfa48a1ec5476dc47be1987f42a
[ "Apache-2.0" ]
null
null
null
file.py
Tawfiq-MoonHacker/metis_video
8d63ac458b8b6bfa48a1ec5476dc47be1987f42a
[ "Apache-2.0" ]
null
null
null
file_forgot_password = ["""<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <style type="text/css"> @media screen { @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 400; src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 700; src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); } } /* CLIENT-SPECIFIC STYLES */ body, table, td, a { -webkit-text-size-adjust: 100%%; -ms-text-size-adjust: 100%%; } table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; } img { -ms-interpolation-mode: bicubic; } /* RESET STYLES */ img { border: 0; height: auto; line-height: 100%%; outline: none; text-decoration: none; } table { border-collapse: collapse !important; } body { height: 100%% !important; margin: 0 !important; padding: 0 !important; width: 100%% !important; } /* iOS BLUE LINKS */ a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important; } /* MOBILE STYLES */ @media screen and (max-width:600px) { h1 { font-size: 32px !important; line-height: 32px !important; } } /* ANDROID CENTER FIX */ div[style*="margin: 16px 0;"] { margin: 0 !important; } </style> </head> <body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important;"> <!-- HIDDEN PREHEADER TEXT --> <div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <!-- LOGO --> <tr> <td bgcolor="#FFA73B" align="center"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td align="center" valign="top" style="padding: 40px 10px 40px 10px;"> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#FFA73B" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="center" valign="top" style="padding: 40px 20px 20px 20px; border-radius: 4px 4px 0px 0px; color: #111111; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: 4px; line-height: 48px;"> <h1 style="font-size: 48px; font-weight: 400; margin: 2;">Welcome!</h1> <img src=" https://img.icons8.com/clouds/100/000000/handshake.png" width="125" height="120" style="display: block; border: 0px;" /> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">We're excited to have you get started. First, you need to confirm your account. Just press the button below.</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left"> <table width="100%%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" style="border-radius: 3px;" bgcolor="#FFA73B"><a href="secret_key" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #FFA73B; display: inline-block;">Reset Password</a></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">""","""</a></p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">If you have any questions, just reply to this emailwe're always happy to help out.</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 40px 30px; border-radius: 0px 0px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">Cheers,BBB Team</p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#FFECD1" align="center" style="padding: 30px 30px 30px 30px; border-radius: 4px 4px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <h2 style="font-size: 20px; font-weight: 400; color: #111111; margin: 0;">Need more help?</h2> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">We&rsquo;re here to help you out</a></p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#f4f4f4" align="left" style="padding: 0px 30px 30px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;"> <p style="margin: 0;">If these emails get annoying, please feel free to <a href="#" target="_blank" style="color: #111111; font-weight: 700;">unsubscribe</a>.</p> </td> </tr> </table> </td> </tr> </table> </body> </html> """] file_verification_email = ["""<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <style type="text/css"> @media screen { @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 400; src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 700; src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); } } /* CLIENT-SPECIFIC STYLES */ body, table, td, a { -webkit-text-size-adjust: 100%%; -ms-text-size-adjust: 100%%; } table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; } img { -ms-interpolation-mode: bicubic; } /* RESET STYLES */ img { border: 0; height: auto; line-height: 100%%; outline: none; text-decoration: none; } table { border-collapse: collapse !important; } body { height: 100%% !important; margin: 0 !important; padding: 0 !important; width: 100%% !important; } /* iOS BLUE LINKS */ a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important; } /* MOBILE STYLES */ @media screen and (max-width:600px) { h1 { font-size: 32px !important; line-height: 32px !important; } } /* ANDROID CENTER FIX */ div[style*="margin: 16px 0;"] { margin: 0 !important; } </style> </head> <body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important;"> <!-- HIDDEN PREHEADER TEXT --> <div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <!-- LOGO --> <tr> <td bgcolor="#FFA73B" align="center"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td align="center" valign="top" style="padding: 40px 10px 40px 10px;"> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#FFA73B" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="center" valign="top" style="padding: 40px 20px 20px 20px; border-radius: 4px 4px 0px 0px; color: #111111; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: 4px; line-height: 48px;"> <h1 style="font-size: 48px; font-weight: 400; margin: 2;">Welcome!</h1> <img src=" https://img.icons8.com/clouds/100/000000/handshake.png" width="125" height="120" style="display: block; border: 0px;" /> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">We're excited to have you get started. First, you need to confirm your account. Just press the button below.</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left"> <table width="100%%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" style="border-radius: 3px;" bgcolor="#FFA73B"><a href="secret_key" target="_blank" style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 15px 25px; border-radius: 2px; border: 1px solid #FFA73B; display: inline-block;">Confirm Email</a></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">If that doesn't work, copy and paste the following link in your browser:</p> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">""", """</a></p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">If you have any questions, just reply to this emailwe're always happy to help out.</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 40px 30px; border-radius: 0px 0px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">Cheers,BBB Team</p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#FFECD1" align="center" style="padding: 30px 30px 30px 30px; border-radius: 4px 4px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <h2 style="font-size: 20px; font-weight: 400; color: #111111; margin: 0;">Need more help?</h2> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">We&rsquo;re here to help you out</a></p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#f4f4f4" align="left" style="padding: 0px 30px 30px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;"> <p style="margin: 0;">If these emails get annoying, please feel free to <a href="#" target="_blank" style="color: #111111; font-weight: 700;">unsubscribe</a>.</p> </td> </tr> </table> </td> </tr> </table> </body> </html> """] file_username = ["""<!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <style type="text/css"> @media screen { @font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 400; src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff'); } @font-face { font-family: 'Lato'; font-style: italic; font-weight: 700; src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff'); } } /* CLIENT-SPECIFIC STYLES */ body, table, td, a { -webkit-text-size-adjust: 100%%; -ms-text-size-adjust: 100%%; } table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; } img { -ms-interpolation-mode: bicubic; } /* RESET STYLES */ img { border: 0; height: auto; line-height: 100%%; outline: none; text-decoration: none; } table { border-collapse: collapse !important; } body { height: 100%% !important; margin: 0 !important; padding: 0 !important; width: 100%% !important; } /* iOS BLUE LINKS */ a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important; } /* MOBILE STYLES */ @media screen and (max-width:600px) { h1 { font-size: 32px !important; line-height: 32px !important; } } /* ANDROID CENTER FIX */ div[style*="margin: 16px 0;"] { margin: 0 !important; } </style> </head> <body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important;"> <!-- HIDDEN PREHEADER TEXT --> <div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <!-- LOGO --> <tr> <td bgcolor="#FFA73B" align="center"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td align="center" valign="top" style="padding: 40px 10px 40px 10px;"> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#FFA73B" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="center" valign="top" style="padding: 40px 20px 20px 20px; border-radius: 4px 4px 0px 0px; color: #111111; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: 4px; line-height: 48px;"> <h1 style="font-size: 48px; font-weight: 400; margin: 2;">Welcome!</h1> <img src=" https://img.icons8.com/clouds/100/000000/handshake.png" width="125" height="120" style="display: block; border: 0px;" /> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">We're excited to have you here. here is your username: secret_key</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left"> <table width="100%%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;"> <table border="0" cellspacing="0" cellpadding="0"> </table> </td> </tr> </table> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 0px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;"></p> </td> </tr> <!-- COPY --> <tr> <td bgcolor="#ffffff" align="left" style="padding: 20px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">""", """</a></p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 20px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">If you have any questions, just reply to this emailwe're always happy to help out.</p> </td> </tr> <tr> <td bgcolor="#ffffff" align="left" style="padding: 0px 30px 40px 30px; border-radius: 0px 0px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <p style="margin: 0;">Cheers,BBB Team</p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 30px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#FFECD1" align="center" style="padding: 30px 30px 30px 30px; border-radius: 4px 4px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;"> <h2 style="font-size: 20px; font-weight: 400; color: #111111; margin: 0;">Need more help?</h2> <p style="margin: 0;"><a href="#" target="_blank" style="color: #FFA73B;">We&rsquo;re here to help you out</a></p> </td> </tr> </table> </td> </tr> <tr> <td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;"> <table border="0" cellpadding="0" cellspacing="0" width="100%%" style="max-width: 600px;"> <tr> <td bgcolor="#f4f4f4" align="left" style="padding: 0px 30px 30px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;"> <p style="margin: 0;">If these emails get annoying, please feel free to <a href="#" target="_blank" style="color: #111111; font-weight: 700;">unsubscribe</a>.</p> </td> </tr> </table> </td> </tr> </table> </body> </html> """]
48.878594
410
0.483365
540dd2561e2691981ca01c923a08b27ff3e24e2d
2,106
py
Python
builder/schedule.py
MyConbook/datatool
1c12bb5124b48ae827c4832896fd81bf711ad44e
[ "Apache-2.0" ]
null
null
null
builder/schedule.py
MyConbook/datatool
1c12bb5124b48ae827c4832896fd81bf711ad44e
[ "Apache-2.0" ]
null
null
null
builder/schedule.py
MyConbook/datatool
1c12bb5124b48ae827c4832896fd81bf711ad44e
[ "Apache-2.0" ]
null
null
null
import icalendar import urllib2 import hashlib import string import re import datetime from database import Database, TableHandler
30.085714
169
0.7132
540df69177e6fb46fc901283c03665c416fc9242
24,887
py
Python
src/OFS/CopySupport.py
MatthewWilkes/Zope
740f934fc9409ae0062e8f0cd6dcfd8b2df00376
[ "ZPL-2.1" ]
1
2018-12-07T21:19:58.000Z
2018-12-07T21:19:58.000Z
src/OFS/CopySupport.py
MatthewWilkes/Zope
740f934fc9409ae0062e8f0cd6dcfd8b2df00376
[ "ZPL-2.1" ]
null
null
null
src/OFS/CopySupport.py
MatthewWilkes/Zope
740f934fc9409ae0062e8f0cd6dcfd8b2df00376
[ "ZPL-2.1" ]
null
null
null
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Copy interface """ from cgi import escape from marshal import dumps from marshal import loads import re import sys import tempfile from urllib import quote from urllib import unquote import warnings from zlib import compress from zlib import decompress import transaction from AccessControl import ClassSecurityInfo from AccessControl import getSecurityManager from AccessControl.class_init import InitializeClass from AccessControl.Permissions import view_management_screens from AccessControl.Permissions import copy_or_move from AccessControl.Permissions import delete_objects from Acquisition import aq_base from Acquisition import aq_inner from Acquisition import aq_parent from App.Dialogs import MessageDialog from App.special_dtml import HTML from App.special_dtml import DTMLFile from ExtensionClass import Base from webdav.Lockable import ResourceLockedError from zExceptions import Unauthorized, BadRequest from ZODB.POSException import ConflictError from zope.interface import implements from zope.event import notify from zope.lifecycleevent import ObjectCopiedEvent from zope.lifecycleevent import ObjectMovedEvent from zope.container.contained import notifyContainerModified from OFS.event import ObjectWillBeMovedEvent from OFS.event import ObjectClonedEvent from OFS.interfaces import ICopyContainer from OFS.interfaces import ICopySource from OFS.Moniker import loadMoniker from OFS.Moniker import Moniker from OFS.subscribers import compatibilityCall copy_re = re.compile('^copy([0-9]*)_of_(.*)') _marker=[] InitializeClass(CopyContainer) InitializeClass(CopySource) fMessageDialog = HTML(""" <HTML> <HEAD> <TITLE>&dtml-title;</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <FORM ACTION="&dtml-action;" METHOD="GET" <dtml-if target>TARGET="&dtml-target;"</dtml-if>> <TABLE BORDER="0" WIDTH="100%%" CELLPADDING="10"> <TR> <TD VALIGN="TOP"> <BR> <CENTER><B><FONT SIZE="+6" COLOR="#77003B">!</FONT></B></CENTER> </TD> <TD VALIGN="TOP"> <BR><BR> <CENTER> <dtml-var message> </CENTER> </TD> </TR> <TR> <TD VALIGN="TOP"> </TD> <TD VALIGN="TOP"> <CENTER> <INPUT TYPE="SUBMIT" VALUE=" Ok "> </CENTER> </TD> </TR> </TABLE> </FORM> </BODY></HTML>""", target='', action='manage_main', title='Changed') eNoData=MessageDialog( title='No Data', message='No clipboard data found.', action ='manage_main',) eInvalid=MessageDialog( title='Clipboard Error', message='The data in the clipboard could not be read, possibly due ' \ 'to cookie data being truncated by your web browser. Try copying ' \ 'fewer objects.', action ='manage_main',) eNotFound=MessageDialog( title='Item Not Found', message='One or more items referred to in the clipboard data was ' \ 'not found. The item may have been moved or deleted after you ' \ 'copied it.', action ='manage_main',) eNotSupported=fMessageDialog( title='Not Supported', message=( 'The action against the <em>%s</em> object could not be carried ' 'out. ' 'One of the following constraints caused the problem: <br><br>' 'The object does not support this operation.' '<br><br>-- OR --<br><br>' 'The currently logged-in user does not have the <b>Copy or ' 'Move</b> permission respective to the object.' ), action ='manage_main',) eNoItemsSpecified=MessageDialog( title='No items specified', message='You must select one or more items to perform ' \ 'this operation.', action ='manage_main' )
33.952251
79
0.571704
540f2aeaaaa0eee405144a0e73dbe2a9199426b2
1,697
py
Python
Search in a Binary Search Tree.py
frank0215/Leetcode_python
9428ded4f9abd347b12bfef8aa1dd2d177f3afea
[ "MIT" ]
null
null
null
Search in a Binary Search Tree.py
frank0215/Leetcode_python
9428ded4f9abd347b12bfef8aa1dd2d177f3afea
[ "MIT" ]
null
null
null
Search in a Binary Search Tree.py
frank0215/Leetcode_python
9428ded4f9abd347b12bfef8aa1dd2d177f3afea
[ "MIT" ]
null
null
null
if __name__ == '__main__': #root = [4,2,7,1,3] # root = TreeNode(4) # root.left = TreeNode(2) # root.left.left = TreeNode(1) # root.right = TreeNode(7) # root.left.right = TreeNode(3) # val = 2 root = TreeNode(4, TreeNode(2, TreeNode(1), TreeNode(3)), TreeNode(7)) val = 2 print(Solution().searchBST(root, val).val) # output [2,1,3]
23.569444
74
0.446081
541271297050a8dd2d540558c72d94871ade9a15
1,019
py
Python
src/data/process_HJ_data.py
simran-grewal/COVID-19-Data-Analysis
8751aa75c451e956d5b1d1e2d6f2ffbec8dc673a
[ "FTL" ]
null
null
null
src/data/process_HJ_data.py
simran-grewal/COVID-19-Data-Analysis
8751aa75c451e956d5b1d1e2d6f2ffbec8dc673a
[ "FTL" ]
null
null
null
src/data/process_HJ_data.py
simran-grewal/COVID-19-Data-Analysis
8751aa75c451e956d5b1d1e2d6f2ffbec8dc673a
[ "FTL" ]
null
null
null
import subprocess import os import numpy as np import pandas as pd from datetime import datetime if __name__ == '__main__': store_relational_JH_data()
42.458333
134
0.703631
5414770e7a98cb88e29d0f46a7ec2949accc8e44
1,023
py
Python
wasm-server.py
erique/pt2-clone
f3376a5a40316f15e82feaa321673a8611c31a53
[ "BSD-3-Clause" ]
null
null
null
wasm-server.py
erique/pt2-clone
f3376a5a40316f15e82feaa321673a8611c31a53
[ "BSD-3-Clause" ]
null
null
null
wasm-server.py
erique/pt2-clone
f3376a5a40316f15e82feaa321673a8611c31a53
[ "BSD-3-Clause" ]
null
null
null
# Python 3 import sys import socketserver from http.server import SimpleHTTPRequestHandler # Python 3.7.5 adds in the WebAssembly Media Type. If this is an older # version, add in the Media Type. if sys.version_info < (3, 7, 5): WasmHandler.extensions_map['.wasm'] = 'application/wasm' if __name__ == '__main__': PORT = 8080 with socketserver.TCPServer(("", PORT), WasmHandler) as httpd: print("Listening on port {}. Press Ctrl+C to stop.".format(PORT)) httpd.serve_forever()
34.1
73
0.670577
5414822b05eb873a76f59d1b99fc4fca71aebfa2
1,850
py
Python
stage.py
boularbahsmail/Asteroids-Game
ef4ae8d2e66ea2875aba83f512610b4da56c9ef1
[ "CNRI-Python" ]
2
2021-03-25T23:02:50.000Z
2021-03-26T10:41:33.000Z
stage.py
boularbahsmail/Asteroids-Game
ef4ae8d2e66ea2875aba83f512610b4da56c9ef1
[ "CNRI-Python" ]
null
null
null
stage.py
boularbahsmail/Asteroids-Game
ef4ae8d2e66ea2875aba83f512610b4da56c9ef1
[ "CNRI-Python" ]
null
null
null
import pygame import sys import os from pygame.locals import *
29.83871
76
0.600541
5414c4d1cd6ab405e144265b135b1ae64b919a77
2,596
py
Python
web/MicroservicesAsAservice/src/notes/app.py
NoXLaw/RaRCTF2021-Challenges-Public
1a1b094359b88f8ebbc83a6b26d27ffb2602458f
[ "MIT" ]
null
null
null
web/MicroservicesAsAservice/src/notes/app.py
NoXLaw/RaRCTF2021-Challenges-Public
1a1b094359b88f8ebbc83a6b26d27ffb2602458f
[ "MIT" ]
null
null
null
web/MicroservicesAsAservice/src/notes/app.py
NoXLaw/RaRCTF2021-Challenges-Public
1a1b094359b88f8ebbc83a6b26d27ffb2602458f
[ "MIT" ]
null
null
null
from flask import Flask, request, jsonify, render_template_string import redis import requests import re import json import sys app = Flask(__name__) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
33.282051
74
0.552003
54156bd3caed9e41e591c736c817a669d7acd84f
1,195
py
Python
divisiones.py
badgercl/scrappers-congreso-chile
ae2f3f451f6fa90a4964f2c476aecdfc2c5254ee
[ "MIT" ]
null
null
null
divisiones.py
badgercl/scrappers-congreso-chile
ae2f3f451f6fa90a4964f2c476aecdfc2c5254ee
[ "MIT" ]
null
null
null
divisiones.py
badgercl/scrappers-congreso-chile
ae2f3f451f6fa90a4964f2c476aecdfc2c5254ee
[ "MIT" ]
null
null
null
import requests from bs4 import BeautifulSoup import json import pprint url = 'https://www.bcn.cl/siit/divisionelectoral/index.htm' res = requests.get(url) soup = BeautifulSoup(res.text, 'html.parser') rows = soup.find_all('tbody')[1].find_all('tr') region = "" circunscripcion = "" distrito = "" comuna = "" regiones = {} comunas = {} for row in rows: tds = row.find_all('td') if len(tds) == 4: region = tds[0].text.strip() circunscripcion = tds[1].text.split()[0].replace('','') distrito = tds[2].text.split()[1] comuna = tds[3].a.text.replace('*', '').strip() regiones[region] = { circunscripcion: { distrito: [comuna] } } elif len(tds) == 2: distrito = tds[0].text.split()[1] comuna = tds[1].a.text.replace('*', '').strip() regiones[region][circunscripcion][distrito] = [comuna] else: comuna = tds[0].a.text.replace('*', '').strip().lower() regiones[region][circunscripcion][distrito].append(comuna) comunas[comuna] = { 'circunscripcion': circunscripcion, 'distrito': distrito, 'region': region } pp = pprint.PrettyPrinter(indent=4) pp.pprint(comunas) with open('output/divisiones.json', 'w') as json_file: json.dump(comunas, json_file)
23.9
60
0.661925
5419760ed6778cfb73074dd68ffc3b8c58ad8780
685
py
Python
aws-auth-manager/src/awsauthmanager/app.py
zepplen/aws_tokens
9249ba00ea0b39ac3c523a9ea3ee2485436e84ef
[ "MIT" ]
null
null
null
aws-auth-manager/src/awsauthmanager/app.py
zepplen/aws_tokens
9249ba00ea0b39ac3c523a9ea3ee2485436e84ef
[ "MIT" ]
null
null
null
aws-auth-manager/src/awsauthmanager/app.py
zepplen/aws_tokens
9249ba00ea0b39ac3c523a9ea3ee2485436e84ef
[ "MIT" ]
null
null
null
#################################################### # (C) Mark Trimmer, 2016, All Rights Reserved # # File Name: app.py # # Creation Date: 28-12-2016 # # Created By: Mark Trimmer # # Purpose: # #################################################### from __future__ import print_function from credentialfile import CredentialFile from ststoken import StsToken
26.346154
111
0.608759
5419a767eec4a75f25fccde0e39c22e20a25e3d6
486
py
Python
setup.py
datamachines/classification-banner
53ae7ea1104000e60474955f7603c46024a1d06f
[ "Apache-2.0" ]
null
null
null
setup.py
datamachines/classification-banner
53ae7ea1104000e60474955f7603c46024a1d06f
[ "Apache-2.0" ]
1
2021-06-11T15:30:31.000Z
2021-06-14T12:58:21.000Z
setup.py
datamachines/classification-banner
53ae7ea1104000e60474955f7603c46024a1d06f
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='classification-banner', version='1.0.0', description='Classification banner compatable with GTK3 and X11.', author='Mike May', author_email='mikemay@datamachines.io', url='https://www.github.com/datamachines/classification-banner', packages=find_packages(), scripts=["bin/classification-banner"], data_files=[("classification-banner", ["style.css"])] )
32.4
72
0.687243
541ac4d6365b97db764dba02574e6974751b26ba
371
py
Python
synapyse/impl/activation_functions/linear.py
synapyse/synapyse
8c9ff53ede2d83af27ce771ce1b6ea6a32155b02
[ "MIT" ]
4
2015-09-19T11:02:56.000Z
2019-03-27T11:42:12.000Z
synapyse/impl/activation_functions/linear.py
synapyse/synapyse
8c9ff53ede2d83af27ce771ce1b6ea6a32155b02
[ "MIT" ]
null
null
null
synapyse/impl/activation_functions/linear.py
synapyse/synapyse
8c9ff53ede2d83af27ce771ce1b6ea6a32155b02
[ "MIT" ]
1
2019-10-29T16:24:28.000Z
2019-10-29T16:24:28.000Z
from synapyse.base.activation_functions.activation_function import ActivationFunction __author__ = 'Douglas Eric Fonseca Rodrigues'
23.1875
85
0.698113
541acc6e7acab303b472692f00ec1a571d8c6ad5
1,027
py
Python
demo/app/libs/description.py
suenklerhaw/seoeffekt
0a31fdfa1a7246da37e37bf53c03d94c5f13f095
[ "MIT" ]
1
2022-02-15T14:03:10.000Z
2022-02-15T14:03:10.000Z
demo/app/libs/description.py
suenklerhaw/seoeffekt
0a31fdfa1a7246da37e37bf53c03d94c5f13f095
[ "MIT" ]
null
null
null
demo/app/libs/description.py
suenklerhaw/seoeffekt
0a31fdfa1a7246da37e37bf53c03d94c5f13f095
[ "MIT" ]
null
null
null
#check description from bs4 import BeautifulSoup import lxml.html
32.09375
82
0.641675
541b0dd061b1cb2fb2dd1d60f50109368732184b
919
py
Python
backend/projectfiles/GradleProjectFile.py
karllindmark/IsYourProjectUpToDate
ce2df36b8fa39a4732b05dfd75558a914e4e990b
[ "Apache-2.0" ]
null
null
null
backend/projectfiles/GradleProjectFile.py
karllindmark/IsYourProjectUpToDate
ce2df36b8fa39a4732b05dfd75558a914e4e990b
[ "Apache-2.0" ]
null
null
null
backend/projectfiles/GradleProjectFile.py
karllindmark/IsYourProjectUpToDate
ce2df36b8fa39a4732b05dfd75558a914e4e990b
[ "Apache-2.0" ]
null
null
null
import re from backend.projectfiles.GenericProjectFile import GenericProjectFile QUOTE = r'(?:["|\'])' STRING = r'([\w\.\-\+]+)' GAV_REGEXP = QUOTE + '(?:' + ":".join([STRING, STRING, STRING]) + ')' + QUOTE
34.037037
82
0.516866
541c51e665974394ae0ab412789deb2f54ac881a
1,879
py
Python
python/rhinoscripts/example_csv_loading.py
tasbolat1/hmv-s16
7863c66ed645b463b72aef98a5c484a18cc9f396
[ "BSD-3-Clause" ]
1
2020-10-10T21:27:30.000Z
2020-10-10T21:27:30.000Z
python/rhinoscripts/example_csv_loading.py
tasbolat1/hmv-s16
7863c66ed645b463b72aef98a5c484a18cc9f396
[ "BSD-3-Clause" ]
null
null
null
python/rhinoscripts/example_csv_loading.py
tasbolat1/hmv-s16
7863c66ed645b463b72aef98a5c484a18cc9f396
[ "BSD-3-Clause" ]
null
null
null
"""Example code for importing a single rigid body trajectory into Rhino from a Optitrack CSV file. Copyright (c) 2016, Garth Zeglin. All rights reserved. Licensed under the terms of the BSD 3-clause license as included in LICENSE. Example code for generating a path of Rhino 'planes' (e.g. coordinate frame) from a trajectory data file. The path is returned as a list of Plane objects. Each plane is created using an origin vector and X and Y basis vectors. The time stamps and Z basis vectors in the trajectory file are ignored. """ # Load the Rhino API. import rhinoscriptsyntax as rs # Make sure that the Python libraries also contained within this course package # are on the load path. This adds the parent folder to the load path, assuming that this # script is still located with the rhinoscripts/ subfolder of the Python library tree. import sys, os sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) # Load the Optitrack CSV file parser module. import optitrack.csv_reader as csv from optitrack.geometry import * # Find the path to the test data file located alongside the script. filename = os.path.join( os.path.abspath(os.path.dirname(__file__)), "sample_optitrack_take.csv") # Read the file. take = csv.Take().readCSV(filename) # Print out some statistics print "Found rigid bodies:", take.rigid_bodies.keys() # Process the first rigid body into a set of planes. bodies = take.rigid_bodies.values() # for now: xaxis = [1,0,0] yaxis = [0,1,0] if len(bodies) > 0: body = bodies[0] for pos,rot in zip(body.positions, body.rotations): if pos is not None and rot is not None: xaxis, yaxis = quaternion_to_xaxis_yaxis(rot) plane = rs.PlaneFromFrame(pos, xaxis, yaxis) # create a visible plane, assuming units are in meters rs.AddPlaneSurface( plane, 0.1, 0.1 )
36.134615
98
0.734433
541d99a0b05066f7ae098ca89430a31ca86b09cb
91,180
py
Python
4_Nback/Nback_practice_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
2
2020-07-01T12:53:40.000Z
2020-07-01T13:30:23.000Z
4_Nback/Nback_practice_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
null
null
null
4_Nback/Nback_practice_lastrun.py
Brinks0211/cognitive_paradigms_patients
30e3f8268e5c2b5ebfffcc4ebbcb46d8e60d039e
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.1.3), on 15, 2020, at 09:02 If you publish work using this script the most relevant publication is: Peirce J, Gray JR, Simpson S, MacAskill M, Hchenberger R, Sogo H, Kastman E, Lindelv JK. (2019) PsychoPy2: Experiments in behavior made easy Behav Res 51: 195. https://doi.org/10.3758/s13428-018-01193-y """ from __future__ import absolute_import, division from psychopy import locale_setup from psychopy import prefs from psychopy import sound, gui, visual, core, data, event, logging, clock from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) import numpy as np # whole numpy lib is available, prepend 'np.' from numpy import (sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray) from numpy.random import random, randint, normal, shuffle import os # handy system and path functions import sys # to get file system encoding from psychopy.hardware import keyboard # Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(_thisDir) # Store info about the experiment session psychopyVersion = '2020.1.3' expName = 'Nback_Practice' # from the Builder filename that created this script expInfo = {'participant': '', '': '', '1/2': '', '1/2': ''} dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName) if dlg.OK == False: core.quit() # user pressed cancel expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName expInfo['psychopyVersion'] = psychopyVersion # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['participant'], expName, expInfo['date']) # An ExperimentHandler isn't essential but helps with data saving thisExp = data.ExperimentHandler(name=expName, version='', extraInfo=expInfo, runtimeInfo=None, originPath='C:\\Users\\zhang\\Desktop\\\\\\4_Nback\\Nback_practice_lastrun.py', savePickle=True, saveWideText=True, dataFileName=filename) # save a log file for detail verbose info logFile = logging.LogFile(filename+'.log', level=logging.EXP) logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file endExpNow = False # flag for 'escape' or other condition => quit the exp frameTolerance = 0.001 # how close to onset before 'same' frame # Start Code - component code to be run before the window creation # Setup the Window win = visual.Window( size=[1024, 768], fullscr=False, screen=0, winType='pyglet', allowGUI=True, allowStencil=False, monitor='testMonitor', color=[0,0,0], colorSpace='rgb', blendMode='avg', useFBO=True, units='height') # store frame rate of monitor if we can measure it expInfo['frameRate'] = win.getActualFrameRate() if expInfo['frameRate'] != None: frameDur = 1.0 / round(expInfo['frameRate']) else: frameDur = 1.0 / 60.0 # could not measure, so guess # create a default keyboard (e.g. to check for escape) defaultKeyboard = keyboard.Keyboard() # Initialize components for Routine "introduction1" introduction1Clock = core.Clock() introduction_1 = visual.TextStim(win=win, name='introduction_1', text='\n\n\n\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); introduction1_2 = keyboard.Keyboard() # Initialize components for Routine "introduction5" introduction5Clock = core.Clock() introduction_5 = visual.TextStim(win=win, name='introduction_5', text='\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_7 = keyboard.Keyboard() # Initialize components for Routine "tip1" tip1Clock = core.Clock() text_2 = visual.TextStim(win=win, name='text_2', text='\n\n \n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_4 = keyboard.Keyboard() # Initialize components for Routine "introduction2" introduction2Clock = core.Clock() introduction2_1 = visual.TextStim(win=win, name='introduction2_1', text='\n\n,+\n\n\n\n\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); introduction2_2 = keyboard.Keyboard() # Initialize components for Routine "_0back_pre" _0back_preClock = core.Clock() concentration_pre1 = visual.TextStim(win=win, name='concentration_pre1', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Initialize components for Routine "_0back" _0backClock = core.Clock() back0_1 = visual.TextStim(win=win, name='back0_1', text='default text', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp0 = keyboard.Keyboard() message0=" " # Initialize components for Routine "feedback_0" feedback_0Clock = core.Clock() text_3 = visual.TextStim(win=win, name='text_3', text='default text', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Initialize components for Routine "tip2" tip2Clock = core.Clock() text = visual.TextStim(win=win, name='text', text='\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_5 = keyboard.Keyboard() # Initialize components for Routine "introduction3" introduction3Clock = core.Clock() introduction3_1 = visual.TextStim(win=win, name='introduction3_1', text='\n\n,+\n\n\n\n\n,; ,\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); introduction3_2 = keyboard.Keyboard() # Initialize components for Routine "_1back_pre" _1back_preClock = core.Clock() concentration1_pre = visual.TextStim(win=win, name='concentration1_pre', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); back1_pre = visual.TextStim(win=win, name='back1_pre', text='2\n()', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); # Initialize components for Routine "_1back" _1backClock = core.Clock() back1_1 = visual.TextStim(win=win, name='back1_1', text='default text', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_2 = keyboard.Keyboard() message1=0 # Initialize components for Routine "feedback_1" feedback_1Clock = core.Clock() feedback1 = visual.TextStim(win=win, name='feedback1', text='default text', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Initialize components for Routine "tip3" tip3Clock = core.Clock() tip_3 = visual.TextStim(win=win, name='tip_3', text='\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_6 = keyboard.Keyboard() # Initialize components for Routine "introduction4" introduction4Clock = core.Clock() introduction4_1 = visual.TextStim(win=win, name='introduction4_1', text='\n\n,+\n\n\n\n\n,; ,\n\n', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp = keyboard.Keyboard() # Initialize components for Routine "_2back_pre" _2back_preClock = core.Clock() concentration_pre = visual.TextStim(win=win, name='concentration_pre', text='+', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); text_4 = visual.TextStim(win=win, name='text_4', text='1\n()', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); text_5 = visual.TextStim(win=win, name='text_5', text='4\n()', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); # Initialize components for Routine "_2back" _2backClock = core.Clock() back2_1 = visual.TextStim(win=win, name='back2_1', text='default text', font='Arial', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); key_resp_3 = keyboard.Keyboard() message2=" " # Initialize components for Routine "feedback_2" feedback_2Clock = core.Clock() feedback2 = visual.TextStim(win=win, name='feedback2', text='default text', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Initialize components for Routine "thanks" thanksClock = core.Clock() text_6 = visual.TextStim(win=win, name='text_6', text='', font='Arial', pos=(0, 0), height=0.05, wrapWidth=None, ori=0, color='white', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); # Create some handy timers globalClock = core.Clock() # to track the time since experiment started routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine # ------Prepare to start Routine "introduction1"------- continueRoutine = True # update component parameters for each repeat introduction1_2.keys = [] introduction1_2.rt = [] _introduction1_2_allKeys = [] # keep track of which components have finished introduction1Components = [introduction_1, introduction1_2] for thisComponent in introduction1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") introduction1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "introduction1"------- while continueRoutine: # get current time t = introduction1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=introduction1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *introduction_1* updates if introduction_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction_1.frameNStart = frameN # exact frame index introduction_1.tStart = t # local t and not account for scr refresh introduction_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction_1, 'tStartRefresh') # time at next scr refresh introduction_1.setAutoDraw(True) # *introduction1_2* updates waitOnFlip = False if introduction1_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction1_2.frameNStart = frameN # exact frame index introduction1_2.tStart = t # local t and not account for scr refresh introduction1_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction1_2, 'tStartRefresh') # time at next scr refresh introduction1_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(introduction1_2.clock.reset) # t=0 on next screen flip win.callOnFlip(introduction1_2.clearEvents, eventType='keyboard') # clear events on next screen flip if introduction1_2.status == STARTED and not waitOnFlip: theseKeys = introduction1_2.getKeys(keyList=['space'], waitRelease=False) _introduction1_2_allKeys.extend(theseKeys) if len(_introduction1_2_allKeys): introduction1_2.keys = _introduction1_2_allKeys[-1].name # just the last key pressed introduction1_2.rt = _introduction1_2_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in introduction1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "introduction1"------- for thisComponent in introduction1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # the Routine "introduction1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "introduction5"------- continueRoutine = True # update component parameters for each repeat key_resp_7.keys = [] key_resp_7.rt = [] _key_resp_7_allKeys = [] # keep track of which components have finished introduction5Components = [introduction_5, key_resp_7] for thisComponent in introduction5Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") introduction5Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "introduction5"------- while continueRoutine: # get current time t = introduction5Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=introduction5Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *introduction_5* updates if introduction_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction_5.frameNStart = frameN # exact frame index introduction_5.tStart = t # local t and not account for scr refresh introduction_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction_5, 'tStartRefresh') # time at next scr refresh introduction_5.setAutoDraw(True) # *key_resp_7* updates waitOnFlip = False if key_resp_7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_7.frameNStart = frameN # exact frame index key_resp_7.tStart = t # local t and not account for scr refresh key_resp_7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_7, 'tStartRefresh') # time at next scr refresh key_resp_7.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_7.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_7.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_7.status == STARTED and not waitOnFlip: theseKeys = key_resp_7.getKeys(keyList=['space'], waitRelease=False) _key_resp_7_allKeys.extend(theseKeys) if len(_key_resp_7_allKeys): key_resp_7.keys = _key_resp_7_allKeys[-1].name # just the last key pressed key_resp_7.rt = _key_resp_7_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in introduction5Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "introduction5"------- for thisComponent in introduction5Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('introduction_5.started', introduction_5.tStartRefresh) thisExp.addData('introduction_5.stopped', introduction_5.tStopRefresh) # the Routine "introduction5" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "tip1"------- continueRoutine = True # update component parameters for each repeat key_resp_4.keys = [] key_resp_4.rt = [] _key_resp_4_allKeys = [] # keep track of which components have finished tip1Components = [text_2, key_resp_4] for thisComponent in tip1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip1"------- while continueRoutine: # get current time t = tip1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text_2* updates if text_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_2.frameNStart = frameN # exact frame index text_2.tStart = t # local t and not account for scr refresh text_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_2, 'tStartRefresh') # time at next scr refresh text_2.setAutoDraw(True) # *key_resp_4* updates waitOnFlip = False if key_resp_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_4.frameNStart = frameN # exact frame index key_resp_4.tStart = t # local t and not account for scr refresh key_resp_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_4, 'tStartRefresh') # time at next scr refresh key_resp_4.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_4.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_4.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_4.status == STARTED and not waitOnFlip: theseKeys = key_resp_4.getKeys(keyList=['space'], waitRelease=False) _key_resp_4_allKeys.extend(theseKeys) if len(_key_resp_4_allKeys): key_resp_4.keys = _key_resp_4_allKeys[-1].name # just the last key pressed key_resp_4.rt = _key_resp_4_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip1"------- for thisComponent in tip1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text_2.started', text_2.tStartRefresh) thisExp.addData('text_2.stopped', text_2.tStopRefresh) # the Routine "tip1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "introduction2"------- continueRoutine = True # update component parameters for each repeat introduction2_2.keys = [] introduction2_2.rt = [] _introduction2_2_allKeys = [] # keep track of which components have finished introduction2Components = [introduction2_1, introduction2_2] for thisComponent in introduction2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") introduction2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "introduction2"------- while continueRoutine: # get current time t = introduction2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=introduction2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *introduction2_1* updates if introduction2_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction2_1.frameNStart = frameN # exact frame index introduction2_1.tStart = t # local t and not account for scr refresh introduction2_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction2_1, 'tStartRefresh') # time at next scr refresh introduction2_1.setAutoDraw(True) # *introduction2_2* updates waitOnFlip = False if introduction2_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction2_2.frameNStart = frameN # exact frame index introduction2_2.tStart = t # local t and not account for scr refresh introduction2_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction2_2, 'tStartRefresh') # time at next scr refresh introduction2_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(introduction2_2.clock.reset) # t=0 on next screen flip win.callOnFlip(introduction2_2.clearEvents, eventType='keyboard') # clear events on next screen flip if introduction2_2.status == STARTED and not waitOnFlip: theseKeys = introduction2_2.getKeys(keyList=['space'], waitRelease=False) _introduction2_2_allKeys.extend(theseKeys) if len(_introduction2_2_allKeys): introduction2_2.keys = _introduction2_2_allKeys[-1].name # just the last key pressed introduction2_2.rt = _introduction2_2_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in introduction2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "introduction2"------- for thisComponent in introduction2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # the Routine "introduction2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "_0back_pre"------- continueRoutine = True routineTimer.add(1.000000) # update component parameters for each repeat # keep track of which components have finished _0back_preComponents = [concentration_pre1] for thisComponent in _0back_preComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _0back_preClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_0back_pre"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _0back_preClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_0back_preClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration_pre1* updates if concentration_pre1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration_pre1.frameNStart = frameN # exact frame index concentration_pre1.tStart = t # local t and not account for scr refresh concentration_pre1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration_pre1, 'tStartRefresh') # time at next scr refresh concentration_pre1.setAutoDraw(True) if concentration_pre1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration_pre1.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration_pre1.tStop = t # not accounting for scr refresh concentration_pre1.frameNStop = frameN # exact frame index win.timeOnFlip(concentration_pre1, 'tStopRefresh') # time at next scr refresh concentration_pre1.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _0back_preComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_0back_pre"------- for thisComponent in _0back_preComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('concentration_pre1.started', concentration_pre1.tStartRefresh) thisExp.addData('concentration_pre1.stopped', concentration_pre1.tStopRefresh) # set up handler to look after randomisation of conditions etc loop_0back = data.TrialHandler(nReps=2, method='random', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('documents\\document_0back_pre.xlsx'), seed=None, name='loop_0back') thisExp.addLoop(loop_0back) # add the loop to the experiment thisLoop_0back = loop_0back.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop_0back.rgb) if thisLoop_0back != None: for paramName in thisLoop_0back: exec('{} = thisLoop_0back[paramName]'.format(paramName)) for thisLoop_0back in loop_0back: currentLoop = loop_0back # abbreviate parameter names if possible (e.g. rgb = thisLoop_0back.rgb) if thisLoop_0back != None: for paramName in thisLoop_0back: exec('{} = thisLoop_0back[paramName]'.format(paramName)) # ------Prepare to start Routine "_0back"------- continueRoutine = True routineTimer.add(4.000000) # update component parameters for each repeat back0_1.setText(num1) key_resp0.keys = [] key_resp0.rt = [] _key_resp0_allKeys = [] # keep track of which components have finished _0backComponents = [back0_1, key_resp0] for thisComponent in _0backComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _0backClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_0back"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _0backClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_0backClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *back0_1* updates if back0_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later back0_1.frameNStart = frameN # exact frame index back0_1.tStart = t # local t and not account for scr refresh back0_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(back0_1, 'tStartRefresh') # time at next scr refresh back0_1.setAutoDraw(True) if back0_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > back0_1.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later back0_1.tStop = t # not accounting for scr refresh back0_1.frameNStop = frameN # exact frame index win.timeOnFlip(back0_1, 'tStopRefresh') # time at next scr refresh back0_1.setAutoDraw(False) # *key_resp0* updates waitOnFlip = False if key_resp0.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp0.frameNStart = frameN # exact frame index key_resp0.tStart = t # local t and not account for scr refresh key_resp0.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp0, 'tStartRefresh') # time at next scr refresh key_resp0.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp0.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp0.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp0.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > key_resp0.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later key_resp0.tStop = t # not accounting for scr refresh key_resp0.frameNStop = frameN # exact frame index win.timeOnFlip(key_resp0, 'tStopRefresh') # time at next scr refresh key_resp0.status = FINISHED if key_resp0.status == STARTED and not waitOnFlip: theseKeys = key_resp0.getKeys(keyList=['space'], waitRelease=False) _key_resp0_allKeys.extend(theseKeys) if len(_key_resp0_allKeys): key_resp0.keys = _key_resp0_allKeys[-1].name # just the last key pressed key_resp0.rt = _key_resp0_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _0backComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_0back"------- for thisComponent in _0backComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop_0back.addData('back0_1.started', back0_1.tStartRefresh) loop_0back.addData('back0_1.stopped', back0_1.tStopRefresh) # check responses if key_resp0.keys in ['', [], None]: # No response was made key_resp0.keys = None loop_0back.addData('key_resp0.keys',key_resp0.keys) if key_resp0.keys != None: # we had a response loop_0back.addData('key_resp0.rt', key_resp0.rt) loop_0back.addData('key_resp0.started', key_resp0.tStartRefresh) loop_0back.addData('key_resp0.stopped', key_resp0.tStopRefresh) if not key_resp0.keys: message0="" # ------Prepare to start Routine "feedback_0"------- continueRoutine = True routineTimer.add(1.000000) # update component parameters for each repeat text_3.setText(message0) # keep track of which components have finished feedback_0Components = [text_3] for thisComponent in feedback_0Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feedback_0Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feedback_0"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feedback_0Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feedback_0Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text_3* updates if text_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_3.frameNStart = frameN # exact frame index text_3.tStart = t # local t and not account for scr refresh text_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_3, 'tStartRefresh') # time at next scr refresh text_3.setAutoDraw(True) if text_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_3.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later text_3.tStop = t # not accounting for scr refresh text_3.frameNStop = frameN # exact frame index win.timeOnFlip(text_3, 'tStopRefresh') # time at next scr refresh text_3.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feedback_0Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feedback_0"------- for thisComponent in feedback_0Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop_0back.addData('text_3.started', text_3.tStartRefresh) loop_0back.addData('text_3.stopped', text_3.tStopRefresh) thisExp.nextEntry() # completed 2 repeats of 'loop_0back' # ------Prepare to start Routine "tip2"------- continueRoutine = True # update component parameters for each repeat key_resp_5.keys = [] key_resp_5.rt = [] _key_resp_5_allKeys = [] # keep track of which components have finished tip2Components = [text, key_resp_5] for thisComponent in tip2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip2"------- while continueRoutine: # get current time t = tip2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text* updates if text.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text.frameNStart = frameN # exact frame index text.tStart = t # local t and not account for scr refresh text.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text, 'tStartRefresh') # time at next scr refresh text.setAutoDraw(True) # *key_resp_5* updates waitOnFlip = False if key_resp_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_5.frameNStart = frameN # exact frame index key_resp_5.tStart = t # local t and not account for scr refresh key_resp_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_5, 'tStartRefresh') # time at next scr refresh key_resp_5.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_5.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_5.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_5.status == STARTED and not waitOnFlip: theseKeys = key_resp_5.getKeys(keyList=['space'], waitRelease=False) _key_resp_5_allKeys.extend(theseKeys) if len(_key_resp_5_allKeys): key_resp_5.keys = _key_resp_5_allKeys[-1].name # just the last key pressed key_resp_5.rt = _key_resp_5_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip2"------- for thisComponent in tip2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text.started', text.tStartRefresh) thisExp.addData('text.stopped', text.tStopRefresh) # the Routine "tip2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "introduction3"------- continueRoutine = True # update component parameters for each repeat introduction3_2.keys = [] introduction3_2.rt = [] _introduction3_2_allKeys = [] # keep track of which components have finished introduction3Components = [introduction3_1, introduction3_2] for thisComponent in introduction3Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") introduction3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "introduction3"------- while continueRoutine: # get current time t = introduction3Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=introduction3Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *introduction3_1* updates if introduction3_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction3_1.frameNStart = frameN # exact frame index introduction3_1.tStart = t # local t and not account for scr refresh introduction3_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction3_1, 'tStartRefresh') # time at next scr refresh introduction3_1.setAutoDraw(True) # *introduction3_2* updates waitOnFlip = False if introduction3_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction3_2.frameNStart = frameN # exact frame index introduction3_2.tStart = t # local t and not account for scr refresh introduction3_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction3_2, 'tStartRefresh') # time at next scr refresh introduction3_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(introduction3_2.clock.reset) # t=0 on next screen flip win.callOnFlip(introduction3_2.clearEvents, eventType='keyboard') # clear events on next screen flip if introduction3_2.status == STARTED and not waitOnFlip: theseKeys = introduction3_2.getKeys(keyList=['space'], waitRelease=False) _introduction3_2_allKeys.extend(theseKeys) if len(_introduction3_2_allKeys): introduction3_2.keys = _introduction3_2_allKeys[-1].name # just the last key pressed introduction3_2.rt = _introduction3_2_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in introduction3Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "introduction3"------- for thisComponent in introduction3Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # the Routine "introduction3" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "_1back_pre"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat # keep track of which components have finished _1back_preComponents = [concentration1_pre, back1_pre] for thisComponent in _1back_preComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _1back_preClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_1back_pre"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _1back_preClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_1back_preClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration1_pre* updates if concentration1_pre.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration1_pre.frameNStart = frameN # exact frame index concentration1_pre.tStart = t # local t and not account for scr refresh concentration1_pre.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration1_pre, 'tStartRefresh') # time at next scr refresh concentration1_pre.setAutoDraw(True) if concentration1_pre.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration1_pre.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration1_pre.tStop = t # not accounting for scr refresh concentration1_pre.frameNStop = frameN # exact frame index win.timeOnFlip(concentration1_pre, 'tStopRefresh') # time at next scr refresh concentration1_pre.setAutoDraw(False) # *back1_pre* updates if back1_pre.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later back1_pre.frameNStart = frameN # exact frame index back1_pre.tStart = t # local t and not account for scr refresh back1_pre.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(back1_pre, 'tStartRefresh') # time at next scr refresh back1_pre.setAutoDraw(True) if back1_pre.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > back1_pre.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later back1_pre.tStop = t # not accounting for scr refresh back1_pre.frameNStop = frameN # exact frame index win.timeOnFlip(back1_pre, 'tStopRefresh') # time at next scr refresh back1_pre.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _1back_preComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_1back_pre"------- for thisComponent in _1back_preComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('concentration1_pre.started', concentration1_pre.tStartRefresh) thisExp.addData('concentration1_pre.stopped', concentration1_pre.tStopRefresh) thisExp.addData('back1_pre.started', back1_pre.tStartRefresh) thisExp.addData('back1_pre.stopped', back1_pre.tStopRefresh) # set up handler to look after randomisation of conditions etc loop_1back = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('documents\\document_1back_pre.xlsx'), seed=None, name='loop_1back') thisExp.addLoop(loop_1back) # add the loop to the experiment thisLoop_1back = loop_1back.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop_1back.rgb) if thisLoop_1back != None: for paramName in thisLoop_1back: exec('{} = thisLoop_1back[paramName]'.format(paramName)) for thisLoop_1back in loop_1back: currentLoop = loop_1back # abbreviate parameter names if possible (e.g. rgb = thisLoop_1back.rgb) if thisLoop_1back != None: for paramName in thisLoop_1back: exec('{} = thisLoop_1back[paramName]'.format(paramName)) # ------Prepare to start Routine "_1back"------- continueRoutine = True routineTimer.add(4.000000) # update component parameters for each repeat back1_1.setText(num2) key_resp_2.keys = [] key_resp_2.rt = [] _key_resp_2_allKeys = [] # keep track of which components have finished _1backComponents = [back1_1, key_resp_2] for thisComponent in _1backComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _1backClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_1back"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _1backClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_1backClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *back1_1* updates if back1_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later back1_1.frameNStart = frameN # exact frame index back1_1.tStart = t # local t and not account for scr refresh back1_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(back1_1, 'tStartRefresh') # time at next scr refresh back1_1.setAutoDraw(True) if back1_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > back1_1.tStartRefresh + 1-frameTolerance: # keep track of stop time/frame for later back1_1.tStop = t # not accounting for scr refresh back1_1.frameNStop = frameN # exact frame index win.timeOnFlip(back1_1, 'tStopRefresh') # time at next scr refresh back1_1.setAutoDraw(False) # *key_resp_2* updates waitOnFlip = False if key_resp_2.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_2.frameNStart = frameN # exact frame index key_resp_2.tStart = t # local t and not account for scr refresh key_resp_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_2, 'tStartRefresh') # time at next scr refresh key_resp_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_2.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_2.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > key_resp_2.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later key_resp_2.tStop = t # not accounting for scr refresh key_resp_2.frameNStop = frameN # exact frame index win.timeOnFlip(key_resp_2, 'tStopRefresh') # time at next scr refresh key_resp_2.status = FINISHED if key_resp_2.status == STARTED and not waitOnFlip: theseKeys = key_resp_2.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_2_allKeys.extend(theseKeys) if len(_key_resp_2_allKeys): key_resp_2.keys = _key_resp_2_allKeys[-1].name # just the last key pressed key_resp_2.rt = _key_resp_2_allKeys[-1].rt # was this correct? if (key_resp_2.keys == str(num2_corr)) or (key_resp_2.keys == num2_corr): key_resp_2.corr = 1 else: key_resp_2.corr = 0 # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _1backComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_1back"------- for thisComponent in _1backComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop_1back.addData('back1_1.started', back1_1.tStartRefresh) loop_1back.addData('back1_1.stopped', back1_1.tStopRefresh) # check responses if key_resp_2.keys in ['', [], None]: # No response was made key_resp_2.keys = None # was no response the correct answer?! if str(num2_corr).lower() == 'none': key_resp_2.corr = 1; # correct non-response else: key_resp_2.corr = 0; # failed to respond (incorrectly) # store data for loop_1back (TrialHandler) loop_1back.addData('key_resp_2.keys',key_resp_2.keys) loop_1back.addData('key_resp_2.corr', key_resp_2.corr) if key_resp_2.keys != None: # we had a response loop_1back.addData('key_resp_2.rt', key_resp_2.rt) loop_1back.addData('key_resp_2.started', key_resp_2.tStartRefresh) loop_1back.addData('key_resp_2.stopped', key_resp_2.tStopRefresh) if not key_resp_2.keys: message1="" else: if key_resp_2.corr: message1="" else: message1="" # ------Prepare to start Routine "feedback_1"------- continueRoutine = True routineTimer.add(1.000000) # update component parameters for each repeat feedback1.setText(message1) # keep track of which components have finished feedback_1Components = [feedback1] for thisComponent in feedback_1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feedback_1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feedback_1"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feedback_1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feedback_1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback1* updates if feedback1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback1.frameNStart = frameN # exact frame index feedback1.tStart = t # local t and not account for scr refresh feedback1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback1, 'tStartRefresh') # time at next scr refresh feedback1.setAutoDraw(True) if feedback1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback1.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later feedback1.tStop = t # not accounting for scr refresh feedback1.frameNStop = frameN # exact frame index win.timeOnFlip(feedback1, 'tStopRefresh') # time at next scr refresh feedback1.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feedback_1Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feedback_1"------- for thisComponent in feedback_1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop_1back.addData('feedback1.started', feedback1.tStartRefresh) loop_1back.addData('feedback1.stopped', feedback1.tStopRefresh) thisExp.nextEntry() # completed 1 repeats of 'loop_1back' # ------Prepare to start Routine "tip3"------- continueRoutine = True # update component parameters for each repeat key_resp_6.keys = [] key_resp_6.rt = [] _key_resp_6_allKeys = [] # keep track of which components have finished tip3Components = [tip_3, key_resp_6] for thisComponent in tip3Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") tip3Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "tip3"------- while continueRoutine: # get current time t = tip3Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=tip3Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *tip_3* updates if tip_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later tip_3.frameNStart = frameN # exact frame index tip_3.tStart = t # local t and not account for scr refresh tip_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(tip_3, 'tStartRefresh') # time at next scr refresh tip_3.setAutoDraw(True) # *key_resp_6* updates waitOnFlip = False if key_resp_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_6.frameNStart = frameN # exact frame index key_resp_6.tStart = t # local t and not account for scr refresh key_resp_6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_6, 'tStartRefresh') # time at next scr refresh key_resp_6.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_6.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_6.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_6.status == STARTED and not waitOnFlip: theseKeys = key_resp_6.getKeys(keyList=['space'], waitRelease=False) _key_resp_6_allKeys.extend(theseKeys) if len(_key_resp_6_allKeys): key_resp_6.keys = _key_resp_6_allKeys[-1].name # just the last key pressed key_resp_6.rt = _key_resp_6_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in tip3Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "tip3"------- for thisComponent in tip3Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('tip_3.started', tip_3.tStartRefresh) thisExp.addData('tip_3.stopped', tip_3.tStopRefresh) # the Routine "tip3" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "introduction4"------- continueRoutine = True # update component parameters for each repeat key_resp.keys = [] key_resp.rt = [] _key_resp_allKeys = [] # keep track of which components have finished introduction4Components = [introduction4_1, key_resp] for thisComponent in introduction4Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") introduction4Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "introduction4"------- while continueRoutine: # get current time t = introduction4Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=introduction4Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *introduction4_1* updates if introduction4_1.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later introduction4_1.frameNStart = frameN # exact frame index introduction4_1.tStart = t # local t and not account for scr refresh introduction4_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(introduction4_1, 'tStartRefresh') # time at next scr refresh introduction4_1.setAutoDraw(True) # *key_resp* updates waitOnFlip = False if key_resp.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp.frameNStart = frameN # exact frame index key_resp.tStart = t # local t and not account for scr refresh key_resp.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp, 'tStartRefresh') # time at next scr refresh key_resp.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp.status == STARTED and not waitOnFlip: theseKeys = key_resp.getKeys(keyList=['space'], waitRelease=False) _key_resp_allKeys.extend(theseKeys) if len(_key_resp_allKeys): key_resp.keys = _key_resp_allKeys[-1].name # just the last key pressed key_resp.rt = _key_resp_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in introduction4Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "introduction4"------- for thisComponent in introduction4Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('introduction4_1.started', introduction4_1.tStartRefresh) thisExp.addData('introduction4_1.stopped', introduction4_1.tStopRefresh) # the Routine "introduction4" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "_2back_pre"------- continueRoutine = True routineTimer.add(4.000000) # update component parameters for each repeat # keep track of which components have finished _2back_preComponents = [concentration_pre, text_4, text_5] for thisComponent in _2back_preComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _2back_preClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_2back_pre"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _2back_preClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_2back_preClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *concentration_pre* updates if concentration_pre.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later concentration_pre.frameNStart = frameN # exact frame index concentration_pre.tStart = t # local t and not account for scr refresh concentration_pre.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(concentration_pre, 'tStartRefresh') # time at next scr refresh concentration_pre.setAutoDraw(True) if concentration_pre.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > concentration_pre.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later concentration_pre.tStop = t # not accounting for scr refresh concentration_pre.frameNStop = frameN # exact frame index win.timeOnFlip(concentration_pre, 'tStopRefresh') # time at next scr refresh concentration_pre.setAutoDraw(False) # *text_4* updates if text_4.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later text_4.frameNStart = frameN # exact frame index text_4.tStart = t # local t and not account for scr refresh text_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_4, 'tStartRefresh') # time at next scr refresh text_4.setAutoDraw(True) if text_4.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_4.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later text_4.tStop = t # not accounting for scr refresh text_4.frameNStop = frameN # exact frame index win.timeOnFlip(text_4, 'tStopRefresh') # time at next scr refresh text_4.setAutoDraw(False) # *text_5* updates if text_5.status == NOT_STARTED and tThisFlip >= 3-frameTolerance: # keep track of start time/frame for later text_5.frameNStart = frameN # exact frame index text_5.tStart = t # local t and not account for scr refresh text_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_5, 'tStartRefresh') # time at next scr refresh text_5.setAutoDraw(True) if text_5.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_5.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later text_5.tStop = t # not accounting for scr refresh text_5.frameNStop = frameN # exact frame index win.timeOnFlip(text_5, 'tStopRefresh') # time at next scr refresh text_5.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _2back_preComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_2back_pre"------- for thisComponent in _2back_preComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('concentration_pre.started', concentration_pre.tStartRefresh) thisExp.addData('concentration_pre.stopped', concentration_pre.tStopRefresh) thisExp.addData('text_4.started', text_4.tStartRefresh) thisExp.addData('text_4.stopped', text_4.tStopRefresh) thisExp.addData('text_5.started', text_5.tStartRefresh) thisExp.addData('text_5.stopped', text_5.tStopRefresh) # set up handler to look after randomisation of conditions etc loop2back = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('documents\\document_2back_pre.xlsx'), seed=None, name='loop2back') thisExp.addLoop(loop2back) # add the loop to the experiment thisLoop2back = loop2back.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisLoop2back.rgb) if thisLoop2back != None: for paramName in thisLoop2back: exec('{} = thisLoop2back[paramName]'.format(paramName)) for thisLoop2back in loop2back: currentLoop = loop2back # abbreviate parameter names if possible (e.g. rgb = thisLoop2back.rgb) if thisLoop2back != None: for paramName in thisLoop2back: exec('{} = thisLoop2back[paramName]'.format(paramName)) # ------Prepare to start Routine "_2back"------- continueRoutine = True routineTimer.add(4.000000) # update component parameters for each repeat back2_1.setText(num3) key_resp_3.keys = [] key_resp_3.rt = [] _key_resp_3_allKeys = [] # keep track of which components have finished _2backComponents = [back2_1, key_resp_3] for thisComponent in _2backComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") _2backClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "_2back"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = _2backClock.getTime() tThisFlip = win.getFutureFlipTime(clock=_2backClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *back2_1* updates if back2_1.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later back2_1.frameNStart = frameN # exact frame index back2_1.tStart = t # local t and not account for scr refresh back2_1.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(back2_1, 'tStartRefresh') # time at next scr refresh back2_1.setAutoDraw(True) if back2_1.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > back2_1.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later back2_1.tStop = t # not accounting for scr refresh back2_1.frameNStop = frameN # exact frame index win.timeOnFlip(back2_1, 'tStopRefresh') # time at next scr refresh back2_1.setAutoDraw(False) # *key_resp_3* updates waitOnFlip = False if key_resp_3.status == NOT_STARTED and tThisFlip >= 1-frameTolerance: # keep track of start time/frame for later key_resp_3.frameNStart = frameN # exact frame index key_resp_3.tStart = t # local t and not account for scr refresh key_resp_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_3, 'tStartRefresh') # time at next scr refresh key_resp_3.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_3.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_3.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_3.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > key_resp_3.tStartRefresh + 3-frameTolerance: # keep track of stop time/frame for later key_resp_3.tStop = t # not accounting for scr refresh key_resp_3.frameNStop = frameN # exact frame index win.timeOnFlip(key_resp_3, 'tStopRefresh') # time at next scr refresh key_resp_3.status = FINISHED if key_resp_3.status == STARTED and not waitOnFlip: theseKeys = key_resp_3.getKeys(keyList=['left', 'right'], waitRelease=False) _key_resp_3_allKeys.extend(theseKeys) if len(_key_resp_3_allKeys): key_resp_3.keys = _key_resp_3_allKeys[-1].name # just the last key pressed key_resp_3.rt = _key_resp_3_allKeys[-1].rt # was this correct? if (key_resp_3.keys == str(num3_corr)) or (key_resp_3.keys == num3_corr): key_resp_3.corr = 1 else: key_resp_3.corr = 0 # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in _2backComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "_2back"------- for thisComponent in _2backComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop2back.addData('back2_1.started', back2_1.tStartRefresh) loop2back.addData('back2_1.stopped', back2_1.tStopRefresh) # check responses if key_resp_3.keys in ['', [], None]: # No response was made key_resp_3.keys = None # was no response the correct answer?! if str(num3_corr).lower() == 'none': key_resp_3.corr = 1; # correct non-response else: key_resp_3.corr = 0; # failed to respond (incorrectly) # store data for loop2back (TrialHandler) loop2back.addData('key_resp_3.keys',key_resp_3.keys) loop2back.addData('key_resp_3.corr', key_resp_3.corr) if key_resp_3.keys != None: # we had a response loop2back.addData('key_resp_3.rt', key_resp_3.rt) loop2back.addData('key_resp_3.started', key_resp_3.tStartRefresh) loop2back.addData('key_resp_3.stopped', key_resp_3.tStopRefresh) if not key_resp_3.keys: message2="" else: if key_resp_3.corr: message2="" else: message2="" # ------Prepare to start Routine "feedback_2"------- continueRoutine = True routineTimer.add(1.000000) # update component parameters for each repeat feedback2.setText(message2) # keep track of which components have finished feedback_2Components = [feedback2] for thisComponent in feedback_2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") feedback_2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "feedback_2"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = feedback_2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=feedback_2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *feedback2* updates if feedback2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later feedback2.frameNStart = frameN # exact frame index feedback2.tStart = t # local t and not account for scr refresh feedback2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(feedback2, 'tStartRefresh') # time at next scr refresh feedback2.setAutoDraw(True) if feedback2.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > feedback2.tStartRefresh + 1.0-frameTolerance: # keep track of stop time/frame for later feedback2.tStop = t # not accounting for scr refresh feedback2.frameNStop = frameN # exact frame index win.timeOnFlip(feedback2, 'tStopRefresh') # time at next scr refresh feedback2.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in feedback_2Components: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "feedback_2"------- for thisComponent in feedback_2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) loop2back.addData('feedback2.started', feedback2.tStartRefresh) loop2back.addData('feedback2.stopped', feedback2.tStopRefresh) thisExp.nextEntry() # completed 1 repeats of 'loop2back' # ------Prepare to start Routine "thanks"------- continueRoutine = True routineTimer.add(2.000000) # update component parameters for each repeat # keep track of which components have finished thanksComponents = [text_6] for thisComponent in thanksComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") thanksClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "thanks"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = thanksClock.getTime() tThisFlip = win.getFutureFlipTime(clock=thanksClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *text_6* updates if text_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later text_6.frameNStart = frameN # exact frame index text_6.tStart = t # local t and not account for scr refresh text_6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(text_6, 'tStartRefresh') # time at next scr refresh text_6.setAutoDraw(True) if text_6.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > text_6.tStartRefresh + 2-frameTolerance: # keep track of stop time/frame for later text_6.tStop = t # not accounting for scr refresh text_6.frameNStop = frameN # exact frame index win.timeOnFlip(text_6, 'tStopRefresh') # time at next scr refresh text_6.setAutoDraw(False) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in thanksComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "thanks"------- for thisComponent in thanksComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('text_6.started', text_6.tStartRefresh) thisExp.addData('text_6.stopped', text_6.tStopRefresh) # Flip one final time so any remaining win.callOnFlip() # and win.timeOnFlip() tasks get executed before quitting win.flip() # these shouldn't be strictly necessary (should auto-save) thisExp.saveAsWideText(filename+'.csv') thisExp.saveAsPickle(filename) logging.flush() # make sure everything is closed down thisExp.abort() # or data files will save again on exit win.close() core.quit()
45.842132
121
0.66599
541db46f26a3ec258d9d85654ca98eae0553065a
3,271
py
Python
pysal/contrib/geotable/utils.py
cubensys/pysal
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
[ "MIT", "BSD-3-Clause" ]
null
null
null
pysal/contrib/geotable/utils.py
cubensys/pysal
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
[ "MIT", "BSD-3-Clause" ]
null
null
null
pysal/contrib/geotable/utils.py
cubensys/pysal
8d50990f6e6603ba79ae1a887a20a1e3a0734e51
[ "MIT", "BSD-3-Clause" ]
1
2021-07-19T01:46:17.000Z
2021-07-19T01:46:17.000Z
from ...cg import asShape as pShape from ...common import requires as _requires from warnings import warn def insert_metadata(df, obj, name=None, inplace=False, overwrite=False): """ Insert an object into a dataframe's metadata with a given key. Arguments ------------ df : pd.DataFrame dataframe to insert into the metadata obj : object object desired to insert into the dataframe name : string key of the object to use. Will be available as an attribute of the dataframe. inplace : bool flag to denote whether to operate on a copy of the dataframe or not. overwrite : bool flag to denote whether to replace existing entry in metadata or not. Returns -------- If inplace, changes dataframe implicitly. Else, returns a new dataframe with added metadata. """ if not inplace: new = df.copy(deep=True) insert_metadata(new, obj, name=name, inplace=True, overwrite=overwrite) return new if name is None: name = type(obj).__name__ if hasattr(df, name): if overwrite: warn('Overwriting attribute {}! This may break the dataframe!'.format(name)) else: raise Exception('Dataframe already has attribute {}. Cowardly refusing ' 'to break dataframe. '.format(name)) df._metadata.append(name) df.__setattr__(name, obj)
33.721649
100
0.602262
541de3fcd94ea7163228d56302142fff219657ee
287
py
Python
torrent/torrent_tracker/whitelist_api/urls.py
projectpai/paipass
8b8e70b6808bf026cf957e240c7eed7bfcf4c55d
[ "MIT" ]
3
2021-04-17T10:20:26.000Z
2022-03-08T07:36:13.000Z
torrent/torrent_tracker/whitelist_api/urls.py
projectpai/paipass
8b8e70b6808bf026cf957e240c7eed7bfcf4c55d
[ "MIT" ]
null
null
null
torrent/torrent_tracker/whitelist_api/urls.py
projectpai/paipass
8b8e70b6808bf026cf957e240c7eed7bfcf4c55d
[ "MIT" ]
null
null
null
from django.urls import path from whitelist_api.views import AddTorrentInfoHash, RemoveTorrentInfoHash app_name = 'whitelist_api' urlpatterns = [ path('add-torrent-info-hash/', AddTorrentInfoHash.as_view()), path('del-torrent-info-hash/', RemoveTorrentInfoHash.as_view()), ]
23.916667
73
0.766551
541e93e13927b8ffff8b83f86083ffe9dd7cdee8
1,847
py
Python
vega/core/metrics/pytorch/flops_and_params.py
qixiuai/vega
3e6588ea4aedb03e3594a549a97ffdb86adb88d1
[ "MIT" ]
null
null
null
vega/core/metrics/pytorch/flops_and_params.py
qixiuai/vega
3e6588ea4aedb03e3594a549a97ffdb86adb88d1
[ "MIT" ]
null
null
null
vega/core/metrics/pytorch/flops_and_params.py
qixiuai/vega
3e6588ea4aedb03e3594a549a97ffdb86adb88d1
[ "MIT" ]
null
null
null
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MIT License for more details. """PyTorch model counter of FLOPS and parameters.""" from copy import deepcopy import torch.nn as nn from thop import profile from thop.profile import register_hooks from thop.vision.basic_hooks import count_softmax def add_new_hooks(custom_hooks): """Add new register hooks to custom hooks.""" add_register_hooks = { nn.PReLU: register_hooks[nn.ReLU], nn.ELU: register_hooks[nn.ReLU], nn.Softmax: count_softmax } for k, v in add_register_hooks.items(): if k not in register_hooks and k not in custom_hooks: custom_hooks[k] = v return custom_hooks def calc_model_flops_params(model, input, custom_hooks=None, verbose=False): """Pytorch model flops and parameters calculation. :param model: pytorch model :type model: torch.nn.Module :param input: pytorch input tensor :type input: torch.Tensor :param custom_hooks: hooks defined by outside customer :type custom_hooks: dict or None :param verbose: whether to print op type which not in collection :type verbose: bool, default True :return: flops and params :rtype: float, float """ _model = deepcopy(model) if custom_hooks is None: custom_hooks = {} custom_hooks = add_new_hooks(custom_hooks) inputs = (input, ) flops, params = profile(_model, inputs, custom_hooks, verbose) del _model return flops, params
33.581818
76
0.714131
5421063007f16d8c808280360658d8af84912272
524
py
Python
Projects/project04/pop_shrink.py
tonysulfaro/CSE-331
b4f743b1127ebe531ba8417420d043e9c149135a
[ "MIT" ]
2
2019-02-13T17:49:18.000Z
2020-09-30T04:51:53.000Z
Projects/project04/pop_shrink.py
tonysulfaro/CSE-331
b4f743b1127ebe531ba8417420d043e9c149135a
[ "MIT" ]
null
null
null
Projects/project04/pop_shrink.py
tonysulfaro/CSE-331
b4f743b1127ebe531ba8417420d043e9c149135a
[ "MIT" ]
null
null
null
from Stack import Stack main()
17.466667
48
0.564885
5421bfc32b86a8ee54dfb925ef8eac6e4d16b3b0
212
py
Python
pycache/__init__.py
HuiiBuh/pycache
300bd51f9e575fd77014d6c86497dd58f313f752
[ "MIT" ]
1
2021-09-04T05:34:26.000Z
2021-09-04T05:34:26.000Z
pycache/__init__.py
HuiiBuh/pycache
300bd51f9e575fd77014d6c86497dd58f313f752
[ "MIT" ]
1
2021-03-14T19:26:01.000Z
2021-03-16T18:46:38.000Z
pycache/__init__.py
HuiiBuh/pycache
300bd51f9e575fd77014d6c86497dd58f313f752
[ "MIT" ]
null
null
null
__version__ = '0.3.2' # noinspection PyUnresolvedReferences from ._cache._cache import cache # noinspection PyUnresolvedReferences from ._scheduler._scheduler import add_schedule, schedule, ScheduleSubscription
30.285714
79
0.84434
5423d564159a63ea1cc7a476c45ce6fae5bb3b4a
1,670
py
Python
bender/tests/test_predict_pipeline.py
otovo/bender
b64f0656658287b932ce44d52e6035682652fe33
[ "Apache-2.0" ]
2
2021-12-17T15:45:40.000Z
2021-12-18T14:15:43.000Z
bender/tests/test_predict_pipeline.py
otovo/bender
b64f0656658287b932ce44d52e6035682652fe33
[ "Apache-2.0" ]
2
2022-03-30T14:31:12.000Z
2022-03-31T14:25:25.000Z
bender/tests/test_predict_pipeline.py
otovo/bender
b64f0656658287b932ce44d52e6035682652fe33
[ "Apache-2.0" ]
1
2021-12-19T17:16:38.000Z
2021-12-19T17:16:38.000Z
import numpy as np import pytest from pandas.core.frame import DataFrame from bender.importers import DataImporters from bender.model_loaders import ModelLoaders from bender.model_trainer.decision_tree import DecisionTreeClassifierTrainer from bender.split_strategies import SplitStrategies pytestmark = pytest.mark.asyncio
27.833333
116
0.640719