code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
from django.contrib import admin
from blog.models import category, article, comment, communication
# Register your models here.
class categoryAdmin(admin.ModelAdmin):
search_fields = (
'name',
)
list_display = (
'name',
)
admin.site.register(category, categoryAdmin)
class articlesA... | [
"django.contrib.admin.site.register"
] | [((258, 302), 'django.contrib.admin.site.register', 'admin.site.register', (['category', 'categoryAdmin'], {}), '(category, categoryAdmin)\n', (277, 302), False, 'from django.contrib import admin\n'), ((490, 533), 'django.contrib.admin.site.register', 'admin.site.register', (['article', 'articlesAdmin'], {}), '(article... |
# Python stubs generated by omniidl from idl/ManipulatorCommonInterface_Common.idl
import omniORB, _omnipy
from omniORB import CORBA, PortableServer
_0_CORBA = CORBA
_omnipy.checkVersion(3,0, __file__)
# #include "BasicDataType.idl"
import BasicDataType_idl
_0_RTC = omniORB.openModule("RTC")
_0_RTC__POA = omniORB.op... | [
"omniORB.registerSkeleton",
"_omnipy.checkVersion",
"omniORB.CORBA.Object.__init__",
"_omnipy.invoke",
"omniORB.EnumItem",
"omniORB.registerObjref",
"omniORB.openModule",
"omniORB.newEmptyClass",
"omniORB.registerType",
"omniORB.Enum",
"omniORB.tcInternal.createTypeCode"
] | [((168, 204), '_omnipy.checkVersion', '_omnipy.checkVersion', (['(3)', '(0)', '__file__'], {}), '(3, 0, __file__)\n', (188, 204), False, 'import omniORB, _omnipy\n'), ((270, 295), 'omniORB.openModule', 'omniORB.openModule', (['"""RTC"""'], {}), "('RTC')\n", (288, 295), False, 'import omniORB, _omnipy\n'), ((310, 340), ... |
import numpy as np
from gym import utils, spaces
from gym.envs.mujoco import mujoco_env
from gym.envs.robotics.rotations import quat2euler, euler2quat, mat2euler
import os
import random
from mjremote import mjremote
import time
from doorenv2.envs.doorenv import DoorEnv
class DoorEnvBaxter(DoorEnv, utils.EzPickle):
... | [
"numpy.random.uniform",
"gym.utils.EzPickle.__init__",
"random.uniform",
"numpy.zeros",
"numpy.array",
"numpy.concatenate"
] | [((1870, 1899), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(self)\n', (1893, 1899), False, 'from gym import utils, spaces\n'), ((2887, 2927), 'numpy.concatenate', 'np.concatenate', (['(a, self.gripper_action)'], {}), '((a, self.gripper_action))\n', (2901, 2927), True, 'import numpy as np... |
import collections
import gc
import math
import os
import pickle
import random
import sys
import time
import warnings
from collections import defaultdict
from datetime import datetime
from operator import itemgetter
import lightgbm as lgb
import numpy as np
import pandas as pd
from sklearn.model_selection import train... | [
"pandas.DataFrame",
"datetime.datetime.today",
"math.sqrt",
"warnings.filterwarnings",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"lightgbm.LGBMRanker",
"numpy.isnan",
"time.time",
"collections.defaultdict",
"pandas.concat"
] | [((355, 388), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (378, 388), False, 'import warnings\n'), ((482, 528), 'pandas.read_csv', 'pd.read_csv', (["(data_path + 'train_click_log.csv')"], {}), "(data_path + 'train_click_log.csv')\n", (493, 528), True, 'import pandas as ... |
# -*- coding: utf-8 -*-
import textwrap
from .helpers import keys
from .helpers import create_example_fixture
example_app = create_example_fixture('examples/when.py')
def test_when_bacon(example_app):
example_app.expect('? Do you like bacon? (Y/n)')
example_app.writeline('')
example_app.expect(
... | [
"textwrap.dedent"
] | [((322, 448), 'textwrap.dedent', 'textwrap.dedent', (['""" ? Do you like bacon? Yes\n ? Bacon lover, what is your favorite type of bacon?"""'], {}), '(\n """ ? Do you like bacon? Yes\n ? Bacon lover, what is your favorite type of bacon?"""\n )\n', (337, 448), False, 'import textwrap\... |
import os
import shutil
import tempfile
from django.test import TestCase
from cartoview.apps_handler.req_installer import ReqFileException, ReqInstaller
class ReqInstallerTest(TestCase):
def setUp(self):
self.tmp_dir = tempfile.mkdtemp()
self.req_file = os.path.join(self.tmp_dir, 'req.txt')
... | [
"tempfile.mkdtemp",
"cartoview.apps_handler.req_installer.ReqInstaller",
"shutil.rmtree",
"os.path.join",
"os.listdir"
] | [((235, 253), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (251, 253), False, 'import tempfile\n'), ((278, 315), 'os.path.join', 'os.path.join', (['self.tmp_dir', '"""req.txt"""'], {}), "(self.tmp_dir, 'req.txt')\n", (290, 315), False, 'import os\n'), ((342, 376), 'os.path.join', 'os.path.join', (['self.tm... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"threading.Thread",
"azure.cli.core.commands.parameters.get_resources_in_subscription",
"knack.util.CLIError",
"re.match",
"uuid.UUID",
"msrestazure.tools.is_valid_resource_id"
] | [((1521, 1549), 'msrestazure.tools.is_valid_resource_id', 'is_valid_resource_id', (['subnet'], {}), '(subnet)\n', (1541, 1549), False, 'from msrestazure.tools import is_valid_resource_id\n'), ((3274, 3310), 'uuid.UUID', 'UUID', (['namespace.workspace'], {'version': '(4)'}), '(namespace.workspace, version=4)\n', (3278, ... |
# Copyright 2014 Google Inc. 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 applicable law or ... | [
"models.models.LabelDAO.get_all_iter",
"models.jobs.MapReduceJob.get_results",
"models.entity_transforms.get_schema_for_entity_unsafe",
"models.courses.Course",
"common.schema_fields.FieldRegistry",
"models.models.LabelDAO.get_all",
"models.transforms.dumps",
"models.transforms.loads",
"models.entit... | [((1320, 1424), 'common.schema_fields.FieldRegistry', 'schema_fields.FieldRegistry', (['"""Analytics"""'], {'description': '"""Sets of questions determining student skill"""'}), "('Analytics', description=\n 'Sets of questions determining student skill')\n", (1347, 1424), False, 'from common import schema_fields\n')... |
#!/usr/bin/env python3.7
'''****************************************************************************
* Hexnet.py: The Hexagonal Machine Learning Module
******************************************************************************
* v0.1 - 01.03.2019
*
* Copyright (c) 2019 <NAME> (<EMAIL>)
*
* Permission i... | [
"argparse.ArgumentParser",
"datasets.datasets.resize_dataset",
"tensorflow.losses.get",
"misc.misc.print_newline",
"datasets.datasets.create_dataset",
"os.path.isfile",
"numpy.mean",
"pprint.pprint",
"misc.augmenters.augment_size",
"os.path.join",
"misc.visualization.visualize_test_results",
"... | [((11453, 11468), 'misc.misc.print_newline', 'print_newline', ([], {}), '()\n', (11466, 11468), False, 'from misc.misc import array_to_one_hot_array, Hexnet_print, print_newline\n'), ((11619, 11677), 'datasets.datasets.load_dataset', 'datasets.load_dataset', (['dataset', 'create_h5', 'verbosity_level'], {}), '(dataset,... |
import unittest
import commonmark
class TestCommonmark(unittest.TestCase):
def setUp(self):
self.parser = commonmark.Parser()
self.renderer = commonmark.ReStructuredTextRenderer()
def render_rst(self, test_str):
ast = self.parser.parse(test_str)
rst = self.renderer.render(ast... | [
"unittest.main",
"commonmark.ReStructuredTextRenderer",
"commonmark.Parser"
] | [((3963, 3978), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3976, 3978), False, 'import unittest\n'), ((121, 140), 'commonmark.Parser', 'commonmark.Parser', ([], {}), '()\n', (138, 140), False, 'import commonmark\n'), ((165, 202), 'commonmark.ReStructuredTextRenderer', 'commonmark.ReStructuredTextRenderer', ([... |
import ifuzz_logger
import os
import errno
class FuzzLoggerFile(ifuzz_logger.IFuzzLogger):
"""
Deprecated: Use FuzzLogger with FuzzLoggerText for typical fuzz logging.
IFuzzLogger that saves sent and received data to files within a directory.
File format is: <mutation nubmer>-(rx|tx)-<sequence numbe... | [
"os.path.isdir",
"os.path.join",
"os.makedirs"
] | [((2134, 2168), 'os.path.join', 'os.path.join', (['self._path', 'filename'], {}), '(self._path, filename)\n', (2146, 2168), False, 'import os\n'), ((2671, 2705), 'os.path.join', 'os.path.join', (['self._path', 'filename'], {}), '(self._path, filename)\n', (2683, 2705), False, 'import os\n'), ((1291, 1314), 'os.makedirs... |
import numpy as np
from .config import Config
import os
def tomatrix(s):
lines = s.split(Config.lineEnd)
lst = []
for line in lines:
if line == "":
continue
if not line.startswith("%"):
tmp = []
for i in line.split(Config.comma):
tmp.appe... | [
"numpy.zeros_like",
"numpy.array",
"os.path.join"
] | [((372, 385), 'numpy.array', 'np.array', (['lst'], {}), '(lst)\n', (380, 385), True, 'import numpy as np\n'), ((434, 477), 'os.path.join', 'os.path.join', (['config.outDir', 'config.fResRaw'], {}), '(config.outDir, config.fResRaw)\n', (446, 477), False, 'import os\n'), ((632, 675), 'os.path.join', 'os.path.join', (['co... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
determine_ext,
ExtractorError,
float_or_none,
int_or_none,
join_nonempty,
parse_iso8601,
)
class ThreeQSDNIE(InfoExtractor):
IE_NAME = '3qsdn'
... | [
"re.search"
] | [((2887, 2993), 're.search', 're.search', (['(\'<iframe[^>]+\\\\b(?:data-)?src=(["\\\\\\\'])(?P<url>%s.*?)\\\\1\' % ThreeQSDNIE.\n _VALID_URL)', 'webpage'], {}), '(\'<iframe[^>]+\\\\b(?:data-)?src=(["\\\\\\\'])(?P<url>%s.*?)\\\\1\' %\n ThreeQSDNIE._VALID_URL, webpage)\n', (2896, 2993), False, 'import re\n')] |
#!/usr/bin/env python
import sys
import os
import rhgamestationFiles
from settings.unixSettings import UnixSettings
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
fbaSettings = UnixSettings(rhgamestationFiles.fbaCustom)
# return true if the option is considered enabled (for ... | [
"os.path.dirname",
"settings.unixSettings.UnixSettings"
] | [((221, 263), 'settings.unixSettings.UnixSettings', 'UnixSettings', (['rhgamestationFiles.fbaCustom'], {}), '(rhgamestationFiles.fbaCustom)\n', (233, 263), False, 'from settings.unixSettings import UnixSettings\n'), ((167, 192), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (182, 192), False... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
"threading.Thread",
"fuzzers.afl.fuzzer.prepare_fuzz_environment",
"fuzzers.afl.fuzzer.build",
"time.sleep"
] | [((1073, 1091), 'fuzzers.afl.fuzzer.build', 'afl_fuzzer.build', ([], {}), '()\n', (1089, 1091), True, 'from fuzzers.afl import fuzzer as afl_fuzzer\n'), ((1174, 1223), 'fuzzers.afl.fuzzer.prepare_fuzz_environment', 'afl_fuzzer.prepare_fuzz_environment', (['input_corpus'], {}), '(input_corpus)\n', (1209, 1223), True, 'f... |
import xadmin
from xadmin import views
from auth_server.models import MobileData, KeyStroke, Mouse
class BaseSettings:
enable_themes = True
use_bootswatch = True
class GlobalSettings:
site_title = '西安交大数据采集系统后台管理'
site_footer = '西安交通大学'
menu_style = 'accordion'
class MobileDataAdmin:
list_... | [
"xadmin.site.register"
] | [((891, 930), 'xadmin.site.register', 'xadmin.site.register', (['Mouse', 'MouseAdmin'], {}), '(Mouse, MouseAdmin)\n', (911, 930), False, 'import xadmin\n'), ((931, 978), 'xadmin.site.register', 'xadmin.site.register', (['KeyStroke', 'KeyStrokeAdmin'], {}), '(KeyStroke, KeyStrokeAdmin)\n', (951, 978), False, 'import xad... |
from pathlib import Path
import sys
for path in Path('src').rglob('*.ts'):
with path.open() as f:
if(f.readline().strip() != '// Name: <NAME> ID: 1505616'.strip()):
print('0')
sys.exit(0)
print('1')
sys.exit(0)
| [
"pathlib.Path",
"sys.exit"
] | [((236, 247), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (244, 247), False, 'import sys\n'), ((48, 59), 'pathlib.Path', 'Path', (['"""src"""'], {}), "('src')\n", (52, 59), False, 'from pathlib import Path\n'), ((213, 224), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (221, 224), False, 'import sys\n')] |
###########################################################################
# Created by: <NAME>
# Email: <EMAIL>
# Copyright (c) 2017
###########################################################################
from PIL import Image, ImageOps, ImageFilter
import os
import math
import random
import numpy as np
from tqd... | [
"os.path.join",
"os.path.basename",
"torch.load",
"os.path.exists",
"torch.save",
"numpy.array",
"detail.Detail",
"os.path.expanduser",
"numpy.unique",
"torch.from_numpy"
] | [((503, 541), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.encoding/data"""'], {}), "('~/.encoding/data')\n", (521, 541), False, 'import os\n'), ((819, 852), 'os.path.join', 'os.path.join', (['root', 'self.BASE_DIR'], {}), '(root, self.BASE_DIR)\n', (831, 852), False, 'import os\n'), ((871, 913), 'os.path.join'... |
# coding: utf-8
import unittest
from data_structures.sets.weighted_quick_union_union_find import WeightedQuickUnionUnionFind
class TestCase(unittest.TestCase):
def setUp(self):
self.union_find = WeightedQuickUnionUnionFind()
self.elements = [1, 5, 7, 1, 3, 9, 6, 18, 'A', 'B', 'C']
self.nu... | [
"unittest.main",
"data_structures.sets.weighted_quick_union_union_find.WeightedQuickUnionUnionFind"
] | [((2612, 2627), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2625, 2627), False, 'import unittest\n'), ((210, 239), 'data_structures.sets.weighted_quick_union_union_find.WeightedQuickUnionUnionFind', 'WeightedQuickUnionUnionFind', ([], {}), '()\n', (237, 239), False, 'from data_structures.sets.weighted_quick_un... |
import math
#Question 5
# Secant method
# x(n+1) = x(n) - f(x(n))*(x(n) - x(n-1))/(f(x(n)) - f(x(n-1)))
err=10**(-5)
def f(x):
return (math.exp(-x)*(x**2+5*x+2))+1
def evalx2(x1,x0):
num=x1-x0
denom=f(x1)-f(x0)
part2=f(x1)*(num/denom)
return x1-part2
x0=-1
x1=0 # since f(0)*f(-1) <0
x2=evalx2(x1... | [
"math.exp"
] | [((141, 153), 'math.exp', 'math.exp', (['(-x)'], {}), '(-x)\n', (149, 153), False, 'import math\n')] |
#!/usr/bin/python
# Copyright: (c) 2020, DellEMC
"""Ansible module for managing snapshot schedules on Unity"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported... | [
"ansible_collections.dellemc.unity.plugins.module_utils.storage.dell.dellemc_ansible_unity_utils.snap_schedule.UnitySnapScheduleRule.every_n_days",
"ansible_collections.dellemc.unity.plugins.module_utils.storage.dell.dellemc_ansible_unity_utils.get_unity_unisphere_connection",
"ansible_collections.dellemc.unity... | [((12367, 12441), 'ansible_collections.dellemc.unity.plugins.module_utils.storage.dell.dellemc_ansible_unity_utils.get_logger', 'utils.get_logger', (['"""dellemc_unity_snapshotschedule"""'], {'log_devel': 'logging.INFO'}), "('dellemc_unity_snapshotschedule', log_devel=logging.INFO)\n", (12383, 12441), True, 'from ansib... |
# Copyright 2018 IBM Corp. 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 applicable law or agr... | [
"os.path.dirname",
"os.path.join"
] | [((1023, 1045), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (1035, 1045), False, 'from os import path\n'), ((1063, 1085), 'os.path.join', 'path.join', (['here', 'fname'], {}), '(here, fname)\n', (1072, 1085), False, 'from os import path\n')] |
from sorl.thumbnail.base import ThumbnailBackend
from sorl.thumbnail import default
from sorl.thumbnail.images import ImageFile, DummyImageFile
class AsyncThumbnailBackend(ThumbnailBackend):
def get_thumbnail(self, file_, geometry_string, **options):
source = ImageFile(file_)
for key, value in self... | [
"sorl.thumbnail.images.ImageFile",
"sorl.thumbnail.default.kvstore.get_or_set",
"sorl.thumbnail.default.kvstore.get",
"sorl.thumbnail.images.DummyImageFile",
"sorl.thumbnail.default.kvstore.set"
] | [((273, 289), 'sorl.thumbnail.images.ImageFile', 'ImageFile', (['file_'], {}), '(file_)\n', (282, 289), False, 'from sorl.thumbnail.images import ImageFile, DummyImageFile\n'), ((487, 519), 'sorl.thumbnail.images.ImageFile', 'ImageFile', (['name', 'default.storage'], {}), '(name, default.storage)\n', (496, 519), False,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# name: password.py
# maintainer: <NAME>
# email: <EMAIL>
#
"""
ext_pylib.password.password
~~~~~~~~~~~~~~~~~~~~~~~~~~~
A module to create passwords.
"""
from random import choice
# Defines the default characters for use in generating a p... | [
"random.choice"
] | [((1755, 1779), 'random.choice', 'choice', (['char_set[subset]'], {}), '(char_set[subset])\n', (1761, 1779), False, 'from random import choice\n')] |
# -*- coding: utf-8 -*-
# @Time : 2020/12/3 上午12:22
# @Author : 司云中
# @File : fields.py
# @Software: Pycharm
from flask_restful import fields
import re
CODE_CATEGORY = {
'register':'e5cbdca0-4210-11eb-b403-9822ef2f94f8',
'login':'f0548faa-4210-11eb-a54d-9822ef2f94f8',
'find-password':'<PASSWORD>',
'mo... | [
"re.match"
] | [((953, 987), 're.match', 're.match', (['"""^[0-9A-Za-z]{5}"""', 'value'], {}), "('^[0-9A-Za-z]{5}', value)\n", (961, 987), False, 'import re\n'), ((1853, 2141), 're.match', 're.match', (['"""^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\\\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|... |
# write tests for bfs
import pytest
import numpy as np
from mst import Graph
from sklearn.metrics import pairwise_distances
def check_mst(adj_mat: np.ndarray,
mst: np.ndarray,
expected_weight: int,
allowed_error: float = 0.0001):
""" Helper function to check the correc... | [
"numpy.count_nonzero",
"sklearn.metrics.pairwise_distances",
"mst.Graph",
"numpy.any",
"numpy.loadtxt"
] | [((1872, 1888), 'mst.Graph', 'Graph', (['file_path'], {}), '(file_path)\n', (1877, 1888), False, 'from mst import Graph\n'), ((2320, 2341), 'numpy.loadtxt', 'np.loadtxt', (['file_path'], {}), '(file_path)\n', (2330, 2341), True, 'import numpy as np\n'), ((2445, 2471), 'sklearn.metrics.pairwise_distances', 'pairwise_dis... |
# Author: <NAME>
# email: <EMAIL>
from PIL import Image
import numpy as np
import init_paths
from image_processing import rgb2hsv
from xinshuo_visualization import visualize_image
def test_rgb2hsv():
image_path = '../lena.png'
# test for rgb pil image
img = Image.open(image_path).convert('RGB')
visualize_image(i... | [
"xinshuo_visualization.visualize_image",
"image_processing.rgb2hsv",
"PIL.Image.open"
] | [((303, 333), 'xinshuo_visualization.visualize_image', 'visualize_image', (['img'], {'vis': '(True)'}), '(img, vis=True)\n', (318, 333), False, 'from xinshuo_visualization import visualize_image\n'), ((345, 357), 'image_processing.rgb2hsv', 'rgb2hsv', (['img'], {}), '(img)\n', (352, 357), False, 'from image_processing ... |
"""routines to interact with the bus of microservices"""
import uuid as _uuid
import fdrtd.server.callback
import fdrtd.server.exceptions
class Bus:
"""the bus stores representations of microservices and other server-side objects"""
def __init__(self):
"""initialize the bus"""
self.microser... | [
"uuid.uuid4"
] | [((2769, 2782), 'uuid.uuid4', '_uuid.uuid4', ([], {}), '()\n', (2780, 2782), True, 'import uuid as _uuid\n'), ((3372, 3385), 'uuid.uuid4', '_uuid.uuid4', ([], {}), '()\n', (3383, 3385), True, 'import uuid as _uuid\n'), ((5178, 5191), 'uuid.uuid4', '_uuid.uuid4', ([], {}), '()\n', (5189, 5191), True, 'import uuid as _uu... |
import sys
import os.path as op
import backslant
from flask import Flask, render_template
sys.meta_path.insert(0, backslant.PymlFinder(op.dirname(__file__), hook="bsviews"))
from bsviews.templates import index
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello_world():
s = ''.join(index.render(tit... | [
"os.path.dirname",
"flask.Flask",
"bsviews.templates.index.render",
"flask.render_template"
] | [((219, 234), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (224, 234), False, 'from flask import Flask, render_template\n'), ((404, 433), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (419, 433), False, 'from flask import Flask, render_template\n'), ((136, 15... |
# Copyright 2014 PerfKitBenchmarker 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 appli... | [
"json.loads",
"perfkitbenchmarker.vm_util.IssueCommand",
"re.match",
"perfkitbenchmarker.errors.VmUtil.CalledProcessException",
"collections.defaultdict",
"perfkitbenchmarker.context.GetThreadBenchmarkSpec",
"six.iteritems",
"perfkitbenchmarker.vm_util.Retry"
] | [((5856, 5871), 'perfkitbenchmarker.vm_util.Retry', 'vm_util.Retry', ([], {}), '()\n', (5869, 5871), False, 'from perfkitbenchmarker import vm_util\n'), ((2384, 2419), 'perfkitbenchmarker.vm_util.IssueCommand', 'vm_util.IssueCommand', (['get_zones_cmd'], {}), '(get_zones_cmd)\n', (2404, 2419), False, 'from perfkitbench... |
from typing import Optional
from sovtokenfees.constants import SET_FEES, FEES
from sovtokenfees.req_handlers.fees_utils import FeesStaticHelper
from sovtokenfees.serializers import proof_nodes_serializer, config_state_serializer
from indy_common.authorize.auth_actions import AuthActionEdit
from sovtokenfees import Fee... | [
"sovtokenfees.req_handlers.fees_utils.FeesStaticHelper.get_fee_from_state",
"sovtokenfees.domain.build_path_for_set_fees",
"plenum.common.txn_util.get_payload_data",
"indy_common.authorize.auth_actions.AuthActionEdit",
"sovtokenfees.serializers.config_state_serializer.serialize"
] | [((2049, 2070), 'plenum.common.txn_util.get_payload_data', 'get_payload_data', (['txn'], {}), '(txn)\n', (2065, 2070), False, 'from plenum.common.txn_util import get_payload_data\n'), ((2136, 2183), 'sovtokenfees.req_handlers.fees_utils.FeesStaticHelper.get_fee_from_state', 'FeesStaticHelper.get_fee_from_state', (['sel... |
import pandas as pd
import numpy as np
from numpy.random import default_rng
df = pd.read_csv("schedules/schedule21.csv")
pr_default = pd.read_csv("data/pr_both.csv",squeeze=True,index_col="Side")
pr_custom = pd.Series()
teams = sorted(list(set(df.team_home)))
rng = default_rng()
def simulate_reg_season(pr = pr_defaul... | [
"pandas.read_csv",
"numpy.where",
"pandas.Series",
"numpy.random.default_rng"
] | [((82, 121), 'pandas.read_csv', 'pd.read_csv', (['"""schedules/schedule21.csv"""'], {}), "('schedules/schedule21.csv')\n", (93, 121), True, 'import pandas as pd\n'), ((135, 198), 'pandas.read_csv', 'pd.read_csv', (['"""data/pr_both.csv"""'], {'squeeze': '(True)', 'index_col': '"""Side"""'}), "('data/pr_both.csv', squee... |
import torch
from torch.nn.utils import rnn
from torch.utils import data
class RCSenseEpisode2:
def __init__(self):
self.csts = []
self.acts = []
self.rewards = []
def append_st(self, cst, act):
cst = cst.unsqueeze(0)
self.csts.append(cst)
self.acts.append(act)
def append_post(self, rew... | [
"torch.nn.utils.rnn.pad_sequence",
"torch.cat",
"torch.tensor"
] | [((508, 538), 'torch.cat', 'torch.cat', (['episode.csts'], {'dim': '(0)'}), '(episode.csts, dim=0)\n', (517, 538), False, 'import torch\n'), ((550, 594), 'torch.tensor', 'torch.tensor', (['episode.acts'], {'dtype': 'torch.long'}), '(episode.acts, dtype=torch.long)\n', (562, 594), False, 'import torch\n'), ((609, 659), ... |
import csv
import os
import re
def summary_exp_results(task,subtask,prefix,infix,outname):
mids=["finetune_prefixlen0","prefix_prefixlen100","lmadaption1_prefixlen100","lmadaption2_finetune_prefixlen0","lmadaption2_prefix_prefixlen100","lmadaption3_prefixlen100"]
field_order = ["mehtod", '[best-bleu]-bleu','... | [
"re.findall",
"os.path.exists",
"os.makedirs",
"csv.DictWriter"
] | [((482, 586), 'os.path.exists', 'os.path.exists', (["('/mnt/sda/ys/codeT5/CodeT5/sh/saved_models/' + task + '/' + subtask +\n '/results_csv')"], {}), "('/mnt/sda/ys/codeT5/CodeT5/sh/saved_models/' + task + '/' +\n subtask + '/results_csv')\n", (496, 586), False, 'import os\n'), ((584, 685), 'os.makedirs', 'os.mak... |
# mysql/enumerated.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
import re
from .types import _StringType
from ... import exc
from ... import s... | [
"re.findall"
] | [((7544, 7570), 're.findall', 're.findall', (['"""[^,]+"""', 'value'], {}), "('[^,]+', value)\n", (7554, 7570), False, 'import re\n')] |
import nuke
import pyblish.api
import pype.api
class ValidateKnobs(pyblish.api.ContextPlugin):
"""Ensure knobs are consistent.
Knobs to validate and their values comes from the
Example for presets in config:
"presets/plugins/nuke/publish.json" preset, which needs this structure:
"ValidateKn... | [
"nuke.allNodes"
] | [((2383, 2398), 'nuke.allNodes', 'nuke.allNodes', ([], {}), '()\n', (2396, 2398), False, 'import nuke\n'), ((2541, 2556), 'nuke.allNodes', 'nuke.allNodes', ([], {}), '()\n', (2554, 2556), False, 'import nuke\n')] |
"""empty message
Revision ID: 81d730bb63
Revises: c51c40a0de
Create Date: 2016-01-04 22:30:39.729115
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'c51c40a0de'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto... | [
"alembic.op.drop_column",
"sqlalchemy.dialects.mysql.INTEGER",
"sqlalchemy.Integer"
] | [((846, 885), 'alembic.op.drop_column', 'op.drop_column', (['"""match_goal"""', '"""team_id"""'], {}), "('match_goal', 'team_id')\n", (860, 885), False, 'from alembic import op\n'), ((416, 428), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (426, 428), True, 'import sqlalchemy as sa\n'), ((523, 554), 'sqlalchem... |
import configparser
import os
import random
import time
import numpy as np
from multiprocessing import Process, Queue, cpu_count
from PIL import Image, ImageFilter, ImageOps
import pathlib
root_dir = pathlib.Path.cwd()
config = configparser.ConfigParser()
config.read(root_dir / 'config.ini')
num_generated_images = ... | [
"os.mkdir",
"numpy.clip",
"pathlib.Path",
"multiprocessing.Queue",
"os.path.join",
"multiprocessing.cpu_count",
"random.randint",
"numpy.reshape",
"configparser.ConfigParser",
"PIL.ImageFilter.GaussianBlur",
"numpy.asarray",
"time.sleep",
"PIL.ImageOps.expand",
"random.random",
"os.listd... | [((202, 220), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (218, 220), False, 'import pathlib\n'), ((231, 258), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (256, 258), False, 'import configparser\n'), ((671, 711), 'os.path.join', 'os.path.join', (['img_gen_dir', '"""backgrou... |
#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
import logging
f... | [
"logging.exception",
"thrift.Thrift.TApplicationException"
] | [((11954, 12062), 'thrift.Thrift.TApplicationException', 'TApplicationException', (['TApplicationException.MISSING_RESULT', '"""getActivePurchases failed: unknown result"""'], {}), "(TApplicationException.MISSING_RESULT,\n 'getActivePurchases failed: unknown result')\n", (11975, 12062), False, 'from thrift.Thrift im... |
from django.conf import settings
from django.conf.urls import include, url
from mozilla_django_oidc.views import OIDCAuthenticationCallbackView
import kitsune.flagit.views
from kitsune.sumo.views import redirect_to
from kitsune.users import api, views
from kitsune.users.models import Profile
# API patterns. All start... | [
"mozilla_django_oidc.views.OIDCAuthenticationCallbackView.as_view",
"django.conf.urls.include",
"kitsune.users.views.FXAAuthenticateView.as_view",
"kitsune.users.views.FXALogoutView.as_view",
"django.conf.urls.url"
] | [((359, 419), 'django.conf.urls.url', 'url', (['"""^usernames"""', 'api.usernames'], {'name': '"""users.api.usernames"""'}), "('^usernames', api.usernames, name='users.api.usernames')\n", (362, 419), False, 'from django.conf.urls import include, url\n'), ((494, 540), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.... |
# init.py
import signac
from simtk import unit
project = signac.init_project('signac_test')
# Possible parameters we can vary:
#---------------#
# LJ parameters #
#---------------#
# epsilon_bb - LJ12 epsilon parameter (unit.kilojoules_per_mole)
# epsilon_sc - LJ12 epsilon parameter (unit.kilojoules_per_mole)
# sig... | [
"signac.init_project"
] | [((59, 93), 'signac.init_project', 'signac.init_project', (['"""signac_test"""'], {}), "('signac_test')\n", (78, 93), False, 'import signac\n')] |
import torch
import torch.nn as nn
import numpy as np
class ContraLoss(torch.nn.Module):
def __init__(self, p=2):
super(ContraLoss, self).__init__()
self.p = p
def forward(self, inputs, centroids):
loss = torch.mean(nn.PairwiseDistance(p=self.p)(inputs, centroids))
return los... | [
"torch.nn.PairwiseDistance",
"torch.tensor"
] | [((358, 396), 'torch.tensor', 'torch.tensor', (['[[1.0, 1.0], [2.0, 2.0]]'], {}), '([[1.0, 1.0], [2.0, 2.0]])\n', (370, 396), False, 'import torch\n'), ((398, 436), 'torch.tensor', 'torch.tensor', (['[[2.0, 2.0], [4.0, 4.0]]'], {}), '([[2.0, 2.0], [4.0, 4.0]])\n', (410, 436), False, 'import torch\n'), ((440, 464), 'tor... |
#
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"itertools.chain.from_iterable",
"osc_lib.utils.sort_items",
"ironicclient.common.utils.key_value_pairs_to_dict",
"json.loads",
"osc_lib.utils.get_dict_properties",
"ironicclient.common.utils.args_array_to_patch",
"ironicclient.v1.utils.PROVISION_ACTIONS.get",
"json.dumps",
"ironicclient.common.util... | [((974, 1450), 'ironicclient.common.i18n._', '_', (['"""A gzipped, base64-encoded configuration drive string OR the path to the configuration drive file OR the path to a directory containing the config drive files OR a JSON object to build config drive from. In case it\'s a directory, a config drive will be generated f... |
from spark_auto_mapper_fhir.generator.fhir_xml_schema_parser import FhirXmlSchemaParser
def test_clean_name() -> None:
name: str = "PublicationStatus"
result = FhirXmlSchemaParser.clean_name(name)
print(result)
| [
"spark_auto_mapper_fhir.generator.fhir_xml_schema_parser.FhirXmlSchemaParser.clean_name"
] | [((170, 206), 'spark_auto_mapper_fhir.generator.fhir_xml_schema_parser.FhirXmlSchemaParser.clean_name', 'FhirXmlSchemaParser.clean_name', (['name'], {}), '(name)\n', (200, 206), False, 'from spark_auto_mapper_fhir.generator.fhir_xml_schema_parser import FhirXmlSchemaParser\n')] |
import fnmatch
import os
import uuid
from functools import update_wrapper
import jinja2
from babel import dates
from jinja2.loaders import split_template_path
from lektor.constants import PRIMARY_ALT
from lektor.context import config_proxy
from lektor.context import get_asset_url
from lektor.context import get_ctx
fr... | [
"lektor.pluginsystem.initialize_plugins",
"lektor.types.builtin_types.copy",
"os.path.join",
"lektor.context.site_proxy.databags.lookup",
"os.path.abspath",
"lektor.context.get_locale",
"lektor.context.get_asset_url",
"lektor.context.url_to",
"jinja2.FileSystemLoader",
"lektor.environment.config.C... | [((1399, 1429), 'functools.update_wrapper', 'update_wrapper', (['new_func', 'func'], {}), '(new_func, func)\n', (1413, 1429), False, 'from functools import update_wrapper\n'), ((3254, 3288), 'lektor.context.site_proxy.databags.lookup', 'site_proxy.databags.lookup', (['pieces'], {}), '(pieces)\n', (3280, 3288), False, '... |
"""Functions for checking validity of 3d board game setting.
Functions
---------
read_input - read game board file from path
check_not_finished_board - check if skyscraper board is not finished
check_uniqueness_in_rows - check buildings of unique height in each row
check_uniquen... | [
"doctest.testmod"
] | [((8117, 8134), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (8132, 8134), False, 'import doctest\n')] |
# pylint: disable=no-self-use
import os
import shutil
import tempfile
import unittest
from unittest import mock
import pytest
try:
import yaml
except ImportError:
yaml = None
from coveralls import Coveralls
from coveralls.api import log
@mock.patch.object(Coveralls, 'config_filename', '.coveralls.mock')
cla... | [
"unittest.mock.patch.object",
"unittest.mock.patch.dict",
"pytest.raises",
"pytest.mark.skipif",
"tempfile.mkdtemp",
"coveralls.Coveralls",
"shutil.rmtree",
"os.chdir"
] | [((250, 316), 'unittest.mock.patch.object', 'mock.patch.object', (['Coveralls', '"""config_filename"""', '""".coveralls.mock"""'], {}), "(Coveralls, 'config_filename', '.coveralls.mock')\n", (267, 316), False, 'from unittest import mock\n'), ((1471, 1537), 'unittest.mock.patch.object', 'mock.patch.object', (['Coveralls... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = 'emec-api',
version = '0.1.6',
url = 'https://github.com/pavanad/emec-api',
license = 'MIT License',
author = '<NAME>',
author_email = '<EMAIL>',
keywords = 'universidades cursos emec e-mec api brasil',
description = 'API Python... | [
"setuptools.find_packages"
] | [((392, 407), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (405, 407), False, 'from setuptools import setup, find_packages\n')] |
# Copyright (c) 2014 <NAME> <<EMAIL>>
import sys
import os.path
p = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.insert(0, p)
import pytest
import asyncio
pytest.importorskip('jsonrpc.client')
from jsonrpc.client import RPCClient
from jsonrpc.message import RPCRequest
def async_test(f):... | [
"pytest.importorskip",
"asyncio.get_event_loop",
"asyncio.coroutine",
"jsonrpc.message.RPCRequest",
"sys.path.insert",
"jsonrpc.client.RPCClient"
] | [((132, 153), 'sys.path.insert', 'sys.path.insert', (['(0)', 'p'], {}), '(0, p)\n', (147, 153), False, 'import sys\n'), ((185, 222), 'pytest.importorskip', 'pytest.importorskip', (['"""jsonrpc.client"""'], {}), "('jsonrpc.client')\n", (204, 222), False, 'import pytest\n'), ((2100, 2152), 'jsonrpc.client.RPCClient', 'RP... |
import os
import numpy as np
import torch
from torchvision.utils import make_grid
from tensorboardX import SummaryWriter
from dataloaders.utils import encode_seg_map_sequence
import matplotlib.pyplot as plt
import itertools
class TensorboardSummary(object):
def __init__(self, directory):
self.directory = d... | [
"matplotlib.pyplot.title",
"dataloaders.utils.encode_seg_map_sequence",
"os.path.join",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.text",
"torch.squeeze",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylab... | [((1698, 1724), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (1708, 1724), True, 'import matplotlib.pyplot as plt\n'), ((1871, 1929), 'matplotlib.pyplot.imshow', 'plt.imshow', (['cm'], {'interpolation': '"""nearest"""', 'cmap': 'plt.cm.Blues'}), "(cm, interpolation='neare... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import path
from collections import OrderedDict
from string import Template
from .types_ import *
from .ast.collapser import as_c
module_files = OrderedDict()
class Package(object):
def __init__(self, modules=[], name="main"):
self.name = name
... | [
"collections.OrderedDict",
"string.Template"
] | [((210, 223), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (221, 223), False, 'from collections import OrderedDict\n'), ((335, 348), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (346, 348), False, 'from collections import OrderedDict\n'), ((807, 820), 'collections.OrderedDict', 'OrderedDic... |
import marshmallow as m
from flask_rebar import Rebar
from flask_rebar import HeaderApiKeyAuthenticator
from flask_rebar import compat
from flask_rebar.swagger_generation import SwaggerV2Generator, SwaggerV3Generator
rebar = Rebar()
registry = rebar.create_handler_registry()
swagger_v2_generator = SwaggerV2Generator... | [
"flask_rebar.swagger_generation.SwaggerV3Generator",
"flask_rebar.swagger_generation.SwaggerV2Generator",
"flask_rebar.HeaderApiKeyAuthenticator",
"marshmallow.fields.String",
"flask_rebar.Rebar",
"marshmallow.fields.Nested"
] | [((227, 234), 'flask_rebar.Rebar', 'Rebar', ([], {}), '()\n', (232, 234), False, 'from flask_rebar import Rebar\n'), ((302, 322), 'flask_rebar.swagger_generation.SwaggerV2Generator', 'SwaggerV2Generator', ([], {}), '()\n', (320, 322), False, 'from flask_rebar.swagger_generation import SwaggerV2Generator, SwaggerV3Gener... |
#!/usr/bin/env python
#
# Copyright (c) 2012, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice... | [
"cPickle.dumps"
] | [((13453, 13473), 'cPickle.dumps', 'cPickle.dumps', (['songs'], {}), '(songs)\n', (13466, 13473), False, 'import cPickle\n')] |
from datetime import timedelta
from flask import current_app
from sqlalchemy import or_, and_
from sqlalchemy.exc import IntegrityError
from zeus.config import celery, db
from zeus.constants import Result, Status
from zeus.models import Build, FailureReason, Job
from zeus.utils import timezone
from .aggregate_job_sta... | [
"flask.current_app.logger.exception",
"zeus.models.Job.query.filter",
"zeus.config.db.session.add",
"sqlalchemy.and_",
"zeus.config.db.session.flush",
"zeus.models.Job.query.unrestricted_unsafe",
"zeus.models.FailureReason",
"zeus.config.db.session.commit",
"datetime.timedelta",
"flask.current_app... | [((402, 457), 'zeus.config.celery.task', 'celery.task', ([], {'name': '"""zeus.cleanup_builds"""', 'time_limit': '(300)'}), "(name='zeus.cleanup_builds', time_limit=300)\n", (413, 457), False, 'from zeus.config import celery, db\n'), ((799, 852), 'zeus.config.celery.task', 'celery.task', ([], {'name': '"""zeus.cleanup_... |
# 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 u... | [
"pytest.importorskip",
"tvm.relay.testing.tf.get_workload_official",
"tvm.relay.frontend.from_tflite",
"tvm.contrib.download.download_testdata",
"pytest.mark.skip"
] | [((864, 893), 'pytest.importorskip', 'pytest.importorskip', (['"""tflite"""'], {}), "('tflite')\n", (883, 893), False, 'import pytest\n'), ((894, 927), 'pytest.importorskip', 'pytest.importorskip', (['"""tensorflow"""'], {}), "('tensorflow')\n", (913, 927), False, 'import pytest\n'), ((4927, 4968), 'pytest.mark.skip', ... |
from predictor import EnsembleBuilder
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/")
def hello():
return "go to /predict"
@app.route('/predict', methods = ['GET', 'POST'])
def predictor():
if(request.method == 'POST'):
rec_json = request.get_json()
... | [
"flask.jsonify",
"flask.Flask",
"predictor.EnsembleBuilder",
"flask.request.get_json"
] | [((86, 101), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (91, 101), False, 'from flask import Flask, request, jsonify\n'), ((293, 311), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (309, 311), False, 'from flask import Flask, request, jsonify\n'), ((417, 434), 'predictor.EnsembleBuild... |
import numpy as np
import os
import datetime
from tensorflow import keras
import tensorflow as tf
import kerasncp as kncp
from kerasncp.tf import LTCCell
import matplotlib.pyplot as plt
import seaborn as sns
from hyperopt import tpe, hp, fmin
from hyperopt.pyll import scope
# Download the dataset (already implemented ... | [
"kerasncp.datasets.icra2020_lidar_collision_avoidance.load_data",
"os.makedirs",
"tensorflow.keras.layers.Dense",
"os.getcwd",
"tensorflow.keras.layers.Conv1D",
"tensorflow.keras.layers.MaxPool1D",
"hyperopt.fmin",
"os.path.exists",
"tensorflow.keras.layers.RNN",
"kerasncp.wirings.NCP",
"tensorf... | [((388, 448), 'kerasncp.datasets.icra2020_lidar_collision_avoidance.load_data', 'kncp.datasets.icra2020_lidar_collision_avoidance.load_data', ([], {}), '()\n', (446, 448), True, 'import kerasncp as kncp\n'), ((4284, 4348), 'hyperopt.fmin', 'fmin', ([], {'fn': 'train_ncp', 'space': 'space', 'algo': 'tpe.suggest', 'max_e... |
from setuptools import setup
setup(
name='pso-nn',
version='',
packages=['pso'],
package_dir={'': 'src'},
url='',
license='',
author='<NAME>',
author_email='<EMAIL>',
description='',
check_format=True,
# Enable type checking
test_mypy=False,
# Enable linting at build... | [
"setuptools.setup"
] | [((30, 244), 'setuptools.setup', 'setup', ([], {'name': '"""pso-nn"""', 'version': '""""""', 'packages': "['pso']", 'package_dir': "{'': 'src'}", 'url': '""""""', 'license': '""""""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '""""""', 'check_format': '(True)', 'test_mypy': '(False)', 't... |
from tables import LimeBikeTripsAnalyze
from utils import TimeUtils
from datetime import datetime, timedelta
from django.http import JsonResponse
class LimeBikeTripsAnalyzeAPI:
def __init__(self, conn):
self.conn = conn
self.lime_bike_trips_analyze = LimeBikeTripsAnalyze(conn)
def get_trips(s... | [
"tables.LimeBikeTripsAnalyze",
"datetime.datetime.now",
"datetime.timedelta"
] | [((273, 299), 'tables.LimeBikeTripsAnalyze', 'LimeBikeTripsAnalyze', (['conn'], {}), '(conn)\n', (293, 299), False, 'from tables import LimeBikeTripsAnalyze\n'), ((625, 639), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (637, 639), False, 'from datetime import datetime, timedelta\n'), ((642, 660), 'dateti... |
import json
import os
from http import HTTPStatus
import requests
__all__ = ['Whois']
PROMPTAPI_ENDPOINT = 'https://api.promptapi.com/whois'
DEFAULT_TIMEOUT = 10
class Whois:
def __init__(self):
self.timeout = DEFAULT_TIMEOUT
self.apikey = None
self.data = None
def _validate(self):... | [
"os.environ.get",
"requests.request"
] | [((338, 377), 'os.environ.get', 'os.environ.get', (['"""PROMPTAPI_TOKEN"""', 'None'], {}), "('PROMPTAPI_TOKEN', None)\n", (352, 377), False, 'import os\n'), ((770, 873), 'requests.request', 'requests.request', (['method', 'endpoint'], {'timeout': 'self.timeout', 'params': 'params', 'headers': 'headers', 'data': 'body'}... |
# -*- coding: utf-8 -*-
from util import *
import rview
import rmodel
import rttov
import copy
import r1Dvar
import time
import argparse
from controller import is_valid_file
class R1dvarController (GenericController):
""" controller for the 1Dvar Window """
def __init__(self, parent, project=None):
... | [
"copy.deepcopy",
"rttov.profile.getNumberOfProfiles",
"controller.is_valid_file",
"argparse.ArgumentParser",
"r1Dvar.r1dvar.Project1dvar",
"rview.rBtView.RBtView",
"rmodel.project.Project",
"time.sleep",
"rview.r1dvarprofileframe.r1dvarProfileView",
"rview.r1dvarView.R1dvarView"
] | [((15224, 15317), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""launch RTTOV GUI 1Dvar"""', 'conflict_handler': '"""resolve"""'}), "(description='launch RTTOV GUI 1Dvar',\n conflict_handler='resolve')\n", (15247, 15317), False, 'import argparse\n'), ((15929, 15953), 'rmodel.project.P... |
"""
Purpose: module to extract embedded information from product names and supply
configured values for each product
Author: <NAME>
"""
import os
import re
from collections import namedtuple
import yaml
from api import ProductNotImplemented, __location__
from api.util import julian_date_check, julian_from_date
# Gra... | [
"api.ProductNotImplemented",
"re.match",
"api.util.julian_date_check",
"api.util.julian_from_date",
"collections.namedtuple",
"os.path.join"
] | [((19663, 19689), 'api.ProductNotImplemented', 'ProductNotImplemented', (['msg'], {}), '(msg)\n', (19684, 19689), False, 'from api import ProductNotImplemented, __location__\n'), ((441, 493), 'os.path.join', 'os.path.join', (['__location__', '"""domain/restricted.yaml"""'], {}), "(__location__, 'domain/restricted.yaml'... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from poetaster.lattice import AlternatingLattice
from poetaster.lattice import IslexOrthoLattice
from poetaster.lattice import Lattice
from poetaster.lattice import RegexGazette
def test_explorer():
e = Lattice("a bc", admitter=frozenset(["a", " ", "... | [
"poetaster.lattice.AlternatingLattice",
"poetaster.lattice.IslexOrthoLattice",
"poetaster.lattice.Lattice",
"poetaster.lattice.RegexGazette"
] | [((822, 866), 'poetaster.lattice.Lattice', 'Lattice', (['"""i love new york city."""'], {'admitter': 'd'}), "('i love new york city.', admitter=d)\n", (829, 866), False, 'from poetaster.lattice import Lattice\n'), ((1196, 1235), 'poetaster.lattice.RegexGazette', 'RegexGazette', (['"""[0-9<>\\\\\'",.?!:;\\\\s ]+"""'], {... |
from pseudo.tree_transformer import TreeTransformer
from pseudo.pseudo_tree import Node, to_node, method_call, call, local
from pseudo.errors import PseudoStandardLibraryError, PseudoDSLError
from pseudo.api_handlers import LeakingNode, NormalLeakingNode, BizarreLeakingNode
import copy
TYPES = {'List', 'Dictionary', '... | [
"copy.deepcopy",
"pseudo.pseudo_tree.method_call",
"pseudo.pseudo_tree.call",
"pseudo.pseudo_tree.local",
"pseudo.pseudo_tree.Node",
"pseudo.errors.PseudoDSLError"
] | [((826, 903), 'pseudo.pseudo_tree.Node', 'Node', (['"""binary_op"""'], {'op': 'op', 'left': 'param', 'right': 'receiver', 'pseudo_type': 'pseudo_type'}), "('binary_op', op=op, left=param, right=receiver, pseudo_type=pseudo_type)\n", (830, 903), False, 'from pseudo.pseudo_tree import Node, to_node, method_call, call, lo... |
import pytest
from async_asgi_testclient import TestClient
@pytest.mark.asyncio
async def test_guest_ws_broadcasts_feature_to_guests_on_connect(
pg_container, app, create_random_feature_obj, create_random_guest_obj
):
async with TestClient(app, timeout=20) as client:
random_feature = await create_rand... | [
"async_asgi_testclient.TestClient"
] | [((239, 266), 'async_asgi_testclient.TestClient', 'TestClient', (['app'], {'timeout': '(20)'}), '(app, timeout=20)\n', (249, 266), False, 'from async_asgi_testclient import TestClient\n')] |
# -*- coding: utf-8 -*-
"""
Created on 2018-06-19 17:17
---------
@summary: item 管理器, 负责缓冲添加到数据库中的item, 由该manager统一添加。防止多线程同时访问数据库
---------
@author: Boris
@email: <EMAIL>
"""
import importlib
import threading
from queue import Queue
import feapder.setting as setting
import feapder.utils.tools as tools
from feapder.d... | [
"feapder.setting.TAB_REQUSETS.format",
"feapder.dedup.Dedup",
"importlib.import_module",
"feapder.utils.tools.dumps_json",
"feapder.utils.tools.get_info",
"feapder.utils.log.log.error",
"feapder.utils.log.log.exception",
"feapder.db.redisdb.RedisDB",
"queue.Queue",
"feapder.utils.tools.delay_time"... | [((7403, 7461), 'feapder.utils.tools.get_info', 'tools.get_info', (['tab_item', '""":s_(.*?)_item$"""'], {'fetch_one': '(True)'}), "(tab_item, ':s_(.*?)_item$', fetch_one=True)\n", (7417, 7461), True, 'import feapder.utils.tools as tools\n'), ((1119, 1148), 'queue.Queue', 'Queue', ([], {'maxsize': 'MAX_ITEM_COUNT'}), '... |
import argparse
from os import path, remove
import requests
import shutil
import os
import git
from const import (API_HACS,HEADERS,HACS_CLI_FOLDER)
from . import IBasic
class Themes(IBasic):
def __init__(self,args:argparse.Namespace):
if args.add:
self.add(args)
if args.remov... | [
"os.remove",
"os.path.isdir",
"os.path.exists",
"requests.get",
"shutil.rmtree",
"os.path.join"
] | [((2079, 2124), 'os.path.join', 'os.path.join', (['args.config', '"""themes"""', 'filename'], {}), "(args.config, 'themes', filename)\n", (2091, 2124), False, 'import os\n'), ((2143, 2168), 'os.path.exists', 'os.path.exists', (['pathTheme'], {}), '(pathTheme)\n', (2157, 2168), False, 'import os\n'), ((2185, 2209), 'os.... |
from Models.Pair import Pair
from selenium import webdriver
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions a... | [
"selenium.webdriver.common.action_chains.ActionChains",
"Models.Pair.Pair",
"selenium.webdriver.support.expected_conditions.visibility_of_element_located",
"time.sleep",
"selenium.webdriver.ChromeOptions",
"webdriver_manager.chrome.ChromeDriverManager",
"selenium.webdriver.support.ui.WebDriverWait"
] | [((872, 897), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (895, 897), False, 'from selenium import webdriver\n'), ((1221, 1234), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1231, 1234), False, 'import time, sys\n'), ((1665, 1690), 'selenium.webdriver.common.action_chains.Ac... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from aws_cdk import core, aws_ecr as ecr, aws_iam as iam
class EcrStack(core.Stack):
"""Define a stack of ECR to store pre-built Docker Images."""
def __init__(self, scope: core.Construct, id: str, **k... | [
"aws_cdk.aws_ecr.Repository",
"aws_cdk.aws_iam.ServicePrincipal"
] | [((474, 521), 'aws_cdk.aws_iam.ServicePrincipal', 'iam.ServicePrincipal', (['"""codebuild.amazonaws.com"""'], {}), "('codebuild.amazonaws.com')\n", (494, 521), True, 'from aws_cdk import core, aws_ecr as ecr, aws_iam as iam\n'), ((391, 444), 'aws_cdk.aws_ecr.Repository', 'ecr.Repository', ([], {'scope': 'self', 'id': '... |
import logging
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from horizon import forms
from horizon import exceptions
from horizon.utils import memoized
from openstack_dashboard import api
from openstack_dashboard.dashboards.projec... | [
"openstack_dashboard.api.proxy.gateway_get_by_instance",
"logging.getLogger",
"openstack_dashboard.api.proxy.server_list",
"openstack_dashboard.api.proxy.server_get",
"openstack_dashboard.api.proxy.gateway_list",
"django.core.urlresolvers.reverse_lazy",
"openstack_dashboard.api.proxy.firewall_get"
] | [((560, 587), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (577, 587), False, 'import logging\n'), ((1382, 1433), 'django.core.urlresolvers.reverse_lazy', 'reverse_lazy', (['"""horizon:project:network_edges:index"""'], {}), "('horizon:project:network_edges:index')\n", (1394, 1433), Fals... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class AuditLog(models.Model):
CREATE = 'c'
UPDATE = 'u'
DELETE = 'd'
ACTION_CHOICES = (
(CREATE, "Create"),
(UPDATE, "Update... | [
"django.db.models.TextField",
"django.db.models.UUIDField",
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((374, 413), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (394, 413), False, 'from django.db import models\n'), ((430, 474), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(False)', 'blank': '(False)'}), '(null=False, blank... |
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING
try:
from azure.core.exceptions import ResourceNotFoundError
except ImportError:
pass
from ..cloudpath import CloudPath, NoStatError, register_path_class
if TYPE_CHECKING:
from .azblobclient impor... | [
"pathlib.Path",
"tempfile.TemporaryDirectory"
] | [((1858, 1878), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (1876, 1878), False, 'from tempfile import TemporaryDirectory\n'), ((1895, 1908), 'pathlib.Path', 'Path', (['tf.name'], {}), '(tf.name)\n', (1899, 1908), False, 'from pathlib import Path\n')] |
"""Functions to compress the contents of a filesystem.
Currently zip and tar are supported, using the `zipfile` and
`tarfile` modules from the standard library.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import time
import tarfile
import t... | [
"zipfile.ZipFile",
"zipfile.ZipInfo",
"tarfile.TarInfo",
"time.time",
"datetime.datetime.utcnow",
"tarfile.open",
"time.localtime"
] | [((1752, 1825), 'zipfile.ZipFile', 'zipfile.ZipFile', (['file'], {'mode': '"""w"""', 'compression': 'compression', 'allowZip64': '(True)'}), "(file, mode='w', compression=compression, allowZip64=True)\n", (1767, 1825), False, 'import zipfile\n'), ((5593, 5604), 'time.time', 'time.time', ([], {}), '()\n', (5602, 5604), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2020-05-21
@author: cook
"""
import logging
from pathlib import Path
from typing import Union
# =============================================================================
# Define variables
# ==================... | [
"logging.Formatter.format",
"logging.Formatter.__init__",
"logging.StreamHandler",
"logging.Formatter",
"logging.getLogger"
] | [((1069, 1088), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1086, 1088), False, 'import logging\n'), ((1754, 1777), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1775, 1777), False, 'import logging\n'), ((9611, 9638), 'logging.Formatter', 'logging.Formatter', (['self.fmt'], {}), ... |
from . import conflateddict
import collections
ohlc = collections.namedtuple('ohlc', 'open high low close')
class OHLCConflator(conflateddict.ConflatedDict):
"""
ConflatedDict returning Open, High, Low, and Close (Last) values.
Example:
>>> ohlc = OHLCConflator()
>>> for i in [3, 1, 4, ... | [
"collections.namedtuple"
] | [((56, 109), 'collections.namedtuple', 'collections.namedtuple', (['"""ohlc"""', '"""open high low close"""'], {}), "('ohlc', 'open high low close')\n", (78, 109), False, 'import collections\n')] |
from application.utils import make_response
from domain.factory.issue_factory import IssueRequestFactory
from infrastructure.issue_repository import IssueRepository
import json
issue_repo = IssueRepository()
def create_issue(event, context):
data = json.loads(event['body'])
issue = IssueRequestFactory().crea... | [
"application.utils.make_response",
"infrastructure.issue_repository.IssueRepository",
"domain.factory.issue_factory.IssueRequestFactory",
"json.loads"
] | [((190, 207), 'infrastructure.issue_repository.IssueRepository', 'IssueRepository', ([], {}), '()\n', (205, 207), False, 'from infrastructure.issue_repository import IssueRepository\n'), ((255, 280), 'json.loads', 'json.loads', (["event['body']"], {}), "(event['body'])\n", (265, 280), False, 'import json\n'), ((380, 44... |
import logging
from PyQt5 import QtGui, QtCore, QtWidgets
import sys
LOGGER = logging.getLogger(__name__)
class QuestionCreationForm(QtWidgets.QDialog):
QUIZ_DATA = []
def __init__(self, parent=None):
super(QuestionCreationForm, self).__init__(parent)
self.setWindowModality(True)
... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QCheckBox",
"PyQt5.QtWidgets.QScrollArea",
"PyQt5.QtWidgets.QVBoxLayout",
"logging.getLogger",
"PyQt5.QtWidgets.QFormLayout"
] | [((79, 106), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (96, 106), False, 'import logging\n'), ((333, 361), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['"""Question"""'], {}), "('Question')\n", (349, 361), False, 'from PyQt5 import QtGui, QtCore, QtWidgets\n'), ((391, 412), 'PyQt5... |
import sys
import os
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from z3 import Bool, Reals, And, Or, is_true, BoolSort, simplify, Ints
from z3 import is_rational_value, Solver, sat, Not, RealVal
from z3 import *
from BPpy.model.bprogram import BProgram
from BPpy.model.event_selection.experimental_smt... | [
"z3.is_true",
"z3.And",
"math.atan2",
"os.path.realpath",
"socket.socket",
"BPpy.model.event_selection.experimental_smt_event_selection_strategy.ExperimentalSMTEventSelectionStrategy",
"time.sleep",
"BPpy.model.event_selection.experimental_smt_event_selection_strategy.Request",
"z3.Not",
"z3.Or",
... | [((488, 537), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (501, 537), False, 'import socket\n'), ((552, 601), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (565, ... |
from launch import LaunchDescription
import launch_ros.actions
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
return LaunchDescription([
launch_ros.actions.Node(
parameters=[
get_package_share_directory("slam_toolbox") + '/confi... | [
"ament_index_python.packages.get_package_share_directory"
] | [((267, 310), 'ament_index_python.packages.get_package_share_directory', 'get_package_share_directory', (['"""slam_toolbox"""'], {}), "('slam_toolbox')\n", (294, 310), False, 'from ament_index_python.packages import get_package_share_directory\n')] |
import utils
print(utils.inRange(1, 420, 4, 9,9))
print(utils.inRange(1, 420, 4, 2,9))
print(utils.inRange(1, 420, 4, 1,9))
print(utils.inRange(1, 420, 0, 0,1)) | [
"utils.inRange"
] | [((20, 50), 'utils.inRange', 'utils.inRange', (['(1)', '(420)', '(4)', '(9)', '(9)'], {}), '(1, 420, 4, 9, 9)\n', (33, 50), False, 'import utils\n'), ((57, 87), 'utils.inRange', 'utils.inRange', (['(1)', '(420)', '(4)', '(2)', '(9)'], {}), '(1, 420, 4, 2, 9)\n', (70, 87), False, 'import utils\n'), ((94, 124), 'utils.in... |
import json
import os
from flask import Blueprint
from flask import current_app
from flask import flash
from flask import jsonify
from flask import redirect
from flask import render_template
from flask import request
from flask import send_from_directory
from flask import url_for
from sqlalchemy import and_
import fl... | [
"shopyoapi.validators.is_empty_str",
"modules.box__default.settings.helpers.get_setting",
"modules.resource.models.Resource.query.filter",
"shopyoapi.init.db.session.delete",
"modules.box__ecommerce.category.models.SubCategory.query.get",
"flask.jsonify",
"flask.url_for",
"shopyoapi.init.db.session.co... | [((1003, 1028), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1018, 1028), False, 'import os\n'), ((1106, 1118), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1115, 1118), False, 'import json\n'), ((1582, 1602), 'modules.box__ecommerce.category.models.Category.query.all', 'Category.query... |
#!/usr/bin/env python3
import sys
sys.path.append("..")
import time
import gym
# this import is not being used, but is required to make Universe envs available!
import universe
from PIL import Image
from lib import wob_vnc
# Docker image manual start:
# docker run -p 5900:5900 -p 15900:15900 --privileged --ipc host ... | [
"sys.path.append",
"gym.make",
"time.sleep",
"PIL.Image.fromarray",
"lib.wob_vnc.MiniWoBCropper"
] | [((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((424, 459), 'gym.make', 'gym.make', (['"""wob.mini.BisectAngle-v0"""'], {}), "('wob.mini.BisectAngle-v0')\n", (432, 459), False, 'import gym\n'), ((470, 497), 'lib.wob_vnc.MiniWoBCropper', 'wob_vnc.MiniW... |
##
## Copyright (c) 2016-2019 Genomics England Ltd.
##
## This file is part of PanelApp
## (see https://panelapp.genomicsengland.co.uk).
##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distributed with this work for additional informati... | [
"django.db.migrations.RemoveField",
"django.db.models.IntegerField",
"django.db.models.CharField"
] | [((1273, 1334), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""str"""', 'name': '"""normal_range"""'}), "(model_name='str', name='normal_range')\n", (1295, 1334), False, 'from django.db import migrations, models\n'), ((1344, 1409), 'django.db.migrations.RemoveField', 'migrations.R... |
# 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 os
import signal
import unittest
from contextlib import contextmanager
from pathlib import Path
from typing import Generator, Optional
... | [
"unittest.mock.patch.object",
"pathlib.Path",
"os.getpid",
"os.path.join"
] | [((708, 756), 'unittest.mock.patch.object', 'patch.object', (['Process', '"""register_unique_process"""'], {}), "(Process, 'register_unique_process')\n", (720, 756), False, 'from unittest.mock import MagicMock, patch\n'), ((762, 804), 'unittest.mock.patch.object', 'patch.object', (['watchman', '"""remove_if_exists"""']... |
# -*- coding: utf-8 -*-
# This file is part of CairoSVG
# Copyright © 2010-2012 Kozea
#
# This library is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option... | [
"path.path"
] | [((2228, 2247), 'path.path', 'path', (['surface', 'node'], {}), '(surface, node)\n', (2232, 2247), False, 'from path import path\n')] |
from simplexml import dumps
from flask import Flask, request, jsonify, g
#from flask_restful import Resource, Api, reqparse
from .estimator import estimator
import time
app = Flask(__name__)
app.config['DEBUG'] = True
# api = Api(app)
# Data = {
# region: {
# name: "Africa",
# avgAge: 19.7,
# ... | [
"flask.jsonify",
"flask.Flask",
"flask.request.get_json",
"time.time"
] | [((176, 191), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (181, 191), False, 'from flask import Flask, request, jsonify, g\n'), ((1164, 1182), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1180, 1182), False, 'from flask import Flask, request, jsonify, g\n'), ((1224, 1236), 'flask.jso... |
#!/usr/bin/python
from participantCollection import ParticipantCollection
participants = ParticipantCollection()
for participant in participants.participantsWhoAreStillIn():
participant.hasCheckedIn = False
participants.save()
| [
"participantCollection.ParticipantCollection"
] | [((91, 114), 'participantCollection.ParticipantCollection', 'ParticipantCollection', ([], {}), '()\n', (112, 114), False, 'from participantCollection import ParticipantCollection\n')] |
# 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 or agreed to in writing, s... | [
"copy.deepcopy",
"re.split",
"lit_nlp.api.types.TextSegment",
"re.escape",
"absl.logging.warning",
"re.search"
] | [((2078, 2106), 're.split', 're.split', (['"""\\\\s*->\\\\s*"""', 'rule'], {}), "('\\\\s*->\\\\s*', rule)\n", (2086, 2106), False, 'import re\n'), ((2249, 2281), 're.split', 're.split', (['"""\\\\s*\\\\|\\\\s*"""', 'tgt_str'], {}), "('\\\\s*\\\\|\\\\s*', tgt_str)\n", (2257, 2281), False, 'import re\n'), ((6588, 6634), ... |
import numpy as np
import tensorflow as tf
from keras import keras_parameterized, layers, models
from keras.utils.losses_utils import ReductionV2 as Reduction
from ..consistency_enhanced import ConsistencyEnhancedSigmoidLoss
from ..consistency_enhanced import consistency_enhanced_sigmoid_loss
def _to_logit(prob):
... | [
"tensorflow.test.main",
"tensorflow.ones",
"numpy.log",
"tensorflow.constant",
"tensorflow.zeros",
"keras.layers.Dense",
"keras.layers.Input"
] | [((329, 356), 'numpy.log', 'np.log', (['(prob / (1.0 - prob))'], {}), '(prob / (1.0 - prob))\n', (335, 356), True, 'import numpy as np\n'), ((5065, 5079), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (5077, 5079), True, 'import tensorflow as tf\n'), ((782, 827), 'tensorflow.constant', 'tf.constant', (['[[0... |
import unittest
from pymoq.stub.request import RequestStub
from utils import HandlerMock
class RequestStubTestCase(unittest.TestCase):
def test_can_handle_default_method(self):
target = RequestStub('book/')
request_handler = HandlerMock('book/', 'GET')
self.assertTrue(target.can_handle(r... | [
"pymoq.stub.request.RequestStub",
"utils.HandlerMock"
] | [((201, 221), 'pymoq.stub.request.RequestStub', 'RequestStub', (['"""book/"""'], {}), "('book/')\n", (212, 221), False, 'from pymoq.stub.request import RequestStub\n'), ((249, 276), 'utils.HandlerMock', 'HandlerMock', (['"""book/"""', '"""GET"""'], {}), "('book/', 'GET')\n", (260, 276), False, 'from utils import Handle... |
from django.conf import settings
from django.db import models
from common.models import BaseModel
class TumblrLead(BaseModel):
tumblr_user = models.CharField(max_length=100, unique=True)
ywot_refers = models.PositiveIntegerField(blank=True, null=True)
time_last_scraped = models.DateTimeField(blank=True, n... | [
"django.db.models.NullBooleanField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.EmailField",
"django.db.models.DateTimeField"
] | [((147, 192), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'unique': '(True)'}), '(max_length=100, unique=True)\n', (163, 192), False, 'from django.db import models\n'), ((211, 261), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'blank': '(True)', 'null'... |
from __future__ import unicode_literals
try:
from urllib.parse import quote
except:
from urllib import quote
from django.urls import Resolver404
from django.http.request import QueryDict
from django.utils import six
class ModuleMatchName(str):
"""Dump str wrapper.
Just to keep module reference over... | [
"django.utils.six.iterlists",
"django.urls.resolvers.RegexPattern",
"django.urls.Resolver404",
"urllib.quote",
"django.http.request.QueryDict"
] | [((3223, 3246), 'django.http.request.QueryDict', 'QueryDict', ([], {'mutable': '(True)'}), '(mutable=True)\n', (3232, 3246), False, 'from django.http.request import QueryDict\n'), ((3269, 3295), 'django.utils.six.iterlists', 'six.iterlists', (['request.GET'], {}), '(request.GET)\n', (3282, 3295), False, 'from django.ut... |
import re
def readArticle(filename):
with open(filename, 'r', encoding='utf8') as fin:
return fin.read()
def getBasicInfo(article):
basicInfo = re.search(r'\{\{基礎情報(.+?)\}\}\n', article, re.DOTALL).group(1)
pat = r'^\|(.+?)\s*=\s*(.+?)(?<!<br/>)\n'
reg = re.compile(pat, re.MULTILINE | re.DOTAL... | [
"re.sub",
"re.search",
"re.compile"
] | [((281, 322), 're.compile', 're.compile', (['pat', '(re.MULTILINE | re.DOTALL)'], {}), '(pat, re.MULTILINE | re.DOTALL)\n', (291, 322), False, 'import re\n'), ((390, 430), 're.sub', 're.sub', (['"""\'\'(\'|\'\'\')([^\']+?)\'\'+"""', '"""\\\\2"""', 'v'], {}), '("\'\'(\'|\'\'\')([^\']+?)\'\'+", \'\\\\2\', v)\n', (396, 43... |
import torch.nn as nn
import random
class LayerHardtanhTest(nn.Module):
"""
Test for nn.layers based types
"""
def __init__(self):
super(LayerHardtanhTest, self).__init__()
self.min_val = random.random()
self.max_val = self.min_val + random.random()
self.htanh = nn.Hard... | [
"random.random",
"torch.nn.functional.hardtanh",
"torch.nn.Hardtanh"
] | [((222, 237), 'random.random', 'random.random', ([], {}), '()\n', (235, 237), False, 'import random\n'), ((313, 368), 'torch.nn.Hardtanh', 'nn.Hardtanh', ([], {'min_val': 'self.min_val', 'max_val': 'self.max_val'}), '(min_val=self.min_val, max_val=self.max_val)\n', (324, 368), True, 'import torch.nn as nn\n'), ((615, 6... |
import json
import logging
import os
import pytest
from ipaddress import ip_interface, IPv4Interface, IPv6Interface, \
ip_address, IPv4Address
from tests.common import config_reload
from tests.common.dualtor.dual_tor_utils import tor_mux_intfs
__all__ = [
'apply_active_state_to_orchagent',
... | [
"tests.common.config_reload",
"ipaddress.ip_interface",
"pytest.fixture",
"ipaddress.ip_address",
"json.dumps",
"os.path.join",
"logging.getLogger"
] | [((837, 864), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (854, 864), False, 'import logging\n'), ((4134, 4164), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (4148, 4164), False, 'import pytest\n'), ((4369, 4399), 'pytest.fixture', 'pytest.... |
from discord.ext import commands
from utils.new_discord import new_guild, new_member
from utils.get_member import get_member
from utils.check import can_convert_to_int
import discord
class Level(commands.Cog):
def __init__(self, bot, data):
self.bot = bot
self.data = data
@commands.Cog.lis... | [
"utils.new_discord.new_member",
"utils.new_discord.new_guild",
"utils.check.can_convert_to_int",
"discord.ext.commands.Cog.listener"
] | [((304, 327), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (325, 327), False, 'from discord.ext import commands\n'), ((620, 647), 'utils.new_discord.new_guild', 'new_guild', (['self.data', 'guild'], {}), '(self.data, guild)\n', (629, 647), False, 'from utils.new_discord import new_gui... |
"""
===========================
Find closest and furthest pairs in the whole set of norms.
===========================
Dr. <NAME>
---------------------------
Embodied Cognition Lab
Department of Psychology
University of Lancaster
<EMAIL>
caiwingfield.net
---------------------------
2022
---------------------------
"""... | [
"pathlib.Path"
] | [((381, 500), 'pathlib.Path', 'Path', (['"""/Users/caiwingfield/Box Sync/LANGBOOT Project/Manuscripts/Draft - Sensorimotor distance norms/Output/"""'], {}), "(\n '/Users/caiwingfield/Box Sync/LANGBOOT Project/Manuscripts/Draft - Sensorimotor distance norms/Output/'\n )\n", (385, 500), False, 'from pathlib import ... |
from http import HTTPServer
from http import status
from http import mkHeader
def callback(file, addr, data):
if file in ["/index.html", "/"]:
print(f"{addr[0]} -> {status[200]} -> {data[0][0]}:{data[0][1]}{file}")
return (status[200], "RoboRIO web configuration")
if file == "/login":
if "Auth" in data[1][4]... | [
"http.mkHeader",
"http.HTTPServer"
] | [((772, 809), 'http.HTTPServer', 'HTTPServer', (['callback', '"""0.0.0.0"""', '(8088)'], {}), "(callback, '0.0.0.0', 8088)\n", (782, 809), False, 'from http import HTTPServer\n'), ((590, 625), 'http.mkHeader', 'mkHeader', (['"""WWW-Authenticate: Basic"""'], {}), "('WWW-Authenticate: Basic')\n", (598, 625), False, 'from... |
import json
import operator
import numpy as np
import pandas as pd
from pandas.core.arrays import ExtensionArray
from pandas.core.dtypes.base import ExtensionDtype
class Delegated:
# Descriptor for delegating attribute access to from
# a Series to an underlying array
def __init__(self, name):
se... | [
"pandas.api.extensions.register_series_accessor",
"json.loads",
"operator.getitem",
"pandas.Series",
"numpy.concatenate",
"pandas.core.algorithms.take"
] | [((2778, 2828), 'pandas.api.extensions.register_series_accessor', 'pd.api.extensions.register_series_accessor', (['"""json"""'], {}), "('json')\n", (2820, 2828), True, 'import pandas as pd\n'), ((537, 572), 'pandas.Series', 'pd.Series', (['result', 'index'], {'name': 'name'}), '(result, index, name=name)\n', (546, 572)... |
"""test utils module."""
from unittest import mock
from itertools import product
import pytest
from version.utils import backup_database
@pytest.mark.parametrize(
'mock_exists_retval, mock_isdir_retval',
product([True, False], repeat=2)
)
def test_run_backup_database(mock_exists_retval, mock_isdir_retval):
... | [
"unittest.mock.Mock",
"unittest.mock.patch",
"unittest.mock.call.path.exists",
"version.utils.backup_database",
"unittest.mock.call.path.join",
"itertools.product",
"unittest.mock.call.path.split",
"unittest.mock.call.path.isdir"
] | [((382, 393), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (391, 393), False, 'from unittest import mock\n'), ((415, 426), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (424, 426), False, 'from unittest import mock\n'), ((443, 454), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (452, 454), False, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.