repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
wanderlog/posthog | ee/clickhouse/sql/person.py | a88b81d44ab31d262be07e84a85d045c4e28f2a3 | 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... | [((1110, 1161), 'ee.clickhouse.sql.table_engines.ReplacingMergeTree', 'ReplacingMergeTree', (['PERSONS_TABLE'], {'ver': '"""_timestamp"""'}), "(PERSONS_TABLE, ver='_timestamp')\n", (1128, 1161), False, 'from ee.clickhouse.sql.table_engines import CollapsingMergeTree, ReplacingMergeTree\n'), ((4949, 5009), 'ee.clickhous... |
davmre/sigvisa | scripts/dump_training_data.py | 91a1f163b8f3a258dfb78d88a07f2a11da41bd04 | 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... | [((258, 280), 'numpy.savetxt', 'np.savetxt', (['"""X.txt"""', 'X'], {}), "('X.txt', X)\n", (268, 280), True, 'import numpy as np\n'), ((281, 303), 'numpy.savetxt', 'np.savetxt', (['"""y.txt"""', 'y'], {}), "('y.txt', y)\n", (291, 303), True, 'import numpy as np\n'), ((304, 334), 'numpy.savetxt', 'np.savetxt', (['"""evi... |
wbrandenburger/ShadowDetection | shdw/tools/welford.py | 2a58df93e32e8baf99806555655a7daf7e68735a | 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(... | [((1475, 1513), 'math.sqrt', 'math.sqrt', (['(self._std / (self._num - 1))'], {}), '(self._std / (self._num - 1))\n', (1484, 1513), False, 'import math\n'), ((1195, 1211), 'math.pow', 'math.pow', (['std', '(2)'], {}), '(std, 2)\n', (1203, 1211), False, 'import math\n'), ((2268, 2293), 'numpy.vectorize', 'np.vectorize',... |
lilbond/bitis | day3/functions.py | 58e5eeebade6cea99fbf86fdf285721fb602e4ef |
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:
... | [] |
KipCrossing/Micropython-AD9833 | test.py | c684f5a9543bc5b67dcbf357c50f4d8f4057b2bf | 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... | [((387, 405), 'ad9833.AD9833', 'AD9833', (['SBI1', 'PIN3'], {}), '(SBI1, PIN3)\n', (393, 405), False, 'from ad9833 import AD9833\n')] |
devicehive/devicehive-plugin-python-template | tests/test_api_network.py | ad532a57ebf9ae52f12afc98eeb867380707d47d | # 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, ... | [((6449, 6457), 'six.moves.range', 'range', (['(2)'], {}), '(2)\n', (6454, 6457), False, 'from six.moves import range\n'), ((9168, 9176), 'six.moves.range', 'range', (['(2)'], {}), '(2)\n', (9173, 9176), False, 'from six.moves import range\n'), ((12099, 12107), 'six.moves.range', 'range', (['(2)'], {}), '(2)\n', (12104... |
miciux/telegram-bot-admin | filehandler.py | feb267ba6ce715b734b1a5911487c1080410a4a9 | 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.... | [((145, 210), 'abstracthandler.AbstractHandler.__init__', 'abstracthandler.AbstractHandler.__init__', (['self', '"""file"""', 'conf', 'bot'], {}), "(self, 'file', conf, bot)\n", (185, 210), False, 'import abstracthandler\n'), ((230, 257), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (24... |
Tensorflow-Devs/federated | tensorflow_federated/python/learning/federated_evaluation.py | 5df96d42d72fa43a050df6465271a38175a5fd7a | # 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... | [((3079, 3133), 'tensorflow_federated.python.learning.framework.optimizer_utils.is_stateful_process', 'optimizer_utils.is_stateful_process', (['broadcast_process'], {}), '(broadcast_process)\n', (3114, 3133), False, 'from tensorflow_federated.python.learning.framework import optimizer_utils\n'), ((3679, 3721), 'tensorf... |
joaompinto/pylibcontainer | pylibcontainer/image.py | 794f12e7511dc2452521bad040a7873eff40f50b | 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... | [((4116, 4131), 'click.command', 'click.command', ([], {}), '()\n', (4129, 4131), False, 'import click\n'), ((4133, 4160), 'click.argument', 'click.argument', (['"""image_url"""'], {}), "('image_url')\n", (4147, 4160), False, 'import click\n'), ((4162, 4201), 'click.option', 'click.option', (['"""--as_root"""'], {'is_f... |
michel117/robotframework-doctestlibrary | utest/test_compareimage.py | 305b220b73846bd389c47d74c2e0431c7bfaff94 | 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... | [((144, 187), 'DocTest.CompareImage.CompareImage', 'CompareImage', (["(testdata_dir / 'text_big.png')"], {}), "(testdata_dir / 'text_big.png')\n", (156, 187), False, 'from DocTest.CompareImage import CompareImage\n'), ((604, 633), 'pytest.raises', 'pytest.raises', (['AssertionError'], {}), '(AssertionError)\n', (617, 6... |
haruiz/PytorchCvStudio | cvstudio/view/widgets/labels_tableview/__init__.py | ccf79dd0cc0d61f3fd01b1b5d96f7cda7b681eef | from .labels_tableview import LabelsTableView
| [] |
vishalbelsare/ags_nlp_solver | experiments/solve_different_methods.py | 3558e8aae5507285d0c5e74f163c01d09a9cb805 | 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... | [((13158, 13203), 'functools.partial', 'functools.partial', (['AGSWrapper'], {'mixedFast': '(True)'}), '(AGSWrapper, mixedFast=True)\n', (13175, 13203), False, 'import functools\n'), ((13224, 13284), 'functools.partial', 'functools.partial', (['NLOptWrapper'], {'method': 'nlopt.GN_ORIG_DIRECT'}), '(NLOptWrapper, method... |
mattyschell/geodatabase-toiler | src/py/fc.py | c8231999c3156bf41f9b80f151085afa97ba8586 | 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... | [((513, 546), 'arcpy.Describe', 'arcpy.Describe', (['self.featureclass'], {}), '(self.featureclass)\n', (527, 546), False, 'import arcpy\n'), ((749, 780), 'arcpy.Exists', 'arcpy.Exists', (['self.featureclass'], {}), '(self.featureclass)\n', (761, 780), False, 'import arcpy\n'), ((877, 910), 'arcpy.Describe', 'arcpy.Des... |
gomesGabriel/Pythonicos | desafiosCursoEmVideo/ex004.py | b491cefbb0479dd83fee267304d0fa30b99786a5 | 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... | [] |
dalmia/Lisa-Lab-Tutorials | Machine learning book/3 - MultiLayer Perceptron/test_regression.py | ee1b0b4fcb82914085420bb289ebda09f248c8d1 | 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:... | [((276, 295), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 't', '"""."""'], {}), "(x, t, '.')\n", (284, 295), True, 'import matplotlib.pyplot as plt\n'), ((296, 306), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (304, 306), True, 'import matplotlib.pyplot as plt\n'), ((452, 506), 'mlp.mlp', 'mlp', (['train',... |
IllIIIllll/reinforcement-learning-omok | gomoku/networks/__init__.py | 1c76ba76c203a3b7c99095fde0626aff45b1b94b | # © 2020 지성. all rights reserved.
# <[email protected]>
# Apache License 2.0
from .small import *
from .medium import *
from .large import * | [] |
snowxmas/alipay-sdk-python-all | alipay/aop/api/domain/AlipayEbppInvoiceAuthSignModel.py | 96870ced60facd96c5bce18d19371720cbda3317 | #!/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... | [] |
jmcshane/experimental | sdk/python/tekton_pipeline/models/v1beta1_embedded_task.py | 3c47c7e87bcdadc6172941169f3f24fc3f159ae0 | # 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... | [((10862, 10895), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (10875, 10895), False, 'import six\n'), ((2520, 2535), 'tekton_pipeline.configuration.Configuration', 'Configuration', ([], {}), '()\n', (2533, 2535), False, 'from tekton_pipeline.configuration import Configurati... |
gmlunesa/zhat | tzp.py | 3bf62625d102bd40274fcd39c91f21c169e334a8 | 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... | [((196, 255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Client for teezeepee"""'}), "(description='Client for teezeepee')\n", (219, 255), False, 'import argparse\n'), ((1448, 1475), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1473, 1475), False, 'imp... |
Sam-Gresh/linkage-agent-tools | anonlink-entity-service/backend/entityservice/tasks/solver.py | f405c7efe3fa82d99bc047f130c0fac6f3f5bf82 | 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.... | [((365, 456), 'entityservice.async_worker.celery.task', 'celery.task', ([], {'base': 'TracedTask', 'ignore_result': '(True)', 'args_as_tags': "('project_id', 'run_id')"}), "(base=TracedTask, ignore_result=True, args_as_tags=('project_id',\n 'run_id'))\n", (376, 456), False, 'from entityservice.async_worker import ce... |
nickmvincent/ugc-val-est | portal/migrations/0007_auto_20170824_1341.py | b5cceda14ef5830f1befaddfccfd90a694c9677a | # -*- 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(
... | [((431, 461), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (450, 461), False, 'from django.db import migrations, models\n'), ((607, 637), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (626, 637), False, 'from djan... |
AleRiccardi/technical-neural-network-course | exercise-09/programming_assignment/hopfield.py | bfcca623a9dc3f7f4c20e1efe39abe986cd8869e | 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([
... | [((45, 145), 'numpy.array', 'np.array', (['[[1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 1,\n 1, 1, 1]]'], {}), '([[1, 1, 1, 1, 1], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0\n ], [1, 1, 1, 1, 1]])\n', (53, 145), True, 'import numpy as np\n'), ((174, 274), 'numpy.array', 'np.array... |
cdla/murfi2 | util/infoclient/test_infoclient.py | 45dba5eb90e7f573f01706a50e584265f0f8ffa7 |
from infoclientLib import InfoClient
ic = InfoClient('localhost', 15002, 'localhost', 15003)
ic.add('roi-weightedave', 'active')
ic.start()
| [((43, 93), 'infoclientLib.InfoClient', 'InfoClient', (['"""localhost"""', '(15002)', '"""localhost"""', '(15003)'], {}), "('localhost', 15002, 'localhost', 15003)\n", (53, 93), False, 'from infoclientLib import InfoClient\n')] |
MovestaDev/low-resource-text-classification-framework | lrtc_lib/experiment_runners/experiment_runner.py | 4380755a65b35265e84ecbf4b87e872d79e8f079 | # (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,... | [((281, 401), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s')\n", (300, 401), False, 'import logging... |
alexbjorling/acquisition-framework | contrast/environment/data.py | 4090381344aabca05155612845ba4e4a47455dc3 | 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... | [((397, 420), 'tango.DeviceProxy', 'DeviceProxy', (['sdm_device'], {}), '(sdm_device)\n', (408, 420), False, 'from tango import DeviceProxy, DevError\n')] |
fung04/csrw_game | game_2048/views.py | 9673fdd311583057d5bf756dec7b99959d961d0c | 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... | [((260, 299), 'django.shortcuts.render', 'render', (['request', '"""game_2048/index.html"""'], {}), "(request, 'game_2048/index.html')\n", (266, 299), False, 'from django.shortcuts import redirect, render\n'), ((1086, 1114), 'django.http.JsonResponse', 'JsonResponse', (['""""""'], {'safe': '(False)'}), "('', safe=False... |
Silvicek/distributional-dqn | distdeepq/__init__.py | 41a9095393dd25b7375119b4af7d2c35ee3ec6cc | 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
| [] |
17nikhil/codecademy | python/10.Authentication-&-API-Keys.py | 58fbd652691c9df8139544965ebb0e9748142538 | # 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... | [] |
takkaria/json-plucker | plucker/__init__.py | 6407dcc9a21d99d8f138128e9ee80c901a08c2e1 | from .plucker import pluck, Path
from .exceptions import PluckError
__all__ = ["pluck", "Path", "PluckError"]
| [] |
gimbo/arviz | arviz/plots/pairplot.py | c1df1847aa5170ad2810ae3d705d576d2643e3ec | """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... | [((5835, 5861), 'numpy.squeeze', 'np.squeeze', (['diverging_mask'], {}), '(diverging_mask)\n', (5845, 5861), True, 'import numpy as np\n'), ((5920, 6188), 'warnings.warn', 'warnings.warn', (['"""Divergences data not found, plotting without divergences. Make sure the sample method provides divergences data and that it i... |
LisandroCanteros/Grupo2_COM06_Info2021 | cuestionario/formularios.py | 86ad9e08db4e8935bf397b6e4db0b3d9d72cb320 | 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... | [] |
biocross/VITCloud | vitcloud/views.py | 9656bd489c6d05717bf529d0661e07da0cd2551a | 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... | [] |
jeremytiki/blurple.py | blurple/ui/base.py | c8f65955539cc27be588a06592b1c81c03f59c37 | 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... | [] |
jonzxz/project-piscator | migrations/versions/e86dd3bc539c_change_admin_to_boolean.py | 588c8b1ac9355f9a82ac449fdbeaa1ef7eb441ef | """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... | [((1235, 1275), 'alembic.op.drop_column', 'op.drop_column', (['"""user"""', '"""last_logged_in"""'], {}), "('user', 'last_logged_in')\n", (1249, 1275), False, 'from alembic import op\n'), ((1280, 1314), 'alembic.op.drop_column', 'op.drop_column', (['"""user"""', '"""is_admin"""'], {}), "('user', 'is_admin')\n", (1294, ... |
adrianomqsmts/django-escola | school/migrations/0010_alter_sala_unique_together.py | a69541bceb3f30bdd2e9f0f41aa9c2da6081a1d1 | # 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',
... | [((263, 349), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""sala"""', 'unique_together': "{('porta', 'predio')}"}), "(name='sala', unique_together={('porta',\n 'predio')})\n", (293, 349), False, 'from django.db import migrations\n')] |
chris4540/DD2430-ds-proj | code_trunk/trainer/abc.py | b876efabe949392b27a7ebd4afb2be623174e287 | """
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... | [] |
melvyniandrag/quadpy | quadpy/triangle/cools_haegemans.py | ae28fc17351be8e76909033f03d71776c7ef8280 | # -*- 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... | [] |
RichardLeeH/invoce_sys | account/admin.py | 42a6f5750f45b25e0d7282114ccb7f9f72ee1761 | # -*- 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... | [((543, 571), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['Token'], {}), '(Token)\n', (564, 571), False, 'from django.contrib import admin\n'), ((572, 610), 'django.contrib.admin.site.register', 'admin.site.register', (['Token', 'TokenAdmin'], {}), '(Token, TokenAdmin)\n', (591, 610), False, 'fro... |
krishankansal/PythonPrograms | oops/#016exceptions.py | 6d4d989068195b8c8dd9d71cf4f920fef1177cf2 | #!/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... | [] |
denn-s/SimCLR | config/simclr_config.py | e2239ac52464b1271c3b8ad1ec4eb26f3b73c7d4 | 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... | [((115, 126), 'dataclasses.dataclass', 'dataclass', ([], {}), '()\n', (124, 126), False, 'from dataclasses import dataclass\n'), ((300, 311), 'dataclasses.dataclass', 'dataclass', ([], {}), '()\n', (309, 311), False, 'from dataclasses import dataclass\n'), ((1430, 1441), 'dataclasses.dataclass', 'dataclass', ([], {}), ... |
Priyanka-Askani/swift | test/unit/common/middleware/s3api/test_obj.py | 1ab691f63778008015b34ce004992844acee9968 | # 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 ... | [((13899, 13921), 'test.unit.common.middleware.s3api.test_s3_acl.s3acl', 's3acl', ([], {'s3acl_only': '(True)'}), '(s3acl_only=True)\n', (13904, 13921), False, 'from test.unit.common.middleware.s3api.test_s3_acl import s3acl\n'), ((32337, 32359), 'test.unit.common.middleware.s3api.test_s3_acl.s3acl', 's3acl', ([], {'s3... |
EggPool/pynyzo | pynyzo/pynyzo/keyutil.py | 7f3b86f15caa51a975e6a428f4dff578a1f24bcb | """
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
"""
# ... | [((582, 606), 'ed25519.create_keypair', 'ed25519.create_keypair', ([], {}), '()\n', (604, 606), False, 'import ed25519\n'), ((1512, 1539), 'ed25519.SigningKey', 'ed25519.SigningKey', (['keydata'], {}), '(keydata)\n', (1530, 1539), False, 'import ed25519\n'), ((2341, 2381), 'ed25519.SigningKey', 'ed25519.SigningKey', ([... |
mir-group/CiderPress | mldftdat/scripts/train_gp.py | bf2b3536e6bd7432645c18dce5a745d63bc9df59 | 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... | [((390, 480), 'os.path.join', 'os.path.join', (['SAVE_ROOT', '"""DATASETS"""', 'args.functional', 'args.basis', 'args.version', 'fname'], {}), "(SAVE_ROOT, 'DATASETS', args.functional, args.basis, args.\n version, fname)\n", (402, 480), False, 'import os\n'), ((1042, 1132), 'os.path.join', 'os.path.join', (['SAVE_RO... |
zaratec/picoCTF | picoCTF-web/api/routes/admin.py | b0a63f03625bb4657a8116f43bea26346ca6f010 | 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 ... | [((322, 354), 'flask.Blueprint', 'Blueprint', (['"""admin_api"""', '__name__'], {}), "('admin_api', __name__)\n", (331, 354), False, 'from flask import Blueprint, Flask, render_template, request, send_from_directory, session\n'), ((840, 861), 'api.common.WebSuccess', 'WebSuccess', ([], {'data': 'data'}), '(data=data)\n... |
thongnbui/MIDS_251_project | python code/influxdb_worker.py | 8eee0f4569268e11c2d1d356024dbdc10f180b10 | #!/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... | [] |
xyzst/pants | src/python/pants/backend/docker/lint/hadolint/subsystem.py | d6a357fe67ee7e8e1aefeae625e107f5609f1717 | # 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... | [((2848, 2877), 'typing.cast', 'cast', (['bool', 'self.options.skip'], {}), '(bool, self.options.skip)\n', (2852, 2877), False, 'from typing import cast\n'), ((3038, 3077), 'typing.cast', 'cast', (['"""str | None"""', 'self.options.config'], {}), "('str | None', self.options.config)\n", (3042, 3077), False, 'from typin... |
LucaCilibrasi/docker_viruclust | venv/lib/python3.9/site-packages/biorun/fetch.py | 88149c17fd4b94a54397d0cb4a9daece00122c49 | """
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 ... | [((6836, 6866), 'biorun.libs.placlib.pos', 'plac.pos', (['"""data"""', '"""data names"""'], {}), "('data', 'data names')\n", (6844, 6866), True, 'import biorun.libs.placlib as plac\n'), ((6868, 6916), 'biorun.libs.placlib.flg', 'plac.flg', (['"""fetch"""', '"""download data as accessions"""'], {}), "('fetch', 'download... |
LaverdeS/Genetic_Algorithm_EGame | game/items/game_item.py | 89ff8c7870fa90768f4616cab6803227c8613396 | 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... | [((829, 847), 'PyQt5.QtGui.QImage', 'QImage', (['self.image'], {}), '(self.image)\n', (835, 847), False, 'from PyQt5.QtGui import QImage\n'), ((701, 719), 'numpy.array', 'np.array', (['[_x, _y]'], {}), '([_x, _y])\n', (709, 719), True, 'import numpy as np\n'), ((573, 609), 'random.randint', 'randint', (['_left_border',... |
felipecosta09/cloudone-workload-controltower-lifecycle | source/deepsecurity/models/application_type_rights.py | 7927c84d164058b034fc872701b5ee117641f4d1 | # 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... | [((5314, 5347), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (5327, 5347), False, 'import six\n')] |
hardikvasa/database-journal | code-samples/aws_neptune.py | 7932b5a7fe909f8adb3a909183532b43d450da7b | 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... | [((376, 383), 'gremlin_python.structure.graph.Graph', 'Graph', ([], {}), '()\n', (381, 383), False, 'from gremlin_python.structure.graph import Graph\n'), ((435, 495), 'gremlin_python.driver.driver_remote_connection.DriverRemoteConnection', 'DriverRemoteConnection', (['"""wss://<endpoint>:8182/gremlin"""', '"""g"""'], ... |
Ramsha04/kits19-2d-reproduce | kits19cnn/io/preprocess_train.py | 66678f1eda3688d6dc64389e9a80ae0b754a3052 | 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):
"... | [((3745, 3761), 'tqdm.tqdm', 'tqdm', (['self.cases'], {}), '(self.cases)\n', (3749, 3761), False, 'from tqdm import tqdm\n'), ((7526, 7554), 'os.path.join', 'join', (['self.out_dir', 'case_raw'], {}), '(self.out_dir, case_raw)\n', (7530, 7554), False, 'from os.path import join, isdir\n'), ((8671, 8688), 'collections.de... |
opywan/calm-dsl | setup.py | 1d89436d039a39265a0ae806022be5b52e757ac0 | 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... | [((306, 340), 'setuptools.command.test.test.finalize_options', 'TestCommand.finalize_options', (['self'], {}), '(self)\n', (334, 340), True, 'from setuptools.command.test import test as TestCommand\n'), ((491, 518), 'pytest.main', 'pytest.main', (['self.test_args'], {}), '(self.test_args)\n', (502, 518), False, 'import... |
chen88358323/HanLP | hanlp/pretrained/tok.py | ee9066c3b7aad405dfe0ccffb7f66c59017169ae | # -*- 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... | [] |
bopopescu/webrtc-streaming-node | third_party/webrtc/src/chromium/src/tools/swarming_client/tests/logging_utils_test.py | 727a441204344ff596401b0253caac372b714d91 | #!/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... | [((323, 348), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (338, 348), False, 'import os\n'), ((543, 554), 'os.getpid', 'os.getpid', ([], {}), '()\n', (552, 554), False, 'import os\n'), ((721, 738), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (736, 738), False, 'import os\n'), (... |
HrishikV/ineuron_inceome_prediction_internship | model_selection.py | 4a97a7f29d80198f394fcfd880cc5250fe2a0d1e | 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... | [((706, 715), 'featur_selection.df.copy', 'df.copy', ([], {}), '()\n', (713, 715), False, 'from featur_selection import df, race, occupation, workclass, country\n'), ((2143, 2190), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(2)', 'ncols': '(1)', 'figsize': '(15, 8)'}), '(nrows=2, ncols=1, figsize=(15... |
blazelibs/blazeweb | tests/apps/newlayout/tasks/init_data.py | b120a6a2e38c8b53da2b73443ff242e2d1438053 | from __future__ import print_function
def action_010():
print('doit')
| [] |
apie/advent-of-code | 2021/d8b_bits.py | c49abec01b044166a688ade40ebb1e642f0e5ce0 | #!/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... | [((2843, 2878), 'fileinput.input', 'fileinput.input', (["(F_NAME + '.test.1')"], {}), "(F_NAME + '.test.1')\n", (2858, 2878), False, 'import fileinput\n'), ((3006, 3039), 'fileinput.input', 'fileinput.input', (["(F_NAME + '.test')"], {}), "(F_NAME + '.test')\n", (3021, 3039), False, 'import fileinput\n'), ((3174, 3196)... |
rizkiailham/two-stream-action-recognition-1 | frame_dataloader/spatial_dataloader.py | 01221f668e62eb26e3593f4ecd3f257b6b6979ab | """
********************************
* 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... | [((760, 787), 'copy.deepcopy', 'copy.deepcopy', (['data_to_load'], {}), '(data_to_load)\n', (773, 787), False, 'import copy\n'), ((890, 914), 'copy.deepcopy', 'copy.deepcopy', (['augmenter'], {}), '(augmenter)\n', (903, 914), False, 'import copy\n'), ((1705, 1798), 'numpy.array', 'np.array', (['self.labels[batch_start ... |
Svolcano/python_exercise | dianhua/worker/crawler/china_mobile/hunan/base_request_param.py | a50e05891cc7f1fbb40ebcae324b09b6a14473d2 | # -*- coding:utf-8 -*-
"""
@version: v1.0
@author: xuelong.liu
@license: Apache Licence
@contact: [email protected]
@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... | [] |
jack-beach/AdventOfCode2019 | day02/puzzle2.py | a8ac53eaf03cd7595deb2a9aa798a2d17c21c513 | # 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:... | [((63, 78), 'click.command', 'click.command', ([], {}), '()\n', (76, 78), False, 'import click\n'), ((488, 517), 'copy.deepcopy', 'copy.deepcopy', (['masterRegister'], {}), '(masterRegister)\n', (501, 517), False, 'import copy\n'), ((114, 129), 'click.File', 'click.File', (['"""r"""'], {}), "('r')\n", (124, 129), False... |
ionos-cloud/ionos-enterprise-sdk-python | ionosenterprise/items/backupunit.py | 6b601990098ab36289a251406fb093489b647f1d | 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 ... | [] |
X-lab-3D/PANDORA | install.py | 02912a03022e814ff8e0ae8ec52f5075f0e2e381 | 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... | [((675, 686), 'os.mkdir', 'os.mkdir', (['D'], {}), '(D)\n', (683, 686), False, 'import os\n')] |
MainaKamau92/apexselftaught | app/auth/views.py | 9f9a3bd1ba23e57a12e173730917fb9bb7003707 | # 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,... | [((630, 643), 'flask_login.logout_user', 'logout_user', ([], {}), '()\n', (641, 643), False, 'from flask_login import login_required, login_user, logout_user, current_user\n'), ((1360, 1426), 'flask.render_template', 'render_template', (['"""auth/register.html"""'], {'form': 'form', 'title': '"""Register"""'}), "('auth... |
devendermishrajio/oslo.messaging | oslo_messaging/_drivers/zmq_driver/client/publishers/zmq_dealer_publisher.py | 9e5fb5697d3f7259f01e3416af0582090d20859a | # 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 ... | [((878, 905), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (895, 905), False, 'import logging\n'), ((913, 935), 'oslo_messaging._drivers.zmq_driver.zmq_async.import_zmq', 'zmq_async.import_zmq', ([], {}), '()\n', (933, 935), False, 'from oslo_messaging._drivers.zmq_driver import zmq_asy... |
mrucker/banditbenchmark | coba/environments/filters.py | 0365291b3a0cf1d862d294e0386d0ccad3f360f1 | 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... | [((3136, 3159), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (3147, 3159), False, 'from collections import defaultdict\n'), ((3203, 3226), 'collections.defaultdict', 'defaultdict', (['(lambda : 1)'], {}), '(lambda : 1)\n', (3214, 3226), False, 'from collections import defaultdict\... |
egoolish/cuml | python/cuml/preprocessing/LabelEncoder.py | 5320eff78890b3e9129e04e13437496c0424820d | #
# 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 ... | [((3543, 3574), 'nvcategory.from_strings', 'nvcategory.from_strings', (['y.data'], {}), '(y.data)\n', (3566, 3574), False, 'import nvcategory\n'), ((5096, 5127), 'nvcategory.from_strings', 'nvcategory.from_strings', (['y.data'], {}), '(y.data)\n', (5119, 5127), False, 'import nvcategory\n'), ((5346, 5362), 'cudf.Series... |
jhamrick/cogsci-proceedings-analysis | cleaning.py | c3c8b0abd8b9ce639f6de0aea52aec46c2c8abca | 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 == '':
... | [] |
CamilaBodack/template-projeto-selecao | quem_foi_para_mar_core/migrations/0004_auto_20200811_1945.py | b0a0cf6070bf8abab626a17af5c315c82368b010 | # 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='... | [((240, 333), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""contato"""', 'old_name': '"""pescador_id"""', 'new_name': '"""pescador"""'}), "(model_name='contato', old_name='pescador_id',\n new_name='pescador')\n", (262, 333), False, 'from django.db import migrations\n')] |
MJ-SEO/py_fuzz | examples/tinytag/fuzz.py | 789fbfea21bf644ba4d00554fe4141694b0a190a | 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()
| [((175, 194), 'tinytag.TinyTag.get', 'TinyTag.get', (['f.name'], {}), '(f.name)\n', (186, 194), False, 'from tinytag import TinyTag\n')] |
GiulianaPola/select_repeats | venv/lib/python3.8/site-packages/requests/compat.py | 17a0d053d4f874e42cf654dd142168c2ec8fbd11 | /home/runner/.cache/pip/pool/d1/fc/c7/6cbbdf9c58b6591d28ed792bbd7944946d3f56042698e822a2869787f6 | [] |
StatMixedML/GPBoost | examples/python-guide/cross_validation_example.py | 786d8be61c5c28da0690e167af636a6d777bf9e1 | # 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 ... | [((176, 199), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (189, 199), True, 'import matplotlib.pyplot as plt\n'), ((492, 529), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(200)'], {'endpoint': '(True)'}), '(0, 1, 200, endpoint=True)\n', (503, 529), True, 'import numpy a... |
Florian-Sabonchi/synapse | synapse/rest/synapse/client/unsubscribe.py | c95b04bb0e719d3f5de1714b442f95a39c6e3634 | # 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... | [((1465, 1517), 'synapse.http.servlet.parse_string', 'parse_string', (['request', '"""access_token"""'], {'required': '(True)'}), "(request, 'access_token', required=True)\n", (1477, 1517), False, 'from synapse.http.servlet import parse_string\n'), ((1535, 1581), 'synapse.http.servlet.parse_string', 'parse_string', (['... |
ravihammond/hanabi-convention-adaptation | pyhanabi/act_group.py | 5dafa91742de8e8d5810e8213e0e2771818b2f54 | 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... | [((41, 67), 'set_path.append_sys_path', 'set_path.append_sys_path', ([], {}), '()\n', (65, 67), False, 'import set_path\n'), ((119, 148), 'rela.__file__.endswith', 'rela.__file__.endswith', (['""".so"""'], {}), "('.so')\n", (141, 148), False, 'import rela\n'), ((156, 190), 'hanalearn.__file__.endswith', 'hanalearn.__fi... |
vanHoek-dgnm/CARBON-DISC | A_source_code/carbon/code/make_mask.py | 3ecd5f4efba5e032d43679ee977064d6b25154a9 | # ******************************************************
## 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... | [((503, 576), 'ascraster.create_mask', 'ascraster.create_mask', (['mask_asc_fn', 'mask_id'], {'logical': 'logical', 'numtype': 'int'}), '(mask_asc_fn, mask_id, logical=logical, numtype=int)\n', (524, 576), False, 'import ascraster\n'), ((930, 982), 'numpy.zeros', 'np.zeros', (['(dum_asc.nrows, dum_asc.ncols)'], {'dtype... |
gitFloyd/AAI-Project-2 | Code/Dataset.py | c6bb4d389248c3385e58a0c399343322a6dd887f | 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... | [((157, 173), 'typing.TypeVar', 'TypeVar', (['"""DataT"""'], {}), "('DataT')\n", (164, 173), False, 'from typing import TypeVar\n'), ((6860, 6886), 'random.shuffle', 'random.shuffle', (['self.data_'], {}), '(self.data_)\n', (6874, 6886), False, 'import random\n'), ((7037, 7052), 'Settings.Settings.Data', 'Settings.Data... |
wahuneke/django-stripe-payments | payments/models.py | 5d4b26b025fc3fa75d3a0aeaafd67fb825325c94 | 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... | [] |
tomzhang/mars-1 | mars/tensor/base/flip.py | 6f1d85e37eb1b383251314cb0ba13e06288af03d | #!/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-... | [] |
imabackstabber/mmcv | tests/test_ops/test_upfirdn2d.py | b272c09b463f00fd7fdd455f7bd4a055f9995521 | # 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... | [((550, 584), 'torch.tensor', 'torch.tensor', (['[1.0, 3.0, 3.0, 1.0]'], {}), '([1.0, 3.0, 3.0, 1.0])\n', (562, 584), False, 'import torch\n'), ((853, 898), 'torch.randn', 'torch.randn', (['(2, 3, 4, 4)'], {'requires_grad': '(True)'}), '((2, 3, 4, 4), requires_grad=True)\n', (864, 898), False, 'import torch\n'), ((928,... |
rmorain/kirby | dataset_creation/description_task2.py | ef115dbaed4acd1b23c3e10ca3b496f05b9a2382 | 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"],
... | [((495, 523), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {'desc': '"""Progress"""'}), "(desc='Progress')\n", (506, 523), False, 'from tqdm import tqdm\n'), ((529, 599), 'pandas.read_pickle', 'pd.read_pickle', (['"""data/augmented_datasets/pickle/label_description.pkl"""'], {}), "('data/augmented_datasets/pickle/label_desc... |
gonzoua/scarab | scarab/commands/attach.py | b86474527b7b2ec30710ae79ea3f1cf5b7a93005 | # 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... | [((2079, 2101), 'magic.Magic', 'magic.Magic', ([], {'mime': '(True)'}), '(mime=True)\n', (2090, 2101), False, 'import magic\n'), ((1145, 1167), 'argparse.FileType', 'argparse.FileType', (['"""r"""'], {}), "('r')\n", (1162, 1167), False, 'import argparse\n')] |
chabotsi/pygmsh | test/test_airfoil.py | f2c26d9193c63efd9fa7676ea0860a18de7e8b52 | #!/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... | [((177, 3082), 'numpy.array', 'numpy.array', (['[[1.0, 0.0, 0.0], [0.999023, 0.000209, 0.0], [0.996095, 0.000832, 0.0], [\n 0.991228, 0.001863, 0.0], [0.984438, 0.003289, 0.0], [0.975752, \n 0.005092, 0.0], [0.965201, 0.007252, 0.0], [0.952825, 0.009744, 0.0], [\n 0.938669, 0.012538, 0.0], [0.922788, 0.015605,... |
ZintrulCre/LeetCode_Archiver | LeetCode/python3/287.py | de23e16ead29336b5ee7aa1898a392a5d6463d27 | 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... | [] |
mathieui/twisted | src/twisted/test/myrebuilder1.py | 35546d2b50742a32edba54719ce3e752dc50dd2a |
class A:
def a(self):
return 'a'
class B(A, object):
def b(self):
return 'b'
class Inherit(A):
def a(self):
return 'c'
| [] |
MateuszG/django_auth | examples/test_yield_8.py | 4cda699c1b6516ffaa26329f545a674a7c849a16 | 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
| [] |
BuddyVolly/sepal | modules/google-earth-engine/docker/src/sepalinternal/gee.py | 6a2356a88940a36568b1d83ba3aeaae4283d5445 | 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)... | [((274, 286), 'threading.Semaphore', 'Semaphore', (['(5)'], {}), '(5)\n', (283, 286), False, 'from threading import Semaphore\n'), ((308, 320), 'threading.Semaphore', 'Semaphore', (['(2)'], {}), '(2)\n', (317, 320), False, 'from threading import Semaphore\n'), ((503, 540), 'google.auth.crypt.RSASigner.from_string', 'cr... |
mirontoli/tolle-rasp | micropython/007_boat_sink.py | 020638e86c167aedd7b556d8515a3adef70724af | #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... | [] |
groupdocs-legacy-sdk/python | examples/api-samples/inc_samples/convert_callback.py | 80e5ef5a9a14ac4a7815c6cf933b5b2997381455 | 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... | [] |
AliShug/EvoArm | PyIK/src/litearm.py | a5dea204914ee1e25867e4412e88d245329316f2 | 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... | [((5285, 5415), 'struct.pack', 'struct.pack', (['ArmPose.structFormat', 'self.swing_angle', 'self.shoulder_angle', 'self.elbow_angle', 'self.wristXAngle', 'self.wristYAngle'], {}), '(ArmPose.structFormat, self.swing_angle, self.shoulder_angle,\n self.elbow_angle, self.wristXAngle, self.wristYAngle)\n', (5296, 5415),... |
jakobabesser/piano_aug | create_augmented_versions.py | 37f78c77465749c80d7aa91d9e804b89024eb278 | 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... | [((883, 905), 'soundfile.read', 'sf.read', (['fn_wav_source'], {}), '(fn_wav_source)\n', (890, 905), True, 'import soundfile as sf\n'), ((958, 981), 'pedalboard.Pedalboard', 'Pedalboard', (['settings[s]'], {}), '(settings[s])\n', (968, 981), False, 'from pedalboard import Reverb, Compressor, Gain, LowpassFilter, Pedalb... |
siq/flux | flux/migrations/versions/9ba67b798fa_add_request_system.py | ca7563deb9ebef14840bbf0cb7bab4d9478b2470 | """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... | [((2702, 2726), 'alembic.op.drop_table', 'op.drop_table', (['"""message"""'], {}), "('message')\n", (2715, 2726), False, 'from alembic import op\n'), ((2731, 2763), 'alembic.op.drop_table', 'op.drop_table', (['"""request_product"""'], {}), "('request_product')\n", (2744, 2763), False, 'from alembic import op\n'), ((276... |
clalancette/ign-math | src/python/Vector2_TEST.py | 84eb1bfe470d00d335c048f102b56c49a15b56be | # 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... | [((9317, 9332), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9330, 9332), False, 'import unittest\n'), ((786, 796), 'ignition.math.Vector2d', 'Vector2d', ([], {}), '()\n', (794, 796), False, 'from ignition.math import Vector2d\n'), ((898, 912), 'ignition.math.Vector2d', 'Vector2d', (['(1)', '(0)'], {}), '(1, 0)... |
sodre/filesystem_spec | fsspec/tests/test_mapping.py | 5fe51c5e85366b57a11ed66637a940970372ea4b | 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", ... | [((365, 402), 'fsspec.get_mapper', 'fsspec.get_mapper', (["('file://' + tmpdir)"], {}), "('file://' + tmpdir)\n", (382, 402), False, 'import fsspec\n'), ((485, 510), 'fsspec.filesystem', 'fsspec.filesystem', (['"""file"""'], {}), "('file')\n", (502, 510), False, 'import fsspec\n'), ((633, 663), 'fsspec.implementations.... |
EderReisS/pythonChallenges | testedome/questions/quest_5.py | a880358c2cb4de0863f4b4cada36b3d439a8a018 | """
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... | [] |
mirfan899/MTTS | sppas/sppas/src/anndata/aio/__init__.py | 3167b65f576abcc27a8767d24c274a04712bd948 | # -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ ... | [] |
dapengchen123/hfsoftmax | models/__init__.py | 467bd90814abdf3e5ad8384e6e05749172b68ae6 | from .resnet import *
from .hynet import *
from .classifier import Classifier, HFClassifier, HNSWClassifier
from .ext_layers import ParameterClient
samplerClassifier = {
'hf': HFClassifier,
'hnsw': HNSWClassifier,
}
| [] |
AgnirudraSil/tetris | scripts/multiplayer/server.py | 2a4f4c26190fc8b669f98c116af343f7f1ac51bf | 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 ... | [((143, 192), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (156, 192), False, 'import socket\n'), ((1335, 1396), '_thread.start_new_thread', '_thread.start_new_thread', (['threaded_client', '(conn, p, game_id)'], {}), '(threaded_client, (con... |
smaranjitghose/PyProjectEuler | solutions/6-sum-suqare-difference.py | d1303d18a0d90acf885ab5ac54b3ea91d99e83db | 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
| [] |
AustinTSchaffer/DailyProgrammer | AdventOfCode/2018/src/day-03/app.py | b16d9babb298ac5e879c514f9c4646b99c6860a8 | 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])
... | [((522, 545), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (535, 545), False, 'import os\n'), ((558, 595), 'os.path.join', 'os.path.join', (['CURRENT_DIR', '"""data.txt"""'], {}), "(CURRENT_DIR, 'data.txt')\n", (570, 595), False, 'import os\n'), ((1082, 1098), 'collections.defaultdict', 'defaul... |
ArianeFire/HaniCam | facerec-master/py/facerec/distance.py | 8a940486a613d680a0b556209a596cdf3eb71f53 | #!/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
... | [((2543, 2560), 'numpy.sum', 'np.sum', (['bin_dists'], {}), '(bin_dists)\n', (2549, 2560), True, 'import numpy as np\n'), ((2822, 2838), 'numpy.minimum', 'np.minimum', (['p', 'q'], {}), '(p, q)\n', (2832, 2838), True, 'import numpy as np\n'), ((3420, 3429), 'numpy.sum', 'np.sum', (['b'], {}), '(b)\n', (3426, 3429), Tru... |
elina8013/android_demo | pgyer_uploader.py | d8cef19d06a4f21f7cf2c277bbabba8cf10a8608 | #!/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... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.