content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
import threading import time import random from multiprocessing.pool import ThreadPool from PyQt5 import QtCore, QtGui, QtWidgets bandera = False val1 = "" msg = 'Caballo ganador es: {}' # Clase Caballo
[ 11748, 4704, 278, 201, 198, 11748, 640, 201, 198, 11748, 4738, 201, 198, 6738, 18540, 305, 919, 278, 13, 7742, 1330, 14122, 27201, 201, 198, 201, 198, 6738, 9485, 48, 83, 20, 1330, 33734, 14055, 11, 33734, 8205, 72, 11, 33734, 54, 3...
2.55814
86
# Copyright 2019-2021 Wingify Software Pvt. Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from ..helpers import impression_util from ..constants import constants from ..constants.constants import API_METHODS from ..helpers import campaign_util, validate_util from ..enums.log_message_enum import LogMessageEnum from ..enums.file_name_enum import FileNameEnum from ..enums.log_level_enum import LogLevelEnum FILE = FileNameEnum.Api.Track def _track(vwo_instance, campaign_specifier, user_id, goal_identifier, **kwargs): """ This API method: Marks the conversion of the campaign(s) for a particular goal 1. validates the arguments being passed 2. retrieves the campaigns having the same global goal 3. calls track_campaign_goal for all the goals Args: campaign_specifier (None, list, string): Campaign key(s), it can be None in case of all campaigns, list in case of given campaigns and string in case of particular campaign should to be tracked. user_id (string): ID assigned to a user goal_identifier (string): campaign(s)'s unique goal identifier Keyword Args: revenue_value (int|float|string): Provide it through **kwargs. It is the revenue generated on triggering the goal custom_variables (dict): Custom variables required for segmentation variation_targeting_variables (dict): Whitelisting variables to target users Returns: dict|None: None if called for single campaign and no goal tracked or called for all campaigns and no goal tracked. Dict otherwise of campaign_key with True/False showing whether the goal has been tracked for the campaign or not """ vwo_instance.logger.set_api(API_METHODS.TRACK) # Retrive revenue value and custom_variables revenue_value = kwargs.get("revenue_value") custom_variables = kwargs.get("custom_variables") variation_targeting_variables = kwargs.get("variation_targeting_variables") valid_params = True # Check for valid args if ( not validate_util.is_valid_string(user_id) or not validate_util.is_valid_string(goal_identifier) or (custom_variables is not None and not validate_util.is_valid_dict(custom_variables)) or ( variation_targeting_variables is not None and not validate_util.is_valid_dict(variation_targeting_variables) ) or (revenue_value is not None and not validate_util.is_valid_basic_data_type(revenue_value)) ): valid_params = False goal_type_to_track = kwargs.get("goal_type_to_track") if goal_type_to_track is None: goal_type_to_track = vwo_instance.goal_type_to_track elif not validate_util.is_valid_goal_type(goal_type_to_track): valid_params = False if not valid_params: vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.TRACK_API_INVALID_PARAMS.format(file=FILE) ) return None campaigns_without_goal = [] no_campaign_found = False if type(campaign_specifier) is str: campaign = campaign_util.get_campaign(vwo_instance.settings_file, campaign_specifier) goal = campaign_util.get_campaign_goal(campaign, goal_identifier) if not goal: no_campaign_found = True else: campaign_goal_list = [(campaign, goal)] elif type(campaign_specifier) is list: campaigns = campaign_util.get_campaigns(vwo_instance.settings_file, campaign_specifier).values() (campaign_goal_list, campaigns_without_goal) = campaign_util.get_campaigns_with_goal_id( campaigns, goal_identifier ) for campaign in campaigns_without_goal: vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.TRACK_API_GOAL_NOT_FOUND.format( file=FILE, goal_identifier=goal_identifier, user_id=user_id, campaign_key=campaign.get("key") ), ) elif campaign_specifier is None: campaigns = vwo_instance.settings_file.get("campaigns") campaign_goal_list = campaign_util.get_campaigns_with_goal_id(campaigns, goal_identifier)[0] if not campaign_goal_list: no_campaign_found = True else: vwo_instance.logger.log( # Specific log for campaign_specifier type LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.TRACK_API_INVALID_PARAMS.format(file=FILE), ) return None if no_campaign_found: vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.NO_CAMPAIGN_FOUND.format(file=FILE, goal_identifier=goal_identifier), ) return None ret_value = {} campaign_goal_revenue_prop_list = [] for campaign, goal in campaign_goal_list: result = track_campaign_goal( vwo_instance, campaign, user_id, goal, revenue_value, custom_variables, variation_targeting_variables, goal_type_to_track, campaign_goal_revenue_prop_list, ) ret_value[campaign.get("key")] = result for campaign in campaigns_without_goal: ret_value[campaign.get("key")] = False if len(campaign_goal_revenue_prop_list) != 0 and ( not vwo_instance.is_event_batching_enabled and vwo_instance.is_event_arch_enabled is True ): params = impression_util.get_events_params(vwo_instance.settings_file, goal_identifier) impression = impression_util.create_track_goal_events_impression( vwo_instance.settings_file, user_id, goal_identifier, campaign_goal_revenue_prop_list, revenue=revenue_value ) vwo_instance.event_dispatcher.dispatch_events(params=params, impression=impression) return ret_value def track_campaign_goal( vwo_instance, campaign, user_id, goal, revenue_value, custom_variables, variation_targeting_variables, goal_type_to_track, campaign_goal_revenue_prop_list, ): """ It marks the conversion of given goal for the given campaign 1. Checks if user is eligible to get bucketed into the campaign, 2. Gets the assigned determinitic variation to the user(based on userId), if user becomes part of campaign 3. Sends an impression call to VWO server to track goal data if event arch is not enabled Args: campaign (dict): Campaign object user_id (string): ID assigned to a user goal (dict): Goal object revenue_value (int|float|string): It is the revenue generated on triggering the goal custom_variables (dict): Custom variables required for segmentation variation_targeting_variables (dict): Whitelisting variables to target users goal_type_to_track (vwo.GOAL_TYPES): Goal type that should be tracked in case of mixed global goal identifier campaign_goal_revenue_prop_list (list): list of campaign_id, goal_id & goal's revenueProp (if revenue goal else None) to build event arch impression Returns: bool: True if goal successfully tracked else False """ campaign_type = campaign.get("type") if campaign_type == constants.CAMPAIGN_TYPES.FEATURE_ROLLOUT: vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.INVALID_API.format( file=FILE, user_id=user_id, campaign_key=campaign.get("key"), campaign_type=campaign_type ), ) return False goal_type = goal.get("type") if (goal_type_to_track == constants.GOAL_TYPES.CUSTOM and goal_type == constants.GOAL_TYPES.REVENUE) or ( goal_type_to_track == constants.GOAL_TYPES.REVENUE and goal_type == constants.GOAL_TYPES.CUSTOM ): # We can log goal type didn't match in debug mode return False if goal_type == constants.GOAL_TYPES.REVENUE and not validate_util.is_valid_value(revenue_value): vwo_instance.logger.log( LogLevelEnum.ERROR, LogMessageEnum.ERROR_MESSAGES.TRACK_API_REVENUE_NOT_PASSED_FOR_REVENUE_GOAL.format( file=FILE, user_id=user_id, goal_identifier=goal.get("identifier"), campaign_key=campaign.get("key") ), ) return False if goal_type == constants.GOAL_TYPES.CUSTOM: revenue_value = None variation, _ = vwo_instance.variation_decider.get_variation( user_id, campaign, custom_variables=custom_variables, variation_targeting_variables=variation_targeting_variables, goal_data={"identifier": goal.get("identifier")}, api_method=constants.API_METHODS.TRACK, ) if variation: if not vwo_instance.is_event_arch_enabled or vwo_instance.is_event_batching_enabled is True: impression = impression_util.create_impression( vwo_instance.settings_file, campaign.get("id"), variation.get("id"), user_id, goal.get("id"), revenue_value, ) vwo_instance.event_dispatcher.dispatch(impression) vwo_instance.logger.log( LogLevelEnum.INFO, LogMessageEnum.INFO_MESSAGES.MAIN_KEYS_FOR_IMPRESSION.format( file=FILE, campaign_id=impression.get("experiment_id"), account_id=impression.get("account_id"), variation_id=impression.get("combination"), ), ) else: campaign_goal_revenue_prop_list.append((campaign.get("id"), goal.get("id"), goal.get("revenueProp"))) return True return False
[ 2, 15069, 13130, 12, 1238, 2481, 13405, 1958, 10442, 18367, 83, 13, 12052, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, ...
2.445205
4,234
# -*- coding: utf-8 -*- #import some dope import sys import os import re import time from random import randrange from itertools import repeat numbers = { 'adam' :"+41111111111", 'bob' :"+41222222222", 'chris' :"+41333333333", 'dave' :"+41444444444", } print "Gespeicherte Empfnger: " for name in numbers: print "%10s - %s"%(name,numbers[name]) number = "" while number == "": numberID = raw_input("\nEmpfnger eingeben: ") if numberID in numbers: number = numbers[numberID] pause = int(raw_input("\nIntervall in Sekunden: ")) print """ Verfgbare Optionen: [1] Zeitansagen im Format 'Es ist 17:34:22' [2] Zufllige 'Chuck Norris' Jokes [3] Satz fr Satz aus einem Buch (Twilight) [4] Fifty Shades of HEX [5] Frhliches Flaggen raten """ option = int(raw_input("Option auswhlen: ")) if option == 1: anzahl = int(raw_input("\nAnzahl Nachrichten: ")) start = 0 elif option == 2: anzahl = int(raw_input("\nAnzahl Nachrichten: ")) start = 0 replaceName = raw_input("\n'Chuck Norris' durch Namen ersetzen: ") if replaceName == "": replaceName = "Chuck Norris" elif option == 3: p = open('content/twilight.txt') book = p.read() pat = re.compile(r'([A-Z][^\.!?]*[\.!?])', re.M) sentences = pat.findall(book) anzahl = int(raw_input("\nAnzahl Nachrichten: ")) start = int(raw_input("\nBei n. Satz anfangen: "))-1 anzahl = anzahl + (start) elif option == 4: anzahl = 50 start = 0 elif option == 5: anzahl = 50 start = 0 import Countries else: anzahl = 0 start = 0 print "\n\nSenden beginnt...\n\n" #tunay bei 207 for i in range(start,anzahl,1): if option == 1: cmdCode = "date +'%H:%M:%S'" message = "Es ist jetzt " + os.popen(cmdCode).read() elif option == 2: curlCode = "curl 'http://api.icndb.com/jokes/random' -s | sed -e 's/.*joke\\\": \\\"//' -e 's/\\\", \\\".*//' -e 's/Chuck Norris/" + replaceName + "/g' -e 's/"/\"/g'" message = os.popen(curlCode).read() elif option == 3: message = sentences[i] elif option == 4: message = "#%s" % "".join(list(repeat(hex(randrange(16, 255))[2:],3))).upper() elif option == 5: flags = os.listdir("content/flags") country = Countries.iso[flags[randrange(1,len(flags))][:2]] message = "Dies ist die Flagge von '%s'."%(country["Name"]) filePath = os.path.abspath("content/flags/%s.png"%country["ISO"]) osaCode = "osascript sendImage.scpt \"%s\" \"%s\""%(number,filePath) osaReturn = os.popen(osaCode).read() print message message = message.replace('"', r'\"') osaCode = "osascript sendText.scpt \"%s\" \"%s\""%(number,message) print "%3d > %s"%((i+1),message) osaReturn = os.popen(osaCode).read() time.sleep(pause)
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 11748, 617, 45654, 198, 11748, 25064, 198, 11748, 28686, 198, 11748, 302, 198, 11748, 640, 198, 6738, 4738, 1330, 43720, 9521, 198, 6738, 340, 861, 10141, 1330, 9585, ...
2.278912
1,176
# Copyright (c) 2020 NVIDIA Corporation # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. """Convert a .mesh file (fTetWild format) to .tet (IsaacGym format).""" def convert_mesh_to_tet(mesh_file_path, tet_output_path): """Convert a .mesh file to a .tet file.""" mesh_file = open(mesh_file_path, "r") tet_output = open(tet_output_path, "w") mesh_lines = list(mesh_file) mesh_lines = [line.strip('\n') for line in mesh_lines] vertices_start = mesh_lines.index('Vertices') num_vertices = mesh_lines[vertices_start + 1] vertices = mesh_lines[vertices_start + 2:vertices_start + 2 + int(num_vertices)] tetrahedra_start = mesh_lines.index('Tetrahedra') num_tetrahedra = mesh_lines[tetrahedra_start + 1] tetrahedra = mesh_lines[tetrahedra_start + 2:tetrahedra_start + 2 + int(num_tetrahedra)] print("# Vertices, # Tetrahedra:", num_vertices, num_tetrahedra) # Write to tet output tet_output.write("# Tetrahedral mesh generated using\n\n") tet_output.write("# " + num_vertices + " vertices\n") for v in vertices: tet_output.write("v " + v + "\n") tet_output.write("\n") tet_output.write("# " + num_tetrahedra + " tetrahedra\n") for t in tetrahedra: line = t.split(' 0')[0] line = line.split(" ") line = [str(int(k) - 1) for k in line] l_text = ' '.join(line) tet_output.write("t " + l_text + "\n") if __name__ == "__main__": convert_mesh_to_tet( "path/to/mesh", "path/to/tet")
[ 2, 15069, 357, 66, 8, 12131, 15127, 10501, 198, 198, 2, 2448, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 198, 2, 257, 4866, 286, 428, 3788, 290, 3917, 10314, 3696, 357, 1169, 366, 25423, 12340, 198, 2, ...
2.640082
978
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # NOQA from future import standard_library standard_library.install_aliases() # NOQA import unittest import chainer import chainer.functions as F from chainer import testing from chainer.testing import attr import numpy as np import chainerrl
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 6738, 11593, 37443, 834, 1330, 7297, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 3170, 1040, 1330, ...
3.62931
116
# -*- coding: utf-8 -*- # Copyright (c) 2020 Red Hat, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import copy import json from datetime import datetime import re import koji from kobo.rpmlib import parse_nvr import semver from freshmaker import db, conf, log from freshmaker.handlers import ContainerBuildHandler from freshmaker.events import BotasErrataShippedEvent, ManualBundleRebuild from freshmaker.lightblue import ContainerImage from freshmaker.models import ArtifactBuild, ArtifactType, Event from freshmaker.types import EventState, ArtifactBuildState, RebuildReason from freshmaker.pyxis import Pyxis from freshmaker.kojiservice import KojiService from freshmaker.errata import Errata def image_has_auto_rebuild_tag(self, image): """ Check if image has a tag enabled for auto rebuild. :param dict image: Dict representation of an image entity in Pyxis. :rtype: bool :return: True if image has a tag enabled for auto rebuild in repository, otherwise False. """ for repo in image['repositories']: # Skip unpublished repository if not repo['published']: continue auto_rebuild_tags = self._pyxis.get_auto_rebuild_tags( repo['registry'], repo['repository'] ) tags = [t['name'] for t in repo.get('tags', [])] if set(auto_rebuild_tags) & set(tags): return True # It'd be more efficient to do this check first, but the exceptions are edge cases # (e.g. testing) and it's best to not use it unless absolutely necessary nvr = image['brew']['build'] parsed_nvr = parse_nvr(nvr) nv = f'{parsed_nvr["name"]}-{parsed_nvr["version"]}' if nv in conf.bundle_autorebuild_tag_exceptions: self.log_info( 'The bundle %r has an exception for being tagged with an auto-rebuild tag', nvr ) return True return False def _create_original_to_rebuilt_nvrs_map(self): """ Creates mapping of original operator build NVRs to rebuilt NVRs in advisory. Including NVRs of the builds from the blocking advisories :rtype: dict :return: map of the original NVRs as keys and rebuilt NVRs as values """ nvrs_mapping = {} # Get builds from all blocking advisories blocking_advisories_builds = \ Errata().get_blocking_advisories_builds(self.event.advisory.errata_id) # Get builds NVRs from the advisory attached to the message/event and # then get original NVR for every build for product_info in self.event.advisory.builds.values(): for build in product_info['builds']: # Each build is a one key/value pair, and key is the build NVR build_nvr = next(iter(build)) # Search for the first build that triggered the chain of rebuilds # for every shipped NVR to get original NVR from it original_nvr = self.get_published_original_nvr(build_nvr) if original_nvr is None: continue nvrs_mapping[original_nvr] = build_nvr parsed_build_nvr = parse_nvr(build_nvr) # Check builds from blocking advisories and add to the mapping # all of them, that have overlapping package names for block_build in blocking_advisories_builds: block_build_nvr = parse_nvr(block_build) if (block_build_nvr['name'] == parsed_build_nvr['name'] and block_build_nvr['version'] == parsed_build_nvr['version']): # noqa: W503 nvrs_mapping[block_build] = build_nvr return nvrs_mapping def _prepare_builds(self, db_event, to_rebuild_bundles): """ Prepare models.ArtifactBuild instance for every bundle that will be rebuilt :param models.Event db_event: database event that will contain builds :param list to_rebuild_bundles: bundles to rebuild :return: builds that already in database and ready to be submitted to brew :rtype: list """ builds = [] csv_mod_url = conf.freshmaker_root_url + "/api/2/pullspec_overrides/{}" for bundle in to_rebuild_bundles: # Reset context to db_event for each iteration before # the ArtifactBuild is created. self.set_context(db_event) rebuild_reason = RebuildReason.DIRECTLY_AFFECTED.value bundle_name = koji.parse_NVR(bundle["nvr"])["name"] build = self.record_build( db_event, bundle_name, ArtifactType.IMAGE, state=ArtifactBuildState.PLANNED.value, original_nvr=bundle["nvr"], rebuild_reason=rebuild_reason) # Set context to particular build so logging shows this build # in case of error. self.set_context(build) build.transition(ArtifactBuildState.PLANNED.value, "") additional_data = ContainerImage.get_additional_data_from_koji(bundle["nvr"]) build.build_args = json.dumps({ "repository": additional_data["repository"], "commit": additional_data["commit"], "target": additional_data["target"], "branch": additional_data["git_branch"], "arches": additional_data["arches"], # The build system always enforces that bundle images build from # "scratch", so there is no parent image. See: # https://osbs.readthedocs.io/en/latest/users.html?#operator-manifest-bundle-builds "original_parent": None, "operator_csv_modifications_url": csv_mod_url.format(build.id), }) build.bundle_pullspec_overrides = { "pullspec_replacements": bundle["pullspec_replacements"], "update": bundle["update"], } db.session.commit() builds.append(build) return builds
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 357, 66, 8, 12131, 220, 2297, 10983, 11, 3457, 13, 198, 2, 198, 2, 2448, 3411, 318, 29376, 7520, 11, 1479, 286, 3877, 11, 284, 597, 1048, 16727, 257, 4866,...
2.419799
2,980
from abc import ABC as Contract, abstractmethod
[ 6738, 450, 66, 1330, 9738, 355, 17453, 11, 12531, 24396, 628 ]
4.454545
11
#!/usr/bin/env python # -*- coding: utf-8 -*- """netblow_cli module.""" import argparse from netblow.netblow import NetBlow from netblow.version import __version__ def main(): """Entry function.""" parser = argparse.ArgumentParser( description="netblow. Vendor agnostic network testing framework to stress network failures." # noqa ) # to add required args. optional = parser._action_groups.pop() required = parser.add_argument_group('required arguments') m_group = optional.add_mutually_exclusive_group() m_group.add_argument( '-d', '--dryrun', default=False, action='store_true', help="show tests calls, won't connect to any devices") m_group.add_argument( '-c', '--concheck', default=False, action='store_true', help='check connectivity with all devices in the topology') m_group.add_argument( '-1', '--once', default=False, action='store_true', help="iterates only once and perfom napalm diffs") parser.add_argument( '-l', '--level', choices=['info', 'debug'], default='info', help='logging verbosity level (default: info)') parser.add_argument( '-v', '--version', action='version', version='{}'.format(__version__), help='show version') required.add_argument( '-f', '--topology', help='topology yml file') required.add_argument( '-t', '--tests', help='tests yml file') parser._action_groups.append(optional) args = parser.parse_args() if not args.topology: parser.error('You have to specify the topology yml file with -f') if not args.tests: if args.once or not args.dryrun and not args.concheck: parser.error('You have to specify the tests yml file with -t') NetBlow( topo_file=args.topology, test_file=args.tests, dry_run=args.dryrun, enable_salt=False, iter_once=args.once, auto_open=True, auto_test=True, con_check=args.concheck, level=args.level) if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 3262, 48619, 62, 44506, 8265, 526, 15931, 198, 11748, 1822, 29572, 198, 6738, 2010, 48619, 13, 3262, 48619, 1330, ...
2.313025
952
''' ' Python Regular Expression ' ''' import re # # # # # # ## if __name__ == '__main__': # test_match() # test_match_character() # test_match_phone() # test_match_qualifier() # escape_character() # boundary() # test_search() # test_multi_character() # test_group() # test_sub() # test_compile() # test_findall() # test_split() # greedy_mode() # <.+><.+>.+</.+></.+> s = '<link href="../assets/css/app.css?t=20112455" type="text/css" rel="stylesheet">' mathched = re.findall(r'\S+assets/css/\S+.css\S+"', s) for m in mathched: print(m, m.index('.css')) s = s.replace(m, m[:m.index('.css')] + '.css?t=00000"') print(s)
[ 7061, 6, 198, 6, 220, 11361, 23603, 41986, 220, 198, 6, 198, 7061, 6, 198, 11748, 302, 628, 198, 198, 2, 220, 628, 198, 198, 2, 220, 628, 198, 2, 220, 220, 628, 198, 2, 220, 628, 198, 198, 2, 220, 628, 198, 2, 220, 628, 198,...
2.196203
316
#! /usr/bin/env python2 # -*- coding: utf8 -*- from subprocess import check_output
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 17, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 23, 532, 9, 12, 198, 198, 6738, 850, 14681, 1330, 2198, 62, 22915, 198 ]
2.545455
33
from __future__ import unicode_literals import pytest from hypothesis import ( strategies as st, given, ) from eth_utils.encoding import ( int_to_big_endian, big_endian_to_int, )
[ 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 12972, 9288, 198, 198, 6738, 14078, 1330, 357, 198, 220, 220, 220, 10064, 355, 336, 11, 198, 220, 220, 220, 1813, 11, 198, 8, 198, 198, 6738, 4555, 62, 267...
2.576923
78
import numpy as np # Normalize dataset such that all sequences have min value 0.0, max value 1.0 # Normalize only the sequences in the data that have value outside range [0, 1) # Normalizes these sequences to have min value 0.0, max value 1.0
[ 11748, 299, 32152, 355, 45941, 628, 198, 2, 14435, 1096, 27039, 884, 326, 477, 16311, 423, 949, 1988, 657, 13, 15, 11, 3509, 1988, 352, 13, 15, 628, 198, 2, 14435, 1096, 691, 262, 16311, 287, 262, 1366, 326, 423, 1988, 2354, 2837, ...
3.632353
68
from __future__ import absolute_import from setuptools import setup, find_packages from codecs import open with open('README.rst', encoding='utf-8') as f: long_description = f.read() setup( name='pypsa', version='0.19.1', author='PyPSA Developers, see https://pypsa.readthedocs.io/en/latest/developers.html', author_email='t.brown@tu-berlin.de', description='Python for Power Systems Analysis', long_description=long_description, long_description_content_type='text/x-rst', url='https://github.com/PyPSA/PyPSA', license='MIT', packages=find_packages(exclude=['doc', 'test']), include_package_data=True, python_requires='>=3.6', install_requires=[ 'numpy', 'scipy', 'pandas>=0.24.0', 'xarray', 'netcdf4', 'tables', 'pyomo>=5.7', 'matplotlib', 'networkx>=1.10', 'deprecation' ], extras_require = { "dev": ["pytest", "pypower", "pandapower", "scikit-learn"], "cartopy": ['cartopy>=0.16'], "docs": ["numpydoc", "sphinx", "sphinx_rtd_theme", "nbsphinx", "nbsphinx-link", "black"], 'gurobipy':['gurobipy'] }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Operating System :: OS Independent', ])
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 628, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 11, 1064, 62, 43789, 198, 6738, 40481, 82, 1330, 1280, 628, 198, 4480, 1280, 10786, 15675, 11682, 13, 81, 301, 3256, 21004, 11639, 40477...
2.242836
663
from django.urls import path from . import views urlpatterns = [ path('', views.quiz_home, name='quiz-home'), path('page/<int:page_no>/', views.quiz_page, name='quiz-page' ), path('about/', views.quiz_about, name='quiz-about'), path('submit/', views.quiz_submit, name='quiz-submit'), ## after quiz end path('view_result/<int:page_no>/', views.quiz_view_result, name='quiz-view_result'), path('leaderboard/', views.quiz_leaderboard, name='quiz-leaderboard'), path('feedback/', views.quiz_feedback, name='quiz-feedback'), ]
[ 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 3108, 198, 6738, 764, 1330, 5009, 198, 198, 6371, 33279, 82, 796, 685, 198, 220, 220, 220, 3108, 10786, 3256, 5009, 13, 421, 528, 62, 11195, 11, 1438, 11639, 421, 528, 12, 11195, 33809, 1...
2.538813
219
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Jamf Config """ __author__ = "Sam Forester" __email__ = "sam.forester@utah.edu" __copyright__ = "Copyright (c) 2020 University of Utah, Marriott Library" __license__ = "MIT" __version__ = "1.0.4" import argparse import getpass import jamf import logging import platform import pprint import sys from os import path if __name__ == "__main__": main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 37811, 198, 30380, 69, 17056, 198, 37811, 198, 198, 834, 9800, 834, 796, 366, 16305, 4558, 1706, 1, 198, 834...
2.753333
150
# -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-03-12 17:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 1157, 13, 1238, 319, 13130, 12, 3070, 12, 1065, 1596, 25, 3901, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198...
2.753623
69
""" S3AIO Class Array access to a single S3 object """ from __future__ import absolute_import import SharedArray as sa import zstd from itertools import repeat, product import numpy as np from pathos.multiprocessing import ProcessingPool from six.moves import zip try: from StringIO import StringIO except ImportError: from io import StringIO from .s3io import S3IO, generate_array_name
[ 37811, 198, 50, 18, 32, 9399, 5016, 198, 198, 19182, 1895, 284, 257, 2060, 311, 18, 2134, 198, 198, 37811, 198, 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 198, 11748, 39403, 19182, 355, 473, 198, 11748, 1976, 19282, 198, 673...
3.286885
122
# -*- coding: utf-8 -*- """ Created on Fri Mar 21 15:11:31 2014 @author: ibackus """ __version__ = "$Revision: 1 $" # $Source$ import pynbody SimArray = pynbody.array.SimArray import numpy as np import gc import os import isaac import calc_velocity import ICgen_utils import ICglobal_settings global_settings = ICglobal_settings.global_settings def snapshot_gen(ICobj): """ Generates a tipsy snapshot from the initial conditions object ICobj. Returns snapshot, param snapshot: tipsy snapshot param: dictionary containing info for a .param file """ print 'Generating snapshot...' # Constants G = SimArray(1.0,'G') # ------------------------------------ # Load in things from ICobj # ------------------------------------ print 'Accessing data from ICs' settings = ICobj.settings # filenames snapshotName = settings.filenames.snapshotName paramName = settings.filenames.paramName # particle positions r = ICobj.pos.r xyz = ICobj.pos.xyz # Number of particles nParticles = ICobj.pos.nParticles # molecular mass m = settings.physical.m # star mass m_star = settings.physical.M.copy() # disk mass m_disk = ICobj.sigma.m_disk.copy() m_disk = isaac.match_units(m_disk, m_star)[0] # mass of the gas particles m_particles = m_disk / float(nParticles) # re-scale the particles (allows making of lo-mass disk) m_particles *= settings.snapshot.mScale # ------------------------------------------------- # Assign output # ------------------------------------------------- print 'Assigning data to snapshot' # Get units all set up m_unit = m_star.units pos_unit = r.units if xyz.units != r.units: xyz.convert_units(pos_unit) # time units are sqrt(L^3/GM) t_unit = np.sqrt((pos_unit**3)*np.power((G*m_unit), -1)).units # velocity units are L/t v_unit = (pos_unit/t_unit).ratio('km s**-1') # Make it a unit v_unit = pynbody.units.Unit('{0} km s**-1'.format(v_unit)) # Other settings metals = settings.snapshot.metals star_metals = metals # ------------------------------------------------- # Initialize snapshot # ------------------------------------------------- # Note that empty pos, vel, and mass arrays are created in the snapshot snapshot = pynbody.new(star=1,gas=nParticles) snapshot['vel'].units = v_unit snapshot['eps'] = 0.01*SimArray(np.ones(nParticles+1, dtype=np.float32), pos_unit) snapshot['metals'] = SimArray(np.zeros(nParticles+1, dtype=np.float32)) snapshot['rho'] = SimArray(np.zeros(nParticles+1, dtype=np.float32)) snapshot.gas['pos'] = xyz snapshot.gas['temp'] = ICobj.T(r) snapshot.gas['mass'] = m_particles snapshot.gas['metals'] = metals snapshot.star['pos'] = SimArray([[ 0., 0., 0.]],pos_unit) snapshot.star['vel'] = SimArray([[ 0., 0., 0.]], v_unit) snapshot.star['mass'] = m_star snapshot.star['metals'] = SimArray(star_metals) # Estimate the star's softening length as the closest particle distance snapshot.star['eps'] = r.min() # Make param file param = isaac.make_param(snapshot, snapshotName) param['dMeanMolWeight'] = m gc.collect() # ------------------------------------------------- # CALCULATE VELOCITY USING calc_velocity.py. This also estimates the # gravitational softening length eps # ------------------------------------------------- print 'Calculating circular velocity' preset = settings.changa_run.preset max_particles = global_settings['misc']['max_particles'] calc_velocity.v_xy(snapshot, param, changa_preset=preset, max_particles=max_particles) gc.collect() # ------------------------------------------------- # Estimate time step for changa to use # ------------------------------------------------- # Save param file isaac.configsave(param, paramName, 'param') # Save snapshot snapshot.write(filename=snapshotName, fmt=pynbody.tipsy.TipsySnap) # est dDelta dDelta = ICgen_utils.est_time_step(paramName, preset) param['dDelta'] = dDelta # ------------------------------------------------- # Create director file # ------------------------------------------------- # largest radius to plot r_director = float(0.9 * r.max()) # Maximum surface density sigma_min = float(ICobj.sigma(r_director)) # surface density at largest radius sigma_max = float(ICobj.sigma.input_dict['sigma'].max()) # Create director dict director = isaac.make_director(sigma_min, sigma_max, r_director, filename=param['achOutName']) ## Save .director file #isaac.configsave(director, directorName, 'director') # ------------------------------------------------- # Wrap up # ------------------------------------------------- print 'Wrapping up' # Now set the star particle's tform to a negative number. This allows # UW ChaNGa treat it as a sink particle. snapshot.star['tform'] = -1.0 # Update params r_sink = isaac.strip_units(r.min()) param['dSinkBoundOrbitRadius'] = r_sink param['dSinkRadius'] = r_sink param['dSinkMassMin'] = 0.9 * isaac.strip_units(m_star) param['bDoSinks'] = 1 return snapshot, param, director
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 37811, 198, 41972, 319, 19480, 1526, 2310, 1315, 25, 1157, 25, 3132, 1946, 198, 198, 31, 9800, 25, 24283, 441, 385, 198, 37811, 198, 198, 834, 9641, 834, 796, 17971, 1...
2.711299
2,009
""" Diagonal Matrix with rank-1 updates. """ import itertools import torch from torch.functional import Tensor def batchDot(self, v): """ Batched multiplication self @ v with batch of matrices v (batch_size, n, k) """ assert v.ndim == 3 assert v.shape[1] == self.rankUpdates.shape[2] n = v.shape[1] diag_bmm = self.diag.reshape((1, n, 1))*v inner_prod = torch.matmul(self.rankUpdates[:,1,:].unsqueeze(0), v) # inner_prod now has shape (batch_size, n_updates, k) outer_prod = torch.matmul( self.rankUpdates[:,0,:].t().unsqueeze(0), inner_prod ) # outer_prod now has shape (batch_size, n, k) return diag_bmm + outer_prod def batchDotTransposed(self, v): """ Batched multiplication self.t() @ v with batch of matrices v (batch_size, n, k) """ assert v.ndim == 3 assert v.shape[1] == self.rankUpdates.shape[2] n = v.shape[1] diag_bmm = self.diag.reshape((1, n, 1))*v inner_prod = torch.matmul(self.rankUpdates[:,0,:].unsqueeze(0), v) # inner_prod now has shape (batch_size, n_updates, k) outer_prod = torch.matmul( self.rankUpdates[:,1,:].t().unsqueeze(0), inner_prod ) # outer_prod now has shape (batch_size, n, k) return diag_bmm + outer_prod def dotRight(self, other): """ Multiply self @ other """ return self.diag * other + torch.matmul( torch.matmul( self.rankUpdates[:,1,:] , other ), self.rankUpdates[:,0,:] ) def dotLeft(self, other): """ Multiply other @ self """ return self.diag * other + torch.matmul( torch.matmul( self.rankUpdates[:,0,:] , other ), self.rankUpdates[:,1,:] ) def dotBoth(self, v, w): """ Let A be self and v, w . Then `dotBoth` computes v A w """ return (self.diag * v * w).sum() + torch.dot( torch.matmul(self.rankUpdates[:, 0, :], v), torch.matmul(self.rankUpdates[:, 1, :], w) )
[ 37811, 198, 18683, 27923, 24936, 351, 4279, 12, 16, 5992, 13, 198, 37811, 198, 11748, 340, 861, 10141, 198, 11748, 28034, 198, 6738, 28034, 13, 45124, 1330, 309, 22854, 628, 220, 220, 220, 825, 15458, 35, 313, 7, 944, 11, 410, 2599, ...
1.931185
1,148
import pickle from unittest import mock from nose2.tools.params import params import numpy as np import tensorflow as tf from garage.tf.envs import TfEnv from garage.tf.policies import GaussianMLPPolicyWithModel from tests.fixtures import TfGraphTestCase from tests.fixtures.envs.dummy import DummyBoxEnv from tests.fixtures.models import SimpleGaussianMLPModel
[ 11748, 2298, 293, 198, 6738, 555, 715, 395, 1330, 15290, 198, 198, 6738, 9686, 17, 13, 31391, 13, 37266, 1330, 42287, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 198, 6738, 15591, 13, 27110, 13, ...
3.288288
111
# ####### # Copyright (c) 2018-2020 Cloudify Platform Ltd. All rights reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from cloudify import ctx from cloudify.decorators import operation from cloudify_gcp.gcp import check_response from .. import utils from .. import constants from ..monitoring import MonitoringBase
[ 2, 46424, 2235, 198, 2, 15069, 357, 66, 8, 2864, 12, 42334, 10130, 1958, 19193, 12052, 13, 1439, 2489, 10395, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 4...
3.777273
220
import unittest from selection.dbms.postgres_dbms import PostgresDatabaseConnector from selection.index import Index from selection.table_generator import TableGenerator from selection.workload import Column, Query, Table if __name__ == "__main__": unittest.main()
[ 11748, 555, 715, 395, 198, 198, 6738, 6356, 13, 9945, 907, 13, 7353, 34239, 62, 9945, 907, 1330, 2947, 34239, 38105, 34525, 198, 6738, 6356, 13, 9630, 1330, 12901, 198, 6738, 6356, 13, 11487, 62, 8612, 1352, 1330, 8655, 8645, 1352, 19...
3.545455
77
from sqlalchemy.orm.collections import InstrumentedList
[ 6738, 44161, 282, 26599, 13, 579, 13, 4033, 26448, 1330, 42410, 276, 8053, 628 ]
4.071429
14
# Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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.
[ 2, 220, 15069, 3648, 12, 6999, 26182, 45196, 641, 27862, 39447, 73, 198, 2, 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, 287, 1...
3.678788
165
from rest_framework import serializers from ... import models
[ 6738, 1334, 62, 30604, 1330, 11389, 11341, 198, 6738, 2644, 1330, 4981, 628, 628 ]
4.642857
14
from cinebot_mini import SERVERS import requests import numpy as np import json
[ 6738, 269, 500, 13645, 62, 45313, 1330, 18871, 28884, 198, 11748, 7007, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 33918, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 198 ]
3.125
32
# -*- coding: utf-8 -*- # Copyright (c) 2018 The Regents of the University of California # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer; # redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution; # neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Authors: Jason Lowe-Power from __future__ import print_function import argparse import m5 from m5.objects import TimingSimpleCPU, DerivO3CPU from m5.objects import SimpleIndirectPredictor, LocalBP, BiModeBP, TournamentBP, LTAGE, SimpleMemory from m5.objects import Root from m5.objects import * from system import BaseTestSystem from system import InfMemory, SingleCycleMemory, SlowMemory # Branch predictor params # If indirect Predictor is disabled use BTB with these params btbEntries = 512 btbTagSize = 19 ipred = SimpleIndirectPredictor() #CPU Configs # Add more CPUs Configs under test before this valid_configs = [Simple_LocalBP, Simple_BiModeBP, Simple_TournamentBP, Simple_LTAGEBP, DefaultO3_LocalBP, DefaultO3_BiModeBP, DefaultO3_TournamentBP, DefaultO3_LTAGEBP] valid_configs = {cls.__name__[:-2]:cls for cls in valid_configs} # Add more Memories under test before this valid_memories = [InfMemory, SingleCycleMemory, SlowMemory] valid_memories = {cls.__name__[:-6]:cls for cls in valid_memories} parser = argparse.ArgumentParser() parser.add_argument('config', choices = valid_configs.keys()) parser.add_argument('memory_model', choices = valid_memories.keys()) parser.add_argument('binary', type = str, help = "Path to binary to run") args = parser.parse_args() system = MySystem() system.setTestBinary(args.binary) root = Root(full_system = False, system = system) m5.instantiate() exit_event = m5.simulate() if exit_event.getCause() != 'exiting with last active thread context': print("Benchmark failed with bad exit cause.") print(exit_event.getCause()) exit(1) if exit_event.getCode() != 0: print("Benchmark failed with bad exit code.") print("Exit code {}".format(exit_event.getCode())) exit(1) print("{} ms".format(m5.curTick()/1e9))
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 15069, 357, 66, 8, 2864, 383, 3310, 658, 286, 262, 2059, 286, 3442, 198, 2, 1439, 6923, 33876, 13, 198, 2, 198, 2, 2297, 396, 3890, 290, 779, 287, 2723, 290, 13...
3.332344
1,011
""" Module related to the argument parsing There is a fallback to the deprecated optparse if argparse is not found """ from pathlib import Path from argparse import ArgumentParser, SUPPRESS from poezio.version import __version__ def parse_args(CONFIG_PATH: Path): """ Parse the arguments from the command line """ parser = ArgumentParser('poezio') parser.add_argument( "-c", "--check-config", dest="check_config", action='store_true', help='Check the config file') parser.add_argument( "-d", "--debug", dest="debug", help="The file where debug will be written", metavar="DEBUG_FILE") parser.add_argument( "-f", "--file", dest="filename", default=CONFIG_PATH / 'poezio.cfg', type=Path, help="The config file you want to use", metavar="CONFIG_FILE") parser.add_argument( '-v', '--version', action='version', version='Poezio v%s' % __version__, ) parser.add_argument( "--custom-version", dest="custom_version", help=SUPPRESS, metavar="VERSION", default=__version__ ) options = parser.parse_args() return options
[ 37811, 198, 26796, 3519, 284, 262, 4578, 32096, 198, 198, 1858, 318, 257, 2121, 1891, 284, 262, 39224, 2172, 29572, 611, 1822, 29572, 318, 407, 1043, 198, 37811, 198, 6738, 3108, 8019, 1330, 10644, 198, 6738, 1822, 29572, 1330, 45751, 4...
2.297834
554
from celerybeatmongo.schedulers import MongoScheduler from mist.api.sharding.mixins import ShardManagerMixin from mist.api.poller.models import PollingSchedule from mist.api.poller.models import OwnerPollingSchedule from mist.api.poller.models import CloudPollingSchedule from mist.api.poller.models import MachinePollingSchedule import datetime
[ 6738, 18725, 1924, 12945, 76, 25162, 13, 1416, 704, 377, 364, 1330, 18428, 34049, 1740, 18173, 198, 198, 6738, 4020, 13, 15042, 13, 1477, 13493, 13, 19816, 1040, 1330, 32822, 13511, 35608, 259, 198, 198, 6738, 4020, 13, 15042, 13, 30393...
3.358491
106
from collections import Counter import json from pathlib import Path from PIL import Image import numpy as np import torch import torch.utils.data as data import torchvision.transforms as transforms from bootstrap.lib.logger import Logger from bootstrap.datasets import transforms as bootstrap_tf try: from .hdd import HDD except: from hdd import HDD if __name__ == "__main__": split = "val" fps = 3 dir_data = Path("/datasets_local/HDD") nb_threads = 0 horizon = 2 win_size = 21 layer = "goal" batch_size = 12 use_navig = False im_size = "small" dataset = HDDClassif(dir_data, split, win_size, im_size, layer, # "goal" or "cause" use_navig=use_navig, fps=fps, horizon=horizon, # in seconds batch_size=batch_size, debug=False, shuffle=False, pin_memory=False, nb_threads=0) vidname_to_index = {} for idx, sequence in enumerate(dataset.index): vid_name = sequence[0].parent.name if vid_name not in vidname_to_index: vidname_to_index[vid_name] = [] vidname_to_index[vid_name].append(idx) batch_sampler = SequentialBatchSampler(vidname_to_index, batch_size) N = 0 for batch in batch_sampler: print(batch) N += 1 # item = dataset[5] # loader = dataset.make_batch_loader(batch_size, # shuffle=False) # for idx, batch in enumerate(loader): # break
[ 6738, 17268, 1330, 15034, 201, 198, 11748, 33918, 201, 198, 6738, 3108, 8019, 1330, 10644, 201, 198, 6738, 350, 4146, 1330, 7412, 220, 201, 198, 11748, 299, 32152, 355, 45941, 201, 198, 201, 198, 11748, 28034, 201, 198, 11748, 28034, 13...
1.929609
895
# https://www.hackerrank.com/challenges/one-week-preparation-kit-jesse-and-cookies/problem #!/bin/python3 import math import os import random import re import sys import heapq # # Complete the 'cookies' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER k # 2. INTEGER_ARRAY A # if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') first_multiple_input = input().rstrip().split() n = int(first_multiple_input[0]) k = int(first_multiple_input[1]) A = list(map(int, input().rstrip().split())) result = cookies(k, A) fptr.write(str(result) + '\n') fptr.close()
[ 2, 3740, 1378, 2503, 13, 31153, 8056, 962, 13, 785, 14, 36747, 34120, 14, 505, 12, 10464, 12, 3866, 1845, 341, 12, 15813, 12, 73, 35270, 12, 392, 12, 27916, 444, 14, 45573, 198, 198, 2, 48443, 8800, 14, 29412, 18, 198, 198, 11748,...
2.618868
265
from abc import ABCMeta, abstractmethod, abstractproperty import numpy __all__ = [ "BaseCapillarity", ] # See <https://stackoverflow.com/questions/35673474/using-abc-abcmeta-in-a-way-it-is-compatible-both-with-python-2-7-and-python-3-5> ABC = ABCMeta("ABC", (object,), {"__slots__": ()})
[ 6738, 450, 66, 1330, 9738, 48526, 11, 12531, 24396, 11, 12531, 26745, 198, 198, 11748, 299, 32152, 198, 198, 834, 439, 834, 796, 685, 198, 220, 220, 220, 366, 14881, 15610, 359, 6806, 1600, 198, 60, 628, 198, 2, 4091, 1279, 5450, 13...
2.582609
115
import bpy import glob from bpy.types import Panel, Operator from bpy.app.handlers import persistent import os import threading from queue import Queue from pathlib import Path from . mix_ops import * from . matgan_ops import * from . neural_ops import * cache_path = os.path.join(Path(__file__).parent.resolve(), '.cache') # Redraw all function # Thread function for reading output def update_active_mat(self, context): active_obj = bpy.context.active_object if active_obj: if context.scene.SelectWorkflow == 'MatGAN': base_name = "matgan_mat" elif context.scene.SelectWorkflow == 'NeuralMAT': base_name = "neural_mat" elif context.scene.SelectWorkflow == 'MixMAT': base_name = "mix_mat" name = f"{active_obj.name}_{base_name}" if name not in bpy.data.materials: mat = bpy.data.materials[base_name].copy() mat.name = name else: mat = bpy.data.materials[name] active_obj.active_material = mat if context.scene.SelectWorkflow == 'MatGAN' and 'MaterialGAN_Path' in active_obj: bpy.context.scene.matgan_properties.directory = active_obj['MaterialGAN_Path'] elif context.scene.SelectWorkflow == 'NeuralMAT' and 'Neural_Path' in active_obj: bpy.context.scene.neural_properties.directory = active_obj['Neural_Path'] elif context.scene.SelectWorkflow == 'MixMAT' and 'Algorithmic_Path' in active_obj: bpy.context.scene.mixmat_properties.directory = active_obj['Algorithmic_Path'] # Copy files to .cache folder
[ 11748, 275, 9078, 198, 11748, 15095, 198, 6738, 275, 9078, 13, 19199, 1330, 18810, 11, 35946, 198, 6738, 275, 9078, 13, 1324, 13, 4993, 8116, 1330, 16218, 198, 11748, 28686, 198, 11748, 4704, 278, 198, 6738, 16834, 1330, 4670, 518, 198,...
2.486943
651
""" Main entry point for running the demo. """ # Standard library import time import sys # Third party library import alsaaudio as aa # Local library from char import show_text from hs_logo import draw_logo from leds import ColumnedLEDStrip from music import calculate_levels, read_musicfile_in_chunks, calculate_column_frequency from shairplay import initialize_shairplay, shutdown_shairplay, RaopCallbacks COLUMNS = 12 GAP_LEDS = 0 TOTAL_LEDS = 100 SKIP_LEDS = 4 SAMPLE_RATE = 44100 NUM_CHANNELS = 2 FORMAT = aa.PCM_FORMAT_S16_LE PERIOD_SIZE = 2048 frequency_limits = calculate_column_frequency(200, 10000, COLUMNS) if __name__ == '__main__': from textwrap import dedent input_types = ('local', 'linein', 'airplay') usage = dedent("""\ Usage: %s <input-type> [additional arguments] input-type: should be one of %s To play a local file, you can pass the path to the file as an additional argument. """) % (sys.argv[0], input_types) if len(sys.argv) == 1: print usage sys.exit(1) input_type = sys.argv[1] led_strip = get_led_strip() if input_type == 'local': path = sys.argv[2] if len(sys.argv) > 2 else 'sample.mp3' analyze_audio_file(led_strip, path) elif input_type == 'airplay': analyze_airplay_input(led_strip) elif input_type == 'linein': analyze_line_in(led_strip) else: print usage sys.exit(1)
[ 37811, 8774, 5726, 966, 329, 2491, 262, 13605, 13, 37227, 628, 198, 2, 8997, 5888, 198, 11748, 640, 198, 11748, 25064, 198, 198, 2, 10467, 2151, 5888, 198, 11748, 435, 11400, 24051, 355, 257, 64, 198, 198, 2, 10714, 5888, 198, 6738, ...
2.537653
571
import re if __name__ == '__main__': with open("test.txt") as handle: lines = handle.readlines() print("Part I: ", part1(lines)) print("Part II:", part2(lines))
[ 11748, 302, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 351, 1280, 7203, 9288, 13, 14116, 4943, 355, 5412, 25, 198, 220, 220, 220, 220, 220, 220, 220, 3951, 796, 5412, 13, 961, 6615, ...
2.48
75
""" Your chance to explore Loops and Turtles! Authors: David Mutchler, Dave Fisher, Vibha Alangar, Amanda Stouder, their colleagues and Alec Polster. """ import rosegraphics as rg ############################################################################### # DONE: 1. # On Line 5 above, replace PUT_YOUR_NAME_HERE with your own name. ############################################################################### ############################################################################### # DONE: 2. # You should have RUN the m5e_loopy_turtles module and READ its code. # (Do so now if you have not already done so.) # # Below this comment, add ANY CODE THAT YOU WANT, as long as: # 1. You construct at least 2 rg.SimpleTurtle objects. # 2. Each rg.SimpleTurtle object draws something # (by moving, using its rg.Pen). ANYTHING is fine! # 3. Each rg.SimpleTurtle moves inside a LOOP. # # Be creative! Strive for way-cool pictures! Abstract pictures rule! # # If you make syntax (notational) errors, no worries -- get help # fixing them at either this session OR at the NEXT session. # # Don't forget to COMMIT-and-PUSH when you are done with this module. ############################################################################### window = rg.TurtleWindow() my_turtle = rg.SimpleTurtle('turtle') my_turtle.pen = rg.Pen('blue', 10) my_turtle.speed = 10 your_turtle = rg.SimpleTurtle() your_turtle.pen = rg.Pen('red', 5) your_turtle.speed = 10 your_turtle.pen_up() your_turtle.forward(3) your_turtle.pen_down() size = 300 for k in range(15): my_turtle.draw_square(size) my_turtle.pen_up() my_turtle.right(45) my_turtle.forward(10) my_turtle.left(45) my_turtle.pen_down() your_turtle.draw_square(size-100) your_turtle.pen_up() your_turtle.right(45) your_turtle.forward(10) your_turtle.left(45) your_turtle.pen_down() size = size - 20 window.close_on_mouse_click()
[ 37811, 198, 7120, 2863, 284, 7301, 6706, 2840, 290, 44356, 0, 198, 198, 30515, 669, 25, 3271, 337, 7140, 1754, 11, 9935, 14388, 11, 569, 571, 3099, 978, 648, 283, 11, 23040, 520, 280, 1082, 11, 198, 220, 220, 220, 220, 220, 220, 2...
2.947917
672
from backbone import entry_point if __name__ == '__main__': entry_point.main()
[ 6738, 32774, 1330, 5726, 62, 4122, 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 5726, 62, 4122, 13, 12417, 3419, 198 ]
2.896552
29
# encoding=utf-8 __author__ = 'lance' import tornado.web
[ 2, 21004, 28, 40477, 12, 23, 198, 834, 9800, 834, 796, 705, 23215, 6, 198, 198, 11748, 33718, 13, 12384, 628 ]
2.809524
21
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import paddle import paddle.nn as nn if __name__ == "__main__": t1 = paddle.randn((1, 3, 512, 512), dtype="float32") t2 = paddle.randn((1, 3, 512, 512), dtype="float32") model = CDNet(6, 2) pred = model(t1, t2)[0] print(pred.shape)
[ 2, 15069, 357, 66, 8, 33160, 350, 37382, 47, 37382, 46665, 13, 1439, 6923, 33876, 13, 201, 198, 2, 201, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 201, 198, 2, 345, 743, 407, 779, ...
2.953642
302
#!/usr/bin/env python """\ make-leap-seconds.py - make leap second file for testing Optional args are date of leap second: YYYY-MM-DD and expiration date of file. Defaults are start of tomorrow (UTC), and 28 days after the leap. "Start of tomorow" is as soon as possible for testing. """ # SPDX-License-Identifier: BSD-2-Clause from __future__ import print_function, division import datetime import sha import sys import time JAN_1970 = 2208988800 # convert Unix/POSIX epoch to NTP epoch epoch = datetime.datetime.utcfromtimestamp(0) args = sys.argv[1:] leap = time.time() days = int(leap/86400) leap = (days+1)*86400 if len(args) > 0: leapdate = datetime.datetime.strptime(args[0], "%Y-%m-%d") leap = (leapdate - epoch).total_seconds() leap = int(leap) args = args[1:] expire = leap + 28*86400 if len(args) > 0: expiredate = datetime.datetime.strptime(args[0], "%Y-%m-%d") expire = (expiredate - epoch).total_seconds() expire = int(expire) args = args[1:] leap_txt = time.asctime(time.gmtime(leap)) leap = str(leap+JAN_1970) expire_txt = time.asctime(time.gmtime(expire)) expire = str(expire+JAN_1970) update = int(time.time()) update_txt = time.asctime(time.gmtime(update)) update = str(update+JAN_1970) tai = "40" # hardwired # File format # # # is comment # #$ xxx Update Date # #@ xxx Expiration Date # #h SHA1 hash of payload # # #$ 3676924800 # #@ 3707596800 # 2272060800 10 # 1 Jan 1972 # #h dacf2c42 2c4765d6 3c797af8 2cf630eb 699c8c67 # # All dates use NTP epoch of 1900-01-01 sha1 = sha.new() print("%s %s # %s" % (leap, tai, leap_txt)) sha1.update(leap) sha1.update(tai) print("#@ %s # %s" % (expire, expire_txt)) sha1.update(expire) print("#$ %s # %s" % (update, update_txt)) sha1.update(update) digest = sha1.hexdigest() print("#h %s %s %s %s %s" % (digest[0:8], digest[8:16], digest[16:24], digest[24:32], digest[32:40])) # end
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 59, 198, 15883, 12, 293, 499, 12, 43012, 13, 9078, 532, 787, 16470, 1218, 2393, 329, 4856, 198, 198, 30719, 26498, 389, 3128, 286, 16470, 1218, 25, 575, 26314, 56, 12, 12038, ...
2.313539
842
# -*- encoding: utf-8 -*- from ddtrace.profiling import event from ddtrace.profiling import exporter from ddtrace.profiling import recorder from ddtrace.profiling import scheduler
[ 2, 532, 9, 12, 21004, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 49427, 40546, 13, 5577, 4386, 1330, 1785, 198, 6738, 49427, 40546, 13, 5577, 4386, 1330, 1033, 4337, 198, 6738, 49427, 40546, 13, 5577, 4386, 1330, 38156, 198, 6738,...
3.45283
53
import scrapy,json,re,time,os,glob from scrapy.exceptions import CloseSpider from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.common.exceptions import TimeoutException from selenium.webdriver.chrome.options import Options #get all the imdb xpaths from xpaths.json file with open('./locators/xpaths.json') as f: xpaths = json.load(f) imdb = xpaths["imdb"][0] #define all the required variables movie_name = '' project_path = r'/Users/eshwar/Documents/projects/sentiment_analysis_on_movie_reviews/' scraped_reviews_path = project_path + "data/scraped_reviews/" predicted_reviews_path = project_path + "data/predicted_reviews/" chrome_driver_path = project_path+"scrape_reviews/chrome_driver/chromedriver"
[ 11748, 15881, 88, 11, 17752, 11, 260, 11, 2435, 11, 418, 11, 4743, 672, 198, 6738, 15881, 88, 13, 1069, 11755, 1330, 13872, 41294, 198, 6738, 384, 11925, 1505, 1330, 3992, 26230, 198, 6738, 384, 11925, 1505, 13, 12384, 26230, 13, 1128...
3.052632
285
from django.contrib import admin from notifications.models import Notification
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 13169, 198, 198, 6738, 19605, 13, 27530, 1330, 42808, 628 ]
4.764706
17
# -------------- # import the libraries import numpy as np import pandas as pd import seaborn as sns from sklearn.model_selection import train_test_split import warnings warnings.filterwarnings('ignore') # Code starts here df=pd.read_csv(path) print(df.head()) X=df.drop(columns='insuranceclaim') y=df['insuranceclaim'] X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=6) # Code ends here # -------------- import matplotlib.pyplot as plt # Code starts here plt.boxplot(X_train['bmi']) plt.show() q_value=X_train['bmi'].quantile(0.95) print(y_train.value_counts()) # Code ends here # -------------- import seaborn as sns # Code starts here relation=X_train.corr() print(relation) sns.pairplot(X_train) plt.show() # Code ends here # -------------- import seaborn as sns import matplotlib.pyplot as plt # Code starts here cols=['children','sex','region','smoker'] fig,axes=plt.subplots(2,2) for i in range(2): for j in range(2): col=cols[i*2+j] sns.countplot(X_train[col],hue=y_train,ax=axes[i,j]) # Code ends here # -------------- from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from sklearn.linear_model import LogisticRegression from sklearn.metrics import accuracy_score # parameters for grid search parameters = {'C':[0.1,0.5,1,5]} # Code starts here lr=LogisticRegression(random_state=9) grid=GridSearchCV(estimator=lr,param_grid=parameters) grid.fit(X_train,y_train) y_pred=grid.predict(X_test) accuracy=accuracy_score(y_test,y_pred) print(accuracy) # Code ends here # -------------- from sklearn.metrics import roc_auc_score from sklearn import metrics # Code starts here score=roc_auc_score(y_test,y_pred) y_pred_proba=grid.predict_proba(X_test)[:,1] fpr,tpr,_=metrics.roc_curve(y_test,y_pred) roc_auc=roc_auc_score(y_test,y_pred_proba) plt.plot(fpr,tpr,label="Logistic model, auc="+str(roc_auc)) # Code ends here
[ 2, 220, 26171, 198, 2, 1330, 262, 12782, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 384, 397, 1211, 355, 3013, 82, 198, 6738, 1341, 35720, 13, 19849, 62, 49283, 1330, 4512, 62, 9288, 62, 35...
2.551265
751
"""Convert a Caffe model file to TensorFlow checkpoint format. Assume that the network built is a equivalent (or a sub-) to the Caffe definition. """ import tensorflow as tf from nets import caffe_scope from nets import nets_factory slim = tf.contrib.slim # =========================================================================== # # Main flags. # =========================================================================== # tf.app.flags.DEFINE_string( 'model_name', 'ssd_300_vgg', 'Name of the model to convert.') tf.app.flags.DEFINE_string( 'num_classes', 21, 'Number of classes in the dataset.') tf.app.flags.DEFINE_string( 'caffemodel_path', None, 'The path to the Caffe model file to convert.') FLAGS = tf.app.flags.FLAGS # =========================================================================== # # Main converting routine. # =========================================================================== # if __name__ == '__main__': tf.app.run()
[ 37811, 3103, 1851, 257, 327, 21223, 2746, 2393, 284, 309, 22854, 37535, 26954, 5794, 13, 198, 198, 8021, 2454, 326, 262, 3127, 3170, 318, 257, 7548, 357, 273, 257, 850, 25106, 284, 262, 327, 21223, 198, 46758, 13, 198, 37811, 198, 117...
3.760456
263
#!/usr/bin/env python import os import re from setuptools import find_packages, setup version = get_version("django_toolshed", "__init__.py") readme = open("README.md").read() setup( name="django-toolshed", version=version, description="""Your project description goes here""", long_description=readme, author="Dani Hodovic", author_email="you@example.com", url="https://github.com/danihodovic/django-toolshed", packages=find_packages(), include_package_data=True, install_requires=[], license="MIT", keywords="django,app", classifiers=[ "Development Status :: 3 - Alpha", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", ], )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 11748, 28686, 198, 11748, 302, 198, 198, 6738, 900, 37623, 10141, 1330, 1064, 62, 43789, 11, 9058, 628, 198, 198, 9641, 796, 651, 62, 9641, 7203, 28241, 14208, 62, 31391, 704, 1600, 36...
2.669753
324
import tensorflow as tf from detection.utils.misc import *
[ 11748, 11192, 273, 11125, 355, 48700, 198, 198, 6738, 13326, 13, 26791, 13, 44374, 1330, 1635, 198 ]
3.529412
17
from ..router import Router from . import create_user, get_user router = Router() router.include(get_user.router) router.include(create_user.router)
[ 6738, 11485, 472, 353, 1330, 48538, 198, 6738, 764, 1330, 2251, 62, 7220, 11, 651, 62, 7220, 198, 198, 472, 353, 796, 48538, 3419, 198, 472, 353, 13, 17256, 7, 1136, 62, 7220, 13, 472, 353, 8, 198, 472, 353, 13, 17256, 7, 17953, ...
2.941176
51
from .base_constraint import BaseConstraint from .empty_constraint import EmptyConstraint
[ 6738, 764, 8692, 62, 1102, 2536, 2913, 1330, 7308, 3103, 2536, 2913, 198, 6738, 764, 28920, 62, 1102, 2536, 2913, 1330, 33523, 3103, 2536, 2913, 628 ]
3.5
26
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Vincent Garonne, <vincent.garonne@cern.ch>, 2015 """Create sources table Revision ID: 22d887e4ec0a Revises: 1a80adff031a Create Date: 2015-03-30 11:37:20.737582 """ from alembic import context, op import sqlalchemy as sa from rucio.db.sqla.types import GUID # revision identifiers, used by Alembic. revision = '22d887e4ec0a' down_revision = '1a80adff031a'
[ 2, 15069, 3427, 12275, 329, 19229, 4992, 357, 34, 28778, 8, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 921, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, 262, 13...
2.920705
227
""" This code is attributed to Yingtong Dou (@YingtongDou) and UIC BDSC Lab DGFraud (A Deep Graph-based Toolbox for Fraud Detection in TensorFlow 2.X) https://github.com/safe-graph/DGFraud-TF2 """ import argparse import numpy as np from tqdm import tqdm import tensorflow as tf from tensorflow.keras import optimizers from algorithms.FdGars.FdGars import FdGars from utils.data_loader import load_data_dblp from utils.utils import preprocess_adj, preprocess_feature, sample_mask # init the common args, expect the model specific args parser = argparse.ArgumentParser() parser.add_argument('--seed', type=int, default=123, help='random seed') parser.add_argument('--epochs', type=int, default=200, help='number of epochs to train') parser.add_argument('--batch_size', type=int, default=512, help='batch size') parser.add_argument('--train_size', type=float, default=0.2, help='training set percentage') parser.add_argument('--dropout', type=float, default=0.5, help='dropout rate') parser.add_argument('--weight_decay', type=float, default=0.001, help='weight decay') parser.add_argument('--lr', type=float, default=0.001, help='learning rate') parser.add_argument('--nhid', type=int, default=64, help='number of hidden units in GCN') args = parser.parse_args() # set seed np.random.seed(args.seed) tf.random.set_seed(args.seed) def FdGars_main(support: list, features: tf.SparseTensor, label: tf.Tensor, masks: list, args: argparse.ArgumentParser().parse_args()) -> None: """ Main function to train, val and test the model :param support: a list of the sparse adjacency matrices :param features: node feature tuple for all nodes {coords, values, shape} :param label: the label tensor for all nodes :param masks: a list of mask tensors to obtain the train, val, test data :param args: additional parameters """ model = FdGars(args.input_dim, args.nhid, args.output_dim, args) optimizer = optimizers.Adam(lr=args.lr) # train for epoch in tqdm(range(args.epochs)): with tf.GradientTape() as tape: train_loss, train_acc = model([support, features, label, masks[0]]) grads = tape.gradient(train_loss, model.trainable_variables) optimizer.apply_gradients(zip(grads, model.trainable_variables)) val_loss, val_acc = model([support, features, label, masks[1]], training=False) if epoch % 10 == 0: print( f"train_loss: {train_loss:.4f}, " f"train_acc: {train_acc:.4f}," f"val_loss: {val_loss:.4f}," f"val_acc: {val_acc:.4f}") # test _, test_acc = model([support, features, label, masks[2]], training=False) print(f"Test acc: {test_acc:.4f}") if __name__ == "__main__": # load the data adj_list, features, [idx_train, _, idx_val, _, idx_test, _], y = \ load_data_dblp(meta=False, train_size=args.train_size) # convert to dense tensors train_mask = tf.convert_to_tensor(sample_mask(idx_train, y.shape[0])) val_mask = tf.convert_to_tensor(sample_mask(idx_val, y.shape[0])) test_mask = tf.convert_to_tensor(sample_mask(idx_test, y.shape[0])) label = tf.convert_to_tensor(y, dtype=tf.float32) # normalize the adj matrix and feature matrix features = preprocess_feature(features) support = preprocess_adj(adj_list[0]) # initialize the model parameters args.input_dim = features[2][1] args.output_dim = y.shape[1] args.train_size = len(idx_train) args.num_features_nonzero = features[1].shape # cast sparse matrix tuples to sparse tensors features = tf.cast(tf.SparseTensor(*features), dtype=tf.float32) support = [tf.cast(tf.SparseTensor(*support), dtype=tf.float32)] FdGars_main(support, features, label, [train_mask, val_mask, test_mask], args)
[ 37811, 198, 1212, 2438, 318, 14183, 284, 38833, 83, 506, 5728, 4275, 56, 278, 83, 506, 40287, 8, 290, 471, 2149, 33741, 34, 3498, 198, 35, 21713, 22863, 357, 32, 10766, 29681, 12, 3106, 16984, 3524, 329, 39826, 46254, 287, 309, 22854,...
2.418269
1,664
""" find the Schwarzschild radius of the Sun in m using pint""" import pint def schwarz_rad(mass): """ Given a mass, find the Schwarzschild radius """ star = Sun(mass) radius = star.schwarz() return radius if __name__ == "__main__": MASS = 1.0 RAD = schwarz_rad(MASS) print(RAD)
[ 37811, 1064, 262, 34835, 35058, 16874, 286, 262, 3825, 287, 285, 1262, 35245, 37811, 198, 198, 11748, 35245, 198, 198, 4299, 5513, 5767, 89, 62, 6335, 7, 22208, 2599, 198, 220, 220, 220, 37227, 11259, 257, 2347, 11, 1064, 262, 34835, ...
2.605042
119
from ....crud.rulesprovider.base import RulesProvider from .. import exc from ..app import App from ..utils import has_role from .model import UserCollection, UserModel
[ 6738, 19424, 6098, 463, 13, 38785, 15234, 1304, 13, 8692, 1330, 14252, 29495, 198, 6738, 11485, 1330, 2859, 198, 6738, 11485, 1324, 1330, 2034, 198, 6738, 11485, 26791, 1330, 468, 62, 18090, 198, 6738, 764, 19849, 1330, 11787, 36307, 11, ...
3.886364
44
from dsa.parsing.line_parsing import line_parser from dsa.parsing.token_parsing import make_parser _parser = line_parser( 'Huffman table entry', make_parser( 'Huffman table entry data', ('integer', 'encoded bit sequence'), ('hexdump', 'decoded bytes') ) )
[ 6738, 288, 11400, 13, 79, 945, 278, 13, 1370, 62, 79, 945, 278, 1330, 1627, 62, 48610, 201, 198, 6738, 288, 11400, 13, 79, 945, 278, 13, 30001, 62, 79, 945, 278, 1330, 787, 62, 48610, 201, 198, 201, 198, 201, 198, 62, 48610, 796...
2.230216
139
from unittest.mock import patch import urllib from django.urls import reverse from django.core import mail from django.conf import settings from django.test import override_settings from model_bakery import baker from evap.evaluation import auth from evap.evaluation.models import Contribution, Evaluation, UserProfile from evap.evaluation.tests.tools import WebTest
[ 6738, 555, 715, 395, 13, 76, 735, 1330, 8529, 198, 11748, 2956, 297, 571, 198, 198, 6738, 42625, 14208, 13, 6371, 82, 1330, 9575, 198, 6738, 42625, 14208, 13, 7295, 1330, 6920, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738...
3.673267
101
import argparse import os.path as osp from glob import glob import cv2 import pandas as pd from tqdm import tqdm from gwd.converters import kaggle2coco if __name__ == "__main__": main()
[ 11748, 1822, 29572, 198, 11748, 28686, 13, 6978, 355, 267, 2777, 198, 6738, 15095, 1330, 15095, 198, 198, 11748, 269, 85, 17, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 256, 80, 36020, 1330, 256, 80, 36020, 198, 198, 6738, 308, ...
2.648649
74
import json from shuttl import app from shuttl.tests import testbase from shuttl.Models.Reseller import Reseller from shuttl.Models.organization import Organization, OrganizationDoesNotExistException
[ 11748, 33918, 198, 198, 6738, 4423, 28781, 1330, 598, 198, 6738, 4423, 28781, 13, 41989, 1330, 1332, 8692, 198, 6738, 4423, 28781, 13, 5841, 1424, 13, 4965, 12368, 1330, 1874, 12368, 198, 6738, 4423, 28781, 13, 5841, 1424, 13, 9971, 163...
3.833333
54
# This file contains functions designed for # loading cron tables and storing new feeds. from emissary import db from sqlalchemy import and_ from emissary.controllers.utils import spaceparse from emissary.controllers.cron import parse_timings from emissary.models import APIKey, Feed, FeedGroup def create_feed(log, db, key, group, feed): """ Takes a key object, a group name and a dictionary describing a feed ({name:,url:,schedule:,active:}) and reliably attaches a newly created feed to the key and group. """ if not type(feed) == dict: log('Unexpected type when creating feed for API key "%s"' % key.name) return for i in ['name', 'schedule', 'active', 'url']: if not i in feed.keys(): log('%s: Error creating feed. Missing "%s" field from feed definition.' % (key.name, i)) return f = Feed.query.filter(and_(Feed.key == key, Feed.name == feed['name'])).first() fg = FeedGroup.query.filter(and_(FeedGroup.key == key, FeedGroup.name == group)).first() if f: if f.group: log('%s: Error creating feed "%s" in group "%s", feed already exists in group "%s".' % \ (key.name, feed['name'], group, f.group.name)) return elif fg: log('%s: %s: Adding feed "%s"' % (key.name, fg.name, f.name)) fg.append(f) db.session.add(fg) db.session.add(f) db.session.commit() return if not fg: log('%s: Creating feed group %s.' % (key.name, group)) fg = FeedGroup(name=group) key.feedgroups.append(fg) try: parse_timings(feed['schedule']) except Exception, e: log('%s: %s: Error creating "%s": %s' % \ (key.name, fg.name, feed['name'], e.message)) log('%s: %s: Creating feed "%s"' % (key.name, fg.name, feed['name'])) f = Feed( name=feed['name'], url=feed['url'], active=feed['active'], schedule=feed['schedule'] ) fg.feeds.append(f) key.feeds.append(f) db.session.add(key) db.session.add(fg) db.session.add(f) db.session.commit() def parse_crontab(filename): """ Get a file descriptor on filename and create feeds and groups for API keys therein. """ # read filename into a string named crontab try: fd = open(filename, "r") except OSError: print "Error opening %s" % filename raise SystemExit crontab = fd.read() fd.close() # keep a resident api key on hand key = None for i, line in enumerate(crontab.split('\n')): # Set the APIKey we're working with when we find a line starting # with apikey: if line.startswith("apikey:"): if ' ' in line: key_str = line.split()[1] key = APIKey.query.filter(APIKey.key == key_str).first() if not key: print 'Malformed or unknown API key at line %i in %s: %s' % (i+1, filename, line) raise SystemExit else: print 'Using API key "%s".' % key.name if line.startswith("http"): feed = {'active': True} # Grab the URL and set the string to the remainder feed['url'] = line.split().pop(0) line = ' '.join(line.split()[1:]) # Grab names and groups names = spaceparse(line) if not names: print "Error parsing feed or group name at line %i in %s: %s" % (i+1, filename, line) continue feed['name'], group = names[:2] # The schedule should be the last five items schedule = line.split()[-5:] try: parse_timings(schedule) except Exception, e: print "Error parsing schedule at line %i in %s: %s" % (i+1, filename, e.message) continue feed['schedule'] = ' '.join(schedule) create_feed(log, db, key, group, feed)
[ 2, 770, 2393, 4909, 5499, 3562, 329, 198, 2, 11046, 1067, 261, 8893, 290, 23069, 649, 21318, 13, 198, 198, 6738, 795, 747, 560, 1330, 20613, 198, 6738, 44161, 282, 26599, 1330, 290, 62, 198, 6738, 795, 747, 560, 13, 3642, 36667, 13,...
2.572496
1,338
"""Vodgen app""" from msilib.schema import Directory import sys import json import re from PyQt5.QtWidgets import (QApplication, QCheckBox, QComboBox, QFileDialog, QLabel, QLineEdit, QMainWindow, QPlainTextEdit, QPushButton, QVBoxLayout, QWidget) from videocutter import create_video from thumbnail import Thumbnail, Player, Config, ImageInfo, MatchInfo import sys from os.path import exists #sys.stdout = open("vodgen.log", "w") import logging import os logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.warning, filename="./vodgen.log") if not exists("./characterinfo.json"): logging.error("characterinfo.json could not be found!") exit() if not exists("./config.json"): logging.error("config.json could not be found!") exit() def formatTitle(title): game_info = title.split(": ")[1].split(" - ")[0] tournament_round = ' '.join(game_info.split(' ')[-2:]) #gameRound = gameInfo.split(' ', 2) game_name = game_info.split(' ')[0] if "Winners" in game_info: game_name = game_info.split(' Winners')[0] elif "Losers" in game_info: game_name = game_info.split(' Losers')[0] elif "Grand Finals" in game_info: game_name = game_info.split(' Grand')[0] else: raise InvalidRoundName() player_info = title.split("-")[1] team1 = player_info.split("vs")[0].strip() team1_players = team1.split("(")[0].split(" + ") team1_characters_search = re.search(r"\(([A-Za-z0-9_, .+]+)\)", team1) if team1_characters_search == None: raise MissingPlayer1Character() team1_characters = team1_characters_search.group(1).split(", ")[0].split(" + ") team2 = player_info.split("vs")[1].strip() team2_players = team2.split("(")[0].split(" + ") team2_characters_search = re.search(r"\(([A-Za-z0-9_, .+]+)\)", team2) if team2_characters_search == None: raise MissingPlayer2Character team2_characters = team2_characters_search.group(1).split(", ")[0].split(" + ") player_names = team1_players + team2_players player_characters = team1_characters + team2_characters player_list = [] for x in range(len(player_names)): if len(player_names) / 2 > x: team_num = 0 else: team_num = 1 player_list.append(Player(player_names[x], player_characters[x], team_num, x+1)) return player_list, tournament_round, game_name app = QApplication(sys.argv) window = MainWindow() window.show() app.exec() #sys.stdout.close()
[ 37811, 53, 375, 5235, 598, 37811, 198, 6738, 13845, 22282, 13, 15952, 2611, 1330, 27387, 198, 11748, 25064, 198, 11748, 33918, 198, 11748, 302, 198, 6738, 9485, 48, 83, 20, 13, 48, 83, 54, 312, 11407, 1330, 357, 48, 23416, 11, 1195, ...
2.465116
1,032
# # Copyright (C) 2018 ETH Zurich and University of Bologna # # 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 plptools as plp
[ 198, 2, 198, 2, 15069, 357, 34, 8, 2864, 35920, 43412, 290, 2059, 286, 347, 928, 2616, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2...
3.693642
173
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Tests the shell console :author: Thomas Calmant """ # Pelix from pelix.utilities import to_str, to_bytes # Standard library import random import string import sys import threading import time # Tests try: import unittest2 as unittest except ImportError: import unittest # ------------------------------------------------------------------------------ __version_info__ = (1, 0, 1) __version__ = ".".join(str(x) for x in __version_info__) # Documentation strings format __docformat__ = "restructuredtext en" # ------------------------------------------------------------------------------ try: import subprocess except ImportError: # Can't run the test if we can't start another process pass else:
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 1377, 14041, 12, 27195, 7656, 25, 41002, 12, 23, 1377, 198, 37811, 198, 51, 3558, 262, 7582, 8624, 198, 198, 25, 9800, 25, 5658, 38280, 415, 198, 37811, 198, 198, 2, 12903, 844, ...
3.547511
221
import os import math
[ 11748, 28686, 201, 198, 11748, 10688, 201 ]
3.285714
7
# -*- coding: utf-8 -*- # @Author: Juan Quintana # @Date: 2018-09-26 10:01:02 # @Last Modified by: Juan Quintana # @Last Modified time: 2018-09-26 16:04:24 """ XGBOOST Regressor with Bayesian tuning: OPTION 3 In this case it will be used hyperopt-sklearn and his native algorithm "xgboost_regression". NOTE: scikit-learn tools is not working for this estimator. Reference: https://github.com/hyperopt/hyperopt-sklearn """ import warnings warnings.filterwarnings('ignore') import numpy as np import sys sys.path.append('../../') from datasets import solar from tools.reader import get_dcol from preprocessing.scalers.normalization import Scaler from models.metrics import metrics_regression from tools.timer import * from sklearn.model_selection import train_test_split from sklearn.model_selection import StratifiedKFold, KFold import time from hyperopt import fmin, tpe, hp, STATUS_OK, Trials import xgboost as xgb from sklearn.metrics import r2_score, mean_absolute_error import os os.environ['OMP_NUM_THREADS'] = str(2) if __name__ == '__main__': main()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 13838, 25, 16852, 33405, 2271, 198, 2, 2488, 10430, 25, 220, 220, 2864, 12, 2931, 12, 2075, 838, 25, 486, 25, 2999, 198, 2, 2488, 5956, 40499, 416, 25, 220,...
3.03966
353
# O Departamento Estadual de Meteorologia lhe contratou para desenvolver um programa que leia as um conjunto indeterminado de temperaturas, e informe ao final a menor e a maior temperaturas informadas, bem como a mdia das temperaturas. temperaturas = [] while True: graus = float(input("Digite a temperatura em graus (tecle 0 para parar): ")) temperaturas.append(graus) media = sum(temperaturas) / len(temperaturas) if graus == 0: temperaturas.pop() print("A maior temperatura registrada: {}C".format(max(temperaturas))) print("A menor temperatura registrada: {}C".format(min(temperaturas))) print("A temperatura mdia registrada: {}C".format(media)) break
[ 2, 440, 2129, 433, 3263, 78, 10062, 324, 723, 390, 25582, 928, 544, 300, 258, 3445, 265, 280, 31215, 748, 268, 10396, 332, 23781, 1430, 64, 8358, 443, 544, 355, 23781, 11644, 403, 1462, 773, 13221, 4533, 390, 4124, 2541, 292, 11, 30...
2.596364
275
#!/usr/bin/env python """ Created by howie.hu at 2021/4/7. Description Changelog: all notable changes to this file will be documented """ import hashlib def md5_encryption(string: str) -> str: """ md5 :param string: :return: """ m = hashlib.md5() m.update(string.encode("utf-8")) return m.hexdigest()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 37811, 198, 220, 220, 220, 15622, 416, 703, 494, 13, 13415, 379, 33448, 14, 19, 14, 22, 13, 198, 220, 220, 220, 12489, 198, 220, 220, 220, 609, 8368, 519, 25, 477, 12411, 2458, 284...
2.406897
145
""" PEP 0484 ( https://www.python.org/dev/peps/pep-0484/ ) describes type hints through function annotations. There is a strong suggestion in this document that only the type of type hinting defined in PEP0484 should be allowed as annotations in future python versions. """ import re from parso import ParserSyntaxError, parse from jedi._compatibility import force_unicode from jedi.evaluate.cache import evaluator_method_cache from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS from jedi.evaluate.gradual.typing import TypeVar, LazyGenericClass, \ AbstractAnnotatedClass from jedi.evaluate.gradual.typing import GenericClass from jedi.evaluate.helpers import is_string from jedi.evaluate.compiled import builtin_from_name from jedi import debug from jedi import parser_utils def eval_annotation(context, annotation): """ Evaluates an annotation node. This means that it evaluates the part of `int` here: foo: int = 3 Also checks for forward references (strings) """ context_set = context.eval_node(annotation) if len(context_set) != 1: debug.warning("Eval'ed typing index %s should lead to 1 object, " " not %s" % (annotation, context_set)) return context_set evaled_context = list(context_set)[0] if is_string(evaled_context): result = _get_forward_reference_node(context, evaled_context.get_safe_value()) if result is not None: return context.eval_node(result) return context_set def _split_comment_param_declaration(decl_text): """ Split decl_text on commas, but group generic expressions together. For example, given "foo, Bar[baz, biz]" we return ['foo', 'Bar[baz, biz]']. """ try: node = parse(decl_text, error_recovery=False).children[0] except ParserSyntaxError: debug.warning('Comment annotation is not valid Python: %s' % decl_text) return [] if node.type == 'name': return [node.get_code().strip()] params = [] try: children = node.children except AttributeError: return [] else: for child in children: if child.type in ['name', 'atom_expr', 'power']: params.append(child.get_code().strip()) return params def _infer_param(execution_context, param): """ Infers the type of a function parameter, using type annotations. """ annotation = param.annotation if annotation is None: # If no Python 3-style annotation, look for a Python 2-style comment # annotation. # Identify parameters to function in the same sequence as they would # appear in a type comment. all_params = [child for child in param.parent.children if child.type == 'param'] node = param.parent.parent comment = parser_utils.get_following_comment_same_line(node) if comment is None: return NO_CONTEXTS match = re.match(r"^#\s*type:\s*\(([^#]*)\)\s*->", comment) if not match: return NO_CONTEXTS params_comments = _split_comment_param_declaration(match.group(1)) # Find the specific param being investigated index = all_params.index(param) # If the number of parameters doesn't match length of type comment, # ignore first parameter (assume it's self). if len(params_comments) != len(all_params): debug.warning( "Comments length != Params length %s %s", params_comments, all_params ) from jedi.evaluate.context.instance import InstanceArguments if isinstance(execution_context.var_args, InstanceArguments): if index == 0: # Assume it's self, which is already handled return NO_CONTEXTS index -= 1 if index >= len(params_comments): return NO_CONTEXTS param_comment = params_comments[index] return _evaluate_annotation_string( execution_context.function_context.get_default_param_context(), param_comment ) # Annotations are like default params and resolve in the same way. context = execution_context.function_context.get_default_param_context() return eval_annotation(context, annotation) def infer_type_vars_for_execution(execution_context, annotation_dict): """ Some functions use type vars that are not defined by the class, but rather only defined in the function. See for example `iter`. In those cases we want to: 1. Search for undefined type vars. 2. Infer type vars with the execution state we have. 3. Return the union of all type vars that have been found. """ context = execution_context.function_context.get_default_param_context() annotation_variable_results = {} executed_params, _ = execution_context.get_executed_params_and_issues() for executed_param in executed_params: try: annotation_node = annotation_dict[executed_param.string_name] except KeyError: continue annotation_variables = find_unknown_type_vars(context, annotation_node) if annotation_variables: # Infer unknown type var annotation_context_set = context.eval_node(annotation_node) star_count = executed_param._param_node.star_count actual_context_set = executed_param.infer(use_hints=False) if star_count == 1: actual_context_set = actual_context_set.merge_types_of_iterate() elif star_count == 2: # TODO _dict_values is not public. actual_context_set = actual_context_set.try_merge('_dict_values') for ann in annotation_context_set: _merge_type_var_dicts( annotation_variable_results, _infer_type_vars(ann, actual_context_set), ) return annotation_variable_results def _infer_type_vars(annotation_context, context_set): """ This function tries to find information about undefined type vars and returns a dict from type var name to context set. This is for example important to understand what `iter([1])` returns. According to typeshed, `iter` returns an `Iterator[_T]`: def iter(iterable: Iterable[_T]) -> Iterator[_T]: ... This functions would generate `int` for `_T` in this case, because it unpacks the `Iterable`. """ type_var_dict = {} if isinstance(annotation_context, TypeVar): return {annotation_context.py__name__(): context_set.py__class__()} elif isinstance(annotation_context, LazyGenericClass): name = annotation_context.py__name__() if name == 'Iterable': given = annotation_context.get_generics() if given: for nested_annotation_context in given[0]: _merge_type_var_dicts( type_var_dict, _infer_type_vars( nested_annotation_context, context_set.merge_types_of_iterate() ) ) elif name == 'Mapping': given = annotation_context.get_generics() if len(given) == 2: for context in context_set: try: method = context.get_mapping_item_contexts except AttributeError: continue key_contexts, value_contexts = method() for nested_annotation_context in given[0]: _merge_type_var_dicts( type_var_dict, _infer_type_vars( nested_annotation_context, key_contexts, ) ) for nested_annotation_context in given[1]: _merge_type_var_dicts( type_var_dict, _infer_type_vars( nested_annotation_context, value_contexts, ) ) return type_var_dict
[ 37811, 198, 47, 8905, 657, 34137, 357, 3740, 1378, 2503, 13, 29412, 13, 2398, 14, 7959, 14, 431, 862, 14, 431, 79, 12, 15, 34137, 14, 1267, 8477, 2099, 20269, 198, 9579, 2163, 37647, 13, 1318, 318, 257, 1913, 13052, 287, 428, 3188, ...
2.268576
3,701
"""Below Python Programme demonstrate rpartition functions in a string""" string = "Python is fun" # 'is' separator is found print(string.rpartition('is ')) # 'not' separator is not found print(string.rpartition('not ')) string = "Python is fun, isn't it" # splits at last occurence of 'is' print(string.rpartition('is'))
[ 37811, 21106, 11361, 35232, 10176, 374, 3911, 653, 198, 12543, 2733, 287, 257, 4731, 37811, 198, 8841, 796, 366, 37906, 318, 1257, 1, 198, 198, 2, 705, 271, 6, 2880, 1352, 318, 1043, 198, 4798, 7, 8841, 13, 81, 3911, 653, 10786, 271...
3.046729
107
data = ( 'Mie ', # 0x00 'Xu ', # 0x01 'Mang ', # 0x02 'Chi ', # 0x03 'Ge ', # 0x04 'Xuan ', # 0x05 'Yao ', # 0x06 'Zi ', # 0x07 'He ', # 0x08 'Ji ', # 0x09 'Diao ', # 0x0a 'Cun ', # 0x0b 'Tong ', # 0x0c 'Ming ', # 0x0d 'Hou ', # 0x0e 'Li ', # 0x0f 'Tu ', # 0x10 'Xiang ', # 0x11 'Zha ', # 0x12 'Xia ', # 0x13 'Ye ', # 0x14 'Lu ', # 0x15 'A ', # 0x16 'Ma ', # 0x17 'Ou ', # 0x18 'Xue ', # 0x19 'Yi ', # 0x1a 'Jun ', # 0x1b 'Chou ', # 0x1c 'Lin ', # 0x1d 'Tun ', # 0x1e 'Yin ', # 0x1f 'Fei ', # 0x20 'Bi ', # 0x21 'Qin ', # 0x22 'Qin ', # 0x23 'Jie ', # 0x24 'Bu ', # 0x25 'Fou ', # 0x26 'Ba ', # 0x27 'Dun ', # 0x28 'Fen ', # 0x29 'E ', # 0x2a 'Han ', # 0x2b 'Ting ', # 0x2c 'Hang ', # 0x2d 'Shun ', # 0x2e 'Qi ', # 0x2f 'Hong ', # 0x30 'Zhi ', # 0x31 'Shen ', # 0x32 'Wu ', # 0x33 'Wu ', # 0x34 'Chao ', # 0x35 'Ne ', # 0x36 'Xue ', # 0x37 'Xi ', # 0x38 'Chui ', # 0x39 'Dou ', # 0x3a 'Wen ', # 0x3b 'Hou ', # 0x3c 'Ou ', # 0x3d 'Wu ', # 0x3e 'Gao ', # 0x3f 'Ya ', # 0x40 'Jun ', # 0x41 'Lu ', # 0x42 'E ', # 0x43 'Ge ', # 0x44 'Mei ', # 0x45 'Ai ', # 0x46 'Qi ', # 0x47 'Cheng ', # 0x48 'Wu ', # 0x49 'Gao ', # 0x4a 'Fu ', # 0x4b 'Jiao ', # 0x4c 'Hong ', # 0x4d 'Chi ', # 0x4e 'Sheng ', # 0x4f 'Ne ', # 0x50 'Tun ', # 0x51 'Fu ', # 0x52 'Yi ', # 0x53 'Dai ', # 0x54 'Ou ', # 0x55 'Li ', # 0x56 'Bai ', # 0x57 'Yuan ', # 0x58 'Kuai ', # 0x59 '[?] ', # 0x5a 'Qiang ', # 0x5b 'Wu ', # 0x5c 'E ', # 0x5d 'Shi ', # 0x5e 'Quan ', # 0x5f 'Pen ', # 0x60 'Wen ', # 0x61 'Ni ', # 0x62 'M ', # 0x63 'Ling ', # 0x64 'Ran ', # 0x65 'You ', # 0x66 'Di ', # 0x67 'Zhou ', # 0x68 'Shi ', # 0x69 'Zhou ', # 0x6a 'Tie ', # 0x6b 'Xi ', # 0x6c 'Yi ', # 0x6d 'Qi ', # 0x6e 'Ping ', # 0x6f 'Zi ', # 0x70 'Gu ', # 0x71 'Zi ', # 0x72 'Wei ', # 0x73 'Xu ', # 0x74 'He ', # 0x75 'Nao ', # 0x76 'Xia ', # 0x77 'Pei ', # 0x78 'Yi ', # 0x79 'Xiao ', # 0x7a 'Shen ', # 0x7b 'Hu ', # 0x7c 'Ming ', # 0x7d 'Da ', # 0x7e 'Qu ', # 0x7f 'Ju ', # 0x80 'Gem ', # 0x81 'Za ', # 0x82 'Tuo ', # 0x83 'Duo ', # 0x84 'Pou ', # 0x85 'Pao ', # 0x86 'Bi ', # 0x87 'Fu ', # 0x88 'Yang ', # 0x89 'He ', # 0x8a 'Zha ', # 0x8b 'He ', # 0x8c 'Hai ', # 0x8d 'Jiu ', # 0x8e 'Yong ', # 0x8f 'Fu ', # 0x90 'Que ', # 0x91 'Zhou ', # 0x92 'Wa ', # 0x93 'Ka ', # 0x94 'Gu ', # 0x95 'Ka ', # 0x96 'Zuo ', # 0x97 'Bu ', # 0x98 'Long ', # 0x99 'Dong ', # 0x9a 'Ning ', # 0x9b 'Tha ', # 0x9c 'Si ', # 0x9d 'Xian ', # 0x9e 'Huo ', # 0x9f 'Qi ', # 0xa0 'Er ', # 0xa1 'E ', # 0xa2 'Guang ', # 0xa3 'Zha ', # 0xa4 'Xi ', # 0xa5 'Yi ', # 0xa6 'Lie ', # 0xa7 'Zi ', # 0xa8 'Mie ', # 0xa9 'Mi ', # 0xaa 'Zhi ', # 0xab 'Yao ', # 0xac 'Ji ', # 0xad 'Zhou ', # 0xae 'Ge ', # 0xaf 'Shuai ', # 0xb0 'Zan ', # 0xb1 'Xiao ', # 0xb2 'Ke ', # 0xb3 'Hui ', # 0xb4 'Kua ', # 0xb5 'Huai ', # 0xb6 'Tao ', # 0xb7 'Xian ', # 0xb8 'E ', # 0xb9 'Xuan ', # 0xba 'Xiu ', # 0xbb 'Wai ', # 0xbc 'Yan ', # 0xbd 'Lao ', # 0xbe 'Yi ', # 0xbf 'Ai ', # 0xc0 'Pin ', # 0xc1 'Shen ', # 0xc2 'Tong ', # 0xc3 'Hong ', # 0xc4 'Xiong ', # 0xc5 'Chi ', # 0xc6 'Wa ', # 0xc7 'Ha ', # 0xc8 'Zai ', # 0xc9 'Yu ', # 0xca 'Di ', # 0xcb 'Pai ', # 0xcc 'Xiang ', # 0xcd 'Ai ', # 0xce 'Hen ', # 0xcf 'Kuang ', # 0xd0 'Ya ', # 0xd1 'Da ', # 0xd2 'Xiao ', # 0xd3 'Bi ', # 0xd4 'Yue ', # 0xd5 '[?] ', # 0xd6 'Hua ', # 0xd7 'Sasou ', # 0xd8 'Kuai ', # 0xd9 'Duo ', # 0xda '[?] ', # 0xdb 'Ji ', # 0xdc 'Nong ', # 0xdd 'Mou ', # 0xde 'Yo ', # 0xdf 'Hao ', # 0xe0 'Yuan ', # 0xe1 'Long ', # 0xe2 'Pou ', # 0xe3 'Mang ', # 0xe4 'Ge ', # 0xe5 'E ', # 0xe6 'Chi ', # 0xe7 'Shao ', # 0xe8 'Li ', # 0xe9 'Na ', # 0xea 'Zu ', # 0xeb 'He ', # 0xec 'Ku ', # 0xed 'Xiao ', # 0xee 'Xian ', # 0xef 'Lao ', # 0xf0 'Bo ', # 0xf1 'Zhe ', # 0xf2 'Zha ', # 0xf3 'Liang ', # 0xf4 'Ba ', # 0xf5 'Mie ', # 0xf6 'Le ', # 0xf7 'Sui ', # 0xf8 'Fou ', # 0xf9 'Bu ', # 0xfa 'Han ', # 0xfb 'Heng ', # 0xfc 'Geng ', # 0xfd 'Shuo ', # 0xfe 'Ge ', # 0xff )
[ 7890, 796, 357, 198, 6, 44, 494, 46083, 220, 220, 220, 1303, 657, 87, 405, 198, 6, 55, 84, 46083, 220, 220, 220, 1303, 657, 87, 486, 198, 6, 44, 648, 46083, 220, 220, 220, 1303, 657, 87, 2999, 198, 6, 1925, 72, 46083, 220, 220...
1.50213
3,051
import sys import unittest def merge(nums1, nums2): """ :param nums1: Sorted list of numbers. :param nums2: Sorted list of numbers. :return: Combined sorted list of numbers. """ merged = list() while len(nums1) != 0 and len(nums2) != 0: if nums1[0] <= nums2[0]: merged.append(nums1.pop(0)) else: merged.append(nums2.pop(0)) while len(nums1) != 0: merged.append(nums1.pop(0)) while len(nums2) != 0: merged.append(nums2.pop(0)) return merged def merge_sort(nums): """ :param nums: List of numbers to sort. :return: Sorted list of numbers. """ if len(nums) != 1: nums1 = merge_sort(nums[:(len(nums) / 2)]) nums2 = merge_sort(nums[(len(nums) / 2):]) sorted_nums = merge(nums1, nums2) return sorted_nums else: # Nothing to do for a list of length 1. return nums if __name__ == "__main__": sys.stdout.write("Bryan Laird merge_sort module. Test mode.\n") sys.exit(unittest.main())
[ 11748, 25064, 198, 11748, 555, 715, 395, 628, 198, 4299, 20121, 7, 77, 5700, 16, 11, 997, 82, 17, 2599, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 1058, 17143, 997, 82, 16, 25, 311, 9741, 1351, 286, 3146, 13, 198, 220, 220, ...
2.102564
507
# Copyright (c) OpenMMLab. All rights reserved. import tempfile from mmocr.utils import list_from_file, list_to_file lists = [ [], [' '], ['\t'], ['a'], [1], [1.], ['a', 'b'], ['a', 1, 1.], [1, 1., 'a'], ['', ''], ['', 'nol', '', ''], ]
[ 2, 15069, 357, 66, 8, 4946, 44, 5805, 397, 13, 1439, 2489, 10395, 13, 198, 11748, 20218, 7753, 198, 198, 6738, 8085, 1696, 13, 26791, 1330, 1351, 62, 6738, 62, 7753, 11, 1351, 62, 1462, 62, 7753, 198, 198, 20713, 796, 685, 198, 22...
1.912752
149
import cv2 from Text_Detection import detect_characters, detect_string, detect_words import re from live_recognition import facial_recognition # #################################################### frameWidth = 640 frameHeight = 480 nPlateCascade = cv2.CascadeClassifier("../../Resources/haarcascade_russian_plate_number.xml") minArea=500 color=(255,0,255) name=None # count = 0 state_codes = ['AP', 'AR', 'AS', 'BR', 'CG', 'GA', 'GJ', 'HR', 'HP', 'JH', 'KA', 'KL', 'MP', 'MH', 'MN', 'ML', 'MZ', 'NL', 'OD', 'PB', 'RJ', 'SK', 'TN', 'TR', 'UP', 'WB', 'TS','ap', 'ar', 'as', 'br', 'cg', 'ga', 'gj', 'hr', 'hp', 'jh', 'ka', 'kl', 'mp', 'mh', 'mn', 'ml', 'mz', 'nl', 'od', 'pb', 'rj', 'sk', 'tn', 'tr', 'up', 'wb', 'ts'] ###################################################### # cap = cv2.VideoCapture("C:\\Users\\jaira\\PycharmProjects\\opencv_tutorial\\Resources\\test.mp4") cap=cv2.VideoCapture(0,cv2.CAP_DSHOW) cap.set(3, frameWidth) cap.set(4, frameHeight) cap.set(10,150) success, img = cap.read() while success: success, img = cap.read() imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) numberPlates = nPlateCascade.detectMultiScale(imgGray, 1.1, 4) for (x, y, w, h) in numberPlates: area = w*h if area > minArea: cv2.rectangle(img=img,pt1=(x,y),pt2=(x+w,y+h), color=color,thickness=2) # cv2.putText(img=img,text="Number Plate",org=(x,y-5),fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL,color=color,fontScale=1,thickness=2) imgRoi=img[y:y+h,x:x+w] cv2.moveWindow("ROI",40,30) cv2.imshow(winname="ROI",mat=imgRoi) temp=detect_words(imgRoi) for i in state_codes: if i in temp: temp2 = ''.join(ch for ch in temp if ch.isalnum() and ch!="." and ch!="_") if temp[-2:].isnumeric() and temp[2:4].isnumeric() and len(temp)==10: cv2.putText(img=img,text=temp,org=(x,y-5),fontFace=cv2.FONT_HERSHEY_COMPLEX_SMALL,color=color,fontScale=1,thickness=2) print(temp) if name==None: name,face_img=facial_recognition(img) cv2.imshow("Face Recognition",face_img) cv2.imshow("Result", img) if cv2.waitKey(1) & 0xFF == ord('q'): break # except: # break cv2.destroyAllWindows()
[ 11748, 269, 85, 17, 201, 198, 6738, 8255, 62, 11242, 3213, 1330, 4886, 62, 10641, 19858, 11, 4886, 62, 8841, 11, 4886, 62, 10879, 201, 198, 11748, 302, 201, 198, 6738, 2107, 62, 26243, 653, 1330, 16324, 62, 26243, 653, 201, 198, 2, ...
1.995857
1,207
##! python3 ##============================================================================== ## Copyright (c) 2021 COMPAL Electronic Inc. All rights reserved. ## This program contains proprietary and confidential information. ## All rights reserved except as may be permitted by prior written consent. ## ## Compal STiD NPSD Test Program Release Notification. ## ## ModuleName: ## LTE.py (Log to Excel) ## ## Abstract: ## Parsing log info to a excel with 4 sheets. ## 1. Read log file: parse -> store (a list of dict) ## 2. Read the INI threshold data: store as dict ## 3. New excel workbook: by openpyxl ## 4. Set worksheet according to Step 1: by dict and DataFrame ## 5. Set condition formating for each sheet ## according to Step 2: by dict ## 6. Save the workbook to xlsx file ## ## Author: ## 25-Oct-2021 Willy Chen ## ## Revision History: ## Rev 1.0.0.1 25-Oct-2021 Willy ## First create. ##============================================================================== import re import os import sys import pandas as pd import codecs import time import configparser import openpyxl from openpyxl.utils.dataframe import dataframe_to_rows from openpyxl.styles import Font, Fill, colors from openpyxl.formatting.rule import CellIsRule # [Main] g_strVersion = "3.0.0.1" #[ParseLogPath] g_strLogDir = "./Log/Pass" #/====================================================================\# #| Functions of printing log of LTE.py |# #\====================================================================/# def getDateTimeFormat(): strDateTime = "[%s]" % (time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())) return strDateTime def printLog(strPrintLine): strFileName = os.path.basename(__file__).split('.')[0] fileLog = codecs.open(g_strFileName + ".log", 'a', "utf-8") print(strPrintLine) fileLog.write("%s%s\r\n" % (getDateTimeFormat(), strPrintLine)) fileLog.close() if __name__ == "__main__": global g_strFileName, g_strINIPath, g_nMethodIndex g_strFileName = os.path.basename(__file__).split('.')[0] g_strINIPath = os.path.join(os.getcwd(), g_strFileName + ".ini") g_nMethodIndex = 1 printLog("========== Start ==========") printLog("[I][main] Python " + sys.version) printLog("[I][main] %s.py %s" % (g_strFileName, g_strVersion)) # ------------ find the target file -------------- try: LogParser = cLogParser() LogParser.log_to_excel() except Exception as e: printLog("[E][main] Unexpected Error: " + str(e)) printLog("========== End ==========")
[ 2235, 0, 21015, 18, 198, 2235, 23926, 25609, 855, 198, 2235, 220, 220, 220, 15069, 357, 66, 8, 33448, 24301, 1847, 19508, 3457, 13, 1439, 2489, 10395, 13, 198, 2235, 220, 220, 220, 770, 1430, 4909, 20622, 290, 15279, 1321, 13, 198, ...
2.629981
1,054
import matplotlib.pyplot as plt import numpy as np # darts_025 = [0, 0, 0, 0, 2, 5, 6, 7, 8] darts_025 = [0, 0, 0, 2, 3, 5, 7, 8] darts_05 = [0, 0, 3, 3, 4, 4, 5, 7, 7] adas_025_9 = [0, 0, 0, 0, 3, 5, 7] adas_05_9 = [0, 0, 1, 4, 5, 6, 6, 7, 7, 7, 7] adas_05_95 = [] adas_05_97 = [0, 0, 0, 2, 4, 4, 4, 4, 4, 6, 8] mile = [0, 0, 0, 2, 4, 4, 4, 3, 4, 4, 4] mile_adas_025_9 = [0, 0, 0, 0, 3, 4, 5, 5, 6, 6, 6] mile_adas_05_9 = [0, 0, 0, 3, 4, 5, 5, 5, 5, 6, 6] mile_adas_05_95 = [0, 0, 0, 0, 1, 1, 5, 5, 6, 6, 6] mile_adas_05_97 = [0, 0, 0, 0, 0, 3, 3, 4, 4, 4, 4] plt.plot(range(0, 36, 5), darts_025, '-o', label='DARTS, lr: 0.025') # plt.plot(range(0, 41, 5), darts_05, '-o', label='DARTS, lr: 0.05') # # # plt.plot(range(0, 31, 5), adas_025_9, '-o', label='DARTS+Adas, lr: 0.025, beta: 0.9') # # plt.plot(range(0, 51, 5), adas_05_9, '-o', label='DARTS+Adas, lr: 0.05, beta: 0.9') # # plt.plot(range(0, 51, 5), adas_05_97, '-o', label='DARTS+Adas, lr: 0.05, beta: 0.97') plt.plot(range(0, 51, 5), mile, '--o', label='MiLeNAS, lr: 0.025') plt.plot(range(0, 51, 5), mile_adas_025_9, '--o', label='MiLeNAS+Adas, lr: 0.025, beta: 0.9') plt.plot(range(0, 51, 5), mile_adas_05_9, '--o', label='MiLeNAS+Adas, lr: 0.05, beta: 0.9') plt.plot(range(0, 51, 5), mile_adas_05_95, '--o', label='MiLeNAS+Adas, lr: 0.05, beta: 0.95') plt.plot(range(0, 51, 5), mile_adas_05_97, '--o', linewidth=3.0, label='MiLeNAS+Adas, lr: 0.05, beta: 0.97') plt.xlabel('Epoch') plt.ylabel('#Skip-connection') plt.legend() plt.show()
[ 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 299, 32152, 355, 45941, 198, 198, 2, 47807, 62, 36629, 796, 685, 15, 11, 657, 11, 657, 11, 657, 11, 362, 11, 642, 11, 718, 11, 767, 11, 807, 60, 198, 67, 5889,...
1.820823
826
from wagtail.admin.edit_handlers import ( InlinePanel, HelpPanel, FieldPanel, FieldRowPanel, MultiFieldPanel, PageChooserPanel, ) from wagtail.documents.edit_handlers import DocumentChooserPanel from wagtail.images.edit_handlers import ImageChooserPanel from core.helpers import make_translated_interface from core.panels import SearchEngineOptimisationPanel
[ 6738, 266, 363, 13199, 13, 28482, 13, 19312, 62, 4993, 8116, 1330, 357, 198, 220, 220, 220, 554, 1370, 26639, 11, 10478, 26639, 11, 7663, 26639, 11, 7663, 25166, 26639, 11, 15237, 15878, 26639, 11, 198, 220, 220, 220, 7873, 22164, 134...
3.339286
112
divisor = int(input()) bound = int(input()) for num in range(bound, 0, -1): if num % divisor == 0: print(num) break
[ 7146, 271, 273, 796, 493, 7, 15414, 28955, 198, 7784, 796, 493, 7, 15414, 28955, 198, 198, 1640, 997, 287, 2837, 7, 7784, 11, 657, 11, 532, 16, 2599, 198, 220, 220, 220, 611, 997, 4064, 2659, 271, 273, 6624, 657, 25, 198, 220, 2...
2.140625
64
from floodsystem.geo import stations_within_radius from floodsystem.stationdata import build_station_list def run(): """Requirements for Task 1C""" # Build list of stations stations = build_station_list() # Store the coordinates of Cambridge City Centre CambCoord = (52.2053, 0.1218) #store the radius value radius = 10 near_cambstations = stations_within_radius(stations, CambCoord, radius) print(sorted([station.name for station in near_cambstations])) if __name__ == "__main__": print("*** Task 1C: CUED Part IA Flood Warning System ***") run()
[ 6738, 6947, 10057, 13, 469, 78, 1330, 8985, 62, 33479, 62, 42172, 198, 6738, 6947, 10057, 13, 17529, 7890, 1330, 1382, 62, 17529, 62, 4868, 198, 198, 4299, 1057, 33529, 198, 220, 220, 220, 37227, 42249, 329, 15941, 352, 34, 37811, 628...
3.035714
196
from model.objects import Objects import time
[ 6738, 2746, 13, 48205, 1330, 35832, 198, 11748, 640, 628 ]
4.7
10
cities = [ 'Budapest', 'Debrecen', 'Miskolc', 'Szeged', 'Pecs', 'Zuglo', 'Gyor', 'Nyiregyhaza', 'Kecskemet', 'Szekesfehervar', 'Szombathely', 'Jozsefvaros', 'Paradsasvar', 'Szolnok', 'Tatabanya', 'Kaposvar', 'Bekescsaba', 'Erd', 'Veszprem', 'Erzsebetvaros', 'Zalaegerszeg', 'Kispest', 'Sopron', 'Eger', 'Nagykanizsa', 'Dunaujvaros', 'Hodmezovasarhely', 'Salgotarjan', 'Cegled', 'Ozd', 'Baja', 'Vac', 'Szekszard', 'Papa', 'Gyongyos', 'Kazincbarcika', 'Godollo', 'Gyula', 'Hajduboszormeny', 'Kiskunfelegyhaza', 'Ajka', 'Oroshaza', 'Mosonmagyarovar', 'Dunakeszi', 'Kiskunhalas', 'Esztergom', 'Jaszbereny', 'Komlo', 'Nagykoros', 'Mako', 'Budaors', 'Szigetszentmiklos', 'Tata', 'Szentendre', 'Hajduszoboszlo', 'Siofok', 'Torokszentmiklos', 'Hatvan', 'Karcag', 'Gyal', 'Monor', 'Keszthely', 'Varpalota', 'Bekes', 'Dombovar', 'Paks', 'Oroszlany', 'Komarom', 'Vecses', 'Mezotur', 'Mateszalka', 'Mohacs', 'Csongrad', 'Kalocsa', 'Kisvarda', 'Szarvas', 'Satoraljaujhely', 'Hajdunanas', 'Balmazujvaros', 'Mezokovesd', 'Tapolca', 'Szazhalombatta', 'Balassagyarmat', 'Tiszaujvaros', 'Dunaharaszti', 'Fot', 'Dabas', 'Abony', 'Berettyoujfalu', 'Puspokladany', 'God', 'Sarvar', 'Gyomaendrod', 'Kiskoros', 'Pomaz', 'Mor', 'Sarospatak', 'Batonyterenye', 'Bonyhad', 'Gyomro', 'Tiszavasvari', 'Ujfeherto', 'Nyirbator', 'Sarbogard', 'Nagykata', 'Budakeszi', 'Pecel', 'Pilisvorosvar', 'Sajoszentpeter', 'Szigethalom', 'Balatonfured', 'Hajduhadhaz', 'Kisujszallas', 'Dorog', 'Kormend', 'Marcali', 'Barcs', 'Tolna', 'Tiszafured', 'Kiskunmajsa', 'Tiszafoldvar', 'Albertirsa', 'Nagyatad', 'Tiszakecske', 'Toeroekbalint', 'Koszeg', 'Celldomolk', 'Heves', 'Mezobereny', 'Szigetvar', 'Pilis', 'Veresegyhaz', 'Bicske', 'Edeleny', 'Lajosmizse', 'Kistarcsa', 'Hajdusamson', 'Csorna', 'Nagykallo', 'Isaszeg', 'Sarkad', 'Kapuvar', 'Ullo', 'Siklos', 'Toekoel', 'Maglod', 'Paszto', 'Szerencs', 'Turkeve', 'Szeghalom', 'Kerepes', 'Jaszapati', 'Janoshalma', 'Tamasi', 'Kunszentmarton', 'Hajdudorog', 'Vasarosnameny', 'Solymar', 'Rackeve', 'Derecske', 'Kecel', 'Nadudvar', 'Ocsa', 'Dunafoldvar', 'Fehergyarmat', 'Kiskunlachaza', 'Kunszentmiklos', 'Szentgotthard', 'Devavanya', 'Biatorbagy', 'Kunhegyes', 'Lenti', 'Ercsi', 'Balatonalmadi', 'Polgar', 'Tura', 'Suelysap', 'Fuzesabony', 'Jaszarokszallas', 'Gardony', 'Tarnok', 'Nyiradony', 'Zalaszentgrot', 'Sandorfalva', 'Soltvadkert', 'Nyergesujfalu', 'Bacsalmas', 'Csomor', 'Putnok', 'Veszto', 'Kistelek', 'Zirc', 'Halasztelek', 'Mindszent', 'Acs', 'Enying', 'Letavertes', 'Nyirtelek', 'Szentlorinc', 'Felsozsolca', 'Solt', 'Fegyvernek', 'Nagyecsed', 'Encs', 'Ibrany', 'Mezokovacshaza', 'Ujszasz', 'Bataszek', 'Balkany', 'Sumeg', 'Tapioszecso', 'Szabadszallas', 'Battonya', 'Polgardi', 'Mezocsat', 'Totkomlos', 'Piliscsaba', 'Szecseny', 'Fuzesgyarmat', 'Kaba', 'Pusztaszabolcs', 'Teglas', 'Mezohegyes', 'Jaszladany', 'Tapioszele', 'Aszod', 'Diosd', 'Taksony', 'Tiszalok', 'Izsak', 'Komadi', 'Lorinci', 'Alsozsolca', 'Kartal', 'Dunavarsany', 'Erdokertes', 'Janossomorja', 'Kerekegyhaza', 'Balatonboglar', 'Szikszo', 'Domsod', 'Nagyhalasz', 'Kisber', 'Kunmadaras', 'Berhida', 'Kondoros', 'Melykut', 'Jaszkiser', 'Csurgo', 'Csorvas', 'Nagyszenas', 'Ujkigyos', 'Tapioszentmarton', 'Tat', 'Egyek', 'Tiszaluc', 'Orbottyan', 'Rakoczifalva', 'Hosszupalyi', 'Paty', 'Elek', 'Vamospercs', 'Morahalom', 'Bugyi', 'Emod', 'Labatlan', 'Csakvar', 'Algyo', 'Kenderes', 'Csenger', 'Fonyod', 'Rakamaz', 'Martonvasar', 'Devecser', 'Orkeny', 'Tokaj', 'Tiszaalpar', 'Kemecse', 'Korosladany' ]
[ 66, 871, 796, 685, 198, 220, 220, 220, 705, 33, 463, 35746, 3256, 198, 220, 220, 220, 705, 16587, 8344, 268, 3256, 198, 220, 220, 220, 705, 44, 1984, 349, 66, 3256, 198, 220, 220, 220, 705, 50, 89, 1533, 276, 3256, 198, 220, 220...
1.635361
2,811
# Generated by Django 3.1.1 on 2020-09-09 12:53 from django.db import migrations, models
[ 2, 2980, 515, 416, 37770, 513, 13, 16, 13, 16, 319, 12131, 12, 2931, 12, 2931, 1105, 25, 4310, 198, 198, 6738, 42625, 14208, 13, 9945, 1330, 15720, 602, 11, 4981, 628 ]
2.84375
32
import json from ..webstack import run as webstack_run
[ 11748, 33918, 198, 6738, 11485, 12384, 25558, 1330, 1057, 355, 3992, 25558, 62, 5143, 628 ]
3.733333
15
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright (c) 2011-2019, Gianluca Fiore # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # ############################################################################### # # Requirements: Python 3.7 or later, Py3exiv # __author__ = "Gianluca Fiore" __license__ = "GPL" __version__ = "0.2" __date__ = "20190912" __email__ = "forod.g@gmail.com" __status__ = "beta" import sys import argparse import os.path import py3exiv def argument_parser(): """Argument parser""" cli_parser = argparse.ArgumentParser() cli_parser.add_argument("-f", "--force", action="store_true", help="force writing of tags regardless of them being already present", dest="force") cli_parser.add_argument("-i", "--image", required=True, action="store", help="the image", dest="image") cli_parser.add_argument("-d", "--delete", action="store_true", help="delete all tags present in an image", dest="delete") cli_parser.add_argument(action="store", nargs="*", help="the tags to be written into the file", dest="tags") options = cli_parser.parse_args() return options def write_tags(image, key, tags): """Write each tags into the iptc key inside an image. Tags must be a list""" image[key] = pyexiv2.IptcTag(key, tags) image.write() def delete_tags(metadata, key): """Delete any tags present inside an image""" try: metadata.__delitem__(key) except KeyError: print(("There's not a %s tag in this image, exiting..." % key)) return 1 def main (): """main loop""" options = argument_parser() image = os.path.abspath(options.image) if os.path.isfile(image) and image.endswith(('jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG', 'tiff', 'TIFF')): m = pyexiv2.ImageMetadata(image) m.read() iptckeys = m.iptc_keys xmpkeys = m.xmp_keys exifkeys = m.exif_keys if options.delete: # delete all tags try: k = m['Iptc.Application2.Keywords'] delete_tags(m, 'Iptc.Application2.Keywords') print("Deleting tags") m.write() return 0 except KeyError: # there are already no tags, skip... print(("%s has no tags, nothing to delete" % options.image)) return 0 if not options.tags: # without tags given perhaps the user wants just see the already # presents tags (if any) try: k = m['Iptc.Application2.Keywords'] print(("%s is already tagged with %s " % (options.image, k.value))) return 0 except: print(("%s has no tags set" % options.image)) return 0 else: try: k = m['Iptc.Application2.Keywords'] if options.force: # Force switch enabled, write tags without questions write_tags(m, 'Iptc.Application2.Keywords', options.tags) else: print("There are already these tags present:\n") for t in k.value: print(t) s = input("\nDo you want to overwrite them with %s ? [y/n] " % options.tags) if s == 'y' or s == 'Y': print("Writing tags") write_tags(m, 'Iptc.Application2.Keywords', options.tags) else: print("Exiting...") sys.exit(0) except KeyError: # there is no previously set tag with this name, pyexiv2 throws KeyError print("Writing tags") write_tags(m, 'Iptc.Application2.Keywords', options.tags) else: print("No image given") if __name__ == '__main__': status = main() sys.exit(status)
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 29113, 29113, 7804, 4242, 21017, 198, 2, 15069, 357, 66, 8, 2813, 12, 23344, 11, 30851, 75, 43120, 23238, 382, 198, 2...
2.136054
2,058
import trio import os import json from itertools import count # Experiment with generating Chrome Event Trace format, which can be browsed # through chrome://tracing or other mechanisms. # # Screenshot: https://files.gitter.im/python-trio/general/fp6w/image.png # # Trace format docs: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview# # # Things learned so far: # - I don't understand how the ph="s"/ph="f" flow events work I think # they're supposed to show up as arrows, and I'm emitting them between tasks # that wake each other up, but they're not showing up. # - I think writing out json synchronously from each event is creating gaps in # the trace; maybe better to batch them up to write up all at once at the # end # - including tracebacks would be cool # - there doesn't seem to be any good way to group together tasks based on # nurseries. this really limits the value of this particular trace # format+viewer for us. (also maybe we should have an instrumentation event # when a nursery is opened/closed?) # - task._counter should maybe be public # - I don't know how to best show task lifetime, scheduling times, and what # the task is actually doing on the same plot. if we want to show particular # events like "called stream.send_all", then the chrome trace format won't # let us also show "task is running", because neither kind of event is # strictly nested inside the other t = Trace(open("/tmp/t.json", "w")) trio.run(parent, instruments=[t])
[ 11748, 19886, 198, 11748, 28686, 198, 11748, 33918, 198, 6738, 340, 861, 10141, 1330, 954, 198, 198, 2, 29544, 351, 15453, 13282, 8558, 34912, 5794, 11, 543, 460, 307, 4772, 36622, 198, 2, 832, 32030, 1378, 2213, 4092, 393, 584, 11701, ...
3.40625
448
from data_refinery_common.models.surveys import SurveyJob, SurveyJobKeyValue from data_refinery_common.models.batches import ( BatchStatuses, Batch, BatchKeyValue, File ) from data_refinery_common.models.jobs import ( WorkerJob, DownloaderJob, ProcessorJob ) from data_refinery_common.models.organism import Organism
[ 6738, 1366, 62, 5420, 15451, 62, 11321, 13, 27530, 13, 11793, 303, 893, 1330, 13084, 33308, 11, 13084, 33308, 9218, 11395, 198, 6738, 1366, 62, 5420, 15451, 62, 11321, 13, 27530, 13, 8664, 2052, 1330, 357, 198, 220, 220, 220, 347, 963...
2.827869
122
from zeep import Client from models import RequestParameter if __name__ == '__main__': main()
[ 6738, 41271, 538, 1330, 20985, 198, 6738, 4981, 1330, 19390, 36301, 628, 628, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419, 198 ]
3.290323
31
from rest_framework import generics from .permissions import IsOwner from .serializers import BucketlistSerializer, UserSerializer from .models import Bucketlist from django.contrib.auth.models import User from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import SessionAuthentication
[ 6738, 1334, 62, 30604, 1330, 1152, 873, 198, 6738, 764, 525, 8481, 1330, 1148, 42419, 198, 6738, 764, 46911, 11341, 1330, 48353, 4868, 32634, 7509, 11, 11787, 32634, 7509, 198, 6738, 764, 27530, 1330, 48353, 4868, 198, 6738, 42625, 14208,...
4.405405
74
# coding: utf-8 # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 from oci.decorators import init_model_state_from_kwargs
[ 2, 19617, 25, 3384, 69, 12, 23, 198, 2, 15069, 357, 66, 8, 1584, 11, 12131, 11, 18650, 290, 14, 273, 663, 29116, 13, 220, 1439, 2489, 10395, 13, 198, 2, 770, 3788, 318, 10668, 12, 36612, 284, 345, 739, 262, 14499, 2448, 33532, 1...
3.097561
164
from django.contrib import auth, messages from django.shortcuts import redirect, render from django.views.decorators.http import require_POST, require_safe
[ 6738, 42625, 14208, 13, 3642, 822, 1330, 6284, 11, 6218, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 18941, 11, 8543, 198, 6738, 42625, 14208, 13, 33571, 13, 12501, 273, 2024, 13, 4023, 1330, 2421, 62, 32782, 11, 2421, 62, 21230, ...
3.697674
43
import balanced balanced.configure('ak-test-1o9QKwUCrwstHWO5sGxICtIJdQXFTjnrV') order = balanced.Order.fetch('/orders/OR7qAh5x1cFzX0U9hD628LPa')
[ 11748, 12974, 198, 198, 27753, 13, 11250, 495, 10786, 461, 12, 9288, 12, 16, 78, 24, 48, 42, 86, 9598, 31653, 301, 39, 54, 46, 20, 82, 38, 87, 2149, 83, 23852, 67, 48, 55, 9792, 73, 48624, 53, 11537, 198, 198, 2875, 796, 12974, ...
1.972973
74
from typing import List #
[ 6738, 19720, 1330, 7343, 628, 198, 2, 220, 628 ]
3.333333
9
from __future__ import print_function import tensorflow as tf import numpy as np from collections import namedtuple, OrderedDict from subprocess import call import scipy.io.wavfile as wavfile import argparse import codecs import timeit import struct import toml import re import sys import os def slice_signal(signal, window_size, stride=0.5): """ Return windows of the given signal by sweeping in stride fractions of window """ assert signal.ndim == 1, signal.ndim n_samples = signal.shape[0] offset = int(window_size * stride) slices = [] for beg_i, end_i in zip(range(0, n_samples, offset), range(window_size, n_samples + offset, offset)): if end_i - beg_i < window_size: break slice_ = signal[beg_i:end_i] if slice_.shape[0] == window_size: slices.append(slice_) return np.array(slices, dtype=np.int32) def encoder_proc(wav_filename, noisy_path, out_file, wav_canvas_size, baseline_dir=None): """ Read and slice the wav and noisy files and write to TFRecords. out_file: TFRecordWriter. """ ppath, wav_fullname = os.path.split(wav_filename) noisy_filename = os.path.join(noisy_path, wav_fullname) wav_signals = read_and_slice(wav_filename, wav_canvas_size) noisy_signals = read_and_slice(noisy_filename, wav_canvas_size) if not baseline_dir is None: baseline_filename = os.path.join(baseline_dir, wav_fullname) baseline_signals = read_and_slice(baseline_filename, wav_canvas_size) assert wav_signals.shape == noisy_signals.shape, noisy_signals.shape if baseline_dir is None: for (wav, noisy) in zip(wav_signals, noisy_signals): wav_raw = wav.tostring() noisy_raw = noisy.tostring() example = tf.train.Example(features=tf.train.Features(feature={ 'wav_raw': _bytes_feature(wav_raw), 'noisy_raw': _bytes_feature(noisy_raw)})) out_file.write(example.SerializeToString()) else: for (wav, noisy, base) in zip(wav_signals, noisy_signals, baseline_signals): wav_raw = wav.tostring() noisy_raw = noisy.tostring() baseline_raw = base.tostring() example = tf.train.Example(features=tf.train.Features(feature={ 'wav_raw': _bytes_feature(wav_raw), 'noisy_raw': _bytes_feature(noisy_raw), 'baseline_raw': _bytes_feature(baseline_raw) })) out_file.write(example.SerializeToString()) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert the set of txt and ' 'wavs to TFRecords') parser.add_argument('--cfg', type=str, default='cfg/e2e_maker.cfg', help='File containing the description of datasets ' 'to extract the info to make the TFRecords.') parser.add_argument('--save_path', type=str, default='data/', help='Path to save the dataset') parser.add_argument('--out_file', type=str, default='segan.tfrecords', help='Output filename') parser.add_argument('--force-gen', dest='force_gen', action='store_true', help='Flag to force overwriting existing dataset.') parser.set_defaults(force_gen=False) opts = parser.parse_args() main(opts)
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 11748, 299, 32152, 355, 45941, 198, 6738, 17268, 1330, 3706, 83, 29291, 11, 14230, 1068, 35, 713, 198, 6738, 850, 14681, 1330, 869, 198, 1174...
2.222363
1,574
from myShop import MyShop from myBot import MYBOT from sMenu import Menu
[ 6738, 616, 29917, 1330, 2011, 29917, 198, 6738, 616, 20630, 1330, 17615, 33, 2394, 198, 6738, 264, 23381, 1330, 21860 ]
3.6
20
import time, sys, os, hashlib, json, re import requests, random, js2py import urllib.request import urllib.parse # languageMapCode = { '': 'auto', '': 'sq', '': 'ar', '': 'am', '': 'az', '': 'ga', '': 'et', '': 'eu', '': 'be', '': 'bg', '': 'is', '': 'pl', '': 'bs', '': 'fa', '()': 'af', '': 'da', '': 'de', '': 'ru', '': 'fr', '': 'tl', '': 'fi', '': 'fy', '': 'km', '': 'ka', '': 'gu', '': 'kk', '': 'ht', '': 'ko', '': 'ha', '': 'nl', '': 'ky', '': 'gl', '': 'ca', '': 'cs', '': 'kn', '': 'co', '': 'hr', '': 'ku', '': 'la', '': 'lv', '': 'lo', '': 'lt', '': 'lb', '': 'ro', '': 'mg', '': 'mt', '': 'mr', '': 'ml', '': 'ms', '': 'mk', '': 'mi', '': 'mn', '': 'bn', '': 'my', '': 'hmn', '': 'xh', '': 'zu', '': 'ne', '': 'no', '': 'pa', '': 'pt', '': 'ps', '': 'ny', '': 'ja', '': 'sv', '': 'sm', '': 'sr', '': 'st', '': 'si', '': 'eo', '': 'sk', '': 'sl', '': 'sw', '': 'gd', '': 'ceb', '': 'so', '': 'tg', '': 'te', '': 'ta', '': 'th', '': 'tr', '': 'cy', '': 'ur', '': 'uk', '': 'uz', '': 'es', '': 'iw', '': 'el', '': 'haw', '': 'sd', '': 'hu', '': 'sn', '': 'hy', '': 'ig', '': 'it', '': 'yi', '': 'hi', '': 'su', '': 'id', '': 'jw', '': 'en', '': 'yo', '': 'vi', '': 'zh-CN', '()': 'zh-TW' } """ """
[ 11748, 640, 11, 25064, 11, 28686, 11, 12234, 8019, 11, 33918, 11, 302, 198, 11748, 7007, 11, 4738, 11, 44804, 17, 9078, 198, 11748, 2956, 297, 571, 13, 25927, 198, 11748, 2956, 297, 571, 13, 29572, 628, 198, 2, 220, 628, 628, 628, ...
1.620079
1,016
import xNormal xNormal.run("piano_high.obj", "piano_low.obj", "piano.png", width=256, height=256, gen_normals = True, gen_ao = True)
[ 11748, 2124, 26447, 198, 87, 26447, 13, 5143, 7203, 79, 10115, 62, 8929, 13, 26801, 1600, 366, 79, 10115, 62, 9319, 13, 26801, 1600, 366, 79, 10115, 13, 11134, 1600, 9647, 28, 11645, 11, 6001, 28, 11645, 11, 2429, 62, 27237, 874, 79...
2.588235
51
from typing import Sequence, Any, Optional from . import BaseRankingEvaluator
[ 6738, 19720, 1330, 45835, 11, 4377, 11, 32233, 198, 198, 6738, 764, 1330, 7308, 49, 15230, 36, 2100, 84, 1352, 628 ]
3.809524
21
"""Test CLI usage.""" import logging import subprocess # nosec import sys from functools import wraps from os import linesep from tqdm.cli import TqdmKeyError, TqdmTypeError, main from tqdm.utils import IS_WIN from .tests_tqdm import BytesIO, _range, closing, mark, raises def restore_sys(func): """Decorates `func(capsysbin)` to save & restore `sys.(stdin|argv)`.""" return inner def norm(bytestr): """Normalise line endings.""" return bytestr if linesep == "\n" else bytestr.replace(linesep.encode(), b"\n") if sys.version_info[:2] >= (3, 8): test_pipes = mark.filterwarnings("ignore:unclosed file:ResourceWarning")( test_pipes) def test_main_import(): """Test main CLI import""" N = 123 _SYS = sys.stdin, sys.argv # test direct import sys.stdin = [str(i).encode() for i in _range(N)] sys.argv = ['', '--desc', 'Test CLI import', '--ascii', 'True', '--unit_scale', 'True'] try: import tqdm.__main__ # NOQA, pylint: disable=unused-variable finally: sys.stdin, sys.argv = _SYS
[ 37811, 14402, 43749, 8748, 526, 15931, 198, 11748, 18931, 198, 11748, 850, 14681, 220, 1303, 9686, 66, 198, 11748, 25064, 198, 6738, 1257, 310, 10141, 1330, 27521, 198, 6738, 28686, 1330, 3951, 538, 198, 198, 6738, 256, 80, 36020, 13, 4...
2.452703
444
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @REQUEST_M0viz from pyrogram import Client, filters from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from script import script
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2488, 2200, 35780, 62, 44, 15, 85, 528, 628, 198, 6738, 12972, 39529, 1330, 20985, 11, 16628, 198, 6738, 12972...
2.985075
67
from copy import deepcopy from typing import Tuple import jax.numpy as jnp from jax.scipy.linalg import cho_factor, cho_solve from multipledispatch import dispatch from .types import Array def I(n: int) -> Array: """ Compute an n x n identity matrix. :param n: The size of of the matrix. :return: An n x n identity matrix. """ return jnp.eye(n) def concat_dictionaries(a: dict, b: dict) -> dict: """ Append one dictionary below another. If duplicate keys exist, then the key-value pair of the second supplied dictionary will be used. """ return {**a, **b} def merge_dictionaries(base_dict: dict, in_dict: dict) -> dict: """ This will return a complete dictionary based on the keys of the first matrix. If the same key should exist in the second matrix, then the key-value pair from the first dictionary will be overwritten. The purpose of this is that the base_dict will be a complete dictionary of values such that an incomplete second dictionary can be used to update specific key-value pairs. :param base_dict: Complete dictionary of key-value pairs. :param in_dict: Subset of key-values pairs such that values from this dictionary will take precedent. :return: A merged single dictionary. """ for k, v in base_dict.items(): if k in in_dict.keys(): base_dict[k] = in_dict[k] return base_dict def sort_dictionary(base_dict: dict) -> dict: """ Sort a dictionary based on the dictionary's key values. :param base_dict: The unsorted dictionary. :return: A dictionary sorted alphabetically on the dictionary's keys. """ return dict(sorted(base_dict.items())) def unstandardise( x: jnp.DeviceArray, xmean: jnp.DeviceArray, xstd: jnp.DeviceArray ) -> jnp.DeviceArray: """ Unstandardise a given matrix with respect to a previously computed mean and standard deviation. This is designed for remapping a matrix back onto its original scale. :param x: A standardised matrix. :param xmean: A mean vector. :param xstd: A standard deviation vector. :return: A matrix of unstandardised values. """ return (x * xstd) + xmean def as_constant(parameter_set: dict, params: list) -> Tuple[dict, dict]: base_params = deepcopy(parameter_set) sparams = {} for param in params: sparams[param] = base_params[param] del base_params[param] return base_params, sparams
[ 6738, 4866, 1330, 2769, 30073, 198, 6738, 19720, 1330, 309, 29291, 198, 198, 11748, 474, 897, 13, 77, 32152, 355, 474, 37659, 198, 6738, 474, 897, 13, 1416, 541, 88, 13, 75, 1292, 70, 1330, 1727, 62, 31412, 11, 1727, 62, 82, 6442, ...
3.001217
822
import os replace_version((1,8,0), (3,9,1))
[ 11748, 28686, 220, 198, 198, 33491, 62, 9641, 19510, 16, 11, 23, 11, 15, 828, 357, 18, 11, 24, 11, 16, 4008, 628 ]
2.043478
23
import argparse import math import matplotlib.pyplot as plt import os import numpy as np import shutil import pandas as pd import seaborn as sns sns.set() sns.set_context("talk") NUM_BINS = 100 path = '../Data/Video_Info/Pensieve_Info/PenieveVideo_video_info' video_mappings = {} video_mappings['300'] = '320x180x30_vmaf_score' video_mappings['750'] = '640x360x30_vmaf_score' video_mappings['1200'] = '768x432x30_vmaf_score' video_mappings['1850'] = '1024x576x30_vmaf_score' video_mappings['2850'] = '1280x720x30_vmaf_score' video_mappings['4300'] = '1280x720x60_vmaf_score' metric_list = ["reward_vmaf", "reward_br", "rebuf", "br_avg", "vmaf_avg", "switching_vmaf", "switching_br"] #MINERVA rebuf_penalty = 25 switching_penalty = 2.5 segment_lenght = 4.0 pensieve_video_csv = load_csv() # #def get_qoe(abr, trace): # logdir = os.path.join(args.result_dir, abr + "-" + trace, "result") # logfile = os.path.join(logdir, abr + "_rewards_0.log") # # reward = 0 # # # with open(logfile, "r") as fin: # reward_lines = fin.readlines() # # if (len(reward_lines) != args.video_chunks): # if len(reward_lines) < args.video_chunks: # to_clean.append(logfile) # print("{} has {} chunks instead of {}".format(logfile, len(reward_lines), args.video_chunks)) # print("Skip, please") # return None # # for i, r_line in enumerate(reward_lines): # if i > 0: # skip first # reward += float(r_line.split()[-1]) # # return reward if __name__ == "__main__": main()
[ 11748, 1822, 29572, 198, 11748, 10688, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 11748, 28686, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 4423, 346, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 384, 39...
2.150134
746
from typing import TYPE_CHECKING, Any, Dict, List from aiopoke.utils.minimal_resources import MinimalResource from aiopoke.utils.resource import Resource if TYPE_CHECKING: from aiopoke.objects.resources import EncounterConditionValue, EncounterMethod
[ 6738, 19720, 1330, 41876, 62, 50084, 2751, 11, 4377, 11, 360, 713, 11, 7343, 198, 198, 6738, 257, 14922, 2088, 13, 26791, 13, 1084, 4402, 62, 37540, 1330, 1855, 4402, 26198, 198, 6738, 257, 14922, 2088, 13, 26791, 13, 31092, 1330, 208...
3.685714
70