content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
# # 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
[ 2, 198, 2, 5231, 519, 877, 515, 416, 16283, 2135, 3082, 5329, 357, 15, 13, 24, 13, 17, 8, 198, 2, 198, 2, 8410, 5626, 48483, 4725, 48481, 7013, 15986, 311, 11335, 14603, 7013, 35876, 25003, 7013, 15986, 8410, 2751, 198, 2, 198, 2,...
3.148387
155
#!/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"]
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 9, 15069, 6186, 13, 785, 11, 3457, 13, 393, 663, 29116, 13, 1439, 6923, 33876, 13, 198, 9, 30628, ...
3.422604
407
# -*- 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()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 565, 600, 13, 5239, 9019, 13, 7295, 198, 27156, 93, 198, 198, 14055, 8255, 10080, 11244, 329, 350, 5500, 14, 5497, 298, 14, 34379, 13, 198, 198, 37811...
2.314858
848
#!/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')
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 6738, 1233, 26791, 13, 7295, 1330, 9058, 198, 11748, 900, 37623, 10141, 220, 198, 198, 40406, 7, 3672, 11639, 9742, 5377, 11141, 3256, 198, 197, 9641, 11639, 16, 13, 15, 3256, 198...
2.86036
222
"""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"}}}
[ 37811, 9171, 14706, 46613, 329, 8811, 973, 26286, 526, 15931, 628, 198, 18302, 1039, 796, 1391, 198, 220, 220, 220, 220, 220, 220, 220, 7721, 1058, 19779, 2025, 265, 22545, 17718, 1298, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220...
1.832138
697
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.')
[ 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 11748, 33918, 628, 198, 10459, 796, 1280, 10786, 6494, 12, 10459, 13, 6494, 3256, 21004, 2625, 40477, 23, 11074, 961, 3419, 198, 82, 10486, 796, 23762, 50, 10486, 7, 10459, 11, 705, 6494...
2.58908
348
# . # . 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)
[ 2, 220, 764, 201, 198, 2, 220, 220, 220, 220, 220, 764, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 11748, 28686, 201, 198, 11748, 3689, 355, 2172, 201, 198, 11748, 4818, 8079, 201, 198, 6738, 1341, 35720, 13, 19849, 62, 4928...
2.154098
305
''' 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')
[ 7061, 6, 198, 359, 7230, 1187, 13, 9078, 532, 45205, 286, 617, 3210, 2801, 7230, 1187, 13, 198, 198, 11828, 25, 198, 198, 21478, 7230, 1187, 389, 5444, 45241, 11, 39279, 523, 326, 575, 796, 352, 13, 15, 13, 198, 198, 49738, 45241, ...
2.093419
9,634
import numpy import pandas import hts.hierarchy from hts.functions import ( _create_bl_str_col, get_agg_series, get_hierarchichal_df, to_sum_mat, )
[ 11748, 299, 32152, 198, 11748, 19798, 292, 198, 198, 11748, 289, 912, 13, 71, 959, 9282, 198, 6738, 289, 912, 13, 12543, 2733, 1330, 357, 198, 220, 220, 220, 4808, 17953, 62, 2436, 62, 2536, 62, 4033, 11, 198, 220, 220, 220, 651, ...
2.197531
81
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
[ 11748, 28686, 198, 11748, 14601, 198, 40539, 654, 13, 36439, 24455, 10786, 33770, 11537, 198, 198, 9288, 62, 15908, 796, 28686, 13, 6978, 13, 15908, 3672, 7, 418, 13, 6978, 13, 397, 2777, 776, 7, 834, 7753, 834, 4008, 198, 198, 35, ...
2.139535
301
""" 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()
[ 37811, 198, 5450, 1378, 293, 316, 8189, 13, 785, 14, 1676, 22143, 14, 28463, 12, 33678, 12, 1136, 25120, 12, 78, 16, 14, 198, 198, 3546, 26908, 262, 14534, 1143, 7248, 1398, 25, 198, 198, 30388, 7550, 7, 600, 1188, 8, 35835, 82, 2...
3.508961
558
#!/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 ---"
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 23926, 4770, 25609, 855, 198, 2, 220, 15069, 357, 66, 8, 3717, 21702, 893, 11419, 13, 4307, 6169, 739, 262, 19835, 10442, 13789, 11, 10628, 352, 13, 15, 13, 220, 198, 2, 220, 35...
2.954861
288
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
[ 11748, 4451, 21760, 198, 2, 422, 4451, 21760, 13, 5796, 5889, 25473, 1330, 4713, 62, 27184, 198, 6738, 764, 834, 27004, 10141, 1330, 10880, 10141, 10267, 11, 1895, 62, 46170, 11, 9394, 24615, 12331, 198, 6738, 764, 774, 9124, 62, 4868, ...
3.365854
123
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 628, 198, 2, 4806, 430, 198, 6738, 13103, 13, 28710, 13, 10745, 6410, 13, 6404, 1330, 5972, 1362, 10707, 273, 1352, 11, 9485, 11187, 1362, 16177, 198, 2, 15678, 198, 6738, ...
3.856322
174
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()
[ 11748, 33918, 198, 11748, 18931, 198, 11748, 555, 715, 395, 198, 6738, 19720, 1330, 360, 713, 198, 198, 6738, 6226, 1503, 9711, 36918, 2848, 1330, 19449, 11163, 198, 198, 6738, 909, 292, 1845, 13976, 13, 22766, 62, 37153, 1330, 43301, 1...
2.964539
141
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
[ 11748, 640, 198, 11748, 33918, 198, 11748, 44161, 578, 18, 198, 11748, 28686, 198, 198, 37043, 796, 44161, 578, 18, 13, 8443, 10786, 11250, 82, 14, 38105, 13, 9945, 11537, 198, 66, 796, 48260, 13, 66, 21471, 3419, 198, 198, 9688, 62, ...
2.706767
266
__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
[ 834, 9800, 834, 796, 705, 33, 859, 5719, 29032, 417, 532, 2124, 343, 844, 528, 6, 198, 834, 9800, 62, 12888, 834, 796, 705, 2777, 321, 31, 15763, 25135, 89, 13, 785, 6, 198, 834, 43085, 834, 796, 705, 36393, 6, 198, 834, 76, 291...
2.387597
129
''' ''' 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
[ 7061, 6, 201, 198, 201, 198, 7061, 6, 201, 198, 201, 198, 11748, 11845, 201, 198, 6738, 4818, 8079, 1330, 3128, 11, 4818, 8079, 11, 28805, 12514, 201, 198, 6738, 19720, 1330, 40806, 1352, 201, 198, 6738, 6516, 10951, 1330, 13035, 1236...
1.881279
2,190
import argparse import logging log = logging.getLogger(__name__)
[ 11748, 1822, 29572, 198, 11748, 18931, 198, 198, 6404, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628, 198 ]
3.090909
22
#!/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
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 37219, 284, 47061, 532, 27254, 3270, 405, 532, 8225, 2177, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 8125, 4935, 198, 2, 220, 220, 220, 220, 220, 220, 220, ...
2.507692
195
from flask import render_template, Blueprint hello_blueprint = Blueprint('hello', __name__)
[ 6738, 42903, 1330, 8543, 62, 28243, 11, 39932, 198, 198, 31373, 62, 17585, 4798, 796, 39932, 10786, 31373, 3256, 11593, 3672, 834, 8, 198 ]
3.875
24
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
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 198, 198, 6738, 1334, 62, 30604, 1330, 3722, 198, 6738, 1334, 62, 30604, 13, 33571, 1330, 3486, 3824, 769, 198, 6738, 1334, 62...
4.101449
69
"""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) ]
[ 37811, 20746, 4823, 20081, 526, 15931, 198, 11748, 302, 198, 198, 6738, 275, 16762, 1330, 16984, 15813, 198, 198, 12261, 51, 796, 16984, 15813, 3419, 628, 198, 4299, 651, 62, 7266, 66, 26129, 7, 22872, 2599, 198, 220, 220, 220, 37227, ...
2.418605
602
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 }
[ 11748, 299, 32152, 198, 198, 34, 62, 18, 796, 299, 32152, 13, 18747, 26933, 16, 11, 362, 12962, 1220, 513, 198, 64, 62, 18, 796, 299, 32152, 13, 18747, 26933, 58, 18, 11, 532, 16, 4357, 685, 16, 11, 352, 11907, 8, 1220, 362, 198...
1.45809
513
from pathlib import Path import shutil import unittest import numpy as np import siml.optimize as optimize import siml.setting as setting
[ 6738, 3108, 8019, 1330, 10644, 198, 11748, 4423, 346, 198, 11748, 555, 715, 395, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 11748, 985, 75, 13, 40085, 1096, 355, 27183, 198, 11748, 985, 75, 13, 33990, 355, 4634, 628 ]
3.525
40
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())
[ 11748, 30351, 952, 198, 11748, 18931, 198, 11748, 28686, 198, 198, 11748, 2240, 77, 549, 198, 198, 6738, 410, 452, 600, 9078, 13, 23317, 1330, 10781, 198, 6738, 410, 452, 600, 9078, 13, 42034, 1330, 25313, 600, 24728, 198, 6738, 410, ...
2.90625
128
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.
[ 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 19816, 1040, 1330, 23093, 37374, 35608, 259, 201, 198, 6738, 42625, 14208, 13, 4023, 13, 26209, 1330, 367, 29281, 31077, 7738, 1060, 11, 367, 29281, 31077, 22069, 18453, 201, 198, 6738, ...
2.919048
210
# 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()
[ 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 807, 3459, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 22...
1.962852
13,971
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
[ 6738, 19720, 1330, 7343, 11, 360, 713, 198, 6738, 12972, 71, 565, 13, 343, 13, 9319, 62, 343, 1330, 1635, 198, 6738, 12972, 71, 565, 13, 343, 13, 9319, 62, 19795, 1330, 1635, 198, 6738, 12972, 71, 565, 13, 6603, 274, 13557, 6603, ...
2.670588
85
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)
[ 11748, 18931, 198, 11748, 640, 198, 11748, 28686, 198, 198, 9148, 8120, 11, 23848, 11, 47606, 11, 575, 23304, 3913, 11, 9878, 8924, 11, 28263, 3525, 32, 11, 30440, 1565, 11, 44925, 796, 2837, 7, 23, 8, 198, 198, 18982, 796, 36521, 7...
2.536638
464
from ethereum import tester as t from ethereum import utils if __name__ == '__main__': test()
[ 6738, 304, 17733, 1330, 256, 7834, 355, 256, 198, 6738, 304, 17733, 1330, 3384, 4487, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1332, 3419, 198 ]
2.911765
34
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
[ 11748, 28034, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 9195, 88, 2271, 13, 4703, 26791, 13, 85, 528, 17, 67, 1330, 38350, 62, 73, 1563, 82, 62, 17, 67, 198, 198, 6738, 19609, 2301, 13, 19608, 292, 1039, 13, 421, 10640, 1330, ...
3.193548
62
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
[ 6738, 3049, 15042, 1330, 2129, 2412, 11, 14626, 16922, 11, 10644, 11, 3722, 198, 6738, 279, 5173, 5109, 1330, 471, 27586, 19, 198, 198, 6738, 40391, 13, 45841, 3976, 13, 48806, 1330, 651, 62, 260, 1930, 37765, 198, 6738, 20613, 13, 48...
3.927632
152
# 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']), }
[ 2, 15069, 357, 66, 8, 2177, 383, 5311, 1313, 418, 4912, 3457, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, ...
2.287057
4,257
import unittest from payroll import * if __name__ == '__main__': unittest.main()
[ 11748, 555, 715, 395, 198, 6738, 22235, 1330, 1635, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 555, 715, 395, 13, 12417, 3419 ]
2.741935
31
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 201, 198, 11748, 640, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 6738, 629, 541, 88, 1330, 39555, 378, 201, 198, 11748, 6468, 28338, 13, 41667, 355, 334, 201, 198, ...
2.724138
145
# Copyright 2017-2020 Palantir Technologies, Inc. # Copyright 2021- Python Language Server Contributors. import logging from pylsp import hookimpl, _utils log = logging.getLogger(__name__)
[ 2, 15069, 2177, 12, 42334, 3175, 415, 343, 21852, 11, 3457, 13, 198, 2, 15069, 33448, 12, 11361, 15417, 9652, 25767, 669, 13, 198, 198, 11748, 18931, 198, 198, 6738, 279, 2645, 2777, 1330, 8011, 23928, 11, 4808, 26791, 198, 198, 6404,...
3.574074
54
# -*- 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)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 3709, 628, 198, 220, 220, 220, 825, 3551, 62, 2302, 3004, 62, 14269, 2569, 7, 944, 11, 6808, 62, 15908, 62, 9186, 2599, 198, 220, 220, 220, 220, 220, 220...
1.722107
1,936
import numpy as np
[ 11748, 299, 32152, 355, 45941, 628, 628, 220, 220, 220, 220, 198, 220, 220, 220, 220, 198 ]
1.882353
17
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)
[ 11748, 42903, 198, 11748, 5735, 13645, 198, 11748, 2456, 198, 6738, 16605, 24330, 1330, 3440, 62, 26518, 24330, 628, 198, 2220, 62, 26518, 24330, 3419, 198, 1324, 796, 42903, 13, 7414, 2093, 7, 834, 3672, 834, 8, 198, 13645, 796, 5735, ...
2.666667
165
""" 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
[ 37811, 198, 220, 220, 220, 300, 14259, 20786, 11, 257, 4947, 286, 569, 499, 454, 29934, 400, 5499, 290, 7917, 11799, 3194, 290, 14, 273, 9518, 416, 4401, 3163, 8516, 6369, 36, 13, 628, 220, 220, 220, 1002, 345, 4136, 597, 2428, 11, ...
2.909574
188
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")
[ 47119, 62, 11600, 796, 1391, 198, 1, 40, 1, 1058, 352, 11, 198, 1, 53, 1, 1058, 642, 11, 198, 1, 55, 1, 1058, 838, 11, 198, 1, 43, 1, 1058, 2026, 11, 198, 1, 34, 1, 1058, 1802, 11, 198, 1, 35, 1, 1058, 5323, 11, 198, 1, ...
1.94382
89
""" 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
[ 37811, 198, 36393, 13789, 198, 198, 15269, 357, 66, 8, 13130, 314, 335, 2238, 6502, 198, 198, 5990, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 257, 4866, 198, 1659, 428, 3788, 290, 3917, 10314, 3696, 357, ...
3.757962
314
import abc import logging from typing import List from ee.models import EnvironmentDefinition logger = logging.getLogger(__name__)
[ 11748, 450, 66, 198, 11748, 18931, 198, 6738, 19720, 1330, 7343, 198, 198, 6738, 304, 68, 13, 27530, 1330, 9344, 36621, 198, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 628 ]
3.621622
37
#! /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()
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 686, 2777, 88, 198, 11748, 25064, 198, 11748, 4866, 198, 11748, 1445, 270, 62, 9503, 4066, 198, 11748, 1445, 270, 62, 907, 14542, 13, 19662, 198, 11748, 22939, 62, 907, ...
2.753623
69
# -*- 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)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 38, 396, 11525, 12083, 13877, 329, 12903, 7490, 198, 10052, 28, 198, 198, 1212, 13877, 3578, 345, 284, 11525, 4600, 38, 1023, 63, 62, 656, 534, 6851, 13, 1...
2.308352
1,748
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)))
[ 11748, 640, 198, 6738, 17802, 1330, 1635, 198, 11748, 25064, 628, 198, 4774, 796, 25064, 13, 853, 85, 58, 16, 60, 198, 2, 634, 796, 25064, 13, 853, 85, 58, 17, 60, 198, 2, 20500, 796, 25064, 13, 853, 85, 58, 17, 60, 198, 198, ...
2.501053
475
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
[ 24376, 24376, 24376, 24376, 24376, 43145, 198, 24376, 24376, 24376, 24376, 24376, 43145, 198, 24376, 24376, 24376, 24376, 24376, 43145, 198, 198, 24376, 1395, 24376, 43145, 1395, 24376, 43145, 27713, 1395, 24376, 24376, 1395, 24376, 43145, 2771...
2.573363
10,414
""" 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))
[ 37811, 198, 32, 4226, 326, 9743, 257, 2393, 422, 262, 3992, 290, 220, 198, 7783, 82, 262, 477, 262, 2456, 1719, 8373, 287, 1022, 734, 2456, 3804, 198, 37811, 198, 198, 11748, 302, 198, 6738, 299, 2528, 74, 13, 10215, 79, 385, 1330, ...
2.859259
135
# 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
[ 2, 49962, 284, 262, 24843, 10442, 5693, 357, 1921, 37, 8, 739, 530, 198, 2, 393, 517, 18920, 5964, 11704, 13, 220, 4091, 262, 28536, 2393, 198, 2, 9387, 351, 428, 670, 329, 3224, 1321, 198, 2, 5115, 6634, 9238, 13, 220, 383, 7054,...
3.041841
717
#!/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)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 198, 198, 11748, 1822, 29572, 198, 11748, 269, 19199, 198, 11748, 33918, 198, 11748, 25064, 198, 198, 361, 407, 705, 492, 6, 287, 25064, 13, 6978, 25, 198, 220, 220, 220, 25064, 13, 6978, 13...
2.424947
1,892
""" 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()
[ 37811, 198, 35, 2690, 1387, 4823, 25, 26439, 6605, 4522, 1672, 198, 44627, 44627, 14030, 4880, 198, 198, 1212, 1672, 15687, 1895, 284, 262, 16726, 4522, 357, 10508, 355, 2134, 11, 2587, 11, 3503, 2014, 1181, 422, 198, 272, 2656, 4522, ...
4.010753
93
# 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})
[ 2, 29566, 25, 12260, 198, 2, 720, 21015, 1104, 14, 8612, 378, 13, 9078, 198, 2, 379, 266, 457, 14, 929, 9526, 12, 259, 22390, 12, 8897, 3558, 11757, 198, 2, 198, 2, 5740, 25, 2773, 5254, 357, 8726, 12, 929, 9526, 13, 7266, 13, ...
2.780892
785
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)
[ 6738, 1257, 310, 10141, 1330, 13027, 198, 198, 6738, 764, 15791, 602, 1330, 39523, 198, 6738, 764, 3262, 1330, 3433, 628, 198, 834, 439, 834, 796, 37250, 36802, 411, 3262, 62, 17143, 7307, 3256, 705, 36802, 411, 3262, 2682, 3256, 705, ...
2.683544
158
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()
[ 11748, 28686, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 545, 903, 1501, 13, 4625, 62, 37687, 11347, 1330, 14534, 9203, 16305, 20053, 198, 198, 6738, 4732, 8019, 1330, 4732, 37153, 198, 11748, 26692, 22602, 198, 11748, 640, 628, 6...
3.403226
62
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
[ 11748, 555, 715, 395, 198, 11748, 599, 5173, 81, 3262, 355, 264, 32656, 628, 198, 220, 220, 220, 825, 1332, 62, 646, 489, 5344, 62, 46758, 62, 68, 3639, 7, 944, 2599, 198, 220, 220, 220, 220, 220, 220, 220, 825, 16, 796, 2116, 1...
1.9317
1,347
# 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)
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 15069, 2864, 383, 24958, 12, 10262, 658, 46665, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, ...
2.744186
1,118
import pygame as pg pg.init() from src.main import Main main = Main()
[ 11748, 12972, 6057, 355, 23241, 198, 6024, 13, 15003, 3419, 198, 198, 6738, 12351, 13, 12417, 1330, 8774, 198, 12417, 796, 8774, 3419, 628 ]
3
24
import frappe
[ 11748, 5306, 27768 ]
4.333333
3
#!/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))
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 279, 2645, 600, 25, 15560, 28, 45688, 12, 15390, 8841, 11, 259, 12102, 12, 3672, 11, 36654, 12, 16341, 11, 3846, 12, 7785, 12, 6738, 12, 26268, 198, 198, 11748, 12234, ...
1.813837
2,197
import os # from signal import pause from gpiozero import Button from datetime import datetime take_screen()
[ 11748, 28686, 198, 2, 422, 6737, 1330, 14985, 198, 6738, 27809, 952, 22570, 1330, 20969, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 220, 220, 220, 220, 198, 198, 20657, 62, 9612, 3419, 220, 220, 220, 220, 198, 220, 220, 220, 220 ]
2.928571
42
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)}")
[ 11748, 2219, 201, 198, 201, 198, 6615, 796, 2219, 13, 1136, 62, 6615, 10786, 820, 2481, 62, 7890, 13, 14116, 11537, 201, 198, 201, 198, 19425, 62, 11600, 796, 23884, 201, 198, 439, 62, 278, 23320, 796, 17635, 201, 198, 1640, 1627, 2...
2.242188
640
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 31, 9800, 25, 21970, 198, 37811, 198, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 384, 397, 1211, 355, 3013, 82, 198, 11748, ...
3.204301
93
#!/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", ], )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 7575, 220, 220, 220, 1058, 2864, 14, 1157, 14, 1238, 807, 25, 1314, 198, 2, 2488, 13838, 220, 1058, 36876, ...
2.498024
506
# 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
[ 2, 15069, 12131, 383, 10169, 14961, 1008, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846...
3.578313
249
# -*- 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"
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 11748, 33918, 198, 6738, 19720, 1330, 7343, 11, 32233, 198, 198, 6738, 42903, 1330, 787, 62, 26209, 198, 198, 834, 9800, 834, 796, 366, 50, 918, 402, 1765, 4835, 1, 19...
2.73
100
import avalon.api
[ 198, 11748, 37441, 261, 13, 15042, 628 ]
2.857143
7
import logging import gpg from rest_framework import serializers from .conf import settings from . import models logger = logging.getLogger(__name__)
[ 11748, 18931, 198, 11748, 308, 6024, 198, 6738, 1334, 62, 30604, 1330, 11389, 11341, 198, 198, 6738, 764, 10414, 1330, 6460, 198, 6738, 764, 1330, 4981, 628, 198, 6404, 1362, 796, 18931, 13, 1136, 11187, 1362, 7, 834, 3672, 834, 8, 62...
3.521739
46
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'])
[ 6738, 42903, 1330, 357, 198, 220, 220, 220, 39932, 11, 7644, 11, 308, 11, 18941, 11, 8543, 62, 28243, 11, 651, 62, 28243, 62, 42348, 11, 2581, 11, 19016, 62, 1640, 11, 33918, 1958, 198, 8, 198, 2, 6738, 19424, 19608, 499, 305, 919...
2.526829
1,435
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
[ 11748, 10688, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 198, 6738, 28034, 1330, 299, 77, 198, 6738, 28034, 13, 1891, 2412, 1330, 269, 463, 20471, 198, 6738, 28034, 13, 26791, 13, 7890, 1330, 6060, 17401, 198, 6738, 256...
3.342857
70
#!/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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 640, 198, 11748, 4738, 198, 11748, 10688, 198, 11748, 555, 715, 395, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 14367, 62, 907, 1...
2.084671
3,177
# 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
[ 2, 770, 318, 257, 1171, 25745, 11, 523, 356, 836, 470, 765, 284, 15651, 597, 1729, 12, 41116, 66, 1850, 198, 2, 12608, 326, 3588, 470, 1682, 636, 286, 674, 1171, 7824, 13, 887, 340, 338, 845, 198, 2, 15774, 284, 7773, 1464, 779, ...
1.959954
5,244
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
[ 11748, 12972, 9288, 198, 198, 6738, 288, 18, 45895, 9078, 13, 27530, 13, 13165, 354, 13, 12685, 375, 364, 1330, 11349, 27195, 12342, 198, 6738, 288, 18, 45895, 9078, 13, 27530, 13, 13165, 354, 13, 12685, 375, 364, 1330, 11349, 27195, ...
3.014925
134
# -*- 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()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 11748, 983, 198, 6738, 15095, 1330, 15095, 198, 7753, 16, 796, 15095, 7203, 486, 62, 2550, 62, 19608, 292, 316, 13, 9078, 4943, 198, 7753, 17, 796, 15095, 7203, 299...
2.140488
1,025
from transformers import ( RobertaModel, RobertaPreTrainedModel, BertModel, BertPreTrainedModel, )
[ 6738, 6121, 364, 1330, 357, 198, 220, 220, 220, 5199, 64, 17633, 11, 198, 220, 220, 220, 5199, 64, 6719, 2898, 1328, 17633, 11, 198, 220, 220, 220, 22108, 17633, 11, 198, 220, 220, 220, 22108, 6719, 2898, 1328, 17633, 11, 198, 8, ...
2.6
45
#!/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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 2, 17168, 13789, 198, 2, 198, 2, 15069, 357, 66, 8, 33160, 20665, 268, 952, 2547, 23130, 1279, 344, 535, 404, 959, 648, 1669, 494, 42740, 952, 5161, 23645, 4529, 42743, 401,...
2.97807
1,140
# 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
[ 2, 770, 360, 4760, 318, 329, 2491, 21015, 14750, 284, 7716, 9037, 5874, 5612, 1366, 198, 2, 422, 6171, 310, 722, 790, 1227, 886, 198, 198, 11748, 45771, 198, 6738, 45771, 1330, 360, 4760, 198, 198, 6738, 45771, 13, 3575, 2024, 13, 4...
2.662462
1,665
from nadl.tensor import Tensor from nadl.parameter import Parameter
[ 6738, 299, 324, 75, 13, 83, 22854, 1330, 309, 22854, 198, 6738, 299, 324, 75, 13, 17143, 2357, 1330, 25139, 2357 ]
3.190476
21
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> """]
[ 7753, 62, 1640, 23442, 62, 28712, 796, 14631, 15931, 27, 0, 18227, 4177, 56, 11401, 27711, 29, 201, 198, 27, 6494, 29, 201, 198, 201, 198, 27, 2256, 29, 201, 198, 220, 220, 220, 1279, 7839, 12240, 7839, 29, 201, 198, 220, 220, 220...
1.776747
17,039
import icalendar import urllib2 import hashlib import string import re import datetime from database import Database, TableHandler
[ 11748, 220, 605, 9239, 198, 11748, 2956, 297, 571, 17, 198, 11748, 12234, 8019, 198, 11748, 4731, 198, 11748, 302, 198, 11748, 4818, 8079, 198, 6738, 6831, 1330, 24047, 11, 8655, 25060, 198 ]
3.969697
33
############################################################################## # # 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' )
[ 29113, 29113, 7804, 4242, 2235, 198, 2, 198, 2, 15069, 357, 66, 8, 6244, 1168, 3008, 5693, 290, 25767, 669, 13, 198, 2, 198, 2, 770, 3788, 318, 2426, 284, 262, 8617, 286, 262, 1168, 3008, 5094, 13789, 11, 198, 2, 10628, 362, 13, ...
2.810167
1,554
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]
[ 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1303, 15763, 796, 685, 19, 11, 17, 11, 22, 11, 16, 11, 18, ...
2.041885
191
import subprocess import os import numpy as np import pandas as pd from datetime import datetime if __name__ == '__main__': store_relational_JH_data()
[ 11748, 850, 14681, 198, 11748, 28686, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, ...
2.907407
54
# 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()
[ 2, 11361, 513, 198, 198, 11748, 25064, 198, 11748, 37037, 18497, 198, 6738, 2638, 13, 15388, 1330, 17427, 40717, 18453, 25060, 628, 198, 2, 11361, 513, 13, 22, 13, 20, 6673, 287, 262, 5313, 49670, 6343, 5994, 13, 1002, 428, 318, 281, ...
2.775956
183
import pygame import sys import os from pygame.locals import *
[ 198, 11748, 12972, 6057, 198, 11748, 25064, 198, 11748, 28686, 198, 6738, 12972, 6057, 13, 17946, 874, 1330, 1635, 628 ]
3.25
20
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)
[ 6738, 42903, 1330, 46947, 11, 2581, 11, 33918, 1958, 11, 8543, 62, 28243, 62, 8841, 198, 11748, 2266, 271, 198, 11748, 7007, 198, 11748, 302, 198, 11748, 33918, 198, 11748, 25064, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 628, 198,...
2.881579
76
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)
[ 198, 11748, 7007, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 11748, 33918, 198, 11748, 279, 4798, 198, 198, 6371, 796, 705, 5450, 1378, 2503, 13, 15630, 77, 13, 565, 14, 13396, 270, 14, 21426, 9509, 6864, 14, 9630, 13, 192...
2.309478
517
#################################################### # (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
[ 29113, 14468, 4242, 198, 2, 357, 34, 8, 2940, 833, 10957, 11, 1584, 11, 1439, 6923, 33876, 198, 2, 198, 2, 9220, 6530, 25, 598, 13, 9078, 198, 2, 198, 2, 21582, 7536, 25, 2579, 12, 1065, 12, 5304, 198, 2, 198, 2, 15622, 2750, ...
3.988889
90
#!/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"])] )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 198, 198, 40406, 7, 3672, 11639, 4871, 2649, 12, 3820, 1008, 3256, 198, 220, 220, 220, 220, 220, 2196, 11639, 16, 13, 1...
2.612903
186
from synapyse.base.activation_functions.activation_function import ActivationFunction __author__ = 'Douglas Eric Fonseca Rodrigues'
[ 6738, 6171, 12826, 325, 13, 8692, 13, 48545, 62, 12543, 2733, 13, 48545, 62, 8818, 1330, 13144, 341, 22203, 198, 198, 834, 9800, 834, 796, 705, 40287, 14391, 7651, 376, 261, 2363, 64, 16114, 947, 6, 198 ]
3.594595
37
#check description from bs4 import BeautifulSoup import lxml.html
[ 2, 9122, 6764, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 11748, 300, 19875, 13, 6494, 198 ]
3.473684
19
import re from backend.projectfiles.GenericProjectFile import GenericProjectFile QUOTE = r'(?:["|\'])' STRING = r'([\w\.\-\+]+)' GAV_REGEXP = QUOTE + '(?:' + ":".join([STRING, STRING, STRING]) + ')' + QUOTE
[ 11748, 302, 198, 198, 6738, 30203, 13, 16302, 16624, 13, 46189, 16775, 8979, 1330, 42044, 16775, 8979, 628, 198, 10917, 23051, 796, 374, 6, 7, 27514, 14692, 91, 43054, 12962, 6, 198, 18601, 2751, 796, 374, 6, 26933, 59, 86, 17405, 414...
2.554217
83
"""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 )
[ 37811, 16281, 2438, 329, 33332, 257, 2060, 20831, 1767, 22942, 656, 47759, 422, 257, 13123, 270, 39638, 44189, 2393, 13, 198, 198, 15269, 357, 66, 8, 1584, 11, 7164, 400, 1168, 1533, 2815, 13, 220, 1439, 2489, 10395, 13, 49962, 739, 2...
3.045381
617
#!/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()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 201, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 201, 198, 37811, 201, 198, 1212, 6306, 373, 2727, 1262, 38955, 20519, 18, 29544, 35869, 357, 85, 42334, 13, 16, 13, 1...
2.458274
36,919
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)
[ 6738, 2644, 66, 70, 1330, 355, 33383, 355, 279, 33383, 198, 6738, 2644, 11321, 1330, 4433, 355, 4808, 47911, 198, 6738, 14601, 1330, 9828, 198, 198, 4299, 7550, 62, 38993, 7, 7568, 11, 26181, 11, 1438, 28, 14202, 11, 287, 5372, 28, ...
2.315407
688
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()), ]
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 198, 6738, 20542, 46331, 62, 15042, 13, 33571, 1330, 3060, 39286, 12360, 26257, 11, 17220, 39286, 12360, 26257, 198, 198, 1324, 62, 3672, 796, 705, 1929, 270, 46331, 62, 15042, 6, 198, ...
2.786408
103
# -*- 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
[ 2, 532, 9, 12, 19617, 25, 40477, 12, 23, 532, 9, 12, 198, 198, 2, 15069, 357, 34, 8, 12131, 13, 43208, 21852, 1766, 1539, 12052, 13, 1439, 2489, 10395, 13, 198, 2, 770, 1430, 318, 1479, 3788, 26, 345, 460, 17678, 4163, 340, 290,...
2.819847
655
from Stack import Stack main()
[ 6738, 23881, 1330, 23881, 628, 198, 198, 12417, 3419 ]
3.666667
9
__version__ = '0.3.2' # noinspection PyUnresolvedReferences from ._cache._cache import cache # noinspection PyUnresolvedReferences from ._scheduler._scheduler import add_schedule, schedule, ScheduleSubscription
[ 834, 9641, 834, 796, 705, 15, 13, 18, 13, 17, 6, 198, 198, 2, 645, 1040, 14978, 9485, 3118, 411, 5634, 19927, 198, 6738, 47540, 23870, 13557, 23870, 1330, 12940, 198, 2, 645, 1040, 14978, 9485, 3118, 411, 5634, 19927, 198, 6738, 475...
3.419355
62
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
[ 11748, 299, 32152, 355, 45941, 198, 11748, 12972, 9288, 198, 6738, 19798, 292, 13, 7295, 13, 14535, 1330, 6060, 19778, 198, 198, 6738, 275, 2194, 13, 320, 1819, 1010, 1330, 6060, 3546, 1819, 1010, 198, 6738, 275, 2194, 13, 19849, 62, ...
3.336735
98