code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
A subclass of tkinter.PhotoImage that connects a
vtkImageData to a photo widget.
Created by <NAME>, August 2002
"""
from __future__ import absolute_import
import sys
if sys.hexversion < 0x03000000:
# for Python2
import Tkinter as tkinter
else:
# for Python3
import tkinter
from .... | [
"tkinter.PhotoImage.__init__"
] | [((601, 638), 'tkinter.PhotoImage.__init__', 'tkinter.PhotoImage.__init__', (['self', 'kw'], {}), '(self, kw)\n', (628, 638), False, 'import tkinter\n')] |
# python: 3.6
# encoding: utf-8
import torch
import torch.nn as nn
from fastNLP.modules.utils import initial_parameter
# import torch.nn.functional as F
class Conv(nn.Module):
"""Basic 1-d convolution module, initialized with xavier_uniform.
:param int in_channels:
:param int out_channels:
:param... | [
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.Conv1d",
"fastNLP.modules.utils.initial_parameter",
"torch.transpose"
] | [((772, 945), 'torch.nn.Conv1d', 'nn.Conv1d', ([], {'in_channels': 'in_channels', 'out_channels': 'out_channels', 'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padding', 'dilation': 'dilation', 'groups': 'groups', 'bias': 'bias'}), '(in_channels=in_channels, out_channels=out_channels, kernel_size=\n ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
assemble.py
This module finds and forms essential structure components, which are the
smallest building blocks that form every repeat in the song.
These functions ensure that each time step of a song is contained in at most
one of the song's essential structure ... | [
"matplotlib.pyplot.title",
"numpy.triu",
"numpy.sum",
"numpy.amin",
"numpy.empty",
"numpy.allclose",
"numpy.ones",
"numpy.argsort",
"numpy.shape",
"numpy.arange",
"numpy.tile",
"numpy.unique",
"numpy.full",
"numpy.ndim",
"numpy.transpose",
"numpy.insert",
"numpy.max",
"inspect.sign... | [((3662, 3702), 'inspect.signature', 'signature', (['breakup_overlaps_by_intersect'], {}), '(breakup_overlaps_by_intersect)\n', (3671, 3702), False, 'from inspect import signature\n'), ((4414, 4437), 'numpy.nonzero', 'np.nonzero', (['(bw_vec == T)'], {}), '(bw_vec == T)\n', (4424, 4437), True, 'import numpy as np\n'), ... |
from __future__ import print_function, division
import numpy as np
import healpy as hp
from matplotlib import pyplot as plt
import geometry
# given nside | number of pixels | resolution (pixel size in degree) | Maximum angular distance (degree) | pixel area (in square degrees)
# 1 | 12 | ... | [
"geometry.genEA",
"healpy.max_pixrad",
"healpy.visufunc.projscatter",
"matplotlib.pyplot.show",
"healpy.mollview",
"numpy.random.randn",
"healpy.graticule",
"healpy.nside2pixarea",
"healpy.nside2npix",
"numpy.linalg.norm",
"healpy.nside2resol"
] | [((2358, 2381), 'numpy.random.randn', 'np.random.randn', (['(100)', '(3)'], {}), '(100, 3)\n', (2373, 2381), True, 'import numpy as np\n'), ((2453, 2470), 'geometry.genEA', 'geometry.genEA', (['v'], {}), '(v)\n', (2467, 2470), False, 'import geometry\n'), ((2557, 2570), 'healpy.mollview', 'hp.mollview', ([], {}), '()\n... |
import os
from urllib.request import urlopen
import pymex
class UniRecord( pymex.xmlrecord.XmlRecord ):
def __init__(self, root=None):
myDir = os.path.dirname( os.path.realpath(__file__))
self.uniConfig = { "uni_v001": {"IN": os.path.join( myDir, "defUniParse_v001.json"),
... | [
"os.path.realpath",
"os.path.join",
"pymex.Protein",
"urllib.request.urlopen"
] | [((8504, 8529), 'pymex.Protein', 'pymex.Protein', (['self._pdef'], {}), '(self._pdef)\n', (8517, 8529), False, 'import pymex\n'), ((174, 200), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (190, 200), False, 'import os\n'), ((1270, 1284), 'urllib.request.urlopen', 'urlopen', (['upUrl'], {}... |
# Helpful classes
import numpy as np
# Helper function for calculating dists
def dists(array):
lens = []
for i in range(len(array)):
lens.append(np.linalg.norm(np.array(array[i][0])-
np.array(array[i][1])))
return lens
# This is for the original shape you want to cut
class Shape:
def __init__(self... | [
"numpy.array"
] | [((344, 356), 'numpy.array', 'np.array', (['ls'], {}), '(ls)\n', (352, 356), True, 'import numpy as np\n'), ((170, 191), 'numpy.array', 'np.array', (['array[i][0]'], {}), '(array[i][0])\n', (178, 191), True, 'import numpy as np\n'), ((199, 220), 'numpy.array', 'np.array', (['array[i][1]'], {}), '(array[i][1])\n', (207,... |
# -*- coding: utf-8 -*-
# FeedCrawler
# Projekt von https://github.com/rix1337
import ast
import json
import os
import re
import sys
import time
from functools import wraps
from flask import Flask, request, redirect, send_from_directory, render_template, jsonify, Response
from passlib.hash import pbkdf2_sha256
from r... | [
"requests.packages.urllib3.disable_warnings",
"feedcrawler.myjd.jdownloader_stop",
"feedcrawler.common.remove_decrypt",
"os.path.isfile",
"flask.jsonify",
"feedcrawler.common.is_device",
"passlib.hash.pbkdf2_sha256.hash",
"os.path.join",
"feedcrawler.myjd.download",
"passlib.hash.pbkdf2_sha256.ver... | [((2257, 2285), 'feedcrawler.config.CrawlerConfig', 'CrawlerConfig', (['"""FeedCrawler"""'], {}), "('FeedCrawler')\n", (2270, 2285), False, 'from feedcrawler.config import CrawlerConfig\n'), ((69071, 69142), 'waitress.serve', 'serve', (['app'], {'host': '"""0.0.0.0"""', 'port': 'internal.port', 'threads': '(10)', '_qui... |
import io
import cv2
import numpy as np
def predict(image):
nparr = np.fromstring(image, np.uint8)
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
res, im_png = cv2.imencode(".png", gray_image)
return im_png
def details():
details = {
"... | [
"cv2.cvtColor",
"cv2.imdecode",
"numpy.fromstring",
"cv2.imencode"
] | [((74, 104), 'numpy.fromstring', 'np.fromstring', (['image', 'np.uint8'], {}), '(image, np.uint8)\n', (87, 104), True, 'import numpy as np\n'), ((115, 152), 'cv2.imdecode', 'cv2.imdecode', (['nparr', 'cv2.IMREAD_COLOR'], {}), '(nparr, cv2.IMREAD_COLOR)\n', (127, 152), False, 'import cv2\n'), ((170, 207), 'cv2.cvtColor'... |
import numpy as np
import tensorflow as tf
import pathlib
import general_utilities
class Actor:
def __init__(self, scope, session, n_actions, action_bound,
eval_states, target_states, learning_rate=0.001, tau=0.01):
self.session = session
self.n_actions = n_actions
self.a... | [
"tensorflow.get_collection",
"tensorflow.constant_initializer",
"tensorflow.layers.dense",
"tensorflow.variable_scope",
"tensorflow.multiply",
"tensorflow.assign",
"tensorflow.matmul",
"tensorflow.random_normal_initializer",
"tensorflow.squared_difference",
"tensorflow.gradients",
"tensorflow.tr... | [((513, 542), 'tensorflow.variable_scope', 'tf.variable_scope', (['self.scope'], {}), '(self.scope)\n', (530, 542), True, 'import tensorflow as tf\n'), ((886, 957), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.GLOBAL_VARIABLES'], {'scope': "(scope + '/eval')"}), "(tf.GraphKeys.GLOBAL_VARIABLES, sco... |
from rubik_cube import RubikCube
r = RubikCube()
r.y_rotate('left', 'down')
r.y_rotate('right', 'up')
print(r)
print()
for _ in range(3):
r.x_rotate('bottom', 'left')
print(r)
print()
for _ in range(7):
r.y_rotate('left', 'up')
r.z_rotate('front', 'clockwise')
r.y_rotate('left', 'up')
... | [
"rubik_cube.RubikCube"
] | [((38, 49), 'rubik_cube.RubikCube', 'RubikCube', ([], {}), '()\n', (47, 49), False, 'from rubik_cube import RubikCube\n')] |
import os
import sys
sys.path.append('../')
def test_node2vec():
os.system("python ../scripts/train.py --task unsupervised_node_classification --dataset wikipedia --model node2vec --p_value 0.3 --q_value 0.7 --seed 0 1 2 3 4")
pass
if __name__ == "__main__":
test_node2vec() | [
"sys.path.append",
"os.system"
] | [((22, 44), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (37, 44), False, 'import sys\n'), ((72, 243), 'os.system', 'os.system', (['"""python ../scripts/train.py --task unsupervised_node_classification --dataset wikipedia --model node2vec --p_value 0.3 --q_value 0.7 --seed 0 1 2 3 4"""'], {})... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-13 18:21
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('common', '0003_delete_contributors'),
]
operations... | [
"django.db.models.ManyToManyField",
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.AutoField"
] | [((767, 840), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""contributor"""', 'name': '"""contributor_type"""'}), "(model_name='contributor', name='contributor_type')\n", (789, 840), False, 'from django.db import migrations, models\n'), ((885, 947), 'django.db.migrations.RemoveFie... |
__author__ = 'edill'
import enaml
from enaml.qt.qt_application import QtApplication
from bubblegum.xrf.model.xrf_model import XRF
def run():
app = QtApplication()
with enaml.imports():
from bubblegum.xrf.view.file_view import FileGui
view = FileGui()
view.xrf_model1 = XRF()
view.xrf_model... | [
"bubblegum.xrf.model.xrf_model.XRF",
"bubblegum.xrf.view.file_view.FileGui",
"enaml.qt.qt_application.QtApplication",
"enaml.imports"
] | [((153, 168), 'enaml.qt.qt_application.QtApplication', 'QtApplication', ([], {}), '()\n', (166, 168), False, 'from enaml.qt.qt_application import QtApplication\n'), ((264, 273), 'bubblegum.xrf.view.file_view.FileGui', 'FileGui', ([], {}), '()\n', (271, 273), False, 'from bubblegum.xrf.view.file_view import FileGui\n'),... |
import numpy as np
from numpy.random import randn
from numpy.linalg import norm
from numpy.random import permutation
from numpy.testing import assert_array_almost_equal, assert_array_equal
import tensor.utils as tu
from tensor.tensor_train import ttsvd, tt_product
# np.random.seed(20)
shape_A = (3, 4, 5, 6, 7)
A = ra... | [
"tensor.tensor_train.ttsvd",
"numpy.linalg.norm",
"tensor.tensor_train.tt_product",
"numpy.random.randn"
] | [((318, 333), 'numpy.random.randn', 'randn', (['*shape_A'], {}), '(*shape_A)\n', (323, 333), False, 'from numpy.random import randn\n'), ((487, 533), 'tensor.tensor_train.ttsvd', 'ttsvd', (['A', 'tol'], {'dim_order': 'dim_order', 'ranks': 'None'}), '(A, tol, dim_order=dim_order, ranks=None)\n', (492, 533), False, 'from... |
''' Visualization code for point clouds and 3D bounding boxes with mayavi.
Modified by <NAME>
Date: September 2017
Ref: https://github.com/hengck23/didi-udacity-2017/blob/master/baseline-04/kitti_data/draw.py
'''
import warnings
import numpy as np
try:
import mayavi.mlab as mlab
except ImportError:
warnings... | [
"lyft_dataset_sdk.utils.data_classes.LidarPointCloud.from_file",
"dataset.prepare_lyft_data_v2.transform_pc_to_camera_coord",
"mayavi.mlab.text3d",
"mayavi.mlab.figure",
"numpy.eye",
"pandas.read_csv",
"dataset.prepare_lyft_data.transform_box_from_world_to_sensor_coordinates",
"mayavi.mlab.view",
"n... | [((5711, 5805), 'mayavi.mlab.figure', 'mlab.figure', ([], {'figure': 'None', 'bgcolor': '(0, 0, 0)', 'fgcolor': 'None', 'engine': 'None', 'size': '(1600, 1000)'}), '(figure=None, bgcolor=(0, 0, 0), fgcolor=None, engine=None, size\n =(1600, 1000))\n', (5722, 5805), True, 'import mayavi.mlab as mlab\n'), ((5862, 5987)... |
from sys import exit
from app.knn.knn_utils import *
from app.utils.prediction_utils import *
MODELS_PATH = "app/knn/results/models/"
EXAMPLE_IMG_PREFIX = "example_"
PREDICT_CSV_PREFIX = "knn_predictions_"
ACCURACY_TXT_PREFIX = "accuracy_k"
VAL_SIZE = 0.25
BATCH_SIZE = 2500
BEST_K = 7
# ---------------------------... | [
"sys.exit"
] | [((3894, 3901), 'sys.exit', 'exit', (['(0)'], {}), '(0)\n', (3898, 3901), False, 'from sys import exit\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
manipulated bfgs method from scipy.optimize (V 1.5.2)
"""
#__docformat__ = "restructuredtext en"
# ******NOTICE***************
# optimize.py module by <NAME>
#
# You may copy and use this module as you see fit with no
# guarantee implied provided you keep this notice ... | [
"numpy.abs",
"numpy.isnan",
"numpy.linalg.norm",
"numpy.inner",
"warnings.simplefilter",
"numpy.isfinite",
"numpy.finfo",
"warnings.catch_warnings",
"numpy.size",
"numpy.asarray",
"numpy.isinf",
"scipy.optimize._differentiable_functions.ScalarFunction",
"numpy.dot",
"numpy.all",
"numpy.i... | [((9140, 9232), 'scipy.optimize._differentiable_functions.ScalarFunction', 'ScalarFunction', (['fun', 'x0', 'args', 'grad', 'hess', 'finite_diff_rel_step', 'bounds'], {'epsilon': 'epsilon'}), '(fun, x0, args, grad, hess, finite_diff_rel_step, bounds,\n epsilon=epsilon)\n', (9154, 9232), False, 'from scipy.optimize._... |
# -*- coding: utf-8 -*-
"""Utils module."""
import json
import re
def camel_case_split(identifier):
"""CamelCase split"""
matches = re.finditer(
".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)",
identifier)
return [m.group(0) for m in matches]
def host_url(request):
return r... | [
"re.finditer",
"json.loads"
] | [((144, 229), 're.finditer', 're.finditer', (['""".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)"""', 'identifier'], {}), "('.+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)', identifier\n )\n", (155, 229), False, 'import re\n'), ((478, 494), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (488, ... |
from db.repositories.statistics_repository import StatisticsRepository
from model.DTO.Statistics import Statistics as StatisticsDTO
from model.Statistics import Statistics
def get_statistics(stats_repo: StatisticsRepository) -> Statistics:
return stats_repo.get_statistics()
def create_statistics(stats_repo: Stati... | [
"model.DTO.Statistics.Statistics"
] | [((1508, 1598), 'model.DTO.Statistics.Statistics', 'StatisticsDTO', ([], {'count_mutant_dna': 'count_mutant', 'count_human_dna': 'count_human', 'ratio': 'ratio'}), '(count_mutant_dna=count_mutant, count_human_dna=count_human,\n ratio=ratio)\n', (1521, 1598), True, 'from model.DTO.Statistics import Statistics as Stat... |
import cleaner
cleaner.doClean()
| [
"cleaner.doClean"
] | [((16, 33), 'cleaner.doClean', 'cleaner.doClean', ([], {}), '()\n', (31, 33), False, 'import cleaner\n')] |
from expects import *
import client.api
import client.models
import random
def empty_interface(api_client):
ports = client.api.PortsApi(api_client)
ps = ports.list_ports(kind='dpdk')
expect(ps).not_to(be_empty)
i = client.models.Interface()
i.port_id = ps[0].id
i.config = client.models.Interf... | [
"random.randint"
] | [((1757, 1779), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (1771, 1779), False, 'import random\n'), ((1920, 1942), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (1934, 1942), False, 'import random\n')] |
"""
Modified from https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py
"""
import operator
from functools import reduce
import torch
import torch.nn as nn
class VGG(nn.Module):
"""VGG Model"""
def __init__(self, input_size, num_classes, cfg):
super(VGG, self).__init__()
self... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.init.kaiming_normal_",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"functools.reduce",
"torch.nn.BatchNorm2d",
"torch.nn.init.constant_",
"torch.nn.init.normal_",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | [((977, 1014), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(2)', 'stride': '(2)'}), '(kernel_size=2, stride=2)\n', (989, 1014), True, 'import torch.nn as nn\n'), ((1567, 1589), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1580, 1589), True, 'import torch.nn as nn\n'), ((177... |
# Imports here
import matplotlib.pyplot as plt
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
from torchvision import datasets, transforms, models
import numpy as np
from PIL import Image
from collections import OrderedDict
import argparse
import json
import utils
ap = argpa... | [
"utils.load_checkpoint",
"utils.predict",
"argparse.ArgumentParser",
"json.load"
] | [((315, 364), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Predict.py"""'}), "(description='Predict.py')\n", (338, 364), False, 'import argparse\n'), ((1139, 1190), 'utils.load_checkpoint', 'utils.load_checkpoint', (['checkpoint_path', 'gpu_enabled'], {}), '(checkpoint_path, gpu_enable... |
from numpy.random import seed
seed(42)
from tensorflow import set_random_seed
set_random_seed(42)
import nltk
from nltk.corpus import stopwords
from xml.dom.minidom import parse
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
warnings.filterwarnings("ignore", category=DeprecationWarning)... | [
"matplotlib.pyplot.title",
"pickle.dump",
"numpy.random.seed",
"numpy.argmax",
"evaluator.evaluate",
"keras.models.Model",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"keras_contrib.layers.CRF",
"pickle.load",
"nltk.download",
"keras.layers.concatenate",
"sys.path.append",
"... | [((30, 38), 'numpy.random.seed', 'seed', (['(42)'], {}), '(42)\n', (34, 38), False, 'from numpy.random import seed\n'), ((78, 97), 'tensorflow.set_random_seed', 'set_random_seed', (['(42)'], {}), '(42)\n', (93, 97), False, 'from tensorflow import set_random_seed\n'), ((195, 257), 'warnings.simplefilter', 'warnings.simp... |
#! /bin/bash
# -*- coding: utf-8 -*-
import logging
import pandas as pd
import numpy as np
import click
from datetime import datetime
logger = logging.getLogger(__name__)
_COLS_TO_CONVERT = [
'market_data_current_price_usd',
'market_data_circulating_supply',
'market_data_ath_usd',
'market_data_high_24... | [
"logging.basicConfig",
"pandas.read_csv",
"click.command",
"pandas.to_datetime",
"datetime.datetime.fromtimestamp",
"pandas.concat",
"logging.getLogger"
] | [((144, 171), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'import logging\n'), ((6571, 6586), 'click.command', 'click.command', ([], {}), '()\n', (6584, 6586), False, 'import click\n'), ((1648, 1714), 'pandas.read_csv', 'pd.read_csv', (['path_bitcoin_df'], {'encoding... |
import multiprocessing as mp
from threading import Lock, RLock
from pybot.externals.viewer.websocket_server import WebsocketServer
from pybot.externals import marshalling_backend
from pybot.externals import unpack, pack
class _ThreadHandler(object):
def __init__(self):
self.lock_ = Lock()
self.ev... | [
"lcm.LCM",
"pybot.externals.marshalling_backend",
"threading.Lock",
"pybot.externals.viewer.websocket_server.WebsocketServer",
"multiprocessing.Process",
"pybot.externals.unpack",
"zmq.Context"
] | [((3291, 3312), 'pybot.externals.viewer.websocket_server.WebsocketServer', 'WebsocketServer', (['PORT'], {}), '(PORT)\n', (3306, 3312), False, 'from pybot.externals.viewer.websocket_server import WebsocketServer\n'), ((298, 304), 'threading.Lock', 'Lock', ([], {}), '()\n', (302, 304), False, 'from threading import Lock... |
# Generated by Django 3.1.1 on 2020-09-27 06:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_userprofile_instagram_link'),
]
operations = [
migrations.RenameField(
model_name='userprofile',
old_name='... | [
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField"
] | [((236, 327), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""userprofile"""', 'old_name': '"""firstname"""', 'new_name': '"""name"""'}), "(model_name='userprofile', old_name='firstname',\n new_name='name')\n", (258, 327), False, 'from django.db import migrations\n'), ((380, 445... |
#test write to Arduino
import serial
ser = serial.Serial('/dev/ttyACM2', 9600)
int_encode = b'2'
float_encode = b'42.3'
string1 = "Hello!"
string1_encode = string1.encode()
int1 = 1
int1_encode = b'%d' %int1 # %d is used for integer data types. float = %f
#ser.write(b'3')
#ser.write(b'5')
#ser.write(b'7')
ser.wri... | [
"serial.Serial"
] | [((43, 78), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM2"""', '(9600)'], {}), "('/dev/ttyACM2', 9600)\n", (56, 78), False, 'import serial\n')] |
from tweets.models import Comment
from django.db import router
# from posts.views import my_view
from rest_framework import routers
from django.urls.conf import include
from django.urls import path
from tweets.views import TweetViewSet, LikeViewSet, RetweetviewSet, CommentviewSet, index
router = routers.DefaultRouter... | [
"django.urls.path",
"django.db.router.register",
"rest_framework.routers.DefaultRouter",
"django.urls.conf.include"
] | [((299, 322), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (320, 322), False, 'from rest_framework import routers\n'), ((323, 362), 'django.db.router.register', 'router.register', (['"""tweets"""', 'TweetViewSet'], {}), "('tweets', TweetViewSet)\n", (338, 362), False, 'from django.... |
from enum import Enum, auto
class AutoName(Enum):
def _generate_next_value_(name, start, count, last_values):
return name.lower()
class CommandType(AutoName):
Unknown = auto()
Help = auto()
Status = auto()
Restart = auto()
Map = auto()
Bots = auto()
Playlist = auto()
Gamemo... | [
"enum.auto"
] | [((187, 193), 'enum.auto', 'auto', ([], {}), '()\n', (191, 193), False, 'from enum import Enum, auto\n'), ((205, 211), 'enum.auto', 'auto', ([], {}), '()\n', (209, 211), False, 'from enum import Enum, auto\n'), ((225, 231), 'enum.auto', 'auto', ([], {}), '()\n', (229, 231), False, 'from enum import Enum, auto\n'), ((24... |
"""Runs all Jupyter notebooks in given folders. Folder names (one or multiple)
can be passed as arguments to the script and can be provided relative to the
folder which contains all notebooks (e.g. "notebooks").
Notebooks are run with their enclosing folder as working directory.
Example
-------
If you want to run all ... | [
"nbconvert.preprocessors.ExecutePreprocessor",
"pathlib.Path",
"nbformat.write",
"nbformat.read"
] | [((2348, 2404), 'nbconvert.preprocessors.ExecutePreprocessor', 'ExecutePreprocessor', ([], {'timeout': 'None', 'kernel_name': '"""python3"""'}), "(timeout=None, kernel_name='python3')\n", (2367, 2404), False, 'from nbconvert.preprocessors import CellExecutionError, ExecutePreprocessor\n'), ((3145, 3162), 'pathlib.Path'... |
from genfigs.genfigs import *
# from ofspy.task import Task
# from ofspy.path import Path
import networkx as nx
import random
from collections import Counter
from scipy.optimize import minimize
# from matplotlib import pylab as plt
# import math
import numpy as np
import matplotlib.pyplot as plt
from gurobipy import Mo... | [
"networkx.draw_networkx_edges",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"gurobipy.Model",
"random.random",
"random.seed",
"networkx.draw_networkx_labels",
"networkx.circular_layout",
"itertools.product",
"networkx.DiGraph",
"gurobipy.LinExpr"
] | [((2766, 2777), 'gurobipy.Model', 'Model', (['"""LP"""'], {}), "('LP')\n", (2771, 2777), False, 'from gurobipy import Model, LinExpr, GRB, GurobiError\n'), ((3030, 3039), 'gurobipy.LinExpr', 'LinExpr', ([], {}), '()\n', (3037, 3039), False, 'from gurobipy import Model, LinExpr, GRB, GurobiError\n'), ((15137, 15149), 'n... |
import random, sys
def common_member_set(lista1, lista2):
a_set = set(lista1)
b_set = set(lista2)
if (a_set & b_set):
return sorted(list(a_set & b_set))
else:
return []
def remove_list_duplicates(lista):
cleanlist = []
[cleanlist.append(x) for x in lista if x not in clea... | [
"random.randint"
] | [((673, 694), 'random.randint', 'random.randint', (['(1)', '(30)'], {}), '(1, 30)\n', (687, 694), False, 'import random, sys\n'), ((717, 739), 'random.randint', 'random.randint', (['(1)', '(101)'], {}), '(1, 101)\n', (731, 739), False, 'import random, sys\n')] |
# Copyright 2019 Indiana Biosciences Research Institute (IBRI)
#
# 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 applica... | [
"django.core.wsgi.get_wsgi_application",
"tp.models.Experiment.objects.filter",
"tp.tasks.load_measurement_tech_gene_map",
"os.remove",
"tp.models.ToxicologyResult.objects.all",
"csv.reader",
"tp.tasks.load_module_scores",
"tp.models.Study.objects.get_or_create",
"pprint.pformat",
"tp.models.GeneS... | [((839, 905), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""toxapp.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'toxapp.settings')\n", (860, 905), False, 'import os\n'), ((920, 942), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (940, 942... |
from . import views as frontendview
from django.urls import path
from django.conf.urls import url, include, static
from django.contrib.auth import views as auth_views
from django.contrib import admin
urlpatterns = [
path('',frontendview.home,name='home'),
url(r'^signup/$', frontendview.signup, name='signup'),
... | [
"django.contrib.auth.views.LogoutView.as_view",
"django.contrib.auth.views.LoginView.as_view",
"django.conf.urls.url",
"django.urls.path"
] | [((220, 260), 'django.urls.path', 'path', (['""""""', 'frontendview.home'], {'name': '"""home"""'}), "('', frontendview.home, name='home')\n", (224, 260), False, 'from django.urls import path\n'), ((264, 316), 'django.conf.urls.url', 'url', (['"""^signup/$"""', 'frontendview.signup'], {'name': '"""signup"""'}), "('^sig... |
import numpy as np
from icecream import ic
if __name__ == '__main__':
length = 12
size = 6
a = np.ones(size) * -1
counter = 0
for i in range(size):
if i < size-1:
a[i] = i
else:
remain = length - (i+1)
counter += remain
a_mask = np.where(a==-1... | [
"icecream.ic",
"numpy.sum",
"numpy.empty_like",
"numpy.ones",
"numpy.where",
"numpy.random.choice"
] | [((349, 354), 'icecream.ic', 'ic', (['a'], {}), '(a)\n', (351, 354), False, 'from icecream import ic\n'), ((359, 369), 'icecream.ic', 'ic', (['a_mask'], {}), '(a_mask)\n', (361, 369), False, 'from icecream import ic\n'), ((374, 381), 'icecream.ic', 'ic', (['idx'], {}), '(idx)\n', (376, 381), False, 'from icecream impor... |
#!/usr/bin/python3
#-*- coding: utf-8 -*-
# coding: utf-8
# pylint: disable=C0103,C0111,W0621
#
# Freebox API SDK / Docs: http://dev.freebox.fr/sdk/os/login/
# version 8
#
from __future__ import print_function
from __future__ import unicode_literals
import os
import subprocess
import sys
# # To install the latest... | [
"application_config.measurement_namePrefix",
"application_config.export_switch_ports_stats",
"application_config.export_storage_disk",
"application_config.app_id",
"application_config.export_switch_status",
"application_config.export_wifi_usage",
"application_config.device_name",
"application_config.p... | [((956, 990), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'FORMAT'}), '(format=FORMAT)\n', (975, 990), False, 'import logging\n'), ((998, 1025), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1015, 1025), False, 'import logging\n'), ((1839, 1852), 'os.stat', 'os.stat', ... |
import logging
from time import sleep
import telegram
from telegram.ext import Updater, CommandHandler
from settings import *
class DailyBot:
def __init__(self, token):
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
level=logging.INFO,
... | [
"logging.basicConfig",
"time.sleep",
"telegram.ext.Updater",
"telegram.ext.CommandHandler",
"logging.getLogger"
] | [((186, 293), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (205, 293), False, 'import logging\n'), ((346, 370), 'loggin... |
import os
PACKDIR = os.path.abspath(os.path.dirname(__file__))
| [
"os.path.dirname"
] | [((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import os\n')] |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from symposion.schedule.cache import db, cache_key, cache_key_user
class Command(BaseCommand):
def delete(self, key):
with db.lock("%s-lock" % key):
db.delete(key)
def handle(self, *... | [
"symposion.schedule.cache.db.delete",
"symposion.schedule.cache.cache_key",
"symposion.schedule.cache.db.lock",
"symposion.schedule.cache.cache_key_user",
"django.contrib.auth.models.User.objects.all"
] | [((240, 264), 'symposion.schedule.cache.db.lock', 'db.lock', (["('%s-lock' % key)"], {}), "('%s-lock' % key)\n", (247, 264), False, 'from symposion.schedule.cache import db, cache_key, cache_key_user\n'), ((278, 292), 'symposion.schedule.cache.db.delete', 'db.delete', (['key'], {}), '(key)\n', (287, 292), False, 'from ... |
import logging
import sys
from PyQt5 import QtWidgets
from .mainwindow import MainWindow
def run():
app = QtWidgets.QApplication(sys.argv)
mw = MainWindow()
try:
mw.openFile(sys.argv[1])
except:
pass
logging.root.setLevel(logging.DEBUG)
app.exec_()
if __name__ == '__main__'... | [
"PyQt5.QtWidgets.QApplication",
"logging.root.setLevel"
] | [((114, 146), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (136, 146), False, 'from PyQt5 import QtWidgets\n'), ((240, 276), 'logging.root.setLevel', 'logging.root.setLevel', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (261, 276), False, 'import logging\n')] |
import logging
import pytest
import json
import time
from ocs_ci.framework.testlib import scale, E2ETest
from ocs_ci.framework.testlib import skipif_ocs_version
from ocs_ci.ocs import hsbench
from ocs_ci.framework import config
from ocs_ci.ocs.ocp import OCP
from ocs_ci.ocs.bucket_utils import compare_bucket_object_li... | [
"ocs_ci.framework.testlib.skipif_ocs_version",
"pytest.fixture",
"ocs_ci.ocs.scale_noobaa_lib.noobaa_running_node_restart",
"ocs_ci.ocs.ocp.OCP",
"time.sleep",
"ocs_ci.ocs.hsbench.HsBench",
"json.dumps",
"pytest.mark.polarion_id",
"ocs_ci.ocs.bucket_utils.compare_bucket_object_list",
"logging.getL... | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (387, 397), False, 'import logging\n'), ((401, 429), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (415, 429), False, 'import pytest\n'), ((666, 692), 'ocs_ci.framework.testlib.skipif_ocs_v... |
from urllib.parse import urlparse
from itsdangerous.timed import TimedSerializer, TimestampSigner
from requests import Response
from requests.sessions import Session
from django.contrib.auth import get_user_model
from django.shortcuts import reverse
from django.test import override_settings, TestCase
from django.util... | [
"itsdangerous.timed.TimedSerializer",
"django.utils.timezone.now",
"django.contrib.auth.get_user_model",
"requests.Response",
"django.shortcuts.reverse",
"urllib.parse.urlparse"
] | [((439, 455), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (453, 455), False, 'from django.contrib.auth import get_user_model\n'), ((522, 575), 'itsdangerous.timed.TimedSerializer', 'TimedSerializer', (["TEST_SSO_SETTINGS['sso_private_key']"], {}), "(TEST_SSO_SETTINGS['sso_private_key'])\n"... |
# -*- coding:utf-8 -*-
"""
通用Easy Mock操作方法
传入:
1.url -- easy mock路径
2.匹配类型 -- 即要替换的目标值
3.替换值 -- 替换目标的值
输出:
1.查看原url的接口内容
2.替换执行是否成功
具体做法:
"""
import requests
import json
import re
from collections import namedtuple
class EasyMock(object):
... | [
"requests.post",
"collections.namedtuple",
"requests.get",
"json.loads"
] | [((848, 908), 'requests.post', 'requests.post', (['login_url'], {'data': 'self.login_info', 'verify': '(False)'}), '(login_url, data=self.login_info, verify=False)\n', (861, 908), False, 'import requests\n'), ((1051, 1096), 'collections.namedtuple', 'namedtuple', (['"""mockURL"""', "['path', 'project_id']"], {}), "('mo... |
"""
sentry.filters.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as django_settings
from django.utils.datastructures import SortedDict
from sentry.conf import settings
from sentry.models ... | [
"django.utils.datastructures.SortedDict",
"django.contrib.sites.models.Site.objects.get_current"
] | [((614, 662), 'django.utils.datastructures.SortedDict', 'SortedDict', (["[(0, 'Unresolved'), (1, 'Resolved')]"], {}), "([(0, 'Unresolved'), (1, 'Resolved')])\n", (624, 662), False, 'from django.utils.datastructures import SortedDict\n'), ((1748, 1774), 'django.contrib.sites.models.Site.objects.get_current', 'Site.objec... |
from django.contrib import admin
from gameon.users import models
admin.site.register(models.Profile)
| [
"django.contrib.admin.site.register"
] | [((67, 102), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Profile'], {}), '(models.Profile)\n', (86, 102), False, 'from django.contrib import admin\n')] |
from __future__ import annotations
import asyncio
import weakref
from types import TracebackType
from typing import Any, Awaitable, Callable, Optional
from ..config import Config
from ..typing import ASGIFramework, ASGIReceiveCallable, ASGIReceiveEvent, ASGISendEvent, Scope
from ..utils import invoke_asgi
async def... | [
"asyncio.gather",
"asyncio.Queue",
"weakref.WeakSet"
] | [((883, 900), 'weakref.WeakSet', 'weakref.WeakSet', ([], {}), '()\n', (898, 900), False, 'import weakref\n'), ((1222, 1262), 'asyncio.Queue', 'asyncio.Queue', (['config.max_app_queue_size'], {}), '(config.max_app_queue_size)\n', (1235, 1262), False, 'import asyncio\n'), ((1861, 1889), 'asyncio.gather', 'asyncio.gather'... |
import time
import os
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from scipy.io import savemat
parser = argparse.ArgumentParser()
parser.add_argument('--tol', type=float, default=1e-3)
parser.add_argument('--adjoint', type=eval, default=False)
parser.add_argument(... | [
"torch.nn.MSELoss",
"numpy.save",
"numpy.load",
"argparse.ArgumentParser",
"torch.random.manual_seed",
"os.makedirs",
"torch.nn.Tanh",
"numpy.empty",
"torch.nn.Sequential",
"scipy.io.savemat",
"torch.cat",
"time.time",
"torch.save",
"torchdiffeq.odeint",
"torch.cuda.is_available",
"tor... | [((160, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (183, 185), False, 'import argparse\n'), ((2234, 2264), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(2021)'], {}), '(2021)\n', (2258, 2264), False, 'import torch\n'), ((3069, 3081), 'torch.nn.MSELoss', 'nn.MSELoss', ([]... |
"""Unit tests for module for interacting with octave / MATL."""
import base64
import json
import os
import pytest
import shutil
from bs4 import BeautifulSoup
from datetime import datetime
from matl_online import matl
from matl_online.utils import parse_iso8601, ISO8601_FORMAT
from matl_online.public.models import Re... | [
"matl_online.public.models.Release.query.count",
"os.path.isfile",
"matl_online.matl.help_file",
"os.path.join",
"os.path.dirname",
"matl_online.matl.get_matl_folder",
"pytest.raises",
"matl_online.matl.refresh_releases",
"matl_online.matl.add_doc_links",
"matl_online.utils.parse_iso8601",
"date... | [((415, 440), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (430, 440), False, 'import os\n'), ((740, 785), 'matl_online.matl.get_matl_folder', 'matl.get_matl_folder', (['"""18.3.0"""'], {'install': '(False)'}), "('18.3.0', install=False)\n", (760, 785), False, 'from matl_online import matl\... |
import os
import pickledb
import requests
from pathlib import Path
try:
os.makedirs(str(Path.home() / '.sussex'))
except(FileExistsError):
pass
db = pickledb.load(str(Path.home() / '.sussex' / '.auth'), False)
def save_session_id(sessid):
db.set('session_id', sessid)
db.dump()
def read_session_id()... | [
"requests.Session",
"pathlib.Path.home"
] | [((572, 590), 'requests.Session', 'requests.Session', ([], {}), '()\n', (588, 590), False, 'import requests\n'), ((93, 104), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (102, 104), False, 'from pathlib import Path\n'), ((177, 188), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (186, 188), False, 'from pat... |
import pbr.version
from sphinx.util import logging
from . import directive, domain
LOG = logging.getLogger(__name__)
__version__ = pbr.version.VersionInfo(
"sphinxcontrib.datatemplates").version_string()
def setup(app):
LOG.info('initializing sphinxcontrib.datatemplates')
app.add_directive('datatemplat... | [
"sphinx.util.logging.getLogger"
] | [((91, 118), 'sphinx.util.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (108, 118), False, 'from sphinx.util import logging\n')] |
"""
Permits calling arbitrary functions and passing some forms of data from C++
to Python (only one direction) as a server-client pair.
The server in this case is the C++ program, and the client is this binary.
For an example of C++ usage, see `call_python_server_test.cc`.
Here's an example of running with the C++ te... | [
"argparse.ArgumentParser",
"numpy.sin",
"os.path.join",
"numpy.meshgrid",
"traceback.print_exc",
"numpy.linspace",
"matplotlib.pyplot.pause",
"threading.Thread",
"matplotlib.pyplot.show",
"numpy.ones_like",
"os.stat",
"matplotlib.interactive",
"numpy.frombuffer",
"signal.getsignal",
"num... | [((5645, 5673), 'matplotlib.interactive', 'matplotlib.interactive', (['(True)'], {}), '(True)\n', (5667, 5673), False, 'import matplotlib\n'), ((20361, 20464), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description... |
#!/usr/bin/env python3
# encoding: utf-8
import json
import requests
import urllib3
from time import time
from urllib.parse import unquote_plus
from settings import API_EP_DOUYIN, ROUTE_SIGN_DOUYIN
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def get_original_url(action, args_dict, ts, device_... | [
"json.loads",
"json.dumps",
"time.time",
"urllib3.disable_warnings",
"urllib.parse.unquote_plus"
] | [((199, 266), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (223, 266), False, 'import urllib3\n'), ((2967, 2983), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2977, 2983), False, 'import json\n')... |
import matplotlib.pyplot as plt
import pymongo
# Make pi chart of 18+ posts
# All charts in graph folder
def intilise_database(db_name):
"""
Initilse the database and make a table instance
Returns
pymongo object of the table
"""
myclient = pymongo.MongoClient("mongodb://localhost:27017/"... | [
"pymongo.MongoClient",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((760, 774), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (772, 774), True, 'import matplotlib.pyplot as plt\n'), ((957, 967), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (965, 967), True, 'import matplotlib.pyplot as plt\n'), ((272, 321), 'pymongo.MongoClient', 'pymongo.MongoClient', ([... |
"""Tests for the middlewares of the ``traces`` app."""
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from django_libs.tests.factories import UserFactory
from mock import Mock
from factories import BlacklistIPFactory
from ..middleware import TracesMiddleware
from ..models import... | [
"django.contrib.auth.models.AnonymousUser",
"django_libs.tests.factories.UserFactory",
"mock.Mock"
] | [((483, 489), 'mock.Mock', 'Mock', ([], {}), '()\n', (487, 489), False, 'from mock import Mock\n'), ((518, 533), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (531, 533), False, 'from django.contrib.auth.models import AnonymousUser\n'), ((758, 764), 'mock.Mock', 'Mock', ([], {}), '()\n'... |
""" Plot SV3 Results """
# LRGs
import sys
sys.path.append('/home/mehdi/github/LSSutils')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import healpy as hp
import numpy as np
from time import time
import fitsio as ft
from lssutils.lab import (make_overdensity, AnaFast,
... | [
"sys.path.append",
"pandas.read_hdf",
"lssutils.lab.make_overdensity",
"lssutils.stats.pcc.pcc",
"lssutils.lab.hpixsum",
"lssutils.lab.AnaFast",
"lssutils.lab.get_meandensity",
"numpy.isfinite",
"time.time",
"numpy.percentile",
"fitsio.read",
"numpy.log10",
"lssutils.dataviz.setup_color",
... | [((44, 90), 'sys.path.append', 'sys.path.append', (['"""/home/mehdi/github/LSSutils"""'], {}), "('/home/mehdi/github/LSSutils')\n", (59, 90), False, 'import sys\n'), ((4698, 4711), 'lssutils.dataviz.setup_color', 'setup_color', ([], {}), '()\n', (4709, 4711), False, 'from lssutils.dataviz import setup_color\n'), ((5059... |
# -*- coding: utf-8 -*-
"""
The entrance for ipfs module.
"""
import logging
import shutil
from pathlib import Path
from src import hive_setting
from src.utils_v1.common import gene_temp_file_name
from src.utils_v1.constants import VAULT_ACCESS_WR, VAULT_ACCESS_R, DID_INFO_DB_NAME
from src.utils_v1.payment.vault_serv... | [
"src.utils_v1.common.gene_temp_file_name",
"src.utils.file_manager.fm.ipfs_upload_file_from_path",
"src.utils.file_manager.fm.ipfs_download_file_to_path",
"src.utils_v1.payment.vault_service_manage.update_used_storage_for_files_data",
"src.utils.db_client.cli.insert_one",
"src.utils.db_client.cli.find_one... | [((1628, 1665), 'src.utils.did_auth.check_auth_and_vault', 'check_auth_and_vault', (['VAULT_ACCESS_WR'], {}), '(VAULT_ACCESS_WR)\n', (1648, 1665), False, 'from src.utils.did_auth import check_auth_and_vault\n'), ((1868, 1904), 'src.utils.did_auth.check_auth_and_vault', 'check_auth_and_vault', (['VAULT_ACCESS_R'], {}), ... |
"""This module implements a time series class with related methods."""
from collections import deque
from datetime import datetime, timedelta
from IPython.display import display
from matplotlib.axes import Axes
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd... | [
"datetime.datetime.fromisoformat",
"numpy.flatnonzero",
"IPython.display.display",
"numpy.array",
"pandas.Series",
"datetime.timedelta",
"matplotlib.pyplot.subplots"
] | [((1209, 1231), 'pandas.Series', 'pd.Series', (['self.series'], {}), '(self.series)\n', (1218, 1231), True, 'import pandas as pd\n'), ((1834, 1856), 'pandas.Series', 'pd.Series', (['self.series'], {}), '(self.series)\n', (1843, 1856), True, 'import pandas as pd\n'), ((3106, 3128), 'pandas.Series', 'pd.Series', (['self.... |
from atst.database import db
from atst.domain.common import Query
from atst.models.audit_event import AuditEvent
class AuditEventQuery(Query):
model = AuditEvent
@classmethod
def get_all(cls, pagination_opts):
query = db.session.query(cls.model).order_by(cls.model.time_created.desc())
ret... | [
"atst.database.db.session.query",
"atst.models.audit_event.AuditEvent.time_created.desc"
] | [((241, 268), 'atst.database.db.session.query', 'db.session.query', (['cls.model'], {}), '(cls.model)\n', (257, 268), False, 'from atst.database import db\n'), ((1926, 1956), 'atst.models.audit_event.AuditEvent.time_created.desc', 'AuditEvent.time_created.desc', ([], {}), '()\n', (1954, 1956), False, 'from atst.models.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('crowdsourcing', '0015_auto_20150709_0149'... | [
"django.db.migrations.swappable_dependency",
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey",
"django.db.migrations.DeleteModel",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((210, 267), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (241, 267), False, 'from django.db import models, migrations\n'), ((813, 882), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name... |
"""
Django settings for abs project.
Generated by 'django-admin startproject' using Django 2.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
import... | [
"platform.system",
"os.path.abspath",
"os.path.join"
] | [((1868, 1900), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static"""'], {}), "(BASE_DIR, 'static')\n", (1880, 1900), False, 'import os\n'), ((3001, 3018), 'platform.system', 'platform.system', ([], {}), '()\n', (3016, 3018), False, 'import platform\n'), ((467, 492), 'os.path.abspath', 'os.path.abspath', (['__fil... |
#!/usr/bin/env python
import os,sys
sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)))
| [
"os.path.dirname"
] | [((72, 97), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (87, 97), False, 'import os, sys\n')] |
##########################################################################
#
# Copyright (c) 2009-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | [
"unittest.main",
"IECore.CompoundObject.staticTypeId",
"IECore.SubstitutedDict",
"IECore.StringData"
] | [((4137, 4152), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4150, 4152), False, 'import unittest\n'), ((2040, 2102), 'IECore.SubstitutedDict', 'IECore.SubstitutedDict', (['d', "{'name': 'john', 'place': 'london'}"], {}), "(d, {'name': 'john', 'place': 'london'})\n", (2062, 2102), False, 'import IECore\n'), ((3... |
"""
Copyright (C) 2017-2018 University of Massachusetts Amherst.
This file is part of "learned-string-alignments"
http://github.com/iesl/learned-string-alignments
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... | [
"subprocess.Popen",
"torch.sum",
"codecs.open"
] | [((785, 818), 'codecs.open', 'codecs.open', (['filename', '"""r"""', 'codec'], {}), "(filename, 'r', codec)\n", (796, 818), False, 'import codecs\n'), ((932, 981), 'torch.sum', 'torch.sum', (['(tensor1 * tensor2)'], {'dim': '(1)', 'keepdim': '(True)'}), '(tensor1 * tensor2, dim=1, keepdim=True)\n', (941, 981), False, '... |
'''
Copyright (c) <2012> <NAME> <<EMAIL>>
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, copy, modify,
merge, publish, dist... | [
"Yowsup.Common.debugger.Debugger.attach"
] | [((1280, 1301), 'Yowsup.Common.debugger.Debugger.attach', 'Debugger.attach', (['self'], {}), '(self)\n', (1295, 1301), False, 'from Yowsup.Common.debugger import Debugger\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def migrate_categories(apps, schema_editor):
Post = apps.get_model("bulletin", "Post")
PostCategory = apps.get_model("bulletin", "PostCategory")
for post in Post.objects.filter(category__isnull=False):
... | [
"django.db.migrations.RunPython"
] | [((624, 664), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_categories'], {}), '(migrate_categories)\n', (644, 664), False, 'from django.db import migrations\n')] |
import argparse
import collections
import numpy as np
parser = argparse.ArgumentParser(
description='Convert T5 predictions into a TREC-formatted run.')
parser.add_argument('--predictions', type=str, required=True, help='T5 predictions file.')
parser.add_argument('--query_run_ids', type=str, required=True,
... | [
"collections.defaultdict",
"numpy.exp",
"argparse.ArgumentParser"
] | [((65, 158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert T5 predictions into a TREC-formatted run."""'}), "(description=\n 'Convert T5 predictions into a TREC-formatted run.')\n", (88, 158), False, 'import argparse\n'), ((551, 580), 'collections.defaultdict', 'collections.d... |
import argparse
import pprint
from PyPDF2 import PdfFileWriter, PdfFileReader
import os
import logging
parser = argparse.ArgumentParser(description="Split pdf into multiple files")
parser.add_argument("-i","--input", help="Input file", required=True)
parser.add_argument("-l","--list", help="Comma separated list for sp... | [
"pprint.pformat",
"logging.debug",
"argparse.ArgumentParser",
"logging.basicConfig",
"logging.info",
"os.path.splitext",
"PyPDF2.PdfFileWriter"
] | [((113, 181), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Split pdf into multiple files"""'}), "(description='Split pdf into multiple files')\n", (136, 181), False, 'import argparse\n'), ((1121, 1153), 'logging.debug', 'logging.debug', (['"""Split list is :"""'], {}), "('Split list is... |
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, InternetGateway
class TestDescribeInternetGateway(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return """
<DescribeInternetGatewaysRespo... | [
"tests.unit.unittest.main"
] | [((6059, 6074), 'tests.unit.unittest.main', 'unittest.main', ([], {}), '()\n', (6072, 6074), False, 'from tests.unit import unittest\n')] |
import numpy as np
import gym
from gym import Wrapper
from gym.spaces import Discrete, Box
from gym_pomdp.envs.rock import RockEnv, Obs
class RockSampleHistoryEnv(Wrapper):
"""
takes observations from an RockSample environment and stacks to history given hist_len of history length
"""
def __init__(... | [
"gym.make",
"numpy.zeros",
"numpy.hstack",
"numpy.array",
"gym.spaces.Box",
"numpy.concatenate"
] | [((2699, 2715), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (2707, 2715), False, 'import gym\n'), ((9135, 9203), 'numpy.zeros', 'np.zeros', (['(self.observation_space.shape[0] - self.historyIgnoreIdx,)'], {}), '((self.observation_space.shape[0] - self.historyIgnoreIdx,))\n', (9143, 9203), True, 'import nump... |
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
# Load training data set from CSV file
training_data_df = pd.read_csv("sales_data_training.csv")
# Load testing data set from CSV file
test_data_df = pd.read_csv("sales_data_test.csv")
# Data needs to be scaled to a small range like 0 to 1 for the ne... | [
"pandas.read_csv",
"sklearn.preprocessing.MinMaxScaler",
"pandas.DataFrame"
] | [((126, 164), 'pandas.read_csv', 'pd.read_csv', (['"""sales_data_training.csv"""'], {}), "('sales_data_training.csv')\n", (137, 164), True, 'import pandas as pd\n'), ((219, 253), 'pandas.read_csv', 'pd.read_csv', (['"""sales_data_test.csv"""'], {}), "('sales_data_test.csv')\n", (230, 253), True, 'import pandas as pd\n'... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
"""
Update selected component from upstream in Fedora
"""
import logging
import os
import click
from packit.cli.types import LocalProjectParameter
from packit.cli.utils import cover_packit_exception, get_packit_api
from packit.config imp... | [
"packit.cli.types.LocalProjectParameter",
"click.option",
"packit.config.get_context_settings",
"packit.cli.utils.get_packit_api",
"logging.getLogger"
] | [((415, 442), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (432, 442), False, 'import logging\n'), ((526, 679), 'click.option', 'click.option', (['"""--dist-git-branch"""'], {'help': '"""Comma separated list of target branches in dist-git to sync from. (defaults to repo\'s default branc... |
from torch import nn
__all__ = ['MobileNetV2']
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It can be seen here:
https://github.com/tensorflow/models/blob/master/resear... | [
"torch.nn.Dropout",
"torch.nn.AdaptiveAvgPool2d",
"thop.profile",
"torch.nn.ReLU6",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.randn",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.nn.init.zeros_",
"torch.clamp",
"torch.nn.init.norm... | [((21493, 21520), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(224)', '(224)'], {}), '(1, 3, 224, 224)\n', (21504, 21520), False, 'import torch\n'), ((21713, 21743), 'thop.profile', 'profile', (['model'], {'inputs': '[input]'}), '(model, inputs=[input])\n', (21720, 21743), False, 'from thop import profile\n'), ((202... |
import dataclasses as dtc
import librosa
import numpy as np
import torch
from torch.utils.data import Dataset
from typing import Optional, Callable, Union
import re
from torch._six import string_classes
import collections
__all__ = [
'Setter',
'Getter',
'AsSlice',
'AsFramedSlice',
'GetId',
'I... | [
"librosa.util.frame",
"re.compile",
"dataclasses.field",
"torch.cuda.is_available",
"torch.from_numpy"
] | [((5117, 5137), 're.compile', 're.compile', (['"""[SaUO]"""'], {}), "('[SaUO]')\n", (5127, 5137), False, 'import re\n'), ((1055, 1090), 'dataclasses.field', 'dtc.field', ([], {'default': 'None', 'init': '(False)'}), '(default=None, init=False)\n', (1064, 1090), True, 'import dataclasses as dtc\n'), ((3917, 3985), 'libr... |
import sys
def import_module(name, path):
if sys.version_info >= (3, 5):
import importlib.util
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
elif sys.version_info >=... | [
"imp.load_source",
"importlib.machinery.SourceFileLoader"
] | [((488, 515), 'imp.load_source', 'imp.load_source', (['name', 'path'], {}), '(name, path)\n', (503, 515), False, 'import imp\n'), ((401, 429), 'importlib.machinery.SourceFileLoader', 'SourceFileLoader', (['name', 'path'], {}), '(name, path)\n', (417, 429), False, 'from importlib.machinery import SourceFileLoader\n')] |
import time
from peewee import *
from playhouse.postgres_ext import ArrayField, BinaryJSONField
from model import BaseModel, MyTimestampField
from model.board import Board
from model._post import POST_TYPES
from model.topic import Topic
from slim import json_ex_dumps
class PostStats(BaseModel):
id = BlobField(pri... | [
"model.MyTimestampField",
"model.topic.Topic.get_by_pk",
"playhouse.postgres_ext.BinaryJSONField",
"time.time"
] | [((1932, 1960), 'model.MyTimestampField', 'MyTimestampField', ([], {'index': '(True)'}), '(index=True)\n', (1948, 1960), False, 'from model import BaseModel, MyTimestampField\n'), ((1972, 2008), 'playhouse.postgres_ext.BinaryJSONField', 'BinaryJSONField', ([], {'dumps': 'json_ex_dumps'}), '(dumps=json_ex_dumps)\n', (19... |
import os
import pandas as pd
import hashlib
from glob import glob
from helpers.menu_extractor import MenuExtractor
input_path = './data'
output_file = './data/raw_menu_data.csv'
def sha1sum(filename):
h = hashlib.sha1()
b = bytearray(128 * 1024)
mv = memoryview(b)
with open(filename, 'rb', bufferin... | [
"helpers.menu_extractor.MenuExtractor",
"hashlib.sha1",
"os.path.basename",
"pandas.read_csv",
"os.path.join"
] | [((214, 228), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (226, 228), False, 'import hashlib\n'), ((2167, 2191), 'pandas.read_csv', 'pd.read_csv', (['output_file'], {}), '(output_file)\n', (2178, 2191), True, 'import pandas as pd\n'), ((887, 911), 'pandas.read_csv', 'pd.read_csv', (['output_file'], {}), '(output_... |
from tornado import httpserver
from tornado.ioloop import IOLoop
import tornado.web
import json
"""
In this file, the API is defined to obtain information about the simulation and control of avatars.
Specifically, the API provide the next requests:
/api/v1/movements_occupants
Returns the movement... | [
"tornado.ioloop.IOLoop.current",
"json.dumps"
] | [((1922, 1938), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (1932, 1938), False, 'import json\n'), ((2106, 2122), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (2116, 2122), False, 'import json\n'), ((2290, 2306), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (2300, 2306), False, 'import... |
import numpy as np
# The last dimensions of box_1 and box_2 are both 4. (x, y, w, h)
class IOU(object):
def __init__(self, box_1, box_2):
self.box_1_min, self.box_1_max = self.__get_box_min_and_max(box_1)
self.box_2_min, self.box_2_max = self.__get_box_min_and_max(box_2)
self.box_1_area = ... | [
"numpy.minimum",
"numpy.maximum"
] | [((768, 810), 'numpy.maximum', 'np.maximum', (['self.box_1_min', 'self.box_2_min'], {}), '(self.box_1_min, self.box_2_min)\n', (778, 810), True, 'import numpy as np\n'), ((835, 877), 'numpy.minimum', 'np.minimum', (['self.box_1_max', 'self.box_2_max'], {}), '(self.box_1_max, self.box_2_max)\n', (845, 877), True, 'impor... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.get",
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set"
] | [((3732, 3787), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""privateLinkServiceConnectionState"""'}), "(name='privateLinkServiceConnectionState')\n", (3745, 3787), False, 'import pulumi\n'), ((4122, 4161), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""provisioningState"""'}), "(name='provisioningState')\n"... |
"""Errors encountered while executing scrape jobs."""
from datetime import timezone
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.types import Enum
import vigorish.database as db
from vigorish.enums import DataSet
from v... | [
"sqlalchemy.types.Enum",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column",
"vigorish.util.datetime_util.get_local_utcoffset",
"vigorish.util.datetime_util.make_tzaware"
] | [((572, 605), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (578, 605), False, 'from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, String\n'), ((624, 657), 'sqlalchemy.Column', 'Column', (['DateTime'], {'default': 'utc_now'}), '(DateTime, d... |
'''
Function:
Algorithm implementation.
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import cv2
import math
import numpy as np
from PIL import Image
from scipy import signal
from utils.utils import *
from scipy.ndimage import interpolation
from scipy.sparse.linalg import spsolve
from scipy.sparse import csr_matrix, spdiag... | [
"numpy.abs",
"numpy.rot90",
"numpy.zeros_like",
"numpy.true_divide",
"scipy.signal.convolve2d",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.power",
"scipy.ndimage.interpolation.zoom",
"numpy.cumsum",
"numpy.reshape",
"scipy.sparse.linalg.spsolve",
"math.ceil",
"cv2.calcHist",
"scipy.sparse.csr... | [((338, 371), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (361, 371), False, 'import warnings\n'), ((850, 872), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (860, 872), False, 'import cv2\n'), ((2535, 2574), 'numpy.zeros', 'np.zeros', (['(kernel_s... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('_nested_admin/', include('nested_admin.urls')),
path('', include('home.urls')),
path('blog/', include... | [
"django.conf.urls.static.static",
"django.urls.path",
"django.urls.include"
] | [((168, 199), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (172, 199), False, 'from django.urls import path, include\n'), ((424, 485), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MED... |
import os
from tt_web import utils
from tt_web.tests import helpers as web_helpers
from .. import service
from .. import operations
class BaseTests(web_helpers.BaseTests):
def create_application(self):
return service.create_application(get_config())
async def clean_environment(self, app=None):
... | [
"os.path.dirname",
"tt_web.utils.load_config"
] | [((475, 505), 'tt_web.utils.load_config', 'utils.load_config', (['config_path'], {}), '(config_path)\n', (492, 505), False, 'from tt_web import utils\n'), ((410, 435), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (425, 435), False, 'import os\n')] |
"""Uses fedelemflowlist analysis functions to perform and export basic analysis."""
import fedelemflowlist
from fedelemflowlist.analysis.flow_list_analysis import count_flows_by_class,\
count_flowables_by_class, list_contexts
from fedelemflowlist.globals import outputpath
if __name__ == '__main__':
flowlist = ... | [
"fedelemflowlist.get_flows",
"fedelemflowlist.analysis.flow_list_analysis.count_flows_by_class",
"fedelemflowlist.analysis.flow_list_analysis.list_contexts",
"fedelemflowlist.analysis.flow_list_analysis.count_flowables_by_class"
] | [((320, 347), 'fedelemflowlist.get_flows', 'fedelemflowlist.get_flows', ([], {}), '()\n', (345, 347), False, 'import fedelemflowlist\n'), ((431, 461), 'fedelemflowlist.analysis.flow_list_analysis.count_flows_by_class', 'count_flows_by_class', (['flowlist'], {}), '(flowlist)\n', (451, 461), False, 'from fedelemflowlist.... |
import pandas as pd
df5 = pd.read_csv('D:/data/final_data_5.csv')
df6 = pd.read_csv('D:/data/final_data_6.csv')
df7 = pd.read_csv('D:/data/final_data_7.csv')
df8 = pd.read_csv('D:/data/final_data_8.csv')
df9 = pd.read_csv('D:/data/final_data_9.csv')
df10 = pd.read_csv('D:/data/final_data_10.csv')
dict = ... | [
"pandas.read_csv"
] | [((27, 66), 'pandas.read_csv', 'pd.read_csv', (['"""D:/data/final_data_5.csv"""'], {}), "('D:/data/final_data_5.csv')\n", (38, 66), True, 'import pandas as pd\n'), ((74, 113), 'pandas.read_csv', 'pd.read_csv', (['"""D:/data/final_data_6.csv"""'], {}), "('D:/data/final_data_6.csv')\n", (85, 113), True, 'import pandas as... |
import os
import glob
import re
import audiomate
from audiomate.corpus import assets
from audiomate.corpus import subset
from . import base
LABEL_PATTERN = re.compile(r'(.*)_\d')
class AEDReader(base.CorpusReader):
"""
Reader for the Acoustic Event Dataset.
.. seealso::
`AED <https://data.visio... | [
"audiomate.corpus.subset.MatchingUtteranceIdxFilter",
"audiomate.corpus.subset.Subview",
"audiomate.corpus.assets.LabelList.create_single",
"os.path.basename",
"audiomate.Corpus",
"os.path.join",
"re.compile"
] | [((158, 180), 're.compile', 're.compile', (['"""(.*)_\\\\d"""'], {}), "('(.*)_\\\\d')\n", (168, 180), False, 'import re\n'), ((552, 579), 'audiomate.Corpus', 'audiomate.Corpus', ([], {'path': 'path'}), '(path=path)\n', (568, 579), False, 'import audiomate\n'), ((603, 629), 'os.path.join', 'os.path.join', (['path', '"""... |
import time
import sys
import os
hpcAccount = 'your_hpc_account_here'
## The following lines indicate the order of the command line arguments that need to be supplied to this script.
# Check if system arguments were provided
if len(sys.argv) > 1:
inDir = sys.argv[1] # Input directory in which to search for param... | [
"os.path.basename",
"os.path.isdir",
"os.walk",
"time.sleep",
"os.path.isfile",
"os.path.splitext",
"os.path.join",
"sys.exit"
] | [((1139, 1159), 'os.path.isdir', 'os.path.isdir', (['inDir'], {}), '(inDir)\n', (1152, 1159), False, 'import os\n'), ((1073, 1084), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1081, 1084), False, 'import sys\n'), ((1240, 1254), 'os.walk', 'os.walk', (['inDir'], {}), '(inDir)\n', (1247, 1254), False, 'import os\n')... |
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from v1.shop.urls import router as shop_router
urlpatterns = [
path('admin/', admin.site.urls),
path('auth/', include('djoser.urls')),
path('auth/', include('djoser.urls.jwt')),
]
rout... | [
"django.urls.path",
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((325, 360), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (338, 360), False, 'from rest_framework.routers import DefaultRouter\n'), ((190, 221), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.url... |
import abc
import inspect
import itertools
import math
import os
import platform
import statistics
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from textwrap import dedent
from typing import (
Collection,
Dict,
Generator,
Iterable,
Iterator,
List,
O... | [
"os.get_terminal_size",
"platform.python_version",
"rich.text.Text",
"pathlib.Path",
"ward._fixtures.fixture_parents_and_children",
"ward._utilities.group_by",
"inspect.getsourcelines",
"rich.text.Text.assemble",
"rich.highlighter.NullHighlighter",
"rich.progress.SpinnerColumn",
"rich.rule.Rule"... | [((1488, 2160), 'rich.theme.Theme', 'Theme', (["{'title': 'bold', 'heading': 'bold', 'pass': '#ffffff on #137C39',\n 'pass.textonly': '#189F4A', 'fail': '#ffffff on #BF2D2D',\n 'fail.textonly': '#BF2D2D', 'fail.header': 'bold #BF2D2D', 'skip':\n '#ffffff on #0E67B3', 'skip.textonly': '#1381E0', 'xpass':\n '... |
"""Generate example matplotlib plots of polynomials created using the
func.Polynomial class."""
import matplotlib.pyplot as plt
from func import Polynomial
# Define an example polynomial and it's derivatives.
f_x = Polynomial([(3, 1), (2, -2), (1, 1)])
# Define a set of x-values for the plot.
num_points = 100
x_min ... | [
"func.Polynomial",
"matplotlib.pyplot.plot"
] | [((217, 254), 'func.Polynomial', 'Polynomial', (['[(3, 1), (2, -2), (1, 1)]'], {}), '([(3, 1), (2, -2), (1, 1)])\n', (227, 254), False, 'from func import Polynomial\n'), ((451, 479), 'matplotlib.pyplot.plot', 'plt.plot', (['x_values', 'y_values'], {}), '(x_values, y_values)\n', (459, 479), True, 'import matplotlib.pypl... |
"""
Tests for the blaze interface to the pipeline api.
"""
from __future__ import division
from collections import OrderedDict
from datetime import timedelta
from unittest import TestCase
import warnings
import blaze as bz
from datashape import dshape, var, Record
from nose_parameterized import parameterized
import n... | [
"zipline.pipeline.engine.SimplePipelineEngine",
"toolz.curried.operator.itemgetter",
"blaze.transform",
"pandas.DataFrame",
"toolz.curried.operator.attrgetter",
"nose_parameterized.parameterized.expand",
"datashape.dshape",
"warnings.simplefilter",
"zipline.pipeline.loaders.blaze.BlazeLoader",
"wa... | [((994, 1015), 'toolz.curried.operator.attrgetter', 'op.attrgetter', (['"""name"""'], {}), "('name')\n", (1007, 1015), True, 'from toolz.curried import operator as op\n'), ((1026, 1048), 'toolz.curried.operator.attrgetter', 'op.attrgetter', (['"""dtype"""'], {}), "('dtype')\n", (1039, 1048), True, 'from toolz.curried i... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import torch
from .stage0 import Stage0
from .stage1 import Stage1
from .stage2 import Stage2
from .stage3 import Stage3
class GNMTSplit(torch.nn.Module):
def __init__(self):
super(GNMTSplit, self).__init__()
self.stage0 = St... | [
"torch.nn.init.constant_",
"torch.nn.init.kaiming_normal_",
"torch.nn.init.normal_"
] | [((917, 993), 'torch.nn.init.kaiming_normal_', 'torch.nn.init.kaiming_normal_', (['m.weight'], {'mode': '"""fan_out"""', 'nonlinearity': '"""relu"""'}), "(m.weight, mode='fan_out', nonlinearity='relu')\n", (946, 993), False, 'import torch\n'), ((1053, 1087), 'torch.nn.init.constant_', 'torch.nn.init.constant_', (['m.bi... |
import cv2
import numpy as np
from pyzbar.pyzbar import decode
def decoder(image):
gray_img = cv2.cvtColor(image, 0)
barcode = decode(gray_img)
for obj in barcode:
points = obj.polygon
(x, y, w, h) = obj.rect
pts = np.array(points, np.int32)
pts = pts.reshape((-1, 1, 2))
... | [
"cv2.putText",
"cv2.polylines",
"cv2.cvtColor",
"pyzbar.pyzbar.decode",
"cv2.waitKey",
"cv2.VideoCapture",
"numpy.array",
"cv2.imshow"
] | [((700, 719), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (716, 719), False, 'import cv2\n'), ((100, 122), 'cv2.cvtColor', 'cv2.cvtColor', (['image', '(0)'], {}), '(image, 0)\n', (112, 122), False, 'import cv2\n'), ((137, 153), 'pyzbar.pyzbar.decode', 'decode', (['gray_img'], {}), '(gray_img)\n', (1... |
#!/usr/bin/python3
# Copyright 2018 <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... | [
"grinlib.lib.get_db",
"random.randint",
"grinbase.model.pool_utxo.Pool_utxo.get_locked_by_id",
"grinbase.model.pool_utxo.Pool_utxo.getPayable",
"grinlib.lib.get_logger",
"subprocess.check_output",
"socket.socket",
"datetime.datetime.utcnow",
"grinlib.grin.get_api_url",
"grinlib.lib.get_config",
... | [((2138, 2156), 'grinlib.grin.get_api_url', 'grin.get_api_url', ([], {}), '()\n', (2154, 2156), False, 'from grinlib import grin\n'), ((2161, 2200), 'os.chdir', 'os.chdir', (["CONFIG[PROCESS]['wallet_dir']"], {}), "(CONFIG[PROCESS]['wallet_dir'])\n", (2169, 2200), False, 'import os\n'), ((3810, 3826), 'grinlib.lib.get_... |
import requests
import magic
def get_content_type_ext (content_type, req=None):
content_type = content_type.lower()
if content_type.startswith('image/jpeg') or content_type.startswith('image/jpg'):
return '.jpg'
elif content_type.startswith('image/png'):
return '.png'
elif content_type.... | [
"magic.from_buffer"
] | [((626, 667), 'magic.from_buffer', 'magic.from_buffer', (['req.content'], {'mime': '(True)'}), '(req.content, mime=True)\n', (643, 667), False, 'import magic\n')] |
#!/usr/bin/env python3
from os.path import dirname, realpath, split,\
join, isdir, exists
from os import remove, system, mkdir
from logging import getLogger, basicConfig,\
DEBUG, INFO, ERROR
from argparse import ArgumentParser
from atexit import register
from shutil import rmtree
from jinja2 import Environmen... | [
"docker.from_env",
"os.mkdir",
"os.remove",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.isdir",
"os.path.realpath",
"os.path.exists",
"jinja2.FileSystemLoader",
"shutil.rmtree",
"os.path.join",
"logging.getLogger"
] | [((85469, 85485), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (85483, 85485), False, 'from argparse import ArgumentParser\n'), ((899, 924), 'os.path.join', 'join', (['self.tmp', 'self.name'], {}), '(self.tmp, self.name)\n', (903, 924), False, 'from os.path import dirname, realpath, split, join, isdir... |
"""Chemisty Flash Cards.
This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.
The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well
as testing instructions are located at http://amzn.to/1LzFrj6
For additional samples, visit the Alexa Skills Kit Getting Started guide... | [
"random.shuffle",
"random.random"
] | [((9526, 9546), 'random.shuffle', 'random.shuffle', (['temp'], {}), '(temp)\n', (9540, 9546), False, 'import random\n'), ((7124, 7139), 'random.random', 'random.random', ([], {}), '()\n', (7137, 7139), False, 'import random\n'), ((8568, 8583), 'random.random', 'random.random', ([], {}), '()\n', (8581, 8583), False, 'im... |
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("dash_tabulator")
| [
"PyInstaller.utils.hooks.collect_data_files"
] | [((64, 100), 'PyInstaller.utils.hooks.collect_data_files', 'collect_data_files', (['"""dash_tabulator"""'], {}), "('dash_tabulator')\n", (82, 100), False, 'from PyInstaller.utils.hooks import collect_data_files\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.models.package import NPM, Package
from gratipay.testing import Harness
class Tests(Harness):
def setUp(self):
self.make_package()
def test_trailing_slash_redirects(self):
... | [
"gratipay.models.package.Package.from_names"
] | [((1540, 1572), 'gratipay.models.package.Package.from_names', 'Package.from_names', (['"""npm"""', '"""foo"""'], {}), "('npm', 'foo')\n", (1558, 1572), False, 'from gratipay.models.package import NPM, Package\n')] |