code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
'''Body Composition is a Slicer module that allows to segment different parts of the lungs in a manual or semi-automatic basis
with the help of a customized Slicer Editor.
It also performs a set of operations to analyze the different structures of
the volume based on its label map, like Area, Mean, Std.Dev., etc.
First... | [
"numpy.clip",
"slicer.modules.volumes.logic",
"qt.QLineEdit",
"CIP.logic.SlicerUtil.SlicerUtil.getNode",
"qt.QFormLayout",
"qt.QIntValidator",
"slicer.qMRMLNodeComboBox",
"numpy.mean",
"ctk.ctkCollapsibleButton",
"qt.QRadioButton",
"numpy.max",
"qt.QLabel",
"slicer.app.applicationLogic",
"... | [((2919, 2945), 'ctk.ctkCollapsibleButton', 'ctk.ctkCollapsibleButton', ([], {}), '()\n', (2943, 2945), False, 'import qt, vtk, ctk, slicer\n'), ((3266, 3312), 'qt.QFormLayout', 'qt.QFormLayout', (['self.mainAreaCollapsibleButton'], {}), '(self.mainAreaCollapsibleButton)\n', (3280, 3312), False, 'import qt, vtk, ctk, s... |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"extensions.rules.checked_proof.Correct",
"extensions.rules.checked_proof.NotCorrect",
"extensions.rules.checked_proof.NotCorrectByCategory"
] | [((1689, 1712), 'extensions.rules.checked_proof.Correct', 'checked_proof.Correct', ([], {}), '()\n', (1710, 1712), False, 'from extensions.rules import checked_proof\n'), ((1958, 1984), 'extensions.rules.checked_proof.NotCorrect', 'checked_proof.NotCorrect', ([], {}), '()\n', (1982, 1984), False, 'from extensions.rules... |
import os
from xml.etree.ElementTree import Element
from mipqctool.exceptions import MappingValidationError
from mipqctool.config import LOGGER
class Correspondence(object):
"""Class for storing and processing a mapping correpondence.
Arguments:
:param mapping: A Mapping object
:param source_paths: lis... | [
"xml.etree.ElementTree.Element",
"os.path.splitext",
"mipqctool.exceptions.MappingValidationError"
] | [((4285, 4310), 'xml.etree.ElementTree.Element', 'Element', (['"""correspondence"""'], {}), "('correspondence')\n", (4292, 4310), False, 'from xml.etree.ElementTree import Element\n'), ((4337, 4360), 'xml.etree.ElementTree.Element', 'Element', (['"""source-paths"""'], {}), "('source-paths')\n", (4344, 4360), False, 'fr... |
import datetime
import os
import backend.processOptions as opts
import rapidjson
def load():
os.chdir(os.path.dirname(__file__))
if not os.path.exists("../times/"):
os.mkdir("../times/")
global nameList
nameList = []
for filename in os.listdir("../times/"):
if filename.endswith(... | [
"os.path.exists",
"os.listdir",
"os.path.splitext",
"datetime.date.today",
"os.path.dirname",
"datetime.datetime.now",
"os.mkdir",
"rapidjson.dumps",
"datetime.timedelta",
"datetime.time.fromisoformat",
"rapidjson.loads"
] | [((266, 289), 'os.listdir', 'os.listdir', (['"""../times/"""'], {}), "('../times/')\n", (276, 289), False, 'import os\n'), ((1147, 1208), 'rapidjson.dumps', 'rapidjson.dumps', (['signData'], {'datetime_mode': 'rapidjson.DM_ISO8601'}), '(signData, datetime_mode=rapidjson.DM_ISO8601)\n', (1162, 1208), False, 'import rapi... |
from _sims4_collections import frozendict
from sims.sim_dialogs import SimPersonalityAssignmentDialog
from sims4.tuning.tunable import HasTunableFactory, TunableVariant
from ui.ui_dialog import UiDialogOkCancel
import element_utils
import elements
import services
class UiDialogElement(HasTunableFactory, elements.Paren... | [
"_sims4_collections.frozendict",
"ui.ui_dialog.UiDialogOkCancel.TunableFactory",
"services.ui_dialog_service",
"sims.sim_dialogs.SimPersonalityAssignmentDialog.TunableFactory",
"element_utils.soft_sleep_forever"
] | [((696, 708), '_sims4_collections.frozendict', 'frozendict', ([], {}), '()\n', (706, 708), False, 'from _sims4_collections import frozendict\n'), ((469, 502), 'ui.ui_dialog.UiDialogOkCancel.TunableFactory', 'UiDialogOkCancel.TunableFactory', ([], {}), '()\n', (500, 502), False, 'from ui.ui_dialog import UiDialogOkCance... |
"""Data loading for SVMRank-style data sets."""
from typing import Callable
from typing import List
from typing import Optional
from typing import Union
import numpy as _np
import torch as _torch
import logging
from scipy.sparse import coo_matrix as _coo_matrix
from sklearn.datasets import load_svmlight_file as _load... | [
"sklearn.datasets.load_svmlight_file",
"torch.LongTensor",
"pytorchltr.datasets.list_sampler.ListSampler",
"torch.Size",
"numpy.where",
"numpy.max",
"pytorchltr.datasets.svmrank.parser.parse_svmrank_file",
"numpy.array",
"numpy.sum",
"scipy.sparse.coo_matrix",
"numpy.vstack",
"numpy.min",
"l... | [((2101, 2154), 'logging.info', 'logging.info', (['"""loading svmrank dataset from %s"""', 'file'], {}), "('loading svmrank dataset from %s', file)\n", (2113, 2154), False, 'import logging\n'), ((8527, 8565), 'torch.LongTensor', '_torch.LongTensor', (['self._ys[start:end]'], {}), '(self._ys[start:end])\n', (8544, 8565)... |
import sqlite3
class NoUserFound(Exception):
pass
class PasswordMissMatch(Exception):
pass
class Database:
def __init__(self):
self.connection = sqlite3.connect('userdb.db')
self.cur = self.connection.cursor()
self.cur.execute("CREATE TABLE IF NOT EXISTS userinfo (username PRIMA... | [
"sqlite3.connect"
] | [((169, 197), 'sqlite3.connect', 'sqlite3.connect', (['"""userdb.db"""'], {}), "('userdb.db')\n", (184, 197), False, 'import sqlite3\n')] |
import numpy as np
from simdkalman.primitives import predict, update
# define model
state_transition = np.array([[1,1],[0,1]])
process_noise = np.eye(2)*0.01
observation_model = np.array([[1,0]])
observation_noise = np.array([[1.0]])
# initial state
m = np.array([0, 1])
P = np.eye(2)
# predict next state
m, P = pred... | [
"simdkalman.primitives.predict",
"numpy.array",
"numpy.eye",
"simdkalman.primitives.update"
] | [((104, 130), 'numpy.array', 'np.array', (['[[1, 1], [0, 1]]'], {}), '([[1, 1], [0, 1]])\n', (112, 130), True, 'import numpy as np\n'), ((179, 197), 'numpy.array', 'np.array', (['[[1, 0]]'], {}), '([[1, 0]])\n', (187, 197), True, 'import numpy as np\n'), ((217, 234), 'numpy.array', 'np.array', (['[[1.0]]'], {}), '([[1.... |
import subprocess
def main():
start_process = subprocess.Popen(['python3', 'interface.py'], cwd="The Assignment/")
sStdout, sStdErr = start_process.communicate()
return
if __name__ == '__main__':
main() | [
"subprocess.Popen"
] | [((51, 119), 'subprocess.Popen', 'subprocess.Popen', (["['python3', 'interface.py']"], {'cwd': '"""The Assignment/"""'}), "(['python3', 'interface.py'], cwd='The Assignment/')\n", (67, 119), False, 'import subprocess\n')] |
import requests
apikey = '"<KEY>"'
url = "https://messagingapis.paylite.net/api/email/send"
payload = '''{ ApiKey:''' + apikey + ''',
FromEmail: {
Email: '<EMAIL>',
Name: 'Stu'
},
ToEmail: [
{
Email: '<EMAIL>',
Name: '<NAME>'
... | [
"requests.request"
] | [((541, 601), 'requests.request', 'requests.request', (['"""POST"""', 'url'], {'data': 'payload', 'headers': 'headers'}), "('POST', url, data=payload, headers=headers)\n", (557, 601), False, 'import requests\n')] |
import math
from pyspark import SparkContext, SparkConf
from sparkquantum import constants, plot, util
from sparkquantum.dtqw.coin.hadamard import Hadamard
from sparkquantum.dtqw.dtqw import DiscreteTimeQuantumWalk
from sparkquantum.dtqw.mesh.grid.onedim.line import Line
from sparkquantum.dtqw.observer.position impor... | [
"sparkquantum.util.create_dir",
"sparkquantum.dtqw.coin.hadamard.Hadamard",
"math.sqrt",
"pyspark.SparkConf",
"sparkquantum.dtqw.particle.Particle",
"sparkquantum.dtqw.dtqw.DiscreteTimeQuantumWalk",
"pyspark.SparkContext",
"sparkquantum.dtqw.mesh.grid.onedim.line.Line",
"sparkquantum.dtqw.observer.p... | [((468, 489), 'sparkquantum.util.create_dir', 'util.create_dir', (['path'], {}), '(path)\n', (483, 489), False, 'from sparkquantum import constants, plot, util\n'), ((667, 690), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (679, 690), False, 'from pyspark import SparkContext, SparkCo... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
version = "0.0.25"
setuptools.setup(
name="commondtools",
version=version,
author="<NAME>",
author_email="<EMAIL>",
description="Common D-tools.",
long_description=long_description,
long_description_cont... | [
"setuptools.find_packages"
] | [((418, 444), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (442, 444), False, 'import setuptools\n')] |
import csv
from datetime import datetime
import json
from operator import itemgetter
from typing import cast, Dict, List, Tuple
from urllib.parse import quote_plus
import requests
class FetchPCGWData:
USER_AGENT = "PCGW-Game-Engines/0.2 (https://github.com/kartones/pcgw-game-engines)"
CSV_SEPARATOR = ","
... | [
"json.loads",
"csv.writer",
"requests.get",
"operator.itemgetter",
"csv.reader",
"urllib.parse.quote_plus"
] | [((965, 1012), 'requests.get', 'requests.get', (['engines_list_url'], {'headers': 'headers'}), '(engines_list_url, headers=headers)\n', (977, 1012), False, 'import requests\n'), ((7752, 7803), 'requests.get', 'requests.get', (['games_per_engine_url'], {'headers': 'headers'}), '(games_per_engine_url, headers=headers)\n'... |
# 需要安装paramiko模块
# 演示使用密钥登录其他机器并上传下载文件
import paramiko
private_key = paramiko.RSAKey.from_private_key_file('id_rsa31.txt') # 获得密钥,需要先在linux机器上生成密钥
ssh = paramiko.SSHClient() # 创建SSH对象
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # 允许连接不在know_hosts文件中的主机
ssh.connect(hostname='10.0.0.41', port=52113... | [
"paramiko.RSAKey.from_private_key_file",
"paramiko.SSHClient",
"paramiko.AutoAddPolicy"
] | [((72, 125), 'paramiko.RSAKey.from_private_key_file', 'paramiko.RSAKey.from_private_key_file', (['"""id_rsa31.txt"""'], {}), "('id_rsa31.txt')\n", (109, 125), False, 'import paramiko\n'), ((158, 178), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (176, 178), False, 'import paramiko\n'), ((223, 247), 'pa... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_resnet.ipynb (unless otherwise specified).
__all__ = ['model_urls', 'conv3x3', 'conv1x1', 'BasicBlock', 'Bottleneck', 'ResNet', 'resnet18', 'resnet34', 'resnet50',
'resnet101', 'resnet152']
# Cell
import os
import shutil
import time
import torch.nn as nn
impo... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"os.path.join",
"torch.utils.model_zoo.load_url",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"shutil.rmtree",
"torch.nn.MaxPool2d",
"os.mkdir",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",... | [((973, 1062), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=False)\n', (982, 1062), True, 'import torch.nn as nn\n'), ((1289, 1363), 'torch.nn.Co... |
# Generated by Django 2.1.7 on 2019-03-18 11:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounting_tech', '0006_auto_20190317_1551'),
]
operations = [
migrations.AlterField(
model_nam... | [
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((385, 433), 'django.db.models.DateField', 'models.DateField', ([], {'verbose_name': '"""Дата постановки"""'}), "(verbose_name='Дата постановки')\n", (401, 433), False, 'from django.db import migrations, models\n'), ((563, 632), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '... |
from matplotlib import animation, pyplot as plt
from django.http import HttpResponse
from app.models import Game
def visualization_view(request, object_id):
game = Game.objects.filter(id=object_id).first()
if not game:
return HttpResponse(f"Can't find game with id {object_id}.")
if (
gam... | [
"django.http.HttpResponse",
"app.models.Game.objects.filter",
"matplotlib.pyplot.subplots"
] | [((574, 647), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(15, 8)', 'gridspec_kw': "{'width_ratios': [3, 1]}"}), "(2, 2, figsize=(15, 8), gridspec_kw={'width_ratios': [3, 1]})\n", (586, 647), True, 'from matplotlib import animation, pyplot as plt\n'), ((245, 298), 'django.http.HttpRespon... |
import chromedriver_autoinstaller
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from time import sleep
import random
import const
# add on your own SSL certificate or using this unsafe certificate
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
def... | [
"selenium.webdriver.chrome.options.Options",
"random.uniform",
"selenium.webdriver.Chrome",
"chromedriver_autoinstaller.install"
] | [((360, 396), 'chromedriver_autoinstaller.install', 'chromedriver_autoinstaller.install', ([], {}), '()\n', (394, 396), False, 'import chromedriver_autoinstaller\n'), ((411, 420), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (418, 420), False, 'from selenium.webdriver.chrome.options import ... |
# # Pandas advanced
import numpy as np
import pandas as pd
# # Code to sample original data
#
# ```
# vdata = pd.read_csv("2021VAERSDATA.csv.gz", encoding="iso-8859-1")
# vdata.sample(frac=0.9).to_csv("vdata_sample.csv.gz", index=False)
# vax = pd.read_csv("2021VAERSVAX.csv.gz", encoding="iso-8859-1")
# vax.sample(fr... | [
"pandas.read_csv"
] | [((384, 418), 'pandas.read_csv', 'pd.read_csv', (['"""vdata_sample.csv.gz"""'], {}), "('vdata_sample.csv.gz')\n", (395, 418), True, 'import pandas as pd\n'), ((439, 471), 'pandas.read_csv', 'pd.read_csv', (['"""vax_sample.csv.gz"""'], {}), "('vax_sample.csv.gz')\n", (450, 471), True, 'import pandas as pd\n')] |
from numba.pycc import CC
from numpy import zeros
cc = CC('UnsatStor_inner_compiled')
@cc.export('UnsatStor_inner', '(int64,int64[:,::1],float64,float64,float64[:,:,::1],float64[:,:,::1])')
def UnsatStor_inner(NYrs, DaysMonth, MaxWaterCap, UnsatStor_0, infiltration, DailyET):
unsatstor = zeros((NYrs, 12, 31))
... | [
"numba.pycc.CC",
"numpy.zeros"
] | [((56, 86), 'numba.pycc.CC', 'CC', (['"""UnsatStor_inner_compiled"""'], {}), "('UnsatStor_inner_compiled')\n", (58, 86), False, 'from numba.pycc import CC\n'), ((296, 317), 'numpy.zeros', 'zeros', (['(NYrs, 12, 31)'], {}), '((NYrs, 12, 31))\n', (301, 317), False, 'from numpy import zeros\n'), ((365, 386), 'numpy.zeros'... |
'''
@ <NAME> (EklipZ) eklipz.io - tdrake0x45 at gmail)
April 2017
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
EklipZ bot - Tries to play generals lol
'''
import logging
import random
from copy import deepcopy
import time
import json
from ArmyAnalyzer import *
from collections ... | [
"time.time"
] | [((1670, 1681), 'time.time', 'time.time', ([], {}), '()\n', (1679, 1681), False, 'import time\n'), ((3120, 3131), 'time.time', 'time.time', ([], {}), '()\n', (3129, 3131), False, 'import time\n'), ((3005, 3016), 'time.time', 'time.time', ([], {}), '()\n', (3014, 3016), False, 'import time\n'), ((5738, 5749), 'time.time... |
import requests
import re
username='username'
password='password'
payload = {'username': username, 'password': password}
url='https://ogero.gov.lb/myogero/login.p.php'
with requests.Session() as sess:
sess.post(url, data=payload)
index=sess.get('https://ogero.gov.lb/myogero/index.php')
txt=index.text
... | [
"re.findall",
"requests.Session"
] | [((177, 195), 'requests.Session', 'requests.Session', ([], {}), '()\n', (193, 195), False, 'import requests\n'), ((326, 367), 're.findall', 're.findall', (['"""[0-9]+\\\\.[0-9]+ GB.*GB"""', 'txt'], {}), "('[0-9]+\\\\.[0-9]+ GB.*GB', txt)\n", (336, 367), False, 'import re\n')] |
#!/usr/bin/env python
from __future__ import absolute_import, print_function
from sqlalchemy import func
from huskar_sdk_v2.consts import OVERALL
from huskar_api import settings
from huskar_api.models import DBSession, cache_manager
from huskar_api.models.auth import ApplicationAuth
from huskar_api.models.catalog im... | [
"sqlalchemy.func.count",
"huskar_api.models.DBSession",
"huskar_api.models.dataware.zookeeper.config_client.get",
"huskar_api.models.catalog.ServiceInfo.check_default_route_args",
"huskar_api.settings.ROUTE_DEFAULT_POLICY.get",
"huskar_api.models.dataware.zookeeper.switch_client.get",
"huskar_api.models... | [((812, 823), 'huskar_api.models.DBSession', 'DBSession', ([], {}), '()\n', (821, 823), False, 'from huskar_api.models import DBSession, cache_manager\n'), ((946, 1014), 'huskar_api.models.dataware.zookeeper.config_client.get', 'config_client.get', (['settings.APP_NAME', 'settings.CLUSTER', '"""SECRET_KEY"""'], {}), "(... |
#coding: utf-8
#Blog: https://zhangnq.com/3125.html
#Windows md5sum下载
#链接: https://pan.baidu.com/s/1gq_d-tI-J3ybN6JZ439anw,提取码: 26rk
import os
import hashlib
import sys
def md5sum(fname):
if not os.path.isfile(fname):
return u"错误:文件路径不存在或不是文件!"
try:
f = file(fname, 'rb')
except:
re... | [
"os.path.isfile",
"hashlib.md5",
"sys.exit"
] | [((347, 360), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (358, 360), False, 'import hashlib\n'), ((201, 222), 'os.path.isfile', 'os.path.isfile', (['fname'], {}), '(fname)\n', (215, 222), False, 'import os\n'), ((615, 626), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (623, 626), False, 'import sys\n')] |
import pandas as pd
import matplotlib.pyplot as plt
import requests
import numpy as np
from math import floor
from termcolor import colored as cl
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (20, 10)
# EXTRACTING STOCK DATA
def get_historical_data(symbol, start_date):
api_key = 'YOUR API K... | [
"pandas.Series",
"matplotlib.pyplot.style.use",
"requests.get",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"pandas.concat",
"matplotlib.pyplot.subplot2grid",
"pandas.to_datetime",
"matplotlib.pyplot.show"
] | [((149, 181), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (162, 181), True, 'import matplotlib.pyplot as plt\n'), ((1461, 1516), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(10, 1)', '(0, 0)'], {'rowspan': '(4)', 'colspan': '(1)'}), '((10, 1), (... |
import copy
import pickle
from pathlib import Path
from typing import Set
from networkx.classes.digraph import DiGraph
from networkx.classes.function import (
set_edge_attributes,
set_node_attributes,
non_edges,
)
from src.data.scripts.utils import apx2nxgraph, nxgraph2apx
from src.data.solvers.Acceptanc... | [
"networkx.classes.function.set_node_attributes",
"src.data.scripts.utils.nxgraph2apx",
"networkx.classes.function.non_edges",
"copy.deepcopy",
"src.data.scripts.utils.apx2nxgraph",
"networkx.classes.function.set_edge_attributes"
] | [((927, 943), 'src.data.scripts.utils.apx2nxgraph', 'apx2nxgraph', (['apx'], {}), '(apx)\n', (938, 943), False, 'from src.data.scripts.utils import apx2nxgraph, nxgraph2apx\n'), ((1230, 1253), 'src.data.scripts.utils.nxgraph2apx', 'nxgraph2apx', (['self.graph'], {}), '(self.graph)\n', (1241, 1253), False, 'from src.dat... |
from page_objects import MultiPageElement, PageElement, PageObject
class RegisterStudentPage(PageObject):
checkboxes = MultiPageElement(xpath="//input[@type='checkbox']")
checked_checkboxes = MultiPageElement(css="input:checked[type='checkbox']")
submit_button = PageElement(css="input[type='submit']")
... | [
"page_objects.PageElement",
"page_objects.MultiPageElement"
] | [((125, 176), 'page_objects.MultiPageElement', 'MultiPageElement', ([], {'xpath': '"""//input[@type=\'checkbox\']"""'}), '(xpath="//input[@type=\'checkbox\']")\n', (141, 176), False, 'from page_objects import MultiPageElement, PageElement, PageObject\n'), ((202, 256), 'page_objects.MultiPageElement', 'MultiPageElement'... |
import requests
import json
from datetime import datetime
from requests.auth import HTTPBasicAuth
review = dict()
review["id"] = int(datetime.now().timestamp())
review["name"] = "<NAME>"
review["dealership"] = 1
review["review"] = "Good deal"
review["purchase"] = True
review["purchase_date"] = "02/16/2020"
review["car... | [
"datetime.datetime.now",
"requests.post"
] | [((544, 581), 'requests.post', 'requests.post', (['url'], {'json': 'json_payload'}), '(url, json=json_payload)\n', (557, 581), False, 'import requests\n'), ((134, 148), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (146, 148), False, 'from datetime import datetime\n')] |
from __future__ import unicode_literals
def execute():
from vmraid.geo.country_info import get_all
import vmraid.utils.install
countries = get_all()
vmraid.utils.install.add_country_and_currency("Ghana", vmraid._dict(countries["Ghana"]))
| [
"vmraid.geo.country_info.get_all"
] | [((144, 153), 'vmraid.geo.country_info.get_all', 'get_all', ([], {}), '()\n', (151, 153), False, 'from vmraid.geo.country_info import get_all\n')] |
"""
Use this as the command you use to launch the qlaunch singleshot in reservation mode (see the crontab_setup.md file).
It confirms that you have not exceeded the number of jobs that you would like to have running in the que, and then creates a file
folder for the documents needed for the run (If you don't use this, ... | [
"subprocess.run",
"os.getcwd",
"os.chdir",
"datetime.datetime.now",
"os.mkdir"
] | [((618, 671), 'os.chdir', 'os.chdir', (['"""/fslhome/calebh27/atomate/reserve_scratch"""'], {}), "('/fslhome/calebh27/atomate/reserve_scratch')\n", (626, 671), False, 'import os\n'), ((725, 739), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (737, 739), False, 'from datetime import datetime\n'), ((844, 863... |
import logging
from datetime import datetime
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidden, JsonResponse
from django.views.generic import View
from google.appengine.api import search
import requests
from dinela_search.models import Restaurant
from dinela_search.parser im... | [
"google.appengine.api.search.Index",
"google.appengine.api.search.TextField",
"django.http.JsonResponse",
"dinela_search.models.Restaurant.query",
"django.http.HttpResponseForbidden",
"logging.exception",
"datetime.datetime.now",
"dinela_search.parser.DineLAParser",
"dinela_search.vision.VisionClien... | [((643, 688), 'dinela_search.parser.DineLAParser', 'DineLAParser', (['settings.DINELA_INDEX_FILE_PATH'], {}), '(settings.DINELA_INDEX_FILE_PATH)\n', (655, 688), False, 'from dinela_search.parser import DineLAParser\n'), ((754, 786), 'django.http.JsonResponse', 'JsonResponse', (["{'result': result}"], {}), "({'result': ... |
# -*- coding: utf-8 -*-
import operator
import sys
import numpy as np
import tensorflow as tf
from jtr.nn.models import get_total_trainable_variables
from jtr.util.tfutil import tfrun
class Vocab(object):
"""
Vocab objects for use in jtr pipelines.
Example:
>>> #Test Vocab without pre-trained ... | [
"tensorflow.contrib.framework.is_tensor",
"tensorflow.nn.embedding_lookup",
"numpy.sqrt",
"tensorflow.contrib.layers.fully_connected",
"tensorflow.contrib.layers.xavier_initializer",
"numpy.square",
"tensorflow.concat",
"doctest.testmod",
"tensorflow.identity",
"operator.itemgetter",
"tensorflow... | [((21423, 21447), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1337)'], {}), '(1337)\n', (21441, 21447), True, 'import tensorflow as tf\n'), ((20108, 20158), 'tensorflow.nn.embedding_lookup', 'tf.nn.embedding_lookup', (['self.embedding_matrix', 'ids'], {}), '(self.embedding_matrix, ids)\n', (20130, 20158), T... |
import typer
app = typer.Typer()
@app.command(help="メッセージの購読を開始します。")
def consume(reload: bool = False):
queueing = get_queuing_instance()
queueing.run()
def get_queuing_instance():
import sys
from importlib import import_module
attr = "magnet.worker:queueing"
module, attr = attr.split(":"... | [
"importlib.import_module",
"sys.modules.pop",
"typer.Typer"
] | [((20, 33), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (31, 33), False, 'import typer\n'), ((425, 446), 'importlib.import_module', 'import_module', (['module'], {}), '(module)\n', (438, 446), False, 'from importlib import import_module\n'), ((378, 401), 'sys.modules.pop', 'sys.modules.pop', (['module'], {}), '(mod... |
"""Test the base widget."""
from dal.widgets import Select
from django import forms
from django import http
from django import test
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from django.utils import six
import mock
urlpatterns = [
... | [
"mock.Mock",
"django.test.utils.override_settings",
"django.http.QueryDict",
"django.core.urlresolvers.reverse"
] | [((410, 462), 'django.test.utils.override_settings', 'override_settings', ([], {'ROOT_URLCONF': '"""tests.test_widgets"""'}), "(ROOT_URLCONF='tests.test_widgets')\n", (427, 462), False, 'from django.test.utils import override_settings\n'), ((361, 372), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (370, 372), False, 'imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2018 <NAME> and <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... | [
"openlego.utils.cmdows_utils.get_element_by_uid",
"os.path.exists",
"os.makedirs",
"openlego.utils.xml_utils.xpath_to_param",
"openlego.utils.cmdows_utils.get_doe_setting_safe",
"lxml.etree.parse",
"openlego.utils.cmdows_utils.get_loop_nesting_obj"
] | [((13602, 13646), 'openlego.utils.cmdows_utils.get_loop_nesting_obj', 'get_loop_nesting_obj', (['self.elem_loop_nesting'], {}), '(self.elem_loop_nesting)\n', (13622, 13646), False, 'from openlego.utils.cmdows_utils import get_loop_nesting_obj, get_element_by_uid, get_doe_setting_safe\n'), ((13158, 13199), 'openlego.uti... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'areaDialog.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon
class Ui_areaDialog(object):
def setupUi(self, areaDialog):
areaDialog.setObjectName("area... | [
"PyQt5.QtGui.QIcon",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QLineEdit"
] | [((449, 482), 'PyQt5.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['areaDialog'], {}), '(areaDialog)\n', (470, 482), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((575, 598), 'PyQt5.QtWidgets.QHBoxLayout', 'QtWidgets.QHBoxLayout', ([], {}), '()\n', (596, 598), False, 'from PyQt5 import QtCore, QtGui, Qt... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# bob: tests_full/test_vm_compiler.py
#
# Run the full tests for the compiler and VM of Bob
#
# <NAME> (<EMAIL>)
# This code is in the public domain
#-------------------------------------------------------------------... | [
"bob.bytecode.Serializer",
"bob.bytecode.Deserializer",
"bob.compiler.compile_code",
"testcases_utils.run_all_tests",
"bob.vm.BobVM"
] | [((839, 879), 'testcases_utils.run_all_tests', 'run_all_tests', ([], {'runner': 'vm_compiler_runner'}), '(runner=vm_compiler_runner)\n', (852, 879), False, 'from testcases_utils import run_all_tests\n'), ((558, 576), 'bob.compiler.compile_code', 'compile_code', (['code'], {}), '(code)\n', (570, 576), False, 'from bob.c... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import Comment
from django.contrib.auth import get_user_model
User = get_user_model()
#create forms
class NewUserForm(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
... | [
"django.forms.Textarea",
"django.contrib.auth.get_user_model",
"django.forms.EmailField"
] | [((164, 180), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (178, 180), False, 'from django.contrib.auth import get_user_model\n'), ((244, 275), 'django.forms.EmailField', 'forms.EmailField', ([], {'required': '(True)'}), '(required=True)\n', (260, 275), False, 'from django import forms\n'),... |
import psutil
import time
import sys
import tensorflow as tf
class CostBenchmarkSpyCallback(tf.keras.callbacks.Callback):
def __init__(self, prefix='[COST BENCHMARK]', suffix=''):
self.log_options = dict(
prefix=prefix,
suffix=suffix,
)
self.time = dict(
... | [
"psutil.boot_time",
"time.time"
] | [((330, 341), 'time.time', 'time.time', ([], {}), '()\n', (339, 341), False, 'import time\n'), ((360, 378), 'psutil.boot_time', 'psutil.boot_time', ([], {}), '()\n', (376, 378), False, 'import psutil\n'), ((789, 800), 'time.time', 'time.time', ([], {}), '()\n', (798, 800), False, 'import time\n'), ((1055, 1066), 'time.... |
# Create class for weather module
# Imports
import requests
import json
import datetime
import time
import os
import sys
from dotenv import load_dotenv
# Class
class WeatherModule:
"""
Weather module class
"""
# Initialize
def __init__(self, city):
"""
Initialize WeatherModule c... | [
"requests.get",
"os.getenv",
"dotenv.load_dotenv"
] | [((520, 533), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (531, 533), False, 'from dotenv import load_dotenv\n'), ((1037, 1050), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1048, 1050), False, 'from dotenv import load_dotenv\n'), ((731, 766), 'os.getenv', 'os.getenv', (['"""OPENWEATHERMAP_API_KEY... |
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-micro',
description='Django as a microframework',
# long_description=read('README.rst'),
keywords='django microframework',
py_modules=['django_micro'],... | [
"os.path.dirname",
"setuptools.setup"
] | [((129, 684), 'setuptools.setup', 'setup', ([], {'name': '"""django-micro"""', 'description': '"""Django as a microframework"""', 'keywords': '"""django microframework"""', 'py_modules': "['django_micro']", 'version': '"""1.7.3"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.co... |
from src.db import db
from src.models.base import BaseModel, BaseSchema
class Node(BaseModel):
dataset_id = db.Column(db.Integer, db.ForeignKey('dataset.id'), nullable=False)
dataset = db.relationship('Dataset', backref=db.backref('nodes', cascade="all, delete-orphan"))
name = db.Column(db.String)
class... | [
"src.db.db.backref",
"src.db.db.Column",
"src.db.db.ForeignKey"
] | [((292, 312), 'src.db.db.Column', 'db.Column', (['db.String'], {}), '(db.String)\n', (301, 312), False, 'from src.db import db\n'), ((136, 163), 'src.db.db.ForeignKey', 'db.ForeignKey', (['"""dataset.id"""'], {}), "('dataset.id')\n", (149, 163), False, 'from src.db import db\n'), ((230, 279), 'src.db.db.backref', 'db.b... |
"""The tests for the Roku remote platform."""
from unittest.mock import MagicMock
from homeassistant.components.remote import (
ATTR_COMMAND,
DOMAIN as REMOTE_DOMAIN,
SERVICE_SEND_COMMAND,
)
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.core import Hom... | [
"homeassistant.helpers.entity_registry.async_get"
] | [((879, 897), 'homeassistant.helpers.entity_registry.async_get', 'er.async_get', (['hass'], {}), '(hass)\n', (891, 897), True, 'from homeassistant.helpers import entity_registry as er\n')] |
from ops.data import OpsClass, OpsField, DszObject, DszCommandObject, cmd_definitions
import dsz
class NetConnectionsCommandData(DszCommandObject, ):
def __init__(self, cmdid=None, cmdname='', debug=False, **kwargs):
DszCommandObject.__init__(self, cmdid, cmdname, debug)
self.update(debug... | [
"ops.data.OpsField",
"ops.data.OpsClass",
"ops.data.DszCommandObject.__init__"
] | [((1754, 1845), 'ops.data.OpsClass', 'OpsClass', (['"""initialconnectionlistitem"""', "{'connectionitem': dszconnectionitem}", 'DszObject'], {}), "('initialconnectionlistitem', {'connectionitem': dszconnectionitem},\n DszObject)\n", (1762, 1845), False, 'from ops.data import OpsClass, OpsField, DszObject, DszCommand... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"pathlib.Path",
"subprocess.Popen",
"os.path.join",
"setuptools.setup",
"os.path.isfile",
"os.path.isdir",
"numpy.get_include"
] | [((1454, 1499), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE'}), '(cmd, stdout=subprocess.PIPE)\n', (1470, 1499), False, 'import subprocess\n'), ((3970, 4071), 'setuptools.setup', 'setuptools.setup', ([], {'name': 'name', 'packages': '[name]', 'install_requires': "['numpy']", 'ext_modul... |
import os
import shutil
from montreal_forced_aligner.g2p.trainer import PyniniTrainer as Trainer
from montreal_forced_aligner.dictionary import Dictionary
from montreal_forced_aligner.exceptions import ArgumentError
from montreal_forced_aligner.config import TEMP_DIR
from montreal_forced_aligner.config.train_g2p_config... | [
"os.path.exists",
"montreal_forced_aligner.config.train_g2p_config.load_basic_train_g2p_config",
"montreal_forced_aligner.dictionary.Dictionary",
"os.path.join",
"montreal_forced_aligner.g2p.trainer.PyniniTrainer",
"os.path.isfile",
"montreal_forced_aligner.command_line.mfa.fix_path",
"montreal_forced... | [((1064, 1100), 'montreal_forced_aligner.dictionary.Dictionary', 'Dictionary', (['args.dictionary_path', '""""""'], {}), "(args.dictionary_path, '')\n", (1074, 1100), False, 'from montreal_forced_aligner.dictionary import Dictionary\n'), ((1109, 1254), 'montreal_forced_aligner.g2p.trainer.PyniniTrainer', 'Trainer', (['... |
from functools import reduce
n = int(input())
a = [int(m) for m in input().split()]
def gcd(a,b):
if b == 0:
return a
return gcd(b, a % b)
def gcd_list(numbers):
return reduce(gcd, numbers)
a.sort()
new = [a[0]]
for i in range(1, n):
new.append(a[i] % a[0])
new.sort()
k = gcd_list(new)
for i i... | [
"functools.reduce"
] | [((189, 209), 'functools.reduce', 'reduce', (['gcd', 'numbers'], {}), '(gcd, numbers)\n', (195, 209), False, 'from functools import reduce\n')] |
# Generated by Django 3.1 on 2020-12-04 01:23
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genes', '0007_activesamplegenelist_samplegenelist'),
('seqauto', '0002_initial_data'),
]
operations = [
... | [
"django.db.models.FloatField",
"django.db.models.ForeignKey"
] | [((435, 465), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(0.0)'}), '(default=0.0)\n', (452, 465), False, 'from django.db import migrations, models\n'), ((596, 626), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(0.0)'}), '(default=0.0)\n', (613, 626), False, 'from djan... |
from datetime import date, datetime
import pytest
from opennem.spiders.bom.utils import get_archive_page_for_station_code
@pytest.mark.parametrize(["web_code", "month", "expected_result"], [
("4019", datetime(2021, 10, 1).date(), "http://www.bom.gov.au/climate/dwo/202110/html/IDCJDW4019.202110.shtml"),
("00... | [
"datetime.datetime",
"opennem.spiders.bom.utils.get_archive_page_for_station_code"
] | [((569, 619), 'opennem.spiders.bom.utils.get_archive_page_for_station_code', 'get_archive_page_for_station_code', (['web_code', 'month'], {}), '(web_code, month)\n', (602, 619), False, 'from opennem.spiders.bom.utils import get_archive_page_for_station_code\n'), ((208, 229), 'datetime.datetime', 'datetime', (['(2021)',... |
import uuid
MSG_FIELDS = {
'uuid_ref': {'key': 'uuid_ref', 'required': True},
'data_location': {'key': 'data_location', 'required': True},
'meta_location': {'key': 'meta_location', 'required': True},
'data_type': {'key': 'data_type', 'required': False},
'metadata': {'key': 'metadata', 'required': F... | [
"uuid.uuid4"
] | [((650, 662), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (660, 662), False, 'import uuid\n')] |
# SPDX-License-Identifier: MIT
from riskmetrics import nvd
from os import path, stat
from datetime import datetime
def test_update():
nvd.update()
par_dir = path.dirname(path.realpath(__file__))
gpa_dir = path.dirname(par_dir)
ggp_dir = path.dirname(gpa_dir)
nvd_dir = str(ggp_dir) + '/nvd/'
filename = 'nvdcve... | [
"os.path.exists",
"os.path.realpath",
"os.path.dirname",
"datetime.datetime.now",
"os.stat",
"riskmetrics.nvd.update",
"riskmetrics.nvd.search"
] | [((138, 150), 'riskmetrics.nvd.update', 'nvd.update', ([], {}), '()\n', (148, 150), False, 'from riskmetrics import nvd\n'), ((212, 233), 'os.path.dirname', 'path.dirname', (['par_dir'], {}), '(par_dir)\n', (224, 233), False, 'from os import path, stat\n'), ((245, 266), 'os.path.dirname', 'path.dirname', (['gpa_dir'], ... |
import tensorflow as tf
IDENTIFIER_OUTPUT_LAYER = "Output"
def get_out(output_layer: str, out_feature_dim, scale_node_size, name: str = 'decoder'):
if output_layer == "gaussian":
output_decoder_layer = GaussianOutput(
original_dim=out_feature_dim,
use_node_scale=scale_node_size,
... | [
"tensorflow.keras.layers.Dense",
"tensorflow.clip_by_value",
"tensorflow.reshape",
"tensorflow.zeros_like",
"tensorflow.exp"
] | [((3129, 3181), 'tensorflow.clip_by_value', 'tf.clip_by_value', (['var', '(-bound)', 'bound', '"""decoder_clip"""'], {}), "(var, -bound, bound, 'decoder_clip')\n", (3145, 3181), True, 'import tensorflow as tf\n'), ((3267, 3283), 'tensorflow.exp', 'tf.exp', (['var_clip'], {}), '(var_clip)\n', (3273, 3283), True, 'import... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
# if gpu is to be used
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
WEIGHTS_FINAL_INIT = 3e-3
BIAS_FINAL_INIT = 3e-4
def fan_in_uniform_init(tensor, fan_in=None):
"""Utility function for initializing ac... | [
"numpy.sqrt",
"torch.nn.LayerNorm",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.nn.functional.relu",
"torch.nn.init.uniform_",
"torch.cat"
] | [((428, 459), 'torch.nn.init.uniform_', 'nn.init.uniform_', (['tensor', '(-w)', 'w'], {}), '(tensor, -w, w)\n', (444, 459), True, 'import torch.nn as nn\n'), ((142, 167), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (165, 167), False, 'import torch\n'), ((408, 423), 'numpy.sqrt', 'np.sqrt', (... |
#!/usr/bin/python
import sys
import markowitz
import back_testing
def main():
time_start = "2011-02-01"
time_end = "2016-02-01"
time_end_test = "2016-07-14"
invest_type = "mid-cap"
tickers, weight = markowitz.mean_variance_portfolio(time_start, time_end, "m", 5, invest_type)
back_testing.invest_simulation(ticker... | [
"markowitz.mean_variance_portfolio",
"back_testing.invest_simulation"
] | [((205, 281), 'markowitz.mean_variance_portfolio', 'markowitz.mean_variance_portfolio', (['time_start', 'time_end', '"""m"""', '(5)', 'invest_type'], {}), "(time_start, time_end, 'm', 5, invest_type)\n", (238, 281), False, 'import markowitz\n'), ((283, 355), 'back_testing.invest_simulation', 'back_testing.invest_simula... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.icecream_list, name='icecream-list'),
path('<int:pk>/', views.icecream_detail, name='detail'),
path('<str:username>/unfollow/', views.profile_unfollow, name='profile_unfollow'),
path('<str:username>/follow/', views.profile_... | [
"django.urls.path"
] | [((70, 121), 'django.urls.path', 'path', (['""""""', 'views.icecream_list'], {'name': '"""icecream-list"""'}), "('', views.icecream_list, name='icecream-list')\n", (74, 121), False, 'from django.urls import path\n'), ((127, 182), 'django.urls.path', 'path', (['"""<int:pk>/"""', 'views.icecream_detail'], {'name': '"""de... |
from datetime import date
m =0
me =0
for c in range(1,8):
i = int(input('que ano a {}ª pessoa nasceu ? >>>'.format(c)))
ano = int(date.today().year)
idade = ano - i
if idade > 18:
m += 1
else:
me += 1
print('{} pessoas são maiores de idade'.format(m))
print('{} pessoas são menores de... | [
"datetime.date.today"
] | [((138, 150), 'datetime.date.today', 'date.today', ([], {}), '()\n', (148, 150), False, 'from datetime import date\n')] |
from Cheater import Cheater_Loaded, Cheater_Swapper
def run_sim():
swapper = Cheater_Swapper('')
loaded = Cheater_Loaded('')
swapper_score = 0
loaded_score = 0
num_games = 100000
curr = 0
while curr < num_games:
swapper.roll()
swapper.cheat()
loaded.roll()
... | [
"Cheater.Cheater_Loaded",
"Cheater.Cheater_Swapper"
] | [((82, 101), 'Cheater.Cheater_Swapper', 'Cheater_Swapper', (['""""""'], {}), "('')\n", (97, 101), False, 'from Cheater import Cheater_Loaded, Cheater_Swapper\n'), ((115, 133), 'Cheater.Cheater_Loaded', 'Cheater_Loaded', (['""""""'], {}), "('')\n", (129, 133), False, 'from Cheater import Cheater_Loaded, Cheater_Swapper\... |
import os
import re
import sys
import romkan
phone_cleanup_pattern = re.compile(r'(UA_|SWA_|M_|\{| WB\}|\})')
def cleanup_transcription(phone_sequence):
phone_sequence = phone_cleanup_pattern.sub('', phone_sequence).strip()
return phone_sequence
def parse_dictionary_file(path):
nonsil = set()
word_c... | [
"romkan.to_roma",
"os.listdir",
"os.path.join",
"re.compile"
] | [((70, 112), 're.compile', 're.compile', (['"""(UA_|SWA_|M_|\\\\{| WB\\\\}|\\\\})"""'], {}), "('(UA_|SWA_|M_|\\\\{| WB\\\\}|\\\\})')\n", (80, 112), False, 'import re\n'), ((337, 361), 're.compile', 're.compile', (['"""\\\\(\\\\d+\\\\)"""'], {}), "('\\\\(\\\\d+\\\\)')\n", (347, 361), False, 'import re\n'), ((385, 406), ... |
from distutils.core import setup, find_packages
from __init__ import VERSION
setup(name='Snowflake',
version=VERSION,
description='Snowflake generator.',
author='JohnyTheCarrot',
author_email='<EMAIL>',
url='https://github.com/JohnyTheCarrot/snowflake',
packages=find_packages()
)
| [
"distutils.core.find_packages"
] | [((300, 315), 'distutils.core.find_packages', 'find_packages', ([], {}), '()\n', (313, 315), False, 'from distutils.core import setup, find_packages\n')] |
import lightgbm as lgb
from tess.utils import Utils
class FeatureSelection:
def __init__(self, data, threshold=1, force_base_entries=True):
self.data = data
self.threshold = threshold
self.force_base_entries = force_base_entries
def select(self):
schema = Utils.get_available... | [
"tess.utils.Utils.get_available_feature_schema",
"tess.utils.Utils.get_element_feature",
"tess.utils.Utils.get_target_function_value",
"lightgbm.LGBMRegressor",
"tess.utils.Utils.get_filtered_schema"
] | [((301, 395), 'tess.utils.Utils.get_available_feature_schema', 'Utils.get_available_feature_schema', (['self.data'], {'force_base_entries': 'self.force_base_entries'}), '(self.data, force_base_entries=self.\n force_base_entries)\n', (335, 395), False, 'from tess.utils import Utils\n'), ((590, 723), 'lightgbm.LGBMReg... |
"""
Created on Tuesday 20 February 2018
Last update: Sunday 11 March 2018
@author: <NAME>
<EMAIL>
Solution for the lecture optimal transport
"""
from itertools import permutations
import numpy as np
from sklearn.metrics.pairwise import pairwise_distances
from random import shuffle
blue = '#264653'
green = '#2a9d8f'... | [
"matplotlib.pyplot.imshow",
"numpy.ones_like",
"numpy.abs",
"matplotlib.pyplot.savefig",
"random.shuffle",
"numpy.log",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.linspace",
"numpy.array",
"numpy.zeros_like",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((528, 544), 'random.shuffle', 'shuffle', (['indices'], {}), '(indices)\n', (535, 544), False, 'from random import shuffle\n'), ((2186, 2202), 'numpy.exp', 'np.exp', (['(-lam * C)'], {}), '(-lam * C)\n', (2192, 2202), True, 'import numpy as np\n'), ((3410, 3426), 'numpy.exp', 'np.exp', (['(-lam * C)'], {}), '(-lam * C... |
#!python3
'''
'''
import logging; log = logging.getLogger(__name__) # noqa E702
from ..errors import RPSLOriginError
attribute = 'origin'
def parse(attr, value, strict=False, messages: list = None):
assert attr == attribute, f'Unexpected {attr!r} in {attribute!r} parser'
ok = value.upper().startswith('AS') ... | [
"logging.getLogger"
] | [((40, 67), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (57, 67), False, 'import logging\n')] |
import pytest
from pyseeyou.locales import get_parts_of_num
from pyseeyou.cldr_rules import CARDINALS
# ========================
# GENERATED AUTOMATICALLY
# DON'T MODIFY MANUALLY
# ========================
def check(assertions, plural_fn):
for assertion in assertions:
match, samples = asser... | [
"pyseeyou.locales.get_parts_of_num"
] | [((388, 412), 'pyseeyou.locales.get_parts_of_num', 'get_parts_of_num', (['sample'], {}), '(sample)\n', (404, 412), False, 'from pyseeyou.locales import get_parts_of_num\n')] |
import MySQLdb
import json
import logging
from base.singleton import singleton
from base.config_utils import ConfigUtils
@singleton
class DbUtils:
def __init__(self):
config_utils = ConfigUtils()
db_config_path = config_utils.get_db_config_path()
self.dbs = {}
self.conns = {}
... | [
"MySQLdb.connect",
"json.loads",
"base.config_utils.ConfigUtils",
"logging.exception"
] | [((197, 210), 'base.config_utils.ConfigUtils', 'ConfigUtils', ([], {}), '()\n', (208, 210), False, 'from base.config_utils import ConfigUtils\n'), ((1168, 1289), 'MySQLdb.connect', 'MySQLdb.connect', ([], {'host': "db['ip']", 'port': "db['port']", 'user': "db['user']", 'passwd': "db['password']", 'db': "db['db']", 'cha... |
from os import path
from urllib import request
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from datasets import AbstractDataset
class CompasDataset(AbstractDataset):
def __init__(self, split, args, normalize=True):
super().__init__('compas', ... | [
"os.path.exists",
"pandas.read_csv",
"urllib.request.urlretrieve",
"sklearn.model_selection.train_test_split",
"os.path.join",
"pandas.Categorical",
"torch.tensor",
"pandas.get_dummies",
"pandas.to_datetime"
] | [((347, 402), 'os.path.join', 'path.join', (['self.data_dir', '"""compas-scores-two-years.csv"""'], {}), "(self.data_dir, 'compas-scores-two-years.csv')\n", (356, 402), False, 'from os import path\n'), ((616, 637), 'pandas.read_csv', 'pd.read_csv', (['datafile'], {}), '(datafile)\n', (627, 637), True, 'import pandas as... |
# Generated by Django 3.1.5 on 2021-03-16 16:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0011_analytic'),
]
operations = [
migrations.DeleteModel(
name='Entry',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((214, 250), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Entry"""'}), "(name='Entry')\n", (236, 250), False, 'from django.db import migrations\n')] |
from flask import Flask, request, jsonify
from flask_restful import Api, Resource, reqparse, abort
import numpy as np
import pickle as p
app = Flask(__name__)
api = Api(app)
@app.route('/forecast', methods=['GET'])
def make_prediction():
data = request.get_json()
prediction = np.array2string(prophet_model.p... | [
"flask.jsonify",
"flask_restful.Api",
"flask.request.get_json",
"flask.Flask"
] | [((145, 160), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (150, 160), False, 'from flask import Flask, request, jsonify\n'), ((167, 175), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (170, 175), False, 'from flask_restful import Api, Resource, reqparse, abort\n'), ((253, 271), 'flask.request.ge... |
from typing import Any, Dict, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Quantity")
@attr.s(auto_attribs=True)
class Quantity:
""" """
amount: str
unit: Union[Unset, str] = UNSET
def to_dict(self) -> Dict[str, Any]:
amount = self.amount
... | [
"attr.s",
"typing.TypeVar"
] | [((103, 133), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""Quantity"""'}), "('T', bound='Quantity')\n", (110, 133), False, 'from typing import Any, Dict, Type, TypeVar, Union\n'), ((137, 162), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (143, 162), False, 'import attr\n')] |
from django.contrib import admin
from .models import user_profile
# Register your models here.
admin.site.register(user_profile)
| [
"django.contrib.admin.site.register"
] | [((96, 129), 'django.contrib.admin.site.register', 'admin.site.register', (['user_profile'], {}), '(user_profile)\n', (115, 129), False, 'from django.contrib import admin\n')] |
import behave
@behave.when(u'I get Task by "{get_method}"')
def step_impl(context, get_method):
if get_method == 'name':
context.task_get = context.project.tasks.get(task_name=context.task.name)
elif get_method == 'id':
context.task_get = context.project.tasks.get(task_id=context.task.id)
@b... | [
"behave.when",
"behave.then"
] | [((17, 61), 'behave.when', 'behave.when', (['u"""I get Task by "{get_method}\\""""'], {}), '(u\'I get Task by "{get_method}"\')\n', (28, 61), False, 'import behave\n'), ((319, 369), 'behave.when', 'behave.when', (['u"""I get Task by wrong "{get_method}\\""""'], {}), '(u\'I get Task by wrong "{get_method}"\')\n', (330, ... |
# Credits (inspired & adapted from) @ https://github.com/lcswillems/torch-rl
import torch
from typing import Tuple
import numpy as np
from utils.dictlist import DictList
from .base import AgentBase
class SimulateDict:
def __init__(self, obj):
self._obj = obj
def __getitem__(self, item):
ret... | [
"torch.ones",
"torch.tensor",
"torch.save",
"utils.dictlist.DictList",
"torch.no_grad",
"torch.zeros",
"numpy.arange",
"numpy.random.permutation"
] | [((1657, 1693), 'torch.zeros', 'torch.zeros', (['shape[1]'], {'device': 'device'}), '(shape[1], device=device)\n', (1668, 1693), False, 'import torch\n'), ((1715, 1749), 'torch.zeros', 'torch.zeros', (['*shape'], {'device': 'device'}), '(*shape, device=device)\n', (1726, 1749), False, 'import torch\n'), ((1773, 1824), ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-23 07:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icds_reports', '0163_update_agg_awc_monthly_view'),
]
operations = [
migra... | [
"django.db.models.NullBooleanField",
"django.db.models.DateField"
] | [((433, 458), 'django.db.models.NullBooleanField', 'models.NullBooleanField', ([], {}), '()\n', (456, 458), False, 'from django.db import migrations, models\n'), ((603, 628), 'django.db.models.NullBooleanField', 'models.NullBooleanField', ([], {}), '()\n', (626, 628), False, 'from django.db import migrations, models\n'... |
from __future__ import annotations
import numpy as np
import pytest
from .helpers import ( # noqa: F401
assert_eq,
line_delim_records_file,
load_records_eager,
load_records_lazy,
)
def test_ufunc_add(line_delim_records_file) -> None: # noqa: F811
daa = load_records_lazy(line_delim_records_file... | [
"numpy.sin",
"pytest.mark.parametrize",
"pytest.raises"
] | [((723, 787), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""f"""', '[np.add.accumulate, np.add.reduce]'], {}), "('f', [np.add.accumulate, np.add.reduce])\n", (746, 787), False, 'import pytest\n'), ((665, 676), 'numpy.sin', 'np.sin', (['daa'], {}), '(daa)\n', (671, 676), True, 'import numpy as np\n'), ((68... |
#!/usr/bin/env python3
import argparse
import os
import re
import difflib
class DiffGroup:
def __init__(self, group_type, diff, test_names=None):
self.group_type = group_type
self.diff = diff
if test_names:
self.test_names = set(test_names)
else:
self.test_... | [
"os.path.exists",
"argparse.ArgumentParser",
"re.compile",
"os.path.join",
"os.getcwd",
"difflib.Differ",
"sys.exit",
"re.findall",
"os.walk"
] | [((1619, 1655), 're.compile', 're.compile', (['"""(.*)\\\\.received(\\\\..*)"""'], {}), "('(.*)\\\\.received(\\\\..*)')\n", (1629, 1655), False, 'import re\n'), ((1702, 1717), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (1709, 1717), False, 'import os\n'), ((4716, 4732), 'difflib.Differ', 'difflib.Differ', ([... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from main.text import page_slugs_list, pages
from jsonfield import JSONField
class PagesProgress(dict):
"""Supplies the first step name as the default for missing pages"""
def __missing__(self, key):
result = {"step_name... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"jsonfield.JSONField",
"django.db.models.CharField"
] | [((442, 502), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'page_slugs_list[0]', 'max_length': '(128)'}), '(default=page_slugs_list[0], max_length=128)\n', (458, 502), False, 'from django.db import models\n'), ((514, 555), 'jsonfield.JSONField', 'JSONField', ([], {'default': "{'pages_progress': {}... |
from Config import Config
from Classes import UploadEvent, PurchaseSessionEvent, Artwork
def get_upload_events(df):
events = [
UploadEvent(upload_date, artwork_id) for artwork_id, upload_date\
in zip(df.artwork_id_hash, df.upload_timestamp)
]
events.sort(key=lambda e: e.timestamp)
retur... | [
"Classes.UploadEvent",
"Classes.Artwork",
"pandas.read_csv"
] | [((140, 176), 'Classes.UploadEvent', 'UploadEvent', (['upload_date', 'artwork_id'], {}), '(upload_date, artwork_id)\n', (151, 176), False, 'from Classes import UploadEvent, PurchaseSessionEvent, Artwork\n'), ((1145, 1180), 'Classes.Artwork', 'Artwork', (['aid', 'upload_date'], {}), '(aid, upload_date, **kwargs)\n', (11... |
#`!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This file contains a class for a house listing
The listing class contains functionality to get all info for a listing"""
import re
from enum import Enum
from .google_maps import GMaps
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__Lisence__ = "MIT"
__maintainer__... | [
"re.findall"
] | [((3351, 3380), 're.findall', 're.findall', (['"""\\\\d+"""', 'price_str'], {}), "('\\\\d+', price_str)\n", (3361, 3380), False, 'import re\n')] |
from os import path
from pyppl import Box
from gff import Gff
from bioprocs.utils.tsvio2 import TsvWriter, TsvReader, TsvRecord
from bioprocs.utils import logger
infile = {{ i.infile | quote}}
outfile = {{ o.outfile | quote}}
notfound = {{ args.notfound | quote}}
genecol = {{ args.genecol or 0 | repr}}
inopts = ... | [
"gff.Gff",
"os.path.isfile",
"bioprocs.utils.tsvio2.TsvReader",
"bioprocs.utils.tsvio2.TsvWriter",
"bioprocs.utils.tsvio2.TsvRecord"
] | [((599, 617), 'bioprocs.utils.tsvio2.TsvWriter', 'TsvWriter', (['outfile'], {}), '(outfile)\n', (608, 617), False, 'from bioprocs.utils.tsvio2 import TsvWriter, TsvReader, TsvRecord\n'), ((695, 707), 'gff.Gff', 'Gff', (['refgene'], {}), '(refgene)\n', (698, 707), False, 'from gff import Gff\n'), ((389, 409), 'os.path.i... |
from urllib.parse import urlparse
from django.conf import settings
from django.shortcuts import render
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
def get_headers(request, keys=[]):
return dict((key, value)... | [
"urllib.parse.urlparse",
"django.utils.translation.gettext"
] | [((442, 461), 'urllib.parse.urlparse', 'urlparse', (['urlstring'], {}), '(urlstring)\n', (450, 461), False, 'from urllib.parse import urlparse\n'), ((1123, 1136), 'django.utils.translation.gettext', 'gettext', (['item'], {}), '(item)\n', (1130, 1136), False, 'from django.utils.translation import gettext\n')] |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import sys
import time
import re
import os
import io
import platform
from datetime import timedelta
from svtplay_dl.utils import is_py2, filenamify, decode_html_entities, ensure_unicode
from ... | [
"svtplay_dl.utils.filenamify",
"svtplay_dl.log.log.info",
"os.listdir",
"svtplay_dl.log.log.error",
"os.path.join",
"os.path.isfile",
"os.path.realpath",
"platform.system",
"os.path.isdir",
"os.path.basename",
"time.time",
"svtplay_dl.utils.terminal.get_terminal_size",
"re.search"
] | [((6044, 6087), 're.search', 're.search', (['"""-(\\\\w+)-\\\\w+.(\\\\w{2,3})$"""', 'name'], {}), "('-(\\\\w+)-\\\\w+.(\\\\w{2,3})$', name)\n", (6053, 6087), False, 'import re\n'), ((1018, 1029), 'time.time', 'time.time', ([], {}), '()\n', (1027, 1029), False, 'import time\n'), ((1259, 1270), 'time.time', 'time.time', ... |
import random
inpt_path = './resources/wwf11/old_dictionary.txt'
output_path = './resources/wwf4/dictionary.txt'
inpt = open(inpt_path, 'r')
output = open(output_path, 'w')
words = set()
for line in inpt:
if len(line[:-1]) <= 4:
words.add(line[:-1])
random_words = random.sample(words, 20)
for word in r... | [
"random.sample"
] | [((281, 305), 'random.sample', 'random.sample', (['words', '(20)'], {}), '(words, 20)\n', (294, 305), False, 'import random\n')] |
# Generated by Django 2.1.7 on 2020-02-19 10:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='DIY',
fields=[
('id', model... | [
"django.db.models.IntegerField",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((1576, 1619), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(50)'}), "(default='', max_length=50)\n", (1592, 1619), False, 'from django.db import migrations, models\n'), ((1736, 1769), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1000)'}), '(max... |
#!/usr/bin/env python3
import sys
import argparse
import xml.etree.ElementTree
MAVEN_NS = { 'maven': 'http://maven.apache.org/POM/4.0.0' }
def parse(pom_file, format):
root = xml.etree.ElementTree.parse(pom_file).getroot()
def text(name, search_parent=True, default=None):
elements = root.findall('mav... | [
"argparse.ArgumentParser",
"sys.exit"
] | [((1698, 1743), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""mvn-parse-pom"""'}), "(prog='mvn-parse-pom')\n", (1721, 1743), False, 'import argparse\n'), ((2223, 2242), 'sys.exit', 'sys.exit', (['exit_code'], {}), '(exit_code)\n', (2231, 2242), False, 'import sys\n')] |
import pip
import sys
import os
import subprocess
from yaml import safe_load, safe_dump
from shutil import copyfile
def main(args):
print(args)
arg_dict = {args[x]: args[x + 1] for x in range(0, len(args) - 1) if x % 2 == 0}
branch_list=arg_dict.get("--branches")
exp_name=arg_dict.get("--name")
hom... | [
"shutil.copyfile",
"subprocess.run",
"yaml.safe_dump",
"sys.exit"
] | [((399, 485), 'subprocess.run', 'subprocess.run', (["['mkdir', home + '/experiments/' + exp_name]"], {'capture_output': '(True)'}), "(['mkdir', home + '/experiments/' + exp_name], capture_output\n =True)\n", (413, 485), False, 'import subprocess\n'), ((1726, 1736), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1734, 17... |
# https://stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/./deck/')
sys.path.insert(1, myPath + '/./player/')
import re
from deck import Deck
from player import User, De... | [
"sys.path.insert",
"player.User",
"re.match",
"deck.Deck",
"player.Dealer",
"sys.exit",
"os.path.abspath"
] | [((178, 217), 'sys.path.insert', 'sys.path.insert', (['(0)', "(myPath + '/./deck/')"], {}), "(0, myPath + '/./deck/')\n", (193, 217), False, 'import sys, os\n'), ((218, 259), 'sys.path.insert', 'sys.path.insert', (['(1)', "(myPath + '/./player/')"], {}), "(1, myPath + '/./player/')\n", (233, 259), False, 'import sys, o... |
#<NAME>
from estrategias.jogadores import Jogador
import numpy
import numpy as np
import os.path
from numpy import round
import pickle
import random
listaRep5=[]
def n_melhores(a1,n):
'a=lista n=posições'
a=list(a1)
a.sort()
return a[-n:]
class MeuJogador(Jogador):
def __init__(self):
... | [
"numpy.round",
"pickle.load",
"pickle.dump",
"estrategias.jogadores.Jogador.__init__"
] | [((325, 347), 'estrategias.jogadores.Jogador.__init__', 'Jogador.__init__', (['self'], {}), '(self)\n', (341, 347), False, 'from estrategias.jogadores import Jogador\n'), ((675, 707), 'pickle.dump', 'pickle.dump', (['listaRep5', 'arquivo5'], {}), '(listaRep5, arquivo5)\n', (686, 707), False, 'import pickle\n'), ((640, ... |
import pathlib
import os
import csv
"""
This script uses a csv of card recipients and their data as well as custom map files for each person to produce
two files per person: one file contains the map file and the other contains the card text and the arc connecting
the source location to the card destination. The custo... | [
"os.path.exists",
"pathlib.Path",
"pathlib.Path.cwd",
"os.system",
"csv.reader"
] | [((5004, 5039), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (5014, 5039), False, 'import csv\n'), ((4807, 4825), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (4823, 4825), False, 'import pathlib\n'), ((4872, 4890), 'pathlib.Path.cwd', 'pathlib.Path.c... |
import django
from widget_tweaks.templatetags.widget_tweaks import add_class
register = django.template.Library()
@register.filter(name='multiply')
def multiply(value: int, args: int):
return value * args
@register.filter(name='divide')
def divide(value: int, args: int):
return value / args
@register.fi... | [
"widget_tweaks.templatetags.widget_tweaks.add_class",
"django.template.Library"
] | [((90, 115), 'django.template.Library', 'django.template.Library', ([], {}), '()\n', (113, 115), False, 'import django\n'), ((648, 678), 'widget_tweaks.templatetags.widget_tweaks.add_class', 'add_class', (['field', 'adding_class'], {}), '(field, adding_class)\n', (657, 678), False, 'from widget_tweaks.templatetags.widg... |
from gui.window import Form
from gui.draw import *
from PIL import Image, ImageQt
import random, io, os
import numpy as np
import torch
import cv2
import torchvision.transforms as transforms
from util import util
import os
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as TF
from... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"torchvision.transforms.ToTensor",
"cv2.threshold",
"torchvision.transforms.functional.to_pil_image",
"util.util.tensor2im",
"torch.load",
"os.path.join",
"pconv.model.PConvUNet",
"numpy.array",
"util.util.mkdir",
"torch.no_grad",
"util.util.save_imag... | [((811, 830), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (823, 830), False, 'import torch\n'), ((918, 957), 'pconv.model.PConvUNet', 'PConvUNet', ([], {'finetune': '(False)', 'layer_size': '(7)'}), '(finetune=False, layer_size=7)\n', (927, 957), False, 'from pconv.model import PConvUNet\n'), ((23... |
import SkinLoader
def test_get_skins():
print(SkinLoader.get_skins())
def test_get_skin_path():
print(SkinLoader.get_skins_dir_path())
| [
"SkinLoader.get_skins",
"SkinLoader.get_skins_dir_path"
] | [((52, 74), 'SkinLoader.get_skins', 'SkinLoader.get_skins', ([], {}), '()\n', (72, 74), False, 'import SkinLoader\n'), ((114, 145), 'SkinLoader.get_skins_dir_path', 'SkinLoader.get_skins_dir_path', ([], {}), '()\n', (143, 145), False, 'import SkinLoader\n')] |
# -*- coding:utf-8 -*-
__author__ = 'eric'
from . import api
from ..models import *
from flask import jsonify, g, abort
from .decorators import permission_required
from .authentication import auth
from .errors import ValidationError
@api.route('/assets/')
@auth.login_required
@permission_requi... | [
"flask.abort"
] | [((2368, 2378), 'flask.abort', 'abort', (['(404)'], {}), '(404)\n', (2373, 2378), False, 'from flask import jsonify, g, abort\n')] |
# Write exponential sweep to csv for testing.
# The sweep was manually inspected.
# The time signal was inspected for smootheness and maximum amplitudes of +/-1.
# The spectrum was inspected for the ripple at the edges of the frequency range
# (typical for time domain sweep generation) and the 1/f slope.
import numpy a... | [
"pyfar.signals.exponential_sweep_time",
"numpy.savetxt"
] | [((431, 486), 'numpy.savetxt', 'np.savetxt', (['"""signals.exponential_sweep_time.csv"""', 'sweep'], {}), "('signals.exponential_sweep_time.csv', sweep)\n", (441, 486), True, 'import numpy as np\n'), ((383, 433), 'pyfar.signals.exponential_sweep_time', 'exponential_sweep_time', (['(2 ** 10)', '[1000.0, 20000.0]'], {}),... |
from logging import Logger
from time import time
from typing import Callable, Optional
import pytorch_lightning as pl
class ProgressBar(pl.callbacks.ProgressBarBase):
"""A custom ProgressBar to log the training progress."""
def __init__(self, logger: Logger, refresh_rate: int = 50) -> None:
"""Create... | [
"time.time"
] | [((3640, 3646), 'time.time', 'time', ([], {}), '()\n', (3644, 3646), False, 'from time import time\n'), ((4928, 4934), 'time.time', 'time', ([], {}), '()\n', (4932, 4934), False, 'from time import time\n'), ((6385, 6391), 'time.time', 'time', ([], {}), '()\n', (6389, 6391), False, 'from time import time\n'), ((3947, 39... |
import requests
URL_AUTH = 'https://developers.lingvolive.com/api/v1.1/authenticate'
URL_TRANSLATE = 'https://developers.lingvolive.com/api/v1/Minicard'
KEY = "<KEY>"
headers_auth = {'Authorization': "Basic" + " " + KEY}
auth = requests.post(URL_AUTH, headers=headers_auth)
print(auth.status_code)
print(auth.text)
if a... | [
"requests.post",
"requests.get"
] | [((229, 274), 'requests.post', 'requests.post', (['URL_AUTH'], {'headers': 'headers_auth'}), '(URL_AUTH, headers=headers_auth)\n', (242, 274), False, 'import requests\n'), ((703, 772), 'requests.get', 'requests.get', (['URL_TRANSLATE'], {'headers': 'headers_translate', 'params': 'params'}), '(URL_TRANSLATE, headers=hea... |
import numpy as np
import skimage.color
import skimage.filters
import skimage.io
import skimage.viewer
# read and display the original image
image = skimage.io.imread('images/coins.png')
viewer = skimage.viewer.ImageViewer(image)
viewer.show()
# blur and grayscale before thresholding
blur = skimage.color.rgb2gray(im... | [
"numpy.zeros_like"
] | [((592, 612), 'numpy.zeros_like', 'np.zeros_like', (['image'], {}), '(image)\n', (605, 612), True, 'import numpy as np\n')] |
from smeagol.io import *
import os
script_dir = os.path.dirname(__file__)
rel_path = "data"
data_path = os.path.join(script_dir, rel_path)
def test_read_fasta():
input_file = os.path.join(data_path, 'test.fa.gz')
records = read_fasta(input_file)
expected = [SeqRecord(seq=Seq('ATTAAATA'), id='Seg1', name=... | [
"os.path.dirname",
"os.path.join",
"os.remove"
] | [((49, 74), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (64, 74), False, 'import os\n'), ((105, 139), 'os.path.join', 'os.path.join', (['script_dir', 'rel_path'], {}), '(script_dir, rel_path)\n', (117, 139), False, 'import os\n'), ((182, 219), 'os.path.join', 'os.path.join', (['data_path',... |
import discord,os
from discord.ext import commands
from discord import Embed
class Info(commands.Cog):
def __init__(self,bot):
bot.remove_command('help')
self.bot = bot
self._last_member = None
@commands.command(brief='Displays the permissions of a member in that guild.')
async... | [
"os.listdir",
"discord.Embed",
"discord.ext.commands.command"
] | [((233, 310), 'discord.ext.commands.command', 'commands.command', ([], {'brief': '"""Displays the permissions of a member in that guild."""'}), "(brief='Displays the permissions of a member in that guild.')\n", (249, 310), False, 'from discord.ext import commands\n'), ((708, 764), 'discord.ext.commands.command', 'comma... |
# Import libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Import dataset
dataset = pd.read_csv('Social_Network_Ads.csv')
X = dataset.iloc[:, :-1].values
Y = dataset.iloc[:, -1].values
print(f"X = {X}")
print(f"Y = {Y}")
print()
# Split Dataset: Training Set and Test Set
from sklearn... | [
"matplotlib.pyplot.savefig",
"numpy.unique",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"sklearn.neighbors.KNeighborsClassifier",
"matplotlib.colors.ListedColormap",
"sklearn.preprocessing.Standard... | [((118, 155), 'pandas.read_csv', 'pd.read_csv', (['"""Social_Network_Ads.csv"""'], {}), "('Social_Network_Ads.csv')\n", (129, 155), True, 'import pandas as pd\n'), ((396, 450), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': '(0.25)', 'random_state': '(0)'}), '(X, Y, test_size... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `wanikani_api` package."""
from wanikani_api.client import Client
from wanikani_api.models import Subject, UserInformation
from tests.utils.utils import (
mock_user_info,
mock_subjects,
mock_assignments,
mock_review_statistics,
mock_study_... | [
"tests.utils.utils.mock_user_info",
"tests.utils.utils.mock_assignments",
"tests.utils.utils.mock_study_materials",
"wanikani_api.client.Client",
"tests.utils.utils.mock_level_progressions",
"tests.utils.utils.mock_reviews",
"tests.utils.utils.mock_summary",
"tests.utils.utils.mock_single_subject",
... | [((533, 562), 'tests.utils.utils.mock_user_info', 'mock_user_info', (['requests_mock'], {}), '(requests_mock)\n', (547, 562), False, 'from tests.utils.utils import mock_user_info, mock_subjects, mock_assignments, mock_review_statistics, mock_study_materials, mock_summary, mock_reviews, mock_level_progressions, mock_res... |
from typing import List
from sqlalchemy import and_
from lws_backend.database import Session
from lws_backend.database_models.categories import Category
from lws_backend.pydantic_models.category import Category as CategoryENUM
from lws_backend.database_models.guides import Guide, GuidePreview, GuideLocationInfo
from l... | [
"lws_backend.database_models.categories.Category",
"lws_backend.database_models.icons.Icon",
"lws_backend.database_models.guides.GuideLocationInfo",
"lws_backend.database_models.guides.GuidePreview.hidden.isnot",
"lws_backend.database_models.guides.Guide",
"sqlalchemy.and_"
] | [((2171, 2206), 'lws_backend.database_models.categories.Category', 'Category', ([], {'enum_value': 'category.value'}), '(enum_value=category.value)\n', (2179, 2206), False, 'from lws_backend.database_models.categories import Category\n'), ((2977, 2984), 'lws_backend.database_models.guides.Guide', 'Guide', ([], {}), '()... |