code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from io import BytesIO
from io import StringIO
import json
from bson.dbref import DBRef
import datetime
from bson import json_util
import logging
import base64
jsonCode ={
"building":{
"Essae Vaishnavi Solitaire": {
"id": "B1",
"division": {
"SS"... | [
"logging.basicConfig",
"bson.dbref.DBRef",
"logging.getLogger",
"datetime.datetime.strptime",
"json.dumps",
"datetime.datetime.now",
"qrcode.make",
"datetime.datetime.today",
"pymongo.MongoClient",
"datetime.timedelta"
] | [((7101, 7195), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""server.log"""', 'format': '"""%(asctime)s %(message)s"""', 'filemode': '"""a"""'}), "(filename='server.log', format='%(asctime)s %(message)s',\n filemode='a')\n", (7120, 7195), False, 'import logging\n'), ((7282, 7301), 'logging.getL... |
# python3
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"mock.Mock",
"mock.patch.object",
"dags.bq_to_cm_dag.BigQueryToCMDag",
"unittest.main",
"mock.MagicMock"
] | [((3473, 3488), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3486, 3488), False, 'import unittest\n'), ((1901, 1974), 'mock.patch.object', 'mock.patch.object', (['cloud_auth', '"""build_impersonated_client"""'], {'autospec': '(True)'}), "(cloud_auth, 'build_impersonated_client', autospec=True)\n", (1918, 1974),... |
from django.core.management.base import BaseCommand
import logging
import re
from talentmap_api.common.xml_helpers import XMLloader, strip_extra_spaces, parse_boolean, parse_date, get_nested_tag
from talentmap_api.language.models import Language, Proficiency
from talentmap_api.position.models import Grade, Skill, Pos... | [
"logging.getLogger",
"talentmap_api.common.xml_helpers.XMLloader",
"talentmap_api.common.xml_helpers.strip_extra_spaces",
"talentmap_api.position.models.Position.objects.filter",
"talentmap_api.organization.models.Location.objects.filter",
"talentmap_api.organization.models.Post.objects.filter",
"talent... | [((544, 571), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (561, 571), False, 'import logging\n'), ((2223, 2299), 'talentmap_api.common.xml_helpers.XMLloader', 'XMLloader', (['model', 'instance_tag', 'tag_map', 'collision_behavior', 'collision_field'], {}), '(model, instance_tag, tag_ma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.recfile
"""
import unittest
import os
import shutil
import uuid
from .fix_path import fix_sys_path
fix_sys_path(__file__)
from gluon import recfile
class TestRecfile(unittest.TestCase):
def setUp(self):
os.mkdir('tests')
d... | [
"gluon.recfile.exists",
"uuid.uuid4",
"os.mkdir",
"shutil.rmtree",
"unittest.main",
"gluon.recfile.remove",
"gluon.recfile.open"
] | [((2565, 2580), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2578, 2580), False, 'import unittest\n'), ((296, 313), 'os.mkdir', 'os.mkdir', (['"""tests"""'], {}), "('tests')\n", (304, 313), False, 'import os\n'), ((347, 369), 'shutil.rmtree', 'shutil.rmtree', (['"""tests"""'], {}), "('tests')\n", (360, 369), Fa... |
"""Miscellaneous utility functions."""
from functools import reduce
from PIL import Image
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
def compose(*funcs):
"""Compose arbitrarily many functions, evaluated left to right.
Reference: https://mathieularose.com/function-composition-in-... | [
"PIL.Image.open",
"numpy.random.rand",
"numpy.logical_and",
"PIL.Image.new",
"numpy.asarray",
"numpy.max",
"numpy.array",
"numpy.zeros",
"matplotlib.colors.hsv_to_rgb",
"numpy.min",
"numpy.random.shuffle"
] | [((847, 886), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'size', '(128, 128, 128)'], {}), "('RGB', size, (128, 128, 128))\n", (856, 886), False, 'from PIL import Image\n'), ((1257, 1276), 'PIL.Image.open', 'Image.open', (['line[0]'], {}), '(line[0])\n', (1267, 1276), False, 'from PIL import Image\n'), ((2591, 2632), ... |
import re
from pyquery import PyQuery as pq
from .. import utils
from .constants import RANKINGS_SCHEME, RANKINGS_URL
from six.moves.urllib.error import HTTPError
class Rankings:
"""
Get all Associated Press (AP) rankings on a week-by-week basis.
Grab a list of the rankings published by the Associated Pr... | [
"re.sub",
"pyquery.PyQuery"
] | [((2268, 2299), 're.sub', 're.sub', (['"""/.*"""', '""""""', 'abbreviation'], {}), "('/.*', '', abbreviation)\n", (2274, 2299), False, 'import re\n'), ((1235, 1258), 'pyquery.PyQuery', 'pq', (['(RANKINGS_URL % year)'], {}), '(RANKINGS_URL % year)\n', (1237, 1258), True, 'from pyquery import PyQuery as pq\n')] |
import re
from zlib import crc32
from ..utils import snake_to_camel_case
CORE_TYPES = (
0xbc799737, # boolFalse#bc799737 = Bool;
0x997275b5, # boolTrue#997275b5 = Bool;
0x3fedd339, # true#3fedd339 = True;
0x1cb5c415, # vector#1cb5c415 {t:Type} # [ t ] = Vector t;
)
# https://github.com/telegramde... | [
"re.compile",
"re.match",
"re.sub",
"re.findall",
"re.search"
] | [((8192, 8307), 're.match', 're.match', (['"""^([\\\\w.]+)(?:#([0-9a-fA-F]+))?(?:\\\\s{?\\\\w+:[\\\\w\\\\d<>#.?!]+}?)*\\\\s=\\\\s([\\\\w\\\\d<>#.?]+);$"""', 'line'], {}), "(\n '^([\\\\w.]+)(?:#([0-9a-fA-F]+))?(?:\\\\s{?\\\\w+:[\\\\w\\\\d<>#.?!]+}?)*\\\\s=\\\\s([\\\\w\\\\d<>#.?]+);$'\n , line)\n", (8200, 8307), Fa... |
# Owner(s): ["oncall: jit"]
import torch
import os
import sys
from torch.testing._internal.jit_utils import JitTestCase
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
if __name__ == '__main__':
raise Ru... | [
"os.path.realpath",
"sys.path.append",
"torch.randn"
] | [((246, 279), 'sys.path.append', 'sys.path.append', (['pytorch_test_dir'], {}), '(pytorch_test_dir)\n', (261, 279), False, 'import sys\n'), ((217, 243), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (233, 243), False, 'import os\n'), ((1017, 1031), 'torch.randn', 'torch.randn', (['(5)'], {... |
#! /usr/bin/env python
import arc
import sys
import os
def retrieve(uc, endpoints):
# The ComputingServiceRetriever needs the UserConfig to know which credentials
# to use in case of HTTPS connections
retriever = arc.ComputingServiceRetriever(uc, endpoints)
# the constructor of the ComputingServiceRetr... | [
"os.getuid",
"arc.ThreadInitializer",
"arc.ComputingServiceRetriever",
"arc.UserConfig",
"arc.Endpoint",
"sys.stdout.write"
] | [((226, 270), 'arc.ComputingServiceRetriever', 'arc.ComputingServiceRetriever', (['uc', 'endpoints'], {}), '(uc, endpoints)\n', (255, 270), False, 'import arc\n'), ((350, 372), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (366, 372), False, 'import sys\n'), ((377, 467), 'sys.stdout.write', '... |
from flask import Blueprint
auth=Blueprint('auth',__name__)
from .import views,forms | [
"flask.Blueprint"
] | [((33, 60), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (42, 60), False, 'from flask import Blueprint\n')] |
import pandas as pd
import numpy as np
def estimate_volatility(prices, l):
"""Create an exponential moving average model of the volatility of a stock
price, and return the most recent (last) volatility estimate.
Parameters
----------
prices : pandas.Series
A series of adjusted closing... | [
"pandas.read_csv"
] | [((973, 1048), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': "['date']", 'index_col': '"""date"""', 'squeeze': '(True)'}), "(filename, parse_dates=['date'], index_col='date', squeeze=True)\n", (984, 1048), True, 'import pandas as pd\n')] |
import sys
n, q = map(int, sys.stdin.readline().split())
s = '$' + sys.stdin.readline().rstrip()
lr = zip(*[map(int, sys.stdin.read().split())] * 2)
def main():
res = [None] * (n + 1); res[0] = 0
prev = '$'
for i in range(1, n+1):
res[i] = res[i-1]
res[i] += (prev == 'A' and s[i... | [
"sys.stdin.readline",
"sys.stdin.read"
] | [((30, 50), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (48, 50), False, 'import sys\n'), ((71, 91), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (89, 91), False, 'import sys\n'), ((122, 138), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (136, 138), False, 'import sys\n')] |
"""
A class hierarchy relating to fields of all kinds.
"""
from __future__ import print_function, division
import numpy as np
from ciabatta.meta import make_repr_str
from fealty import lattice, field_numerics, walled_field_numerics
class Space(object):
def __init__(self, L, dim):
self.L = L
self.... | [
"numpy.logical_not",
"fealty.field_numerics.density_3d",
"fealty.walled_field_numerics.grad_3d",
"fealty.field_numerics.div_1d",
"fealty.lattice.i_to_r",
"ciabatta.meta.make_repr_str",
"fealty.walled_field_numerics.grad_i_1d",
"fealty.field_numerics.grad_i_1d",
"numpy.empty",
"fealty.walled_field_... | [((3872, 3896), 'fealty.lattice.r_to_i', 'lattice.r_to_i', (['r', 'L', 'dx'], {}), '(r, L, dx)\n', (3886, 3896), False, 'from fealty import lattice, field_numerics, walled_field_numerics\n'), ((3905, 3946), 'numpy.zeros', 'np.zeros', (['(r.shape[1] * (M,))'], {'dtype': 'np.int'}), '(r.shape[1] * (M,), dtype=np.int)\n',... |
"""
ASGI config for example_django project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANG... | [
"os.environ.setdefault",
"os.system",
"django.core.asgi.get_asgi_application"
] | [((292, 366), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""example_django.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'example_django.settings')\n", (313, 366), False, 'import os\n'), ((382, 404), 'django.core.asgi.get_asgi_application', 'get_asgi_application', ([], {}), '... |
# +
#
# Copyright 2016 The BigDL Authors.
#
# 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... | [
"bigdl.chronos.model.prophet.ProphetModel",
"bigdl.orca.automl.hp.uniform",
"bigdl.orca.automl.hp.loguniform",
"pandas.Timedelta",
"bigdl.orca.automl.hp.choice",
"bigdl.chronos.model.prophet.ProphetBuilder",
"bigdl.chronos.autots.utils.recalculate_n_sampling",
"warnings.warn",
"bigdl.orca.automl.aut... | [((3348, 3362), 'bigdl.chronos.model.prophet.ProphetModel', 'ProphetModel', ([], {}), '()\n', (3360, 3362), False, 'from bigdl.chronos.model.prophet import ProphetBuilder, ProphetModel\n'), ((4543, 4559), 'bigdl.chronos.model.prophet.ProphetBuilder', 'ProphetBuilder', ([], {}), '()\n', (4557, 4559), False, 'from bigdl.... |
# module pyparsing.py
#
# Copyright (c) 2003-2019 <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 restriction, including
# without limitation the rights to use, copy, modify... | [
"pyparsing.CaselessKeyword",
"pyparsing.Regex",
"pyparsing.Forward",
"pyparsing.Group",
"pyparsing.Word",
"pyparsing.Literal"
] | [((2472, 2492), 'pyparsing.CaselessKeyword', 'CaselessKeyword', (['"""E"""'], {}), "('E')\n", (2487, 2492), False, 'from pyparsing import Literal, Word, Group, Forward, alphas, alphanums, Regex, CaselessKeyword, Suppress, delimitedList\n'), ((2502, 2523), 'pyparsing.CaselessKeyword', 'CaselessKeyword', (['"""PI"""'], {... |
from itertools import combinations
import copy
def get_reverse(n):
if n == 1:
return 0
else:
return 1
def get_edge_info(e):
v = [0 for i in range(2)]
n = [0 for i in range(2)]
t = 0
for x in e:
v[t], n[t] = x
t += 1
return v, n
def sort_e_by_domain(val)... | [
"itertools.combinations",
"copy.copy"
] | [((1671, 1687), 'copy.copy', 'copy.copy', (['edges'], {}), '(edges)\n', (1680, 1687), False, 'import copy\n'), ((1016, 1057), 'itertools.combinations', 'combinations', (['indexlist[cursor:oldlen]', '(2)'], {}), '(indexlist[cursor:oldlen], 2)\n', (1028, 1057), False, 'from itertools import combinations\n')] |
# coding=utf-8
# Copyright 2020 The HuggingFace Team 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 require... | [
"nn_pruning.sparse_trainer.SparseTrainer.__init__"
] | [((1176, 1217), 'nn_pruning.sparse_trainer.SparseTrainer.__init__', 'SparseTrainer.__init__', (['self', 'sparse_args'], {}), '(self, sparse_args)\n', (1198, 1217), False, 'from nn_pruning.sparse_trainer import SparseTrainer\n')] |
# -*- coding: future_fstrings -*-
#
# Copyright 2019 <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This file is part of acados.
#
# The 2-Clause BSD License
#
# Redistribution and use in source and binary forms, with or without
#... | [
"os.path.exists",
"numpy.ones",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"numpy.sum",
"numpy.zeros",
"copy.deepcopy",
"json.load",
"os.system",
"numpy.shape",
"json.dump"
] | [((15748, 15771), 'numpy.sum', 'np.sum', (['opts.time_steps'], {}), '(opts.time_steps)\n', (15754, 15771), True, 'import numpy as np\n'), ((16019, 16059), 'os.path.dirname', 'os.path.dirname', (['current_module.__file__'], {}), '(current_module.__file__)\n', (16034, 16059), False, 'import sys, os, json\n'), ((9215, 923... |
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.application"
__author__ = "<NAME>"
__all__ = ["Application", "AppStateError", "TimeoutError", "VersionError",
"AppState", "requires_s... | [
"enum.auto",
"functools.wraps",
"time.time"
] | [((526, 532), 'enum.auto', 'auto', ([], {}), '()\n', (530, 532), False, 'from enum import Flag, auto\n'), ((547, 553), 'enum.auto', 'auto', ([], {}), '()\n', (551, 553), False, 'from enum import Flag, auto\n'), ((569, 575), 'enum.auto', 'auto', ([], {}), '()\n', (573, 575), False, 'from enum import Flag, auto\n'), ((58... |
# Copyright (c) 2020 PaddlePaddle 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 app... | [
"paddle._C_ops.real",
"paddle._C_ops.final_state_real",
"paddle._C_ops.imag",
"paddle._C_ops.final_state_imag"
] | [((6059, 6085), 'paddle._C_ops.final_state_real', '_C_ops.final_state_real', (['x'], {}), '(x)\n', (6082, 6085), False, 'from paddle import _C_ops\n'), ((6130, 6144), 'paddle._C_ops.real', '_C_ops.real', (['x'], {}), '(x)\n', (6141, 6144), False, 'from paddle import _C_ops\n'), ((7755, 7781), 'paddle._C_ops.final_state... |
# Barcode Example
#
# This example shows off how easy it is to detect bar codes using the
# OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # High Res!
sensor.set_windowing((640, 80... | [
"sensor.set_windowing",
"sensor.skip_frames",
"sensor.set_auto_gain",
"time.clock",
"sensor.set_pixformat",
"sensor.set_auto_whitebal",
"sensor.set_framesize",
"sensor.reset",
"sensor.snapshot"
] | [((192, 206), 'sensor.reset', 'sensor.reset', ([], {}), '()\n', (204, 206), False, 'import sensor, image, time, math\n'), ((207, 245), 'sensor.set_pixformat', 'sensor.set_pixformat', (['sensor.GRAYSCALE'], {}), '(sensor.GRAYSCALE)\n', (227, 245), False, 'import sensor, image, time, math\n'), ((246, 278), 'sensor.set_fr... |
# coding: utf-8
"""
Marketplace Insights API
<a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-api.svg\" class=\"legend-icon partners-icon\" title=\"Limited Release\" alt=\"Limited Release\" />(Limited Release)</a> The Marketpl... | [
"six.iteritems"
] | [((8458, 8491), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (8471, 8491), False, 'import six\n')] |
#!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2019 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-... | [
"codegen.c_switch_generator_t",
"genutil.field_check",
"re.search"
] | [((1102, 1145), 'codegen.c_switch_generator_t', 'codegen.c_switch_generator_t', (['"""isa_set"""', 'fo'], {}), "('isa_set', fo)\n", (1130, 1145), False, 'import codegen\n'), ((1697, 1730), 'genutil.field_check', 'genutil.field_check', (['ii', '"""iclass"""'], {}), "(ii, 'iclass')\n", (1716, 1730), False, 'import genuti... |
"""
Module containing all the spectrogram classes
"""
# 0.2.0
import torch
import torch.nn as nn
from torch.nn.functional import conv1d, conv2d, fold
import numpy as np
from time import time
from nnAudio.librosa_functions import *
from nnAudio.utils import *
sz_float = 4 # size of a float
epsilon = 10e-8 # fudg... | [
"torch.nn.functional.conv2d",
"numpy.sqrt",
"torch.nn.functional.conv1d",
"torch.sin",
"torch.max",
"torch.sqrt",
"torch.cos",
"torch.arange",
"torch.nn.ReflectionPad1d",
"torch.nn.ConstantPad1d",
"torch.rfft",
"torch.matmul",
"torch.pinverse",
"torch.randn",
"torch.optim.SGD",
"numpy.... | [((4751, 4757), 'time.time', 'time', ([], {}), '()\n', (4755, 4757), False, 'from time import time\n'), ((5660, 5703), 'torch.tensor', 'torch.tensor', (['kernel_sin'], {'dtype': 'torch.float'}), '(kernel_sin, dtype=torch.float)\n', (5672, 5703), False, 'import torch\n'), ((5725, 5768), 'torch.tensor', 'torch.tensor', (... |
"""
Custom management command to rebuild thumbnail images
- May be required after importing a new dataset, for example
"""
import os
import logging
from PIL import UnidentifiedImageError
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.utils import OperationalError... | [
"logging.getLogger",
"os.path.exists",
"company.models.Company.objects.exclude",
"part.models.Part.objects.exclude",
"os.path.join"
] | [((415, 456), 'logging.getLogger', 'logging.getLogger', (['"""inventree-thumbnails"""'], {}), "('inventree-thumbnails')\n", (432, 456), False, 'import logging\n'), ((806, 844), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', 'url'], {}), '(settings.MEDIA_ROOT, url)\n', (818, 844), False, 'import os\n'), ((1418... |
from glue.core.data_factories.helpers import has_extension
from glue.config import data_factory
__all__ = ['tabular_data']
@data_factory(label="ASCII Table",
identifier=has_extension('csv txt tsv tbl dat '
'csv.gz txt.gz tbl.bz '
... | [
"glue.core.data_factories.helpers.has_extension"
] | [((187, 251), 'glue.core.data_factories.helpers.has_extension', 'has_extension', (['"""csv txt tsv tbl dat csv.gz txt.gz tbl.bz dat.gz"""'], {}), "('csv txt tsv tbl dat csv.gz txt.gz tbl.bz dat.gz')\n", (200, 251), False, 'from glue.core.data_factories.helpers import has_extension\n')] |
# External deps
import os, sys, json
from pathlib import Path
from typing import Dict, List
# Internal deps
os.chdir(sys.path[0])
sys.path.append("..")
import df_common as dfc
import analyses_common as ac
# Generated files directory
GEN_FILE_DIR = str(Path(__file__).resolve().parent.parent) + os.sep + "generated_file... | [
"os.path.exists",
"pathlib.Path",
"os.path.join",
"analyses_common.build_dict_two_lvl_cnt",
"os.chdir",
"graph_dd_sloc_by_arch.get_sloc_avg_and_list_by_arch",
"sys.exit",
"json.load",
"analyses_common.argparse_and_get_files",
"analyses_common.print_mean_median_std_dev_for_dict_of_lists",
"sys.pa... | [((109, 130), 'os.chdir', 'os.chdir', (['sys.path[0]'], {}), '(sys.path[0])\n', (117, 130), False, 'import os, sys, json\n'), ((131, 152), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (146, 152), False, 'import os, sys, json\n'), ((361, 389), 'os.path.exists', 'os.path.exists', (['GEN_FILE_DIR'... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 <NAME> <<EMAIL>>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# 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 withou... | [
"re.split",
"os.path.isabs",
"re.compile",
"os.path.join",
"yaml.load",
"os.getcwd",
"time.time"
] | [((1658, 1707), 're.compile', 're.compile', (['"""(?P<token>[a-z0-9][a-z0-9_]+)"""', 're.I'], {}), "('(?P<token>[a-z0-9][a-z0-9_]+)', re.I)\n", (1668, 1707), False, 'import re\n'), ((2676, 2687), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2685, 2687), False, 'import os\n'), ((12727, 12738), 'time.time', 'time.time', ... |
import sys
import subprocess
from subprocess import Popen, PIPE
AV_LOG_QUIET = "quiet"
AV_LOG_PANIC = "panic"
AV_LOG_FATAL = "fatal"
AV_LOG_ERROR = "error"
AV_LOG_WARNING = "warning"
AV_LOG_INFO = "info"
AV_LOG_VERBOSE = "verbose"
AV_LOG_DEBUG = "debug"
ffmpeg_loglevel = AV_LOG_ERROR
IS_WIN32 = 'win32' ... | [
"subprocess.Popen",
"subprocess.STARTUPINFO"
] | [((401, 425), 'subprocess.STARTUPINFO', 'subprocess.STARTUPINFO', ([], {}), '()\n', (423, 425), False, 'import subprocess\n'), ((801, 856), 'subprocess.Popen', 'Popen', (['cmd'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(cmd, stdout=PIPE, stderr=PIPE, **SUBPROCESS_ARGS)\n', (806, 856), False, 'from subprocess import Pop... |
from setuptools import setup
setup(
name="nmn-iwp",
version="0.1",
keywords="",
packages=["vr", "vr.models"]
)
| [
"setuptools.setup"
] | [((30, 109), 'setuptools.setup', 'setup', ([], {'name': '"""nmn-iwp"""', 'version': '"""0.1"""', 'keywords': '""""""', 'packages': "['vr', 'vr.models']"}), "(name='nmn-iwp', version='0.1', keywords='', packages=['vr', 'vr.models'])\n", (35, 109), False, 'from setuptools import setup\n')] |
""" Represent a triangulated surface using a 3D boolean grid"""
import logging
import numpy as np
from rpl.tools.ray_tracing.bsp_tree_poly import BSP_Element
from rpl.tools.geometry import geom_utils
import data_io
class BSP_Grid(object):
def __init__(self, node_array, tris, allocate_step=100000):
... | [
"mayavi.mlab.points3d",
"numpy.arccos",
"data_io.save_multi_array",
"mayavi.mlab.show",
"rpl.tools.geometry.geom_utils.rotation_about_vector",
"numpy.where",
"numpy.hstack",
"numpy.min",
"numpy.max",
"rpl.tools.ray_tracing.bsp_tree_poly.BSP_Element",
"numpy.array",
"numpy.dot",
"numpy.zeros"... | [((2930, 3002), 'numpy.arange', 'np.arange', (['x_min', "(x_max + settings['voxel_size'])", "settings['voxel_size']"], {}), "(x_min, x_max + settings['voxel_size'], settings['voxel_size'])\n", (2939, 3002), True, 'import numpy as np\n'), ((3017, 3089), 'numpy.arange', 'np.arange', (['y_min', "(y_max + settings['voxel_s... |
'''
>List of functions
1. encrypt(user_input,passphrase) - Encrypt the given string with the given passphrase. Returns cipher text and locked pad.
2. decrypt(cipher_text,locked_pad,passphrase) - Decrypt the cipher text encrypted with SBET. It requires cipher text, locked pad, and passphrase.
'''
# CODE ============... | [
"zlib.decompress",
"silver_bullet.contain_value.contain",
"random.seed",
"random.randrange"
] | [((1076, 1101), 'random.seed', 'random.seed', (['bloated_seed'], {}), '(bloated_seed)\n', (1087, 1101), False, 'import random\n'), ((663, 720), 'silver_bullet.contain_value.contain', 'contain', (['(target_list[counter] + pad[counter])', 'ascii_value'], {}), '(target_list[counter] + pad[counter], ascii_value)\n', (670, ... |
import random
class Status(object):
def getHeadPosition(gamedata):
me = gamedata['you']
my_position = me['body']
head = my_position[0]
return head
def getMyLength(gamedata):
me = gamedata['you']
my_position = me['body']
if my_position[0] == my_position[1] == my_position[2]:
return 1
elif my_... | [
"random.choice"
] | [((3760, 3782), 'random.choice', 'random.choice', (['options'], {}), '(options)\n', (3773, 3782), False, 'import random\n'), ((4772, 4794), 'random.choice', 'random.choice', (['options'], {}), '(options)\n', (4785, 4794), False, 'import random\n')] |
from dataclasses import dataclass
import math
import chess
import chess.engine
from model import EngineMove, NextMovePair
from chess import Color, Board
from chess.pgn import GameNode
from chess.engine import SimpleEngine, Score
nps = []
def material_count(board: Board, side: Color) -> int:
values = { chess.PAWN:... | [
"model.NextMovePair",
"math.exp"
] | [((1172, 1212), 'model.NextMovePair', 'NextMovePair', (['node', 'winner', 'best', 'second'], {}), '(node, winner, best, second)\n', (1184, 1212), False, 'from model import EngineMove, NextMovePair\n'), ((1934, 1955), 'math.exp', 'math.exp', (['(-0.004 * cp)'], {}), '(-0.004 * cp)\n', (1942, 1955), False, 'import math\n... |
import time, morning
from datetime import datetime
def main():
while True:
a = time.mktime(datetime.now().timetuple())
n = datetime.now()
if n.hour == 6 and (n.minute-(n.minute%5)) == 15:
return morning.main()
time.sleep(300 - (time.mktime(datetime.now().timetuple())-a)) | [
"datetime.datetime.now",
"morning.main"
] | [((135, 149), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (147, 149), False, 'from datetime import datetime\n'), ((214, 228), 'morning.main', 'morning.main', ([], {}), '()\n', (226, 228), False, 'import time, morning\n'), ((100, 114), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (112, 114),... |
import sys
import json
import subprocess
import re
import statistics
def get_complexity():
# Load the cyclomatic complexity info
cyclostats = subprocess.check_output(['./gocyclo', 'repo']).decode("utf-8")
results = re.findall('([0-9]+)\s([^\s]+)\s([^\s]+)\s([^:]+):([0-9]+):([0-9]+)', cyclostats)
# S... | [
"subprocess.check_output",
"re.findall",
"json.dumps",
"statistics.median_high"
] | [((230, 320), 're.findall', 're.findall', (['"""([0-9]+)\\\\s([^\\\\s]+)\\\\s([^\\\\s]+)\\\\s([^:]+):([0-9]+):([0-9]+)"""', 'cyclostats'], {}), "('([0-9]+)\\\\s([^\\\\s]+)\\\\s([^\\\\s]+)\\\\s([^:]+):([0-9]+):([0-9]+)',\n cyclostats)\n", (240, 320), False, 'import re\n'), ((1044, 1148), 're.findall', 're.findall', (... |
"""
Testing if parso finds syntax errors and indentation errors.
"""
import sys
import warnings
import pytest
import parso
from parso._compatibility import is_pypy
from .failing_examples import FAILING_EXAMPLES, indent, build_nested
if is_pypy:
# The errors in PyPy might be different. Just skip the module for n... | [
"pytest.mark.skip",
"warnings.catch_warnings",
"parso.load_grammar",
"pytest.mark.parametrize",
"pytest.skip",
"warnings.filterwarnings"
] | [((726, 775), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""code"""', 'FAILING_EXAMPLES'], {}), "('code', FAILING_EXAMPLES)\n", (749, 775), False, 'import pytest\n'), ((1872, 2288), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('code', 'positions')", "[('1 +', [(1, 3)]), ('1 +\\n', [(1, 3)]), ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE
RANKNUM = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9
}
def decoder(f):
color = ... | [
"shogitk.shogi.Move"
] | [((720, 776), 'shogitk.shogi.Move', 'Move', (['color[step & 1]', 'dst', 'src', 'None'], {'modifier': 'modifier'}), '(color[step & 1], dst, src, None, modifier=modifier)\n', (724, 776), False, 'from shogitk.shogi import Coords, Move, BLACK, WHITE, DROP, PROMOTE\n'), ((906, 962), 'shogitk.shogi.Move', 'Move', (['color[st... |
import getpass
from plumbum import local
from plumbum.machines.paramiko_machine import ParamikoMachine
from plumbum.path.utils import copy
def _once(f):
res = None
def wrapped(*args, **kwargs):
nonlocal res
if res is None:
res = f(*args, **kwargs)
return res
return wrapp... | [
"plumbum.path.utils.copy",
"plumbum.machines.paramiko_machine.ParamikoMachine",
"getpass.getpass"
] | [((396, 464), 'getpass.getpass', 'getpass.getpass', ([], {'prompt': 'f"""Password for {user}@{host}: """', 'stream': 'None'}), "(prompt=f'Password for {user}@{host}: ', stream=None)\n", (411, 464), False, 'import getpass\n'), ((476, 527), 'plumbum.machines.paramiko_machine.ParamikoMachine', 'ParamikoMachine', (['host']... |
from quart import Quart, jsonify, request
from quart_jwt_extended import (
JWTManager,
jwt_required,
create_access_token,
jwt_refresh_token_required,
create_refresh_token,
get_jwt_identity,
fresh_jwt_required,
)
app = Quart(__name__)
app.config["JWT_SECRET_KEY"] = "super-secret" # Change ... | [
"quart.Quart",
"quart_jwt_extended.create_refresh_token",
"quart_jwt_extended.JWTManager",
"quart.request.get_json",
"quart_jwt_extended.create_access_token",
"quart_jwt_extended.get_jwt_identity"
] | [((247, 262), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (252, 262), False, 'from quart import Quart, jsonify, request\n'), ((332, 347), 'quart_jwt_extended.JWTManager', 'JWTManager', (['app'], {}), '(app)\n', (342, 347), False, 'from quart_jwt_extended import JWTManager, jwt_required, create_access_to... |
from unittest import TestCase
from unittest.mock import Mock, patch
import sys
sys.modules['smbus'] = Mock() # Mock the hardware layer to avoid errors.
from ledshimdemo.canvas import Canvas
from ledshimdemo.effects.cheerlights import CheerLightsEffect
class TestCheerLights(TestCase):
TEST_CANVAS_SIZE = 3 # t... | [
"ledshimdemo.canvas.Canvas",
"unittest.mock.patch",
"ledshimdemo.effects.cheerlights.CheerLightsEffect",
"unittest.mock.Mock"
] | [((103, 109), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (107, 109), False, 'from unittest.mock import Mock, patch\n'), ((562, 673), 'unittest.mock.patch', 'patch', (['"""ledshimdemo.effects.cheerlights.CheerLightsEffect.get_colour_from_channel"""'], {'return_value': 'None'}), "(\n 'ledshimdemo.effects.cheerlig... |
from colicoords.synthetic_data import add_readout_noise, draw_poisson
from colicoords import load
import numpy as np
import mahotas as mh
from tqdm import tqdm
import os
import tifffile
def chunk_list(l, sizes):
prev = 0
for s in sizes:
result = l[prev:prev+s]
prev += s
yield result
... | [
"numpy.random.normal",
"numpy.ones_like",
"mahotas.distance",
"colicoords.synthetic_data.draw_poisson",
"numpy.random.rand",
"tqdm.tqdm",
"os.path.join",
"numpy.floor",
"numpy.max",
"numpy.exp",
"numpy.append",
"numpy.zeros",
"colicoords.synthetic_data.add_readout_noise",
"numpy.random.see... | [((4100, 4131), 'numpy.arange', 'np.arange', (['(step / 2)', 'xmax', 'step'], {}), '(step / 2, xmax, step)\n', (4109, 4131), True, 'import numpy as np\n'), ((4141, 4172), 'numpy.arange', 'np.arange', (['(step / 2)', 'ymax', 'step'], {}), '(step / 2, ymax, step)\n', (4150, 4172), True, 'import numpy as np\n'), ((4361, 4... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"ai_flow.rest_endpoint.service.stringValue",
"ai_flow.meta.metric_meta.MetricType.value_of",
"ai_flow.rest_endpoint.protobuf.message_pb2.ReturnCode.Name",
"ast.literal_eval",
"ai_flow.meta.metric_meta.MetricSummary",
"ai_flow.rest_endpoint.service.int64Value"
] | [((2570, 2763), 'ai_flow.meta.metric_meta.MetricSummary', 'MetricSummary', ([], {'uuid': 'metric_summary_result.uuid', 'metric_id': 'metric_summary_result.metric_id', 'metric_key': 'metric_summary_result.metric_key', 'metric_value': 'metric_summary_result.metric_value'}), '(uuid=metric_summary_result.uuid, metric_id=\n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def flow_to_img(flow, normalize=True):
"""Convert flow to viewable image, using color hue to encode flow vector orientation, and color saturation to
encode vector length. This is similar to the OpenCV tutorial on dense optical flow, e... | [
"cv2.normalize",
"numpy.where",
"numpy.any",
"numpy.zeros",
"numpy.isnan",
"cv2.cvtColor"
] | [((764, 823), 'numpy.zeros', 'np.zeros', (['(flow.shape[0], flow.shape[1], 3)'], {'dtype': 'np.uint8'}), '((flow.shape[0], flow.shape[1], 3), dtype=np.uint8)\n', (772, 823), True, 'import numpy as np\n'), ((1011, 1035), 'numpy.isnan', 'np.isnan', (['flow_magnitude'], {}), '(flow_magnitude)\n', (1019, 1035), True, 'impo... |
# Copyright (c) 2015 Openstack Foundation
#
# 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 ... | [
"netaddr.IPNetwork",
"oslo_utils.excutils.save_and_reraise_exception",
"neutron.agent.linux.ip_lib.IPRule",
"neutron.agent.linux.ip_lib.send_garp_for_proxyarp",
"neutron.agent.linux.ip_lib.IPDevice",
"neutron.agent.linux.ip_lib.device_exists",
"neutron.common.utils.ip_to_cidr",
"neutron.agent.l3.dvr_s... | [((1027, 1054), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1044, 1054), True, 'from oslo_log import log as logging\n'), ((3521, 3558), 'neutron.agent.linux.ip_lib.IPRule', 'ip_lib.IPRule', ([], {'namespace': 'self.ns_name'}), '(namespace=self.ns_name)\n', (3534, 3558), False, 'f... |
#!/usr/bin/env python
import chainer
from algs import trpo
from env_makers import EnvMaker
from models import GaussianMLPPolicy, MLPBaseline
from utils import SnapshotSaver
import numpy as np
import os
import logger
log_dir = "data/local/trpo-pendulum"
np.random.seed(42)
# Clean up existing logs
os.system("rm -rf {... | [
"models.GaussianMLPPolicy",
"env_makers.EnvMaker",
"models.MLPBaseline",
"numpy.random.seed",
"logger.session",
"utils.SnapshotSaver"
] | [((256, 274), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (270, 274), True, 'import numpy as np\n'), ((346, 369), 'logger.session', 'logger.session', (['log_dir'], {}), '(log_dir)\n', (360, 369), False, 'import logger\n'), ((387, 410), 'env_makers.EnvMaker', 'EnvMaker', (['"""Pendulum-v0"""'], {}),... |
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2019/12/2 10:17
# @Author: <EMAIL>
"""
正则解析器
"""
try:
import xml.etree.cElementTree as et
except ModuleNotFoundError:
import xml.etree.ElementTree as et
import re
class RegexEngine:
def __init__(self, xml, str_):
"""加载正则表。正则表为xml
:pa... | [
"re.findall",
"xml.etree.ElementTree.parse"
] | [((951, 984), 're.findall', 're.findall', (['self.re', 'self._string'], {}), '(self.re, self._string)\n', (961, 984), False, 'import re\n'), ((426, 439), 'xml.etree.ElementTree.parse', 'et.parse', (['xml'], {}), '(xml)\n', (434, 439), True, 'import xml.etree.ElementTree as et\n')] |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.collections as mcoll
from matplotlib.ticker import MaxNLocator
plt.style.use('seaborn-darkgrid')
class BaseTraj:
def __init__(self, model, X):
self.model = model
assert len(X.shape) == 2, f"X should be 2... | [
"numpy.sqrt",
"matplotlib.collections.LineCollection",
"numpy.array",
"matplotlib.ticker.MaxNLocator",
"numpy.arctan2",
"matplotlib.pyplot.Normalize",
"numpy.asarray",
"matplotlib.pyplot.style.use",
"numpy.linspace",
"matplotlib.cm.ScalarMappable",
"numpy.vstack",
"numpy.concatenate",
"numpy... | [((158, 191), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-darkgrid"""'], {}), "('seaborn-darkgrid')\n", (171, 191), True, 'import matplotlib.pyplot as plt\n'), ((8329, 8351), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""copper"""'], {}), "('copper')\n", (8341, 8351), True, 'import matplotlib.py... |
import imp
from venv import create
from django.shortcuts import render, redirect
from django.views import View
from django.views.generic import (
ListView,
)
from account.models import *
from account.forms import *
from data.models import *
from django.contrib.auth import login as auth_login
from django.contrib.a... | [
"django.shortcuts.render",
"django.contrib.messages.error",
"django.contrib.messages.warning",
"django.contrib.auth.login",
"django.contrib.auth.models.auth.logout",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((1219, 1257), 'django.shortcuts.render', 'render', (['request', '"""login.html"""', 'context'], {}), "(request, 'login.html', context)\n", (1225, 1257), False, 'from django.shortcuts import render, redirect\n'), ((1284, 1304), 'django.contrib.auth.models.auth.logout', 'auth.logout', (['request'], {}), '(request)\n', ... |
import logging
import os
import pickle
import sys
import threading
import time
from typing import List
from Giveme5W1H.extractor.root import path
from Giveme5W1H.extractor.tools.util import bytes_2_human_readable
class KeyValueCache(object):
def __init__(self, cache_path):
"""
:param cache_path: ... | [
"logging.getLogger",
"os.path.getsize",
"pickle.dump",
"threading.Lock",
"sys.getsizeof",
"pickle.load",
"os.path.isfile",
"time.time",
"Giveme5W1H.extractor.root.path"
] | [((404, 433), 'logging.getLogger', 'logging.getLogger', (['"""GiveMe5W"""'], {}), "('GiveMe5W')\n", (421, 433), False, 'import logging\n'), ((510, 526), 'Giveme5W1H.extractor.root.path', 'path', (['cache_path'], {}), '(cache_path)\n', (514, 526), False, 'from Giveme5W1H.extractor.root import path\n'), ((1080, 1096), 't... |
from argparse import ArgumentParser
from tqdm import tqdm
import NSST
from nsst_translate import best_transition_sequence
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("--nsst_file", default="output/nsst_tss20_th4_nSt100_Q0.pkl", help="nsst file")
parser.add_argument("--src_lan... | [
"nsst_translate.best_transition_sequence",
"NSST.NSST",
"argparse.ArgumentParser"
] | [((165, 181), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (179, 181), False, 'from argparse import ArgumentParser\n'), ((685, 696), 'NSST.NSST', 'NSST.NSST', ([], {}), '()\n', (694, 696), False, 'import NSST\n'), ((1633, 1663), 'nsst_translate.best_transition_sequence', 'best_transition_sequence', ([... |
# Import library
import math
# Define functionts
def mean(data):
return sum(data) / len(data)
def stddev(data, size):
sum = 0
for i in range(size):
sum = sum + (data[i] - mean(data)) ** 2
return math.sqrt(sum / size)
# Set data
size = int(input())
numbers = list(map(int, input().split()))
# ... | [
"math.sqrt"
] | [((221, 242), 'math.sqrt', 'math.sqrt', (['(sum / size)'], {}), '(sum / size)\n', (230, 242), False, 'import math\n')] |
#!/usr/bin/env python3
# python 线程测试
import _thread
import time
from yvhai.demo.base import YHDemo
def print_time(thread_name, interval, times):
for cnt in range(times):
time.sleep(interval)
print(" -- %s: %s" % (thread_name, time.ctime(time.time())))
class RawThreadDemo(YHDemo):
def __in... | [
"_thread.start_new_thread",
"time.sleep",
"time.time"
] | [((187, 207), 'time.sleep', 'time.sleep', (['interval'], {}), '(interval)\n', (197, 207), False, 'import time\n'), ((447, 505), '_thread.start_new_thread', '_thread.start_new_thread', (['print_time', "('Thread-01', 1, 10)"], {}), "(print_time, ('Thread-01', 1, 10))\n", (471, 505), False, 'import _thread\n'), ((518, 575... |
import cv2
from cv2 import *
import numpy as np
from matplotlib import pyplot as plt
###############################SIFT MATCH Function#################################
def SIFTMATCH(img1,img2):
# Initiate SIFT detector
sift = cv2.xfeatures2d.SIFT_create()
# find the keypoints and descri... | [
"numpy.int32",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.xfeatures2d.SIFT_create",
"cv2.moveWindow",
"cv2.arcLength",
"cv2.contourArea",
"cv2.perspectiveTransform",
"cv2.waitKey",
"cv2.getTickFrequency",
"cv2.drawContours",
"cv2.findHomography",
"cv2.putText",
"cv2.circle",
"cv2.moment... | [((4277, 4295), 'cv2.getTickCount', 'cv2.getTickCount', ([], {}), '()\n', (4293, 4295), False, 'import cv2\n'), ((4792, 4818), 'cv2.imread', 'cv2.imread', (['"""Scene.jpg"""', '(0)'], {}), "('Scene.jpg', 0)\n", (4802, 4818), False, 'import cv2\n'), ((4869, 4894), 'cv2.imread', 'cv2.imread', (['"""img3.jpg"""', '(0)'], ... |
import dash
from dash.exceptions import PreventUpdate
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import dash_bootstrap_components as dbc
import dash_table
import plotly.express as ex
import plotly.graph_objects as go
import pandas as pd
imp... | [
"pandas.read_csv",
"dash.dependencies.Input",
"numpy.argsort",
"dash_html_components.Td",
"dash_bootstrap_components.Label",
"dash_html_components.Div",
"dash.Dash",
"dash_bootstrap_components.Tooltip",
"dash.dependencies.Output",
"dash_html_components.Span",
"numpy.asarray",
"dash_bootstrap_c... | [((345, 398), 'pandas.read_csv', 'pd.read_csv', (['"""./data/Phone_dataset_new.csv"""'], {'header': '(0)'}), "('./data/Phone_dataset_new.csv', header=0)\n", (356, 398), True, 'import pandas as pd\n'), ((409, 458), 'pandas.read_csv', 'pd.read_csv', (['"""./data/Phone_details.csv"""'], {'header': '(0)'}), "('./data/Phone... |
# Segmentation script
# -------------------
# This script lets the user segment automatically one or many images based on the default segmentation models: SEM or
# TEM.
#
# <NAME> - 2017-08-30
# Imports
import sys
from pathlib import Path
import json
import argparse
from argparse import RawTextHelpFormatter
from tqd... | [
"argparse.ArgumentParser",
"pathlib.Path",
"AxonDeepSeg.ads_utils.imwrite",
"AxonDeepSeg.ads_utils.convert_path",
"tqdm.tqdm",
"pkg_resources.resource_filename",
"AxonDeepSeg.apply_model.axon_segmentation",
"sys.exit"
] | [((643, 699), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""AxonDeepSeg"""', '"""models"""'], {}), "('AxonDeepSeg', 'models')\n", (674, 699), False, 'import pkg_resources\n'), ((714, 731), 'pathlib.Path', 'Path', (['MODELS_PATH'], {}), '(MODELS_PATH)\n', (718, 731), False, 'from pathlib im... |
from dcstats.hedges import Hedges_d
from dcstats.statistics_EJ import simple_stats as mean_SD
import random
import math
def generate_sample (length, mean, sigma):
#generate a list of normal distributed samples
sample = []
for n in range(length):
sample.append(random.gauss(mean, sigma))
return ... | [
"dcstats.hedges.Hedges_d",
"math.sqrt",
"math.fabs",
"dcstats.statistics_EJ.simple_stats",
"random.gauss"
] | [((551, 573), 'math.sqrt', 'math.sqrt', (['sample_size'], {}), '(sample_size)\n', (560, 573), False, 'import math\n'), ((723, 739), 'dcstats.hedges.Hedges_d', 'Hedges_d', (['s1', 's2'], {}), '(s1, s2)\n', (731, 739), False, 'from dcstats.hedges import Hedges_d\n'), ((373, 389), 'math.fabs', 'math.fabs', (['(a - b)'], {... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.Records, name ="fRec"),
] | [
"django.urls.path"
] | [((70, 106), 'django.urls.path', 'path', (['""""""', 'views.Records'], {'name': '"""fRec"""'}), "('', views.Records, name='fRec')\n", (74, 106), False, 'from django.urls import path\n')] |
import pytest
from spacy.training.example import Example
from spacy.util import make_tempdir
from spacy import util
from thinc.api import Config
TRAIN_DATA = [
("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}),
("I'm so angry", {"cats": {"POSITIVE": 0.0, "NEGATIVE": 1.0}}),
]
cfg_string = """
... | [
"spacy.util.load_model_from_config",
"spacy.util.load_model_from_path",
"thinc.api.Config",
"spacy.util.make_tempdir"
] | [((1181, 1252), 'spacy.util.load_model_from_config', 'util.load_model_from_config', (['orig_config'], {'auto_fill': '(True)', 'validate': '(True)'}), '(orig_config, auto_fill=True, validate=True)\n', (1208, 1252), False, 'from spacy import util\n'), ((1754, 1768), 'spacy.util.make_tempdir', 'make_tempdir', ([], {}), '(... |
import asyncio
from ..core.common.io import input
from .action_creator import ActionCreator
class REPL:
def __init__(self, action_queue, config, *args, **kwargs):
self.action_queue = action_queue
self.config = config
async def run(self):
await asyncio.sleep(1)
print("Insert c... | [
"asyncio.all_tasks",
"asyncio.sleep"
] | [((280, 296), 'asyncio.sleep', 'asyncio.sleep', (['(1)'], {}), '(1)\n', (293, 296), False, 'import asyncio\n'), ((495, 514), 'asyncio.all_tasks', 'asyncio.all_tasks', ([], {}), '()\n', (512, 514), False, 'import asyncio\n')] |
# %% [markdown]
# # Testing python-som with audio dataset
# %% [markdown]
# # Imports
# %%
import matplotlib.pyplot as plt
# import librosa as lr
# import librosa.display as lrdisp
import numpy as np
import pandas as pd
import pickle
import seaborn as sns
import sklearn.preprocessing
from python_som import SOM
FILE... | [
"pickle.dump",
"pandas.read_csv",
"seaborn.color_palette",
"seaborn.diverging_palette",
"pickle.load",
"seaborn.heatmap",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"python_som.SOM",
"seaborn.barplot",
"seaborn.countplot",
"matplotlib.pyplot.draw",... | [((395, 455), 'pandas.read_csv', 'pd.read_csv', (['"""features_means.csv"""'], {'index_col': '(0)', 'verbose': '(True)'}), "('features_means.csv', index_col=0, verbose=True)\n", (406, 455), True, 'import pandas as pd\n'), ((467, 491), 'pandas.to_datetime', 'pd.to_datetime', (['df.index'], {}), '(df.index)\n', (481, 491... |
"""Script to embed pydeck examples into .rst pages with code
These populate the files you see once you click into a grid cell
on the pydeck gallery page
"""
from multiprocessing import Pool
import os
import subprocess
import sys
from const import DECKGL_URL_BASE, EXAMPLE_GLOB, GALLERY_DIR, HTML_DIR, HOSTED_STATIC_PAT... | [
"os.path.join",
"os.environ.get",
"utils.to_snake_case_string",
"subprocess.call",
"multiprocessing.Pool",
"os.path.basename",
"utils.to_presentation_name"
] | [((428, 460), 'os.environ.get', 'os.environ.get', (['"""MAPBOX_API_KEY"""'], {}), "('MAPBOX_API_KEY')\n", (442, 460), False, 'import os\n'), ((638, 694), 'utils.to_snake_case_string', 'to_snake_case_string', ([], {'file_name': 'pydeck_example_file_name'}), '(file_name=pydeck_example_file_name)\n', (658, 694), False, 'f... |
from django.conf.urls import include, url
from django.views.generic.base import TemplateView
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .collection.urls import urlpatterns as collection_urls
from .customer.urls import urlpatterns as customer_urls
from .discount.urls ... | [
"django.conf.urls.include",
"django.conf.urls.url",
"django.views.generic.base.TemplateView.as_view"
] | [((1630, 1671), 'django.conf.urls.url', 'url', (['"""^$"""', 'core_views.index'], {'name': '"""index"""'}), "('^$', core_views.index, name='index')\n", (1633, 1671), False, 'from django.conf.urls import include, url\n'), ((2295, 2357), 'django.conf.urls.url', 'url', (['"""^style-guide/"""', 'core_views.styleguide'], {'... |
import os
import sys
import torch
import yaml
from functools import partial
sys.path.append('../../../../')
from trainers import trainer, frn_train
from datasets import dataloaders
from models.FRN import FRN
args = trainer.train_parser()
with open('../../../../config.yml', 'r') as f:
temp = yaml.safe_load(f)
data... | [
"models.FRN.FRN",
"trainers.trainer.Path_Manager",
"trainers.trainer.Train_Manager",
"os.path.join",
"yaml.safe_load",
"functools.partial",
"os.path.abspath",
"sys.path.append",
"datasets.dataloaders.meta_train_dataloader",
"trainers.trainer.train_parser"
] | [((76, 107), 'sys.path.append', 'sys.path.append', (['"""../../../../"""'], {}), "('../../../../')\n", (91, 107), False, 'import sys\n'), ((217, 239), 'trainers.trainer.train_parser', 'trainer.train_parser', ([], {}), '()\n', (237, 239), False, 'from trainers import trainer, frn_train\n'), ((328, 362), 'os.path.abspath... |
from gym_pcgrl.envs.reps.representation3D import Representation3D
from PIL import Image
from gym import spaces
import numpy as np
from gym_pcgrl.envs.probs.minecraft.mc_render import reps_3D_render
"""
The wide representation where the agent can pick the tile position and tile value at each update.
"""
class Wide3DRep... | [
"gym.spaces.MultiDiscrete",
"gym.spaces.Box"
] | [((994, 1050), 'gym.spaces.MultiDiscrete', 'spaces.MultiDiscrete', (['[length, width, height, num_tiles]'], {}), '([length, width, height, num_tiles])\n', (1014, 1050), False, 'from gym import spaces\n'), ((1541, 1629), 'gym.spaces.Box', 'spaces.Box', ([], {'low': '(0)', 'high': '(num_tiles - 1)', 'dtype': 'np.uint8', ... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Description :
Author : cmy
date: 2020/1/2
-------------------------------------------------
"""
import datetime
import heapq
import numpy as np
import tensorflow as tf
import time
from metrics import ndcg_at_k
from tr... | [
"numpy.mean",
"train.get_user_record",
"numpy.random.choice",
"metrics.ndcg_at_k",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"heapq.nlargest",
"numpy.sum",
"datetime.datetime.now",
"DMF.DMF",
"tensorflow.ConfigProto",
"time.time",
"numpy.random.shuffle"
] | [((429, 445), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (443, 445), True, 'import tensorflow as tf\n'), ((766, 791), 'DMF.DMF', 'DMF', (['args', 'n_user', 'n_item'], {}), '(args, n_user, n_item)\n', (769, 791), False, 'from DMF import DMF\n'), ((870, 903), 'train.get_user_record', 'get_user_record',... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import uuid
import random
import math
import time
import typing as t
from . import experiment as hip
# Demos from the README. If one of those ... | [
"random.uniform",
"random.choice",
"uuid.uuid4",
"random.random",
"time.time",
"random.randint",
"random.gauss"
] | [((2618, 2633), 'random.random', 'random.random', ([], {}), '()\n', (2631, 2633), False, 'import random\n'), ((1848, 1883), 'random.choice', 'random.choice', (['exp.datapoints[-10:]'], {}), '(exp.datapoints[-10:])\n', (1861, 1883), False, 'import random\n'), ((2749, 2770), 'random.uniform', 'random.uniform', (['(0)', '... |
import logging
import groceries.api as groceries
import barcodescanner.scan as barcode
def main():
grocy = groceries.GrocyAPIClient()
while True:
scanner = barcode.Scan()
line = scanner.PollScanner()
if line != None:
response = grocy.consume_barcode(line)
loggin... | [
"logging.basicConfig",
"barcodescanner.scan.Scan",
"groceries.api.GrocyAPIClient",
"logging.debug"
] | [((113, 139), 'groceries.api.GrocyAPIClient', 'groceries.GrocyAPIClient', ([], {}), '()\n', (137, 139), True, 'import groceries.api as groceries\n'), ((371, 411), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (390, 411), False, 'import logging\n'), ((174, 188... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="easy-icm-runner",
version="1.0.6",
author="<NAME>",
author_email="<EMAIL>",
description="A wrapper for IBM ICMs Scheduler API Calls",
long_description=long_description,
long_descri... | [
"setuptools.setup"
] | [((88, 612), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""easy-icm-runner"""', 'version': '"""1.0.6"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""A wrapper for IBM ICMs Scheduler API Calls"""', 'long_description': 'long_description', 'long_description_content_type': '""... |
from setuptools import find_packages, setup
setup(name='ActT',
version='0.6',
description='Active Testing',
url='',
author='',
author_email='none',
license='BSD',
packages=find_packages(),
install_requires=[
'numpy', 'pandas', 'matplotlib','scipy','scikit-learn',... | [
"setuptools.find_packages"
] | [((215, 230), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (228, 230), False, 'from setuptools import find_packages, setup\n')] |
# deltat.py time difference calculation for sensor fusion
# Released under the MIT License (MIT)
# Copyright (c) 2018 <NAME>
# Provides TimeDiff function and DeltaT class.
# The following notes cover special cases. Where the device performing fusion
# is linked to the IMU and is running MicroPython no special treatmen... | [
"time.ticks_diff",
"time.ticks_us"
] | [((2667, 2682), 'time.ticks_us', 'time.ticks_us', ([], {}), '()\n', (2680, 2682), False, 'import time\n'), ((2203, 2230), 'time.ticks_diff', 'time.ticks_diff', (['start', 'end'], {}), '(start, end)\n', (2218, 2230), False, 'import time\n')] |
# -*- coding: utf-8 -*-
"""
Sony Colourspaces
=================
Defines the *Sony* colourspaces:
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT`.
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3`.
- :attr:`colour.models.RGB_COLOURSPACE_S_GAMUT3_CINE`.
- :attr:`colour.models.RGB_COLOURSPACE_VENICE_S_GAMUT3`.
- ... | [
"numpy.array",
"colour.models.rgb.normalised_primary_matrix",
"colour.models.rgb.RGB_Colourspace",
"numpy.linalg.inv"
] | [((3760, 3813), 'numpy.array', 'np.array', (['[[0.73, 0.28], [0.14, 0.855], [0.1, -0.05]]'], {}), '([[0.73, 0.28], [0.14, 0.855], [0.1, -0.05]])\n', (3768, 3813), True, 'import numpy as np\n'), ((4273, 4421), 'numpy.array', 'np.array', (['[[0.7064827132, 0.1288010498, 0.1151721641], [0.2709796708, 0.7866064112, -\n ... |
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File :EWC -> network
@IDE :PyCharm
@Author :<NAME>
@Date :2021/6/23 20:28
@Desc :
=================================================='''
from tensorflow.keras import Model
from tensorflow.keras.layers import Dense, Conv2D,L... | [
"tensorflow.keras.Model",
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Dense"
] | [((378, 425), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(784)', 'dtype': '"""float32"""', 'name': '"""input"""'}), "(shape=784, dtype='float32', name='input')\n", (383, 425), False, 'from tensorflow.keras.layers import Dense, Conv2D, LeakyReLU, MaxPool2D, Flatten, Input\n'), ((694, 714), 'tensorflow.ker... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import os
import pprint
import unittest
import numpy as np
# pyre-fixme[21]: Could not find module `pytest`.
import pytest
import torch
from parameterized import parameterized
from reagent.core.types import R... | [
"logging.getLogger",
"reagent.gym.utils.build_normalizer",
"reagent.gym.utils.fill_replay_buffer",
"torch.cuda.is_available",
"reagent.replay_memory.circular_replay_buffer.ReplayBuffer",
"unittest.main",
"torch.utils.tensorboard.SummaryWriter",
"numpy.mean",
"reagent.tensorboardX.summary_writer_cont... | [((1286, 1313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1303, 1313), False, 'import logging\n'), ((2639, 2664), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2654, 2664), False, 'import os\n'), ((2776, 2807), 'parameterized.parameterized.expand', 'para... |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(ErrorGroup)
admin.site.register(Error) | [
"django.contrib.admin.site.register"
] | [((84, 115), 'django.contrib.admin.site.register', 'admin.site.register', (['ErrorGroup'], {}), '(ErrorGroup)\n', (103, 115), False, 'from django.contrib import admin\n'), ((116, 142), 'django.contrib.admin.site.register', 'admin.site.register', (['Error'], {}), '(Error)\n', (135, 142), False, 'from django.contrib impo... |
from rest_framework import serializers
from .models import *
class CoordinatorSerializer(serializers.ModelSerializer):
# ModelID = serializers.CharField(max_length=100, required=True)
CourseID = serializers.CharField(max_length=100, required=True)
FName = serializers.CharField(max_length=100, required=Fa... | [
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.CharField"
] | [((206, 258), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(100)', 'required': '(True)'}), '(max_length=100, required=True)\n', (227, 258), False, 'from rest_framework import serializers\n'), ((271, 324), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'ma... |
import cv2
import numpy as np
from keras.models import model_from_json
from keras.preprocessing.image import img_to_array
#load model
model = model_from_json(open("fer.json", "r").read()) #change the path accoring to files
#load weights
model.load_weights('fer.h5') #change the path accor... | [
"cv2.rectangle",
"keras.preprocessing.image.img_to_array",
"cv2.imshow",
"cv2.putText",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"numpy.expand_dims",
"cv2.CascadeClassifier",
"cv2.resize",
"cv2.waitKey"
] | [((472, 515), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['detection_model_path'], {}), '(detection_model_path)\n', (493, 515), False, 'import cv2\n'), ((564, 583), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (580, 583), False, 'import cv2\n'), ((1747, 1770), 'cv2.destroyAllWindows', 'cv2.de... |
#!/usr/bin/env python
import logging
from datetime import datetime
logging.basicConfig(level=logging.WARNING)
import os
import urllib2, base64, json
import dateutil.parser
def from_ISO8601( str_iso8601 ):
return dateutil.parser.parse(str_iso8601)
def to_ISO8601( timestamp ):
return timestamp.isoformat()
de... | [
"logging.basicConfig",
"logging.getLogger",
"os.path.exists",
"urllib2.urlopen",
"urllib2.ProxyHandler",
"urllib2.Request",
"urllib2.HTTPHandler",
"urllib2.install_opener",
"base64.encodestring",
"urllib2.HTTPSHandler",
"json.load",
"os.path.expanduser"
] | [((68, 110), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARNING'}), '(level=logging.WARNING)\n', (87, 110), False, 'import logging\n'), ((792, 818), 'logging.getLogger', 'logging.getLogger', (['"""Toggl"""'], {}), "('Toggl')\n", (809, 818), False, 'import logging\n'), ((2098, 2127), 'urllib2.... |
from typing import Optional
import torch
from gs_divergence import gs_div
def symmetrized_gs_div(
input: torch.Tensor,
target: torch.Tensor,
alpha: float = -1,
lmd: float = 0.5,
reduction: Optional[str] = 'sum',
) -> torch.Tensor:
lhs = gs_div(input, target, alpha=alpha, lmd=lmd, reduction=re... | [
"gs_divergence.gs_div"
] | [((264, 328), 'gs_divergence.gs_div', 'gs_div', (['input', 'target'], {'alpha': 'alpha', 'lmd': 'lmd', 'reduction': 'reduction'}), '(input, target, alpha=alpha, lmd=lmd, reduction=reduction)\n', (270, 328), False, 'from gs_divergence import gs_div\n'), ((339, 403), 'gs_divergence.gs_div', 'gs_div', (['target', 'input']... |
'''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By <NAME>
'''
import warnings
warnings.filterwarnings("ignore")
from models.vit import Visi... | [
"models.med.BertConfig.from_json_file",
"timm.models.hub.download_cached_file",
"urllib.parse.urlparse",
"models.vit.interpolate_pos_embed",
"torch.load",
"transformers.BertTokenizer.from_pretrained",
"os.path.isfile",
"models.vit.VisionTransformer",
"models.med.BertModel",
"models.med.BertLMHeadM... | [((258, 291), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (281, 291), False, 'import warnings\n'), ((8347, 8397), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-uncased"""'], {}), "('bert-base-uncased')\n", (8376, 8397), F... |
#! /usr/local/bin/python3
# -*- coding: UTF-8 -*-
# 抓取 妹子图 并存储
import urllib.request
import os
import random
def open_url(url):
request = urllib.request.Request(url)
request.add_header('User-Agent',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0')
... | [
"os.chdir",
"os.path.exists",
"random.choice",
"os.mkdir"
] | [((1692, 1714), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (1706, 1714), False, 'import os\n'), ((1733, 1749), 'os.mkdir', 'os.mkdir', (['folder'], {}), '(folder)\n', (1741, 1749), False, 'import os\n'), ((1758, 1774), 'os.chdir', 'os.chdir', (['folder'], {}), '(folder)\n', (1766, 1774), False,... |
# copyright (c) 2018 paddlepaddle 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 app... | [
"numpy.product",
"paddle.fluid.DataFeeder",
"paddle.nn.layer.ReLU",
"paddle.fluid.dygraph.guard",
"paddle.fluid.dygraph.to_variable",
"paddle.static.InputSpec",
"paddle.fluid.layers.cross_entropy",
"paddle.fluid.layers.data",
"numpy.array",
"paddle.fluid.Executor",
"paddle.fluid.log_helper.get_l... | [((1541, 1563), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (1561, 1563), False, 'import paddle\n'), ((1596, 1624), 'paddle.fluid.core.is_compiled_with_cuda', 'core.is_compiled_with_cuda', ([], {}), '()\n', (1622, 1624), False, 'from paddle.fluid import core\n'), ((1694, 1779), 'paddle.fluid.log_h... |
import os
import glob
import shutil
import yaml
from IPython import embed
import pytest
import numpy as np
from pypeit.par.util import parse_pypeit_file
from pypeit.pypeitsetup import PypeItSetup
from pypeit.tests.tstutils import dev_suite_required, data_path
from pypeit.metadata import PypeItMetaData
from pypeit.s... | [
"pypeit.scripts.setup.Setup.main",
"numpy.where",
"os.path.join",
"yaml.load",
"pypeit.par.util.parse_pypeit_file",
"os.path.isfile",
"pypeit.tests.tstutils.data_path",
"os.path.isdir",
"pypeit.metadata.PypeItMetaData",
"shutil.rmtree",
"numpy.all",
"pypeit.spectrographs.util.load_spectrograph... | [((547, 571), 'pypeit.tests.tstutils.data_path', 'data_path', (['"""setup_files"""'], {}), "('setup_files')\n", (556, 571), False, 'from pypeit.tests.tstutils import dev_suite_required, data_path\n'), ((579, 603), 'os.path.isdir', 'os.path.isdir', (['setup_dir'], {}), '(setup_dir)\n', (592, 603), False, 'import os\n'),... |
import numpy as np
import pickle
import os
def GenerateFeature_alpha(ligand_name, working_dir):
Cut = 12.0
LIGELE = ['C','N','O','S','CN','CO','CS','NO','NS','OS','CCl','CBr','CP','CF','CNO','CNS','COS','NOS','CNOS','CNOSPFClBrI','H','CH','NH','OH','SH','CNH','COH','CSH','NOH','NSH','OSH','CNOH','CNSH','COSH'... | [
"os.path.exists",
"numpy.mean",
"numpy.asarray",
"pickle.load",
"numpy.min",
"numpy.max",
"numpy.argmax",
"numpy.sum",
"numpy.std",
"numpy.save"
] | [((500, 519), 'pickle.load', 'pickle.load', (['InFile'], {}), '(InFile)\n', (511, 519), False, 'import pickle\n'), ((4686, 4714), 'numpy.asarray', 'np.asarray', (['Feature_i', 'float'], {}), '(Feature_i, float)\n', (4696, 4714), True, 'import numpy as np\n'), ((4806, 4833), 'numpy.save', 'np.save', (['outfile', 'Featur... |
import tensorflow as tf
def _is_tensor(x):
"""Returns `True` if `x` is a symbolic tensor-like object.
From http://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/image_ops_impl.py
Args:
x: A python object to check.
Returns:
`True` if `x` is a `tf.Tensor` or `tf.Va... | [
"tensorflow.meshgrid",
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.assert_greater_equal",
"tensorflow.control_dependencies",
"tensorflow.assert_non_negative",
"tensorflow.image.non_max_suppression_overlaps",
"tensorflow.clip_by_value",
"tensorflow.maximum",
"tensorflow.convert_to_tensor",
... | [((2734, 2768), 'tensorflow.random.uniform', 'tf.random.uniform', (['*args'], {}), '(*args, **kwargs)\n', (2751, 2768), True, 'import tensorflow as tf\n'), ((2808, 2831), 'tensorflow.pad', 'tf.pad', (['*args'], {}), '(*args, **kwargs)\n', (2814, 2831), True, 'import tensorflow as tf\n'), ((2873, 2903), 'tensorflow.math... |
# 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... | [
"tensorflow.contrib.framework.python.ops.variables.local_variable",
"tensorflow.python.ops.array_ops.placeholder",
"tensorflow.contrib.framework.python.framework.tensor_util.reduce_sum_n",
"numpy.ones",
"re.compile",
"tensorflow.python.ops.variables.local_variables_initializer",
"tensorflow.python.ops.v... | [((16270, 16281), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (16279, 16281), False, 'from tensorflow.python.platform import test\n'), ((2684, 2716), 'tensorflow.contrib.framework.python.framework.tensor_util.assert_scalar_int', 'tensor_util.assert_scalar_int', (['(3)'], {}), '(3)\n', (2713, ... |
#!/usr/bin/env python3
# Copyright 2021 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Simple script for updating musl from extern... | [
"os.path.exists",
"os.path.join",
"shutil.copytree",
"os.path.dirname",
"shutil.rmtree",
"os.path.abspath"
] | [((902, 942), 'os.path.join', 'os.path.join', (['script_dir', '"""libc"""', '"""musl"""'], {}), "(script_dir, 'libc', 'musl')\n", (914, 942), False, 'import os\n'), ((1315, 1343), 'os.path.abspath', 'os.path.abspath', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1330, 1343), False, 'import os\n'), ((863, 888), 'os.path.d... |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
# Used in the exec() call below.
from scout_apm.core.monkey import monkeypatch_method, unpatch_method # noqa: F401
from scout_apm.core.tracked_request import TrackedRequest # noqa: F401
logger = logging.getLogger(__na... | [
"logging.getLogger",
"scout_apm.core.monkey.unpatch_method"
] | [((298, 325), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (315, 325), False, 'import logging\n'), ((3319, 3357), 'scout_apm.core.monkey.unpatch_method', 'unpatch_method', (['Collection', 'method_str'], {}), '(Collection, method_str)\n', (3333, 3357), False, 'from scout_apm.core.monkey ... |
from abc import ABC, abstractmethod
import collections
import pandas as pd
from autoscalingsim.utils.error_check import ErrorChecker
class Correlator(ABC):
_Registry = {}
@abstractmethod
def _compute_correlation(self, metrics_vals_1 : pd.Series, metrics_vals_2 : pd.Series, lag : int):
pass
... | [
"pandas.DataFrame",
"pandas.Timedelta",
"collections.defaultdict",
"autoscalingsim.utils.error_check.ErrorChecker.key_check_and_load"
] | [((391, 483), 'autoscalingsim.utils.error_check.ErrorChecker.key_check_and_load', 'ErrorChecker.key_check_and_load', (['"""history_buffer_size"""', 'config', 'self.__class__.__name__'], {}), "('history_buffer_size', config, self.\n __class__.__name__)\n", (422, 483), False, 'from autoscalingsim.utils.error_check imp... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0035-Search-Insert-Position.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-01-01
============================... | [
"time.process_time"
] | [((2847, 2866), 'time.process_time', 'time.process_time', ([], {}), '()\n', (2864, 2866), False, 'import time\n'), ((2923, 2942), 'time.process_time', 'time.process_time', ([], {}), '()\n', (2940, 2942), False, 'import time\n')] |
import requests
url = 'https://192.168.3.11/api/contextaware/v1/maps/info/DevNetCampus/DevNetBuilding/DevNetZone'
headers = {'Authorization': 'Basic bGVhcm5pbmc6bGVhcm5pbmc=='}
response = requests.get(url, headers=headers, verify=False)
responseString = response.text
print(responseString)
| [
"requests.get"
] | [((188, 236), 'requests.get', 'requests.get', (['url'], {'headers': 'headers', 'verify': '(False)'}), '(url, headers=headers, verify=False)\n', (200, 236), False, 'import requests\n')] |
""" Code for wrapping the motion primitive action in an object. """
from __future__ import division
from __future__ import absolute_import
import attr
import numpy as np
from bc_gym_planning_env.utilities.serialize import Serializable
@attr.s(cmp=False)
class Action(Serializable):
""" Object representing an 'ac... | [
"numpy.array",
"attr.s",
"attr.ib"
] | [((240, 257), 'attr.s', 'attr.s', ([], {'cmp': '(False)'}), '(cmp=False)\n', (246, 257), False, 'import attr\n'), ((411, 435), 'attr.ib', 'attr.ib', ([], {'type': 'np.ndarray'}), '(type=np.ndarray)\n', (418, 435), False, 'import attr\n'), ((567, 639), 'numpy.array', 'np.array', (['[wanted_linear_velocity_of_baselink, w... |
import matplotlib.pyplot as plt
import pandas as pd
import math
import numpy as np
from scipy import stats
import seaborn as sns
data = pd.read_csv("data/500-4.txt", sep="\t")
# example1 = data[data["SIM_TIME"] == 500]
simulations = 500
simtimes = [5, 50, 150, 500, 1000]
# for i in [1, 2, 4]:
# data = pd.read_c... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((137, 176), 'pandas.read_csv', 'pd.read_csv', (['"""data/500-4.txt"""'], {'sep': '"""\t"""'}), "('data/500-4.txt', sep='\\t')\n", (148, 176), True, 'import pandas as pd\n'), ((531, 571), 'pandas.read_csv', 'pd.read_csv', (['f"""data/500-2.txt"""'], {'sep': '"""\t"""'}), "(f'data/500-2.txt', sep='\\t')\n", (542, 571),... |
import os
import logging
import yaml
from schema import Use, Schema, SchemaError, Optional
class InvalidConfig(Exception):
pass
class MissingConfig(Exception):
pass
default_config = {
'logging': 30,
'migrate_from_0_3_2': True
}
schema = Schema({
'stellar_url': Use(str),
'url': Use(str),
... | [
"logging.getLogger",
"os.path.exists",
"schema.Optional",
"os.getenv",
"schema.Use",
"yaml.dump",
"os.path.join",
"os.getcwd",
"yaml.safe_load"
] | [((508, 519), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (517, 519), False, 'import os\n'), ((1020, 1047), 'os.getenv', 'os.getenv', (['"""STELLAR_CONFIG"""'], {}), "('STELLAR_CONFIG')\n", (1029, 1047), False, 'import os\n'), ((389, 408), 'schema.Optional', 'Optional', (['"""logging"""'], {}), "('logging')\n", (397, 4... |
#!/usr/bin/env python3
# Copyright 2021 <NAME> University (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import os
import random
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-d", help="downloads directory", type=str, default="downl... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"random.Random",
"os.path.join"
] | [((212, 237), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (235, 237), False, 'import argparse\n'), ((768, 788), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (782, 788), False, 'import os\n'), ((1308, 1324), 'random.Random', 'random.Random', (['(0)'], {}), '(0)\n', (1321, 1... |
import geojson
import pytest
from napari_geojson import write_shapes
ellipse = [[[0, 0], [0, 5], [5, 5], [5, 0]], "ellipse", "Polygon"]
line = [[[0, 0], [5, 5]], "line", "LineString"]
polygon = [[[0, 0], [5, 5], [0, 10]], "polygon", "Polygon"]
polyline = [[[0, 0], [5, 5], [0, 10]], "path", "LineString"]
rectangle = [... | [
"pytest.mark.parametrize",
"geojson.load",
"napari_geojson.write_shapes"
] | [((520, 616), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""coords,shape_type,expected"""', 'sample_shapes'], {'ids': 'sample_shapes_ids'}), "('coords,shape_type,expected', sample_shapes, ids=\n sample_shapes_ids)\n", (543, 616), False, 'import pytest\n'), ((1045, 1076), 'napari_geojson.write_shapes', ... |
#!/usr/bin/env python3
from collections import defaultdict
import numpy as np
from pgmpy.base import UndirectedGraph
from pgmpy.factors import factor_product
class ClusterGraph(UndirectedGraph):
r"""
Base class for representing Cluster Graph.
Cluster graph is an undirected graph which is associated wi... | [
"numpy.sum",
"collections.defaultdict"
] | [((8516, 8532), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (8527, 8532), False, 'from collections import defaultdict\n'), ((9995, 10016), 'numpy.sum', 'np.sum', (['factor.values'], {}), '(factor.values)\n', (10001, 10016), True, 'import numpy as np\n')] |
from PySide6.QtWidgets import QListWidgetItem
from yapsy.IPlugin import IPlugin
class Plugin(IPlugin):
def __init__(self):
IPlugin.__init__(self)
def activate(self):
IPlugin.activate(self)
return
def deactivate(self):
IPlugin.deactivate(self)
def set_current_window(self, ... | [
"PySide6.QtWidgets.QListWidgetItem",
"yapsy.IPlugin.IPlugin.__init__",
"yapsy.IPlugin.IPlugin.activate",
"yapsy.IPlugin.IPlugin.deactivate"
] | [((141, 163), 'yapsy.IPlugin.IPlugin.__init__', 'IPlugin.__init__', (['self'], {}), '(self)\n', (157, 163), False, 'from yapsy.IPlugin import IPlugin\n'), ((194, 216), 'yapsy.IPlugin.IPlugin.activate', 'IPlugin.activate', (['self'], {}), '(self)\n', (210, 216), False, 'from yapsy.IPlugin import IPlugin\n'), ((261, 285)... |
"""Helpers for the Broadlink remote."""
from base64 import b64decode
from homeassistant.helpers import config_validation as cv
def decode_packet(value):
"""Decode a data packet given for a Broadlink remote."""
value = cv.string(value)
extra = len(value) % 4
if extra > 0:
value = value + ("=" ... | [
"base64.b64decode",
"homeassistant.helpers.config_validation.string"
] | [((229, 245), 'homeassistant.helpers.config_validation.string', 'cv.string', (['value'], {}), '(value)\n', (238, 245), True, 'from homeassistant.helpers import config_validation as cv\n'), ((346, 362), 'base64.b64decode', 'b64decode', (['value'], {}), '(value)\n', (355, 362), False, 'from base64 import b64decode\n')] |