code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from smartnlp.classfication.svm_classifier import SVMClassifier
if __name__ == '__main__':
svm_model = SVMClassifier('model/svm/model.pkl',
'./data/imdb/aclImdb.txt',
train=True)
# svm_model = SVMClassifier('model/svm/model.pkl')
svm_model.predict... | [
"smartnlp.classfication.svm_classifier.SVMClassifier"
] | [((108, 183), 'smartnlp.classfication.svm_classifier.SVMClassifier', 'SVMClassifier', (['"""model/svm/model.pkl"""', '"""./data/imdb/aclImdb.txt"""'], {'train': '(True)'}), "('model/svm/model.pkl', './data/imdb/aclImdb.txt', train=True)\n", (121, 183), False, 'from smartnlp.classfication.svm_classifier import SVMClassi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 09:48:24 2020
@author: tcandela
"""
# =============================================================================
# IMPORTS
# =============================================================================
import sys
import numpy as np
import mat... | [
"plot_lib.show_start_point",
"netCDF_lib.read_nc",
"plot_lib.plot_map",
"matplotlib.pyplot.savefig",
"plot_lib.display_colorbar",
"numpy.max",
"matplotlib.pyplot.subplot",
"turtle_lib.find_date_death",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"plot_lib.display_trajectories_par... | [((582, 641), 'sys.path.append', 'sys.path.append', (['"""/homelocal-px/px-179/tcandela/STAMM/LIB/"""'], {}), "('/homelocal-px/px-179/tcandela/STAMM/LIB/')\n", (597, 641), False, 'import sys\n'), ((2723, 2834), 'netCDF_lib.read_nc', 'ncl.read_nc', (["(indir + filename + '.nc')", "['traj_lat', 'traj_lon', 'date', 'traj_... |
import numpy as np
import loader
import responser
def processing(data):
data = loader.load(data)
# perform something
return responser.save(data)
| [
"loader.load",
"responser.save"
] | [((85, 102), 'loader.load', 'loader.load', (['data'], {}), '(data)\n', (96, 102), False, 'import loader\n'), ((138, 158), 'responser.save', 'responser.save', (['data'], {}), '(data)\n', (152, 158), False, 'import responser\n')] |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='NGS analysis of Cell-free DNA for the NGS course at DTU.',
author='<NAME>, <NAME>',
license='MIT',
)
| [
"setuptools.find_packages"
] | [((81, 96), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (94, 96), False, 'from setuptools import find_packages, setup\n')] |
import tensorflow as tf
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import matplotlib.image as img
import matplotlib.pyplot as plt
sess = tf.Session()
diag = tf.diag([1,1,1,1])
truncated = tf.truncated_normal([2,3])
fill = tf.fill([2,3],5.0)
uniform = tf.random_uniform([3,2])
convert_tensor ... | [
"matplotlib.pyplot.imshow",
"tensorflow.shape",
"tensorflow.fill",
"tensorflow.diag",
"tensorflow.Session",
"matplotlib.image.imread",
"tensorflow.random_shuffle",
"tensorflow.random_uniform",
"tensorflow.random_crop",
"numpy.array",
"tensorflow.constant",
"tensorflow.cast",
"tensorflow.trun... | [((165, 177), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (175, 177), True, 'import tensorflow as tf\n'), ((186, 207), 'tensorflow.diag', 'tf.diag', (['[1, 1, 1, 1]'], {}), '([1, 1, 1, 1])\n', (193, 207), True, 'import tensorflow as tf\n'), ((217, 244), 'tensorflow.truncated_normal', 'tf.truncated_normal', ([... |
import os
import h5py
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import svm
import Models.PrepareData as PD
import SignalExtractor.graph_plots as gp
#iterate through signal events
#figure out how to get accuracy of predictions
#files needed bed file sam file
def get_locations(sam_locs,... | [
"matplotlib.pyplot.savefig",
"Models.PrepareData.scaleData",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"Models.PrepareData.createNanoInstance",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"h5py.File",
"SignalExtractor.graph_plots.ven_diagram",
"Models.PrepareData.to_onehot",
"Sign... | [((3057, 3074), 'os.walk', 'os.walk', (['fastPath'], {}), '(fastPath)\n', (3064, 3074), False, 'import os\n'), ((6634, 6660), 'matplotlib.pyplot.plot', 'plt.plot', (['runs', 'accuracies'], {}), '(runs, accuracies)\n', (6642, 6660), True, 'import matplotlib.pyplot as plt\n'), ((6666, 6684), 'matplotlib.pyplot.xlabel', '... |
# -- coding: utf-8 --
import os
from unittest import main, TestCase
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class... | [
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.Firefox",
"os.path.dirname",
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"unittest.main",
"selenium.webdriver.support.expected_conditions.visibility_of_element_located"
] | [((4179, 4185), 'unittest.main', 'main', ([], {}), '()\n', (4183, 4185), False, 'from unittest import main, TestCase\n'), ((388, 407), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (405, 407), False, 'from selenium import webdriver\n'), ((430, 468), 'selenium.webdriver.support.ui.WebDriverWait', ... |
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
import os, sys, subprocess
from flask import Flask, send_from_directory
app = Flask(__name__)
app.config['DEBUG'] = True
here = os.getcwd()
@app.route('/')
def hello():
return send_from_directory('statics', 'main.html')
@app.route('... | [
"os.getcwd",
"os.path.join",
"flask.send_from_directory",
"flask.Flask"
] | [((160, 175), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (165, 175), False, 'from flask import Flask, send_from_directory\n'), ((210, 221), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (219, 221), False, 'import os, sys, subprocess\n'), ((263, 306), 'flask.send_from_directory', 'send_from_directory', ([... |
import numpy as np
dt = 0.05
number_inputs = 3
number_neurons = 6
V = np.random.rand(number_neurons, number_inputs)*4-2
W = np.random.rand(number_neurons, number_neurons)*4-2
net_type = 'CTRNN3'
u = np.random.rand(number_inputs)*4-2
N = 100
x = np.random.rand(number_neurons)*4-2
for t in range(N):
print("t... | [
"numpy.clip",
"numpy.matmul",
"numpy.random.rand",
"numpy.arctan"
] | [((73, 118), 'numpy.random.rand', 'np.random.rand', (['number_neurons', 'number_inputs'], {}), '(number_neurons, number_inputs)\n', (87, 118), True, 'import numpy as np\n'), ((127, 173), 'numpy.random.rand', 'np.random.rand', (['number_neurons', 'number_neurons'], {}), '(number_neurons, number_neurons)\n', (141, 173), ... |
import os
import itertools
from urlparse import urljoin
from .utils import force_str, force_unicode
__all__ = ('Storage')
def reraise(exception):
kwargs = {
'message': exception.message,
'wrapped_exception': exception
}
# cloudfiles and S3Boto exceptions have http compatible status code... | [
"os.path.normpath",
"itertools.count",
"os.path.splitext",
"os.path.split"
] | [((3024, 3046), 'os.path.normpath', 'os.path.normpath', (['name'], {}), '(name)\n', (3040, 3046), False, 'import os\n'), ((3476, 3495), 'os.path.split', 'os.path.split', (['name'], {}), '(name)\n', (3489, 3495), False, 'import os\n'), ((3526, 3553), 'os.path.splitext', 'os.path.splitext', (['file_name'], {}), '(file_na... |
from PIL import Image
from rembg.bg import remove
import numpy as np
import io
from django.db.models.functions import Radians, Cos, Sin, ASin, Sqrt
from date_site import settings
def add_watermark(image,):
background = np.fromfile(settings.WATERMARK)
result = remove(background)
base_image = Image.open(im... | [
"numpy.fromfile",
"PIL.Image.open",
"PIL.Image.new",
"django.db.models.functions.Radians",
"io.BytesIO",
"django.db.models.functions.Cos",
"rembg.bg.remove",
"django.db.models.functions.Sin"
] | [((226, 257), 'numpy.fromfile', 'np.fromfile', (['settings.WATERMARK'], {}), '(settings.WATERMARK)\n', (237, 257), True, 'import numpy as np\n'), ((271, 289), 'rembg.bg.remove', 'remove', (['background'], {}), '(background)\n', (277, 289), False, 'from rembg.bg import remove\n'), ((307, 324), 'PIL.Image.open', 'Image.o... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
from ..utils import (
ExtractorError,
get_element_by_id,
)
class SlideshareIE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?slideshare\.net/[^/]+?/(?P<title>.... | [
"json.loads",
"re.match"
] | [((835, 865), 're.match', 're.match', (['self._VALID_URL', 'url'], {}), '(self._VALID_URL, url)\n', (843, 865), False, 'import re\n'), ((1154, 1180), 'json.loads', 'json.loads', (['slideshare_obj'], {}), '(slideshare_obj)\n', (1164, 1180), False, 'import json\n')] |
# Please complete TODO items in this code
import asyncio
from dataclasses import asdict, dataclass, field
import json
import time
import random
import requests
from confluent_kafka import avro, Consumer, Producer
from confluent_kafka.avro import AvroConsumer, AvroProducer, CachedSchemaRegistryClient
from faker import... | [
"confluent_kafka.avro.loads",
"confluent_kafka.avro.AvroProducer",
"json.dumps",
"requests.get",
"faker.Faker",
"asyncio.sleep",
"random.randint",
"dataclasses.field"
] | [((337, 344), 'faker.Faker', 'Faker', ([], {}), '()\n', (342, 344), False, 'from faker import Faker\n'), ((2897, 2931), 'dataclasses.field', 'field', ([], {'default_factory': 'faker.email'}), '(default_factory=faker.email)\n', (2902, 2931), False, 'from dataclasses import asdict, dataclass, field\n'), ((2953, 2989), 'd... |
import numpy as np
import soundfile as sf
import argparse
import os
import keras
import sklearn
import librosa
from keras import backend as K
eps = np.finfo(np.float).eps
def class_mae(y_true, y_pred):
return K.mean(
K.abs(
K.argmax(y_pred, axis=-1) - K.argmax(y_true, axis=-1)
),
... | [
"numpy.mean",
"argparse.ArgumentParser",
"os.path.join",
"numpy.argmax",
"sklearn.preprocessing.StandardScaler",
"numpy.linalg.norm",
"numpy.finfo",
"keras.backend.argmax",
"soundfile.read",
"librosa.stft"
] | [((150, 168), 'numpy.finfo', 'np.finfo', (['np.float'], {}), '(np.float)\n', (158, 168), True, 'import numpy as np\n'), ((715, 729), 'numpy.mean', 'np.mean', (['Theta'], {}), '(Theta)\n', (722, 729), True, 'import numpy as np\n'), ((972, 1058), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': ... |
from configurations import importer
importer.install(check_options=True) | [
"configurations.importer.install"
] | [((37, 73), 'configurations.importer.install', 'importer.install', ([], {'check_options': '(True)'}), '(check_options=True)\n', (53, 73), False, 'from configurations import importer\n')] |
#!/usr/bin/env python3
from asyncio.tasks import wait
import time
import sys
import os
from pwn import p32, p64, u32, u64, context, remote
from time import sleep
from construct import *
from ctypes import sizeof, c_int
import struct
import codecs
from hashlib import sha256
from binascii import hexlify
MESSAGE_HEADER_... | [
"hashlib.sha256",
"pwn.p64",
"os.getenv",
"binascii.hexlify",
"ctypes.sizeof",
"struct.pack",
"time.sleep",
"codecs.decode",
"sys.stdout.flush",
"sys.stdout.write"
] | [((374, 386), 'pwn.p64', 'p64', (['(4215136)'], {}), '(4215136)\n', (377, 386), False, 'from pwn import p32, p64, u32, u64, context, remote\n'), ((347, 360), 'ctypes.sizeof', 'sizeof', (['c_int'], {}), '(c_int)\n', (353, 360), False, 'from ctypes import sizeof, c_int\n'), ((794, 822), 'sys.stdout.write', 'sys.stdout.wr... |
# MIT License
# Copyright (c) 2020 <NAME> (Alias: Alanthiel)
# 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, mod... | [
"dataclasses.dataclass"
] | [((1292, 1331), 'dataclasses.dataclass', 'dataclass', ([], {'repr': '(False)', 'unsafe_hash': '(True)'}), '(repr=False, unsafe_hash=True)\n', (1301, 1331), False, 'from dataclasses import dataclass, asdict, astuple\n')] |
############### Standard Imports ###############
import time
import logging
import string
############### External Modules Imports ###############
from PIL import Image
def only_ASCII(s):
'''
Elimina tutti i caratteri non ASCII da una stringa
Params:
@s: Stringa da cui rimuovere i caratteri
Ret... | [
"logging.getLogger",
"PIL.Image.load",
"pyfiglet.Figlet",
"logging.Formatter",
"logging.FileHandler",
"time.time"
] | [((1980, 2001), 'pyfiglet.Figlet', 'Figlet', ([], {'font': '"""shadow"""'}), "(font='shadow')\n", (1986, 2001), False, 'from pyfiglet import Figlet\n'), ((2169, 2192), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (2186, 2192), False, 'import logging\n'), ((2209, 2283), 'logging.Formatter', 'log... |
import os
import glob
import time
import os.path
from ARR2019_config import root_directory
from ARR2019_post_processing import plot_hydrographs
import matplotlib.pyplot as plt
from anuga.shallow_water.sww_interrogate import get_flow_through_cross_section
from anuga.caching import cache
# Enter location poly here
#pol... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"os.listdir",
"os.makedirs",
"matplotlib.pyplot.ylabel",
"anuga.caching.cache",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"os.path.join",
"matplotlib.pyplot.minorticks_on",
"matplotlib.pyplot.plot",
... | [((549, 584), 'os.path.join', 'os.path.join', (['root_directory', '"""SWW"""'], {}), "(root_directory, 'SWW')\n", (561, 584), False, 'import os\n'), ((708, 745), 'os.path.join', 'os.path.join', (['root_directory', '"""PLOTS"""'], {}), "(root_directory, 'PLOTS')\n", (720, 745), False, 'import os\n'), ((774, 809), 'os.ma... |
# -*- coding: utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
from collections import Counter
import codecs
import chardet
f = open(".txt","w",encoding='utf-8')
DATA_FILE = "GamerGate_processed.json"
# Build a JSON array
data = "[{0}]".format(",".join([l for l in open(DATA_FILE,encoding='utf-8').readline... | [
"matplotlib.pyplot.savefig",
"nltk.corpus.stopwords.words",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"collections.Counter",
"nltk.Text",
"pandas.notnull",
"pandas.read_json"
] | [((447, 483), 'pandas.read_json', 'pd.read_json', (['data'], {'orient': '"""records"""'}), "(data, orient='records')\n", (459, 483), True, 'import pandas as pd\n'), ((2526, 2552), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Tweet Volume"""'], {}), "('Tweet Volume')\n", (2536, 2552), True, 'import matplotlib.pyplot ... |
from organize.utils import Path, find_unused_filename, splitglob, increment_filename_version
def test_splitglob():
assert splitglob('~/Downloads') == (Path.home() / 'Downloads', '')
assert (
splitglob('/Test/\* tmp\*/*[!H]/**/*.*') ==
(Path('/Test/\* tmp\*'), '*[!H]/**/*.*'))
assert (
... | [
"organize.utils.splitglob",
"organize.utils.Path.home",
"organize.utils.Path"
] | [((128, 152), 'organize.utils.splitglob', 'splitglob', (['"""~/Downloads"""'], {}), "('~/Downloads')\n", (137, 152), False, 'from organize.utils import Path, find_unused_filename, splitglob, increment_filename_version\n'), ((209, 251), 'organize.utils.splitglob', 'splitglob', (['"""/Test/\\\\* tmp\\\\*/*[!H]/**/*.*"""'... |
import socket
from subprocess import run, PIPE
import qrcode
import psutil
__all__ = [
"qr_generator", "get_available_port", "get_ip_address", "command_processor"
]
def command_processor(command: str):
"""
:param command:
:return:
"""
result = run(command, stdout=PIPE, stderr=PIPE, universal... | [
"qrcode.QRCode",
"psutil.net_connections",
"subprocess.run",
"socket.socket"
] | [((272, 347), 'subprocess.run', 'run', (['command'], {'stdout': 'PIPE', 'stderr': 'PIPE', 'universal_newlines': '(True)', 'shell': '(True)'}), '(command, stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True)\n', (275, 347), False, 'from subprocess import run, PIPE\n'), ((582, 683), 'qrcode.QRCode', 'qrcode.QRC... |
'''
Created on Nov 21, 2017
@author: <NAME>
'''
import random
import pandas as pd
import matplotlib.pyplot as plt
import math
def simulation(numPoints):
"""Calculates an approximation to pi via the Monte Carlo method
Args:
text: Number of points
Returns:
... | [
"random.uniform",
"random.seed",
"matplotlib.pyplot.show"
] | [((727, 740), 'random.seed', 'random.seed', ([], {}), '()\n', (738, 740), False, 'import random\n'), ((1314, 1324), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1322, 1324), True, 'import matplotlib.pyplot as plt\n'), ((470, 490), 'random.uniform', 'random.uniform', (['(0)', '(2)'], {}), '(0, 2)\n', (484, 4... |
import os.path
import yaml
from appr.auth import ApprAuth
def test_fake_home(fake_home):
assert os.path.expanduser("~") == fake_home
def test_init_create_dir(fake_home):
ApprAuth(".appr")
assert os.path.exists(os.path.join(str(fake_home), ".appr"))
def test_init_token_empty(fake_home):
k = ApprA... | [
"yaml.load",
"yaml.dump",
"appr.auth.ApprAuth"
] | [((184, 201), 'appr.auth.ApprAuth', 'ApprAuth', (['""".appr"""'], {}), "('.appr')\n", (192, 201), False, 'from appr.auth import ApprAuth\n'), ((315, 325), 'appr.auth.ApprAuth', 'ApprAuth', ([], {}), '()\n', (323, 325), False, 'from appr.auth import ApprAuth\n'), ((421, 431), 'appr.auth.ApprAuth', 'ApprAuth', ([], {}), ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './acq4/analysis/old/StdpCtrlTemplate.ui'
#
# Created: Tue Dec 24 01:49:15 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QSt... | [
"SpinBox.SpinBox",
"PyQt4.QtGui.QSpacerItem",
"PyQt4.QtCore.QMetaObject.connectSlotsByName",
"PyQt4.QtGui.QLabel",
"PyQt4.QtGui.QGridLayout",
"PyQt4.QtGui.QApplication.translate",
"PyQt4.QtGui.QCheckBox",
"PyQt4.QtGui.QSpinBox",
"PyQt4.QtGui.QDoubleSpinBox"
] | [((509, 573), 'PyQt4.QtGui.QApplication.translate', 'QtGui.QApplication.translate', (['context', 'text', 'disambig', '_encoding'], {}), '(context, text, disambig, _encoding)\n', (537, 573), False, 'from PyQt4 import QtCore, QtGui\n'), ((916, 949), 'PyQt4.QtGui.QGridLayout', 'QtGui.QGridLayout', (['StdpCtrlWidget'], {})... |
import os
os.environ['MATPLOTLIBDATA'] = os.path.join(os.environ['RESOURCEPATH'], 'mpl-data')
| [
"os.path.join"
] | [((41, 93), 'os.path.join', 'os.path.join', (["os.environ['RESOURCEPATH']", '"""mpl-data"""'], {}), "(os.environ['RESOURCEPATH'], 'mpl-data')\n", (53, 93), False, 'import os\n')] |
from bs4 import BeautifulSoup
from decimal import Decimal
def convert(amount, cur_from, cur_to, date, requests):
response = requests.get(
"http://www.cbr.ru/scripts/XML_daily.asp?date_req={}".format(date)
) # Использовать переданный requests
soup = BeautifulSoup(response.content, "xml")
if c... | [
"bs4.BeautifulSoup",
"decimal.Decimal"
] | [((273, 311), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""xml"""'], {}), "(response.content, 'xml')\n", (286, 311), False, 'from bs4 import BeautifulSoup\n'), ((1189, 1205), 'decimal.Decimal', 'Decimal', (['""".0001"""'], {}), "('.0001')\n", (1196, 1205), False, 'from decimal import Decimal\n')] |
import os
def header():
print("****************************************")
print("*** School of Net - Caixa Eletrônico ***")
print("****************************************")
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
| [
"os.system"
] | [((214, 262), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (223, 262), False, 'import os\n')] |
# Copyright (c) 2016 Dataman Cloud
# 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 require... | [
"jsonschema.validate",
"omegaclient.utils.url_maker",
"copy.deepcopy"
] | [((1376, 1397), 'copy.deepcopy', 'copy.deepcopy', (['kwargs'], {}), '(kwargs)\n', (1389, 1397), False, 'import copy\n'), ((939, 981), 'omegaclient.utils.url_maker', 'url_maker', (['"""/clusters"""', 'cluster_id', '"""apps"""'], {}), "('/clusters', cluster_id, 'apps')\n", (948, 981), False, 'from omegaclient.utils impor... |
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: <NAME>
## Email: <EMAIL>
## Copyright (c) 2018
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##++++++++++++++++++++++++++++++++++++++++++++++... | [
"os.path.join",
"warnings.filterwarnings",
"os.path.expanduser"
] | [((460, 539), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '"""(Possibly )?corrupt EXIF data"""', 'UserWarning'], {}), "('ignore', '(Possibly )?corrupt EXIF data', UserWarning)\n", (483, 539), False, 'import warnings\n'), ((642, 680), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.encod... |
from calibre.customize import InterfaceActionBase
class ReadwisePlugin(InterfaceActionBase):
name = 'Readwise'
description = 'Export highlights to Readwise'
supported_platforms = ['windows', 'osx', 'linux']
author = '<NAME>'
version = (0, 1, 1)
minimum_calibre_version = (5, 0, 1)
actual_plugin = 'calibre... | [
"calibre_plugins.readwise.config.ConfigWidget"
] | [((504, 518), 'calibre_plugins.readwise.config.ConfigWidget', 'ConfigWidget', ([], {}), '()\n', (516, 518), False, 'from calibre_plugins.readwise.config import ConfigWidget\n')] |
import sys
from src.models import Referencedbentity
from scripts.loading.database_session import get_session
__author__ = 'sweng66'
outfile = 'scripts/dumping/paper/data/pmcid_2021.txt'
def dump_data():
nex_session = get_session()
fw = open(outfile, "w")
all = nex_session.query(Referencedbentity).ord... | [
"scripts.loading.database_session.get_session"
] | [((226, 239), 'scripts.loading.database_session.get_session', 'get_session', ([], {}), '()\n', (237, 239), False, 'from scripts.loading.database_session import get_session\n')] |
from typing import Optional
import typer
from typer import Argument
from ..check import DoCheck
from ..opt import Opt
def patch_project(
hw: str = Argument(
default=..., metavar="hw_prefix", help="prefix of the homework title"
),
patch_branch: str = Argument(
default=..., help="source br... | [
"typer.Option",
"typer.Abort",
"typer.confirm",
"typer.Argument"
] | [((155, 234), 'typer.Argument', 'Argument', ([], {'default': '...', 'metavar': '"""hw_prefix"""', 'help': '"""prefix of the homework title"""'}), "(default=..., metavar='hw_prefix', help='prefix of the homework title')\n", (163, 234), False, 'from typer import Argument\n'), ((274, 346), 'typer.Argument', 'Argument', ([... |
import io
import matplotlib.pyplot as plt
import numpy as np
import telegram
import torch
import torchvision
from PIL import Image
from trixi.util.util import figure_to_image, get_image_as_buffered_file
from trixi.logger.plt.numpyseabornimageplotlogger import NumpySeabornImagePlotLogger
class TelegramMessageLogger(... | [
"trixi.util.util.get_image_as_buffered_file",
"telegram.Bot",
"torch.from_numpy",
"torch.is_tensor",
"torchvision.utils.make_grid"
] | [((935, 965), 'telegram.Bot', 'telegram.Bot', ([], {'token': 'self.token'}), '(token=self.token)\n', (947, 965), False, 'import telegram\n'), ((3436, 3591), 'torchvision.utils.make_grid', 'torchvision.utils.make_grid', (['image_array'], {'nrow': 'nrow', 'padding': 'padding', 'pad_value': 'pad_value', 'normalize': 'norm... |
import os
import json
from typing import Dict
from fintools.settings import get_logger
from fintools.utils import StringWrapper, timeit
from .settings import (
INDUSTRY_SEARCH_DEFAULT_FILENAME,
INDUSTRY_SEARCH_DEFAULT_THRESHOLD
)
logger = get_logger(name=__name__)
class Main:
threshold = INDUSTRY_SEARC... | [
"fintools.settings.get_logger",
"fintools.utils.timeit"
] | [((250, 275), 'fintools.settings.get_logger', 'get_logger', ([], {'name': '__name__'}), '(name=__name__)\n', (260, 275), False, 'from fintools.settings import get_logger\n'), ((346, 367), 'fintools.utils.timeit', 'timeit', ([], {'logger': 'logger'}), '(logger=logger)\n', (352, 367), False, 'from fintools.utils import S... |
import json
from sanic import response
from module.request import requests
from module.check_date import check_date
from module.get_error import get_error, forhidden
from config import parser
def read_food(food):
food_list = food.split('<br/>')
answer = ", ".join(food_list)
for i in range(20, 0, -1):
... | [
"module.check_date.check_date",
"sanic.response.json",
"json.loads",
"config.parser.get",
"module.get_error.get_error",
"module.request.requests"
] | [((433, 461), 'config.parser.get', 'parser.get', (['"""TOKEN"""', '"""token"""'], {}), "('TOKEN', 'token')\n", (443, 461), False, 'from config import parser\n'), ((1659, 1700), 'module.check_date.check_date', 'check_date', ([], {'params': "params['day']['value']"}), "(params=params['day']['value'])\n", (1669, 1700), Fa... |
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.utils.text import slugify
from django.utils.html import strip_tags
from django.db import IntegrityError
from build.management.commands.base_build import Command as BaseBuild
from protein.models import ... | [
"protein.models.ProteinSource.objects.get_or_create",
"os.listdir",
"django.utils.html.strip_tags",
"protein.models.ProteinConformation.objects.prefetch_related",
"yaml.load",
"protein.models.Protein",
"os.path.isfile",
"protein.models.ProteinConformation",
"protein.models.ProteinState.objects.get",... | [((1297, 1361), 'os.sep.join', 'os.sep.join', (["[settings.DATA_DIR, 'structure_data', 'constructs']"], {}), "([settings.DATA_DIR, 'structure_data', 'constructs'])\n", (1308, 1361), False, 'import os\n'), ((1401, 1431), 'os.listdir', 'os.listdir', (['construct_data_dir'], {}), '(construct_data_dir)\n', (1411, 1431), Fa... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__a... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"warnings.warn",
"pulumi.log.warn",
"pulumi.ResourceOptions"
] | [((2738, 2935), 'warnings.warn', 'warnings.warn', (['"""ClusterSecurityGroupIngress is not yet supported by AWS Native, so its creation will currently fail. Please use the classic AWS provider, if possible."""', 'DeprecationWarning'], {}), "(\n 'ClusterSecurityGroupIngress is not yet supported by AWS Native, so its ... |
'''
LighteningCorrector
By <NAME>
lightning.py
Copyright (c) 2017 <NAME> (MIT License)
'''
import praw
from time import sleep
import time
import datetime
import re
import requests
import json
import spellcheck_config
ENDPOINT = "https://api.cognitive.microsoft.com/bing/v5.0/spellcheck/?"
HEADERS = {"Ocp-Apim-Subscrip... | [
"datetime.datetime.utcfromtimestamp",
"re.split",
"re.escape",
"json.loads",
"datetime.datetime.utcnow",
"time.sleep",
"requests.get",
"praw.Reddit",
"time.time"
] | [((1940, 1964), 'praw.Reddit', 'praw.Reddit', (['"""lightning"""'], {}), "('lightning')\n", (1951, 1964), False, 'import praw\n'), ((1673, 1707), 'requests.get', 'requests.get', (['url'], {'headers': 'HEADERS'}), '(url, headers=HEADERS)\n', (1685, 1707), False, 'import requests\n'), ((2151, 2160), 'time.sleep', 'sleep'... |
# -*- coding: utf-8 -*-
"""
The token types for coloring are the following:
+-----------------------------------------------+-------+-------------------------------------------+
| Respective name | Value | Parent's respective name |
+======================================... | [
"html.escape",
"re.compile"
] | [((9376, 9500), 're.compile', 're.compile', (['"""((?:\\\\d(?:_?\\\\d)*\\\\.\\\\d(?:_?\\\\d)*|\\\\d(?:_?\\\\d)*\\\\.|\\\\.\\\\d(?:_?\\\\d)*)(?:[eE][+-]?\\\\d(?:_?\\\\d)*)?[jJ])"""'], {}), "(\n '((?:\\\\d(?:_?\\\\d)*\\\\.\\\\d(?:_?\\\\d)*|\\\\d(?:_?\\\\d)*\\\\.|\\\\.\\\\d(?:_?\\\\d)*)(?:[eE][+-]?\\\\d(?:_?\\\\d)*)?[j... |
from argparse import ArgumentParser
def make_args():
parser = ArgumentParser()
# general
parser.add_argument('--comment', dest='comment', default='0', type=str,
help='comment')
parser.add_argument('--task', dest='task', default='link', type=str,
help='link... | [
"argparse.ArgumentParser"
] | [((66, 82), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (80, 82), False, 'from argparse import ArgumentParser\n')] |
import fileinput, copy, sys
def findFLD( a, i, j ):
i -= 1
j -= 1
while( i >= 0 and j >= 0 ):
if( a[i][j] != '.' ):
return a[i][j]
i -= 1
j -= 1
return None
def findFront(a, i, j ):
i -= 1
while( i >= 0 ):
if( a[i][j] != '.' ):
... | [
"fileinput.input",
"copy.deepcopy"
] | [((3085, 3102), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (3100, 3102), False, 'import fileinput, copy, sys\n'), ((3229, 3245), 'copy.deepcopy', 'copy.deepcopy', (['a'], {}), '(a)\n', (3242, 3245), False, 'import fileinput, copy, sys\n'), ((3773, 3789), 'copy.deepcopy', 'copy.deepcopy', (['t'], {}), '(t)\... |
import random
class XOR:
def __init__(self):
self.states = [[1,1], [1,0], [0,1], [0,0]]
self.current_state = []
def step(self, action):
if (self.current_state == [1,1] or self.current_state == [0,0]) and action == 0:
reward = 1
elif (self.current_state == [1,0] or ... | [
"random.choice"
] | [((580, 606), 'random.choice', 'random.choice', (['self.states'], {}), '(self.states)\n', (593, 606), False, 'import random\n')] |
from typing import List
# import phonenumbers
from aiohttp.web_response import Response
from aiohttp.web import Request
from aiohttp_rest_api import AioHTTPRestEndpoint
class DemoEndpoint(AioHTTPRestEndpoint):
def connected_routes(self) -> List[str]:
"""
"""
return [
'/demo/... | [
"aiohttp.web_response.Response"
] | [((404, 460), 'aiohttp.web_response.Response', 'Response', ([], {'status': '(200)', 'body': '""""""', 'content_type': '"""text/plain"""'}), "(status=200, body='', content_type='text/plain')\n", (412, 460), False, 'from aiohttp.web_response import Response\n')] |
import os
import json
with open(os.path.abspath(os.path.dirname(__file__) + '/config.json'), 'r') as f:
raw_config = json.load(f)
class TestConfig:
def setEnvironment(self,test_env):
config = {}
config["botName"] = raw_config["botName"]
if test_env == 'development':
test_en... | [
"json.load",
"os.path.dirname"
] | [((122, 134), 'json.load', 'json.load', (['f'], {}), '(f)\n', (131, 134), False, 'import json\n'), ((49, 74), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (64, 74), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["app"]
import os
import glob
import string
import random
import subprocess as sp
import tweepy
from skimage import img_as_ubyte
from skimage.transform import resize
from skimage.io import imread, imsave
import ... | [
"flask.render_template",
"flask.request.args.get",
"flask.send_from_directory",
"random.choice",
"flask.Flask",
"subprocess.Popen",
"os.path.splitext",
"tweepy.OAuthHandler",
"flask.url_for",
"skimage.io.imread",
"tweepy.API",
"skimage.io.imsave",
"flask.abort",
"skimage.transform.resize",... | [((386, 407), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (397, 407), False, 'import flask\n'), ((500, 535), 'flask.render_template', 'flask.render_template', (['"""index.html"""'], {}), "('index.html')\n", (521, 535), False, 'import flask\n'), ((571, 605), 'subprocess.Popen', 'sp.Popen', (["['kil... |
from setuptools import setup, find_packages
import os
import re
import subprocess
import sys
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = []
def run(self):
errno = subprocess.call([sys.executable, '-m', 'pytest', 'tests'])
raise SystemExit... | [
"os.path.dirname",
"setuptools.find_packages",
"subprocess.call"
] | [((237, 295), 'subprocess.call', 'subprocess.call', (["[sys.executable, '-m', 'pytest', 'tests']"], {}), "([sys.executable, '-m', 'pytest', 'tests'])\n", (252, 295), False, 'import subprocess\n'), ((1613, 1628), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1626, 1628), False, 'from setuptools import ... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2022 BigML
#
# 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 ... | [
"bigml.api_handlers.resourcehandler.get_id",
"sys._getframe"
] | [((3390, 3422), 'bigml.api_handlers.resourcehandler.get_id', 'get_id', (["world.source['resource']"], {}), "(world.source['resource'])\n", (3396, 3422), False, 'from bigml.api_handlers.resourcehandler import get_id\n'), ((3629, 3661), 'bigml.api_handlers.resourcehandler.get_id', 'get_id', (["world.source['resource']"],... |
import os
import sys
import time
from pickle import Pickler, Unpickler
from random import shuffle
import numpy as np
from Arena import Arena
from MCTS import MCTS
from connect4.Connect4BoardEvaluate import getBoardScoreTheoretical
from connect4.Connect4Game import Connect4Game
from connect4.Connect4Heuristics import ... | [
"os.path.exists",
"connect4.Connect4Game.Connect4Game",
"MCTS.MCTS",
"connect4.Connect4Heuristics.heuristic2_prob",
"random.shuffle",
"os.makedirs",
"pytorch_classification.utils.AverageMeter",
"os.path.join",
"pickle.Pickler",
"connect4.Connect4BoardEvaluate.getBoardScoreTheoretical",
"os.path.... | [((948, 985), 'MCTS.MCTS', 'MCTS', (['self.game', 'self.nnet', 'self.args'], {}), '(self.game, self.nnet, self.args)\n', (952, 985), False, 'from MCTS import MCTS\n'), ((11743, 11817), 'os.path.join', 'os.path.join', (['self.args.load_folder_file[0]', 'self.args.load_folder_file[1]'], {}), '(self.args.load_folder_file[... |
__authors__ = ["<NAME>", "<NAME>", "<NAME>"]
__copyright__ = "Copyright 2015, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
import sys
import os
from os.path import join
from subprocess import call
from tempfile import mkdtemp
import hashlib
import urllib
from shutil import rmtree
from snakemake import snakemake
... | [
"os.path.exists",
"os.listdir",
"hashlib.md5",
"os.path.join",
"snakemake.snakemake",
"urllib.request.urlopen",
"os.path.dirname",
"os.path.isdir",
"tempfile.mkdtemp",
"os.mkdir",
"shutil.rmtree",
"nose.run"
] | [((1305, 1335), 'os.path.join', 'join', (['path', '"""expected-results"""'], {}), "(path, 'expected-results')\n", (1309, 1335), False, 'from os.path import join\n'), ((1352, 1373), 'os.path.join', 'join', (['path', 'snakefile'], {}), '(path, snakefile)\n', (1356, 1373), False, 'from os.path import join\n'), ((1385, 141... |
from app.schemas import game_schema
from .action_handler import ActionHandler
class CallForBrawlActionHandler(ActionHandler):
@property
def activity_text(self):
return f"player {self.player} called fer a brawl, " \
f"waitin' fer vote: " \
f"{self.get_brawl_call_participat... | [
"app.schemas.game_schema.CallForBrawlActionData",
"app.schemas.game_schema.Positions.tr_positions"
] | [((696, 842), 'app.schemas.game_schema.CallForBrawlActionData', 'game_schema.CallForBrawlActionData', ([], {'governor': 'self.player', 'participating_players': 'participating_players', 'state': 'game_schema.State.InProgress'}), '(governor=self.player,\n participating_players=participating_players, state=game_schema.... |
from testex import create_app
from testex.models import db, Data
import json
import os
from ddt import ddt, data
from flask_testing import TestCase
@ddt
class Test(TestCase):
"""
Test object for testing application, inherited from `TestCase` of
flask-testing module
"""
def create_app(self):
... | [
"testex.models.db.create_all",
"testex.create_app",
"testex.models.db.drop_all",
"testex.models.Data.query.get",
"testex.models.db.session.add",
"json.dumps",
"testex.models.db.session.remove",
"testex.models.db.session.commit",
"os.path.dirname",
"ddt.data",
"testex.models.Data"
] | [((764, 1024), 'ddt.data', 'data', (["[1, [1, 2, 3, 4], [1, 2, 3, 5], 'diff starts from offset 3']", "[10, [1, 2, 3], [1, 2], 'sides have different size']", "[20, [5], [6, 7], 'sides have different size']", "[100, 'abcdef', 'abcdef', 'sides are equal']", "[101, '', '', 'sides are equal']"], {}), "([1, [1, 2, 3, 4], [1,... |
"""
© Copyright 2021 Graphcore Ltd. All rights reserved.
© Copyright 2020, The Hugging Face Team, Licenced under the Apache License,Version 2.0
"""
"""
# Hugging Face: Fine-tuning a pretrained transformer
This tutorial demonstrates how to fine-tune a pretrained model from the Hugging
Face transformers library using ... | [
"poptorch.BeginBlock",
"poptorch.Options",
"poptorch.DataLoader",
"transformers.AutoModelForSequenceClassification.from_pretrained",
"datasets.load_dataset",
"transformers.AutoTokenizer.from_pretrained",
"poptorch.identity_loss",
"torch.no_grad",
"sklearn.metrics.accuracy_score"
] | [((1130, 1150), 'datasets.load_dataset', 'load_dataset', (['"""imdb"""'], {}), "('imdb')\n", (1142, 1150), False, 'from datasets import load_dataset\n'), ((2457, 2520), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""google/electra-small-generator"""'], {}), "('google/electra-small-... |
import sys
def extract_vars(vars, keys):
"""Utility function to extract vars from dict
>>> a, c = extract_vars({"a": 1, "b": 2", "c": 3}, "a,c")
"""
keys = keys.split(",")
for k in keys:
yield vars[k.strip()]
def is_brownie_coverage_enabled(tenv):
if tenv.kind == "ethereum" and "bro... | [
"brownie._config.CONFIG.argv.get"
] | [((396, 430), 'brownie._config.CONFIG.argv.get', 'CONFIG.argv.get', (['"""coverage"""', '(False)'], {}), "('coverage', False)\n", (411, 430), False, 'from brownie._config import CONFIG\n')] |
"""
Handlers for Content-Encoding.
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
"""
import codecs
import io
import typing
import zlib
from ._exceptions import DecodingError
try:
import brotlicffi
except ImportError: # pragma: nocover
brotlicffi = None
class ContentDecode... | [
"zlib.decompressobj",
"codecs.getincrementaldecoder",
"io.BytesIO",
"brotlicffi.Decompressor",
"io.StringIO"
] | [((943, 963), 'zlib.decompressobj', 'zlib.decompressobj', ([], {}), '()\n', (961, 963), False, 'import zlib\n'), ((1779, 1818), 'zlib.decompressobj', 'zlib.decompressobj', (['(zlib.MAX_WBITS | 16)'], {}), '(zlib.MAX_WBITS | 16)\n', (1797, 1818), False, 'import zlib\n'), ((2953, 2978), 'brotlicffi.Decompressor', 'brotli... |
"""
Module that provides retrying-at-a-particular-interval functionality.
"""
import random
from characteristic import Attribute, attributes
from effect import Delay, Effect, Func, sync_performer
from effect.retry import retry as effect_retry
from twisted.internet import defer
from twisted.python.failure import Fai... | [
"random.uniform",
"characteristic.attributes",
"characteristic.Attribute",
"effect.retry.retry",
"twisted.internet.defer.maybeDeferred",
"effect.Func",
"twisted.python.failure.Failure",
"effect.Delay",
"twisted.internet.defer.Deferred"
] | [((10777, 10819), 'characteristic.attributes', 'attributes', (["['can_retry', 'next_interval']"], {}), "(['can_retry', 'next_interval'])\n", (10787, 10819), False, 'from characteristic import Attribute, attributes\n'), ((11727, 11765), 'characteristic.attributes', 'attributes', (["['effect', 'should_retry']"], {}), "([... |
import logging
from .Basic import Basic
from decimal import Decimal
from firestone_engine.Utils import Utils
class Ydls(Basic):
_logger = logging.getLogger(__name__)
_MIN_TIME_PERIOD_LENGTH = 15
def match_data(self):
if self.is_forece_stop():
return False
if(B... | [
"logging.getLogger",
"firestone_engine.Utils.Utils.round_dec",
"decimal.Decimal"
] | [((151, 178), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (168, 178), False, 'import logging\n'), ((1078, 1111), 'decimal.Decimal', 'Decimal', (["self.dataLastRow['high']"], {}), "(self.dataLastRow['high'])\n", (1085, 1111), False, 'from decimal import Decimal\n'), ((1127, 1159), 'deci... |
""" Censors audio chunks by muting explicit sections """
from multiprocessing import Lock
from pathlib import Path
from colorama import Fore
from pydub import AudioSegment
from utils import CHUNK_LEN
from audio import ChunkWrapper
from speech import Timestamp, Transcribe
class Censor():
""" Superclass of CensorFi... | [
"pathlib.Path",
"speech.Timestamp",
"pydub.AudioSegment.from_file",
"multiprocessing.Lock",
"pydub.AudioSegment.silent",
"audio.ChunkWrapper",
"speech.Transcribe"
] | [((357, 363), 'multiprocessing.Lock', 'Lock', ([], {}), '()\n', (361, 363), False, 'from multiprocessing import Lock\n'), ((785, 818), 'pydub.AudioSegment.from_file', 'AudioSegment.from_file', (['file_path'], {}), '(file_path)\n', (807, 818), False, 'from pydub import AudioSegment\n'), ((949, 976), 'audio.ChunkWrapper'... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 28 21:44:53 2020
@author: Taemin
"""
import pandas as pd
import json
# read csv file and convert it to dictionary
df = pd.read_csv(r'C:\Users\Taemin\Desktop\Hackerton-fintech\Kospi-200\Kospi-200.csv')
Code = df["Code"].tolist()
for i in range(len(Code)):
if (le... | [
"json.dumps",
"pandas.read_csv"
] | [((170, 261), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\Users\\\\Taemin\\\\Desktop\\\\Hackerton-fintech\\\\Kospi-200\\\\Kospi-200.csv"""'], {}), "(\n 'C:\\\\Users\\\\Taemin\\\\Desktop\\\\Hackerton-fintech\\\\Kospi-200\\\\Kospi-200.csv')\n", (181, 261), True, 'import pandas as pd\n'), ((1072, 1113), 'json.dumps',... |
"""
Arguments should be (in order): gamedate (YYYYMMDD) away team abbreviation (e.g. BOS) home team abbreviation (e.g. CLE).
The file team_metadata.csv has two required columns: ABBR and PRIMARY_COLOR (as HTML color code)
The schedule.csv needs to contain the GAMECODE (YYYYMMDD/AWYHOM), first year of the SEASON (2017... | [
"pandas.Series",
"os.path.exists",
"json.loads",
"yeelight.Bulb",
"pandas.read_csv",
"json.dumps",
"requests.get",
"time.sleep",
"pandas.to_datetime"
] | [((4340, 4354), 'time.sleep', 'time.sleep', (['(60)'], {}), '(60)\n', (4350, 4354), False, 'import time\n'), ((4447, 4487), 'pandas.read_csv', 'pd.read_csv', (['"""schedule.csv"""'], {'index_col': '(0)'}), "('schedule.csv', index_col=0)\n", (4458, 4487), True, 'import pandas as pd\n'), ((4504, 4549), 'pandas.read_csv',... |
"""
--- Day 3: No Matter How You Slice It ---
https://adventofcode.com/2018/day/3
"""
from types import SimpleNamespace
import numpy as np
from aocd import data
from parse import parse
template = "#{id:d} @ {col:d},{row:d}: {w:d}x{h:d}"
claims = [SimpleNamespace(**parse(template, s).named) for s in data.splitlines()... | [
"parse.parse",
"aocd.data.splitlines"
] | [((303, 320), 'aocd.data.splitlines', 'data.splitlines', ([], {}), '()\n', (318, 320), False, 'from aocd import data\n'), ((268, 286), 'parse.parse', 'parse', (['template', 's'], {}), '(template, s)\n', (273, 286), False, 'from parse import parse\n')] |
import numpy as np
positions = np.loadtxt("input.txt", dtype=int, delimiter=",")
part1_fuel = np.abs(
np.tile(positions, (positions.size, 1))
- np.arange(1, positions.size + 1).reshape(-1, 1)
)
part2_fuel = part1_fuel * (part1_fuel + 1) // 2
print("Part 1:", part1_fuel.sum(axis=1).min())
print("Part 2:", par... | [
"numpy.tile",
"numpy.loadtxt",
"numpy.arange"
] | [((32, 81), 'numpy.loadtxt', 'np.loadtxt', (['"""input.txt"""'], {'dtype': 'int', 'delimiter': '""","""'}), "('input.txt', dtype=int, delimiter=',')\n", (42, 81), True, 'import numpy as np\n'), ((108, 147), 'numpy.tile', 'np.tile', (['positions', '(positions.size, 1)'], {}), '(positions, (positions.size, 1))\n', (115, ... |
import bpy
import re
class TILA_CopyMirrorVertexGroup(bpy.types.Operator):
bl_idname = "object.tila_copy_mirror_vertex_group"
bl_label = "TILA: Copy and Mirror Vertex Group"
bl_options = {'REGISTER', 'UNDO'}
left : bpy.props.StringProperty(name='left', default='.L')
right : bpy.props.StringProper... | [
"bpy.utils.register_classes_factory",
"bpy.props.StringProperty",
"bpy.props.BoolProperty",
"bpy.ops.object.vertex_group_mirror",
"bpy.ops.object.vertex_group_copy",
"bpy.types.MESH_MT_vertex_group_context_menu.append"
] | [((2373, 2434), 'bpy.types.MESH_MT_vertex_group_context_menu.append', 'bpy.types.MESH_MT_vertex_group_context_menu.append', (['menu_draw'], {}), '(menu_draw)\n', (2423, 2434), False, 'import bpy\n'), ((2500, 2543), 'bpy.utils.register_classes_factory', 'bpy.utils.register_classes_factory', (['classes'], {}), '(classes)... |
#coding:utf-8
#
# id: bugs.core_6088
# title: "SIMILAR TO" hangs when processing parenthesis
# decription:
# Confirmed normal work (evaluation for less than 5 ms) on WI-T4.0.0.1598
# 31.12.2020: increased max duration threshold from 100 to 150 ms.
# ... | [
"pytest.mark.version",
"firebird.qa.db_factory",
"firebird.qa.isql_act"
] | [((571, 616), 'firebird.qa.db_factory', 'db_factory', ([], {'sql_dialect': '(3)', 'init': 'init_script_1'}), '(sql_dialect=3, init=init_script_1)\n', (581, 616), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((2223, 2285), 'firebird.qa.isql_act', 'isql_act', (['"""db_1"""', 'test_script_1'], {'subst... |
from enum import Enum
from functools import wraps
from typing import Callable
from inspect import signature
class Restrict:
def __init__(self, check_function: Callable):
self.check_function = check_function
sig = signature(check_function)
self.params = sig.parameters.keys()
def __ca... | [
"inspect.signature",
"functools.wraps"
] | [((236, 261), 'inspect.signature', 'signature', (['check_function'], {}), '(check_function)\n', (245, 261), False, 'from inspect import signature\n'), ((362, 377), 'inspect.signature', 'signature', (['func'], {}), '(func)\n', (371, 377), False, 'from inspect import signature\n'), ((452, 463), 'functools.wraps', 'wraps'... |
import numpy
import pandas
from utils import pos_range
class CrossWordPuzzle():
def __init__(self, word_df, layout_df):
assert len(word_df) == len(layout_df)
self.word_list = word_df["word"]
self.puzzle_df = pandas.concat([word_df, layout_df], axis=1)
self.puzzle_df["len"] = [*map(len, self.word_list)]
self... | [
"numpy.array",
"utils.pos_range",
"pandas.concat"
] | [((216, 259), 'pandas.concat', 'pandas.concat', (['[word_df, layout_df]'], {'axis': '(1)'}), '([word_df, layout_df], axis=1)\n', (229, 259), False, 'import pandas\n'), ((899, 933), 'numpy.array', 'numpy.array', (["self.puzzle_df['len']"], {}), "(self.puzzle_df['len'])\n", (910, 933), False, 'import numpy\n'), ((947, 98... |
import numpy as np
import re
import decimal
rule_names=[]
rules=[]
### Parsing
r1=re.compile("(.+): (\d+)-(\d+) or (\d+)-(\d+)")
with open('resources/day_16_tickets-data.txt','r') as f:
while(True):
m=r1.match(f.readline().strip())
if not m:
break
rule_names.append(m.groups()... | [
"numpy.ones",
"re.compile",
"numpy.where",
"numpy.array",
"numpy.vectorize"
] | [((85, 135), 're.compile', 're.compile', (['"""(.+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)"""'], {}), "('(.+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)')\n", (95, 135), False, 'import re\n'), ((1300, 1334), 'numpy.ones', 'np.ones', (['valid.shape'], {'dtype': '"""bool"""'}), "(valid.shape, dtype='bool')\n", (1307, 1334)... |
# -*- coding: utf-8 -*-
"""URLs for all views."""
from django.contrib.auth import views as auth_views
from django.urls import include
from django.urls import path
from django.urls import reverse_lazy
from django.views.generic import RedirectView
from django.views.generic import TemplateView
from djauth.views import ... | [
"django.urls.include",
"django.views.generic.TemplateView.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"django.contrib.auth.views.LoginView.as_view",
"django.urls.reverse_lazy",
"django.urls.path"
] | [((873, 989), 'django.urls.path', 'path', (['"""accounts/loggedout/"""', 'loggedout', "{'template_name': 'registration/logged_out.html'}"], {'name': '"""auth_loggedout"""'}), "('accounts/loggedout/', loggedout, {'template_name':\n 'registration/logged_out.html'}, name='auth_loggedout')\n", (877, 989), False, 'from d... |
import unittest
from cash_desk import CashDesk
class TestCashDesk(unittest.TestCase):
def setUp(self):
self.kasa = CashDesk()
self.kasa.scan('Sandwich')
def test_init(self):
self.assertEqual(
self.kasa.discounts,
{'Sandwich': [3, 2], 'Cucumber': [2, 1], 'Apple... | [
"unittest.main",
"cash_desk.CashDesk"
] | [((1697, 1712), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1710, 1712), False, 'import unittest\n'), ((130, 140), 'cash_desk.CashDesk', 'CashDesk', ([], {}), '()\n', (138, 140), False, 'from cash_desk import CashDesk\n')] |
from plugin import plugin
class firefox(plugin, ):
def __init__(self, os, maxsize):
plugin.__init__(self, os, maxsize, __name__)
print ('loaded %s' % __name__)
def preGet(self):
lFiles = self.listFiles()
size = 0
for f in lFiles:
size += f.size
pri... | [
"os.path.exists",
"ops.pprint.pprint",
"os.makedirs",
"os.path.join",
"firefox_decrypt.read_passwords_from_profile",
"os.path.split",
"shutil.copy",
"plugin.plugin.__init__",
"sys.path.append"
] | [((99, 143), 'plugin.plugin.__init__', 'plugin.__init__', (['self', 'os', 'maxsize', '__name__'], {}), '(self, os, maxsize, __name__)\n', (114, 143), False, 'from plugin import plugin\n'), ((723, 754), 'sys.path.append', 'sys.path.append', (['windowsScripts'], {}), '(windowsScripts)\n', (738, 754), False, 'import sys\n... |
import os
import sys
import time
from locust import FastHttpUser, task, between, constant,tag
from bs4 import BeautifulSoup
import locust_plugins
sys.path.append(os.path.dirname(__file__) + '/..')
from common.storefront import Storefront
from common.context import Context
from common.api import Api
context = Context... | [
"locust.task",
"common.storefront.Storefront",
"locust.between",
"os.path.dirname",
"common.context.Context"
] | [((313, 322), 'common.context.Context', 'Context', ([], {}), '()\n', (320, 322), False, 'from common.context import Context\n'), ((369, 382), 'locust.between', 'between', (['(2)', '(5)'], {}), '(2, 5)\n', (376, 382), False, 'from locust import FastHttpUser, task, between, constant, tag\n'), ((405, 412), 'locust.task', ... |
#!/usr/bin/env python3
import click
@click.command()
@click.option("--count", default=1)
@click.option("--name")
def hello_cli(count, name):
for _ in range(count):
click.echo(f"Hello {name}!")
if __name__ == "__main__":
hello_cli()
# $ ./counting.py
# Hello None!
# $ ./counting.py --name="melvin"
# ... | [
"click.option",
"click.echo",
"click.command"
] | [((39, 54), 'click.command', 'click.command', ([], {}), '()\n', (52, 54), False, 'import click\n'), ((56, 90), 'click.option', 'click.option', (['"""--count"""'], {'default': '(1)'}), "('--count', default=1)\n", (68, 90), False, 'import click\n'), ((92, 114), 'click.option', 'click.option', (['"""--name"""'], {}), "('-... |
import pytest
import os
from polyglotdb.io import inspect_orthography
from polyglotdb.exceptions import DelimiterError
from polyglotdb import CorpusContext
def test_load_spelling_no_ignore(graph_db, text_spelling_test_dir):
spelling_path = os.path.join(text_spelling_test_dir, 'text_spelling.txt')
parser =... | [
"polyglotdb.io.inspect_orthography",
"os.path.join",
"polyglotdb.CorpusContext"
] | [((249, 306), 'os.path.join', 'os.path.join', (['text_spelling_test_dir', '"""text_spelling.txt"""'], {}), "(text_spelling_test_dir, 'text_spelling.txt')\n", (261, 306), False, 'import os\n'), ((321, 355), 'polyglotdb.io.inspect_orthography', 'inspect_orthography', (['spelling_path'], {}), '(spelling_path)\n', (340, 35... |
from auth.models import get_user
from .blueprint import make_blueprint
from .models import User, query_one
def get_permissions(service, userid):
print('get_permissions', service, userid)
if service != 'ckan-cloud-provisioner': return {}
user = get_user(userid)
if user is None: return {}
... | [
"auth.models.get_user"
] | [((264, 280), 'auth.models.get_user', 'get_user', (['userid'], {}), '(userid)\n', (272, 280), False, 'from auth.models import get_user\n')] |
import os
import sys
import collections
KeyItem = collections.namedtuple('KeyItem', 'redis key type ttl value')
def redis_str(redis, filter=None):
info = redis.connection_pool.connection_kwargs
if 'path' in info: # unix socket
addr = info['path']
elif 'host' in info:
addr = '{0}:{1}'.form... | [
"os.execvp",
"collections.namedtuple",
"os.getcwd",
"os.chdir",
"os.getpid",
"sys.platform.lower"
] | [((51, 112), 'collections.namedtuple', 'collections.namedtuple', (['"""KeyItem"""', '"""redis key type ttl value"""'], {}), "('KeyItem', 'redis key type ttl value')\n", (73, 112), False, 'import collections\n'), ((1212, 1223), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1221, 1223), False, 'import os\n'), ((1521, 1544... |
import numpy as np
import torch
import torch.nn as nn
from .utils import register_model, get_model
from . import cos_norm_classifier
@register_model('MannNet')
class MannNet(nn.Module):
"""Defines a Dynamic Meta-Embedding Network."""
def __init__(self, num_cls=10, model='LeNet', src_weights_init=None,
... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"torch.load",
"torch.nn.Linear",
"numpy.load"
] | [((687, 708), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (706, 708), True, 'import torch.nn as nn\n'), ((738, 759), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (757, 759), True, 'import torch.nn as nn\n'), ((2281, 2320), 'torch.nn.Linear', 'nn.Linear', (['self.feat_d... |
#!/usr/bin/env python3
# Questo file visualizza la chiave "lists" redis
#
# Prima verifica che ci sia la chiave nel form
# Serve per la parte di gestione html in python
import cgi
import cgitb
import html
# Abilita gli errori al server web/http
cgitb.enable()
# Le mie librerie mjl (Json, Files), mhl (Html), flt (T ... | [
"mhl.MyHtml",
"mhl.MyHtmlHead",
"cgi.FieldStorage",
"cgitb.enable",
"html.escape",
"flt.OpenDBFile",
"mhl.MyHtmlBottom"
] | [((248, 262), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (260, 262), False, 'import cgitb\n'), ((680, 706), 'flt.OpenDBFile', 'flt.OpenDBFile', (['ConfigFile'], {}), '(ConfigFile)\n', (694, 706), False, 'import mjl, mhl, flt\n'), ((1057, 1075), 'cgi.FieldStorage', 'cgi.FieldStorage', ([], {}), '()\n', (1073, 107... |
import time
from collections import deque
import torch
import numpy as np
from ... import mohex, hex
from . import json, analysis
from .. import common
from rebar import arrdict
from pavlov import stats, runs, logs
from logging import getLogger
import activelo
import pandas as pd
from functools import wraps
from contex... | [
"logging.getLogger",
"pavlov.runs.resolve",
"pavlov.logs.to_run",
"multiprocessing.Process",
"pavlov.stats.to_run",
"time.sleep",
"multiprocessing.set_start_method",
"numpy.arange",
"numpy.diag_indices_from",
"activelo.improvement",
"collections.deque",
"functools.wraps",
"numpy.exp",
"pan... | [((408, 427), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (417, 427), False, 'from logging import getLogger\n'), ((6455, 6470), 'functools.wraps', 'wraps', (['run_sync'], {}), '(run_sync)\n', (6460, 6470), False, 'from functools import wraps\n'), ((940, 974), 'activelo.solve', 'activelo.solve'... |
# Automatic Domain Randomization, see https://arxiv.org/abs/1910.07113 for details
# Implemented by <NAME> and <NAME>
import numpy as np
from gym.spaces import Box
from collections import deque
from TeachMyAgent.teachers.algos.AbstractTeacher import AbstractTeacher
class ADR(AbstractTeacher):
def __init__(self, m... | [
"numpy.mean",
"collections.deque",
"gym.spaces.Box",
"numpy.array",
"numpy.interp",
"TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__"
] | [((1199, 1277), 'TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__', 'AbstractTeacher.__init__', (['self', 'mins', 'maxs', 'env_reward_lb', 'env_reward_ub', 'seed'], {}), '(self, mins, maxs, env_reward_lb, env_reward_ub, seed)\n', (1223, 1277), False, 'from TeachMyAgent.teachers.algos.AbstractTeacher... |
# Generated by Django 2.2.1 on 2019-07-11 07:05
from django.db import migrations
import pretix.base.models.fields
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0126_item_show_quota_left'),
]
operations = [
migrations.RenameField(
model_name='questi... | [
"django.db.migrations.RenameField"
] | [((266, 374), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""question"""', 'old_name': '"""dependency_value"""', 'new_name': '"""dependency_values"""'}), "(model_name='question', old_name='dependency_value',\n new_name='dependency_values')\n", (288, 374), False, 'from django.db... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from future.utils import python_2_unicode_compatible
import logging
import textwrap
import requests
from copy import deepcopy
from functools import lru_cache
from protmapper.api import ProtMapper, default_site_map
fr... | [
"logging.getLogger",
"textwrap.dedent",
"builtins.str",
"indra.databases.hgnc_client.get_uniprot_id",
"copy.deepcopy",
"functools.lru_cache"
] | [((470, 497), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (487, 497), False, 'import logging\n'), ((15531, 15555), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(10000)'}), '(maxsize=10000)\n', (15540, 15555), False, 'from functools import lru_cache\n'), ((1475, 1651), 'textwra... |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def history_analyze(history):
plt.figure(figsize=(12, 8))
plt.subplot(1, 2, 1)
plt.plot(history.history['accuracy'])
plt.plot(history.history['val_accuracy'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel('epoch')
... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((92, 119), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (102, 119), True, 'import matplotlib.pyplot as plt\n'), ((124, 144), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (135, 144), True, 'import matplotlib.pyplot as plt\n'),... |
# -*- coding: utf-8 -*-
# Copyright © 2019 <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | [
"importlib.util.find_spec",
"imp.find_module"
] | [((1089, 1127), 'importlib.util.find_spec', 'importlib.util.find_spec', (['package_name'], {}), '(package_name)\n', (1113, 1127), False, 'import importlib\n'), ((1305, 1334), 'imp.find_module', 'imp.find_module', (['package_name'], {}), '(package_name)\n', (1320, 1334), False, 'import imp\n')] |
import os
def getReqs(major):
'''
:param major: string of Field of study. e.g: csci
:return: dictionary of courses and their pre_reqs
'''
result = dict()
with open(os.path.abspath(f'algo/doc/pre_req_{major.lower()}.txt'), 'r', encoding='utf-8') as f:
lines = f.readlines()
for line in lines:
line = line.s... | [
"os.path.abspath"
] | [((984, 1030), 'os.path.abspath', 'os.path.abspath', (['f"""algo/doc/courses_taken.txt"""'], {}), "(f'algo/doc/courses_taken.txt')\n", (999, 1030), False, 'import os\n')] |
"""csgame URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | [
"django.conf.urls.url",
"django.urls.path",
"django.urls.include"
] | [((906, 937), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (909, 937), False, 'from django.conf.urls import url\n'), ((944, 1001), 'django.urls.path', 'path', (['"""admin/users/experiment"""', 'player.downloadExperiment'], {}), "('admin/users/experiment', ... |
import logging
from os.path import dirname, join, realpath
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import astroplan as ap
from scipy.constants import c as c_light_ms
from tqdm import tqdm
from skimage import io
from skimage import transform as tf
from scipy.interpolate import interp1d
... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"exoorbit.orbit.Orbit",
"scipy.interpolate.interp1d",
"numpy.nanmean",
"cats.extractor.runner.CatsRunner",
"scipy.stats.ttest_ind",
"numpy.sin",
"matplotlib.pyplot.imshow",
"numpy.histogram",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"ski... | [((2110, 2121), 'astropy.utils.iers.IERS_Auto', 'IERS_Auto', ([], {}), '()\n', (2119, 2121), False, 'from astropy.utils.iers import IERS_Auto\n'), ((2213, 2254), 'cats.simulator.detector.Crires', 'Crires', (['setting', 'detectors'], {'orders': 'orders'}), '(setting, detectors, orders=orders)\n', (2219, 2254), False, 'f... |
import pygame
from consts import *
from snake import Snake, Food
pygame.init()
screen = pygame.display.set_mode((screen_width, screen_height))
clock = pygame.time.Clock()
snake = Snake()
food = Food()
myfont = pygame.font.SysFont("monospace",16)
def drawGrid():
for y in range(0, int(grid_height)):
for x ... | [
"snake.Snake",
"pygame.init",
"pygame.event.get",
"snake.Food",
"pygame.display.set_mode",
"pygame.Rect",
"pygame.draw.rect",
"pygame.time.Clock",
"pygame.display.update",
"pygame.font.SysFont"
] | [((66, 79), 'pygame.init', 'pygame.init', ([], {}), '()\n', (77, 79), False, 'import pygame\n'), ((89, 143), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_height)'], {}), '((screen_width, screen_height))\n', (112, 143), False, 'import pygame\n'), ((152, 171), 'pygame.time.Clock', 'pygam... |
#!/usr/bin/env python
from collections import Iterable, OrderedDict
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.ioff()
from RouToolPa.Parsers.Abstract import Record, Collection, Metadata, Header
from RouToolPa.Parsers.VCF import CollectionVCF, MetadataVCF, HeaderVCF
... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.arange",
"numpy.mean",
"RouToolPa.Parsers.VCF.CollectionVCF",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.delete",
"matplotlib.pyplot.close",
"numpy.linspace",
"collections.OrderedDict",
"matplotlib.... | [((107, 128), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (121, 128), False, 'import matplotlib\n'), ((161, 171), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (169, 171), True, 'import matplotlib.pyplot as plt\n'), ((4213, 4254), 'numpy.array', 'np.array', (['[record.pos for record ... |
from persia.ctx import InferCtx
from persia.service import get_middleware_services
from ts.torch_handler.base_handler import BaseHandler
from abc import ABC
import torch
device_id = 0 if torch.cuda.is_available() else None
class PersiaHandler(BaseHandler, ABC):
def initialize(self, context):
super().ini... | [
"torch.no_grad",
"torch.cuda.is_available",
"persia.ctx.InferCtx",
"torch.reshape",
"persia.service.get_middleware_services"
] | [((189, 214), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (212, 214), False, 'import torch\n'), ((364, 389), 'persia.service.get_middleware_services', 'get_middleware_services', ([], {}), '()\n', (387, 389), False, 'from persia.service import get_middleware_services\n'), ((420, 467), 'persia... |
# Copyright 2020-2021 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"utils.utils.addComputedStatistics",
"os.path.exists",
"report.report.Report.get_header",
"click.option",
"config.config.ConfigHandler.get_header",
"utils.utils.get_run_path",
"os.path.join",
"report.report.Report",
"config.config.ConfigHandler.get_config",
"click.command"
] | [((882, 897), 'click.command', 'click.command', ([], {}), '()\n', (895, 897), False, 'import click\n'), ((899, 964), 'click.option', 'click.option', (['"""--design"""', '"""-d"""'], {'required': '(True)', 'help': '"""Design Path"""'}), "('--design', '-d', required=True, help='Design Path')\n", (911, 964), False, 'impor... |
# Generated by Django 2.0.3 on 2018-05-26 22:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0017_remove_patient_priority'),
]
operations = [
migrations.AlterField(
model_name='user',
name='photo',
... | [
"django.db.models.ImageField"
] | [((336, 466), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'help_text': '"""Photo of user."""', 'max_length': '(500)', 'null': '(True)', 'upload_to': '"""media/"""', 'verbose_name': '"""Photo"""'}), "(blank=True, help_text='Photo of user.', max_length=500,\n null=True, upload_to='medi... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from hl7parser.hl7 import HL7Delimiters
from hl7parser.hl7_data_types import HL7Datetime
@pytest.mark.parametrize(
"input_string, isoformat, string_repr",
[
("198808181126", "1988-08-18T11:26:00", "198808181126"),
... | [
"hl7parser.hl7_data_types.HL7Datetime",
"pytest.mark.parametrize",
"hl7parser.hl7.HL7Delimiters"
] | [((174, 460), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_string, isoformat, string_repr"""', "[('198808181126', '1988-08-18T11:26:00', '198808181126'), ('', '', ''), (\n '2010', '2010-01-01T00:00:00', '2010'), ('-200', '', ''), (\n '20190924143134^YYYYMMDDHHMMSS', '2019-09-24T14:31:34', '20... |
"""
prettyqr
https://github.com/olorin/prettyqr
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
desc = f.read()
setup(
name="prettyqr",
version="0.0.2... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((163, 185), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'from os import path\n'), ((198, 227), 'os.path.join', 'path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (207, 227), False, 'from os import path\n'), ((1104, 1136), 'setuptools.find_packages'... |
# -*- coding: UTF-8 -*-
# Copyright 2013-2016 <NAME>
#
# License: BSD (see file COPYING for details)
"""Adds feedback-based workflow to :mod:`lino_xl.lib.cal`.
Used e.g. by :ref:`welfare`.
"""
from __future__ import unicode_literals
import logging
logger = logging.getLogger(__name__)
from django.utils.translation... | [
"logging.getLogger",
"django.utils.translation.ugettext_lazy",
"lino.api.dd.today",
"lino.api.dd.fds",
"django.utils.translation.pgettext_lazy"
] | [((262, 289), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (279, 289), False, 'import logging\n'), ((669, 683), 'django.utils.translation.ugettext_lazy', '_', (['"""Published"""'], {}), "('Published')\n", (670, 683), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((... |
# type: ignore
from typing import Any
import qtvscodestyle as qtvsc
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt
from PySide6.QtGui import QAction, QActionGroup, QTextOption
from PySide6.QtWidgets import (
QCheckBox,
QColorDialog,
QComboBox,
QDateTimeEdit,
QDial,
QDockWidget... | [
"PySide6.QtWidgets.QDockWidget",
"PySide6.QtWidgets.QToolBar",
"qtvscodestyle.theme_icon",
"PySide6.QtWidgets.QTableView",
"PySide6.QtWidgets.QGridLayout",
"PySide6.QtWidgets.QComboBox",
"PySide6.QtWidgets.QSplitter",
"PySide6.QtWidgets.QVBoxLayout",
"PySide6.QtWidgets.QFileDialog.getOpenFileName",
... | [((975, 1007), 'qtvscodestyle.theme_icon', 'qtvsc.theme_icon', (['FaRegular.STAR'], {}), '(FaRegular.STAR)\n', (991, 1007), True, 'import qtvscodestyle as qtvsc\n'), ((1048, 1072), 'PySide6.QtWidgets.QGroupBox', 'QGroupBox', (['"""Push Button"""'], {}), "('Push Button')\n", (1057, 1072), False, 'from PySide6.QtWidgets ... |
#!/usr/bin/env python3
# coding: utf-8
"""
時計表示スクリプト
中身はいつか作ったものと同様ですが、
並列処理を実現するために少し手直しを加えています。
"""
from logging import getLogger
logger = getLogger(__name__)
logger.debug('loaded')
import datetime
from PIL import Image, ImageDraw, ImageFont
import unicornhathd
import time
COLOR = (200, 0, 0)
width,... | [
"logging.getLogger",
"unicornhathd.show",
"unicornhathd.set_pixel",
"PIL.Image.new",
"PIL.ImageFont.truetype",
"time.sleep",
"unicornhathd.clear",
"datetime.datetime.now",
"PIL.ImageDraw.Draw",
"unicornhathd.rotation",
"unicornhathd.get_shape"
] | [((155, 174), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'from logging import getLogger\n'), ((330, 354), 'unicornhathd.get_shape', 'unicornhathd.get_shape', ([], {}), '()\n', (352, 354), False, 'import unicornhathd\n'), ((373, 445), 'PIL.ImageFont.truetype', 'ImageFont.tru... |
from random import randint
from time import sleep
numsort = list()
def sort():
numsort.clear()
print('Sorteando 5 valores: ', end='')
for c in range(0, 5):
numsort.append(randint(1, 10))
for n in numsort:
print(n, end=' ')
sleep(0.5)
print('Pronto !')
sleep(1)
def add... | [
"random.randint",
"time.sleep"
] | [((302, 310), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (307, 310), False, 'from time import sleep\n'), ((265, 275), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (270, 275), False, 'from time import sleep\n'), ((193, 207), 'random.randint', 'randint', (['(1)', '(10)'], {}), '(1, 10)\n', (200, 207), False, 'f... |
import numpy as np
from .util import ensure_rng
def _hashable(x):
""" ensure that an point is hashable by a python dict """
return tuple(map(float, x))
class TargetSpace(object):
"""
Holds the param-space coordinates (X) and target values (Y)
Allows for constant-time appends while ensuring no du... | [
"numpy.ones_like",
"numpy.asarray",
"numpy.floor",
"numpy.array",
"numpy.empty",
"numpy.concatenate",
"numpy.zeros_like"
] | [((1599, 1628), 'numpy.empty', 'np.empty', ([], {'shape': '(0, self.dim)'}), '(shape=(0, self.dim))\n', (1607, 1628), True, 'import numpy as np\n'), ((1652, 1669), 'numpy.empty', 'np.empty', ([], {'shape': '(0)'}), '(shape=0)\n', (1660, 1669), True, 'import numpy as np\n'), ((5750, 5790), 'numpy.concatenate', 'np.conca... |
"""
Samplers for perses automated molecular design.
TODO
----
* Determine where `System` object should be stored: In `SamplerState` or in `Thermodynamic State`, or both, or neither?
* Can we create a generalized, extensible `SamplerState` that also stores chemical/thermodynamic state information?
* Can we create a gen... | [
"logging.getLogger",
"simtk.openmm.app.PDBFile.writeFile",
"openmmtools.utils.get_fastest_platform",
"perses.utils.openeye.smiles_to_oemol",
"perses.annihilation.ncmc_switching.NCMCEngine",
"openmmtools.states.SamplerState",
"numpy.exp",
"openmmtools.states.ThermodynamicState",
"perses.dispersed.fep... | [((1333, 1352), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1350, 1352), False, 'import logging\n'), ((1394, 1423), 'logging.getLogger', 'logging.getLogger', (['"""samplers"""'], {}), "('samplers')\n", (1411, 1423), False, 'import logging\n'), ((7187, 7220), 'mdtraj.Topology.from_openmm', 'md.Topology.... |
import os
from tinydb import TinyDB, Query
from tinydb.operations import set
DB_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'olympus_db.json')
TABLE = 'models'
db = TinyDB(DB_PATH)
Model = Query()
def get_all_models():
return db.table(TABLE).all()
def create_new_model(model_object):
db... | [
"os.path.realpath",
"tinydb.Query",
"tinydb.TinyDB",
"tinydb.operations.set"
] | [((188, 203), 'tinydb.TinyDB', 'TinyDB', (['DB_PATH'], {}), '(DB_PATH)\n', (194, 203), False, 'from tinydb import TinyDB, Query\n'), ((213, 220), 'tinydb.Query', 'Query', ([], {}), '()\n', (218, 220), False, 'from tinydb import TinyDB, Query\n'), ((117, 143), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), ... |