repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
benlamonica/energy-monitor
new-influx-client.py
86714a365c91cc05c265de81bce191ff4ab585f8
import influxdb_client from influxdb_client import InfluxDBClient bucket = "python-client-sandbox" org = "Energy Monitor" token = "miQdAvNXHiNDVVzPzV5FpkCaR_8qdQ-L1FlPCOXQPI325Kbrh1fgfhkcDUZ4FepaebDdpZ-A1gmtnnjU0_hViA==" url = "http://localhost:9999" client = InfluxDBClient(url=url, token=token, org=org) writeApi = c...
[((262, 307), 'influxdb_client.InfluxDBClient', 'InfluxDBClient', ([], {'url': 'url', 'token': 'token', 'org': 'org'}), '(url=url, token=token, org=org)\n', (276, 307), False, 'from influxdb_client import InfluxDBClient\n')]
guidow/pyfarm-agent
tests/test_agent/test_manhole.py
bb5d464f9f6549a3db3529a93e3d9f388b365586
# No shebang line, this module is meant to be imported # # Copyright 2014 Oliver Palmer # # 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 # # Unle...
[((1260, 1296), 'collections.namedtuple', 'namedtuple', (['"""Peer"""', "('host', 'port')"], {}), "('Peer', ('host', 'port'))\n", (1270, 1296), False, 'from collections import namedtuple\n'), ((2431, 2477), 'pyfarm.agent.manhole.manhole_factory', 'manhole_factory', (['namespace', 'username', 'password'], {}), '(namespa...
xcgoo/uiKLine
func-button/klSigmode.py
80683401d7dc66262ae645db4c2780d6e71be551
# coding: utf-8 """ 插入所有需要的库,和函数 """ #---------------------------------------------------------------------- def klSigmode(self): """查找模式""" if self.mode == 'deal': self.canvas.updateSig(self.signalsOpen) self.mode = 'dealOpen' else: self.canvas.updateSig(self.signals) se...
[]
BnF-jadis/projet
utils/thin.py
212b1e7b179a564650fb959d9c2565648178f6b6
# 2020, BackThen Maps # Coded by Remi Petitpierre https://github.com/RPetitpierre # For Bibliothèque nationale de France (BnF) import cv2, thinning, os import numpy as np import pandas as pd import shapefile as shp from skimage.measure import approximate_polygon from PIL import Image, ImageDraw from utils.utils im...
[((1009, 1095), 'cv2.resize', 'cv2.resize', (['road_network', '(road_network.shape[1] // 2, road_network.shape[0] // 2)'], {}), '(road_network, (road_network.shape[1] // 2, road_network.shape[0] //\n 2))\n', (1019, 1095), False, 'import cv2, thinning, os\n'), ((1105, 1136), 'thinning.guo_hall_thinning', 'thinning.gu...
lutostag/otp
easy2fa/tests/test_checkinput.py
0792548fa51c489cdc5fcb01a3c6dad1cd453154
from unittest import TestCase from unittest.mock import patch from easy2fa import cli class TestCheckInput(TestCase): @patch('builtins.input') def test_default(self, mock_input): mock_input.return_value = '' self.assertEquals(cli.check_input('prompt', default='one'), 'one') mock_input...
[((126, 149), 'unittest.mock.patch', 'patch', (['"""builtins.input"""'], {}), "('builtins.input')\n", (131, 149), False, 'from unittest.mock import patch\n'), ((423, 446), 'unittest.mock.patch', 'patch', (['"""builtins.input"""'], {}), "('builtins.input')\n", (428, 446), False, 'from unittest.mock import patch\n'), ((4...
nps1ngh/adversarial-bert-german-attacks-defense
bert_finetuning/data_loader.py
3cca292ec4c3c07945f4198ae81e1f671462ed90
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler from bert_finetuning.data import GermanData class GermanDataLoader: def __init__( self, data_paths, model_name, do_cleansing, max_sequence_length, batch_size=8, ...
[((837, 946), 'torch.utils.data.TensorDataset', 'TensorDataset', (['self.german_data.train_inputs', 'self.german_data.train_masks', 'self.german_data.train_labels'], {}), '(self.german_data.train_inputs, self.german_data.train_masks,\n self.german_data.train_labels)\n', (850, 946), False, 'from torch.utils.data impo...
Karthik-Ragunath/DDU
data/dirty_mnist.py
b9daae9304bdeb222857884ef8cb3b6b3d004d33
import torch import numpy as np import torch.utils.data as data from torch.utils.data import Subset from data.fast_mnist import create_MNIST_dataset from data.ambiguous_mnist.ambiguous_mnist_dataset import AmbiguousMNIST def get_train_valid_loader(root, batch_size, val_seed=1, val_size=0.1, **kwargs): error_msg...
[((480, 502), 'data.fast_mnist.create_MNIST_dataset', 'create_MNIST_dataset', ([], {}), '()\n', (500, 502), False, 'from data.fast_mnist import create_MNIST_dataset\n'), ((1015, 1039), 'numpy.random.seed', 'np.random.seed', (['val_seed'], {}), '(val_seed)\n', (1029, 1039), True, 'import numpy as np\n'), ((1044, 1070), ...
jaspersnel/vantage6-server
vantage6/server/resource/recover.py
88ad40d23cc36eaba57c170929f7ccdd0011720a
# -*- coding: utf-8 -*- import logging import datetime from flask import request, render_template from flask_jwt_extended import ( create_access_token, decode_token ) from jwt.exceptions import DecodeError from flasgger import swag_from from http import HTTPStatus from pathlib import Path from sqlalchemy.orm.e...
[((494, 515), 'vantage6.common.logger_name', 'logger_name', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'from vantage6.common import logger_name\n'), ((522, 552), 'logging.getLogger', 'logging.getLogger', (['module_name'], {}), '(module_name)\n', (539, 552), False, 'import logging\n'), ((1577, 1595), 'flask....
tranvietanh1991/tomodachi
examples/basic_examples/aws_sns_sqs_middleware_service.py
a815fc718b6cc42dc3fe241abb0e5a5829eba0e8
import os from typing import Any, Callable, Dict import tomodachi from tomodachi import aws_sns_sqs, aws_sns_sqs_publish from tomodachi.discovery import AWSSNSRegistration from tomodachi.envelope import JsonBase async def middleware_function( func: Callable, service: Any, message: Any, topic: str, context: Dict,...
[((2199, 2228), 'tomodachi.aws_sns_sqs', 'aws_sns_sqs', (['"""example-route1"""'], {}), "('example-route1')\n", (2210, 2228), False, 'from tomodachi import aws_sns_sqs, aws_sns_sqs_publish\n'), ((891, 921), 'os.environ.get', 'os.environ.get', (['"""SERVICE_UUID"""'], {}), "('SERVICE_UUID')\n", (905, 921), False, 'impor...
ThitsarAung/python-exercises
ex9.py
bca97875e25f9621fc5f58ab1d360426a21efc7f
types_of_people = 10 x = f"There are {types_of_people} types of people." binary = "binary" do_not = "don't" y = f"Those who know {binary} and those who {do_not}." print(x) print(y) print(f"I said: {x}") print(f"I also said: '{y}'") hilarious = False joke_evaluation = "Isn't that joke so funny?! {}" print(joke_eval...
[]
2yz/MMdnn
mmdnn/conversion/caffe/writer.py
13d909e4b591a5043b74b611e412c3c0a5eba0cc
import base64 from google.protobuf import json_format from importlib import import_module import json import numpy as np import os import sys from mmdnn.conversion.caffe.errors import ConversionError from mmdnn.conversion.caffe.common_graph import fetch_attr_value from mmdnn.conversion.caffe.utils import get_lower_cas...
[((558, 599), 'google.protobuf.json_format.MessageToJson', 'json_format.MessageToJson', (['self.graph_def'], {}), '(self.graph_def)\n', (583, 599), False, 'from google.protobuf import json_format\n'), ((617, 637), 'json.loads', 'json.loads', (['json_txt'], {}), '(json_txt)\n', (627, 637), False, 'import json\n'), ((658...
LionTao/algo_weekend
week1/85-maximal-rectangle.py
d25756761d47491b8c78ecf8a857080497910c76
""" leetcode-85 给定一个仅包含 0 和 1 , 大小为 rows x cols 的二维二进制矩阵, 找出只包含 1 的最大矩形, 并返回其面积。 """ from typing import List class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: """ 统计直方图然后单调递增栈 """ rows = len(matrix) if rows == 0: return 0 columns ...
[]
mathildebadoual/pandapower
pandapower/test/opf/test_costs_pwl.py
9ba4bcb78e84b644d2ba6df0c08e285c54af8ddc
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np import pytest from pandapower.optimal_powerflow import OPFNotConverged import pandapower as pp try: impo...
[((389, 416), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (406, 416), False, 'import logging\n'), ((660, 685), 'pandapower.create_empty_network', 'pp.create_empty_network', ([], {}), '()\n', (683, 685), True, 'import pandapower as pp\n'), ((690, 756), 'pandapower.create_bus', 'pp.creat...
guoxianru/cookie_pool_lite
cookie_refresh.py
02c4b2009b4c8aa3306ae1f5f7c5decde1eb5f3f
# -*- coding: utf-8 -*- # @Author: GXR # @CreateTime: 2022-01-20 # @UpdateTime: 2022-01-20 import redis import config import cookie_login from cookie_api import app red = redis.Redis( host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.REDIS_DB, decode_responses=True, ) # 刷新cookie数量 def cooki...
[((174, 281), 'redis.Redis', 'redis.Redis', ([], {'host': 'config.REDIS_HOST', 'port': 'config.REDIS_PORT', 'db': 'config.REDIS_DB', 'decode_responses': '(True)'}), '(host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.\n REDIS_DB, decode_responses=True)\n', (185, 281), False, 'import redis\n'), ((484, 516), '...
bitcoinfees/feemodel
feemodel/app/__init__.py
5d582d87eca6e54eb20b81f4e21c81273a59b468
from feemodel.app.transient import TransientOnline from feemodel.app.pools import PoolsOnlineEstimator from feemodel.app.predict import Prediction from feemodel.app.simonline import SimOnline __all__ = [ 'TransientOnline', 'PoolsOnlineEstimator', 'Prediction', 'SimOnline' ]
[]
ParikhKadam/django-angular
examples/server/models/image_file_upload.py
1fdd2ab3211ed1655acc2d172d826ed7f3ad0574
# -*- coding: utf-8 -*- from __future__ import unicode_literals # start tutorial from django.db import models from djng.forms import NgModelFormMixin, NgFormValidationMixin from djng.styling.bootstrap3.forms import Bootstrap3ModelForm class SubscribeUser(models.Model): full_name = models.CharField( "Full ...
[((288, 332), 'django.db.models.CharField', 'models.CharField', (['"""Full name"""'], {'max_length': '(99)'}), "('Full name', max_length=99)\n", (304, 332), False, 'from django.db import models\n'), ((364, 415), 'django.db.models.ImageField', 'models.ImageField', (['"""Avatar"""'], {'blank': '(False)', 'null': '(True)'...
yangulei/tvm
python/tvm/topi/hexagon/slice_ops/add_subtract_multiply.py
d2cbdf381b68134951bfd7525c6a3a67838e5bdf
# 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 ...
[((1274, 1300), 'tvm.topi.add', 'topi.add', (['input_a', 'input_b'], {}), '(input_a, input_b)\n', (1282, 1300), False, 'from tvm import topi\n'), ((1410, 1441), 'tvm.topi.subtract', 'topi.subtract', (['input_a', 'input_b'], {}), '(input_a, input_b)\n', (1423, 1441), False, 'from tvm import topi\n'), ((1551, 1582), 'tvm...
jrouly/dagster
python_modules/automation/automation/docker/dagster_docker.py
2b3104db2fc6439050f7825d4b9ebaf39ddf6c0c
import contextlib import os from collections import namedtuple import yaml from dagster import __version__ as current_dagster_version from dagster import check from .ecr import ecr_image, get_aws_account_id, get_aws_region from .utils import ( execute_docker_build, execute_docker_push, execute_docker_tag,...
[((634, 690), 'collections.namedtuple', 'namedtuple', (['"""_DagsterDockerImage"""', '"""image build_cm path"""'], {}), "('_DagsterDockerImage', 'image build_cm path')\n", (644, 690), False, 'from collections import namedtuple\n'), ((509, 534), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (...
Fusion-Rom/android_external_chromium_org
chrome/test/telemetry/chromeos/login_unittest.py
d8b126911c6ea9753e9f526bee5654419e1d0ebd
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import logging import os import unittest from telemetry.core import browser_finder from telemetry.core import exceptions from telemetry.core ...
[((561, 592), 'telemetry.unittest.options_for_unittests.GetCopy', 'options_for_unittests.GetCopy', ([], {}), '()\n', (590, 592), False, 'from telemetry.unittest import options_for_unittests\n'), ((609, 685), 'telemetry.core.backends.chrome.cros_interface.CrOSInterface', 'cros_interface.CrOSInterface', (['options.cros_r...
Neotrinost/Neotrinost.ir
generator/database.py
f501b8cf410c1e6ec6cc4e5fce935147b8be1e61
import sqlite3 class Database: def get_connection(self): return sqlite3.connect("./db.sqlite") def add_card(self, card_title, card_text, card_link_text, card_link_url): con = self.get_connection() cur = con.cursor() create_table_query = "CREATE TABLE IF NOT EXISTS cards('card...
[((78, 108), 'sqlite3.connect', 'sqlite3.connect', (['"""./db.sqlite"""'], {}), "('./db.sqlite')\n", (93, 108), False, 'import sqlite3\n')]
frbapolkosnik/crits
crits/backdoors/forms.py
1278c034f2238e2fe34e65e32ce241128a014df2
from django import forms from django.forms.utils import ErrorList from crits.campaigns.campaign import Campaign from crits.core.forms import add_bucketlist_to_form, add_ticket_to_form from crits.core.handlers import get_item_names, get_source_names from crits.core.user_tools import get_user_organization from crits.cor...
[((662, 725), 'django.forms.CharField', 'forms.CharField', ([], {'label': 'form_consts.Backdoor.NAME', 'required': '(True)'}), '(label=form_consts.Backdoor.NAME, required=True)\n', (677, 725), False, 'from django import forms\n'), ((740, 807), 'django.forms.CharField', 'forms.CharField', ([], {'label': 'form_consts.Bac...
fkamrani/adversarial-policies
src/aprl/agents/monte_carlo.py
53e129c2083f6557ddc18dbb39e4e633a2d7ab9b
"""Monte Carlo receding horizon control.""" from abc import ABC, abstractmethod from multiprocessing import Pipe, Process import gym from stable_baselines.common.vec_env import CloudpickleWrapper from aprl.common.mujoco import MujocoState, ResettableEnv class MujocoResettableWrapper(ResettableEnv, gym.Wrapper): ...
[((800, 831), 'gym.Wrapper.__init__', 'gym.Wrapper.__init__', (['self', 'env'], {}), '(self, env)\n', (820, 831), False, 'import gym\n'), ((1157, 1196), 'aprl.common.mujoco.MujocoState.from_flattened', 'MujocoState.from_flattened', (['x', 'self.sim'], {}), '(x, self.sim)\n', (1183, 1196), False, 'from aprl.common.mujoc...
xuwening/tensorflowDemo
machineLearnInAction/bayes.py
65687a61e16f947b7ec8a85d12213f954a71542b
import numpy as np def loadDataSet(): postingList = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], #[0,0,1,1,1......] ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ...
[((1253, 1271), 'numpy.zeros', 'np.zeros', (['numWords'], {}), '(numWords)\n', (1261, 1271), True, 'import numpy as np\n'), ((1284, 1302), 'numpy.zeros', 'np.zeros', (['numWords'], {}), '(numWords)\n', (1292, 1302), True, 'import numpy as np\n')]
segrids/arduino_due
py/debug/__init__.py
f375020b81459eae9b325aa3646ff84efc2853e8
from .swd import SWD from .ahb import AHB from .debugger import Debugger, HaltError, NotHaltedError try: from .dwarf import ELFDebugger except ImportError: pass
[]
cbdunc2/pi-kit
HAP-NodeJS/Switch3_1.py
bf7e9e118af7853d509e0a10c95ba5d8564bb157
import subprocess subprocess.Popen(['sh', '../Switches/Switch3_On.sh'])
[((18, 71), 'subprocess.Popen', 'subprocess.Popen', (["['sh', '../Switches/Switch3_On.sh']"], {}), "(['sh', '../Switches/Switch3_On.sh'])\n", (34, 71), False, 'import subprocess\n')]
Software-Natives-OSS/cicd_sim
src/cicd_sim/artifact/__init__.py
19452a5b06a6c6d99322c9b6777c501025e954f1
from . artifactory import Artifactory __all__ = ['Artifactory']
[]
Spiritdude/mandoline-py
mandoline/line_segment3d.py
702cd1f9264c7d5d814600ff919406387fd86185
class LineSegment3D(object): """A class to represent a 3D line segment.""" def __init__(self, p1, p2): """Initialize with two endpoints.""" if p1 > p2: p1, p2 = (p2, p1) self.p1 = p1 self.p2 = p2 self.count = 1 def __len__(self): """Line segment...
[]
d1hotpep/cacheable
cacheable/adapter/PeeweeAdapter.py
9ea97d6504965179f8fe495b67e466c068719445
import peewee import playhouse.kv from time import time from . import CacheableAdapter class PeeweeAdapter(CacheableAdapter, peewee.Model): key = peewee.CharField(max_length=256, unique=True) value = playhouse.kv.JSONField() mtime = peewee.IntegerField(default=time) ttl = peewee.IntegerField(default=...
[((153, 198), 'peewee.CharField', 'peewee.CharField', ([], {'max_length': '(256)', 'unique': '(True)'}), '(max_length=256, unique=True)\n', (169, 198), False, 'import peewee\n'), ((248, 281), 'peewee.IntegerField', 'peewee.IntegerField', ([], {'default': 'time'}), '(default=time)\n', (267, 281), False, 'import peewee\n...
plutoyuxie/mmgeneration
mmgen/models/architectures/arcface/helpers.py
0a7f5d16c970de1766ebf049d7a0264fe506504b
from collections import namedtuple import torch from torch.nn import (AdaptiveAvgPool2d, BatchNorm2d, Conv2d, MaxPool2d, Module, PReLU, ReLU, Sequential, Sigmoid) # yapf: disable """ ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) # isort:skip # noqa """ # ...
[((890, 944), 'collections.namedtuple', 'namedtuple', (['"""Block"""', "['in_channel', 'depth', 'stride']"], {}), "('Block', ['in_channel', 'depth', 'stride'])\n", (900, 944), False, 'from collections import namedtuple\n'), ((784, 816), 'torch.norm', 'torch.norm', (['input', '(2)', 'axis', '(True)'], {}), '(input, 2, a...
mahi0601/SpotifyPlaylist
createplaylist.py
55e30bb4c13f291693b892d6eeccc70b4a769805
import os from spotifyclient import SpotifyClient def main(): spotify_client = SpotifyClient(os.getenv("SPOTIFY_AUTHORIZATION_TOKEN"), os.getenv("SPOTIFY_USER_ID")) # get last played tracks num_tracks_to_visualise = int(input("How many tracks would you like to visualis...
[((100, 140), 'os.getenv', 'os.getenv', (['"""SPOTIFY_AUTHORIZATION_TOKEN"""'], {}), "('SPOTIFY_AUTHORIZATION_TOKEN')\n", (109, 140), False, 'import os\n'), ((177, 205), 'os.getenv', 'os.getenv', (['"""SPOTIFY_USER_ID"""'], {}), "('SPOTIFY_USER_ID')\n", (186, 205), False, 'import os\n')]
thieman/dd-trace-py
tests/contrib/flask/test_request.py
1e87c9bdf7769032982349c4ccc0e1c2e6866a16
# -*- coding: utf-8 -*- from ddtrace.compat import PY2 from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY from ddtrace.contrib.flask.patch import flask_version from ddtrace.ext import http from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID, HTTP_HEADER_PARENT_ID from flask import abort from . import BaseFl...
[((16267, 16277), 'flask.abort', 'abort', (['(404)'], {}), '(404)\n', (16272, 16277), False, 'from flask import abort\n'), ((22922, 22932), 'flask.abort', 'abort', (['(501)'], {}), '(501)\n', (22927, 22932), False, 'from flask import abort\n')]
blazejdolicki/CHEDAR
ConvDR/data/preprocess_cast19.py
e4819775e7f6ffa2d6f1ad798ee262f01370b236
import argparse from trec_car import read_data from tqdm import tqdm import pickle import os import json import copy from utils.util import NUM_FOLD def parse_sim_file(filename): """ Reads the deduplicated documents file and stores the duplicate passage ids into a dictionary """ sim_dict = {} ...
[((622, 647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (645, 647), False, 'import argparse\n'), ((1073, 1131), 'os.path.join', 'os.path.join', (['args.cast_dir', '"""evaluation_topics_v1.0.json"""'], {}), "(args.cast_dir, 'evaluation_topics_v1.0.json')\n", (1085, 1131), False, 'import os\...
brandonxiang/example-pyQGIS
coord_convert/geojson_utils.py
a61d0321d223d0b82e44bb809521965858fde857
__doc__ = 'github: https://github.com/brandonxiang/geojson-python-utils' import math from coordTransform_utils import wgs84togcj02 from coordTransform_utils import gcj02tobd09 def linestrings_intersect(line1, line2): """ To valid whether linestrings from geojson are intersected with each other. reference:...
[((7021, 7042), 'math.sin', 'math.sin', (['(deg_lat / 2)'], {}), '(deg_lat / 2)\n', (7029, 7042), False, 'import math\n'), ((7181, 7193), 'math.sqrt', 'math.sqrt', (['a'], {}), '(a)\n', (7190, 7193), False, 'import math\n'), ((7195, 7211), 'math.sqrt', 'math.sqrt', (['(1 - a)'], {}), '(1 - a)\n', (7204, 7211), False, '...
Rinku92/Mini_Project3
config.py
eab11ce3743fddda2ccc158367a37d4522ba1e39
import os ''' user = os.environ['POSTGRES_USER'] password = os.environ['POSTGRES_PASSWORD'] host = os.environ['POSTGRES_HOST'] database = os.environ['POSTGRES_DB'] port = os.environ['POSTGRES_PORT'] ''' user = 'test' password = 'password' host = 'localhost' database = 'example' port = '5432' DATABASE_CONNECTION_URI =...
[]
sercangul/HackerRank
10_days_of_statistics_8_1.py
e6d7056babe03baafee8d7f1cacdca7c28b72ded
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 3 19:26:47 2019 @author: sercangul """ n = 5 xy = [map(int, input().split()) for _ in range(n)] sx, sy, sx2, sxy = map(sum, zip(*[(x, y, x**2, x * y) for x, y in xy])) b = (n * sxy - sx * sy) / (n * sx2 - sx**2) a = (sy / n) - b * (sx / n) print('...
[]
vermouth1992/rl-util
rlutils/gym/envs/reset_obs/hopper.py
4c06ab8f5c96a44e58f88cf30146bcb837057112
import gym.envs.mujoco.hopper as hopper import numpy as np class HopperEnv(hopper.HopperEnv): def _get_obs(self): return np.concatenate([ self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat, ]) def reset_obs(self, obs): state = np.insert(obs, 0, 0.) qp...
[((135, 205), 'numpy.concatenate', 'np.concatenate', (['[self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat]'], {}), '([self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat])\n', (149, 205), True, 'import numpy as np\n'), ((288, 310), 'numpy.insert', 'np.insert', (['obs', '(0)', '(0.0)'], {}), '(obs, 0, 0.0)\n', (297...
yutian-zhao/recommenders
reco_utils/recommender/deeprec/io/iterator.py
17b9c1280a79019dd91f50b3a7e66f25cb5004b1
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import numpy as np # import tensorflow as tf import abc class BaseIterator(object): @abc.abstractmethod def parser_one_line(self, line): pass @abc.abstractmethod def load_data_from_file(self, infile...
[]
kolyasalubov/Lv-677.PythonCore
HW6/YuliiaKutsyk/3_ unfinished_loop_bug_fixing.py
c9f9107c734a61e398154a90b8a3e249276c2704
def create_array(n): res=[] i=1 while i<=n: res.append(i) i += 1 return res
[]
SDhuangao/netease-cloud-music-dl
ncm/api.py
4a970504e1fec0a9848f3920b392aa507d6b3879
# -*- coding: utf-8 -*- import requests from ncm.encrypt import encrypted_request from ncm.constants import headers from ncm.constants import song_download_url from ncm.constants import get_song_url from ncm.constants import get_album_url from ncm.constants import get_artist_url from ncm.constants import get_playlist...
[((438, 456), 'requests.session', 'requests.session', ([], {}), '()\n', (454, 456), False, 'import requests\n'), ((865, 890), 'ncm.encrypt.encrypted_request', 'encrypted_request', (['params'], {}), '(params)\n', (882, 890), False, 'from ncm.encrypt import encrypted_request\n'), ((1304, 1325), 'ncm.constants.get_song_ur...
Web-Dev-Collaborative/algos
book/trees/binary_search_tree.py
d280581d74ded382094283d931a202eb55fd8369
# -*- coding: utf-8 -*- """ The `TreeNode` class provides many helper functions that make the work done in the `BinarySearchTree` class methods much easier. The constructor for a `TreeNode`, along with these helper functions, is shown below. As you can see, many of these helper functions help to classify a node acco...
[]
adamruth/python-fire
fire/core.py
6912ccd56f50e0f4bb30a0725d95858ef29f3bde
# Copyright (C) 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[((6713, 6747), 'fire.completion.Script', 'completion.Script', (['name', 'component'], {}), '(name, component)\n', (6730, 6747), False, 'from fire import completion\n'), ((11789, 11818), 'fire.parser.SeparateFlagArgs', 'parser.SeparateFlagArgs', (['args'], {}), '(args)\n', (11812, 11818), False, 'from fire import parse...
AmirValeev/auto-ml-classifier
app.py
e803fe92d1ec71e87509845ea61ecc46b363bae6
import os, ast import pandas as pd from sklearn.svm import SVC from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEncoder from sklearn.compose import make_column_transformer from sklearn.pipeline import make_pipeline import pickle def main(): # Get the dataset from the us...
[((467, 492), 'pandas.read_csv', 'pd.read_csv', (['dataset_path'], {}), '(dataset_path)\n', (478, 492), True, 'import pandas as pd\n'), ((744, 797), 'sklearn.model_selection.train_test_split', 'train_test_split', (['x', 'y'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(x, y, test_size=0.2, random_state=0)\n', (76...
giuseppe/quay
util/headers.py
a1b7e4b51974edfe86f66788621011eef2667e6a
import base64 def parse_basic_auth(header_value): """ Attempts to parse the given header value as a Base64-encoded Basic auth header. """ if not header_value: return None parts = header_value.split(" ") if len(parts) != 2 or parts[0].lower() != "basic": return None try: ...
[((342, 368), 'base64.b64decode', 'base64.b64decode', (['parts[1]'], {}), '(parts[1])\n', (358, 368), False, 'import base64\n')]
tobiashuste/indico
indico/core/signals/event/core.py
c1e6ec0c8c84745988e38c9b1768142a6feb9e0e
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from indico.core.signals.event import _signals sidemenu = _signals.signal('sidemenu', """ Expected to re...
[((274, 475), 'indico.core.signals.event._signals.signal', '_signals.signal', (['"""sidemenu"""', '"""\nExpected to return ``MenuEntryData`` objects to be added to the event side menu.\nA single entry can be returned directly, multiple entries must be yielded.\n"""'], {}), '(\'sidemenu\',\n """\nExpected to return `...
aarunsai81/netapp
cinder/tests/unit/volume/drivers/emc/scaleio/test_delete_volume.py
8f0f7bf9be7f4d9fb9c3846bfc639c90a05f86ba
# Copyright (c) 2013 - 2015 EMC Corporation. # 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 # # Unle...
[((1268, 1323), 'cinder.context.RequestContext', 'context.RequestContext', (['"""fake"""', '"""fake"""'], {'auth_token': '(True)'}), "('fake', 'fake', auth_token=True)\n", (1290, 1323), False, 'from cinder import context\n'), ((1347, 1416), 'cinder.tests.unit.fake_volume.fake_volume_obj', 'fake_volume.fake_volume_obj',...
chrisc20042001/python-for-transportation-modeling
example-package/transportation_tutorials/__init__.py
677129daa390fcaa6e5cde45960e27d9bd6ca4bf
# -*- coding: utf-8 -*- __version__ = '1.0.2' import os import appdirs import osmnx as ox import joblib import requests from .files import load_vars, save_vars, cached, inflate_tar, download_zipfile from .data import data, list_data, problematic from .tools.view_code import show_file from . import mapping cache_dir ...
[((772, 841), 'joblib.Memory', 'joblib.Memory', (['location'], {'compress': 'compress', 'verbose': 'verbose'}), '(location, compress=compress, verbose=verbose, **kwargs)\n', (785, 841), False, 'import joblib\n'), ((668, 718), 'appdirs.user_cache_dir', 'appdirs.user_cache_dir', (['"""transportation_tutorials"""'], {}), ...
czajowaty/curry-bot
common/common.py
91bfbd884342a02c6defd057d27d5b1fcd78cb21
from requests.models import PreparedRequest def is_valid_url(url): prepared_request = PreparedRequest() try: prepared_request.prepare_url(url, None) return True except Exception as e: return False class Timestamp: # a speedrun.com style timestamp e.g. "3h 53m 233s 380ms" def...
[((92, 109), 'requests.models.PreparedRequest', 'PreparedRequest', ([], {}), '()\n', (107, 109), False, 'from requests.models import PreparedRequest\n')]
anthonyalmarza/hendrix
hendrix/test/test_ux.py
eebd2a2183cc18ec2267d96a53a70d41b1630ce6
import os import sys from . import HendrixTestCase, TEST_SETTINGS from hendrix.contrib import SettingsError from hendrix.options import options as hx_options from hendrix import ux from mock import patch class TestMain(HendrixTestCase): def setUp(self): super(TestMain, self).setUp() self.DEFAULTS...
[((323, 335), 'hendrix.options.options', 'hx_options', ([], {}), '()\n', (333, 335), True, 'from hendrix.options import options as hx_options\n'), ((495, 533), 'mock.patch', 'patch', (['"""hendrix.ux.findSettingsModule"""'], {}), "('hendrix.ux.findSettingsModule')\n", (500, 533), False, 'from mock import patch\n'), ((2...
Voxel-Fox-Ltd/Novus
discord/types/interactions.py
3e254115daf1c09455b26dc7819b73fbf5ee56e5
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, ...
[]
EVAyo/chaoxing_auto_sign
local/local_sign.py
7ae91a5e9aa4d15f57a5419ff3f5a455e151930a
# -*- coding: utf8 -*- import os import re import time import json import random import asyncio from typing import Optional, List, Dict from aiohttp import ClientSession from aiohttp.cookiejar import SimpleCookie from lxml import etree from bs4 import BeautifulSoup from config import * from message import server_chan...
[((894, 929), 'aiohttp.ClientSession', 'ClientSession', ([], {'headers': 'self.headers'}), '(headers=self.headers)\n', (907, 929), False, 'from aiohttp import ClientSession\n'), ((1227, 1243), 'json.loads', 'json.loads', (['text'], {}), '(text)\n', (1237, 1243), False, 'import json\n'), ((5391, 5418), 'bs4.BeautifulSou...
stahlberggroup/umierrorcorrect
build/scripts-3.6/fit_background_model.py
8ceabe30a87811dad467d04eb5a08d0213065946
#!python import numpy as np from numpy import inf from numpy import nan from scipy.optimize import fmin from scipy.stats import beta from scipy.special import beta as B from scipy.special import comb import argparse import sys def parseArgs(): '''Function for parsing arguments''' parser = argparse.ArgumentPars...
[((299, 544), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pipeline for analyzing barcoded amplicon sequencing data with Unique molecular identifiers (UMI)"""'}), "(description=\n 'Pi...
KevinKecc/caffe2
caffe2/python/operator_test/partition_ops_test.py
a2b6c6e2f0686358a84277df65e9489fb7d9ddb2
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[((7638, 7653), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7651, 7653), False, 'import unittest\n'), ((2004, 2082), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Partition"""', 'ins', 'outs'], {'pack_first_input': '(1 if pack else 0)'}), "('Partition', ins, outs, pack_first_input=1 if pack...
Maikor/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_fib_common_cfg.py
b86c4a7c570ae3b2c5557d098420446df5de4929
""" Cisco_IOS_XR_fib_common_cfg This module contains a collection of YANG definitions for Cisco IOS\-XR fib\-common package configuration. This module contains definitions for the following management objects\: fib\: CEF configuration Copyright (c) 2013\-2018 by Cisco Systems, Inc. All rights reserved. """ from ...
[((906, 927), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(1)', '"""list"""'], {}), "(1, 'list')\n", (916, 927), False, 'from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64\n'), ((939, 959), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(2)', '"""any"""...
dl-stuff/dl9
action/combo.py
1cbe98afc53a1de9d413797fb130946acc4b6ba4
"""Series of actions that form a combo chain""" from __future__ import annotations from typing import Optional, Sequence, TYPE_CHECKING from action import Action from core.utility import Array from core.constants import PlayerForm, SimActKind, MomentType from core.database import FromDB if TYPE_CHECKING: from ent...
[((562, 569), 'core.utility.Array', 'Array', ([], {}), '()\n', (567, 569), False, 'from core.utility import Array\n'), ((1689, 1714), 'core.database.FromDB.__init__', 'FromDB.__init__', (['self', 'id'], {}), '(self, id)\n', (1704, 1714), False, 'from core.database import FromDB\n'), ((2326, 2351), 'core.database.FromDB...
achiang/flask-unchained
flask_unchained/bundles/session/config.py
12788a6e618904a25ff2b571eb05ff1dc8f1840f
import os from datetime import timedelta from flask_unchained import BundleConfig try: from flask_unchained.bundles.sqlalchemy import db except ImportError: db = None class _DefaultFlaskConfigForSessions(BundleConfig): SESSION_COOKIE_NAME = 'session' """ The name of the session cookie. Defa...
[((1367, 1385), 'datetime.timedelta', 'timedelta', ([], {'days': '(31)'}), '(days=31)\n', (1376, 1385), False, 'from datetime import timedelta\n'), ((4029, 4040), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (4038, 4040), False, 'import os\n')]
tombh/sktime
sktime/forecasting/base/adapters/_statsmodels.py
53df0b9ed9d1fd800539165c414cc5611bcc56b3
#!/usr/bin/env python3 -u # -*- coding: utf-8 -*- __author__ = ["Markus Löning"] __all__ = ["_StatsModelsAdapter"] import numpy as np import pandas as pd from sktime.forecasting.base._base import DEFAULT_ALPHA from sktime.forecasting.base._sktime import _OptionalForecastingHorizonMixin from sktime.forecasting.base._...
[((3440, 3482), 'pandas.RangeIndex', 'pd.RangeIndex', (['y.index[0]', '(y.index[-1] + 1)'], {}), '(y.index[0], y.index[-1] + 1)\n', (3453, 3482), True, 'import pandas as pd\n'), ((3500, 3549), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['y.index', 'new_index'], {}), '(y.index, new_index)\n', ...
Dieptranivsr/Ros_Diep
melodic/lib/python2.7/dist-packages/gazebo_msgs/srv/_GetLinkProperties.py
d790e75e6f5da916701b11a2fdf3e03b6a47086b
# This Python file uses the following encoding: utf-8 """autogenerated by genpy from gazebo_msgs/GetLinkPropertiesRequest.msg. Do not edit.""" import codecs import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class GetLinkPropertiesRequest(genpy.Message): _md5sum = "7d82d6...
[((12651, 12675), 'struct.Struct', 'struct.Struct', (['"""<7dB7dB"""'], {}), "('<7dB7dB')\n", (12664, 12675), False, 'import struct\n'), ((2370, 2399), 'codecs.lookup_error', 'codecs.lookup_error', (['"""rosmsg"""'], {}), "('rosmsg')\n", (2389, 2399), False, 'import codecs\n'), ((3778, 3807), 'codecs.lookup_error', 'co...
st--/jupytext
jupytext/kernels.py
f8e8352859cc22e17b11154d0770fd946c4a430a
"""Find kernel specifications for a given language""" import os import sys from .languages import same_language from .reraise import reraise try: # I prefer not to take a dependency on jupyter_client from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec except ImportError as err: find_...
[((1903, 1922), 'jupyter_client.kernelspec.find_kernel_specs', 'find_kernel_specs', ([], {}), '()\n', (1920, 1922), False, 'from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec\n'), ((1157, 1176), 'jupyter_client.kernelspec.find_kernel_specs', 'find_kernel_specs', ([], {}), '()\n', (1174, 1176), Fal...
dhruv9vats/scipy
scipy/sparse/_matrix_io.py
48e1dd7e604df3ae57d104b407c5b7a2a6a3247d
import numpy as np import scipy.sparse __all__ = ['save_npz', 'load_npz'] # Make loading safe vs. malicious input PICKLE_KWARGS = dict(allow_pickle=False) def save_npz(file, matrix, compressed=True): """ Save a sparse matrix to a file using ``.npz`` format. Parameters ---------- file : str or file...
[((2426, 2466), 'numpy.savez_compressed', 'np.savez_compressed', (['file'], {}), '(file, **arrays_dict)\n', (2445, 2466), True, 'import numpy as np\n'), ((2485, 2514), 'numpy.savez', 'np.savez', (['file'], {}), '(file, **arrays_dict)\n', (2493, 2514), True, 'import numpy as np\n'), ((4018, 4048), 'numpy.load', 'np.load...
ed741/PathBench
src/simulator/services/resources/atlas.py
50fe138eb1f824f49fe1a862705e435a1c3ec3ae
from typing import Dict, List from simulator.services.resources.directory import Directory from simulator.services.services import Services class Atlas(Directory): def __init__(self, services: Services, name: str, parent: str, create: bool = False) -> None: super().__init__(services, name, parent, create...
[]
ulixius9/OpenMetadata
ingestion/src/metadata/great_expectations/builders/table/row_count_to_equal.py
f121698d968717f0932f685ef2a512c2a4d92438
# Copyright 2022 Collate # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software...
[((1225, 1331), 'metadata.generated.schema.tests.table.tableRowCountToEqual.TableRowCountToEqual', 'tableRowCountToEqual.TableRowCountToEqual', ([], {'value': "self.result['expectation_config']['kwargs']['value']"}), "(value=self.result[\n 'expectation_config']['kwargs']['value'])\n", (1266, 1331), False, 'from meta...
gustavovaliati/obj-det-experiments
tensorflow/bbox/jrieke-tf-parse-v2/jrieke_tf_dataset.py
e81774a18b34c22d971ad15d7ac6eb8663ac6f22
''' This code is based on https://github.com/jrieke/shape-detection/ ''' import matplotlib.pyplot as plt import matplotlib import numpy as np import tensorflow as tf import datetime class JriekeBboxDataset: def generate(self): print('Generating...') self.WIDTH = 8 self.HEIGHT = 8 ...
[((440, 476), 'numpy.zeros', 'np.zeros', (['(num_imgs, num_objects, 4)'], {}), '((num_imgs, num_objects, 4))\n', (448, 476), True, 'import numpy as np\n'), ((497, 542), 'numpy.zeros', 'np.zeros', (['(num_imgs, self.WIDTH, self.HEIGHT)'], {}), '((num_imgs, self.WIDTH, self.HEIGHT))\n', (505, 542), True, 'import numpy as...
skeevey/PyBitmessage
src/knownnodes.py
196d688b138393d1d540df3322844dfe7e7c02ba
import pickle import threading from bmconfigparser import BMConfigParser import state knownNodesLock = threading.Lock() knownNodes = {} knownNodesTrimAmount = 2000 def saveKnownNodes(dirName = None): if dirName is None: dirName = state.appdata with knownNodesLock: with open(dirName + 'knownn...
[((105, 121), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (119, 121), False, 'import threading\n'), ((360, 391), 'pickle.dump', 'pickle.dump', (['knownNodes', 'output'], {}), '(knownNodes, output)\n', (371, 391), False, 'import pickle\n'), ((1121, 1137), 'bmconfigparser.BMConfigParser', 'BMConfigParser', ([],...
whamcloud/iml-agent
chroma_agent/action_plugins/manage_node.py
fecb2468fd6edc822f3ab37ced444d98d8725730
# Copyright (c) 2018 DDN. All rights reserved. # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import os from chroma_agent.lib.shell import AgentShell from chroma_agent.log import console_log from chroma_agent.device_plugins.action_runner import CallbackAfterResp...
[((453, 481), 'chroma_agent.lib.shell.AgentShell.try_run', 'AgentShell.try_run', (["['sync']"], {}), "(['sync'])\n", (471, 481), False, 'from chroma_agent.lib.shell import AgentShell\n'), ((486, 514), 'chroma_agent.lib.shell.AgentShell.try_run', 'AgentShell.try_run', (["['sync']"], {}), "(['sync'])\n", (504, 514), Fals...
ian-r-rose/census-data-downloader
census_data_downloader/core/tables.py
f8ac9d773e6d3f52be87bf916a2e32249391f966
#! /usr/bin/env python # -*- coding: utf-8 -* """ A base class that governs how to download and process tables from a Census API table. """ import os import logging import pathlib from . import geotypes from . import decorators logger = logging.getLogger(__name__) class BaseTableConfig(object): """ Configures...
[((237, 264), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (254, 264), False, 'import logging\n'), ((400, 422), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (412, 422), False, 'import pathlib\n'), ((1474, 1510), 'os.getenv', 'os.getenv', (['"""CENSUS_API_KEY"""', ...
loujine/sgf2ebook
sgf2ebook.py
13c87056646cc6c06485b129221ab2028e67ef95
#!/usr/bin/env python3 import argparse import os from pathlib import Path import shutil import subprocess import sys from tempfile import TemporaryDirectory from uuid import uuid4 from zipfile import ZipFile import jinja2 import sente # type: ignore __version__ = (1, 0, 0) SGF_RENDER_EXECUTABLE = './sgf-render' TE...
[((1263, 1270), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (1268, 1270), False, 'from uuid import uuid4\n'), ((4822, 4861), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (4845, 4861), False, 'import argparse\n'), ((5065, 5086), 'pathlib.Path', 'Path', (['args...
bolcom/serenade-experiments-sigmod
vmis_sql_python/evaluation/metrics/popularity.py
0a4c7f19d800d1c2784ea5536abb1a628cb12f7a
class Popularity: ''' Popularity( length=20 ) Used to iteratively calculate the average overall popularity of an algorithm's recommendations. Parameters ----------- length : int Coverage@length training_df : dataframe determines how many distinct item_ids there are in the ...
[]
amberdiehl/dandeliondiary_project
dandeliondiary/household/urls.py
e9bace5bd7980def6ca763840ab5b38f1e05cd3d
from django.conf.urls import include, url from . import views urlpatterns = [ url(r'^settings$', views.household_dashboard, name='household_dashboard'), url(r'^myinfo$', views.my_info, name='my_info'), url(r'^profile$', views.household_profile, name='maintain_household'), url(r'^members$', views.househ...
[((83, 155), 'django.conf.urls.url', 'url', (['"""^settings$"""', 'views.household_dashboard'], {'name': '"""household_dashboard"""'}), "('^settings$', views.household_dashboard, name='household_dashboard')\n", (86, 155), False, 'from django.conf.urls import include, url\n'), ((162, 208), 'django.conf.urls.url', 'url',...
devinbalkind/eden
private/templates/NYC/config.py
d5a684eae537432eb2c7d954132484a4714ca8fb
# -*- coding: utf-8 -*- try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current from gluon.html import A, URL from gluon.storage import Storage from s3 import s3_fullname T = current.T settings...
[]
nitinkaveriappa/downward
experiments/issue561/v2.py
5c9a1b5111d667bb96f94da61ca2a45b1b70bb83
#! /usr/bin/env python # -*- coding: utf-8 -*- from main import main main("issue561-v1", "issue561-v2")
[((71, 105), 'main.main', 'main', (['"""issue561-v1"""', '"""issue561-v2"""'], {}), "('issue561-v1', 'issue561-v2')\n", (75, 105), False, 'from main import main\n')]
tgroth97/q2-qemistree
q2_qemistree/tests/test_fingerprint.py
289c447a6c3a29478bb84212281ef0d7ffc1387a
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2018, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
[((4200, 4206), 'unittest.main', 'main', ([], {}), '()\n', (4204, 4206), False, 'from unittest import TestCase, main\n'), ((836, 874), 'os.path.join', 'os.path.join', (['THIS_DIR', '"""data/foo/bin"""'], {}), "(THIS_DIR, 'data/foo/bin')\n", (848, 874), False, 'import os\n'), ((902, 966), 'os.path.join', 'os.path.join',...
GarimaVishvakarma/intel-chroma
chroma-manager/tests/utils/__init__.py
fdf68ed00b13643c62eb7480754d3216d9295e0b
import time import datetime import contextlib @contextlib.contextmanager def patch(obj, **attrs): "Monkey patch an object's attributes, restoring them after the block." stored = {} for name in attrs: stored[name] = getattr(obj, name) setattr(obj, name, attrs[name]) try: yield ...
[]
rackerlabs/Tempo
tempo/worker.py
60c2adaf5b592ae171987b999e0b9cc46b80c54e
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2012 Rackspace # 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/licen...
[((970, 1003), 'logging.getLogger', 'logging.getLogger', (['"""tempo.worker"""'], {}), "('tempo.worker')\n", (987, 1003), False, 'import logging\n'), ((1266, 1317), 'tempo.openstack.common.cfg.OptGroup', 'cfg.OptGroup', ([], {'name': '"""worker"""', 'title': '"""Worker options"""'}), "(name='worker', title='Worker opti...
AndyPJiang/basenji
bin/basenji_motifs.py
64e43570c8bece156b4ab926608014f489b7965e
#!/usr/bin/env python # Copyright 2017 Calico LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agr...
[((829, 850), 'matplotlib.use', 'matplotlib.use', (['"""PDF"""'], {}), "('PDF')\n", (843, 850), False, 'import matplotlib\n'), ((1670, 1689), 'optparse.OptionParser', 'OptionParser', (['usage'], {}), '(usage)\n', (1682, 1689), False, 'from optparse import OptionParser\n'), ((3270, 3290), 'h5py.File', 'h5py.File', (['da...
Joetib/jshop
apps/shop/urls.py
810ce5dcf2cf2d23b45536dd0c8806efd3b7fc91
from django.urls import path from . import views app_name = "shop" urlpatterns = [ path('', views.HomePage.as_view(), name="home-page"), path('shop/', views.ProductListView.as_view(), name="product-list"), path('shop/<int:category_pk>/', views.ProductListView.as_view(), name="product-list"), path('sho...
[((406, 449), 'django.urls.path', 'path', (['"""cart/"""', 'views.cart_view'], {'name': '"""cart"""'}), "('cart/', views.cart_view, name='cart')\n", (410, 449), False, 'from django.urls import path\n'), ((455, 550), 'django.urls.path', 'path', (['"""cart/add/<int:product_pk>/"""', 'views.add_product_to_order'], {'name'...
dfm/SurPyval
surpyval/parametric/expo_weibull.py
014fba8f1d4a0f43218a3713ce80a78191ad8be9
import autograd.numpy as np from scipy.stats import uniform from autograd import jacobian from numpy import euler_gamma from scipy.special import gamma as gamma_func from scipy.special import ndtri as z from scipy import integrate from scipy.optimize import minimize from surpyval import parametric as para from surpyva...
[((1148, 1157), 'autograd.numpy.log', 'np.log', (['x'], {}), '(x)\n', (1154, 1157), True, 'import autograd.numpy as np\n'), ((1208, 1247), 'surpyval.parametric.Gumbel.fit', 'para.Gumbel.fit', (['log_x', 'c', 'n'], {'how': '"""MLE"""'}), "(log_x, c, n, how='MLE')\n", (1223, 1247), True, 'from surpyval import parametric ...
stjordanis/datar
tests/test_base_table.py
4e2b5db026ad35918954576badef9951928c0cb1
import pytest from datar import stats from datar.base import * from datar import f from datar.datasets import warpbreaks, state_division, state_region, airquality from .conftest import assert_iterable_equal def test_table(): # https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/table z = stats...
[((315, 334), 'datar.stats.rpois', 'stats.rpois', (['(100)', '(5)'], {}), '(100, 5)\n', (326, 334), False, 'from datar import stats\n'), ((1058, 1080), 'datar.stats.quantile', 'stats.quantile', (['f.Temp'], {}), '(f.Temp)\n', (1072, 1080), False, 'from datar import stats\n'), ((2791, 2816), 'pytest.raises', 'pytest.rai...
dokai/cqlengine
cqlengine/tests/statements/test_update_statement.py
a080aff3a73351d37126b14eef606061b445aa37
from unittest import TestCase from cqlengine.statements import UpdateStatement, WhereClause, AssignmentClause from cqlengine.operators import * class UpdateStatementTests(TestCase): def test_table_rendering(self): """ tests that fields are properly added to the select statement """ us = UpdateSta...
[((311, 335), 'cqlengine.statements.UpdateStatement', 'UpdateStatement', (['"""table"""'], {}), "('table')\n", (326, 335), False, 'from cqlengine.statements import UpdateStatement, WhereClause, AssignmentClause\n'), ((534, 558), 'cqlengine.statements.UpdateStatement', 'UpdateStatement', (['"""table"""'], {}), "('table'...
Falcons-Robocup/code
packages/facilities/diagnostics/py/custom_checkbox.py
2281a8569e7f11cbd3238b7cc7341c09e2e16249
# Copyright 2020 Jan Feitsma (Falcons) # SPDX-License-Identifier: Apache-2.0 #!/usr/bin/python import matplotlib.pyplot as plt from matplotlib.patches import Rectangle class Checkbox(): def __init__(self, name, position, default=False, label=None, rsize=0.6, enabled=True): self.name = name # unique ID a...
[((601, 619), 'matplotlib.pyplot.axes', 'plt.axes', (['position'], {}), '(position)\n', (609, 619), True, 'import matplotlib.pyplot as plt\n'), ((965, 1023), 'matplotlib.patches.Rectangle', 'Rectangle', (['(0, (1.0 - rsize) / 2)', 'rsize', 'rsize'], {'fill': '(True)'}), '((0, (1.0 - rsize) / 2), rsize, rsize, fill=True...
Axonny/HexagonalHitori
generator.py
582cb50b751796c30ed273f66c8ac9fa6f3dd089
from hitori_generator import Generator from argparse import ArgumentParser def generate(n: int, output_file: str) -> None: if n < 3 or n > 8: print("It isn't valid size") exit(4) generator = Generator(n) data = generator.generate() lines = map(lambda x: ' '.join(map(str, x)), data) ...
[((217, 229), 'hitori_generator.Generator', 'Generator', (['n'], {}), '(n)\n', (226, 229), False, 'from hitori_generator import Generator\n'), ((429, 445), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (443, 445), False, 'from argparse import ArgumentParser\n')]
feliam/opaf
opaflib/xmlast.py
f9908c26af1bf28cc29f3d647dcd9f55d631d732
from lxml import etree from opaflib.filters import defilterData #Logging facility import logging,code logger = logging.getLogger("OPAFXML") class PDFXML(etree.ElementBase): ''' Base pdf-xml class. Every pdf token xml representation will have a span wich indicates where the original token layed in the file...
[]
le3t/ko-repo
course-code/imooc-tf-mnist-flask/mnist/module.py
50eb0b4cadb9db9bf608a9e5d36376f38ff5cce5
import tensorflow as tf # y=ax+b linear model def regression(x): a = tf.Variable(tf.zeros([784, 10]), name="a") b = tf.Variable(tf.zeros([10]), name="b") y = tf.nn.softmax(tf.matmul(x, a) + b) return y, [a, b] # 定义卷积模型 def convolutional(x, keep_prob): def conv2d(x, w): return tf.nn.conv...
[((745, 775), 'tensorflow.reshape', 'tf.reshape', (['x', '[-1, 28, 28, 1]'], {}), '(x, [-1, 28, 28, 1])\n', (755, 775), True, 'import tensorflow as tf\n'), ((1243, 1280), 'tensorflow.reshape', 'tf.reshape', (['h_pool2', '[-1, 7 * 7 * 64]'], {}), '(h_pool2, [-1, 7 * 7 * 64])\n', (1253, 1280), True, 'import tensorflow as...
terra-dashboard/staketaxcsv
src/sol/handle_metaplex.py
5793105488bf799c61aee64a45f44e9ae8fef397
from common.make_tx import make_swap_tx from sol.handle_simple import handle_unknown_detect_transfers def handle_metaplex(exporter, txinfo): transfers_in, transfers_out, _ = txinfo.transfers_net if len(transfers_in) == 1 and len(transfers_out) == 1: sent_amount, sent_currency, _, _ = transfers_out[0]...
[((1494, 1543), 'sol.handle_simple.handle_unknown_detect_transfers', 'handle_unknown_detect_transfers', (['exporter', 'txinfo'], {}), '(exporter, txinfo)\n', (1525, 1543), False, 'from sol.handle_simple import handle_unknown_detect_transfers\n'), ((403, 491), 'common.make_tx.make_swap_tx', 'make_swap_tx', (['txinfo', '...
lemiceterieux/dcor
dcor/independence.py
205682a71463a2c6ab8f5b8b215ec12d44f0b5a6
""" Functions for testing independence of several distributions. The functions in this module provide methods for testing if the samples generated from two random vectors are independent. """ import numpy as np import scipy.stats from . import _dcor_internals, _hypothesis from ._dcor import u_distance_correlation_sqr...
[((9268, 9292), 'numpy.sqrt', 'np.sqrt', (['(1 - bcdcor ** 2)'], {}), '(1 - bcdcor ** 2)\n', (9275, 9292), True, 'import numpy as np\n'), ((9242, 9256), 'numpy.sqrt', 'np.sqrt', (['(v - 1)'], {}), '(v - 1)\n', (9249, 9256), True, 'import numpy as np\n')]
cinemascience/cinemasc
cinemasci/cis/__init__.py
5b00a0c2e3c886f65cfbf1f59e914fc458d7068b
from . import imageview from . import cisview from . import renderer from . import convert class cis: """Composible Image Set Class The data structure to hold properties of a Composible Image Set. """ def __init__(self, filename): """ The constructor. """ self.fname = filenam...
[]
fos/fos-legacy
applications/spaghetti.py
db6047668781a0615abcebc7d55a7164f3105047
import numpy as np import nibabel as nib import os.path as op import pyglet #pyglet.options['debug_gl'] = True #pyglet.options['debug_x11'] = True #pyglet.options['debug_gl_trace'] = True #pyglet.options['debug_texture'] = True #fos modules from fos.actor.axes import Axes from fos import World, Window, WindowManager ...
[((727, 803), 'nibabel.load', 'nib.load', (["('data/subj_' + '%02d' % subject + '/MPRAGE_32/T1_flirt_out.nii.gz')"], {}), "('data/subj_' + '%02d' % subject + '/MPRAGE_32/T1_flirt_out.nii.gz')\n", (735, 803), True, 'import nibabel as nib\n'), ((1018, 1033), 'dipy.io.dpy.Dpy', 'Dpy', (['fdpyw', '"""r"""'], {}), "(fdpyw, ...
dlzdy/faceai
faceai/gender.py
4b1e41d4c394c00da51533562b76306d86493f72
#coding=utf-8 #性别识别 import cv2 from keras.models import load_model import numpy as np import chineseText img = cv2.imread("img/gather.png") face_classifier = cv2.CascadeClassifier( "d:\Python36\Lib\site-packages\opencv-master\data\haarcascades\haarcascade_frontalface_default.xml" ) gray = cv2.cvtColor(img, cv2.CO...
[((113, 141), 'cv2.imread', 'cv2.imread', (['"""img/gather.png"""'], {}), "('img/gather.png')\n", (123, 141), False, 'import cv2\n'), ((160, 299), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""d:\\\\Python36\\\\Lib\\\\site-packages\\\\opencv-master\\\\data\\\\haarcascades\\\\haarcascade_frontalface_default.xm...
mudit2103/csm_web
csm_web/scheduler/tests/utils.py
3b7fd9ca7269ad4cb57bf264cf62a620e02d3780
from django.test import TestCase from os import path from rest_framework import status from rest_framework.test import APIClient import random from scheduler.models import Profile from scheduler.factories import ( CourseFactory, SpacetimeFactory, UserFactory, ProfileFactory, SectionFactory, Att...
[((388, 402), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (399, 402), False, 'import random\n'), ((3184, 3211), 'scheduler.factories.UserFactory.create_batch', 'UserFactory.create_batch', (['n'], {}), '(n)\n', (3208, 3211), False, 'from scheduler.factories import CourseFactory, SpacetimeFactory, UserFactory, ...
tallpauley/coldtype
coldtype/beziers.py
c1811e1d3713ff9c3c804511d6cd607b1d802065
import math from fontTools.pens.recordingPen import RecordingPen, replayRecording from fontTools.misc.bezierTools import calcCubicArcLength, splitCubicAtT from coldtype.geometry import Rect, Point def raise_quadratic(start, a, b): c0 = start c1 = (c0[0] + (2/3)*(a[0] - c0[0]), c0[1] + (2/3)*(a[1] - c0[1])) ...
[((650, 678), 'fontTools.misc.bezierTools.splitCubicAtT', 'splitCubicAtT', (['a', 'b', 'c', 'd', 't'], {}), '(a, b, c, d, t)\n', (663, 678), False, 'from fontTools.misc.bezierTools import calcCubicArcLength, splitCubicAtT\n'), ((951, 981), 'fontTools.misc.bezierTools.calcCubicArcLength', 'calcCubicArcLength', (['a', 'b...
nick0lay/deep-reinforcement-learning
p1_navigation/train.py
5af4daca9850b4e12aec5d8b0dad87f1e22a1f98
""" Project for Udacity Danaodgree in Deep Reinforcement Learning This script train an agent to navigate (and collect bananas!) in a large, square world. A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. Thus, the goal of your agent is to collect a...
[((1524, 1564), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""Banana.app"""'}), "(file_name='Banana.app')\n", (1540, 1564), False, 'from unityagents import UnityEnvironment\n'), ((1829, 1905), 'dqn_agent.Agent', 'Agent', ([], {'state_size': 'state_size', 'action_size': 'action_size', 'seed'...
jac99/Egonn
models/model_factory.py
075e00368a1676df741a35f42f6f38497da9d58f
# Warsaw University of Technology from layers.eca_block import ECABasicBlock from models.minkgl import MinkHead, MinkTrunk, MinkGL from models.minkloc import MinkLoc from third_party.minkloc3d.minkloc import MinkLoc3D from misc.utils import ModelParams def model_factory(model_params: ModelParams): in_channels ...
[((1835, 1902), 'models.minkgl.MinkHead', 'MinkHead', (['global_in_levels', 'global_in_channels', 'global_map_channels'], {}), '(global_in_levels, global_in_channels, global_map_channels)\n', (1843, 1902), False, 'from models.minkgl import MinkHead, MinkTrunk, MinkGL\n'), ((2370, 2491), 'models.minkgl.MinkTrunk', 'Mink...
rabarar/phidget_docker
mdns/Phidget22Python/Phidget22/Phidget.py
ceca56c86d27f291a4300a1257c02096862335ec
import sys import ctypes from Phidget22.PhidgetSupport import PhidgetSupport from Phidget22.Async import * from Phidget22.ChannelClass import ChannelClass from Phidget22.ChannelSubclass import ChannelSubclass from Phidget22.DeviceClass import DeviceClass from Phidget22.DeviceID import DeviceID from Phidget22.ErrorEvent...
[((457, 474), 'ctypes.c_void_p', 'ctypes.c_void_p', ([], {}), '()\n', (472, 474), False, 'import ctypes\n'), ((1830, 1851), 'ctypes.c_int32', 'ctypes.c_int32', (['(65536)'], {}), '(65536)\n', (1844, 1851), False, 'import ctypes\n'), ((4772, 4793), 'ctypes.c_int32', 'ctypes.c_int32', (['flags'], {}), '(flags)\n', (4786,...
oleksiyVeretiuk/openprocurement.auctions.geb
openprocurement/auctions/geb/tests/blanks/create.py
2965b52bf8826b9a8f8870c9a4d2052f945f5799
def create_auction(self): expected_http_status = '201 Created' request_data = {"data": self.auction} entrypoint = '/auctions' response = self.app.post_json(entrypoint, request_data) self.assertEqual(response.status, expected_http_status) def create_auction_check_minNumberOfQualifiedBids(self): ...
[]
crossscreenmedia/scout_apm_python
tests/integration/test_celery.py
5cd31bf21f5acd0be0df4f40ec0bd29ec050ec01
# coding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals from contextlib import contextmanager import celery import pytest from celery.signals import setup_logging import scout_apm.celery from scout_apm.api import Config # http://docs.celeryproject.org/en/latest/userguide/te...
[((367, 461), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(celery.VERSION < (4, 0))'], {'reason': '"""pytest fixtures added in Celery 4.0"""'}), "(celery.VERSION < (4, 0), reason=\n 'pytest fixtures added in Celery 4.0')\n", (385, 461), False, 'import pytest\n'), ((1268, 1288), 'scout_apm.api.Config.set', 'Config...
mollyproject/mollyproject
molly/apps/places/migrations/0001_initial.py
3247c6bac3f39ce8d275d19aa410b30c6284b8a7
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Source' db.create_table('places_source', ( ('id', self.gf('django.db.models.fields.Aut...
[((650, 693), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""places"""', "['Source']"], {}), "('places', ['Source'])\n", (671, 693), False, 'from south.db import db\n'), ((1510, 1557), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""places"""', "['EntityType']"], {}), "('places', ['En...
polivbr/pulumi-azure-native
sdk/python/pulumi_azure_native/servicebus/v20210601preview/get_subscription.py
09571f3bf6bdc4f3621aabefd1ba6c0d4ecfb0e7
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities fro...
[((6398, 6430), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""accessedAt"""'}), "(name='accessedAt')\n", (6411, 6430), False, 'import pulumi\n'), ((6624, 6662), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""autoDeleteOnIdle"""'}), "(name='autoDeleteOnIdle')\n", (6637, 6662), False, 'import pulumi\n'), ((693...
crystalfontz/CFA-EVE-Python-Library
py_cfeve/module/CFAF240400E0-030TN-A1.py
c5aca10b9b6ee109d4df8a9a692dcef083dafc88
#=========================================================================== # # Crystalfontz Raspberry-Pi Python example library for FTDI / BridgeTek # EVE graphic accelerators. # #--------------------------------------------------------------------------- # # This file is part of the port/adaptation of existin...
[]
OneToolsCollection/HLT-ISTI-QuaPy
quapy/model_selection.py
6a5c528154c2d6d38d9f3258e667727bf692fc8b
import itertools import signal from copy import deepcopy from typing import Union, Callable import numpy as np import quapy as qp from quapy.data.base import LabelledCollection from quapy.evaluation import artificial_prevalence_prediction, natural_prevalence_prediction, gen_prevalence_prediction from quapy.method.agg...
[((9694, 9727), 'itertools.product', 'itertools.product', (['*params_values'], {}), '(*params_values)\n', (9711, 9727), False, 'import itertools\n'), ((7798, 7943), 'quapy.evaluation.artificial_prevalence_prediction', 'artificial_prevalence_prediction', (['model', 'val_split', 'self.sample_size'], {'n_prevpoints': 'sel...
ZxShane/slam_hospital
flasky.py
302704b3a188cea07dddfb23595dd75f8d3cd636
# -*- coding: utf-8 -*- import os from flask_migrate import Migrate from app import create_app, db from app.models import User, Role, PoseToLocation app = create_app(os.getenv('FLASK_CONFIG') or 'default') migrate = Migrate(app, db) # migrate 的新建 我们需要扫描到这些文件我们才能创建 @app.shell_context_processor def make_shell_conte...
[((220, 236), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (227, 236), False, 'from flask_migrate import Migrate\n'), ((170, 195), 'os.getenv', 'os.getenv', (['"""FLASK_CONFIG"""'], {}), "('FLASK_CONFIG')\n", (179, 195), False, 'import os\n'), ((505, 526), 'unittest.TestLoader', 'unittest.Tes...
aesdeef/advent-of-code-2021
python/day09/smoke_basin.py
4561bcf12ac03d360f5b28c48ef80134f97613b9
INPUT_FILE = "../../input/09.txt" Point = tuple[int, int] Heightmap = dict[Point, int] Basin = set[Point] def parse_input() -> Heightmap: """ Parses the input and returns a Heightmap """ with open(INPUT_FILE) as f: heights = [[int(x) for x in line.strip()] for line in f] heightmap: Heigh...
[]