text
string
size
int64
token_count
int64
from yoyo import step step( "CREATE TABLE IF NOT EXISTS shadowban_log (username text, dated datetime DEFAULT CURRENT_TIMESTAMP)" )
136
40
"""Tests of disco_elb""" from unittest import TestCase from mock import MagicMock from moto import mock_elb from disco_aws_automation import DiscoELB TEST_ENV_NAME = 'unittestenv' TEST_HOSTCLASS = 'mhcunit' TEST_VPC_ID = 'vpc-56e10e3d' # the hard coded VPC Id that moto will always return TEST_DOMAIN_NAME = 'test.exam...
8,576
2,929
# -*- coding: utf-8 -*- """ Created on Wed Jul 15 23:54:49 2020 @author: Andres Angeles Albores """ import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): # Prevent CSRF attack on web forms SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess' # Define th...
517
209
# coding: utf-8 # In[2]: import cv2 import numpy as np import sys # callback function def nothing(x): pass # import image inputImageName = 'test_images/test1.jpg' try: img = cv2.imread(inputImageName) # BRG WindowName = 'Color Select V1.0' cv2.namedWindow(WindowName) cv2.imshow(WindowName,i...
2,765
1,116
from salt.salt_api import Pepper from asset.models import Host, HostGroup from deploy.models import Task, TASK_STATUS, History from django.conf import settings from users.models import User from pillars.models import Vars, Configuration from redis import StrictRedis def get_all_hosts(task: Task): hosts = set() ...
1,918
630
from certifi.core import contents, where __version__ = "9999"
63
23
import numpy as np import statsmodels.api as sm import matplotlib.pyplot as plt from scipy.fftpack import rfft from scipy.fftpack import fftshift data_loader = sm.datasets.sunspots.load_pandas() sunspots = data_loader.data["SUNACTIVITY"].values transformed = fftshift(rfft(sunspots)) plt.subplot(311) plt.plot(sunspot...
547
221
import os from os.path import join import numpy as np import pandas as pd import scipy.io.wavfile as wav from laughter_classification.utils import chunks, in_any, interv_to_range, get_sname from laughter_prediction.sample_audio import sample_wav_by_time, sample_by_frames class SSPNetDataSampler: """ Class f...
4,170
1,393
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import collections from collections import defaultdict from termcolor import colored def get_missing_parameters_message(keys: list): """ Get a logging-friendly message to report parameter names (keys) that are in ...
3,292
996
import argparse from pathlib import Path import pytest from demtools.scripts import InputPath @pytest.fixture(scope='module') def tmp_test_file(tmp_input_path): file = Path(tmp_input_path.join('test_input_file.txt')) print(str(file)) file.touch(mode=0o644, exist_ok=True) return file @pytest.fixtur...
1,653
557
''' # tests.py # William Ponton # 5.9.21 # Tests for the song_generator project ''' # import pacagkes import song_generator.generator as gen import song_generator.song_data as s_data import song_generator.string_literals as s_lit from song_generator.SongClass import Song # Song class # test output from each import fil...
578
185
#!/usr/bin/env python """ _LoadFromIDWithWorkflow_ Oracle implementation of Jobs.LoadFromIDWithWorkflow. """ from WMCore.WMBS.MySQL.Jobs.LoadFromIDWithWorkflow import LoadFromIDWithWorkflow as MySQLLoadFromIDWithWorkflow class LoadFromIDWithWorkflow(MySQLLoadFromIDWithWorkflow): """ Load jobs by ID but inclu...
360
125
import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.transforms as transforms import numpy as np import pandas as pd from sklearn.model_selection import ParameterGrid from tqdm import tqdm_notebook as tqdm def kaiming_init(m): '''Initilize weights (with kaiming ini...
11,367
3,376
__author__ = 'tyler' import bt #%pylab inline # download data data = bt.get('aapl,msft', start='2013-01-01') data.head() import pandas as pd # a rolling mean is a moving average, right? sma = pd.rolling_mean(data, 50) s = bt.Strategy('above50sma', [ bt.algos.SelectWhere(data > sma), ...
506
206
from datetime import datetime from django.shortcuts import render, redirect from django.http import HttpResponse from .models import Post # Create your views here def homepage(request): posts = Post.objects.all() post_lists = list() for count,post in enumerate(posts): posts = Post.objects.all() ...
778
231
#!/usr/bin/env python # Author: Mario Rivas Vivar # https://twitter.com/Grifo """ Scan a list of hosts with a list of CGIs trying to exploit the ShellShock vulnerability with different methods and payloads (CVE-2014-6271, CVE-2014-6278) """ import httplib,sys,time import pprint import csv import argparse from threa...
12,911
4,313
from __future__ import print_function import smtplib import email.mime.multipart import email.mime.text import getpass import io import codecs from path import Path from jaraco.ui import progress def email_message(body_text, subject=None): SMTP_SERVER = 'pod51011.outlook.com' SMTP_PORT = 587 SMTP_USERNA...
2,079
724
import re some_re = re.compile(r""" (?P<abc>abc) (?P<name> (?(abc)yes|noo) ) """, re.VERBOSE)
96
52
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pants.backend.codegen.thrift.apache.java import subsystem from pants.backend.codegen.thrift.apache.java.subsystem import ApacheThriftJavaSubsystem from pants.backend.codegen.thrift.ap...
2,680
806
from bughunter.action.core import * from bughunter.action.basic import ModifyStatement, InsertStatement, DeleteStatement import cgum.statement ##### # GROUP: If-Statement-Related ##### class WrapStatement(ReplaceRepairAction): @staticmethod def from_json(jsn, before, after): return ReplaceRepairAction....
10,427
3,246
import copy import math from hana_ml import DataFrame from hana_ml.algorithms.pal.neighbors import KNNRegressor from hana_ml.algorithms.pal.preprocessing import ( Imputer, FeatureNormalizer, variance_test, ) from hana_automl.algorithms.classification.decisiontreecls import DecisionTreeCls from hana_automl....
11,124
3,302
#coding:utf-8 # # id: bugs.core_2251 # title: gbak doesn't return error code # decription: # Inaccessible folder is defined here as $tmp + GUID (i.e. it 100% not yet exists). # We have to check allof kind for inaccessible file: # * .fbk when ...
10,438
3,625
from __future__ import absolute_import, division, print_function, unicode_literals from ctypes import POINTER, c_int, Structure from ctypes.wintypes import LPCSTR, HANDLE, LPCWSTR, DWORD, BOOL, UINT, LPVOID, WORD, LONG, BYTE from .. import windll HDC = HANDLE HGDIOBJ = HANDLE HBITMAP = HANDLE DIB_RGB_COLORS = 0 HOR...
2,534
1,103
#!/usr/bin/env python # -*- coding: utf-8 -*- """ pjbank """ from pjbank.api import PJBankAPI from pjbank.contadigital import ContaDigital from pjbank.recebimentos.boleto import Boleto from pjbank.recebimentos.cartaocredito import CartaoCredito from pjbank.config import __version__ conta_digital = ContaDigital() bole...
358
138
dico = {25: 4, 8: 1, 12: 2, 3: 5} print(dico) print("5 dans dico ?", 5 in dico) print("25 dans dico ?", 25 in dico) dico[9] = 1 dico[8] = 2 print(dico) del dico[25] print(dico) print("-" * 10) inventaire = {"orange": 378, "pomme": 545, "banane": 422, "poire": 269} def checkStock(): fruit = input("Entrez un fruit...
1,081
423
import click from ..hyperopt import run_hyperopt CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @click.command(context_settings=CONTEXT_SETTINGS) @click.option('--submission', default='starting_kit', show_default=True, help='The kit to hyperopt. It should be located in the ' ...
2,176
655
from django.http import HttpResponseRedirect from django.template import RequestContext from django.shortcuts import render_to_response, get_object_or_404 from django.core.context_processors import csrf from django.core.urlresolvers import reverse from django.views.decorators.csrf import csrf_protect from django.contri...
3,675
1,061
""" If else predicate = is any logical expression if predicate: code elif predicate2: (not compulsory) code2 elif predicate3: code3 .. .. .. .. else: (not compulsory) code """ # switch statements not supported by python number = int(input()) if number > 10: print('i am in if block') print('s...
780
281
from .similarweb_scraper import *
35
13
from os.path import basename import glob def get_py_files(path): for py_file in glob.glob("{}*.py".format(path)): if not py_file.endswith("__init__.py"): yield basename(py_file)[:-3] def install_static_imports(path): with open("{}__init__.py".format(path), 'w') as init_f: for pf in...
578
203
''' ░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░ ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░ ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░ ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░ ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░ ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░ ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░ ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░ ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░ ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░ ▀▒▀▐▄█▄█▌▄░▀▒...
989
867
import json import os import sys import bpy #pylint: disable=import-error def convert_files(convertfn, outputext): args = sys.argv[sys.argv.index('--')+1:] #print(args) settings_fname, srcroot, dstdir, blendfiles = args[0], args[1], args[2], args[3:] if not srcroot.endswith(os.sep): srcroot ...
1,802
583
import pytest from django.urls import reverse from rest_framework import status from traffic_control.models import Owner from traffic_control.tests.factories import get_api_client, get_owner, get_user @pytest.mark.django_db @pytest.mark.parametrize("is_admin", (True, False)) def test__owner_api__list(is_admin): ...
4,191
1,486
# -*- coding: utf-8 -*- """Unit tests for get_service_info method""" import json import pytest from ga4gh.refget.config.service_info import SERVICE_INFO from ga4gh.refget.http.status_codes import StatusCodes as SC from ga4gh.refget.routes.sequence.get_service_info import get_service_info from test.common.methods impor...
989
325
from .clients import WayBillClient, CloudPrintClient from .waybill import WayBill from .cloudprint import CloudPrint __all__ = ("WayBillClient", "WayBill", "CloudPrint", "CloudPrintClient") __version__ = "0.2.0"
214
74
# Eve W-Space # Copyright 2014 Andrew Austin and contributors # # 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 requi...
4,215
1,248
from PyQt5.QtGui import QIcon try: from importlib.resources import read_text, path except ImportError: from importlib_resources import read_text, path import os from types import SimpleNamespace def load_theme(): return SimpleNamespace( window_style = read_text(__package__, 'window.css'), ...
887
287
import json import requests import pickle from bridges.data_src_dependent import earthquake_usgs from bridges.data_src_dependent import actor_movie_imdb from bridges.data_src_dependent import game from bridges.data_src_dependent import shakespeare from bridges.data_src_dependent import gutenberg_book from bridges.data_...
23,000
7,574
import _plotly_utils.basevalidators class LocationmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__( self, plotly_name='locationmode', parent_name='choropleth', **kwargs ): super(LocationmodeValidator, self).__init__( plotly_name=plotly_name, ...
494
140
from django.http import HttpResponse def set_cookies(request): resp = HttpResponse('设置cookies成功') resp.set_cookie('uname', 'aid2010', 60) return resp def get_cookies(request): uname = request.COOKIES.get('uname', 'default value') res = f'uname is {uname}' return HttpResponse(res) def delet...
924
317
import re import logging from math import ceil from datetime import datetime from starlette.applications import Starlette from starlette.responses import PlainTextResponse from starlette.templating import Jinja2Templates from starlette.staticfiles import StaticFiles import uvicorn from gensim.summarization.summarizer ...
5,453
1,733
from .dpsrvf import *
22
10
import unittest import re import os from report.parser import REGEX, parser, ParseError from report.app import Application class TestRegularExpressions(unittest.TestCase): def test_date(self): test_string = "1992-05-29 PDT" self.assertIsNotNone(re.match(REGEX.date, test_string)) def test_date...
2,786
1,043
import os from churchtools import ChurchToolsApi if __name__ == "__main__": ct = ChurchToolsApi(os.environ["API_BASE_URL"], os.environ["ADMIN_TOKEN"]) all_members_group_id = list(ct.get_groups(query="Auto-Gruppe: Alle Mitarbeiter"))[ 0 ]["id"] member_status_ids = [s["id"] for s in ct.get_sta...
1,061
386
def new_seating_chart(size=22): ''' :param size: int - number if seats in the seating chart. Default is 22. :return: dict - with number of seats specified, and placeholder values. ''' pass def arrange_reservations(guest_list): ''' :param guest_list: list - list of guest names for reserva...
1,276
380
# Copyright (c) 2016 Mirantis, 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...
3,308
1,041
import os import subprocess from six import moves from pyramid.scaffolds import PyramidTemplate class RamsesStarterTemplate(PyramidTemplate): _template_dir = 'ramses_starter' summary = 'Ramses starter' def pre(self, command, output_dir, vars): dbengine_choices = {'1': 'sqla', '2': 'mongodb'} ...
1,082
328
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold(arr, n): if (n <= 0): return 0 incl = arr[0] excl = 0 for i in range(1, n): incl_new ...
1,916
1,256
from xml.dom.minidom import parse import json, re import xml.dom.minidom import codecs from collections import defaultdict def readfrom_xml(xml_file, languge, textdict=None): if not textdict: textdict = defaultdict(dict) DOMTree = xml.dom.minidom.parse(xml_file) collection = DOMTree.documentElement...
2,220
651
from datetime import datetime from sqlalchemy.exc import SQLAlchemyError from sme_financing.main import db from ..models.fund_disbursement import FundDisbursement from ..service.funding_project_service import get_funding_project_by_id def update(): db.session.commit() def commit_changes(data): db.session...
3,359
1,015
# coding: utf-8 """ BillForward REST API OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git 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...
65,519
16,332
# Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,189
363
# Generated by Django 2.0.5 on 2018-05-23 23:46 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import multiselectfield.db.fields class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(setting...
3,323
1,038
import json import yaml import csv def file_to_raw(filename): with open(filename, "r") as file: f = file.read() return f def dump_to_json(data, filename): with open(filename, "w", encoding="utf8") as file: json.dump(data, file, ensure_ascii=False) def read_csv(filename): rows =...
940
301
import logging logger = logging.getLogger() logger.setLevel(logging.INFO) import argparse import boto3 from botocore.waiter import SingleWaiterConfig, Waiter excluded_regions=[] parser = argparse.ArgumentParser() parser.add_argument("--excluded_regions","-excluded_regions",help="Regions to exclude as comma separated...
2,828
949
aas = 'FILWVMYCPAGTSQNEDHKR' core_rules_r = dict([ ['tgnb' , r"[GFL][PHL][DS][TSVH][T][IMEH][VSR][T][EKRSAVLG][T][ITS][E][NSQM][AVRFW][D][PI][DS][EAMW][YLST][FYEP][LAFQG]"], ['plpxy', r"[AT][VTCQSNKRP][AS][A][MLN][Y][G][VATS][V][FITEKP][P]"], ['paap' , r"[E][E][NSTDKRYV][AMTGP][MVSTNHD][YF][TSAVLWYG][KRSA...
1,950
1,049
#!/usr/bin/env python3 # -*- coding:utf-8 -*- def quick_sort(array, left, right): if left<right: mid=adjust_array(array, left, right) quick_sort(array, left, mid-1) quick_sort(array, mid+1, right) def adjust_array(array, left, right): i=left j=right base_value=array[left] while i<j: while (i<j and arr...
629
326
# -*- coding: utf-8 -*- """Unit test package for ukboards."""
63
26
#!/usr/bin/env python # coding: utf-8 # In[2]: import pandas as pd import numpy as np # In[3]: # reading data data = pd.read_csv('dattaa.csv') # In[4]: X = data.drop('verdit', axis=1).values y = data.verdit.values # In[5]: # splitting data as X_train and X_test from sklearn.model_selection import train_t...
761
303
#Desenvolva um gerador de tabuada n = int(input("Tabuada de que número? ")) i = 0 while i < 10: print("{} X {} = {}".format(n, i + 1, (n*(i + 1)))) i = i + 1
172
81
""" Doto main module """ import argparse import shutil import doto.cli import doto.cli.cmd import doto.cli.sub_cmds import doto.defaultconfig import doto.model def init_env(commands): """ Initialize the enviroment. This includes - the parser and subpurser, - and the enviroment variables...
1,430
449
#!/usr/bin/env python3 '''Display data send as gzip''' import urllib import gzip import io url = 'http://www.stream-urls.de/webradio' r = urllib.urlopen(url) # create file-like object in memory buf = io.StringIO(r.read()) # create gzip object using file-like object instead of real file on disk f = gzip.GzipFile...
534
196
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
1,660
472
from kiteconnect import KiteConnect from kiteconnect import KiteTicker import pdb import pandas as pd import datetime import os api_k = "put_your_api_key_here" # api_key api_s = "put_your_api_secret_here" # api_secret filename = str(datetime.datetime.now().date()) + ' token' + '.txt' def read_acc...
2,922
1,396
import os from contextlib import contextmanager @contextmanager def use_temporary_filename(file_path): """ Delete any existing file with this name, and delete this file after the block completes. :param file_path: A full file path :yield: A the file path again. """ directory, _ = os.path.split...
517
163
from django.db import models class Donor(models.Model): userName = models.TextField()
91
27
from . import app application = app.wsgi_app
46
16
import html from typing import Optional, List from telegram import Message, Chat, Update, Bot, User, InlineKeyboardButton, InlineKeyboardMarkup, ParseMode, ChatPermissions from telegram.error import BadRequest from telegram.ext import Filters, MessageHandler, CommandHandler, run_async, CallbackQueryHandler from telegr...
19,375
6,574
import json import os AMT_testset = json.load(open('data/AMT_test_set.json', 'r')) AMT_trainset = json.load(open('data/greatesthit_train_2.00.json', 'r')) AMT_validset = json.load(open('data/greatesthit_valid_2.00.json', 'r')) greatest_testset = json.load(open('data/greatesthit_test_2.00.json', 'r')) record_dir = 'dat...
2,792
991
from rest_framework import serializers from api.models import * class ServerListSerializers(serializers.ModelSerializer): class Meta: model = Server fields = "__all__"
193
53
# Copyright (C) 2016 Midokura SARL # 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 require...
1,232
377
# Alex Ciaramella and Greg Suner # Abstract Tournament Class # Tournament is observable while players are observers import Message import Observable import ScoreKeeper class Tournament(Observable.Observable): # set up a list of players when tournament is initialized def __init__(self): Observable.Ob...
3,905
1,072
#!/usr/bin/env python import matplotlib matplotlib.rcParams['legend.fancybox'] = True import matplotlib.pyplot as plt import numpy as np #data x = [1, 2, 3, 4] #define some data x = [5000, 10000, 15000, 20000] pc_mean = [4.770, 6.327, 7.427, 8.147] s3mini_mean = [96.878, 101.656, 243.981, 331.433] s3_mean = [84.121,...
2,512
1,331
#adapted from PyimageSearch for testing accuracy between my standard NN_model architecture and a popular model # set the matplotlib backend so figures can be saved in the background import matplotlib matplotlib.use("Agg") import data_processing from keras.preprocessing.image import ImageDataGenerator from keras.app...
6,039
2,055
# -*- coding: utf-8 -*- """Voxity api module.""" from __future__ import absolute_import, division, unicode_literals from requests_oauthlib import OAuth2Session from flask import current_app, session, abort from datetime import datetime, timedelta from app.utils import datetime_to_timestamp from requests.models import R...
4,174
1,313
import MudCommand import MudAction import MudActionHandler import MudDatabase import MudWorld class cmdLook(MudCommand.MudCommand): def __init__(self): MudCommand.MudCommand.__init__(self) self.info['cmdName'] = "look" self.info['helpText'] = '''Look at your surroundings, or something ...
551
164
import socket def soma(a, b): temp = a + b return str(temp) def sub(a, b): temp = a - b return str(temp) def mult(a, b): temp = a * b return str(temp) def div(a, b): if b == 0: return 0 else: temp = a / b temp = int(temp) return str(temp) host = '' porta = 12003 servidor = socket...
916
391
# for in range # Print numbers 20XX where XX is 1..20 for i in range(1, 21): print("20", f"{i:02d}", sep="") # ^ formatting # ^ variable/value to format # ^^ 2 digits, with leading zero # ^ integer
277
93
"""Dealing with the atmospheric drag need to be included : - [ ] Accomodation Coefficient (Cook and other) - [ ] Diffusive coefficient - [ ] Abserbtion (?? cf Célestlab) - [ ] Drag coefficient from a sphere - [ ] Drag and lift coefficient from a plane (fonction of the angle) - [ ] Drag force for a sphere - [ ] Drag a...
351
111
import insightconnect_plugin_runtime from .schema import ConnectionSchema, Input # Custom imports below from threatstack import ThreatStack from threatstack.errors import ThreatStackAPIError, ThreatStackClientError, APIRateLimitError from insightconnect_plugin_runtime.exceptions import ConnectionTestException import da...
1,429
390
a,b,c,d = int(input()),int(input()),int(input()),int(input()) print('DIFERENCA = {}'.format(a*b-c*d))
101
46
import tensorflow as tf from tensorflow.keras.models \ import ( Model, ) tf.random.set_seed(0) from tensorflow.keras import ( layers, activations, regularizers, initializers, losses, optimizers, metrics, callbacks, ) from typing import ( Tuple, List, ) def define_callbacks( sa...
3,719
1,395
#-*-coding:utf-8-*- import pandas as pd dataset = pd.read_csv( 'machine_usage_headed.csv', index_col=1) print(dataset.head()) dataset.drop('m_number', axis=1, inplace=True) dataset.drop('mem_gps', axis=1, inplace=True) dataset.drop('mpki', axis=1, inplace=True) print(dataset.head()) dataset.columns = [ '...
578
243
from unittest import TestCase from merge_string_alternately import mergeAlternately class Test(TestCase): def test_merge_alternately(self): self.assertEqual(mergeAlternately("abc", "pqr"), "apbqcr") self.assertEqual(mergeAlternately("ab", "pqrs"), "apbqrs") self.assertEqual(mergeAlternately...
345
115
from __future__ import absolute_import from __future__ import print_function __author__ = 'Rodolfo Quispe' __description__ = 'Top Batch Dropblock for Person Re-Identification' __url__ = 'https://github.com/RQuispeC/top-batch-dropblock' __based_on__ = 'https://github.com/KaiyangZhou/deep-person-reid' from . import ( ...
402
144
from paraview.simple import * vars = ['U', 'V'] Xs = [1, 16] Ts = [0, 23] def look_at_angle(view1): view1.CameraPosition = [-91.79570803687004, -4.511485753227961, 32.24697211000749] view1.CameraFocalPoint = [15.499600000000001, 15.499600000000001, 15.499600000000001] view1.CameraViewUp = [0.1508633701950...
1,425
650
# flake8: noqa F401 from .oracles import ( AaveOracle, BalancerOracle, CannotGetPriceFromOracle, ComposedPriceOracle, CreamOracle, CurveOracle, EnzymeOracle, InvalidPriceFromOracle, KyberOracle, MooniswapOracle, OracleException, PoolTogetherOracle, PriceOracle, Pr...
486
187
import pytest from glaciersat.tests import requires_credentials from glaciersat.utils import * import configobj @requires_credentials def test_get_credentials(): cred = get_credentials(credfile=None) assert isinstance(cred, configobj.ConfigObj) cred = get_credentials(credfile='.\\.credentials') assert...
1,192
459
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-12-20 07:11 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wildlifecompliance', '0353_auto_20191220_1334'), ] ...
2,103
632
file_name = 'pi_digits.txt' with open(file_name) as file_object: lines = file_object.readlines() pi_string = '' for line in lines: pi_string += line.strip() print(pi_string) print(len(pi_string))
214
79
# # 2020 ExpertSystem # '''Script for generating predictions for Task2 of CLEF 2018 using the acred predictor See https://github.com/clef2018-factchecking/clef2018-factchecking See also scripts/fetch-data.sh, which should download the v1.0 release and place it in the `data/evaluation/` folder. ''' import argparse im...
4,553
1,504
from datetime import timedelta, datetime from typing import List from vnpy.trader.constant import Exchange, Interval from vnpy.trader.object import BarData, HistoryRequest from vnpy_pro.data.source.dataapi import SourceDataApi from vnpy_pro.data.tdx.tdx_future_data import TdxFutureData INTERVAL_VT2JQ = { Interva...
2,712
867
# Generated by Django 4.0.1 on 2022-02-01 12:57 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.db.models.manager import phonenumber_field.modelfields class Migration(migrations.Migration): initial = True dependencies = [ ] o...
3,796
1,070
#!/usr/bin/env python # -*- coding: utf-8 -*- """File upload utility""" # System imports import os TEST_FILE_IMAGE = os.path.join(os.path.dirname(__file__), 'pic.jpg') TEST_FILE_CONTENT_HEADER = 'attachment; filename="pic.jpg"' TEST_FILE_INVALID = os.path.join(os.path.dirname(__file__), 'test.invalid') TEST_FILE_GIF...
1,125
407
import sys import json import socket import inspect import subprocess from mudpi.extensions import Component, BaseExtension, BaseInterface def get_ip(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # doesn't even have to be reachable s.connect(('10.255.255.255', 1)) IP = s....
3,029
899
from django.db import models # Create your models here. class Employee(models.Model): user_name = models.CharField(u'user_name',default='abc',max_length = 20) user_first_name = models.CharField(u'Enter first name',max_length=15,default='Chaman') user_last_name = models.CharField(u'Enter first name',max_le...
695
225
import importlib.util import time from dataclasses import dataclass from typing import Optional from sqlalchemy.engine import Engine from sqlalchemy.exc import OperationalError from pyctuator.health.health_provider import HealthProvider, HealthStatus, Status, HealthDetails @dataclass class DbHealthDetails(HealthDet...
1,421
415
import os import struct from JumpScale import j import JumpScale.baselib.serializers j.application.start("blowfishtest") from random import randrange msg = "" for i in range(1000): msg += chr(randrange(0, 256)) key = "" for i in range(56): key += chr(randrange(0, 256)) # b means blowfish s = j.db.serial...
482
200
import sys import plico_motor from guietta import Gui, _, G, Exceptions class Runner(object): def __init__(self): self.motor = None def _setUp(self, host='localhost', port=7200, axis=1): def moveby(gui): nsteps = int(gui.nstepsby) if self.motor: self...
2,385
749
#!/usr/bin/env python # encoding: utf-8 """ metadata.py Created by Geert Dekkers on 2008-02-11. Copyright (c) 2008, 2009 Geert Dekkers Web Studio, 2010, 2011, 2012 Django Web Studio. All rights reserved. """ import string import sys import os import unittest import subprocess import re import datetime import time from...
21,225
5,958