code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from nose.tools import assert_equal, assert_almost_equal, assert_true, \
assert_false, assert_raises, assert_is_instance
from stats import mean, median, mode, std, var
# mean tests
def test_mean1():
obs = mean([0, 0, 0, 0])
exp = 0
assert_equal(obs, exp)
obs = mean([0, 200])
exp = 100
ass... | [
"nose.tools.assert_equal",
"stats.median",
"stats.mean",
"stats.std"
] | [((215, 233), 'stats.mean', 'mean', (['[0, 0, 0, 0]'], {}), '([0, 0, 0, 0])\n', (219, 233), False, 'from stats import mean, median, mode, std, var\n'), ((250, 272), 'nose.tools.assert_equal', 'assert_equal', (['obs', 'exp'], {}), '(obs, exp)\n', (262, 272), False, 'from nose.tools import assert_equal, assert_almost_equ... |
# -*- coding: utf-8 -*-
"""
@FileName : data_conversion.py
@Description : 数据转换
@Author : 齐鲁桐
@Email : <EMAIL>
@Time : 2019-05-07 11:13
@Modify : None
"""
from __future__ import absolute_import, division, print_function
import os
import fairy.tail as ft
from .data_base import open_image
de... | [
"fairy.tail.check_sep",
"fairy.tail.check_dir",
"os.path.dirname",
"os.path.basename"
] | [((880, 902), 'fairy.tail.check_sep', 'ft.check_sep', (['new_path'], {}), '(new_path)\n', (892, 902), True, 'import fairy.tail as ft\n'), ((911, 933), 'fairy.tail.check_dir', 'ft.check_dir', (['new_path'], {}), '(new_path)\n', (923, 933), True, 'import fairy.tail as ft\n'), ((812, 837), 'os.path.dirname', 'os.path.dirn... |
'''This module provides test helpers for Figures view tests
'''
from __future__ import absolute_import
from tests.factories import UserFactory
from tests.helpers import organizations_support_sites
if organizations_support_sites():
from tests.factories import UserOrganizationMappingFactory
def create_test_use... | [
"tests.factories.UserOrganizationMappingFactory",
"tests.factories.UserFactory",
"tests.helpers.organizations_support_sites"
] | [((205, 234), 'tests.helpers.organizations_support_sites', 'organizations_support_sites', ([], {}), '()\n', (232, 234), False, 'from tests.helpers import organizations_support_sites\n'), ((1424, 1453), 'tests.helpers.organizations_support_sites', 'organizations_support_sites', ([], {}), '()\n', (1451, 1453), False, 'fr... |
# Python imports
import unittest
# Third party imports
import mock
from mock import patch
import pandas as pd
from pandas.util.testing import assert_frame_equal
# Project imports
from retraction import retract_deactivated_pids
from constants import bq_utils as bq_consts
from constants.cdr_cleaner import clean_cdr as ... | [
"pandas.isnull",
"mock.patch",
"retraction.retract_deactivated_pids.get_pids_table_info",
"retraction.retract_deactivated_pids.SANDBOX_QUERY_END_DATE.render",
"retraction.retract_deactivated_pids.CLEAN_QUERY_END_DATE.render",
"retraction.retract_deactivated_pids.get_date_info_for_pids_tables",
"retracti... | [((2445, 2524), 'mock.patch', 'mock.patch', (['"""retraction.retract_deactivated_pids.get_date_info_for_pids_tables"""'], {}), "('retraction.retract_deactivated_pids.get_date_info_for_pids_tables')\n", (2455, 2524), False, 'import mock\n'), ((4141, 4220), 'mock.patch', 'mock.patch', (['"""retraction.retract_deactivated... |
import logging
from openeye import oechem, oeszybki, oeomega
from torsion.utils.process_sd_data import get_sd_data, has_sd_data
from torsion.dihedral import get_dihedral
TORSION_LIBRARY = [
'[C,N,c:1][NX3:2][C:3](=[O])[C,N,c,O:4] 0 180', # amides are flipped cis and trans
'[#1:1][NX3H:2][C:3... | [
"openeye.oechem.OESetTorsion",
"torsion.utils.process_sd_data.has_sd_data",
"openeye.oeszybki.OETorsionScanOptions",
"openeye.oechem.OEIsRotor",
"openeye.oechem.OESetSDData",
"torsion.utils.process_sd_data.get_sd_data",
"openeye.oechem.OEHasAtomIdx",
"openeye.oeszybki.OETorsionScan",
"openeye.oechem... | [((1815, 1847), 'openeye.oechem.OEMatchAtom', 'oechem.OEMatchAtom', (['"""[OX2][C,c]"""'], {}), "('[OX2][C,c]')\n", (1833, 1847), False, 'from openeye import oechem, oeszybki, oeomega\n'), ((1992, 2015), 'openeye.oechem.OEBondIsInRing', 'oechem.OEBondIsInRing', ([], {}), '()\n', (2013, 2015), False, 'from openeye impor... |
# Copyright © 2020-present <NAME> <<EMAIL>>. All rights reserved.
#
# This source code is licensed under the Apache 2.0 license found
# in the LICENSE file in the root directory of this source tree.
import pytest
from sspvo.client import Client, RequestsClient
from sspvo.exceptions import BadRequest
from sspvo.mess... | [
"pytest.fixture",
"sspvo.message.CLSMessage",
"sspvo.client.Client",
"pytest.raises"
] | [((1335, 1351), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1349, 1351), False, 'import pytest\n'), ((410, 439), 'sspvo.client.Client', 'Client', (['"""OGRN"""', '"""KPP"""', '"""/api"""'], {}), "('OGRN', 'KPP', '/api')\n", (416, 439), False, 'from sspvo.client import Client, RequestsClient\n'), ((481, 510),... |
import asyncio
import hashlib
import json
import re
import ssl
import websocket
import websockets
class OKCoinWSPublic:
Ticker = None
def __init__(self, pair, verbose):
self.pair = pair
self.verbose = verbose
@asyncio.coroutine
def initialize(self):
TickerFirstRun = True
while True:
i... | [
"re.sub",
"websocket.create_connection",
"websockets.connect"
] | [((403, 435), 're.sub', 're.sub', (['"""[\\\\W_]+"""', '""""""', 'self.pair'], {}), "('[\\\\W_]+', '', self.pair)\n", (409, 435), False, 'import re\n'), ((1573, 1610), 'websocket.create_connection', 'websocket.create_connection', (['self.url'], {}), '(self.url)\n', (1600, 1610), False, 'import websocket\n'), ((2466, 25... |
from typing import Optional
import pandas as pd
from sklearn.datasets import fetch_openml
from sklearn.model_selection import train_test_split
from ..basis import (
BinaryClassificationTask,
MultiClassClassificationTask,
RegressionTask,
Task
)
class OpenMLTask(Task):
def __init__(self, openml_i... | [
"sklearn.model_selection.train_test_split",
"pandas.api.types.is_numeric_dtype",
"pandas.api.types.is_categorical_dtype",
"sklearn.datasets.fetch_openml"
] | [((781, 857), 'sklearn.datasets.fetch_openml', 'fetch_openml', ([], {'data_id': 'openml_id', 'as_frame': '(True)', 'return_X_y': '(True)', 'cache': '(False)'}), '(data_id=openml_id, as_frame=True, return_X_y=True, cache=False)\n', (793, 857), False, 'from sklearn.datasets import fetch_openml\n'), ((917, 962), 'sklearn.... |
# -*- coding: utf-8 -*-
from django.conf import settings # @Reimport
from django.contrib import messages
from .. import models
from . import import_base
from .. import utils
from django.db import transaction
class Csv_unicode_reader_ope_base(import_base.Property_ope_base, utils.Csv_unicode_reader):
pass
cla... | [
"django.db.transaction.atomic",
"django.contrib.messages.error",
"django.contrib.messages.warning",
"django.contrib.messages.info",
"django.contrib.messages.success"
] | [((3555, 3575), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (3573, 3575), False, 'from django.db import transaction\n'), ((4238, 4273), 'django.contrib.messages.warning', 'messages.warning', (['self.request', 'err'], {}), '(self.request, err)\n', (4254, 4273), False, 'from django.contrib imp... |
# Copyright 2019 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, ... | [
"tf_quant_finance.experimental.pde_v2.steppers.parabolic_equation_stepper.parabolic_equation_step",
"tf_quant_finance.experimental.pde_v2.steppers.weighted_implicit_explicit.weighted_implicit_explicit_scheme"
] | [((5866, 5908), 'tf_quant_finance.experimental.pde_v2.steppers.weighted_implicit_explicit.weighted_implicit_explicit_scheme', 'weighted_implicit_explicit_scheme', ([], {'theta': '(1)'}), '(theta=1)\n', (5899, 5908), False, 'from tf_quant_finance.experimental.pde_v2.steppers.weighted_implicit_explicit import weighted_im... |
import os
import numpy as np
from keras.models import load_model
def makePredict(arrayTest, strOutputFolder):
strModelPath = os.path.join(strOutputFolder, "model.h5")
model = load_model(strModelPath)
predictions = model.predict(arrayTest[0], batch_size=256)
predictions = (predictions > 0.5).ast... | [
"keras.models.load_model",
"os.path.join"
] | [((132, 173), 'os.path.join', 'os.path.join', (['strOutputFolder', '"""model.h5"""'], {}), "(strOutputFolder, 'model.h5')\n", (144, 173), False, 'import os\n'), ((191, 215), 'keras.models.load_model', 'load_model', (['strModelPath'], {}), '(strModelPath)\n', (201, 215), False, 'from keras.models import load_model\n')] |
"""Insteon All-Link Database.
The All-Link database contains database records that represent links to other
Insteon devices that either respond to or control the current device.
"""
import asyncio
import logging
from typing import Callable
from ..constants import ALDBStatus, ALDBVersion
from .aldb_base import ALDBBas... | [
"logging.getLogger"
] | [((487, 514), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (504, 514), False, 'import logging\n')] |
"""
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 1:
How many differ... | [
"csv.reader"
] | [((155, 168), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (165, 168), False, 'import csv\n'), ((246, 259), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (256, 259), False, 'import csv\n')] |
# data analysis
import xlrd
import pandas as pd
import numpy as np
import random as rnd
# visulization
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
# %matplotlib inline
# data processing
from sklearn import preprocessing
df1 = pd.read_excel(r'\tsdata_2.xlsx')
grouped = df1... | [
"pandas.read_csv",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"pandas.read_excel",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.suptitle"
] | [((274, 306), 'pandas.read_excel', 'pd.read_excel', (['"""\\\\tsdata_2.xlsx"""'], {}), "('\\\\tsdata_2.xlsx')\n", (287, 306), True, 'import pandas as pd\n'), ((342, 376), 'pandas.read_excel', 'pd.read_excel', (['"""\\\\numbdata_2.xlsx"""'], {}), "('\\\\numbdata_2.xlsx')\n", (355, 376), True, 'import pandas as pd\n'), (... |
import os
import math
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement, ElementTree
from xml.dom import minidom
import shutil
import cv2
def is_exist_dir(dir):
if not os.path.exists(dir):
os.makedirs(dir)
def prettify(elem):
"""Return a pretty-printed XML stri... | [
"os.path.exists",
"xml.etree.ElementTree.parse",
"os.makedirs",
"xml.etree.ElementTree.tostring",
"os.path.join",
"math.cos",
"xml.etree.ElementTree.Element",
"xml.dom.minidom.parseString",
"xml.etree.ElementTree.ElementTree",
"shutil.copyfile",
"xml.etree.ElementTree.SubElement",
"math.sin",
... | [((367, 393), 'xml.etree.ElementTree.tostring', 'ET.tostring', (['elem', '"""utf-8"""'], {}), "(elem, 'utf-8')\n", (378, 393), True, 'import xml.etree.ElementTree as ET\n'), ((409, 442), 'xml.dom.minidom.parseString', 'minidom.parseString', (['rough_string'], {}), '(rough_string)\n', (428, 442), False, 'from xml.dom im... |
from ethereum.utils import sha3, encode_hex
class EphemDB():
def __init__(self, kv=None):
self.reads = 0
self.writes = 0
self.kv = kv or {}
def get(self, k):
self.reads += 1
return self.kv.get(k, None)
def put(self, k, v):
self.writes += 1
self.kv[k... | [
"ethereum.utils.sha3"
] | [((477, 512), 'ethereum.utils.sha3', 'sha3', (['(zerohashes[0] + zerohashes[0])'], {}), '(zerohashes[0] + zerohashes[0])\n', (481, 512), False, 'from ethereum.utils import sha3, encode_hex\n'), ((1816, 1843), 'ethereum.utils.sha3', 'sha3', (['(vals[i] + vals[i + 1])'], {}), '(vals[i] + vals[i + 1])\n', (1820, 1843), Fa... |
import xlrd
import numpy as np
import xlwt
from tempfile import TemporaryFile
book = xlwt.Workbook()
sheet1 = book.add_sheet('sheet1')
data=xlrd.open_workbook(r'C:\Users\Desktop\teamE\D1_route.xlsx')
table=data.sheets()[0]
all_data=[]
row_num=table.nrows
col_num=table.ncols
all_loc=[]
for i in ran... | [
"numpy.where",
"numpy.delete",
"xlrd.open_workbook",
"numpy.array",
"numpy.min",
"tempfile.TemporaryFile",
"xlwt.Workbook"
] | [((93, 108), 'xlwt.Workbook', 'xlwt.Workbook', ([], {}), '()\n', (106, 108), False, 'import xlwt\n'), ((152, 214), 'xlrd.open_workbook', 'xlrd.open_workbook', (['"""C:\\\\Users\\\\Desktop\\\\teamE\\\\D1_route.xlsx"""'], {}), "('C:\\\\Users\\\\Desktop\\\\teamE\\\\D1_route.xlsx')\n", (170, 214), False, 'import xlrd\n'), ... |
from hashlib import md5
import posixpath
from rhcephcompose import common_koji
from rhcephcompose.build import Build
from rhcephcompose.artifacts import BinaryArtifact, SourceArtifact
from rhcephcompose.log import log
# Koji archive types that represent a Debian source package:
SOURCE_TYPES = ('tar', 'dsc')
def que... | [
"posixpath.join",
"rhcephcompose.artifacts.BinaryArtifact",
"rhcephcompose.log.log.warning",
"rhcephcompose.common_koji.get_session",
"rhcephcompose.build.Build",
"rhcephcompose.log.log.info",
"rhcephcompose.artifacts.SourceArtifact",
"rhcephcompose.common_koji.get_koji_pathinfo"
] | [((793, 825), 'rhcephcompose.common_koji.get_session', 'common_koji.get_session', (['profile'], {}), '(profile)\n', (816, 825), False, 'from rhcephcompose import common_koji\n'), ((960, 998), 'rhcephcompose.common_koji.get_koji_pathinfo', 'common_koji.get_koji_pathinfo', (['profile'], {}), '(profile)\n', (989, 998), Fa... |
#!/usr/bin/env python
# Copyright (c) 2009-2014 by Farsight Security, 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 requir... | [
"nmsg.input.open_sock",
"nmsg.print_nmsg_header"
] | [((707, 739), 'nmsg.input.open_sock', 'nmsg.input.open_sock', (['addr', 'port'], {}), '(addr, port)\n', (727, 739), False, 'import nmsg\n'), ((823, 853), 'nmsg.print_nmsg_header', 'nmsg.print_nmsg_header', (['m', 'out'], {}), '(m, out)\n', (845, 853), False, 'import nmsg\n')] |
# -*-coding:utf-8 -*-
from page_parse.taobaomm import get_image_by_uid
from db.mm_info import get_ids_by_home_flag_random, insert_mm_pic, update_seed_crawled_status
def excute_crawl_mm_info():
seed_ids = get_ids_by_home_flag_random(0, 2000)
for seed_id in seed_ids:
get_image_by_uid(seed_id.uid)
# insert_mm_pic(m... | [
"page_parse.taobaomm.get_image_by_uid",
"db.mm_info.get_ids_by_home_flag_random",
"db.mm_info.update_seed_crawled_status"
] | [((206, 242), 'db.mm_info.get_ids_by_home_flag_random', 'get_ids_by_home_flag_random', (['(0)', '(2000)'], {}), '(0, 2000)\n', (233, 242), False, 'from db.mm_info import get_ids_by_home_flag_random, insert_mm_pic, update_seed_crawled_status\n'), ((271, 300), 'page_parse.taobaomm.get_image_by_uid', 'get_image_by_uid', (... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import argparse
import gc
import math
import multiprocessing as mp
from multiprocessing import Pool
import random
import time
import os
import psutil
from dpareto.utils.mxnet_scripts import get_gpu_count
from dp... | [
"random.uniform",
"random.normalvariate",
"argparse.ArgumentParser",
"multiprocessing.set_start_method",
"os.makedirs",
"dpareto.utils.object_io.save_object",
"psutil.Process",
"time.sleep",
"multiprocessing.cpu_count",
"dpareto.utils.mxnet_scripts.get_gpu_count",
"random.expovariate",
"multip... | [((648, 688), 'multiprocessing.set_start_method', 'mp.set_start_method', (['"""spawn"""'], {'force': '(True)'}), "('spawn', force=True)\n", (667, 688), True, 'import multiprocessing as mp\n'), ((1565, 1590), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1588, 1590), False, 'import argparse\n'... |
# coding: utf8
from __future__ import print_function
from itertools import product
from nltk.tree import Tree
class ChunkTreeInformationExtractor():
def __init__(self):
self.arg = lambda chunk: ' '.join([word for word, tag in chunk.leaves()])
def extract(self, chunked_tree):
""" extracts information from chu... | [
"itertools.product"
] | [((2342, 2363), 'itertools.product', 'product', (['arg1s', 'arg2s'], {}), '(arg1s, arg2s)\n', (2349, 2363), False, 'from itertools import product\n')] |
"""Bully Algorithm."""
import time
import pickle
import thread
import socket
import select
def _send_election_messages(node):
"""Send election messages to all Node's with higher IDs than this one."""
#send election message to all higher ID processes
time.sleep(0.10)
for ID, ip_info in node._ip_table.i... | [
"select.select",
"socket.socket",
"pickle.dumps",
"time.sleep",
"pickle.loads",
"thread.start_new_thread"
] | [((264, 279), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (274, 279), False, 'import time\n'), ((660, 737), 'thread.start_new_thread', 'thread.start_new_thread', (['_send_message', "(node._node_id, IP, TCP_PORT, 'OKAY')"], {}), "(_send_message, (node._node_id, IP, TCP_PORT, 'OKAY'))\n", (683, 737), False, '... |
# Generated by Django 3.1.1 on 2021-03-02 08:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Post', '0021_auto_20210227_2216'),
]
operations = [
migrations.RenameField(
model_name='post',
old_name='image... | [
"django.db.migrations.RenameField"
] | [((236, 326), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""post"""', 'old_name': '"""image1"""', 'new_name': '"""backsideview"""'}), "(model_name='post', old_name='image1', new_name=\n 'backsideview')\n", (258, 326), False, 'from django.db import migrations\n'), ((383, 470), ... |
import pandas as pd
# data from https://archive.ics.uci.edu/ml/datasets/Computer+Hardware
df = pd.read_csv('../data/machine.data', header=None)
df.columns = [
'VENDOR', 'MODEL', 'MYCT', 'MMIN', 'MMAX',
'CACH', 'CHMIN', 'CHMAX', 'PRP', 'ERP'
]
# print(df.head())
import matplotlib.pyplot as plt
import seaborn... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.logical_not",
"sklearn.metrics.r2_score",
"numpy.arange",
"seaborn.set",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.dot",
"matplotlib.pyplot.scatter",
"numpy.abs",
"numpy.corrcoef",
"sklearn.model_selection.train_test_sp... | [((97, 145), 'pandas.read_csv', 'pd.read_csv', (['"""../data/machine.data"""'], {'header': 'None'}), "('../data/machine.data', header=None)\n", (108, 145), True, 'import pandas as pd\n'), ((328, 374), 'seaborn.set', 'sns.set', ([], {'style': '"""whitegrid"""', 'context': '"""notebook"""'}), "(style='whitegrid', context... |
from celery import Celery
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
celery = Celery(app.name)
VALENTINE_METRICS_TO_COMPUTE = {
"names": ["precision", "recall", "f1_score", "precision_at_n_percent", "recall_at_sizeof_ground_truth",
"get_spurious_results_at_sizeof_grou... | [
"celery.Celery",
"flask_cors.CORS",
"flask.Flask"
] | [((85, 100), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (90, 100), False, 'from flask import Flask\n'), ((111, 127), 'celery.Celery', 'Celery', (['app.name'], {}), '(app.name)\n', (117, 127), False, 'from celery import Celery\n'), ((783, 792), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (787, ... |
import logging
import queue
import threading
import time
from pytest import fixture
from loggingex.context import LoggingContextFilter, context
from .helpers import InitializedContextBase
class SimpleLoggingTests(InitializedContextBase):
@fixture(autouse=True)
def logging_context_of_the_test(self, request, ... | [
"logging.getLogger",
"loggingex.context.context",
"time.sleep",
"threading.get_ident",
"loggingex.context.LoggingContextFilter",
"pytest.fixture",
"threading.Thread",
"queue.Queue"
] | [((247, 268), 'pytest.fixture', 'fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (254, 268), False, 'from pytest import fixture\n'), ((412, 421), 'pytest.fixture', 'fixture', ([], {}), '()\n', (419, 421), False, 'from pytest import fixture\n'), ((525, 534), 'pytest.fixture', 'fixture', ([], {}), '()\n', (532... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy, sys
import thread, copy
import moveit_commander
from moveit_commander import RobotCommander, MoveGroupCommander, PlanningSceneInterface
from geometry_msgs.msg import PoseStamped, Pose
from moveit_msgs.msg import CollisionObject, AttachedCollisionObject, Plan... | [
"moveit_commander.roscpp_shutdown",
"rospy.init_node",
"moveit_commander.PlanningSceneInterface",
"moveit_commander.os._exit",
"moveit_commander.MoveGroupCommander",
"geometry_msgs.msg.PoseStamped",
"moveit_commander.roscpp_initialize",
"rospy.sleep"
] | [((472, 516), 'moveit_commander.roscpp_initialize', 'moveit_commander.roscpp_initialize', (['sys.argv'], {}), '(sys.argv)\n', (506, 516), False, 'import moveit_commander\n'), ((553, 599), 'rospy.init_node', 'rospy.init_node', (['"""moveit_attached_object_demo"""'], {}), "('moveit_attached_object_demo')\n", (568, 599), ... |
import unittest
from canvas_sdk.exceptions import CanvasAPIError
class TestExceptions(unittest.TestCase):
longMessage = True
def setUp(self):
self.default_api_error = CanvasAPIError()
def test_default_status_for_canvas_api_error(self):
""" Test expected default status for instance of C... | [
"canvas_sdk.exceptions.CanvasAPIError"
] | [((188, 204), 'canvas_sdk.exceptions.CanvasAPIError', 'CanvasAPIError', ([], {}), '()\n', (202, 204), False, 'from canvas_sdk.exceptions import CanvasAPIError\n'), ((1273, 1345), 'canvas_sdk.exceptions.CanvasAPIError', 'CanvasAPIError', ([], {'status_code': 'status', 'msg': 'error_msg', 'error_json': 'error_json'}), '(... |
import requests
import mysql.connector
from mysql.connector import errorcode
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy import *
import csv
Session ... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"csv.reader"
] | [((322, 336), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', ([], {}), '()\n', (334, 336), False, 'from sqlalchemy.orm import sessionmaker\n'), ((444, 520), 'sqlalchemy.create_engine', 'create_engine', (['"""mysql+mysqlconnector://dublinbikesadmin:<EMAIL>/dublinbikes"""'], {}), "('mysql+mysqlconnector://dublinbikesadmi... |
# -*- coding: utf-8 -*-
import sublime, sublime_plugin
import os, fnmatch, re
TAB_SIZE = 2
COL_WIDTH = 30
def settings():
return sublime.load_settings('Notes.sublime-settings')
def get_root():
project_settings = sublime.active_window().active_view().settings().get('PlainNotes')
if project_settings:
... | [
"sublime.active_window",
"os.path.join",
"sublime.load_settings",
"sublime.run_command",
"fnmatch.fnmatch",
"re.sub",
"os.walk",
"os.path.relpath"
] | [((137, 184), 'sublime.load_settings', 'sublime.load_settings', (['"""Notes.sublime-settings"""'], {}), "('Notes.sublime-settings')\n", (158, 184), False, 'import sublime, sublime_plugin\n'), ((1623, 1651), 'os.walk', 'os.walk', (['path'], {'topdown': '(False)'}), '(path, topdown=False)\n', (1630, 1651), False, 'import... |
import pandas
u202 = pandas.read_csv("u202.csv", encoding="utf-8")
u203 = pandas.read_csv("u203.csv", encoding="utf-8")
u302 = pandas.read_csv("u302.csv", encoding="utf-8")
u202.dropna(inplace=True)
u203.dropna(inplace=True)
u302.dropna(inplace=True)
u202["místnost"] = "u202"
u203["místnost"] = "u203"
u302["místnost... | [
"pandas.merge",
"pandas.concat",
"pandas.read_csv"
] | [((22, 67), 'pandas.read_csv', 'pandas.read_csv', (['"""u202.csv"""'], {'encoding': '"""utf-8"""'}), "('u202.csv', encoding='utf-8')\n", (37, 67), False, 'import pandas\n'), ((75, 120), 'pandas.read_csv', 'pandas.read_csv', (['"""u203.csv"""'], {'encoding': '"""utf-8"""'}), "('u203.csv', encoding='utf-8')\n", (90, 120)... |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
n, m = map(int, readline().split())
memo_graph = [[0] * (n + 1) for _ in range(n + 1)]
... | [
"sys.setrecursionlimit",
"scipy.sparse.csr_matrix",
"scipy.sparse.csgraph.floyd_warshall"
] | [((116, 146), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (137, 146), False, 'import sys\n'), ((440, 462), 'scipy.sparse.csr_matrix', 'csr_matrix', (['memo_graph'], {}), '(memo_graph)\n', (450, 462), False, 'from scipy.sparse import csr_matrix\n'), ((470, 491), 'scipy.sparse.cs... |
# -*- coding: utf-8 -*-
import logging
from typing import Any
from inspect import isfunction, signature, getsourcelines, getmodule
from pydhsfw.messages import (
IncomingMessageQueue,
OutgoingMessageQueue,
MessageIn,
MessageOut,
MessageFactory,
register_message,
)
from pydhsfw.transport import (... | [
"logging.getLogger",
"inspect.getsourcelines",
"pydhsfw.connection.register_connection",
"inspect.getmodule",
"inspect.signature",
"pydhsfw.messages.register_message",
"inspect.isfunction"
] | [((597, 624), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (614, 624), False, 'import logging\n'), ((2274, 2323), 'pydhsfw.messages.register_message', 'register_message', (['"""stoc_send_client_type"""', '"""dcss"""'], {}), "('stoc_send_client_type', 'dcss')\n", (2290, 2323), False, 'fr... |
import pandas as pd
import numpy as np
from glob import glob
from pathlib import Path
from tqdm import tqdm
import libs.dirs as dirs
import libs.utils as utils
import libs.dataset_utils as dutils
import models.utils as mutils
import libs.commons as commons
from libs.vis_functions import plot_confusion_matrix
''' Comp... | [
"pandas.read_csv",
"pathlib.Path",
"libs.utils.compute_file_hash_list",
"libs.commons.rede2_positive.lower",
"libs.dataset_utils.df_to_csv",
"libs.commons.rede1_positive.lower"
] | [((723, 740), 'pathlib.Path', 'Path', (['dirs.images'], {}), '(dirs.images)\n', (727, 740), False, 'from pathlib import Path\n'), ((1398, 1415), 'pathlib.Path', 'Path', (['classFolder'], {}), '(classFolder)\n', (1402, 1415), False, 'from pathlib import Path\n'), ((1539, 1598), 'pandas.read_csv', 'pd.read_csv', (["(clas... |
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import qdarkstyle
import sys
import mysql.connector as mysql
import MainWindow as mw
import Configuration as cfg
import GYMMSSystemTray as CustomSystemTray
import EnterCDKey as EnterCDKey
def startAPP():
app = QApplicat... | [
"mysql.connector.connect",
"MainWindow.MainWindowApplication",
"EnterCDKey.EnterCDKey",
"GYMMSSystemTray.GYMMSSystemTray",
"PyQt5.QtWidgets.QApplication",
"sys.exit",
"qdarkstyle.load_stylesheet"
] | [((311, 333), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (323, 333), False, 'from PyQt5.QtWidgets import QApplication\n'), ((402, 439), 'GYMMSSystemTray.GYMMSSystemTray', 'CustomSystemTray.GYMMSSystemTray', (['app'], {}), '(app)\n', (434, 439), True, 'import GYMMSSystemTray as C... |
#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD license.
# However, when used with the GPL version of PyQt the additional terms described in ... | [
"pyface.qt.QtGui.QWidget",
"pyface.qt.QtGui.QColor"
] | [((1109, 1130), 'pyface.qt.QtGui.QWidget', 'QtGui.QWidget', (['parent'], {}), '(parent)\n', (1122, 1130), False, 'from pyface.qt import QtGui\n'), ((1216, 1235), 'pyface.qt.QtGui.QColor', 'QtGui.QColor', (['"""red"""'], {}), "('red')\n", (1228, 1235), False, 'from pyface.qt import QtGui\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, C0D1G0 B1NAR10 and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ComisionesDoctores(Document):
pass
@frappe.whitelist()
def corte(docname):
fecha = f... | [
"frappe.whitelist",
"frappe.msgprint",
"frappe.db.commit",
"frappe.get_doc",
"frappe.db.sql"
] | [((271, 289), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (287, 289), False, 'import frappe\n'), ((319, 365), 'frappe.get_doc', 'frappe.get_doc', (['"""Comisiones Doctores"""', 'docname'], {}), "('Comisiones Doctores', docname)\n", (333, 365), False, 'import frappe\n'), ((402, 735), 'frappe.db.sql', 'frap... |
import json
from datetime import datetime
from django.conf import settings
from response.slack.settings import INCIDENT_EDIT_DIALOG, INCIDENT_REPORT_DIALOG
from response.core.models.incident import Incident
from response.slack.models import HeadlinePost, CommsChannel, ExternalUser, GetOrCreateSlackExternalUser
from r... | [
"logging.getLogger",
"response.slack.models.GetOrCreateSlackExternalUser",
"response.slack.decorators.dialog_handler",
"datetime.datetime.now",
"django.conf.settings.SLACK_CLIENT.get_user_profile",
"response.slack.client.channel_reference",
"response.core.models.incident.Incident.objects.get",
"django... | [((444, 471), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (461, 471), False, 'import logging\n'), ((475, 513), 'response.slack.decorators.dialog_handler', 'dialog_handler', (['INCIDENT_REPORT_DIALOG'], {}), '(INCIDENT_REPORT_DIALOG)\n', (489, 513), False, 'from response.slack.decorator... |
from dsn.s_expr.structure import TreeText
from dsn.s_expr.clef import BecomeNode, TextBecome, Insert, Replace, Delete
from spacetime import st_become, st_insert, st_replace, st_delete
from collections import namedtuple
from list_operations import l_become, l_insert, l_delete, l_replace
from historiography import Hist... | [
"dsn.historiography.legato.HistoriographyNoteCapo",
"dsn.historiography.construct.construct_historiography",
"collections.namedtuple",
"spacetime.st_insert",
"list_operations.l_insert",
"list_operations.l_delete",
"spacetime.st_replace",
"dsn.s_expr.structure.TreeText",
"spacetime.st_delete",
"dsn... | [((662, 761), 'collections.namedtuple', 'namedtuple', (['"""RecursiveHistoryInfo"""', "('t_address', 'historiography_note_nout', 'children_steps')"], {}), "('RecursiveHistoryInfo', ('t_address', 'historiography_note_nout',\n 'children_steps'))\n", (672, 761), False, 'from collections import namedtuple\n'), ((976, 10... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from collections import defaultdict
import json
import os
from os.path import join, dirname, isdir
import sys
import tqdm
import requests
CHANNEL_NAME = "conda-forge"
CHANNEL_ALIAS = "https://conda-web.anaconda.org"
SUBDIRS = (
... | [
"os.getenv",
"os.makedirs",
"tqdm.tqdm",
"os.path.join",
"requests.get",
"os.path.dirname",
"os.path.isdir",
"collections.defaultdict",
"json.dump"
] | [((12069, 12116), 'tqdm.tqdm', 'tqdm.tqdm', (['SUBDIRS'], {'desc': '"""Downloading repodata"""'}), "(SUBDIRS, desc='Downloading repodata')\n", (12078, 12116), False, 'import tqdm\n'), ((12395, 12414), 'os.getenv', 'os.getenv', (['"""PREFIX"""'], {}), "('PREFIX')\n", (12404, 12414), False, 'import os\n'), ((6864, 6881),... |
# -*- coding: utf-8 -*-
from django_extensions.management.jobs import HourlyJob
try:
from unittest import mock
except ImportError:
import mock
HOURLY_JOB_MOCK = mock.MagicMock()
class Job(HourlyJob):
help = "My sample hourly job."
def execute(self):
HOURLY_JOB_MOCK()
| [
"mock.MagicMock"
] | [((172, 188), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (186, 188), False, 'import mock\n')] |
from .base import MethodBuilderBase
from itertools import chain
class MethodBuilder(MethodBuilderBase):
"""
Builder for instance method wrappers
"""
def __init__(self, cls, method, xlname):
super().__init__(cls, method, xlname)
self.__method_str = None
def __str__(self):
... | [
"itertools.chain"
] | [((701, 755), 'itertools.chain', 'chain', (['*(t.imports for n, t in self.method.parameters)'], {}), '(*(t.imports for n, t in self.method.parameters))\n', (706, 755), False, 'from itertools import chain\n')] |
from decimal import Decimal
from datetime import datetime
from django.urls import reverse
from rest_framework.test import APITestCase
from cotidia.account import fixtures
from cotidia.admin.tests.factory import ExampleModelOneFactory, ExampleModelTwoFactory
class AdminSearchDashboardTestsGeneralQuery(APITestCase):
... | [
"cotidia.admin.tests.factory.ExampleModelOneFactory.create",
"django.urls.reverse"
] | [((384, 481), 'django.urls.reverse', 'reverse', (['"""generic-api:object-list"""'], {'kwargs': "{'app_label': 'tests', 'model': 'examplemodelone'}"}), "('generic-api:object-list', kwargs={'app_label': 'tests', 'model':\n 'examplemodelone'})\n", (391, 481), False, 'from django.urls import reverse\n'), ((645, 695), 'c... |
import json
import uuid
from collections import OrderedDict
from unittest.mock import patch
import faker
import pytest
from django.contrib.contenttypes.models import ContentType
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.client import BOUNDARY, MULTIPART_CONTENT, encode_multipart
fr... | [
"apiqa_storage.models.Attachment.objects.count",
"apiqa_storage.models.Attachment.objects.get",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.test.client.encode_multipart",
"json.dumps",
"apiqa_storage.models.Attachment.objects.filter",
"uuid.uuid4",
"faker.Faker",
... | [((792, 812), 'faker.Faker', 'faker.Faker', (['"""ru_RU"""'], {}), "('ru_RU')\n", (803, 812), False, 'import faker\n'), ((823, 850), 'django.urls.reverse', 'reverse', (['"""file_upload-list"""'], {}), "('file_upload-list')\n", (830, 850), False, 'from django.urls import reverse\n'), ((1436, 1457), 'apiqa_storage.files.... |
import os
import app as flaskr
import unittest
import tempfile
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp()
flaskr.app.testing = True
self.app = flaskr.app.test_client()
with flaskr.app.app_context():
... | [
"app.init_db",
"os.close",
"app.app.test_client",
"app.app.app_context",
"os.unlink",
"unittest.main",
"tempfile.mkstemp"
] | [((2061, 2076), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2074, 2076), False, 'import unittest\n'), ((179, 197), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (195, 197), False, 'import tempfile\n'), ((251, 275), 'app.app.test_client', 'flaskr.app.test_client', ([], {}), '()\n', (273, 275), True,... |
# -*- coding: utf-8 -*-
import collections
import pytest
import numpy as np
from skmpe import mpe, parameters, OdeSolverMethod, EndPointNotReachedError
TRAVEL_TIME_ABS_TOL = 100
travel_time_order_param = pytest.mark.parametrize('travel_time_order', [
pytest.param(1),
pytest.param(2),
])
@pytest.mark.par... | [
"pytest.approx",
"pytest.param",
"pytest.mark.parametrize",
"skmpe.mpe",
"pytest.raises",
"numpy.ma.masked_array",
"skmpe.parameters",
"numpy.zeros_like"
] | [((305, 723), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ode_method, start_point, end_point"""', '[(OdeSolverMethod.RK23, (37, 255), (172, 112)), (OdeSolverMethod.RK45, (37,\n 255), (172, 112)), (OdeSolverMethod.DOP853, (37, 255), (172, 112)), (\n OdeSolverMethod.Radau, (37, 255), (172, 112)), (O... |
import numpy as np
import os.path
import time
import matplotlib._pylab_helpers
from matplotlib.backends.backend_pdf import PdfPages
# import plotly.plotly as py
# import plotly.tools as tls
def return_length_of_nonzero_array(X):
"""
Takes in a numpy.ndarray X of shape (m,n) and returns the length of the array that r... | [
"numpy.shape",
"time.strftime",
"matplotlib.backends.backend_pdf.PdfPages"
] | [((648, 659), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (656, 659), True, 'import numpy as np\n'), ((2359, 2391), 'matplotlib.backends.backend_pdf.PdfPages', 'PdfPages', (['(FilePath + PDFFileName)'], {}), '(FilePath + PDFFileName)\n', (2367, 2391), False, 'from matplotlib.backends.backend_pdf import PdfPages\n'... |
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
with open(file_path) as file:
content = file.read()
return content if content else 'no content read'
... | [
"setuptools.find_packages",
"pytest.main",
"setuptools.command.test.test.initialize_options",
"os.path.dirname",
"sys.exit"
] | [((168, 193), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (183, 193), False, 'import os\n'), ((412, 448), 'setuptools.command.test.test.initialize_options', 'TestCommand.initialize_options', (['self'], {}), '(self)\n', (442, 448), True, 'from setuptools.command.test import test as TestComm... |
import os
import time
import sys
import multiprocessing
from joblib import Parallel, delayed
import argparse
from triplets_create_functions.worker_create_patches_parallel import process_scene
parser = argparse.ArgumentParser(description='Create patches from scenes - Damian',
formatter_c... | [
"argparse.ArgumentParser",
"os.path.join",
"multiprocessing.cpu_count",
"joblib.Parallel",
"joblib.delayed",
"time.time",
"os.walk"
] | [((201, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create patches from scenes - Damian"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Create patches from scenes - Damian',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (224,... |
import pickle
from collections import Counter
from math import log
from typing import List, Dict, Tuple
import numpy as np
from scipy.sparse import csr_matrix
from scipy.spatial.distance import cosine
from common import check_data_set, flatten_nested_iterables
from preprocessors.configs import PreProcessingConfigs
fr... | [
"scipy.spatial.distance.cosine",
"pickle.dump",
"common.check_data_set",
"math.log",
"collections.Counter",
"numpy.array",
"common.flatten_nested_iterables",
"scipy.sparse.csr_matrix",
"utils.file_ops.check_paths",
"utils.file_ops.create_dir"
] | [((2033, 2042), 'collections.Counter', 'Counter', ([], {}), '()\n', (2040, 2042), False, 'from collections import Counter\n'), ((5051, 5060), 'collections.Counter', 'Counter', ([], {}), '()\n', (5058, 5060), False, 'from collections import Counter\n'), ((7067, 7138), 'common.check_data_set', 'check_data_set', ([], {'da... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 21 11:05:24 2017
The oil and sugar separation (pretreatment) section for the baseline lipid cane biorefinery is defined here as System objects. The systems include all streams and units starting from enzyme treatment to purification of the sugar sol... | [
"biosteam.units.MixTank",
"biosteam.units.CrushingMill",
"biosteam.units.ConveyingBelt",
"numpy.array",
"biosteam.biorefineries.lipidcane.species.pretreatment_species.indices",
"biosteam.units.Pump",
"biosteam.units.Mixer",
"biosteam.units.EnzymeTreatment",
"biosteam.Stream.indices",
"biosteam.Str... | [((1507, 1579), 'biosteam.Stream', 'Stream', (['"""lipid_cane"""', 'f1', 'psp1'], {'units': '"""kg/hr"""', 'price': "price['Lipid cane']"}), "('lipid_cane', f1, psp1, units='kg/hr', price=price['Lipid cane'])\n", (1513, 1579), False, 'from biosteam import System, Stream\n'), ((1622, 1709), 'biosteam.Stream', 'Stream', ... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
import flatbuffers
class PublisherFeatures(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsPublisherFeatures(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
... | [
"flatbuffers.encode.Get",
"flatbuffers.table.Table"
] | [((252, 315), 'flatbuffers.encode.Get', 'flatbuffers.encode.Get', (['flatbuffers.packer.uoffset', 'buf', 'offset'], {}), '(flatbuffers.packer.uoffset, buf, offset)\n', (274, 315), False, 'import flatbuffers\n'), ((472, 505), 'flatbuffers.table.Table', 'flatbuffers.table.Table', (['buf', 'pos'], {}), '(buf, pos)\n', (49... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kakakaya, Date: Sun Oct 15 19:49:06 2017
from unittest import TestCase
from nose.tools import ok_, eq_, raises
import irasutoya
class TestIrasutoyaEntry(TestCase):
def test_single_illust_entry(self):
url = 'http://www.irasutoya.com/2017/10/blog-post_... | [
"irasutoya.IrasutoyaEntry",
"nose.tools.ok_",
"nose.tools.raises",
"nose.tools.eq_"
] | [((1030, 1048), 'nose.tools.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (1036, 1048), False, 'from nose.tools import ok_, eq_, raises\n'), ((458, 487), 'irasutoya.IrasutoyaEntry', 'irasutoya.IrasutoyaEntry', (['url'], {}), '(url)\n', (482, 487), False, 'import irasutoya\n'), ((496, 512), 'nose.tools.eq_'... |
# ._____. __
# ___________ |__\_ |__ _____/ |_
# \____ \__ \ | || __ \ / _ \ __\
# | |_> > __ \| || \_\ ( <_> ) |
# | __(____ /__||___ /\____/|__|
# |__| \/ \/
#This code is horrendous. Just saying.
import os, discord, random
from bo... | [
"os.getenv",
"discord.ext.commands.Bot",
"dotenv.load_dotenv",
"discord.Colour.light_gray",
"random.randint",
"discord.File",
"discord.Intents.default"
] | [((421, 434), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (432, 434), False, 'from dotenv import load_dotenv\n'), ((810, 836), 'os.getenv', 'os.getenv', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (819, 836), False, 'import os, discord, random\n'), ((873, 898), 'discord.Intents.default', 'discord.I... |
# -*- coding: utf-8 -*-
import json
"""
This module responsibility is for reading and setting elements of the json templates in memory.
"""
def set_template_pool_id(in_memory_json_object: str, pool_id: str):
"""
Finds the poolName or poolId inside the in_memory_json_object and sets the value based on the poo... | [
"json.load"
] | [((6151, 6163), 'json.load', 'json.load', (['f'], {}), '(f)\n', (6160, 6163), False, 'import json\n'), ((6785, 6797), 'json.load', 'json.load', (['f'], {}), '(f)\n', (6794, 6797), False, 'import json\n'), ((7362, 7374), 'json.load', 'json.load', (['f'], {}), '(f)\n', (7371, 7374), False, 'import json\n'), ((7944, 7956)... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"pytest.mark.parametrize",
"pytest.raises",
"torch.tensor",
"pytorch_lightning.utilities.fetching.DataFetcher"
] | [((888, 949), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_combined_loader"""', '[False, True]'], {}), "('use_combined_loader', [False, True])\n", (911, 949), False, 'import pytest\n'), ((2531, 2544), 'pytorch_lightning.utilities.fetching.DataFetcher', 'DataFetcher', ([], {}), '()\n', (2542, 2544), F... |
# -*- coding: utf-8 -*-
import sys
import json
from workflow import Workflow3, ICON_SYNC, ICON_EJECT, ICON_WARNING
from workflow.background import run_in_background
def show_RSS_items(posts):
settings = json.loads(open('mikan_settings.json', 'r').read())
filters = settings.get('filters', {})
history = wf.... | [
"workflow.background.run_in_background",
"workflow.Workflow3"
] | [((2700, 2711), 'workflow.Workflow3', 'Workflow3', ([], {}), '()\n', (2709, 2711), False, 'from workflow import Workflow3, ICON_SYNC, ICON_EJECT, ICON_WARNING\n'), ((2232, 2264), 'workflow.background.run_in_background', 'run_in_background', (['"""update"""', 'cmd'], {}), "('update', cmd)\n", (2249, 2264), False, 'from ... |
"""
There are a few important sets of datastructures:
dimensions
* N - Size of the dstore.
* K - Number of retrieved neighbors.
* D - Size of the key vectors.
dstore - This is the "ground truth" source of keys, values, and other important
items created by the KNN-LM.
... | [
"torch.ones_like",
"numpy.unique",
"torch.log_softmax",
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.sort",
"torch.stack",
"numpy.log",
"os.path.join",
"torch.from_numpy",
"numpy.sum",
"numpy.zeros",
"numpy.concatenate",
"numpy.take_along_axis",
"numpy.arange",
"torch.logsume... | [((2131, 2173), 'numpy.logical_and', 'np.logical_and', (['has_positive', 'has_negative'], {}), '(has_positive, has_negative)\n', (2145, 2173), True, 'import numpy as np\n'), ((17064, 17089), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (17087, 17089), False, 'import argparse\n'), ((3442, 3455... |
#!/usr/bin/env python
import os
import codecs
from setuptools import setup, find_packages
dirname = 'sample_data_utils'
app = __import__(dirname)
def read(*parts):
here = os.path.abspath(os.path.dirname(__file__))
return codecs.open(os.path.join(here, *parts), 'r').read()
tests_require = ['pytest', 'covera... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((195, 220), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (210, 220), False, 'import os\n'), ((679, 697), 'setuptools.find_packages', 'find_packages', (['"""."""'], {}), "('.')\n", (692, 697), False, 'from setuptools import setup, find_packages\n'), ((245, 271), 'os.path.join', 'os.path.jo... |
# Credits:
# https://levelup.gitconnected.com/python-sun-position-for-solar-energy-and-research-7a4ead801777
import datetime
from dateutil.tz import tzutc
from math import sin, cos, tan, asin, atan2, radians as rad, degrees as deg
def sun_position(location, utc=None, refraction=True):
if utc is None:
utc... | [
"math.tan",
"dateutil.tz.tzutc",
"math.degrees",
"math.radians",
"math.cos",
"math.sin"
] | [((448, 461), 'math.radians', 'rad', (['latitude'], {}), '(latitude)\n', (451, 461), True, 'from math import sin, cos, tan, asin, atan2, radians as rad, degrees as deg\n'), ((473, 487), 'math.radians', 'rad', (['longitude'], {}), '(longitude)\n', (476, 487), True, 'from math import sin, cos, tan, asin, atan2, radians a... |
#!/usr/bin/env python
import sys
import argparse
# read in components and mangled enums
from timemory_types import native_components
def generate_extern(component, key, alias, suffix, specify_comp=True):
"""
This function generates a type trait label for C++
"""
if specify_comp:
return "TIMEM... | [
"timemory_types.native_components.sort",
"argparse.ArgumentParser"
] | [((595, 620), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (618, 620), False, 'import argparse\n'), ((983, 1007), 'timemory_types.native_components.sort', 'native_components.sort', ([], {}), '()\n', (1005, 1007), False, 'from timemory_types import native_components\n')] |
"""This module is meant to contain the OptimisticEtherscan class"""
from typing import Union, List
import pandas as pd
from messari.blockexplorers import Scanner
from messari.utils import validate_input
BASE_URL='https://api-optimistic.etherscan.io/api'
# Reference: https://optimistic.etherscan.io/apis
class Optimis... | [
"pandas.DataFrame",
"messari.blockexplorers.Scanner.__init__",
"pandas.concat",
"messari.utils.validate_input"
] | [((469, 527), 'messari.blockexplorers.Scanner.__init__', 'Scanner.__init__', (['self'], {'base_url': 'BASE_URL', 'api_key': 'api_key'}), '(self, base_url=BASE_URL, api_key=api_key)\n', (485, 527), False, 'from messari.blockexplorers import Scanner\n'), ((706, 733), 'messari.utils.validate_input', 'validate_input', (['a... |
from .handler import handler
try:
import socketserver
except ImportError:
import SocketServer as socketserver
class udp_handler:
def __init__(self, log, host, port):
log.log(1, "Starting TCP server on Host: '%s' and Port: '%d'" % (host, port))
socketserver.UDPServer.allow_reuse_address = Tr... | [
"SocketServer.UDPServer"
] | [((345, 390), 'SocketServer.UDPServer', 'socketserver.UDPServer', (['(host, port)', 'handler'], {}), '((host, port), handler)\n', (367, 390), True, 'import SocketServer as socketserver\n')] |
import os
from auth.aws_login import aws_login
from services.services import aws_services
from services.ec2.instance_ssh_login import instance_login
os.system("tput setaf 1")
print("\t\t\t\tWelcome to the AWS-TUI interface!")
os.system("tput setaf 7")
print("\t\t\t--------------------------------------------")
def aw... | [
"os.system",
"services.services.aws_services",
"auth.aws_login.aws_login"
] | [((150, 175), 'os.system', 'os.system', (['"""tput setaf 1"""'], {}), "('tput setaf 1')\n", (159, 175), False, 'import os\n'), ((227, 252), 'os.system', 'os.system', (['"""tput setaf 7"""'], {}), "('tput setaf 7')\n", (236, 252), False, 'import os\n'), ((353, 378), 'os.system', 'os.system', (['"""tput setaf 4"""'], {})... |
"""URL Configuration"""
from django.urls import path, include
from . import views
from rest_auth.views import LogoutView
urlpatterns = [
path('user/', views.UserDetailsAPIView.as_view(), name='rest_user_details'),
path('login/', views.LoginUserView.as_view(), name='account_login'),
path('password/change... | [
"rest_auth.views.LogoutView.as_view",
"django.urls.include"
] | [((503, 528), 'django.urls.include', 'include', (['"""rest_auth.urls"""'], {}), "('rest_auth.urls')\n", (510, 528), False, 'from django.urls import path, include\n'), ((651, 689), 'django.urls.include', 'include', (['"""rest_auth.registration.urls"""'], {}), "('rest_auth.registration.urls')\n", (658, 689), False, 'from... |
from django.urls import path
from . import views
urlpatterns = [
path('remainder/', views.notification,name='blog-notifications'),
] | [
"django.urls.path"
] | [((70, 135), 'django.urls.path', 'path', (['"""remainder/"""', 'views.notification'], {'name': '"""blog-notifications"""'}), "('remainder/', views.notification, name='blog-notifications')\n", (74, 135), False, 'from django.urls import path\n')] |
#exec(open("C:\\dev\\blender\\blogo\\src\\blogo.py").read())
import bpy
import math
import mathutils
import numpy as np
import runpy
#exec(open("C:\\dev\\blender\\blogo\\src\\blogo_colours.py").read())
import blogo_colours
import blogo
# TODO
# Clean up functions
# Add config file reading (with defau... | [
"bpy.data.lights.new",
"mathutils.Matrix.Rotation",
"math.sqrt",
"bpy.data.objects.new",
"bpy.data.libraries.load",
"math.cos",
"numpy.array",
"bpy.context.scene.collection.children.link",
"blogo.Blogo.clean_up",
"numpy.linalg.norm",
"bpy.context.copy",
"bpy.data.images.load",
"mathutils.Vec... | [((1804, 1826), 'blogo.Blogo.clean_up', 'blogo.Blogo.clean_up', ([], {}), '()\n', (1824, 1826), False, 'import blogo\n'), ((2365, 2384), 'numpy.array', 'np.array', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (2373, 2384), True, 'import numpy as np\n'), ((3859, 3884), 'bpy.ops.info.select_all', 'bpy.ops.info.select_all', ([],... |
import numpy as np
from phi import struct
from phi.math.math_util import is_static_shape
# creates normal distributed noise that can vary over the batch
def generateNoise(grid, var, mean=0, seed=0, dtype=np.float32):
size = grid.data.shape
rand = np.random.RandomState(seed)
def array(shape):
result... | [
"numpy.mean",
"numpy.repeat",
"numpy.ones",
"numpy.random.rand",
"numpy.arange",
"numpy.asarray",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.sum",
"numpy.concatenate",
"numpy.min",
"numpy.sin",
"numpy.pad",
"numpy.zeros_like",
"numpy.random.RandomState"... | [((256, 283), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (277, 283), True, 'import numpy as np\n'), ((482, 537), 'phi.struct.map', 'struct.map', (['array', 'grid'], {'leaf_condition': 'is_static_shape'}), '(array, grid, leaf_condition=is_static_shape)\n', (492, 537), False, 'from p... |
import re
import pkuseg
from tqdm import tqdm
from collections import Counter
class Statistics():
def __init__(self,data):
self.data = data
self.min_length = 5
self.max_length = 100
self.post_num = 0
self.resp_num = 0
self.err_data = 0
def word_freq(self):
... | [
"collections.Counter",
"tqdm.tqdm",
"pkuseg.pkuseg"
] | [((329, 360), 'pkuseg.pkuseg', 'pkuseg.pkuseg', ([], {'model_name': '"""web"""'}), "(model_name='web')\n", (342, 360), False, 'import pkuseg\n'), ((554, 569), 'tqdm.tqdm', 'tqdm', (['self.data'], {}), '(self.data)\n', (558, 569), False, 'from tqdm import tqdm\n'), ((839, 856), 'collections.Counter', 'Counter', (['new_t... |
from datetime import datetime as dt
import pytest
import sys
import os
from collections import namedtuple
import platform
if platform.system() == 'Windows':
splitter = '\\'
else:
splitter = '/'
base = splitter.join(__file__.split(splitter)[:-2])
if base not in sys.path:
sys.path.append(base)
from src imp... | [
"datetime.datetime",
"collections.namedtuple",
"pytest.main",
"platform.system",
"src.ens_processing.find_run_time",
"sys.path.append"
] | [((126, 143), 'platform.system', 'platform.system', ([], {}), '()\n', (141, 143), False, 'import platform\n'), ((285, 306), 'sys.path.append', 'sys.path.append', (['base'], {}), '(base)\n', (300, 306), False, 'import sys\n'), ((1338, 1351), 'pytest.main', 'pytest.main', ([], {}), '()\n', (1349, 1351), False, 'import py... |
# -*- coding: utf-8 -*-
import sys, os
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.join(os.path.abspath('.'), '_ext'))
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as st... | [
"os.path.abspath",
"sphinx_rtd_theme.get_html_theme_path"
] | [((59, 79), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (74, 79), False, 'import sys, os\n'), ((100, 121), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (115, 121), False, 'import sys, os\n'), ((1796, 1834), 'sphinx_rtd_theme.get_html_theme_path', 'sphinx_rtd_theme.get_ht... |
from gspackage.utils import config
print(config.getValue(section="log", key="log1")) | [
"gspackage.utils.config.getValue"
] | [((42, 84), 'gspackage.utils.config.getValue', 'config.getValue', ([], {'section': '"""log"""', 'key': '"""log1"""'}), "(section='log', key='log1')\n", (57, 84), False, 'from gspackage.utils import config\n')] |
from __future__ import print_function, division
from collections import namedtuple
from .metergroup import MeterGroup
from .datastore import join_key
from .hashable import Hashable
BuildingID = namedtuple('BuildingID', ['instance', 'dataset'])
class Building(Hashable):
"""
Attributes
----------
elec :... | [
"collections.namedtuple"
] | [((195, 244), 'collections.namedtuple', 'namedtuple', (['"""BuildingID"""', "['instance', 'dataset']"], {}), "('BuildingID', ['instance', 'dataset'])\n", (205, 244), False, 'from collections import namedtuple\n')] |
#!python3
from flask import Flask, render_template, request
from simpleeval import simple_eval
import logging
logging.basicConfig(level=logging.DEBUG)
# Declare the App
app = Flask(__name__)
@app.route('/') # Start the app route ('/')
def main():
print('-----------------started-----------------')
return re... | [
"logging.basicConfig",
"flask.render_template",
"simpleeval.simple_eval",
"flask.Flask"
] | [((111, 151), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (130, 151), False, 'import logging\n'), ((177, 192), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (182, 192), False, 'from flask import Flask, render_template, request\n'), ((318, 347)... |
from django.contrib.auth import authenticate, login, get_user_model
from django.http import HttpResponseRedirect
from django.shortcuts import render, redirect
from .forms import ContactForm, LoginForm, RegisterForm
def index(request):
return render(request, "index.html", {})
def login_auth(request):
form = LoginF... | [
"django.shortcuts.render",
"django.contrib.auth.get_user_model",
"django.contrib.auth.authenticate",
"django.http.HttpResponseRedirect",
"django.contrib.auth.login",
"django.shortcuts.redirect"
] | [((245, 278), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', '{}'], {}), "(request, 'index.html', {})\n", (251, 278), False, 'from django.shortcuts import render, redirect\n'), ((781, 824), 'django.shortcuts.render', 'render', (['request', '"""auth/login.html"""', 'context'], {}), "(request, 'aut... |
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
operations = [
migrations.CreateModel(
name='Bookmark',
fields=[
('id', models... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.URLField"
] | [((314, 407), '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", (330, 407), False, 'from django.db import migrations, models\... |
from pydoc import locate
import multiprocessing
import datetime
from extract_keywords import extract_keywords
import file_loaders
from family_resemblance_tagger.common import logger, database, config
def monitor(monitor_queue):
apx_tasks = 0
while True:
update = monitor_queue.get()
apx_tasks ... | [
"datetime.datetime.utcnow",
"family_resemblance_tagger.common.database.check_already_added",
"multiprocessing.Process",
"extract_keywords.extract_keywords.extract_keywords",
"pydoc.locate",
"family_resemblance_tagger.common.database.init_db",
"multiprocessing.connection.Listener",
"family_resemblance_... | [((1803, 1821), 'family_resemblance_tagger.common.database.init_db', 'database.init_db', ([], {}), '()\n', (1819, 1821), False, 'from family_resemblance_tagger.common import logger, database, config\n'), ((1832, 1847), 'family_resemblance_tagger.common.logger.Logger', 'logger.Logger', ([], {}), '()\n', (1845, 1847), Fa... |
import torch
import torch.nn as nn
import torch.nn.functional as f
from mlp import MultiLayerPerceptron
import torch
import torch.nn as nn
import torch.optim as optim
import logging
import numpy as np
device = "cuda" if torch.cuda.is_available() else "cpu"
logger = logging.getLogger(__name__)
logging.basicConfig... | [
"logging.getLogger",
"torch.manual_seed",
"logging.basicConfig",
"torch.nn.ReLU",
"numpy.mean",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.no_grad",
"torch.cat"
] | [((273, 300), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (290, 300), False, 'import logging\n'), ((301, 322), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (320, 322), False, 'import logging\n'), ((227, 252), 'torch.cuda.is_available', 'torch.cuda.is_available', ([],... |
# © 2019 Nokia
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
import re
from string import Template
from radish_ext.sdk.l import Logging
def dot_to_dict_notation(dot_notation):
""" replace dot_notation to nested_python_dict_notation
so that It can be later used in nested ... | [
"nose.tools.assert_equal",
"radish_ext.sdk.l.Logging.get_object_logger",
"json.dumps",
"nose.runmodule",
"nose.tools.raises",
"re.sub"
] | [((12675, 12692), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (12681, 12692), False, 'from nose.tools import assert_equal, raises\n'), ((13063, 13080), 'nose.tools.raises', 'raises', (['Exception'], {}), '(Exception)\n', (13069, 13080), False, 'from nose.tools import assert_equal, raises\n'), (... |
from setuptools import setup
setup(
name='pychnarm-vcs-xml',
py_modules=[
'gitpycharm',
"gitsubmodule"
],
version='4.0',
url='https://github.com/alexsilva/pycharm-cvs-xlm',
license='MIT',
author='alex',
author_email='<EMAIL>',
description='Search for git submodules i... | [
"setuptools.setup"
] | [((30, 379), 'setuptools.setup', 'setup', ([], {'name': '"""pychnarm-vcs-xml"""', 'py_modules': "['gitpycharm', 'gitsubmodule']", 'version': '"""4.0"""', 'url': '"""https://github.com/alexsilva/pycharm-cvs-xlm"""', 'license': '"""MIT"""', 'author': '"""alex"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Searc... |
from environment import Environment
from species import Species
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg') # <-- THIS MAKES IT FAST!
class DataVisualizer():
def __init__(self, env):
self.environments = [env]
plt.ion()
plt.show()
print("Init of Data Visualizer complete")
... | [
"matplotlib.use",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.show"
] | [((114, 137), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (128, 137), False, 'import matplotlib\n'), ((249, 258), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (256, 258), True, 'import matplotlib.pyplot as plt\n'), ((263, 273), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n... |
# https://github.com/lucidrains/vit-pytorch
import torch
from pagi.models.vits.vit import ViT
v = ViT(
image_size = 256,
patch_size = 32,
num_classes = 1000,
dim = 1024,
depth = 6,
heads = 16,
mlp_dim = 2048,
dropout = 0.1,
emb_dropout = 0.1
)
img = torch.randn(1, 3, 256, 256)
pr... | [
"pagi.models.vits.vit.ViT",
"torch.randn"
] | [((100, 229), 'pagi.models.vits.vit.ViT', 'ViT', ([], {'image_size': '(256)', 'patch_size': '(32)', 'num_classes': '(1000)', 'dim': '(1024)', 'depth': '(6)', 'heads': '(16)', 'mlp_dim': '(2048)', 'dropout': '(0.1)', 'emb_dropout': '(0.1)'}), '(image_size=256, patch_size=32, num_classes=1000, dim=1024, depth=6,\n hea... |
from pyiso import client_factory
from unittest import TestCase
import logging
import StringIO
import pandas as pd
import pytz
from datetime import date, datetime, timedelta
from bs4 import BeautifulSoup
class TestCAISOBase(TestCase):
def setUp(self):
self.ren_report_tsv = StringIO.StringIO("03/12/14\t\t\t... | [
"StringIO.StringIO",
"datetime.datetime",
"logging.StreamHandler",
"bs4.BeautifulSoup",
"datetime.date",
"pyiso.client_factory",
"datetime.timedelta"
] | [((287, 2439), 'StringIO.StringIO', 'StringIO.StringIO', (['"""03/12/14\t\t\tHourly Breakdown of Renewable Resources (MW)\t\t\t\t\t\t\t\t\t\t\t\t\n\tHour\t\tGEOTHERMAL\tBIOMASS\t\tBIOGAS\t\tSMALL HYDRO\tWIND TOTAL\tSOLAR PV\tSOLAR THERMAL\t\t\t\t\n\t1\t\t900\t\t313\t\t190\t\t170\t\t1596\t\t0\t\t0\n\t2\t\t900\t\t314\t\t... |
#!/usr/bin/env python
from setuptools import find_packages, setup
requirements = []
with open("requirements.txt") as f:
for line in f:
stripped = line.split("#")[0].strip()
if len(stripped) > 0:
requirements.append(stripped)
setup(
name="mapreader-plant-scivision",
version="0.0... | [
"setuptools.find_packages"
] | [((510, 525), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (523, 525), False, 'from setuptools import find_packages, setup\n')] |
import re
from random import randrange
def test_first_and_last_names_on_home_page(app):
all_contacts = app.contact.get_contact_list()
user_index = randrange(len(all_contacts))
contact_from_home_page = app.contact.get_contact_list(user_index)
contact_from_edit_page = app.contact.get_contact_info_from_e... | [
"re.sub"
] | [((964, 992), 're.sub', 're.sub', (['"""^\\\\s+|\\\\s+$"""', '""""""', 's'], {}), "('^\\\\s+|\\\\s+$', '', s)\n", (970, 992), False, 'import re\n')] |
# imports
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path
import numpy as np
from matplotlib.animation import FuncAnimation
import matplotlib.gridspec as gridspec
import os
import time
from manipulate_readinuvot import uvot
import scipy
from scipy.interpolate import interp1d
import matplot... | [
"random.shuffle",
"bokeh.plotting.figure",
"pandas.read_csv",
"bokeh.plotting.show",
"bokeh.plotting.save",
"os.path.join",
"bokeh.io.curdoc",
"scipy.interpolate.interp1d",
"numpy.array_split",
"numpy.linspace",
"bokeh.plotting.output_file"
] | [((859, 891), 'random.shuffle', 'random.shuffle', (['random_color_arr'], {}), '(random_color_arr)\n', (873, 891), False, 'import random\n'), ((1491, 1637), 'bokeh.plotting.figure', 'figure', ([], {'title': '"""Flux vs Wavelength"""', 'x_axis_label': '"""Wavelength (angstroms)"""', 'y_axis_label': '"""log(flux)+constant... |
# encoding: utf-8
"""
@author: gallupliu
@contact: <EMAIL>
@version: 1.0
@license: Apache Licence
@file: test_dataset.py
@time: 2018/2/20 20:02
"""
# import tensorflow as tf
#
# # sequences = [[1, 2, 3], [4, 5, 1], [1, 2]]
# sequences = [["1", "2", "3"], ["4", "5", "1"], ["1", "2"]]
# label_sequences = [[0, 1, 0],... | [
"tensorflow.InteractiveSession",
"tensorflow.train.Int64List",
"tensorflow.global_variables_initializer",
"tensorflow.FixedLenSequenceFeature",
"tensorflow.train.FloatList",
"tensorflow.contrib.learn.run_n",
"tensorflow.FixedLenFeature"
] | [((2495, 2518), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (2516, 2518), True, 'import tensorflow as tf\n'), ((2528, 2561), 'tensorflow.global_variables_initializer', 'tf.global_variables_initializer', ([], {}), '()\n', (2559, 2561), True, 'import tensorflow as tf\n'), ((3223, 3262), 't... |
# Copyright (c) 2013- The Spyder Development Team and Docrepr Contributors
#
# Distributed under the terms of the BSD BSD 3-Clause License
"""Simple tests of docrepr's output."""
# Standard library imports
import copy
import subprocess
import sys
import tempfile
from pathlib import Path
# Third party imports
import ... | [
"docrepr.sphinxify.rich_repr",
"pathlib.Path",
"IPython.core.oinspect.Inspector",
"sys.platform.startswith",
"IPython.core.oinspect.object_info",
"docrepr.options.clear",
"copy.deepcopy",
"pytest.fixture",
"pytest.skip",
"docrepr.options.update"
] | [((4322, 4356), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""build_oinfo"""'}), "(name='build_oinfo')\n", (4336, 4356), False, 'import pytest\n'), ((4685, 4727), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""set_docrepr_options"""'}), "(name='set_docrepr_options')\n", (4699, 4727), False, 'import pytes... |
# ____ ____
# / /\/ /
# /___/ \ / Copyright (c) 2021, Xilinx®.
# \ \ \/ Author: <NAME> <<EMAIL>>
# \ \
# / /
# /___/ /\
# \ \ / \
# \___\/\___\
#
# Licensed under the Apache License, Version 2.0
#
from ros2pkg.api import package_name_completer
from ros2cli.node.strategy import ... | [
"ros2acceleration.verb.run",
"ros2cli.node.strategy.add_arguments"
] | [((636, 656), 'ros2acceleration.verb.run', 'run', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (639, 656), False, 'from ros2acceleration.verb import VerbExtension, run\n'), ((823, 858), 'ros2cli.node.strategy.add_arguments', 'add_strategy_node_arguments', (['parser'], {}), '(parser)\n', (850, 858), True, 'fro... |
from pyorbs.app import main
def test_keyboard_interrupt(mocker):
mocker.patch('pyorbs.orbs.Orbs.list', side_effect=KeyboardInterrupt)
assert main(args=['-l']) == 1
| [
"pyorbs.app.main"
] | [((151, 168), 'pyorbs.app.main', 'main', ([], {'args': "['-l']"}), "(args=['-l'])\n", (155, 168), False, 'from pyorbs.app import main\n')] |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login
from .forms import *
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.urls import reverse
# 自己写的用户登录的判断 ... | [
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"django.contrib.auth.authenticate",
"django.http.HttpResponse",
"django.contrib.auth.login",
"django.contrib.auth.decorators.login_required",
"django.urls.reverse"
] | [((2194, 2210), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (2208, 2210), False, 'from django.contrib.auth.decorators import login_required\n'), ((2962, 3004), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/account/login"""'}), "(login... |
# coding:utf-8
"""
Copyright 2021 Huawei Technologies Co., Ltd
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 agree... | [
"numpy.mean",
"os.path.exists",
"os.path.join",
"os.path.split",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame",
"numpy.loadtxt"
] | [((1220, 1253), 'pandas.DataFrame', 'pd.DataFrame', (['T[1:]'], {'columns': 'T[0]'}), '(T[1:], columns=T[0])\n', (1232, 1253), True, 'import pandas as pd\n'), ((1857, 1905), 'os.path.join', 'os.path.join', (['info_path', '"""music_tagging_tmp.txt"""'], {}), "(info_path, 'music_tagging_tmp.txt')\n", (1869, 1905), False,... |
#!/usr/bin/env python
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | [
"requests.post",
"hpsdnclient.error.raise_400.assert_called_with",
"hpsdnclient.error.IllegalArgument",
"hpsdnclient.error.raise_404.assert_called_with",
"hpsdnclient.error.raise_500.assert_called_with",
"httpretty.register_uri",
"hpsdnclient.error.raise_500",
"requests.Response",
"hpsdnclient.error... | [((1282, 1309), 'mock.MagicMock', 'MagicMock', ([], {'name': '"""raise_400"""'}), "(name='raise_400')\n", (1291, 1309), False, 'from mock import MagicMock\n'), ((1325, 1344), 'requests.Response', 'requests.Response', ([], {}), '()\n', (1342, 1344), False, 'import requests\n'), ((1380, 1408), 'hpsdnclient.error.raise_er... |
from celery import Celery
task_queue = Celery('MiCV',
broker='redis://127.0.0.1:6379',
backend='redis://127.0.0.1:6379',
include=['tasks.tasks'])
# Optional configuration, see the application user guide.
task_queue.conf.update(
result_expires=3600,
)
if _... | [
"celery.Celery"
] | [((40, 151), 'celery.Celery', 'Celery', (['"""MiCV"""'], {'broker': '"""redis://127.0.0.1:6379"""', 'backend': '"""redis://127.0.0.1:6379"""', 'include': "['tasks.tasks']"}), "('MiCV', broker='redis://127.0.0.1:6379', backend=\n 'redis://127.0.0.1:6379', include=['tasks.tasks'])\n", (46, 151), False, 'from celery im... |
#!/usr/bin/env python
"""Python wrapper for the GROMACS mdrun module
"""
import sys
import json
import configuration.settings as settings
from command_wrapper import cmd_wrapper
from tools import file_utils as fu
class Mdrun(object):
"""Wrapper for the 5.1.2 version of the mdrun module
Args:
input_tpr... | [
"json.loads",
"tools.file_utils.get_logs",
"sys.argv.append",
"configuration.settings.YamlReader",
"command_wrapper.cmd_wrapper.CmdWrapper"
] | [((2304, 2371), 'tools.file_utils.get_logs', 'fu.get_logs', ([], {'path': 'self.path', 'mutation': 'self.mutation', 'step': 'self.step'}), '(path=self.path, mutation=self.mutation, step=self.step)\n', (2315, 2371), True, 'from tools import file_utils as fu\n'), ((3808, 3853), 'command_wrapper.cmd_wrapper.CmdWrapper', '... |
import pandas as pd
df = pd.read_csv("data.csv")
df.head()
bools_distance = []
for distance in df.Distance:
if distance <= 100:
bools_distance.append(True)
else:
bools_distance.append(False)
temp_distance = pd.Series(bools_distance)
temp_distance.head()
distance = df[temp_dist... | [
"pandas.Series",
"pandas.read_csv"
] | [((28, 51), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (39, 51), True, 'import pandas as pd\n'), ((246, 271), 'pandas.Series', 'pd.Series', (['bools_distance'], {}), '(bools_distance)\n', (255, 271), True, 'import pandas as pd\n'), ((590, 614), 'pandas.Series', 'pd.Series', (['bools_g... |
import re
import string
from nltk.stem import SnowballStemmer
def snowball_stemmer(x):
"""Computes the stemmer transformation of string x."""
if x is None:
return None
x = x.strip().lower()
x = re.sub("-", " ", x)
x = re.sub("[" + string.punctuation + "]", "", x)
# x = remove_accents(... | [
"re.sub",
"nltk.stem.SnowballStemmer"
] | [((221, 240), 're.sub', 're.sub', (['"""-"""', '""" """', 'x'], {}), "('-', ' ', x)\n", (227, 240), False, 'import re\n'), ((249, 294), 're.sub', 're.sub', (["('[' + string.punctuation + ']')", '""""""', 'x'], {}), "('[' + string.punctuation + ']', '', x)\n", (255, 294), False, 'import re\n'), ((331, 357), 'nltk.stem.S... |
from sys import exit
import argparse
import logging
_logger = logging.getLogger(__name__)
_LOGGING_FORMAT = '%(name)s.%(funcName)s[%(levelname)s]: %(message)s'
_DEBUG_LOGGING_FORMAT = '### %(asctime).19s.%(msecs).3s [%(levelname)s] %(name)s.%(funcName)s (%(filename)s:%(lineno)d) ###\n%(message)s'
def parse_args():
... | [
"logging.getLogger",
"logging.basicConfig",
"argparse.ArgumentParser",
"sys.exit"
] | [((62, 89), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (79, 89), False, 'import logging\n'), ((331, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (354, 356), False, 'import argparse\n'), ((4925, 4995), 'logging.basicConfig', 'logging.basicConfig', ([], ... |
from __future__ import division
from utils.utils import *
from utils.datasets import *
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.ticker import NullLocator
def plot_box_images(imgs, img_detections, classes, savePath, img_size=416):
"""
imgs: l... | [
"PIL.Image.open",
"matplotlib.pyplot.savefig",
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.gca",
"matplotlib.ticker.NullLocator",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.get_cmap"
] | [((571, 593), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""tab20b"""'], {}), "('tab20b')\n", (583, 593), True, 'import matplotlib.pyplot as plt\n'), ((934, 946), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (944, 946), True, 'import matplotlib.pyplot as plt\n'), ((965, 980), 'matplotlib.pyplot.sub... |