code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from pathlib import Path
import cv2
from icls.albu import Compose
from torch.utils.data import Dataset
class ImagenetDataset(Dataset):
def __init__(self, prefix: str, augs: Compose) -> None:
self.prefix = Path(prefix)
self.augs = augs
with open(self.prefix / "val.txt", "r") as f:
... | [
"cv2.cvtColor",
"pathlib.Path"
] | [((221, 233), 'pathlib.Path', 'Path', (['prefix'], {}), '(prefix)\n', (225, 233), False, 'from pathlib import Path\n'), ((777, 813), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (789, 813), False, 'import cv2\n')] |
from allennlp.data import Instance
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.fields import LabelField, TextField, IndexField
from allennlp.data.token_indexers import SingleIdTokenIndexer
from allennlp.data.tokenizers import Token
class LinspectorContextualDatasetReader(DatasetReader):... | [
"allennlp.data.fields.IndexField",
"allennlp.data.fields.LabelField",
"allennlp.data.fields.TextField",
"allennlp.data.tokenizers.Token",
"allennlp.data.token_indexers.SingleIdTokenIndexer",
"allennlp.data.Instance"
] | [((933, 953), 'allennlp.data.fields.IndexField', 'IndexField', (['index', '(0)'], {}), '(index, 0)\n', (943, 953), False, 'from allennlp.data.fields import LabelField, TextField, IndexField\n'), ((969, 985), 'allennlp.data.Instance', 'Instance', (['fields'], {}), '(fields)\n', (977, 985), False, 'from allennlp.data imp... |
# train logistic regression on mnist dataest
import numpy as np
import theano.tensor as T
import theano as K
import gzip, cPickle
import matplotlib.pyplot as plt
from random import sample, seed
import os, sys
os.chdir('data/sparse_lstm')
print(os.getcwd())
from sparse_lstm import Sparse_LSTM_wo_O_Gate_v2
from keras.m... | [
"numpy.hstack",
"matplotlib.pyplot.ylabel",
"gzip.open",
"numpy.arange",
"os.path.exists",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.random.seed",
"numpy.vstack",
"os.mkdir",
"sys.setrecursionlimit",
"matplotlib.pyplot.savefig",
"keras.models.Sequential",
"keras.regulari... | [((210, 238), 'os.chdir', 'os.chdir', (['"""data/sparse_lstm"""'], {}), "('data/sparse_lstm')\n", (218, 238), False, 'import os, sys\n'), ((648, 676), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000)'], {}), '(10000)\n', (669, 676), False, 'import os, sys\n'), ((1411, 1463), 'numpy.vstack', 'np.vstack', (['... |
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 17:26:56 2019
@author: autol
"""
import re
import pandas as pd
#%%
import dcm_util as ut
from dcm_globalvar import *
locals().update(var.to_dict()) # 设置读取的全局变量
#%%
def df_transform_stream(df):
df_x=pd.DataFrame();
df = ut.titles_trans_columns(df,titles_cn);... | [
"re.search",
"dcm_util.split_list",
"pandas.merge",
"dcm_util.check_cn_str",
"dcm_util.print_log",
"pandas.DataFrame",
"re.sub",
"dcm_util.save_adjust_xlsx",
"pandas.concat",
"dcm_util.titles_trans_columns"
] | [((256, 270), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (268, 270), True, 'import pandas as pd\n'), ((282, 320), 'dcm_util.titles_trans_columns', 'ut.titles_trans_columns', (['df', 'titles_cn'], {}), '(df, titles_cn)\n', (305, 320), True, 'import dcm_util as ut\n'), ((4038, 4058), 're.sub', 're.sub', (['"""... |
from typing import List, Optional
from openff.bespokefit.schema.fitting import BespokeOptimizationSchema
from pydantic import BaseModel, Field
from beflow.services.coordinator.stages import StageType
from beflow.utilities.typing import Status
class CoordinatorGETStageStatus(BaseModel):
stage_type: str = Field(... | [
"pydantic.Field"
] | [((314, 340), 'pydantic.Field', 'Field', (['...'], {'description': '""""""'}), "(..., description='')\n", (319, 340), False, 'from pydantic import BaseModel, Field\n'), ((369, 395), 'pydantic.Field', 'Field', (['...'], {'description': '""""""'}), "(..., description='')\n", (374, 395), False, 'from pydantic import BaseM... |
import re
from uuid import UUID
from typing import Union
class BTUUID(UUID):
"""An extension of the built-in UUID class with some utility functions for converting Bluetooth UUID16s to and from UUID128s."""
_UUID16_UUID128_FMT = "0000{0}-0000-1000-8000-00805F9B34FB"
_UUID16_UUID128_RE = re.compile(
... | [
"re.compile"
] | [((303, 379), 're.compile', 're.compile', (['"""^0000([0-9A-F]{4})-0000-1000-8000-00805F9B34FB$"""', 're.IGNORECASE'], {}), "('^0000([0-9A-F]{4})-0000-1000-8000-00805F9B34FB$', re.IGNORECASE)\n", (313, 379), False, 'import re\n'), ((411, 462), 're.compile', 're.compile', (['"""^(?:0x)?([0-9A-F]{4})$"""', 're.IGNORECASE... |
import urllib
import urllib.request
import datetime
import time
while True:
try:
page = urllib.request.urlopen('http://pudim.com.br/')
except urllib.error.URLError:
print('\033[31mO site pudim não está acessível no momento.\033[m', end = ' - ')
else:
print('\033[34mConsegui acessar o... | [
"datetime.datetime.now",
"urllib.request.urlopen",
"time.sleep"
] | [((100, 146), 'urllib.request.urlopen', 'urllib.request.urlopen', (['"""http://pudim.com.br/"""'], {}), "('http://pudim.com.br/')\n", (122, 146), False, 'import urllib\n'), ((434, 447), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (444, 447), False, 'import time\n'), ((399, 422), 'datetime.datetime.now', 'dateti... |
# coding=utf-8
# 结构方程模型的参数估计
from __future__ import division, print_function, unicode_literals
from psy import sem, data
import numpy as np
data_ = data['ex5.11.dat']
beta = np.array([
[0, 0],
[1, 0]
])
gamma = np.array([
[1, 1],
[0, 0]
])
x = [0, 1, 2, 3, 4, 5]
lam_x = np.array([
[1, 0],
[... | [
"numpy.array",
"numpy.diag",
"psy.sem"
] | [((176, 202), 'numpy.array', 'np.array', (['[[0, 0], [1, 0]]'], {}), '([[0, 0], [1, 0]])\n', (184, 202), True, 'import numpy as np\n'), ((222, 248), 'numpy.array', 'np.array', (['[[1, 1], [0, 0]]'], {}), '([[1, 1], [0, 0]])\n', (230, 248), True, 'import numpy as np\n'), ((292, 350), 'numpy.array', 'np.array', (['[[1, 0... |
import asyncio
import random
import typing
import discord
from .base_day_states import DayState, Challenging, Reporting, Undoable, States, SearchSummary, \
RandomizeSearch, HangSummary, DuelInterface
from .errors import VotingNotAllowed, WrongValidVotesNumber, DuplicateVote, WrongVote, DuelDoublePerson, \
Not... | [
"discord.Colour",
"random.choice",
"asyncio.gather"
] | [((14674, 14696), 'asyncio.gather', 'asyncio.gather', (['*tasks'], {}), '(*tasks)\n', (14688, 14696), False, 'import asyncio\n'), ((6126, 6148), 'asyncio.gather', 'asyncio.gather', (['*tasks'], {}), '(*tasks)\n', (6140, 6148), False, 'import asyncio\n'), ((11344, 11369), 'random.choice', 'random.choice', (['self.other'... |
# -*- coding: utf-8 -*-
"""
@author: fornax
"""
from __future__ import print_function, division
import os
import numpy as np
import pandas as pd
os.chdir(os.path.dirname(os.path.abspath(__file__)))
os.sys.path.append(os.path.dirname(os.getcwd()))
import prepare_data1 as prep
DATA_PATH = os.path.join('..', prep.DATA_PA... | [
"os.path.abspath",
"os.path.join",
"numpy.unique",
"os.getcwd"
] | [((289, 323), 'os.path.join', 'os.path.join', (['""".."""', 'prep.DATA_PATH'], {}), "('..', prep.DATA_PATH)\n", (301, 323), False, 'import os\n'), ((6104, 6146), 'os.path.join', 'os.path.join', (['DATA_PATH', "(filename + '.csv')"], {}), "(DATA_PATH, filename + '.csv')\n", (6116, 6146), False, 'import os\n'), ((381, 41... |
import unittest
from code.evallib import recall
class TestRecall(unittest.TestCase):
'''
Recall tests
recall excepts two parameters: two document sets (relevent and retrieved)
It returns the value of: |(relevent INTERSECTION retrieved)| / |relevent|
'''
def test_expected(self):
releve... | [
"unittest.main",
"code.evallib.recall"
] | [((1874, 1889), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1887, 1889), False, 'import unittest\n'), ((455, 502), 'code.evallib.recall', 'recall', (['relevent_documents', 'retrieved_documents'], {}), '(relevent_documents, retrieved_documents)\n', (461, 502), False, 'from code.evallib import recall\n'), ((712,... |
import pytest
from pycfmodel.model.resources.kms_key import KMSKey
@pytest.fixture()
def kms_key():
return KMSKey(
**{
"Type": "AWS::KMS::Key",
"Properties": {
"Description": "Test key to test KMS best practices",
"Enabled": True,
"E... | [
"pytest.fixture",
"pycfmodel.model.resources.kms_key.KMSKey"
] | [((71, 87), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (85, 87), False, 'import pytest\n'), ((114, 711), 'pycfmodel.model.resources.kms_key.KMSKey', 'KMSKey', ([], {}), "(**{'Type': 'AWS::KMS::Key', 'Properties': {'Description':\n 'Test key to test KMS best practices', 'Enabled': True,\n 'EnableKeyRota... |
# Generated by Django 3.1.4 on 2021-11-13 07:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='docprofile',
name='address2',
),
... | [
"django.db.migrations.RemoveField"
] | [((213, 277), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""docprofile"""', 'name': '"""address2"""'}), "(model_name='docprofile', name='address2')\n", (235, 277), False, 'from django.db import migrations\n'), ((322, 388), 'django.db.migrations.RemoveField', 'migrations.RemoveFie... |
import sys
import requests
import random
token = sys.argv[1]
userid = sys.argv[2]
useproxies = sys.argv[3]
if useproxies == 'True':
proxy_list = open("proxies.txt").read().splitlines()
def proxyfriend():
try:
proxy = random.choice(proxy_list)
requests.put(apilink, headers=headers,... | [
"random.choice",
"requests.put"
] | [((633, 671), 'requests.put', 'requests.put', (['apilink'], {'headers': 'headers'}), '(apilink, headers=headers)\n', (645, 671), False, 'import requests\n'), ((247, 272), 'random.choice', 'random.choice', (['proxy_list'], {}), '(proxy_list)\n', (260, 272), False, 'import random\n'), ((282, 361), 'requests.put', 'reques... |
# Copyright 2021 by <NAME>, <EMAIL>
# All rights reserved.
# This file is part of the Nessaid CLI Framework, nessaid_cli python package
# and is released under the "MIT License Agreement". Please see the LICENSE
# file included as part of this package.
#
import os
from nessaid_cli.compiler import compile_grammar
from ... | [
"os.path.dirname",
"nessaid_cli.compiler.compile_grammar"
] | [((875, 900), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (890, 900), False, 'import os\n'), ((1004, 1028), 'nessaid_cli.compiler.compile_grammar', 'compile_grammar', (['inp_str'], {}), '(inp_str)\n', (1019, 1028), False, 'from nessaid_cli.compiler import compile_grammar\n')] |
import argparse
import pandas as pd
from collections import Counter
def arguments():
# Handle command line arguments
parser = argparse.ArgumentParser(description='Adventofcode.')
parser.add_argument('-f', '--file', required=True)
args = parser.parse_args()
return args
def main():
args = ar... | [
"pandas.to_numeric",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((136, 188), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Adventofcode."""'}), "(description='Adventofcode.')\n", (159, 188), False, 'import argparse\n'), ((1209, 1254), 'pandas.read_csv', 'pd.read_csv', (['args.file'], {'names': "['raw_strings']"}), "(args.file, names=['raw_strings']... |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='pysoftether',
version='1.0.1',
description='SoftEther VPN Server Python Management API',
author='vandot',
author_email='<EMAIL>',
url='https://github.com/vandot/pysoftether',
packages=['softether'],
)
| [
"distutils.core.setup"
] | [((57, 280), 'distutils.core.setup', 'setup', ([], {'name': '"""pysoftether"""', 'version': '"""1.0.1"""', 'description': '"""SoftEther VPN Server Python Management API"""', 'author': '"""vandot"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/vandot/pysoftether"""', 'packages': "['softether']"}), "(... |
import discord
import asyncio
import yaml
import pandas as pd
import urllib.request, urllib.error
from xml.sax.saxutils import unescape
from bs4 import BeautifulSoup
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as' + client.user.name)
print(client.user.id)
print('------')... | [
"pandas.read_csv",
"bs4.BeautifulSoup",
"yaml.safe_load",
"asyncio.sleep",
"discord.Client",
"xml.sax.saxutils.unescape"
] | [((176, 192), 'discord.Client', 'discord.Client', ([], {}), '()\n', (190, 192), False, 'import discord\n'), ((1009, 1029), 'yaml.safe_load', 'yaml.safe_load', (['file'], {}), '(file)\n', (1023, 1029), False, 'import yaml\n'), ((8807, 8827), 'yaml.safe_load', 'yaml.safe_load', (['file'], {}), '(file)\n', (8821, 8827), F... |
from sqlalchemy import create_engine
import pandas as pd
import pymysql
sqlEngine= create_engine('mysql+pymysql://root:@127.0.0.1/django')
#sqlEngine = create_engine("mysql+pymysql://{userid}:{password}@localhost/{database}".format(userid="root",password="",database="scores"))
dbConnect= sqlEngine.connect()
try:
q... | [
"sqlalchemy.create_engine"
] | [((83, 138), 'sqlalchemy.create_engine', 'create_engine', (['"""mysql+pymysql://root:@127.0.0.1/django"""'], {}), "('mysql+pymysql://root:@127.0.0.1/django')\n", (96, 138), False, 'from sqlalchemy import create_engine\n')] |
import torch
from torchvision import transforms, datasets
data_transform = transforms.Compose([
transforms.RandomSizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.2... | [
"torchvision.transforms.RandomSizedCrop",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor"
] | [((354, 431), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', ([], {'root': '"""hymenoptera_data/train"""', 'transform': 'data_transform'}), "(root='hymenoptera_data/train', transform=data_transform)\n", (374, 431), False, 'from torchvision import transforms, datasets\n'), ((492, 587), 'torch.utils.data.Dat... |
"""
Base classes used to setup testing fixtures
"""
import itertools
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import AnonymousUser, User, Permission
from django.utils.text import slugify
from assessment.builder import models, choices
from assessment.assess impo... | [
"assessment.assess.models.MetricScore.objects.create",
"django.utils.text.slugify",
"django.contrib.auth.models.AnonymousUser",
"itertools.product",
"assessment.assess.models.AssessmentRecord",
"assessment.assess.models.AssessmentGroup.objects.create",
"assessment.builder.models.MetricChoicesType.object... | [((441, 456), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (454, 456), False, 'from django.contrib.auth.models import AnonymousUser, User, Permission\n'), ((3613, 3688), 'assessment.builder.models.MetricChoicesType.objects.create', 'models.MetricChoicesType.objects.create', ([], {'labe... |
""" This module contains auxiliary functions to plot some information on the
RESTUD economy.
"""
# standard library
import matplotlib.pylab as plt
import numpy as np
import shutil
import shlex
import os
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import FuncFormatter
from matplotlib import cm
# Ev... | [
"numpy.tile",
"matplotlib.pylab.savefig",
"matplotlib.pylab.figure",
"shlex.split",
"matplotlib.pylab.legend",
"numpy.exp",
"os.mkdir",
"shutil.rmtree",
"matplotlib.pylab.bar"
] | [((1060, 1072), 'numpy.exp', 'np.exp', (['wage'], {}), '(wage)\n', (1066, 1072), True, 'import numpy as np\n'), ((1772, 1795), 'numpy.tile', 'np.tile', (['np.nan', '(0, 4)'], {}), '(np.nan, (0, 4))\n', (1779, 1795), True, 'import numpy as np\n'), ((3513, 3540), 'matplotlib.pylab.figure', 'plt.figure', ([], {'figsize': ... |
#!/usr/bin/env python3
import os
import re
wd = os.path.dirname(os.path.abspath(__file__))
os.chdir(wd)
names = sorted(name[:-4] for name in os.listdir('.') if '.f90' in name)
sub = None
for name in names:
print(name.upper())
with open('%s.f90' % name) as file:
for line in file:
match ... | [
"os.chdir",
"os.listdir",
"os.path.abspath",
"re.search"
] | [((93, 105), 'os.chdir', 'os.chdir', (['wd'], {}), '(wd)\n', (101, 105), False, 'import os\n'), ((66, 91), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((144, 159), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (154, 159), False, 'import os\n'), ... |
from __future__ import annotations
from typing import Any
from checkov.common.output.report import CheckType
from checkov.common.parsers.json import parse
from checkov.common.parsers.node import DictNode
from checkov.common.runners.object_runner import Runner as ObjectRunner
from checkov.json_doc.base_registry import... | [
"checkov.common.parsers.json.parse"
] | [((749, 757), 'checkov.common.parsers.json.parse', 'parse', (['f'], {}), '(f)\n', (754, 757), False, 'from checkov.common.parsers.json import parse\n')] |
from logging import Logger
from logging import getLogger
from math import atan2
from math import degrees
from math import floor
from math import sqrt
from pytrek.Constants import CONSOLE_HEIGHT
from pytrek.Constants import HALF_QUADRANT_PIXEL_HEIGHT
from pytrek.Constants import HALF_QUADRANT_PIXEL_WIDTH
from pytr... | [
"logging.getLogger",
"pytrek.engine.Intelligence.Intelligence",
"math.floor",
"math.degrees",
"math.sqrt",
"pytrek.model.Coordinates.Coordinates",
"pytrek.engine.ArcadePoint.ArcadePoint",
"math.atan2"
] | [((1074, 1093), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1083, 1093), False, 'from logging import getLogger\n'), ((1137, 1151), 'pytrek.engine.Intelligence.Intelligence', 'Intelligence', ([], {}), '()\n', (1149, 1151), False, 'from pytrek.engine.Intelligence import Intelligence\n'), ((2141... |
from legendre import legendre
import seidel
import matrix
import numpy as np
from math import sqrt, pi, e
def quadrature(k):
if k % 2:
return 0
else:
return 2 / (k + 1)
def integrate(a, b, n, f):
l = legendre(n)
A = np.zeros((n, n))
B = np.zeros((n, 1))
for k in range(n):
... | [
"numpy.zeros",
"matrix.multi",
"matrix.inv",
"legendre.legendre"
] | [((231, 242), 'legendre.legendre', 'legendre', (['n'], {}), '(n)\n', (239, 242), False, 'from legendre import legendre\n'), ((252, 268), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (260, 268), True, 'import numpy as np\n'), ((277, 293), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {}), '((n, 1))\n', (285, 293... |
import gym
from stable_baselines.common.policies import MlpPolicy
from stable_baselines.common import make_vec_env
from stable_baselines import A2C
# Parallel environments
env = make_vec_env('Pendulum-v0', n_envs=4)
model = A2C(MlpPolicy, env, verbose=1)
model.learn(total_timesteps=25000)
obs = env.reset()
while Tr... | [
"stable_baselines.common.make_vec_env",
"stable_baselines.A2C"
] | [((180, 217), 'stable_baselines.common.make_vec_env', 'make_vec_env', (['"""Pendulum-v0"""'], {'n_envs': '(4)'}), "('Pendulum-v0', n_envs=4)\n", (192, 217), False, 'from stable_baselines.common import make_vec_env\n'), ((227, 257), 'stable_baselines.A2C', 'A2C', (['MlpPolicy', 'env'], {'verbose': '(1)'}), '(MlpPolicy, ... |
# Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
# ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"logging.getLogger",
"logging.basicConfig",
"tngsdksm.create_specific_manager",
"tngsdksm.generate_all",
"argparse.ArgumentParser",
"tngsdksm.execute_fsm",
"tngsdksm.execute_ssm"
] | [((1541, 1568), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1558, 1568), False, 'import logging\n'), ((3936, 3994), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""5GTANGO tng-sm tool"""'}), "(description='5GTANGO tng-sm tool')\n", (3959, 3994), False, '... |
# Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from dnnet.ext_mathlibs import cp, np
class LossFunction:
"""Base class for loss functions.
Warning
-------
This class should not be used directly.
Use derived classes instead.
Parameters
----------
ep : float
Used to avoid... | [
"dnnet.ext_mathlibs.np.log",
"dnnet.ext_mathlibs.np.power"
] | [((1486, 1505), 'dnnet.ext_mathlibs.np.log', 'np.log', (['(y + self.ep)'], {}), '(y + self.ep)\n', (1492, 1505), False, 'from dnnet.ext_mathlibs import cp, np\n'), ((1518, 1541), 'dnnet.ext_mathlibs.np.log', 'np.log', (['(1 - y + self.ep)'], {}), '(1 - y + self.ep)\n', (1524, 1541), False, 'from dnnet.ext_mathlibs impo... |
"""
Fetch posts and related stats from Facebook
through the CrowdTangle API
"""
import pandas as pd
import requests
from constants import FB_TITLE_TO_MODE
from facebook.data.api_utils import load_env_vars
# @st.cache
def get_fb_posts(start_date, end_date, mode,
get_from_csv=False, create_csv=False):... | [
"pandas.json_normalize",
"pandas.read_csv",
"requests.get",
"facebook.data.api_utils.load_env_vars",
"pandas.DataFrame"
] | [((609, 628), 'facebook.data.api_utils.load_env_vars', 'load_env_vars', (['mode'], {}), '(mode)\n', (622, 628), False, 'from facebook.data.api_utils import load_env_vars\n'), ((1459, 1473), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1471, 1473), True, 'import pandas as pd\n'), ((1486, 1524), 'requests.get',... |
# Generated by Django 3.0.6 on 2020-05-31 07:35
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Reports', '0002_auto_20200531_1126'),
]
operations = [
migrations.RenameField(
model_name='report',
old_name='Pre_medical_hi... | [
"django.db.migrations.AlterModelTable",
"django.db.migrations.RenameField"
] | [((227, 323), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""report"""', 'old_name': '"""Pre_medical_history"""', 'new_name': '"""cmnt"""'}), "(model_name='report', old_name='Pre_medical_history',\n new_name='cmnt')\n", (249, 323), False, 'from django.db import migrations\n'), ... |
import configparser
import numpy
import sys
import time
import random
import math
import os
from copy import deepcopy
import json
from numpy.linalg import norm
from numpy import dot
import numpy as np
import codecs
from scipy.stats import spearmanr
import tensorflow as tf
import torch
import torch.nn as nn
from torch.... | [
"torch.mul",
"torch.LongTensor",
"numpy.array",
"torch.sum",
"numpy.linalg.norm",
"torch.DoubleTensor",
"numpy.dot",
"numpy.argmin",
"scipy.stats.spearmanr",
"numpy.fromstring",
"numpy.dtype",
"random.randint",
"torch.nn.Embedding",
"numpy.round",
"torch.nn.functional.mse_loss",
"scipy... | [((1087, 1152), 'torch.nn.functional.mse_loss', 'nn.functional.mse_loss', (['input_tensor', 'target_tensor'], {'reduce': '(False)'}), '(input_tensor, target_tensor, reduce=False)\n', (1109, 1152), True, 'import torch.nn as nn\n'), ((20439, 20471), 'random.randint', 'random.randint', (['(0)', '(top_range - 1)'], {}), '(... |
# Copyright 2013-2021 The Salish Sea MEOPAR Contributors
# and The University of British Columbia
# 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... | [
"logging.getLogger",
"nemo_cmd.api.pbs_common",
"nemo_cmd.api.prepare",
"math.ceil",
"pathlib.Path",
"pathlib.Path.cwd",
"nemo_cmd.prepare.get_run_desc_value",
"time.sleep",
"datetime.timedelta",
"nemo_cmd.fspath.fspath",
"nemo_cmd.prepare.get_n_processors",
"nemo_cmd.prepare.load_run_desc"
] | [((1049, 1076), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1066, 1076), False, 'import logging\n'), ((7189, 7225), 'nemo_cmd.api.prepare', 'api.prepare', (['desc_file', 'nocheck_init'], {}), '(desc_file, nocheck_init)\n', (7200, 7225), False, 'from nemo_cmd import api\n'), ((7323, 73... |
from __future__ import annotations
import dataclasses
from pathlib import Path
from textwrap import dedent
from typing import List
from typing import Union
OFFSET = ' ' * 4
@dataclasses.dataclass
class File:
path: Path
def read_content(self) -> str:
return self.path.read_text()
@dataclasses.datac... | [
"textwrap.dedent",
"dataclasses.field"
] | [((393, 432), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (410, 432), False, 'import dataclasses\n'), ((1684, 1703), 'textwrap.dedent', 'dedent', (['description'], {}), '(description)\n', (1690, 1703), False, 'from textwrap import dedent\n')] |
# -*- coding: utf-8 -*-
from functools import partial
from datetime import datetime
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import Screen
from kivy.uix.dropdown import DropDown
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.l... | [
"kivy.uix.relativelayout.RelativeLayout",
"kivy.uix.button.Button",
"kivy.uix.dropdown.DropDown",
"kivy.uix.floatlayout.FloatLayout",
"kivy.uix.boxlayout.BoxLayout",
"npt_events.Event.get_events",
"npt_events.Event.remove_event",
"datetime.datetime.now",
"kivy.uix.label.Label",
"npt_events.Event.g... | [((859, 895), 'npt_events.Event.get_events', 'Event.get_events', (['self.manager.store'], {}), '(self.manager.store)\n', (875, 895), False, 'from npt_events import Event, EVALUATION_POSITIVE, EVALUATION_NEGATIVE, FILTERS, ALL_FILTER\n'), ((1526, 1561), 'kivy.uix.boxlayout.BoxLayout', 'BoxLayout', ([], {'orientation': '... |
from torch.nn.modules.loss import _Loss
import torch
from enum import Enum
from typing import Union
class Mode(Enum):
BINARY = "binary"
MULTICLASS = "multiclass"
MULTILABEL = "multilabel"
class Reduction(Enum):
SUM = "sum"
MEAN = "mean"
NONE = "none"
SAMPLE_SUM = "sample_sum" # mean by s... | [
"torch.tensor"
] | [((1925, 1947), 'torch.tensor', 'torch.tensor', (['[weight]'], {}), '([weight])\n', (1937, 1947), False, 'import torch\n')] |
# -*- coding: utf-8 -*-
"""
Plot sensitivity and false positive rate for output of "core_and_accessory_results.py"
"""
import glob
import pandas as pd
from tqdm import tqdm
import matplotlib.pyplot as plt
tenthousand = glob.glob("cluster_results/core/*.csv")
files_dict = []
kmer_dict = {}
for kmer in tqdm([1,2,4,6,8... | [
"pandas.read_csv",
"tqdm.tqdm",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"glob.glob"
] | [((220, 259), 'glob.glob', 'glob.glob', (['"""cluster_results/core/*.csv"""'], {}), "('cluster_results/core/*.csv')\n", (229, 259), False, 'import glob\n'), ((305, 330), 'tqdm.tqdm', 'tqdm', (['[1, 2, 4, 6, 8, 10]'], {}), '([1, 2, 4, 6, 8, 10])\n', (309, 330), False, 'from tqdm import tqdm\n'), ((2063, 2077), 'matplotl... |
from ctypes import *
from ctypes.wintypes import *
import sys
import time
import codecs
import colorama
import os
import subprocess
colorama.init()
superhotpath = None
superhotprocess = None
if not os.path.isdir(os.path.expanduser('~/.6kk')):
os.mkdir(os.path.expanduser('~/.6kk'))
if os.path.is... | [
"subprocess.Popen",
"psutil.process_iter",
"webbrowser.open",
"time.sleep",
"os.path.isfile",
"colorama.init",
"os.path.expanduser"
] | [((142, 157), 'colorama.init', 'colorama.init', ([], {}), '()\n', (155, 157), False, 'import colorama\n'), ((1174, 1286), 'subprocess.Popen', 'subprocess.Popen', (['superhotpath'], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.DEVNULL', 'stderr': 'subprocess.DEVNULL'}), '(superhotpath, stdin=subprocess.PIPE, stdou... |
from python_framework import Enum, EnumItem
@Enum()
class ContactStatusEnumeration :
NONE = EnumItem()
ACTIVE = EnumItem()
INACTIVE = EnumItem()
ContactStatus = ContactStatusEnumeration()
| [
"python_framework.Enum",
"python_framework.EnumItem"
] | [((46, 52), 'python_framework.Enum', 'Enum', ([], {}), '()\n', (50, 52), False, 'from python_framework import Enum, EnumItem\n'), ((97, 107), 'python_framework.EnumItem', 'EnumItem', ([], {}), '()\n', (105, 107), False, 'from python_framework import Enum, EnumItem\n'), ((121, 131), 'python_framework.EnumItem', 'EnumIte... |
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn')
## Example 1
x = np.linspace(-3,3,100)
obj_fun = np.cos(14.5 * x - 0.3) + x*(x + 0.2) + 1.01
fig, ax = plt.subplots(1,1,figsize=(10,6))
ax.plot(x,obj_fun)
ax.axvline(x = x[np.argmin(obj_fun)],color='r',ls='--')
ax.set_ylabel(r'$f(x)$')
ax.s... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.cos",
"numpy.argmin",
"numpy.meshgrid",
"matplotlib.pyplot.subplots"
] | [((51, 75), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (64, 75), True, 'import matplotlib.pyplot as plt\n'), ((96, 119), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(100)'], {}), '(-3, 3, 100)\n', (107, 119), True, 'import numpy as np\n'), ((183, 218), 'matplotlib.p... |
from flask import (
Blueprint, render_template, redirect, url_for, request, flash, jsonify
)
from flask_jwt_extended import create_access_token, get_jwt_identity, jwt_required
from flask_login import login_user, logout_user
from flask_mail import Message
from extensions import bcrypt
from extensions import db
from... | [
"flask.render_template",
"flask.flash",
"flask_login.login_user",
"flask_login.logout_user",
"extensions.bcrypt.check_password_hash",
"flask_jwt_extended.create_access_token",
"extensions.bcrypt.generate_password_hash",
"flask.request.form.get",
"flask.url_for",
"extensions.db.session.add",
"ext... | [((378, 405), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (387, 405), False, 'from flask import Blueprint, render_template, redirect, url_for, request, flash, jsonify\n'), ((454, 488), 'flask.render_template', 'render_template', (['"""auth/login.html"""'], {}), "('auth/logi... |
# Generated by Django 2.2.4 on 2019-09-30 18:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('scheduler', '0023_auto_20190930_1631'),
]
operations = [
migrations.AlterUniqueTogether(
name='track',
unique_together={('sl... | [
"django.db.migrations.AlterUniqueTogether"
] | [((229, 319), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""track"""', 'unique_together': "{('slug', 'conference')}"}), "(name='track', unique_together={('slug',\n 'conference')})\n", (259, 319), False, 'from django.db import migrations\n')] |
import torch
import os
from typing import List
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
def get_devices(gpu_device_ids: List[int] = None) -> List[torch.device]:
if torch.cuda.is_available(): # if we got some GPUs
if gpu_device_ids is None:
gpu_device_ids = list(range(torch.cuda.device_... | [
"torch.cuda.is_available",
"torch.cuda.device_count",
"torch.device"
] | [((177, 202), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (200, 202), False, 'import torch\n'), ((346, 379), 'torch.device', 'torch.device', (['f"""cuda:{device_id}"""'], {}), "(f'cuda:{device_id}')\n", (358, 379), False, 'import torch\n'), ((551, 570), 'torch.device', 'torch.device', (['"""... |
# -*- coding: utf-8 -*-
import copy
import hashlib
import os
import re
import time
import rstr
from amplify.agent.context import context
from amplify.agent.nginx.config.parser import NginxConfigParser
from amplify.agent.util import subp
from amplify.agent.util.ssl import ssl_analysis
__author__ = "<NAME>"
__copyright... | [
"amplify.agent.nginx.config.parser.NginxConfigParser",
"amplify.agent.context.context.log.error",
"amplify.agent.util.ssl.ssl_analysis",
"copy.copy",
"os.path.isfile",
"time.time",
"amplify.agent.util.subp.call",
"re.sub",
"rstr.xeger",
"amplify.agent.context.context.log.debug",
"amplify.agent.c... | [((1437, 1464), 'amplify.agent.nginx.config.parser.NginxConfigParser', 'NginxConfigParser', (['filename'], {}), '(filename)\n', (1454, 1464), False, 'from amplify.agent.nginx.config.parser import NginxConfigParser\n'), ((1500, 1560), 'amplify.agent.context.context.log.debug', 'context.log.debug', (["('parsing full tree... |
from setuptools import setup, find_packages
import re
# Get the version, following advice from https://stackoverflow.com/a/7071358/851699
VERSIONFILE="artemis/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr =... | [
"setuptools.find_packages",
"re.search"
] | [((267, 300), 're.search', 're.search', (['VSRE', 'verstrline', 're.M'], {}), '(VSRE, verstrline, re.M)\n', (276, 300), False, 'import re\n'), ((978, 993), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (991, 993), False, 'from setuptools import setup, find_packages\n')] |
import falcon
import json
from utils.config import ANNOUNCEMENT_FIELD
from utils.config import LANGUAGE_TAG
from auth.falcon_auth_decorator import PermissionRequired
class Announcements:
auth = {
'exempt_methods': ['GET']
}
def __init__(self, cache_manager):
self.cache_manager = cache_m... | [
"falcon.HTTPBadRequest",
"auth.falcon_auth_decorator.PermissionRequired",
"utils.config.LANGUAGE_TAG.items",
"utils.config.ANNOUNCEMENT_FIELD.keys",
"falcon.HTTPInternalServerError"
] | [((3418, 3450), 'falcon.HTTPInternalServerError', 'falcon.HTTPInternalServerError', ([], {}), '()\n', (3448, 3450), False, 'import falcon\n'), ((2701, 2739), 'auth.falcon_auth_decorator.PermissionRequired', 'PermissionRequired', ([], {'permission_level': '(1)'}), '(permission_level=1)\n', (2719, 2739), False, 'from aut... |
from nlgen.cfg import CFG, PTerminal, PUnion
def test_simple_production_union():
cfg = CFG([
("S", PUnion([
PTerminal("foo"),
PTerminal("bar")
])),
])
expect = [("foo",), ("bar",)]
result = list(cfg.permutation_values("S"))
assert expect == result
def test... | [
"nlgen.cfg.PTerminal"
] | [((353, 369), 'nlgen.cfg.PTerminal', 'PTerminal', (['"""foo"""'], {}), "('foo')\n", (362, 369), False, 'from nlgen.cfg import CFG, PTerminal, PUnion\n'), ((371, 387), 'nlgen.cfg.PTerminal', 'PTerminal', (['"""bar"""'], {}), "('bar')\n", (380, 387), False, 'from nlgen.cfg import CFG, PTerminal, PUnion\n'), ((425, 441), ... |
import numpy as np
import pyFAI
import h5py
import fabio
### This function integrates a 2D image using integrate2D pyfai's function and save the results in a h5file named Results_name of the h5 file containing the image
### 1) It looks on the image on th h5 file
### 2) creates a mask based on the int_max and in... | [
"pyFAI.load",
"numpy.float64",
"numpy.ndim",
"h5py.File",
"fabio.open",
"numpy.shape"
] | [((1771, 1829), 'h5py.File', 'h5py.File', (["(root_data + '/' + 'Results' + '_' + h5file)", '"""a"""'], {}), "(root_data + '/' + 'Results' + '_' + h5file, 'a')\n", (1780, 1829), False, 'import h5py\n'), ((2353, 2374), 'pyFAI.load', 'pyFAI.load', (['poni_file'], {}), '(poni_file)\n', (2363, 2374), False, 'import pyFAI\n... |
import os
os.system("python3 lichess-bot.py -u")
| [
"os.system"
] | [((13, 51), 'os.system', 'os.system', (['"""python3 lichess-bot.py -u"""'], {}), "('python3 lichess-bot.py -u')\n", (22, 51), False, 'import os\n')] |
from sanic.exceptions import SanicException, add_status_code
class CustomException(SanicException):
def __init__(self, message: str, code: int):
super().__init__(message=message, status_code=code)
@add_status_code(401)
class ValidationErrorException(SanicException):
def __init__(self):
messa... | [
"sanic.exceptions.add_status_code"
] | [((214, 234), 'sanic.exceptions.add_status_code', 'add_status_code', (['(401)'], {}), '(401)\n', (229, 234), False, 'from sanic.exceptions import SanicException, add_status_code\n')] |
from flask import Flask, redirect
from flask.ext.cache import Cache
import logging
import os
import requests
app = Flask(__name__)
cache = Cache(app, config={'CACHE_TYPE': 'simple'})
cache_timeout = os.getenv('CACHE_TIMEOUT') or 60
@app.route('/<owner>/<repo>/<version>/<path:path>')
@cache.cached(timeout=cache_timeo... | [
"logging.basicConfig",
"logging.debug",
"os.getenv",
"flask.Flask",
"requests.get",
"flask.redirect",
"flask.ext.cache.Cache"
] | [((116, 131), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'from flask import Flask, redirect\n'), ((140, 183), 'flask.ext.cache.Cache', 'Cache', (['app'], {'config': "{'CACHE_TYPE': 'simple'}"}), "(app, config={'CACHE_TYPE': 'simple'})\n", (145, 183), False, 'from flask.ext.cache impo... |
# -*- coding:utf-8 -*-
import unittest
import nose
import dmr
import os
import numpy as np
from tests.settings import (DMR_DOC_FILEPATH, DMR_VEC_FILEPATH,
K, BETA, SIGMA, L, mk_dmr_dat, count_word_freq)
class DMRTestCase(unittest.TestCase):
NUM_VECS = 10
def setUp(self):
np.random.seed(0)
i... | [
"numpy.random.normal",
"os.path.exists",
"tests.settings.count_word_freq",
"dmr.Vocabulary",
"dmr.Corpus.read",
"tests.settings.mk_dmr_dat",
"numpy.exp",
"numpy.sum",
"numpy.array",
"numpy.random.randint",
"numpy.random.seed",
"nose.main"
] | [((5021, 5051), 'nose.main', 'nose.main', ([], {'argv': "['nose', '-v']"}), "(argv=['nose', '-v'])\n", (5030, 5051), False, 'import nose\n'), ((293, 310), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (307, 310), True, 'import numpy as np\n'), ((482, 515), 'dmr.Corpus.read', 'dmr.Corpus.read', (['DMR_D... |
from dataclasses import dataclass
from decimal import Decimal
from typing import TypedDict
class HitbtcRawTradingFeeModel(TypedDict):
"""Trading fee json model."""
takeLiquidityRate: str
provideLiquidityRate: str
@dataclass(frozen=True)
class HitbtcTradingFeeModel:
"""Trading fee model for certain ... | [
"dataclasses.dataclass"
] | [((231, 253), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (240, 253), False, 'from dataclasses import dataclass\n')] |
from conans import ConanFile, CMake, tools
import json, os
class FakeX11Conan(ConanFile):
name = "fakex11-ue4"
version = "1.0"
license = "Apache-2.0"
url = "https://github.com/adamrehn/ue4-conan-recipes/fakex11-ue4"
description = "fakex11 custom build for Unreal Engine 4"
settings = "os", "comp... | [
"conans.tools.collect_libs",
"conans.CMake",
"libcxx.LibCxx.set_vars"
] | [((1015, 1036), 'libcxx.LibCxx.set_vars', 'LibCxx.set_vars', (['self'], {}), '(self)\n', (1030, 1036), False, 'from libcxx import LibCxx\n'), ((1083, 1094), 'conans.CMake', 'CMake', (['self'], {}), '(self)\n', (1088, 1094), False, 'from conans import ConanFile, CMake, tools\n'), ((1474, 1498), 'conans.tools.collect_lib... |
import logging
import os
import absl.logging
import tensorflow as tf
from networks.classes.centernet.pipeline.Pipeline import CenterNetPipeline
from networks.classes.general_utilities.Logger import Logger
from networks.classes.general_utilities.Params import Params
def main():
# -- TENSORFLOW BASIC CONFIG ---
... | [
"tensorflow.executing_eagerly",
"tensorflow.compat.v1.logging.set_verbosity",
"os.path.join",
"os.getcwd",
"tensorflow.compat.v1.enable_eager_execution",
"networks.classes.general_utilities.Logger.Logger",
"logging.root.removeHandler",
"networks.classes.centernet.pipeline.Pipeline.CenterNetPipeline"
] | [((352, 389), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (387, 389), True, 'import tensorflow as tf\n'), ((507, 569), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logg... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-15 18:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('entity', '0006_entity_relationship_unique'),
]
operations = [
migrations.CreateMode... | [
"django.db.migrations.CreateModel"
] | [((299, 411), 'django.db.migrations.CreateModel', 'migrations.CreateModel', ([], {'name': '"""AllEntityProxy"""', 'fields': '[]', 'options': "{'proxy': True}", 'bases': "('entity.entity',)"}), "(name='AllEntityProxy', fields=[], options={'proxy': \n True}, bases=('entity.entity',))\n", (321, 411), False, 'from djang... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((4107, 4145), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""autoDeleteOnIdle"""'}), "(name='autoDeleteOnIdle')\n", (4120, 4145), False, 'import pulumi\n'), ((4417, 4456), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""defaultMessageTtl"""'}), "(name='defaultMessageTtl')\n", (4430, 4456), False, 'import pul... |
# Copyright 2020, General Electric Company. All rights reserved. See https://github.com/xcist/code/blob/master/LICENSE
import numpy as np
from catsim.GetMu import GetMu
Mu = []
Mu.append(GetMu('water', 70))
Mu.append(GetMu('water', 70.0))
Mu.append(GetMu('bone', (30, 50, 70)))
Mu.append(GetMu('bone', [30, 50, 70]))
... | [
"numpy.array",
"catsim.GetMu.GetMu"
] | [((519, 574), 'numpy.array', 'np.array', (['[(20, 30, 40), (50, 60, 70)]'], {'dtype': 'np.single'}), '([(20, 30, 40), (50, 60, 70)], dtype=np.single)\n', (527, 574), True, 'import numpy as np\n'), ((580, 600), 'catsim.GetMu.GetMu', 'GetMu', (['"""water"""', 'Evec'], {}), "('water', Evec)\n", (585, 600), False, 'from ca... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 10:30:25 2018
Try to predict in which lab an animal was trained based on its behavior
@author: guido
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
from os.path import join
import seaborn as s... | [
"numpy.unique",
"os.path.join",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.linear_model.LogisticRegression",
"numpy.append",
"numpy.array",
"pandas.concat",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"sklearn.naive_bayes.GaussianNB",
"sklearn.model_selection.KFold",
"numpy.... | [((1951, 2144), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['mouse', 'lab', 'time_zone', 'learned', 'date_learned', 'training_time',\n 'perf_easy', 'n_trials', 'threshold', 'bias', 'reaction_time',\n 'lapse_low', 'lapse_high']"}), "(columns=['mouse', 'lab', 'time_zone', 'learned',\n 'date_learned', ... |
import random
def rand_bytes(n: int) -> bytes:
return bytes(random.getrandbits(8) for _ in range(n)) | [
"random.getrandbits"
] | [((65, 86), 'random.getrandbits', 'random.getrandbits', (['(8)'], {}), '(8)\n', (83, 86), False, 'import random\n')] |
import argparse
import numpy as np
from pyimzml.ImzMLWriter import ImzMLWriter
from pyImagingMSpec.inMemoryIMS import inMemoryIMS
from scipy.optimize import least_squares
from pyimzml.ImzMLParser import ImzMLParser
from pyimzml.ImzMLWriter import ImzMLWriter
from scipy.signal import medfilt2d
import logging
def fit_fu... | [
"numpy.polyfit",
"pyimzml.ImzMLWriter.ImzMLWriter",
"numpy.poly1d",
"numpy.random.RandomState",
"numpy.arange",
"scipy.optimize.least_squares",
"argparse.ArgumentParser",
"numpy.searchsorted",
"numpy.asarray",
"numpy.max",
"numpy.polyval",
"numpy.min",
"numpy.abs",
"scipy.signal.medfilt2d"... | [((337, 353), 'numpy.polyval', 'np.polyval', (['x', 't'], {}), '(x, t)\n', (347, 353), True, 'import numpy as np\n'), ((544, 557), 'numpy.asarray', 'np.asarray', (['v'], {}), '(v)\n', (554, 557), True, 'import numpy as np\n'), ((567, 588), 'numpy.searchsorted', 'np.searchsorted', (['v', 't'], {}), '(v, t)\n', (582, 588... |
from django.urls import path
from .views import *
app_name = "default"
urlpatterns = [
path('', home, name='home'),
path('active_cities/names/', ActiveCityNames.as_view(), name='active_city_names'),
path('active_cities/zip_codes/', ActiveCityZipCodes.as_view(), name='active_city_zip_codes'),
]
| [
"django.urls.path"
] | [((92, 119), 'django.urls.path', 'path', (['""""""', 'home'], {'name': '"""home"""'}), "('', home, name='home')\n", (96, 119), False, 'from django.urls import path\n')] |
import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.renderers.default = "browser"
# Load the final database and the ozone train/dev/test splits
db = pd.read_csv(
'01_Data/01_Carbon_emissions/AirNow/World_all_locations_2020_avg_clean.csv',
dtype={
'Unique_ID': str, 'Location_typ... | [
"pandas.read_csv",
"plotly.express.scatter_geo"
] | [((175, 455), 'pandas.read_csv', 'pd.read_csv', (['"""01_Data/01_Carbon_emissions/AirNow/World_all_locations_2020_avg_clean.csv"""'], {'dtype': "{'Unique_ID': str, 'Location_type': str, 'Zipcode': str, 'County': str,\n 'type': str, 'measurement': str, 'value': float, 'lat': float, 'lon':\n float, 'AQI_level': str... |
import hashlib
import os
import xml.etree.cElementTree as ET
import time
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
BLOCKSIZE = 65536
def fn_hash(input_path):
hasher = hashlib.sha1()
with open(str(input_path), "rb") as file:
buf = file.read(BLOCKSIZE)
... | [
"xml.etree.cElementTree.ElementTree",
"os.path.join",
"time.sleep",
"os.path.split",
"watchdog.observers.Observer",
"hashlib.sha1"
] | [((224, 238), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (236, 238), False, 'import hashlib\n'), ((1919, 1929), 'watchdog.observers.Observer', 'Observer', ([], {}), '()\n', (1927, 1929), False, 'from watchdog.observers import Observer\n'), ((495, 530), 'xml.etree.cElementTree.ElementTree', 'ET.ElementTree', ([],... |
from __future__ import print_function
import os.path
import sys
import json
from collections import OrderedDict
from itertools import chain
from dmcontent import ContentLoader, utils
_base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def _get_questions_by_type(framework_slug, doc_type, questi... | [
"collections.OrderedDict",
"dmcontent.utils.get_option_value",
"json.load",
"dmcontent.ContentLoader",
"json.dump"
] | [((401, 425), 'dmcontent.ContentLoader', 'ContentLoader', (['_base_dir'], {}), '(_base_dir)\n', (414, 425), False, 'from dmcontent import ContentLoader, utils\n'), ((1493, 1506), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1504, 1506), False, 'from collections import OrderedDict\n'), ((4648, 4718), 'js... |
import json
import numpy as np
class thing:
def __init__(self):
self.reuslt_id = list()
@staticmethod
def save2json(file, filename):
with open(filename, 'a') as json_file:
json.dump(file, json_file)
@staticmethod
def loadjson(filename):
with open(filename) as... | [
"json.load",
"json.dump"
] | [((216, 242), 'json.dump', 'json.dump', (['file', 'json_file'], {}), '(file, json_file)\n', (225, 242), False, 'import json\n'), ((353, 373), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (362, 373), False, 'import json\n')] |
import os
import numpy as np
import pydub as pd
from abc import ABC, abstractmethod
class Messenger(ABC):
""" Abstract methods """
def __init__(self, files_path=None):
if files_path is None:
self.message_left, self.message_right = np.array([]), np.array([])
else:
self.... | [
"numpy.array",
"os.listdir",
"numpy.concatenate"
] | [((3270, 3292), 'os.listdir', 'os.listdir', (['files_path'], {}), '(files_path)\n', (3280, 3292), False, 'import os\n'), ((4319, 4343), 'numpy.concatenate', 'np.concatenate', (['messages'], {}), '(messages)\n', (4333, 4343), True, 'import numpy as np\n'), ((262, 274), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', ... |
# Player.py
# Class definition for 'Player'
import json
import signal
from random import random, randint
from game.Command import Command
from game.Coordinate import Coordinate
from game.params import INITIAL_RESOURCES
# ------------------------------------------------------------------------------
# P... | [
"game.Command.Command.from_dict",
"signal.signal",
"game.Coordinate.Coordinate",
"signal.alarm"
] | [((3800, 3850), 'signal.signal', 'signal.signal', (['signal.SIGALRM', 'self.handle_timeout'], {}), '(signal.SIGALRM, self.handle_timeout)\n', (3813, 3850), False, 'import signal\n'), ((3860, 3886), 'signal.alarm', 'signal.alarm', (['self.seconds'], {}), '(self.seconds)\n', (3872, 3886), False, 'import signal\n'), ((394... |
import logging
from config import Config
import os
import datetime
from logging.handlers import TimedRotatingFileHandler, RotatingFileHandler
def get_file_logger_handler(log_path: str) -> logging.Handler:
cfg = Config()
if cfg.LOG_ROTATION_MODE == 'days':
handler = TimedRotatingFileHandler(log_path,
... | [
"logging.StreamHandler",
"logging.Formatter",
"config.Config",
"logging.handlers.RotatingFileHandler",
"datetime.datetime.now",
"logging.handlers.TimedRotatingFileHandler"
] | [((217, 225), 'config.Config', 'Config', ([], {}), '()\n', (223, 225), False, 'from config import Config\n'), ((284, 401), 'logging.handlers.TimedRotatingFileHandler', 'TimedRotatingFileHandler', (['log_path'], {'when': '"""d"""', 'interval': 'cfg.LOG_ROTATION_DAYS', 'backupCount': 'cfg.LOG_ROTATION_BACKUP'}), "(log_pa... |
from flask import Flask, render_template, request
from recommender import Recommender
from recommender_with_spark import sparkRecommender
from extract_infos import omdb_extract, postgres_extract
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route("/recommendatio... | [
"flask.render_template",
"recommender_with_spark.sparkRecommender",
"flask.Flask",
"extract_infos.omdb_extract",
"recommender.Recommender"
] | [((204, 219), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (209, 219), False, 'from flask import Flask, render_template, request\n'), ((262, 291), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (277, 291), False, 'from flask import Flask, render_template, requ... |
"""
Settings
"""
from importlib import import_module
import six
import json
from collections import MutableMapping
from . import default_settings
TORNADO_APP_SETTINGS_PREFIX = "TORNADO_APP_SETTINGS_"
TORNADO_SERVER_SETTINGS_PREFIX = "TORNADO_SERVER_SETTINGS_"
class Settings(MutableMapping):
def __init__(self, ... | [
"json.loads",
"six.iteritems",
"importlib.import_module"
] | [((4370, 4387), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (4380, 4387), False, 'import json\n'), ((5004, 5039), 'importlib.import_module', 'import_module', (['settings_module_path'], {}), '(settings_module_path)\n', (5017, 5039), False, 'from importlib import import_module\n'), ((5286, 5304), 'json.load... |
# 2021.03.20
# @yifan
#
import numpy as np
from skimage.util import view_as_windows
from scipy.fftpack import dct, idct
def Shrink(X, win):
X = view_as_windows(X, (1,win,win,1), (1,win,win,1))
return X.reshape(X.shape[0], X.shape[1], X.shape[2], -1)
def invShrink(X, win):
S = X.shape
X = X.reshape(S[0... | [
"numpy.sqrt",
"numpy.ones",
"numpy.unique",
"numpy.argmax",
"scipy.fftpack.idct",
"numpy.min",
"numpy.argsort",
"numpy.zeros",
"scipy.fftpack.dct",
"numpy.matmul",
"numpy.concatenate",
"numpy.linalg.lstsq",
"numpy.moveaxis",
"skimage.util.view_as_windows"
] | [((149, 203), 'skimage.util.view_as_windows', 'view_as_windows', (['X', '(1, win, win, 1)', '(1, win, win, 1)'], {}), '(X, (1, win, win, 1), (1, win, win, 1))\n', (164, 203), False, 'from skimage.util import view_as_windows\n'), ((363, 383), 'numpy.moveaxis', 'np.moveaxis', (['X', '(5)', '(2)'], {}), '(X, 5, 2)\n', (37... |
import argparse
import os
from tqdm import tqdm
from datasets import kss_wav, public_korean_wav, selvas_wav, check_file_integrity, generate_mel_f0, f0_mean
from multiprocessing import cpu_count
from hparams import create_hparams
import torch
# TODO: lang code is written in this procedure. Langcode==1 for korean-only c... | [
"datasets.f0_mean.build_from_path",
"datasets.kss_wav.build_from_path",
"argparse.ArgumentParser",
"datasets.check_file_integrity.check_paths",
"os.path.join",
"multiprocessing.cpu_count",
"hparams.create_hparams",
"datasets.public_korean_wav.build_from_path",
"torch.cuda.is_available",
"datasets.... | [((807, 842), 'os.path.join', 'os.path.join', (['meta_dir', 'target_file'], {}), '(meta_dir, target_file)\n', (819, 842), False, 'import os\n'), ((3171, 3258), 'datasets.check_file_integrity.check_paths', 'check_file_integrity.check_paths', (['lists', 'args.meta_dir', 'args.num_workers'], {'tqdm': 'tqdm'}), '(lists, ar... |
__author__ = 'Shane'
from ClassToPass import ClassToPass
class ImportantClass:
def __init__(self):
pass
def doTheThing(self, number1=int(), number2=int(), classToPass=ClassToPass()) -> int:
print("TheThing")
added = classToPass.gimmeTheSum(number1, number2)
return added
... | [
"ClassToPass.ClassToPass"
] | [((187, 200), 'ClassToPass.ClassToPass', 'ClassToPass', ([], {}), '()\n', (198, 200), False, 'from ClassToPass import ClassToPass\n'), ((353, 366), 'ClassToPass.ClassToPass', 'ClassToPass', ([], {}), '()\n', (364, 366), False, 'from ClassToPass import ClassToPass\n'), ((622, 635), 'ClassToPass.ClassToPass', 'ClassToPas... |
from collections import defaultdict
from typing import Optional, List, Dict, Iterable, Tuple, Generator
from jellycc.parser.grammar import SymbolTerminal
from jellycc.parser.ll.lhtable import LHTable, LHState, Transition, MegaAction, SkipNode
from jellycc.utils.scc import topological_sort
def state_to_edges(state: L... | [
"jellycc.utils.scc.topological_sort"
] | [((896, 947), 'jellycc.utils.scc.topological_sort', 'topological_sort', (['self.table.states', 'state_to_edges'], {}), '(self.table.states, state_to_edges)\n', (912, 947), False, 'from jellycc.utils.scc import topological_sort\n')] |
# imports the libraries needed for game to function
import pygame
import random
import sys
import math
import time
import os
import csv
# imports all other classes
from Gigabyte import Gigabyte
from Button import Button
from DataSprite import DataSprite
'''
Main class that has the main functionality of... | [
"pygame.init",
"pygame.quit",
"pygame.font.quit",
"time.sleep",
"sys.exit",
"pygame.transform.scale",
"pygame.display.set_mode",
"pygame.mouse.get_pos",
"pygame.font.init",
"pygame.image.load",
"pygame.display.update",
"csv.reader",
"Button.Button",
"DataSprite.DataSprite",
"time.time",
... | [((593, 606), 'pygame.init', 'pygame.init', ([], {}), '()\n', (604, 606), False, 'import pygame\n'), ((610, 628), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (626, 628), False, 'import pygame\n'), ((632, 659), 'pygame.key.set_repeat', 'pygame.key.set_repeat', (['(1)', '(1)'], {}), '(1, 1)\n', (653, 659), ... |
import numpy as np
import utils
test_np = np.ndarray(shape=(100, 256, 256, 1))
train_np = np.ndarray(shape=(800, 256, 256, 1))
valid_np = np.ndarray(shape=(100, 256, 256, 1))
train_np_gt = np.ndarray(shape=(800, 64, 64, 2))
valid_np_gt = np.ndarray(shape=(100, 64, 64, 2))
train_np_real = np.ndarray(shape=(800, 256,... | [
"utils.cvt2Lab",
"utils.read_image",
"numpy.ndarray",
"numpy.save"
] | [((43, 79), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(100, 256, 256, 1)'}), '(shape=(100, 256, 256, 1))\n', (53, 79), True, 'import numpy as np\n'), ((92, 128), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(800, 256, 256, 1)'}), '(shape=(800, 256, 256, 1))\n', (102, 128), True, 'import numpy as np\n'), ((140, 1... |
# -*- coding: utf-8 -*-
from baseScreen import BaseScreen
from .mainScreen import MainScreen
from ..graphic_utils import ListView
class QueueScreen(BaseScreen):
def __init__(self, size, base_size, manager, fonts):
BaseScreen.__init__(self, size, base_size, manager, fonts)
self.size = size
... | [
"baseScreen.BaseScreen.__init__"
] | [((229, 287), 'baseScreen.BaseScreen.__init__', 'BaseScreen.__init__', (['self', 'size', 'base_size', 'manager', 'fonts'], {}), '(self, size, base_size, manager, fonts)\n', (248, 287), False, 'from baseScreen import BaseScreen\n')] |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return "<h1>hello flask</h1>"
@app.route('/home', methods=['GET', 'POST'])
def index2():
url_str = 'www.baidu.com'
# 格式:模板中使用的名字=值
return render_template('index.html', url_str=url_str)
@app.route('/list', meth... | [
"flask.render_template",
"flask.Flask"
] | [((47, 62), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (52, 62), False, 'from flask import Flask, render_template\n'), ((248, 294), 'flask.render_template', 'render_template', (['"""index.html"""'], {'url_str': 'url_str'}), "('index.html', url_str=url_str)\n", (263, 294), False, 'from flask import Flas... |
from typing import Optional
from pydantic.networks import EmailStr
from datetime import datetime
from pydantic.types import UUID4
from sqlmodel import SQLModel, Field
from sqlalchemy import Enum
from sqlmodel.main import Relationship
from models.commom import CreatedAtModel, IDModel, Pagination, UpdateAtModel
from mo... | [
"sqlmodel.main.Relationship",
"sqlmodel.Field"
] | [((529, 594), 'sqlmodel.Field', 'Field', (['...'], {'max_length': '(256)', 'description': '"""User name"""', 'alias': '"""name"""'}), "(..., max_length=256, description='User name', alias='name')\n", (534, 594), False, 'from sqlmodel import SQLModel, Field\n'), ((639, 685), 'sqlmodel.Field', 'Field', ([], {'alias': '""... |
import numpy as np
def get_ranks(array):
args_tmp = np.argsort(array)
args = np.empty_like(args_tmp)
args[args_tmp] = np.arange(len(args))
return args
| [
"numpy.argsort",
"numpy.empty_like"
] | [((58, 75), 'numpy.argsort', 'np.argsort', (['array'], {}), '(array)\n', (68, 75), True, 'import numpy as np\n'), ((87, 110), 'numpy.empty_like', 'np.empty_like', (['args_tmp'], {}), '(args_tmp)\n', (100, 110), True, 'import numpy as np\n')] |
from importlib import import_module
from py2swagger.plugins import Py2SwaggerPlugin, Py2SwaggerPluginException
from py2swagger.introspector import BaseDocstringIntrospector
from py2swagger.utils import OrderedDict
class FalconMethodIntrospector(BaseDocstringIntrospector):
def get_operation(self):
"""
... | [
"importlib.import_module"
] | [((1493, 1519), 'importlib.import_module', 'import_module', (['module_name'], {}), '(module_name)\n', (1506, 1519), False, 'from importlib import import_module\n')] |
"""
A module used to work
with animations
"""
import abc
from enum import Enum
import json
from typing import Optional, List, Union
import pandas as pd
from pandas.api.types import is_numeric_dtype
from ipyvizzu.json import RawJavaScript, RawJavaScriptEncoder
from ipyvizzu.schema import DataSchema
class Animation:... | [
"ipyvizzu.schema.DataSchema.validate",
"pandas.api.types.is_numeric_dtype",
"ipyvizzu.json.RawJavaScript",
"json.load",
"pandas.DataFrame"
] | [((5942, 5967), 'ipyvizzu.schema.DataSchema.validate', 'DataSchema.validate', (['self'], {}), '(self)\n', (5961, 5967), False, 'from ipyvizzu.schema import DataSchema\n'), ((1667, 1723), 'ipyvizzu.json.RawJavaScript', 'RawJavaScript', (['f"""record => {{ return ({filter_expr}) }}"""'], {}), "(f'record => {{ return ({fi... |
"""
XeroExtractConnector(): Connection between Xero and Database
"""
import logging
import sqlite3
import time
from os import path
from typing import List
import copy
import pandas as pd
class XeroExtractConnector:
"""
- Extract Data from Xero and load to Database
"""
def __init__(self, xero, dbconn)... | [
"logging.getLogger",
"os.path.join",
"time.sleep",
"os.path.dirname",
"copy.deepcopy",
"pandas.DataFrame"
] | [((450, 492), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (467, 492), False, 'import logging\n'), ((592, 614), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (604, 614), False, 'from os import path\n'), ((633, 671), 'os.path.join', ... |
#!/usr/bin/env python
__author__ = '<NAME>'
from pyon.core.exception import NotFound, BadRequest
from pyon.datastore.datastore_common import DatastoreFactory, DataStore
from pyon.ion.identifier import create_unique_resource_id, create_unique_association_id
from pyon.util.containers import get_ion_ts, get_default_sysn... | [
"pyon.ion.identifier.create_unique_resource_id",
"pyon.util.containers.get_default_sysname",
"pyon.util.containers.get_safe",
"pyon.datastore.datastore_common.DatastoreFactory.get_datastore",
"pyon.util.containers.get_ion_ts",
"pyon.ion.identifier.create_unique_association_id",
"pyon.core.exception.BadR... | [((701, 881), 'pyon.datastore.datastore_common.DatastoreFactory.get_datastore', 'DatastoreFactory.get_datastore', ([], {'datastore_name': 'self.datastore_name', 'config': 'config', 'scope': 'sysname', 'profile': 'DataStore.DS_PROFILE.RESOURCES', 'variant': 'DatastoreFactory.DS_BASE'}), '(datastore_name=self.datastore_n... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import re
from typing import List
from assertpy.assertpy import assert_that
from lisa.executable import Tool
from lisa.util import LisaException, get_matched_str
class PartitionInfo(object):
# TODO: Merge with lsblk.PartitionInfo
def ... | [
"lisa.util.LisaException",
"assertpy.assertpy.assert_that",
"lisa.util.get_matched_str",
"re.compile"
] | [((814, 849), 're.compile', 're.compile', (['"""\\\\s*(?P<name>\\\\S+):.*"""'], {}), "('\\\\s*(?P<name>\\\\S+):.*')\n", (824, 849), False, 'import re\n'), ((991, 1034), 're.compile', 're.compile', (['"""\\\\s+UUID=\\\\"(?P<uuid>\\\\S+)\\\\\\""""'], {}), '(\'\\\\s+UUID=\\\\"(?P<uuid>\\\\S+)\\\\"\')\n', (1001, 1034), Fal... |
# Copyright (c) 2021 <NAME>, <NAME>.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import glob
import os
import re
import shlex
import sys
from distutils.errors imp... | [
"shlex.split",
"distutils.errors.DistutilsOptionError",
"glob.glob",
"re.compile"
] | [((1396, 1495), 're.compile', 're.compile', (['"""^(?P<provider>^[^\\\\d\\\\W]\\\\w*):(?P<provider_arg>\\\\S*)\\\\s+(?P<antlr_args>.*)$"""'], {}), "(\n '^(?P<provider>^[^\\\\d\\\\W]\\\\w*):(?P<provider_arg>\\\\S*)\\\\s+(?P<antlr_args>.*)$'\n )\n", (1406, 1495), False, 'import re\n'), ((1287, 1382), 'distutils.err... |
__author__ = '<NAME> <<EMAIL>>'
import unittest
import prxgt.const as const
from prxgt.repo.generator import Generator
class Test(unittest.TestCase):
def test_init(self):
# tests
gene = Generator()
self.assertIsNotNone(gene)
return
def test_get_value(self):
# tests si... | [
"unittest.main",
"prxgt.repo.generator.Generator"
] | [((1482, 1497), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1495, 1497), False, 'import unittest\n'), ((209, 220), 'prxgt.repo.generator.Generator', 'Generator', ([], {}), '()\n', (218, 220), False, 'from prxgt.repo.generator import Generator\n'), ((352, 363), 'prxgt.repo.generator.Generator', 'Generator', ([]... |
"""Tests for NoiseTable."""
import numpy as np
from src.utils.noise_table import NoiseTable
def test_mirrored_sample():
table = NoiseTable(size=1000)
rng = np.random.default_rng()
vec = table.sample_index_vec(rng, 100, None)
noise = table.get_vec(vec)
vec.mirror = True
mirrored_noise = table.... | [
"src.utils.noise_table.NoiseTable",
"numpy.random.default_rng"
] | [((135, 156), 'src.utils.noise_table.NoiseTable', 'NoiseTable', ([], {'size': '(1000)'}), '(size=1000)\n', (145, 156), False, 'from src.utils.noise_table import NoiseTable\n'), ((167, 190), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (188, 190), True, 'import numpy as np\n')] |
from marshmallow import fields, validate
from flask_blog import ma
from flask_blog.blog.models import Post
class PostDetailSerializer(ma.SQLAlchemySchema):
'''Schema for Post detail serialization'''
class Meta:
model = Post
fields = ('id', 'title', 'content', 'created_on',
... | [
"marshmallow.validate.Length",
"marshmallow.fields.Str"
] | [((614, 639), 'marshmallow.fields.Str', 'fields.Str', ([], {'required': '(True)'}), '(required=True)\n', (624, 639), False, 'from marshmallow import fields, validate\n'), ((904, 930), 'marshmallow.fields.Str', 'fields.Str', ([], {'required': '(False)'}), '(required=False)\n', (914, 930), False, 'from marshmallow import... |
# coding: utf-8
"""
TileDB Storage Platform API
TileDB Storage Platform REST API # noqa: E501
The version of the OpenAPI document: 2.2.19
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from tiledb.cloud.rest_api.configuration import Configuratio... | [
"six.iteritems",
"tiledb.cloud.rest_api.configuration.Configuration"
] | [((4493, 4526), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (4506, 4526), False, 'import six\n'), ((1331, 1346), 'tiledb.cloud.rest_api.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1344, 1346), False, 'from tiledb.cloud.rest_api.configuration import Con... |
from django.urls import path
from api.accounts.views import UserViewSet, GroupViewSet
urlpatterns = [
path("users/", UserViewSet.as_view({"get": "list"})),
path("groups/", GroupViewSet.as_view({"get": "list"})),
]
| [
"api.accounts.views.GroupViewSet.as_view",
"api.accounts.views.UserViewSet.as_view"
] | [((122, 158), 'api.accounts.views.UserViewSet.as_view', 'UserViewSet.as_view', (["{'get': 'list'}"], {}), "({'get': 'list'})\n", (141, 158), False, 'from api.accounts.views import UserViewSet, GroupViewSet\n'), ((181, 218), 'api.accounts.views.GroupViewSet.as_view', 'GroupViewSet.as_view', (["{'get': 'list'}"], {}), "(... |
from django.urls import path
from rest_framework.routers import SimpleRouter
from .views import CategoryViewSet, ProductViewSet, all_products_list
router = SimpleRouter()
router.register(r'categories', CategoryViewSet, basename='category')
router.register(r'products', ProductViewSet, basename='product')
urlpattern... | [
"rest_framework.routers.SimpleRouter",
"django.urls.path"
] | [((158, 172), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (170, 172), False, 'from rest_framework.routers import SimpleRouter\n'), ((330, 402), 'django.urls.path', 'path', (['"""paginated-products/"""', 'all_products_list'], {'name': '"""all-products-list"""'}), "('paginated-products/', all... |
import boto3
import botocore
def download_data_from_s3(bucket_name, key, dst):
try:
s3 = boto3.resource('s3')
s3.Bucket(bucket_name).download_file(key, dst)
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] == "404":
print("The object does not exis... | [
"boto3.resource"
] | [((103, 123), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (117, 123), False, 'import boto3\n'), ((436, 456), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (450, 456), False, 'import boto3\n')] |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | [
"rogerthat.rpc.users.User",
"logging.debug",
"rogerthat.dal.profile.get_user_profile",
"rogerthat.dal.parent_key",
"google.appengine.ext.deferred.defer",
"rogerthat.utils.service.add_slash_default",
"rogerthat.utils.transactions.run_in_transaction",
"rogerthat.bizz.communities.communities.get_communit... | [((1834, 1860), 'rogerthat.dal.profile.get_user_profile', 'get_user_profile', (['app_user'], {}), '(app_user)\n', (1850, 1860), False, 'from rogerthat.dal.profile import get_user_profile\n'), ((1877, 1917), 'rogerthat.bizz.communities.communities.get_community', 'get_community', (['user_profile.community_id'], {}), '(u... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((2553, 2587), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""assessmentId"""'}), "(name='assessmentId')\n", (2566, 2587), False, 'import pulumi\n'), ((2703, 2753), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""assessmentReportsDestination"""'}), "(name='assessmentReportsDestination')\n", (2716, 2753), Fals... |
"""
Parse data obtained from analyzing the video into video count segments and write the results into an xlsx file.
"""
from enum import Enum
import util
class AnalyseData:
def __init__(self, timePerFrame, jumpEventSubscriber, segmenter, ratioRef, ratioErode):
"""
Beware, the analyse data / segme... | [
"logging.getLogger",
"util.median"
] | [((5014, 5044), 'logging.getLogger', 'logging.getLogger', (['"""[MV-test]"""'], {}), "('[MV-test]')\n", (5031, 5044), False, 'import logging\n'), ((1124, 1143), 'util.median', 'util.median', (['ratios'], {}), '(ratios)\n', (1135, 1143), False, 'import util\n')] |
from svtransform.models import HyperMartType, HypermartGeoInfo
# for logger
import logging
logger = logging.getLogger(__name__) # __file__ # logger.debug('debug msg')
class EdiFilter:
__g_oHttpRequest = None
__g_dictBranchInfo = {}
__g_dictSalesChInfo = None
__g_dictFilter = {'s_sales_ch_mode': Non... | [
"logging.getLogger",
"svtransform.models.HyperMartType.get_dict_by_idx",
"svtransform.models.HypermartGeoInfo.objects.all"
] | [((102, 129), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (119, 129), False, 'import logging\n'), ((824, 855), 'svtransform.models.HyperMartType.get_dict_by_idx', 'HyperMartType.get_dict_by_idx', ([], {}), '()\n', (853, 855), False, 'from svtransform.models import HyperMartType, Hyperm... |
from store.api.handlers.base import BaseView
from http import HTTPStatus
from typing import Generator
from datetime import datetime
from aiohttp.web_response import Response
from aiohttp.web_exceptions import HTTPNotFound
from aiohttp_apispec import docs, request_schema, response_schema
from sqlalchemy import and_, or... | [
"sqlalchemy.or_",
"sqlalchemy.and_"
] | [((1391, 1607), 'sqlalchemy.and_', 'and_', (["(working_hours['time_start'] > delivery_hours_table.c.time_start)", "(working_hours['time_finish'] > delivery_hours_table.c.time_finish)", "(delivery_hours_table.c.time_finish - working_hours['time_start'] > 0)"], {}), "(working_hours['time_start'] > delivery_hours_table.c.... |
from spice4mertis.core.director import run
from spice4mertis.core.output import output
import spice4mertis.utils.sensor as sensor
import spiceypy
def test_sensor_definition(mk):
spiceypy.furnsh(mk)
sensor.definition('MPO_MERTIS_TIS_SPACE')
def runSPICE4MERTIS(mk):
print('CCD Center:')
run(mk, time_st... | [
"spiceypy.furnsh",
"spice4mertis.core.output.output",
"spice4mertis.utils.sensor.definition",
"spice4mertis.core.director.run"
] | [((183, 202), 'spiceypy.furnsh', 'spiceypy.furnsh', (['mk'], {}), '(mk)\n', (198, 202), False, 'import spiceypy\n'), ((207, 248), 'spice4mertis.utils.sensor.definition', 'sensor.definition', (['"""MPO_MERTIS_TIS_SPACE"""'], {}), "('MPO_MERTIS_TIS_SPACE')\n", (224, 248), True, 'import spice4mertis.utils.sensor as sensor... |