code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
#! usr/bin/env python3.8
import sys
import scipy.io.wavfile
import numpy as np
import matplotlib.pyplot as plt
args = sys.argv
wav_filename = args[1]
rate, data = scipy.io.wavfile.read(wav_filename)
data = data / 32768
time = np.arange(0, data.shape[0]/rate, 1/rate)
plt.plot(time, data)
plt.show()
| [
"numpy.arange",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((233, 277), 'numpy.arange', 'np.arange', (['(0)', '(data.shape[0] / rate)', '(1 / rate)'], {}), '(0, data.shape[0] / rate, 1 / rate)\n', (242, 277), True, 'import numpy as np\n'), ((276, 296), 'matplotlib.pyplot.plot', 'plt.plot', (['time', 'data'], {}), '(time, data)\n', (284, 296), True, 'import matplotlib.pyplot a... |
import numpy as np
import pandas as pd
import os,re
import multiprocessing
import h5py
import csv
import ujson
from operator import itemgetter
from collections import defaultdict
from io import StringIO
from . import helper
from ..utils import misc
def index(eventalign_result,pos_start,out_paths,locks):
eventali... | [
"io.StringIO",
"os.path.join",
"multiprocessing.Lock",
"ujson.dump",
"pandas.read_csv",
"numpy.unique",
"os.path.exists",
"numpy.dtype",
"numpy.split",
"collections.defaultdict",
"numpy.argsort",
"numpy.rec.fromrecords",
"numpy.around",
"numpy.array",
"pandas.to_numeric",
"multiprocess... | [((1610, 1664), 'multiprocessing.JoinableQueue', 'multiprocessing.JoinableQueue', ([], {'maxsize': '(n_processes * 2)'}), '(maxsize=n_processes * 2)\n', (1639, 1664), False, 'import multiprocessing\n'), ((2163, 2227), 'pandas.read_csv', 'pd.read_csv', (['eventalign_filepath'], {'chunksize': 'chunk_size', 'sep': '"""\t"... |
# Created by DrLecter, based on DraX' scripts
# This script is part of the L2J Official Datapack Project
# Visit us at http://www.l2jdp.com/
# See readme-dp.txt and gpl.txt for license and distribution details
# Let us know if you did not receive a copy of such files.
import sys
from ru.catssoftware.gameserver.model.qu... | [
"ru.catssoftware.gameserver.model.quest.jython.QuestJython.__init__"
] | [((2438, 2476), 'ru.catssoftware.gameserver.model.quest.jython.QuestJython.__init__', 'JQuest.__init__', (['self', 'id', 'name', 'descr'], {}), '(self, id, name, descr)\n', (2453, 2476), True, 'from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest\n')] |
#!/usr/bin/env pytest
#
# To get information about the actual durations being reported by the tests,
# run with the INFO debug level:
#
# pytest test_activation_metrics.py --log-cli-level INFO
#
import time
import logging
import htcondor
from ornithology import (
config, standup, action,
Condor, ClusterSta... | [
"time.sleep",
"ornithology.format_script",
"logging.getLogger",
"time.time"
] | [((367, 394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (384, 394), False, 'import logging\n'), ((4826, 4837), 'time.time', 'time.time', ([], {}), '()\n', (4835, 4837), False, 'import time\n'), ((3400, 3421), 'ornithology.format_script', 'format_script', (['script'], {}), '(script)\n... |
# Copyright (c) 2021-present, Data-driven Intelligent System Research Center (DIRECT), National Institute of Information and Communications Technology (NICT). (Modifications for BERTAC)
""" Modified from squad.py in the original Huggingface transformers
for open-domain QA experiments using BERTAC
Following funct... | [
"functools.partial",
"tqdm.tqdm",
"numpy.minimum",
"json.load",
"tensorflow.TensorShape",
"numpy.array",
"io.TextIOWrapper",
"torch.utils.data.TensorDataset",
"multiprocessing.Pool",
"torch.tensor",
"os.path.join",
"logging.getLogger",
"multiprocessing.cpu_count"
] | [((1337, 1364), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1354, 1364), False, 'import logging\n'), ((1378, 1431), 'io.TextIOWrapper', 'io.TextIOWrapper', (['sys.stdout.buffer'], {'encoding': '"""utf-8"""'}), "(sys.stdout.buffer, encoding='utf-8')\n", (1394, 1431), False, 'import io\... |
import datetime
import time
# 时间戳
time_stamp = time.time()
print(time_stamp)
# 时间戳转datetime
date_time = datetime.datetime.fromtimestamp(time_stamp)
print(date_time)
for i in range(10):
pass
# time.sleep(1)
# print(time_str)
print('='*60)
today = datetime.date.today() # 今天
print(today)
yesterday = toda... | [
"datetime.date.today",
"time.time",
"datetime.datetime.strptime",
"datetime.timedelta",
"datetime.datetime.fromtimestamp"
] | [((48, 59), 'time.time', 'time.time', ([], {}), '()\n', (57, 59), False, 'import time\n'), ((106, 149), 'datetime.datetime.fromtimestamp', 'datetime.datetime.fromtimestamp', (['time_stamp'], {}), '(time_stamp)\n', (137, 149), False, 'import datetime\n'), ((262, 283), 'datetime.date.today', 'datetime.date.today', ([], {... |
from run_tec_reflections import main
import sys
if len(sys.argv) > 1:
voltage = float(sys.argv[1])
file_path = str(sys.argv[2])
run_options = {
'dgap': 0.47e-3,
'dt': 8e-12,
'nsteps': 6000,
'particles_per_step': 2400,
'injection_type': 2, # Thermionic injection without... | [
"run_tec_reflections.main"
] | [((1357, 1376), 'run_tec_reflections.main', 'main', ([], {}), '(**run_options)\n', (1361, 1376), False, 'from run_tec_reflections import main\n')] |
"""Messages with headers from 50-79.
Mostly RFC 4252: SSH Authentication Protocol
"""
from __future__ import print_function, division, absolute_import
from __future__ import unicode_literals
from pyssh.base_types import Byte, Boolean, String, NameList, Sequence
from pyssh.constants import (SSH_MSG_USERAUTH_REQUEST, S... | [
"pyssh.base_types.Byte",
"pyssh.base_types.String",
"pyssh.base_types.Boolean"
] | [((705, 735), 'pyssh.base_types.Byte', 'Byte', (['SSH_MSG_USERAUTH_REQUEST'], {}), '(SSH_MSG_USERAUTH_REQUEST)\n', (709, 735), False, 'from pyssh.base_types import Byte, Boolean, String, NameList, Sequence\n'), ((1321, 1351), 'pyssh.base_types.Byte', 'Byte', (['SSH_MSG_USERAUTH_FAILURE'], {}), '(SSH_MSG_USERAUTH_FAILUR... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"binascii.unhexlify",
"kafka.tools.protocol.requests.ArgumentError"
] | [((1726, 1783), 'kafka.tools.protocol.requests.ArgumentError', 'ArgumentError', (['"""SyncGroupV0 requires exactly 4 arguments"""'], {}), "('SyncGroupV0 requires exactly 4 arguments')\n", (1739, 1783), False, 'from kafka.tools.protocol.requests import BaseRequest, ArgumentError\n'), ((1831, 1862), 'binascii.unhexlify',... |
import os
from typing import Optional
import pymongo
client = pymongo.MongoClient(os.environ.get('MONGO_URI'))
db = client.get_default_database()
def get_project(project_name: str) -> Optional[dict]:
filters = {'radiksType': 'project', 'name': project_name, 'deleted': False}
return db['radiks-server-data']... | [
"os.environ.get"
] | [((84, 111), 'os.environ.get', 'os.environ.get', (['"""MONGO_URI"""'], {}), "('MONGO_URI')\n", (98, 111), False, 'import os\n')] |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... | [
"_SimControlScheme_ControlAndSequencingScheme_HeatingLoad.SimControlScheme_ControlAndSequencingScheme_HeatingLoad_sequence_push_back",
"_SimControlScheme_ControlAndSequencingScheme_HeatingLoad.SimControlScheme_ControlAndSequencingScheme_HeatingLoad_sequence_end",
"_SimControlScheme_ControlAndSequencingScheme_He... | [((3743, 3879), '_SimControlScheme_ControlAndSequencingScheme_HeatingLoad.SimControlScheme_ControlAndSequencingScheme_SimCntrlSchm_Name', '_SimControlScheme_ControlAndSequencingScheme_HeatingLoad.SimControlScheme_ControlAndSequencingScheme_SimCntrlSchm_Name', (['self', '*args'], {}), '(\n self, *args)\n', (3861, 387... |
# ./usr/bin/env python
" Importing from .csv to PostgreSQL"
import pandas as pd
from sqlalchemy import create_engine
from dotenv import load_dotenv
import os
titanic = pd.read_csv('titanic.csv')
# Get secret credentials
load_dotenv()
ElephantSQL_URL = os.getenv("ElephantSQL_URL")
# Upload data to SQL
engine = creat... | [
"pandas.read_csv",
"sqlalchemy.create_engine",
"os.getenv",
"dotenv.load_dotenv"
] | [((170, 196), 'pandas.read_csv', 'pd.read_csv', (['"""titanic.csv"""'], {}), "('titanic.csv')\n", (181, 196), True, 'import pandas as pd\n'), ((223, 236), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (234, 236), False, 'from dotenv import load_dotenv\n'), ((255, 283), 'os.getenv', 'os.getenv', (['"""ElephantS... |
import argparse
from sys import argv
from os import scandir, walk
from os.path import join
from glob import glob
from subprocess import run
from tqdm import tqdm
from multiprocessing import Pool
opts = None
def contain_img(d):
return len(glob(join(d, '*.jpg'))) > 0
def worker_func(d):
run(
[... | [
"tqdm.tqdm",
"argparse.ArgumentParser",
"os.walk",
"multiprocessing.Pool",
"os.path.join",
"os.scandir"
] | [((943, 1017), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Make videos given folders of images"""'}), "(description='Make videos given folders of images')\n", (966, 1017), False, 'import argparse\n'), ((1491, 1505), 'os.walk', 'walk', (['opts.dir'], {}), '(opts.dir)\n', (1495, 1505), ... |
# Copyright (c) 2011 - 2017, Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | [
"re.escape",
"time.sleep",
"time.time",
"testlib.loggers.ClassLogger",
"testlib.clissh.CLISSH"
] | [((916, 937), 'testlib.loggers.ClassLogger', 'loggers.ClassLogger', ([], {}), '()\n', (935, 937), False, 'from testlib import loggers\n'), ((1358, 1382), 'testlib.clissh.CLISSH', 'clissh.CLISSH', (['self.host'], {}), '(self.host)\n', (1371, 1382), False, 'from testlib import clissh\n'), ((4138, 4149), 'time.time', 'tim... |
# -*- coding: utf-8 -*-
'''Setup script for StereoFlouroscopyRegistration package'''
# Imports
import re
from setuptools import setup, find_packages
from packaging import version
# Try to get version. Will throw error if something goes wrong.
VERSION = get_version()
# Verify version is PEP compliant
PEP440_REGEX = r... | [
"setuptools.find_packages",
"re.compile"
] | [((319, 382), 're.compile', 're.compile', (['version.VERSION_PATTERN', '(re.VERBOSE | re.IGNORECASE)'], {}), '(version.VERSION_PATTERN, re.VERBOSE | re.IGNORECASE)\n', (329, 382), False, 'import re\n'), ((1532, 1598), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['pip', 'config', 'data', 'demos', 'tes... |
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... | [
"threading.Thread",
"aops_utils.restful.helper.make_datacenter_url",
"flask.request.headers.get",
"aops_manager.conf.configuration.manager.get",
"aops_utils.log.log.LOGGER.error",
"aops_utils.restful.response.MyResponse.verify_all",
"aops_utils.log.log.LOGGER.debug",
"flask.jsonify",
"uuid.uuid1",
... | [((2102, 2120), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (2118, 2120), False, 'from flask import request\n'), ((2144, 2179), 'flask.request.headers.get', 'request.headers.get', (['"""access_token"""'], {}), "('access_token')\n", (2163, 2179), False, 'from flask import request\n'), ((2201, 2262), ... |
import discord
import os
import requests
import json
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import randfacts
import random
import pyjokes
from discord import ChannelType, Guild, Member, Message, Role, Status, utils, Embed
from add import token
from mongo import *
global ... | [
"discord.Activity",
"json.loads",
"discord.Embed",
"randfacts.get_fact",
"pyjokes.get_joke",
"requests.get",
"discord.Client"
] | [((349, 365), 'discord.Client', 'discord.Client', ([], {}), '()\n', (363, 365), False, 'import discord\n'), ((741, 788), 'requests.get', 'requests.get', (['"""https://zenquotes.io/api/random"""'], {}), "('https://zenquotes.io/api/random')\n", (753, 788), False, 'import requests\n'), ((803, 828), 'json.loads', 'json.loa... |
import random
import pandas as pd
from sepal_ui import model
from traitlets import Any
from component import parameter as cp
layer_list = pd.read_csv(cp.layer_list).fillna('')
class CustomizeLayerModel(model.Model):
layer_list = Any([
{
'layer_id' : row.layer_id,
... | [
"pandas.read_csv"
] | [((141, 167), 'pandas.read_csv', 'pd.read_csv', (['cp.layer_list'], {}), '(cp.layer_list)\n', (152, 167), True, 'import pandas as pd\n')] |
from __future__ import generators
import time
import heapq
from datetime import datetime
from celery import log
DEFAULT_MAX_INTERVAL = 2
class Scheduler(object):
"""ETA scheduler.
:param ready_queue: Queue to move items ready for processing.
:keyword max_interval: Maximum sleep interval between itera... | [
"celery.log.get_default_logger",
"heapq.heappush",
"time.time"
] | [((1140, 1200), 'heapq.heappush', 'heapq.heappush', (['self._queue', '(eta, priority, item, callback)'], {}), '(self._queue, (eta, priority, item, callback))\n', (1154, 1200), False, 'import heapq\n'), ((583, 607), 'celery.log.get_default_logger', 'log.get_default_logger', ([], {}), '()\n', (605, 607), False, 'from cel... |
import os
import pytest
from assistant import AssistantCLI
_PATH_ROOT = os.path.dirname(os.path.dirname(__file__))
_PATH_TEMPLATES = os.path.join(_PATH_ROOT, "templates")
_PATH_DIR_SIMPLE = os.path.join(_PATH_TEMPLATES, "simple")
_PATH_DIR_TITANIC = os.path.join(_PATH_TEMPLATES, "titanic")
def _path_in_dir(fname: s... | [
"assistant.AssistantCLI",
"os.path.dirname",
"os.path.join"
] | [((135, 172), 'os.path.join', 'os.path.join', (['_PATH_ROOT', '"""templates"""'], {}), "(_PATH_ROOT, 'templates')\n", (147, 172), False, 'import os\n'), ((192, 231), 'os.path.join', 'os.path.join', (['_PATH_TEMPLATES', '"""simple"""'], {}), "(_PATH_TEMPLATES, 'simple')\n", (204, 231), False, 'import os\n'), ((252, 292)... |
"""
Kafka topic creation
====================
Takes that from the topics defined in context.py and
for creates a topic for each of them.
In addition to the topics in the context.py, it also
creates the histogram topics (measurement appended by
hist)
Based on:
https://github.com/dp... | [
"context.topics.extend",
"context.Client",
"kafka.admin.NewTopic",
"context.wait_for_it"
] | [((538, 578), 'context.Client', 'Client', ([], {'admin': '(False)', 'client_id': 'client_id'}), '(admin=False, client_id=client_id)\n', (544, 578), False, 'from context import topics, client_id, Client, wait_for_it\n'), ((752, 778), 'context.topics.extend', 'topics.extend', (['hist_topics'], {}), '(hist_topics)\n', (76... |
from tool import darknet2pytorch
import torch
from tool.utils import *
from tool.torch_utils import *
from config import configs
from utils_ import find_overlap, transform_detection, load_model
# from tool.darknet2pytorch import Darknet
import cv2
class YoloDetector():
"""
A class to load trained Yolov4 mod... | [
"cv2.cvtColor",
"torch.load",
"utils_.load_model",
"utils_.find_overlap",
"config.configs",
"cv2.imread",
"torch.cuda.is_available",
"torch.device",
"utils_.transform_detection",
"tool.darknet2pytorch.Darknet",
"cv2.resize"
] | [((1018, 1027), 'config.configs', 'configs', ([], {}), '()\n', (1025, 1027), False, 'from config import configs\n'), ((1469, 1517), 'tool.darknet2pytorch.Darknet', 'darknet2pytorch.Darknet', (['cfgfile'], {'inference': '(True)'}), '(cfgfile, inference=True)\n', (1492, 1517), False, 'from tool import darknet2pytorch\n')... |
import pytest
from pyfasta import Fasta
import sys
sys.path.append("..")
import transcript as t2
import TranscriptClean as TC
@pytest.mark.unit
class TestInsertionCorr(object):
def test_correctable_insertion(self):
""" Toy transcript with sequence AAATTGA, where the Ts are a 2 bp insertion.
ch... | [
"sys.path.append",
"TranscriptClean.init_log_info",
"TranscriptClean.correctInsertions",
"pyfasta.Fasta",
"transcript.Transcript"
] | [((51, 72), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (66, 72), False, 'import sys\n'), ((712, 745), 'pyfasta.Fasta', 'Fasta', (['"""input_files/hg38_chr1.fa"""'], {}), "('input_files/hg38_chr1.fa')\n", (717, 745), False, 'from pyfasta import Fasta\n'), ((832, 860), 'TranscriptClean.init_log... |
"""Read status of growatt inverters."""
from __future__ import annotations
from dataclasses import dataclass
import datetime
import json
import logging
import growattServer
from homeassistant.components.sensor import (
STATE_CLASS_TOTAL_INCREASING,
SensorEntity,
SensorEntityDescription,
)
from homeassist... | [
"homeassistant.util.dt.as_utc",
"datetime.timedelta",
"homeassistant.util.Throttle",
"growattServer.GrowattApi",
"homeassistant.util.dt.now",
"datetime.datetime.combine",
"logging.getLogger"
] | [((890, 917), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (907, 917), False, 'import logging\n'), ((935, 964), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': '(1)'}), '(minutes=1)\n', (953, 964), False, 'import datetime\n'), ((29934, 29960), 'growattServer.GrowattApi', 'g... |
import requests
from icon import Icon
import favicon
class IconFinder:
def __init__(self, url, orig_url):
self.orig_url = orig_url
self.url_to_search = url
self.found = False
icons = self.find_icons_at_url()
icon = self.get_largest_icon_from_list(icons)
if self.f... | [
"favicon.get",
"icon.Icon"
] | [((345, 365), 'icon.Icon', 'Icon', (['icon', 'orig_url'], {}), '(icon, orig_url)\n', (349, 365), False, 'from icon import Icon\n'), ((497, 561), 'favicon.get', 'favicon.get', (['self.url_to_search'], {'allow_redirects': '(True)', 'timeout': '(5)'}), '(self.url_to_search, allow_redirects=True, timeout=5)\n', (508, 561),... |
from dotenv import load_dotenv
from sympy import sympify, integrate, Symbol
from sympy.solvers import solve
import config
from mbutil.autosolver import AutoSolver
from mbutil.mathml import MATHML
from mbutil.util import sanitize_input, round_res
class Solver:
@staticmethod
def __solver(function_f, function_g... | [
"sympy.Symbol",
"mbutil.autosolver.AutoSolver",
"sympy.solvers.solve",
"mbutil.mathml.MATHML",
"mbutil.util.round_res",
"dotenv.load_dotenv",
"sympy.integrate"
] | [((335, 346), 'sympy.Symbol', 'Symbol', (['"""x"""'], {}), "('x')\n", (341, 346), False, 'from sympy import sympify, integrate, Symbol\n'), ((597, 627), 'mbutil.util.round_res', 'round_res', (['area_between_curves'], {}), '(area_between_curves)\n', (606, 627), False, 'from mbutil.util import sanitize_input, round_res\n... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 25 12:30:44 2017
@author: <NAME>
"""
import pdb
import os
import keras
import h5py
from keras.models import Sequential
from keras.layers import Input, Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D, ZeroPadding2D
fr... | [
"keras.preprocessing.image.ImageDataGenerator",
"os.mkdir",
"pickle.dump",
"numpy.argmax",
"keras.preprocessing.image.img_to_array",
"pickle.load",
"keras.layers.ZeroPadding2D",
"shutil.rmtree",
"os.path.join",
"keras.layers.Flatten",
"sklearn.preprocessing.LabelEncoder",
"keras.preprocessing.... | [((4111, 4281), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rotation_range': '(360)', 'width_shift_range': '(0.1)', 'height_shift_range': '(0.1)', 'shear_range': '(0.1)', 'zoom_range': '(0.1)', 'horizontal_flip': '(False)', 'fill_mode': '"""nearest"""'}), "(rotation_range=360, width_shi... |
import dash_bootstrap_components as dbc
from dash import Input, Output, dcc, html
progress = html.Div(
[
dcc.Interval(id="progress-interval", n_intervals=0, interval=500),
dbc.Progress(id="progress"),
]
)
@app.callback(
[Output("progress", "value"), Output("progress", "label")],
[Inpu... | [
"dash.Output",
"dash_bootstrap_components.Progress",
"dash.dcc.Interval",
"dash.Input"
] | [((118, 183), 'dash.dcc.Interval', 'dcc.Interval', ([], {'id': '"""progress-interval"""', 'n_intervals': '(0)', 'interval': '(500)'}), "(id='progress-interval', n_intervals=0, interval=500)\n", (130, 183), False, 'from dash import Input, Output, dcc, html\n'), ((193, 220), 'dash_bootstrap_components.Progress', 'dbc.Pro... |
#encoding=utf-8
import pandas as pd
from get_emotion_score import get_sents_pairs_emotion_score
from get_countinfo2strs import get_lcs,get_samewords,get_length_diff
from get_keyword_overlap_rate import get_overlap_rate
from get_synonym import get_synonyms_overlap
from ESim import esim
import random
import json
import t... | [
"pandas.read_csv",
"get_countinfo2strs.get_samewords",
"get_countinfo2strs.get_lcs",
"get_keyword_overlap_rate.get_overlap_rate",
"get_synonym.get_synonyms_overlap",
"get_emotion_score.get_sents_pairs_emotion_score",
"get_countinfo2strs.get_length_diff"
] | [((441, 482), 'pandas.read_csv', 'pd.read_csv', (['testcsvfile'], {'engine': '"""python"""'}), "(testcsvfile, engine='python')\n", (452, 482), True, 'import pandas as pd\n'), ((643, 685), 'pandas.read_csv', 'pd.read_csv', (['testcsvfile2'], {'engine': '"""python"""'}), "(testcsvfile2, engine='python')\n", (654, 685), T... |
import pathlib
import warnings
import pandas as pd
def check_if_write(file_path, force, throw_warning=False):
if file_path.exists():
if force:
if throw_warning:
warnings.warn(f"{file_path} exists, overwriting")
return True
else:
if throw_warning... | [
"pandas.read_csv",
"warnings.warn",
"pandas.concat"
] | [((854, 906), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'chunksize': 'chunksize'}), '(filename, chunksize=chunksize, **kwargs)\n', (865, 906), True, 'import pandas as pd\n'), ((1029, 1046), 'pandas.concat', 'pd.concat', (['dflist'], {}), '(dflist)\n', (1038, 1046), True, 'import pandas as pd\n'), ((204, 253), '... |
from antarest.study.storage.rawstudy.model.filesystem.config.model import (
FileStudyTreeConfig,
)
from antarest.study.storage.rawstudy.model.filesystem.context import (
ContextServer,
)
from antarest.study.storage.rawstudy.model.filesystem.folder_node import (
FolderNode,
)
from antarest.study.storage.raws... | [
"antarest.study.storage.rawstudy.model.filesystem.folder_node.FolderNode.__init__"
] | [((648, 690), 'antarest.study.storage.rawstudy.model.filesystem.folder_node.FolderNode.__init__', 'FolderNode.__init__', (['self', 'context', 'config'], {}), '(self, context, config)\n', (667, 690), False, 'from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode\n')] |
import unittest
from fzfaws.utils import FileLoader
from fzfaws.s3.helper.s3transferwrapper import S3TransferWrapper
import boto3
from pathlib import Path
class TestS3TransferWrapper(unittest.TestCase):
def test_constructor(self):
fileloader = FileLoader()
config_path = Path(__file__).resolve().pa... | [
"pathlib.Path",
"fzfaws.utils.FileLoader",
"boto3.client"
] | [((258, 270), 'fzfaws.utils.FileLoader', 'FileLoader', ([], {}), '()\n', (268, 270), False, 'from fzfaws.utils import FileLoader\n'), ((459, 477), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (471, 477), False, 'import boto3\n'), ((293, 307), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n'... |
import numpy as np
from numpy.polynomial.chebyshev import Chebyshev
import matplotlib
matplotlib.rcParams = matplotlib.rc_params_from_file('../../matplotlibrc')
from solutions import nodes, get_coefs
from matplotlib import pyplot as plt
def node_project():
resolution = 513
num_of_nodes = 12
X = nodes(-1, 1... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplot",
"numpy.zeros_like",
"numpy.polynomial.chebyshev.Chebyshev",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"solutions.nodes",
"numpy.zeros",
"solutions.get_coefs",
"numpy.linspace"... | [((108, 160), 'matplotlib.rc_params_from_file', 'matplotlib.rc_params_from_file', (['"""../../matplotlibrc"""'], {}), "('../../matplotlibrc')\n", (138, 160), False, 'import matplotlib\n'), ((309, 337), 'solutions.nodes', 'nodes', (['(-1)', '(1)', '(resolution - 1)'], {}), '(-1, 1, resolution - 1)\n', (314, 337), False,... |
import argparse
import inspect
import re
import sys
import traceback
from typing import Any, Iterator, Union, Optional, TextIO, NoReturn, List, Callable, Type, Tuple
from traceback_with_variables.color import ColorScheme, ColorSchemes, supports_ansi
Patterns = Union[None, str, List[str]]
Print = Callable[... | [
"traceback_with_variables.color.supports_ansi",
"sys._getframe",
"traceback.format_exc",
"sys.exc_info",
"re.search",
"re.compile"
] | [((4351, 4367), 'sys._getframe', 'sys._getframe', (['(1)'], {}), '(1)\n', (4364, 4367), False, 'import sys\n'), ((8141, 8154), 're.compile', 're.compile', (['p'], {}), '(p)\n', (8151, 8154), False, 'import re\n'), ((3482, 3496), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (3494, 3496), False, 'import sys\n'), ((8... |
# Write module
import os
class Write(object):
'''Class that saves data to zam_export file.'''
def __init__(self):
if os.path.exists('./zam_export.csv'):
os.remove('./zam_export.csv')
self.zam_export = open('./zam_export.csv', 'w+')
else:
self.zam_export = op... | [
"os.remove",
"os.path.exists"
] | [((135, 169), 'os.path.exists', 'os.path.exists', (['"""./zam_export.csv"""'], {}), "('./zam_export.csv')\n", (149, 169), False, 'import os\n'), ((183, 212), 'os.remove', 'os.remove', (['"""./zam_export.csv"""'], {}), "('./zam_export.csv')\n", (192, 212), False, 'import os\n')] |
# %%
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['mathtext.fontset'] = 'dejavusans'
plt.style.use('seaborn-muted')
# read / process cycle data
data_f = pd.read_csv('../data/d4sorp/cycle_PCN777_D4_303.csv')
data_f["time"] = pd.to_timedelta(data_f["time"])
data_f = data_f.set_index("time")
x = li... | [
"pandas.read_csv",
"matplotlib.pyplot.style.use",
"pandas.to_timedelta",
"matplotlib.pyplot.subplots"
] | [((106, 136), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-muted"""'], {}), "('seaborn-muted')\n", (119, 136), True, 'import matplotlib.pyplot as plt\n'), ((176, 229), 'pandas.read_csv', 'pd.read_csv', (['"""../data/d4sorp/cycle_PCN777_D4_303.csv"""'], {}), "('../data/d4sorp/cycle_PCN777_D4_303.csv')\n... |
import os
import sys
import click
from lamby.src.utils import (deserialize_log, deserialize_meta, serialize_log,
serialize_meta)
@click.command('rename', short_help='rename file in commit history')
@click.argument('file_original', nargs=1)
@click.argument('file_rename', nargs=1)
def ren... | [
"click.argument",
"lamby.src.utils.deserialize_meta",
"os.path.isdir",
"os.getcwd",
"click.echo",
"click.command",
"lamby.src.utils.serialize_log",
"lamby.src.utils.serialize_meta",
"sys.exit",
"lamby.src.utils.deserialize_log"
] | [((163, 230), 'click.command', 'click.command', (['"""rename"""'], {'short_help': '"""rename file in commit history"""'}), "('rename', short_help='rename file in commit history')\n", (176, 230), False, 'import click\n'), ((232, 272), 'click.argument', 'click.argument', (['"""file_original"""'], {'nargs': '(1)'}), "('fi... |
import sys
from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QMessageBox
from buildnotifylib.app_notification import AppNotification
from buildnotifylib.app_ui import AppUi
from buildnotifylib.build_icons import BuildIcons
from buildnotifylib.config import Config
from buildnotifylib.core.projects import Proj... | [
"PyQt5.QtWidgets.QApplication",
"buildnotifylib.app_notification.AppNotification",
"PyQt5.QtWidgets.QSystemTrayIcon.isSystemTrayAvailable",
"PyQt5.QtWidgets.QMessageBox.critical",
"buildnotifylib.core.repeat_timed_event.RepeatTimedEvent",
"buildnotifylib.app_ui.AppUi",
"buildnotifylib.core.timed_event.T... | [((519, 527), 'buildnotifylib.config.Config', 'Config', ([], {}), '()\n', (525, 527), False, 'from buildnotifylib.config import Config\n'), ((597, 609), 'buildnotifylib.build_icons.BuildIcons', 'BuildIcons', ([], {}), '()\n', (607, 609), False, 'from buildnotifylib.build_icons import BuildIcons\n'), ((767, 826), 'build... |
from zope.interface import implementer
from repoze.who.interfaces import IAuthenticator
class TGAuthMetadata(object):
"""
Provides a way to lookup for user, groups and permissions
given the current identity. This has to be specialized
for each storage backend.
By default it returns empty lists fo... | [
"zope.interface.implementer"
] | [((576, 603), 'zope.interface.implementer', 'implementer', (['IAuthenticator'], {}), '(IAuthenticator)\n', (587, 603), False, 'from zope.interface import implementer\n')] |
from smooth.components.component_trailer_h2_delivery import TrailerH2Delivery
import oemof.solph as solph
def test_init():
trailer = TrailerH2Delivery({})
assert trailer.trailer_capacity > 0
assert hasattr(trailer, "current_ac")
def test_add_to_oemof_model():
trailer = TrailerH2Delivery({
"b... | [
"smooth.components.component_trailer_h2_delivery.TrailerH2Delivery",
"oemof.solph.EnergySystem",
"oemof.solph.Bus"
] | [((139, 160), 'smooth.components.component_trailer_h2_delivery.TrailerH2Delivery', 'TrailerH2Delivery', (['{}'], {}), '({})\n', (156, 160), False, 'from smooth.components.component_trailer_h2_delivery import TrailerH2Delivery\n'), ((290, 351), 'smooth.components.component_trailer_h2_delivery.TrailerH2Delivery', 'Traile... |
from django.contrib import admin
from .models import User, ActivationCode, InviteCode
admin.site.register(User)
admin.site.register(ActivationCode)
admin.site.register(InviteCode)
| [
"django.contrib.admin.site.register"
] | [((89, 114), 'django.contrib.admin.site.register', 'admin.site.register', (['User'], {}), '(User)\n', (108, 114), False, 'from django.contrib import admin\n'), ((115, 150), 'django.contrib.admin.site.register', 'admin.site.register', (['ActivationCode'], {}), '(ActivationCode)\n', (134, 150), False, 'from django.contri... |
# Copyright 2019 Google Inc. 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 law or agre... | [
"numpy.ones",
"PIL.Image.open",
"random.choice",
"numpy.load"
] | [((2549, 2600), 'random.choice', 'random.choice', (['self.imgid2modtarget[self.last_from]'], {}), '(self.imgid2modtarget[self.last_from])\n', (2562, 2600), False, 'import random\n'), ((2657, 2708), 'random.choice', 'random.choice', (['self.imgid2modtarget[self.last_from]'], {}), '(self.imgid2modtarget[self.last_from])\... |
import os
def extract_name(name):
return name.split(".")[0]
def read_lines(filename):
_file = open(os.path.join("data", "meta-data", filename), "rt")
data = _file.read().split("\n")
_file.close()
return data
def read_metadata(filename):
metadata = []
for column in read_... | [
"os.path.join"
] | [((119, 162), 'os.path.join', 'os.path.join', (['"""data"""', '"""meta-data"""', 'filename'], {}), "('data', 'meta-data', filename)\n", (131, 162), False, 'import os\n'), ((609, 642), 'os.path.join', 'os.path.join', (['"""data"""', '"""meta-data"""'], {}), "('data', 'meta-data')\n", (621, 642), False, 'import os\n')] |
# Ravestate module class
from typing import Dict, Any, Union, Iterable, Set
import inspect
from collections import defaultdict
from ravestate.constraint import Signal
from ravestate.property import Property
from ravestate.state import State
from ravestate.threadlocal import ravestate_thread_local
from reggol import ... | [
"collections.defaultdict",
"inspect.stack",
"reggol.get_logger"
] | [((340, 360), 'reggol.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'from reggol import get_logger\n'), ((725, 741), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (736, 741), False, 'from collections import defaultdict\n'), ((2009, 2024), 'inspect.stack', 'inspe... |
# Generated by Django 2.2.24 on 2021-07-26 19:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('data_templates', '0001_initial'),
('files', '0025_remove_old_file_type_choices'),
]
operations = [
... | [
"django.db.models.ForeignKey"
] | [((428, 649), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'help_text': '"""The data template version this file conforms to"""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""files"""', 'to': '"""data_templates.TemplateVersion"""'}), "(blank=Tru... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ocean_stories', '0008_auto_20150203_2337'),
]
operations = [
migrations.AddField(
model_name='oceanstorysection'... | [
"django.db.models.BooleanField"
] | [((371, 405), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (390, 405), False, 'from django.db import models, migrations\n')] |
# from plants.models import Plant
from plants.models import Location
from geoposition import Geoposition
# def run():
# a = Plant.objects.all()
# for item in a:
# if item.coordinates:
# item.geo_location = Geoposition(latitude=item.coordinates.latitude,
# ... | [
"plants.models.Location.objects.all",
"geoposition.Geoposition"
] | [((450, 472), 'plants.models.Location.objects.all', 'Location.objects.all', ([], {}), '()\n', (470, 472), False, 'from plants.models import Location\n'), ((578, 647), 'geoposition.Geoposition', 'Geoposition', ([], {'latitude': 'item.gps_latitude', 'longitude': 'item.gps_longitude'}), '(latitude=item.gps_latitude, longi... |
import waveletsui
import numpy as np
from libwise import signalutils, uiutils, plotutils, nputils, wtutils, wavelets
class WaveletFilterResponse(uiutils.Experience):
def __init__(self, wavelet_families=wavelets.get_all_wavelet_families()):
uiutils.Experience.__init__(self)
self.gui = uiutils.UI(... | [
"libwise.uiutils.VBox",
"libwise.wavelets.get_wavelet",
"libwise.plotutils.ExtendedNavigationToolbar",
"libwise.nputils.LinearFct.fit",
"numpy.logspace",
"libwise.uiutils.UI",
"libwise.uiutils.HBox",
"libwise.uiutils.Experience.__init__",
"libwise.wtutils.wavedec",
"numpy.zeros",
"libwise.plotut... | [((210, 245), 'libwise.wavelets.get_all_wavelet_families', 'wavelets.get_all_wavelet_families', ([], {}), '()\n', (243, 245), False, 'from libwise import signalutils, uiutils, plotutils, nputils, wtutils, wavelets\n'), ((256, 289), 'libwise.uiutils.Experience.__init__', 'uiutils.Experience.__init__', (['self'], {}), '(... |
import os
import shutil
import pickle
import time
import numpy as np
import torch
from os.path import join
import all_constants as ac
import utils as ut
import shutil
if torch.cuda.is_available():
torch.cuda.manual_seed(ac.SEED)
else:
torch.manual_seed(ac.SEED)
class Controller(object):
def __init__(self... | [
"os.remove",
"pickle.dump",
"torch.manual_seed",
"torch.load",
"torch.cuda.manual_seed",
"os.path.exists",
"time.time",
"numpy.argsort",
"pickle.load",
"torch.cuda.is_available",
"numpy.exp",
"utils.calc_bleu",
"utils.remove_bpe",
"torch.no_grad",
"os.path.join",
"shutil.copyfile",
"... | [((171, 196), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (194, 196), False, 'import torch\n'), ((202, 233), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['ac.SEED'], {}), '(ac.SEED)\n', (224, 233), False, 'import torch\n'), ((244, 270), 'torch.manual_seed', 'torch.manual_seed', (['a... |
import sqlite3
# Class to compare barcode readed to the database
class DatabaseComparator:
# Database File
database = None
# Database Global Connection
conn = None
# Database Global Cursor
cursor = None
# Database Global Results
db_results = None
db_prices = None
def __init... | [
"sqlite3.connect"
] | [((425, 455), 'sqlite3.connect', 'sqlite3.connect', (['self.database'], {}), '(self.database)\n', (440, 455), False, 'import sqlite3\n')] |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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... | [
"paddle.fluid.layers.reduce_mean",
"paddle.fluid.initializer.Uniform",
"paddle.fluid.layers.reshape",
"math.sqrt",
"paddle.fluid.regularizer.L2Decay",
"paddle.fluid.dygraph.nn.Pool2D",
"paddle.fluid.param_attr.ParamAttr",
"paddle.fluid.layers.elementwise_add",
"paddle.fluid.layers.dropout",
"paddl... | [((2880, 2938), 'paddle.fluid.layers.temporal_shift', 'fluid.layers.temporal_shift', (['inputs', 'self.seg_num', '(1.0 / 8)'], {}), '(inputs, self.seg_num, 1.0 / 8)\n', (2907, 2938), True, 'import paddle.fluid as fluid\n'), ((3152, 3210), 'paddle.fluid.layers.elementwise_add', 'fluid.layers.elementwise_add', ([], {'x':... |
# Generated by Django 2.2 on 2019-04-29 19:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0029_phone'),
]
operations = [
migrations.CreateModel(
name='Agriculture_Suggestion',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.AutoField"
] | [((328, 421), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (344, 421), False, 'from django.db import migrations, models\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Methods common to other files in Clippy.
"""
import inspect
import os
import re
import ast
from ast import FunctionDef, Module, stmt
from inspect import FrameInfo
from types import ModuleType
from typing import Callable, Iterable, List, Optional, Tuple, Dict, Any
de... | [
"os.path.isdir",
"os.path.exists",
"inspect.getmodule",
"inspect.signature",
"re.search",
"inspect.stack",
"re.sub"
] | [((2334, 2357), 'os.path.isdir', 'os.path.isdir', (['filename'], {}), '(filename)\n', (2347, 2357), False, 'import os\n'), ((5267, 5300), 'inspect.getmodule', 'inspect.getmodule', (['stack_frame[0]'], {}), '(stack_frame[0])\n', (5284, 5300), False, 'import inspect\n'), ((2244, 2268), 'os.path.exists', 'os.path.exists',... |
from django import forms
class NameForm(forms.Form):
data_name = forms.CharField(label='dropdown1', max_length=100)
| [
"django.forms.CharField"
] | [((70, 120), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""dropdown1"""', 'max_length': '(100)'}), "(label='dropdown1', max_length=100)\n", (85, 120), False, 'from django import forms\n')] |
from datetime import datetime
import logging
import os
import shutil
import unittest
import cache_requests
from lxml import html
from predictivepunter.scrape import ScrapeProcessor
import pymongo
import pypunters
class ScrapeProcessorTest(unittest.TestCase):
def test_scrape(self):
"""The scrape method should pop... | [
"pymongo.MongoClient",
"os.path.isdir",
"datetime.datetime",
"predictivepunter.scrape.ScrapeProcessor",
"shutil.rmtree"
] | [((930, 959), 'os.path.isdir', 'os.path.isdir', (['dump_directory'], {}), '(dump_directory)\n', (943, 959), False, 'import os\n'), ((1009, 1041), 'predictivepunter.scrape.ScrapeProcessor', 'ScrapeProcessor', ([], {}), '(**configuration)\n', (1024, 1041), False, 'from predictivepunter.scrape import ScrapeProcessor\n'), ... |
"""
Functions for taxonomic management
"""
from flask_restful import Resource
import requests
import random
import re
import json
import os
import psycopg2
from psycopg2 import sql
import psycopg2.extras
from io import BytesIO
from flask import send_file
from fuzzywuzzy import fuzz
from manageStatus import manageSourc... | [
"errors_def.MissingArgError",
"re.sub",
"requests.get"
] | [((1081, 1098), 'requests.get', 'requests.get', (['api'], {}), '(api)\n', (1093, 1098), False, 'import requests\n'), ((1676, 1693), 'requests.get', 'requests.get', (['api'], {}), '(api)\n', (1688, 1693), False, 'import requests\n'), ((2322, 2339), 'requests.get', 'requests.get', (['api'], {}), '(api)\n', (2334, 2339), ... |
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar
import attr
from ..models.edge import Edge
from ..models.family import Family
from ..models.node import Node
from ..types import UNSET
from ..util.serialization import is_not_none
T = TypeVar("T", bound="Architecture")
@attr.s(auto_attribs=True)... | [
"attr.s",
"typing.TypeVar"
] | [((257, 291), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""Architecture"""'}), "('T', bound='Architecture')\n", (264, 291), False, 'from typing import Any, Callable, Dict, List, Optional, Type, TypeVar\n'), ((295, 320), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (301, 320... |
import os
import config
import modules
import time
import sys
import time
import logging
from threading import Thread
from fs import Filesystem
#This function loads all the modules and returns an array with every module
def load_modules():
runtime_modules = []
for m in modules.start:
runtime_modules.a... | [
"fs.Filesystem",
"threading.Thread",
"os.remove",
"sys.argv.pop",
"time.sleep",
"os.umask",
"os.path.isfile",
"os.setsid",
"os.fork",
"os.mkfifo",
"sys.stderr.write",
"sys.exit"
] | [((3836, 3847), 'os.setsid', 'os.setsid', ([], {}), '()\n', (3845, 3847), False, 'import os\n'), ((3853, 3864), 'os.umask', 'os.umask', (['(0)'], {}), '(0)\n', (3861, 3864), False, 'import os\n'), ((4167, 4201), 'fs.Filesystem', 'Filesystem', (["('%s' % config.BASEPATH)"], {}), "('%s' % config.BASEPATH)\n", (4177, 4201... |
'''
Real-time detection
Given a real-time stream of input, it runs the detector and stores the timestamped output
'''
import argparse, json, pickle
from os.path import join, isfile, basename
from glob import glob
from time import perf_counter
from tqdm import tqdm
import numpy as np
import torch
from pycocotools.c... | [
"torch.cuda.synchronize",
"tqdm.tqdm",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.floor",
"numpy.zeros",
"sys.path.insert",
"util.print_stats",
"torch.cuda.device_count",
"util.mkdir2",
"time.perf_counter",
"pycocotools.coco.COCO",
"det.det_apis.init_detector",
"os.path.isfile",
... | [((444, 468), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (459, 468), False, 'import sys\n'), ((470, 493), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (485, 493), False, 'import sys\n'), ((664, 689), 'argparse.ArgumentParser', 'argparse.ArgumentParse... |
import json
import random
import re
import string
import sys
import time
from .async_run import *
from .binhex import to_bin, to_hex
from .cls_init import MetaClassForInit
from .pagination import pagination_calc
from .state_obj import StateObject
from .myobjectid import ObjectID
from .customid import CustomID
try:
... | [
"json.loads",
"random.choice",
"time.strftime",
"time.time",
"re.compile"
] | [((527, 541), 're.compile', 're.compile', (['""""""'], {}), "('')\n", (537, 541), False, 'import re\n'), ((1311, 1348), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d %H:%M:%S"""', 'x'], {}), "('%Y-%m-%d %H:%M:%S', x)\n", (1324, 1348), False, 'import time\n'), ((1287, 1298), 'time.time', 'time.time', ([], {}), '()\n'... |
#coding=utf-8
from __future__ import print_function
from future.utils import lmap, lfilter
import matplotlib
matplotlib.use('Agg') # reset matplotlib
from chart.data_loader import NormalDataLoader, PivotTableDataLoader
from exceptions import FigureToolException
from matplotlib import pyplot as plt
from matplotlib.tick... | [
"chart.data_loader.NormalDataLoader",
"matplotlib.pyplot.clf",
"numpy.arange",
"matplotlib.pyplot.gca",
"matplotlib.ticker.ScalarFormatter",
"json.loads",
"matplotlib.pyplot.close",
"matplotlib.ticker.FixedLocator",
"matplotlib.pyplot.rcParams.update",
"chart.data_loader.PivotTableDataLoader",
"... | [((109, 130), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (123, 130), False, 'import matplotlib\n'), ((3433, 3465), 're.sub', 're.sub', (['"""\\\\\\\\\\\\n"""', '""""""', 'input_str'], {}), "('\\\\\\\\\\\\n', '', input_str)\n", (3439, 3465), False, 'import re\n'), ((3484, 3518), 're.sub', 're.... |
"""Config flow to configure the SimpliSafe component."""
from __future__ import annotations
import asyncio
from collections.abc import Mapping
from typing import Any
import async_timeout
from simplipy import API
from simplipy.api import AuthStates
from simplipy.errors import InvalidCredentialsError, SimplipyError, Ve... | [
"asyncio.sleep",
"voluptuous.Required",
"async_timeout.timeout",
"simplipy.API.async_from_credentials",
"homeassistant.helpers.aiohttp_client.async_get_clientsession"
] | [((850, 877), 'voluptuous.Required', 'vol.Required', (['CONF_PASSWORD'], {}), '(CONF_PASSWORD)\n', (862, 877), True, 'import voluptuous as vol\n'), ((947, 970), 'voluptuous.Required', 'vol.Required', (['CONF_CODE'], {}), '(CONF_CODE)\n', (959, 970), True, 'import voluptuous as vol\n'), ((1037, 1064), 'voluptuous.Requir... |
import pytest
import numpy as np
from numpy.testing import assert_array_almost_equal
from tests.conftest import ds_config
from sm.engine.annotation.isocalc_wrapper import IsocalcWrapper
@pytest.mark.parametrize('formula, adduct', [('', '+H'), ('Np', '+H'), ('4Sn', '+K'), ('C4', '-H')])
def test_centroids_wrong_formu... | [
"sm.engine.annotation.isocalc_wrapper.IsocalcWrapper",
"pytest.mark.parametrize",
"numpy.array"
] | [((190, 294), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""formula, adduct"""', "[('', '+H'), ('Np', '+H'), ('4Sn', '+K'), ('C4', '-H')]"], {}), "('formula, adduct', [('', '+H'), ('Np', '+H'), (\n '4Sn', '+K'), ('C4', '-H')])\n", (213, 294), False, 'import pytest\n'), ((507, 585), 'pytest.mark.paramet... |
from more_itertools import windowed, first_true
data = map(int, open('d9.txt'))
windowed_data = windowed(data, 26)
def sum2(window, target):
return all(e1 + e2 != target for e1 in window for e2 in window)
def pred(datum):
*window, target = datum
return sum2(window, target)
print(first_true(windowed_data, pr... | [
"more_itertools.windowed",
"more_itertools.first_true"
] | [((96, 114), 'more_itertools.windowed', 'windowed', (['data', '(26)'], {}), '(data, 26)\n', (104, 114), False, 'from more_itertools import windowed, first_true\n'), ((292, 328), 'more_itertools.first_true', 'first_true', (['windowed_data'], {'pred': 'pred'}), '(windowed_data, pred=pred)\n', (302, 328), False, 'from mor... |
# -*- coding: utf-8 -*-
from openprocurement.tender.core.utils import optendersresource
from openprocurement.tender.openeu.views.bid_document import TenderEUBidDocumentResource
from openprocurement.tender.openeu.utils import (
bid_financial_documents_resource,
bid_eligibility_documents_resource,
bid_qualifi... | [
"openprocurement.tender.openeu.utils.bid_eligibility_documents_resource",
"openprocurement.tender.openeu.utils.bid_qualification_documents_resource",
"openprocurement.tender.core.utils.optendersresource",
"openprocurement.tender.openeu.utils.bid_financial_documents_resource"
] | [((352, 622), 'openprocurement.tender.core.utils.optendersresource', 'optendersresource', ([], {'name': '"""esco:Tender Bid Documents"""', 'collection_path': '"""/tenders/{tender_id}/bids/{bid_id}/documents"""', 'path': '"""/tenders/{tender_id}/bids/{bid_id}/documents/{document_id}"""', 'procurementMethodType': '"""esc... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 17:14:42 2020
@author: lutra
CREATE TABLE "Phage_like_plasmids_SSU5_P1_D6" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
"nucleotide" TEXT,
"biosample" TEXT,
"organism" TEXT,
"completeness" TEXT,
"genome" TEXT,
"slen" INTEGER,... | [
"PLP_main_functions.find_overlaps",
"csv_in_tables_to_sqlite3.csv_to_sqlite3",
"os.remove",
"glob.glob"
] | [((1388, 1413), 'glob.glob', 'glob.glob', (["(annotate + '*')"], {}), "(annotate + '*')\n", (1397, 1413), False, 'import glob\n'), ((1462, 1487), 'glob.glob', 'glob.glob', (["(coverage + '*')"], {}), "(coverage + '*')\n", (1471, 1487), False, 'import glob\n'), ((10311, 10362), 'csv_in_tables_to_sqlite3.csv_to_sqlite3',... |
from django.db import models
class PortmonePayment(models.Model):
created = models.DateTimeField(auto_now=True)
shopOrderNumber = models.CharField(unique=True, editable=False, max_length=255)
def __str__(self):
return 'Portmone payment (shopOrderNumber: {})'.format(self.shopOrderNumber)
| [
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((83, 118), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (103, 118), False, 'from django.db import models\n'), ((141, 202), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'editable': '(False)', 'max_length': '(255)'}), '(uniqu... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from sqlalchemy.exc import IntegrityError
from h.models import AuthClient
from h.models.auth_client import GrantType
class TestAuthClient(object):
def test_has_id(self, client):
assert client.id
def test_does_not_allow_e... | [
"pytest.raises",
"pytest.mark.parametrize",
"h.models.AuthClient"
] | [((642, 757), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""grant_type"""', '[GrantType.client_credentials, GrantType.jwt_bearer, GrantType.password]'], {}), "('grant_type', [GrantType.client_credentials,\n GrantType.jwt_bearer, GrantType.password])\n", (665, 757), False, 'import pytest\n'), ((1104, 11... |
"""Implementation of Linear Dynamical Models."""
import torch
from torch.distributions import MultivariateNormal
from .abstract_model import AbstractModel
class LinearModel(AbstractModel):
"""A linear Gaussian state space model."""
def __init__(self, a, b, noise: MultivariateNormal = None, *args, **kwargs):... | [
"torch.zeros",
"torch.get_default_dtype"
] | [((1622, 1636), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (1633, 1636), False, 'import torch\n'), ((403, 428), 'torch.get_default_dtype', 'torch.get_default_dtype', ([], {}), '()\n', (426, 428), False, 'import torch\n'), ((512, 537), 'torch.get_default_dtype', 'torch.get_default_dtype', ([], {}), '()\n', (5... |
#!/usr/bin/python
# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Integration test to test the basic functionality of cros flash/deploy.
This module contains a test that runs some sanity integra... | [
"logging.error",
"logging.warning",
"chromite.lib.vm.VMInstance",
"logging.info",
"chromite.lib.vm.CreateVMImage",
"chromite.lib.commandline.ArgumentParser",
"chromite.lib.cros_build_lib.RunCommand",
"chromite.lib.remote_access.ChromiumOSDeviceHandler"
] | [((5621, 5661), 'chromite.lib.commandline.ArgumentParser', 'commandline.ArgumentParser', ([], {'caching': '(True)'}), '(caching=True)\n', (5647, 5661), False, 'from chromite.lib import commandline\n'), ((5951, 5991), 'logging.info', 'logging.info', (['"""Starting cros_vm_test..."""'], {}), "('Starting cros_vm_test...')... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2021 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Engine-Snakemake executor."""
import os
import subprocess
import logging
fr... | [
"snakemake.snakemake",
"reana_commons.utils.build_progress_message",
"subprocess.check_output",
"snakemake.logging.logger.info",
"snakemake.logging.logger.error",
"collections.namedtuple",
"os.path.join",
"os.getenv",
"logging.getLogger"
] | [((725, 758), 'logging.getLogger', 'logging.getLogger', (['LOGGING_MODULE'], {}), '(LOGGING_MODULE)\n', (742, 758), False, 'import logging\n'), ((779, 881), 'collections.namedtuple', 'namedtuple', (['"""REANAClusterJob"""', '"""job jobid callback error_callback jobscript jobfinished jobfailed"""'], {}), "('REANACluster... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import platform
from toolService import ToolService
class Singleton(type):
def __init__(self, name, bases, dictItem):
super(Singleton,self).__init__(name,bases, dictItem)
self._instance = None
def __call__(self, *args, **kwargs):
... | [
"os.path.join",
"os.getcwd",
"os.path.exists",
"platform.machine",
"toolService.ToolService"
] | [((949, 960), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (958, 960), False, 'import os\n'), ((1106, 1150), 'os.path.join', 'os.path.join', (['DataService.root_path', 'relpath'], {}), '(DataService.root_path, relpath)\n', (1118, 1150), False, 'import os\n'), ((1249, 1262), 'toolService.ToolService', 'ToolService', ([],... |
from python_graphql_client import GraphqlClient
import pathlib
import re
import os
root = pathlib.Path(__file__).parent.resolve()
client = GraphqlClient(endpoint="https://graphql.anilist.co")
TOKEN = os.environ.get("ANILIST_TOKEN", "")
def replace_chunk(content, marker, chunk, inline=False):
r = re.compile(
... | [
"os.environ.get",
"pathlib.Path",
"python_graphql_client.GraphqlClient"
] | [((140, 192), 'python_graphql_client.GraphqlClient', 'GraphqlClient', ([], {'endpoint': '"""https://graphql.anilist.co"""'}), "(endpoint='https://graphql.anilist.co')\n", (153, 192), False, 'from python_graphql_client import GraphqlClient\n'), ((204, 239), 'os.environ.get', 'os.environ.get', (['"""ANILIST_TOKEN"""', '"... |
from care.base.views import BaseView
from care.groupaccount.models import GroupAccount
from care.groupaccountinvite.models import GroupAccountInvite
from care. groupaccountinvite.forms import NewInviteForm
from care.userprofile.models import UserProfile
from care.base import emailserver
from django.views.generic.edit ... | [
"care.userprofile.models.UserProfile.objects.get",
"care.groupaccountinvite.models.GroupAccountInvite.objects.get",
"care.groupaccountinvite.models.GroupAccountInvite.get_invites_sent",
"care.base.emailserver.send_invite_email",
"care.groupaccount.models.GroupAccount.objects.get",
"logging.getLogger",
"... | [((361, 388), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (378, 388), False, 'import logging\n'), ((1277, 1335), 'care.groupaccountinvite.models.GroupAccountInvite.objects.get', 'GroupAccountInvite.objects.get', ([], {'id': "self.kwargs['inviteId']"}), "(id=self.kwargs['inviteId'])\n",... |
import numpy as np
from scipy.special import logsumexp
from opt_einsum import contract_path
from collections import deque
import itertools
import yaml
from timeit import default_timer as timer
__all__ = [ 'log_einsum_np', 'log_einsum_path' ]
############################################################################... | [
"numpy.sum",
"opt_einsum.contract_path",
"numpy.empty",
"numpy.allclose",
"numpy.einsum",
"numpy.sin",
"scipy.special.logsumexp",
"numpy.random.rand"
] | [((444, 464), 'numpy.sum', 'np.sum', (['x'], {'axis': 'axis'}), '(x, axis=axis)\n', (450, 464), True, 'import numpy as np\n'), ((552, 575), 'scipy.special.logsumexp', 'logsumexp', (['x'], {'axis': 'axis'}), '(x, axis=axis)\n', (561, 575), False, 'from scipy.special import logsumexp\n'), ((1192, 1257), 'opt_einsum.contr... |
#!/usr/bin/env python3.7
# -*- coding:utf-8 -*-
import json
import requests
import hashlib
import time
import random
import os
import sys
# reload(sys)
# sys.setdefaultencoding("UTF-8")
# 游可赢平台腾讯游戏收入信息
secure_key = '<KEY>'
start_date = sys.argv[1]
end_date = start_date
account_id = '1016'
userurl = 'https://api.yky... | [
"os.remove",
"random.randint",
"json.loads",
"os.makedirs",
"os.path.dirname",
"os.path.exists",
"time.time",
"requests.get"
] | [((795, 821), 'requests.get', 'requests.get', (['url', 'headers'], {}), '(url, headers)\n', (807, 821), False, 'import requests\n'), ((838, 858), 'json.loads', 'json.loads', (['res.text'], {}), '(res.text)\n', (848, 858), False, 'import json\n'), ((874, 900), 'os.path.dirname', 'os.path.dirname', (['file_name'], {}), '... |
import core
app = core.App()
core.set_api_path(__path__)
| [
"core.App",
"core.set_api_path"
] | [((19, 29), 'core.App', 'core.App', ([], {}), '()\n', (27, 29), False, 'import core\n'), ((30, 57), 'core.set_api_path', 'core.set_api_path', (['__path__'], {}), '(__path__)\n', (47, 57), False, 'import core\n')] |
from owslib.fes import PropertyIsEqualTo, PropertyIsGreaterThanOrEqualTo, PropertyIsLessThan, And, OgcExpression
from owslib.wfs import WebFeatureService
from owslib.etree import etree
import pandas as pd
class Synop:
def __init__(self):
self.wfs = WebFeatureService(url='https://opendata.meteo.be/servic... | [
"pandas.read_csv",
"owslib.fes.PropertyIsGreaterThanOrEqualTo",
"owslib.fes.PropertyIsEqualTo",
"pandas.to_datetime",
"owslib.wfs.WebFeatureService",
"owslib.fes.PropertyIsLessThan",
"owslib.fes.And"
] | [((265, 354), 'owslib.wfs.WebFeatureService', 'WebFeatureService', ([], {'url': '"""https://opendata.meteo.be/service/synop/wfs"""', 'version': '"""1.1.0"""'}), "(url='https://opendata.meteo.be/service/synop/wfs',\n version='1.1.0')\n", (282, 354), False, 'from owslib.wfs import WebFeatureService\n'), ((934, 955), '... |
from time import mktime, strftime, localtime, strptime
def gen_comparing_time(hour, minute, second):
lt = localtime()
st = "%s %s %s %d:%d:%d" %(
strftime("%d", lt),
strftime("%m", lt),
strftime("%Y", lt),
hour,
minute,
second)
t = strptime(st, "%d %m %Y %H... | [
"time.mktime",
"time.strptime",
"time.strftime",
"time.localtime"
] | [((112, 123), 'time.localtime', 'localtime', ([], {}), '()\n', (121, 123), False, 'from time import mktime, strftime, localtime, strptime\n'), ((295, 328), 'time.strptime', 'strptime', (['st', '"""%d %m %Y %H:%M:%S"""'], {}), "(st, '%d %m %Y %H:%M:%S')\n", (303, 328), False, 'from time import mktime, strftime, localtim... |
import bisect
from collections import namedtuple
from scipy.spatial.distance import euclidean
NO_QUADRANT = -1
NORTH_WEST = 1
NORTH_EAST = 2
SOUTH_EAST = 3
SOUTH_WEST = 4
# Constants for tuple access optimzation
CENTER = 0
DIMENSION = 1
X = 0
Y = 1
Point = namedtuple('Point', ['x', 'y'])
Boundary = namedtuple('Boun... | [
"bisect.insort",
"collections.namedtuple",
"scipy.spatial.distance.euclidean"
] | [((261, 292), 'collections.namedtuple', 'namedtuple', (['"""Point"""', "['x', 'y']"], {}), "('Point', ['x', 'y'])\n", (271, 292), False, 'from collections import namedtuple\n'), ((304, 351), 'collections.namedtuple', 'namedtuple', (['"""Boundary"""', "['center', 'dimension']"], {}), "('Boundary', ['center', 'dimension'... |
# -*- coding: utf-8 -*-
from pyleecan.Classes.OutGeo import OutGeo
def comp_output_geo(self):
"""Compute the main geometry output
Parameters
----------
self : Machine
A Machine object
Returns
-------
output: OutGeo
Main geometry output of the machine
"""
output... | [
"pyleecan.Classes.OutGeo.OutGeo"
] | [((323, 331), 'pyleecan.Classes.OutGeo.OutGeo', 'OutGeo', ([], {}), '()\n', (329, 331), False, 'from pyleecan.Classes.OutGeo import OutGeo\n')] |
from decouple import config
import tweepy
class TwitterBot:
""" Class responsible to receive and send messages using Twitter
Usage Example:
bot = TwitterBot()
bot.send_text('hello world')
"""
def __init__(self: object) -> None:
auth = tweepy.OAuthHandler(
config... | [
"decouple.config",
"tweepy.API"
] | [((558, 574), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (568, 574), False, 'import tweepy\n'), ((314, 344), 'decouple.config', 'config', (['"""twitter_consumer_key"""'], {}), "('twitter_consumer_key')\n", (320, 344), False, 'from decouple import config\n'), ((358, 391), 'decouple.config', 'config', (['"""... |
# -*- coding: utf-8 -*-
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | [
"oslo_utils.reflection.get_callable_args",
"taskflow.utils.misc.clamp",
"oslo_utils.reflection.get_class_name",
"copy.copy",
"six.moves.map",
"six.callable",
"six.add_metaclass",
"taskflow.utils.misc.is_iterable",
"six.moves.reduce",
"taskflow.logging.getLogger",
"oslo_utils.reflection.get_calla... | [((1073, 1100), 'taskflow.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1090, 1100), False, 'from taskflow import logging\n'), ((1346, 1376), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (1363, 1376), False, 'import six\n'), ((2640, 2685), 'taskflow... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-01-30 12:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0002_auto_20161026_1036'),
]
operation... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.PositiveSmallIntegerField"
] | [((435, 462), 'django.db.models.DateField', 'models.DateField', ([], {'null': '(True)'}), '(null=True)\n', (451, 462), False, 'from django.db import migrations, models\n'), ((586, 692), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'choices': "[(0, 'no repeat'), (1, 'weekly'), ... |
# Copyright 2014: Mirantis Inc.
# 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 b... | [
"rally.exceptions.NoNodesFound",
"rally.deploy.fuel.fuelclient.FuelClient",
"rally.openstack.common.gettextutils._",
"rally.objects.Endpoint",
"rally.objects.Deployment.delete_resource",
"rally.exceptions.UnknownRelease"
] | [((3936, 3993), 'rally.exceptions.UnknownRelease', 'exceptions.UnknownRelease', ([], {'release': "self.config['release']"}), "(release=self.config['release'])\n", (3961, 3993), False, 'from rally import exceptions\n'), ((4039, 4084), 'rally.deploy.fuel.fuelclient.FuelClient', 'fuelclient.FuelClient', (["self.config['ap... |
from __future__ import unicode_literals
import pytest
from taxi.projects import Activity, Project, ProjectsDb
@pytest.fixture
def projects_db(data_dir):
projects_db = ProjectsDb(str(data_dir))
projects_list = []
project = Project(42, 'not started project',
Project.STATUS_NOT_START... | [
"taxi.projects.Project",
"taxi.projects.Activity"
] | [((239, 301), 'taxi.projects.Project', 'Project', (['(42)', '"""not started project"""', 'Project.STATUS_NOT_STARTED'], {}), "(42, 'not started project', Project.STATUS_NOT_STARTED)\n", (246, 301), False, 'from taxi.projects import Activity, Project, ProjectsDb\n'), ((402, 454), 'taxi.projects.Project', 'Project', (['(... |
#!/usr/bin/env python
"""
Demonstrate the chase function from holiday.py
Copyright (c) 2013 <NAME> <<EMAIL>>
License: MIT (see LICENSE for details)
"""
__author__ = "<NAME>"
__version__ = '0.01-dev'
__license__ = "MIT"
import sys
import time
import logging
import holiday
# Simulator default address
SIM_ADDR = "loc... | [
"logging.StreamHandler",
"time.sleep",
"logging.Formatter",
"holiday.Holiday",
"logging.getLogger"
] | [((340, 370), 'logging.getLogger', 'logging.getLogger', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (357, 370), False, 'import logging\n'), ((381, 404), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (402, 404), False, 'import logging\n'), ((426, 497), 'logging.Formatter', 'logging.Formatter', (['"""... |
import os
import re
import json
from collections import Counter, namedtuple, defaultdict
import pickle
from tqdm import tqdm
import torch
from torch.nn.utils.rnn import pad_sequence
import nltk
from pytorch_pretrained_bert import BertTokenizer
Element = namedtuple('Element', ['id', 'text', 'author', 'timestep'])
... | [
"tqdm.tqdm",
"pickle.dump",
"nltk.tokenize.word_tokenize",
"json.loads",
"pytorch_pretrained_bert.BertTokenizer.from_pretrained",
"collections.defaultdict",
"os.path.isfile",
"pickle.load",
"collections.namedtuple",
"re.search",
"collections.Counter",
"torch.nn.utils.rnn.pad_sequence",
"os.p... | [((259, 318), 'collections.namedtuple', 'namedtuple', (['"""Element"""', "['id', 'text', 'author', 'timestep']"], {}), "('Element', ['id', 'text', 'author', 'timestep'])\n", (269, 318), False, 'from collections import Counter, namedtuple, defaultdict\n'), ((6608, 6683), 'torch.nn.utils.rnn.pad_sequence', 'pad_sequence'... |
# -*- coding: utf-8 -*-
# Copyright FMR LLC <<EMAIL>>
# SPDX-License-Identifier: Apache-2.0
"""Handles FP16/mixed-precision related classes -- mixin style"""
from abc import ABC
from contextlib import nullcontext
from enum import Enum
from typing import List, Optional, Tuple, Union
import torch
from fairscale.optim... | [
"torch.cuda.amp.autocast",
"apex.amp.initialize",
"apex.amp.master_params",
"apex.amp.scale_loss",
"apex.parallel.convert_syncbn_model",
"contextlib.nullcontext"
] | [((7996, 8009), 'contextlib.nullcontext', 'nullcontext', ([], {}), '()\n', (8007, 8009), False, 'from contextlib import nullcontext\n'), ((8135, 8148), 'contextlib.nullcontext', 'nullcontext', ([], {}), '()\n', (8146, 8148), False, 'from contextlib import nullcontext\n'), ((19077, 19410), 'apex.amp.initialize', 'amp.in... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 19 11:37:05 2018
@author: <NAME>
"""
import numpy as np
import pandas as pd
## Description of the collection of functions
def checkSpacing(iterator):
iterator=np.asarray(iterator)
return len(set(iterator)) <= 1 #set builds an unordered collection of unique elem... | [
"pandas.DataFrame",
"numpy.asarray",
"numpy.linspace"
] | [((214, 234), 'numpy.asarray', 'np.asarray', (['iterator'], {}), '(iterator)\n', (224, 234), True, 'import numpy as np\n'), ((659, 682), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'data'}), '(data=data)\n', (671, 682), True, 'import pandas as pd\n'), ((729, 789), 'numpy.linspace', 'np.linspace', (['(0)', '(times... |
import logging
from django.contrib.auth.models import User
from rest_framework import viewsets, permissions, status, generics
from rest_framework.response import Response
from social_django.utils import load_backend, load_strategy
from shotclock import models, serializers
logger = logging.Logger(__name__)
... | [
"logging.Logger",
"rest_framework.response.Response",
"social_django.utils.load_strategy",
"shotclock.serializers.UserSerializer",
"social_django.utils.load_backend",
"shotclock.models.MusicProfile.objects.all",
"shotclock.models.PowerHour.objects.all",
"django.contrib.auth.models.User.objects.all"
] | [((292, 316), 'logging.Logger', 'logging.Logger', (['__name__'], {}), '(__name__)\n', (306, 316), False, 'import logging\n'), ((517, 535), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (533, 535), False, 'from django.contrib.auth.models import User\n'), ((651, 684), 'shotclock.mod... |
# Copyright 2021, joshiayus Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | [
"linkedin.driver.GetGlobalChromeDriverInstance",
"time.sleep"
] | [((2466, 2479), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2476, 2479), False, 'import time\n'), ((2231, 2269), 'linkedin.driver.GetGlobalChromeDriverInstance', 'driver.GetGlobalChromeDriverInstance', ([], {}), '()\n', (2267, 2269), False, 'from linkedin import driver\n'), ((2369, 2407), 'linkedin.driver.GetG... |
import spacy
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
import json
import logging
logger = logging.getLogger("data_transform")
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler = logging.FileHandler('./logs/app... | [
"nltk.tokenize.RegexpTokenizer",
"json.load",
"logging.FileHandler",
"logging.StreamHandler",
"logging.Formatter",
"spacy.load",
"nltk.corpus.stopwords.words",
"logging.getLogger"
] | [((126, 161), 'logging.getLogger', 'logging.getLogger', (['"""data_transform"""'], {}), "('data_transform')\n", (143, 161), False, 'import logging\n'), ((204, 277), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'], {}), "('%(asctime)s - %(name)s - %(levelname)s -... |
#!/usr/bin/env python3
from argparse import ArgumentParser, FileType
# Process an MDHC CSV input file.
def cleanup(args):
''' Main loop for cleanup'''
for line in args.infile:
# strip out BOM
line = line.replace('\ufeff', '')
# Add EOL if missing
if line[-1:] != '\n':
... | [
"argparse.ArgumentParser",
"argparse.FileType"
] | [((485, 501), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (499, 501), False, 'from argparse import ArgumentParser, FileType\n'), ((589, 620), 'argparse.FileType', 'FileType', (['"""r"""'], {'encoding': '"""UTF-8"""'}), "('r', encoding='UTF-8')\n", (597, 620), False, 'from argparse import ArgumentPars... |
from robodk.robolink import *
from robodk.robodialogs import *
from robodk.robofileio import *
import os
import glob
# ---------------------------
# Start the RoboDK API
RDK = Robolink()
# Avoid rendering after each step (faster)
RDK.Render(False)
# Select the first robot available
robot = RDK.Item('', ITEM_TYPE_ROB... | [
"glob.glob"
] | [((1039, 1072), 'glob.glob', 'glob.glob', (["(PATH_FOLDER + '/*.apt')"], {}), "(PATH_FOLDER + '/*.apt')\n", (1048, 1072), False, 'import glob\n')] |
# InfiniTag Copyright © 2020 AMOS-5
# 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, publish, dist... | [
"app.app.run"
] | [((1141, 1175), 'app.app.run', 'app.run', ([], {'host': '"""0.0.0.0"""', 'port': '(5000)'}), "(host='0.0.0.0', port=5000)\n", (1148, 1175), False, 'from app import app\n')] |
import tempfile
import boto3
from models.File import File
class S3Handler(object):
"""
The S3Handler Class provides method to handle Amazon web service,
has methods to upload an download files and set parameters for Amazon S3.
"""
def __init__(self, bucket_name, region, profile=None):
"""... | [
"tempfile.NamedTemporaryFile",
"boto3.Session"
] | [((963, 998), 'boto3.Session', 'boto3.Session', ([], {'profile_name': 'profile'}), '(profile_name=profile)\n', (976, 998), False, 'import boto3\n'), ((1040, 1055), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (1053, 1055), False, 'import boto3\n'), ((2612, 2641), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTem... |
from __future__ import print_function
from random import randint
# --------------- Main handler ------------------
def lambda_handler(event, context):
""" Route the incoming request based on type (LaunchRequest, IntentRequest,
etc.) The JSON body of the request is provided in the event parameter.
"""
... | [
"random.randint"
] | [((6370, 6385), 'random.randint', 'randint', (['(18)', '(27)'], {}), '(18, 27)\n', (6377, 6385), False, 'from random import randint\n'), ((9213, 9226), 'random.randint', 'randint', (['(1)', '(3)'], {}), '(1, 3)\n', (9220, 9226), False, 'from random import randint\n'), ((9404, 9417), 'random.randint', 'randint', (['(1)'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models import resnet18, resnet50
from tamil_tech.torch.layers import *
from tamil_tech.torch.encoders import *
from tamil_tech.torch.decoders import *
# class CustomCNNbiRNN(nn.Module):
# """
# ASR Model similar to Deep Speech
... | [
"torch.nn.Dropout",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.init.xavier_uniform_",
"torch.nn.GELU",
"torch.nn.Linear"
] | [((1891, 1941), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(32)', '(3)'], {'stride': 'stride', 'padding': '(3 // 2)'}), '(1, 32, 3, stride=stride, padding=3 // 2)\n', (1900, 1941), True, 'import torch.nn as nn\n'), ((2155, 2187), 'torch.nn.Linear', 'nn.Linear', (['(n_feats * 32)', 'rnn_dim'], {}), '(n_feats * 32, rnn_di... |
import random
import pytest
from telisar.bot.plugins import roll
from conftest import msg_factory
@pytest.fixture
def plugin():
return roll.Roll()
@pytest.mark.parametrize('message', [
msg_factory('.roll 0d0'),
msg_factory('.roll 0d1'),
msg_factory('.roll 1d0'),
msg_factory('.roll -3d'),
m... | [
"conftest.msg_factory",
"telisar.bot.plugins.roll.Roll",
"random.randint"
] | [((143, 154), 'telisar.bot.plugins.roll.Roll', 'roll.Roll', ([], {}), '()\n', (152, 154), False, 'from telisar.bot.plugins import roll\n'), ((199, 223), 'conftest.msg_factory', 'msg_factory', (['""".roll 0d0"""'], {}), "('.roll 0d0')\n", (210, 223), False, 'from conftest import msg_factory\n'), ((229, 253), 'conftest.m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.