code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from pathlib import Path
def read(filename='in'):
file_path = Path(__file__).parent / filename
with file_path.open('r') as file:
return read_lines(file.readlines())
def read_lines(lines):
cells = {}
for y in range(len(lines)):
line = lines[y].strip()
for x in range(len(line))... | [
"pathlib.Path"
] | [((68, 82), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (72, 82), False, 'from pathlib import Path\n')] |
## Copyright 2014 Cognitect. 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... | [
"itertools.islice",
"transit.pyversion.imap"
] | [((844, 869), 'itertools.islice', 'itertools.islice', (['i', '(0)', 'n'], {}), '(i, 0, n)\n', (860, 869), False, 'import itertools\n'), ((729, 739), 'transit.pyversion.imap', 'imap', (['f', 'i'], {}), '(f, i)\n', (733, 739), False, 'from transit.pyversion import imap, izip\n')] |
import pandas as pd
import matplotlib.pyplot as plt
#한글 폰트 오류 제거
from matplotlib import font_manager,rc
font_path ="D:/5674-833_4th/part4/malgun.ttf"
font_name = font_manager.FontProperties(fname=font_path).get_name()
rc('font',family = font_name)
df = pd.read_excel('D:/5674-833_4th/part4/시도별 전출입 인구수.xlsx',engine = 'o... | [
"matplotlib.font_manager.FontProperties",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.rc",
"pandas.read_excel",
"matplotlib.pyplot.show"
] | [((218, 246), 'matplotlib.rc', 'rc', (['"""font"""'], {'family': 'font_name'}), "('font', family=font_name)\n", (220, 246), False, 'from matplotlib import font_manager, rc\n'), ((254, 342), 'pandas.read_excel', 'pd.read_excel', (['"""D:/5674-833_4th/part4/시도별 전출입 인구수.xlsx"""'], {'engine': '"""openpyxl"""', 'header': '(... |
import os
import time
import pyautogui
# from voiceassmain import play_voice_assistant_speech
from vacore import VACore
# based on EnjiRouz realization https://github.com/EnjiRouz/Voice-Assistant-App/blob/master/app.py
# функция на старте
def start(core: VACore):
manifest = {
"name": "Википедия (поиск)"... | [
"traceback.print_exc",
"wikipediaapi.Wikipedia"
] | [((658, 686), 'wikipediaapi.Wikipedia', 'wikipediaapi.Wikipedia', (['"""ru"""'], {}), "('ru')\n", (680, 686), False, 'import wikipediaapi\n'), ((2009, 2030), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (2028, 2030), False, 'import traceback\n')] |
# Django
from django.urls import include, path
# Django REST Framework
from rest_framework.routers import DefaultRouter
# Views
from .views import tasks as task_views
router = DefaultRouter()
router.register(r'tasks', task_views.TaskViewSet, basename='task')
urlpatterns = [
path('', include(router.urls))
]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((179, 194), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (192, 194), False, 'from rest_framework.routers import DefaultRouter\n'), ((292, 312), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (299, 312), False, 'from django.urls import include, path\n')] |
import importlib.metadata
import logging
import os
import shutil
from typing import Dict, Any, List
import click
from sqlalchemy import text
from dbd.log.dbd_exception import DbdException
from dbd.config.dbd_profile import DbdProfile
from dbd.config.dbd_project import DbdProject
from dbd.executors.model_executor impo... | [
"logging.getLogger",
"dbd.log.dbd_logger.setup_logging",
"click.argument",
"os.path.exists",
"sqlalchemy.text",
"click.group",
"click.option",
"os.path.join",
"dbd.executors.model_executor.ModelExecutor",
"shutil.copytree",
"os.path.dirname",
"click.echo",
"dbd.log.dbd_exception.DbdException... | [((412, 439), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (429, 439), False, 'import logging\n'), ((459, 484), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (474, 484), False, 'import os\n'), ((1787, 1827), 'click.group', 'click.group', ([], {'invoke_without... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import logging
ENV_VAR_ROOT = "IG_SERVICE"
CONFIG_FILE_NAME = "trading_ig_config.py"
logger = logging.getLogger(__name__)
class ConfigEnvVar(object):
def __init__(self, env_var_base):
self.ENV_VAR_BASE = env_var_base
def _env_var(self, key):
... | [
"logging.getLogger",
"os.environ.get"
] | [((152, 179), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (169, 179), False, 'import logging\n'), ((470, 508), 'os.environ.get', 'os.environ.get', (['env_var', 'default_value'], {}), '(env_var, default_value)\n', (484, 508), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
episode, season, disc, episode_count, season_count and episode_details properties
"""
import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
fr... | [
"rebulk.Rebulk",
"rebulk.utils.is_iterable",
"rebulk.RenameMatch",
"collections.defaultdict",
"copy.copy",
"rebulk.match.Match"
] | [((25216, 25247), 'rebulk.RenameMatch', 'RenameMatch', (['"""absolute_episode"""'], {}), "('absolute_episode')\n", (25227, 25247), False, 'from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch\n'), ((20193, 20221), 'rebulk.RenameMatch', 'RenameMatch', (['"""episode_count"""'], {}), "('episode_count')\n... |
import flask
import functools
import bs4
import urllib.parse
from .. import auth
from .. import themes
from .. import settings
INVALID_PERMISSIONS_FLASH_MESSAGE = "Sorry, you don't have permission to view that page."
def checkForSession():
if "uid" in flask.session:
session = auth.validateSession(flask.se... | [
"flask.flash",
"flask.redirect",
"flask.render_template_string",
"bs4.BeautifulSoup",
"functools.update_wrapper"
] | [((526, 546), 'flask.redirect', 'flask.redirect', (['path'], {}), '(path)\n', (540, 546), False, 'import flask\n'), ((4194, 4379), 'flask.render_template_string', 'flask.render_template_string', (['template', '*args'], {'pageTitle': 'pageTitle', 'pageNumber': 'pageNumber', 'pageCount': 'pageCount', 'nextPageExists': 'n... |
#!/usr/bin/env python3
# This is bot coded by <NAME> and used for educational purposes only
# https://github.com/AbhijithNT
# Copyright <NAME>
# Thank you https://github.com/pyrogram/pyrogram
from pyrogram.types import (
InlineKeyboardMarkup,
InlineKeyboardButton
)
def server_select():
upload_selection =... | [
"pyrogram.types.InlineKeyboardButton",
"pyrogram.types.InlineKeyboardMarkup"
] | [((1111, 1149), 'pyrogram.types.InlineKeyboardMarkup', 'InlineKeyboardMarkup', (['upload_selection'], {}), '(upload_selection)\n', (1131, 1149), False, 'from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton\n'), ((345, 408), 'pyrogram.types.InlineKeyboardButton', 'InlineKeyboardButton', (['"""transfer.s... |
import pickle
from collections import OrderedDict
from datetime import datetime
from .chunk import Chunk
from .review import Review
from .tokenizer import LineTokenizer
from .utils import norm_path
from .database.snippet import maybe_init, Snippet as DataSnippet
class Snippet(object):
def __init__(self, snippet... | [
"pickle.dumps",
"pickle.loads",
"collections.OrderedDict",
"datetime.datetime.now"
] | [((955, 968), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (966, 968), False, 'from collections import OrderedDict\n'), ((4455, 4508), 'pickle.dumps', 'pickle.dumps', (['self.chunk_ids', 'pickle.HIGHEST_PROTOCOL'], {}), '(self.chunk_ids, pickle.HIGHEST_PROTOCOL)\n', (4467, 4508), False, 'import pickle\n'... |
# Copyright (c) 2015 Presslabs SRL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
"rest_framework.utils.urls.replace_query_param",
"rest_framework.utils.urls.remove_query_param",
"rest_framework.response.Response"
] | [((1158, 1218), 'rest_framework.utils.urls.replace_query_param', 'replace_query_param', (['url', 'self.page_query_param', 'page_number'], {}), '(url, self.page_query_param, page_number)\n', (1177, 1218), False, 'from rest_framework.utils.urls import replace_query_param, remove_query_param\n'), ((2471, 2502), 'rest_fram... |
import os
import fecfile
import json
import csv
import sys
from settings import RAW_ELECTRONIC_DIR, MASTER_HEADER_ROW, HEADER_DUMP_FILE
START_YEAR = 2019
ERROR_HEADERS = ['path', 'error', ]
def readfile(filepath, writer):
filename = os.path.basename(filepath)
filename = filename.replace(".fec", "")
f... | [
"csv.DictWriter",
"fecfile.parse_line",
"fecfile.parse_header",
"os.path.join",
"os.path.basename",
"os.walk"
] | [((244, 270), 'os.path.basename', 'os.path.basename', (['filepath'], {}), '(filepath)\n', (260, 270), False, 'import os\n'), ((555, 586), 'fecfile.parse_header', 'fecfile.parse_header', (['firstline'], {}), '(firstline)\n', (575, 586), False, 'import fecfile\n'), ((1200, 1239), 'fecfile.parse_line', 'fecfile.parse_line... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('collector.views',
url(r'^blob404/$', 'blob404'),
url(r'^deleted/$', 'deleted'),
url(r'^$', 'create'),
url(r'^(?P<uid>\w+)/$', 'delete'),
)
# Local Variables:
# indent-tabs-mode: nil
# End:
# vim: ai et... | [
"django.conf.urls.defaults.url"
] | [((124, 152), 'django.conf.urls.defaults.url', 'url', (['"""^blob404/$"""', '"""blob404"""'], {}), "('^blob404/$', 'blob404')\n", (127, 152), False, 'from django.conf.urls.defaults import patterns, url\n'), ((159, 187), 'django.conf.urls.defaults.url', 'url', (['"""^deleted/$"""', '"""deleted"""'], {}), "('^deleted/$',... |
"""
categories: Modules,array
description: Array deletion not implemented
cause: Unknown
workaround: Unknown
"""
import array
a = array.array('b', (1, 2, 3))
del a[1]
print(a)
| [
"array.array"
] | [((130, 157), 'array.array', 'array.array', (['"""b"""', '(1, 2, 3)'], {}), "('b', (1, 2, 3))\n", (141, 157), False, 'import array\n')] |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Time : 2019/9/17 15:07
@Author : <NAME>
@FileName: models.py
@GitHub : https://github.com/cRiii
"""
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from jaysblog.extensions import db
from flask_login i... | [
"jaysblog.extensions.db.String",
"jaysblog.extensions.db.Column",
"jaysblog.extensions.db.ForeignKey",
"jaysblog.extensions.db.Enum",
"jaysblog.extensions.db.relationship",
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((408, 455), 'jaysblog.extensions.db.Column', 'db.Column', (['db.DateTime'], {'default': 'datetime.utcnow'}), '(db.DateTime, default=datetime.utcnow)\n', (417, 455), False, 'from jaysblog.extensions import db\n'), ((474, 547), 'jaysblog.extensions.db.Column', 'db.Column', (['db.DateTime'], {'default': 'datetime.utcnow... |
#!/usr/bin/env python
# coding: utf-8
import yaml
import json
import sys
import os
sys.path.append('../venv/lib/python3.5/site-packages')
from elasticsearch import Elasticsearch
sys.path.append('../telemanom')
class Config:
'''Loads parameters from config.yaml into global object'''
def __init__(self, path... | [
"os.path.isfile",
"sys.path.append"
] | [((85, 139), 'sys.path.append', 'sys.path.append', (['"""../venv/lib/python3.5/site-packages"""'], {}), "('../venv/lib/python3.5/site-packages')\n", (100, 139), False, 'import sys\n'), ((181, 212), 'sys.path.append', 'sys.path.append', (['"""../telemanom"""'], {}), "('../telemanom')\n", (196, 212), False, 'import sys\n... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | [
"pulumi.InvokeOptions",
"pulumi.set",
"pulumi.runtime.invoke",
"pulumi.get"
] | [((755, 795), 'pulumi.set', 'pulumi.set', (['__self__', '"""default"""', 'default'], {}), "(__self__, 'default', default)\n", (765, 795), False, 'import pulumi\n'), ((913, 943), 'pulumi.set', 'pulumi.set', (['__self__', '"""id"""', 'id'], {}), "(__self__, 'id', id)\n", (923, 943), False, 'import pulumi\n'), ((1070, 110... |
'''
Flask Application Config
'''
import os
from logging.config import dictConfig
BASEDIR = os.path.abspath(os.path.dirname(__file__))
class Config:
'''공통 Config'''
JWT_SECRET_KEY = os.environ.get('FLASK_JWT_SECRET_KEY')
# test only
TEST_ACCESS_TOKEN = os.environ.get('FLASK_TEST_ACCESS_TOKEN')
ADM... | [
"os.path.dirname",
"os.environ.get",
"logging.config.dictConfig"
] | [((108, 133), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (123, 133), False, 'import os\n'), ((192, 230), 'os.environ.get', 'os.environ.get', (['"""FLASK_JWT_SECRET_KEY"""'], {}), "('FLASK_JWT_SECRET_KEY')\n", (206, 230), False, 'import os\n'), ((271, 312), 'os.environ.get', 'os.environ.ge... |
from django.db import models
from django.core.validators import RegexValidator, ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from smart_selects.db_fields import ChainedForeignKey, ChainedManyToManyField
from ordered_model.models import OrderedModel
... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.utils.translation.ugettext_lazy",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"smart_selects.db_fields.ChainedForeignKey",
"django.core.validators.RegexValidator",
"django.db.models... | [((388, 433), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(False)'}), '(max_length=100, blank=False)\n', (404, 433), False, 'from django.db import models\n'), ((453, 507), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'null': '(True)', 'blank'... |
from django import forms
from .models import Connection, KoboUser, KoboData
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db.models import Q
class ConnectionForm(forms.ModelForm):
class Meta:
model = Connection
exclude = []
widgets = {
'auth_pass':... | [
"django.contrib.admin.widgets.FilteredSelectMultiple",
"django.db.models.Q",
"django.forms.PasswordInput"
] | [((321, 342), 'django.forms.PasswordInput', 'forms.PasswordInput', ([], {}), '()\n', (340, 342), False, 'from django import forms\n'), ((602, 653), 'django.contrib.admin.widgets.FilteredSelectMultiple', 'FilteredSelectMultiple', (['"""Surveys"""'], {'is_stacked': '(False)'}), "('Surveys', is_stacked=False)\n", (624, 65... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | [
"pyangbind.lib.yangtypes.YANGDynClass",
"__builtin__.property",
"pyangbind.lib.yangtypes.RestrictedClassType",
"pyangbind.lib.yangtypes.YANGListType"
] | [((36786, 36821), '__builtin__.property', '__builtin__.property', (['_get_lsp_name'], {}), '(_get_lsp_name)\n', (36806, 36821), False, 'import __builtin__\n'), ((36842, 36884), '__builtin__.property', '__builtin__.property', (['_get_lsp_instance_id'], {}), '(_get_lsp_instance_id)\n', (36862, 36884), False, 'import __bu... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... | [
"logging.getLogger",
"horovod.torch.broadcast_optimizer_state",
"horovod.torch.allreduce",
"torch.tensor",
"vega.common.ClassFactory.register",
"vega.is_torch_backend"
] | [((791, 818), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (808, 818), False, 'import logging\n'), ((822, 863), 'vega.common.ClassFactory.register', 'ClassFactory.register', (['ClassType.CALLBACK'], {}), '(ClassType.CALLBACK)\n', (843, 863), False, 'from vega.common import ClassFactory,... |
"""
<NAME>
Skeleton of https://github.com/pyhoneybot/honeybot/
"""
import time
import os
import socket
directory = "irc"
if not os.path.exists(directory):
os.makedirs(directory)
target = open(os.path.join(directory, "log.txt"), "w")
def message_checker(msgLine):
sendvar = ""
global mute
mute = False... | [
"os.path.exists",
"os.makedirs",
"socket.socket",
"os.path.join",
"time.sleep"
] | [((1215, 1230), 'socket.socket', 'socket.socket', ([], {}), '()\n', (1228, 1230), False, 'import socket\n'), ((1782, 1795), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (1792, 1795), False, 'import time\n'), ((130, 155), 'os.path.exists', 'os.path.exists', (['directory'], {}), '(directory)\n', (144, 155), False,... |
# coding: utf-8
"""
Xenia Python Client Library
Python Client Library to interact with the Xenia API. # noqa: E501
The version of the OpenAPI document: v2.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from xenia_python_client_library.configur... | [
"six.iteritems",
"xenia_python_client_library.configuration.Configuration"
] | [((4145, 4178), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (4158, 4178), False, 'import six\n'), ((1417, 1432), 'xenia_python_client_library.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1430, 1432), False, 'from xenia_python_client_library.configuratio... |
################################################################################
# Create a Registration with the UI for a Role.
# Each module's aushadha.py is screened for this
#
# Each Class is registered for a Role in UI
# These can be used to generate Role based UI elements later.
#
# As of now string base role... | [
"AuShadha.apps.ui.ui.ui.register"
] | [((564, 599), 'AuShadha.apps.ui.ui.ui.register', 'UI.register', (['"""RegistryApp"""', 'Chapter'], {}), "('RegistryApp', Chapter)\n", (575, 599), True, 'from AuShadha.apps.ui.ui import ui as UI\n'), ((600, 636), 'AuShadha.apps.ui.ui.ui.register', 'UI.register', (['"""DiseaseCodes"""', 'Chapter'], {}), "('DiseaseCodes',... |
from tensorflow.keras import Sequential
from tensorflow.keras.layers import Conv2D, Flatten, Dense, Dropout
import tensorflow.keras as keras
import os
import cv2
import numpy as np
from sklearn.model_selection import train_test_split
def data_prep(path, img_rows, img_cols, color):
"""
A function to preprocess ... | [
"os.listdir",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.Sequential",
"sklearn.model_selection.train_test_split",
"os.path.join",
"numpy.argmax",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.Flatten",
"cv2.resize",
"cv2... | [((1704, 1720), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1714, 1720), False, 'import os\n'), ((2245, 2268), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (2262, 2268), True, 'import numpy as np\n'), ((2773, 2785), 'tensorflow.keras.Sequential', 'Sequential', ([], {}), '()\n', ... |
"""
Oracle library
"""
import lib_common
from lib_properties import pc
def Graphic_colorbg():
return "#CC99FF"
def EntityOntology():
return ( ["Db", "Schema", "Library"], )
# Ambiguity with tables, oracle or normal users.
def MakeUri(dbName,schemaName,libraryName):
return lib_common.gUriGen.UriMakeFromDict("ora... | [
"sources_types.oracle.schema.MakeUri",
"lib_common.gUriGen.UriMakeFromDict"
] | [((281, 399), 'lib_common.gUriGen.UriMakeFromDict', 'lib_common.gUriGen.UriMakeFromDict', (['"""oracle/library"""', "{'Db': dbName, 'Schema': schemaName, 'Library': libraryName}"], {}), "('oracle/library', {'Db': dbName,\n 'Schema': schemaName, 'Library': libraryName})\n", (315, 399), False, 'import lib_common\n'), ... |
from myhdl import Signal, intbv, block, always_comb, ConcatSignal
import myhdl
from collections import OrderedDict
import keyword
def _is_valid_name(ident: str) -> bool:
'''Determine if ident is a valid register or bitfield name.
'''
if not isinstance(ident, str):
raise TypeError("expected str, b... | [
"collections.OrderedDict",
"myhdl.Signal",
"keyword.iskeyword",
"myhdl.intbv",
"myhdl.ConcatSignal"
] | [((417, 441), 'keyword.iskeyword', 'keyword.iskeyword', (['ident'], {}), '(ident)\n', (434, 441), False, 'import keyword\n'), ((15521, 15534), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (15532, 15534), False, 'from collections import OrderedDict\n'), ((10488, 10496), 'myhdl.intbv', 'intbv', (['(0)'], {... |
# Copyright (c) 2014 Simplistix Ltd
# See license.txt for license details.
from decimal import Decimal
from testfixtures import RoundComparison as R, compare, ShouldRaise
from unittest import TestCase
from ..compat import PY2, PY3
class Tests(TestCase):
def test_equal_yes_rhs(self):
self.assertTrue(0.1... | [
"decimal.Decimal",
"testfixtures.ShouldRaise",
"testfixtures.RoundComparison"
] | [((1576, 1598), 'testfixtures.ShouldRaise', 'ShouldRaise', (['TypeError'], {}), '(TypeError)\n', (1587, 1598), False, 'from testfixtures import RoundComparison as R, compare, ShouldRaise\n'), ((1686, 1708), 'testfixtures.ShouldRaise', 'ShouldRaise', (['TypeError'], {}), '(TypeError)\n', (1697, 1708), False, 'from testf... |
# -*- coding=utf-8 -*-
# author: dongrixinyu
# contact: <EMAIL>
# blog: https://github.com/dongrixinyu/
# file: bare_embedding.py
# time: 2020-06-12 11:27
import os
import pdb
import logging
from typing import Union, Optional, Dict, Any, Tuple
import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_... | [
"torch.nn.LSTM",
"torch.mean",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torch.nn.utils.rnn.pad_packed_sequence"
] | [((1650, 1756), 'torch.nn.LSTM', 'nn.LSTM', (['self.embedding_size', 'self.hidden_size', 'self.num_layers'], {'batch_first': '(True)', 'bidirectional': '(True)'}), '(self.embedding_size, self.hidden_size, self.num_layers, batch_first\n =True, bidirectional=True)\n', (1657, 1756), True, 'import torch.nn as nn\n'), ((... |
from collections import namedtuple
from dagster import check
from dagster.config.config_type import ConfigType, ConfigTypeKind
from dagster.config.field import Field
from dagster.core.serdes import whitelist_for_serdes
@whitelist_for_serdes
class NonGenericTypeRefMeta(namedtuple('_NonGenericTypeRefMeta', 'key')):
... | [
"dagster.check.list_param",
"dagster.check.inst_param",
"collections.namedtuple",
"dagster.config.config_type.ConfigTypeKind.has_fields",
"dagster.check.str_param",
"dagster.check.opt_str_param",
"dagster.check.bool_param",
"dagster.config.config_type.ConfigTypeKind.is_closed_generic"
] | [((272, 315), 'collections.namedtuple', 'namedtuple', (['"""_NonGenericTypeRefMeta"""', '"""key"""'], {}), "('_NonGenericTypeRefMeta', 'key')\n", (282, 315), False, 'from collections import namedtuple\n'), ((486, 589), 'collections.namedtuple', 'namedtuple', (['"""_ConfigTypeMeta"""', '"""kind key given_name descriptio... |
#########################################################
# 母比率の差の検定/タイプ1
#########################################################
import sys
import math
def error_usage():
sys.stderr.write("usage: " + sys.argv[0] + "\n")
sys.stderr.write("\tこのプログラムは、4つの引数が必要です。\n\n")
sys.stderr.write(
"\t1.属性1のn... | [
"sys.stderr.write",
"math.fabs",
"math.sqrt",
"sys.exit"
] | [((180, 228), 'sys.stderr.write', 'sys.stderr.write', (["('usage: ' + sys.argv[0] + '\\n')"], {}), "('usage: ' + sys.argv[0] + '\\n')\n", (196, 228), False, 'import sys\n'), ((233, 279), 'sys.stderr.write', 'sys.stderr.write', (['"""\tこのプログラムは、4つの引数が必要です。\n\n"""'], {}), "('\\tこのプログラムは、4つの引数が必要です。\\n\\n')\n", (249, 279)... |
# coding=utf-8
import functools
from flask import Flask, session
from flask import redirect
from flask import request, make_response
from flask import render_template
from flask import url_for
from flask_bootstrap import Bootstrap
# 数据库处理
from db import *
# json
import json
# 生成一个app
app = Flask(__name... | [
"flask.render_template",
"flask.Flask",
"flask.request.get_data",
"flask.request.form.items",
"json.dumps",
"flask.url_for",
"flask_bootstrap.Bootstrap"
] | [((308, 354), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (313, 354), False, 'from flask import Flask, session\n'), ((366, 380), 'flask_bootstrap.Bootstrap', 'Bootstrap', (['app'], {}), '(app)\n', (375, 380), False, 'from flask_bootstrap... |
# STL imports
import random
import logging
import string
import time
import datetime
import random
import struct
import sys
from functools import wraps
# Third party imports
import numpy as np
import faker
from faker.providers import BaseProvider
logging.getLogger('faker').setLevel(logging.ERROR)
sys.path.append('.'... | [
"logging.getLogger",
"random.choice",
"random.randrange",
"time.perf_counter",
"functools.wraps",
"datetime.timedelta",
"faker.Faker",
"datetime.datetime.now",
"random.random",
"time.localtime",
"sys.path.append",
"random.randint",
"numpy.random.RandomState"
] | [((301, 321), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (316, 321), False, 'import sys\n'), ((2030, 2043), 'faker.Faker', 'faker.Faker', ([], {}), '()\n', (2041, 2043), False, 'import faker\n'), ((578, 605), 'numpy.random.RandomState', 'np.random.RandomState', (['(1234)'], {}), '(1234)\n', (59... |
import math
import os
import random
import re
import sys
first_multiple_input = input().rstrip().split()
n = int(first_multiple_input[0])
m = int(first_multiple_input[1])
matrix = []
if (n>0 and m>0 and n<100 and m< 100):
for _ in range(n):
matrix_item = input()
matrix.append(matrix_item)
for... | [
"re.sub"
] | [((468, 507), 're.sub', 're.sub', (['"""\\\\b[!@#$%& ]+\\\\b"""', '""" """', 'string'], {}), "('\\\\b[!@#$%& ]+\\\\b', ' ', string)\n", (474, 507), False, 'import re\n')] |
import torch
import torch.nn.functional as F
import os.path as osp
import json
from torch_geometric.utils import precision, recall
from torch_geometric.utils import f1_score, accuracy
from torch.utils.tensorboard import SummaryWriter
def train_epoch_classifier(model, train_loader, len_train, optimizer, device):
m... | [
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.functional.mse_loss",
"json.dump",
"os.path.join",
"torch.tensor",
"torch_geometric.utils.f1_score",
"torch.nn.functional.log_softmax",
"torch_geometric.utils.recall",
"torch_geometric.utils.precision",
"torch_geometric.utils.accuracy",
"torch.c... | [((1661, 1696), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (["(base_path + '/plots')"], {}), "(base_path + '/plots')\n", (1674, 1696), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((4366, 4401), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (["(base_path + '/plots')"], {}), ... |
# nuScenes dev-kit.
# Code written by <NAME>, 2020.
import argparse
import gc
import os
import random
from typing import List
from collections import defaultdict
import cv2
import tqdm
from nuimages.nuimages import NuImages
def render_images(nuim: NuImages,
mode: str = 'all',
ca... | [
"random.shuffle",
"argparse.ArgumentParser",
"os.makedirs",
"tqdm.tqdm",
"os.path.join",
"random.seed",
"cv2.VideoWriter",
"os.path.isdir",
"cv2.VideoWriter_fourcc",
"gc.collect",
"cv2.imread",
"os.path.expanduser",
"os.remove"
] | [((2879, 2906), 'os.path.expanduser', 'os.path.expanduser', (['out_dir'], {}), '(out_dir)\n', (2897, 2906), False, 'import os\n'), ((4761, 4790), 'random.shuffle', 'random.shuffle', (['sample_tokens'], {}), '(sample_tokens)\n', (4775, 4790), False, 'import random\n'), ((4979, 5003), 'tqdm.tqdm', 'tqdm.tqdm', (['sample_... |
import os
import sys
cwd = os.getcwd()
sys.path.append(cwd)
import pickle
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from plot.helper import plot_task, plot_weights, plot_rf_z_max, plot_rf_quad, plot_vector_traj
tasks = [
'com_pos', 'com_vel', 'chassis_quat', 'ch... | [
"matplotlib.use",
"plot.helper.plot_rf_z_max",
"pickle.load",
"os.getcwd",
"numpy.stack",
"plot.helper.plot_weights",
"plot.helper.plot_task",
"sys.path.append",
"plot.helper.plot_rf_quad",
"matplotlib.pyplot.show"
] | [((27, 38), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (36, 38), False, 'import os\n'), ((39, 59), 'sys.path.append', 'sys.path.append', (['cwd'], {}), '(cwd)\n', (54, 59), False, 'import sys\n'), ((112, 135), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (126, 135), False, 'import matplotl... |
from pyramid.httpexceptions import HTTPConflict
from h.auth.util import client_authority
from h.presenters import TrustedUserJSONPresenter
from h.schemas import ValidationError
from h.schemas.api.user import CreateUserAPISchema, UpdateUserAPISchema
from h.services.user_unique import DuplicateUserError
from h.views.api... | [
"h.views.api.exceptions.PayloadError",
"h.views.api.config.api_config",
"h.schemas.api.user.CreateUserAPISchema",
"h.presenters.TrustedUserJSONPresenter",
"h.auth.util.client_authority",
"h.schemas.api.user.UpdateUserAPISchema"
] | [((397, 558), 'h.views.api.config.api_config', 'api_config', ([], {'versions': "['v1', 'v2']", 'route_name': '"""api.user_read"""', 'request_method': '"""GET"""', 'link_name': '"""user.read"""', 'description': '"""Fetch a user"""', 'permission': '"""read"""'}), "(versions=['v1', 'v2'], route_name='api.user_read',\n ... |
import tkinter as tk
from presentacion.formulario import FormularioPersona
def centrar_ventana(ventana):
aplicacion_ancho = 550
aplicacion_largo = 650
pantall_ancho = ventana.winfo_screenwidth()
pantall_largo = ventana.winfo_screenheight()
x = int((pantall_ancho/2) - (aplicacion_ancho/2))
y = ... | [
"presentacion.formulario.FormularioPersona",
"tkinter.Tk"
] | [((466, 473), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (471, 473), True, 'import tkinter as tk\n'), ((581, 607), 'presentacion.formulario.FormularioPersona', 'FormularioPersona', (['ventana'], {}), '(ventana)\n', (598, 607), False, 'from presentacion.formulario import FormularioPersona\n')] |
from django.urls import path
from .views import teams_all, team_vote
urlpatterns = [
path('teams/all', teams_all, name="teams_all"),
path('teams/<int:pk>', team_vote, name="team_vote"),
] | [
"django.urls.path"
] | [((90, 136), 'django.urls.path', 'path', (['"""teams/all"""', 'teams_all'], {'name': '"""teams_all"""'}), "('teams/all', teams_all, name='teams_all')\n", (94, 136), False, 'from django.urls import path\n'), ((142, 193), 'django.urls.path', 'path', (['"""teams/<int:pk>"""', 'team_vote'], {'name': '"""team_vote"""'}), "(... |
from Dataset import *
from Network import *
from Functions import *
import os
from fastai.distributed import *
import argparse
import torch
try:
#from apex.parallel import DistributedDataParallel as DDP
from apex.fp16_utils import *
from apex import amp, optimizers
from apex.multi_tensor_apply import mu... | [
"apex.amp.scale_loss",
"argparse.ArgumentParser",
"torch.load",
"tqdm.tqdm",
"torch.no_grad",
"apex.amp.initialize",
"torch.cuda.is_available",
"os.system"
] | [((2228, 2253), 'os.system', 'os.system', (['"""mkdir models"""'], {}), "('mkdir models')\n", (2237, 2253), False, 'import os\n'), ((2254, 2277), 'os.system', 'os.system', (['"""mkdir logs"""'], {}), "('mkdir logs')\n", (2263, 2277), False, 'import os\n'), ((3298, 3351), 'apex.amp.initialize', 'amp.initialize', (['mode... |
"""
NODE model definition and experiment setup.
Neural Oblivious Decision Ensembles for Deep Learning on Tabular Data
https://arxiv.org/abs/1909.06312
Model details:
https://pytorch-tabular.readthedocs.io/en/latest/models/#nodemodel
"""
import logging
import os.path
import shutil
from sklearn.metrics import classif... | [
"logging.getLogger",
"pytorch_tabular.models.NodeConfig",
"pytorch_tabular.config.OptimizerConfig",
"sklearn.metrics.classification_report",
"optuna_utils.run_experiments",
"pytorch_tabular.config.ExperimentConfig",
"pytorch_tabular.config.TrainerConfig",
"shutil.rmtree",
"optuna.samplers.TPESampler... | [((749, 776), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (766, 776), False, 'import logging\n'), ((852, 1394), 'omegaconf.OmegaConf.create', 'OmegaConf.create', (["{'max_epochs': 50, 'lr_exp_min': -4, 'lr_exp_max': -3, 'alpha_exp_min': -4,\n 'alpha_exp_max': -3, 'batch_exp_min': 7,... |
from django.db import models
from django.core.urlresolvers import reverse
from djnfusion import server, key
from django.conf import settings
from jsonfield import JSONField
# TODO: change to this. Currently doesnt work. may have something to do with
# the server not in __init__
# from packages.providers.infusionsoft ... | [
"djnfusion.server.ContactService.runActionSequence",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.core.urlresolvers.reverse",
"packages.managers.PackageManager",
"djnfusion.... | [((856, 888), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (872, 888), False, 'from django.db import models\n'), ((903, 966), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""courses.Course"""'], {'null': '(True)', 'blank': '(True)'}), "('cour... |
import numpy as np
import matplotlib.pyplot as plt
from tqdm import trange
class CFG:
n = 10
mean = 0.0
variance = 1.0
t = 1000
esp = [0, 0.01, 0.05, 0.1, 0.15, 0.2]
n_try = 2000
class bandit():
def __init__(self, m, v):
self.m = m
self.v = v
self.mean = 0.0
... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"numpy.random.random",
"numpy.random.choice",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.argmax",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.random.randn",
"tqdm.trange",
"matplotlib.pyplot.legend",
"matplotlib... | [((1088, 1116), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (1098, 1116), True, 'import matplotlib.pyplot as plt\n'), ((1336, 1354), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""step"""'], {}), "('step')\n", (1346, 1354), True, 'import matplotlib.pyplot as plt\n')... |
from dataclasses import dataclass
from .base import _MiscOptionBase
from application.src.misc.sampling import PurposesOfSampling
@dataclass
class Editor(_MiscOptionBase):
name = "Purpose of sampling"
id = "purpose_of_sampling"
link = "misc_bp.submit_purpose_of_sampling"
description = "The reason the ... | [
"application.src.misc.sampling.PurposesOfSampling.fetch_list",
"application.src.misc.sampling.PurposesOfSampling.save_by_procedure"
] | [((454, 485), 'application.src.misc.sampling.PurposesOfSampling.fetch_list', 'PurposesOfSampling.fetch_list', ([], {}), '()\n', (483, 485), False, 'from application.src.misc.sampling import PurposesOfSampling\n'), ((552, 594), 'application.src.misc.sampling.PurposesOfSampling.save_by_procedure', 'PurposesOfSampling.sav... |
from rest_framework import status
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from apprest.plugins.icat.helpers.complex_encoder import JsonResponse
from apprest.plugins.icat.services... | [
"apprest.plugins.icat.helpers.complex_encoder.JsonResponse",
"apprest.plugins.icat.services.ICAT.ICATService"
] | [((669, 682), 'apprest.plugins.icat.services.ICAT.ICATService', 'ICATService', ([], {}), '()\n', (680, 682), False, 'from apprest.plugins.icat.services.ICAT import ICATService\n'), ((863, 923), 'apprest.plugins.icat.helpers.complex_encoder.JsonResponse', 'JsonResponse', (['investigation_users'], {'status': 'status.HTTP... |
import unittest
from table_tests.utils import BaseTestNoFlushTable
from evaluator.hashtable8 import NO_FLUSH_8
class TestNoFlush8Table(BaseTestNoFlushTable):
TOCOMPARE = NO_FLUSH_8
TABLE = [0] * len(TOCOMPARE)
VISIT = [0] * len(TOCOMPARE)
NUM_CARDS = 8
def test_noflush8_table(self):
self.assertListEqua... | [
"unittest.main"
] | [((380, 395), 'unittest.main', 'unittest.main', ([], {}), '()\n', (393, 395), False, 'import unittest\n')] |
'''
Leetcode problem No 862 Shortest Subarray with Sum at Least K
Solution written by <NAME> on 1 July, 2018
'''
import collections
class Solution(object):
def shortestSubarray(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: int
"""
n = len(A)
B = [0]... | [
"collections.deque"
] | [((403, 422), 'collections.deque', 'collections.deque', ([], {}), '()\n', (420, 422), False, 'import collections\n')] |
# coding=utf-8
import logging
import random
import string
import sys
import unittest
from time import time, sleep
import apiritif
import os
import re
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.common.by import By
from seleniu... | [
"apiritif.put_into_thread_store",
"selenium.webdriver.Firefox",
"apiritif.set_stage",
"apiritif.smart_transaction",
"selenium.webdriver.FirefoxOptions",
"bzt.resources.selenium_extras.waiter",
"selenium.webdriver.FirefoxProfile"
] | [((779, 805), 'selenium.webdriver.FirefoxOptions', 'webdriver.FirefoxOptions', ([], {}), '()\n', (803, 805), False, 'from selenium import webdriver\n'), ((824, 850), 'selenium.webdriver.FirefoxProfile', 'webdriver.FirefoxProfile', ([], {}), '()\n', (848, 850), False, 'from selenium import webdriver\n'), ((1022, 1065), ... |
__description__ = \
"""
Fitter subclass for performing bayesian (MCMC) fits.
"""
__author__ = "<NAME>"
__date__ = "2017-05-10"
from .base import Fitter
import emcee, corner
import numpy as np
import scipy.optimize as optimize
import multiprocessing
class BayesianFitter(Fitter):
"""
"""
def __init__(sel... | [
"numpy.mean",
"numpy.copy",
"scipy.optimize.least_squares",
"numpy.sort",
"multiprocessing.cpu_count",
"emcee.EnsembleSampler",
"numpy.array",
"numpy.sum",
"numpy.isfinite",
"numpy.std",
"numpy.random.randn"
] | [((4549, 4565), 'numpy.array', 'np.array', (['bounds'], {}), '(bounds)\n', (4557, 4565), True, 'import numpy as np\n'), ((5769, 5861), 'emcee.EnsembleSampler', 'emcee.EnsembleSampler', (['self._num_walkers', 'ndim', 'self.ln_prob'], {'threads': 'self._num_threads'}), '(self._num_walkers, ndim, self.ln_prob, threads=sel... |
# -*- coding: utf-8 -*-
# We must always import the relevant libraries for our problem at hand. NumPy and TensorFlow are required for this example.
# https://www.kaggle.com/c/costa-rican-household-poverty-prediction/data#_=_
import numpy as np
np.set_printoptions(threshold='nan')
import matplotlib.pyplot as plt
import... | [
"tensorflow.feature_column.crossed_column",
"tensorflow.estimator.DNNClassifier",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"tensorflow.estimator.LinearClassifier",
"tensorflow.feature_column.numeric_column",
"tensorflow.estimator.inputs.pandas_input_fn",
"numpy.set_printoptions"
... | [((245, 281), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '"""nan"""'}), "(threshold='nan')\n", (264, 281), True, 'import numpy as np\n'), ((521, 550), 'pandas.read_csv', 'pd.read_csv', (['"""data/train.csv"""'], {}), "('data/train.csv')\n", (532, 550), True, 'import pandas as pd\n'), ((6250, 63... |
"""JSON implementations of authentication queries."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allow... | [
"dlkit.abstract_osid.osid.errors.Unimplemented"
] | [((3335, 3357), 'dlkit.abstract_osid.osid.errors.Unimplemented', 'errors.Unimplemented', ([], {}), '()\n', (3355, 3357), False, 'from dlkit.abstract_osid.osid import errors\n'), ((3800, 3822), 'dlkit.abstract_osid.osid.errors.Unimplemented', 'errors.Unimplemented', ([], {}), '()\n', (3820, 3822), False, 'from dlkit.abs... |
# Adapted by <NAME>, 2019
#
# Based on Detectron.pytorch/lib/roi_data/fast_rcnn.py
# Original license text:
# --------------------------------------------------------
# Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | [
"logging.getLogger",
"numpy.minimum",
"numpy.ones",
"numpy.hstack",
"numpy.where",
"utils_rel.boxes_rel.get_spt_features",
"numpy.unique",
"numpy.random.choice",
"utils_rel.boxes_rel.rois_union",
"numpy.append",
"numpy.array",
"numpy.zeros",
"utils.fpn.add_multilevel_roi_blobs",
"numpy.con... | [((1404, 1431), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1421, 1431), False, 'import logging\n'), ((8692, 8741), 'numpy.hstack', 'np.hstack', (['(repeated_batch_idx, sampled_sbj_rois)'], {}), '((repeated_batch_idx, sampled_sbj_rois))\n', (8701, 8741), True, 'import numpy as np\n'),... |
import time
import re
from src.core.tables import Table, MigrationTable
from src.core.constraints import Index
class MysqlTable(Table):
@staticmethod
def _join_cols(cols):
'''Join and escape a list'''
return ', '.join(['`%s`' % i for i in cols])
@staticmethod
def _join_conditionals(r... | [
"re.sub",
"src.core.constraints.Index",
"time.sleep",
"pdb.set_trace"
] | [((4067, 4082), 'pdb.set_trace', 'pdb.set_trace', ([], {}), '()\n', (4080, 4082), False, 'import pdb\n'), ((2658, 2688), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'statement'], {}), "('\\\\s+', ' ', statement)\n", (2664, 2688), False, 'import re\n'), ((2948, 2985), 'src.core.constraints.Index', 'Index', (['tup[0... |
'''
Local DB Authentication module.
.. moduleauthor:: <NAME> <<EMAIL>>
'''
import logging
from django.contrib.auth.models import User, Group
from django.contrib.auth.backends import ModelBackend
from tardis.tardis_portal.auth.interfaces import AuthProvider, GroupProvider, UserProvider
logger = logging.getLogger(_... | [
"logging.getLogger",
"django.contrib.auth.models.Group.objects.get",
"django.contrib.auth.models.Group.objects.filter",
"django.contrib.auth.models.User.objects.filter",
"django.contrib.auth.backends.ModelBackend",
"django.contrib.auth.models.User.objects.get"
] | [((301, 328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (318, 328), False, 'import logging\n'), ((403, 417), 'django.contrib.auth.backends.ModelBackend', 'ModelBackend', ([], {}), '()\n', (415, 417), False, 'from django.contrib.auth.backends import ModelBackend\n'), ((1669, 1693), 'd... |
import os
import time
from pathlib import Path
from flask import Flask, jsonify, abort, request, Response, Request
import concurrent.futures
import threading
import requests
import logging
import ast
from urllib.parse import urlparse
from flask import current_app as app
from urllib3.exceptions import InsecureRequestWar... | [
"logging.getLogger",
"requests.post",
"flask.request.args.items",
"flask.current_app.route",
"libs.assay_type.AssayType.iter_names",
"flask.current_app.app_context",
"flask.current_app.errorhandler",
"flask.jsonify",
"flask.current_app.config.from_pyfile",
"pathlib.Path",
"flask.abort",
"hubma... | [((870, 1024), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s] %(levelname)s in %(module)s:%(lineno)d: %(message)s"""', 'level': 'logging.DEBUG', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(format=\n '[%(asctime)s] %(levelname)s in %(module)s:%(lineno)d: %(message)s',\n level=logging... |
#!/usr/bin/env python
#
# Creates resources
# This script creates VPC/security group/keypair if not already present
import logging
import os
import sys
import time
from . import aws_util as u
from . import util
DRYRUN = False
DEBUG = True
# Names of Amazon resources that are created. These settings are fixed across
... | [
"logging.getLogger",
"os.path.exists",
"os.environ.get",
"time.sleep",
"os.system",
"sys.stdout.flush",
"logging.info",
"sys.stdout.write"
] | [((595, 622), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (612, 622), False, 'import logging\n'), ((5900, 5947), 'os.system', 'os.system', (["('mkdir -p ' + u.PRIVATE_KEY_LOCATION)"], {}), "('mkdir -p ' + u.PRIVATE_KEY_LOCATION)\n", (5909, 5947), False, 'import os\n'), ((3934, 3996), '... |
#
# Copyright (c) 2020, NVIDIA 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 ... | [
"pynvml.nvmlShutdown",
"pynvml.nvmlDeviceGetHandleByIndex",
"pynvml.nvmlInit",
"psutil.virtual_memory",
"numba.cuda.current_context",
"warnings.warn"
] | [((809, 826), 'pynvml.nvmlInit', 'pynvml.nvmlInit', ([], {}), '()\n', (824, 826), False, 'import pynvml\n'), ((1192, 1213), 'pynvml.nvmlShutdown', 'pynvml.nvmlShutdown', ([], {}), '()\n', (1211, 1213), False, 'import pynvml\n'), ((1523, 1588), 'warnings.warn', 'warnings.warn', (['"""Please install psutil for full cpu=T... |
import re
import argparse
import os
import sys
import logging
import traceback
import pysatl
class EtsiTs101955(object):
COMMENT_MARKER = "REM"
COMMAND_MARKER = "CMD"
RESET_MARKER = "RST"
INIT_MARKER = "INI"
OFF_MARKER = "OFF"
def __init__(self, cmdHandler):
self._cmdHandler = cmdHandl... | [
"logging.getLogger",
"logging.debug",
"argparse.ArgumentParser",
"re.compile",
"pysatl.RAPDU",
"pysatl.Utils.ba",
"os.path.basename",
"pysatl.CAPDU.from_hexstr",
"pysatl.Utils.hexstr",
"logging.info"
] | [((3787, 3827), 'pysatl.RAPDU', 'pysatl.RAPDU', ([], {'SW1': 'sw1', 'SW2': 'sw2', 'DATA': 'dat'}), '(SW1=sw1, SW2=sw2, DATA=dat)\n', (3799, 3827), False, 'import pysatl\n'), ((4140, 4177), 'pysatl.Utils.hexstr', 'pysatl.Utils.hexstr', (['dat[:header_len]'], {}), '(dat[:header_len])\n', (4159, 4177), False, 'import pysa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 <EMAIL>
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
import cffi
import ctypes.util
import platform
ffi = cffi.FFI()
ffi.cdef("""
struct hid_device_info {
char *path;
unsigned short vendor_id;
unsigned short product_id... | [
"easyhid.Enumeration",
"platform.platform",
"cffi.FFI"
] | [((196, 206), 'cffi.FFI', 'cffi.FFI', ([], {}), '()\n', (204, 206), False, 'import cffi\n'), ((1868, 1887), 'platform.platform', 'platform.platform', ([], {}), '()\n', (1885, 1887), False, 'import platform\n'), ((11515, 11528), 'easyhid.Enumeration', 'Enumeration', ([], {}), '()\n', (11526, 11528), False, 'from easyhid... |
#!/usr/bin/env python3
import anki_vector
import paho.mqtt.client as mqtt
import time
###############################################################################
def main():
voltage = 0
batlevel = 0
charging = 0
docked = 0
status = "error"
ltime = time.strftime("%d.%m.%Y %H:%M:%S"... | [
"paho.mqtt.client.Client",
"anki_vector.Robot",
"time.strftime"
] | [((287, 321), 'time.strftime', 'time.strftime', (['"""%d.%m.%Y %H:%M:%S"""'], {}), "('%d.%m.%Y %H:%M:%S')\n", (300, 321), False, 'import time\n'), ((3490, 3503), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (3501, 3503), True, 'import paho.mqtt.client as mqtt\n'), ((398, 473), 'anki_vector.Robot', 'anki_... |
import time
from beacontools import BeaconScanner, IBeaconFilter
def callback(bt_addr, rssi, packet, additional_info):
print("<%s, %d> %s %s" % (bt_addr, rssi, packet, additional_info))
# scan for all iBeacon advertisements from beacons with the specified uuid
scanner = BeaconScanner(callback,
device_filter... | [
"beacontools.IBeaconFilter",
"time.sleep"
] | [((398, 412), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (408, 412), False, 'import time\n'), ((321, 379), 'beacontools.IBeaconFilter', 'IBeaconFilter', ([], {'uuid': '"""e2c56db5-dffb-48d2-b060-d0f5a71096e0"""'}), "(uuid='e2c56db5-dffb-48d2-b060-d0f5a71096e0')\n", (334, 379), False, 'from beacontools import... |
# Desafio 61 Curso em Video Python
# By Rafabr
from estrutura_modelo import cabecalho, rodape
cabecalho(61, "Termos de uma Progressão Aritmética - II")
while True:
try:
p0 = float(input('Digite o Termo inicial da PA: '))
r = float(input('Digite a razão da PA: '))
except ValueError:
pr... | [
"estrutura_modelo.rodape",
"estrutura_modelo.cabecalho"
] | [((96, 153), 'estrutura_modelo.cabecalho', 'cabecalho', (['(61)', '"""Termos de uma Progressão Aritmética - II"""'], {}), "(61, 'Termos de uma Progressão Aritmética - II')\n", (105, 153), False, 'from estrutura_modelo import cabecalho, rodape\n'), ((490, 498), 'estrutura_modelo.rodape', 'rodape', ([], {}), '()\n', (496... |
from setuptools import setup
tests_require = [
'cov-core',
'mock',
'nose2',
]
setup(name='steinlib',
version='0.1',
description='Python bindings for Steinlib format.',
url='http://github.com/leandron/steinlib',
author='<NAME>',
author_email='<EMAIL>',
li... | [
"setuptools.setup"
] | [((108, 424), 'setuptools.setup', 'setup', ([], {'name': '"""steinlib"""', 'version': '"""0.1"""', 'description': '"""Python bindings for Steinlib format."""', 'url': '"""http://github.com/leandron/steinlib"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['steinlib']... |
# -*- coding:utf-8 -*-
"""
@File : test_template
@Author : Chen
@Contact : <EMAIL>
@Date : 2021/1/20 20:09
@Desc :
"""
# 导包
import pytest
import requests
from time import sleep
from api.template_api import TemplateAPI
from tools.get_log import GetLog
from tools.read_file import read_json
import allure
# 获取日志器
log =... | [
"requests.Session",
"allure.story",
"api.template_api.TemplateAPI",
"time.sleep",
"allure.feature",
"pytest.skip",
"tools.read_file.read_json",
"tools.get_log.GetLog.get_log"
] | [((321, 337), 'tools.get_log.GetLog.get_log', 'GetLog.get_log', ([], {}), '()\n', (335, 337), False, 'from tools.get_log import GetLog\n'), ((341, 364), 'allure.feature', 'allure.feature', (['"""测试类模板"""'], {}), "('测试类模板')\n", (355, 364), False, 'import allure\n'), ((366, 390), 'pytest.skip', 'pytest.skip', (['"""参考模板,... |
# -*- coding: utf-8 -*-
import botocore.exceptions
import logging
import dockerfilegenerator.lib.constants as constants
import dockerfilegenerator.lib.exceptions as exceptions
import dockerfilegenerator.lib.versions as versions
import dockerfilegenerator.lib.jsonstore as jsonstore
import dockerfilegenerator.lib.s3sto... | [
"logging.getLogger",
"dockerfilegenerator.lib.jsonstore.get_dockerfile",
"dockerfilegenerator.lib.jsonstore.Store",
"dockerfilegenerator.lib.s3store.get_s3_bucket_manager",
"dockerfilegenerator.lib.github.get_github_repository"
] | [((392, 411), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (409, 411), False, 'import logging\n'), ((2721, 2752), 'dockerfilegenerator.lib.s3store.get_s3_bucket_manager', 's3store.get_s3_bucket_manager', ([], {}), '()\n', (2750, 2752), True, 'import dockerfilegenerator.lib.s3store as s3store\n'), ((2784,... |
# coding: utf-8
"""
FreeClimb API
FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site teleph... | [
"six.iteritems",
"freeclimb.configuration.Configuration"
] | [((12557, 12590), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (12570, 12590), False, 'import six\n'), ((2550, 2565), 'freeclimb.configuration.Configuration', 'Configuration', ([], {}), '()\n', (2563, 2565), False, 'from freeclimb.configuration import Configuration\n')] |
from kdbush import KDBush
# test data
points = [
[54,1],[97,21],[65,35],[33,54],[95,39],[54,3],[53,54],[84,72],[33,34],[43,15],[52,83],[81,23],[1,61],[38,74],
[11,91],[24,56],[90,31],[25,57],[46,61],[29,69],[49,60],[4,98],[71,15],[60,25],[38,84],[52,38],[94,51],[13,25],
[77,73],[88,87],[6,27],[58,22],[53,28... | [
"kdbush.KDBush"
] | [((1923, 1937), 'kdbush.KDBush', 'KDBush', (['points'], {}), '(points)\n', (1929, 1937), False, 'from kdbush import KDBush\n'), ((2434, 2448), 'kdbush.KDBush', 'KDBush', (['points'], {}), '(points)\n', (2440, 2448), False, 'from kdbush import KDBush\n')] |
#!/usr/bin/env python3
"""
Contains testcases for the individual examination.
"""
import unittest
from io import StringIO
import os
import sys
from unittest.mock import patch
from examiner import ExamTestCase, ExamTestResult, tags
from examiner import import_module, find_path_to_assignment
FILE_DIR = os.path.dirname(... | [
"sys.path.insert",
"examiner.tags",
"examiner.import_module",
"examiner.find_path_to_assignment",
"os.path.realpath",
"os.chdir",
"unittest.main",
"io.StringIO",
"unittest.mock.patch",
"unittest.TextTestRunner"
] | [((360, 393), 'examiner.find_path_to_assignment', 'find_path_to_assignment', (['FILE_DIR'], {}), '(FILE_DIR)\n', (383, 393), False, 'from examiner import import_module, find_path_to_assignment\n'), ((517, 549), 'examiner.import_module', 'import_module', (['REPO_PATH', '"""main"""'], {}), "(REPO_PATH, 'main')\n", (530, ... |
from django.contrib import admin
from olha_boca.infratores.models import Infratores
# Register your models here.
class InfratoresAdmin(admin.ModelAdmin):
list_display = ('nome', 'infracoes_a_pagar', 'total_infracoes', 'valor_a_pagar')
@admin.display(empty_value='???')
def total_infracoes(self, obj):
... | [
"django.contrib.admin.site.register",
"django.contrib.admin.display"
] | [((783, 831), 'django.contrib.admin.site.register', 'admin.site.register', (['Infratores', 'InfratoresAdmin'], {}), '(Infratores, InfratoresAdmin)\n', (802, 831), False, 'from django.contrib import admin\n'), ((247, 279), 'django.contrib.admin.display', 'admin.display', ([], {'empty_value': '"""???"""'}), "(empty_value... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import functools
import torch.nn as nn
from torch.nn import init
import torch.functional as F
from torch.autograd import Variable
print('ok')
def weights_init_normal(m):
classname = m.__class__.... | [
"torch.nn.ReLU",
"torch.nn.parallel.data_parallel",
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.nn.Sequential",
"torch.nn.init.normal",
"torch.nn.ReflectionPad2d",
"torch.nn.InstanceNorm2d",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.init.constant"
] | [((395, 432), 'torch.nn.init.normal', 'init.normal', (['m.weight.data', '(0.0)', '(0.02)'], {}), '(m.weight.data, 0.0, 0.02)\n', (406, 432), False, 'from torch.nn import init\n'), ((1683, 1709), 'torch.nn.Sequential', 'nn.Sequential', (['*conv_block'], {}), '(*conv_block)\n', (1696, 1709), True, 'import torch.nn as nn\... |
# Generated by Django 2.0.13 on 2019-06-27 17:04
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('research', '0001_initial'),
('datasets', '0001_init... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField... | [((15570, 15668), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""mapperanalysis"""', 'unique_together': "{('slug', 'research')}"}), "(name='mapperanalysis', unique_together={(\n 'slug', 'research')})\n", (15600, 15668), False, 'from django.db import migrations, models... |
import FWCore.ParameterSet.Config as cms
def reEmulateLayer2(process):
process.load('L1Trigger/L1TCalorimeter/simCaloStage2Digis_cfi')
process.load('L1Trigger.L1TCalorimeter.caloStage2Params_2017_v1_7_excl30_cfi')
process.simCaloStage2Digis.towerToken = cms.InputTag("caloStage2Digis", "CaloTower")
... | [
"FWCore.ParameterSet.Config.Path",
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.InputTag"
] | [((270, 314), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""caloStage2Digis"""', '"""CaloTower"""'], {}), "('caloStage2Digis', 'CaloTower')\n", (282, 314), True, 'import FWCore.ParameterSet.Config as cms\n'), ((345, 381), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['process.simCaloStage2Digis'], {})... |
"""
ethereum.py
ethereum.py contains an EthereumClient class that provides functions for interacting
with the Coverage.sol solidity contract on an Ethereum blockchain network.
"""
import asyncio
import datetime
import json
import logging
import os
from ethereum.clients.nats import get_nats_client
from ethereum.config ... | [
"logging.getLogger",
"json.dumps",
"os.path.join",
"web3.Web3.toJSON",
"asyncio.sleep",
"ethereum.clients.nats.get_nats_client",
"datetime.date.today",
"asyncio.get_event_loop",
"ethereum.exceptions.EthereumNetworkConnectionError",
"ethereum.config.get_settings",
"web3.Web3.HTTPProvider"
] | [((530, 557), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (547, 557), False, 'import logging\n'), ((9462, 9481), 'json.dumps', 'json.dumps', (['message'], {}), '(message)\n', (9472, 9481), False, 'import json\n'), ((9886, 9900), 'ethereum.config.get_settings', 'get_settings', ([], {}),... |
# -*- coding: utf-8 -*-
from django.shortcuts import resolve_url
from django.template.loader import render_to_string
from django_jinja import library
from jinja2 import contextfunction
@contextfunction
@library.global_function
def breadcrumb(context, contents, *args, **kwargs):
class_name = kwargs.pop('class', False... | [
"django.shortcuts.resolve_url",
"django.template.loader.render_to_string"
] | [((699, 752), 'django.template.loader.render_to_string', 'render_to_string', (['"""breadcrumbs/breadcrumbs.html"""', 'ctx'], {}), "('breadcrumbs/breadcrumbs.html', ctx)\n", (715, 752), False, 'from django.template.loader import render_to_string\n'), ((384, 417), 'django.shortcuts.resolve_url', 'resolve_url', (['url', '... |
import torchvision
import torch
import torch.nn as nn
import torch.nn.functional as F
class Vgg_Deeplab(nn.Module):
def __init__(self,*args, **kwargs):
super(Vgg_Deeplab, self).__init__()
vgg16 = torchvision.models.vgg16()
layers = []
layers.append(nn.Conv2d(3, 64, kernel_size=3, ... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d",
"torchvision.models.vgg16",
"torch.randn"
] | [((5212, 5239), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(224)', '(224)'], {}), '(1, 3, 224, 224)\n', (5223, 5239), False, 'import torch\n'), ((5313, 5338), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(64)', '(64)'], {}), '(1, 3, 64, 64)\n', (5324, 5338), False, 'import torch\n'), ((5349, 5414), 'torch.nn.Conv... |
# -*- coding: utf-8 -*-
"""
This module defines a connexion app object and configures the API
endpoints based the swagger.yml configuration file.
copyright: © 2019 by <NAME>.
license: MIT, see LICENSE for more details.
"""
import connexion
app = connexion.App(__name__, specification_dir="./")
app.app.url_map.strict... | [
"connexion.App"
] | [((250, 297), 'connexion.App', 'connexion.App', (['__name__'], {'specification_dir': '"""./"""'}), "(__name__, specification_dir='./')\n", (263, 297), False, 'import connexion\n')] |
from django import forms
from django.test import TestCase
from template_forms import bs3
def startswith_a(value):
if value.startswith('a'):
return value
raise forms.ValidationError('Value must start with "a".')
def not_now(value):
if value:
raise forms.ValidationError('I cannot let you... | [
"django.forms.BooleanField",
"django.forms.CharField",
"django.forms.ValidationError"
] | [((179, 230), 'django.forms.ValidationError', 'forms.ValidationError', (['"""Value must start with "a"."""'], {}), '(\'Value must start with "a".\')\n', (200, 230), False, 'from django import forms\n'), ((281, 341), 'django.forms.ValidationError', 'forms.ValidationError', (['"""I cannot let you do that right now."""'],... |
from snakemake import shell
input, output, params, threads, w, config = snakemake.input, snakemake.output, snakemake.params, snakemake.threads, snakemake.wildcards, snakemake.config
genome = w.genome
params.hybrid = config['x'][genome]['hybrid']
opt = params.opt
shell("""
rm -rf {output.fna}* {output.fai}*
rm... | [
"snakemake.shell"
] | [((265, 513), 'snakemake.shell', 'shell', (['"""\n rm -rf {output.fna}* {output.fai}*\n rm -rf {output.chrom_bed} {output.chrom_size} {output.gap}\n\n mkdir -p {params.wdir}/{params.odir}\n cd {params.wdir}/{params.odir}\n rm -rf raw.fna.* renamed* map* raw.sizes\n"""'], {}), '(\n """\n rm -rf {out... |
import io
import pytest
from requests import get
from urllib.parse import urljoin
def test_my_uploads_page(wait_for_api, login_user):
"""
GIVEN a user has logged in (login_user)
WHEN the '/my/uploads' page is navigated to (GET)
THEN check the response is valid and page title is correct
"""
requ... | [
"urllib.parse.urljoin"
] | [((391, 422), 'urllib.parse.urljoin', 'urljoin', (['api_url', '"""/my/uploads"""'], {}), "(api_url, '/my/uploads')\n", (398, 422), False, 'from urllib.parse import urljoin\n'), ((833, 869), 'urllib.parse.urljoin', 'urljoin', (['api_url', '"""/media/newupload"""'], {}), "(api_url, '/media/newupload')\n", (840, 869), Fal... |
import justpy as jp
from .group import Group
class Row(Group):
def __init__(self):
'''Row Element
Provides a container which arranges its child in a row.
'''
view = jp.QDiv(classes='row items-start', style='gap: 1em', delete_flag=False)
super().__init__(view)
| [
"justpy.QDiv"
] | [((204, 275), 'justpy.QDiv', 'jp.QDiv', ([], {'classes': '"""row items-start"""', 'style': '"""gap: 1em"""', 'delete_flag': '(False)'}), "(classes='row items-start', style='gap: 1em', delete_flag=False)\n", (211, 275), True, 'import justpy as jp\n')] |
import uvicorn
from fastapi import FastAPI
from database import Base, engine
from routers.user import router as router_user
from routers.product import router as router_product
from routers.authentication import router as router_auth
app = FastAPI(
title="Wish List",
description="Permita que seus clientes acompan... | [
"uvicorn.run",
"fastapi.FastAPI",
"database.Base.metadata.create_all"
] | [((244, 413), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""Wish List"""', 'description': '"""Permita que seus clientes acompanhem seus produtos favoritos, adicionando-os a uma lista de desejos."""', 'version': '"""1.0.0"""'}), "(title='Wish List', description=\n 'Permita que seus clientes acompanhem seus produto... |
# encoding: utf-8
import torch
import cv2
import numpy as np
import pdb
def detection_collate(batch):
"""Custom collate fn for dealing with batches of images that have a different
number of associated object annotations (bounding boxes).
Arguments:
batch: (tuple) A tuple of tensor images and lists... | [
"torch.stack",
"numpy.array",
"numpy.zeros",
"cv2.resize",
"torch.FloatTensor"
] | [((948, 989), 'numpy.zeros', 'np.zeros', (['aug_size'], {'dtype': 'sample[1].dtype'}), '(aug_size, dtype=sample[1].dtype)\n', (956, 989), True, 'import numpy as np\n'), ((1087, 1107), 'torch.stack', 'torch.stack', (['imgs', '(0)'], {}), '(imgs, 0)\n', (1098, 1107), False, 'import torch\n'), ((1109, 1132), 'torch.stack'... |
# Copyright (c) 2018 Copyright holder of the paper Generative Adversarial Model Learning
# submitted to NeurIPS 2019 for review
# All rights reserved.
import numpy as np
import torch
class Optimizer(object):
def __init__(self, policy, use_gpu=False):
self.networks = self._init_networks(policy.input_dim, ... | [
"numpy.array"
] | [((1868, 1911), 'numpy.array', 'np.array', (["batch['states']"], {'dtype': 'np.float32'}), "(batch['states'], dtype=np.float32)\n", (1876, 1911), True, 'import numpy as np\n'), ((1944, 1988), 'numpy.array', 'np.array', (["batch['rewards']"], {'dtype': 'np.float32'}), "(batch['rewards'], dtype=np.float32)\n", (1952, 198... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 基地址是本项目根目录
sys.path.append(BASE_DIR)
import datetime
from yxf_yixue.xiaochengtu import XiaochengtuApi
if __name__ == '__main__':
string = '1996/02/29 23:16'
obj = datetime.... | [
"datetime.datetime",
"sys.path.append",
"os.path.abspath",
"yxf_yixue.xiaochengtu.XiaochengtuApi"
] | [((149, 174), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (164, 174), False, 'import sys\n'), ((311, 348), 'datetime.datetime', 'datetime.datetime', (['(2012)', '(3)', '(7)', '(17)', '(40)'], {}), '(2012, 3, 7, 17, 40)\n', (328, 348), False, 'import datetime\n'), ((357, 373), 'yxf_yixue.xi... |
# -*- coding: UTF-8 -*-
"""
Provides a summary after each test run.
"""
from __future__ import absolute_import, division, print_function
import sys
from time import time as time_now
from behave.model import Rule, ScenarioOutline # MAYBE: Scenario
from behave.model_core import Status
from behave.reporter.base import R... | [
"behave.formatter.base.StreamOpener.ensure_stream_with_encoder",
"time.time"
] | [((4196, 4243), 'behave.formatter.base.StreamOpener.ensure_stream_with_encoder', 'StreamOpener.ensure_stream_with_encoder', (['stream'], {}), '(stream)\n', (4235, 4243), False, 'from behave.formatter.base import StreamOpener\n'), ((4977, 4987), 'time.time', 'time_now', ([], {}), '()\n', (4985, 4987), True, 'from time i... |
from typing import Dict, Any
import pytest
from checkov.common.bridgecrew.bc_source import SourceType
from checkov.common.bridgecrew.platform_integration import BcPlatformIntegration, bc_integration
@pytest.fixture()
def mock_bc_integration() -> BcPlatformIntegration:
bc_integration.bc_api_key = "<KEY>"
bc_... | [
"pytest.fixture",
"checkov.common.bridgecrew.bc_source.SourceType"
] | [((204, 220), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (218, 220), False, 'import pytest\n'), ((633, 649), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (647, 649), False, 'import pytest\n'), ((509, 536), 'checkov.common.bridgecrew.bc_source.SourceType', 'SourceType', (['"""Github"""', '(False)'], ... |
import argparse
from pathlib import Path
from cv2 import cv2
from trimap import generate_trimap
from trimap_output_utils import save_trimap_output
def main():
args = parse_args()
image_path = args.image
output_directory_path = args.output
image_path = Path(image_path)
if not image_path.is_file(... | [
"argparse.ArgumentParser",
"trimap.generate_trimap",
"trimap_output_utils.save_trimap_output",
"pathlib.Path"
] | [((273, 289), 'pathlib.Path', 'Path', (['image_path'], {}), '(image_path)\n', (277, 289), False, 'from pathlib import Path\n'), ((515, 581), 'trimap.generate_trimap', 'generate_trimap', (['saliency_image_path'], {'kernel_size': '(3)', 'iterations': '(20)'}), '(saliency_image_path, kernel_size=3, iterations=20)\n', (530... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from http.client import OK
from unittest.mock import MagicMock, patch
from urllib.parse import urlencode
import graphene_django.views as views
from django.urls import reverse
from graphql import GraphQLError
from graphql.error import GraphQLLocatedError
class CustomExce... | [
"unittest.mock.MagicMock",
"graphql.GraphQLError",
"graphql.error.GraphQLLocatedError",
"django.urls.reverse",
"urllib.parse.urlencode",
"unittest.mock.patch.object",
"unittest.mock.patch"
] | [((692, 750), 'unittest.mock.patch.object', 'patch.object', (['views.GraphQLView', '"""execute_graphql_request"""'], {}), "(views.GraphQLView, 'execute_graphql_request')\n", (704, 750), False, 'from unittest.mock import MagicMock, patch\n'), ((752, 789), 'unittest.mock.patch', 'patch', (['"""sentry_sdk.capture_exceptio... |
'''
(c) University of Liverpool 2020
Licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>..
@author: neilswainston
'''
# pylint: disable=broad-except
import os.path
import tempfile
from liv_covid19.web.artic import opentrons
from liv_covid19.web.job import JobT... | [
"liv_covid19.web.job.save_export",
"liv_covid19.web.job.JobThread.__init__",
"tempfile.mkdtemp",
"liv_covid19.web.artic.opentrons.run",
"tempfile.NamedTemporaryFile"
] | [((538, 594), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)', 'suffix': 'suffix'}), '(delete=False, suffix=suffix)\n', (565, 594), False, 'import tempfile\n'), ((876, 910), 'liv_covid19.web.job.JobThread.__init__', 'JobThread.__init__', (['self', 'query', '(1)'], {}), '(self, qu... |
# Copyright 2018 <NAME>.
#
# Licensed under the MIT License
import tensorflow as tf
DEFAULT_VARIABLE_NAMES = ['conv1', 'conv2', 'conv3', 'conv4', 'fc1', 'fc2', 'softmax_linear']
BATCH_SIZE = 200
IMAGE_WIDTH = 32
IMAGE_HEIGHT = 32
IMAGE_DEPTH = 3
NUM_CLASSES = 10
INPUT_PLACEHOLDER = 'X_INPUT'
LABELS_PLACEHOLDER = 'Y... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.variable_scope",
"tensorflow.nn.relu",
"tensorflow.placeholder",
"tensorflow.truncated_normal_initializer",
"tensorflow.matmul",
"tensorflow.constant_initializer",
"tensorflow.nn.bias_add"
] | [((377, 479), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DEPTH]'], {'name': 'INPUT_PLACEHOLDER'}), '(tf.float32, [None, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_DEPTH],\n name=INPUT_PLACEHOLDER)\n', (391, 479), True, 'import tensorflow as tf\n'), ((496, 553), 'tensor... |
import urwid
from scronsole.config_manager import ConfigManager
from scronsole.plugin_manager import PluginManager
from scronsole.widgets.main_menu import MainMenu
from scronsole.widgets.server_screen import ServerScreen
class MainScreen(urwid.WidgetPlaceholder):
def __init__(self):
super().__init__(urwi... | [
"urwid.SolidFill",
"scronsole.config_manager.ConfigManager",
"scronsole.widgets.main_menu.MainMenu",
"scronsole.widgets.server_screen.ServerScreen",
"scronsole.plugin_manager.PluginManager"
] | [((361, 376), 'scronsole.config_manager.ConfigManager', 'ConfigManager', ([], {}), '()\n', (374, 376), False, 'from scronsole.config_manager import ConfigManager\n'), ((430, 449), 'scronsole.plugin_manager.PluginManager', 'PluginManager', (['self'], {}), '(self)\n', (443, 449), False, 'from scronsole.plugin_manager imp... |
import re
from csv import reader
def splitEscaped(str, by, escapeChar):
infile = [str]
return reader(infile, delimiter=by, quotechar=escapeChar)
def removeComments(text):
p = r'/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|\'(\\.|[^\'\\])*\'|.[^/"\'\\]*)'
return ''.join(m.group(2) for m in re.finditer... | [
"re.sub",
"csv.reader",
"re.finditer"
] | [((103, 153), 'csv.reader', 'reader', (['infile'], {'delimiter': 'by', 'quotechar': 'escapeChar'}), '(infile, delimiter=by, quotechar=escapeChar)\n', (109, 153), False, 'from csv import reader\n'), ((397, 438), 're.sub', 're.sub', (['"""(/\\\\*@)(.*)(\\\\*/)"""', '"""@\\\\2"""', 'text'], {}), "('(/\\\\*@)(.*)(\\\\*/)',... |
#!/usr/bin/python
from ConfigUtils import getBaseConfig
from LogUtils import getModuleLogger
from StringUtils import isValidUrl, randomString
from urlparse import urlparse
import json
import os
import requests
import sys
cDir = os.path.dirname(os.path.realpath(__file__))
rootDir = os.path.abspath(os.path.join(cDir,... | [
"os.path.join",
"requests.get",
"ConfigUtils.getBaseConfig",
"os.path.realpath",
"LogUtils.getModuleLogger",
"StringUtils.isValidUrl",
"sys.exc_info"
] | [((346, 368), 'ConfigUtils.getBaseConfig', 'getBaseConfig', (['rootDir'], {}), '(rootDir)\n', (359, 368), False, 'from ConfigUtils import getBaseConfig\n'), ((379, 404), 'LogUtils.getModuleLogger', 'getModuleLogger', (['__name__'], {}), '(__name__)\n', (394, 404), False, 'from LogUtils import getModuleLogger\n'), ((248... |
from attempt.ddpg import HERDDPG, DDPG
import gym
import os
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
if __name__ == "__main__":
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
env = gym.make('FetchReach-v1')
agent = HERDDPG(env)
for epoch in range(2):
for cycle in tq... | [
"attempt.ddpg.HERDDPG",
"numpy.vstack",
"matplotlib.pyplot.title",
"gym.make",
"matplotlib.pyplot.show"
] | [((219, 244), 'gym.make', 'gym.make', (['"""FetchReach-v1"""'], {}), "('FetchReach-v1')\n", (227, 244), False, 'import gym\n'), ((257, 269), 'attempt.ddpg.HERDDPG', 'HERDDPG', (['env'], {}), '(env)\n', (264, 269), False, 'from attempt.ddpg import HERDDPG, DDPG\n'), ((488, 508), 'matplotlib.pyplot.title', 'plt.title', (... |
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Written (W) 2008-2009 <NAME>
# Copyright (C) ... | [
"os.path.join",
"os.walk"
] | [((2195, 2207), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (2202, 2207), False, 'import os\n'), ((2271, 2292), 'os.path.join', 'os.path.join', (['root', 'f'], {}), '(root, f)\n', (2283, 2292), False, 'import os\n')] |
"""Main farm access."""
from __future__ import annotations
import os
from datetime import datetime
from typing import Dict, Iterable, Iterator, List, Type, Union
from farmos_ext.area import Area
from farmos_ext.asset import Asset, Equipment, Planting
from farmos_ext.log import (Activity, Birth, Harvest, Input, Log, ... | [
"farmos_ext.term.CropFamily",
"os.path.exists",
"farmos_ext.term.Season",
"farmos_ext.term.Crop",
"farmos_ext.area.Area",
"farmos_ext.log.Seeding",
"farmos_ext.asset.Planting",
"farmos_ext.log.Transplanting",
"datetime.datetime.timestamp",
"farmos_ext.term.Unit",
"farmos_ext.log.Harvest"
] | [((1280, 1308), 'os.path.exists', 'os.path.exists', (['"""farmos.cfg"""'], {}), "('farmos.cfg')\n", (1294, 1308), False, 'import os\n'), ((11585, 11609), 'farmos_ext.asset.Planting', 'Planting', (['self'], {'keys': 'ret'}), '(self, keys=ret)\n', (11593, 11609), False, 'from farmos_ext.asset import Asset, Equipment, Pla... |
from telegram.ext import *
from telegram import *
import time
def start(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text="Hi 👋 I'm Rinkoglionito and I'm here because @OnyyTheBest had nothing to do ;-;. \n that said do the /cmds command to see the available commands")
cha... | [
"time.sleep"
] | [((2721, 2735), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (2731, 2735), False, 'import time\n')] |