code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import secrets
from typing import List, Union
from decouple import config
from pydantic import BaseSettings, validator
class Settings(BaseSettings):
PROJECT_NAME: str = "Chat Room"
API_V1_PREFIX: str = "/api/v1"
SECRET_KEY: str = secrets.token_urlsafe(32)
# CORS_ORIGINS is a JSON-formatted list of ori... | [
"decouple.config",
"secrets.token_urlsafe",
"pydantic.validator"
] | [((244, 269), 'secrets.token_urlsafe', 'secrets.token_urlsafe', (['(32)'], {}), '(32)\n', (265, 269), False, 'import secrets\n'), ((527, 561), 'decouple.config', 'config', (['"""CORS_ORIGINS"""'], {'default': '[]'}), "('CORS_ORIGINS', default=[])\n", (533, 561), False, 'from decouple import config\n'), ((585, 672), 'de... |
# Donut problem using logistic regression
# Code Flow:
# 1. Import all relevant libraries.
# 2. Generate sample data.
# 3. Plot the data.
# 4. Add bias term.
# 5. Add radius as a feature.
# 6. Generate random weights for initialization.
# 7. Define sigmoid function.
# 8. Calculate Y.
... | [
"numpy.ones",
"matplotlib.pyplot.ylabel",
"numpy.random.random",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"numpy.exp",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.cos",
"matplotlib.pyplot.scatter",
"numpy.concatenate",
"numpy.sin",
"matplotlib.pyplot.title",... | [((1208, 1242), 'numpy.concatenate', 'np.concatenate', (['[X_inner, X_outer]'], {}), '([X_inner, X_outer])\n', (1222, 1242), True, 'import numpy as np\n'), ((1249, 1290), 'numpy.array', 'np.array', (['([0] * (N // 2) + [1] * (N // 2))'], {}), '([0] * (N // 2) + [1] * (N // 2))\n', (1257, 1290), True, 'import numpy as n... |
import json
import os
from typing import List
from internal.information.core.query.get_config import GetConfig as QueryModel
from internal.information.infrastructure.getpath.config.model.path import PathModel
JSON_FILE = '.json'
RELATIVE_PATH = 'Eureka\\internal\\platform\\defaultconfig\\'
class JsonMapping:
de... | [
"json.load",
"internal.information.infrastructure.getpath.config.model.path.PathModel",
"os.getcwd"
] | [((913, 924), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (922, 924), False, 'import os\n'), ((554, 566), 'json.load', 'json.load', (['f'], {}), '(f)\n', (563, 566), False, 'import json\n'), ((672, 701), 'internal.information.infrastructure.getpath.config.model.path.PathModel', 'PathModel', (['""""""', '""""""', '"""""... |
# Copyright 2021 Sony Semiconductors Israel, 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 b... | [
"model_compression_toolkit.core.common.graph.graph_matchers.NodeFrameworkAttrMatcher",
"numpy.array",
"model_compression_toolkit.core.common.graph.graph_matchers.NodeOperationMatcher",
"model_compression_toolkit.core.common.graph.BaseNode",
"model_compression_toolkit.core.common.substitutions.shift_negative... | [((4868, 4903), 'model_compression_toolkit.core.common.graph.graph_matchers.NodeOperationMatcher', 'NodeOperationMatcher', (['ZeroPadding2D'], {}), '(ZeroPadding2D)\n', (4888, 4903), False, 'from model_compression_toolkit.core.common.graph.graph_matchers import NodeOperationMatcher, NodeFrameworkAttrMatcher\n'), ((6009... |
import numpy as np
import pandas as pd
l_2d = [[0, 1, 2], [3, 4, 5]]
arr_t = np.array(l_2d).T
print(arr_t)
print(type(arr_t))
# [[0 3]
# [1 4]
# [2 5]]
# <class 'numpy.ndarray'>
l_2d_t = np.array(l_2d).T.tolist()
print(l_2d_t)
print(type(l_2d_t))
# [[0, 3], [1, 4], [2, 5]]
# <class 'list'>
df_t = pd.DataFrame(l... | [
"pandas.DataFrame",
"numpy.array"
] | [((79, 93), 'numpy.array', 'np.array', (['l_2d'], {}), '(l_2d)\n', (87, 93), True, 'import numpy as np\n'), ((306, 324), 'pandas.DataFrame', 'pd.DataFrame', (['l_2d'], {}), '(l_2d)\n', (318, 324), True, 'import pandas as pd\n'), ((193, 207), 'numpy.array', 'np.array', (['l_2d'], {}), '(l_2d)\n', (201, 207), True, 'impo... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"os.path.exists",
"textwrap.dedent",
"os.makedirs",
"click.secho",
"pathlib.Path",
"mindinsight.wizard.base.utility.load_network_maker",
"os.getcwd",
"os.path.os.listdir",
"mindinsight.wizard.base.utility.find_network_maker_names",
"mindinsight.wizard.base.utility.process_prompt_choice",
"sys.ex... | [((1288, 1314), 'mindinsight.wizard.base.utility.find_network_maker_names', 'find_network_maker_names', ([], {}), '()\n', (1312, 1314), False, 'from mindinsight.wizard.base.utility import find_network_maker_names, load_network_maker, process_prompt_choice\n'), ((1874, 1924), 'os.makedirs', 'os.makedirs', (['project_dir... |
# Generated by Django 3.1.1 on 2020-09-10 16:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customers', '0004_customer_description'),
]
operations = [
migrations.AddField(
model_name='customer',
name='lookup_... | [
"django.db.models.CharField"
] | [((343, 399), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(24)', 'unique': '(True)'}), '(blank=True, max_length=24, unique=True)\n', (359, 399), False, 'from django.db import migrations, models\n')] |
import os
from dvc.scm import Git
from mock import MagicMock
from contextlib import contextmanager
def spy(method_to_decorate):
mock = MagicMock()
def wrapper(self, *args, **kwargs):
mock(*args, **kwargs)
return method_to_decorate(self, *args, **kwargs)
wrapper.mock = mock
return wr... | [
"os.chdir",
"mock.MagicMock",
"os.path.expanduser",
"os.getcwd"
] | [((142, 153), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (151, 153), False, 'from mock import MagicMock\n'), ((490, 501), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (499, 501), False, 'import os\n'), ((515, 541), 'os.path.expanduser', 'os.path.expanduser', (['newdir'], {}), '(newdir)\n', (533, 541), False, 'impo... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import shutil
import tempfile
import time
import salt.config
# Import salt libs
import salt.version
# Import Salt Testing libs
from tests.support.case import MultimasterMod... | [
"logging.getLogger",
"os.path.join",
"tempfile.mkdtemp",
"time.time",
"tests.support.unit.skipIf"
] | [((573, 600), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (590, 600), False, 'import logging\n'), ((604, 659), 'tests.support.unit.skipIf', 'skipIf', (['(not HAS_PYINOTIFY)', '"""pyinotify is not available"""'], {}), "(not HAS_PYINOTIFY, 'pyinotify is not available')\n", (610, 659), Fa... |
"""Compatibility code for using CherryPy with various versions of Python.
To retain compatibility with older Python versions, this module provides a
useful abstraction over the differences between Python versions, sometimes by
preferring a newer idiom, sometimes an older one, and sometimes a custom one.
In particular... | [
"six.moves.urllib.parse.unquote_plus",
"six.moves.urllib.parse.unquote",
"json.JSONDecoder",
"json.JSONEncoder",
"cgi.escape"
] | [((4421, 4439), 'json.JSONDecoder', 'json.JSONDecoder', ([], {}), '()\n', (4437, 4439), False, 'import json\n'), ((4462, 4480), 'json.JSONEncoder', 'json.JSONEncoder', ([], {}), '()\n', (4478, 4480), False, 'import json\n'), ((5336, 5365), 'cgi.escape', 'escape', (['s'], {'quote': 'escape_quote'}), '(s, quote=escape_qu... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-18 16:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid_upload_path.storage
class Migration(migrations.Migration):
initial = True
d... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((378, 435), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (409, 435), False, 'from django.db import migrations, models\n'), ((566, 659), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import torch
import shapely
from shapely.geometry import Polygon
import numpy as np
from .transformer_obb import poly2bbox
from .bbox_overlaps_cython import bbox_overlaps_cython
import DOTA_devkit.polyiou as polyiou
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):
"""Calculate overlap between tw... | [
"DOTA_devkit.polyiou.VectorDouble",
"numpy.where",
"torch.max",
"torch.from_numpy",
"torch.min",
"shapely.geometry.Polygon"
] | [((4246, 4264), 'numpy.where', 'np.where', (['(ious > 0)'], {}), '(ious > 0)\n', (4254, 4264), True, 'import numpy as np\n'), ((1150, 1191), 'torch.max', 'torch.max', (['bboxes1[:, :2]', 'bboxes2[:, :2]'], {}), '(bboxes1[:, :2], bboxes2[:, :2])\n', (1159, 1191), False, 'import torch\n'), ((1218, 1259), 'torch.min', 'to... |
'''Borrowed utils file from <NAME>'''
from datetime import datetime
from decouple import config
import pandas as pd
import os
import requests
import nltk
from nltk.stem import WordNetLemmatizer
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from api.models import DB, Repo
from api.queries import repo_query... | [
"pandas.DataFrame.from_records",
"requests.post",
"nltk.sentiment.vader.SentimentIntensityAnalyzer",
"api.models.DB.session.merge",
"datetime.datetime.strptime",
"api.models.Repo",
"decouple.config",
"nltk.stem.WordNetLemmatizer",
"datetime.datetime.now",
"api.models.DB.session.commit",
"pandas.... | [((438, 454), 'decouple.config', 'config', (['"""SECRET"""'], {}), "('SECRET')\n", (444, 454), False, 'from decouple import config\n'), ((8528, 8547), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (8545, 8547), False, 'from nltk.stem import WordNetLemmatizer\n'), ((641, 757), 'requests.post', 'r... |
import unittest
from mock import MagicMock
from py_i2c_register.register_list import RegisterList
from py_i2c_register.register import Register
from py_i2c_register.register_segment import RegisterSegment
class TestRegisterListInit(unittest.TestCase):
def test_perfect(self):
i2c = MagicMock()
list... | [
"py_i2c_register.register_list.RegisterList",
"py_i2c_register.register_segment.RegisterSegment",
"mock.MagicMock"
] | [((296, 307), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (305, 307), False, 'from mock import MagicMock\n'), ((323, 361), 'py_i2c_register.register_list.RegisterList', 'RegisterList', (['(1)', 'i2c', "{'key': 'value'}"], {}), "(1, i2c, {'key': 'value'})\n", (335, 361), False, 'from py_i2c_register.register_list i... |
import rasterstats
import rasterio
import fiona
from rasterio.warp import reproject
import pandas as pd
import geopandas as gpd
#### FOR ICLUS, BEST PROJECTION IS EPSG 5070: NAD83/CONUS ALBERS
vor = '/home/akagi/voronoi_intersect.shp'
pop_dens = '/home/akagi/Desktop/rastercopy.tif'
gdf = gpd.GeoDataFrame.from_file(vo... | [
"rasterio.open",
"geopandas.GeoDataFrame.from_file",
"rasterstats.zonal_stats",
"pandas.concat"
] | [((291, 322), 'geopandas.GeoDataFrame.from_file', 'gpd.GeoDataFrame.from_file', (['vor'], {}), '(vor)\n', (317, 322), True, 'import geopandas as gpd\n'), ((330, 353), 'rasterio.open', 'rasterio.open', (['pop_dens'], {}), '(pop_dens)\n', (343, 353), False, 'import rasterio\n'), ((509, 555), 'pandas.concat', 'pd.concat',... |
#
# Copyright (c) 2018 CNRS INRIA
#
## In this file, are reported some deprecated functions that are still maintained until the next important future releases ##
from __future__ import print_function
import warnings as _warnings
from . import libpinocchio_pywrap as pin
from .deprecation import deprecated, Deprecat... | [
"warnings.warn"
] | [((1695, 1751), 'warnings.warn', '_warnings.warn', (['message', 'DeprecatedWarning'], {'stacklevel': '(2)'}), '(message, DeprecatedWarning, stacklevel=2)\n', (1709, 1751), True, 'import warnings as _warnings\n'), ((2043, 2099), 'warnings.warn', '_warnings.warn', (['message', 'DeprecatedWarning'], {'stacklevel': '(2)'})... |
from django.db import migrations, models
import two_factor.models
class Migration(migrations.Migration):
dependencies = [
('two_factor', '0005_auto_20160224_0450'),
]
operations = [
migrations.AlterField(
model_name='phonedevice',
name='key',
field=mo... | [
"django.db.models.CharField"
] | [((318, 483), 'django.db.models.CharField', 'models.CharField', ([], {'default': 'two_factor.models.random_hex_str', 'help_text': '"""Hex-encoded secret key"""', 'max_length': '(40)', 'validators': '[two_factor.models.key_validator]'}), "(default=two_factor.models.random_hex_str, help_text=\n 'Hex-encoded secret key... |
import os
import imageio
import numpy as np
from skimage.transform import resize
import tensorflow as tf
from tensorflow.keras.initializers import RandomNormal
from tensorflow.keras.layers import Conv2D, Activation, Concatenate
# from keras_contrib.layers.normalization.instancenormalization import InstanceNormal... | [
"os.listdir",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.initializers.RandomNormal",
"tensorflow.keras.layers.Concatenate",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.nn.moments",
"numpy.asarray",
"os.path.join",
"tensorflow.random_normal_initializer",
"numpy.zeros",
"ten... | [((3435, 3460), 'tensorflow.keras.initializers.RandomNormal', 'RandomNormal', ([], {'stddev': '(0.02)'}), '(stddev=0.02)\n', (3447, 3460), False, 'from tensorflow.keras.initializers import RandomNormal\n'), ((1142, 1186), 'tensorflow.nn.moments', 'tf.nn.moments', (['x'], {'axes': '[1, 2]', 'keepdims': '(True)'}), '(x, ... |
import numpy as np
def to_2darray(x: np.array, copy: bool = True, trans: bool = False,
flip: bool = False) -> np.array:
"""
Assumption:
-----------
x is assumed to be numpy 2D array or matrix.
(please convert x accordingly). For example,
x = nptweak.to_2darray(x)
The... | [
"numpy.flipud"
] | [((757, 769), 'numpy.flipud', 'np.flipud', (['y'], {}), '(y)\n', (766, 769), True, 'import numpy as np\n')] |
import os
from setka.pipes.logging.progressbar.theme_parser import view_status, format_status
# from setka.pipes.logging.progressbar.theme import main_theme
try:
from IPython.display import display, update_display
except:
pass
def isnotebook():
try:
shell = get_ipython().__class__.__name__
... | [
"IPython.display.display",
"setka.pipes.logging.progressbar.theme_parser.view_status",
"IPython.display.update_display",
"setka.pipes.logging.progressbar.theme_parser.format_status"
] | [((1196, 1225), 'setka.pipes.logging.progressbar.theme_parser.format_status', 'format_status', (['self.last_vals'], {}), '(self.last_vals)\n', (1209, 1225), False, 'from setka.pipes.logging.progressbar.theme_parser import view_status, format_status\n'), ((1244, 1287), 'setka.pipes.logging.progressbar.theme_parser.view_... |
# -*- coding: utf-8 -*-
"""
This module contains tests for the ACSpy package.
"""
from __future__ import division, print_function
from acspy import acsc, control
import time
def test_write_real():
print("Testing acsc.writeReal")
hc = acsc.openCommDirect()
varname = "SLLIMIT1"
val = 3.14
acsc.write... | [
"acspy.acsc.closeComm",
"acspy.acsc.readReal",
"acspy.acsc.openCommDirect",
"acspy.control.Controller",
"acspy.acsc.writeReal",
"time.sleep",
"acspy.acsc.runBuffer",
"acspy.acsc.getRPosition",
"acspy.acsc.getVelocity",
"acspy.acsc.loadBuffer"
] | [((244, 265), 'acspy.acsc.openCommDirect', 'acsc.openCommDirect', ([], {}), '()\n', (263, 265), False, 'from acspy import acsc, control\n'), ((310, 342), 'acspy.acsc.writeReal', 'acsc.writeReal', (['hc', 'varname', 'val'], {}), '(hc, varname, val)\n', (324, 342), False, 'from acspy import acsc, control\n'), ((357, 389)... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-03-13 21:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hosts', '0003_auto_20170309_1038'),
]
operations = ... | [
"django.db.models.ForeignKey"
] | [((438, 548), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""hosts.GroupHost"""', 'verbose_name': '"""平台ID"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'hosts.GroupHost', verbose_name='平台ID')\n", (455, 548), False, 'from django.db ... |
from pathlib import Path
from mock import patch, PropertyMock, MagicMock
import pytest
import asyncio
from decoy import matchers
from opentrons.hardware_control import ExecutionManager
from opentrons.hardware_control.modules import (
MagDeck,
Thermocycler,
TempDeck,
HeaterShaker,
)
from opentrons.hardw... | [
"mock.patch",
"opentrons.hardware_control.modules.UpdateError",
"pathlib.Path",
"decoy.matchers.IsA",
"opentrons.hardware_control.ExecutionManager",
"opentrons.drivers.rpi_drivers.types.USBPort",
"asyncio.get_running_loop",
"mock.PropertyMock",
"asyncio.TimeoutError",
"mock.MagicMock"
] | [((493, 578), 'opentrons.drivers.rpi_drivers.types.USBPort', 'USBPort', ([], {'name': '""""""', 'hub': 'None', 'port_number': '(0)', 'device_path': '"""/dev/ot_module_magdeck1"""'}), "(name='', hub=None, port_number=0, device_path='/dev/ot_module_magdeck1'\n )\n", (500, 578), False, 'from opentrons.drivers.rpi_drive... |
import operator
import typing
import z3
from .._exceptions import UnsupportedError
from ._methods import Methods
from ._type_factory import TypeFactory
if typing.TYPE_CHECKING:
from .._context import Context
from ._bool import BoolSort
from ._float import FloatSort, FPSort, RealSort
from ._int impor... | [
"z3.Not",
"typing.TypeVar"
] | [((366, 404), 'typing.TypeVar', 'typing.TypeVar', (['"""T"""'], {'bound': '"""ProxySort"""'}), "('T', bound='ProxySort')\n", (380, 404), False, 'import typing\n'), ((5524, 5536), 'z3.Not', 'z3.Not', (['expr'], {}), '(expr)\n', (5530, 5536), False, 'import z3\n'), ((7547, 7575), 'z3.Not', 'z3.Not', (['expr'], {'ctx': 'c... |
# Generated by Django 2.2.4 on 2019-08-15 23:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0012_auto_20190815_2338'),
]
operations = [
migrations.AddField(
model_name='pyproduct',
name='bar_code',
... | [
"django.db.models.CharField"
] | [((336, 379), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(80)'}), '(blank=True, max_length=80)\n', (352, 379), False, 'from django.db import migrations, models\n')] |
import csv
import os
import cv2
import random
import argparse
def main(args):
image_path = args.image_path
csv_path = args.csv_path
preprocess(image_path, csv_path)
def preprocess(image_path, csv_path):
print("start preprocess...")
f = open(csv_path, 'w', encoding='utf-8', newli... | [
"os.listdir",
"argparse.ArgumentParser",
"csv.writer",
"cv2.imread",
"random.randint"
] | [((347, 360), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (357, 360), False, 'import csv\n'), ((428, 450), 'os.listdir', 'os.listdir', (['image_path'], {}), '(image_path)\n', (438, 450), False, 'import os\n'), ((770, 880), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PREPROCESS""... |
from __future__ import division
from asciimatics.effects import BannerText, Print, Scroll
from asciimatics.renderers import ColourImageFile, FigletText, ImageFile
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import ResizeScreenError
import sys
def demo(screen):... | [
"asciimatics.renderers.ImageFile",
"asciimatics.renderers.FigletText",
"asciimatics.effects.Scroll",
"sys.exit",
"asciimatics.scene.Scene",
"asciimatics.renderers.ColourImageFile",
"asciimatics.screen.Screen.wrapper"
] | [((514, 528), 'asciimatics.scene.Scene', 'Scene', (['effects'], {}), '(effects)\n', (519, 528), False, 'from asciimatics.scene import Scene\n'), ((1066, 1080), 'asciimatics.scene.Scene', 'Scene', (['effects'], {}), '(effects)\n', (1071, 1080), False, 'from asciimatics.scene import Scene\n'), ((1333, 1350), 'asciimatics... |
# 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, ... | [
"flask.request.args.get",
"services.datacommons.fetch_data",
"services.datacommons.get_statvar_groups",
"services.datacommons.query",
"lib.statvar_hierarchy_search.get_search_result",
"routes.api.place.statsvars",
"json.dumps",
"cache.cache.memoize",
"flask.request.json.get",
"services.datacommons... | [((888, 955), 'flask.Blueprint', 'flask.Blueprint', (['"""api.browser"""', '__name__'], {'url_prefix': '"""/api/browser"""'}), "('api.browser', __name__, url_prefix='/api/browser')\n", (903, 955), False, 'import flask\n'), ((1024, 1056), 'cache.cache.memoize', 'cache.memoize', ([], {'timeout': '(3600 * 24)'}), '(timeou... |
"""Definition of the Roman numeral analysis deep neural network(s)."""
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
def AugmentedNet(inputs, outputs, blocks=6):
"""Definition of the AugmentedNet architecture."""
x = [] # (raw) inputs of the network
xprime = []... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.name_scope",
"tensorflow.keras.Model",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.la... | [((1688, 1720), 'tensorflow.keras.Model', 'keras.Model', ([], {'inputs': 'x', 'outputs': 'y'}), '(inputs=x, outputs=y)\n', (1699, 1720), False, 'from tensorflow import keras\n'), ((3485, 3536), 'tensorflow.keras.layers.Input', 'layers.Input', ([], {'shape': '(sequenceLength, inputFeatures)'}), '(shape=(sequenceLength, ... |
from __future__ import annotations
import dataclasses
import datetime
import hashlib
import json
import logging
import os
import uuid
from contextlib import contextmanager
from enum import Enum
from pathlib import Path
from typing import Any, Dict, Iterator, List, Optional, Union
from minato.exceptions import CacheAl... | [
"logging.getLogger",
"os.makedirs",
"pathlib.Path",
"minato.exceptions.CacheAlreadyExists",
"minato.util.remove_file_or_directory",
"minato.exceptions.CacheNotFoundError",
"uuid.uuid4",
"datetime.datetime.now",
"datetime.datetime.fromisoformat",
"json.load",
"minato.exceptions.ConfigurationError... | [((468, 495), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (485, 495), False, 'import logging\n'), ((5941, 5964), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (5962, 5964), False, 'import datetime\n'), ((7100, 7153), 'minato.exceptions.CacheNotFoundError', 'CacheN... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
__author__ = 'david'
import numpy as np
import nibabel as nib
import resources as rs
from vispy import app
from plot import Canvas
import matplotlib.pyplot as plt
import gc
np.random.seed()
class Clarity(object):
def __init__(self,token,imgfile=None,pointsfile=None):
... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.hist",
"nibabel.load",
"matplotlib.pyplot.ylabel",
"numpy.hstack",
"numpy.mean",
"numpy.histogram",
"numpy.where",
"numpy.random.random",
"matplotlib.pyplot.xlabel",
"numpy.max",
"numpy.random.seed",
"numpy.vstack",
"numpy.abs",
"numpy.int16",... | [((215, 231), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (229, 231), True, 'import numpy as np\n'), ((844, 862), 'nibabel.load', 'nib.load', (['pathname'], {}), '(pathname)\n', (852, 862), True, 'import nibabel as nib\n'), ((1005, 1022), 'numpy.max', 'np.max', (['self._img'], {}), '(self._img)\n', (1011, ... |
import copy
import functools
import gc
import time
from hfutils.constants import TASK_TO_LABELS
from seaborn.distributions import histplot
import torch
import logging
import numpy as np
from transformers.data.data_collator import (
DataCollatorForSeq2Seq,
default_data_collator,
)
from transformers.utils.dummy_p... | [
"hfutils.loader.DatasetLoader",
"torch.cuda.Stream",
"torch.profiler.profile",
"transformers.data.data_collator.DataCollatorForSeq2Seq",
"matplotlib.pyplot.close",
"hfutils.loader.ModelLoader",
"datasets.concatenate_datasets",
"hfutils.arg_parser.TestArguments",
"torch.cuda.stream",
"hfutils.logge... | [((1403, 1418), 'hfutils.arg_parser.TestArguments', 'TestArguments', ([], {}), '()\n', (1416, 1418), False, 'from hfutils.arg_parser import TestArguments\n'), ((1885, 1958), 'transformers.T5ForConditionalGeneration.from_pretrained', 'T5ForConditionalGeneration.from_pretrained', (['model_args.model_name_or_path'], {}), ... |
#!/usr/local/bin/python3
print("fragments of a large packet that has to be refragmented by reflector")
# |--------|
# |------------------|
# ...
# |------------------|
# |----|
import os
from addr... | [
"os.fork",
"os._exit",
"os.getpid"
] | [((359, 370), 'os.getpid', 'os.getpid', ([], {}), '()\n', (368, 370), False, 'import os\n'), ((1150, 1159), 'os.fork', 'os.fork', ([], {}), '()\n', (1157, 1159), False, 'import os\n'), ((1210, 1221), 'os._exit', 'os._exit', (['(0)'], {}), '(0)\n', (1218, 1221), False, 'import os\n')] |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404, redirect
from django.apps import apps
from django.urls import reverse
from django.views.decorators.csrf import csrf_protect
from order.models import Dish, Order
from menu.models import SubMenu
from order.... | [
"django.shortcuts.render",
"order.forms.PickUpForm",
"order.models.Dish.objects.all",
"order.forms.Order.objects.get",
"order.forms.HomeForm",
"order.models.Dish.objects.create",
"django.apps.apps.get_model",
"menu.models.SubMenu.objects.get"
] | [((484, 511), 'django.apps.apps.get_model', 'apps.get_model', (['"""menu.Menu"""'], {}), "('menu.Menu')\n", (498, 511), False, 'from django.apps import apps\n'), ((533, 563), 'django.apps.apps.get_model', 'apps.get_model', (['"""menu.SubMenu"""'], {}), "('menu.SubMenu')\n", (547, 563), False, 'from django.apps import a... |
#!/usr/bin/env python
import numpy as np
import netCDF4 as nc
import pandas as pd
import multiprocessing
import textwrap
import matplotlib.pyplot as plt
import lhsmdu
import glob
import json
import os
import ast
import shutil
import subprocess
from contextlib import contextmanager
import param_util as pu
import outp... | [
"pandas.read_csv",
"param_util.get_CMT_datablock",
"numpy.array",
"os.cpu_count",
"os.listdir",
"param_util.cmtdatablock2dict",
"subprocess.run",
"netCDF4.Dataset",
"os.path.isdir",
"doctest.testmod",
"os.mkdir",
"pandas.DataFrame",
"glob.glob",
"param_util.build_param_lookup",
"lhsmdu.r... | [((1521, 1568), 'numpy.array', 'np.array', (["[p['bounds'][0] for p in param_props]"], {}), "([p['bounds'][0] for p in param_props])\n", (1529, 1568), True, 'import numpy as np\n'), ((1579, 1626), 'numpy.array', 'np.array', (["[p['bounds'][1] for p in param_props]"], {}), "([p['bounds'][1] for p in param_props])\n", (1... |
import numpy as np
# import matplotlib.pyplot as plt
import pickle
from pathlib import Path
import torch
from google.protobuf import text_format
from second.utils import simplevis
from second.pytorch.train import build_network
from second.protos import pipeline_pb2
from second.utils import config_tool
import time
impor... | [
"numpy.fromfile",
"second.utils.simplevis.draw_box_in_bev",
"cv2.imshow",
"numpy.array",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"pathlib.Path",
"numpy.where",
"second.protos.pipeline_pb2.TrainEvalPipelineConfig",
"numpy.concatenate",
"cv2.waitKey",
"pickle.load",
"second.pytorch... | [((661, 699), 'second.protos.pipeline_pb2.TrainEvalPipelineConfig', 'pipeline_pb2.TrainEvalPipelineConfig', ([], {}), '()\n', (697, 699), False, 'from second.protos import pipeline_pb2\n'), ((2060, 2117), 'torch.tensor', 'torch.tensor', (['anchors'], {'dtype': 'torch.float32', 'device': 'device'}), '(anchors, dtype=tor... |
from django import forms
class PhotoUploadForm(forms.Form):
photo = forms.ImageField()
| [
"django.forms.ImageField"
] | [((74, 92), 'django.forms.ImageField', 'forms.ImageField', ([], {}), '()\n', (90, 92), False, 'from django import forms\n')] |
"""Tests for typing.AnyStr."""
from pytype import file_utils
from pytype.tests import test_base
class AnyStrTest(test_base.TargetPython27FeatureTest):
"""Tests for issues related to AnyStr."""
def testAnyStrFunctionImport(self):
with file_utils.Tempdir() as d:
d.create_file("a.pyi", """
from t... | [
"pytype.file_utils.Tempdir"
] | [((246, 266), 'pytype.file_utils.Tempdir', 'file_utils.Tempdir', ([], {}), '()\n', (264, 266), False, 'from pytype import file_utils\n')] |
# Copyright (c) 2015 Uber Technologies, Inc.
#
# 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, merge, publ... | [
"tchannel.Request",
"textwrap.dedent",
"mock.patch",
"tornado.gen.sleep",
"tchannel.TChannel",
"os.path.realpath",
"tornado.gen.Return",
"tornado.gen.Future",
"pytest.raises",
"tchannel.Response",
"json.load",
"mock.MagicMock"
] | [((1774, 1795), 'tchannel.TChannel', 'TChannel', ([], {'name': '"""test"""'}), "(name='test')\n", (1782, 1795), False, 'from tchannel import TChannel, Request, Response, schemes, errors, thrift\n'), ((2089, 2112), 'tchannel.TChannel', 'TChannel', ([], {'name': '"""server"""'}), "(name='server')\n", (2097, 2112), False,... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import numpy as np
import math
def ClassifyColor( BGR, width, height ): ##分類顏色 (BGR, width, height)
r_threshold = 20 ##r閾值 before 10
b_threshold = 20 ##b閾值 before 10
FortyFive_degree = math.pi / 4 ## 45度
grey_threshold = 10.0 * ... | [
"numpy.ones",
"cv2.erode",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.dilate",
"cv2.waitKey"
] | [((1180, 1199), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (1196, 1199), False, 'import cv2\n'), ((2914, 2937), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2935, 2937), False, 'import cv2\n'), ((1440, 1475), 'cv2.imshow', 'cv2.imshow', (['"""Original frame"""', 'frame'], {}... |
import os
os.system('xdg-open https://www.instagram.com/shubhamg0sai')
| [
"os.system"
] | [((10, 70), 'os.system', 'os.system', (['"""xdg-open https://www.instagram.com/shubhamg0sai"""'], {}), "('xdg-open https://www.instagram.com/shubhamg0sai')\n", (19, 70), False, 'import os\n')] |
from flask import Flask, jsonify, request, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("home.html")
@app.route("/api/<data>")
def api(data):
return jsonify({"message": "Successfully received client request for "+data+"."})
if __name__ == "__main__":
app.run... | [
"flask.render_template",
"flask.jsonify",
"flask.Flask"
] | [((65, 80), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (70, 80), False, 'from flask import Flask, jsonify, request, render_template\n'), ((122, 150), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (137, 150), False, 'from flask import Flask, jsonify, request, ... |
# -*- coding: utf-8 -*-
import codecs
import setuptools
import re
import ast
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('src/icalendar/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
shortdesc = 'iCalendar parser/genera... | [
"codecs.open",
"setuptools.find_packages",
"re.compile"
] | [((92, 130), 're.compile', 're.compile', (['"""__version__\\\\s+=\\\\s+(.*)"""'], {}), "('__version__\\\\s+=\\\\s+(.*)')\n", (102, 130), False, 'import re\n'), ((427, 463), 'codecs.open', 'codecs.open', (['fname'], {'encoding': '"""utf-8"""'}), "(fname, encoding='utf-8')\n", (438, 463), False, 'import codecs\n'), ((175... |
from gusto import *
from firedrake import (FunctionSpace, as_vector,
VectorFunctionSpace,
PeriodicIntervalMesh,
ExtrudedMesh, Constant,
SpatialCoordinate, exp, pi, cos,
Function, conditional, Mesh, sin,
... | [
"firedrake.Mesh",
"firedrake.FunctionSpace",
"firedrake.sin",
"firedrake.Function",
"sys.exit",
"firedrake.petsc.PETSc.Log.begin",
"firedrake.Constant",
"argparse.ArgumentParser",
"firedrake.ExtrudedMesh",
"firedrake.exp",
"firedrake.cos",
"firedrake.sqrt",
"firedrake.PeriodicIntervalMesh",
... | [((735, 752), 'firedrake.petsc.PETSc.Log.begin', 'PETSc.Log.begin', ([], {}), '()\n', (750, 752), False, 'from firedrake.petsc import PETSc\n'), ((763, 858), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Flow over an isolated mountain (hydrostatic)."""', 'add_help': '(False)'}), "(description='F... |
#!/usr/bin/env python
#
# Copyright 2020 Xilinx 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 o... | [
"pyxir.ops.input",
"numpy.ones",
"pyxir.ops.prelu",
"pyxir.graph.layer.xlayer.XLayer",
"pyxir.shapes.TensorShape",
"pyxir.ops.constant",
"numpy.array",
"unittest.SkipTest",
"numpy.testing.assert_array_equal"
] | [((1095, 1189), 'unittest.SkipTest', 'unittest.SkipTest', (['"""Skipping Tensorflow related test because Tensorflow is not available"""'], {}), "(\n 'Skipping Tensorflow related test because Tensorflow is not available')\n", (1112, 1189), False, 'import unittest\n'), ((3407, 3604), 'pyxir.graph.layer.xlayer.XLayer',... |
from __future__ import annotations
from typing import Union, Any
from interfaces import ASerial
from boards import M5StickC
from communication import Sockets, MCUSerial
from boards import WOODManager
class Device(WOODManager):
def __init__(self, config: dict) -> Device:
super().__init__()
self.__... | [
"communication.Sockets",
"communication.MCUSerial",
"boards.M5StickC.serialConfig"
] | [((660, 673), 'communication.Sockets', 'Sockets', (['p', 'h'], {}), '(p, h)\n', (667, 673), False, 'from communication import Sockets, MCUSerial\n'), ((859, 898), 'boards.M5StickC.serialConfig', 'M5StickC.serialConfig', (["config['serial']"], {}), "(config['serial'])\n", (880, 898), False, 'from boards import M5StickC\... |
from graphql import GraphQLField, GraphQLFieldMap, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema
from sqlalchemy.ext.declarative import DeclarativeMeta
from typing import cast, Callable
from .args import (
make_query_args,
make_pk_args,
make_mutation_args,
)
from .helpers import get_pk_colu... | [
"graphql.GraphQLObjectType",
"typing.cast",
"graphql.GraphQLNonNull"
] | [((1269, 1304), 'graphql.GraphQLObjectType', 'GraphQLObjectType', (['"""Query"""', 'queries'], {}), "('Query', queries)\n", (1286, 1304), False, 'from graphql import GraphQLField, GraphQLFieldMap, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema\n'), ((1314, 1354), 'graphql.GraphQLObjectType', 'GraphQLObje... |
'''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
'''
import json
from tqdm import tqdm
import argparse
import clip
import torch
def filter_anno... | [
"argparse.ArgumentParser",
"torch.mean",
"tqdm.tqdm",
"torch.stack",
"clip.load",
"json.load",
"torch.no_grad",
"clip.tokenize",
"json.dump"
] | [((440, 469), 'tqdm.tqdm', 'tqdm', (["anno_dict['categories']"], {}), "(anno_dict['categories'])\n", (444, 469), False, 'from tqdm import tqdm\n'), ((821, 851), 'tqdm.tqdm', 'tqdm', (["anno_dict['annotations']"], {}), "(anno_dict['annotations'])\n", (825, 851), False, 'from tqdm import tqdm\n'), ((1112, 1137), 'tqdm.tq... |
# coding: utf-8
from __future__ import unicode_literals
import os
import time
from twython import Twython
import feedparser
APP_KEY = os.environ.get('APP_KEY')
APP_SECRET = os.environ.get('APP_SECRET')
OAUTH_TOKEN = os.environ.get('OAUTH_TOKEN')
OAUTH_TOKEN_SECRET = os.environ.get('OAUTH_TOKEN_SECRET')
FEED_URL = os... | [
"feedparser.parse",
"os.environ.get",
"twython.Twython",
"time.sleep"
] | [((137, 162), 'os.environ.get', 'os.environ.get', (['"""APP_KEY"""'], {}), "('APP_KEY')\n", (151, 162), False, 'import os\n'), ((176, 204), 'os.environ.get', 'os.environ.get', (['"""APP_SECRET"""'], {}), "('APP_SECRET')\n", (190, 204), False, 'import os\n'), ((219, 248), 'os.environ.get', 'os.environ.get', (['"""OAUTH_... |
##########################################################################
# NSAp - Copyright (C) CEA, 2013
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for details.
##########... | [
"os.path.exists",
"nibabel.save",
"nibabel.load",
"pyfreesurfer.utils.filetools.get_or_check_freesurfer_subjects_dir",
"pyfreesurfer.wrapper.FSWrapper",
"os.path.join",
"numpy.diag",
"os.path.isfile",
"os.path.dirname",
"numpy.loadtxt",
"numpy.linalg.inv",
"numpy.dot",
"os.path.basename",
... | [((2114, 2164), 'pyfreesurfer.utils.filetools.get_or_check_freesurfer_subjects_dir', 'get_or_check_freesurfer_subjects_dir', (['subjects_dir'], {}), '(subjects_dir)\n', (2150, 2164), False, 'from pyfreesurfer.utils.filetools import get_or_check_freesurfer_subjects_dir\n'), ((2563, 2599), 'os.path.join', 'os.path.join',... |
import math
import sys
import time
import torch
import torchvision
import pandas as pd
import networkx
from networkx.algorithms.components.connected import connected_components
import utils
from coco_utils import get_coco_api_from_dataset
from coco_eval import CocoEvaluator
def train_one_epoch(model, optimizer, data... | [
"utils.warmup_lr_scheduler",
"math.isfinite",
"utils.reduce_dict",
"networkx.Graph",
"torch.set_num_threads",
"utils.SmoothedValue",
"torch.cuda.synchronize",
"coco_eval.CocoEvaluator",
"networkx.algorithms.components.connected.connected_components",
"utils.MetricLogger",
"sys.exit",
"pandas.D... | [((2256, 2271), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2269, 2271), False, 'import torch\n'), ((395, 429), 'utils.MetricLogger', 'utils.MetricLogger', ([], {'delimiter': '""" """'}), "(delimiter=' ')\n", (413, 429), False, 'import utils\n'), ((2330, 2353), 'torch.get_num_threads', 'torch.get_num_threads... |
import pornhub
from NHentai import NHentai
def pornhub_search(word1, word2):
keywords = [word1, word2]
client = pornhub.PornHub(keywords)
result = []
for video in client.getVideos(10, page=2):
result.append(video["url"])
result.append(video["name"])
result.append(video["duratio... | [
"pornhub.PornHub",
"NHentai.NHentai"
] | [((122, 147), 'pornhub.PornHub', 'pornhub.PornHub', (['keywords'], {}), '(keywords)\n', (137, 147), False, 'import pornhub\n'), ((470, 479), 'NHentai.NHentai', 'NHentai', ([], {}), '()\n', (477, 479), False, 'from NHentai import NHentai\n'), ((642, 651), 'NHentai.NHentai', 'NHentai', ([], {}), '()\n', (649, 651), False... |
# (c) 2018, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
from __future__ import (absolute_import, division, p... | [
"re.search",
"re.findall",
"ansible.module_utils.six.iteritems",
"re.compile"
] | [((2680, 2703), 're.compile', 're.compile', (['start', 're.M'], {}), '(start, re.M)\n', (2690, 2703), False, 'import re\n'), ((2919, 2955), 're.search', 're.search', (['context_start_re', 'content'], {}), '(context_start_re, content)\n', (2928, 2955), False, 'import re\n'), ((3112, 3152), 're.search', 're.search', (['c... |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | [
"azure.cli.core.commands.client_factory.get_mgmt_service_client"
] | [((664, 715), 'azure.cli.core.commands.client_factory.get_mgmt_service_client', 'get_mgmt_service_client', (['cli_ctx', 'MaintenanceClient'], {}), '(cli_ctx, MaintenanceClient)\n', (687, 715), False, 'from azure.cli.core.commands.client_factory import get_mgmt_service_client\n')] |
#!/usr/bin/env python3
###############################################################################
# Example 3 FAN PWM Control
#
# Copyright (c) 2021 <NAME> https://bokunimo.net/
###############################################################################
# CPU温度が55℃以下に抑えるようにファン速度をPWMで調整... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.PWM",
"RPi.GPIO.setmode"
] | [((983, 1005), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (995, 1005), False, 'from RPi import GPIO\n'), ((1047, 1073), 'RPi.GPIO.setup', 'GPIO.setup', (['port', 'GPIO.OUT'], {}), '(port, GPIO.OUT)\n', (1057, 1073), False, 'from RPi import GPIO\n'), ((1122, 1140), 'RPi.GPIO.PWM', 'GPIO.PWM'... |
"""
In code demo for multiobjective_hartmann
-- <EMAIL>
"""
from dragonfly import load_config_file, multiobjective_maximise_functions
# From current directory
# from multiobjective_hartmann import compute_objectives, num_objectives
from multiobjective_hartmann import hartmann3_by_2_1, hartmann6, hartmann3_by_2_2
... | [
"dragonfly.load_config_file",
"dragonfly.multiobjective_maximise_functions"
] | [((563, 594), 'dragonfly.load_config_file', 'load_config_file', (['"""config.json"""'], {}), "('config.json')\n", (579, 594), False, 'from dragonfly import load_config_file, multiobjective_maximise_functions\n'), ((1194, 1292), 'dragonfly.multiobjective_maximise_functions', 'multiobjective_maximise_functions', (['moo_o... |
# Copyright 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"logging.basicConfig",
"json.dumps",
"http_client.http_jrpc_client.HttpJrpcClient"
] | [((794, 889), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(levelname)s - %(message)s',\n level=logging.INFO)\n", (813, 889), False, 'import logging\n'), ((1116, 1161), 'http_client.http_jrpc_clien... |
#!/usr/bin/env python3
"""
The configuration file
"""
from .core import ColourMapping, Field, RequiredFields
import os
import configparser
from typing import Optional, Dict
import pandas as pd
MODULEPATH = os.path.abspath(os.path.join(__file__, '../../'))
class ConfigException(Exception):
"""
Raised if a... | [
"configparser.ConfigParser",
"pandas.read_csv",
"os.getenv",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"os.path.expanduser"
] | [((227, 259), 'os.path.join', 'os.path.join', (['__file__', '"""../../"""'], {}), "(__file__, '../../')\n", (239, 259), False, 'import os\n'), ((1368, 1395), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1393, 1395), False, 'import configparser\n'), ((831, 866), 'os.path.expanduser', 'os.... |
from setuptools import setup
setup(name='pyccflex',
version='0.2',
description='Python Flexible Code Classifier',
url='https://github.com/mochodek/py-ccflex',
author='',
author_email='',
license='Apache-2.0',
packages=['common', 'prepare'],
install_requires=[
'... | [
"setuptools.setup"
] | [((30, 1002), 'setuptools.setup', 'setup', ([], {'name': '"""pyccflex"""', 'version': '"""0.2"""', 'description': '"""Python Flexible Code Classifier"""', 'url': '"""https://github.com/mochodek/py-ccflex"""', 'author': '""""""', 'author_email': '""""""', 'license': '"""Apache-2.0"""', 'packages': "['common', 'prepare']... |
import spacy
import classy_classification # noqa: F401
from .data import training_data, validation_data
nlp = spacy.blank("en")
nlp.add_pipe("text_categorizer", config={"data": list(training_data.keys()), "cat_type": "zero", "include_sent": True})
print([sent._.cats for sent in nlp(validation_data[0]).sents])
print... | [
"spacy.blank"
] | [((114, 131), 'spacy.blank', 'spacy.blank', (['"""en"""'], {}), "('en')\n", (125, 131), False, 'import spacy\n')] |
# RAiDAuth and RAiDFactory classes
#
# Wrapper classes around the Python Requests library
# to facilitate the creation and updating of RAiDs
#
# Written by <NAME> <<EMAIL>>
#
# Updated 23 Jul 2020
import logging
import requests
from requests.auth import AuthBase
from urllib.parse import quote
import backoff
from .mt_j... | [
"logging.getLogger",
"urllib.parse.quote",
"requests.request",
"backoff.on_exception"
] | [((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((1646, 1766), 'backoff.on_exception', 'backoff.on_exception', (['backoff.expo', '(requests.exceptions.Timeout, requests.exceptions.ConnectionError)'], {'max_tries': '(8)'}), '(backoff.exp... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 17 07:40:39 2019
@author: adela
"""
from PIL import Image
import numpy as np
def smooth(image):
#opens image
image = Image.open('Puppy_project_image.jpg')
#determines width and height of image
w, h = image.size
#creates a new i... | [
"PIL.Image.new",
"PIL.Image.open"
] | [((191, 228), 'PIL.Image.open', 'Image.open', (['"""Puppy_project_image.jpg"""'], {}), "('Puppy_project_image.jpg')\n", (201, 228), False, 'from PIL import Image\n'), ((388, 421), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(w, h)', '"""white"""'], {}), "('RGB', (w, h), 'white')\n", (397, 421), False, 'from PIL impor... |
import sys
sys.setrecursionlimit(10**6)
def main():
input = sys.stdin.readline
N = int(input())
H = list(map(int, input().split()))
c = 0
for h in H:
if h < c:
return 'No'
c = max(c, h-1)
return 'Yes'
if __name__ == '__main__':
print(main())
| [
"sys.setrecursionlimit"
] | [((11, 41), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (32, 41), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-31 18:21
from __future__ import unicode_literals
try:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.contenttypes.models import ContentType
from django.db import DEFAULT_DB_ALIA... | [
"django.contrib.contenttypes.models.ContentType.objects.filter",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.recorder.MigrationRecorder"
] | [((622, 670), 'django.db.migrations.recorder.MigrationRecorder', 'MigrationRecorder', (['connections[DEFAULT_DB_ALIAS]'], {}), '(connections[DEFAULT_DB_ALIAS])\n', (639, 670), False, 'from django.db.migrations.recorder import MigrationRecorder\n'), ((1621, 1736), 'django.db.models.ForeignKey', 'models.ForeignKey', ([],... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest, copy
from frappe.test_runner import make_test_objects
from frappe.core.doctype.version.version import get_diff
class TestVersion(unittest.TestCase):
def test_g... | [
"frappe.core.doctype.version.version.get_diff",
"frappe.get_doc",
"frappe.test_runner.make_test_objects",
"copy.deepcopy"
] | [((352, 390), 'frappe.test_runner.make_test_objects', 'make_test_objects', (['"""Event"""'], {'reset': '(True)'}), "('Event', reset=True)\n", (369, 390), False, 'from frappe.test_runner import make_test_objects\n'), ((405, 445), 'frappe.get_doc', 'frappe.get_doc', (['"""Event"""', 'test_records[0]'], {}), "('Event', te... |
from grafana_api.grafana_face import GrafanaFace
import os
print(os.environ['GRAFANA_HOST'])
# grafana_api = GrafanaFace(protocol='https', auth=os.environ['GRAFANA_API_KEY'], host=os.environ['GRAFANA_HOST'])
grafana_api = GrafanaFace(auth=(os.environ['GRAFANA_USER'], os.environ['GRAFANA_PWD']),protocol='https', host=o... | [
"grafana_api.grafana_face.GrafanaFace"
] | [((223, 351), 'grafana_api.grafana_face.GrafanaFace', 'GrafanaFace', ([], {'auth': "(os.environ['GRAFANA_USER'], os.environ['GRAFANA_PWD'])", 'protocol': '"""https"""', 'host': "os.environ['GRAFANA_HOST']"}), "(auth=(os.environ['GRAFANA_USER'], os.environ['GRAFANA_PWD']),\n protocol='https', host=os.environ['GRAFANA... |
# Generated by Django 3.1.5 on 2021-01-24 20:31
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Session',
fields=[
('id', models.AutoField(... | [
"django.db.models.DateField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((303, 396), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (319, 396), False, 'from django.db import migrations, models\... |
from django.shortcuts import render
from django.http import HttpResponse
from .models import Image
# Create your views here.
def gallery(request):
images = Image.all_images()
return render(request, 'gallery.html', {"images":images})
def search_results(request):
if 'image' in request.GET and request.GET[... | [
"django.shortcuts.render"
] | [((191, 242), 'django.shortcuts.render', 'render', (['request', '"""gallery.html"""', "{'images': images}"], {}), "(request, 'gallery.html', {'images': images})\n", (197, 242), False, 'from django.shortcuts import render\n'), ((851, 898), 'django.shortcuts.render', 'render', (['request', '"""image.html"""', "{'image': ... |
# Copyright 2010-2011 OpenStack Foundation
# 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... | [
"glance.common.crypt.urlsafe_decrypt",
"os.urandom",
"glance.common.utils.image_meta_to_http_headers",
"glance.common.crypt.urlsafe_encrypt"
] | [((1953, 1995), 'glance.common.utils.image_meta_to_http_headers', 'utils.image_meta_to_http_headers', (['metadata'], {}), '(metadata)\n', (1985, 1995), False, 'from glance.common import utils\n'), ((1177, 1190), 'os.urandom', 'os.urandom', (['i'], {}), '(i)\n', (1187, 1190), False, 'import os\n'), ((1296, 1344), 'glanc... |
from django.shortcuts import render
from django.views.generic.list import ListView
from pattern_for.models import pattern_for as prod_list
# Create your views here.
from django.shortcuts import get_object_or_404
from .models import items_cat, name_cat
class ArticleListView(ListView):
model = items_cat
queryset... | [
"django.shortcuts.render",
"pattern_for.models.pattern_for.objects.filter"
] | [((331, 374), 'pattern_for.models.pattern_for.objects.filter', 'prod_list.objects.filter', ([], {'categoy': '"""for_you"""'}), "(categoy='for_you')\n", (355, 374), True, 'from pattern_for.models import pattern_for as prod_list\n'), ((849, 941), 'django.shortcuts.render', 'render', (['request', '"""product_category/inde... |
#np39.py
#39.Zipfの法則
"「単語の出現頻度順位を横軸,その出現頻度を縦軸として,両対数グラフをプロットせよ.」"
cat = 'neko.txt.mecab'#catに格納
with open(cat)as f:
#1文ずつ区切って読み込み
text = f.read().splitlines()
import re
#「\t」と「,」で分割してリスト化
nlist = [re.split("[\t|,]", lines) for lines in text]
catlist = []
for line in nlist:
linelist = []
if line[0] != "EOS"... | [
"collections.Counter",
"re.split",
"numpy.log",
"matplotlib.pyplot.show"
] | [((999, 1009), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1007, 1009), True, 'import matplotlib.pyplot as plt\n'), ((201, 226), 're.split', 're.split', (['"""[\t|,]"""', 'lines'], {}), "('[\\t|,]', lines)\n", (209, 226), False, 'import re\n'), ((976, 997), 'numpy.log', 'np.log', (['f_most_common'], {}), '... |
# -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ 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 r... | [
"psiz.utils.standard_split",
"tensorflow_probability.math.softplus_inverse",
"pathlib.Path.home",
"psiz.keras.Restarter",
"numpy.equal",
"tensorflow.keras.backend.clear_session",
"psiz.keras.callbacks.EarlyStoppingRe",
"tensorflow.keras.losses.CategoricalCrossentropy",
"os.fspath",
"pathlib.Path",... | [((2063, 2094), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': 'small_size'}), "('font', size=small_size)\n", (2069, 2094), True, 'import matplotlib.pyplot as plt\n'), ((2099, 2136), 'matplotlib.pyplot.rc', 'plt.rc', (['"""axes"""'], {'titlesize': 'medium_size'}), "('axes', titlesize=medium_size)\n", (2105... |
import os
import asyncio
import chess
import discord
from discord.ext import commands, tasks
from discord.ext.commands import Context
from cogs.utils.chess_utils import ChessUtils
import berserk
"""
{'type': 'gameState',
'moves': 'g1f3',
'wtime': datetime.datetime(1970, 1, 25, 20, 31, 23, 647000, tzinfo=datetime.t... | [
"chess.command",
"os.getenv",
"berserk.Client",
"chess.Board",
"discord.ext.commands.group",
"cogs.utils.chess_utils.ChessUtils",
"discord.ext.tasks.loop"
] | [((897, 954), 'discord.ext.commands.group', 'commands.group', ([], {'invoke_without_command': '(True)', 'name': '"""chess"""'}), "(invoke_without_command=True, name='chess')\n", (911, 954), False, 'from discord.ext import commands, tasks\n'), ((1101, 1129), 'chess.command', 'chess.command', ([], {'name': '"""import"""'... |
import appdaemon.plugins.hass.hassapi as hass
import random
import globals
class nextBusIntent(hass.Hass):
def initialize(self):
self.sensor = globals.get_arg(self.args,"sensor")
self.textLine = globals.get_arg(self.args,"textLine")
self.Error = globals.get_arg(self.args,"Error")
def ... | [
"globals.get_arg"
] | [((157, 193), 'globals.get_arg', 'globals.get_arg', (['self.args', '"""sensor"""'], {}), "(self.args, 'sensor')\n", (172, 193), False, 'import globals\n'), ((217, 255), 'globals.get_arg', 'globals.get_arg', (['self.args', '"""textLine"""'], {}), "(self.args, 'textLine')\n", (232, 255), False, 'import globals\n'), ((276... |
"""
Finalfusion Vocabulary interface
"""
import abc
import struct
from typing import List, Optional, Dict, Tuple, Iterable, Any, Union, BinaryIO
from ffp.io import _write_binary, _read_binary
class Vocab(abc.ABC):
"""
Finalfusion vocabulary interface.
Vocabs provide at least a simple string to index map... | [
"struct.calcsize",
"ffp.io._read_binary",
"ffp.io._write_binary"
] | [((3284, 3305), 'struct.calcsize', 'struct.calcsize', (['"""<Q"""'], {}), "('<Q')\n", (3299, 3305), False, 'import struct\n'), ((3331, 3352), 'struct.calcsize', 'struct.calcsize', (['"""<I"""'], {}), "('<I')\n", (3346, 3352), False, 'import struct\n'), ((3843, 3875), 'ffp.io._write_binary', '_write_binary', (['file', '... |
# helper function that are used by the settings for multidomain
#
import numpy as np
import pickle
import sys
import struct
import scipy.stats
def load_mesh(fiber_file, sampling_stride_z, rank_no):
# get the mesh nodes, either from a .bin file or a python pickle file
if ".bin" in fiber_file:
# data input from... | [
"numpy.sqrt",
"pickle.load",
"numpy.inner",
"numpy.array",
"struct.unpack",
"numpy.linalg.norm"
] | [((6831, 6869), 'numpy.array', 'np.array', (['fiber_data[0][z_index_fiber]'], {}), '(fiber_data[0][z_index_fiber])\n', (6839, 6869), True, 'import numpy as np\n'), ((6883, 6941), 'numpy.array', 'np.array', (['fiber_data[(n_fibers_x - 1) // 2][z_index_fiber]'], {}), '(fiber_data[(n_fibers_x - 1) // 2][z_index_fiber])\n'... |
"""Allow null users in the event table
Revision ID: a96ca1dce4d5
Revises: <PASSWORD>
Create Date: 2018-02-14 13:15:17.281694
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a96ca1dce4d5'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def... | [
"sqlalchemy.VARCHAR"
] | [((398, 419), 'sqlalchemy.VARCHAR', 'sa.VARCHAR', ([], {'length': '(64)'}), '(length=64)\n', (408, 419), True, 'import sqlalchemy as sa\n'), ((536, 557), 'sqlalchemy.VARCHAR', 'sa.VARCHAR', ([], {'length': '(64)'}), '(length=64)\n', (546, 557), True, 'import sqlalchemy as sa\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: NetworkRanger
# Date: 2019/8/11 1:51 PM
# models.py
from django.db import models
from django import forms
class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField()
class Me... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.CharField"
] | [((206, 238), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (222, 238), False, 'from django.db import models\n'), ((250, 268), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (266, 268), False, 'from django.db import models\n'), ((285, 307), '... |
# -*- coding: utf-8 -*-
# @author Wendy
# @created on 2021/1/13
import scrapy
from scrapy.selector import Selector
import helper
# https://m.douban.com/rexxar/api/v2/tv/27157689?ck=lvDn&for_mobile=1
# https://m.douban.com/rexxar/api/v2/tv/27157689/credits
# https://m.douban.com/rexxar/api/v2/tv/27157689/rating?ck=lvDn... | [
"scrapy.selector.Selector",
"helper.read_json",
"helper.read_mock"
] | [((1599, 1631), 'helper.read_mock', 'helper.read_mock', (['"""movie_detail"""'], {}), "('movie_detail')\n", (1615, 1631), False, 'import helper\n'), ((1647, 1666), 'scrapy.selector.Selector', 'Selector', ([], {'text': 'body'}), '(text=body)\n', (1655, 1666), False, 'from scrapy.selector import Selector\n'), ((458, 488)... |
import time
def timeit(method):
""" Get the time it takes for a method to run.
Args:
method (function): The function to time.
Returns:
Method wrapped with an operation to time it.
"""
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te... | [
"time.time"
] | [((261, 272), 'time.time', 'time.time', ([], {}), '()\n', (270, 272), False, 'import time\n'), ((323, 334), 'time.time', 'time.time', ([], {}), '()\n', (332, 334), False, 'import time\n')] |
from openstatesapi.jurisdiction import make_jurisdiction
J = make_jurisdiction('mt')
J.url = 'http://montana.gov'
| [
"openstatesapi.jurisdiction.make_jurisdiction"
] | [((62, 85), 'openstatesapi.jurisdiction.make_jurisdiction', 'make_jurisdiction', (['"""mt"""'], {}), "('mt')\n", (79, 85), False, 'from openstatesapi.jurisdiction import make_jurisdiction\n')] |
# Serial Port exceptions
# (c) www.xanthium.in
import serial
try:
SerialObj = serial.Serial('COM17',9600) # open the Serial Port
# /dev/ttyUSBx format on Linux
#
# Eg /dev/ttyUSB0
... | [
"serial.Serial"
] | [((84, 112), 'serial.Serial', 'serial.Serial', (['"""COM17"""', '(9600)'], {}), "('COM17', 9600)\n", (97, 112), False, 'import serial\n')] |
import os
import random
import pathlib
import shutil
import glob
import cv2
import numpy as np
def load_name_images(image_path_pattern):
name_images = []
# 지정한 Path Pattern에 일치하는 파일 얻기
image_paths = glob.glob(image_path_pattern)
# 파일별로 읽기
for image_path in image_paths:
path = pathlib.Path(i... | [
"cv2.imwrite",
"random.shuffle",
"cv2.flip",
"pathlib.Path",
"cv2.threshold",
"os.path.splitext",
"os.path.join",
"os.rmdir",
"os.path.isdir",
"glob.glob",
"os.mkdir",
"cv2.GaussianBlur",
"os.walk"
] | [((212, 241), 'glob.glob', 'glob.glob', (['image_path_pattern'], {}), '(image_path_pattern)\n', (221, 241), False, 'import glob\n'), ((1643, 1675), 'os.walk', 'os.walk', (['dir_path'], {'topdown': '(False)'}), '(dir_path, topdown=False)\n', (1650, 1675), False, 'import os\n'), ((2740, 2769), 'glob.glob', 'glob.glob', (... |
# Generated by Django 2.2.13 on 2020-11-05 01:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('jobs', '0001_move_jobs'),
('releases', '0002_add_release_events'),
]
operations = [
migrations.Add... | [
"django.db.models.ForeignKey"
] | [((407, 540), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""releases"""', 'to': '"""jobs.JobLog"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, related_name='releases... |
# Copyright 2014 OpenStack Foundation
# Copyright 2014 Mirantis 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 ... | [
"os.urandom",
"sahara.openstack.common.db.sqlalchemy.utils.get_table"
] | [((2192, 2225), 'sahara.openstack.common.db.sqlalchemy.utils.get_table', 'db_utils.get_table', (['engine', 'table'], {}), '(engine, table)\n', (2210, 2225), True, 'from sahara.openstack.common.db.sqlalchemy import utils as db_utils\n'), ((2481, 2514), 'sahara.openstack.common.db.sqlalchemy.utils.get_table', 'db_utils.g... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from copy import deepcopy
from collections import Counter
from rlpytorch import Mod... | [
"torch.nn.Softmax",
"torch.nn.LeakyReLU",
"trunk.MiniRTSNet",
"torch.nn.Linear",
"copy.deepcopy",
"trunk.MiniRTSNet.get_define_args"
] | [((850, 866), 'trunk.MiniRTSNet', 'MiniRTSNet', (['args'], {}), '(args)\n', (860, 866), False, 'from trunk import MiniRTSNet\n'), ((1167, 1213), 'torch.nn.Linear', 'nn.Linear', (['linear_in_dim', "params['num_action']"], {}), "(linear_in_dim, params['num_action'])\n", (1176, 1213), True, 'import torch.nn as nn\n'), ((1... |
from inspect import Signature, Parameter
class Descriptor:
def __init__(self, name):
self.name = name
def __set__(self, instance, val):
print("setting %s to %s" % (self.name, val))
instance.__dict__[self.name] = val
def __delete(self, instance):
print("deleting %s from ins... | [
"inspect.Parameter"
] | [((1064, 1109), 'inspect.Parameter', 'Parameter', (['n', 'Parameter.POSITIONAL_OR_KEYWORD'], {}), '(n, Parameter.POSITIONAL_OR_KEYWORD)\n', (1073, 1109), False, 'from inspect import Signature, Parameter\n')] |
#!/usr/bin/env python
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
import re
import subprocess
import sys
import click
from babel.dates impo... | [
"subprocess.check_output",
"click.argument",
"re.escape",
"subprocess.check_call",
"click.option",
"click.style",
"babel.dates.format_date",
"click.echo",
"os.path.dirname",
"packaging.version.Version",
"sys.exit",
"re.sub",
"click.command",
"re.search"
] | [((5297, 5312), 'click.command', 'click.command', ([], {}), '()\n', (5310, 5312), False, 'import click\n'), ((5314, 5355), 'click.argument', 'click.argument', (['"""version"""'], {'required': '(False)'}), "('version', required=False)\n", (5328, 5355), False, 'import click\n'), ((5357, 5455), 'click.option', 'click.opti... |
# -*- coding: utf-8 -*-
from pyfr.backends.base.kernels import ComputeMetaKernel
from pyfr.polys import get_polybasis
from pyfr.solvers.baseadvec import BaseAdvectionElements
class BaseAdvectionDiffusionElements(BaseAdvectionElements):
@property
def _scratch_bufs(self):
bufs = {'scal_fpts', 'vect_fpt... | [
"pyfr.backends.base.kernels.ComputeMetaKernel"
] | [((2907, 2930), 'pyfr.backends.base.kernels.ComputeMetaKernel', 'ComputeMetaKernel', (['muls'], {}), '(muls)\n', (2924, 2930), False, 'from pyfr.backends.base.kernels import ComputeMetaKernel\n'), ((3537, 3560), 'pyfr.backends.base.kernels.ComputeMetaKernel', 'ComputeMetaKernel', (['muls'], {}), '(muls)\n', (3554, 3560... |
"""Base Test Design for LocalEGA Inbox Scenario 1.
For this test we are aiming to upload an encrypted file.
Scenario 1: Upload an encrypted file and disconnect.
"""
import os
import paramiko
from ruamel.yaml import YAML
from locust import Locust, TaskSet, task
from common import log_format, CONFIG_PATH
LOG = log_for... | [
"paramiko.SFTPClient.from_transport",
"common.log_format",
"paramiko.AutoAddPolicy",
"paramiko.RSAKey.from_private_key_file",
"os.path.splitext",
"paramiko.Transport",
"ruamel.yaml.YAML",
"paramiko.SSHClient",
"os.path.expanduser"
] | [((313, 339), 'common.log_format', 'log_format', (['"""test_inbox_1"""'], {}), "('test_inbox_1')\n", (323, 339), False, 'from common import log_format, CONFIG_PATH\n'), ((494, 514), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (512, 514), False, 'import paramiko\n'), ((527, 593), 'paramiko.RSAKey.from_... |
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import string
from nltk.stem import WordNetLemmatizer
class NlpPreprocessing:
"""
This class contains methods to pre process text to prepare them for NLP
"""
def __init__(self,text):
"""
:type text: st... | [
"nltk.stem.WordNetLemmatizer",
"nltk.corpus.stopwords.words"
] | [((636, 655), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (653, 655), False, 'from nltk.stem import WordNetLemmatizer\n'), ((944, 970), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (959, 970), False, 'from nltk.corpus import stopwords\n')] |
from wtpy import WtEngine,EngineType
from Strategies.DualThrust import StraDualThrust
if __name__ == "__main__":
#创建一个运行环境,并加入策略
env = WtEngine(EngineType.ET_CTA)
env.init('./common/', "config.yaml",
contractfile="okex_tickers.json",
sessionfile="btc_sessions.json",
commfi... | [
"wtpy.WtEngine",
"Strategies.DualThrust.StraDualThrust"
] | [((149, 176), 'wtpy.WtEngine', 'WtEngine', (['EngineType.ET_CTA'], {}), '(EngineType.ET_CTA)\n', (157, 176), False, 'from wtpy import WtEngine, EngineType\n'), ((397, 521), 'Strategies.DualThrust.StraDualThrust', 'StraDualThrust', ([], {'name': '"""pydt_okex"""', 'code': '"""OKEX.BTC-USDT"""', 'barCnt': '(50)', 'period... |
from ctypes import *
import os
if os.name == 'nt':
dllpath = os.path.dirname(os.path.abspath(__file__)) + "/SuffixTreePyBinding.dll"
#dllpath = os.path.dirname(os.path.abspath(__file__)) + "/../../x64/Release/SuffixTreePyBinding.dll"
else:
dllpath = os.path.dirname(os.path.abspath(__file__)) + "/libSuffixT... | [
"os.path.abspath",
"zlib.decompress",
"zlib.compress"
] | [((3419, 3439), 'zlib.compress', 'zlib.compress', (['b1', '(3)'], {}), '(b1, 3)\n', (3432, 3439), False, 'import zlib\n'), ((3631, 3650), 'zlib.decompress', 'zlib.decompress', (['b1'], {}), '(b1)\n', (3646, 3650), False, 'import zlib\n'), ((82, 107), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)... |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.utils import timezone
import datetime
import time
from django import forms
from erp_app.models import Expenses
from django.template import RequestContext, loader
from django.contrib import messages
from erp_app.models import *... | [
"django.shortcuts.render",
"erp_app.models.Expenses.objects.all",
"django.http.HttpResponseRedirect",
"django.template.RequestContext",
"datetime.datetime.now",
"erp_app.models.Expenses"
] | [((785, 954), 'django.template.RequestContext', 'RequestContext', (['request', "{'list_of_expenses': list_of_expenses, 'list_of_orders': list_of_orders,\n 'empty_orders': empty_orders, 'empty_expenses': empty_expenses}"], {}), "(request, {'list_of_expenses': list_of_expenses,\n 'list_of_orders': list_of_orders, '... |
import discord
from discord.ext import commands
class User_Value(commands.Cog):
"""ユーザーのスコアに関するコマンドなどが入っています"""
def __init__(self, bot):
self.bot = bot
self.db = self.bot.db
@commands.is_owner()
@commands.group(description='ユーザースコアを操作します')
async def score(self, ctx):
if no... | [
"discord.ext.commands.group",
"discord.AllowedMentions.none",
"discord.ext.commands.Cog.listener",
"discord.ext.commands.is_owner"
] | [((206, 225), 'discord.ext.commands.is_owner', 'commands.is_owner', ([], {}), '()\n', (223, 225), False, 'from discord.ext import commands\n'), ((231, 274), 'discord.ext.commands.group', 'commands.group', ([], {'description': '"""ユーザースコアを操作します"""'}), "(description='ユーザースコアを操作します')\n", (245, 274), False, 'from discord.e... |
# -*- coding:utf-8 -*-
import numpy as np
def dropout(x, level):
if level < 0 or level >= 1:
raise ValueError("Dropout Level must be in interval[0, 1)")
retain_prob = 1. - level
random_tensor = np.random.binomial(n = 1, p = retain_prob, size = x.shape)
print(random_tensor)
x *= random_te... | [
"numpy.array",
"numpy.random.binomial"
] | [((391, 446), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9]'], {'dtype': 'np.float32'}), '([1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.float32)\n', (399, 446), True, 'import numpy as np\n'), ((217, 269), 'numpy.random.binomial', 'np.random.binomial', ([], {'n': '(1)', 'p': 'retain_prob', 'size': 'x.shape'}), '(n=... |
import invoke
import docs
import installers
import shims
namespace = invoke.Collection(docs, installers, shims)
| [
"invoke.Collection"
] | [((71, 113), 'invoke.Collection', 'invoke.Collection', (['docs', 'installers', 'shims'], {}), '(docs, installers, shims)\n', (88, 113), False, 'import invoke\n')] |
import copy
import sys
import httplib2
from apiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
from oauth2client.client import AccessTokenRefreshError
# To run: rollout_update package_name json_credentials_path
def main():
PACKAGE_NAME = sys.argv[1]
TRACK = (sys.ar... | [
"httplib2.Http",
"oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name",
"apiclient.discovery.build",
"copy.deepcopy"
] | [((401, 526), 'oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name', 'ServiceAccountCredentials.from_json_keyfile_name', (['sys.argv[2]'], {'scopes': '"""https://www.googleapis.com/auth/androidpublisher"""'}), "(sys.argv[2], scopes=\n 'https://www.googleapis.com/auth/androidpublisher')\n", ... |
from argparse import ArgumentParser
from argparse import FileType as ArgFileType
from base64 import b64encode
from hashlib import sha1
from json import loads as load_json
from random import uniform as randfloat
from time import localtime
from time import sleep
from time import time as time_sec
from requests import Ses... | [
"argparse.FileType",
"random.uniform",
"requests.Session",
"argparse.ArgumentParser",
"time.localtime",
"time.time"
] | [((658, 667), 'requests.Session', 'Session', ([], {}), '()\n', (665, 667), False, 'from requests import Session\n'), ((1398, 1509), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Get data about you at hfut"""', 'epilog': '"""https://github.com/RayAlto/hfut-crawler"""'}), "(description='Get data a... |
# -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
#
# 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
#... | [
"mock.patch.object",
"hpOneView.resources.fc_sans.endpoints.Endpoints",
"hpOneView.connection.connection"
] | [((1042, 1086), 'mock.patch.object', 'mock.patch.object', (['ResourceClient', '"""get_all"""'], {}), "(ResourceClient, 'get_all')\n", (1059, 1086), False, 'import mock\n'), ((1265, 1309), 'mock.patch.object', 'mock.patch.object', (['ResourceClient', '"""get_all"""'], {}), "(ResourceClient, 'get_all')\n", (1282, 1309), ... |