code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'cellPoseUI.ui'
# Created by: PyQt5 UI code generator 5.11.3
import os, platform, ctypes, sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFontDatabase
from scellseg.guis.scellsegUi import Ui_... | [
"PyQt5.QtWidgets.QMessageBox.question",
"platform.system",
"PyQt5.QtWidgets.QApplication",
"os.path.abspath",
"ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID"
] | [((6736, 6768), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (6758, 6768), False, 'from PyQt5 import QtWidgets\n'), ((732, 880), 'PyQt5.QtWidgets.QMessageBox.question', 'QtWidgets.QMessageBox.question', (['self', '"""Close"""', '"""Close Scellseg"""', '(QtWidgets.QMessag... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tensorflow.cast",
"tensorflow_federated.federated_map",
"group_by_key_lib.key_list_func",
"tensorflow.range",
"group_by_key_lib.gather_data",
"tensorflow.lookup.KeyValueTensorInitializer",
"tensorflow.convert_to_tensor",
"tensorflow_federated.FederatedType",
"tensorflow_federated.tf_computation",
... | [((910, 930), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (928, 930), False, 'import nest_asyncio\n'), ((1056, 1072), 'group_by_key_lib.gather_data', 'gather_data', (['"""1"""'], {}), "('1')\n", (1067, 1072), False, 'from group_by_key_lib import gather_data, key_list_func\n'), ((1091, 1113), 'group_by... |
import os
from ibm_watson import LanguageTranslatorV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from dotenv import load_dotenv
load_dotenv()
apikey= os.environ['apikey']
url= os.environ['url']
VERSION= '2018-05-01'
authenticator= IAMAuthenticator(apikey)
language_translator= LanguageTranslatorV3(... | [
"ibm_watson.LanguageTranslatorV3",
"ibm_cloud_sdk_core.authenticators.IAMAuthenticator",
"dotenv.load_dotenv"
] | [((149, 162), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (160, 162), False, 'from dotenv import load_dotenv\n'), ((253, 277), 'ibm_cloud_sdk_core.authenticators.IAMAuthenticator', 'IAMAuthenticator', (['apikey'], {}), '(apikey)\n', (269, 277), False, 'from ibm_cloud_sdk_core.authenticators import IAMAuthent... |
import trace_malloc as trace
'''trace 10 files with maximum memory allocated'''
trace.start()
# ... run your code ...
snapshot = trace.take_snapshot()
top_stats = snapshot.statistics('lineno')
print("[ Top 10 ]")
for stat in top_stats[:10]:
print(stat)
'''Backtrack the largest memory block'''
# Store 25 f... | [
"trace_malloc.start",
"trace_malloc.take_snapshot"
] | [((83, 96), 'trace_malloc.start', 'trace.start', ([], {}), '()\n', (94, 96), True, 'import trace_malloc as trace\n'), ((134, 155), 'trace_malloc.take_snapshot', 'trace.take_snapshot', ([], {}), '()\n', (153, 155), True, 'import trace_malloc as trace\n'), ((326, 341), 'trace_malloc.start', 'trace.start', (['(25)'], {}),... |
from django.test import TestCase, Client
from django.urls import reverse
from django.test.utils import setup_test_environment
from bs4 import BeautifulSoup
import re
import time
from projects.models import *
from projects.forms import *
client = Client()
# length of base template, used to test for empty pages
LEN_B... | [
"re.match",
"bs4.BeautifulSoup",
"django.urls.reverse",
"time.time",
"django.test.Client"
] | [((249, 257), 'django.test.Client', 'Client', ([], {}), '()\n', (255, 257), False, 'from django.test import TestCase, Client\n'), ((456, 480), 'django.urls.reverse', 'reverse', (['"""projects:home"""'], {}), "('projects:home')\n", (463, 480), False, 'from django.urls import reverse\n'), ((627, 651), 'django.urls.revers... |
import tensorflow as tf
from layers.attention_layers import attention_layer
from layers.common_layers import init_inputs
from layers.feed_forward_layers import feed_forward_diff_features, feed_forward_diff_layers
from utils.hyperparams import Hyperparams as hp
class AttentionBasedEnsembleNets:
def __init__(self... | [
"tensorflow.round",
"tensorflow.train.AdamOptimizer",
"tensorflow.summary.merge_all",
"tensorflow.placeholder",
"tensorflow.losses.sigmoid_cross_entropy",
"layers.feed_forward_layers.feed_forward_diff_layers",
"tensorflow.nn.sigmoid",
"tensorflow.name_scope",
"tensorflow.reduce_mean",
"tensorflow.... | [((390, 412), 'tensorflow.name_scope', 'tf.name_scope', (['"""input"""'], {}), "('input')\n", (403, 412), True, 'import tensorflow as tf\n'), ((443, 487), 'layers.common_layers.init_inputs', 'init_inputs', (['num_features', 'selection_methods'], {}), '(num_features, selection_methods)\n', (454, 487), False, 'from layer... |
# Copyright 2013 10gen Inc.
#
# 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... | [
"types.ModuleType",
"mock.MagicMock"
] | [((902, 933), 'types.ModuleType', 'types.ModuleType', (['"""test_script"""'], {}), "('test_script')\n", (918, 933), False, 'import types\n'), ((953, 969), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (967, 969), False, 'import mock\n')] |
import math
from itertools import product
from typing import Tuple, List, Optional, Union
import numpy as np
import torch
import torch.nn as nn
import torch.nn.init as init
class EMA:
"""
Class that keeps track of exponential moving average of model parameters of a particular model.
Also see https://gith... | [
"numpy.clip",
"torch.nn.init.constant_",
"itertools.product",
"math.sqrt",
"torch.no_grad",
"torch.flatten"
] | [((7623, 7638), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7636, 7638), False, 'import torch\n'), ((8322, 8364), 'numpy.clip', 'np.clip', (['(current / rampup_length)', '(0.0)', '(1.0)'], {}), '(current / rampup_length, 0.0, 1.0)\n', (8329, 8364), True, 'import numpy as np\n'), ((1390, 1405), 'torch.no_grad',... |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import csv
import seaborn as sns
import itertools
import pandas as pd
import scipy
from scipy.signal import savgol_filter
from scipy.signal import find_peaks_cwt
from scipy.signal import boxcar
sns.set(font_scale=1.2)
sns.set_style("white")
colors = ... | [
"seaborn.set",
"numpy.convolve",
"seaborn.color_palette",
"seaborn.set_style",
"scipy.signal.boxcar",
"numpy.interp",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((264, 287), 'seaborn.set', 'sns.set', ([], {'font_scale': '(1.2)'}), '(font_scale=1.2)\n', (271, 287), True, 'import seaborn as sns\n'), ((288, 310), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (301, 310), True, 'import seaborn as sns\n'), ((387, 433), 'numpy.loadtxt', 'np.loadtxt', ([... |
import mock
import pytest
from prf.tests.prf_testcase import PrfTestCase
from pyramid.exceptions import ConfigurationExecutionError
from prf.resource import Resource, get_view_class, get_parent_elements
from prf.view import BaseView
class TestResource(PrfTestCase):
def test_init_(self):
res = Resource(se... | [
"mock.patch",
"pytest.mark.skip",
"pytest.raises",
"prf.resource.get_view_class",
"prf.resource.Resource"
] | [((2185, 2224), 'mock.patch', 'mock.patch', (['"""prf.resource.maybe_dotted"""'], {}), "('prf.resource.maybe_dotted')\n", (2195, 2224), False, 'import mock\n'), ((2852, 2894), 'pytest.mark.skip', 'pytest.mark.skip', (['"""route_prefix is broken"""'], {}), "('route_prefix is broken')\n", (2868, 2894), False, 'import pyt... |
"""Test aggregation of config files and command-line options."""
import os
import pytest
from flake8.main import options
from flake8.options import aggregator
from flake8.options import config
from flake8.options import manager
@pytest.fixture
def optmanager():
"""Create a new OptionManager."""
option_manag... | [
"flake8.main.options.register_default_options",
"flake8.options.config.load_config",
"flake8.options.aggregator.aggregate_options",
"os.path.abspath",
"flake8.options.manager.OptionManager"
] | [((325, 395), 'flake8.options.manager.OptionManager', 'manager.OptionManager', ([], {'version': '"""3.0.0"""', 'plugin_versions': '""""""', 'parents': '[]'}), "(version='3.0.0', plugin_versions='', parents=[])\n", (346, 395), False, 'from flake8.options import manager\n'), ((431, 479), 'flake8.main.options.register_def... |
# Imports
import sys, os, time, logging, json
# QR code scanning is on a separate file
from qr import qrscan
# Configuration using config.json
with open('config.json', 'r') as f:
config = json.load(f)
if 'outfile' in config:
outfile = config['outfile']
if 'path' in config:
path = config['path']
extensions = c... | [
"logging.basicConfig",
"logging.StreamHandler",
"os.listdir",
"qr.qrscan",
"os.fsdecode",
"os.path.splitext",
"os.path.isfile",
"os.path.isdir",
"logging.FileHandler",
"time.time",
"json.load",
"logging.info",
"logging.error",
"json.dump"
] | [((1789, 1809), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (1803, 1809), False, 'import sys, os, time, logging, json\n'), ((192, 204), 'json.load', 'json.load', (['f'], {}), '(f)\n', (201, 204), False, 'import sys, os, time, logging, json\n'), ((1908, 1927), 'os.path.isdir', 'os.path.isdir', (['pat... |
import cv2
import numpy as np
from rich import print
dewarped = cv2.imread('../dewarped.png')
'''
SIZE = 600
# Get ROI corners
arucoDict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_APRILTAG_36h11)
arucoParams = cv2.aruco.DetectorParameters_create()
(corners, ids, rejected) = cv2.aruco.detectMarkers(image, arucoDict, p... | [
"cv2.setMouseCallback",
"cv2.imshow",
"cv2.circle",
"rich.print",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.imread"
] | [((65, 94), 'cv2.imread', 'cv2.imread', (['"""../dewarped.png"""'], {}), "('../dewarped.png')\n", (75, 94), False, 'import cv2\n'), ((1024, 1056), 'cv2.imshow', 'cv2.imshow', (['"""Dewarped"""', 'dewarped'], {}), "('Dewarped', dewarped)\n", (1034, 1056), False, 'import cv2\n'), ((1531, 1577), 'cv2.setMouseCallback', 'c... |
#!/usr/bin/python
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import trie
class TrieTest(unittest.TestCase):
def MakeUncompressedTrie(self):
uncompressed = trie.Node(... | [
"trie.AcceptInfo",
"trie.GetAllUniqueNodes",
"trie.Node",
"trie.NodeCache",
"trie.TrieToDict",
"trie.AddToUncompressedTrie",
"trie.DiffTries",
"unittest.main",
"trie.GetAllAcceptSequences"
] | [((3683, 3698), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3696, 3698), False, 'import unittest\n'), ((310, 321), 'trie.Node', 'trie.Node', ([], {}), '()\n', (319, 321), False, 'import trie\n'), ((335, 385), 'trie.AcceptInfo', 'trie.AcceptInfo', ([], {'input_rr': '"""%eax"""', 'output_rr': '"""%edx"""'}), "(i... |
# Copyright 2018 AT&T Intellectual Property. All other 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... | [
"beaker.util.parse_cache_config_options",
"oslo_log.log.getLogger"
] | [((805, 832), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (822, 832), True, 'from oslo_log import log as logging\n'), ((947, 986), 'beaker.util.parse_cache_config_options', 'parse_cache_config_options', (['_CACHE_OPTS'], {}), '(_CACHE_OPTS)\n', (973, 986), False, 'from beaker.util... |
import os
import reader
import json
# todo: get this logger from elsewhere
from celery.utils.log import get_task_logger
log = get_task_logger(__name__)
defaultFieldMappings = [
### SET
(['info','protocol'], 'getReplayProtocolVersion'),
(['info','bytes'], 'getReplayFileByteSize'),
(['info','gameloops'], '... | [
"celery.utils.log.get_task_logger"
] | [((128, 153), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'from celery.utils.log import get_task_logger\n')] |
# -*- coding: utf-8 -*-
import matplotlib.colors as colorplt
import matplotlib.pyplot as plt
import numpy as np
from sktime.distances._distance import distance_alignment_path, pairwise_distance
gray_cmap = colorplt.LinearSegmentedColormap.from_list("", ["#c9cacb", "white"])
def _path_mask(cost_matrix, path, ax, the... | [
"os.path.exists",
"os.makedirs",
"numpy.arange",
"matplotlib.pyplot.plot",
"matplotlib.colors.LinearSegmentedColormap.from_list",
"sktime.distances._distance.pairwise_distance",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyp... | [((208, 276), 'matplotlib.colors.LinearSegmentedColormap.from_list', 'colorplt.LinearSegmentedColormap.from_list', (['""""""', "['#c9cacb', 'white']"], {}), "('', ['#c9cacb', 'white'])\n", (250, 276), True, 'import matplotlib.colors as colorplt\n'), ((353, 379), 'numpy.zeros_like', 'np.zeros_like', (['cost_matrix'], {}... |
# RT Ext - Useful Util
# 注意:普通のエクステンションとは違います。
import asyncio
from json import dumps
from time import time
import discord
from aiofile import async_open
from discord.ext import commands, tasks
class RtUtil(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.data = {
"list_emb... | [
"discord.ext.commands.Cog.listener",
"discord.utils.get",
"discord.ext.tasks.loop",
"time.time"
] | [((906, 927), 'discord.ext.tasks.loop', 'tasks.loop', ([], {'seconds': '(5)'}), '(seconds=5)\n', (916, 927), False, 'from discord.ext import commands, tasks\n'), ((2425, 2448), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (2446, 2448), False, 'from discord.ext import commands, tasks\n... |
import numpy as np
import pytest
from src.models.noise_transformation import average_true_var_real, average_true_var_imag, average_true_cov, \
average_true_noise_covariance, naive_noise_covariance
test_cases_real_variance = [
(2 - 3j, 0, 0, 0),
(0, 1, 1, np.exp(-2) * (2 * np.cosh(2) - np.cosh(1))),
(2... | [
"src.models.noise_transformation.naive_noise_covariance",
"numpy.sqrt",
"src.models.noise_transformation.average_true_var_imag",
"numpy.testing.assert_allclose",
"src.models.noise_transformation.average_true_cov",
"numpy.sinh",
"numpy.exp",
"pytest.mark.parametrize",
"numpy.zeros",
"src.models.noi... | [((1045, 1134), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""m,sd_magnitude,sd_phase,expected"""', 'test_cases_real_variance'], {}), "('m,sd_magnitude,sd_phase,expected',\n test_cases_real_variance)\n", (1068, 1134), False, 'import pytest\n'), ((1309, 1398), 'pytest.mark.parametrize', 'pytest.mark.par... |
"""Finds out all the people you need to follow to follow all the same people as another user. Then, optionally, follows them for you."""
import configparser
import csv
import errno
import os
import tweepy
from tqdm import tqdm
#Useful Constants
PATH_TO_TARGET_CSV = "./output/targetfriends.csv"
PATH_TO_USER... | [
"configparser.ConfigParser",
"os.makedirs",
"tqdm.tqdm.write",
"tweepy.Cursor",
"csv.writer",
"tqdm.tqdm",
"tweepy.API",
"csv.reader",
"tweepy.OAuthHandler"
] | [((436, 463), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (461, 463), False, 'import configparser\n'), ((1119, 1166), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['API_KEY', 'API_SECRET', '"""oob"""'], {}), "(API_KEY, API_SECRET, 'oob')\n", (1138, 1166), False, 'import tweepy\n'), ((1... |
# Thanks `https://github.com/pypa/sampleproject`!!
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'VERSION'), 'r', encoding='utf-8') as f:
version = f.read().strip()
with open(path.join(here, 'README.md'), 'r', encoding='utf-8') ... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((136, 158), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (148, 158), False, 'from os import path\n'), ((171, 197), 'os.path.join', 'path.join', (['here', '"""VERSION"""'], {}), "(here, 'VERSION')\n", (180, 197), False, 'from os import path\n'), ((267, 295), 'os.path.join', 'path.join', (['he... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 26 19:39:00 2019
@author: hehehe
"""
from __future__ import absolute_import, print_function
from tweepy import OAuthHandler, Stream, StreamListener
#Buat API Twitter di link berikut https://developer.twitter.com/en/apps
consumer_key = "masukkan consumer_key"
consumer_s... | [
"tweepy.Stream",
"tweepy.OAuthHandler"
] | [((1181, 1196), 'tweepy.Stream', 'Stream', (['auth', 'l'], {}), '(auth, l)\n', (1187, 1196), False, 'from tweepy import OAuthHandler, Stream, StreamListener\n'), ((1031, 1074), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (1043, 1074), False, 'fr... |
from flask import Blueprint
api = Blueprint("data_manage_api", __name__)
from . import data_venation
from . import operator_manage
from . import model_manage
from . import resource_manage
from . import pipeline_manage
from . import trainedmodel_manage
| [
"flask.Blueprint"
] | [((35, 73), 'flask.Blueprint', 'Blueprint', (['"""data_manage_api"""', '__name__'], {}), "('data_manage_api', __name__)\n", (44, 73), False, 'from flask import Blueprint\n')] |
import os
import typing
import cfg_exporter.custom as custom
from cfg_exporter.const import DataType
from cfg_exporter.const import TEMPLATE_EXTENSION
from cfg_exporter.exports.base.export import BaseExport
from cfg_exporter.lang_template import lang
from cfg_exporter.tables.base.type import DefaultValue
EXTENSION = ... | [
"os.path.dirname",
"cfg_exporter.custom.analyze_default_value",
"cfg_exporter.lang_template.lang"
] | [((359, 384), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (374, 384), False, 'import os\n'), ((1861, 1900), 'cfg_exporter.custom.analyze_default_value', 'custom.analyze_default_value', (['table_obj'], {}), '(table_obj)\n', (1889, 1900), True, 'import cfg_exporter.custom as custom\n'), ((11... |
from typing import Any
from starlette.datastructures import State
class DefaultState:
state = State()
def get(self,key:str, value: Any = None) -> Any:
if hasattr(self.state, key):
return getattr(self.state, key)
else:
if not value:
raise Exception('st... | [
"starlette.datastructures.State"
] | [((102, 109), 'starlette.datastructures.State', 'State', ([], {}), '()\n', (107, 109), False, 'from starlette.datastructures import State\n')] |
# -*- coding: utf-8 -*-
import os
import sys
# ensure `tests` directory path is on top of Python's module search
filedir = os.path.dirname(__file__)
sys.path.insert(0, filedir)
while filedir in sys.path[1:]:
sys.path.pop(sys.path.index(filedir)) # avoid duplication
import pytest
import numpy as np
from copy impor... | [
"numpy.abs",
"sys.path.insert",
"backend.notify",
"backend.tempdir",
"os.path.join",
"backend._do_test_load",
"pytest.main",
"os.path.dirname",
"numpy.random.randint",
"sys.path.index",
"backend._get_test_names",
"copy.deepcopy",
"backend.K.abs",
"deeptrain.metrics._standardize",
"backen... | [((123, 148), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (138, 148), False, 'import os\n'), ((149, 176), 'sys.path.insert', 'sys.path.insert', (['(0)', 'filedir'], {}), '(0, filedir)\n', (164, 176), False, 'import sys\n'), ((734, 781), 'os.path.join', 'os.path.join', (['BASEDIR', '"""test... |
"""
File copy from https://github.com/moddevices/lilvlib
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------------------------------------
# Imports
import json
import lilv
import os
from math import fmod
# -----------------------------... | [
"lilv.lilv_world_load_plugin_classes",
"lilv.lilv_uri_to_path",
"lilv.lilv_node_free",
"lilv.lilv_nodes_next",
"lilv.lilv_scale_point_get_value",
"lilv.lilv_world_get",
"lilv.lilv_node_is_uri",
"pprint.pprint",
"lilv.lilv_scale_points_get",
"os.path.exists",
"lilv.lilv_scale_points_is_end",
"l... | [((4919, 4947), 'lilv.lilv_nodes_begin', 'lilv.lilv_nodes_begin', (['nodes'], {}), '(nodes)\n', (4940, 4947), False, 'import lilv\n'), ((6609, 6641), 'lilv.lilv_uri_to_path', 'lilv.lilv_uri_to_path', (['bundleuri'], {}), '(bundleuri)\n', (6630, 6641), False, 'import lilv\n'), ((6718, 6740), 'os.path.isfile', 'os.path.i... |
import os
'''
This script takes a beatmap file and a bunch of replays, calculates hitoffsets for each replay and saves them
to a *.csv file. This script works for std gamemode only.
'''
class SaveHitoffsets():
def create_dir(self, dir_path):
if not os.path.exists(dir_path):
try: os.mkdir(dir_... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"os.mkdir"
] | [((264, 288), 'os.path.exists', 'os.path.exists', (['dir_path'], {}), '(dir_path)\n', (278, 288), False, 'import os\n'), ((307, 325), 'os.mkdir', 'os.mkdir', (['dir_path'], {}), '(dir_path)\n', (315, 325), False, 'import os\n'), ((631, 656), 'os.listdir', 'os.listdir', (['replay_folder'], {}), '(replay_folder)\n', (641... |
import pytest
from mixins.fsm import FinalStateMachineMixin
MSG_START = 'start'
MSG_COMPLETE = 'complete'
MSG_BREAK = 'break'
MSG_RESTART = 'repair'
MSG_UNREGISTERED = 'unknown'
class SampleTask(FinalStateMachineMixin):
STATE_NEW = 'new'
STATE_RUNNING = 'running'
STATE_READY = 'ready'
STATE_FAILED =... | [
"pytest.raises"
] | [((2205, 2251), 'pytest.raises', 'pytest.raises', (['Exception'], {'message': 'expected_msg'}), '(Exception, message=expected_msg)\n', (2218, 2251), False, 'import pytest\n'), ((3572, 3606), 'pytest.raises', 'pytest.raises', (['NotImplementedError'], {}), '(NotImplementedError)\n', (3585, 3606), False, 'import pytest\n... |
import requests
import json
import os
import sys
import shutil
from .azureblob import AzureBlob
from .azuretable import AzureTable
from .timeutil import get_time_offset, str_to_dt, dt_to_str
from .series import Series
from .constant import STATUS_SUCCESS, STATUS_FAIL
from telemetry import log
# To get the meta of a ... | [
"os.path.exists",
"shutil.make_archive",
"json.dumps",
"os.path.join",
"requests.get",
"sys.exc_info",
"telemetry.log.info",
"os.remove"
] | [((742, 838), 'requests.get', 'requests.get', (["(config.tsana_api_endpoint + '/metrics/' + metric_id + '/meta')"], {'headers': 'headers'}), "(config.tsana_api_endpoint + '/metrics/' + metric_id + '/meta',\n headers=headers)\n", (754, 838), False, 'import requests\n'), ((7019, 7062), 'os.path.join', 'os.path.join', ... |
import click
from rastervision.command import Command
class TrainCommand(Command):
def __init__(self, task):
self.task = task
def run(self, tmp_dir=None):
if not tmp_dir:
tmp_dir = self.get_tmp_dir()
msg = 'Training model...'
click.echo(click.style(msg, fg='green'... | [
"click.style"
] | [((293, 321), 'click.style', 'click.style', (['msg'], {'fg': '"""green"""'}), "(msg, fg='green')\n", (304, 321), False, 'import click\n')] |
import inspect
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.magic import cell_magic, magics_class, Magics
from IPython.core.magic_arguments import (argument, magic_arguments,
parse_argstring)
import warnings
from htools.meta import timebox
@ma... | [
"IPython.core.magic_arguments.parse_argstring",
"htools.meta.timebox",
"IPython.core.magic_arguments.argument",
"IPython.core.magic_arguments.magic_arguments",
"inspect.isclass",
"warnings.filterwarnings"
] | [((385, 402), 'IPython.core.magic_arguments.magic_arguments', 'magic_arguments', ([], {}), '()\n', (400, 402), False, 'from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n'), ((408, 644), 'IPython.core.magic_arguments.argument', 'argument', (['"""-p"""'], {'action': '"""store_true"""', ... |
import asyncio
from datetime import datetime, timedelta
import functools
from http import HTTPStatus
import logging
import os
import pickle
from random import random
import re
import struct
from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Tuple
import warnings
import aiohttp.web
from aiohtt... | [
"logging.getLogger",
"sentry_sdk.configure_scope",
"athenian.api.controllers.account.get_user_account_status",
"connexion.exceptions.Unauthorized",
"multidict.CIMultiDict",
"sqlalchemy.select",
"datetime.timedelta",
"functools.wraps",
"athenian.api.models.web.user.User.from_auth0",
"asyncio.sleep"... | [((570, 595), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (593, 595), False, 'import warnings\n'), ((653, 726), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""int_from_bytes is deprecated"""'}), "('ignore', message='int_from_bytes is deprecated')\n",... |
import subprocess
def check_working_tree():
try:
subprocess.check_output(['git', 'diff', '--exit-code'])
except subprocess.CalledProcessError as e:
print('called process error')
out_bytes = e.output # Output generated before error
code = e.returncode # Return code
... | [
"subprocess.check_output"
] | [((63, 118), 'subprocess.check_output', 'subprocess.check_output', (["['git', 'diff', '--exit-code']"], {}), "(['git', 'diff', '--exit-code'])\n", (86, 118), False, 'import subprocess\n'), ((497, 561), 'subprocess.check_output', 'subprocess.check_output', (["['git', 'rev-parse', '--short', 'HEAD']"], {}), "(['git', 're... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0013_metadocumentasset_metadocumentsecureasset'),
]
operations = [
migrations.AlterField(
model_name='... | [
"django.db.models.OneToOneField"
] | [((384, 469), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'to': '"""assets.Asset"""', 'null': '(True)', 'related_name': '"""meta_document"""'}), "(to='assets.Asset', null=True, related_name='meta_document'\n )\n", (404, 469), False, 'from django.db import migrations, models\n'), ((602, 693), 'dja... |
# -*- coding: utf-8 -*-
"""
Logging configuration functions
"""
from logbook import NullHandler, FileHandler, NestedSetup
from logbook.more import ColorizedStderrHandler
from logbook.queues import ThreadedWrapperHandler
def logging_options(parser):
"""Add cli options for logging to parser"""
LOG_LEVELS = ("cr... | [
"logbook.more.ColorizedStderrHandler",
"logbook.NullHandler",
"logbook.queues.ThreadedWrapperHandler"
] | [((1084, 1121), 'logbook.more.ColorizedStderrHandler', 'ColorizedStderrHandler', ([], {'level': '"""ERROR"""'}), "(level='ERROR')\n", (1106, 1121), False, 'from logbook.more import ColorizedStderrHandler\n'), ((1575, 1588), 'logbook.NullHandler', 'NullHandler', ([], {}), '()\n', (1586, 1588), False, 'from logbook impor... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
#
# 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
#
#... | [
"openstack_dashboard.api.cinder.volume_list",
"openstack_dashboard.api.cinder.volume_snapshot_list"
] | [((1191, 1252), 'openstack_dashboard.api.cinder.volume_list', 'api.cinder.volume_list', (['self.request'], {'search_opts': 'search_opts'}), '(self.request, search_opts=search_opts)\n', (1213, 1252), False, 'from openstack_dashboard import api\n'), ((1580, 1625), 'openstack_dashboard.api.cinder.volume_snapshot_list', 'a... |
# Copyright 2020 Makani Technologies LLC
#
# 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... | [
"makani.analysis.checks.base_check.ParseCheckSpecs",
"makani.lib.python.import_util.ImportClass"
] | [((1051, 1090), 'makani.lib.python.import_util.ImportClass', 'import_util.ImportClass', (['path_to_checks'], {}), '(path_to_checks)\n', (1074, 1090), False, 'from makani.lib.python import import_util\n'), ((1659, 1697), 'makani.lib.python.import_util.ImportClass', 'import_util.ImportClass', (['path_to_check'], {}), '(p... |
# p2wsh input (2-of-2 multisig)
# p2wpkh output
import argparse
import hashlib
import ecdsa
def dSHA256(data):
hash_1 = hashlib.sha256(data).digest()
hash_2 = hashlib.sha256(hash_1).digest()
return hash_2
def hash160(s):
'''sha256 followed by ripemd160'''
return hashlib.new('ripemd160', hashlib.s... | [
"hashlib.sha256",
"argparse.ArgumentParser",
"ecdsa.SigningKey.from_string"
] | [((1149, 1174), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1172, 1174), False, 'import argparse\n'), ((5586, 5657), 'ecdsa.SigningKey.from_string', 'ecdsa.SigningKey.from_string', (['cust_close_privkey'], {'curve': 'ecdsa.SECP256k1'}), '(cust_close_privkey, curve=ecdsa.SECP256k1)\n', (5614... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file imports your code from localization_logic.py and uses class Visualisation from visualisation.py.
Additionally, it imports code from sensor_fusion.py file.
You can change the code at your own risk!
"""
import easygopigo3 as go
import signal
import pyqtgraph a... | [
"localization_logic.get_distance_with_cam",
"sensor_fusion.on_camera_measurement",
"signal.signal",
"easygopigo3.EasyGoPiGo3",
"visualisation.initialize_visualisation",
"localization_logic.get_blob_size",
"localization_logic.detect_blobs",
"read_sensors.initialize_serial",
"cv2.VideoCapture",
"sys... | [((895, 918), 'localization_logic.detect_blobs', 'loc.detect_blobs', (['frame'], {}), '(frame)\n', (911, 918), True, 'import localization_logic as loc\n'), ((935, 963), 'localization_logic.get_blob_size', 'loc.get_blob_size', (['keypoints'], {}), '(keypoints)\n', (952, 963), True, 'import localization_logic as loc\n'),... |
import os, sys, inspect, logging, time
lib_folder = os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0], '..')
lib_load = os.path.realpath(os.path.abspath(lib_folder))
if lib_load not in sys.path:
sys.path.insert(0, lib_load)
import capablerobot_usbhub
hub = capablerobot_usbhub.USBHub()
##... | [
"capablerobot_usbhub.USBHub",
"sys.path.insert",
"inspect.currentframe",
"time.sleep",
"os.path.abspath"
] | [((288, 316), 'capablerobot_usbhub.USBHub', 'capablerobot_usbhub.USBHub', ([], {}), '()\n', (314, 316), False, 'import capablerobot_usbhub\n'), ((161, 188), 'os.path.abspath', 'os.path.abspath', (['lib_folder'], {}), '(lib_folder)\n', (176, 188), False, 'import os, sys, inspect, logging, time\n'), ((224, 252), 'sys.pat... |
from setuptools import setup
# Get the long description by reading the README
try:
readme_content = open("README.rst").read()
except Exception as e:
readme_content = ""
# Create the actual setup method
setup(
name="pycinga",
version="1.0.0",
description="Python library to write Icinga plugins.",
... | [
"setuptools.setup"
] | [((212, 899), 'setuptools.setup', 'setup', ([], {'name': '"""pycinga"""', 'version': '"""1.0.0"""', 'description': '"""Python library to write Icinga plugins."""', 'long_description': 'readme_content', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'maintainer': '"""<NAME>"""', 'maintainer_email': '"""<EMAI... |
"""
Main call.
TODO:
- parallize the mda processing portion? (dask)
"""
import numpy as np
import matplotlib.pyplot as plt
import MDAnalysis as mda
from command_line import create_cmd_arguments, handle_command_line
from calc_relax import Calc_19F_Relaxation
from calc_fh_dists import Calc_FH_Dists
from plot_relax imp... | [
"numpy.mean",
"calc_fh_dists.Calc_FH_Dists",
"calc_relax.Calc_19F_Relaxation",
"command_line.handle_command_line",
"matplotlib.pyplot.plot",
"command_line.create_cmd_arguments",
"numpy.savetxt",
"MDAnalysis.Universe",
"matplotlib.pyplot.show"
] | [((681, 703), 'command_line.create_cmd_arguments', 'create_cmd_arguments', ([], {}), '()\n', (701, 703), False, 'from command_line import create_cmd_arguments, handle_command_line\n'), ((743, 779), 'command_line.handle_command_line', 'handle_command_line', (['argument_parser'], {}), '(argument_parser)\n', (762, 779), F... |
import numpy as np
class BoundBox:
"""
Adopted from https://github.com/thtrieu/darkflow/blob/master/darkflow/utils/box.py
"""
def __init__(self, obj_prob, probs=None, box_coord=[float() for i in range(4)]):
self.x, self.y = float(box_coord[0]), float(box_coord[1])
self.w, self.h =... | [
"numpy.array",
"numpy.argmax"
] | [((594, 621), 'numpy.argmax', 'np.argmax', (['self.class_probs'], {}), '(self.class_probs)\n', (603, 621), True, 'import numpy as np\n'), ((469, 484), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (477, 484), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Feb 28 20:56:45 2020
Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
"""
import json
import os
import sys
if __name__ == '__main__':
if len(sys.argv) != 3:
print(sys.argv)
print('argv error, inert_op_info.py your_op_file lib_op_file')
... | [
"json.load",
"os.path.exists",
"os.path.getsize",
"json.dumps"
] | [((441, 468), 'os.path.exists', 'os.path.exists', (['sys.argv[2]'], {}), '(sys.argv[2])\n', (455, 468), False, 'import os\n'), ((399, 416), 'json.load', 'json.load', (['load_f'], {}), '(load_f)\n', (408, 416), False, 'import json\n'), ((481, 509), 'os.path.getsize', 'os.path.getsize', (['sys.argv[2]'], {}), '(sys.argv[... |
import unittest
import docs as bp
class ApplicationClassTest(unittest.TestCase):
def setUp(self):
self.app = bp.Application()
def test_set_fps(self):
self.app.set_fps(30)
self.assertEqual(self.app.fps, 30)
self.app.set_fps(60)
self.assertEqual(self.app.fps, 60)
if _... | [
"unittest.main",
"docs.Application"
] | [((347, 362), 'unittest.main', 'unittest.main', ([], {}), '()\n', (360, 362), False, 'import unittest\n'), ((123, 139), 'docs.Application', 'bp.Application', ([], {}), '()\n', (137, 139), True, 'import docs as bp\n')] |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from .user_admin_views import UserAdminListViewSet
user_admin_list=UserAdminListViewSet.as_view({
"get":"get"
})
urlpatterns = (
url(r'^user$', user_admin_list, name='user-admin-list'),
)
| [
"django.conf.urls.url"
] | [((209, 263), 'django.conf.urls.url', 'url', (['"""^user$"""', 'user_admin_list'], {'name': '"""user-admin-list"""'}), "('^user$', user_admin_list, name='user-admin-list')\n", (212, 263), False, 'from django.conf.urls import include, url\n')] |
import pandas as pd
import numpy as np
import click
import os
PRIORITY = ('Read-through', 'Protein coding',
'Pseudogene', 'TUCP', 'lncrna', 'lncRNA', 'other', 'ncRNA,other')
type_map = {
'other': 'lncRNA',
'ncRNA,other': 'lncRNA',
'lncrna': 'lncRNA',
'protein_coding': 'Protein coding',
... | [
"click.option",
"numpy.where",
"os.path.join",
"click.Path",
"pandas.read_table",
"pandas.DataFrame",
"click.command",
"pandas.concat"
] | [((390, 405), 'click.command', 'click.command', ([], {}), '()\n', (403, 405), False, 'import click\n'), ((897, 989), 'click.option', 'click.option', (['"""-n"""', '"""--name"""'], {'type': 'click.STRING', 'help': '"""Summary table name"""', 'default': 'None'}), "('-n', '--name', type=click.STRING, help='Summary table n... |
from django import template
register = template.Library()
@register.filter
def is_bbb_mod(room, user):
return room.is_moderator(user)
| [
"django.template.Library"
] | [((40, 58), 'django.template.Library', 'template.Library', ([], {}), '()\n', (56, 58), False, 'from django import template\n')] |
# -*- coding: utf-8 -*-
import scinum as sn
import numpy as np
def create_config(base_cfg):
# setup the config for 2018 data
from analysis.config.campaign_UltraLegacy18 import campaign as campaign_UltraLegacy18
from analysis.config.jet_tagging_sf import ch_ee, ch_emu, ch_mumu, ch_e, ch_mu
cfg = base_c... | [
"analysis.config.campaign_UltraLegacy18.campaign.get_dataset",
"scinum.Number"
] | [((1151, 1199), 'analysis.config.campaign_UltraLegacy18.campaign.get_dataset', 'campaign_UltraLegacy18.get_dataset', (['dataset_name'], {}), '(dataset_name)\n', (1185, 1199), True, 'from analysis.config.campaign_UltraLegacy18 import campaign as campaign_UltraLegacy18\n'), ((7288, 7327), 'scinum.Number', 'sn.Number', ([... |
#!/usr/bin/evn python
# jojo_xia
import os
import re
import socket
from urllib import request
from urllib.error import ContentTooShortError
import apk_info
import data_utils
import file_utils
socket.setdefaulttimeout(30)
class qihu:
def __init__(self):
self.url_list = []
self.apk_list = []
... | [
"os.path.exists",
"os.path.getsize",
"os.makedirs",
"urllib.request.urlretrieve",
"re.compile",
"data_utils.parse_cfg",
"file_utils.gen_file_md5",
"os.path.join",
"apk_info.get_apk_info",
"urllib.request.urlcleanup",
"os.path.isfile",
"re.findall",
"urllib.request.urlopen",
"socket.setdefa... | [((194, 222), 'socket.setdefaulttimeout', 'socket.setdefaulttimeout', (['(30)'], {}), '(30)\n', (218, 222), False, 'import socket\n'), ((367, 418), 'data_utils.parse_cfg', 'data_utils.parse_cfg', (['"""download"""', '"""path"""', '"""../apks"""'], {}), "('download', 'path', '../apks')\n", (387, 418), False, 'import dat... |
import subprocess
import time
import socket
import os
import smtplib
class CyberCPLogFileWriter:
fileName = "/home/cyberpanel/error-logs.txt"
@staticmethod
def SendEmail(sender, receivers, message, subject=None, type=None):
try:
smtpPath = '/home/cyberpanel/smtpDetails'
if... | [
"os.path.exists",
"smtplib.SMTP",
"socket.gethostname",
"time.strftime"
] | [((321, 345), 'os.path.exists', 'os.path.exists', (['smtpPath'], {}), '(smtpPath)\n', (335, 345), False, 'import os\n'), ((1051, 1076), 'smtplib.SMTP', 'smtplib.SMTP', (['"""localhost"""'], {}), "('localhost')\n", (1063, 1076), False, 'import smtplib\n'), ((1623, 1648), 'os.path.exists', 'os.path.exists', (['emailPath'... |
#!/usr/bin/env python
"""Module for global fitting titrations (pH and cl) on 2 datasets
"""
import os
import sys
import argparse
import numpy as np
from lmfit import Parameters, Minimizer, minimize, conf_interval, report_fit
import pandas as pd
import matplotlib.pyplot as plt
# from scipy import optimize
def ci_repo... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"lmfit.Minimizer",
"argparse.ArgumentParser",
"pandas.read_csv",
"lmfit.conf_interval",
"os.makedirs",
"matplotlib.pyplot.plot",
"os.path.split",
"seaborn.set_style",
"numpy.random.randint",
"os.path.isdir",
"lmfit.report_fit",
"sys.ex... | [((1986, 2034), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (2009, 2034), False, 'import argparse\n'), ((2861, 2883), 'pandas.read_csv', 'pd.read_csv', (['args.file'], {}), '(args.file)\n', (2872, 2883), True, 'import pandas as pd\n'), ((298... |
import os
import sys
import neuron
import json
from pprint import pprint
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
import h5py
## Runs the 5 cell iclamp simulation but in NEURON for each individual cell
# $ python pure_nrn.py <gid>
neuron.load_mechanisms('../components/mechanisms')
h.loa... | [
"neuron.h.startsw",
"neuron.h",
"neuron.h.run",
"neuron.h.Import3d_GUI",
"os.path.join",
"neuron.h.define_shape",
"matplotlib.pyplot.plot",
"h5py.File",
"neuron.h.Import3d_SWC_read",
"neuron.h.load_file",
"neuron.h.allsec",
"neuron.h.delete_section",
"neuron.load_mechanisms",
"neuron.h.std... | [((264, 314), 'neuron.load_mechanisms', 'neuron.load_mechanisms', (['"""../components/mechanisms"""'], {}), "('../components/mechanisms')\n", (286, 314), False, 'import neuron\n'), ((315, 340), 'neuron.h.load_file', 'h.load_file', (['"""stdgui.hoc"""'], {}), "('stdgui.hoc')\n", (326, 340), False, 'from neuron import h\... |
# Recipe creation tool - create command build system handlers
#
# Copyright (C) 2014 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed... | [
"logging.getLogger",
"recipetool.create.RecipeHandler.checkfiles",
"recipetool.create.read_pkgconfig_provides",
"re.compile"
] | [((850, 881), 'logging.getLogger', 'logging.getLogger', (['"""recipetool"""'], {}), "('recipetool')\n", (867, 881), False, 'import logging\n'), ((1162, 1215), 'recipetool.create.RecipeHandler.checkfiles', 'RecipeHandler.checkfiles', (['srctree', "['CMakeLists.txt']"], {}), "(srctree, ['CMakeLists.txt'])\n", (1186, 1215... |
import unittest
import sys
import os
sys.path.append('../')
from src.class_query import ClassQuery
from src.query_tool import QueryTool, Mode
base_path = os.path.dirname(__file__)
cq = ClassQuery(base_path + '/sample_queries/class_queries.xml')
class TestClassQuery(unittest.TestCase):
def test_class_cluster(self... | [
"os.path.dirname",
"src.class_query.ClassQuery",
"sys.path.append",
"src.query_tool.QueryTool"
] | [((37, 59), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (52, 59), False, 'import sys\n'), ((155, 180), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (170, 180), False, 'import os\n'), ((186, 245), 'src.class_query.ClassQuery', 'ClassQuery', (["(base_path + '/sampl... |
import init_file as variables
import cj_function_lib as cj
from datetime import datetime
fert_table = cj.extract_table_from_mdb(variables.QSWAT_MDB, "fert", variables.path + "\\fert.tmp~")
fert = ""
for fert_line in fert_table:
fert += cj.trailing_spaces(4, fert_line.split(",")[1], 0) + cj.string_trailing_spaces... | [
"cj_function_lib.write_to",
"cj_function_lib.extract_table_from_mdb"
] | [((103, 193), 'cj_function_lib.extract_table_from_mdb', 'cj.extract_table_from_mdb', (['variables.QSWAT_MDB', '"""fert"""', "(variables.path + '\\\\fert.tmp~')"], {}), "(variables.QSWAT_MDB, 'fert', variables.path +\n '\\\\fert.tmp~')\n", (128, 193), True, 'import cj_function_lib as cj\n'), ((813, 881), 'cj_function... |
from scrapy.item import Field, Item
# pylint: disable-msg=too-many-ancestors
class FundItem(Item):
code = Field()
name = Field()
tier = Field()
start_date = Field()
date = Field()
price = Field()
| [
"scrapy.item.Field"
] | [((111, 118), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (116, 118), False, 'from scrapy.item import Field, Item\n'), ((130, 137), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (135, 137), False, 'from scrapy.item import Field, Item\n'), ((149, 156), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (154, 156), Fa... |
__author__ = 'dimd'
from zope.interface import Interface, Attribute
class IProtocolStogareInterface(Interface):
"""
This interface define our session storage
Every custom storage have to implement this Interface
"""
session = Attribute(""" Container for our session """) | [
"zope.interface.Attribute"
] | [((252, 292), 'zope.interface.Attribute', 'Attribute', (['""" Container for our session """'], {}), "(' Container for our session ')\n", (261, 292), False, 'from zope.interface import Interface, Attribute\n')] |
#!/usr/bin/env python
from __future__ import division
import numpy as np
from lfd.environment.simulation import DynamicSimulationRobotWorld
from lfd.environment.simulation_object import XmlSimulationObject, BoxSimulationObject
from lfd.environment import environment
from lfd.environment import sim_util
from lfd.demo... | [
"move_rope.create_rope",
"lfd.environment.environment.LfdEnvironment",
"move_rope.create_augmented_traj",
"lfd.transfer.registration_transfer.TwoStepRegistrationAndTrajectoryTransferer",
"lfd.environment.sim_util.reset_arms_to_side",
"lfd.registration.registration.TpsRpmRegistrationFactory",
"lfd.enviro... | [((767, 789), 'move_rope.create_rope', 'create_rope', (['rope_poss'], {}), '(rope_poss)\n', (778, 789), False, 'from move_rope import create_augmented_traj, create_rope\n'), ((1098, 1142), 'numpy.array', 'np.array', (['[[0, 0, 1], [0, 1, 0], [-1, 0, 0]]'], {}), '([[0, 0, 1], [0, 1, 0], [-1, 0, 0]])\n', (1106, 1142), Tr... |
import csv
import os.path
import random
import numpy as np
import scipy.io
import torch
import torchvision
from torch.utils.data import Dataset
# from .util import *
from data.util import default_loader, read_img, augment, get_image_paths
class PIPALFolder(Dataset):
def __init__(self, root=None, ... | [
"data.util.augment",
"numpy.array",
"torchvision.transforms.Normalize",
"data.util.read_img",
"numpy.transpose"
] | [((1538, 1630), 'torchvision.transforms.Normalize', 'torchvision.transforms.Normalize', ([], {'mean': '[0.485, 0.456, 0.406]', 'std': '[0.229, 0.224, 0.225]'}), '(mean=[0.485, 0.456, 0.406], std=[0.229, \n 0.224, 0.225])\n', (1570, 1630), False, 'import torchvision\n'), ((1956, 1988), 'data.util.read_img', 'read_img... |
import unittest
from Familytree.individual import Person
from Familytree import variables
class Testperson(unittest.TestCase):
def setUp(self):
self.person = Person(1, "Jane", "Female")
def test_initialization(self):
# check instance
self.assertEqual(isinstance(self.person, Person), ... | [
"unittest.main",
"Familytree.individual.Person"
] | [((3058, 3073), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3071, 3073), False, 'import unittest\n'), ((173, 200), 'Familytree.individual.Person', 'Person', (['(1)', '"""Jane"""', '"""Female"""'], {}), "(1, 'Jane', 'Female')\n", (179, 200), False, 'from Familytree.individual import Person\n'), ((818, 850), 'Fa... |
import codecs
import collections
import io
import os
import re
import struct
from .instruction import Instruction
from .opcode import Opcodes
from .registers import Registers
from .section import Section
from .symbol import Symbol
def p32(v):
return struct.pack('<I', v)
def unescape_str_to_bytes(x):
return c... | [
"collections.OrderedDict",
"io.BytesIO",
"struct.pack",
"os.path.dirname",
"io.StringIO"
] | [((256, 276), 'struct.pack', 'struct.pack', (['"""<I"""', 'v'], {}), "('<I', v)\n", (267, 276), False, 'import struct\n'), ((1095, 1120), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1118, 1120), False, 'import collections\n'), ((976, 992), 'io.StringIO', 'io.StringIO', (['fin'], {}), '(fin)... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appli... | [
"nemo.utils.logging.info",
"collections.OrderedDict",
"argparse.ArgumentParser",
"torch.LongTensor",
"omegaconf.OmegaConf.load",
"faiss.read_index",
"nemo.utils.logging.warning",
"os.path.isfile",
"torch.cuda.is_available",
"build_index.load_model"
] | [((3169, 3182), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3180, 3182), False, 'from collections import OrderedDict\n'), ((4511, 4563), 'nemo.utils.logging.info', 'logging.info', (['"""Loading entity linking encoder model"""'], {}), "('Loading entity linking encoder model')\n", (4523, 4563), False, 'f... |
"""
test_Payload.py
Copyright 2012 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that it wil... | [
"w3af.plugins.attack.payloads.payloads.tests.test_payload_handler.FakeExecShell",
"mock.MagicMock",
"w3af.plugins.attack.payloads.payloads.tests.test_payload_handler.FakeReadShell"
] | [((1724, 1739), 'w3af.plugins.attack.payloads.payloads.tests.test_payload_handler.FakeExecShell', 'FakeExecShell', ([], {}), '()\n', (1737, 1739), False, 'from w3af.plugins.attack.payloads.payloads.tests.test_payload_handler import FakeReadShell, FakeExecShell\n'), ((1764, 1790), 'mock.MagicMock', 'MagicMock', ([], {'r... |
import moeda
p = float(input('Digite o preço: '))
t = int(input('Qual o valor da taxa? '))
moeda.resumo(p, t)
| [
"moeda.resumo"
] | [((92, 110), 'moeda.resumo', 'moeda.resumo', (['p', 't'], {}), '(p, t)\n', (104, 110), False, 'import moeda\n')] |
#!/usr/bin/env python
r'''
https://www.hackerrank.com/challenges/journey-to-the-moon/problem
'''
import math
import os
import random
import re
import sys
class Node:
def __init__(self, v):
self.v = v
self.neighbors = set()
self.visit = False
def addN(self, n):
if n not in sel... | [
"collections.deque"
] | [((737, 744), 'collections.deque', 'deque', ([], {}), '()\n', (742, 744), False, 'from collections import deque\n')] |
import pytest
import numpy as np
import pandas as pd
from SPARTACUS10 import spatial_silhouette as spasi
import sklearn.metrics as metrics
import os
def find_path(name, path = None):
if path is None:
path = os.getcwd()
for root, dirs, files in os.walk(path):
if name in files:
... | [
"numpy.random.normal",
"numpy.isclose",
"SPARTACUS10.spatial_silhouette.simplified_silhouette_coefficient_spatial",
"numpy.round",
"os.path.join",
"SPARTACUS10.spatial_silhouette.silhouette_coefficient_spatial",
"os.getcwd",
"numpy.array",
"numpy.random.randint",
"SPARTACUS10.spatial_silhouette.ge... | [((268, 281), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (275, 281), False, 'import os\n'), ((1207, 1237), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(10, V)'}), '(size=(10, V))\n', (1223, 1237), True, 'import numpy as np\n'), ((1882, 1958), 'SPARTACUS10.spatial_silhouette.silhouette_coefficient',... |
# Standard
import os
import platform
# Pip
import typer
import yaml
from PIL import Image
from PyPDF2 import PdfFileReader, PdfFileWriter
from yaml.scanner import ScannerError
from yaml.loader import SafeLoader
# Custom
from auxiliary.message_keys import MessageKeys as mk
from auxiliary.file_explorer import FileExplo... | [
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"os.makedirs",
"auxiliary.file_explorer.FileExplorer",
"typer.Typer",
"os.path.join",
"os.getcwd",
"yaml.load",
"os.path.splitext",
"platform.system",
"typer.echo",
"PyPDF2.PdfFileWriter",
"PyPDF2.PdfFileReader",
"typer.Argument"
] | [((343, 356), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (354, 356), False, 'import typer\n'), ((380, 391), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (389, 391), False, 'import os\n'), ((400, 434), 'auxiliary.file_explorer.FileExplorer', 'FileExplorer', ([], {'home_dir': 'current_dir'}), '(home_dir=current_dir)\... |
from django.shortcuts import render
from django.views import View, generic
from .services.predictor import get_results
class Index(View):
template_name = 'predictions/index.html'
model = 'xgboost'
season = '16/17'
results = ''
leadboard = ''
def get(self, request):
self.results = get_r... | [
"django.shortcuts.render"
] | [((419, 514), 'django.shortcuts.render', 'render', (['request', 'self.template_name', "{'results': self.results, 'leadboard': self.leadboard}"], {}), "(request, self.template_name, {'results': self.results, 'leadboard':\n self.leadboard})\n", (425, 514), False, 'from django.shortcuts import render\n'), ((744, 839), ... |
import numpy as np
import pandas as pd
import pickle as pk
import random
from sklearn.metrics import accuracy_score
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import Imputer
def read_csv(csv_path):
df = pd.read_csv(csv_path)
return df
d... | [
"sklearn.preprocessing.LabelEncoder",
"pickle.dump",
"pandas.read_csv",
"numpy.where",
"numpy.delete",
"pickle.load",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.metrics.accuracy_score"
] | [((281, 302), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (292, 302), True, 'import pandas as pd\n'), ((349, 377), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (375, 377), False, 'from sklearn import preprocessing\n'), ((2115, 2143), 'sklearn.preprocess... |
from decimal import Decimal
import simplejson as json
import requests
from .converter import RatesNotAvailableError, DecimalFloatMismatchError
class BtcConverter(object):
"""
Get bit coin rates and convertion
"""
def __init__(self, force_decimal=False):
self._force_decimal = force_decimal
... | [
"decimal.Decimal",
"simplejson.loads",
"requests.get"
] | [((821, 838), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (833, 838), False, 'import requests\n'), ((1550, 1567), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1562, 1567), False, 'import requests\n'), ((2339, 2356), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2351, 2356), Fals... |
# iPhone Manager bot by Oldmole
# No support will be provided, this code is provided "as is" without warranty of any kind, either express or implied. Use at your own risk.
# The use of the software and scripts is done at your own discretion and risk and with agreement that you will be solely responsible for any damage
... | [
"math.ceil",
"sqlite3.connect",
"asyncio.sleep",
"discord.Game",
"subprocess.run",
"psutil.process_iter",
"psutil.Process",
"time.sleep",
"yaml.safe_load",
"sys.exit",
"discord.Client",
"discord.File"
] | [((10214, 10230), 'discord.Client', 'discord.Client', ([], {}), '()\n', (10228, 10230), False, 'import discord\n'), ((10281, 10316), 'discord.Game', 'discord.Game', ([], {'name': '"""Taking Selfies"""'}), "(name='Taking Selfies')\n", (10293, 10316), False, 'import discord\n'), ((2040, 2060), 'yaml.safe_load', 'yaml.saf... |
# Generated by Django 3.1.7 on 2021-03-09 16:24
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Material',
fields=[
('id', models.AutoField... | [
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((304, 397), '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", (320, 397), False, 'from django.db import migrations, models\... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((1012, 1069), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (1043, 1069), False, 'from django.db import migrations, models\n'), ((1206, 1299), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '... |
import re
from dataclasses import dataclass
from collections import defaultdict
from itertools import cycle
@dataclass
class Line:
x1: int
y1: int
x2: int
y2: int
def all_points(self):
stepx = 1 if self.x1 < self.x2 else -1
stepy = 1 if self.y1 < self.y2 else -1
if self.x1... | [
"itertools.cycle",
"collections.defaultdict",
"re.match"
] | [((927, 943), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (938, 943), False, 'from collections import defaultdict\n'), ((785, 833), 're.match', 're.match', (['"""(\\\\d+),(\\\\d+) -> (\\\\d+),(\\\\d+)"""', 'line'], {}), "('(\\\\d+),(\\\\d+) -> (\\\\d+),(\\\\d+)', line)\n", (793, 833), False, 'im... |
# Generated by Django 3.0.7 on 2020-12-20 15:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('academica', '0002_auto_20201220_0117'),
]
operations = [
migrations.RemoveField(
model_name='clase',
name='nivel',
)... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((229, 285), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""clase"""', 'name': '"""nivel"""'}), "(model_name='clase', name='nivel')\n", (251, 285), False, 'from django.db import migrations\n'), ((330, 395), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'mode... |
from event.models import Event
from talk.models import Talk
def committee_member_context_processor(request):
if request.user.is_authenticated:
return {
"is_committee_member": request.user.has_perms(
("talk.add_vote", "talk.add_talkcomment")
)
}
else:
... | [
"talk.models.Talk.objects.filter",
"event.models.Event.objects.current_event"
] | [((421, 450), 'event.models.Event.objects.current_event', 'Event.objects.current_event', ([], {}), '()\n', (448, 450), False, 'from event.models import Event\n'), ((563, 629), 'talk.models.Talk.objects.filter', 'Talk.objects.filter', ([], {'event': 'event', 'track__isnull': '(False)', 'spots__gt': '(0)'}), '(event=even... |
import code.PdfReader as PdfReaderModule
import code.ExcelReader as ExcelReader
import code.TemplateParser as TemplateParser
import code.PdfAnalyzer as PdfAnalyzer
import code.EmailSender as EmailSender
def getFileContent(fileName):
read_data = ""
with open(fileName, encoding="utf-8") as f:
read_data =... | [
"code.PdfAnalyzer.PdfAnalyzer",
"code.ExcelReader.ExcelReader",
"code.EmailSender.EmailSender",
"code.TemplateParser.TemplateParser",
"code.PdfReader.PdfReader"
] | [((686, 711), 'code.ExcelReader.ExcelReader', 'ExcelReader.ExcelReader', ([], {}), '()\n', (709, 711), True, 'import code.ExcelReader as ExcelReader\n'), ((848, 875), 'code.PdfReader.PdfReader', 'PdfReaderModule.PdfReader', ([], {}), '()\n', (873, 875), True, 'import code.PdfReader as PdfReaderModule\n'), ((996, 1047),... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import textwrap
import time
import bs4
from django.core.urlresolvers import get_resolver
from django.http import HttpResponse
from django.http import HttpResponseBadRequest
from django.http i... | [
"django.http.HttpResponseRedirect",
"os.path.exists",
"django.http.HttpResponseBadRequest",
"textwrap.shorten",
"django.http.JsonResponse",
"django.http.HttpResponse",
"django.core.urlresolvers.get_resolver",
"bs4.BeautifulSoup",
"django.http.HttpResponseServerError",
"kolibri.core.content.utils.p... | [((7576, 7594), 'django.core.urlresolvers.get_resolver', 'get_resolver', (['None'], {}), '(None)\n', (7588, 7594), False, 'from django.core.urlresolvers import get_resolver\n'), ((7833, 7868), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['html_str', '"""lxml"""'], {}), "(html_str, 'lxml')\n", (7850, 7868), False, 'impor... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 22 21:44:55 2017
@author: Mike
"""
import numpy as np
import cv2
import glob
import pickle
import matplotlib.pyplot as plt
from matplotlib.pyplot import *
import os
from scipy import stats
from moviepy.editor import VideoFileClip
from IPython.display im... | [
"cv2.rectangle",
"numpy.polyfit",
"numpy.hstack",
"numpy.array",
"cv2.warpPerspective",
"sobel_library.abs_sobel_image",
"cv2.destroyAllWindows",
"cv2.calibrateCamera",
"camera_calibration.calibrate_camera",
"numpy.arange",
"numpy.mean",
"os.listdir",
"collections.deque",
"camera_calibrati... | [((2065, 2089), 'collections.deque', 'deque', ([], {'maxlen': 'deque_size'}), '(maxlen=deque_size)\n', (2070, 2089), False, 'from collections import deque\n'), ((2133, 2157), 'collections.deque', 'deque', ([], {'maxlen': 'deque_size'}), '(maxlen=deque_size)\n', (2138, 2157), False, 'from collections import deque\n'), (... |
"""
homeassistant.components.light.insteon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Insteon Hub lights.
"""
from homeassistant.components.insteon_hub import INSTEON, InsteonToggleDevice
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Insteon Hub light platform. """
... | [
"homeassistant.components.insteon_hub.InsteonToggleDevice"
] | [((455, 482), 'homeassistant.components.insteon_hub.InsteonToggleDevice', 'InsteonToggleDevice', (['device'], {}), '(device)\n', (474, 482), False, 'from homeassistant.components.insteon_hub import INSTEON, InsteonToggleDevice\n'), ((573, 600), 'homeassistant.components.insteon_hub.InsteonToggleDevice', 'InsteonToggleD... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
pio.templates.default = "simple_white"
SAMPLES_NUM = 1000
LEFT_CIRCLE = '('
RIGHT_CIRCLE = ')'
COMMA = ', '
GRAPH_SIZE = 500
HEATMAP_SIZE = 700
def test_univariate_gaussi... | [
"numpy.random.normal",
"numpy.transpose",
"plotly.graph_objects.Layout",
"numpy.random.multivariate_normal",
"numpy.asarray",
"numpy.argmax",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"plotly.graph_objects.Scatter",
"numpy.random.seed",
"IMLearn.learners.UnivariateGaussian",
"IMLearn.l... | [((392, 412), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (410, 412), False, 'from IMLearn.learners import UnivariateGaussian, MultivariateGaussian\n'), ((443, 483), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma', 'SAMPLES_NUM'], {}), '(mu, sigma, SAMPLES_NUM)\n', (459, 48... |
results = open('test-results-gpu.out', 'a')
results.write('** Starting serial GPU tests **\n')
try:
# Fresnel
#import fresnel
#results.write('Fresnel version : {}\n'.format(fresnel.__version__))
#dev = fresnel.Device(mode='gpu', n=1)
#results.write('Fresnel device : {}\n'.format(dev))
# H... | [
"hoomd.context.initialize",
"hoomd._hoomd.hoomd_compile_flags"
] | [((356, 394), 'hoomd.context.initialize', 'hoomd.context.initialize', (['"""--mode=gpu"""'], {}), "('--mode=gpu')\n", (380, 394), False, 'import hoomd\n'), ((548, 582), 'hoomd._hoomd.hoomd_compile_flags', 'hoomd._hoomd.hoomd_compile_flags', ([], {}), '()\n', (580, 582), False, 'import hoomd\n')] |
from django.utils.translation import ugettext_lazy as _
from mayan.apps.authentication.link_conditions import condition_user_is_authenticated
from mayan.apps.navigation.classes import Link, Separator, Text
from mayan.apps.navigation.utils import factory_condition_queryset_access
from .icons import (
icon_current_... | [
"mayan.apps.navigation.classes.Separator",
"mayan.apps.navigation.utils.factory_condition_queryset_access",
"django.utils.translation.ugettext_lazy",
"mayan.apps.navigation.classes.Text"
] | [((4680, 4691), 'mayan.apps.navigation.classes.Separator', 'Separator', ([], {}), '()\n', (4689, 4691), False, 'from mayan.apps.navigation.classes import Link, Separator, Text\n'), ((4711, 4778), 'mayan.apps.navigation.classes.Text', 'Text', ([], {'html_extra_classes': '"""menu-user-name"""', 'text': 'get_user_label_te... |
from django.utils.translation import gettext_lazy as _, gettext
from .utils import get_main_menu_item, APPS
ENTITIES = {
'apart': ('apart', 'apartment'),
'meter': ('meters data', 'execute'),
'bill': ('bill', 'cost'),
'service': ('service', 'key'),
'price': ('tari... | [
"django.utils.translation.gettext_lazy"
] | [((3184, 3211), 'django.utils.translation.gettext_lazy', '_', (['ENTITIES[self.entity][0]'], {}), '(ENTITIES[self.entity][0])\n', (3185, 3211), True, 'from django.utils.translation import gettext_lazy as _, gettext\n')] |
'''Refaça o DESAFIO 9, mostrando a tabuada de um número que o usuário escolher,
só que agora utilizando um laço for.'''
#RESOLUÇÃO ALAN
'''mult = int(input(' Digite um número para ver sua tabuada: '))
for num in range(1, 11):
rest = num * mult
print('{} X {} = {} '. format(num, mult, rest))'''
#RESOLUÇÃO PROF... | [
"time.sleep"
] | [((437, 445), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (442, 445), False, 'from time import sleep\n'), ((532, 540), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (537, 540), False, 'from time import sleep\n'), ((523, 531), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (528, 531), False, 'from time import sleep\... |
from django.utils.formats import localize
from rest_framework.serializers import (
ModelSerializer,
HyperlinkedIdentityField,
SerializerMethodField,
ValidationError,
)
from rest_framework import serializers
from django.contrib.auth import ... | [
"structlog.get_logger",
"django.contrib.auth.get_user_model",
"rest_framework.serializers.SerializerMethodField",
"django.utils.formats.localize",
"rest_framework.serializers.HyperlinkedIdentityField"
] | [((484, 504), 'structlog.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'from structlog import get_logger\n'), ((513, 529), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (527, 529), False, 'from django.contrib.auth import get_user_model\n'), ((604, 627), 'r... |
import inspect
try:
from unittest import mock
except ImportError:
import mock
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver, WebElement
from selenium.common.exceptions import NoSuchElementException
from page_objects import PageObject, Pag... | [
"page_objects.PageElement",
"mock.Mock",
"pytest.raises",
"pytest.fixture",
"mock.call",
"page_objects.MultiPageElement"
] | [((350, 366), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (364, 366), False, 'import pytest\n'), ((395, 420), 'mock.Mock', 'mock.Mock', ([], {'spec': 'WebDriver'}), '(spec=WebDriver)\n', (404, 420), False, 'import mock\n'), ((495, 517), 'page_objects.PageElement', 'PageElement', ([], {'css': '"""foo"""'}), "(... |
import copy
import struct
class PointerTable:
END_OF_DATA = (0xff, )
"""
Class to manage a list of pointers to data objects
Can rewrite the rom to modify the data objects and still keep the pointers intact.
"""
def __init__(self, rom, info):
assert "count" in info
... | [
"struct.unpack",
"copy.deepcopy"
] | [((2586, 2615), 'copy.deepcopy', 'copy.deepcopy', (['self.__storage'], {}), '(self.__storage)\n', (2599, 2615), False, 'import copy\n'), ((975, 1045), 'struct.unpack', 'struct.unpack', (["('<' + 'H' * count)", 'pointers_bank[addr:addr + count * 2]'], {}), "('<' + 'H' * count, pointers_bank[addr:addr + count * 2])\n", (... |
#Telegram @javes05
import spamwatch, os, asyncio
from telethon import events
from userbot import client as javes, JAVES_NAME, JAVES_MSG
JAVES_NNAME = str(JAVES_NAME) if JAVES_NAME else str(JAVES_MSG)
swapi = os.environ.get("SPAMWATCH_API_KEY", None)
SPAM_PROTECT = os.environ.get("SPAM_PROTECT", None)
SPAMWATCH_SHOUT... | [
"userbot.client.on",
"os.environ.get",
"spamwatch.Client",
"userbot.client.edit_permissions"
] | [((211, 252), 'os.environ.get', 'os.environ.get', (['"""SPAMWATCH_API_KEY"""', 'None'], {}), "('SPAMWATCH_API_KEY', None)\n", (225, 252), False, 'import spamwatch, os, asyncio\n'), ((268, 304), 'os.environ.get', 'os.environ.get', (['"""SPAM_PROTECT"""', 'None'], {}), "('SPAM_PROTECT', None)\n", (282, 304), False, 'impo... |
import json
from urllib import parse, request
from telegram.ext import CallbackContext, CommandHandler
from telegram.update import Update
from autonomia.core import bot_handler
BASE_URL = "https://query.yahooapis.com/v1/public/yql?"
def _get_weather_info(location):
query = (
"select * from weather.fore... | [
"urllib.parse.urlencode",
"telegram.ext.CommandHandler",
"urllib.request.urlopen"
] | [((1318, 1372), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""weather"""', 'cmd_weather'], {'pass_args': '(True)'}), "('weather', cmd_weather, pass_args=True)\n", (1332, 1372), False, 'from telegram.ext import CallbackContext, CommandHandler\n'), ((456, 485), 'urllib.parse.urlencode', 'parse.urlencode', (["{'q... |
"""Mock hardware implementation"""
import logging
from stage import exceptions
from unittest.mock import Mock
LOGGER = logging.getLogger("mock")
class MockStage:
"""A mock implemenation of a stepper motor driven linear stage"""
MAX_POS = 100
MIN_POS = 0
def __init__(self):
self._position = _... | [
"logging.getLogger",
"unittest.mock.Mock"
] | [((121, 146), 'logging.getLogger', 'logging.getLogger', (['"""mock"""'], {}), "('mock')\n", (138, 146), False, 'import logging\n'), ((1469, 1475), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (1473, 1475), False, 'from unittest.mock import Mock\n')] |
from compmech.stiffpanelbay import StiffPanelBay
spb = StiffPanelBay()
spb.a = 2.
spb.b = 1.
spb.r = 2.
spb.stack = [0, 90, 90, 0, -45, +45]
spb.plyt = 1e-3*0.125
spb.laminaprop = (142.5e9, 8.7e9, 0.28, 5.1e9, 5.1e9, 5.1e9)
spb.model = 'cpanel_clt_donnell_bardell'
spb.m = 15
spb.n = 16
spb.u1tx = 0.
spb.u1rx = 1.
spb... | [
"compmech.stiffpanelbay.StiffPanelBay"
] | [((56, 71), 'compmech.stiffpanelbay.StiffPanelBay', 'StiffPanelBay', ([], {}), '()\n', (69, 71), False, 'from compmech.stiffpanelbay import StiffPanelBay\n')] |
"""
<Program Name>
common.py
<Author>
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
<Started>
Sep 23, 2016
<Copyright>
See LICENSE for licensing information.
<Purpose>
Provides base classes for various classes in the model.
<Classes>
Metablock:
pretty printed canonical JSON representation and dump
Signa... | [
"attr.s",
"attr.asdict",
"canonicaljson.encode_pretty_printed_json",
"attr.ib"
] | [((578, 596), 'attr.s', 'attr.s', ([], {'repr': '(False)'}), '(repr=False)\n', (584, 596), False, 'import attr\n'), ((968, 986), 'attr.s', 'attr.s', ([], {'repr': '(False)'}), '(repr=False)\n', (974, 986), False, 'import attr\n'), ((2299, 2328), 'attr.s', 'attr.s', ([], {'repr': '(False)', 'cmp': '(False)'}), '(repr=Fa... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class Application:
def __init__(self):
self.wd = webdriver.Chrome(executable_path='/Users/atvelova/Documents/python_training/chromedriver')
self.wd.implicitly_wait(60)
d... | [
"selenium.webdriver.Chrome"
] | [((187, 282), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""/Users/atvelova/Documents/python_training/chromedriver"""'}), "(executable_path=\n '/Users/atvelova/Documents/python_training/chromedriver')\n", (203, 282), False, 'from selenium import webdriver\n')] |
# Copyright 2017-2020 TensorHub, Inc.
#
# 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 writ... | [
"logging.getLogger",
"guild.resource.for_name",
"guild.resolver.for_resdef_source",
"os.path.exists",
"os.path.lexists",
"guild.util.realpath",
"os.path.split",
"os.path.relpath",
"os.path.isabs",
"guild.util.strip_trailing_sep",
"re.match",
"os.path.dirname",
"guild.util.resolve_refs",
"r... | [((816, 842), 'logging.getLogger', 'logging.getLogger', (['"""guild"""'], {}), "('guild')\n", (833, 842), False, 'import logging\n'), ((4232, 4251), 'os.path.isabs', 'os.path.isabs', (['link'], {}), '(link)\n', (4245, 4251), False, 'import os\n'), ((4559, 4594), 'guild.util.symlink', 'util.symlink', (['rel_source_path'... |
r"""Provides functions used by strategies that use a tree to select the
permutation.
To compute optimal permutations, we use the belief states
.. math::
b(y^{k-1}) := \mathbb{P}(s_0, s_k|y^{k-1}),
where the :math:`s_k` are the states of the HMM at step :math:`k`, and the
superscript :math:`y^{k-1}` is the sequen... | [
"torch.broadcast_tensors",
"torch.broadcast_shapes",
"torch.arange",
"perm_hmm.policies.belief.HMMBeliefState.from_hmm"
] | [((4847, 4880), 'perm_hmm.policies.belief.HMMBeliefState.from_hmm', 'HMMBeliefState.from_hmm', (['self.hmm'], {}), '(self.hmm)\n', (4870, 4880), False, 'from perm_hmm.policies.belief import HMMBeliefState\n'), ((5686, 5740), 'torch.broadcast_shapes', 'torch.broadcast_shapes', (['(length, 1, 1)', 'b.logits.shape'], {}),... |
# All .ui files and .so files are added through keyword: package_data, because setuptools doesn't include them automatically.
import sys
import os
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = "xfntr",
version = "0.3.0",
autho... | [
"setuptools.find_packages"
] | [((581, 596), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (594, 596), False, 'from setuptools import setup, find_packages\n')] |
"""
module contains a function that polls the ukcovid api in order to find up to date
information about coronavirus in the UK
"""
import json
import logging
from uk_covid19 import Cov19API
from requests import get
logging.basicConfig(level=logging.DEBUG, filename='sys.log')
def get_covid() -> str:
"""... | [
"logging.basicConfig",
"requests.get",
"uk_covid19.Cov19API",
"json.load",
"logging.info"
] | [((227, 287), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'filename': '"""sys.log"""'}), "(level=logging.DEBUG, filename='sys.log')\n", (246, 287), False, 'import logging\n'), ((696, 781), 'uk_covid19.Cov19API', 'Cov19API', ([], {'filters': 'filters', 'structure': 'structure', 'latest_... |