code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# import the necessary packages
from pyimagesearch.nn.conv.lenet import LeNet
from tensorflow.keras.utils import plot_model
model = LeNet.build(28, 28, 3, 3)
plot_model(model, show_shapes=True, to_file="lenet.png") | [
"tensorflow.keras.utils.plot_model",
"pyimagesearch.nn.conv.lenet.LeNet.build"
] | [((133, 158), 'pyimagesearch.nn.conv.lenet.LeNet.build', 'LeNet.build', (['(28)', '(28)', '(3)', '(3)'], {}), '(28, 28, 3, 3)\n', (144, 158), False, 'from pyimagesearch.nn.conv.lenet import LeNet\n'), ((159, 215), 'tensorflow.keras.utils.plot_model', 'plot_model', (['model'], {'show_shapes': '(True)', 'to_file': '"""le... |
import itertools
import pyscipopt as scip
import geco.mips.utilities.naming as naming
def naive(graph):
model = scip.Model("Naive MaxCut")
node_variables = {}
for v in graph.nodes():
node_variables[v] = model.addVar(lb=0, ub=1, obj=0, name=str(v), vtype="B")
edge_variables = {}
all_non_... | [
"geco.mips.utilities.naming.undirected_edge_name",
"pyscipopt.Model"
] | [((119, 145), 'pyscipopt.Model', 'scip.Model', (['"""Naive MaxCut"""'], {}), "('Naive MaxCut')\n", (129, 145), True, 'import pyscipopt as scip\n'), ((1377, 1406), 'pyscipopt.Model', 'scip.Model', (['"""Triangle MaxCut"""'], {}), "('Triangle MaxCut')\n", (1387, 1406), True, 'import pyscipopt as scip\n'), ((2237, 2270), ... |
import time
import socket
import sys
from board import Board
INF = 1.0e100
CORNERS = [(0, 0), (0, 7), (7, 0), (7, 7)]
CENTERS = [(3, 3), (3, 4), (4, 3), (4, 4)]
DANGERS = [(0, 1), (0, 6), (1, 0), (1, 1), (1, 6), (1, 7), (6, 0), (6, 1),
(6, 6), (6, 7), (7, 1), (7, 6)]
G_EDGES = [(0, 2), (0, 3), (0, 4), (0, ... | [
"socket.socket",
"time.time",
"time.sleep",
"board.Board",
"sys.exit"
] | [((695, 702), 'board.Board', 'Board', ([], {}), '()\n', (700, 702), False, 'from board import Board\n'), ((1529, 1578), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1542, 1578), False, 'import socket\n'), ((2098, 2111), 'time.sleep', 'time.... |
# Aplicación de validación de formularios en Javascript
#
# Copyright 2018 <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... | [
"flask.jsonify",
"flask.Flask",
"flask.render_template"
] | [((1214, 1229), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1219, 1229), False, 'from flask import Flask, render_template, request, jsonify\n'), ((1272, 1301), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (1287, 1301), False, 'from flask import Flask, rend... |
import inspect
# Indent level for writer
_INDENT_LEVEL = 2
_INDENT = ' ' * _INDENT_LEVEL
class _Writer(object):
'''Writer used to create source files with consistent formatting'''
def __init__(self, path):
'''
Args:
path (handle): File name and path to write to
'''
... | [
"inspect.cleandoc"
] | [((2383, 2408), 'inspect.cleandoc', 'inspect.cleandoc', (['content'], {}), '(content)\n', (2399, 2408), False, 'import inspect\n')] |
import torch
from torch import nn
from gpytorch.kernels import LinearKernel,MaternKernel,RBFKernel,Kernel
from torch.nn.modules.loss import _Loss
class Log1PlusExp(torch.autograd.Function):
"""Implementation of x ↦ log(1 + exp(x))."""
@staticmethod
def forward(ctx, x):
exp = x.exp()
ctx.sav... | [
"torch.mean",
"torch.ones",
"torch.median",
"torch.eye",
"torch.isinf",
"gpytorch.kernels.RBFKernel",
"torch.unsqueeze",
"torch.cat",
"torch.zeros",
"gpytorch.kernels.MaternKernel",
"torch.randperm",
"gpytorch.kernels.LinearKernel",
"gpytorch.kernels.Kernel",
"torch.no_grad",
"torch.sum"... | [((1322, 1339), 'torch.cat', 'torch.cat', (['[X, Y]'], {}), '([X, Y])\n', (1331, 1339), False, 'import torch\n'), ((2513, 2521), 'gpytorch.kernels.Kernel', 'Kernel', ([], {}), '()\n', (2519, 2521), False, 'from gpytorch.kernels import LinearKernel, MaternKernel, RBFKernel, Kernel\n'), ((3959, 3993), 'torch.mean', 'torc... |
from rembg.multiprocessing import parallel_greenscreen
if __name__ == "__main__":
parallel_greenscreen("/Users/zihao/Desktop/zero/video/group15B_Short.avi",
3,
1,
"u2net_human_seg",
frame_limit=300)
| [
"rembg.multiprocessing.parallel_greenscreen"
] | [((92, 213), 'rembg.multiprocessing.parallel_greenscreen', 'parallel_greenscreen', (['"""/Users/zihao/Desktop/zero/video/group15B_Short.avi"""', '(3)', '(1)', '"""u2net_human_seg"""'], {'frame_limit': '(300)'}), "('/Users/zihao/Desktop/zero/video/group15B_Short.avi', \n 3, 1, 'u2net_human_seg', frame_limit=300)\n", ... |
from datetime import datetime, timedelta
import numpy as np
input_data={'incon_state':'current',
'EOS':1,
'source_txt':'../input/',
'ref_date':datetime(1975,1,1,0,0,0),
'z_ref':600,
'db_path':'../input/model_month.db',
'LAYERS':{1:['A',100],
2:['B', 100],
3:['C', 125],
4:['D', 60],
... | [
"datetime.timedelta",
"datetime.datetime"
] | [((153, 182), 'datetime.datetime', 'datetime', (['(1975)', '(1)', '(1)', '(0)', '(0)', '(0)'], {}), '(1975, 1, 1, 0, 0, 0)\n', (161, 182), False, 'from datetime import datetime, timedelta\n'), ((884, 904), 'datetime.datetime', 'datetime', (['(1985)', '(7)', '(1)'], {}), '(1985, 7, 1)\n', (892, 904), False, 'from dateti... |
import os
from flask import Flask, app, flash, session
from flask_pymongo import PyMongo
from datetime import date, datetime
app = Flask(__name__)
app.config["MONGO_DBNAME"] = os.getenv('MONGO_DBNAME')
app.config["MONGO_URI"] = os.getenv('MONGO_URI')
app.config["SECRET_KEY"] = os.getenv('SECRET_KEY')
mongo = PyMongo(... | [
"flask.flash",
"flask.Flask",
"flask.session.get",
"datetime.date.today",
"datetime.datetime.strptime",
"flask_pymongo.PyMongo",
"os.getenv"
] | [((132, 147), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (137, 147), False, 'from flask import Flask, app, flash, session\n'), ((177, 202), 'os.getenv', 'os.getenv', (['"""MONGO_DBNAME"""'], {}), "('MONGO_DBNAME')\n", (186, 202), False, 'import os\n'), ((229, 251), 'os.getenv', 'os.getenv', (['"""MONGO... |
import unittest
from unittest.mock import (
AsyncMock,
call,
)
from uuid import (
uuid4,
)
from minos.saga import (
ConditionalSagaStepExecution,
LocalSagaStep,
LocalSagaStepExecution,
RemoteSagaStepExecution,
Saga,
SagaContext,
SagaExecution,
TransactionCommitter,
)
from te... | [
"unittest.main",
"minos.saga.LocalSagaStep",
"minos.saga.TransactionCommitter",
"uuid.uuid4",
"minos.saga.RemoteSagaStepExecution",
"minos.saga.Saga",
"unittest.mock.AsyncMock",
"minos.saga.ConditionalSagaStepExecution",
"minos.saga.SagaContext",
"minos.saga.LocalSagaStepExecution",
"unittest.mo... | [((4185, 4200), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4198, 4200), False, 'import unittest\n'), ((493, 500), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (498, 500), False, 'from uuid import uuid4\n'), ((560, 599), 'minos.saga.LocalSagaStep', 'LocalSagaStep', ([], {'on_execute': 'LocalSagaStep'}), '(on_execu... |
"""
:date_created: 2020-06-28
"""
from do_py.common import R
from do_py.data_object.restriction import ManagedRestrictions
from do_py.exceptions import RestrictionError
class ManagedList(ManagedRestrictions):
"""
Use this when you need a restriction for a list of DataObject's.
"""
_restriction = R(lis... | [
"do_py.exceptions.RestrictionError.bad_data"
] | [((1159, 1222), 'do_py.exceptions.RestrictionError.bad_data', 'RestrictionError.bad_data', (['self.data', 'self._restriction.allowed'], {}), '(self.data, self._restriction.allowed)\n', (1184, 1222), False, 'from do_py.exceptions import RestrictionError\n')] |
#!/usr/bin/env python3
import unittest
import networkx as nx
from Medusa.graphs import bfs
class TestBFS(unittest.TestCase):
def test_disconnected_graph(self):
G = nx.Graph()
node_list = ['A', 'B', 'C', 'D', 'E', 'F']
G.add_nodes_from(node_list)
self.assertEqual(list(G.nodes), node_... | [
"Medusa.graphs.bfs.breadth_first_search",
"networkx.Graph"
] | [((177, 187), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (185, 187), True, 'import networkx as nx\n'), ((334, 369), 'Medusa.graphs.bfs.breadth_first_search', 'bfs.breadth_first_search', (['G', '"""A"""', '(1)'], {}), "(G, 'A', 1)\n", (358, 369), False, 'from Medusa.graphs import bfs\n'), ((743, 753), 'networkx.Gra... |
'''
Tenor class
@author: <NAME>
@copyright: BG Research LLC, 2011
@modified: July 2012 to replace SWIG Quantlib bindings with pyQL Cython code.
'''
from datetime import date
from pybg.enums import TimeUnits
from pybg.quantlib.time.api import *
from pybg.ql import pydate_from_qldate, qldate_from_pydate
class Ten... | [
"pybg.ql.pydate_from_qldate",
"pybg.ql.qldate_from_pydate"
] | [((1632, 1658), 'pybg.ql.qldate_from_pydate', 'qldate_from_pydate', (['settle'], {}), '(settle)\n', (1650, 1658), False, 'from pybg.ql import pydate_from_qldate, qldate_from_pydate\n'), ((1678, 1706), 'pybg.ql.qldate_from_pydate', 'qldate_from_pydate', (['maturity'], {}), '(maturity)\n', (1696, 1706), False, 'from pybg... |
import unittest
from spn.algorithms.EM import EM_optimization
from spn.algorithms.Inference import log_likelihood
from spn.algorithms.LearningWrappers import learn_parametric, learn_mspn
from spn.gpu.TensorFlow import spn_to_tf_graph, eval_tf, likelihood_loss, tf_graph_to_spn
from spn.structure.Base import Context
fro... | [
"unittest.main",
"spn.algorithms.LearningWrappers.learn_parametric",
"numpy.random.seed",
"spn.algorithms.EM.EM_optimization",
"spn.algorithms.Inference.log_likelihood",
"numpy.array",
"numpy.random.normal",
"spn.structure.Base.Context"
] | [((1190, 1205), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1203, 1205), False, 'import unittest\n'), ((556, 574), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (570, 574), True, 'import numpy as np\n'), ((793, 894), 'spn.structure.Base.Context', 'Context', ([], {'meta_types': '([MetaType.RE... |
#!/usr/bin/env python3
import subprocess
try:
subprocess.call(["pyclean", ".."])
except:
print("error")
else:
print("*.pyc borrados")
| [
"subprocess.call"
] | [((50, 84), 'subprocess.call', 'subprocess.call', (["['pyclean', '..']"], {}), "(['pyclean', '..'])\n", (65, 84), False, 'import subprocess\n')] |
"""MobileAlerts internet gataway."""
from typing import Any, Awaitable, Callable, Dict, List, Optional
import asyncio
import logging
import socket
import struct
import time
from ipaddress import IPv4Address
import aiohttp
from multidict import CIMultiDictProxy
from yarl import URL
from .sensor import Sensor
_LOGGE... | [
"asyncio.get_event_loop",
"socket.socket",
"time.ctime",
"struct.pack",
"time.time",
"aiohttp.ClientSession",
"ipaddress.IPv4Address",
"logging.getLogger"
] | [((324, 351), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (341, 351), False, 'import logging\n'), ((2812, 2860), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (2825, 2860), False, 'import socket\n'), ((3353, 33... |
import os
import pytest
import torch
import torchvision
from flower_classifier.datasets.csv import CSVDataset
from flower_classifier.datasets.oxford_flowers import OxfordFlowers102Dataset, OxfordFlowersDataModule, split_dataset
from flower_classifier.datasets.random import RandomDataModule
from tests.datasets import ... | [
"os.path.join",
"torch.utils.data.DataLoader",
"flower_classifier.datasets.csv.CSVDataset",
"torchvision.transforms.Normalize",
"pytest.fixture",
"flower_classifier.datasets.random.RandomDataModule",
"flower_classifier.datasets.oxford_flowers.OxfordFlowers102Dataset",
"flower_classifier.datasets.oxfor... | [((338, 368), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (352, 368), False, 'import pytest\n'), ((753, 783), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (767, 783), False, 'import pytest\n'), ((938, 968), 'pytest.fixture', 'p... |
"""
Objective
In this challenge, we learn about Poisson distributions.
Task
A random variable, X, follows Poisson distribution with mean of 2.5.
Find the probability with which the random variable X is equal to 5.
"""
from math import exp, factorial
def poisson(lam=2.5, k=5):
"""
Return the probability of X=... | [
"math.exp",
"math.factorial"
] | [((398, 410), 'math.factorial', 'factorial', (['k'], {}), '(k)\n', (407, 410), False, 'from math import exp, factorial\n'), ((388, 397), 'math.exp', 'exp', (['(-lam)'], {}), '(-lam)\n', (391, 397), False, 'from math import exp, factorial\n')] |
"""Common utils for parsing and handling InferenceServices."""
import os
from kubeflow.kubeflow.crud_backend import api, helpers, logging
log = logging.getLogger(__name__)
KNATIVE_REVISION_LABEL = "serving.knative.dev/revision"
FILE_ABS_PATH = os.path.abspath(os.path.dirname(__file__))
INFERENCESERVICE_TEMPLATE_YAM... | [
"kubeflow.kubeflow.crud_backend.logging.getLogger",
"os.path.dirname",
"kubeflow.kubeflow.crud_backend.api.list_pods",
"os.path.join",
"kubeflow.kubeflow.crud_backend.helpers.load_param_yaml"
] | [((146, 173), 'kubeflow.kubeflow.crud_backend.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (163, 173), False, 'from kubeflow.kubeflow.crud_backend import api, helpers, logging\n'), ((324, 394), 'os.path.join', 'os.path.join', (['FILE_ABS_PATH', '"""yaml"""', '"""inference_service_templat... |
from note import Note
from majorScale import MajorScale
from minorScale import MinorScale
print("Hi welcome to my app.\n")
note = None
scale = None
while(True):
# if no scale is chosen
if scale is None:
# choose a note
if note is None:
note = input("Choose a note: ")
menu = (... | [
"majorScale.MajorScale",
"minorScale.MinorScale"
] | [((603, 619), 'majorScale.MajorScale', 'MajorScale', (['note'], {}), '(note)\n', (613, 619), False, 'from majorScale import MajorScale\n'), ((1182, 1202), 'minorScale.MinorScale', 'MinorScale', (['scale', '(1)'], {}), '(scale, 1)\n', (1192, 1202), False, 'from minorScale import MinorScale\n'), ((1792, 1812), 'majorScal... |
#this could be in a repo on its own should have used a
#obj oriented approach
"""manages GTK3 broadwayd displays
.. and to minimize bash scripting ugggh
usage:
>displynum, port =display.add()
>display.app('gedit',displaynum) #where gedit is a gtk3 app
you may want to set the limits after import
>import display
>di... | [
"atexit.register",
"psutil.process_iter",
"socket.socket",
"time.sleep"
] | [((6878, 6903), 'atexit.register', 'atexit.register', (['kill_all'], {}), '(kill_all)\n', (6893, 6903), False, 'import atexit\n'), ((896, 945), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (909, 945), False, 'import socket\n'), ((4958, 5007)... |
# //using pivot element and partition and merge sort basically
import random
def swap(A, i, j):
A[i], A[j] = A[j], A[i]
def partition(A, lo, hi):
pivot = A[lo]
i = lo + 1
j = hi
while True:
while A[i] < pivot:
i += 1
if i == hi:
break
while ... | [
"random.shuffle"
] | [((575, 592), 'random.shuffle', 'random.shuffle', (['A'], {}), '(A)\n', (589, 592), False, 'import random\n')] |
import os
print(os.name)
print(os.uname())
print(os.environ)
print(os.environ.get('PATH'))
p = os.path.join('.', 'test_dir')
print(p)
os.mkdir(p)
os.rmdir(p)
| [
"os.mkdir",
"os.uname",
"os.environ.get",
"os.rmdir",
"os.path.join"
] | [((98, 127), 'os.path.join', 'os.path.join', (['"""."""', '"""test_dir"""'], {}), "('.', 'test_dir')\n", (110, 127), False, 'import os\n'), ((137, 148), 'os.mkdir', 'os.mkdir', (['p'], {}), '(p)\n', (145, 148), False, 'import os\n'), ((149, 160), 'os.rmdir', 'os.rmdir', (['p'], {}), '(p)\n', (157, 160), False, 'import ... |
import os, subprocess
def execute_shell_process(message, command):
print(message)
env_copy = os.environ.copy()
output = subprocess.run(command, env=env_copy, shell=True)
if output.returncode == 0:
print("Success!")
else:
print("Oops! Please try again.") | [
"subprocess.run",
"os.environ.copy"
] | [((103, 120), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (118, 120), False, 'import os, subprocess\n'), ((134, 183), 'subprocess.run', 'subprocess.run', (['command'], {'env': 'env_copy', 'shell': '(True)'}), '(command, env=env_copy, shell=True)\n', (148, 183), False, 'import os, subprocess\n')] |
from unittest import TestCase
from jsonconf import CommandLineParser
class ConfigTests(TestCase):
def setUp(self):
pass
def test_constructor(self):
parser = CommandLineParser()
self.assertTrue(parser is not None)
self.assertEqual(parser.getKeywordArguments(), {})
self... | [
"jsonconf.CommandLineParser"
] | [((185, 204), 'jsonconf.CommandLineParser', 'CommandLineParser', ([], {}), '()\n', (202, 204), False, 'from jsonconf import CommandLineParser\n'), ((483, 502), 'jsonconf.CommandLineParser', 'CommandLineParser', ([], {}), '()\n', (500, 502), False, 'from jsonconf import CommandLineParser\n'), ((784, 803), 'jsonconf.Comm... |
import unittest
import pydictionaria.sfm2cldf as s
import clldutils.sfm as sfm
class SplitMarkersWithSeparators(unittest.TestCase):
def test_lump_everything_together_if_seperator_isnt_found(self):
sep = 'sep'
input_markers = [
('marker1', 'value1'),
('marker2', 'value2')]
... | [
"pydictionaria.sfm2cldf.LinkProcessor",
"pydictionaria.sfm2cldf.sfm_entry_to_cldf_row",
"pydictionaria.sfm2cldf.split_by_pred",
"clldutils.sfm.Entry",
"pydictionaria.sfm2cldf.IDGenerator",
"pydictionaria.sfm2cldf.group_by_separator",
"pydictionaria.sfm2cldf.CaptionFinder"
] | [((11518, 11549), 'clldutils.sfm.Entry', 'sfm.Entry', (["[('ge', 'abc\\tdef')]"], {}), "([('ge', 'abc\\tdef')])\n", (11527, 11549), True, 'import clldutils.sfm as sfm\n'), ((11851, 11899), 'clldutils.sfm.Entry', 'sfm.Entry', (["[('cf', 'val1'), ('cf', 'val2;val3')]"], {}), "([('cf', 'val1'), ('cf', 'val2;val3')])\n", (... |
##-------------------------------------------
## 2 VARIABLE NORMAL DISTIBUTION
##-------------------------------------------
import matplotlib.pyplot as plt
import numpy as np
#USER INPUTS
FUNC=2
FS=18 #FONT SIZE
CMAP='hsv' #'RdYlBu'
#normal distribution param
ux=0.5; uy=0.0
sx=2.0; sy=1.0 #STD-DEV
rho=0.5... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((364, 386), 'numpy.array', 'np.array', (['[[ux], [uy]]'], {}), '([[ux], [uy]])\n', (372, 386), True, 'import numpy as np\n'), ((417, 483), 'numpy.array', 'np.array', (['[[sx ** 2.0, rho * sy * sx], [rho * sy * sx, sy ** 2.0]]'], {}), '([[sx ** 2.0, rho * sy * sx], [rho * sy * sx, sy ** 2.0]])\n', (425, 483), True, 'i... |
"""Unit tests for reviewboard.extensions.hooks.FileDiffACLHook."""
import kgb
from djblets.features.testing import override_feature_check
from reviewboard.extensions.hooks import FileDiffACLHook
from reviewboard.extensions.tests.testcases import BaseExtensionHookTestCase
from reviewboard.reviews.features import DiffA... | [
"reviewboard.extensions.hooks.FileDiffACLHook",
"kgb.SpyOpReturn",
"djblets.features.testing.override_feature_check"
] | [((2345, 2409), 'djblets.features.testing.override_feature_check', 'override_feature_check', (['DiffACLsFeature.feature_id'], {'enabled': '(True)'}), '(DiffACLsFeature.feature_id, enabled=True)\n', (2367, 2409), False, 'from djblets.features.testing import override_feature_check\n'), ((2514, 2555), 'reviewboard.extensi... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import pytorch_lightning as pl
from torchsummaryX import summary
from torch.nn.utils import weight_norm, remove_weight_norm
from utils import get_padding, get_conv1d_outlen, init_weights, get_padding_down, get_padding_up,walk_ratent_space
from typing im... | [
"numpy.random.seed",
"torch.sqrt",
"torch.cat",
"torch.randn",
"utils.get_padding",
"matplotlib.pyplot.figure",
"torch.rand_like",
"utils.load_config",
"torch.nn.functional.leaky_relu",
"torchsummaryX.summary",
"torch.no_grad",
"utils.walk_ratent_space",
"torch.nn.MSELoss",
"torch.nn.Conv1... | [((11251, 11266), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (11264, 11266), False, 'import torch\n'), ((14800, 14834), 'utils.load_config', 'load_config', (['"""hparams/origin.json"""'], {}), "('hparams/origin.json')\n", (14811, 14834), False, 'from utils import load_config\n'), ((3380, 3395), 'torch.nn.Modul... |
"""Perceptron implementation for apprenticeship learning in pacman.
Author: <NAME>, <NAME>, and <NAME>
Class: CSI-480-01
Assignment: PA 5 -- Supervised Learning
Due Date: Nov 30, 2018 11:59 PM
Certification of Authenticity:
I certify that this is entirely my own work, except where I have given
fully-documented refere... | [
"util.Counter"
] | [((2037, 2051), 'util.Counter', 'util.Counter', ([], {}), '()\n', (2049, 2051), False, 'import util\n'), ((2407, 2421), 'util.Counter', 'util.Counter', ([], {}), '()\n', (2419, 2421), False, 'import util\n')] |
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
Created on Tue Oct 6 16:23:04 2020
@author: Admin
"""
import numpy as np
import pandas as pd
import math
import os
from keras.layers import Dense
from keras.layers import LSTM
from keras.optimizers import Adam
from sklearn.preprocessing i... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"os.getcwd",
"keras.layers.LSTM",
"sklearn.preprocessing.MinMaxScaler",
"keras.optimizers.Adam",
"numpy.empty_like",
"keras.layers.Dense",
"numpy.array",
"numpy.reshape",
"keras.models.Sequential",
"sklearn.metrics.mean_s... | [((587, 638), 'pandas.read_csv', 'pd.read_csv', (['filepath'], {'usecols': '[1]', 'engine': '"""python"""'}), "(filepath, usecols=[1], engine='python')\n", (598, 638), True, 'import pandas as pd\n'), ((901, 942), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': 'feature_range'}), '(feature_r... |
from django.contrib import admin
from .models import Thread, Reply
class ThreadAdmin(admin.ModelAdmin):
list_display = ['title', 'author', 'created', 'modifield']
search_fields = ['title', 'author__email', 'body']
prepopulated_fields = {'slug':('title',)}
class ReplyAdmin(admin.ModelAdmin):
list... | [
"django.contrib.admin.site.register"
] | [((442, 482), 'django.contrib.admin.site.register', 'admin.site.register', (['Thread', 'ThreadAdmin'], {}), '(Thread, ThreadAdmin)\n', (461, 482), False, 'from django.contrib import admin\n'), ((482, 520), 'django.contrib.admin.site.register', 'admin.site.register', (['Reply', 'ReplyAdmin'], {}), '(Reply, ReplyAdmin)\n... |
#!/usr/bin/env python3
import sys
import json
# add parent directory
sys.path.append(".")
from utils import get
from digital_land_frontend.render import wkt_to_json_geometry
sample_file = "docs/brownfield-land/organisation/local-authority-eng/HAG/sites.json"
def create_feature_collection(features):
return {"t... | [
"sys.path.append",
"json.load",
"digital_land_frontend.render.wkt_to_json_geometry",
"json.dumps"
] | [((71, 91), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (86, 91), False, 'import sys\n'), ((525, 559), 'digital_land_frontend.render.wkt_to_json_geometry', 'wkt_to_json_geometry', (["row['point']"], {}), "(row['point'])\n", (545, 559), False, 'from digital_land_frontend.render import wkt_to_json... |
from bsbetl import ov_helpers
import logging
import math
from datetime import date, datetime
from numpy.core.numeric import NaN
from pandas.core.indexes.base import Index
import pandas as pd
from bsbetl.alltable_calcs import Calculation
from bsbetl.alltable_calcs.at_params import at_calc_params
from bsbetl.calc_helper... | [
"logging.error",
"bsbetl.ov_helpers.global_ov_update",
"bsbetl.calc_helpers.between_dates_condition"
] | [((10764, 10850), 'bsbetl.ov_helpers.global_ov_update', 'ov_helpers.global_ov_update', (['share_num', '"""SDVBf.D-1"""', "df.loc[df.index[-2], 'SDVBf']"], {}), "(share_num, 'SDVBf.D-1', df.loc[df.index[-2],\n 'SDVBf'])\n", (10791, 10850), False, 'from bsbetl import ov_helpers\n'), ((10858, 10944), 'bsbetl.ov_helpers... |
__all__ = [
"make_mrcnn",
"mrcnn",
]
import torch
from torchvision.models.detection import MaskRCNN, maskrcnn_resnet50_fpn
from torchvision.models.detection.backbone_utils import resnet_fpn_backbone
from torchvision.models.detection.rpn import AnchorGenerator
from torchvision.models.detection.transform import ... | [
"torch.nn.Conv2d",
"torchvision.models.detection.rpn.AnchorGenerator",
"torchvision.models.detection.maskrcnn_resnet50_fpn",
"torchvision.models.detection.transform.GeneralizedRCNNTransform",
"torchvision.models.detection.backbone_utils.resnet_fpn_backbone",
"torchvision.models.detection.MaskRCNN"
] | [((377, 472), 'torchvision.models.detection.maskrcnn_resnet50_fpn', 'maskrcnn_resnet50_fpn', ([], {'num_classes': '(2)', 'pretrained_backbone': '(True)', 'trainable_backbone_layers': '(5)'}), '(num_classes=2, pretrained_backbone=True,\n trainable_backbone_layers=5)\n', (398, 472), False, 'from torchvision.models.det... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import threading
mu = threading.Lock()
def create_sql_file():
open('sql.txt', 'w+', encoding='utf-8')
def lock_test(sql):
if mu.acquire(True):
write_to_file(sql)
mu.release()
def write_to_file(sql):
fp = open('sql.txt', 'a+')
print('wri... | [
"threading.Lock"
] | [((68, 84), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (82, 84), False, 'import threading\n')] |
"""Outgoing SMS API."""
import logging
import pkg_resources
from pyramid.renderers import render
from pyramid.settings import asbool
from pyramid_sms.utils import get_sms_backend
try:
pkg_resources.get_distribution('websauna')
from websauna.system.http import Request
from websauna.system.task.tasks impor... | [
"pkg_resources.get_distribution",
"websauna.system.task.tasks.task",
"pyramid_sms.utils.get_sms_backend",
"pyramid.settings.asbool",
"pyramid.renderers.render",
"logging.getLogger"
] | [((610, 637), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (627, 637), False, 'import logging\n'), ((191, 233), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""websauna"""'], {}), "('websauna')\n", (221, 233), False, 'import pkg_resources\n'), ((798, 822), 'pyr... |
import torch
from torch import nn
import torch.nn.functional as F
import pytorch_lightning as pl
import kornia
from .voxelmorph2d import VxmDense,NCC,Grad,Dice
from monai.losses import BendingEnergyLoss,GlobalMutualInformationLoss,DiceLoss,LocalNormalizedCrossCorrelationLoss
from kornia.filters import sobel, gaussian_b... | [
"torch.ones",
"torch.stack",
"kornia.filters.canny",
"kornia.enhance.normalize_min_max",
"torch.log",
"torch.argmax",
"torch.nn.ParameterDict",
"monai.losses.BendingEnergyLoss",
"monai.losses.GlobalMutualInformationLoss",
"torch.set_grad_enabled",
"monai.losses.DiceLoss",
"torch.clone"
] | [((5969, 5994), 'kornia.filters.canny', 'canny', (['moved_mask[:, 1:2]'], {}), '(moved_mask[:, 1:2])\n', (5974, 5994), False, 'from kornia.filters import sobel, gaussian_blur2d, canny, spatial_gradient\n'), ((6356, 6378), 'torch.stack', 'torch.stack', (['[y, x, x]'], {}), '([y, x, x])\n', (6367, 6378), False, 'import t... |
# This file is part of GenMap and released under the MIT License, see LICENSE.
# Author: <NAME>
from EvalBase import EvalBase
import networkx as nx
import os
import signal
import math
main_pid = os.getpid()
class MapHeightEval(EvalBase):
def __init__(self):
pass
@staticmethod
def eval(CGRA, ap... | [
"os.kill",
"os.getpid",
"math.ceil"
] | [((199, 210), 'os.getpid', 'os.getpid', ([], {}), '()\n', (208, 210), False, 'import os\n'), ((2194, 2227), 'os.kill', 'os.kill', (['main_pid', 'signal.SIGUSR1'], {}), '(main_pid, signal.SIGUSR1)\n', (2201, 2227), False, 'import os\n'), ((1929, 1972), 'math.ceil', 'math.ceil', (['((input_count + output_count) / 2)'], {... |
"""
Coauthors: <NAME>
<NAME>
"""
from toolbox import *
import argparse
import random
from sklearn.ensemble import RandomForestClassifier
import torchvision.models as models
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from sklearn.model_selection import ParameterSampl... | [
"sklearn.ensemble.RandomForestClassifier",
"json.dump",
"torchvision.models.resnet18",
"argparse.ArgumentParser",
"random.shuffle",
"torchvision.datasets.CIFAR10",
"sklearn.model_selection.ParameterSampler",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((10251, 10276), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (10274, 10276), False, 'import argparse\n'), ((10513, 10533), 'random.shuffle', 'random.shuffle', (['nums'], {}), '(nums)\n', (10527, 10533), False, 'import random\n'), ((10734, 10804), 'torchvision.datasets.CIFAR10', 'datasets.CI... |
from typing import Dict
from pathlib import Path
from discord.ext import commands
from ..config import MAIN_DB
from .db import DatabaseConnection
# Maybe this is a little clumsy?
_CONNECTIONS: Dict[str, DatabaseConnection] = {}
def add_db(path: str, bot: commands.Bot) -> DatabaseConnection:
if path not in _CON... | [
"pathlib.Path"
] | [((560, 573), 'pathlib.Path', 'Path', (['MAIN_DB'], {}), '(MAIN_DB)\n', (564, 573), False, 'from pathlib import Path\n')] |
#!/usr/bin/env python3
import sys
import graphyte
import requests
def get_orgs():
with requests.get("https://codein.withgoogle.com/api/program/current/organization/") as resp:
if resp.status_code != 200:
print(f"Received status code {resp.status_code}: {resp.text}")
exit(1)
... | [
"graphyte.send",
"graphyte.init",
"requests.get"
] | [((94, 173), 'requests.get', 'requests.get', (['"""https://codein.withgoogle.com/api/program/current/organization/"""'], {}), "('https://codein.withgoogle.com/api/program/current/organization/')\n", (106, 173), False, 'import requests\n'), ((527, 579), 'graphyte.send', 'graphyte.send', (['f"""{name_base}.tasks_complete... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist, squareform
from scipy.cluster.hierarchy import linkage, dendrogram
from sklearn.cluster import AgglomerativeClustering
# # Organizing clusters as a hierarchical tree
# ## Grouping clusters in bottom-up fas... | [
"pandas.DataFrame",
"numpy.random.seed",
"matplotlib.pyplot.show",
"numpy.random.random_sample",
"scipy.cluster.hierarchy.linkage",
"matplotlib.pyplot.figure",
"sklearn.cluster.AgglomerativeClustering",
"scipy.spatial.distance.pdist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.tight_layout",
... | [((326, 345), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (340, 345), True, 'import numpy as np\n'), ((470, 518), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': 'variables', 'index': 'labels'}), '(X, columns=variables, index=labels)\n', (482, 518), True, 'import pandas as pd\n'), ((1898,... |
# coding=UTF-8
# ex:ts=4:sw=4:et
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
from mvc.support.utils import get_new_uuid
__all__ = [
"gobject",
"GtkTreeIter",
"GenericTreeModel"
"TREE_MODEL_LIST_ONLY"
]
TREE_MODEL_LIST_ONLY = 0x00
TREE_MOD... | [
"mvc.support.utils.get_new_uuid"
] | [((804, 818), 'mvc.support.utils.get_new_uuid', 'get_new_uuid', ([], {}), '()\n', (816, 818), False, 'from mvc.support.utils import get_new_uuid\n')] |
# Random Pick with Weight: https://leetcode.com/problems/random-pick-with-weight/
# You are given an array of positive integers w where w[i] describes the weight of ith index (0-indexed).
# We need to call the function pickIndex() which randomly returns an integer in the range [0, w.length - 1]. pickIndex() should ret... | [
"random"
] | [((1099, 1107), 'random', 'random', ([], {}), '()\n', (1105, 1107), False, 'import random\n'), ((1639, 1647), 'random', 'random', ([], {}), '()\n', (1645, 1647), False, 'import random\n')] |
from django.forms import BooleanField, ModelForm
from tree.forms import TreeChoiceField
from .models import DossierDEvenements
class DossierDEvenementsForm(ModelForm):
statique = BooleanField(required=False)
class Meta(object):
model = DossierDEvenements
exclude = ()
field_classes = ... | [
"django.forms.BooleanField"
] | [((186, 214), 'django.forms.BooleanField', 'BooleanField', ([], {'required': '(False)'}), '(required=False)\n', (198, 214), False, 'from django.forms import BooleanField, ModelForm\n')] |
import random
import time
n = 10000000
random_list = random.sample(range(n * 10), n)
start = time.time()
median = sorted(random_list, reverse=True)[n // 2]
end = time.time()
print(median)
print(end - start)
| [
"time.time"
] | [((95, 106), 'time.time', 'time.time', ([], {}), '()\n', (104, 106), False, 'import time\n'), ((164, 175), 'time.time', 'time.time', ([], {}), '()\n', (173, 175), False, 'import time\n')] |
#!/usr/bin/env python3
import pandas as pd
dataset = pd.read_csv('Dataset.csv')
dataset.to_csv('Dataset.csv', index=False)
| [
"pandas.read_csv"
] | [((55, 81), 'pandas.read_csv', 'pd.read_csv', (['"""Dataset.csv"""'], {}), "('Dataset.csv')\n", (66, 81), True, 'import pandas as pd\n')] |
import scrapy
class CompaniesSpider(scrapy.Spider):
"""This spider wil crawl all the company link available in itviec and save it
to a json line file.
"""
name = "companies"
start_urls = [
'https://itviec.com/companies',
]
def parse(self, response):
all_compan... | [
"scrapy.Request"
] | [((1037, 1083), 'scrapy.Request', 'scrapy.Request', (['next_page'], {'callback': 'self.parse'}), '(next_page, callback=self.parse)\n', (1051, 1083), False, 'import scrapy\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 15:19:55 2020
@author: mi19356
"""
import numpy as np
import os
import pandas as pd
from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree
import random
import math
from scrape import vtk_scrap
from dataconversions import data_reco... | [
"dataconversions.data_reconstruct_dream",
"random.uniform",
"dataconversions.printtofiletext",
"xml.etree.ElementTree.Element",
"dataconversions.data_reconstruct",
"xml.etree.ElementTree.Comment",
"numpy.sin",
"numpy.cos",
"xml.etree.ElementTree.SubElement",
"numpy.dot",
"scrape.vtk_scrap",
"x... | [((547, 591), 'scrape.vtk_scrap', 'vtk_scrap', (['"""PF_00130000"""', '"""graindata"""', 'dream'], {}), "('PF_00130000', 'graindata', dream)\n", (556, 591), False, 'from scrape import vtk_scrap\n'), ((605, 655), 'dataconversions.data_reconstruct', 'data_reconstruct', (['vtkdata', 'vtkdataPoints', '(1)', 'orien'], {}), ... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.template import loader
from django.shortcuts import render
from django.http import Http404
# Create your views here.
def index(request):
return render(request=request, template_name='homepage.html')
| [
"django.shortcuts.render"
] | [((255, 309), 'django.shortcuts.render', 'render', ([], {'request': 'request', 'template_name': '"""homepage.html"""'}), "(request=request, template_name='homepage.html')\n", (261, 309), False, 'from django.shortcuts import render\n')] |
#!/usr/bin/env python
"""Tests for `acdh_geonames_utils` package."""
import os
import unittest
from click.testing import CliRunner
from acdh_geonames_utils import acdh_geonames_utils as gn
from acdh_geonames_utils import cli
good_country_code = 'YU'
bad_country_code = 'BAAAD'
good_ft_code = "en"
bad_ft_code = "de"... | [
"acdh_geonames_utils.acdh_geonames_utils.download_country_zip",
"acdh_geonames_utils.acdh_geonames_utils.download_and_unzip_country_zip",
"acdh_geonames_utils.acdh_geonames_utils.dl_feature_codes",
"acdh_geonames_utils.acdh_geonames_utils.countries_as_df",
"acdh_geonames_utils.acdh_geonames_utils.download_t... | [((337, 373), 'os.path.join', 'os.path.join', (['"""./fixtures"""', '"""AL.txt"""'], {}), "('./fixtures', 'AL.txt')\n", (349, 373), False, 'import os\n'), ((710, 752), 'acdh_geonames_utils.acdh_geonames_utils.download_country_zip', 'gn.download_country_zip', (['good_country_code'], {}), '(good_country_code)\n', (733, 7... |
# Generated by Django 3.2.1 on 2021-08-08 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('admin_panel', '0016_wish_list'),
]
operations = [
migrations.AddField(
model_name='wish_list',
name='is_wished',
... | [
"django.db.models.BooleanField"
] | [((335, 369), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (354, 369), False, 'from django.db import migrations, models\n')] |
"""
Use this script to post-process the predicted softmax segmentation.
This script performs rigid register of the softmax prediction to the subject space.
@author: <NAME> (<EMAIL>)
"""
import os
from argparse import ArgumentParser
import numpy as np
import nibabel as nib
parser = ArgumentParser()
parser.add_argumen... | [
"nibabel.Nifti1Image",
"os.mkdir",
"numpy.sum",
"argparse.ArgumentParser",
"nibabel.load",
"os.path.exists",
"os.system",
"nibabel.save",
"os.path.split",
"os.path.join"
] | [((285, 301), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (299, 301), False, 'from argparse import ArgumentParser\n'), ((982, 1031), 'os.path.join', 'os.path.join', (['output_dir', "('%s_inv.txt' % aff_name)"], {}), "(output_dir, '%s_inv.txt' % aff_name)\n", (994, 1031), False, 'import os\n'), ((1131... |
"""A minimal sample script for illustration of basic usage of NCE module"""
import torch
from nce import IndexLinear
class_freq = [0, 2, 2, 3, 4, 5, 6] # an unigram class probability
freq_count = torch.FloatTensor(class_freq)
print("total counts for all tokens:", freq_count.sum())
noise = freq_count / freq_count.sum... | [
"torch.ones",
"torch.Tensor",
"torch.FloatTensor",
"nce.IndexLinear"
] | [((199, 228), 'torch.FloatTensor', 'torch.FloatTensor', (['class_freq'], {}), '(class_freq)\n', (216, 228), False, 'import torch\n'), ((364, 427), 'nce.IndexLinear', 'IndexLinear', ([], {'embedding_dim': '(100)', 'num_classes': '(300000)', 'noise': 'noise'}), '(embedding_dim=100, num_classes=300000, noise=noise)\n', (3... |
"""this file is aimed to generate a small datasets for test"""
import json
f = open("/home/ayb/UVM_Datasets/voc_test3.json", "r")
line = f.readline()
f.close()
dic = eval(line)
images = dic['images']
new_images=[]
for image in images:
if "ten" in image['file_name']:
continue
else:
new_images.ap... | [
"json.dumps"
] | [((732, 747), 'json.dumps', 'json.dumps', (['dic'], {}), '(dic)\n', (742, 747), False, 'import json\n')] |
import os
from flask import Flask, g
from flask_sijax import sijax
path = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax/')
app = Flask(__name__)
app.config['SIJAX_STATIC_PATH'] = path
app.config['SIJAX_JSON_URI'] = '/static/js/sijax/json2.js'
flask_sijax.Sijax(app)
@app.route('/')
def ind... | [
"os.path.dirname",
"flask.Flask",
"flask.g.sijax.register_callback",
"flask.g.sijax.process_request"
] | [((151, 166), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (156, 166), False, 'from flask import Flask, g\n'), ((97, 122), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (112, 122), False, 'import os\n'), ((506, 549), 'flask.g.sijax.register_callback', 'g.sijax.register_callbac... |
import re
import sys
from wtforms.form import FormMeta
class WTFormsDynamicFields():
""" Add dynamic (set) fields to a WTForm.
Instantiating this class will merely create a configuration
dictionary on which you can add fields and validators using
the designated methods "add_field" and "add_validat... | [
"re.compile"
] | [((4393, 4428), 're.compile', 're.compile', (['"""\\\\%([a-zA-Z0-9_]*)\\\\%"""'], {}), "('\\\\%([a-zA-Z0-9_]*)\\\\%')\n", (4403, 4428), False, 'import re\n')] |
""" Construct dataset """
import sys
import math
import pandas as pd
import numpy as np
import csv
def calc_gaps(station):
"""Calculate gaps in time series"""
df = pd.read_csv('../data/all_clean/{0}-clean.txt'.format(station), parse_dates=['Date'])
df = df.set_index(['Date'])
df.index = pd.to_datetim... | [
"numpy.timedelta64",
"pandas.to_datetime",
"math.floor"
] | [((307, 331), 'pandas.to_datetime', 'pd.to_datetime', (['df.index'], {}), '(df.index)\n', (321, 331), True, 'import pandas as pd\n'), ((1041, 1083), 'math.floor', 'math.floor', (['(total_gap / 3600 / 24 / 365.25)'], {}), '(total_gap / 3600 / 24 / 365.25)\n', (1051, 1083), False, 'import math\n'), ((1095, 1137), 'math.f... |
from app import app, socketio
if __name__ == '__main__':
app.jinja_env.auto_reload = True
app.config['TEMPLATES_AUTO_RELOAD'] = True
socketio.run(app)
| [
"app.socketio.run"
] | [((146, 163), 'app.socketio.run', 'socketio.run', (['app'], {}), '(app)\n', (158, 163), False, 'from app import app, socketio\n')] |
import numpy as np
import matplotlib.pyplot as plt
import keras
import keras.layers as klayers
import time_series as tsutils
import processing
import metrics
class ModelBase(object):
# Required 'context' information for a model
input_window = None
# How many point the model can predict for a single give... | [
"time_series.free_run_batch",
"processing.StandardScaler",
"keras.Sequential",
"keras.layers.Flatten",
"numpy.genfromtxt",
"keras.layers.Conv1D",
"metrics.evaluate",
"keras.layers.Dense",
"numpy.squeeze"
] | [((1529, 1548), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {}), '(path)\n', (1542, 1548), True, 'import numpy as np\n'), ((2123, 2199), 'time_series.free_run_batch', 'tsutils.free_run_batch', (['model.predict', 'ctx', 'predict_points', 'ts'], {'batch_size': '(1)'}), '(model.predict, ctx, predict_points, ts, batch_... |
"""
Contains styling utilities for tkinter widgets.
Some features include:
- a hierarchical styling system for the non-ttk widgets;
- a collection of colour constants;
- and reasonable cross-platform named fonts.
"""
import tkinter as tk
import tkinter.font as tkfont
from contextlib import contextmanager
# Co... | [
"tkinter.font.Font"
] | [((22063, 22160), 'tkinter.font.Font', 'tkfont.Font', (['root'], {'size': '(10)', 'name': '"""FONT_MONOSPACE_TITLE"""', 'family': '"""Courier"""', 'weight': 'tkfont.BOLD'}), "(root, size=10, name='FONT_MONOSPACE_TITLE', family='Courier',\n weight=tkfont.BOLD)\n", (22074, 22160), True, 'import tkinter.font as tkfont\... |
import re
from bson.regex import Regex
def test_qop_not_1(monty_find, mongo_find):
docs = [
{"a": 4},
{"x": 8}
]
spec = {"a": {"$not": {"$eq": 8}}}
monty_c = monty_find(docs, spec)
mongo_c = mongo_find(docs, spec)
assert mongo_c.count() == 2
assert monty_c.count() == mon... | [
"bson.regex.Regex",
"re.compile"
] | [((1042, 1053), 'bson.regex.Regex', 'Regex', (['"""^a"""'], {}), "('^a')\n", (1047, 1053), False, 'from bson.regex import Regex\n'), ((1350, 1366), 're.compile', 're.compile', (['"""^a"""'], {}), "('^a')\n", (1360, 1366), False, 'import re\n')] |
import asar
from rom import Rom
from patchexception import PatchException
import os
import re
class Routine:
incsrc = 'incsrc global_ow_code/defines.asm\nfreecode cleaned\n'
def __init__(self, file):
self.path = file
self.ptr = None
self.name = re.findall(r'\w+\.asm', file)[-1].replac... | [
"os.remove",
"asar.geterrors",
"asar.patch",
"patchexception.PatchException",
"re.findall",
"asar.getprints"
] | [((838, 882), 'asar.patch', 'asar.patch', (['f"""tmp_{self.name}.asm"""', 'rom.data'], {}), "(f'tmp_{self.name}.asm', rom.data)\n", (848, 882), False, 'import asar\n'), ((1217, 1250), 'os.remove', 'os.remove', (['f"""tmp_{self.name}.asm"""'], {}), "(f'tmp_{self.name}.asm')\n", (1226, 1250), False, 'import os\n'), ((954... |
from pathlib import Path
import aku
from torch import nn, optim
from houttuynia.monitors import get_monitor
from houttuynia.schedules import EpochalSchedule
from houttuynia.nn import Classifier
from houttuynia import log_system, manual_seed, to_device
from houttuynia.datasets import prepare_iris_dataset
from houttuyn... | [
"torch.nn.Dropout",
"houttuynia.to_device",
"houttuynia.extensions.CommitScalarByMean",
"houttuynia.triggers.Periodic",
"houttuynia.monitors.get_monitor",
"houttuynia.schedules.EpochalSchedule",
"houttuynia.manual_seed",
"houttuynia.extensions.ClipGradNorm",
"torch.nn.Linear",
"pathlib.Path",
"a... | [((1393, 1410), 'aku.App', 'aku.App', (['__file__'], {}), '(__file__)\n', (1400, 1410), False, 'import aku\n'), ((1663, 1681), 'pathlib.Path', 'Path', (['"""../out_dir"""'], {}), "('../out_dir')\n", (1667, 1681), False, 'from pathlib import Path\n'), ((2303, 2336), 'houttuynia.utils.ensure_output_dir', 'ensure_output_d... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import json
import tensorflow as tf
import util
import json
except_name = ["公司", "本公司", "该公司", "贵公司", "贵司", "本行", "该行", "本银行", "该集团", "本集团", "集团",
"它", "他们", "他们", "我们", "该股", "其", ... | [
"json.loads",
"tensorflow.train.Saver",
"tensorflow.Session",
"json.dumps",
"util.get_model",
"util.initialize_from_env"
] | [((3660, 3686), 'util.initialize_from_env', 'util.initialize_from_env', ([], {}), '()\n', (3684, 3686), False, 'import util\n'), ((3938, 3960), 'util.get_model', 'util.get_model', (['config'], {}), '(config)\n', (3952, 3960), False, 'import util\n'), ((3973, 3989), 'tensorflow.train.Saver', 'tf.train.Saver', ([], {}), ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility methods related to folders
"""
from __future__ import print_function, division, absolute_import
import os
import sys
import time
import errno
import shutil
import fnmatch
import logging
import tempfile
import traceback
import subprocess
from distutils.dir_... | [
"shutil.ignore_patterns",
"os.remove",
"tpDcc.libs.python.path.is_dir",
"tpDcc.libs.python.osplatform.is_windows",
"os.walk",
"tpDcc.libs.python.path.clean_path",
"shutil.rmtree",
"tpDcc.libs.python.name.clean_file_string",
"os.path.join",
"subprocess.check_call",
"os.path.abspath",
"tpDcc.lib... | [((352, 390), 'logging.getLogger', 'logging.getLogger', (['"""tpDcc-libs-python"""'], {}), "('tpDcc-libs-python')\n", (369, 390), False, 'import logging\n'), ((1238, 1260), 'tpDcc.libs.python.path.is_dir', 'path.is_dir', (['full_path'], {}), '(full_path)\n', (1249, 1260), False, 'from tpDcc.libs.python import path\n'),... |
import bisect
import operator
import numpy as np
import torch
from torch.utils import data
from multilayer_perceptron import *
from utils import *
def preprocess_weights(weights):
w_later = np.abs(weights[-1])
w_input = np.abs(weights[0])
for i in range(len(weights) - 2, 0, -1):
w_later = np.matm... | [
"numpy.minimum",
"numpy.abs",
"numpy.sum",
"numpy.array",
"torch.device",
"operator.itemgetter",
"bisect.insort"
] | [((196, 215), 'numpy.abs', 'np.abs', (['weights[-1]'], {}), '(weights[-1])\n', (202, 215), True, 'import numpy as np\n'), ((230, 248), 'numpy.abs', 'np.abs', (['weights[0]'], {}), '(weights[0])\n', (236, 248), True, 'import numpy as np\n'), ((3519, 3538), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n"... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2019 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
from __future__ import absolute_import, unicode_literals
from datetime import datetime, timedelta
from... | [
"datetime.timedelta",
"datetime.datetime"
] | [((2590, 2623), 'datetime.datetime', 'datetime', (['(2015)', '(12)', '(23)', '(8)', '(14)', '(12)'], {}), '(2015, 12, 23, 8, 14, 12)\n', (2598, 2623), False, 'from datetime import datetime, timedelta\n'), ((2643, 2664), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(10)'}), '(seconds=10)\n', (2652, 2664), False,... |
from django.db import models
from account.models import Country
from django.contrib import admin
grad_streams_list = [
'Engineering',
'Law',
'Medicine',
'Business',
]
grad_streams = (
('Engineering', 'Engineering'),
('Law', 'Law'),
('Medicine', 'Medicine'),
('Business', 'Business'),
)... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.SlugField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((362, 418), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': 'None', 'null': '(True)', 'blank': '(True)'}), '(default=None, null=True, blank=True)\n', (381, 418), False, 'from django.db import models\n'), ((433, 489), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': 'No... |
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import OneHotEncoder
import keras
from keras import backend as K
from keras.models import Sequential
from keras.layers import Activation
from keras.layers.core import Dense
from keras.optimizers import Adam... | [
"keras.layers.core.Dense",
"pandas.read_csv",
"numpy.savetxt",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.preprocessing.OneHotEncoder",
"keras.optimizers.Adam"
] | [((826, 860), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (838, 860), False, 'from sklearn.preprocessing import MinMaxScaler\n'), ((1008, 1040), 'sklearn.preprocessing.OneHotEncoder', 'OneHotEncoder', ([], {'categories': '"""auto"""'}), "(categori... |
###################################################
## ##
## This file is part of the KinBot code v2.0 ##
## ##
## The contents are covered by the terms of the ##
## BSD 3-clause license included in the LICENSE ##
## file,... | [
"xml.dom.minidom.parseString",
"random.uniform",
"xml.etree.cElementTree.tostring",
"xml.etree.cElementTree.Element",
"xml.etree.cElementTree.SubElement"
] | [((1131, 1314), 'xml.etree.cElementTree.Element', 'ET.Element', (['"""me:mesmer"""', "{'xmlns': 'http://www.xml-cml.org/schema', 'xmlns:me':\n 'http://www.chem.leeds.ac.uk/mesmer', 'xmlns:xsi':\n 'http://www.w3.org/2001/XMLSchema-instance'}"], {}), "('me:mesmer', {'xmlns': 'http://www.xml-cml.org/schema',\n 'x... |
r'''This dataloader is an attemp to make a master DL that provides 2 augmented version
of a sparse clip (covering minimum 64 frames) and 2 augmented versions of 4 dense clips
(covering 16 frames temporal span minimum)'''
import os
import torch
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data imp... | [
"torchvision.transforms.functional.to_tensor",
"random.shuffle",
"torchvision.transforms.functional.adjust_saturation",
"numpy.random.randint",
"os.path.join",
"torch.utils.data.DataLoader",
"torchvision.transforms.functional.hflip",
"torchvision.transforms.ToPILImage",
"torchvision.transforms.funct... | [((16132, 16163), 'torch.stack', 'torch.stack', (['sparse_clip'], {'dim': '(0)'}), '(sparse_clip, dim=0)\n', (16143, 16163), False, 'import torch\n'), ((16182, 16213), 'torch.stack', 'torch.stack', (['dense_clip0'], {'dim': '(0)'}), '(dense_clip0, dim=0)\n', (16193, 16213), False, 'import torch\n'), ((16232, 16263), 't... |
from location import Location
import random
class Party:
def __init__(self, simulation, name, colour, strategy=""):
self.location = Location()
self.simulation = simulation
if strategy == "":
self.random_strategy()
else:
self.strategy = strategy
self.name = name
self.colour ... | [
"random.random",
"random.randint",
"location.Location"
] | [((140, 150), 'location.Location', 'Location', ([], {}), '()\n', (148, 150), False, 'from location import Location\n'), ((547, 567), 'random.randint', 'random.randint', (['(1)', '(5)'], {}), '(1, 5)\n', (561, 567), False, 'import random\n'), ((1963, 1973), 'location.Location', 'Location', ([], {}), '()\n', (1971, 1973)... |
from snmachine import sndata,snfeatures
import numpy as np
import pandas
from astropy.table import Table
import pickle
import os,sys
'''
print('starting readin of monster files')
#raw_data=pandas.read_csv('/share/hypatia/snmachine_resources/data/plasticc/test_set.csv')
raw_data=pandas.read_csv('/share/hypatia/snmachin... | [
"snmachine.snfeatures.WaveletFeatures",
"pickle.load",
"sys.stdout.flush",
"os.path.join"
] | [((984, 1002), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1000, 1002), False, 'import os, sys\n'), ((1105, 1136), 'os.path.join', 'os.path.join', (['out_folder', '"""int"""'], {}), "(out_folder, 'int')\n", (1117, 1136), False, 'import os, sys\n'), ((1149, 1185), 'os.path.join', 'os.path.join', (['out_fo... |
import os
import json
import errno
import sys
import argparse
from dockstream.utils.execute_external.execute import Executor
from dockstream.utils import files_paths
from dockstream.utils.enums.docking_enum import DockingConfigurationEnum
_DC = DockingConfigurationEnum()
def run_script(input_path: str) -> dict:
... | [
"dockstream.utils.files_paths.attach_root_path",
"json.load",
"argparse.ArgumentParser",
"dockstream.utils.enums.docking_enum.DockingConfigurationEnum",
"os.path.isdir",
"dockstream.utils.execute_external.execute.Executor",
"json.replace",
"os.path.isfile",
"os.strerror",
"os.path.normpath",
"os... | [((247, 273), 'dockstream.utils.enums.docking_enum.DockingConfigurationEnum', 'DockingConfigurationEnum', ([], {}), '()\n', (271, 273), False, 'from dockstream.utils.enums.docking_enum import DockingConfigurationEnum\n'), ((1263, 1288), 'os.path.isdir', 'os.path.isdir', (['input_path'], {}), '(input_path)\n', (1276, 12... |
#---------------------------------------------------
# Perform a bunch of experiments using CompareIntegerMaps.exe, and writes the results to results.txt.
# You can filter the experiments by name by passing a regular expression as a script argument.
# For example: run_tests.py LOOKUP_0_.*
# Results are also cached in a... | [
"collections.defaultdict",
"cmake_launcher.CMakeLauncher",
"os.path.split",
"datetime.datetime.now",
"re.compile"
] | [((3048, 3062), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3060, 3062), False, 'from datetime import datetime\n'), ((3121, 3155), 're.compile', 're.compile', (["(sys.argv + ['.*'])[1]"], {}), "((sys.argv + ['.*'])[1])\n", (3131, 3155), False, 'import re\n'), ((1261, 1329), 'cmake_launcher.CMakeLauncher... |
"""
functionality for solving body-intersection problems. used by
`lhorizon.targeter`. currently contains only ray-sphere intersection solutions
but could also sensibly contain expressions for bodies of different shapes.
"""
from collections.abc import Callable, Sequence
import sympy as sp
# sympy symbols for ray-sph... | [
"sympy.symbols",
"sympy.Eq",
"sympy.lambdify"
] | [((371, 424), 'sympy.symbols', 'sp.symbols', (['"""x,y,z,x0,y0,z0,m_x,m_y,m_z,d"""'], {'real': '(True)'}), "('x,y,z,x0,y0,z0,m_x,m_y,m_z,d', real=True)\n", (381, 424), True, 'import sympy as sp\n'), ((724, 740), 'sympy.Eq', 'sp.Eq', (['x', '(x0 * d)'], {}), '(x, x0 * d)\n', (729, 740), True, 'import sympy as sp\n'), ((... |
import gym
import time
from connect_four.agents import DFPN
from connect_four.agents import difficult_connect_four_positions
from connect_four.evaluation.victor.victor_evaluator import Victor
from connect_four.hashing import ConnectFourHasher
from connect_four.transposition.sqlite_transposition_table import SQLiteTra... | [
"connect_four.evaluation.victor.victor_evaluator.Victor",
"gym.make",
"connect_four.agents.DFPN",
"time.time",
"connect_four.transposition.sqlite_transposition_table.SQLiteTranspositionTable",
"connect_four.hashing.ConnectFourHasher"
] | [((343, 370), 'gym.make', 'gym.make', (['"""connect_four-v0"""'], {}), "('connect_four-v0')\n", (351, 370), False, 'import gym\n'), ((397, 414), 'connect_four.evaluation.victor.victor_evaluator.Victor', 'Victor', ([], {'model': 'env'}), '(model=env)\n', (403, 414), False, 'from connect_four.evaluation.victor.victor_eva... |
#!/usr/bin/env python
import datetime
from lib.geo import interpolate_lat_lon, compute_bearing, offset_bearing
from lib.sequence import Sequence
import lib.io
import os
import sys
from lib.exifedit import ExifEdit
def interpolate_with_anchors(anchors, angle_offset):
'''
Interpolate gps position and compass an... | [
"lib.geo.compute_bearing",
"lib.geo.interpolate_lat_lon",
"datetime.datetime.strptime",
"datetime.timedelta",
"os.path.join",
"lib.exifedit.ExifEdit",
"lib.sequence.Sequence"
] | [((1821, 1859), 'lib.sequence.Sequence', 'Sequence', (['image_path'], {'check_exif': '(False)'}), '(image_path, check_exif=False)\n', (1829, 1859), False, 'from lib.sequence import Sequence\n'), ((1945, 2015), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['"""2000_09_03_12_00_00"""', '"""%Y_%m_%d_%H_%M_... |
from glob import glob
from pathlib import Path
from typing import List, Any, Dict
import pytest
import requests
import json
from requests import Response
from mockserver_client.exceptions.mock_server_expectation_not_found_exception import (
MockServerExpectationNotFoundException,
)
from mockserver_client.excepti... | [
"pytest.raises",
"mockserver_client.mockserver_client.MockServerFriendlyClient",
"requests.Session",
"pathlib.Path"
] | [((925, 975), 'mockserver_client.mockserver_client.MockServerFriendlyClient', 'MockServerFriendlyClient', ([], {'base_url': 'mock_server_url'}), '(base_url=mock_server_url)\n', (949, 975), False, 'from mockserver_client.mockserver_client import MockServerFriendlyClient\n'), ((1237, 1255), 'requests.Session', 'requests.... |
import unittest
from sim.battle import Battle
from data import dex
class TestAcrobatics(unittest.TestCase):
def test_acrobatics(self):
b = Battle(debug=False, rng=False)
b.join(0, [{'species': 'charmander', 'moves': ['tackle']}])
b.join(1, [{'species': 'pidgey', 'moves': ['acrobati... | [
"data.dex.Decision",
"sim.battle.Battle"
] | [((161, 191), 'sim.battle.Battle', 'Battle', ([], {'debug': '(False)', 'rng': '(False)'}), '(debug=False, rng=False)\n', (167, 191), False, 'from sim.battle import Battle\n'), ((675, 705), 'sim.battle.Battle', 'Battle', ([], {'debug': '(False)', 'rng': '(False)'}), '(debug=False, rng=False)\n', (681, 705), False, 'from... |
import requests
from pdf4me.helper.json_converter import JsonConverter
from pdf4me.helper.pdf4me_exceptions import Pdf4meClientException, Pdf4meBackendException
from pdf4me.helper.response_checker import ResponseChecker
# from pdf4me.helper.token_generator import TokenGenerator
class CustomHttp(object):
def __... | [
"pdf4me.helper.pdf4me_exceptions.Pdf4meClientException",
"pdf4me.helper.pdf4me_exceptions.Pdf4meBackendException",
"requests.get",
"requests.post",
"pdf4me.helper.response_checker.ResponseChecker",
"pdf4me.helper.json_converter.JsonConverter"
] | [((407, 422), 'pdf4me.helper.json_converter.JsonConverter', 'JsonConverter', ([], {}), '()\n', (420, 422), False, 'from pdf4me.helper.json_converter import JsonConverter\n'), ((1412, 1466), 'requests.post', 'requests.post', (['request_url'], {'data': 'body', 'headers': 'headers'}), '(request_url, data=body, headers=hea... |
# General
import numpy as np
import random
import argparse
import json
import commentjson
import joblib
import os
import pathlib
from collections import OrderedDict
# Pytorch
import torch
import pytorch_lightning as pl
from pytorch_lightning.loggers import TensorBoardLogger
from pytorch_lightning.callbacks import Mode... | [
"pytorch_lightning.Trainer",
"numpy.random.seed",
"argparse.ArgumentParser",
"joblib.dump",
"json.dumps",
"pathlib.Path",
"torch.autograd.set_detect_anomaly",
"optuna.integration.PyTorchLightningPruningCallback",
"os.path.join",
"optuna.samplers.TPESampler",
"random.randint",
"os.path.exists",... | [((602, 666), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Learn subgraph embeddings"""'}), "(description='Learn subgraph embeddings')\n", (625, 666), False, 'import argparse\n'), ((2974, 3016), 'torch.manual_seed', 'torch.manual_seed', (["hyperparameters['seed']"], {}), "(hyperparamet... |
import math
import pandas as pd
from transformers import Trainer, TrainingArguments
from .config import RecconEmotionEntailmentConfig
from .data_class import RecconEmotionEntailmentArguments
from .modeling import RecconEmotionEntailmentModel
from .tokenization import RecconEmotionEntailmentTokenizer
from .utils impor... | [
"pandas.read_csv",
"transformers.TrainingArguments",
"math.ceil"
] | [((1280, 1318), 'pandas.read_csv', 'pd.read_csv', (['train_config.x_train_path'], {}), '(train_config.x_train_path)\n', (1291, 1318), True, 'import pandas as pd\n'), ((1332, 1370), 'pandas.read_csv', 'pd.read_csv', (['train_config.x_valid_path'], {}), '(train_config.x_valid_path)\n', (1343, 1370), True, 'import pandas ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 16 18:49:46 2021
@author: wanderer
"""
### Housekeeping ###
import pandas as pd
import pandas_datareader.data as web
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import seaborn as sns
sns.set_style(... | [
"seaborn.set_style",
"pandas.date_range",
"pandas_datareader.data.DataReader",
"dateutil.relativedelta.relativedelta",
"matplotlib.ticker.FixedLocator",
"pandas.to_datetime",
"seaborn.color_palette",
"pandas.read_pickle",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((306, 376), 'seaborn.set_style', 'sns.set_style', (['"""white"""', "{'xtick.major.size': 2, 'ytick.major.size': 2}"], {}), "('white', {'xtick.major.size': 2, 'ytick.major.size': 2})\n", (319, 376), True, 'import seaborn as sns\n'), ((1095, 1133), 'pandas.read_pickle', 'pd.read_pickle', (["(save_loc + '/M2SL.pkl')"], ... |
import numpy as np
import est_dir
def test_1():
"""
Test for compute_forward() - check for flag=True.
"""
np.random.seed(90)
m = 10
f = est_dir.quad_f_noise
const_back = 0.5
const_forward = (1 / const_back)
minimizer = np.ones((m,))
centre_point = np.random.unif... | [
"numpy.random.seed",
"est_dir.combine_tracking",
"numpy.ones",
"est_dir.backward_tracking",
"numpy.round",
"est_dir.compute_direction_LS",
"numpy.copy",
"est_dir.compute_coeffs",
"numpy.identity",
"est_dir.forward_tracking",
"est_dir.compute_direction_XY",
"numpy.min",
"numpy.linalg.inv",
... | [((134, 152), 'numpy.random.seed', 'np.random.seed', (['(90)'], {}), '(90)\n', (148, 152), True, 'import numpy as np\n'), ((272, 285), 'numpy.ones', 'np.ones', (['(m,)'], {}), '((m,))\n', (279, 285), True, 'import numpy as np\n'), ((306, 336), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(20)', '(m,)'], {}), ... |
import logging as log
from PyQt5 import QtWidgets, uic
from PyQt5.QtCore import Qt
from creator.utils import util
from creator.child_views import shared
from creator.child_views import list_view
GENDERLESS = 0
MALE = 1
FEMALE = 2
class GenderTab(QtWidgets.QWidget, shared.Tab):
def __init__(self, data):
... | [
"PyQt5.QtWidgets.QMenu",
"creator.utils.util.pokemon_list",
"PyQt5.uic.loadUi"
] | [((363, 414), 'PyQt5.uic.loadUi', 'uic.loadUi', (["(util.RESOURCE_UI / 'GenderTab.ui')", 'self'], {}), "(util.RESOURCE_UI / 'GenderTab.ui', self)\n", (373, 414), False, 'from PyQt5 import QtWidgets, uic\n'), ((643, 662), 'creator.utils.util.pokemon_list', 'util.pokemon_list', ([], {}), '()\n', (660, 662), False, 'from ... |
"""
Notes
-----
This test and docs/source/usage/iss/iss_cli.sh test the same code paths and should be updated
together
"""
import os
import unittest
import numpy as np
import pandas as pd
import pytest
from starfish.test.full_pipelines.cli._base_cli_test import CLITest
from starfish.types import Features
EXPERIMENT... | [
"os.path.join",
"pandas.Series",
"numpy.unique"
] | [((6573, 6639), 'numpy.unique', 'np.unique', (['intensities.coords[Features.TARGET]'], {'return_counts': '(True)'}), '(intensities.coords[Features.TARGET], return_counts=True)\n', (6582, 6639), True, 'import numpy as np\n'), ((6675, 6699), 'pandas.Series', 'pd.Series', (['counts', 'genes'], {}), '(counts, genes)\n', (6... |
# !/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
import SillyServer
setup(
name="SillyServer",
version=SillyServer.__VERSION__,
author=SillyServer.__AUTHOR__,
url=SillyServer.__URL__,
license=SillyServer.__LICENSE__,
packages=find_packages(),
description="A... | [
"setuptools.find_packages"
] | [((285, 300), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (298, 300), False, 'from setuptools import setup, find_packages\n')] |
from django_filters import rest_framework as filters
from hive_sbi_api.core.models import Transaction
class TransactionFilter(filters.FilterSet):
account = filters.CharFilter(
field_name='account__account',
label='account',
)
sponsor = filters.CharFilter(
field_name='sponsor__acc... | [
"django_filters.rest_framework.CharFilter"
] | [((163, 229), 'django_filters.rest_framework.CharFilter', 'filters.CharFilter', ([], {'field_name': '"""account__account"""', 'label': '"""account"""'}), "(field_name='account__account', label='account')\n", (181, 229), True, 'from django_filters import rest_framework as filters\n'), ((268, 334), 'django_filters.rest_f... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# DATE: 2021/7/24
# Author: <EMAIL>
from collections import OrderedDict
from threading import Lock
from time import time as current
from typing import Dict, Any, Type, Union, Optional, NoReturn, Tuple, List, Callable
from cache3 import AbstractCache
from cache3.setting import... | [
"collections.OrderedDict",
"time.time"
] | [((1726, 1739), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1737, 1739), False, 'from collections import OrderedDict\n'), ((5522, 5531), 'time.time', 'current', ([], {}), '()\n', (5529, 5531), True, 'from time import time as current\n'), ((6321, 6330), 'time.time', 'current', ([], {}), '()\n', (6328, 6... |
from django.urls import re_path
import mainapp.views as mainapp
from .apps import MainappConfig
app_name = MainappConfig.name
urlpatterns = [
re_path(r"^$", mainapp.products, name="index"),
re_path(r"^category/(?P<pk>\d+)/$", mainapp.products, name="category"),
re_path(r"^category/(?P<pk>\d+)/page/(?P<p... | [
"django.urls.re_path"
] | [((150, 195), 'django.urls.re_path', 're_path', (['"""^$"""', 'mainapp.products'], {'name': '"""index"""'}), "('^$', mainapp.products, name='index')\n", (157, 195), False, 'from django.urls import re_path\n'), ((202, 272), 'django.urls.re_path', 're_path', (['"""^category/(?P<pk>\\\\d+)/$"""', 'mainapp.products'], {'na... |
from math import pi
import os
from MultiHex2.tools import Basic_Tool
from MultiHex2.core.coordinates import screen_to_hex, hex_to_screen
from MultiHex2.actions import NullAction
from tools.basic_tool import ToolLayer
from PyQt5 import QtGui
art_dir = os.path.join( os.path.dirname(__file__),'..','assets','buttons')
... | [
"MultiHex2.core.coordinates.hex_to_screen",
"os.path.dirname",
"os.path.join",
"MultiHex2.actions.NullAction"
] | [((269, 294), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (284, 294), False, 'import os\n'), ((954, 974), 'MultiHex2.core.coordinates.hex_to_screen', 'hex_to_screen', (['locid'], {}), '(locid)\n', (967, 974), False, 'from MultiHex2.core.coordinates import screen_to_hex, hex_to_screen\n'), ... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="sciPENN",
version="0.9.6",
author="<NAME>",
author_email="<EMAIL>",
description="A package for integrative and predictive analysis of CITE-seq data",
long_description... | [
"setuptools.find_packages"
] | [((646, 683), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (670, 683), False, 'import setuptools\n')] |
# -*- python -*-
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
#
# (c) 2013-2020 parasim inc
# (c) 2010-2020 california institute of technology
# all rights reserved
#
# the package
import altar
# and the protocols
from .Controller import Controller as controller
from .Sampler import Sampler as sampler
from .Scheduler... | [
"altar.foundry"
] | [((409, 515), 'altar.foundry', 'altar.foundry', ([], {'implements': 'controller', 'tip': '"""a Bayesian controller that implements simulated annealing"""'}), "(implements=controller, tip=\n 'a Bayesian controller that implements simulated annealing')\n", (422, 515), False, 'import altar\n'), ((695, 790), 'altar.foun... |
"""
Trading-Technical-Indicators (tti) python library
File name: _volume_oscillator.py
Implements the Volume Oscillator technical indicator.
"""
import pandas as pd
from ._technical_indicator import TechnicalIndicator
from ..utils.constants import TRADE_SIGNALS
from ..utils.exceptions import NotEnoughInputData, ... | [
"pandas.DataFrame"
] | [((3853, 3945), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'self._input_data.index', 'columns': "['vosc']", 'data': 'None', 'dtype': '"""float64"""'}), "(index=self._input_data.index, columns=['vosc'], data=None,\n dtype='float64')\n", (3865, 3945), True, 'import pandas as pd\n')] |
# NOTE: Derived from https://github.com/biocore/qurro/blob/master/setup.py
from setuptools import find_packages, setup
classes = """
Development Status :: 3 - Alpha
Topic :: Software Development :: Libraries
Topic :: Scientific/Engineering
Topic :: Scientific/Engineering :: Bio-Informatics
Program... | [
"setuptools.find_packages"
] | [((974, 989), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (987, 989), False, 'from setuptools import find_packages, setup\n')] |
from mayavi import mlab as mayalab
import numpy as np
import os
def plot_pc(pcs,color=None,scale_factor=.05,mode='point'):
if color == 'red':
mayalab.points3d(pcs[:,0],pcs[:,1],pcs[:,2],mode=mode,scale_factor=scale_factor,color=(1,0,0))
print("color",color)
elif color == 'blue':
mayalab.points3d(pcs[:... | [
"numpy.load",
"mayavi.mlab.quiver3d",
"mayavi.mlab.show",
"mayavi.mlab.points3d",
"numpy.array",
"numpy.tile",
"numpy.eye",
"os.path.join"
] | [((1488, 1514), 'numpy.tile', 'np.tile', (['origin_pc', '(3, 1)'], {}), '(origin_pc, (3, 1))\n', (1495, 1514), True, 'import numpy as np\n'), ((2297, 2311), 'mayavi.mlab.show', 'mayalab.show', ([], {}), '()\n', (2309, 2311), True, 'from mayavi import mlab as mayalab\n'), ((2695, 2712), 'numpy.load', 'np.load', (['save_... |
# =========================================================================================
# Copyright 2016 Community Information Online Consortium (CIOC) and KCL Software Solutions
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | [
"pyramid.security.remember",
"pyramid.security.forget",
"offlinetools.views.validators.UnicodeString",
"offlinetools.syslanguage.default_culture",
"offlinetools.views.validators.String",
"sqlalchemy.func.count"
] | [((1412, 1460), 'offlinetools.views.validators.UnicodeString', 'validators.UnicodeString', ([], {'max': '(50)', 'not_empty': '(True)'}), '(max=50, not_empty=True)\n', (1436, 1460), False, 'from offlinetools.views import validators\n'), ((1476, 1509), 'offlinetools.views.validators.String', 'validators.String', ([], {'n... |