code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""Testing constants for Bio2BEL GO."""
import os
from bio2bel.testing import AbstractTemporaryCacheClassMixin
from bio2bel_go import Manager
__all__ = [
'TemporaryCacheClass',
]
HERE = os.path.abspath(os.path.dirname(__file__))
TEST_GO_PATH = os.path.join(HERE, 'test_go.obo')
class T... | [
"os.path.dirname",
"os.path.join"
] | [((277, 310), 'os.path.join', 'os.path.join', (['HERE', '"""test_go.obo"""'], {}), "(HERE, 'test_go.obo')\n", (289, 310), False, 'import os\n'), ((235, 260), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (250, 260), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser, ArgumentTypeError
import codecs
import keyword
import os
import re
import subprocess
import sys
from shutil import copyfile
def _decode_stdin(value):
if sys.version_info.major < 3:
return value.decode(sys.stdin.encoding)
... | [
"os.path.exists",
"argparse.ArgumentParser",
"virtualenv.create_environment",
"os.path.join",
"os.environ.get",
"re.match",
"os.path.normpath",
"keyword.iskeyword",
"os.path.isdir",
"shutil.copyfile",
"subprocess.call",
"os.mkdir",
"sys.exit",
"os.path.abspath",
"codecs.open"
] | [((761, 785), 'keyword.iskeyword', 'keyword.iskeyword', (['value'], {}), '(value)\n', (778, 785), False, 'import keyword\n'), ((1257, 1273), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1271, 1273), False, 'from argparse import ArgumentParser, ArgumentTypeError\n'), ((2367, 2409), 'os.path.join', 'os... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... | [
"ooflib.common.IO.GUI.regclassfactory.RegisteredClassFactory.__init__"
] | [((1231, 1429), 'ooflib.common.IO.GUI.regclassfactory.RegisteredClassFactory.__init__', 'regclassfactory.RegisteredClassFactory.__init__', (['self', 'registry', '*args'], {'obj': 'obj', 'title': 'title', 'callback': 'callback', 'fill': 'fill', 'expand': 'expand', 'scope': 'scope', 'name': 'name', 'verbose': 'verbose'})... |
# Find angles in degrees of skeleton segments
import os
import cv2
import numpy as np
import pandas as pd
from plantcv.plantcv import params
from plantcv.plantcv import outputs
from plantcv.plantcv import color_palette
from plantcv.plantcv._debug import _debug
def segment_angle(segmented_img, objects, label="default... | [
"cv2.boxPoints",
"cv2.line",
"os.path.join",
"plantcv.plantcv.outputs.add_observation",
"cv2.putText",
"cv2.minAreaRect",
"pandas.DataFrame",
"cv2.fitLine",
"numpy.arctan"
] | [((2615, 2834), 'plantcv.plantcv.outputs.add_observation', 'outputs.add_observation', ([], {'sample': 'label', 'variable': '"""segment_angle"""', 'trait': '"""segment angle"""', 'method': '"""plantcv.plantcv.morphology.segment_angle"""', 'scale': '"""degrees"""', 'datatype': 'list', 'value': 'segment_angles', 'label': ... |
# Generated by Django 2.1.15 on 2021-03-14 13:53
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('stocks', '0004_auto_20210313_2253'),
migrations.swappable_depe... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((295, 352), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (326, 352), False, 'from django.db import migrations, models\n'), ((496, 547), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'... |
import scipy.sparse as sparse
def diffusionForMMatrix(A):
A = A.tocsr()
Am = A.maximum(0)
Am -= sparse.dia_matrix((Am.diagonal(),0),A.shape)
Am = Am.maximum(Am.T)
Am = Am + Am.T
diagp = Am.sum(axis=1).ravel()
D = sparse.dia_matrix((diagp,0),A.shape)
# print(f"{D.diagonal()=}\n {A.minimu... | [
"scipy.sparse.dia_matrix"
] | [((242, 280), 'scipy.sparse.dia_matrix', 'sparse.dia_matrix', (['(diagp, 0)', 'A.shape'], {}), '((diagp, 0), A.shape)\n', (259, 280), True, 'import scipy.sparse as sparse\n')] |
from pyspark.context import SparkContext
from pyspark.sql.session import SparkSession
import os
from pyspark.sql.functions import col,lit
def convert_columns_to_string(schema):
print(schema)
lst=[]
for name in set(schema):
lst.append("cast(`{col}` as string) as `{col}`".format(col=name))
... | [
"pyspark.sql.session.SparkSession",
"os.listdir",
"pyspark.context.SparkContext"
] | [((1566, 1587), 'pyspark.context.SparkContext', 'SparkContext', (['"""local"""'], {}), "('local')\n", (1578, 1587), False, 'from pyspark.context import SparkContext\n'), ((1596, 1612), 'pyspark.sql.session.SparkSession', 'SparkSession', (['sc'], {}), '(sc)\n', (1608, 1612), False, 'from pyspark.sql.session import Spark... |
"""
@author: <NAME>
@date: 29-May-17
@intepreter: Python 3.6
"""
import sqlite3 as lite
con = lite.connect('todo.db')
with con:
cur = con.cursor()
cur.execute("SELECT * FROM Cars;")
rows = cur.fetchall()
for row in rows:
print(row) | [
"sqlite3.connect"
] | [((96, 119), 'sqlite3.connect', 'lite.connect', (['"""todo.db"""'], {}), "('todo.db')\n", (108, 119), True, 'import sqlite3 as lite\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import find_packages, setup
with open("requirements.txt") as f:
reqs = f.read().splitlines()
description = """Benchmark of the data augmentation libraries"""
setup(
author="<NAME>",
author_email="<EMAIL>",
classif... | [
"setuptools.find_packages"
] | [((1074, 1109), 'setuptools.find_packages', 'find_packages', ([], {'include': "['augbench']"}), "(include=['augbench'])\n", (1087, 1109), False, 'from setuptools import find_packages, setup\n')] |
import time, os, sys
import numpy as np
import signal
import random
from alarmexception import AlarmException
from getch import _getChUnix as getChar
from colorama import init, Fore, Back, Style
init()
HEIGHT=40
WIDTH=90
PADDLE_LEN = 10
INPUT_CHAR=''
LIVES = [20]
LEVEL = [1]
SCORE = [0]
START = [0]
START_LVL = [0]
FAL... | [
"os.system",
"colorama.init"
] | [((195, 201), 'colorama.init', 'init', ([], {}), '()\n', (199, 201), False, 'from colorama import init, Fore, Back, Style\n'), ((1130, 1175), 'os.system', 'os.system', (['"""aplay -q ./sounds/sound_win.wav&"""'], {}), "('aplay -q ./sounds/sound_win.wav&')\n", (1139, 1175), False, 'import time, os, sys\n'), ((2315, 2366... |
from .utils import columns_to_title_case, positions_output_path
from openpyxl import Workbook as Wb
from openpyxl.utils.dataframe import dataframe_to_rows
class Sheet:
_BRL_FORMAT = '_-"R$"\ * #,##0.00_-;\-"R$"\ * #,##0.00_-;_-"R$"\ * "-"??_-;_-@_-'
_DATE_FORMAT = "dd/mm/yy"
def __init__(self, ws):
... | [
"openpyxl.utils.dataframe.dataframe_to_rows",
"openpyxl.Workbook"
] | [((1240, 1244), 'openpyxl.Workbook', 'Wb', ([], {}), '()\n', (1242, 1244), True, 'from openpyxl import Workbook as Wb\n'), ((1394, 1428), 'openpyxl.utils.dataframe.dataframe_to_rows', 'dataframe_to_rows', (['df'], {'index': '(False)'}), '(df, index=False)\n', (1411, 1428), False, 'from openpyxl.utils.dataframe import d... |
from django.shortcuts import render
from django.core import serializers
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.conf import settings
import json
import datetime
from registrar.models import Course
from registr... | [
"django.shortcuts.render",
"registrar.models.Student.objects.get",
"registrar.models.CourseFinalMark.objects.create",
"json.dumps",
"registrar.models.Course.objects.get",
"registrar.models.AssignmentSubmission.objects.filter",
"registrar.models.CourseFinalMark.objects.get",
"registrar.models.QuizSubmi... | [((530, 567), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/landpage"""'}), "(login_url='/landpage')\n", (544, 567), False, 'from django.contrib.auth.decorators import login_required\n'), ((1459, 1475), 'django.contrib.auth.decorators.login_required', 'login_required', ([], ... |
from typing import TYPE_CHECKING
from discordmenu.embed.base import Box
from discordmenu.embed.text import LinkedText, Text
from tsutils.enums import Server
from padinfo.common.emoji_map import get_attribute_emoji_by_monster
from padinfo.common.external_links import puzzledragonx
if TYPE_CHECKING:
from dbcog.mod... | [
"padinfo.common.external_links.puzzledragonx",
"discordmenu.embed.text.Text",
"padinfo.common.emoji_map.get_attribute_emoji_by_monster"
] | [((1494, 1503), 'discordmenu.embed.text.Text', 'Text', (['msg'], {}), '(msg)\n', (1498, 1503), False, 'from discordmenu.embed.text import LinkedText, Text\n'), ((1716, 1725), 'discordmenu.embed.text.Text', 'Text', (['msg'], {}), '(msg)\n', (1720, 1725), False, 'from discordmenu.embed.text import LinkedText, Text\n'), (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This module implements the handler for sound mode of Denon AVR receivers.
:copyright: (c) 2021 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
from copy import deepcopy
import logging
from collections import OrderedDict
from typing import Dict, Hashable,... | [
"logging.getLogger",
"attr.s",
"attr.converters.optional",
"attr.validators.instance_of",
"attr.Factory",
"copy.deepcopy"
] | [((579, 606), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (596, 606), False, 'import logging\n'), ((1443, 1499), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)', 'on_setattr': 'DENON_ATTR_SETATTR'}), '(auto_attribs=True, on_setattr=DENON_ATTR_SETATTR)\n', (1449, 1499), False, 'impor... |
"""MS COCO Key Points Evaluate Metrics."""
from __future__ import absolute_import
import os
from os import path as osp
from collections import OrderedDict
import warnings
try:
from mxnet.metric import EvalMetric
except ImportError:
from mxnet.gluon.metric import EvalMetric
class COCOKeyPointsMetric(EvalMetric... | [
"os.path.expanduser",
"collections.OrderedDict",
"pycocotools.cocoeval.COCOeval",
"datetime.datetime.now",
"json.dump",
"os.remove"
] | [((3275, 3306), 'pycocotools.cocoeval.COCOeval', 'COCOeval', (['gt', 'pred', '"""keypoints"""'], {}), "(gt, pred, 'keypoints')\n", (3283, 3306), False, 'from pycocotools.cocoeval import COCOeval\n'), ((3907, 3928), 'collections.OrderedDict', 'OrderedDict', (['info_str'], {}), '(info_str)\n', (3918, 3928), False, 'from ... |
# Copyright (c) 2020 AllSeeingEyeTolledEweSew
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERC... | [
"tvaf.app.App",
"signal.signal",
"signal.pause",
"argparse.ArgumentParser"
] | [((894, 930), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""TVAF"""'}), "(prog='TVAF')\n", (917, 930), False, 'import argparse\n'), ((1173, 1206), 'tvaf.app.App', 'app_lib.App', (['self.args.config_dir'], {}), '(self.args.config_dir)\n', (1184, 1206), True, 'from tvaf import app as app_lib\n')... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import argparse
from io import BytesIO
import tensorflow as tf
from PIL import ImageFont
from model.dataset import get_batch_iter
from model.preprocessing_helper import save_imgs, draw_paired_image, CHAR_SIZE, \
... | [
"argparse.ArgumentParser",
"model.preprocessing_helper.draw_paired_image",
"tensorflow.Session",
"model.dataset.get_batch_iter",
"model.preprocessing_helper.draw_single_char_by_font",
"PIL.ImageFont.truetype",
"model.unet.UNet",
"io.BytesIO",
"tensorflow.ConfigProto",
"model.preprocessing_helper.s... | [((551, 615), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Inference for unseen data"""'}), "(description='Inference for unseen data')\n", (574, 615), False, 'import argparse\n'), ((1999, 2015), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (2013, 2015), True, 'import t... |
import os
import sys
import re
import requests
import yaml
def load_yaml(file_path):
"""
Load yaml file
:param file_path: path of the yaml file ready to load
:return: content of the file
"""
try:
with open(file_path, 'r', encoding='utf-8') as fp:
content = yaml.load(fp.read... | [
"re.match",
"requests.get",
"sys.exit"
] | [((1113, 1130), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1125, 1130), False, 'import requests\n'), ((11354, 11365), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (11362, 11365), False, 'import sys\n'), ((11842, 11853), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (11850, 11853), False, 'import sy... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | [
"mxnet.image.ImageIter"
] | [((1308, 1466), 'mxnet.image.ImageIter', 'mx.image.ImageIter', (['(2)', '(3, 224, 224)'], {'imglist': 'self.imglist', 'path_root': '"""tests/data/test_images"""', 'label_name': '"""softmax_label"""', 'data_name': 'self.data_name'}), "(2, (3, 224, 224), imglist=self.imglist, path_root=\n 'tests/data/test_images', lab... |
import numpy as np
import time
from sklearn.utils import check_random_state
from scipy.special import expit
def sigmoid(x):
return expit(np.clip(x, -30, 30))
class RestrictedBoltzmannMachine:
def __init__(self, n_hidden_variables, learning_rate=0.1, batch_size=20,
n_epochs=15, mu=0.5, pcd_st... | [
"numpy.clip",
"sklearn.utils.check_random_state",
"numpy.sqrt",
"numpy.random.random",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"time.time"
] | [((143, 162), 'numpy.clip', 'np.clip', (['x', '(-30)', '(30)'], {}), '(x, -30, 30)\n', (150, 162), True, 'import numpy as np\n'), ((700, 737), 'sklearn.utils.check_random_state', 'check_random_state', (['self.random_state'], {}), '(self.random_state)\n', (718, 737), False, 'from sklearn.utils import check_random_state\... |
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import booz_xform as bx
wout_filename = 'test_files/wout_li383_1.4m.nc'
b = bx.Booz_xform()
b.read_wout(wout_filename)
b.compute_surfs = [47]
b.run()
bx.surfplot(b)
plt.tight_layout()
plt.figure()
bx.surfplot(b, fill=False, cmap=plt.cm.jet, le... | [
"booz_xform.surfplot",
"booz_xform.Booz_xform",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((152, 167), 'booz_xform.Booz_xform', 'bx.Booz_xform', ([], {}), '()\n', (165, 167), True, 'import booz_xform as bx\n'), ((226, 240), 'booz_xform.surfplot', 'bx.surfplot', (['b'], {}), '(b)\n', (237, 240), True, 'import booz_xform as bx\n'), ((241, 259), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), ... |
import os
import click
import json
from shutil import copy, copytree
from typing import List
from .utils import PyprSetup
@click.command(name='build')
@click.option('--project', '-p', type=str, required=True,
help='Name of directory to be created for project')
@click.option('--name', '-n', type=str,
help=... | [
"os.path.exists",
"os.makedirs",
"click.option",
"os.path.join",
"os.getcwd",
"shutil.copytree",
"os.path.dirname",
"shutil.copy",
"click.command"
] | [((127, 154), 'click.command', 'click.command', ([], {'name': '"""build"""'}), "(name='build')\n", (140, 154), False, 'import click\n'), ((156, 269), 'click.option', 'click.option', (['"""--project"""', '"""-p"""'], {'type': 'str', 'required': '(True)', 'help': '"""Name of directory to be created for project"""'}), "('... |
# Copyright 2016-2021, Pulumi Corporation.
#
# 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 t... | [
"pulumi.Output.from_input",
"pulumi.runtime.mocks.set_mocks",
"pulumi.resource.DependencyProviderResource",
"pulumi.runtime.settings.configure",
"pulumi.ResourceOptions",
"pulumi.Output.all",
"asyncio.Future",
"typing.TypeVar"
] | [((859, 871), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (866, 871), False, 'from typing import Optional, TypeVar, Awaitable, List, Any\n'), ((3096, 3112), 'asyncio.Future', 'asyncio.Future', ([], {}), '()\n', (3110, 3112), False, 'import asyncio\n'), ((3198, 3225), 'pulumi.Output.from_input', 'pulumi.O... |
import re
my_input = '1'
# check for one or more digits
digits_test = re.search('^\d+', my_input)
if digits_test:
print("We have one or more digits!")
else:
print("Invalid data") | [
"re.search"
] | [((71, 99), 're.search', 're.search', (['"""^\\\\d+"""', 'my_input'], {}), "('^\\\\d+', my_input)\n", (80, 99), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved
"""Tests using pytest_resilient_circuits"""
from __future__ import print_function
from fn_aws_utilities.util.aws_sns_api import AwsSns
class TestSendSmsViaSns:
""" Tests for th... | [
"fn_aws_utilities.util.aws_sns_api.AwsSns"
] | [((750, 815), 'fn_aws_utilities.util.aws_sns_api.AwsSns', 'AwsSns', (['aws_access_key_id', 'aws_secret_access_key', 'aws_region_name'], {}), '(aws_access_key_id, aws_secret_access_key, aws_region_name)\n', (756, 815), False, 'from fn_aws_utilities.util.aws_sns_api import AwsSns\n')] |
import numpy as np
from flask import request
from chatbot.common.Debug import flush
from chatbot.common.Talk import parse, get_ml_vars, get_ml_model, create_input
from chatbot.api.helpers.responses.Talk import TalkResponse
from chatbot.models.TalkLog import TalkLogModel
from chatbot.api.domain.repositories.TalkLogRepos... | [
"chatbot.common.Talk.get_ml_model",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"chatbot.common.Talk.get_ml_vars",
"chatbot.models.TalkLog.TalkLogModel",
"chatbot.common.Talk.parse",
"chatbot.common.Talk.create_input"
] | [((679, 698), 'chatbot.common.Talk.get_ml_vars', 'get_ml_vars', (['bot_id'], {}), '(bot_id)\n', (690, 698), False, 'from chatbot.common.Talk import parse, get_ml_vars, get_ml_model, create_input\n'), ((715, 735), 'chatbot.common.Talk.get_ml_model', 'get_ml_model', (['bot_id'], {}), '(bot_id)\n', (727, 735), False, 'fro... |
from interface import default, Interface
import numpy as np
import pandas as pd
from zipline.utils.sentinel import sentinel
DEFAULT_FX_RATE = sentinel('DEFAULT_FX_RATE')
class FXRateReader(Interface):
def get_rates(self, rate, quote, bases, dts):
"""
Get rates to convert ``bases`` into ``quote... | [
"pandas.DatetimeIndex",
"numpy.array",
"zipline.utils.sentinel.sentinel"
] | [((145, 172), 'zipline.utils.sentinel.sentinel', 'sentinel', (['"""DEFAULT_FX_RATE"""'], {}), "('DEFAULT_FX_RATE')\n", (153, 172), False, 'from zipline.utils.sentinel import sentinel\n'), ((2280, 2310), 'numpy.array', 'np.array', (['[base]'], {'dtype': 'object'}), '([base], dtype=object)\n', (2288, 2310), True, 'import... |
# import glob
# import json
# import os
# import re
#
# from somajo import SoMaJo
# import spacy
#
# nlp = spacy.load("en_core_web_lg")
# nlp.disable_pipe("parser")
# nlp.enable_pipe("senter")
# tokenizer = SoMaJo("en_PTB")
#
#
# def sentencizer(text):
# sents = []
# doc = nlp(text)
# sent_lst = doc.sents
#... | [
"os.path.exists",
"os.path.getsize",
"os.makedirs",
"spacy.load",
"json.dump",
"somajo.SoMaJo",
"glob.glob"
] | [((2937, 2965), 'spacy.load', 'spacy.load', (['"""en_core_web_lg"""'], {}), "('en_core_web_lg')\n", (2947, 2965), False, 'import spacy\n'), ((3031, 3047), 'somajo.SoMaJo', 'SoMaJo', (['"""en_PTB"""'], {}), "('en_PTB')\n", (3037, 3047), False, 'from somajo import SoMaJo\n'), ((3270, 3294), 'glob.glob', 'glob.glob', (['"... |
"""This module specifies classes that model an application traffic pattern.
"""
from numpy.random import default_rng
import random
__all__ = [
"Application",
"SingleConstantApplication",
"SingleRandomApplication",
"MultiConstantApplication",
"MultiRandomApplication",
"MultiPoissonApplication",... | [
"random.sample",
"random.choices",
"numpy.random.default_rng"
] | [((4863, 4897), 'random.sample', 'random.sample', (['self._node_names', '(2)'], {}), '(self._node_names, 2)\n', (4876, 4897), False, 'import random\n'), ((7074, 7119), 'random.sample', 'random.sample', (['self._pairs', 'self._cardinality'], {}), '(self._pairs, self._cardinality)\n', (7087, 7119), False, 'import random\... |
#!/usr/bin/env python3
import re
import os
import sys
import json
import yaml
import glob
import shutil
import random
import logging
from pathlib import Path
logger = logging.getLogger('apiLogger')
path_to_src = Path(__file__, '../..').resolve()
path_to_data = path_to_src.joinpath('../data').resolve()
def find_path... | [
"logging.getLogger",
"os.path.exists",
"random.sample",
"random.choice",
"re.compile",
"pathlib.Path",
"os.path.join",
"os.path.split",
"shutil.copytree",
"yaml.safe_load",
"os.path.basename",
"shutil.copy",
"sys.exit",
"glob.glob"
] | [((169, 199), 'logging.getLogger', 'logging.getLogger', (['"""apiLogger"""'], {}), "('apiLogger')\n", (186, 199), False, 'import logging\n'), ((6298, 6328), 'random.choice', 'random.choice', (['available_probs'], {}), '(available_probs)\n', (6311, 6328), False, 'import random\n'), ((7389, 7428), 'shutil.copytree', 'shu... |
import random
N = 10000000
STOCKS = ['AAPL', 'MFST', 'GOOG', 'AMZN', 'FB', 'NFLX', 'NVDA', 'AMD', 'INTC', 'T']
PRICES = [302.00, 180.00, 1371.00, 2378.00, 202.00, 435.00, 320.00, 54.00, 58.00, 28.00]
outfile = open('stocks_data/trades4.csv', 'w')
for x in range(N):
stock = STOCKS[random.randint(0,len(STOCKS)-1)]
... | [
"random.randint"
] | [((330, 353), 'random.randint', 'random.randint', (['(1)', '(1000)'], {}), '(1, 1000)\n', (344, 353), False, 'import random\n'), ((446, 466), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (460, 466), False, 'import random\n'), ((401, 422), 'random.randint', 'random.randint', (['(1)', '(20)'], {}... |
import os
import json
import yaml
import base64
import shutil
import logging
import tarfile
import zipfile
import mimetypes
from copy import deepcopy
from pprint import pformat
from contextlib import contextmanager
from tempfile import NamedTemporaryFile, mkdtemp
import boto3
from wagon import show
from botocore.exce... | [
"tarfile.open",
"boto3.client",
"zipfile.ZipFile",
"copy.deepcopy",
"mimetypes.guess_type",
"logging.info",
"os.walk",
"os.listdir",
"shutil.move",
"boto3.resource",
"os.path.isdir",
"tempfile.NamedTemporaryFile",
"os.path.relpath",
"yaml.dump",
"pprint.pformat",
"os.path.dirname",
"... | [((347, 386), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (366, 386), False, 'import logging\n'), ((477, 520), 'os.path.join', 'os.path.join', (['BUCKET_FOLDER', '"""plugins.json"""'], {}), "(BUCKET_FOLDER, 'plugins.json')\n", (489, 520), False, 'import os\n'... |
import socket
if socket.gethostname() == 'Faramir': #for CNN_B
data_root = '/home/tencia/Documents/data/heart/'
data_kaggle = data_root + 'kaggle'
data_sunnybrook = data_root + 'sunnybrook'
local_root = '/home/tencia/Dropbox/heart/diagnose-heart/'
data_manual = local_root + 'manual_data'
data_in... | [
"socket.gethostname"
] | [((17, 37), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (35, 37), False, 'import socket\n')] |
import setuptools
import re
with open("requirements.txt") as f:
requirements = f.read().splitlines()
with open("flat/__init__.py") as f:
m = re.search(r"__version__ \= \"(\d+\.\d+\.\d+)\"", f.read())
version = m.group(1)
setuptools.setup(
name="flat",
author="nguuuquaaa",
url="https://github.... | [
"setuptools.setup"
] | [((236, 594), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""flat"""', 'author': '"""nguuuquaaa"""', 'url': '"""https://github.com/nguuuquaaa/flat"""', 'version': 'version', 'packages': "['flat']", 'license': '"""MIT"""', 'description': '"""Facebook chat (Messenger) wrapper written in python."""', 'include_p... |
from discord.ext import commands
import discord
import asyncio
import random
import asyncpg
import aiohttp
import psutil
from datetime import datetime
import os
import sys
sys.dont_write_bytecode = True
from utils import config
class xerx(commands.Bot):
def __init__(self):
super().__init__(
... | [
"discord.Game"
] | [((406, 443), 'discord.Game', 'discord.Game', ([], {'name': 'f"""{config.STATUS}"""'}), "(name=f'{config.STATUS}')\n", (418, 443), False, 'import discord\n')] |
"""
Cluster upstream sequences (UTR and leader) for each gene
For each gene, look at the sequences assigned to it. Take the upstream
sequences and compute a consensus for them. Only those assigned sequences are
taken that have a very low error rate for the V gene match.
Output a FASTA file that contains one consensus... | [
"logging.getLogger",
"collections.Counter"
] | [((478, 505), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (495, 505), False, 'import logging\n'), ((3166, 3194), 'collections.Counter', 'Counter', (["group['UTR_length']"], {}), "(group['UTR_length'])\n", (3173, 3194), False, 'from collections import Counter\n'), ((2100, 2119), 'loggin... |
# xgboost is a dependency of dtreeviz, but too large (>350M) for heroku
# so we uninstall it and mock it here:
from explainerdashboard import *
# from dash_bootstrap_components.themes import FLATLY, BOOTSTRAP # bootstrap theme
import dash
from flask import Flask
from pathlib import Path
from unittest.mock imp... | [
"pathlib.Path.cwd"
] | [((401, 411), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (409, 411), False, 'from pathlib import Path\n')] |
import tensorflow as tf
def temporal_weights(temporal_links, read_weights):
forward_weights = tf.matmul(read_weights,
temporal_links, transpose_b = True)
backward_weights = tf.matmul(read_weights, temporal_links)
return forward_weights, backward_weights
| [
"tensorflow.matmul"
] | [((97, 154), 'tensorflow.matmul', 'tf.matmul', (['read_weights', 'temporal_links'], {'transpose_b': '(True)'}), '(read_weights, temporal_links, transpose_b=True)\n', (106, 154), True, 'import tensorflow as tf\n'), ((184, 223), 'tensorflow.matmul', 'tf.matmul', (['read_weights', 'temporal_links'], {}), '(read_weights, t... |
import os
import random
import numpy as np
import logging
import argparse
import collections
import open3d as o3d
import sys
print(os.path.abspath(__file__))
sys.path.append(".")
import torch
import torch.nn.parallel
import torch.optim
import torch.utils.data
from util import config
from util.common_util import Ave... | [
"logging.getLogger",
"logging.StreamHandler",
"util.common_util.intersectionAndUnion",
"sys.path.append",
"util.config.load_cfg_from_cfg_file",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.stack",
"numpy.random.seed",
"numpy.concatenate",
"util.common_util.AverageMeter",
"model.pointtransfo... | [((160, 180), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (175, 180), False, 'import sys\n'), ((491, 507), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (502, 507), False, 'import random\n'), ((508, 527), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (522, 527), ... |
import json
import requests
import sys, getopt
from fasp.loc import crdcDRSClient, bdcDRSClient, Gen3DRSClient, anvilDRSClient
from fasp.loc import kfDRSClient
from fasp.loc import sdlDRSClient, SRADRSClient
from fasp.loc import sbcgcDRSClient, cavaticaDRSClient, sbbdcDRSClient
from fasp.loc import DRSClient
from fasp... | [
"fasp.loc.GA4GHRegistryClient",
"fasp.loc.bdcDRSClient",
"getopt.getopt",
"fasp.loc.cavaticaDRSClient",
"fasp.loc.sbbdcDRSClient",
"fasp.loc.kfDRSClient",
"json.dumps",
"fasp.loc.SRADRSClient",
"fasp.loc.anvilDRSClient",
"fasp.loc.sbcgcDRSClient",
"sys.exit",
"fasp.loc.crdcDRSClient",
"fasp.... | [((708, 760), 'fasp.loc.crdcDRSClient', 'crdcDRSClient', (['"""~/.keys/crdc_credentials.json"""', '"""s3"""'], {}), "('~/.keys/crdc_credentials.json', 's3')\n", (721, 760), False, 'from fasp.loc import crdcDRSClient, bdcDRSClient, Gen3DRSClient, anvilDRSClient\n'), ((773, 831), 'fasp.loc.anvilDRSClient', 'anvilDRSClien... |
from __future__ import annotations
from e2cnn import gspaces
from e2cnn import kernels
from e2cnn import diffops
from .general_r2 import GeneralOnR2
from .utils import rotate_array
from e2cnn.group import Representation
from e2cnn.group import Group
from e2cnn.group import DihedralGroup
from e2cnn.group import O2
fr... | [
"e2cnn.kernels.kernels_DN_act_R2",
"e2cnn.gspaces.Rot2dOnR2",
"e2cnn.group.dihedral_group",
"e2cnn.group.o2_group",
"e2cnn.gspaces.TrivialOnR2",
"e2cnn.kernels.kernels_O2_act_R2",
"e2cnn.gspaces.Flip2dOnR2",
"e2cnn.gspaces.FlipRot2dOnR2",
"e2cnn.diffops.diffops_DN_act_R2",
"e2cnn.diffops.diffops_O... | [((10119, 10257), 'e2cnn.kernels.kernels_DN_act_R2', 'kernels.kernels_DN_act_R2', (['in_repr', 'out_repr', 'rings', 'sigma'], {'axis': 'self.axis', 'max_frequency': 'maximum_frequency', 'max_offset': 'maximum_offset'}), '(in_repr, out_repr, rings, sigma, axis=self.axis,\n max_frequency=maximum_frequency, max_offset=... |
from gpiozero import LED
from time import sleep
from http.server import BaseHTTPRequestHandler, HTTPServer
# PIN numbering per https://gpiozero.readthedocs.io/en/stable/recipes.html
PIN_BUTTON1 = 2
PIN_BUTTONUP = 3
PIN_BUTTONDOWN = 4
class HD():
def __init__(self):
self.isTraveling = False # flag to ensu... | [
"http.server.HTTPServer",
"time.sleep",
"gpiozero.LED"
] | [((2927, 2982), 'http.server.HTTPServer', 'HTTPServer', (['server_address', 'myHTTPServer_RequestHandler'], {}), '(server_address, myHTTPServer_RequestHandler)\n', (2937, 2982), False, 'from http.server import BaseHTTPRequestHandler, HTTPServer\n'), ((418, 453), 'gpiozero.LED', 'LED', (['PIN_BUTTON1'], {'active_high': ... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("MIS Reports"),
"items": [
{
"type": "report",
"is_query_report": True,
"name": "Profit and Loss Statement",
"doctype": "GL Entry"
},
{
"type": "report",
"is_query_repor... | [
"frappe._"
] | [((104, 120), 'frappe._', '_', (['"""MIS Reports"""'], {}), "('MIS Reports')\n", (105, 120), False, 'from frappe import _\n'), ((832, 850), 'frappe._', '_', (['"""Sales Reports"""'], {}), "('Sales Reports')\n", (833, 850), False, 'from frappe import _\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 13:20:36 2020
@author: ambar
"""
'''
Imports
'''
import glob
from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
from astropy.nddata import CCDData
import astropy.units as u
import ccdproc
import os
########################################... | [
"ccdproc.trim_image",
"os.path.exists",
"numpy.nanmedian",
"os.makedirs",
"astropy.nddata.CCDData",
"astropy.io.fits.open",
"ccdproc.subtract_bias",
"glob.glob"
] | [((4345, 4370), 'astropy.io.fits.open', 'fits.open', (['sciencelist[0]'], {}), '(sciencelist[0])\n', (4354, 4370), False, 'from astropy.io import fits\n'), ((653, 675), 'astropy.io.fits.open', 'fits.open', (['biaslist[0]'], {}), '(biaslist[0])\n', (662, 675), False, 'from astropy.io import fits\n'), ((1625, 1650), 'num... |
from setuptools import setup
# run:
# setup.py install
# or (if you'll be modifying the package):
# setup.py develop
# To use a consistent encoding
# To upload to PyPI:
# twine upload dist/*
#
# Tag the release in github!
#
from codecs import open
from os import path
setup(name='hsds',
version='0.0.1',
... | [
"setuptools.setup"
] | [((273, 600), 'setuptools.setup', 'setup', ([], {'name': '"""hsds"""', 'version': '"""0.0.1"""', 'description': '"""HDF REST API"""', 'url': '"""http://github.com/HDFGroup/h5pyd"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""BSD"""', 'packages': "['hsds', 'hsds.util']", 'install_requires... |
import openpyxl
my_red = openpyxl.styles.colors.Color(rgb='FFD33D3D')
red_fill = openpyxl.styles.fills.PatternFill(patternType='solid', fgColor=my_red)
my_green = openpyxl.styles.colors.Color(rgb='FF55996F')
green_fill = openpyxl.styles.fills.PatternFill(patternType='solid', fgColor=my_green)
my_yellow = openpyxl.styl... | [
"openpyxl.styles.colors.Color",
"openpyxl.styles.fills.PatternFill"
] | [((26, 70), 'openpyxl.styles.colors.Color', 'openpyxl.styles.colors.Color', ([], {'rgb': '"""FFD33D3D"""'}), "(rgb='FFD33D3D')\n", (54, 70), False, 'import openpyxl\n'), ((82, 152), 'openpyxl.styles.fills.PatternFill', 'openpyxl.styles.fills.PatternFill', ([], {'patternType': '"""solid"""', 'fgColor': 'my_red'}), "(pat... |
"""
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not... | [
"boto3.resource",
"datetime.datetime.utcnow"
] | [((1058, 1109), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'region_name': '"""us-west-1"""'}), "('dynamodb', region_name='us-west-1')\n", (1072, 1109), False, 'import boto3\n'), ((1480, 1497), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1495, 1497), False, 'from datetime import date... |
import cv2
import numpy as np
import pyzbar.pyzbar as pyzbar
from pyzbar.pyzbar import ZBarSymbol
import sqlite3
from sqlite3 import Error
import time
class TimeStamp:
def __init__(self, db = 'payroll.db'):
self.db = db
def scan_qr(self):
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)... | [
"cv2.normalize",
"sqlite3.connect",
"time.sleep",
"cv2.imshow",
"pyzbar.pyzbar.decode",
"cv2.VideoCapture",
"cv2.waitKey"
] | [((286, 320), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)', 'cv2.CAP_DSHOW'], {}), '(0, cv2.CAP_DSHOW)\n', (302, 320), False, 'import cv2\n'), ((429, 481), 'cv2.normalize', 'cv2.normalize', (['frame', 'frame', '(0)', '(255)', 'cv2.NORM_MINMAX'], {}), '(frame, frame, 0, 255, cv2.NORM_MINMAX)\n', (442, 481), False, 'i... |
import cowsay
import gtts
import os
import random
import yaml
from pathlib import Path
from zalgo_text import zalgo
from discord import Embed
from discord.ext import commands
from discord.ext.commands import Context, Cog, command, cooldown
from discord.ext.commands.errors import BadArgument
from discord.file import Fi... | [
"random.choice",
"pathlib.Path",
"zalgo_text.zalgo.zalgo",
"gtts.tts.tts_langs",
"discord.ext.commands.errors.BadArgument",
"incarn.pagination.LinePaginator.paginate",
"gtts.gTTS",
"os.mkdir",
"cowsay.get_output_string",
"discord.ext.commands.cooldown",
"discord.Embed",
"discord.ext.commands.c... | [((540, 596), 'discord.ext.commands.command', 'command', ([], {'name': '"""coinflip"""', 'aliases': "('flip', 'coin', 'cf')"}), "(name='coinflip', aliases=('flip', 'coin', 'cf'))\n", (547, 596), False, 'from discord.ext.commands import Context, Cog, command, cooldown\n'), ((1045, 1066), 'discord.ext.commands.command', ... |
"""
This module provides the main entry point to any simulation task.
"""
from __future__ import annotations
__all__ = ['Organisation', 'Simulator']
import datetime as dt
import json
from pathlib import Path
from typing import List, Optional, Tuple, Deque
import dill as pickle
import pandas as pd
import tqdm
from ... | [
"pandas.DataFrame",
"slim.simulation.lice_population.GenoDistrib",
"json.dumps",
"slim.simulation.farm.Farm",
"slim.types.TreatmentTypes.Money",
"pandas.DataFrame.from_dict",
"datetime.timedelta",
"json.load",
"slim.simulation.lice_population.GenoDistrib.batch_sum",
"dill.dump",
"slim.logger.inf... | [((1607, 1646), 'slim.simulation.lice_population.GenoDistrib', 'GenoDistrib', (['cfg.initial_genetic_ratios'], {}), '(cfg.initial_genetic_ratios)\n', (1618, 1646), False, 'from slim.simulation.lice_population import GenoDistrib, GenoDistribDict\n'), ((3888, 3895), 'slim.types.TreatmentTypes.Money', 'Money', ([], {}), '... |
import netomaton as ntm
if __name__ == '__main__':
network = ntm.topology.cellular_automaton2d(60, 60, r=1, neighbourhood="Hex")
initial_conditions = ntm.init_simple2d(60, 60)
def activity_rule(ctx):
return 1 if sum(ctx.neighbourhood_activities) == 1 else ctx.current_activity
trajectory = nt... | [
"netomaton.init_simple2d",
"netomaton.topology.cellular_automaton2d",
"netomaton.evolve",
"netomaton.animate_hex"
] | [((66, 133), 'netomaton.topology.cellular_automaton2d', 'ntm.topology.cellular_automaton2d', (['(60)', '(60)'], {'r': '(1)', 'neighbourhood': '"""Hex"""'}), "(60, 60, r=1, neighbourhood='Hex')\n", (99, 133), True, 'import netomaton as ntm\n'), ((160, 185), 'netomaton.init_simple2d', 'ntm.init_simple2d', (['(60)', '(60)... |
from keras.models import Model, load_model
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import SGD
import numpy as np
import os
import pandas as pd
import json
from keras.applications.densenet import preprocess_input as densenet_preprocess_input
# from keras.applications.resnet50 impo... | [
"json.dump",
"numpy.save",
"keras.models.load_model",
"keras.preprocessing.image.ImageDataGenerator"
] | [((513, 572), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'preprocessing_function': 'preprocess_input'}), '(preprocessing_function=preprocess_input)\n', (531, 572), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((599, 667), 'keras.preprocessing.image.ImageDataGene... |
"""
This class is used as a dispatcher, calls the relevant function according to the type object
"""
import sys
from args_container import ArgsContainer
from local_address_range_to_global import LocalAddressRangeToGlobal
from local_group_to_global import LocalGroupToGlobal
from local_group_to_global import L... | [
"args_container.ArgsContainer",
"util_functions.UtilFunctions.unsupported_type_find_name_and_write_to_file",
"util_functions.UtilFunctions.discard_write_to_log_file"
] | [((5472, 5499), 'args_container.ArgsContainer', 'ArgsContainer', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (5485, 5499), False, 'from args_container import ArgsContainer\n'), ((4223, 4297), 'util_functions.UtilFunctions.unsupported_type_find_name_and_write_to_file', 'UtilFunctions.unsupported_type_find_name_and_write... |
import logging
import socket
from typing import List, Tuple, Optional
logger = logging.getLogger(__name__)
class WhoisQueryError(ValueError):
pass
def whois_query(host: str, port: int, query: str, end_markings: List[str]=None) -> str:
"""
Perform a query on a whois server, connecting to the specified h... | [
"logging.getLogger",
"socket.socket"
] | [((80, 107), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (97, 107), False, 'import logging\n'), ((837, 852), 'socket.socket', 'socket.socket', ([], {}), '()\n', (850, 852), False, 'import socket\n'), ((1777, 1792), 'socket.socket', 'socket.socket', ([], {}), '()\n', (1790, 1792), False... |
import Globals
import main
import Conversions
class Empty:
""" Empty square - place holder object. Has colour and location.
It is possible that these are almost entirely redundant and that, with small change to a small number of
functions they could be entirely removed from the game.
"""
... | [
"main.convert_board2san",
"Conversions.legal"
] | [((712, 749), 'main.convert_board2san', 'main.convert_board2san', (['self.location'], {}), '(self.location)\n', (734, 749), False, 'import main\n'), ((2347, 2372), 'main.convert_board2san', 'main.convert_board2san', (['x'], {}), '(x)\n', (2369, 2372), False, 'import main\n'), ((2426, 2451), 'main.convert_board2san', 'm... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-21 00:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('photos', '0007_auto_20160920_2218'),
]
operations = [
migrations.RemoveFiel... | [
"django.db.migrations.RemoveField",
"django.db.models.IntegerField"
] | [((299, 357), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""photo"""', 'name': '"""nasa_id"""'}), "(model_name='photo', name='nasa_id')\n", (321, 357), False, 'from django.db import migrations, models\n'), ((402, 460), 'django.db.migrations.RemoveField', 'migrations.RemoveField',... |
from functools import partial
from logging import getLogger
from typing import List, Optional, Set
from recording_script_generator.core.helper import strip_punctuation_words
from recording_script_generator.core.multiprocessing_helper import \
execute_method_on_utterances_mp_bool
from recording_script_generator.cor... | [
"logging.getLogger",
"recording_script_generator.core.helper.strip_punctuation_words",
"recording_script_generator.core.multiprocessing_helper.execute_method_on_utterances_mp_bool",
"functools.partial",
"recording_script_generator.core.types.utterance_to_str"
] | [((862, 889), 'recording_script_generator.core.types.utterance_to_str', 'utterance_to_str', (['utterance'], {}), '(utterance)\n', (878, 889), False, 'from recording_script_generator.core.types import Utterance, UtteranceId, Utterances, utterance_to_str\n'), ((951, 981), 'recording_script_generator.core.helper.strip_pun... |
# Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"numpy.sqrt",
"pylib.pc.tests.utils._create_random_point_cloud_segmented",
"tensorflow.unique_with_counts",
"numpy.array",
"numpy.arange",
"numpy.repeat",
"pylib.pc.PointCloud",
"numpy.asarray",
"sklearn.neighbors.KernelDensity",
"numpy.exp",
"numpy.concatenate",
"tensorflow_graphics.util.test... | [((3976, 4062), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(1, 200, 1, 4, 2)', '(1, 200, 1, 4, 3)', '(1, 100, 1, 4, 4)'], {}), '((1, 200, 1, 4, 2), (1, 200, 1, 4, 3), (1, 100, 1, \n 4, 4))\n', (4000, 4062), False, 'from absl.testing import parameterized\n'), ((5707, 5723), 'tensorflow_gr... |
from __future__ import division
import numpy as np
import torch
import torch.nn as nn
from ..registry import ROIPOOLING
@ROIPOOLING.register_module
class RoIPooling(nn.Module):
def __init__(self,
pool_plane,
inter_channels,
outchannels,
crop_s... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.init.constant_",
"torch.nn.functional.affine_grid",
"torch.stack",
"torch.nn.init.kaiming_normal_",
"torch.from_numpy",
"numpy.stack",
"numpy.array",
"torch.nn.MaxPool2d",
"torch.nn.init.normal_",
"torch.nn.Linear",
"torch.cat"
] | [((489, 513), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['pool_plane'], {}), '(pool_plane)\n', (501, 513), True, 'import torch.nn as nn\n'), ((1699, 1719), 'numpy.stack', 'np.stack', (['ab'], {'axis': '(0)'}), '(ab, axis=0)\n', (1707, 1719), True, 'import numpy as np\n'), ((563, 611), 'torch.nn.Linear', 'nn.Linear', (['(n... |
"""downloads the nightly simc"""
#!/usr/bin/env python
import glob
import os
import re
import subprocess
import time
from urllib.error import URLError
from urllib.request import urlopen, urlretrieve
def download_latest():
"""main download function"""
seven_zip_paths = ["7z.exe", "C:/Program Files/7-Zip/7z.exe... | [
"os.path.exists",
"os.makedirs",
"urllib.request.urlretrieve",
"os.rename",
"os.path.join",
"time.sleep",
"os.path.realpath",
"subprocess.call",
"os.path.basename",
"re.findall",
"urllib.request.urlopen",
"glob.glob",
"os.remove"
] | [((570, 615), 'os.path.join', 'os.path.join', (['rootpath', '""".."""', '"""auto_download"""'], {}), "(rootpath, '..', 'auto_download')\n", (582, 615), False, 'import os\n'), ((1257, 1293), 'os.path.join', 'os.path.join', (['download_dir', 'filename'], {}), '(download_dir, filename)\n', (1269, 1293), False, 'import os\... |
import csv
# import pandas as pd
import openpyxl
DAY_ROWS = [
(15, 20, "Monday"), # Monday
(24, 28, "Tuesday"), # Tuesday
(32, 39, "Wednesday"), # Wednesday
(43, 50, "Thursday"), # Thursday
(54, 61, "Friday"), # Friday
(66, 73, "Weekend"), # Weekend: Saturday & Sunday
]
def merged_size... | [
"openpyxl.load_workbook",
"csv.writer"
] | [((581, 613), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (['filename'], {}), '(filename)\n', (603, 613), False, 'import openpyxl\n'), ((762, 847), 'csv.writer', 'csv.writer', (['output_file'], {'delimiter': '""","""', 'quotechar': '"""\\""""', 'quoting': 'csv.QUOTE_MINIMAL'}), '(output_file, delimiter=\',\', q... |
from django.urls import reverse
from lego.apps.users.models import AbakusGroup, User
from lego.utils.test_utils import BaseAPITestCase
_test_company_data = [{"name": "TEST"}, {"name": "TEST2"}]
_test_semester_status_data = [
{"semester": 2, "company": 1, "contactedStatus": ["interested"]}
]
_test_company_contac... | [
"lego.apps.users.models.User.objects.all",
"lego.apps.users.models.AbakusGroup.objects.get",
"django.urls.reverse"
] | [((505, 531), 'django.urls.reverse', 'reverse', (['"""api:v1:bdb-list"""'], {}), "('api:v1:bdb-list')\n", (512, 531), False, 'from django.urls import reverse\n'), ((570, 617), 'django.urls.reverse', 'reverse', (['"""api:v1:bdb-detail"""'], {'kwargs': "{'pk': pk}"}), "('api:v1:bdb-detail', kwargs={'pk': pk})\n", (577, 6... |
from mido import MidiFile
from time import sleep
import pibrella
""" fade test
pibrella.light.red.fade(0,100,10)
sleep(11)
pibrella.light.red.fade(100,0,10)
sleep(11)
"""
""" start
pibrella.buzzer.note(-9)
sleep(.9)
pibrella.buzzer.off()
sleep(0.1)
pibrella.buzzer.note(-9)
sleep(0.9)
pibrella.buzzer.off()
sleep(0.1)
... | [
"time.sleep",
"pibrella.buzzer.note",
"mido.MidiFile",
"pibrella.buzzer.off"
] | [((815, 835), 'mido.MidiFile', 'MidiFile', (['"""bond.mid"""'], {}), "('bond.mid')\n", (823, 835), False, 'from mido import MidiFile\n'), ((1399, 1420), 'pibrella.buzzer.off', 'pibrella.buzzer.off', ([], {}), '()\n', (1418, 1420), False, 'import pibrella\n'), ((1112, 1138), 'pibrella.buzzer.note', 'pibrella.buzzer.note... |
from Animate import Animate
Animate.Model('BulldozerBucket.xlsx', 'Script') | [
"Animate.Animate.Model"
] | [((28, 75), 'Animate.Animate.Model', 'Animate.Model', (['"""BulldozerBucket.xlsx"""', '"""Script"""'], {}), "('BulldozerBucket.xlsx', 'Script')\n", (41, 75), False, 'from Animate import Animate\n')] |
from pdb import set_trace as breakpoint
from random import randint, sample
import unittest
class Product():
def __init__(self, name, price=None, weight=None,flammability=None):
self.name=name
def_num1=10
self.price=price if price is not None else def_num1
def_num2=20
self.we... | [
"random.randint"
] | [((498, 523), 'random.randint', 'randint', (['(1000000)', '(9999999)'], {}), '(1000000, 9999999)\n', (505, 523), False, 'from random import randint, sample\n')] |
"""racks URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based v... | [
"django.contrib.auth.views.LoginView.as_view",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.urls.path",
"django.contrib.auth.views.LogoutView.as_view"
] | [((2968, 2993), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (2991, 2993), False, 'from django.contrib.staticfiles.urls import staticfiles_urlpatterns\n'), ((861, 892), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.sit... |
from pathlib import Path
from resource import setrlimit
from subprocess import Popen
from tempfile import TemporaryDirectory
from django import forms
from django.forms import Form
from django.shortcuts import render
import rholang.settings as cfg
from .runner import Compiler, VM, ConfigurationError, UserError
def h... | [
"django.shortcuts.render",
"tempfile.TemporaryDirectory",
"django.forms.BooleanField",
"django.forms.CharField",
"pathlib.Path"
] | [((2038, 2243), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', "{'form': compilerForm, 'examples': examples, 'rbl_code': rbl or '',\n 'compile_error': compile_error or '', 'repl_session': session or '',\n 'run_error': run_error or ''}"], {}), "(request, 'index.html', {'form': compilerForm, ... |
from keras.models import *
from keras.callbacks import *
import keras.backend as K
from model import *
from data import *
import cv2
import argparse
import pydot, graphviz
from keras.utils import np_utils, plot_model
def visualize_class_activation_map(model_path, img_path, output_path, run_count, write_to_file, post_... | [
"cv2.imwrite",
"argparse.ArgumentParser",
"keras.utils.plot_model",
"keras.backend.function",
"cv2.resize",
"cv2.imread"
] | [((394, 417), 'cv2.imread', 'cv2.imread', (['img_path', '(1)'], {}), '(img_path, 1)\n', (404, 417), False, 'import cv2\n'), ((434, 470), 'cv2.resize', 'cv2.resize', (['original_img', '(224, 224)'], {}), '(original_img, (224, 224))\n', (444, 470), False, 'import cv2\n'), ((674, 737), 'keras.utils.plot_model', 'plot_mode... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | [
"bpy.utils.unregister_module",
"os.listdir",
"mathutils.Vector",
"bpy.ops.object.mode_set",
"os.path.join",
"os.path.splitext",
"bpy.data.meshes.new",
"os.path.split",
"bpy.utils.register_module",
"bpy_extras.image_utils.load_image",
"bpy.types.INFO_MT_file_import.remove",
"bpy.types.INFO_MT_f... | [((4754, 4783), 'bpy.data.meshes.new', 'bpy.data.meshes.new', (['img.name'], {}), '(img.name)\n', (4773, 4783), False, 'import bpy, os, mathutils\n'), ((5244, 5272), 'os.path.split', 'os.path.split', (['self.filepath'], {}), '(self.filepath)\n', (5257, 5272), False, 'import bpy, os, mathutils\n'), ((12519, 12554), 'bpy... |
"""Create a self extracting executable
"""
import argparse
import os
import pathlib
import re
import shutil
import subprocess
import sys
import tarfile
import tempfile
try:
from importlib.resources import read_text, files
except ImportError:
from importlib_resources import read_text, files
from . import VERSI... | [
"installer.create_installer",
"tempfile.TemporaryDirectory",
"tarfile.open",
"argparse.ArgumentParser",
"pathlib.Path",
"os.getenv",
"importlib_resources.read_text",
"importlib_resources.files",
"sys.platform.lower",
"os.remove"
] | [((4015, 4132), 'installer.create_installer', 'installer.create_installer', (['options.install_spec', '"""setup"""', 'options.uname'], {'dialog': 'options.dialog_tool', 'vars': 'varmap'}), "(options.install_spec, 'setup', options.uname,\n dialog=options.dialog_tool, vars=varmap)\n", (4041, 4132), False, 'import inst... |
"""
Fake data generator.
"""
import datetime
import os
from typing import Dict
import collections
import numpy as np
import pandas as pd
# Generic type definitions.
ndist_params = collections.namedtuple('ndist_params', ('mu', 'sigma', 'derives_from', 'decimals'))
#
# Generator settings
#
# Base paths.
BASE_DIR = ... | [
"datetime.datetime",
"numpy.random.normal",
"collections.namedtuple",
"pandas.to_timedelta",
"pandas.read_csv",
"numpy.arange",
"numpy.where",
"pandas.merge",
"os.path.join",
"os.path.abspath",
"pandas.to_datetime"
] | [((184, 271), 'collections.namedtuple', 'collections.namedtuple', (['"""ndist_params"""', "('mu', 'sigma', 'derives_from', 'decimals')"], {}), "('ndist_params', ('mu', 'sigma', 'derives_from',\n 'decimals'))\n", (206, 271), False, 'import collections\n'), ((391, 421), 'os.path.join', 'os.path.join', (['BASE_DIR', '"... |
from flask_restful import reqparse, abort, Api, Resource
from flask import Flask
from flask import render_template
app = Flask(__name__, static_folder='../PCWebclient', static_url_path='')
@app.route('/')
def index():
return app.send_static_file("index.html")
if __name__ == '__main__':
# 张三负责qzone组件
from... | [
"qzone.add_qzone_routes",
"friend.add_friend_routes",
"flask.Flask"
] | [((121, 188), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""../PCWebclient"""', 'static_url_path': '""""""'}), "(__name__, static_folder='../PCWebclient', static_url_path='')\n", (126, 188), False, 'from flask import Flask\n'), ((355, 376), 'qzone.add_qzone_routes', 'add_qzone_routes', (['app'], {}), '(a... |
f = open("Q6/inputs.txt","r")
# k = [*map(int,f.readline().split(","))]
# d = {}
# for i in k:
# if i not in d:
# d[i] = 0
# d[i] += 1
# for i in range(256):
# p = {0:0,1:0,2:0,3:0,4:0,5:0,7:0,6:0,8:0}
# for j in d:
# if j == 0:
# p[6] += d[j]
# p[8] += d[j]
# ... | [
"random.randrange"
] | [((557, 580), 'random.randrange', 'random.randrange', (['(1)', '(15)'], {}), '(1, 15)\n', (573, 580), False, 'import random\n'), ((588, 611), 'random.randrange', 'random.randrange', (['(0)', '(25)'], {}), '(0, 25)\n', (604, 611), False, 'import random\n')] |
import pika
def callback(ch, method, properties, body):
print(" [x] %r" % body)
if __name__ == '__main__':
parameters = pika.URLParameters('amqp://guest:guest@maragi-rabbit:5672/%2F')
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.exchange_declare(exchang... | [
"pika.URLParameters",
"pika.BlockingConnection"
] | [((132, 195), 'pika.URLParameters', 'pika.URLParameters', (['"""amqp://guest:guest@maragi-rabbit:5672/%2F"""'], {}), "('amqp://guest:guest@maragi-rabbit:5672/%2F')\n", (150, 195), False, 'import pika\n'), ((213, 248), 'pika.BlockingConnection', 'pika.BlockingConnection', (['parameters'], {}), '(parameters)\n', (236, 24... |
from doubles import allow, InstanceDouble, expect
from pytest import fixture
from staticpy.page import Page
from staticpy.page.data import Data
@fixture
def page(request):
page = Page('file_path.page', 'url_path', dummy_category())
allow(page)._data.and_return(Data())
return page
def dummy_category():
... | [
"doubles.InstanceDouble",
"doubles.allow",
"staticpy.page.data.Data",
"doubles.expect"
] | [((272, 278), 'staticpy.page.data.Data', 'Data', ([], {}), '()\n', (276, 278), False, 'from staticpy.page.data import Data\n'), ((518, 534), 'staticpy.page.data.Data', 'Data', ([], {'order': '"""10"""'}), "(order='10')\n", (522, 534), False, 'from staticpy.page.data import Data\n'), ((786, 792), 'staticpy.page.data.Dat... |
import pytest
from connect.client.openapi import OpenAPISpecs
def test_load_from_file():
oa = OpenAPISpecs('tests/data/specs.yml')
assert oa._specs is not None
def test_load_from_url(mocked_responses):
mocked_responses.add(
'GET',
'https://localhost/specs.yml',
body=open('tests/... | [
"pytest.mark.parametrize",
"connect.client.openapi.OpenAPISpecs"
] | [((822, 1255), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('method', 'path', 'expected')", "(('get', 'products', True), ('get', 'products?eq(status,published)', True),\n ('put', 'products', False), ('get', 'products/PRD-000', True), ('get',\n 'products/PRD-000/items', True), ('post', 'products/PRD-0... |
from scramjet.streams import Stream, StreamAlreadyConsumed
import asyncio
import pytest
@pytest.mark.asyncio
async def test_simple_stream_piping():
s1 = Stream.read_from(range(8)).map(lambda x: 2*x)
s2 = Stream().filter(lambda x: x > 5)
s1.pipe(s2)
assert await s2.to_list() == [6, 8, 10, 12, 14]
@pyte... | [
"scramjet.streams.Stream",
"pytest.raises"
] | [((929, 937), 'scramjet.streams.Stream', 'Stream', ([], {}), '()\n', (935, 937), False, 'from scramjet.streams import Stream, StreamAlreadyConsumed\n'), ((963, 999), 'pytest.raises', 'pytest.raises', (['StreamAlreadyConsumed'], {}), '(StreamAlreadyConsumed)\n', (976, 999), False, 'import pytest\n'), ((213, 221), 'scram... |
import unicodedata
import scrapy
import json
import abc
from datetime import datetime
class BaseSpider(scrapy.Spider, abc.ABC):
"""Base spider, defines how to scrape a newspaper website.
See Scrapy documentation for more information:
'https://docs.scrapy.org/en/latest/topics/spiders.html'
Attri... | [
"datetime.datetime.now"
] | [((2300, 2314), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2312, 2314), False, 'from datetime import datetime\n')] |
from jina import Executor, Document, DocumentArray, requests
import numpy as np
from typing import Tuple
import os
top_k = 10
class DiskIndexer(Executor):
"""Simple indexer class """
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._docs = DocumentArray()
self.top_k = top... | [
"os.path.exists",
"numpy.ones",
"os.makedirs",
"os.path.join",
"jina.requests",
"jina.DocumentArray.load",
"numpy.linalg.norm",
"numpy.take_along_axis",
"jina.DocumentArray"
] | [((733, 754), 'jina.requests', 'requests', ([], {'on': '"""/index"""'}), "(on='/index')\n", (741, 754), False, 'from jina import Executor, Document, DocumentArray, requests\n'), ((867, 889), 'jina.requests', 'requests', ([], {'on': '"""/search"""'}), "(on='/search')\n", (875, 889), False, 'from jina import Executor, Do... |
from flask import Blueprint, send_file, current_app, send_from_directory
import pandas as pd
from matplotlib.figure import Figure
import base64
import os
from io import BytesIO
from .db import engine
bp = Blueprint('views', __name__, url_prefix='')
@bp.route("/")
def index():
return current_app.send_s... | [
"flask.send_from_directory",
"matplotlib.figure.Figure",
"pandas.merge",
"os.path.join",
"io.BytesIO",
"pandas.read_sql",
"flask.current_app.send_static_file",
"flask.send_file",
"flask.Blueprint"
] | [((214, 257), 'flask.Blueprint', 'Blueprint', (['"""views"""', '__name__'], {'url_prefix': '""""""'}), "('views', __name__, url_prefix='')\n", (223, 257), False, 'from flask import Blueprint, send_file, current_app, send_from_directory\n'), ((302, 344), 'flask.current_app.send_static_file', 'current_app.send_static_fil... |
"""eatiht v2 - <NAME> - Copyright 2014"""
from lxml.html import builder as E
from lxml.html import tostring as htmltostring
class TextNodeSubTree(object):
""" This class can be described in a few different ways. A proper
explanation requires a brief definition of terms.
There's two W3C-spec'd ... | [
"lxml.html.builder.H2",
"lxml.html.builder.LINK",
"lxml.html.tostring",
"lxml.html.builder.CLASS",
"lxml.html.builder.TITLE",
"lxml.html.builder.BODY"
] | [((7954, 7965), 'lxml.html.builder.BODY', 'E.BODY', (['div'], {}), '(div)\n', (7960, 7965), True, 'from lxml.html import builder as E\n'), ((7649, 7669), 'lxml.html.builder.CLASS', 'E.CLASS', (['"""container"""'], {}), "('container')\n", (7656, 7669), True, 'from lxml.html import builder as E\n'), ((7729, 7747), 'lxml.... |
import random
from main.public import models
from main.public import utils
from django.db.models import Q
from main.api_v1.servers.get import config
# 函数编号:100000
# 从随机获取数据库客户并封装为列表
def get_random_customers_list(customers_list_size):
"""
:param customers_list_size: 一次需要获取多少个客户信息
:return: 返回一个存放客户信息的列表,每个... | [
"random.sample",
"main.public.models.CustomerTable.objects.values",
"main.public.utils.is_bad_str",
"main.public.models.AdsTable.objects.values",
"main.public.models.DataSourcesTable.objects.values",
"main.public.models.EvaluationTable.objects.values",
"main.public.utils.strip_all",
"django.db.models.... | [((2300, 2303), 'django.db.models.Q', 'Q', ([], {}), '()\n', (2301, 2303), False, 'from django.db.models import Q\n'), ((8357, 8387), 'main.public.utils.is_bad_str', 'utils.is_bad_str', (['country_name'], {}), '(country_name)\n', (8373, 8387), False, 'from main.public import utils\n'), ((8839, 8872), 'main.public.utils... |
"""
This module contains all the code that is necessary to facilitate the updating
of the simulation and other objects from the interface, and also for sending
information back to the interface.
"""
import copy
from twisted.logger import Logger
from ..util.dict import difference, merge
class Handler():
"""
The... | [
"twisted.logger.Logger"
] | [((953, 961), 'twisted.logger.Logger', 'Logger', ([], {}), '()\n', (959, 961), False, 'from twisted.logger import Logger\n')] |
#
# Copyright 2022 The AI Flow Authors
#
# 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 w... | [
"unittest.main",
"os.path.dirname",
"ai_flow.test.util.notification_service_utils.stop_notification_server",
"ai_flow.test.util.notification_service_utils.start_notification_server"
] | [((1838, 1853), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1851, 1853), False, 'import unittest\n'), ((891, 918), 'ai_flow.test.util.notification_service_utils.start_notification_server', 'start_notification_server', ([], {}), '()\n', (916, 918), False, 'from ai_flow.test.util.notification_service_utils impor... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 00:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobportal', '0008_remove_person_join_date'),
]
operations = [
migrations.Ad... | [
"django.db.models.CharField"
] | [((403, 458), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(200)', 'null': '(True)'}), '(blank=True, max_length=200, null=True)\n', (419, 458), False, 'from django.db import migrations, models\n'), ((582, 637), 'django.db.models.CharField', 'models.CharField', ([], {'blank':... |
# PYTHON PASSWORD GENERATOR
# <NAME>
import random
lower = "abcdefghijklmnopqrstuvwxyz"
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numbers = "0123456789"
symbols = "[]{}()*;/,_-"
all = lower + upper + numbers + symbols
length = 16
password = "".join(random.sample(all,length))
print(password)
| [
"random.sample"
] | [((248, 274), 'random.sample', 'random.sample', (['all', 'length'], {}), '(all, length)\n', (261, 274), False, 'import random\n')] |
import sys
from antlr4 import * #FIXME Remove unused imports
from enum import Enum
from collections import namedtuple
#Annoyingly, the Antl4 Python libraries use camelcase since it was originally Java, so we have convention inconsistencies here
from .CMakeParser import CMakeParser
from .CMakeListener import CMakeList... | [
"collections.namedtuple",
"enum.Enum"
] | [((852, 910), 'collections.namedtuple', 'namedtuple', (['"""FunctionDocumentation"""', '"""function params doc"""'], {}), "('FunctionDocumentation', 'function params doc')\n", (862, 910), False, 'from collections import namedtuple\n'), ((932, 984), 'collections.namedtuple', 'namedtuple', (['"""MacroDocumentation"""', '... |
#!/usr/bin/env python
"""experiments.py: experiments python program for different experiment applications"""
__author__ = "<NAME>."
__copyright__ = "Copyright 2020, SuperDARN@VT"
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
import ... | [
"numpy.log10",
"model.Model",
"pandas.read_csv",
"matplotlib.dates.MinuteLocator",
"numpy.array",
"scipy.stats.ttest_rel",
"datetime.timedelta",
"utils.smooth",
"sys.path.append",
"utils.read_goes",
"datetime.datetime",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParser",
"netCDF4.... | [((331, 352), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (345, 352), False, 'import matplotlib\n'), ((419, 455), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""config/alt.mplstyle"""'], {}), "('config/alt.mplstyle')\n", (432, 455), True, 'import matplotlib.pyplot as plt\n'), ((468, 494... |
# pylint:disable=redefined-outer-name
# pylint:disable=too-many-arguments
from datetime import datetime, timedelta
import pytest
from tinkoff.invest.data_loaders import get_all_candles
from tinkoff.invest.schemas import (
CandleInterval,
GetCandlesResponse,
HistoricCandle,
Quotation,
)
from tinkoff.in... | [
"datetime.datetime.utcnow",
"tinkoff.invest.data_loaders.get_all_candles",
"pytest.mark.parametrize",
"pytest.fixture",
"datetime.timedelta",
"tinkoff.invest.schemas.Quotation",
"tinkoff.invest.schemas.GetCandlesResponse"
] | [((362, 378), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (376, 378), False, 'import pytest\n'), ((412, 428), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (426, 428), False, 'import pytest\n'), ((495, 511), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (509, 511), False, 'import pytest\n'), (... |
from malcolm.core import Process
from malcolm.modules.builtin.controllers import ManagerController
from malcolm.modules.pmac.blocks import pmac_status_block
from malcolm.modules.pmac.parts import PmacStatusPart
from malcolm.testutil import ChildTestCase
class TestPmacStatusPart(ChildTestCase):
def setUp(self):
... | [
"malcolm.modules.pmac.parts.PmacStatusPart",
"malcolm.core.Process",
"malcolm.modules.builtin.controllers.ManagerController"
] | [((341, 359), 'malcolm.core.Process', 'Process', (['"""Process"""'], {}), "('Process')\n", (348, 359), False, 'from malcolm.core import Process\n'), ((549, 597), 'malcolm.modules.builtin.controllers.ManagerController', 'ManagerController', (['"""PMAC"""', '"""/tmp"""'], {'use_git': '(False)'}), "('PMAC', '/tmp', use_gi... |
import pandas as pd
def _parse_cell_id_v1(cell_id):
plate1, plate2, pcr_index, random_index = cell_id.split('-')
if random_index.upper() in {'AD001', 'AD002', 'AD004', 'AD006'}:
plate = plate1
else:
plate = plate2
# 96 pos
col96 = int(pcr_index[1:]) - 1
row96 = ord(pcr_index[0]... | [
"pandas.Series",
"pandas.DataFrame"
] | [((727, 846), 'pandas.Series', 'pd.Series', (["{'Plate': plate, 'PCRIndex': pcr_index, 'RandomIndex': random_index,\n 'Col384': col384, 'Row384': row384}"], {}), "({'Plate': plate, 'PCRIndex': pcr_index, 'RandomIndex':\n random_index, 'Col384': col384, 'Row384': row384})\n", (736, 846), True, 'import pandas as pd... |
"""Sentence Embedding to
"""
from typing import List
import tensorflow as tf
import tensorflow_hub as hub
import torch
embed = hub.load("https://tfhub.dev/google/universal-sentence-encoder/4")
def cosine_similarity(orig_sentences: List[str], adv_sentences: List[str]):
orig_features = torch.tensor(embed(orig_se... | [
"torch.nn.functional.cosine_similarity",
"tensorflow_hub.load"
] | [((130, 195), 'tensorflow_hub.load', 'hub.load', (['"""https://tfhub.dev/google/universal-sentence-encoder/4"""'], {}), "('https://tfhub.dev/google/universal-sentence-encoder/4')\n", (138, 195), True, 'import tensorflow_hub as hub\n'), ((411, 477), 'torch.nn.functional.cosine_similarity', 'torch.nn.functional.cosine_si... |
import sys
from fabric import Connection
from invoke import task
PROJECT_NAME = "project_name"
PROJECT_PATH = "~/{}".format(PROJECT_NAME)
VENV_PATH = '/home/ronin/Projects/pyenvs/bin'
REPO_URL = 'https://github.com/raikel/dnfas.git'
@task
def upgrade(c):
c.run(f'git pull')
c.run(f'{VENV_PATH}/pip install -r ... | [
"sys.exit"
] | [((1284, 1320), 'sys.exit', 'sys.exit', (['"""Failed to get connection"""'], {}), "('Failed to get connection')\n", (1292, 1320), False, 'import sys\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Code accompanying the manuscript:
"Reinterpreting the relationship between number of species and
number of links connects community structure and stability"
-------
v1.0.0 (First release)
-------
For any question or comment, please contact:
<NAME>(1), <EMAIL>
(1)... | [
"decomposition.experiment",
"robustness.robx",
"robustness.R2deltaS",
"matplotlib.pyplot.ylabel",
"local_stability.realpart",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axhline",
"numpy.array",
"numpy.linspace",
"decomposition.R2L",
"matplotlib.pyplot.scatter",
... | [((821, 955), 'numpy.array', 'np.array', (['[[0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1], [1, 0, 0, 0, 1,\n 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0]]'], {}), '([[0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1], [1, 0,\n 0, 0, 1, 1], [0, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0]])\n', (829, 955... |
from collections import namedtuple
from datetime import datetime
def parse_datetime(datetime_str):
if datetime_str:
return datetime.strptime(datetime_str, "%Y-%m-%dT%H:%M:%S.%fZ")
class Price(
namedtuple(
"price",
[
"quantity",
"vwap",
"price",
... | [
"datetime.datetime.strptime",
"collections.namedtuple"
] | [((213, 288), 'collections.namedtuple', 'namedtuple', (['"""price"""', "['quantity', 'vwap', 'price', 'fees', 'total', 'json']"], {}), "('price', ['quantity', 'vwap', 'price', 'fees', 'total', 'json'])\n", (223, 288), False, 'from collections import namedtuple\n'), ((742, 797), 'collections.namedtuple', 'namedtuple', (... |
import sys
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Add our app to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
SECRET_KEY = '<KEY>'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.a... | [
"os.path.abspath",
"os.path.dirname",
"os.path.join",
"os.getenv"
] | [((2590, 2625), 'os.getenv', 'os.getenv', (['"""FB_ACCESS_TOKEN"""', '"""XYZ"""'], {}), "('FB_ACCESS_TOKEN', 'XYZ')\n", (2599, 2625), False, 'import os\n'), ((66, 91), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((1653, 1689), 'os.path.join', 'os.path.join'... |
import pytest
from demo.accounts.models import User, APIToken
@pytest.fixture
def user0(db):
return User.objects.create_user(
email='<EMAIL>',
is_active=True,
)
@pytest.fixture
def user1(db):
return User.objects.create_user(
email='<EMAIL>',
password='<PASSWORD>',
... | [
"demo.accounts.models.User.objects.create_user",
"demo.accounts.models.APIToken.objects.create_token"
] | [((107, 164), 'demo.accounts.models.User.objects.create_user', 'User.objects.create_user', ([], {'email': '"""<EMAIL>"""', 'is_active': '(True)'}), "(email='<EMAIL>', is_active=True)\n", (131, 164), False, 'from demo.accounts.models import User, APIToken\n'), ((232, 317), 'demo.accounts.models.User.objects.create_user'... |
# Generated by Django 3.0.3 on 2020-04-01 02:09
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('network', '0005_auto_20200401_0206'),
]
operations = [
migrations.AlterField(
model_name='post'... | [
"django.db.models.ManyToManyField"
] | [((366, 472), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'null': '(True)', 'related_name': '"""user_likes"""', 'to': 'settings.AUTH_USER_MODEL'}), "(blank=True, null=True, related_name='user_likes', to\n =settings.AUTH_USER_MODEL)\n", (388, 472), False, 'from django.db imp... |
"""Запуск основных операций с помощью CLI."""
import logging
import typer
import os
from poptimizer import config
from poptimizer.data.views import div_status
from poptimizer.evolve import Evolution
from poptimizer.portfolio import load_from_yaml, optimizer_hmean, optimizer_resample
LOGGER = logging.getLogger()
os.... | [
"logging.getLogger",
"poptimizer.evolve.Evolution",
"poptimizer.portfolio.optimizer_resample.Optimizer",
"typer.Typer",
"poptimizer.portfolio.load_from_yaml",
"poptimizer.portfolio.optimizer_hmean.Optimizer",
"poptimizer.data.views.div_status.dividends_validation",
"typer.Argument"
] | [((296, 315), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (313, 315), False, 'import logging\n'), ((419, 430), 'poptimizer.evolve.Evolution', 'Evolution', ([], {}), '()\n', (428, 430), False, 'from poptimizer.evolve import Evolution\n'), ((521, 560), 'poptimizer.data.views.div_status.dividends_validatio... |
# -*-encoding:utf-8-*-
from karlooper.utils.encrypt import StrEncryption
from karlooper.utils.base64encrypt import Encryption
from karlooper.utils.des_encrypt import DES
def test_encrypt():
str_encryption = StrEncryption()
str_encryption.input_key("test")
_str = "make a test"
encode_str = str_encrypt... | [
"karlooper.utils.base64encrypt.Encryption",
"karlooper.utils.encrypt.StrEncryption",
"karlooper.utils.des_encrypt.DES"
] | [((214, 229), 'karlooper.utils.encrypt.StrEncryption', 'StrEncryption', ([], {}), '()\n', (227, 229), False, 'from karlooper.utils.encrypt import StrEncryption\n'), ((573, 585), 'karlooper.utils.base64encrypt.Encryption', 'Encryption', ([], {}), '()\n', (583, 585), False, 'from karlooper.utils.base64encrypt import Encr... |