content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
import json import os import sys from datetime import date import pytest from dateutil.relativedelta import relativedelta from telegram_bot_calendar import DAY, MONTH, YEAR from telegram_bot_calendar.detailed import DetailedTelegramCalendar, NOTHING myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') # todo: fix this test to properly check generated keyboard
[ 11748, 33918, 198, 11748, 28686, 198, 11748, 25064, 198, 6738, 4818, 8079, 1330, 3128, 198, 198, 11748, 12972, 9288, 198, 6738, 3128, 22602, 13, 2411, 265, 1572, 12514, 1330, 48993, 1572, 12514, 198, 198, 6738, 573, 30536, 62, 13645, 62, ...
3.198413
126
import collections import types from optparse import make_option from django.db.models.loading import get_model from django.core.management.base import BaseCommand, CommandError from django.db.models.fields import EmailField, URLField, BooleanField, TextField bs_form = """\ <form role="form" class="form-horizontal"> %s\ <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button class="btn btn-primary"><i class="fa fa-save"></i> Save</button> </div> </div> </form> """ bs_field = """\ <div class="form-group"> <label for="%(id)s" class="col-sm-2 control-label">%(label)s</label> <div class="col-sm-10"> %(field)s%(error)s </div> </div> """ bs_input = """\ <input type="%(input_type)s" %(name_attr)s="%(name)s"%(class)s id="%(id)s"%(extra)s/>""" bs_select = """\ <select %(name_attr)s="%(name)s" class="form-control" id="%(id)s"%(extra)s>%(options)s </select>""" bs_option = """ <option value="%(value)s">%(label)s</option>""" optgroup = """ <optgroup label="%(label)s">%(options)s </optgroup>""" bs_textarea = """\ <textarea %(name_attr)s="%(name)s" class="form-control" id="%(id)s"%(extra)s></textarea>""" react_error = """ {errors.%(name)s}"""
[ 11748, 17268, 198, 11748, 3858, 198, 6738, 2172, 29572, 1330, 787, 62, 18076, 198, 6738, 42625, 14208, 13, 9945, 13, 27530, 13, 25138, 1330, 651, 62, 19849, 198, 6738, 42625, 14208, 13, 7295, 13, 27604, 13, 8692, 1330, 7308, 21575, 11, ...
2.321691
544
"""Gives users direct access to class and functions.""" from logical.logical import\ logical,\ nullary, unary, binary, every,\ nf_, nt_,\ uf_, id_, not_, ut_,\ bf_,\ and_, nimp_, fst_, nif_, snd_, xor_, or_,\ nor_, xnor_, nsnd_, if_, nfst_, imp_, nand_,\ bt_
[ 37811, 38, 1083, 2985, 1277, 1895, 284, 1398, 290, 5499, 526, 15931, 198, 6738, 12219, 13, 6404, 605, 1330, 59, 198, 220, 220, 220, 12219, 11, 59, 198, 220, 220, 220, 9242, 560, 11, 555, 560, 11, 13934, 11, 790, 11, 59, 198, 220, ...
1.914474
152
import queue import select import socket server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setblocking(False) server.bind(('localhost', 9999)) server.listen(5) inputs = [server] outputs = [] message_queues = {} while inputs: readable, writable, exceptional = select.select( inputs, outputs, inputs) for s in readable: if s is server: connection, client_address = s.accept() connection.setblocking(0) inputs.append(connection) message_queues[connection] = queue.Queue() else: data = s.recv(1024) if data: message_queues[s].put(data) if s not in outputs: outputs.append(s) else: if s in outputs: outputs.remove(s) inputs.remove(s) s.close() del message_queues[s] for s in writable: try: next_msg = message_queues[s].get_nowait() except queue.Empty: outputs.remove(s) else: s.send(next_msg) for s in exceptional: inputs.remove(s) if s in outputs: outputs.remove(s) s.close() del message_queues[s] # import socket # # server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # server.bind(('localhost', 9999)) # server.listen(1) # while True: # client_socket, addr = server.accept() # print(f'New connection from {addr}') # client_socket.send('Hello there, how are you?'.encode('utf-8')) # answer = client_socket.recv(1024) # print(answer) # client_socket.close()
[ 11748, 16834, 198, 11748, 2922, 198, 11748, 17802, 198, 198, 15388, 796, 17802, 13, 44971, 7, 44971, 13, 8579, 62, 1268, 2767, 11, 17802, 13, 50, 11290, 62, 2257, 32235, 8, 198, 15388, 13, 2617, 41938, 7, 25101, 8, 198, 15388, 13, 2...
2.063119
808
from .segmentA import SegmentA
[ 6738, 764, 325, 5154, 32, 1330, 1001, 5154, 32, 628 ]
3.2
10
#!/usr/bin/python import sys import codecs import ipaddress as ip import pandas as pd from datetime import datetime as dt if __name__ == "__main__": sys.exit(main(sys.argv))
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 198, 11748, 25064, 198, 11748, 40481, 82, 198, 198, 11748, 20966, 21975, 355, 20966, 198, 11748, 19798, 292, 355, 279, 67, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 355, 288, 83, 628, 628...
2.681159
69
# simple_checkboxes.py import logging from os.path import basename from pathlib import Path import jsonschema import pytest # from reportlab.pdfbase import pdfform import yaml from reportlab.pdfgen import canvas uischema = yaml.safe_load(Path("jsonforms-react-seed/src/uischema.json").read_text()) form_schema = yaml.safe_load(Path("jsonforms-react-seed/src/schema.json").read_text()) form_fields = jsonschema.RefResolver.from_schema(form_schema) log = logging.getLogger() logging.basicConfig(level=logging.DEBUG) DATA = { "name": "foo", "description": "Confirm if you have passed the subject\nHereby ...", "done": True, "recurrence": "Daily", "rating": "3", "due_date": "2020-05-21", "recurrence_interval": 421, }
[ 2, 2829, 62, 9122, 29305, 13, 9078, 198, 11748, 18931, 198, 6738, 28686, 13, 6978, 1330, 1615, 12453, 198, 6738, 3108, 8019, 1330, 10644, 198, 198, 11748, 44804, 684, 2395, 2611, 198, 11748, 12972, 9288, 198, 198, 2, 422, 989, 23912, ...
2.707143
280
''' Assuming the following tag-separated format: VBP+RB VBP VBZ+RB VBZ IN+DT IN (etc.) '''
[ 198, 198, 7061, 6, 198, 48142, 262, 1708, 7621, 12, 25512, 515, 5794, 25, 198, 53, 20866, 10, 27912, 197, 53, 20866, 198, 44526, 57, 10, 27912, 197, 44526, 57, 198, 1268, 10, 24544, 197, 1268, 198, 7, 14784, 2014, 198, 7061, 6 ]
2.139535
43
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Functions to represent potentially large integers as the shortest possible human-readable and writable strings. The motivation is to be able to take int ids as produced by an :class:`zc.intid.IIntId` utility and produce something that can be written down and typed in by a human. To this end, the strings produced have to be: * One-to-one and onto the integer domain; * As short as possible; * While not being easily confused; * Or accidentaly permuted To meet those goals, we define an alphabet consisting of the ASCII digits and upper and lowercase letters, leaving out troublesome pairs (zero and upper and lower oh and upper queue, one and upper and lower ell) (actually, those troublesome pairs will all map to the same character). We also put a version marker at the end of the string so we can evolve this algorithm gracefully but still honor codes in the wild. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function __all__ = [ 'to_external_string', 'from_external_string', ] # stdlib imports import string try: maketrans = str.maketrans except AttributeError: # Python 2 from string import maketrans # pylint:disable=no-name-in-module translate = str.translate # In the first version of the protocol, the version marker, which would # come at the end, is always omitted. Subsequent versions will append # a value that cannot be produced from the _VOCABULARY _VERSION = '$' # First, our vocabulary. # Remove the letter values o and O, Q (confused with O if you're sloppy), l and L, # and i and I, leaving the digits 1 and 0 _REMOVED = 'oOQlLiI' _REPLACE = '0001111' _VOCABULARY = ''.join( reversed(sorted(list(set(string.ascii_letters + string.digits) - set(_REMOVED)))) ) # We translate the letters we removed _TRANSTABLE = maketrans(_REMOVED, _REPLACE) # Leaving us a base vocabulary to map integers into _BASE = len(_VOCABULARY) _ZERO_MARKER = '@' # Zero is special def from_external_string(key): """ Turn the string in *key* into an integer. >>> from nti.externalization.integer_strings import from_external_string >>> from_external_string('xkr') 6773 :param str key: A native string, as produced by `to_external_string`. (On Python 2, unicode *keys* are also valid.) :raises ValueError: If the key is invalid or contains illegal characters. :raises UnicodeDecodeError: If the key is a Unicode object, and contains non-ASCII characters (which wouldn't be valid anyway) """ if not key: raise ValueError("Improper key") if not isinstance(key, str): # Unicode keys cause problems on Python 2: The _TRANSTABLE is coerced # to Unicode, which fails because it contains non-ASCII values. # So instead, we encode the unicode string to ascii, which, if it is a # valid key, will work key = key.decode('ascii') if isinstance(key, bytes) else key.encode('ascii') # strip the version if needed key = key[:-1] if key[-1] == _VERSION else key key = translate(key, _TRANSTABLE) # translate bad chars if key == _ZERO_MARKER: return 0 int_sum = 0 for idx, char in enumerate(reversed(key)): int_sum += _VOCABULARY.index(char) * pow(_BASE, idx) return int_sum def to_external_string(integer): """ Turn an integer into a native string representation. >>> from nti.externalization.integer_strings import to_external_string >>> to_external_string(123) 'xk' >>> to_external_string(123456789) 'kVxr5' """ # we won't step into the while if integer is 0 # so we just solve for that case here if integer == 0: return _ZERO_MARKER result = '' # Simple string concat benchmarks the fastest for this size data, # among a list and an array.array( 'c' ) while integer > 0: integer, remainder = divmod(integer, _BASE) result = _VOCABULARY[remainder] + result return result
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 24629, 2733, 284, 2380, 6196, 1588, 37014, 355, 262, 35581, 198, 79, 4733, 1692, 12, 46155, 290, 1991, 540,...
2.959094
1,369
#!/usr/bin/python3 import argparse, os from collections import defaultdict from lib.data import * from lib.exporters import * from lib.filters import * from lib.parsers import * if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 201, 198, 201, 198, 11748, 1822, 29572, 11, 28686, 201, 198, 201, 198, 6738, 17268, 1330, 4277, 11600, 201, 198, 201, 198, 6738, 9195, 13, 7890, 1330, 1635, 201, 198, 6738, 9195, 13, 1069, 1...
2.674419
86
# -*- coding: utf-8 -*- """Torrent.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1Uo1_KHGxOe_Dh4-DjQyEb0wROp-tMv0w """ TorrName = 'YOUR TORRENT NAME' FolderPath = f'/content/drive/My Drive/{TorrName}' TorrPath = f'{TorrName}.torrent' init() download(FolderPath,TorrPath)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 39286, 13, 541, 2047, 65, 198, 198, 38062, 4142, 7560, 416, 1623, 4820, 2870, 13, 198, 198, 20556, 2393, 318, 5140, 379, 198, 220, 220, 220, 3740, 1378, 4033, 3...
2.296053
152
""" Utilities that help with wrapping various C structures. """
[ 37811, 198, 18274, 2410, 326, 1037, 351, 27074, 2972, 327, 8573, 13, 198, 37811, 198 ]
4.266667
15
import dash_html_components as html
[ 11748, 14470, 62, 6494, 62, 5589, 3906, 355, 27711, 628 ]
3.7
10
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*- import os, os.path as path, shutil import datetime from .file_match import file_match from .file_util import file_util
[ 2, 12, 9, 12, 19617, 25, 40477, 12, 23, 26, 4235, 25, 29412, 26, 33793, 12, 8658, 82, 12, 14171, 25, 18038, 26, 269, 12, 35487, 12, 28968, 25, 362, 26, 7400, 12, 10394, 25, 362, 532, 9, 12, 198, 198, 11748, 28686, 11, 28686, 1...
2.717949
78
import os import argparse from struct import pack from twisted.internet import reactor from twisted.application.reactors import Reactor from twisted.internet.endpoints import HostnameEndpoint from twisted.internet.protocol import ClientFactory from pyrdp.core.ssl import ClientTLSContext from pyrdp.mitm.layerset import RDPLayerSet from pyrdp.mitm.state import RDPMITMState from pyrdp.mitm.config import MITMConfig from pyrdp.layer import LayerChainItem, VirtualChannelLayer, DeviceRedirectionLayer, ClipboardLayer from pyrdp.pdu import MCSAttachUserConfirmPDU, MCSAttachUserRequestPDU, MCSChannelJoinConfirmPDU, \ MCSChannelJoinRequestPDU, MCSConnectInitialPDU, MCSConnectResponsePDU, MCSDisconnectProviderUltimatumPDU, \ MCSDomainParams, MCSErectDomainRequestPDU, MCSSendDataIndicationPDU, MCSSendDataRequestPDU, \ ClientChannelDefinition, PDU, ClientExtraInfo, ClientInfoPDU, DemandActivePDU, MCSSendDataIndicationPDU, \ ShareControlHeader, ConfirmActivePDU, SynchronizePDU, ShareDataHeader, ControlPDU, DeviceRedirectionPDU, \ DeviceListAnnounceRequest, X224DataPDU, NegotiationRequestPDU, NegotiationResponsePDU, X224ConnectionConfirmPDU, \ X224ConnectionRequestPDU, X224DisconnectRequestPDU, X224ErrorPDU, NegotiationFailurePDU, MCSDomainParams, \ ClientDataPDU, GCCConferenceCreateRequestPDU, SlowPathPDU, SetErrorInfoPDU, DeviceRedirectionClientCapabilitiesPDU from pyrdp.enum import NegotiationFailureCode, NegotiationProtocols, EncryptionMethod, ChannelOption, MCSChannelName, \ ParserMode, SegmentationPDUType, ClientInfoFlags, CapabilityType, VirtualChannelCompressionFlag, SlowPathPDUType, \ SlowPathDataType, DeviceRedirectionPacketID, DeviceRedirectionComponent, VirtualChannelPDUFlag from pyrdp.pdu.rdp.negotiation import NegotiationRequestPDU from pyrdp.pdu.rdp.capability import Capability from pyrdp.parser import NegotiationRequestParser, NegotiationResponseParser, ClientConnectionParser, GCCParser, \ ServerConnectionParser from pyrdp.mcs import MCSClientChannel from pyrdp.logging import LOGGER_NAMES, SessionLogger import logging # Hard-coded constant PAYLOAD_HEAD_ADDR = 0xfffffa8008711010 + 0x38 if __name__ == '__main__': main()
[ 11748, 28686, 198, 11748, 1822, 29572, 198, 6738, 2878, 1330, 2353, 198, 198, 6738, 19074, 13, 37675, 1330, 21905, 198, 6738, 19074, 13, 31438, 13, 45018, 669, 1330, 797, 11218, 198, 6738, 19074, 13, 37675, 13, 437, 13033, 1330, 14504, ...
3.317629
658
# # # Copyright (c) 2020. Yue Liu # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # If you find this code useful please cite: # Predicting Annual Equirectangular Panoramic Luminance Maps Using Deep Neural Networks, # Yue Liu, Alex Colburn and and Mehlika Inanici. 16th IBPSA International Conference and Exhibition, Building Simulation 2019. # # # import os import numpy as np from matplotlib import pyplot as plt from deep_light import time_to_sun_angles import shutil from deep_light.genData import get_data_path ####randomly select the test data from the dataset #### TODO make a function with source and destination subdirectoies #finish the rest part
[ 198, 2, 198, 2, 198, 2, 220, 15069, 357, 66, 8, 12131, 13, 220, 32854, 18258, 198, 2, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 220, 345, 743, 407, 779, 428, 2393, 2845, 28...
3.442529
348
#!/usr/bin/env python3 import argparse import sys from concurrent.futures import ThreadPoolExecutor import pandas as pd import altair as alt # Plots application `appname` if __name__ == '__main__': main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 1822, 29572, 198, 11748, 25064, 198, 198, 6738, 24580, 13, 69, 315, 942, 1330, 14122, 27201, 23002, 38409, 198, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 5988, ...
3
71
__version__ = '7'
[ 834, 9641, 834, 796, 705, 22, 6, 198 ]
2.25
8
from rest_framework import generics from rest_framework import filters from bluebottle.utils.permissions import IsAuthenticated, IsOwnerOrReadOnly, IsOwner from rest_framework_json_api.pagination import JsonApiPageNumberPagination from rest_framework_json_api.parsers import JSONParser from rest_framework_json_api.views import AutoPrefetchMixin from rest_framework_jwt.authentication import JSONWebTokenAuthentication from bluebottle.bluebottle_drf2.renderers import BluebottleJSONAPIRenderer from bluebottle.organizations.serializers import ( OrganizationSerializer, OrganizationContactSerializer ) from bluebottle.organizations.models import ( Organization, OrganizationContact )
[ 6738, 1334, 62, 30604, 1330, 1152, 873, 198, 6738, 1334, 62, 30604, 1330, 16628, 198, 198, 6738, 4171, 10985, 293, 13, 26791, 13, 525, 8481, 1330, 1148, 47649, 3474, 11, 1148, 42419, 5574, 5569, 10049, 11, 1148, 42419, 198, 198, 6738, ...
3.642487
193
from gen3_etl.utils.cli import default_argument_parser from gen3_etl.utils.ioutils import JSONEmitter import os import re DEFAULT_OUTPUT_DIR = 'output/default' DEFAULT_EXPERIMENT_CODE = 'default' DEFAULT_PROJECT_ID = 'default-default' def emitter(type=None, output_dir=DEFAULT_OUTPUT_DIR, **kwargs): """Creates a default emitter for type.""" return JSONEmitter(os.path.join(output_dir, '{}.json'.format(type)), compresslevel=0, **kwargs) def path_to_type(path): """Get the type (snakecase) of a vertex file""" return snake_case(os.path.basename(path).split('.')[0]) def snake_case(name): """Converts name to snake_case.""" s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
[ 6738, 2429, 18, 62, 316, 75, 13, 26791, 13, 44506, 1330, 4277, 62, 49140, 62, 48610, 198, 6738, 2429, 18, 62, 316, 75, 13, 26791, 13, 72, 448, 4487, 1330, 19449, 10161, 1967, 198, 11748, 28686, 198, 11748, 302, 198, 198, 7206, 38865...
2.448718
312
import logging import numpy as np from sklearn.utils import check_random_state from csrank.constants import DISCRETE_CHOICE from csrank.dataset_reader.tag_genome_reader import critique_dist from csrank.dataset_reader.util import get_key_for_indices from ..tag_genome_reader import TagGenomeDatasetReader from ...util import convert_to_label_encoding logger = logging.getLogger(__name__)
[ 11748, 18931, 198, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 1341, 35720, 13, 26791, 1330, 2198, 62, 25120, 62, 5219, 198, 198, 6738, 269, 27891, 962, 13, 9979, 1187, 1330, 13954, 43387, 9328, 62, 44899, 8476, 198, 6738, 269, 27891...
3.07874
127
# coding: utf-8 from geoalchemy2 import Geometry from sqlalchemy import BigInteger, Column, DateTime, Float, Integer, SmallInteger, Table, Text, TEXT, BIGINT from sqlalchemy.dialects.postgresql import HSTORE from sqlalchemy.dialects.postgresql import ARRAY from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() metadata = Base.metadata t_osm_line = Table( 'osm_line', metadata, Column('osm_id', BigInteger, index=True), Column('access', Text), Column('addr:city', Text), Column('addr:housenumber', Text), Column('addr:interpolation', Text), Column('addr:place', Text), Column('addr:postcode', Text), Column('addr:street', Text), Column('addr:country', Text), Column('admin_level', Text), Column('aerialway', Text), Column('aeroway', Text), Column('amenity', Text), Column('area', Text), Column('barrier', Text), Column('brand', Text), Column('bridge', Text), Column('boundary', Text), Column('building', Text), Column('bus', Text), Column('contact:phone', Text), Column('cuisine', Text), Column('denomination', Text), Column('drinkable', Text), Column('emergency', Text), Column('entrance', Text), Column('foot', Text), Column('frequency', Text), Column('generator:source', Text), Column('height', Text), Column('highway', Text), Column('historic', Text), Column('information', Text), Column('junction', Text), Column('landuse', Text), Column('layer', Text), Column('leisure', Text), Column('man_made', Text), Column('maxspeed', Text), Column('military', Text), Column('name', Text), Column('int_name', Text), Column('name:en', Text), Column('name:de', Text), Column('name:fr', Text), Column('name:es', Text), Column('natural', Text), Column('office', Text), Column('oneway', Text), Column('opening_hours', Text), Column('operator', Text), Column('phone', Text), Column('power', Text), Column('power_source', Text), Column('parking', Text), Column('place', Text), Column('population', Text), Column('public_transport', Text), Column('recycling:glass', Text), Column('recycling:paper', Text), Column('recycling:clothes', Text), Column('recycling:scrap_metal', Text), Column('railway', Text), Column('ref', Text), Column('religion', Text), Column('route', Text), Column('service', Text), Column('shop', Text), Column('sport', Text), Column('tourism', Text), Column('tower:type', Text), Column('tracktype', Text), Column('traffic_calming', Text), Column('train', Text), Column('tram', Text), Column('tunnel', Text), Column('type', Text), Column('vending', Text), Column('voltage', Text), Column('water', Text), Column('waterway', Text), Column('website', Text), Column('wetland', Text), Column('width', Text), Column('wikipedia', Text), Column('z_order', SmallInteger), Column('way_area', Float), Column('osm_timestamp', DateTime), Column('osm_version', Text), Column('tags', HSTORE), Column('way', Geometry(geometry_type='LineString', srid=900913), index=True) ) t_osm_point = Table( 'osm_point', metadata, Column('osm_id', BigInteger, index=True), Column('access', Text), Column('addr:city', Text), Column('addr:housenumber', Text), Column('addr:interpolation', Text), Column('addr:place', Text), Column('addr:postcode', Text), Column('addr:street', Text), Column('addr:country', Text), Column('admin_level', Text), Column('aerialway', Text), Column('aeroway', Text), Column('amenity', Text), Column('area', Text), Column('barrier', Text), Column('brand', Text), Column('bridge', Text), Column('boundary', Text), Column('building', Text), Column('bus', Text), Column('contact:phone', Text), Column('cuisine', Text), Column('denomination', Text), Column('drinkable', Text), Column('ele', Text), Column('emergency', Text), Column('entrance', Text), Column('foot', Text), Column('frequency', Text), Column('generator:source', Text), Column('height', Text), Column('highway', Text), Column('historic', Text), Column('information', Text), Column('junction', Text), Column('landuse', Text), Column('layer', Text), Column('leisure', Text), Column('man_made', Text), Column('maxspeed', Text), Column('military', Text), Column('name', Text), Column('int_name', Text), Column('name:en', Text), Column('name:de', Text), Column('name:fr', Text), Column('name:es', Text), Column('natural', Text), Column('office', Text), Column('oneway', Text), Column('opening_hours', Text), Column('operator', Text), Column('phone', Text), Column('power', Text), Column('power_source', Text), Column('parking', Text), Column('place', Text), Column('population', Text), Column('public_transport', Text), Column('recycling:glass', Text), Column('recycling:paper', Text), Column('recycling:clothes', Text), Column('recycling:scrap_metal', Text), Column('railway', Text), Column('ref', Text), Column('religion', Text), Column('route', Text), Column('service', Text), Column('shop', Text), Column('sport', Text), Column('tourism', Text), Column('tower:type', Text), Column('traffic_calming', Text), Column('train', Text), Column('tram', Text), Column('tunnel', Text), Column('type', Text), Column('vending', Text), Column('voltage', Text), Column('water', Text), Column('waterway', Text), Column('website', Text), Column('wetland', Text), Column('width', Text), Column('wikipedia', Text), Column('z_order', SmallInteger), Column('osm_timestamp', DateTime), Column('osm_version', Text), Column('tags', HSTORE), Column('way', Geometry(geometry_type='Point', srid=900913), index=True) ) t_osm_polygon = Table( 'osm_polygon', metadata, Column('osm_id', BigInteger, index=True), Column('access', Text), Column('addr:city', Text), Column('addr:housenumber', Text), Column('addr:interpolation', Text), Column('addr:place', Text), Column('addr:postcode', Text), Column('addr:street', Text), Column('addr:country', Text), Column('admin_level', Text), Column('aerialway', Text), Column('aeroway', Text), Column('amenity', Text), Column('area', Text), Column('barrier', Text), Column('brand', Text), Column('bridge', Text), Column('boundary', Text), Column('building', Text), Column('bus', Text), Column('contact:phone', Text), Column('cuisine', Text), Column('denomination', Text), Column('drinkable', Text), Column('emergency', Text), Column('entrance', Text), Column('foot', Text), Column('frequency', Text), Column('generator:source', Text), Column('height', Text), Column('highway', Text), Column('historic', Text), Column('information', Text), Column('junction', Text), Column('landuse', Text), Column('layer', Text), Column('leisure', Text), Column('man_made', Text), Column('maxspeed', Text), Column('military', Text), Column('name', Text), Column('int_name', Text), Column('name:en', Text), Column('name:de', Text), Column('name:fr', Text), Column('name:es', Text), Column('natural', Text), Column('office', Text), Column('oneway', Text), Column('opening_hours', Text), Column('operator', Text), Column('phone', Text), Column('power', Text), Column('power_source', Text), Column('parking', Text), Column('place', Text), Column('population', Text), Column('public_transport', Text), Column('recycling:glass', Text), Column('recycling:paper', Text), Column('recycling:clothes', Text), Column('recycling:scrap_metal', Text), Column('railway', Text), Column('ref', Text), Column('religion', Text), Column('route', Text), Column('service', Text), Column('shop', Text), Column('sport', Text), Column('tourism', Text), Column('tower:type', Text), Column('tracktype', Text), Column('traffic_calming', Text), Column('train', Text), Column('tram', Text), Column('tunnel', Text), Column('type', Text), Column('vending', Text), Column('voltage', Text), Column('water', Text), Column('waterway', Text), Column('website', Text), Column('wetland', Text), Column('width', Text), Column('wikipedia', Text), Column('z_order', SmallInteger), Column('way_area', Float), Column('osm_timestamp', DateTime), Column('osm_version', Text), Column('tags', HSTORE), Column('way', Geometry(geometry_type='Geometry', srid=900913), index=True) ) t_osm_roads = Table( 'osm_roads', metadata, Column('osm_id', BigInteger, index=True), Column('access', Text), Column('addr:city', Text), Column('addr:housenumber', Text), Column('addr:interpolation', Text), Column('addr:place', Text), Column('addr:postcode', Text), Column('addr:street', Text), Column('addr:country', Text), Column('admin_level', Text), Column('aerialway', Text), Column('aeroway', Text), Column('amenity', Text), Column('area', Text), Column('barrier', Text), Column('brand', Text), Column('bridge', Text), Column('boundary', Text), Column('building', Text), Column('bus', Text), Column('contact:phone', Text), Column('cuisine', Text), Column('denomination', Text), Column('drinkable', Text), Column('emergency', Text), Column('entrance', Text), Column('foot', Text), Column('frequency', Text), Column('generator:source', Text), Column('height', Text), Column('highway', Text), Column('historic', Text), Column('information', Text), Column('junction', Text), Column('landuse', Text), Column('layer', Text), Column('leisure', Text), Column('man_made', Text), Column('maxspeed', Text), Column('military', Text), Column('name', Text), Column('int_name', Text), Column('name:en', Text), Column('name:de', Text), Column('name:fr', Text), Column('name:es', Text), Column('natural', Text), Column('office', Text), Column('oneway', Text), Column('opening_hours', Text), Column('operator', Text), Column('phone', Text), Column('power', Text), Column('power_source', Text), Column('parking', Text), Column('place', Text), Column('population', Text), Column('public_transport', Text), Column('recycling:glass', Text), Column('recycling:paper', Text), Column('recycling:clothes', Text), Column('recycling:scrap_metal', Text), Column('railway', Text), Column('ref', Text), Column('religion', Text), Column('route', Text), Column('service', Text), Column('shop', Text), Column('sport', Text), Column('tourism', Text), Column('tower:type', Text), Column('tracktype', Text), Column('traffic_calming', Text), Column('train', Text), Column('tram', Text), Column('tunnel', Text), Column('type', Text), Column('vending', Text), Column('voltage', Text), Column('water', Text), Column('waterway', Text), Column('website', Text), Column('wetland', Text), Column('width', Text), Column('wikipedia', Text), Column('z_order', SmallInteger), Column('way_area', Float), Column('osm_timestamp', DateTime), Column('osm_version', Text), Column('tags', HSTORE), Column('way', Geometry(geometry_type='LineString', srid=900913), index=True) )
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 6738, 40087, 282, 26599, 17, 1330, 2269, 15748, 198, 6738, 44161, 282, 26599, 1330, 4403, 46541, 11, 29201, 11, 7536, 7575, 11, 48436, 11, 34142, 11, 10452, 46541, 11, 8655, 11, 8255, 11, 40383, ...
2.696695
4,418
import logging from keyvault import secrets_to_environment from twinfield import TwinfieldApi logging.basicConfig( format="%(asctime)s.%(msecs)03d [%(levelname)-5s] [%(name)s] - %(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INFO, ) secrets_to_environment("twinfield-test") tw = TwinfieldApi()
[ 11748, 18931, 198, 198, 6738, 1994, 85, 1721, 1330, 13141, 62, 1462, 62, 38986, 198, 198, 6738, 15203, 3245, 1330, 14968, 3245, 32, 14415, 198, 198, 6404, 2667, 13, 35487, 16934, 7, 198, 220, 220, 220, 5794, 2625, 4, 7, 292, 310, 52...
2.292857
140
# Generated by Django 2.1.2 on 2018-10-27 17:26 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 362, 13, 16, 13, 17, 319, 2864, 12, 940, 12, 1983, 1596, 25, 2075, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
# -*- coding: utf-8 -*- # Copyright 2017 Taylor C. Richberger <taywee@gmx.com> # This code is released under the license described in the LICENSE file from __future__ import division, absolute_import, print_function, unicode_literals
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 220, 2177, 8121, 327, 13, 3998, 21041, 1279, 83, 323, 732, 68, 31, 70, 36802, 13, 785, 29, 198, 2, 770, 2438, 318, 2716, 739, 262, 5964, 3417, 287, 262, ...
3.277778
72
import numpy as np import matplotlib.pyplot as plt def weighted_quantile(values, quantiles, sample_weight=None, values_sorted=False, old_style=False): ''' Very close to numpy.percentile, but supports weights. Note: quantiles should be in [0, 1]! :param values: numpy.array with data :param quantiles: array-like with many quantiles needed :param sample_weight: array-like of the same length as `array` :param values_sorted: bool, if True, then will avoid sorting of initial array :param old_style: if True, will correct output to be consistent with numpy.percentile. :return: numpy.array with computed quantiles. ''' values = np.array(values) quantiles = np.array(quantiles) if sample_weight is None: sample_weight = np.ones(len(values)) sample_weight = np.array(sample_weight) assert np.all(quantiles >= 0) and np.all(quantiles <= 1), \ 'quantiles should be in [0, 1]' if not values_sorted: sorter = np.argsort(values) values = values[sorter] sample_weight = sample_weight[sorter] weighted_quantiles = np.cumsum(sample_weight) - 0.5 * sample_weight if old_style: # To be convenient with numpy.percentile weighted_quantiles -= weighted_quantiles[0] weighted_quantiles /= weighted_quantiles[-1] else: weighted_quantiles /= np.sum(sample_weight) return np.interp(quantiles, weighted_quantiles, values)
[ 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 628, 198, 4299, 26356, 62, 40972, 576, 7, 27160, 11, 5554, 2915, 11, 6291, 62, 6551, 28, 14202, 11, 198, 220, 220, 220, 220, 220, 220, 220,...
2.60453
574
alist = [1,2,3,5,5,1,3] b = set(alist) c = tuple(alist) print(b) print(c) print([x for x in b]) print([x for x in c])
[ 49845, 796, 685, 16, 11, 17, 11, 18, 11, 20, 11, 20, 11, 16, 11, 18, 60, 201, 198, 65, 796, 900, 7, 49845, 8, 201, 198, 66, 796, 46545, 7, 49845, 8, 201, 198, 4798, 7, 65, 8, 201, 198, 4798, 7, 66, 8, 201, 198, 4798, 269...
1.892308
65
from ocp_resources.resource import NamespacedResource
[ 6738, 267, 13155, 62, 37540, 13, 31092, 1330, 28531, 32416, 26198, 628 ]
4.583333
12
from django.conf.urls import patterns, url from metashare.settings import DJANGO_BASE urlpatterns = patterns('metashare.accounts.views', url(r'create/$', 'create', name='create'), url(r'confirm/(?P<uuid>[0-9a-f]{32})/$', 'confirm', name='confirm'), url(r'contact/$', 'contact', name='contact'), url(r'reset/(?:(?P<uuid>[0-9a-f]{32})/)?$', 'reset', name='reset'), url(r'profile/$', 'edit_profile', name='edit_profile'), url(r'editor_group_application/$', 'editor_group_application', name='editor_group_application'), url(r'organization_application/$', 'organization_application', name='organization_application'), url(r'update_default_editor_groups/$', 'update_default_editor_groups', name='update_default_editor_groups'), url(r'edelivery_membership_application/$', 'edelivery_application', name='edelivery_application'), ) urlpatterns += patterns('django.contrib.auth.views', url(r'^profile/change_password/$', 'password_change', {'post_change_redirect' : '/{0}accounts/profile/change_password/done/'.format(DJANGO_BASE), 'template_name': 'accounts/change_password.html'}, name='password_change'), url(r'^profile/change_password/done/$', 'password_change_done', {'template_name': 'accounts/change_password_done.html'}, name='password_change_done'), )
[ 6738, 42625, 14208, 13, 10414, 13, 6371, 82, 1330, 7572, 11, 19016, 198, 6738, 1138, 1077, 533, 13, 33692, 1330, 13004, 1565, 11230, 62, 33, 11159, 198, 198, 6371, 33279, 82, 796, 7572, 10786, 4164, 1077, 533, 13, 23317, 82, 13, 33571...
2.712245
490
from utilmeta.conf import Env env = ServiceEnvironment(__file__)
[ 6738, 7736, 28961, 13, 10414, 1330, 2039, 85, 628, 198, 198, 24330, 796, 4809, 31441, 7, 834, 7753, 834, 8, 198 ]
3.238095
21
# https://www.geeksforgeeks.org/counting-sort/ if __name__ == '__main__': arr = [10, 7, 8, 9, 1, 5] assert [1, 5, 7, 8, 9, 10] == sort(arr)
[ 2, 3740, 1378, 2503, 13, 469, 2573, 30293, 2573, 13, 2398, 14, 9127, 278, 12, 30619, 14, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 5240, 796, 685, 940, 11, 767, 11, 807, 11, 860, 11, 352, 11, ...
2.130435
69
import nidaqmx from . import InstrumentException from time import sleep
[ 11748, 299, 3755, 80, 36802, 198, 6738, 764, 1330, 42410, 16922, 198, 6738, 640, 1330, 3993, 628 ]
4.294118
17
""" Unittest. """ import unittest from calculator.standard.operations_model import ( UniOperation, BiOperation, Square, SquareRoot, Reciprocal, Add, Subtract, Multiply, Divide, Modulo )
[ 37811, 791, 715, 395, 13, 198, 37811, 198, 198, 11748, 555, 715, 395, 198, 6738, 28260, 13, 20307, 13, 3575, 602, 62, 19849, 1330, 357, 198, 220, 220, 220, 43376, 32180, 11, 198, 220, 220, 220, 8436, 32180, 11, 198, 220, 220, 220, ...
2.350515
97
from lab.distribution import DistrManager
[ 6738, 2248, 13, 17080, 3890, 1330, 4307, 81, 13511, 628 ]
4.3
10
import unittest import logging import os import haplotype_plot.genotyper as genotyper import haplotype_plot.reader as reader import haplotype_plot.haplotyper as haplotyper import haplotype_plot.plot as hplot logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) dir_path = os.path.dirname(os.path.realpath(__file__)) if __name__ == '__main__': unittest.main()
[ 11748, 555, 715, 395, 201, 198, 11748, 18931, 201, 198, 11748, 28686, 201, 198, 11748, 42519, 8690, 62, 29487, 13, 5235, 313, 88, 525, 355, 2429, 313, 88, 525, 201, 198, 11748, 42519, 8690, 62, 29487, 13, 46862, 355, 9173, 201, 198, ...
2.564103
156
from typing import Tuple import numpy as np from docknet.data_generator.data_generator import DataGenerator
[ 6738, 19720, 1330, 309, 29291, 198, 198, 11748, 299, 32152, 355, 45941, 198, 198, 6738, 23423, 3262, 13, 7890, 62, 8612, 1352, 13, 7890, 62, 8612, 1352, 1330, 6060, 8645, 1352, 628 ]
3.46875
32
import cv2 import numpy as np import matplotlib.pyplot as plt __all__ = ['DetectionEngine']
[ 11748, 269, 85, 17, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 198, 834, 439, 834, 796, 37250, 11242, 3213, 13798, 20520, 628 ]
2.848485
33
from .constants import FIELDS, PROPERTIES from .shopify_csv import ShopifyRow
[ 6738, 764, 9979, 1187, 1330, 18930, 3698, 5258, 11, 4810, 3185, 17395, 11015, 198, 6738, 764, 24643, 1958, 62, 40664, 1330, 13705, 1958, 25166, 198 ]
3.12
25
from decimal import Decimal import xml.etree.ElementTree as ET from .pcexception import * def get_dimension(self, name_or_pos): ''' return the dimension by name or position (1-based) ''' if isinstance(name_or_pos, int): # position is 1-based return self.dimensions[name_or_pos - 1] else: return self._dimension_lookups['name'][name_or_pos] def get_dimension_index(self, name): ''' return the index of the dimension by name ''' if name not in self._dimension_lookups['name']: return None return self.dimensions.index(self._dimension_lookups['name'][name])
[ 6738, 32465, 1330, 4280, 4402, 198, 11748, 35555, 13, 316, 631, 13, 20180, 27660, 355, 12152, 198, 198, 6738, 764, 79, 344, 87, 4516, 1330, 1635, 628, 220, 220, 220, 825, 651, 62, 46156, 7, 944, 11, 1438, 62, 273, 62, 1930, 2599, ...
2.307947
302
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="django_home_urls", version="0.1.0", author="Yuji Koseki", author_email="pxquuqjm0k62new7q4@gmail.com", description="Django home urlconf.", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/yuji-koseki/django-home-urls", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", 'Framework :: Django', "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], )
[ 11748, 900, 37623, 10141, 198, 198, 4480, 1280, 7203, 15675, 11682, 13, 9132, 1600, 366, 81, 4943, 355, 277, 71, 25, 198, 220, 220, 220, 890, 62, 11213, 796, 277, 71, 13, 961, 3419, 198, 198, 2617, 37623, 10141, 13, 40406, 7, 198, ...
2.451852
270
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This script provide a class to read and save files Created on Sat July 21 2018 @author: cttsai """ import pandas as pd from Utility import CheckFileExist from LibConfigs import logger, hdf5_compress_option, fast_hdf5_compress_option def loadCSV(self, configs={}): """ configs = {'name': 'file_path'} return load_data = {'name': dataframe} """ logger.info("Read Data from CSV") load_data = {} for k, f_path in configs.items(): if not self.checkFile(f_path): continue load_data[k] = pd.read_csv(f_path) logger.info("Read in {}: from {}, shape={}".format(k, f_path, load_data[k].shape)) self.data_lastet_load = load_data.copy() return load_data def loadHDF(self, filename, configs={}, limited_by_configs=True): """ """ logger.info("Read Data from HDFS") if not self.checkFile(filename): return self.loadEmpty(configs) if limited_by_configs: logger.info("Load selected DataFrame Only") load_data = self.readHDF(filename, configs, opt_load=True) else: # full loaded load_data = self.readHDF(filename, opt_load=True) for k, v in load_data.items(): if isinstance(v, pd.DataFrame): logger.info('memory usage on {} is {:.3f} MB'.format(k, v.memory_usage().sum() / 1024. ** 2)) self.data_lastet_load = load_data#.copy() return load_data
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 1212, 4226, 2148, 257, 1398, 284, 1100, 290, 3613, 3696, 198, 41972, 319, 7031, 2901, 2310, 2864, 198, ...
2.194406
715
#!/bin/python from roomai.sevenking import SevenKingEnv from roomai.sevenking import SevenKingAction import unittest
[ 2, 48443, 8800, 14, 29412, 198, 6738, 2119, 1872, 13, 26548, 3364, 1330, 13723, 15708, 4834, 85, 198, 6738, 2119, 1872, 13, 26548, 3364, 1330, 13723, 15708, 12502, 198, 11748, 555, 715, 395, 628, 628 ]
3.428571
35
import attr import os import tarfile from pyamazonlandsat.utils import get_path_row_from_name from pyamazonlandsat.downloader import Downloader
[ 11748, 708, 81, 198, 11748, 28686, 198, 11748, 13422, 7753, 198, 198, 6738, 12972, 33103, 4447, 265, 13, 26791, 1330, 651, 62, 6978, 62, 808, 62, 6738, 62, 3672, 198, 6738, 12972, 33103, 4447, 265, 13, 15002, 263, 1330, 10472, 263, 62...
3.47619
42
from __future__ import division from skimage.segmentation import slic, mark_boundaries from skimage.util import img_as_float from skimage import io import numpy as np import matplotlib.pyplot as plt import os from cv2 import boundingRect #from argparse import ArgumentParser img_width = 50 img_height = 50 img_depth = 4 _selected_segments = set() _current_segments = [] _current_image = [] _original_image = [] _plt_img = [] _shift = False if __name__ == "__main__": parser = ArgumentParser() parser.add_argument("--name", default="new") args = parser.parse_args() image_paths = os.listdir("inputs") images = [io.imread(os.path.join("inputs", image_path)) for image_path in image_paths] print(f"Found {len(images)} inputs") output_path = os.path.join("datasets", args.name) existing_segments = os.listdir(output_path) if 'c0' in existing_segments: false_index = existing_segments.index('c0') true_index = len(existing_segments) - false_index else: false_index = len(existing_segments) true_index = 0 print("Segmenting") segments = [segment(image) for image in images] for i in range(len(images)): selection = select(images[i], segments[i]) true_padded_images, _ = padded_segments(images[i], segments[i], selection) print(f"Saving {len(true_padded_images)} car images") for img in true_padded_images: # Can't save it as an image: it has an extra channel with open(os.path.join(output_path, f"c{str(true_index)}"), 'wb') as save_file: np.save(save_file, img) true_index += 1 not_selection = set(range(segments[i].max())) - selection false_padded_images, _ = padded_segments(images[i], segments[i], not_selection) print(f"Saving {len(false_padded_images)} non-car images") for img in false_padded_images: with open(os.path.join(output_path, str(false_index)), 'wb') as save_file: np.save(save_file, img) false_index += 1 os.rename(os.path.join("inputs", image_paths[i]), os.path.join("processed", image_paths[i]))
[ 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 1341, 9060, 13, 325, 5154, 341, 1330, 14369, 11, 1317, 62, 7784, 3166, 198, 6738, 1341, 9060, 13, 22602, 1330, 33705, 62, 292, 62, 22468, 198, 6738, 1341, 9060, 1330, 33245, 198, 11748, ...
2.702849
737
"""Parse CWL and create a JSON file describing the workflow. This dictionary is directly suitable for display by vis.js, but can be parsed for any other purpose.""" # Copyright (c) 2019 Seven Bridges. See LICENSE from ..cwl.lib import ListOrMap
[ 37811, 10044, 325, 24006, 43, 290, 2251, 257, 19449, 2393, 12059, 262, 30798, 13, 770, 22155, 198, 271, 3264, 11080, 329, 3359, 416, 1490, 13, 8457, 11, 475, 460, 307, 44267, 329, 597, 584, 198, 29983, 526, 15931, 198, 198, 2, 220, ...
3.705882
68
from django.db import models from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \ PermissionsMixin from django.conf import settings
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 27530, 1330, 27741, 14881, 12982, 11, 7308, 12982, 13511, 11, 3467, 198, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,...
2.25
92
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.891892
37
# AUTOGENERATED! DO NOT EDIT! File to edit: 04kraus.ipynb (unless otherwise specified). __all__ = ['apply_kraus', 'partial_trace_kraus', 'povm_map'] # Cell import numpy as np import qutip as qt # Cell def apply_kraus(dm, kraus): r""" Applies a Kraus map to a density matrix $\rho$. The Kraus map consists in some number of operators satisfying $\sum_{i} \hat{K}_{i}^{\dagger}\hat{K}_{i} = \hat{I}$. $\rho$ is transformed via: $$\rho \rightarrow \sum_{i} \hat{K}_{i}\rho\hat{K}_{i}^{\dagger} $$ """ return sum([kraus[j]*dm*kraus[j].dag() for j in range(len(kraus))]) # Cell def partial_trace_kraus(keep, dims): r""" Constructs the Kraus map corresponding to the partial trace. Takes `keep` which is a single index or list of indices denoting subsystems to keep, and a list `dims` of dimensions of the overall tensor product Hilbert space. For illustration, to trace over the $i^{th}$ subsystem of $n$, one would construct Kraus operators: $$ \hat{K}_{i} = I^{\otimes i - 1} \otimes \langle i \mid \otimes I^{\otimes n - i}$$. """ if type(keep) == int: keep = [keep] trace_over = [i for i in range(len(dims)) if i not in keep] indices = [{trace_over[0]:t} for t in range(dims[trace_over[0]])] for i in trace_over[1:]: new_indices = [] for t in range(dims[i]): new_indices.extend([{**j, **{i: t}} for j in indices]) indices = new_indices return [qt.tensor(*[qt.identity(d) if i in keep else qt.basis(d, index[i]).dag() for i, d in enumerate(dims)]) for index in indices] # Cell def povm_map(kraus, A, B=None): r""" Represents a Kraus map on Qbist probability vectors. Takes a list of Kraus operators, a POVM $A$ on the initial Hilbert space, and a POVM $B$ on the final Hilbert space. If $B$ isn't provided, it's assumed to be the same as $A$. Then the matrix elements of the map are: $$K_{j, i} = tr( \mathbb{K}(\frac{\hat{A}_{i}}{tr \hat{A}_{i}})\hat{B}_{j} ) $$ Where $\mathbb{K}(\hat{O})$ denotes the Kraus map applied to $O$. """ B = B if type(B) != type(None) else A return np.array([[(apply_kraus(a/a.tr(), kraus)*b).tr() for a in A] for b in B]).real
[ 2, 47044, 7730, 1677, 1137, 11617, 0, 8410, 5626, 48483, 0, 9220, 284, 4370, 25, 8702, 74, 430, 385, 13, 541, 2047, 65, 357, 25252, 4306, 7368, 737, 198, 198, 834, 439, 834, 796, 37250, 39014, 62, 74, 430, 385, 3256, 705, 47172, 6...
2.450783
894
n = int(input()) num = 1 while num <= n: print(num) num = num * 2 + 1
[ 77, 796, 493, 7, 15414, 28955, 198, 22510, 796, 352, 198, 198, 4514, 997, 19841, 299, 25, 198, 220, 220, 220, 3601, 7, 22510, 8, 198, 220, 220, 220, 997, 796, 997, 1635, 362, 1343, 352 ]
2.166667
36
import sys sys.path.insert(0,'..') sys.path.insert(0,'../..') from bayes_opt import BayesOpt,BayesOpt_KnownOptimumValue import numpy as np #from bayes_opt import auxiliary_functions from bayes_opt import functions from bayes_opt import utilities import warnings #from bayes_opt import acquisition_maximization import sys import itertools import matplotlib.pyplot as plt np.random.seed(6789) warnings.filterwarnings("ignore") counter = 0 myfunction_list=[] #myfunction_list.append(functions.sincos()) #myfunction_list.append(functions.branin()) #myfunction_list.append(functions.hartman_3d()) #myfunction_list.append(functions.ackley(input_dim=5)) myfunction_list.append(functions.alpine1(input_dim=5)) #myfunction_list.append(functions.hartman_6d()) #myfunction_list.append(functions.gSobol(a=np.array([1,1,1,1,1]))) #myfunction_list.append(functions.gSobol(a=np.array([1,1,1,1,1,1,1,1,1,1]))) acq_type_list=[] temp={} temp['name']='erm' # expected regret minimization temp['IsTGP']=0 # recommended to use tgp for ERM acq_type_list.append(temp) temp={} temp['name']='cbm' # confidence bound minimization temp['IsTGP']=1 # recommended to use tgp for CBM #acq_type_list.append(temp) #temp={} #temp['name']='kov_mes' # MES+f* #temp['IsTGP']=0 # we can try 'tgp' #acq_type_list.append(temp) temp={} temp['name']='kov_ei' # this is EI + f* temp['IsTGP']=0 # we can try 'tgp' by setting it =1 #acq_type_list.append(temp) temp={} temp['name']='ucb' # vanilla UCB temp['IsTGP']=0 # we can try 'tgp' by setting it =1 #acq_type_list.append(temp) temp={} temp['name']='ei' # vanilla EI temp['IsTGP']=0 # we can try 'tgp' by setting it =1 #acq_type_list.append(temp) temp={} temp['name']='random' # vanilla EI temp['IsTGP']=0 # we can try 'tgp' by setting it =1 #acq_type_list.append(temp) fig=plt.figure() color_list=['r','b','k','m','c','g','o'] marker_list=['s','x','o','v','^','>','<'] for idx, (myfunction,acq_type,) in enumerate(itertools.product(myfunction_list,acq_type_list)): print("=====================func:",myfunction.name) print("==================acquisition type",acq_type) IsTGP=acq_type['IsTGP'] acq_name=acq_type['name'] nRepeat=10 ybest=[0]*nRepeat MyTime=[0]*nRepeat MyOptTime=[0]*nRepeat marker=[0]*nRepeat bo=[0]*nRepeat [0]*nRepeat for ii in range(nRepeat): if 'kov' in acq_name or acq_name == 'erm' or acq_name == 'cbm': bo[ii]=BayesOpt_KnownOptimumValue(myfunction.func,myfunction.bounds,myfunction.fstar, \ acq_name,IsTGP,verbose=1) else: bo[ii]=BayesOpt(myfunction.func,myfunction.bounds,acq_name,verbose=1) ybest[ii],MyTime[ii]=utilities.run_experiment(bo[ii],n_init=3*myfunction.input_dim,\ NN=10*myfunction.input_dim,runid=ii) MyOptTime[ii]=bo[ii].time_opt print("ii={} BFV={:.3f}".format(ii,myfunction.ismax*np.max(ybest[ii]))) Score={} Score["ybest"]=ybest Score["MyTime"]=MyTime Score["MyOptTime"]=MyOptTime utilities.print_result_sequential(bo,myfunction,Score,acq_type) ## plot the result # process the result y_best_sofar=[0]*len(bo) for uu,mybo in enumerate(bo): y_best_sofar[uu]=[ (myfunction.fstar - np.max(mybo.Y_ori[:ii+1]) ) for ii in range(len(mybo.Y_ori))] y_best_sofar[uu]=y_best_sofar[uu][3*myfunction.input_dim:] # remove the random phase for plotting purpose y_best_sofar=np.asarray(y_best_sofar) myxaxis=range(y_best_sofar.shape[1]) plt.errorbar(myxaxis,np.mean(y_best_sofar,axis=0), np.std(y_best_sofar,axis=0)/np.sqrt(nRepeat), label=acq_type['name'],color=color_list[idx],marker=marker_list[idx]) plt.ylabel("Simple Regret",fontsize=14) plt.xlabel("Iterations",fontsize=14) plt.legend(prop={'size': 14}) strTitle="{:s} D={:d}".format(myfunction.name,myfunction.input_dim) plt.title(strTitle,fontsize=18)
[ 11748, 25064, 198, 17597, 13, 6978, 13, 28463, 7, 15, 4032, 492, 11537, 198, 17597, 13, 6978, 13, 28463, 7, 15, 4032, 40720, 492, 11537, 198, 198, 6738, 15489, 274, 62, 8738, 1330, 4696, 274, 27871, 11, 15262, 274, 27871, 62, 29870, ...
2.141598
1,928
import icalendar import uuid from datetime import datetime import pytz cst = pytz.timezone('Asia/Shanghai') # def fCalendar(): # cal = icalendar.Calendar() # cal.add('prodid', '-//CDFMLR//coursesical//CN') # cal.add('VERSION', '2.0') # cal.add('X-WR-CALNAME', 'coursesical') # cal.add('X-APPLE-CALENDAR-COLOR', '#ff5a1d') # cal.add('X-WR-TIMEZONE', 'Asia/Shanghai') # return cal
[ 11748, 220, 605, 9239, 198, 11748, 334, 27112, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 11748, 12972, 22877, 198, 198, 66, 301, 796, 12972, 22877, 13, 2435, 11340, 10786, 38555, 14, 2484, 272, 20380, 11537, 628, 198, 198, 2, 825, ...
2.139175
194
#!/usr/bin/python3.2 import unittest from minesweeper.message import * if __name__ == "__main__": unittest.main()
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 13, 17, 198, 198, 11748, 555, 715, 395, 198, 6738, 18446, 732, 5723, 13, 20500, 1330, 1635, 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 555, ...
2.489796
49
from distutils.core import setup from distutils.command.build_py import build_py import os import shutil import stat from RunnerPyzza import __version__ setup( name = 'RunnerPyzza', version = __version__, author = 'Marco Galardini - Emilio Potenza', author_email = 'marco.galardini@gmail.com - emilio.potenza@gmail.com', packages = ['RunnerPyzza','RunnerPyzza.ClientCommon', 'RunnerPyzza.Common', 'RunnerPyzza.LauncherManager', 'RunnerPyzza.ServerCommon'], scripts = ['RPdaemon','RPlauncher','RPaddservice','RPadduser','RPpreparedir','RPsshkeys'], #url = 'http://RunnerPyzza', license = 'LICENSE.txt', description = 'An easy to use queue system for laboratory networks', long_description = open('README.txt').read(), install_requires = ["paramiko >= 1.7.7.2", "argparse >= 1.1"], cmdclass = {"build_py" : runner_build_py} )
[ 6738, 1233, 26791, 13, 7295, 1330, 9058, 198, 6738, 1233, 26791, 13, 21812, 13, 11249, 62, 9078, 1330, 1382, 62, 9078, 198, 11748, 28686, 198, 11748, 4423, 346, 198, 11748, 1185, 198, 6738, 21529, 20519, 34443, 1330, 11593, 9641, 834, 2...
2.869707
307
if __name__ == "__main__": solu = Solution() print(solu.multiply('123', '456'))
[ 628, 198, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 1540, 84, 796, 28186, 3419, 628, 220, 220, 220, 3601, 7, 34453, 84, 13, 16680, 541, 306, 10786, 10163, 3256, 705, 29228, 6, 4008 ]
2.243902
41
""" Here for compat. with objectstore. """
[ 37811, 198, 4342, 329, 8330, 13, 351, 2134, 8095, 13, 198, 37811, 628, 198 ]
3.214286
14
import asyncio import inspect import logging import os import random import time import uuid from abc import ABC, abstractmethod from functools import cached_property, wraps from logging import Logger from typing import Any, Callable, Dict, List, Optional, Tuple from aiohttp.client import ClientConnectionError, ClientConnectorError from aiohttp.web import Application, GracefulExit from .log import get_logger from .utils import close_task, dot_name, underscore def _exit(self) -> None: # pragma: no cover if os.getenv("PYTHON_ENV") != "test": raise GracefulExit class NodeWorker(NodeBase): # FOR DERIVED CLASSES async def work(self) -> None: """Main work coroutine, this is where you define the asynchronous loop. Must be implemented by derived classes """ raise NotImplementedError # API def is_running(self) -> bool: """True if the Node is running""" return bool(self._worker) # INTERNAL class Node(NodeWorker): """A nodeworker with an heartbeat work loop and ability to publish messages into a pubsub """ heartbeat: float = 1 ticks: int = 0 class Worker(NodeWorker): class TickWorker(Node): class every: def __init__(self, seconds: float, noise: float = 0) -> None: self.seconds = seconds self.noise = min(noise, seconds) self.last = 0 self.gap = self._gap() self.ticks = 0
[ 11748, 30351, 952, 198, 11748, 10104, 198, 11748, 18931, 198, 11748, 28686, 198, 11748, 4738, 198, 11748, 640, 198, 11748, 334, 27112, 198, 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 1257, 310, 10141, 1330, 39986, 62, 26745, ...
2.804598
522
import syaml testcase = """--- key: key: f key2: l nest: inner: g nest2: nestted: 3 inner2: s outnest: 3 ha: g je: r --- key: value a_list: - itema - listlist: - itemitem - itemb - key1: bweh key2: bweh key3: bweh key4: bweh - innerList: - innerItem - indict: reh rar: dd sublist: - iteml - itemc - - itm - [44,55,66,"7t","8t","eeee"] - ohno - "test" - "ending": obj key: last of inner - aa: aaa - lastitem anotherkey: value ... """ a = syaml.load(testcase) print(a) depth = 12 #a[0] = recurse(a[0]) b = syaml.dump(2,a) print(b) print(syaml.load(b))
[ 11748, 827, 43695, 198, 198, 9288, 7442, 796, 37227, 6329, 198, 2539, 25, 198, 220, 1994, 25, 277, 198, 220, 1994, 17, 25, 300, 198, 220, 16343, 25, 198, 220, 220, 220, 8434, 25, 308, 198, 220, 220, 220, 16343, 17, 25, 198, 220, ...
1.793367
392
#!/usr/bin/env python import os import sys
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 28686, 198, 11748, 25064, 628 ]
2.8125
16
# Generated by Django 2.2.5 on 2020-02-22 22:36 from django.db import migrations
[ 2, 2980, 515, 416, 37770, 362, 13, 17, 13, 20, 319, 12131, 12, 2999, 12, 1828, 2534, 25, 2623, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 628 ]
2.766667
30
""" Load and Display a Shape. Illustration by George Brower. (Rewritten in Python by Jonathan Feinberg.) The loadShape() command is used to read simple SVG (Scalable Vector Graphics) files into a Processing sketch. This library was specifically tested under SVG files created from Adobe Illustrator. For now, we can't guarantee that it'll work for SVGs created with anything else. """ # The file "bot1.svg" must be in the data folder # of the current sketch to load successfully bot = loadShape("bot1.svg")
[ 37811, 198, 8778, 290, 16531, 257, 25959, 13, 198, 23279, 1358, 416, 4502, 19600, 263, 13, 198, 357, 30003, 9108, 287, 11361, 416, 11232, 45711, 3900, 2014, 628, 383, 3440, 33383, 3419, 3141, 318, 973, 284, 1100, 2829, 45809, 357, 3351,...
4
129
""" Custom tokenization routines for the 'ons' corpus. Special care is taken to metadata tokens such as === Report: 12345 === that were inserted to distinguish between multiple documents of a client. They will be properly handled during the tokenization and sentence segmentation stage. """ import re import spacy from spacy.matcher import Matcher from spacy.symbols import ORTH from deidentify.tokenizer import Tokenizer META_REGEX = re.compile(r'=== (?:Report|Answer): [0-9]+ ===\n') TOKENIZER_SPECIAL_CASES = [ 'B.Sc.', 'Co.', 'Dhr.', 'Dr.', 'M.Sc.', 'Mevr.', 'Mgr.', 'Mr.', 'Mw.', 'O.K.', 'a.u.b.', 'ca.', 'e.g.', 'etc.', 'v.d.' ] def _metadata_sentence_segmentation(doc): """Custom sentence segmentation rule of the Ons corpus. It segments metadata text into separate sentences. Metadata consists of 10 tokens: ['=', '=', '=', 'Report|Answer', ':', 'DDDDDD', '=', '=', '=', '\n'] During sentence segmentation, we want that the metadata is always a sentence in itself. Therefore, the first token (i.e., '=') is marked as sentence start. All other tokens are explicitly marked as non-sentence boundaries. To ensure that anything immediately following after metadata is a new sentece, the next token is marked as sentence start. """ for i in range(len(doc)): if not _metadata_complete(doc, i): continue # All metadata tokens excluding the leading '='. meta_span = doc[i - 8: i + 1] for meta_token in meta_span: meta_token.is_sent_start = False # The leading '=' is a sentence boundary doc[i - 9].is_sent_start = True # Any token following the metadata is also a new sentence. doc[i + 1].is_sent_start = True return doc NLP = spacy.load('nl_core_news_sm') try: NLP.add_pipe(_metadata_sentence_segmentation, before="parser") # Insert before the parser except ValueError: # spacy>=3 from spacy.language import Language Language.component('meta-sentence-segmentation')(_metadata_sentence_segmentation) # pylint: disable=E1101 NLP.add_pipe('meta-sentence-segmentation', before="parser") # Insert before the parser for case in TOKENIZER_SPECIAL_CASES: NLP.tokenizer.add_special_case(case, [{ORTH: case}]) NLP.tokenizer.add_special_case(case.lower(), [{ORTH: case.lower()}]) infixes = NLP.Defaults.infixes + [r'\(', r'\)', r'(?<=[\D])\/(?=[\D])'] infix_regex = spacy.util.compile_infix_regex(infixes) NLP.tokenizer.infix_finditer = infix_regex.finditer
[ 37811, 198, 15022, 11241, 1634, 31878, 329, 262, 705, 684, 6, 35789, 13, 6093, 1337, 318, 2077, 284, 20150, 16326, 884, 355, 198, 18604, 6358, 25, 17031, 2231, 24844, 326, 547, 18846, 284, 15714, 1022, 3294, 4963, 286, 257, 5456, 13, ...
2.596192
998
# Django from django.conf import Settings, settings # APPs from systemtest.quality import forms as quality_forms, models as quality_models from systemtest.utils.db2 import Database def get_quality_status(status_name: str) -> quality_models.QualityStatus: """ Gets a specific QualityStatus by exact name Args: status_name: Name of status to fetch Raises: DoesNotExist: QualityStatus matching query does not exist Returns: QualityStatus object """ return quality_models.QualityStatus.objects.get(name=status_name)
[ 198, 198, 2, 37770, 198, 6738, 42625, 14208, 13, 10414, 1330, 16163, 11, 6460, 198, 198, 2, 3486, 12016, 198, 6738, 1080, 9288, 13, 13237, 1330, 5107, 355, 3081, 62, 23914, 11, 4981, 355, 3081, 62, 27530, 198, 6738, 1080, 9288, 13, ...
2.856459
209
# -*- coding: utf-8 -*- import asyncio import logging import aiohttp from cibopath import readme_parser, github_api from cibopath.templates import Template logger = logging.getLogger('cibopath') def fetch_template_data(username, token): semaphore = asyncio.Semaphore(10) loop = asyncio.get_event_loop() auth = aiohttp.BasicAuth(username, token) with aiohttp.ClientSession(loop=loop, auth=auth) as client: logger.debug('Load Cookiecutter readme') cookiecutter_readme = loop.run_until_complete( github_api.get_readme(semaphore, client, 'audreyr', 'cookiecutter') ) if not cookiecutter_readme: raise CookiecutterReadmeError logger.debug('Find GitHub links in Cookiecutter readme') github_links, _ = readme_parser.read(cookiecutter_readme) if not github_links: raise UnableToFindTemplateLinks tasks = [ github_api.get_template(semaphore, client, link) for link in github_links ] logger.debug('Fetch template data from links') results = loop.run_until_complete(asyncio.gather(*tasks)) yield from filter(None, results) # Ignore all invalid templates def load_templates(username, token): templates = [] template_data = fetch_template_data(username, token) for name, author, repo, context, readme in template_data: _, tags = readme_parser.read(readme) templates.append(Template(name, author, repo, context, sorted(tags))) return templates
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 30351, 952, 198, 11748, 18931, 198, 198, 11748, 257, 952, 4023, 198, 198, 6738, 269, 571, 18569, 1330, 1100, 1326, 62, 48610, 11, 33084, 62, 15042, 198, 6738...
2.556837
607
# Goal: # Demonstrate the A/B switch functionality of the SpikeSafe PSMU while operating in DC mode # # Expectation: # Channel 1 will run in DC mode with the switch set to Primary. # Afterward the Switch be set to Auxiliary mode, in which another source may operate connected to the SpikeSafe # After the Auxiliary source has completed operation, the switch will be set to Primary to operate the SpikeSafe in DC mode again import sys import time import logging from spikesafe_python.MemoryTableReadData import log_memory_table_read from spikesafe_python.ReadAllEvents import log_all_events from spikesafe_python.TcpSocket import TcpSocket from spikesafe_python.Threading import wait from spikesafe_python.SpikeSafeError import SpikeSafeError from tkinter import messagebox ### set these before starting application # SpikeSafe IP address and port number ip_address = '10.0.0.220' port_number = 8282 ### setting up sequence log log = logging.getLogger(__name__) logging.basicConfig(filename='SpikeSafePythonSamples.log',format='%(asctime)s, %(levelname)s, %(message)s',datefmt='%m/%d/%Y %I:%M:%S',level=logging.INFO) ### start of main program try: log.info("ForceSenseSwitchSample.py started.") # instantiate new TcpSocket to connect to SpikeSafe tcp_socket = TcpSocket() tcp_socket.open_socket(ip_address, port_number) # reset to default state tcp_socket.send_scpi_command('*RST') log_all_events(tcp_socket) # check that the Force Sense Selector Switch is available for this SpikeSafe. We need the switch to run this sequence # If switch related SCPI is sent and there is no switch configured, it will result in error "386, Output Switch is not installed" tcp_socket.send_scpi_command('OUTP1:CONN:AVAIL?') isSwitchAvailable = tcp_socket.read_data() if isSwitchAvailable != 'Ch:1': raise Exception('Force Sense Selector Switch is not available, and is necessary to run this sequence.') # set the Force Sense Selector Switch state to Primary (A) so that the SpikeSafe can output to the DUT # the default switch state can be manually adjusted using SCPI, so it is best to send this command even after sending a *RST tcp_socket.send_scpi_command('OUTP1:CONN PRI') # set Channel 1 settings to operate in DC mode tcp_socket.send_scpi_command('SOUR1:FUNC:SHAP DC') tcp_socket.send_scpi_command('SOUR1:CURR:PROT 50') tcp_socket.send_scpi_command('SOUR1:CURR 0.1') tcp_socket.send_scpi_command('SOUR1:VOLT 20') # log all SpikeSafe event after settings are adjusted log_all_events(tcp_socket) # turn on Channel 1 tcp_socket.send_scpi_command('OUTP1 1') # check for all events and measure readings on Channel 1 once per second for 10 seconds time_end = time.time() + 10 while time.time() < time_end: log_all_events(tcp_socket) log_memory_table_read(tcp_socket) wait(1) # turn off Channel 1 and check for all events # When operating in DC mode, the channel must be turned off before adjusting the switch state tcp_socket.send_scpi_command('OUTP1 0') log_all_events(tcp_socket) # set the Force Sense Selector Switch state to Auxiliary (B) so that the Auxiliary Source will be routed to the DUT and the SpikeSafe will be disconnected tcp_socket.send_scpi_command('OUTP1:CONN AUX') # Show a message box so any tasks using the Auxiliary source may be performed before adjusting the switch back to Primary # The SpikeSafe is not electrically connected to the DUT at this time messagebox.showinfo("Auxiliary Source Active", "Force Sense Selector Switch is in Auxiliary (B) mode. Perform any tests using the auxiliary source, then close this window to adjust the switch back to Primary (A) mode.") # set the Force Sense Selector Switch state to Primary (A) so that the SpikeSafe can output to the DUT tcp_socket.send_scpi_command('OUTP1:CONN PRI') # turn on Channel 1 tcp_socket.send_scpi_command('OUTP1 1') # check for all events and measure readings on Channel 1 once per second for 10 seconds time_end = time.time() + 10 while time.time() < time_end: log_all_events(tcp_socket) log_memory_table_read(tcp_socket) wait(1) # turn off Channel 1 and check for all events tcp_socket.send_scpi_command('OUTP1 0') log_all_events(tcp_socket) # disconnect from SpikeSafe tcp_socket.close_socket() log.info("ForceSenseSwitchSample.py completed.\n") except SpikeSafeError as ssErr: # print any SpikeSafe-specific error to both the terminal and the log file, then exit the application error_message = 'SpikeSafe error: {}\n'.format(ssErr) log.error(error_message) print(error_message) sys.exit(1) except Exception as err: # print any general exception to both the terminal and the log file, then exit the application error_message = 'Program error: {}\n'.format(err) log.error(error_message) print(error_message) sys.exit(1)
[ 2, 25376, 25, 220, 198, 2, 7814, 23104, 262, 317, 14, 33, 5078, 11244, 286, 262, 26309, 31511, 6599, 42422, 981, 5361, 287, 6257, 4235, 198, 2, 220, 198, 2, 23600, 341, 25, 220, 198, 2, 11102, 352, 481, 1057, 287, 6257, 4235, 351,...
2.681231
2,014
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import os import py_utils import time from telemetry.page import legacy_page_test from telemetry.util import image_util
[ 2, 15069, 2177, 383, 18255, 1505, 46665, 13, 1439, 2489, 10395, 13, 198, 2, 5765, 286, 428, 2723, 2438, 318, 21825, 416, 257, 347, 10305, 12, 7635, 5964, 326, 460, 307, 198, 2, 1043, 287, 262, 38559, 24290, 2393, 13, 198, 198, 11748...
3.78481
79
# Copyright 2016 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # import mock from tripleoclient.tests.v1.overcloud_deploy import fakes from tripleoclient.v1 import overcloud_delete
[ 2, 220, 220, 15069, 1584, 2297, 10983, 11, 3457, 13, 198, 2, 198, 2, 220, 220, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 345, 743, 198, 2, 220, 220, 407, 779, 428, 2393, 2845, 287, 11846,...
3.407583
211
import numpy as np import torch from collections import deque, namedtuple import cv2 import os import carla from .model_supervised import Model_Segmentation_Traffic_Light_Supervised from .model_RL import DQN, Orders
[ 11748, 299, 32152, 355, 45941, 198, 11748, 28034, 198, 6738, 17268, 1330, 390, 4188, 11, 3706, 83, 29291, 198, 11748, 269, 85, 17, 198, 11748, 28686, 198, 11748, 1097, 5031, 198, 198, 6738, 764, 19849, 62, 16668, 16149, 1330, 9104, 62, ...
3.40625
64
n = int(input()) for i in range(1 , n + 1 ): x = input().split() a,b,c = x print('{:.1f}'.format((float(a) * 2 + float(b) * 3 + float(c) * 5) / 10))
[ 77, 796, 493, 7, 15414, 28955, 198, 198, 1640, 1312, 287, 2837, 7, 16, 837, 299, 1343, 352, 15179, 198, 220, 220, 220, 2124, 796, 5128, 22446, 35312, 3419, 198, 220, 220, 220, 257, 11, 65, 11, 66, 796, 2124, 198, 220, 220, 220, ...
2.025
80
import base64 import binascii import datetime import os import subprocess import random import sys BECH_SYMBOLS = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" OUR_BINARY = None LIBBECH32ENC_BINARY = None LIBBECH32DEC_BINARY = None NODE_REF = "node . " # region Encoding # endregion # region Decoding # endregion # Adapted from # https://stackoverflow.com/questions/1425493/convert-hex-to-binary if __name__ == '__main__': OUR_BINARY = sys.argv[1] LIBBECH32ENC_BINARY = sys.argv[2] LIBBECH32DEC_BINARY = sys.argv[3] FUZZ_ITERATIONS = int(sys.argv[4]) FUZZ_SECONDS = int(sys.argv[5]) _hrp = 'v)zeod9[qg.ns)+}r}' _hex_str = '857e' _b64_str = to_base64(_hex_str.upper()) process('a', 'ff', to_base64('FF')) fail_count = 0 start_time = datetime.datetime.now() for _ in range(0, FUZZ_ITERATIONS): if not process(_hrp, _hex_str, _b64_str): fail_count += 1 _hrp = generate_hrp() _hex_str = generate_hex(_hrp) _b64_str = to_base64(_hex_str.upper()) end_time = datetime.datetime.now() if (end_time - start_time).seconds >= FUZZ_SECONDS: print(f'Fuzzing stopped after {FUZZ_SECONDS} seconds') break print("DONE") sys.exit(fail_count)
[ 11748, 2779, 2414, 198, 11748, 9874, 292, 979, 72, 198, 11748, 4818, 8079, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 11748, 4738, 198, 11748, 25064, 198, 198, 33, 25994, 62, 23060, 10744, 3535, 50, 796, 366, 80, 79, 89, 563, 24,...
2.092105
608
#!/usr/bin/env python3 """ #------------------------------------------------------------------------------ # # SCRIPT: forecast_task_07.py # # PURPOSE: Combine all non-precip 6-hourly files into one file and copy BCSD # precip files in to the same directory Based on FORECAST_TASK_07.sh. # # REVISION HISTORY: # 24 Oct 2021: Ryan Zamora, first version # #------------------------------------------------------------------------------ """ # # Standard modules # import configparser import os import subprocess import sys # # Local methods # def _usage(): """Print command line usage.""" txt = f"[INFO] Usage: {(sys.argv[0])} current_year month_abbr config_file" print(txt) print("[INFO] where") print("[INFO] current_year: Current year") print("[INFO] month_abbr: Current month") print("[INFO] config_file: Config file that sets up environment") def _read_cmd_args(): """Read command line arguments.""" if len(sys.argv) != 4: print("[ERR] Invalid number of command line arguments!") _usage() sys.exit(1) # current_year try: current_year = int(sys.argv[1]) except ValueError: print(f"[ERR] Invalid argument for current_year! Received {(sys.argv[1])}") _usage() sys.exit(1) if current_year < 0: print(f"[ERR] Invalid argument for current_year! Received {(sys.argv[1])}") _usage() sys.exit(1) # month_abbr month_abbr = str(sys.argv[2]) # config_file config_file = sys.argv[3] if not os.path.exists(config_file): print(f"[ERR] {config_file} does not exist!") sys.exit(1) return current_year, month_abbr, config_file def read_config(config_file): """Read from bcsd_preproc config file.""" config = configparser.ConfigParser() config.read(config_file) return config def _driver(): """Main driver.""" current_year, month_abbr, config_file = _read_cmd_args() # Setup local directories config = read_config(config_file) # Path of the main project directory projdir = config["bcsd_preproc"]["projdir"] # Number of precip ensembles needed range_ens_fcst=list(range(1, 13)) + list(range(1,13)) + list(range(1,7)) range_ens_nmme=range(1,31) fcst_date = f"{month_abbr}01" # Path for where forecast files are located: indir=f"{projdir}/data/forecast/CFSv2_25km/raw/6-Hourly/{fcst_date}/{current_year}" # Path for where the linked precip files should be placed: outdir=f"{projdir}/data/forecast/NMME/linked_cfsv2_precip_files/{fcst_date}/{current_year}" if not os.path.exists(outdir): os.makedirs(outdir) for iens, ens_value in enumerate(range_ens_fcst): src_file=f"{indir}/ens{ens_value}" dst_file=f"{outdir}/ens{range_ens_nmme[iens]}" cmd = f"ln -sfn {src_file} {dst_file}" print(cmd) returncode = subprocess.call(cmd, shell=True) if returncode != 0: print("[ERR] Problem calling creating symbolic links!") sys.exit(1) print("[INFO] Done creating symbolic links") # # Main Method # if __name__ == "__main__": _driver()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 37811, 198, 2, 10097, 26171, 198, 2, 198, 2, 6374, 46023, 25, 11092, 62, 35943, 62, 2998, 13, 9078, 198, 2, 198, 2, 33079, 48933, 25, 29176, 477, 1729, 12, 3866, 66, 541, 718, ...
2.479248
1,277
""" 10. Faa um Programa que pea a temperatura em graus Celsius, transforme e mostre em graus Farenheit. """ celsius = float(input('Informe o valor em Celsius (C): ')) fahrenheit = (celsius * (9/5)) + 32 print('{} C igual a {:.1f} F'.format(celsius, fahrenheit))
[ 37811, 198, 940, 13, 376, 7252, 23781, 6118, 64, 8358, 613, 64, 257, 4124, 2541, 64, 795, 7933, 385, 34186, 11, 6121, 68, 304, 749, 260, 795, 7933, 385, 376, 5757, 29361, 13, 198, 37811, 198, 198, 5276, 82, 3754, 796, 12178, 7, 15...
2.548077
104
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.distributions import Normal def squash(s, dim=-1, eps=1e-8): """ "Squashing" non-linearity that shrunks short vectors to almost zero length and long vectors to a length slightly below 1 v_j = ||s_j||^2 / (1 + ||s_j||^2) * s_j / ||s_j|| Args: s: Vector before activation dim: Dimension along which to calculate the norm Returns: v: Squashed vector """ squared_norm = torch.sum(s**2, dim=dim, keepdim=True) v = squared_norm / (1 + squared_norm) * \ s / (torch.sqrt(squared_norm) + eps) return v
[ 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 11748, 28034, 13, 20471, 13, 45124, 355, 376, 198, 6738, 28034, 13, 2306, 519, 6335, 1330, 35748, 198, 6738, 28034, 13, 17080, 2455, 507, 1330, 14435, 628, 198, 4299, 34613,...
2.64876
242
#!python3 import contextlib import json import logging import os from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa from dcos_e2e import cluster from dcos_e2e import node from dcos_test_utils import helpers as dcos_helpers from dcos_test_utils import iam as dcos_iam from dcos_test_utils import enterprise as dcos_ee_api from dcos_test_utils import dcos_api from dcos_test_utils import package import dcos_installer_tools import pytest import test_marathon_lb DCOS_E2E_BACKEND = 'DCOS_E2E_BACKEND' DCOS_E2E_CLUSTER_ID = 'DCOS_E2E_CLUSTER_ID' DCOS_E2E_NODE_TRANSPORT = 'DCOS_E2E_NODE_TRANSPORT' DCOS_LOGIN_UNAME = 'DCOS_LOGIN_UNAME' DCOS_LOGIN_PW = 'DCOS_LOGIN_PW' BACKEND_AWS = 'aws' BACKEND_DOCKER = 'docker' BACKEND_VAGRANT = 'vagrant' MARATHON_LB_IMAGE = os.environ.get('MARATHON_LB_IMAGE', 'marathon-lb:latest') MARATHON_LB_VERSION = os.environ.get('MARATHON_LB_VERSION', 'dev') OSS = 'oss' ENTERPRISE = 'enterprise' VARIANTS = {OSS: dcos_installer_tools.DCOSVariant.OSS, ENTERPRISE: dcos_installer_tools.DCOSVariant.ENTERPRISE} VARIANT_VALUES = dict((value.value, value) for value in VARIANTS.values()) logging.captureWarnings(True) # NOTE(jkoelker) Define some helpers that should eventually be upstreamed def add_user_to_group(self, user, group): return self.put('/groups/{}/users/{}'.format(group, user)) def delete_user_from_group(self, user, group): if not self.user_in_group(user, group): return return self.delete('/groups/{}/users/{}'.format(group, user)) def list_group_users(self, group): r = self.get('/groups/{}/users'.format(group)) r.raise_for_status() return r.json()['array'] def user_in_group(self, user, group): return user in [a['user']['uid'] for a in self.list_group_users(group)] # NOTE(jkoelker) Monkey patch in our helpers dcos_api.DcosApiSession.package = property( lambda s: Package(default_url=s.default_url.copy(path='package'), session=s.copy().session)) dcos_api.DcosApiSession.secrets = property( lambda s: Secrets( default_url=s.default_url.copy(path='secrets/v1'), session=s.copy().session)) dcos_ee_api.EnterpriseApiSession.secrets = property( lambda s: Secrets( default_url=s.default_url.copy(path='secrets/v1'), session=s.copy().session)) dcos_iam.Iam.add_user_to_group = add_user_to_group dcos_iam.Iam.delete_user_from_group = delete_user_from_group dcos_iam.Iam.list_group_users = list_group_users dcos_iam.Iam.user_in_group = user_in_group def test_port(app_deployment, app_port): assert app_port == app_deployment["labels"]["HAPROXY_0_PORT"] def test_response(app_deployment, app_port, agent_public_ip): (response, status_code) = test_marathon_lb.get_app_content(app_port, agent_public_ip) assert status_code == 200 assert response == app_deployment['name']
[ 2, 0, 29412, 18, 198, 198, 11748, 4732, 8019, 198, 11748, 33918, 198, 11748, 18931, 198, 11748, 28686, 198, 198, 6738, 45898, 13, 71, 1031, 6759, 13, 1891, 2412, 1330, 4277, 62, 1891, 437, 198, 6738, 45898, 13, 71, 1031, 6759, 13, 1...
2.295734
1,383
file = open("./input/input1.txt", "r") for s in file: s = s.strip() print('Part 1: ', sumOf(s, 1)) print('Part 2: ', sumOf(s, int(len(s)/2))) file.close()
[ 628, 197, 198, 197, 198, 7753, 796, 1280, 7, 1911, 14, 15414, 14, 15414, 16, 13, 14116, 1600, 366, 81, 4943, 198, 1640, 264, 287, 2393, 25, 198, 197, 82, 796, 264, 13, 36311, 3419, 198, 197, 198, 197, 4798, 10786, 7841, 352, 25, ...
2.074074
81
import numpy as np from cops.graph import Graph from cops.clustering import ClusterProblem, ClusterStructure, inflate_agent_clusters
[ 11748, 299, 32152, 355, 45941, 198, 6738, 14073, 13, 34960, 1330, 29681, 198, 6738, 14073, 13, 565, 436, 1586, 1330, 38279, 40781, 11, 38279, 1273, 5620, 11, 1167, 17660, 62, 25781, 62, 565, 13654, 628, 198 ]
3.75
36
import csv from sys import argv from os import getcwd def generate_memory_list_view(expected_memory) -> str: """ Convert expected memory's bytestring to a list of Cells (in string) :param expected_memory: "A00023" :return: [Cell("A0"), Cell("00"), Cell("23")] """ list_view = "[" for i in range(0, len(expected_memory), 2): list_view += f"Cell(\"{expected_memory[i] + expected_memory[i + 1]}\")," list_view += "]" return list_view def generate_test_case(file_name: str, expected_memory: str, expected_output: str) -> str: """ Generate a test case string to test an *.asm file. :param file_name: *.asm file to test :param expected_memory: Expected memory as bytestring :param expected_output: Expected output from STDOUT :return: String """ with open(file_name) as file: code = file.read() expected_memory_list: str = generate_memory_list_view(expected_memory) output: str = f"""# Generated with SpaceCat TestCase Generator. import unittest from spacecat import assembler, simulator from spacecat.common_utils import Cell test_code = \"\"\"{code}\"\"\" class AlphabetBenchmark(unittest.TestCase): def test_assembler(self): a_ = assembler.Assembler.instantiate(test_code, mem_size={len(expected_memory)//2}) self.assertEqual({expected_memory_list}, a_.memory) def test_simulator(self): a_ = assembler.Assembler.instantiate(test_code, mem_size=128) s_ = simulator.Simulator(mem_size=128, register_size=16, stdout_register_indices=[15]) s_.load_memory(a_.memory) output = "" i = 0 for _ in s_: output += s_.return_stdout() i += 1 if i == 10_000: self.fail("Failed to resolve in given CPU Cycles.") self.assertEqual('{expected_output}', output) if __name__ == '__main__': unittest.main() """ return output if __name__ == "__main__": print("Generating...") if len(argv) > 1: relative_import_directory = argv[1] config_file = argv[2] output_directory = argv[3] else: relative_import_directory = "../../src/data/sample_scripts" config_file="test_files.csv" output_directory="../../src/test/integration_tests" generate_from_config(relative_import_directory, config_file, output_directory)
[ 11748, 269, 21370, 198, 6738, 25064, 1330, 1822, 85, 198, 6738, 28686, 1330, 651, 66, 16993, 198, 198, 4299, 7716, 62, 31673, 62, 4868, 62, 1177, 7, 40319, 62, 31673, 8, 4613, 965, 25, 198, 220, 220, 220, 37227, 198, 220, 220, 220, ...
2.498429
955
car = ['volvo', 'toyota', 'BMW', 'Yes?'] message = f"I would like to own a {car[1].title()}" print(message)
[ 7718, 796, 37250, 10396, 13038, 3256, 705, 83, 726, 4265, 3256, 705, 12261, 54, 3256, 705, 5297, 8348, 60, 198, 20500, 796, 277, 1, 40, 561, 588, 284, 898, 257, 1391, 7718, 58, 16, 4083, 7839, 3419, 36786, 198, 198, 4798, 7, 20500, ...
2.454545
44
""" File: my_drawing Author name: Alan Chen ---------------------- This program will draw a recently famous picture of Gian(), one of the main characters in doraemon(A). This is a picture that originally Gian was scared by something. Here, I reassign the things that scared him is the Illuminati symbol with a string of PYTHON. """ from campy.graphics.gobjects import GOval, GRect, GLine, GLabel, GPolygon, GArc from campy.graphics.gwindow import GWindow w = GWindow(1000, 650) def main(): """ Draw a scared Gian. """ ''' #This is for adjusting the position for i in range(0, 1000, 100): li = GLine(i, 0, i, 650) locatei = GLabel(str(i)) w.add(li) w.add(locatei, i, 20) for j in range(0, 700, 100): lj = GLine(0, j, 1000, j) locatej = GLabel(str(j)) w.add(lj) w.add(locatej, 0, j) ''' #background bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((0, 0)) bg.add_vertex((0, 325)) bg.filled = True bg.fill_color = 'red' bg.color = 'red' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((0, 325)) bg.add_vertex((0, 650)) bg.filled = True bg.fill_color = 'orange' bg.color = 'orange' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((333, 650)) bg.add_vertex((0, 650)) bg.filled = True bg.fill_color = 'lightgreen' bg.color = 'lightgreen' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((333, 650)) bg.add_vertex((666, 650)) bg.filled = True bg.fill_color = 'slategrey' bg.color = 'slategrey' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((1000, 650)) bg.add_vertex((666, 650)) bg.filled = True bg.fill_color = 'darkcyan' bg.color = 'darkcyan' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((1000, 650)) bg.add_vertex((1000, 400)) bg.filled = True bg.fill_color = 'greenyellow' bg.color = 'greenyellow' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((1000, 400)) bg.add_vertex((1000, 200)) bg.filled = True bg.fill_color = 'khaki' bg.color = 'khaki' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((1000, 0)) bg.add_vertex((1000, 200)) bg.filled = True bg.fill_color = 'mistyrose' bg.color = 'mistyrose' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((1000, 0)) bg.add_vertex((666, 0)) bg.filled = True bg.fill_color = 'plum' bg.color = 'plum' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((350, 0)) bg.add_vertex((666, 0)) bg.filled = True bg.fill_color = 'magenta' bg.color = 'magenta' w.add(bg) bg = GPolygon() bg.add_vertex((666, 325)) bg.add_vertex((350, 0)) bg.add_vertex((0, 0)) bg.filled = True bg.fill_color = 'tomato' bg.color = 'tomato' w.add(bg) #body body = GOval(900, 200) body.filled = True body.fill_color = 'Steelblue' body.color = 'blue' w.add(body, 220, 570) #face lower_face = GOval(530, 380) lower_face.filled = True lower_face.fill_color = 'Steelblue' lower_face.color = 'navy' w.add(lower_face, 405, 260) upper_face = GOval(485, 575) upper_face.filled = True upper_face.fill_color = 'Steelblue' upper_face.color = 'Steelblue' w.add(upper_face, 423, 40) shadow_on_face = GOval(420, 330) shadow_on_face.filled = True shadow_on_face.fill_color = 'Cadetblue' shadow_on_face.color = 'Cadetblue' w.add(shadow_on_face, 455, 230) shadow_on_face2 = GOval(390, 370) shadow_on_face2.filled = True shadow_on_face2.fill_color = 'Cadetblue' shadow_on_face2.color = 'Cadetblue' w.add(shadow_on_face2, 480, 170) # right_eye right_eye1 = GOval(90, 90) right_eye1.filled = True right_eye1.fill_color = 'powderblue' right_eye1.color = 'black' w.add(right_eye1, 525, 225) right_eye2 = GOval(45, 80) right_eye2.color = 'black' w.add(right_eye2, 546, 231) right_eye3 = GOval(30, 45) right_eye3.color = 'black' w.add(right_eye3, 552, 253) right_eye4 = GOval(5, 10) right_eye4.filled = True right_eye4.fill_color = 'black' right_eye4.color = 'black' w.add(right_eye4, 565, 271) # left_eye left_eye1 = GOval(90, 90) left_eye1.filled = True left_eye1.fill_color = 'powderblue' left_eye1.color = 'black' w.add(left_eye1, 710, 230) left_eye2 = GOval(60, 80) left_eye2.color = 'black' w.add(left_eye2, 725, 235) left_eye3 = GOval(25, 50) left_eye3.color = 'black' w.add(left_eye3, 740, 250) left_eye4 = GOval(5, 10) left_eye4.filled = True left_eye4.fill_color = 'black' left_eye4.color = 'black' w.add(left_eye4, 750, 270) # nose nose = GOval(80, 52) # 610 351 nose.filled = True nose.fill_color = 'DarkSeaGreen' nose.color = 'black' w.add(nose, 610, 347) # mouse for i in range(10): mouse = GOval(50, 80) mouse.filled = True mouse.fill_color = 'navy' mouse.color = 'navy' w.add(mouse, 560 + 4 * i, 430 - i) for i in range(100): mouse = GOval(50, 80) mouse.filled = True mouse.fill_color = 'navy' mouse.color = 'navy' w.add(mouse, 600 + i, 420) # tongue for i in range(15): tongue = GOval(50, 40) tongue.filled = True tongue.fill_color = 'mediumblue' tongue.color = 'mediumblue' w.add(tongue, 570 + 2 * i, 470 - i) for i in range(10): tongue = GOval(50, 45) tongue.filled = True tongue.fill_color = 'mediumblue' tongue.color = 'mediumblue' w.add(tongue, 600 + i, 455) for i in range(25): tongue = GOval(50, 30) tongue.filled = True tongue.fill_color = 'mediumblue' tongue.color = 'mediumblue' w.add(tongue, 600 + i, 475) for i in range(50): tongue = GOval(50, 45) tongue.filled = True tongue.fill_color = 'mediumblue' tongue.color = 'mediumblue' w.add(tongue, 650 + i, 455) # hair top_hair = GOval(330, 95) top_hair.filled = True top_hair.fill_color = 'navy' top_hair.color = 'navy' w.add(top_hair, 505, 25) bangs = GPolygon() bangs.add_vertex((510, 82)) bangs.add_vertex((620, 82)) bangs.add_vertex((560, 147)) bangs.filled = True bangs.fill_color = 'navy' bangs.color = 'navy' w.add(bangs) bangs = GPolygon() bangs.add_vertex((580, 98)) bangs.add_vertex((690, 98)) bangs.add_vertex((635, 155)) bangs.filled = True bangs.fill_color = 'navy' bangs.color = 'navy' w.add(bangs) bangs = GPolygon() bangs.add_vertex((650, 96)) bangs.add_vertex((770, 96)) bangs.add_vertex((710, 150)) bangs.filled = True bangs.fill_color = 'navy' bangs.color = 'navy' w.add(bangs) bangs = GPolygon() bangs.add_vertex((740, 85)) bangs.add_vertex((825, 85)) bangs.add_vertex((780, 148)) bangs.filled = True bangs.fill_color = 'navy' bangs.color = 'navy' w.add(bangs) for i in range(80): # rightside side = GOval(40, 90) side.filled = True side.fill_color = 'navy' side.color = 'navy' w.add(side, 800 + i, 55 + i ** 1.2) for i in range(100): # leftside side = GOval(40, 40) side.filled = True side.fill_color = 'navy' side.color = 'navy' w.add(side, 500 - i, 60 + i ** 1.2) # right_ear right_ear = GOval(70, 130) right_ear.filled = True right_ear.fill_color = 'Steelblue' right_ear.color = 'blue' w.add(right_ear, 395, 250) right_inear = GOval(50, 80) right_inear.filled = True right_inear.fill_color = 'royalblue' right_inear.color = 'blue' w.add(right_inear, 410, 290) # left_ear left_ear = GOval(70, 130) left_ear.filled = True left_ear.fill_color = 'Steelblue' left_ear.color = 'blue' w.add(left_ear, 880, 260) left_inear = GOval(50, 80) left_inear.filled = True left_inear.fill_color = 'royalblue' left_inear.color = 'blue' w.add(left_inear, 890, 290) # tears t1 = GOval(50, 25) t1.filled = True t1.fill_color = 'aqua' w.add(t1, 525, 300) t1 = GOval(50, 25) t1.filled = True t1.fill_color = 'aqua' w.add(t1, 750, 300) #left tears for i in range(0, 10, 2): tear = GOval(15, 50) tear.filled = True tear.fill_color = 'aqua' tear.color = 'aqua' w.add(tear, 525 - 2* i, 300 + 10 * i) for i in range(0, 10, 2): tear = GOval(21, 40) tear.filled = True tear.fill_color = 'aqua' tear.color = 'aqua' w.add(tear, 515 + i, 400 + 10 * i) for i in range(0, 10, 2): tear = GOval(18, 40) tear.filled = True tear.fill_color = 'aqua' tear.color = 'aqua' w.add(tear, 525, 500 + 10 * i) #right tears for i in range(0, 10, 2): tear = GOval(5, 50) tear.filled = True tear.fill_color = 'aqua' tear.color = 'aqua' w.add(tear, 790 + 2 * i, 300 + 10 * i) for i in range(0, 10, 2): tear = GOval(11, 40) tear.filled = True tear.fill_color = 'aqua' tear.color = 'aqua' w.add(tear, 808 - i, 410 + 10 * i) #lines line1 = GLine(525, 175, 575, 185) w.add(line1) line2 = GLine(575,185, 625, 270) w.add(line2) line3 = GLine(710, 255, 760, 170) w.add(line3) line4 = GLine(651, 400, 651, 420) w.add(line4) line5 = GLine(630, 520, 660, 520) w.add(line5) # Illuminati tri = GPolygon() tri.add_vertex((150, 20)) tri.add_vertex((-20, 280)) tri.add_vertex((320, 280)) tri.filled = True tri.fill_color = 'green' w.add(tri) up_eye = GArc(200, 120, 0, 180) up_eye.filled = True up_eye.fill_color = 'darkgreen' w.add(up_eye, 50, 150) low_eye = GArc(200, 120, -12, -167) low_eye.filled = True low_eye.fill_color = 'darkgreen' low_eye.color = 'darkgreen' w.add(low_eye, 50, 145) eye_ball = GOval(55, 55) eye_ball.filled = True eye_ball.fill_color = 'black' w.add(eye_ball, 125, 150) py = GLabel('PYTHON') py.font = '-50' w.add(py, 20, 280) if __name__ == '__main__': main()
[ 37811, 198, 8979, 25, 616, 62, 19334, 278, 198, 13838, 1438, 25, 12246, 12555, 198, 19351, 438, 198, 1212, 1430, 481, 3197, 257, 2904, 5863, 4286, 286, 30851, 22784, 530, 286, 262, 1388, 3435, 287, 288, 5799, 7966, 7, 32, 737, 198, ...
2.007147
5,317
""" This module doesn't provide a register method and should be skipped. This ensures that the error handling logic works. """
[ 37811, 770, 8265, 1595, 470, 2148, 257, 7881, 2446, 290, 815, 307, 26684, 13, 770, 19047, 326, 262, 4049, 9041, 9156, 2499, 13, 37227, 198 ]
5.08
25
import json import os import subprocess import requests from bs4 import BeautifulSoup from ciri import HelpStr from ciri.utils import ciri_cmd, eor HelpStr.update( { "reddit": { "red(ddit)": { "Description": "Downloads the audio and video from a reddit post.", "Usage": "red(ddit <url>)", }, } } )
[ 11748, 33918, 198, 11748, 28686, 198, 11748, 850, 14681, 198, 198, 11748, 7007, 198, 6738, 275, 82, 19, 1330, 23762, 50, 10486, 198, 198, 6738, 10774, 72, 1330, 10478, 13290, 198, 6738, 10774, 72, 13, 26791, 1330, 10774, 72, 62, 28758, ...
2.156425
179
import requests, json import numpy as np import importlib import pandas as pd import os import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline import pdb import warnings warnings.filterwarnings('ignore')
[ 11748, 7007, 11, 33918, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 1330, 8019, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 28686, 198, 198, 11748, 384, 397, 1211, 355, 3013, 82, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487,...
3.246377
69
from re import I import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import sensor from esphome.const import CONF_ID, STATE_CLASS_MEASUREMENT, UNIT_EMPTY, UNIT_METER # DEPENDENCIES = ["i2c"] AUTO_LOAD = ["sensor", "binary_sensor", "text_sensor"] MULTI_CONF = True CONF_ROODE_ID = "roode_id" roode_ns = cg.esphome_ns.namespace("roode") Roode = roode_ns.class_("Roode", cg.PollingComponent) CONF_ROI_HEIGHT = 'roi_height' CONF_ROI_WIDTH = 'roi_width' CONF_ADVISED_SENSOR_ORIENTATION = 'advised_sensor_orientation' CONF_CALIBRATION = "calibration" CONF_ROI_CALIBRATION = "roi_calibration" CONF_INVERT_DIRECTION = "invert_direction" CONF_MAX_THRESHOLD_PERCENTAGE = "max_threshold_percentage" CONF_MIN_THRESHOLD_PERCENTAGE = "min_threshold_percentage" CONF_MANUAL_THRESHOLD = "manual_threshold" CONF_THRESHOLD_PERCENTAGE = "threshold_percentage" CONF_RESTORE_VALUES = "restore_values" CONF_I2C_ADDRESS = "i2c_address" CONF_SENSOR_MODE = "sensor_mode" CONF_MANUAL = "manual" CONF_MANUAL_ACTIVE = "manual_active" CONF_CALIBRATION_ACTIVE = "calibration_active" CONF_TIMING_BUDGET = "timing_budget" TYPES = [ CONF_RESTORE_VALUES, CONF_INVERT_DIRECTION, CONF_ADVISED_SENSOR_ORIENTATION, CONF_I2C_ADDRESS ] CONFIG_SCHEMA = (cv.Schema({ cv.GenerateID(): cv.declare_id(Roode), cv.Optional(CONF_INVERT_DIRECTION, default='false'): cv.boolean, cv.Optional(CONF_RESTORE_VALUES, default='false'): cv.boolean, cv.Optional(CONF_ADVISED_SENSOR_ORIENTATION, default='true'): cv.boolean, cv.Optional(CONF_I2C_ADDRESS, default=0x29): cv.uint8_t, cv.Exclusive( CONF_CALIBRATION, "mode", f"Only one mode, {CONF_MANUAL} or {CONF_CALIBRATION} is usable"): cv.Schema({ cv.Optional(CONF_CALIBRATION_ACTIVE, default='true'): cv.boolean, cv.Optional(CONF_MAX_THRESHOLD_PERCENTAGE, default=85): cv.int_range(min=50, max=100), cv.Optional(CONF_MIN_THRESHOLD_PERCENTAGE, default=0): cv.int_range(min=0, max=100), cv.Optional(CONF_ROI_CALIBRATION, default='false'): cv.boolean, }), cv.Exclusive( CONF_MANUAL, "mode", f"Only one mode, {CONF_MANUAL} or {CONF_CALIBRATION} is usable"): cv.Schema({ cv.Optional(CONF_MANUAL_ACTIVE, default='true'): cv.boolean, cv.Optional(CONF_TIMING_BUDGET, default=10): cv.int_range(min=10, max=1000), cv.Inclusive( CONF_SENSOR_MODE, "manual_mode", f"{CONF_SENSOR_MODE}, {CONF_ROI_HEIGHT}, {CONF_ROI_WIDTH} and {CONF_MANUAL_THRESHOLD} must be used together", ): cv.int_range(min=-1, max=2), cv.Inclusive( CONF_ROI_HEIGHT, "manual_mode", f"{CONF_SENSOR_MODE}, {CONF_ROI_HEIGHT}, {CONF_ROI_WIDTH} and {CONF_MANUAL_THRESHOLD} must be used together", ): cv.int_range(min=4, max=16), cv.Inclusive( CONF_ROI_WIDTH, "manual_mode", f"{CONF_SENSOR_MODE}, {CONF_ROI_HEIGHT}, {CONF_ROI_WIDTH} and {CONF_MANUAL_THRESHOLD} must be used together", ): cv.int_range(min=4, max=16), cv.Inclusive( CONF_MANUAL_THRESHOLD, "manual_mode", f"{CONF_SENSOR_MODE}, {CONF_ROI_HEIGHT}, {CONF_ROI_WIDTH} and {CONF_MANUAL_THRESHOLD} must be used together", ): cv.int_range(min=40, max=4000), }), }).extend(cv.polling_component_schema("100ms")))
[ 6738, 302, 1330, 314, 198, 11748, 1658, 746, 462, 13, 8189, 5235, 355, 269, 70, 198, 11748, 1658, 746, 462, 13, 11250, 62, 12102, 341, 355, 269, 85, 198, 6738, 1658, 746, 462, 13, 5589, 3906, 1330, 12694, 198, 6738, 1658, 746, 462, ...
1.943112
1,793
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'D:\Projects\Python\Folder Maker\GUI\main.ui' # # Created by: PyQt5 UI code generator 5.12.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets if __name__ == "__main__": import sys app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 2, 5178, 7822, 7560, 422, 3555, 334, 72, 2393, 705, 35, 7479, 16775, 82, 59, 37906, 59, 41092, 21521, 59, 40156, 59, 12417, 13, 9019, 6, 198, 2, 198, 2, 15622, ...
2.515
200
# -------------- # Import packages import numpy as np import pandas as pd from scipy.stats import mode # code starts here bank = pd.read_csv(path) categorical_var = bank.select_dtypes(include = 'object') print(categorical_var) numerical_var = bank.select_dtypes(include = 'number') print(numerical_var) # code ends here # -------------- # code starts here banks = bank.drop(columns='Loan_ID') print(banks.isnull().sum()) bank_mode = banks.mode() #print(bank_mode) banks = banks.fillna(0) print(banks.isna().sum()) #code ends here # -------------- # Code starts here avg_loan_amount = pd.pivot_table(data=banks, index=['Gender', 'Married', 'Self_Employed'],values='LoanAmount', aggfunc=np.mean) # code ends here # -------------- # code starts here loan_approved_se = banks[(banks['Self_Employed']=='Yes')&(banks['Loan_Status']=='Y')].shape[0] loan_approved_nse=banks[(banks['Self_Employed']=='No')&(banks['Loan_Status']=='Y')].shape[0] Loan_Status = 614 percentage_se = (loan_approved_se/Loan_Status)*100 percentage_nse = (loan_approved_nse/Loan_Status)*100 # code ends here # -------------- # code starts here banks.Loan_Amount_Term.iloc[0] loan_term = banks['Loan_Amount_Term'].apply(lambda x: int(x)/12) banks['Loan_Amount_Term']=banks['Loan_Amount_Term'].apply(lambda x: int(x)/12) big_loan_term= banks[banks['Loan_Amount_Term']>=25].shape[0] # code ends here # -------------- # code starts here columns_to_show = ['ApplicantIncome', 'Credit_History'] loan_groupby = banks.groupby(by='Loan_Status') loan_groupby = loan_groupby[columns_to_show] mean_values = loan_groupby.agg([np.mean]) # code ends here
[ 2, 220, 26171, 198, 2, 17267, 10392, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 629, 541, 88, 13, 34242, 1330, 4235, 220, 198, 198, 2, 2438, 4940, 994, 198, 17796, 796, 279, 67, 13, 961, 6...
2.65798
614
import pytest import torch from espnet2.tts.feats_extract.energy import Energy
[ 11748, 12972, 9288, 198, 11748, 28034, 198, 198, 6738, 15024, 3262, 17, 13, 83, 912, 13, 5036, 1381, 62, 2302, 974, 13, 22554, 1330, 6682, 628, 628 ]
3.074074
27
"""Official merge script for PI-SQuAD v0.1""" from __future__ import print_function import os import argparse import json import sys import shutil import scipy.sparse import scipy.sparse.linalg import numpy as np import numpy.linalg if __name__ == '__main__': squad_expected_version = '1.1' parser = argparse.ArgumentParser(description='Official merge script for PI-SQuAD v0.1') parser.add_argument('data_path', help='Dataset file path') parser.add_argument('context_emb_dir', help='Context embedding directory') parser.add_argument('question_emb_dir', help='Question embedding directory') parser.add_argument('pred_path', help='Prediction json file path') parser.add_argument('--sparse', default=False, action='store_true', help='Whether the embeddings are scipy.sparse or pure numpy.') parser.add_argument('--metric', type=str, default='ip', help='ip|l1|l2 (inner product or L1 or L2 distance)') parser.add_argument('--progress', default=False, action='store_true', help='Show progress bar. Requires `tqdm`.') args = parser.parse_args() with open(args.data_path) as dataset_file: dataset_json = json.load(dataset_file) if dataset_json['version'] != squad_expected_version: print('Evaluation expects v-' + squad_expected_version + ', but got dataset with v-' + dataset_json['version'], file=sys.stderr) dataset = dataset_json['data'] q2c = get_q2c(dataset) predictions = get_predictions(args.context_emb_dir, args.question_emb_dir, q2c, sparse=args.sparse, metric=args.metric, progress=args.progress) with open(args.pred_path, 'w') as fp: json.dump(predictions, fp)
[ 37811, 28529, 20121, 4226, 329, 30434, 12, 50, 4507, 2885, 410, 15, 13, 16, 37811, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 198, 11748, 28686, 198, 11748, 1822, 29572, 198, 11748, 33918, 198, 11748, 25064, 198, 11748, 44...
2.512605
714
from functools import cached_property from datetime import datetime from math import degrees, radians, sin, cos import numpy as np from orbit_predictor import coordinate_systems from .utils import get_timezone_from_latlon from .time import make_utc from ._time import datetime2mjd from .solar import sun_pos_mjd from ._rotations import elevation_at_rad try: from zoneinfo import ZoneInfo except ImportError: from backports.zoneinfo import ZoneInfo def sun_elevation(self, d: datetime) -> float: """ Computes elevation angle of sun relative to location. Returns degrees. """ d2 = make_utc(d) mjd = datetime2mjd(d2) return self._sun_elevation_mjd(mjd) def is_sunlit(self, dt: datetime) -> bool: """ Computes elevation angle of sun relative to location Returns True if elevation > -6 degrees """ el = self.sun_elevation(dt) return el > -6 def _is_sunlit_mjd(self, mjd: float) -> bool: """ Computes elevation angle of sun relative to location Returns True if elevation > -6 degrees """ el = self._sun_elevation_mjd(mjd) return el > -6
[ 6738, 1257, 310, 10141, 1330, 39986, 62, 26745, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 10688, 1330, 7370, 11, 2511, 1547, 11, 7813, 11, 8615, 198, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 13066, 62, 79, 17407, 273, ...
2.477366
486
import subprocess import numpy as np import pickle import argparse import os from rl_baselines.student_eval import allPolicy from srl_zoo.utils import printRed, printGreen from rl_baselines.evaluation.cross_eval_utils import EnvsKwargs, loadConfigAndSetup, policyEval,createEnv if __name__ == '__main__': parser = argparse.ArgumentParser(description="Evaluation after training") parser.add_argument('--log-dir',type=str, default='' ,help='RL algo to use') parser.add_argument('--task-label', type=str, default='', help='task to evaluate') parser.add_argument('--episode', type=str, default='', help='evaluation for the policy saved at this episode') parser.add_argument('--policy-path', type=str, default='', help='policy path') parser.add_argument('--seed', type=int, default=0, help='policy path') args, unknown = parser.parse_known_args() reward, _ = policyCrossEval(args.log_dir, args.task_label, episode=args.episode, model_path=args.policy_path, num_timesteps=251,seed=args.seed) saveReward(args.log_dir, reward, args.task_label, save_name='episode_eval.pkl')
[ 198, 11748, 850, 14681, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2298, 293, 198, 11748, 1822, 29572, 198, 11748, 28686, 198, 198, 6738, 374, 75, 62, 12093, 20655, 13, 50139, 62, 18206, 1330, 220, 477, 36727, 198, 6738, 19677, 75,...
2.416667
528
#! /usr/bin/env python import os os.system("make clean; make; \\rm *.log log.list") ############################################ #dir1='TriggerValidation_223_HLT' #dir2='TriggerValidation_224_HLT' #out='223_vs_224' #samples=['LM1'] #prefix1 = "histo_" #prefix2 = "histo_" #sufix1 = "_IDEALV11" #sufix2 = "_IDEALV11_v1" #label1 = "LM1_223" #label2 = "LM1_224" ############################################ #dir1='TriggerValidation_224_HLT' #dir2='TriggerValidation_300pre2_HLT' #out='224_vs_300pre2' #samples=['LM1'] #prefix1 = "histo_" #prefix2 = "histo_" #sufix1 = "_IDEALV11_v1" #sufix2 = "_IDEALV9" #label1 = "LM1_223" #label2 = "LM1_300pre2" ############################################ #dir1='TriggerValidation_224_HLT' #dir2='TriggerValidation_300pre6_HLT' #out='224_vs_300pre6' #samples=['LM1'] #prefix1 = "histo_" #prefix2 = "histo_" #sufix1 = "_IDEALV11_v1" #sufix2 = "_IDEAL_30x_v1" #label1 = "LM1_223" #label2 = "LM1_300pre6" ############################################ dir1='/afs/cern.ch/user/c/chiorbo/scratch0/SUSY_2007/TriggerValidation/TriggerValidation_DQM_312_commit_V00-06-00/src/HLTriggerOffline/SUSYBSM/test' dir2='/afs/cern.ch/user/c/chiorbo/scratch0/SUSY_2007/TriggerValidation/TriggerValidation_DQM_312_commit_V00-06-00/src/HLTriggerOffline/SUSYBSM/test' out='mc1_vs_mc2' samples=['_HLT'] prefix1 = "DQM_V0001" prefix2 = "DQM_V0001" sufix1 = "_R000000001" sufix2 = "_R000000001_2" label1 = "HLT" label2 = "HLT" ############################################ os.system('mkdir html/'+out) #create html index page os.system('cp html/template/index.html html/'+out+'/index.html') #create the cover page inputhtml = open('html/template/beginning.html') outputhtml = open('html/'+out+'/cover.html','w') for line in inputhtml: # remove .root if line.find('<!-- Here python will write the name of first release -->') != -1: outputhtml.write(dir1) # remove .root elif line.find('<!-- Here python will write the name of second release -->') != -1: outputhtml.write(dir2) else: outputhtml.write(line) continue inputhtml.close() outputhtml.close() #create the menu page os.system('cp html/template/menu_beginning.html html/'+out+'/menu.html') for sample in samples: tmp1 = open('tmp.html','w') tmp2 = open('html/template/menu_body.html') for line in tmp2: if line.find('thissample') != -1: newline = line.replace('thissample',sample) tmp1.write(newline) else: tmp1.write(line) continue tmp1.close() tmp2.close() os.system('more tmp.html >> html/'+out+'/menu.html') os.system('rm tmp.html') continue os.system('more html/template/menu_end.html >> html/'+out+'/menu.html') #run the code for each sample for sample in samples: file1 = dir1+'/'+prefix1+sample+sufix1+'.root' file2 = dir2+'/'+prefix2+sample+sufix2+'.root' outputfile = 'outputfile.root' #create html page for this sample inputhtml = open('html/template/comp_beginning.html') os.system('mkdir html/'+out+'/'+sample) outputhtml = open('html/'+out+'/'+sample+'/comparison.html','w') # add right version names in the html for line in inputhtml: if line.find('<!-- Here python will write the name of first release -->') != -1: outputhtml.write(dir1) elif line.find('<!-- Here python will write the name of second release -->') != -1: outputhtml.write(dir2) elif line.find('<!-- Here python will write the name of the model -->') != -1: outputhtml.write(sample) elif line.find('thissample') != -1: newline = line.replace('thissample',sample) outputhtml.write(newline) else: outputhtml.write(line) continue inputhtml.close() outputhtml.close() # run the comparison os.system('./triggerComparison.x -File1='+file1+' -File2='+file2+' -OutputFile='+outputfile+' -label1='+label1+' -label2='+label2) # for old names # os.system('./triggerComparison.x --oldL1names -File1='+file1+' -File2='+file2+' -OutputFile='+outputfile+' -label1='+label1+' -label2='+label2) os.system('mv HLTcomparison.log html/'+out+'/'+sample) os.system('mv L1comparison.log html/'+out+'/'+sample) # mv root file to the html directory os.system('mv '+outputfile+' html/'+out+'/'+sample) # add eff and residual pulls to the html os.system('more html/template/comp.html >> html/'+out+'/'+sample+'/comparison.html') # link the compatibility maps os.system('more compatibility.html >> html/'+out+'/'+sample+'/comparison.html') # create jpg files os.system("ls *eps > listeps.log") listeps = open("listeps.log") for epsfile in listeps: os.system("convert \""+epsfile[:-1]+"\" \""+epsfile[:-4]+"jpg\"") thefile = open('html/'+out+'/'+sample+'/comparison.html',"r+") # link HLT files #thefile.seek(0,2) #thefile.write('<tr><td><center><table>\n') #listeps.seek(0) #for epsfile in listeps: # if(epsfile.find('HLT') != -1): #this is a plot of a trigger path # tmp1 = open('html/template/addplot.html') # for line in tmp1: # newline = line.replace('triggerpath',epsfile[:-5]) # thefile.write(newline+'\n') # continue # continue # continue #thefile.write('</table></center></td>\n') # link L1 files #thefile.write('<td><center><table>\n') #listeps.seek(0) #for epsfile in listeps: # if(epsfile.find('L1') != -1): #this is a plot of a trigger path # if(epsfile.find('A_') != -1): #this is a plot of a trigger path # tmp1 = open('html/template/addplot.html') # for line in tmp1: # newline = line.replace('triggerpath',epsfile[:-5]) # thefile.write(newline+'\n') # continue # continue # continue #thefile.write('</table></center></td></tr>\n') #thefile.close() # write end of the comparison web page os.system('more html/template/end.html >> html/'+out+'/'+sample+'/comparison.html') # move all eps and jpg files in the proper directory os.system('mv *jpg html/'+out+'/'+sample+'/') os.system('mv *eps html/'+out+'/'+sample+'/') continue os.system('\\rm listeps.log')
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 28686, 198, 418, 13, 10057, 7203, 15883, 3424, 26, 787, 26, 26867, 26224, 46866, 6404, 2604, 13, 4868, 4943, 628, 198, 29113, 7804, 4242, 198, 198, 2, 15908, 16, 11639, 48344,...
2.329638
2,706
from curses import echo from importlib.metadata import metadata import sqlite3 import sys import sqlalchemy import os from sqlalchemy import Column, Integer, String, ForeignKey, Table, MetaData, create_engine, engine_from_config from sqlalchemy.orm import relationship, backref, sessionmaker from sqlalchemy.ext.declarative import declarative_base from database import DataBase Base = declarative_base() # def db_connect(db_name): # """ # Performs database connection using database settings from settings.py. # Returns sqlalchemy engine instance # """ name = "test" db = DataBase(name) passphrase = "test" AuthentificationPros = Authentification(db, name, passphrase)
[ 6738, 43878, 1330, 9809, 198, 6738, 1330, 8019, 13, 38993, 1330, 20150, 198, 11748, 44161, 578, 18, 198, 11748, 25064, 198, 11748, 44161, 282, 26599, 198, 11748, 28686, 198, 6738, 44161, 282, 26599, 1330, 29201, 11, 34142, 11, 10903, 11, ...
3.455
200
# -*- coding: utf-8 -*- from django_cas.decorators import login_required from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render, redirect from mecc.apps.years.models import UniversityYear
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 42625, 14208, 62, 34004, 13, 12501, 273, 2024, 1330, 17594, 62, 35827, 198, 6738, 42625, 14208, 13, 7295, 13, 1069, 11755, 1330, 9515, 13921, 3673, 3109, 396, ...
3.275362
69
# coding=utf-8 from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde # Generated with OTLEnumerationCreator. To modify: extend, do not edit
[ 2, 19617, 28, 40477, 12, 23, 198, 6738, 440, 14990, 44, 3913, 13, 2394, 43, 17633, 13, 27354, 265, 9497, 13, 8896, 10277, 417, 2926, 301, 15878, 1330, 3873, 10277, 417, 2926, 301, 15878, 198, 6738, 440, 14990, 44, 3913, 13, 2394, 43...
2.655172
87
import logging import threading import time
[ 11748, 18931, 198, 11748, 4704, 278, 198, 11748, 640, 628 ]
4.5
10
from befh.ws_api_socket import WebSocketApiClient from befh.market_data import L2Depth, Trade from befh.exchanges.gateway import ExchangeGateway from befh.instrument import Instrument from befh.util import Logger from befh.clients.sql_template import SqlClientTemplate import time import threading import json from functools import partial from datetime import datetime if __name__ == '__main__': exchange_name = 'Okex' instmt_name = 'BCHBTC' instmt_code = 'BCH_BTC' instmt = Instrument(exchange_name, instmt_name, instmt_code) db_client = SqlClientTemplate() Logger.init_log() exch = ExchGwOkexSpot([db_client]) td = exch.start(instmt)
[ 6738, 307, 69, 71, 13, 18504, 62, 15042, 62, 44971, 1330, 5313, 39105, 32, 14415, 11792, 198, 6738, 307, 69, 71, 13, 10728, 62, 7890, 1330, 406, 17, 48791, 11, 9601, 198, 6738, 307, 69, 71, 13, 1069, 36653, 13, 10494, 1014, 1330, ...
2.740891
247
from cloudflare_ddns.configuration import Configuration, SiteConfiguration from cloudflare_ddns.ddns import CloudflareDDNS __all__ = ["CloudflareDDNS", "Configuration", "SiteConfiguration"]
[ 6738, 6279, 2704, 533, 62, 1860, 5907, 13, 11250, 3924, 1330, 28373, 11, 14413, 38149, 198, 6738, 6279, 2704, 533, 62, 1860, 5907, 13, 1860, 5907, 1330, 10130, 2704, 533, 16458, 8035, 198, 198, 834, 439, 834, 796, 14631, 18839, 2704, ...
3.603774
53
from .base import PipBaseRecipe
[ 6738, 764, 8692, 1330, 25149, 14881, 37523, 628 ]
4.125
8
#!/usr/bin/python # combiner.py import sys word_count = 0 line_count = 0 for line in sys.stdin: words, lines = line.strip().split('\t') word_count += int(words) line_count += int(lines) print("{0}\t{1}".format(word_count, line_count))
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 2, 1974, 7274, 13, 9078, 198, 198, 11748, 25064, 198, 198, 4775, 62, 9127, 796, 657, 198, 1370, 62, 9127, 796, 657, 198, 198, 1640, 1627, 287, 25064, 13, 19282, 259, 25, 198, 220, 220, 22...
2.427184
103
import re from radish.stepregistry import step from radish import when, then from radish.terrain import world
[ 11748, 302, 198, 198, 6738, 2511, 680, 13, 9662, 2301, 4592, 1330, 2239, 198, 6738, 2511, 680, 1330, 618, 11, 788, 198, 6738, 2511, 680, 13, 353, 3201, 1330, 995, 628, 628 ]
3.5625
32
from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.http.response import HttpResponseBadRequest, HttpResponseRedirect from django.urls import reverse_lazy from django.urls.base import reverse from django.views.generic import CreateView, DeleteView, DetailView, View from .forms import AnswerForm, QuestionForm from .models import Answer, Like, Question User = get_user_model()
[ 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 1330, 651, 62, 7220, 62, 19849, 198, 6738, 42625, 14208, 13, 3642, 822, 13, 18439, 13, 19816, 1040, 1330, 23093, 37374, 35608, 259, 198, 6738, 42625, 14208, 13, 7295, 13, 1069, 11755, 1330, ...
3.533784
148
#!/usr/bin/env python from distutils.core import setup setup( name = 'pydouban', version = '1.0.0', description = 'Lightweight Python Douban API Library', author = 'Marvour', author_email = 'marvour@gmail.com', license = 'BSD License', url = 'http://i.shiao.org/a/pydouban', packages = ['pydouban'], )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 6738, 1233, 26791, 13, 7295, 1330, 9058, 198, 198, 40406, 7, 198, 220, 220, 220, 1438, 796, 705, 79, 5173, 280, 3820, 3256, 198, 220, 220, 220, 2196, 796, 705, 16, 13, 15, 13,...
2.434783
138