code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
mylogger = logging.getLogger("My Script")
# mylogger = logging.getLogger(__name__)
## messages
mylogger.debug("Сообщение уровня debug")
mylogger.info("Сообщение уровня info")
mylogger.warning("Сообщение уровня warning")
| [
"logging.getLogger"
] | [((27, 57), 'logging.getLogger', 'logging.getLogger', (['"""My Script"""'], {}), "('My Script')\n", (44, 57), False, 'import logging\n')] |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Post, Like, Comment
from .forms import PostForm, CommentForm
from User.models import UserProfile
from django.db import IntegrityError
from django.contrib import messages
def comment_adjustment_view(request, id, id2): # id is a commen... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.shortcuts.redirect",
"django.contrib.messages.warning"
] | [((347, 380), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Comment'], {'id': 'id'}), '(Comment, id=id)\n', (364, 380), False, 'from django.shortcuts import render, redirect, get_object_or_404\n'), ((392, 423), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Post'], {'id': 'id2'}), '(Post,... |
from collections.abc import Mapping
from tempfile import NamedTemporaryFile
from typing import Any, List, Literal, Optional, Type
import yamale
from colored import attr, fg
from yamale.validators import DefaultValidators, Validator
from opta.constants import REGISTRY, yaml
from opta.exceptions import UserErrors
cla... | [
"tempfile.NamedTemporaryFile",
"opta.constants.yaml.dump_all",
"opta.exceptions.UserErrors",
"yamale.make_data",
"yamale.validators.DefaultValidators.copy",
"yamale.validate",
"colored.fg",
"opta.constants.yaml.dump",
"colored.attr",
"yamale.make_schema"
] | [((4604, 4628), 'yamale.validators.DefaultValidators.copy', 'DefaultValidators.copy', ([], {}), '()\n', (4626, 4628), False, 'from yamale.validators import DefaultValidators, Validator\n'), ((4682, 4706), 'yamale.validators.DefaultValidators.copy', 'DefaultValidators.copy', ([], {}), '()\n', (4704, 4706), False, 'from ... |
import pandas
__pandas_version__ = "0.25.3"
if pandas.__version__ != __pandas_version__:
raise ImportError(
"The pandas version installed does not match the required pandas "
"version in Modin. Please install pandas {} to use "
"Modin.".format(__pandas_version__)
)
from pandas import ... | [
"ray.init",
"ray.register_custom_serializer",
"os.path.dirname",
"tempfile.gettempdir",
"ray.utils.get_system_memory",
"distributed.client._get_global_client",
"ray.worker.global_worker.run_function_on_all_workers",
"os.environ.get",
"distributed.Client",
"warnings.warn",
"threading.current_thre... | [((2509, 2550), 'os.environ.get', 'os.environ.get', (['"""MODIN_RAY_CLUSTER"""', 'None'], {}), "('MODIN_RAY_CLUSTER', None)\n", (2523, 2550), False, 'import os\n'), ((2575, 2618), 'os.environ.get', 'os.environ.get', (['"""MODIN_REDIS_ADDRESS"""', 'None'], {}), "('MODIN_REDIS_ADDRESS', None)\n", (2589, 2618), False, 'im... |
"""
Test suite for ssp.securityplan module.
"""
import os
import sys
import pytest
import docx
from ssp.securityplan import SecurityPlan
TEST_DIR = os.path.dirname(os.path.abspath(__file__))
class TestSecurityPlan(object):
def test_that_word_doc_opens(self):
"""
Make sure basic word docs op... | [
"os.path.abspath",
"ssp.securityplan.SecurityPlan"
] | [((167, 192), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (182, 192), False, 'import os\n'), ((444, 462), 'ssp.securityplan.SecurityPlan', 'SecurityPlan', (['path'], {}), '(path)\n', (456, 462), False, 'from ssp.securityplan import SecurityPlan\n'), ((874, 904), 'ssp.securityplan.SecurityP... |
import argparse
import logging
from typing import Union
import pytorch_lightning as pl
import torch
from torch.utils.data import DataLoader
from retinanet import Retinanet
from utils import collate_fn, load_obj
class RetinaNetModel(pl.LightningModule):
"""
Lightning Class to wrap the RetinaNet Model.
So... | [
"torch.as_tensor",
"utils.load_obj",
"logging.getLogger"
] | [((2757, 2778), 'torch.as_tensor', 'torch.as_tensor', (['loss'], {}), '(loss)\n', (2772, 2778), False, 'import torch\n'), ((3437, 3460), 'torch.as_tensor', 'torch.as_tensor', (['metric'], {}), '(metric)\n', (3452, 3460), False, 'import torch\n'), ((1094, 1107), 'utils.load_obj', 'load_obj', (['opt'], {}), '(opt)\n', (1... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import os
import onnx
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import build_detection_test_loader
from detectron2.evaluation import COCOEvaluator, inference... | [
"os.makedirs",
"argparse.ArgumentParser",
"detectron2.evaluation.print_csv_format",
"detectron2.modeling.build_model",
"detectron2.utils.logger.setup_logger",
"detectron2.evaluation.COCOEvaluator",
"detectron2.config.get_cfg",
"detectron2.export.Caffe2Tracer",
"detectron2.export.add_export_config",
... | [((538, 547), 'detectron2.config.get_cfg', 'get_cfg', ([], {}), '()\n', (545, 547), False, 'from detectron2.config import get_cfg\n'), ((680, 702), 'detectron2.export.add_export_config', 'add_export_config', (['cfg'], {}), '(cfg)\n', (697, 702), False, 'from detectron2.export import Caffe2Tracer, add_export_config\n'),... |
#!/usr/bin/env python2
# coding: utf-8
"""Test ONLY_ON_SYMBOLIZED."""
import unittest
from triton import ARCH, MODE, CPUSIZE, TritonContext, Instruction, MemoryAccess
def checkAstIntegrity(instruction):
"""
This function check if all ASTs under an Instruction class are still
available.
"""
try:
... | [
"triton.MemoryAccess",
"triton.TritonContext",
"triton.Instruction"
] | [((955, 970), 'triton.TritonContext', 'TritonContext', ([], {}), '()\n', (968, 970), False, 'from triton import ARCH, MODE, CPUSIZE, TritonContext, Instruction, MemoryAccess\n'), ((1080, 1105), 'triton.Instruction', 'Instruction', (["b'H\\x89\\xc3'"], {}), "(b'H\\x89\\xc3')\n", (1091, 1105), False, 'from triton import ... |
"""
General Setup and Imports
"""
get_ipython().run_line_magic('matplotlib', 'tk')
import matplotlib.pyplot as plt
from bluesky import RunEngine
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky.plans import *
from bluesky.preprocessors import run_wrapper
from bluesky.utils import install_nb_kic... | [
"bluesky.utils.install_nb_kicker",
"bluesky.plan_stubs.close_run",
"ophyd.signal.EpicsSignalRO",
"functools.partial",
"argparse.ArgumentParser",
"bluesky.plan_stubs.unsubscribe",
"bluesky.callbacks.LivePlot",
"bluesky.callbacks.best_effort.BestEffortCallback",
"pswalker.plans.walk_to_pixel",
"matp... | [((997, 1032), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'noise_scale'}), '(scale=noise_scale)\n', (1013, 1032), True, 'import numpy as np\n'), ((2125, 2153), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 10)'}), '(figsize=(15, 10))\n', (2135, 2153), True, 'import matplotlib.pyplot as... |
""" VariableTree class definition
"""
import copy
# pylint: disable-msg=E0611,F0401
from enthought.traits.has_traits import FunctionType
from openmdao.main.variable import Variable
from openmdao.main.container import Container
from openmdao.main.datatypes.api import Slot, Str
from openmdao.main.rbac import rbac
from ... | [
"copy.deepcopy",
"openmdao.main.case.flatten_obj",
"openmdao.main.rbac.rbac",
"openmdao.main.datatypes.api.Str",
"openmdao.main.datatypes.api.Slot",
"openmdao.main.mp_support.is_instance"
] | [((481, 488), 'openmdao.main.datatypes.api.Str', 'Str', (['""""""'], {}), "('')\n", (484, 488), False, 'from openmdao.main.datatypes.api import Slot, Str\n'), ((967, 990), 'openmdao.main.rbac.rbac', 'rbac', (["('owner', 'user')"], {}), "(('owner', 'user'))\n", (971, 990), False, 'from openmdao.main.rbac import rbac\n')... |
import json
import re
import subprocess
from collections import OrderedDict
from collections import deque
# 3rd party libraries
import jinja2
# 1st party libraries
from lookuponterra.graph import Graph, Node, Edge
from lookuponterra.util import OrderedSet
class DotGraph(Graph):
def __init__(self, filename, fil... | [
"lookuponterra.util.OrderedSet",
"json.dumps",
"re.match",
"lookuponterra.graph.Node.svg_id_counter",
"lookuponterra.graph.Edge.svg_id_counter",
"jinja2.BaseLoader",
"collections.OrderedDict",
"re.sub",
"collections.deque",
"re.compile"
] | [((449, 462), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (460, 462), False, 'from collections import OrderedDict\n'), ((866, 943), 're.compile', 're.compile', (['"""\\\\s+\\\\"(?P<src>.*)\\\\"\\\\s+\\\\-\\\\>(?P<dst>.*)\\\\s+\\\\[(?P<fmt>.*)\\\\]"""'], {}), '(\'\\\\s+\\\\"(?P<src>.*)\\\\"\\\\s+\\\\-\\\... |
# tests for things that are not implemented, or have non-compliant behaviour
import array
# array deletion not implemented
try:
a = array.array('b', (1, 2, 3))
del a[1]
except TypeError:
print('TypeError')
# slice with step!=1 not implemented
try:
a = array.array('b', (1, 2, 3))
print(a[3:2:2])
e... | [
"array.array"
] | [((138, 165), 'array.array', 'array.array', (['"""b"""', '(1, 2, 3)'], {}), "('b', (1, 2, 3))\n", (149, 165), False, 'import array\n'), ((271, 298), 'array.array', 'array.array', (['"""b"""', '(1, 2, 3)'], {}), "('b', (1, 2, 3))\n", (282, 298), False, 'import array\n')] |
import emcee
import numpy as np
from astropy.io import fits
from pylinear.utilities import indices,pool
def mp_mcmcUncertainty(A,bi,func,conf):
if A is None or bi is None:
return None,None,None
ndim=1
p0=[]
nwalkers=conf['nwalkers']
for i in range(nwalkers):
p0.append(np.ar... | [
"numpy.sum",
"numpy.random.randn",
"emcee.EnsembleSampler",
"numpy.std",
"numpy.percentile",
"pylinear.utilities.pool.Pool",
"numpy.array"
] | [((388, 447), 'emcee.EnsembleSampler', 'emcee.EnsembleSampler', (['nwalkers', 'ndim', 'lnlike'], {'args': '(A, bi)'}), '(nwalkers, ndim, lnlike, args=(A, bi))\n', (409, 447), False, 'import emcee\n'), ((662, 685), 'numpy.std', 'np.std', (['samples'], {'axis': '(0)'}), '(samples, axis=0)\n', (668, 685), True, 'import nu... |
import numpy as np
import heapq
import tensorflow as tf
from sklearn.metrics import roc_auc_score
from layers import Dense, CrossCompressUnit
import metrics
def test_one_user(x, train_items, test_items, item_num, Ks):
rating, u = x[0], x[1]
training_items = train_items[u] if u in train_items else []
user_... | [
"tensorflow.reduce_sum",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.get_variable",
"metrics.ndcg_at_k",
"metrics.auc",
"tensorflow.concat",
"heapq.nlargest",
"numpy.equal",
"tensorflow.placeholder",
"numpy.max",
"tensorflow.nn.embedding_lookup",
"sklearn.metrics.roc_auc_sco... | [((749, 802), 'heapq.nlargest', 'heapq.nlargest', (['K_max', 'item_score'], {'key': 'item_score.get'}), '(K_max, item_score, key=item_score.get)\n', (763, 802), False, 'import heapq\n'), ((1857, 1906), 'metrics.auc', 'metrics.auc', ([], {'ground_truth': 'r', 'prediction': 'posterior'}), '(ground_truth=r, prediction=pos... |
# -*- coding: utf-8 -*-
from mahjong.constants import CHUN, HAKU, HATSU
from mahjong.hand_calculating.yaku import Yaku
from mahjong.utils import is_pon
class Daisangen(Yaku):
"""
The hand contains three sets of dragons
"""
def __init__(self, yaku_id=None):
super(Daisangen, self).__init__(yaku... | [
"mahjong.utils.is_pon"
] | [((703, 715), 'mahjong.utils.is_pon', 'is_pon', (['item'], {}), '(item)\n', (709, 715), False, 'from mahjong.utils import is_pon\n')] |
import boto3
import time
import subprocess
import argparse
import os
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--queue', dest='queue',default='workshop', help='Amazon SQS')
parser.add_argument('--region', dest='region',default=None, help='Region')
args = parser.parse_a... | [
"argparse.ArgumentParser",
"boto3.client",
"subprocess.check_output",
"time.sleep",
"boto3.resource",
"os.getenv"
] | [((79, 140), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(description='Process some integers.')\n", (102, 140), False, 'import argparse\n'), ((1160, 1178), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1172, 1178), False, 'import boto3... |
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404,redirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.decorators import login_required
from neighbor.forms import SignupF... | [
"neighbor.models.Neighborhood.search",
"neighbor.models.Neighborhood.objects.all",
"neighbor.models.Business.objects.all",
"neighbor.forms.NeighborhoodForm",
"django.http.HttpResponseRedirect",
"neighbor.models.Business.search",
"django.contrib.auth.login",
"django.http.HttpResponse",
"django.contri... | [((998, 1042), 'django.shortcuts.render', 'render', (['request', '"""registration/confirm.html"""'], {}), "(request, 'registration/confirm.html')\n", (1004, 1042), False, 'from django.shortcuts import render, get_object_or_404, redirect\n'), ((2574, 2677), 'django.shortcuts.render', 'render', (['request', '"""registrat... |
import json
import graphene
import pytest
from django.shortcuts import reverse
from saleor.product.models import Category, Product, ProductAttribute
from prices import Money
from .utils import get_graphql_content
def test_category_query(client, product_in_stock):
category = Category.objects.first()
query = ... | [
"saleor.product.models.Product.objects.count",
"prices.Money",
"graphene.Node.to_global_id",
"saleor.product.models.ProductAttribute.objects.count",
"saleor.product.models.ProductAttribute.objects.prefetch_related",
"saleor.product.models.Product.objects.update",
"django.shortcuts.reverse",
"saleor.pr... | [((283, 307), 'saleor.product.models.Category.objects.first', 'Category.objects.first', ([], {}), '()\n', (305, 307), False, 'from saleor.product.models import Category, Product, ProductAttribute\n'), ((1977, 2000), 'saleor.product.models.Product.objects.count', 'Product.objects.count', ([], {}), '()\n', (1998, 2000), ... |
from django.core.management.base import BaseCommand
from django.db.models import Count
from project.pastebin.models import Country
class Command(BaseCommand):
help = 'countries statistics'
def handle(self, *args, **kwargs):
countries = Country.objects.annotate(
pastes_count=Count('users__... | [
"django.db.models.Count"
] | [((306, 328), 'django.db.models.Count', 'Count', (['"""users__pastes"""'], {}), "('users__pastes')\n", (311, 328), False, 'from django.db.models import Count\n')] |
__author__ = "<NAME>"
__copyright__ = "Copyright, 2021, <NAME>"
__license__ = "3-Clause BSD License"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMIT... | [
"numpy.divide",
"numpy.sum",
"numpy.abs",
"numpy.empty",
"numpy.square",
"numpy.ones",
"numpy.arange"
] | [((1709, 1755), 'numpy.empty', 'np.empty', (['(degree, theta.size)'], {'dtype': 'np.float'}), '((degree, theta.size), dtype=np.float)\n', (1717, 1755), True, 'import numpy as np\n'), ((1772, 1796), 'numpy.ones', 'np.ones', (['(1, theta.size)'], {}), '((1, theta.size))\n', (1779, 1796), True, 'import numpy as np\n'), ((... |
import tensorflow as tf
class TFrecordCreator:
"""
Creates TFRecord Dataset to store the memorization metric
"""
def __init__(self,path):
self.path = path
self.writer = tf.io.TFRecordWriter(path)
def _int64_feature(self,value):
"""Returns an int64_list from a bool / enum... | [
"os.remove",
"tensorflow.data.TFRecordDataset",
"tensorflow.train.Int64List",
"tensorflow.train.Features",
"tensorflow.io.parse_single_example",
"tensorflow.train.FloatList",
"tensorflow.io.FixedLenFeature",
"tensorflow.io.TFRecordWriter"
] | [((2204, 2230), 'os.remove', 'os.remove', (['"""temp.tfrecord"""'], {}), "('temp.tfrecord')\n", (2213, 2230), False, 'import os\n'), ((201, 227), 'tensorflow.io.TFRecordWriter', 'tf.io.TFRecordWriter', (['path'], {}), '(path)\n', (221, 227), True, 'import tensorflow as tf\n'), ((1407, 1438), 'tensorflow.data.TFRecordDa... |
import os
import logging
import sys
class WebAppModuleLoader:
folder = ""
blacklist = ['base_app.py', '__init__.py']
modules = []
logger = None
is_aggressive = False
module = None
def __init__(self, folder='../webapp', blacklist=[], is_aggressive=False, log_level=logging.INFO):
fo... | [
"os.path.dirname",
"logging.StreamHandler",
"logging.Formatter",
"os.listdir",
"logging.getLogger"
] | [((516, 552), 'logging.getLogger', 'logging.getLogger', (['"""Web App Scanner"""'], {}), "('Web App Scanner')\n", (533, 552), False, 'import logging\n'), ((606, 639), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (627, 639), False, 'import logging\n'), ((691, 764), 'logging.F... |
from pydatanet.server import Server, ServerType
def onPacketSend(sender, data):
print(f"{sender.getIp()} sent me this!: {data}")
s = Server(
"localhost", 5050, ServerType.UDP
)
s.on_recv_bind(onPacketSend)
s.connect() | [
"pydatanet.server.Server"
] | [((139, 180), 'pydatanet.server.Server', 'Server', (['"""localhost"""', '(5050)', 'ServerType.UDP'], {}), "('localhost', 5050, ServerType.UDP)\n", (145, 180), False, 'from pydatanet.server import Server, ServerType\n')] |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
import copy
import torch
# import modules to to register feature extractors
from fcos_core.modeling.backbone import build_backbone # NoQA
from fcos_core.modeling.roi_heads.roi_heads import build_roi_heads # NoQA
from fcos_core.mode... | [
"unittest.main",
"copy.deepcopy",
"tests.utils.load_config",
"fcos_core.structures.bounding_box.BoxList",
"torch.rand"
] | [((3045, 3060), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3058, 3060), False, 'import unittest\n'), ((1685, 1733), 'torch.rand', 'torch.rand', (['[N, C_in, H, W]'], {'dtype': 'torch.float32'}), '([N, C_in, H, W], dtype=torch.float32)\n', (1695, 1733), False, 'import torch\n'), ((1845, 1878), 'fcos_core.struc... |
"""
File system utils.
"""
import os
import sys
import errno
import shutil
import glob
import pwd
import codecs
import hashlib
import tarfile
import fnmatch
from datetime import datetime
from socket import gethostname
f_ext = os.path.splitext
f_expand = os.path.expanduser
f_size = os.path.getsize
is_file = os.path.... | [
"shutil.ignore_patterns",
"os.remove",
"shutil.copystat",
"os.path.islink",
"glob.glob",
"shutil.rmtree",
"os.path.join",
"shutil.copy",
"codecs.open",
"os.path.exists",
"socket.gethostname",
"os.path.normpath",
"tarfile.open",
"os.path.getctime",
"datetime.datetime.now",
"hashlib.md5"... | [((607, 620), 'socket.gethostname', 'gethostname', ([], {}), '()\n', (618, 620), False, 'from socket import gethostname\n'), ((821, 868), 'codecs.open', 'codecs.open', (['fname'], {'mode': 'mode', 'encoding': '"""utf-8"""'}), "(fname, mode=mode, encoding='utf-8')\n", (832, 868), False, 'import codecs\n'), ((2489, 2505)... |
#!/usr/bin/env python3
import math
from sys import path
path.append("..")
from utils.convert import numparse
import pygal
from pint import UnitRegistry
if __name__ == "__main__":
ureg = UnitRegistry()
length_datapoints = []
with open("../data/distances.txt", "r") as f:
for line in f.readlines():
... | [
"sys.path.append",
"math.asin",
"pint.UnitRegistry",
"utils.convert.numparse",
"pygal.Box"
] | [((57, 74), 'sys.path.append', 'path.append', (['""".."""'], {}), "('..')\n", (68, 74), False, 'from sys import path\n'), ((193, 207), 'pint.UnitRegistry', 'UnitRegistry', ([], {}), '()\n', (205, 207), False, 'from pint import UnitRegistry\n'), ((646, 678), 'pygal.Box', 'pygal.Box', ([], {'legend_at_bottom': '(True)'})... |
#!/bin/python3
from __future__ import print_function
from functools import wraps
import os, sys, imp, random, string, re, errno, threading, time, queue
GOAL = 100 # goal score for Hog
STRATEGY_FUNC_ATTR = 'final_strategy' # attribute of student's module that contains the strategy function
TEAM_NAME_ATTRS = ['PLAYER_N... | [
"sys.path.append",
"queue.Queue",
"threading.Thread.__init__",
"os.path.join",
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"os.path.realpath",
"os.path.exists",
"random.choice",
"time.sleep",
"imp.load_source",
"os.strerror",
"functools.wraps",
"sys.setrecursionlimit",
"re.sub",... | [((7965, 7984), 'sys.path.append', 'sys.path.append', (['""""""'], {}), "('')\n", (7980, 7984), False, 'import shutil, os, sys\n'), ((1821, 1845), 'os.strerror', 'os.strerror', (['errno.ETIME'], {}), '(errno.ETIME)\n', (1832, 1845), False, 'import shutil, os, sys\n'), ((2655, 2684), 'sys.setrecursionlimit', 'sys.setrec... |
import time
def time_it(func):
# courtesy of <NAME>!
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(func.__name__ + ' took ' + str((end - start) * 1000) + ' ms')
return result
return wrapper
| [
"time.time"
] | [((108, 119), 'time.time', 'time.time', ([], {}), '()\n', (117, 119), False, 'import time\n'), ((173, 184), 'time.time', 'time.time', ([], {}), '()\n', (182, 184), False, 'import time\n')] |
import time
start = time.perf_counter()
import io
import os
import sys
from karl import KarlSDK
from datetime import datetime
karl = KarlSDK()
import torch, torchvision
from torchvision import transforms
from PIL import Image, ImageDraw
sys.stderr.write('imports\t\t%.3fs\n' % (time.perf_counter() - start))
torch.hub... | [
"io.BytesIO",
"karl.KarlSDK",
"time.perf_counter",
"PIL.Image.open",
"torchvision.models.detection.maskrcnn_resnet50_fpn",
"PIL.ImageDraw.Draw",
"torch.hub.set_dir",
"torch.no_grad",
"torchvision.transforms.ToTensor"
] | [((20, 39), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (37, 39), False, 'import time\n'), ((134, 143), 'karl.KarlSDK', 'KarlSDK', ([], {}), '()\n', (141, 143), False, 'from karl import KarlSDK\n'), ((311, 337), 'torch.hub.set_dir', 'torch.hub.set_dir', (['"""torch"""'], {}), "('torch')\n", (328, 337), ... |
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
"six.add_metaclass"
] | [((695, 725), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (712, 725), False, 'import six\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"superset.db_engine_specs.elasticsearch.ElasticSearchEngineSpec.convert_dttm",
"unittest.mock.MagicMock",
"superset.db_engine_specs.elasticsearch.OpenDistroEngineSpec.convert_dttm",
"superset.db_engine_specs.elasticsearch.OpenDistroEngineSpec.execute",
"sqlalchemy.column"
] | [((2192, 2203), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (2201, 2203), False, 'from unittest.mock import MagicMock\n'), ((2259, 2354), 'superset.db_engine_specs.elasticsearch.OpenDistroEngineSpec.execute', 'OpenDistroEngineSpec.execute', (['mock_cursor', '"""-- some comment \nSELECT 1\n --other comment... |
"""
Lines 5 and 6 were adapted from SO code:
http://stackoverflow.com/questions/4383571/importing-files-from-different-folder-in-python
"""
import sys
sys.path.insert(0, '..')
""" END """
import main as program
import pytest
def test_for_i_2():
assert program.span_without_basis(2) == program.binary_matrix([
... | [
"main.span_without_basis",
"main.binary_matrix",
"sys.path.insert"
] | [((151, 175), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (166, 175), False, 'import sys\n'), ((258, 287), 'main.span_without_basis', 'program.span_without_basis', (['(2)'], {}), '(2)\n', (284, 287), True, 'import main as program\n'), ((291, 322), 'main.binary_matrix', 'program.binar... |
#!/usr/bin/env python3
# The MIT License
# Copyright (c) 2016 Estonian Information System Authority (RIA), Population Register Centre (VRK)
#
# 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 ... | [
"python_common.format_query_operational_data_request_template",
"python_common.parse_and_clean_xml",
"os.path.join",
"python_common.generate_message_id",
"sys.path.append",
"python_common.get_multipart_json_payload",
"python_common.parse_multipart_response",
"python_common.parse_and_check_soap_respons... | [((1404, 1425), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1419, 1425), False, 'import sys\n'), ((3904, 3973), 'os.path.join', 'os.path.join', (['request_template_dir', '"""simple_xroad_query_template.xml"""'], {}), "(request_template_dir, 'simple_xroad_query_template.xml')\n", (3916, 3973),... |
import argparse, socket, time, json, datetime, platform, psutil, requests, pprint, uuid
from retrying import retry
import yaml, pynvml
###############################################################################
# GPU
###############################################################################
HAS_CUDA = False
t... | [
"psutil.virtual_memory",
"yaml.load",
"argparse.ArgumentParser",
"json.dumps",
"pynvml.nvmlDeviceGetHandleByIndex",
"datetime.datetime.utcnow",
"pprint.pprint",
"platform.release",
"requests.post",
"psutil.cpu_count",
"pynvml.nvmlInit",
"psutil.net_io_counters",
"psutil.disk_usage",
"socke... | [((6256, 6326), 'retrying.retry', 'retry', ([], {'stop_max_attempt_number': '(3)', 'retry_on_result': 'retry_if_result_none'}), '(stop_max_attempt_number=3, retry_on_result=retry_if_result_none)\n', (6261, 6326), False, 'from retrying import retry\n'), ((328, 345), 'pynvml.nvmlInit', 'pynvml.nvmlInit', ([], {}), '()\n'... |
from qtpy import QtWidgets, QtCore
from qtpy.QtCore import Qt
class AnnotationScene(QtWidgets.QGraphicsScene):
clickRequest = QtCore.Signal(int, int, bool)
def __init__(self, parent=None):
super(AnnotationScene, self).__init__(parent)
self.creating = False
self.polygon_items = []
... | [
"qtpy.QtCore.Signal"
] | [((132, 161), 'qtpy.QtCore.Signal', 'QtCore.Signal', (['int', 'int', 'bool'], {}), '(int, int, bool)\n', (145, 161), False, 'from qtpy import QtWidgets, QtCore\n')] |
from __future__ import absolute_import, print_function, division
import os
import shutil
import unittest
from tempfile import mkdtemp
import numpy as np
import theano
from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.misc.pkl_utils import dump, load, StripPickler
class T_dump_load(unittest.TestCase)... | [
"numpy.load",
"os.getcwd",
"theano.misc.pkl_utils.dump",
"theano.misc.pkl_utils.load",
"theano.sandbox.rng_mrg.MRG_RandomStreams",
"tempfile.mkdtemp",
"theano.shared",
"numpy.array",
"theano.misc.pkl_utils.StripPickler",
"shutil.rmtree",
"os.chdir",
"theano.tensor.matrix"
] | [((441, 452), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (450, 452), False, 'import os\n'), ((475, 484), 'tempfile.mkdtemp', 'mkdtemp', ([], {}), '()\n', (482, 484), False, 'from tempfile import mkdtemp\n'), ((493, 514), 'os.chdir', 'os.chdir', (['self.tmpdir'], {}), '(self.tmpdir)\n', (501, 514), False, 'import os\n'... |
# -*- coding: utf-8 -*-
'''
Configure the WiFi Preferred Networks settings on macOS
=======================================================
Support for configuring a WiFi Preferred Networks settings on macOS.
Requires the PyObjC Library, bundled with the macOS installer as of 2029.2.0.
.. note::
This state is pr... | [
"logging.getLogger"
] | [((1648, 1675), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1665, 1675), False, 'import logging\n')] |
# Import configurations
import FWCore.ParameterSet.Config as cms
process = cms.Process("test")
process.load("CalibTracker.SiStripDCS.MessLogger_cfi")
process.SiStripConfigDb = cms.Service("SiStripConfigDb",
ConfDb = cms.untracked.string('username/password@cms_omds_nolb'),
TNS_ADMIN = cms.untracked.string('.'... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.untracked.vuint32",
"FWCore.ParameterSet.Config.untracked.vint32",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.Proces... | [((76, 95), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""test"""'], {}), "('test')\n", (87, 95), True, 'import FWCore.ParameterSet.Config as cms\n'), ((5331, 5376), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""oracle://cms_omds_nolb/username"""'], {}), "('oracle://cms_omds_nolb/username')\n", ... |
from __future__ import absolute_import, print_function, division
import contextlib
import blinker
import pprint
from mitmproxy import exceptions
"""
The base implementation for Options.
"""
class OptManager(object):
"""
.changed is a blinker Signal that triggers whenever options are
updated... | [
"pprint.pformat",
"blinker.Signal"
] | [((970, 986), 'blinker.Signal', 'blinker.Signal', ([], {}), '()\n', (984, 986), False, 'import blinker\n'), ((1022, 1038), 'blinker.Signal', 'blinker.Signal', ([], {}), '()\n', (1036, 1038), False, 'import blinker\n'), ((3127, 3163), 'pprint.pformat', 'pprint.pformat', (['self._opts'], {'indent': '(4)'}), '(self._opts,... |
# MIT License
#
# Copyright (c) 2018-2019 Red Hat, Inc.
# 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, m... | [
"urllib.parse.urlparse",
"ogr.read_only.if_readonly",
"ogr.abstract.GitTag",
"ogr.utils.filter_paths",
"ogr.exceptions.OperationNotSupported",
"ogr.exceptions.OgrException",
"ogr.exceptions.PagureAPIException",
"ogr.utils.indirect",
"logging.getLogger",
"ogr.services.pagure.release.PagureRelease"
... | [((1943, 1970), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1960, 1970), False, 'import logging\n'), ((7643, 7673), 'ogr.utils.indirect', 'indirect', (['PagureIssue.get_list'], {}), '(PagureIssue.get_list)\n', (7651, 7673), False, 'from ogr.utils import RequestResponse, filter_paths, ... |
from __future__ import (print_function, absolute_import)
import numpy as np
from .profiles import get_profiles
def interpolate_profile(nlower, nupper, nelec, temp, with_doppler=False):
"""
Interpolate profile tables of Lemke 1997 to get a Stark broadened line profile
Parameters
----------
nlowe... | [
"numpy.log10",
"numpy.arange",
"numpy.ceil",
"numpy.floor"
] | [((871, 886), 'numpy.log10', 'np.log10', (['nelec'], {}), '(nelec)\n', (879, 886), True, 'import numpy as np\n'), ((899, 913), 'numpy.log10', 'np.log10', (['temp'], {}), '(temp)\n', (907, 913), True, 'import numpy as np\n'), ((1074, 1096), 'numpy.floor', 'np.floor', (['log_ne_index'], {}), '(log_ne_index)\n', (1082, 10... |
# Copyright (c) OpenMMLab. All rights reserved.
import logging
from typing import Any, Dict, Optional, Sequence, Tuple, Union
import mmcv
import numpy as np
import torch
from torch.utils.data import Dataset
from mmdeploy.codebase.base import BaseTask
from mmdeploy.utils import Task, get_root_logger
from mmdeploy.util... | [
"mmcv.utils.get_logger",
"numpy.argmax",
"mmcv.parallel.scatter",
"mmdeploy.utils.config_utils.get_input_shape",
"mmcls.datasets.pipelines.Compose",
"numpy.max",
"mmcv.dump",
"mmdeploy.utils.get_root_logger",
"warnings.warn",
"mmcls.apis.init_model",
"mmcv.parallel.collate",
"mmcv.imread",
"... | [((3527, 3597), 'mmcls.apis.init_model', 'init_model', (['self.model_cfg', 'model_checkpoint', 'self.device', 'cfg_options'], {}), '(self.model_cfg, model_checkpoint, self.device, cfg_options)\n', (3537, 3597), False, 'from mmcls.apis import init_model\n'), ((4615, 4646), 'mmcls.datasets.pipelines.Compose', 'Compose', ... |
import sys
import asyncio
def get_ioloop() -> asyncio.BaseEventLoop:
loop = asyncio.get_event_loop()
if sys.platform == 'win32' and not isinstance(loop, asyncio.ProactorEventLoop):
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
return loop
def async_corun(coroutine):
... | [
"asyncio.set_event_loop",
"asyncio.get_event_loop",
"asyncio.ProactorEventLoop",
"asyncio.iscoroutinefunction"
] | [((82, 106), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (104, 106), False, 'import asyncio\n'), ((531, 564), 'asyncio.iscoroutinefunction', 'asyncio.iscoroutinefunction', (['func'], {}), '(func)\n', (558, 564), False, 'import asyncio\n'), ((718, 751), 'asyncio.iscoroutinefunction', 'asyncio.i... |
from os.path import basename
from zipfile import ZipFile
from zipfile import BadZipFile
class ContentReader:
def __init__(self):
self.__UNNEEDED_CONTENT_NAMES = [
'OEBPS/images',
'OEBPS/css',
'OEBPS/pagenav', # a number follows after 'pagenav'
'OEBPS/cont... | [
"zipfile.ZipFile",
"os.path.basename"
] | [((617, 634), 'zipfile.ZipFile', 'ZipFile', (['pub_file'], {}), '(pub_file)\n', (624, 634), False, 'from zipfile import ZipFile\n'), ((1145, 1168), 'os.path.basename', 'basename', (['pub_file.name'], {}), '(pub_file.name)\n', (1153, 1168), False, 'from os.path import basename\n')] |
"""
Template-based email system for Python.
"""
import logging
import os
from typing import Dict
from typing import List
import jinja2
from premailer import Premailer
class DeliveryEngineNotInstalled(Exception):
"""
This exception is raised when you attempt to use TemplateMail without a delivery engine insta... | [
"os.path.isdir",
"os.path.exists",
"jinja2.FileSystemLoader",
"premailer.Premailer",
"os.path.join",
"logging.getLogger"
] | [((1238, 1268), 'premailer.Premailer', 'Premailer', ([], {'allow_network': '(False)'}), '(allow_network=False)\n', (1247, 1268), False, 'from premailer import Premailer\n'), ((1747, 1813), 'os.path.join', 'os.path.join', (['template_layout', 'template_name', '"""content.html.jinja"""'], {}), "(template_layout, template... |
import os
import argparse
import yaml
from pathlib import Path
modules = ['wgsRecomb', 'coreGen', 'coreRecomb','panRecomb', 'geneRecomb','ALL']
CWD = os.getcwd()
# declare an argparse variable
general_parser = argparse.ArgumentParser(prog="start_analysis", usage='%(prog)s MODULE [options]',
description='Please alw... | [
"argparse.ArgumentParser",
"os.path.basename",
"os.getcwd",
"os.path.dirname",
"yaml.dump",
"os.system",
"os.path.join",
"os.chdir"
] | [((152, 163), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (161, 163), False, 'import os\n'), ((214, 487), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""start_analysis"""', 'usage': '"""%(prog)s MODULE [options]"""', 'description': '"""Please always specify the program to use in the first argum... |
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from django.contrib.auth import get_user_model
from django.test import TestCase
from .utils import create_reply_markup, create_users_list
User = get_user_model()
class StubUser():
def __init__(self, name, t_user, t_id):
self.name = name
... | [
"telegram.InlineKeyboardButton",
"django.contrib.auth.get_user_model"
] | [((212, 228), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (226, 228), False, 'from django.contrib.auth import get_user_model\n'), ((846, 916), 'telegram.InlineKeyboardButton', 'InlineKeyboardButton', (['"""single_data_t1"""'], {'callback_data': '"""single_data_d1"""'}), "('single_data_t1',... |
import argparse
import numpy as np
import pandas as pd
import os
from tqdm import tqdm
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torch
#from apex import amp
from torch.utils.data import DataLoader, RandomSampler, SequentialSampl... | [
"torch.nn.Dropout",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"random.shuffle",
"transformers.BertModel",
"numpy.ones",
"torch.device",
"json.loads",
"torch.utils.data.DataLoader",
"torch.nn.parallel.DistributedDataParallel",
"os.path.exists",
"torch.utils.data.distributed... | [((9488, 9506), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (9504, 9506), True, 'import numpy as np\n'), ((9689, 9714), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (9712, 9714), False, 'import argparse\n'), ((9867, 9905), 'torch.cuda.set_device', 'torch.cuda.set_device', (['... |
#!/usr/bin/env python
"""
See README.md
"""
from unittest import TestCase
from sr_sample_python_library.sample_python_class import SamplePythonClass
class TestSamplePythonClass(TestCase):
def test_get_parameter_name_from_value(self):
my_convertor = SamplePythonClass()
param1 = "my_python_param... | [
"sr_sample_python_library.sample_python_class.SamplePythonClass",
"rosunit.rosrun"
] | [((756, 853), 'rosunit.rosrun', 'rosunit.rosrun', (['"""sr_sample_python_library"""', '"""test_sample_python_class"""', 'TestSamplePythonClass'], {}), "('sr_sample_python_library', 'test_sample_python_class',\n TestSamplePythonClass)\n", (770, 853), False, 'import rosunit\n'), ((266, 285), 'sr_sample_python_library.... |
import json
from urllib.request import urlopen
planet_url = 'https://swapi.dev/api/planets/'
def api_call(url: str) -> dict:
json_url = urlopen(url)
return json.loads(json_url.read()) # converts json to dict | [
"urllib.request.urlopen"
] | [((143, 155), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (150, 155), False, 'from urllib.request import urlopen\n')] |
"""Imports World Bank income groups to Walden.
Example usage:
```
poetry run python -m ingests.wb_income_groups
```
"""
import tempfile
import datetime as dt
import unicodedata
import pandas as pd
import click
from owid.walden import files, add_to_catalog
from owid.walden.catalog import Dataset
SOURCE_DATA_URL = "h... | [
"unicodedata.normalize",
"tempfile.NamedTemporaryFile",
"datetime.date",
"owid.walden.files.download",
"click.command",
"pandas.read_excel",
"owid.walden.add_to_catalog",
"datetime.datetime.now"
] | [((1619, 1634), 'click.command', 'click.command', ([], {}), '()\n', (1632, 1634), False, 'import click\n'), ((461, 511), 'pandas.read_excel', 'pd.read_excel', (['SOURCE_DATA_URL'], {'sheet_name': '"""Notes"""'}), "(SOURCE_DATA_URL, sheet_name='Notes')\n", (474, 511), True, 'import pandas as pd\n'), ((575, 607), 'unicod... |
#!/usr/bin/python
import sys
import cgi
import cgitb
import sqlite3
reload(sys)
#import sys
sys.setdefaultencoding('utf-8')
cgitb.enable()
# html
print("Content-type: text/html\n")
print('<meta charset="utf-8">')
print("<html><head>")
print('''<link rel="stylesheet" href="https://bioed.bu.edu/students_21/group_proj/... | [
"cgitb.enable",
"sys.setdefaultencoding"
] | [((93, 124), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (115, 124), False, 'import sys\n'), ((126, 140), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (138, 140), False, 'import cgitb\n')] |
import unittest
from osvimdriver.openstack.heat.template import HeatInputUtil
from ignition.utils.propvaluemap import PropValueMap
class TestHeatInputUtil(unittest.TestCase):
def test_filter_used_properties(self):
util = HeatInputUtil()
heat_yml = '''
parameters:
propA:
... | [
"ignition.utils.propvaluemap.PropValueMap",
"osvimdriver.openstack.heat.template.HeatInputUtil"
] | [((235, 250), 'osvimdriver.openstack.heat.template.HeatInputUtil', 'HeatInputUtil', ([], {}), '()\n', (248, 250), False, 'from osvimdriver.openstack.heat.template import HeatInputUtil\n'), ((686, 701), 'osvimdriver.openstack.heat.template.HeatInputUtil', 'HeatInputUtil', ([], {}), '()\n', (699, 701), False, 'from osvim... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"os.environ.get",
"subprocess.check_output",
"parl.utils.logger.warn"
] | [((847, 891), 'os.environ.get', 'os.environ.get', (['"""CUDA_VISIBLE_DEVICES"""', 'None'], {}), "('CUDA_VISIBLE_DEVICES', None)\n", (861, 891), False, 'import os\n'), ((1286, 1350), 'parl.utils.logger.warn', 'logger.warn', (['"""Cannot find available GPU devices, using CPU now."""'], {}), "('Cannot find available GPU d... |
# https://stackoverflow.com/questions/273192/how-can-i-create-a-directory-if-it-does-not-exist
import os
import errno
# Not recommend this one:
# if not os.path.exists(directory):
# os.makedirs(directory)
try:
os.makedirs("D:/tim")
except OSError as e:
if e.errno != errno.EEXIST:
raise... | [
"os.path.isdir",
"os.makedirs"
] | [((229, 250), 'os.makedirs', 'os.makedirs', (['"""D:/tim"""'], {}), "('D:/tim')\n", (240, 250), False, 'import os\n'), ((659, 676), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (670, 676), False, 'import os\n'), ((745, 764), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (758, 764), False, '... |
"""
Scrapy Shell
See documentation in docs/topics/shell.rst
"""
from threading import Thread
from scrapy.commands import ScrapyCommand
from scrapy.shell import Shell
from scrapy.http import Request
from scrapy.utils.url import add_http_if_no_scheme
from scrapy.utils.spider import spidercls_for_request, DefaultSpider... | [
"threading.Thread",
"scrapy.http.Request",
"scrapy.shell.Shell",
"scrapy.utils.url.add_http_if_no_scheme",
"scrapy.commands.ScrapyCommand.add_options"
] | [((709, 748), 'scrapy.commands.ScrapyCommand.add_options', 'ScrapyCommand.add_options', (['self', 'parser'], {}), '(self, parser)\n', (734, 748), False, 'from scrapy.commands import ScrapyCommand\n'), ((2027, 2087), 'scrapy.shell.Shell', 'Shell', (['crawler'], {'update_vars': 'self.update_vars', 'code': 'opts.code'}), ... |
#### PATTERN | XX ##################################################################################
# -*- coding: utf-8 -*-
# Copyright (c) year, institute, country
# Author: Name (e-mail)
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
#########################################... | [
"sys.path.pop",
"os.path.abspath",
"pattern.text.Parser.find_chunks",
"pattern.text.xx.inflect.predicative",
"pattern.text.xx.inflect.singularize",
"pattern.text.commandline",
"pattern.text.tree.Text",
"pattern.text.Parser.find_tokens",
"pattern.text.xx.inflect.conjugate",
"pattern.text.Parser.fin... | [((2319, 2334), 'sys.path.pop', 'sys.path.pop', (['(0)'], {}), '(0)\n', (2331, 2334), False, 'import sys\n'), ((1216, 1260), 'os.path.join', 'os.path.join', (['MODULE', '""".."""', '""".."""', '""".."""', '""".."""'], {}), "(MODULE, '..', '..', '..', '..')\n", (1228, 1260), False, 'import os\n'), ((6423, 6437), 'patter... |
import json
from importlib import import_module
from time import sleep
from unittest import mock
from django.conf import settings
from django.shortcuts import resolve_url
from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django_otp imp... | [
"importlib.import_module",
"django.test.RequestFactory",
"django_otp.util.random_hex",
"time.sleep",
"unittest.mock.patch",
"django.urls.reverse",
"two_factor.views.core.LoginView.get_initkwargs",
"django.test.utils.override_settings",
"django.shortcuts.resolve_url",
"django_otp.oath.totp"
] | [((24337, 24387), 'django.test.utils.override_settings', 'override_settings', ([], {'ROOT_URLCONF': '"""tests.urls_admin"""'}), "(ROOT_URLCONF='tests.urls_admin')\n", (24354, 24387), False, 'from django.test.utils import override_settings\n'), ((1136, 1198), 'unittest.mock.patch', 'mock.patch', (['"""two_factor.views.c... |
# Copyright (C) 2014 <NAME>
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... | [
"numpy.maximum",
"numpy.abs",
"phonopy.structure.snf.SNF3x3",
"spglib.relocate_BZ_grid_address",
"phonopy.structure.cells.determinant",
"numpy.unique",
"numpy.prod",
"phonopy.structure.symmetry.get_pointgroup_operations",
"numpy.zeros_like",
"numpy.multiply",
"numpy.extract",
"numpy.logical_xo... | [((3043, 3065), 'numpy.linalg.inv', 'np.linalg.inv', (['lattice'], {}), '(lattice)\n', (3056, 3065), True, 'import numpy as np\n'), ((3595, 3630), 'numpy.maximum', 'np.maximum', (['mesh_numbers', '[1, 1, 1]'], {}), '(mesh_numbers, [1, 1, 1])\n', (3605, 3630), True, 'import numpy as np\n'), ((4596, 4629), 'numpy.zeros_l... |
import os
import re
import torch
from torchtext.data import Field, TabularDataset
from torchtext.data.iterator import BucketIterator
from torchtext.vocab import Vectors
from datasets.reuters import process_labels
from datasets.ag_news import process_labels
def clean_string(string):
"""
Performs tokenization... | [
"os.path.join",
"datasets.ag_news.process_labels",
"torchtext.data.iterator.BucketIterator.splits",
"torchtext.vocab.Vectors",
"re.sub",
"torchtext.data.Field"
] | [((397, 425), 're.sub', 're.sub', (['"""\\\\\\\\n"""', '""" """', 'string'], {}), "('\\\\\\\\n', ' ', string)\n", (403, 425), False, 'import re\n'), ((498, 528), 're.sub', 're.sub', (['"""\\\\s{2,}"""', '""" """', 'string'], {}), "('\\\\s{2,}', ' ', string)\n", (504, 528), False, 'import re\n'), ((710, 778), 'torchtext... |
from flask import Blueprint
from marshmallow import pprint
from api.utils import catch_exception
from api.resources import LIMIT_ROWS
from api.database import get_session
import api.models.post
post_bp = Blueprint('post', __name__, url_prefix='/post')
| [
"flask.Blueprint"
] | [((206, 253), 'flask.Blueprint', 'Blueprint', (['"""post"""', '__name__'], {'url_prefix': '"""/post"""'}), "('post', __name__, url_prefix='/post')\n", (215, 253), False, 'from flask import Blueprint\n')] |
import streamlit as st
def draw_tot_cases_graph(df):
tot_cases_by_day = df.groupby("date")["cases"].sum()
st.write("Total cases(US):")
st.line_chart(tot_cases_by_day)
def draw_daily_cases_graph(df):
cases_by_day = df.groupby("date")["cases"].sum().reset_index(name="cases")
shifted = cases_by_day... | [
"streamlit.line_chart",
"streamlit.write",
"streamlit.bar_chart"
] | [((116, 144), 'streamlit.write', 'st.write', (['"""Total cases(US):"""'], {}), "('Total cases(US):')\n", (124, 144), True, 'import streamlit as st\n'), ((149, 180), 'streamlit.line_chart', 'st.line_chart', (['tot_cases_by_day'], {}), '(tot_cases_by_day)\n', (162, 180), True, 'import streamlit as st\n'), ((521, 549), 's... |
from setuptools import setup
with open("README.md", "r") as f:
long_description = f.read()
setup(
name='JSONifier',
version='0.0.7',
description="A package for reading, writing, and editing of JSON files, Python dictionaries, and such.",
py_modules=["jsonify"],
package_dir={"": "src"},
long_description=... | [
"setuptools.setup"
] | [((95, 809), 'setuptools.setup', 'setup', ([], {'name': '"""JSONifier"""', 'version': '"""0.0.7"""', 'description': '"""A package for reading, writing, and editing of JSON files, Python dictionaries, and such."""', 'py_modules': "['jsonify']", 'package_dir': "{'': 'src'}", 'long_description': 'long_description', 'long_... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"aiida.backends.sqlalchemy.models.user.DbUser",
"warnings.simplefilter",
"aiida.common.utils.get_new_uuid",
"aiida.orm.CalculationNode",
"aiida.backends.sqlalchemy.models.node.DbNode",
"warnings.catch_warnings",
"aiida.backends.sqlalchemy.get_scoped_session",
"aiida.orm.Data"
] | [((1722, 1739), 'aiida.orm.CalculationNode', 'CalculationNode', ([], {}), '()\n', (1737, 1739), False, 'from aiida.orm import CalculationNode, Data\n'), ((2798, 2815), 'aiida.orm.CalculationNode', 'CalculationNode', ([], {}), '()\n', (2813, 2815), False, 'from aiida.orm import CalculationNode, Data\n'), ((3897, 3939), ... |
import asyncio
import json
import logging
import websockets
from django.contrib.auth import get_user_model
from . import models, router
from .utils import get_user_from_session, get_dialogs_with_user
logger = logging.getLogger('django-private-dialog')
ws_connections = {}
@asyncio.coroutine
def target_message(conn, p... | [
"django.contrib.auth.get_user_model",
"logging.getLogger",
"json.dumps"
] | [((210, 252), 'logging.getLogger', 'logging.getLogger', (['"""django-private-dialog"""'], {}), "('django-private-dialog')\n", (227, 252), False, 'import logging\n'), ((518, 537), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (528, 537), False, 'import json\n'), ((824, 843), 'json.dumps', 'json.dumps', (... |
import sys
import click
import carica_cfn_tools.version
from carica_cfn_tools.stack_config import Stack, CaricaCfnToolsError, Action
class ActionParamType(click.Choice):
def __init__(self):
super().__init__([str(action.value) for action in Action])
def convert(self, value, param, ctx):
if i... | [
"click.version_option",
"click.argument",
"click.option",
"click.command",
"carica_cfn_tools.stack_config.Stack",
"sys.exit"
] | [((1927, 1942), 'click.command', 'click.command', ([], {}), '()\n', (1940, 1942), False, 'import click\n'), ((1944, 1974), 'click.argument', 'click.argument', (['"""stack_config"""'], {}), "('stack_config')\n", (1958, 1974), False, 'import click\n'), ((2083, 2145), 'click.option', 'click.option', (['"""--direct"""', '"... |
from pathlib import Path
import itertools
# Get the puzzle input data
input_file = Path(__file__).parent / "input.txt"
puzzle_data = input_file.read_text().strip().split("\n")
puzzle_data = [int(x) for x in puzzle_data]
# ------------------------- Part 1/2 -------------------------
""" Puzzle Rules:
"""
data = [35, 2... | [
"itertools.combinations",
"pathlib.Path"
] | [((84, 98), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (88, 98), False, 'from pathlib import Path\n'), ((562, 616), 'itertools.combinations', 'itertools.combinations', (['puzzle_data[i - prev_num:i]', '(2)'], {}), '(puzzle_data[i - prev_num:i], 2)\n', (584, 616), False, 'import itertools\n')] |
# -*- coding: utf-8 -*-
import re
import json
import scrapy
from locations.items import GeojsonPointItem
class BunningsSpider(scrapy.Spider):
name = "bunnings"
allowed_domains = ["bunnings.com.au"]
start_urls = (
'https://www.bunnings.com.au/stores/',
)
def parse(self, response):
r... | [
"locations.items.GeojsonPointItem",
"re.search",
"json.loads"
] | [((430, 450), 'json.loads', 'json.loads', (['raw_data'], {}), '(raw_data)\n', (440, 450), False, 'import json\n'), ((330, 401), 're.search', 're.search', (['"""com_bunnings_locations_mapLocations = (.+);"""', 'response.text'], {}), "('com_bunnings_locations_mapLocations = (.+);', response.text)\n", (339, 401), False, '... |
from sklearn.model_selection import train_test_split
import pandas as pd
from training.models.random_forest_classifier import *
if __name__ == '__main__':
df = pd.read_excel('../../data_base/excel/datasetV2.xlsx', sheet_name='Casos Dengue')
# Separación de los datos
x, y = df.iloc[:, :-1].values, df.iloc[... | [
"pandas.read_excel",
"sklearn.model_selection.train_test_split"
] | [((165, 250), 'pandas.read_excel', 'pd.read_excel', (['"""../../data_base/excel/datasetV2.xlsx"""'], {'sheet_name': '"""Casos Dengue"""'}), "('../../data_base/excel/datasetV2.xlsx', sheet_name='Casos Dengue'\n )\n", (178, 250), True, 'import pandas as pd\n'), ((374, 439), 'sklearn.model_selection.train_test_split', ... |
"""
Monthly Class
Meteorological data provided by Meteostat (https://dev.meteostat.net)
under the terms of the Creative Commons Attribution-NonCommercial
4.0 International Public License.
The code is licensed under the MIT license.
"""
from datetime import datetime
from typing import Union
import numpy as np
import ... | [
"pandas.DataFrame",
"meteostat.core.loader.processing_handler",
"pandas.Index",
"meteostat.core.loader.load_handler",
"pandas.Grouper",
"pandas.read_pickle",
"meteostat.core.cache.file_in_cache",
"meteostat.core.cache.get_file_path",
"meteostat.utilities.validations.validate_series"
] | [((2269, 2323), 'meteostat.core.cache.get_file_path', 'get_file_path', (['self.cache_dir', 'self.cache_subdir', 'file'], {}), '(self.cache_dir, self.cache_subdir, file)\n', (2282, 2323), False, 'from meteostat.core.cache import get_file_path, file_in_cache\n'), ((3693, 3729), 'pandas.DataFrame', 'pd.DataFrame', ([], {'... |
#!/usr/bin/env python
# Distributed under the MIT License.
# See LICENSE.txt for details.
from spectre.Visualization.Render1D import (find_extrema_over_data_set,
render_single_time)
import unittest
import os
import numpy as np
import matplotlib as mpl
mpl.use('agg')
clas... | [
"unittest.main",
"os.remove",
"spectre.Visualization.Render1D.find_extrema_over_data_set",
"os.path.isfile",
"matplotlib.use",
"numpy.array",
"spectre.Visualization.Render1D.render_single_time"
] | [((299, 313), 'matplotlib.use', 'mpl.use', (['"""agg"""'], {}), "('agg')\n", (306, 313), True, 'import matplotlib as mpl\n'), ((1168, 1194), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1181, 1194), False, 'import unittest\n'), ((423, 455), 'numpy.array', 'np.array', (['[1.1, 6.45, ... |
from setuptools import setup, find_packages
setup(
name="elegantrl",
version="0.3.3",
author="<NAME>, <NAME>, <NAME>, <NAME>",
author_email="<EMAIL>",
url="https://github.com/AI4Finance-LLC/ElegantRL",
license="Apache 2.0",
packages=find_packages(),
install_requires=[
"gym",
... | [
"setuptools.find_packages"
] | [((262, 277), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (275, 277), False, 'from setuptools import setup, find_packages\n')] |
import os
import sys
import numpy as np
import flopy
import matplotlib.pyplot as plt
# --modify default matplotlib settings
updates = {
"font.family": ["Univers 57 Condensed", "Arial"],
"mathtext.default": "regular",
"pdf.compression": 0,
"pdf.fonttype": 42,
"legend.fontsize": 7,
"axes.label... | [
"os.remove",
"flopy.modflow.ModflowOc",
"numpy.empty",
"numpy.ones",
"matplotlib.pyplot.figure",
"flopy.modflow.ModflowBcf",
"numpy.arange",
"flopy.modflow.ModflowSwi2",
"os.path.join",
"flopy.utils.CellBudgetFile",
"flopy.modflow.ModflowPcg",
"numpy.copy",
"flopy.modflow.ModflowGhb",
"mat... | [((384, 412), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['updates'], {}), '(updates)\n', (403, 412), True, 'import matplotlib.pyplot as plt\n'), ((470, 491), 'numpy.empty', 'np.empty', (['ndim', 'float'], {}), '(ndim, float)\n', (478, 491), True, 'import numpy as np\n'), ((526, 546), 'numpy.empty', '... |
#- Python 3 source code
#- qq-wait-times-dormant-bin5.py ~~
#
# This program creates a Quantile-Quantile plot (or more accurately here, a
# Percentile-Percentile plot) of the distributions for the wait times of
# bin 5 jobs submitted by non-CSC108 projects during the two weeks prior to
# the "dormant" period... | [
"matplotlib.pyplot.plot",
"os.path.basename",
"os.getcwd",
"os.path.isdir",
"numpy.percentile",
"matplotlib.pyplot.figure",
"sqlite3.connect",
"os.path.splitext",
"os.path.join"
] | [((2761, 2804), 'numpy.percentile', 'numpy.percentile', (['with_csc108', 'marks_to_use'], {}), '(with_csc108, marks_to_use)\n', (2777, 2804), False, 'import numpy\n'), ((2820, 2861), 'numpy.percentile', 'numpy.percentile', (['wo_csc108', 'marks_to_use'], {}), '(wo_csc108, marks_to_use)\n', (2836, 2861), False, 'import ... |
import os
import ctypes
import numpy
from algopy.base_type import Ring
_ctps = numpy.ctypeslib.load_library('libctps', os.path.dirname(__file__))
double_ptr = ctypes.POINTER(ctypes.c_double)
argtypes1 = [ctypes.c_int, double_ptr, double_ptr, double_ptr]
_ctps.ctps_add.argtypes = argtypes1
_ctps.ctps_sub.argtypes =... | [
"os.path.dirname",
"numpy.zeros_like",
"numpy.array",
"ctypes.POINTER"
] | [((163, 194), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (177, 194), False, 'import ctypes\n'), ((121, 146), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (136, 146), False, 'import os\n'), ((721, 738), 'numpy.array', 'numpy.array', (['data'], {}), ... |
from __future__ import print_function
import argparse
import os
import h5py
import numpy as np
import sys
from molecules.model import MoleculeVAE
from molecules.utils import one_hot_array, one_hot_index, from_one_hot_array, \
decode_smiles_from_indexes, load_dataset
from pylab import figure, axes, scatter, title... | [
"h5py.File",
"argparse.ArgumentParser",
"molecules.model.MoleculeVAE",
"numpy.savetxt",
"molecules.utils.decode_smiles_from_indexes",
"os.path.isfile",
"molecules.utils.load_dataset"
] | [((455, 523), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Molecular autoencoder network"""'}), "(description='Molecular autoencoder network')\n", (478, 523), False, 'import argparse\n'), ((1186, 1210), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (1195... |
from random import randint
from flask import Flask, request, jsonify, redirect, make_response
app = Flask(__name__)
auth = randint(100, 50000)
@app.route('/get-auth', methods=['POST'])
def get_auth_cookie():
req = request.get_json()
if req['pass'] == '<PASSWORD>':
res = make_response(jsonify({'auth... | [
"random.randint",
"flask.redirect",
"flask.request.args.get",
"flask.Flask",
"flask.jsonify",
"flask.request.get_json"
] | [((102, 117), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (107, 117), False, 'from flask import Flask, request, jsonify, redirect, make_response\n'), ((126, 145), 'random.randint', 'randint', (['(100)', '(50000)'], {}), '(100, 50000)\n', (133, 145), False, 'from random import randint\n'), ((223, 241), '... |
from django.conf.urls import url
from bfs.views import *
urlpatterns = [
url(r'^', index),
]
| [
"django.conf.urls.url"
] | [((79, 94), 'django.conf.urls.url', 'url', (['"""^"""', 'index'], {}), "('^', index)\n", (82, 94), False, 'from django.conf.urls import url\n')] |
# Copyright 2012-2013 OpenStack Foundation
#
# 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 la... | [
"copy.deepcopy",
"osc_lib.tests.utils.fake_execute",
"unittest.mock.patch",
"osc_lib.tests.utils.EnvFixture",
"osc_lib.shell.main",
"testtools.skip",
"osc_lib.tests.utils.make_shell"
] | [((4820, 4872), 'testtools.skip', 'testtools.skip', (['"""skip until bug 1444983 is resolved"""'], {}), "('skip until bug 1444983 is resolved')\n", (4834, 4872), False, 'import testtools\n'), ((10663, 10734), 'unittest.mock.patch', 'mock.patch', (['"""openstack.config.loader.OpenStackConfig._load_config_file"""'], {}),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# created by Lipson on 2018/4/19.
# email to <EMAIL>
#
from colorama import Fore
from colorama import init
init(autoreset=True)
def print_err(msg):
print(Fore.RED + "ERROR: " + msg)
def print_warn(msg):
print(Fore.YELLOW + "WARNING: " + msg)
def print_info(... | [
"colorama.init"
] | [((156, 176), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (160, 176), False, 'from colorama import init\n')] |
# Generated by Django 2.2.1 on 2019-05-17 02:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('heavy_celery', '0004_auto_20190303_0128'),
]
operations = [
migrations.DeleteModel(
name='WorkerHeartBeat',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((232, 278), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""WorkerHeartBeat"""'}), "(name='WorkerHeartBeat')\n", (254, 278), False, 'from django.db import migrations\n')] |
from django.conf.urls import url
from event import views
urlpatterns = [
url(r"^event/ics/(?P<code>.*).ics$", views.event_ics, name="events_event_ics"),
url(r"^event/(?P<code>.*)/live$", views.live, name="events_live"),
url(
r"^event/(?P<event_id>.*)/register$",
views.checkin_event_registe... | [
"django.conf.urls.url"
] | [((79, 156), 'django.conf.urls.url', 'url', (['"""^event/ics/(?P<code>.*).ics$"""', 'views.event_ics'], {'name': '"""events_event_ics"""'}), "('^event/ics/(?P<code>.*).ics$', views.event_ics, name='events_event_ics')\n", (82, 156), False, 'from django.conf.urls import url\n'), ((163, 227), 'django.conf.urls.url', 'url'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 09:51:19 2021
@author: lferiani
"""
import numpy as np
import pandas as pd
import seaborn as sns
from tqdm import tqdm
from matplotlib import pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from experiment_constants import MD... | [
"seaborn.lineplot",
"matplotlib.backends.backend_pdf.PdfPages",
"tqdm.tqdm",
"timeseries_helper.plot_stimuli",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"seaborn.color_palette",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.subplots"
] | [((5404, 5430), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '(**fig_kwargs)\n', (5416, 5430), True, 'from matplotlib import pyplot as plt\n'), ((5897, 5921), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '(**leg_kwargs)\n', (5907, 5921), True, 'from matplotlib import pyplot as plt\n'), ((10980, 11068)... |
# Copyright (c) 2011, SD Elements. See LICENSE.txt for details.
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from django.conf import settings
# Finding proper User model that we can set Foreign key to.
# In newer versions of Django default user model can b... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.utils.timezone.now",
"django.db.models.GenericIPAddressField",
"django.db.models.DateTimeField"
] | [((968, 1036), 'django.db.models.ForeignKey', 'models.ForeignKey', (['USER_MODEL'], {'unique': '(True)', 'on_delete': 'models.CASCADE'}), '(USER_MODEL, unique=True, on_delete=models.CASCADE)\n', (985, 1036), False, 'from django.db import models\n'), ((1095, 1266), 'django.db.models.DateTimeField', 'models.DateTimeField... |
import os
import sys
deltext=""
if sys.platform.startswith("linux") :
deltext="rm"
copytext="cp"
if sys.platform.startswith("darwin") :
deltext="rm"
copytext="cp"
if sys.platform.startswith("win") :
deltext="del"
copytext="copy"
def replace(namefile,oldtext,newtext):
f = open(namefile,'r')
filedata = f.read... | [
"sys.platform.startswith",
"os.system"
] | [((36, 68), 'sys.platform.startswith', 'sys.platform.startswith', (['"""linux"""'], {}), "('linux')\n", (59, 68), False, 'import sys\n'), ((104, 137), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (127, 137), False, 'import sys\n'), ((173, 203), 'sys.platform.startswith',... |
# -*- coding: utf-8 -*-
import json
from six import assertCountEqual
from synapsesuggestor.tests.common import SynapseSuggestorTestCase
URL_PREFIX = '/ext/synapsesuggestor/treenode-association'
SYN_SLICE_NEAR_SKEL_COLS = [
'skeleton_id', 'treenode_id', 'synapse_object_id', 'synapse_slice_ids', 'synapse_z_s', '... | [
"six.assertCountEqual",
"json.dumps"
] | [((3024, 3080), 'six.assertCountEqual', 'assertCountEqual', (['self', 'expected_result', 'parsed_response'], {}), '(self, expected_result, parsed_response)\n', (3040, 3080), False, 'from six import assertCountEqual\n'), ((2234, 2282), 'json.dumps', 'json.dumps', (['[syn_slice_id, other_tn, contact_px]'], {}), '([syn_sl... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class NamespaceObject(object):
"""N... | [
"six.iteritems"
] | [((20851, 20884), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (20864, 20884), False, 'import six\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
网易云音乐 Player
"""
# Let's make some noise
from __future__ import print_function, unicode_literals, division, absolute_import
import subprocess
import threading
import time
import os
import random
from future.builtins import str
# from ui import Ui
from storage import... | [
"api.NetEase",
"threading.Thread",
"subprocess.Popen",
"config.Config",
"future.builtins.str",
"random.shuffle",
"logger.getLogger",
"storage.Storage",
"utils.notify",
"time.sleep",
"time.time",
"os.path.isfile",
"cache.Cache"
] | [((450, 476), 'logger.getLogger', 'logger.getLogger', (['__name__'], {}), '(__name__)\n', (466, 476), False, 'import logger\n'), ((665, 673), 'config.Config', 'Config', ([], {}), '()\n', (671, 673), False, 'from config import Config\n'), ((936, 945), 'storage.Storage', 'Storage', ([], {}), '()\n', (943, 945), False, 'f... |
import unittest
import aerochat.database
class TestJson(unittest.TestCase):
@staticmethod
def get_json_string():
return '{"timestamp":"1399589150","sender":"mpillar","text":"This is a test"}'
@staticmethod
def get_json_message():
return aerochat.database.Message.from_json(TestJson.get_... | [
"unittest.main"
] | [((1064, 1079), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1077, 1079), False, 'import unittest\n')] |
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from onnx import defs
def main() -> None:
# domain -> support level -> name -> [schema]
with_inference = []
without_i... | [
"onnx.defs.get_all_schemas"
] | [((352, 374), 'onnx.defs.get_all_schemas', 'defs.get_all_schemas', ([], {}), '()\n', (372, 374), False, 'from onnx import defs\n')] |
import os
import numpy as np
from libyana.meshutils import meshio
def load_objects(obj_root):
object_names = [obj_name for obj_name in os.listdir(obj_root) if ".tgz" not in obj_name]
objects = {}
for obj_name in object_names:
# obj_path = os.path.join(obj_root, obj_name, "textured_simple_2000.obj... | [
"numpy.stack",
"numpy.load",
"numpy.array",
"libyana.meshutils.meshio.fast_load_obj",
"os.path.join",
"os.listdir"
] | [((679, 702), 'os.listdir', 'os.listdir', (['corner_root'], {}), '(corner_root)\n', (689, 702), False, 'import os\n'), ((2559, 2638), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0], [0, -1.0, 0.0], [0.0, 0.0, -1.0]]'], {'dtype': 'np.float32'}), '([[1.0, 0.0, 0.0], [0, -1.0, 0.0], [0.0, 0.0, -1.0]], dtype=np.float32)\n'... |
"""
Create a flat plate of length 1.0 with aspect ratio 2.0 and a 40-degree
inclination.
The plate is discretized with spacing 0.04 in the x-y plane and with spacing
0.04 along the z-direction.
"""
import math
import pathlib
import numpy
# Flat-plate's parameters.
L = 1.0 # chord length
AR = 2.0 # aspect ratio
xc,... | [
"numpy.radians",
"math.ceil",
"numpy.ones",
"pathlib.Path",
"numpy.linspace"
] | [((544, 561), 'math.ceil', 'math.ceil', (['(L / ds)'], {}), '(L / ds)\n', (553, 561), False, 'import math\n'), ((566, 615), 'numpy.linspace', 'numpy.linspace', (['(xc - L / 2)', '(xc + L / 2)'], {'num': '(n + 1)'}), '(xc - L / 2, xc + L / 2, num=n + 1)\n', (580, 615), False, 'import numpy\n'), ((711, 733), 'math.ceil',... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<<EMAIL>>
# http://binux.me
# Created on 2014-02-22 14:02:21
from pyspider.libs.base_handler import BaseHandler, catch_status_code_error, every
class IgnoreHandler(object):
pass
class TestHandl... | [
"pyspider.libs.base_handler.every"
] | [((1150, 1167), 'pyspider.libs.base_handler.every', 'every', ([], {'seconds': '(10)'}), '(seconds=10)\n', (1155, 1167), False, 'from pyspider.libs.base_handler import BaseHandler, catch_status_code_error, every\n')] |
#!/usr/bin/env python2.7
#
# Silicon Labs si7021 Interface Class
# Copyright (C) 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... | [
"smbus2.SMBus",
"time.sleep"
] | [((1350, 1367), 'smbus2.SMBus', 'smbus2.SMBus', (['bus'], {}), '(bus)\n', (1362, 1367), False, 'import smbus2, time\n'), ((2844, 2859), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (2854, 2859), False, 'import smbus2, time\n'), ((2246, 2261), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (2256, 226... |
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import glob
import fnmatch
import traceback
import logging
import numpy
import pytest
import lasio
test_dir = os.path.dirname(__file__)
egfn = lambda fn: os.path.join(os.path.dirname(__file__), "examples", fn)
stegfn = lambda vers, fn: o... | [
"os.path.dirname",
"logging.getLogger"
] | [((192, 217), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (207, 217), False, 'import os, sys\n'), ((391, 418), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (408, 418), False, 'import logging\n'), ((51, 76), 'os.path.dirname', 'os.path.dirname', (['__file__'... |
# Copyright 2012 Yelp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | [
"yaml.load",
"six.u",
"mr3px.common.encode_string",
"yaml.safe_load",
"mr3px.common.decode_string"
] | [((2336, 2350), 'six.u', 'six.u', (['"""\n..."""'], {}), "('\\n...')\n", (2341, 2350), False, 'import six\n'), ((2974, 3017), 'mr3px.common.decode_string', 'decode_string', (['data'], {'encoding': 'self.encoding'}), '(data, encoding=self.encoding)\n', (2987, 3017), False, 'from mr3px.common import decode_string, encode... |
import json
import time
def create_graph(data):
current_milli_time = lambda: int(round(time.time() * 1000))
edge_list = []
hashtags_list = []
user_mentions_list = []
all_data = json.loads(data)
user_screen_name = all_data['user']['screen_name']
timestamp_ms = all_data['timestamp_ms']
if len(all_data['entities'... | [
"json.loads",
"time.time"
] | [((183, 199), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (193, 199), False, 'import json\n'), ((89, 100), 'time.time', 'time.time', ([], {}), '()\n', (98, 100), False, 'import time\n')] |
from django.db.models import Field
from urllib.parse import unquote
from django_editorjs.widgets import EditorJsWidget
class EditorJsField(Field):
def __init__(self, *args, **kwargs):
editorjs_config = kwargs.pop("editorjs_config", None)
super().__init__(*args, **kwargs)
self._editorjs_co... | [
"django_editorjs.widgets.EditorJsWidget"
] | [((652, 705), 'django_editorjs.widgets.EditorJsWidget', 'EditorJsWidget', ([], {'editorjs_config': 'self._editorjs_config'}), '(editorjs_config=self._editorjs_config)\n', (666, 705), False, 'from django_editorjs.widgets import EditorJsWidget\n')] |
#!/usr/bin/env python3
import re
from mongodb1 import *
def get_goods_url(url):
urls = re.findall('http.+\r\n', url)
if len(urls) == 2:
urls[0] = urls[0].strip('\r\n')
urls[1] = urls[1].strip('\r\n')
#丢弃短连接
if urls[1].find('click') > 0:
return 0, urls
else:
... | [
"re.findall"
] | [((93, 122), 're.findall', 're.findall', (["'http.+\\r\\n'", 'url'], {}), "('http.+\\r\\n', url)\n", (103, 122), False, 'import re\n')] |
# Copyright 2013, Big Switch Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
"openstack_dashboard.dashboards.project.loadbalancers.utils.get_monitor_display_name",
"openstack_dashboard.api.lbaas.pool_list",
"openstack_dashboard.api.lbaas.pool_create",
"django.utils.translation.ugettext_lazy",
"openstack_dashboard.api.lbaas.pool_monitor_association_create",
"horizon.forms.Select",
... | [((1054, 1081), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1071, 1081), False, 'import logging\n'), ((5077, 5090), 'django.utils.translation.ugettext_lazy', '_', (['"""Add Pool"""'], {}), "('Add Pool')\n", (5078, 5090), True, 'from django.utils.translation import ugettext_lazy as _\n... |