code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# build_matrix.py
#
# <NAME>
# <EMAIL>
#
# APPM 4380: Project 3. Least Squares Inversion
# Code to build equation matrix.
#
# The Algorithm works by counting the number of points along the trajectory
# of the X-Ray in each grid-box. The number of points tallied correspond
# to the coefficient in the equation matrix.
#
... | [
"numpy.sqrt",
"numpy.tan",
"numpy.delete",
"numpy.linspace",
"numpy.zeros",
"numpy.all",
"numpy.genfromtxt"
] | [((1177, 1214), 'numpy.linspace', 'np.linspace', (['theta_i', 'theta_f', 'Ntheta'], {}), '(theta_i, theta_f, Ntheta)\n', (1188, 1214), True, 'import numpy as np\n'), ((1245, 1275), 'numpy.zeros', 'np.zeros', (['[m * Ntheta, N ** 2]'], {}), '([m * Ntheta, N ** 2])\n', (1253, 1275), True, 'import numpy as np\n'), ((1275,... |
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import math
'''
生成器
'''
print("============================生成器=========================")
# 这就是一个简单的生成器g,与列表生成式的区别在于括号,生成器是()
g = (math.pow(x, 2) for x in range(1, 10))
print(g)
for x in g:
print(x)
def f1(x):
n, y, z = 0, 0, 1
while n < x:
yiel... | [
"math.pow"
] | [((184, 198), 'math.pow', 'math.pow', (['x', '(2)'], {}), '(x, 2)\n', (192, 198), False, 'import math\n')] |
import datetime
import sqlalchemy as sa
from sqlalchemy import Integer
from karmabot.db.modelbase import SqlAlchemyBase
class KarmaTransaction(SqlAlchemyBase):
"""Models a karma transaction in the DB"""
__tablename__ = "karma_transaction"
id: int = sa.Column(
sa.BigInteger().with_variant(Integ... | [
"sqlalchemy.ForeignKey",
"sqlalchemy.Column",
"sqlalchemy.CheckConstraint",
"sqlalchemy.BigInteger"
] | [((618, 687), 'sqlalchemy.Column', 'sa.Column', (['sa.DateTime'], {'default': 'datetime.datetime.now', 'nullable': '(False)'}), '(sa.DateTime, default=datetime.datetime.now, nullable=False)\n', (627, 687), True, 'import sqlalchemy as sa\n'), ((702, 722), 'sqlalchemy.Column', 'sa.Column', (['sa.String'], {}), '(sa.Strin... |
from io import BytesIO
import discord
import requests
from discord.ext import commands
from PIL import Image
class ImageConvert:
"""
Convert images automatically.
"""
def __init__(self, bot):
self.bot = bot
print('Addon "{}" loaded'.format(self.__class__.__name__))
async def on_mes... | [
"io.BytesIO",
"requests.get"
] | [((522, 544), 'requests.get', 'requests.get', (["f['url']"], {}), "(f['url'])\n", (534, 544), False, 'import requests\n'), ((638, 647), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (645, 647), False, 'from io import BytesIO\n'), ((582, 610), 'io.BytesIO', 'BytesIO', (['img_request.content'], {}), '(img_request.content)\n... |
#!/usr/bin/env python3
# pylint: disable=too-many-instance-attributes
"""
Handling of logs and plots for learning
"""
import os
import sys
script_dir = os.path.dirname(__file__)
parent_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
sys.path.insert(1, parent_dir)
import shutil
import pickle
from dataclasse... | [
"sys.path.insert",
"matplotlib.pyplot.ylabel",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.fill_between",
"numpy.array",
"numpy.arange",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"matplotlib.pyplot.close",
"os.mkdir",
"numpy.min",
"matplotlib.pyp... | [((153, 178), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (168, 178), False, 'import os\n'), ((245, 275), 'sys.path.insert', 'sys.path.insert', (['(1)', 'parent_dir'], {}), '(1, parent_dir)\n', (260, 275), False, 'import sys\n'), ((208, 243), 'os.path.join', 'os.path.join', (['script_dir',... |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"getopt.getopt",
"vecs.Vecs",
"sys.exit"
] | [((1372, 1423), 'getopt.getopt', 'getopt', (['sys.argv[1:]', '""""""', "['embeddings=', 'vocab=']"], {}), "(sys.argv[1:], '', ['embeddings=', 'vocab='])\n", (1378, 1423), False, 'from getopt import GetoptError, getopt\n'), ((1755, 1766), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (1763, 1766), False, 'import sys\n... |
# Copyright 2018 Platform9 Systems, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wr... | [
"logging.getLogger",
"json.loads",
"unittest.mock.MagicMock",
"qbertconfig.cli.operation.fetch.Fetch",
"base64.b64decode",
"qbertconfig.kubeconfig.Kubeconfig",
"unittest.mock.patch",
"qbertconfig.qbertclient.QbertClient"
] | [((1090, 1117), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1107, 1117), False, 'import logging\n'), ((1163, 1216), 'unittest.mock.patch', 'patch', (['"""qbertconfig.qbertclient.QbertClient.__init__"""'], {}), "('qbertconfig.qbertclient.QbertClient.__init__')\n", (1168, 1216), False, ... |
from configHandler import loadConfigData
from clientClass import Client
def main():
mainConfig = loadConfigData("../../config.json")
PORT = mainConfig["PORT"]
SERVER_IP = mainConfig["SERVER_IP"]
SERVER_ADDRESS = (SERVER_IP, PORT)
client = Client(PORT, SERVER_IP, SERVER_ADDRESS)
client.sen... | [
"clientClass.Client",
"configHandler.loadConfigData"
] | [((102, 137), 'configHandler.loadConfigData', 'loadConfigData', (['"""../../config.json"""'], {}), "('../../config.json')\n", (116, 137), False, 'from configHandler import loadConfigData\n'), ((265, 304), 'clientClass.Client', 'Client', (['PORT', 'SERVER_IP', 'SERVER_ADDRESS'], {}), '(PORT, SERVER_IP, SERVER_ADDRESS)\n... |
from typing import List
from spacy.lang import char_classes
from spacy.symbols import ORTH
from spacy.tokenizer import Tokenizer
from spacy.util import compile_prefix_regex, compile_infix_regex, compile_suffix_regex
from spacy.language import Language
def remove_new_lines(text: str) -> str:
"""Used to preprocess ... | [
"spacy.lang.char_classes.HYPHENS.replace",
"spacy.lang.char_classes.LIST_QUOTES.copy",
"spacy.util.compile_prefix_regex",
"spacy.lang.char_classes.PUNCT.replace",
"spacy.util.compile_suffix_regex",
"spacy.tokenizer.Tokenizer",
"spacy.util.compile_infix_regex",
"spacy.lang.char_classes.split_chars"
] | [((1014, 1050), 'spacy.lang.char_classes.PUNCT.replace', 'char_classes.PUNCT.replace', (['"""|"""', '""" """'], {}), "('|', ' ')\n", (1040, 1050), False, 'from spacy.lang import char_classes\n'), ((2111, 2152), 'spacy.lang.char_classes.HYPHENS.replace', 'char_classes.HYPHENS.replace', (['"""-|"""', '""""""', '(1)'], {}... |
import pickle
from pathlib import Path
from datetime import datetime
import msgpack
from pydantic import BaseModel, ValidationError
class User(BaseModel):
id: int
name = '<NAME>'
signup_ts: datetime = None
m = User.parse_obj({'id': 123, 'name': 'James'})
print(m)
# > User id=123 name='James' signup_ts=Non... | [
"datetime.datetime",
"msgpack.packb",
"pathlib.Path"
] | [((656, 724), 'msgpack.packb', 'msgpack.packb', (["{'id': 123, 'name': 'James', 'signup_ts': 1500000000}"], {}), "({'id': 123, 'name': 'James', 'signup_ts': 1500000000})\n", (669, 724), False, 'import msgpack\n'), ((981, 1002), 'datetime.datetime', 'datetime', (['(2017)', '(7)', '(14)'], {}), '(2017, 7, 14)\n', (989, 1... |
from sevenbridges.meta.fields import (
StringField, DateTimeField, CompoundField, BooleanField
)
from sevenbridges.meta.resource import Resource
from sevenbridges.models.compound.jobs.job_docker import JobDocker
from sevenbridges.models.compound.jobs.job_instance import Instance
from sevenbridges.models.compound.jo... | [
"sevenbridges.meta.fields.CompoundField",
"sevenbridges.meta.fields.BooleanField",
"sevenbridges.meta.fields.StringField",
"sevenbridges.meta.fields.DateTimeField"
] | [((479, 506), 'sevenbridges.meta.fields.StringField', 'StringField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (490, 506), False, 'from sevenbridges.meta.fields import StringField, DateTimeField, CompoundField, BooleanField\n'), ((524, 553), 'sevenbridges.meta.fields.DateTimeField', 'DateTimeField', ([], {'r... |
import os
import csv
csvpath = os.path.join('Resources', 'budget_data.csv')
date_count = 0
total_profit_loss = 0
total_profit_loss_change = 0
previous_profit_loss = 867884
average_profit_loss_change = 0
profit_loss_change_list = []
profit_loss_date_list = []
with open(csvpath) as csvfile:
csvreader = csv.reader(... | [
"os.path.join",
"csv.reader"
] | [((32, 76), 'os.path.join', 'os.path.join', (['"""Resources"""', '"""budget_data.csv"""'], {}), "('Resources', 'budget_data.csv')\n", (44, 76), False, 'import os\n'), ((1665, 1708), 'os.path.join', 'os.path.join', (['"""Analysis"""', '"""budget_data.txt"""'], {}), "('Analysis', 'budget_data.txt')\n", (1677, 1708), Fals... |
import yaml
import os
from .graph import Greengraph
from nose.tools import assert_equal
def test_greeter():
with open(os.path.join(os.path.dirname(__file__),
'fixtures','samples.yaml')) as fixtures_file:
fixtures=yaml.load(fixtures_file)
for fixture in fixtures:
answer=fixtu... | [
"os.path.dirname",
"yaml.load"
] | [((238, 262), 'yaml.load', 'yaml.load', (['fixtures_file'], {}), '(fixtures_file)\n', (247, 262), False, 'import yaml\n'), ((136, 161), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (151, 161), False, 'import os\n')] |
from ldtcommon import ATTR_SURFACING_PROJECT
from ldtcommon import ATTR_SURFACING_OBJECT
from ldtcommon import TEXTURE_FILE_PATTERN
from ldt import context
from ldtui import qtutils
"""
.. module:: Maya import material
:synopsis: MayaTextureImport Plugin. Imports textureSets to maya Surfacing Projects
.. moduleauth... | [
"logging.getLogger",
"Qt.QtWidgets.QWidget",
"ldtui.qtutils.get_folder_path",
"Qt.QtWidgets.QPushButton",
"Qt.QtWidgets.QTableWidget",
"ldttextures.TextureFinder",
"Qt.QtWidgets.QLineEdit",
"ldt.context.dcc",
"os.path.basename",
"Qt.QtWidgets.QLabel",
"Qt.QtWidgets.QVBoxLayout"
] | [((595, 622), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (612, 622), False, 'import logging\n'), ((1059, 1072), 'ldt.context.dcc', 'context.dcc', ([], {}), '()\n', (1070, 1072), False, 'from ldt import context\n'), ((1713, 1732), 'Qt.QtWidgets.QWidget', 'QtWidgets.QWidget', ([], {}), ... |
import numpy as np
from scipy import linalg
from pressio4py import logger, solvers, ode
class MySys1:
def createResidual(self):
return np.zeros(5)
def createJacobian(self):
return np.zeros((5,2))
def residual(self, stateIn, R):
for i in range(5):
R[i] = float(i)
def jacobian(self, stateIn... | [
"pressio4py.logger.initialize",
"numpy.allclose",
"numpy.ones",
"pressio4py.logger.finalize",
"numpy.array",
"numpy.zeros",
"scipy.linalg.lapack.dgetrf",
"scipy.linalg.lapack.dgetrs",
"pressio4py.solvers.create_gauss_newton",
"pressio4py.logger.setVerbosity"
] | [((741, 781), 'pressio4py.logger.initialize', 'logger.initialize', (['logger.logto.terminal'], {}), '(logger.logto.terminal)\n', (758, 781), False, 'from pressio4py import logger, solvers, ode\n'), ((784, 828), 'pressio4py.logger.setVerbosity', 'logger.setVerbosity', (['[logger.loglevel.debug]'], {}), '([logger.logleve... |
from Bio.Restriction import *
import itertools
import pandas as pd
import git
# Find home directory for repo
repo = git.Repo("./", search_parent_directories=True)
homedir = repo.working_dir
enzyme_list = [(enzyme, enzyme.site) for enzyme in itertools.islice(CommOnly, len(CommOnly))]
pd.DataFrame(columns=["enzyme", "s... | [
"pandas.DataFrame",
"git.Repo"
] | [((117, 163), 'git.Repo', 'git.Repo', (['"""./"""'], {'search_parent_directories': '(True)'}), "('./', search_parent_directories=True)\n", (125, 163), False, 'import git\n'), ((286, 344), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['enzyme', 'site']", 'data': 'enzyme_list'}), "(columns=['enzyme', 'site'], da... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [
"pandas.read_csv",
"modin.pandas.Series",
"modin.pandas.read_csv",
"pyarrow.Table.from_pydict",
"numpy.int32",
"pandas.Index",
"modin.pandas.test.utils.df_equals",
"modin.pandas.concat",
"modin.pandas.utils.from_arrow",
"pandas.MultiIndex.from_tuples",
"numpy.arange",
"pandas.to_datetime",
"... | [((1116, 1140), 'modin.config.IsExperimental.put', 'IsExperimental.put', (['(True)'], {}), '(True)\n', (1134, 1140), False, 'from modin.config import IsExperimental, Engine, StorageFormat\n'), ((1141, 1161), 'modin.config.Engine.put', 'Engine.put', (['"""native"""'], {}), "('native')\n", (1151, 1161), False, 'from modi... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | [
"logging.getLogger"
] | [((633, 660), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (650, 660), False, 'import logging\n')] |
#! /usr/bin/env python3
"""This module defines the utility functionalities for the pub-sub-python
"""
__all__ = [
'get_unique_id',
'import_string',
]
__version__ = '1.0.0.1'
__author__ = '<NAME> <<EMAIL>>'
__maintainers__ = [
'<NAME> <<EMAIL>>',
]
from hashlib import (
md5,
)
from importlib import (... | [
"importlib.import_module"
] | [((1047, 1068), 'importlib.import_module', 'import_module', (['m_path'], {}), '(m_path)\n', (1060, 1068), False, 'from importlib import import_module\n')] |
import ns.network
import ns.internet
import ns.energy
import sys
from base import __Base, _Base, _Iter
class Agent(_Base, _Iter):
def __init__(self, numNodes=1, systemId=0, name="agent", \
initialEnergy=50000000, updateIntervalS=1, config_flag=True, install_flag=True, *args, **kwargs):
"""
Agent is eithe... | [
"base._Iter.__init__"
] | [((958, 990), 'base._Iter.__init__', '_Iter.__init__', (['self', 'self.nodes'], {}), '(self, self.nodes)\n', (972, 990), False, 'from base import __Base, _Base, _Iter\n')] |
import bitmath
import ipaddress
import re
from ipaddress import AddressValueError
from insights.parsers.installed_rpms import InstalledRpm
from kerlescan.constants import SYSTEM_ID_KEY
from kerlescan.constants import SYSTEM_PROFILE_STRINGS, SYSTEM_PROFILE_INTEGERS
from kerlescan.constants import SYSTEM_PROFILE_BOOLEA... | [
"ipaddress.IPv6Address",
"insights.parsers.installed_rpms.InstalledRpm.from_package",
"re.match",
"kerlescan.exceptions.UnparsableNEVRAError",
"bitmath.format",
"bitmath.Byte"
] | [((5774, 5806), 're.match', 're.match', (['"""^[0-9]+:"""', 'rpm_string'], {}), "('^[0-9]+:', rpm_string)\n", (5782, 5806), False, 'import re\n'), ((4411, 4455), 'bitmath.format', 'bitmath.format', ([], {'fmt_str': '"""{value:.2f} {unit}"""'}), "(fmt_str='{value:.2f} {unit}')\n", (4425, 4455), False, 'import bitmath\n'... |
import os
# from funcy import distinct, remove
from .helpers import fix_assets_path, array_from_string, parse_boolean, int_or_none, set_from_string
from .organization import *
from .callbacks import *
from .crypt import *
from .debug import *
from .identifiers import *
from .jsonschema import *
from .mongo import *
de... | [
"os.environ.get"
] | [((796, 865), 'os.environ.get', 'os.environ.get', (['"""CATALOG_STORAGE_SYSTEM"""', 'TACC_PRIMARY_STORAGE_SYSTEM'], {}), "('CATALOG_STORAGE_SYSTEM', TACC_PRIMARY_STORAGE_SYSTEM)\n", (810, 865), False, 'import os\n'), ((897, 952), 'os.environ.get', 'os.environ.get', (['"""CATALOG_STORAGE_MANAGED_VERSION"""', '"""v2"""']... |
import sqlite3 as sl
class Database():
def __init__(self):
self.database = sl.connect('database.db')
self.database.execute("""
CREATE TABLE IF NOT EXISTS MATERIAL (
nome TEXT,
rho INTEGER,
E FLOAT
);
""")
# def materials_d... | [
"sqlite3.connect"
] | [((88, 113), 'sqlite3.connect', 'sl.connect', (['"""database.db"""'], {}), "('database.db')\n", (98, 113), True, 'import sqlite3 as sl\n')] |
__author__ = ["<NAME>"]
__email__ = ["<EMAIL>"]
__status__ = "Prototype"
""" Path handler. """
import os
import shutil
from datetime import datetime
from vscvs.settings import CHECKPOINT_NAME_FORMAT
from vscvs.settings import ROOT_DIR
def get_path(*paths):
"""Get the path of a file or directory by joining t... | [
"os.makedirs",
"os.path.join",
"datetime.datetime.now",
"shutil.rmtree",
"os.walk"
] | [((591, 637), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""data"""', "*(paths or '')"], {}), "(ROOT_DIR, 'data', *(paths or ''))\n", (603, 637), False, 'import os\n'), ((691, 705), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (703, 705), False, 'from datetime import datetime\n'), ((1186, 1200), 'date... |
# Copyright 2019 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... | [
"importlib.import_module"
] | [((2118, 2161), 'importlib.import_module', 'import_module', (['"""mindinsight.utils.constant"""'], {}), "('mindinsight.utils.constant')\n", (2131, 2161), False, 'from importlib import import_module\n')] |
def load_dataset_with_preprocess(dataset):
import pandas as pd
import helper
# import importlib
# importlib.reload(..helper)
X=pd.read_csv(f"../../../datasets/cleaned/{dataset}_X.csv")
X = X.drop("Unnamed: 0", axis=1)
y = pd.read_csv(f"../../../datasets/cleaned/{dataset}_y.csv")
y = y.d... | [
"helper.select_preprocessing_for_many_feat",
"pandas.read_csv"
] | [((148, 205), 'pandas.read_csv', 'pd.read_csv', (['f"""../../../datasets/cleaned/{dataset}_X.csv"""'], {}), "(f'../../../datasets/cleaned/{dataset}_X.csv')\n", (159, 205), True, 'import pandas as pd\n'), ((251, 308), 'pandas.read_csv', 'pd.read_csv', (['f"""../../../datasets/cleaned/{dataset}_y.csv"""'], {}), "(f'../..... |
from django.views.generic import ListView
import pymongo
from nosqladmin.mixins import NosqlAdminViewMixin
# TODO Move this to settings or something...
# TODO Move this to settings or something...
# TODO Move this to settings or something...
from pymongo import Connection
from pymongo.errors import CollectionInvalid... | [
"pymongo.Connection"
] | [((334, 346), 'pymongo.Connection', 'Connection', ([], {}), '()\n', (344, 346), False, 'from pymongo import Connection\n')] |
from pathlib import Path
import json
from django.core.management import call_command
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
import pytest
from geocontrib.models.project import Project
from geocontrib.models.user import UserLevelPermission
from geocontrib.models.u... | [
"pytest.mark.freeze_time",
"django.core.management.call_command",
"pathlib.Path",
"pytest.mark.skip",
"json.load",
"geocontrib.models.user.User.objects.get",
"json.dump"
] | [((645, 1235), 'pytest.mark.skip', 'pytest.mark.skip', (['"""\n Test en echec : il faidrait lancer celery avec la conf de test \n ou regarder la doc celery pour le tester\n\n On peut lancer le test à la main comme ça\n curl --user admin:passpass \'http... |
import fileinput
def solve(n, m):
accuml = []
for i in range(n + 1):
accuml.append([0] * (n + 1))
# print(accuml)
for c in range(n):
for r in range(n):
accuml[r + 1][c + 1] = accuml[r][c + 1] + sum(m[r*n : r*n + c + 1])
#Calculate the sum of a sub-rectangle from col1... | [
"fileinput.input"
] | [((1345, 1362), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (1360, 1362), False, 'import fileinput\n')] |
#
# a wrapper module for pycryptodome.
#
from Crypto.Cipher import AES
class AES_ECB():
def __init__(self, key):
"""
key: 8 bytes of bytearray
"""
self.aes_ecb = AES.new(key, AES.MODE_ECB)
def encrypt(self, data):
"""
data: any size of bytearray. expanded into 1... | [
"Crypto.Cipher.AES.new"
] | [((199, 225), 'Crypto.Cipher.AES.new', 'AES.new', (['key', 'AES.MODE_ECB'], {}), '(key, AES.MODE_ECB)\n', (206, 225), False, 'from Crypto.Cipher import AES\n')] |
from django.contrib import admin
# Register your models here.
from .models import ci_cd_info
class info(admin.ModelAdmin):
list_display = ['ID','requestid','xiang_mu','date','jar_pack','jar_url','status']
list_filter = ['xiang_mu']
search_fields = ['jar_pack'] # display 展示表字段,filter过滤分类,search搜索内容
admin.... | [
"django.contrib.admin.site.register"
] | [((314, 351), 'django.contrib.admin.site.register', 'admin.site.register', (['ci_cd_info', 'info'], {}), '(ci_cd_info, info)\n', (333, 351), False, 'from django.contrib import admin\n')] |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Test Mapping Issue mapping"""
from ddt import data, ddt, unpack
from ggrc.app import app # NOQA pylint: disable=unused-import
from ggrc.models import all_models
from integration.ggrc import TestCase
fro... | [
"ggrc.models.all_models.Relationship.query.filter_by",
"integration.ggrc.models.factories.RelationshipFactory",
"integration.ggrc.models.factories.AccessControlPersonFactory",
"integration.ggrc.models.factories.PersonFactory",
"integration.ggrc.models.factories.AuditFactory",
"integration.ggrc.models.fact... | [((3280, 3379), 'ddt.data', 'data', (["('auditor', True)", "('programeditor', True)", "('auditor', False)", "('programeditor', False)"], {}), "(('auditor', True), ('programeditor', True), ('auditor', False), (\n 'programeditor', False))\n", (3284, 3379), False, 'from ddt import data, ddt, unpack\n'), ((1833, 1859), ... |
import json
from uuid import UUID
from pymongo import MongoClient
data = {}
def _convertForJson(d):
for k,v in d.items():
if isinstance(v, UUID):
d[k] = str(v)
if isinstance(v, list):
v = [str(s) for s in v]
d[k] = v
return d
db = MongoClient().artifact_databa... | [
"pymongo.MongoClient",
"json.dump"
] | [((291, 304), 'pymongo.MongoClient', 'MongoClient', ([], {}), '()\n', (302, 304), False, 'from pymongo import MongoClient\n'), ((476, 512), 'json.dump', 'json.dump', (["data['gem5Data']", 'outfile'], {}), "(data['gem5Data'], outfile)\n", (485, 512), False, 'import json\n')] |
"""GUIのバリデーター
GUIの入力パラメーターのバリデーターチェックを行う
"""
import os
from app_constants import (
FILE_TYPES,
INPUT_ERROR,
IS_NOT_DIR_MESSAGE,
SELECT_DIR_MESSAGE,
FILE_TYPE_IS_NOT_CHOSEN_MESSAGE,
FILE_TYPE_IS_NOT_IN_THE_LIST_MESSAGE
)
class ValidateError(Exception):
"""エラーになったときの例外クラス
エラーになったときに投... | [
"app_constants.SELECT_DIR_MESSAGE.format",
"os.path.isdir",
"app_constants.IS_NOT_DIR_MESSAGE.format"
] | [((1208, 1232), 'os.path.isdir', 'os.path.isdir', (['file_path'], {}), '(file_path)\n', (1221, 1232), False, 'import os\n'), ((1612, 1647), 'app_constants.SELECT_DIR_MESSAGE.format', 'SELECT_DIR_MESSAGE.format', (['dir_type'], {}), '(dir_type)\n', (1637, 1647), False, 'from app_constants import FILE_TYPES, INPUT_ERROR,... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
url(r'^admin/', include(admin.site.urls)),
url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
url(r'^calls/$', 'calls.views.call'),
)
| [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((249, 284), 'django.conf.urls.url', 'url', (['"""^calls/$"""', '"""calls.views.call"""'], {}), "('^calls/$', 'calls.views.call')\n", (252, 284), False, 'from django.conf.urls import patterns, include, url\n'), ((149, 173), 'django.conf.urls.include', 'include', (['admin.site.urls'], {}), '(admin.site.urls)\n', (156, ... |
"""
Encapsulates external dependencies to retrieve hardware metadata
"""
import os
import re
import subprocess
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Iterable, List, Optional, Tuple
import psutil
from codecarbon.core.cpu import IntelPowerGadget, IntelRAPL
from ... | [
"subprocess.check_output",
"codecarbon.core.cpu.IntelPowerGadget",
"codecarbon.core.units.Time.from_seconds",
"psutil.Process",
"codecarbon.core.gpu.get_gpu_details",
"re.match",
"codecarbon.core.units.Energy.from_energy",
"codecarbon.core.util.detect_cpu_model",
"codecarbon.external.logger.logger.w... | [((1746, 1763), 'codecarbon.core.gpu.get_gpu_details', 'get_gpu_details', ([], {}), '()\n', (1761, 1763), False, 'from codecarbon.core.gpu import get_gpu_details\n'), ((3985, 4008), 'codecarbon.core.units.Power.from_watts', 'Power.from_watts', (['power'], {}), '(power)\n', (4001, 4008), False, 'from codecarbon.core.uni... |
import sys
import numpy as np
import pandas as pd
from pspy import so_dict, so_map
d = so_dict.so_dict()
d.read_from_file(sys.argv[1])
binary = so_map.read_map(d["template"])
if binary.data.ndim > 2:
# Only use temperature
binary.data = binary.data[0]
binary.data = binary.data.astype(np.int16)
binary.data[:]... | [
"pspy.so_dict.so_dict",
"pandas.read_csv",
"pspy.so_map.read_map",
"numpy.deg2rad",
"pandas.read_table"
] | [((89, 106), 'pspy.so_dict.so_dict', 'so_dict.so_dict', ([], {}), '()\n', (104, 106), False, 'from pspy import so_dict, so_map\n'), ((147, 177), 'pspy.so_map.read_map', 'so_map.read_map', (["d['template']"], {}), "(d['template'])\n", (162, 177), False, 'from pspy import so_dict, so_map\n'), ((424, 489), 'pandas.read_ta... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import boto3
import requests
import json
import time
GAME_NAME = '<REPLACE_WITH_YOUR_GAME_NAME>'
REGION = '<REPLACE_WITH_YOUR_REGION>'
USER_POOL_NAME = GAME_NAME + 'UserPool'
USER_POOL_CLIENT_NAME = GAME_NAME + 'Use... | [
"json.loads",
"requests.post",
"boto3.client",
"json.dumps",
"time.sleep"
] | [((531, 578), 'boto3.client', 'boto3.client', (['"""cognito-idp"""'], {'region_name': 'REGION'}), "('cognito-idp', region_name=REGION)\n", (543, 578), False, 'import boto3\n'), ((586, 632), 'boto3.client', 'boto3.client', (['"""apigateway"""'], {'region_name': 'REGION'}), "('apigateway', region_name=REGION)\n", (598, 6... |
from .models import Measures
from rest_framework import serializers
class MeasuresSerializer(serializers.ModelSerializer):
measure_type_name = serializers.CharField(source='measure_type_id.measure_name', read_only=True)
incident_category_name = serializers.CharField(source='incident_category.incident_category'... | [
"rest_framework.serializers.CharField"
] | [((148, 224), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""measure_type_id.measure_name"""', 'read_only': '(True)'}), "(source='measure_type_id.measure_name', read_only=True)\n", (169, 224), False, 'from rest_framework import serializers\n'), ((254, 341), 'rest_framework.serializ... |
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from .jamspell import JamspellCorrector
from .gector import Gector
from .morphosyntactic_feedback import Feedback
from pprint import pprint
class Gecko():
def __init__(self) -> None:
print("Loading Jamspell...")
self.j... | [
"warnings.simplefilter"
] | [((16, 78), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (37, 78), False, 'import warnings\n')] |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"numpy.log10",
"numpy.sqrt",
"numpy.argsort",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.where",
"numpy.tanh",
"numpy.max",
"numpy.dot",
"numpy.linalg.lstsq",
"numpy.min",
"numpy.linalg.eigh",
"numpy.eye",
"numpy.ones",
"numpy.squeeze",
"numpy.t... | [((1461, 1472), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (1469, 1472), True, 'import numpy as np\n'), ((6899, 6948), 'numpy.array', 'np.array', (['[datum_b_c for datum_b_c in data_a_b_c]'], {}), '([datum_b_c for datum_b_c in data_a_b_c])\n', (6907, 6948), True, 'import numpy as np\n'), ((6964, 7004), 'numpy.tra... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"logging.getLogger",
"superset.extensions.celery_app.task",
"superset.security_manager.find_user",
"superset.utils.screenshots.DashboardScreenshot",
"logging.warning",
"superset.utils.screenshots.ChartScreenshot",
"superset.app.app_context"
] | [((1144, 1171), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1161, 1171), False, 'import logging\n'), ((1175, 1241), 'superset.extensions.celery_app.task', 'celery_app.task', ([], {'name': '"""cache_chart_thumbnail"""', 'soft_time_limit': '(300)'}), "(name='cache_chart_thumbnail', soft... |
import spacy
import re
import string
import gensim
from gensim.utils import simple_preprocess
from collections import Counter
from string import punctuation
nlp = spacy.load("en_core_web_sm")
def text_preproc(x):
x = x.lower()
#x = ' '.join([word for word in x.split(' ') if word not in stop_words])
x = x.... | [
"spacy.load",
"re.sub",
"re.escape",
"collections.Counter"
] | [((163, 191), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (173, 191), False, 'import spacy\n'), ((363, 391), 're.sub', 're.sub', (['"""https*\\\\S+"""', '""" """', 'x'], {}), "('https*\\\\S+', ' ', x)\n", (369, 391), False, 'import re\n'), ((400, 423), 're.sub', 're.sub', (['"""@... |
#!/usr/bin/env python
"""Cloudflare API code - example"""
from __future__ import print_function
import os
import sys
import re
import json
import requests
sys.path.insert(0, os.path.abspath('..'))
import CloudFlare
def my_ip_address():
"""Cloudflare API code - example"""
# This list is adjustable - plus so... | [
"os.path.abspath",
"CloudFlare.CloudFlare",
"requests.get"
] | [((177, 198), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (192, 198), False, 'import os\n'), ((3522, 3545), 'CloudFlare.CloudFlare', 'CloudFlare.CloudFlare', ([], {}), '()\n', (3543, 3545), False, 'import CloudFlare\n'), ((540, 557), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (5... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import Pmf
import first
def ProbEarly(pmf):
"""
<= 37
"""
rate = 0.0
for w, p in pmf.Items():
if w > 37:
continue
rate += p
return rate
def ProbOnTime(pmf):
"""
38, 39, 40
"""
rate = 0.0
for w, p in pmf... | [
"Pmf.MakePmfFromList",
"first.MakeTables"
] | [((888, 920), 'first.MakeTables', 'first.MakeTables', ([], {'data_dir': '"""res"""'}), "(data_dir='res')\n", (904, 920), False, 'import first\n'), ((1052, 1104), 'Pmf.MakePmfFromList', 'Pmf.MakePmfFromList', (['firsts.prglengths'], {'name': '"""first"""'}), "(firsts.prglengths, name='first')\n", (1071, 1104), False, 'i... |
import sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle, PathPatch
from scipy.sparse import csr_matrix, coo_matrix
from scipy.sparse.csgraph import dijkstra
from timeit import default_timer as timer
from mpl_toolkits.mplot3d import axes3d
import mpl_toolk... | [
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.use",
"timeit.default_timer",
"numpy.floor",
"scipy.sparse.csgraph.dijkstra",
"numpy.dot",
"numpy.zeros",
"matplotlib.pyplot.figure",
"mpl_toolkits.mplot3d.art3d.pathpatch_2d_to_3d",
"scipy.sparse.coo_matrix... | [((348, 371), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (362, 371), False, 'import matplotlib\n'), ((2255, 2307), 'numpy.zeros', 'np.zeros', (['(self.n_x + 1, self.n_y + 1, self.n_z + 1)'], {}), '((self.n_x + 1, self.n_y + 1, self.n_z + 1))\n', (2263, 2307), True, 'import numpy as np\n')... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
def plot_2ala_ramachandran(traj, ax=None, weights=None):
import mdtraj as md
if ax == None:
ax = plt.gca()
if isinstance(weights, np.ndarray):
ax.hist2d(
md.compute_phi(traj)[1].reshape(-1),
... | [
"matplotlib.pyplot.gca",
"mdtraj.compute_psi",
"numpy.linspace",
"mdtraj.compute_phi",
"matplotlib.colors.LogNorm"
] | [((192, 201), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (199, 201), True, 'import matplotlib.pyplot as plt\n'), ((460, 480), 'matplotlib.colors.LogNorm', 'mpl.colors.LogNorm', ([], {}), '()\n', (478, 480), True, 'import matplotlib as mpl\n'), ((748, 768), 'matplotlib.colors.LogNorm', 'mpl.colors.LogNorm', (... |
import aoc_cas.aoc2021.day1 as aoc
testData = """
199
200
208
210
200
207
240
269
260
263
""".strip()
def testPart1():
assert aoc.part1(testData) == 7
def testPart2():
assert aoc.part2(testData) == 5
| [
"aoc_cas.aoc2021.day1.part2",
"aoc_cas.aoc2021.day1.part1"
] | [((173, 192), 'aoc_cas.aoc2021.day1.part1', 'aoc.part1', (['testData'], {}), '(testData)\n', (182, 192), True, 'import aoc_cas.aoc2021.day1 as aoc\n'), ((228, 247), 'aoc_cas.aoc2021.day1.part2', 'aoc.part2', (['testData'], {}), '(testData)\n', (237, 247), True, 'import aoc_cas.aoc2021.day1 as aoc\n')] |
import numpy as np
from pandas.tests.frame.test_join import frame
import niipy as nii
from rw_segmenter import rw_segment
# Folder path of dataset
FOLDER_PATH= "/scratch/bmustafa/datasets/ACDC/ACDC_challenge_20170617/"
# Threshold for probabilties returned by random walk algorithm
THRESHOLD = 0.7
# Gradient penalisati... | [
"niipy.save_nii",
"rw_segmenter.rw_segment",
"niipy.load_nii"
] | [((983, 1007), 'niipy.load_nii', 'nii.load_nii', (['frame_path'], {}), '(frame_path)\n', (995, 1007), True, 'import niipy as nii\n'), ((1082, 1105), 'niipy.load_nii', 'nii.load_nii', (['mask_path'], {}), '(mask_path)\n', (1094, 1105), True, 'import niipy as nii\n'), ((1118, 1177), 'rw_segmenter.rw_segment', 'rw_segment... |
import os
import unittest
from datetime import date
from mining.cmd_executor import FileCommandOutputConsumer
class FileCommandOutputConsumerTestCase(unittest.TestCase):
def test_consum_output_line_1(self):
file_name = 'mining.log'
file_name_2 = 'mining_' + str(date.today()) + '.log'
out... | [
"unittest.main",
"datetime.date.today",
"mining.cmd_executor.FileCommandOutputConsumer",
"os.remove"
] | [((1194, 1209), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1207, 1209), False, 'import unittest\n'), ((366, 402), 'mining.cmd_executor.FileCommandOutputConsumer', 'FileCommandOutputConsumer', (['file_name'], {}), '(file_name)\n', (391, 402), False, 'from mining.cmd_executor import FileCommandOutputConsumer\n'... |
"""
Copyright 2018 Lambda Labs. All Rights Reserved.
Licensed under
==========================================================================
"""
import tensorflow as tf
from .callback import Callback
class EvalAccuracy(Callback):
def __init__(self, config):
super(EvalAccuracy, self).__init__(config)
def ... | [
"tensorflow.get_default_graph"
] | [((361, 383), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (381, 383), True, 'import tensorflow as tf\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("msgs", "0009_label_migrate_pt1"), ("cases", "0024_label_migrate_pt3")]
operations = [
migrations.RemoveField(model_name="messageaction", ... | [
"django.db.migrations.RemoveField",
"django.db.migrations.RenameField"
] | [((269, 333), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""messageaction"""', 'name': '"""label"""'}), "(model_name='messageaction', name='label')\n", (291, 333), False, 'from django.db import migrations, models\n'), ((343, 437), 'django.db.migrations.RenameField', 'migrations.R... |
#!/usr/bin/env python3
import re
import csv
import glob
from matplotlib import pyplot as plt
from matplotlib.ticker import FuncFormatter
from adjustText import adjust_text
compilePlots = [
[ "XXD, random data", "work/compile-times-xxd-random.csv" ],
[ "XXD, text data", "work/compile-... | [
"matplotlib.pyplot.text",
"csv.DictReader",
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"re.compile",
"matplotlib.ticker.FuncFormatter",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"glob.iglo... | [((1699, 1717), 'adjustText.adjust_text', 'adjust_text', (['texts'], {}), '(texts)\n', (1710, 1717), False, 'from adjustText import adjust_text\n'), ((1898, 1927), 'matplotlib.pyplot.xticks', 'plt.xticks', (['keys'], {'rotation': '(40)'}), '(keys, rotation=40)\n', (1908, 1927), True, 'from matplotlib import pyplot as p... |
from src.apps.prescriptionapp.models import *
from tortoise.contrib.pydantic import pydantic_model_creator
#######clinic########
Create_Clinic = pydantic_model_creator(
Clinic, name="ClinicGet", exclude=("timings", "created", "updated", "id", "clinicTimings", "clinic_images"))
Create_Recopinist = pydantic_model_c... | [
"tortoise.contrib.pydantic.pydantic_model_creator"
] | [((147, 282), 'tortoise.contrib.pydantic.pydantic_model_creator', 'pydantic_model_creator', (['Clinic'], {'name': '"""ClinicGet"""', 'exclude': "('timings', 'created', 'updated', 'id', 'clinicTimings', 'clinic_images')"}), "(Clinic, name='ClinicGet', exclude=('timings',\n 'created', 'updated', 'id', 'clinicTimings',... |
# Implementation of simply command-line parser
# New commands added by providing method which accepts argument list as its only argument
import sys
import threading
import traceback
# Class to implement either Boolean or integer-valued options. Value
# displayed as integer, with 0 for False and 1 for True for Boolea... | [
"threading.Lock",
"traceback.format_exc",
"sys.stdout.write"
] | [((1792, 1808), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1806, 1808), False, 'import threading\n'), ((3182, 3205), 'traceback.format_exc', 'traceback.format_exc', (['(6)'], {}), '(6)\n', (3202, 3205), False, 'import traceback\n'), ((4392, 4421), 'sys.stdout.write', 'sys.stdout.write', (['self.prompt'], {}... |
import pandas as pd
import os
# from prettytable import PrettyTable
class EDF:
"""Experiment Description File Parser
Attributes:
ACTIONS (Object): Contains all the actions data in the file
AREAS (Object): Contains all the Areas data in the file
CONSTRAINTS (Object): Contains all the c... | [
"pandas.DataFrame",
"os.path.abspath",
"os.path.basename",
"os.path.join"
] | [((12392, 12422), 'pandas.DataFrame', 'pd.DataFrame', (['self._data_buses'], {}), '(self._data_buses)\n', (12404, 12422), True, 'import pandas as pd\n'), ((15808, 15853), 'pandas.DataFrame', 'pd.DataFrame', (['self._data_stores'], {'columns': 'cols'}), '(self._data_stores, columns=cols)\n', (15820, 15853), True, 'impor... |
# coding=utf-8
"""
Shells out to get ipvs statistics, which may or may not require sudo access
#### Dependencies
* /usr/sbin/ipvsadmin
"""
import diamond.collector
import subprocess
import os
import string
from diamond.collector import str_to_bool
class IPVSCollector(diamond.collector.Collector):
def __ini... | [
"subprocess.Popen",
"os.access",
"diamond.collector.str_to_bool",
"string.replace"
] | [((577, 613), 'diamond.collector.str_to_bool', 'str_to_bool', (["self.config['use_sudo']"], {}), "(self.config['use_sudo'])\n", (588, 613), False, 'from diamond.collector import str_to_bool\n'), ((843, 897), 'subprocess.Popen', 'subprocess.Popen', (['self.command'], {'stdout': 'subprocess.PIPE'}), '(self.command, stdou... |
import json
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
cookie = self.get_secure_cookie("sessionId", max_age_days=1, min_version=1)
if cookie != None:
cookie = cookie.decode('utf-8')
cookie = json.loads(cookie)
return... | [
"json.loads"
] | [((287, 305), 'json.loads', 'json.loads', (['cookie'], {}), '(cookie)\n', (297, 305), False, 'import json\n')] |
import cv2
#fetching the image
img =cv2.imread("image.jpg")
#giving the color changes
gray=cv2.cvtColor(img,cv2.COLOR_BGRA2GRAY)
gray=cv2.medianBlur(gray,9)
edges=cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,13,6)
color=cv2.bilateralFilter(img,9,250,250)
cartoon=cv2.bitwise_and(color,co... | [
"cv2.bilateralFilter",
"cv2.bitwise_and",
"cv2.medianBlur",
"cv2.imshow",
"cv2.adaptiveThreshold",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.imread"
] | [((38, 61), 'cv2.imread', 'cv2.imread', (['"""image.jpg"""'], {}), "('image.jpg')\n", (48, 61), False, 'import cv2\n'), ((93, 131), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGRA2GRAY'], {}), '(img, cv2.COLOR_BGRA2GRAY)\n', (105, 131), False, 'import cv2\n'), ((136, 159), 'cv2.medianBlur', 'cv2.medianBlur', (... |
import autograd.numpy as anp
import numpy as np
from numpy import linalg as LA
from pymoo.util.misc import stack
from pymoo.model.problem import Problem
class Lamp(Problem):
def __init__(self, focal_z):
super().__init__(n_var=21,
n_obj=3,
n_constr=0,
xl=anp.array(21*[0]),
xu=anp.array(21*[1])... | [
"numpy.reshape",
"numpy.ones",
"autograd.numpy.column_stack",
"autograd.numpy.array",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.empty_like",
"numpy.concatenate",
"numpy.linalg.norm"
] | [((673, 724), 'numpy.array', 'np.array', (['[2 * scale, 2 * scale, self.focalPoint_z]'], {}), '([2 * scale, 2 * scale, self.focalPoint_z])\n', (681, 724), True, 'import numpy as np\n'), ((1124, 1154), 'autograd.numpy.column_stack', 'anp.column_stack', (['[f1, f2, f3]'], {}), '([f1, f2, f3])\n', (1140, 1154), True, 'imp... |
import datetime
from jinja2 import Environment, Undefined
import json
import yaml
import os
import uuid
import collections
from typing import List, Tuple, Dict, Optional, TypeVar
import attr
import logging
from openlineage.client.facet import DataSourceDatasetFacet, SchemaDatasetFacet, SchemaField, \
SqlJobFace... | [
"logging.getLogger",
"openlineage.common.utils.get_from_multiple_chains",
"jinja2.Environment",
"yaml.load",
"openlineage.client.facet.ParentRunFacet.create",
"attr.ib",
"openlineage.client.facet.SchemaField",
"logging.NullHandler",
"uuid.uuid4",
"openlineage.client.facet.OutputStatisticsOutputDat... | [((3262, 3274), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (3269, 3274), False, 'from typing import List, Tuple, Dict, Optional, TypeVar\n'), ((1247, 1256), 'attr.ib', 'attr.ib', ([], {}), '()\n', (1254, 1256), False, 'import attr\n'), ((1292, 1313), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '(de... |
"""plotlib.py: Module is used to plotting tools"""
__author__ = "<NAME>."
__copyright__ = ""
__credits__ = []
__license__ = "MIT"
__version__ = "1.0."
__maintainer__ = "<NAME>."
__email__ = "<EMAIL>"
__status__ = "Research"
import matplotlib as mpl
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as ... | [
"numpy.abs",
"matplotlib.rcParams.update",
"matplotlib.use",
"matplotlib.pyplot.style.use",
"numpy.min",
"numpy.max",
"matplotlib.pyplot.close",
"numpy.angle",
"matplotlib.pyplot.figure",
"scipy.stats.pearsonr",
"matplotlib.pyplot.subplots"
] | [((270, 291), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (284, 291), False, 'import matplotlib\n'), ((325, 359), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['science', 'ieee']"], {}), "(['science', 'ieee'])\n", (338, 359), True, 'import matplotlib.pyplot as plt\n'), ((3478, 3566), 'ma... |
# coding: utf-8
address = 'http://192.168.1.69:5555'
token = '<KEY>'
team_name = 'max'
workspace_name = 'script1'
src_project_name = 'lemons_annotated'
dst_project_name = 'lemons_train_detection'
validation_portion = 0.05
multiplier = 5
import supervisely_lib as sly
from tqdm import tqdm
import random
api = sly.Api... | [
"supervisely_lib.ProjectMeta",
"supervisely_lib.Api",
"supervisely_lib.aug.random_crop_fraction",
"supervisely_lib.TagMeta",
"random.random",
"supervisely_lib.Annotation.from_json",
"supervisely_lib.ProjectMeta.from_json",
"supervisely_lib.ObjClass",
"supervisely_lib.aug.fliplr"
] | [((313, 336), 'supervisely_lib.Api', 'sly.Api', (['address', 'token'], {}), '(address, token)\n', (320, 336), True, 'import supervisely_lib as sly\n'), ((594, 634), 'supervisely_lib.ProjectMeta.from_json', 'sly.ProjectMeta.from_json', (['src_meta_json'], {}), '(src_meta_json)\n', (619, 634), True, 'import supervisely_l... |
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import Message
from aiogram_dialog import Dialog, Window, DialogManager
from aiogram_dialog.tools import render_transitions
from aiogram_dialog.widgets.input import MessageInput
from aiogram_dialog.widgets.kbd import Next, Back
from aio... | [
"aiogram_dialog.widgets.input.MessageInput",
"aiogram_dialog.widgets.text.Const",
"aiogram.dispatcher.filters.state.State",
"aiogram_dialog.widgets.kbd.Next",
"aiogram_dialog.widgets.kbd.Back",
"aiogram_dialog.tools.render_transitions"
] | [((964, 992), 'aiogram_dialog.tools.render_transitions', 'render_transitions', (['[dialog]'], {}), '([dialog])\n', (982, 992), False, 'from aiogram_dialog.tools import render_transitions\n'), ((401, 408), 'aiogram.dispatcher.filters.state.State', 'State', ([], {}), '()\n', (406, 408), False, 'from aiogram.dispatcher.fi... |
import json
import uuid
import aioredis
from . import defaults
from .base_cache import BaseCache, CacheEntry
def pack_entry(entry):
ts, pol_id, pol_body = entry # pylint: disable=invalid-name,unused-variable
obj = (pol_id, pol_body)
# add unique seed to entry in order to avoid set collisions
# and u... | [
"aioredis.create_redis_pool",
"json.dumps",
"uuid.uuid4"
] | [((357, 369), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (367, 369), False, 'import uuid\n'), ((960, 1000), 'aioredis.create_redis_pool', 'aioredis.create_redis_pool', ([], {}), '(**self._opts)\n', (986, 1000), False, 'import aioredis\n'), ((378, 393), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj)\n', (388, 393)... |
import setuptools
def get_license():
""" replace the license content while creating the package"""
with open("LICENSE.md", "r", encoding="utf8") as fh:
license_description = fh.read()
return license_description
def get_install():
""" replace the install content while creating the package... | [
"setuptools.find_packages"
] | [((1675, 1777), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'include': "['functiondefextractor']", 'exclude': "['test', '*.test', '*.test.*']"}), "(include=['functiondefextractor'], exclude=['test',\n '*.test', '*.test.*'])\n", (1699, 1777), False, 'import setuptools\n')] |
"""
Copyright 2018 <NAME>, S.A.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | [
"random.sample",
"collections.deque",
"numpy.random.rand",
"random.randrange"
] | [((1244, 1262), 'collections.deque', 'deque', ([], {'maxlen': '(2000)'}), '(maxlen=2000)\n', (1249, 1262), False, 'from collections import deque\n'), ((1800, 1843), 'random.sample', 'random.sample', (['self.memory', 'self.batch_size'], {}), '(self.memory, self.batch_size)\n', (1813, 1843), False, 'import random\n'), ((... |
from typing import Dict, List
import os
import shutil
from pathlib import Path
import wandb
from catalyst.dl.core import Runner, Experiment
from catalyst.dl.experiment import ConfigExperiment
from catalyst.dl import utils
from .supervised import SupervisedRunner
class WandbRunner(Runner):
"""
Runner wrapper ... | [
"wandb.log",
"catalyst.dl.utils.flatten_dict",
"os.makedirs",
"pathlib.Path",
"wandb.init",
"shutil.rmtree"
] | [((569, 587), 'wandb.log', 'wandb.log', (['metrics'], {}), '(metrics)\n', (578, 587), False, 'import wandb\n'), ((2056, 2106), 'wandb.init', 'wandb.init', ([], {'config': 'exp_config'}), '(**monitoring_params, config=exp_config)\n', (2066, 2106), False, 'import wandb\n'), ((2190, 2213), 'pathlib.Path', 'Path', (['exper... |
# ___________________________________________________________________________
#
# EGRET: Electrical Grid Research and Engineering Tools
# Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains cert... | [
"csv.DictReader",
"pandas.read_csv",
"egret.common.log.logger.warning",
"egret.data.model_data.ModelData.empty_model_data_dict",
"pandas.DataFrame",
"datetime.timedelta",
"math.isnan"
] | [((7451, 7490), 'pandas.read_csv', 'pd.read_csv', (['metadata_path'], {'index_col': '(0)'}), '(metadata_path, index_col=0)\n', (7462, 7490), True, 'import pandas as pd\n'), ((11794, 11898), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'header': '(0)', 'parse_dates': '[[0, 1, 2, 3]]', 'date_parser': '_date_parser'... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="home"),
path('painting/', views.paintings, name="paintings"),
path('painting/<int:pk>/', views.painting, name="painting"),
path('review/user/', views.review_users, name="review_users"),
path('review/user/<in... | [
"django.urls.path"
] | [((70, 103), 'django.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (74, 103), False, 'from django.urls import path\n'), ((109, 161), 'django.urls.path', 'path', (['"""painting/"""', 'views.paintings'], {'name': '"""paintings"""'}), "('painting/', views.painti... |
import unittest
from lib import Monitor
from cloudasr.test_doubles import PollerSpy
from cloudasr.messages.helpers import *
class TestMonitor(unittest.TestCase):
def setUp(self):
self.poller = PollerSpy()
self.scale_workers = ScaleWorkersSpy()
self.create_poller = lambda: self.poller
... | [
"cloudasr.test_doubles.PollerSpy",
"lib.Monitor"
] | [((208, 219), 'cloudasr.test_doubles.PollerSpy', 'PollerSpy', ([], {}), '()\n', (217, 219), False, 'from cloudasr.test_doubles import PollerSpy\n'), ((339, 432), 'lib.Monitor', 'Monitor', (['self.create_poller', 'self.emit', 'self.scale_workers', 'self.poller.has_next_message'], {}), '(self.create_poller, self.emit, se... |
from __future__ import unicode_literals
from django.db import migrations
def migrate_comments(apps, schema_editor):
from zinnia_threaded_comments.models import ThreadedComment
o_comment_klass = apps.get_model(
'django_comments', 'Comment')
t_comment_klass = apps.get_model(
'zinnia-thread... | [
"django.db.migrations.RunPython",
"zinnia_threaded_comments.models.ThreadedComment.tree.rebuild"
] | [((1164, 1194), 'zinnia_threaded_comments.models.ThreadedComment.tree.rebuild', 'ThreadedComment.tree.rebuild', ([], {}), '()\n', (1192, 1194), False, 'from zinnia_threaded_comments.models import ThreadedComment\n'), ((1389, 1434), 'django.db.migrations.RunPython', 'migrations.RunPython', (['migrate_comments', 'empty']... |
from __future__ import division, print_function, absolute_import
__author__ = '<NAME>'
import numpy
from hep_ml.losses import CompositeLossFunction, MSELossFunction
from pruning import greedy, utils
def test_pruner(mx_filename='../data/formula.mx', higgs_filename='../data/training.csv'):
with open(mx_filename, ... | [
"hep_ml.losses.CompositeLossFunction",
"pruning.utils.get_higgs_data",
"numpy.array",
"hep_ml.losses.MSELossFunction"
] | [((379, 415), 'pruning.utils.get_higgs_data', 'utils.get_higgs_data', (['higgs_filename'], {}), '(higgs_filename)\n', (399, 415), False, 'from pruning import greedy, utils\n'), ((424, 455), 'numpy.array', 'numpy.array', (['X'], {'dtype': '"""float32"""'}), "(X, dtype='float32')\n", (435, 455), False, 'import numpy\n'),... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 19:39:26 2017
@author: PiotrTutak
"""
import numpy as np
from itertools import zip_longest
from operator import itemgetter
import random
import sys
"""
Różne funkcje aktywacji używane w testowaniu neuronu:
"""
def ident(x):
return float(x)
... | [
"random.sample",
"numpy.random.choice",
"itertools.zip_longest",
"numpy.exp",
"numpy.array",
"numpy.dot",
"numpy.random.ranf",
"operator.itemgetter"
] | [((2467, 2484), 'numpy.array', 'np.array', (['weights'], {}), '(weights)\n', (2475, 2484), True, 'import numpy as np\n'), ((3098, 3119), 'numpy.array', 'np.array', (['inputValues'], {}), '(inputValues)\n', (3106, 3119), True, 'import numpy as np\n'), ((3449, 3466), 'numpy.array', 'np.array', (['weights'], {}), '(weight... |
"""The FastGalleryTemplate can be used to show case your applications in a nice way"""
import pathlib
import param
from panel import Template
ROOT = pathlib.Path(__file__).parent
CSS = (ROOT / "fast_gallery_template.css").read_text()
JS = (ROOT / "fast_gallery_template.js").read_text()
TEMPLATE = (ROOT / "fa... | [
"param.ObjectSelector",
"pathlib.Path",
"param.Boolean",
"param.String",
"param.List"
] | [((157, 179), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (169, 179), False, 'import pathlib\n'), ((673, 685), 'param.List', 'param.List', ([], {}), '()\n', (683, 685), False, 'import param\n'), ((699, 875), 'param.String', 'param.String', ([], {'default': '"""Gallery"""', 'doc': '"""\n A... |
from yapsy import PluginManager
from pavilion.module_wrapper import ModuleWrapper
from pavilion.commands import Command
from pavilion.system_variables import SystemPlugin as System
from pavilion.schedulers import SchedulerPlugin
from pavilion.result_parsers import ResultParser
import os
import logging
LOGGER = logging... | [
"logging.getLogger",
"inspect.getmodule",
"os.path.join",
"yapsy.PluginManager.PluginManager"
] | [((313, 341), 'logging.getLogger', 'logging.getLogger', (['"""plugins"""'], {}), "('plugins')\n", (330, 341), False, 'import logging\n'), ((1223, 1255), 'os.path.join', 'os.path.join', (['cfg_dir', '"""plugins"""'], {}), "(cfg_dir, 'plugins')\n", (1235, 1255), False, 'import os\n'), ((1336, 1435), 'yapsy.PluginManager.... |
"""Build and Version class model Managers."""
import logging
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from polymorphic.managers import PolymorphicManager
from readthedocs.core.utils.extend import (
SettingsOverrideObject,
get_override_class,
)
from .constants import... | [
"logging.getLogger",
"readthedocs.core.utils.extend.get_override_class"
] | [((496, 523), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (513, 523), False, 'import logging\n'), ((1047, 1114), 'readthedocs.core.utils.extend.get_override_class', 'get_override_class', (['VersionQuerySet', 'VersionQuerySet._default_class'], {}), '(VersionQuerySet, VersionQuerySet._de... |
import json
import requests
url = 'http://localhost:5000'
def test(document_name: str, output_name: str, _type: str, data: dict):
data = {
'data': data,
'template_name': document_name,
'filename': output_name,
'type': _type,
}
r = requests.post(url+'/publipost', json=dat... | [
"requests.post"
] | [((280, 324), 'requests.post', 'requests.post', (["(url + '/publipost')"], {'json': 'data'}), "(url + '/publipost', json=data)\n", (293, 324), False, 'import requests\n')] |
#!/usr/bin/env python3
from Bio import SeqIO
import argparse
def circularize_sequence(input_file):
'''
Takes the output file from megahit and keep the contigs larger
than 100 Kbp.
Contigs sequence is fixed to match polyhedrin ATG codon as start
position.
Additionally, we add a missing sequenc... | [
"Bio.SeqIO.parse",
"argparse.ArgumentParser"
] | [((712, 744), 'Bio.SeqIO.parse', 'SeqIO.parse', (['input_file', '"""fasta"""'], {}), "(input_file, 'fasta')\n", (723, 744), False, 'from Bio import SeqIO\n'), ((1461, 1486), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1484, 1486), False, 'import argparse\n')] |
#!/usr/bin/env python3
import pytorch_lightning as pl
import hydra
from omegaconf import DictConfig
import cctv_learning
from cctv_learning.models.conv_autoencoder import Autoencoder
from cctv_learning.datasets.cctv import CCTV, CCTVOneVideo
from torch.utils.data import DataLoader
@cctv_learning.register_experiment
... | [
"cctv_learning.run",
"hydra.main",
"pytorch_lightning.seed_everything",
"cctv_learning.models.conv_autoencoder.Autoencoder",
"pytorch_lightning.Trainer",
"cctv_learning.datasets.cctv.CCTV"
] | [((544, 596), 'hydra.main', 'hydra.main', ([], {'config_path': '"""conf"""', 'config_name': '"""config"""'}), "(config_path='conf', config_name='config')\n", (554, 596), False, 'import hydra\n'), ((339, 367), 'pytorch_lightning.seed_everything', 'pl.seed_everything', (['cfg.seed'], {}), '(cfg.seed)\n', (357, 367), True... |
from clientes.models import Cliente
def busca_um_cliente(cliente_id):
return Cliente.objects.get(id=cliente_id)
def busca_clientes_nao_excluidos():
return Cliente.objects.filter(excluido=False)
def busca_todos_os_clientes():
return Cliente.objects.all()
| [
"clientes.models.Cliente.objects.get",
"clientes.models.Cliente.objects.filter",
"clientes.models.Cliente.objects.all"
] | [((83, 117), 'clientes.models.Cliente.objects.get', 'Cliente.objects.get', ([], {'id': 'cliente_id'}), '(id=cliente_id)\n', (102, 117), False, 'from clientes.models import Cliente\n'), ((167, 205), 'clientes.models.Cliente.objects.filter', 'Cliente.objects.filter', ([], {'excluido': '(False)'}), '(excluido=False)\n', (... |
import os
import aiosqlite
from discord.ext import commands
class Database(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild):
async with aiosqlite.connect(os.environ["JOSHGONE_DB"]) as db:
await db.execute("INS... | [
"discord.ext.commands.Cog.listener",
"discord.ext.commands.command",
"aiosqlite.connect"
] | [((150, 173), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (171, 173), False, 'from discord.ext import commands\n'), ((428, 451), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (449, 451), False, 'from discord.ext import commands\n'), ((688, 739), 'dis... |
os.environ['GOOGLE_APPLICATION_CREDENTIALS']=""
def translate_text(target, text):
"""Translates text into the target language.
Target must be an ISO 639-1 language code.
See https://g.co/cloud/translate/v2/translate-reference#supported_languages
"""
import six
from google.cloud import translat... | [
"google.cloud.translate_v2.Client"
] | [((1268, 1286), 'google.cloud.translate_v2.Client', 'translate.Client', ([], {}), '()\n', (1284, 1286), True, 'from google.cloud import translate_v2 as translate\n'), ((362, 380), 'google.cloud.translate_v2.Client', 'translate.Client', ([], {}), '()\n', (378, 380), True, 'from google.cloud import translate_v2 as transl... |
import os
import yaml
import argparse
import datetime
import shutil
parser = argparse.ArgumentParser()
parser.add_argument('--preprocessedoutputdir', type=str, help="intermediate preprocessed pipeline data directory")
parser.add_argument('--trainoutputdir', type=str, help="intermediate training pipeline data directory... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"shutil.copytree",
"datetime.datetime.now",
"shutil.copy"
] | [((78, 103), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (101, 103), False, 'import argparse\n'), ((2499, 2543), 'shutil.copy', 'shutil.copy', (['train_set_path', 'destination_dir'], {}), '(train_set_path, destination_dir)\n', (2510, 2543), False, 'import shutil\n'), ((2544, 2587), 'shutil.c... |
import asyncio
import random
import pytest
import uuid
from collections import defaultdict
import aiotask_context as context
@asyncio.coroutine
def dummy3():
yield from asyncio.sleep(random.uniform(0, 2))
return context.get("key")
@asyncio.coroutine
def dummy2(a, b):
yield from asyncio.sleep(random.un... | [
"aiotask_context.set",
"random.uniform",
"aiotask_context.asyncio_current_task",
"uuid.uuid4",
"aiotask_context.get",
"collections.defaultdict",
"asyncio.gather"
] | [((224, 242), 'aiotask_context.get', 'context.get', (['"""key"""'], {}), "('key')\n", (235, 242), True, 'import aiotask_context as context\n'), ((343, 361), 'aiotask_context.get', 'context.get', (['"""key"""'], {}), "('key')\n", (354, 361), True, 'import aiotask_context as context\n'), ((760, 777), 'collections.default... |
from .utils import to_q
from .sparqlwikidata import sparql_wikidata
import config
from string import Template
class TypeMatcher(object):
"""
Interface that caches the subclasses of parent classes.
Cached using Redis sets, with expiration.
"""
def __init__(self, redis_client):
self.r = redi... | [
"string.Template"
] | [((1163, 1212), 'string.Template', 'Template', (['config.sparql_query_to_fetch_subclasses'], {}), '(config.sparql_query_to_fetch_subclasses)\n', (1171, 1212), False, 'from string import Template\n')] |
"""Conf as separate file."""
import logging
import pycnfg
CNFG = {
'path': {
'default': {
'init': pycnfg.utils.find_path,
'producer': pycnfg.Producer,
'global': {},
'patch': {},
'priority': 1,
'steps': [],
},
},
'logge... | [
"logging.getLogger"
] | [((367, 395), 'logging.getLogger', 'logging.getLogger', (['"""default"""'], {}), "('default')\n", (384, 395), False, 'import logging\n')] |
import cv2
import matplotlib.pyplot as plt
from utils.logger import Writer
import threading
import time
cap = cv2.VideoCapture()
import time
cap.open("/dev/video0" )
writer = Writer()
duration=1
def cam():
global duration
while (1):
try:
t1 = time.time()
ret, frame = cap.read... | [
"utils.logger.Writer",
"time.sleep",
"cv2.imshow",
"cv2.waitKey",
"cv2.VideoCapture",
"threading.Thread",
"time.time"
] | [((110, 128), 'cv2.VideoCapture', 'cv2.VideoCapture', ([], {}), '()\n', (126, 128), False, 'import cv2\n'), ((175, 183), 'utils.logger.Writer', 'Writer', ([], {}), '()\n', (181, 183), False, 'from utils.logger import Writer\n'), ((746, 774), 'threading.Thread', 'threading.Thread', ([], {'target': 'cam'}), '(target=cam)... |
# encoding: utf-8
import os
import unittest
import warnings
from vcr import VCR
from octokit import Octokit
# Turn off requests warnings about unsecure SSL requests since
# no real requests are happening in tests. Everything is routed to VCR afterall
warnings.simplefilter("ignore")
CASSETTES_PATH = os.path.join(os.p... | [
"warnings.simplefilter",
"vcr.VCR",
"os.path.realpath",
"octokit.Octokit"
] | [((253, 284), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (274, 284), False, 'import warnings\n'), ((411, 471), 'vcr.VCR', 'VCR', ([], {'record_mode': '"""once"""', 'cassette_library_dir': 'CASSETTES_PATH'}), "(record_mode='once', cassette_library_dir=CASSETTES_PATH)\n", (4... |
import torch.nn.functional as F
import torch.nn as nn
class WeightNet(nn.Module):
r"""Applies WeightNet to a standard convolution.
The grouped fc layer directly generates the convolutional kernel,
this layer has M*inp inputs, G*oup groups and oup*inp*ksize*ksize outputs.
M/G control the amount of par... | [
"torch.nn.Sigmoid",
"torch.nn.functional.conv2d",
"torch.nn.Conv2d"
] | [((644, 706), 'torch.nn.Conv2d', 'nn.Conv2d', (['inp_gap', '(self.M * oup)', '(1)', '(1)', '(0)'], {'groups': '(1)', 'bias': '(True)'}), '(inp_gap, self.M * oup, 1, 1, 0, groups=1, bias=True)\n', (653, 706), True, 'import torch.nn as nn\n'), ((728, 740), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (738, 740), T... |
import os
# from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
FLASK_APP = os.getenv('FLASK_APP')
SQLALCHEMY_DATABASE_URI = os.getenv("DATABASE_URL", "sqlite://")
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = os.urandom(32)
# Image up... | [
"os.urandom",
"os.path.dirname",
"os.path.join",
"os.getenv"
] | [((69, 94), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import os\n'), ((137, 159), 'os.getenv', 'os.getenv', (['"""FLASK_APP"""'], {}), "('FLASK_APP')\n", (146, 159), False, 'import os\n'), ((191, 229), 'os.getenv', 'os.getenv', (['"""DATABASE_URL"""', '"""sqlite://"""']... |
#!/usr/bin/env python3
# coding: utf8
__author__ = "<NAME>"
from requests.auth import HTTPBasicAuth
import requests
class SecurityController:
__instance = None
@staticmethod
def getInstance():
if SecurityController.__instance is None:
SecurityController()
return SecurityContr... | [
"requests.auth.HTTPBasicAuth"
] | [((1058, 1091), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (['username', 'password'], {}), '(username, password)\n', (1071, 1091), False, 'from requests.auth import HTTPBasicAuth\n')] |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from mavros_msgs/ADSBVehicle.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import genpy
import std_msgs.msg
class ADSBVehicle(genpy.Message):
_md5sum = ... | [
"codecs.lookup_error",
"struct.Struct",
"genpy.Duration",
"genpy.DeserializationError"
] | [((12751, 12779), 'struct.Struct', 'struct.Struct', (['"""<2d4f2B2i2H"""'], {}), "('<2d4f2B2i2H')\n", (12764, 12779), False, 'import struct\n'), ((12920, 12940), 'struct.Struct', 'struct.Struct', (['"""<3I"""'], {}), "('<3I')\n", (12933, 12940), False, 'import struct\n'), ((6473, 6489), 'genpy.Duration', 'genpy.Duratio... |
from __future__ import absolute_import
from .utils.parameters import *
import codecs, json
def load_data(filename):
data = []
with codecs.open(filename, encoding='utf8', mode='r') as f:
sample_list = json.load(f)['data']
for sample in sample_list:
data.append((sample['noisy_add'],sample['std_add']))
return... | [
"json.load",
"codecs.open"
] | [((136, 184), 'codecs.open', 'codecs.open', (['filename'], {'encoding': '"""utf8"""', 'mode': '"""r"""'}), "(filename, encoding='utf8', mode='r')\n", (147, 184), False, 'import codecs, json\n'), ((207, 219), 'json.load', 'json.load', (['f'], {}), '(f)\n', (216, 219), False, 'import codecs, json\n')] |
# Copyright 2019 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"perfkitbenchmarker.flags.DEFINE_bool",
"perfkitbenchmarker.errors.Config.UnrecognizedOption",
"perfkitbenchmarker.vm_util.IssueCommand",
"perfkitbenchmarker.errors.Benchmarks.PrepareException",
"perfkitbenchmarker.sample.Sample",
"logging.info",
"os.walk",
"perfkitbenchmarker.flags.DEFINE_enum",
"j... | [((3111, 3218), 'perfkitbenchmarker.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dpb_sparksql_data"""', 'None', '"""The HCFS based dataset to run Spark SQL query against"""'], {}), "('dpb_sparksql_data', None,\n 'The HCFS based dataset to run Spark SQL query against')\n", (3130, 3218), False, 'from perfkitbenc... |
# -*- coding: utf-8 -*
from expects import *
from expects.testing import failure
with describe('be'):
with it('should pass if object is expected'):
value = 1
expect(value).to(be(value))
with it('should fail if object is not expected'):
with failure('expected: 1 to be 2'):
... | [
"expects.testing.failure"
] | [((277, 307), 'expects.testing.failure', 'failure', (['"""expected: 1 to be 2"""'], {}), "('expected: 1 to be 2')\n", (284, 307), False, 'from expects.testing import failure\n'), ((561, 595), 'expects.testing.failure', 'failure', (['"""expected: 1 not to be 1"""'], {}), "('expected: 1 not to be 1')\n", (568, 595), Fals... |
# -*- coding: utf-8 -*-
import matplotlib
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
# from mpl_toolkits.basemap import Basemap
import xarray as xr
import re
from collections import OrderedDict
from datetime import datetime, timedelta
from scipy.spatial import cKDTree, KDTree
f... | [
"numpy.radians",
"numpy.ma.getmaskarray",
"numpy.sqrt",
"numpy.column_stack",
"numpy.iinfo",
"numpy.array",
"numpy.arctan2",
"numpy.sin",
"datetime.timedelta",
"numpy.ma.isMaskedArray",
"logging.info",
"numpy.arange",
"datetime.datetime",
"numpy.select",
"numpy.full_like",
"numpy.sort"... | [((446, 541), '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", (465, 541), False, 'import logging\n'), ((5604, 5625), 'numpy.ma.isMaskedArray', 'm... |
#!/usr/bin/env python3
import numpy as np
from main import sympy_simplex, LP
"""
use jupyter notebook or qtconsole to see formatted results
e.g. > jupyter qtconsole
then in the console:
> %load usage.py
then press ENTER twice
"""
aufgabe1 = LP( # Blatt 2
np.matrix('2 0 6; -2 8 4; 3 6 5'),
np.matrix('10;... | [
"numpy.matrix",
"main.sympy_simplex"
] | [((810, 840), 'main.sympy_simplex', 'sympy_simplex', (['blatt5_aufgabe1'], {}), '(blatt5_aufgabe1)\n', (823, 840), False, 'from main import sympy_simplex, LP\n'), ((267, 300), 'numpy.matrix', 'np.matrix', (['"""2 0 6; -2 8 4; 3 6 5"""'], {}), "('2 0 6; -2 8 4; 3 6 5')\n", (276, 300), True, 'import numpy as np\n'), ((30... |
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import mmcv
from mmcv import deprecated_api_warning
from mmcv.utils.misc import has_method
def test_to_ntuple():
single_number = 2
assert mmcv.utils.to_1tuple(single_number) == (single_number, )
assert mmcv.utils.to_2tuple(single_number) == (s... | [
"mmcv.utils.to_3tuple",
"mmcv.import_modules_from_strings",
"mmcv.utils.misc.has_method",
"mmcv.is_list_of",
"mmcv.tuple_cast",
"mmcv.utils.to_ntuple",
"mmcv.requires_package",
"mmcv.slice_list",
"mmcv.is_seq_of",
"mmcv.utils.to_1tuple",
"mmcv.is_method_overridden",
"mmcv.concat_list",
"mmcv... | [((2121, 2159), 'mmcv.is_seq_of', 'mmcv.is_seq_of', (['[1.0, 2.0, 3.0]', 'float'], {}), '([1.0, 2.0, 3.0], float)\n', (2135, 2159), False, 'import mmcv\n'), ((2171, 2212), 'mmcv.is_seq_of', 'mmcv.is_seq_of', (['[(1,), (2,), (3,)]', 'tuple'], {}), '([(1,), (2,), (3,)], tuple)\n', (2185, 2212), False, 'import mmcv\n'), (... |
# Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 us... | [
"algorithm.wolrd.World",
"src.utils.logging_engine.logger.error",
"src.utils.json_tools.convert_nodes_to_json",
"src.utils.json_tools.read_json_from_file",
"src.utils.json_tools.get_order_item_dict",
"src.utils.json_tools.get_vehicle_instance_dict",
"copy.copy",
"numpy.load",
"src.utils.input_utils.... | [((1623, 1658), 'numpy.load', 'np.load', (['"""algorithm/factory2id.npy"""'], {}), "('algorithm/factory2id.npy')\n", (1630, 1658), True, 'import numpy as np\n'), ((1667, 1705), 'numpy.load', 'np.load', (['"""algorithm/shortest_path.npy"""'], {}), "('algorithm/shortest_path.npy')\n", (1674, 1705), True, 'import numpy as... |