code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import io
import torch
from torchvision import ops
from torchvision.models.detection.transform import GeneralizedRCNNTransform
from collections import OrderedDict
# onnxruntime requires python 3.5 or above
try:
import onnxruntime
except ImportError:
onnxruntime = None
import unittest
@unittest.skipIf(onnxr... | [
"unittest.main",
"unittest.skipIf",
"io.BytesIO",
"torch.jit._flatten",
"torchvision.ops.RoIAlign",
"torchvision.ops.RoIPool",
"torch.testing.assert_allclose",
"torch.manual_seed",
"torchvision.ops.MultiScaleRoIAlign",
"torch.randn",
"torchvision.models.detection.transform.GeneralizedRCNNTransfo... | [((299, 363), 'unittest.skipIf', 'unittest.skipIf', (['(onnxruntime is None)', '"""ONNX Runtime unavailable"""'], {}), "(onnxruntime is None, 'ONNX Runtime unavailable')\n", (314, 363), False, 'import unittest\n'), ((2946, 3033), 'unittest.skip', 'unittest.skip', (['"""Disable test until Resize opset 11 is implemented ... |
from cloudify.decorators import workflow
from cloudify.workflows import ctx
import re
from fabric.api import run,env
#
# Run an image on the cluster pointed to by the master arg
#
@workflow
def kube_run(**kwargs):
setfabenv(kwargs)
optstr=buildopts(kwargs,{"dry_run":"dry-run"},{"port":"not _val_ == -1"},["dry_run... | [
"fabric.api.env.update",
"fabric.api.run",
"cloudify.workflows.ctx.get_node"
] | [((392, 470), 'fabric.api.run', 'run', (["('./kubectl -s http://localhost:8080 run ' + ' ' + kwargs['name'] + optstr)"], {}), "('./kubectl -s http://localhost:8080 run ' + ' ' + kwargs['name'] + optstr)\n", (395, 470), False, 'from fabric.api import run, env\n'), ((857, 868), 'fabric.api.run', 'run', (['runstr'], {}), ... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import IndexLocator, FormatStrFormatter
'''
<NAME>, Dec 2015
Plotting routine for initial 'test' runs of ELC.
It will make a plot that has both light curve data w/fit and RV data w/fit.
There are also residua... | [
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.median",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.subplot2grid",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figtext",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.loadtxt",
"numpy.interp",... | [((1544, 1619), 'numpy.loadtxt', 'np.loadtxt', (['f1'], {'comments': '"""#"""', 'dtype': 'np.float64', 'usecols': '(0, 1)', 'unpack': '(True)'}), "(f1, comments='#', dtype=np.float64, usecols=(0, 1), unpack=True)\n", (1554, 1619), True, 'import numpy as np\n'), ((1731, 1806), 'numpy.loadtxt', 'np.loadtxt', (['f3'], {'c... |
'''
@date: 22/11/2020
@author: <NAME>
@email: <EMAIL>
'''
from configparser import ConfigParser
import os
DEFAULT_CONFIG_FILE = 'settings.ini'
def get_config_file():
return os.environ.get('CONFIG_FILE', DEFAULT_CONFIG_FILE)
CONFIG_FILE = get_config_file()
def create_config(config_file=None):
parser = ConfigP... | [
"os.environ.get",
"configparser.ConfigParser"
] | [((178, 228), 'os.environ.get', 'os.environ.get', (['"""CONFIG_FILE"""', 'DEFAULT_CONFIG_FILE'], {}), "('CONFIG_FILE', DEFAULT_CONFIG_FILE)\n", (192, 228), False, 'import os\n'), ((313, 327), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (325, 327), False, 'from configparser import ConfigParser\n')] |
#!/usr/local/bin/python3
from notionscripts.notion_api import NotionApi
api = NotionApi()
def app_url(browser_url):
return browser_url.replace("https://", "notion://")
message = None
for row in api.get_active_tasks():
message = "%s | href=%s" % (row.title, app_url(row.get_browseable_url()))
print(messa... | [
"notionscripts.notion_api.NotionApi"
] | [((79, 90), 'notionscripts.notion_api.NotionApi', 'NotionApi', ([], {}), '()\n', (88, 90), False, 'from notionscripts.notion_api import NotionApi\n')] |
from setuptools import setup, find_packages
with open("README.md") as readme_file:
readme = readme_file.read()
# FIXME: Convert to ReST
requirements = [
"exifread",
"humanfriendly",
"jsonschema",
"lxml",
"pandas",
"pillow",
"pyyaml",
"tqdm",
"numpy",
"pycocotools",
... | [
"setuptools.find_packages"
] | [((651, 700), 'setuptools.find_packages', 'find_packages', ([], {'include': "['weedcoco', 'weedcoco.*']"}), "(include=['weedcoco', 'weedcoco.*'])\n", (664, 700), False, 'from setuptools import setup, find_packages\n')] |
import contextlib
import random
import re
import time
import unittest.mock as um
from typing import List
import pytest
from .. import io, logger
def test_add_duration():
event: logger.Event = {}
with logger.add_duration(event):
time.sleep(0.01)
assert event["duration"] > 0
def test_set_time():... | [
"unittest.mock.Mock",
"time.sleep",
"pytest.raises",
"random.seed",
"re.search"
] | [((397, 467), 're.search', 're.search', (['"""\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}"""', "header['time']"], {}), "('\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}', header['time'])\n", (406, 467), False, 'import re\n'), ((695, 711), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (706, ... |
"""coBib's Redo command.
This command can be used to re-apply the changes *of a previously undone* command:
```
cobib redo
```
This command takes *no* additional arguments!
Note, that if you have not used `cobib undo` previously, this command will have no effect!
Furthermore, this command is *only* available if coBi... | [
"cobib.database.Database",
"subprocess.check_output",
"sys.exit",
"cobib.config.Event.PreRedoCommand.fire",
"cobib.utils.rel_path.RelPath",
"cobib.config.Event.PostRedoCommand.fire",
"logging.getLogger"
] | [((902, 929), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (919, 929), False, 'import logging\n'), ((2883, 2915), 'cobib.config.Event.PreRedoCommand.fire', 'Event.PreRedoCommand.fire', (['largs'], {}), '(largs)\n', (2908, 2915), False, 'from cobib.config import Event, config\n'), ((2976... |
# -*- coding: utf-8 -*-
"""
idfy_rest_client.models.jwt_payload
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
from idfy_rest_client.api_helper import APIHelper
import idfy_rest_client.models.signature_error
import idfy_rest_client.models.sign_success
c... | [
"idfy_rest_client.api_helper.APIHelper.RFC3339DateTime"
] | [((2202, 2236), 'idfy_rest_client.api_helper.APIHelper.RFC3339DateTime', 'APIHelper.RFC3339DateTime', (['expires'], {}), '(expires)\n', (2227, 2236), False, 'from idfy_rest_client.api_helper import APIHelper\n')] |
import os
from collections import namedtuple
from conans import Options
from conans.model.conan_file import ConanFile
from conans.model.options import PackageOptions
from conans.test.utils.tools import TestBufferConanOutput
class MockSettings(object):
def __init__(self, values):
self.values = values
... | [
"conans.test.utils.tools.TestBufferConanOutput",
"os.environ.items",
"conans.model.options.PackageOptions.loads",
"collections.namedtuple"
] | [((1038, 1061), 'conans.test.utils.tools.TestBufferConanOutput', 'TestBufferConanOutput', ([], {}), '()\n', (1059, 1061), False, 'from conans.test.utils.tools import TestBufferConanOutput\n'), ((4070, 4093), 'conans.test.utils.tools.TestBufferConanOutput', 'TestBufferConanOutput', ([], {}), '()\n', (4091, 4093), False,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import os
import sys
import traceback
sys.path.append("..") # Since examples are buried one level into source tree
from asyncpushbullet import AsyncPushbullet
__author__ = "<NAME>"
__email__ = "<EMAIL>"
API_KEY = "" # YOUR API KEY
PROXY = os.environ.get... | [
"sys.path.append",
"asyncio.get_event_loop",
"asyncpushbullet.AsyncPushbullet",
"os.environ.get",
"sys.exc_info"
] | [((101, 122), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (116, 122), False, 'import sys\n'), ((306, 335), 'os.environ.get', 'os.environ.get', (['"""https_proxy"""'], {}), "('https_proxy')\n", (320, 335), False, 'import os\n'), ((339, 367), 'os.environ.get', 'os.environ.get', (['"""http_proxy"... |
# Generated by Django 3.2.8 on 2021-11-20 20:03
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Inventory',
fields=[
('id',... | [
"django.db.models.TextField",
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((321, 417), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (340, 417), False, 'from django.db import migrations, m... |
"""Unit tests for code in urllib.response."""
import socket
import tempfile
import urllib.response
import unittest
class TestResponse(unittest.TestCase):
def setUp(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.fp = self.sock.makefile('rb')
self.test... | [
"unittest.main",
"socket.socket"
] | [((1770, 1785), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1783, 1785), False, 'import unittest\n'), ((208, 257), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (221, 257), False, 'import socket\n')] |
from richkit.retrieve.cert_sh import DomainCertificates
from richkit.retrieve.x509 import X509
def get_logs(domain):
"""
Get a list of certificates with all the features
:param domain: Input domain
"""
try:
certs = DomainCertificates(domain)
return certs.get_all()
except Except... | [
"richkit.retrieve.cert_sh.DomainCertificates",
"richkit.retrieve.x509.X509"
] | [((245, 271), 'richkit.retrieve.cert_sh.DomainCertificates', 'DomainCertificates', (['domain'], {}), '(domain)\n', (263, 271), False, 'from richkit.retrieve.cert_sh import DomainCertificates\n'), ((504, 530), 'richkit.retrieve.cert_sh.DomainCertificates', 'DomainCertificates', (['domain'], {}), '(domain)\n', (522, 530)... |
from django.urls import path, reverse_lazy
from . import views
app_name = "home"
urlpatterns = [
path("", views.home_view, name="home_page"),
path("unauthorized", views.unauthorized_view, name="unauthorized_view"),
path("reset_password", views.reset_password, name="reset_password"),
]
| [
"django.urls.path"
] | [((102, 145), 'django.urls.path', 'path', (['""""""', 'views.home_view'], {'name': '"""home_page"""'}), "('', views.home_view, name='home_page')\n", (106, 145), False, 'from django.urls import path, reverse_lazy\n'), ((151, 222), 'django.urls.path', 'path', (['"""unauthorized"""', 'views.unauthorized_view'], {'name': '... |
import math
import subprocess
import sys
# Run with arg "a" to analyze, "r" to run.
# Run executes the algorithm (edit source code here for different configurations)
# Analyze will compile a summary of the outputs. Again, edit this file to extract different details.
assert len(sys.argv) == 2
do_summarize = sys.argv... | [
"subprocess.run"
] | [((1588, 1623), 'subprocess.run', 'subprocess.run', (['command'], {'shell': '(True)'}), '(command, shell=True)\n', (1602, 1623), False, 'import subprocess\n')] |
import argparse
import csv
from os import listdir
from os.path import isfile, join, basename
class Table:
name: str
tuples: list = []
attributes: list = []
def file_to_table(file_path: str) -> Table:
table: Table = Table()
table.name = basename(file_path).split(".")[0]
with open(file_path) a... | [
"csv.reader",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.join",
"os.listdir"
] | [((942, 1017), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Converts CSV files to RelaX Dataset."""'}), "(description='Converts CSV files to RelaX Dataset.')\n", (965, 1017), False, 'import argparse\n'), ((1505, 1527), 'os.path.join', 'join', (['args.input', 'file'], {}), '(args.input,... |
# -*- coding: utf-8 -*-
__all__ = [
'predict',
'redistribute',
'simulate',
'walk_probability'
]
###########
# IMPORTS #
###########
# Libraries
import numpy as _np
# Internal
from .custom_types import (
oint as _oint,
olist_int as _olist_int,
tarray as _tarray,
tlist_int as _tlist... | [
"numpy.sum",
"numpy.log",
"numpy.ravel",
"numpy.zeros",
"numpy.split",
"numpy.max",
"numpy.exp"
] | [((935, 979), 'numpy.zeros', '_np.zeros', (['(steps + 1, mc.size)'], {'dtype': 'float'}), '((steps + 1, mc.size), dtype=float)\n', (944, 979), True, 'import numpy as _np\n'), ((1990, 2000), 'numpy.exp', '_np.exp', (['p'], {}), '(p)\n', (1997, 2000), True, 'import numpy as _np\n'), ((1119, 1139), 'numpy.sum', '_np.sum',... |
""" Test database backends """
from numpy.testing import *
from PyMC2 import Model, database
from PyMC2.examples import DisasterModel
class test_no_trace(NumpyTestCase):
def check(self):
M = Model(DisasterModel, db='no_trace')
M.sample(1000,500,2, verbose=False)
try:
assert_eq... | [
"PyMC2.Model"
] | [((206, 241), 'PyMC2.Model', 'Model', (['DisasterModel'], {'db': '"""no_trace"""'}), "(DisasterModel, db='no_trace')\n", (211, 241), False, 'from PyMC2 import Model, database\n'), ((470, 500), 'PyMC2.Model', 'Model', (['DisasterModel'], {'db': '"""ram"""'}), "(DisasterModel, db='ram')\n", (475, 500), False, 'from PyMC2... |
# Generated by Django 3.0.8 on 2020-08-11 08:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth_access_admin', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='familyme... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.BooleanField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.ImageField"
] | [((373, 482), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '(0)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""auth_access_admin.Address"""'}), "(default=0, on_delete=django.db.models.deletion.CASCADE,\n to='auth_access_admin.Address')\n", (390, 482), False, 'from django.db imp... |
# This example demonstrates prototype of the update model that Ryan, Alex, and Chip discussed.
################################################################################################################################
# Everything here would be part of a DH library
##############################################... | [
"numpy.zeros",
"deephaven.TableTools.timeTable",
"numpy.sum",
"deephaven.QueryScope.addParam"
] | [((4181, 4222), 'deephaven.QueryScope.addParam', 'QueryScope.addParam', (['"""gatherer"""', 'gatherer'], {}), "('gatherer', gatherer)\n", (4200, 4222), False, 'from deephaven import QueryScope\n'), ((4227, 4268), 'deephaven.QueryScope.addParam', 'QueryScope.addParam', (['"""computer"""', 'computer'], {}), "('computer',... |
import pandas as pd # type: ignore
import json
from datetime import datetime
from json import JSONEncoder
from typing import Any, Dict, List, Union, TYPE_CHECKING
from aat.config import Side
from aat.core import Order, Trade, Instrument, ExchangeType, Position
if TYPE_CHECKING:
from aat.strategy import Strategy
... | [
"pandas.DataFrame",
"json.load",
"json.loads",
"aat.core.Position",
"aat.core.Position.fromJson",
"datetime.datetime.fromtimestamp",
"aat.core.Trade.fromJson",
"pandas.concat"
] | [((6856, 7003), 'aat.core.Position', 'Position', ([], {'price': 'trade.price', 'size': 'trade.volume', 'timestamp': 'trade.timestamp', 'instrument': 'trade.instrument', 'exchange': 'trade.exchange', 'trades': '[trade]'}), '(price=trade.price, size=trade.volume, timestamp=trade.timestamp,\n instrument=trade.instrumen... |
from __future__ import annotations
from unittest import TestCase
from jsonclasses.excs import ValidationException
from tests.classes.simple_article import SimpleArticle
from tests.classes.simple_language import SimpleLanguage
from tests.classes.simple_project import SimpleProject
from tests.classes.simple_chart import ... | [
"tests.classes.author.Author",
"tests.classes.linked_profile.LinkedProfile",
"tests.classes.simple_language.SimpleLanguage",
"tests.classes.simple_article.SimpleArticle",
"tests.classes.simple_chart.SimpleChart",
"tests.classes.linked_user.LinkedUser",
"tests.classes.simple_project.SimpleProject"
] | [((605, 659), 'tests.classes.simple_article.SimpleArticle', 'SimpleArticle', ([], {'title': '"""U Ia Huê"""', 'content': '"""Bê Tshua Bo"""'}), "(title='U Ia Huê', content='Bê Tshua Bo')\n", (618, 659), False, 'from tests.classes.simple_article import SimpleArticle\n'), ((792, 807), 'tests.classes.simple_article.Simple... |
#
# Test for API infrastructure
#
import os
import multiprocessing as mp
import tempfile
import unittest
import osbuild
from osbuild.util import jsoncomm
class APITester(osbuild.api.BaseAPI):
"""Records the number of messages and if it got cleaned up"""
def __init__(self, sockaddr):
super().__init__... | [
"osbuild.api.API",
"osbuild.api.metadata",
"tempfile.TemporaryDirectory",
"osbuild.api.exception_handler",
"osbuild.util.jsoncomm.Socket.new_client",
"multiprocessing.Process",
"os.path.join"
] | [((742, 771), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (769, 771), False, 'import tempfile\n'), ((922, 959), 'os.path.join', 'os.path.join', (['self.tmp.name', '"""socket"""'], {}), "(self.tmp.name, 'socket')\n", (934, 959), False, 'import os\n'), ((1575, 1612), 'os.path.join', 'o... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Engine-yadage command line interface."""
from __future__ import absolu... | [
"base64.standard_b64decode",
"logging.basicConfig",
"yadage.utils.setupbackend_fromstring",
"click.option",
"os.path.exists",
"click.command",
"os.umask",
"yadage.steering_api.steering_ctx",
"yadageschemas.load",
"os.path.join",
"reana_commons.utils.check_connection_to_job_controller",
"loggin... | [((855, 922), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'REANA_LOG_LEVEL', 'format': 'REANA_LOG_FORMAT'}), '(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT)\n', (874, 922), False, 'import logging\n'), ((929, 962), 'logging.getLogger', 'logging.getLogger', (['LOGGING_MODULE'], {}), '(LOGGING_MODULE)\n... |
import pytest
from fdsolver.classes import FD, FDSet
from tests.fixtures import fdsets
def test_fd_equality():
rel_abc = set('ABC')
rel_cde = set('CDE')
rel_ad = set('AD')
rel_de = set('DE')
rel_b = set('B')
rel_e = set('E')
fd_abc_de = FD(rel_abc, rel_de)
fd_abc_de2 = FD(rel_abc, rel_... | [
"fdsolver.classes.FD"
] | [((267, 286), 'fdsolver.classes.FD', 'FD', (['rel_abc', 'rel_de'], {}), '(rel_abc, rel_de)\n', (269, 286), False, 'from fdsolver.classes import FD, FDSet\n'), ((304, 323), 'fdsolver.classes.FD', 'FD', (['rel_abc', 'rel_de'], {}), '(rel_abc, rel_de)\n', (306, 323), False, 'from fdsolver.classes import FD, FDSet\n'), ((3... |
#!/usr/bin/env python
import PySimpleGUI as sg
import sys
import os
import csv
import pandas as pd
import re
# TODOS:
# Add props at run time
# sg.theme('Dark Red')
sg.theme('Dark Blue 3')
# print = sg.Print
bigfont = ("Arial", 16)
rule = ("Arial", 10)
def pad(s, l=12):
return s.ljust(l, " ")
def getlines(fil... | [
"csv.reader",
"pandas.read_csv",
"PySimpleGUI.StatusBar",
"pandas.DataFrame",
"PySimpleGUI.theme",
"PySimpleGUI.InputText",
"os.path.exists",
"PySimpleGUI.FolderBrowse",
"PySimpleGUI.Window",
"re.search",
"PySimpleGUI.popup_ok_cancel",
"os.system",
"PySimpleGUI.FileBrowse",
"re.compile",
... | [((167, 190), 'PySimpleGUI.theme', 'sg.theme', (['"""Dark Blue 3"""'], {}), "('Dark Blue 3')\n", (175, 190), True, 'import PySimpleGUI as sg\n'), ((832, 861), 're.compile', 're.compile', (['"""\\\\[([^\\\\]]*)\\\\]"""'], {}), "('\\\\[([^\\\\]]*)\\\\]')\n", (842, 861), False, 'import re\n'), ((5970, 6067), 'csv.reader',... |
from solarlib.error_handling import (
ValueOutOfRange,
raise_type_error,
type_check)
from solarlib.solar import (
sunrise,
sunset,
estimated_irradiance,
solar_noon
)
import pytz
import datetime
class Location:
def __init__(self, latitude, longitude, timezone=None):
self.set... | [
"solarlib.solar.solar_noon",
"solarlib.error_handling.type_check",
"solarlib.solar.estimated_irradiance",
"solarlib.solar.sunset",
"solarlib.error_handling.raise_type_error",
"solarlib.solar.sunrise",
"datetime.datetime.strptime",
"solarlib.error_handling.ValueOutOfRange",
"datetime.timedelta",
"p... | [((2456, 2479), 'solarlib.solar.sunrise', 'sunrise', (['date', 'lat', 'lon'], {}), '(date, lat, lon)\n', (2463, 2479), False, 'from solarlib.solar import sunrise, sunset, estimated_irradiance, solar_noon\n'), ((2495, 2518), 'solarlib.solar.sunrise', 'sunrise', (['base', 'lat', 'lon'], {}), '(base, lat, lon)\n', (2502, ... |
'''Prediction and plotting routine
In preparation for prediction and plotting, this script will:
1) Load the obs_dimensions
2) Specify the input_dimensions and latent_dimensions
3) Instantiate the DataHandler class
4) Instantiate the neural network
5) Load the trained neural network weights
6) ... | [
"sys.path.append",
"matplotlib.pyplot.title",
"numpy.log",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.close",
"neural_networks.nn_vaeiaf.VAEIAF",
"numpy.expand_dims",
"matplotlib.pyplot.figure",
"utils_data.data_handler.DataHandler",
"numpy.linspa... | [((968, 1001), 'sys.path.append', 'sys.path.append', (['"""../../../../.."""'], {}), "('../../../../..')\n", (983, 1001), False, 'import sys\n'), ((1074, 1084), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (1082, 1084), True, 'import matplotlib.pyplot as plt\n'), ((2374, 2463), 'utils_data.data_handler.DataH... |
from Welcome import WelcomeCog
from MinimumMessages import MinimumMessagesCog
from SupporterRoles import SupporterRolesCog
from ReactionRoles import ReactionRolesCog
import discord
from discord.ext import commands, tasks
import asyncio
from discord.abc import GuildChannel
from discord.guild import Guild
from discord.m... | [
"json.load",
"Welcome.WelcomeCog",
"ReactionRoles.ReactionRolesCog",
"discord.ext.commands.has_permissions",
"SupporterRoles.SupporterRolesCog",
"dotenv.load_dotenv",
"os.environ.get",
"discord.ext.commands.Bot",
"MinimumMessages.MinimumMessagesCog",
"discord.Intents.default"
] | [((438, 451), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (449, 451), False, 'from dotenv import load_dotenv\n'), ((464, 491), 'os.environ.get', 'os.environ.get', (['"""bot-token"""'], {}), "('bot-token')\n", (478, 491), False, 'import os\n'), ((521, 546), 'discord.Intents.default', 'discord.Intents.default'... |
import logging
logging.basicConfig(format="[%(asctime)s] %(filename)s [line:%(lineno)d] %(message)s", datefmt="%m-%d %H:%M:%S")
import os
import sys
import urllib
import pprint
import tarfile
import tensorflow as tf
import json
import datetime
import dateutil.tz
import numpy as np
import scipy.misc
pp = pprint.Prett... | [
"numpy.random.uniform",
"os.makedirs",
"logging.basicConfig",
"tensorflow.trainable_variables",
"os.stat",
"os.path.exists",
"numpy.prod",
"pprint.PrettyPrinter",
"numpy.arange",
"sys.stdout.flush",
"urllib.urlretrieve",
"tarfile.open",
"os.path.join",
"logging.getLogger"
] | [((15, 137), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s] %(filename)s [line:%(lineno)d] %(message)s"""', 'datefmt': '"""%m-%d %H:%M:%S"""'}), "(format=\n '[%(asctime)s] %(filename)s [line:%(lineno)d] %(message)s', datefmt=\n '%m-%d %H:%M:%S')\n", (34, 137), False, 'import loggi... |
from dataclasses import dataclass
from datetime import date
from typing import Optional, List
from domain import events
@dataclass(frozen=True)
class OrderLine:
orderid: str
sku: str
qty: int
class Batch:
def __init__(self, ref: str, sku: str, qty:int, eta: Optional[date]):
self.reference = ... | [
"domain.events.Allocated",
"domain.events.OutOfStock",
"domain.events.AllocationRequired",
"dataclasses.dataclass"
] | [((123, 145), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (132, 145), False, 'from dataclasses import dataclass\n'), ((2000, 2097), 'domain.events.Allocated', 'events.Allocated', ([], {'orderid': 'line.orderid', 'sku': 'line.sku', 'qty': 'line.qty', 'batchref': 'batch.reference'... |
import json
import sqlite3
import datetime
import math
import requests
import string
import time
visits_db = '__HOME__/locations.db'
st_pop = dict()
st_pop["AK"] = 731545
st_pop["AL"] = 4903000
st_pop["AR"] = 3018000
st_pop["AZ"] = 7279000
st_pop["CA"] = 39510000
st_pop["CO"] = 5759000
st_pop["CT"] = 3565000
st_pop["... | [
"json.loads",
"math.radians",
"datetime.datetime.strptime",
"sqlite3.connect",
"requests.get",
"math.degrees",
"datetime.datetime.now"
] | [((1452, 1495), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['time_entry', 'fmt'], {}), '(time_entry, fmt)\n', (1478, 1495), False, 'import datetime\n'), ((2149, 2172), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2170, 2172), False, 'import datetime\n'), ((2196, 2222), 'sqlite3... |
"""
Builds Deformable DETR package.
"""
import glob
import os
from setuptools import find_packages, setup
import torch
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_extension import CppExtension
from torch.utils.cpp_extension import CUDAExtension
def get_extensions():
this_dir = os.path.d... | [
"os.path.abspath",
"torch.cuda.is_available",
"os.path.join",
"setuptools.find_packages"
] | [((1634, 1684), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('*datasets', 'models.ops')"}), "(exclude=('*datasets', 'models.ops'))\n", (1647, 1684), False, 'from setuptools import find_packages, setup\n'), ((375, 415), 'os.path.join', 'os.path.join', (['this_dir', '"""models/ops/src"""'], {}), "(this... |
# vim:ts=4:sw=4:et:
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import binascii
import json
import os
import os.path
import subprocess
import unittest
from pywatchman import bser, en... | [
"pywatchman.bser.loads",
"subprocess.Popen",
"pywatchman.bser.dumps",
"binascii.hexlify",
"watchman.integration.lib.WatchmanInstance.getSharedInstance",
"pywatchman.encoding.decode_local",
"json.dumps",
"os.environ.get"
] | [((1266, 1366), 'subprocess.Popen', 'subprocess.Popen', (['cli_cmd'], {'stdin': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE'}), '(cli_cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE,\n stdout=subprocess.PIPE)\n', (1282, 1366), False, 'import subprocess\n'), ((2117, 2145), 'pywatchma... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from module.controller import BaseController
from module.dao import AuthorDao
class AuthorController (BaseController):
"""
Controller relacionado a las operaciones correspondientes a los
autores. Implementa las operaciones CRUD sobre las tablas.
@autor <... | [
"module.dao.AuthorDao"
] | [((632, 649), 'module.dao.AuthorDao', 'AuthorDao', (['config'], {}), '(config)\n', (641, 649), False, 'from module.dao import AuthorDao\n')] |
#!/usr/bin/env python3
import os
import sys
import re
import argparse
from pathlib import Path
from collections import Counter
from enum import Enum
import itertools
import json
from operator import itemgetter
import math
import datetime
import logging
import multiprocessing
import time
import signal
from typing import... | [
"argparse.ArgumentParser",
"cv2.approxPolyDP",
"cv2.arcLength",
"cv2.imdecode",
"numpy.ones",
"logging.getLogger",
"pageinfo.guess_lines",
"json.dumps",
"pathlib.Path",
"numpy.mean",
"cv2.rectangle",
"cv2.compareHist",
"cv2.HOGDescriptor",
"cv2.minMaxLoc",
"cv2.imshow",
"cv2.inRange",
... | [((605, 632), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (622, 632), False, 'import logging\n'), ((1733, 1760), 'cv2.img_hash.PHash_create', 'cv2.img_hash.PHash_create', ([], {}), '()\n', (1758, 1760), False, 'import cv2\n'), ((1215, 1234), 'pathlib.Path', 'Path', (['"""item/equip/"""... |
import pytest
from easel.site import Site
from easel.site.defaults import Key
from easel.site.errors import Error, SiteConfigError
from easel.site.globals import Globals
from tests.test_configs import TestSites
# -----------------------------------------------------------------------------
# Site
# -----------------... | [
"pytest.raises",
"easel.site.globals.Globals.init",
"easel.site.Site"
] | [((415, 449), 'easel.site.globals.Globals.init', 'Globals.init', ([], {'root': 'TestSites.valid'}), '(root=TestSites.valid)\n', (427, 449), False, 'from easel.site.globals import Globals\n'), ((462, 468), 'easel.site.Site', 'Site', ([], {}), '()\n', (466, 468), False, 'from easel.site import Site\n'), ((1363, 1397), 'e... |
import json
from tqdm import tqdm
import re, string
def normalize(s):
#return re.sub('[%s]' % chars, '0', s).lower()
return re.sub("\d", "0", s).lower().replace("-LRB-", "(").replace("-RRB-", ")")
seg_morph_data = "../segmentations/morph_data/"
morph_maps = {
'list_SW_TL_new' : [
('../../data/IARPA/SW/swah... | [
"re.sub",
"json.loads"
] | [((1800, 1816), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (1810, 1816), False, 'import json\n'), ((133, 154), 're.sub', 're.sub', (['"""\\\\d"""', '"""0"""', 's'], {}), "('\\\\d', '0', s)\n", (139, 154), False, 'import re, string\n')] |
#!/usr/bin/python
# A simple python utility to summarize an fastavn run
import os
import fnmatch
import re
import sys
inp = sys.argv[1]
#print ("inp is ", inp)
for root, dir, file in os.walk(inp):
#print ("*************** " + root + " *************")
fm = fnmatch.filter(file, "smvexecute.log")
... | [
"fnmatch.filter",
"os.walk",
"re.search",
"os.path.join",
"re.compile"
] | [((187, 199), 'os.walk', 'os.walk', (['inp'], {}), '(inp)\n', (194, 199), False, 'import os\n'), ((276, 314), 'fnmatch.filter', 'fnmatch.filter', (['file', '"""smvexecute.log"""'], {}), "(file, 'smvexecute.log')\n", (290, 314), False, 'import fnmatch\n'), ((392, 417), 'os.path.join', 'os.path.join', (['root', 'fm[0]'],... |
import unittest
import utils
# O(n) time. O(1) space. Bit manipulation.
class Solution:
def binaryGap(self, n):
"""
:type n: int
:rtype: int
"""
result = 0
count = 1
while n > 0 and n & 1 == 0:
n >>= 1
n >>= 1
while n > 0:
... | [
"unittest.main",
"utils.load_test_json"
] | [((833, 848), 'unittest.main', 'unittest.main', ([], {}), '()\n', (846, 848), False, 'import unittest\n'), ((570, 600), 'utils.load_test_json', 'utils.load_test_json', (['__file__'], {}), '(__file__)\n', (590, 600), False, 'import utils\n')] |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"functools.partial",
"numpy.size",
"tensorflow.python.eager.context.get_default_context",
"tensorflow.python.pywrap_tensorflow.TFE_Py_Execute",
"numpy.isinf",
"numpy.isnan",
"numpy.issubdtype"
] | [((5244, 5273), 'tensorflow.python.eager.context.get_default_context', 'context.get_default_context', ([], {}), '()\n', (5271, 5273), False, 'from tensorflow.python.eager import context\n'), ((10708, 10737), 'tensorflow.python.eager.context.get_default_context', 'context.get_default_context', ([], {}), '()\n', (10735, ... |
import numpy as np
from .distribution import NoDistribution
__all__ = ["Simulator"]
class Simulator(NoDistribution):
def __init__(self, function, *args, **kwargs):
"""
This class stores a function defined by the user in python language.
function : function
Simulation ... | [
"numpy.prod"
] | [((556, 579), 'numpy.prod', 'np.prod', (['observed.shape'], {}), '(observed.shape)\n', (563, 579), True, 'import numpy as np\n')] |
import os
import time
from plyer import notification
import caretakers.time_moniter as time_moniter
class caretaker:
def __init__(self) -> None:
print("Instance created: Eyes Caretaker is running")
print(
f"Starting Time : {self.formatted_date_time(time_moniter.time_moniter.get_curre... | [
"caretakers.time_moniter.time_moniter",
"caretakers.time_moniter.time_moniter.start_t",
"os.path.realpath",
"time.sleep",
"caretakers.time_moniter.time_moniter.get_current_time"
] | [((1077, 1096), 'time.sleep', 'time.sleep', (['(60 * 20)'], {}), '(60 * 20)\n', (1087, 1096), False, 'import time\n'), ((798, 819), 'os.path.realpath', 'os.path.realpath', (['"""."""'], {}), "('.')\n", (814, 819), False, 'import os\n'), ((1119, 1146), 'caretakers.time_moniter.time_moniter', 'time_moniter.time_moniter',... |
import os
import subprocess
import sys
import time
import pytest
@pytest.fixture
def mqtt_server():
print('Starting MQTT server')
mosquitto = subprocess.Popen('mosquitto')
time.sleep(1) # Let's wait a bit before it's started
yield mosquitto
print('Tearing down MQTT server')
mosquitto.kill()... | [
"subprocess.Popen",
"time.sleep"
] | [((153, 182), 'subprocess.Popen', 'subprocess.Popen', (['"""mosquitto"""'], {}), "('mosquitto')\n", (169, 182), False, 'import subprocess\n'), ((187, 200), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (197, 200), False, 'import time\n')] |
import copy
import os
import random
import re
import time
from os.path import join
from threading import Thread
import cv2
import gym
import numpy as np
from filelock import FileLock, Timeout
from gym.utils import seeding
from vizdoom.vizdoom import ScreenResolution, DoomGame, Mode, AutomapMode
from algorithms.utils.... | [
"vizdoom.vizdoom.DoomGame",
"utils.utils.log.warning",
"utils.utils.log.info",
"cv2.imshow",
"os.path.join",
"gym.utils.seeding.np_random",
"numpy.zeros_like",
"os.path.dirname",
"numpy.transpose",
"os.path.exists",
"utils.utils.log.debug",
"gym.utils.seeding.hash_seed",
"os.path.normpath",
... | [((1128, 1145), 'utils.utils.project_tmp_dir', 'project_tmp_dir', ([], {}), '()\n', (1143, 1145), False, 'from utils.utils import log, project_tmp_dir\n'), ((1162, 1190), 'os.path.join', 'join', (['tmp_dir', 'lock_filename'], {}), '(tmp_dir, lock_filename)\n', (1166, 1190), False, 'from os.path import join\n'), ((3471,... |
from dotenv import load_dotenv, find_dotenv
import requests
import base64
import json
import os
load_dotenv(find_dotenv())
REFRESH_TOKEN = os.environ.get("REFRESH_TOKEN").strip()
CLIENT_ID = os.environ.get("CLIENT_ID").strip()
CLIENT_SECRET = os.environ.get("CLIENT_SECRET").strip()
DISCOVER_WEEKLY_ID = os.environ.get(... | [
"dotenv.find_dotenv",
"json.dumps",
"os.environ.get",
"requests.get",
"requests.post"
] | [((109, 122), 'dotenv.find_dotenv', 'find_dotenv', ([], {}), '()\n', (120, 122), False, 'from dotenv import load_dotenv, find_dotenv\n'), ((877, 938), 'requests.post', 'requests.post', (['OAUTH_TOKEN_URL'], {'data': 'payload', 'headers': 'headers'}), '(OAUTH_TOKEN_URL, data=payload, headers=headers)\n', (890, 938), Fal... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import functools
from .backend import RedisBackend, FileBackend
from .tache import Tache
RedisCache = functools.partial(Tache, RedisBackend)
FileCache = functools.partial(Tache, FileBackend)
__all__ = ['RedisCache', 'FileCache']
| [
"functools.partial"
] | [((150, 188), 'functools.partial', 'functools.partial', (['Tache', 'RedisBackend'], {}), '(Tache, RedisBackend)\n', (167, 188), False, 'import functools\n'), ((201, 238), 'functools.partial', 'functools.partial', (['Tache', 'FileBackend'], {}), '(Tache, FileBackend)\n', (218, 238), False, 'import functools\n')] |
# uma forma de criar uma home em usar app
from django.shortcuts import render
def index(request):
return render(request, 'home/index.html')
| [
"django.shortcuts.render"
] | [((110, 144), 'django.shortcuts.render', 'render', (['request', '"""home/index.html"""'], {}), "(request, 'home/index.html')\n", (116, 144), False, 'from django.shortcuts import render\n')] |
import unittest
from shexer.shaper import Shaper
from test.const import G1_NT, G1, BASE_FILES, default_namespaces, G1_ALL_CLASSES_NO_COMMENTS
from test.t_utils import file_vs_str_tunned_comparison
import os.path as pth
from shexer.consts import TURTLE, NT
_BASE_DIR = BASE_FILES + "namespaces_dict" + pth.sep
class Tes... | [
"shexer.shaper.Shaper",
"test.const.default_namespaces",
"test.t_utils.file_vs_str_tunned_comparison"
] | [((1564, 1789), 'shexer.shaper.Shaper', 'Shaper', ([], {'target_classes': "['http://xmlns.com/foaf/0.1/Person', 'http://xmlns.com/foaf/0.1/Document']", 'graph_file_input': 'G1_NT', 'namespaces_dict': 'namespaces', 'all_classes_mode': '(False)', 'input_format': 'NT', 'disable_comments': '(True)'}), "(target_classes=['ht... |
import unittest
import tensorflow.contrib.keras as keras
import numpy as np
from vixstructure.models import term_structure_to_spread_price, term_structure_to_spread_price_v2
from vixstructure.models import term_structure_to_single_spread_price
from vixstructure.models import mask_output
from vixstructure.data import ... | [
"unittest.main",
"numpy.square",
"vixstructure.models.term_structure_to_single_spread_price",
"tensorflow.contrib.keras.layers.Lambda",
"numpy.all",
"tensorflow.contrib.keras.layers.Input",
"tensorflow.contrib.keras.models.Model",
"vixstructure.models.term_structure_to_spread_price_v2",
"vixstructur... | [((3622, 3637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3635, 3637), False, 'import unittest\n'), ((421, 497), 'vixstructure.data.LongPricesDataset', 'LongPricesDataset', (['"""../../data/8_m_settle.csv"""', '"""../../data/expirations.csv"""'], {}), "('../../data/8_m_settle.csv', '../../data/expirations.cs... |
import socket
def getLocalIP():
return socket.gethostbyname(socket.gethostname())
| [
"socket.gethostname"
] | [((66, 86), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (84, 86), False, 'import socket\n')] |
#!/usr/bin/env python
import os
import sys
from setuptools import find_packages, setup
base_dir = os.path.dirname(__file__)
src_dir = os.path.join(base_dir, "src")
# When executing the setup.py, we need to be able to import ourselves, this
# means that we need to add the src/ directory to the sys.path.
sys.path.ins... | [
"os.path.dirname",
"os.path.join",
"sys.path.insert",
"setuptools.find_packages"
] | [((101, 126), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (116, 126), False, 'import os\n'), ((137, 166), 'os.path.join', 'os.path.join', (['base_dir', '"""src"""'], {}), "(base_dir, 'src')\n", (149, 166), False, 'import os\n'), ((308, 335), 'sys.path.insert', 'sys.path.insert', (['(0)', '... |
import tensorflow as tf
import tensorflow.keras.layers as KL
from utils import conv_block
def protonet_graph(inputs, cfg):
P3, P4, P5 = inputs
# refine
R1 = conv_block(P3, 128)
R2 = conv_block(P4, 128)
R2 = KL.UpSampling2D(size=(2, 2), interpolation='bilinear', name="protonet_refine2upsampled")(R... | [
"tensorflow.keras.layers.Conv2D",
"utils.conv_block",
"tensorflow.keras.Model",
"tensorflow.keras.layers.UpSampling2D",
"tensorflow.keras.layers.Add"
] | [((172, 191), 'utils.conv_block', 'conv_block', (['P3', '(128)'], {}), '(P3, 128)\n', (182, 191), False, 'from utils import conv_block\n'), ((201, 220), 'utils.conv_block', 'conv_block', (['P4', '(128)'], {}), '(P4, 128)\n', (211, 220), False, 'from utils import conv_block\n'), ((332, 351), 'utils.conv_block', 'conv_bl... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Serial port support for Windows.
Requires PySerial and pywin32.
"""
# system imports
from serial import PARITY_NONE
from serial import STOPBITS_ONE
from serial import EIGHTBITS
import win32file, win32event
# twisted imports
from twisted.int... | [
"win32event.ResetEvent",
"win32file.OVERLAPPED",
"win32file.WriteFile",
"win32event.CreateEvent",
"win32file.ClearCommError",
"twisted.internet.abstract.FileDescriptor.connectionLost",
"win32file.GetOverlappedResult",
"win32file.AllocateReadBuffer"
] | [((1270, 1292), 'win32file.OVERLAPPED', 'win32file.OVERLAPPED', ([], {}), '()\n', (1290, 1292), False, 'import win32file, win32event\n'), ((1331, 1371), 'win32event.CreateEvent', 'win32event.CreateEvent', (['None', '(1)', '(0)', 'None'], {}), '(None, 1, 0, None)\n', (1353, 1371), False, 'import win32file, win32event\n'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 17:37:51 2020
@author: sawleen
"""
import pandas as pd
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
os.chdir('/Users/sawleen/Documents/Leen/Python/stock_analysis')
import data.get_yf_data as get_y... | [
"pandas.DataFrame",
"selenium.webdriver.chrome.options.Options",
"pandas.DataFrame.from_dict",
"pandas.read_csv",
"data.get_yf_data.Data",
"time.time",
"data.get_sgi_data.Data",
"selenium.webdriver.Chrome",
"data.get_morningstar_data.Data",
"pandas.concat",
"os.chdir"
] | [((224, 287), 'os.chdir', 'os.chdir', (['"""/Users/sawleen/Documents/Leen/Python/stock_analysis"""'], {}), "('/Users/sawleen/Documents/Leen/Python/stock_analysis')\n", (232, 287), False, 'import os\n'), ((761, 777), 'pandas.DataFrame', 'pd.DataFrame', (['[]'], {}), '([])\n', (773, 777), True, 'import pandas as pd\n'), ... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | [
"tempfile.NamedTemporaryFile",
"tabulate.tabulate",
"aiida.cmdline.utils.echo.echo",
"datetime.datetime.utcnow"
] | [((1913, 2006), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'prefix': '"""migration-"""', 'suffix': '""".log"""', 'dir': '"""."""', 'delete': '(False)', 'mode': '"""w+"""'}), "(prefix='migration-', suffix='.log', dir='.', delete=\n False, mode='w+')\n", (1931, 2006), False, 'from tempfile import Named... |
#!/usr/bin/env python
fork_pushback_block_count = {
'Byzantium': 3000000,
'Constantinople': 5000000,
'MuirGlacier': 9000000,
'London': 9700000,
'ArrowGlacier': 10700000
}
emptyOmmersHash = "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
nonEmptyOmmersHash = "0x2dcc4de8dec7... | [
"json.load"
] | [((5955, 5967), 'json.load', 'json.load', (['f'], {}), '(f)\n', (5964, 5967), False, 'import json\n')] |
from django.contrib import admin
from .models import Priority
admin.site.register(Priority)
| [
"django.contrib.admin.site.register"
] | [((64, 93), 'django.contrib.admin.site.register', 'admin.site.register', (['Priority'], {}), '(Priority)\n', (83, 93), False, 'from django.contrib import admin\n')] |
import os
import sys
from types import ModuleType
import unittest
import warnings
from django.conf import LazySettings, Settings, settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test import (SimpleTestCase, TransactionTestCase, TestCase,
modify_setti... | [
"django.test.signals.COMPLEX_OVERRIDE_SETTINGS.add",
"warnings.simplefilter",
"django.test.signals.COMPLEX_OVERRIDE_SETTINGS.copy",
"django.test.modify_settings",
"django.conf.Settings",
"django.test.signals.setting_changed.connect",
"django.http.HttpRequest",
"django.conf.settings.is_overridden",
"... | [((385, 470), 'django.test.modify_settings', 'modify_settings', ([], {'ITEMS': "{'prepend': ['b'], 'append': ['d'], 'remove': ['a', 'e']}"}), "(ITEMS={'prepend': ['b'], 'append': ['d'], 'remove': ['a', 'e']}\n )\n", (400, 470), False, 'from django.test import SimpleTestCase, TransactionTestCase, TestCase, modify_set... |
from django import forms
NIVEL_CHOICES =(
("Elementary", "Elementary"),
("Intermediate", "Intermediate"),
("Advanced", "Advanced")
)
class LogInForm(forms.Form):
username = forms.CharField(label="Username")
password = forms.CharField(label="Password")
class RegisterForm(forms.Form):
username ... | [
"django.forms.ChoiceField",
"django.forms.CharField",
"django.forms.EmailField",
"django.forms.ImageField"
] | [((191, 224), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Username"""'}), "(label='Username')\n", (206, 224), False, 'from django import forms\n'), ((240, 273), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Password"""'}), "(label='Password')\n", (255, 273), False, 'from django imp... |
import zmq
import logging
import socket
import json
import sys
import pickle
import logging
from logging.handlers import RotatingFileHandler
from os import path
from os import makedirs
from datetime import datetime
# from logging.handlers import RotatingFileHandler
try:
from fusionlog_config import init
except Exc... | [
"pickle.loads",
"os.makedirs",
"fusionlog_config.init",
"interval_logger.calc_interval_from_timestamp",
"os.path.exists",
"interval_logger.update_interval_file_handle",
"json.dumps",
"logging.fatal",
"interval_logger.get_interval_file_handle",
"os.path.join",
"sys.exit",
"zmq.Context"
] | [((726, 732), 'fusionlog_config.init', 'init', ([], {}), '()\n', (730, 732), False, 'from fusionlog_config import init\n'), ((904, 917), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (915, 917), False, 'import zmq\n'), ((388, 400), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (396, 400), False, 'import sys\n'), ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Train a network across multiple GPUs.
"""
import contextlib
import logging
import os
import sys
import time
from argparse import Namespac... | [
"torch.distributed.is_initialized",
"fairseq.logging.metrics.log_speed",
"fairseq.logging.metrics.aggregate",
"fairseq.logging.metrics.log_scalar",
"torch.cuda.max_memory_allocated",
"fairseq.optim.MemoryEfficientFP16Optimizer.build_optimizer",
"torch.cuda.DoubleTensor",
"fairseq.utils.xla_device_to_c... | [((926, 953), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (943, 953), False, 'import logging\n'), ((33374, 33400), 'fairseq.logging.metrics.aggregate', 'metrics.aggregate', (['"""train"""'], {}), "('train')\n", (33391, 33400), False, 'from fairseq.logging import meters, metrics\n'), ((... |
from sklearn.utils.sparsefuncs import mean_variance_axis
from scipy.sparse import issparse
from scipy.special import loggamma
import numpy as np
def log_binom(n, k):
"""
log (n choose k)
Parameters
----------
n, k: int
Output
------
log_binom: float
"""
return loggamma(n + 1)... | [
"scipy.special.loggamma",
"scipy.sparse.issparse",
"numpy.array",
"sklearn.utils.sparsefuncs.mean_variance_axis",
"numpy.sqrt"
] | [((1997, 2008), 'scipy.sparse.issparse', 'issparse', (['X'], {}), '(X)\n', (2005, 2008), False, 'from scipy.sparse import issparse\n'), ((341, 360), 'scipy.special.loggamma', 'loggamma', (['(n - k + 1)'], {}), '(n - k + 1)\n', (349, 360), False, 'from scipy.special import loggamma\n'), ((2086, 2171), 'sklearn.utils.spa... |
# -*- coding: utf-8 -*-
import datetime
import os
from pyvirtualdisplay import Display
from selenium import webdriver
import constants
# Choose and configure the browser of your choice
def get_browser():
# # These work on Mac
# return webdriver.Chrome()
# return webdriver.Firefox()
# On Linux you n... | [
"selenium.webdriver.Firefox",
"datetime.datetime",
"os.environ.get",
"pyvirtualdisplay.Display",
"selenium.webdriver.Chrome"
] | [((2297, 2321), 'os.environ.get', 'os.environ.get', (['"""TRAVIS"""'], {}), "('TRAVIS')\n", (2311, 2321), False, 'import os\n'), ((3101, 3154), 'datetime.datetime', 'datetime.datetime', (['BIRTH_YEAR', 'BIRTH_MONTH', 'BIRTH_DAY'], {}), '(BIRTH_YEAR, BIRTH_MONTH, BIRTH_DAY)\n', (3118, 3154), False, 'import datetime\n'),... |
# coding=utf-8
# Copyright 2021 The Tensor2Tensor 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... | [
"tensorflow.compat.v1.pad",
"tensorflow.compat.v1.constant",
"tensor2tensor.utils.hparam.HParams",
"absl.testing.parameterized.parameters",
"tensor2tensor.layers.common_image_attention.postprocess_image",
"tensorflow.compat.v1.test.main",
"tensorflow.compat.v1.keras.layers.Conv1D",
"tensor2tensor.laye... | [((1064, 1206), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(common_image_attention.DistributionType.DMOL, 5, 50)', '(common_image_attention.DistributionType.CAT, None, 256)'], {}), '((common_image_attention.DistributionType.DMOL, 5, \n 50), (common_image_attention.DistributionType.CAT, N... |
"""Tests for distutils.util."""
import os
import sys
import unittest
from copy import copy
from test.support import run_unittest
from unittest import mock
from distutils.errors import DistutilsPlatformError, DistutilsByteCompileError
from distutils.util import (get_platform, convert_path, change_root,
... | [
"unittest.mock.patch.object",
"distutils.util.strtobool",
"distutils.util.rfc822_escape",
"distutils.util.grok_environment_error",
"os.uname",
"unittest.makeSuite",
"distutils.util.check_environ",
"copy.copy",
"distutils.sysconfig.get_config_vars",
"unittest.skipUnless",
"distutils.util.convert_... | [((9373, 9433), 'unittest.skipUnless', 'unittest.skipUnless', (["(os.name == 'posix')", '"""specific to posix"""'], {}), "(os.name == 'posix', 'specific to posix')\n", (9392, 9433), False, 'import unittest\n'), ((11645, 11677), 'unittest.makeSuite', 'unittest.makeSuite', (['UtilTestCase'], {}), '(UtilTestCase)\n', (116... |
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
# This is for only Linux system used.
| [
"subprocess.call",
"pip.get_installed_distributions"
] | [((55, 88), 'pip.get_installed_distributions', 'pip.get_installed_distributions', ([], {}), '()\n', (86, 88), False, 'import pip\n'), ((95, 157), 'subprocess.call', 'call', (["('pip install --upgrade ' + dist.project_name)"], {'shell': '(True)'}), "('pip install --upgrade ' + dist.project_name, shell=True)\n", (99, 157... |
from django.db import models
class Location(models.Model):
place = models.CharField(max_length=30)
def __str__(self):
return self.place
class Meta:
ordering = ['place']
def save_location(self):
self.save()
class Category(models.Model):
category = models.CharField(max_length=30)
d... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ImageField"
] | [((71, 102), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (87, 102), False, 'from django.db import models\n'), ((284, 315), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (300, 315), False, 'from django.db impo... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('delete_item/<name>', views.delete_item, name='delete_item'),
path('add_drink/', views.add_drink, name='add_drink'),
path('add_snack/', views.add_snack, name='add_snack'),
path('edit_item/<na... | [
"django.urls.path"
] | [((71, 106), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (75, 106), False, 'from django.urls import path\n'), ((112, 177), 'django.urls.path', 'path', (['"""delete_item/<name>"""', 'views.delete_item'], {'name': '"""delete_item"""'}), "('delete_... |
#
# Copyright 2018 the original author or 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... | [
"voltha.protos.omci_mib_db_pb2.MibInstanceData",
"voltha.protos.omci_mib_db_pb2.MibAttributeData",
"voltha.protos.omci_mib_db_pb2.MibDeviceData",
"voltha.protos.omci_mib_db_pb2.MessageType",
"voltha.protos.omci_mib_db_pb2.MibClassData"
] | [((15510, 15541), 'voltha.protos.omci_mib_db_pb2.MibClassData', 'MibClassData', ([], {'class_id': 'class_id'}), '(class_id=class_id)\n', (15522, 15541), False, 'from voltha.protos.omci_mib_db_pb2 import MibInstanceData, MibClassData, MibDeviceData, MibAttributeData, MessageType, ManagedEntity\n'), ((17736, 17803), 'vol... |
import warnings
from pygromos.files._basics import _general_gromos_file, parser
from pygromos.files.blocks import topology_blocks as blocks
class Distance_restraints(_general_gromos_file._general_gromos_file):
required_blocks = ["TITLE", "DISTANCERESPEC"]
_gromos_file_ending:str = "disres"
def __init__(... | [
"pygromos.files._basics.parser.read_disres"
] | [((934, 963), 'pygromos.files._basics.parser.read_disres', 'parser.read_disres', (['self.path'], {}), '(self.path)\n', (952, 963), False, 'from pygromos.files._basics import _general_gromos_file, parser\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# A tf.keras implementation of ghostnet
#
#
import os, sys
import warnings
import math
from keras_applications.imagenet_utils import _obtain_input_shape
from keras_applications.imagenet_utils import preprocess_input as _preprocess_input
from tensorflow.keras.utils impor... | [
"keras_preprocessing.image.load_img",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Multiply",
"common.backbones.layers.YoloConv2D",
"tensorflow.keras.backend.set_learning_phase",
"common.backbones.layers.YoloDepthwiseConv2D",
"tensorflow.keras.layers.Fla... | [((14029, 14076), 'tensorflow.keras.models.Model', 'Model', (['inputs', 'x'], {'name': "('ghostnet_%0.2f' % width)"}), "(inputs, x, name='ghostnet_%0.2f' % width)\n", (14034, 14076), False, 'from tensorflow.keras.models import Model\n'), ((14692, 14740), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(None, ... |
# -*- coding: utf-8 -*-
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Unit tests for the pydicom.charset module."""
import pytest
import pydicom.charset
from pydicom import dcmread, config
from pydicom.data import get_charset_files, get_testdata_file
from pydicom.dataelem import DataElement
... | [
"pydicom.dcmread",
"pydicom.filebase.DicomBytesIO",
"pydicom.data.get_charset_files",
"pytest.warns",
"pydicom.data.get_testdata_file",
"pytest.raises",
"pydicom.dataelem.DataElement",
"pytest.mark.parametrize",
"pydicom.valuerep.PersonName"
] | [((17192, 17261), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""encoding, decoded, raw_data"""', 'ENCODED_NAMES'], {}), "('encoding, decoded, raw_data', ENCODED_NAMES)\n", (17215, 17261), False, 'import pytest\n'), ((17570, 17639), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""filename, pati... |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | [
"m5.ticks.setGlobalFrequency",
"m5.util.addToPath"
] | [((2211, 2249), 'm5.util.addToPath', 'm5.util.addToPath', (['"""../configs/common"""'], {}), "('../configs/common')\n", (2228, 2249), False, 'import m5\n'), ((7628, 7663), 'm5.ticks.setGlobalFrequency', 'm5.ticks.setGlobalFrequency', (['"""1THz"""'], {}), "('1THz')\n", (7655, 7663), False, 'import m5\n'), ((9403, 9438)... |
import os
from pathlib import Path
import logging
import configparser
from . import settings
CONFIG_FILE = '/etc/margot'
def init():
# logging
logger = logging.getLogger('margot config') # unless worker
# load config
cfg = configparser.ConfigParser()
logger.debug('loading config from {}'.forma... | [
"configparser.ConfigParser",
"pathlib.Path.home",
"logging.getLogger"
] | [((164, 198), 'logging.getLogger', 'logging.getLogger', (['"""margot config"""'], {}), "('margot config')\n", (181, 198), False, 'import logging\n'), ((245, 272), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (270, 272), False, 'import configparser\n'), ((1777, 1804), 'configparser.ConfigP... |
import ruamel.yaml as yaml
import re
import json
class TestConfigAPI():
def test_config_api_user_role_error(self, hge_ctx):
admin_secret = hge_ctx.hge_key
auth_hook = hge_ctx.hge_webhook
jwt_conf = hge_ctx.hge_jwt_conf
if jwt_conf is not None:
jwt_conf_dict = json.loads(... | [
"re.sub",
"json.loads"
] | [((309, 341), 'json.loads', 'json.loads', (['hge_ctx.hge_jwt_conf'], {}), '(hge_ctx.hge_jwt_conf)\n', (319, 341), False, 'import json\n'), ((841, 873), 'json.loads', 'json.loads', (['hge_ctx.hge_jwt_conf'], {}), '(hge_ctx.hge_jwt_conf)\n', (851, 873), False, 'import json\n'), ((1521, 1559), 're.sub', 're.sub', (['"""-d... |
"""Settings that need to be set in order to run the tests."""
import os
DEBUG = True
USE_TZ = True
SITE_ID = 1
SECRET_KEY = 'secret_key_for_django'
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
USE_I18N = True
LANGUAGE_CODE = 'en'
LANGUAGES = (... | [
"os.path.dirname"
] | [((490, 515), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (505, 515), False, 'import os\n'), ((560, 585), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (575, 585), False, 'import os\n'), ((1302, 1327), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(... |
import requests
url = "http://mockbin.com/har"
payload = { "foo": "bar" }
headers = { "content-type": "application/json" }
response = requests.post(url, json=payload, headers=headers)
print(response.text)
| [
"requests.post"
] | [((137, 186), 'requests.post', 'requests.post', (['url'], {'json': 'payload', 'headers': 'headers'}), '(url, json=payload, headers=headers)\n', (150, 186), False, 'import requests\n')] |
# Copyright 2020 NXP Semiconductors
# Copyright 2020 NXP Semiconductors
#
# 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 b... | [
"dssim.simulation.sim.time_queue.delete.assert_called_once_with",
"dssim.simulation.sim.signal",
"dssim.simulation.sim.time_queue.add_element.assert_called_once_with",
"unittest.mock.Mock",
"dssim.simulation.sim.schedule_event",
"dssim.simulation.sim.time_queue.delete.reset_mock",
"dssim.simulation.sim.... | [((3168, 3174), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (3172, 3174), False, 'from unittest.mock import Mock, call\n'), ((3279, 3293), 'dssim.simulation.DSSimulation', 'DSSimulation', ([], {}), '()\n', (3291, 3293), False, 'from dssim.simulation import DSSimulation, DSAbortException, DSSchedulable, sim\n'), ((3... |
import os
from setuptools import setup, find_packages
BASEDIR = os.path.dirname(os.path.abspath(__file__))
VERSION = open(os.path.join(BASEDIR, 'VERSION')).read().strip()
# Dependencies (format is 'PYPI_PACKAGE_NAME[>]=VERSION_NUMBER')
BASE_DEPENDENCIES = [
'pandas>=1.3',
'numpy>=1.19'
]
# TEST_DEPENDENCIES ... | [
"os.path.abspath",
"os.path.join",
"os.path.normpath",
"setuptools.find_packages"
] | [((81, 106), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (96, 106), False, 'import os\n'), ((445, 470), 'os.path.normpath', 'os.path.normpath', (['BASEDIR'], {}), '(BASEDIR)\n', (461, 470), False, 'import os\n'), ((519, 534), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (... |
"""
Copyright (c) 2019 NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, su... | [
"torch.from_numpy",
"torch.nn.ReLU",
"torch.nn.ReflectionPad2d",
"torch.nn.Conv2d",
"numpy.transpose",
"numpy.ones",
"numpy.sqrt"
] | [((1237, 1252), 'numpy.ones', 'np.ones', (['(1, 2)'], {}), '((1, 2))\n', (1244, 1252), True, 'import numpy as np\n'), ((1287, 1302), 'numpy.ones', 'np.ones', (['(1, 2)'], {}), '((1, 2))\n', (1294, 1302), True, 'import numpy as np\n'), ((1367, 1391), 'numpy.transpose', 'np.transpose', (['harr_wav_L'], {}), '(harr_wav_L)... |
# Generated by Django 3.0.7 on 2021-02-16 12:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('payment_system', '0034_auto_20210216_0923'),
]
operations = [
migrations.AlterModelOptions(
name='customsubscriptionrequest',
... | [
"django.db.migrations.AlterModelOptions"
] | [((234, 466), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""customsubscriptionrequest"""', 'options': "{'ordering': ['is_processed', '-created_at'], 'verbose_name':\n 'custom subscription request', 'verbose_name_plural':\n 'custom subscription requests'}"}), "(name='c... |
#!/usr/bin/env python3
"""
Take the output of Cargo.toml and print target name.
"""
import sys
import json
def main(inp):
try:
o = json.loads(inp)
except:
print("Failed to interpret JSON", file=sys.stderr)
if 'targets' in o:
for target in o['targets']:
if 'kind' in targe... | [
"sys.stdin.read",
"json.loads",
"sys.exit"
] | [((144, 159), 'json.loads', 'json.loads', (['inp'], {}), '(inp)\n', (154, 159), False, 'import json\n'), ((596, 607), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (604, 607), False, 'import sys\n'), ((672, 688), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (686, 688), False, 'import sys\n')] |
import numpy
class ReverseProjection:
"""
I suppose that
the photo is xy plane having z=0.
coordinates of a point of laser plane having laser_position=0 are (p_1, p_2, p_3).
normal vector of laser plane is (n_1, n_2, n_3).
focus is in (width/2, heigth/2, -f).
"""
def __init__(self, ... | [
"numpy.cross",
"numpy.linalg.inv",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot"
] | [((602, 674), 'numpy.array', 'numpy.array', (['[photo_size_px[0] / 2, photo_size_px[1] / 2, focal_point_z]'], {}), '([photo_size_px[0] / 2, photo_size_px[1] / 2, focal_point_z])\n', (613, 674), False, 'import numpy\n'), ((923, 966), 'numpy.cross', 'numpy.cross', (['self.up_unit', 'self.normal_unit'], {}), '(self.up_uni... |
#!/usr/bin/env python
from common import open_example_serial_interface
from coax import ReadAddressCounterHi, ReadAddressCounterLo, ReadStatus, LoadAddressCounterHi, LoadAddressCounterLo, WriteData, LoadMask, Clear
with open_example_serial_interface() as interface:
# Clear the entire screen, except status line.
... | [
"coax.LoadAddressCounterHi",
"coax.LoadAddressCounterLo",
"coax.Clear",
"coax.ReadStatus",
"common.open_example_serial_interface",
"coax.ReadAddressCounterHi",
"coax.ReadAddressCounterLo",
"coax.LoadMask"
] | [((223, 254), 'common.open_example_serial_interface', 'open_example_serial_interface', ([], {}), '()\n', (252, 254), False, 'from common import open_example_serial_interface\n'), ((456, 468), 'coax.ReadStatus', 'ReadStatus', ([], {}), '()\n', (466, 468), False, 'from coax import ReadAddressCounterHi, ReadAddressCounter... |
#!/usr/bin/env python
'''
Feature homography
==================
Example of using features2d framework for interactive video homography matching.
ORB features and FLANN matcher are used. The actual tracking is implemented by
PlaneTracker class in plane_tracker.py
'''
# Python 2/3 compatibility
from __future__ import ... | [
"cv2.contourArea",
"numpy.uint8",
"numpy.float32",
"cv2.AKAZE_create",
"cv2.FlannBasedMatcher",
"numpy.array",
"collections.namedtuple",
"numpy.int32",
"cv2.findHomography"
] | [((2274, 2339), 'collections.namedtuple', 'namedtuple', (['"""PlaneTarget"""', '"""image, rect, keypoints, descrs, data"""'], {}), "('PlaneTarget', 'image, rect, keypoints, descrs, data')\n", (2284, 2339), False, 'from collections import namedtuple\n'), ((2588, 2642), 'collections.namedtuple', 'namedtuple', (['"""Track... |
"""Tests for josepy.jws."""
import base64
import unittest
from unittest import mock
import OpenSSL
from josepy import errors, json_util, jwa, jwk, test_util
CERT = test_util.load_comparable_cert('cert.pem')
KEY = jwk.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
class MediaTypeTest(unittest.TestCase):
"... | [
"unittest.main",
"josepy.jws.JWS.sign",
"josepy.jws.MediaType.decode",
"josepy.jws.MediaType.encode",
"josepy.jws.Signature.from_json",
"josepy.json_util.encode_b64jose",
"josepy.test_util.vector_path",
"josepy.jws.JWS.from_compact",
"josepy.jws.Header",
"base64.b64encode",
"unittest.mock.patch"... | [((167, 209), 'josepy.test_util.load_comparable_cert', 'test_util.load_comparable_cert', (['"""cert.pem"""'], {}), "('cert.pem')\n", (197, 209), False, 'from josepy import errors, json_util, jwa, jwk, test_util\n'), ((232, 271), 'josepy.test_util.load_vector', 'test_util.load_vector', (['"""rsa512_key.pem"""'], {}), "(... |
# 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 writing, software
# distributed under t... | [
"openstack.dns.v2.recordset.Recordset",
"openstack.dns.v2.zone.Zone"
] | [((5111, 5135), 'openstack.dns.v2.zone.Zone', '_zone.Zone', ([], {'id': '"""zone-id"""'}), "(id='zone-id')\n", (5121, 5135), True, 'from openstack.dns.v2 import zone as _zone\n'), ((12767, 12791), 'openstack.dns.v2.zone.Zone', '_zone.Zone', ([], {'id': '"""zone-id"""'}), "(id='zone-id')\n", (12777, 12791), True, 'from ... |
import re
from string import ascii_letters
import numpy as np
import pandas as pd
import pytest
import anndata as ad
ADATA_ATTRS = ("obs", "var", "varm", "obsm", "layers", "obsp", "varp", "uns")
@pytest.fixture
def adata():
return ad.AnnData(
np.zeros((20, 10)),
obs=pd.DataFrame(
di... | [
"numpy.zeros",
"pytest.fixture",
"numpy.arange",
"re.search"
] | [((843, 877), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'ADATA_ATTRS'}), '(params=ADATA_ATTRS)\n', (857, 877), False, 'import pytest\n'), ((260, 278), 'numpy.zeros', 'np.zeros', (['(20, 10)'], {}), '((20, 10))\n', (268, 278), True, 'import numpy as np\n'), ((1323, 1395), 're.search', 're.search', (['f"""^\\\\... |
# Copyright 2019 Graphcore Ltd.
"""Networks for VAE implementation in VCD paper"""
import numpy as np
import tensorflow as tf
def encoder(X_input, Z_dim, dtype, n_hidden=200):
"""As in paper"""
with tf.variable_scope('encoder', reuse=tf.AUTO_REUSE, use_resource=True):
# Calculate sqrt(n_hidden) - for... | [
"tensorflow.exp",
"tensorflow.random_normal_initializer",
"tensorflow.variable_scope",
"numpy.prod"
] | [((209, 277), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""encoder"""'], {'reuse': 'tf.AUTO_REUSE', 'use_resource': '(True)'}), "('encoder', reuse=tf.AUTO_REUSE, use_resource=True)\n", (226, 277), True, 'import tensorflow as tf\n'), ((3424, 3492), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""decod... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from lndgrpc.compiled import signer_pb2 as lndgrpc_dot_compiled_dot_signer__pb2
class SignerStub(object):
"""Signer is a service that gives access to the s... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.unary_unary"
] | [((7612, 7687), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""signrpc.Signer"""', 'rpc_method_handlers'], {}), "('signrpc.Signer', rpc_method_handlers)\n", (7648, 7687), False, 'import grpc\n'), ((5906, 6142), 'grpc.unary_unary_rpc_method_handler', 'grpc.unary_unary_rpc_method_ha... |
from django import template
register = template.Library()
@register.inclusion_tag('datatables/css.html')
def css_bundle():
return {}
@register.inclusion_tag('datatables/js.html')
def js_bundle():
return {}
| [
"django.template.Library"
] | [((40, 58), 'django.template.Library', 'template.Library', ([], {}), '()\n', (56, 58), False, 'from django import template\n')] |
import cv2
import os
"""
This is a simple script written to find the smallest safest dimension
to crop all images to. The result is a tuple representing the
smallest height found and the smallest width found.
The reason this is necessary is because the standardized dimensions
for the dataset needs to be within the ... | [
"os.getcwd",
"os.walk",
"os.path.join"
] | [((358, 369), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (367, 369), False, 'import os\n'), ((470, 492), 'os.walk', 'os.walk', (['downloads_dir'], {}), '(downloads_dir)\n', (477, 492), False, 'import os\n'), ((543, 569), 'os.path.join', 'os.path.join', (['subdir', 'file'], {}), '(subdir, file)\n', (555, 569), False, '... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2016, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at y... | [
"ansible.module_utils.cloudstack.cs_required_together",
"ansible.module_utils.cloudstack.cs_argument_spec"
] | [((4987, 5005), 'ansible.module_utils.cloudstack.cs_argument_spec', 'cs_argument_spec', ([], {}), '()\n', (5003, 5005), False, 'from ansible.module_utils.cloudstack import AnsibleCloudStack, cs_argument_spec, cs_required_together\n'), ((5402, 5424), 'ansible.module_utils.cloudstack.cs_required_together', 'cs_required_t... |
# Copyright 2015 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"inspect.getdoc",
"logging.getLogger"
] | [((731, 758), 'logging.getLogger', 'logging.getLogger', (['"""typist"""'], {}), "('typist')\n", (748, 758), False, 'import logging\n'), ((4438, 4457), 'inspect.getdoc', 'inspect.getdoc', (['obj'], {}), '(obj)\n', (4452, 4457), False, 'import inspect\n')] |
from functools import reduce
from itertools import product
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
import numpy as np
class _Domain:
__slots__ = ['_dimensions_discrete',
'_avg_distance',
'_dimensions_continuous',
'_dimensio... | [
"numpy.sum",
"numpy.abs",
"numpy.random.default_rng",
"numpy.cumsum",
"numpy.any",
"numpy.linspace",
"numpy.random.choice"
] | [((7364, 7396), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': 'seed'}), '(seed=seed)\n', (7385, 7396), True, 'import numpy as np\n'), ((9225, 9257), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': 'seed'}), '(seed=seed)\n', (9246, 9257), True, 'import numpy as np\n'), ((11582, 11... |
#!/usr/bin/env python
import numpy as np
import chainer
from chainer import cuda, serializers, Variable # , optimizers, training
import cv2
import os.path
#import chainer.functions as F
#import chainer.links as L
#import six
#import os
#from chainer.training import extensions
#from train import Image2ImageDataset
f... | [
"lnet.LNET",
"chainer.cuda.set_max_workspace_size",
"cv2.resize",
"chainer.Variable",
"chainer.cuda.get_device",
"chainer.serializers.load_npz",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.asarray",
"numpy.zeros",
"chainer.cuda.to_cpu",
"cv2.imread",
"unet.UNET",
"cv2.__version__.split",
"chai... | [((1298, 1309), 'unet.UNET', 'unet.UNET', ([], {}), '()\n', (1307, 1309), False, 'import unet\n'), ((1333, 1344), 'unet.UNET', 'unet.UNET', ([], {}), '()\n', (1342, 1344), False, 'import unet\n'), ((1649, 1713), 'chainer.serializers.load_npz', 'serializers.load_npz', (['"""./models/unet_128_standard"""', 'self.cnn_128'... |
import datetime
import time
import logging
from common.utils import getSiteDBCollection
from common.utils import getSiteDB
from common.utils import getLatestUserOrderDatetime
from api.mongo_client import MongoClient
def insertUserOrderFromRawLog(connection, site_id, raw_log):
c_user_orders = getSiteDBCollection(c... | [
"common.utils.getLatestUserOrderDatetime",
"common.utils.getSiteDB",
"common.utils.getSiteDBCollection",
"time.time",
"api.mongo_client.MongoClient",
"datetime.timedelta",
"logging.getLogger"
] | [((299, 354), 'common.utils.getSiteDBCollection', 'getSiteDBCollection', (['connection', 'site_id', '"""user_orders"""'], {}), "(connection, site_id, 'user_orders')\n", (318, 354), False, 'from common.utils import getSiteDBCollection\n'), ((745, 797), 'common.utils.getSiteDBCollection', 'getSiteDBCollection', (['connec... |
import asyncio
# todo 以后可以想想实现子集、并集、交集等,最小元素考虑是互斥时期
from loguru import logger
class AsyncExclusivePeriod:
obj_has_async_exclusive_periods = {}
@classmethod
def create_obj_periods(cls, obj, *period_names: str):
'''
Initially create periods for some object.
:param obj:
:pa... | [
"asyncio.Event"
] | [((3497, 3512), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (3510, 3512), False, 'import asyncio\n'), ((3541, 3556), 'asyncio.Event', 'asyncio.Event', ([], {}), '()\n', (3554, 3556), False, 'import asyncio\n')] |