text
string
size
int64
token_count
int64
from ee.clickhouse.sql.clickhouse import KAFKA_COLUMNS, STORAGE_POLICY, kafka_engine from ee.clickhouse.sql.table_engines import CollapsingMergeTree, ReplacingMergeTree from ee.kafka_client.topics import KAFKA_PERSON, KAFKA_PERSON_DISTINCT_ID, KAFKA_PERSON_UNIQUE_ID from posthog.settings import CLICKHOUSE_CLUSTER, CLIC...
11,929
4,713
from sigvisa.learn.train_coda_models import get_shape_training_data import numpy as np X, y, evids = get_shape_training_data(runid=4, site="AS12", chan="SHZ", band="freq_2.0_3.0", phases=["P",], target="amp_transfer", max_acost=np.float("inf"), min_amp=-2) np.savetxt("X.txt", X) np.savetxt("y.txt", y) np.savetxt("evid...
335
149
import math import numpy as np # plt.style.use('seaborn') # plt.rcParams['figure.figsize'] = (12, 8) def welford(x_array): k = 0 M = 0 S = 0 for x in x_array: k += 1 Mnext = M + (x - M) / k S = S + (x - M)*(x - Mnext) M = Mnext return (M, S/(k-1)) class Welford(...
2,637
965
def greet(): print("Hi") def greet_again(message): print(message) def greet_again_with_type(message): print(type(message)) print(message) greet() greet_again("Hello Again") greet_again_with_type("One Last Time") greet_again_with_type(1234) # multiple types def multiple_types(x): if x < 0: ...
819
313
from ad9833 import AD9833 # DUMMY classes for testing without board class SBI(object): def __init__(self): pass def send(self, data): print(data) class Pin(object): def __init__(self): pass def low(self): print(" 0") def high(self): prin...
480
187
# Copyright (C) 2018 DataArt # # 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, ...
14,276
3,872
import logging import abstracthandler import os class FileHandler(abstracthandler.AbstractHandler): def __init__(self, conf, bot): abstracthandler.AbstractHandler.__init__(self, 'file', conf, bot) self.log = logging.getLogger(__name__) self.commands={} self.commands['list'] = self....
1,043
316
# Copyright 2019, The TensorFlow Federated 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 o...
6,276
1,790
from __future__ import print_function import os import shutil import hashlib import requests import click from tempfile import NamedTemporaryFile from hashlib import sha256 from os.path import expanduser, join, exists, basename from .utils import HumanSize from .tar import extract_layer from . import trust from . impor...
5,226
1,641
from DocTest.CompareImage import CompareImage import pytest from pathlib import Path import numpy def test_single_png(testdata_dir): img = CompareImage(testdata_dir / 'text_big.png') assert len(img.opencv_images)==1 assert type(img.opencv_images)==list type(img.opencv_images[0])==numpy.ndarray def tes...
987
348
from .labels_tableview import LabelsTableView
46
13
import functools import numpy as np import math import argparse import ags_solver import go_problems import nlopt import sys from Simple import SimpleTuner import itertools from scipy.spatial import Delaunay from scipy.optimize import differential_evolution from scipy.optimize import basinhopping from sdaopt import sda...
16,243
5,722
import arcpy import logging import pathlib import subprocess import gdb import cx_sde class Fc(object): def __init__(self ,gdb ,name): # gdb object self.gdb = gdb # ex BUILDING self.name = name.upper() # esri tools usually expect this C:/s...
8,288
2,278
n = input('Digite algo: ') print('O tipo primitivo da variável é: ', type(n)) print('O que foi digitado é alfa numérico? ', n.isalnum()) print('O que foi digitado é alfabético? ', n.isalpha()) print('O que foi digitado é um decimal? ', n.isdecimal()) print('O que foi digitado é minúsculo? ', n.islower()) print('O que f...
602
204
from numpy import * import numpy as np import matplotlib.pyplot as plt from mlp import mlp x = ones((1, 40)) * linspace(0, 1, 40) t = sin(2 * pi * x) + cos(2 * pi * x) + np.random.randn(40) * 0.2 x = transpose(x) t = transpose(t) n_hidden = 3 eta = 0.25 n_iterations = 101 plt.plot(x, t, '.') plt.show() train = x[0:...
640
301
# © 2020 지성. all rights reserved. # <llllllllll@kakao.com> # Apache License 2.0 from .small import * from .medium import * from .large import *
144
59
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayEbppInvoiceAuthSignModel(object): def __init__(self): self._authorization_type = None self._m_short_name = None self._user_id = None @property def authoriza...
2,020
658
# Copyright 2020 The Tekton 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 wr...
12,219
3,741
import zmq import curses import argparse import configparser import threading import time from curses import wrapper from client import Client from ui import UI def parse_args(): parser = argparse.ArgumentParser(description='Client for teezeepee') # Please specify your username parser.add_argument('use...
3,122
1,010
import anonlink from anonlink.candidate_generation import _merge_similarities from entityservice.object_store import connect_to_object_store from entityservice.async_worker import celery, logger from entityservice.settings import Config as config from entityservice.tasks.base_task import TracedTask from entityservice....
1,968
643
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-24 13:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('portal', '0006_auto_20170824_0950'), ] operations = [ migrations.AddField( ...
3,239
880
import numpy as np import random letter_C = np.array([ [1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1, 1, 1, 1], ]) noisy_C = np.array([ [1, 1, 1, 1, 1], [0, 1, 0, 0, 1], [1, 0, 0, 0, 0], [1, 0, 0, 1, 0], [1, 0, 1, 1, 1], ]) letter_I = np.array([ ...
5,270
2,198
from infoclientLib import InfoClient ic = InfoClient('localhost', 15002, 'localhost', 15003) ic.add('roi-weightedave', 'active') ic.start()
142
58
# (c) Copyright IBM Corporation 2020. # LICENSE: Apache License 2.0 (Apache-2.0) # http://www.apache.org/licenses/LICENSE-2.0 import abc import logging import time from collections import defaultdict from typing import List import numpy as np from dataclasses import dataclass logging.basicConfig(level=logging.INFO,...
13,095
3,831
try: from tango import DeviceProxy, DevError except ModuleNotFoundError: pass class PathFixer(object): """ Basic pathfixer which takes a path manually. """ def __init__(self): self.directory = None class SdmPathFixer(object): """ MAX IV pathfixer which takes a path from a Tan...
909
262
import json from django.contrib.auth.models import User from django.http import JsonResponse from django.shortcuts import redirect, render from .models import Game2048 # Create your views here. # test_user # 8!S#5RP!WVMACg def game(request): return render(request, 'game_2048/index.html') def set_result(req...
1,504
461
from distdeepq import models # noqa from distdeepq.build_graph import build_act, build_train # noqa from distdeepq.simple import learn, load, make_session # noqa from distdeepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer # noqa from distdeepq.static import * from distdeepq.plots import PlotMachine
319
97
# Authentication & API Keys # Many APIs require an API key. Just as a real-world key allows you to access something, an API key grants you access to a particular API. Moreover, an API key identifies you to the API, which helps the API provider keep track of how their service is used and prevent unauthorized or maliciou...
812
201
from .plucker import pluck, Path from .exceptions import PluckError __all__ = ["pluck", "Path", "PluckError"]
111
38
"""Plot a scatter or hexbin of sampled parameters.""" import warnings import numpy as np from ..data import convert_to_dataset, convert_to_inference_data from .plot_utils import xarray_to_ndarray, get_coords, get_plotting_function from ..utils import _var_names def plot_pair( data, group="posterior", var...
7,417
2,200
from django.forms import ModelForm from .models import Cuestionario, Categoria from preguntas.models import Pregunta, Respuesta class CuestionarioForm(ModelForm): class Meta: model = Cuestionario fields = '__all__' class PreguntaForm(ModelForm): class Meta: model = Pregunta fi...
542
163
from django.views.generic import View from django.http import HttpResponse import os, json, datetime from django.shortcuts import redirect from django.shortcuts import render_to_response from vitcloud.models import File from django.views.decorators.csrf import csrf_exempt from listingapikeys import findResult import sy...
6,403
1,987
from abc import ABC import discord class Base(discord.Embed, ABC): async def send(self, client: discord.abc.Messageable): """ Send the component as a message in discord. :param client: The client used, usually a :class:`discord.abc.Messageable`. Must have implemented :func:`.send` :retur...
406
117
"""change admin to boolean Revision ID: e86dd3bc539c Revises: 6f63ef516cdc Create Date: 2020-11-11 22:32:00.707936 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e86dd3bc539c' down_revision = '6f63ef516cdc' branch_labels = None depends_on = None def upgrade...
1,661
598
# Generated by Django 4.0.3 on 2022-03-16 03:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('school', '0009_rename_periodo_semestre_alter_semestre_options_and_more'), ] operations = [ migrations.AlterUniqueTogether( name='sala', ...
388
140
""" Abstract training class """ from abc import ABC as AbstractBaseClass from abc import abstractmethod class AdstractTrainer(AbstractBaseClass): @abstractmethod def run(self): pass @abstractmethod def prepare_data_loaders(self): """ For preparing data loaders and save them a...
637
163
# -*- coding: utf-8 -*- # from mpmath import mp from .helpers import untangle2 class CoolsHaegemans(object): """ R. Cools, A. Haegemans, Construction of minimal cubature formulae for the square and the triangle using invariant theory, Department of Computer Science, K.U.Leuven, TW Reports vol...
2,763
1,551
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from account.models import Profile admin.site.site_header = 'invoce' class T...
912
297
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 18 08:40:11 2020 @author: krishan """ def funny_division2(anumber): try: if anumber == 13: raise ValueError("13 is an unlucky number") return 100 / anumber except (ZeroDivisionError, TypeError): return "E...
844
291
import os from datetime import datetime import torch from dataclasses import dataclass class SimCLRConfig: @dataclass() class Base: output_dir_path: str log_dir_path: str log_file_path: str device: object num_gpu: int logger_name: str @dataclass() clas...
4,129
1,320
# Copyright (c) 2014 OpenStack Foundation # # 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 ...
47,259
14,389
""" Eddsa Ed25519 key handling From https://github.com/n-y-z-o/nyzoVerifier/blob/b73bc25ba3094abe3470ec070ce306885ad9a18f/src/main/java/co/nyzo/verifier/KeyUtil.java plus https://github.com/n-y-z-o/nyzoVerifier/blob/17509f03a7f530c0431ce85377db9b35688c078e/src/main/java/co/nyzo/verifier/util/SignatureUtil.java """ # ...
3,654
1,290
from argparse import ArgumentParser import os import numpy as np from joblib import dump from mldftdat.workflow_utils import SAVE_ROOT from mldftdat.models.gp import * from mldftdat.data import load_descriptors, filter_descriptors import yaml def parse_settings(args): fname = args.datasets_list[0] if args.suff...
6,729
2,393
import api import bson from api.annotations import ( api_wrapper, log_action, require_admin, require_login, require_teacher ) from api.common import WebError, WebSuccess from flask import ( Blueprint, Flask, render_template, request, send_from_directory, session ) blueprint ...
5,684
1,763
#!/usr/bin/python import json import argparse from influxdb import InfluxDBClient parser = argparse.ArgumentParser(description = 'pull data for softlayer queue' ) parser.add_argument( 'measurement' , help = 'measurement001' ) args = parser.parse_args() client_influxdb = InfluxDBClient('50.23.117.76', '8086', 'crick...
724
276
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from typing import cast from pants.core.util_rules.config_files import ConfigFilesRequest from pants.core.util_rules.external_tool import TemplatedExte...
3,522
1,211
""" Handles functionality related to data storege. """ import sys, os, glob, re, gzip, json from biorun import const, utils, objects, ncbi from biorun.models import jsonrec import biorun.libs.placlib as plac # Module level logger. logger = utils.logger # A nicer error message on incorrect installation. try: from ...
8,504
2,831
import numpy as np from random import randint from PyQt5.QtGui import QImage from PyQt5.QtCore import QPointF class GameItem(): def __init__(self, parent, boundary, position=None): self.parent = parent self.config = parent.config self.items_config = self.config.items if position i...
1,049
301
# coding: utf-8 """ Trend Micro Deep Security API Copyright 2018 - 2020 Trend Micro Incorporated.<br/>Get protected, stay secured, and keep informed with Trend Micro Deep Security's new RESTful API. Access system data and manage security configurations to automate your security workflows and integrate De...
6,750
2,027
from __future__ import print_function # Python 2/3 compatibility from gremlin_python import statics from gremlin_python.structure.graph import Graph from gremlin_python.process.graph_traversal import __ from gremlin_python.process.strategies import * from gremlin_python.driver.driver_remote_connection import DriverR...
3,900
1,390
import os from os.path import join, isdir from pathlib import Path from collections import defaultdict from tqdm import tqdm import nibabel as nib import numpy as np import json from .resample import resample_patient from .custom_augmentations import resize_data_and_seg, crop_to_bbox class Preprocessor(object): "...
15,045
4,375
import sys import setuptools from setuptools.command.test import test as TestCommand def read_file(filename): with open(filename, "r", encoding='utf8') as f: return f.read() class PyTest(TestCommand): """PyTest""" def finalize_options(self): """finalize_options""" TestCommand.fi...
1,558
505
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-28 21:12 from hanlp_common.constant import HANLP_URL SIGHAN2005_PKU_CONVSEG = HANLP_URL + 'tok/sighan2005-pku-convseg_20200110_153722.zip' 'Conv model (:cite:`wang-xu-2017-convolutional`) trained on sighan2005 pku dataset.' SIGHAN2005_MSR_CONVSEG = HANLP_URL + 't...
2,019
998
#!/usr/bin/env python # Copyright 2015 The Swarming Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 that # can be found in the LICENSE file. import logging import os import subprocess import sys import tempfile import shutil import unittest import re THIS_FILE...
3,364
1,247
from featur_selection import df,race,occupation,workclass,country import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.model_selection import cross_val_score,KFold from sklearn.linear_model import LogisticRegression from imblearn.pipeline import Pipeline from sklearn.compose import ColumnT...
2,452
801
from __future__ import print_function def action_010(): print('doit')
76
28
#!/usr/bin/env python3 import pytest import fileinput from os.path import splitext, abspath F_NAME = 'd8' #implement day8 using bits def find_ones(d): '''count number of ones in binary number''' ones = 0 while d > 0: ones += d & 1 d >>= 1 return ones # Assign each segment a 'wire'. lut...
3,392
1,197
""" ******************************** * Created by mohammed-alaa * ******************************** Spatial Dataloader implementing sequence api from keras (defines how to load a single item) this loads batches of images for each iteration it returns [batch_size, height, width ,3] ndarrays """ import copy import ran...
8,931
2,731
# -*- coding:utf-8 -*- """ @version: v1.0 @author: xuelong.liu @license: Apache Licence @contact: xuelong.liu@yulore.com @software: PyCharm @file: base_request_param.py @time: 12/21/16 6:48 PM """ class RequestParam(object): """ 请求相关 """ # URL START_URL = "https://www.hn.10086.cn/service/static...
1,593
756
# stdlib imports import copy # vendor imports import click @click.command() @click.argument("input_file", type=click.File("r")) def main(input_file): """Put your puzzle execution code here""" # Convert the comma-delimited string of numbers into a list of ints masterRegister = list( map(lambda op:...
2,762
705
class BackupUnit(object): def __init__(self, name, password=None, email=None): """ BackupUnit class initializer. :param name: A name of that resource (only alphanumeric characters are acceptable)" :type name: ``str`` :param password: The password associated ...
823
216
import os dirs = [ './PANDORA_files', './PANDORA_files/data', './PANDORA_files/data/csv_pkl_files', './PANDORA_files/data/csv_pkl_files/mhcseqs', './PANDORA_files/data/PDBs', './PANDORA_files/data/PDBs/pMHCI', './PANDORA_files/data/PDBs/pMHCII', './PANDORA_files/data/PDBs/Bad', './PANDO...
984
420
# app/auth/views.py import os from flask import flash, redirect, render_template, url_for, request from flask_login import login_required, login_user, logout_user, current_user from . import auth from .forms import (LoginForm, RegistrationForm, RequestResetForm, ResetPasswordForm) from .. import db,...
7,711
2,093
# Copyright 2015 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 or ...
6,174
1,963
import pickle import warnings import collections.abc from math import isnan from statistics import mean, median, stdev, mode from abc import abstractmethod, ABC from numbers import Number from collections import defaultdict from itertools import islice, chain from typing import Hashable, Optional, Sequence, Union, Ite...
25,175
6,741
# # Copyright (c) 2019, NVIDIA CORPORATION. # # 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 ...
6,553
1,965
import re import difflib import pandas as pd import numpy as np from nameparser import HumanName from nameparser.config import CONSTANTS CONSTANTS.titles.remove("gen") CONSTANTS.titles.remove("prin") def parse_paper_type(section_name): section_name = section_name.strip().lower() if section_name == '': ...
5,054
1,501
# Generated by Django 3.1 on 2020-08-11 19:45 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('quem_foi_para_mar_core', '0003_auto_20200811_1944'), ] operations = [ migrations.RenameField( model_name='contato', old_name='...
384
149
from pythonfuzz.main import PythonFuzz from tinytag import TinyTag import io @PythonFuzz def fuzz(buf): try: f = open('temp.mp4', "wb") f.write(buf) f.seek(0) tag = TinyTag.get(f.name) except UnicodeDecodeError: pass if __name__ == '__main__': fuzz()
268
122
/home/runner/.cache/pip/pool/d1/fc/c7/6cbbdf9c58b6591d28ed792bbd7944946d3f56042698e822a2869787f6
96
74
# coding: utf-8 # pylint: disable = invalid-name, C0111 import gpboost as gpb import numpy as np from sklearn.metrics import mean_squared_error import matplotlib.pyplot as plt plt.style.use('ggplot') #--------------------Cross validation for tree-boosting without GP or random effects---------------- print('Simulating ...
3,951
1,492
# Copyright 2022 The Matrix.org Foundation C.I.C. # # 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 a...
2,230
685
import set_path import sys import torch set_path.append_sys_path() import rela import hanalearn import utils assert rela.__file__.endswith(".so") assert hanalearn.__file__.endswith(".so") class ActGroup: def __init__( self, devices, agent, partner_weight, seed, n...
4,859
1,415
# ****************************************************** ## Copyright 2019, PBL Netherlands Environmental Assessment Agency and Utrecht University. ## Reuse permitted under Gnu Public License, GPL v3. # ****************************************************** from netCDF4 import Dataset import numpy as np import genera...
1,128
388
from io import TextIOWrapper import math from typing import TypeVar import random import os from Settings import Settings class Dataset: DataT = TypeVar('DataT') WIN_NL = "\r\n" LINUX_NL = "\n" def __init__(self, path:str, filename:str, newline:str = WIN_NL) -> None: self.path_ = path self.f...
7,309
3,295
import datetime import decimal import json import traceback from django.conf import settings from django.core.mail import EmailMessage from django.db import models from django.utils import timezone from django.template.loader import render_to_string from django.contrib.sites.models import Site import stripe from js...
36,939
10,912
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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,321
812
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch _USING_PARROTS = True try: from parrots.autograd import gradcheck except ImportError: from torch.autograd import gradcheck, gradgradcheck _USING_PARROTS = False class TestUpFirDn2d: """Unit test for UpFirDn2d. Here, we ju...
1,876
651
import pandas as pd from tqdm import tqdm data_list = [] def get_questions(row): global data_list random_samples = df.sample(n=num_choices - 1) distractors = random_samples["description"].tolist() data = { "question": "What is " + row["label"] + "?", "correct": row["description"], ...
852
312
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 """ 'attach' command implementation''' """ from base64 import b64encode import argparse import magic from ..bugzilla import BugzillaError from ..context import bugzilla_instance from .. import ui from .base import Base class Command(Base): """Attach file to...
2,776
797
#!/usr/bin/env python # -*- coding: utf-8 -*- # import numpy import pygmsh from helpers import compute_volume def test(): # Airfoil coordinates airfoil_coordinates = numpy.array([ [1.000000, 0.000000, 0.0], [0.999023, 0.000209, 0.0], [0.996095, 0.000832, 0.0], [0.991228, 0.001...
5,089
3,285
class Solution: def findDuplicate(self, nums: List[int]) -> int: p1, p2 = nums[0], nums[nums[0]] while nums[p1] != nums[p2]: p1 = nums[p1] p2 = nums[nums[p2]] p2 = 0 while nums[p1] != nums[p2]: p1 = nums[p1] p2 = nums[p2] return...
330
141
class A: def a(self): return 'a' class B(A, object): def b(self): return 'b' class Inherit(A): def a(self): return 'c'
158
63
import pytest @pytest.yield_fixture def passwd(): print ("\nsetup before yield") f = open("/etc/passwd") yield f.readlines() print ("teardown after yield") f.close() def test_has_lines(passwd): print ("test called") assert passwd
260
90
import json from threading import Semaphore import ee from flask import request from google.auth import crypt from google.oauth2 import service_account from google.oauth2.credentials import Credentials service_account_credentials = None import logging export_semaphore = Semaphore(5) get_info_semaphore = Semaphore(2)...
2,327
767
#https://microbit-micropython.readthedocs.io/en/latest/tutorials/images.html#animation from microbit import * boat1 = Image("05050:05050:05050:99999:09990") boat2 = Image("00000:05050:05050:05050:99999") boat3 = Image("00000:00000:05050:05050:05050") boat4 = Image("00000:00000:00000:05050:05050") boat5 = Image("00000:0...
481
301
import os import json import shutil import time from pyramid.renderers import render_to_response from pyramid.response import Response from groupdocs.ApiClient import ApiClient from groupdocs.AsyncApi import AsyncApi from groupdocs.StorageApi import StorageApi from groupdocs.GroupDocsRequestSigner import GroupDocsReq...
2,022
572
from __future__ import print_function import numpy as np import struct import solvers import pid from util import * MOTORSPEED = 0.9 MOTORMARGIN = 1 MOTORSLOPE = 30 ERRORLIM = 5.0 class ArmConfig: """Holds an arm's proportions, limits and other configuration data""" def __init__(self, main...
14,585
4,543
from pedalboard import Reverb, Compressor, Gain, LowpassFilter, Pedalboard import soundfile as sf if __name__ == '__main__': # replace by path of unprocessed piano file if necessar fn_wav_source = 'live_grand_piano.wav' # augmentation settings using Pedalboard library settings = {'rev-': [Reverb(roo...
1,194
410
"""add_request_system Revision: 9ba67b798fa Revises: 31b92bf6506d Created: 2013-07-23 02:49:09.342814 """ revision = '9ba67b798fa' down_revision = '31b92bf6506d' from alembic import op from spire.schema.fields import * from spire.mesh import SurrogateType from sqlalchemy import (Column, ForeignKey, ForeignKeyConstra...
2,867
870
# Copyright (C) 2021 Open Source Robotics Foundation # # 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...
9,333
3,761
import os import fsspec from fsspec.implementations.memory import MemoryFileSystem import pickle import pytest def test_mapping_prefix(tmpdir): tmpdir = str(tmpdir) os.makedirs(os.path.join(tmpdir, "afolder")) open(os.path.join(tmpdir, "afile"), "w").write("test") open(os.path.join(tmpdir, "afolder", ...
1,418
554
""" A / | B C 'B, C' """ class CategoryTree: def __init__(self): self.root = {} self.all_categories = [] def add_category(self, category, parent): if category in self.all_categories: raise KeyError(f"{category} exists") if parent is None: self.r...
990
322
# -*- coding: UTF-8 -*- """ .. --------------------------------------------------------------------- ___ __ __ __ ___ / | \ | \ | \ / the automatic \__ |__/ |__/ |___| \__ annotation and \ | | | | \ ...
4,681
1,791
from .resnet import * from .hynet import * from .classifier import Classifier, HFClassifier, HNSWClassifier from .ext_layers import ParameterClient samplerClassifier = { 'hf': HFClassifier, 'hnsw': HNSWClassifier, }
226
79
import pickle import socket import _thread from scripts.multiplayer import game, board, tetriminos server = "192.168.29.144" port = 5555 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((server, port)) except socket.error as e: print(e) s.listen() print("Waiting for connection") connected ...
1,397
483
def sum_of_squares(n): return sum(i ** 2 for i in range(1, n+1)) def square_of_sum(n): return sum(range(1, n+1)) ** 2
134
66
import os import re from collections import defaultdict class Claim(object): def __init__(self, data_row): match = re.match(r'#(\d+) @ (\d+),(\d+): (\d+)x(\d+)', data_row) self.id = int(match[1]) self.x = int(match[2]) self.y = int(match[3]) self.width = int(match[4]) ...
2,311
713
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) Philipp Wagner. All rights reserved. # Licensed under the BSD license. See LICENSE file in the project root for full license information. import numpy as np class AbstractDistance(object): def __init__(self, name): self._name = name ...
4,737
1,618
#!/usr/bin/python #coding=utf-8 import os import requests import time import re from datetime import datetime import urllib2 import json import mimetypes import smtplib from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart # configuration for pgyer USER_KEY = "f605b7c782669...
7,162
2,690