code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import print_function
import os
import logging
import numpy as np
import random
import math
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
impor... | [
"torch.optim.lr_scheduler.StepLR",
"argparse.ArgumentParser",
"torch.cat",
"advertorch.context.ctx_noparamgrad_and_eval",
"torchvision.datasets.CIFAR10",
"torch.device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"cnnf.model_mnist.CNNF",
"torch.utils.data.DataLoader",
... | [((9922, 9974), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""CNNF training"""'}), "(description='CNNF training')\n", (9945, 9974), False, 'import argparse\n'), ((13812, 13855), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n... |
import torch
import random
import socket
import os
import numpy as np
def get_device(device):
assert device in (
'cpu', 'cuda'), 'device {} should be in (cpu, cuda)'.format(device)
if socket.gethostname() == 'gemini' or not torch.cuda.is_available():
device = 'cpu'
else:
device = '... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed",
"socket.gethostname",
"torch.set_num_threads",
"random.seed",
"torch.cuda.is_available",
"os.path.join"
] | [((416, 433), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (427, 433), False, 'import random\n'), ((438, 458), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (452, 458), True, 'import numpy as np\n'), ((463, 486), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (48... |
import os
import tempfile
import pathlib
import pytest
from wallabag.config import Configs, Options, Sections
from xdg.BaseDirectory import xdg_config_home as XDG_CONFIG_HOME
class TestConfigs():
configs = None
def teardown_method(self, method):
os.close(self.fd)
os.remove(self.path)
... | [
"os.remove",
"tempfile.mkstemp",
"pytest.raises",
"os.close",
"pathlib.PurePath",
"wallabag.config.Configs",
"pytest.mark.parametrize",
"os.path.expanduser"
] | [((1700, 2118), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""condition"""', "[(Sections.TOKEN, Options.EXPIRES, '1000', 'get'), (Sections.TOKEN, Options\n .ACCESS_TOKEN, None, 'get'), (Sections.API, Options.SERVERURL,\n 'https://server', 'get'), (Sections.API, '', 0, 'getint'), (Sections.\n API,... |
import torch
import pandas as pd
import numpy as np
from os import path
from torch.utils.data import Dataset, sampler
from scipy.ndimage.filters import gaussian_filter
class MRIDataset(Dataset):
"""Dataset of MRI organized in a CAPS folder."""
def __init__(self, img_dir, data_file, preprocessing='linear', tr... | [
"pandas.DataFrame",
"scipy.ndimage.filters.gaussian_filter",
"numpy.nan_to_num",
"pandas.read_csv",
"torch.load",
"copy.copy",
"os.path.join",
"pandas.concat",
"torch.from_numpy"
] | [((4592, 4606), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4604, 4606), True, 'import pandas as pd\n'), ((4622, 4636), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4634, 4636), True, 'import pandas as pd\n'), ((5913, 5927), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (5925, 5927), True, ... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.conj",
"numpy.outer",
"numpy.abs",
"cirq.inverse",
"cirq.unitary",
"cirq.to_valid_state_vector",
"numpy.identity",
"cirq.num_qubits",
"qsp.to_r_z_from_wx",
"cirq.Circuit",
"numpy.linspace",
"numpy.real",
"cirq.LineQubit.range"
] | [((2056, 2076), 'cirq.inverse', 'cirq.inverse', (['self.u'], {}), '(self.u)\n', (2068, 2076), False, 'import cirq\n'), ((2209, 2232), 'cirq.num_qubits', 'cirq.num_qubits', (['self.u'], {}), '(self.u)\n', (2224, 2232), False, 'import cirq\n'), ((2865, 2902), 'cirq.LineQubit.range', 'cirq.LineQubit.range', (['self.num_qu... |
import aiohttp
from plugin_system import Plugin
plugin = Plugin("Скриншот любого сайта",
usage=["скрин [адрес сайта] - сделать скриншот сайта [адрес сайта]"])
# Желательно первой командой указывать основную (она будет в списке команд)
@plugin.on_command('скрин')
async def screen(msg, args):
if n... | [
"aiohttp.ClientSession",
"plugin_system.Plugin"
] | [((59, 165), 'plugin_system.Plugin', 'Plugin', (['"""Скриншот любого сайта"""'], {'usage': "['скрин [адрес сайта] - сделать скриншот сайта [адрес сайта]']"}), "('Скриншот любого сайта', usage=[\n 'скрин [адрес сайта] - сделать скриншот сайта [адрес сайта]'])\n", (65, 165), False, 'from plugin_system import Plugin\n'... |
import pytest
from hypothesis import given
from lz import right
from lz.functional import curry
from tests import strategies
from tests.hints import (FunctionCall,
PartitionedFunctionCall)
@given(strategies.partitioned_transparent_functions_calls)
def test_basic(partitioned_function_call: Pa... | [
"lz.functional.curry",
"pytest.raises",
"hypothesis.given",
"lz.right.applier"
] | [((218, 275), 'hypothesis.given', 'given', (['strategies.partitioned_transparent_functions_calls'], {}), '(strategies.partitioned_transparent_functions_calls)\n', (223, 275), False, 'from hypothesis import given\n'), ((838, 914), 'hypothesis.given', 'given', (['strategies.non_variadic_transparent_functions_calls_with_i... |
from django.test import TestCase
from app.calc import add, subtract
class CalcTest(TestCase):
def test_and_numbers(self):
"""Test that numbers are added together"""
self.assertEqual(add(3,8), 11)
def test_subtract_numbers(self):
"""Test That numbers are subtracted"""
self.ass... | [
"app.calc.add",
"app.calc.subtract"
] | [((204, 213), 'app.calc.add', 'add', (['(3)', '(8)'], {}), '(3, 8)\n', (207, 213), False, 'from app.calc import add, subtract\n'), ((329, 344), 'app.calc.subtract', 'subtract', (['(5)', '(11)'], {}), '(5, 11)\n', (337, 344), False, 'from app.calc import add, subtract\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# xdp_ip_whitelist.py Drop packet coming from ips not in a whitelist
#
# Based on https://github.com/iovisor/bcc/blob/master/examples/networking/xdp/xdp_drop_count.py,
# Copyright (c) 2016 PLUMgrid
# Copyright (c) 2016 <NAME>
# Licensed under the Apache License, Version 2.0 (... | [
"bcc.BPF",
"pyroute2.IPDB",
"time.sleep",
"socket.inet_aton",
"pyroute2.IPRoute"
] | [((1816, 1903), 'bcc.BPF', 'BPF', ([], {'text': 'bpf_src', 'cflags': "['-w', '-DRETURNCODE=%s' % ret, '-DCTXTYPE=%s' % ctxtype]"}), "(text=bpf_src, cflags=['-w', '-DRETURNCODE=%s' % ret, '-DCTXTYPE=%s' %\n ctxtype])\n", (1819, 1903), False, 'from bcc import BPF\n'), ((2066, 2084), 'pyroute2.IPRoute', 'pyroute2.IPRou... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TCP
import socket
# Client
# # create
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#
# # connect
# s.connect(('www.sina.com.cn', 80))
#
# # AF_INET IPV4
# # AF_INET6 IPV6
# # SOCK_STREAM 使用面向流的TCP协议
# # connect 参数是tuple 包含ip和port
#
# # send
# s.send(b'GET / ... | [
"threading.Thread",
"socket.socket",
"time.sleep"
] | [((769, 818), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (782, 818), False, 'import socket\n'), ((1420, 1471), 'threading.Thread', 'threading.Thread', ([], {'target': 'tcplink', 'args': '(sock, addr)'}), '(target=tcplink, args=(sock, addr)... |
# Generated by Django 3.0.6 on 2020-05-25 00:02
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.TimeField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((263, 320), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (294, 320), False, 'from django.db import migrations, models\n'), ((449, 542), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import json
import subprocess
import sys
from argparse import ArgumentParser
from os import environ
from pathlib import Path
from typing import Any, List
# Bazel sets this environment for 'bazel run' to document the workspace root
WORKSPACE_ENV_VAR = "BUILD_WORKSPACE_DIRECTORY"
def cli():
parser = ArgumentParser... | [
"subprocess.run",
"json.load",
"argparse.ArgumentParser",
"os.environ.get",
"pathlib.Path",
"sys.exit"
] | [((306, 322), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (320, 322), False, 'from argparse import ArgumentParser\n'), ((2622, 2652), 'os.environ.get', 'environ.get', (['WORKSPACE_ENV_VAR'], {}), '(WORKSPACE_ENV_VAR)\n', (2633, 2652), False, 'from os import environ\n'), ((2855, 2875), 'pathlib.Path',... |
import math
def process_input(file_contents):
lines_stripped = [line.strip() for line in file_contents]
lines_stripped = [line.replace(" ","") for line in lines_stripped]
return lines_stripped
def find_opening_par(input_string):
position = input_string.rfind(")")
counter = 1
while counter > ... | [
"math.prod"
] | [((1810, 1828), 'math.prod', 'math.prod', (['results'], {}), '(results)\n', (1819, 1828), False, 'import math\n')] |
import collections
from typing import TYPE_CHECKING, List, NoReturn, Optional, Tuple, Union
from pyknp import Morpheme, Tag
from pyknp_eventgraph.builder import Builder
from pyknp_eventgraph.component import Component
from pyknp_eventgraph.helper import PAS_ORDER, convert_katakana_to_hiragana, get_parallel_tags
from ... | [
"pyknp_eventgraph.builder.Builder.stid_tag_map.get",
"pyknp_eventgraph.relation.filter_relations",
"pyknp_eventgraph.helper.convert_katakana_to_hiragana",
"pyknp_eventgraph.builder.Builder.stid_bid_map.get",
"pyknp_eventgraph.helper.get_parallel_tags",
"pyknp_eventgraph.helper.PAS_ORDER.get"
] | [((7483, 7524), 'pyknp_eventgraph.builder.Builder.stid_bid_map.get', 'Builder.stid_bid_map.get', (['(ssid, tid)', '(-1)'], {}), '((ssid, tid), -1)\n', (7507, 7524), False, 'from pyknp_eventgraph.builder import Builder\n'), ((7539, 7582), 'pyknp_eventgraph.builder.Builder.stid_tag_map.get', 'Builder.stid_tag_map.get', (... |
from ape.api.config import PluginConfig
from ape.api.networks import LOCAL_NETWORK_NAME
from ape_ethereum.ecosystem import Ethereum, NetworkConfig
NETWORKS = {
# chain_id, network_id
"opera": (250, 250),
"testnet": (4002, 4002),
}
class FantomConfig(PluginConfig):
opera: NetworkConfig = NetworkConfig... | [
"ape_ethereum.ecosystem.NetworkConfig"
] | [((307, 360), 'ape_ethereum.ecosystem.NetworkConfig', 'NetworkConfig', ([], {'required_confirmations': '(1)', 'block_time': '(1)'}), '(required_confirmations=1, block_time=1)\n', (320, 360), False, 'from ape_ethereum.ecosystem import Ethereum, NetworkConfig\n'), ((406, 459), 'ape_ethereum.ecosystem.NetworkConfig', 'Net... |
from setuptools import setup
from os import path
base_dir = path.abspath(path.dirname(__file__))
with open(path.join(base_dir, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='sigils',
version='0.0.5',
description='Extract, resolve and replace [SIGILS] embedded in text.'... | [
"os.path.dirname",
"os.path.join",
"setuptools.setup"
] | [((200, 1134), 'setuptools.setup', 'setup', ([], {'name': '"""sigils"""', 'version': '"""0.0.5"""', 'description': '"""Extract, resolve and replace [SIGILS] embedded in text."""', 'long_description': 'long_description', 'long_description_content_type': '"""text/x-rst"""', 'url': '"""http://github.com/arthexis/sigils"""... |
import lab as B
from stheno import EQ, GP, Delta, Measure
from gpcm.experiment import run, setup
args, wd = setup("smk")
# Setup experiment.
n = 801 # Need to add the last point for the call to `linspace`.
noise = 1.0
t = B.linspace(-44, 44, n)
t_plot = B.linspace(0, 10, 500)
# Setup true model and GPCM models.
ke... | [
"stheno.EQ",
"lab.linspace",
"gpcm.experiment.setup",
"lab.sin",
"stheno.Delta",
"stheno.Measure",
"stheno.GP",
"lab.cos"
] | [((110, 122), 'gpcm.experiment.setup', 'setup', (['"""smk"""'], {}), "('smk')\n", (115, 122), False, 'from gpcm.experiment import run, setup\n'), ((226, 248), 'lab.linspace', 'B.linspace', (['(-44)', '(44)', 'n'], {}), '(-44, 44, n)\n', (236, 248), True, 'import lab as B\n'), ((258, 280), 'lab.linspace', 'B.linspace', ... |
# -*- coding: utf-8 -*-
"""
Module to define CONSTANTS used across the project
"""
import os
from webargs import fields, validate
from marshmallow import Schema, INCLUDE
# identify basedir for the package
BASE_DIR = os.path.dirname(os.path.normpath(os.path.dirname(__file__)))
# default location for input and outp... | [
"webargs.fields.Str",
"os.path.isdir",
"webargs.fields.Float",
"os.path.dirname",
"webargs.validate.OneOf",
"webargs.fields.Int",
"webargs.fields.Field",
"webargs.fields.Boolean",
"os.path.join"
] | [((903, 941), 'os.path.join', 'os.path.join', (['IN_OUT_BASE_DIR', '"""data/"""'], {}), "(IN_OUT_BASE_DIR, 'data/')\n", (915, 941), False, 'import os\n'), ((958, 1027), 'os.path.join', 'os.path.join', (['IN_OUT_BASE_DIR', '"""neural_transfer/dataset/style_images"""'], {}), "(IN_OUT_BASE_DIR, 'neural_transfer/dataset/st... |
from ...isa.inst import *
import numpy as np
class Vmfeq_vf(Inst):
name = 'vmfeq.vf'
def golden(self):
if 'vs2' in self:
result = np.unpackbits( self['orig'], bitorder='little' )
if 'vstart' in self:
vstart = self['vstart']
else:
v... | [
"numpy.packbits",
"numpy.ones",
"numpy.unpackbits"
] | [((161, 207), 'numpy.unpackbits', 'np.unpackbits', (["self['orig']"], {'bitorder': '"""little"""'}), "(self['orig'], bitorder='little')\n", (174, 207), True, 'import numpy as np\n'), ((782, 820), 'numpy.packbits', 'np.packbits', (['result'], {'bitorder': '"""little"""'}), "(result, bitorder='little')\n", (793, 820), Tr... |
from typing import List, Tuple
import numpy as np
from evobench.benchmark import Benchmark
# from evobench.linkage import DependencyStructureMatrix
from evobench.model import Population, Solution
from ..operator import Operator
class RestrictedMixing(Operator):
def __init__(self, benchmark: Benchmark):
... | [
"numpy.zeros"
] | [((911, 959), 'numpy.zeros', 'np.zeros', (['self.benchmark.genome_size'], {'dtype': 'bool'}), '(self.benchmark.genome_size, dtype=bool)\n', (919, 959), True, 'import numpy as np\n')] |
import logging
from django.template import VariableDoesNotExist
from django import template
from stack_it.contents.abstracts import BaseContentMixin
from stack_it.models import Page, Template as TemplateModel
from django.db import transaction
from django.utils.safestring import mark_safe
# Get an instance of a logger
... | [
"stack_it.models.Template.objects.get_or_create",
"django.template.Library",
"django.utils.safestring.mark_safe",
"django.template.Variable",
"stack_it.models.Page.get_or_create",
"django.db.transaction.atomic",
"logging.getLogger",
"django.template.loader.get_template"
] | [((329, 356), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (346, 356), False, 'import logging\n'), ((368, 386), 'django.template.Library', 'template.Library', ([], {}), '()\n', (384, 386), False, 'from django import template\n'), ((1285, 1312), 'django.template.Variable', 'template.Vari... |
from unittest import TestCase
import os
import tempfile
import numpy as np
from keras_trans_mask.backend import keras
from keras_trans_mask import CreateMask, RemoveMask, RestoreMask
class TestMasks(TestCase):
def test_over_fit(self):
input_layer = keras.layers.Input(shape=(None,))
embed_layer ... | [
"keras_trans_mask.RestoreMask",
"keras_trans_mask.RemoveMask",
"keras_trans_mask.backend.keras.layers.Embedding",
"tempfile.gettempdir",
"keras_trans_mask.backend.keras.layers.Input",
"keras_trans_mask.backend.keras.models.Model",
"keras_trans_mask.CreateMask",
"numpy.array",
"keras_trans_mask.backe... | [((266, 299), 'keras_trans_mask.backend.keras.layers.Input', 'keras.layers.Input', ([], {'shape': '(None,)'}), '(shape=(None,))\n', (284, 299), False, 'from keras_trans_mask.backend import keras\n'), ((970, 1029), 'keras_trans_mask.backend.keras.models.Model', 'keras.models.Model', ([], {'inputs': 'input_layer', 'outpu... |
import numpy as np
from scipy.stats import entropy
from bisect import bisect
from scipy import stats
from scipy.stats import median_absolute_deviation as mad
from sklearn.metrics import r2_score, mean_squared_error
from pyapprox.multivariate_polynomials import conditional_moments_of_polynomial_chaos_expansion as cond_m... | [
"numpy.quantile",
"pyapprox.multivariate_polynomials.conditional_moments_of_polynomial_chaos_expansion",
"numpy.copy",
"numpy.zeros",
"scipy.stats.ks_2samp",
"numpy.sqrt"
] | [((7295, 7340), 'numpy.quantile', 'np.quantile', (['results_fix_resample', 'conf_level'], {}), '(results_fix_resample, conf_level)\n', (7306, 7340), True, 'import numpy as np\n'), ((7374, 7427), 'scipy.stats.ks_2samp', 'stats.ks_2samp', (['y_true_resample', 'results_fix_resample'], {}), '(y_true_resample, results_fix_r... |
import re
from datetime import date
import pyexcel
def convert_to_date(datetime: str):
"""Convert the date-time string(dd/mm/yyyy) to date time object"""
if type(datetime) == str:
date_, *_ = datetime.split()
dd, mm, yyyy = [int(val) for val in date_.split("/")]
return date(year=yyyy, ... | [
"pyexcel.get_book",
"datetime.date"
] | [((1033, 1087), 'pyexcel.get_book', 'pyexcel.get_book', ([], {'file_type': '"""xls"""', 'file_content': 'xlfile'}), "(file_type='xls', file_content=xlfile)\n", (1049, 1087), False, 'import pyexcel\n'), ((304, 337), 'datetime.date', 'date', ([], {'year': 'yyyy', 'month': 'mm', 'day': 'dd'}), '(year=yyyy, month=mm, day=d... |
import time
import pickle
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import os.path
def load_cookies(driver):
for cookie in pickle.load(open("TwitterCookies.pkl", "rb")):
driver.add_cookie(cookie)
def save_cookies(driver):
pickle.dump(driver.ge... | [
"selenium.webdriver.firefox.options.Options",
"selenium.webdriver.Firefox",
"time.sleep"
] | [((990, 1003), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1000, 1003), False, 'import time\n'), ((1073, 1088), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (1083, 1088), False, 'import time\n'), ((1164, 1179), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (1174, 1179), False, 'import time... |
from core.argo.core.argoLogging import get_logger
tf_logging = get_logger()
import numpy as np
from core.argo.core.hooks.AbstractImagesReconstructHook import AbstractImagesReconstructHook
from core.argo.core.utils.ImagesSaver import ImagesSaver
class ImagesReconstructHook(AbstractImagesReconstructHook):
def d... | [
"core.argo.core.argoLogging.get_logger"
] | [((64, 76), 'core.argo.core.argoLogging.get_logger', 'get_logger', ([], {}), '()\n', (74, 76), False, 'from core.argo.core.argoLogging import get_logger\n')] |
import sys
sys.path.append('../')
import bz2, os
import random, string
import importlib
import _pickle as pickle
from datetime import datetime, timedelta
# ~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<
# OS & list MANAGEMENT FUNCTIONS <~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<~<... | [
"sys.path.append",
"_pickle.load",
"datetime.datetime.strftime",
"importlib.import_module",
"_pickle.dump",
"os.walk",
"random.choices",
"bz2.BZ2File",
"datetime.timedelta",
"os.path.join"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((583, 596), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (590, 596), False, 'import bz2, os\n'), ((1107, 1125), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (1114, 1125), False, 'im... |
"""Fetch JIRA issues from database
Defines a schema using SQLalchemy
"""
from __future__ import absolute_import
from __future__ import print_function
import logging
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from . import jiraschema
def get_issues(user, password, host="localhost", database="jira"):
... | [
"sqlalchemy.create_engine",
"sqlalchemy.orm.sessionmaker",
"logging.error"
] | [((486, 531), 'sqlalchemy.create_engine', 'sqlalchemy.create_engine', (['connstr'], {'echo': '(False)'}), '(connstr, echo=False)\n', (510, 531), False, 'import sqlalchemy\n'), ((634, 659), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {'bind': 'engine'}), '(bind=engine)\n', (646, 659), False, 'from sqlalchemy.orm... |
import numpy as np
import gpflow
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from mpl_toolkits.mplot3d import axes3d, Axes3D
from BoManifolds.Riemannian_utils.sphere_utils import logmap
from BoManifolds.kernel_utils.kernels_sphere_tf import SphereGaussianKernel, SphereLaplaceKernel
from BoManifolds.p... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"numpy.sum",
"BoManifolds.Riemannian_utils.sphere_utils.logmap",
"matplotlib.pyplot.figure",
"numpy.linalg.norm",
"gpflow.kernels.RBF",
"numpy.diag",
"numpy.linalg.det",
"matplotlib.pylab.cm.inferno",
"matplotlib.pyplot.show",
"mpl_toolkits.mplot... | [((1336, 1397), 'numpy.array', 'np.array', (['[[0.6, 0.2, 0], [0.2, 0.3, -0.01], [0, -0.01, 0.2]]'], {}), '([[0.6, 0.2, 0], [0.2, 0.3, -0.01], [0, -0.01, 0.2]])\n', (1344, 1397), True, 'import numpy as np\n'), ((1423, 1452), 'numpy.linalg.inv', 'np.linalg.inv', (['sigma_test_fct'], {}), '(sigma_test_fct)\n', (1436, 145... |
from flask import render_template, request, redirect, url_for, jsonify, json
from flask_login import login_required
from app.api.classes.location.models import Location
from app.api.classes.observatory.models import Observatory
from app.api.classes.type.models import Type
from app.api.classes.observatory.services imp... | [
"app.api.classes.location.models.Location",
"app.api.classes.location.services.getAllLocations",
"app.db.db.session",
"app.api.classes.location.services.editLocation",
"app.api.classes.location.services.getLocationsAndTypes",
"app.api.bp.route",
"flask.request.get_json"
] | [((519, 565), 'app.api.bp.route', 'bp.route', (['"""/api/addLocation"""'], {'methods': "['POST']"}), "('/api/addLocation', methods=['POST'])\n", (527, 565), False, 'from app.api import bp\n'), ((789, 862), 'app.api.bp.route', 'bp.route', (['"""/api/getLocationsAndTypes/<observatory_name>"""'], {'methods': "['GET']"}), ... |
import re
from datetime import datetime
from getpass import getpass
from sys import argv
from . import __version__
from .data.time import 沙坪坝校区作息时间, 虎溪校区作息时间
from .app import App
class CommandParser:
def __init__(self):
self.username = input("用户名: ").strip()
self.password = getpass("密码: ").strip(... | [
"getpass.getpass",
"re.fullmatch",
"datetime.datetime"
] | [((517, 569), 're.fullmatch', 're.fullmatch', (['"""(?P<year>\\\\d{4,})(?P<term>\\\\d)"""', 'term'], {}), "('(?P<year>\\\\d{4,})(?P<term>\\\\d)', term)\n", (529, 569), False, 'import re\n'), ((772, 843), 're.fullmatch', 're.fullmatch', (['"""(?P<year>\\\\d{4,})(?P<month>\\\\d{2})(?P<day>\\\\d{2})"""', 'date'], {}), "('... |
from django.urls import path
from django.views.generic import TemplateView
from . import views
urlpatterns = [
path('search/directions', views.results_search_directions),
path('enter', views.enter),
path('get', views.result_get),
path('pdf', views.result_print),
path('preview', TemplateView.as_vie... | [
"django.views.generic.TemplateView.as_view",
"django.urls.path"
] | [((117, 175), 'django.urls.path', 'path', (['"""search/directions"""', 'views.results_search_directions'], {}), "('search/directions', views.results_search_directions)\n", (121, 175), False, 'from django.urls import path\n'), ((181, 207), 'django.urls.path', 'path', (['"""enter"""', 'views.enter'], {}), "('enter', view... |
from django.contrib import admin
from .models import Owner
admin.site.register(Owner)
from .models import Car
admin.site.register(Car)
from .models import Ownership
admin.site.register(Ownership)
from .models import License
admin.site.register(License)
| [
"django.contrib.admin.site.register"
] | [((59, 85), 'django.contrib.admin.site.register', 'admin.site.register', (['Owner'], {}), '(Owner)\n', (78, 85), False, 'from django.contrib import admin\n'), ((110, 134), 'django.contrib.admin.site.register', 'admin.site.register', (['Car'], {}), '(Car)\n', (129, 134), False, 'from django.contrib import admin\n'), ((1... |
#!/usr/bin/env python3
from scrapper import INSTANCE_URL
from bs4 import BeautifulSoup
import requests
def get_html() -> BeautifulSoup:
"""Function makes GET request to instance and downloads raw HTML code
which is parsing after."""
html_doc = requests.get(f"{INSTANCE_URL}/preferences").content
html ... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((322, 360), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_doc', '"""html.parser"""'], {}), "(html_doc, 'html.parser')\n", (335, 360), False, 'from bs4 import BeautifulSoup\n'), ((259, 302), 'requests.get', 'requests.get', (['f"""{INSTANCE_URL}/preferences"""'], {}), "(f'{INSTANCE_URL}/preferences')\n", (271, 302), Fa... |
import datetime
import jwt
import os
from functools import wraps
from flask import request, Response
SECRET_KEY = "ThisIsAVeryBadAPISecretKeyThatIsOnlyUsedWhenRunningLocally"
if 'API_KEY' in os.environ: SECRET_KEY = os.environ['API_KEY']
# generates an encrypted auth token using the encrypted using the secret key va... | [
"flask.request.headers.get",
"jwt.encode",
"flask.request.cookies.get",
"datetime.datetime.utcnow",
"datetime.timedelta",
"functools.wraps",
"flask.Response",
"jwt.decode"
] | [((1313, 1321), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (1318, 1321), False, 'from functools import wraps\n'), ((591, 641), 'jwt.encode', 'jwt.encode', (['payload', 'SECRET_KEY'], {'algorithm': '"""HS256"""'}), "(payload, SECRET_KEY, algorithm='HS256')\n", (601, 641), False, 'import jwt\n'), ((922, 956), 'jwt... |
from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
import tkinter.messagebox as mb
import sys, os, requests
def weatherapp():
def closeweatherapp():
file = open('Apps/WeatherApp/src/weather-condition.txt', 'w')
file.write("")
file.close()
weatherapp.destroy()
def getWeather(canvas):... | [
"requests.get"
] | [((1298, 1315), 'requests.get', 'requests.get', (['api'], {}), '(api)\n', (1310, 1315), False, 'import sys, os, requests\n')] |
import os
import shutil
def copytree(src, dst):
"""
Copy file tree from <src> location to <dst> location
"""
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
shutil.copytree(s, d)
else:
shu... | [
"os.path.isdir",
"shutil.copy2",
"shutil.copytree",
"os.path.join",
"os.listdir"
] | [((139, 154), 'os.listdir', 'os.listdir', (['src'], {}), '(src)\n', (149, 154), False, 'import os\n'), ((168, 191), 'os.path.join', 'os.path.join', (['src', 'item'], {}), '(src, item)\n', (180, 191), False, 'import os\n'), ((204, 227), 'os.path.join', 'os.path.join', (['dst', 'item'], {}), '(dst, item)\n', (216, 227), ... |
import os, logging, json, re
import pandas as pd
import numpy as np
from BarSeqPy.translate_R_to_pandas import *
def data_prep_1(data_dir, FEBA_dir, debug_bool=False, meta_ix=7, cfg=None):
""" The first phase of data preparation for the BarSeqR Computations
Args:
data_dir: (str) Path to directory whic... | [
"logging.debug",
"numpy.copy",
"logging.info",
"os.path.isfile",
"pandas.Series",
"re.search",
"os.access",
"pandas.read_table",
"pandas.isna",
"os.path.join",
"os.listdir",
"re.sub"
] | [((8321, 8341), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (8331, 8341), False, 'import os, logging, json, re\n'), ((8648, 8687), 'os.path.join', 'os.path.join', (['data_dir', '"""all.poolcount"""'], {}), "(data_dir, 'all.poolcount')\n", (8660, 8687), False, 'import os, logging, json, re\n'), ((870... |
import matplotlib
matplotlib.rcParams['savefig.dpi'] = 600
# see https://stackoverflow.com/a/46262952 (for norm symbol)
# and https://stackoverflow.com/a/23856968
matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['text.latex.preamble'] = [
r'\usepackage{amsmath}',
r'\usepackage{amsfonts}',
r'\u... | [
"matplotlib.pyplot.rc"
] | [((373, 400), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (379, 400), True, 'import matplotlib.pyplot as plt\n'), ((401, 431), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (407, 431), True, 'import m... |
import nagisa
from core.models import Music
class Nagisa():
def __init__(self, idol):
self.musics = Music.objects.filter(artist=idol).values("id", "identifications_title")
self.overide_nagisa = nagisa.Tagger(
single_word_list=list(self.musics.values_list("identifications_title", fl... | [
"core.models.Music.objects.get",
"core.models.Music.objects.filter"
] | [((117, 150), 'core.models.Music.objects.filter', 'Music.objects.filter', ([], {'artist': 'idol'}), '(artist=idol)\n', (137, 150), False, 'from core.models import Music\n'), ((893, 938), 'core.models.Music.objects.get', 'Music.objects.get', ([], {'identifications_title': 'word'}), '(identifications_title=word)\n', (910... |
import re
def count(word):
"""
Simple syllable counting
"""
word = word if type(word) is str else str(word)
word = word.lower()
if len(word) <= 3:
return 1
word = re.sub('(?:[^laeiouy]es|[^laeiouy]e)$', '', word) # removed ed|
word = re.sub('^y', '', word)
matches = re.... | [
"re.findall",
"re.sub"
] | [((205, 254), 're.sub', 're.sub', (['"""(?:[^laeiouy]es|[^laeiouy]e)$"""', '""""""', 'word'], {}), "('(?:[^laeiouy]es|[^laeiouy]e)$', '', word)\n", (211, 254), False, 'import re\n'), ((280, 302), 're.sub', 're.sub', (['"""^y"""', '""""""', 'word'], {}), "('^y', '', word)\n", (286, 302), False, 'import re\n'), ((317, 35... |
import asyncio
from schedule import Scheduler
from janusbackup.logger import logger
from janusbackup.worker.jobs import BaseJob
class TestJob(BaseJob):
is_active = False
@staticmethod
async def _job(*args, **kwargs):
logger.debug("Hello world for TestJob")
@classmethod
def set_schedule... | [
"janusbackup.logger.logger.debug"
] | [((242, 281), 'janusbackup.logger.logger.debug', 'logger.debug', (['"""Hello world for TestJob"""'], {}), "('Hello world for TestJob')\n", (254, 281), False, 'from janusbackup.logger import logger\n')] |
import json
import requests
from bs4 import BeautifulSoup
def updatePlaces(key):
'''Puts the launch places (address and coords) in a json'''
link = "http://www.spaceflightinsider.com/launch-schedule/"
places = {}
for url in [link, link+"?past=1"]:
page = requests.get(url)
soup = Beautif... | [
"json.dump",
"json.load",
"pprint.pprint",
"requests.get",
"bs4.BeautifulSoup"
] | [((1163, 1180), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1175, 1180), False, 'import requests\n'), ((1192, 1224), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.text', '"""lxml"""'], {}), "(page.text, 'lxml')\n", (1205, 1224), False, 'from bs4 import BeautifulSoup\n'), ((280, 297), 'requests.get', 'req... |
"""
Threading tests.
"""
from multiprocessing.pool import ThreadPool
from tempfile import NamedTemporaryFile
from microcosm.api import create_object_graph
from microcosm.loaders import load_from_dict
from hamcrest import assert_that, contains
from microcosm_sqlite.context import SessionContext
from microcosm_sqlite.... | [
"tempfile.NamedTemporaryFile",
"microcosm_sqlite.tests.fixtures.Person.recreate_all",
"microcosm_sqlite.context.SessionContext",
"multiprocessing.pool.ThreadPool",
"microcosm.api.create_object_graph",
"microcosm_sqlite.tests.fixtures.Person",
"microcosm_sqlite.stores.GetOrCreateSession",
"hamcrest.con... | [((459, 479), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {}), '()\n', (477, 479), False, 'from tempfile import NamedTemporaryFile\n'), ((682, 741), 'microcosm.api.create_object_graph', 'create_object_graph', (['"""example"""'], {'testing': '(True)', 'loader': 'loader'}), "('example', testing=True, loader... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 herrlich10
#
# 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... | [
"subprocess.Popen",
"multiprocessing.Array",
"numpy.frombuffer",
"numpy.dtype",
"shlex.split",
"time.sleep",
"numpy.any",
"time.time",
"multiprocessing.Process",
"numpy.prod",
"multiprocessing.cpu_count"
] | [((5724, 5735), 'time.time', 'time.time', ([], {}), '()\n', (5733, 5735), False, 'import sys, shlex, time\n'), ((6640, 6653), 'numpy.any', 'np.any', (['codes'], {}), '(codes)\n', (6646, 6653), True, 'import numpy as np\n'), ((8430, 8445), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (8438, 8445), True, 'imp... |
import requests
import time
from bs4 import BeautifulSoup
from pymongo import MongoClient
from selenium import webdriver
client = MongoClient('localhost', 27017)
db = client.dbnews
def crawler_daum_news(date):
db_list = client.list_database_names()
if 'dbnews' in db_list:
print('db 최신 뉴스로 새로고침')
... | [
"pymongo.MongoClient",
"time.sleep",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"requests.get",
"bs4.BeautifulSoup"
] | [((131, 162), 'pymongo.MongoClient', 'MongoClient', (['"""localhost"""', '(27017)'], {}), "('localhost', 27017)\n", (142, 162), False, 'from pymongo import MongoClient\n'), ((623, 657), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (635, 657), False, 'import requests\n')... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-06 04:40
from __future__ import unicode_literals
from django.db import migrations
def create_locations(apps, schema_editor):
country_model = apps.get_model("postal_code_api", "Country")
region_model = apps.get_model("postal_code_api", "Region")... | [
"django.db.migrations.RunPython"
] | [((6217, 6273), 'django.db.migrations.RunPython', 'migrations.RunPython', (['create_locations', 'delete_locations'], {}), '(create_locations, delete_locations)\n', (6237, 6273), False, 'from django.db import migrations\n')] |
from typing import List
from fractions import Fraction
from abc import ABC, abstractmethod
import spacy
import string
import random
import pandas as pd
import numpy as np
import diskcache
import sys
from somajo import SoMaJo
from spacy.lang.tr import Turkish
from spacy.lang.sv import Swedish
from spacy.lang.uk import U... | [
"sys.path.append",
"pandas.DataFrame",
"somajo.SoMaJo",
"decompound_server.make_decompounder",
"diskcache.Index",
"random.choice",
"spacy.load",
"random.random"
] | [((1025, 1078), 'spacy.load', 'spacy.load', (['name'], {'disable': "['tagger', 'parser', 'ner']"}), "(name, disable=['tagger', 'parser', 'ner'])\n", (1035, 1078), False, 'import spacy\n'), ((3994, 4012), 'somajo.SoMaJo', 'SoMaJo', (['model_name'], {}), '(model_name)\n', (4000, 4012), False, 'from somajo import SoMaJo\n... |
from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import date
from decimal import Decimal as D
import mock
import pytest
from gratipay.billing.payday import Payday
from gratipay.models.community import Community
from gratipay.models.participant import Participant
from g... | [
"mock.patch.object",
"decimal.Decimal",
"datetime.date.today",
"pytest.raises",
"gratipay.models.participant.Participant.from_username",
"gratipay.models.community.Community.from_slug",
"gratipay.billing.payday.Payday.start"
] | [((5644, 5685), 'mock.patch.object', 'mock.patch.object', (['Participant', '"""_mailer"""'], {}), "(Participant, '_mailer')\n", (5661, 5685), False, 'import mock\n'), ((1336, 1350), 'gratipay.billing.payday.Payday.start', 'Payday.start', ([], {}), '()\n', (1348, 1350), False, 'from gratipay.billing.payday import Payday... |
import numpy as np
from pommerman import constants
from pommerman.constants import Item
from util.data import calc_dist
def staying_alive_reward(nobs, agent_id):
"""
Return a reward if the agent with the given id is alive.
:param nobs: The game state
:param agent_id: The agent to check
... | [
"numpy.isin",
"numpy.asarray",
"numpy.where",
"util.data.calc_dist"
] | [((1392, 1418), 'util.data.calc_dist', 'calc_dist', (['agent_ind', 'nobs'], {}), '(agent_ind, nobs)\n', (1401, 1418), False, 'from util.data import calc_dist\n'), ((4096, 4122), 'numpy.where', 'np.where', (['(wood_bitmap == 1)'], {}), '(wood_bitmap == 1)\n', (4104, 4122), True, 'import numpy as np\n'), ((5017, 5037), '... |
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from plotly import express as px
from attrbench.suite.dashboard.components.pages import Page
class DetailPage(Page):
def __init__(self, result_obj, app):
... | [
"dash_html_components.H2",
"dash_html_components.Div",
"plotly.express.violin",
"dash.dependencies.Input",
"dash_core_components.Graph",
"dash.dependencies.Output"
] | [((474, 505), 'dash.dependencies.Output', 'Output', (['"""plots-div"""', '"""children"""'], {}), "('plots-div', 'children')\n", (480, 505), False, 'from dash.dependencies import Input, Output\n'), ((528, 561), 'dash.dependencies.Input', 'Input', (['"""method-dropdown"""', '"""value"""'], {}), "('method-dropdown', 'valu... |
from django.db import models
# Create your models here.
class Candidate(models.Model):
id = models.IntegerField(primary_key=True)
cand_no = models.IntegerField(blank=True, null=True)
cand_type = models.CharField(max_length=1, blank=True, null=True)
name = models.CharField(max_length=150, blank=True, n... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((98, 135), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (117, 135), False, 'from django.db import models\n'), ((150, 192), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n... |
from machine import UART
import sys
import select
import socket
import iceboot
import gc
def go():
"""
Stupid telnet to serial terminal for Blinkencard
"""
uart=UART(2, rx=16, tx=17, timeout=1)
uart.init(9600)
s = socket.socket()
s.bind(socket.getaddrinfo('0.0.0.0', 5000)[0][-1])
s.li... | [
"select.poll",
"socket.socket",
"gc.collect",
"socket.getaddrinfo",
"iceboot.boot",
"machine.UART"
] | [((180, 212), 'machine.UART', 'UART', (['(2)'], {'rx': '(16)', 'tx': '(17)', 'timeout': '(1)'}), '(2, rx=16, tx=17, timeout=1)\n', (184, 212), False, 'from machine import UART\n'), ((241, 256), 'socket.socket', 'socket.socket', ([], {}), '()\n', (254, 256), False, 'import socket\n'), ((3453, 3465), 'gc.collect', 'gc.co... |
'''
name: E#09
author: <NAME>
email: <EMAIL>
link: https://www.youtube.com/channel/UCNN3bpPlWWUkUMB7gjcUFlw
MIT License https://github.com/repen/E-parsers/blob/master/License
'''
import requests
from bs4 import BeautifulSoup
base_url = "https://wallpapershome.com"
space = "/space?page=4"
response = requests.get(base... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((303, 333), 'requests.get', 'requests.get', (['(base_url + space)'], {}), '(base_url + space)\n', (315, 333), False, 'import requests\n'), ((378, 412), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (391, 412), False, 'from bs4 import BeautifulSoup\n'), ((756, 77... |
#!/usr/bin/env python
from __future__ import unicode_literals
import os
import sys
import django
from django.core.management import call_command
import reviewboard
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reviewboard.settings')
if hasattr(django, 'setup'):
# Dja... | [
"django.core.management.call_command",
"os.path.dirname",
"os.environ.setdefault",
"django.setup"
] | [((201, 272), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""reviewboard.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'reviewboard.settings')\n", (222, 272), False, 'import os\n'), ((339, 353), 'django.setup', 'django.setup', ([], {}), '()\n', (351, 353), False, 'import djang... |
import re
import ply.lex as lex
states = (
('instring', 'exclusive'),
)
tokens = (
'COMMENT', 'HEXSTRING', 'INT', 'FLOAT', 'LITERAL', 'KEYWORD', 'STRING', 'OPERATOR'
)
delimiter = r'\(\)\<\>\[\]\{\}\/\%\s'
delimiter_end = r'(?=[%s]|$)' % delimiter
def t_COMMENT(t):
# r'^%!.+\n'
r'%.*\n'
pass
RE... | [
"ply.lex.TOKEN",
"ply.lex.lex",
"re.compile"
] | [((327, 344), 're.compile', 're.compile', (['"""\\\\s"""'], {}), "('\\\\s')\n", (337, 344), False, 'import re\n'), ((359, 389), 're.compile', 're.compile', (['"""[0-9a-fA-F]{2}|."""'], {}), "('[0-9a-fA-F]{2}|.')\n", (369, 389), False, 'import re\n'), ((392, 422), 'ply.lex.TOKEN', 'lex.TOKEN', (['"""<[0-9A-Fa-f\\\\s]*>"... |
import numpy as np
import pandas as pd
def intersection_cartesian(L1: pd.DataFrame, L2: pd.DataFrame):
"""
Compute cartesian coordinates of intersection points given two list of lines in general form.
General form for a line: Ax+By+C=0
:param L1:
:param L2:
:return:
"""
if not {'A', '... | [
"pandas.DataFrame",
"numpy.abs",
"numpy.floor",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"numpy.round"
] | [((1209, 1221), 'numpy.array', 'np.array', (['p1'], {}), '(p1)\n', (1217, 1221), True, 'import numpy as np\n'), ((1231, 1243), 'numpy.array', 'np.array', (['p2'], {}), '(p2)\n', (1239, 1243), True, 'import numpy as np\n'), ((2246, 2261), 'numpy.array', 'np.array', (['lines'], {}), '(lines)\n', (2254, 2261), True, 'impo... |
import pytest
from pyasn1.type.namedval import NamedValues
from asn1PERser.codec.per.encoder import encode as per_encoder
from asn1PERser.classes.data.builtin.EnumeratedType import EnumeratedType
from asn1PERser.classes.types.constraint import ExtensionMarker
def SCHEMA_my_enum(enumerationRoot_list, extensionMarker_v... | [
"asn1PERser.classes.types.constraint.ExtensionMarker",
"asn1PERser.codec.per.encoder.encode",
"pyasn1.type.namedval.NamedValues"
] | [((561, 599), 'asn1PERser.classes.types.constraint.ExtensionMarker', 'ExtensionMarker', (['extensionMarker_value'], {}), '(extensionMarker_value)\n', (576, 599), False, 'from asn1PERser.classes.types.constraint import ExtensionMarker\n'), ((757, 770), 'pyasn1.type.namedval.NamedValues', 'NamedValues', ([], {}), '()\n',... |
from error.error_crossbar import *
from basic_blocks.mvm_four_bit import mvm_four_by_four
import unittest
import os
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir))
sys.path.insert(0, parent_dir_path)
class TestFourBitMAC(unittest.T... | [
"unittest.main",
"os.path.realpath",
"sys.path.insert",
"basic_blocks.mvm_four_bit.mvm_four_by_four",
"os.path.join"
] | [((251, 286), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent_dir_path'], {}), '(0, parent_dir_path)\n', (266, 286), False, 'import sys\n'), ((154, 180), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (170, 180), False, 'import os\n'), ((216, 249), 'os.path.join', 'os.path.join', (['... |
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from rest_framework.response import Response
from rest_framework.utils import json
from rest_framework.viewsets import ViewSetMixin
from course import models
from rest_fr... | [
"arrange.models.ClassroomInfo.objects.all",
"arrange.models.CourseBaseInfo.objects.filter",
"rest_framework.response.Response",
"arrange.models.CourseBaseInfo.objects.all"
] | [((930, 964), 'arrange.models.ClassroomInfo.objects.all', 'models.ClassroomInfo.objects.all', ([], {}), '()\n', (962, 964), False, 'from arrange import models\n'), ((1084, 1119), 'arrange.models.CourseBaseInfo.objects.all', 'models.CourseBaseInfo.objects.all', ([], {}), '()\n', (1117, 1119), False, 'from arrange import... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def capm(path):
"""Stock Market Data
monthly observations from 1960–01... | [
"observations.util.maybe_download_and_extract",
"os.path.expanduser",
"os.path.join"
] | [((1100, 1124), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (1118, 1124), False, 'import os\n'), ((1264, 1342), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""capm.csv"""', 'resume': '(False)'}), "(path, url, save_file_n... |
# -*- coding: utf-8 -*-
"""
(c) 2019 - Copyright Red Hat Inc
Authors:
<NAME> <<EMAIL>>
"""
from __future__ import unicode_literals, absolute_import
import unittest
import sys
import os
import json
from mock import patch
sys.path.insert(
0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
)... | [
"unittest.main",
"os.path.abspath",
"mock.patch.dict"
] | [((2114, 2179), 'mock.patch.dict', 'patch.dict', (['"""pagure.config.config"""', "{'DISABLED_PLUGINS': ['IRC']}"], {}), "('pagure.config.config', {'DISABLED_PLUGINS': ['IRC']})\n", (2124, 2179), False, 'from mock import patch\n'), ((3522, 3548), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=... |
from contextlib import contextmanager
from datetime import datetime
from six.moves import cStringIO as StringIO
from django.test import TestCase
from django.core import management
from simple_history import models as sh_models
from simple_history.management.commands import populate_history
from .. import models
@c... | [
"django.core.management.call_command",
"six.moves.cStringIO",
"datetime.datetime.now"
] | [((776, 786), 'six.moves.cStringIO', 'StringIO', ([], {}), '()\n', (784, 786), True, 'from six.moves import cStringIO as StringIO\n'), ((4081, 4091), 'six.moves.cStringIO', 'StringIO', ([], {}), '()\n', (4089, 4091), True, 'from six.moves import cStringIO as StringIO\n'), ((4568, 4578), 'six.moves.cStringIO', 'StringIO... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import networkx as nx
import numpy as np
from .defined_histogram import DefinedHistogram
from typing import List, Union
from .make_cuts import MakeCuts, filter_function_for_make_cuts
def histogram_degree_centrality(
graph: nx.Graph,
bin_... | [
"networkx.degree_centrality"
] | [((1543, 1570), 'networkx.degree_centrality', 'nx.degree_centrality', (['graph'], {}), '(graph)\n', (1563, 1570), True, 'import networkx as nx\n'), ((2548, 2580), 'networkx.degree_centrality', 'nx.degree_centrality', (['graph_copy'], {}), '(graph_copy)\n', (2568, 2580), True, 'import networkx as nx\n')] |
from dexp.utils import xpArray
from dexp.utils.backends import Backend, CupyBackend, NumpyBackend
def nan_to_zero(array: xpArray, copy: bool = True) -> xpArray:
"""
Replaces every nan in an array to zero. It might, or not, be able to operate in-place.
To be safe, the returned array should always be used..... | [
"dexp.utils.backends.Backend.current",
"cupy.nan_to_num"
] | [((625, 642), 'dexp.utils.backends.Backend.current', 'Backend.current', ([], {}), '()\n', (640, 642), False, 'from dexp.utils.backends import Backend, CupyBackend, NumpyBackend\n'), ((841, 863), 'cupy.nan_to_num', 'cupy.nan_to_num', (['array'], {}), '(array)\n', (856, 863), False, 'import cupy\n')] |
import sys
import json
log_file_name = sys.argv[1]
number_of_agents = sys.argv[2]
agent_config_file_name = sys.argv[3]
best_agents_file_name = sys.argv[4]
current_iteration = sys.argv[5]
# reading contents of logfile
log_file = open(log_file_name, 'r')
lines = log_file.readlines()
log_file.close()
# convert log entr... | [
"json.load",
"json.loads",
"json.dumps"
] | [((2495, 2526), 'json.load', 'json.load', (['best_agent_json_file'], {}), '(best_agent_json_file)\n', (2504, 2526), False, 'import json\n'), ((394, 414), 'json.loads', 'json.loads', (['lines[i]'], {}), '(lines[i])\n', (404, 414), False, 'import json\n'), ((2882, 2914), 'json.dumps', 'json.dumps', (['next_agent'], {'ind... |
"""Boundary checking (improved)
This function will (hopefully!) find if data in a csv file is contained within Northern Ireland.
If not so, this will be reported back to the user.
For now, please make sure that the second geojson in the argument is a boundary of Northern Ireland.
"""
import shapely
from geojson_util... | [
"json.load",
"shapely.geometry.mapping",
"os.path.exists",
"ltldoorstep.reports.report.GeoJSONReport",
"geopandas.read_file"
] | [((2058, 2079), 'geopandas.read_file', 'gp.read_file', (['ni_data'], {}), '(ni_data)\n', (2070, 2079), True, 'import geopandas as gp\n'), ((4004, 4104), 'ltldoorstep.reports.report.GeoJSONReport', 'report.GeoJSONReport', (['"""GeoJSON Boundary Processor"""', '"""Info from GeoJSON Processor - example info"""'], {}), "('... |
# -*- coding: utf-8 -*-
#code adapted from https://github.com/analyticalmindsltd/smote_variants
import numpy as np
import time
import logging
import itertools
from sklearn.neighbors import NearestNeighbors
# setting the _logger format
_logger = logging.getLogger('smote_variants')
_logger.setLevel(loggin... | [
"numpy.random.seed",
"numpy.copy",
"logging.StreamHandler",
"logging.getLogger",
"time.time",
"logging.Formatter",
"numpy.random.RandomState",
"numpy.hstack",
"sklearn.neighbors.NearestNeighbors",
"itertools.product",
"numpy.squeeze",
"numpy.vstack",
"numpy.unique"
] | [((260, 295), 'logging.getLogger', 'logging.getLogger', (['"""smote_variants"""'], {}), "('smote_variants')\n", (277, 295), False, 'import logging\n'), ((343, 366), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (364, 366), False, 'import logging\n'), ((392, 450), 'logging.Formatter', 'logging.Form... |
#!/usr/bin/env python
from telnetlib import Telnet
import time
tn = Telnet('192.168.1.4', 13666, None)
tn.write("hello\n")
tn.write("screen_add s1\n")
tn.write("screen_set s1 -priority 1\n")
tn.write("widget_add s1 w1 string\n")
tn.write("widget_add s1 w2 string\n")
def lcd_string(x, telnet_obj, delay=2):
L = []... | [
"telnetlib.Telnet",
"time.sleep"
] | [((70, 104), 'telnetlib.Telnet', 'Telnet', (['"""192.168.1.4"""', '(13666)', 'None'], {}), "('192.168.1.4', 13666, None)\n", (76, 104), False, 'from telnetlib import Telnet\n'), ((606, 623), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (616, 623), False, 'import time\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"hashlib.md5",
"decapod_common.models.role.PermissionSet.add_permission",
"pytest.faux.gen_uuid",
"decapod_common.models.execution.ExecutionModel.find_by_model_id",
"decapod_common.models.task.Task.get_by_execution_id",
"pytest.faux.gen_integer",
"decapod_common.models.execution_step.ExecutionStep.colle... | [((4820, 4870), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""what"""', "('id', 'version')"], {}), "('what', ('id', 'version'))\n", (4843, 4870), False, 'import pytest\n'), ((9115, 9182), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', 'execution_step.ExecutionStepState'], {}), "('s... |
from typing import Callable, Optional
from numpy import nan
from pandas import Series, isnull, Interval
from pandas.core.dtypes.inference import is_number
class ObjectDataMixin(object):
_data: Optional[Series]
_validate_data: Callable[[Series], None]
def _set_data(self, data: Series):
self.dat... | [
"pandas.isnull",
"pandas.core.dtypes.inference.is_number"
] | [((2550, 2559), 'pandas.isnull', 'isnull', (['d'], {}), '(d)\n', (2556, 2559), False, 'from pandas import Series, isnull, Interval\n'), ((1662, 1671), 'pandas.isnull', 'isnull', (['d'], {}), '(d)\n', (1668, 1671), False, 'from pandas import Series, isnull, Interval\n'), ((1813, 1825), 'pandas.core.dtypes.inference.is_n... |
"""
An extended shell for test selection
"""
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.core.magic import (Magics, magics_class, line_magic)
from IPython.core.history import HistoryManager
class PytestShellEmbed(InteractiveShellEmbed):
"""Custom ip shell with a slightly altered exit mes... | [
"IPython.core.history.HistoryManager"
] | [((667, 739), 'IPython.core.history.HistoryManager', 'HistoryManager', ([], {'shell': 'self', 'parent': 'self', 'hist_file': 'self.pytest_hist_file'}), '(shell=self, parent=self, hist_file=self.pytest_hist_file)\n', (681, 739), False, 'from IPython.core.history import HistoryManager\n')] |
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceclipper.py,v $
## Language: Python
## Date: $Date: 2006/05/26 12:35:13 $
## Version: $Revision: 1.9 $
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WIT... | [
"vtk.vtkPoints",
"vmtk.vmtkscripts.vmtkSurfaceDistance",
"vtk.vtkWarpVector",
"vtk.vtkThreshold",
"vmtk.vmtkscripts.vmtkSurfaceRegionDrawing",
"vmtk.pypes.pypeMain",
"vtk.vtkAppendPolyData",
"vmtk.vmtkscripts.vmtkSurfaceClipper",
"vtk.vtkIdList",
"vtk.vtkConnectivityFilter",
"vmtk.vmtkcontribscr... | [((24418, 24434), 'vmtk.pypes.pypeMain', 'pypes.pypeMain', ([], {}), '()\n', (24432, 24434), False, 'from vmtk import pypes\n'), ((865, 896), 'vmtk.pypes.pypeScript.__init__', 'pypes.pypeScript.__init__', (['self'], {}), '(self)\n', (890, 896), False, 'from vmtk import pypes\n'), ((5226, 5248), 'vtk.vtkCleanPolyData', ... |
import logging
from gehomesdk.erd.converters.abstract import ErdReadOnlyConverter
from gehomesdk.erd.converters.primitives import *
from gehomesdk.erd.values.laundry import ErdTankStatus, TankStatus, TANK_STATUS_MAP
_LOGGER = logging.getLogger(__name__)
class TankStatusConverter(ErdReadOnlyConverter[TankStatus]):
... | [
"logging.getLogger"
] | [((228, 255), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (245, 255), False, 'import logging\n')] |
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... | [
"cve_manager.function.cache.LRUCache"
] | [((899, 910), 'cve_manager.function.cache.LRUCache', 'LRUCache', (['(2)'], {}), '(2)\n', (907, 910), False, 'from cve_manager.function.cache import LRUCache\n')] |
"""
"""
# IMPORT modules. Must have unittest, and probably coast.
import coast
from coast import general_utils
import unittest
import numpy as np
import os.path as path
import xarray as xr
import matplotlib.pyplot as plt
import unit_test_files as files
class test_transect_methods(unittest.TestCase):
def test_de... | [
"coast.TransectT",
"matplotlib.pyplot.close",
"coast.TransectF",
"numpy.isclose",
"coast.Gridded"
] | [((377, 481), 'coast.Gridded', 'coast.Gridded', (['files.fn_nemo_grid_t_dat'], {'fn_domain': 'files.fn_nemo_dom', 'config': 'files.fn_config_t_grid'}), '(files.fn_nemo_grid_t_dat, fn_domain=files.fn_nemo_dom, config\n =files.fn_config_t_grid)\n', (390, 481), False, 'import coast\n'), ((4641, 4752), 'coast.Gridded', ... |
import numpy as np
from csv import reader
from decimal import *
def SDM(datalist):
"""
逐差法
:param datalist:
:return:
"""
length = len(datalist)
resultlist = []
halfLen = int(length/2)
for i in range(0, halfLen):
resultlist.append((Decimal(datalist[i+halfLen])... | [
"numpy.array",
"csv.reader"
] | [((566, 597), 'csv.reader', 'reader', (['raw_data'], {'delimiter': '""","""'}), "(raw_data, delimiter=',')\n", (572, 597), False, 'from csv import reader\n'), ((653, 668), 'numpy.array', 'np.array', (['overx'], {}), '(overx)\n', (661, 668), True, 'import numpy as np\n')] |
from swagger import RoutingSpecGenerator
import os
def replace_class_instances(className, fileContents):
fileContents = replace_class_named_instances(className, fileContents)
fileContents = str(fileContents).replace('**CLASSNAME**', className)
return replace_class_plural_instances(className, fileContents)... | [
"swagger.RoutingSpecGenerator.RoutingSpecGenerator",
"os.path.join"
] | [((1204, 1247), 'swagger.RoutingSpecGenerator.RoutingSpecGenerator', 'RoutingSpecGenerator.RoutingSpecGenerator', ([], {}), '()\n', (1245, 1247), False, 'from swagger import RoutingSpecGenerator\n'), ((1484, 1537), 'os.path.join', 'os.path.join', (['swagger_paths_spec_dir', "(model + '.yaml')"], {}), "(swagger_paths_sp... |
# -*- coding: utf-8 -*-
import random
import unittest
import tondo
class TestSequenceFunctions(unittest.TestCase):
JSON_ITEMS = [
'content',
'contributor',
'type',
'url'
]
def setUp(self):
self.json = tondo.loadjsons()
def test_json_integrity(self):
... | [
"unittest.TextTestRunner",
"tondo.loadjsons",
"unittest.TestLoader"
] | [((258, 275), 'tondo.loadjsons', 'tondo.loadjsons', ([], {}), '()\n', (273, 275), False, 'import tondo\n'), ((502, 523), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (521, 523), False, 'import unittest\n'), ((573, 609), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}),... |
"""users table
Revision ID: a7acd67386c9
Revises:
Create Date: 2020-07-21 16:17:36.492935
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by ... | [
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((1275, 1296), 'alembic.op.drop_table', 'op.drop_table', (['"""user"""'], {}), "('user')\n", (1288, 1296), False, 'from alembic import op\n'), ((695, 724), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (718, 724), True, 'import sqlalchemy as sa\n'), ((751, 774), 'alembic... |
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
import dataclasses
import context
import wallet.services.offchain.p2p_payment as pc_service
import wallet.services.offchain.utils as utils
from diem import identifier, LocalAccount, jsonrpc
from diem_utils.types.currencies import DiemCurr... | [
"wallet.services.offchain.p2p_payment.save_outbound_payment_command",
"wallet.services.offchain.offchain.process_offchain_tasks",
"dataclasses.replace",
"wallet.services.offchain.offchain.process_inbound_command",
"diem.identifier.gen_subaddress",
"wallet.storage.get_transaction_by_reference_id",
"offch... | [((881, 960), 'tests.wallet_tests.resources.seeds.one_user_seeder.OneUser.run', 'OneUser.run', (['db_session'], {'account_amount': '(100000000000)', 'account_currency': 'currency'}), '(db_session, account_amount=100000000000, account_currency=currency)\n', (892, 960), False, 'from tests.wallet_tests.resources.seeds.one... |
from urllib import request, error as url_error
from django.conf import settings
from cra_helper.logging import logger
def hosted_by_liveserver(file_url: str) -> bool:
# Ignore the server check if we're in production
if settings.DEBUG:
try:
resp = request.urlopen(file_url)
if ... | [
"cra_helper.logging.logger.warning",
"urllib.request.urlopen",
"cra_helper.logging.logger.debug"
] | [((754, 814), 'cra_helper.logging.logger.debug', 'logger.debug', (['"""Liveserver host check disabled in production"""'], {}), "('Liveserver host check disabled in production')\n", (766, 814), False, 'from cra_helper.logging import logger\n'), ((279, 304), 'urllib.request.urlopen', 'request.urlopen', (['file_url'], {})... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_im... | [
"_inertial3DSpin.longArray_setitem",
"_inertial3DSpin.delete_longArray",
"_inertial3DSpin.doubleArray_getitem",
"_inertial3DSpin.new_intArray",
"_inertial3DSpin.shortArray_setitem",
"_inertial3DSpin.intArray_getitem",
"inspect.getmembers",
"_inertial3DSpin.delete_shortArray",
"os.path.dirname",
"_... | [((2985, 3027), '_inertial3DSpin.new_doubleArray', '_inertial3DSpin.new_doubleArray', (['nelements'], {}), '(nelements)\n', (3016, 3027), False, 'import _inertial3DSpin\n'), ((3119, 3158), '_inertial3DSpin.delete_doubleArray', '_inertial3DSpin.delete_doubleArray', (['ary'], {}), '(ary)\n', (3153, 3158), False, 'import ... |
# -*- coding: utf-8 -*-
# Copyright (c) <NAME>. All Rights Reserved.
# Distributed under the MIT License. See LICENSE file for more info.
import time
from asyncframes import Frame, PFrame, sleep, all_
from asyncframes.asyncio_eventloop import EventLoop
@Frame
async def main_frame():
subframes = [sub_frame(i) for ... | [
"asyncframes.asyncio_eventloop.EventLoop",
"asyncframes.all_",
"time.sleep"
] | [((504, 515), 'asyncframes.asyncio_eventloop.EventLoop', 'EventLoop', ([], {}), '()\n', (513, 515), False, 'from asyncframes.asyncio_eventloop import EventLoop\n'), ((456, 473), 'time.sleep', 'time.sleep', (['(0.001)'], {}), '(0.001)\n', (466, 473), False, 'import time\n'), ((400, 416), 'asyncframes.all_', 'all_', (['*... |
from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(270)
magenta=(255,0,255)
sense.clear(magenta)
| [
"sense_hat.SenseHat"
] | [((40, 50), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (48, 50), False, 'from sense_hat import SenseHat\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import subprocess
from flask import Flask, Response, request
from deployer.runner import run_child
app = Flask('deployer')
@app.route('/incoming/<deployment_name>/', methods=["POST"])
def incoming(deployment_name):
r = request
config_path = os.en... | [
"deployer.runner.run_child",
"flask.Flask",
"os.path.exists",
"os.environ.get",
"flask.Response"
] | [((170, 187), 'flask.Flask', 'Flask', (['"""deployer"""'], {}), "('deployer')\n", (175, 187), False, 'from flask import Flask, Response, request\n'), ((315, 348), 'os.environ.get', 'os.environ.get', (['"""DEPLOYER_CONFIG"""'], {}), "('DEPLOYER_CONFIG')\n", (329, 348), False, 'import os, sys\n'), ((637, 658), 'deployer.... |
import pretty_midi
import numpy as np
'''
Note class: represent note, including:
1. the note pitch
2. the note duration
3. downbeat
4. intensity of note sound
'''
class Note:
def __init__(self):
self.pitch = 0
self.length = 0
self.downbeat = False
self.force = 0
... | [
"numpy.save",
"pretty_midi.PrettyMIDI"
] | [((1240, 1264), 'pretty_midi.PrettyMIDI', 'pretty_midi.PrettyMIDI', ([], {}), '()\n', (1262, 1264), False, 'import pretty_midi\n'), ((1277, 1305), 'pretty_midi.PrettyMIDI', 'pretty_midi.PrettyMIDI', (['path'], {}), '(path)\n', (1299, 1305), False, 'import pretty_midi\n'), ((613, 647), 'pretty_midi.PrettyMIDI', 'pretty_... |
"""Utility functions and classes for visualization and logging."""
import os
from datetime import datetime
import cv2
import imageio
import numpy as np
from allenact_plugins.manipulathor_plugin.manipulathor_utils import initialize_arm
from allenact_plugins.manipulathor_plugin.manipulathor_utils import (
reset_env... | [
"numpy.stack",
"allenact_plugins.manipulathor_plugin.manipulathor_utils.transport_wrapper",
"os.makedirs",
"cv2.imwrite",
"numpy.zeros",
"os.path.exists",
"datetime.datetime.now",
"allenact_plugins.manipulathor_plugin.manipulathor_utils.initialize_arm",
"allenact_plugins.manipulathor_plugin.manipula... | [((11803, 11834), 'os.path.join', 'os.path.join', (['gif_dir', 'gif_name'], {}), '(gif_dir, gif_name)\n', (11815, 11834), False, 'import os\n'), ((11896, 11931), 'numpy.zeros', 'np.zeros', (['(seq_len, w, h * cols, c)'], {}), '((seq_len, w, h * cols, c))\n', (11904, 11931), True, 'import numpy as np\n'), ((602, 616), '... |
import logging
from tornado import gen
import hijackingprevention.db_int as db_int
logger = logging.getLogger(__name__)
class User(db_int.Interface):
"""This class handles reading, writing, and manipulating user objects."""
def __init__(self, uid, site, db):
self.__id_type = "uid"
self.__id = uid
self.__dat... | [
"logging.getLogger"
] | [((94, 121), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (111, 121), False, 'import logging\n')] |
# Standard python library
import logging
# The Fastapi web server
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
# Import uvicorn for debugging
import uvicorn
# The settings for the system
from settings import settings
# Acces to the bockchain
... | [
"blockchain.trustframework.connect_blockchain",
"logging.basicConfig",
"fastapi.templating.Jinja2Templates",
"uvicorn.run",
"logging.getLogger",
"fastapi.FastAPI"
] | [((381, 476), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s - %(asctime)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)s - %(asctime)s - %(message)s',\n level=logging.INFO)\n", (400, 476), False, 'import logging\n'), ((484, 511), 'logging.getLogger', 'logging.... |
import math
num = int(input("Enter the number:"))
try:
result = math.factorial(num)
print(result)
except:
print("factorial is not print for negative number") | [
"math.factorial"
] | [((65, 84), 'math.factorial', 'math.factorial', (['num'], {}), '(num)\n', (79, 84), False, 'import math\n')] |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from utils import read_ZINC_smiles, smiles_to_onehot, convert_to_graph
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
import sys
import time
# execution) python gcn_logP.py 3 64 256 0.001 gsc
# Def... | [
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.reduce_sum",
"utils.read_ZINC_smiles",
"numpy.abs",
"tensorflow.reshape",
"tensorflow.train.AdamOptimizer",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"tensorflow.Variable",
"numpy.arange",
"numpy.mean",
"tensorflow.multiply",
... | [((75, 100), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (93, 100), True, 'import matplotlib.pyplot as plt\n'), ((955, 978), 'utils.read_ZINC_smiles', 'read_ZINC_smiles', (['(50000)'], {}), '(50000)\n', (971, 978), False, 'from utils import read_ZINC_smiles, smiles_to_one... |
# Average Pariwsie Distance:
import argparse
import pickle
import pandas as pd
from scipy.spatial import distance
parser = argparse.ArgumentParser(
description="Average Pariwsie Distance Evaluation (Quality Analysis)"
)
parser.add_argument("embed_type", type=str, metavar="N", help="")
parser.add_argument("label... | [
"pandas.DataFrame.from_dict",
"pickle.load",
"argparse.ArgumentParser",
"scipy.spatial.distance.euclidean"
] | [((127, 226), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Average Pariwsie Distance Evaluation (Quality Analysis)"""'}), "(description=\n 'Average Pariwsie Distance Evaluation (Quality Analysis)')\n", (150, 226), False, 'import argparse\n'), ((5598, 5693), 'pandas.DataFrame.from_di... |
import numpy as np
from ROI_Arrival import ROI_Arrival,ROI_Location
#prefined imports
import sys,time,winsound
import numpy as np
from PyQt5.QtWidgets import (QApplication, QPushButton,QWidget,QGridLayout,
QSizePolicy,QLineEdit,
QMainWindow,QAction,QVBoxLayout
... | [
"PyQt5.QtWidgets.QLabel",
"ROI_Arrival.ROI_Arrival",
"ROI_Arrival.ROI_Location",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtGui.QFont",
"time.time",
"matplotlib.backends.backend_qt5agg.FigureCanvas",
"matplotlib.... | [((1247, 1254), 'PyQt5.QtGui.QFont', 'QFont', ([], {}), '()\n', (1252, 1254), False, 'from PyQt5.QtGui import QFont\n'), ((1611, 1636), 'PyQt5.QtWidgets.QAction', 'QAction', (['"""&Save Spectrum"""'], {}), "('&Save Spectrum')\n", (1618, 1636), False, 'from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QGri... |
"""
Copyright (c) 2020 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WI... | [
"matplotlib.pyplot.show",
"main.predict",
"main.train",
"matplotlib.pyplot.legend",
"sklearn.metrics.r2_score",
"matplotlib.pyplot.scatter"
] | [((968, 1010), 'main.train', 'train', (['"""data/train.csv"""', '"""data/"""', '(2000)', '(40)'], {}), "('data/train.csv', 'data/', 2000, 40)\n", (973, 1010), False, 'from main import train, predict\n'), ((1142, 1180), 'main.predict', 'predict', (['"""data/test.csv"""', '"""data/"""', '(0.1)'], {}), "('data/test.csv', ... |
from corner import corner
import numpy as np
CORNER_KWARGS = dict(
smooth=0.9,
label_kwargs=dict(fontsize=30),
title_kwargs=dict(fontsize=16),
color="tab:blue",
truth_color="tab:orange",
quantiles=[0.16, 0.84],
levels=(1 - np.exp(-0.5), 1 - np.exp(-2), 1 - np.exp(-9.0 / 2.0)),
plot_dens... | [
"corner.corner",
"numpy.exp"
] | [((742, 784), 'corner.corner', 'corner', (['df'], {'labels': 'labels'}), '(df, labels=labels, **CORNER_KWARGS)\n', (748, 784), False, 'from corner import corner\n'), ((252, 264), 'numpy.exp', 'np.exp', (['(-0.5)'], {}), '(-0.5)\n', (258, 264), True, 'import numpy as np\n'), ((270, 280), 'numpy.exp', 'np.exp', (['(-2)']... |
#Ref: <NAME>
"""
# TTA - Should be called prediction time augmentation
#We can augment each input image, predict augmented images and average all predictions
"""
import os
import cv2
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
import random
model = tf.ker... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"tensorflow.keras.models.load_model",
"random.randint",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.flipud",
"numpy.expand_dims",
"numpy.fliplr",
"matplotlib.pyplot.figure",
"cv2.imread",
"numpy.array",
"PIL.Image.froma... | [((314, 416), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""mitochondria_load_from_disk_focal_dice_50epochs.hdf5"""'], {'compile': '(False)'}), "(\n 'mitochondria_load_from_disk_focal_dice_50epochs.hdf5', compile=False)\n", (340, 416), True, 'import tensorflow as tf\n'), ((564, 591), 'os.... |
"""Added task model
Revision ID: ca6c6171cdbe
Revises: 989dbc01a9b0
Create Date: 2021-06-11 08:31:03.584401
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ca6c6171cdbe'
down_revision = '989dbc01a9b0'
branch_labels = None
depends_on = None
def upgrade():
... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Text",
"sqlalchemy.Boolean",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((1295, 1316), 'alembic.op.drop_table', 'op.drop_table', (['"""task"""'], {}), "('task')\n", (1308, 1316), False, 'from alembic import op\n'), ((940, 991), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['admin_id']", "['admin.id']"], {}), "(['admin_id'], ['admin.id'])\n", (963, 991), True, 'import s... |
import tensorflow as tf
class ResidualDense(tf.keras.layers.Layer):
def __init__(
self,
units,
activation=None,
dropout=None,
kernel_initializer=None,
kernel_regularizer=None,
output_activation=None
):
super(ResidualDense, self).__init__()
... | [
"tensorflow.keras.layers.Dense",
"tensorflow.reshape",
"tensorflow.zeros_like",
"tensorflow.keras.backend.int_shape",
"tensorflow.executing_eagerly",
"tensorflow.abs",
"tensorflow.TensorShape",
"tensorflow.sort",
"tensorflow.cast",
"tensorflow.gradients",
"tensorflow.keras.layers.Permute",
"te... | [((785, 949), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', ([], {'units': 'self.units', 'activation': 'self.activation', 'kernel_initializer': 'self.kernel_initializer', 'kernel_regularizer': 'self.kernel_regularizer'}), '(units=self.units, activation=self.activation,\n kernel_initializer=self.kernel_in... |
"""
Transformers
------------
Transformers defines the mutations that can be applied. The ``CATEGORIES`` dictionary lists all
valid category codes that are valid filters. The primary classes are:
1. ``LocIndex``
2. ``MutateAST``
The ``LocIndex`` is a location index within a given Abstract Syntax Tree (AST) that can ... | [
"ast.Index",
"ast.Num",
"ast.Compare",
"ast.If",
"ast.Subscript",
"ast.Slice",
"ast.USub",
"logging.getLogger"
] | [((1217, 1244), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1234, 1244), False, 'import logging\n'), ((16067, 16079), 'ast.Num', 'ast.Num', ([], {'n': '(0)'}), '(n=0)\n', (16074, 16079), False, 'import ast\n'), ((16109, 16121), 'ast.Num', 'ast.Num', ([], {'n': '(1)'}), '(n=1)\n', (161... |