code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
from contextlib import contextmanager
from os import path
import importlib
# https://stackoverflow.com/a/41904558/2281355
@contextmanager
def add_to_path(p):
import sys
old_path = sys.path
old_modules = sys.modules
sys.modules = old_modules.copy()
sys.path = sys.path[:]
sys.path.inse... | [
"importlib.reload",
"babel.messages.extract.extract_javascript",
"os.path.dirname",
"sys.path.insert"
] | [((307, 328), 'sys.path.insert', 'sys.path.insert', (['(0)', 'p'], {}), '(0, p)\n', (322, 328), False, 'import sys\n'), ((870, 893), 'importlib.reload', 'importlib.reload', (['babel'], {}), '(babel)\n', (886, 893), False, 'import importlib\n'), ((932, 964), 'importlib.reload', 'importlib.reload', (['babel.messages'], {... |
import psycopg2
from psycopg2 import Error
try:
# Connect to an existing database
connection = psycopg2.connect(user="sa",
password="<PASSWORD>",
host="127.0.0.1",
port="5432",
... | [
"psycopg2.connect"
] | [((104, 209), 'psycopg2.connect', 'psycopg2.connect', ([], {'user': '"""sa"""', 'password': '"""<PASSWORD>"""', 'host': '"""127.0.0.1"""', 'port': '"""5432"""', 'database': '"""soildb"""'}), "(user='sa', password='<PASSWORD>', host='127.0.0.1', port=\n '5432', database='soildb')\n", (120, 209), False, 'import psycop... |
# -*- encoding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 6
_modified_time = 1433361565.2110319
_template_filename='templates/webapps/galaxy/admin/tool_sheds.mako'
_template_uri='/webapps/galaxy/admin/tool_sheds.ma... | [
"mako.cache.Cache",
"mako.runtime._inherit_from"
] | [((340, 377), 'mako.cache.Cache', 'cache.Cache', (['__name__', '_modified_time'], {}), '(__name__, _modified_time)\n', (351, 377), False, 'from mako import runtime, filters, cache\n'), ((1042, 1102), 'mako.runtime._inherit_from', 'runtime._inherit_from', (['context', 'u"""/base.mako"""', '_template_uri'], {}), "(contex... |
import time
import grbl
import pytest
import gcode
@pytest.fixture(scope="session")
def cnc(request):
grbl_cfg = {
"port": request.config.getoption("--port"),
"baudrate": request.config.getoption("--baudrate"),
}
cnc = grbl.Grbl(**grbl_cfg)
time.sleep(2)
cnc.reset()
# Metric
... | [
"gcode.GCode",
"grbl.Grbl",
"pytest.fixture",
"time.sleep",
"pytest.mark.parametrize",
"gcode.Line"
] | [((56, 87), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (70, 87), False, 'import pytest\n'), ((709, 781), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""laser_power"""', '[10, 50, 75, 100, 150, 200, 255]'], {}), "('laser_power', [10, 50, 75, 100, 150, 200, 2... |
import numpy as np
import autoeap
from numpy.testing import assert_array_almost_equal
import os
PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))
def test_raw_lightcurve():
time,flux,flux_err = autoeap.createlightcurve('EPIC220198696',campaign=8)
lc = np.genfromtxt(os.path.join(PACKAGEDIR,"EPIC22019869... | [
"os.path.dirname",
"os.path.join",
"autoeap.createlightcurve",
"numpy.testing.assert_array_almost_equal"
] | [((126, 151), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (141, 151), False, 'import os\n'), ((206, 259), 'autoeap.createlightcurve', 'autoeap.createlightcurve', (['"""EPIC220198696"""'], {'campaign': '(8)'}), "('EPIC220198696', campaign=8)\n", (230, 259), False, 'import autoeap\n'), ((360... |
import logging
import os
import urllib3
import ast
from common.utils.requests import http
from common.utils.networks import ETH
from common.services import cointainer_web3 as web3
from common.utils.ethereum import ERC20_ABI
logger = logging.getLogger('watchtower.common.services.unchained')
class UnchainedClient(ob... | [
"common.services.cointainer_web3.eth.contract",
"common.services.cointainer_web3.toChecksumAddress",
"os.getenv",
"logging.getLogger"
] | [((236, 293), 'logging.getLogger', 'logging.getLogger', (['"""watchtower.common.services.unchained"""'], {}), "('watchtower.common.services.unchained')\n", (253, 293), False, 'import logging\n'), ((705, 735), 'os.getenv', 'os.getenv', (['"""UNCHAINED_ETH_URL"""'], {}), "('UNCHAINED_ETH_URL')\n", (714, 735), False, 'imp... |
from django.core.management.base import BaseCommand
from rest_framework.authtoken.models import Token
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--force',
action='store_true',
help='WARNING - Understand that this logs out and *PER... | [
"rest_framework.authtoken.models.Token.objects.all"
] | [((573, 592), 'rest_framework.authtoken.models.Token.objects.all', 'Token.objects.all', ([], {}), '()\n', (590, 592), False, 'from rest_framework.authtoken.models import Token\n')] |
from config import Config
from main import determine_colour, return_tile_colour, coordinates_to_notation
def test_determine_colour():
assert determine_colour(0, 0)
assert not determine_colour(0, 7)
assert not determine_colour(7, 0)
assert determine_colour(7, 7)
def test_return_tile_colour():
ass... | [
"main.return_tile_colour",
"main.determine_colour",
"main.coordinates_to_notation"
] | [((147, 169), 'main.determine_colour', 'determine_colour', (['(0)', '(0)'], {}), '(0, 0)\n', (163, 169), False, 'from main import determine_colour, return_tile_colour, coordinates_to_notation\n'), ((257, 279), 'main.determine_colour', 'determine_colour', (['(7)', '(7)'], {}), '(7, 7)\n', (273, 279), False, 'from main i... |
# Essential modules import
import json
from paho.mqtt.client import *
# Variables modules import
from tools import *
# Importing custom Utility modules
from utility.logger import MyLogger
log = MyLogger("mqtt") # Logger
class Marker(Client):
'''
Client Marker : Broker client to send and/or receive MQTT pub... | [
"utility.logger.MyLogger",
"json.dumps"
] | [((194, 210), 'utility.logger.MyLogger', 'MyLogger', (['"""mqtt"""'], {}), "('mqtt')\n", (202, 210), False, 'from utility.logger import MyLogger\n'), ((2320, 2339), 'json.dumps', 'json.dumps', (['message'], {}), '(message)\n', (2330, 2339), False, 'import json\n')] |
import os, sys, ConfigParser
sys.path.insert(0, os.path.join(os.getcwd(), "Jinja2-2.3-py2.5.egg"))
sys.path.append(os.path.join(os.getcwd(), "netifaces-0.5-py2.5-linux-i686.egg"))
import jinja2, netifaces
_config = ConfigParser.SafeConfigParser()
_config.read("config.ini")
# iptables forwarding configuration ... | [
"netifaces.interfaces",
"ConfigParser.SafeConfigParser",
"models.PortForward.select",
"os.getcwd",
"os.system",
"netifaces.ifaddresses",
"jinja2.loaders.FileSystemLoader"
] | [((221, 252), 'ConfigParser.SafeConfigParser', 'ConfigParser.SafeConfigParser', ([], {}), '()\n', (250, 252), False, 'import os, sys, ConfigParser\n'), ((453, 475), 'netifaces.interfaces', 'netifaces.interfaces', ([], {}), '()\n', (473, 475), False, 'import jinja2, netifaces\n'), ((776, 804), 'os.system', 'os.system', ... |
from praline.client.project.pipeline.cache import Cache
from praline.client.project.pipeline.stage_resources import StageResources
from praline.client.project.pipeline.stages.stage import Stage
from praline.client.repository.remote_proxy import RemoteProxy
from praline.common.algorithm.graph.instance_traversal import m... | [
"praline.common.file_system.join",
"praline.client.project.pipeline.cache.Cache",
"praline.common.algorithm.graph.instance_traversal.multiple_instance_depth_first_traversal",
"praline.common.algorithm.graph.simple_traversal.root_last_traversal",
"praline.client.project.pipeline.stage_resources.StageResource... | [((1017, 1037), 'praline.common.tracing.trace', 'trace', ([], {'parameters': '[]'}), '(parameters=[])\n', (1022, 1037), False, 'from praline.common.tracing import trace\n'), ((2571, 2658), 'praline.common.algorithm.graph.instance_traversal.multiple_instance_depth_first_traversal', 'multiple_instance_depth_first_travers... |
import sys
import argparse
from textwrap import dedent
def main(kwargs):
with kwargs["infile"] as indata,\
kwargs["ofile"] as odata:
for line in indata:
odata.write(line)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
prog = "argparse_example", # defa... | [
"textwrap.dedent",
"argparse.FileType"
] | [((426, 626), 'textwrap.dedent', 'dedent', (['"""\n Please do not mess up this text!\n --------------------------------\n I have indented it\n exactly the way\n I want it\n """'], {}), '(\n """\n Please do not mess up this text!\n --------------... |
# Obliterate unused leaf bones in VRoid models!
import bpy
context = bpy.context
obj = context.object
# By default, VRM Importer includes leaf bones automatically.
# It's cool and stuff, but it's not necessary for Blender, and will spew out
# scary long warning when imported to UE4.
# Use this script to obliterate th... | [
"bpy.ops.object.mode_set"
] | [((402, 438), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {'mode': '"""EDIT"""'}), "(mode='EDIT')\n", (425, 438), False, 'import bpy\n'), ((578, 616), 'bpy.ops.object.mode_set', 'bpy.ops.object.mode_set', ([], {'mode': '"""OBJECT"""'}), "(mode='OBJECT')\n", (601, 616), False, 'import bpy\n')] |
# ------------------------------------------------------------------------------
# Hippocampus segmentation task for the HarP dataset
# (http://www.hippocampal-protocol.net/SOPs/index.php)
# ------------------------------------------------------------------------------
import os
import re
import SimpleITK as sitk
imp... | [
"nibabel.Nifti1Image",
"numpy.moveaxis",
"os.makedirs",
"mp.data.datasets.dataset_utils.get_dataset_name",
"os.path.isdir",
"numpy.asarray",
"re.match",
"SimpleITK.GetArrayFromImage",
"mp.data.datasets.dataset_utils.get_original_data_path",
"numpy.min",
"numpy.array",
"SimpleITK.GetImageFromAr... | [((3132, 3198), 'numpy.array', 'np.array', (['[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]'], {}), '([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])\n', (3140, 3198), True, 'import numpy as np\n'), ((3287, 3320), 'os.path.join', 'os.path.join', (['source_path', 'subset'], {}), '(source_path, subse... |
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
# code changed to Python3
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import tarfile
from IPython.display import display, Image
from scipy import ndima... | [
"sys.stdout.write",
"pickle.dump",
"numpy.random.seed",
"numpy.sum",
"pickle.load",
"numpy.arange",
"sys.stdout.flush",
"numpy.mean",
"numpy.ndarray",
"os.path.join",
"numpy.std",
"os.path.exists",
"numpy.reshape",
"tarfile.open",
"numpy.random.shuffle",
"os.stat",
"urllib.request.ur... | [((2095, 2114), 'numpy.random.seed', 'np.random.seed', (['(133)'], {}), '(133)\n', (2109, 2114), True, 'import numpy as np\n'), ((1683, 1700), 'os.stat', 'os.stat', (['filename'], {}), '(filename)\n', (1690, 1700), False, 'import os\n'), ((3488, 3506), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (3498, ... |
#!/usr/bin/env python
import serial
import time
from sys import stdout
print("starting jrk_simple_test")
ser = serial.Serial( "/dev/ttyACM0", 9600) # input to the JRK controller for sending it commands
print("connected to: " + ser.portstr + " for sending commands to JRK")
init_cmd = "\xAA"
jrk_id = "\x0B"
set_targ... | [
"serial.Serial",
"time.sleep"
] | [((113, 148), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""', '(9600)'], {}), "('/dev/ttyACM0', 9600)\n", (126, 148), False, 'import serial\n'), ((767, 782), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (777, 782), False, 'import time\n'), ((984, 1000), 'time.sleep', 'time.sleep', (['(0.01)'], {}),... |
# -*- coding: utf-8 -*-
"""livereload.app
Core Server of LiveReload.
"""
import os
import logging
import time
import mimetypes
import webbrowser
from tornado import ioloop
from tornado import escape
from tornado import websocket
from tornado.web import RequestHandler, Application
from tornado.util import ObjectDict
... | [
"tornado.ioloop.IOLoop.instance",
"os.path.join",
"mimetypes.guess_type",
"os.path.abspath",
"logging.error",
"os.path.dirname",
"os.path.exists",
"tornado.escape.json_encode",
"livereload.task.Task.watch",
"tornado.web.Application",
"os.listdir",
"webbrowser.open",
"os.path.isdir",
"os.ge... | [((5629, 5652), 'tornado.options.enable_pretty_logging', 'enable_pretty_logging', ([], {}), '()\n', (5650, 5652), False, 'from tornado.options import enable_pretty_logging\n'), ((5663, 5693), 'tornado.web.Application', 'Application', ([], {'handlers': 'handlers'}), '(handlers=handlers)\n', (5674, 5693), False, 'from to... |
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField
from wtforms.fields.simple import SubmitField
from wtforms.validators import DataRequired, NumberRange
class SimParamsForm(FlaskForm):
intellect = IntegerField('Intellect', [NumberRange(0,1000)])
spellpower = IntegerField('Spellpower... | [
"wtforms.validators.NumberRange"
] | [((260, 280), 'wtforms.validators.NumberRange', 'NumberRange', (['(0)', '(1000)'], {}), '(0, 1000)\n', (271, 280), False, 'from wtforms.validators import DataRequired, NumberRange\n'), ((332, 352), 'wtforms.validators.NumberRange', 'NumberRange', (['(0)', '(1000)'], {}), '(0, 1000)\n', (343, 352), False, 'from wtforms.... |
from nba_api.stats.endpoints._base import Endpoint
from nba_api.stats.library.http import NBAStatsHTTP
class TeamDetails(Endpoint):
endpoint = 'teamdetails'
expected_data = {'TeamAwardsChampionships': ['YEARAWARDED', 'OPPOSITETEAM'], 'TeamAwardsConf': ['YEARAWARDED', 'OPPOSITETEAM'], 'TeamAwardsDiv': ['YEARAW... | [
"nba_api.stats.library.http.NBAStatsHTTP",
"nba_api.stats.endpoints._base.Endpoint.DataSet"
] | [((1905, 1964), 'nba_api.stats.endpoints._base.Endpoint.DataSet', 'Endpoint.DataSet', ([], {'data': "data_sets['TeamAwardsChampionships']"}), "(data=data_sets['TeamAwardsChampionships'])\n", (1921, 1964), False, 'from nba_api.stats.endpoints._base import Endpoint\n'), ((1997, 2047), 'nba_api.stats.endpoints._base.Endpo... |
import unittest
class node():
def __init__(self, value=None):
self.value = value
self.left = None
self.right = None
def solution(root):
res = []
queue = []
queue.append(root)
while queue:
numberOfNodesInThisLevel = len(queue)
level = [queue.pop() for _ in r... | [
"unittest.main"
] | [((930, 945), 'unittest.main', 'unittest.main', ([], {}), '()\n', (943, 945), False, 'import unittest\n')] |
# -*- coding: utf-8 -*-
"""
This software is licensed under the License (MIT) located at
https://github.com/ephreal/rollbot/Licence
Please see the license for any restrictions or rights granted to you by the
License.
"""
from utils.rolling import rolling_utils
class Shadowrun3Roller():
"""
The shadowrun ro... | [
"utils.rolling.rolling_utils.roll"
] | [((2554, 2583), 'utils.rolling.rolling_utils.roll', 'rolling_utils.roll', (['dice_pool'], {}), '(dice_pool)\n', (2572, 2583), False, 'from utils.rolling import rolling_utils\n'), ((3281, 3310), 'utils.rolling.rolling_utils.roll', 'rolling_utils.roll', (['dice_pool'], {}), '(dice_pool)\n', (3299, 3310), False, 'from uti... |
"""
Copyright (C) 2020 SunSpec Alliance
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... | [
"xml.etree.ElementTree.parse",
"sunspec2.mdef.ModelDefinitionError",
"os.path.splitext",
"sunspec2.mdef.point_type_info.get"
] | [((4873, 4891), 'xml.etree.ElementTree.parse', 'ET.parse', (['filename'], {}), '(filename)\n', (4881, 4891), True, 'import xml.etree.ElementTree as ET\n'), ((5273, 5328), 'sunspec2.mdef.ModelDefinitionError', 'mdef.ModelDefinitionError', (['"""Model definition not found"""'], {}), "('Model definition not found')\n", (5... |
"""
MicroPython MY9221 LED driver
https://github.com/mcauser/micropython-my9221
MIT License
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includin... | [
"time.sleep_ms"
] | [((1460, 1471), 'time.sleep_ms', 'sleep_ms', (['(1)'], {}), '(1)\n', (1468, 1471), False, 'from time import sleep_ms\n'), ((1553, 1564), 'time.sleep_ms', 'sleep_ms', (['(1)'], {}), '(1)\n', (1561, 1564), False, 'from time import sleep_ms\n')] |
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import CASCADE
class Grant(models.Model):
nazwa_projektu = models.TextField(blank=True, null=True)
zrodlo_finansowania = models.TextFie... | [
"django.db.models.TextField",
"django.contrib.contenttypes.fields.GenericForeignKey",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.PositiveSmallIntegerField"
] | [((240, 279), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (256, 279), False, 'from django.db import models\n'), ((306, 345), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=T... |
"""Views for debugging and diagnostics"""
import pprint
import traceback
from codejail.safe_exec import safe_exec
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponse
from django.utils.html import escape
from django.views.decorators.csrf import ensure_csrf_cookie
f... | [
"pprint.pformat",
"common.djangoapps.edxmako.shortcuts.render_to_response",
"openedx.core.djangolib.markup.HTML",
"traceback.format_exc",
"codejail.safe_exec.safe_exec",
"django.utils.html.escape"
] | [((1387, 1438), 'common.djangoapps.edxmako.shortcuts.render_to_response', 'render_to_response', (['"""debug/run_python_form.html"""', 'c'], {}), "('debug/run_python_form.html', c)\n", (1405, 1438), False, 'from common.djangoapps.edxmako.shortcuts import render_to_response\n'), ((1020, 1132), 'codejail.safe_exec.safe_ex... |
"""Calculate metrics on graph"""
import graph_tool.all as gt
from .nodedataframe import NodeDataFrame
from .context import expect_nodes
def graph_component_count(G: gt.Graph,
directed: bool = False) -> NodeDataFrame:
expect_nodes(G)
counted_comp, _ = gt.label_components(G, directed=di... | [
"graph_tool.all.label_components",
"graph_tool.all.label_largest_component"
] | [((286, 327), 'graph_tool.all.label_components', 'gt.label_components', (['G'], {'directed': 'directed'}), '(G, directed=directed)\n', (305, 327), True, 'import graph_tool.all as gt\n'), ((534, 582), 'graph_tool.all.label_largest_component', 'gt.label_largest_component', (['G'], {'directed': 'directed'}), '(G, directed... |
from bevy.injection import AutoInject, detect_dependencies
from bevy.app.args import ArgumentParser, CLIArgs
from typing import Any
import os
@detect_dependencies
class Options(AutoInject):
"""The options object aggregates all options values that the Bevy.App application pulls in from the environment."""
arg... | [
"os.getcwd",
"os.environ.items"
] | [((1713, 1724), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1722, 1724), False, 'import os\n'), ((1865, 1883), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (1881, 1883), False, 'import os\n')] |
import logging
import numpy as np
import math
from .drawing import Camouflage, NoPattern, SolidColor, MultiGradient, ImagePattern, Gradient, Image, Symbol
from .fonts import LANGUAGE_MAP
from .generate import (
dataset_generator,
basic_attribute_sampler,
flatten_mask,
flatten_mask_except_first,
ad... | [
"numpy.random.rand",
"numpy.random.randn",
"numpy.random.choice"
] | [((17287, 17303), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (17301, 17303), True, 'import numpy as np\n'), ((17405, 17445), 'numpy.random.choice', 'np.random.choice', (['alphabet.symbols[:200]'], {}), '(alphabet.symbols[:200])\n', (17421, 17445), True, 'import numpy as np\n'), ((17560, 17598), 'numpy.ran... |
import ast
import os
import pickle
import sys
import stackimpact
import datetime
import argparse
import multiprocessing
from log import logger
from patterns import Miner
from patterns.models import Fragment, Pattern
from vcs.traverse import GitAnalyzer, RepoInfo, Method
import pyflowgraph
import changegraph
import se... | [
"pyflowgraph.export_graph_image",
"patterns.Miner",
"argparse.ArgumentParser",
"multiprocessing.set_start_method",
"vcs.traverse.GitAnalyzer",
"changegraph.export_graph_image",
"pickle.load",
"sys.setrecursionlimit",
"os.path.join",
"changegraph.build_from_files",
"log.logger.warning",
"settin... | [((589, 679), 'log.logger.info', 'logger.info', (['"""------------------------------ Starting ------------------------------"""'], {}), "(\n '------------------------------ Starting ------------------------------')\n", (600, 679), False, 'from log import logger\n'), ((683, 730), 'settings.get', 'settings.get', (['""... |
#!/usr/bin/python3
# DESCRIPTION
# An efficient python script that reads a line separated list of stock symbols
# with optional start and end dates for range and saves the relevant daily
# volume and adjusted closing prices from Yahoo Finance.
# a logfile is also created to summarise the outcome in terms of available ... | [
"csv.reader",
"argparse.ArgumentParser",
"os.makedirs",
"re.split",
"os.path.isdir",
"csv.DictReader",
"os.path.exists",
"collections.defaultdict",
"re.search",
"re.sub",
"re.compile"
] | [((5018, 5043), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5041, 5043), False, 'import argparse\n'), ((1172, 1192), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1186, 1192), False, 'import os\n'), ((1762, 1810), 're.search', 're.search', (['"""^[0-9]{4}-[0-9]{2}-[0-9]{2... |
from django.core.exceptions import SuspiciousOperation
import hashlib
import hmac
import base64
class SecureAcceptanceSigner(object):
def __init__(self, secret_key):
self.secret_key = secret_key
def sign(self, data, signed_fields):
key = self.secret_key.encode("utf-8")
msg_raw = self.... | [
"hmac.new",
"django.core.exceptions.SuspiciousOperation"
] | [((391, 429), 'hmac.new', 'hmac.new', (['key', 'msg_raw', 'hashlib.sha256'], {}), '(key, msg_raw, hashlib.sha256)\n', (399, 429), False, 'import hmac\n'), ((719, 773), 'django.core.exceptions.SuspiciousOperation', 'SuspiciousOperation', (['"""Request has no fields to verify"""'], {}), "('Request has no fields to verify... |
from os import makedirs, path
from lxml import html
import requests
import urllib
import getopt, sys, os
import re
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
#old_address = lambda n,city: f'https://guide.ancv.com/recherche/liste/cv?page={n}&rows=30&f%5B0%5D=im_fiel... | [
"selenium.webdriver.chrome.options.Options",
"getopt.getopt",
"time.sleep",
"lxml.html.fromstring",
"selenium.webdriver.Chrome",
"sys.exit"
] | [((1165, 1194), 'lxml.html.fromstring', 'html.fromstring', (['page.content'], {}), '(page.content)\n', (1180, 1194), False, 'from lxml import html\n'), ((1617, 1626), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (1624, 1626), False, 'from selenium.webdriver.chrome.options import Options\n')... |
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import plotly.express as px
import pandas as pd
import numpy as np
from app import app
from app import server
from apps import state, county
cases = pd.read_csv... | [
"dash_html_components.H3",
"dash_html_components.H6",
"dash_core_components.Location",
"dash_html_components.H2",
"pandas.read_csv",
"dash_html_components.Div",
"dash_html_components.A",
"dash.dependencies.Input",
"pandas.to_datetime",
"app.app.run_server",
"dash.dependencies.Output",
"dash_ht... | [((309, 338), 'pandas.read_csv', 'pd.read_csv', (['"""data/cases.csv"""'], {}), "('data/cases.csv')\n", (320, 338), True, 'import pandas as pd\n'), ((360, 393), 'pandas.to_datetime', 'pd.to_datetime', (['cases.report_date'], {}), '(cases.report_date)\n', (374, 393), True, 'import pandas as pd\n'), ((2197, 2231), 'dash.... |
#!/usr/bin/env python
"""
Bundle Python packages into a single script
A utility needed to build multiple files into a single script.
It can be useful for distribution or for easy writing of code
and bundle it (for example for www.codingame.com)
"""
import re
from distutils.core import setup
description, long_descri... | [
"re.split",
"distutils.core.setup"
] | [((328, 354), 're.split', 're.split', (['"""\n{2}"""', '__doc__'], {}), "('\\n{2}', __doc__)\n", (336, 354), False, 'import re\n'), ((356, 629), 'distutils.core.setup', 'setup', ([], {'name': '"""pyndler"""', 'version': '"""1.0.0"""', 'description': 'description', 'long_description': 'long_description', 'author': '"""<... |
#!/usr/bin/env python3
from datetime import datetime
#web3fusion
from web3fsnpy import Fsn
linkToChain = {
'network' : 'mainnet', # One of 'testnet', or 'mainnet'
'provider' : 'WebSocket', # One of 'WebSocket', 'HTTP', or 'IPC'
'gateway' : 'wss://mainnetpublicgateway1.fusionnetwork.io:... | [
"web3fsnpy.Fsn",
"datetime.datetime.fromtimestamp"
] | [((416, 432), 'web3fsnpy.Fsn', 'Fsn', (['linkToChain'], {}), '(linkToChain)\n', (419, 432), False, 'from web3fsnpy import Fsn\n'), ((751, 788), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['tck.StartTime'], {}), '(tck.StartTime)\n', (773, 788), False, 'from datetime import datetime\n'), ((813, 851), '... |
import re
import datetime
class DateFoldStreamProxy:
old_date = None
date_re = re.compile(r"(?P<year>\d\d\d\d)-(?P<month>\d\d)-(?P<day>\d\d).*")
def __init__(self, stream):
self.stream = stream
def close(self):
self.stream.close()
def render_month(self, date: datetime.date):
... | [
"datetime.date",
"re.sub",
"re.compile"
] | [((89, 161), 're.compile', 're.compile', (['"""(?P<year>\\\\d\\\\d\\\\d\\\\d)-(?P<month>\\\\d\\\\d)-(?P<day>\\\\d\\\\d).*"""'], {}), "('(?P<year>\\\\d\\\\d\\\\d\\\\d)-(?P<month>\\\\d\\\\d)-(?P<day>\\\\d\\\\d).*')\n", (99, 161), False, 'import re\n'), ((1063, 1101), 're.sub', 're.sub', (['"""\\\\s+\\\\n"""', '"""\\\\n""... |
import extract_features as ef
import numpy as np
with open('./input.csv','r',encoding='utf-8') as input_file:
with open('./dataset.csv','w',encoding='utf-8') as dataset:
for line in input_file:
r = line.split(',')
x = r[0].strip()
y = r[1].strip()
example = ef.extractFeatures(x)
r... | [
"numpy.array2string",
"extract_features.extractFeatures"
] | [((294, 315), 'extract_features.extractFeatures', 'ef.extractFeatures', (['x'], {}), '(x)\n', (312, 315), True, 'import extract_features as ef\n'), ((353, 392), 'numpy.array2string', 'np.array2string', (['example'], {'separator': '""","""'}), "(example, separator=',')\n", (368, 392), True, 'import numpy as np\n')] |
import click
import inflection
@click.command()
@click.argument("name")
@click.option("--doc")
def get_context(name, doc):
"""Generate a command with given name.
The command can be run immediately after generation.
For example:
dj generate command bar
dj run manage.py bar
"""
na... | [
"inflection.underscore",
"click.option",
"click.argument",
"click.command"
] | [((34, 49), 'click.command', 'click.command', ([], {}), '()\n', (47, 49), False, 'import click\n'), ((51, 73), 'click.argument', 'click.argument', (['"""name"""'], {}), "('name')\n", (65, 73), False, 'import click\n'), ((75, 96), 'click.option', 'click.option', (['"""--doc"""'], {}), "('--doc')\n", (87, 96), False, 'im... |
from contextlib import contextmanager
import requests
def _validate_response(response):
if response.status_code == 200:
return response
json = response.json()
raise Exception(json["message"])
def _release_lease(lease_id):
_validate_response(requests.post("http://localhost:3000/leases/release"... | [
"requests.post",
"requests.get"
] | [((268, 353), 'requests.post', 'requests.post', (['"""http://localhost:3000/leases/release"""'], {'json': "{'leaseId': lease_id}"}), "('http://localhost:3000/leases/release', json={'leaseId':\n lease_id})\n", (281, 353), False, 'import requests\n'), ((419, 504), 'requests.post', 'requests.post', (['"""http://localho... |
# 05 de Junio del 2018
# 31 Mayo 2018
import numpy as np
import matplotlib.pyplot as plt
from time import sleep
import cv2
class Recurrent_Photo:
'''
Recurrent Photo only for testing
'''
def __init__(self, iterations=100, resize=(1280, 720)):
self.camera = cv2.VideoCapture(0)
self.vi... | [
"numpy.abs",
"cv2.waitKey",
"numpy.zeros",
"time.sleep",
"cv2.VideoCapture",
"numpy.array",
"cv2.imshow",
"cv2.resize"
] | [((2183, 2191), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (2188, 2191), False, 'from time import sleep\n'), ((285, 304), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (301, 304), False, 'import cv2\n'), ((326, 373), 'numpy.zeros', 'np.zeros', (['[iterations, resize[1], resize[0], 3]'], {}), '([it... |
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
# https://www.rfc-editor.org/rfc/rfc4178.txt
from asn1crypto.core import ObjectIdentifier, Sequence, SequenceOf, Enumerated, GeneralString, OctetString, BitString, Choice, Any, Boolean
import enum
import os
import io
TAG = 'explicit'
# class
UNIVERSAL = 0
AP... | [
"io.BytesIO"
] | [((3357, 3373), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (3367, 3373), False, 'import io\n')] |
import docker
import boto3
import os
import sys
import base64
from datetime import datetime, timezone
def get_docker_client():
return docker.from_env()
def get_ecr_clients(settings):
clients = []
for region in settings['regions']:
clients.append(boto3.client('ecr',
aws_access_key_id=settings['acces... | [
"docker.from_env",
"boto3.client",
"base64.b64decode",
"datetime.datetime.now",
"sys.exit"
] | [((137, 154), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (152, 154), False, 'import docker\n'), ((481, 602), 'boto3.client', 'boto3.client', (['"""sts"""'], {'aws_access_key_id': "settings['access_key_id']", 'aws_secret_access_key': "settings['secret_access_key']"}), "('sts', aws_access_key_id=settings['ac... |
from samcli.cli.context import Context
import click
class LocalContext(Context):
def __init__(self):
super().__init__()
self._aws_account_id = None
@property
def aws_account_id(self):
return self._aws_account_id
@aws_account_id.setter
def aws_account_id(self, value):
... | [
"click.make_pass_decorator"
] | [((402, 441), 'click.make_pass_decorator', 'click.make_pass_decorator', (['LocalContext'], {}), '(LocalContext)\n', (427, 441), False, 'import click\n')] |
# coding=utf-8
'''Implementation of the Add Page form.
'''
try:
from five.formlib.formbase import AddForm
except ImportError:
from Products.Five.formlib.formbase import AddForm # lint:ok
from zope.component import createObject
from zope.formlib import form
from Products.Five.browser.pagetemplatefile import Zop... | [
"page.GSContentPage",
"zope.app.apidoc.interface.getFieldsInOrder",
"zope.formlib.form.Fields",
"zope.formlib.form.applyChanges",
"zope.component.createObject",
"Products.Five.formlib.formbase.AddForm.__init__",
"zope.app.form.browser.TextAreaWidget",
"zope.formlib.form.action",
"Products.Five.brows... | [((574, 604), 'zope.app.form.browser.TextAreaWidget', 'TextAreaWidget', (['field', 'request'], {}), '(field, request)\n', (588, 604), False, 'from zope.app.form.browser import TextAreaWidget\n'), ((786, 831), 'Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile', 'ZopeTwoPageTemplateFile', (['pageTemplateFil... |
#!/usr/bin/env python
#******************************************************************************
# From $Id: gdal2tiles.py 19288 2010-04-02 18:36:17Z rouault $
# VERSION MODIFIED FROM ORIGINAL, come with no warranty
# <NAME>
# input: vrt file (-addalpha) in 3857 projection (projection is forced due
# to weird effe... | [
"math.exp",
"os.unlink",
"math.tan",
"os.path.isfile",
"sqlite3.connect",
"os.listdir",
"sqlite3.Binary"
] | [((1070, 1100), 'sqlite3.connect', 'sqlite3.connect', (['self.filename'], {}), '(self.filename)\n', (1085, 1100), False, 'import sqlite3\n'), ((2197, 2226), 'os.path.isfile', 'os.path.isfile', (['self.filename'], {}), '(self.filename)\n', (2211, 2226), False, 'import os\n'), ((4183, 4202), 'os.listdir', 'os.listdir', (... |
from django.contrib import admin
from django.utils.html import format_html
# from django.contrib.auth.models import Group
from .models import Product, CartProduct, Order, Address, Payment, Coupon, Refund, Setting, ProductImages, Profile, \
Contact, Category, Size
# admin.site.unregister(Group)
class ProductI... | [
"django.contrib.admin.register",
"django.utils.html.format_html"
] | [((381, 404), 'django.contrib.admin.register', 'admin.register', (['Product'], {}), '(Product)\n', (395, 404), False, 'from django.contrib import admin\n'), ((1110, 1134), 'django.contrib.admin.register', 'admin.register', (['Category'], {}), '(Category)\n', (1124, 1134), False, 'from django.contrib import admin\n'), (... |
from typing import Callable
from queue import Queue
"""A type of depth-first walk of a tree (parent, left, right)"""
def pre_order_walk(node, result: list, left: Callable, right: Callable, parent: Callable):
if node is not None:
result.append(node)
if left(node) is not None:
pre_order_w... | [
"queue.Queue"
] | [((1787, 1794), 'queue.Queue', 'Queue', ([], {}), '()\n', (1792, 1794), False, 'from queue import Queue\n')] |
#!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import os
import sys
EXE_PATH = os.getcwd() # 실행 경로
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__)) # 스크립트 경로
UPPER_PATH = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 상위 경로
sys.path.append(UPPER_PATH) # 상위 경로를 추가
from my_tools import first_mo... | [
"sys.path.append",
"os.path.abspath",
"my_tools.first_module.function_1",
"os.getcwd",
"os.path.dirname"
] | [((79, 90), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (88, 90), False, 'import os\n'), ((250, 277), 'sys.path.append', 'sys.path.append', (['UPPER_PATH'], {}), '(UPPER_PATH)\n', (265, 277), False, 'import sys\n'), ((130, 155), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (145, 155), False... |
path = './stores.csv'
import pandas as pd
from shopify import extract_products_json
result = ''
with open(path) as csvfile:
df = pd.read_csv(csvfile)
url = df['url']
products = extract_products_json(url)
print(products) | [
"pandas.read_csv",
"shopify.extract_products_json"
] | [((135, 155), 'pandas.read_csv', 'pd.read_csv', (['csvfile'], {}), '(csvfile)\n', (146, 155), True, 'import pandas as pd\n'), ((191, 217), 'shopify.extract_products_json', 'extract_products_json', (['url'], {}), '(url)\n', (212, 217), False, 'from shopify import extract_products_json\n')] |
from setuptools import setup, find_packages
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='taming-transformers',
version='0.0.1-eden',
description='Taming Transformers for High-Resolution Image Synthesis',
packages=find_packages(),
include_package_data=True,
... | [
"setuptools.find_packages"
] | [((272, 287), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (285, 287), False, 'from setuptools import setup, find_packages\n')] |
#! /usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------... | [
"numpy.mean",
"numpy.equal.outer",
"numpy.invert"
] | [((2254, 2288), 'numpy.equal.outer', 'np.equal.outer', (['grouping', 'grouping'], {}), '(grouping, grouping)\n', (2268, 2288), True, 'import numpy as np\n'), ((2779, 2820), 'numpy.mean', 'np.mean', (['self._ranked_dists[grouping_tri]'], {}), '(self._ranked_dists[grouping_tri])\n', (2786, 2820), True, 'import numpy as n... |
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import time
import pandas as pd
import numpy as np
from datetime import datetime
from textblob import TextBlob
page = requests.get('https://qz.com/india/latest')
soup = BeautifulSoup(page.content, 'html.parser')
weblinks = soup.find_all('... | [
"pandas.DataFrame",
"datetime.datetime.now",
"pandas.read_excel",
"textblob.TextBlob",
"requests.get",
"bs4.BeautifulSoup",
"pandas.ExcelWriter"
] | [((199, 242), 'requests.get', 'requests.get', (['"""https://qz.com/india/latest"""'], {}), "('https://qz.com/india/latest')\n", (211, 242), False, 'import requests\n'), ((251, 293), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.content', '"""html.parser"""'], {}), "(page.content, 'html.parser')\n", (264, 293), False, '... |
from spreadsheet.utility import get_user_ccas, is_registered, register_user
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import ConversationHandler
import logging
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = l... | [
"logging.basicConfig",
"telegram.InlineKeyboardButton",
"telegram.InlineKeyboardMarkup",
"spreadsheet.utility.get_user_ccas",
"spreadsheet.utility.is_registered",
"logging.getLogger"
] | [((201, 308), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (220, 308), False, 'import logging\n'), ((319, 346), 'loggin... |
# Generated by Django 3.2.4 on 2021-10-11 10:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.migrations.swappable_dependency",
"django.db.models.BigAutoField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.DateField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((433, 529), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '... |
import json
import logging
import gevent
import os
import psutil
import six
from gevent import subprocess
from six.moves import range
from iris.core.interfaces import Interface
from iris.utils.sockets import create_socket
logger = logging.getLogger(__name__)
class Process(object):
def __init__(self, cmd, env=N... | [
"psutil.Process",
"six.moves.range",
"os.environ.copy",
"gevent.subprocess.Popen",
"iris.utils.sockets.create_socket",
"gevent.sleep",
"gevent.spawn",
"six.iteritems",
"logging.getLogger"
] | [((234, 261), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (251, 261), False, 'import logging\n'), ((559, 616), 'gevent.subprocess.Popen', 'subprocess.Popen', (['self.cmd'], {'env': 'self.env', 'close_fds': '(False)'}), '(self.cmd, env=self.env, close_fds=False)\n', (575, 616), False, '... |
# Standard
# PIP
from torch.utils.data import DataLoader
from pytorch_lightning import LightningDataModule
from torchtext.datasets import WikiText2
# Custom
class CustomDataModule(LightningDataModule):
def __init__(
self,
batch_size=1,
num_workers=0,
):
super().__init__()
... | [
"torchtext.datasets.WikiText2",
"torch.utils.data.DataLoader"
] | [((828, 943), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'self.train_dataset', 'batch_size': 'self.batch_size', 'shuffle': '(True)', 'num_workers': 'self.num_workers'}), '(dataset=self.train_dataset, batch_size=self.batch_size, shuffle=\n True, num_workers=self.num_workers)\n', (838, 943), False, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import speaksee.data as data
import numpy as np
import torch
'''class TestImageField(object):
def test_preprocessing(self):
field = data.ImageField()
image = ''
expected_image = ''
assert field.preproce... | [
"numpy.asarray",
"speaksee.data.TextField"
] | [((446, 462), 'speaksee.data.TextField', 'data.TextField', ([], {}), '()\n', (460, 462), True, 'import speaksee.data as data\n'), ((966, 1002), 'speaksee.data.TextField', 'data.TextField', ([], {'include_lengths': '(True)'}), '(include_lengths=True)\n', (980, 1002), True, 'import speaksee.data as data\n'), ((1160, 1188... |
import functools
import json
from datetime import datetime
from typing import Any, Dict
from .wikidatasession import WikidataSession
@functools.lru_cache()
def getPropertyType(propertyId: str):
repo = WikidataSession()
query = {
"action": "query",
"format": "json",
"prop": "revisions"... | [
"functools.lru_cache",
"json.loads"
] | [((137, 158), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (156, 158), False, 'import functools\n'), ((518, 537), 'json.loads', 'json.loads', (['jsonstr'], {}), '(jsonstr)\n', (528, 537), False, 'import json\n')] |
"""
# espn.py
# classes for scraping, parsing espn football data
# this does include some basic fantasy data
# espn_fantasy is mostly about managing fantasy teams
# NOTE: trouble accessing data in offseason
# will have to revisit this module as season approaches
"""
import logging
import re
from bs4 import Beautif... | [
"logging.NullHandler",
"bs4.BeautifulSoup",
"re.search",
"logging.getLogger",
"re.compile"
] | [((6740, 6770), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content', '"""lxml"""'], {}), "(content, 'lxml')\n", (6753, 6770), False, 'from bs4 import BeautifulSoup, NavigableString, Tag\n'), ((9377, 9407), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content', '"""lxml"""'], {}), "(content, 'lxml')\n", (9390, 9407), False, '... |
from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
DbCommitedEntity = declarative_base(metadata=MetaData(schema="commited")) | [
"sqlalchemy.MetaData"
] | [((134, 161), 'sqlalchemy.MetaData', 'MetaData', ([], {'schema': '"""commited"""'}), "(schema='commited')\n", (142, 161), False, 'from sqlalchemy import MetaData\n')] |
import pandas as pd
import numpy as np
import nltk
nltk.download('punkt')
import os
import nltk.corpus
from nltk.probability import FreqDist
from nltk.tokenize import word_tokenize
# read result
result = pd.read_csv("result.csv")
Tags = result["Tag"]
print(Tags)
allTag = ""
for row in result.index:
allTag = a... | [
"pandas.read_csv",
"nltk.download",
"nltk.probability.FreqDist",
"nltk.tokenize.word_tokenize"
] | [((51, 73), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (64, 73), False, 'import nltk\n'), ((206, 231), 'pandas.read_csv', 'pd.read_csv', (['"""result.csv"""'], {}), "('result.csv')\n", (217, 231), True, 'import pandas as pd\n'), ((362, 383), 'nltk.tokenize.word_tokenize', 'word_tokenize', (... |
from setuptools import setup, find_packages
setup(
name='blueliv-python-sdk',
version='2.3.0',
description='Blueliv API SDK for Python',
url='https://github.com/Blueliv/api-python-sdk',
author='Blueliv',
author_email='<EMAIL>',
license='MIT',
classifiers=[
'Development Status ::... | [
"setuptools.find_packages"
] | [((915, 967), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['contrib', 'docs', 'tests*']"}), "(exclude=['contrib', 'docs', 'tests*'])\n", (928, 967), False, 'from setuptools import setup, find_packages\n')] |
import sys
#import argparse
import pandas as pd
import matplotlib.pyplot as plt
from dztools.stats.intersample import intersample
from dztools.utils.makeplots import makeplots
xmin = 1 # define lower limit for probability density plots (PDPs) and kernel density estimates (KDEs) and all plots
xmax = 4000 #upper limit... | [
"pandas.read_csv",
"dztools.utils.makeplots.makeplots",
"dztools.stats.intersample.intersample",
"matplotlib.pyplot.show"
] | [((526, 547), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (537, 547), True, 'import pandas as pd\n'), ((600, 633), 'dztools.stats.intersample.intersample', 'intersample', (['df', 'xmin', 'xmax', 'xint'], {}), '(df, xmin, xmax, xint)\n', (611, 633), False, 'from dztools.stats.intersample import... |
import numpy as np
"""
:param MLLD_functions: this class has several functions that are usually used by myself.
"""
class MLLD_functions:
def standardization(self, variable):
"""
:param variable: the array with the variables you wish to standardize
:return: standardized array
"""
... | [
"numpy.std",
"numpy.average",
"numpy.array"
] | [((342, 362), 'numpy.average', 'np.average', (['variable'], {}), '(variable)\n', (352, 362), True, 'import numpy as np\n'), ((385, 401), 'numpy.std', 'np.std', (['variable'], {}), '(variable)\n', (391, 401), True, 'import numpy as np\n'), ((608, 630), 'numpy.array', 'np.array', (['new_variable'], {}), '(new_variable)\n... |
import random
import time
from pathlib import Path
import numpy as np
import json
import torch
from editsql.data_util import atis_batch
from editsql.data_util.atis_data import ATISDataset
from editsql.data_util.interaction import load_function
from editsql.model import model, utils_bert
from editsql.model.schema_inte... | [
"editsql.model.bert.modeling.BertModel",
"time.strftime",
"pathlib.Path",
"editsql.model.bert.modeling.BertConfig.from_json_file",
"editsql.model.schema_interaction_model.SchemaInteractionATISModel",
"torch.load",
"editsql.model.bert.tokenization.FullTokenizer",
"editsql.model.model.eval",
"json.dum... | [((10111, 10126), 'pathlib.Path', 'Path', (['directory'], {}), '(directory)\n', (10115, 10126), False, 'from pathlib import Path\n'), ((13090, 13133), 'editsql.model.bert.modeling.BertConfig.from_json_file', 'BertConfig.from_json_file', (['bert_config_file'], {}), '(bert_config_file)\n', (13115, 13133), False, 'from ed... |
"""User defined module for simulation."""
import numpy
def get_analytical(grid, asol, user_bc):
"""Compute and set the analytical solution.
Arguments
---------
grid : flowx.Grid object
Grid containing data.
asol : string
Name of the variable on the grid.
"""
X, Y = numpy... | [
"numpy.sin",
"numpy.meshgrid",
"numpy.cos"
] | [((315, 345), 'numpy.meshgrid', 'numpy.meshgrid', (['grid.x', 'grid.y'], {}), '(grid.x, grid.y)\n', (329, 345), False, 'import numpy\n'), ((856, 886), 'numpy.meshgrid', 'numpy.meshgrid', (['grid.x', 'grid.y'], {}), '(grid.x, grid.y)\n', (870, 886), False, 'import numpy\n'), ((396, 423), 'numpy.sin', 'numpy.sin', (['(2 ... |
from pipeline.feature_engineering.preprocessing.abstract_preprocessor import Preprocessor
from pipeline.feature_engineering.preprocessing.replacement_strategies.mean_replacement_strategy import MeanReplacementStrategy
from pipeline.feature_engineering.preprocessing.replacement_strategies.del_row_replacement_strategy im... | [
"pipeline.feature_engineering.preprocessing.replacement_strategies.del_row_replacement_strategy.DelRowReplacementStrategy",
"pipeline.feature_engineering.preprocessing.replacement_strategies.replacement_val_replacement_strategy.ReplacementValReplacementStrategy",
"pipeline.feature_engineering.preprocessing.repl... | [((11397, 11440), 'pandas.to_datetime', 'pandas.to_datetime', (['data[column]'], {'unit': 'unit'}), '(data[column], unit=unit)\n', (11415, 11440), False, 'import pandas\n'), ((15773, 15810), 'pandas.concat', 'pandas.concat', (['(labels, data)'], {'axis': '(1)'}), '((labels, data), axis=1)\n', (15786, 15810), False, 'im... |
"""Struct classes for car telemetry. Classes parse data from binary format and extract player data."""
import struct
import ctypes
from dataclasses import dataclass, asdict
from typing import List
PACKET_HEADER_FORMAT = "<HBBBBQfLBB"
PACKET_CAR_TELEMETRY_DATA_FORMAT = "BBb"
CAR_TELEMETRY_DATA_FORMAT = "HfffBbHBBHHHHHB... | [
"dataclasses.asdict",
"struct.unpack_from"
] | [((1886, 1935), 'struct.unpack_from', 'struct.unpack_from', (['format_string', 'binary_message'], {}), '(format_string, binary_message)\n', (1904, 1935), False, 'import struct\n'), ((2969, 2990), 'dataclasses.asdict', 'asdict', (['packet_header'], {}), '(packet_header)\n', (2975, 2990), False, 'from dataclasses import ... |
import os
from fastapi import FastAPI, HTTPException
from github3.exceptions import NotFoundError, ForbiddenError
from github3.github import GitHub
from github3.pulls import PullRequest
from pydantic import BaseModel
GITHUB_PRIVATE_KEY = os.environ.get('APP_PRIVATE_KEY', None)
GITHUB_APP_IDENTIFIER = os.environ.get('... | [
"os.environ.get",
"github3.github.GitHub",
"fastapi.HTTPException",
"fastapi.FastAPI"
] | [((240, 279), 'os.environ.get', 'os.environ.get', (['"""APP_PRIVATE_KEY"""', 'None'], {}), "('APP_PRIVATE_KEY', None)\n", (254, 279), False, 'import os\n'), ((304, 342), 'os.environ.get', 'os.environ.get', (['"""APP_IDENTIFIER"""', 'None'], {}), "('APP_IDENTIFIER', None)\n", (318, 342), False, 'import os\n'), ((440, 44... |
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
'''
print(lemmatizer.lemmatize("cacti"))
print(lemmatizer.lemmatize("geese"))
print(lemmatizer.lemmatize("rocks"))
print(lemmatizer.lemmatize("python"))
'''
#default pos="n"(noun)
#"a" = adjective, "v" = verb
#lemmas give back actual words, usual... | [
"nltk.stem.WordNetLemmatizer"
] | [((54, 73), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (71, 73), False, 'from nltk.stem import WordNetLemmatizer\n')] |
from django.urls import reverse
from django.db import models
# Create your models here
class Location(models.Model):
name = models.CharField(max_length=60)
def __str__(self):
return self.name
class Category(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(uniqu... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.SlugField",
"django.db.models.ImageField",
"django.urls.reverse"
] | [((129, 160), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(60)'}), '(max_length=60)\n', (145, 160), False, 'from django.db import models\n'), ((254, 286), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (270, 286), False, 'from django.db ... |
from PIL import ImageFont
def analysis(obj):
params = dict()
params['size'] = size(obj)
params['rgb'] = color(obj)
params['lines'] = line(obj)
params['ellipses'] = ellipse_and_rectangle(obj, 'ellipses')
params['rectangles'] = ellipse_and_rectangle(obj, 'rectangles')
params['texts'] = text(... | [
"PIL.ImageFont.truetype"
] | [((4858, 4885), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['ttf', '(30)'], {}), '(ttf, 30)\n', (4876, 4885), False, 'from PIL import ImageFont\n'), ((4670, 4697), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['ttf', '(30)'], {}), '(ttf, 30)\n', (4688, 4697), False, 'from PIL import ImageFont\n')] |
'''Combines oslo bors and yahoo data'''
import numpy as np
import pandas as pd
from pprint import pprint
import scrapeconfig as cng
def merge_bors_and_yahoo_dfs(bors_name: str, yahoo_name: str, result_filename: str):
'''
Get filenames for csv files from Oslo Bors and Yahoo Finance and merges them
... | [
"pandas.read_csv",
"pandas.merge"
] | [((371, 393), 'pandas.read_csv', 'pd.read_csv', (['bors_name'], {}), '(bors_name)\n', (382, 393), True, 'import pandas as pd\n'), ((410, 433), 'pandas.read_csv', 'pd.read_csv', (['yahoo_name'], {}), '(yahoo_name)\n', (421, 433), True, 'import pandas as pd\n'), ((692, 740), 'pandas.merge', 'pd.merge', (['df_bors', 'df_s... |
"""
Goldair WiFi Heater device.
"""
import logging
import json
from homeassistant.const import (
ATTR_TEMPERATURE, TEMP_CELSIUS, STATE_UNAVAILABLE
)
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE, ATTR_PRESET_MODE,
HVAC_MODE_OFF... | [
"custom_components.goldair_climate.GoldairTuyaDevice.get_key_for_value",
"logging.getLogger",
"json.dumps"
] | [((487, 514), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (504, 514), False, 'import logging\n'), ((6228, 6296), 'custom_components.goldair_climate.GoldairTuyaDevice.get_key_for_value', 'GoldairTuyaDevice.get_key_for_value', (['HVAC_MODE_TO_DPS_MODE', 'dps_mode'], {}), '(HVAC_MODE_TO_D... |
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.by import By
from sel... | [
"discord.RequestsWebhookAdapter",
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"random.randint",
"selenium.webdriver.Firefox",
"time.sleep",
"time.time",
"selenium.webdriver.support.ui.WebDriverWait"
] | [((742, 800), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'executable_path': "json['executable_path']"}), "(executable_path=json['executable_path'])\n", (759, 800), False, 'from selenium import webdriver\n'), ((670, 694), 'discord.RequestsWebhookAdapter', 'RequestsWebhookAdapter', ([], {}), '()\n', (692, 6... |
from asyncore import read
import os
import shutil
import yaml
import json
from app_logger import logger
from datetime import datetime
import uuid
def create_directory(path: str, is_recreate: bool = False)->None:
"""Utility to create the dirctory
Args:
path (str): Give the full path with directory name
... | [
"app_logger.logger.Logger",
"json.load",
"uuid.uuid4",
"os.makedirs",
"yaml.safe_load",
"shutil.rmtree",
"datetime.datetime.now"
] | [((562, 594), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (573, 594), False, 'import os\n'), ((1927, 2164), 'app_logger.logger.Logger', 'logger.Logger', ([], {'execution_id': 'execution_id', 'executed_by': 'executed_by', 'project_id': 'project_id', 'databasename': "param... |
"""Test of pmd_consumer functionality, with a selection of data."""
from os.path import join, expanduser
from async_cv.play_file import play_file
from async_cv.event_processing.pmd_consumer import pmd_consumer
data_root = 'OneDrive\\Documents\\NIWC\\NeuroComp\\boat_tests\\'
annot_root = 'OneDrive\\Documents\\NIWC\\N... | [
"os.path.join",
"os.path.expanduser",
"async_cv.play_file.play_file"
] | [((4289, 4473), 'async_cv.play_file.play_file', 'play_file', (['data_path', '(33)', 'pmd_consumer'], {'run_name': 'run_name', 'video_out': '(True)', 'targets': "['vessel', 'boat', 'RHIB']", 'annot_file': 'annot_path', 'show_metrics': '(False)', 'parameters': 'parameters'}), "(data_path, 33, pmd_consumer, run_name=run_n... |
# Generated by Django 2.1.4 on 2019-03-18 22:00
from django.db import migrations, models
import front.models
class Migration(migrations.Migration):
dependencies = [
('front', '0002_images_filename'),
]
operations = [
migrations.AlterField(
model_name='images',
na... | [
"django.db.models.ImageField"
] | [((350, 413), 'django.db.models.ImageField', 'models.ImageField', ([], {'unique': '(True)', 'upload_to': 'front.models.upld_dir'}), '(unique=True, upload_to=front.models.upld_dir)\n', (367, 413), False, 'from django.db import migrations, models\n')] |
"""tensorflow summary util"""
import tensorflow as tf
def mean_summary(var):
"""mean scalar summary
:type var: tensorflow.Variable
:param var: variable to add summary
"""
with tf.name_scope(var.name.split(":")[0]):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', m... | [
"tensorflow.summary.image",
"tensorflow.summary.scalar",
"tensorflow.reduce_mean",
"tensorflow.summary.histogram",
"tensorflow.square",
"tensorflow.reduce_max",
"tensorflow.reduce_min"
] | [((264, 283), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['var'], {}), '(var)\n', (278, 283), True, 'import tensorflow as tf\n'), ((293, 324), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['"""mean"""', 'mean'], {}), "('mean', mean)\n", (310, 324), True, 'import tensorflow as tf\n'), ((538, 557), 'tensorflow.re... |
from datetime import datetime
armstrong = datetime(1969, 7, 21, 14, 56, 15)
armstrong.date() # datetime.date(1969, 7, 21)
armstrong.time() # datetime.time(14, 56, 15)
armstrong.weekday() # 0 # in US week starts with Sunday
| [
"datetime.datetime"
] | [((44, 77), 'datetime.datetime', 'datetime', (['(1969)', '(7)', '(21)', '(14)', '(56)', '(15)'], {}), '(1969, 7, 21, 14, 56, 15)\n', (52, 77), False, 'from datetime import datetime\n')] |
# -*- coding: utf-8 -*-
"""Read polarity.
"""
import csv
def readfile(filepath, fmt='csv'):
with open(filepath, 'r') as f:
data = csv.reader(f, delimiter=',', skipinitialspace=True)
next(data)
r = {i[0]: int(i[1]) for i in data if not i[0].startswith("#")}
return r
| [
"csv.reader"
] | [((145, 196), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""","""', 'skipinitialspace': '(True)'}), "(f, delimiter=',', skipinitialspace=True)\n", (155, 196), False, 'import csv\n')] |
from django.contrib import admin
from .models import Planet, Jedi, Tests, Questions
# Register your models here.
admin.site.register(Planet)
admin.site.register(Jedi)
class TestsInline(admin.StackedInline):
model = Questions
extra = 0
@admin.register(Tests)
class QuestionsAdmin(admin.ModelAdmin):
inline... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((115, 142), 'django.contrib.admin.site.register', 'admin.site.register', (['Planet'], {}), '(Planet)\n', (134, 142), False, 'from django.contrib import admin\n'), ((143, 168), 'django.contrib.admin.site.register', 'admin.site.register', (['Jedi'], {}), '(Jedi)\n', (162, 168), False, 'from django.contrib import admin\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Contains function to call API for information about a team's games.
from bvlapi.api.call import call_api
from bvlapi.api.settings import API_BASE_URL
from bvlapi.common.exceptions import InvalidGuid
from bvlapi.guid.team import is_team_guid
def get_matches_by_guid(gu... | [
"bvlapi.api.call.call_api",
"bvlapi.guid.team.is_team_guid"
] | [((804, 817), 'bvlapi.api.call.call_api', 'call_api', (['url'], {}), '(url)\n', (812, 817), False, 'from bvlapi.api.call import call_api\n'), ((630, 648), 'bvlapi.guid.team.is_team_guid', 'is_team_guid', (['guid'], {}), '(guid)\n', (642, 648), False, 'from bvlapi.guid.team import is_team_guid\n')] |
import sqlite3
from pathlib import Path
from typing import Any, AsyncIterator, Dict
import aiohttp_jinja2
import aiosqlite
import jinja2
from aiohttp import web
router = web.RouteTableDef()
async def fetch_post(db: aiosqlite.Connection, post_id: int) -> Dict[str, Any]:
async with db.execute(
"select ow... | [
"aiohttp.web.RouteTableDef",
"sqlite3.connect",
"aiohttp.web.HTTPSeeOther",
"aiohttp_jinja2.template",
"aiosqlite.connect",
"pathlib.Path.cwd",
"aiohttp.web.Application"
] | [((173, 192), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (190, 192), False, 'from aiohttp import web\n'), ((758, 795), 'aiohttp_jinja2.template', 'aiohttp_jinja2.template', (['"""index.html"""'], {}), "('index.html')\n", (781, 795), False, 'import aiohttp_jinja2\n'), ((1308, 1343), 'aiohttp_jin... |
from custom_types import *
from constants import EPSILON
import igl
def scale_all(*values: T):
max_val = max([val.max().item() for val in values])
min_val = min([val.min().item() for val in values])
scale = max_val - min_val
values = [(val - min_val) / scale for val in values]
if len(values) == 1:... | [
"igl.remove_duplicate_vertices",
"igl.principal_curvature",
"igl.decimate",
"igl.gaussian_curvature",
"igl.fast_winding_number_for_meshes",
"igl.lscm",
"igl.per_vertex_normals",
"igl.remove_duplicates"
] | [((11061, 11096), 'igl.remove_duplicates', 'igl.remove_duplicates', (['*mesh', '(1e-08)'], {}), '(*mesh, 1e-08)\n', (11082, 11096), False, 'import igl\n'), ((11229, 11258), 'igl.gaussian_curvature', 'igl.gaussian_curvature', (['*mesh'], {}), '(*mesh)\n', (11251, 11258), False, 'import igl\n'), ((11384, 11424), 'igl.per... |
from django.test import TestCase
from django.urls import reverse
from model_mommy import mommy
from monitor.models import TwitterUser
from monitor.tests.utils.http_client_mixin import HTTPClientMixin
import mock
class TestTwitterUserView(HTTPClientMixin, TestCase):
def setUp(self):
super(TestTwitterUserV... | [
"django.urls.reverse",
"monitor.models.TwitterUser.objects.count",
"mock.Mock",
"model_mommy.mommy.make"
] | [((358, 382), 'django.urls.reverse', 'reverse', (['"""monitor:users"""'], {}), "('monitor:users')\n", (365, 382), False, 'from django.urls import reverse\n'), ((404, 450), 'model_mommy.mommy.make', 'mommy.make', (['"""monitor.TwitterUser"""'], {'_quantity': '(3)'}), "('monitor.TwitterUser', _quantity=3)\n", (414, 450),... |
"""
Sinusoidal Function Sphere function (2 random inputs, scalar output)
======================================================================
In this example, PCE is used to generate a surrogate model for a given set of 2D data.
.. math:: f(x) = x_1^2 + x_2^2
**Description:** Dimensions: 2
**Input Domain:** T... | [
"numpy.meshgrid",
"numpy.random.seed",
"matplotlib.pyplot.show",
"numpy.abs",
"UQpy.distributions.JointIndependent",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.ticker.LinearLocator",
"matplotlib.ticker.FormatStrFormatter",
"numpy.linspace",
"UQpy.distributions.Uniform",
"numpy.var"
... | [((1125, 1142), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1139, 1142), True, 'import numpy as np\n'), ((1153, 1184), 'UQpy.distributions.Uniform', 'Uniform', ([], {'loc': '(-5.12)', 'scale': '(10.24)'}), '(loc=-5.12, scale=10.24)\n', (1160, 1184), False, 'from UQpy.distributions import Uniform, Jo... |
from datetime import date
import boundaries
boundaries.register('Ottawa wards',
domain='Ottawa, ON',
last_updated=date(2010, 8, 27),
name_func=boundaries.dashed_attr('WARD_EN'),
id_func=boundaries.attr('WARD_NUM'),
authority='City of Ottawa',
source_url='http://ottawa.ca/online_services/openda... | [
"boundaries.attr",
"boundaries.dashed_attr",
"datetime.date"
] | [((124, 141), 'datetime.date', 'date', (['(2010)', '(8)', '(27)'], {}), '(2010, 8, 27)\n', (128, 141), False, 'from datetime import date\n'), ((157, 190), 'boundaries.dashed_attr', 'boundaries.dashed_attr', (['"""WARD_EN"""'], {}), "('WARD_EN')\n", (179, 190), False, 'import boundaries\n'), ((204, 231), 'boundaries.att... |
from nose.tools import *
import title_cleaner
TRUTH = [
(True, 'Manhattan: 1st Ave. - 34th St. E.'),
(True, 'Queens: Hoyt Avenue - 24th Street'),
(False, "Queens: Flushing Meadow Park - New York World's Fair of 1939-40 - [Industrial exhibits.]"),
(False, 'Fifth Avenue - 90th Street, southeast corner')... | [
"title_cleaner.is_pure_location"
] | [((1072, 1109), 'title_cleaner.is_pure_location', 'title_cleaner.is_pure_location', (['title'], {}), '(title)\n', (1102, 1109), False, 'import title_cleaner\n')] |
from discord.ext import commands
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Logged in as')
print(self.bot.user.name)
print(self.bot.user.id)
print('------')
def setup(bot):
bo... | [
"discord.ext.commands.Cog.listener"
] | [((122, 145), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (143, 145), False, 'from discord.ext import commands\n')] |
import datetime
import os
from models.system_model_v3.model.params.init import params
from models.system_model_v3.model.state_variables.init import state_variables
from models.constants import RAY
from experiments.system_model_v3.configure import configure_experiment
from experiments.system_model_v3.run import run_ex... | [
"experiments.system_model_v3.configure.configure_experiment",
"models.system_model_v3.model.params.init.params.update",
"os.path.realpath",
"experiments.system_model_v3.run.run_experiment",
"datetime.datetime.now"
] | [((659, 747), 'experiments.system_model_v3.configure.configure_experiment', 'configure_experiment', (['sweeps'], {'timesteps': 'SIMULATION_TIMESTEPS', 'runs': 'MONTE_CARLO_RUNS'}), '(sweeps, timesteps=SIMULATION_TIMESTEPS, runs=\n MONTE_CARLO_RUNS)\n', (679, 747), False, 'from experiments.system_model_v3.configure i... |
from get_config import get_config
from get_ansible import get_ansible
from get_helm import get_helm
from get_skaffold import get_skaffold
from get_docker import get_docker
from get_minikube import get_minikube
from get_regs import get_registries
from edit_hosts import edit_hosts
from c_registry import c_registry
if _... | [
"get_docker.get_docker",
"edit_hosts.edit_hosts",
"c_registry.c_registry",
"get_minikube.get_minikube",
"get_regs.get_registries",
"get_skaffold.get_skaffold",
"get_ansible.get_ansible",
"get_config.get_config"
] | [((347, 359), 'edit_hosts.edit_hosts', 'edit_hosts', ([], {}), '()\n', (357, 359), False, 'from edit_hosts import edit_hosts\n'), ((364, 376), 'get_docker.get_docker', 'get_docker', ([], {}), '()\n', (374, 376), False, 'from get_docker import get_docker\n'), ((383, 395), 'c_registry.c_registry', 'c_registry', ([], {}),... |
import numpy as np
import pytest
from fast_carpenter.selection.filters import Counter
@pytest.fixture
def weight_names():
return [
"EventWeight",
# "MuonWeight", "ElectronWeight", "JetWeight",
]
@pytest.fixture
def counter(weight_names):
return Counter(weight_names)
def test_init(weigh... | [
"pytest.raises",
"pytest.approx",
"numpy.array",
"fast_carpenter.selection.filters.Counter"
] | [((277, 298), 'fast_carpenter.selection.filters.Counter', 'Counter', (['weight_names'], {}), '(weight_names)\n', (284, 298), False, 'from fast_carpenter.selection.filters import Counter\n'), ((357, 378), 'fast_carpenter.selection.filters.Counter', 'Counter', (['weight_names'], {}), '(weight_names)\n', (364, 378), False... |
# coding:utf-8
import sys
from flask import Flask, jsonify
from flask_cors import CORS
from flask_migrate import Migrate
from flask_restplus import Api
from flasgger import Swagger
from alchemy.common.base import db
from marshmallow import Schema, fields, ValidationError, pre_load
from controllers import tests_cont... | [
"alchemy.common.base.db.init_app",
"flask_restplus.Api",
"flask_cors.CORS",
"flask.Flask",
"flask_migrate.Migrate",
"flasgger.Swagger",
"container.Container"
] | [((517, 528), 'container.Container', 'Container', ([], {}), '()\n', (526, 528), False, 'from container import Container\n'), ((622, 668), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (627, 668), False, 'from flask import Flask, jsonify\n'... |
from strato.racktest.infra.suite import *
from example_seeds import addition
import time
SIGNALLED_CALLABLE_CODE = """
import signal
import time
signalReceived = None
def signalHandler(sigNum, _):
global signalReceived
signalReceived = sigNum
signal.signal(signal.SIGUSR2, signalHandler)
while not signalRece... | [
"time.sleep"
] | [((1563, 1576), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1573, 1576), False, 'import time\n'), ((1975, 1988), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1985, 1988), False, 'import time\n'), ((2357, 2370), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (2367, 2370), False, 'import time\n')] |
# Reference : https://docs.atlassian.com/software/jira/docs/api/REST/8.5.3
# Reference : https://developer.atlassian.com/cloud/jira/platform/rest/v2/
# https://id.atlassian.com/manage/api-tokens - create the api token
# https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/ - doing it
from conf... | [
"configparser.ConfigParser",
"requests.get"
] | [((513, 527), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (525, 527), False, 'from configparser import ConfigParser\n'), ((1194, 1255), 'requests.get', 'requests.get', (['f"""{self.base_url}{route}"""'], {'headers': 'self.headers'}), "(f'{self.base_url}{route}', headers=self.headers)\n", (1206, 1255)... |
import os
import json
import re
import sys
from datetime import datetime
import logging
import wx
import zipfile
import shutil
import pcbnew
from .config import Config
from ..dialog import SettingsDialog
from ..errors import ParsingException
from .parser import Parser
class Logger(object):
def __init__(self... | [
"os.path.isabs",
"wx.LogWarning",
"zipfile.ZipFile",
"os.path.join",
"os.makedirs",
"os.path.basename",
"os.path.abspath",
"pcbnew.GetBoard",
"os.path.dirname",
"logging.StreamHandler",
"logging.getLogger",
"logging.Formatter",
"os.path.splitext",
"wx.MessageBox",
"datetime.datetime.now"... | [((1491, 1505), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1503, 1505), False, 'from datetime import datetime\n'), ((1732, 1763), 're.sub', 're.sub', (['"""[?%*:|"<>]"""', '"""_"""', 'name'], {}), '(\'[?%*:|"<>]\', \'_\', name)\n', (1738, 1763), False, 'import re\n'), ((3091, 3125), 'os.path.basename',... |
import torch as pt
import numpy as np
from model.PFSeg import PFSeg3D
from medpy.metric.binary import jc,hd95
from dataset.GuidedBraTSDataset3D import GuidedBraTSDataset3D
# from loss.FALoss3D import FALoss3D
import cv2
from loss.TaskFusionLoss import TaskFusionLoss
from loss.DiceLoss import BinaryDiceLoss
from config ... | [
"numpy.sum",
"argparse.ArgumentParser",
"torch.cuda.device_count",
"torch.no_grad",
"torch.nn.MSELoss",
"torch.nn.BCELoss",
"torch.utils.data.DataLoader",
"loss.TaskFusionLoss.TaskFusionLoss",
"cv2.imwrite",
"torch.load",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"tqdm.tqdm",
"model.PFSe... | [((500, 585), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Patch-free 3D Medical Image Segmentation."""'}), "(description='Patch-free 3D Medical Image Segmentation.'\n )\n", (523, 585), False, 'import argparse\n'), ((1956, 2004), 'dataset.GuidedBraTSDataset3D.GuidedBraTSDataset3D', ... |
from os.path import abspath, join
import subprocess
from django.apps import apps as django_apps
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.template.loader import render_to_string
from termcolor import colored
SEPARATOR = '----------------------------... | [
"django.conf.settings.EMBER_TOOLKIT.get",
"django.core.management.base.CommandError",
"django.apps.apps.get_app_configs"
] | [((765, 819), 'django.conf.settings.EMBER_TOOLKIT.get', 'settings.EMBER_TOOLKIT.get', (['key', 'DEFAULT_SETTINGS[key]'], {}), '(key, DEFAULT_SETTINGS[key])\n', (791, 819), False, 'from django.conf import settings\n'), ((3407, 3436), 'django.apps.apps.get_app_configs', 'django_apps.get_app_configs', ([], {}), '()\n', (3... |
from flask import render_template
def index():
return render_template('index.html')
def documentation():
return render_template('documentation.html')
def api_landing():
return render_template('api_landing.html')
| [
"flask.render_template"
] | [((59, 88), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (74, 88), False, 'from flask import render_template\n'), ((122, 159), 'flask.render_template', 'render_template', (['"""documentation.html"""'], {}), "('documentation.html')\n", (137, 159), False, 'from flask import ... |