code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from artificial_idiot.networks import networks
from artificial_idiot.search.RL import (
ParametrisedRL, simple_grid_extractor, full_grid_extractor
)
import glob
import os
from artificial_idiot.game.state import State
from artificial_idiot.game.game import Game
from artificial_idiot.player import Player
from artific... | [
"artificial_idiot.game.game.Game",
"artificial_idiot.search.RL.ParametrisedRL",
"artificial_idiot.game.state.State",
"glob.glob",
"artificial_idiot.search.RL.ParametrisedRL.from_file"
] | [((1710, 1743), 'artificial_idiot.game.state.State', 'State', (['Player.start_config', '"""red"""'], {}), "(Player.start_config, 'red')\n", (1715, 1743), False, 'from artificial_idiot.game.state import State\n'), ((1751, 1777), 'artificial_idiot.game.game.Game', 'Game', (['"""red"""', 'initial_state'], {}), "('red', in... |
#! /usr/bin/env python
"""Pre-processing image datasets for model training"""
import os
import json
import tensorflow as tf
import csv
import xml.etree.ElementTree as ET
from tqdm import tqdm
from PIL import Image
from utils import get_immediate_subdirectories, get_file_list, get_bb_count, get_int, group_to_tf_record... | [
"os.mkdir",
"tqdm.tqdm",
"utils.get_dir_list",
"json.load",
"tensorflow.python_io.TFRecordWriter",
"json.dump",
"os.path.basename",
"csv.reader",
"utils.get_file_list",
"xml.etree.ElementTree.parse",
"os.path.exists",
"utils.get_bb_count",
"PIL.Image.open",
"utils.get_int",
"utils.group_... | [((1066, 1113), 'os.path.join', 'os.path.join', (['data_dir', "(dataset_name + '.names')"], {}), "(data_dir, dataset_name + '.names')\n", (1078, 1113), False, 'import os\n'), ((1517, 1554), 'os.path.join', 'os.path.join', (['data_dir', '"""annotations"""'], {}), "(data_dir, 'annotations')\n", (1529, 1554), False, 'impo... |
import os
AUTH_ENV_VAR_NAME = "AadAuthorityUri"
KUSTO_CLIENT_APP_ID = "db662dc1-0cfe-4e1c-a843-19a68e65be58"
PUBLIC_LOGIN_URL = "https://login.microsoftonline.com"
class CloudInfo:
""" This class holds the data for a specific cloud instance. """
def __init__(self, auth_endpoint: str, kusto_client_... | [
"os.environ.get"
] | [((941, 992), 'os.environ.get', 'os.environ.get', (['AUTH_ENV_VAR_NAME', 'PUBLIC_LOGIN_URL'], {}), '(AUTH_ENV_VAR_NAME, PUBLIC_LOGIN_URL)\n', (955, 992), False, 'import os\n')] |
from datetime import timedelta
from airflow import DAG
from airflow.providers.docker.operators.docker import DockerOperator
from airflow.utils.dates import days_ago
default_args = {
"owner": "airflow",
"depends_on_past": False,
"start_date": days_ago(2),
"retries": 1,
"retry_delay": tim... | [
"airflow.utils.dates.days_ago",
"airflow.providers.docker.operators.docker.DockerOperator",
"datetime.timedelta"
] | [((265, 276), 'airflow.utils.dates.days_ago', 'days_ago', (['(2)'], {}), '(2)\n', (273, 276), False, 'from airflow.utils.dates import days_ago\n'), ((317, 337), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(5)'}), '(minutes=5)\n', (326, 337), False, 'from datetime import timedelta\n'), ((525, 764), 'airflow.pro... |
import logging
import argparse
import sys
##################
#### logger ###
##################
# Set up logger
formatter = logging.Formatter('[%(asctime)s] %(levelname)s: %(message)s')
logger = logging.getLogger('ev_logger')
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
#Set up args
parser = argpar... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"logging.FileHandler",
"logging.Formatter",
"logging.getLogger"
] | [((130, 191), 'logging.Formatter', 'logging.Formatter', (['"""[%(asctime)s] %(levelname)s: %(message)s"""'], {}), "('[%(asctime)s] %(levelname)s: %(message)s')\n", (147, 191), False, 'import logging\n'), ((201, 231), 'logging.getLogger', 'logging.getLogger', (['"""ev_logger"""'], {}), "('ev_logger')\n", (218, 231), Fal... |
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"sawtooth_signing.create_context",
"os.path.expanduser",
"os.chmod",
"getpass.getuser",
"os.makedirs",
"os.path.exists",
"sawtooth_cli.exceptions.CliException",
"os.path.join"
] | [((2524, 2565), 'os.path.join', 'os.path.join', (['key_dir', "(key_name + '.priv')"], {}), "(key_dir, key_name + '.priv')\n", (2536, 2565), False, 'import os\n'), ((2585, 2625), 'os.path.join', 'os.path.join', (['key_dir', "(key_name + '.pub')"], {}), "(key_dir, key_name + '.pub')\n", (2597, 2625), False, 'import os\n'... |
#! /usr/bin/env python3
import socket
import time
from dateutil import parser, tz
from datetime import datetime
import time
#configuration
LOG_MODE=2 #1:ERROR, 2:TRACE
CONSOLE_LOG=True
SLEEP_TIMER=0.25
#parameters
TIMEZONE="Europe/Zurich"
CHECKUNTIL_TIME="Dec 20, 2021 0:30 AM"
REMOTE_SERVER_DNS = "one.one.one.one"
R... | [
"dateutil.parser.parse",
"socket.create_connection",
"dateutil.tz.gettz",
"dateutil.tz.tzlocal",
"time.sleep"
] | [((1394, 1418), 'dateutil.parser.parse', 'parser.parse', (['mydatetime'], {}), '(mydatetime)\n', (1406, 1418), False, 'from dateutil import parser, tz\n'), ((1093, 1144), 'socket.create_connection', 'socket.create_connection', (['(hostip, port)', 'retryTime'], {}), '((hostip, port), retryTime)\n', (1117, 1144), False, ... |
"""
tests for time conversions relevant to MSISE00
"""
from __future__ import annotations
import datetime
import typing
import numpy as np
from pytest import approx
import sciencedates as sd
T: list[typing.Any] = [datetime.datetime(2013, 7, 2, 12, 0, 0)]
T.append(T[0].date())
T.append(np.datetime64(T[0]))
T.append(... | [
"numpy.datetime64",
"sciencedates.datetime2gtd",
"datetime.datetime",
"numpy.arange",
"pytest.approx"
] | [((218, 257), 'datetime.datetime', 'datetime.datetime', (['(2013)', '(7)', '(2)', '(12)', '(0)', '(0)'], {}), '(2013, 7, 2, 12, 0, 0)\n', (235, 257), False, 'import datetime\n'), ((290, 309), 'numpy.datetime64', 'np.datetime64', (['T[0]'], {}), '(T[0])\n', (303, 309), True, 'import numpy as np\n'), ((415, 442), 'scienc... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ovito as ov
import glob
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy import optimize
import pickle
from itertools import product
from multiprocessing import get_context
def func(x, phi_l):
a = (4/3)*np.pi*-2
b = 2*1.919
q = (... | [
"ovito.io.import_file",
"numpy.count_nonzero",
"os.getcwd",
"ovito.modifiers.ConstructSurfaceModifier",
"numpy.zeros",
"scipy.optimize.fsolve",
"multiprocessing.get_context",
"numpy.append",
"numpy.linspace",
"glob.glob",
"itertools.product",
"numpy.round",
"ovito.modifiers.SelectTypeModifie... | [((5286, 5297), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5295, 5297), False, 'import os\n'), ((5315, 5343), 'glob.glob', 'glob.glob', (["(folder + '/*.pdb')"], {}), "(folder + '/*.pdb')\n", (5324, 5343), False, 'import glob\n'), ((507, 530), 'ovito.io.import_file', 'ov.io.import_file', (['file'], {}), '(file)\n', (... |
from flask import render_template
from flask import Flask, render_template, request, current_app, url_for
from flask import request, jsonify,make_response,Markup,send_file
from flask_cors import *
import json
import requests
from flask import make_response
from flask import Response
import os
server = Flask(__name__)
#... | [
"json.loads",
"flask.request.args.get",
"flask.request.form.get",
"flask.Flask",
"flask.render_template",
"requests.get"
] | [((303, 318), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'from flask import Flask, render_template, request, current_app, url_for\n'), ((1657, 1678), 'requests.get', 'requests.get', ([], {'url': 'url'}), '(url=url)\n', (1669, 1678), False, 'import requests\n'), ((1693, 1716), 'json.l... |
import cv2
import torch
import numpy as np
from torch import nn
from collections import OrderedDict
from torch.nn.functional import one_hot
from utils.box.bbox import bbox_switch, angle_switch, bbox_iou, encode, decode
from utils.box.ext.rotate_overlap_diff.oriented_iou_loss import cal_iou, cal_diou, cal_giou
from uti... | [
"torch.nn.BCEWithLogitsLoss",
"torch.zeros_like",
"utils.box.bbox.encode",
"utils.box.bbox.angle_switch",
"torch.nn.functional.one_hot",
"utils.utils.soft_weight",
"utils.box.rbbox.rbbox_batched_nms",
"utils.box.bbox.decode",
"torch.max",
"torch.zeros",
"utils.box.bbox.bbox_switch",
"torch.nn.... | [((461, 478), 'utils.box.bbox.angle_switch', 'angle_switch', (['gts'], {}), '(gts)\n', (473, 478), False, 'from utils.box.bbox import bbox_switch, angle_switch, bbox_iou, encode, decode\n'), ((497, 516), 'utils.box.bbox.angle_switch', 'angle_switch', (['preds'], {}), '(preds)\n', (509, 516), False, 'from utils.box.bbox... |
# Copyright 2018 The Cirq Developers
#
# 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 ... | [
"sympy.srepr"
] | [((848, 866), 'sympy.srepr', 'sympy.srepr', (['value'], {}), '(value)\n', (859, 866), False, 'import sympy\n')] |
import os
import numpy as np
import string
import re
dataDir = '/u/cs401/A3/data/'
# dataDir = './subdata/'
def Levenshtein(r, h):
"""
Calculation of WER with Levenshtein distance.
... | [
"os.path.join",
"numpy.std",
"os.walk",
"numpy.zeros",
"numpy.mean",
"numpy.arange",
"re.sub",
"re.compile"
] | [((2123, 2147), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {}), '((n + 1, m + 1))\n', (2131, 2147), True, 'import numpy as np\n'), ((2178, 2202), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {}), '((n + 1, m + 1))\n', (2186, 2202), True, 'import numpy as np\n'), ((2258, 2274), 'numpy.arange', 'np.arange', (['(n... |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 ... | [
"cinder.volume.drivers.remotefs.RemoteFSSnapDriver",
"cinder.tests.unit.fake_snapshot.fake_snapshot_obj",
"os.path.join",
"cinder.volume.drivers.remotefs.RemoteFSPoolMixin",
"cinder.tests.unit.fake_volume.fake_volume_obj",
"os.path.normpath",
"mock.patch.object",
"copy.deepcopy",
"ddt.data",
"mock... | [((1996, 2200), 'ddt.data', 'ddt.data', (["{'current_state': 'in-use', 'acceptable_states': ['available', 'in-use']}", "{'current_state': 'in-use', 'acceptable_states': ['available'],\n 'expected_exception': exception.InvalidVolume}"], {}), "({'current_state': 'in-use', 'acceptable_states': ['available',\n 'in-us... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.contrib.distribute.AllReduceCrossDeviceOps",
"tensorflow.logging.info",
"tensorflow.device",
"tensorflow.distribute.MirroredStrategy",
"random.choice",
"tensorflow.no_op",
"tensorflow.nest.flatten",
"tensorflow.executing_eagerly",
"tensorflow.contrib.distribute.OneDeviceStrategy",
"ten... | [((4366, 4389), 'tensorflow.nest.flatten', 'tf.nest.flatten', (['tensor'], {}), '(tensor)\n', (4381, 4389), True, 'import tensorflow as tf\n'), ((4823, 4870), 'tensorflow.nest.pack_sequence_as', 'tf.nest.pack_sequence_as', (['tensor', 'variable_data'], {}), '(tensor, variable_data)\n', (4847, 4870), True, 'import tenso... |
#!/usr/bin/python3
import sys
import getopt
import yaml
import os
import random
import string
def randomString(stringLength=10):
"""Generate a random string of fixed length """
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(stringLength))
def main(argv):
"""Creat... | [
"getopt.getopt",
"yaml.safe_dump",
"random.choice",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((1304, 1325), 'os.listdir', 'os.listdir', (['crds_path'], {}), '(crds_path)\n', (1314, 1325), False, 'import os\n'), ((591, 714), 'getopt.getopt', 'getopt.getopt', (['argv', '"""c:v:n:b:p:d:r:"""', "['cdrd=', 'crds=', 'bundle=', 'csvfile=', 'namespace=', 'proxy=', 'deploy-dir='\n ]"], {}), "(argv, 'c:v:n:b:p:d:r:'... |
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Input
def get_bonds_model():
model = Sequential()
model.add(Dense(128, activation='relu', input_dim=17))
model.add(Dense(256, activation='relu'))
model.add(Dense(128, activation='relu'))
model.add(Dense(1, activa... | [
"keras.models.Sequential",
"keras.layers.Dense"
] | [((129, 141), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (139, 141), False, 'from keras.models import Sequential, Model\n'), ((390, 402), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (400, 402), False, 'from keras.models import Sequential, Model\n'), ((653, 665), 'keras.models.Sequential',... |
"""
ft_console.py
==========
Adaptation of Python's console found in code.py so that it can be
used to show some "friendly" tracebacks.
"""
import os
import platform
import sys
import traceback
from code import InteractiveConsole
import codeop # need to import to exclude from tracebacks
import friendly_traceback
fr... | [
"friendly_traceback.set_formatter",
"platform.python_version",
"traceback.print_exc",
"os._exit",
"friendly_traceback.install",
"friendly_traceback.exclude_file_from_traceback",
"friendly_traceback.explain_traceback"
] | [((665, 690), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (688, 690), False, 'import platform\n'), ((6490, 6544), 'friendly_traceback.install', 'friendly_traceback.install', ([], {'include': 'include', 'lang': 'lang'}), '(include=include, lang=lang)\n', (6516, 6544), False, 'import friendly_... |
from django.urls import path
from . import views
urlpatterns = [
path("login/", views.signin, name="signin"),
path("signup/", views.signup, name="signup"),
] | [
"django.urls.path"
] | [((70, 113), 'django.urls.path', 'path', (['"""login/"""', 'views.signin'], {'name': '"""signin"""'}), "('login/', views.signin, name='signin')\n", (74, 113), False, 'from django.urls import path\n'), ((119, 163), 'django.urls.path', 'path', (['"""signup/"""', 'views.signup'], {'name': '"""signup"""'}), "('signup/', vi... |
from argparse import ArgumentParser
import os
import sys
import traceback
from tempfile import mkstemp
from shutil import move, copymode
from os import fdopen, remove, path
def rem_empty_lines(filename):
changed = False;
ignore_next = False;
fh, abs_path = mkstemp()
with fdopen(fh,'w') as new_file:
... | [
"os.remove",
"argparse.ArgumentParser",
"tempfile.mkstemp",
"os.path.join",
"os.path.isdir",
"os.walk",
"shutil.move",
"os.fdopen",
"shutil.copymode"
] | [((270, 279), 'tempfile.mkstemp', 'mkstemp', ([], {}), '()\n', (277, 279), False, 'from tempfile import mkstemp\n'), ((1107, 1127), 'os.path.isdir', 'os.path.isdir', (['input'], {}), '(input)\n', (1120, 1127), False, 'import os\n'), ((1430, 1491), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Re... |
import requests
import urllib.parse
class Tweets:
class RateLimit:
def __init__(self) -> None:
self.EndpointLimit = None
self.Remaining = None
self.ResetIn = None
def toJSON(self):
return {'EndpointLimit': self.EndpointLimit, 'Remaining': self.Remain... | [
"requests.request"
] | [((2312, 2367), 'requests.request', 'requests.request', (['"""GET"""', 'self.url'], {'headers': 'self.headers'}), "('GET', self.url, headers=self.headers)\n", (2328, 2367), False, 'import requests\n')] |
import torch
import numpy as np
STATE_MANDATORY_NEXT = 0
STATE_ACT_NEXT = 1
STATE_CSTE_NEXT = 2
STATE_BOOL_NEXT = 3
STATE_POSTCOND_OPEN_PAREN = 4
open_paren_token = ["m(", "c(", "r(", "w(", "i(", "e("]
close_paren_token = ["m)", "c)", "r)", "w)", "i)", "e)"]
flow_leads = ["REPEAT", "WHILE", "IF", "IFELSE... | [
"fetch_mapping.fetch_mapping",
"argparse.ArgumentParser",
"torch.where",
"torch.cat",
"sys.path.insert",
"torch.tensor"
] | [((15070, 15093), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (15085, 15093), False, 'import sys\n'), ((15155, 15196), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""RL"""'}), "(description='RL')\n", (15178, 15196), False, 'import argparse\n'), ((1567, 1... |
import os
import sys
import time
from glob import glob
import numpy as np
import pandas as pd
import pytest
from PartSegCore.algorithm_describe_base import SegmentationProfile
from PartSegCore.analysis.batch_processing import batch_backend
from PartSegCore.analysis.batch_processing.batch_backend import CalculationMan... | [
"PartSegCore.analysis.calculation_plan.MaskSuffix",
"PartSegCore.analysis.calculation_plan.CalculationPlan",
"os.path.basename",
"PartSegCore.analysis.calculation_plan.CalculationTree",
"PartSegImage.TiffImageReader.read_image",
"PartSegImage.Image",
"numpy.zeros",
"PartSegCore.analysis.measurement_ca... | [((12277, 12341), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:This method will be removed"""'], {}), "('ignore:This method will be removed')\n", (12303, 12341), False, 'import pytest\n'), ((13743, 13807), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:This method w... |
import tempfile
import os
import shutil
from regulations.generator.api_client import ApiClient
from unittest import TestCase
class ClientTest(TestCase):
def test_local_filesystem(self):
""" Verify that it's possible to host the files locally, where
index.html is used in place of just the director... | [
"regulations.generator.api_client.ApiClient",
"os.mkdir",
"tempfile.mkdtemp",
"shutil.rmtree"
] | [((447, 468), 'os.mkdir', 'os.mkdir', (['notice_path'], {}), '(notice_path)\n', (455, 468), False, 'import os\n'), ((591, 602), 'regulations.generator.api_client.ApiClient', 'ApiClient', ([], {}), '()\n', (600, 602), False, 'from regulations.generator.api_client import ApiClient\n'), ((685, 708), 'shutil.rmtree', 'shut... |
import py._path.local
import pytest
from energuide import element
from energuide.exceptions import ElementGetValueError
@pytest.fixture
def fragment() -> str:
return "<Foo><Bar id='1'>baz</Bar><Bar id='2'>qux</Bar></Foo>"
@pytest.fixture
def fragment_file_path(fragment: str, tmpdir: py._path.local.LocalPath) ->... | [
"energuide.element.Element.from_string",
"energuide.element.Element.new",
"pytest.raises",
"energuide.element.Element.parse"
] | [((593, 630), 'energuide.element.Element.from_string', 'element.Element.from_string', (['fragment'], {}), '(fragment)\n', (620, 630), False, 'from energuide import element\n'), ((691, 728), 'energuide.element.Element.from_string', 'element.Element.from_string', (['fragment'], {}), '(fragment)\n', (718, 728), False, 'fr... |
'''
homelette
=========
homelette is an interface for various homology modelling tools, enabling the
user to easily assemble custom homology modelling pipelines.
Please check out the documentation and tutorials at
https://homelette.readthedocs.io/.
The docstring examples assume that `homelette` has been imported as ... | [
"warnings.warn"
] | [((1896, 1914), 'warnings.warn', 'warnings.warn', (['msg'], {}), '(msg)\n', (1909, 1914), False, 'import warnings\n'), ((1707, 1725), 'warnings.warn', 'warnings.warn', (['msg'], {}), '(msg)\n', (1720, 1725), False, 'import warnings\n')] |
'''
total number of delimeters
total number of hyphens
the length of the hostname
the length of the entire URL
the number of dots
a binary feature for each token in the hostname
a binary feature for each token in the path
'''
from urllib.parse import urlparse
import whois
import tldextract
import pandas as pd
import n... | [
"numpy.load",
"numpy.save",
"numpy.set_printoptions",
"tldextract.extract",
"pandas.read_csv",
"numpy.array",
"pandas.set_option",
"urllib.parse.urlparse"
] | [((332, 375), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(10000)'], {}), "('display.max_columns', 10000)\n", (345, 375), True, 'import pandas as pd\n'), ((376, 416), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(10000)'], {}), "('display.max_rows', 10000)\n", (389, 416),... |
from Skeleton import Skeleton
if __name__ == '__main__' :
Skeleton.run()
| [
"Skeleton.Skeleton.run"
] | [((71, 85), 'Skeleton.Skeleton.run', 'Skeleton.run', ([], {}), '()\n', (83, 85), False, 'from Skeleton import Skeleton\n')] |
#!/usr/bin/env python3
import acsuite
import lvsfunc as lvf
ac = acsuite.AC()
path = r'BDMV/GRANBLUE_FANTASY_SEASON2_1/BDMV/STREAM/00007.m2ts'
src = lvf.src(path)
if __name__ == "__main__":
ac.eztrim(src, [(0, -24)], path[:-4]+"wav", "GBF2BD_NCOP1_cut.wav")
| [
"lvsfunc.src",
"acsuite.AC"
] | [((65, 77), 'acsuite.AC', 'acsuite.AC', ([], {}), '()\n', (75, 77), False, 'import acsuite\n'), ((151, 164), 'lvsfunc.src', 'lvf.src', (['path'], {}), '(path)\n', (158, 164), True, 'import lvsfunc as lvf\n')] |
#!/usr/bin/env python3
#
# Copyright 2020 IBM
# 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 t... | [
"app.core.configuration.get_config"
] | [((816, 833), 'app.core.configuration.get_config', 'conf.get_config', ([], {}), '()\n', (831, 833), True, 'import app.core.configuration as conf\n'), ((1284, 1301), 'app.core.configuration.get_config', 'conf.get_config', ([], {}), '()\n', (1299, 1301), True, 'import app.core.configuration as conf\n')] |
import numpy as np
from scipy import stats
from pm4py.algo.filtering.log.start_activities import start_activities_filter
def start_activities(log):
log_start = start_activities_filter.get_start_activities(log)
n_unique_start_activities = len(log_start)
start_activities_occurrences = list(log_start.value... | [
"scipy.stats.iqr",
"pm4py.algo.filtering.log.start_activities.start_activities_filter.get_start_activities",
"numpy.median",
"numpy.std",
"numpy.percentile",
"scipy.stats.skew",
"numpy.min",
"numpy.mean",
"numpy.max",
"scipy.stats.kurtosis",
"numpy.var"
] | [((166, 215), 'pm4py.algo.filtering.log.start_activities.start_activities_filter.get_start_activities', 'start_activities_filter.get_start_activities', (['log'], {}), '(log)\n', (210, 215), False, 'from pm4py.algo.filtering.log.start_activities import start_activities_filter\n'), ((352, 388), 'numpy.min', 'np.min', (['... |
"""Setup of Spark Framework"""
from setuptools import setup
with open("requirements.txt") as f:
requirements = [line for line in f if not line.startswith("#")]
setup(
name="spark_framework",
version="1.24",
description="Alternative pythonic style API to work with Apache Spark",
long_de... | [
"setuptools.setup"
] | [((174, 588), 'setuptools.setup', 'setup', ([], {'name': '"""spark_framework"""', 'version': '"""1.24"""', 'description': '"""Alternative pythonic style API to work with Apache Spark"""', 'long_description': '"""The project is a collection of useful functions that allow to write PySpark code in a more convenient way"""... |
#!/usr/bin/env python
import os.path as op
import nibabel as nib
from glob import glob
from scipy.ndimage import gaussian_filter
from pydra import mark, Workflow, Submitter
import click
from numpy.typing import NDArray
@mark.task
@mark.annotate({"return": {"outfile": str}})
def filter(filename: str, outdir: str) -> ... | [
"pydra.mark.annotate",
"nibabel.Nifti1Image",
"nibabel.load",
"os.path.basename",
"scipy.ndimage.gaussian_filter",
"click.option",
"click.command",
"nibabel.save",
"click.Path",
"pydra.Workflow",
"pydra.Submitter",
"os.path.join"
] | [((234, 277), 'pydra.mark.annotate', 'mark.annotate', (["{'return': {'outfile': str}}"], {}), "({'return': {'outfile': str}})\n", (247, 277), False, 'from pydra import mark, Workflow, Submitter\n'), ((640, 655), 'click.command', 'click.command', ([], {}), '()\n', (653, 655), False, 'import click\n'), ((795, 851), 'clic... |
#!/usr/bin/env python
import itertools
EXAMPLE = """mxmxvkd kfcds sqjhc nhms (contains dairy, fish)
trh fvjkl sbzzf mxmxvkd (contains dairy)
sqjhc fvjkl (contains soy)
sqjhc mxmxvkd sbzzf (contains fish)
"""
def parse_recipe(line):
"""Meh
>>> parse_recipe(EXAMPLE.split("\\n")[0])
{'ingredients': ['mxmxv... | [
"itertools.product"
] | [((2882, 2915), 'itertools.product', 'itertools.product', (['with_one', 'bkts'], {}), '(with_one, bkts)\n', (2899, 2915), False, 'import itertools\n')] |
from gym_minigrid.minigrid import *
from gym_minigrid.register import register
class Room:
def __init__(self,
top,
size
):
# Top-left corner and size (tuples)
self.top = top
self.size = size
# List of door objects and door positions
self.doors = []
... | [
"gym_minigrid.register.register"
] | [((3379, 3456), 'gym_minigrid.register.register', 'register', ([], {'id': '"""MiniGrid-RoomGrid-v0"""', 'entry_point': '"""gym_minigrid.envs:RoomGrid"""'}), "(id='MiniGrid-RoomGrid-v0', entry_point='gym_minigrid.envs:RoomGrid')\n", (3387, 3456), False, 'from gym_minigrid.register import register\n')] |
from ete3 import Tree, TreeStyle
import pandas as pd
# load jordan predictions
jor = pd.read_csv(snakemake.input.jor, index_col=0)
sample = jor.sample(100)
sample_genomes = sample['genome']
root = 'NC_000913.3'
tree = Tree(snakemake.input.tree)
tree.set_outgroup(root)
# keep_list = []
# for n, node in enumerate(tree... | [
"pandas.read_csv",
"ete3.TreeStyle",
"ete3.Tree"
] | [((86, 131), 'pandas.read_csv', 'pd.read_csv', (['snakemake.input.jor'], {'index_col': '(0)'}), '(snakemake.input.jor, index_col=0)\n', (97, 131), True, 'import pandas as pd\n'), ((220, 246), 'ete3.Tree', 'Tree', (['snakemake.input.tree'], {}), '(snakemake.input.tree)\n', (224, 246), False, 'from ete3 import Tree, Tree... |
#! /usr/bin/env python
__author__ = "<NAME>"
__email__ = "<EMAIL>"
"""
Code to store and manipulate data.
-------------------------------------------------------------------------------
class StatusInfo
-------------------------------------------------------------------------------
This ... | [
"time.time",
"copy.copy",
"logging.getLogger",
"logging.NullHandler"
] | [((7775, 7800), 'logging.getLogger', 'logging.getLogger', (['"""info"""'], {}), "('info')\n", (7792, 7800), False, 'import logging\n'), ((26476, 26501), 'logging.getLogger', 'logging.getLogger', (['"""info"""'], {}), "('info')\n", (26493, 26501), False, 'import logging\n'), ((7829, 7850), 'logging.NullHandler', 'loggin... |
import os
import numpy as np
from demo_utils import plot_image
import svmbir
"""
This file demonstrates the generation of a 3D microscopy phantom followed by sinogram projection and reconstruction using MBIR.
The phantom, sinogram, and reconstruction are then displayed.
"""
# Simulated image parameters
num_rows = 2... | [
"os.makedirs",
"svmbir.phantom.nrmse",
"svmbir.recon",
"numpy.linspace",
"demo_utils.plot_image",
"svmbir.phantom.gen_microscopy_sample_3d"
] | [((792, 863), 'svmbir.phantom.gen_microscopy_sample_3d', 'svmbir.phantom.gen_microscopy_sample_3d', (['num_rows', 'num_cols', 'num_slices'], {}), '(num_rows, num_cols, num_slices)\n', (831, 863), False, 'import svmbir\n'), ((908, 955), 'numpy.linspace', 'np.linspace', (['(-tilt_angle)', 'tilt_angle', 'num_views'], {}),... |
import setuptools
from cyanobyte import __version__
"""
Run bundler:
$ python3 setup.py sdist
Install via Pip:
$ pip3 install dist/cyanobyte-<version>.tar.gz
Upload via twine:
$ twine check dist/*
$ twine upload dist/*
"""
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.tx... | [
"setuptools.find_packages"
] | [((776, 819), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': "('test',)"}), "(exclude=('test',))\n", (800, 819), False, 'import setuptools\n')] |
import json
from django.http import HttpRequest, JsonResponse
from connect.models import Connection
from .models import Workgroup
def schedule(request: HttpRequest):
if not Connection.authorize(request):
return JsonResponse({}, status=401)
try:
payload = json.loads(request.body)
worke... | [
"json.loads",
"django.http.JsonResponse",
"connect.models.Connection.authorize"
] | [((179, 208), 'connect.models.Connection.authorize', 'Connection.authorize', (['request'], {}), '(request)\n', (199, 208), False, 'from connect.models import Connection\n'), ((225, 253), 'django.http.JsonResponse', 'JsonResponse', (['{}'], {'status': '(401)'}), '({}, status=401)\n', (237, 253), False, 'from django.http... |
from fastapi import BackgroundTasks
from dispatch.conversation import service as conversation_service
from dispatch.conversation.enums import ConversationButtonActions
from dispatch.database import SessionLocal
from dispatch.decorators import background_task
from dispatch.incident import flows as incident_flows
from d... | [
"dispatch.plugins.dispatch_slack.service.create_slack_client",
"dispatch.conversation.service.get_by_channel_id_ignoring_channel_type",
"dispatch.incident.models.IncidentRead.from_orm",
"dispatch.plugins.dispatch_slack.service.send_ephemeral_message",
"dispatch.plugin.service.get_active",
"dispatch.incide... | [((1039, 1083), 'dispatch.plugins.dispatch_slack.service.create_slack_client', 'dispatch_slack_service.create_slack_client', ([], {}), '()\n', (1081, 1083), True, 'from dispatch.plugins.dispatch_slack import service as dispatch_slack_service\n'), ((1275, 1343), 'dispatch.incident.service.get', 'incident_service.get', (... |
import torch
import torch.nn as nn
import torch.nn.init as init
from torchvision.models import resnet50
def mixup_data(p, n, lam):
mixed_x = lam * p + (1 - lam) * n
return mixed_x
class Resnet50(nn.Module):
def __init__(self,embedding_size, pretrained=True, is_norm=True, bn_freeze = True):
super(Resnet50, ... | [
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.init.kaiming_normal_",
"torch.nn.AdaptiveMaxPool2d",
"torch.sqrt",
"torchvision.models.resnet50",
"torch.nn.init.constant_",
"torch.pow",
"torch.nn.Linear",
"torch.sum"
] | [((353, 373), 'torchvision.models.resnet50', 'resnet50', (['pretrained'], {}), '(pretrained)\n', (361, 373), False, 'from torchvision.models import resnet50\n'), ((501, 524), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1)'], {}), '(1)\n', (521, 524), True, 'import torch.nn as nn\n'), ((544, 567), 'torch.n... |
import os
import shutil
import tempfile
import pytest
import prefect
from prefect import Flow, Parameter, Task
from prefect.environments import DockerEnvironment
#################################
##### Docker Environment Tests
#################################
class TestDockerEnvironment:
def test_create_docke... | [
"tempfile.NamedTemporaryFile",
"tempfile.TemporaryDirectory",
"os.path.basename",
"pytest.raises",
"prefect.environments.DockerEnvironment",
"pytest.mark.skip",
"os.path.join",
"shutil.copy",
"prefect.Flow"
] | [((440, 505), 'pytest.mark.skip', 'pytest.mark.skip', (['"""Circle will need to handle container building"""'], {}), "('Circle will need to handle container building')\n", (456, 505), False, 'import pytest\n'), ((358, 411), 'prefect.environments.DockerEnvironment', 'DockerEnvironment', ([], {'base_image': 'None', 'regi... |
from setuptools import setup
# Dependencies.
with open("requirements.txt") as f:
tests_require = f.readlines()
install_requires = [t.strip() for t in tests_require]
with open("README.md") as f:
long_description = f.read()
setup(
name="contextily",
version="1.0.0",
description="Context geo-tiles i... | [
"setuptools.setup"
] | [((233, 1068), 'setuptools.setup', 'setup', ([], {'name': '"""contextily"""', 'version': '"""1.0.0"""', 'description': '"""Context geo-tiles in Python"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/darribas/contextily"""', 'author': '""... |
from direct.gui.DirectGui import *
from direct.task import Task
from pandac.PandaModules import *
from pirates.piratesgui import PiratesGuiGlobals
from pirates.piratesgui import InventoryPage
from pirates.piratesgui import WeaponPanel
from pirates.piratesgui.SkillButton import SkillButton
from pirates.piratesgui import... | [
"pirates.piratesgui.InventoryPage.InventoryPage.destroy",
"pirates.piratesgui.InventoryPage.InventoryPage.hide",
"pirates.piratesgui.InventoryPage.InventoryPage.show",
"pirates.inventory.ItemGlobals.getAllHealthIds",
"pirates.piratesgui.InventoryPage.InventoryPage.__init__",
"pirates.piratesbase.PiratesGl... | [((1134, 1176), 'pirates.piratesgui.InventoryPage.InventoryPage.__init__', 'InventoryPage.InventoryPage.__init__', (['self'], {}), '(self)\n', (1170, 1176), False, 'from pirates.piratesgui import InventoryPage\n'), ((1612, 1650), 'pirates.piratesgui.InventoryPage.InventoryPage.show', 'InventoryPage.InventoryPage.show',... |
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Usage:
# run './build_docs.py' to generate the documentation and keep it updated
# open 'http://localhost:1313/' to check live update (this op... | [
"argparse.ArgumentParser",
"textwrap.wrap",
"pathlib.Path",
"difgen.gen_dif_listing.gen_listing_html",
"check_tool_requirements.read_tool_requirements",
"difgen.gen_dif_listing.get_difref_info",
"reggen.gen_html.gen_html",
"difgen.gen_dif_listing.gen_difref_html",
"platform.machine",
"re.search",
... | [((1155, 1203), 'check_tool_requirements.read_tool_requirements', 'check_tool_requirements.read_tool_requirements', ([], {}), '()\n', (1201, 1203), False, 'import check_tool_requirements\n'), ((7999, 8087), 'textwrap.wrap', 'textwrap.wrap', (['apt_cmd'], {'width': '(78)', 'replace_whitespace': '(True)', 'subsequent_ind... |
import csv
import math
import bokeh
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.models import Span
def main():
filepath = input("output: ")
data = []
with open(filepath, "r") as file:
reader = csv.reader(file)
for k, i in enumerate(reader):
row = []
for j in range(len(i)):
r... | [
"bokeh.io.curdoc",
"bokeh.plotting.figure",
"csv.reader",
"bokeh.layouts.column"
] | [((749, 890), 'bokeh.plotting.figure', 'figure', ([], {'x_axis_label': '"""Spannung [kN/m²]"""', 'y_axis_label': '"""Tiefe [m]"""', 'x_axis_type': '"""auto"""', 'width': '(750)', 'height': '(900)', 'title': '"""Spannungsverteilung"""'}), "(x_axis_label='Spannung [kN/m²]', y_axis_label='Tiefe [m]',\n x_axis_type='aut... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.9.1+dev
# kernelspec:
# display_name: Python [conda env:biovectors]
# language: python
# name: conda-env-biovectors-... | [
"lzma.open",
"tqdm.tqdm",
"plotnine.coord_flip",
"pandas.DataFrame.from_dict",
"plotnine.geom_col",
"pandas.read_csv",
"plotnine.labs",
"collections.Counter",
"collections.defaultdict",
"biovectors_modules.word2vec_run_helper.PubtatorTarIterator",
"pathlib.Path",
"pandas.DataFrame.from_records... | [((4264, 4317), 'pandas.read_csv', 'pd.read_csv', (['"""output/pmc_metadata_2.tsv.xz"""'], {'sep': '"""\t"""'}), "('output/pmc_metadata_2.tsv.xz', sep='\\t')\n", (4275, 4317), True, 'import pandas as pd\n'), ((7435, 7455), 'collections.defaultdict', 'defaultdict', (['Counter'], {}), '(Counter)\n', (7446, 7455), False, ... |
# import libraries
import requests, shelve
from bs4 import BeautifulSoup
def getKDA(id):
quote_page ='https://www.dotabuff.com/players/'+str(id)
page = requests.get(quote_page,headers = {'User-agent': 'my bot 0.1'})
page.status_code
soup = BeautifulSoup( page.content,features="html.parser" )
... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((167, 229), 'requests.get', 'requests.get', (['quote_page'], {'headers': "{'User-agent': 'my bot 0.1'}"}), "(quote_page, headers={'User-agent': 'my bot 0.1'})\n", (179, 229), False, 'import requests, shelve\n'), ((265, 316), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.content'], {'features': '"""html.parser"""'}), ... |
from bisect import insort
from collections import Counter
from hashlib import md5
class KetamaRing:
"""Implement a ketama compatible consistent hashing ring."""
def __init__(self):
"""Create a new HashRing."""
self._distribution = Counter()
self._keys = []
self._nodes = {}
... | [
"collections.Counter",
"bisect.insort"
] | [((258, 267), 'collections.Counter', 'Counter', ([], {}), '()\n', (265, 267), False, 'from collections import Counter\n'), ((1698, 1707), 'collections.Counter', 'Counter', ([], {}), '()\n', (1705, 1707), False, 'from collections import Counter\n'), ((1929, 1945), 'bisect.insort', 'insort', (['_keys', 'h'], {}), '(_keys... |
import codecs
import os
from multiprocessing.pool import Pool
import soundfile as sf
import librosa
import sys
from pydub import AudioSegment
def detect_leading_silence(sound, silence_threshold=-50.0, chunk_size=10):
'''
sound is a pydub.AudioSegment
silence_threshold in dB
chunk_size in ms
iterate... | [
"multiprocessing.pool.Pool",
"os.makedirs",
"codecs.open",
"os.path.dirname",
"librosa.resample",
"librosa.load",
"soundfile.write",
"pydub.AudioSegment.from_file",
"os.path.join",
"os.listdir"
] | [((745, 770), 'os.path.dirname', 'os.path.dirname', (['out_path'], {}), '(out_path)\n', (760, 770), False, 'import os\n'), ((775, 813), 'os.makedirs', 'os.makedirs', (['out_folder'], {'exist_ok': '(True)'}), '(out_folder, exist_ok=True)\n', (786, 813), False, 'import os\n'), ((826, 871), 'pydub.AudioSegment.from_file',... |
# -*- coding: utf-8 -*-
# Copyright 2019 The Blueoil Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | [
"click.option",
"lmnet.datasets.dataset_iterator.DatasetIterator",
"tensorflow.local_variables_initializer",
"tensorflow.Variable",
"tensorflow.GPUOptions",
"os.path.join",
"multiprocessing.cpu_count",
"tensorflow.test.is_built_with_cuda",
"ray.tune.suggest.HyperOptSearch",
"tensorflow.placeholder... | [((12512, 12606), 'click.option', 'click.option', (['"""-i"""', '"""--tunable_id"""'], {'help': '"""[optional] id of this tuning"""', 'default': '"""tunable"""'}), "('-i', '--tunable_id', help='[optional] id of this tuning',\n default='tunable')\n", (12524, 12606), False, 'import click\n'), ((12623, 12770), 'click.o... |
import os
from itertools import islice
import random
from test_framework.base58 import b58encode_chk, b58decode_chk, b58chars
from test_framework.script import CScript, OP_HASH160, OP_CHECKSIG, hash160, OP_EQUAL, OP_DUP, OP_EQUALVERIFY
# 为key_io_tests.cpp准备测试数据
# python test/functional/feature_address.py valid 50 > s... | [
"sys.stdout.write",
"json.dump",
"test_framework.base58.b58encode_chk",
"random.expovariate",
"random.randint",
"test_framework.script.CScript",
"test_framework.base58.b58decode_chk",
"random.choice",
"random.random",
"os.urandom"
] | [((1134, 1150), 'test_framework.base58.b58decode_chk', 'b58decode_chk', (['v'], {}), '(v)\n', (1147, 1150), False, 'from test_framework.base58 import b58encode_chk, b58decode_chk, b58chars\n'), ((3303, 3323), 'test_framework.base58.b58encode_chk', 'b58encode_chk', (['chk_b'], {}), '(chk_b)\n', (3316, 3323), False, 'fro... |
"""
Copyright 2013 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | [
"numpy.abs"
] | [((2147, 2170), 'numpy.abs', 'np.abs', (['self.expr.value'], {}), '(self.expr.value)\n', (2153, 2170), True, 'import numpy as np\n'), ((4407, 4430), 'numpy.abs', 'np.abs', (['self.expr.value'], {}), '(self.expr.value)\n', (4413, 4430), True, 'import numpy as np\n')] |
"""Test the cross_validation module"""
from __future__ import division
import warnings
import numpy as np
from scipy.sparse import coo_matrix
from scipy.sparse import csr_matrix
from scipy import stats
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | [
"sklearn.datasets.load_digits",
"sklearn.datasets.load_iris",
"numpy.sum",
"numpy.abs",
"sklearn.utils.testing.assert_raise_message",
"sklearn.datasets.make_multilabel_classification",
"sklearn.utils.testing.assert_equal",
"sklearn.utils.mocking.CheckingClassifier",
"numpy.ones",
"sklearn.utils.te... | [((4572, 4588), 'numpy.ones', 'np.ones', (['(10, 2)'], {}), '((10, 2))\n', (4579, 4588), True, 'import numpy as np\n'), ((4600, 4613), 'scipy.sparse.coo_matrix', 'coo_matrix', (['X'], {}), '(X)\n', (4610, 4613), False, 'from scipy.sparse import coo_matrix\n'), ((1044, 1069), 'warnings.catch_warnings', 'warnings.catch_w... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from setuptools import setup, find_packages
setup(
name="tosca",
version="0.3.4",
long_description="Advanced FacetView User Interface",
packages=find_pack... | [
"setuptools.find_packages"
] | [((311, 326), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (324, 326), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import unittest
import mock
from google.appengine.ext import ndb
from dashboard.common import testing_common
from dashboard.comm... | [
"dashboard.common.testing_common.SetIsInternalUser",
"dashboard.common.utils.OldStyleTestKey",
"json.dumps",
"dashboard.common.utils.GetMulti",
"unittest.main",
"dashboard.common.utils.TestPath",
"dashboard.common.utils.TestSuiteName",
"dashboard.common.utils.MinimumRange",
"dashboard.common.utils.I... | [((13672, 13714), 'mock.patch', 'mock.patch', (['"""common.utils.discovery.build"""'], {}), "('common.utils.discovery.build')\n", (13682, 13714), False, 'import mock\n'), ((14292, 14319), 'mock.patch', 'mock.patch', (['"""logging.error"""'], {}), "('logging.error')\n", (14302, 14319), False, 'import mock\n'), ((14323, ... |
#!/usr/bin/env python
# Copyright 2019 D-Wave Systems 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 ... | [
"hybrid.bqm_density",
"dimod.BinaryQuadraticModel.from_coo",
"hybrid.profiling.print_counters",
"hybrid.reference.pa.EnergyWeightedResampler",
"hybrid.reference.pt.FixedTemperatureSampler",
"hybrid.State.from_problem",
"hybrid.reference.pa.ProgressBetaAlongSchedule",
"hybrid.reference.pa.CalculateAnne... | [((1704, 1734), 'hybrid.State.from_problem', 'hybrid.State.from_problem', (['bqm'], {}), '(bqm)\n', (1729, 1734), False, 'import hybrid\n'), ((1801, 1842), 'hybrid.profiling.print_counters', 'hybrid.profiling.print_counters', (['workflow'], {}), '(workflow)\n', (1832, 1842), False, 'import hybrid\n'), ((951, 990), 'dim... |
import numpy as np
from example import algs
def test_pointless_sort():
# generate random vector of length 10
x = np.random.rand(10)
# check that pointless_sort always returns [1,2,3]
assert np.array_equal(algs.pointless_sort(x), np.array([1,2,3]))
# generate a new random vector of length 10
x... | [
"numpy.random.rand",
"example.algs.bubblesort",
"numpy.array",
"example.algs.pointless_sort"
] | [((122, 140), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (136, 140), True, 'import numpy as np\n'), ((323, 341), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (337, 341), True, 'import numpy as np\n'), ((223, 245), 'example.algs.pointless_sort', 'algs.pointless_sort', (['x'], {}... |
import pytest
from ....account.models import Address
from ....checkout.fetch import CheckoutInfo, get_delivery_method_info
from ....shipping.models import ShippingMethodChannelListing
from ...models import PluginConfiguration
from ..plugin import AvataxPlugin
@pytest.fixture(scope="module")
def vcr_config():
ret... | [
"pytest.fixture"
] | [((264, 294), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (278, 294), False, 'import pytest\n')] |
import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=2, alpha=0.5, weight=None, ignore_index=255):
super().__init__()
self.gamma = gamma
self.alpha = alpha
self.weight = weight
self.ignore_index = ignore_index
self.ce_fn... | [
"torch.exp",
"torch.nn.CrossEntropyLoss"
] | [((323, 394), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'weight': 'self.weight', 'ignore_index': 'self.ignore_index'}), '(weight=self.weight, ignore_index=self.ignore_index)\n', (342, 394), True, 'import torch.nn as nn\n'), ((494, 510), 'torch.exp', 'torch.exp', (['logpt'], {}), '(logpt)\n', (503, 510),... |
from datetime import datetime
from django.core.urlresolvers import reverse
from sentry.models import Release
from sentry.testutils import APITestCase
class ProjectReleasesTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team(owner=self.user)
proj... | [
"sentry.models.Release.objects.create",
"django.core.urlresolvers.reverse",
"datetime.datetime"
] | [((785, 838), 'sentry.models.Release.objects.create', 'Release.objects.create', ([], {'project': 'project2', 'version': '"""1"""'}), "(project=project2, version='1')\n", (807, 838), False, 'from sentry.models import Release\n'), ((889, 965), 'django.core.urlresolvers.reverse', 'reverse', (['"""sentry-api-0-project-rele... |
#!/usr/bin/python
import sys
import graph
def printUsage():
print('main.py <graph_file>')
if __name__ == '__main__':
if (len(sys.argv) != 2):
printUsage()
# Open input file
f = open(sys.argv[1], "r")
data = f.readlines()
# Fill graph with edges in file
g = graph.Graph()
... | [
"graph.Graph"
] | [((303, 316), 'graph.Graph', 'graph.Graph', ([], {}), '()\n', (314, 316), False, 'import graph\n')] |
from antarest.study.storage.rawstudy.model.filesystem.config.model import (
FileStudyTreeConfig,
)
from antarest.study.storage.rawstudy.model.filesystem.context import (
ContextServer,
)
from antarest.study.storage.rawstudy.model.filesystem.folder_node import (
FolderNode,
)
from antarest.study.storage.raws... | [
"antarest.study.storage.rawstudy.model.filesystem.folder_node.FolderNode.__init__"
] | [((699, 741), 'antarest.study.storage.rawstudy.model.filesystem.folder_node.FolderNode.__init__', 'FolderNode.__init__', (['self', 'context', 'config'], {}), '(self, context, config)\n', (718, 741), False, 'from antarest.study.storage.rawstudy.model.filesystem.folder_node import FolderNode\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
__version__ = '0.1.0'
PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__))
os.chdir(PACKAGE_DIR)
setup(name='django-pint-unit-field',
version=__version__,
url='https://github.com/marcosalcazar/django-pint-unit-field',
... | [
"os.path.dirname",
"os.path.join",
"os.chdir",
"setuptools.find_packages"
] | [((158, 179), 'os.chdir', 'os.chdir', (['PACKAGE_DIR'], {}), '(PACKAGE_DIR)\n', (166, 179), False, 'import os\n'), ((131, 156), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (146, 156), False, 'import os\n'), ((597, 630), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests... |
from sense_hat import SenseHat
import pygame
from pygame.locals import *
from time import sleep
pygame.init()
pygame.display.set_mode((1,1))
sense = SenseHat()
loop = True
i = 0
while i < 25:
i += 1
while loop == True:
for event in pygame.event.get():
if event.type == KEYDOWN:
... | [
"pygame.event.get",
"pygame.display.set_mode",
"sense_hat.SenseHat",
"pygame.init",
"time.sleep"
] | [((97, 110), 'pygame.init', 'pygame.init', ([], {}), '()\n', (108, 110), False, 'import pygame\n'), ((111, 142), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(1, 1)'], {}), '((1, 1))\n', (134, 142), False, 'import pygame\n'), ((150, 160), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (158, 160), False... |
from setuptools import setup, find_packages
def readme():
with open('README.md', encoding='utf-8') as f:
README = f.read()
return README
setup(
name="mealpy",
version="1.0.3",
author="Thieu",
author_email="<EMAIL>",
description="A collection of the state-of-the-art MEta-heuristics ... | [
"setuptools.find_packages"
] | [((569, 584), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (582, 584), False, 'from setuptools import setup, find_packages\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# -*- coding: utf-8 -*-
"""
# @Time : 2019/5/25
# @Author : Jiaqi&Zecheng
# @File : args.py
# @Software: PyCharm
"""
import random
# argparse帮助在命令行界面运行.py文件,帮助程序获取参数,并生成报错,用户手册等信息
import argparse
import torch
import numpy a... | [
"torch.manual_seed",
"torch.cuda.manual_seed",
"argparse.ArgumentParser"
] | [((455, 480), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (478, 480), False, 'import argparse\n'), ((4560, 4588), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (4577, 4588), False, 'import torch\n'), ((4617, 4650), 'torch.cuda.manual_seed', 'torch.cuda.manua... |
import logging
import os
import subprocess
import sys
import textwrap
import toml
from datetime import datetime
from typing import Any, Callable, Dict, Optional
try:
from secrets import token_hex
except ImportError:
# TODO: remove after dropping Python 2.7 and 3.5 support
import string
import random
... | [
"textwrap.dedent",
"toml.dumps",
"os.path.dirname",
"subprocess.check_output",
"secrets.token_hex",
"random.choice",
"os.path.join",
"logging.getLogger"
] | [((533, 560), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (550, 560), False, 'import logging\n'), ((584, 609), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (599, 609), False, 'import os\n'), ((659, 670), 'secrets.token_hex', 'token_hex', ([], {}), '()\n', (... |
"""
997. Find the Town Judge
In a town, there are n people labeled from 1 to n.
There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
1. The town judge trusts nobody.
2. Everybody (except for the town judge) trusts the town judge.
3. There is exactly one per... | [
"lib.run_tests"
] | [((1320, 1374), 'lib.run_tests', 'run_tests', ([], {'testcases': 'testcases', 'function': 'kls.findJudge'}), '(testcases=testcases, function=kls.findJudge)\n', (1329, 1374), False, 'from lib import run_tests\n')] |
# -*- coding: utf-8 -*-
"""
Generating image window by weighted sampling map from input image
This can also be considered as a `weighted random cropping` layer of the
input image
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from niftynet.engine.image_... | [
"tensorflow.logging.info",
"tensorflow.logging.fatal",
"numpy.argmax",
"numpy.asarray",
"numpy.floor",
"numpy.zeros",
"numpy.unravel_index",
"numpy.ones",
"numpy.argsort",
"niftynet.engine.sampler_uniform.UniformSampler.__init__",
"numpy.max",
"numpy.append",
"numpy.sort",
"numpy.random.ra... | [((3368, 3413), 'numpy.asarray', 'np.asarray', (['spatial_win_sizes'], {'dtype': 'np.int32'}), '(spatial_win_sizes, dtype=np.int32)\n', (3378, 3413), True, 'import numpy as np\n'), ((3436, 3469), 'numpy.max', 'np.max', (['spatial_win_sizes'], {'axis': '(0)'}), '(spatial_win_sizes, axis=0)\n', (3442, 3469), True, 'impor... |
"""update user table
Revision ID: 0a909e2b59a1
Revises: 0b026dea7cc6
Create Date: 2019-11-25 10:15:20.875486
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '0b026dea7cc6'
branch_labels = None
depends_on = None
def upgrade():
# ###... | [
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((579, 614), 'alembic.op.drop_column', 'op.drop_column', (['"""usertable"""', '"""site"""'], {}), "('usertable', 'site')\n", (593, 614), False, 'from alembic import op\n'), ((426, 437), 'sqlalchemy.String', 'sa.String', ([], {}), '()\n', (435, 437), True, 'import sqlalchemy as sa\n')] |
from tqdm import tqdm
from network import LatentModel
from tensorboardX import SummaryWriter
import torchvision
import torch as t
from torch.utils.data import DataLoader
import os
import sys
from tools import *
import time
import matplotlib.pyplot as plt
import matplotlib
os.environ["CUDA_VISIBLE_DEVICES"]="0"
def a... | [
"matplotlib.pyplot.xlim",
"matplotlib.rc",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca",
"network.LatentModel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig"
] | [((3304, 3347), 'matplotlib.rc', 'matplotlib.rc', (['"""xtick"""'], {'labelsize': 'labelfont'}), "('xtick', labelsize=labelfont)\n", (3317, 3347), False, 'import matplotlib\n'), ((3353, 3396), 'matplotlib.rc', 'matplotlib.rc', (['"""ytick"""'], {'labelsize': 'labelfont'}), "('ytick', labelsize=labelfont)\n", (3366, 339... |
from skimage.io import imread
import numpy as np
import pickle
from pumapy.utilities.workspace import Workspace
from os import path
from glob import glob
from vtkmodules.util.numpy_support import vtk_to_numpy
from vtkmodules.vtkIOXML import vtkXMLImageDataReader, vtkXMLUnstructuredGridReader
from vtkmodules.vtkIOLegacy... | [
"pumapy.utilities.workspace.Workspace.from_shape",
"vtkmodules.vtkIOXML.vtkXMLImageDataReader",
"os.path.exists",
"pickle.load",
"vtkmodules.vtkIOXML.vtkXMLUnstructuredGridReader",
"pumapy.utilities.workspace.Workspace.from_array",
"glob.glob",
"os.path.split",
"skimage.io.imread",
"vtkmodules.vtk... | [((2317, 2341), 'pickle.load', 'pickle.load', (['pumapy_file'], {}), '(pumapy_file)\n', (2328, 2341), False, 'import pickle\n'), ((8122, 8152), 'vtkmodules.vtkIOXML.vtkXMLUnstructuredGridReader', 'vtkXMLUnstructuredGridReader', ([], {}), '()\n', (8150, 8152), False, 'from vtkmodules.vtkIOXML import vtkXMLImageDataReade... |
import argparse
import cv2 as cv
import numpy as np
from trainer.config import img_rows, img_cols
if __name__ == '__main__':
ap = argparse.ArgumentParser()
ap.add_argument("-x0")
ap.add_argument("-y0")
ap.add_argument("-x1")
ap.add_argument("-y1")
args = vars(ap.parse_args())
x0 = int(args... | [
"cv2.imwrite",
"cv2.imshow",
"numpy.zeros",
"argparse.ArgumentParser"
] | [((136, 161), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (159, 161), False, 'import argparse\n'), ((417, 466), 'numpy.zeros', 'np.zeros', (['(img_rows, img_cols, 1)'], {'dtype': 'np.uint8'}), '((img_rows, img_cols, 1), dtype=np.uint8)\n', (425, 466), True, 'import numpy as np\n'), ((507, 53... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"AccessControl.ZopeGuards.guarded_hasattr",
"Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile",
"zope.viewlet.interfaces.IViewletManager.implementedBy",
"Acquisition.aq_base"
] | [((3125, 3158), 'Products.Five.browser.pagetemplatefile.ZopeTwoPageTemplateFile', 'ZopeTwoPageTemplateFile', (['template'], {}), '(template)\n', (3148, 3158), False, 'from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile\n'), ((1709, 1743), 'AccessControl.ZopeGuards.guarded_hasattr', 'guarded_hasat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-only
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHA... | [
"ansible_collections.vmware.ansible_for_nsxt.plugins.module_utils.nsxt_resource_urls.IP_ADDRESS_POOL_SUBNET_URL.format"
] | [((10940, 11000), 'ansible_collections.vmware.ansible_for_nsxt.plugins.module_utils.nsxt_resource_urls.IP_ADDRESS_POOL_SUBNET_URL.format', 'IP_ADDRESS_POOL_SUBNET_URL.format', (["parent_info['ip_pool_id']"], {}), "(parent_info['ip_pool_id'])\n", (10973, 11000), False, 'from ansible_collections.vmware.ansible_for_nsxt.p... |
import matplotlib.pyplot as plt
def plot_train_data_errors(images, predictions, labels, show_predictions = True):
'''
Function that plots images, and overlays model predictions with true labels
The function takes a list of 25 images
'''
fig = plt.figure(figsize = (15,15))
for i,image in... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.legend"
] | [((271, 299), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 15)'}), '(figsize=(15, 15))\n', (281, 299), True, 'import matplotlib.pyplot as plt\n'), ((708, 720), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (718, 720), True, 'import matplotlib.pyplot as plt\n'), ((353, 377), 'matplotlib... |
import os
from api_gateway_service.api import app
def main():
port = int(os.environ.get('PORT', 5000))
login_url = 'http://localhost:{}/login'.format(port)
print('If you run locally, browse to', login_url)
host = '0.0.0.0'
app.run(host=host, port=port)
if __name__ == "__main__":
main() | [
"os.environ.get",
"api_gateway_service.api.app.run"
] | [((244, 273), 'api_gateway_service.api.app.run', 'app.run', ([], {'host': 'host', 'port': 'port'}), '(host=host, port=port)\n', (251, 273), False, 'from api_gateway_service.api import app\n'), ((78, 106), 'os.environ.get', 'os.environ.get', (['"""PORT"""', '(5000)'], {}), "('PORT', 5000)\n", (92, 106), False, 'import o... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-07-10 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questions', '0020_data_migration'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.BooleanField"
] | [((413, 561), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Designates whether this question/questionset is a collection."""', 'verbose_name': '"""is collection"""'}), "(default=False, help_text=\n 'Designates whether this question/questionset is a collection.',... |
import torch
from typing import Dict
# @torch.jit.script
# def myfn(x, mask: Dict[int, int]):
# if x.dim() == 1:
# return torch.ones(10)
# else:
# return torch.zeros(10)
# inp1 = torch.randn(1)
# inp2 = torch.randn(())
# mask: Dict[int, int] = {}
# mask[0] = 1
# mask[1] = 2
# print(myfn(inp1... | [
"torch.ones",
"torch.nn.PReLU",
"torch.jit.trace",
"torch.jit.script",
"torch.nn.LogSoftmax",
"torch.randn",
"torch.nn.Linear",
"torch.zeros"
] | [((1629, 1650), 'torch.randn', 'torch.randn', (['[1, 512]'], {}), '([1, 512])\n', (1640, 1650), False, 'import torch\n'), ((1679, 1703), 'torch.jit.script', 'torch.jit.script', (['model2'], {}), '(model2)\n', (1695, 1703), False, 'import torch\n'), ((1756, 1782), 'torch.jit.trace', 'torch.jit.trace', (['model2', 'x'], ... |
from django.db import models
# Create your models here.
class Order(models.Model):
category = (('Confirmed', 'Confirmed'),
('Preparing', 'Preparing'),
('Out for Delivery', 'Out for Delivery'),
('Delivered', 'Delivered'),
('Cancelled', 'Cancelled'),... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((356, 442), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""restaurants.Restaurant"""'], {'null': '(True)', 'on_delete': 'models.SET_NULL'}), "('restaurants.Restaurant', null=True, on_delete=models.\n SET_NULL)\n", (373, 442), False, 'from django.db import models\n'), ((462, 539), 'django.db.models.Forei... |
#!/usr/bin/env python
# Copyright 2019 Google, 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... | [
"base64.b64encode",
"os.urandom"
] | [((999, 1013), 'os.urandom', 'os.urandom', (['(32)'], {}), '(32)\n', (1009, 1013), False, 'import os\n'), ((1032, 1053), 'base64.b64encode', 'base64.b64encode', (['key'], {}), '(key)\n', (1048, 1053), False, 'import base64\n')] |
from SPARQLWrapper import SPARQLWrapper, JSON, POST
import json
import requests
def test_wrapper_select(sparql_endpoint):
repo_uri = 'https://my.rdfdb.com/repo/sparql'
rdf_files = ['tests/upper_ontology.ttl',
'tests/domain_ontology.ttl',
'tests/instance_data.ttl']
endpoin... | [
"requests.post",
"SPARQLWrapper.SPARQLWrapper",
"requests.get"
] | [((374, 406), 'SPARQLWrapper.SPARQLWrapper', 'SPARQLWrapper', ([], {'endpoint': 'repo_uri'}), '(endpoint=repo_uri)\n', (387, 406), False, 'from SPARQLWrapper import SPARQLWrapper, JSON, POST\n'), ((984, 1016), 'SPARQLWrapper.SPARQLWrapper', 'SPARQLWrapper', ([], {'endpoint': 'repo_uri'}), '(endpoint=repo_uri)\n', (997,... |
import os
import sys
import numpy as np
from math import floor
def splitset(dataset, parts):
"""Partition data into "parts" partitions"""
n = dataset.shape[0]
local_n = floor(n/parts)
result = []
for i in range(parts):
result.append(dataset[i*local_n: (i+1)*local_n])
return np.array(res... | [
"os.mkdir",
"numpy.load",
"os.getcwd",
"math.floor",
"os.path.exists",
"numpy.array"
] | [((182, 198), 'math.floor', 'floor', (['(n / parts)'], {}), '(n / parts)\n', (187, 198), False, 'from math import floor\n'), ((308, 324), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (316, 324), True, 'import numpy as np\n'), ((476, 501), 'numpy.load', 'np.load', (['"""data/mnist.npz"""'], {}), "('data/mn... |
import numpy as np
def approximate_error(motif):
"""Calculate approximate error"""
pwm = motif.pwm
bases = list(pwm.keys())
n = sum(motif.counts[bases[0]])
approx_error = (len(bases)-1)/(2 * np.log(2) * n)
return approx_error
def exact_error(motif):
"""Calculate exact error, using multin... | [
"numpy.log2",
"numpy.log"
] | [((213, 222), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (219, 222), True, 'import numpy as np\n'), ((603, 613), 'numpy.log2', 'np.log2', (['p'], {}), '(p)\n', (610, 613), True, 'import numpy as np\n'), ((1828, 1846), 'numpy.log2', 'np.log2', (['pwm[b][l]'], {}), '(pwm[b][l])\n', (1835, 1846), True, 'import numpy a... |
#!/usr/bin/env python
"""
Threshold Graphs
================
"""
import pytest
import networkx as nx
import networkx.algorithms.threshold as nxt
from networkx.algorithms.isomorphism.isomorph import graph_could_be_isomorphic
from networkx.testing import almost_equal
cnlti = nx.convert_node_labels_to_integers
class T... | [
"networkx.algorithms.threshold.find_alternating_4_cycle",
"networkx.algorithms.threshold.creation_sequence",
"networkx.algorithms.threshold.shortest_path_length",
"networkx.MultiGraph",
"networkx.algorithms.threshold.threshold_graph",
"networkx.laplacian_matrix",
"networkx.algorithms.threshold.find_thre... | [((407, 424), 'networkx.star_graph', 'nx.star_graph', (['(10)'], {}), '(10)\n', (420, 424), True, 'import networkx as nx\n'), ((440, 465), 'networkx.algorithms.threshold.is_threshold_graph', 'nxt.is_threshold_graph', (['G'], {}), '(G)\n', (462, 465), True, 'import networkx.algorithms.threshold as nxt\n'), ((552, 573), ... |
"""
MH-Z19 sensorin datasheetti https://www.winsen-sensor.com/d/files/MH-Z19B.pdf
Oletuksena on käyttää 0 - 5000 ppm sensoria. Tarkkuus ± (50ppm+5%)
Toimintajännite: 4.5 ~ 5.5 V DC, keskimääräinen kulutus < 20mA, maksimi 150mA
Toimintalämpötila -10 ~ 50 °C ja kosteus 0~ 90% RH.
Signaalin lähtö 3.3V sopiva. Vasteaika ... | [
"utime.time",
"uasyncio.StreamReader",
"uasyncio.sleep",
"uasyncio.StreamWriter",
"machine.UART"
] | [((3199, 3214), 'machine.UART', 'machine.UART', (['(1)'], {}), '(1)\n', (3211, 3214), False, 'import machine\n'), ((3509, 3521), 'utime.time', 'utime.time', ([], {}), '()\n', (3519, 3521), False, 'import utime\n'), ((3553, 3565), 'utime.time', 'utime.time', ([], {}), '()\n', (3563, 3565), False, 'import utime\n'), ((44... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"argparse.ArgumentParser",
"sklearn.metrics.accuracy_score",
"tensorflow.contrib.layers.convolution2d",
"tensorflow.contrib.learn.models.logistic_regression",
"tensorflow.reduce_max",
"pandas.DataFrame",
"tensorflow.one_hot",
"tensorflow.nn.relu",
"tensorflow.contrib.learn.preprocessing.ByteProcesso... | [((1532, 1555), 'tensorflow.one_hot', 'tf.one_hot', (['y', '(15)', '(1)', '(0)'], {}), '(y, 15, 1, 0)\n', (1542, 1555), True, 'import tensorflow as tf\n'), ((2750, 2792), 'tensorflow.contrib.learn.models.logistic_regression', 'learn.models.logistic_regression', (['pool2', 'y'], {}), '(pool2, y)\n', (2782, 2792), False,... |
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without res... | [
"typing.TypeVar",
"disent.util.imports._check_and_split_path",
"disent.util.function.wrapped_partial",
"disent.util.imports.import_obj_partial"
] | [((1888, 1900), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1895, 1900), False, 'from typing import TypeVar\n'), ((5849, 5883), 'disent.util.imports._check_and_split_path', '_check_and_split_path', (['import_path'], {}), '(import_path)\n', (5870, 5883), False, 'from disent.util.imports import _check_and... |
import subprocess
# install dependencies
print("installing dependencies...")
subprocess.call(["pip3 install --user performance"], shell=True)
subprocess.call(["python3 -m pip install perf"], shell=True)
print("\n\n__________________________")
print("dependencies now satisfied")
import sys
import performance
from ran... | [
"subprocess.call",
"sys.exit"
] | [((78, 142), 'subprocess.call', 'subprocess.call', (["['pip3 install --user performance']"], {'shell': '(True)'}), "(['pip3 install --user performance'], shell=True)\n", (93, 142), False, 'import subprocess\n'), ((143, 203), 'subprocess.call', 'subprocess.call', (["['python3 -m pip install perf']"], {'shell': '(True)'}... |
from common.sagemaker_component import SageMakerComponent, SageMakerJobStatus
from deploy.src.sagemaker_deploy_spec import SageMakerDeploySpec
from deploy.src.sagemaker_deploy_component import (
EndpointRequests,
SageMakerDeployComponent,
)
from tests.unit_tests.tests.deploy.test_deploy_spec import DeploySpecTe... | [
"deploy.src.sagemaker_deploy_component.SageMakerDeployComponent",
"common.sagemaker_component.SageMakerJobStatus",
"unittest.mock.MagicMock",
"deploy.src.sagemaker_deploy_component.EndpointRequests",
"deploy.src.sagemaker_deploy_spec.SageMakerDeploySpec"
] | [((559, 585), 'deploy.src.sagemaker_deploy_component.SageMakerDeployComponent', 'SageMakerDeployComponent', ([], {}), '()\n', (583, 585), False, 'from deploy.src.sagemaker_deploy_component import EndpointRequests, SageMakerDeployComponent\n'), ((932, 1008), 'deploy.src.sagemaker_deploy_spec.SageMakerDeploySpec', 'SageM... |
"""
:py:class:`Utils` - a set of generic utilities
==============================================
Usage::
# assuming that $PYTHONPATH=.../lcls2/psana
# Run test: python lcls2/psana/psana/pyalgos/generic/Utils.py 1
# Import
from psana.pyalgos.generic.Utils import input_single_char
import psana.p... | [
"sys.stdout.write",
"time.strptime",
"pickle.dump",
"getpass.getuser",
"os.popen",
"termios.tcsetattr",
"time.mktime",
"os.path.isfile",
"sys.stdout.flush",
"scipy.misc.imsave",
"subprocess.getoutput",
"os.path.join",
"os.path.lexists",
"os.path.dirname",
"numpy.savetxt",
"os.path.exis... | [((3460, 3489), 'logging.getLogger', 'logging.getLogger', (['"""__name__"""'], {}), "('__name__')\n", (3477, 3489), False, 'import logging\n'), ((4586, 4611), 'os.environ.get', 'os.environ.get', (['env', 'None'], {}), '(env, None)\n', (4600, 4611), False, 'import os\n'), ((4705, 4725), 'socket.gethostname', 'socket.get... |
# Definition of radius
r = 192500
# Import radians function of math package
from math import radians
# Travel distance of Moon over 12 degrees. Store in dist.
phi = radians(12)
dist = r * phi
# Print out dist
print(dist) | [
"math.radians"
] | [((167, 178), 'math.radians', 'radians', (['(12)'], {}), '(12)\n', (174, 178), False, 'from math import radians\n')] |
""" Tests for admin endpoints """
from mock import MagicMock
from pyramid.httpexceptions import HTTPBadRequest
from pypicloud.views.admin import AdminEndpoints
from . import MockServerTest
class TestAdmin(MockServerTest):
"""Tests for admin endpoints"""
def setUp(self):
super(TestAdmin, self).setU... | [
"pypicloud.views.admin.AdminEndpoints",
"mock.MagicMock"
] | [((368, 379), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (377, 379), False, 'from mock import MagicMock\n'), ((485, 496), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (494, 496), False, 'from mock import MagicMock\n'), ((505, 533), 'pypicloud.views.admin.AdminEndpoints', 'AdminEndpoints', (['self.request'], {... |
#
# OtterTune - views.py
#
# Copyright (c) 2017-18, Carnegie Mellon University Database Group
#
import logging
import datetime
import re
from collections import OrderedDict
from django.contrib.auth import login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth import update_ses... | [
"django.http.HttpResponse",
"django.utils.timezone.now",
"django.template.context_processors.csrf",
"django.urls.reverse_lazy",
"django.contrib.auth.forms.AuthenticationForm",
"re.match",
"django.urls.reverse",
"django.shortcuts.get_object_or_404",
"django.contrib.auth.logout",
"django.contrib.aut... | [((1675, 1702), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1692, 1702), False, 'import logging\n'), ((2524, 2561), 'django.shortcuts.render', 'render', (['request', '"""signup.html"""', 'token'], {}), "(request, 'signup.html', token)\n", (2530, 2561), False, 'from django.shortcuts im... |
# -*- coding: utf-8 -*-
"""
Module containing the available commands of the game, the factory class to
create the commands...
Today, the available commands are:
- look,
- talk,
- move,
- enter,
- exit,
- take,
- drop,
- inventory,
- stats,
- help,
- quit,
- attack
- save
"""
import core.command
from core.commands impo... | [
"core.localisation._"
] | [((719, 736), 'core.localisation._', '_', (['"""LOOK_COMMAND"""'], {}), "('LOOK_COMMAND')\n", (720, 736), False, 'from core.localisation import _\n'), ((793, 810), 'core.localisation._', '_', (['"""TALK_COMMAND"""'], {}), "('TALK_COMMAND')\n", (794, 810), False, 'from core.localisation import _\n'), ((868, 885), 'core.... |
# Generated by pypy/tool/import_cffi.py
import py, sys
from pypy.module.test_lib_pypy.cffi_tests.cffi0 import backend_tests
from cffi.backend_ctypes import CTypesBackend
class TestCTypes(backend_tests.BackendTests):
# for individual tests see
# ====> backend_tests.py
Backend = CTypesBackend
TypeR... | [
"pypy.module.test_lib_pypy.cffi_tests.cffi0.backend_tests.BackendTests.test_CData_CType_2",
"py.test.skip"
] | [((399, 485), 'py.test.skip', 'py.test.skip', (['"""ctypes backend: not supported: initializers for function pointers"""'], {}), "(\n 'ctypes backend: not supported: initializers for function pointers')\n", (411, 485), False, 'import py, sys\n'), ((553, 642), 'py.test.skip', 'py.test.skip', (['"""ctypes backend: not... |
# -*- coding: utf-8 -*-
"""
TODO:
Fix slowness
Fix sorting so columns are initially sorted in ascending order
"""
import logging
from wbia.guitool.__PYQT__ import QtCore, QtGui, QVariantHack
from wbia.guitool.__PYQT__.QtCore import Qt
from wbia.guitool import qtype
from wbia.guitool.guitool_decorators import ... | [
"utool.is_funclike",
"utool.replace_nones",
"utool.grab_test_imgpath",
"numpy.isnan",
"utool.noinject",
"six.moves.zip",
"utool.get_argflag",
"wbia.guitool.api_tree_node.TreeNode",
"wbia.guitool.__PYQT__.QVariantHack",
"utool.printex",
"wbia.guitool.ensure_qapp",
"wbia.guitool.qtype.cast_from_... | [((796, 821), 'logging.getLogger', 'logging.getLogger', (['"""wbia"""'], {}), "('wbia')\n", (813, 821), False, 'import logging\n'), ((822, 861), 'utool.noinject', 'ut.noinject', (['__name__', '"""[APIItemModel]"""'], {}), "(__name__, '[APIItemModel]')\n", (833, 861), True, 'import utool as ut\n'), ((1013, 1057), 'utool... |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
import datetime as dt
from io import StringIO
import logging
import numpy as np
import pytest
from sys import version_info
import warnings
import aacgmv2
class TestFutureDepWarning:
def setup(self):
# Initialize th... | [
"warnings.simplefilter",
"numpy.testing.assert_almost_equal",
"aacgmv2.deprecated.subsol",
"aacgmv2.deprecated.gc2gd_lat",
"datetime.datetime",
"numpy.array",
"warnings.catch_warnings",
"numpy.testing.assert_allclose",
"aacgmv2.deprecated.igrf_dipole_axis"
] | [((1307, 1339), 'datetime.datetime', 'dt.datetime', (['(2015)', '(1)', '(1)', '(0)', '(0)', '(0)'], {}), '(2015, 1, 1, 0, 0, 0)\n', (1318, 1339), True, 'import datetime as dt\n'), ((2151, 2183), 'datetime.datetime', 'dt.datetime', (['(2015)', '(1)', '(1)', '(0)', '(0)', '(0)'], {}), '(2015, 1, 1, 0, 0, 0)\n', (2162, 21... |