code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.views.generic.base import RedirectView
from django.contrib import admin
from .views import (
editions_list,
lemma_detail,
lemma_js... | [
"django.conf.urls.url",
"django.views.generic.TemplateView.as_view",
"django.conf.urls.include",
"django.conf.urls.static.static",
"django.views.generic.base.RedirectView.as_view"
] | [((1474, 1535), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1480, 1535), False, 'from django.conf.urls.static import static\n'), ((900, 946), 'django.conf.urls.url', 'url', (['"""^lemma/$"""... |
import logging
from pprint import pprint # noqa
from banal import hash_data
from datetime import datetime
from followthemoney.util import get_entity_id
from aleph.index.util import index_name, index_settings, configure_index
from aleph.index.util import query_delete, index_safe
from aleph.index.util import KEYWORD
l... | [
"logging.getLogger",
"datetime.datetime.utcnow",
"aleph.index.util.index_name",
"aleph.index.util.index_safe",
"banal.hash_data",
"followthemoney.util.get_entity_id",
"aleph.index.util.index_settings",
"aleph.index.util.configure_index"
] | [((325, 352), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (342, 352), False, 'import logging\n'), ((393, 426), 'aleph.index.util.index_name', 'index_name', (['"""notifications"""', '"""v1"""'], {}), "('notifications', 'v1')\n", (403, 426), False, 'from aleph.index.util import index_nam... |
#!/usr/local/bin/python3
import requests
import time
import random
while True:
tem = random.randint(30, 40)
pre = 2 + random.random()
log = {'temperature': tem, 'pressure': pre}
print(log)
body = {'username': 'daipei5', 'mac': 'b6:00:1d:d0:2c:34', 'log': log}
r = requests.post('http://localho... | [
"random.random",
"requests.post",
"random.randint",
"time.sleep"
] | [((92, 114), 'random.randint', 'random.randint', (['(30)', '(40)'], {}), '(30, 40)\n', (106, 114), False, 'import random\n'), ((291, 351), 'requests.post', 'requests.post', (['"""http://localhost:3521/device/log"""'], {'json': 'body'}), "('http://localhost:3521/device/log', json=body)\n", (304, 351), False, 'import req... |
import numpy as np
from gym.spaces import Box
from metaworld.envs import reward_utils
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerBinPickingEnvV2(SawyerXYZEnv):
"""
Motivation for V2:
... | [
"numpy.hstack",
"metaworld.envs.asset_path_utils.full_v2_path_for",
"numpy.log",
"gym.spaces.Box",
"numpy.array",
"numpy.concatenate",
"numpy.linalg.norm",
"metaworld.envs.reward_utils.hamacher_product",
"metaworld.envs.reward_utils.tolerance"
] | [((1036, 1069), 'numpy.array', 'np.array', (['[0.1199, 0.699, -0.001]'], {}), '([0.1199, 0.699, -0.001])\n', (1044, 1069), True, 'import numpy as np\n'), ((1090, 1123), 'numpy.array', 'np.array', (['[0.1201, 0.701, +0.001]'], {}), '([0.1201, 0.701, +0.001])\n', (1098, 1123), True, 'import numpy as np\n'), ((1461, 1488)... |
import os
from jinja2 import lexer, nodes
from jinja2.ext import Extension
from jinja2.filters import do_mark_safe
__all__ = ['IncludeBlockExtension']
class IncludeBlockExtension(Extension):
tags = {'include_block'}
fields = {'template', 'block_name'} # block_name is optional
def template_contents(sel... | [
"os.path.splitext"
] | [((1435, 1461), 'os.path.splitext', 'os.path.splitext', (['template'], {}), '(template)\n', (1451, 1461), False, 'import os\n')] |
# Generated by Django 2.2.13 on 2021-04-05 01:30
from django.db import migrations
from django.conf import settings
def forwards(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('subscriptions', '0018_add_itunes_receipt_field'),
]
operations = [
m... | [
"django.db.migrations.RunPython"
] | [((319, 349), 'django.db.migrations.RunPython', 'migrations.RunPython', (['forwards'], {}), '(forwards)\n', (339, 349), False, 'from django.db import migrations\n')] |
import torch
import torch.nn as nn
from . import common
from .utils import register_model
from .. import SR_conv_init
from ..layerwise_model import LayerWiseModel
@register_model
def Plain_layerwise(in_nc=3, n_feats=50, nf=None, widths=None, num_modules=16, out_nc=3, scale=4, tail='easy',
mean_sh... | [
"frameworks.distillation.exp_network.Plain_SR_Block",
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.LeakyReLU",
"torch.nn.PixelShuffle",
"torch.nn.Sequential",
"model.basic_cifar_models.repvgg.RepVGGBlock",
"torch.nn.Conv2d",
"torch.nn.PReLU",
"model.super_resolution_model.edsr_layerwise_mode... | [((3454, 3480), 'torch.nn.Sequential', 'nn.Sequential', (['*new_layers'], {}), '(*new_layers)\n', (3467, 3480), True, 'import torch.nn as nn\n'), ((10845, 10869), 'torch.cat', 'torch.cat', (['[L, R]'], {'dim': '(1)'}), '([L, R], dim=1)\n', (10854, 10869), False, 'import torch\n'), ((10999, 11021), 'torch.nn.PixelShuffl... |
import os
from multiprocessing import Process
from benchmark_runner.common.logger.logger_time_stamp import logger_time_stamp, logger
from benchmark_runner.common.elasticsearch.elasticsearch_exceptions import ElasticSearchDataNotUploaded
from benchmark_runner.workloads.workloads_operations import WorkloadsOperations
... | [
"os.path.join"
] | [((908, 983), 'os.path.join', 'os.path.join', (['f"""{self._run_artifacts_path}"""', 'f"""{self.__name}_{vm_num}.yaml"""'], {}), "(f'{self._run_artifacts_path}', f'{self.__name}_{vm_num}.yaml')\n", (920, 983), False, 'import os\n'), ((2087, 2162), 'os.path.join', 'os.path.join', (['f"""{self._run_artifacts_path}"""', '... |
from deap import creator
from src.utils.utility import collaborate
import problem
import unittest
class TestCollaborate(unittest.TestCase):
def test_collaborate_testInput1(self):
p1 = [creator.Scenario([1]), creator.Scenario([2.5])]
a1 = [creator.Scenario([1])]
p2 = [[3], creator.OutputMLC... | [
"unittest.main",
"src.utils.utility.collaborate",
"deap.creator.OutputMLC",
"deap.creator.Scenario"
] | [((1252, 1267), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1265, 1267), False, 'import unittest\n'), ((480, 521), 'src.utils.utility.collaborate', 'collaborate', (['a1', 'p1', 'a2', 'p2', 'cls', 'fcls', 'k'], {}), '(a1, p1, a2, p2, cls, fcls, k)\n', (491, 521), False, 'from src.utils.utility import collaborat... |
from ormar import BigInteger, Boolean, ForeignKey, Model, String
from .metadata import database, metadata
from .user import User
class Todo(Model):
class Meta:
database = database
metadata = metadata
tablename = "todos"
# pyright: reportGeneralTypeIssues=false
id: int = BigIntege... | [
"ormar.Boolean",
"ormar.ForeignKey",
"ormar.String",
"ormar.BigInteger"
] | [((311, 339), 'ormar.BigInteger', 'BigInteger', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (321, 339), False, 'from ormar import BigInteger, Boolean, ForeignKey, Model, String\n'), ((357, 373), 'ormar.ForeignKey', 'ForeignKey', (['User'], {}), '(User)\n', (367, 373), False, 'from ormar import BigInteger, ... |
# -*- coding: utf-8 -*-
import numpy as np
from numba import jit
import matplotlib.pyplot as plt
import seaborn as sns
class BaseWindow():
"""Base window class."""
def __init__(self):
pass
def plot(self):
"""Show window.
"""
_, ax = plt.subplots(1)
sns.heatmap(se... | [
"numpy.abs",
"numpy.ones",
"seaborn.heatmap",
"numpy.zeros",
"numba.jit",
"numpy.argwhere",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((2283, 2301), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (2286, 2301), False, 'from numba import jit\n'), ((2354, 2393), 'numpy.zeros', 'np.zeros', (['(len_x, len_y)'], {'dtype': 'np.int8'}), '((len_x, len_y), dtype=np.int8)\n', (2362, 2393), True, 'import numpy as np\n'), ((282, 297), 'ma... |
import pandas as pd
from cyberbrain import Binding, Symbol # noqa
def test_pandas(tracer, test_server):
tracer.start()
baby_data_set = [
("Bob", 968),
("Jessica", 155),
("Mary", 77),
("John", 578),
("Mel", 973),
]
df = pd.DataFrame(data=baby_data_set, columns=... | [
"pandas.DataFrame",
"utils.get_os_type",
"utils.get_value",
"cyberbrain.Symbol"
] | [((279, 340), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'baby_data_set', 'columns': "['Names', 'Births']"}), "(data=baby_data_set, columns=['Names', 'Births'])\n", (291, 340), True, 'import pandas as pd\n'), ((416, 478), 'utils.get_value', 'get_value', (["{'windows': '\\\\r\\\\n', 'linux': '\\\\n', 'mac': '\\\\... |
# Generated by Django 2.2.4 on 2019-10-15 20:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crud_lugar', '0005_auto_20191015_1559'),
]
operations = [
migrations.AlterField(
model_name='alojamiento',
name='fec... | [
"django.db.models.DateField"
] | [((353, 371), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (369, 371), False, 'from django.db import migrations, models\n'), ((503, 521), 'django.db.models.DateField', 'models.DateField', ([], {}), '()\n', (519, 521), False, 'from django.db import migrations, models\n'), ((653, 671), 'django.db.m... |
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models.resnet import resnet18 as _resnet18
def resnet18(num_classes, use_pretrained=False, **kwargs):
'''
Resnet18 model
:param pretrained: Bool, whether to load pretrained weights into model
:param num_classes: Int, number of clas... | [
"torchvision.models.resnet.resnet18",
"torch.nn.Linear"
] | [((391, 426), 'torchvision.models.resnet.resnet18', '_resnet18', (['use_pretrained'], {}), '(use_pretrained, **kwargs)\n', (400, 426), True, 'from torchvision.models.resnet import resnet18 as _resnet18\n'), ((511, 567), 'torch.nn.Linear', 'nn.Linear', ([], {'in_features': 'in_ftrs', 'out_features': 'num_classes'}), '(i... |
import cv2 as cv
import time
import os
import config
class face_detect():
def __init__(self):
self.start_time = 0 # 用于计算帧率
self.fps = 0 # 帧率
self.image = None
self.face_img = None
self.face_num = 0 # 这一帧的... | [
"cv2.rectangle",
"config.detector",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"time.time",
"cv2.waitKey",
"cv2.namedWindow"
] | [((885, 896), 'time.time', 'time.time', ([], {}), '()\n', (894, 896), False, 'import time\n'), ((2112, 2142), 'config.detector', 'config.detector', (['self.image', '(0)'], {}), '(self.image, 0)\n', (2127, 2142), False, 'import config\n'), ((4053, 4075), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n',... |
# Made for TeleBot
# Re-written by @
# Kangers kwwp the credits
#Made by @
#From Nekos API
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from uniborg.util import admin_cmd
@b... | [
"uniborg.util.admin_cmd",
"telethon.events.NewMessage"
] | [((327, 347), 'uniborg.util.admin_cmd', 'admin_cmd', (['"""sologif"""'], {}), "('sologif')\n", (336, 347), False, 'from uniborg.util import admin_cmd\n'), ((1207, 1226), 'uniborg.util.admin_cmd', 'admin_cmd', (['"""cumgif"""'], {}), "('cumgif')\n", (1216, 1226), False, 'from uniborg.util import admin_cmd\n'), ((2095, 2... |
# Generated by Django 3.0.4 on 2020-03-10 18:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0080_invoice'),
]
operations = [
migrations.AlterField(
model_name='order',
name='language_code',
... | [
"django.db.models.CharField"
] | [((329, 374), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""nb"""', 'max_length': '(35)'}), "(default='nb', max_length=35)\n", (345, 374), False, 'from django.db import migrations, models\n')] |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | [
"os.path.dirname",
"scancode.cli_test_utils.run_scan_click",
"scancode.cli_test_utils.check_json_scan",
"scancode.plugin_mark_source.is_source_directory"
] | [((743, 760), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (750, 760), False, 'from os.path import dirname\n'), ((889, 932), 'scancode.plugin_mark_source.is_source_directory', 'is_source_directory', (['src_count', 'files_count'], {}), '(src_count, files_count)\n', (908, 932), False, 'from scancode.... |
######################
# Import main modules
######################
import unittest
import librosa
from PIL import Image
import pandas as pd
import numpy as np
import tensorflow as tf
from main import getAudioModel, getTopK, LogMelSpectMesh, predictModel
######################
# Globals
######################
CLAS... | [
"unittest.main"
] | [((813, 828), 'unittest.main', 'unittest.main', ([], {}), '()\n', (826, 828), False, 'import unittest\n')] |
#!/usr/bin/env python
"""
Author: <NAME>
Scrape the Malaysian Food Composition Database
"""
# This code retrieves a .csv and json with all entries in the Malaysian Food Composition Database.
## import statements
import textwrap
import json
import requests
import re
import pandas as pd
import time
# Define variable... | [
"json.loads",
"time.sleep",
"requests.get",
"pandas.DataFrame",
"re.findall",
"json.dump"
] | [((1743, 1784), 'requests.get', 'requests.get', (['identifier'], {'headers': 'headers'}), '(identifier, headers=headers)\n', (1755, 1784), False, 'import requests\n'), ((1819, 1846), 're.findall', 're.findall', (['pattern', 'parsed'], {}), '(pattern, parsed)\n', (1829, 1846), False, 'import re\n'), ((5084, 5097), 'time... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pysemeels.tools.convert_elv
.. moduleauthor:: <NAME> <<EMAIL>>
Convert an elv file into msa and/or hdf5 file.
"""
###############################################################################
# Copyright 2017 <NAME>
#
# Licensed under the Apa... | [
"pysemeels.hitachi.eels_su.elv_file.ElvFile"
] | [((1856, 1865), 'pysemeels.hitachi.eels_su.elv_file.ElvFile', 'ElvFile', ([], {}), '()\n', (1863, 1865), False, 'from pysemeels.hitachi.eels_su.elv_file import ElvFile\n')] |
import logging
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.log import LogConfig
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.crazyflie.syncLogger import SyncLogger
from cflib.utils import uri_helper
# URI to the Crazyflie to connect to
address = uri_h... | [
"logging.basicConfig",
"cflib.crazyflie.log.LogConfig",
"time.sleep",
"cflib.utils.uri_helper.address_from_env",
"cflib.crazyflie.Crazyflie"
] | [((315, 364), 'cflib.utils.uri_helper.address_from_env', 'uri_helper.address_from_env', ([], {'default': '(996028180226)'}), '(default=996028180226)\n', (342, 364), False, 'from cflib.utils import uri_helper\n'), ((365, 405), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR'}), '(level=loggin... |
"""A module handling scheduling and Flask loading in two threads"""
from datetime import datetime, timedelta
import time
import sched
import threading
import logging
import pyttsx3
from flask import Flask, render_template, request
import json_handler
app = Flask(__name__)
# scheduler is used as a global variable to en... | [
"logging.getLogger",
"logging.basicConfig",
"flask.render_template",
"json_handler.get_list_from_json",
"flask.Flask",
"pyttsx3.init",
"json_handler.get_user_input",
"datetime.datetime.strptime",
"json_handler.delete_from_json",
"datetime.datetime.now",
"sched.scheduler",
"threading.Thread",
... | [((258, 273), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (263, 273), False, 'from flask import Flask, render_template, request\n'), ((438, 452), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (450, 452), False, 'from datetime import datetime, timedelta\n'), ((462, 489), 'logging.getLogger',... |
import unittest
from unittest.mock import patch
from streamlink import Streamlink
from streamlink.plugin.plugin import LOW_PRIORITY, NORMAL_PRIORITY, NO_PRIORITY, BIT_RATE_WEIGHT_RATIO
from streamlink.plugins.dash import MPEGDASH
class TestPluginMPEGDASH(unittest.TestCase):
def setUp(self):
self.session ... | [
"streamlink.plugins.dash.MPEGDASH.priority",
"streamlink.plugins.dash.MPEGDASH.stream_weight",
"streamlink.plugins.dash.MPEGDASH",
"streamlink.plugins.dash.MPEGDASH.can_handle_url",
"streamlink.Streamlink",
"unittest.mock.patch"
] | [((1759, 1811), 'unittest.mock.patch', 'patch', (['"""streamlink.stream.DASHStream.parse_manifest"""'], {}), "('streamlink.stream.DASHStream.parse_manifest')\n", (1764, 1811), False, 'from unittest.mock import patch\n'), ((2074, 2126), 'unittest.mock.patch', 'patch', (['"""streamlink.stream.DASHStream.parse_manifest"""... |
import numpy
from methods.dna import PatternDNA
from methods.fuser import Fuser
from methods.fuser import init_indices
from methods.fuser import init_matched_group
L = PatternDNA(["L"], dna_strand=numpy.array([["T", "T", "R"], ["C", "T", "N"]]))
R = PatternDNA(["R"], dna_strand=numpy.array([["C", "G", "N"], [... | [
"numpy.array",
"methods.fuser.init_indices",
"methods.fuser.init_matched_group"
] | [((206, 253), 'numpy.array', 'numpy.array', (["[['T', 'T', 'R'], ['C', 'T', 'N']]"], {}), "([['T', 'T', 'R'], ['C', 'T', 'N']])\n", (217, 253), False, 'import numpy\n'), ((289, 336), 'numpy.array', 'numpy.array', (["[['C', 'G', 'N'], ['A', 'G', 'R']]"], {}), "([['C', 'G', 'N'], ['A', 'G', 'R']])\n", (300, 336), False, ... |
import os
import secrets
FLASK_SECRET_KEY = os.environ.get('FLASK_SECRET_KEY', secrets.token_urlsafe(32))
N_CLUSTERS = 8
ALLOWED_EXTENSIONS = ['png', 'jpg', 'jpeg']
APP_NAME = 'pltzr-python'
APP_TITLE = 'plttzrrrrr'
APP_REPO = 'https://github.com/bartekpi/palettizer-python'
| [
"secrets.token_urlsafe"
] | [((80, 105), 'secrets.token_urlsafe', 'secrets.token_urlsafe', (['(32)'], {}), '(32)\n', (101, 105), False, 'import secrets\n')] |
# -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Frames of Reference orientation test functions
----------------------------------------------
"""
import pytest
import numpy as np
from numpy.testi... | [
"pyfme.utils.coordinates.hor2body",
"numpy.testing.assert_array_almost_equal",
"pyfme.utils.coordinates.check_alpha_beta_range",
"pyfme.utils.coordinates.hor2wind",
"pyfme.utils.coordinates.body2wind",
"pyfme.utils.coordinates.check_theta_phi_psi_range",
"numpy.array",
"pyfme.utils.coordinates.wind2ho... | [((1909, 1928), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (1917, 1928), True, 'import numpy as np\n'), ((1993, 2031), 'pyfme.utils.coordinates.body2hor', 'body2hor', (['vector_body', 'theta', 'phi', 'psi'], {}), '(vector_body, theta, phi, psi)\n', (2001, 2031), False, 'from pyfme.utils.coordinate... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 19:00:38 2020
@author: Mradumay
"""
import math
import matplotlib.pyplot as plt
from scipy.integrate import quad
import numpy as np
import pandas as pd
from colorama import Fore, Style
import os
import glob
import sys
num=int(input("Enter number... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"math.acos",
"math.floor",
"math.sqrt",
"math.cos",
"numpy.array",
"sys.exit",
"math.log10",
"numpy.mean",
"math.tan",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.linspace",
"pandas.DataFrame",
"m... | [((390, 411), 'math.ceil', 'math.ceil', (['(num / num1)'], {}), '(num / num1)\n', (399, 411), False, 'import math\n'), ((414, 425), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (423, 425), False, 'import os\n'), ((507, 521), 'os.chdir', 'os.chdir', (['cwd1'], {}), '(cwd1)\n', (515, 521), False, 'import os\n'), ((623, 72... |
# SCH1101.sh --> JB_UPD_BOOKINGS.py
#**************************************************************************************************************
#
# Created by : bibin
# Version : 1.1
#
# Description :
# 1. Updates the table 'WORK_BOOKINGS' table based on Oracle procedure
#
# Initial Creation:
#
# Da... | [
"logging.getLogger",
"dependencies.spark.start_spark",
"dependencies.EbiReadWrite.EbiReadWrite"
] | [((801, 828), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (818, 828), False, 'import logging\n'), ((1047, 1077), 'dependencies.spark.start_spark', 'start_spark', ([], {'app_name': 'app_name'}), '(app_name=app_name)\n', (1058, 1077), False, 'from dependencies.spark import start_spark\n'... |
from setuptools import setup
import os
version_file = os.path.abspath(os.path.join(os.path.dirname(__file__),
'VERSION'))
with open(version_file) as v:
VERSION = v.read().strip()
SETUP = {
'name': "jujubigdata",
'version': VERSION,
'author': "Ubuntu Develo... | [
"os.path.dirname",
"setuptools.setup"
] | [((1017, 1031), 'setuptools.setup', 'setup', ([], {}), '(**SETUP)\n', (1022, 1031), False, 'from setuptools import setup\n'), ((85, 110), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (100, 110), False, 'import os\n')] |
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sklearn.exceptions import NotFittedError
from sklearn.base import clone
from sklearn.linear_model import LinearRegression, Lasso
from sklearn.model_selection import KFold
REQUIRED_COLS = ['start_date', 'lat', 'lon', 'gt']
def _get_rmse(... | [
"numpy.copy",
"sklearn.exceptions.NotFittedError",
"sklearn.linear_model.Lasso",
"sklearn.base.clone",
"numpy.delete",
"numpy.argmax",
"numpy.square",
"joblib.Parallel",
"numpy.zeros",
"numpy.setdiff1d",
"numpy.concatenate",
"joblib.delayed",
"sklearn.model_selection.KFold"
] | [((1170, 1242), 'numpy.setdiff1d', 'np.setdiff1d', (['train_dataframe.columns', 'REQUIRED_COLS'], {'assume_unique': '(True)'}), '(train_dataframe.columns, REQUIRED_COLS, assume_unique=True)\n', (1182, 1242), True, 'import numpy as np\n'), ((2306, 2375), 'sklearn.linear_model.Lasso', 'Lasso', ([], {'alpha': '(0.001)', '... |
import asyncio
from threading import Lock
from config.key import api_key,secret_key
from config.config import symbol,backward_steps
from data_collector import DataCollector
from traders.traders import HeuristicTrader,AgentTrader,CumRetTrader
async def main():
console_lock = Lock()
db_lock = Lock()
data_co... | [
"traders.traders.HeuristicTrader",
"data_collector.DataCollector",
"threading.Lock",
"traders.traders.CumRetTrader",
"traders.traders.AgentTrader",
"asyncio.get_event_loop"
] | [((281, 287), 'threading.Lock', 'Lock', ([], {}), '()\n', (285, 287), False, 'from threading import Lock\n'), ((302, 308), 'threading.Lock', 'Lock', ([], {}), '()\n', (306, 308), False, 'from threading import Lock\n'), ((330, 389), 'data_collector.DataCollector', 'DataCollector', (['api_key', 'secret_key', 'symbol'], {... |
# Copyright (c) 2019-2020 <NAME>
# License: MIT License
from typing import TYPE_CHECKING, List
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttr, DXFAttributes, DefSubclass, XType, RETURN_DEFAULT,
)
from ezdxf.lldxf.const import DXF12, SUBCLASS_MARKER
from ezdxf.math import Vec3, Matrix... | [
"ezdxf.render.point.virtual_entities",
"ezdxf.math.transformtools.transform_thickness_and_extrusion_without_ocs",
"ezdxf.lldxf.attributes.DXFAttributes",
"ezdxf.lldxf.attributes.DXFAttr",
"ezdxf.math.Vec3"
] | [((2163, 2213), 'ezdxf.lldxf.attributes.DXFAttributes', 'DXFAttributes', (['base_class', 'acdb_entity', 'acdb_point'], {}), '(base_class, acdb_entity, acdb_point)\n', (2176, 2213), False, 'from ezdxf.lldxf.attributes import DXFAttr, DXFAttributes, DefSubclass, XType, RETURN_DEFAULT\n'), ((1567, 1616), 'ezdxf.lldxf.attr... |
import base64
import os
import os.path
import sys
import zipfile
import cryptography
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
def decryptTables():
... | [
"zipfile.ZipFile",
"cryptography.hazmat.primitives.hashes.SHA256",
"cryptography.fernet.Fernet",
"os.mkdir",
"cryptography.hazmat.backends.default_backend"
] | [((734, 751), 'cryptography.fernet.Fernet', 'Fernet', (['cryptoKey'], {}), '(cryptoKey)\n', (740, 751), False, 'from cryptography.fernet import Fernet\n'), ((1122, 1146), 'os.mkdir', 'os.mkdir', (['"""app/Database"""'], {}), "('app/Database')\n", (1130, 1146), False, 'import os\n'), ((1156, 1190), 'zipfile.ZipFile', 'z... |
import os
import sys
import platform
def file_dir():
dir = os.path.dirname(__file__)
if len(dir) == 0:
dir = './'
return dir
return dir
def upacker():
sysname = platform.system()
machine = platform.machine()
if sysname == 'Darwin':
if machine == 'x86_64':
re... | [
"os.path.exists",
"os.path.dirname",
"platform.system",
"platform.machine",
"sys.exit",
"os.system"
] | [((64, 89), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (79, 89), False, 'import os\n'), ((195, 212), 'platform.system', 'platform.system', ([], {}), '()\n', (210, 212), False, 'import platform\n'), ((227, 245), 'platform.machine', 'platform.machine', ([], {}), '()\n', (243, 245), False, '... |
from src import preprocessing, telegram_bot
if __name__ == "__main__":
preprocessing.main()
telegram_bot.main()
| [
"src.preprocessing.main",
"src.telegram_bot.main"
] | [((76, 96), 'src.preprocessing.main', 'preprocessing.main', ([], {}), '()\n', (94, 96), False, 'from src import preprocessing, telegram_bot\n'), ((101, 120), 'src.telegram_bot.main', 'telegram_bot.main', ([], {}), '()\n', (118, 120), False, 'from src import preprocessing, telegram_bot\n')] |
from phue import Bridge
# How to:
# 1. Set newDevice to True
# 2. Set bridge ip
# 3. Turn those lamps on, you wish to control
# 4. Press bind button of the bridge
# 5. Run programm
newDevice = False
ip = '192.168.0.100'
b = Bridge(ip)
if newDevice:
b.connect()
discovered = []
try:
for i in range(1,100):
... | [
"phue.Bridge"
] | [((226, 236), 'phue.Bridge', 'Bridge', (['ip'], {}), '(ip)\n', (232, 236), False, 'from phue import Bridge\n')] |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import os
import numpy
import tensorflow as tf
import time
from tensorflow.python import ipu
from tensorflow.python.ipu import ipu_compiler, scopes, config
tf.compat.v1.disable_v2_behavior()
def matrix_solve_graph(A, b):
outputs = {
"output_types... | [
"tensorflow.compat.v1.disable_v2_behavior",
"tensorflow.python.ipu.config.IPUConfig",
"numpy.int32",
"numpy.array",
"tensorflow.python.ipu.ipu_compiler.compile",
"tensorflow.compat.v1.Session",
"numpy.arange",
"tensorflow.compat.v1.placeholder",
"numpy.repeat",
"numpy.max",
"numpy.min",
"numpy... | [((216, 250), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.compat.v1.disable_v2_behavior', ([], {}), '()\n', (248, 250), True, 'import tensorflow as tf\n'), ((455, 506), 'os.path.join', 'os.path.join', (['base_path', '"""libmatrix_solve_ce_op.so"""'], {}), "(base_path, 'libmatrix_solve_ce_op.so')\n", (467, 506), Fal... |
import argparse
import os
import subprocess
import sys
from glob import glob
from pathlib import Path
import pytest
from mock import patch
from pyproj.__main__ import main
from pyproj.datadir import append_data_dir, get_data_dir, get_user_data_dir
from pyproj.sync import _load_grid_geojson
from test.conftest import g... | [
"subprocess.check_output",
"pyproj.datadir.get_user_data_dir",
"mock.patch",
"pyproj.datadir.get_data_dir",
"pathlib.Path",
"pyproj.sync._load_grid_geojson",
"test.conftest.proj_env",
"test.conftest.grids_available",
"pytest.mark.parametrize",
"pyproj.__main__.main",
"pytest.raises",
"argparse... | [((379, 471), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_command"""', "[['pyproj'], [sys.executable, '-m', 'pyproj']]"], {}), "('input_command', [['pyproj'], [sys.executable, '-m',\n 'pyproj']])\n", (402, 471), False, 'import pytest\n'), ((870, 924), 'pytest.mark.parametrize', 'pytest.mark.par... |
__author__ = '<NAME>'
"""
Company : VMWare Inc.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
"""
from collections import namedtuple,defaultdict
"""
global testname
global stressparam
global test_data
global... | [
"collections.defaultdict"
] | [((704, 721), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (715, 721), False, 'from collections import namedtuple, defaultdict\n')] |
from os import path
from pony.orm.core import db_session
from tornado.web import StaticFileHandler, url, Application
from grepopla.controllers.PlayerController import PlayerController
from grepopla.controllers.IndexController import IndexController
from grepopla.settings import PRODUCTION
app_params = [
url(r'/... | [
"tornado.web.url",
"tornado.ioloop.IOLoop",
"tornado.ioloop.start",
"tornado.options.parse_command_line",
"tornado.autoreload.start",
"tornado.web.Application",
"os.path.abspath"
] | [((518, 634), 'tornado.web.Application', 'Application', (['app_params'], {'debug': '(not PRODUCTION)', 'compiled_template_cache': 'PRODUCTION', 'static_hash_cache': 'PRODUCTION'}), '(app_params, debug=not PRODUCTION, compiled_template_cache=\n PRODUCTION, static_hash_cache=PRODUCTION)\n', (529, 634), False, 'from to... |
"""Map of NASS Progress Data"""
import datetime
from collections import OrderedDict
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.plot.geoplot import MapPlot
from pyiem.util import get_autoplot_context, get_dbconn
PDICT = OrderedDict((
('corn_silking', 'Perce... | [
"collections.OrderedDict",
"pandas.io.sql.read_sql",
"pandas.DataFrame.from_dict",
"pyiem.util.get_dbconn",
"pyiem.plot.use_agg.plt.get_cmap",
"pandas.isna",
"datetime.date.today",
"pyiem.plot.geoplot.MapPlot",
"pandas.to_datetime"
] | [((279, 494), 'collections.OrderedDict', 'OrderedDict', (["(('corn_silking', 'Percentage Corn Silking Acres'), ('corn_poor_verypoor',\n 'Percentage Corn Poor + Very Poor Condition'), ('corn_good_excellent',\n 'Percentage Corn Good + Excellent Condition'))"], {}), "((('corn_silking', 'Percentage Corn Silking Acres... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2019-01-31 02:10
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Users', '0010_auto_20180606_00... | [
"django.db.models.ForeignKey",
"django.db.models.NullBooleanField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((534, 627), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (550, 627), False, 'from django.db import migrations, models\... |
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"logging.getLogger",
"pandas.DataFrame",
"torch.load",
"torch.max",
"torch.utils.data.TensorDataset",
"os.path.realpath",
"collections.defaultdict",
"torch.utils.data.DataLoader",
"json.load",
"torch.no_grad",
"torch.nn.functional.softmax"
] | [((1001, 1028), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1018, 1028), False, 'import logging\n'), ((2882, 2908), 'torch.load', 'torch.load', (['model_filepath'], {}), '(model_filepath)\n', (2892, 2908), False, 'import torch\n'), ((6226, 6267), 'torch.utils.data.TensorDataset', 'Ten... |
import pydotplus as pdp
import networkx as nx
from copy import deepcopy
import itertools as it
from ..utilities.util import Util
from IPython.display import Image
from IPython import get_ipython
import logging
logger = logging.getLogger('cegpy.chain_event_graph')
class ChainEventGraph(nx.MultiDiGraph):
"""
... | [
"logging.getLogger",
"networkx.relabel_nodes",
"IPython.get_ipython",
"networkx.topological_sort",
"pydotplus.Dot",
"pydotplus.Edge",
"networkx.all_simple_edge_paths",
"itertools.count",
"networkx.get_node_attributes",
"copy.deepcopy",
"pydotplus.Node",
"networkx.subgraph_view"
] | [((221, 265), 'logging.getLogger', 'logging.getLogger', (['"""cegpy.chain_event_graph"""'], {}), "('cegpy.chain_event_graph')\n", (238, 265), False, 'import logging\n'), ((8710, 8768), 'networkx.relabel_nodes', 'nx.relabel_nodes', (['self', "{'s0': self.root_node}"], {'copy': '(False)'}), "(self, {'s0': self.root_node}... |
# Python program to illustrate the concept
# of threading
# importing the threading module
import threading
def task(num):
print("task: {}".format(num))
if __name__ == "__main__":
# creating thread
t1 = []
RANGE = 10
for x in range(RANGE):
#print(x)
t = threading.Thread(target=task, args=(1... | [
"threading.Thread"
] | [((283, 324), 'threading.Thread', 'threading.Thread', ([], {'target': 'task', 'args': '(10,)'}), '(target=task, args=(10,))\n', (299, 324), False, 'import threading\n')] |
from json import load
from os import getenv
from typing import Dict, Optional
from flask import Flask, redirect, url_for
from flask_login import (
LoginManager,
UserMixin,
current_user,
login_required,
login_user,
logout_user,
)
app = Flask(__name__)
app.config["SECRET_KEY"] = getenv("SECRET_K... | [
"flask_login.LoginManager",
"os.getenv",
"flask.Flask",
"flask_login.login_user",
"flask_login.logout_user",
"flask.url_for",
"json.load"
] | [((261, 276), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (266, 276), False, 'from flask import Flask, redirect, url_for\n'), ((304, 354), 'os.getenv', 'getenv', (['"""SECRET_KEY"""'], {'default': '"""secret_key_example"""'}), "('SECRET_KEY', default='secret_key_example')\n", (310, 354), False, 'from os... |
from keras.utils import np_utils
import numpy as np
import math
import matplotlib.pyplot as plt
class ChunkTest:
def __init__(self, time_delay):
self.chunk= 0
self.output_size = 10
self.counter = -1
self.time_delay = time_delay
self.time_counter = time_delay
self.output_class= 0
self.previous_output_... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.argmax",
"matplotlib.pyplot.close",
"numpy.exp",
"numpy.random.randint",
"keras.utils.np_utils.to_categorical",
"numpy.empty",
"numpy.random.randn",
"matplotlib.pyplot.show"
] | [((2282, 2302), 'numpy.empty', 'np.empty', (['iterations'], {}), '(iterations)\n', (2290, 2302), True, 'import numpy as np\n'), ((2322, 2362), 'numpy.empty', 'np.empty', (['(iterations, self.output_size)'], {}), '((iterations, self.output_size))\n', (2330, 2362), True, 'import numpy as np\n'), ((2686, 2709), 'numpy.asa... |
import os
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
from django.db import models
from sorl.thumbnail import ImageField
from urllib import request
IMAGE_SIZE = {
'small': 256,
'medium': 1024,
'large': 2048
}
class TimeStampMixin(models.Model):
created_a... | [
"django.db.models.ForeignKey",
"urllib.request.urlretrieve",
"django.db.models.JSONField",
"os.path.basename",
"django.db.models.DateTimeField",
"sorl.thumbnail.ImageField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((324, 363), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (344, 363), False, 'from django.db import models\n'), ((381, 416), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (401, 416), F... |
from numpy import nan
from pandas import Series, DataFrame, isnull
from typing import List
from survey.constants import CATEGORY_SPLITTER
from survey.surveys.metadata.question_metadata import QuestionMetadata
from survey.surveys.survey_creators.base.survey_creator import SurveyCreator
class AlphaHQCreator(SurveyCrea... | [
"pandas.DataFrame",
"pandas.isnull",
"survey.constants.CATEGORY_SPLITTER.join"
] | [((1236, 1247), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (1245, 1247), False, 'from pandas import Series, DataFrame, isnull\n'), ((523, 535), 'pandas.isnull', 'isnull', (['item'], {}), '(item)\n', (529, 535), False, 'from pandas import Series, DataFrame, isnull\n'), ((988, 1020), 'survey.constants.CATEGORY_SP... |
"""
My Data My Consent - Developer API
Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organizations. The API can be used to request, manage and upd... | [
"unittest.main"
] | [((2496, 2511), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2509, 2511), False, 'import unittest\n')] |
# !/usr/bin/env python
# -*- coding:utf8 -*-
#
# Copyright (c) 2019 - 2040 <NAME> Technology CO.,Ltd.
# 北京智图时空科技有限公司
#
# All rights reserved.
#
from flask import Flask, render_template, send_from_directory
from flask_tus import tus_manager
import os
app = Flask(__name__)
tm = tus_manager(app, upload_url='/file-upload'... | [
"flask_tus.tus_manager",
"flask.Flask"
] | [((257, 272), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (262, 272), False, 'from flask import Flask, render_template, send_from_directory\n'), ((278, 347), 'flask_tus.tus_manager', 'tus_manager', (['app'], {'upload_url': '"""/file-upload"""', 'upload_folder': '"""uploads/"""'}), "(app, upload_url='/fi... |
import numpy as np
import librosa
import json
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
sys.path.append('vggish/')
from math import pi
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
import pickle
import xgboost as xgb
from scipy.fftpack import fft, hilb... | [
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.sqrt",
"librosa.feature.zero_crossing_rate",
"librosa.feature.mfcc",
"numpy.array",
"scipy.fftpack.fft",
"scipy.fftpack.hilbert",
"librosa.effects.trim",
"sys.path.append",
"librosa.feature.rms",
"librosa.feature.spectral_centroid",
"tensorflo... | [((111, 137), 'sys.path.append', 'sys.path.append', (['"""vggish/"""'], {}), "('vggish/')\n", (126, 137), False, 'import sys\n'), ((341, 374), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (364, 374), False, 'import warnings\n'), ((410, 434), 'tensorflow.compat.v1.disable... |
import torch
from torch import Tensor
from .optimizer import Optimizer, required
from typing import List, Optional
class SGD(Optimizer):
r"""Implements stochastic gradient descent (optionally with momentum).
.. math::
\begin{aligned}
&\rule{110mm}{0.4pt} ... | [
"torch._foreach_add_",
"torch.enable_grad",
"torch._foreach_mul_",
"torch.jit.is_scripting",
"torch.clone",
"torch.no_grad",
"torch._foreach_add"
] | [((6045, 6060), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6058, 6060), False, 'import torch\n'), ((8627, 8651), 'torch.jit.is_scripting', 'torch.jit.is_scripting', ([], {}), '()\n', (8649, 8651), False, 'import torch\n'), ((10880, 10933), 'torch._foreach_add', 'torch._foreach_add', (['grads', 'params'], {'al... |
# -*- coding: utf-8 -*-
import vimbastructure as structs
from vimbaexception import VimbaException
from vimbadll import VimbaDLL
from ctypes import *
# class may extend a generic Vimba entity class one day...
class VimbaFeature(object):
"""
A feature of a Vimba object.
"""
@property
def name(se... | [
"vimbadll.VimbaDLL.featureBoolSet",
"vimbadll.VimbaDLL.featureStringSet",
"vimbadll.VimbaDLL.featureEnumSet",
"vimbastructure.VimbaFeatureInfo",
"vimbadll.VimbaDLL.featureIntSet",
"vimbaexception.VimbaException",
"vimbadll.VimbaDLL.featureFloatSet"
] | [((2952, 2978), 'vimbastructure.VimbaFeatureInfo', 'structs.VimbaFeatureInfo', ([], {}), '()\n', (2976, 2978), True, 'import vimbastructure as structs\n'), ((3526, 3547), 'vimbaexception.VimbaException', 'VimbaException', (['(-1001)'], {}), '(-1001)\n', (3540, 3547), False, 'from vimbaexception import VimbaException\n'... |
import argparse
import troposphere.ec2 as ec2
from troposphere import And, Condition, Equals, If, Join, Not, NoValue, Output, Parameter, Ref, Select, Template
def main(args):
number_of_vol = 5
t = Template()
availability_zone = t.add_parameter(
Parameter(
"AvailabilityZone",
... | [
"troposphere.Parameter",
"argparse.ArgumentParser",
"troposphere.Join",
"troposphere.Ref",
"troposphere.Condition",
"troposphere.Output",
"troposphere.Template"
] | [((208, 218), 'troposphere.Template', 'Template', ([], {}), '()\n', (216, 218), False, 'from troposphere import And, Condition, Equals, If, Join, Not, NoValue, Output, Parameter, Ref, Select, Template\n'), ((5731, 5806), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Take in generator re... |
import subprocess, re, smtplib
def send_mail(email, message):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
sender_email = "<EMAIL>"
password = "<PASSWORD>"
server.login(sender_email, password)
server.sendmail(sender_email, email, message)
server.quit()
command = "netsh ... | [
"subprocess.check_output",
"re.findall",
"smtplib.SMTP"
] | [((424, 471), 're.findall', 're.findall', (['"""(?:Profile\\\\s*:\\\\s)(.*)"""', 'networks'], {}), "('(?:Profile\\\\s*:\\\\s)(.*)', networks)\n", (434, 471), False, 'import subprocess, re, smtplib\n'), ((77, 112), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (89,... |
# tcviz 1.2
#
# Licensed under the terms of the MIT/X11 license.
# Copyright (c) 2009-2013 <NAME> <http://ze.phyr.us>
import textwrap
from Id import Id
class Filter:
COLOR = '#999999'
def __init__(self, spec=None):
self.__parent = None
self.__target = None
self.__params = []
... | [
"Id.Id"
] | [((695, 704), 'Id.Id', 'Id', (['idval'], {}), '(idval)\n', (697, 704), False, 'from Id import Id\n')] |
from moz_sql_parser import parse
import json
import sys
# import the logging library
import logging
# Get an instance of a logger
logger = logging.getLogger(__name__)
hdlr = logging.FileHandler('./main/logs/application.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(form... | [
"logging.getLogger",
"logging.Formatter",
"sys.exc_info",
"moz_sql_parser.parse",
"logging.FileHandler"
] | [((141, 168), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'import logging\n'), ((176, 226), 'logging.FileHandler', 'logging.FileHandler', (['"""./main/logs/application.log"""'], {}), "('./main/logs/application.log')\n", (195, 226), False, 'import logging\n'), ((239, ... |
__author__ = 'antonellacalvia'
import AST as Tree
def constantsPass(tree, funcs):
vars = {}
def run(n, pos= 0, name= ""):
for iter in range(len(n.nodes)):
i = n.nodes[iter]
if not n.isEnd():
run(i, iter, i.name if type(i) in [Tree.FuncBraceOpen, Tree.FuncBody] o... | [
"TopCompiler.Types.FuncPointer",
"AST.Array",
"AST.FuncStart",
"AST.FuncBody",
"AST.FuncBraceOpen",
"AST.Bool",
"TopCompiler.Types.Null",
"AST.FuncCall",
"AST.String",
"AST.Block",
"AST.ReadVar"
] | [((6316, 6329), 'AST.Block', 'Tree.Block', (['i'], {}), '(i)\n', (6326, 6329), True, 'import AST as Tree\n'), ((6375, 6387), 'TopCompiler.Types.Null', 'Types.Null', ([], {}), '()\n', (6385, 6387), False, 'from TopCompiler import Types\n'), ((6401, 6443), 'AST.FuncStart', 'Tree.FuncStart', (['i.name', 'i.nodes[0].type',... |
# Generated by Django 2.1.4 on 2019-03-13 23:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ticketholders', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='bicyclebooking',
name='confirme... | [
"django.db.models.BooleanField"
] | [((342, 456), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Check this field to confirm your intention to pick up a bike."""'}), "(default=False, help_text=\n 'Check this field to confirm your intention to pick up a bike.')\n", (361, 456), False, 'from django.db... |
from __future__ import absolute_import
from __future__ import print_function
import os
import glob
import numpy as np
from scipy.interpolate import UnivariateSpline
from .core import file_finder, load_probe, load_fs, load_clusters, load_spikes
from .core import find_info, find_kwd, find_kwik, find_kwx
import h5py as h5... | [
"numpy.fromfile",
"numpy.count_nonzero",
"numpy.array",
"numpy.arange",
"os.path.exists",
"numpy.mean",
"numpy.reshape",
"numpy.where",
"os.path.split",
"numpy.dot",
"os.path.splitext",
"h5py.File",
"numpy.sign",
"scipy.interpolate.UnivariateSpline",
"six.moves.range",
"os.makedirs",
... | [((2311, 2352), 'numpy.fromfile', 'np.fromfile', (['mean_masks'], {'dtype': 'np.float32'}), '(mean_masks, dtype=np.float32)\n', (2322, 2352), True, 'import numpy as np\n'), ((3708, 3751), 'numpy.array', 'np.array', (['[geometry[ch] for ch in channels]'], {}), '([geometry[ch] for ch in channels])\n', (3716, 3751), True,... |
import json
import os
import pickle
import sys
import cv2
import numpy as np
this_filepath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(this_filepath, '../src/detectron2/projects/DensePose/'))
from densepose import add_densepose_config, add_hrnet_config
from densepose.data.structures imp... | [
"numpy.mean",
"pickle.dump",
"detectron2.config.get_cfg",
"densepose.add_hrnet_config",
"densepose.data.structures.DensePoseResult.decode_png_data",
"os.makedirs",
"src.utils.image.recover_original_mask_size",
"src.utils.image.create_context",
"os.path.join",
"src.dataset.MINDS.MINDSDataset",
"o... | [((111, 136), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (126, 136), False, 'import os\n'), ((154, 222), 'os.path.join', 'os.path.join', (['this_filepath', '"""../src/detectron2/projects/DensePose/"""'], {}), "(this_filepath, '../src/detectron2/projects/DensePose/')\n", (166, 222), False,... |
import os
import json
from django.conf import settings
from channels import Group
DECADENCE_DIR = getattr(settings, "DECADENCE_DIR",
os.path.join("includes", "decadence"))
def check_template_path(path):
"""
Checks whether the path is valid. Valid path is a path that:
- is not out... | [
"os.path.normpath",
"json.dumps",
"channels.Group",
"os.path.join"
] | [((159, 196), 'os.path.join', 'os.path.join', (['"""includes"""', '"""decadence"""'], {}), "('includes', 'decadence')\n", (171, 196), False, 'import os\n'), ((435, 457), 'os.path.normpath', 'os.path.normpath', (['path'], {}), '(path)\n', (451, 457), False, 'import os\n'), ((1708, 1719), 'channels.Group', 'Group', (['pa... |
from django.contrib.auth import get_user_model
from django_countries.serializer_fields import CountryField
from drf_writable_nested import UniqueFieldsMixin, NestedUpdateMixin, WritableNestedModelSerializer
from rest_framework import serializers
from evan.models import Profile
class AttendeeSerializer(serializers.Mo... | [
"django_countries.serializer_fields.CountryField",
"django.contrib.auth.get_user_model",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.HyperlinkedIdentityField"
] | [((347, 396), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (380, 396), False, 'from rest_framework import serializers\n'), ((415, 464), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField'... |
from PIL import Image
import cv2
from decimal import getcontext, Decimal
import pickle
import network
import numpy as np
def convert_image():
image = Image.open('z.jpg').convert('L')
new_image = image.resize((28, 28), Image.ANTIALIAS)
quality_val = 100
new_image.save('img_28.jpg', quality=quality_val)... | [
"numpy.ndarray",
"decimal.getcontext",
"cv2.imread",
"PIL.Image.open"
] | [((337, 383), 'cv2.imread', 'cv2.imread', (['"""img_28.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('img_28.jpg', cv2.IMREAD_GRAYSCALE)\n", (347, 383), False, 'import cv2\n'), ((852, 878), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(784, 1)'}), '(shape=(784, 1))\n', (862, 878), True, 'import numpy as np\n'), ((882, 894... |
"""
Manage the keys and load keys from file to do verification.
"""
import hashlib
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
class Keys:
def __init__(self, pri... | [
"hashlib.sha256",
"cryptography.hazmat.backends.default_backend"
] | [((2132, 2162), 'hashlib.sha256', 'hashlib.sha256', (['public_key_str'], {}), '(public_key_str)\n', (2146, 2162), False, 'import hashlib\n'), ((3145, 3162), 'cryptography.hazmat.backends.default_backend', 'default_backend', ([], {}), '()\n', (3160, 3162), False, 'from cryptography.hazmat.backends import default_backend... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import print_function
import gdb
import struct
import os.path
from ctypes import create_string_buffer
import load_symbol_cmd
POINTER_SIZE = 8
# These constant definitions must align with _oe_enclave structur... | [
"gdb.inferiors",
"gdb.events.new_objfile.connect",
"gdb.breakpoints",
"gdb.parse_and_eval",
"gdb.execute",
"struct.unpack",
"gdb.events.exited.connect",
"gdb.Breakpoint.__init__",
"struct.unpack_from"
] | [((3039, 3089), 'gdb.execute', 'gdb.execute', (['"""show solib-search-path"""', '(False)', '(True)'], {}), "('show solib-search-path', False, True)\n", (3050, 3089), False, 'import gdb\n'), ((3755, 3788), 'gdb.execute', 'gdb.execute', (['gdb_cmd', '(False)', '(True)'], {}), '(gdb_cmd, False, True)\n', (3766, 3788), Fal... |
"""
Copyright 2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | [
"os.chdir"
] | [((665, 699), 'os.chdir', 'os.chdir', (['"""1Client_IdealBenchmark"""'], {}), "('1Client_IdealBenchmark')\n", (673, 699), False, 'import os\n'), ((737, 751), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..')\n", (745, 751), False, 'import os\n'), ((806, 841), 'os.chdir', 'os.chdir', (['"""5Clients_IdealBenchmark"""']... |
# project/tests/test_user_model.py
from sqlalchemy.exc import IntegrityError
from project import db
from project.models.device import Device
from tests.base import BaseTestCase
from tests.utils import add_device
class TestDeviceModel(BaseTestCase):
def test_add_device(self):
device = add_device(device_... | [
"tests.utils.add_device",
"project.models.device.Device",
"project.db.session.add"
] | [((302, 356), 'tests.utils.add_device', 'add_device', ([], {'device_id': '"""device_id"""', 'device_type': '"""apple"""'}), "(device_id='device_id', device_type='apple')\n", (312, 356), False, 'from tests.utils import add_device\n'), ((639, 693), 'tests.utils.add_device', 'add_device', ([], {'device_id': '"""device_id"... |
from __future__ import annotations
# Copyright (c) 2021 zfit
import typing
from collections.abc import Callable
from contextlib import suppress
import tensorflow_probability as tfp
import zfit_interface.typing as ztyping
from zfit_interface.pdf import ZfitPDF
from zfit_interface.variables import ZfitVar, ZfitSpace, ... | [
"zfit.core.values.ValueHolder",
"zfit.util.container.convert_to_container",
"zfit.z.function",
"zfit._variables.varsupport.VarSupports",
"zfit.convert_to_parameter",
"contextlib.suppress",
"tensorflow_probability.mcmc.sample_halton_sequence"
] | [((4919, 4944), 'zfit.z.function', 'z.function', ([], {'wraps': '"""model"""'}), "(wraps='model')\n", (4929, 4944), False, 'from zfit import convert_to_parameter, z\n'), ((5959, 5984), 'zfit.z.function', 'z.function', ([], {'wraps': '"""model"""'}), "(wraps='model')\n", (5969, 5984), False, 'from zfit import convert_to... |
import numpy as np
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PAR_DIR = os.path.dirname(os.path.dirname(BASE_DIR))
RLG_DIR = os.path.join(PAR_DIR,'result/rot_log')
LOG_FOUT = open(os.path.join(BASE_DIR, 'calShape.txt'), 'w')
NUM_CLASSES = 40
SHAPE_NAMES = [line.rstrip() for line in \
open(... | [
"os.path.abspath",
"os.path.dirname",
"numpy.load",
"os.path.join"
] | [((148, 187), 'os.path.join', 'os.path.join', (['PAR_DIR', '"""result/rot_log"""'], {}), "(PAR_DIR, 'result/rot_log')\n", (160, 187), False, 'import os\n'), ((57, 82), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (72, 82), False, 'import os\n'), ((111, 136), 'os.path.dirname', 'os.path.dirn... |
import pathlib
from setuptools import setup
from setuptools import find_packages
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="clipboard_monitor",
version=... | [
"setuptools.setup",
"pathlib.Path"
] | [((271, 839), 'setuptools.setup', 'setup', ([], {'name': '"""clipboard_monitor"""', 'version': '"""1.0.5"""', 'description': '"""Monitor Clipboard changes and trigger related actions"""', 'long_description': 'README', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/cylin2000/clipbo... |
import json
from dotenv import load_dotenv
def init():
load_dotenv(verbose=True)
| [
"dotenv.load_dotenv"
] | [((60, 85), 'dotenv.load_dotenv', 'load_dotenv', ([], {'verbose': '(True)'}), '(verbose=True)\n', (71, 85), False, 'from dotenv import load_dotenv\n')] |
#!/usr/bin/env python
"""
Parses the CMake files in a ROS installation directory (eg /opt/ros/melodic)
and produces bazel files to import each catkin package with the right
dependency information.
"""
import argparse
import glob
import os
import re
def _read_file_lines(fp):
with open(fp) as f:
lines = [l... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.dirname",
"os.path.basename"
] | [((1733, 1764), 'os.path.exists', 'os.path.exists', (['msg_extras_path'], {}), '(msg_extras_path)\n', (1747, 1764), False, 'import os\n'), ((3964, 3989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3987, 3989), False, 'import argparse\n'), ((1638, 1657), 'os.path.dirname', 'os.path.dirname'... |
"""
Collects information from TekkenGameState over time in hopes of synthesizing it and presenting it in a more useful way.
"""
import time
from enum import Enum
import artificial_keyboard
from MoveInfoEnums import AttackType
from MoveInfoEnums import ComplexMoveStates
from MoveInfoEnums import ThrowTechs
from Tekke... | [
"artificial_keyboard.press_and_release_n_times",
"time.strftime"
] | [((22419, 22523), 'artificial_keyboard.press_and_release_n_times', 'artificial_keyboard.press_and_release_n_times', (['(22)', 'MAGIC_THROW_BREAK_FLOAT', 'MAGIC_THROW_BREAK_NUMBER'], {}), '(22, MAGIC_THROW_BREAK_FLOAT,\n MAGIC_THROW_BREAK_NUMBER)\n', (22464, 22523), False, 'import artificial_keyboard\n'), ((22603, 22... |
import pytest
from policykit import Conftest
class TestPolicy(object):
@pytest.fixture
def conftest(self):
return Conftest()
def test_policy(self, conftest):
run = conftest.verify()
assert run.success
def test_pytest_config(self, conftest):
run = conftest.test("pytest... | [
"policykit.Conftest"
] | [((132, 142), 'policykit.Conftest', 'Conftest', ([], {}), '()\n', (140, 142), False, 'from policykit import Conftest\n')] |
#!/usr/bin/env python3
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import init
from tqdm import tqdm
import random
import math
import operator
import matplotlib.pyplot as plt
import numpy as np
use_cuda = torch.cuda.is_available()
cla... | [
"math.floor",
"numpy.polyfit",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.init.xavier_uniform",
"operator.itemgetter",
"gym.make",
"random.choice",
"matplotlib.pyplot.savefig",
"random.randrange",
"torch.nn.init.uniform",
"torch.save",
"torch.nn.Conv2d",
"numpy.append",
"numpy.z... | [((290, 315), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (313, 315), False, 'import torch\n'), ((8047, 8083), 'torch.save', 'torch.save', (['bestNet', '"""Pongexpert.pt"""'], {}), "(bestNet, 'Pongexpert.pt')\n", (8057, 8083), False, 'import torch\n'), ((2525, 2544), 'gym.make', 'gym.make', ... |
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras.models import Model as tf_Model
from Model import Model
from PreprocessingParameters import PreprocessingParameters
from DataProperties import DataProperties
class VGG19Model(Model):
def __init__(self, **kwargs):
super().__... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.models.Sequential"
] | [((3066, 3094), 'tensorflow.keras.models.Sequential', 'tf.keras.models.Sequential', ([], {}), '()\n', (3092, 3094), True, 'import tensorflow as tf\n'), ((3114, 3249), 'tensorflow.keras.layers.Conv2D', 'layers.Conv2D', (['(64)'], {'kernel_size': '(3, 3)', 'padding': '"""same"""', 'activation': '"""relu"""', 'input_shape... |
import os
from signal import SIGKILL
from cloudify import ctx
def _stop_process():
os.killpg(
ctx.instance.runtime_properties['pid'],
SIGKILL)
def _unset_runtime_properties():
ctx.instance.runtime_properties.pop('pid', None)
for runtime_property in ctx.instance.runtime_properties:
... | [
"cloudify.ctx.logger.exception",
"cloudify.ctx.instance.runtime_properties.pop",
"os.killpg"
] | [((90, 148), 'os.killpg', 'os.killpg', (["ctx.instance.runtime_properties['pid']", 'SIGKILL'], {}), "(ctx.instance.runtime_properties['pid'], SIGKILL)\n", (99, 148), False, 'import os\n'), ((205, 253), 'cloudify.ctx.instance.runtime_properties.pop', 'ctx.instance.runtime_properties.pop', (['"""pid"""', 'None'], {}), "(... |
import torch
import torch.nn as nn
from resnet import ResidualNetwork
from Transformer import LayerNorm
# predict distance map from pair features
# based on simple 2D ResNet
class DistanceNetwork(nn.Module):
def __init__(self, n_block, n_feat, block_type='orig', p_drop=0.1):
super(DistanceNetwork, self)._... | [
"torch.nn.Dropout",
"resnet.ResidualNetwork",
"torch.nn.Linear",
"Transformer.LayerNorm"
] | [((350, 367), 'Transformer.LayerNorm', 'LayerNorm', (['n_feat'], {}), '(n_feat)\n', (359, 367), False, 'from Transformer import LayerNorm\n'), ((388, 413), 'torch.nn.Linear', 'nn.Linear', (['n_feat', 'n_feat'], {}), '(n_feat, n_feat)\n', (397, 413), True, 'import torch.nn as nn\n'), ((434, 452), 'torch.nn.Dropout', 'nn... |
from labelreg.helpers import DataReader
import SimpleITK as sitk
from dataprocessor.tools import get_bounding_box
from NIIVisualization.Niiplot import multi_slice_viewer
class NiiDataPreprocessor():
def __init__(self,img_dir,lable_dir):
self.img=DataReader(img_dir)
self.label=DataReader(lable_dir)... | [
"labelreg.helpers.DataReader",
"NIIVisualization.Niiplot.multi_slice_viewer",
"dataprocessor.tools.get_bounding_box"
] | [((1487, 1553), 'labelreg.helpers.DataReader', 'DataReader', (['"""E:\\\\MIA_CODE_DATA\\\\zhuang_data\\\\MMWHS\\\\MRI\\\\mr-label"""'], {}), "('E:\\\\MIA_CODE_DATA\\\\zhuang_data\\\\MMWHS\\\\MRI\\\\mr-label')\n", (1497, 1553), False, 'from labelreg.helpers import DataReader\n'), ((1567, 1633), 'labelreg.helpers.DataRea... |
#! /usr/bin/env python3
"""
****************************************************************************
Copyright (C) 2018 Datirium. LLC.
All rights reserved.
Contact: Datirium, LLC (<EMAIL>)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the ... | [
"warnings.filterwarnings",
"os.path.exists",
"biowardrobe_cwl_workflows.available",
"airflow.bin.cli.api_client.create_pool",
"os.path.join",
"airflow.configuration.conf.add_section",
"os.path.splitext",
"shutil.copyfile",
"airflow.configuration.conf.write",
"airflow.configuration.set",
"airflow... | [((1219, 1261), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {'category': 'Warning'}), "('ignore', category=Warning)\n", (1233, 1261), False, 'from warnings import filterwarnings\n'), ((1565, 1576), 'biowardrobe_cwl_workflows.available', 'available', ([], {}), '()\n', (1574, 1576), False, 'from biowa... |
# ------------------------------------------------------------------ #
# mrr.py
# ------------------------------------------------------------------ #
#
# Extract all the relevant parameters of a microring resonator:
# Bus effective index
# Ring effective index
# Self-coupling coefficient
# Cross-coupling... | [
"meep.Vector3",
"meep.ContinuousSource",
"matplotlib.pyplot.show",
"meep.PML",
"meep.Simulation",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"meep.Medium"
] | [((1114, 1135), 'meep.Medium', 'mp.Medium', ([], {'epsilon': '(12)'}), '(epsilon=12)\n', (1123, 1135), True, 'import meep as mp\n'), ((1143, 1163), 'meep.Medium', 'mp.Medium', ([], {'epsilon': '(3)'}), '(epsilon=3)\n', (1152, 1163), True, 'import meep as mp\n'), ((3397, 3428), 'meep.Vector3', 'mp.Vector3', (['cellX', '... |
import os
import requests
import json
class SimulationManagerException(Exception):
def __init__(self, status_code, message):
self.status_code = status_code
self.message = message
def createSimulation(incident_id, num_nodes, requested_walltime, kind, executable, queuestate_callbacks={}, directory=N... | [
"json.loads"
] | [((2546, 2571), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (2556, 2571), False, 'import json\n')] |
#!/usr/bin/env python3
import csv
import datetime
import os
import shelve
from time import time
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import expit as activation_function # sigmoid function
from scipy.special import logit as inverse_activation_function
import wget
# CONFIG
DATA_DIR =... | [
"wget.download",
"numpy.asfarray",
"numpy.array",
"shelve.open",
"datetime.timedelta",
"matplotlib.pyplot.imshow",
"os.path.exists",
"numpy.asarray",
"numpy.max",
"numpy.dot",
"numpy.min",
"csv.reader",
"numpy.argmax",
"scipy.special.expit",
"numpy.transpose",
"time.time",
"matplotli... | [((529, 570), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""mnist_train.csv"""'], {}), "(DATA_DIR, 'mnist_train.csv')\n", (541, 570), False, 'import os\n'), ((583, 623), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""mnist_test.csv"""'], {}), "(DATA_DIR, 'mnist_test.csv')\n", (595, 623), False, 'import os\n'), (... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
NiBetaSeries processing workflows
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import os
from copy import deepcopy... | [
"bids.BIDSLayout",
"os.makedirs",
"nipype.interfaces.utility.Function",
"nibabel.load",
"os.path.join",
"re.match",
"niworkflows.engine.workflows.LiterateWorkflow",
"copy.deepcopy",
"nipype.interfaces.utility.IdentityInterface"
] | [((3775, 3819), 'niworkflows.engine.workflows.LiterateWorkflow', 'Workflow', ([], {'name': '"""nibetaseries_participant_wf"""'}), "(name='nibetaseries_participant_wf')\n", (3783, 3819), True, 'from niworkflows.engine.workflows import LiterateWorkflow as Workflow\n'), ((3863, 3906), 'os.path.join', 'os.path.join', (['wo... |
import cv2
img = cv2.imread("opencv-logo.png", 1) # 第2个参数是1表示使用图像的默认颜色和色彩通道,如果是0则表示以黑白形式读入该图片
print(img) # 会发现是一个数组
print(type(img)) # 类型是<class 'numpy.ndarray'>
print(len(img)) # 表示数组的行
print(len(img[0])) # 表示数组的列
print(len(img[0][0])) # 表示通道数,这里是3,表示RGB红绿蓝3通道
print(img.shape) # 直接打印出这3项参数
print(img.dtype) ... | [
"cv2.imread"
] | [((18, 50), 'cv2.imread', 'cv2.imread', (['"""opencv-logo.png"""', '(1)'], {}), "('opencv-logo.png', 1)\n", (28, 50), False, 'import cv2\n')] |
import numpy as np
def compute_fans(shape):
if len(shape) == 2:
fan_in, fan_out = shape[0], shape[1]
else:
fan_in, fan_out = np.prod(shape[1:]), shape[0]
return fan_in, fan_out
class initializer(object):
def __call__(self, shape):
return self.init(shape).astype(np.float32)
... | [
"numpy.prod",
"numpy.sqrt",
"numpy.full",
"numpy.random.uniform"
] | [((151, 169), 'numpy.prod', 'np.prod', (['shape[1:]'], {}), '(shape[1:])\n', (158, 169), True, 'import numpy as np\n'), ((854, 887), 'numpy.sqrt', 'np.sqrt', (['(6.0 / (fan_in + fan_out))'], {}), '(6.0 / (fan_in + fan_out))\n', (861, 887), True, 'import numpy as np\n'), ((507, 549), 'numpy.full', 'np.full', ([], {'shap... |
"""
Spidy takes the params URL, Depth, File Path
"""
from __future__ import print_function
import sys
from spidy.spidy import Spidy
if __name__ == '__main__':
args = sys.argv
try:
spidy = Spidy(args[0], args[1], args[2])
spidy.crawl()
except IndexError:
print_function("Please c... | [
"__future__.print_function",
"spidy.spidy.Spidy"
] | [((210, 242), 'spidy.spidy.Spidy', 'Spidy', (['args[0]', 'args[1]', 'args[2]'], {}), '(args[0], args[1], args[2])\n', (215, 242), False, 'from spidy.spidy import Spidy\n'), ((296, 341), '__future__.print_function', 'print_function', (['"""Please check the arguments."""'], {}), "('Please check the arguments.')\n", (310,... |
import sys
import os
import logging
import torch
from torch import nn
from transduction_model import test, save_output, Model
from read_emg import EMGDataset
from asr import evaluate
from data_utils import phoneme_inventory, print_confusion
from absl import flags
FLAGS = flags.FLAGS
flags.DEFINE_list('models', [], '... | [
"read_emg.EMGDataset",
"logging.StreamHandler",
"os.makedirs",
"torch.nn.ModuleList",
"torch.load",
"torch.stack",
"data_utils.print_confusion",
"os.path.join",
"transduction_model.test",
"torch.cuda.is_available",
"asr.evaluate",
"absl.flags.DEFINE_list"
] | [((287, 355), 'absl.flags.DEFINE_list', 'flags.DEFINE_list', (['"""models"""', '[]', '"""identifiers of models to evaluate"""'], {}), "('models', [], 'identifiers of models to evaluate')\n", (304, 355), False, 'from absl import flags\n'), ((774, 824), 'os.makedirs', 'os.makedirs', (['FLAGS.output_directory'], {'exist_o... |
# -*- coding: utf8
from __future__ import division, print_function
from pyksc import dist
from pyksc import ksc
import ioutil
import numpy as np
import os
import plac
def main(tseries_fpath, base_folder, k):
k = int(k)
idx_fpath = os.path.join(os.path.join(base_folder, '..'), 'train.dat')
X = iouti... | [
"ioutil.load_series",
"os.path.join",
"pyksc.ksc.inc_ksc",
"plac.call"
] | [((315, 359), 'ioutil.load_series', 'ioutil.load_series', (['tseries_fpath', 'idx_fpath'], {}), '(tseries_fpath, idx_fpath)\n', (333, 359), False, 'import ioutil\n'), ((399, 416), 'pyksc.ksc.inc_ksc', 'ksc.inc_ksc', (['X', 'k'], {}), '(X, k)\n', (410, 416), False, 'from pyksc import ksc\n'), ((768, 783), 'plac.call', '... |
import unittest
from archapp import print_formats
def test_print_list_no_crash():
print_formats.list_print([], do_print=False)
print_formats.list_print(["text"], do_print=False)
print_formats.list_print(["text"] * 50, do_print=False)
| [
"archapp.print_formats.list_print"
] | [((89, 133), 'archapp.print_formats.list_print', 'print_formats.list_print', (['[]'], {'do_print': '(False)'}), '([], do_print=False)\n', (113, 133), False, 'from archapp import print_formats\n'), ((138, 188), 'archapp.print_formats.list_print', 'print_formats.list_print', (["['text']"], {'do_print': '(False)'}), "(['t... |
from flask import current_app
from cache.statistic import UserArticleCountStorage, UserFollowingsCountStorage, UserFansCountStorage
from utils.decorators import set_db_to_read
def __fix_statistic(cls):
try:
# 先得到查询集
ret = cls.get_query()
# 校正数据
cls.reset(ret)
except BaseExcepti... | [
"flask.current_app.logger.error"
] | [((337, 364), 'flask.current_app.logger.error', 'current_app.logger.error', (['e'], {}), '(e)\n', (361, 364), False, 'from flask import current_app\n')] |
from click.testing import CliRunner
import time
import pytest
import json
from calm.dsl.cli import main as cli
from calm.dsl.cli.constants import APPLICATION
from calm.dsl.tools import get_logging_handle
LOG = get_logging_handle(__name__)
BP_FILE_PATH = "tests/cli/runtime_helpers/ahv/blueprint.py"
LAUNCH_PARAMS = "te... | [
"calm.dsl.tools.get_logging_handle",
"json.loads",
"time.sleep",
"click.testing.CliRunner",
"pytest.fail",
"time.time"
] | [((212, 240), 'calm.dsl.tools.get_logging_handle', 'get_logging_handle', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'from calm.dsl.tools import get_logging_handle\n'), ((655, 666), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (664, 666), False, 'from click.testing import CliRunner\n'), ((2791, ... |
# pylint: disable=missing-docstring
from unittest.mock import Mock, patch
from peltak.extra.scripts.commands import post_conf_load, root_cli
from peltak.testing import patch_pelconf
@patch_pelconf({
'scripts': {
'fake1': {'command': 'fake1_cmd'},
'fake2': {'command': 'fake2_cmd'},
}
})
@patch... | [
"unittest.mock.Mock",
"unittest.mock.patch",
"peltak.extra.scripts.commands.post_conf_load",
"peltak.testing.patch_pelconf"
] | [((186, 289), 'peltak.testing.patch_pelconf', 'patch_pelconf', (["{'scripts': {'fake1': {'command': 'fake1_cmd'}, 'fake2': {'command':\n 'fake2_cmd'}}}"], {}), "({'scripts': {'fake1': {'command': 'fake1_cmd'}, 'fake2': {\n 'command': 'fake2_cmd'}}})\n", (199, 289), False, 'from peltak.testing import patch_pelconf... |
# (c) 2017 <NAME>
import numpy as np
from scipy.special import digamma
from scipy.stats import poisson, gamma
from matplotlib import pyplot as plt
euler = 0.577215664901532
t = np.linspace(0, 10, 1000)
plt.plot(t, t*np.exp(t)/np.expm1(t))
plt.show()
exit()
#plt.plot(t, digamma(t))
#plt.plot(t, np.log(t/(1 - np.exp(-t... | [
"scipy.special.digamma",
"scipy.stats.poisson.pmf",
"matplotlib.pyplot.plot",
"numpy.expm1",
"numpy.exp",
"numpy.linspace",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((179, 203), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(1000)'], {}), '(0, 10, 1000)\n', (190, 203), True, 'import numpy as np\n'), ((241, 251), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (249, 251), True, 'from matplotlib import pyplot as plt\n'), ((684, 698), 'matplotlib.pyplot.plot', 'plt.plot... |
#!/usr/bin/env python2.7
import numbers
from operator import itemgetter
import math
import xxhash_cffi as xxhash
import socket
import numpy as np
import sys
import numpy
from scipy import stats
import dpkt
import time
import argparse
from datetime import datetime
VERBOSE_ITEM = "1112.238.162.249"
def hll_rank(has... | [
"dpkt.pcap.Reader",
"argparse.ArgumentParser",
"socket.inet_ntop",
"math.log",
"dpkt.ethernet.Ethernet",
"datetime.datetime.now",
"dpkt.sll.SLL",
"sys.exit"
] | [((2813, 2834), 'dpkt.pcap.Reader', 'dpkt.pcap.Reader', (['fr1'], {}), '(fr1)\n', (2829, 2834), False, 'import dpkt\n'), ((6370, 6384), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (6382, 6384), False, 'from datetime import datetime\n'), ((1668, 1726), 'argparse.ArgumentParser', 'argparse.ArgumentParser',... |
# -*- coding:utf8 -*-
from lib.base.Base import Base
import clr
class NpcNameFinder(Base):
def __init__(self, needCpture=True):
Base.__init__(self)
print(clr.AddReference("lib\\NameFinder\\NpcNameFinder"))
import NpcNameFinder
self.dll = NpcNameFinder.Main()
self.captur = F... | [
"lib.base.Base.Base.__init__",
"NpcNameFinder.Main",
"clr.AddReference"
] | [((142, 161), 'lib.base.Base.Base.__init__', 'Base.__init__', (['self'], {}), '(self)\n', (155, 161), False, 'from lib.base.Base import Base\n'), ((276, 296), 'NpcNameFinder.Main', 'NpcNameFinder.Main', ([], {}), '()\n', (294, 296), False, 'import NpcNameFinder\n'), ((176, 226), 'clr.AddReference', 'clr.AddReference', ... |
#!/usr/bin/env python3
"""
Module to implement the Modified Seminario Method
Originally written by <NAME>, TCM, University of Cambridge
Modified by <NAME> and rewritten by <NAME>, Newcastle University
Reference using AEA Allen, MC Payne, DJ Cole, J. Chem. Theory Comput. (2018), doi:10.1021/acs.jctc.7b00785
"""
from Q... | [
"numpy.cross",
"numpy.linalg.eig",
"numpy.average",
"numpy.real",
"numpy.zeros",
"numpy.dot",
"numpy.empty",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"operator.itemgetter",
"QUBEKit.utils.decorators.for_all_methods"
] | [((5725, 5754), 'QUBEKit.utils.decorators.for_all_methods', 'for_all_methods', (['timer_logger'], {}), '(timer_logger)\n', (5740, 5754), False, 'from QUBEKit.utils.decorators import for_all_methods, timer_logger\n'), ((837, 857), 'numpy.cross', 'np.cross', (['u_bc', 'u_ab'], {}), '(u_bc, u_ab)\n', (845, 857), True, 'im... |