text
string
size
int64
token_count
int64
"""TODO: Add file description.""" import curio # async library import logging # python standard logging library import click # command line interface creation kit (click) import click_log # connects the logger output to click output from datasources.binance_csv import BinanceCSV from datasources.binance...
4,879
1,549
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os.path as op from pathlib import Path FILE_ROOT = Path(__file__).parent with open(op.join(FILE_ROOT, ...
446
151
#!/usr/bin/env python # -*- coding: utf-8 -*- import yahoofinancials def get_historical_price_data(ticker_symbol, start_date, end_date, frequency='weekly'): ''' The API returns historical price data. ''' yf = yahoofinancials.YahooFinancials...
428
140
#!/usr/bin/env python import os import sys dbSet = [] with open('other_allmut_HD.txt',"r") as beds: for bed in beds: bed = bed.strip() bed = bed.split('\t') item = bed[15] + '\t' + bed[16] + '\t' + bed[17] + '\t' + bed[17] + '\t' + bed[17] + '\t' + bed[17] + '\t' + 'https://www.ncbi.nlm.ni...
601
277
import chanutils.reddit _SUBREDDIT = 'Documentaries' _FEEDLIST = [ {'title':'Latest', 'url':'http://www.reddit.com/r/Documentaries.json'}, {'title':'Anthropology', 'url':'http://www.reddit.com/r/documentaries/search.json?q=flair%3A%27Anthropology%27&sort=top&restrict_sr=on&t=all'}, {'title':'Art', 'url':'http:/...
5,058
2,227
from .irbasis import load, basis, sampling_points_matsubara, __version__
73
24
import sys import traceback import click from . import imaging_utility as iu from . import provisioning from . import __version__ def eprint(msg, show): if show: traceback.print_exc() print(file=sys.stderr) click.echo(msg, file=sys.stderr) @click.group() @click.version_option(__version__) @c...
4,650
1,464
def read_paragraph_element(element): """Returns text in given ParagraphElement Args: element: ParagraphElement from Google Doc """ text_run = element.get('textRun') if not text_run: return '' return text_run.get('content') def read_structural_elements(elements): """...
1,338
343
from django.contrib import admin from ServerRestAPI.models import ( Student, Teacher, StudentLecture, TeacherLecture, Lecture ) admin.site.register(Student) admin.site.register(Teacher) admin.site.register(StudentLecture) admin.site.register(TeacherLecture) admin.site.register(Lecture)
301
102
import itertools,math L = [1,2,3] p = list(itertools.permutations(L,3)) D = [list(map(int,input().split())) for i in range(4)] ans = 999999999999 for pp in p: k = [0]+list(pp) d = 0 for i in range(1,4): d += math.sqrt((D[k[i-1]][0] - D[k[i]][0])**2 + (D[k[i-1]][1] - D[k[i]][1])**2) if d < ans:...
352
181
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'cellPoseUI.ui' # Created by: PyQt5 UI code generator 5.11.3 import os, platform, ctypes, sys from PyQt5 import QtWidgets from PyQt5.QtCore import Qt from PyQt5.QtGui import QFontDatabase from scellseg.guis.scellsegUi import Ui_...
7,264
2,628
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
4,066
1,412
import os from ibm_watson import LanguageTranslatorV3 from ibm_cloud_sdk_core.authenticators import IAMAuthenticator from dotenv import load_dotenv load_dotenv() apikey= os.environ['apikey'] url= os.environ['url'] VERSION= '2018-05-01' authenticator= IAMAuthenticator(apikey) language_translator= LanguageTranslatorV3(...
918
316
import trace_malloc as trace '''trace 10 files with maximum memory allocated''' trace.start() # ... run your code ... snapshot = trace.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") for stat in top_stats[:10]: print(stat) '''Backtrack the largest memory block''' # Store 25 f...
629
216
# coding: utf-8 from pathlib import Path import pytest from AxonDeepSeg.visualization.visualize import visualize_training class TestCore(object): def setup(self): # Get the directory where this current file is saved self.fullPath = Path(__file__).resolve().parent # Move up to the test d...
770
223
from normal_forms import normal_form import sympy # Murdock, Normal Forms and Unfoldings of Local Dynamical Systems, Example 4.5.24 def f(x, y, z): f1 = 6 * x + x**2 + x * y + x * z + y**2 + y * z + z**2 f2 = 2 * y + x**2 + x * y + x * z + y**2 + y * z + z**2 f3 = 3 * z + x**2 + x * y + x * z + y**2 + y *...
441
216
def average_speed(s1 : float, s0 : float, t1 : float, t0 : float) -> float: """ [FUNC] average_speed: Returns the average speed. Where: Delta Space = (space1[s1] - space0[s0]) Delta Time = (time1[t1] - time0[t0]) """ return ((s1-s0)/(t1-t0)); def average_acceleration(v1 : flo...
486
204
from django.test import TestCase, Client from django.urls import reverse from django.test.utils import setup_test_environment from bs4 import BeautifulSoup import re import time from projects.models import * from projects.forms import * client = Client() # length of base template, used to test for empty pages LEN_B...
28,858
8,807
from sys import exit from typing import Optional, Final import pygame from rich.traceback import install from chess.board import Chessboard, Move, PieceType, PieceColour from chess.bot import ChessBot from chess.const import GameState from chess.utils import load_image, load_sound, load_font install(show_locals=True...
11,851
3,766
def set_material(sg_node, sg_material_node): '''Sets the material on a scenegraph group node and sets the materialid user attribute at the same time. Arguments: sg_node (RixSGGroup) - scene graph group node to attach the material. sg_material_node (RixSGMaterial) - the scene graph material ...
532
170
import tensorflow as tf from layers.attention_layers import attention_layer from layers.common_layers import init_inputs from layers.feed_forward_layers import feed_forward_diff_features, feed_forward_diff_layers from utils.hyperparams import Hyperparams as hp class AttentionBasedEnsembleNets: def __init__(self...
1,766
566
# Copyright 2013 10gen Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
1,965
577
import math from itertools import product from typing import Tuple, List, Optional, Union import numpy as np import torch import torch.nn as nn import torch.nn.init as init class EMA: """ Class that keeps track of exponential moving average of model parameters of a particular model. Also see https://gith...
9,370
2,598
import matplotlib import matplotlib.pyplot as plt import numpy as np import csv import seaborn as sns import itertools import pandas as pd import scipy from scipy.signal import savgol_filter from scipy.signal import find_peaks_cwt from scipy.signal import boxcar sns.set(font_scale=1.2) sns.set_style("white") colors = ...
2,647
1,091
# Debug or not DEBUG = 1 # Trackbar or not CREATE_TRACKBARS = 1 # Display or not DISPLAY = 1 # Image or Video, if "Video" is given as argument, program will use cv2.VideoCapture # If "Image" argument is given the program will use cv2.imread imageType = "Video" # imageType = "Image" # Image/Video source 0 or 1...
3,349
1,169
#! /usr/bin/env python3 """Context files must contain a 'main' function. The return from the main function should be the resulting text""" def main(params): if hasattr(params,'time'): # 1e6 steps per ns steps = int(params.time * 1e6) else: steps = 10000 return steps
307
102
#-*-coding:utf-8-*- #bodyBMI.py #2018年4月11日 21:03:12 #打印出字符串中的某一部分 ''' import random st = [1,1,15,1,5,8,1,5,8] print (random.shuffle(st)) ''' ''' #利用蒙特卡洛方法计算圆周率PI from random import random from time import perf_counter DATA = pow(1000,100) hit = 0 start = perf_counter() for i in range(1,DATA+1): x,y = random(),r...
1,822
1,029
# Copyright [2018-2020] Peter Krenesky # # 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...
20,499
5,272
#!/usr/local/bin/bash """ Two options: 1) Build DB-specific data files from meta-data files 2) Build a single file containing all the DB-specific 'insert' statements in the correct dependency order from meta-data files and XML table files NOTE: - The data files must be named "xxx.dat"; for option (2) the correspond...
8,421
2,688
#!/usr/bin/env python import numpy as np import chainer from chainer import cuda, Function, gradient_check, Variable, optimizers, serializers, utils from chainer import Link, Chain, ChainList import chainer.functions as F import chainer.links as L from chainer import training from chainer.training import extensions d...
3,806
1,566
import mock import pytest from prf.tests.prf_testcase import PrfTestCase from pyramid.exceptions import ConfigurationExecutionError from prf.resource import Resource, get_view_class, get_parent_elements from prf.view import BaseView class TestResource(PrfTestCase): def test_init_(self): res = Resource(se...
3,294
1,038
"""Test aggregation of config files and command-line options.""" import os import pytest from flake8.main import options from flake8.options import aggregator from flake8.options import config from flake8.options import manager @pytest.fixture def optmanager(): """Create a new OptionManager.""" option_manag...
2,004
717
import os import cv2 import numpy as np import time from backgroundsubtraction.KMeans import KMeans from objectblob.ObjectBlobDetection import ObjectBlobDetection from pixelcleaning.MorphologicalCleaning import MorphologicalCleaning __author__ = 'Luqman' def morphological(image): cleaning_model = Morphologica...
4,091
1,532
# Imports import sys, os, time, logging, json # QR code scanning is on a separate file from qr import qrscan # Configuration using config.json with open('config.json', 'r') as f: config = json.load(f) if 'outfile' in config: outfile = config['outfile'] if 'path' in config: path = config['path'] extensions = c...
2,439
804
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
4,566
1,223
default_app_config='workfolw.apps.WorkfolwConfig'
49
18
class NamingUtils(object): """ A collection of utilities related to element naming. """ @staticmethod def CompareNames(nameA, nameB): """ CompareNames(nameA: str,nameB: str) -> int Compares two object name strings using Revit's comparison rules. nameA: The first obje...
1,176
369
import cv2 import numpy as np from rich import print dewarped = cv2.imread('../dewarped.png') ''' SIZE = 600 # Get ROI corners arucoDict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_APRILTAG_36h11) arucoParams = cv2.aruco.DetectorParameters_create() (corners, ids, rejected) = cv2.aruco.detectMarkers(image, arucoDict, p...
1,616
665
#!/usr/bin/python # Copyright (c) 2014 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest import trie class TrieTest(unittest.TestCase): def MakeUncompressedTrie(self): uncompressed = trie.Node(...
3,699
1,390
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013-2017 Gauvain Pocentek <gauvain@pocentek.net> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the...
6,074
1,923
import pandas as pd import numpy from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier
142
39
# Copyright 2018 AT&T Intellectual Property. All other 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...
2,882
849
import os import reader import json # todo: get this logger from elsewhere from celery.utils.log import get_task_logger log = get_task_logger(__name__) defaultFieldMappings = [ ### SET (['info','protocol'], 'getReplayProtocolVersion'), (['info','bytes'], 'getReplayFileByteSize'), (['info','gameloops'], '...
15,572
4,396
# -*- coding: utf-8 -*- import matplotlib.colors as colorplt import matplotlib.pyplot as plt import numpy as np from sktime.distances._distance import distance_alignment_path, pairwise_distance gray_cmap = colorplt.LinearSegmentedColormap.from_list("", ["#c9cacb", "white"]) def _path_mask(cost_matrix, path, ax, the...
6,214
2,405
# RT Ext - Useful Util # 注意:普通のエクステンションとは違います。 import asyncio from json import dumps from time import time import discord from aiofile import async_open from discord.ext import commands, tasks class RtUtil(commands.Cog): def __init__(self, bot): self.bot = bot self.data = { "list_emb...
5,310
1,762
# -*- coding: utf-8 -*- # # Copyright (C) 2018 CERN. # # Asclepias Broker is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Events CLI.""" from __future__ import absolute_import, print_function import datetime import json import cl...
3,230
1,067
import numpy as np import pytest from src.models.noise_transformation import average_true_var_real, average_true_var_imag, average_true_cov, \ average_true_noise_covariance, naive_noise_covariance test_cases_real_variance = [ (2 - 3j, 0, 0, 0), (0, 1, 1, np.exp(-2) * (2 * np.cosh(2) - np.cosh(1))), (2...
2,620
1,262
from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), path('login', views.login_fun, name='login'), path('signup', views.signup, name='signup'), path('logout', views.logout, name='logout'), ]
257
87
"""Parse NMEA GPS strings""" from pynmea.streamer import NMEAStream nmeaFile = open("nmea.txt") nmea_stream = NMEAStream(stream_obj=nmeaFile) next_data = nmea_stream.get_objects() nmea_objects = [] while next_data: nmea_objects += next_data next_data = nmea_stream.get_objects() # The NMEA stream is parsed!...
494
215
# Description: Class Based Decorators """ ### Note * If you want to maintain some sort of state and/or just make your code more confusing, use class based decorators. """ class ClassBasedDecorator(object): def __init__(self, function_to_decorate): print("INIT ClassBasedDecorator") self.function_...
852
284
# Task 09. Hello, France def validate_price(items_and_prices): item = items_and_prices.split('->')[0] prices = float(items_and_prices.split('->')[1]) if item == 'Clothes' and prices <= 50 or \ item == 'Shoes' and prices <= 35.00 or \ item == 'Accessories' and prices <= 20.50: ...
991
366
"""Finds out all the people you need to follow to follow all the same people as another user. Then, optionally, follows them for you.""" import configparser import csv import errno import os import tweepy from tqdm import tqdm #Useful Constants PATH_TO_TARGET_CSV = "./output/targetfriends.csv" PATH_TO_USER...
7,293
2,771
import pandas as pd import matplotlib.pyplot as plt from nltk import ngrams from preprocessing.preprocess import remove_stopwords """ frequent_ngrams.py was used to generate bar plots of most frequently used bi and trigrams from the fascist and hate documents. @Author: Siôn Davies Date: July 2020 """ # First the fasc...
1,962
787
from unittest.mock import Mock from urllib.error import URLError from codalib import util def test_is_sucessful(monkeypatch): """ Verifies the return value from a successful call to doWaitWebRequest. """ response = Mock() doWebRequest = Mock(return_value=(response, 'fake content')) # Pat...
1,319
427
# Thanks `https://github.com/pypa/sampleproject`!! from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'VERSION'), 'r', encoding='utf-8') as f: version = f.read().strip() with open(path.join(here, 'README.md'), 'r', encoding='utf-8') ...
1,609
536
# -*- coding: utf-8 -*- """ Created on Wed Jun 26 19:39:00 2019 @author: hehehe """ from __future__ import absolute_import, print_function from tweepy import OAuthHandler, Stream, StreamListener #Buat API Twitter di link berikut https://developer.twitter.com/en/apps consumer_key = "masukkan consumer_key" consumer_s...
1,226
414
#ask user to enter a positive value (pedir al usuario que ingrese un valor positivo) a = int(input("please enter a positive integer: ")) #if value entered is negative print "not a positive number" and stop (si el valor introducido es una impresion negativa "no es un número positivo" y se detiene) while a < 0: prin...
683
228
# Copyright 2016-2018 Intel Corporation., Tieto # # 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 agree...
8,788
2,424
from redbot.core import commands, Config, checks import discord from discord.ext import tasks import random import math from datetime import datetime class GoFest(commands.Cog): def __init__(self, bot): self.bot = bot self.contest.start() @commands.is_owner() @commands.command() asyn...
14,104
5,261
from flask import Blueprint api = Blueprint("data_manage_api", __name__) from . import data_venation from . import operator_manage from . import model_manage from . import resource_manage from . import pipeline_manage from . import trainedmodel_manage
254
75
import os import typing import cfg_exporter.custom as custom from cfg_exporter.const import DataType from cfg_exporter.const import TEMPLATE_EXTENSION from cfg_exporter.exports.base.export import BaseExport from cfg_exporter.lang_template import lang from cfg_exporter.tables.base.type import DefaultValue EXTENSION = ...
5,349
1,792
from typing import Any from starlette.datastructures import State class DefaultState: state = State() def get(self,key:str, value: Any = None) -> Any: if hasattr(self.state, key): return getattr(self.state, key) else: if not value: raise Exception('st...
774
232
""" The :mod:`sklearn.metrics` module includes score functions, performance metrics and pairwise metrics and distance computations. """ from .metrics import (accuracy_score, average_precision_score, auc, roc_auc_score, classificati...
3,260
880
from pathlib import Path from collections import defaultdict import numpy as np try: import pandas as pd except ImportError: from dacman.core.utils import dispatch_import_error dispatch_import_error(module_name='pandas', plugin_name='CSV') from dacman.compare import base try: from IPython.display im...
29,736
8,944
# -*- coding: utf-8 -*- import os import sys # ensure `tests` directory path is on top of Python's module search filedir = os.path.dirname(__file__) sys.path.insert(0, filedir) while filedir in sys.path[1:]: sys.path.pop(sys.path.index(filedir)) # avoid duplication import pytest import numpy as np from copy impor...
4,223
1,451
""" File copy from https://github.com/moddevices/lilvlib """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------------------------------------ # Imports import json import lilv import os from math import fmod # -----------------------------...
57,410
17,288
import os ''' This script takes a beatmap file and a bunch of replays, calculates hitoffsets for each replay and saves them to a *.csv file. This script works for std gamemode only. ''' class SaveHitoffsets(): def create_dir(self, dir_path): if not os.path.exists(dir_path): try: os.mkdir(dir_...
1,747
589
{ 'name': 'Clean Theme', 'description': 'Clean Theme', 'category': 'Theme/Services', 'summary': 'Corporate, Business, Tech, Services', 'sequence': 120, 'version': '2.0', 'author': 'Odoo S.A.', 'depends': ['theme_common', 'website_animate'], 'data': [ 'views/assets.xml', ...
779
290
class ValidationException(Exception): pass class NeedsGridType(ValidationException): def __init__(self, ghost_zones=0, fields=None): self.ghost_zones = ghost_zones self.fields = fields def __str__(self): return f"({self.ghost_zones}, {self.fields})" class NeedsOriginalGrid(Needs...
1,283
378
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import logging import hashlib import json import time from redis import Redis from git import Repo # type: ignore from .helpers import get_homedir, get_socket_path """ sha: set of libname|version|fullpath libname|version: hash of fullpath -> sha """ # We assume the i...
5,923
1,686
import pytest from mixins.fsm import FinalStateMachineMixin MSG_START = 'start' MSG_COMPLETE = 'complete' MSG_BREAK = 'break' MSG_RESTART = 'repair' MSG_UNREGISTERED = 'unknown' class SampleTask(FinalStateMachineMixin): STATE_NEW = 'new' STATE_RUNNING = 'running' STATE_READY = 'ready' STATE_FAILED =...
3,916
1,330
from mt5_correlation.gui.mdi import CorrelationMDIFrame
56
20
from ..core import BlockParser def _parse_refraction(line, lines): """Parse Energy [eV] ref_ind_xx ref_ind_zz extinct_xx extinct_zz""" split_line = line.split() energy = float(split_line[0]) ref_ind_xx = float(split_line[1]) ref_ind_zz = float(split_line[2]) extinct_xx = float(split...
841
313
import numpy as np import pickle import tqdm import os import torch from prompts.prompt_material import DETS_LIST, CONTENT_STRUCTS_PREFIX_LIST, CONTENT_STRUCTS_MIDDLE_LIST, CONTENT_STRUCTS_SUFFIX_LIST, TRANSFORMATIONS, LOGICAL_PREFIXES_LIST, LOGICAL_STRUCTS_LW_LIST ####################################### # ...
23,985
7,625
import requests import json import os import sys import shutil from .azureblob import AzureBlob from .azuretable import AzureTable from .timeutil import get_time_offset, str_to_dt, dt_to_str from .series import Series from .constant import STATUS_SUCCESS, STATUS_FAIL from telemetry import log # To get the meta of a ...
7,861
2,340
from .dnd5e import dnd5e_sources class SourceTree: backgrounds: object = dnd5e_sources["backgrounds"] classes: object = dnd5e_sources["classes"] feats: object = dnd5e_sources["feats"] metrics: object = dnd5e_sources["metrics"] races: object = dnd5e_sources["races"] skills: object = dnd5e_sourc...
435
164
# # Copyright (c) 2014 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # """ Logging """ import logging import logging.handlers _loggers = {} def get_logger(name): """ Get a logger or create one """ if name not in _loggers: _loggers[name] = logging.getLogger(name) return _lo...
1,087
357
import click from rastervision.command import Command class TrainCommand(Command): def __init__(self, task): self.task = task def run(self, tmp_dir=None): if not tmp_dir: tmp_dir = self.get_tmp_dir() msg = 'Training model...' click.echo(click.style(msg, fg='green'...
357
116
import inspect from IPython.core.interactiveshell import InteractiveShell from IPython.core.magic import cell_magic, magics_class, Magics from IPython.core.magic_arguments import (argument, magic_arguments, parse_argstring) import warnings from htools.meta import timebox @ma...
10,220
2,815
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test-msal ------------ Tests for MSAL Connection """ from django.test import TestCase from drf_msal_jwt.utils import build_auth_url class TestMSAL(TestCase): def setUp(self): pass def test_login_url(self): login_url = build_auth_url() ...
395
144
import asyncio from datetime import datetime, timedelta import functools from http import HTTPStatus import logging import os import pickle from random import random import re import struct from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Tuple import warnings import aiohttp.web from aiohtt...
25,135
7,012
import subprocess def check_working_tree(): try: subprocess.check_output(['git', 'diff', '--exit-code']) except subprocess.CalledProcessError as e: print('called process error') out_bytes = e.output # Output generated before error code = e.returncode # Return code ...
732
205
import unittest import pytest from omniglot.jpn.jmdict.convert import create_JMDict_database_entries from omniglot.jpn.jmdict.extract import convert_to_JSON from omnilingual import PartOfSpeech from .test_jmdict_entries import entry_America, entry_batsuichi class TestJMDict(unittest.TestCase): @pytest.mark.asy...
1,526
578
import sys from mots_common.io import load_sequences, load_seqmap, write_sequences if __name__ == "__main__": if len(sys.argv) != 4: print("Usage: python images_to_txt.py gt_img_folder gt_txt_output_folder seqmap") sys.exit(1) gt_img_folder = sys.argv[1] gt_txt_output_folder = sys.argv[2] ...
572
230
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('assets', '0013_metadocumentasset_metadocumentsecureasset'), ] operations = [ migrations.AlterField( model_name='...
707
208
#import sys #file = sys.stdin file = open( r".\data\nestedlists.txt" ) data = file.read().strip().split()[1:] records = [ [data[i], float(data[i+1])] for i in range(0, len(data), 2) ] print(records) low = min([r[1] for r in records]) dif = min([r[1] - low for r in records if r[1] != low]) print(dif) names = [ r[0] for...
695
287
# -*- coding: utf-8 -*- """ Logging configuration functions """ from logbook import NullHandler, FileHandler, NestedSetup from logbook.more import ColorizedStderrHandler from logbook.queues import ThreadedWrapperHandler def logging_options(parser): """Add cli options for logging to parser""" LOG_LEVELS = ("cr...
1,856
579
from .adaptive import DQNAdaptive
34
14
from testframework import * import os import vb2py.utils PATH = vb2py.utils.rootPath() # << File tests >> (1 of 14) # Open with Input tests.append((r""" Open "%s" For Input As #3 Input #3, a Input #3, b Input #3, c, d, e Input #3, f, g Close #3 """ % vb2py.utils.relativePath("test/testread.txt"), {'a' : 'Can you hear ...
8,451
3,686
from setuptools import setup setup(name='gym_dinorun', version='0.1', install_requires=['gym', 'selenium', 'numpy', 'pillow', 'pyvirtualdisplay', 'matplotlib'] )
181
64
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
2,234
698
from django.apps import AppConfig class QueuesConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "queues"
144
47
import pytest from noopy.cron.rule import RateEventRule, BaseEventRule, TimeEventRule from noopy.decorators import cron @pytest.fixture def rate_5_mins_rule(): return RateEventRule('5MinsRateRule', value=5) @pytest.fixture def time_5pm_rule(): return TimeEventRule('5pmRule', '* 17 * * * *') @pytest.fixtu...
964
360
import requests import random import json from multiprocessing import Pool # Multi-Threading from multiprocessing import freeze_support # Windows Support requests.packages.urllib3.disable_warnings() accounts = [line.rstrip('\n') for line in open("combo.txt", 'r')] proxies = [line.rstrip('\n') for line in open("proxie...
5,420
1,558
import numpy as np data_file = 'input.txt' def parse_input(input_data_file): with open(input_data_file, 'r') as input_data_file: input_data = input_data_file.read() lines = input_data.split('\n') item_count = len(lines) - 1 items = [] for i in range(0, item_count): line...
1,097
386
# Copyright 2020 Makani Technologies LLC # # 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...
2,206
702
#coding=utf-8 """ __create_time__ = '13-10-18' __author__ = 'Madre' """ from django.shortcuts import get_object_or_404 from django.views.generic import ListView, DetailView from resource.models import Resource, Topic class ResourceListView(ListView): context_object_name = 'resource_list' templat...
1,732
566
import os from argparse import ArgumentParser from mmdet.apis import (inference_detector, init_detector) def parse_args(): parser = ArgumentParser() parser.add_argument('img_dir', help='Image file folder') parser.add_argument('out_dir', help='Image file output folder') parser....
1,560
518
# p2wsh input (2-of-2 multisig) # p2wpkh output import argparse import hashlib import ecdsa def dSHA256(data): hash_1 = hashlib.sha256(data).digest() hash_2 = hashlib.sha256(hash_1).digest() return hash_2 def hash160(s): '''sha256 followed by ripemd160''' return hashlib.new('ripemd160', hashlib.s...
6,698
2,633
class ApiOperations: """ Class to extract defined parts from the OpenApiSpecs definition json """ def __init__(self, resource, parts=None): """ Extract defined parts out of paths/<endpoint> (resource) in the OpenApiSpecs definition :param resource: source to be extracted from ...
852
210