code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from PySmartMirror.handlers.log import LogHandler
class BaseException(Exception):
"""
Base Exception class in this project
"""
def __init__(self, message=None):
super().__init__()
self.logger = LogHandler().get_logger()
if message:
self.logger.exception(message)
c... | [
"PySmartMirror.handlers.log.LogHandler"
] | [((228, 240), 'PySmartMirror.handlers.log.LogHandler', 'LogHandler', ([], {}), '()\n', (238, 240), False, 'from PySmartMirror.handlers.log import LogHandler\n')] |
import numpy as np
from skimage.morphology import skeletonize
from skan import Skeleton, summarize
import networkx as nx
import toolz as tz
def branch_classification(thres):
"""Predict the extent of branching.
Parameters
----------
thres: array
thresholded image to be analysed
scale: the ... | [
"skan.summarize",
"networkx.Graph",
"networkx.connected_components",
"numpy.sum",
"numpy.zeros",
"skan.Skeleton",
"networkx.shortest_path",
"numpy.isfinite",
"networkx.all_pairs_dijkstra_path_length",
"skimage.morphology.skeletonize"
] | [((599, 617), 'skimage.morphology.skeletonize', 'skeletonize', (['thres'], {}), '(thres)\n', (610, 617), False, 'from skimage.morphology import skeletonize\n'), ((629, 667), 'skan.Skeleton', 'Skeleton', (['skeleton'], {'source_image': 'thres'}), '(skeleton, source_image=thres)\n', (637, 667), False, 'from skan import S... |
#!/usr/bin/python
#
# Usage: packer-config my-template.yaml | packer build -
#
# Constructs a Packer JSON configuration file from the specified YAML
# template file and writes it to STDOUT.
#
# The YAML template format adds some flexibility and readability by
# adding comments and an !include directive, allowing for t... | [
"os.path.exists",
"json.dumps",
"os.path.join",
"yaml.load",
"os.path.split",
"sys.stderr.write",
"sys.exit"
] | [((2834, 2866), 'yaml.load', 'yaml.load', (['infile', 'IncludeLoader'], {}), '(infile, IncludeLoader)\n', (2843, 2866), False, 'import yaml\n'), ((3204, 3222), 'json.dumps', 'json.dumps', (['parsed'], {}), '(parsed)\n', (3214, 3222), False, 'import json\n'), ((3287, 3335), 'sys.stderr.write', 'sys.stderr.write', (['"""... |
import logging
import time
from queue import Queue
from typing import Dict, Optional, TYPE_CHECKING
from manta_lab.base.packet import RequestPacket
from .pusher import FilePusher, RecordPusher
from .thread import InternalManager, InternalManagerThread
if TYPE_CHECKING:
from threading import Event
from manta... | [
"logging.getLogger",
"time.time"
] | [((480, 507), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (497, 507), False, 'import logging\n'), ((2722, 2733), 'time.time', 'time.time', ([], {}), '()\n', (2731, 2733), False, 'import time\n'), ((3073, 3084), 'time.time', 'time.time', ([], {}), '()\n', (3082, 3084), False, 'import ti... |
"""Helper script to inject data into the built HTML file."""
import base64
import os
import sys
def add_data_to_viewer(data_path, src_html_path):
if os.path.isfile(data_path) and os.path.exists(src_html_path):
dstDir = os.path.dirname(data_path)
dstHtmlPath = os.path.join(dstDir, '%s.html' % os.pa... | [
"os.path.exists",
"base64.b64encode",
"os.path.isfile",
"os.path.dirname",
"os.path.basename"
] | [((155, 180), 'os.path.isfile', 'os.path.isfile', (['data_path'], {}), '(data_path)\n', (169, 180), False, 'import os\n'), ((185, 214), 'os.path.exists', 'os.path.exists', (['src_html_path'], {}), '(src_html_path)\n', (199, 214), False, 'import os\n'), ((233, 259), 'os.path.dirname', 'os.path.dirname', (['data_path'], ... |
# MIT License
#
# Copyright (c) 2020 <NAME>
#
# 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, publi... | [
"logging.getLogger",
"squeak.core.CResqueak.deserialize",
"squeak.core.CSqueak.deserialize",
"requests.get"
] | [((1483, 1510), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1500, 1510), False, 'import logging\n'), ((2721, 2808), 'requests.get', 'requests.get', (['url'], {'params': 'payload', 'proxies': 'self.proxies', 'timeout': 'REQUEST_TIMEOUT_S'}), '(url, params=payload, proxies=self.proxies,... |
"""Config for a linear regression model evaluated on a diabetes dataset."""
from dbispipeline.evaluators import GridEvaluator
import dbispipeline.result_handlers as result_handlers
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.dummy import DummyClassifier
from nlp4... | [
"sklearn.preprocessing.StandardScaler",
"nlp4musa2020.dataloaders.alf200k.genre_target_labels",
"nlp4musa2020.evaluators.grid_parameters_genres",
"sklearn.dummy.DummyClassifier"
] | [((669, 690), 'nlp4musa2020.dataloaders.alf200k.genre_target_labels', 'genre_target_labels', ([], {}), '()\n', (688, 690), False, 'from nlp4musa2020.dataloaders.alf200k import ALF200KLoader, genre_target_labels\n'), ((914, 949), 'nlp4musa2020.evaluators.grid_parameters_genres', 'evaluators.grid_parameters_genres', ([],... |
# -*- coding: utf-8 -*-
# Django settings for SEROL project.
import os, ast
from django.utils.crypto import get_random_string
VERSION = '0.2'
SITE_ID = 1
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
PRODUCTION = True if CURRENT_PATH.startswith('/var/www') else False
# Build paths inside the project l... | [
"os.getenv",
"os.environ.get",
"django.utils.crypto.get_random_string",
"os.path.realpath",
"os.path.abspath"
] | [((3037, 3064), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""', '""""""'], {}), "('SECRET_KEY', '')\n", (3046, 3064), False, 'import os, ast\n'), ((4488, 4524), 'os.environ.get', 'os.environ.get', (['"""EMAIL_USERNAME"""', '""""""'], {}), "('EMAIL_USERNAME', '')\n", (4502, 4524), False, 'import os, ast\n'), ((4547, 458... |
import pandas as pd
with open('Day3 input.txt') as f:
lines = f.readlines()
pos = [list(val.rstrip()) for val in lines]
df = pd.DataFrame(pos).astype(int)
gamma = ''
epsilon = ''
for c in df.columns:
print(c, df[c].mode()[0])
mode = df[c].mode()[0]
gamma += str(mode)
epsilon += '1' if mode==0 e... | [
"pandas.DataFrame"
] | [((132, 149), 'pandas.DataFrame', 'pd.DataFrame', (['pos'], {}), '(pos)\n', (144, 149), True, 'import pandas as pd\n')] |
#!/usr/bin/env python3
import argparse
import numpy as np
from matplotlib import rcParams, pyplot as plt
rcParams["svg.fonttype"] = "none"
parser = argparse.ArgumentParser()
parser.add_argument("--input", "-i", default="", help="input file", required=True)
parser.add_argument("--output", "-o", default="", help="out... | [
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.legend"
] | [((152, 177), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (175, 177), False, 'import argparse\n'), ((755, 783), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (765, 783), True, 'from matplotlib import rcParams, pyplot as plt\n'), ((2217, 2250... |
# SPDX-License-Identifier: MIT
import docker
import os
import sys
from bobber.__version__ import __version__ as version
from bobber.lib.exit_codes import (CONTAINER_NOT_RUNNING,
CONTAINER_VERSION_MISMATCH,
DOCKER_BUILD_FAILURE,
... | [
"bobber.lib.system.file_handler.update_log",
"docker.from_env",
"docker.types.Ulimit",
"sys.exit",
"os.path.abspath",
"docker.APIClient"
] | [((1265, 1282), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (1280, 1282), False, 'import docker\n'), ((1306, 1335), 'docker.APIClient', 'docker.APIClient', ([], {'timeout': '(600)'}), '(timeout=600)\n', (1322, 1335), False, 'import docker\n'), ((7085, 7110), 'os.path.abspath', 'os.path.abspath', (['__file__... |
import random as rn
import multiprocessing
import platform
import sys
import os
from pathlib import Path
import numpy as np
import pytest
if platform.system() != 'Windows':
if sys.version_info[1] >= 8:
try:
#multiprocessing.get_start_method() != 'fork'
multiprocessing.set_start_meth... | [
"quanguru.QuantumToolbox.states.basis",
"quanguru.QuantumToolbox.operators.sigmaz",
"sys.path.insert",
"numpy.sqrt",
"quanguru.QuantumToolbox.states.densityMatrix",
"os.getcwd",
"numpy.array",
"platform.system",
"quanguru.QuantumToolbox.operators.sigmam",
"quanguru.QuantumToolbox.operators.sigmax"... | [((436, 460), 'sys.path.insert', 'sys.path.insert', (['(0)', 'path'], {}), '(0, path)\n', (451, 460), False, 'import sys\n'), ((142, 159), 'platform.system', 'platform.system', ([], {}), '()\n', (157, 159), False, 'import platform\n'), ((2639, 2659), 'numpy.array', 'np.array', (['[[0], [1]]'], {}), '([[0], [1]])\n', (2... |
import datetime as _datetime
import json as _json
from ._errors import PaymentError
__all__ = ["Cheque"]
class Cheque:
"""This class acts like a real world cheque, except it can only
be used to transfer money from a regular user to a service
user's account. This allows users to pay for services. ... | [
"Acquire.ObjectStore.string_to_list",
"json.loads",
"Acquire.ObjectStore.create_uid",
"Acquire.ObjectStore.datetime_to_string",
"Acquire.Service.Service.resolve",
"Acquire.ObjectStore.decimal_to_string",
"Acquire.Identity.Authorisation.from_data",
"Acquire.ObjectStore.string_to_decimal",
"Acquire.Ob... | [((3699, 3745), 'Acquire.ObjectStore.create_uid', '_create_uid', ([], {'include_date': '(True)', 'short_uid': '(True)'}), '(include_date=True, short_uid=True)\n', (3710, 3745), True, 'from Acquire.ObjectStore import create_uid as _create_uid\n'), ((6805, 6830), 'Acquire.ObjectStore.string_to_decimal', '_string_to_decim... |
from unittest import TestCase, mock
from ...core.error import BaseError
from .. import classloader as test_module
from ..classloader import ClassLoader, ClassNotFoundError, ModuleLoadError
class TestClassLoader(TestCase):
def test_import_loaded(self):
assert ClassLoader.load_module("unittest")
def ... | [
"unittest.mock.patch.object"
] | [((358, 407), 'unittest.mock.patch.object', 'mock.patch.object', (['test_module.sys', '"""modules"""', '{}'], {}), "(test_module.sys, 'modules', {})\n", (375, 407), False, 'from unittest import TestCase, mock\n'), ((621, 670), 'unittest.mock.patch.object', 'mock.patch.object', (['test_module.sys', '"""modules"""', '{}'... |
import gym
from gym.spaces import Discrete, Box
import numpy as np
class MemoryGame(gym.Env):
'''An instance of the memory game with noisy observations'''
def __init__(self, config={}):
self._length = config.get("length", 5)
self._num_cues =config.get("num_cues", 2)
self._noise = confi... | [
"numpy.random.randint",
"gym.spaces.Box",
"gym.spaces.Discrete",
"numpy.random.uniform"
] | [((696, 720), 'gym.spaces.Discrete', 'Discrete', (['self._num_cues'], {}), '(self._num_cues)\n', (704, 720), False, 'from gym.spaces import Discrete, Box\n'), ((825, 888), 'numpy.random.uniform', 'np.random.uniform', (['(0)', 'self._noise', 'self.observation_space.shape'], {}), '(0, self._noise, self.observation_space.... |
import datetime
import re
from zoneinfo import ZoneInfo
def convert_to_utc(dtime: datetime.time, tz: str) -> datetime.time:
"""Converts the time from a given timezone to the UTC time.
We have to use this since timed tasks for some reason do not work with tzinfo.
I don't know why since the docs say it shou... | [
"zoneinfo.ZoneInfo",
"re.compile"
] | [((1464, 1779), 're.compile', 're.compile', (['"""(\\\\s?)(?:(?P<days>[0-9]{1,5})(\\\\s?)(?:days?|d))?(\\\\s?(,|and)?)(\\\\s?)(?:(?P<hours>[0-9]{1,5})(\\\\s?)(?:hours?|hrs?|h))?(\\\\s?(,|and)?)(\\\\s?)(?:(?P<minutes>[0-9]{1,5})(\\\\s?)(?:minutes?|mins?|m))?(\\\\s?(,|and)?)(\\\\s?)(?:(?P<seconds>[0-9]{1,5})(\\\\s?)(?:se... |
import pytest
import fotofriend
import urllib.request
import os
class TestLibrary:
def test_login(self):
links = fotofriend.login("fotofriendtest")
assert links == { 'Links': ['https://s3-us-west-2.amazonaws.com/foto-friend/5a1848632bc46432713be66d/dog.jpg'] }
@pytest.mark.dependency()
def... | [
"fotofriend.deleteImage",
"pytest.mark.dependency",
"fotofriend.uploadImage",
"fotofriend.filter",
"fotofriend.login",
"os.remove"
] | [((288, 312), 'pytest.mark.dependency', 'pytest.mark.dependency', ([], {}), '()\n', (310, 312), False, 'import pytest\n'), ((670, 717), 'pytest.mark.dependency', 'pytest.mark.dependency', ([], {'depends': "['test_upload']"}), "(depends=['test_upload'])\n", (692, 717), False, 'import pytest\n'), ((126, 160), 'fotofriend... |
import torch
from model import Trainer
from batch_gen import BatchGenerator
import os
import argparse
import random
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
parser = argparse.ArgumentParser()
parser.add_argument('--action', default='train')
parser.add_argument('--dataset', default="gtea"... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"batch_gen.BatchGenerator",
"random.seed",
"torch.cuda.is_available",
"model.Trainer"
] | [((198, 223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (221, 223), False, 'import argparse\n'), ((675, 692), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (686, 692), False, 'import random\n'), ((693, 716), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', ... |
from utils import copy_vocab
import run_setting
from train import train_lm, train_cls, get_model_name
from nltk import ToktokTokenizer as ToktokTokenizer_
from fastai.text.data import NumericalizeProcessor, TextList, ItemLists, TokenizeProcessor
from fastai.basic_data import DatasetType
from fastai.text.transform... | [
"run_setting.update",
"pandas.read_csv",
"nltk.ToktokTokenizer",
"numpy.array",
"fastai.text.data.TextList.from_df",
"train.train_cls",
"numpy.mean",
"argparse.ArgumentParser",
"pathlib.Path",
"train.train_lm",
"fastai.text.transform.Tokenizer",
"train.get_model_name",
"fastai.text.data.Toke... | [((559, 583), 'pathlib.Path', 'Path', (['"""../data/text_cls"""'], {}), "('../data/text_cls')\n", (563, 583), False, 'from pathlib import Path\n'), ((1272, 1346), 'fastai.text.data.TokenizeProcessor', 'TokenizeProcessor', ([], {'tokenizer': 'tokenizer', 'chunksize': '(10000)', 'mark_fields': '(False)'}), '(tokenizer=to... |
# .mtr-table
import pandas as pd
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
# Since Kali uses different default Firefox version, we need to link it's binary file.
binary = FirefoxBinary("/usr/bin/firefox-esr")
browser = webdriver.Firefox(firefox_binary=binary)
b... | [
"pandas.DataFrame",
"selenium.webdriver.Firefox",
"selenium.webdriver.firefox.firefox_binary.FirefoxBinary"
] | [((229, 266), 'selenium.webdriver.firefox.firefox_binary.FirefoxBinary', 'FirefoxBinary', (['"""/usr/bin/firefox-esr"""'], {}), "('/usr/bin/firefox-esr')\n", (242, 266), False, 'from selenium.webdriver.firefox.firefox_binary import FirefoxBinary\n'), ((277, 317), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], ... |
from datetime import datetime
from . import schemas
from flask import Flask, request, jsonify
import requests
QALERT_TEST_DATA_URL = "https://qalert-data.s3.us-east-2.amazonaws.com/requests_get.json"
app = Flask(__name__)
@app.route('/api/requests/get')
def requests_get_handler():
params = schemas.GetReques... | [
"flask.jsonify",
"datetime.datetime.strptime",
"requests.get",
"flask.Flask"
] | [((212, 227), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (217, 227), False, 'from flask import Flask, request, jsonify\n'), ((1122, 1160), 'requests.get', 'requests.get', ([], {'url': 'QALERT_TEST_DATA_URL'}), '(url=QALERT_TEST_DATA_URL)\n', (1134, 1160), False, 'import requests\n'), ((1046, 1070), 'fl... |
from tensorflow import keras as k
from tensorflow.keras import layers, models
import numpy as np
from tensorflow.python.keras.models import Model
class MockModel:
@classmethod
def get_model(cls) -> Model:
# Create a fake model. Basically, we simulate a text classifier where we have 3 words which are ... | [
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.losses.BinaryCrossentropy",
"numpy.array",
"tensorflow.keras.layers.GlobalMaxPool1D"
] | [((835, 894), 'tensorflow.keras.layers.Embedding', 'layers.Embedding', ([], {'input_dim': '(4)', 'output_dim': '(3)', 'input_length': '(3)'}), '(input_dim=4, output_dim=3, input_length=3)\n', (851, 894), False, 'from tensorflow.keras import layers, models\n'), ((908, 932), 'tensorflow.keras.layers.GlobalMaxPool1D', 'la... |
from zdppy_mysql import Mysql
m = Mysql(db="test")
# 查询“95031”班的学生人数。
sql = """
select count(*)
from student
where student.CLASS = '95031';
"""
m.log.info(m.fetchone(sql))
| [
"zdppy_mysql.Mysql"
] | [((35, 51), 'zdppy_mysql.Mysql', 'Mysql', ([], {'db': '"""test"""'}), "(db='test')\n", (40, 51), False, 'from zdppy_mysql import Mysql\n')] |
import pandas as pd
import talib
df= pd.read_csv('data/train/EURUSD_H1_2010-2019_train.csv')
close = df['close'].astype('float')
volume = df['volume'].astype('float')
obv = talib.MA(close, volume)
print(obv) | [
"talib.MA",
"pandas.read_csv"
] | [((41, 96), 'pandas.read_csv', 'pd.read_csv', (['"""data/train/EURUSD_H1_2010-2019_train.csv"""'], {}), "('data/train/EURUSD_H1_2010-2019_train.csv')\n", (52, 96), True, 'import pandas as pd\n'), ((182, 205), 'talib.MA', 'talib.MA', (['close', 'volume'], {}), '(close, volume)\n', (190, 205), False, 'import talib\n')] |
################################################################################
# Module: setup_aggr.py
# Description: this module contains functions to set up within and across city indicators
################################################################################
import json
import os
import time
import p... | [
"pandas.concat",
"geopandas.read_file",
"setup_config.hex_fieldNames.values"
] | [((1392, 1442), 'geopandas.read_file', 'gpd.read_file', (['gpkg_input'], {'layer': 'layer_samplepoint'}), '(gpkg_input, layer=layer_samplepoint)\n', (1405, 1442), True, 'import geopandas as gpd\n'), ((1457, 1499), 'geopandas.read_file', 'gpd.read_file', (['gpkg_input'], {'layer': 'layer_hex'}), '(gpkg_input, layer=laye... |
from django.core.management.base import BaseCommand
from cms.serializers import get_slug_page_serializer
from cms.models import SlugPage
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('pages', nargs='*')
def handle(self, *args, **options):
pages = options['p... | [
"cms.models.SlugPage.objects.all",
"cms.models.SlugPage.objects.filter",
"cms.serializers.get_slug_page_serializer"
] | [((348, 387), 'cms.models.SlugPage.objects.filter', 'SlugPage.objects.filter', ([], {'slug__in': 'pages'}), '(slug__in=pages)\n', (371, 387), False, 'from cms.models import SlugPage\n'), ((402, 424), 'cms.models.SlugPage.objects.all', 'SlugPage.objects.all', ([], {}), '()\n', (422, 424), False, 'from cms.models import ... |
import pandas as pd
import os
import urllib.request
def download_project_maslow_files():
"""The purpose of this function is to handle getting the nonprofit.txt and nonprofit_text.txt
files. This functin will create a data directory, add a .gitignore file so
source control does not pick up the txt files, ... | [
"os.path.isfile",
"pandas.read_csv"
] | [((1659, 1718), 'pandas.read_csv', 'pd.read_csv', (['"""data/nonprofit.txt"""'], {'sep': '"""|"""', 'dtype': 'col_types'}), "('data/nonprofit.txt', sep='|', dtype=col_types)\n", (1670, 1718), True, 'import pandas as pd\n'), ((2282, 2370), 'pandas.read_csv', 'pd.read_csv', (['"""data/nonprofit_text.txt"""'], {'sep': '""... |
from threading import Thread
def makeThread(function, arguments):
thread = Thread(target = function, args = arguments)
thread.start()
return thread
def joinThreads(threads):
for thread in threads:
thread.join()
| [
"threading.Thread"
] | [((80, 119), 'threading.Thread', 'Thread', ([], {'target': 'function', 'args': 'arguments'}), '(target=function, args=arguments)\n', (86, 119), False, 'from threading import Thread\n')] |
# 飞船类
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
super(Ship, self).__init__()
''' 初始化飞船并设置其初始位置 '''
self.screen = screen
# 设置飞船参数
self.ai_setings = ai_settings
# 移动标识
self.move_right = False
... | [
"pygame.image.load"
] | [((1686, 1722), 'pygame.image.load', 'pygame.image.load', (['"""images/ship.bmp"""'], {}), "('images/ship.bmp')\n", (1703, 1722), False, 'import pygame\n')] |
import json
import re
import shlex
import asyncio
import html
from nbsubmit import cluster
from notebook.base.handlers import IPythonHandler
from tornado.web import MissingArgumentError
comet = cluster.get("comet")
comet.mount()
class ShellExecutionHandler(IPythonHandler):
async def run_command(self, command=Non... | [
"nbsubmit.cluster.get",
"re.compile",
"shlex.split",
"json.dumps",
"asyncio.create_subprocess_exec",
"tornado.web.MissingArgumentError",
"html.escape"
] | [((196, 216), 'nbsubmit.cluster.get', 'cluster.get', (['"""comet"""'], {}), "('comet')\n", (207, 216), False, 'from nbsubmit import cluster\n'), ((1206, 1328), 'asyncio.create_subprocess_exec', 'asyncio.create_subprocess_exec', (['*commands'], {'stdout': 'asyncio.subprocess.PIPE', 'stderr': 'asyncio.subprocess.PIPE', '... |
import bitcoin
import os
from requests import get, put, post, Response
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from bitcoin.core.key import CECKey
from bitcoin.wallet import P2PKHBitcoinAddress
from bitcoin.core import CMutableTransaction, CMutableTxIn
from keyserver_pb2 import *
from payme... | [
"bitcoin.wallet.P2PKHBitcoinAddress.from_pubkey",
"hashlib.sha256",
"os.urandom",
"bitcoin.SelectParams",
"bitcoinrpc.authproxy.AuthServiceProxy",
"bitcoin.core.key.CECKey",
"time.time",
"decimal.Decimal"
] | [((3269, 3283), 'os.urandom', 'os.urandom', (['(16)'], {}), '(16)\n', (3279, 3283), False, 'import os\n'), ((3298, 3306), 'bitcoin.core.key.CECKey', 'CECKey', ([], {}), '()\n', (3304, 3306), False, 'from bitcoin.core.key import CECKey\n'), ((521, 531), 'decimal.Decimal', 'Decimal', (['(1)'], {}), '(1)\n', (528, 531), F... |
# -*- coding: utf-8 -*-
from collections import defaultdict
import mock
from searx.engines import mediawiki
from searx.testing import SearxTestCase
class TestMediawikiEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dicto = defaultdict(dict)
dicto['pageno'] = 1
... | [
"mock.Mock",
"collections.defaultdict",
"searx.engines.mediawiki.request",
"searx.engines.mediawiki.response"
] | [((266, 283), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (277, 283), False, 'from collections import defaultdict\n'), ((365, 396), 'searx.engines.mediawiki.request', 'mediawiki.request', (['query', 'dicto'], {}), '(query, dicto)\n', (382, 396), False, 'from searx.engines import mediawiki\n'),... |
import xgboost as xgb
from xgboost.dask import DaskDMatrix
from dask.distributed import Client
from dask.distributed import LocalCluster
from dask import array as da
def main(client):
# generate some random data for demonstration
m = 100000
n = 100
X = da.random.random(size=(m, n), chunks=100)
y =... | [
"xgboost.dask.train",
"dask.distributed.LocalCluster",
"xgboost.dask.DaskDMatrix",
"xgboost.dask.predict",
"dask.distributed.Client",
"dask.array.random.random"
] | [((271, 312), 'dask.array.random.random', 'da.random.random', ([], {'size': '(m, n)', 'chunks': '(100)'}), '(size=(m, n), chunks=100)\n', (287, 312), True, 'from dask import array as da\n'), ((321, 360), 'dask.array.random.random', 'da.random.random', ([], {'size': '(m,)', 'chunks': '(100)'}), '(size=(m,), chunks=100)\... |
# Function names are self explanatory
import math
def is_prime(N):
if N < 2:
return False
for i in range(2, math.floor(math.sqrt(N)) + 1):
if N % i == 0:
return False
return True
def evaluate_function(a, b, n):
return (n*n) + (a*n) + b
def get_how_many_conecutive_prime... | [
"math.sqrt"
] | [((138, 150), 'math.sqrt', 'math.sqrt', (['N'], {}), '(N)\n', (147, 150), False, 'import math\n')] |
import datetime
import os
import traceback
from queue import Empty
import deepdish as dd
import qdarkstyle
import logging
from PyQt5.QtCore import QObject
from PyQt5.QtWidgets import QMessageBox
from stytra.calibration import CrossCalibrator
from stytra.collectors import DataCollector
from stytra.stimulation import P... | [
"logging.getLogger",
"stytra.calibration.CrossCalibrator",
"os.makedirs",
"stytra.collectors.DataCollector",
"PyQt5.QtWidgets.QMessageBox",
"stytra.metadata.AnimalMetadata",
"traceback.print_tb",
"qdarkstyle.load_stylesheet_pyqt5",
"datetime.datetime.now",
"os.path.isdir",
"stytra.gui.container_... | [((3210, 3229), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (3227, 3229), False, 'import logging\n'), ((4244, 4304), 'stytra.stimulation.ProtocolRunner', 'ProtocolRunner', ([], {'experiment': 'self', 'protocol': 'self.last_protocol'}), '(experiment=self, protocol=self.last_protocol)\n', (4258, 4304), Fa... |
from collections import defaultdict, OrderedDict
from distutils.version import LooseVersion
from django.db.models import Count
import sal.plugin
# This table is also used for sequnecing output, so use OrderedDict.
OS_TABLE = OrderedDict(Darwin='macOS', Windows='Windows', Linux='Linux', ChromeOS='Chrome OS')
class... | [
"django.db.models.Count",
"distutils.version.LooseVersion",
"collections.OrderedDict",
"collections.defaultdict"
] | [((229, 317), 'collections.OrderedDict', 'OrderedDict', ([], {'Darwin': '"""macOS"""', 'Windows': '"""Windows"""', 'Linux': '"""Linux"""', 'ChromeOS': '"""Chrome OS"""'}), "(Darwin='macOS', Windows='Windows', Linux='Linux', ChromeOS=\n 'Chrome OS')\n", (240, 317), False, 'from collections import defaultdict, Ordered... |
"""
The custom component for local network access to Midea appliances
"""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
from typing import Any, cast, final
from homeassistant import config_entries
from homeassistant.components.network import async_get_ipv4_broadcast_... | [
"logging.getLogger",
"midea_beautiful.appliance_state",
"midea_beautiful.find_appliances",
"midea_beautiful.appliance.AirConditionerAppliance.supported",
"midea_beautiful.appliance.DehumidifierAppliance.supported",
"homeassistant.helpers.debounce.Debouncer",
"homeassistant.helpers.event.async_track_time... | [((1819, 1846), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1836, 1846), False, 'import logging\n'), ((1870, 1891), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(15)'}), '(minutes=15)\n', (1879, 1891), False, 'from datetime import timedelta\n'), ((4834, 4903), 'homeassistant.h... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... | [
"polyaxon.connections.reader.get_connection_schema_env_name",
"polyaxon.k8s.k8s_schemas.V1SecretKeySelector",
"polyaxon.k8s.k8s_schemas.V1EnvVar",
"polyaxon.k8s.k8s_schemas.V1EnvFromSource",
"json.dumps",
"polyaxon.k8s.k8s_schemas.V1ObjectFieldSelector",
"polyaxon.k8s.k8s_schemas.V1ConfigMapKeySelector"... | [((2025, 2069), 'polyaxon.k8s.k8s_schemas.V1EnvVar', 'k8s_schemas.V1EnvVar', ([], {'name': 'name', 'value': 'value'}), '(name=name, value=value)\n', (2045, 2069), False, 'from polyaxon.k8s import k8s_schemas\n'), ((2679, 2702), 'polyaxon.polypod.common.accelerators.requests_gpu', 'requests_gpu', (['resources'], {}), '(... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Author : <NAME>
@Contact : <EMAIL>
@File : kl_loss.py
@Time : 7/23/19 4:02 PM
@Desc :
@License : This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
"""
import torch... | [
"datasets.target_generation.generate_edge_tensor",
"torch.argmax"
] | [((667, 695), 'torch.argmax', 'torch.argmax', (['parsing'], {'dim': '(1)'}), '(parsing, dim=1)\n', (679, 695), False, 'import torch\n'), ((785, 818), 'datasets.target_generation.generate_edge_tensor', 'generate_edge_tensor', (['parsing_pre'], {}), '(parsing_pre)\n', (805, 818), False, 'from datasets.target_generation i... |
#!/usr/bin/python
import sys
#
## the mock-0.3.1 dir contains testcase.py, testutils.py & mock.py
#sys.path.append('/home/mcnowinski/.local/lib/python2.7/')
import astropy
from astropy.io import fits
from astropy import wcs
from astropy.io.fits import getheader
import astropy.coordinates as coord
import astropy.unit... | [
"astropy.test"
] | [((328, 342), 'astropy.test', 'astropy.test', ([], {}), '()\n', (340, 342), False, 'import astropy\n')] |
"""String-based code generation utilities."""
import re
import cypy
## Code generator
class CG(object):
"""Provides a simple, flexible code generator."""
@cypy.autoinit
def __init__(self, processor=None,
code_builder=cypy.new[list],
convert=str,
... | [
"cypy.attr_lookup",
"cypy.fn_minimum_argcount",
"cypy.is_callable",
"re.compile",
"cypy.re_nonend_newline.sub",
"cypy.include",
"cypy.lazy",
"cypy.remove_once",
"cypy.is_iterable"
] | [((12965, 12985), 're.compile', 're.compile', (['"""(\\\\W+)"""'], {}), "('(\\\\W+)')\n", (12975, 12985), False, 'import re\n'), ((20781, 20800), 'cypy.lazy', 'cypy.lazy', (['property'], {}), '(property)\n', (20790, 20800), False, 'import cypy\n'), ((8039, 8069), 'cypy.fn_minimum_argcount', 'cypy.fn_minimum_argcount', ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
packages = find_packages()
packages.append('asdf.schemas')
packages.append('asdf.reference_files')
package_dir = {
'asdf.schemas': 'asdf-standard/schemas',
'asdf.reference_files': 'asdf-standard/reference_files',
}
package_data = {
'asdf.... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((79, 94), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (92, 94), False, 'from setuptools import setup, find_packages\n'), ((546, 648), 'setuptools.setup', 'setup', ([], {'use_scm_version': '(True)', 'packages': 'packages', 'package_dir': 'package_dir', 'package_data': 'package_data'}), '(use_scm_ver... |
# coding=utf-8
from honeybee.model import Model
from honeybee.room import Room
from honeybee.face import Face
from honeybee.shade import Shade
from honeybee.aperture import Aperture
from honeybee.door import Door
from honeybee.boundarycondition import boundary_conditions
from honeybee.facetype import face_types, Floor,... | [
"honeybee.room.Room.solve_adjacency",
"honeybee_energy.construction.window.WindowConstruction",
"honeybee.room.Room.from_box",
"honeybee.model.Model",
"honeybee_radiance.modifier.material.Plastic.from_single_reflectance",
"honeybee_energy.constructionset.ConstructionSet",
"honeybee_radiance.modifier.mat... | [((20748, 20792), 'os.path.join', 'os.path.join', (['master_dir', '"""samples"""', '"""model"""'], {}), "(master_dir, 'samples', 'model')\n", (20760, 20792), False, 'import os\n'), ((1645, 1689), 'honeybee.room.Room.from_box', 'Room.from_box', (['"""Tiny_House_Office"""', '(5)', '(10)', '(3)'], {}), "('Tiny_House_Offic... |
#!/usr/bin/env python
from multiprocessing import Process
import signal, os
from icecube import icetray, dataio
from I3Tray import I3Tray
def hangy():
icetray.logging.set_level_for_unit('I3Module', 'TRACE')
tray = I3Tray()
tray.Add("I3InfiniteSource")
tray.Add("TrashCan")
tray.Execute(1)
if __name__ == "__main_... | [
"multiprocessing.Process",
"os.kill",
"I3Tray.I3Tray",
"icecube.icetray.logging.set_level_for_unit"
] | [((154, 209), 'icecube.icetray.logging.set_level_for_unit', 'icetray.logging.set_level_for_unit', (['"""I3Module"""', '"""TRACE"""'], {}), "('I3Module', 'TRACE')\n", (188, 209), False, 'from icecube import icetray, dataio\n'), ((218, 226), 'I3Tray.I3Tray', 'I3Tray', ([], {}), '()\n', (224, 226), False, 'from I3Tray imp... |
from recon.core.module import BaseModule
import xml.etree.ElementTree as ET
import subprocess
import tempfile
import shlex
class Module(BaseModule):
meta = {
'name': 'Network Mapper (Nmap)',
'author': '<NAME>',
'description': 'Uses the network mapper (nmap) to probe known hosts on... | [
"shlex.split",
"tempfile.gettempdir",
"xml.etree.ElementTree.parse"
] | [((1088, 1099), 'xml.etree.ElementTree.parse', 'ET.parse', (['f'], {}), '(f)\n', (1096, 1099), True, 'import xml.etree.ElementTree as ET\n'), ((1677, 1704), 'shlex.split', 'shlex.split', (["('sudo rm ' + f)"], {}), "('sudo rm ' + f)\n", (1688, 1704), False, 'import shlex\n'), ((2293, 2309), 'shlex.split', 'shlex.split'... |
from django.conf.urls import include, patterns, url
from django.db.transaction import non_atomic_requests
from olympia.addons.urls import ADDON_ID
from olympia.legacy_api import views
# Wrap class views in a lambda call so we get an fresh instance of the class
# for thread-safety.
@non_atomic_requests
def api_view(c... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((1904, 1960), 'django.conf.urls.url', 'url', (['"""^((?:addon|search|list)/.*)$"""', 'views.redirect_view'], {}), "('^((?:addon|search|list)/.*)$', views.redirect_view)\n", (1907, 1960), False, 'from django.conf.urls import include, patterns, url\n'), ((1984, 2041), 'django.conf.urls.url', 'url', (['"""^1.5/search_su... |
import nltk, pprint, re
import json
from nltk import word_tokenize
from urllib import request
from nltk.corpus import PlaintextCorpusReader
from nltk.corpus import stopwords
raw = open('docs\stoker-dracula.txt').read()
words = nltk.wordpunct_tokenize(raw)
sentences = nltk.sent_tokenize(raw)
paragraphs = str.split(raw... | [
"nltk.corpus.stopwords.words",
"nltk.word_tokenize",
"nltk.wordpunct_tokenize",
"nltk.FreqDist",
"nltk.PorterStemmer",
"nltk.sent_tokenize",
"re.sub",
"json.dump"
] | [((229, 257), 'nltk.wordpunct_tokenize', 'nltk.wordpunct_tokenize', (['raw'], {}), '(raw)\n', (252, 257), False, 'import nltk, pprint, re\n'), ((270, 293), 'nltk.sent_tokenize', 'nltk.sent_tokenize', (['raw'], {}), '(raw)\n', (288, 293), False, 'import nltk, pprint, re\n'), ((439, 471), 'nltk.word_tokenize', 'nltk.word... |
from setuptools import setup, find_packages
version = '0.2.3'
desc = '''\
FinancialFundamentals
=========================
:Author: <NAME>
:Version: $Revision: {}
:Copyright: <NAME>
:License: Apache Version 2
FinancialFundamentals caches financial data to speed alogirithm development. It is developed with the ziplin... | [
"setuptools.find_packages"
] | [((853, 868), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (866, 868), False, 'from setuptools import setup, find_packages\n')] |
import os
import requests
import re
import zipfile
import datetime
import shutil
from sqlalchemy import text
def create_directory(directory, delete_first=False):
try:
if(delete_first):
remove_directory(directory)
if not os.path.isdir(directory):
os.makedirs(directory)
... | [
"os.path.exists",
"os.listdir",
"sqlalchemy.text.upper",
"sqlalchemy.text",
"os.makedirs",
"zipfile.ZipFile",
"os.rename",
"requests.get",
"datetime.datetime.now",
"os.path.isdir",
"shutil.rmtree",
"re.findall"
] | [((645, 662), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (657, 662), False, 'import requests\n'), ((448, 472), 'os.path.isdir', 'os.path.isdir', (['directory'], {}), '(directory)\n', (461, 472), False, 'import os\n'), ((1438, 1469), 'zipfile.ZipFile', 'zipfile.ZipFile', (['from_path', '"""r"""'], {}), "(... |
#!/usr/bin/env python
import sys
# https://github.com/Callidon/pyHDT
import hdt
import numpy as np
from tqdm import tqdm
def generate_stats(doc):
n_edges = len(doc)
n_vertices = 0
# create integer mapping
vertices = set()
triples, c = doc.search_triples('', '', '')
for s, p, o in tqdm(triple... | [
"numpy.mean",
"tqdm.tqdm",
"hdt.HDTDocument",
"numpy.max",
"numpy.zeros",
"numpy.min"
] | [((309, 331), 'tqdm.tqdm', 'tqdm', (['triples'], {'total': 'c'}), '(triples, total=c)\n', (313, 331), False, 'from tqdm import tqdm\n'), ((524, 560), 'numpy.zeros', 'np.zeros', (['(n_vertices, 3)'], {'dtype': 'int'}), '((n_vertices, 3), dtype=int)\n', (532, 560), True, 'import numpy as np\n'), ((628, 650), 'tqdm.tqdm',... |
import pytest
import torch
from torch_geometric.data import Batch
from src.models.model import GCN
@pytest.fixture
def model():
return GCN(2, 2)
class TestGCN:
def test_model_structure(self, model):
assert model.conv_layers[0].in_channels == 2
assert model.conv_layers[0].out_channels == 64
... | [
"src.models.model.GCN",
"pytest.raises",
"torch_geometric.data.Batch",
"torch.Size",
"torch.zeros"
] | [((142, 151), 'src.models.model.GCN', 'GCN', (['(2)', '(2)'], {}), '(2, 2)\n', (145, 151), False, 'from src.models.model import GCN\n'), ((686, 705), 'torch.zeros', 'torch.zeros', (['[1, 2]'], {}), '([1, 2])\n', (697, 705), False, 'import torch\n'), ((727, 764), 'torch.zeros', 'torch.zeros', (['[2, 2]'], {'dtype': 'tor... |
import io
import json
import os
import codecs
import shutil
import pandas as pd
import boto3
import brightics.common.json as data_json
from brightics.common.datasource import DbEngine
from brightics.common.validation import raise_runtime_error
from brightics.brightics_data_api import _write_dataframe
import brightics... | [
"os.path.exists",
"brightics.common.validation.raise_runtime_error",
"boto3.client",
"brightics.common.datasource.DbEngine",
"os.makedirs",
"brightics.common.data.utils.make_data_path_from_key",
"codecs.getwriter",
"brightics.brightics_data_api._write_dataframe",
"os.path.dirname",
"os.path.isdir"... | [((398, 449), 'brightics.common.data.utils.make_data_path_from_key', 'data_utils.make_data_path_from_key', (['partial_path[0]'], {}), '(partial_path[0])\n', (432, 449), True, 'import brightics.common.data.utils as data_utils\n'), ((457, 476), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (470, 476), Fal... |
#!/usr/bin/env python3
# Copyright (c) 2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from decimal import (
Decimal,
)
from test_framework.util import (
Matcher,
assert_matches,
)
from test_... | [
"test_framework.util.Matcher.hexstr",
"test_framework.util.Matcher.many",
"test_framework.util.Matcher.match"
] | [((883, 901), 'test_framework.util.Matcher.hexstr', 'Matcher.hexstr', (['(64)'], {}), '(64)\n', (897, 901), False, 'from test_framework.util import Matcher, assert_matches\n'), ((972, 990), 'test_framework.util.Matcher.hexstr', 'Matcher.hexstr', (['(64)'], {}), '(64)\n', (986, 990), False, 'from test_framework.util imp... |
import time
import sys
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.protocol import TCompactProtocol
from thrift.protocol import TJSONProtocol
from src.main.py.gen_py.transfer import Transfer
class DataG... | [
"thrift.protocol.TBinaryProtocol.TBinaryProtocol",
"thrift.transport.TTransport.TBufferedTransport",
"thrift.protocol.TCompactProtocol.TCompactProtocol",
"src.main.py.gen_py.transfer.Transfer.Client",
"time.time",
"thrift.transport.TSocket.TSocket",
"thrift.protocol.TJSONProtocol.TJSONProtocol"
] | [((2054, 2092), 'thrift.protocol.TBinaryProtocol.TBinaryProtocol', 'TBinaryProtocol.TBinaryProtocol', (['trans'], {}), '(trans)\n', (2085, 2092), False, 'from thrift.protocol import TBinaryProtocol\n'), ((2601, 2635), 'thrift.transport.TSocket.TSocket', 'TSocket.TSocket', (['"""localhost"""', '(9080)'], {}), "('localho... |
"""
Copyright 2019 ShipChain, 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, softwar... | [
"rest_framework.response.Response"
] | [((4460, 4564), 'rest_framework.response.Response', 'Response', (['serializer.data'], {'status': '(config.success_status or status.HTTP_201_CREATED)', 'headers': 'headers'}), '(serializer.data, status=config.success_status or status.\n HTTP_201_CREATED, headers=headers)\n', (4468, 4564), False, 'from rest_framework.... |
#!/usr/bin/env python3
import sys
import click
import check_entry_mariadb
import delete_old_entries
import detect_ldap_problems
import fix_wrong_format
import update_password_fields
import delete_userpassword_cram
from config_loader import load_config
from common import LOGGER
@click.group()
def cli():
"""CLI ... | [
"config_loader.load_config",
"click.argument",
"detect_ldap_problems.detect_wrong_format",
"click.group",
"click.option",
"delete_userpassword_cram.delete_userpassword_cram",
"update_password_fields.update",
"common.LOGGER.error",
"sys.exit",
"delete_old_entries.delete_old_entries",
"fix_wrong_f... | [((284, 297), 'click.group', 'click.group', ([], {}), '()\n', (295, 297), False, 'import click\n'), ((376, 404), 'click.argument', 'click.argument', (['"""input_file"""'], {}), "('input_file')\n", (390, 404), False, 'import click\n'), ((406, 452), 'click.option', 'click.option', (['"""--limit_days_ago"""'], {'default':... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import asyncio
import ssl
import time
from http import HTTPStatus
from urllib import parse
import websockets
from dataclasses import dataclass
from websockets import ConnectionClosed
from websockets.http import Headers
from butterfly import tricks
@dataclass
class Router:
... | [
"urllib.parse.urlparse",
"asyncio.Queue",
"urllib.parse.parse_qs",
"asyncio.gather",
"asyncio.get_event_loop",
"time.time"
] | [((1479, 1503), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1501, 1503), False, 'import asyncio\n'), ((3570, 3591), 'urllib.parse.parse_qs', 'parse.parse_qs', (['query'], {}), '(query)\n', (3584, 3591), False, 'from urllib import parse\n'), ((3773, 3794), 'urllib.parse.parse_qs', 'parse.parse... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
from matplotlib.legend import Legend
from scipy.interpolate import interp1d
from scipy.optimize import curve_fit
from sklearn.metrics import mean_squared_error
"""
Função usada para fittar os dados.
https://docs.scipy.org... | [
"scipy.optimize.curve_fit",
"numpy.ceil",
"matplotlib.pyplot.style.use",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((71, 94), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (84, 94), True, 'import matplotlib.pyplot as plt\n'), ((3449, 3514), 'numpy.linspace', 'np.linspace', (['self.pmin', 'last_point', 'n_interp_point'], {'endpoint': '(True)'}), '(self.pmin, last_point, n_interp_point, endp... |
# -*- coding:utf-8 -*-
__author__ = 'Gvammer'
from PManager.models import PM_Task, listManager, PM_Milestone
from django.contrib.auth.models import User
import datetime
#from django.db.models import Sum,Count
#from PManager.viewsExt.tools import templateTools
#from django.contrib.contenttypes.models import ContentType
... | [
"PManager.models.PM_Task.objects.filter",
"PManager.widgets.tasklist.widget.TaskWidgetManager.getResponsibleList",
"PManager.models.PM_Milestone",
"PManager.viewsExt.tools.templateTools.dateTime.convertToSite",
"django.db.transaction.commit",
"django.utils.timezone.get_current_timezone",
"datetime.timed... | [((680, 700), 'django.db.transaction.commit', 'transaction.commit', ([], {}), '()\n', (698, 700), False, 'from django.db import transaction\n'), ((1370, 1416), 'PManager.viewsExt.tools.templateTools.dateTime.convertToDateTime', 'templateTools.dateTime.convertToDateTime', (['date'], {}), '(date)\n', (1410, 1416), False,... |
# Generated by Django 2.1 on 2018-08-28 09:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('substitute_finder', '0005_auto_20180816_0849'),
]
operations = [
migrations.AddField(
model_name='product',
name='imag... | [
"django.db.models.URLField"
] | [((358, 469), 'django.db.models.URLField', 'models.URLField', ([], {'default': '"""https://fake_image/fake.jpg"""', 'max_length': '(2000)', 'verbose_name': '"""url de la miniature"""'}), "(default='https://fake_image/fake.jpg', max_length=2000,\n verbose_name='url de la miniature')\n", (373, 469), False, 'from djang... |
import frappe
import json
from erpnext.stock.get_item_details import get_item_details
from six import string_types
@frappe.whitelist()
def get_user_default():
return frappe.get_all("User Default",
filters = {'user': frappe.session.user},
fields = ["setting_key", "setting_value"])
@frappe.whiteli... | [
"json.loads",
"erpnext.stock.get_item_details.get_item_details",
"frappe.db.has_column",
"frappe.whitelist",
"frappe.get_doc",
"frappe.get_all"
] | [((118, 136), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (134, 136), False, 'import frappe\n'), ((306, 324), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (322, 324), False, 'import frappe\n'), ((1087, 1105), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (1103, 1105), False, 'impo... |
#!/usr/bin/python2
import os
import subprocess
import re
from ansible.module_utils.basic import AnsibleModule
def get_sg_info():
cmd = "cmviewcl -f line"
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
returncode = process.returncode
# Python3 reads... | [
"re.search"
] | [((844, 879), 're.search', 're.search', (['regex_package_node', 'line'], {}), '(regex_package_node, line)\n', (853, 879), False, 'import re\n'), ((1262, 1292), 're.search', 're.search', (['regex_package', 'line'], {}), '(regex_package, line)\n', (1271, 1292), False, 'import re\n'), ((1666, 1693), 're.search', 're.searc... |
# tva.py - functions for handling French TVA numbers
# coding: utf-8
#
# Copyright (C) 2012-2017 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the Licen... | [
"stdnum.fr.siren.validate",
"stdnum.util.clean",
"stdnum.util.isdigits"
] | [((2628, 2644), 'stdnum.util.isdigits', 'isdigits', (['number'], {}), '(number)\n', (2636, 2644), False, 'from stdnum.util import clean, isdigits\n'), ((2391, 2411), 'stdnum.util.isdigits', 'isdigits', (['number[2:]'], {}), '(number[2:])\n', (2399, 2411), False, 'from stdnum.util import clean, isdigits\n'), ((2594, 262... |
import re
import time
from multiprocessing import Pool
import pandas as pd
from cnswd.mongodb import get_db
from cnswd.websource.wy import fetch_fhpg
from ..setting.constants import MARKET_START, MAX_WORKER
from ..utils import make_logger
from .base import get_stock_status
logger = make_logger('网易分红配股')
NAMES = ['分... | [
"pandas.isnull",
"re.compile",
"cnswd.mongodb.get_db",
"cnswd.websource.wy.fetch_fhpg",
"multiprocessing.Pool",
"pandas.Timestamp",
"time.time",
"pandas.to_datetime"
] | [((360, 380), 're.compile', 're.compile', (['"""日期$|日$"""'], {}), "('日期$|日$')\n", (370, 380), False, 'import re\n'), ((1569, 1581), 'cnswd.mongodb.get_db', 'get_db', (['"""wy"""'], {}), "('wy')\n", (1575, 1581), False, 'from cnswd.mongodb import get_db\n'), ((2097, 2108), 'time.time', 'time.time', ([], {}), '()\n', (21... |
import core
import model
import settings
def get_communitylist(city):
res = []
for community in model.Community.select():
if community.city == city:
res.append(community.title)
return res
if __name__ == "__main__":
regionlist = settings.REGIONLIST # only pinyin support
city =... | [
"core.GetHouseByRegionlist",
"core.GetCommunityByRegionlist",
"model.database_init",
"core.GetSellByCommunitylist",
"model.Community.select"
] | [((106, 130), 'model.Community.select', 'model.Community.select', ([], {}), '()\n', (128, 130), False, 'import model\n'), ((339, 360), 'model.database_init', 'model.database_init', ([], {}), '()\n', (358, 360), False, 'import model\n'), ((365, 408), 'core.GetHouseByRegionlist', 'core.GetHouseByRegionlist', (['city', 'r... |
import os
here = os.path.abspath(os.path.dirname(__file__))
os.chdir(here)
def hello_world():
return "Hello World"
| [
"os.chdir",
"os.path.dirname"
] | [((61, 75), 'os.chdir', 'os.chdir', (['here'], {}), '(here)\n', (69, 75), False, 'import os\n'), ((34, 59), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (49, 59), False, 'import os\n')] |
import zlib
BIBLIOTIK_ZDICT = '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta nam... | [
"zlib.compressobj",
"zlib.decompressobj"
] | [((10885, 10933), 'zlib.compressobj', 'zlib.compressobj', ([], {'level': '(9)', 'zdict': 'BIBLIOTIK_ZDICT'}), '(level=9, zdict=BIBLIOTIK_ZDICT)\n', (10901, 10933), False, 'import zlib\n'), ((11135, 11176), 'zlib.decompressobj', 'zlib.decompressobj', ([], {'zdict': 'BIBLIOTIK_ZDICT'}), '(zdict=BIBLIOTIK_ZDICT)\n', (1115... |
# This is the simulation of our evolving RS model under the SECOND framework of our assumptions on edge weights.
import numpy as np
import random
import matplotlib.pyplot as plt
import powerlaw
import pandas as pd
class assumption_2nd:
# initializing the whole model
def __init__(self, beta, iterations, rating_... | [
"numpy.random.normal",
"powerlaw.Fit",
"numpy.random.rand",
"numpy.random.choice",
"numpy.random.multinomial",
"numpy.sum",
"numpy.zeros",
"numpy.random.sample",
"numpy.array",
"numpy.dot",
"numpy.random.randint",
"numpy.transpose",
"numpy.bincount",
"random.randint",
"numpy.set_printopt... | [((10483, 10500), 'powerlaw.Fit', 'powerlaw.Fit', (['seq'], {}), '(seq)\n', (10495, 10500), False, 'import powerlaw\n'), ((756, 783), 'numpy.zeros', 'np.zeros', (['self.rating_scale'], {}), '(self.rating_scale)\n', (764, 783), True, 'import numpy as np\n'), ((811, 840), 'numpy.zeros', 'np.zeros', (['(self.iterations + ... |
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
import os
import shutil
from tempfile import TemporaryDirectory
import sys
import re
import json
from widgets.textviewer import *
from urllib.parse import urlparse
import requests
import threading
import webbrowser
import platform... | [
"os.path.exists",
"tempfile.TemporaryDirectory",
"os.listdir",
"os.makedirs",
"threading.Lock",
"widgets.progressbar.ProgressBar",
"os.path.join",
"webbrowser.open",
"requests.get",
"platform.system",
"os.path.basename",
"json.load",
"os.path.expanduser"
] | [((1484, 1500), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1498, 1500), False, 'import threading\n'), ((16856, 16874), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (16866, 16874), False, 'import os\n'), ((754, 777), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (77... |
from django.utils.translation import gettext_lazy as _
from chemreg.common.serializers import CommonInfoSerializer, ControlledVocabSerializer
from chemreg.common.validators import ExternalIdUniqueTogetherValidator
from chemreg.lists.models import (
AccessibilityType,
ExternalContact,
IdentifierType,
Li... | [
"chemreg.users.serializers.UserSerializer",
"django.utils.translation.gettext_lazy"
] | [((1549, 1590), 'chemreg.users.serializers.UserSerializer', 'UserSerializer', ([], {'read_only': '(True)', 'many': '(True)'}), '(read_only=True, many=True)\n', (1563, 1590), False, 'from chemreg.users.serializers import UserSerializer\n'), ((2927, 3052), 'django.utils.translation.gettext_lazy', '_', (['"""External IDs ... |
import sys
import re #Regular Expressions!
#Source: https://github.com/msbanik/drawtree
#Licence: MIT
class AsciiNode(object):
left = None
right = None
# length of the edge from this node to its children
edge_length = 0
height = 0
lablen = 0
# -1 = left, 0 = root, 1 = right
parent_di... | [
"sys.stdout.write"
] | [((4600, 4630), 'sys.stdout.write', 'sys.stdout.write', (["(' ' * spaces)"], {}), "(' ' * spaces)\n", (4616, 4630), False, 'import sys\n'), ((4669, 4697), 'sys.stdout.write', 'sys.stdout.write', (['node.label'], {}), '(node.label)\n', (4685, 4697), False, 'import sys\n'), ((4848, 4878), 'sys.stdout.write', 'sys.stdout.... |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p, constants as _cs, arrays
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_NV_video_capture'
def _f( function ):
return _p.createFunction( function,_p.GL,'GL_NV_video_capture',False)
_p.unpack_constants( ""... | [
"OpenGL.platform.types",
"OpenGL.GL.glget.addGLGetConstant",
"OpenGL.extensions.hasGLExtension",
"OpenGL.platform.createFunction"
] | [((1408, 1464), 'OpenGL.GL.glget.addGLGetConstant', 'glget.addGLGetConstant', (['GL_VIDEO_BUFFER_BINDING_NV', '(1,)'], {}), '(GL_VIDEO_BUFFER_BINDING_NV, (1,))\n', (1430, 1464), False, 'from OpenGL.GL import glget\n'), ((1472, 1498), 'OpenGL.platform.types', '_p.types', (['None', '_cs.GLuint'], {}), '(None, _cs.GLuint)... |
from activity.cloudkit import CloudKit
from activity.datastore import ActivityDatastore
from activity.datastore import Datastore
import argparse
import datetime
import os
class Main:
def __init__(self):
self.datastore_path = os.path.expanduser('~/Downloads/Firefly Activity')
self.private_key_path ... | [
"datetime.datetime",
"argparse.ArgumentParser",
"activity.datastore.Datastore",
"activity.cloudkit.CloudKit",
"datetime.datetime.now",
"activity.datastore.ActivityDatastore",
"os.path.expanduser"
] | [((239, 289), 'os.path.expanduser', 'os.path.expanduser', (['"""~/Downloads/Firefly Activity"""'], {}), "('~/Downloads/Firefly Activity')\n", (257, 289), False, 'import os\n'), ((322, 382), 'os.path.expanduser', 'os.path.expanduser', (['"""~/Documents/Firefly Activity/eckey.pem"""'], {}), "('~/Documents/Firefly Activit... |
import os
import logging
import boto3
import botocore
from botocore.exceptions import ClientError
logger = logging.getLogger()
logger.setLevel(logging.INFO)
cp = boto3.client("codepipeline")
def lambda_handler(event, context):
logger.debug("## Environment Variables ##")
logger.debug(os.environ)
logger.de... | [
"logging.getLogger",
"boto3.client"
] | [((108, 127), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (125, 127), False, 'import logging\n'), ((163, 191), 'boto3.client', 'boto3.client', (['"""codepipeline"""'], {}), "('codepipeline')\n", (175, 191), False, 'import boto3\n')] |
#!/usr/bin/env python
from pathlib import Path
from setuptools import find_packages, setup
from congress_crawler import __version__
with (Path(__file__).parent / "requirements.txt").open() as f:
required = f.read().splitlines()
setup(
name="congress-crawler",
version=__version__,
author="<NAME>",... | [
"setuptools.find_packages",
"pathlib.Path"
] | [((1088, 1103), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1101, 1103), False, 'from setuptools import find_packages, setup\n'), ((143, 157), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'from pathlib import Path\n')] |
"""
Tests for the Registry library.
"""
import itertools
import unittest
import requests
from pyregistry.registry import (
Registry,
chunk_streamer,
parse_image_name,
parse_user,
)
class RegistryTest(unittest.TestCase):
"""
Tests for the Registry library.
"""
def test_parse_user(sel... | [
"itertools.chain",
"pyregistry.registry.chunk_streamer",
"pyregistry.registry.Registry",
"pyregistry.registry.parse_user",
"unittest.main",
"pyregistry.registry.parse_image_name"
] | [((10718, 10733), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10731, 10733), False, 'import unittest\n'), ((956, 978), 'pyregistry.registry.parse_image_name', 'parse_image_name', (['name'], {}), '(name)\n', (972, 978), False, 'from pyregistry.registry import Registry, chunk_streamer, parse_image_name, parse_us... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.mean",
"numpy.zeros",
"numpy.argmax",
"numpy.max"
] | [((1205, 1226), 'numpy.max', 'np.max', (['attn'], {'axis': '(-1)'}), '(attn, axis=-1)\n', (1211, 1226), True, 'import numpy as np\n'), ((1238, 1250), 'numpy.mean', 'np.mean', (['max'], {}), '(max)\n', (1245, 1250), True, 'import numpy as np\n'), ((1323, 1348), 'numpy.zeros', 'np.zeros', (['[attn.shape[2]]'], {}), '([at... |
"""
Supplementary Fig. 2
"""
"""This script is used to benchmark GLIPH's performance across a variety of clustering thresholds by
varying the hamming distance parameter. This script required a local installation of GLIPH. The output
of this script is saved as GLIPH.csv and can be found in the github repository."""
i... | [
"seaborn.regplot",
"os.listdir",
"pandas.read_csv",
"numpy.asarray",
"os.path.join",
"numpy.sum",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"glob.glob",
"os.remove"
] | [((482, 503), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (492, 503), False, 'import os\n'), ((715, 729), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (727, 729), True, 'import pandas as pd\n'), ((804, 818), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (816, 818), True, 'import p... |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
"unittest.main",
"tools.android.instrumentation_test_check._ExtractTargetPackageToInstrument",
"tools.android.instrumentation_test_check._ExtractTargetPackageName",
"tools.android.instrumentation_test_check._ValidateManifestPackageNames"
] | [((2836, 2851), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2849, 2851), False, 'import unittest\n'), ((2098, 2161), 'tools.android.instrumentation_test_check._ExtractTargetPackageToInstrument', '_ExtractTargetPackageToInstrument', (['INSTRUMENTATION_MANIFEST', '""""""'], {}), "(INSTRUMENTATION_MANIFEST, '')\n... |
# -*- coding: utf-8 -*-
#############################################################
# IMPORTS #
#############################################################
import os
import sys
import re
from time import sleep
from PIL import Image, ImageOps, ImageFile
##... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"PIL.Image.new",
"PIL.ImageOps.fit",
"os.chdir",
"os.path.abspath",
"os.system"
] | [((816, 830), 'os.chdir', 'os.chdir', (['PATH'], {}), '(PATH)\n', (824, 830), False, 'import os\n'), ((788, 813), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (803, 813), False, 'import os\n'), ((1813, 1846), 'os.path.exists', 'os.path.exists', (['f"""{PATH}\\\\2 en 1"""'], {}), "(f'{PATH}\... |
# Author: <NAME>(ICSRL)
# Created: 4/14/2020, 7:15 AM
# Email: <EMAIL>
import tensorflow as tf
import numpy as np
from network.loss_functions import huber_loss, mse_loss
from network.network import *
from numpy import linalg as LA
class initialize_network_DeepQLearning():
def __init__(self, cfg, name, vehicle_nam... | [
"tensorflow.local_variables_initializer",
"tensorflow.transpose",
"tensorflow.multiply",
"numpy.linalg.norm",
"network.loss_functions.mse_loss",
"tensorflow.log",
"tensorflow.Graph",
"numpy.mean",
"tensorflow.placeholder",
"numpy.max",
"tensorflow.trainable_variables",
"tensorflow.train.AdamOp... | [((341, 351), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (349, 351), True, 'import tensorflow as tf\n'), ((3605, 3652), 'numpy.zeros', 'np.zeros', ([], {'shape': '[xs.shape[0]]', 'dtype': 'np.float32'}), '(shape=[xs.shape[0]], dtype=np.float32)\n', (3613, 3652), True, 'import numpy as np\n'), ((3671, 3711), 'num... |
from fastccd_support_ioc.utils import cin_functions
cin_functions.WriteReg("8204", "0001", 1)
cin_functions.WriteReg("8205", "0009", 1)
| [
"fastccd_support_ioc.utils.cin_functions.WriteReg"
] | [((53, 94), 'fastccd_support_ioc.utils.cin_functions.WriteReg', 'cin_functions.WriteReg', (['"""8204"""', '"""0001"""', '(1)'], {}), "('8204', '0001', 1)\n", (75, 94), False, 'from fastccd_support_ioc.utils import cin_functions\n'), ((95, 136), 'fastccd_support_ioc.utils.cin_functions.WriteReg', 'cin_functions.WriteReg... |
#
# From https://github.com/rguthrie3/BiLSTM-CRF/blob/master/model.py
#
import dynet
import numpy as np
class CRF():
def __init__(self, model, id_to_tag):
self.id_to_tag = id_to_tag
self.tag_to_id = {tag: id for id, tag in list(id_to_tag.items())}
self.n_tags = len(self.id_to_tag)
... | [
"dynet.scalarInput",
"dynet.exp",
"numpy.argmax",
"dynet.pick",
"dynet.inputVector",
"dynet.concatenate"
] | [((741, 761), 'dynet.scalarInput', 'dynet.scalarInput', (['(0)'], {}), '(0)\n', (758, 761), False, 'import dynet\n'), ((2709, 2739), 'dynet.inputVector', 'dynet.inputVector', (['init_alphas'], {}), '(init_alphas)\n', (2726, 2739), False, 'import dynet\n'), ((3746, 3775), 'dynet.inputVector', 'dynet.inputVector', (['ini... |
#!/usr/bin/python3
import sys
import copy
'''
ns-vcf -- read vcf and output json record
Plan: will load the vcf file bach, check the annotated vcf file and load it
'''
def vcf_to_json(vcf_file):
vcf_json = []
with open(vcf_file, 'r+') as fh:
title = []
for line in fh:
line = li... | [
"sys.exit",
"copy.deepcopy"
] | [((1095, 1117), 'copy.deepcopy', 'copy.deepcopy', (['variant'], {}), '(variant)\n', (1108, 1117), False, 'import copy\n'), ((1348, 1421), 'sys.exit', 'sys.exit', (['"""[ERR]genotype fields num is not consistant with genotype info"""'], {}), "('[ERR]genotype fields num is not consistant with genotype info')\n", (1356, 1... |
import anonypy
import pandas as pd
from datetime import datetime, date
def calculate_age(born):
born = datetime.strptime(born, "%Y/%m")
today = date.today()
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
def test_receipt():
path = "data/receipt.csv"
df = pd.r... | [
"anonypy.Preserver",
"pandas.read_csv",
"datetime.datetime.strptime",
"pandas.DataFrame",
"datetime.date.today"
] | [((109, 141), 'datetime.datetime.strptime', 'datetime.strptime', (['born', '"""%Y/%m"""'], {}), "(born, '%Y/%m')\n", (126, 141), False, 'from datetime import datetime, date\n'), ((154, 166), 'datetime.date.today', 'date.today', ([], {}), '()\n', (164, 166), False, 'from datetime import datetime, date\n'), ((316, 333), ... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import altair as alt
# import seaborn_altair as salt # https://github.com/Kitware/seaborn_altair
sns.set_style("whitegrid")
def plot_histograms(data):
# cols = list(data.columns)
# for i in cols:
# g = sns.d... | [
"seaborn.distplot",
"matplotlib.pyplot.plot",
"seaborn.set_style",
"seaborn.lineplot",
"seaborn.PairGrid"
] | [((192, 218), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (205, 218), True, 'import seaborn as sns\n'), ((384, 402), 'seaborn.distplot', 'sns.distplot', (['data'], {}), '(data)\n', (396, 402), True, 'import seaborn as sns\n'), ((526, 587), 'seaborn.lineplot', 'sns.lineplot', ([],... |
import datetime
from polls.models import QuestionTuple, Choice
def meal441():
print("++++++++++++++++++++++++")
question_tuple = QuestionTuple.objects.get(pk=441)
questions = question_tuple.question_set.all()
now = datetime.datetime.now()
print("Time: " + str(now))
today = datetime.date.today... | [
"datetime.timedelta",
"polls.models.QuestionTuple.objects.get",
"datetime.datetime.now",
"polls.models.Choice.objects.filter",
"datetime.date.today"
] | [((140, 173), 'polls.models.QuestionTuple.objects.get', 'QuestionTuple.objects.get', ([], {'pk': '(441)'}), '(pk=441)\n', (165, 173), False, 'from polls.models import QuestionTuple, Choice\n'), ((234, 257), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (255, 257), False, 'import datetime\n'), ((30... |
from flask import Request
from flask_injector import inject
from models.Item import Item
from services.provider import ItemsProvider
items = {
0: {"name": "<NAME>"}
}
@inject(data_provider=ItemsProvider)
def search(data_provider) -> list:
return data_provider.get_serialized()
@inject(item=Item, _request=R... | [
"flask_injector.inject"
] | [((176, 211), 'flask_injector.inject', 'inject', ([], {'data_provider': 'ItemsProvider'}), '(data_provider=ItemsProvider)\n', (182, 211), False, 'from flask_injector import inject\n'), ((292, 327), 'flask_injector.inject', 'inject', ([], {'item': 'Item', '_request': 'Request'}), '(item=Item, _request=Request)\n', (298,... |
import os
import requests
from dataclasses import dataclass
@dataclass()
class AirTable:
base_id: str
api_key: str
table_name: str
def create_records(self, email=None):
if email is None:
return False
headers = {
"Authorization": f"Bearer {self.api_key}",
... | [
"requests.post",
"dataclasses.dataclass"
] | [((62, 73), 'dataclasses.dataclass', 'dataclass', ([], {}), '()\n', (71, 73), False, 'from dataclasses import dataclass\n'), ((661, 712), 'requests.post', 'requests.post', (['endpoint'], {'json': 'data', 'headers': 'headers'}), '(endpoint, json=data, headers=headers)\n', (674, 712), False, 'import requests\n')] |
import easypost
import os
easypost.api_key=os.environ['EASYPOST_KEY']
shipment=easypost.Shipment.retrieve('shp_sq2zuZ8d')
| [
"easypost.Shipment.retrieve"
] | [((79, 121), 'easypost.Shipment.retrieve', 'easypost.Shipment.retrieve', (['"""shp_sq2zuZ8d"""'], {}), "('shp_sq2zuZ8d')\n", (105, 121), False, 'import easypost\n')] |
import numpy as np
shape = tuple(map(int,input().strip().split()))
zeros = np.zeros(shape,dtype=np.int32)
ones = np.ones(shape,dtype=np.int32)
print(zeros)
print(ones)
| [
"numpy.zeros",
"numpy.ones"
] | [((75, 106), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'np.int32'}), '(shape, dtype=np.int32)\n', (83, 106), True, 'import numpy as np\n'), ((113, 143), 'numpy.ones', 'np.ones', (['shape'], {'dtype': 'np.int32'}), '(shape, dtype=np.int32)\n', (120, 143), True, 'import numpy as np\n')] |
import logging
import pkg_resources
import sys
from evm.utils.logging import (
trace,
TRACE_LEVEL_NUM,
)
from evm.vm import ( # noqa: F401
VM,
)
from evm.chains import ( # noqa: F401
Chain,
MainnetChain,
MainnetTesterChain,
RopstenChain,
)
#
# Setup TRACE level logging.
#
logging.addLe... | [
"sys.setrecursionlimit",
"pkg_resources.get_distribution",
"logging.addLevelName"
] | [((307, 353), 'logging.addLevelName', 'logging.addLevelName', (['TRACE_LEVEL_NUM', '"""TRACE"""'], {}), "(TRACE_LEVEL_NUM, 'TRACE')\n", (327, 353), False, 'import logging\n'), ((600, 632), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(1024 * 10)'], {}), '(1024 * 10)\n', (621, 632), False, 'import sys\n'), ((649... |
from enum import Enum
from typing import Optional
import requests
import typer
class ListType(str, Enum):
blacklist = "blacklist"
whitelist = "whitelist"
class ListAction(str, Enum):
add = "add"
clear = "clear"
class BlacklistSource(str, Enum):
firebog_ticked = "firebog_ticked"
firebog_no... | [
"typer.Option",
"typer.run",
"requests.Session",
"requests.get"
] | [((7661, 7685), 'typer.run', 'typer.run', (['instance.main'], {}), '(instance.main)\n', (7670, 7685), False, 'import typer\n'), ((2775, 2805), 'typer.Option', 'typer.Option', (['...'], {'prompt': '(True)'}), '(..., prompt=True)\n', (2787, 2805), False, 'import typer\n'), ((2841, 2871), 'typer.Option', 'typer.Option', (... |
from abc import abstractmethod
from tqdm import tqdm
from os.path import exists, join, isfile, dirname, abspath, split
from pathlib import Path
import random
import tensorflow as tf
import numpy as np
from ...utils import Cache, get_hash
from ...datasets.utils import DataProcessing
from sklearn.neighbors import KDTre... | [
"tensorflow.data.Dataset.from_generator"
] | [((3406, 3469), 'tensorflow.data.Dataset.from_generator', 'tf.data.Dataset.from_generator', (['gen_func', 'gen_types', 'gen_shapes'], {}), '(gen_func, gen_types, gen_shapes)\n', (3436, 3469), True, 'import tensorflow as tf\n')] |
#!/usr/bin/env python3
"""
"""
import pprint
import argparse
import csv
import json
def create_structure():
output = {}
output["nodes"] = []
return output
def read_file_to_object(filename):
"""
:param filename:
:return: dictreader output
"""
print(filename)
input_file = csv.... | [
"json.dumps",
"pprint.pprint"
] | [((548, 574), 'json.dumps', 'json.dumps', (['objs'], {'indent': '(4)'}), '(objs, indent=4)\n', (558, 574), False, 'import json\n'), ((2218, 2243), 'pprint.pprint', 'pprint.pprint', (['output_obj'], {}), '(output_obj)\n', (2231, 2243), False, 'import pprint\n')] |
from configparser import ConfigParser
import logging
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
from torch.nn import functional as F
from decoder import top_k_top_p_filtering
from discord_bot import get_prescripted_lines
from model import load_model, download_model_folder
# Enable logging
lo... | [
"logging.getLogger",
"configparser.ConfigParser",
"torch.multinomial",
"decoder.top_k_top_p_filtering",
"logging.Formatter",
"model.load_model",
"discord_bot.get_prescripted_lines",
"torch.tensor",
"torch.no_grad",
"torch.cuda.is_available",
"logging.FileHandler",
"model.download_model_folder"... | [((327, 354), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (344, 354), False, 'import logging\n'), ((396, 467), 'logging.FileHandler', 'logging.FileHandler', ([], {'filename': '"""discord.log"""', 'encoding': '"""utf-8"""', 'mode': '"""w"""'}), "(filename='discord.log', encoding='utf-8'... |
import os
from leapp.libraries.common.config import architecture
from leapp.libraries.stdlib import api
from leapp.models import CopyFile, TargetUserSpaceUpgradeTasks, UpgradeInitramfsTasks
DASD_CONF = '/etc/dasd.conf'
def process():
if not architecture.matches_architecture(architecture.ARCH_S390X):
ret... | [
"leapp.models.CopyFile",
"os.path.isfile",
"leapp.libraries.common.config.architecture.matches_architecture",
"leapp.libraries.stdlib.api.current_logger",
"leapp.models.UpgradeInitramfsTasks"
] | [((331, 356), 'os.path.isfile', 'os.path.isfile', (['DASD_CONF'], {}), '(DASD_CONF)\n', (345, 356), False, 'import os\n'), ((249, 307), 'leapp.libraries.common.config.architecture.matches_architecture', 'architecture.matches_architecture', (['architecture.ARCH_S390X'], {}), '(architecture.ARCH_S390X)\n', (282, 307), Fa... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json, logging, time
from urllib.request import Request, urlopen
from betterboto import client as betterboto_client
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(e... | [
"logging.getLogger",
"urllib.request.Request",
"json.dumps",
"os.environ.get",
"betterboto.client.CrossAccountClientContextManager",
"time.sleep",
"urllib.request.urlopen"
] | [((255, 274), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (272, 274), False, 'import json, logging, time\n'), ((4165, 4415), 'json.dumps', 'json.dumps', (["{'Status': rs, 'Reason': 'CloudWatch Log Stream: ' + c.log_stream_name,\n 'PhysicalResourceId': c.log_stream_name, 'StackId': e['StackId'],\n ... |
#!/usr/bin/env python3
# coding: utf8
import argparse
import csv
import sys
import numpy
from abc import ABCMeta, abstractmethod
class CLI:
def __init__(self): pass
def parse(self):
self.__stdin = [line.rstrip('\n') for line in sys.stdin.readlines()]
# print(self.__stdin)
parser = argpar... | [
"sys.stdin.readlines",
"csv.reader",
"argparse.ArgumentParser"
] | [((314, 371), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""このプログラムの説明(なくてもよい)"""'}), "(description='このプログラムの説明(なくてもよい)')\n", (337, 371), False, 'import argparse\n'), ((1396, 1427), 'csv.reader', 'csv.reader', (['tsv'], {'delimiter': '"""\t"""'}), "(tsv, delimiter='\\t')\n", (1406, 1427... |
import pyconll
import urllib
import numpy as np
from pathlib import Path
from keras.preprocessing.sequence import pad_sequences
'''
Universal Dependencies Treebank Dataset
https://universaldependencies.org
'''
def read_conllu(path):
data = pyconll.load_from_file(path)
tagged_sentences = list()
t = 0
... | [
"pyconll.load_from_file",
"urllib.request.urlretrieve",
"pathlib.Path",
"numpy.array",
"numpy.zeros",
"keras.preprocessing.sequence.pad_sequences"
] | [((247, 275), 'pyconll.load_from_file', 'pyconll.load_from_file', (['path'], {}), '(path)\n', (269, 275), False, 'import pyconll\n'), ((1787, 1810), 'numpy.array', 'np.array', (['cat_sequences'], {}), '(cat_sequences)\n', (1795, 1810), True, 'import numpy as np\n'), ((1952, 1969), 'pathlib.Path', 'Path', (['UDTB_FOLDER... |