code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
# import unittest
import numpy as np
import femnurbs.SplineUsefulFunctions as SUF
def test_isValidU():
with pytest.raises(TypeError):
SUF.isValidU()
assert SUF.isValidU(0) is False
assert SUF.isValidU(1.2) is False
assert SUF.isValidU({}) is False
assert SUF.isV... | [
"numpy.eye",
"femnurbs.SplineUsefulFunctions.getNfromU",
"femnurbs.SplineUsefulFunctions.transformHtoSides",
"numpy.ones",
"femnurbs.SplineUsefulFunctions.transformUtoH",
"femnurbs.SplineUsefulFunctions.isDiagonalDominant",
"femnurbs.SplineUsefulFunctions.isValidU",
"femnurbs.SplineUsefulFunctions.URa... | [((1399, 1421), 'numpy.array', 'np.array', (['[0, 0, 1, 1]'], {}), '([0, 0, 1, 1])\n', (1407, 1421), True, 'import numpy as np\n'), ((1435, 1451), 'femnurbs.SplineUsefulFunctions.UBezier', 'SUF.UBezier', ([], {'p': '(1)'}), '(p=1)\n', (1446, 1451), True, 'import femnurbs.SplineUsefulFunctions as SUF\n'), ((1457, 1501),... |
# # -*- coding: utf-8 -*-
# # Part of Odoo. See LICENSE file for full copyright and licensing details.
from unittest.mock import patch
from odoo.addons.base.tests.common import TransactionCaseWithUserDemo
from odoo.tests import common, tagged
from odoo.exceptions import AccessError
@tagged('post_install', '-at_inst... | [
"odoo.tests.tagged",
"unittest.mock.patch",
"odoo.tests.common.tagged"
] | [((288, 325), 'odoo.tests.tagged', 'tagged', (['"""post_install"""', '"""-at_install"""'], {}), "('post_install', '-at_install')\n", (294, 325), False, 'from odoo.tests import common, tagged\n'), ((17217, 17261), 'odoo.tests.common.tagged', 'common.tagged', (['"""post_install"""', '"""-at_install"""'], {}), "('post_ins... |
from plot import plot
from helpers import split
def plot_AMI(ciag):
bity = split(ciag)
niski = float(input('Podaj poziom niski: '))
wysoki = float(input('Podaj poziom wysoki: '))
flag = False
AMI = []
for bit in bity:
if int(bit) == 1 and flag is False:
AMI.append(wyso... | [
"plot.plot",
"helpers.split"
] | [((82, 93), 'helpers.split', 'split', (['ciag'], {}), '(ciag)\n', (87, 93), False, 'from helpers import split\n'), ((626, 656), 'plot.plot', 'plot', (['bity', 'AMI', 'niski', 'wysoki'], {}), '(bity, AMI, niski, wysoki)\n', (630, 656), False, 'from plot import plot\n')] |
"""
Django settings for urlshortener project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import o... | [
"environs.Env",
"os.getenv",
"pathlib.Path"
] | [((403, 408), 'environs.Env', 'Env', ([], {}), '()\n', (406, 408), False, 'from environs import Env\n'), ((2319, 2364), 'os.getenv', 'os.getenv', (['"""DATABASE"""', '"""sqlite:///db.sqlite3"""'], {}), "('DATABASE', 'sqlite:///db.sqlite3')\n", (2328, 2364), False, 'import os\n'), ((501, 515), 'pathlib.Path', 'Path', ([... |
import numpy as np
import matplotlib.pyplot as plt
from read_file import select_original_breakpoints
def plot_ave_curve(slopes, intervals, filename, color):
all_curve_descr = []
for curve in slopes:
curve_descr = np.zeros(N - 1)
for i in range(N - 1):
if curve[i] > curve[i + 1]:
... | [
"numpy.radians",
"numpy.mean",
"matplotlib.pyplot.savefig",
"numpy.unique",
"matplotlib.pyplot.ylabel",
"read_file.select_original_breakpoints",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.tight_layout",
... | [((416, 470), 'numpy.unique', 'np.unique', (['all_curve_descr'], {'return_counts': '(True)', 'axis': '(0)'}), '(all_curve_descr, return_counts=True, axis=0)\n', (425, 470), True, 'import numpy as np\n'), ((482, 495), 'numpy.argsort', 'np.argsort', (['B'], {}), '(B)\n', (492, 495), True, 'import numpy as np\n'), ((647, ... |
#Creator: <NAME>, 19IE10002
import os
import csv
import string
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
import spacy
import fasttext
curr_dir_path = os.getcwd() #returns current directory path
common = curr_dir_path[:-5] #since "task1" occupies 5 places. we slice it... | [
"pandas.read_csv",
"spacy.load",
"csv.writer",
"sklearn.ensemble.RandomForestClassifier",
"os.getcwd",
"os.chdir",
"sklearn.feature_extraction.text.TfidfVectorizer",
"os.mkdir",
"fasttext.train_supervised",
"sklearn.svm.SVC"
] | [((202, 213), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (211, 213), False, 'import os\n'), ((523, 631), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'delimiter': '"""\t"""', 'encoding': '"""utf-8"""', 'quoting': 'csv.QUOTE_NONE', 'error_bad_lines': '(False)'}), "(file_name, delimiter='\\t', encoding='utf-8', qu... |
import MySQLdb
db = MySQLdb.connect("localhost", "root", "<PASSWORD>wort", "<PASSWORD>")
curs=db.cursor()
def write_log_message(message):
try:
print("writing log message..")
curs.execute ("INSERT INTO log_message (message) VALUES (%s);" % message)
db.commit()
print("Done")
exce... | [
"MySQLdb.connect"
] | [((21, 89), 'MySQLdb.connect', 'MySQLdb.connect', (['"""localhost"""', '"""root"""', '"""<PASSWORD>wort"""', '"""<PASSWORD>"""'], {}), "('localhost', 'root', '<PASSWORD>wort', '<PASSWORD>')\n", (36, 89), False, 'import MySQLdb\n')] |
from sense_hat import SenseHat
sense = SenseHat()
sense.show_letter("G")
while True:
x = sense.get_accelerometer_raw()['x']
y = sense.get_accelerometer_raw()['y']
z = sense.get_accelerometer_raw()['z']
x = round(x, 0)
y = round(y, 0)
if x == -1:
sense.set_rotation(180)
elif y == 1:
sense.set_... | [
"sense_hat.SenseHat"
] | [((40, 50), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (48, 50), False, 'from sense_hat import SenseHat\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import re
import shutil
sys.path.append("..")
from utils.baiducloud import *
from utils.common import *
from tqdm import tqdm
from datetime import timedelta
live_id = 'zard'
danmu_merge_cloud_root_path = 'danmu_merge'
danmu_merge_local_root_path = os.path.abspath... | [
"re.compile",
"shutil.move",
"tqdm.tqdm",
"re.match",
"datetime.timedelta",
"shutil.rmtree",
"re.sub",
"re.findall",
"sys.path.append"
] | [((80, 101), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (95, 101), False, 'import sys\n'), ((554, 577), 're.compile', 're.compile', (['""".*\\\\.xml$"""'], {}), "('.*\\\\.xml$')\n", (564, 577), False, 'import re\n'), ((640, 656), 'tqdm.tqdm', 'tqdm', (['live_dates'], {}), '(live_dates)\n', (6... |
from typing import Tuple
from os.path import join
import sys
from coreml.utils.logger import color
from coreml.utils.io import read_yml
from coreml.utils.typing import DatasetConfigDict
def read_dataset_from_config(
data_root: str, dataset_config: DatasetConfigDict) -> dict:
"""
Loads and returns the ... | [
"coreml.utils.io.read_yml",
"os.path.join"
] | [((974, 1076), 'os.path.join', 'join', (['data_root', "dataset_config['name']", '"""processed/versions"""', "(dataset_config['version'] + '.yml')"], {}), "(data_root, dataset_config['name'], 'processed/versions', \n dataset_config['version'] + '.yml')\n", (978, 1076), False, 'from os.path import join\n'), ((1275, 12... |
#!/usr/bin/env python
import json
import sys
import os
from web3 import Web3
from eth_account import Account
def getenv_or_exit(name):
""" Gets the required variable from the environment. Closes the application
with error if it's not set.
Args:
name (string) - The name of required environment vari... | [
"os.path.exists",
"os.getenv",
"os.path.isfile",
"sys.exit",
"json.load",
"eth_account.Account.privateKeyToAccount"
] | [((1216, 1253), 'eth_account.Account.privateKeyToAccount', 'Account.privateKeyToAccount', (['PRIV_KEY'], {}), '(PRIV_KEY)\n', (1243, 1253), False, 'from eth_account import Account\n'), ((419, 434), 'os.getenv', 'os.getenv', (['name'], {}), '(name)\n', (428, 434), False, 'import os\n'), ((750, 816), 'sys.exit', 'sys.exi... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License
# Copyright (c) 2019 Ina (<NAME> - http://www.ina.fr/)
# 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, includ... | [
"inaFaceAnalyzer.face_classifier.Resnet50FairFace",
"pandas.read_csv",
"inaFaceAnalyzer.face_detector.LibFaceDetection",
"inaFaceAnalyzer.face_classifier.Resnet50FairFaceGRA",
"inaFaceAnalyzer.face_detector.PrecomputedDetector",
"inaFaceAnalyzer.inaFaceAnalyzer.VideoPrecomputedDetection",
"pandas.testin... | [((1676, 1709), 'inaFaceAnalyzer.face_detector.OcvCnnFacedetector', 'OcvCnnFacedetector', ([], {'padd_prct': '(0.0)'}), '(padd_prct=0.0)\n', (1694, 1709), False, 'from inaFaceAnalyzer.face_detector import LibFaceDetection, PrecomputedDetector, OcvCnnFacedetector\n'), ((1779, 1811), 'tensorflow.keras.backend.clear_sessi... |
"""Manipulate differences."""
import collections
from arxpy.bitvector import core
from arxpy.bitvector import operation
from arxpy.bitvector import extraop
def _tuplify(seq):
if isinstance(seq, collections.abc.Sequence):
return tuple(seq)
else:
return tuple([seq])
class Difference(object):
... | [
"arxpy.differential.derivative.XDS",
"arxpy.differential.derivative.RXDA",
"arxpy.differential.derivative.XDCA",
"arxpy.differential.derivative.XDA",
"arxpy.bitvector.operation.RotateLeft"
] | [((8103, 8129), 'arxpy.differential.derivative.XDA', 'derivative.XDA', (['input_diff'], {}), '(input_diff)\n', (8117, 8129), False, 'from arxpy.differential import derivative\n'), ((8238, 8264), 'arxpy.differential.derivative.XDS', 'derivative.XDS', (['input_diff'], {}), '(input_diff)\n', (8252, 8264), False, 'from arx... |
import pandas as pd
import pickle
with open("../data/COMPLETE_df.pkl", 'rb') as f:
x = pickle.load(f)
df = pd.DataFrame(x)
df_new = df.flux_list.apply(pd.Series).merge(df, right_index = True, left_index = True)
# .drop(["ingredients"], axis = 1)
df_new.to_pickle('../data/complete-splited.pkl') | [
"pandas.DataFrame",
"pickle.load"
] | [((113, 128), 'pandas.DataFrame', 'pd.DataFrame', (['x'], {}), '(x)\n', (125, 128), True, 'import pandas as pd\n'), ((92, 106), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (103, 106), False, 'import pickle\n')] |
"""
### `drawio`
Automatically includes an svg, based on .drawio file changes.
"""
import json
import subprocess as sp
from lcdoc import lp
from lcdoc.tools import file_hash, app, dirname, exists, os, read_file, write_file, os
multi_line_to_list = True
req_kw = ['fn', 'src']
def run(cmd, kw):
"""
"""
... | [
"lcdoc.lp.err",
"lcdoc.tools.read_file",
"lcdoc.tools.app.info",
"lcdoc.tools.file_hash",
"lcdoc.tools.exists",
"lcdoc.tools.os.environ.get",
"lcdoc.tools.dirname",
"lcdoc.tools.os.stat",
"subprocess.call",
"lcdoc.lp.page_dir"
] | [((325, 340), 'lcdoc.lp.page_dir', 'lp.page_dir', (['kw'], {}), '(kw)\n', (336, 340), False, 'from lcdoc import lp\n'), ((629, 648), 'lcdoc.tools.exists', 'exists', (['fn_src_info'], {}), '(fn_src_info)\n', (635, 648), False, 'from lcdoc.tools import file_hash, app, dirname, exists, os, read_file, write_file, os\n'), (... |
import logging
from argparse import ArgumentParser, Namespace
from pathlib import Path
import torch
from torch.utils.data import DataLoader
from pytorch_lightning import Trainer
from module import ConditionalLM
logging.basicConfig(level=logging.INFO)
def main(args: Namespace):
model = ConditionalLM.load_from_c... | [
"logging.basicConfig",
"pytorch_lightning.Trainer.add_argparse_args",
"argparse.ArgumentParser",
"module.ConditionalLM.add_model_specific_args",
"torch.utils.data.DataLoader",
"pytorch_lightning.Trainer.from_argparse_args",
"module.ConditionalLM.load_from_checkpoint"
] | [((214, 253), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (233, 253), False, 'import logging\n'), ((295, 403), 'module.ConditionalLM.load_from_checkpoint', 'ConditionalLM.load_from_checkpoint', ([], {'checkpoint_path': 'args.checkpoint_path', 'hparams_file': ... |
from tir import Webapp
import unittest
from datetime import datetime
DateSystem = datetime.today().strftime("%d/%m/%Y")
class TRKXFUN(unittest.TestCase):
@classmethod
def setUpClass(self):
self.oHelper = Webapp(autostart=False)
self.oHelper.SetTIRConfig(config_name="User", value="telemarket... | [
"unittest.main",
"datetime.datetime.today",
"tir.Webapp"
] | [((1300, 1315), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1313, 1315), False, 'import unittest\n'), ((83, 99), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (97, 99), False, 'from datetime import datetime\n'), ((225, 248), 'tir.Webapp', 'Webapp', ([], {'autostart': '(False)'}), '(autostart=F... |
"""Converts a dataset in a given format to another.
COCO -> PASCAL VOC
"""
import argparse
from argparse import RawTextHelpFormatter
from convert_utils.from_coco import coco2pascalvoc
VALID_IN_FORMATS = ['COCO']
VALID_OUT_FORMATS = ['PASCALVOC']
def run_main():
"""The main function of the covert script"""
... | [
"convert_utils.from_coco.coco2pascalvoc",
"argparse.ArgumentParser"
] | [((331, 465), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert the given dataset annotation to another"""', 'formatter_class': 'RawTextHelpFormatter'}), "(description=\n 'Convert the given dataset annotation to another', formatter_class=\n RawTextHelpFormatter)\n", (354, 465)... |
from gzip import open as gzip_open
from pickle import dump
def write_gps_map(gps_map, pickle_gz_file_path):
with gzip_open(pickle_gz_file_path, mode="wb") as pickle_gz_file:
dump(gps_map, pickle_gz_file)
| [
"pickle.dump",
"gzip.open"
] | [((120, 161), 'gzip.open', 'gzip_open', (['pickle_gz_file_path'], {'mode': '"""wb"""'}), "(pickle_gz_file_path, mode='wb')\n", (129, 161), True, 'from gzip import open as gzip_open\n'), ((190, 219), 'pickle.dump', 'dump', (['gps_map', 'pickle_gz_file'], {}), '(gps_map, pickle_gz_file)\n', (194, 219), False, 'from pickl... |
# coding: utf-8
import re
import sre_constants
from ..roles import Resolvable
def validate_regex(regex):
"""
:param str regex: A regular expression to validate.
:raises: ValueError
"""
try:
re.compile(regex)
except sre_constants.error as e:
raise ValueError('Invalid regular ex... | [
"re.compile"
] | [((221, 238), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (231, 238), False, 'import re\n')] |
from int_comp import IntComputer
import os
SHAPES = {
0: ".",
1: "#",
2: "@",
3: "-",
4: "o"
}
class Game:
def __init__(self):
self.comp = IntComputer("input", [])
self.map = {}
self.max_x = 0
self.max_y = 0
self.ball_x = None
self.paddle_x = Non... | [
"int_comp.IntComputer"
] | [((173, 197), 'int_comp.IntComputer', 'IntComputer', (['"""input"""', '[]'], {}), "('input', [])\n", (184, 197), False, 'from int_comp import IntComputer\n')] |
from flask_socketio import SocketIO, emit
from flask import Flask, render_template
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@app.route('/')
def hub():
return render_template("hub.html")
@app.route('/gps')
def gps():
return render_template("gps.html")
@socketio.... | [
"flask.render_template",
"flask_socketio.SocketIO",
"flask.Flask"
] | [((91, 106), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (96, 106), False, 'from flask import Flask, render_template\n'), ((155, 168), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (163, 168), False, 'from flask_socketio import SocketIO, emit\n'), ((209, 236), 'flask.render_template',... |
"""
Created on Apr 4, 2014
@author: <NAME>
In this module you can find the :class:`MyStorage`. It inherits
from :class:`base.base.Storage`.
This class represents the base layer. It manages the project files,
the data loading and the data writing.
The data loading is called in the :class:`Task` which is a thread.
""... | [
"os.path.exists",
"swan.virtual_unit_map.VirtualUnitMap",
"pyqtgraph.Qt.QtGui.QApplication.processEvents",
"swan.base.project.Project",
"os.path.join",
"os.path.splitext",
"os.path.split",
"pyqtgraph.Qt.QtCore.pyqtSignal",
"pyqtgraph.Qt.QtCore.QThread.__init__",
"swan.neodata.NeoData",
"os.path.... | [((2158, 2180), 'pyqtgraph.Qt.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['int'], {}), '(int)\n', (2175, 2180), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((1461, 1490), 'pyqtgraph.Qt.QtCore.QThread.__init__', 'QtCore.QThread.__init__', (['self'], {}), '(self)\n', (1484, 1490), False, 'from pyqtgraph.Qt import ... |
# Importing the required packages
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
from catboost import CatBoostClassifier
import statistic... | [
"statistics.mean",
"numpy.copy",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.delete",
"sklearn.metrics.classification_report",
"numpy.array",
"numpy.concatenate",
"catboost.CatBoostClassifier",
"sklearn.metrics.accuracy_score",
"numpy.random.shuffle"
] | [((389, 556), 'pandas.read_csv', 'pd.read_csv', (["('https://raw.githubusercontent.com/ssfaruque/HD_Computing/master/chemometrics/datasets/DTreeSets/'\n + 'DNA_inLiquidDNA.csv')"], {'sep': '""","""', 'header': 'None'}), "(\n 'https://raw.githubusercontent.com/ssfaruque/HD_Computing/master/chemometrics/datasets/D... |
# Copyright (c) 2015 UnitedStack 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
#
# Unles... | [
"neutron.extensions.tunnelaas.NoLocalSubnetFound",
"neutron.manager.NeutronManager.get_plugin",
"neutron.manager.NeutronManager.get_service_plugins",
"netaddr.IPNetwork"
] | [((4344, 4367), 'netaddr.IPNetwork', 'netaddr.IPNetwork', (['cidr'], {}), '(cidr)\n', (4361, 4367), False, 'import netaddr\n'), ((4408, 4428), 'netaddr.IPNetwork', 'netaddr.IPNetwork', (['c'], {}), '(c)\n', (4425, 4428), False, 'import netaddr\n'), ((2183, 2218), 'neutron.manager.NeutronManager.get_plugin', 'manager.Ne... |
import magma as m
from magma.testing import check_files_equal
def def_foo():
foo = m.DefineCircuit("Foo", "ifc", m.Tuple(I=m.In(m.Bit), O=m.Out(m.Bit)))
m.wire(foo.ifc.I, foo.ifc.O)
m.EndCircuit()
return foo
def test_multi_direction_tuple():
foo = def_foo()
m.compile("build/test_multi_direct... | [
"magma.EndCircuit",
"magma.compile",
"magma.In",
"magma.DefineCircuit",
"magma.testing.check_files_equal",
"magma.Out",
"magma.Tuple",
"magma.wire"
] | [((163, 191), 'magma.wire', 'm.wire', (['foo.ifc.I', 'foo.ifc.O'], {}), '(foo.ifc.I, foo.ifc.O)\n', (169, 191), True, 'import magma as m\n'), ((196, 210), 'magma.EndCircuit', 'm.EndCircuit', ([], {}), '()\n', (208, 210), True, 'import magma as m\n'), ((286, 353), 'magma.compile', 'm.compile', (['"""build/test_multi_dir... |
from glob import glob
import toolbox as tx
import sys
cmdarg = str(sys.argv[1])
if cmdarg=="TESTING":
data = tx.getSpeciesConfig(testing=True)
latgrid,longrid = tx.getLatLonVals(data,True)
else:
data = tx.getSpeciesConfig(testing=False)
latgrid,longrid = tx.getLatLonVals(data,False)
path_to_scratch = f"{data['M... | [
"toolbox.getSpeciesConfig",
"toolbox.getLatLonVals",
"glob.glob"
] | [((368, 419), 'glob.glob', 'glob', (['f"""{path_to_scratch}/**/*.npy"""'], {'recursive': '(True)'}), "(f'{path_to_scratch}/**/*.npy', recursive=True)\n", (372, 419), False, 'from glob import glob\n'), ((113, 146), 'toolbox.getSpeciesConfig', 'tx.getSpeciesConfig', ([], {'testing': '(True)'}), '(testing=True)\n', (132, ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 AT&T Labs All Rights Reserved.
# Copyright (C) 2014 University of Pennsylvania 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 ... | [
"logging.getLogger",
"logging.StreamHandler",
"kazoo.client.KazooClient",
"SimpleXMLRPCServer.SimpleXMLRPCServer",
"ryu.lib.packet.packet.Packet.__init__",
"logging.Formatter",
"os.path.join",
"time.sleep",
"ryu.lib.dpid.str_to_dpid",
"collections.defaultdict",
"ryu.lib.hub.spawn",
"md5.new",
... | [((1455, 1482), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1472, 1482), False, 'import logging\n'), ((2244, 2261), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (2255, 2261), False, 'from collections import defaultdict\n'), ((2473, 2490), 'collections.defaultd... |
"""
run.py
Run TF-IDF Debater and generate debater data for the given debate option.
"""
from pytorch_pretrained_bert.tokenization import BertTokenizer, BasicTokenizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.metrics.pairwise import cosine_similarity
import argparse
import json
import... | [
"sklearn.feature_extraction.text.TfidfTransformer",
"pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained",
"os.listdir",
"sklearn.metrics.pairwise.cosine_similarity",
"pytorch_pretrained_bert.tokenization.BasicTokenizer",
"argparse.ArgumentParser",
"tqdm.tqdm",
"os.path.join",
"IPytho... | [((491, 543), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TF-IDF Runner"""'}), "(description='TF-IDF Runner')\n", (514, 543), False, 'import argparse\n'), ((6351, 6365), 'tqdm.tqdm', 'tqdm.tqdm', (['p_a'], {}), '(p_a)\n', (6360, 6365), False, 'import tqdm\n'), ((14653, 14724), 'pytorc... |
import uuid
import urllib
from flask import request
from flask_jwt_extended import (
create_access_token
)
from ..db import Session
from ..mappings import *
from ..jwt_claims import TokenObject
from ..models import AuthResult, ErrorMessage
def auth_post(username: str, password: str = None):
""" Log in as a u... | [
"uuid.UUID",
"flask_jwt_extended.create_access_token",
"urllib.parse.unquote"
] | [((1361, 1391), 'urllib.parse.unquote', 'urllib.parse.unquote', (['accessId'], {}), '(accessId)\n', (1381, 1391), False, 'import urllib\n'), ((1762, 1794), 'uuid.UUID', 'uuid.UUID', ([], {'bytes': 'account.user_id'}), '(bytes=account.user_id)\n', (1771, 1794), False, 'import uuid\n'), ((1805, 1841), 'uuid.UUID', 'uuid.... |
from wellcomeml.datasets.conll import _load_data_spacy, load_conll
import pytest
def test_length():
X, Y = _load_data_spacy("tests/test_data/test_conll", inc_outside=True)
assert len(X) == len(Y) and len(X) == 4
def test_entity():
X, Y = _load_data_spacy("tests/test_data/test_conll", inc_outside=False)... | [
"wellcomeml.datasets.conll._load_data_spacy",
"pytest.raises",
"wellcomeml.datasets.conll.load_conll"
] | [((113, 177), 'wellcomeml.datasets.conll._load_data_spacy', '_load_data_spacy', (['"""tests/test_data/test_conll"""'], {'inc_outside': '(True)'}), "('tests/test_data/test_conll', inc_outside=True)\n", (129, 177), False, 'from wellcomeml.datasets.conll import _load_data_spacy, load_conll\n'), ((255, 320), 'wellcomeml.da... |
#!/usr/bin/env python3
#This sample demonstrates reading motion state in a loop.
#Install Modular library with "pip3 install turta-modular"
from time import sleep
from turta_modular import Turta_PIR_Motion_Module
#Initialize
pir = Turta_PIR_Motion_Module.PIRMotion(slot = 1)
try:
while True:
#Read PIR mo... | [
"turta_modular.Turta_PIR_Motion_Module.PIRMotion",
"time.sleep"
] | [((234, 275), 'turta_modular.Turta_PIR_Motion_Module.PIRMotion', 'Turta_PIR_Motion_Module.PIRMotion', ([], {'slot': '(1)'}), '(slot=1)\n', (267, 275), False, 'from turta_modular import Turta_PIR_Motion_Module\n'), ((486, 496), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (491, 496), False, 'from time import sleep... |
from chemios.pumps import Chemyx
from chemios.utils import SerialTestClass
#from dummyserial import Serial
import pytest
import logging
#Logging
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s")
rootLogger = logging.getLogger()
rootLogger.setLevel(logging.DEBUG)
lo... | [
"logging.getLogger",
"logging.StreamHandler",
"chemios.pumps.Chemyx",
"logging.Formatter",
"pytest.mark.parametrize",
"logging.FileHandler",
"pytest.fixture",
"chemios.utils.SerialTestClass"
] | [((161, 254), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s"""'], {}), "(\n '%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s')\n", (178, 254), False, 'import logging\n'), ((263, 282), 'logging.getLogger', 'logging.getLogger', (... |
# From Dalgaard page 83 [R755c9bae090e-1]_, suppose the daily energy intake for 11
# women in kilojoules (kJ) is:
intake = np.array([5260., 5470, 5640, 6180, 6390, 6515, 6805, 7515, \
7515, 8230, 8770])
# Does their energy intake deviate systematically from the recommended
# value of 7725 kJ? Our n... | [
"matplotlib.pyplot.hist"
] | [((1328, 1363), 'matplotlib.pyplot.hist', 'plt.hist', (['s'], {'bins': '(100)', 'density': '(True)'}), '(s, bins=100, density=True)\n', (1336, 1363), True, 'import matplotlib.pyplot as plt\n')] |
import pytest
from paste.deploy.config import ConfigMiddleware
class Bug(Exception):
pass
def app_with_exception(environ, start_response):
def cont():
yield b"something"
raise Bug
start_response('200 OK', [('Content-type', 'text/html')])
return cont()
def test_error():
# This ... | [
"pytest.skip",
"paste.deploy.config.ConfigMiddleware",
"pytest.raises",
"paste.fixture.TestApp"
] | [((523, 572), 'paste.deploy.config.ConfigMiddleware', 'ConfigMiddleware', (['app_with_exception', "{'test': 1}"], {}), "(app_with_exception, {'test': 1})\n", (539, 572), False, 'from paste.deploy.config import ConfigMiddleware\n'), ((588, 604), 'paste.fixture.TestApp', 'TestApp', (['wrapped'], {}), '(wrapped)\n', (595,... |
"""
Check diffs for each test file
Diff Configuration
------------------
Currently this is setup to ignore metadata as the extension will generate
a minimal notebook. So opening a notebook and saving will add metadata
that will cause the diff checker to fail.
"""
import nbformat
import glob
import os
from nbdime.dif... | [
"nbdime.diffing.notebooks.diff_notebooks",
"nbdime.diffing.notebooks.set_notebook_diff_ignores",
"re.compile",
"nbformat.read",
"os.path.join",
"nbdime.diffing.notebooks.set_notebook_diff_targets",
"glob.glob",
"fnmatch.filter",
"os.walk"
] | [((685, 737), 'nbdime.diffing.notebooks.set_notebook_diff_ignores', 'set_notebook_diff_ignores', (["{'/nbformat_minor': True}"], {}), "({'/nbformat_minor': True})\n", (710, 737), False, 'from nbdime.diffing.notebooks import diff_notebooks, set_notebook_diff_targets, set_notebook_diff_ignores\n'), ((739, 780), 'nbdime.d... |
"""__init__
License: BSD 3-Clause License
Copyright (C) 2021, New York University
Copyright note valid unless otherwise stated in individual files.
All rights reserved.
"""
import numpy as np
class SimHead:
def __init__(self, robot, vicon_name='', with_sliders=True, joint_index=None,
measurement... | [
"numpy.zeros",
"numpy.zeros_like",
"numpy.diag"
] | [((843, 855), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (851, 855), True, 'import numpy as np\n'), ((896, 908), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (904, 908), True, 'import numpy as np\n'), ((1448, 1460), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (1456, 1460), True, 'import numpy as np... |
# Copyright 2019 <NAME>
#
# 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, softwa... | [
"mishmash_rpc_pb2.Member",
"MishmashSet.MishmashSet",
"datetime.datetime.strptime",
"mishmash_rpc_pb2.NullValue",
"mishmash_rpc_pb2.BooleanValue",
"mishmash_rpc_pb2.Literal",
"mishmash_rpc_pb2.DecimalValue",
"mishmash_rpc_pb2.YieldDataAck",
"mishmash_rpc_pb2.LambdaFunctionClosure",
"utils.isinstan... | [((2674, 2721), 'mishmash_rpc_pb2.LambdaFunctionBody', 'mishmash_rpc_pb2.LambdaFunctionBody', ([], {'source': 'arg'}), '(source=arg)\n', (2709, 2721), False, 'import mishmash_rpc_pb2\n'), ((4884, 4928), 'mishmash_rpc_pb2.MishmashSetDescriptorList', 'mishmash_rpc_pb2.MishmashSetDescriptorList', ([], {}), '()\n', (4926, ... |
# coding: utf-8
"""
Camunda BPM REST API
OpenApi Spec for Camunda BPM REST API. # noqa: E501
The version of the OpenAPI document: 7.13.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from openapi_client.configuration import Configuration
clas... | [
"six.iteritems",
"openapi_client.configuration.Configuration"
] | [((6553, 6586), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (6566, 6586), False, 'import six\n'), ((1472, 1487), 'openapi_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1485, 1487), False, 'from openapi_client.configuration import Configuration\n')... |
# Copyright (c) 2020-2021 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following discla... | [
"os.path.abspath",
"os.path.join"
] | [((1801, 1836), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""templates"""'], {}), "(BASE_DIR, 'templates')\n", (1813, 1836), False, 'import os\n'), ((4748, 4780), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static"""'], {}), "(BASE_DIR, 'static')\n", (4760, 4780), False, 'import os\n'), ((1758, 1783), 'os.pa... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 16 12:56:17 2021
@author: Luigi
"""
import numpy as np
import scipy as sci
import sympy as sym
import matplotlib.pyplot as plt
def Lagrange(xnodi, i):
if i == 0:
xzeri = xnodi[1:]
else:
xzeri = np.append(xnodi[:i], xnodi[i + 1 :])
... | [
"numpy.abs",
"numpy.poly",
"numpy.sqrt",
"numpy.arange",
"numpy.append",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"numpy.polyval",
"numpy.dot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((1163, 1183), 'numpy.linspace', 'np.linspace', (['a', 'b', '(4)'], {}), '(a, b, 4)\n', (1174, 1183), True, 'import numpy as np\n'), ((1190, 1212), 'numpy.linspace', 'np.linspace', (['a', 'b', '(100)'], {}), '(a, b, 100)\n', (1201, 1212), True, 'import numpy as np\n'), ((1291, 1365), 'matplotlib.pyplot.legend', 'plt.l... |
from django.http import JsonResponse, HttpResponse
from django.views import View
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
import json
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from re... | [
"json.loads",
"django.http.JsonResponse",
"django.http.HttpResponse",
"numpy.asarray",
"numpy.expand_dims"
] | [((1634, 1657), 'json.loads', 'json.loads', (['byte_string'], {}), '(byte_string)\n', (1644, 1657), False, 'import json\n'), ((1900, 1916), 'numpy.asarray', 'np.asarray', (['body'], {}), '(body)\n', (1910, 1916), True, 'import numpy as np\n'), ((1931, 1958), 'numpy.expand_dims', 'np.expand_dims', (['arr'], {'axis': '(0... |
from mmdet.apis import init_detector, inference_detector, show_result
import time
import os
config_file = 'configs/htc/htc_x101_64x4d_fpn_20e_16gpu.py'
checkpoint_file = 'checkpoints/htc_x101_64x4d_fpn_20e_20190408-497f2561.pth'
folder_name = config_file.split('/')[2].split('.')[0]
print('FOLDER NAME ',folder_name)
if... | [
"mmdet.apis.init_detector",
"os.getcwd",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"mmdet.apis.inference_detector",
"time.time"
] | [((570, 630), 'mmdet.apis.init_detector', 'init_detector', (['config_file', 'checkpoint_file'], {'device': '"""cuda:0"""'}), "(config_file, checkpoint_file, device='cuda:0')\n", (583, 630), False, 'from mmdet.apis import init_detector, inference_detector, show_result\n'), ((774, 803), 'cv2.VideoCapture', 'cv2.VideoCapt... |
import time
from flask import Flask, request
from ipyclient.connection import IPythonConnection
from nnNodes.computation_graph import ComputationGraph
app = Flask(__name__)
#ipyclient = IPythonConnection()
cg = ComputationGraph()
@app.route('/time')
def get_time():
return { 'time': time.time() }
@app.route('/i... | [
"nnNodes.computation_graph.ComputationGraph",
"time.time",
"flask.Flask"
] | [((159, 174), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'from flask import Flask, request\n'), ((213, 231), 'nnNodes.computation_graph.ComputationGraph', 'ComputationGraph', ([], {}), '()\n', (229, 231), False, 'from nnNodes.computation_graph import ComputationGraph\n'), ((887, 905)... |
import pika
import json
credentials = pika.PlainCredentials("cc-dev", "<PASSWORD>")
parameters = pika.ConnectionParameters(
host="127.0.0.1",
port=5672,
virtual_host="cc-dev-ws",
credentials=credentials)
conn = pika.BlockingConnection(parameters)
assert conn.is_open
try:
ch = conn.channel()
... | [
"pika.ConnectionParameters",
"json.dumps",
"pika.BlockingConnection",
"pika.PlainCredentials",
"pika.BasicProperties"
] | [((40, 85), 'pika.PlainCredentials', 'pika.PlainCredentials', (['"""cc-dev"""', '"""<PASSWORD>"""'], {}), "('cc-dev', '<PASSWORD>')\n", (61, 85), False, 'import pika\n'), ((99, 209), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""127.0.0.1"""', 'port': '(5672)', 'virtual_host': '"""cc-dev-w... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>, 2021
"""
def load_binary(path, dtype="<f"):
import numpy as np
with open(path, "rb") as file:
# specify little endian float: dtype="<f"
dat = np.fromfile(file, dtype=dtype)
return dat
def write_binary(dataArray, path):
with open(path, "wb"... | [
"numpy.clip",
"numpy.fromfile",
"scipy.interpolate.RegularGridInterpolator",
"numpy.flipud",
"numpy.fliplr",
"matplotlib.colors.to_hex",
"numpy.max",
"numpy.rot90",
"numpy.min",
"imageio.imread",
"numpy.arange"
] | [((659, 681), 'numpy.arange', 'np.arange', (['im.shape[0]'], {}), '(im.shape[0])\n', (668, 681), True, 'import numpy as np\n'), ((690, 712), 'numpy.arange', 'np.arange', (['im.shape[1]'], {}), '(im.shape[1])\n', (699, 712), True, 'import numpy as np\n'), ((783, 818), 'scipy.interpolate.RegularGridInterpolator', 'Regula... |
#!/usr/bin/env python -W ignore::DeprecationWarning
# -*- coding: utf-8 -*-
"""Adenine analyzer module."""
######################################################################
# Copyright (C) 2016 <NAME>, <NAME>, <NAME>
#
# FreeBSD License
######################################################################
import... | [
"sklearn.metrics.homogeneity_score",
"adenine.utils.scores.confusion_matrix",
"adenine.core.plotting.eigs",
"multiprocessing.Process",
"sklearn.metrics.adjusted_rand_score",
"adenine.utils.extra.title_from_filename",
"sklearn.metrics.completeness_score",
"adenine.core.plotting.silhouette",
"logging.... | [((372, 393), 'matplotlib.use', 'matplotlib.use', (['"""AGG"""'], {}), "('AGG')\n", (386, 393), False, 'import matplotlib\n'), ((3961, 3998), 'logging.info', 'logging.info', (['"""Dumped : %s"""', 'filename'], {}), "('Dumped : %s', filename)\n", (3973, 3998), False, 'import logging\n'), ((4631, 4644), 'os.walk', 'os.wa... |
# Write a word count example for an undefined arguments using words.
# Example:
# >>> some_text = """When you look at the increasing sophistication of malware,
# it becomes apparent that you need to establish highly protected enclaves of
# data. The only way to achieve that is through modern encryption, properly
# imp... | [
"re.compile"
] | [((1636, 1656), 're.compile', 're.compile', (['"""(\\\\w+)"""'], {}), "('(\\\\w+)')\n", (1646, 1656), False, 'import re\n')] |
from numba import jit
import numpy as np
import cProfile
import timeit
def L1distances(a,b):
n = len(a)
m = len(b)
distance = [[] for _ in range(n)]
for i in range(0, n):
for j in range(0, m):
distance[i].append(0)
containsNaN = False
for i in range(n):
if a[i] == 'nan' or b[j] == 'nan':
containsNaN ... | [
"cProfile.run",
"numpy.sin",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.cos",
"timeit.timeit"
] | [((1470, 1481), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1478, 1481), True, 'import numpy as np\n'), ((1488, 1499), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1496, 1499), True, 'import numpy as np\n'), ((1501, 1549), 'cProfile.run', 'cProfile.run', (['"""L1distances(x,y)"""'], {'sort': '"""tottime"""'}... |
from tkinter import *
from datetime import datetime
import sqlite3
root = Tk()
root.title("Symptom-Medication Database")
root.geometry("400x600")
#Create A Database
conn = sqlite3.connect('symptom-med.db')
#Create a Cursor:
c = conn.cursor()
def save():
#Connect To Database
conn = sqlite3.connect('s... | [
"datetime.datetime.today",
"sqlite3.connect"
] | [((183, 216), 'sqlite3.connect', 'sqlite3.connect', (['"""symptom-med.db"""'], {}), "('symptom-med.db')\n", (198, 216), False, 'import sqlite3\n'), ((302, 335), 'sqlite3.connect', 'sqlite3.connect', (['"""symptom-med.db"""'], {}), "('symptom-med.db')\n", (317, 335), False, 'import sqlite3\n'), ((1263, 1296), 'sqlite3.c... |
import os
import glob
import errno
import random
import urllib.request as urllib
import numpy as np
from scipy.io import loadmat
class CWRU:
def __init__(self, exp, rpm, length):
if exp not in ('12DriveEndFault', '12FanEndFault', '48DriveEndFault'):
print("wrong experiment name: {}".format(ex... | [
"os.path.exists",
"urllib.request.URLopener",
"os.makedirs",
"random.Random",
"scipy.io.loadmat",
"os.path.join",
"os.getcwd",
"os.path.dirname",
"numpy.zeros",
"os.path.isdir",
"numpy.vstack",
"os.path.expanduser"
] | [((529, 540), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (538, 540), False, 'import os\n'), ((1724, 1750), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length))\n', (1732, 1750), True, 'import numpy as np\n'), ((1773, 1799), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length)... |
import cv2
import numpy as np
writer = cv2.VideoWriter("output.avi",
cv2.VideoWriter_fourcc(*"MJPG"), 30,(220,220))
image = np.random.randint(0, 255, (220,220,3)).astype('uint8')
for frame in range(1000):
writer.write(image)
writer.release() | [
"numpy.random.randint",
"cv2.VideoWriter_fourcc"
] | [((69, 100), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MJPG'"], {}), "(*'MJPG')\n", (91, 100), False, 'import cv2\n'), ((124, 164), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(220, 220, 3)'], {}), '(0, 255, (220, 220, 3))\n', (141, 164), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# bamPlot.py
'''
The MIT License (MIT)
Copyright (c) 2013 <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 righ... | [
"string.maketrans",
"pipeline_dfci.formatFolder",
"colorsys.hsv_to_rgb",
"sys.exit",
"utils.parseTable",
"utils.makeTranscriptCollection",
"os.listdir",
"utils.makeGenes",
"argparse.ArgumentParser",
"subprocess.Popen",
"cPickle.dump",
"os.access",
"os.path.isfile",
"zlib.crc32",
"utils.L... | [((1714, 1749), 'os.path.isfile', 'os.path.isfile', (['bamliquidatorString'], {}), '(bamliquidatorString)\n', (1728, 1749), False, 'import os\n'), ((1777, 1809), 'distutils.spawn.find_executable', 'find_executable', (['"""bamliquidator"""'], {}), "('bamliquidator')\n", (1792, 1809), False, 'from distutils.spawn import ... |
import hazelcast
import time
if __name__ == "__main__":
client = hazelcast.HazelcastClient()
transaction = client.new_transaction(timeout=10)
try:
transaction.begin()
transactional_map = transaction.get_map("transaction-map")
print("Map: {}".format(transactional_map))
trans... | [
"time.sleep",
"hazelcast.HazelcastClient"
] | [((70, 97), 'hazelcast.HazelcastClient', 'hazelcast.HazelcastClient', ([], {}), '()\n', (95, 97), False, 'import hazelcast\n'), ((355, 370), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (365, 370), False, 'import time\n')] |
"""Test project for `Number` class.
Command examples:
$ python test_projects/Number/main.py
"""
import sys
sys.path.append('./')
import os
from types import ModuleType
import apysc as ap
from apysc._file import file_util
this_module: ModuleType = sys.modules[__name__]
_DEST_DIR_PATH: str = os.p... | [
"apysc.Stage",
"apysc.save_overall_html",
"apysc.Number",
"apysc._file.file_util.get_abs_module_dir_path",
"apysc.assert_equal",
"apysc.Int",
"sys.path.append"
] | [((118, 139), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (133, 139), False, 'import sys\n'), ((335, 388), 'apysc._file.file_util.get_abs_module_dir_path', 'file_util.get_abs_module_dir_path', ([], {'module': 'this_module'}), '(module=this_module)\n', (368, 388), False, 'from apysc._file impor... |
# -*- coding: utf-8 -*-
"""
Assembly: %MODULE_NAME%.py
"""
from assembly import (Assembly,
asm,
models,
request,
response,
HTTPError)
# -----------------------------------------------------------------------... | [
"assembly.request.route"
] | [((331, 362), 'assembly.request.route', 'request.route', (['"""/%ROUTE_NAME%/"""'], {}), "('/%ROUTE_NAME%/')\n", (344, 362), False, 'from assembly import Assembly, asm, models, request, response, HTTPError\n')] |
from osutk.osufile.beatmap import read_from_file, write_to_file, Hitsound
from osutk.objects.hitobject import HitObject, HitCircle
import sys
def main(filename):
print("Reading beatmap...", file=sys.stderr)
beatmap = read_from_file(filename)
moments = beatmap.get_distinct_times()
print("Analyzing..."... | [
"osutk.osufile.beatmap.read_from_file",
"osutk.osufile.beatmap.write_to_file",
"osutk.osufile.beatmap.Hitsound"
] | [((227, 251), 'osutk.osufile.beatmap.read_from_file', 'read_from_file', (['filename'], {}), '(filename)\n', (241, 251), False, 'from osutk.osufile.beatmap import read_from_file, write_to_file, Hitsound\n'), ((3108, 3142), 'osutk.osufile.beatmap.write_to_file', 'write_to_file', (['beatmap', 'sys.stdout'], {}), '(beatmap... |
from django.contrib import admin
from django.urls import path
import wordcount.views
urlpatterns = [
path('admin/', admin.site.urls),
path('', wordcount.views.home, name="home"),
path('about/', wordcount.views.about, name='about'),
path('result/', wordcount.views.result, name='result'),
]
| [
"django.urls.path"
] | [((106, 137), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (110, 137), False, 'from django.urls import path\n'), ((143, 186), 'django.urls.path', 'path', (['""""""', 'wordcount.views.home'], {'name': '"""home"""'}), "('', wordcount.views.home, name='home')\n", ... |
from openpharmacophore import Pharmacophore, StructuredBasedPharmacophore, LigandBasedPharmacophore
from openpharmacophore._private_tools.exceptions import OpenPharmacophoreNotImplementedError, OpenPharmacophoreValueError
def is_3d_pharmacophore(pharmacophore):
""" Check whether a pharmacophore object is of type P... | [
"openpharmacophore._private_tools.exceptions.OpenPharmacophoreValueError"
] | [((1659, 1738), 'openpharmacophore._private_tools.exceptions.OpenPharmacophoreValueError', 'OpenPharmacophoreValueError', (['"""Similarity cutoff value must lie between 0 and 1"""'], {}), "('Similarity cutoff value must lie between 0 and 1')\n", (1686, 1738), False, 'from openpharmacophore._private_tools.exceptions imp... |
import numpy as np
import os
import pandas as pd
import pickle
def get_user_avg_ratings(user_item_mat):
"""
Given one user-item matrix, calculate the average rating a user has given.
Input:
- user_item_mat: file containing a dataframe, with rows indicating users
columns indicating items, each valu... | [
"os.path.dirname",
"numpy.array"
] | [((878, 903), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (893, 903), False, 'import os\n'), ((1810, 1830), 'numpy.array', 'np.array', (['index_list'], {}), '(index_list)\n', (1818, 1830), True, 'import numpy as np\n'), ((2082, 2107), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}... |
import click
import pandas as pd
import os
import random
import sys
from ranking_metrics import average_precision
from ranking_metrics import ndcg_at_k
file_dir = os.path.dirname(os.path.abspath(__file__))
base_dir = os.path.abspath(os.path.join(file_dir, '..'))
sys.path.append(base_dir)
from gensim.corpora import ... | [
"os.path.expanduser",
"random.shuffle",
"gensim.corpora.Dictionary",
"pandas.DataFrame",
"ranking_metrics.average_precision",
"os.path.join",
"nltk.tokenize.word_tokenize",
"ranking_metrics.ndcg_at_k",
"os.path.abspath",
"click.command",
"sys.path.append",
"gensim.models.TfidfModel",
"office... | [((265, 290), 'sys.path.append', 'sys.path.append', (['base_dir'], {}), '(base_dir)\n', (280, 290), False, 'import sys\n'), ((698, 713), 'click.command', 'click.command', ([], {}), '()\n', (711, 713), False, 'import click\n'), ((181, 206), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (196, ... |
import pygame
from math import floor
screenWidth = 750
screenHeight = 750
win = pygame.display.set_mode((screenWidth, screenHeight))
pygame.display.set_caption("Fractal Triangles")
x = 0
y = 0
l = screenWidth
WHITE = (255,255,255)
BLACK = (0,0,0)
NEON = (70,102,255)
def frac(x, y, l) :
if l < 2... | [
"pygame.quit",
"math.floor",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.key.get_pressed",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.display.update"
] | [((86, 138), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screenWidth, screenHeight)'], {}), '((screenWidth, screenHeight))\n', (109, 138), False, 'import pygame\n'), ((140, 187), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Fractal Triangles"""'], {}), "('Fractal Triangles')\n", (166,... |
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"google.cloud.datacatalog.TagField",
"google.protobuf.timestamp_pb2.Timestamp"
] | [((3613, 3635), 'google.cloud.datacatalog.TagField', 'datacatalog.TagField', ([], {}), '()\n', (3633, 3635), False, 'from google.cloud import datacatalog\n'), ((1027, 1049), 'google.cloud.datacatalog.TagField', 'datacatalog.TagField', ([], {}), '()\n', (1047, 1049), False, 'from google.cloud import datacatalog\n'), ((1... |
import os
from enum import Enum
from pathlib import Path
AIRFLOW_COMM_PATH = "/opt/airflow/comm"
class AirflowCommStatus(Enum):
IDLE = "empty"
RETRAIN = "retrain"
TRAINING = "training"
DONE = "done"
@classmethod
def status(cls):
status_files = os.listdir(AIRFLOW_COMM_PATH)
as... | [
"os.listdir",
"pathlib.Path",
"os.remove"
] | [((280, 309), 'os.listdir', 'os.listdir', (['AIRFLOW_COMM_PATH'], {}), '(AIRFLOW_COMM_PATH)\n', (290, 309), False, 'import os\n'), ((663, 698), 'os.listdir', 'os.listdir', (['f"""{AIRFLOW_COMM_PATH}/"""'], {}), "(f'{AIRFLOW_COMM_PATH}/')\n", (673, 698), False, 'import os\n'), ((712, 749), 'os.remove', 'os.remove', (['f... |
import argparse
import pysam
from pysam import VariantFile
import pandas as pd
import numpy as np
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from intervaltree import Interval, IntervalTree
def readBAM(bam):
ChrDict = {}
for record in bam:
id = record.query_name.split("_")[0]
star... | [
"pysam.VariantFile",
"pysam.AlignmentFile",
"argparse.ArgumentParser"
] | [((445, 492), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parse FP"""'}), "(description='Parse FP')\n", (468, 492), False, 'import argparse\n'), ((821, 841), 'pysam.VariantFile', 'VariantFile', (['args.fp'], {}), '(args.fp)\n', (832, 841), False, 'from pysam import VariantFile\n'), ((... |
import os
from blinker import Namespace
from flask import Flask, session
from flask_wtf import CsrfProtect
from flask.ext.cors import CORS
csrf = CsrfProtect()
def create_app(config_file=None, config_object=None):
"""
Bootstrap the flask application, registering blueprints, modules and other fun things.
... | [
"flask_wtf.CsrfProtect",
"radar.api.api_manager.init_app",
"os.getenv",
"flask.Flask",
"flask.ext.cors.CORS",
"radar.models.migrate.init_app",
"radar.oauth.oauth.init_app",
"radar.models.db.init_app",
"radar.blueprints.StructuresView.register",
"radar.blueprints.AccountView.register",
"radar.blu... | [((148, 161), 'flask_wtf.CsrfProtect', 'CsrfProtect', ([], {}), '()\n', (159, 161), False, 'from flask_wtf import CsrfProtect\n'), ((522, 561), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""public"""'}), "(__name__, static_folder='public')\n", (527, 561), False, 'from flask import Flask, session\n'), ((6... |
# -*- coding: utf-8 -*-
"""
NoveltyHainsworth
computes the novelty measure used by Hainsworth
Args:
X: spectrogram (dimension FFTLength X Observations)
f_s: sample rate
Returns:
d_hai novelty measure
"""
import numpy as np
def NoveltyHainsworth(X, f_s):
epsilon = 1e-5
# ... | [
"numpy.sum",
"numpy.sqrt",
"numpy.arange"
] | [((533, 555), 'numpy.sum', 'np.sum', (['afDiff'], {'axis': '(0)'}), '(afDiff, axis=0)\n', (539, 555), True, 'import numpy as np\n'), ((386, 396), 'numpy.sqrt', 'np.sqrt', (['X'], {}), '(X)\n', (393, 396), True, 'import numpy as np\n'), ((448, 472), 'numpy.arange', 'np.arange', (['(1)', 'X.shape[1]'], {}), '(1, X.shape[... |
"""
Module to plot a pie chart for the profiled sections of the code.
TODO: Fix legend box size conflict. Make font of legends smaller.
https://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend
TODO: Create several charts instead of hierarchic pie charts..
"""
import os
import pickle
import numpy as np... | [
"seaborn.set",
"matplotlib.colors.rgb_to_hsv",
"matplotlib.use",
"os.path.join",
"warnings.catch_warnings",
"os.path.split",
"numpy.sum",
"numpy.linspace",
"numpy.array",
"matplotlib.colors.hsv_to_rgb",
"os.path.dirname",
"matplotlib.pyplot.tight_layout",
"warnings.simplefilter"
] | [((361, 382), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (375, 382), False, 'import matplotlib\n'), ((437, 446), 'seaborn.set', 'sns.set', ([], {}), '()\n', (444, 446), True, 'import seaborn as sns\n'), ((3567, 3598), 'numpy.linspace', 'np.linspace', (['(0.6)', '(1.0)', 'n_levels'], {}), '(0.... |
'''The main class for creating overlays.'''
__author__ = '<NAME>'
__all__ = [
'Window',
'overlays',
]
import tkinter as tk
overlays = []
master = tk.Tk()
master.withdraw()
class Window:
def __init__(self, **kwargs):
'''Initiate an overlay window.
All parameters of this method are cofiguration parameters ... | [
"tkinter.Tk",
"tkinter.Toplevel"
] | [((153, 160), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (158, 160), True, 'import tkinter as tk\n'), ((758, 771), 'tkinter.Toplevel', 'tk.Toplevel', ([], {}), '()\n', (769, 771), True, 'import tkinter as tk\n')] |
import pyttsx3
import speech_recognition as sr
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[0].id) # change id for changing voice
def speak(audio):
engine.say(audio)
print(audio)
engine.runAndWait()
def takecommand():
r =... | [
"pyttsx3.init",
"speech_recognition.Microphone",
"speech_recognition.Recognizer"
] | [((60, 81), 'pyttsx3.init', 'pyttsx3.init', (['"""sapi5"""'], {}), "('sapi5')\n", (72, 81), False, 'import pyttsx3\n'), ((321, 336), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (334, 336), True, 'import speech_recognition as sr\n'), ((347, 362), 'speech_recognition.Microphone', 'sr.Microphone', ... |
import numpy as np
import matplotlib.pylab as plt
import tensorflow as tf
from keras.models import Model, Sequential
from keras.layers import Input, Activation, Dense
from keras.optimizers import SGD
# Generate data from -20, -19.75, -19.5, .... , 20
train_x = np.arange(-20, 20, 0.25)
# Calculate Target : sqrt(2x^2 +... | [
"numpy.sqrt",
"numpy.array",
"keras.layers.Input",
"keras.optimizers.SGD",
"keras.models.Model",
"matplotlib.pylab.show",
"keras.layers.Dense",
"matplotlib.pylab.plot",
"numpy.arange"
] | [((262, 286), 'numpy.arange', 'np.arange', (['(-20)', '(20)', '(0.25)'], {}), '(-20, 20, 0.25)\n', (271, 286), True, 'import numpy as np\n'), ((334, 363), 'numpy.sqrt', 'np.sqrt', (['(2 * train_x ** 2 + 1)'], {}), '(2 * train_x ** 2 + 1)\n', (341, 363), True, 'import numpy as np\n'), ((387, 404), 'keras.layers.Input', ... |
import numpy as np
# # blind A
# # Z_Bbin sigma_e neff
# # Flag_SOM_Fid
# 0.1<ZB<=0.3 0.27085526185463465 0.6141903412434272
# 0.3<ZB<=0.5 0.260789170603278 1.1714443526924525
# 0.5<ZB<=0.7 0.27664489739710685 1.8306617593091257
# 0.7<ZB<=0.9 0.2616226704859973 1.2340324684694277
# 0.9<ZB<=1.2 0.2818628832701304 1.277... | [
"numpy.asarray"
] | [((978, 1095), 'numpy.asarray', 'np.asarray', (['[0.6141903412434272, 1.1714443526924525, 1.8306617593091257, \n 1.2340324684694277, 1.2777696421274052]'], {}), '([0.6141903412434272, 1.1714443526924525, 1.8306617593091257, \n 1.2340324684694277, 1.2777696421274052])\n', (988, 1095), True, 'import numpy as np\n')... |
# Generated by Django 3.1.13 on 2022-04-24 15:45
import app.storage
from django.conf import settings
from django.db import migrations, models, transaction
import django.db.models.deletion
import uuid
import versatileimagefield.fields
def create_slack_users(apps, schema_editor):
SlackUser = apps.get_model("messag... | [
"django.db.models.UUIDField",
"django.db.models.OneToOneField",
"django.db.transaction.atomic",
"django.db.migrations.RunPython",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((391, 411), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (409, 411), False, 'from django.db import migrations, models, transaction\n'), ((807, 864), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL... |
import asyncio
import time
def prime_generator():
n: int = 2
primes: set = set()
while True:
test = [p for p in primes if n % p == 0]
if not any(test):
primes.add(n)
yield n
n += 1
async def prime_factors(n):
print(f'Starting processing for {n}')
... | [
"asyncio.get_event_loop",
"time.clock",
"asyncio.sleep"
] | [((829, 841), 'time.clock', 'time.clock', ([], {}), '()\n', (839, 841), False, 'import time\n'), ((881, 905), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (903, 905), False, 'import asyncio\n'), ((1161, 1173), 'time.clock', 'time.clock', ([], {}), '()\n', (1171, 1173), False, 'import time\n'), ... |
# This module is used for wrapping SqlAlchemy to a simple ORM
# Author: limodou <<EMAIL>>
from __future__ import print_function, absolute_import, unicode_literals, generator_stop
__all__ = ['Field', 'get_connection', 'Model', 'do_',
'set_debug_query', 'set_auto_create', 'set_auto_set_model',
'get_model', 'se... | [
"logging.getLogger",
"uliweb.utils.date.now",
"sqlalchemy.sql.and_",
"uliweb.utils.common.safe_unicode",
"uliweb.orm.graph.generate_file",
"sqlalchemy.engine.reflection.Inspector.from_engine",
"uliweb.utils.date.to_time",
"uliweb.utils.common.get_caller",
"uliweb.utils.date.to_string",
"sqlalchemy... | [((3736, 3763), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3753, 3763), False, 'import logging\n'), ((3773, 3790), 'threading.local', 'threading.local', ([], {}), '()\n', (3788, 3790), False, 'import threading\n'), ((17099, 17142), 'uliweb.core.dispatch.bind', 'dispatch.bind', (['"""... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import torch
import h5py
import numpy as np
class DatasetHDF5(torch.utils.data.Dataset):
def __init__(self, hdf5fn, t, transform=None, target_transform=None):
"""
t: 'train' or 'val'
"""
super(DatasetHDF5, self).__init__... | [
"numpy.int64",
"h5py.File"
] | [((341, 391), 'h5py.File', 'h5py.File', (['hdf5fn', '"""r"""'], {'libver': '"""latest"""', 'swmr': '(True)'}), "(hdf5fn, 'r', libver='latest', swmr=True)\n", (350, 391), False, 'import h5py\n'), ((888, 904), 'numpy.int64', 'np.int64', (['target'], {}), '(target)\n', (896, 904), True, 'import numpy as np\n')] |
# @l2g 1946 python3
# [1946] Largest Number After Mutating Substring
# Difficulty: Medium
# https://leetcode.com/problems/largest-number-after-mutating-substring
#
# You are given a string num,which represents a large integer.
# You are also given a 0-indexed integer array change of length 10 that maps each digit 0-9 t... | [
"os.path.join"
] | [((2123, 2160), 'os.path.join', 'os.path.join', (['"""tests"""', '"""test_1946.py"""'], {}), "('tests', 'test_1946.py')\n", (2135, 2160), False, 'import os\n')] |
#!/usr/bin/env python
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 - 2017 <NAME> <<EMAIL>>
#
# See LICENSE comming with the source of python-quilt for details.
from setuptools import setup
from codecs import open
import os
i... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((480, 1594), 'setuptools.setup', 'setup', ([], {'name': '"""python-quilt"""', 'version': 'quilt.__version__', 'description': '"""A quilt patch system implementation in Python"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'install_requires': "['six']", 'url': '"""https://github.com/bjoernricks/python... |
from gym.envs.registration import register
register(
id='vrep-hopper-v0',
entry_point='vrepdemo.envs:HopperVrepEnv',
)
register(
id='vrep-twolink-v0',
entry_point='vrepdemo.envs:TwoLinkVrepEnv',
)
register(
id='vrep-twolink1-v0',
entry_point='vrepdemo.envs:TwoLink1VrepEnv',
)
... | [
"gym.envs.registration.register"
] | [((46, 118), 'gym.envs.registration.register', 'register', ([], {'id': '"""vrep-hopper-v0"""', 'entry_point': '"""vrepdemo.envs:HopperVrepEnv"""'}), "(id='vrep-hopper-v0', entry_point='vrepdemo.envs:HopperVrepEnv')\n", (54, 118), False, 'from gym.envs.registration import register\n'), ((136, 210), 'gym.envs.registratio... |
"""
Npass: Yet Another NCurses UI for Pass
List and Search Functions
Copyright © 2014-2019, <NAME>.
The use of this code is governed by the MIT license attached.
See the LICENSE file for the full license.
"""
import re
from os import walk
from os.path import join, relpath, splitext, expanduser
def FuzzyFilter(colle... | [
"os.path.splitext",
"os.path.join",
"os.path.expanduser",
"re.compile"
] | [((631, 665), 're.compile', 're.compile', (['pattern', 're.IGNORECASE'], {}), '(pattern, re.IGNORECASE)\n', (641, 665), False, 'import re\n'), ((1392, 1403), 'os.path.join', 'join', (['dp', 'f'], {}), '(dp, f)\n', (1396, 1403), False, 'from os.path import join, relpath, splitext, expanduser\n'), ((1701, 1725), 'os.path... |
import argparse
import sys
import json
import asyncio
import enum
import re
import base64
from typing import Optional
from dataclasses import dataclass
import httpx
from pure_protobuf.dataclasses_ import field, optional_field, message
from pure_protobuf.types import int32
# - Protobuf schemas
# Converted from https:/... | [
"argparse.ArgumentParser",
"pure_protobuf.dataclasses_.field",
"asyncio.to_thread",
"pure_protobuf.dataclasses_.optional_field",
"httpx.AsyncClient",
"json.dump",
"re.search"
] | [((4132, 4221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Gets all notes from an Online Sequencer song."""'}), "(description=\n 'Gets all notes from an Online Sequencer song.')\n", (4155, 4221), False, 'import argparse\n'), ((679, 708), 'pure_protobuf.dataclasses_.field', 'field'... |
#!/usr/bin/env python
# Foundations of Python Network Programming - Chapter 11 - bottle_app.py
# A simple web application built using the Bottle micro-framework.
import base64, bottle
bottle.debug(True)
app = bottle.Bottle()
@app.route('/encode')
@bottle.view('bottle_template.html')
def encode():
mystring = bottl... | [
"bottle.Bottle",
"base64.b64encode",
"bottle.view",
"bottle.debug",
"bottle.abort",
"bottle.request.GET.get",
"bottle.run"
] | [((185, 203), 'bottle.debug', 'bottle.debug', (['(True)'], {}), '(True)\n', (197, 203), False, 'import base64, bottle\n'), ((210, 225), 'bottle.Bottle', 'bottle.Bottle', ([], {}), '()\n', (223, 225), False, 'import base64, bottle\n'), ((250, 285), 'bottle.view', 'bottle.view', (['"""bottle_template.html"""'], {}), "('b... |
import json
import numpy as np
from flightsim.shapes import Cuboid
class World(object):
def __init__(self, world_data):
"""
Construct World object from data. Instead of using this constructor
directly, see also class methods 'World.from_file()' for building a
world from a saved .j... | [
"axes3ds.Axes3Ds",
"json.dumps",
"numpy.max",
"matplotlib.pyplot.figure",
"json.load",
"flightsim.shapes.Cuboid",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((5773, 5785), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5783, 5785), True, 'import matplotlib.pyplot as plt\n'), ((5795, 5807), 'axes3ds.Axes3Ds', 'Axes3Ds', (['fig'], {}), '(fig)\n', (5802, 5807), False, 'from axes3ds import Axes3Ds\n'), ((5854, 5864), 'matplotlib.pyplot.show', 'plt.show', ([], {}... |
import numpy as np
from util.gym import action_size
from util.logger import logger
from motion_planners.sampling_based_planner import SamplingBasedPlanner
class PlannerAgent:
def __init__(
self,
config,
ac_space,
non_limited_idx=None,
passive_joint_idx=[],
ignored_... | [
"util.gym.action_size"
] | [((612, 633), 'util.gym.action_size', 'action_size', (['ac_space'], {}), '(ac_space)\n', (623, 633), False, 'from util.gym import action_size\n')] |
import time
from telethon.sync import TelegramClient
from telethon import errors
from telethon.tl.custom.message import Message
from telethon.tl.custom.chatgetter import ChatGetter
from telethon.tl.types import InputPeerUser
from telethon.errors.rpcerrorlist import PeerFloodError
import sys
import json
import csv
api_... | [
"csv.reader",
"time.sleep",
"telethon.sync.TelegramClient"
] | [((393, 432), 'telethon.sync.TelegramClient', 'TelegramClient', (['phone', 'api_id', 'api_hash'], {}), '(phone, api_id, api_hash)\n', (407, 432), False, 'from telethon.sync import TelegramClient\n'), ((725, 774), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""', 'lineterminator': '"""\n"""'}), "(f, delimiter... |
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# Permission i... | [
"readline.set_completer",
"readline.set_completer_delims",
"readline.parse_and_bind",
"readline.write_history_file",
"re.match",
"readline.read_history_file",
"os.path.expanduser"
] | [((2618, 2668), 're.match', 're.match', (['"""(\\\\S+(\\\\.[\\\\w-]+)*)\\\\.([\\\\w-]*)$"""', 'text'], {}), "('(\\\\S+(\\\\.[\\\\w-]+)*)\\\\.([\\\\w-]*)$', text)\n", (2626, 2668), False, 'import re\n'), ((4361, 4403), 'readline.set_completer', 'readline.set_completer', (['completer.complete'], {}), '(completer.complete... |
"""
FoodSource Class for ABC
Implements properties and functions of the candidate solutions in ABC.
"""
# ----------------------------------------------------------
from candidate_solution import CandidateSolution, random_tour, weight
import numpy as np
# ---------------------------------------------------------
... | [
"candidate_solution.random_tour",
"candidate_solution.weight"
] | [((938, 969), 'candidate_solution.weight', 'weight', (['self.problem', 'self.tour'], {}), '(self.problem, self.tour)\n', (944, 969), False, 'from candidate_solution import CandidateSolution, random_tour, weight\n'), ((1422, 1447), 'candidate_solution.random_tour', 'random_tour', (['self.problem'], {}), '(self.problem)\... |
import wagtail_factories
import factory
from tests.models import BlogIndex, BlogPage
class BlogIndexFactory(wagtail_factories.PageFactory):
class Meta:
model = BlogIndex
class BlogPageFactory(wagtail_factories.PageFactory):
class Meta:
model = BlogPage
introduction = factory.Faker("sen... | [
"factory.Faker"
] | [((302, 327), 'factory.Faker', 'factory.Faker', (['"""sentence"""'], {}), "('sentence')\n", (315, 327), False, 'import factory\n')] |
import json
import re
def eval_js_variable(label, text):
match = re.findall(r"var %s ?= ?(.*?);" % (label), text)
if not match:
return None
return json.loads(match[0])
def list_extend(lhs, rhs):
lhs = lhs or []
rhs = rhs or []
return list(set(lhs + rhs)) or None
def formatted_meta(... | [
"re.findall",
"json.loads"
] | [((71, 116), 're.findall', 're.findall', (["('var %s ?= ?(.*?);' % label)", 'text'], {}), "('var %s ?= ?(.*?);' % label, text)\n", (81, 116), False, 'import re\n'), ((169, 189), 'json.loads', 'json.loads', (['match[0]'], {}), '(match[0])\n', (179, 189), False, 'import json\n')] |
from __future__ import absolute_import, unicode_literals
import datetime
from decimal import Decimal
import mock
import pytz
from temba_client.v2.types import Contact as TembaContact
from django.test.utils import override_settings
from django.utils import timezone
from tracpro.contacts.models import ChangeType
fr... | [
"datetime.datetime",
"tracpro.test.factories.RegionalPollRun",
"mock.patch",
"tracpro.utils.get_uuids",
"tracpro.test.factories.UniversalPollRun",
"tracpro.test.factories.ContactField",
"django.utils.timezone.now",
"tracpro.test.factories.Contact",
"tracpro.test.factories.Response",
"django.test.u... | [((558, 671), 'django.test.utils.override_settings', 'override_settings', ([], {'CELERY_ALWAYS_EAGER': '(True)', 'CELERY_EAGER_PROPAGATES_EXCEPTIONS': '(True)', 'BROKER_BACKEND': '"""memory"""'}), "(CELERY_ALWAYS_EAGER=True,\n CELERY_EAGER_PROPAGATES_EXCEPTIONS=True, BROKER_BACKEND='memory')\n", (575, 671), False, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from CTFd.models import Fields, TeamFieldEntries, Teams, UserFieldEntries, Users
from tests.helpers import (
create_ctfd,
destroy_ctfd,
gen_field,
gen_team,
login_as_user,
register_user,
)
def test_api_custom_fields():
app = create_ctfd()
... | [
"CTFd.models.Teams.query.filter_by",
"tests.helpers.create_ctfd",
"CTFd.models.TeamFieldEntries.query.count",
"CTFd.models.UserFieldEntries.query.count",
"CTFd.models.Users.query.filter_by",
"tests.helpers.login_as_user",
"tests.helpers.gen_team",
"tests.helpers.register_user",
"CTFd.models.TeamFiel... | [((302, 315), 'tests.helpers.create_ctfd', 'create_ctfd', ([], {}), '()\n', (313, 315), False, 'from tests.helpers import create_ctfd, destroy_ctfd, gen_field, gen_team, login_as_user, register_user\n'), ((5135, 5152), 'tests.helpers.destroy_ctfd', 'destroy_ctfd', (['app'], {}), '(app)\n', (5147, 5152), False, 'from te... |
import torch.nn as nn
import torch.nn.functional as F
class FCModel1(nn.Module):
'''
epoch: 50
batch: 64
nn.CrossEntropyLoss()
optim.SGD(model.parameters(), lr=0.01, momentum=0.9, weight_decay=5e-4)
* Accuracy: 55.5 %
* Loss: 0.0200
'''
def __init__(self, i... | [
"torch.nn.BatchNorm2d",
"torch.nn.Dropout",
"torch.nn.LocalResponseNorm",
"torch.nn.Dropout2d",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear"
] | [((405, 431), 'torch.nn.Linear', 'nn.Linear', (['input_size', '(500)'], {}), '(input_size, 500)\n', (414, 431), True, 'import torch.nn as nn\n'), ((451, 470), 'torch.nn.Linear', 'nn.Linear', (['(500)', '(500)'], {}), '(500, 500)\n', (460, 470), True, 'import torch.nn as nn\n'), ((490, 517), 'torch.nn.Linear', 'nn.Linea... |
import os
import math
from pprint import PrettyPrinter
import random
import numpy as np
import torch # Torch must be imported before sklearn and tf
import sklearn
import tensorflow as tf
import better_exceptions
from tqdm import tqdm, trange
import colorlog
import colorful
from utils.etc_utils import set_logger, set... | [
"utils.etc_utils.set_gpus",
"tensorflow.train.Checkpoint",
"modules.from_parlai.unzip",
"better_exceptions.hook",
"tensorflow.config.experimental.set_visible_devices",
"utils.config_utils.CommandArgs",
"utils.etc_utils.set_logger",
"os.path.exists",
"utils.config_utils.initialize_argparser",
"ppri... | [((714, 738), 'better_exceptions.hook', 'better_exceptions.hook', ([], {}), '()\n', (736, 738), False, 'import better_exceptions\n'), ((755, 781), 'utils.config_utils.CommandArgs', 'config_utils.CommandArgs', ([], {}), '()\n', (779, 781), False, 'from utils import config_utils, custom_argparsers\n'), ((791, 806), 'ppri... |
import vtk
#------------READER ----------------------
rectGridReader = vtk.vtkXMLImageDataReader()
rectGridReader.SetFileName("../data/wind_image.vti")
rectGridReader.Update()
#------------END READER ------------------
print(rectGridReader.GetOutput())
#------------ FILTER: CALCULATE VECTOR MAGNITUDE -----------------... | [
"vtk.vtkVolumeProperty",
"vtk.vtkXMLImageDataReader",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkRenderWindow",
"vtk.vtkProbeFilter",
"vtk.vtkGPUVolumeRayCastMapper",
"vtk.vtkVolume",
"vtk.vtkArrayCalculator",
"vtk.vtkColorTransferFunction",
"vtk.vtkImageData",
"vtk.vtkRenderer",
"vtk.vtkPiecewi... | [((72, 99), 'vtk.vtkXMLImageDataReader', 'vtk.vtkXMLImageDataReader', ([], {}), '()\n', (97, 99), False, 'import vtk\n'), ((348, 372), 'vtk.vtkArrayCalculator', 'vtk.vtkArrayCalculator', ([], {}), '()\n', (370, 372), False, 'import vtk\n'), ((1084, 1102), 'vtk.vtkImageData', 'vtk.vtkImageData', ([], {}), '()\n', (1100,... |
from util import readDatabase, showConfusionMatrix
from keras.models import Sequential
from keras.layers.core import Dense, Flatten
from keras.optimizers import Adam
xTrain, yTrain, xTest, yTestCategorical, yTest = readDatabase()
print(xTrain.shape)
print(xTest.shape)
print(yTestCategorical.shape)
# Network paramete... | [
"keras.optimizers.Adam",
"keras.layers.core.Flatten",
"util.readDatabase",
"keras.models.Sequential",
"util.showConfusionMatrix",
"keras.layers.core.Dense"
] | [((217, 231), 'util.readDatabase', 'readDatabase', ([], {}), '()\n', (229, 231), False, 'from util import readDatabase, showConfusionMatrix\n'), ((552, 564), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (562, 564), False, 'from keras.models import Sequential\n'), ((672, 693), 'keras.optimizers.Adam', 'Ada... |
import gym
import argparse
import calendar
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.normalized_env import normalize
from rllab.envs.gym_env import GymEnv
from rllab.config import LOG_DIR
from sandbox import RLLabRunner
from sandbox.rocky.tf.algos.trpo import TRPO
fro... | [
"gym.envs.register",
"calendar.datetime.date.today",
"numpy.prod",
"os.listdir",
"sandbox.rocky.tf.envs.base.TfEnv",
"argparse.ArgumentParser",
"rllab.envs.gym_env.GymEnv",
"sandbox.rocky.tf.policies.gaussian_gru_policy.GaussianGRUPolicy",
"os.path.join",
"numpy.square",
"os.mkdir",
"sandbox.r... | [((1021, 1046), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1044, 1046), False, 'import argparse\n'), ((5024, 5175), 'gym.envs.register', 'gym.envs.register', ([], {'id': '"""SpellingCorrection-v0"""', 'entry_point': '"""rllab.envs.nlp_env:SpellingCorrection"""', 'timestep_limit': '(999)', ... |
from django.contrib import admin
# Register your models here.
from django.contrib import admin
from .models import SignificantMajors, College, Blog
admin.site.register(SignificantMajors)
admin.site.register(College)
admin.site.register(Blog)
| [
"django.contrib.admin.site.register"
] | [((151, 189), 'django.contrib.admin.site.register', 'admin.site.register', (['SignificantMajors'], {}), '(SignificantMajors)\n', (170, 189), False, 'from django.contrib import admin\n'), ((191, 219), 'django.contrib.admin.site.register', 'admin.site.register', (['College'], {}), '(College)\n', (210, 219), False, 'from ... |
# Generated by Django 2.1.3 on 2019-11-20 18:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('datavis', '0004_remove_comment_dustbin'),
]
operations = [
migrations.RenameField(
model_name='comment',
old_name='author',
... | [
"django.db.migrations.RenameField"
] | [((231, 316), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""comment"""', 'old_name': '"""author"""', 'new_name': '"""user"""'}), "(model_name='comment', old_name='author', new_name='user'\n )\n", (253, 316), False, 'from django.db import migrations\n')] |
from binascii import hexlify
from crypto.transactions.deserializers.base import BaseDeserializer
class DelegateResignationDeserializer(BaseDeserializer):
def deserialize(self):
self.transaction.parse_signatures(
hexlify(self.serialized).decode(),
self.asset_offset
)
... | [
"binascii.hexlify"
] | [((240, 264), 'binascii.hexlify', 'hexlify', (['self.serialized'], {}), '(self.serialized)\n', (247, 264), False, 'from binascii import hexlify\n')] |
# -*- coding: utf-8 -*-
' a CAA sqlite3 database module '
__author__ = '<NAME>'
import os
import re
import sqlite3
import hashlib
# id , method ,fullname ,DStype , header , moduel , framework
class database(object):
def __init__(self):
self.__path = None
for x in os.walk(os.getcwd()):
... | [
"os.path.exists",
"sqlite3.connect",
"hashlib.md5",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"os.path.split",
"re.findall",
"os.walk"
] | [((1110, 1123), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (1121, 1123), False, 'import hashlib\n'), ((1258, 1286), 'sqlite3.connect', 'sqlite3.connect', (['self.__path'], {}), '(self.__path)\n', (1273, 1286), False, 'import sqlite3\n'), ((1950, 1976), 'os.path.exists', 'os.path.exists', (['caaDocPath'], {}), '(ca... |