code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def swahili(path):
"""Swahili
Attitudes towards the Swahili language a... | [
"observations.util.maybe_download_and_extract",
"os.path.join",
"os.path.expanduser"
] | [((995, 1019), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (1013, 1019), False, 'import os\n'), ((1169, 1255), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""swahili.csv"""', 'resume': '(False)'}), "(path, url, save_file... |
#!/usr/bin/env python
import requests
import re
from hashlib import md5
from search_client import *
from api_credentials import *
## API Configuration
# --------------------------------------------
GOOGLE_WEB_ENTRY = 'http://www.google.com/'
GOOGLE_WEB_FUNC = 'images'
## Search Class
# --------------------------... | [
"hashlib.md5",
"re.compile"
] | [((1717, 1754), 're.compile', 're.compile', (['"""/imgres\\\\?imgurl=(.*?)&"""'], {}), "('/imgres\\\\?imgurl=(.*?)&')\n", (1727, 1754), False, 'import re\n'), ((1782, 1806), 're.compile', 're.compile', (['"""tbn:(.*?)\\""""'], {}), '(\'tbn:(.*?)"\')\n', (1792, 1806), False, 'import re\n'), ((2398, 2410), 'hashlib.md5',... |
import math
def f(x):
return math.pow(x, 2) + 3 * x + 15
def riemannIntegral(interval, a):
x = interval[0]
step = (interval[1] - interval[0]) / a
x1 = x + step
integral = 0
for i in range (interval[0], a):
width = x1 - x
height = f(x1)
integral += width * height
... | [
"math.pow"
] | [((34, 48), 'math.pow', 'math.pow', (['x', '(2)'], {}), '(x, 2)\n', (42, 48), False, 'import math\n')] |
import pandas as pd
import numpy as np
USAhousing = pd.read_csv('USA_Housing.csv')
print(USAhousing.head())
print(USAhousing.tail()) | [
"pandas.read_csv"
] | [((54, 84), 'pandas.read_csv', 'pd.read_csv', (['"""USA_Housing.csv"""'], {}), "('USA_Housing.csv')\n", (65, 84), True, 'import pandas as pd\n')] |
import pypyodbc
from group_plugin import GroupPlugin, Group
class ODBCGroupPlugin(GroupPlugin):
def __init__(self):
super(ODBCGroupPlugin, self).__init__()
self.connection_str = self.get_conf_option('connection_str')
self.groups_sql = self.get_conf_option('groups_sql')
self.change... | [
"pypyodbc.connect",
"group_plugin.Group"
] | [((484, 521), 'pypyodbc.connect', 'pypyodbc.connect', (['self.connection_str'], {}), '(self.connection_str)\n', (500, 521), False, 'import pypyodbc\n'), ((960, 997), 'pypyodbc.connect', 'pypyodbc.connect', (['self.connection_str'], {}), '(self.connection_str)\n', (976, 997), False, 'import pypyodbc\n'), ((645, 666), 'g... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-03 09:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('book', '0010_auto_20170603_1441'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.TextField"
] | [((392, 431), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (408, 431), False, 'from django.db import migrations, models\n')] |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"threading.Thread.__init__",
"time.sleep",
"future.standard_library.install_aliases",
"queue.put",
"queue.Queue"
] | [((724, 758), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (756, 758), False, 'from future import standard_library\n'), ((1290, 1309), 'queue.Queue', 'queue.Queue', (['numthr'], {}), '(numthr)\n', (1301, 1309), False, 'import queue\n'), ((885, 916), 'threading.Thread.... |
from pocketthrone.entities.event import *
from weakref import WeakKeyDictionary
class EventManager:
_tag = "[EventManager] "
listeners = WeakKeyDictionary()
eventQueue= []
@classmethod
def register(self, listener, tag="untagged"):
'''registers an object for receiving game events'''
self.listeners[listener] =... | [
"weakref.WeakKeyDictionary"
] | [((140, 159), 'weakref.WeakKeyDictionary', 'WeakKeyDictionary', ([], {}), '()\n', (157, 159), False, 'from weakref import WeakKeyDictionary\n')] |
import time
import picamera
import numpy as np
import cv2
with picamera.PiCamera() as camera:
camera.resolution = (3280, 2464)
camera. start_preview()
time. sleep(2)
camera.capture('image.data', 'yuv')
##################################################
fd = open('image.data', 'rb')
f=np.fromfile(fd, dty... | [
"cv2.imwrite",
"numpy.fromfile",
"picamera.PiCamera",
"time.sleep"
] | [((301, 351), 'numpy.fromfile', 'np.fromfile', (['fd'], {'dtype': 'np.uint8', 'count': '(3280 * 2464)'}), '(fd, dtype=np.uint8, count=3280 * 2464)\n', (312, 351), True, 'import numpy as np\n'), ((390, 425), 'cv2.imwrite', 'cv2.imwrite', (['"""rawconverted.jpg"""', 'im'], {}), "('rawconverted.jpg', im)\n", (401, 425), F... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import numpy as np
import scipy.io.wavfile as wav
import random
import tables
import pickle
def feed_to_hdf5(feature_vector, subject_num, utterance_train_storage, utterance_test_storage, ... | [
"numpy.array",
"numpy.zeros"
] | [((1387, 1430), 'numpy.zeros', 'np.zeros', (['(1, 80, 40, 20)'], {'dtype': 'np.float32'}), '((1, 80, 40, 20), dtype=np.float32)\n', (1395, 1430), True, 'import numpy as np\n'), ((2216, 2259), 'numpy.zeros', 'np.zeros', (['(1, 80, 40, 20)'], {'dtype': 'np.float32'}), '((1, 80, 40, 20), dtype=np.float32)\n', (2224, 2259)... |
import setuptools
setuptools.setup(
name="almond-cloud-cli",
version="0.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="Command Line Interface (CLI) for Almond Cloud development and deployment",
url="https://github.com/stanford-oval/almond-cloud",
packages=setuptools.find_packag... | [
"setuptools.find_packages"
] | [((298, 324), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (322, 324), False, 'import setuptools\n')] |
from os import path, environ, makedirs
from peewee import SqliteDatabase
CACHE_FOLDER_NAME = '.sydler'
DB_FILE_NAME = 'member.db'
# create the cache folder before connecting to the data store
path_to_db = path.join(environ.get('HOME'), CACHE_FOLDER_NAME)
makedirs(path_to_db, exist_ok=True)
# create and connect to data... | [
"os.path.join",
"os.environ.get",
"os.makedirs"
] | [((256, 291), 'os.makedirs', 'makedirs', (['path_to_db'], {'exist_ok': '(True)'}), '(path_to_db, exist_ok=True)\n', (264, 291), False, 'from os import path, environ, makedirs\n'), ((216, 235), 'os.environ.get', 'environ.get', (['"""HOME"""'], {}), "('HOME')\n", (227, 235), False, 'from os import path, environ, makedirs... |
import os
from dotenv import dotenv_values
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from twisted.internet.defer import inlineCallbacks
from autoinfo.cookie import CookieProvider
from autoinfo.data.mongo import MongoConnector, MongoConnectionSettings, MongoMakerSt... | [
"os.environ.setdefault",
"autoinfo.data.mongo.MongoMakerStore",
"autoinfo.services.AutoDetailsService",
"autoinfo.data.mongo.MongoModelSeriesStore",
"scrapy.utils.project.get_project_settings",
"autoinfo.data.mongo.MongoSeriesStore",
"autoinfo.data.mongo.MongoConnector",
"autoinfo.data.mongo.MongoMode... | [((3917, 3994), 'os.environ.setdefault', 'os.environ.setdefault', (['"""SCRAPY_SETTINGS_MODULE"""', '"""scrapper.scrapper.settings"""'], {}), "('SCRAPY_SETTINGS_MODULE', 'scrapper.scrapper.settings')\n", (3938, 3994), False, 'import os\n'), ((4010, 4032), 'scrapy.utils.project.get_project_settings', 'get_project_settin... |
#!/usr/bin/env python3
#
# SPDX-License-Identifier: MIT
#
# This file is formatted with Python Black
"""
A Parser helper function to convert a byte array to a Python object and the
other way around. The conversion is specified in a list of :class:`Spec`
instances, for example:
>>> data = bytes(range(16))
>>> ... | [
"logging.getLogger",
"struct.calcsize",
"struct.unpack_from",
"ratbag.util.as_hex",
"attr.validators.instance_of",
"struct.pack_into",
"re.sub",
"re.findall",
"attr.validators.in_",
"attr.ib"
] | [((1287, 1314), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1304, 1314), False, 'import logging\n'), ((2062, 2071), 'attr.ib', 'attr.ib', ([], {}), '()\n', (2069, 2071), False, 'import attr\n'), ((2659, 2668), 'attr.ib', 'attr.ib', ([], {}), '()\n', (2666, 2668), False, 'import attr\n... |
'''mpi4py wrapper that allows an ensemble of serial applications to run in
parallel across ranks on the computing resource'''
import argparse
from collections import defaultdict
import os
import sys
import logging
import random
from subprocess import Popen, STDOUT, TimeoutExpired
import shlex
import signal
import time
... | [
"logging.getLogger",
"shlex.split",
"time.sleep",
"balsam.launcher.util.remaining_time_minutes",
"sys.exit",
"mpi4py.MPI.Finalize",
"balsam.core.models.BalsamJob.batch_update_state",
"balsam.core.models.BalsamJob.objects.filter",
"os.path.exists",
"argparse.ArgumentParser",
"balsam.launcher.util... | [((443, 450), 'balsam.setup', 'setup', ([], {}), '()\n', (448, 450), False, 'from balsam import config_logging, settings, setup\n'), ((626, 675), 'logging.getLogger', 'logging.getLogger', (['"""balsam.launcher.mpi_ensemble"""'], {}), "('balsam.launcher.mpi_ensemble')\n", (643, 675), False, 'import logging\n'), ((676, 7... |
import numpy as np
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.palettes import Cividis256 as Pallete
from bokeh.plotting import Figure, figure
from bokeh.transform import factor_cmap
def draw_interactive_scatter_plot(
texts: np.ndarray,
xs: np.ndarray,
ys: np.ndarray,
values: np.nd... | [
"bokeh.transform.factor_cmap",
"numpy.log10",
"bokeh.plotting.figure",
"bokeh.models.HoverTool"
] | [((1245, 1334), 'bokeh.models.HoverTool', 'HoverTool', ([], {'tooltips': "[(text_column, '@text{safe}'), (label_column, '@original_label')]"}), "(tooltips=[(text_column, '@text{safe}'), (label_column,\n '@original_label')])\n", (1254, 1334), False, 'from bokeh.models import ColumnDataSource, HoverTool\n'), ((1353, 1... |
def plot_power_spectra(kbins, deltab_2, deltac_2, deltac_2_nodeconv, tf, ax=None):
'''
Plot density and velocity power spectra and compare with CAMB
'''
import numpy as np
import matplotlib.pylab as plt
from seren3.cosmology.transfer_function import TF
if ax is None:
ax = plt.gca()
... | [
"matplotlib.pylab.gca",
"matplotlib.pylab.subplots",
"numpy.sqrt",
"numpy.ones",
"matplotlib.pylab.figure",
"matplotlib.gridspec.GridSpec",
"numpy.linspace",
"numpy.isnan",
"matplotlib.pylab.show"
] | [((3864, 3911), 'matplotlib.pylab.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(2)', 'figsize': '(12, 6)'}), '(nrows=1, ncols=2, figsize=(12, 6))\n', (3876, 3911), True, 'import matplotlib.pylab as plt\n'), ((4410, 4420), 'matplotlib.pylab.show', 'plt.show', ([], {}), '()\n', (4418, 4420), True, 'import m... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from os.path import join, dirname
sys.path.insert(0, join(dirname(__file__), '../../'))
import os
import random
import argparse
from datetime import datetime
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
import torch
impor... | [
"carla_utils.parse_yaml_file_unsafe",
"learning.model.Generator",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.sum",
"torch.utils.tensorboard.SummaryWriter",
"robo_utils.oxford.oxford_dataset.GANDataset",
"argparse.ArgumentParser",
"torch.mean",
"torch.set_num_threads",
"matplotlib.pypl... | [((249, 300), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'figure.max_open_warning': 0}"], {}), "({'figure.max_open_warning': 0})\n", (268, 300), True, 'import matplotlib.pyplot as plt\n'), ((675, 697), 'torch.manual_seed', 'torch.manual_seed', (['(666)'], {}), '(666)\n', (692, 697), False, 'import ... |
import os
class PathManager:
input_folder_label = None
output_folder_label = None
_input_folder_path = None
_output_folder_path = None
_import_file_path = None
_import_file_style = None
@classmethod
def set_input_folder_label(cls, label):
cls.input_folder_label = label
@classmethod
def set_output_folder... | [
"os.path.abspath",
"os.path.exists",
"os.path.join"
] | [((845, 866), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (860, 866), False, 'import os\n'), ((1059, 1080), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (1074, 1080), False, 'import os\n'), ((1303, 1327), 'os.path.exists', 'os.path.exists', (['all_path'], {}), '(all_path)\n', ... |
"""Views fo the node settings page."""
# -*- coding: utf-8 -*-
import logging
import httplib as http
from dropbox.rest import ErrorResponse
from dropbox.client import DropboxClient
from urllib3.exceptions import MaxRetryError
from framework.exceptions import HTTPError
from website.addons.dropbox.serializer import Dro... | [
"logging.getLogger",
"website.addons.base.generic_views.deauthorize_node",
"website.addons.base.generic_views.import_auth",
"website.addons.base.generic_views.root_folder",
"website.addons.base.generic_views.set_config",
"website.addons.base.generic_views.folder_list",
"website.addons.base.generic_views... | [((391, 418), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (408, 418), False, 'import logging\n'), ((510, 567), 'website.addons.base.generic_views.account_list', 'generic_views.account_list', (['SHORT_NAME', 'DropboxSerializer'], {}), '(SHORT_NAME, DropboxSerializer)\n', (536, 567), Fal... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from unittest.mock import patch
import numpy as np
from ...common import testing
from . import co... | [
"numpy.random.normal",
"numpy.testing.assert_equal",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.random.seed",
"numpy.all",
"unittest.mock.patch"
] | [((674, 692), 'numpy.random.seed', 'np.random.seed', (['(24)'], {}), '(24)\n', (688, 692), True, 'import numpy as np\n'), ((940, 970), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {'size': '(8)'}), '(0, 1, size=8)\n', (956, 970), True, 'import numpy as np\n'), ((1036, 1095), 'numpy.testing.assert_almost_... |
from math import sqrt
from collections import namedtuple
import torch
from e3nn import o3
from e3nn.util import eval_code
def _prod(x):
out = 1
for a in x:
out *= a
return out
class TensorProduct(torch.nn.Module):
r"""Tensor Product with parametrizable paths
Parameters
----------
... | [
"e3nn.util.eval_code",
"torch.nn.ParameterDict",
"torch.get_default_dtype",
"collections.namedtuple",
"e3nn.o3.Irrep",
"e3nn.o3.Irreps",
"e3nn.o3.wigner_3j",
"math.sqrt",
"torch.randn",
"torch.is_tensor",
"torch.zeros",
"torch.ones"
] | [((5868, 5915), 'e3nn.o3.Irreps', 'o3.Irreps', (['[(mul, ir) for mul, ir, _var in in1]'], {}), '([(mul, ir) for mul, ir, _var in in1])\n', (5877, 5915), False, 'from e3nn import o3\n'), ((5942, 5989), 'e3nn.o3.Irreps', 'o3.Irreps', (['[(mul, ir) for mul, ir, _var in in2]'], {}), '([(mul, ir) for mul, ir, _var in in2])\... |
import functools
from itertools import zip_longest
from Bio import Phylo
def memoize(func):
cache = func.cache = {}
@functools.wraps(func)
def memoized_func(*args, **kwargs):
key = str(args) + str(kwargs)
if key not in cache:
cache[key] = func(*args, **kwargs)
return ... | [
"itertools.zip_longest",
"Bio.Phylo.read",
"functools.wraps"
] | [((129, 150), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (144, 150), False, 'import functools\n'), ((448, 522), 'Bio.Phylo.read', 'Phylo.read', (['newick_tree', '"""newick"""'], {'values_are_confidence': '(True)', 'rooted': '(True)'}), "(newick_tree, 'newick', values_are_confidence=True, rooted=T... |
#!env python
import collections
import queue
import logging
import enum
import functools
import json
import time
import os
import gzip
import shutil
import random # ONLY USED FOR RANDOM DELAY AT BEGINNING.
import numpy as np
import argparse
import sys
sys.path.append("../src-testbed")
import events
import common
imp... | [
"numpy.random.default_rng",
"events.WorkerQueueCompletionEvent",
"common.getLogger",
"logging.debug",
"events.ModelAdditionEvent",
"logging.info",
"sys.path.append",
"logging.error",
"os.path.exists",
"common.getParser",
"json.dumps",
"events.ModelRemovalEvent",
"events.RequestCompletionEven... | [((254, 287), 'sys.path.append', 'sys.path.append', (['"""../src-testbed"""'], {}), "('../src-testbed')\n", (269, 287), False, 'import sys\n'), ((14014, 14063), 'common.getLogger', 'common.getLogger', ([], {'hide_debug': '(not flags.show_debug)'}), '(hide_debug=not flags.show_debug)\n', (14030, 14063), False, 'import c... |
# Copyright (c) 2018, <NAME> <<EMAIL>>
# SPDX-License-Identifier: Apache-2.0
"""
Utility module to locate filesystem directories relevant to ps4rp. Conforms to
the XDG spec on Linux. MacOS and Windows support are TODO.
"""
import functools
from xdg import BaseDirectory
_XDG_RESOURCE = 'ps4-remote-play'
@functools.... | [
"functools.lru_cache",
"xdg.BaseDirectory.save_config_path",
"xdg.BaseDirectory.save_cache_path"
] | [((310, 331), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (329, 331), False, 'import functools\n'), ((404, 425), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (423, 425), False, 'import functools\n'), ((356, 400), 'xdg.BaseDirectory.save_cache_path', 'BaseDirectory.save_cache_path'... |
import os, confuse
config = confuse.Configuration('RecLauncher')
config.set_file('config-st.yaml')
server_port = config['streamlit']['server_port'].get()
os.system(f"streamlit run app.py --server.port {server_port}") | [
"confuse.Configuration",
"os.system"
] | [((29, 65), 'confuse.Configuration', 'confuse.Configuration', (['"""RecLauncher"""'], {}), "('RecLauncher')\n", (50, 65), False, 'import os, confuse\n'), ((155, 217), 'os.system', 'os.system', (['f"""streamlit run app.py --server.port {server_port}"""'], {}), "(f'streamlit run app.py --server.port {server_port}')\n", (... |
from django.db import models
from apps.website.models.article import Article
STATUS_CHOICES = (
("SH", "Show"),
("HD", "Hide"),
)
class Comments(models.Model):
article = models.ForeignKey(Article, on_delete=models.CASCADE)
name = models.CharField(max_length=50, null=False)
email = models.CharFie... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((186, 238), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Article'], {'on_delete': 'models.CASCADE'}), '(Article, on_delete=models.CASCADE)\n', (203, 238), False, 'from django.db import models\n'), ((250, 293), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(False)'}),... |
# the simplex projection algorithm implemented as a layer, while using the saliency maps to obtain object size estimates
import sys
sys.path.insert(0,'/home/briq/libs/caffe/python')
import caffe
import random
import numpy as np
import scipy.misc
import imageio
import cv2
import scipy.ndimage as nd
import os.path
import... | [
"sys.path.insert",
"numpy.where",
"scipy.io.loadmat",
"random.seed",
"numpy.sum"
] | [((132, 182), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/briq/libs/caffe/python"""'], {}), "(0, '/home/briq/libs/caffe/python')\n", (147, 182), False, 'import sys\n'), ((711, 723), 'numpy.sum', 'np.sum', (['V_im'], {}), '(V_im)\n', (717, 723), True, 'import numpy as np\n'), ((1802, 1815), 'random.seed', '... |
import torch
import torch.nn as nn
from torch.autograd import Variable
import sklearn.preprocessing as skp
import data_util as du
import training
class FXLSTM(nn.Module):
def __init__(self, input_dim, hidden_size, num_layers, output_seq_len,
bias=True, dropout=0,
batch_first=F... | [
"data_util.load_fx_10m_xy",
"training.run_training",
"torch.index_select",
"torch.nn.LSTM",
"torch.nn.L1Loss",
"sklearn.preprocessing.StandardScaler",
"torch.nn.Linear",
"torch.arange",
"torch.nn.GRU"
] | [((3384, 3438), 'data_util.load_fx_10m_xy', 'du.load_fx_10m_xy', ([], {'test_size': 'test_size', 'y_shape_mode': '(1)'}), '(test_size=test_size, y_shape_mode=1)\n', (3401, 3438), True, 'import data_util as du\n'), ((3704, 3724), 'sklearn.preprocessing.StandardScaler', 'skp.StandardScaler', ([], {}), '()\n', (3722, 3724... |
import collections
from contextlib import contextmanager
import json
import os
import pytest
import consul.base
CB = consul.base.CB
Response = consul.base.Response
Request = collections.namedtuple(
'Request', ['method', 'path', 'params', 'data'])
class HTTPClient(object):
def __init__(self, base_uri, ver... | [
"collections.namedtuple",
"os.getenv",
"pytest.mark.parametrize",
"os.environ.update",
"pytest.raises"
] | [((179, 250), 'collections.namedtuple', 'collections.namedtuple', (['"""Request"""', "['method', 'path', 'params', 'data']"], {}), "('Request', ['method', 'path', 'params', 'data'])\n", (201, 250), False, 'import collections\n'), ((8105, 8989), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url, interval, ... |
'''
This file implements JPP-Net for human parsing and pose detection.
'''
import tensorflow as tf
import os
from tensorflow.python.framework import graph_util
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from tensorflow.python.platform import gfile
import time
class JPP(object):
... | [
"tensorflow.Session",
"tensorflow.GraphDef",
"tensorflow.global_variables_initializer",
"numpy.array",
"tensorflow.python.platform.gfile.FastGFile",
"tensorflow.import_graph_def",
"tensorflow.ConfigProto",
"tensorflow.GPUOptions"
] | [((423, 493), 'numpy.array', 'np.array', (['(104.00698793, 116.66876762, 122.67891434)'], {'dtype': 'np.float32'}), '((104.00698793, 116.66876762, 122.67891434), dtype=np.float32)\n', (431, 493), True, 'import numpy as np\n'), ((548, 580), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'allow_growth': '(True)'}), '(al... |
import itertools
import subprocess
import sys
import pytest
from arca import Arca, Task, CurrentEnvironmentBackend
from arca.utils import logger
from arca.exceptions import BuildError
from common import BASE_DIR, RETURN_COLORAMA_VERSION_FUNCTION, SECOND_RETURN_STR_FUNCTION, TEST_UNICODE
def _pip_action(action, pack... | [
"arca.Task",
"subprocess.Popen",
"arca.utils.logger.debug",
"itertools.product",
"arca.Arca",
"pytest.raises",
"arca.CurrentEnvironmentBackend",
"arca.utils.logger.info"
] | [((568, 628), 'arca.utils.logger.info', 'logger.info', (['"""Installing requirements with command: %s"""', 'cmd'], {}), "('Installing requirements with command: %s', cmd)\n", (579, 628), False, 'from arca.utils import logger\n'), ((644, 713), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE... |
# 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... | [
"time.localtime",
"openpyxl.load_workbook",
"os.path.join",
"re.findall",
"json.dump"
] | [((3489, 3522), 'openpyxl.load_workbook', 'opx.load_workbook', (['me_report_path'], {}), '(me_report_path)\n', (3506, 3522), True, 'import openpyxl as opx\n'), ((1376, 1409), 'os.path.join', 'os.path.join', (['log_path', '(fname % i)'], {}), '(log_path, fname % i)\n', (1388, 1409), False, 'import os\n'), ((3608, 3624),... |
#
# GeomProc: geometry processing library in python + numpy
#
# Copyright (c) 2008-2021 <NAME> <<EMAIL>>
# under the MIT License.
#
# See file LICENSE.txt for details on the copyright license.
#
"""This module contains the implicit function class of the GeomProc
geometry processing library used for defining implicit fu... | [
"numpy.linalg.solve",
"math.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((2726, 2746), 'numpy.zeros', 'np.zeros', (['(n * 2, 3)'], {}), '((n * 2, 3))\n', (2734, 2746), True, 'import numpy as np\n'), ((2773, 2793), 'numpy.zeros', 'np.zeros', (['(n * 2, 1)'], {}), '((n * 2, 1))\n', (2781, 2793), True, 'import numpy as np\n'), ((5602, 5644), 'numpy.linalg.solve', 'np.linalg.solve', (['self.K... |
import os
import csv
import subprocess
import matplotlib.pyplot as plt
from math import ceil
from tqdm import tqdm
from pandas import read_csv
from netCDF4 import Dataset, num2date
from multiprocessing import cpu_count, Process
from .plot import plot_filtered_profiles_data
def download_data(files, storage_path):
... | [
"math.ceil",
"pandas.read_csv",
"netCDF4.num2date",
"multiprocessing.Process",
"tqdm.tqdm",
"csv.writer",
"netCDF4.Dataset",
"multiprocessing.cpu_count",
"subprocess.call",
"os.remove"
] | [((3054, 3164), 'subprocess.call', 'subprocess.call', (["['rsync', '-azh', 'vdmzrs.ifremer.fr::argo-index/ar_index_global_prof.txt',\n storage_path]"], {}), "(['rsync', '-azh',\n 'vdmzrs.ifremer.fr::argo-index/ar_index_global_prof.txt', storage_path])\n", (3069, 3164), False, 'import subprocess\n'), ((3667, 3716)... |
from bearlibterminal import terminal as term
from spaceship.engine import Engine
from spaceship.menus.main import Main
def test_engine_init():
e = Engine()
assert isinstance(e.scene, Main)
def test_engine_run():
e = Engine()
e.run()
if __name__ == "__main__":
test_engine_run() | [
"spaceship.engine.Engine"
] | [((152, 160), 'spaceship.engine.Engine', 'Engine', ([], {}), '()\n', (158, 160), False, 'from spaceship.engine import Engine\n'), ((230, 238), 'spaceship.engine.Engine', 'Engine', ([], {}), '()\n', (236, 238), False, 'from spaceship.engine import Engine\n')] |
# coding=utf-8
import os
import re
from collections import OrderedDict
from xml.dom import minidom
from xml.etree import ElementTree
from xml.etree.ElementTree import Element, SubElement
from letterparser import build, parse, utils, zip_lib
# max level of recursion adding content blocks supported
MAX_LEVEL = 5
def... | [
"letterparser.utils.open_tag",
"letterparser.utils.reparsing_namespaces",
"os.listdir",
"letterparser.utils.xml_string_fix_namespaces",
"letterparser.build.build_articles",
"xml.dom.minidom.parseString",
"letterparser.utils.object_id_from_uri",
"xml.etree.ElementTree.fromstring",
"collections.Ordere... | [((668, 709), 're.match', 're.match', (['""".*\\\\.[Zz][Ii][Pp]$"""', 'file_name'], {}), "('.*\\\\.[Zz][Ii][Pp]$', file_name)\n", (676, 709), False, 'import re\n'), ((1309, 1347), 'letterparser.zip_lib.unzip_zip', 'zip_lib.unzip_zip', (['file_name', 'temp_dir'], {}), '(file_name, temp_dir)\n', (1326, 1347), False, 'fro... |
# Copyright (c) 2018-2021, Texas Instruments
# All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions... | [
"tensorflow.compat.v1.lite.TFLiteConverter.from_frozen_graph",
"os.makedirs",
"os.path.split"
] | [((2213, 2251), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exist_ok': '(True)'}), '(output_dir, exist_ok=True)\n', (2224, 2251), False, 'import os\n'), ((2306, 2433), 'tensorflow.compat.v1.lite.TFLiteConverter.from_frozen_graph', 'tf.compat.v1.lite.TFLiteConverter.from_frozen_graph', (['graph_def_file', 'input_ar... |
import pickle
import numpy as np
import matplotlib.pyplot as plt
with open('./quadratic/eval_record.pickle','rb') as loss:
data = pickle.load(loss)
print('Mat_record',len(data['Mat_record']))
#print('bias',data['inter_gradient_record'])
#print('constant',data['intra_record'])
with open('./quadratic/evaluate_reco... | [
"numpy.array",
"pickle.load"
] | [((382, 409), 'numpy.array', 'np.array', (["data1['x_record']"], {}), "(data1['x_record'])\n", (390, 409), True, 'import numpy as np\n'), ((135, 152), 'pickle.load', 'pickle.load', (['loss'], {}), '(loss)\n', (146, 152), False, 'import pickle\n'), ((359, 377), 'pickle.load', 'pickle.load', (['loss1'], {}), '(loss1)\n',... |
import copy
# Saves room and client list
initialMsg = ':JACK! {0.0.0.0, 5000} PRIVMSG #: /JOIN #\n' # {IP,port}
msg = "PRIVMSG #cats: Hello World! I'm back!\n"
qmsg = "PRIVMSG #cats: /part #cats"
client = "('127.0.0.1', 41704)"
message = {'nick': '', 'client': '', 'chan': '', 'cmd': '', 'msg': ''}
test = ":BEN! {('127... | [
"copy.deepcopy"
] | [((2767, 2791), 'copy.deepcopy', 'copy.deepcopy', (['string[0]'], {}), '(string[0])\n', (2780, 2791), False, 'import copy\n'), ((3603, 3624), 'copy.deepcopy', 'copy.deepcopy', (['client'], {}), '(client)\n', (3616, 3624), False, 'import copy\n'), ((3655, 3678), 'copy.deepcopy', 'copy.deepcopy', (['self.var'], {}), '(se... |
#
# (C) Copyright IBM Corp. 2021
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | [
"logging.getLogger",
"pathlib.Path.home",
"time.sleep",
"ray.autoscaler.node_provider.NodeProvider.__init__",
"pathlib.Path",
"json.dumps",
"threading.RLock",
"concurrent.futures.as_completed",
"socket.gethostname",
"inspect.stack",
"ray.autoscaler._private.cli_logger.cli_logger.print",
"re.ma... | [((1229, 1256), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1246, 1256), False, 'import logging\n'), ((1616, 1664), 'ibm_vpc.VpcV1', 'VpcV1', (['"""2021-01-19"""'], {'authenticator': 'authenticator'}), "('2021-01-19', authenticator=authenticator)\n", (1621, 1664), False, 'from ibm_vpc... |
from django.forms import TextInput
from django.forms.widgets import MultiWidget, RadioSelect
from django.template.loader import render_to_string
class MultiTextWidget(MultiWidget):
def __init__(self, widgets_length, **kwargs):
widgets = [TextInput() for _ in range(widgets_length)]
kwargs.update({"... | [
"django.template.loader.render_to_string",
"django.forms.TextInput"
] | [((543, 636), 'django.template.loader.render_to_string', 'render_to_string', (['"""formly/run/_multiple_input.html"""'], {'context': "{'inputs': rendered_widgets}"}), "('formly/run/_multiple_input.html', context={'inputs':\n rendered_widgets})\n", (559, 636), False, 'from django.template.loader import render_to_stri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A simple logger to look at eddn messages passing.
Terminate with a simple Ctlr+C
"""
import os
import sys
import time
import zlib
import argparse
import zmq
try:
import rapidjson as json
except ImportError:
import json
EDDN_ADDR = "tcp://eddn.edcd.io:9500"
T... | [
"argparse.ArgumentParser",
"zmq.ZMQError",
"json.dumps",
"os.path.join",
"time.sleep",
"zmq.Context",
"zlib.decompress"
] | [((1810, 1860), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""EDDN Logger"""'}), "(description='EDDN Logger')\n", (1833, 1860), False, 'import argparse\n'), ((881, 922), 'json.dumps', 'json.dumps', (['msg'], {'indent': '(2)', 'sort_keys': '(True)'}), '(msg, indent=2, sort_keys=True)\n',... |
# Generated by Django 3.2 on 2022-03-09 19:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0002_auto_20220309_1545'),
]
operations = [
migrations.AlterField(
model_name='user',
name='date_of_birth',
... | [
"django.db.models.DateField",
"django.db.models.CharField"
] | [((336, 393), 'django.db.models.DateField', 'models.DateField', ([], {'null': '(True)', 'verbose_name': '"""Date of birth"""'}), "(null=True, verbose_name='Date of birth')\n", (352, 393), False, 'from django.db import migrations, models\n'), ((522, 596), 'django.db.models.CharField', 'models.CharField', ([], {'max_leng... |
#!/bin/python3
# pdfpng - convert pdf to png
# Copyright (C) 2022 ArcNyxx
# see LICENCE file for licensing information
import sys
import fitz as pdf
if len(sys.argv) != 2:
print("usage: pdfpng [file]")
sys.exit()
doc = pdf.open(sys.argv[1])
for num, page in enumerate(doc):
pixmap = page.get_pixmap()
... | [
"fitz.open",
"sys.exit"
] | [((230, 251), 'fitz.open', 'pdf.open', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (238, 251), True, 'import fitz as pdf\n'), ((212, 222), 'sys.exit', 'sys.exit', ([], {}), '()\n', (220, 222), False, 'import sys\n')] |
import socket
def is_connectable(host, port):
sock = None
try:
sock = socket.create_connection((host, port), 1)
result = True
except socket.error:
result = False
finally:
if sock:
sock.close()
return result
| [
"socket.create_connection"
] | [((94, 135), 'socket.create_connection', 'socket.create_connection', (['(host, port)', '(1)'], {}), '((host, port), 1)\n', (118, 135), False, 'import socket\n')] |
import pandas as pd
import matplotlib.pyplot as plt
from src.utils.function_libraries import *
from src.utils.data_utils import *
from src.utils.identification.PI_Identifier import PI_Identifier
from src.utils.solution_processing import *
from differentiation.spectral_derivative import compute_spectral_derivative
from ... | [
"os.path.exists",
"pickle.dump",
"sympy.utilities.codegen.codegen",
"pandas.read_csv",
"matplotlib.use",
"sklearn.model_selection.train_test_split",
"src.utils.identification.PI_Identifier.PI_Identifier",
"os.path.join",
"matplotlib.pyplot.style.use",
"sympy.latex",
"pickle.load",
"os.chdir",
... | [((849, 927), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""src"""', '"""utils"""', '"""visualization"""', '"""BystrickyK.mplstyle"""'], {}), "(ROOT_DIR, 'src', 'utils', 'visualization', 'BystrickyK.mplstyle')\n", (861, 927), False, 'import os\n'), ((946, 984), 'matplotlib.pyplot.style.use', 'plt.style.use', (["{'s... |
import logging
import os
import json
from errors import throw_input_data_is_corrupted, throw_table_does_not_exist
DATA_FILE_SUFFIX = '.db'
def generate_data_file_name(table):
return table+DATA_FILE_SUFFIX
def get_table_name_from_data_file(data_file):
return data_file.replace(DATA_FILE_SUFFIX,'')
def split_d... | [
"os.path.exists",
"json.loads",
"errors.throw_table_does_not_exist",
"json.dumps",
"errors.throw_input_data_is_corrupted"
] | [((559, 589), 'os.path.exists', 'os.path.exists', (['data_file_name'], {}), '(data_file_name)\n', (573, 589), False, 'import os\n'), ((397, 428), 'errors.throw_input_data_is_corrupted', 'throw_input_data_is_corrupted', ([], {}), '()\n', (426, 428), False, 'from errors import throw_input_data_is_corrupted, throw_table_d... |
import tempfile
import pandas as pd
from pg2pd import Pg2Pd
def test_make_df_1(pg_conn):
"""Test of main Postgres binary data to Pandas dataframe pipeline.
This tests an integer and varchar.
"""
cursor = pg_conn.cursor()
# Copy binary data to a tempfile
path = tempfile.mkstemp()[1]
que... | [
"tempfile.mkstemp",
"pg2pd.Pg2Pd"
] | [((469, 520), 'pg2pd.Pg2Pd', 'Pg2Pd', (['path', "['integer', 'varchar']", "['id', 'text']"], {}), "(path, ['integer', 'varchar'], ['id', 'text'])\n", (474, 520), False, 'from pg2pd import Pg2Pd\n'), ((291, 309), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (307, 309), False, 'import tempfile\n'), ((996, 10... |
import asyncio
from NewsClassificator.news import News
@asyncio.coroutine
def read(file_name, code='utf-8'):
"""
async generator to read file in with special delimeter
:param file_name: the way to the file
:param code: encoding of file (utf-8)
:return: generator with all parts of file
"""
... | [
"NewsClassificator.news.News"
] | [((415, 425), 'NewsClassificator.news.News', 'News', (['line'], {}), '(line)\n', (419, 425), False, 'from NewsClassificator.news import News\n')] |
from django.db import models
from django.conf import settings
from django.contrib.postgres.search import SearchVectorField
from django.contrib.auth.models import AbstractUser
from django.utils import timezone
# BOOK-RELATED MODELS
class Books(models.Model):
title = models.CharField(max_length=5125)
year... | [
"django.db.models.Index",
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.DateField",
"django.db.models.UniqueConstraint",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.Func",
"django.db.models.ManyToManyField",
"django.db.mode... | [((278, 311), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(5125)'}), '(max_length=5125)\n', (294, 311), False, 'from django.db import models\n'), ((323, 344), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (342, 344), False, 'from django.db import models\n'), ((359,... |
""" Tests for the client credentials grant flow. """
from txoauth2.clients import PublicClient
from txoauth2.token import TokenResource
from txoauth2.errors import UnauthorizedClientError, MissingParameterError, \
MultipleParameterError, InvalidScopeError
from tests import getTestPasswordClient
from tests.unit.te... | [
"txoauth2.errors.MultipleParameterError",
"txoauth2.errors.InvalidScopeError",
"txoauth2.token.TokenResource",
"tests.getTestPasswordClient",
"txoauth2.errors.UnauthorizedClientError",
"txoauth2.clients.PublicClient",
"txoauth2.errors.MissingParameterError"
] | [((748, 842), 'tests.getTestPasswordClient', 'getTestPasswordClient', (['"""unauthorizedClientCredentialsGrantClient"""'], {'authorizedGrantTypes': '[]'}), "('unauthorizedClientCredentialsGrantClient',\n authorizedGrantTypes=[])\n", (769, 842), False, 'from tests import getTestPasswordClient\n'), ((1578, 1695), 'txo... |
from __future__ import annotations
import requests
from requests.auth import HTTPBasicAuth
from dataclasses import dataclass, asdict
from mashumaro import DataClassJSONMixin
@dataclass
class Response(DataClassJSONMixin):
statusCode: int = 200
body: str = ''
@classmethod
def of(cls, status_code: int, ... | [
"requests.auth.HTTPBasicAuth",
"dataclasses.asdict"
] | [((446, 458), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (452, 458), False, 'from dataclasses import dataclass, asdict\n'), ((666, 703), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (['"""username"""', '"""password"""'], {}), "('username', 'password')\n", (679, 703), False, 'from requests.auth impor... |
import typer
from pathlib import Path
import yaml
from scTenifold import scTenifoldNet, scTenifoldKnk
app = typer.Typer()
@app.command(name="config")
def get_config_file(
config_type: int = typer.Option(1, "--type", "-t",
help="Type, 1: scTenifoldNet, 2: scTenifoldKnk"... | [
"scTenifold.scTenifoldKnk.load_config",
"yaml.dump",
"typer.Option",
"pathlib.Path",
"scTenifold.scTenifoldKnk.get_empty_config",
"typer.Typer",
"yaml.safe_load",
"scTenifold.scTenifoldNet.get_empty_config",
"scTenifold.scTenifoldNet.load_config"
] | [((109, 122), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (120, 122), False, 'import typer\n'), ((201, 300), 'typer.Option', 'typer.Option', (['(1)', '"""--type"""', '"""-t"""'], {'help': '"""Type, 1: scTenifoldNet, 2: scTenifoldKnk"""', 'min': '(1)', 'max': '(2)'}), "(1, '--type', '-t', help=\n 'Type, 1: scTeni... |
from singlecellmultiomics.modularDemultiplexer.baseDemultiplexMethods import UmiBarcodeDemuxMethod
class chrom10x_c16_u12(UmiBarcodeDemuxMethod):
def __init__(self, barcodeFileParser, **kwargs):
self.barcodeFileAlias = '10x_3M-february-2018'
UmiBarcodeDemuxMethod.__init__(
self,
... | [
"singlecellmultiomics.modularDemultiplexer.baseDemultiplexMethods.UmiBarcodeDemuxMethod.__init__"
] | [((263, 538), 'singlecellmultiomics.modularDemultiplexer.baseDemultiplexMethods.UmiBarcodeDemuxMethod.__init__', 'UmiBarcodeDemuxMethod.__init__', (['self'], {'umiRead': '(0)', 'umiStart': '(16)', 'umiLength': '(12)', 'barcodeRead': '(0)', 'barcodeStart': '(0)', 'barcodeLength': '(16)', 'random_primer_read': 'None', 'r... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# read CSV data into a "dataframe" - pandas can parse dates
# this will be familiar to R users (not so much matlab users)
df = pd.read_csv('data/SHA.csv', index_col=0, parse_dates=True)
Q = df.SHA_INFLOW_CFS # a pandas series (daily)
# Q = Q.resa... | [
"pandas.read_csv",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlim",
"pandas.plotting.autocorrelation_plot",
"statsmodels.tsa.stattools.pacf"
] | [((200, 258), 'pandas.read_csv', 'pd.read_csv', (['"""data/SHA.csv"""'], {'index_col': '(0)', 'parse_dates': '(True)'}), "('data/SHA.csv', index_col=0, parse_dates=True)\n", (211, 258), True, 'import pandas as pd\n'), ((427, 462), 'pandas.plotting.autocorrelation_plot', 'pd.plotting.autocorrelation_plot', (['Q'], {}), ... |
import json
import os
import unittest
from functools import wraps
import mock
from lambdas import my_pi_lambda
EVENTS = json.load(open(os.path.join(os.path.dirname(__file__), 'sample_events.json')))
def forall_events(f):
@wraps(f)
def wrapper(*args, **kwds):
for event_meta in EVENTS:
kw... | [
"lambdas.my_pi_lambda.get_slots",
"lambdas.my_pi_lambda.lambda_handler",
"functools.wraps",
"mock.patch.object",
"os.path.dirname",
"unittest.main",
"lambdas.my_pi_lambda.get_intent"
] | [((231, 239), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (236, 239), False, 'from functools import wraps\n'), ((1984, 1999), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1997, 1999), False, 'import unittest\n'), ((757, 787), 'lambdas.my_pi_lambda.get_intent', 'my_pi_lambda.get_intent', (['event'], {}), '... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
from webdriver_manager.chrome import ChromeDriverManager
import re
from itertools import groupby
import pandas as pd
import googlemaps
browser = webdriver.Chrome(ChromeDriverManager().inst... | [
"itertools.groupby",
"googlemaps.Client",
"time.sleep",
"bs4.BeautifulSoup",
"webdriver_manager.chrome.ChromeDriverManager"
] | [((554, 584), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': 'API_key'}), '(key=API_key)\n', (571, 584), False, 'import googlemaps\n'), ((1020, 1069), 'bs4.BeautifulSoup', 'BeautifulSoup', (['browser.page_source', '"""html.parser"""'], {}), "(browser.page_source, 'html.parser')\n", (1033, 1069), False, 'from bs... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 25 12:41:40 2021
@author: jtm545
"""
#%%
import sys
sys.path.insert(0, '../')
import random
from colour.plotting import plot_chromaticity_diagram_CIE1931
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from scipy.optimize... | [
"sys.path.insert",
"pandas.read_csv",
"seaborn.set_context",
"scipy.optimize.minimize",
"seaborn.set_style",
"silentsub.problem.SilentSubstitutionProblem"
] | [((124, 149), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (139, 149), False, 'import sys\n'), ((492, 519), 'seaborn.set_context', 'sns.set_context', (['"""notebook"""'], {}), "('notebook')\n", (507, 519), True, 'import seaborn as sns\n'), ((520, 546), 'seaborn.set_style', 'sns.set_... |
"""
Exception handling used by **MSL-Qt**.
"""
import logging
import traceback
from . import QtWidgets, Qt, application
logger = logging.getLogger(__name__)
def excepthook(exc_type, exc_obj, exc_traceback):
"""Displays unhandled exceptions in a :class:`QtWidgets.QMessageBox`.
See :func:`sys.excepthook` for... | [
"logging.getLogger",
"traceback.format_tb"
] | [((131, 158), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (148, 158), False, 'import logging\n'), ((1258, 1292), 'traceback.format_tb', 'traceback.format_tb', (['exc_traceback'], {}), '(exc_traceback)\n', (1277, 1292), False, 'import traceback\n')] |
import unittest
from calculator import multiply
class TestSomething(unittest.TestCase):
def test_multiply(self):
self.assertEqual(6, multiply(2,3))
if __name__ == '__main__':
unittest.main()
| [
"unittest.main",
"calculator.multiply"
] | [((181, 196), 'unittest.main', 'unittest.main', ([], {}), '()\n', (194, 196), False, 'import unittest\n'), ((137, 151), 'calculator.multiply', 'multiply', (['(2)', '(3)'], {}), '(2, 3)\n', (145, 151), False, 'from calculator import multiply\n')] |
#--SHAPES and TEXTS--#
import cv2
import numpy as np
#We are going to use the numpy library to create our matrix
#0 stands for black and 1 stands for white
img = np.zeros((512,512,3),np.uint8) # (height,width) and the channel, it gives us value range 0-255
#print(img)
#img[200:300,100:300] = 255,0,0 #whole... | [
"cv2.rectangle",
"cv2.line",
"cv2.putText",
"cv2.imshow",
"cv2.circle",
"numpy.zeros",
"cv2.waitKey"
] | [((173, 206), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (181, 206), True, 'import numpy as np\n'), ((395, 462), 'cv2.line', 'cv2.line', (['img', '(0, 0)', '(img.shape[1], img.shape[0])', '(0, 255, 0)', '(3)'], {}), '(img, (0, 0), (img.shape[1], img.shape[0]), (0, 255... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... | [
"json.loads"
] | [((1903, 1926), 'json.loads', 'json.loads', (['params[key]'], {}), '(params[key])\n', (1913, 1926), False, 'import json\n')] |
# coding: utf-8
"""
Fulfillment API
Use the Fulfillment API to complete the process of packaging, addressing, handling, and shipping each order on behalf of the seller, in accordance with the payment method and timing specified at checkout. # noqa: E501
OpenAPI spec version: v1.19.10
Generated ... | [
"six.iteritems"
] | [((5200, 5233), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (5213, 5233), False, 'import six\n')] |
from unittest import TestCase
from datetime import datetime, timedelta
from tarefa_v2 import Tarefa, Projeto, TarefaNaoEncontrada
class TestTarefa(TestCase):
def test_tarefa_init(self):
tarefa = Tarefa('Lavar pratos')
self.assertEqual('Lavar pratos', tarefa.descricao)
self.assertFalse(ta... | [
"datetime.datetime.now",
"datetime.timedelta",
"tarefa_v2.Projeto",
"tarefa_v2.Tarefa"
] | [((210, 232), 'tarefa_v2.Tarefa', 'Tarefa', (['"""Lavar pratos"""'], {}), "('Lavar pratos')\n", (216, 232), False, 'from tarefa_v2 import Tarefa, Projeto, TarefaNaoEncontrada\n'), ((434, 456), 'tarefa_v2.Tarefa', 'Tarefa', (['"""Lavar pratos"""'], {}), "('Lavar pratos')\n", (440, 456), False, 'from tarefa_v2 import Tar... |
import copy
import unittest
from keydra.config import KeydraConfig
from keydra.exceptions import ConfigException
from unittest.mock import MagicMock
from unittest.mock import patch
ENVS = {
'dev': {
'description': 'AWS Development Environment',
'type': 'aws',
'access': 'dev',
'i... | [
"copy.deepcopy",
"unittest.mock.MagicMock",
"keydra.config.KeydraConfig",
"unittest.mock.patch.object",
"unittest.mock.patch"
] | [((9066, 9101), 'unittest.mock.patch', 'patch', (['"""keydra.loader.build_client"""'], {}), "('keydra.loader.build_client')\n", (9071, 9101), False, 'from unittest.mock import patch\n'), ((3889, 3900), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (3898, 3900), False, 'from unittest.mock import MagicMock\n'... |
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Input, Dense, Flatten, Conv2D, BatchNormalization, Lambda, Concatenate, Conv2DTranspose, Reshape, ReLU
from tensorflow.keras.applications import DenseNet121
# tf.config.experimental_run_functions_eagerly(True)
# with tf.dev... | [
"tensorflow.keras.applications.DenseNet121",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Activation"
] | [((1471, 1521), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', ([], {'units': '(64)', 'activation': '"""relu"""'}), "(units=64, activation='relu')\n", (1492, 1521), True, 'import tensorflow as tf\n'), ((1544, 1594), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', ([], {'units': '(32)', 'activation'... |
from box import Box
from src import repos
from src.processors import SelfIteratingProcessor
from src.processors import use_cases
def CallbackDelivery(config: Box = None):
use_case = use_cases.DeliverCallbackUseCase(
delivery_outbox_repo=repos.DeliveryOutbox(config.DELIVERY_OUTBOX_REPO),
topic_base... | [
"src.processors.SelfIteratingProcessor",
"src.repos.DeliveryOutbox"
] | [((414, 455), 'src.processors.SelfIteratingProcessor', 'SelfIteratingProcessor', ([], {'use_case': 'use_case'}), '(use_case=use_case)\n', (436, 455), False, 'from src.processors import SelfIteratingProcessor\n'), ((251, 300), 'src.repos.DeliveryOutbox', 'repos.DeliveryOutbox', (['config.DELIVERY_OUTBOX_REPO'], {}), '(c... |
from django.shortcuts import get_object_or_404, redirect, render
from feincms3.plugins import external, html, richtext
from feincms3.regions import Regions
from feincms3.renderer import TemplatePluginRenderer
from .models import HTML, External, Image, Page, RichText, Snippet
renderer = TemplatePluginRenderer()
rend... | [
"django.shortcuts.redirect",
"feincms3.renderer.TemplatePluginRenderer"
] | [((291, 315), 'feincms3.renderer.TemplatePluginRenderer', 'TemplatePluginRenderer', ([], {}), '()\n', (313, 315), False, 'from feincms3.renderer import TemplatePluginRenderer\n'), ((862, 917), 'django.shortcuts.redirect', 'redirect', (['(page.redirect_to_url or page.redirect_to_page)'], {}), '(page.redirect_to_url or p... |
import os
from django.conf import settings
from django.contrib.auth import logout as django_logout
from django.contrib.sites.models import Site
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.views.generic import View, TemplateView
from luna_django_commons.app.mixins imp... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"os.path.join",
"django.shortcuts.redirect",
"luna_django_commons.app.mixins.get_login_context",
"django.contrib.sites.models.Site.objects.get_current",
"django.contrib.auth.logout"
] | [((1258, 1284), 'luna_django_commons.app.mixins.get_login_context', 'get_login_context', (['request'], {}), '(request)\n', (1275, 1284), False, 'from luna_django_commons.app.mixins import get_login_context\n'), ((1296, 1359), 'django.shortcuts.render', 'render', (['request', '"""static_pages/westlife/services.html"""',... |
#!/usr/bin/python3
import requests
import json
import searchguard.settings as settings
from searchguard.exceptions import RoleMappingException, CheckRoleMappingExistsException, ViewRoleMappingException, \
DeleteRoleMappingException, CreateRoleMappingException, ModifyRoleMappingException, CheckRoleExistsException, ... | [
"json.loads",
"json.dumps",
"searchguard.roles.check_role_exists",
"searchguard.exceptions.ViewAllRoleMappingException"
] | [((2315, 2355), 'json.loads', 'json.loads', (['view_all_sg_rolemapping.text'], {}), '(view_all_sg_rolemapping.text)\n', (2325, 2355), False, 'import json\n'), ((2419, 2492), 'searchguard.exceptions.ViewAllRoleMappingException', 'ViewAllRoleMappingException', (['"""Unknown error retrieving all role mappings"""'], {}), "... |
"""
QUBO API solvers
QUBO solvers from Meta Analytics # noqa: E501
The version of the OpenAPI document: v1
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import meta_analytics
from meta_analytics.model.solver_async_response import SolverAsyncRespon... | [
"unittest.main"
] | [((753, 768), 'unittest.main', 'unittest.main', ([], {}), '()\n', (766, 768), False, 'import unittest\n')] |
import configparser
import os
ApplicationDir = os.path.dirname(os.path.abspath(__file__))
HomeDir = os.path.expanduser('~')
CredentialDir = os.path.join(HomeDir, '.credentials')
if not os.path.exists(CredentialDir):
os.makedirs(CredentialDir)
CredentialFilePath = os.path.join(CredentialDir, 'CalSyncHAB.json')
Ca... | [
"os.path.exists",
"configparser.ConfigParser",
"os.makedirs",
"os.path.join",
"os.path.abspath",
"os.path.expanduser"
] | [((101, 124), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (119, 124), False, 'import os\n'), ((141, 178), 'os.path.join', 'os.path.join', (['HomeDir', '""".credentials"""'], {}), "(HomeDir, '.credentials')\n", (153, 178), False, 'import os\n'), ((271, 317), 'os.path.join', 'os.path.join', ... |
from django.core.exceptions import PermissionDenied
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.views.generic import ListView
from hours.models import TimecardObject, ReportingPeriod
from employees.models import UserData
from tock.utils import PermissionMixin
from .u... | [
"hours.models.ReportingPeriod.objects.count",
"employees.models.UserData.objects.filter",
"django.template.defaultfilters.slugify",
"hours.models.TimecardObject.objects.filter",
"django.urls.reverse"
] | [((1168, 1199), 'hours.models.ReportingPeriod.objects.count', 'ReportingPeriod.objects.count', ([], {}), '()\n', (1197, 1199), False, 'from hours.models import TimecardObject, ReportingPeriod\n'), ((1791, 1809), 'django.template.defaultfilters.slugify', 'slugify', (['choice[1]'], {}), '(choice[1])\n', (1798, 1809), Fal... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 15:10:58 2021
@author: nguy0936
"""
from pyenvnoise.utils import ptiread
data = ptiread('R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti')
import numpy as np
file_name = 'R:\CMPH-Windfarm Field Study\Hornsdale\set2\Recording-1.1.pti'
fid = open(file... | [
"numpy.fromfile",
"numpy.delete",
"pyenvnoise.utils.ptiread",
"numpy.array",
"numpy.transpose"
] | [((133, 209), 'pyenvnoise.utils.ptiread', 'ptiread', (['"""R:\\\\CMPH-Windfarm Field Study\\\\Hornsdale\\\\set2\\\\Recording-1.1.pti"""'], {}), "('R:\\\\CMPH-Windfarm Field Study\\\\Hornsdale\\\\set2\\\\Recording-1.1.pti')\n", (140, 209), False, 'from pyenvnoise.utils import ptiread\n'), ((2162, 2203), 'numpy.fromfile'... |
import numpy as np
from OpenGL.arrays import vbo
from .Mesh_utils import MeshFuncs, MeshSignals, BBox
import openmesh
import copy
from .Shader import *
orig_set_vertex_property_array = openmesh.PolyMesh.set_vertex_property_array
def svpa(self, prop_name, array=None, element_shape=None, element_value=None):
if ar... | [
"numpy.identity",
"numpy.product",
"openmesh.PolyMesh",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.empty",
"copy.deepcopy",
"numpy.shape",
"numpy.broadcast_to"
] | [((3084, 3116), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'np.float64'}), '(3, dtype=np.float64)\n', (3095, 3116), True, 'import numpy as np\n'), ((3133, 3165), 'numpy.identity', 'np.identity', (['(4)'], {'dtype': 'np.float64'}), '(4, dtype=np.float64)\n', (3144, 3165), True, 'import numpy as np\n'), ((7821,... |
#
from __future__ import print_function
import datetime as dt
import math
from apps.ots.strategy.performance import Performance
try:
import Queue as queue
except ImportError:
import queue
import numpy as np
import pandas as pd
#
from apps.ots.event.ots_event import OtsEvent
from apps.ots.event.signal_event impo... | [
"apps.ots.strategy.performance.Performance.calculate_sharpe_ratio",
"apps.ots.strategy.performance.Performance.calculate_drawdowns",
"apps.ots.strategy.naive_risk_manager.NaiveRiskManager",
"pandas.DataFrame",
"apps.ots.event.order_event.OrderEvent"
] | [((982, 1000), 'apps.ots.strategy.naive_risk_manager.NaiveRiskManager', 'NaiveRiskManager', ([], {}), '()\n', (998, 1000), False, 'from apps.ots.strategy.naive_risk_manager import NaiveRiskManager\n'), ((5963, 5994), 'pandas.DataFrame', 'pd.DataFrame', (['self.all_holdings'], {}), '(self.all_holdings)\n', (5975, 5994),... |
import numpy as np
import pyautogui
import imutils
from mss import mss
from PIL import Image
import cv2
import copy
import argparse
from hand_poses import HandPoses
from hand_detect import HandDetect
from delay import Delay
from spotify_controls import SpotifyControls
parser = argparse.ArgumentParser()
parser.add_a... | [
"numpy.flip",
"delay.Delay",
"argparse.ArgumentParser",
"mss.mss",
"hand_poses.HandPoses",
"hand_detect.HandDetect",
"cv2.flip",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"copy.deepcopy",
"spotify_controls.SpotifyControls",
"cv2.waitKey"
] | [((282, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (305, 307), False, 'import argparse\n'), ((1307, 1357), 'hand_detect.HandDetect', 'HandDetect', ([], {'detect_threshold': 'args.detect_threshold'}), '(detect_threshold=args.detect_threshold)\n', (1317, 1357), False, 'from hand_detect ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '1.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setO... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QMainWindow",
"PyQt5.QtGui.QFont",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QPushButton"
] | [((5117, 5149), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (5139, 5149), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((5167, 5190), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (5188, 5190), False, 'from PyQt5 import QtCore, QtG... |
import explorer
import random
import os
import logic
import copy
import patches.dungeonEntrances
import patches.goal
from locations.items import *
class Error(Exception):
pass
class Randomizer:
def __init__(self, rom, options, *, seed=None):
self.seed = seed
if self.seed is ... | [
"itertools.accumulate",
"copy.deepcopy",
"logic.MultiworldLogic",
"random.Random",
"os.urandom",
"logic.Logic",
"explorer.Explorer"
] | [((386, 410), 'random.Random', 'random.Random', (['self.seed'], {}), '(self.seed)\n', (399, 410), False, 'import random\n'), ((5800, 5819), 'explorer.Explorer', 'explorer.Explorer', ([], {}), '()\n', (5817, 5819), False, 'import explorer\n'), ((351, 365), 'os.urandom', 'os.urandom', (['(16)'], {}), '(16)\n', (361, 365)... |
import numpy as np
from scipy.fft import fft
def CAR(X, labels):
N = X.shape
N_classes = len(np.unique(labels))
data10 = np.zeros((N[0], N[1], 1))
data11 = np.zeros((N[0], N[1], 1))
data12 = np.zeros((N[0], N[1], 1))
data13 = np.zeros((N[0], N[1], 1))
for trial in range(N[2]): ##... | [
"numpy.mean",
"numpy.unique",
"numpy.where",
"numpy.delete",
"numpy.array",
"numpy.zeros",
"numpy.vstack",
"scipy.fft.fft"
] | [((140, 165), 'numpy.zeros', 'np.zeros', (['(N[0], N[1], 1)'], {}), '((N[0], N[1], 1))\n', (148, 165), True, 'import numpy as np\n'), ((179, 204), 'numpy.zeros', 'np.zeros', (['(N[0], N[1], 1)'], {}), '((N[0], N[1], 1))\n', (187, 204), True, 'import numpy as np\n'), ((218, 243), 'numpy.zeros', 'np.zeros', (['(N[0], N[1... |
from typing import Optional, Callable, List
import torch as tc
import numpy as np
from drl.agents.architectures.stateless.abstract import StatelessArchitecture
class Identity(StatelessArchitecture):
"""
Identity architecture. Useful for unit testing.
"""
def __init__(
self,
i... | [
"numpy.prod"
] | [((938, 964), 'numpy.prod', 'np.prod', (['self._input_shape'], {}), '(self._input_shape)\n', (945, 964), True, 'import numpy as np\n')] |
import geog
import networkx as nx
import osmgraph
# By default any way with a highway tag will be loaded
g = osmgraph.parse_file('hawaii-latest.osm.bz2') # or .osm or .pbf
for n1, n2 in g.edges_iter():
c1, c2 = osmgraph.tools.coordinates(g, (n1, n2))
g[n1][n2]['length'] = geog.distance(c1, c2)
import ran... | [
"osmgraph.parse_file",
"osmgraph.tools.coordinates",
"itertools.groupby",
"json.dumps",
"geog.distance",
"networkx.shortest_path",
"osmgraph.tools.pairwise"
] | [((110, 154), 'osmgraph.parse_file', 'osmgraph.parse_file', (['"""hawaii-latest.osm.bz2"""'], {}), "('hawaii-latest.osm.bz2')\n", (129, 154), False, 'import osmgraph\n'), ((395, 436), 'networkx.shortest_path', 'nx.shortest_path', (['g', 'start', 'end', '"""length"""'], {}), "(g, start, end, 'length')\n", (411, 436), Tr... |
from random import random
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
from kivy.graphics import Color
from pyobjus import autoclass
class Ball(Widget):
vel... | [
"kivy.properties.NumericProperty",
"pyobjus.autoclass",
"random.random",
"kivy.vector.Vector",
"kivy.clock.Clock.schedule_interval",
"kivy.properties.ReferenceListProperty",
"kivy.properties.ObjectProperty"
] | [((330, 348), 'kivy.properties.NumericProperty', 'NumericProperty', (['(0)'], {}), '(0)\n', (345, 348), False, 'from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty\n'), ((366, 384), 'kivy.properties.NumericProperty', 'NumericProperty', (['(0)'], {}), '(0)\n', (381, 384), False, 'from kivy... |
import os, sys
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
try:
from data_handle.mid_object import *
except:
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from data_handle.mid_object import *
'''
Th... | [
"os.listdir",
"pathlib.Path",
"os.path.join",
"matplotlib.pyplot.close",
"os.path.dirname",
"matplotlib.pyplot.subplots",
"pandas.DataFrame",
"pandas.concat",
"matplotlib.patches.Circle",
"matplotlib.pyplot.show"
] | [((871, 891), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (881, 891), False, 'import os, sys\n'), ((2517, 2550), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'column_name'}), '(columns=column_name)\n', (2529, 2550), True, 'import pandas as pd\n'), ((2569, 2589), 'os.listdir', 'os.listdir', (... |
from setuptools import setup, find_packages
setup(
name = 'fundfind',
version = '0.1',
packages = find_packages(),
url = 'http://fundfind.cottagelabs.com',
author = '<NAME>',
author_email = '<EMAIL>',
description = 'fundfind - an Open way to share, visualise and map out scholarly funding op... | [
"setuptools.find_packages"
] | [((111, 126), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (124, 126), False, 'from setuptools import setup, find_packages\n')] |
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | [
"kmip.core.utils.BytearrayStream",
"kmip.core.errors.ErrorStrings.BAD_EXP_RECV.format",
"kmip.core.primitives.TextString",
"kmip.core.errors.ErrorStrings.BAD_ENCODING.format"
] | [((897, 920), 'kmip.core.utils.BytearrayStream', 'utils.BytearrayStream', ([], {}), '()\n', (918, 920), False, 'from kmip.core import utils\n'), ((945, 1039), 'kmip.core.errors.ErrorStrings.BAD_EXP_RECV.format', 'errors.ErrorStrings.BAD_EXP_RECV.format', (['"""primitives.TextString.{0}"""', '"""type"""', '"""{1}"""', '... |
import sys, os
for i in ["/task", "/workspace", "/program"]:
sys.path.append(os.path.dirname(os.path.realpath(__file__)) + i)
import taskManager, workspaceManager, programManager
commands = workspaceManager.commands + taskManager.commands + programManager.commands
os.environ["workspace"] = ""
def main():
p... | [
"os.path.realpath"
] | [((98, 124), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (114, 124), False, 'import sys, os\n')] |
'''
Hash and Acoustic Fingerprint Functions
<NAME>
'''
import numpy as np
def findAdjPts(index,A,delay_time,delta_time,delta_freq):
"Find the three closest adjacent points to the anchor point"
adjPts = []
low_x = A[index][0]+delay_time
high_x = low_x+delta_time
low_y = A[index][1]-delta_freq/2... | [
"numpy.all",
"numpy.sort"
] | [((1283, 1310), 'numpy.sort', 'np.sort', (['hashMatrix'], {'axis': '(0)'}), '(hashMatrix, axis=0)\n', (1290, 1310), True, 'import numpy as np\n'), ((2025, 2052), 'numpy.sort', 'np.sort', (['hashMatrix'], {'axis': '(0)'}), '(hashMatrix, axis=0)\n', (2032, 2052), True, 'import numpy as np\n'), ((1236, 1267), 'numpy.all',... |
from utils.stats_trajectories import trajectory_arclength
import statistics as stats
import numpy as np
import logging
# Returns a matrix of trajectories:
# the entry (i,j) has the paths that go from the goal i to the goal j
def separate_trajectories_between_goals(trajectories, goals_areas):
goals_n = len(goals_are... | [
"statistics.stdev",
"numpy.median",
"numpy.reshape",
"utils.stats_trajectories.trajectory_arclength",
"numpy.max",
"statistics.median",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.empty",
"numpy.square",
"numpy.concatenate",
"numpy.min",
"numpy.cov",
"logging.error",
"numpy.var"
... | [((370, 412), 'numpy.empty', 'np.empty', (['(goals_n, goals_n)'], {'dtype': 'object'}), '((goals_n, goals_n), dtype=object)\n', (378, 412), True, 'import numpy as np\n'), ((1884, 1904), 'statistics.median', 'stats.median', (['arclen'], {}), '(arclen)\n', (1896, 1904), True, 'import statistics as stats\n'), ((2437, 2486... |
import unittest
import DecodeMouseData as d
class FooTests(unittest.TestCase):
def setUp(self):
self.dmd = d.DecodeMouseData()
def testDecode(self):
expected = {'1':2, '3':4}
actual = self.dmd.decode('{"1":2, "3":4}')
self.assertEquals(actual, expected)
def testMouseDec... | [
"unittest.main",
"DecodeMouseData.DecodeMouseData"
] | [((1566, 1581), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1579, 1581), False, 'import unittest\n'), ((122, 141), 'DecodeMouseData.DecodeMouseData', 'd.DecodeMouseData', ([], {}), '()\n', (139, 141), True, 'import DecodeMouseData as d\n')] |
from rest_framework.routers import SimpleRouter, Route
class SwitchDetailRouter(SimpleRouter):
routes = [
Route(
url=r'^{prefix}/{lookup}{trailing_slash}$',
mapping={
'post': 'create',
'delete': 'destroy'
},
name='{basename}-sw... | [
"rest_framework.routers.Route"
] | [((119, 297), 'rest_framework.routers.Route', 'Route', ([], {'url': '"""^{prefix}/{lookup}{trailing_slash}$"""', 'mapping': "{'post': 'create', 'delete': 'destroy'}", 'name': '"""{basename}-switch"""', 'detail': '(True)', 'initkwargs': "{'suffix': 'Switch'}"}), "(url='^{prefix}/{lookup}{trailing_slash}$', mapping={'pos... |
from abc import ABC
from src.domanin.factories.repository_factory import RepositoryFactory
from src.infra.repositories.rest.github_data_rest_repository import GithubDataRestRepository
from src.infra.repositories.rest.schedule_rest_repository import ScheduleJsonRepository
class RestRepositoryFactory(RepositoryFactory... | [
"src.infra.repositories.rest.github_data_rest_repository.GithubDataRestRepository",
"src.infra.repositories.rest.schedule_rest_repository.ScheduleJsonRepository"
] | [((396, 422), 'src.infra.repositories.rest.github_data_rest_repository.GithubDataRestRepository', 'GithubDataRestRepository', ([], {}), '()\n', (420, 422), False, 'from src.infra.repositories.rest.github_data_rest_repository import GithubDataRestRepository\n'), ((514, 538), 'src.infra.repositories.rest.schedule_rest_re... |
"""Custom page renderers for Mon School.
The URLs that are handled here are:
/s/<sketch_id>.svg
/s/<sketch_id>-<hash>-s.png
/s/<sketch_id>-<hash>-w.png
"""
import frappe
import hashlib
import re
from pathlib import Path
import cairosvg
from frappe.website.page_renderers.base_renderer import BaseRenderer
from werkzeu... | [
"werkzeug.wrappers.Response",
"frappe.get_doc",
"pathlib.Path",
"re.compile"
] | [((580, 613), 're.compile', 're.compile', (['"""s/(\\\\d+).(svg|png)$"""'], {}), "('s/(\\\\d+).(svg|png)$')\n", (590, 613), False, 'import re\n'), ((1822, 1867), 're.compile', 're.compile', (['"""s/(.+)-([0-9a-f]+)-([smw]).png$"""'], {}), "('s/(.+)-([0-9a-f]+)-([smw]).png$')\n", (1832, 1867), False, 'import re\n'), ((1... |
"""
ec2.types
~~~~~~~~~
:copyright: (c) 2012 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from ec2.connection import get_connection
from ec2.base import objects_base
class instances(objects_base):
"Singleton to stem off queries for instances"
@classmethod
def _all(cls):
"Grab all... | [
"ec2.connection.get_connection"
] | [((608, 624), 'ec2.connection.get_connection', 'get_connection', ([], {}), '()\n', (622, 624), False, 'from ec2.connection import get_connection\n'), ((363, 379), 'ec2.connection.get_connection', 'get_connection', ([], {}), '()\n', (377, 379), False, 'from ec2.connection import get_connection\n')] |
import numpy as np
from utils.metrics import variation_ratio, entropy, bald
from utils.progress_bar import Progbar
def get_monte_carlo_metric(metric):
if metric == 'variation_ratio':
return VariationRationMC
elif metric == 'entropy':
return EntropyMC
elif metric == 'bald':
return ... | [
"numpy.mean",
"utils.metrics.bald",
"utils.metrics.variation_ratio",
"numpy.equal",
"numpy.array",
"numpy.zeros",
"numpy.bincount",
"numpy.random.uniform",
"utils.progress_bar.Progbar",
"numpy.amax",
"utils.metrics.entropy"
] | [((2651, 2711), 'numpy.zeros', 'np.zeros', ([], {'shape': '(self.data_batch.shape[0], self.num_samples)'}), '(shape=(self.data_batch.shape[0], self.num_samples))\n', (2659, 2711), True, 'import numpy as np\n'), ((3625, 3649), 'numpy.zeros', 'np.zeros', ([], {'shape': 'num_data'}), '(shape=num_data)\n', (3633, 3649), Tr... |
# Build-in modules
import configparser
import logging
import os
from functools import wraps
# from cryptography.fernet import Fernet
# from werkzeug.security import generate_password_hash, check_password_hash
from flask import jsonify, request
def authorization(f):
@wraps(f)
def decorated(*args, **kwargs):
... | [
"configparser.ConfigParser",
"functools.wraps",
"logging.exception",
"flask.request.headers.get",
"flask.jsonify"
] | [((274, 282), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (279, 282), False, 'from functools import wraps\n'), ((379, 406), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (404, 406), False, 'import configparser\n'), ((1361, 1397), 'logging.exception', 'logging.exception', (['e'], {'ex... |
import os
def hmms():
with open('Pfam-A.hmm') as f:
lines = []
for l in f:
lines.append(l)
if l.startswith('//'):
yield lines
lines = []
for hmm in hmms():
name = hmm[2].split()[1].split('.')[0]
with open(os.path.join('../data/hmms', '%s.HMM' % name), 'w') as f:
f.writeli... | [
"os.path.join"
] | [((249, 294), 'os.path.join', 'os.path.join', (['"""../data/hmms"""', "('%s.HMM' % name)"], {}), "('../data/hmms', '%s.HMM' % name)\n", (261, 294), False, 'import os\n')] |
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from Apps.models import App
class AppSerializer(serializers.ModelSerializer):
"""
Сериализатор приложения
"""
id = serializers.CharField(required=True, allow_null=False, allow_blank=False,
... | [
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.BooleanField",
"Apps.models.App.objects.create",
"Apps.models.App.objects.all",
"rest_framework.serializers.CharField"
] | [((402, 496), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'required': '(True)', 'allow_null': '(False)', 'allow_blank': '(False)', 'write_only': '(True)'}), '(required=True, allow_null=False, allow_blank=False,\n write_only=True)\n', (423, 496), False, 'from rest_framework import serialize... |
from __future__ import print_function
from numpy import pi, arange, sin, cos
import numpy as np
import os.path
import time
from bokeh.objects import (Plot, DataRange1d, LinearAxis, DatetimeAxis,
ColumnDataSource, Glyph, PanTool, WheelZoomTool)
from bokeh.glyphs import Circle
from bokeh import session
x = ara... | [
"bokeh.session.HTMLFileSession",
"bokeh.objects.Glyph",
"bokeh.objects.WheelZoomTool",
"bokeh.objects.LinearAxis",
"bokeh.objects.PanTool",
"bokeh.objects.DatetimeAxis",
"bokeh.glyphs.Circle",
"numpy.sin",
"bokeh.objects.Plot",
"time.time",
"numpy.arange"
] | [((317, 345), 'numpy.arange', 'arange', (['(-2 * pi)', '(2 * pi)', '(0.1)'], {}), '(-2 * pi, 2 * pi, 0.1)\n', (323, 345), False, 'from numpy import pi, arange, sin, cos\n'), ((350, 356), 'numpy.sin', 'sin', (['x'], {}), '(x)\n', (353, 356), False, 'from numpy import pi, arange, sin, cos\n'), ((690, 760), 'bokeh.glyphs.... |