code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#<NAME>
#adaptation of shortest paths code from my phd for more general case. kind of.
#no objects, just a method, gpl since penn/phd
import priodict
def shortestPaths(nodes, edges, startDist, initialNodes):
'''simple shortest paths algorithm, using advanced data structure. calculates
all distances from the start... | [
"priodict.priorityDictionary"
] | [((549, 578), 'priodict.priorityDictionary', 'priodict.priorityDictionary', ([], {}), '()\n', (576, 578), False, 'import priodict\n')] |
#/usr/bin/python3
#-*- encoding=utf-8 -*-
from pathlib import Path
import random
import numpy as np
import cv2
from cv2 import cv2 as cv
from keras.utils import Sequence
import os
def readTxt(txtpath):
filelist = []
with open(txtpath, 'r') as f:
for line in f.readlines():
filelist.append(... | [
"os.path.basename",
"os.popen",
"numpy.zeros",
"random.choice",
"os.path.exists",
"numpy.expand_dims",
"cv2.imread",
"numpy.random.randint",
"cv2.resize"
] | [((1788, 1853), 'numpy.zeros', 'np.zeros', (['(batch_size, image_size, image_size, 3)'], {'dtype': 'np.uint8'}), '((batch_size, image_size, image_size, 3), dtype=np.uint8)\n', (1796, 1853), True, 'import numpy as np\n'), ((1866, 1931), 'numpy.zeros', 'np.zeros', (['(batch_size, image_size, image_size, 3)'], {'dtype': '... |
import sys
import os
import math
import cv2
import numpy as np
import pandas as pd
from skimage import io
from PIL import Image
from sklearn.model_selection import train_test_split
from skimage.color import gray2rgb
import torch
from torch.utils.data.sampler import SubsetRandomSampler
from torch.utils.data import Data... | [
"sys.path.append",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.array",
"numpy.loadtxt",
"skimage.color.gray2rgb",
"os.path.join",
"os.listdir",
"skimage.io.imread"
] | [((379, 401), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (394, 401), False, 'import sys\n'), ((630, 698), 'os.path.join', 'os.path.join', (["cfg['root']", '"""RAF-Face"""', "('%s/Annotation/manual' % type)"], {}), "(cfg['root'], 'RAF-Face', '%s/Annotation/manual' % type)\n", (642, 698), Fal... |
import heapq
class MedianFinder:
def __init__(self):
"""
initialize your data structure here.
"""
# 初始化大顶堆和小顶堆
self.max_heap = []
self.min_heap = []
def addNum(self, num: int) -> None:
if len(self.max_heap) == len(self.min_heap):
# 先加到小顶堆,再把... | [
"heapq.heappush",
"heapq.heappop"
] | [((343, 377), 'heapq.heappush', 'heapq.heappush', (['self.min_heap', 'num'], {}), '(self.min_heap, num)\n', (357, 377), False, 'import heapq\n'), ((511, 546), 'heapq.heappush', 'heapq.heappush', (['self.max_heap', '(-num)'], {}), '(self.max_heap, -num)\n', (525, 546), False, 'import heapq\n'), ((422, 450), 'heapq.heapp... |
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université
# "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. "
import time
import numpy as np
from mpi4py import MPI
from nest_elephant_tvb.translation.s... | [
"numpy.sum",
"nest_elephant_tvb.translation.science_tvb_to_nest.generate_data",
"mpi4py.MPI.Win.Allocate_shared",
"mpi4py.MPI.Status",
"numpy.empty",
"time.sleep",
"mpi4py.MPI.DOUBLE.Get_size",
"mpi4py.MPI.Request.Waitall",
"numpy.ndarray",
"numpy.concatenate"
] | [((1502, 1571), 'nest_elephant_tvb.translation.science_tvb_to_nest.generate_data', 'generate_data', (["(path_config + '/../../log/')", 'nb_spike_generator', 'param'], {}), "(path_config + '/../../log/', nb_spike_generator, param)\n", (1515, 1571), False, 'from nest_elephant_tvb.translation.science_tvb_to_nest import ge... |
"""
MIT License
Copyright (c) 2021 <NAME>
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, distri... | [
"sys.exit",
"logging.getLogger"
] | [((1266, 1285), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (1275, 1285), False, 'from logging import getLogger\n'), ((1663, 1670), 'sys.exit', 'exit', (['(1)'], {}), '(1)\n', (1667, 1670), False, 'from sys import exit\n')] |
from CalcFinanceira import CalcFinanceira
from CalcCientifica import CalcCientifica
cc1 = CalcCientifica("Hp", "H230", "Cinza")
cf1 = CalcFinanceira("Acer", "A115", "Azul")
cc1.exponenciar(1, 2)
cf1.modular(3,5)
| [
"CalcFinanceira.CalcFinanceira",
"CalcCientifica.CalcCientifica"
] | [((91, 128), 'CalcCientifica.CalcCientifica', 'CalcCientifica', (['"""Hp"""', '"""H230"""', '"""Cinza"""'], {}), "('Hp', 'H230', 'Cinza')\n", (105, 128), False, 'from CalcCientifica import CalcCientifica\n'), ((135, 173), 'CalcFinanceira.CalcFinanceira', 'CalcFinanceira', (['"""Acer"""', '"""A115"""', '"""Azul"""'], {}... |
import sys
def parse(func):
method = list(sys._current_frames().values())[0].f_back.f_globals['__name__'] #https://stackoverflow.com/questions/1095543/get-name-of-calling-functions-module-in-python#1095621
method_bytes = {
'mbinobs.ipv4' : 4,
'mbinobs.ipv6' : 16,
'mbinobs.uuid' : 16,
'mbinobs.mac' : 6
}
... | [
"sys._current_frames",
"sys.exit"
] | [((521, 532), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (529, 532), False, 'import sys\n'), ((45, 66), 'sys._current_frames', 'sys._current_frames', ([], {}), '()\n', (64, 66), False, 'import sys\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import grpc
import zemberek_grpc.language_id_pb2 as z_langid
import zemberek_grpc.language_id_pb2_grpc as z_langid_g
import zemberek_grpc.normalization_pb2 as z_normalization
import zemberek_grpc.normalization_pb2_grpc as z_normalization_g
import zemberek_grpc.preprocess_... | [
"zemberek_grpc.preprocess_pb2.TokenizationRequest",
"zemberek_grpc.morphology_pb2.SentenceAnalysisRequest",
"zemberek_grpc.morphology_pb2_grpc.MorphologyServiceStub",
"grpc.insecure_channel",
"zemberek_grpc.preprocess_pb2_grpc.PreprocessingServiceStub",
"zemberek_grpc.normalization_pb2.NormalizationReques... | [((521, 560), 'grpc.insecure_channel', 'grpc.insecure_channel', (['"""localhost:6789"""'], {}), "('localhost:6789')\n", (542, 560), False, 'import grpc\n'), ((576, 617), 'zemberek_grpc.language_id_pb2_grpc.LanguageIdServiceStub', 'z_langid_g.LanguageIdServiceStub', (['channel'], {}), '(channel)\n', (608, 617), True, 'i... |
#
# Copyright (c) 2019 ISP RAS (http://www.ispras.ru)
# Ivannikov Institute for System Programming of the Russian Academy of Sciences
#
# 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
#
# h... | [
"json.dumps"
] | [((882, 898), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (892, 898), False, 'import json\n')] |
# Copyright (c) 2018-2019, NVIDIA CORPORATION.
import numpy as np
import pytest
from utils import assert_eq
import nvcategory
import nvstrings
def test_size():
strs = nvstrings.to_device(
["eee", "aaa", "eee", "ddd", "ccc", "ccc", "ccc", "eee", "aaa"]
)
cat = nvcategory.from_strings(strs)
as... | [
"utils.assert_eq",
"nvcategory.to_device",
"pytest.raises",
"numpy.array",
"nvcategory.from_strings",
"nvcategory.from_strings_list",
"nvstrings.to_device",
"nvcategory.from_offsets"
] | [((175, 263), 'nvstrings.to_device', 'nvstrings.to_device', (["['eee', 'aaa', 'eee', 'ddd', 'ccc', 'ccc', 'ccc', 'eee', 'aaa']"], {}), "(['eee', 'aaa', 'eee', 'ddd', 'ccc', 'ccc', 'ccc', 'eee',\n 'aaa'])\n", (194, 263), False, 'import nvstrings\n'), ((284, 313), 'nvcategory.from_strings', 'nvcategory.from_strings', ... |
# coding: utf-8
"""
flyteidl/service/admin.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: version not set
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import r... | [
"six.iteritems"
] | [((12316, 12349), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (12329, 12349), False, 'import six\n')] |
"""
Object to perform analysis and plotting on a given dataset
Methods for the measurement control software to anaylse and plot data
@author: krolljg
"""
import matplotlib.pyplot as plt
import numpy as np
import colorsys
import qcodes
#from qcodes import Instrument # consider making a qcodes instrument in the future... | [
"numpy.abs",
"numpy.argmax",
"numpy.polyfit",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.round",
"matplotlib.pyplot.tight_layout",
"numpy.transpose",
"numpy.linspace",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"numpy.asarray",
"numpy.isinf",
"scipy.optimize.curve_fit",
... | [((2870, 2882), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2880, 2882), True, 'import matplotlib.pyplot as plt\n'), ((7099, 7134), 'numpy.polyfit', 'np.polyfit', (['self.xvar', 'self.yvar', '(1)'], {}), '(self.xvar, self.yvar, 1)\n', (7109, 7134), True, 'import numpy as np\n'), ((7151, 7196), 'numpy.l... |
import os
from typing import Optional
from pytest_embedded.log import PexpectProcess, cls_redirect_stdout, live_print_call
from pytest_embedded_idf.app import IdfApp
from . import DEFAULT_IMAGE_FN
class IdfFlashImageMaker:
"""
Create a single image for qemu based on the `IdfApp`'s partition table and all th... | [
"os.path.exists",
"os.path.join",
"pytest_embedded.log.live_print_call",
"pytest_embedded.log.cls_redirect_stdout"
] | [((3145, 3187), 'pytest_embedded.log.cls_redirect_stdout', 'cls_redirect_stdout', ([], {'source': '"""create image"""'}), "(source='create image')\n", (3164, 3187), False, 'from pytest_embedded.log import PexpectProcess, cls_redirect_stdout, live_print_call\n'), ((1204, 1315), 'pytest_embedded.log.live_print_call', 'li... |
import sys
import gzip
import os
DEBUG = 0
if DEBUG:
inputFile="Z:/Shared/Labs/Vickers Lab/Tiger/projects/20150930_TGIRT_tRNA_human/identical/result/KCVH01_clipped_identical.fastq.gz"
originalFile="Z:/Shared/Labs/Vickers Lab/Tiger/data/20150515_tRNA/KCVH1_S6_R1_001.fastq.gz"
outputFile="H:/temp/test_cc... | [
"os.rename",
"os.path.isfile",
"gzip.open",
"os.remove"
] | [((468, 494), 'gzip.open', 'gzip.open', (['inputFile', '"""rt"""'], {}), "(inputFile, 'rt')\n", (477, 494), False, 'import gzip\n'), ((1075, 1104), 'gzip.open', 'gzip.open', (['originalFile', '"""rt"""'], {}), "(originalFile, 'rt')\n", (1084, 1104), False, 'import gzip\n'), ((2018, 2044), 'os.path.isfile', 'os.path.isf... |
from flask import Flask, render_template
from flask_socketio import SocketIO
from models import TikTok
import os
app = Flask(__name__)
socketio = SocketIO(app)
tiktok = TikTok(os.getenv('ACC_HANDLE'))
def emit_data():
data = {
'followers': tiktok.followers,
'likes': tiktok.likes
}
socketi... | [
"flask.Flask",
"os.getenv",
"flask.render_template",
"flask_socketio.SocketIO"
] | [((120, 135), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (125, 135), False, 'from flask import Flask, render_template\n'), ((147, 160), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (155, 160), False, 'from flask_socketio import SocketIO\n'), ((177, 200), 'os.getenv', 'os.getenv', ([... |
import numpy as np
import matplotlib.pyplot as pl
import h5py
import platform
import os
import pickle
import scipy.io as io
import seaborn as sns
from keras.models import model_from_json
import json
from ipdb import set_trace as stop
class plot_map(object):
def __init__(self, root):
self.root = root
... | [
"matplotlib.pyplot.tight_layout",
"h5py.File",
"numpy.atleast_3d",
"matplotlib.pyplot.show",
"numpy.sum",
"matplotlib.pyplot.close",
"numpy.zeros",
"numpy.max",
"keras.models.model_from_json",
"numpy.min",
"numpy.mean",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((504, 533), 'h5py.File', 'h5py.File', (['self.dataFile', '"""r"""'], {}), "(self.dataFile, 'r')\n", (513, 533), False, 'import h5py\n'), ((611, 636), 'numpy.min', 'np.min', (['self.pars'], {'axis': '(0)'}), '(self.pars, axis=0)\n', (617, 636), True, 'import numpy as np\n'), ((658, 683), 'numpy.max', 'np.max', (['self... |
import random
import math
def MUTATE(X,RATE=.05):
def MU(X,RATE):
if random.random()<=RATE:
return random.random()
else:
return X
return [MU(x,RATE) for x in X]
def CROSSOVER(A,B,RATE=.5):
if random.random()<=RATE:
return [*A[0:len(A)//2],*B[len(B)//2:]],[*B[0:len(B)//2],*A[len(A)//2:]]
else:
return [... | [
"random.random"
] | [((205, 220), 'random.random', 'random.random', ([], {}), '()\n', (218, 220), False, 'import random\n'), ((72, 87), 'random.random', 'random.random', ([], {}), '()\n', (85, 87), False, 'import random\n'), ((105, 120), 'random.random', 'random.random', ([], {}), '()\n', (118, 120), False, 'import random\n'), ((699, 714)... |
import socket
class PostMan(object):
def __init__(self):
self.mailBox = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
def PutOneLetter(self, ipAddr, port, letter):
encoded_letter = letter.encode("utf-8")
try:
self.mailBox.sendto(encoded_letter, (ipAddr, port))
exc... | [
"socket.socket"
] | [((85, 133), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (98, 133), False, 'import socket\n')] |
# Copyright 2018 <NAME> <<EMAIL>>
#
# 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 l... | [
"serial.Serial",
"numpy.array"
] | [((4568, 4586), 'numpy.array', 'np.array', (['measures'], {}), '(measures)\n', (4576, 4586), True, 'import numpy as np\n'), ((1144, 1284), 'serial.Serial', 'serial.Serial', (['self._port'], {'baudrate': '(9600)', 'bytesize': 'serial.EIGHTBITS', 'parity': 'serial.PARITY_NONE', 'stopbits': 'serial.STOPBITS_ONE', 'timeout... |
import keras_mnist as km
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D
from keras.optimizers import RMSprop
from keras.callbacks import Callback, CSVLogger
from matplotlib import pyplot as plt
from sklearn.model_s... | [
"keras.preprocessing.image.ImageDataGenerator",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"sklearn.model_selection.train_test_split",
"keras.datasets.mnist.load_data",
"pickle.load",
"keras.utils.to_categorical"
] | [((556, 725), 'keras.preprocessing.image.ImageDataGenerator', 'image.ImageDataGenerator', ([], {'rotation_range': '(60)', 'width_shift_range': '(0.2)', 'height_shift_range': '(0.2)', 'shear_range': '(math.pi / 4)', 'zoom_range': '(0.4)', 'fill_mode': '"""constant"""', 'cval': '(0)'}), "(rotation_range=60, width_shift_r... |
import os
from subprocess import getstatusoutput
def compiler(dirPath, string):
filePath = os.path.join(dirPath, "Demo.js")
with open(filePath, "w+") as fp:
fp.write(string)
cmd = f"node {filePath}"
print(cmd, string)
exitcode, data = getstatusoutput(cmd)
return exitcode == 0,... | [
"subprocess.getstatusoutput",
"os.path.join"
] | [((98, 130), 'os.path.join', 'os.path.join', (['dirPath', '"""Demo.js"""'], {}), "(dirPath, 'Demo.js')\n", (110, 130), False, 'import os\n'), ((271, 291), 'subprocess.getstatusoutput', 'getstatusoutput', (['cmd'], {}), '(cmd)\n', (286, 291), False, 'from subprocess import getstatusoutput\n')] |
from __future__ import print_function
import logging
log = logging.getLogger('SKQ.SnobFit')
if not log.hasHandlers():
def _setupLogger(log):
import sys
hdlr = logging.StreamHandler(sys.stdout)
frmt = logging.Formatter('%(name)-12s: %(levelname)8s %(message)s')
hdlr.setFormatter(frmt... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((60, 92), 'logging.getLogger', 'logging.getLogger', (['"""SKQ.SnobFit"""'], {}), "('SKQ.SnobFit')\n", (77, 92), False, 'import logging\n'), ((180, 213), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (201, 213), False, 'import logging\n'), ((229, 289), 'logging.Formatter', '... |
# BUG: Change in index of empty dataframes in mode operation #43336
import pandas as pd
print(pd.__version__)
df = pd.DataFrame({"a": ["a", "b", "a"]}, index=["a", "b", "c"])
result = df.mode(numeric_only=True)
print(result)
expected = pd.DataFrame(index=["a", "b", "c"])
pd.testing.assert_frame_equal(result, expect... | [
"pandas.DataFrame",
"pandas.testing.assert_frame_equal"
] | [((118, 177), 'pandas.DataFrame', 'pd.DataFrame', (["{'a': ['a', 'b', 'a']}"], {'index': "['a', 'b', 'c']"}), "({'a': ['a', 'b', 'a']}, index=['a', 'b', 'c'])\n", (130, 177), True, 'import pandas as pd\n'), ((240, 275), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': "['a', 'b', 'c']"}), "(index=['a', 'b', 'c'])\n",... |
import os
import unittest
import logging
import shutil
import numpy as np
from smac.configspace import Configuration
from smac.scenario.scenario import Scenario
from smac.stats.stats import Stats
from smac.tae.execute_ta_run import StatusType
from smac.tae.execute_ta_run_old import ExecuteTARunOld
from smac.runhistor... | [
"os.remove",
"smac.utils.validate._Run",
"smac.runhistory.runhistory.RunHistory",
"smac.utils.io.traj_logging.TrajLogger.read_traj_aclib_format",
"shutil.rmtree",
"smac.tae.execute_ta_run_old.ExecuteTARunOld",
"os.path.join",
"os.chdir",
"unittest.mock.MagicMock",
"smac.utils.validate.Validator",
... | [((716, 727), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (725, 727), False, 'import os\n'), ((736, 760), 'os.chdir', 'os.chdir', (['base_directory'], {}), '(base_directory)\n', (744, 760), False, 'import os\n'), ((770, 791), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (789, 791), False, 'import log... |
from io import BytesIO
import pytest
from thumbor.engines import BaseEngine
from PIL import Image
@pytest.fixture
def config(config):
config.FILTERS = [
'thumbor_video_engine.filters.format',
'thumbor_video_engine.filters.still',
'thumbor.filters.watermark',
]
config.QUALITY = 95... | [
"pytest.mark.parametrize",
"thumbor.engines.BaseEngine.get_mimetype",
"io.BytesIO"
] | [((364, 412), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pos"""', "['', '00:00:00']"], {}), "('pos', ['', '00:00:00'])\n", (387, 412), False, 'import pytest\n'), ((761, 880), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""format,mime_type"""', "[('webp', 'image/webp'), ('jpg', 'image/jpeg'... |
from django.http import HttpResponse
from django.shortcuts import render
from .one_variable_stats import OneVariableStatsQuestion, OneVariableStatsQuestionType
from .probabilities import ProbabilitiesQuestion, ProbabilitiesQuestionType
# Create your views here.
def index(request):
return render(request, 'index.htm... | [
"django.shortcuts.render"
] | [((294, 323), 'django.shortcuts.render', 'render', (['request', '"""index.html"""'], {}), "(request, 'index.html')\n", (300, 323), False, 'from django.shortcuts import render\n'), ((1401, 1461), 'django.shortcuts.render', 'render', (['request', '"""probabilities.html"""', 'probabilities_context'], {}), "(request, 'prob... |
from django.contrib import admin
from . import models
class DoNotLog:
def log_addition(self, *args, **kwargs):
return
def log_change(self, *args, **kwargs):
return
def log_deletion(self, *args, **kwargs):
return
class YamlAdmin(DoNotLog, admin.ModelAdmin):
list_display = (... | [
"django.contrib.admin.site.register"
] | [((2217, 2264), 'django.contrib.admin.site.register', 'admin.site.register', (['models.YamlFile', 'YamlAdmin'], {}), '(models.YamlFile, YamlAdmin)\n', (2236, 2264), False, 'from django.contrib import admin\n'), ((2265, 2316), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Category', 'CategoryAdm... |
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.distributions.independent import Independent
from torch.distributions.normal import Normal
import numpy as np
from ..utils import export, Named, Expression
from ..conv_parts import ResBlock,conv2d
from ..invertible import SqueezeLayer,padChan... | [
"torch.ones",
"torch.nn.ReLU",
"torch.nn.BatchNorm2d",
"torch.device",
"torch.nn.Linear",
"torch.zeros"
] | [((987, 1009), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (999, 1009), False, 'import torch\n'), ((2335, 2357), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(16 * k)'], {}), '(16 * k)\n', (2349, 2357), True, 'import torch.nn as nn\n'), ((2423, 2453), 'torch.nn.Linear', 'nn.Linear', (['(16 *... |
#!/bin/python
import json
YAHOO_ENDPOINT = 'https://fantasysports.yahooapis.com/fantasy/v2'
class YHandler:
"""Class that constructs the APIs to send to Yahoo"""
def __init__(self, sc):
self.sc = sc
def get(self, uri):
"""Send an API request to the URI and return the response as JSON
... | [
"json.dumps"
] | [((750, 767), 'json.dumps', 'json.dumps', (['jresp'], {}), '(jresp)\n', (760, 767), False, 'import json\n')] |
from django.db import models
class Pizza(models.Model):
name = models.CharField(max_length=120)
priceM = models.DecimalField(max_digits=4, decimal_places=2)
priceL = models.DecimalField(max_digits=4, decimal_places=2)
pImage = models.URLField()
class Burger(models.Model):
name = models.Char... | [
"django.db.models.CharField",
"django.db.models.DecimalField",
"django.db.models.URLField"
] | [((70, 102), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (86, 102), False, 'from django.db import models\n'), ((116, 167), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'max_digits': '(4)', 'decimal_places': '(2)'}), '(max_digits=4, decimal_plac... |
'''
This script, functions of which are in foo_vb_lib.py, is based on
https://github.com/chenzeno/FOO-VB/blob/ebc14a930ba9d1c1dadc8e835f746c567c253946/main.py
For more information, please see the original paper https://arxiv.org/abs/2010.00373 .
Author: <NAME>(@karalleyna)
'''
import numpy as np
from time import ... | [
"jax.random.PRNGKey",
"foo_vb_lib.aggregate_e_b",
"foo_vb_lib.update_m",
"foo_vb_lib.weight_grad",
"jax.numpy.argmax",
"foo_vb_lib.aggregate_e_a",
"foo_vb_lib.init_param",
"functools.partial",
"foo_vb_lib.aggregate_grads",
"jax.numpy.sum",
"foo_vb_lib.gen_phi",
"foo_vb_lib.zero_matrix",
"jax... | [((752, 769), 'jax.random.split', 'random.split', (['key'], {}), '(key)\n', (764, 769), False, 'from jax import random, value_and_grad, tree_map, vmap, lax\n'), ((865, 899), 'jax.tree_map', 'tree_map', (['jnp.transpose', 'variables'], {}), '(jnp.transpose, variables)\n', (873, 899), False, 'from jax import random, valu... |
"""Template plugin for Home Assistant CLI (hass-cli)."""
import logging
import os
from typing import Any, Dict # noqa, flake8 issue
import click
from jinja2 import Environment, FileSystemLoader
from homeassistant_cli.cli import pass_context
from homeassistant_cli.config import Configuration
import homeassistant_cli.... | [
"os.path.basename",
"os.path.dirname",
"click.option",
"click.File",
"click.command",
"homeassistant_cli.remote.render_template",
"logging.getLogger"
] | [((346, 373), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (363, 373), False, 'import logging\n'), ((854, 879), 'click.command', 'click.command', (['"""template"""'], {}), "('template')\n", (867, 879), False, 'import click\n'), ((1006, 1106), 'click.option', 'click.option', (['"""--loca... |
from typing import Optional, Dict
import css_inline
import jinja2
from cc_email_templates import txt_processing
env = jinja2.Environment(
loader = jinja2.PackageLoader("cc_email_templates", "templates"),
autoescape = jinja2.select_autoescape()
)
inliner = css_inline.CSSInliner()
def call_to_actio... | [
"jinja2.PackageLoader",
"cc_email_templates.txt_processing.process",
"jinja2.select_autoescape",
"css_inline.CSSInliner"
] | [((278, 301), 'css_inline.CSSInliner', 'css_inline.CSSInliner', ([], {}), '()\n', (299, 301), False, 'import css_inline\n'), ((156, 211), 'jinja2.PackageLoader', 'jinja2.PackageLoader', (['"""cc_email_templates"""', '"""templates"""'], {}), "('cc_email_templates', 'templates')\n", (176, 211), False, 'import jinja2\n'),... |
import FWCore.ParameterSet.Config as cms
from DQM.TrackingMonitor.packedCandidateTrackValidator_cfi import *
packedCandidateTrackValidatorLostTracks = packedCandidateTrackValidator.clone(
trackToPackedCandidateAssociation = "lostTracks",
rootFolder = "Tracking/PackedCandidate/lostTracks"
)
tracksDQMMiniAOD =... | [
"FWCore.ParameterSet.Config.Sequence"
] | [((321, 410), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['(packedCandidateTrackValidator + packedCandidateTrackValidatorLostTracks)'], {}), '(packedCandidateTrackValidator +\n packedCandidateTrackValidatorLostTracks)\n', (333, 410), True, 'import FWCore.ParameterSet.Config as cms\n')] |
import pygame
class Clock():
def __init__(self, FPS):
self.clock = pygame.time.Clock()
self.FPS = FPS
def waitForTick(self):
self.clock.tick(self.FPS)
def changeFPS(self, FPS):
self.FPS = FPS
clock = Clock(60) | [
"pygame.time.Clock"
] | [((81, 100), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (98, 100), False, 'import pygame\n')] |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"os.makedirs",
"src.dataset.create_ocr_val_dataset",
"numpy.zeros",
"numpy.ones",
"os.path.join"
] | [((1133, 1196), 'src.dataset.create_ocr_val_dataset', 'create_ocr_val_dataset', (['mindrecord_file', 'config.eval_batch_size'], {}), '(mindrecord_file, config.eval_batch_size)\n', (1155, 1196), False, 'from src.dataset import create_ocr_val_dataset\n'), ((1381, 1430), 'os.path.join', 'os.path.join', (['config.pre_resul... |
from typing import *
from nansi.utils.collections import iter_flat
TFileDataValue = Union[bool, str, int, float]
TFileDataSection = Mapping[str, Union[TFileDataValue, Iterable[TFileDataValue]]]
TFileData = Mapping[str, TFileDataSection]
def file_content_for(data: TFileData) -> str:
lines = []
for section_na... | [
"nansi.utils.collections.iter_flat"
] | [((661, 677), 'nansi.utils.collections.iter_flat', 'iter_flat', (['value'], {}), '(value)\n', (670, 677), False, 'from nansi.utils.collections import iter_flat\n')] |
import sys, os
import datetime
pippath = __file__
pippath_folder, filename = os.path.split(pippath)
try:
import setuptools
except ImportError:
print("Installing setuptools...")
# install setuptools
setuptools_path = '"%s"' %os.path.join(pippath_folder, "ez_setup.py")
python_folder = os.path.sp... | [
"os.remove",
"os.walk",
"os.path.isfile",
"os.path.join",
"urllib2.urlopen",
"os.path.lexists",
"os.path.abspath",
"os.path.dirname",
"urllib2.Request",
"os.path.exists",
"sys.version.startswith",
"site.getsitepackages",
"imp.load_module",
"datetime.datetime.today",
"pdoc.Module",
"imp... | [((81, 103), 'os.path.split', 'os.path.split', (['pippath'], {}), '(pippath)\n', (94, 103), False, 'import sys, os\n'), ((906, 940), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pippath_folder'], {}), '(0, pippath_folder)\n', (921, 940), False, 'import sys, os\n'), ((1238, 1275), 'os.path.join', 'os.path.join', (['p... |
from juriscraper.lib.html_utils import get_html5_parsed_text
from juriscraper.opinions.united_states.federal_appellate import ca11_p
class Site(ca11_p.Site):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.url = "http://media.ca11.uscourts.gov/opinions/unpub/l... | [
"juriscraper.lib.html_utils.get_html5_parsed_text"
] | [((482, 509), 'juriscraper.lib.html_utils.get_html5_parsed_text', 'get_html5_parsed_text', (['text'], {}), '(text)\n', (503, 509), False, 'from juriscraper.lib.html_utils import get_html5_parsed_text\n')] |
#!/usr/bin/env python3
#
# Copyright (c) 2019, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | [
"unittest.main"
] | [((5675, 5690), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5688, 5690), False, 'import unittest\n')] |
from ignite.engine import Events
from ignite.contrib.handlers.tqdm_logger import ProgressBar
from ignite.handlers import Checkpoint, DiskSaver, global_step_from_engine
from logger.base.base_logger import BaseLogger
from logger.base.utils import *
from logger.neptune.neptune_utils import *
from ignite.contrib.handlers.n... | [
"os.getenv"
] | [((507, 537), 'os.getenv', 'os.getenv', (['"""NEPTUNE_API_TOKEN"""'], {}), "('NEPTUNE_API_TOKEN')\n", (516, 537), False, 'import os\n')] |
from fanstatic import Library, Resource, Group
library = Library('pace', 'resources')
pace_js = Resource(library, 'js/pace.js', minified='js/pace.min.js')
pace_barber_shop_css = Resource(library, 'css/pace-barber-shop.css')
pace_center_atom_css = Resource(library, 'css/pace-center-atom.css')
pace_center_simple_css =... | [
"fanstatic.Group",
"fanstatic.Library",
"fanstatic.Resource"
] | [((58, 86), 'fanstatic.Library', 'Library', (['"""pace"""', '"""resources"""'], {}), "('pace', 'resources')\n", (65, 86), False, 'from fanstatic import Library, Resource, Group\n'), ((98, 156), 'fanstatic.Resource', 'Resource', (['library', '"""js/pace.js"""'], {'minified': '"""js/pace.min.js"""'}), "(library, 'js/pace... |
"""Test compilation database flags generation."""
import imp
from unittest import TestCase
from os import path
from EasyClangComplete.plugin.utils import include_parser
imp.reload(include_parser)
class TestIncludeParser(TestCase):
"""Test unique list."""
def test_get_all_includes(self):
"""Test get... | [
"imp.reload",
"os.path.dirname",
"EasyClangComplete.plugin.utils.include_parser.get_all_headers",
"os.path.normpath"
] | [((171, 197), 'imp.reload', 'imp.reload', (['include_parser'], {}), '(include_parser)\n', (181, 197), False, 'import imp\n'), ((364, 386), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (376, 386), False, 'from os import path\n'), ((404, 524), 'EasyClangComplete.plugin.utils.include_parser.get_a... |
import numpy as np
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Dense
from tcn import TCN
# if you increase the sequence length make sure the receptive field of the TCN is big enough.
MAX_TIME_STEP = 30
"""
Input: sequence of length 7
Input: sequence of length 25
Input: sequence of len... | [
"tensorflow.keras.layers.Dense",
"numpy.zeros",
"numpy.expand_dims",
"tcn.TCN"
] | [((1154, 1180), 'tcn.TCN', 'TCN', ([], {'input_shape': '(None, 1)'}), '(input_shape=(None, 1))\n', (1157, 1180), False, 'from tcn import TCN\n'), ((1186, 1216), 'tensorflow.keras.layers.Dense', 'Dense', (['(1)'], {'activation': '"""sigmoid"""'}), "(1, activation='sigmoid')\n", (1191, 1216), False, 'from tensorflow.kera... |
from singlecellmultiomics.universalBamTagger.digest import DigestFlagger
from singlecellmultiomics.tagtools import tagtools
class NlaIIIFlagger(DigestFlagger):
def __init__(self, **kwargs):
DigestFlagger.__init__(self, **kwargs)
def addSite(self, reads, strand, restrictionChrom, restriction... | [
"singlecellmultiomics.tagtools.tagtools.getRandomPrimerHash",
"singlecellmultiomics.universalBamTagger.digest.DigestFlagger.__init__",
"singlecellmultiomics.tagtools.tagtools.getPairGenomicLocations"
] | [((212, 250), 'singlecellmultiomics.universalBamTagger.digest.DigestFlagger.__init__', 'DigestFlagger.__init__', (['self'], {}), '(self, **kwargs)\n', (234, 250), False, 'from singlecellmultiomics.universalBamTagger.digest import DigestFlagger\n'), ((2563, 2625), 'singlecellmultiomics.tagtools.tagtools.getRandomPrimerH... |
# -*- coding: utf-8 -*-
# Copyright 2008-2011, <NAME> (inamidst.com) and <NAME>
# (yanovich.net)
# Copyright © 2012, <NAME> <<EMAIL>>
# Copyright 2012, <NAME> (embolalia.net)
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals
import re
import time
import base64
import lpbot
from lp... | [
"lpbot.tools.iteritems",
"lpbot.logger.get_logger",
"time.sleep",
"lpbot.module.rule",
"base64.b64encode",
"lpbot.tools.Identifier",
"lpbot.module.priority",
"lpbot.module.event",
"lpbot.module.thread",
"re.search"
] | [((481, 501), 'lpbot.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (491, 501), False, 'from lpbot.logger import get_logger\n'), ((505, 524), 'lpbot.module.event', 'event', (['"""001"""', '"""251"""'], {}), "('001', '251')\n", (510, 524), False, 'from lpbot.module import event, rule, thread, unbl... |
import os
import pytest
from unittest.mock import patch, MagicMock
import tempfile
from click.testing import CliRunner
from paths_cli.commands.visit_all import *
import openpathsampling as paths
# patch with this for testing
def print_test(output_storage, states, engine, initial_frame):
print(isinstance(output_... | [
"os.remove",
"os.path.join",
"pytest.fixture",
"unittest.mock.patch",
"tempfile.mkdtemp",
"os.rmdir",
"click.testing.CliRunner",
"openpathsampling.Storage"
] | [((457, 473), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (471, 473), False, 'import pytest\n'), ((716, 780), 'unittest.mock.patch', 'patch', (['"""paths_cli.commands.visit_all.visit_all_main"""', 'print_test'], {}), "('paths_cli.commands.visit_all.visit_all_main', print_test)\n", (721, 780), False, 'from uni... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 11:25:16 2017
@author: flwe6397
"""
import scipy
import statsmodels.api as sm
import matplotlib
matplotlib.rcParams.update({'font.size': 12})
from matplotlib import pyplot
import numpy as np
from pylab import rcParams
rcParams['figure.figsize'] = 16/2,12/2
... | [
"matplotlib.pyplot.show",
"statistics.median",
"scipy.stats.shapiro",
"numpy.argmax",
"scipy.stats.mannwhitneyu",
"statistics.stdev",
"matplotlib.rcParams.update",
"matplotlib.pyplot.bar",
"scipy.stats.levene",
"scipy.stats.ttest_ind",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.array... | [((153, 198), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 12}"], {}), "({'font.size': 12})\n", (179, 198), False, 'import matplotlib\n'), ((1008, 1031), 'statistics.stdev', 'statistics.stdev', (['list1'], {}), '(list1)\n', (1024, 1031), False, 'import statistics\n'), ((1046, 1069), 'sta... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import json
import os
from unittest import TestCase
from unittest.mock import patch, MagicMock
from functionsTests.helpers.sample_lambda_events import http_event
with patch.dict(os.environ, {
'ACHIEVEMENTS_... | [
"functions.achievements.AdminAddAchievements.index.achievements_table.update_item.assert_called_once",
"unittest.mock.MagicMock",
"json.loads",
"functions.achievements.AdminAddAchievements.index.achievements_table.get_item.assert_called_once",
"functions.achievements.AdminAddAchievements.index.s3_client.del... | [((277, 463), 'unittest.mock.patch.dict', 'patch.dict', (['os.environ', "{'ACHIEVEMENTS_TABLE_NAME': 'gamekit_dev_foogamename_game_achievements',\n 'ACHIEVEMENTS_BUCKET_NAME':\n 'gamekit-dev-uswe2-abcd123-foogamename-achievements'}"], {}), "(os.environ, {'ACHIEVEMENTS_TABLE_NAME':\n 'gamekit_dev_foogamename_ga... |
import json
import os
import shutil
from unittest import TestCase
from flask import Flask
from micro.core.params import Params
class TestAPIRestEndpoints(TestCase):
@classmethod
def setUpClass(cls):
parent = os.path.abspath(os.path.join(os.path.dirname(__file__),
... | [
"micro.core.params.Params",
"os.makedirs",
"json.loads",
"os.path.dirname",
"flask.Flask",
"json.dumps",
"shutil.rmtree",
"os.path.join"
] | [((363, 406), 'os.path.join', 'os.path.join', (['parent', '"""resources"""', '"""plugin"""'], {}), "(parent, 'resources', 'plugin')\n", (375, 406), False, 'import os\n'), ((851, 870), 'flask.Flask', 'Flask', (['"""micro_test"""'], {}), "('micro_test')\n", (856, 870), False, 'from flask import Flask\n'), ((710, 742), 'o... |
import os
import numpy as np
import logging
from pystella.model.sn_eve import PreSN
from pystella.util.phys_var import phys
logger = logging.getLogger(__name__)
try:
import matplotlib.pyplot as plt
from matplotlib import gridspec
is_matplotlib = True
except ImportError:
logging.debug('matplotlib fa... | [
"os.path.expanduser",
"logging.debug",
"numpy.zeros",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.min",
"numpy.loadtxt",
"numpy.max",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.matplotlib.rcParams.update",
"pystella.model.sn_eve.PreSN",
"logging.getLogger"
] | [((136, 163), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (153, 163), False, 'import logging\n'), ((513, 540), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (530, 540), False, 'import logging\n'), ((11263, 11284), 'pystella.model.sn_eve.PreSN', 'PreSN', ... |
from pathlib import Path
from collections import defaultdict
import json
import subprocess
from multiprocessing import Process, Queue, current_process, cpu_count
import shutil
import os
import glob
DATASET_ROOT = Path("/media/gitumarkk/Seagate Backup Plus Drive//Dancelogue/DATASETS/Kinetics/")
DATA_GIF_ROOT = Path("/h... | [
"os.remove",
"collections.defaultdict",
"pathlib.Path",
"multiprocessing.Queue",
"shutil.rmtree",
"multiprocessing.Process",
"multiprocessing.cpu_count"
] | [((214, 305), 'pathlib.Path', 'Path', (['"""/media/gitumarkk/Seagate Backup Plus Drive//Dancelogue/DATASETS/Kinetics/"""'], {}), "(\n '/media/gitumarkk/Seagate Backup Plus Drive//Dancelogue/DATASETS/Kinetics/'\n )\n", (218, 305), False, 'from pathlib import Path\n'), ((312, 366), 'pathlib.Path', 'Path', (['"""/ho... |
from PyQt5 import QtCore, QtGui, QtWidgets
from AddStudent import Ui_AddStudent
from ViewStudents import Ui_ViewStudents
from Reports import Ui_Reports
class Ui_AdminHome(object):
def __init__(self, Dialog,unm):
self.dialog = Dialog
self.unm = unm
def addstdnts(self, event):
try:
... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtCore.QRect",
"ViewStudents.Ui_ViewStudents",
"PyQt5.QtWidgets.QDialog",
"Reports.Ui_Reports",
"AddStudent.Ui_AddStudent",
"sys.exc_info",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QApplication"
] | [((4222, 4254), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (4244, 4254), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((4268, 4287), 'PyQt5.QtWidgets.QDialog', 'QtWidgets.QDialog', ([], {}), '()\n', (4285, 4287), False, 'from PyQt5 import QtCore, QtGui, QtWi... |
from multiprocessing import Pool
from Model import Model
from util.Document import Document
from util.Sentence import Sentence
from util.Word import Word
from util.data import parse_doc
import time
import argparse
def label_doc(document):
sentences_to_process = []
doc_output = document.meta + "\n"
for sent... | [
"argparse.ArgumentParser",
"Model.Model",
"time.time",
"multiprocessing.Pool",
"util.data.parse_doc"
] | [((1225, 1236), 'time.time', 'time.time', ([], {}), '()\n', (1234, 1236), False, 'import time\n'), ((1249, 1260), 'Model.Model', 'Model', (['path'], {}), '(path)\n', (1254, 1260), False, 'from Model import Model\n'), ((1485, 1496), 'time.time', 'time.time', ([], {}), '()\n', (1494, 1496), False, 'import time\n'), ((151... |
#encoding: utf8
import datetime
import json
from unittest import TestCase
import mock
from dateutil.parser import parse as date_parse
from tests import BaseTestCase
from redash import models
from redash.utils import gen_query_hash, utcnow
class DashboardTest(BaseTestCase):
def test_appends_suffix_to_slug_when_dup... | [
"redash.utils.utcnow",
"json.dumps",
"redash.models.Query.all_queries",
"redash.models.Dashboard.recent",
"redash.models.Group.find_by_name",
"redash.models.QueryResult.get_latest",
"json.loads",
"redash.models.Event.create",
"datetime.datetime.utcfromtimestamp",
"redash.models.DataSourceGroup.cre... | [((24364, 24461), 'redash.models.DataSourceGroup.create', 'models.DataSourceGroup.create', ([], {'group': 'd.g1', 'data_source': 'd.ds1', 'permissions': "['create', 'view']"}), "(group=d.g1, data_source=d.ds1, permissions=[\n 'create', 'view'])\n", (24393, 24461), False, 'from redash import models\n'), ((24461, 2455... |
from py_sexpr.terms import *
from py_sexpr.stack_vm.emit import module_code
import dis
main = define("main", [], const(1))
assert eval(module_code(main))() == 1
main = define(
"main",
[],
block(
call(
var("print"), ite(cmp(const(1), Compare.GT, const(2)), const(1), const(2))
)... | [
"py_sexpr.stack_vm.emit.module_code"
] | [((1343, 1360), 'py_sexpr.stack_vm.emit.module_code', 'module_code', (['main'], {}), '(main)\n', (1354, 1360), False, 'from py_sexpr.stack_vm.emit import module_code\n'), ((2479, 2496), 'py_sexpr.stack_vm.emit.module_code', 'module_code', (['main'], {}), '(main)\n', (2490, 2496), False, 'from py_sexpr.stack_vm.emit imp... |
import os
from typing import List
from enum import IntEnum
import cv2 as cv
import numpy as np
from pydicom import dcmread
from pydicom.dataset import Dataset
from pydicom.sequence import Sequence
from rt_utils.utils import ROIData, SOPClassUID
def load_sorted_image_series(dicom_series_path: str):
"""
File ... | [
"cv2.line",
"numpy.invert",
"numpy.ravel",
"os.walk",
"numpy.zeros",
"numpy.ones",
"cv2.fillPoly",
"numpy.around",
"numpy.array",
"os.path.join",
"numpy.concatenate"
] | [((823, 849), 'os.walk', 'os.walk', (['dicom_series_path'], {}), '(dicom_series_path)\n', (830, 849), False, 'import os\n'), ((4837, 4882), 'numpy.concatenate', 'np.concatenate', (['(contour, z_indicies)'], {'axis': '(1)'}), '((contour, z_indicies), axis=1)\n', (4851, 4882), True, 'import numpy as np\n'), ((4899, 4916)... |
from ISR.utils.image_processing import process_array, process_output
class ImageModel:
"""ISR models parent class.
Contains functions that are common across the super-scaling models.
"""
def predict(self, input_image_array):
"""
Processes the image array into a suitable format
... | [
"ISR.utils.image_processing.process_array",
"ISR.utils.image_processing.process_output"
] | [((529, 561), 'ISR.utils.image_processing.process_array', 'process_array', (['input_image_array'], {}), '(input_image_array)\n', (542, 561), False, 'from ISR.utils.image_processing import process_array, process_output\n'), ((623, 645), 'ISR.utils.image_processing.process_output', 'process_output', (['sr_img'], {}), '(s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | [
"six.BytesIO",
"girder.utility.plugin_utilities.getPluginFailureInfo",
"mock.patch",
"girder.utility.plugin_utilities.findEntryPointPlugins"
] | [((1258, 1321), 'mock.patch', 'mock.patch', (['"""girder.utility.plugin_utilities.iter_entry_points"""'], {}), "('girder.utility.plugin_utilities.iter_entry_points')\n", (1268, 1321), False, 'import mock\n'), ((1606, 1649), 'mock.patch', 'mock.patch', (['"""pkg_resources.resource_exists"""'], {}), "('pkg_resources.reso... |
# Unit tests for c11.py
# IMPORTS
from c11 import Employee
from c11 import Manager
import unittest
# main
class EmployeeTests(unittest.TestCase):
def setUp(self):
self.e = Employee()
def test_get_name(self):
self.assertEqual("", self.e.get_name())
def test_get_salary(self):
sel... | [
"unittest.main",
"c11.Manager",
"c11.Employee"
] | [((1347, 1362), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1360, 1362), False, 'import unittest\n'), ((188, 198), 'c11.Employee', 'Employee', ([], {}), '()\n', (196, 198), False, 'from c11 import Employee\n'), ((645, 665), 'c11.Employee', 'Employee', (['"""John"""', '(60)'], {}), "('John', 60)\n", (653, 665),... |
from PySide2.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QLabel, QMenu, QAction
from PySide2.QtGui import QIcon, QDrag
from PySide2.QtCore import Signal, QMimeData, Qt, QEvent, QByteArray
import json
from custom_src.custom_list_widgets.ListWidget_NameLineEdit import ListWidget_NameLineEdit
from custom_src.glo... | [
"PySide2.QtGui.QDrag",
"PySide2.QtWidgets.QWidget.event",
"PySide2.QtWidgets.QMenu",
"PySide2.QtWidgets.QLabel",
"custom_src.custom_list_widgets.ListWidget_NameLineEdit.ListWidget_NameLineEdit",
"PySide2.QtGui.QIcon",
"PySide2.QtWidgets.QVBoxLayout",
"json.dumps",
"PySide2.QtCore.QMimeData",
"cust... | [((595, 603), 'PySide2.QtCore.Signal', 'Signal', ([], {}), '()\n', (601, 603), False, 'from PySide2.QtCore import Signal, QMimeData, Qt, QEvent, QByteArray\n'), ((919, 932), 'PySide2.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (930, 932), False, 'from PySide2.QtWidgets import QWidget, QHBoxLayout, QVBoxLay... |
import os
import json
import pickle
from datetime import datetime
import torch
import numpy as np
from pathlib import Path
from mushroom_rl.core import Serializable
from mushroom_rl.core.logger import ConsoleLogger
class BenchmarkLogger(ConsoleLogger):
"""
Class to handle all interactions with the log direc... | [
"json.dump",
"pickle.dump",
"numpy.save",
"numpy.load",
"json.load",
"os.path.isdir",
"torch.load",
"os.path.exists",
"datetime.datetime.now",
"torch.save",
"pathlib.Path",
"pickle.load",
"os.path.join",
"os.getenv"
] | [((2434, 2473), 'os.path.join', 'os.path.join', (['self._log_dir', 'log_id', '""""""'], {}), "(self._log_dir, log_id, '')\n", (2446, 2473), False, 'import os\n'), ((2818, 2869), 'os.path.join', 'os.path.join', (['self._log_dir', 'self._log_id', 'filename'], {}), '(self._log_dir, self._log_id, filename)\n', (2830, 2869)... |
import math
import numpy as np
def _is_in_china(func):
def wrapper(cls, lnglat):
if 72.004 < lnglat[0] < 137.8347 and .8293 < lnglat[1] < 55.8271:
return func(cls, lnglat)
return lnglat
return wrapper
class Convert:
_XPI = math.pi * 3000 / 180
_PI = math.pi
_A = 63782... | [
"math.exp",
"numpy.flip",
"math.sqrt",
"math.atan2",
"math.radians",
"math.tan",
"math.fabs",
"math.sin",
"numpy.array",
"math.cos",
"math.sinh",
"math.degrees"
] | [((1975, 1991), 'math.sin', 'math.sin', (['radlat'], {}), '(radlat)\n', (1983, 1991), False, 'import math\n'), ((2056, 2072), 'math.sqrt', 'math.sqrt', (['magic'], {}), '(magic)\n', (2065, 2072), False, 'import math\n'), ((3034, 3050), 'math.sin', 'math.sin', (['radlat'], {}), '(radlat)\n', (3042, 3050), False, 'import... |
from __future__ import print_function
import findspark
findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
'''def most_hashtags(new_state,):
final_hash = defaultdict(lambda: 0)
hashtags = ... | [
"pyspark.SparkContext",
"pyspark.SparkConf",
"pyspark.streaming.StreamingContext",
"findspark.init"
] | [((55, 71), 'findspark.init', 'findspark.init', ([], {}), '()\n', (69, 71), False, 'import findspark\n'), ((1084, 1095), 'pyspark.SparkConf', 'SparkConf', ([], {}), '()\n', (1093, 1095), False, 'from pyspark import SparkConf, SparkContext\n'), ((1126, 1149), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from flask import Flask, render_template, jsonify
from redis_conn import redis_conn_pool
app = Flask(__name__)
redis_conn = redis_conn_pool()
@app.route('/')
def index():
return render_template("bigdata.html")
def get_chart1_data():
chart1_data_lis... | [
"json.loads",
"flask.Flask",
"flask.jsonify",
"flask.render_template",
"redis_conn.redis_conn_pool"
] | [((156, 171), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from flask import Flask, render_template, jsonify\n'), ((185, 202), 'redis_conn.redis_conn_pool', 'redis_conn_pool', ([], {}), '()\n', (200, 202), False, 'from redis_conn import redis_conn_pool\n'), ((244, 275), 'flask.render_... |
# pylint: disable=missing-docstring, protected-access
# type: ignore
# TODO remove it later
# pylint: disable=invalid-name
import unittest
from exonum_client.crypto import Hash
from exonum_client.proofs.list_proof import ListProof
from exonum_client.proofs.list_proof.key import ProofListKey
from exonum_client.proofs... | [
"exonum_client.proofs.list_proof.list_proof.HashedEntry.parse",
"exonum_client.proofs.list_proof.ListProof.parse",
"exonum_client.proofs.list_proof.key.ProofListKey"
] | [((1105, 1134), 'exonum_client.proofs.list_proof.list_proof.HashedEntry.parse', 'HashedEntry.parse', (['entry_json'], {}), '(entry_json)\n', (1122, 1134), False, 'from exonum_client.proofs.list_proof.list_proof import HashedEntry\n'), ((1861, 1899), 'exonum_client.proofs.list_proof.ListProof.parse', 'ListProof.parse', ... |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
import sys
from collections import defaultd... | [
"collections.defaultdict",
"sys.setrecursionlimit"
] | [((325, 354), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(100000)'], {}), '(100000)\n', (346, 354), False, 'import sys\n'), ((830, 847), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (841, 847), False, 'from collections import defaultdict\n')] |
# Generated by Django 3.2 on 2022-02-04 03:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Apps', '0002_diaries'),
]
operations = [
migrations.AddField(
model_name='user',
name='remark',
field=mode... | [
"django.db.models.CharField"
] | [((316, 377), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(True)', 'verbose_name': '"""备注"""'}), "(max_length=50, null=True, verbose_name='备注')\n", (332, 377), False, 'from django.db import migrations, models\n')] |
import datetime
from flask import current_app, jsonify
from http import HTTPStatus
from sqlalchemy.orm import Session
import werkzeug.exceptions
from app.controllers.sales.helpers_sales import (
helper_verify_quatity_product_stock,
)
from app.models.product.products_model import ProductModel
from app.decorators ... | [
"app.controllers.sales.helpers_sales.helper_verify_quatity_product_stock",
"app.models.orders_sellers.orders_seller.OrdersModel",
"app.models.orders_has_products.orders_has_products.OrdersHasProductsModel",
"app.decorators.verify_payload",
"datetime.date.today",
"app.models.types_sales.type_sale.TypeSaleM... | [((590, 719), 'app.decorators.verify_payload', 'verify_payload', ([], {'fields_and_types': "{'id_seller': int, 'id_client': int, 'id_store': int, 'products': list,\n 'id_type_sale': int}"}), "(fields_and_types={'id_seller': int, 'id_client': int,\n 'id_store': int, 'products': list, 'id_type_sale': int})\n", (604... |
#!/usr/bin/env python3
#
# Advent of Code 2017 - Day 21
#
import logging
logging.basicConfig(format="%(asctime)s %(message)s", level=logging.INFO)
logger = logging.getLogger()
INPUTFILE = 'input.txt'
START = ['.#.', '..#', '###']
def sample_input():
return """
../.# => ##./#../...
.#./..#/### => #..#/..../....... | [
"logging.getLogger",
"logging.basicConfig"
] | [((75, 148), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s %(message)s', level=logging.INFO)\n", (94, 148), False, 'import logging\n'), ((158, 177), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (175, 177), F... |
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
from __future__ import division
import math
import json
import random
import pprint
import scipy.misc
import numpy as np
import os
from time import gmtime, strftime
#pp = pprint.PrettyPrinter()
#get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shap... | [
"os.makedirs",
"os.path.dirname",
"os.path.exists",
"numpy.expand_dims",
"numpy.zeros",
"numpy.fliplr",
"numpy.random.random",
"numpy.array",
"numpy.concatenate"
] | [((1157, 1184), 'os.path.dirname', 'os.path.dirname', (['image_path'], {}), '(image_path)\n', (1172, 1184), False, 'import os\n'), ((584, 611), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (598, 611), True, 'import numpy as np\n'), ((898, 912), 'numpy.fliplr', 'np.fliplr', (['im... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import datetime
import logging.config
import pytz
from campbellsciparser import cr
from tasks import insert_to_daily_single_measurements_by_sensor
from tasks impo... | [
"campbellsciparser.cr.extract_columns_data",
"argparse.ArgumentParser",
"tasks.insert_to_hourly_single_measurements_by_sensor.delay",
"utils.save_config",
"utils.load_config",
"tasks.insert_to_one_min_profile_measurements_by_sensor.delay",
"os.path.join",
"tasks.insert_to_one_min_single_measurements_b... | [((1541, 1585), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""cfg/appconfig.yaml"""'], {}), "(BASE_DIR, 'cfg/appconfig.yaml')\n", (1553, 1585), False, 'import os\n'), ((1608, 1650), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""cfg/logging.yaml"""'], {}), "(BASE_DIR, 'cfg/logging.yaml')\n", (1620, 1650), False,... |
import sys
def reverse_gcd(a, b, k):
cnt = 0
while cnt <= k:
a, b = a + b, a
cnt += 1
return a, b
def main():
k = int(sys.stdin.readline().rstrip())
print(reverse_gcd(1, 0, k))
if __name__ == '__main__':
main()
| [
"sys.stdin.readline"
] | [((164, 184), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (182, 184), False, 'import sys\n')] |
# allow us to mock behavior of django get database function.
# simulate behavior when database is available and not
# when we run our command
from unittest.mock import patch
# allow us to call the command in the source code
from django.core.management import call_command
# Error that django will throw when db is ... | [
"unittest.mock.patch",
"django.core.management.call_command"
] | [((1582, 1620), 'unittest.mock.patch', 'patch', (['"""time.sleep"""'], {'return_value': '(True)'}), "('time.sleep', return_value=True)\n", (1587, 1620), False, 'from unittest.mock import patch\n'), ((826, 880), 'unittest.mock.patch', 'patch', (['"""django.db.utils.ConnectionHandler.__getitem__"""'], {}), "('django.db.u... |
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.gui.DirectGui import *
from panda3d.core import *
from pirates.ai import HolidayGlobals
from pirates.battle import WeaponGlobals
from pirates.economy import EconomyGlobals
from pirates.economy.EconomyGlobals import ItemType
from pirates.holiday... | [
"pirates.piratesbase.PLocalizer.getItemName",
"pirates.inventory.ItemGlobals.getPrimaryColor",
"pirates.uberdog.UberDogGlobals.InventoryId.isStackable",
"pirates.piratesbase.PLocalizer.makeHeadingString",
"pirates.economy.EconomyGlobals.getItemCategory",
"pirates.economy.EconomyGlobals.getItemType",
"ra... | [((1885, 1912), 'pirates.piratesbase.PLocalizer.getItemName', 'PLocalizer.getItemName', (['uid'], {}), '(uid)\n', (1907, 1912), False, 'from pirates.piratesbase import PLocalizer\n'), ((1938, 1965), 'pirates.piratesbase.PLocalizer.getItemName', 'PLocalizer.getItemName', (['uid'], {}), '(uid)\n', (1960, 1965), False, 'f... |
from django.contrib import admin
from .models import Holiday, Vendor, Category, Ticket
admin.site.register(Holiday)
admin.site.register(Vendor)
admin.site.register(Category)
admin.site.register(Ticket)
| [
"django.contrib.admin.site.register"
] | [((89, 117), 'django.contrib.admin.site.register', 'admin.site.register', (['Holiday'], {}), '(Holiday)\n', (108, 117), False, 'from django.contrib import admin\n'), ((118, 145), 'django.contrib.admin.site.register', 'admin.site.register', (['Vendor'], {}), '(Vendor)\n', (137, 145), False, 'from django.contrib import a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import sys
import datetime
import os
from itertools import repeat
import multiprocessing
from multiprocessing import Pool, Lock, Value, Manager
multiprocessing.set_start_method('spawn', True)
### compile_test.py
### For each filename in file listed in @... | [
"subprocess.Popen",
"os.path.abspath",
"multiprocessing.Lock",
"multiprocessing.Manager",
"multiprocessing.set_start_method",
"os.cpu_count",
"datetime.datetime.now",
"os.chdir"
] | [((210, 257), 'multiprocessing.set_start_method', 'multiprocessing.set_start_method', (['"""spawn"""', '(True)'], {}), "('spawn', True)\n", (242, 257), False, 'import multiprocessing\n'), ((792, 861), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(cmd, s... |
#!/usr/bin/python3
from test_framework.test_framework import BethelTestFramework
from test_framework.staticr_util import *
import logging
'''
Checks that there is no interaction between immature balance and staking weight
node0 has both confirmed and immature balance, it sends away its confirmed balance to node1 so t... | [
"logging.info",
"logging.basicConfig"
] | [((464, 563), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s: %(message)s"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format='%(levelname)s: %(message)s', level=logging.INFO,\n stream=sys.stdout)\n", (483, 563), False, 'import logging\n'), ((1161, 1198), 'logging.info',... |
"""Common code between all entities"""
from dataclasses import dataclass, field
from urllib.parse import urljoin
from functools import wraps
from aiohttp import ClientResponse, ClientSession
from async_lru import alru_cache
HOST = "https://api.flair.co"
SCOPE = "thermostats.view+structures.view+structures.edit"
cla... | [
"dataclasses.field",
"urllib.parse.urljoin",
"aiohttp.ClientSession"
] | [((4278, 4295), 'dataclasses.field', 'field', ([], {'repr': '(False)'}), '(repr=False)\n', (4283, 4295), False, 'from dataclasses import dataclass, field\n'), ((471, 490), 'urllib.parse.urljoin', 'urljoin', (['HOST', 'path'], {}), '(HOST, path)\n', (478, 490), False, 'from urllib.parse import urljoin\n'), ((1355, 1370)... |
import ssl
from unittest import TestCase
import urllib.error
import urllib.request
from seleniumwire.proxy.client import AdminClient
class AdminClientIntegrationTest(TestCase):
def test_create_proxy(self):
html = self._make_request('http://python.org')
self.assertIn(b'Welcome to Python.org', ht... | [
"ssl.create_default_context",
"seleniumwire.proxy.client.AdminClient"
] | [((7754, 7767), 'seleniumwire.proxy.client.AdminClient', 'AdminClient', ([], {}), '()\n', (7765, 7767), False, 'from seleniumwire.proxy.client import AdminClient\n'), ((7997, 8025), 'ssl.create_default_context', 'ssl.create_default_context', ([], {}), '()\n', (8023, 8025), False, 'import ssl\n')] |
from tkinter import *
from tkinter import ttk
from tkinter import font
import threading
import time as time
import datetime
import calendar
import requests
from PIL import Image, ImageTk
def timer():
tmp = time.thread_time()
currentTime = time.localtime()
print(time.asctime(currentTime))
print(type(c... | [
"time.asctime",
"PIL.Image.open",
"time.thread_time",
"requests.get",
"time.localtime"
] | [((212, 230), 'time.thread_time', 'time.thread_time', ([], {}), '()\n', (228, 230), True, 'import time as time\n'), ((250, 266), 'time.localtime', 'time.localtime', ([], {}), '()\n', (264, 266), True, 'import time as time\n'), ((277, 302), 'time.asctime', 'time.asctime', (['currentTime'], {}), '(currentTime)\n', (289, ... |
import torch.nn.functional as F
import torch
from .factorgnn import FactorGNN, FactorGNNPool
from .factorgnn_zinc import FactorGNNZinc
from .factorgnn_pattern import FactorGNNSBMs
from .mlp import MLP, MLPPool
from .mlp_zinc import MLPZinc
from .gat import GAT, GATPool
from .gat_zinc import GATZinc
from .gat_pattern im... | [
"torch.max"
] | [((4491, 4508), 'torch.max', 'torch.max', (['labels'], {}), '(labels)\n', (4500, 4508), False, 'import torch\n')] |
from kivy.properties import NumericProperty, ReferenceListProperty
from kivy.uix.widget import Widget
from kivy.vector import Vector
# Define o elemento "bola"
class Bola(Widget):
"""
Define a bola do jogo e mantém sua velocidade, a qual é um Vector
contendo suas componentes de velocidade X e Y.
"""
... | [
"kivy.properties.NumericProperty",
"kivy.properties.ReferenceListProperty",
"kivy.vector.Vector"
] | [((364, 382), 'kivy.properties.NumericProperty', 'NumericProperty', (['(0)'], {}), '(0)\n', (379, 382), False, 'from kivy.properties import NumericProperty, ReferenceListProperty\n'), ((402, 420), 'kivy.properties.NumericProperty', 'NumericProperty', (['(0)'], {}), '(0)\n', (417, 420), False, 'from kivy.properties impo... |
from equity import app
from flask_script import Manager
manager = Manager(app)
if __name__ == '__main__':
manager.run()
| [
"flask_script.Manager"
] | [((67, 79), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (74, 79), False, 'from flask_script import Manager\n')] |
#!/usr/bin/env python3
import io
import unittest
import unittest.mock
from src import output
class TestOutput(unittest.TestCase):
HEADER_ROW = "filepath,function_or_class_name,variable_name,is_local\n"
def test_corner_cases(self):
mock_file_handle = io.StringIO()
output.writeCSV(set(), mock... | [
"unittest.main",
"io.StringIO",
"unittest.mock.Mock",
"src.output.writeCSV"
] | [((1157, 1172), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1170, 1172), False, 'import unittest\n'), ((271, 284), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (282, 284), False, 'import io\n'), ((485, 498), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (496, 498), False, 'import io\n'), ((532, 552), 'uni... |
"""
MIT License
Copyright (c) 2020 <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, publi... | [
"ctypes.get_errno",
"copy.copy",
"os.strerror"
] | [((6681, 6692), 'ctypes.get_errno', 'get_errno', ([], {}), '()\n', (6690, 6692), False, 'from ctypes import get_errno\n'), ((4301, 4312), 'ctypes.get_errno', 'get_errno', ([], {}), '()\n', (4310, 4312), False, 'from ctypes import get_errno\n'), ((6125, 6136), 'ctypes.get_errno', 'get_errno', ([], {}), '()\n', (6134, 61... |
from datetime import datetime
from os.path import dirname, join
import pytest
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_police_retirement import ChiPoliceRetirementSpider
test_response = file_response(
join(dirname(__file__), "files", "chi... | [
"os.path.dirname",
"datetime.datetime",
"pytest.mark.parametrize",
"city_scrapers.spiders.chi_police_retirement.ChiPoliceRetirementSpider",
"freezegun.freeze_time"
] | [((434, 461), 'city_scrapers.spiders.chi_police_retirement.ChiPoliceRetirementSpider', 'ChiPoliceRetirementSpider', ([], {}), '()\n', (459, 461), False, 'from city_scrapers.spiders.chi_police_retirement import ChiPoliceRetirementSpider\n'), ((473, 498), 'freezegun.freeze_time', 'freeze_time', (['"""2019-05-05"""'], {})... |
"""Categorical LSTM Model.
A model represented by a Categorical distribution
which is parameterized by a Long short-term memory (LSTM).
"""
import tensorflow as tf
import tensorflow_probability as tfp
from garage.tf.models.lstm_model import LSTMModel
class CategoricalLSTMModel(LSTMModel):
"""Categor... | [
"tensorflow.zeros_initializer",
"tensorflow.initializers.glorot_uniform",
"tensorflow_probability.distributions.OneHotCategorical"
] | [((3041, 3073), 'tensorflow.initializers.glorot_uniform', 'tf.initializers.glorot_uniform', ([], {}), '()\n', (3071, 3073), True, 'import tensorflow as tf\n'), ((3107, 3129), 'tensorflow.zeros_initializer', 'tf.zeros_initializer', ([], {}), '()\n', (3127, 3129), True, 'import tensorflow as tf\n'), ((3222, 3254), 'tenso... |
import logging
import os
import random
import sys
from enum import Enum
from functools import wraps
from logging.handlers import TimedRotatingFileHandler
class DynamicTimedRotatingFileHandler(TimedRotatingFileHandler):
# noinspection PyPep8Naming
def __init__(self, filename, when='h', interval=1, backupCount=... | [
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"functools.wraps",
"os.path.join",
"logging.getLogger"
] | [((1388, 1422), 'logging.getLogger', 'logging.getLogger', (['func.__module__'], {}), '(func.__module__)\n', (1405, 1422), False, 'import logging\n'), ((1429, 1440), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1434, 1440), False, 'from functools import wraps\n'), ((382, 407), 'os.path.dirname', 'os.path.dir... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2022 -- <NAME>
# All rights reserved.
#
# License: BSD License
#
"""\
Tests against issue 39
<https://github.com/heuer/segno/issues/39>
"""
from __future__ import absolute_import, unicode_literals
import os
import io
import tempfile
import pytest
import segno
from segno ... | [
"tempfile.NamedTemporaryFile",
"io.BytesIO",
"os.unlink",
"segno.make_qr",
"pytest.main"
] | [((362, 374), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (372, 374), False, 'import io\n'), ((518, 579), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', (['"""w"""'], {'suffix': '""".png"""', 'delete': '(False)'}), "('w', suffix='.png', delete=False)\n", (545, 579), False, 'import tempfile\n'), ((772, ... |
import hashlib
import hmac
import logging
import os
import tornado.escape
import tornado.httpserver
import tornado.gen
import tornado.ioloop
import tornado.log
import tornado.web
from . import update_pr
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.set_status(404)
self.write... | [
"os.environ.get",
"hmac.new"
] | [((2055, 2083), 'os.environ.get', 'os.environ.get', (['"""PORT"""', '(8080)'], {}), "('PORT', 8080)\n", (2069, 2083), False, 'import os\n'), ((714, 771), 'hmac.new', 'hmac.new', (['webhook_secret', 'self.request.body', 'hashlib.sha1'], {}), '(webhook_secret, self.request.body, hashlib.sha1)\n', (722, 771), False, 'impo... |
import logging
import os
from galaxy.util.dictifiable import Dictifiable
from galaxy.util.bunch import Bunch
from galaxy.util import asbool
from tool_shed.util import common_util
from urlparse import urljoin
log = logging.getLogger( __name__ )
class ToolShedRepository( object ):
dict_collection_visible_keys = ( ... | [
"tool_shed.util.common_util.remove_protocol_and_port_from_tool_shed_url",
"tool_shed.util.common_util.parse_repository_dependency_tuple",
"galaxy.util.bunch.Bunch",
"os.path.exists",
"galaxy.util.asbool",
"urlparse.urljoin",
"tool_shed.util.common_util.get_tool_shed_url_from_tool_shed_registry",
"os.p... | [((215, 242), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (232, 242), False, 'import logging\n'), ((877, 1273), 'galaxy.util.bunch.Bunch', 'Bunch', ([], {'NEW': '"""New"""', 'CLONING': '"""Cloning"""', 'SETTING_TOOL_VERSIONS': '"""Setting tool versions"""', 'INSTALLING_REPOSITORY_DEPEN... |
import unittest
from doublylinkedlist import DoublyLinkedList, DoublyLinkedListNode, DoublyLinkedListError
class TestDoublyLinkedList(unittest.TestCase):
def test_create_new_linked_list(self):
dl_list = DoublyLinkedList()
self.assertIsInstance(dl_list, DoublyLinkedList)
def test_create_new_li... | [
"doublylinkedlist.DoublyLinkedList"
] | [((217, 235), 'doublylinkedlist.DoublyLinkedList', 'DoublyLinkedList', ([], {}), '()\n', (233, 235), False, 'from doublylinkedlist import DoublyLinkedList, DoublyLinkedListNode, DoublyLinkedListError\n'), ((365, 392), 'doublylinkedlist.DoublyLinkedList', 'DoublyLinkedList', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (381, 3... |
#! /usr/bin/env python3
"""Tokenize a program"""
import re
from tokenize import TokenInfo
from tokenize import ISTERMINAL as is_terminal
from tokenize import ISNONTERMINAL as is_nonterminal
from simplecompiler.compiler.Symbol import *
__all__ = [ "is_terminal", "is_nonterminal", "tokenize", "print_tokens" ]
def gro... | [
"tokenize.TokenInfo",
"re.compile"
] | [((840, 878), 're.compile', 're.compile', (['"""[ \\\\t\\\\f]*(?:[\\\\r\\\\n]|$)"""'], {}), "('[ \\\\t\\\\f]*(?:[\\\\r\\\\n]|$)')\n", (850, 878), False, 'import re\n'), ((2470, 2520), 'tokenize.TokenInfo', 'TokenInfo', (['ENDMARKER', '""""""', '(lnum, 0)', '(lnum, 0)', '""""""'], {}), "(ENDMARKER, '', (lnum, 0), (lnum,... |
from __future__ import division, with_statement, absolute_import
import hashlib
import logging
import sys
from ldclient.version import VERSION
log = logging.getLogger(sys.modules[__name__].__name__)
# noinspection PyBroadException
try:
import queue
except:
# noinspection PyUnresolvedReferences,PyPep8Naming
... | [
"uwsgi.opt.get",
"logging.getLogger"
] | [((151, 200), 'logging.getLogger', 'logging.getLogger', (['sys.modules[__name__].__name__'], {}), '(sys.modules[__name__].__name__)\n', (168, 200), False, 'import logging\n'), ((2870, 2901), 'uwsgi.opt.get', 'uwsgi.opt.get', (['"""enable-threads"""'], {}), "('enable-threads')\n", (2883, 2901), False, 'import uwsgi\n')] |
from sepa.definitions.general import code_or_proprietary, party
from sepa.definitions.mandate import mandate_group_header, original_message, mandate
# PAIN.010.001.05 - Mandate Amendment Request v5
standard = 'pain.010.001.05'
name = 'mandate_amendment_request'
definition = {
'_namespaces': {
None: 'urn:is... | [
"sepa.definitions.mandate.mandate_group_header",
"sepa.definitions.general.code_or_proprietary",
"sepa.definitions.general.party",
"sepa.definitions.mandate.original_message",
"sepa.definitions.mandate.mandate"
] | [((533, 563), 'sepa.definitions.mandate.mandate_group_header', 'mandate_group_header', (['"""GrpHdr"""'], {}), "('GrpHdr')\n", (553, 563), False, 'from sepa.definitions.mandate import mandate_group_header, original_message, mandate\n'), ((651, 682), 'sepa.definitions.mandate.original_message', 'original_message', (['""... |
from distutils.core import setup
setup(name='uwsgitop',
version='0.8',
description='uWSGI top-like interface',
scripts=['uwsgitop'],
install_requires = ['simplejson']
)
| [
"distutils.core.setup"
] | [((34, 176), 'distutils.core.setup', 'setup', ([], {'name': '"""uwsgitop"""', 'version': '"""0.8"""', 'description': '"""uWSGI top-like interface"""', 'scripts': "['uwsgitop']", 'install_requires': "['simplejson']"}), "(name='uwsgitop', version='0.8', description=\n 'uWSGI top-like interface', scripts=['uwsgitop'], ... |
import numpy as np
import yaml, pickle, os, librosa, argparse
from concurrent.futures import ThreadPoolExecutor as PE
from collections import deque
from threading import Thread
from tqdm import tqdm
from Audio import Audio_Prep, Mel_Generate
from yin import pitch_calc
with open('Hyper_Parameters.yaml') as f:
hp_D... | [
"yaml.load",
"pickle.dump",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.basename",
"os.walk",
"Audio.Audio_Prep",
"Audio.Mel_Generate",
"numpy.min",
"numpy.max",
"pickle.load",
"os.path.splitext",
"yin.pitch_calc"
] | [((326, 358), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.Loader'}), '(f, Loader=yaml.Loader)\n', (335, 358), False, 'import yaml, pickle, os, librosa, argparse\n'), ((465, 749), 'yin.pitch_calc', 'pitch_calc', ([], {'sig': 'audio', 'sr': "hp_Dict['Sound']['Sample_Rate']", 'w_len': "hp_Dict['Sound']['Frame_Lengt... |
from rpython.jit.metainterp.test.support import LLJitMixin, noConst
from rpython.rlib import jit
class CallTest(object):
def test_indirect_call(self):
@jit.dont_look_inside
def f1(x):
return x + 1
@jit.dont_look_inside
def f2(x):
return x + 2
@jit.... | [
"rpython.jit.metainterp.test.support.noConst",
"rpython.rlib.jit.we_are_jitted",
"rpython.rlib.jit.JitDriver",
"rpython.rlib.jit.conditional_call",
"rpython.rlib.jit.conditional_call_elidable",
"rpython.rlib.jit._jit_conditional_call_value"
] | [((937, 973), 'rpython.rlib.jit.JitDriver', 'jit.JitDriver', ([], {'greens': '[]', 'reds': "['n']"}), "(greens=[], reds=['n'])\n", (950, 973), False, 'from rpython.rlib import jit\n'), ((2704, 2748), 'rpython.rlib.jit.JitDriver', 'jit.JitDriver', ([], {'greens': "['m']", 'reds': "['n', 'p']"}), "(greens=['m'], reds=['n... |