code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys,os
import math
import random
#import mpmath
import operator
import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pylab as pyl
import itertools
import scipy as sp
from scipy import stats
from scipy import optimize
from scipy.integrate import quad
#import scikits.statsmodels as sm
... | [
"numpy.array",
"scipy.optimize.fmin",
"scipy.optimize.leastsq"
] | [((7735, 7746), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (7743, 7746), True, 'import numpy as np\n'), ((7755, 7766), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (7763, 7766), True, 'import numpy as np\n'), ((7985, 8036), 'scipy.optimize.leastsq', 'optimize.leastsq', (['f', 'p'], {'maxfev': '(10000)', 'full... |
#!/usr/bin/env python
"""
This is the main setup script for h5py (http://www.h5py.org).
Most of the functionality is provided in two separate modules:
setup_configure, which manages compile-time/Cython-time build options
for h5py, and setup_build, which handles the actual compilation process.
"""
try... | [
"os.path.abspath",
"h5py.run_tests",
"distutils.extension.Extension",
"sys.exit"
] | [((2541, 2576), 'h5py.run_tests', 'h5py.run_tests', ([], {'verbose': 'self.detail'}), '(verbose=self.detail)\n', (2555, 2576), False, 'import h5py\n'), ((4993, 5021), 'distutils.extension.Extension', 'Extension', (['"""h5py.x"""', "['x.c']"], {}), "('h5py.x', ['x.c'])\n", (5002, 5021), False, 'from distutils.extension ... |
#!/usr/bin/env python3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Author: <NAME>, <NAME> & <NAME>
# Copyright 2019, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
"os.path.exists",
"os.makedirs",
"RAiDER.logger.logger.debug",
"RAiDER.logger.logger.error",
"os.getcwd",
"matplotlib.pyplot.close",
"numpy.nanmax",
"numpy.nanmin",
"RAiDER.logger.logger.warning",
"RAiDER.logger.logger.exception",
"RAiDER.utilFcns.getTimeFromFile"
] | [((1085, 1118), 'os.makedirs', 'os.makedirs', (['wmLoc'], {'exist_ok': '(True)'}), '(wmLoc, exist_ok=True)\n', (1096, 1118), False, 'import os\n'), ((3260, 3308), 'RAiDER.logger.logger.debug', 'logger.debug', (['f"""Shape of weather model: {shape}"""'], {}), "(f'Shape of weather model: {shape}')\n", (3272, 3308), False... |
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals
import sys
import string
try:
from tkinter import *
except ImportError:
# Fall back to Python 2 name for module
from Tkinter import *
import subprocess
tkroot = Tk()
class Container:
pass
cont = Container(... | [
"sys.exit"
] | [((5851, 5862), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (5859, 5862), False, 'import sys\n')] |
#!/usr/bin/env python3
'''
Пример для первой лекции про TkInter
Закрытие окошка в постинтерактивном режиме
'''
from tkinter import *
import random
def randomcolor():
colorsymbols = "ABCDEF0123456"
color = "#"
for c in range(6):
color += random.choice(colorsymbols)
return color
def add_button... | [
"random.choice"
] | [((260, 287), 'random.choice', 'random.choice', (['colorsymbols'], {}), '(colorsymbols)\n', (273, 287), False, 'import random\n')] |
import os
from typing import List
from app.common.build_artifact import BuildArtifact
from app.master.atom import AtomState
from app.util.conf.configuration import Configuration
from app.util.log import get_logger
from app.util.pagination import get_paginated_indices
class Subjob(object):
def __init__(self, buil... | [
"app.util.pagination.get_paginated_indices",
"app.util.log.get_logger",
"os.path.exists",
"os.path.join"
] | [((823, 843), 'app.util.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (833, 843), False, 'from app.util.log import get_logger\n'), ((3520, 3567), 'app.util.pagination.get_paginated_indices', 'get_paginated_indices', (['offset', 'limit', 'num_atoms'], {}), '(offset, limit, num_atoms)\n', (3541, 3567... |
#!/usr/bin/python
# vim: set fileencoding=utf-8 :
"""Extract counts of each Köppen-Geiger/slope/land cover/soil health for each country,
for use in Project Drawdown solution models."""
import argparse
import math
import os.path
import pdb
import signal
import sys
import tempfile
import osgeo.gdal
import osgeo.gdal... | [
"signal.signal",
"pdb.Pdb",
"numpy.unique",
"argparse.ArgumentParser",
"numpy.logical_not",
"geoutil.is_sparse",
"pandas.set_option",
"geoutil.km2_block",
"geoutil.blklim",
"sys.exit",
"numpy.ma.masked_array",
"numpy.nansum",
"numpy.seterr",
"numpy.set_printoptions"
] | [((420, 458), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (433, 458), True, 'import pandas as pd\n'), ((459, 499), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(40)'], {}), "('display.max_columns', 40)\n", (472, 499), True, 'im... |
#!/usr/bin/python
import json
import sys
import argparse
#import tabulate
"""
This file is used to generate ip addresses for a given router.
"""
parser = argparse.ArgumentParser(description='Run ip generation algorithm')
parser.add_argument('-f', '--topology_file', type=str, help='give the topology file name (default ... | [
"json.load",
"json.dump",
"argparse.ArgumentParser"
] | [((155, 221), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run ip generation algorithm"""'}), "(description='Run ip generation algorithm')\n", (178, 221), False, 'import argparse\n'), ((482, 502), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (491, 502), False, 'impor... |
'''
migration_195.py
A module that adds fields, relationship classes and data to enable linking between
stations and streams/lakes data.
Accepts a single argument which is a path to the fgdb containing the lakes & streams data.
'''
from os.path import dirname, join
from sys import argv
import arcpy
arcpy.env.works... | [
"arcpy.management.AddField",
"arcpy.Describe",
"os.path.join",
"os.path.dirname",
"arcpy.Exists",
"arcpy.management.CreateRelationshipClass"
] | [((338, 355), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (345, 355), False, 'from os.path import dirname, join\n'), ((632, 725), 'arcpy.management.AddField', 'arcpy.management.AddField', (['"""Stations"""', 'water_id_field'], {'field_type': '"""TEXT"""', 'field_length': '(40)'}), "('Stations', wa... |
import tensorflow as tf
from nn_basic_layers import *
from filterbank_shape import FilterbankShape
from ops import *
class Naive_Fusion_Net(object):
def __init__(self, config):
# Placeholders for input, output and dropout
self.config = config
self.input_x1 = tf.placeholder(tf.float32,shape... | [
"tensorflow.reduce_sum",
"tensorflow.multiply",
"tensorflow.truncated_normal_initializer",
"tensorflow.cast",
"filterbank_shape.FilterbankShape",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.concat",
"tensorflow.matmul",
"tensorflow.trainable_variables",
"tensorflow.device",... | [((289, 424), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, self.config.epoch_seq_len, self.config.deep_ntime, self.config.nchannel]', 'name': '"""input_x1"""'}), "(tf.float32, shape=[None, self.config.epoch_seq_len, self.\n config.deep_ntime, self.config.nchannel], name='input_x1')\... |
# coding=utf-8
# Copyright 2020 The Microsoft Authors and The HuggingFace Inc. team.
#
# 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
#
# Unl... | [
"torch.triu",
"apex.normalization.FusedProphetNetLayerNorm",
"math.log",
"torch.cuda.is_available",
"copy.deepcopy",
"torch.bmm",
"torch.nn.functional.softmax",
"torch.arange",
"torch.nn.LayerNorm",
"torch.zeros_like",
"torch.gather",
"torch.nn.Embedding",
"torch.ones_like",
"torch.abs",
... | [((9520, 9563), 'torch.lt', 'torch.lt', (['inv_relative_positions', 'max_exact'], {}), '(inv_relative_positions, max_exact)\n', (9528, 9563), False, 'import torch\n'), ((31905, 31930), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (31928, 31930), False, 'import torch\n'), ((32157, 32218), 'tor... |
import pymongo
from vanilla.uix.db.database import connect, get_all
def providers():
conn = connect()
all_ = get_all(conn)
pro = set([prov['provider'] for prov in all_])
return [{'count': conn.posts.find({'provider': p}).count(), 'provider': p, 'last':
[date['script_ex_day'] for date in conn.... | [
"vanilla.uix.db.database.get_all",
"vanilla.uix.db.database.connect"
] | [((98, 107), 'vanilla.uix.db.database.connect', 'connect', ([], {}), '()\n', (105, 107), False, 'from vanilla.uix.db.database import connect, get_all\n'), ((119, 132), 'vanilla.uix.db.database.get_all', 'get_all', (['conn'], {}), '(conn)\n', (126, 132), False, 'from vanilla.uix.db.database import connect, get_all\n')] |
from bs4 import BeautifulSoup
import pickle
from reader import Packet
with open('res\SciBowl.txt', 'r') as f:
ht = f.read()
soup = BeautifulSoup(ht)
group = 0
prefix = "https://science.osti.gov"
for ul in soup.find_all('ul'):
group += 1
rnd = 0
for li in ul.find_all('li'):
... | [
"bs4.BeautifulSoup",
"pickle.dump",
"reader.Packet"
] | [((140, 157), 'bs4.BeautifulSoup', 'BeautifulSoup', (['ht'], {}), '(ht)\n', (153, 157), False, 'from bs4 import BeautifulSoup\n'), ((406, 417), 'reader.Packet', 'Packet', (['url'], {}), '(url)\n', (412, 417), False, 'from reader import Packet\n'), ((512, 531), 'pickle.dump', 'pickle.dump', (['p', 'out'], {}), '(p, out)... |
"""--- Day 20: Trench Map ---"""
from pathlib import Path
from bitarray import bitarray
from bitarray.util import ba2int
from numpy import array
from numpy import byte
from numpy import ones
from numpy import sum as sum_
from numpy import zeros
from aoc import open_utf8
M_RANGE = 3 // 2 # Algorithm horizontal searc... | [
"numpy.ones",
"aoc.open_utf8",
"numpy.sum",
"numpy.zeros",
"bitarray.bitarray"
] | [((1422, 1497), 'numpy.zeros', 'zeros', (['(initial_rows + 2 * M_RANGE, initial_cols + 2 * N_RANGE)'], {'dtype': 'byte'}), '((initial_rows + 2 * M_RANGE, initial_cols + 2 * N_RANGE), dtype=byte)\n', (1427, 1497), False, 'from numpy import zeros\n'), ((2898, 2909), 'numpy.sum', 'sum_', (['image'], {}), '(image)\n', (290... |
"""Core authentication logic."""
from enum import Enum
from importlib import import_module
from typing import List, Tuple
from gino.declarative import Model
from jwcrypto.jwe import JWE, InvalidJWEData
from jwcrypto.jwk import JWK
from jwcrypto.jws import InvalidJWSObject, InvalidJWSSignature
from passlib.context imp... | [
"turbulette.conf.settings.SECRET_KEY.items",
"turbulette.conf.settings.AUTH_USER_MODEL.rsplit",
"jwcrypto.jwe.JWE",
"passlib.context.CryptContext",
"python_jwt.process_jwt",
"turbulette.conf.settings.ENCRYPTION_KEY.items",
"turbulette.cache.cache.set",
"python_jwt.generate_jwt",
"python_jwt.verify_j... | [((728, 794), 'passlib.context.CryptContext', 'CryptContext', ([], {'schemes': '[settings.HASH_ALGORITHM]', 'deprecated': '"""auto"""'}), "(schemes=[settings.HASH_ALGORITHM], deprecated='auto')\n", (740, 794), False, 'from passlib.context import CryptContext\n'), ((3129, 3234), 'python_jwt.generate_jwt', 'generate_jwt'... |
import socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host=socket.gethostname()
port=9991
s.connect((host,port))
while True:
print("Client:",end=' ')
data=str(input())
temp=data
s.sendall(bytearray(data,'utf-8'))
if temp.lower()=='bye':
break
data=s.recv(1024)
print... | [
"socket.gethostname",
"socket.socket"
] | [((16, 65), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (29, 65), False, 'import socket\n'), ((70, 90), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (88, 90), False, 'import socket\n')] |
import os
import posixpath
from pystac.errors import RequiredPropertyMissing
from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
from urllib.parse import urlparse, ParseResult as URLParseResult
from datetime import datetime, timezone
import dateutil.parser
# Allow for modifying the path library for ... | [
"posixpath.join",
"urllib.parse.urlparse",
"os.getcwd",
"pystac.errors.RequiredPropertyMissing",
"typing.TypeVar"
] | [((6751, 6763), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (6758, 6763), False, 'from typing import Any, Callable, Dict, List, Optional, TypeVar, Union\n'), ((6768, 6780), 'typing.TypeVar', 'TypeVar', (['"""U"""'], {}), "('U')\n", (6775, 6780), False, 'from typing import Any, Callable, Dict, List, Optio... |
# Import libraries
import RPi.GPIO as GPIO
import random
import ES2EEPROMUtils
import os
import time
# some global variables that need to change as we run the program
end_of_game = None # set if the user wins or ends the game
# DEFINE THE PINS USED HERE
LED_value = [11, 13, 15] #definining the pins of the LED to sho... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.add_event_detect",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"RPi.GPIO.PWM",
"RPi.GPIO.input",
"ES2EEPROMUtils.ES2EEPROM",
"os.system",
"time.time",
"RPi.GPIO.setmode"
] | [((643, 669), 'ES2EEPROMUtils.ES2EEPROM', 'ES2EEPROMUtils.ES2EEPROM', ([], {}), '()\n', (667, 669), False, 'import ES2EEPROMUtils\n'), ((713, 731), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (722, 731), False, 'import os\n'), ((3404, 3418), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([], {}), '()\n', (341... |
from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
PasswordField,
SelectField,
StringField,
SubmitField,
ValidationError,
)
from wtforms.validators import DataRequired, Email, EqualTo, Length, Regexp
from pili.jinja_filters import permissions2str
from pili.models import Role, U... | [
"wtforms.validators.Email",
"pili.models.Role.query.order_by",
"wtforms.BooleanField",
"wtforms.ValidationError",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"pili.models.User.query.filter_by",
"pili.jinja_filters.permissions2str",
"wtforms.validators.Length",
"wtforms.validators.Regexp",... | [((528, 561), 'wtforms.BooleanField', 'BooleanField', (['"""Keep me logged in"""'], {}), "('Keep me logged in')\n", (540, 561), False, 'from wtforms import BooleanField, PasswordField, SelectField, StringField, SubmitField, ValidationError\n'), ((575, 596), 'wtforms.SubmitField', 'SubmitField', (['"""Log In"""'], {}), ... |
"""Create dataset from MonogDB"""
# Author: <NAME>
# Created: 31/01/2020
# Last Updated: 20/02/2020
import datatable as dt
import pandas as pd
from h2oaicore.data import CustomData
_global_modules_needed_by_name = ["pymongo", "dnspython"]
# Please fill before usage
# Note that this information is logged in Driverle... | [
"pymongo.MongoClient",
"datatable.Frame",
"pandas.DataFrame.from_dict"
] | [((964, 1000), 'pymongo.MongoClient', 'MongoClient', (['MONGO_CONNECTION_STRING'], {}), '(MONGO_CONNECTION_STRING)\n', (975, 1000), False, 'from pymongo import MongoClient\n'), ((1328, 1356), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['docs'], {}), '(docs)\n', (1350, 1356), True, 'import pandas as pd\n')... |
import numpy as np
def converge_aitken_series(f, n_start=0, f_startm1=0, eps=1e-6, max_iter=-1, min_consec=2):
"""Finds the limit of a series using Aitken acceleration
an = converge_aitken_series(f, n_start, f_startm1)
where f(n, fp) returns the nth member of the sequence given the n-1th
member e.g. to... | [
"numpy.isinf",
"numpy.asarray",
"numpy.isnan"
] | [((765, 778), 'numpy.asarray', 'np.asarray', (['a'], {}), '(a)\n', (775, 778), True, 'import numpy as np\n'), ((794, 805), 'numpy.isnan', 'np.isnan', (['a'], {}), '(a)\n', (802, 805), True, 'import numpy as np\n'), ((848, 859), 'numpy.isinf', 'np.isinf', (['a'], {}), '(a)\n', (856, 859), True, 'import numpy as np\n'), ... |
#!/usr/bin/env python
import datetime
import logging
import os
import re
from urllib.parse import urljoin
from utils import utils, inspector, admin
# https://www.archives.gov/oig/
archive = 2005
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
# - List more tha... | [
"datetime.datetime",
"logging.debug",
"utils.inspector.save_report",
"re.compile",
"datetime.datetime.strptime",
"utils.admin.log_no_date",
"datetime.datetime.strftime",
"os.path.splitext",
"utils.utils.scraper.request",
"utils.utils.beautifulsoup_from_url",
"utils.inspector.year_range",
"urll... | [((661, 691), 'datetime.datetime', 'datetime.datetime', (['(2014)', '(4)', '(30)'], {}), '(2014, 4, 30)\n', (678, 691), False, 'import datetime\n'), ((728, 758), 'datetime.datetime', 'datetime.datetime', (['(2017)', '(3)', '(15)'], {}), '(2017, 3, 15)\n', (745, 758), False, 'import datetime\n'), ((784, 815), 'datetime.... |
import numpy as np
import pyrado
from pyrado.spaces.base import Space
from pyrado.utils.data_types import EnvSpec
from pyrado.tasks.base import Task
from pyrado.tasks.reward_functions import RewFcn, ZeroPerStepRewFcn, MinusOnePerStepRewFcn, PlusOnePerStepRewFcn
class DesSpaceTask(Task):
"""
Task class for mo... | [
"pyrado.ShapeErr",
"pyrado.TypeErr"
] | [((1074, 1127), 'pyrado.TypeErr', 'pyrado.TypeErr', ([], {'given': 'env_spec', 'expected_type': 'EnvSpec'}), '(given=env_spec, expected_type=EnvSpec)\n', (1088, 1127), False, 'import pyrado\n'), ((1191, 1243), 'pyrado.TypeErr', 'pyrado.TypeErr', ([], {'given': 'space_des', 'expected_type': 'Space'}), '(given=space_des,... |
from google.cloud import storage
import os
from datetime import datetime
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
import googlemaps
from time import time
import numpy as np
import cv2
# Fetch the service account key JSON file contents
try:
cred = credentials.Certif... | [
"firebase_admin.db.reference",
"google.cloud.storage.Client",
"cv2.imencode",
"firebase_admin.initialize_app",
"googlemaps.Client",
"datetime.datetime.now",
"firebase_admin.credentials.Certificate",
"numpy.random.uniform",
"time.time"
] | [((701, 730), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': 'appkey'}), '(key=appkey)\n', (718, 730), False, 'import googlemaps\n'), ((302, 396), 'firebase_admin.credentials.Certificate', 'credentials.Certificate', (['"""../smart-waste-locator-firebase-adminsdk-ljjzx-495a7e327a.json"""'], {}), "(\n '../smar... |
import json
import os
import sys
from collections import defaultdict
if len(sys.argv) != 2:
print('Usage: {} directory'.format(sys.argv[0]))
sys.exit(0)
parent_dir = sys.argv[1]
if not os.path.isdir(parent_dir):
print('Directory {} not found!'.format(parent_dir))
sys.exit(0)
os.chdir(parent_dir)
f... | [
"os.listdir",
"os.chdir",
"os.path.isdir",
"collections.defaultdict",
"sys.exit",
"json.dump"
] | [((297, 317), 'os.chdir', 'os.chdir', (['parent_dir'], {}), '(parent_dir)\n', (305, 317), False, 'import os\n'), ((151, 162), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (159, 162), False, 'import sys\n'), ((197, 222), 'os.path.isdir', 'os.path.isdir', (['parent_dir'], {}), '(parent_dir)\n', (210, 222), False, 'imp... |
#! python3
import re
import collections
import xml.etree.ElementTree as ET
class Device():
def __init__(self, name):
self.name = name
self.cpu = Cpu()
self.peripherals = {}
@property
def children(self):
return self.peripherals
def __str__(self):
... | [
"collections.OrderedDict",
"xml.etree.ElementTree.parse"
] | [((723, 748), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (746, 748), False, 'import collections\n'), ((1343, 1368), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1366, 1368), False, 'import collections\n'), ((2585, 2610), 'collections.OrderedDict', 'collections.Or... |
from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_equal, assert_array_almost_equal_nulp)
import numpy as np
import pytest
import matplotlib.mlab as mlab
from matplotlib.cbook.deprecation import MatplotlibDeprecationWarning
def _stride_repeat(*args, **kw... | [
"numpy.random.standard_normal",
"matplotlib.mlab.detrend_linear",
"matplotlib.mlab.specgram",
"numpy.iterable",
"numpy.prod",
"matplotlib.mlab._single_spectrum_helper",
"numpy.array",
"pytest.fixture",
"numpy.sin",
"matplotlib.mlab.psd",
"numpy.arange",
"matplotlib.mlab.apply_window",
"numpy... | [((32566, 32661), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""iscomplex"""', '[False, True]'], {'ids': "['real', 'complex']", 'scope': '"""class"""'}), "('iscomplex', [False, True], ids=['real', 'complex'],\n scope='class')\n", (32589, 32661), False, 'import pytest\n'), ((32686, 32775), 'pytest.mark.... |
from flask import Flask, request, render_template
import os
import random
import redis
import socket
import sys
import logging
from datetime import datetime
# App Insights
from opencensus.ext.azure.log_exporter import AzureLogHandler
from opencensus.ext.azure.log_exporter import AzureEventHandler
from opencensus.ext.a... | [
"logging.getLogger",
"opencensus.ext.azure.trace_exporter.AzureExporter",
"flask.Flask",
"opencensus.ext.azure.log_exporter.AzureLogHandler",
"logging.Formatter",
"opencensus.trace.samplers.ProbabilitySampler",
"redis.Redis",
"opencensus.ext.azure.log_exporter.AzureEventHandler",
"opencensus.ext.azu... | [((993, 1020), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1010, 1020), False, 'import logging\n'), ((1031, 1092), 'opencensus.ext.azure.log_exporter.AzureLogHandler', 'AzureLogHandler', ([], {'connection_string': '"""InstrumentationKey=<KEY>"""'}), "(connection_string='Instrumentatio... |
from opera.parser.yaml.node import Node
from .constraint_clause import ConstraintClause
from .property_definition import PropertyDefinition
from ..entity import TypeEntity
from ..list import List
from ..map import Map
from ..reference import DataTypeReference
class DataType(TypeEntity):
REFERENCE = DataTypeRefere... | [
"opera.parser.yaml.node.Node"
] | [((945, 970), 'opera.parser.yaml.node.Node', 'Node', (['data', 'yaml_node.loc'], {}), '(data, yaml_node.loc)\n', (949, 970), False, 'from opera.parser.yaml.node import Node\n'), ((857, 877), 'opera.parser.yaml.node.Node', 'Node', (['"""derived_from"""'], {}), "('derived_from')\n", (861, 877), False, 'from opera.parser.... |
"""
A Class for generating QIcons from SVGs with arbitrary colors at runtime.
"""
from functools import lru_cache
from typing import Optional, Union
from qtpy.QtCore import QByteArray, QPoint, QRect, QRectF, Qt
from qtpy.QtGui import QIcon, QIconEngine, QImage, QPainter, QPixmap
from qtpy.QtSvg import QSvgRenderer
c... | [
"qtpy.QtGui.QPainter",
"qtpy.QtCore.QByteArray",
"qtpy.QtGui.QPixmap.fromImage",
"qtpy.QtCore.QPoint",
"functools.lru_cache",
"qtpy.QtSvg.QSvgRenderer",
"qtpy.QtGui.QImage",
"qtpy.QtCore.QRectF"
] | [((1729, 1740), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (1738, 1740), False, 'from functools import lru_cache\n'), ((2935, 2946), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (2944, 2946), False, 'from functools import lru_cache\n'), ((4187, 4202), 'qtpy.QtCore.QByteArray', 'QByteArray', (['xml']... |
import os
import pathlib
import pytest
from pyzzy.utils import (
fspath,
is_dir,
is_file,
search_files,
set_working_directory,
)
@pytest.fixture
def temp_dir(tmpdir):
"""Create temporary directory tree structure used for the tests
<temp_dir>
|-- src/
| |-- ... | [
"pyzzy.utils.search_files",
"pathlib.Path",
"pyzzy.utils.set_working_directory",
"pyzzy.utils.is_file",
"pyzzy.utils.is_dir",
"os.path.abspath"
] | [((1350, 1372), 'pyzzy.utils.search_files', 'search_files', (['temp_dir'], {}), '(temp_dir)\n', (1362, 1372), False, 'from pyzzy.utils import fspath, is_dir, is_file, search_files, set_working_directory\n'), ((1751, 1787), 'pyzzy.utils.search_files', 'search_files', (['temp_dir'], {}), '(temp_dir, **parameters)\n', (17... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.6.0-bd605d07 on 2018-12-20.
# 2018, SMART Health IT.
import os
import io
import unittest
import json
from . import medicinalproductcontraindication
from .fhirdate import FHIRDate
class MedicinalProductContraindicationTests(unittest.TestCase):... | [
"json.load",
"os.environ.get",
"os.path.join"
] | [((381, 420), 'os.environ.get', 'os.environ.get', (['"""FHIR_UNITTEST_DATADIR"""'], {}), "('FHIR_UNITTEST_DATADIR')\n", (395, 420), False, 'import os\n'), ((532, 549), 'json.load', 'json.load', (['handle'], {}), '(handle)\n', (541, 549), False, 'import json\n'), ((448, 479), 'os.path.join', 'os.path.join', (['datadir',... |
import random
import time
import warnings
import sys
import argparse
import shutil
import os.path as osp
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.optim import SGD
from torch.optim.lr_scheduler import LambdaLR
from torch.utils.data import DataLoader
import torchvision.transform... | [
"common.utils.meter.AverageMeter",
"torch.nn.Sequential",
"dalib.adaptation.dann.ImageClassifier",
"common.utils.data.ForeverDataIterator",
"torch.cuda.is_available",
"common.utils.analysis.a_distance.calculate",
"sys.path.append",
"dalib.adaptation.dann.DomainAdversarialLoss",
"argparse.ArgumentPar... | [((360, 385), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (375, 385), False, 'import sys\n'), ((1090, 1126), 'common.utils.logger.CompleteLogger', 'CompleteLogger', (['args.log', 'args.phase'], {}), '(args.log, args.phase)\n', (1104, 1126), False, 'from common.utils.logger import Compl... |
# Code for "ActionCLIP: ActionCLIP: A New Paradigm for Action Recognition"
# arXiv:
# <NAME>, <NAME>, <NAME>
import torch.nn.functional as F
import torch.nn as nn
class KLLoss(nn.Module):
"""Loss that uses a 'hinge' on the lower bound.
This means that for samples with a label value smaller than the t... | [
"torch.nn.KLDivLoss",
"torch.nn.functional.softmax",
"torch.nn.functional.log_softmax"
] | [((640, 684), 'torch.nn.KLDivLoss', 'nn.KLDivLoss', ([], {'size_average': '(True)', 'reduce': '(True)'}), '(size_average=True, reduce=True)\n', (652, 684), True, 'import torch.nn as nn\n'), ((962, 990), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['prediction', '(1)'], {}), '(prediction, 1)\n', (975, 990), Tru... |
# django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 <NAME>
# Copyright (C) 2008-2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source... | [
"os.path.dirname",
"os.path.join"
] | [((1796, 1821), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1811, 1821), False, 'import os\n'), ((4333, 4369), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""db.sqlite3"""'], {}), "(BASE_DIR, 'db.sqlite3')\n", (4345, 4369), False, 'import os\n')] |
from manimlib.constants import *
from manimlib.mobject.types.vectorized_mobject import VMobject
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib.utils.rate_functions import smooth
from manimlib.utils.space_ops import get_norm
class AnimatedBoundary(VGroup):
CONFIG = {
"colors": [... | [
"manimlib.utils.space_ops.get_norm"
] | [((3061, 3102), 'manimlib.utils.space_ops.get_norm', 'get_norm', (['(new_point - self.points[-nppcc])'], {}), '(new_point - self.points[-nppcc])\n', (3069, 3102), False, 'from manimlib.utils.space_ops import get_norm\n')] |
"""
The Kinetics700 dataset.
Note that the setting for the data loader is obtained from the github repo provided by the official workers:
https://github.com/pytorch/vision/references/video_classification/train.py
"""
import json
import logging
import os
import sys
from torch.utils.data.dataloader import default_coll... | [
"os.path.exists",
"os.listdir",
"plato.datasources.datalib.video_transform.VideoClassificationTrainTransformer",
"plato.datasources.datalib.parallel_downloader.VideoDownloaderPool",
"os.path.join",
"torchvision.datasets.Kinetics400",
"plato.datasources.datalib.video_transform.VideoClassificationEvalTran... | [((1077, 1131), 'os.path.join', 'os.path.join', (['self.source_data_path', 'download_dir_name'], {}), '(self.source_data_path, download_dir_name)\n', (1089, 1131), False, 'import os\n'), ((1528, 1582), 'os.path.join', 'os.path.join', (['self.source_data_path', '"""categories.json"""'], {}), "(self.source_data_path, 'ca... |
import pytest
import shlex
import subprocess
import time
import fsspec
pytest.importorskip("paramiko")
def stop_docker(name):
cmd = shlex.split('docker ps -a -q --filter "name=%s"' % name)
cid = subprocess.check_output(cmd).strip().decode()
if cid:
subprocess.call(["docker", "rm", "-f", cid])
@... | [
"subprocess.check_output",
"subprocess.check_call",
"shlex.split",
"time.sleep",
"pytest.mark.parametrize",
"pytest.importorskip",
"pytest.raises",
"subprocess.call",
"pytest.fixture",
"fsspec.get_filesystem_class",
"pytest.skip"
] | [((72, 103), 'pytest.importorskip', 'pytest.importorskip', (['"""paramiko"""'], {}), "('paramiko')\n", (91, 103), False, 'import pytest\n'), ((320, 350), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (334, 350), False, 'import pytest\n'), ((2127, 2179), 'pytest.mark.parametr... |
import pytest
from napkin import sd
from napkin import sd_action
class TestParams:
def test_empty(self):
assert "" == str(sd.Params(tuple(), dict()))
def test_args(self):
assert "abc, def" == str(sd.Params(('abc', 'def'), dict()))
def test_args_kargs(self):
assert "abc, foo=1" =... | [
"napkin.sd_action.ImplicitReturn",
"napkin.sd_action.Note",
"napkin.sd.Context",
"pytest.raises",
"napkin.sd.Params"
] | [((705, 717), 'napkin.sd.Context', 'sd.Context', ([], {}), '()\n', (715, 717), False, 'from napkin import sd\n'), ((999, 1011), 'napkin.sd.Context', 'sd.Context', ([], {}), '()\n', (1009, 1011), False, 'from napkin import sd\n'), ((1423, 1435), 'napkin.sd.Context', 'sd.Context', ([], {}), '()\n', (1433, 1435), False, '... |
from dame._utils import init_logger, get_latest_version
def test_init_logger():
init_logger()
def test_get_latest_version():
assert get_latest_version()
| [
"dame._utils.init_logger",
"dame._utils.get_latest_version"
] | [((86, 99), 'dame._utils.init_logger', 'init_logger', ([], {}), '()\n', (97, 99), False, 'from dame._utils import init_logger, get_latest_version\n'), ((144, 164), 'dame._utils.get_latest_version', 'get_latest_version', ([], {}), '()\n', (162, 164), False, 'from dame._utils import init_logger, get_latest_version\n')] |
# @Author: Ivan
# @LastEdit: 2020/9/25
import os
import random
import cv2 # install
import numpy as np # install
def load_img_from_folder(root, nb_classes, nb_per_class, width, height, depth, train_proportion, valid_proportion,
test_proportion, shuffle=True, rescale=True, normalize=True):
... | [
"cv2.imwrite",
"numpy.fromfile",
"os.listdir",
"random.shuffle",
"os.rename",
"os.path.join",
"numpy.asarray",
"cv2.medianBlur",
"numpy.array",
"numpy.ndarray.flatten",
"os.path.isdir",
"cv2.cvtColor",
"cv2.resize",
"cv2.imread",
"os.remove"
] | [((2090, 2106), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (2100, 2106), False, 'import os\n'), ((4370, 4407), 'numpy.array', 'np.array', (['train_data'], {'dtype': '"""float32"""'}), "(train_data, dtype='float32')\n", (4378, 4407), True, 'import numpy as np\n'), ((4426, 4462), 'numpy.array', 'np.array', (... |
#!/usr/bin/env python3
import sys
import os
import re
import texts
import shutil
import datetime
import subprocess
from python_terraform import *
from functions import (
gen_whitelist
)
# Global Variables------------------------------------------------------------------------------------
opr = ""
quest_id = ""
us... | [
"os.path.exists",
"os.makedirs",
"shutil.move",
"subprocess.Popen",
"os.path.isfile",
"datetime.datetime.now",
"shutil.copytree",
"os.path.isdir",
"sys.exit",
"re.findall",
"functions.gen_whitelist"
] | [((438, 461), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (459, 461), False, 'import datetime\n'), ((855, 865), 'sys.exit', 'sys.exit', ([], {}), '()\n', (863, 865), False, 'import sys\n'), ((6913, 6951), 'os.path.isfile', 'os.path.isfile', (['"""./hazprone_state.txt"""'], {}), "('./hazprone_sta... |
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
alpha = 0.5
beta = 0.2
b = np.array( [ 1 - alpha, 0, -( 1 - alpha ) ] )
a = np.array( [ 2, -2 * beta * ( 1 + alpha ), 2 * alpha ] )
w, H = signal.freqz( b, a )
H1 = abs( H )
alpha = 0.5
beta = 0.5
b = np.array( [ 1 - alpha, 0, -( 1 - alp... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"scipy.signal.freqz",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((109, 147), 'numpy.array', 'np.array', (['[1 - alpha, 0, -(1 - alpha)]'], {}), '([1 - alpha, 0, -(1 - alpha)])\n', (117, 147), True, 'import numpy as np\n'), ((158, 207), 'numpy.array', 'np.array', (['[2, -2 * beta * (1 + alpha), 2 * alpha]'], {}), '([2, -2 * beta * (1 + alpha), 2 * alpha])\n', (166, 207), True, 'imp... |
# Copyright (c) Facebook, Inc. and its affiliates.
import gc
import logging
import warnings
from abc import ABC
from typing import Any, Dict
import torch
from mmf.common.registry import registry
from mmf.common.report import Report
from mmf.common.sample import to_device
from mmf.utils.general import clip_gradients
f... | [
"logging.getLogger",
"torch.autograd.set_detect_anomaly",
"mmf.common.report.Report",
"mmf.common.registry.registry.register",
"mmf.utils.general.clip_gradients",
"gc.collect",
"warnings.warn",
"torch.cuda.empty_cache",
"torch.device"
] | [((355, 382), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (372, 382), False, 'import logging\n'), ((608, 678), 'torch.autograd.set_detect_anomaly', 'torch.autograd.set_detect_anomaly', (['self.training_config.detect_anomaly'], {}), '(self.training_config.detect_anomaly)\n', (641, 678),... |
# Copyright (c) 2014 OpenStack Foundation
# 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 ... | [
"oslo_config.cfg.FloatOpt",
"cinder.db.volume_data_get_for_host"
] | [((1104, 1262), 'oslo_config.cfg.FloatOpt', 'cfg.FloatOpt', (['"""volume_number_multiplier"""'], {'default': '(-1.0)', 'help': '"""Multiplier used for weighing volume number. Negative numbers mean to spread vs stack."""'}), "('volume_number_multiplier', default=-1.0, help=\n 'Multiplier used for weighing volume numb... |
#!/usr/bin/env python
from __future__ import absolute_import
"""Unit tests for M2Crypto.RSA.
Copyright (c) 2000 <NAME>. All rights reserved."""
import hashlib
import logging
import os
try:
import unittest2 as unittest
except ImportError:
import unittest
from M2Crypto import BIO, RSA, Rand, X509, m2, six
fr... | [
"logging.getLogger",
"M2Crypto.m2.rsa_set_n",
"M2Crypto.m2.rsa_new",
"unittest.makeSuite",
"unittest.skipIf",
"M2Crypto.Rand.load_file",
"M2Crypto.X509.load_cert",
"hashlib.sha1",
"unittest.TextTestRunner",
"os.remove",
"M2Crypto.m2.rsa_get_e",
"M2Crypto.m2.rsa_set_en",
"M2Crypto.m2.rsa_set_... | [((358, 387), 'logging.getLogger', 'logging.getLogger', (['"""test_RSA"""'], {}), "('test_RSA')\n", (375, 387), False, 'import logging\n'), ((1244, 1307), 'unittest.skipIf', 'unittest.skipIf', (['six.PY3', '"""test_loadkey_pp hangs under python3"""'], {}), "(six.PY3, 'test_loadkey_pp hangs under python3')\n", (1259, 13... |
from sqlalchemy import Column, ForeignKey, Integer, String, DateTime
from sqlalchemy.orm import relationship
import datetime
# Backtrack to parent dir to prevent import problems
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(current... | [
"sqlalchemy.orm.relationship",
"models.base.Base.metadata.create_all",
"inspect.currentframe",
"sqlalchemy.ForeignKey",
"os.sys.path.insert",
"os.path.dirname",
"sqlalchemy.String",
"datetime.datetime.now",
"config.setup.engine.has_table",
"sqlalchemy.Column"
] | [((297, 324), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (312, 324), False, 'import os, inspect\n'), ((325, 357), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (343, 357), False, 'import os, inspect\n'), ((518, 571), 'sqlalchemy.Column', '... |
__author__ = 'CFPB Labs'
import time
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.webd... | [
"time.sleep"
] | [((3224, 3237), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (3234, 3237), False, 'import time\n'), ((4572, 4587), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (4582, 4587), False, 'import time\n'), ((4665, 4678), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (4675, 4678), False, 'import time\n'... |
"""Base module for generating javascript Angular application."""
import datetime
import re
from textx import generator
from textxjinja import textx_jinja_generator
from os import mkdir, getcwd
from os.path import dirname, exists, join
from sbag.language import Entity, BaseType
from sbag.generators.java import get_type ... | [
"os.path.exists",
"textxjinja.textx_jinja_generator",
"os.path.join",
"sbag.generators.java.setup_custom_paths_for_generation",
"os.getcwd",
"textx.generator",
"os.path.dirname",
"sbag.generators.java.create_imports_for_models",
"datetime.datetime.now",
"os.mkdir",
"re.sub",
"sbag.generators.f... | [((2509, 2540), 'textx.generator', 'generator', (['"""sbag"""', '"""javascript"""'], {}), "('sbag', 'javascript')\n", (2518, 2540), False, 'from textx import generator\n'), ((1547, 1586), 're.sub', 're.sub', (['"""(\\\\w)([A-Z])"""', '"""\\\\1 \\\\2"""', 'prop'], {}), "('(\\\\w)([A-Z])', '\\\\1 \\\\2', prop)\n", (1553,... |
#!/usr/bin/env python3
# Copyright (c) 2016 <NAME>
#
# This script generates the nodeset for a memory macro.
import sys, argparse
from potstill import nodeset
# Parse the command line arguments.
parser = argparse.ArgumentParser(prog="potstill make-nodeset", description="Generate the nodeset for a memory macro.")
par... | [
"potstill.nodeset.generate",
"argparse.ArgumentParser"
] | [((207, 321), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""potstill make-nodeset"""', 'description': '"""Generate the nodeset for a memory macro."""'}), "(prog='potstill make-nodeset', description=\n 'Generate the nodeset for a memory macro.')\n", (230, 321), False, 'import sys, argparse\n... |
"""
OpenID Connect relying party (RP) utilities
===========================================
This modules defines utilities allowing to manipulate ID tokens and other common helpers.
"""
import logging
import datetime as dt
from calendar import timegm
from urllib.parse import urlparse, urljoin
from djang... | [
"urllib.parse.urlparse",
"jwkest.jwk.KEYS",
"datetime.datetime.utcnow",
"jwkest.jws.JWS",
"django.utils.encoding.force_bytes",
"urllib.parse.urljoin",
"django.utils.encoding.smart_bytes",
"django.core.exceptions.SuspiciousOperation"
] | [((2162, 2168), 'jwkest.jwk.KEYS', 'KEYS', ([], {}), '()\n', (2166, 2168), False, 'from jwkest.jwk import KEYS\n'), ((2854, 2879), 'urllib.parse.urlparse', 'urlparse', (["id_token['iss']"], {}), "(id_token['iss'])\n", (2862, 2879), False, 'from urllib.parse import urlparse, urljoin\n'), ((2906, 2950), 'urllib.parse.url... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from gaiatest import GaiaTestCase
from gaiatest.apps.homescreen.app import Homescreen
from marionette.by import By
cla... | [
"gaiatest.apps.homescreen.app.Homescreen",
"gaiatest.GaiaTestCase.setUp"
] | [((589, 613), 'gaiatest.GaiaTestCase.setUp', 'GaiaTestCase.setUp', (['self'], {}), '(self)\n', (607, 613), False, 'from gaiatest import GaiaTestCase\n'), ((766, 793), 'gaiatest.apps.homescreen.app.Homescreen', 'Homescreen', (['self.marionette'], {}), '(self.marionette)\n', (776, 793), False, 'from gaiatest.apps.homescr... |
from py_client.aidm.aidm_base_classes import _HasDebugString
from py_client.aidm.aidm_time_window_classes import TimeWindow
class AlgorithmNodeTrackClosure(_HasDebugString):
__node_id: int
__node_track_id: int
__closure_time_window: TimeWindow
def __init__(self, debug_string: str, node_id: i... | [
"py_client.aidm.aidm_base_classes._HasDebugString.__init__"
] | [((387, 431), 'py_client.aidm.aidm_base_classes._HasDebugString.__init__', '_HasDebugString.__init__', (['self', 'debug_string'], {}), '(self, debug_string)\n', (411, 431), False, 'from py_client.aidm.aidm_base_classes import _HasDebugString\n'), ((1371, 1415), 'py_client.aidm.aidm_base_classes._HasDebugString.__init__... |
import datetime
from enum import Enum
from typing import Dict, List
from dataclasses import field
# we use pydantic for dataclasses so that we can
# easily load and validate JSON reports.
#
# pydantic checks all the JSON fields look as they should
# while using the nice and familiar dataclass syntax.
#
# really, you s... | [
"datetime.datetime.now",
"dataclasses.field",
"pydantic.dataclasses.dataclass"
] | [((416, 438), 'pydantic.dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (425, 438), False, 'from pydantic.dataclasses import dataclass\n'), ((1892, 1914), 'pydantic.dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1901, 1914), False, 'from pydantic... |
import ast
import sqlite3
import sys
import traceback
import unittest
from io import StringIO
from time import sleep
from unittest import mock
from littleutils import SimpleNamespace, only
import sorcery as spells
from sorcery import unpack_keys, unpack_attrs, print_args, magic_kwargs, maybe, args_with_source, spell
... | [
"littleutils.SimpleNamespace",
"sorcery.select_from",
"sorcery.print_args",
"sorcery.args_with_source",
"time.sleep",
"sorcery.unpack_keys",
"sys.stdout.getvalue",
"unittest.main",
"unittest.mock.patch",
"sorcery.maybe",
"sorcery.dict_of",
"sorcery.delegate_to_attr",
"sorcery.switch",
"io.... | [((807, 838), 'sorcery.delegate_to_attr', 'spells.delegate_to_attr', (['"""list"""'], {}), "('list')\n", (830, 838), True, 'import sorcery as spells\n'), ((889, 929), 'sorcery.call_with_name', 'spells.call_with_name', (['_make_new_wrapper'], {}), '(_make_new_wrapper)\n', (910, 929), True, 'import sorcery as spells\n'),... |
import os.path
from glob import glob
import nbformat as nbf
# Collect a list of all notebooks in the docs folder
notebooks = glob(
os.path.join(os.path.dirname(__file__), "..", "**", "*.ipynb"),
recursive=True,
)
# Text to look for in adding tags
text_search_dict = {
"# TEST": "remove_cell", # Remove th... | [
"nbformat.read",
"nbformat.write"
] | [((695, 726), 'nbformat.read', 'nbf.read', (['ipath', 'nbf.NO_CONVERT'], {}), '(ipath, nbf.NO_CONVERT)\n', (703, 726), True, 'import nbformat as nbf\n'), ((1170, 1192), 'nbformat.write', 'nbf.write', (['ntbk', 'ipath'], {}), '(ntbk, ipath)\n', (1179, 1192), True, 'import nbformat as nbf\n')] |
# USAGE
# python quantize_example.py
# import the necessary packages
from __future__ import print_function
from ir import BagOfVisualWords
from sklearn.metrics import pairwise
import numpy as np
# randomly generate the vocabulary/cluster centers along with the feature
# vectors -- we'll generate 10 feature vectos con... | [
"ir.BagOfVisualWords",
"numpy.zeros",
"numpy.random.seed",
"numpy.random.uniform",
"numpy.argmin"
] | [((403, 421), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (417, 421), True, 'import numpy as np\n'), ((430, 460), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(3, 6)'}), '(size=(3, 6))\n', (447, 460), True, 'import numpy as np\n'), ((472, 503), 'numpy.random.uniform', 'np.random.unif... |
from django.db import models
from taggit.managers import TaggableManager
class BaseModel(models.Model):
name = models.CharField(max_length=50, unique=True)
tags = TaggableManager()
def __unicode__(self):
return self.name
class Meta(object):
abstract = True
class AlphaModel(... | [
"taggit.managers.TaggableManager",
"django.db.models.CharField"
] | [((117, 161), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'unique': '(True)'}), '(max_length=50, unique=True)\n', (133, 161), False, 'from django.db import models\n'), ((173, 190), 'taggit.managers.TaggableManager', 'TaggableManager', ([], {}), '()\n', (188, 190), False, 'from taggit.m... |
"""Pathname and path-related operations for the Macintosh."""
# strings representing various path-related bits and pieces
# These are primarily for export; internally, they are hardcoded.
# Should be set before imports for resolving cyclic dependency.
curdir = ':'
pardir = '::'
extsep = '.'
sep = ':'
pathsep ... | [
"os.getcwdb",
"genericpath._check_arg_types",
"genericpath._splitext",
"os.getcwd",
"os.lstat"
] | [((2933, 2977), 'genericpath._splitext', 'genericpath._splitext', (['p', "b':'", 'altsep', "b'.'"], {}), "(p, b':', altsep, b'.')\n", (2954, 2977), False, 'import genericpath\n'), ((3005, 3050), 'genericpath._splitext', 'genericpath._splitext', (['p', 'sep', 'altsep', 'extsep'], {}), '(p, sep, altsep, extsep)\n', (3026... |
import pandas as pd
import numpy as np
from os import path
#Read File of all the unique userids of the bots that tweeted messages regarding to the 2016 elections.
dfn = pd.read_csv("/root/.encrypted/.pythonSai/kCoreBots/CoreBotEN/MachineLearning/NaiveBayes/ListIDS.csv", sep="\n", skiprows=[0], header=None, usecols=[0]... | [
"os.path.isfile",
"pandas.read_csv"
] | [((170, 349), 'pandas.read_csv', 'pd.read_csv', (['"""/root/.encrypted/.pythonSai/kCoreBots/CoreBotEN/MachineLearning/NaiveBayes/ListIDS.csv"""'], {'sep': '"""\n"""', 'skiprows': '[0]', 'header': 'None', 'usecols': '[0]', 'names': "['userid']"}), "(\n '/root/.encrypted/.pythonSai/kCoreBots/CoreBotEN/MachineLearning/... |
"""
Test SBBreakpoint APIs.
"""
import os, time
import re
import unittest2
import lldb, lldbutil
from lldbtest import *
class BreakpointAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@python_api_test
@dsym_test
def test_breakpoint_is_valid_with_dsym(self):
... | [
"lldb.SBDebugger.Terminate",
"lldb.SBDebugger.Initialize",
"unittest2.main",
"os.getcwd"
] | [((1999, 2027), 'lldb.SBDebugger.Initialize', 'lldb.SBDebugger.Initialize', ([], {}), '()\n', (2025, 2027), False, 'import lldb, lldbutil\n'), ((2089, 2105), 'unittest2.main', 'unittest2.main', ([], {}), '()\n', (2103, 2105), False, 'import unittest2\n'), ((954, 965), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (963, 9... |
from importlib import metadata
from typing import Any
import sqlalchemy
from sqlalchemy.ext.declarative import as_declarative, declared_attr
@as_declarative()
class Base:
id: Any
__name__: str
# Generate __tablename__ automatically
metadata = sqlalchemy.MetaData()
@declared_attr
def __tablen... | [
"sqlalchemy.MetaData",
"sqlalchemy.ext.declarative.as_declarative"
] | [((145, 161), 'sqlalchemy.ext.declarative.as_declarative', 'as_declarative', ([], {}), '()\n', (159, 161), False, 'from sqlalchemy.ext.declarative import as_declarative, declared_attr\n'), ((262, 283), 'sqlalchemy.MetaData', 'sqlalchemy.MetaData', ([], {}), '()\n', (281, 283), False, 'import sqlalchemy\n')] |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.loader.processors import MapCompose, TakeFirst
class DiscursoItem(scrapy.Item):
"""
Item responsavel por receber os discursos do si... | [
"scrapy.loader.processors.TakeFirst",
"scrapy.Field",
"scrapy.loader.processors.MapCompose"
] | [((588, 602), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (600, 602), False, 'import scrapy\n'), ((804, 818), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (816, 818), False, 'import scrapy\n'), ((965, 986), 'scrapy.loader.processors.MapCompose', 'MapCompose', (['str.strip'], {}), '(str.strip)\n', (975, 986),... |
"""
Copyright (c) 2018-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
"numpy.argmin",
"numpy.array",
"pathlib.Path",
"copy.deepcopy"
] | [((5995, 6017), 'copy.deepcopy', 'deepcopy', (['self._config'], {}), '(self._config)\n', (6003, 6017), False, 'from copy import deepcopy\n'), ((6305, 6325), 'copy.deepcopy', 'deepcopy', (['self._meta'], {}), '(self._meta)\n', (6313, 6325), False, 'from copy import deepcopy\n'), ((3077, 3109), 'pathlib.Path', 'Path', ([... |
from apiclient import discovery
from httplib2 import Http
from oauth2client import file, client, tools
from openpyxl import Workbook
files_cache = {}
def cache_put(files_list):
for f in files_list:
key = f['id']
files_cache[key] = f
def get_credentials():
scope = 'https://www.googleapis.co... | [
"oauth2client.client.flow_from_clientsecrets",
"openpyxl.Workbook",
"oauth2client.file.Storage",
"httplib2.Http",
"oauth2client.tools.run_flow"
] | [((364, 392), 'oauth2client.file.Storage', 'file.Storage', (['"""storage.json"""'], {}), "('storage.json')\n", (376, 392), False, 'from oauth2client import file, client, tools\n'), ((1411, 1421), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (1419, 1421), False, 'from openpyxl import Workbook\n'), ((486, 541), 'oa... |
# Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.unstack",
"tensorflow.random.uniform",
"tensorflow.math.reduce_mean",
"keras_cv.layers.preprocessing.RandomSaturation",
"tensorflow.zeros",
"tensorflow.math.reduce_min"
] | [((881, 930), 'keras_cv.layers.preprocessing.RandomSaturation', 'preprocessing.RandomSaturation', ([], {'factor': '(0.3, 0.8)'}), '(factor=(0.3, 0.8))\n', (911, 930), False, 'from keras_cv.layers import preprocessing\n'), ((1230, 1279), 'keras_cv.layers.preprocessing.RandomSaturation', 'preprocessing.RandomSaturation',... |
import discord
import json
from geocode import get_gridpoints
from geocode import getAlerts
from geocode import getForecast
from geocode import getForecastHourly
client = discord.Client()
@client.event
async def on_ready():
print('Logged on as {0.user} '.format(client), end='')
print(f'in {len(client.guilds)}... | [
"geocode.getAlerts",
"geocode.get_gridpoints",
"json.load",
"geocode.getForecastHourly",
"discord.Activity",
"discord.Client",
"geocode.getForecast",
"discord.Embed"
] | [((172, 188), 'discord.Client', 'discord.Client', ([], {}), '()\n', (186, 188), False, 'import discord\n'), ((3715, 3808), 'discord.Embed', 'discord.Embed', ([], {'title': "data['name']", 'description': "('Forecast for ' + location)", 'colour': '(4359668)'}), "(title=data['name'], description='Forecast for ' + location... |
import pytest
from brownie import *
from scripts.abis import *
@pytest.fixture(scope="function", autouse=True)
def isolate(fn_isolation):
pass
@pytest.fixture(scope="module")
def owner():
yield accounts[-1]
@pytest.fixture(scope="module")
def rm(owner):
yield Contract.from_abi("RM", "0xce761D788DF608... | [
"pytest.fixture"
] | [((67, 113), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (81, 113), False, 'import pytest\n'), ((153, 183), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (167, 183), False, 'import pytest\n... |
from pathlib import Path
from subprocess import run
import glob
import os
def nc3to4(dir_in, dir_out, pattern):
"""
Convert netcdf4 in folder to netcdf 3 in another folder
:param dir_in: directory with input
:param dir_out: directory for output
:param pattern: e.g. '.h1.'
:return:
"""
... | [
"subprocess.run",
"os.makedirs",
"pathlib.Path"
] | [((329, 341), 'pathlib.Path', 'Path', (['dir_in'], {}), '(dir_in)\n', (333, 341), False, 'from pathlib import Path\n'), ((356, 369), 'pathlib.Path', 'Path', (['dir_out'], {}), '(dir_out)\n', (360, 369), False, 'from pathlib import Path\n'), ((407, 427), 'os.makedirs', 'os.makedirs', (['dir_out'], {}), '(dir_out)\n', (4... |
"""
This is a way to save the startup time when running img2py on lots of
files...
"""
import sys
from wx.tools import img2py
command_lines = [
" -F -n action_clean_history action_clean_history.png images.py",
"-a -F -n action_new action_new.png ... | [
"wx.tools.img2py.main"
] | [((1261, 1278), 'wx.tools.img2py.main', 'img2py.main', (['args'], {}), '(args)\n', (1272, 1278), False, 'from wx.tools import img2py\n')] |
from tests import BaseTestCase
from redash.models import QuerySnippet
class TestQuerySnippetResource(BaseTestCase):
def test_get_snippet(self):
snippet = self.factory.create_query_snippet()
rv = self.make_request('get', '/api/query_snippets/{}'.format(snippet.id))
for field in ('snippet'... | [
"redash.models.QuerySnippet.query.get"
] | [((1080, 1114), 'redash.models.QuerySnippet.query.get', 'QuerySnippet.query.get', (['snippet.id'], {}), '(snippet.id)\n', (1102, 1114), False, 'from redash.models import QuerySnippet\n')] |
# -*- coding: utf-8 -*-
# Copyright © 2012-2013 <NAME> and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, c... | [
"sys.path.insert",
"json.JSONEncoder.default",
"zipfile.ZipFile",
"re.compile",
"os.path.islink",
"os.walk",
"os.remove",
"os.path.exists",
"pytz.timezone",
"logbook.Logger",
"sys.getfilesystemencoding",
"os.readlink",
"shutil.copy2",
"calendar.TimeEncoding",
"json.dumps",
"os.path.isd... | [((2192, 2245), 'logbook.more.ExceptionHandler', 'ExceptionHandler', (['ApplicationWarning'], {'level': '"""WARNING"""'}), "(ApplicationWarning, level='WARNING')\n", (2208, 2245), False, 'from logbook.more import ExceptionHandler\n'), ((2250, 2275), 'os.getenv', 'os.getenv', (['"""NIKOLA_DEBUG"""'], {}), "('NIKOLA_DEBU... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
import time
class MoveRobot():
def __init__(self):
# variables
# instantiate the node
rospy.init_node('haptic_teleop_control')
# subscribe to
# publish to the move_base
self... | [
"rospy.is_shutdown",
"rospy.init_node",
"time.sleep",
"rospy.Time.now",
"geometry_msgs.msg.PoseStamped",
"rospy.Publisher"
] | [((205, 245), 'rospy.init_node', 'rospy.init_node', (['"""haptic_teleop_control"""'], {}), "('haptic_teleop_control')\n", (220, 245), False, 'import rospy\n'), ((337, 404), 'rospy.Publisher', 'rospy.Publisher', (['"""move_base_simple/goal"""', 'PoseStamped'], {'queue_size': '(1)'}), "('move_base_simple/goal', PoseStamp... |
#!/usr/bin/env python
import curses
from . import wgtextbox as textbox
from . import wgmultiline as multiline
from . import wgtitlefield as titlefield
import os
from . import fmForm as Form
from . import fmPopup as Popup
class Autocomplete(textbox.Textfield):
"""This class is fairly useless, but override auto_... | [
"os.listdir",
"os.path.join",
"os.path.split",
"os.path.isdir",
"os.path.basename",
"os.path.abspath",
"os.path.normcase",
"curses.beep",
"os.path.expanduser"
] | [((586, 599), 'curses.beep', 'curses.beep', ([], {}), '()\n', (597, 599), False, 'import curses\n'), ((1528, 1558), 'os.path.expanduser', 'os.path.expanduser', (['self.value'], {}), '(self.value)\n', (1546, 1558), False, 'import os\n'), ((4015, 4043), 'os.path.normcase', 'os.path.normcase', (['self.value'], {}), '(self... |
"""Test config utils."""
# pylint: disable=too-many-public-methods,protected-access
import os
import tempfile
import unittest
import unittest.mock as mock
import pytest
from voluptuous import MultipleInvalid
from homeassistant.core import DOMAIN, HomeAssistantError, Config
import homeassistant.config as config_util
f... | [
"homeassistant.core.Config",
"tests.common.get_test_home_assistant",
"unittest.mock.patch",
"os.remove",
"homeassistant.config.CORE_CONFIG_SCHEMA",
"os.mkdir",
"homeassistant.config.create_default_config",
"homeassistant.config.process_ha_core_config",
"homeassistant.config.load_yaml_config_file",
... | [((720, 741), 'tests.common.get_test_config_dir', 'get_test_config_dir', ([], {}), '()\n', (739, 741), False, 'from tests.common import get_test_config_dir, get_test_home_assistant\n'), ((754, 808), 'os.path.join', 'os.path.join', (['CONFIG_DIR', 'config_util.YAML_CONFIG_FILE'], {}), '(CONFIG_DIR, config_util.YAML_CONF... |
"""
mairo_soundboard.py
This is a sample on how to use mario.py. It shows how to register event hook
functions and how to let the script run as an endless loop.
###################################################################################
MIT License
Copyright (c) 2022 <NAME>, <NAME>
Permission is hereby granted... | [
"os.listdir",
"random.choice",
"pathlib.Path",
"sounddevice.query_devices",
"pyLegoMario.Mario",
"pyLegoMario.MarioWindow",
"pyLegoMario.run",
"os.path.isdir",
"os.mkdir",
"asyncio.sleep",
"json.load",
"soundfile.read",
"asyncio.get_event_loop",
"json.dump",
"pyLegoMario.LEGO_MARIO_DATA.... | [((4352, 4370), 'sounddevice.query_devices', 'sd.query_devices', ([], {}), '()\n', (4368, 4370), True, 'import sounddevice as sd\n'), ((5361, 5384), 'os.listdir', 'os.listdir', (['folder_path'], {}), '(folder_path)\n', (5371, 5384), False, 'import json, os, asyncio, random, sys\n'), ((6940, 6969), 'pyLegoMario.Mario', ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bankaccounts', '0001_initial'),
('banktransactiontags', '0001_initial'),
]
... | [
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((447, 540), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (463, 540), False, 'from django.db import models, migrations\... |
from nip.providers.pip import pip_install_dependancies
from nip.middleware import nipfile_selector, env_selector
from nip.hooks import (exit_if_no_nipfile, write_requirements_file,
create_venv_if_none_exists, create_command_greeting,
print_success_message, logger)
HOOKS =... | [
"nip.hooks.create_command_greeting",
"nip.providers.pip.pip_install_dependancies",
"nip.middleware.nipfile_selector",
"nip.middleware.env_selector"
] | [((622, 643), 'nip.middleware.nipfile_selector', 'nipfile_selector', (['ctx'], {}), '(ctx)\n', (638, 643), False, 'from nip.middleware import nipfile_selector, env_selector\n'), ((654, 671), 'nip.middleware.env_selector', 'env_selector', (['ctx'], {}), '(ctx)\n', (666, 671), False, 'from nip.middleware import nipfile_s... |
import os
import math
import torch
import numpy as np
class EvaluationSinhalaSongsDataset(torch.utils.data.Dataset):
def __init__(self, root_dir, trim_seconds=10, indexing=False):
self.dir = root_dir
self.feature_list = sorted(os.listdir(self.dir))
self.trim_seconds = trim_seconds
... | [
"os.listdir",
"math.floor",
"os.path.join",
"torch.from_numpy",
"torch.is_tensor",
"numpy.load",
"torch.cat"
] | [((828, 848), 'torch.is_tensor', 'torch.is_tensor', (['idx'], {}), '(idx)\n', (843, 848), False, 'import torch\n'), ((1039, 1089), 'os.path.join', 'os.path.join', (['self.dir', 'self.feature_list[file_id]'], {}), '(self.dir, self.feature_list[file_id])\n', (1051, 1089), False, 'import os\n'), ((1112, 1149), 'numpy.load... |
import numpy as np
import CreateMatrix
import WriteMatrix
import ReadMatrix
if __name__ == '__main__':
test = input().split(' ')
length,rows,cols=list(map(int, test))
matrix_list = CreateMatrix.createMatrixList(length,rows,cols)
WriteMatrix.writeMatrixList('/data/workspace/myshixun/creatematrix/... | [
"WriteMatrix.writeMatrixList",
"ReadMatrix.readMatrixFromFile",
"CreateMatrix.createMatrixList"
] | [((200, 249), 'CreateMatrix.createMatrixList', 'CreateMatrix.createMatrixList', (['length', 'rows', 'cols'], {}), '(length, rows, cols)\n', (229, 249), False, 'import CreateMatrix\n'), ((253, 360), 'WriteMatrix.writeMatrixList', 'WriteMatrix.writeMatrixList', (['"""/data/workspace/myshixun/creatematrix/data/data.idx3.u... |
# coding: utf-8
import pprint
import re
import six
class CreateSnapshotOption:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the val... | [
"six.iteritems"
] | [((4507, 4540), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (4520, 4540), False, 'import six\n')] |
#!/usr/bin/env python3
"""
Author : moaad <<EMAIL>>
Date : 2022-01-05
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Rock the Casbah',
formatte... | [
"argparse.FileType",
"argparse.ArgumentParser"
] | [((240, 355), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Rock the Casbah"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Rock the Casbah', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (263, 355), False, 'import argparse\n'), ((1... |
# Copyright 2020 The Magenta Authors.
#
# 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 ... | [
"magenta.models.drums_rnn.drums_rnn_model.default_configs.items",
"magenta.music.quantize_to_step",
"magenta.models.shared.sequence_generator.SequenceGeneratorError",
"magenta.music.steps_per_bar_in_quantized_sequence",
"magenta.music.quantize_note_sequence",
"functools.partial",
"magenta.models.drums_r... | [((2590, 2659), 'magenta.music.steps_per_quarter_to_steps_per_second', 'mm.steps_per_quarter_to_steps_per_second', (['self.steps_per_quarter', 'qpm'], {}), '(self.steps_per_quarter, qpm)\n', (2630, 2659), True, 'import magenta.music as mm\n'), ((3843, 3909), 'magenta.music.quantize_note_sequence', 'mm.quantize_note_seq... |
from typing import Union, Tuple
import torch
import torch.nn as nn
tuple_or_int = Union[int, Tuple[int, int]]
class ConvBlock(nn.Module):
"""U-Net Convolution block
Parameters
----------
in_channels, out_channels: int
Number of input and desired output channels.
kernel_size: `tuple` or ... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((1830, 1852), 'torch.nn.Sequential', 'nn.Sequential', (['*blocks'], {}), '(*blocks)\n', (1843, 1852), True, 'import torch.nn as nn\n'), ((4708, 4738), 'torch.cat', 'torch.cat', (['(accross, x)'], {'dim': '(1)'}), '((accross, x), dim=1)\n', (4717, 4738), False, 'import torch\n'), ((3615, 3693), 'torch.nn.Upsample', 'n... |
import os
import numpy as np
from utils.utils import json_from_file, get_files_from_dir, get_module_attr
# get list of themes (excluding python system files)
def get_themes(dir):
theme_dir = 'themes/{dir}'.format(dir=dir)
themes = get_files_from_dir(theme_dir)
return themes
# pick random theme from a libr... | [
"numpy.random.choice",
"os.path.splitext",
"utils.utils.get_files_from_dir"
] | [((240, 269), 'utils.utils.get_files_from_dir', 'get_files_from_dir', (['theme_dir'], {}), '(theme_dir)\n', (258, 269), False, 'from utils.utils import json_from_file, get_files_from_dir, get_module_attr\n'), ((415, 439), 'numpy.random.choice', 'np.random.choice', (['themes'], {}), '(themes)\n', (431, 439), True, 'impo... |
import os
from pydantic import BaseSettings
class Settings(BaseSettings):
class Config:
env_file = ".env"
app_name: str = "FastAPI Demo"
admin_email: str = "<EMAIL>"
secret_key: str = os.getenv("SECRET_KEY")
hash_algo: str = os.getenv("HASH_ALGO", "HS256")
access_token_expiration... | [
"os.getenv"
] | [((216, 239), 'os.getenv', 'os.getenv', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (225, 239), False, 'import os\n'), ((261, 292), 'os.getenv', 'os.getenv', (['"""HASH_ALGO"""', '"""HS256"""'], {}), "('HASH_ALGO', 'HS256')\n", (270, 292), False, 'import os\n'), ((328, 371), 'os.getenv', 'os.getenv', (['"""ACCESS_T... |
from datetime import datetime
from dateutil import parser
from flask import redirect, request
from sqlalchemy import func, or_
from app import utils as utils
from app.api import bp
from app.api.routes.helpers import failures_counter, latency_summary, logger
from app.models import Category, Language, Resource
from con... | [
"flask.request.args.get",
"dateutil.parser.parse",
"app.api.routes.helpers.logger.exception",
"app.utils.standardize_response",
"app.api.bp.route",
"app.utils.Paginator",
"app.api.routes.helpers.failures_counter.count_exceptions",
"flask.request.args.getlist",
"flask.redirect",
"datetime.datetime.... | [((342, 364), 'app.api.routes.helpers.latency_summary.time', 'latency_summary.time', ([], {}), '()\n', (362, 364), False, 'from app.api.routes.helpers import failures_counter, latency_summary, logger\n'), ((366, 401), 'app.api.routes.helpers.failures_counter.count_exceptions', 'failures_counter.count_exceptions', ([], ... |
"""
High performance schedule for conv2d_nchw
Target NVIDIA GPU P100
====================================
**Author**: `<NAME>`
"""
import tvm
from flextensor.measure import _evaluate
from flextensor.nn import YoloConvLayer10
def schedule_yolo_conv_cuda(s, outputs, inputs, weight):
# inline the padding operation... | [
"tvm.ir_pass.VerifyGPUCode",
"tvm.create_schedule",
"tvm.nd.context",
"flextensor.nn.YoloConvLayer10",
"tvm.thread_axis",
"tvm.build",
"flextensor.measure._evaluate",
"tvm.lower",
"tvm.placeholder"
] | [((1012, 1041), 'tvm.thread_axis', 'tvm.thread_axis', (['"""blockIdx.x"""'], {}), "('blockIdx.x')\n", (1027, 1041), False, 'import tvm\n'), ((1051, 1080), 'tvm.thread_axis', 'tvm.thread_axis', (['"""blockIdx.y"""'], {}), "('blockIdx.y')\n", (1066, 1080), False, 'import tvm\n'), ((1090, 1119), 'tvm.thread_axis', 'tvm.th... |
from django.conf import settings
from django.db import models
class TaskerWallet(models.Model):
"Generated Model"
tasker = models.OneToOneField(
"task_profile.TaskerProfile",
on_delete=models.CASCADE,
related_name="taskerwallet_tasker",
)
balance = models.FloatField(
ma... | [
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((133, 249), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""task_profile.TaskerProfile"""'], {'on_delete': 'models.CASCADE', 'related_name': '"""taskerwallet_tasker"""'}), "('task_profile.TaskerProfile', on_delete=models.CASCADE,\n related_name='taskerwallet_tasker')\n", (153, 249), False, 'from dj... |
from flask import g, request
from flask_restful import Resource, marshal_with, fields, reqparse
from octoprint_dashboard.app import db, socketio
from octoprint_dashboard.login import login_required, superadmin_required
from octoprint_dashboard.model import Printer, Config
from octoprint_dashboard.services import Octop... | [
"octoprint_dashboard.app.db.session.add",
"octoprint_dashboard.services.OctoprintService.auth",
"octoprint_dashboard.app.socketio.emit",
"flask_restful.reqparse.RequestParser",
"flask.g.user.get_accessible_printers",
"octoprint_dashboard.app.db.session.delete",
"octoprint_dashboard.model.Printer",
"fl... | [((352, 376), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (374, 376), False, 'from flask_restful import Resource, marshal_with, fields, reqparse\n'), ((508, 532), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (530, 532), False, 'from flask_re... |
# This artist can be used to deal with the sampling of the data as well as any
# RGB blending.
from __future__ import absolute_import
import numpy as np
from glue.utils import view_shape
from matplotlib.colors import ColorConverter, Colormap
from astropy.visualization import (LinearStretch, SqrtStretch, AsinhStretc... | [
"numpy.product",
"numpy.clip",
"matplotlib.colors.ColorConverter",
"numpy.atleast_2d",
"astropy.visualization.ContrastBiasStretch",
"numpy.isscalar",
"numpy.ones",
"numpy.any",
"glue.utils.view_shape",
"numpy.zeros",
"numpy.isnan",
"astropy.visualization.ManualInterval"
] | [((457, 473), 'matplotlib.colors.ColorConverter', 'ColorConverter', ([], {}), '()\n', (471, 473), False, 'from matplotlib.colors import ColorConverter, Colormap\n'), ((5140, 5162), 'numpy.product', 'np.product', (['self.shape'], {}), '(self.shape)\n', (5150, 5162), True, 'import numpy as np\n'), ((2610, 2640), 'astropy... |
# Lint as: python2, python3
# Copyright 2020 Google LLC. 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 req... | [
"tensorflow_model_analysis.GenericChangeThreshold",
"tfx.components.base.executor_spec.ExecutorClassSpec",
"tfx.components.StatisticsGen",
"tfx.orchestration.pipeline.Pipeline",
"tfx.components.Trainer",
"tfx.components.Transform",
"tensorflow_model_analysis.ModelSpec",
"tensorflow_model_analysis.Slic... | [((3232, 3287), 'tfx.components.StatisticsGen', 'StatisticsGen', ([], {'examples': "example_gen.outputs['examples']"}), "(examples=example_gen.outputs['examples'])\n", (3245, 3287), False, 'from tfx.components import StatisticsGen\n'), ((3461, 3550), 'tfx.components.SchemaGen', 'SchemaGen', ([], {'statistics': "statist... |
from positional_list import PositionalList
from favoritelist import FavoriteList
# if no. of acess tally, recently acesssed element is returned when top(k) is called
class FavoriteListMTF(FavoriteList):
"""List of elements ordered with move-to-front heuristics."""
# we override _move_up to provide move-to-fron... | [
"positional_list.PositionalList"
] | [((908, 924), 'positional_list.PositionalList', 'PositionalList', ([], {}), '()\n', (922, 924), False, 'from positional_list import PositionalList\n')] |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"logging.getLogger",
"time.sleep",
"pytorch_lightning.utilities.exceptions.MisconfigurationException",
"pytorch_lightning.utilities.rank_zero_warn",
"pytorch_lightning.overrides.distributed.prepare_for_backward",
"pytorch_lightning.utilities.seed.reset_seed",
"pytorch_lightning.utilities.exceptions.Dead... | [((2703, 2730), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2720, 2730), False, 'import logging\n'), ((6903, 6988), 'torch.nn.parallel.distributed.DistributedDataParallel', 'DistributedDataParallel', ([], {'module': 'model', 'device_ids': 'device_ids'}), '(module=model, device_ids=dev... |
from django.db import models
# Create your models here.
class Bookmark(models.Model):
title = models.CharField(max_length=100, blank=True, null=True)
url = models.URLField('URL', unique=True)
class Meta:
verbose_name = 'Bookmark'
verbose_name_plural = 'Bookmarks'
def __str__(self):
... | [
"django.db.models.URLField",
"django.db.models.CharField"
] | [((100, 155), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)', 'null': '(True)'}), '(max_length=100, blank=True, null=True)\n', (116, 155), False, 'from django.db import models\n'), ((166, 201), 'django.db.models.URLField', 'models.URLField', (['"""URL"""'], {'unique': '... |
from __future__ import (
absolute_import,
unicode_literals,
)
import re
from typing import (
Any as AnyType,
Iterable,
List as ListType,
)
import warnings
import six
from conformity.fields.basic import (
Introspection,
UnicodeString,
)
from conformity.fields.utils import strip_none
from c... | [
"warnings.warn",
"conformity.fields.net.IPAddress",
"conformity.types.Error",
"re.compile"
] | [((836, 847), 'conformity.fields.net.IPAddress', 'IPAddress', ([], {}), '()\n', (845, 847), False, 'from conformity.fields.net import IPAddress\n'), ((981, 1188), 're.compile', 're.compile', (['"""(^[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+(\\\\.[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+)*\\\\Z|^"([\\\\001-\\\\010\\\\013\\\\014\\\\016-\\\\037!... |
from unittest import TestCase
from filemanager import FileManager
class FileManagerTest(TestCase):
def setUp(self):
self.manager = FileManager("products.csv", "urls.db")
def test_change_products_result(self):
self.manager.clear_result()
products = self.manager.get_product_names_set()... | [
"filemanager.FileManager"
] | [((146, 184), 'filemanager.FileManager', 'FileManager', (['"""products.csv"""', '"""urls.db"""'], {}), "('products.csv', 'urls.db')\n", (157, 184), False, 'from filemanager import FileManager\n')] |
# Generated by Django 2.2 on 2019-04-16 19:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Line',
fields=[
... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.TextField",
"django.db.models.CharField"
] | [((331, 424), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (347, 424), False, 'from django.db import migrations, models\... |
import config #this file contains the SSID API Key and Bolt device ID
import json,time
from boltiot import Sms,Bolt #used to call methods to sen SMS and use Bolt WiFi Module
mybolt = Bolt(config.API_KEY, config.DEVICE_ID) #To configure the Bolt WiFi Module
sms = Sms(config.SSID, config.AUTH_TOK... | [
"json.loads",
"boltiot.Sms",
"time.sleep",
"boltiot.Bolt"
] | [((201, 239), 'boltiot.Bolt', 'Bolt', (['config.API_KEY', 'config.DEVICE_ID'], {}), '(config.API_KEY, config.DEVICE_ID)\n', (205, 239), False, 'from boltiot import Sms, Bolt\n'), ((288, 361), 'boltiot.Sms', 'Sms', (['config.SSID', 'config.AUTH_TOKEN', 'config.TO_NUMBER', 'config.FROM_NUMBER'], {}), '(config.SSID, confi... |
from fdfs_client.client import Fdfs_client
from rest_framework.permissions import DjangoModelPermissions
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from apps.goods.models import SPU, Brand, GoodsCategory
from apps.meiduo_admin.serializers.SpuSerializer import SPUGoodSe... | [
"fdfs_client.client.Fdfs_client",
"apps.goods.models.SPU.objects.all",
"apps.meiduo_admin.serializers.SpuSerializer.SPUBrandsSerizliser",
"apps.meiduo_admin.serializers.SpuSerializer.CategorysSerizliser",
"rest_framework.response.Response",
"apps.goods.models.Brand.objects.all",
"apps.goods.models.Goods... | [((562, 579), 'apps.goods.models.SPU.objects.all', 'SPU.objects.all', ([], {}), '()\n', (577, 579), False, 'from apps.goods.models import SPU, Brand, GoodsCategory\n'), ((750, 769), 'apps.goods.models.Brand.objects.all', 'Brand.objects.all', ([], {}), '()\n', (767, 769), False, 'from apps.goods.models import SPU, Brand... |