code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
from os.path import join
import cv2
import pickle
import torch
import numpy as np
import pandas as pd
import torch.utils.data as data
class InteriorNet(data.Dataset):
def __init__(self, root_dir, label_name='_raycastingV2',
pred_dir='pred', method_name='sharpnet_pred',
... | [
"numpy.load",
"torch.utils.data.DataLoader",
"numpy.ascontiguousarray",
"os.path.exists",
"cv2.imread",
"pickle.load",
"os.path.join",
"sys.exit"
] | [((3710, 3758), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': '(4)', 'shuffle': '(False)'}), '(dataset, batch_size=4, shuffle=False)\n', (3720, 3758), False, 'from torch.utils.data import DataLoader\n'), ((3400, 3419), 'numpy.load', 'np.load', (['label_path'], {}), '(label_path)\n', (3407, 3... |
#!/usr/bin/env python3
from pathlib import Path
import requests
from bs4 import BeautifulSoup
page = requests.get(
"https://animalcrossing.fandom.com/wiki/K.K._Slider_song_list_(New_Horizons)"
)
tree = BeautifulSoup(page.content, "lxml")
with open(Path("src") / "turbot" / "assets" / "songs.csv", "w", newline="... | [
"bs4.BeautifulSoup",
"pathlib.Path",
"requests.get"
] | [((104, 205), 'requests.get', 'requests.get', (['"""https://animalcrossing.fandom.com/wiki/K.K._Slider_song_list_(New_Horizons)"""'], {}), "(\n 'https://animalcrossing.fandom.com/wiki/K.K._Slider_song_list_(New_Horizons)'\n )\n", (116, 205), False, 'import requests\n'), ((209, 244), 'bs4.BeautifulSoup', 'Beautifu... |
import filecmp
import shutil
import os
import unittest
import cluster_vcf_records
from minos import vcf_chunker
this_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(this_dir, "data", "vcf_chunker")
class TestVcfChunker(unittest.TestCase):
def test_total_variants_and_alleles_in_vcf_dict... | [
"os.path.abspath",
"os.unlink",
"minos.vcf_chunker.VcfChunker",
"cluster_vcf_records.vcf_record.VcfRecord",
"os.path.exists",
"minos.vcf_chunker.VcfChunker._total_variants_and_alleles_in_vcf_dict",
"minos.vcf_chunker.VcfChunker._chunk_end_indexes_from_vcf_record_list",
"shutil.rmtree",
"filecmp.cmp"... | [((180, 225), 'os.path.join', 'os.path.join', (['this_dir', '"""data"""', '"""vcf_chunker"""'], {}), "(this_dir, 'data', 'vcf_chunker')\n", (192, 225), False, 'import os\n'), ((142, 167), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (157, 167), False, 'import os\n'), ((773, 846), 'minos.vcf... |
#!/usr/bin/env python
"""
A light wrapper for Cybersource SOAP Toolkit API
"""
import os
import sys
from setuptools import setup, find_packages
import pycybersource
# fix permissions for sdist
if 'sdist' in sys.argv:
os.system('chmod -R a+rX .')
os.umask(int('022', 8))
base_dir = os.path.dirname(__file__)
w... | [
"os.path.join",
"os.path.dirname",
"os.system",
"setuptools.setup"
] | [((292, 317), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (307, 317), False, 'import os\n'), ((429, 1147), 'setuptools.setup', 'setup', ([], {'name': '"""pycybersource"""', 'version': '"""0.1.2a0"""', 'description': '"""A light wrapper for Cybersource SOAP Toolkit API"""', 'author': '"""<N... |
#!/usr/bin/env python
import sys, os, optparse, time
from os.path import expanduser
PY2 = sys.version_info[0] == 2
if PY2:
from urllib import quote
from urllib2 import urlopen, Request
from urllib2 import HTTPError,URLError
else:
from urllib import parse
from urllib.request import urlopen, Request
... | [
"json.load",
"os.getpid",
"urllib.request.Request",
"output.Output",
"json.loads",
"time.strftime",
"urllib.request.urlopen",
"json.dumps",
"optparse.TitledHelpFormatter",
"os.path.isfile",
"pprint.pprint",
"os.path.expanduser",
"sys.exit"
] | [((1759, 1793), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d %H:%M:%S"""'], {}), "('%Y-%m-%d %H:%M:%S')\n", (1772, 1793), False, 'import sys, os, optparse, time\n'), ((1800, 1811), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1809, 1811), False, 'import sys, os, optparse, time\n'), ((1818, 1850), 'output.Output', '... |
#!/usr/bin/env python3
import sys
import os
import glob
if len(sys.argv[1:]) == 0:
dirs = [os.getcwd()]
else:
dirs = sys.argv[1:]
for dir in dirs:
for notebook in glob.glob(os.path.join(dir, '*.ipynb')):
cmd = 'ipython nbconvert --to rst {0}'.format(notebook)
print(cmd)
os.system(... | [
"os.getcwd",
"os.path.join",
"os.system"
] | [((97, 108), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (106, 108), False, 'import os\n'), ((188, 216), 'os.path.join', 'os.path.join', (['dir', '"""*.ipynb"""'], {}), "(dir, '*.ipynb')\n", (200, 216), False, 'import os\n'), ((310, 324), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (319, 324), False, 'import os... |
#-*- coding: utf-8 -*-
from DBP.models import Base,session
from sqlalchemy import Column, Integer, Unicode, Enum, Date, String
from sqlalchemy import Table, ForeignKey, PrimaryKeyConstraint
from sqlalchemy.sql.expression import label
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from datetim... | [
"sqlalchemy.Enum",
"sqlalchemy.Unicode",
"DBP.models.session.query",
"sqlalchemy.ForeignKey",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.orm.relationship",
"werkzeug.security.check_password_hash",
"datetime.datetime.strptime",
"random.randrange",
"sqlalchemy.Column",
"sqlalchemy.String",
"... | [((941, 980), 'sqlalchemy.orm.relationship', 'relationship', (['"""User"""'], {'backref': '"""enrolls"""'}), "('User', backref='enrolls')\n", (953, 980), False, 'from sqlalchemy.orm import relationship\n'), ((1033, 1102), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'autoincrement': '(True)', ... |
from abc import abstractmethod
from typing import List, Dict
from src.bounding_box import BoundingBox
from src.utils.enumerators import BBType, BBFormat
import torch.nn.functional as F
class ModelEvaluator:
def __init__(self):
self._gt_bboxes = []
self._predicted_bboxes = []
self._img_cou... | [
"torch.nn.functional.softmax"
] | [((1402, 1428), 'torch.nn.functional.softmax', 'F.softmax', (['pred_logits', '(-1)'], {}), '(pred_logits, -1)\n', (1411, 1428), True, 'import torch.nn.functional as F\n')] |
"""
Numba-specific errors and warnings.
"""
from __future__ import print_function, division, absolute_import
import contextlib
from collections import defaultdict
import warnings
# Filled at the end
__all__ = []
class NumbaWarning(Warning):
"""
Base category for all Numba compiler warnings.
"""
class... | [
"collections.defaultdict",
"warnings.warn_explicit",
"warnings.catch_warnings",
"warnings.simplefilter"
] | [((827, 843), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (838, 843), False, 'from collections import defaultdict\n'), ((1040, 1076), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (1063, 1076), False, 'import warnings\n'), ((1099, 1146), 'wa... |
from collections import namedtuple
from contextlib import contextmanager
from pyroscope import agent
Config = namedtuple('Config', ('app_name', 'server_address',
'auth_token', 'sample_rate', 'with_subprocesses', 'log_level'))
class PyroscopeError(Exception):
pass
def configure(app_name, se... | [
"pyroscope.agent.stop",
"pyroscope.agent.set_tag",
"collections.namedtuple",
"pyroscope.agent.test_logger",
"pyroscope.agent.build_summary",
"pyroscope.agent.change_name"
] | [((112, 231), 'collections.namedtuple', 'namedtuple', (['"""Config"""', "('app_name', 'server_address', 'auth_token', 'sample_rate',\n 'with_subprocesses', 'log_level')"], {}), "('Config', ('app_name', 'server_address', 'auth_token',\n 'sample_rate', 'with_subprocesses', 'log_level'))\n", (122, 231), False, 'from... |
import discord
from discord.ext import commands
from forex_python.converter import CurrencyRates,CurrencyCodes
from datetime import date
class Exchange(commands.Cog):
def __init__(self,bot):
self.bot = bot
self.exchangeNames = {
"EUR":["eur","euro member countries"],
"IDR":... | [
"forex_python.converter.CurrencyRates",
"forex_python.converter.CurrencyCodes",
"discord.ext.commands.command"
] | [((1797, 1815), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (1813, 1815), False, 'from discord.ext import commands\n'), ((1730, 1745), 'forex_python.converter.CurrencyRates', 'CurrencyRates', ([], {}), '()\n', (1743, 1745), False, 'from forex_python.converter import CurrencyRates, CurrencyCode... |
# encoding: utf-8
import logging_helper
from .timeout import TimersBase
logging = logging_helper.setup_logging()
class Stopwatch(TimersBase):
def __init__(self,
high_precision=None):
super(Stopwatch, self).__init__(high_precision=high_precision)
self.reset()
def reset(sel... | [
"logging_helper.setup_logging"
] | [((84, 114), 'logging_helper.setup_logging', 'logging_helper.setup_logging', ([], {}), '()\n', (112, 114), False, 'import logging_helper\n')] |
import select
import socket
import struct
import time
import uuid
from collections import deque
from .icmp import parse_icmp_packet
from .ip import get_ip_address, parse_ipv4_packet
_FMT_ICMP_PACKET = '>BBHHH'
def chesksum(data):
n = len(data)
m = n % 2
sum_ = 0
for i in range(0, n - m, 2):
... | [
"uuid.uuid4",
"socket.socket",
"struct.pack",
"time.sleep",
"time.time",
"select.select",
"socket.htons",
"collections.deque"
] | [((2494, 2561), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_RAW', 'socket.IPPROTO_ICMP'], {}), '(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)\n', (2507, 2561), False, 'import socket\n'), ((3331, 3342), 'time.time', 'time.time', ([], {}), '()\n', (3340, 3342), False, 'import time\n'), ((5... |
from glob import glob
import re
require_pattern = re.compile(r'\brequire\("(.*)"\)')
print("digraph require_graph {")
for path in glob("**/*.lua", recursive=True):
with open(path) as f:
caller = path.replace(".lua", "").replace("/", ".")
caller_node = caller.replace(".", "__")
print(f" {... | [
"glob.glob",
"re.compile"
] | [((51, 87), 're.compile', 're.compile', (['"""\\\\brequire\\\\("(.*)"\\\\)"""'], {}), '(\'\\\\brequire\\\\("(.*)"\\\\)\')\n', (61, 87), False, 'import re\n'), ((133, 165), 'glob.glob', 'glob', (['"""**/*.lua"""'], {'recursive': '(True)'}), "('**/*.lua', recursive=True)\n", (137, 165), False, 'from glob import glob\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 15:47:36 2018
@author: akurnizk
"""
import flopy
import numpy as np
import sys,os
import matplotlib.pyplot as plt
# Location of BitBucket folder containing cgw folder
cgw_code_dir = 'E:\python'
sys.path.insert(0,cgw_code_dir)
from cgw.utils import ge... | [
"flopy.modflow.ModflowOc",
"numpy.amin",
"cgw.utils.raster_utils.subsection_griddata",
"numpy.empty",
"numpy.ones",
"numpy.isnan",
"cgw.utils.general_utils.quick_plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.contour",
"cgw.utils.feature_utils.nodes_to_cc",
"os.path.join",
"numpy.meshgr... | [((261, 293), 'sys.path.insert', 'sys.path.insert', (['(0)', 'cgw_code_dir'], {}), '(0, cgw_code_dir)\n', (276, 293), False, 'import sys, os\n'), ((537, 607), 'flopy.modflow.Modflow', 'flopy.modflow.Modflow', (['modelname'], {'exe_name': '"""mf2005"""', 'model_ws': 'work_dir'}), "(modelname, exe_name='mf2005', model_ws... |
# Copyright 2017-2020 Fitbit, Inc
# SPDX-License-Identifier: Apache-2.0
"""
Invoke configuration for Golden Gate
"""
# First check that we are running in a Python >= 3.5 environment
from __future__ import print_function
import sys
if not sys.version_info.major == 3 and sys.version_info.minor >= 5:
print(
"""You a... | [
"subprocess.check_output",
"invoke.Collection",
"invoke.Config",
"os.path.join",
"sys.exit"
] | [((2173, 2206), 'invoke.Config', 'Config', ([], {'project_location': 'ROOT_DIR'}), '(project_location=ROOT_DIR)\n', (2179, 2206), False, 'from invoke import Collection, Config, task\n'), ((2260, 2272), 'invoke.Collection', 'Collection', ([], {}), '()\n', (2270, 2272), False, 'from invoke import Collection, Config, task... |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
class brocade_arp(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def hide_arp_holder_system_max_arp(self, **kwargs):
"""Auto Generated Code
"""
... | [
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.SubElement"
] | [((335, 355), 'xml.etree.ElementTree.Element', 'ET.Element', (['"""config"""'], {}), "('config')\n", (345, 355), True, 'import xml.etree.ElementTree as ET\n'), ((382, 469), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['config', '"""hide-arp-holder"""'], {'xmlns': '"""urn:brocade.com:mgmt:brocade-arp"""'}), "(... |
import discord
from discord.ext import commands
import aiohttp
import sys
import time
import googletrans
import functools
class utility:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def avatar(self, ctx, *, member: discord.Member = None):
if member is None:
em... | [
"discord.ext.commands.command",
"discord.Embed",
"discord.Colour.green"
] | [((196, 214), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (212, 214), False, 'from discord.ext import commands\n'), ((662, 680), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (678, 680), False, 'from discord.ext import commands\n'), ((879, 897), 'discord.ext.commands.co... |
import pandas as pd
import numpy as np
import pytest
from ..wrangling import (
subset_plot_data_for_income_bins,
subset_plot_data_for_scatter_plot,
subset_year_age_sex_geo
)
def test_subset_plot_data_for_income_bins():
expected_result = {'Age group': {598748: '35 to 44 years',
... | [
"pandas.read_csv"
] | [((5769, 5804), 'pandas.read_csv', 'pd.read_csv', (['path'], {'low_memory': '(False)'}), '(path, low_memory=False)\n', (5780, 5804), True, 'import pandas as pd\n'), ((6649, 6684), 'pandas.read_csv', 'pd.read_csv', (['path'], {'low_memory': '(False)'}), '(path, low_memory=False)\n', (6660, 6684), True, 'import pandas as... |
import flowsim.client as c
get_chunk = c.get_chunk(port=8080)
| [
"flowsim.client.get_chunk"
] | [((40, 62), 'flowsim.client.get_chunk', 'c.get_chunk', ([], {'port': '(8080)'}), '(port=8080)\n', (51, 62), True, 'import flowsim.client as c\n')] |
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
import requests
API_KEY = '<KEY>'
API_SECRET = '<KEY>'
API_URL = 'http://apicn.faceplusplus.com'
def detect(path):
data = {
'api_key': API_KEY,
'api_secret': API_SECRET,
}
files = {
'img': open(path, 'rb'),
}
r = requests.post(API_... | [
"requests.post"
] | [((302, 370), 'requests.post', 'requests.post', (["(API_URL + '/detection/detect')"], {'data': 'data', 'files': 'files'}), "(API_URL + '/detection/detect', data=data, files=files)\n", (315, 370), False, 'import requests\n'), ((606, 663), 'requests.post', 'requests.post', (["(API_URL + '/detection/landmark')"], {'data':... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | [
"logging.getLogger"
] | [((880, 907), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (897, 907), False, 'import logging\n')] |
# Functions of img processing.
from functools import total_ordering
import config
import numpy as np
import copy
import torch
import cv2
from skimage.color import rgb2gray
from XCSLBP import XCSLBP
def extractPixelBlock(originalImg, labels):
'''
input_param:
originalImg: Original pixels matrix that sq... | [
"torch.eq",
"copy.deepcopy",
"numpy.meshgrid",
"skimage.color.rgb2gray",
"numpy.arctan2",
"numpy.append",
"numpy.array",
"numpy.sqrt",
"cv2.Sobel",
"torch.tensor",
"XCSLBP.XCSLBP"
] | [((637, 658), 'copy.deepcopy', 'copy.deepcopy', (['labels'], {}), '(labels)\n', (650, 658), False, 'import copy\n'), ((766, 791), 'numpy.array', 'np.array', (['[255, 255, 255]'], {}), '([255, 255, 255])\n', (774, 791), True, 'import numpy as np\n'), ((2226, 2247), 'numpy.array', 'np.array', (['featureList'], {}), '(fea... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
"flatbuffers.Builder",
"DeepSeaScene.Color3f.CreateColor3f",
"DeepSeaScene.Vector3f.CreateVector3f"
] | [((7001, 7023), 'flatbuffers.Builder', 'flatbuffers.Builder', (['(0)'], {}), '(0)\n', (7020, 7023), False, 'import flatbuffers\n'), ((9521, 9594), 'DeepSeaScene.Color3f.CreateColor3f', 'CreateColor3f', (['builder', 'ambientColor[0]', 'ambientColor[1]', 'ambientColor[2]'], {}), '(builder, ambientColor[0], ambientColor[1... |
"""
Deque is double-ended-queue. Lets you append and prepend to a list. Faster at
finding stuff I guess?
It is O(1) of memory use when inserting or popping, but lists are O(N).
"""
from collections import deque
def search(lines, pattern, history=5):
previous_lines = deque(maxlen=history)
for line in lines:
... | [
"collections.deque"
] | [((800, 815), 'collections.deque', 'deque', ([], {'maxlen': '(3)'}), '(maxlen=3)\n', (805, 815), False, 'from collections import deque\n'), ((274, 295), 'collections.deque', 'deque', ([], {'maxlen': 'history'}), '(maxlen=history)\n', (279, 295), False, 'from collections import deque\n')] |
"""This module contains tests for pyspark interval identifier.
isort:skip_file
"""
import pandas as pd
import pytest
from pywrangler.util.testing import PlainFrame
pytestmark = pytest.mark.pyspark # noqa: E402
pyspark = pytest.importorskip("pyspark") # noqa: E402
from tests.test_data.interval_identifier import (
... | [
"tests.test_data.interval_identifier.ResultTypeValidIids",
"pytest.importorskip",
"tests.test_data.interval_identifier.CollectionGeneral.pytest_parametrize_kwargs",
"pytest.mark.parametrize",
"pywrangler.util.testing.PlainFrame.from_pyspark",
"tests.test_data.interval_identifier.MultipleIntervalsSpanningG... | [((223, 253), 'pytest.importorskip', 'pytest.importorskip', (['"""pyspark"""'], {}), "('pyspark')\n", (242, 253), False, 'import pytest\n'), ((888, 930), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ([], {}), '(**WRANGLER_KWARGS)\n', (911, 930), False, 'import pytest\n'), ((932, 989), 'tests.test_data.interval... |
import os
from tmuxdir.dirmngr import ConfigHandler, DirMngr
import pytest
@pytest.fixture
def dir_mngr() -> DirMngr:
folder_name = "/tmp/tmuxdirtest/"
os.makedirs(folder_name, exist_ok=True)
cfg_handler = ConfigHandler(folder_name=folder_name)
yield DirMngr([], [".git"], cfg_handler=cfg_handler)
... | [
"os.makedirs",
"os.removedirs",
"os.environ.get",
"tmuxdir.dirmngr.ConfigHandler",
"os.path.expanduser",
"tmuxdir.dirmngr.DirMngr"
] | [((162, 201), 'os.makedirs', 'os.makedirs', (['folder_name'], {'exist_ok': '(True)'}), '(folder_name, exist_ok=True)\n', (173, 201), False, 'import os\n'), ((220, 258), 'tmuxdir.dirmngr.ConfigHandler', 'ConfigHandler', ([], {'folder_name': 'folder_name'}), '(folder_name=folder_name)\n', (233, 258), False, 'from tmuxdir... |
import os
import unittest
from baseLogger.ConsoleLogger import ConsoleLogger
from baseLogger.FileLogger import FileLogger
from baseLogger.LoggingConfig import LoggingConfig
from baseLogger.constants.LoggingEnabled import LoggingEnabled
from baseLogger.constants.MessageType import MessageType
from utilities.Config impor... | [
"utilities.StringProcessor.StringProcessor.safe_formatter",
"os.path.dirname",
"utilities.Config.Config",
"baseLogger.LoggingConfig.LoggingConfig"
] | [((712, 720), 'utilities.Config.Config', 'Config', ([], {}), '()\n', (718, 720), False, 'from utilities.Config import Config\n'), ((1161, 1169), 'utilities.Config.Config', 'Config', ([], {}), '()\n', (1167, 1169), False, 'from utilities.Config import Config\n'), ((6341, 6356), 'baseLogger.LoggingConfig.LoggingConfig', ... |
#fuzzytest.py
#<NAME>
#<NAME>
#fuzzy clustering for testFun.dat
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
import skfuzzy as fuzz
colors = ['b', 'orange', 'g', 'r', 'c', 'm', 'y', 'k', 'Brown', 'ForestGreen']
# Insert his test data instead !!!!
# Then our data ... | [
"matplotlib.pyplot.show",
"numpy.argmax",
"numpy.zeros",
"skfuzzy.cluster.cmeans",
"numpy.array",
"matplotlib.pyplot.subplots",
"numpy.vstack"
] | [((430, 441), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (438, 441), True, 'import numpy as np\n'), ((446, 470), 'numpy.zeros', 'np.zeros', ([], {'shape': '(200, 2)'}), '(shape=(200, 2))\n', (454, 470), True, 'import numpy as np\n'), ((925, 939), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (93... |
# coding=utf-8
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
from django.db import models
from django.dispatch import receiver
from django.utils.translat... | [
"django.db.models.signals.post_delete.connect",
"django.db.models.ForeignKey",
"django.contrib.sites.models.Site.objects.get_current",
"django.dispatch.receiver",
"django.contrib.sites.managers.CurrentSiteManager",
"django.db.models.Manager",
"django.db.models.signals.pre_delete.connect",
"django.cont... | [((6541, 6617), 'django.dispatch.receiver', 'receiver', (['models.signals.pre_save'], {'sender': 'Edge', 'dispatch_uid': '"""pre_save_edge"""'}), "(models.signals.pre_save, sender=Edge, dispatch_uid='pre_save_edge')\n", (6549, 6617), False, 'from django.dispatch import receiver\n'), ((7791, 7883), 'django.dispatch.rece... |
from uuid import uuid4
import boto3
import pytest
from moto import mock_dynamodb2, mock_s3
from tests.local_login import MockAuthenticator
from warehouse14 import DBBackend, PackageStorage
from warehouse14.repos_dynamo import DynamoDBBackend
from warehouse14.storage import S3Storage
@pytest.fixture
def bucket():
... | [
"warehouse14.storage.S3Storage",
"moto.mock_dynamodb2",
"uuid.uuid4",
"warehouse14.repos_dynamo.DynamoDBBackend",
"tests.local_login.MockAuthenticator",
"boto3.resource",
"moto.mock_s3",
"pyppeteer.launch"
] | [((1731, 1750), 'tests.local_login.MockAuthenticator', 'MockAuthenticator', ([], {}), '()\n', (1748, 1750), False, 'from tests.local_login import MockAuthenticator\n'), ((1808, 1830), 'warehouse14.repos_dynamo.DynamoDBBackend', 'DynamoDBBackend', (['table'], {}), '(table)\n', (1823, 1830), False, 'from warehouse14.repo... |
from django.contrib import admin
from .. import admin as enhanced_admin
from .models import Author, Book, Character, Theme
class EnhancedModelAdmin(enhanced_admin.EnhancedModelAdminMixin,
admin.ModelAdmin):
pass
class CharacterInline(enhanced_admin.EnhancedAdminMixin,
... | [
"django.contrib.admin.site.register"
] | [((478, 525), 'django.contrib.admin.site.register', 'admin.site.register', (['Author', 'EnhancedModelAdmin'], {}), '(Author, EnhancedModelAdmin)\n', (497, 525), False, 'from django.contrib import admin\n'), ((526, 562), 'django.contrib.admin.site.register', 'admin.site.register', (['Book', 'BookAdmin'], {}), '(Book, Bo... |
import typing
import discord
from discord.ext import commands
from .database import fetch_guild_db
from .logging import LoggingMixin
from .rolls import (RollHandler, QuietRollHandler, SekretRollHandler,
RollList, DiceDelta)
from .utils import handle_http_exception
class RollCommands(commands.Cog... | [
"discord.ext.commands.command"
] | [((449, 505), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""z"""', 'help': '"""Evaluate a dice roll."""'}), "(name='z', help='Evaluate a dice roll.')\n", (465, 505), False, 'from discord.ext import commands\n'), ((1024, 1090), 'discord.ext.commands.command', 'commands.command', ([], {'name': '""... |
#!/usr/bin/python2.7
# This is a simple script which copies old tripit auth details into etcd.
# If you've never run the scraper, you don't need to run this script.
# $1 is a job tag, which identifies the tripit user authentication details
# in etcd.
import json
import os
import sys
import etcd
etcd_path = '/todo... | [
"os.path.expanduser",
"etcd.Client"
] | [((356, 399), 'etcd.Client', 'etcd.Client', ([], {'host': '"""192.168.50.1"""', 'port': '(2379)'}), "(host='192.168.50.1', port=2379)\n", (367, 399), False, 'import etcd\n'), ((442, 474), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.todoist"""'], {}), "('~/.todoist')\n", (460, 474), False, 'import os\n')] |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D
from tensorflow.keras import Model
class CNN(Model):
def __init__(self):
super(CNN, self).__init__()
self.conv1 ... | [
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Input",
"tensorflow.keras.layers.Flatten"
] | [((322, 370), 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(32)', '(3)'], {'padding': '"""same"""', 'activation': '"""relu"""'}), "(32, 3, padding='same', activation='relu')\n", (328, 370), False, 'from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D\n'), ((401, 449), 'tensorflow.keras.la... |
from collections import Counter
from collections import deque
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
wordList = set(wordList)
if endWord not in wordList:
return 0
q = deque([beginWord])
step = 0
w... | [
"collections.deque"
] | [((275, 293), 'collections.deque', 'deque', (['[beginWord]'], {}), '([beginWord])\n', (280, 293), False, 'from collections import deque\n')] |
from telegram import update
from telegram.ext import Updater, CommandHandler
import requests
import re
import os
URL = "https://random.dog/woof.json"
def get_url():
contents = requests.get(URL).json()
url = contents["url"]
return url
def woof(update, context):
url = get_url()
chat_id = update.m... | [
"telegram.ext.Updater",
"telegram.ext.CommandHandler",
"requests.get"
] | [((475, 516), 'telegram.ext.Updater', 'Updater', ([], {'token': 'token_id', 'use_context': '(True)'}), '(token=token_id, use_context=True)\n', (482, 516), False, 'from telegram.ext import Updater, CommandHandler\n'), ((564, 592), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""woof"""', 'woof'], {}), "('woof', w... |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | [
"random.choice"
] | [((1609, 1644), 'random.choice', 'random.choice', (['self._format_id_list'], {}), '(self._format_id_list)\n', (1622, 1644), False, 'import random\n')] |
import argparse
import os
import sys
import torch
import torch.utils.data
from tensorboardX import SummaryWriter
import torch.backends.cudnn as cudnn
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
from utils.Survival_Aanlysis import SurvivalAnalysis
from utils.RiskLayer import cox_cost
from ... | [
"os.mkdir",
"tensorboardX.SummaryWriter",
"os.path.abspath",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"Prognostic.data.image_producer.ImageDataset",
"os.path.isdir",
"torch.load",
"os.path.exists",
"torch.cat",
"utils.Survival_Aanlysis.SurvivalAnalysis",
"torch.Tensor",
"tor... | [((522, 585), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Predicting survival time"""'}), "(description='Predicting survival time')\n", (545, 585), False, 'import argparse\n'), ((3944, 3992), 'torch.device', 'torch.device', (["('cuda' if args.use_cuda else 'cpu')"], {}), "('cuda' if a... |
import logging
from logging.handlers import RotatingFileHandler
import numpy as np
import sys
try: # python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHandler())
# TO... | [
"logging.Formatter.format",
"logging.StreamHandler",
"logging.getLogger",
"logging.NullHandler"
] | [((1726, 1753), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1743, 1753), False, 'import logging\n'), ((1798, 1821), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1819, 1821), False, 'import logging\n'), ((300, 313), 'logging.NullHandler', 'NullHandler', ([], {})... |
import argparse
from transformers import BertTokenizer
from tqdm import tqdm
def main(args):
"""Tokenize a corpus and write one sentence per line in order to be able to train
fastText on it.
Args:
args (TYPE)
"""
tok = BertTokenizer.from_pretrained(args.vocab)
with open(args.corpu... | [
"tqdm.tqdm",
"transformers.BertTokenizer.from_pretrained",
"argparse.ArgumentParser"
] | [((254, 295), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['args.vocab'], {}), '(args.vocab)\n', (283, 295), False, 'from transformers import BertTokenizer\n'), ((571, 596), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (594, 596), False, 'import argparse\n'... |
from _erwin import build
from _erwin import serve
from _erwin import clean
from _erwin import initialize
def run(argv):
if argv[0] == "clean" or argv[0] == "c":
print("Cleaning output folder")
clean.run_clean()
elif argv[0] == "build" or argv[0] == "b":
print("Build")
build.main()
e... | [
"_erwin.initialize.run_init",
"_erwin.serve.run_server",
"_erwin.clean.run_clean",
"_erwin.build.main"
] | [((210, 227), '_erwin.clean.run_clean', 'clean.run_clean', ([], {}), '()\n', (225, 227), False, 'from _erwin import clean\n'), ((302, 314), '_erwin.build.main', 'build.main', ([], {}), '()\n', (312, 314), False, 'from _erwin import build\n'), ((389, 407), '_erwin.serve.run_server', 'serve.run_server', ([], {}), '()\n',... |
import os
import unittest
import numpy as np
import pandas as pd
import cassiopeia
class TestErrorCorrectIntBCstoWhitelist(unittest.TestCase):
def setUp(self):
dir_path = os.path.dirname(os.path.realpath(__file__))
test_files_path = os.path.join(dir_path, "test_files")
self.whitelist_fp ... | [
"unittest.main",
"pandas.testing.assert_frame_equal",
"pandas.DataFrame.from_dict",
"os.path.realpath",
"cassiopeia.pp.error_correct_intbcs_to_whitelist",
"os.path.join"
] | [((4234, 4249), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4247, 4249), False, 'import unittest\n'), ((257, 293), 'os.path.join', 'os.path.join', (['dir_path', '"""test_files"""'], {}), "(dir_path, 'test_files')\n", (269, 293), False, 'import os\n'), ((322, 374), 'os.path.join', 'os.path.join', (['test_files_... |
from django.urls import reverse
from rest_framework.test import APITestCase
from tests.testapp.models import Book, Course, Student, Phone
class ViewTests(APITestCase):
def setUp(self):
self.book1 = Book.objects.create(title="Advanced Data Structures", author="S.Mobit")
self.book2 = Book.objects.cr... | [
"tests.testapp.models.Student.objects.all",
"tests.testapp.models.Book.objects.create",
"tests.testapp.models.Phone.objects.create",
"tests.testapp.models.Book.objects.all",
"tests.testapp.models.Student.objects.create",
"django.urls.reverse",
"tests.testapp.models.Course.objects.create",
"tests.testa... | [((212, 283), 'tests.testapp.models.Book.objects.create', 'Book.objects.create', ([], {'title': '"""Advanced Data Structures"""', 'author': '"""S.Mobit"""'}), "(title='Advanced Data Structures', author='S.Mobit')\n", (231, 283), False, 'from tests.testapp.models import Book, Course, Student, Phone\n'), ((305, 373), 'te... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@email: <EMAIL>
@time: 2021/12/17 20:25
"""
from unittest import mock
import pytest
from mussel.core.make_requests import MakeRequest
from mussel.scheme.api import Interface
class TestMakeAPIRequests:
def test_can_be_instantiated(self):
... | [
"unittest.mock.patch",
"mussel.core.make_requests.MakeRequest",
"mussel.scheme.api.Interface"
] | [((739, 786), 'unittest.mock.patch', 'mock.patch', (['"""mussel.core.make_requests.Session"""'], {}), "('mussel.core.make_requests.Session')\n", (749, 786), False, 'from unittest import mock\n'), ((327, 340), 'mussel.core.make_requests.MakeRequest', 'MakeRequest', ([], {}), '()\n', (338, 340), False, 'from mussel.core.... |
import pickle
from pathlib import Path
from datetime import datetime
from tqdm import tqdm
from dfp_main import patch, PatchStats, setVerbose
TEST_SET_PATH = "testSet"
# How many test files should be examined [0,100]
LIMIT = None
def evaluateTestSet():
testFiles = list(Path(TEST_SET_PATH).iterdir())
testPa... | [
"tqdm.tqdm",
"pickle.dump",
"dfp_main.setVerbose",
"pathlib.Path",
"datetime.datetime.now",
"dfp_main.PatchStats"
] | [((455, 478), 'tqdm.tqdm', 'tqdm', (['testPairs[:LIMIT]'], {}), '(testPairs[:LIMIT])\n', (459, 478), False, 'from tqdm import tqdm\n'), ((1430, 1446), 'dfp_main.setVerbose', 'setVerbose', (['(True)'], {}), '(True)\n', (1440, 1446), False, 'from dfp_main import patch, PatchStats, setVerbose\n'), ((736, 795), 'pickle.dum... |
from os import path
from unittest.mock import call
from uptimer.events import SCHEMATA_PATH
from uptimer.events.cache import SchemaCache
def test_schemacache_init(mocker):
mocked_open = mocker.patch.object(SchemaCache, "__missing__")
schema_cache = SchemaCache()
assert schema_cache is not None
mock... | [
"os.path.join",
"uptimer.events.cache.SchemaCache"
] | [((262, 275), 'uptimer.events.cache.SchemaCache', 'SchemaCache', ([], {}), '()\n', (273, 275), False, 'from uptimer.events.cache import SchemaCache\n'), ((477, 490), 'uptimer.events.cache.SchemaCache', 'SchemaCache', ([], {}), '()\n', (488, 490), False, 'from uptimer.events.cache import SchemaCache\n'), ((925, 938), 'u... |
from sklearn.neighbors import NearestNeighbors
import Sv
import logging
import pandas as pd
import numpy as np
import functools
import os
import math
logger = logging.getLogger('marin')
logger.setLevel(logging.DEBUG)
def point_processing(tracks_data):
"""
input: tracking data matrix
ouput: column of dist... | [
"numpy.sum",
"math.atan2",
"pandas.read_csv",
"numpy.mean",
"numpy.linalg.norm",
"numpy.std",
"pandas.merge",
"numpy.transpose",
"os.path.exists",
"sklearn.neighbors.NearestNeighbors",
"math.cos",
"numpy.log10",
"pandas.concat",
"math.sqrt",
"os.path.basename",
"os.path.getsize",
"fu... | [((160, 186), 'logging.getLogger', 'logging.getLogger', (['"""marin"""'], {}), "('marin')\n", (177, 186), False, 'import logging\n'), ((705, 759), 'numpy.vstack', 'np.vstack', (['[tracks.lat_m, tracks.long_m, tracks.z_gps]'], {}), '([tracks.lat_m, tracks.long_m, tracks.z_gps])\n', (714, 759), True, 'import numpy as np\... |
#!/usr/bin/env python3
import argparse
import os
import sys
import collections
import textwrap
from functools import partial
import machinery as ma
from machinery import ErrMsg, chk, bail
from machinery import LogEntry as L
from generic import lty, interleave, itemify, dupchk, listify, w_str
# -----------------------... | [
"machinery.LogEntry.does_match",
"machinery.setup_err_handling",
"generic.interleave",
"argparse.ArgumentParser",
"machinery.LogEntry.is_mem_stress",
"machinery.LogEntry.is_barrier",
"generic.dupchk",
"machinery.get_entry",
"machinery.get_matching_keys",
"machinery.get_pos_keys",
"machinery.LogE... | [((547, 1072), 'textwrap.dedent', 'textwrap.dedent', (['""" <!DOCTYPE html>\n <html>\n <head>\n <meta charset="UTF-8">\n <title>GPU Litmus Test Results</title>\n <link rel="stylesheet" href="common.css" type="text/css" media="screen"/>\n </head>\n\n <body>\n <div class="outer">\n <div class="inner">\n\n <h1>... |
# -*- coding: utf-8 -*-
"""This module contains the the methods related to scraping articles from arXiv.
To only scrape the metadata from the articles in the rss-stream use the
harvestMetaDataRss method.
It's also possible to scrape articles between any two dates,
to accomplish this use the get_records_by_date method."... | [
"feedparser.parse",
"xml.etree.ElementTree.fromstring",
"urllib.request.urlopen",
"time.sleep",
"datetime.datetime.utcnow",
"datetime.timedelta",
"requests.get"
] | [((4135, 4147), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (4142, 4147), False, 'from urllib.request import urlopen\n'), ((2726, 2763), 'requests.get', 'requests.get', (['base_url'], {'params': 'params'}), '(base_url, params=params)\n', (2738, 2763), False, 'import requests\n'), ((3131, 3152), 'xml.... |
# This is sample baseline for CIKM Personalization Cup 2016
# by <NAME> & <NAME>
import numpy as np
import pandas as pd
import datetime
start_time = datetime.datetime.now()
print("Running baseline. Now it's", start_time.isoformat())
# Loading queries (assuming data placed in <dataset-train/>
queries = pd.read_csv('d... | [
"pandas.read_csv",
"datetime.datetime.now",
"numpy.array"
] | [((151, 174), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (172, 174), False, 'import datetime\n'), ((2686, 2709), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2707, 2709), False, 'import datetime\n'), ((306, 361), 'pandas.read_csv', 'pd.read_csv', (['"""dataset-train/trai... |
"""Discrete KL divergence
KL loss for Categorical and RelaxedCategorical
ref) KL divergence in PyTorch
https://pytorch.org/docs/stable/_modules/torch/distributions/kl.html#kl_divergence
"""
from typing import Optional, List, Dict, Tuple
import sympy
import torch
from torch._six import inf
from pixyz.distribution... | [
"torch.sum",
"pixyz.utils.get_dict_values"
] | [((2427, 2474), 'pixyz.utils.get_dict_values', 'get_dict_values', (['x_dict', 'self.p.input_var', '(True)'], {}), '(x_dict, self.p.input_var, True)\n', (2442, 2474), False, 'from pixyz.utils import get_dict_values\n'), ((2533, 2580), 'pixyz.utils.get_dict_values', 'get_dict_values', (['x_dict', 'self.q.input_var', '(Tr... |
#!/usr/bin/env python
""" christmas.py
Prints a christmas tree on the terminal using coloured and blinking characters.
Uses ansi terminal escape sequences.
The '\033[' part is the escape code.
We pass '5;' for the colours other than green to make them blink.
The next part is the colour code and the 'm' ends the sequen... | [
"random.random",
"random.choice"
] | [((2075, 2083), 'random.random', 'random', ([], {}), '()\n', (2081, 2083), False, 'from random import random\n'), ((2220, 2235), 'random.choice', 'choice', (['colours'], {}), '(colours)\n', (2226, 2235), False, 'from random import choice\n'), ((2237, 2249), 'random.choice', 'choice', (['decs'], {}), '(decs)\n', (2243, ... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
exp = 0
while 2 ** (exp + 1) <= n:
exp += 1
print(2 ** exp)
| [
"sys.setrecursionlimit"
] | [((38, 68), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (59, 68), False, 'import sys\n')] |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from typing import List, Optional
import torch
import torch.nn as nn
from pytorchvideo.layers.utils import set_attributes
from pytorchvideo.models.weight_init import init_net_weights
class Net(nn.Module):
"""
Build a general Net models ... | [
"pytorchvideo.models.weight_init.init_net_weights"
] | [((1164, 1186), 'pytorchvideo.models.weight_init.init_net_weights', 'init_net_weights', (['self'], {}), '(self)\n', (1180, 1186), False, 'from pytorchvideo.models.weight_init import init_net_weights\n')] |
from setuptools import setup
import sys
setup(name='nuodbawsquickstart',
version='1.1.0',
description='Script to deploy a multi-region and multi-instance AWS cluster',
url='http://github.com/nuodb/nuodb-aws-quickstart',
author='<NAME>.',
author_email='<EMAIL>',
#data_files=[('nuodba... | [
"setuptools.setup"
] | [((41, 465), 'setuptools.setup', 'setup', ([], {'name': '"""nuodbawsquickstart"""', 'version': '"""1.1.0"""', 'description': '"""Script to deploy a multi-region and multi-instance AWS cluster"""', 'url': '"""http://github.com/nuodb/nuodb-aws-quickstart"""', 'author': '"""<NAME>."""', 'author_email': '"""<EMAIL>"""', 'i... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | [
"flask_oauthlib.client.OAuth",
"flask.redirect",
"flask.request.args.get",
"flask_login.LoginManager",
"os.environ.get",
"flask.url_for",
"airflow.models.User",
"airflow.configuration.conf.has_option",
"airflow.configuration.conf.get",
"airflow.utils.log.logging_mixin.LoggingMixin"
] | [((1473, 1487), 'airflow.utils.log.logging_mixin.LoggingMixin', 'LoggingMixin', ([], {}), '()\n', (1485, 1487), False, 'from airflow.utils.log.logging_mixin import LoggingMixin\n'), ((1620, 1665), 'airflow.configuration.conf.has_option', 'configuration.conf.has_option', (['"""oauth"""', 'param'], {}), "('oauth', param)... |
from logging import getLogger, Formatter
from logging.handlers import RotatingFileHandler
from typing import Type
from src.framework import get_config, make_config_files, run_jobs, _sleeper
from src.zipped_logs import ZippedRotatingFileHandler
if __name__ == '__main__':
# setup section
make_config_files()
... | [
"logging.Formatter",
"src.framework.get_config",
"logging.getLogger",
"src.framework.make_config_files"
] | [((298, 317), 'src.framework.make_config_files', 'make_config_files', ([], {}), '()\n', (315, 317), False, 'from src.framework import get_config, make_config_files, run_jobs, _sleeper\n'), ((331, 343), 'src.framework.get_config', 'get_config', ([], {}), '()\n', (341, 343), False, 'from src.framework import get_config, ... |
__author__ = 'DafniAntotsiou'
from gym_ext.envs.inverted_pendulum_ext import InvertedPendulumEnvExt
from gym_ext.envs.HalfCheetah_ext import HalfCheetahEnvExt
from gym.envs.mujoco.mujoco_env import MujocoEnv
import mujoco_py
from mapping.mjviewerext import MjViewerExt as MjViewer
def _get_viewer(self, mode):
sel... | [
"mujoco_py.MjRenderContextOffscreen"
] | [((587, 635), 'mujoco_py.MjRenderContextOffscreen', 'mujoco_py.MjRenderContextOffscreen', (['self.sim', '(-1)'], {}), '(self.sim, -1)\n', (621, 635), False, 'import mujoco_py\n')] |
"""@file data_reader.py
contains a reader class for data"""
from six.moves import configparser
from nabu.processing.processors import processor_factory
import gzip
import os
class DataReader(object):
"""the data reader class.
a reader for data. Data is not stored in tensorflow format
as was done in data.py. Data... | [
"os.path.isfile",
"nabu.processing.processors.processor_factory.factory",
"six.moves.configparser.ConfigParser"
] | [((1290, 1317), 'six.moves.configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1315, 1317), False, 'from six.moves import configparser\n'), ((1177, 1206), 'os.path.isfile', 'os.path.isfile', (['proc_cfg_file'], {}), '(proc_cfg_file)\n', (1191, 1206), False, 'import os\n'), ((1463, 1511), 'nabu.p... |
from pathlib import Path
from typing import Tuple
from sacred.run import Run
import tensorflow as tf
from tensorflow.keras.callbacks import ReduceLROnPlateau, TensorBoard
from tensorflow.keras.models import Model
from .job import Job
from ..ingredients import (
get_data_loader,
get_builder,
)
from ..loaders i... | [
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"pathlib.Path",
"tensorflow.distribute.MirroredStrategy"
] | [((3404, 3436), 'tensorflow.distribute.MirroredStrategy', 'tf.distribute.MirroredStrategy', ([], {}), '()\n', (3434, 3436), True, 'import tensorflow as tf\n'), ((6397, 6446), 'pathlib.Path', 'Path', (["self.exp_config['run_config']['model_path']"], {}), "(self.exp_config['run_config']['model_path'])\n", (6401, 6446), F... |
from sklearn.manifold import TSNE
import pandas as pd
import matplotlib.pyplot as plt
def visualize(data):
data_embedded = TSNE(n_components=2).fit_transform(data)
print(data_embedded)
plt.plot(data_embedded)
plt.show()
| [
"sklearn.manifold.TSNE",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot"
] | [((198, 221), 'matplotlib.pyplot.plot', 'plt.plot', (['data_embedded'], {}), '(data_embedded)\n', (206, 221), True, 'import matplotlib.pyplot as plt\n'), ((226, 236), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (234, 236), True, 'import matplotlib.pyplot as plt\n'), ((128, 148), 'sklearn.manifold.TSNE', 'TS... |
from subs2cia.sources import Stream
import pycountry
import logging
def picker(streams: [Stream], target_lang: str = None, forced_stream: int = None):
r"""
Returns streams by priority. Streams which are not part of a container are preferred first,
followed by manually specified stream indices, then stream... | [
"pycountry.languages.lookup"
] | [((732, 771), 'pycountry.languages.lookup', 'pycountry.languages.lookup', (['target_lang'], {}), '(target_lang)\n', (758, 771), False, 'import pycountry\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import os
from cloghandler import ConcurrentRotatingFileHandler
import logconf
def compose_logger(name, log_file):
logger = logging.Logger(name)
hdlr = ConcurrentRotatingFileHandler(
filename=os.path.join(LOG_FILE_DIR, log_file),
maxB... | [
"logging.Formatter",
"os.path.join",
"logging.Logger"
] | [((190, 210), 'logging.Logger', 'logging.Logger', (['name'], {}), '(name)\n', (204, 210), False, 'import logging\n'), ((395, 439), 'logging.Formatter', 'logging.Formatter', (['logconf.VERBOSE_FORMATTER'], {}), '(logconf.VERBOSE_FORMATTER)\n', (412, 439), False, 'import logging\n'), ((270, 306), 'os.path.join', 'os.path... |
from django.contrib import admin
from .models import Concert
# Register your models here.
class ConcertAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'updated')
admin.site.register(Concert, ConcertAdmin) | [
"django.contrib.admin.site.register"
] | [((180, 222), 'django.contrib.admin.site.register', 'admin.site.register', (['Concert', 'ConcertAdmin'], {}), '(Concert, ConcertAdmin)\n', (199, 222), False, 'from django.contrib import admin\n')] |
"""
Test ingress.py module
"""
import os
import pandas as pd
from sqlalchemy import create_engine
from edunotice.ingress import (
_update_courses,
_update_labs,
_update_subscriptions,
_update_details,
update_edu_data,
)
from edunotice.constants import (
CONST_TEST_DIR_DATA,
CONST_TEST1_F... | [
"pandas.DataFrame",
"pandas.read_csv",
"edunotice.ingress._update_labs",
"edunotice.ingress.update_edu_data",
"edunotice.ingress._update_courses",
"edunotice.ingress._update_details",
"sqlalchemy.create_engine",
"os.path.join",
"edunotice.ingress._update_subscriptions"
] | [((436, 638), 'pandas.DataFrame', 'pd.DataFrame', (["{'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 'year': [2012, 2012, \n 2013, 2014, 2014], 'reports': [4, 24, 31, 2, 3]}"], {'index': "['Cochice', 'Pima', '<NAME>', 'Maricopa', 'Yuma']"}), "({'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 'year': [\n 20... |
from django.core.management.base import BaseCommand
from django.db import transaction
from jobya.users.models import User
from jobya.users.tests.factories import UserFactory
class Command(BaseCommand):
help = "Set up users data"
def add_arguments(self, parser):
parser.add_argument(
"tota... | [
"jobya.users.tests.factories.UserFactory",
"jobya.users.models.User.objects.filter"
] | [((839, 852), 'jobya.users.tests.factories.UserFactory', 'UserFactory', ([], {}), '()\n', (850, 852), False, 'from jobya.users.tests.factories import UserFactory\n'), ((636, 675), 'jobya.users.models.User.objects.filter', 'User.objects.filter', ([], {'is_superuser': '(False)'}), '(is_superuser=False)\n', (655, 675), Fa... |
import os
import re
import time
import logging
from virttest import data_dir
from virttest import env_process
from avocado.utils import process
from avocado.core import exceptions
from autotest.client.shared import error
from qemu.tests import thin_provisioning
@error.context_aware
def run(test, params, env):
""... | [
"qemu.tests.thin_provisioning.get_allocation_bitmap",
"virttest.data_dir.get_data_dir",
"virttest.env_process.preprocess_vm",
"logging.debug",
"qemu.tests.thin_provisioning.get_scsi_disk",
"qemu.tests.thin_provisioning.destroy_vm",
"avocado.core.exceptions.TestError",
"time.sleep",
"avocado.core.exc... | [((3389, 3422), 'qemu.tests.thin_provisioning.destroy_vm', 'thin_provisioning.destroy_vm', (['env'], {}), '(env)\n', (3417, 3422), False, 'from qemu.tests import thin_provisioning\n'), ((3801, 3854), 'virttest.env_process.preprocess_vm', 'env_process.preprocess_vm', (['test', 'params', 'env', 'vm_name'], {}), '(test, p... |
import sys
sys.path.append('~/Func2Wav/FuncToWav/src')
| [
"sys.path.append"
] | [((11, 54), 'sys.path.append', 'sys.path.append', (['"""~/Func2Wav/FuncToWav/src"""'], {}), "('~/Func2Wav/FuncToWav/src')\n", (26, 54), False, 'import sys\n')] |
# python
import warnings
# Third party imports
import numpy as np
# grAdapt
from .base import Initial
from grAdapt.utils.sampling import sample_corner_bounds
class VerticesForceRandom(Initial):
"""
Samples all vertices if n_evals >= 2 ** len(bounds).
Else, a subset of vertices is sampled.
"""
d... | [
"numpy.log2",
"numpy.hstack",
"grAdapt.utils.sampling.sample_corner_bounds",
"numpy.tile",
"numpy.vstack"
] | [((1438, 1481), 'grAdapt.utils.sampling.sample_corner_bounds', 'sample_corner_bounds', (['self.bounds[:d_tilde]'], {}), '(self.bounds[:d_tilde])\n', (1458, 1481), False, 'from grAdapt.utils.sampling import sample_corner_bounds\n'), ((2071, 2105), 'numpy.tile', 'np.tile', (['fix_corners', '(n_tilde, 1)'], {}), '(fix_cor... |
import numpy as np
import pickle
class onehot:
def __init__(self, sentences):
self.__sentences = sentences
self.__data = {}
self.__count = {}
self.__build()
def __build(self):
self.__word_num = 1
for sentence in self.__sentences:
for word ... | [
"numpy.zeros"
] | [((748, 782), 'numpy.zeros', 'np.zeros', (['(self.__word_num - 1, 1)'], {}), '((self.__word_num - 1, 1))\n', (756, 782), True, 'import numpy as np\n')] |
#! /usr/bin/env python2.7
import os
from app import app
# Change working directory
os.chdir(os.path.dirname(__file__))
# Run application
app.run(debug=True)
| [
"os.path.dirname",
"app.app.run"
] | [((138, 157), 'app.app.run', 'app.run', ([], {'debug': '(True)'}), '(debug=True)\n', (145, 157), False, 'from app import app\n'), ((93, 118), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (108, 118), False, 'import os\n')] |
import datetime
from operator import attrgetter
from fastapi import APIRouter, HTTPException
from models import user as user_model, match
from resources.crud import read, create, custom
from schemas import user as user_schemas
from schemas.match import Match, FilterParams
from . import session_dep
match_router = API... | [
"fastapi.HTTPException",
"datetime.date",
"resources.crud.create.create_single_isolated_resource",
"operator.attrgetter",
"datetime.timedelta",
"resources.crud.custom.match_user",
"schemas.match.Match",
"datetime.datetime.now",
"resources.crud.read.read_single_resource",
"fastapi.APIRouter"
] | [((317, 328), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (326, 328), False, 'from fastapi import APIRouter, HTTPException\n'), ((530, 622), 'resources.crud.read.read_single_resource', 'read.read_single_resource', ([], {'model': 'user_model.User', 'identifier': '"""id"""', 'value': 'user_id', 'db': 'db'}), "(mo... |
import scrapy
from wuba.items import WubaItem
from selenium import webdriver
from lxml import etree
from selenium.webdriver.chrome.options import Options # 无头浏览器
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
from selenium.webdriver import ChromeOption... | [
"selenium.webdriver.chrome.options.Options",
"scrapy.Request",
"wuba.items.WubaItem",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"lxml.etree.HTML"
] | [((180, 189), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (187, 189), False, 'from selenium.webdriver.chrome.options import Options\n'), ((339, 354), 'selenium.webdriver.ChromeOptions', 'ChromeOptions', ([], {}), '()\n', (352, 354), False, 'from selenium.webdriver import ChromeOptions\n'),... |
#!/usr/bin/python
# (because /usr/bin/env python does not work when called from IDE on Windows)
#
# Copyright (c) 2012 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must ret... | [
"os.path.isabs",
"os.remove",
"getopt.getopt",
"os.makedirs",
"os.getcwd",
"seal.generator.components.clearGlobals",
"os.path.realpath",
"os.path.dirname",
"os.path.exists",
"os.system",
"seal.generator.SealParser",
"os.path.normpath",
"shutil.move",
"shutil.copyfile",
"seal.generator.cr... | [((2465, 2487), 'sys.stderr.write', 'sys.stderr.write', (['line'], {}), '(line)\n', (2481, 2487), False, 'import os, sys, getopt, shutil\n'), ((2512, 2540), 'sys.stderr.write', 'sys.stderr.write', (['"""Usage:\n"""'], {}), "('Usage:\\n')\n", (2528, 2540), False, 'import os, sys, getopt, shutil\n'), ((2977, 3035), 'sys.... |
from typing import List, Dict
from . import _target_configurator_base
from .. import configurator_enums
import template
import optimize
import launch
from os import path
import yaml
import warnings
import time
import re
class SpiloPostgresConfigurator(_target_configurator_base.TargetConfigurator):
label = ... | [
"yaml.load",
"os.path.dirname",
"yaml.dump",
"time.sleep",
"warnings.warn",
"os.path.join"
] | [((2555, 2568), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2565, 2568), False, 'import time\n'), ((3953, 4005), 'warnings.warn', 'warnings.warn', (['"""Unable to prepare, no client match."""'], {}), "('Unable to prepare, no client match.')\n", (3966, 4005), False, 'import warnings\n'), ((4288, 4340), 'warning... |
import pytest
from PTMCMCSampler.nompi4py import MPIDummy
class TestMPIDummp(object):
"""Test the MPIDummpy class
"""
def setup(self):
"""Setup the MPIDummy object
"""
self.mpidummy = MPIDummy()
def test_Get_rank(self):
"""Test the `Get_rank` method
"""
... | [
"PTMCMCSampler.nompi4py.MPIDummy"
] | [((222, 232), 'PTMCMCSampler.nompi4py.MPIDummy', 'MPIDummy', ([], {}), '()\n', (230, 232), False, 'from PTMCMCSampler.nompi4py import MPIDummy\n')] |
import discord
import main
from discord.ext import commands
from cogs.help import Help
class Clear(commands.Cog):
def __init__(self, bot):
"""Returns embeds for the clear command."""
self.bot = bot
@commands.group(invoke_without_command=True, case_insensitive=True, aliases=['cl', 'pg', 'purge... | [
"discord.ext.commands.check",
"main.ids",
"main.log_embed",
"discord.ext.commands.group",
"main.error_embed",
"cogs.help.Help.clear"
] | [((226, 328), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)', 'case_insensitive': '(True)', 'aliases': "['cl', 'pg', 'purge']"}), "(invoke_without_command=True, case_insensitive=True, aliases=\n ['cl', 'pg', 'purge'])\n", (240, 328), False, 'from discord.ext import commands\... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 15 14:52:34 2019
@author: a.mohammadi
"""
import pyodbc
from collections import OrderedDict
#%%
def GetConnection(server, database):
return pyodbc.connect( ''.join(
[r'DRIVER={ODBC Driver 13 for SQL Server};',
r'Trusted_Connection=ye... | [
"pandas.DataFrame",
"collections.OrderedDict"
] | [((1368, 1391), 'pandas.DataFrame', 'DataFrame', (['lst_of_dicts'], {}), '(lst_of_dicts)\n', (1377, 1391), False, 'from pandas import DataFrame\n'), ((896, 909), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (907, 909), False, 'from collections import OrderedDict\n')] |
import torch
import torch.nn.functional as F
import gym
import gym.spaces
import numpy as np
def autocrop_observations(observations, cell_size, output_size=None):
shape = observations.size()[3:]
if output_size is None:
new_shape = tuple(map(lambda x: (x // cell_size) * cell_size, shape))
else:
... | [
"torch.gather",
"torch.nn.functional.avg_pool2d",
"torch.nn.functional.mse_loss",
"numpy.zeros",
"torch.nn.functional.binary_cross_entropy_with_logits",
"numpy.clip",
"gym.spaces.Box",
"torch.no_grad"
] | [((2582, 2631), 'torch.gather', 'torch.gather', (['action_values[:, :-1]', '(2)', 'q_actions'], {}), '(action_values[:, :-1], 2, q_actions)\n', (2594, 2631), False, 'import torch\n'), ((2644, 2681), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['pseudo_rewards', 'q_actions'], {}), '(pseudo_rewards, q_actions)\n', (26... |
import json
import pytest
import responses
from cellengine.utils.generate_id import generate_id
from cellengine.resources.fcs_file import FcsFile
EXP_ID = "5d38a6f79fae87499999a74b"
FCSFILE_ID = "5d64abe2ca9df61349ed8e7c"
@responses.activate
def test_should_get_fcs_file(ENDPOINT_BASE, client, fcs_files):
file_i... | [
"cellengine.resources.fcs_file.FcsFile.get",
"cellengine.resources.fcs_file.FcsFile.from_dict",
"json.loads",
"responses.add",
"cellengine.resources.fcs_file.FcsFile.create",
"cellengine.utils.generate_id.generate_id",
"pytest.raises",
"pytest.mark.parametrize"
] | [((1419, 1485), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fcs_file_args,expected_response"""', 'params'], {}), "('fcs_file_args,expected_response', params)\n", (1442, 1485), False, 'import pytest\n'), ((348, 460), 'responses.add', 'responses.add', (['responses.GET', "(ENDPOINT_BASE + f'/experiments/{E... |
import numpy as np
from scipy.spatial.transform import Rotation
import numpy as np
import pybullet as p
def todegree(w):
return w*180/np.pi
def torad(w):
return w*np.pi/180
def angle(v1, v2):
v1_u = unit_vector(v1)
v2_u = unit_vector(v2)
return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))... | [
"numpy.abs",
"numpy.dot",
"numpy.asarray",
"pybullet.getMatrixFromQuaternion",
"numpy.cross",
"numpy.zeros",
"numpy.sign",
"numpy.sin",
"numpy.array",
"numpy.linalg.norm",
"numpy.cos",
"numpy.matmul",
"scipy.spatial.transform.Rotation.from_matrix",
"numpy.eye",
"scipy.spatial.transform.R... | [((583, 594), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (591, 594), True, 'import numpy as np\n'), ((605, 614), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (611, 614), True, 'import numpy as np\n'), ((792, 805), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (800, 805), True, 'import numpy as np\n'), ... |
import argparse
import hashlib
import json
import csv
import os
MAESTRO_INDEX_PATH = '../mirdata/indexes/maestro_index.json'
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path: str
File path.
Returns
-------
md5_hash: str
md5 hash of data in ... | [
"json.dump",
"hashlib.md5",
"json.load",
"argparse.ArgumentParser",
"os.path.join"
] | [((353, 366), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (364, 366), False, 'import hashlib\n'), ((594, 640), 'os.path.join', 'os.path.join', (['data_path', '"""maestro-v2.0.0.json"""'], {}), "(data_path, 'maestro-v2.0.0.json')\n", (606, 640), False, 'import os\n'), ((1598, 1661), 'argparse.ArgumentParser', 'argpa... |
from subprocess import Popen, PIPE
from selenium import webdriver
from PIL import Image
import io
class WebsiteScreenshotGenerator():
def __init__(self):
self._screenshot = None
def capture(self, url, width, height, crop=True):
print ("Capturing website screenshot of: " + url)
driver =... | [
"selenium.webdriver.PhantomJS",
"io.BytesIO"
] | [((321, 342), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {}), '()\n', (340, 342), False, 'from selenium import webdriver\n'), ((1079, 1091), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1089, 1091), False, 'import io\n')] |
import sst
import sst.actions
from sst import config
# PhantomJS can not do alerts by design
if config.browser_type == 'phantomjs':
sst.actions.skip()
sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)
sst.actions.go_to('/alerts')
# Accept an alert box and assert its text.
sst.actions.click_... | [
"sst.actions.set_base_url",
"sst.actions.click_button",
"sst.actions.dismiss_alert",
"sst.actions.assert_title",
"sst.actions.go_to",
"sst.actions.accept_alert",
"sst.actions.skip"
] | [((159, 228), 'sst.actions.set_base_url', 'sst.actions.set_base_url', (["('http://localhost:%s/' % sst.DEVSERVER_PORT)"], {}), "('http://localhost:%s/' % sst.DEVSERVER_PORT)\n", (183, 228), False, 'import sst\n'), ((229, 257), 'sst.actions.go_to', 'sst.actions.go_to', (['"""/alerts"""'], {}), "('/alerts')\n", (246, 257... |
from collections.abc import Iterable
import numpy as np
import pandas as pd
import param
import xarray as xr
from matplotlib.colors import LinearSegmentedColormap, rgb2hex
from .configuration import DEFAULTS, EASES, INTERPS, PRECEDENCES, REVERTS
from .util import is_str
class Easing(param.Parameterized):
inter... | [
"numpy.isnan",
"numpy.sin",
"numpy.arange",
"numpy.tile",
"matplotlib.colors.rgb2hex",
"param.Integer",
"numpy.full",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"numpy.power",
"param.edit_constant",
"numpy.linspace",
"numpy.repeat",
"numpy.ceil",
"numpy.roll",
"numpy.hstack",... | [((324, 453), 'param.ClassSelector', 'param.ClassSelector', ([], {'default': 'None', 'class_': 'Iterable', 'doc': 'f"""Interpolation method; {INTERPS}"""', 'precedence': "PRECEDENCES['interp']"}), "(default=None, class_=Iterable, doc=\n f'Interpolation method; {INTERPS}', precedence=PRECEDENCES['interp'])\n", (343, ... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator
from django.db.models import Count
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import ... | [
"django.shortcuts.redirect",
"django.utils.timezone.now",
"django.contrib.messages.add_message",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.shortcuts.render",
"django.db.models.Count"
] | [((13128, 13170), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['User'], {'username': 'username'}), '(User, username=username)\n', (13145, 13170), False, 'from django.shortcuts import get_object_or_404, redirect, render\n'), ((13510, 13548), 'django.shortcuts.redirect', 'redirect', (['"""profile"""'], {'... |
from __future__ import annotations
import json
import uuid
from argparse import ArgumentParser, Namespace
from collections.abc import Awaitable, Callable, Mapping, AsyncIterator
from contextlib import closing, asynccontextmanager, AsyncExitStack
from datetime import datetime
from functools import partial
from secrets... | [
"pymap.context.connection_exit.get",
"functools.partial",
"secrets.token_bytes",
"uuid.uuid4",
"json.loads",
"pymap.exceptions.UserNotFound",
"pymap.bytes.BytesFormat",
"pymap.config.BackendCapability",
"pymap.exceptions.NotAllowedError",
"pymap.token.AllTokens",
"pymap.health.HealthStatus",
"... | [((3084, 3098), 'pymap.health.HealthStatus', 'HealthStatus', ([], {}), '()\n', (3096, 3098), False, 'from pymap.health import HealthStatus\n'), ((3123, 3166), 'functools.partial', 'partial', (['cls._connect_redis', 'config', 'status'], {}), '(cls._connect_redis, config, status)\n', (3130, 3166), False, 'from functools ... |
from mmdnn.conversion.rewriter.rewriter import UnitRewriterBase
import numpy as np
import re
class LSTMRewriter(UnitRewriterBase):
def __init__(self, graph, weights_dict):
return super(LSTMRewriter, self).__init__(graph, weights_dict)
def process_lstm_cell(self, match_result):
if 'lstm_cell... | [
"re.sub",
"numpy.split"
] | [((666, 695), 'numpy.split', 'np.split', (['w', '[-1 * num_units]'], {}), '(w, [-1 * num_units])\n', (674, 695), True, 'import numpy as np\n'), ((2259, 2302), 're.sub', 're.sub', (['"""(_\\\\d+)*$"""', '""""""', 'op_name_splits[-2]'], {}), "('(_\\\\d+)*$', '', op_name_splits[-2])\n", (2265, 2302), False, 'import re\n')... |
import space_mission_design
from space_mission_design.celestlab import celestlab_wrapper
from space_mission_design.visualisation import ploting_map
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("presentation")
from astropy import units as u
from poliastro.bodies import Earth, Mars, Sun
from polias... | [
"matplotlib.pyplot.show",
"space_mission_design.celestlab.celestlab_wrapper.WrapperCelestlab",
"matplotlib.pyplot.style.use",
"space_mission_design.visualisation.ploting_map.plot_planisphere",
"space_mission_design.visualisation.ploting_map.plot_poles"
] | [((200, 229), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""presentation"""'], {}), "('presentation')\n", (213, 229), True, 'import matplotlib.pyplot as plt\n'), ((451, 667), 'space_mission_design.celestlab.celestlab_wrapper.WrapperCelestlab', 'celestlab_wrapper.WrapperCelestlab', ([], {'scilab_path': '"""/home... |
from NXController import Controller
ctr = Controller()
ctr.LS()
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(0.3)
ctr.h()
response = input("Restart(y/n): ")
while response == 'y':
ctr.X()
ctr.A()
ctr.pause(3)
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(15)
ctr.A()
ctr.pause(7)
ctr.A()
ctr.paus... | [
"NXController.Controller"
] | [((43, 55), 'NXController.Controller', 'Controller', ([], {}), '()\n', (53, 55), False, 'from NXController import Controller\n')] |
from spefit.pdf.base import PDFParameter, PDF
from spefit.common.stats import normal_pdf
import numpy as np
from numpy.testing import assert_allclose
import pytest
def test_pdf_parameter():
initial = 1
limits = (0, 4)
fixed = True
multi = True
param = PDFParameter(initial=initial, limits=limits, ... | [
"spefit.pdf.base.PDF.__subclasses__",
"numpy.trapz",
"spefit.pdf.base.PDF",
"spefit.pdf.base.PDF._prepare_parameters",
"spefit.pdf.base.PDFParameter",
"spefit.pdf.base.PDF.from_name",
"pytest.raises",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"numpy.array_equal"
] | [((275, 345), 'spefit.pdf.base.PDFParameter', 'PDFParameter', ([], {'initial': 'initial', 'limits': 'limits', 'fixed': 'fixed', 'multi': 'multi'}), '(initial=initial, limits=limits, fixed=fixed, multi=multi)\n', (287, 345), False, 'from spefit.pdf.base import PDFParameter, PDF\n'), ((493, 537), 'spefit.pdf.base.PDFPara... |
# Copyright 2018 SAP SE
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | [
"json.dumps"
] | [((1745, 1766), 'json.dumps', 'json.dumps', (['json_body'], {}), '(json_body)\n', (1755, 1766), False, 'import json\n'), ((3072, 3093), 'json.dumps', 'json.dumps', (['json_body'], {}), '(json_body)\n', (3082, 3093), False, 'import json\n')] |
"""
Google Documents functionality for the API
"""
import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'credentials.json',
[
'https://www.googleapis.com/auth/spreadsheets',
... | [
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"httplib2.Http"
] | [((178, 346), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['"""credentials.json"""', "['https://www.googleapis.com/auth/spreadsheets',\n 'https://www.googleapis.com/auth/drive']"], {}), "('credentials.json', [\n 'https://www... |
#!/usr/bin/env python3
from flask import Flask
from flask import request
from util import startTunnel, stopTunnel, addressesForInterface
from argparse import ArgumentParser
import logging
app = Flask(__name__)
settings = {}
@app.route("/connect")
def connect():
address = request.remote_addr
logging.info("Con... | [
"util.addressesForInterface",
"flask.Flask",
"util.startTunnel",
"argparse.ArgumentParser"
] | [((196, 211), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (201, 211), False, 'from flask import Flask\n'), ((363, 424), 'util.startTunnel', 'startTunnel', (['address', "settings['localIP']", "settings['bridge']"], {}), "(address, settings['localIP'], settings['bridge'])\n", (374, 424), False, 'from util... |
from string import ascii_letters, digits
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.components import color
from esphome.const import (
CONF_VISIBLE,
)
from . import CONF_NEXTION_ID
from . import Nextion
CONF_VARIABLE_NAME = "variable_name"
CONF_COMPONENT_NAME = "component_nam... | [
"esphome.config_validation.use_id",
"esphome.config_validation.Required",
"esphome.codegen.get_variable",
"esphome.config_validation.int_range",
"esphome.config_validation.Invalid",
"esphome.config_validation.GenerateID",
"esphome.config_validation.Optional"
] | [((1137, 1191), 'esphome.config_validation.Invalid', 'cv.Invalid', (['"""Must be a string less than 29 characters"""'], {}), "('Must be a string less than 29 characters')\n", (1147, 1191), True, 'import esphome.config_validation as cv\n'), ((1507, 1537), 'esphome.config_validation.GenerateID', 'cv.GenerateID', (['CONF_... |
import sys
from koapy.compat.pyside2.QtWidgets import QApplication
from koapy import KiwoomOpenApiPlusQAxWidget
app = QApplication(sys.argv)
control = KiwoomOpenApiPlusQAxWidget()
APIModulePath = control.GetAPIModulePath()
print(APIModulePath)
| [
"koapy.KiwoomOpenApiPlusQAxWidget",
"koapy.compat.pyside2.QtWidgets.QApplication"
] | [((120, 142), 'koapy.compat.pyside2.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (132, 142), False, 'from koapy.compat.pyside2.QtWidgets import QApplication\n'), ((153, 181), 'koapy.KiwoomOpenApiPlusQAxWidget', 'KiwoomOpenApiPlusQAxWidget', ([], {}), '()\n', (179, 181), False, 'from koap... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from uw_canvas import Canvas
from uw_canvas.accounts import ACCOUNTS_API
from uw_canvas.courses import COURSES_API
class ExternalToolsException(Exception):
pass
class ExternalTools(Canvas):
def get_external_tools_in_acco... | [
"uw_canvas.accounts.ACCOUNTS_API.format",
"uw_canvas.courses.COURSES_API.format"
] | [((552, 583), 'uw_canvas.accounts.ACCOUNTS_API.format', 'ACCOUNTS_API.format', (['account_id'], {}), '(account_id)\n', (571, 583), False, 'from uw_canvas.accounts import ACCOUNTS_API\n'), ((1323, 1352), 'uw_canvas.courses.COURSES_API.format', 'COURSES_API.format', (['course_id'], {}), '(course_id)\n', (1341, 1352), Fal... |
from pymarshal.csv import *
import pytest
def test_marshal_unmarshal_list():
class Test:
def __init__(self, a, b):
self.a = a
self.b = b
u = [Test("a", 2), Test("b", 3)]
assert u[0].a == "a", u[0].a
m = marshal_csv(u)
assert m[0][0] == "a", m[0][0]
u = unmarsha... | [
"pytest.raises"
] | [((1742, 1771), 'pytest.raises', 'pytest.raises', (['AttributeError'], {}), '(AttributeError)\n', (1755, 1771), False, 'import pytest\n'), ((2018, 2043), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (2031, 2043), False, 'import pytest\n')] |
# Copyright 2020 Alibaba Group Holding Limited. 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 ... | [
"numpy.asarray",
"tf_euler.python.euler_ops.type_ops.get_edge_type_id",
"tf_euler.python.euler_ops.base.nebula_client.execute_query",
"tensorflow.py_func"
] | [((1686, 1801), 'tensorflow.py_func', 'tf.py_func', (['_nebula_random_walk', '[nodes, edge_types, p, q, default_node]', '[tf.int64]', '(True)', '"""NebulaRandomWalk"""'], {}), "(_nebula_random_walk, [nodes, edge_types, p, q, default_node], [\n tf.int64], True, 'NebulaRandomWalk')\n", (1696, 1801), True, 'import tens... |