code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: 11360
# datetime: 2021/3/14 13:41
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_swiss_roll
from scipy.spatial import KDTree
import mpl_toolkits.mplot3d.axes3d as p3
from sklearn.cluster import AgglomerativeCluster... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.zeros",
"numpy.ones",
"sklearn.datasets.make_swiss_roll",
"matplotlib.pyplot.figure",
"numpy.linalg.svd",
"numpy.where",
"sklearn.cluster.AgglomerativeClustering",
"numpy.max",
"matplotlib.pyplot.gca",
"numpy.diag",
"mpl_toolkits.mp... | [((3258, 3304), 'sklearn.datasets.make_swiss_roll', 'make_swiss_roll', (['(1000)'], {'noise': '(0)', 'random_state': '(0)'}), '(1000, noise=0, random_state=0)\n', (3273, 3304), False, 'from sklearn.datasets import make_swiss_roll\n'), ((4712, 4733), 'numpy.linalg.svd', 'np.linalg.svd', (['self.B'], {}), '(self.B)\n', (... |
import pathlib
from transformers4rec.data.dataset import ParquetDataset
tabular_testing_data: ParquetDataset = ParquetDataset(pathlib.Path(__file__).parent)
| [
"pathlib.Path"
] | [((128, 150), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (140, 150), False, 'import pathlib\n')] |
import json
EVENT_FILE = 'events.rad'
eventFile = open(EVENT_FILE, 'a')
def log(event):
event['version'] = '0.1.0'
eventFile.write('\n' + json.dumps(event))
| [
"json.dumps"
] | [((148, 165), 'json.dumps', 'json.dumps', (['event'], {}), '(event)\n', (158, 165), False, 'import json\n')] |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((5907, 5932), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (5926, 5932), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
from django.core.management import BaseCommand
from talenta365.addons import seek_letters
class Command(BaseCommand):
help = 'Given any positive integer number, get your value in letters. How does Excel'
def add_arguments(self, parser):
parser.add_argument('number', type=int)
def handle(self, *... | [
"talenta365.addons.seek_letters"
] | [((352, 383), 'talenta365.addons.seek_letters', 'seek_letters', (["options['number']"], {}), "(options['number'])\n", (364, 383), False, 'from talenta365.addons import seek_letters\n')] |
from typing import OrderedDict
from rest_framework import serializers, status
from rest_framework_simplejwt.tokens import RefreshToken, TokenError
import re
import json
from language.serializers import LanguageSerializer
from .models import CustomUser
from language.models import Language
from .services.file_upload imp... | [
"rest_framework.serializers.EmailField",
"re.fullmatch",
"re.compile",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.JSONField",
"rest_framework.serializers.CharField",
"rest_framework_simplejwt.tokens.RefreshToken",
"language.serializers.LanguageSerializer",
"rest_framework... | [((630, 659), 'language.serializers.LanguageSerializer', 'LanguageSerializer', ([], {'many': '(True)'}), '(many=True)\n', (648, 659), False, 'from language.serializers import LanguageSerializer\n'), ((1241, 1270), 'language.serializers.LanguageSerializer', 'LanguageSerializer', ([], {'many': '(True)'}), '(many=True)\n'... |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import collections as mc
import torch
import task
from torchmodel import FullModel
from configs import FullConfig
import tools
device = 'cuda' if torch.cuda.is_available() else 'cpu'
def train(conf... | [
"torchmodel.FullModel",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"tools.save_config",
"numpy.arange",
"os.path.join",
"configs.FullConfig",
"os.path.exists",
"numpy.max",
"matplotlib.collections.LineCollection",
"tools.load_config",
"torch.cuda.is_available",
"numpy.... | [((267, 292), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (290, 292), False, 'import torch\n'), ((437, 471), 'tools.load_config', 'tools.load_config', (['config.data_dir'], {}), '(config.data_dir)\n', (454, 471), False, 'import tools\n'), ((701, 754), 'tools.save_config', 'tools.save_config'... |
import json
import logging
from threading import Thread
import queue
logger = logging.getLogger("flames")
'''
{"event":{"msgType": ["poofer_on"|
"poofer_off"|
"sequence_start"|
"sequence_stop"|
"poofer_enabled"|
... | [
"threading.Thread.__init__",
"queue.Queue",
"logging.getLogger"
] | [((79, 106), 'logging.getLogger', 'logging.getLogger', (['"""flames"""'], {}), "('flames')\n", (96, 106), False, 'import logging\n'), ((1065, 1078), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (1076, 1078), False, 'import queue\n'), ((2003, 2024), 'threading.Thread.__init__', 'Thread.__init__', (['self'], {}), '(se... |
import collections
import csv
import re
import json
ID_CIDADE = '2754' # BH
ARQUIVO_LISTA_CEP_ENDERECO = 'cepbr_endereco.csv'
LISTA_BHMAP = 'bhmap_endereco2.json'
LISTA_BHMAP_DESTINO = 'bhmap_endereco.geojson'
LISTA_PALAVRAS = 'bhmap_palavras.txt'
trocas_ruas = {
'<NAME>': u'<NAME>',
u'<NAME>': u'<NAME>',
}
... | [
"json.dump",
"json.load",
"csv.DictReader",
"math.log10",
"re.sub"
] | [((9170, 9202), 'csv.DictReader', 'csv.DictReader', (['f'], {'delimiter': '"""|"""'}), "(f, delimiter='|')\n", (9184, 9202), False, 'import csv\n'), ((10203, 10215), 'json.load', 'json.load', (['f'], {}), '(f)\n', (10212, 10215), False, 'import json\n'), ((13629, 13656), 'json.dump', 'json.dump', (['json_result', 'out'... |
"""The api module exposes the mloq functionality to the CLI."""
from pathlib import Path
from typing import List, Tuple, Union
from omegaconf import DictConfig
from mloq.files import (
dockerfile,
DOCS_FILES,
Ledger,
LICENSES,
mlproject,
OPEN_SOURCE_FILES,
ROOT_PATH_FILES,
setup_py,
... | [
"mloq.templating.write_template",
"mloq.skeleton.create_docs_directories",
"mloq.git.setup_git",
"mloq.skeleton.create_project_skeleton",
"pathlib.Path",
"mloq.workflows.setup_push_workflow",
"omegaconf.DictConfig",
"mloq.requirements.install_requirements",
"mloq.requirements.write_requirements",
... | [((2322, 2434), 'mloq.requirements.write_requirements', 'write_requirements', ([], {'out_path': 'path', 'options': 'options', 'test': 'test', 'lint': 'lint', 'ledger': 'ledger', 'overwrite': 'overwrite'}), '(out_path=path, options=options, test=test, lint=lint,\n ledger=ledger, overwrite=overwrite)\n', (2340, 2434),... |
from abc import ABC
import cv2
import numpy as np
from Operators.DummyAlgorithmWithModel import DummyAlgorithmWithModel
from Utils.GeometryUtils import center_pad_image_with_specific_base, \
resize_with_long_side, force_convert_image_to_bgr, correct_face_orientation
from Utils.InferenceHelpers import TritonInfere... | [
"Operators.ExampleFaceAlignmentOperator.GeneralLandmark106p",
"Utils.AnnotationTools.annotate_segmentation",
"argparse.ArgumentParser",
"Utils.GeometryUtils.correct_face_orientation",
"Operators.ExampleFaceDetectOperator.GeneralUltraLightFaceDetect",
"cv2.waitKey",
"cv2.destroyAllWindows",
"Utils.Geom... | [((4815, 4853), 'argparse.ArgumentParser', 'ArgumentParser', (['"""Face Parsing Example"""'], {}), "('Face Parsing Example')\n", (4829, 4853), False, 'from argparse import ArgumentParser\n'), ((5224, 5251), 'cv2.imread', 'cv2.imread', (['args.image_path'], {}), '(args.image_path)\n', (5234, 5251), False, 'import cv2\n'... |
import logging
import textwrap
from analysis.tools.aws_secrets import get_secrets
from analysis.tools.ssh_client import SshClient
_AWS_KEY_ID = "aws_key_id"
_AWS_KEY_SECRET = "aws_key_secret"
def setup_credentials(ssh: SshClient, secret_name: str):
logger = logging.getLogger("setup_credentials")
if 0 == ss... | [
"analysis.tools.aws_secrets.get_secrets",
"textwrap.dedent",
"logging.getLogger"
] | [((266, 304), 'logging.getLogger', 'logging.getLogger', (['"""setup_credentials"""'], {}), "('setup_credentials')\n", (283, 304), False, 'import logging\n'), ((502, 526), 'analysis.tools.aws_secrets.get_secrets', 'get_secrets', (['secret_name'], {}), '(secret_name)\n', (513, 526), False, 'from analysis.tools.aws_secret... |
# 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.lib.python.pack2.metadata.EnumType",
"makani.lib.python.pack2.metadata.BitfieldType",
"makani.lib.python.pack2.metadata.Header",
"makani.lib.python.pack2.metadata.ScaledType",
"makani.lib.python.pack2.metadata.Metadata",
"makani.lib.python.pack2.metadata.StringType",
"ply.lex.lex",
"makani.lib... | [((5758, 5788), 'ply.lex.lex', 'lex.lex', ([], {'object': 'self'}), '(object=self, **kwargs)\n', (5765, 5788), False, 'from ply import lex\n'), ((10433, 10457), 're.compile', 're.compile', (['"""(.*)\\\\.p2$"""'], {}), "('(.*)\\\\.p2$')\n", (10443, 10457), False, 'import re\n'), ((10575, 10630), 'ply.yacc.yacc', 'yacc.... |
import unittest
from mylist import LinkedList
def partition(head, P):
n = head
while n is not None:
if n.data >= P:
s = n.next
while s is not None:
if s.data < P:
tmp = n.data
n.data = s.data
s.data = tm... | [
"unittest.main",
"mylist.LinkedList.create"
] | [((707, 722), 'unittest.main', 'unittest.main', ([], {}), '()\n', (720, 722), False, 'import unittest\n'), ((637, 657), 'mylist.LinkedList.create', 'LinkedList.create', (['A'], {}), '(A)\n', (654, 657), False, 'from mylist import LinkedList\n')] |
#import svm_prediction
import os
import csv
import json
import sys
import random
sys.path.append(os.environ['HOME'] + 'src/models/')
from constructiveness_predictor import ConstructivenessPredictor
# Load models
predictor = ConstructivenessPredictor()
from flask import Flask
from flask import render_template, reques... | [
"sys.path.append",
"csv.writer",
"flask.request.args.get",
"flask.Flask",
"random.choice",
"flask.jsonify",
"os.path.isfile",
"flask.render_template",
"constructiveness_predictor.ConstructivenessPredictor"
] | [((81, 132), 'sys.path.append', 'sys.path.append', (["(os.environ['HOME'] + 'src/models/')"], {}), "(os.environ['HOME'] + 'src/models/')\n", (96, 132), False, 'import sys\n'), ((226, 253), 'constructiveness_predictor.ConstructivenessPredictor', 'ConstructivenessPredictor', ([], {}), '()\n', (251, 253), False, 'from con... |
#!/usr/bin/python
# mac_convertor.py - Converts mac address from various formats to other formats
import argparse
from mac_operations import Operations
def main():
# Handle command line args
parser = argparse.ArgumentParser(description='Process some mac addresses.', formatter_class=argparse.RawTextHelpFormatter)
... | [
"mac_operations.Operations",
"argparse.ArgumentParser",
"argparse.FileType"
] | [((206, 323), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some mac addresses."""', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description='Process some mac addresses.',\n formatter_class=argparse.RawTextHelpFormatter)\n", (229, 323), False, 'import argparse\n')... |
class Graph:
def __init__(self, max_vertex_count, direct=0, array=0):
self.max_vertex_count = max_vertex_count
self.current_vertex_count = 0
self.directed_graph = direct
self.vertex_list = [0] * (max_vertex_count + 1)
self.edge_matrix = []
self.array_graph = array
... | [
"sys.stdin.readline",
"collections.deque"
] | [((5261, 5268), 'collections.deque', 'deque', ([], {}), '()\n', (5266, 5268), False, 'from collections import deque\n'), ((3531, 3551), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (3549, 3551), False, 'import sys\n'), ((3634, 3654), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (3652, ... |
import numpy as np
import os
import pickle
import joblib
import sys
import glob
import torch
window_size = 1000
normality = str(sys.argv[1]) # e.g. abnormal
source = str(sys.argv[2]) # e.g. ryerson_ab_train_sigOver
outname = '{}_{}.npy'.format(source, normality)
input_path = '/net/adv_spectrum/data/feature/downsampl... | [
"numpy.save",
"numpy.array",
"numpy.arange",
"glob.glob",
"numpy.concatenate"
] | [((1864, 1892), 'numpy.save', 'np.save', (['output_path', 'X_full'], {}), '(output_path, X_full)\n', (1871, 1892), True, 'import numpy as np\n'), ((744, 781), 'numpy.arange', 'np.arange', (['(0)', 'X.shape[0]', 'window_size'], {}), '(0, X.shape[0], window_size)\n', (753, 781), True, 'import numpy as np\n'), ((991, 1007... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... | [
"heat.common.i18n._"
] | [((1219, 1260), 'heat.common.i18n._', '_', (['"""Tenant id of the service chain node."""'], {}), "('Tenant id of the service chain node.')\n", (1220, 1260), False, 'from heat.common.i18n import _\n'), ((1355, 1391), 'heat.common.i18n._', '_', (['"""Name of the service chain node."""'], {}), "('Name of the service chain... |
# Copyright 2021, Mycroft AI 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 writi... | [
"mycroft.util.LOG.warning",
"mycroft.util.LOG.debug",
"mycroft.util.LOG.info",
"requests.get",
"mediawiki.MediaWiki"
] | [((1904, 1955), 'mycroft.util.LOG.debug', 'LOG.debug', (['"""Fetching best image for %s"""', 'page.title'], {}), "('Fetching best image for %s', page.title)\n", (1913, 1955), False, 'from mycroft.util import LOG\n'), ((2238, 2259), 'requests.get', 'requests.get', (['api_url'], {}), '(api_url)\n', (2250, 2259), False, '... |
#!/usr/bin/env python3
# encoding=utf8
import argparse
import os
from time import time
from zipfile import ZipFile, BadZipFile
import shutil
from mylib.ext.ostk import clipboard as cb
from mylib.easy import ez_thread_factory
from mylib.__deprecated__ import list_files
from queue import Queue
ap = argparse.ArgumentPars... | [
"zipfile.ZipFile",
"argparse.ArgumentParser",
"shutil.get_terminal_size",
"mylib.easy.ez_thread_factory",
"time.time",
"shutil.move",
"mylib.__deprecated__.list_files",
"os.path.split",
"queue.Queue"
] | [((299, 324), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (322, 324), False, 'import argparse\n'), ((552, 559), 'queue.Queue', 'Queue', ([], {}), '()\n', (557, 559), False, 'from queue import Queue\n'), ((944, 1004), 'mylib.__deprecated__.list_files', 'list_files', (['(src or cb)'], {'recurs... |
import time, cv2, sys, os
from threading import Thread
from djitellopy import Tello
import ffmpeg
video_file="phone_test.avi"
path= "C:/Users/65965/Desktop/School/FYPS2"
path_to_weights= f"{path}/yolov5/weights/v8best.pt"
def videoRecorder():
height, width, _ = frame_read.frame.shape
video = cv2.VideoWriter... | [
"threading.Thread",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"os.system",
"djitellopy.Tello",
"time.sleep",
"sys.exit"
] | [((1171, 1178), 'djitellopy.Tello', 'Tello', ([], {}), '()\n', (1176, 1178), False, 'from djitellopy import Tello\n'), ((1387, 1400), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1397, 1400), False, 'import time, cv2, sys, os\n'), ((1443, 1456), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1453, 1456), ... |
"""Tests that implementations in engine package are runnable."""
import unittest
import deep_learning.experimental.other_runners
from deep_learning.engine import environment_impl
from deep_learning.engine import policy_impl
from deep_learning.engine import qfunc_impl
from deep_learning.engine import runner_impl
cla... | [
"deep_learning.engine.runner_impl.SimpleRunner",
"deep_learning.engine.runner_impl.ExperienceReplayRunner",
"deep_learning.engine.environment_impl.SingleStateEnvironment",
"deep_learning.engine.qfunc_impl.MemoizationQFunction",
"deep_learning.engine.policy_impl.GreedyPolicy",
"deep_learning.engine.policy_... | [((397, 472), 'deep_learning.engine.environment_impl.SingleStateEnvironment', 'environment_impl.SingleStateEnvironment', ([], {'action_space_size': '(1)', 'step_limit': '(10)'}), '(action_space_size=1, step_limit=10)\n', (436, 472), False, 'from deep_learning.engine import environment_impl\n'), ((497, 593), 'deep_learn... |
import os, random, shutil
def moveFile(fileDir):
pathDir = os.listdir(fileDir) #取图片的原始路径
picknumber = 800
print(picknumber)
sample = random.sample(pathDir, picknumber)
tsample = []
for it in sample:
tsample.append(it.split('.')[0] + '.tif')
# print ... | [
"random.sample",
"os.listdir",
"shutil.move"
] | [((67, 86), 'os.listdir', 'os.listdir', (['fileDir'], {}), '(fileDir)\n', (77, 86), False, 'import os, random, shutil\n'), ((168, 202), 'random.sample', 'random.sample', (['pathDir', 'picknumber'], {}), '(pathDir, picknumber)\n', (181, 202), False, 'import os, random, shutil\n'), ((517, 559), 'shutil.move', 'shutil.mov... |
# Toy problem from the textbook: Romanian road map
from pygraphml import Graph, GraphMLParser
romania = Graph()
oradea = romania.add_node("Oradea")
zerind = romania.add_node("Zerind")
arad = romania.add_node("Arad")
sibiu = romania.add_node("Sibiu")
fagaras = romania.add_node("Fagaras")
timisoara = romania.add_node(... | [
"pygraphml.GraphMLParser",
"pygraphml.Graph"
] | [((106, 113), 'pygraphml.Graph', 'Graph', ([], {}), '()\n', (111, 113), False, 'from pygraphml import Graph, GraphMLParser\n'), ((2611, 2626), 'pygraphml.GraphMLParser', 'GraphMLParser', ([], {}), '()\n', (2624, 2626), False, 'from pygraphml import Graph, GraphMLParser\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
from PIL import Image
import pylab as pl
import matplotlib.cm as cm
def int2B(pat, binary=True):
_ = np.array(pat, float)
for i in range(len(_)):
for j in range(len(_[i])):
if binary:
if pat[i][j] > 130:
... | [
"numpy.array",
"PIL.Image.open"
] | [((169, 189), 'numpy.array', 'np.array', (['pat', 'float'], {}), '(pat, float)\n', (177, 189), True, 'import numpy as np\n'), ((613, 645), 'PIL.Image.open', 'Image.open', (['"""data/picture/1.jpg"""'], {}), "('data/picture/1.jpg')\n", (623, 645), False, 'from PIL import Image\n'), ((676, 708), 'PIL.Image.open', 'Image.... |
import logging
#-----------------------
# Logger
#-----------------------
class LoggerFactory():
def __init__(self):
pass
def getLogger(self, name):
logger = logging.getLogger(name)
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((184, 207), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (201, 207), False, 'import logging\n'), ((221, 244), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (242, 244), False, 'import logging\n'), ((299, 372), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - ... |
import gepify
from . import GepifyTestCase
from flask import url_for, session, g
import spotipy
from urllib import parse
from unittest import mock
from gepify.services import spotify
from gepify.providers import songs
from werkzeug.contrib.cache import SimpleCache
import json
import os
import time
class MockResponse:... | [
"gepify.services.spotify.models.save_token_data_in_session",
"os.remove",
"gepify.services.spotify.models.get_username",
"gepify.services.spotify.models.get_access_token_from_refresh_token",
"os.getcwd",
"werkzeug.contrib.cache.SimpleCache",
"urllib.parse.urlparse",
"gepify.services.spotify.models.get... | [((3825, 3889), 'unittest.mock.patch', 'mock.patch', (['"""requests.post"""'], {'side_effect': 'mocked_spotify_api_post'}), "('requests.post', side_effect=mocked_spotify_api_post)\n", (3835, 3889), False, 'from unittest import mock\n'), ((2923, 2987), 'unittest.mock.patch', 'mock.patch', (['"""requests.post"""'], {'sid... |
"""
Default Configuration
Do NOT change the values here for risk of accidentally committing them.
Use the appropriate environment variable or create a local_config.py instead.
"""
import os
DEBUG = os.environ.get('DEBUG')
HOST = os.environ.get('HOST', 'localhost')
PORT = int(os.environ.get('PORT', 5000))
SPARKPOS... | [
"os.environ.get"
] | [((202, 225), 'os.environ.get', 'os.environ.get', (['"""DEBUG"""'], {}), "('DEBUG')\n", (216, 225), False, 'import os\n'), ((233, 268), 'os.environ.get', 'os.environ.get', (['"""HOST"""', '"""localhost"""'], {}), "('HOST', 'localhost')\n", (247, 268), False, 'import os\n'), ((332, 367), 'os.environ.get', 'os.environ.ge... |
#!/usr/bin/env python
from __future__ import print_function
try: input = raw_input
except: pass
# usage: python break-contigs-vs-truth.py <k> [input.txt]
# input.txt:
# <master> :string
# <query1> :string
# <query2> :string
# ...
#
# Output:
# <contig-id> <ref-strand> <ref-start> <contig-substr>
# ...
#
# For ea... | [
"collections.defaultdict",
"fileinput.input",
"pyRBT.pyRBT"
] | [((6621, 6638), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (6632, 6638), False, 'from collections import defaultdict\n'), ((6952, 6973), 'fileinput.input', 'fileinput.input', (['path'], {}), '(path)\n', (6967, 6973), False, 'import fileinput\n'), ((7003, 7016), 'pyRBT.pyRBT', 'pyRBT.pyRBT', (... |
# -*- test-case-name: nevow.test.test_context -*-
# Copyright (c) 2004 Divmod.
# See LICENSE for details.
import itertools
import time
import zope.interface as zi
from twisted.python.components import registerAdapter
from nevow import context
from nevow import tags
from nevow import inevow
from nevow.testutil impor... | [
"time.clock",
"itertools.count",
"nevow.context.WovenContext",
"nevow.context.PageContext",
"nevow.tags.invisible",
"twisted.python.components.registerAdapter"
] | [((3566, 3614), 'twisted.python.components.registerAdapter', 'registerAdapter', (['dummyAdapter', 'TestContext', 'IFoo'], {}), '(dummyAdapter, TestContext, IFoo)\n', (3581, 3614), False, 'from twisted.python.components import registerAdapter\n'), ((3742, 3759), 'itertools.count', 'itertools.count', ([], {}), '()\n', (3... |
import typing
from inspect import isclass, getsource
from typing import Callable, Any, Type
import typeguard
from parachute.validators.base import ValidatedArgument
def is_literal(value: Any) -> bool:
return not is_type(value)
def is_type(value: Any) -> bool:
"""
Whether a value is a python `type`, suc... | [
"inspect.isclass",
"inspect.getsource",
"typeguard.check_type"
] | [((1784, 1803), 'inspect.getsource', 'getsource', (['function'], {}), '(function)\n', (1793, 1803), False, 'from inspect import isclass, getsource\n'), ((435, 449), 'inspect.isclass', 'isclass', (['value'], {}), '(value)\n', (442, 449), False, 'from inspect import isclass, getsource\n'), ((1010, 1024), 'inspect.isclass... |
import os, sys
from distutils.core import setup, Extension
from distutils import sysconfig
cpp_args = ['-std=c++11','-mmacosx-version-min=10.7','-stdlib=libc++']
ext_modules = [
Extension(
'mcts',
['MCTS.cpp', 'binding.cpp'],
include_dirs=['pybind11/include'],
language='c++',
extra_... | [
"distutils.core.Extension",
"distutils.core.setup"
] | [((355, 477), 'distutils.core.setup', 'setup', ([], {'name': '"""mcts"""', 'version': '"""0.0.1"""', 'author': '"""wxw"""', 'author_email': '"""<EMAIL>"""', 'description': '"""MCTS"""', 'ext_modules': 'ext_modules'}), "(name='mcts', version='0.0.1', author='wxw', author_email='<EMAIL>',\n description='MCTS', ext_mod... |
from pystac.extensions.eo import Band
ABI_CHANNEL_BANDS = {
1:
Band.create(common_name="blue",
name="ABI Band 1",
description="Daytime aerosol over land, coastal water mapping",
center_wavelength=0.47),
2:
Band.create(common_name="red",
na... | [
"pystac.extensions.eo.Band.create"
] | [((72, 215), 'pystac.extensions.eo.Band.create', 'Band.create', ([], {'common_name': '"""blue"""', 'name': '"""ABI Band 1"""', 'description': '"""Daytime aerosol over land, coastal water mapping"""', 'center_wavelength': '(0.47)'}), "(common_name='blue', name='ABI Band 1', description=\n 'Daytime aerosol over land, ... |
import os
from PyQt5.QtWidgets import QFileDialog, QLineEdit, QShortcut
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtGui import QKeySequence
from .ValidateView import ValidateView
class ValidateWidget(ValidateView):
moveSignal = pyqtSignal(str, bool)
def __init__(self):
super().__init... | [
"PyQt5.QtCore.pyqtSignal",
"os.mkdir",
"PyQt5.QtGui.QKeySequence",
"os.path.exists",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWidgets.QFileDialog"
] | [((251, 272), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['str', 'bool'], {}), '(str, bool)\n', (261, 272), False, 'from PyQt5.QtCore import pyqtSignal, pyqtSlot\n'), ((1618, 1637), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', (['QLineEdit'], {}), '(QLineEdit)\n', (1626, 1637), False, 'from PyQt5.QtCore import pyqtSignal, pyqtS... |
from collections import namedtuple, OrderedDict
from pyqtgraph.parametertree import parameterTypes, ParameterTree, Parameter
from ..pipeline import Pipeline
from ..nodes import (
sources as source_nodes,
processors as processor_nodes,
outputs as output_nodes
)
from .node_controls import (
sources as s... | [
"collections.namedtuple",
"pyqtgraph.parametertree.parameterTypes.ListParameter"
] | [((522, 588), 'collections.namedtuple', 'namedtuple', (['"""NodeControlClasses"""', "['node_class', 'controls_class']"], {}), "('NodeControlClasses', ['node_class', 'controls_class'])\n", (532, 588), False, 'from collections import namedtuple, OrderedDict\n'), ((4771, 4870), 'pyqtgraph.parametertree.parameterTypes.List... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import nvidia.dali.ops as ops
import nvidia.dali.types as types
import torch.utils.data
from nvidia.dali.pipeline import Pipeline
from nvidia.dali.plugin.pytorch import DALIClassificationIterator
import multiprocessing as mp
mp.set_st... | [
"nvidia.dali.ops.RandomResizedCrop",
"multiprocessing.set_start_method",
"nvidia.dali.ops.Resize",
"nvidia.dali.ops.CropMirrorNormalize",
"nvidia.dali.ops.FileReader",
"nvidia.dali.plugin.pytorch.DALIClassificationIterator",
"nvidia.dali.ops.CoinFlip",
"nvidia.dali.ops.ColorTwist",
"nvidia.dali.ops.... | [((311, 339), 'multiprocessing.set_start_method', 'mp.set_start_method', (['"""spawn"""'], {}), "('spawn')\n", (330, 339), True, 'import multiprocessing as mp\n'), ((756, 860), 'nvidia.dali.ops.FileReader', 'ops.FileReader', ([], {'file_root': 'data_dir', 'shard_id': 'local_rank', 'num_shards': 'world_size', 'random_sh... |
import numpy as np
from ...utils import transform_utils as T
from .base_interpolator import Interpolator
class LinearInterpolator(Interpolator):
"""
Simple class for implementing a linear interpolator.
Abstracted to interpolate n-dimensions
Args:
max_delta: Maximum single change in dx allowe... | [
"numpy.array",
"numpy.ceil"
] | [((2000, 2051), 'numpy.ceil', 'np.ceil', (['(ramp_ratio * controller_freq / policy_freq)'], {}), '(ramp_ratio * controller_freq / policy_freq)\n', (2007, 2051), True, 'import numpy as np\n'), ((3292, 3306), 'numpy.array', 'np.array', (['goal'], {}), '(goal)\n', (3300, 3306), True, 'import numpy as np\n')] |
from Config import SUDO, ADMINCHAT, CHANNEL, GROUP, LINK, BOT_USERNAME
from Config import API_ID, API_HASH, BOT_TOKEN
from pyrogram import Client, filters
from pyrogram.types import *
from MongoDB import *
import asyncio
bot = Client(
'Shaaak',
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN,
)
... | [
"pyrogram.Client",
"Config.LINK.format",
"pyrogram.filters.chat",
"pyrogram.filters.command"
] | [((229, 300), 'pyrogram.Client', 'Client', (['"""Shaaak"""'], {'api_id': 'API_ID', 'api_hash': 'API_HASH', 'bot_token': 'BOT_TOKEN'}), "('Shaaak', api_id=API_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)\n", (235, 300), False, 'from pyrogram import Client, filters\n'), ((337, 388), 'pyrogram.filters.command', 'filters.co... |
# -*- coding: utf-8 -*-
# Copyright 2015 OpenMarket 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 l... | [
"unpaddedbase64.decode_base64",
"signedjson.sign.sign_json"
] | [((742, 764), 'unpaddedbase64.decode_base64', 'decode_base64', (['"""<KEY>"""'], {}), "('<KEY>')\n", (755, 764), False, 'from unpaddedbase64 import decode_base64\n'), ((1287, 1328), 'signedjson.sign.sign_json', 'sign_json', (['{}', '"""domain"""', 'self.signing_key'], {}), "({}, 'domain', self.signing_key)\n", (1296, 1... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from config import app_config
db = SQLAlchemy()
def create_app(config_name):
application = Flask(__name__, instance_relative_config=True)
application.config.from_object(app_config[config_name])
application.con... | [
"flask.Flask",
"flask_sqlalchemy.SQLAlchemy",
"flask_migrate.Migrate"
] | [((134, 146), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (144, 146), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((194, 240), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (199, 240), False, 'from flask import ... |
#!/usr/bin/env python
import json
import sys
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
try:
# since pip 19.3
from pip._internal.network.session import PipSession
except ImportError:
try:
# since pip 10
f... | [
"pip.download.PipSession",
"pip._vendor.pkg_resources.working_set.resolve",
"json.dumps"
] | [((1299, 1319), 'json.dumps', 'json.dumps', (['packages'], {}), '(packages)\n', (1309, 1319), False, 'import json\n'), ((570, 582), 'pip.download.PipSession', 'PipSession', ([], {}), '()\n', (580, 582), False, 'from pip.download import PipSession\n'), ((1251, 1290), 'pip._vendor.pkg_resources.working_set.resolve', 'pkg... |
import sys
from subprocess import call
import os
"""
Transform all pdf files in input text file to text, keep the same names
and add a txt_extracted directory
Requirement: install imagemagick on Mac for pdftotext command to work
To generate the list of pdf files to be transcripted we used
`ls data/slf/**/nb/**/*_fr_... | [
"os.path.split",
"os.path.join",
"os.path.splitext",
"subprocess.call"
] | [((607, 632), 'os.path.split', 'os.path.split', (['input_file'], {}), '(input_file)\n', (620, 632), False, 'import os\n'), ((655, 681), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (671, 681), False, 'import os\n'), ((795, 844), 'os.path.join', 'os.path.join', (['output_directory', "(base... |
import re
import pytest
import numpy as np
import torch
from obp.types import BanditFeedback
from obp.ope import (
DirectMethod,
DoublyRobust,
DoublyRobustWithShrinkage,
SwitchDoublyRobust,
SelfNormalizedDoublyRobust,
)
from conftest import generate_action_dist
# prepare instances
dm = DirectMeth... | [
"torch.ones",
"numpy.random.uniform",
"obp.ope.SelfNormalizedDoublyRobust",
"numpy.abs",
"conftest.generate_action_dist",
"numpy.zeros",
"numpy.ones",
"re.escape",
"obp.ope.DoublyRobustWithShrinkage",
"pytest.raises",
"obp.ope.SwitchDoublyRobust",
"numpy.arange",
"numpy.random.choice",
"to... | [((310, 324), 'obp.ope.DirectMethod', 'DirectMethod', ([], {}), '()\n', (322, 324), False, 'from obp.ope import DirectMethod, DoublyRobust, DoublyRobustWithShrinkage, SwitchDoublyRobust, SelfNormalizedDoublyRobust\n'), ((330, 344), 'obp.ope.DoublyRobust', 'DoublyRobust', ([], {}), '()\n', (342, 344), False, 'from obp.o... |
import numpy as np
from chainer import cuda, Link, Chain, ChainList
from chainer.training import extension
def _namedpersistents_as_link(target):
assert isinstance(target, Link)
d = target.__dict__
for name in target._persistent:
yield '/' + name, d[name]
def _namedpersistents_as_chain(target):... | [
"chainer.cuda.get_device_from_array",
"chainer.cuda.get_array_module",
"chainer.cuda.elementwise",
"numpy.array",
"chainer.cuda.to_gpu"
] | [((3435, 3464), 'chainer.cuda.get_device_from_array', 'cuda.get_device_from_array', (['p'], {}), '(p)\n', (3461, 3464), False, 'from chainer import cuda, Link, Chain, ChainList\n'), ((3596, 3699), 'chainer.cuda.elementwise', 'cuda.elementwise', (['"""T p, T decay"""', '"""T s"""', '"""s -= (1 - decay) * (s - p)"""', '"... |
#!/usr/bin/env python
import rospy
import os
import matplotlib.pyplot as plt
import pickle
from tello_driver.msg import TelloStatus
import numpy as np
import atexit
import datetime
RECORD_BATTERY = False
class BatteryLogPlot(object):
def __init__(self):
# current variables
self.zero_time = rospy... | [
"atexit.register",
"matplotlib.pyplot.show",
"rospy.Time.now",
"rospy.Subscriber",
"datetime.datetime.now",
"rospy.loginfo",
"matplotlib.pyplot.figure",
"numpy.arange",
"rospy.init_node",
"rospy.spin",
"matplotlib.pyplot.grid",
"os.getenv"
] | [((4337, 4349), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (4347, 4349), True, 'import matplotlib.pyplot as plt\n'), ((6745, 6768), 'matplotlib.pyplot.grid', 'plt.grid', ([], {'linewidth': '(0.5)'}), '(linewidth=0.5)\n', (6753, 6768), True, 'import matplotlib.pyplot as plt\n'), ((6772, 6782), 'matplotl... |
# import libraries
from imutils.face_utils import rect_to_bb
import imutils
import dlib
import cv2
import os
import sys
import time
TGT_WIDTH = 800 # set final width for image to be scaled to
TGT_AR = 0.71 # set desired aspect ratio
DET_WIDTH = 500 # set width to scal... | [
"os.mkdir",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"time.time",
"cv2.imread",
"imutils.face_utils.rect_to_bb",
"os.path.splitext",
"dlib.get_frontal_face_detector",
"imutils.resize",
"dlib.shape_predictor",
"os.listdir",
"sys.exit"
] | [((2969, 3001), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (2999, 3001), False, 'import dlib\n'), ((3014, 3075), 'dlib.shape_predictor', 'dlib.shape_predictor', (['"""shape_predictor_68_face_landmarks.dat"""'], {}), "('shape_predictor_68_face_landmarks.dat')\n", (3034, 3075), ... |
# This file is initialized with a code version of this
# question's sample test case. Feel free to add, edit,
# or remove test cases in this file as you see fit!
import program
import unittest
def isMinHeapPropertySatisfied(array):
for currentIdx in range(1, len(array)):
parentIdx = (currentIdx... | [
"program.MinHeap"
] | [((514, 583), 'program.MinHeap', 'program.MinHeap', (['[48, 12, 24, 7, 8, -5, 24, 391, 24, 56, 2, 6, 8, 41]'], {}), '([48, 12, 24, 7, 8, -5, 24, 391, 24, 56, 2, 6, 8, 41])\n', (529, 583), False, 'import program\n')] |
import os.path
import argparse
import boto3
from botocore.exceptions import ClientError
class S3Uploader:
def __init__(self):
pass
def upload_file(self, file_name, bucket, object_name=None):
"""Upload a file to an S3 bucket
:param file_name: File to upload
:param bucket: Bucket to upload to
:param obj... | [
"argparse.ArgumentParser",
"boto3.client"
] | [((815, 840), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (838, 840), False, 'import argparse\n'), ((603, 621), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (615, 621), False, 'import boto3\n')] |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import math
test_scores=[88,92,79,93,85]
print(np.mean(test_scores))
curved_5=[score + 5 for score in test_scores]
print(np.mean(curved_5))
curved_10=[score + 10 for score in test_scores]
print(np.mean(curved_10))
curved_sqrt=[math.sqrt(score)*10... | [
"numpy.mean",
"math.sqrt"
] | [((110, 130), 'numpy.mean', 'np.mean', (['test_scores'], {}), '(test_scores)\n', (117, 130), True, 'import numpy as np\n'), ((188, 205), 'numpy.mean', 'np.mean', (['curved_5'], {}), '(curved_5)\n', (195, 205), True, 'import numpy as np\n'), ((265, 283), 'numpy.mean', 'np.mean', (['curved_10'], {}), '(curved_10)\n', (27... |
# Get the subtitles
# Find and print a subtitle of the article by an index. The index of
# the subtitle is the first line in the input, and the link to the
# article is the second one. For example, your code should print
# The Definite Article for the following input:
# 1
# https://www.grammarly.com/blog/articles/
#... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((530, 547), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (542, 547), False, 'import requests\n'), ((555, 594), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n", (568, 594), False, 'from bs4 import BeautifulSoup\n')] |
import brownie
def test_security_1(TestSecurity1, testERC20, testERC721, deployer, accounts, chain):
# - can be paused by operator or governance
# - unpaused only by governance
# - withdraw only whenPaused by governance
# - governance operator change addresses
operator = accounts[1]
governanc... | [
"brownie.reverts"
] | [((540, 586), 'brownie.reverts', 'brownie.reverts', (['"""Only Operator or Governance"""'], {}), "('Only Operator or Governance')\n", (555, 586), False, 'import brownie\n'), ((799, 833), 'brownie.reverts', 'brownie.reverts', (['"""Only Governance"""'], {}), "('Only Governance')\n", (814, 833), False, 'import brownie\n'... |
# see https://www.firedrakeproject.org/demos/stokes.py.html
# (see also https://www.firedrakeproject.org/matrix-free.html)
# CHANGES: stdout & comments mods/declutter, timing
# TODO: see if I can get any performance improvement in 3D; none obvious here
# Stokes Equations: lid-driven cavity.
import time
from firedra... | [
"time.time"
] | [((4449, 4460), 'time.time', 'time.time', ([], {}), '()\n', (4458, 4460), False, 'import time\n'), ((5533, 5544), 'time.time', 'time.time', ([], {}), '()\n', (5542, 5544), False, 'import time\n'), ((4545, 4556), 'time.time', 'time.time', ([], {}), '()\n', (4554, 4556), False, 'import time\n'), ((5629, 5640), 'time.time... |
# todo: Discussion Related With Outliers And Impact On Machine Learning!!
# todo: Which Machine LEarning Models Are Sensitive To Outliers?
# 1. Naivye Bayes Classifier--- Not Sensitive To Outliers
# 2. SVM-------- Not Sensitive To Outliers
# 3. Linear Regression---------- Sensitive To Outlier... | [
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.roc_auc_score"
] | [((1036, 1062), 'pandas.read_csv', 'pd.read_csv', (['"""titanic.csv"""'], {}), "('titanic.csv')\n", (1047, 1062), True, 'import pandas as pd\n'), ((3469, 3489), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (3487, 3489), False, 'from sklearn.linear_model import LogisticRegression\n'... |
# Purpose: auditor module
# Created: 10.03.2017
# Copyright (c) 2017-2020, <NAME>
# License: MIT License
"""
audit(drawing, stream): check a DXF drawing for errors.
"""
from enum import IntEnum
from typing import TYPE_CHECKING, Iterable, List, Set, TextIO, Any, Dict
import sys
from ezdxf.lldxf.types import is_pointer_... | [
"ezdxf.lldxf.validator.is_valid_layer_name",
"ezdxf.lldxf.types.is_pointer_code",
"ezdxf.lldxf.validator.is_adsk_special_layer"
] | [((1551, 1576), 'ezdxf.lldxf.types.is_pointer_code', 'is_pointer_code', (['tag.code'], {}), '(tag.code)\n', (1566, 1576), False, 'from ezdxf.lldxf.types import is_pointer_code, DXFTag\n'), ((8660, 8685), 'ezdxf.lldxf.validator.is_valid_layer_name', 'is_valid_layer_name', (['name'], {}), '(name)\n', (8679, 8685), False,... |
import hashlib
import os
from dotenv import load_dotenv
from passlib.hash import sha256_crypt, bcrypt, bcrypt_sha256
import jwt
from datetime import datetime
load_dotenv()
def md5(str):
return hashlib.md5(str.encode('utf-8')).hexdigest()
def hash_sha256(text):
return sha256_crypt.hash(text)
def verify_sha25... | [
"passlib.hash.bcrypt_sha256.verify",
"jwt.encode",
"passlib.hash.bcrypt.hash",
"dotenv.load_dotenv",
"datetime.datetime.utcnow",
"passlib.hash.sha256_crypt.hash",
"passlib.hash.bcrypt.verify",
"passlib.hash.sha256_crypt.verify",
"passlib.hash.bcrypt_sha256.hash"
] | [((158, 171), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (169, 171), False, 'from dotenv import load_dotenv\n'), ((279, 302), 'passlib.hash.sha256_crypt.hash', 'sha256_crypt.hash', (['text'], {}), '(text)\n', (296, 302), False, 'from passlib.hash import sha256_crypt, bcrypt, bcrypt_sha256\n'), ((346, 377), ... |
from django.db import models
from tests.models import Test, Question, Option
# Create your models here.
class Participant(models.Model):
name = models.CharField(max_length=120)
email = models.EmailField(max_length=254)
test = models.ForeignKey(Test, on_delete=models.CASCADE)
finished = models.BooleanFi... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.EmailField"
] | [((149, 181), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(120)'}), '(max_length=120)\n', (165, 181), False, 'from django.db import models\n'), ((194, 227), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(254)'}), '(max_length=254)\n', (211, 227), False, 'from django... |
from mypy.types import Instance, Type
from mypy_drf_plugin import helpers
def make_field_repr_not_return_any_generics():
from mypy import messages
# format_bare
old_format_bare = messages.MessageBuilder.format_bare
def patched_format_bare(self, typ: Type, verbosity: int = 0) -> str:
if isin... | [
"mypy_drf_plugin.helpers.reparametrize_instance"
] | [((407, 446), 'mypy_drf_plugin.helpers.reparametrize_instance', 'helpers.reparametrize_instance', (['typ', '[]'], {}), '(typ, [])\n', (437, 446), False, 'from mypy_drf_plugin import helpers\n')] |
#eci_ecef_conversions.py
#<NAME> (nhz2)
#November 24, 2019
# using examples from https://astropy.readthedocs.io/en/latest/coordinates/velocities.html
"""Module for using astropy to convert between ECI and ECEF coordinates and velocities"""
import astropy.units as u
from astropy.coordinates import (ITRS,GCRS)
from astro... | [
"astropy.time.Time",
"numpy.cov",
"numpy.array"
] | [((638, 712), 'astropy.time.Time', 'Time', (['(init_gps_weeknum * 7 * 24 * 60 * 60)', 'time'], {'scale': '"""tai"""', 'format': '"""gps"""'}), "(init_gps_weeknum * 7 * 24 * 60 * 60, time, scale='tai', format='gps')\n", (642, 712), False, 'from astropy.time import Time\n'), ((2277, 2294), 'numpy.array', 'np.array', (['v... |
# Copyright 2020 DeepMind Technologies Limited.
#
# 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 ag... | [
"dm_robotics.agentflow.rendering.graphviz_renderer.open_viewer",
"dm_robotics.agentflow.meta_options.control_flow.examples.common.DummyEnv",
"dm_robotics.agentflow.subtask.SubTaskOption",
"dm_robotics.agentflow.meta_options.control_flow.cond.Cond",
"absl.app.run",
"dm_robotics.agentflow.meta_options.contr... | [((1544, 1561), 'dm_robotics.agentflow.meta_options.control_flow.examples.common.DummyEnv', 'common.DummyEnv', ([], {}), '()\n', (1559, 1561), False, 'from dm_robotics.agentflow.meta_options.control_flow.examples import common\n'), ((2003, 2073), 'dm_robotics.agentflow.subtask.SubTaskOption', 'subtask.SubTaskOption', (... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Date: 2018-08-10 19:31:47
"""
from __future__ import absolute_import, division, print_function
import csv
import os
import numpy as np
np.random.seed(0)
ratio = 0.9
def gen_lines(path, d):
path = os.path.join(path, d)
lines = []
for f ... | [
"numpy.random.seed",
"csv.writer",
"os.path.join",
"os.listdir",
"numpy.random.shuffle"
] | [((212, 229), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (226, 229), True, 'import numpy as np\n'), ((1097, 1127), 'numpy.random.shuffle', 'np.random.shuffle', (['train_lines'], {}), '(train_lines)\n', (1114, 1127), True, 'import numpy as np\n'), ((1128, 1158), 'numpy.random.shuffle', 'np.random.shu... |
"""
The transpiler module is responsible for converting shellcode into x86 asm and
vice versa.
"""
#pylint: disable=wrong-import-position
import os
import sys
MODULE_DIR_NAME = os.path.dirname(os.path.realpath(__file__))
if MODULE_DIR_NAME not in sys.path:
sys.path.insert(0, MODULE_DIR_NAME)
from pwn import a... | [
"pwn.disasm",
"pwn.asm",
"os.path.realpath",
"sys.path.insert",
"pwn.context.clear"
] | [((349, 375), 'pwn.context.clear', 'context.clear', ([], {'arch': '"""i686"""'}), "(arch='i686')\n", (362, 375), False, 'from pwn import asm, context, disasm, unhex\n'), ((376, 401), 'pwn.context.clear', 'context.clear', ([], {'os': '"""linux"""'}), "(os='linux')\n", (389, 401), False, 'from pwn import asm, context, di... |
import unittest
from pytopojson import (
extract,
join,
)
class JoinTestCase(unittest.TestCase):
def setUp(self):
self.extract = extract.Extract()
self.join = join.Join()
def test_join_the_returned_hashmap_has_true_for_junction_points(self):
junctions = self.join(
... | [
"pytopojson.extract.Extract",
"pytopojson.join.Join"
] | [((152, 169), 'pytopojson.extract.Extract', 'extract.Extract', ([], {}), '()\n', (167, 169), False, 'from pytopojson import extract, join\n'), ((190, 201), 'pytopojson.join.Join', 'join.Join', ([], {}), '()\n', (199, 201), False, 'from pytopojson import extract, join\n')] |
import os
import pytest
import json
import test
from test import dbtvault_generator
from test import dbtvault_harness_utils
from . import structure_metadata
from filelock import FileLock
mark_metadata_mapping = {
"single_source_hub": structure_metadata.single_source_hub,
"single_source_multi_nk_hub": structur... | [
"test.dbtvault_harness_utils.clean_models",
"test.dbtvault_harness_utils.clean_target",
"test.dbtvault_harness_utils.replace_test_schema",
"pytest.fixture",
"json.dumps",
"test.dbtvault_harness_utils.setup_environment",
"test.dbtvault_harness_utils.run_dbt_seeds",
"os.chdir",
"test.dbtvault_generato... | [((632, 648), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (646, 648), False, 'import pytest\n'), ((1865, 1910), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (1879, 1910), False, 'import pytest\n'), ((1981, 2013), 'os.chdir', 'o... |
import cv2
import numpy as np
import glob
import math
import scipy
from scipy.spatial import distance
from scipy import signal
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
#modulating function as defined in ... | [
"numpy.absolute",
"math.sqrt",
"scipy.signal.convolve2d",
"numpy.zeros",
"numpy.mean",
"numpy.exp"
] | [((663, 679), 'numpy.zeros', 'np.zeros', (['(8, 8)'], {}), '((8, 8))\n', (671, 679), True, 'import numpy as np\n'), ((2311, 2365), 'scipy.signal.convolve2d', 'scipy.signal.convolve2d', (['img_roi', 'filter1'], {'mode': '"""same"""'}), "(img_roi, filter1, mode='same')\n", (2334, 2365), False, 'import scipy\n'), ((2382, ... |
import hashlib
from copy import copy
def create_hash(Input, hashfunction=hashlib.sha256):
if type(Input) is str:
h = hashfunction()
h.update(bytes(Input, "utf-8"))
return h.hexdigest()
def hash_cracker_v4(inputHash, debug=False, hashfunction=hashlib.sha256):
chars = "default";
if debug:
chars = input("Chara... | [
"copy.copy"
] | [((1081, 1092), 'copy.copy', 'copy', (['chars'], {}), '(chars)\n', (1085, 1092), False, 'from copy import copy\n')] |
#export
import matplotlib
import matplotlib.pyplot as plt
from datetime import datetime
import glob
import emoji
import numpy as np
import seaborn as sns
def convert(year,month,date):
return int(datetime(year, month, date, 0, 0, 0).timestamp()*1000)
def convert_reverse(timestamp):
dt_object = datetime.fromti... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.axvline",
"numpy.trace",
"seaborn.heatmap",
"numpy.sum",
"emoji.demojize",
"datetime.datetime.fromtimestamp",
"numpy.asarray",
"matplotlib.pyplot.rcParams.get",
"datetime.datetime",
"matplotlib.pyplot.figure",
"glob.glob",
"matplotlib.pyplot.ylab... | [((305, 345), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(timestamp / 1000)'], {}), '(timestamp / 1000)\n', (327, 345), False, 'from datetime import datetime\n'), ((762, 811), 'matplotlib.pyplot.axvline', 'plt.axvline', (['day_start'], {'linestyle': '"""--"""', 'color': '"""r"""'}), "(day_start, li... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import xmltodict
try:
from lxml import etree
except ImportError:
import xml.etree.ElementTree as etree
from .record import ... | [
"xml.etree.ElementTree.parse",
"xmltodict.parse",
"logging.getLogger",
"xml.etree.ElementTree.tostring"
] | [((336, 363), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (353, 363), False, 'import logging\n'), ((444, 460), 'xml.etree.ElementTree.parse', 'etree.parse', (['res'], {}), '(res)\n', (455, 460), True, 'import xml.etree.ElementTree as etree\n'), ((8613, 8665), 'xml.etree.ElementTree.tos... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class BrandItem(scrapy.Item):
# define the fields for your item here like:
name = scrapy.Field()
url = scrapy.Field()
id = scrapy.Field(... | [
"scrapy.Field"
] | [((258, 272), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (270, 272), False, 'import scrapy\n'), ((283, 297), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (295, 297), False, 'import scrapy\n'), ((307, 321), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (319, 321), False, 'import scrapy\n'), ((425, 439), ... |
import unittest
from double_palindromes import *
class TestDoublePalindromes(unittest.TestCase):
def test_double_palindromes(self):
self.assertTrue([1], double_palindromes(2))
self.assertTrue([1, 3], double_palindromes(4))
self.assertTrue([1, 3, 5], double_palindromes(6))
self.ass... | [
"unittest.main"
] | [((635, 650), 'unittest.main', 'unittest.main', ([], {}), '()\n', (648, 650), False, 'import unittest\n')] |
from typing import Optional
from pydash import get
from scieldas.api import API
from scieldas.services import ServiceAPI
class Crates(ServiceAPI):
base_url = "https://crates.io/api/v1/crates/"
@ServiceAPI.call
def downloads(self, crate: str, api: API, version: str = None) -> Optional[int]:
if ve... | [
"pydash.get"
] | [((693, 729), 'pydash.get', 'get', (['crate_info', '"""crate.max_version"""'], {}), "(crate_info, 'crate.max_version')\n", (696, 729), False, 'from pydash import get\n'), ((401, 437), 'pydash.get', 'get', (['crate_info', '"""version.downloads"""'], {}), "(crate_info, 'version.downloads')\n", (404, 437), False, 'from py... |
#!/usr/bin/env python3
"""ConfigParser extension that supports nesting"""
import collections
import configparser
class NestedConfigParser(configparser.ConfigParser):
"""ConfigParser implementation that supports nested lookups"""
def __init__(self, section_splitter='.', *args, **kwargs):
"""Overrides ... | [
"collections.ChainMap"
] | [((687, 723), 'collections.ChainMap', 'collections.ChainMap', (['self._defaults'], {}), '(self._defaults)\n', (707, 723), False, 'import collections\n'), ((1961, 2009), 'collections.ChainMap', 'collections.ChainMap', (['vardict', '*unified_map.maps'], {}), '(vardict, *unified_map.maps)\n', (1981, 2009), False, 'import ... |
import pandas as pd
metadata = pd.read_csv('C:/Users/aksha/OneDrive/Desktop/Movie Recommender py/movies_metadata.csv', low_memory=False)
metadata = metadata.head(5000)
def Top_List():
C = metadata['vote_average'].mean()
#print(round(float(C), 3))
m = metadata['vote_count'].quantile(0.93)
#p... | [
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.metrics.pairwise.cosine_similarity",
"sklearn.metrics.pairwise.linear_kernel",
"pandas.read_csv",
"sklearn.feature_extraction.text.TfidfVectorizer",
"pandas.Series"
] | [((34, 148), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/aksha/OneDrive/Desktop/Movie Recommender py/movies_metadata.csv"""'], {'low_memory': '(False)'}), "(\n 'C:/Users/aksha/OneDrive/Desktop/Movie Recommender py/movies_metadata.csv',\n low_memory=False)\n", (45, 148), True, 'import pandas as pd\n'), ((1391... |
#!/usr/bin/env python
import time
print("Blinking LED on Grove connector no.2 (Digital I/O)")
gpiopath = "/sys/class/gpio/gpio508/value"
f = open(gpiopath, 'w+')
while (True):
# sys/class/gpio requires 0x0a31 ('1'+LF) for ON and 0x0a30 ('0'+LF) for OFF
# remember bytes have to be inverted!!!!! (endianness)
f.... | [
"time.sleep"
] | [((353, 368), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (363, 368), False, 'import time\n'), ((406, 421), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (416, 421), False, 'import time\n')] |
import os
import cv2
import numpy as np
import lxml.etree as ET
page_folder='moc_dataset/train/moc_train_xml/'
image_folder='moc_dataset/train/moc_train_images/'
pixel_label_folder='moc_dataset/train/moc_train_pixel_label/'
os.mkdir(pixel_label_folder)
for page_file in sorted(os.listdir(page_folder)):
print(page_... | [
"os.mkdir",
"cv2.imwrite",
"numpy.zeros",
"cv2.fillPoly",
"cv2.imread",
"numpy.array",
"lxml.etree.parse",
"os.listdir"
] | [((225, 253), 'os.mkdir', 'os.mkdir', (['pixel_label_folder'], {}), '(pixel_label_folder)\n', (233, 253), False, 'import os\n'), ((279, 302), 'os.listdir', 'os.listdir', (['page_folder'], {}), '(page_folder)\n', (289, 302), False, 'import os\n'), ((334, 387), 'cv2.imread', 'cv2.imread', (["(image_folder + page_file[:-4... |
# ----------------------------------------------------------------------------
# File: processor.py
# Author: <NAME> <<EMAIL>>
# Created: 2015-02-11
# ----------------------------------------------------------------------------
#
#
#
# ---------------------------------------------------------------------------#
f... | [
"datetime.datetime.now",
"json.loads"
] | [((1122, 1136), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1134, 1136), False, 'from datetime import datetime\n'), ((1913, 1940), 'json.loads', 'json.loads', (['self.p.pipeline'], {}), '(self.p.pipeline)\n', (1923, 1940), False, 'import json\n'), ((1232, 1246), 'datetime.datetime.now', 'datetime.now', ... |
import gzip
import os
import shutil
import time
from csv import reader, writer
from typing import List
import aria2p
import pandas as pd
from yaml import safe_load
from maro.cli.data_pipeline.base import DataPipeline, DataTopology
from maro.cli.data_pipeline.utils import StaticParameter, convert, download_file
from m... | [
"os.path.expanduser",
"aria2p.Client",
"csv.reader",
"os.makedirs",
"csv.writer",
"gzip.open",
"pandas.read_csv",
"os.path.exists",
"maro.utils.logger.CliLogger",
"time.sleep",
"maro.utils.exception.cli_exception.CommandError",
"yaml.safe_load",
"maro.cli.data_pipeline.utils.convert",
"mar... | [((424, 448), 'maro.utils.logger.CliLogger', 'CliLogger', ([], {'name': '__name__'}), '(name=__name__)\n', (433, 448), False, 'from maro.utils.logger import CliLogger\n'), ((14588, 14649), 'os.path.join', 'os.path.join', (['StaticParameter.data_root', '"""vm_scheduling/meta"""'], {}), "(StaticParameter.data_root, 'vm_s... |
import quorra
import pandas
df = pandas.DataFrame({'size': [1,2,3,1,2,3], 'rfu': [1,2,3,5,6,7], 'channel': ['fam', 'fam', 'fam', 'ned', 'ned', 'ned']})
plt = quorra.line()\
.data(df, x='size', y='rfu', group='channel')\
.opacity(0.75).lposition("outside")\
.lshape("circle").labelposition("end")
quorra.ex... | [
"pandas.DataFrame",
"quorra.export",
"quorra.line"
] | [((34, 166), 'pandas.DataFrame', 'pandas.DataFrame', (["{'size': [1, 2, 3, 1, 2, 3], 'rfu': [1, 2, 3, 5, 6, 7], 'channel': ['fam',\n 'fam', 'fam', 'ned', 'ned', 'ned']}"], {}), "({'size': [1, 2, 3, 1, 2, 3], 'rfu': [1, 2, 3, 5, 6, 7],\n 'channel': ['fam', 'fam', 'fam', 'ned', 'ned', 'ned']})\n", (50, 166), False,... |
"""add record and player models
Revision ID: d237f5738423
Revises: <PASSWORD>
Create Date: 2021-02-13 20:13:56.173994
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "d237f5738423"
down_revision = "<PASSWORD>"
branch_labels = None
depends_on = None
def upgrad... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"alembic.op.drop_column",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((2773, 2812), 'alembic.op.drop_column', 'op.drop_column', (['"""character"""', '"""position"""'], {}), "('character', 'position')\n", (2787, 2812), False, 'from alembic import op\n'), ((2817, 2852), 'alembic.op.drop_column', 'op.drop_column', (['"""character"""', '"""name"""'], {}), "('character', 'name')\n", (2831, ... |
# -*- coding: utf-8 -*-
'''
runit service module
This module is compatible with the :mod:`service <salt.states.service>` states,
so it can be used to maintain services using the ``provider`` argument:
.. code-block:: yaml
myservice:
service:
- running
- provider: runit
Note that the ``enab... | [
"salt.exceptions.CommandExecutionError",
"os.path.exists",
"os.listdir"
] | [((720, 747), 'os.path.exists', 'os.path.exists', (['service_dir'], {}), '(service_dir)\n', (734, 747), False, 'import os\n'), ((901, 959), 'salt.exceptions.CommandExecutionError', 'CommandExecutionError', (['"""Could not find service directory."""'], {}), "('Could not find service directory.')\n", (922, 959), False, '... |
#!/usr/bin/env python3
import pandas as pd
import sys
import multiprocessing
import numpy as np
import pandas as pd
import sys
import importlib.machinery
import Bio; from Bio import SeqIO
import sequtils
import shutil
import algo
import os
import subprocess
from collections import defaultdict
import json
from Bio.SeqR... | [
"os.mkdir",
"Bio.SeqIO.parse",
"gff3.orfblastp2gff3",
"pandas.read_csv",
"os.path.exists",
"collections.defaultdict",
"Bio.Blast.NCBIXML.parse",
"gff3.gff3_contig_export"
] | [((1064, 1092), 'Bio.Blast.NCBIXML.parse', 'NCBIXML.parse', (['result_handle'], {}), '(result_handle)\n', (1077, 1092), False, 'from Bio.Blast import NCBIXML\n'), ((1117, 1134), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1128, 1134), False, 'from collections import defaultdict\n'), ((1145, 1... |
import click
from PyInquirer import prompt
from cubone.functions import start_project
from cubone.questions import CheckboxQuestion, ListQuestion
@click.group()
def main():
pass
@click.command()
@click.option(
"--path",
"-p",
help="Absolute path where will be created the projects files.",
defau... | [
"cubone.questions.ListQuestion",
"click.option",
"click.command",
"cubone.functions.start_project",
"PyInquirer.prompt",
"click.group",
"cubone.questions.CheckboxQuestion"
] | [((150, 163), 'click.group', 'click.group', ([], {}), '()\n', (161, 163), False, 'import click\n'), ((188, 203), 'click.command', 'click.command', ([], {}), '()\n', (201, 203), False, 'import click\n'), ((205, 329), 'click.option', 'click.option', (['"""--path"""', '"""-p"""'], {'help': '"""Absolute path where will be ... |
#!/home/cc/library/bin/cctools_python
# CCTOOLS_PYTHON_VERSION 2.7 2.6
from datetime import datetime
from work_queue import *
import os
import socket
import sys
import tarfile
def get_port():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
s.cl... | [
"os.remove",
"os.path.basename",
"socket.socket",
"os.path.exists",
"tarfile.open",
"datetime.datetime.now",
"os.listdir",
"sys.exit"
] | [((204, 252), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (217, 252), False, 'import socket\n'), ((750, 781), 'tarfile.open', 'tarfile.open', (['targzname', '"""w:gz"""'], {}), "(targzname, 'w:gz')\n", (762, 781), False, 'import tarfile\n'), ... |
import os
from shared.constants import DefaultValues as DV
import allure
import pytest
from hamcrest import *
from shared.utils.get_image_metadata import get_image_thumb_bytes
# NEEDS REWORK ( hash calculating is incorrect )
@allure.issue("SAN-25", "Send Image")
@pytest.mark.parametrize('d_user', ["2 users"], ind... | [
"allure.issue",
"allure.step",
"allure.testcase",
"allure.title",
"os.path.splitext",
"pytest.mark.parametrize",
"shared.utils.get_image_metadata.get_image_thumb_bytes"
] | [((232, 268), 'allure.issue', 'allure.issue', (['"""SAN-25"""', '"""Send Image"""'], {}), "('SAN-25', 'Send Image')\n", (244, 268), False, 'import allure\n'), ((270, 331), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""d_user"""', "['2 users']"], {'indirect': '(True)'}), "('d_user', ['2 users'], indirect=T... |
#!/usr/bin/env python
import festival
festival.say("Hello World")
| [
"festival.say"
] | [((38, 65), 'festival.say', 'festival.say', (['"""Hello World"""'], {}), "('Hello World')\n", (50, 65), False, 'import festival\n')] |
from importlib import import_module
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from .common.menus import Menu
# Create the navigation menu.
# This is the one and only menu object in the application.
menu = Menu()
# Add our default topics.
menu.addGroup("admin", label=_("... | [
"importlib.import_module",
"django.utils.translation.gettext_lazy"
] | [((317, 327), 'django.utils.translation.gettext_lazy', '_', (['"""admin"""'], {}), "('admin')\n", (318, 327), True, 'from django.utils.translation import gettext_lazy as _\n'), ((368, 377), 'django.utils.translation.gettext_lazy', '_', (['"""help"""'], {}), "('help')\n", (369, 377), True, 'from django.utils.translation... |
import grpc
import simple_pb2
import simple_pb2_grpc
def run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = simple_pb2_grpc.InferenceStub(channel)
def requests():
messages = [simple_pb2.Input(batch_id=i) for i in range(10)]
for msg in messages:
... | [
"simple_pb2.Input",
"grpc.insecure_channel",
"simple_pb2_grpc.InferenceStub"
] | [((76, 116), 'grpc.insecure_channel', 'grpc.insecure_channel', (['"""localhost:50051"""'], {}), "('localhost:50051')\n", (97, 116), False, 'import grpc\n'), ((144, 182), 'simple_pb2_grpc.InferenceStub', 'simple_pb2_grpc.InferenceStub', (['channel'], {}), '(channel)\n', (173, 182), False, 'import simple_pb2_grpc\n'), ((... |
from django.db import models
# Create your models here.
def article_file_path(instance, filename):
'''Returns the path of an associated article file.'''
return 'articles/{0}/{1}'.format(instance.article, filename)
class Article(models.Model):
'''The main model for blog posts.'''
title = models.TextF... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.FileField",
"django.db.models.BooleanField"
] | [((308, 403), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(500)', 'blank': '(True)', 'null': '(False)', 'help_text': '"""The article content."""'}), "(max_length=500, blank=True, null=False, help_text=\n 'The article content.')\n", (324, 403), False, 'from django.db import models\n'), ((44... |
import logging
def adjust_logger():
logger = logging.getLogger()
logger_handler = logging.StreamHandler()
logger.addHandler(logger_handler)
logger_handler.setFormatter(logging.Formatter("\n%(levelname)s: %(message)s"))
logger.setLevel(logging.INFO)
return logger
def get_log_level(log_level_s... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((51, 70), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (68, 70), False, 'import logging\n'), ((92, 115), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (113, 115), False, 'import logging\n'), ((186, 238), 'logging.Formatter', 'logging.Formatter', (['"""\n%(levelname)s: %(message)s"... |
from sys import argv
from src.main import main as vivus
vivus(argv)
| [
"src.main.main"
] | [((57, 68), 'src.main.main', 'vivus', (['argv'], {}), '(argv)\n', (62, 68), True, 'from src.main import main as vivus\n')] |
from geneticAlgorithm import GeneticAlgorithm
import random
class KeyGA(GeneticAlgorithm):
def __init__(self, key):
super().__init__()
self.key = key
def randomChromosome(self): # 隨機產生一個染色體 (一個 16 位元的 01 字串)
bits=[]
for _ in range(len(self.key)):
bit = str(random.ra... | [
"random.choice",
"random.randint"
] | [((311, 331), 'random.randint', 'random.randint', (['(0)', '(1)'], {}), '(0, 1)\n', (325, 331), False, 'import random\n'), ((878, 903), 'random.choice', 'random.choice', (["['0', '1']"], {}), "(['0', '1'])\n", (891, 903), False, 'import random\n')] |
import os
from lib import status
from src import video
from src import extract
import threading
import time
#limit max threads
max_threads = 5
#function to register a thread
#wait until a new thread is avaible, then start a new thread
def thread_get(FILE, PATH):
while True:
if threading.active_count() <= m... | [
"threading.Thread",
"threading.active_count",
"os.path.exists",
"time.sleep",
"lib.status.get"
] | [((543, 563), 'os.path.exists', 'os.path.exists', (['FILE'], {}), '(FILE)\n', (557, 563), False, 'import os\n'), ((291, 315), 'threading.active_count', 'threading.active_count', ([], {}), '()\n', (313, 315), False, 'import threading\n'), ((348, 403), 'threading.Thread', 'threading.Thread', ([], {'target': 'extract.get'... |
#!/usr/bin/env python3
# coding=utf-8
# author: @netwookie.
# -*- coding: utf-8 -*-
"""
This is a test file that tests the API
"""
import urllib3
urllib3.disable_warnings()
from pypheus.network import Network
from pypheus.storage import Storage
from pypheus.logs import Logs
from pypheus.monitoring import Monitoring
imp... | [
"pypheus.monitoring.Monitoring",
"pypheus.network.Network",
"pypheus.storage.Storage",
"pypheus.logs.Logs",
"urllib3.disable_warnings"
] | [((146, 172), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (170, 172), False, 'import urllib3\n'), ((415, 448), 'pypheus.network.Network', 'Network', (['host', 'username', 'password'], {}), '(host, username, password)\n', (422, 448), False, 'from pypheus.network import Network\n'), ((584, 6... |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import SiteProgramAuthorizationFactory
class TestSiteProgramAuthorization(TestCase):
def test_str(self):
site_program_authorization = SitePro... | [
"accelerator.tests.factories.SiteProgramAuthorizationFactory"
] | [((313, 375), 'accelerator.tests.factories.SiteProgramAuthorizationFactory', 'SiteProgramAuthorizationFactory', ([], {'jobs': '(True)', 'startup_list': '(False)'}), '(jobs=True, startup_list=False)\n', (344, 375), False, 'from accelerator.tests.factories import SiteProgramAuthorizationFactory\n')] |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import String
def callback(msg):
rospy.loginfo("I Heard %s", msg.data)
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber('chatter',String, callback)
rospy.spin()
if __name__ == '__main__':
listener() | [
"rospy.loginfo",
"rospy.spin",
"rospy.Subscriber",
"rospy.init_node"
] | [((90, 127), 'rospy.loginfo', 'rospy.loginfo', (['"""I Heard %s"""', 'msg.data'], {}), "('I Heard %s', msg.data)\n", (103, 127), False, 'import rospy\n'), ((148, 191), 'rospy.init_node', 'rospy.init_node', (['"""listener"""'], {'anonymous': '(True)'}), "('listener', anonymous=True)\n", (163, 191), False, 'import rospy\... |
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import Account
class UserAdminCreationForm(UserCreationForm):
d... | [
"django.utils.translation.ugettext_lazy",
"django.contrib.admin.site.register",
"django.contrib.admin.site.unregister"
] | [((1513, 1559), 'django.contrib.admin.site.register', 'admin.site.register', (['Account', 'UserAccountAdmin'], {}), '(Account, UserAccountAdmin)\n', (1532, 1559), False, 'from django.contrib import admin\n'), ((1589, 1617), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['Group'], {}), '(Group)\n', (... |
# -*- coding: utf-8 -*-
# Copyright 2021 Tampere University and VTT Technical Research Centre of Finland
# This software was developed as a part of the ProCemPlus project: https://www.senecc.fi/projects/procemplus
# This source code is licensed under the MIT license. See LICENSE in the repository root directory.
# Auth... | [
"subprocess.run",
"tools.messages.EpochMessage.from_json",
"tools.db_clients.MongodbClient",
"tools.messages.StatusMessage.from_json",
"tools.messages.ResultMessage.from_json",
"tools.tools.load_environmental_variables"
] | [((983, 1366), 'tools.tools.load_environmental_variables', 'load_environmental_variables', (["('MONGODB_HOST', str, 'localhost')", "('MONGODB_PORT', int, 27017)", "('MONGODB_USERNAME', str, '')", "('MONGODB_PASSWORD', str, '')", "('MONGODB_DATABASE', str, 'db')", "('MONGODB_METADATA_COLLECTION', str, 'simulations')", "... |
import sys
import os
import multiprocessing
import numpy as np
from matplotlib import pyplot as pl
from function_as_script import scriptify
from closure_measurements.process_dic import load_dgs
from closure_measurements.process_dic import Calc_CTODs as calc_CTODs_function
from closure_measurements.process_dic impor... | [
"pyopencl.create_some_context",
"matplotlib.pyplot.show",
"closure_measurements.process_dic.TestRegistration",
"closure_measurements.process_dic.load_dgs"
] | [((3119, 3140), 'closure_measurements.process_dic.load_dgs', 'load_dgs', (['dgsfilename'], {}), '(dgsfilename)\n', (3127, 3140), False, 'from closure_measurements.process_dic import load_dgs\n'), ((7002, 7011), 'matplotlib.pyplot.show', 'pl.show', ([], {}), '()\n', (7009, 7011), True, 'from matplotlib import pyplot as ... |
from datetime import datetime
from urllib.parse import urlparse
class Throttle:
def __init__(self, delay):
self.domains = {} # 可以放到数据库中
self.delay = delay # 两次间隔下载间隔
def wait_url(self, url_str):
# 以netloc为基础进行休眠
domain_url = urlparse(url_str).netloc
last_accessed = s... | [
"datetime.datetime.now",
"urllib.parse.urlparse",
"time.sleep"
] | [((718, 732), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (730, 732), False, 'from datetime import datetime\n'), ((270, 287), 'urllib.parse.urlparse', 'urlparse', (['url_str'], {}), '(url_str)\n', (278, 287), False, 'from urllib.parse import urlparse\n'), ((655, 681), 'time.sleep', 'time.sleep', (['sleep... |
import unittest
from scoring.component_parameters import ComponentParameters
from scoring.function import CustomProduct
from unittest_reinvent.scoring_tests.fixtures import create_activity_component_regression, \
create_predictive_property_component_regression
from utils.enums.scoring_function_component_enum impor... | [
"unittest_reinvent.scoring_tests.fixtures.create_activity_component_regression",
"scoring.function.CustomProduct",
"utils.enums.scoring_function_component_enum.ScoringFunctionComponentNameEnum",
"scoring.component_parameters.ComponentParameters",
"unittest_reinvent.scoring_tests.fixtures.create_predictive_p... | [((458, 492), 'utils.enums.scoring_function_component_enum.ScoringFunctionComponentNameEnum', 'ScoringFunctionComponentNameEnum', ([], {}), '()\n', (490, 492), False, 'from utils.enums.scoring_function_component_enum import ScoringFunctionComponentNameEnum\n'), ((523, 572), 'unittest_reinvent.scoring_tests.fixtures.cre... |