code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import core
import asyncio
from components import controller
class Speed(Component):
async def start(self):
controller = core.core.get_component(controller.Controller)
while True:
await asyncio.sleep(0.1)
x = controller.get_axis("LEFT-X")
controller.get_button('R... | [
"components.controller.get_axis",
"components.controller.get_button",
"core.core.get_component",
"asyncio.sleep"
] | [((134, 180), 'core.core.get_component', 'core.core.get_component', (['controller.Controller'], {}), '(controller.Controller)\n', (157, 180), False, 'import core\n'), ((254, 283), 'components.controller.get_axis', 'controller.get_axis', (['"""LEFT-X"""'], {}), "('LEFT-X')\n", (273, 283), False, 'from components import ... |
import shutil
import tempfile
from unittest import TestCase, mock
import pytest
from lineflow import download
from lineflow.datasets.squad import Squad, get_squad
class SquadTestCase(TestCase):
@classmethod
def setUpClass(cls):
cls.default_cache_root = download.get_cache_root()
cls.temp_dir... | [
"lineflow.download.get_cache_root",
"lineflow.download.set_cache_root",
"lineflow.datasets.squad.Squad",
"tempfile.mkdtemp",
"shutil.rmtree",
"unittest.mock.patch",
"lineflow.datasets.squad.get_squad"
] | [((274, 299), 'lineflow.download.get_cache_root', 'download.get_cache_root', ([], {}), '()\n', (297, 299), False, 'from lineflow import download\n'), ((323, 341), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (339, 341), False, 'import tempfile\n'), ((350, 387), 'lineflow.download.set_cache_root', 'download... |
"""initial sync with alembic
Revision ID: 437e0ac0a455
Revises: None
Create Date: 2015-03-24 16:42:05.596131
"""
# revision identifiers, used by Alembic.
revision = '437e0ac0a455'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### comman... | [
"alembic.op.create_foreign_key",
"alembic.op.drop_constraint",
"sqlalchemy.dialects.mysql.INTEGER",
"alembic.op.drop_column",
"alembic.op.drop_index",
"alembic.op.create_index"
] | [((374, 453), 'alembic.op.create_index', 'op.create_index', (['"""ix_affiliations_code"""', '"""affiliations"""', "['code']"], {'unique': '(False)'}), "('ix_affiliations_code', 'affiliations', ['code'], unique=False)\n", (389, 453), False, 'from alembic import op\n'), ((458, 554), 'alembic.op.create_index', 'op.create_... |
import json
import pandas as pd
from dataprep.scrape_all_alexa_information import main
file_name = "data_for_trainig_model_corpus_2018_audience_overlap_sites_level_3_and_referral_data_2018_corpus_level3_deep.csv"
df = pd.read_csv(file_name)
df.head()
unique_sources = df.source.unique().tolist()
uniqu... | [
"json.dump",
"dataprep.scrape_all_alexa_information.main",
"pandas.read_csv"
] | [((232, 254), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {}), '(file_name)\n', (243, 254), True, 'import pandas as pd\n'), ((788, 805), 'json.dump', 'json.dump', (['res', 'f'], {}), '(res, f)\n', (797, 805), False, 'import json\n'), ((587, 602), 'dataprep.scrape_all_alexa_information.main', 'main', (['site_name'... |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME> and <NAME>
# --------------------------------------------------------
"""Compute minibatch blobs for training a Fast R-CNN network."""
fr... | [
"numpy.random.normal",
"cv2.imwrite",
"utils.blob.prep_noise_for_blob",
"numpy.where",
"numpy.array",
"utils.blob.prep_im_for_blob",
"utils.blob.im_list_to_blob",
"cv2.imread"
] | [((2179, 2264), 'numpy.array', 'np.array', (['[[im_blob.shape[1], im_blob.shape[2], im_scales[0]]]'], {'dtype': 'np.float32'}), '([[im_blob.shape[1], im_blob.shape[2], im_scales[0]]], dtype=np.float32\n )\n', (2187, 2264), True, 'import numpy as np\n'), ((4255, 4285), 'utils.blob.im_list_to_blob', 'im_list_to_blob',... |
# 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... | [
"cairis.data.CairisDAO.CairisDAO.__init__",
"cairis.tools.JsonConverter.json_serialize",
"cairis.misc.DataFlowDiagram.DataFlowDiagram",
"cairis.misc.ControlStructure.ControlStructure",
"cairis.tools.SessionValidator.get_fonts",
"cairis.tools.JsonConverter.json_deserialize",
"cairis.daemon.CairisHTTPErro... | [((1570, 1606), 'cairis.data.CairisDAO.CairisDAO.__init__', 'CairisDAO.__init__', (['self', 'session_id'], {}), '(self, session_id)\n', (1588, 1606), False, 'from cairis.data.CairisDAO import CairisDAO\n'), ((5600, 5654), 'cairis.tools.SessionValidator.check_required_keys', 'check_required_keys', (['json_dict', 'DataFl... |
import torch
def steps(end:float,steps=None,dtype=None,device=None)->torch.Tensor:
return torch.linspace(0.0,end,steps+1,dtype=dtype,device=device)[1:] | [
"torch.linspace"
] | [((95, 158), 'torch.linspace', 'torch.linspace', (['(0.0)', 'end', '(steps + 1)'], {'dtype': 'dtype', 'device': 'device'}), '(0.0, end, steps + 1, dtype=dtype, device=device)\n', (109, 158), False, 'import torch\n')] |
import unittest
from solutions.home.roman_numerals import my_solution
class TestSolution(unittest.TestCase):
def test_solution(self):
self.assertEqual(my_solution(1), 'I')
self.assertEqual(my_solution(6), 'VI')
self.assertEqual(my_solution(76), 'LXXVI')
self.assertEqual(my_soluti... | [
"unittest.main",
"solutions.home.roman_numerals.my_solution"
] | [((436, 451), 'unittest.main', 'unittest.main', ([], {}), '()\n', (449, 451), False, 'import unittest\n'), ((167, 181), 'solutions.home.roman_numerals.my_solution', 'my_solution', (['(1)'], {}), '(1)\n', (178, 181), False, 'from solutions.home.roman_numerals import my_solution\n'), ((213, 227), 'solutions.home.roman_nu... |
import sqlalchemy as sa
from .coltype_map import string_to_sqlalchemy_type
def is_ord_sequence(obj):
return isinstance(obj, list) or isinstance(obj,tuple)
def parse_schema_strings(schema, default_fpath='./'):
columns = list()
for colinfo in schema:
n = len(colinfo)
if n not in (2,3,4):
... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.Index",
"sqlalchemy.CheckConstraint",
"sqlalchemy.Column"
] | [((1082, 1153), 'sqlalchemy.Column', 'sa.Column', (['colinfo[1]', 'sa.Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(colinfo[1], sa.Integer, primary_key=True, autoincrement=True)\n', (1091, 1153), True, 'import sqlalchemy as sa\n'), ((1306, 1362), 'sqlalchemy.Column', 'sa.Column', (['colinfo[1]', '... |
""" Pyc2Py.py by gauravssnl
It supports touchscreen device also as it uses powlite_fm_en mod translated to English by me """
import appuifw
import e32
import sys
import series60_console
import globalui
import py_compile
import py_decompile
try :
import powlite_fm_en as powlite_fm
except :
import p... | [
"series60_console.Console",
"powlite_fm.manager",
"py_compile.compile",
"py_decompile.decompile",
"appuifw.app.set_exit",
"globalui.global_msg_query",
"sys.stdout.flush",
"e32.Ao_lock",
"sys.stdout.write"
] | [((348, 361), 'e32.Ao_lock', 'e32.Ao_lock', ([], {}), '()\n', (359, 361), False, 'import e32\n'), ((395, 421), 'series60_console.Console', 'series60_console.Console', ([], {}), '()\n', (419, 421), False, 'import series60_console\n'), ((1244, 1264), 'powlite_fm.manager', 'powlite_fm.manager', ([], {}), '()\n', (1262, 12... |
#!/usr/bin/env python3
import os
import sys
import json
from datetime import datetime
from datetime import timedelta
from yahoo_finance import repeat_download
# collect the tickers to crawl their corresponding price information
def get_tickers(date, tickers):
try:
f = open('./input/news/' + date[:4] +... | [
"datetime.datetime.strptime",
"datetime.timedelta",
"yahoo_finance.repeat_download",
"json.dump"
] | [((596, 633), 'datetime.datetime.strptime', 'datetime.strptime', (['end_date', '"""%Y%m%d"""'], {}), "(end_date, '%Y%m%d')\n", (613, 633), False, 'from datetime import datetime\n'), ((884, 930), 'yahoo_finance.repeat_download', 'repeat_download', (['"""^GSPC"""', 'start_date', 'end_date'], {}), "('^GSPC', start_date, e... |
import pygame as pg
import random as rd
import config
import assets
import arrow
# Instâncias
arConfig = config.ArrowConfig()
wdConfig = config.WindowConfig()
clock = pg.time.Clock()
# arrow = arrow.Arrow()
assets = assets.Assets(0, (arConfig.pressed_arrow_size, arConfig.pressed_arrow_size))
assets.load()
pg.init()
... | [
"config.WindowConfig",
"random.uniform",
"pygame.display.set_caption",
"random.choice",
"pygame.init",
"pygame.quit",
"config.ArrowConfig",
"assets.load",
"pygame.display.set_mode",
"assets.Assets",
"pygame.event.get",
"pygame.display.set_icon",
"pygame.key.get_pressed",
"pygame.time.Clock... | [((106, 126), 'config.ArrowConfig', 'config.ArrowConfig', ([], {}), '()\n', (124, 126), False, 'import config\n'), ((138, 159), 'config.WindowConfig', 'config.WindowConfig', ([], {}), '()\n', (157, 159), False, 'import config\n'), ((168, 183), 'pygame.time.Clock', 'pg.time.Clock', ([], {}), '()\n', (181, 183), True, 'i... |
#!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | [
"k8s.models.common.ObjectMeta",
"k8s.client.NotFound",
"mock.Mock",
"k8s.models.resourcequota.ResourceQuotaSpec",
"pytest.mark.usefixtures",
"k8s.models.resourcequota.ResourceQuota",
"k8s.models.resourcequota.ResourceQuota.get_or_create",
"k8s.models.resourcequota.ResourceQuota.delete"
] | [((880, 917), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""k8s_config"""'], {}), "('k8s_config')\n", (903, 917), False, 'import pytest\n'), ((2328, 2339), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (2337, 2339), False, 'import mock\n'), ((3086, 3153), 'k8s.models.common.ObjectMeta', 'ObjectMeta', ([], {... |
from systemcheck.checks.models.checks import Check
from systemcheck.models.meta import Base, ChoiceType, Column, ForeignKey, Integer, QtModelMixin, String, qtRelationship, \
relationship, RichString, generic_repr, OperatorMixin, BaseMixin, TableNameMixin
from systemcheck.systems.ABAP.models import ActionAbapClientS... | [
"systemcheck.models.meta.ForeignKey",
"systemcheck.models.meta.Column",
"systemcheck.models.meta.qtRelationship",
"systemcheck.models.meta.relationship"
] | [((542, 575), 'systemcheck.models.meta.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (548, 575), False, 'from systemcheck.models.meta import Base, ChoiceType, Column, ForeignKey, Integer, QtModelMixin, String, qtRelationship, relationship, RichString, generic_repr, Operat... |
#!/usr/bin/env python
"""
ViperMonkey: core package - ViperMonkey class
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source code or documentation
Proje... | [
"logger.log.info",
"logger.log.debug",
"prettytable.PrettyTable",
"unidecode.unidecode"
] | [((13720, 13766), 'logger.log.debug', 'log.debug', (["('line_keywords: %r' % line_keywords)"], {}), "('line_keywords: %r' % line_keywords)\n", (13729, 13766), False, 'from logger import log\n'), ((17289, 17330), 'logger.log.info', 'log.info', (['"""Emulating loose statements..."""'], {}), "('Emulating loose statements.... |
import itertools
import time
import regex
import sh
from nlstruct.core.cache import yaml_load, yaml_dump
from nlstruct.core.collections import set_deep_attr
from nlstruct.core.logging import TrainingLogger
from nlstruct.core.random import seed_all
from nlstruct.core.schedule import ConcatSchedule
from nlstruct.core.t... | [
"nlstruct.core.collections.set_deep_attr",
"nlstruct.core.random.seed_all",
"regex.match",
"nlstruct.core.logging.TrainingLogger",
"sh.rm",
"time.time",
"itertools.repeat"
] | [((4893, 5004), 'nlstruct.core.logging.TrainingLogger', 'TrainingLogger', ([], {'key': 'main_score', 'patience_warmup': 'patience_warmup', 'patience': 'patience', 'formatter': 'metrics_info'}), '(key=main_score, patience_warmup=patience_warmup, patience=\n patience, formatter=metrics_info)\n', (4907, 5004), False, '... |
#!/usr/bin/env python
import os
import numpy as np
from scipy.io import loadmat
print('Loading movie ratings dataset.\n\n')
os.chdir("/home/mgaber/Workbench/ML/Week9/exercise/ex8/")
# % Load movie data
load_data = loadmat('ex8_movies.mat')
Y = load_data['Y']
R = load_data['R']
# We should try to plot
# imagesc(Y);
... | [
"os.chdir",
"numpy.transpose",
"scipy.io.loadmat",
"numpy.square"
] | [((126, 183), 'os.chdir', 'os.chdir', (['"""/home/mgaber/Workbench/ML/Week9/exercise/ex8/"""'], {}), "('/home/mgaber/Workbench/ML/Week9/exercise/ex8/')\n", (134, 183), False, 'import os\n'), ((217, 242), 'scipy.io.loadmat', 'loadmat', (['"""ex8_movies.mat"""'], {}), "('ex8_movies.mat')\n", (224, 242), False, 'from scip... |
## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# can use the below import should you choose to initialize the weights of your Net
# import torch.nn.init as I
from torch.nn import init
class MyNetwork... | [
"torch.nn.BatchNorm2d",
"torch.nn.Dropout",
"torch.nn.Conv2d",
"torch.nn.init.uniform",
"torch.nn.BatchNorm1d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.init.xavier_uniform"
] | [((417, 453), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(32)'], {'kernel_size': '(4, 4)'}), '(1, 32, kernel_size=(4, 4))\n', (426, 453), True, 'import torch.nn as nn\n'), ((475, 562), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': '(32)', 'out_channels': '(64)', 'kernel_size': '(3, 3)', 'stride': '(1)', 'padding'... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_lattice_tuner_for_reference.ui'
#
# Created: Tue Jan 28 16:35:46 2014
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.... | [
"PyQt4.QtGui.QPushButton",
"PyQt4.QtGui.QLabel",
"PyQt4.QtGui.QTableView",
"PyQt4.QtGui.QStatusBar",
"PyQt4.QtGui.QApplication.translate",
"PyQt4.QtGui.QMenuBar",
"PyQt4.QtCore.QSize",
"PyQt4.QtGui.QTextEdit",
"PyQt4.QtGui.QWidget",
"PyQt4.QtGui.QTabWidget",
"PyQt4.QtGui.QAction",
"PyQt4.QtGui... | [((569, 594), 'PyQt4.QtGui.QWidget', 'QtGui.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (582, 594), False, 'from PyQt4 import QtCore, QtGui\n'), ((745, 773), 'PyQt4.QtGui.QStatusBar', 'QtGui.QStatusBar', (['MainWindow'], {}), '(MainWindow)\n', (761, 773), False, 'from PyQt4 import QtCore, QtGui\n'), ((917, 946), ... |
from flask import Flask
app = Flask(__name__)
from flaskrestaur import views
| [
"flask.Flask"
] | [((31, 46), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (36, 46), False, 'from flask import Flask\n')] |
from flask import render_template, current_app, jsonify
from flask import request
from info.response_code import *
from info.models import News, Category, db
def news_review():
"""
新闻审核列表
:return:
"""
no_check_news = News.query.filter(News.status != 0)
condition = request.args.get('search')
... | [
"flask.render_template",
"flask.request.args.get",
"flask.current_app.logger.error",
"info.models.Category",
"info.models.db.session.add",
"info.models.db.session.commit",
"flask.request.form.get",
"flask.request.json.get",
"info.models.Category.query.all",
"info.models.News.query.filter",
"flas... | [((239, 274), 'info.models.News.query.filter', 'News.query.filter', (['(News.status != 0)'], {}), '(News.status != 0)\n', (256, 274), False, 'from info.models import News, Category, db\n'), ((291, 317), 'flask.request.args.get', 'request.args.get', (['"""search"""'], {}), "('search')\n", (307, 317), False, 'from flask ... |
import inspect
import logging
from numpy import exp, log, average
from .metric_directionality import greater_is_better, best_in_series, idxbest
def random_model_group(df, train_end_time, n=1):
"""Pick a random model group (as a baseline)
Arguments:
train_end_time (Timestamp) -- current train end ti... | [
"numpy.log",
"inspect.getargspec",
"logging.info",
"numpy.average"
] | [((5345, 5456), 'logging.info', 'logging.info', (['"""Null metric variances for %s %s at %s; picking at random"""', 'metric', 'parameter', 'train_end_time'], {}), "('Null metric variances for %s %s at %s; picking at random',\n metric, parameter, train_end_time)\n", (5357, 5456), False, 'import logging\n'), ((12099, ... |
import datetime
import sys
import zipfile
from django.contrib.auth.models import User
from django.core.mail import send_mail
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404, get_list_or_404
from django.urls import reverse
from django.views.generic impor... | [
"django.shortcuts.render",
"zipfile.ZipFile",
"django.core.mail.send_mail",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"sys.exc_info",
"django.urls.reverse",
"django.db.models.Q",
"django.contrib.auth.models.User.objects.values_list"
] | [((554, 598), 'django.contrib.auth.models.User.objects.values_list', 'User.objects.values_list', (['"""email"""'], {'flat': '(True)'}), "('email', flat=True)\n", (578, 598), False, 'from django.contrib.auth.models import User\n'), ((1094, 1140), 'django.shortcuts.render', 'render', (['request', '"""gyoseki/index.html""... |
import talib
import numpy as np
import jtrade.core.instrument.equity as Equity
# ========== TECH OVERLAP INDICATORS **START** ==========
def BBANDS(equity, start=None, end=None, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0):
"""Bollinger Bands
:param timeperiod:
:param nbdevup:
:param nbdevdn:
... | [
"talib.HT_TRENDLINE",
"talib.CDLTAKURI",
"talib.CDLXSIDEGAP3METHODS",
"talib.TYPPRICE",
"talib.CDLBREAKAWAY",
"talib.CDLMATCHINGLOW",
"talib.CDLIDENTICAL3CROWS",
"talib.ROCR",
"talib.DEMA",
"talib.CDLONNECK",
"talib.CDLRICKSHAWMAN",
"talib.CDL3INSIDE",
"talib.CDL3STARSINSOUTH",
"talib.MOM"... | [((368, 423), 'numpy.array', 'np.array', (["equity.hp.loc[start:end, 'close']"], {'dtype': '"""f8"""'}), "(equity.hp.loc[start:end, 'close'], dtype='f8')\n", (376, 423), True, 'import numpy as np\n'), ((463, 558), 'talib.BBANDS', 'talib.BBANDS', (['close'], {'timeperiod': 'timeperiod', 'nbdevup': 'nbdevup', 'nbdevdn': ... |
import aspose.email
from aspose.email.clients.imap import ImapClient
from aspose.email.clients import SecurityOptions
from aspose.email import MailMessage
def run():
dataDir = ""
#ExStart: MoveMessageToAnotherFolder
client = ImapClient("imap.gmail.com", 993, "username", "password")
clien... | [
"aspose.email.clients.imap.ImapClient",
"aspose.email.MailMessage"
] | [((252, 309), 'aspose.email.clients.imap.ImapClient', 'ImapClient', (['"""imap.gmail.com"""', '(993)', '"""username"""', '"""password"""'], {}), "('imap.gmail.com', 993, 'username', 'password')\n", (262, 309), False, 'from aspose.email.clients.imap import ImapClient\n'), ((424, 479), 'aspose.email.MailMessage', 'MailMe... |
import numpy as np
def thresholding(scores, labels):
"""
Args:
scores: Type:ndarray
shape: N * Nc
N - Number of training examples
Nc - Number of classes
labels: Type: ndarray
shape: N * Nc
N - Number of training examples
... | [
"numpy.argsort",
"numpy.array",
"numpy.sort",
"numpy.where"
] | [((2879, 2892), 'numpy.array', 'np.array', (['tms'], {}), '(tms)\n', (2887, 2892), True, 'import numpy as np\n'), ((543, 567), 'numpy.sort', 'np.sort', (['scores_'], {'axis': '(1)'}), '(scores_, axis=1)\n', (550, 567), True, 'import numpy as np\n'), ((672, 698), 'numpy.argsort', 'np.argsort', (['scores'], {'axis': '(1)... |
import discord
from discord.ext import commands
import re
import asyncio
time_regex = re.compile("(?:(\d{1,5})(h|s|m|d))+?")
time_dict = {"h":3600, "s":1, "m":60, "d":86400}
class TimeConverter(commands.Converter):
async def convert(self, ctx, argument):
args = argument.lower()
matches ... | [
"discord.ext.commands.has_permissions",
"re.compile",
"discord.utils.get",
"discord.Object",
"asyncio.sleep",
"discord.ext.commands.BadArgument",
"re.findall",
"discord.ext.commands.command"
] | [((92, 131), 're.compile', 're.compile', (['"""(?:(\\\\d{1,5})(h|s|m|d))+?"""'], {}), "('(?:(\\\\d{1,5})(h|s|m|d))+?')\n", (102, 131), False, 'import re\n'), ((812, 847), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['clear']"}), "(aliases=['clear'])\n", (828, 847), False, 'from discord.ext imp... |
# built-in
import re
# external
from flake8.formatting.default import Default
from flake8.style_guide import Violation
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers import PythonLexer
# app
from .._logic import color_code, color_description, colored
REX_TEXT =... | [
"pygments.highlight",
"pygments.formatters.TerminalFormatter",
"pygments.lexers.PythonLexer",
"re.compile"
] | [((321, 341), 're.compile', 're.compile', (['"""[A-Z]+"""'], {}), "('[A-Z]+')\n", (331, 341), False, 'import re\n'), ((611, 624), 'pygments.lexers.PythonLexer', 'PythonLexer', ([], {}), '()\n', (622, 624), False, 'from pygments.lexers import PythonLexer\n'), ((651, 670), 'pygments.formatters.TerminalFormatter', 'Termin... |
"""
Implements a Django model, with the API of the standard User,
but contains just the 'username' field. This instance is
persisted in the traditional database configured in your project.
It acts as a proxy to the real user, stored in Cassadra.
It's required because the way Django is designed, and it's
the recommend... | [
"logging.getLogger",
"django.utils.crypto.salted_hmac",
"logging.warning",
"django.db.models.CharField"
] | [((1180, 1207), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1197, 1207), False, 'import logging\n'), ((4939, 4988), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'primary_key': '(True)'}), '(max_length=30, primary_key=True)\n', (4955, 4988), False, 'fro... |
import click
import requests
import json
from StringIO import StringIO
surl = None
srepo = None
drepo = None
durl = None
stoken = None
dtoken = None
stat = "closed"
@click.command()
@click.option('--verbose', is_flag=True, help="verbose mode enabled.")
@click.option('--param', '-p', multiple=True, default='', help... | [
"StringIO.StringIO",
"click.option",
"json.dumps",
"requests.get",
"click.echo",
"click.command"
] | [((171, 186), 'click.command', 'click.command', ([], {}), '()\n', (184, 186), False, 'import click\n'), ((188, 257), 'click.option', 'click.option', (['"""--verbose"""'], {'is_flag': '(True)', 'help': '"""verbose mode enabled."""'}), "('--verbose', is_flag=True, help='verbose mode enabled.')\n", (200, 257), False, 'imp... |
from tests.testutils.mocks.mock_paths import MockPaths
def test_app():
with MockPaths():
from tilescopegui.factory import TestingConfig, create_app
app = create_app(TestingConfig())
app.blueprints["home_blueprint"].template_folder = MockPaths._TMP.as_posix()
yield app
| [
"tests.testutils.mocks.mock_paths.MockPaths",
"tests.testutils.mocks.mock_paths.MockPaths._TMP.as_posix",
"tilescopegui.factory.TestingConfig"
] | [((82, 93), 'tests.testutils.mocks.mock_paths.MockPaths', 'MockPaths', ([], {}), '()\n', (91, 93), False, 'from tests.testutils.mocks.mock_paths import MockPaths\n'), ((264, 289), 'tests.testutils.mocks.mock_paths.MockPaths._TMP.as_posix', 'MockPaths._TMP.as_posix', ([], {}), '()\n', (287, 289), False, 'from tests.test... |
# -*- coding: utf-8 -*
"""logger.py
:DATE: 2019/12/25 18:32:24
LOGGING SETTING FOR OpenPraat
"""
from pathlib import Path
import logging
import sys
LOGGINGDIR = Path.home().joinpath(".local", "share", "open-praat", "logs")
def createLogger(name):
"""Logger の初期化を行います"""
formatter = logging.Formatter(
... | [
"logging.getLogger",
"logging.StreamHandler",
"pathlib.Path",
"logging.Formatter",
"pathlib.Path.home"
] | [((296, 363), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s:%(name)s:%(levelname)s:%(message)s"""'], {}), "('%(asctime)s:%(name)s:%(levelname)s:%(message)s')\n", (313, 363), False, 'import logging\n'), ((387, 420), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (... |
import logging
from datetime import datetime
from django.db import models
from django.db.models import QuerySet
from . import _thread_locals
logger = logging.getLogger(__name__)
class SoftDeleteManager(models.Manager):
def __init__(self, *args, **kwargs):
self.with_deleted = kwargs.pop("deleted", False... | [
"logging.getLogger",
"datetime.datetime.utcnow"
] | [((153, 180), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'import logging\n'), ((700, 717), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (715, 717), False, 'from datetime import datetime\n')] |
""" converts a GEDCOM file into a JSON file for use in Topographic Attribute Maps
(https://github.com/rpreiner/tam)
this is just a proof of concept and might contain serious mistakes and problems
"""
import argparse
import json
import re
__author__ = "<NAME>"
def add_child(parentId, childId, idsWithNodes, nodesWithF... | [
"json.dump",
"re.match",
"argparse.ArgumentParser"
] | [((1210, 1324), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""convert GEDCOM file to JSON file for use in Topographic Attribute Maps"""'}), "(description=\n 'convert GEDCOM file to JSON file for use in Topographic Attribute Maps')\n", (1233, 1324), False, 'import argparse\n'), ((3617... |
from __future__ import division
import numpy as np
from loss import Loss
from npai_stats import NpaiStats
from sigmoid import Sigmoid
class CrossEntropy(Loss):
def __init__(self): pass
def loss(self, y, p):
# Avoid division by zero
p = np.clip(p, 1e-15, 1 - 1e-15)
return - y * np.log(p... | [
"numpy.clip",
"numpy.log",
"numpy.argmax"
] | [((262, 290), 'numpy.clip', 'np.clip', (['p', '(1e-15)', '(1 - 1e-15)'], {}), '(p, 1e-15, 1 - 1e-15)\n', (269, 290), True, 'import numpy as np\n'), ((508, 536), 'numpy.clip', 'np.clip', (['p', '(1e-15)', '(1 - 1e-15)'], {}), '(p, 1e-15, 1 - 1e-15)\n', (515, 536), True, 'import numpy as np\n'), ((312, 321), 'numpy.log',... |
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
from typing import NoReturn
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
pio.templat... | [
"plotly.graph_objects.Layout",
"pandas.read_csv",
"plotly.express.bar",
"IMLearn.utils.split_train_test",
"numpy.array",
"plotly.graph_objects.Scatter",
"numpy.random.seed",
"IMLearn.learners.regressors.PolynomialFitting"
] | [((1425, 1468), 'pandas.read_csv', 'pd.read_csv', (['filename'], {'parse_dates': "['Date']"}), "(filename, parse_dates=['Date'])\n", (1436, 1468), True, 'import pandas as pd\n'), ((3676, 3733), 'IMLearn.utils.split_train_test', 'split_train_test', (["isr_data['DayOfYear']", "isr_data['Temp']"], {}), "(isr_data['DayOfYe... |
# coding=utf-8
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE 2
Game menu with 3 difficulty options.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2019 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to... | [
"pygame.display.set_caption",
"pygame.init",
"pygame.event.get",
"random.randrange",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.time.Clock",
"pygame.font.Font"
] | [((2040, 2053), 'pygame.init', 'pygame.init', ([], {}), '()\n', (2051, 2053), False, 'import pygame\n'), ((2139, 2175), 'pygame.display.set_mode', 'pygame.display.set_mode', (['WINDOW_SIZE'], {}), '(WINDOW_SIZE)\n', (2162, 2175), False, 'import pygame\n'), ((2176, 2226), 'pygame.display.set_caption', 'pygame.display.se... |
# ************************************************************
# Author : <NAME>, 2017
# Github : https://github.com/meliketoy/cellnet.pytorch
#
# Korea University, Data-Mining Lab
# Deep Convolutional Network Fine tuning Implementation
#
# Module : 2_parser
# Description : XML_function.py
# The function code for XML f... | [
"cv2.rectangle",
"os.path.exists",
"xml.etree.ElementTree.parse",
"os.makedirs",
"os.path.join",
"cv2.imread",
"os.walk"
] | [((937, 952), 'os.walk', 'os.walk', (['in_dir'], {}), '(in_dir)\n', (944, 952), False, 'import os\n'), ((1205, 1215), 'xml.etree.ElementTree.parse', 'parse', (['xml'], {}), '(xml)\n', (1210, 1215), False, 'from xml.etree.ElementTree import parse\n'), ((1757, 1773), 'os.walk', 'os.walk', (['xml_dir'], {}), '(xml_dir)\n'... |
'''OpenGL extension EXT.framebuffer_blit
This module customises the behaviour of the
OpenGL.raw.GL.EXT.framebuffer_blit to provide a more
Python-friendly API
Overview (from the spec)
This extension modifies EXT_framebuffer_object by splitting the
framebuffer object binding point into separate DRAW and READ
bin... | [
"OpenGL.extensions.hasGLExtension"
] | [((1058, 1100), 'OpenGL.extensions.hasGLExtension', 'extensions.hasGLExtension', (['_EXTENSION_NAME'], {}), '(_EXTENSION_NAME)\n', (1083, 1100), False, 'from OpenGL import extensions\n')] |
"""
Django settings for happy project.
Generated by 'django-admin startproject' using Django 2.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
impo... | [
"os.path.join",
"datetime.timedelta",
"os.environ.get",
"os.path.abspath"
] | [((4043, 4078), 'os.environ.get', 'os.environ.get', (['"""AWS_ACCESS_KEY_ID"""'], {}), "('AWS_ACCESS_KEY_ID')\n", (4057, 4078), False, 'import os\n'), ((4103, 4142), 'os.environ.get', 'os.environ.get', (['"""AWS_SECRET_ACCESS_KEY"""'], {}), "('AWS_SECRET_ACCESS_KEY')\n", (4117, 4142), False, 'import os\n'), ((4169, 421... |
"""Import data from database."""
import sqlite3 as lite
from sqlite3 import Error as LiteError
import pandas as pd
from datetime import datetime
from test_utils import clean_data
class Importer:
def __init__(self, *args, **kwargs):
self.database_name = kwargs['database_name']
self._connection = s... | [
"sqlite3.connect"
] | [((476, 508), 'sqlite3.connect', 'lite.connect', (['self.database_name'], {}), '(self.database_name)\n', (488, 508), True, 'import sqlite3 as lite\n')] |
'''
This software is the ground station GUI software that will
be used to view and analyze flight data while also be able
to configure the custom flight computer built by the
students of SEDS@IIT.
The goal is to make the software compatable with multiple
OS enviroments with minimal additional packages and easy
to use ... | [
"pandas.read_csv",
"matplotlib.style.use",
"tkinter.Frame",
"tkinter.ttk.Label",
"tkinter.Tk.config",
"tkinter.messagebox.showinfo",
"PIL.ImageTk.PhotoImage",
"tkinter.filedialog.askopenfilename",
"tkinter.Menu",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg",
"tkinter.Image",
"matplotl... | [((658, 681), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (672, 681), False, 'import matplotlib\n'), ((1201, 1220), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (1210, 1220), False, 'from matplotlib import style\n'), ((1236, 1267), 'matplotlib.figure.Figure'... |
from IPython import display
__all__ = ("update_plot",)
def update_plot(fig):
"""Interactively update fig in Jupyter notebook.
args:
fig (matplotlib.figure.Figure): updated figure to replot
"""
display.clear_output(wait=True)
display.display(fig)
return
| [
"IPython.display.display",
"IPython.display.clear_output"
] | [((221, 252), 'IPython.display.clear_output', 'display.clear_output', ([], {'wait': '(True)'}), '(wait=True)\n', (241, 252), False, 'from IPython import display\n'), ((257, 277), 'IPython.display.display', 'display.display', (['fig'], {}), '(fig)\n', (272, 277), False, 'from IPython import display\n')] |
#!/usr/bin/env python
"""Bayesian linear regression using variational inference.
This version directly regresses on the data X, rather than regressing
on a placeholder X. Note this prevents the model from conditioning on
other values of X.
References
----------
http://edwardlib.org/tutorials/supervised-regression
"""... | [
"numpy.random.normal",
"tensorflow.random_normal",
"tensorflow.ones",
"edward.KLqp",
"edward.set_seed",
"numpy.linspace",
"tensorflow.cast",
"edward.dot",
"tensorflow.zeros"
] | [((771, 786), 'edward.set_seed', 'ed.set_seed', (['(42)'], {}), '(42)\n', (782, 786), True, 'import edward as ed\n'), ((895, 922), 'tensorflow.cast', 'tf.cast', (['X_data', 'tf.float32'], {}), '(X_data, tf.float32)\n', (902, 922), True, 'import tensorflow as tf\n'), ((1336, 1377), 'edward.KLqp', 'ed.KLqp', (['{w: qw, b... |
import time
from pyscf import scf
import os, time
import numpy as np
from mldftdat.lowmem_analyzers import RHFAnalyzer, UHFAnalyzer
from mldftdat.workflow_utils import get_save_dir, SAVE_ROOT, load_mol_ids
from mldftdat.density import get_exchange_descriptors2, LDA_FACTOR, GG_AMIN
from mldftdat.data import get_unique_c... | [
"logging.basicConfig",
"mldftdat.density.get_exchange_descriptors2",
"argparse.ArgumentParser",
"os.makedirs",
"yaml.dump",
"time.monotonic",
"os.path.join",
"numpy.append",
"numpy.array",
"os.path.isdir",
"mldftdat.workflow_utils.load_mol_ids",
"os.path.basename",
"mldftdat.data.get_unique_... | [((4283, 4313), 'os.path.basename', 'os.path.basename', (['DATASET_NAME'], {}), '(DATASET_NAME)\n', (4299, 4313), False, 'import os, time\n'), ((4329, 4406), 'os.path.join', 'os.path.join', (['SAVE_ROOT', '"""DATASETS"""', 'FUNCTIONAL', 'BASIS', 'version', 'DATASET_NAME'], {}), "(SAVE_ROOT, 'DATASETS', FUNCTIONAL, BASI... |
from __future__ import print_function
import os
import random
import signal
import numpy as np
from robolearn.old_utils.sampler import Sampler
from robolearn.old_agents import GPSAgent
from robolearn.old_algos.gps.gps import GPS
from robolearn.old_costs.cost_action import CostAction
from robolearn.old_costs.cost_fk ... | [
"robolearn.old_utils.print_utils.change_print_color.change",
"robolearn.old_utils.tasks.bigman.lift_box_utils.load_task_space_torque_control_demos",
"numpy.array",
"robolearn.old_utils.tasks.bigman.lift_box_utils.Reset_condition_bigman_box_gazebo",
"robolearn.old_utils.tasks.bigman.lift_box_utils.spawn_box_... | [((1814, 1877), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'suppress': '(True)', 'linewidth': '(1000)'}), '(precision=4, suppress=True, linewidth=1000)\n', (1833, 1877), True, 'import numpy as np\n'), ((2009, 2054), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'kill_everything'],... |
import os
import numpy as np
import time
import subprocess
import sys
setups = ['spec', 'spec', 'spec']
GPU = 0
script = 'train.py'
if __name__ == '__main__':
start = time.time()
for stp in setups:
str_exec = 'CUDA_VISIBLE_DEVICES=' + str(GPU) + ' python ' + str(script) + ' ' + str(stp)
#str_e... | [
"time.time",
"subprocess.call"
] | [((173, 184), 'time.time', 'time.time', ([], {}), '()\n', (182, 184), False, 'import time\n'), ((742, 753), 'time.time', 'time.time', ([], {}), '()\n', (751, 753), False, 'import time\n'), ((474, 511), 'subprocess.call', 'subprocess.call', (['str_exec'], {'shell': '(True)'}), '(str_exec, shell=True)\n', (489, 511), Fal... |
import discord
from discord.ext import commands
class Owner(commands.Cog):
def __init__(self, kita):
self.kita = kita
@commands.command(name='reload', hidden=True)
@commands.is_owner()
async def _reload(self, ctx, *, cog):
"""Reload cog"""
try:
self.kita.unload_ex... | [
"discord.Embed",
"discord.ext.commands.command",
"discord.ext.commands.is_owner"
] | [((139, 183), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""reload"""', 'hidden': '(True)'}), "(name='reload', hidden=True)\n", (155, 183), False, 'from discord.ext import commands\n'), ((189, 208), 'discord.ext.commands.is_owner', 'commands.is_owner', ([], {}), '()\n', (206, 208), False, 'from ... |
#!/bin/usr/python3
"""Test Place"""
import unittest
from models.base_model import BaseModel
from models.place import Place
class TestPlace(unittest.TestCase):
"""Test Place"""
def test_class(self):
"""Test class"""
self.assertEqual(Place.city_id, "")
self.assertEqual(Place.user_id, "... | [
"models.place.Place"
] | [((879, 886), 'models.place.Place', 'Place', ([], {}), '()\n', (884, 886), False, 'from models.place import Place\n')] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Name: <NAME>
# Date: October 11, 2019
# Email: <EMAIL>
# Description: Contains several general-purpose utility functions
import os
import tensorflow as tf
import argparse
def set_gpu(gpu, frac):
"""
Function to specify which GPU to use
I... | [
"tensorflow.GPUOptions",
"argparse.ArgumentTypeError"
] | [((599, 650), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'per_process_gpu_memory_fraction': 'frac'}), '(per_process_gpu_memory_fraction=frac)\n', (612, 650), True, 'import tensorflow as tf\n'), ((953, 1015), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (["('%r no in range [0.0, 1.0]' % (x,))"], {}),... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... | [
"anaconda_project.requirements_registry.requirement.UserConfigOverrides",
"anaconda_project.requirements_registry.registry.RequirementsRegistry",
"anaconda_project.internal.test.tmpfile_utils.with_directory_contents",
"anaconda_project.local_state_file.LocalStateFile.load_for_directory"
] | [((829, 851), 'anaconda_project.requirements_registry.registry.RequirementsRegistry', 'RequirementsRegistry', ([], {}), '()\n', (849, 851), False, 'from anaconda_project.requirements_registry.registry import RequirementsRegistry\n'), ((1557, 1599), 'anaconda_project.internal.test.tmpfile_utils.with_directory_contents',... |
# Copyright (c) 2017 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"neutron_lib.context.get_admin_context",
"neutron.plugins.ml2.config.cfg.CONF.set_override",
"neutron_lib.plugins.directory.get_plugin"
] | [((1249, 1317), 'neutron.plugins.ml2.config.cfg.CONF.set_override', 'config.cfg.CONF.set_override', (['"""enable_dhcp_service"""', '(True)', '"""ml2_odl"""'], {}), "('enable_dhcp_service', True, 'ml2_odl')\n", (1277, 1317), False, 'from neutron.plugins.ml2 import config\n'), ((1993, 2028), 'neutron_lib.context.get_admi... |
import json
import os
import ccxt
import pandas as pd
import requests
import file_utils
from dm_utils import *
from file_utils import alogger
@alogger
def update_ticker_binance(directory, timeframe, pairs, initial_candles, zeitpunkt=None, postfix=""):
return _update_ticker_binance(directory, timeframe, pairs, i... | [
"file_utils.load_json",
"json.loads",
"file_utils.save_json",
"requests.get",
"os.path.isfile",
"ccxt.binance",
"pandas.to_datetime"
] | [((2837, 2854), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2849, 2854), False, 'import requests\n'), ((2866, 2887), 'json.loads', 'json.loads', (['r.content'], {}), '(r.content)\n', (2876, 2887), False, 'import json\n'), ((3313, 3327), 'ccxt.binance', 'ccxt.binance', ([], {}), '()\n', (3325, 3327), Fals... |
#!/usr/bin/env python
## Copyright (c) 2019, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in the LICENSE file, you ca... | [
"logging.getLogger",
"CalcQtyWithVmafTool.VMAF_GatherQualityMetrics",
"CalcQtyWithVmafTool.VMAF_CalQualityMetrics",
"CalcQtyWithFfmpeg.FFMPEG_CalQualityMetrics",
"CalcQtyWithHdrTools.HDRTool_CalQualityMetrics",
"CalcQtyWithHdrTools.HDRTool_GatherQualityMetrics",
"Utils.CmdLogger.write",
"CalcQtyWithFf... | [((1108, 1137), 'logging.getLogger', 'logging.getLogger', (['loggername'], {}), '(loggername)\n', (1125, 1137), False, 'import logging\n'), ((1406, 1450), 'Utils.CmdLogger.write', 'Utils.CmdLogger.write', (['"""::Quality Metrics\n"""'], {}), "('::Quality Metrics\\n')\n", (1427, 1450), False, 'import Utils\n'), ((1602, ... |
"""
@file
@brief This extension contains various functionalities to help unittesting.
"""
import os
import sys
import glob
import re
import unittest
import warnings
from io import StringIO
from .utils_tests_stringio import StringIOAndFile
from .default_filter_warning import default_filter_warning
from ..filehelper.sync... | [
"os.path.exists",
"unittest.TestSuite",
"sys.executable.replace",
"sys.path.insert",
"re.compile",
"os.environ.get",
"os.path.join",
"warnings.catch_warnings",
"os.path.split",
"os.path.isfile",
"sys.stderr.write",
"warnings.simplefilter",
"os.path.isdir",
"os.path.abspath",
"io.StringIO... | [((13702, 13749), 're.compile', 're.compile', (['"""Ran ([0-9]+) tests? in ([.0-9]+)s"""'], {}), "('Ran ([0-9]+) tests? in ([.0-9]+)s')\n", (13712, 13749), False, 'import re\n'), ((14254, 14264), 'io.StringIO', 'StringIO', ([], {}), '()\n', (14262, 14264), False, 'from io import StringIO\n'), ((2681, 2711), 'glob.glob'... |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import PollPlugin
from django.utils.translation import ugettext as _
class CMSPollPlugin(CMSPluginBase):
model = PollPlugin
name = _("Simple poll")
render_template = "cmsplugin_poll/detail.html"
def render(... | [
"django.utils.translation.ugettext",
"cms.plugin_pool.plugin_pool.register_plugin"
] | [((423, 465), 'cms.plugin_pool.plugin_pool.register_plugin', 'plugin_pool.register_plugin', (['CMSPollPlugin'], {}), '(CMSPollPlugin)\n', (450, 465), False, 'from cms.plugin_pool import plugin_pool\n'), ((236, 252), 'django.utils.translation.ugettext', '_', (['"""Simple poll"""'], {}), "('Simple poll')\n", (237, 252), ... |
##==============================================================#
## SECTION: Imports #
##==============================================================#
import io
import sys
import os.path as op
import auxly.filesys as fsys
import qprompt
import requests
##===============... | [
"sys.setdefaultencoding",
"auxly.filesys.makedirs",
"os.path.join",
"io.open",
"requests.get",
"os.path.isfile",
"os.path.isdir",
"os.path.abspath",
"urllib.parse.unquote",
"qprompt.error"
] | [((585, 616), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (607, 616), False, 'import sys\n'), ((3789, 3808), 'os.path.abspath', 'op.abspath', (['dstpath'], {}), '(dstpath)\n', (3799, 3808), True, 'import os.path as op\n'), ((2416, 2429), 'urllib.parse.unquote', 'unquote', (... |
import requests
import json
import time
import logging
from nose.tools import with_setup
log = logging.getLogger(__name__)
sh = logging.StreamHandler()
log.addHandler(sh)
log.setLevel(logging.INFO)
base_url = 'http://localhost:8080/api'
test_data = type('',(object,),{})()
session = None
def setup_download():
g... | [
"logging.getLogger",
"json.loads",
"logging.StreamHandler",
"nose.tools.with_setup",
"requests.Session",
"json.dumps",
"time.time"
] | [((96, 123), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (113, 123), False, 'import logging\n'), ((129, 152), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (150, 152), False, 'import logging\n'), ((3649, 3694), 'nose.tools.with_setup', 'with_setup', (['setup_downl... |
#
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"qtpy.QtWidgets.QMenuBar",
"qtpy.QtWidgets.QToolBar",
"qtpy.QtCore.Signal",
"qtpy.QtGui.QKeySequence",
"qtpy.QtWidgets.QMessageBox.warning",
"qtpy.QtCore.QModelIndex"
] | [((2445, 2469), 'qtpy.QtCore.Signal', '_QtCore.Signal', (['str', 'str'], {}), '(str, str)\n', (2459, 2469), True, 'from qtpy import QtCore as _QtCore\n'), ((2261, 2309), 'qtpy.QtWidgets.QMessageBox.warning', '_QtWidgets.QMessageBox.warning', (['self', 'title', 'msg'], {}), '(self, title, msg)\n', (2291, 2309), True, 'f... |
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D, proj3d
import matplotlib.pyplot as plt
import numpy as np
import itertools
import oloid.circle
fig = plt.figure()
ax = fig.gca(projection='3d')
# #dibujar cubo
r = [-1, 1]
for s, e in itertools.combination... | [
"numpy.abs",
"itertools.product",
"matplotlib.pyplot.figure",
"matplotlib.patches.FancyArrowPatch.__init__",
"matplotlib.patches.FancyArrowPatch.draw",
"mpl_toolkits.mplot3d.proj3d.proj_transform",
"matplotlib.pyplot.show"
] | [((215, 227), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (225, 227), True, 'import matplotlib.pyplot as plt\n'), ((1806, 1816), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1814, 1816), True, 'import matplotlib.pyplot as plt\n'), ((609, 681), 'matplotlib.patches.FancyArrowPatch.__init__', '... |
# Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.random.uniform",
"absl.testing.parameterized.named_parameters",
"tensorflow.ones"
] | [((2356, 2450), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (['*TEST_CONFIGURATIONS', "('CutMix', preprocessing.CutMix, {})"], {}), "(*TEST_CONFIGURATIONS, ('CutMix',\n preprocessing.CutMix, {}))\n", (2386, 2450), False, 'from absl.testing import parameterized\n'), ((2891, 2943),... |
"""
parseando arquivo html
retornando texto
parser padrão
"""
# importando modulo BeautifulSoup do pacote bs4
from bs4 import BeautifulSoup
# abrir arquivo para leitura
with open('arquivo01.html','r') as f:
soup = BeautifulSoup(f, 'html5lib')
# transforma em uma string bem formatada
#print(soup.prettify())
# ret... | [
"bs4.BeautifulSoup"
] | [((219, 247), 'bs4.BeautifulSoup', 'BeautifulSoup', (['f', '"""html5lib"""'], {}), "(f, 'html5lib')\n", (232, 247), False, 'from bs4 import BeautifulSoup\n')] |
import numpy as np
import dnplab as dnp
def get_gauss_3d(std_noise=0.0):
x = np.r_[0:100]
y = np.r_[0:100]
z = np.r_[0:100]
noise = std_noise * np.random.randn(len(x), len(y), len(z))
gauss = np.exp(-1.0 * (x - 50) ** 2.0 / (10.0 ** 2))
gauss_3d = (
gauss.reshape(-1, 1, 1) * gauss.res... | [
"numpy.exp",
"dnplab.DNPData"
] | [((215, 257), 'numpy.exp', 'np.exp', (['(-1.0 * (x - 50) ** 2.0 / 10.0 ** 2)'], {}), '(-1.0 * (x - 50) ** 2.0 / 10.0 ** 2)\n', (221, 257), True, 'import numpy as np\n'), ((511, 560), 'dnplab.DNPData', 'dnp.DNPData', (['gauss_3d', "['x', 'y', 'z']", '[x, y, z]'], {}), "(gauss_3d, ['x', 'y', 'z'], [x, y, z])\n", (522, 56... |
import sys
import os
import csv
import sqlite3
class Database():
"""
This is the class for controlling the Database for the Blender Addon
The Goal is to create a database and have acces to the stored variables like camera positions, lights and obkects
Classvariables:
filepath (String): the Path t... | [
"os.listdir",
"sqlite3.connect",
"os.path.join",
"os.path.dirname",
"csv.reader"
] | [((1666, 1691), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1681, 1691), False, 'import os\n'), ((1716, 1756), 'os.path.join', 'os.path.join', (['self.filepath', '"""Datenbank"""'], {}), "(self.filepath, 'Datenbank')\n", (1728, 1756), False, 'import os\n'), ((1797, 1846), 'os.path.join', ... |
# Generated by Django 2.2.4 on 2020-01-19 03:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('orders', '0007_order_braintree_id'),
]
operations = [
migrations.RemoveField(
model_name='order',
name='braintree_id',
... | [
"django.db.migrations.RemoveField"
] | [((226, 289), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""order"""', 'name': '"""braintree_id"""'}), "(model_name='order', name='braintree_id')\n", (248, 289), False, 'from django.db import migrations\n')] |
from collections import defaultdict
def _items_from_list(l):
for i in range(len(l)):
yield i, l[i]
def _items_from_dict(l):
return l.items()
def choose_from_distribution(distribution, random_number):
s = 0
last_key = None
items = (
_items_from_dict if hasattr(distribution, 'ite... | [
"collections.defaultdict"
] | [((933, 958), 'collections.defaultdict', 'defaultdict', (['(lambda : 0.0)'], {}), '(lambda : 0.0)\n', (944, 958), False, 'from collections import defaultdict\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 18:30:06 2018
@author: malopez
"""
import numpy as np
from numpy import random_intel
def computeCollisions(alpha, N, rem, dt, rv_max, vel):
# First we have to determine the maximum number of candidate collisions
n_cols_max = (N * rv_max * dt /2) + rem
... | [
"numpy.random_intel.uniform",
"numpy.sqrt",
"numpy.random_intel.choice",
"numpy.floor",
"numpy.stack",
"numpy.sum",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.random_intel.seed"
] | [((571, 603), 'numpy.random_intel.seed', 'random_intel.seed', ([], {'brng': '"""MT2203"""'}), "(brng='MT2203')\n", (588, 603), False, 'from numpy import random_intel\n'), ((687, 731), 'numpy.random_intel.choice', 'random_intel.choice', (['N'], {'size': '(n_cols_max, 2)'}), '(N, size=(n_cols_max, 2))\n', (706, 731), Fal... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import logging
from typing import Dict
# For import ascii_table__simple_pretty__ljust.py
import sys
sys.path.append('..')
from ascii_table__simple_pretty__ljust import pretty_table
def get_table(assigned_open_issues_per_project: Dict[str, int... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"sys.path.append",
"ascii_table__simple_pretty__ljust.pretty_table"
] | [((176, 197), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (191, 197), False, 'import sys\n'), ((426, 444), 'ascii_table__simple_pretty__ljust.pretty_table', 'pretty_table', (['data'], {}), '(data)\n', (438, 444), False, 'from ascii_table__simple_pretty__ljust import pretty_table\n'), ((787, 81... |
import torch
CUDA_DEVICE = 'gpu' if torch.cuda.is_available() else 'cpu' | [
"torch.cuda.is_available"
] | [((37, 62), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (60, 62), False, 'import torch\n')] |
from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
import torchaudio
from constants import INPUT_SAMPLE_RATE, TARGET_SAMPLE_RATE
from torch.utils.data import DataLoader, Dataset
from tqdm import tqdm
class SegmentationDataset(Dataset)... | [
"pandas.read_csv",
"torchaudio.backend.sox_io_backend.load",
"numpy.arange",
"pathlib.Path",
"torch.mean",
"numpy.where",
"torchaudio.info",
"numpy.random.seed",
"pandas.DataFrame",
"numpy.round",
"torch.std",
"numpy.insert",
"numpy.append",
"torch.tensor",
"numpy.zeros",
"numpy.random... | [((26545, 26586), 'torch.ones', 'torch.ones', (['audio.shape'], {'dtype': 'torch.long'}), '(audio.shape, dtype=torch.long)\n', (26555, 26586), False, 'import torch\n'), ((788, 809), 'pathlib.Path', 'Path', (['path_to_dataset'], {}), '(path_to_dataset)\n', (792, 809), False, 'from pathlib import Path\n'), ((1117, 1210),... |
# Generated by Django 2.1.5 on 2019-01-12 22:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Program',
fields=[
... | [
"django.db.models.DecimalField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((1703, 1789), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""ircoapp.Site"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'ircoapp.Site')\n", (1720, 1789), False, 'from django.db import migrations, models\n'), ((336, 429), 'django.d... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Sistem Koperasi
import frappe
from frappe.utils import today, flt
@frappe.whitelist()
def dkh_get_permission_query_conditions(user=None):
if not user: user = frappe.session.user
return """(`tabDKH`.parent_sales_executive = '{}')""".format(user)
if user == "Administrat... | [
"frappe.whitelist",
"frappe.db.get_value",
"frappe.get_roles"
] | [((116, 134), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (132, 134), False, 'import frappe\n'), ((441, 459), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (457, 459), False, 'import frappe\n'), ((589, 642), 'frappe.db.get_value', 'frappe.db.get_value', (['group_type', 'root', "['lft', 'rgt']"... |
from core.himesis import Himesis
import cPickle as pickle
from uuid import UUID
class HTransition2Inst(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HTransition2Inst.
"""
# Flag this instance as compiled now
self.is_compiled = Tru... | [
"cPickle.loads",
"uuid.UUID"
] | [((1442, 1492), 'cPickle.loads', 'pickle.loads', (['"""(lp1\nS\'UMLRT2Kiltera_MM\'\np2\na."""'], {}), '("""(lp1\nS\'UMLRT2Kiltera_MM\'\np2\na.""")\n', (1454, 1492), True, 'import cPickle as pickle\n'), ((1563, 1607), 'uuid.UUID', 'UUID', (['"""6fffb6c1-f004-4c95-8ef3-fbe385299f74"""'], {}), "('6fffb6c1-f004-4c95-8ef3-f... |
# -*- coding: utf-8 -*-
from resources.constants import EMPTY_STR, EMPTY_LIST, EMPTY_DICT
from dateutil import parser
class Podcast():
"""
Podcast class
"""
def __init__(self, title, podcast_url, **kwargs):
"""
Initialize the class with you title and podcast_url, other meta informatio... | [
"dateutil.parser.parse"
] | [((3335, 3362), 'dateutil.parser.parse', 'parser.parse', (['self.pub_date'], {}), '(self.pub_date)\n', (3347, 3362), False, 'from dateutil import parser\n')] |
import torch.nn as nn
import math
import torch
from collections import namedtuple
from maskrcnn_benchmark.layers import FrozenBatchNorm2d
# s0 = top layer idx
# name = sub op name
# s1 = sub layer idx
GraphPath = namedtuple("GraphPath", ['s0', 'name', 's1']) #
def conv_bn(inp, oup, stride, norm_func):
return nn.S... | [
"collections.namedtuple",
"torch.nn.CrossEntropyLoss",
"torch.nn.Sequential",
"math.sqrt",
"torch.nn.Conv2d",
"torch.nn.LogSoftmax",
"torch.nn.Linear",
"torch.zeros_like",
"torch.nn.ReLU6"
] | [((213, 258), 'collections.namedtuple', 'namedtuple', (['"""GraphPath"""', "['s0', 'name', 's1']"], {}), "('GraphPath', ['s0', 'name', 's1'])\n", (223, 258), False, 'from collections import namedtuple\n'), ((339, 384), 'torch.nn.Conv2d', 'nn.Conv2d', (['inp', 'oup', '(3)', 'stride', '(1)'], {'bias': '(False)'}), '(inp,... |
import functools
import math
from typing import List, Optional
from PySide2.QtCore import Qt, QCoreApplication
from PySide2.QtWidgets import QMainWindow, QStatusBar, QLabel, QWidget, QGridLayout, QPushButton, QHBoxLayout
import gui
import logic
class MainWindow(QMainWindow):
def __init__(self, device_manager: l... | [
"PySide2.QtWidgets.QGridLayout",
"PySide2.QtCore.QCoreApplication.translate",
"PySide2.QtWidgets.QMainWindow.__init__",
"math.floor",
"PySide2.QtWidgets.QHBoxLayout",
"PySide2.QtWidgets.QWidget",
"functools.partial",
"gui.ActionWidget",
"PySide2.QtWidgets.QLabel",
"PySide2.QtWidgets.QStatusBar"
] | [((349, 375), 'PySide2.QtWidgets.QMainWindow.__init__', 'QMainWindow.__init__', (['self'], {}), '(self)\n', (369, 375), False, 'from PySide2.QtWidgets import QMainWindow, QStatusBar, QLabel, QWidget, QGridLayout, QPushButton, QHBoxLayout\n'), ((788, 796), 'PySide2.QtWidgets.QLabel', 'QLabel', ([], {}), '()\n', (794, 79... |
import argparse
import deepspeed
import torch.nn as nn
import torch.nn.functional as F
import torch
import torchvision
dataset_dir = r"test_frames"
parser = argparse.ArgumentParser()
parser.add_argument('deepspeed_config')
args = parser.parse_args()
class Decoder(nn.Module):
def __init__(self, dim, depth=6, ... | [
"deepspeed.initialize",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"argparse.ArgumentParser",
"torch.Tensor",
"torch.nn.Conv2d",
"torch.nn.MSELoss",
"torch.nn.Upsample",
"torch.nn.AvgPool2d",
"torchvision.models.densenet121",
"torch.nn.ConvTranspose2d"
] | [((161, 186), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (184, 186), False, 'import argparse\n'), ((7518, 7597), 'deepspeed.initialize', 'deepspeed.initialize', ([], {'args': 'args', 'model': 'model', 'model_parameters': 'model.parameters'}), '(args=args, model=model, model_parameters=model... |
#!/usr/bin/env python3.7
import os, requests
json = {
"environmentGuid": "guid-1007",
"asynchronous": False,
"actions": [
{
"containerGuid": "guid-2405",
"instanceGuid": "guid-46462",
"filename": "sleep.sh"
},
{
"containerGuid": "guid-2405",
"instanceGuid": "a13eabdd-f8da-4ebe-a54c-c9fdb55885e... | [
"requests.request"
] | [((792, 863), 'requests.request', 'requests.request', (['"""POST"""', 'url'], {'headers': 'headers', 'verify': '(False)', 'json': 'json'}), "('POST', url, headers=headers, verify=False, json=json)\n", (808, 863), False, 'import os, requests\n')] |
# -*-coding:utf-8-*-
from moviepy.editor import VideoFileClip, CompositeVideoClip
import os
import argparse
import sys
import time
from os.path import join, getsize
import logging
parser = argparse.ArgumentParser(description='Classify some images.')
# parser.add_argument('--mov', help='father path of mov', default="/m... | [
"logging.basicConfig",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"os.makedirs",
"moviepy.editor.CompositeVideoClip",
"logging.warning",
"os.path.join",
"time.sleep",
"logging.info",
"os.mkdir",
"time.time",
"time.localtime",
"moviepy.editor.VideoFileClip",
"logging.error... | [((190, 250), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Classify some images."""'}), "(description='Classify some images.')\n", (213, 250), False, 'import argparse\n'), ((2430, 2450), 'os.listdir', 'os.listdir', (['out_path'], {}), '(out_path)\n', (2440, 2450), False, 'import os\n')... |
import logging
import os
import traceback
from json import dumps
import tweepy
from kafka import KafkaProducer
from .sentiments import TweetAnalyzer
kafka_servers = [os.getenv("KAFKA_ENDPOINT", "kafka:9095")]
kafka_topic = os.getenv("KAFKA_TWITTER_TOPIC", "newsler-twitter-crawler")
def get_logger():
logging_le... | [
"logging.getLogger",
"traceback.format_exc",
"os.getenv",
"json.dumps",
"tweepy.API",
"logging.getLevelName",
"tweepy.OAuthHandler"
] | [((226, 285), 'os.getenv', 'os.getenv', (['"""KAFKA_TWITTER_TOPIC"""', '"""newsler-twitter-crawler"""'], {}), "('KAFKA_TWITTER_TOPIC', 'newsler-twitter-crawler')\n", (235, 285), False, 'import os\n'), ((169, 210), 'os.getenv', 'os.getenv', (['"""KAFKA_ENDPOINT"""', '"""kafka:9095"""'], {}), "('KAFKA_ENDPOINT', 'kafka:9... |
import pyplc
import threading, time
class Plc(object):
__pl = None
def __init__(self, db):
self.record = False
self.db = db
self.cur = self.db.getCursor()
print("Init PLC")
self.__pl = pyplc.PyPlc()
self.__pl.setrxcb(self.rx_callback)
self.__pl.speed=200... | [
"threading.Thread",
"pyplc.PyPlc",
"time.sleep"
] | [((235, 248), 'pyplc.PyPlc', 'pyplc.PyPlc', ([], {}), '()\n', (246, 248), False, 'import pyplc\n'), ((1350, 1381), 'time.sleep', 'time.sleep', (['(self.__delay / 1000)'], {}), '(self.__delay / 1000)\n', (1360, 1381), False, 'import threading, time\n'), ((2270, 2308), 'threading.Thread', 'threading.Thread', ([], {'targe... |
import numpy as np
from pylab import imshow, plot, show, gray
N = 1000 # the number of the divisions on the axis
NIT = 10 # f(z) precision
real = np.linspace(-2, 2, N) # Real axis
imaginario = np.linspace(-2, 2, N) # Imaginary axis
matriz_c = np.zeros((N, N), dtype=complex) ... | [
"pylab.gray",
"numpy.linspace",
"numpy.zeros",
"pylab.show"
] | [((164, 185), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', 'N'], {}), '(-2, 2, N)\n', (175, 185), True, 'import numpy as np\n'), ((227, 248), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', 'N'], {}), '(-2, 2, N)\n', (238, 248), True, 'import numpy as np\n'), ((287, 318), 'numpy.zeros', 'np.zeros', (['(N, N)'], ... |
"""
Implementation of X.660 Object Identifiers.
"""
from __future__ import annotations
from functools import total_ordering
from itertools import chain
from typing import Sequence, Tuple, Union
from asn1crypto.core import ObjectIdentifier as Asn1ObjId
def to_int_tuple(value: OidValue) -> Tuple[int, ...]:
"""
... | [
"asn1crypto.core.ObjectIdentifier",
"asn1crypto.core.ObjectIdentifier.load"
] | [((492, 513), 'asn1crypto.core.ObjectIdentifier.load', 'Asn1ObjId.load', (['value'], {}), '(value)\n', (506, 513), True, 'from asn1crypto.core import ObjectIdentifier as Asn1ObjId\n'), ((1484, 1506), 'asn1crypto.core.ObjectIdentifier', 'Asn1ObjId', (['self.dotted'], {}), '(self.dotted)\n', (1493, 1506), True, 'from asn... |
'''
Created on 13.02.2015
@author: Iris
'''
from Component.Component import Component
from Component.Container import container
from Util.Vector import Vector2
from Physics.Body import Body
from Physics.Damping import Damping
from Collision.AabbCollider import AabbCollider
from Component.LifeCycle import LifeCycle
fro... | [
"Component.Component.Component.activate",
"Collision.AabbCollider.AabbCollider",
"Component.LifeCycle.LifeCycle",
"Component.Container.container.add",
"Physics.Damping.Damping",
"Component.PoseTransmitter.PoseTransmitter",
"Component.Component.Component.__init__",
"Component.Component.Component.deacti... | [((596, 620), 'Component.Component.Component.__init__', 'Component.__init__', (['self'], {}), '(self)\n', (614, 620), False, 'from Component.Component import Component\n'), ((724, 748), 'Component.Component.Component.activate', 'Component.activate', (['self'], {}), '(self)\n', (742, 748), False, 'from Component.Compone... |
import os
import json
from Big_Data_Platform.Kubernetes.Kafka_Client.Confluent_Kafka_Python.src.classes.CKafkaPC import KafkaPC
from confluent_kafka import Producer
debugging = True
if debugging is True:
env_vars = {
"config_path": "./Use_Cases/VPS_Popcorn_Production/Kubernetes/src/configurations/config_... | [
"confluent_kafka.Producer",
"Big_Data_Platform.Kubernetes.Kafka_Client.Confluent_Kafka_Python.src.classes.CKafkaPC.KafkaPC",
"os.getenv"
] | [((571, 590), 'Big_Data_Platform.Kubernetes.Kafka_Client.Confluent_Kafka_Python.src.classes.CKafkaPC.KafkaPC', 'KafkaPC', ([], {}), '(**env_vars)\n', (578, 590), False, 'from Big_Data_Platform.Kubernetes.Kafka_Client.Confluent_Kafka_Python.src.classes.CKafkaPC import KafkaPC\n'), ((618, 683), 'confluent_kafka.Producer'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 9 22:04:01 2022
@author: lukepinkel
"""
import numpy as np
import scipy as sp
import scipy.linalg
import pandas as pd
from ..utilities.random import r_lkj, exact_rmvnorm
class FactorModelSim(object):
def __init__(self, n_vars=12, n_facs=... | [
"numpy.random.default_rng",
"numpy.sort",
"numpy.diag",
"numpy.zeros",
"numpy.linspace",
"scipy.linalg.block_diag",
"numpy.arange"
] | [((666, 702), 'numpy.zeros', 'np.zeros', (['(self.n_vars, self.n_facs)'], {}), '((self.n_vars, self.n_facs))\n', (674, 702), True, 'import numpy as np\n'), ((2016, 2028), 'numpy.diag', 'np.diag', (['psi'], {}), '(psi)\n', (2023, 2028), True, 'import numpy as np\n'), ((2606, 2646), 'scipy.linalg.block_diag', 'sp.linalg.... |
"""empty message
Revision ID: 2286baefdbc2
Revises: ca9ba145768e
Create Date: 2020-03-26 21:47:03.150005
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'ca9ba145768e'
branch_labels = None
depends_on = None
def upgrade():
# ### com... | [
"alembic.op.drop_constraint",
"sqlalchemy.String",
"alembic.op.drop_column"
] | [((593, 646), 'alembic.op.drop_constraint', 'op.drop_constraint', (['None', '"""locations"""'], {'type_': '"""unique"""'}), "(None, 'locations', type_='unique')\n", (611, 646), False, 'from alembic import op\n'), ((651, 694), 'alembic.op.drop_column', 'op.drop_column', (['"""locations"""', '"""country_code"""'], {}), "... |
# rules.py
import rules
# from rules import Predicate
from rules import predicates
from common import rules as common_rules
from .models import DataSource
rules.add_rule('can_list_datasources', predicates.always_allow)
rules.add_rule('can_edit_datasource',
common_rules.is_resource_owner | predicates.... | [
"rules.add_rule",
"rules.add_perm"
] | [((158, 221), 'rules.add_rule', 'rules.add_rule', (['"""can_list_datasources"""', 'predicates.always_allow'], {}), "('can_list_datasources', predicates.always_allow)\n", (172, 221), False, 'import rules\n'), ((223, 322), 'rules.add_rule', 'rules.add_rule', (['"""can_edit_datasource"""', '(common_rules.is_resource_owner... |
'''OpenGL extension APPLE.fence
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_APPLE_fence'
_DEPRECATED = False
GL_DRAW_PIXELS_APPLE = constan... | [
"OpenGL.extensions.hasGLExtension",
"OpenGL.constant.Constant",
"OpenGL.platform.createExtensionFunction"
] | [((313, 361), 'OpenGL.constant.Constant', 'constant.Constant', (['"""GL_DRAW_PIXELS_APPLE"""', '(35338)'], {}), "('GL_DRAW_PIXELS_APPLE', 35338)\n", (330, 361), False, 'from OpenGL import platform, constants, constant, arrays\n'), ((382, 424), 'OpenGL.constant.Constant', 'constant.Constant', (['"""GL_FENCE_APPLE"""', '... |
"""Test for djangopress.core.models."""
from model_mommy import mommy
from djangopress.core.models import Option
def test_option_str():
"""Test string representation for Option object."""
option = mommy.prepare(Option)
assert str(option) == option.name
| [
"model_mommy.mommy.prepare"
] | [((208, 229), 'model_mommy.mommy.prepare', 'mommy.prepare', (['Option'], {}), '(Option)\n', (221, 229), False, 'from model_mommy import mommy\n')] |
import math
import torch
import torch.nn as nn
class UpsampleFractionalConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=4, stride=2, negative_slope=0.2, activation=False):
super().__init__()
self.negative_slope = negative_slope
if activation:
sel... | [
"torch.nn.ConvTranspose2d",
"torch.nn.LeakyReLU",
"torch.nn.PixelShuffle",
"math.sqrt",
"torch.nn.init.kaiming_uniform_",
"torch.nn.init._calculate_fan_in_and_fan_out",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.init.uniform_"
] | [((1406, 1500), 'torch.nn.init.kaiming_uniform_', 'torch.nn.init.kaiming_uniform_', (['m.weight'], {'a': 'self.negative_slope', 'nonlinearity': '"""leaky_relu"""'}), "(m.weight, a=self.negative_slope,\n nonlinearity='leaky_relu')\n", (1436, 1500), False, 'import torch\n'), ((3357, 3451), 'torch.nn.init.kaiming_unifo... |
import serial
from contextlib import contextmanager
from typing import Iterator
class SerialData:
def __init__(self, ser):
self.__ser = ser
def read(self) -> Iterator[list[float]]:
while True:
try:
data = self.__readline()
if len(data) > 0:
... | [
"serial.Serial"
] | [((760, 799), 'serial.Serial', 'serial.Serial', (['"""/dev/tty.usbmodem00001"""'], {}), "('/dev/tty.usbmodem00001')\n", (773, 799), False, 'import serial\n')] |
from requests.auth import HTTPBasicAuth
def apply_updates(doc, update_dict):
# updates the doc with items from the dict
# returns whether or not any updates were made
should_save = False
for key, value in update_dict.items():
if getattr(doc, key, None) != value:
setattr(doc, key, v... | [
"requests.auth.HTTPBasicAuth"
] | [((565, 608), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (['self.username', 'self.password'], {}), '(self.username, self.password)\n', (578, 608), False, 'from requests.auth import HTTPBasicAuth\n')] |
#!/usr/bin/env python
"""
This script extracts btsnooz content from bugreports and generates
a valid btsnoop log file which can be viewed using standard tools
like Wireshark.
btsnooz is a custom format designed to be included in bugreports.
It can be described as:
base64 {
file_header
deflate {
repeated {
... | [
"struct.pack",
"sys.stderr.write",
"base64.standard_b64decode",
"sys.exit",
"fileinput.input",
"zlib.decompress",
"struct.unpack_from"
] | [((1740, 1772), 'struct.unpack_from', 'struct.unpack_from', (['"""=bQ"""', 'snooz'], {}), "('=bQ', snooz)\n", (1758, 1772), False, 'import struct\n'), ((1993, 2019), 'zlib.decompress', 'zlib.decompress', (['snooz[9:]'], {}), '(snooz[9:])\n', (2008, 2019), False, 'import zlib\n'), ((4765, 4799), 'fileinput.input', 'file... |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Databricks helper functions',
author='<NAME>',
license='',
)
| [
"setuptools.find_packages"
] | [((81, 96), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (94, 96), False, 'from setuptools import find_packages, setup\n')] |
import unittest
from IDM import IDM, IDMAuto
from Constants import *
from LaneChange import LaneChange
from Cars import *
from copy import copy, deepcopy
from CarFactory import *
from Street import *
class MyTestCase(unittest.TestCase):
def test_IDM(self):
# using the initial value of Cars
... | [
"unittest.main",
"IDM.IDM",
"LaneChange.LaneChange",
"copy.copy"
] | [((1915, 1930), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1928, 1930), False, 'import unittest\n'), ((332, 369), 'IDM.IDM', 'IDM', (['(112.65 / 3.6)', '(0.5)', '(3.0)', '(3.0)', '(1.5)'], {}), '(112.65 / 3.6, 0.5, 3.0, 3.0, 1.5)\n', (335, 369), False, 'from IDM import IDM, IDMAuto\n'), ((629, 649), 'LaneChan... |
import demo_quipuswap.models as models
from demo_quipuswap.types.quipu_fa2.storage import QuipuFa2Storage
from dipdup.context import HandlerContext
from dipdup.models import Origination
async def on_fa2_origination(
ctx: HandlerContext,
quipu_fa2_origination: Origination[QuipuFa2Storage],
) -> None:
if ct... | [
"demo_quipuswap.models.Position"
] | [((577, 646), 'demo_quipuswap.models.Position', 'models.Position', ([], {'trader': 'address', 'symbol': 'symbol', 'shares_qty': 'shares_qty'}), '(trader=address, symbol=symbol, shares_qty=shares_qty)\n', (592, 646), True, 'import demo_quipuswap.models as models\n')] |
from classes import biblioteca
def menu():
print("\n1-Inserir livros")
print("2- Exibir livros")
print("3-sair ")
op = int(input("\ndigite a opcao: "))
return op
def ler(biblioteca):
titulo = str(input("\ndigite o titulo do livro: "))
autor = str(input("digite o nome do autor: "))
data... | [
"classes.biblioteca.inserir_livros",
"classes.biblioteca"
] | [((525, 537), 'classes.biblioteca', 'biblioteca', ([], {}), '()\n', (535, 537), False, 'from classes import biblioteca\n'), ((456, 509), 'classes.biblioteca.inserir_livros', 'biblioteca.inserir_livros', (['titulo', 'autor', 'data', 'preco'], {}), '(titulo, autor, data, preco)\n', (481, 509), False, 'from classes import... |
import os
this_dir, _ = os.path.split(__file__)
DEFAULT_DATA_PATH = f"{this_dir}{os.sep}maps{os.sep}"
# Ontologies
ACTION: str = "ACTION"
AIM: str = "aim"
ANGLE: str = "angle"
CREATE: str = "CREATE"
DEC_AMMO: str = "dec_ammo"
DEC_HEALTH: str = "dec_health"
DESTROY: str = "DESTROY"
DISTANCE: str = "distance"
FOV: str ... | [
"os.path.split"
] | [((25, 48), 'os.path.split', 'os.path.split', (['__file__'], {}), '(__file__)\n', (38, 48), False, 'import os\n')] |
#M3 -- Meka Robotics Robot Components
#Copyright (c) 2010 Meka Robotics
#Author: <EMAIL> (<NAME>)
#M3 is free software: you can redistribute it and/or modify
#it under the terms of the GNU Lesser General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option)... | [
"m3.joint_array.M3JointArray.__init__"
] | [((999, 1045), 'm3.joint_array.M3JointArray.__init__', 'M3JointArray.__init__', (['self', 'name', 'ndof', 'ctype'], {}), '(self, name, ndof, ctype)\n', (1020, 1045), False, 'from m3.joint_array import M3JointArray\n')] |